Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

PCI-card memory not mapped



Hi Collective Wisdom,
I am trying to port a UNIX driver for a PCI card which works with an OS9 driver (under OS9) but THIS source is not available. So I started to read relevant sources about IOKit including archives here and the excellent intro articles by Godfrey, but run into a problem that I do not understand.
I started with a minimalistic skeleton driver , which matches, and loads just fine. In the start method I make sure my "super" is started, and my provider is an IOPCIDevice

if( !super::start( provider ))
return( result );
assert( OSDynamicCast( IOPCIDevice, provider ));
fPCIDevice = (IOPCIDevice *) provider;

provider is opened:

fPCIDevice->open(this)

however I can't get acces to the card's memory.
The following call returns zero:

fPCIDevice->getDeviceMemoryCount()

as well as

memmap0 = fPCIDevice->getDeviceMemoryWithRegister( kIOPCIConfigBaseAddress0 );
memmap1 = fPCIDevice->getDeviceMemoryWithRegister( kIOPCIConfigBaseAddress1 );

I checked whether the card is in mem map mode or not, and the registers return the following:
Feb 11 15:09:04 In15tt mach_kernel: PCI_COMMAND: 0x14 mem mapped
Feb 11 15:09:04 In15tt mach_kernel: PCI_STATUS: 0x280
Feb 11 15:09:04 In15tt mach_kernel: PCI_REVISION_ID: 0x0
Feb 11 15:09:04 In15tt mach_kernel: PCI_CLASS_CODE: 0x7800000
Feb 11 15:09:04 In15tt mach_kernel: PCI_BASE_ADDRESS_0: 0x80081000
Feb 11 15:09:04 In15tt mach_kernel: PCI_BASE_ADDRESS_1: 0x80090000
Feb 11 15:09:04 In15tt mach_kernel: PCI_BASE_ADDRESS_2: 0x0
Feb 11 15:09:04 In15tt mach_kernel: PCI_BASE_ADDRESS_3: 0x0
Feb 11 15:09:04 In15tt mach_kernel: PCI_INTERRUPT_LINE: 0

Shows we have bar0 and bar1. Under OS9 I dumped the registry explorer which gives

bus 1, dev 2, func 0, reg 0 (Config) rel, 00011000 00000000 00000000
bus 1, dev 2, func 0, reg 16 (Mem) rel, 02011010 00000000 00000800
bus 1, dev 2, func 0, reg 20 (Mem) rel, 02011014 00000000 00004000
bus 1, dev 2, func 0, reg 48 (Mem) rel, 02011030 00000000 00004000

To the best of my understanding this also tells me bar0 @0x10 needs 0x800 and bar1 @0x14 needs 0x4000 memory. IOResgistry explorer under OSX (10.2.3) gives the same information in the "reg" property but just has no IODeviceMemory property! I compared to the registry of an Adaptec SCSI-PCI card and the reg property looks similar but it does have IODeviceMemory.

I tried explicitly clear the 0 bit of the command register either directly or calling
fPCIDevice->setMemoryEnable( true ), before calling getDeviceMemoryWithRegister() but it still returns NULL.

I am out of ideas, what can go wrong? Why the system doesn't recognizes the card memory for mapping while assigning 0x80081000 for bar0 and 0x80090000 for bar1? Should or could I force the mapping somehow? My knowledge on PCI is too weak ( close to zero) to understand what is the reason for failure above. I tried to read the PCI dev kit 3 from Apple, but I did not find and explanation.
A last interesting bit of information:
I started testing the card on a Power Mac 8600 with a G3 upgrade card and a patched OSX 10.2.3. There mapping seemed to work, but started to see unreproducible kernel panics, so switched to 450MHz G4. Ever since no mapping in the G4 Mac.
Also rebooted to OS9 where the card DOES work with the original OS9 driver. So I conclude the card still does work.

thanks for any hint

Bela
_______________________________________________
darwin-drivers mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/darwin-drivers
Do not post admin requests to the list. They will be ignored.



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.