| Summary: | [acpi] acpi_hp not working when loaded via loader.conf | ||||||
|---|---|---|---|---|---|---|---|
| Product: | Base System | Reporter: | Maciej Suszko <maciej> | ||||
| Component: | kern | Assignee: | Andriy Gapon <avg> | ||||
| Status: | Closed FIXED | ||||||
| Severity: | Affects Only Me | ||||||
| Priority: | Normal | ||||||
| Version: | Unspecified | ||||||
| Hardware: | Any | ||||||
| OS: | Any | ||||||
| Attachments: |
|
||||||
|
Description
Maciej Suszko
2010-06-14 21:50:01 UTC
State Changed From-To: open->feedback Maciej, please provide a verbose boot dmesg when acpi_hp is loaded from loader(8) Responsible Changed From-To: freebsd-bugs->freebsd-acpi Over to maintainer(s). Hm, acpi_hp seems to be quite bad in newbus department. It doesn't have an identify method to create a device_t for its use and its probe method would claim any device_t passed in. So, it doesn't have any actual provision to get probed/attached after acpi_wmi and it can potentially wrek havoc by claiming device_t which should be handled by some other driver. I guess that I "broke" this driver when I removed second pass of probe+attach of acpi bus children, but it is the driver that should be fixed. -- Andriy Gapon Could originator and other people having the problem please test the attached patch and followup to the PR? Thanks! The patch is only compile-tested by me, because I don't have the hardware. So you might experience crashes or other surprising behavior. But I hope that you won't. -- Andriy Gapon Andriy Gapon <avg@icyb.net.ua> wrote: > > Could originator and other people having the problem please test the > attached patch and followup to the PR? > Thanks! > > The patch is only compile-tested by me, because I don't have the > hardware. So you might experience crashes or other surprising > behavior. But I hope that you won't. Thanks, now it's working again. Device is present and readable, no crashes or any unexpected behavior... at least for now. -- regards, Maciej Suszko. on 04/09/2010 22:33 Maciej Suszko said the following:
> Andriy Gapon <avg@icyb.net.ua> wrote:
>>
>> Could originator and other people having the problem please test the
>> attached patch and followup to the PR?
>> Thanks!
>>
>> The patch is only compile-tested by me, because I don't have the
>> hardware. So you might experience crashes or other surprising
>> behavior. But I hope that you won't.
>
> Thanks, now it's working again. Device is present and readable, no
> crashes or any unexpected behavior... at least for now.
Thank you very much for testing!
Could you please share verbose dmesg just in case?
Thanks!
--
Andriy Gapon
Author: avg Date: Mon Sep 6 07:34:32 2010 New Revision: 212251 URL: http://svn.freebsd.org/changeset/base/212251 Log: acpi_hp: fix bus attachment code - add identify method to create driver's own device_t - successfully probe only driver's own device_t instead of any device_t - (ab)use device order to hopefully be probed/attached after acpi_wmi PR: kern/147858 Tested by: Maciej Suszko <maciej@suszko.eu> MFC after: 1 week Modified: head/sys/dev/acpi_support/acpi_hp.c Modified: head/sys/dev/acpi_support/acpi_hp.c ============================================================================== --- head/sys/dev/acpi_support/acpi_hp.c Mon Sep 6 07:24:43 2010 (r212250) +++ head/sys/dev/acpi_support/acpi_hp.c Mon Sep 6 07:34:32 2010 (r212251) @@ -49,6 +49,7 @@ __FBSDID("$FreeBSD$"); #include <sys/uio.h> #include <sys/proc.h> #include <sys/kernel.h> +#include <sys/limits.h> #include <sys/bus.h> #include <sys/sbuf.h> #include <sys/module.h> @@ -116,7 +117,6 @@ struct acpi_hp_inst_seq_pair { struct acpi_hp_softc { device_t dev; - ACPI_HANDLE handle; device_t wmi_dev; int has_notify; /* notification GUID found */ int has_cmi; /* CMI GUID found */ @@ -289,6 +289,7 @@ static struct { ACPI_SERIAL_DECL(hp, "HP ACPI-WMI Mapping"); +static void acpi_hp_identify(driver_t *driver, device_t parent); static int acpi_hp_probe(device_t dev); static int acpi_hp_attach(device_t dev); static int acpi_hp_detach(device_t dev); @@ -320,6 +321,7 @@ static struct cdevsw hpcmi_cdevsw = { }; static device_method_t acpi_hp_methods[] = { + DEVMETHOD(device_identify, acpi_hp_identify), DEVMETHOD(device_probe, acpi_hp_probe), DEVMETHOD(device_attach, acpi_hp_attach), DEVMETHOD(device_detach, acpi_hp_detach), @@ -405,7 +407,7 @@ acpi_hp_evaluate_auto_on_off(struct acpi "WLAN on air changed to %i " "(new_wlan_status is %i)\n", sc->was_wlan_on_air, new_wlan_status); - acpi_UserNotify("HP", sc->handle, + acpi_UserNotify("HP", ACPI_ROOT_OBJECT, 0xc0+sc->was_wlan_on_air); } } @@ -420,7 +422,7 @@ acpi_hp_evaluate_auto_on_off(struct acpi " to %i (new_bluetooth_status is %i)\n", sc->was_bluetooth_on_air, new_bluetooth_status); - acpi_UserNotify("HP", sc->handle, + acpi_UserNotify("HP", ACPI_ROOT_OBJECT, 0xd0+sc->was_bluetooth_on_air); } } @@ -433,16 +435,43 @@ acpi_hp_evaluate_auto_on_off(struct acpi "WWAN on air changed to %i" " (new_wwan_status is %i)\n", sc->was_wwan_on_air, new_wwan_status); - acpi_UserNotify("HP", sc->handle, + acpi_UserNotify("HP", ACPI_ROOT_OBJECT, 0xe0+sc->was_wwan_on_air); } } } +static void +acpi_hp_identify(driver_t *driver, device_t parent) +{ + + /* Don't do anything if driver is disabled. */ + if (acpi_disabled("hp")) + return; + + /* Add only a single device instance. */ + if (device_find_child(parent, "acpi_hp", -1) != NULL) + return; + + /* Make sure acpi_wmi driver is present. */ + if (devclass_find("acpi_wmi") == NULL) + return; + + /* + * Add our device with late order, so that it is hopefully + * probed after acpi_wmi. + * XXX User proper constant instead of UINT_MAX for order. + */ + if (BUS_ADD_CHILD(parent, UINT_MAX, "acpi_hp", -1) == NULL) + device_printf(parent, "add acpi_hp child failed\n"); +} + static int acpi_hp_probe(device_t dev) { - if (acpi_disabled("hp") || device_get_unit(dev) != 0) + + /* Skip auto-enumerated devices from ACPI namespace. */ + if (acpi_get_handle(dev) != NULL) return (ENXIO); device_set_desc(dev, "HP ACPI-WMI Mapping"); @@ -460,7 +489,6 @@ acpi_hp_attach(device_t dev) sc = device_get_softc(dev); sc->dev = dev; - sc->handle = acpi_get_handle(dev); sc->has_notify = 0; sc->has_cmi = 0; sc->bluetooth_enable_if_radio_on = 0; @@ -477,7 +505,7 @@ acpi_hp_attach(device_t dev) sc->verbose = 0; memset(sc->cmi_order, 0, sizeof(sc->cmi_order)); - if (!(wmi_devclass = devclass_find ("acpi_wmi"))) { + if (!(wmi_devclass = devclass_find("acpi_wmi"))) { device_printf(dev, "Couldn't find acpi_wmi devclass\n"); return (EINVAL); } _______________________________________________ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org" on 04/09/2010 23:29 Maciej Suszko said the following:
> No problem, dmesg.boot attached.
Well, it's usually better to upload such a big file to some site/service and
post a link.
The attachment looks quite garbled on the PR web-page too.
But, still, thanks!
--
Andriy Gapon
State Changed From-To: feedback->analyzed Taking this one. The issue is patched in head, but I am working on a better patch. Responsible Changed From-To: freebsd-acpi->avg Taking this one. The issue is patched in head, but I am working on a better patch. Maciej, would you be willing to test a different, hopefully better, patch? The patch is here: http://people.freebsd.org/~avg/acpi_hp2.diff The patch is against clean source tree (i.e. previous patch would need to be reverted). This time you would need to rebuild both acpi_hp and acpi_wmi modules. As usual, could you please post a link to verbose dmesg after the patch? Thanks a lot for your help! -- Andriy Gapon Andriy Gapon <avg@freebsd.org> wrote: > Maciej, > > would you be willing to test a different, hopefully better, patch? > The patch is here: > http://people.freebsd.org/~avg/acpi_hp2.diff > The patch is against clean source tree (i.e. previous patch would > need to be reverted). I tried to apply this patch against fresh RELENG_8_1 and RELENG_8 sources - it does not apply cleanly on acpi_hp.c. Here's what is left in acpi_hp.c.rej (patched against RELENG_8): *************** *** 453,466 **** acpi_hp_attach(device_t dev) { struct acpi_hp_softc *sc; - devclass_t wmi_devclass; int arg; ACPI_FUNCTION_TRACE((char *)(uintptr_t) __func__); sc = device_get_softc(dev); sc->dev = dev; - sc->handle = acpi_get_handle(dev); sc->has_notify = 0; sc->has_cmi = 0; sc->bluetooth_enable_if_radio_on = 0; --- 468,479 ---- acpi_hp_attach(device_t dev) { struct acpi_hp_softc *sc; int arg; ACPI_FUNCTION_TRACE((char *)(uintptr_t) __func__); sc = device_get_softc(dev); sc->dev = dev; sc->has_notify = 0; sc->has_cmi = 0; sc->bluetooth_enable_if_radio_on = 0; I tried to edit source file manualy, compiled both modules but the result was as on clean sources - acpi_hp/wmi not working when loaded during boot. > This time you would need to rebuild both acpi_hp and acpi_wmi modules. > As usual, could you please post a link to verbose dmesg after the > patch? > > Thanks a lot for your help! -- regards, Maciej Suszko. on 09/09/2010 22:36 Maciej Suszko said the following: > I tried to apply this patch against fresh RELENG_8_1 and RELENG_8 > sources - it does not apply cleanly on acpi_hp.c. Sorry about this, I overlooked that some changes in head were not MFC-ed to stable/8. Here's a better patch: > I tried to edit source file manualy, compiled both modules but the > result was as on clean sources - acpi_hp/wmi not working when loaded > during boot. I hope you just removed those two lines. Even if it did not succeed, could you still please provide a link to the verbose dmesg, so that I could analyze what went wrong? Thanks! -- Andriy Gapon Andriy Gapon <avg@freebsd.org> wrote: > on 09/09/2010 22:36 Maciej Suszko said the following: > > I tried to apply this patch against fresh RELENG_8_1 and RELENG_8 > > sources - it does not apply cleanly on acpi_hp.c. > > Sorry about this, I overlooked that some changes in head were not > MFC-ed to stable/8. > Here's a better patch: Did you forget to paste it? > > I tried to edit source file manualy, compiled both modules but the > > result was as on clean sources - acpi_hp/wmi not working when loaded > > during boot. > > I hope you just removed those two lines. > Even if it did not succeed, could you still please provide a link to > the verbose dmesg, so that I could analyze what went wrong? > Thanks! Anyway - I just patched RELENG_8 sources with acpi_hp2.diff and removed those two lines. Full dmesg is available here: http://pastebin.com/kdVsn1SR -- regards, Maciej Suszko. on 10/09/2010 17:59 Maciej Suszko said the following: > Andriy Gapon <avg@freebsd.org> wrote: >> on 09/09/2010 22:36 Maciej Suszko said the following: >>> I tried to apply this patch against fresh RELENG_8_1 and RELENG_8 >>> sources - it does not apply cleanly on acpi_hp.c. >> >> Sorry about this, I overlooked that some changes in head were not >> MFC-ed to stable/8. >> Here's a better patch: > > Did you forget to paste it? Oh my, yes I did. Here is the link: http://people.freebsd.org/~avg/acpi_hp3.diff >>> I tried to edit source file manualy, compiled both modules but the >>> result was as on clean sources - acpi_hp/wmi not working when loaded >>> during boot. >> >> I hope you just removed those two lines. >> Even if it did not succeed, could you still please provide a link to >> the verbose dmesg, so that I could analyze what went wrong? >> Thanks! > > Anyway - I just patched RELENG_8 sources with acpi_hp2.diff and removed > those two lines. Full dmesg is available here: > > http://pastebin.com/kdVsn1SR I just have to ask this, are you positive that you have acpi_wmi.c patched, and acpi_wmi.ko rebuilt and reinstalled? -- Andriy Gapon Andriy Gapon <avg@freebsd.org> wrote: > on 10/09/2010 17:59 Maciej Suszko said the following: > > Andriy Gapon <avg@freebsd.org> wrote: > >> on 09/09/2010 22:36 Maciej Suszko said the following: > >>> I tried to apply this patch against fresh RELENG_8_1 and RELENG_8 > >>> sources - it does not apply cleanly on acpi_hp.c. > >> > >> Sorry about this, I overlooked that some changes in head were not > >> MFC-ed to stable/8. > >> Here's a better patch: > > > > Did you forget to paste it? > > Oh my, yes I did. > Here is the link: > http://people.freebsd.org/~avg/acpi_hp3.diff Thanks for then next patch - it applies cleanly right now. > >>> I tried to edit source file manualy, compiled both modules but the > >>> result was as on clean sources - acpi_hp/wmi not working when > >>> loaded during boot. > >> > >> I hope you just removed those two lines. > >> Even if it did not succeed, could you still please provide a link > >> to the verbose dmesg, so that I could analyze what went wrong? > >> Thanks! > > > > Anyway - I just patched RELENG_8 sources with acpi_hp2.diff and > > removed those two lines. Full dmesg is available here: > > > > http://pastebin.com/kdVsn1SR > > I just have to ask this, are you positive that you have acpi_wmi.c > patched, and acpi_wmi.ko rebuilt and reinstalled? If it's not more than doing make obj depend && make && make install in sys/modules/acpi_(wmi|hp) - yes, I'm sure of that. Here's the next dmesg.boot after applying acpi_hp3.diff, unfortunately still not working as it should: http://pastebin.com/68sauZNe -- regards, Maciej Suszko. on 10/09/2010 21:12 Maciej Suszko said the following:
> If it's not more than doing make obj depend && make && make install in
> sys/modules/acpi_(wmi|hp) - yes, I'm sure of that. Here's the next
> dmesg.boot after applying acpi_hp3.diff, unfortunately still not
> working as it should:
Hmm, I am puzzled.
Can you please add printfs in acpi_wmi_attach before and after calls to
bus_generic_probe and bus_generic_attach?
And also at the start and the end of acpi_hp_identify.
And then check which of the messages get printed and which are not?
--
Andriy Gapon
on 10/09/2010 21:37 Andriy Gapon said the following:
> on 10/09/2010 21:12 Maciej Suszko said the following:
>> If it's not more than doing make obj depend && make && make install in
>> sys/modules/acpi_(wmi|hp) - yes, I'm sure of that. Here's the next
>> dmesg.boot after applying acpi_hp3.diff, unfortunately still not
>> working as it should:
>
> Hmm, I am puzzled.
> Can you please add printfs in acpi_wmi_attach before and after calls to
> bus_generic_probe and bus_generic_attach?
> And also at the start and the end of acpi_hp_identify.
> And then check which of the messages get printed and which are not?
>
Oh, and when you do this, could you please also add the following three lines to
acpi_wmi_methods[] after "Device interface" block and before "acpi_wmi
interface" block?
/* bus interface */
DEVMETHOD(bus_add_child, bus_generic_add_child),
DEVMETHOD(bus_print_child, bus_generic_print_child),
I think that this could be the culprit.
--
Andriy Gapon
Andriy Gapon <avg@freebsd.org> wrote: > on 10/09/2010 21:37 Andriy Gapon said the following: > > on 10/09/2010 21:12 Maciej Suszko said the following: > >> If it's not more than doing make obj depend && make && make > >> install in sys/modules/acpi_(wmi|hp) - yes, I'm sure of that. > >> Here's the next dmesg.boot after applying acpi_hp3.diff, > >> unfortunately still not working as it should: > > > > Hmm, I am puzzled. > > Can you please add printfs in acpi_wmi_attach before and after > > calls to bus_generic_probe and bus_generic_attach? > > And also at the start and the end of acpi_hp_identify. > > And then check which of the messages get printed and which are not? I added printf("PRINTF:...") in places you ask me to. Here's the next dmesg after rebuilding and reinstalling those modules - all additional printfs are present: http://pastebin.com/J2bPdKMz > Oh, and when you do this, could you please also add the following > three lines to acpi_wmi_methods[] after "Device interface" block and > before "acpi_wmi interface" block? > > /* bus interface */ > DEVMETHOD(bus_add_child, bus_generic_add_child), > DEVMETHOD(bus_print_child, bus_generic_print_child), > > I think that this could be the culprit. Probably, yes. Now it looks like working fine. -- regards, Maciej Suszko. Author: avg Date: Sat Sep 11 08:09:14 2010 New Revision: 212457 URL: http://svn.freebsd.org/changeset/base/212457 Log: make acpi_hp device a child of acpi_wmi to properly reflect dependency between the devices/drivers PR: kern/147858 Suggested by: jhb Tested by: Maciej Suszko <maciej@suszko.eu> MFC after: 1 week Modified: head/sys/dev/acpi_support/acpi_hp.c head/sys/dev/acpi_support/acpi_wmi.c Modified: head/sys/dev/acpi_support/acpi_hp.c ============================================================================== --- head/sys/dev/acpi_support/acpi_hp.c Sat Sep 11 07:24:10 2010 (r212456) +++ head/sys/dev/acpi_support/acpi_hp.c Sat Sep 11 08:09:14 2010 (r212457) @@ -49,7 +49,6 @@ __FBSDID("$FreeBSD$"); #include <sys/uio.h> #include <sys/proc.h> #include <sys/kernel.h> -#include <sys/limits.h> #include <sys/bus.h> #include <sys/sbuf.h> #include <sys/module.h> @@ -336,7 +335,7 @@ static driver_t acpi_hp_driver = { static devclass_t acpi_hp_devclass; -DRIVER_MODULE(acpi_hp, acpi, acpi_hp_driver, acpi_hp_devclass, +DRIVER_MODULE(acpi_hp, acpi_wmi, acpi_hp_driver, acpi_hp_devclass, 0, 0); MODULE_DEPEND(acpi_hp, acpi_wmi, 1, 1, 1); MODULE_DEPEND(acpi_hp, acpi, 1, 1, 1); @@ -453,16 +452,7 @@ acpi_hp_identify(driver_t *driver, devic if (device_find_child(parent, "acpi_hp", -1) != NULL) return; - /* Make sure acpi_wmi driver is present. */ - if (devclass_find("acpi_wmi") == NULL) - return; - - /* - * Add our device with late order, so that it is hopefully - * probed after acpi_wmi. - * XXX User proper constant instead of UINT_MAX for order. - */ - if (BUS_ADD_CHILD(parent, UINT_MAX, "acpi_hp", -1) == NULL) + if (BUS_ADD_CHILD(parent, 0, "acpi_hp", -1) == NULL) device_printf(parent, "add acpi_hp child failed\n"); } @@ -470,11 +460,7 @@ static int acpi_hp_probe(device_t dev) { - /* Skip auto-enumerated devices from ACPI namespace. */ - if (acpi_get_handle(dev) != NULL) - return (ENXIO); device_set_desc(dev, "HP ACPI-WMI Mapping"); - return (0); } @@ -482,7 +468,6 @@ static int acpi_hp_attach(device_t dev) { struct acpi_hp_softc *sc; - devclass_t wmi_devclass; int arg; ACPI_FUNCTION_TRACE((char *)(uintptr_t) __func__); @@ -505,14 +490,7 @@ acpi_hp_attach(device_t dev) sc->verbose = 0; memset(sc->cmi_order, 0, sizeof(sc->cmi_order)); - if (!(wmi_devclass = devclass_find("acpi_wmi"))) { - device_printf(dev, "Couldn't find acpi_wmi devclass\n"); - return (EINVAL); - } - if (!(sc->wmi_dev = devclass_get_device(wmi_devclass, 0))) { - device_printf(dev, "Couldn't find acpi_wmi device\n"); - return (EINVAL); - } + sc->wmi_dev = device_get_parent(dev); if (!ACPI_WMI_PROVIDES_GUID_STRING(sc->wmi_dev, ACPI_HP_WMI_BIOS_GUID)) { device_printf(dev, Modified: head/sys/dev/acpi_support/acpi_wmi.c ============================================================================== --- head/sys/dev/acpi_support/acpi_wmi.c Sat Sep 11 07:24:10 2010 (r212456) +++ head/sys/dev/acpi_support/acpi_wmi.c Sat Sep 11 08:09:14 2010 (r212457) @@ -173,6 +173,10 @@ static device_method_t acpi_wmi_methods[ DEVMETHOD(device_attach, acpi_wmi_attach), DEVMETHOD(device_detach, acpi_wmi_detach), + /* bus interface */ + DEVMETHOD(bus_add_child, bus_generic_add_child), + DEVMETHOD(bus_print_child, bus_generic_print_child), + /* acpi_wmi interface */ DEVMETHOD(acpi_wmi_provides_guid_string, acpi_wmi_provides_guid_string_method), @@ -269,6 +273,11 @@ acpi_wmi_attach(device_t dev) } ACPI_SERIAL_END(acpi_wmi); + if (ret == 0) { + bus_generic_probe(dev); + ret = bus_generic_attach(dev); + } + return (ret); } _______________________________________________ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org" State Changed From-To: analyzed->patched The issue is fixed in head. Author: avg Date: Sat Sep 18 07:16:38 2010 New Revision: 212810 URL: http://svn.freebsd.org/changeset/base/212810 Log: MFC r212251,212457: make acpi_hp device a child of acpi_wmi PR: kern/147858 Modified: stable/8/sys/dev/acpi_support/acpi_hp.c stable/8/sys/dev/acpi_support/acpi_wmi.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/acpi_support/acpi_hp.c ============================================================================== --- stable/8/sys/dev/acpi_support/acpi_hp.c Sat Sep 18 00:58:44 2010 (r212809) +++ stable/8/sys/dev/acpi_support/acpi_hp.c Sat Sep 18 07:16:38 2010 (r212810) @@ -116,7 +116,6 @@ struct acpi_hp_inst_seq_pair { struct acpi_hp_softc { device_t dev; - ACPI_HANDLE handle; device_t wmi_dev; int has_notify; /* notification GUID found */ int has_cmi; /* CMI GUID found */ @@ -289,6 +288,7 @@ static struct { ACPI_SERIAL_DECL(hp, "HP ACPI-WMI Mapping"); +static void acpi_hp_identify(driver_t *driver, device_t parent); static int acpi_hp_probe(device_t dev); static int acpi_hp_attach(device_t dev); static int acpi_hp_detach(device_t dev); @@ -320,6 +320,7 @@ static struct cdevsw hpcmi_cdevsw = { }; static device_method_t acpi_hp_methods[] = { + DEVMETHOD(device_identify, acpi_hp_identify), DEVMETHOD(device_probe, acpi_hp_probe), DEVMETHOD(device_attach, acpi_hp_attach), DEVMETHOD(device_detach, acpi_hp_detach), @@ -334,7 +335,7 @@ static driver_t acpi_hp_driver = { static devclass_t acpi_hp_devclass; -DRIVER_MODULE(acpi_hp, acpi, acpi_hp_driver, acpi_hp_devclass, +DRIVER_MODULE(acpi_hp, acpi_wmi, acpi_hp_driver, acpi_hp_devclass, 0, 0); MODULE_DEPEND(acpi_hp, acpi_wmi, 1, 1, 1); MODULE_DEPEND(acpi_hp, acpi, 1, 1, 1); @@ -405,7 +406,7 @@ acpi_hp_evaluate_auto_on_off(struct acpi "WLAN on air changed to %i " "(new_wlan_status is %i)\n", sc->was_wlan_on_air, new_wlan_status); - acpi_UserNotify("HP", sc->handle, + acpi_UserNotify("HP", ACPI_ROOT_OBJECT, 0xc0+sc->was_wlan_on_air); } } @@ -420,7 +421,7 @@ acpi_hp_evaluate_auto_on_off(struct acpi " to %i (new_bluetooth_status is %i)\n", sc->was_bluetooth_on_air, new_bluetooth_status); - acpi_UserNotify("HP", sc->handle, + acpi_UserNotify("HP", ACPI_ROOT_OBJECT, 0xd0+sc->was_bluetooth_on_air); } } @@ -433,19 +434,33 @@ acpi_hp_evaluate_auto_on_off(struct acpi "WWAN on air changed to %i" " (new_wwan_status is %i)\n", sc->was_wwan_on_air, new_wwan_status); - acpi_UserNotify("HP", sc->handle, + acpi_UserNotify("HP", ACPI_ROOT_OBJECT, 0xe0+sc->was_wwan_on_air); } } } +static void +acpi_hp_identify(driver_t *driver, device_t parent) +{ + + /* Don't do anything if driver is disabled. */ + if (acpi_disabled("hp")) + return; + + /* Add only a single device instance. */ + if (device_find_child(parent, "acpi_hp", -1) != NULL) + return; + + if (BUS_ADD_CHILD(parent, 0, "acpi_hp", -1) == NULL) + device_printf(parent, "add acpi_hp child failed\n"); +} + static int acpi_hp_probe(device_t dev) { - if (acpi_disabled("hp") || device_get_unit(dev) != 0) - return (ENXIO); - device_set_desc(dev, "HP ACPI-WMI Mapping"); + device_set_desc(dev, "HP ACPI-WMI Mapping"); return (0); } @@ -453,14 +468,12 @@ static int acpi_hp_attach(device_t dev) { struct acpi_hp_softc *sc; - devclass_t wmi_devclass; int arg; ACPI_FUNCTION_TRACE((char *)(uintptr_t) __func__); sc = device_get_softc(dev); sc->dev = dev; - sc->handle = acpi_get_handle(dev); sc->has_notify = 0; sc->has_cmi = 0; sc->bluetooth_enable_if_radio_on = 0; @@ -477,14 +490,7 @@ acpi_hp_attach(device_t dev) sc->verbose = 0; memset(sc->cmi_order, 0, sizeof(sc->cmi_order)); - if (!(wmi_devclass = devclass_find ("acpi_wmi"))) { - device_printf(dev, "Couldn't find acpi_wmi devclass\n"); - return (EINVAL); - } - if (!(sc->wmi_dev = devclass_get_device(wmi_devclass, 0))) { - device_printf(dev, "Couldn't find acpi_wmi device\n"); - return (EINVAL); - } + sc->wmi_dev = device_get_parent(dev); if (!ACPI_WMI_PROVIDES_GUID_STRING(sc->wmi_dev, ACPI_HP_WMI_BIOS_GUID)) { device_printf(dev, Modified: stable/8/sys/dev/acpi_support/acpi_wmi.c ============================================================================== --- stable/8/sys/dev/acpi_support/acpi_wmi.c Sat Sep 18 00:58:44 2010 (r212809) +++ stable/8/sys/dev/acpi_support/acpi_wmi.c Sat Sep 18 07:16:38 2010 (r212810) @@ -173,6 +173,10 @@ static device_method_t acpi_wmi_methods[ DEVMETHOD(device_attach, acpi_wmi_attach), DEVMETHOD(device_detach, acpi_wmi_detach), + /* bus interface */ + DEVMETHOD(bus_add_child, bus_generic_add_child), + DEVMETHOD(bus_print_child, bus_generic_print_child), + /* acpi_wmi interface */ DEVMETHOD(acpi_wmi_provides_guid_string, acpi_wmi_provides_guid_string_method), @@ -269,6 +273,11 @@ acpi_wmi_attach(device_t dev) } ACPI_SERIAL_END(acpi_wmi); + if (ret == 0) { + bus_generic_probe(dev); + ret = bus_generic_attach(dev); + } + return (ret); } _______________________________________________ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org" State Changed From-To: patched->closed The fix is MFC-ed to stable/8. |