Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 29 Jun 2009 17:33:12 +0200
From:      Michael Gmelin <freebsdusb@bindone.de>
To:        Rui Paulo <rpaulo@freebsd.org>, freebsd-acpi@freebsd.org
Cc:        "Paul B. Mahol" <onemda@gmail.com>
Subject:   New patchset for acpi_wmi/acpi_hp
Message-ID:  <4A48DEB8.1040808@bindone.de>

next in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------000802090103020201040907
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

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



--------------000802090103020201040907
Content-Type: text/plain;
 name="acpi_wmi_acpi_hp.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="acpi_wmi_acpi_hp.patch"

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

--------------000802090103020201040907
Content-Type: application/octet-stream;
 name="patchset.tgz"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
 filename="patchset.tgz"

H4sIAFbeSEoAA+1aa3PaRhfuV/ErTtsZVxiQd3UF3KRxbBoz42DX4LQzbWdHiAU0BolKwonb
yX/v2ZUEMkns9K3HfTOzz2AEq7NH5/Ls2Qv2g1XI3i5D5osP85Wx8rNg/tWjghDi2jaIK2L3
ivc8CpSapkkdlzgWEOrYjvsVkMc14+NYp5mfoClJHGf3yb2dc7645/6uc18IWq0WpHM/4QdL
PxJ/9kHJBNuIk3CmmYR0WsRtmS5Qq0usLnUNy6LEdV3HgwbB+7VGo/FJLVsFHaBel3a6tG04
tm3aXsfuFApevIAWdZ2mCw1x6cCLFzUYzuO34MMiTDOIp3DjL8IJxKssjKMUpnEC2ZzDy/75
EFKeZWE0q4HRz+AsBPKO2GX/ySQUPfwFTBf+LBWaqn1Av+T+5Dxa3ALPAqNea2x1tGuNn9Y8
uYV5OJtztEJ25FGGTWGExIkCbsBoHqaAr3ESX/MI4ggwALdwegHLeMIXKfjRpNZAWxOORnOY
hKk/XvAJjG9hwqf+epEZaHlvkZv/xsfWG6OMHzFueDKOU14DPUFLWzGaWq/JvN2mByiahzpd
r1Zxkm3iHnyYPbPr2F3bNRzS6XQwAW41e/fq2s1hu2sRo2O2TdRitas5JJ7MIV48mcNv0cMw
4nB0fNFnpxfs+HWfnfRGR/0zdnE0Oh1qGsaZ3ivXG1y9zuXMe+V+PDt6lcvZtcY9csPT85/Z
66NfWH8wHB0NjnuaTDXUIM2SdZBB4TYTKWYp/4Ot/DCBv2qgXfUHI8vUsG3NMfeH2sE+lF8g
Wi/HPAE/hXQ9myFd8hQHyxDGYZzC/oEMkUMEvxsOcZuUyBhpmpYGredzP2VRnIXTW3gG9FC0
v8e397WWFk5Bl578jG5cXJ6/6Z/0huzVVf+EDUeX/cErXSgQZRxz2Nw4LaSF40KwXkcPGlKT
Xj5NmPYMsBUQ/1Z/o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Y/HEKnm72on8BlkMSPgxFwJbPu9DJY9dGMqr2G4shQ1iyyHsrf3XG7dHgty1MdywiD+7PAVg
9mOeAzyw/yeuR8r9v+PhZ0Jdz3XU/v8poPb/X+b+/7Hyj7VeLMVYtdZvqkDwOFXggfFvuaaz
Hf84OSEjbMtS4/8poM6R1DmSOkdS50jqHEmdI6lzpP+Tc6QnnP8/vf4TwX2cBeAD6z9KXWu7
/iOuWP+5VP3++yRQR5bqyPKJjyz/a8orVHB//Q+nbPnvp4CHzv+c7f//OK7rYP2nFrVV/X8K
qN8P1O8HCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKXxb+BqbdTRwA
UAAA
--------------000802090103020201040907--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4A48DEB8.1040808>