svn commit: r195185 - in head: share/man/man4 sys/dev/acpi_support

Rui Paulo rpaulo at FreeBSD.org
Tue Jun 30 09:51:42 UTC 2009


Author: rpaulo
Date: Tue Jun 30 09:51:41 2009
New Revision: 195185
URL: http://svn.freebsd.org/changeset/base/195185

Log:
  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

Modified:
  head/share/man/man4/acpi_hp.4
  head/sys/dev/acpi_support/acpi_hp.c
  head/sys/dev/acpi_support/acpi_wmi.c
  head/sys/dev/acpi_support/acpi_wmi_if.m

Modified: head/share/man/man4/acpi_hp.4
==============================================================================
--- head/share/man/man4/acpi_hp.4	Tue Jun 30 09:20:43 2009	(r195184)
+++ head/share/man/man4/acpi_hp.4	Tue Jun 30 09:51:41 2009	(r195185)
@@ -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

Modified: head/sys/dev/acpi_support/acpi_hp.c
==============================================================================
--- head/sys/dev/acpi_support/acpi_hp.c	Tue Jun 30 09:20:43 2009	(r195184)
+++ head/sys/dev/acpi_support/acpi_hp.c	Tue Jun 30 09:51:41 2009	(r195185)
@@ -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 
 				    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, str
 	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, str
 	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;

Modified: head/sys/dev/acpi_support/acpi_wmi.c
==============================================================================
--- head/sys/dev/acpi_support/acpi_wmi.c	Tue Jun 30 09:20:43 2009	(r195184)
+++ head/sys/dev/acpi_support/acpi_wmi.c	Tue Jun 30 09:51:41 2009	(r195185)
@@ -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);

Modified: head/sys/dev/acpi_support/acpi_wmi_if.m
==============================================================================
--- head/sys/dev/acpi_support/acpi_wmi_if.m	Tue Jun 30 09:20:43 2009	(r195184)
+++ head/sys/dev/acpi_support/acpi_wmi_if.m	Tue Jun 30 09:51:41 2009	(r195185)
@@ -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


More information about the svn-src-all mailing list