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: ordering calls to driver's ::start() routine?



On Monday, February 4, 2002, at 01:29 PM, Andrew Gallatin wrote:

I'm working on an IOKit driver for a PCI device. I'm matching on
device id / vendor id in info.plist.

All was well until I added a second card to the machine (dual g4).
When I did this, I noticed that my start() routine was being called in
parallel. This is bad because all units share some common data. To
fix this, I "locked" the start routine.

However, I'm now having a problem where the start() routine is
called in a somewhat random order. By this I mean that most times
<device>@12 makes it into the start() routine first, but sometimes
<device>@14 wins the race. This is a problem because the first
device through my start() routine ends up as unit 0, the second as
unit 1, etc. I'd really like to keep these unit numbers
consistant across reboots.

Is there an easy way to make this deterministic?

My understand of the IOKit startup/device discovery scheme is that it is, by design, non-deterministic. This has been the subject of a fair amount of discussion on various lists. The disk and networking devices suffer from this same malaise, and the only way around it is to provide some "domain-specific" namer if you need persistent naming.

For networking devices, this is done by the IPConfiguration plugin for configd. This code names keeps track (in the SystemConfiguration database, /var/db/SystemConfiguration/preferences.xml) of known devices and tries to assign a name to a device based on a known property. It always names the 'built-in ethernet' as "en0"; and tries to name Airport as "en1" (this fails if you change the card, currently). For others, it relies on the MAC address as the 'discriminator'.

I don't know whether the device "path name", or some other property, will work in your case, but for each new class of device, you'll need to provide a namer. I don't know enough about the IOKit hierarchy to know where that namer takes effect, in general.

Regards,

Justin

--
/~\ The ASCII Justin C. Walker, Curmudgeon-at-Large
\ / Ribbon Campaign
X Help cure HTML Email
/ \


References: 
 >ordering calls to driver's ::start() routine? (From: Andrew Gallatin <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.