From owner-acpi-jp@jp.freebsd.org  Mon Oct 15 23:49:49 2001
Received: (from daemon@localhost)
	by castle.jp.freebsd.org (8.9.3+3.2W/8.7.3) id XAA46897;
	Mon, 15 Oct 2001 23:49:49 +0900 (JST)
	(envelope-from owner-acpi-jp@jp.FreeBSD.org)
Received: from shidahara1.planet.sci.kobe-u.ac.jp (shidahara1.planet.sci.kobe-u.ac.jp [133.30.68.253])
	by castle.jp.freebsd.org (8.9.3+3.2W/8.7.3) with ESMTP id XAA46890
	for <acpi-jp@jp.freebsd.org>; Mon, 15 Oct 2001 23:49:47 +0900 (JST)
	(envelope-from takawata@shidahara1.planet.sci.kobe-u.ac.jp)
Received: from shidahara1.planet.sci.kobe-u.ac.jp (localhost [127.0.0.1])
	by shidahara1.planet.sci.kobe-u.ac.jp (8.9.3/8.9.3) with ESMTP id XAA77970
	for <acpi-jp@jp.freebsd.org>; Mon, 15 Oct 2001 23:49:42 +0900 (JST)
	(envelope-from takawata@shidahara1.planet.sci.kobe-u.ac.jp)
Message-Id: <200110151449.XAA77970@shidahara1.planet.sci.kobe-u.ac.jp>
To: acpi-jp@jp.freebsd.org
Date: Mon, 15 Oct 2001 23:49:42 +0900
From: Takanori Watanabe <takawata@shidahara1.planet.sci.kobe-u.ac.jp>
Reply-To: acpi-jp@jp.freebsd.org
Precedence: list
X-Distribute: distribute version 2.1 (Alpha) patchlevel 24e+010328
X-Sequence: acpi-jp 1347
Subject: [acpi-jp 1347] DSDT Override
Errors-To: owner-acpi-jp@jp.freebsd.org
Sender: owner-acpi-jp@jp.freebsd.org
X-Originator: takawata@shidahara1.planet.sci.kobe-u.ac.jp

Hi, I implemented BIOS override written in following URL.

http://developer.intel.com/technology/iapc/acpi/bios_override.htm

This patch is not clean enough to put. But works.
To override BIOS,

	Dump ASL
	   |
	   v
	Edit ASL
	   |
	   v
       compile ASL and Create AML
	   |
	   v
	copy AML to root FS
	   |
	   v
         reboot
	   |
	   v
     load -t dsdt <filename of AML>
	   |
	   v
	Problem Fixed!

Here is example of DSDT override. Here I fixed lame resource stream for 
IrDA module.(This is because resource tag contains Large resource 
with 0x82 tag,which means ANSI description resource in PnPBIOS spec.
In ACPI 1.0 this tag has reserved, but in ACPI 2.0 this tag means another 
thing.)

BTW,are there more way to clean way to override DSDT?

--- 2	Mon Oct 15 23:35:11 2001
+++ 1	Mon Oct 15 23:36:18 2001
@@ -7,11 +7,12 @@
   Origin = "GenuineIntel"  Id = 0x66a  Stepping = 10
   Features=0x183f9ff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,MMX,FXSR>
 real memory  = 67043328 (65472K bytes)
-avail memory = 61751296 (60304K bytes)
-Preloaded elf kernel "/boot/kernel/kernel" at 0xc0371000.
-Preloaded elf module "/boot/kernel/snd_solo.ko" at 0xc03710a8.
-Preloaded elf module "/boot/kernel/snd_pcm.ko" at 0xc0371158.
-Preloaded elf module "/boot/acpitmp.ko" at 0xc0371204.
+avail memory = 61739008 (60292K bytes)
+Preloaded elf kernel "/boot/kernel/kernel" at 0xc0374000.
+Preloaded elf module "/boot/kernel/snd_solo.ko" at 0xc03740a8.
+Preloaded elf module "/boot/kernel/snd_pcm.ko" at 0xc0374158.
+Preloaded dsdt "/boot/TP240.aml3" at 0xc0374204.
+Preloaded elf module "/boot/acpitmp.ko" at 0xc0374248.
 Pentium Pro MTRR support enabled
 Using $PIR table, 6 entries at 0xc00fdf60
 apm0: <APM BIOS> on motherboard
