From owner-freebsd-hackers Mon Mar 10 15:15:58 1997 Return-Path: Received: (from root@localhost) by freefall.freebsd.org (8.8.5/8.8.5) id PAA06040 for hackers-outgoing; Mon, 10 Mar 1997 15:15:58 -0800 (PST) Received: from main.cyclades.com (root@main.cyclades.com [208.138.19.2]) by freefall.freebsd.org (8.8.5/8.8.5) with ESMTP id PAA06035 for ; Mon, 10 Mar 1997 15:15:56 -0800 (PST) Received: from main.cyclades.com ([208.138.19.230]) by main.cyclades.com with smtp id m0w4EI5-000SizC (Debian Smail-3.2 1996-Jul-4 #2); Mon, 10 Mar 1997 15:15:37 -0800 (PST) Message-ID: <33249768.7287@cyclades.com> Date: Mon, 10 Mar 1997 15:21:12 -0800 From: Marcio Saito Reply-To: marcio@cyclades.com Organization: Cyclades Corporation X-Mailer: Mozilla 3.0 (Win95; I) MIME-Version: 1.0 To: Brian McGovern CC: Mark Tinguely , hackers@freebsd.org Subject: Re: Question on mapping PCI memory... References: <199703102125.QAA16038@bmcgover-pc.cisco.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-hackers@freebsd.org X-Loop: FreeBSD.org Precedence: bulk Brian McGovern wrote: > > 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) This is defined for each particular PCI device. For the PLX9060 (the PCI bridge chip we use), we have: 0x10 - 9060 registers (memory mapped) 0x14 - 9060 registers (I/O mapped) 0x18 - 512kb memory window. (the PXL chip registers can be accessed either through memory or I/O addressing). > 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. 0xf880 is probably an I/O address. 0x18 is the offset associated to the memory window. Marcio. > 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 -- ---------------------------------------------------------------------- Marcio Saito e-mail: marcio@cyclades.com SW Engineer/Product Manager phone: (510)770-9727 x214 Cyclades Corporation fax: (510)770-0355 ----------------------------------------------------------------------