Date: Mon, 10 Mar 1997 15:21:12 -0800 From: Marcio Saito <marcio@cyclades.com> To: Brian McGovern <bmcgover@cisco.com> Cc: Mark Tinguely <tinguely@plains.nodak.edu>, hackers@freebsd.org Subject: Re: Question on mapping PCI memory... Message-ID: <33249768.7287@cyclades.com> References: <199703102125.QAA16038@bmcgover-pc.cisco.com>
next in thread | previous in thread | raw e-mail | index | archive | help
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
----------------------------------------------------------------------
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?33249768.7287>