@@ -21,7 +22,6 @@
 acpi0: <PTLTD    RSDT  > on motherboard
 acpi0: power button is handled as a fixed feature programming model.
 Timecounter "ACPI"  frequency 3579545 Hz
-can't fetch resources for \\_SB_.PCI0.ISA_.FIR_ - AE_AML_INVALID_RESOURCE_TYPE
 acpi_timer0: <24-bit timer at 3.579545MHz> port 0x8008-0x800b on acpi0
 acpi_cpu0: <CPU> on acpi0
 acpi_tz0: <thermal zone> on acpi0
@@ -53,6 +53,8 @@
 lpt0: Interrupt-driven port
 sio0 port 0x3f8-0x3ff irq 4 on acpi0
 sio0: type 16550A
+sio1 port 0x2f8-0x2ff irq 3 on acpi0
+sio1: type 16550A
 fdc0: <NEC 72065B or clone> port 0x3f7,0x3f0-0x3f5 irq 6 on acpi0
 fdc0: FIFO enabled, 8 bytes threshold
 fd0: <1440-KB 3.5" drive> on fdc0 drive 0


The patch follows .


diff -u /usr/home/takawata/acpi-jp/src/sys/contrib/dev/acpica/tbget.c ./tbget.c
--- /usr/home/takawata/acpi-jp/src/sys/contrib/dev/acpica/tbget.c	Wed Oct  3 20:44:24 2001
+++ ./tbget.c	Mon Oct 15 22:08:11 2001
@@ -324,7 +324,7 @@
  *              already be loaded and validated.
  *
  ******************************************************************************/
-
+extern void *acpi_dsdt_override;
 ACPI_STATUS
 AcpiTbGetAllTables (
     UINT32                  NumberOfTables,
@@ -339,7 +339,6 @@
 
     ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Number of tables: %d\n", NumberOfTables));
 
-
     /*
      * Loop through all table pointers found in RSDT.
      * This will NOT include the FACS and DSDT - we must get
@@ -439,7 +438,8 @@
      * Get the DSDT (We know that the FADT is valid now)
      */
     Status = AcpiTbGetTable ((ACPI_PHYSICAL_ADDRESS) ACPI_GET_ADDRESS (AcpiGbl_FADT->XDsdt),
-                                TablePtr, &TableInfo);
+			     (acpi_dsdt_override!= 0)
+			     ?acpi_dsdt_override: TablePtr, &TableInfo);
     if (ACPI_FAILURE (Status))
     {
         return_ACPI_STATUS (Status);
Only in .: tbget.c~
--- /usr/home/takawata/acpi-jp/src/sys/dev/acpica/acpi.c	Wed Oct  3 20:44:28 2001
+++ /sys/dev/acpica/acpi.c	Mon Oct 15 22:00:38 2001
@@ -42,6 +42,7 @@
 #include <sys/reboot.h>
 #include <sys/sysctl.h>
 #include <sys/ctype.h>
+#include <sys/linker.h>
 
 #include <machine/clock.h>
 #include <machine/resource.h>
@@ -68,7 +69,7 @@
 static d_open_t		acpiopen;
 static d_close_t	acpiclose;
 static d_ioctl_t	acpiioctl;
-
+void *acpi_dsdt_override = NULL;
 #define CDEV_MAJOR 152
 static struct cdevsw acpi_cdevsw = {
     acpiopen,
@@ -242,6 +243,19 @@
     if (debugpoint && !strcmp(debugpoint, "tables"))
 	acpi_EnterDebugger();
 #endif
+    {
+      caddr_t dt_mod;
+      void  **p;
+      int err;
+      dt_mod = preload_search_by_type("dsdt");
+      if(dt_mod == NULL)
+	goto next;
+      p = preload_search_info(dt_mod, MODINFO_ADDR);
+      if(p == NULL)
+	goto next;
+      acpi_dsdt_override=*p;
+    }
+ next:
     if ((error = AcpiLoadTables()) != AE_OK) {
 	printf("ACPI: table load failed: %s\n", AcpiFormatException(error));
 	return_VOID;


Takanori Watanabe
<a href="http://www.planet.sci.kobe-u.ac.jp/~takawata/key.html">
Public Key</a>
Key fingerprint =  2C 51 E2 78 2C E1 C5 2D  0F F1 20 A3 11 3A 62 2A 


