From owner-freebsd-hackers Mon Mar 10 13:27:07 1997 Return-Path: Received: (from root@localhost) by freefall.freebsd.org (8.8.5/8.8.5) id NAA25802 for hackers-outgoing; Mon, 10 Mar 1997 13:27:07 -0800 (PST) Received: from bmcgover-pc.cisco.com (bmcgover-pc.cisco.com [171.69.104.147]) by freefall.freebsd.org (8.8.5/8.8.5) with ESMTP id NAA25779 for ; Mon, 10 Mar 1997 13:26:34 -0800 (PST) Received: from bmcgover-pc.cisco.com (localhost.cisco.com [127.0.0.1]) by bmcgover-pc.cisco.com (8.8.5/8.8.2) with ESMTP id QAA16038; Mon, 10 Mar 1997 16:25:21 -0500 (EST) Message-Id: <199703102125.QAA16038@bmcgover-pc.cisco.com> To: Mark Tinguely , marcio@cyclades.com, hackers@freebsd.org Subject: Re: Question on mapping PCI memory... In-reply-to: Your message of "Mon, 10 Mar 1997 14:47:08 CST." <199703102047.OAA23607@plains.nodak.edu> Date: Mon, 10 Mar 1997 16:25:21 -0500 From: Brian McGovern Sender: owner-hackers@freebsd.org X-Loop: FreeBSD.org Precedence: bulk According to the docs I have, they define the register set as: 0x00 Vendor ID (bits 0-15), device id (bits 16-31) 0x04 Status register/command register 0x08 Rev ID (bits 0-7), Class code (bits 8-31) 0x10 Base Address 1 (Memory address for 9060 controller chip) 0x14 Base Address 2 (Memory address for 512KB memory window) 0x18 Base Address 3 (unused) 0x3C IRQ (0-7) I then have the lines: #define CYZ_PCI_BASE_ADDR1 0x10 /* 9060 Controller memory address */ #define CYZ_PCI_BASE_ADDR2 0x14 /* Memory Window */ #define CYZ_PCI_IRQ 0x3C /* IRQ */ to make the registers easier to work with. I then have a code chunk that does: vm_offset_t paddr, vaddr; if (pci_map_mem(config_id, CYZ_PCI_BASE_ADDR2, &vaddr, &paddr) == 0) { printf("Error mapping shared memory\n"); return; } When run, it complains with: pci_map_mem failed: device's memrange 0xf880-0xf8ff is incompatible with its bridge's memrange 0x2000000-0xffffffff. Also, the routine keeps running, so should I think that pci_map_mem returning 0 on error (as according to pcivar.h) may be incorrect, or is this just considered a warning? Also, based on this message, is it possible that these pointers need to be shifted left by 16 bits, so it fits in the window? In any event, when I try to write to the memory, it has a parity error, and panics. I'm assumeing this is because the memory range really is invalid. Any suggestions? -Brian