Porting code from the Linux ibm-acpi sourceforge package
Nate Lawson
nate at root.org
Sun May 8 13:46:40 PDT 2005
Takanori Watanabe wrote:
> In message <20050508024448.A943 at cons.org>, Martin Cracauer さんいわく:
>
>>Hi,
>>
>>I reinstalled my Thinkpad R40 with FreeBSD-5-stable. Works very well
>>except for video corruption on sleep and that I miss some ACPI
>>functionality I had with the ibm-acpi package under Linux.
>
>
> Some functionalies are implimented in acpi_ibm.
In particular, sys/dev/acpi_support/acpi_ibm.c
If you want to update that, it would be good since Linux appears to have
reverse engineered more capabilities recently.
>>More specifically, I would like to port or reimplement some parts of
>>it, and I would like to start with the code to eject and re-mount the
>>ultrabay devices.
>>
>>I have the Linux code in front of me which is showing, for the example
>>of the basic bay identifier and the eject code:
>>
>>IBM_HANDLE(bay, root,
>> "\\_SB.PCI.IDE.SECN.MAST", /* 570 */
>> "\\_SB.PCI0.IDE0.IDES.IDSM", /* 600e/x, 770e, 770x */
>> "\\_SB.PCI0.IDE0.SCND.MSTR", /* all others */
>>); /* A21e, R30, R31 */
>>IBM_HANDLE(bay_ej, bay,
>> "_EJ3", /* 600e/x, A2xm/p, A3x */
>> "_EJ0", /* all others */
>>); /* 570,A21e,G4x,R30,R31,R32,R40e,R50e */
>
> But eject handling is not supported .
There is a lot of work to do here and not much of it has to do with
ACPI. I have a patch for ACPI eject support that I'll post again some
time. But it is not usable since many device drivers don't support
eject. For instance, our ATA driver did not support detach until the
recent mkIII import. I'm not sure if it supports forced detach yet.
Going up a level, I'm not sure how our filesystem drivers would support
a drive disappearing out from under them. If you want to contribute, I
think a good first step is adding a testing SYSCTL_PROC that calls
device_detach(devclass_get_device(devclass_find("acd"), 0)) and then
running it to see if it works.
Linux doesn't yet implement a proper device tree (although they're
getting better). So they have to have lots of hacks like these handle
arrays to figure out what to eject. In FreeBSD, the ACPI side is very
simple -- you get a notify, take the passed in handle, and call the
associated device_t's detach routine. That's what my patch does. No
hardcoded paths.
--
Nate
More information about the freebsd-acpi
mailing list