New patchset for acpi_wmi/acpi_hp

Michael Gmelin freebsdusb at bindone.de
Mon Jun 29 15:33:23 UTC 2009


Hello,

please find attached more patches against CURRENT of today. These
patches include the patches I've sent on the 27th.

So the complete feature list of this patchset is:

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

Installation instructions (against latest CURRENT):
patch -d /usr/src < /path/to/acpi_wmi_acpi_hp.patch
cd /usr/src/sys/modules/acpi/acpi_wmi
make all && make install
cd /usr/src/sys/modules/acpi/acpi_hp
make all && make install
cd /usr/src/share/man/man4
make all && make install

cheers
Michael


-------------- next part --------------
--- share/man/man4/acpi_hp.4.orig	2009-06-26 13:03:16.331066657 +0200
+++ share/man/man4/acpi_hp.4	2009-06-29 17:19:18.544247949 +0200
@@ -165,6 +165,9 @@
 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
 .It Va dev.acpi_hp.0.verbose
 (read-only)
--- sys/dev/acpi_support/acpi_hp.c.orig	2009-06-26 12:54:46.509994426 +0200
+++ sys/dev/acpi_support/acpi_hp.c	2009-06-29 17:18:30.928244238 +0200
@@ -107,6 +107,7 @@
 #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 */
@@ -505,9 +506,10 @@
 			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) {
@@ -772,6 +774,10 @@
 				    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;
 		case ACPI_HP_METHOD_VERBOSE:
 			sc->verbose = arg;
@@ -1122,6 +1128,7 @@
 	struct acpi_hp_softc	*sc;
 	int			pos, i, l, ret;
 	UINT8			instance;
+	UINT8			maxInstance;
 	UINT32			sequence;
 	int			linesize = 1025;
 	char			line[linesize];
@@ -1138,14 +1145,20 @@
 	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;
--- sys/dev/acpi_support/acpi_wmi.c.orig	2009-06-21 22:27:26.897414000 +0200
+++ sys/dev/acpi_support/acpi_wmi.c	2009-06-29 17:17:39.554824991 +0200
@@ -326,11 +326,13 @@
 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);
--- sys/dev/acpi_support/acpi_wmi_if.m.orig	2009-06-21 22:27:31.119098000 +0200
+++ sys/dev/acpi_support/acpi_wmi_if.m	2009-06-29 17:18:38.217246332 +0200
@@ -46,6 +46,7 @@
 
 #
 # 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patchset.tgz
Type: application/octet-stream
Size: 1785 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-acpi/attachments/20090629/0b852c45/patchset.obj


More information about the freebsd-acpi mailing list