Review: Add support for additional ACPI table dump for acpidump(8)
Takanori Watanabe
takawata at init-main.com
Tue Mar 22 04:44:39 UTC 2011
This patch adds support capability to dump Alert Standard Format(ASF!)
and Simple Boot format(BOOT) table to acpidump(8).
How about this?
Index: acpidump.h
===================================================================
--- acpidump.h (revision 219256)
+++ acpidump.h (working copy)
@@ -33,6 +33,7 @@
#include <contrib/dev/acpica/include/acpi.h>
#include <contrib/dev/acpica/include/acconfig.h>
#include <contrib/dev/acpica/include/actbl1.h>
+#include <contrib/dev/acpica/include/actbl2.h>
/* GAS address space ID constants. */
#define ACPI_GAS_MEMORY 0
Index: acpi.c
===================================================================
--- acpi.c (revision 219256)
+++ acpi.c (working copy)
@@ -743,7 +743,97 @@
}
}
+
static void
+acpi_handle_boot(ACPI_TABLE_HEADER *sdp)
+{
+ ACPI_TABLE_BOOT *boot = (ACPI_TABLE_BOOT *) sdp;
+
+ printf(BEGIN_COMMENT);
+ acpi_print_sdt(sdp);
+ printf("\tCMOS Index: %02x\n", boot->CmosIndex);
+ printf(END_COMMENT);
+}
+
+static void
+acpi_handle_asf(ACPI_TABLE_HEADER *sdp)
+{
+ char *p, *q, *r;
+ int i;
+ ACPI_ASF_HEADER *asf;
+ ACPI_ASF_INFO *asfinfo;
+ ACPI_ASF_ALERT *asfalert;
+ ACPI_ASF_REMOTE *asfcontrol;
+ ACPI_ASF_RMCP *asfboot;
+ ACPI_ASF_ADDRESS *asfaddr;
+ ACPI_ASF_CONTROL_DATA *cdata;
+
+ printf(BEGIN_COMMENT);
+ acpi_print_sdt(sdp);
+ p = (char *) sdp + sizeof(ACPI_TABLE_HEADER);
+ q = (char *) sdp + sdp->Length;
+ while(p < q){
+ asf = (ACPI_ASF_HEADER *)p;
+ switch(asf->Type&0x7f){
+ case ACPI_ASF_TYPE_INFO:
+ asfinfo = (ACPI_ASF_INFO *)asf;
+ printf("\tASF_INFO:MinResetValue:%d MinPollInterval:%d\n",asfinfo->MinResetValue, asfinfo->MinPollInterval);
+ printf("\t MfgId:%08x Flags:%x\n",
+ asfinfo->MfgId, asfinfo->Flags);
+ break;
+ case ACPI_ASF_TYPE_ALERT:
+ asfalert = (ACPI_ASF_ALERT *)asf;
+ printf("\tASF_ALERT:AssertMask %02x DeassertMask %02x\n",
+ asfalert->AssertMask, asfalert->DeassertMask);
+ printf("\t Alerts:%x, Length%x\n", asfalert->Alerts, asfalert->DataLength);
+ break;
+ case ACPI_ASF_TYPE_CONTROL:
+ asfcontrol = (ACPI_ASF_REMOTE *)asf;
+ r = (char *)asf + sizeof(ACPI_ASF_REMOTE);
+
+ printf("\tASF_RCTL:Controls %02x DataLength %02x\n",
+ asfcontrol->Controls, asfcontrol->DataLength);
+ for(i = 0; i < asfcontrol->Controls; i++){
+ cdata = (ACPI_ASF_CONTROL_DATA *)r ;
+ printf("\t\tFunc:%02x, Addr %02x, Cmd %02x, Data %02x\n", cdata->Function, cdata->Address, cdata->Command, cdata->Value);
+ r += asfcontrol->DataLength;
+ }
+ break;
+ case ACPI_ASF_TYPE_BOOT:
+ asfboot = (ACPI_ASF_RMCP *)asf;
+ printf("\tASF_RMCP:Capabilities%02x%02x%02x%02x%02x%02x%02x\n",
+ asfboot->Capabilities[0],
+ asfboot->Capabilities[1],
+ asfboot->Capabilities[2],
+ asfboot->Capabilities[3],
+ asfboot->Capabilities[4],
+ asfboot->Capabilities[5],
+ asfboot->Capabilities[6]);
+ printf("\t CompletionCode %02x, EnterpriseId %08x, Command %02x\n",
+ asfboot->CompletionCode, asfboot->EnterpriseId,
+ asfboot->Command);
+ printf("\t Parameter %04x, BootOptions %04x, OemParameters %04x\n",
+ asfboot->Parameter, asfboot->BootOptions,
+ asfboot->OemParameters);
+ break;
+ case ACPI_ASF_TYPE_ADDRESS:
+ asfaddr = (ACPI_ASF_ADDRESS *)asf;
+ printf("\tASF_ADDR:EpromAddress %02x Devices %02x\n",
+ asfaddr->EpromAddress, asfaddr->Devices);
+ break;
+ default:
+ printf("\tType:%02x Length:%04x\n",
+ asf->Type&0x7f, asf->Length);
+ }
+ if(asf->Type&0x80)
+ break;
+ p += asf->Length;
+ }
+
+ printf(END_COMMENT);
+}
+
+static void
acpi_handle_srat(ACPI_TABLE_HEADER *sdp)
{
ACPI_TABLE_SRAT *srat;
@@ -1088,6 +1178,10 @@
acpi_handle_srat(sdp);
else if (!memcmp(sdp->Signature, ACPI_SIG_TCPA, 4))
acpi_handle_tcpa(sdp);
+ else if (!memcmp(sdp->Signature, ACPI_SIG_ASF, 4))
+ acpi_handle_asf(sdp);
+ else if (!memcmp(sdp->Signature, ACPI_SIG_BOOT, 4))
+ acpi_handle_boot(sdp);
else {
printf(BEGIN_COMMENT);
acpi_print_sdt(sdp);
More information about the freebsd-acpi
mailing list