Re: File Access with VFS
Re: File Access with VFS
- Subject: Re: File Access with VFS
- From: Michael Cashwell <email@hidden>
- Date: Fri, 11 Apr 2003 21:00:01 -0400
Greetings all,
I feel the need to chime in here. I worked on a Darwin / MacOS X driver
for Lucent -> Agere Orinoco cards. (There was little company support
for the project, it was never finished, and I no longer work there.)
But I also wrote the last major update to the MacOS 8/9 version (March
of 2002) and one of the features was this sort of firmware download.
I cannot speak to the architecture of the cards in question but in the
Orinoco case there was a shift to downloading the firmware into RAM and
not messing with the FLASH. (The code runs out of RAM anyway for
performance reasons.) If your card is similar then do keep in mind that
the power to PC Card / Cardbus slots is cut off when the host system
sleeps. And even if it weren't, the user can pull the card out (and
swap it with another) while asleep!
So assuming the OpenFirmware case is out of the running (as it sounds)
and the firmware runs out of card RAM this focus on "boot time" is
somewhat misplaced. While the kext indeed needs to load the firmware
during system boot, the trigger for this (IOKit matching) is
essentially identical to what needs to happen when the card is
hot-inserted or merely present when waking from sleep. All three cases
should be covered by a unified technique which of necessity needs to be
mostly independent of system boot and StartupItems. (That may be one
way to get the firmware into the kernel space without reading a file
within the kernel but you'd have to hold it there to deal with the
other cases.)
That said, everything Godfrey said below makes sense to me. Just don't
get overly focused on system boot time since that's not really the
issue.
Best of luck!
Michael Cashwell
On Friday, April 11, 2003, at 02:50 PM, Godfrey van der Linden wrote:
Actually Scott,
This is good news.
There are 3 major phases in a boot.
1> The firmware. For a driver to work here it MUST have an open
firmware driver, i.e. Forth The firmware is actually 2 phases as
well. First the rom loads the OS relocator and loader, i.e. the OS
Booter. The OSBooter then loads the kernel and all drivers (kexts)
that claim to be required i.e. all drivers that have the appropriate
OSBundleRequired settings.
2> The boot to single user. This phase of the boot starts the OS
proper up, i.e. VM, threading and Unix Init, and brings enough of the
system up to mount the root device, usually the disk but if we have a
firmware enabled network driver then we can 'netboot'. This part of
the boot is what I was loosely calling the boot and where we are
confusing nomenclature.
3> The remainder of the boot to multi-user, aka login window. This
phase does many jobs but briefly it loads all drivers that aren't
required for the root device or single user. Then it mounts the
non-root filesystems and starts the networking up.
So stage three is still a boot loaded driver but it isn't the same as
being required for rooting, sorry for the confusion.
Stage three is where your driver is should load. Fortunately IOKit is
designed for exactly this phase. Load you driver normally as a 'late'
loadable kext. Then setup a StartupItem, see
/System/Library/StartupItems for an example on how do to this.
I recommend using the IOService::setProperties subclass to get the
load the firmware.
Your driver will overload this function, and your startup script will
discover the driver in the registry and send down a firmware by using
the IORegistryEntrySetCFProperties() function. The data will be read
into your helper APPs memory, or mapped if you wish to use mmap().
Then you wrap the address in a CFData object. In the kernel you grab
the corresponding OSData object and create an IOMemoryDescriptor for
the current_task() in your setProperty.
There is an example of a simple implementation of
IOService::setProperties in the IOSerialFamily/IOSerialBSDClient.cpp.
Yes this example is a User Client but remember that the setProperties
call can be passed to ANY object in the registry.
I know I have been a little handwavy in my descriptions here. This
technique will work but you will have to do some research. If you
have any questions don't hesitate.
Godfrey
At 11:25 -0700 03-4-11, Scott Lance wrote:
The device is a 802.11g cardbus adapter. No I don't think that this
driver
is netbootable, as for the firmware, I didn't write it, it was
obtained from
the company who made the chip (as will be all the updates). In
anycase I
would like to be able to turn on my laptop with the card in and have
it load
during boot time (as for it being required, yes it is, and well lets
just
say I don't make those decisions) ;)
_______________________________________________
darwin-kernel mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/darwin-kernel
Do not post admin requests to the list. They will be ignored.
_______________________________________________
darwin-kernel mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/darwin-kernel
Do not post admin requests to the list. They will be ignored.