Mailing Lists: Apple Mailing Lists

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

Re: PCI-card memory not mapped



On Sunday, February 16, 2003, at 07:12 AM, B. Farago wrote:

> 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 );

This is what I do in my code (note by the time this is called the pci
nub is already opened by my super class, under the new SCSI family).

if ( ( m_pciNub = OSDynamicCast( IOPCIDevice, GetProvider() ) ) == NULL
)
{
FTSWDBG_LOGIF( FTSWQLA_ERRORS,
("(%p)qla_hba::InitializeController - provider is
not IOPCIDevice\n",
(void*)this ));

errorCode = 1;
goto abortInit;
}

... from a lower function ...

m_ispMap = pciNub->mapDeviceMemoryWithRegister(
kIOPCIConfigBaseAddress1 );
if ( m_ispMap == NULL )
return false;

m_isp = (isp_registers*) m_ispMap->getVirtualAddress();
pciNub->setBusMasterEnable(true);
pciNub->setMemoryEnable(true);
pciNub->setIOEnable(false);

The above has always worked fine for me against a large family of
adapter made by QLogic. It looks similar to you code snippet.

> 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

[snip]

I will need to probe my adapter(s) to see what the config space looks
like for comparison (not currently setup to do that).

> 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.

Trying to get my PCI config space knowledge out of moths balls in the
back of my head... don't see anything obvious at the moment (maybe
after some more coffee).

> 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.

Humm... (off to get another cup of coffee)

-Shawn
_______________________________________________
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.

References: 
 >PCI-card memory not mapped (From: "B. Farago" <email@hidden>)



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.