| |||
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] |
Message: 1
Date: Sun, 22 Dec 2002 03:33:54 -0500
Subject: PCIATA driver matching
From: Ernesto Corvi <email@hidden>
To: email@hidden
I'm fudging with a ATA PCI adapter here, and there's something
regarding the IOKit ATA family that
I don't quite follow. The hardware is a 2 channel ATA/100 PCI card. So
I wrote 2 classes:
com.bleh.ata.controller derived from IOService whose requested provider
is a IOPCIDevice.
com.bleh.ata.driver derived from IOPCIATA whose requested provider is a
com.bleh.ata.controller.
The .controller class uses the standard IOPCIMatch against the
vendor/device id. Once the match
happens, it creates .driver nubs, one per channel, calls the init
function on the .driver, attaches the nub
to the .controller class, and finally calls registerService on the nub.
So far so good. The problem is that after running it, the start()
function on the .driver never happens,
as if nothing is matched against it. So I end up with a IO registry
like this:
+--- pci1234,12 <class IOPCIDevice>
{ ... }
|
+--- com.bleh.ata.controller <class com.bleh.ata.controller>
{ ... }
|
+ --- com.bleh.ata.driver <class com.bleh.ata.driver>
| { ... }
+ --- com.bleh.ata.driver <class com.bleh.ata.driver>
{ ... }
So, my question is what do I need to match the 'com.bleh.ata.driver'
against so it gets started and I get to
spawn the IOATADevice nubs? Can it be anything? What is anything? Can I
call start() directly?
Oh, one bug? I found while writing this is that when calling the init()
function on my .driver class, after
creating an instance of it with 'new', if I try to IOLog( "%s init",
getName() ); as the first piece of code on the
init() routine, it will cause a kernel panic everytime. The culprit
being getName() for some reason.
TIA,
Ernesto.
--__--__--
Message: 2
Date: Sun, 22 Dec 2002 10:54:01 -0800
Subject: Re: PCIATA driver matching
Cc: email@hidden
To: Ernesto Corvi <email@hidden>
From: Eric Brown <email@hidden>
On Sunday, December 22, 2002, at 12:33 AM, Ernesto Corvi wrote:
I'm fudging with a ATA PCI adapter here, and there's something> provider is a IOPCIDevice.
regarding the IOKit ATA family that
I don't quite follow. The hardware is a 2 channel ATA/100 PCI card. So
I wrote 2 classes:
com.bleh.ata.controller derived from IOService whose requestedcom.bleh.ata.driver derived from IOPCIATA whose requested provider is
a com.bleh.ata.controller.
The .controller class uses the standard IOPCIMatch against the
vendor/device id. Once the match
happens, it creates .driver nubs, one per channel, calls the init
function on the .driver, attaches the nub
to the .controller class, and finally calls registerService on the nub.
So far so good. The problem is that after running it, the start()
function on the .driver never happens,
as if nothing is matched against it. So I end up with a IO registry
like this:
+--- pci1234,12 <class IOPCIDevice>
{ ... }
|
+--- com.bleh.ata.controller <class com.bleh.ata.controller>
{ ... }
|
+ --- com.bleh.ata.driver <class com.bleh.ata.driver>
| { ... }
+ --- com.bleh.ata.driver <class com.bleh.ata.driver>
{ ... }
So, my question is what do I need to match the 'com.bleh.ata.driver'
against so it gets started and I get to
spawn the IOATADevice nubs? Can it be anything? What is anything? Can
I call start() directly?
It is the responsibility of the code that allocates the IOService
instance to do everything necessary to start the driver (i.e. init(),
attach(), start()). So if you depend on IOKit matching to create your
driver instance, IOKit will take care of it since it allocated your
class. However if you are allocating nubs yourself, it is your
responsibility for calling start(). To make that easier, there's an
IOService function startCandidate() that will call both attach() and
start() on your nub. It will also clean up by calling detach() if
start() fails.
Also, since you are creating your driver nubs, there is no need to set
up matching criteria for them. That is only needed for cases like your
controller class that need to be automatically created.
Oh, one bug? I found while writing this is that when calling the
init() function on my .driver class, after
creating an instance of it with 'new', if I try to IOLog( "%s init",
getName() ); as the first piece of code on the
init() routine, it will cause a kernel panic everytime. The culprit
being getName() for some reason.
Definitely seems like a bug. I believe that the name information comes
from the registry, so it might be that getName() will fail until the
service has been attached to its provider. But calling getName()
should never cause a panic().
- Eric
--__--__--
| Home | Archives | FAQ | Terms/Conditions | Contact | RSS | Lists | About |
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.