Subject: Re: 64-bit memory fun with an adaptec 3950U2B..
To: Bill Studenmund <wrstuden@nas.nasa.gov>
From: Chris G. Demetriou <cgd@netbsd.org>
List: tech-kern
Date: 03/13/2000 18:13:47
Bill Studenmund <wrstuden@nas.nasa.gov> writes:
> On line 157 of pci_map.c, the following switch statement starts:
> 
>         switch (PCI_MAPREG_MEM_TYPE(address)) {
>         case PCI_MAPREG_MEM_TYPE_32BIT:
>         case PCI_MAPREG_MEM_TYPE_32BIT_1M:
>                 break;
>         case PCI_MAPREG_MEM_TYPE_64BIT:
>                 printf("pci_mem_find: 64-bit memory mapping register\n");
>                 return (1);
>         default:
>                 printf("pci_mem_find: reserved mapping register type\n");
>                 return (1);
>         }
> [ ... ]
> So what do we do to fix this? We NEED to have this card work. :-) Apple's
> been shipping them in machines for like a year, and they will definitly
> get a performance boost with the 64-bit bus. :-)

Well, obviously, fix it!  8-)


at the very minimum, you'll need to:

	* make sure bus_addr_t is 64-bits wide, and you might want
	  bus_size_t to be as well.

	* follow the PCI spec for decoding 64-bit BARs.  it's fairly
	  simple.

i think i would:

* do what the code does now as to checking for size.

* if 64-bit, and the second part of the BAR (i.e. the register address
for the second 32-bits) is in range, get the second addr/mask as the
first is gotten.

* do the MEM_ADDR/MEM_SIZE on the low 32-bit words, and put them into
temporary 64 bit wide variables.

* if 64-bit BAR, shift/or the second parts (addr/mask) of the BAR into
the temp variables.  (I'm not if the upper 32-bits of size are valid,
etc.  it's been a while since i've read that hunk of the spec.)


do the basep/sizep assignments, and if you do them and if *basep !=
tmp_address print a warning and fail, or if *sizep != tmp_size print a
warning and fail.


cgd	  
-- 
Chris Demetriou - cgd@netbsd.org - http://www.netbsd.org/People/Pages/cgd.html
Disclaimer: Not speaking for NetBSD, just expressing my own opinion.