cvs commit: src/usr.sbin/acpi/acpidump acpi.c acpidump.c acpidump.h

Takanori Watanabe takawata at init-main.com
Wed Oct 6 22:13:11 PDT 2004


In message <41644415.3030402 at root.org>, Nate Lawson wrote:
>
>> I think ACPI-CA itself can override any SSDT by checking existing
>> SSDT header passed to AcpiOsTableOverride.
>
>I'm not sure what you mean here but I agree that AcpiOsTableOverride() 
>should be able to decide whether to override an SSDT or not.  All I'm 
>asking for is a special return code from AcpiOsTableOverride() that 
>means "ignore this table completely" so I don't have to provide a fake 
>empty table to get this effect.

The thing I want to say is like this. 
In this code, I intended to be able to override arbitaly table 
on a system, though I have never run it. And if iASL can accept
ASL file with multiple DefinitionBlock, you don't need to compound
all SSDT's into DSDT: all you have to do is concatinate SSDT 
with DefinitionBlock to the tail of DSDT dump.
I think this approach is far more extensive, though I don't 
deny current approach as a workaround.


--- /sys/dev/acpica/Osd/OsdTable.c	Sun May 16 22:37:37 2004
+++ OsdTable.c	Thu Oct  7 13:01:01 2004
@@ -63,20 +63,40 @@
     ACPI_TABLE_HEADER       *ExistingTable,
     ACPI_TABLE_HEADER       **NewTable)
 {
-    caddr_t                 acpi_dsdt, p;
-
+    caddr_t                 acpi_sdt, modtype;
+    ACPI_TABLE_HEADER *p;
+ 
     if (ExistingTable == NULL || NewTable == NULL)
         return(AE_BAD_PARAMETER);
 
     *NewTable = NULL;
-    if (strncmp(ExistingTable->Signature, "DSDT", 4) != 0)
-        return(AE_OK);
-    if ((acpi_dsdt = preload_search_by_type("acpi_dsdt")) == NULL)
-        return(AE_OK);
-    if ((p = preload_search_info(acpi_dsdt, MODINFO_ADDR)) == NULL)
-        return(AE_OK);
 
-    *NewTable = *(void **)p;
-    printf("ACPI: DSDT was overridden.\n");
+    if (strncmp(ExistingTable->Signature, "DSDT", 4) == 0){
+      if ((acpi_sdt = preload_search_by_type("acpi_dsdt"))&&
+	  (p = (ACPI_TABLE_HEADER *)preload_search_info
+	   (acpi_sdt, MODINFO_ADDR)))
+	*NewTable = *(void **)p;
+      printf("ACPI: DSDT was overridden.\n");
+      return (AE_OK);
+    }
+
+    acpi_sdt = NULL;
+    while ((acpi_sdt = preload_search_next_name(acpi_sdt)) != NULL) {
+      modtype = (char *)preload_search_info(acpi_sdt, MODINFO_TYPE);
+      if(strcmp(modtype, "acpi_sdt") != 0){
+	 continue;
+      }
+      p = (ACPI_TABLE_HEADER *)preload_search_info(acpi_sdt, MODINFO_ADDR);
+      if(strncmp(ExistingTable->Signature, p->Signature, 4)&&
+	 strncmp(ExistingTable->OemId, p->OemId, 6)&&
+	 strncmp(ExistingTable->OemTableId, p->OemTableId, 8)){
+	*NewTable = p;
+	printf("ACPI: %4s- %6s/%8s was overridden\n", 
+	       ExistingTable->Signature, ExistingTable->OemId,
+	       ExistingTable->OemTableId);
+	return(AE_OK);
+      }
+    }
+
     return (AE_OK);
 }



More information about the cvs-src mailing list