Mailing Lists: Apple Mailing Lists

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

Problems with driver on G5



Hi,

I'm writing a driver for a PCI ATA card, and am really stuck on what
seems like a simple problem.

Here is my code in configureTFPointers:



_busMasterMap = getProvider()->mapDeviceMemoryWithIndex( 4 );
if( !_busMasterMap)
{
DLOG("NetCellATADriver: Couldn't get Bus Master address\n");
return false;
}

volatile UInt8* busMasterAddress = 0;
busMasterAddress = (volatile
UInt8*)_busMasterMap->getVirtualAddress();
if( !busMasterAddress )
{
DLOG("NetCellATADriver: No bus Master Map address\n");
return false;
}

//Bus Master (for DMA) baseAddresses
_bmCommandReg = busMasterAddress;
_bmStatusReg = busMasterAddress + 2; //2 bytes later
_bmPRDAddresReg = (volatile UInt32*) (busMasterAddress +
4); //another 2 bytes
//_mrdModeReg = busMasterAddress + 1;
//_udideTCR0 = busMasterAddress + 3;

// clear the edge-trigger bit
*_bmStatusReg = 0x04;

DLOG("Now I show bmStatusReg = %x", *_bmStatusReg);
OSSynchronizeIO();
DLOG(" and now I show bmStatusReg = %x\n", *_bmStatusReg);


Now the problem is that this code works on a G4, but something is
broken on the G5. When I run it on the G4, I get the two DLOG
statements returning 0x80 (a good status), but when I run it on the G5
I only get 0xFF. It's as if the statusRegister isn't being properly
wired to the card.

I've looked at the TN2090
(http://developer.apple.com/technotes/tn/tn2090.htm) but I don't think
it applies to my code (most of what I have is taken from apple's
opensource drivers, and they don't use prepare in them).

Does anyone have any suggestions as to where I should look? I've
narrowed down the problem so much, but I don't know where to go from
here.



Another question, but this one is really just a C question, so somewhat
off-topic.
My configureTFPointers, taken from CMD646ATA has this format:

_tfFeatureReg = baseAddress + 0x01;
_tfSCountReg = baseAddress + 0x02;
_tfSectorNReg = baseAddress + 0x03;

but apple's K2SATA drivers use as offsets
_tfFeatureReg = baseAddress + 0x04;
_tfSCountReg = baseAddress + 0x08;
_tfSectorNReg = baseAddress + 0x0C;

It seems to me like these shouldn't both work (they both are accessing
the hard drive Task Files, so I think the physical locations are the
same) and baseAddress is defined the same way in both files (volatile
UInt8 *). The reason I ask is because only the first way works for my
code, but it seems that since each Register is 4 bytes, increments
should be in 4's not 1's which makes me think it's using the size of
the pointer, which would be changing from G4 to G5. (Although I was
able to make PIO work, so this may be a wild goose chase).

Thanks for all help,

Matt Gillette
_______________________________________________
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.