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

[-- Attachment #1 --]
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



[-- Attachment #2 --]
--- 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

[-- Attachment #3 --]
VHJZksFW+NWwuܤql3`3mgG4J‰ٕ2I}3`GU.C`գ6+b<
I8؎5X)Igɽss_Zs?K?AۈptZm.PK.u
ˢu]ǃFI-[^vm8m^
^u
q5"L3p/	ī,qٜRea4,e$=L,}@<Z^kluk<y8sBvQMaĉnhq_0pzx)Ѥ@[Fs?^	oa§zhyo1nx2S^=AK[1Zɼݦ(:]Vqm|=]5t0n5{akcMb9$!^<o0pt|guFG3vq4:jƙ+\{~<;zٵ=r_X0
{L5 ͒uA6)f)0j]#԰m1>_ Z/<?t=!]aCqis?eQ[xPǷNAn\\U
G+](es8-B^GR^>MVF>MG0lQ6eopH8qxo7CtQkH4rSq<SPJ	~2vI.c{
һxTqiy}hn/&okiQLxOVhn{i']|ӻ|y>m+H8Jv1^1,@<SVqڄ	&$<;,E[ʲmo7#HێQJLGpN)Zj7-Y0-'u:^O$'!%K7ډ@lT=@*L̓?Iߡ^΂z8{{G>R*A(cZ&fK=zA7/t/F)ǤЌg"Zl;>VOovWrh#q7	2ɭNŧw?tlUZw}^0+S0ͮuMhw<b9T;-{]c8rC+Ӳed
jɡfaAjPjj߄:0,@bK^d-p
_$U""T4Rjǣ.{k]e	MQϰw?:c/{^N#ic8^Xi	V}ӫóg0:;@JE-rz>iJ6讇I?4ԺN"A9N'XgQ뤾ۆI=v-ˬv7|׀5bY;\::~KgZ.p^)}5:`"Rf&1O\c*yډYH1[>C%]ʫn,
b!Gܵ1ܰ?<`c<'GgB]u)_^,Xo@8Uo89!#lR)Α9:GRHI#ss'?}?J]k#XT$PG,k+Tpl燎8`U







































_MP

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