diff options
author | rpaulo <rpaulo@FreeBSD.org> | 2009-06-30 09:51:41 +0000 |
---|---|---|
committer | rpaulo <rpaulo@FreeBSD.org> | 2009-06-30 09:51:41 +0000 |
commit | 905d9397a05effde536c6c52c272bcd0bd3ccfd5 (patch) | |
tree | 9ffdc3902a8467c3c7ffa06372a7fba985c373d9 | |
parent | f236086095393d6969306feea41e45333268596b (diff) | |
download | FreeBSD-src-905d9397a05effde536c6c52c272bcd0bd3ccfd5.zip FreeBSD-src-905d9397a05effde536c6c52c272bcd0bd3ccfd5.tar.gz |
acpi_wmi_if:
- Document different semantics for ACPI_WMI_PROVIDES_GUID_STRING_METHOD
acpi_wmi.c:
- Modify acpi_wmi_provides_guid_string_method to return absolut number of
instances known for the given GUID.
acpi_hp.c:
- sysctl dev.acpi_hp.0.verbose to toggle debug output
- A modification so this can deal with different array lengths
when reading the CMI BIOS - now it works ok on HP Compaq nx7300
as well.
- Change behaviour to query only max_instance-1 CMI BIOS instances,
because all HPs seen so far are broken in that respect
(or there is a fundamental misunderstanding on my side, possible
as well). This way a disturbing ACPI Error Field exceeds Buffer
message is avoided.
- New bit to set on dev.acpi_hp.0.cmi_detail (0x8) to
also query the highest guid instance of CMI bios
acpi_hp.4:
- Document dev.acpi_hp.0.verbose sysctl in man page
- Document new bit for dev.acpi_hp.0.cmi_detail
- Add a section to manpage about hardware that has been reported
to work ok
Submitted by: Michael Gmelin, freebsdusb at bindone.de
Approved by: re (kib)
MFC after: 2 weeks
-rw-r--r-- | share/man/man4/acpi_hp.4 | 3 | ||||
-rw-r--r-- | sys/dev/acpi_support/acpi_hp.c | 21 | ||||
-rw-r--r-- | sys/dev/acpi_support/acpi_wmi.c | 4 | ||||
-rw-r--r-- | sys/dev/acpi_support/acpi_wmi_if.m | 1 |
4 files changed, 24 insertions, 5 deletions
diff --git a/share/man/man4/acpi_hp.4 b/share/man/man4/acpi_hp.4 index b8cb008..612b30c 100644 --- a/share/man/man4/acpi_hp.4 +++ b/share/man/man4/acpi_hp.4 @@ -165,6 +165,9 @@ Show path component of BIOS setting Show a list of valid options for the BIOS setting .It Li 0x04 Show additional flags of BIOS setting (ReadOnly etc.) +.It Li 0x08 +Query highest BIOS entry instance. This is broken on many HP models and +therefore disabled by default. .El .El .Pp diff --git a/sys/dev/acpi_support/acpi_hp.c b/sys/dev/acpi_support/acpi_hp.c index 66d30e8..650d6b3 100644 --- a/sys/dev/acpi_support/acpi_hp.c +++ b/sys/dev/acpi_support/acpi_hp.c @@ -106,6 +106,7 @@ ACPI_MODULE_NAME("HP") #define ACPI_HP_CMI_DETAIL_PATHS 0x01 #define ACPI_HP_CMI_DETAIL_ENUMS 0x02 #define ACPI_HP_CMI_DETAIL_FLAGS 0x04 +#define ACPI_HP_CMI_DETAIL_SHOW_MAX_INSTANCE 0x08 struct acpi_hp_inst_seq_pair { UINT32 sequence; /* sequence number as suggested by cmi bios */ @@ -489,9 +490,10 @@ acpi_hp_attach(device_t dev) sc->has_notify = 1; } } - if (ACPI_WMI_PROVIDES_GUID_STRING(sc->wmi_dev, ACPI_HP_WMI_CMI_GUID)) { + if ((sc->has_cmi = + ACPI_WMI_PROVIDES_GUID_STRING(sc->wmi_dev, ACPI_HP_WMI_CMI_GUID) + )) { device_printf(dev, "HP CMI GUID detected\n"); - sc->has_cmi = 1; } if (sc->has_cmi) { @@ -752,6 +754,10 @@ acpi_hp_sysctl_set(struct acpi_hp_softc *sc, int method, int arg, int oldarg) arg?1:0)); case ACPI_HP_METHOD_CMI_DETAIL: sc->cmi_detail = arg; + if ((arg & ACPI_HP_CMI_DETAIL_SHOW_MAX_INSTANCE) != + (oldarg & ACPI_HP_CMI_DETAIL_SHOW_MAX_INSTANCE)) { + sc->cmi_order_size = -1; + } break; } } @@ -1103,6 +1109,7 @@ acpi_hp_hpcmi_read(struct cdev *dev, struct uio *buf, int flag) struct acpi_hp_softc *sc; int pos, i, l, ret; UINT8 instance; + UINT8 maxInstance; UINT32 sequence; int linesize = 1025; char line[linesize]; @@ -1119,14 +1126,20 @@ acpi_hp_hpcmi_read(struct cdev *dev, struct uio *buf, int flag) else { if (!sbuf_done(&sc->hpcmi_sbuf)) { if (sc->cmi_order_size < 0) { + maxInstance = sc->has_cmi; + if (!(sc->cmi_detail & + ACPI_HP_CMI_DETAIL_SHOW_MAX_INSTANCE) && + maxInstance > 0) { + maxInstance--; + } sc->cmi_order_size = 0; - for (instance = 0; instance < 128; + for (instance = 0; instance < maxInstance; ++instance) { if (acpi_hp_get_cmi_block(sc->wmi_dev, ACPI_HP_WMI_CMI_GUID, instance, line, linesize, &sequence, sc->cmi_detail)) { - instance = 128; + instance = maxInstance; } else { pos = sc->cmi_order_size; diff --git a/sys/dev/acpi_support/acpi_wmi.c b/sys/dev/acpi_support/acpi_wmi.c index 7483293..07c2d71 100644 --- a/sys/dev/acpi_support/acpi_wmi.c +++ b/sys/dev/acpi_support/acpi_wmi.c @@ -326,11 +326,13 @@ acpi_wmi_detach(device_t dev) static int acpi_wmi_provides_guid_string_method(device_t dev, const char *guid_string) { + struct wmi_info *winfo; int ret; ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__); ACPI_SERIAL_BEGIN(acpi_wmi); - ret = (acpi_wmi_lookup_wmi_info_by_guid_string(guid_string) == NULL)?0:1; + winfo = acpi_wmi_lookup_wmi_info_by_guid_string(guid_string); + ret = (winfo == NULL)?0:winfo->ginfo.max_instance+1; ACPI_SERIAL_END(acpi_wmi); return (ret); diff --git a/sys/dev/acpi_support/acpi_wmi_if.m b/sys/dev/acpi_support/acpi_wmi_if.m index 88c0144..905f87d 100644 --- a/sys/dev/acpi_support/acpi_wmi_if.m +++ b/sys/dev/acpi_support/acpi_wmi_if.m @@ -46,6 +46,7 @@ CODE { # # Check if given GUID exists in WMI +# Returns number of instances (max_instace+1) or 0 if guid doesn't exist # # device_t dev: Device to probe # const char* guid_string: String form of the GUID |