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 Saturday, Feb 22, 2003, at 03:00 Europe/Paris, Amanda Walker wrote:


The configuration has not failed. Your driver is responsible for creating the mappings.

I more or less worked around by creating two IOMemoryDescriptors with physical address as read from bar0 and bar1 and sizes of 0x800 and 0x4000 as read out from IORegistry, and call IOMemoryDescriptor's map method which returns an IOMemoryMap. As far as I am today it seems I can talk to the card but I do not know whether am I living dangerously or not... Will my code break when interrupts come into play or DMA?

I would look at an example PCI driver. The "AppleIntel8255x" driver (which you can check out from the Darwin CVS repository) is a good example, since it also shows how to set up DMA and interrupts. Basically, in your start routine you will want to make one or more calls of the form:

IOMemoryMap *map0;
map0 = nub->mapDeviceMemoryWithRegister(kIOPCIConfigBaseAddress0);


I'm afraid you missed my previous mail. In fact the call above returns NULL!! To be more precise:

mapReg0 = fPCIDevice->mapDeviceMemoryWithRegister( kIOPCIConfigBaseAddress0 );
//returns with mapReg0 = NULL

Than if I try:
base0 = fPCIDevice->configRead32(kIOPCIConfigBaseAddress0);
// ok base0 is a valid address, the same that I can see in IORegistry...
IOMemoryDescriptor* memDesc0 = IOMemoryDescriptor::withPhysicalAddress(
(IOPhysicalAddress) base0,
(IOByteCount) 0x800,
kIODirectionOutIn);
// returns a valid memDesc0
if ( memDesc0 != NULL) {
mapReg0 = memDesc0->map(kernel_task,0,(kIOMapAnywhere | kIOMapDefaultCache),0,0);
mapReg0->retain();
}

and bingo I have a valid mapReg0 and my code works. The question is how or why possibly
fPCIDevice->mapDeviceMemoryWithRegister( kIOPCIConfigBaseAddress0 )
fails?


_/ _/ _/ Bela Farago "Hi-Yo c'est l'echo"
_/ _/ _/ mailto:email@hidden
_/ _/ _/ Institut Laue-Langevin
_/ _/ _/ BP:156, 38042 Grenoble Cedex 9, France
_/ _/_/_/_/ _/_/_/_/ tel:(33)(0)4.76.20.73.47 fax:(33)(0)4.76.48.39.06


_/ _/ _/ Bela Farago "Hi-Yo c'est l'echo"
_/ _/ _/ mailto:email@hidden
_/ _/ _/ Institut Laue-Langevin
_/ _/ _/ BP:156, 38042 Grenoble Cedex 9, France
_/ _/_/_/_/ _/_/_/_/ tel:(33)(0)4.76.20.73.47 fax:(33)(0)4.76.48.39.06
_______________________________________________
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: 
 >Re: PCI-card memory not mapped (From: Amanda Walker <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.