## Automatically generated incremental diff
## From:   linux-2.4.6-pre4
## To:     linux-2.4.6-pre5
## Robot:  $Id: make-incremental-diff,v 1.8 2001/12/04 06:05:04 hpa Exp $

diff -urN linux-2.4.6-pre4/Documentation/Configure.help linux/Documentation/Configure.help
--- linux-2.4.6-pre4/Documentation/Configure.help	Mon Dec  3 22:48:32 2001
+++ linux/Documentation/Configure.help	Mon Dec  3 22:48:41 2001
@@ -11374,6 +11374,20 @@
   The module will be called pegasus.o. If you want to compile it as a
   module, say M here and read Documentation/modules.txt.
 
+USB CATC NetMate-based Ethernet device support
+CONFIG_USB_CATC
+  Say Y if you want to use one of the following 10Mbps USB Ethernet
+  device based on the EL1210A chip. Supported devices are:
+    Belkin F5U111
+    CATC NetMate
+    CATC NetMate II
+    smartBridges smartNIC
+
+  This code is also available as a module ( = code which can be
+  inserted in and removed from the running kernel whenever you want).
+  The module will be called catc.o. If you want to compile it as a
+  module, say M here and read <file:Documentation/modules.txt>.
+
 USB Kodak DC-2xx Camera support
 CONFIG_USB_DC2XX
   Say Y here if you want to connect this type of still camera to
@@ -14133,7 +14147,7 @@
   will issue the hlt instruction if nothing is to be done, thereby
   sending the processor to sleep and saving power.
 
-ACPI Support
+ACPI support
 CONFIG_ACPI
   ACPI/OSPM support for Linux is currently under development. As such, 
   this support is preliminary and EXPERIMENTAL. Configuring ACPI support
@@ -14162,6 +14176,57 @@
   
   The ACPI mailing list may also be of interest:
   http://phobos.fs.tum.de/acpi/index.html
+
+ACPI Debug Statements
+CONFIG_ACPI_DEBUG
+  The ACPI driver can optionally report errors with a great deal
+  of verbosity. Saying Y enables these statements. This will increase
+  your kernel size by around 50K.
+
+ACPI Bus Manager
+CONFIG_ACPI_BUSMGR
+  The ACPI Bus Manager enumerates devices in the ACPI namespace, and
+  handles PnP messages. All ACPI devices use its services, so using them
+  requires saying Y here.
+
+ACPI System Driver
+CONFIG_ACPI_SYS
+  This driver will enable your system to shut down using ACPI, and dump
+  your ACPI DSDT table using /proc/acpi/dsdt.
+
+ACPI Processor Driver
+CONFIG_ACPI_CPU
+  This driver installs ACPI as the idle handler for Linux, and uses ACPI
+  C2 and C3 processor states to save power, on systems that support it.
+
+ACPI Button
+CONFIG_ACPI_BUTTON
+  This driver registers for events based on buttons, such as the power,
+  sleep, and lid switch. In the future, a daemon will read 
+  /proc/acpi/event and perform user-defined actions such as shutting
+  down the system. Until then, you can cat it, and see output when
+  a button is pressed.
+
+ACPI AC Adapter
+CONFIG_ACPI_AC
+  This driver adds support for the AC Adapter object, which indicates
+  whether a system is on AC, or not. Typically, only laptops have this
+  object, since desktops are always on AC.
+
+ACPI Embedded Controller
+CONFIG_ACPI_EC
+  This driver is required on some systems for the proper operation of the
+  battery and thermal drivers. If you are compiling for a laptop, say Y.
+
+ACPI Control Method Battery
+CONFIG_ACPI_CMBATT
+  This driver adds support for battery information through
+  /proc/acpi/battery. If you have a laptop with a battery, say Y.
+
+ACPI Thermal
+CONFIG_ACPI_THERMAL
+  This driver handles overheating conditions on laptops. It is HIGHLY
+  recommended, as your laptop CPU may be damaged without it.
 
 Advanced Power Management BIOS support
 CONFIG_APM
diff -urN linux-2.4.6-pre4/MAINTAINERS linux/MAINTAINERS
--- linux-2.4.6-pre4/MAINTAINERS	Mon Dec  3 22:48:32 2001
+++ linux/MAINTAINERS	Mon Dec  3 22:48:41 2001
@@ -759,8 +759,8 @@
 M:	kaos@ocs.com.au
 P:	Michael Elizabeth Chastain
 M:	mec@shout.net
-L:	linux-kbuild@torque.net
-W:	http://www.kernel.org/pub/linux/kernel/projects/kbuild/
+L:	kbuild-devel@lists.sourceforge.net
+W:	http://kbuild.sourceforge.net
 S:	Maintained 
 
 KERNEL NFSD
diff -urN linux-2.4.6-pre4/Makefile linux/Makefile
--- linux-2.4.6-pre4/Makefile	Mon Dec  3 22:48:32 2001
+++ linux/Makefile	Mon Dec  3 22:48:41 2001
@@ -1,7 +1,7 @@
 VERSION = 2
 PATCHLEVEL = 4
 SUBLEVEL = 6
-EXTRAVERSION =-pre4
+EXTRAVERSION =-pre5
 
 KERNELRELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
 
diff -urN linux-2.4.6-pre4/arch/i386/config.in linux/arch/i386/config.in
--- linux-2.4.6-pre4/arch/i386/config.in	Mon Dec  3 22:48:32 2001
+++ linux/arch/i386/config.in	Mon Dec  3 22:48:41 2001
@@ -245,6 +245,10 @@
 
 if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
    dep_bool '  ACPI support' CONFIG_ACPI $CONFIG_PM
+   
+   if [ "$CONFIG_ACPI" != "n" ]; then
+      source drivers/acpi/Config.in
+   fi
 fi
 
 dep_tristate '  Advanced Power Management BIOS support' CONFIG_APM $CONFIG_PM
diff -urN linux-2.4.6-pre4/arch/sparc64/kernel/pci.c linux/arch/sparc64/kernel/pci.c
--- linux-2.4.6-pre4/arch/sparc64/kernel/pci.c	Mon Dec  3 22:48:33 2001
+++ linux/arch/sparc64/kernel/pci.c	Mon Dec  3 22:48:41 2001
@@ -1,4 +1,4 @@
-/* $Id: pci.c,v 1.32 2001/06/08 06:25:41 davem Exp $
+/* $Id: pci.c,v 1.35 2001/06/13 06:34:30 davem Exp $
  * pci.c: UltraSparc PCI controller support.
  *
  * Copyright (C) 1997, 1998, 1999 David S. Miller (davem@redhat.com)
@@ -305,6 +305,53 @@
 
 /* Platform support for /proc/bus/pci/X/Y mmap()s. */
 
+/* If the user uses a host-bridge as the PCI device, he may use
+ * this to perform a raw mmap() of the I/O or MEM space behind
+ * that controller.
+ *
+ * This can be useful for execution of x86 PCI bios initialization code
+ * on a PCI card, like the xfree86 int10 stuff does.
+ */
+static int __pci_mmap_make_offset_bus(struct pci_dev *pdev, struct vm_area_struct *vma,
+				      enum pci_mmap_state mmap_state)
+{
+	struct pcidev_cookie *pcp = pdev->sysdata;
+	struct pci_pbm_info *pbm;
+	unsigned long space_size, user_offset, user_size;
+
+	if (!pcp)
+		return -ENXIO;
+	pbm = pcp->pbm;
+	if (!pbm)
+		return -ENXIO;
+
+	if (mmap_state == pci_mmap_io) {
+		space_size = (pbm->io_space.end -
+			      pbm->io_space.start) + 1;
+	} else {
+		space_size = (pbm->mem_space.end -
+			      pbm->mem_space.start) + 1;
+	}
+
+	/* Make sure the request is in range. */
+	user_offset = vma->vm_pgoff << PAGE_SHIFT;
+	user_size = vma->vm_end - vma->vm_start;
+
+	if (user_offset >= space_size ||
+	    (user_offset + user_size) > space_size)
+		return -EINVAL;
+
+	if (mmap_state == pci_mmap_io) {
+		vma->vm_pgoff = (pbm->io_space.start +
+				 user_offset) >> PAGE_SHIFT;
+	} else {
+		vma->vm_pgoff = (pbm->mem_space.start +
+				 user_offset) >> PAGE_SHIFT;
+	}
+
+	return 0;
+}
+
 /* Adjust vm_pgoff of VMA such that it is the physical page offset corresponding
  * to the 32-bit pci bus offset for DEV requested by the user.
  *
@@ -315,14 +362,17 @@
  *
  * Returns negative error code on failure, zero on success.
  */
-static __inline__ int __pci_mmap_make_offset(struct pci_dev *dev, struct vm_area_struct *vma,
-					     enum pci_mmap_state mmap_state)
+static int __pci_mmap_make_offset(struct pci_dev *dev, struct vm_area_struct *vma,
+				  enum pci_mmap_state mmap_state)
 {
 	unsigned long user_offset = vma->vm_pgoff << PAGE_SHIFT;
 	unsigned long user32 = user_offset & 0xffffffffUL;
 	unsigned long largest_base, this_base, addr32;
 	int i;
 
+	if ((dev->class >> 8) == PCI_CLASS_BRIDGE_HOST)
+		return __pci_mmap_make_offset_bus(dev, vma, mmap_state);
+
 	/* Figure out which base address this is for. */
 	largest_base = 0UL;
 	for (i = 0; i <= PCI_ROM_RESOURCE; i++) {
@@ -370,7 +420,7 @@
 /* Set vm_flags of VMA, as appropriate for this architecture, for a pci device
  * mapping.
  */
-static __inline__ void __pci_mmap_set_flags(struct pci_dev *dev, struct vm_area_struct *vma,
+static void __pci_mmap_set_flags(struct pci_dev *dev, struct vm_area_struct *vma,
 					    enum pci_mmap_state mmap_state)
 {
 	vma->vm_flags |= (VM_SHM | VM_LOCKED);
@@ -379,7 +429,7 @@
 /* Set vm_page_prot of VMA, as appropriate for this architecture, for a pci
  * device mapping.
  */
-static __inline__ void __pci_mmap_set_pgprot(struct pci_dev *dev, struct vm_area_struct *vma,
+static void __pci_mmap_set_pgprot(struct pci_dev *dev, struct vm_area_struct *vma,
 					     enum pci_mmap_state mmap_state)
 {
 	/* Our io_remap_page_range takes care of this, do nothing. */
diff -urN linux-2.4.6-pre4/arch/sparc64/kernel/pci_common.c linux/arch/sparc64/kernel/pci_common.c
--- linux-2.4.6-pre4/arch/sparc64/kernel/pci_common.c	Mon Dec  3 22:48:33 2001
+++ linux/arch/sparc64/kernel/pci_common.c	Mon Dec  3 22:48:41 2001
@@ -1,4 +1,4 @@
-/* $Id: pci_common.c,v 1.21 2001/06/08 06:57:19 davem Exp $
+/* $Id: pci_common.c,v 1.25 2001/06/14 16:57:41 davem Exp $
  * pci_common.c: PCI controller common support.
  *
  * Copyright (C) 1999 David S. Miller (davem@redhat.com)
@@ -257,11 +257,13 @@
 	}
 }
 
-static void __init bad_assignment(struct linux_prom_pci_registers *ap,
+static void __init bad_assignment(struct pci_dev *pdev,
+				  struct linux_prom_pci_registers *ap,
 				  struct resource *res,
 				  int do_prom_halt)
 {
-	prom_printf("PCI: Bogus PROM assignment.\n");
+	prom_printf("PCI: Bogus PROM assignment. BUS[%02x] DEVFN[%x]\n",
+		    pdev->bus->number, pdev->devfn);
 	if (ap)
 		prom_printf("PCI: phys[%08x:%08x:%08x] size[%08x:%08x]\n",
 			    ap->phys_hi, ap->phys_mid, ap->phys_lo,
@@ -319,7 +321,7 @@
 	case  PCI_ROM_ADDRESS:
 		/* It had better be MEM space. */
 		if (space != 2)
-			bad_assignment(ap, NULL, 0);
+			bad_assignment(pdev, ap, NULL, 0);
 
 		res = &pdev->resource[PCI_ROM_RESOURCE];
 		break;
@@ -334,7 +336,7 @@
 		break;
 
 	default:
-		bad_assignment(ap, NULL, 0);
+		bad_assignment(pdev, ap, NULL, 0);
 		res = NULL;
 		break;
 	};
@@ -371,14 +373,15 @@
 		ap = &pcp->prom_assignments[i];
 		root = get_root_resource(ap, pbm);
 		res = get_device_resource(ap, pdev);
-		if (root == NULL || res == NULL)
+		if (root == NULL || res == NULL ||
+		    res->flags == 0)
 			continue;
 
 		/* Ok we know which resource this PROM assignment is
 		 * for, sanity check it.
 		 */
 		if ((res->start & 0xffffffffUL) != ap->phys_lo)
-			bad_assignment(ap, res, 1);
+			bad_assignment(pdev, ap, res, 1);
 
 		/* If it is a 64-bit MEM space assignment, verify that
 		 * the resource is too and that the upper 32-bits match.
@@ -387,9 +390,9 @@
 			if (((res->flags & IORESOURCE_MEM) == 0) ||
 			    ((res->flags & PCI_BASE_ADDRESS_MEM_TYPE_MASK)
 			     != PCI_BASE_ADDRESS_MEM_TYPE_64))
-				bad_assignment(ap, res, 1);
+				bad_assignment(pdev, ap, res, 1);
 			if ((res->start >> 32) != ap->phys_mid)
-				bad_assignment(ap, res, 1);
+				bad_assignment(pdev, ap, res, 1);
 
 			/* PBM cannot generate cpu initiated PIOs
 			 * to the full 64-bit space.  Therefore the
@@ -441,6 +444,23 @@
 		pci_record_assignments(pbm, pci_bus_b(walk));
 }
 
+/* Return non-zero if PDEV has implicit I/O resources even
+ * though it may not have an I/O base address register
+ * active.
+ */
+static int __init has_implicit_io(struct pci_dev *pdev)
+{
+	int class = pdev->class >> 8;
+
+	if (class == PCI_CLASS_NOT_DEFINED ||
+	    class == PCI_CLASS_NOT_DEFINED_VGA ||
+	    class == PCI_CLASS_STORAGE_IDE ||
+	    (pdev->class >> 16) == PCI_BASE_CLASS_DISPLAY)
+		return 1;
+
+	return 0;
+}
+
 static void __init pdev_assign_unassigned(struct pci_pbm_info *pbm,
 					  struct pci_dev *pdev)
 {
@@ -504,7 +524,7 @@
 	 */
 	if (io_seen || mem_seen) {
 		pci_read_config_word(pdev, PCI_COMMAND, &cmd);
-		if (io_seen)
+		if (io_seen || has_implicit_io(pdev))
 			cmd |= PCI_COMMAND_IO;
 		if (mem_seen)
 			cmd |= PCI_COMMAND_MEMORY;
@@ -863,6 +883,46 @@
 	walk = &pbus->children;
 	for (walk = walk->next; walk != &pbus->children; walk = walk->next)
 		pci_setup_busmastering(pbm, pci_bus_b(walk));
+}
+
+void pci_register_legacy_regions(struct resource *io_res,
+				 struct resource *mem_res)
+{
+	struct resource *p;
+
+	/* VGA Video RAM. */
+	p = kmalloc(sizeof(*p), GFP_KERNEL);
+	if (!p)
+		return;
+
+	memset(p, 0, sizeof(*p));
+	p->name = "Video RAM area";
+	p->start = mem_res->start + 0xa0000UL;
+	p->end = p->start + 0x1ffffUL;
+	p->flags = IORESOURCE_BUSY;
+	request_resource(mem_res, p);
+
+	p = kmalloc(sizeof(*p), GFP_KERNEL);
+	if (!p)
+		return;
+
+	memset(p, 0, sizeof(*p));
+	p->name = "System ROM";
+	p->start = mem_res->start + 0xf0000UL;
+	p->end = p->start + 0xffffUL;
+	p->flags = IORESOURCE_BUSY;
+	request_resource(mem_res, p);
+
+	p = kmalloc(sizeof(*p), GFP_KERNEL);
+	if (!p)
+		return;
+
+	memset(p, 0, sizeof(*p));
+	p->name = "Video ROM";
+	p->start = mem_res->start + 0xc0000UL;
+	p->end = p->start + 0x7fffUL;
+	p->flags = IORESOURCE_BUSY;
+	request_resource(mem_res, p);
 }
 
 /* Generic helper routines for PCI error reporting. */
diff -urN linux-2.4.6-pre4/arch/sparc64/kernel/pci_impl.h linux/arch/sparc64/kernel/pci_impl.h
--- linux-2.4.6-pre4/arch/sparc64/kernel/pci_impl.h	Wed May 16 10:31:27 2001
+++ linux/arch/sparc64/kernel/pci_impl.h	Mon Dec  3 22:48:41 2001
@@ -1,4 +1,4 @@
-/* $Id: pci_impl.h,v 1.8 2001/05/15 08:54:30 davem Exp $
+/* $Id: pci_impl.h,v 1.9 2001/06/13 06:34:30 davem Exp $
  * pci_impl.h: Helper definitions for PCI controller support.
  *
  * Copyright (C) 1999 David S. Miller (davem@redhat.com)
@@ -33,6 +33,8 @@
 					    struct pci_bus *pbus);
 extern void pci_setup_busmastering(struct pci_pbm_info *pbm,
 				   struct pci_bus *pbus);
+extern void pci_register_legacy_regions(struct resource *io_res,
+					struct resource *mem_res);
 
 /* Error reporting support. */
 extern void pci_scan_for_target_abort(struct pci_controller_info *, struct pci_pbm_info *, struct pci_bus *);
diff -urN linux-2.4.6-pre4/arch/sparc64/kernel/pci_psycho.c linux/arch/sparc64/kernel/pci_psycho.c
--- linux-2.4.6-pre4/arch/sparc64/kernel/pci_psycho.c	Mon Dec  3 22:48:33 2001
+++ linux/arch/sparc64/kernel/pci_psycho.c	Mon Dec  3 22:48:41 2001
@@ -1,4 +1,4 @@
-/* $Id: pci_psycho.c,v 1.25 2001/06/04 23:20:32 ecd Exp $
+/* $Id: pci_psycho.c,v 1.26 2001/06/13 06:34:30 davem Exp $
  * pci_psycho.c: PSYCHO/U2P specific PCI controller support.
  *
  * Copyright (C) 1997, 1998, 1999 David S. Miller (davem@caipfs.rutgers.edu)
@@ -1409,6 +1409,8 @@
 
 	request_resource(&ioport_resource, &pbm->io_space);
 	request_resource(&iomem_resource, &pbm->mem_space);
+	pci_register_legacy_regions(&pbm->io_space,
+				    &pbm->mem_space);
 }
 
 static void psycho_pbm_strbuf_init(struct pci_controller_info *p,
diff -urN linux-2.4.6-pre4/arch/sparc64/kernel/pci_sabre.c linux/arch/sparc64/kernel/pci_sabre.c
--- linux-2.4.6-pre4/arch/sparc64/kernel/pci_sabre.c	Mon Dec  3 22:48:33 2001
+++ linux/arch/sparc64/kernel/pci_sabre.c	Mon Dec  3 22:48:41 2001
@@ -1,4 +1,4 @@
-/* $Id: pci_sabre.c,v 1.36 2001/06/08 06:25:41 davem Exp $
+/* $Id: pci_sabre.c,v 1.37 2001/06/13 06:34:30 davem Exp $
  * pci_sabre.c: Sabre specific PCI controller support.
  *
  * Copyright (C) 1997, 1998, 1999 David S. Miller (davem@caipfs.rutgers.edu)
@@ -1357,6 +1357,12 @@
 			    (pbm == &p->pbm_A ? 'A' : 'B'));
 		prom_halt();
 	}
+
+	/* Register legacy regions if this PBM covers that area. */
+	if (pbm->io_space.start == ibase &&
+	    pbm->mem_space.start == mbase)
+		pci_register_legacy_regions(&pbm->io_space,
+					    &pbm->mem_space);
 }
 
 static void __init sabre_pbm_init(struct pci_controller_info *p, int sabre_node, u32 dma_begin)
@@ -1497,6 +1503,9 @@
 			prom_printf("Cannot register Hummingbird's MEM space.\n");
 			prom_halt();
 		}
+
+		pci_register_legacy_regions(&pbm->io_space,
+					    &pbm->mem_space);
 	}
 }
 
diff -urN linux-2.4.6-pre4/arch/sparc64/kernel/pci_schizo.c linux/arch/sparc64/kernel/pci_schizo.c
--- linux-2.4.6-pre4/arch/sparc64/kernel/pci_schizo.c	Mon Dec  3 22:48:33 2001
+++ linux/arch/sparc64/kernel/pci_schizo.c	Mon Dec  3 22:48:41 2001
@@ -1,4 +1,4 @@
-/* $Id: pci_schizo.c,v 1.17 2001/06/04 23:20:32 ecd Exp $
+/* $Id: pci_schizo.c,v 1.19 2001/06/20 21:31:00 davem Exp $
  * pci_schizo.c: SCHIZO specific PCI controller support.
  *
  * Copyright (C) 2001 David S. Miller (davem@redhat.com)
@@ -1196,17 +1196,38 @@
 	/* Make all Safari error conditions fatal except unmapped errors
 	 * which we make generate interrupts.
 	 */
+#if 1
+	/* XXX Something wrong with some Excalibur systems
+	 * XXX Sun is shipping.  The behavior on a 2-cpu
+	 * XXX machine is that both CPU1 parity error bits
+	 * XXX are set and are immediately set again when
+	 * XXX their error status bits are cleared.  Just
+	 * XXX ignore them for now.  -DaveM
+	 */
+	schizo_write(base + SCHIZO_SAFARI_ERRCTRL,
+		     (SCHIZO_SAFERRCTRL_EN |
+		      (SAFARI_ERROR_BADCMD | SAFARI_ERROR_SSMDIS |
+		       SAFARI_ERROR_BADMA | SAFARI_ERROR_BADMB |
+		       SAFARI_ERROR_BADMC |
+		       SAFARI_ERROR_CIQTO |
+		       SAFARI_ERROR_LPQTO | SAFARI_ERROR_SFPQTO |
+		       SAFARI_ERROR_UFPQTO | SAFARI_ERROR_APERR |
+		       SAFARI_ERROR_BUSERR | SAFARI_ERROR_TIMEOUT |
+		       SAFARI_ERROR_ILL)));
+#else
 	schizo_write(base + SCHIZO_SAFARI_ERRCTRL,
 		     (SCHIZO_SAFERRCTRL_EN |
 		      (SAFARI_ERROR_BADCMD | SAFARI_ERROR_SSMDIS |
 		       SAFARI_ERROR_BADMA | SAFARI_ERROR_BADMB |
-		       SAFARI_ERROR_BADMC | SAFARI_ERROR_CPU1PS |
-		       SAFARI_ERROR_CPU1PB | SAFARI_ERROR_CPU0PS |
-		       SAFARI_ERROR_CPU0PB | SAFARI_ERROR_CIQTO |
+		       SAFARI_ERROR_BADMC |
+		       SAFARI_ERROR_CPU1PS | SAFARI_ERROR_CPU1PB |
+		       SAFARI_ERROR_CPU0PS | SAFARI_ERROR_CPU0PB |
+		       SAFARI_ERROR_CIQTO |
 		       SAFARI_ERROR_LPQTO | SAFARI_ERROR_SFPQTO |
 		       SAFARI_ERROR_UFPQTO | SAFARI_ERROR_APERR |
 		       SAFARI_ERROR_BUSERR | SAFARI_ERROR_TIMEOUT |
 		       SAFARI_ERROR_ILL)));
+#endif
 
 	schizo_write(base + SCHIZO_SAFARI_IRQCTRL,
 		     (SCHIZO_SAFIRQCTRL_EN | (SAFARI_ERROR_UNMAP)));
@@ -1492,6 +1513,8 @@
 
 	request_resource(&ioport_resource, &pbm->io_space);
 	request_resource(&iomem_resource, &pbm->mem_space);
+	pci_register_legacy_regions(&pbm->io_space,
+				    &pbm->mem_space);
 }
 
 #define SCHIZO_STRBUF_CONTROL_A		(SCHIZO_PBM_A_REGS_OFF + 0x02800UL)
diff -urN linux-2.4.6-pre4/arch/sparc64/kernel/sys_sparc32.c linux/arch/sparc64/kernel/sys_sparc32.c
--- linux-2.4.6-pre4/arch/sparc64/kernel/sys_sparc32.c	Fri Apr 13 20:15:55 2001
+++ linux/arch/sparc64/kernel/sys_sparc32.c	Mon Dec  3 22:48:41 2001
@@ -1,4 +1,4 @@
-/* $Id: sys_sparc32.c,v 1.176 2001/04/14 01:12:02 davem Exp $
+/* $Id: sys_sparc32.c,v 1.177 2001/06/10 06:48:46 davem Exp $
  * sys_sparc32.c: Conversion between 32bit and 64bit native syscalls.
  *
  * Copyright (C) 1997,1998 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
@@ -3493,6 +3493,7 @@
 
 #endif  /* CONFIG_MODULES */
 
+#if defined(CONFIG_NFSD) || defined(CONFIG_NFSD_MODULE)
 /* Stuff for NFS server syscalls... */
 struct nfsctl_svc32 {
 	u16			svc32_port;
@@ -3815,6 +3816,13 @@
 		kfree(kres);
 	return err;
 }
+#else /* !NFSD */
+extern asmlinkage long sys_ni_syscall(void);
+int asmlinkage sys32_nfsservctl(int cmd, void *notused, void *notused2)
+{
+	return sys_ni_syscall();
+}
+#endif
 
 /* Translations due to time_t size differences.  Which affects all
    sorts of things, like timeval and itimerval.  */
diff -urN linux-2.4.6-pre4/arch/sparc64/math-emu/sfp-util.h linux/arch/sparc64/math-emu/sfp-util.h
--- linux-2.4.6-pre4/arch/sparc64/math-emu/sfp-util.h	Mon Dec 20 22:05:52 1999
+++ linux/arch/sparc64/math-emu/sfp-util.h	Mon Dec  3 22:48:41 2001
@@ -1,4 +1,4 @@
-/* $Id: sfp-util.h,v 1.4 1999/09/20 12:14:19 jj Exp $
+/* $Id: sfp-util.h,v 1.5 2001/06/10 06:48:46 davem Exp $
  * arch/sparc64/math-emu/sfp-util.h
  *
  * Copyright (C) 1999 Jakub Jelinek (jj@ultra.linux.cz)
@@ -12,10 +12,10 @@
 #include <asm/byteorder.h>
 
 #define add_ssaaaa(sh, sl, ah, al, bh, bl) 						\
-  __asm__ ("addcc %4,%5,%1
-  	    add %2,%3,%0
-  	    bcs,a,pn %%xcc, 1f
-  	    add %0, 1, %0
+  __asm__ ("addcc %4,%5,%1\n\
+  	    add %2,%3,%0\n\
+  	    bcs,a,pn %%xcc, 1f\n\
+  	    add %0, 1, %0\n\
   	    1:"										\
 	   : "=r" ((UDItype)(sh)),				      			\
 	     "=&r" ((UDItype)(sl))				      			\
@@ -26,10 +26,10 @@
 	   : "cc")
 	   
 #define sub_ddmmss(sh, sl, ah, al, bh, bl) 						\
-  __asm__ ("subcc %4,%5,%1
-  	    sub %2,%3,%0
-  	    bcs,a,pn %%xcc, 1f
-  	    sub %0, 1, %0
+  __asm__ ("subcc %4,%5,%1\n\
+  	    sub %2,%3,%0\n\
+  	    bcs,a,pn %%xcc, 1f\n\
+  	    sub %0, 1, %0\n\
   	    1:"										\
 	   : "=r" ((UDItype)(sh)),				      			\
 	     "=&r" ((UDItype)(sl))				      			\
@@ -43,26 +43,26 @@
   do {											\
 	  UDItype tmp1, tmp2, tmp3, tmp4;						\
 	  __asm__ __volatile__ (							\
-		   "srl %7,0,%3
-		    mulx %3,%6,%1
-		    srlx %6,32,%2
-		    mulx %2,%3,%4
-		    sllx %4,32,%5
-		    srl %6,0,%3
-		    sub %1,%5,%5
-		    srlx %5,32,%5
-		    addcc %4,%5,%4
-		    srlx %7,32,%5
-		    mulx %3,%5,%3
-		    mulx %2,%5,%5
-		    sethi %%hi(0x80000000),%2
-		    addcc %4,%3,%4
-		    srlx %4,32,%4
-		    add %2,%2,%2
-		    movcc %%xcc,%%g0,%2
-		    addcc %5,%4,%5
-		    sllx %3,32,%3
-		    add %1,%3,%1
+		   "srl %7,0,%3\n\
+		    mulx %3,%6,%1\n\
+		    srlx %6,32,%2\n\
+		    mulx %2,%3,%4\n\
+		    sllx %4,32,%5\n\
+		    srl %6,0,%3\n\
+		    sub %1,%5,%5\n\
+		    srlx %5,32,%5\n\
+		    addcc %4,%5,%4\n\
+		    srlx %7,32,%5\n\
+		    mulx %3,%5,%3\n\
+		    mulx %2,%5,%5\n\
+		    sethi %%hi(0x80000000),%2\n\
+		    addcc %4,%3,%4\n\
+		    srlx %4,32,%4\n\
+		    add %2,%2,%2\n\
+		    movcc %%xcc,%%g0,%2\n\
+		    addcc %5,%4,%5\n\
+		    sllx %3,32,%3\n\
+		    add %1,%3,%1\n\
 		    add %5,%2,%0"							\
 	   : "=r" ((UDItype)(wh)),							\
 	     "=&r" ((UDItype)(wl)),							\
diff -urN linux-2.4.6-pre4/drivers/acpi/Config.in linux/drivers/acpi/Config.in
--- linux-2.4.6-pre4/drivers/acpi/Config.in	Wed Dec 31 16:00:00 1969
+++ linux/drivers/acpi/Config.in	Mon Dec  3 22:48:41 2001
@@ -0,0 +1,17 @@
+#
+# ACPI configuration
+#
+#mainmenu_option next_comment
+#comment 'ACPI Configuration'
+
+dep_bool     '    ACPI Debug Statements' CONFIG_ACPI_DEBUG $CONFIG_ACPI
+dep_tristate '    ACPI Bus Manager' CONFIG_ACPI_BUSMGR $CONFIG_ACPI
+
+dep_tristate '      System' CONFIG_ACPI_SYS $CONFIG_ACPI_BUSMGR $CONFIG_ACPI
+dep_tristate '      Processor' CONFIG_ACPI_CPU $CONFIG_ACPI_BUSMGR $CONFIG_ACPI
+dep_tristate '      Button' CONFIG_ACPI_BUTTON $CONFIG_ACPI_BUSMGR $CONFIG_ACPI
+dep_tristate '      AC Adapter' CONFIG_ACPI_AC $CONFIG_ACPI_BUSMGR $CONFIG_ACPI
+dep_tristate '      Embedded Controller' CONFIG_ACPI_EC $CONFIG_ACPI_BUSMGR $CONFIG_ACPI
+dep_tristate '      Control Method Battery' CONFIG_ACPI_CMBATT $CONFIG_ACPI_BUSMGR $CONFIG_ACPI $CONFIG_ACPI_EC
+dep_tristate '      Thermal' CONFIG_ACPI_THERMAL $CONFIG_ACPI_BUSMGR $CONFIG_ACPI  $CONFIG_ACPI_EC
+#endmenu
diff -urN linux-2.4.6-pre4/drivers/acpi/Makefile linux/drivers/acpi/Makefile
--- linux-2.4.6-pre4/drivers/acpi/Makefile	Sat Mar  3 17:46:47 2001
+++ linux/drivers/acpi/Makefile	Mon Dec  3 22:48:41 2001
@@ -1,13 +1,15 @@
 #
 # Makefile for the Linux ACPI interpreter
-#
+# (It's a mess, but it's all here for a reason.)
+# 
 
 O_TARGET := acpi.o
 
 export-objs := acpi_ksyms.o
 
 export ACPI_CFLAGS
-ACPI_CFLAGS := -D_LINUX
+
+ACPI_CFLAGS := -D_LINUX -I$(CURDIR)/include
 
 #
 # CONFIG_ACPI_KERNEL_CONFIG is currently only IA64
@@ -16,25 +18,37 @@
   ACPI_CFLAGS += -DCONFIG_ACPI_KERNEL_CONFIG_ONLY
 endif
 
-EXTRA_CFLAGS += -I./include
+acpi-subdirs := utilities dispatcher events hardware \
+		executer namespace parser resources tables
 
-EXTRA_CFLAGS += $(ACPI_CFLAGS)
+ifdef CONFIG_ACPI_DEBUG
+  ACPI_CFLAGS += -DACPI_DEBUG -Wno-unused #-DENABLE_DEBUGGER
+
+  #acpi-subdirs += debugger
+endif
 
-acpi-subdirs := common dispatcher events hardware \
-		interpreter namespace parser resources tables
+EXTRA_CFLAGS += $(ACPI_CFLAGS)
 
-subdir-$(CONFIG_ACPI) += $(acpi-subdirs)
+mod-subdirs  := ospm
 
-obj-$(CONFIG_ACPI) := $(patsubst %,%.o,$(acpi-subdirs))
-obj-$(CONFIG_ACPI) += os.o acpi_ksyms.o
+subdir-$(CONFIG_ACPI) 		+= $(acpi-subdirs)
+subdir-$(CONFIG_ACPI_BUSMGR)	+= ospm
 
+obj-$(CONFIG_ACPI)	+= os.o acpi_ksyms.o
+obj-$(CONFIG_ACPI)	+= $(foreach dir,$(acpi-subdirs),$(dir)/$(dir).o) 
 ifdef CONFIG_ACPI_KERNEL_CONFIG
-  obj-$(CONFIG_ACPI) += acpiconf.o osconf.o
+   obj-$(CONFIG_ACPI) 	+= acpiconf.o osconf.o
 else
-  obj-$(CONFIG_ACPI) += driver.o cmbatt.o cpu.o ec.o acpi_ksyms.o sys.o table.o power.o
+   obj-$(CONFIG_ACPI)	+= driver.o
 endif
 
-include $(TOPDIR)/Rules.make
+ifeq ($(CONFIG_ACPI_BUSMGR),y)
+	obj-y			+= ospm/ospm.o
+endif
 
-clean:
-	$(RM) *.o */*.o
+# commented out until we distribute it -ASG
+#ifeq ($(CONFIG_KDB),y)
+#	obj-m	+= kdb/kdbm_acpi.o
+#endif
+
+include $(TOPDIR)/Rules.make
diff -urN linux-2.4.6-pre4/drivers/acpi/acpi_ksyms.c linux/drivers/acpi/acpi_ksyms.c
--- linux-2.4.6-pre4/drivers/acpi/acpi_ksyms.c	Fri Feb 16 16:06:17 2001
+++ linux/drivers/acpi/acpi_ksyms.c	Mon Dec  3 22:48:41 2001
@@ -18,6 +18,7 @@
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
+#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/kernel.h>
@@ -27,6 +28,7 @@
 #include "acdebug.h"
 
 extern int acpi_in_debugger;
+extern FADT_DESCRIPTOR acpi_fadt;
 
 #define _COMPONENT	OS_DEPENDENT
 	MODULE_NAME	("symbols")
@@ -55,9 +57,7 @@
 EXPORT_SYMBOL(debug_print_raw);
 EXPORT_SYMBOL(debug_print_prefix);
 
-EXPORT_SYMBOL(acpi_cm_strncmp);
-EXPORT_SYMBOL(acpi_cm_memcpy);
-EXPORT_SYMBOL(acpi_cm_memset);
+EXPORT_SYMBOL(acpi_ut_format_exception);
 
 EXPORT_SYMBOL(acpi_get_handle);
 EXPORT_SYMBOL(acpi_get_parent);
@@ -66,6 +66,7 @@
 EXPORT_SYMBOL(acpi_get_object_info);
 EXPORT_SYMBOL(acpi_get_next_object);
 EXPORT_SYMBOL(acpi_evaluate_object);
+EXPORT_SYMBOL(acpi_get_table);
 
 EXPORT_SYMBOL(acpi_install_notify_handler);
 EXPORT_SYMBOL(acpi_remove_notify_handler);
@@ -73,6 +74,11 @@
 EXPORT_SYMBOL(acpi_remove_gpe_handler);
 EXPORT_SYMBOL(acpi_install_address_space_handler);
 EXPORT_SYMBOL(acpi_remove_address_space_handler);
+EXPORT_SYMBOL(acpi_install_fixed_event_handler);
+EXPORT_SYMBOL(acpi_remove_fixed_event_handler);
+
+EXPORT_SYMBOL(acpi_acquire_global_lock);
+EXPORT_SYMBOL(acpi_release_global_lock);
 
 EXPORT_SYMBOL(acpi_get_current_resources);
 EXPORT_SYMBOL(acpi_get_possible_resources);
@@ -81,3 +87,20 @@
 EXPORT_SYMBOL(acpi_enable_event);
 EXPORT_SYMBOL(acpi_disable_event);
 EXPORT_SYMBOL(acpi_clear_event);
+
+EXPORT_SYMBOL(acpi_get_timer_duration);
+EXPORT_SYMBOL(acpi_get_timer);
+
+EXPORT_SYMBOL(acpi_os_signal_semaphore);
+EXPORT_SYMBOL(acpi_os_create_semaphore);
+EXPORT_SYMBOL(acpi_os_delete_semaphore);
+EXPORT_SYMBOL(acpi_os_wait_semaphore);
+
+EXPORT_SYMBOL(acpi_os_in32);
+EXPORT_SYMBOL(acpi_os_out32);
+EXPORT_SYMBOL(acpi_fadt);
+EXPORT_SYMBOL(acpi_hw_register_bit_access);
+EXPORT_SYMBOL(acpi_hw_obtain_sleep_type_register_data);
+EXPORT_SYMBOL(acpi_enter_sleep_state);
+EXPORT_SYMBOL(acpi_get_system_info);
+
diff -urN linux-2.4.6-pre4/drivers/acpi/cmbatt.c linux/drivers/acpi/cmbatt.c
--- linux-2.4.6-pre4/drivers/acpi/cmbatt.c	Fri Feb  9 11:45:58 2001
+++ linux/drivers/acpi/cmbatt.c	Wed Dec 31 16:00:00 1969
@@ -1,390 +0,0 @@
-/*
- *  cmbatt.c - Control Method Battery driver
- *
- *  Copyright (C) 2000 Andrew Grover
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-/*
- * Changes:
- * Brendan Burns <bburns@wso.williams.edu> 2000-11-15
- * - added proc battery interface
- * - parse returned data from _BST and _BIF
- * Andy Grover <andrew.grover@intel.com> 2000-12-8
- * - improved proc interface
- * Pavel Machek <pavel@suse.cz> 2001-1-31
- * - fixed oops on NULLs in return from _BIF
- */
-
-#include <linux/kernel.h>
-#include <linux/types.h>
-#include <linux/proc_fs.h>
-#include "acpi.h"
-#include "driver.h"
-
-#define _COMPONENT	OS_DEPENDENT
-	MODULE_NAME	("cmbatt")
-
-/* ACPI-specific defines */
-#define ACPI_CMBATT_HID		"PNP0C0A"
-#define ACPI_BATT_PRESENT	0x10
-#define ACPI_BATT_UNKNOWN	0xFFFFFFFF
-
-/* driver-specific defines */
-#define MAX_CM_BATTERIES	0x8
-#define MAX_BATT_STRLEN		0x20
-
-#define Xstrncpy(a, b, c) if (b) strncpy(a,b,c); else strncpy(a, "unknown", c)
-
-struct cmbatt_info
-{
-	u32  power_unit;
-	u32  design_capacity;
-	u32  last_full_capacity;
-	u32  battery_technology;
-	u32  design_voltage;
-	u32  design_capacity_warning;
-	u32  design_capacity_low;
-	u32  battery_capacity_granularity_1;
-	u32  battery_capacity_granularity_2;
-
-	char model_number[MAX_BATT_STRLEN];
-	char serial_number[MAX_BATT_STRLEN];
-	char battery_type[MAX_BATT_STRLEN];
-	char oem_info[MAX_BATT_STRLEN];
-};
-
-struct cmbatt_context
-{
-	u32			is_present;
-	ACPI_HANDLE		handle;
-	char			UID[9];
-	char			*power_unit;
-	struct cmbatt_info	info;
-};
-
-struct cmbatt_status
-{
-	u32			state;
-	u32			present_rate;
-	u32			remaining_capacity;
-	u32			present_voltage;
-};
-
-static u32 batt_count = 0;
-
-static struct cmbatt_context batt_list[MAX_CM_BATTERIES];
-
-static ACPI_STATUS
-acpi_get_battery_status(ACPI_HANDLE handle, struct cmbatt_status *result)
-{
-	ACPI_OBJECT       *obj;
-	ACPI_OBJECT       *objs;
-	ACPI_BUFFER       buf;
-
-	buf.length = 0;
-	buf.pointer = NULL;		
-
-	/* determine buffer length needed */
-	if (acpi_evaluate_object(handle, "_BST", NULL, &buf) != AE_BUFFER_OVERFLOW) {
-		printk(KERN_ERR "Cmbatt: Could not get battery status struct length\n");
-		return AE_NOT_FOUND;
-	}
-
-	buf.pointer = kmalloc(buf.length, GFP_KERNEL);
-	if (!buf.pointer)
-		return AE_NO_MEMORY;
-
-	/* get the data */
-	if (!ACPI_SUCCESS(acpi_evaluate_object(handle, "_BST", NULL, &buf))) {
-		printk(KERN_ERR "Cmbatt: Could not get battery status\n");
-		kfree (buf.pointer);
-		return AE_NOT_FOUND;
-	}
-
-	obj = (ACPI_OBJECT *) buf.pointer;
-	objs = obj->package.elements;
-
-	result->state = objs[0].integer.value;
-	result->present_rate = objs[1].integer.value;
-	result->remaining_capacity = objs[2].integer.value;
-	result->present_voltage = objs[3].integer.value;
-
-	kfree(buf.pointer);
-
-	return AE_OK;
-}
-
-static ACPI_STATUS
-acpi_get_battery_info(ACPI_HANDLE handle, struct cmbatt_info *result)
-{
-	ACPI_OBJECT       *obj;
-	ACPI_OBJECT       *objs;
-	ACPI_BUFFER       buf;
-
-	buf.length = 0;
-	buf.pointer = NULL;
-
-	/* determine the length of the data */
-	if (acpi_evaluate_object(handle, "_BIF", NULL, &buf) != AE_BUFFER_OVERFLOW) {
-		printk(KERN_ERR "Cmbatt: Could not get battery info struct length\n");
-		return AE_NOT_FOUND;
-	}
-
-	buf.pointer = kmalloc(buf.length, GFP_KERNEL);
-	if (!buf.pointer)
-		return AE_NO_MEMORY;
-
-	/* get the data */
-	if (!ACPI_SUCCESS(acpi_evaluate_object(handle, "_BIF", NULL, &buf))) {
-		printk(KERN_ERR "Cmbatt: Could not get battery info\n");
-		kfree (buf.pointer);
-		return AE_NOT_FOUND;
-	}
-	
-	obj = (ACPI_OBJECT *) buf.pointer;
-	objs = obj->package.elements;
-	
-	result->power_unit=objs[0].integer.value;
-	result->design_capacity=objs[1].integer.value;
-	result->last_full_capacity=objs[2].integer.value;
-	result->battery_technology=objs[3].integer.value;
-	result->design_voltage=objs[4].integer.value;
-	result->design_capacity_warning=objs[5].integer.value;
-	result->design_capacity_low=objs[6].integer.value;
-	result->battery_capacity_granularity_1=objs[7].integer.value;
-	result->battery_capacity_granularity_2=objs[8].integer.value;
-
- 	/* BUG: trailing NULL issue */
-	Xstrncpy(result->model_number, objs[9].string.pointer, MAX_BATT_STRLEN-1);
-	Xstrncpy(result->serial_number, objs[10].string.pointer, MAX_BATT_STRLEN-1);
-	Xstrncpy(result->battery_type, objs[11].string.pointer, MAX_BATT_STRLEN-1);
-	Xstrncpy(result->oem_info, objs[12].string.pointer, MAX_BATT_STRLEN-1);
-	
-	kfree(buf.pointer);
-
-	return AE_OK;
-}
-
-/*
- * We found a device with the correct HID
- */
-static ACPI_STATUS
-acpi_found_cmbatt(ACPI_HANDLE handle, u32 level, void *ctx, void **value)
-{
-	ACPI_DEVICE_INFO	info;
-
-	if (batt_count >= MAX_CM_BATTERIES) {
-		printk(KERN_ERR "Cmbatt: MAX_CM_BATTERIES exceeded\n");
-		return AE_OK;
-	}
-
-	if (!ACPI_SUCCESS(acpi_get_object_info(handle, &info))) {
-		printk(KERN_ERR "Cmbatt: Could not get battery object info\n");
-		return (AE_OK);
-	}
-
-	if (info.valid & ACPI_VALID_UID) {
-		strncpy(batt_list[batt_count].UID, info.unique_id, 9);
-	}
-	else if (batt_count > 1) {
-		printk(KERN_WARNING "Cmbatt: No UID but more than 1 battery\n");
-	}
-	
-	if (!(info.valid & ACPI_VALID_STA)) {
-		printk(KERN_ERR "Cmbatt: Battery _STA invalid\n");
-		return AE_OK;
-	}
-
-	if (!(info.current_status & ACPI_BATT_PRESENT)) {
-		printk(KERN_INFO "Cmbatt: Battery socket %d empty\n", batt_count);
-		batt_list[batt_count].is_present = FALSE;
-	}
-	else {
-		printk(KERN_INFO "Cmbatt: Battery socket %d occupied\n", batt_count);
-		batt_list[batt_count].is_present = TRUE;
-		if (acpi_get_battery_info(handle, &batt_list[batt_count].info) != AE_OK) {
-			printk(KERN_ERR "acpi_get_battery_info failed\n");
-			return AE_OK;
-		}
-
-		batt_list[batt_count].power_unit = (batt_list[batt_count].info.power_unit) ? "mA" : "mW";
-	}
-	
-	batt_list[batt_count].handle = handle;
-
-	batt_count++;
-
-	return AE_OK;
-}
-
-static int
-proc_read_batt_info(char *page, char **start, off_t off,
-			int count, int *eof, void *data)
-{
-	struct cmbatt_info *info;
-	u32 batt_num = (u32) data;
-	char *p = page;
-	int len;
-
-	info = &batt_list[batt_num].info;
-
-	/* don't get info more than once for a single proc read */
-	if (off != 0)
-		goto end;
-
-	if (!batt_list[batt_num].is_present) {
-		p += sprintf(p, "battery %d not present\n", batt_num);
-		goto end;
-	}
-
-	if (info->last_full_capacity != ACPI_BATT_UNKNOWN)
-		p += sprintf(p, "Last Full Capacity: %d %sh\n", 
-		     info->last_full_capacity, batt_list[batt_num].power_unit);
-
-	if (info->design_capacity != ACPI_BATT_UNKNOWN)
-		p += sprintf(p, "Design Capacity:    %d %sh\n", 
-		     info->design_capacity, batt_list[batt_num].power_unit);
-	
-	if (info->battery_technology)
-		p += sprintf(p, "Battery Technology: Secondary\n");
-	else
-		p += sprintf(p, "Battery Technology: Primary\n");
-	
-	if (info->design_voltage != ACPI_BATT_UNKNOWN)
-		p += sprintf(p, "Design Voltage:     %d mV\n", 
-		     info->design_voltage);
-	
-	p += sprintf(p, "Design Capacity Warning:    %d %sh\n",
-		info->design_capacity_warning, batt_list[batt_num].power_unit);
-	p += sprintf(p, "Design Capacity Low:        %d %sh\n",
-		info->design_capacity_low, batt_list[batt_num].power_unit);
-	p += sprintf(p, "Battery Capacity Granularity 1: %d\n",
-		info->battery_capacity_granularity_1);
-	p += sprintf(p, "Battery Capacity Granularity 2: %d\n",
-		info->battery_capacity_granularity_2);
-	p += sprintf(p, "Model number; %s\nSerial number: %s\nBattery type: %s\nOEM info: %s\n",
-		info->model_number,info->serial_number,
-		info->battery_type,info->oem_info);
-end:
-	len = (p - page);
-	if (len <= off+count) *eof = 1;
-	*start = page + off;
-	len -= off;
-	if (len>count) len = count;
-	if (len<0) len = 0;
-	return len;
-}
-
-static int
-proc_read_batt_status(char *page, char **start, off_t off,
-			int count, int *eof, void *data)
-{
-	struct cmbatt_status status;
-	u32 batt_num = (u32) data;
-	char *p = page;
-	int len;
-
-	/* don't get status more than once for a single proc read */
-	if (off != 0)
-		goto end;
-
-	if (!batt_list[batt_num].is_present) {
-		p += sprintf(p, "battery %d not present\n", batt_num);
-		goto end;
-	}
-
-	if (acpi_get_battery_status(batt_list[batt_num].handle, &status) != AE_OK) {
-		printk(KERN_ERR "Cmbatt: acpi_get_battery_status failed\n");
-		goto end;
-	}
-
-	p += sprintf(p, "Battery discharging:        %s\n",
-		     (status.state & 0x1)?"yes":"no");
-	p += sprintf(p, "Battery charging:           %s\n",
-		     (status.state & 0x2)?"yes":"no");
-	p += sprintf(p, "Battery critically low:     %s\n",
-		     (status.state & 0x4)?"yes":"no");
-
-	if (status.present_rate != ACPI_BATT_UNKNOWN)
-		p += sprintf(p, "Battery rate:               %d %s\n",
-			status.present_rate, batt_list[batt_num].power_unit);
-
-	if (status.remaining_capacity != ACPI_BATT_UNKNOWN)
-		p += sprintf(p, "Battery capacity:           %d %sh\n",
-			status.remaining_capacity, batt_list[batt_num].power_unit);
-
-	if (status.present_voltage != ACPI_BATT_UNKNOWN)
-		p += sprintf(p, "Battery voltage:            %d mV\n",
-			status.present_voltage);
-
-end:
-
-	len = (p - page);
-	if (len <= off+count) *eof = 1;
-	*start = page + off;
-	len -= off;
-	if (len>count) len = count;
-	if (len<0) len = 0;
-	return len;
-}
-
-
-
-int
-acpi_cmbatt_init(void)
-{
-	int i;
-
-	acpi_get_devices(ACPI_CMBATT_HID, 
-			acpi_found_cmbatt,
-			NULL,
-			NULL);
-
-	for (i = 0; i < batt_count; i++) {
-
-		char batt_name[20];
-
-		sprintf(batt_name, "power/batt%d_info", i);
-		create_proc_read_entry(batt_name, 0, NULL,
-			proc_read_batt_info, (void *) i);
-
-		sprintf(batt_name, "power/batt%d_status", i);
-		create_proc_read_entry(batt_name, 0, NULL,
-			proc_read_batt_status, (void *) i);
-
-	}
-
-	return 0;
-}
-
-int
-acpi_cmbatt_terminate(void)
-{
-	int i;
-
-	for (i = 0; i < batt_count; i++) {
-
-		char batt_name[20];
-
-		sprintf(batt_name, "power/batt%d_info", i);
-		remove_proc_entry(batt_name, NULL);
-
-		sprintf(batt_name, "power/batt%d_status", i);
-		remove_proc_entry(batt_name, NULL);
-	}
-
-	return 0;
-}
diff -urN linux-2.4.6-pre4/drivers/acpi/common/Makefile linux/drivers/acpi/common/Makefile
--- linux-2.4.6-pre4/drivers/acpi/common/Makefile	Fri Dec 29 14:07:21 2000
+++ linux/drivers/acpi/common/Makefile	Wed Dec 31 16:00:00 1969
@@ -1,16 +0,0 @@
-#
-# Makefile for all Linux ACPI interpreter subdirectories
-#
-
-O_TARGET := ../$(shell basename `pwd`).o
-
-obj-$(CONFIG_ACPI) := $(patsubst %.c,%.o,$(wildcard *.c))
-
-EXTRA_CFLAGS += -I../include
-
-EXTRA_CFLAGS += $(ACPI_CFLAGS)
-
-include $(TOPDIR)/Rules.make
-
-clean:
-	$(RM) *.o 
diff -urN linux-2.4.6-pre4/drivers/acpi/common/cmalloc.c linux/drivers/acpi/common/cmalloc.c
--- linux-2.4.6-pre4/drivers/acpi/common/cmalloc.c	Mon Jan 29 10:15:58 2001
+++ linux/drivers/acpi/common/cmalloc.c	Wed Dec 31 16:00:00 1969
@@ -1,170 +0,0 @@
-/******************************************************************************
- *
- * Module Name: cmalloc - local memory allocation routines
- *              $Revision: 84 $
- *
- *****************************************************************************/
-
-/*
- *  Copyright (C) 2000, 2001 R. Byron Moore
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-
-#include "acpi.h"
-#include "acparser.h"
-#include "acinterp.h"
-#include "acnamesp.h"
-#include "acglobal.h"
-
-#define _COMPONENT          MISCELLANEOUS
-	 MODULE_NAME         ("cmalloc")
-
-
-/*****************************************************************************
- *
- * FUNCTION:    _Cm_allocate
- *
- * PARAMETERS:  Size                - Size of the allocation
- *              Component           - Component type of caller
- *              Module              - Source file name of caller
- *              Line                - Line number of caller
- *
- * RETURN:      Address of the allocated memory on success, NULL on failure.
- *
- * DESCRIPTION: The subsystem's equivalent of malloc.
- *
- ****************************************************************************/
-
-void *
-_cm_allocate (
-	u32                     size,
-	u32                     component,
-	NATIVE_CHAR             *module,
-	u32                     line)
-{
-	void                    *address = NULL;
-
-
-	/* Check for an inadvertent size of zero bytes */
-
-	if (!size) {
-		_REPORT_ERROR (module, line, component,
-				("Cm_allocate: Attempt to allocate zero bytes\n"));
-		size = 1;
-	}
-
-	address = acpi_os_allocate (size);
-	if (!address) {
-		/* Report allocation error */
-
-		_REPORT_ERROR (module, line, component,
-				("Cm_allocate: Could not allocate size %X\n", size));
-
-		return (NULL);
-	}
-
-
-	return (address);
-}
-
-
-/*****************************************************************************
- *
- * FUNCTION:    _Cm_callocate
- *
- * PARAMETERS:  Size                - Size of the allocation
- *              Component           - Component type of caller
- *              Module              - Source file name of caller
- *              Line                - Line number of caller
- *
- * RETURN:      Address of the allocated memory on success, NULL on failure.
- *
- * DESCRIPTION: Subsystem equivalent of calloc.
- *
- ****************************************************************************/
-
-void *
-_cm_callocate (
-	u32                     size,
-	u32                     component,
-	NATIVE_CHAR             *module,
-	u32                     line)
-{
-	void                    *address = NULL;
-
-
-	/* Check for an inadvertent size of zero bytes */
-
-	if (!size) {
-		_REPORT_ERROR (module, line, component,
-				("Cm_callocate: Attempt to allocate zero bytes\n"));
-		return (NULL);
-	}
-
-
-	address = acpi_os_callocate (size);
-
-	if (!address) {
-		/* Report allocation error */
-
-		_REPORT_ERROR (module, line, component,
-				("Cm_callocate: Could not allocate size %X\n", size));
-		return (NULL);
-	}
-
-
-	return (address);
-}
-
-
-/*****************************************************************************
- *
- * FUNCTION:    _Cm_free
- *
- * PARAMETERS:  Address             - Address of the memory to deallocate
- *              Component           - Component type of caller
- *              Module              - Source file name of caller
- *              Line                - Line number of caller
- *
- * RETURN:      None
- *
- * DESCRIPTION: Frees the memory at Address
- *
- ****************************************************************************/
-
-void
-_cm_free (
-	void                    *address,
-	u32                     component,
-	NATIVE_CHAR             *module,
-	u32                     line)
-{
-
-	if (NULL == address) {
-		_REPORT_ERROR (module, line, component,
-			("_Cm_free: Trying to delete a NULL address\n"));
-
-		return;
-	}
-
-
-	acpi_os_free (address);
-
-	return;
-}
-
-
diff -urN linux-2.4.6-pre4/drivers/acpi/common/cmclib.c linux/drivers/acpi/common/cmclib.c
--- linux-2.4.6-pre4/drivers/acpi/common/cmclib.c	Mon Jan 22 13:23:42 2001
+++ linux/drivers/acpi/common/cmclib.c	Wed Dec 31 16:00:00 1969
@@ -1,818 +0,0 @@
-/******************************************************************************
- *
- * Module Name: cmclib - Local implementation of C library functions
- * $Revision: 32 $
- *
- *****************************************************************************/
-
-/*
- *  Copyright (C) 2000, 2001 R. Byron Moore
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-
-#include "acpi.h"
-#include "acevents.h"
-#include "achware.h"
-#include "acnamesp.h"
-#include "acinterp.h"
-#include "amlcode.h"
-
-/*
- * These implementations of standard C Library routines can optionally be
- * used if a C library is not available.  In general, they are less efficient
- * than an inline or assembly implementation
- */
-
-#define _COMPONENT          MISCELLANEOUS
-	 MODULE_NAME         ("cmclib")
-
-
-#ifndef ACPI_USE_SYSTEM_CLIBRARY
-
-/*******************************************************************************
- *
- * FUNCTION:    strlen
- *
- * PARAMETERS:  String              - Null terminated string
- *
- * RETURN:      Length
- *
- * DESCRIPTION: Returns the length of the input string
- *
- ******************************************************************************/
-
-
-NATIVE_UINT
-acpi_cm_strlen (
-	const NATIVE_CHAR       *string)
-{
-	NATIVE_UINT             length = 0;
-
-
-	/* Count the string until a null is encountered */
-
-	while (*string) {
-		length++;
-		string++;
-	}
-
-	return (length);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    strcpy
- *
- * PARAMETERS:  Dst_string      - Target of the copy
- *              Src_string      - The source string to copy
- *
- * RETURN:      Dst_string
- *
- * DESCRIPTION: Copy a null terminated string
- *
- ******************************************************************************/
-
-NATIVE_CHAR *
-acpi_cm_strcpy (
-	NATIVE_CHAR             *dst_string,
-	const NATIVE_CHAR       *src_string)
-{
-	NATIVE_CHAR             *string = dst_string;
-
-
-	/* Move bytes brute force */
-
-	while (*src_string) {
-		*string = *src_string;
-
-		string++;
-		src_string++;
-	}
-
-	/* Null terminate */
-
-	*string = 0;
-
-	return (dst_string);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    strncpy
- *
- * PARAMETERS:  Dst_string      - Target of the copy
- *              Src_string      - The source string to copy
- *              Count           - Maximum # of bytes to copy
- *
- * RETURN:      Dst_string
- *
- * DESCRIPTION: Copy a null terminated string, with a maximum length
- *
- ******************************************************************************/
-
-NATIVE_CHAR *
-acpi_cm_strncpy (
-	NATIVE_CHAR             *dst_string,
-	const NATIVE_CHAR       *src_string,
-	NATIVE_UINT             count)
-{
-	NATIVE_CHAR             *string = dst_string;
-
-
-	/* Copy the string */
-
-	for (string = dst_string;
-		count && (count--, (*string++ = *src_string++)); )
-	{;}
-
-	/* Pad with nulls if necessary */
-
-	while (count--) {
-		*string = 0;
-		string++;
-	}
-
-	/* Return original pointer */
-
-	return (dst_string);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    strcmp
- *
- * PARAMETERS:  String1         - First string
- *              String2         - Second string
- *
- * RETURN:      Index where strings mismatched, or 0 if strings matched
- *
- * DESCRIPTION: Compare two null terminated strings
- *
- ******************************************************************************/
-
-u32
-acpi_cm_strcmp (
-	const NATIVE_CHAR       *string1,
-	const NATIVE_CHAR       *string2)
-{
-
-
-	for ( ; (*string1 == *string2); string2++) {
-		if (!*string1++) {
-			return (0);
-		}
-	}
-
-
-	return ((unsigned char) *string1 - (unsigned char) *string2);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    strncmp
- *
- * PARAMETERS:  String1         - First string
- *              String2         - Second string
- *              Count           - Maximum # of bytes to compare
- *
- * RETURN:      Index where strings mismatched, or 0 if strings matched
- *
- * DESCRIPTION: Compare two null terminated strings, with a maximum length
- *
- ******************************************************************************/
-
-u32
-acpi_cm_strncmp (
-	const NATIVE_CHAR       *string1,
-	const NATIVE_CHAR       *string2,
-	NATIVE_UINT             count)
-{
-
-
-	for ( ; count-- && (*string1 == *string2); string2++) {
-		if (!*string1++) {
-			return (0);
-		}
-	}
-
-	return ((count == -1) ? 0 : ((unsigned char) *string1 -
-		(unsigned char) *string2));
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Strcat
- *
- * PARAMETERS:  Dst_string      - Target of the copy
- *              Src_string      - The source string to copy
- *
- * RETURN:      Dst_string
- *
- * DESCRIPTION: Append a null terminated string to a null terminated string
- *
- ******************************************************************************/
-
-NATIVE_CHAR *
-acpi_cm_strcat (
-	NATIVE_CHAR             *dst_string,
-	const NATIVE_CHAR       *src_string)
-{
-	NATIVE_CHAR             *string;
-
-
-	/* Find end of the destination string */
-
-	for (string = dst_string; *string++; ) { ; }
-
-	/* Concatinate the string */
-
-	for (--string; (*string++ = *src_string++); ) { ; }
-
-	return (dst_string);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    strncat
- *
- * PARAMETERS:  Dst_string      - Target of the copy
- *              Src_string      - The source string to copy
- *              Count           - Maximum # of bytes to copy
- *
- * RETURN:      Dst_string
- *
- * DESCRIPTION: Append a null terminated string to a null terminated string,
- *              with a maximum count.
- *
- ******************************************************************************/
-
-NATIVE_CHAR *
-acpi_cm_strncat (
-	NATIVE_CHAR             *dst_string,
-	const NATIVE_CHAR       *src_string,
-	NATIVE_UINT             count)
-{
-	NATIVE_CHAR             *string;
-
-
-	if (count) {
-		/* Find end of the destination string */
-
-		for (string = dst_string; *string++; ) { ; }
-
-		/* Concatinate the string */
-
-		for (--string; (*string++ = *src_string++) && --count; ) { ; }
-
-		/* Null terminate if necessary */
-
-		if (!count) {
-			*string = 0;
-		}
-	}
-
-	return (dst_string);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    memcpy
- *
- * PARAMETERS:  Dest        - Target of the copy
- *              Src         - Source buffer to copy
- *              Count       - Number of bytes to copy
- *
- * RETURN:      Dest
- *
- * DESCRIPTION: Copy arbitrary bytes of memory
- *
- ******************************************************************************/
-
-void *
-acpi_cm_memcpy (
-	void                    *dest,
-	const void              *src,
-	NATIVE_UINT             count)
-{
-	NATIVE_CHAR             *new = (NATIVE_CHAR *) dest;
-	NATIVE_CHAR             *old = (NATIVE_CHAR *) src;
-
-
-	while (count) {
-		*new = *old;
-		new++;
-		old++;
-		count--;
-	}
-
-	return (dest);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    memset
- *
- * PARAMETERS:  Dest        - Buffer to set
- *              Value       - Value to set each byte of memory
- *              Count       - Number of bytes to set
- *
- * RETURN:      Dest
- *
- * DESCRIPTION: Initialize a buffer to a known value.
- *
- ******************************************************************************/
-
-void *
-acpi_cm_memset (
-	void                    *dest,
-	NATIVE_UINT             value,
-	NATIVE_UINT             count)
-{
-	NATIVE_CHAR             *new = (NATIVE_CHAR *) dest;
-
-
-	while (count) {
-		*new = (char) value;
-		new++;
-		count--;
-	}
-
-	return (dest);
-}
-
-
-#define NEGATIVE    1
-#define POSITIVE    0
-
-
-#define _ACPI_XA     0x00    /* extra alphabetic - not supported */
-#define _ACPI_XS     0x40    /* extra space */
-#define _ACPI_BB     0x00    /* BEL, BS, etc. - not supported */
-#define _ACPI_CN     0x20    /* CR, FF, HT, NL, VT */
-#define _ACPI_DI     0x04    /* '0'-'9' */
-#define _ACPI_LO     0x02    /* 'a'-'z' */
-#define _ACPI_PU     0x10    /* punctuation */
-#define _ACPI_SP     0x08    /* space */
-#define _ACPI_UP     0x01    /* 'A'-'Z' */
-#define _ACPI_XD     0x80    /* '0'-'9', 'A'-'F', 'a'-'f' */
-
-static const u8 _acpi_ctype[257] = {
-	_ACPI_CN,            /* 0x0      0.     */
-	_ACPI_CN,            /* 0x1      1.     */
-	_ACPI_CN,            /* 0x2      2.     */
-	_ACPI_CN,            /* 0x3      3.     */
-	_ACPI_CN,            /* 0x4      4.     */
-	_ACPI_CN,            /* 0x5      5.     */
-	_ACPI_CN,            /* 0x6      6.     */
-	_ACPI_CN,            /* 0x7      7.     */
-	_ACPI_CN,            /* 0x8      8.     */
-	_ACPI_CN|_ACPI_SP,   /* 0x9      9.     */
-	_ACPI_CN|_ACPI_SP,   /* 0xA     10.     */
-	_ACPI_CN|_ACPI_SP,   /* 0xB     11.     */
-	_ACPI_CN|_ACPI_SP,   /* 0xC     12.     */
-	_ACPI_CN|_ACPI_SP,   /* 0xD     13.     */
-	_ACPI_CN,            /* 0xE     14.     */
-	_ACPI_CN,            /* 0xF     15.     */
-	_ACPI_CN,            /* 0x10    16.     */
-	_ACPI_CN,            /* 0x11    17.     */
-	_ACPI_CN,            /* 0x12    18.     */
-	_ACPI_CN,            /* 0x13    19.     */
-	_ACPI_CN,            /* 0x14    20.     */
-	_ACPI_CN,            /* 0x15    21.     */
-	_ACPI_CN,            /* 0x16    22.     */
-	_ACPI_CN,            /* 0x17    23.     */
-	_ACPI_CN,            /* 0x18    24.     */
-	_ACPI_CN,            /* 0x19    25.     */
-	_ACPI_CN,            /* 0x1A    26.     */
-	_ACPI_CN,            /* 0x1B    27.     */
-	_ACPI_CN,            /* 0x1C    28.     */
-	_ACPI_CN,            /* 0x1D    29.     */
-	_ACPI_CN,            /* 0x1E    30.     */
-	_ACPI_CN,            /* 0x1F    31.     */
-	_ACPI_XS|_ACPI_SP,   /* 0x20    32. ' ' */
-	_ACPI_PU,            /* 0x21    33. '!' */
-	_ACPI_PU,            /* 0x22    34. '"' */
-	_ACPI_PU,            /* 0x23    35. '#' */
-	_ACPI_PU,            /* 0x24    36. '$' */
-	_ACPI_PU,            /* 0x25    37. '%' */
-	_ACPI_PU,            /* 0x26    38. '&' */
-	_ACPI_PU,            /* 0x27    39. ''' */
-	_ACPI_PU,            /* 0x28    40. '(' */
-	_ACPI_PU,            /* 0x29    41. ')' */
-	_ACPI_PU,            /* 0x2A    42. '*' */
-	_ACPI_PU,            /* 0x2B    43. '+' */
-	_ACPI_PU,            /* 0x2C    44. ',' */
-	_ACPI_PU,            /* 0x2D    45. '-' */
-	_ACPI_PU,            /* 0x2E    46. '.' */
-	_ACPI_PU,            /* 0x2F    47. '/' */
-	_ACPI_XD|_ACPI_DI,   /* 0x30    48. '0' */
-	_ACPI_XD|_ACPI_DI,   /* 0x31    49. '1' */
-	_ACPI_XD|_ACPI_DI,   /* 0x32    50. '2' */
-	_ACPI_XD|_ACPI_DI,   /* 0x33    51. '3' */
-	_ACPI_XD|_ACPI_DI,   /* 0x34    52. '4' */
-	_ACPI_XD|_ACPI_DI,   /* 0x35    53. '5' */
-	_ACPI_XD|_ACPI_DI,   /* 0x36    54. '6' */
-	_ACPI_XD|_ACPI_DI,   /* 0x37    55. '7' */
-	_ACPI_XD|_ACPI_DI,   /* 0x38    56. '8' */
-	_ACPI_XD|_ACPI_DI,   /* 0x39    57. '9' */
-	_ACPI_PU,            /* 0x3A    58. ':' */
-	_ACPI_PU,            /* 0x3B    59. ';' */
-	_ACPI_PU,            /* 0x3C    60. '<' */
-	_ACPI_PU,            /* 0x3D    61. '=' */
-	_ACPI_PU,            /* 0x3E    62. '>' */
-	_ACPI_PU,            /* 0x3F    63. '?' */
-	_ACPI_PU,            /* 0x40    64. '@' */
-	_ACPI_XD|_ACPI_UP,   /* 0x41    65. 'A' */
-	_ACPI_XD|_ACPI_UP,   /* 0x42    66. 'B' */
-	_ACPI_XD|_ACPI_UP,   /* 0x43    67. 'C' */
-	_ACPI_XD|_ACPI_UP,   /* 0x44    68. 'D' */
-	_ACPI_XD|_ACPI_UP,   /* 0x45    69. 'E' */
-	_ACPI_XD|_ACPI_UP,   /* 0x46    70. 'F' */
-	_ACPI_UP,            /* 0x47    71. 'G' */
-	_ACPI_UP,            /* 0x48    72. 'H' */
-	_ACPI_UP,            /* 0x49    73. 'I' */
-	_ACPI_UP,            /* 0x4A    74. 'J' */
-	_ACPI_UP,            /* 0x4B    75. 'K' */
-	_ACPI_UP,            /* 0x4C    76. 'L' */
-	_ACPI_UP,            /* 0x4D    77. 'M' */
-	_ACPI_UP,            /* 0x4E    78. 'N' */
-	_ACPI_UP,            /* 0x4F    79. 'O' */
-	_ACPI_UP,            /* 0x50    80. 'P' */
-	_ACPI_UP,            /* 0x51    81. 'Q' */
-	_ACPI_UP,            /* 0x52    82. 'R' */
-	_ACPI_UP,            /* 0x53    83. 'S' */
-	_ACPI_UP,            /* 0x54    84. 'T' */
-	_ACPI_UP,            /* 0x55    85. 'U' */
-	_ACPI_UP,            /* 0x56    86. 'V' */
-	_ACPI_UP,            /* 0x57    87. 'W' */
-	_ACPI_UP,            /* 0x58    88. 'X' */
-	_ACPI_UP,            /* 0x59    89. 'Y' */
-	_ACPI_UP,            /* 0x5A    90. 'Z' */
-	_ACPI_PU,            /* 0x5B    91. '[' */
-	_ACPI_PU,            /* 0x5C    92. '\' */
-	_ACPI_PU,            /* 0x5D    93. ']' */
-	_ACPI_PU,            /* 0x5E    94. '^' */
-	_ACPI_PU,            /* 0x5F    95. '_' */
-	_ACPI_PU,            /* 0x60    96. '`' */
-	_ACPI_XD|_ACPI_LO,   /* 0x61    97. 'a' */
-	_ACPI_XD|_ACPI_LO,   /* 0x62    98. 'b' */
-	_ACPI_XD|_ACPI_LO,   /* 0x63    99. 'c' */
-	_ACPI_XD|_ACPI_LO,   /* 0x64   100. 'd' */
-	_ACPI_XD|_ACPI_LO,   /* 0x65   101. 'e' */
-	_ACPI_XD|_ACPI_LO,   /* 0x66   102. 'f' */
-	_ACPI_LO,            /* 0x67   103. 'g' */
-	_ACPI_LO,            /* 0x68   104. 'h' */
-	_ACPI_LO,            /* 0x69   105. 'i' */
-	_ACPI_LO,            /* 0x6A   106. 'j' */
-	_ACPI_LO,            /* 0x6B   107. 'k' */
-	_ACPI_LO,            /* 0x6C   108. 'l' */
-	_ACPI_LO,            /* 0x6D   109. 'm' */
-	_ACPI_LO,            /* 0x6E   110. 'n' */
-	_ACPI_LO,            /* 0x6F   111. 'o' */
-	_ACPI_LO,            /* 0x70   112. 'p' */
-	_ACPI_LO,            /* 0x71   113. 'q' */
-	_ACPI_LO,            /* 0x72   114. 'r' */
-	_ACPI_LO,            /* 0x73   115. 's' */
-	_ACPI_LO,            /* 0x74   116. 't' */
-	_ACPI_LO,            /* 0x75   117. 'u' */
-	_ACPI_LO,            /* 0x76   118. 'v' */
-	_ACPI_LO,            /* 0x77   119. 'w' */
-	_ACPI_LO,            /* 0x78   120. 'x' */
-	_ACPI_LO,            /* 0x79   121. 'y' */
-	_ACPI_LO,            /* 0x7A   122. 'z' */
-	_ACPI_PU,            /* 0x7B   123. '{' */
-	_ACPI_PU,            /* 0x7C   124. '|' */
-	_ACPI_PU,            /* 0x7D   125. '}' */
-	_ACPI_PU,            /* 0x7E   126. '~' */
-	_ACPI_CN,            /* 0x7F   127.     */
-
-	0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,  /* 0x80 to 0x8F    */
-	0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,  /* 0x90 to 0x9F    */
-	0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,  /* 0xA0 to 0xAF    */
-	0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,  /* 0xB0 to 0xBF    */
-	0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,  /* 0xC0 to 0xCF    */
-	0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,  /* 0xD0 to 0xDF    */
-	0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,  /* 0xE0 to 0xEF    */
-	0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* 0xF0 to 0x100   */
-};
-
-#define IS_UPPER(c)  (_acpi_ctype[(unsigned char)(c)] & (_ACPI_UP))
-#define IS_LOWER(c)  (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO))
-#define IS_DIGIT(c)  (_acpi_ctype[(unsigned char)(c)] & (_ACPI_DI))
-#define IS_SPACE(c)  (_acpi_ctype[(unsigned char)(c)] & (_ACPI_SP))
-#define IS_XDIGIT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_XD))
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_cm_to_upper
- *
- * PARAMETERS:
- *
- * RETURN:
- *
- * DESCRIPTION: Convert character to uppercase
- *
- ******************************************************************************/
-
-u32
-acpi_cm_to_upper (
-	u32                     c)
-{
-
-	return (IS_LOWER(c) ? ((c)-0x20) : (c));
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_cm_to_lower
- *
- * PARAMETERS:
- *
- * RETURN:
- *
- * DESCRIPTION: Convert character to lowercase
- *
- ******************************************************************************/
-
-u32
-acpi_cm_to_lower (
-	u32                     c)
-{
-
-	return (IS_UPPER(c) ? ((c)+0x20) : (c));
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    strupr
- *
- * PARAMETERS:  Src_string      - The source string to convert to
- *
- * RETURN:      Src_string
- *
- * DESCRIPTION: Convert string to uppercase
- *
- ******************************************************************************/
-
-NATIVE_CHAR *
-acpi_cm_strupr (
-	NATIVE_CHAR             *src_string)
-{
-	NATIVE_CHAR             *string;
-
-
-	/* Walk entire string, uppercasing the letters */
-
-	for (string = src_string; *string; ) {
-		*string = (char) acpi_cm_to_upper (*string);
-		string++;
-	}
-
-
-	return (src_string);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    strstr
- *
- * PARAMETERS:  String1       -
- *              String2
- *
- * RETURN:
- *
- * DESCRIPTION: Checks if String2 occurs in String1. This is not really a
- *              full implementation of strstr, only sufficient for command
- *              matching
- *
- ******************************************************************************/
-
-NATIVE_CHAR *
-acpi_cm_strstr (
-	NATIVE_CHAR             *string1,
-	NATIVE_CHAR             *string2)
-{
-	NATIVE_CHAR             *string;
-
-
-	if (acpi_cm_strlen (string2) > acpi_cm_strlen (string1)) {
-		return (NULL);
-	}
-
-	/* Walk entire string, comparing the letters */
-
-	for (string = string1; *string2; ) {
-		if (*string2 != *string) {
-			return (NULL);
-		}
-
-		string2++;
-		string++;
-	}
-
-
-	return (string1);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    strtoul
- *
- * PARAMETERS:  String          - Null terminated string
- *              Terminater      - Where a pointer to the terminating byte is returned
- *              Base            - Radix of the string
- *
- * RETURN:      Converted value
- *
- * DESCRIPTION: Convert a string into an unsigned value.
- *
- ******************************************************************************/
-
-u32
-acpi_cm_strtoul (
-	const NATIVE_CHAR       *string,
-	NATIVE_CHAR             **terminator,
-	NATIVE_UINT             base)
-{
-	u32                     converted = 0;
-	u32                     index;
-	u32                     sign;
-	const NATIVE_CHAR       *string_start;
-	u32                     return_value = 0;
-	ACPI_STATUS             status = AE_OK;
-
-
-	/*
-	 * Save the value of the pointer to the buffer's first
-	 * character, save the current errno value, and then
-	 * skip over any white space in the buffer:
-	 */
-	string_start = string;
-	while (IS_SPACE (*string) || *string == '\t') {
-		++string;
-	}
-
-	/*
-	 * The buffer may contain an optional plus or minus sign.
-	 * If it does, then skip over it but remember what is was:
-	 */
-	if (*string == '-') {
-		sign = NEGATIVE;
-		++string;
-	}
-
-	else if (*string == '+') {
-		++string;
-		sign = POSITIVE;
-	}
-
-	else {
-		sign = POSITIVE;
-	}
-
-	/*
-	 * If the input parameter Base is zero, then we need to
-	 * determine if it is octal, decimal, or hexadecimal:
-	 */
-	if (base == 0) {
-		if (*string == '0') {
-			if (acpi_cm_to_lower (*(++string)) == 'x') {
-				base = 16;
-				++string;
-			}
-
-			else {
-				base = 8;
-			}
-		}
-
-		else {
-			base = 10;
-		}
-	}
-
-	else if (base < 2 || base > 36) {
-		/*
-		 * The specified Base parameter is not in the domain of
-		 * this function:
-		 */
-		goto done;
-	}
-
-	/*
-	 * For octal and hexadecimal bases, skip over the leading
-	 * 0 or 0x, if they are present.
-	 */
-	if (base == 8 && *string == '0') {
-		string++;
-	}
-
-	if (base == 16 &&
-		*string == '0' &&
-		acpi_cm_to_lower (*(++string)) == 'x')
-	{
-		string++;
-	}
-
-
-	/*
-	 * Main loop: convert the string to an unsigned long:
-	 */
-	while (*string) {
-		if (IS_DIGIT (*string)) {
-			index = *string - '0';
-		}
-
-		else {
-			index = acpi_cm_to_upper (*string);
-			if (IS_UPPER (index)) {
-				index = index - 'A' + 10;
-			}
-
-			else {
-				goto done;
-			}
-		}
-
-		if (index >= base) {
-			goto done;
-		}
-
-		/*
-		 * Check to see if value is out of range:
-		 */
-
-		if (return_value > ((ACPI_UINT32_MAX - (u32) index) /
-				   (u32) base))
-		{
-			status = AE_ERROR;
-			return_value = 0L;          /* reset */
-		}
-
-		else {
-			return_value *= base;
-			return_value += index;
-			converted = 1;
-		}
-
-		++string;
-	}
-
-done:
-	/*
-	 * If appropriate, update the caller's pointer to the next
-	 * unconverted character in the buffer.
-	 */
-	if (terminator) {
-		if (converted == 0 && return_value == 0L && string != NULL) {
-			*terminator = (NATIVE_CHAR *) string_start;
-		}
-
-		else {
-			*terminator = (NATIVE_CHAR *) string;
-		}
-	}
-
-	if (status == AE_ERROR) {
-		return_value = ACPI_UINT32_MAX;
-	}
-
-	/*
-	 * If a minus sign was present, then "the conversion is negated":
-	 */
-	if (sign == NEGATIVE) {
-		return_value = (ACPI_UINT32_MAX - return_value) + 1;
-	}
-
-	return (return_value);
-}
-
-#endif /* ACPI_USE_SYSTEM_CLIBRARY */
-
diff -urN linux-2.4.6-pre4/drivers/acpi/common/cmcopy.c linux/drivers/acpi/common/cmcopy.c
--- linux-2.4.6-pre4/drivers/acpi/common/cmcopy.c	Fri Feb  9 11:45:58 2001
+++ linux/drivers/acpi/common/cmcopy.c	Wed Dec 31 16:00:00 1969
@@ -1,708 +0,0 @@
-/******************************************************************************
- *
- * Module Name: cmcopy - Internal to external object translation utilities
- *              $Revision: 66 $
- *
- *****************************************************************************/
-
-/*
- *  Copyright (C) 2000, 2001 R. Byron Moore
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-
-#include "acpi.h"
-#include "acinterp.h"
-#include "acnamesp.h"
-#include "amlcode.h"
-
-
-#define _COMPONENT          MISCELLANEOUS
-	 MODULE_NAME         ("cmcopy")
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_cm_copy_isimple_to_esimple
- *
- * PARAMETERS:  *Internal_object    - Pointer to the object we are examining
- *              *Buffer             - Where the object is returned
- *              *Space_used         - Where the data length is returned
- *
- * RETURN:      Status
- *
- * DESCRIPTION: This function is called to place a simple object in a user
- *              buffer.
- *
- *              The buffer is assumed to have sufficient space for the object.
- *
- ******************************************************************************/
-
-static ACPI_STATUS
-acpi_cm_copy_isimple_to_esimple (
-	ACPI_OPERAND_OBJECT     *internal_object,
-	ACPI_OBJECT             *external_object,
-	u8                      *data_space,
-	u32                     *buffer_space_used)
-{
-	u32                     length = 0;
-	ACPI_STATUS             status = AE_OK;
-
-
-	/*
-	 * Check for NULL object case (could be an uninitialized
-	 * package element
-	 */
-
-	if (!internal_object) {
-		*buffer_space_used = 0;
-		return (AE_OK);
-	}
-
-	/* Always clear the external object */
-
-	MEMSET (external_object, 0, sizeof (ACPI_OBJECT));
-
-	/*
-	 * In general, the external object will be the same type as
-	 * the internal object
-	 */
-
-	external_object->type = internal_object->common.type;
-
-	/* However, only a limited number of external types are supported */
-
-	switch (internal_object->common.type)
-	{
-
-	case ACPI_TYPE_STRING:
-
-		length = internal_object->string.length + 1;
-		external_object->string.length = internal_object->string.length;
-		external_object->string.pointer = (NATIVE_CHAR *) data_space;
-		MEMCPY ((void *) data_space, (void *) internal_object->string.pointer, length);
-		break;
-
-
-	case ACPI_TYPE_BUFFER:
-
-		length = internal_object->buffer.length;
-		external_object->buffer.length = internal_object->buffer.length;
-		external_object->buffer.pointer = data_space;
-		MEMCPY ((void *) data_space, (void *) internal_object->buffer.pointer, length);
-		break;
-
-
-	case ACPI_TYPE_INTEGER:
-
-		external_object->integer.value= internal_object->integer.value;
-		break;
-
-
-	case INTERNAL_TYPE_REFERENCE:
-
-		/*
-		 * This is an object reference.  Attempt to dereference it.
-		 */
-
-		switch (internal_object->reference.op_code)
-		{
-		case AML_ZERO_OP:
-			external_object->type = ACPI_TYPE_INTEGER;
-			external_object->integer.value = 0;
-			break;
-
-		case AML_ONE_OP:
-			external_object->type = ACPI_TYPE_INTEGER;
-			external_object->integer.value = 1;
-			break;
-
-		case AML_ONES_OP:
-			external_object->type = ACPI_TYPE_INTEGER;
-			external_object->integer.value = ACPI_INTEGER_MAX;
-			break;
-
-		case AML_NAMEPATH_OP:
-			/*
-			 * This is a named reference, get the string.  We already know that
-			 * we have room for it, use max length
-			 */
-			length = MAX_STRING_LENGTH;
-			external_object->type = ACPI_TYPE_STRING;
-			external_object->string.pointer = (NATIVE_CHAR *) data_space;
-			status = acpi_ns_handle_to_pathname ((ACPI_HANDLE *) internal_object->reference.node,
-					 &length, (char *) data_space);
-			break;
-
-		default:
-			/*
-			 * Use the object type of "Any" to indicate a reference
-			 * to object containing a handle to an ACPI named object.
-			 */
-			external_object->type = ACPI_TYPE_ANY;
-			external_object->reference.handle = internal_object->reference.node;
-			break;
-		}
-		break;
-
-
-	case ACPI_TYPE_PROCESSOR:
-
-		external_object->processor.proc_id = internal_object->processor.proc_id;
-		external_object->processor.pblk_address = internal_object->processor.address;
-		external_object->processor.pblk_length = internal_object->processor.length;
-		break;
-
-
-	case ACPI_TYPE_POWER:
-
-		external_object->power_resource.system_level =
-				   internal_object->power_resource.system_level;
-
-		external_object->power_resource.resource_order =
-				   internal_object->power_resource.resource_order;
-		break;
-
-
-	default:
-		/*
-		 * There is no corresponding external object type
-		 */
-		return (AE_SUPPORT);
-		break;
-	}
-
-
-	*buffer_space_used = (u32) ROUND_UP_TO_NATIVE_WORD (length);
-
-	return (status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_cm_copy_ielement_to_eelement
- *
- * PARAMETERS:  ACPI_PKG_CALLBACK
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Copy one package element to another package element
- *
- ******************************************************************************/
-
-ACPI_STATUS
-acpi_cm_copy_ielement_to_eelement (
-	u8                      object_type,
-	ACPI_OPERAND_OBJECT     *source_object,
-	ACPI_GENERIC_STATE      *state,
-	void                    *context)
-{
-	ACPI_STATUS             status = AE_OK;
-	ACPI_PKG_INFO           *info = (ACPI_PKG_INFO *) context;
-	u32                     object_space;
-	u32                     this_index;
-	ACPI_OBJECT             *target_object;
-
-
-	this_index      = state->pkg.index;
-	target_object   = (ACPI_OBJECT *)
-			   &((ACPI_OBJECT *)(state->pkg.dest_object))->package.elements[this_index];
-
-
-	switch (object_type)
-	{
-	case 0:
-
-		/*
-		 * This is a simple or null object -- get the size
-		 */
-
-		status = acpi_cm_copy_isimple_to_esimple (source_object,
-				  target_object, info->free_space, &object_space);
-		if (ACPI_FAILURE (status)) {
-			return (status);
-		}
-
-		break;
-
-	case 1:
-
-		/*
-		 * Build the package object
-		 */
-		target_object->type             = ACPI_TYPE_PACKAGE;
-		target_object->package.count    = source_object->package.count;
-		target_object->package.elements = (ACPI_OBJECT *) info->free_space;
-
-		/*
-		 * Pass the new package object back to the package walk routine
-		 */
-		state->pkg.this_target_obj = target_object;
-
-		/*
-		 * Save space for the array of objects (Package elements)
-		 * update the buffer length counter
-		 */
-		object_space = (u32) ROUND_UP_TO_NATIVE_WORD (
-				   target_object->package.count * sizeof (ACPI_OBJECT));
-		break;
-
-	default:
-		return (AE_BAD_PARAMETER);
-	}
-
-
-	info->free_space  += object_space;
-	info->length      += object_space;
-
-	return (status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_cm_copy_ipackage_to_epackage
- *
- * PARAMETERS:  *Internal_object    - Pointer to the object we are returning
- *              *Buffer             - Where the object is returned
- *              *Space_used         - Where the object length is returned
- *
- * RETURN:      Status
- *
- * DESCRIPTION: This function is called to place a package object in a user
- *              buffer.  A package object by definition contains other objects.
- *
- *              The buffer is assumed to have sufficient space for the object.
- *              The caller must have verified the buffer length needed using the
- *              Acpi_cm_get_object_size function before calling this function.
- *
- ******************************************************************************/
-
-static ACPI_STATUS
-acpi_cm_copy_ipackage_to_epackage (
-	ACPI_OPERAND_OBJECT     *internal_object,
-	u8                      *buffer,
-	u32                     *space_used)
-{
-	ACPI_OBJECT             *external_object;
-	ACPI_STATUS             status;
-	ACPI_PKG_INFO           info;
-
-
-	/*
-	 * First package at head of the buffer
-	 */
-	external_object = (ACPI_OBJECT *) buffer;
-
-	/*
-	 * Free space begins right after the first package
-	 */
-	info.length      = 0;
-	info.object_space = 0;
-	info.num_packages = 1;
-	info.free_space  = buffer + ROUND_UP_TO_NATIVE_WORD (sizeof (ACPI_OBJECT));
-
-
-	external_object->type              = internal_object->common.type;
-	external_object->package.count     = internal_object->package.count;
-	external_object->package.elements  = (ACPI_OBJECT *) info.free_space;
-
-
-	/*
-	 * Build an array of ACPI_OBJECTS in the buffer
-	 * and move the free space past it
-	 */
-
-	info.free_space += external_object->package.count *
-			  ROUND_UP_TO_NATIVE_WORD (sizeof (ACPI_OBJECT));
-
-
-	status = acpi_cm_walk_package_tree (internal_object, external_object,
-			 acpi_cm_copy_ielement_to_eelement, &info);
-
-	*space_used = info.length;
-
-	return (status);
-
-}
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_cm_copy_iobject_to_eobject
- *
- * PARAMETERS:  *Internal_object    - The internal object to be converted
- *              *Buffer_ptr         - Where the object is returned
- *
- * RETURN:      Status
- *
- * DESCRIPTION: This function is called to build an API object to be returned to
- *              the caller.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-acpi_cm_copy_iobject_to_eobject (
-	ACPI_OPERAND_OBJECT     *internal_object,
-	ACPI_BUFFER             *ret_buffer)
-{
-	ACPI_STATUS             status;
-
-
-	if (IS_THIS_OBJECT_TYPE (internal_object, ACPI_TYPE_PACKAGE)) {
-		/*
-		 * Package object:  Copy all subobjects (including
-		 * nested packages)
-		 */
-		status = acpi_cm_copy_ipackage_to_epackage (internal_object,
-				  ret_buffer->pointer, &ret_buffer->length);
-	}
-
-	else {
-		/*
-		 * Build a simple object (no nested objects)
-		 */
-		status = acpi_cm_copy_isimple_to_esimple (internal_object,
-				  (ACPI_OBJECT *) ret_buffer->pointer,
-				  ((u8 *) ret_buffer->pointer +
-				  ROUND_UP_TO_NATIVE_WORD (sizeof (ACPI_OBJECT))),
-				  &ret_buffer->length);
-		/*
-		 * build simple does not include the object size in the length
-		 * so we add it in here
-		 */
-		ret_buffer->length += sizeof (ACPI_OBJECT);
-	}
-
-	return (status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_cm_copy_esimple_to_isimple
- *
- * PARAMETERS:  *External_object   - The external object to be converted
- *              *Internal_object   - Where the internal object is returned
- *
- * RETURN:      Status
- *
- * DESCRIPTION: This function copies an external object to an internal one.
- *              NOTE: Pointers can be copied, we don't need to copy data.
- *              (The pointers have to be valid in our address space no matter
- *              what we do with them!)
- *
- ******************************************************************************/
-
-ACPI_STATUS
-acpi_cm_copy_esimple_to_isimple (
-	ACPI_OBJECT             *external_object,
-	ACPI_OPERAND_OBJECT     *internal_object)
-{
-
-
-	internal_object->common.type = (u8) external_object->type;
-
-	switch (external_object->type)
-	{
-
-	case ACPI_TYPE_STRING:
-
-		internal_object->string.length = external_object->string.length;
-		internal_object->string.pointer = external_object->string.pointer;
-		break;
-
-
-	case ACPI_TYPE_BUFFER:
-
-		internal_object->buffer.length = external_object->buffer.length;
-		internal_object->buffer.pointer = external_object->buffer.pointer;
-		break;
-
-
-	case ACPI_TYPE_INTEGER:
-		/*
-		 * Number is included in the object itself
-		 */
-		internal_object->integer.value  = external_object->integer.value;
-		break;
-
-
-	default:
-		return (AE_CTRL_RETURN_VALUE);
-		break;
-	}
-
-
-	return (AE_OK);
-}
-
-
-#ifdef ACPI_FUTURE_IMPLEMENTATION
-
-/* Code to convert packages that are parameters to control methods */
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_cm_copy_epackage_to_ipackage
- *
- * PARAMETERS:  *Internal_object   - Pointer to the object we are returning
- *              *Buffer         - Where the object is returned
- *              *Space_used     - Where the length of the object is returned
- *
- * RETURN:      Status          - the status of the call
- *
- * DESCRIPTION: This function is called to place a package object in a user
- *              buffer.  A package object by definition contains other objects.
- *
- *              The buffer is assumed to have sufficient space for the object.
- *              The caller must have verified the buffer length needed using the
- *              Acpi_cm_get_object_size function before calling this function.
- *
- ******************************************************************************/
-
-static ACPI_STATUS
-acpi_cm_copy_epackage_to_ipackage (
-	ACPI_OPERAND_OBJECT     *internal_object,
-	u8                      *buffer,
-	u32                     *space_used)
-{
-	u8                      *free_space;
-	ACPI_OBJECT             *external_object;
-	u32                     length = 0;
-	u32                     this_index;
-	u32                     object_space = 0;
-	ACPI_OPERAND_OBJECT     *this_internal_obj;
-	ACPI_OBJECT             *this_external_obj;
-
-
-	/*
-	 * First package at head of the buffer
-	 */
-	external_object = (ACPI_OBJECT *)buffer;
-
-	/*
-	 * Free space begins right after the first package
-	 */
-	free_space = buffer + sizeof(ACPI_OBJECT);
-
-
-	external_object->type              = internal_object->common.type;
-	external_object->package.count     = internal_object->package.count;
-	external_object->package.elements  = (ACPI_OBJECT *)free_space;
-
-
-	/*
-	 * Build an array of ACPI_OBJECTS in the buffer
-	 * and move the free space past it
-	 */
-
-	free_space += external_object->package.count * sizeof(ACPI_OBJECT);
-
-
-	/* Call Walk_package */
-
-}
-
-#endif /* Future implementation */
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_cm_copy_eobject_to_iobject
- *
- * PARAMETERS:  *Internal_object   - The external object to be converted
- *              *Buffer_ptr     - Where the internal object is returned
- *
- * RETURN:      Status          - the status of the call
- *
- * DESCRIPTION: Converts an external object to an internal object.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-acpi_cm_copy_eobject_to_iobject (
-	ACPI_OBJECT             *external_object,
-	ACPI_OPERAND_OBJECT     *internal_object)
-{
-	ACPI_STATUS             status;
-
-
-	if (external_object->type == ACPI_TYPE_PACKAGE) {
-		/*
-		 * Package objects contain other objects (which can be objects)
-		 * buildpackage does it all
-		 *
-		 * TBD: Package conversion must be completed and tested
-		 * NOTE: this code converts packages as input parameters to
-		 * control methods only.  This is a very, very rare case.
-		 */
-/*
-		Status = Acpi_cm_copy_epackage_to_ipackage(Internal_object,
-				 Ret_buffer->Pointer,
-				 &Ret_buffer->Length);
-*/
-		return (AE_NOT_IMPLEMENTED);
-	}
-
-	else {
-		/*
-		 * Build a simple object (no nested objects)
-		 */
-		status = acpi_cm_copy_esimple_to_isimple (external_object, internal_object);
-		/*
-		 * build simple does not include the object size in the length
-		 * so we add it in here
-		 */
-	}
-
-	return (status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_cm_copy_ielement_to_ielement
- *
- * PARAMETERS:  ACPI_PKG_CALLBACK
- *
- * RETURN:      Status          - the status of the call
- *
- * DESCRIPTION: Copy one package element to another package element
- *
- ******************************************************************************/
-
-ACPI_STATUS
-acpi_cm_copy_ielement_to_ielement (
-	u8                      object_type,
-	ACPI_OPERAND_OBJECT     *source_object,
-	ACPI_GENERIC_STATE      *state,
-	void                    *context)
-{
-	ACPI_STATUS             status = AE_OK;
-	u32                     this_index;
-	ACPI_OPERAND_OBJECT     **this_target_ptr;
-	ACPI_OPERAND_OBJECT     *target_object;
-
-
-	this_index    = state->pkg.index;
-	this_target_ptr = (ACPI_OPERAND_OBJECT **)
-			   &state->pkg.dest_object->package.elements[this_index];
-
-	switch (object_type)
-	{
-	case 0:
-
-		/*
-		 * This is a simple object, just copy it
-		 */
-		target_object = acpi_cm_create_internal_object (source_object->common.type);
-		if (!target_object) {
-			return (AE_NO_MEMORY);
-		}
-
-		status = acpi_aml_store_object_to_object (source_object, target_object,
-				  (ACPI_WALK_STATE *) context);
-		if (ACPI_FAILURE (status)) {
-			return (status);
-		}
-
-		*this_target_ptr = target_object;
-		break;
-
-
-	case 1:
-		/*
-		 * This object is a package - go down another nesting level
-		 * Create and build the package object
-		 */
-		target_object = acpi_cm_create_internal_object (ACPI_TYPE_PACKAGE);
-		if (!target_object) {
-			/* TBD: must delete package created up to this point */
-
-			return (AE_NO_MEMORY);
-		}
-
-		target_object->package.count = source_object->package.count;
-
-		/*
-		 * Pass the new package object back to the package walk routine
-		 */
-		state->pkg.this_target_obj = target_object;
-
-		/*
-		 * Store the object pointer in the parent package object
-		 */
-		*this_target_ptr = target_object;
-		break;
-
-	default:
-		return (AE_BAD_PARAMETER);
-	}
-
-
-	return (status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_cm_copy_ipackage_to_ipackage
- *
- * PARAMETERS:  *Source_obj     - Pointer to the source package object
- *              *Dest_obj       - Where the internal object is returned
- *
- * RETURN:      Status          - the status of the call
- *
- * DESCRIPTION: This function is called to copy an internal package object
- *              into another internal package object.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-acpi_cm_copy_ipackage_to_ipackage (
-	ACPI_OPERAND_OBJECT     *source_obj,
-	ACPI_OPERAND_OBJECT     *dest_obj,
-	ACPI_WALK_STATE         *walk_state)
-{
-	ACPI_STATUS             status = AE_OK;
-
-
-	dest_obj->common.type   = source_obj->common.type;
-	dest_obj->package.count = source_obj->package.count;
-
-
-	/*
-	 * Create the object array and walk the source package tree
-	 */
-
-	dest_obj->package.elements = acpi_cm_callocate ((source_obj->package.count + 1) *
-			 sizeof (void *));
-	dest_obj->package.next_element = dest_obj->package.elements;
-
-	if (!dest_obj->package.elements) {
-		REPORT_ERROR (
-			("Aml_build_copy_internal_package_object: Package allocation failure\n"));
-		return (AE_NO_MEMORY);
-	}
-
-
-	status = acpi_cm_walk_package_tree (source_obj, dest_obj,
-			 acpi_cm_copy_ielement_to_ielement, walk_state);
-
-	return (status);
-}
-
diff -urN linux-2.4.6-pre4/drivers/acpi/common/cmdebug.c linux/drivers/acpi/common/cmdebug.c
--- linux-2.4.6-pre4/drivers/acpi/common/cmdebug.c	Mon Jan 22 13:23:42 2001
+++ linux/drivers/acpi/common/cmdebug.c	Wed Dec 31 16:00:00 1969
@@ -1,559 +0,0 @@
-/******************************************************************************
- *
- * Module Name: cmdebug - Debug print routines
- *              $Revision: 64 $
- *
- *****************************************************************************/
-
-/*
- *  Copyright (C) 2000, 2001 R. Byron Moore
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-
-#include "acpi.h"
-
-#define _COMPONENT          MISCELLANEOUS
-	 MODULE_NAME         ("cmdebug")
-
-
-/*****************************************************************************
- *
- * FUNCTION:    Get/Set debug level
- *
- * DESCRIPTION: Get or set value of the debug flag
- *
- *              These are used to allow user's to get/set the debug level
- *
- ****************************************************************************/
-
-
-u32
-get_debug_level (void)
-{
-
-	return (acpi_dbg_level);
-}
-
-void
-set_debug_level (
-	u32                     new_debug_level)
-{
-
-	acpi_dbg_level = new_debug_level;
-}
-
-
-/*****************************************************************************
- *
- * FUNCTION:    Function_trace
- *
- * PARAMETERS:  Module_name         - Caller's module name (for error output)
- *              Line_number         - Caller's line number (for error output)
- *              Component_id        - Caller's component ID (for error output)
- *              Function_name       - Name of Caller's function
- *
- * RETURN:      None
- *
- * DESCRIPTION: Function entry trace.  Prints only if TRACE_FUNCTIONS bit is
- *              set in Debug_level
- *
- ****************************************************************************/
-
-void
-function_trace (
-	NATIVE_CHAR             *module_name,
-	u32                     line_number,
-	u32                     component_id,
-	NATIVE_CHAR             *function_name)
-{
-
-	acpi_gbl_nesting_level++;
-
-	debug_print (module_name, line_number, component_id,
-			 TRACE_FUNCTIONS,
-			 " %2.2ld Entered Function: %s\n",
-			 acpi_gbl_nesting_level, function_name);
-}
-
-
-/*****************************************************************************
- *
- * FUNCTION:    Function_trace_ptr
- *
- * PARAMETERS:  Module_name         - Caller's module name (for error output)
- *              Line_number         - Caller's line number (for error output)
- *              Component_id        - Caller's component ID (for error output)
- *              Function_name       - Name of Caller's function
- *              Pointer             - Pointer to display
- *
- * RETURN:      None
- *
- * DESCRIPTION: Function entry trace.  Prints only if TRACE_FUNCTIONS bit is
- *              set in Debug_level
- *
- ****************************************************************************/
-
-void
-function_trace_ptr (
-	NATIVE_CHAR             *module_name,
-	u32                     line_number,
-	u32                     component_id,
-	NATIVE_CHAR             *function_name,
-	void                    *pointer)
-{
-
-	acpi_gbl_nesting_level++;
-	debug_print (module_name, line_number, component_id, TRACE_FUNCTIONS,
-			 " %2.2ld Entered Function: %s, %p\n",
-			 acpi_gbl_nesting_level, function_name, pointer);
-}
-
-
-/*****************************************************************************
- *
- * FUNCTION:    Function_trace_str
- *
- * PARAMETERS:  Module_name         - Caller's module name (for error output)
- *              Line_number         - Caller's line number (for error output)
- *              Component_id        - Caller's component ID (for error output)
- *              Function_name       - Name of Caller's function
- *              String              - Additional string to display
- *
- * RETURN:      None
- *
- * DESCRIPTION: Function entry trace.  Prints only if TRACE_FUNCTIONS bit is
- *              set in Debug_level
- *
- ****************************************************************************/
-
-void
-function_trace_str (
-	NATIVE_CHAR             *module_name,
-	u32                     line_number,
-	u32                     component_id,
-	NATIVE_CHAR             *function_name,
-	NATIVE_CHAR             *string)
-{
-
-	acpi_gbl_nesting_level++;
-	debug_print (module_name, line_number, component_id, TRACE_FUNCTIONS,
-			 " %2.2ld Entered Function: %s, %s\n",
-			 acpi_gbl_nesting_level, function_name, string);
-}
-
-
-/*****************************************************************************
- *
- * FUNCTION:    Function_trace_u32
- *
- * PARAMETERS:  Module_name         - Caller's module name (for error output)
- *              Line_number         - Caller's line number (for error output)
- *              Component_id        - Caller's component ID (for error output)
- *              Function_name       - Name of Caller's function
- *              Integer             - Integer to display
- *
- * RETURN:      None
- *
- * DESCRIPTION: Function entry trace.  Prints only if TRACE_FUNCTIONS bit is
- *              set in Debug_level
- *
- ****************************************************************************/
-
-void
-function_trace_u32 (
-	NATIVE_CHAR             *module_name,
-	u32                     line_number,
-	u32                     component_id,
-	NATIVE_CHAR             *function_name,
-	u32                     integer)
-{
-
-	acpi_gbl_nesting_level++;
-	debug_print (module_name, line_number, component_id, TRACE_FUNCTIONS,
-			 " %2.2ld Entered Function: %s, %lX\n",
-			 acpi_gbl_nesting_level, function_name, integer);
-}
-
-
-/*****************************************************************************
- *
- * FUNCTION:    Function_exit
- *
- * PARAMETERS:  Module_name         - Caller's module name (for error output)
- *              Line_number         - Caller's line number (for error output)
- *              Component_id        - Caller's component ID (for error output)
- *              Function_name       - Name of Caller's function
- *
- * RETURN:      None
- *
- * DESCRIPTION: Function exit trace.  Prints only if TRACE_FUNCTIONS bit is
- *              set in Debug_level
- *
- ****************************************************************************/
-
-void
-function_exit (
-	NATIVE_CHAR             *module_name,
-	u32                     line_number,
-	u32                     component_id,
-	NATIVE_CHAR             *function_name)
-{
-
-	debug_print (module_name, line_number, component_id, TRACE_FUNCTIONS,
-			 " %2.2ld Exiting Function: %s\n",
-			 acpi_gbl_nesting_level, function_name);
-
-	acpi_gbl_nesting_level--;
-}
-
-
-/*****************************************************************************
- *
- * FUNCTION:    Function_status_exit
- *
- * PARAMETERS:  Module_name         - Caller's module name (for error output)
- *              Line_number         - Caller's line number (for error output)
- *              Component_id        - Caller's component ID (for error output)
- *              Function_name       - Name of Caller's function
- *              Status              - Exit status code
- *
- * RETURN:      None
- *
- * DESCRIPTION: Function exit trace.  Prints only if TRACE_FUNCTIONS bit is
- *              set in Debug_level. Prints exit status also.
- *
- ****************************************************************************/
-
-void
-function_status_exit (
-	NATIVE_CHAR             *module_name,
-	u32                     line_number,
-	u32                     component_id,
-	NATIVE_CHAR             *function_name,
-	ACPI_STATUS             status)
-{
-
-	debug_print (module_name, line_number, component_id,
-		TRACE_FUNCTIONS,
-		" %2.2ld Exiting Function: %s, %s\n",
-		acpi_gbl_nesting_level,
-		function_name,
-		acpi_cm_format_exception (status));
-
-	acpi_gbl_nesting_level--;
-}
-
-
-/*****************************************************************************
- *
- * FUNCTION:    Function_value_exit
- *
- * PARAMETERS:  Module_name         - Caller's module name (for error output)
- *              Line_number         - Caller's line number (for error output)
- *              Component_id        - Caller's component ID (for error output)
- *              Function_name       - Name of Caller's function
- *              Value               - Value to be printed with exit msg
- *
- * RETURN:      None
- *
- * DESCRIPTION: Function exit trace.  Prints only if TRACE_FUNCTIONS bit is
- *              set in Debug_level. Prints exit value also.
- *
- ****************************************************************************/
-
-void
-function_value_exit (
-	NATIVE_CHAR             *module_name,
-	u32                     line_number,
-	u32                     component_id,
-	NATIVE_CHAR             *function_name,
-	ACPI_INTEGER            value)
-{
-
-	debug_print (module_name, line_number, component_id, TRACE_FUNCTIONS,
-			 " %2.2ld Exiting Function: %s, %X\n",
-			 acpi_gbl_nesting_level, function_name, value);
-
-	acpi_gbl_nesting_level--;
-}
-
-
-/*****************************************************************************
- *
- * FUNCTION:    Function_ptr_exit
- *
- * PARAMETERS:  Module_name         - Caller's module name (for error output)
- *              Line_number         - Caller's line number (for error output)
- *              Component_id        - Caller's component ID (for error output)
- *              Function_name       - Name of Caller's function
- *              Value               - Value to be printed with exit msg
- *
- * RETURN:      None
- *
- * DESCRIPTION: Function exit trace.  Prints only if TRACE_FUNCTIONS bit is
- *              set in Debug_level. Prints exit value also.
- *
- ****************************************************************************/
-
-void
-function_ptr_exit (
-	NATIVE_CHAR             *module_name,
-	u32                     line_number,
-	u32                     component_id,
-	NATIVE_CHAR             *function_name,
-	u8                      *ptr)
-{
-
-	debug_print (module_name, line_number, component_id, TRACE_FUNCTIONS,
-			 " %2.2ld Exiting Function: %s, %p\n",
-			 acpi_gbl_nesting_level, function_name, ptr);
-
-	acpi_gbl_nesting_level--;
-}
-
-
-/*****************************************************************************
- *
- * FUNCTION:    Debug_print
- *
- * PARAMETERS:  Module_name         - Caller's module name (for error output)
- *              Line_number         - Caller's line number (for error output)
- *              Component_id        - Caller's component ID (for error output)
- *              Print_level         - Requested debug print level
- *              Format              - Printf format field
- *              ...                 - Optional printf arguments
- *
- * RETURN:      None
- *
- * DESCRIPTION: Print error message with prefix consisting of the module name,
- *              line number, and component ID.
- *
- ****************************************************************************/
-
-void
-debug_print (
-	NATIVE_CHAR             *module_name,
-	u32                     line_number,
-	u32                     component_id,
-	u32                     print_level,
-	NATIVE_CHAR             *format,
-	...)
-{
-	va_list                 args;
-
-
-	/* Both the level and the component must be enabled */
-
-	if ((print_level & acpi_dbg_level) &&
-		(component_id & acpi_dbg_layer))
-	{
-		va_start (args, format);
-
-		acpi_os_printf ("%8s-%04d: ", module_name, line_number);
-		acpi_os_vprintf (format, args);
-	}
-}
-
-
-/*****************************************************************************
- *
- * FUNCTION:    Debug_print_prefix
- *
- * PARAMETERS:  Module_name         - Caller's module name (for error output)
- *              Line_number         - Caller's line number (for error output)
- *              Component_id        - Caller's component ID (for error output)
- *
- * RETURN:      None
- *
- * DESCRIPTION: Print the prefix part of an error message, consisting of the
- *              module name, and line number
- *
- ****************************************************************************/
-
-void
-debug_print_prefix (
-	NATIVE_CHAR             *module_name,
-	u32                     line_number)
-{
-
-
-	acpi_os_printf ("%8s-%04d: ", module_name, line_number);
-}
-
-
-/*****************************************************************************
- *
- * FUNCTION:    Debug_print_raw
- *
- * PARAMETERS:  Format              - Printf format field
- *              ...                 - Optional printf arguments
- *
- * RETURN:      None
- *
- * DESCRIPTION: Print error message -- without module/line indentifiers
- *
- ****************************************************************************/
-
-void
-debug_print_raw (
-	NATIVE_CHAR             *format,
-	...)
-{
-	va_list                 args;
-
-
-	va_start (args, format);
-
-	acpi_os_vprintf (format, args);
-
-	va_end (args);
-}
-
-
-/*****************************************************************************
- *
- * FUNCTION:    Acpi_cm_dump_buffer
- *
- * PARAMETERS:  Buffer              - Buffer to dump
- *              Count               - Amount to dump, in bytes
- *              Component_iD        - Caller's component ID
- *
- * RETURN:      None
- *
- * DESCRIPTION: Generic dump buffer in both hex and ascii.
- *
- ****************************************************************************/
-
-void
-acpi_cm_dump_buffer (
-	u8                      *buffer,
-	u32                     count,
-	u32                     display,
-	u32                     component_id)
-{
-	u32                     i = 0;
-	u32                     j;
-	u32                     temp32;
-	u8                      buf_char;
-
-
-	/* Only dump the buffer if tracing is enabled */
-
-	if (!((TRACE_TABLES & acpi_dbg_level) &&
-		(component_id & acpi_dbg_layer)))
-	{
-		return;
-	}
-
-
-	/*
-	 * Nasty little dump buffer routine!
-	 */
-	while (i < count) {
-		/* Print current offset */
-
-		acpi_os_printf ("%05X  ", i);
-
-
-		/* Print 16 hex chars */
-
-		for (j = 0; j < 16;) {
-			if (i + j >= count) {
-				acpi_os_printf ("\n");
-				return;
-			}
-
-			/* Make sure that the s8 doesn't get sign-extended! */
-
-			switch (display)
-			{
-			/* Default is BYTE display */
-
-			default:
-
-				acpi_os_printf ("%02X ",
-						*((u8 *) &buffer[i + j]));
-				j += 1;
-				break;
-
-
-			case DB_WORD_DISPLAY:
-
-				MOVE_UNALIGNED16_TO_32 (&temp32,
-						 &buffer[i + j]);
-				acpi_os_printf ("%04X ", temp32);
-				j += 2;
-				break;
-
-
-			case DB_DWORD_DISPLAY:
-
-				MOVE_UNALIGNED32_TO_32 (&temp32,
-						 &buffer[i + j]);
-				acpi_os_printf ("%08X ", temp32);
-				j += 4;
-				break;
-
-
-			case DB_QWORD_DISPLAY:
-
-				MOVE_UNALIGNED32_TO_32 (&temp32,
-						 &buffer[i + j]);
-				acpi_os_printf ("%08X", temp32);
-
-				MOVE_UNALIGNED32_TO_32 (&temp32,
-						 &buffer[i + j + 4]);
-				acpi_os_printf ("%08X ", temp32);
-				j += 8;
-				break;
-			}
-		}
-
-
-		/*
-		 * Print the ASCII equivalent characters
-		 * But watch out for the bad unprintable ones...
-		 */
-
-		for (j = 0; j < 16; j++) {
-			if (i + j >= count) {
-				acpi_os_printf ("\n");
-				return;
-			}
-
-			buf_char = buffer[i + j];
-			if ((buf_char > 0x1F && buf_char < 0x2E) ||
-				(buf_char > 0x2F && buf_char < 0x61) ||
-				(buf_char > 0x60 && buf_char < 0x7F))
-			{
-				acpi_os_printf ("%c", buf_char);
-			}
-			else {
-				acpi_os_printf (".");
-			}
-		}
-
-		/* Done with that line. */
-
-		acpi_os_printf ("\n");
-		i += 16;
-	}
-
-	return;
-}
-
-
diff -urN linux-2.4.6-pre4/drivers/acpi/common/cmdelete.c linux/drivers/acpi/common/cmdelete.c
--- linux-2.4.6-pre4/drivers/acpi/common/cmdelete.c	Mon Jan 22 13:23:42 2001
+++ linux/drivers/acpi/common/cmdelete.c	Wed Dec 31 16:00:00 1969
@@ -1,591 +0,0 @@
-/*******************************************************************************
- *
- * Module Name: cmdelete - object deletion and reference count utilities
- *              $Revision: 62 $
- *
- ******************************************************************************/
-
-/*
- *  Copyright (C) 2000, 2001 R. Byron Moore
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-
-#include "acpi.h"
-#include "acinterp.h"
-#include "acnamesp.h"
-#include "actables.h"
-#include "acparser.h"
-
-#define _COMPONENT          MISCELLANEOUS
-	 MODULE_NAME         ("cmdelete")
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_cm_delete_internal_obj
- *
- * PARAMETERS:  *Object        - Pointer to the list to be deleted
- *
- * RETURN:      None
- *
- * DESCRIPTION: Low level object deletion, after reference counts have been
- *              updated (All reference counts, including sub-objects!)
- *
- ******************************************************************************/
-
-void
-acpi_cm_delete_internal_obj (
-	ACPI_OPERAND_OBJECT     *object)
-{
-	void                    *obj_pointer = NULL;
-	ACPI_OPERAND_OBJECT     *handler_desc;
-
-
-	if (!object) {
-		return;
-	}
-
-	/*
-	 * Must delete or free any pointers within the object that are not
-	 * actual ACPI objects (for example, a raw buffer pointer).
-	 */
-
-	switch (object->common.type)
-	{
-
-	case ACPI_TYPE_STRING:
-
-		/* Free the actual string buffer */
-
-		obj_pointer = object->string.pointer;
-		break;
-
-
-	case ACPI_TYPE_BUFFER:
-
-		/* Free the actual buffer */
-
-		obj_pointer = object->buffer.pointer;
-		break;
-
-
-	case ACPI_TYPE_PACKAGE:
-
-		/*
-		 * Elements of the package are not handled here, they are deleted
-		 * separately
-		 */
-
-		/* Free the (variable length) element pointer array */
-
-		obj_pointer = object->package.elements;
-		break;
-
-
-	case ACPI_TYPE_MUTEX:
-
-		acpi_os_delete_semaphore (object->mutex.semaphore);
-		break;
-
-
-	case ACPI_TYPE_EVENT:
-
-		acpi_os_delete_semaphore (object->event.semaphore);
-		object->event.semaphore = NULL;
-		break;
-
-
-	case ACPI_TYPE_METHOD:
-
-		/* Delete the method semaphore if it exists */
-
-		if (object->method.semaphore) {
-			acpi_os_delete_semaphore (object->method.semaphore);
-			object->method.semaphore = NULL;
-		}
-
-		break;
-
-
-	case ACPI_TYPE_REGION:
-
-
-		if (object->region.extra) {
-			/*
-			 * Free the Region_context if and only if the handler is one of the
-			 * default handlers -- and therefore, we created the context object
-			 * locally, it was not created by an external caller.
-			 */
-			handler_desc = object->region.addr_handler;
-			if ((handler_desc) &&
-				(handler_desc->addr_handler.hflags == ADDR_HANDLER_DEFAULT_INSTALLED))
-			{
-				obj_pointer = object->region.extra->extra.region_context;
-			}
-
-			/* Now we can free the Extra object */
-
-			acpi_cm_delete_object_desc (object->region.extra);
-		}
-		break;
-
-
-	case ACPI_TYPE_FIELD_UNIT:
-
-		if (object->field_unit.extra) {
-			acpi_cm_delete_object_desc (object->field_unit.extra);
-		}
-		break;
-
-	default:
-		break;
-	}
-
-
-	/*
-	 * Delete any allocated memory found above
-	 */
-
-	if (obj_pointer) {
-		if (!acpi_tb_system_table_pointer (obj_pointer)) {
-			acpi_cm_free (obj_pointer);
-		}
-	}
-
-
-	/* Only delete the object if it was dynamically allocated */
-
-
-	if (!(object->common.flags & AOPOBJ_STATIC_ALLOCATION)) {
-		acpi_cm_delete_object_desc (object);
-
-	}
-
-	return;
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_cm_delete_internal_object_list
- *
- * PARAMETERS:  *Obj_list       - Pointer to the list to be deleted
- *
- * RETURN:      Status          - the status of the call
- *
- * DESCRIPTION: This function deletes an internal object list, including both
- *              simple objects and package objects
- *
- ******************************************************************************/
-
-ACPI_STATUS
-acpi_cm_delete_internal_object_list (
-	ACPI_OPERAND_OBJECT     **obj_list)
-{
-	ACPI_OPERAND_OBJECT     **internal_obj;
-
-
-	/* Walk the null-terminated internal list */
-
-	for (internal_obj = obj_list; *internal_obj; internal_obj++) {
-		/*
-		 * Check for a package
-		 * Simple objects are simply stored in the array and do not
-		 * need to be deleted separately.
-		 */
-
-		if (IS_THIS_OBJECT_TYPE ((*internal_obj), ACPI_TYPE_PACKAGE)) {
-			/* Delete the package */
-
-			/*
-			 * TBD: [Investigate] This might not be the right thing to do,
-			 * depending on how the internal package object was allocated!!!
-			 */
-			acpi_cm_delete_internal_obj (*internal_obj);
-		}
-
-	}
-
-	/* Free the combined parameter pointer list and object array */
-
-	acpi_cm_free (obj_list);
-
-	return (AE_OK);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_cm_update_ref_count
- *
- * PARAMETERS:  *Object         - Object whose ref count is to be updated
- *              Action          - What to do
- *
- * RETURN:      New ref count
- *
- * DESCRIPTION: Modify the ref count and return it.
- *
- ******************************************************************************/
-
-static void
-acpi_cm_update_ref_count (
-	ACPI_OPERAND_OBJECT     *object,
-	u32                     action)
-{
-	u16                     count;
-	u16                     new_count;
-
-
-	if (!object) {
-		return;
-	}
-
-
-	count = object->common.reference_count;
-	new_count = count;
-
-	/*
-	 * Reference count action (increment, decrement, or force delete)
-	 */
-
-	switch (action)
-	{
-
-	case REF_INCREMENT:
-
-		new_count++;
-		object->common.reference_count = new_count;
-
-		break;
-
-
-	case REF_DECREMENT:
-
-		if (count < 1) {
-			new_count = 0;
-		}
-
-		else {
-			new_count--;
-
-		}
-
-
-		object->common.reference_count = new_count;
-		if (new_count == 0) {
-			acpi_cm_delete_internal_obj (object);
-		}
-
-		break;
-
-
-	case REF_FORCE_DELETE:
-
-		new_count = 0;
-		object->common.reference_count = new_count;
-		acpi_cm_delete_internal_obj (object);
-		break;
-
-
-	default:
-
-		break;
-	}
-
-
-	/*
-	 * Sanity check the reference count, for debug purposes only.
-	 * (A deleted object will have a huge reference count)
-	 */
-
-
-	return;
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_cm_update_object_reference
- *
- * PARAMETERS:  *Object             - Increment ref count for this object
- *                                    and all sub-objects
- *              Action              - Either REF_INCREMENT or REF_DECREMENT or
- *                                    REF_FORCE_DELETE
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Increment the object reference count
- *
- * Object references are incremented when:
- * 1) An object is attached to a Node (namespace object)
- * 2) An object is copied (all subobjects must be incremented)
- *
- * Object references are decremented when:
- * 1) An object is detached from an Node
- *
- ******************************************************************************/
-
-ACPI_STATUS
-acpi_cm_update_object_reference (
-	ACPI_OPERAND_OBJECT     *object,
-	u16                     action)
-{
-	ACPI_STATUS             status;
-	u32                     i;
-	ACPI_OPERAND_OBJECT     *next;
-	ACPI_OPERAND_OBJECT     *new;
-	ACPI_GENERIC_STATE       *state_list = NULL;
-	ACPI_GENERIC_STATE       *state;
-
-
-	/* Ignore a null object ptr */
-
-	if (!object) {
-		return (AE_OK);
-	}
-
-
-	/*
-	 * Make sure that this isn't a namespace handle or an AML pointer
-	 */
-
-	if (VALID_DESCRIPTOR_TYPE (object, ACPI_DESC_TYPE_NAMED)) {
-		return (AE_OK);
-	}
-
-	if (acpi_tb_system_table_pointer (object)) {
-		return (AE_OK);
-	}
-
-
-	state = acpi_cm_create_update_state (object, action);
-
-	while (state) {
-
-		object = state->update.object;
-		action = state->update.value;
-		acpi_cm_delete_generic_state (state);
-
-		/*
-		 * All sub-objects must have their reference count incremented also.
-		 * Different object types have different subobjects.
-		 */
-		switch (object->common.type)
-		{
-
-		case ACPI_TYPE_DEVICE:
-
-			status = acpi_cm_create_update_state_and_push (object->device.addr_handler,
-					   action, &state_list);
-			if (ACPI_FAILURE (status)) {
-				return (status);
-			}
-
-			acpi_cm_update_ref_count (object->device.sys_handler, action);
-			acpi_cm_update_ref_count (object->device.drv_handler, action);
-			break;
-
-
-		case INTERNAL_TYPE_ADDRESS_HANDLER:
-
-			/* Must walk list of address handlers */
-
-			next = object->addr_handler.next;
-			while (next) {
-				new = next->addr_handler.next;
-				acpi_cm_update_ref_count (next, action);
-
-				next = new;
-			}
-			break;
-
-
-		case ACPI_TYPE_PACKAGE:
-
-			/*
-			 * We must update all the sub-objects of the package
-			 * (Each of whom may have their own sub-objects, etc.
-			 */
-			for (i = 0; i < object->package.count; i++) {
-				/*
-				 * Push each element onto the stack for later processing.
-				 * Note: There can be null elements within the package,
-				 * these are simply ignored
-				 */
-
-				status = acpi_cm_create_update_state_and_push (
-						 object->package.elements[i], action, &state_list);
-				if (ACPI_FAILURE (status)) {
-					return (status);
-				}
-			}
-			break;
-
-
-		case ACPI_TYPE_FIELD_UNIT:
-
-			status = acpi_cm_create_update_state_and_push (
-					 object->field_unit.container, action, &state_list);
-
-			if (ACPI_FAILURE (status)) {
-				return (status);
-			}
-			break;
-
-
-		case INTERNAL_TYPE_DEF_FIELD:
-
-			status = acpi_cm_create_update_state_and_push (
-					 object->field.container, action, &state_list);
-			if (ACPI_FAILURE (status)) {
-				return (status);
-			}
-		   break;
-
-
-		case INTERNAL_TYPE_BANK_FIELD:
-
-			status = acpi_cm_create_update_state_and_push (
-					 object->bank_field.bank_select, action, &state_list);
-			if (ACPI_FAILURE (status)) {
-				return (status);
-			}
-
-			status = acpi_cm_create_update_state_and_push (
-					 object->bank_field.container, action, &state_list);
-			if (ACPI_FAILURE (status)) {
-				return (status);
-			}
-			break;
-
-
-		case ACPI_TYPE_REGION:
-
-	/* TBD: [Investigate]
-			Acpi_cm_update_ref_count (Object->Region.Addr_handler, Action);
-	*/
-/*
-			Status =
-				Acpi_cm_create_update_state_and_push (Object->Region.Addr_handler,
-						   Action, &State_list);
-			if (ACPI_FAILURE (Status)) {
-				return (Status);
-			}
-*/
-			break;
-
-
-		case INTERNAL_TYPE_REFERENCE:
-
-			break;
-		}
-
-
-		/*
-		 * Now we can update the count in the main object.  This can only
-		 * happen after we update the sub-objects in case this causes the
-		 * main object to be deleted.
-		 */
-
-		acpi_cm_update_ref_count (object, action);
-
-
-		/* Move on to the next object to be updated */
-
-		state = acpi_cm_pop_generic_state (&state_list);
-	}
-
-
-	return (AE_OK);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_cm_add_reference
- *
- * PARAMETERS:  *Object        - Object whose reference count is to be
- *                                  incremented
- *
- * RETURN:      None
- *
- * DESCRIPTION: Add one reference to an ACPI object
- *
- ******************************************************************************/
-
-void
-acpi_cm_add_reference (
-	ACPI_OPERAND_OBJECT     *object)
-{
-
-
-	/*
-	 * Ensure that we have a valid object
-	 */
-
-	if (!acpi_cm_valid_internal_object (object)) {
-		return;
-	}
-
-	/*
-	 * We have a valid ACPI internal object, now increment the reference count
-	 */
-
-	acpi_cm_update_object_reference (object, REF_INCREMENT);
-
-	return;
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_cm_remove_reference
- *
- * PARAMETERS:  *Object        - Object whose ref count will be decremented
- *
- * RETURN:      None
- *
- * DESCRIPTION: Decrement the reference count of an ACPI internal object
- *
- ******************************************************************************/
-
-void
-acpi_cm_remove_reference (
-	ACPI_OPERAND_OBJECT     *object)
-{
-
-
-	/*
-	 * Ensure that we have a valid object
-	 */
-
-	if (!acpi_cm_valid_internal_object (object)) {
-		return;
-	}
-
-	/*
-	 * Decrement the reference count, and only actually delete the object
-	 * if the reference count becomes 0.  (Must also decrement the ref count
-	 * of all subobjects!)
-	 */
-
-	acpi_cm_update_object_reference (object, REF_DECREMENT);
-
-	return;
-}
-
-
diff -urN linux-2.4.6-pre4/drivers/acpi/common/cmeval.c linux/drivers/acpi/common/cmeval.c
--- linux-2.4.6-pre4/drivers/acpi/common/cmeval.c	Mon Jan 22 13:23:42 2001
+++ linux/drivers/acpi/common/cmeval.c	Wed Dec 31 16:00:00 1969
@@ -1,308 +0,0 @@
-/******************************************************************************
- *
- * Module Name: cmeval - Object evaluation
- *              $Revision: 21 $
- *
- *****************************************************************************/
-
-/*
- *  Copyright (C) 2000, 2001 R. Byron Moore
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-
-#include "acpi.h"
-#include "acnamesp.h"
-#include "acinterp.h"
-
-
-#define _COMPONENT          MISCELLANEOUS
-	 MODULE_NAME         ("cmeval")
-
-
-/****************************************************************************
- *
- * FUNCTION:    Acpi_cm_evaluate_numeric_object
- *
- * PARAMETERS:  *Object_name        - Object name to be evaluated
- *              Device_node         - Node for the device
- *              *Address            - Where the value is returned
- *
- * RETURN:      Status
- *
- * DESCRIPTION: evaluates a numeric namespace object for a selected device
- *              and stores results in *Address.
- *
- *              NOTE: Internal function, no parameter validation
- *
- ***************************************************************************/
-
-ACPI_STATUS
-acpi_cm_evaluate_numeric_object (
-	NATIVE_CHAR             *object_name,
-	ACPI_NAMESPACE_NODE     *device_node,
-	ACPI_INTEGER            *address)
-{
-	ACPI_OPERAND_OBJECT     *obj_desc;
-	ACPI_STATUS             status;
-
-
-	/* Execute the method */
-
-	status = acpi_ns_evaluate_relative (device_node, object_name, NULL, &obj_desc);
-	if (ACPI_FAILURE (status)) {
-
-		return (status);
-	}
-
-
-	/* Did we get a return object? */
-
-	if (!obj_desc) {
-		return (AE_TYPE);
-	}
-
-	/* Is the return object of the correct type? */
-
-	if (obj_desc->common.type != ACPI_TYPE_INTEGER) {
-		status = AE_TYPE;
-	}
-	else {
-		/*
-		 * Since the structure is a union, setting any field will set all
-		 * of the variables in the union
-		 */
-		*address = obj_desc->integer.value;
-	}
-
-	/* On exit, we must delete the return object */
-
-	acpi_cm_remove_reference (obj_desc);
-
-	return (status);
-}
-
-
-/****************************************************************************
- *
- * FUNCTION:    Acpi_cm_execute_HID
- *
- * PARAMETERS:  Device_node         - Node for the device
- *              *Hid                - Where the HID is returned
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Executes the _HID control method that returns the hardware
- *              ID of the device.
- *
- *              NOTE: Internal function, no parameter validation
- *
- ***************************************************************************/
-
-ACPI_STATUS
-acpi_cm_execute_HID (
-	ACPI_NAMESPACE_NODE     *device_node,
-	DEVICE_ID               *hid)
-{
-	ACPI_OPERAND_OBJECT     *obj_desc;
-	ACPI_STATUS             status;
-
-
-	/* Execute the method */
-
-	status = acpi_ns_evaluate_relative (device_node,
-			 METHOD_NAME__HID, NULL, &obj_desc);
-	if (ACPI_FAILURE (status)) {
-
-
-		return (status);
-	}
-
-	/* Did we get a return object? */
-
-	if (!obj_desc) {
-		return (AE_TYPE);
-	}
-
-	/*
-	 *  A _HID can return either a Number (32 bit compressed EISA ID) or
-	 *  a string
-	 */
-
-	if ((obj_desc->common.type != ACPI_TYPE_INTEGER) &&
-		(obj_desc->common.type != ACPI_TYPE_STRING))
-	{
-		status = AE_TYPE;
-	}
-
-	else {
-		if (obj_desc->common.type == ACPI_TYPE_INTEGER) {
-			/* Convert the Numeric HID to string */
-
-			acpi_aml_eisa_id_to_string ((u32) obj_desc->integer.value, hid->buffer);
-		}
-
-		else {
-			/* Copy the String HID from the returned object */
-
-			STRNCPY(hid->buffer, obj_desc->string.pointer, sizeof(hid->buffer));
-		}
-	}
-
-
-	/* On exit, we must delete the return object */
-
-	acpi_cm_remove_reference (obj_desc);
-
-	return (status);
-}
-
-
-/****************************************************************************
- *
- * FUNCTION:    Acpi_cm_execute_UID
- *
- * PARAMETERS:  Device_node         - Node for the device
- *              *Uid                - Where the UID is returned
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Executes the _UID control method that returns the hardware
- *              ID of the device.
- *
- *              NOTE: Internal function, no parameter validation
- *
- ***************************************************************************/
-
-ACPI_STATUS
-acpi_cm_execute_UID (
-	ACPI_NAMESPACE_NODE     *device_node,
-	DEVICE_ID               *uid)
-{
-	ACPI_OPERAND_OBJECT     *obj_desc;
-	ACPI_STATUS             status;
-
-
-	/* Execute the method */
-
-	status = acpi_ns_evaluate_relative (device_node,
-			 METHOD_NAME__UID, NULL, &obj_desc);
-	if (ACPI_FAILURE (status)) {
-
-
-		return (status);
-	}
-
-	/* Did we get a return object? */
-
-	if (!obj_desc) {
-		return (AE_TYPE);
-	}
-
-	/*
-	 *  A _UID can return either a Number (32 bit compressed EISA ID) or
-	 *  a string
-	 */
-
-	if ((obj_desc->common.type != ACPI_TYPE_INTEGER) &&
-		(obj_desc->common.type != ACPI_TYPE_STRING))
-	{
-		status = AE_TYPE;
-	}
-
-	else {
-		if (obj_desc->common.type == ACPI_TYPE_INTEGER) {
-			/* Convert the Numeric UID to string */
-
-			acpi_aml_unsigned_integer_to_string (obj_desc->integer.value, uid->buffer);
-		}
-
-		else {
-			/* Copy the String UID from the returned object */
-
-			STRNCPY(uid->buffer, obj_desc->string.pointer, sizeof(uid->buffer));
-		}
-	}
-
-
-	/* On exit, we must delete the return object */
-
-	acpi_cm_remove_reference (obj_desc);
-
-	return (status);
-}
-
-/****************************************************************************
- *
- * FUNCTION:    Acpi_cm_execute_STA
- *
- * PARAMETERS:  Device_node         - Node for the device
- *              *Flags              - Where the status flags are returned
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Executes _STA for selected device and stores results in
- *              *Flags.
- *
- *              NOTE: Internal function, no parameter validation
- *
- ***************************************************************************/
-
-ACPI_STATUS
-acpi_cm_execute_STA (
-	ACPI_NAMESPACE_NODE     *device_node,
-	u32                     *flags)
-{
-	ACPI_OPERAND_OBJECT     *obj_desc;
-	ACPI_STATUS             status;
-
-
-	/* Execute the method */
-
-	status = acpi_ns_evaluate_relative (device_node,
-			 METHOD_NAME__STA, NULL, &obj_desc);
-	if (AE_NOT_FOUND == status) {
-		*flags = 0x0F;
-		status = AE_OK;
-	}
-
-
-	else /* success */ {
-		/* Did we get a return object? */
-
-		if (!obj_desc) {
-			return (AE_TYPE);
-		}
-
-		/* Is the return object of the correct type? */
-
-		if (obj_desc->common.type != ACPI_TYPE_INTEGER) {
-			status = AE_TYPE;
-		}
-
-		else {
-			/* Extract the status flags */
-
-			*flags = (u32) obj_desc->integer.value;
-		}
-
-		/* On exit, we must delete the return object */
-
-		acpi_cm_remove_reference (obj_desc);
-	}
-
-	return (status);
-}
diff -urN linux-2.4.6-pre4/drivers/acpi/common/cmglobal.c linux/drivers/acpi/common/cmglobal.c
--- linux-2.4.6-pre4/drivers/acpi/common/cmglobal.c	Mon Jan 22 13:23:42 2001
+++ linux/drivers/acpi/common/cmglobal.c	Wed Dec 31 16:00:00 1969
@@ -1,472 +0,0 @@
-/******************************************************************************
- *
- * Module Name: cmglobal - Global variables for the ACPI subsystem
- *              $Revision: 116 $
- *
- *****************************************************************************/
-
-/*
- *  Copyright (C) 2000, 2001 R. Byron Moore
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-#define DEFINE_ACPI_GLOBALS
-
-#include "acpi.h"
-#include "acevents.h"
-#include "acnamesp.h"
-#include "acinterp.h"
-#include "amlcode.h"
-
-
-#define _COMPONENT          MISCELLANEOUS
-	 MODULE_NAME         ("cmglobal")
-
-
-/******************************************************************************
- *
- * Static global variable initialization.
- *
- ******************************************************************************/
-
-/*
- * We want the debug switches statically initialized so they
- * are already set when the debugger is entered.
- */
-
-/* Debug switch - level and trace mask */
-
-u32                         acpi_dbg_level = NORMAL_DEFAULT;
-
-/* Debug switch - layer (component) mask */
-
-u32                         acpi_dbg_layer = COMPONENT_DEFAULT;
-u32                         acpi_gbl_nesting_level = 0;
-
-
-/* Debugger globals */
-
-u8                          acpi_gbl_db_terminate_threads = FALSE;
-u8                          acpi_gbl_method_executing = FALSE;
-
-/* System flags */
-
-u32                         acpi_gbl_system_flags = 0;
-u32                         acpi_gbl_startup_flags = 0;
-
-/* System starts unitialized! */
-u8                          acpi_gbl_shutdown = TRUE;
-
-
-u8                          acpi_gbl_decode_to8bit [8] = {1,2,4,8,16,32,64,128};
-
-
-/******************************************************************************
- *
- * Namespace globals
- *
- ******************************************************************************/
-
-
-/*
- * Names built-in to the interpreter
- *
- * Initial values are currently supported only for types String and Number.
- * To avoid type punning, both are specified as strings in this table.
- */
-
-PREDEFINED_NAMES            acpi_gbl_pre_defined_names[] =
-{
-	{"_GPE",    INTERNAL_TYPE_DEF_ANY},
-	{"_PR_",    INTERNAL_TYPE_DEF_ANY},
-	{"_SB_",    INTERNAL_TYPE_DEF_ANY},
-	{"_SI_",    INTERNAL_TYPE_DEF_ANY},
-	{"_TZ_",    INTERNAL_TYPE_DEF_ANY},
-	{"_REV",    ACPI_TYPE_INTEGER, "2"},
-	{"_OS_",    ACPI_TYPE_STRING, ACPI_OS_NAME},
-	{"_GL_",    ACPI_TYPE_MUTEX, "0"},
-
-	/* Table terminator */
-
-	{NULL,      ACPI_TYPE_ANY}
-};
-
-
-/*
- * Properties of the ACPI Object Types, both internal and external.
- *
- * Elements of Acpi_ns_properties are bit significant
- * and the table is indexed by values of ACPI_OBJECT_TYPE
- */
-
-u8                          acpi_gbl_ns_properties[] =
-{
-	NSP_NORMAL,                 /* 00 Any              */
-	NSP_NORMAL,                 /* 01 Number           */
-	NSP_NORMAL,                 /* 02 String           */
-	NSP_NORMAL,                 /* 03 Buffer           */
-	NSP_LOCAL,                  /* 04 Package          */
-	NSP_NORMAL,                 /* 05 Field_unit       */
-	NSP_NEWSCOPE | NSP_LOCAL,   /* 06 Device           */
-	NSP_LOCAL,                  /* 07 Acpi_event       */
-	NSP_NEWSCOPE | NSP_LOCAL,   /* 08 Method           */
-	NSP_LOCAL,                  /* 09 Mutex            */
-	NSP_LOCAL,                  /* 10 Region           */
-	NSP_NEWSCOPE | NSP_LOCAL,   /* 11 Power            */
-	NSP_NEWSCOPE | NSP_LOCAL,   /* 12 Processor        */
-	NSP_NEWSCOPE | NSP_LOCAL,   /* 13 Thermal          */
-	NSP_NORMAL,                 /* 14 Buffer_field     */
-	NSP_NORMAL,                 /* 15 Ddb_handle       */
-	NSP_NORMAL,                 /* 16 Debug Object     */
-	NSP_NORMAL,                 /* 17 Def_field        */
-	NSP_NORMAL,                 /* 18 Bank_field       */
-	NSP_NORMAL,                 /* 19 Index_field      */
-	NSP_NORMAL,                 /* 20 Reference        */
-	NSP_NORMAL,                 /* 21 Alias            */
-	NSP_NORMAL,                 /* 22 Notify           */
-	NSP_NORMAL,                 /* 23 Address Handler  */
-	NSP_NEWSCOPE | NSP_LOCAL,   /* 24 Resource         */
-	NSP_NORMAL,                 /* 25 Def_field_defn   */
-	NSP_NORMAL,                 /* 26 Bank_field_defn  */
-	NSP_NORMAL,                 /* 27 Index_field_defn */
-	NSP_NORMAL,                 /* 28 If               */
-	NSP_NORMAL,                 /* 29 Else             */
-	NSP_NORMAL,                 /* 30 While            */
-	NSP_NEWSCOPE,               /* 31 Scope            */
-	NSP_LOCAL,                  /* 32 Def_any          */
-	NSP_NORMAL,                 /* 33 Extra            */
-	NSP_NORMAL                  /* 34 Invalid          */
-};
-
-
-/* Hex to ASCII conversion table */
-
-NATIVE_CHAR                 acpi_gbl_hex_to_ascii[] =
-			  {'0','1','2','3','4','5','6','7',
-			  '8','9','A','B','C','D','E','F'};
-
-
-/******************************************************************************
- *
- * Table globals
- *
- * NOTE: This table includes ONLY the ACPI tables that the subsystem consumes.
- * it is NOT an exhaustive list of all possible ACPI tables.  All ACPI tables
- * that are not used by the subsystem are simply ignored.
- *
- ******************************************************************************/
-
-
-ACPI_TABLE_DESC             acpi_gbl_acpi_tables[NUM_ACPI_TABLES];
-
-
-ACPI_TABLE_SUPPORT          acpi_gbl_acpi_table_data[NUM_ACPI_TABLES] =
-{
-	/***********    Name,    Signature,  Signature size,    How many allowed?,   Supported?  Global typed pointer */
-
-	/* RSDP 0 */ {RSDP_NAME, RSDP_SIG, sizeof (RSDP_SIG)-1, ACPI_TABLE_SINGLE,   AE_OK,      NULL},
-	/* DSDT 1 */ {DSDT_SIG,  DSDT_SIG, sizeof (DSDT_SIG)-1, ACPI_TABLE_SINGLE,   AE_OK,      (void **) &acpi_gbl_DSDT},
-	/* FADT 2 */ {FADT_SIG,  FADT_SIG, sizeof (FADT_SIG)-1, ACPI_TABLE_SINGLE,   AE_OK,      (void **) &acpi_gbl_FADT},
-	/* FACS 3 */ {FACS_SIG,  FACS_SIG, sizeof (FACS_SIG)-1, ACPI_TABLE_SINGLE,   AE_OK,      (void **) &acpi_gbl_FACS},
-	/* PSDT 4 */ {PSDT_SIG,  PSDT_SIG, sizeof (PSDT_SIG)-1, ACPI_TABLE_MULTIPLE, AE_OK,      NULL},
-	/* SSDT 5 */ {SSDT_SIG,  SSDT_SIG, sizeof (SSDT_SIG)-1, ACPI_TABLE_MULTIPLE, AE_OK,      NULL},
-	/* XSDT 6 */ {XSDT_SIG,  XSDT_SIG, sizeof (RSDT_SIG)-1, ACPI_TABLE_SINGLE,   AE_OK,      NULL},
-};
-
-
-/*****************************************************************************
- *
- * FUNCTION:    Acpi_cm_valid_object_type
- *
- * PARAMETERS:  None.
- *
- * RETURN:      TRUE if valid object type
- *
- * DESCRIPTION: Validate an object type
- *
- ****************************************************************************/
-
-u8
-acpi_cm_valid_object_type (
-	u32                     type)
-{
-
-	if (type > ACPI_TYPE_MAX) {
-		if ((type < INTERNAL_TYPE_BEGIN) ||
-			(type > INTERNAL_TYPE_MAX))
-		{
-			return (FALSE);
-		}
-	}
-
-	return (TRUE);
-}
-
-
-/*****************************************************************************
- *
- * FUNCTION:    Acpi_cm_format_exception
- *
- * PARAMETERS:  Status              - Acpi status to be formatted
- *
- * RETURN:      Formatted status string
- *
- * DESCRIPTION: Convert an ACPI exception to a string
- *
- ****************************************************************************/
-
-NATIVE_CHAR *
-acpi_cm_format_exception (
-	ACPI_STATUS             status)
-{
-	NATIVE_CHAR             *exception = "UNKNOWN_STATUS";
-	ACPI_STATUS             sub_status;
-
-
-	sub_status = (status & ~AE_CODE_MASK);
-
-
-	switch (status & AE_CODE_MASK)
-	{
-	case AE_CODE_ENVIRONMENTAL:
-
-		if (sub_status <= AE_CODE_ENV_MAX) {
-			exception = acpi_gbl_exception_names_env [sub_status];
-		}
-		break;
-
-	case AE_CODE_PROGRAMMER:
-
-		if (sub_status <= AE_CODE_PGM_MAX) {
-			exception = acpi_gbl_exception_names_pgm [sub_status -1];
-		}
-		break;
-
-	case AE_CODE_ACPI_TABLES:
-
-		if (sub_status <= AE_CODE_TBL_MAX) {
-			exception = acpi_gbl_exception_names_tbl [sub_status -1];
-		}
-		break;
-
-	case AE_CODE_AML:
-
-		if (sub_status <= AE_CODE_AML_MAX) {
-			exception = acpi_gbl_exception_names_aml [sub_status -1];
-		}
-		break;
-
-	case AE_CODE_CONTROL:
-
-		if (sub_status <= AE_CODE_CTRL_MAX) {
-			exception = acpi_gbl_exception_names_ctrl [sub_status -1];
-		}
-		break;
-
-	default:
-		break;
-	}
-
-
-	return (exception);
-}
-
-
-/****************************************************************************
- *
- * FUNCTION:    Acpi_cm_allocate_owner_id
- *
- * PARAMETERS:  Id_type         - Type of ID (method or table)
- *
- * DESCRIPTION: Allocate a table or method owner id
- *
- ***************************************************************************/
-
-ACPI_OWNER_ID
-acpi_cm_allocate_owner_id (
-	u32                     id_type)
-{
-	ACPI_OWNER_ID           owner_id = 0xFFFF;
-
-
-	acpi_cm_acquire_mutex (ACPI_MTX_CACHES);
-
-	switch (id_type)
-	{
-	case OWNER_TYPE_TABLE:
-
-		owner_id = acpi_gbl_next_table_owner_id;
-		acpi_gbl_next_table_owner_id++;
-
-		if (acpi_gbl_next_table_owner_id == FIRST_METHOD_ID) {
-			acpi_gbl_next_table_owner_id = FIRST_TABLE_ID;
-		}
-		break;
-
-
-	case OWNER_TYPE_METHOD:
-
-		owner_id = acpi_gbl_next_method_owner_id;
-		acpi_gbl_next_method_owner_id++;
-
-		if (acpi_gbl_next_method_owner_id == FIRST_TABLE_ID) {
-			acpi_gbl_next_method_owner_id = FIRST_METHOD_ID;
-		}
-		break;
-	}
-
-
-	acpi_cm_release_mutex (ACPI_MTX_CACHES);
-
-	return (owner_id);
-}
-
-
-/****************************************************************************
- *
- * FUNCTION:    Acpi_cm_init_globals
- *
- * PARAMETERS:  none
- *
- * DESCRIPTION: Init library globals.  All globals that require specific
- *              initialization should be initialized here!
- *
- ***************************************************************************/
-
-void
-acpi_cm_init_globals (
-	void)
-{
-	u32                     i;
-
-
-	/* ACPI table structure */
-
-	for (i = 0; i < NUM_ACPI_TABLES; i++) {
-		acpi_gbl_acpi_tables[i].prev        = &acpi_gbl_acpi_tables[i];
-		acpi_gbl_acpi_tables[i].next        = &acpi_gbl_acpi_tables[i];
-		acpi_gbl_acpi_tables[i].pointer     = NULL;
-		acpi_gbl_acpi_tables[i].length      = 0;
-		acpi_gbl_acpi_tables[i].allocation  = ACPI_MEM_NOT_ALLOCATED;
-		acpi_gbl_acpi_tables[i].count       = 0;
-	}
-
-
-	/* Address Space handler array */
-
-	for (i = 0; i < ACPI_NUM_ADDRESS_SPACES; i++) {
-		acpi_gbl_address_spaces[i].handler  = NULL;
-		acpi_gbl_address_spaces[i].context  = NULL;
-	}
-
-	/* Mutex locked flags */
-
-	for (i = 0; i < NUM_MTX; i++) {
-		acpi_gbl_acpi_mutex_info[i].mutex   = NULL;
-		acpi_gbl_acpi_mutex_info[i].locked  = FALSE;
-		acpi_gbl_acpi_mutex_info[i].use_count = 0;
-	}
-
-	/* Global notify handlers */
-
-	acpi_gbl_sys_notify.handler         = NULL;
-	acpi_gbl_drv_notify.handler         = NULL;
-
-	/* Global "typed" ACPI table pointers */
-
-	acpi_gbl_RSDP                       = NULL;
-	acpi_gbl_XSDT                       = NULL;
-	acpi_gbl_FACS                       = NULL;
-	acpi_gbl_FADT                       = NULL;
-	acpi_gbl_DSDT                       = NULL;
-
-
-	/* Global Lock support */
-
-	acpi_gbl_global_lock_acquired       = FALSE;
-	acpi_gbl_global_lock_thread_count   = 0;
-
-	/* Miscellaneous variables */
-
-	acpi_gbl_system_flags               = 0;
-	acpi_gbl_startup_flags              = 0;
-	acpi_gbl_global_lock_set            = FALSE;
-	acpi_gbl_rsdp_original_location     = 0;
-	acpi_gbl_cm_single_step             = FALSE;
-	acpi_gbl_db_terminate_threads       = FALSE;
-	acpi_gbl_shutdown                   = FALSE;
-	acpi_gbl_ns_lookup_count            = 0;
-	acpi_gbl_ps_find_count              = 0;
-	acpi_gbl_acpi_hardware_present      = TRUE;
-	acpi_gbl_next_table_owner_id        = FIRST_TABLE_ID;
-	acpi_gbl_next_method_owner_id       = FIRST_METHOD_ID;
-	acpi_gbl_debugger_configuration     = DEBUGGER_THREADING;
-
-	/* Cache of small "state" objects */
-
-	acpi_gbl_generic_state_cache        = NULL;
-	acpi_gbl_generic_state_cache_depth  = 0;
-	acpi_gbl_state_cache_requests       = 0;
-	acpi_gbl_state_cache_hits           = 0;
-
-	acpi_gbl_parse_cache                = NULL;
-	acpi_gbl_parse_cache_depth          = 0;
-	acpi_gbl_parse_cache_requests       = 0;
-	acpi_gbl_parse_cache_hits           = 0;
-
-	acpi_gbl_ext_parse_cache            = NULL;
-	acpi_gbl_ext_parse_cache_depth      = 0;
-	acpi_gbl_ext_parse_cache_requests   = 0;
-	acpi_gbl_ext_parse_cache_hits       = 0;
-
-	acpi_gbl_object_cache               = NULL;
-	acpi_gbl_object_cache_depth         = 0;
-	acpi_gbl_object_cache_requests      = 0;
-	acpi_gbl_object_cache_hits          = 0;
-
-	acpi_gbl_walk_state_cache           = NULL;
-	acpi_gbl_walk_state_cache_depth     = 0;
-	acpi_gbl_walk_state_cache_requests  = 0;
-	acpi_gbl_walk_state_cache_hits      = 0;
-
-	/* Hardware oriented */
-
-	acpi_gbl_gpe0enable_register_save   = NULL;
-	acpi_gbl_gpe1_enable_register_save  = NULL;
-	acpi_gbl_original_mode              = SYS_MODE_UNKNOWN;   /*  original ACPI/legacy mode   */
-	acpi_gbl_gpe_registers              = NULL;
-	acpi_gbl_gpe_info                   = NULL;
-
-	/* Namespace */
-
-	acpi_gbl_root_node                  = NULL;
-
-	acpi_gbl_root_node_struct.name      = ACPI_ROOT_NAME;
-	acpi_gbl_root_node_struct.data_type = ACPI_DESC_TYPE_NAMED;
-	acpi_gbl_root_node_struct.type      = ACPI_TYPE_ANY;
-	acpi_gbl_root_node_struct.child     = NULL;
-	acpi_gbl_root_node_struct.peer      = NULL;
-	acpi_gbl_root_node_struct.object    = NULL;
-	acpi_gbl_root_node_struct.flags     = ANOBJ_END_OF_PEER_LIST;
-
-	/* Memory allocation metrics - compiled out in non-debug mode. */
-
-	INITIALIZE_ALLOCATION_METRICS();
-
-	return;
-}
-
-
diff -urN linux-2.4.6-pre4/drivers/acpi/common/cminit.c linux/drivers/acpi/common/cminit.c
--- linux-2.4.6-pre4/drivers/acpi/common/cminit.c	Mon Jan 22 13:23:42 2001
+++ linux/drivers/acpi/common/cminit.c	Wed Dec 31 16:00:00 1969
@@ -1,250 +0,0 @@
-/******************************************************************************
- *
- * Module Name: cminit - Common ACPI subsystem initialization
- *              $Revision: 93 $
- *
- *****************************************************************************/
-
-/*
- *  Copyright (C) 2000, 2001 R. Byron Moore
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-
-#include "acpi.h"
-#include "achware.h"
-#include "acnamesp.h"
-#include "acevents.h"
-#include "acparser.h"
-#include "acdispat.h"
-
-#define _COMPONENT          MISCELLANEOUS
-	 MODULE_NAME         ("cminit")
-
-
-#define ACPI_OFFSET(d,o)    ((u32) &(((d *)0)->o))
-#define ACPI_FADT_OFFSET(o) ACPI_OFFSET (FADT_DESCRIPTOR, o)
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_cm_fadt_register_error
- *
- * PARAMETERS:  *Register_name          - Pointer to string identifying register
- *              Value                   - Actual register contents value
- *              Acpi_test_spec_section  - TDS section containing assertion
- *              Acpi_assertion          - Assertion number being tested
- *
- * RETURN:      AE_BAD_VALUE
- *
- * DESCRIPTION: Display failure message and link failure to TDS assertion
- *
- ******************************************************************************/
-
-static ACPI_STATUS
-acpi_cm_fadt_register_error (
-	NATIVE_CHAR             *register_name,
-	u32                     value,
-	u32                     offset)
-{
-
-	REPORT_ERROR (
-		("Invalid FADT value %s=%lX at offset %lX FADT=%p\n",
-		register_name, value, offset, acpi_gbl_FADT));
-
-
-	return (AE_BAD_VALUE);
-}
-
-
-/******************************************************************************
- *
- * FUNCTION:    Acpi_cm_validate_fadt
- *
- * PARAMETERS:  None
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Validate various ACPI registers in the FADT
- *
- ******************************************************************************/
-
-ACPI_STATUS
-acpi_cm_validate_fadt (
-	void)
-{
-	ACPI_STATUS                 status = AE_OK;
-
-
-	/*
-	 * Verify Fixed ACPI Description Table fields,
-	 * but don't abort on any problems, just display error
-	 */
-
-	if (acpi_gbl_FADT->pm1_evt_len < 4) {
-		status = acpi_cm_fadt_register_error ("PM1_EVT_LEN",
-				  (u32) acpi_gbl_FADT->pm1_evt_len,
-				  ACPI_FADT_OFFSET (pm1_evt_len));
-	}
-
-	if (!acpi_gbl_FADT->pm1_cnt_len) {
-		status = acpi_cm_fadt_register_error ("PM1_CNT_LEN", 0,
-				  ACPI_FADT_OFFSET (pm1_cnt_len));
-	}
-
-	if (!ACPI_VALID_ADDRESS (acpi_gbl_FADT->Xpm1a_evt_blk.address)) {
-		status = acpi_cm_fadt_register_error ("X_PM1a_EVT_BLK", 0,
-				  ACPI_FADT_OFFSET (Xpm1a_evt_blk.address));
-	}
-
-	if (!ACPI_VALID_ADDRESS (acpi_gbl_FADT->Xpm1a_cnt_blk.address)) {
-		status = acpi_cm_fadt_register_error ("X_PM1a_CNT_BLK", 0,
-				  ACPI_FADT_OFFSET (Xpm1a_cnt_blk.address));
-	}
-
-	if (!ACPI_VALID_ADDRESS (acpi_gbl_FADT->Xpm_tmr_blk.address)) {
-		status = acpi_cm_fadt_register_error ("X_PM_TMR_BLK", 0,
-				  ACPI_FADT_OFFSET (Xpm_tmr_blk.address));
-	}
-
-	if ((ACPI_VALID_ADDRESS (acpi_gbl_FADT->Xpm2_cnt_blk.address) &&
-		!acpi_gbl_FADT->pm2_cnt_len))
-	{
-		status = acpi_cm_fadt_register_error ("PM2_CNT_LEN",
-				  (u32) acpi_gbl_FADT->pm2_cnt_len,
-				  ACPI_FADT_OFFSET (pm2_cnt_len));
-	}
-
-	if (acpi_gbl_FADT->pm_tm_len < 4) {
-		status = acpi_cm_fadt_register_error ("PM_TM_LEN",
-				  (u32) acpi_gbl_FADT->pm_tm_len,
-				  ACPI_FADT_OFFSET (pm_tm_len));
-	}
-
-	/* length of GPE blocks must be a multiple of 2 */
-
-
-	if (ACPI_VALID_ADDRESS (acpi_gbl_FADT->Xgpe0blk.address) &&
-		(acpi_gbl_FADT->gpe0blk_len & 1))
-	{
-		status = acpi_cm_fadt_register_error ("(x)GPE0_BLK_LEN",
-				  (u32) acpi_gbl_FADT->gpe0blk_len,
-				  ACPI_FADT_OFFSET (gpe0blk_len));
-	}
-
-	if (ACPI_VALID_ADDRESS (acpi_gbl_FADT->Xgpe1_blk.address) &&
-		(acpi_gbl_FADT->gpe1_blk_len & 1))
-	{
-		status = acpi_cm_fadt_register_error ("(x)GPE1_BLK_LEN",
-				  (u32) acpi_gbl_FADT->gpe1_blk_len,
-				  ACPI_FADT_OFFSET (gpe1_blk_len));
-	}
-
-	return (status);
-}
-
-
-/******************************************************************************
- *
- * FUNCTION:    Acpi_cm_terminate
- *
- * PARAMETERS:  none
- *
- * RETURN:      none
- *
- * DESCRIPTION: free memory allocated for table storage.
- *
- ******************************************************************************/
-
-void
-acpi_cm_terminate (void)
-{
-
-
-	/* Free global tables, etc. */
-
-	if (acpi_gbl_gpe0enable_register_save) {
-		acpi_cm_free (acpi_gbl_gpe0enable_register_save);
-	}
-
-	if (acpi_gbl_gpe1_enable_register_save) {
-		acpi_cm_free (acpi_gbl_gpe1_enable_register_save);
-	}
-
-
-	return;
-}
-
-
-/******************************************************************************
- *
- * FUNCTION:    Acpi_cm_subsystem_shutdown
- *
- * PARAMETERS:  none
- *
- * RETURN:      none
- *
- * DESCRIPTION: Shutdown the various subsystems.  Don't delete the mutex
- *              objects here -- because the AML debugger may be still running.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-acpi_cm_subsystem_shutdown (void)
-{
-
-	/* Just exit if subsystem is already shutdown */
-
-	if (acpi_gbl_shutdown) {
-		return (AE_OK);
-	}
-
-	/* Subsystem appears active, go ahead and shut it down */
-
-	acpi_gbl_shutdown = TRUE;
-
-	/* Close the Namespace */
-
-	acpi_ns_terminate ();
-
-	/* Close the Acpi_event Handling */
-
-	acpi_ev_terminate ();
-
-	/* Close the globals */
-
-	acpi_cm_terminate ();
-
-	/* Flush the local cache(s) */
-
-	acpi_cm_delete_generic_state_cache ();
-	acpi_cm_delete_object_cache ();
-	acpi_ds_delete_walk_state_cache ();
-
-	/* Close the Parser */
-
-	/* TBD: [Restructure] Acpi_ps_terminate () */
-
-	acpi_ps_delete_parse_cache ();
-
-	/* Debug only - display leftover memory allocation, if any */
-#ifdef ENABLE_DEBUGGER
-	acpi_cm_dump_current_allocations (ACPI_UINT32_MAX, NULL);
-#endif
-
-	return (AE_OK);
-}
-
-
diff -urN linux-2.4.6-pre4/drivers/acpi/common/cmobject.c linux/drivers/acpi/common/cmobject.c
--- linux-2.4.6-pre4/drivers/acpi/common/cmobject.c	Fri Feb  9 11:45:58 2001
+++ linux/drivers/acpi/common/cmobject.c	Wed Dec 31 16:00:00 1969
@@ -1,618 +0,0 @@
-/******************************************************************************
- *
- * Module Name: cmobject - ACPI object create/delete/size/cache routines
- *              $Revision: 36 $
- *
- *****************************************************************************/
-
-/*
- *  Copyright (C) 2000, 2001 R. Byron Moore
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-
-#include "acpi.h"
-#include "acinterp.h"
-#include "acnamesp.h"
-#include "actables.h"
-#include "amlcode.h"
-
-
-#define _COMPONENT          MISCELLANEOUS
-	 MODULE_NAME         ("cmobject")
-
-
-/*******************************************************************************
- *
- * FUNCTION:    _Cm_create_internal_object
- *
- * PARAMETERS:  Address             - Address of the memory to deallocate
- *              Component           - Component type of caller
- *              Module              - Source file name of caller
- *              Line                - Line number of caller
- *              Type                - ACPI Type of the new object
- *
- * RETURN:      Object              - The new object.  Null on failure
- *
- * DESCRIPTION: Create and initialize a new internal object.
- *
- * NOTE:        We always allocate the worst-case object descriptor because
- *              these objects are cached, and we want them to be
- *              one-size-satisifies-any-request.  This in itself may not be
- *              the most memory efficient, but the efficiency of the object
- *              cache should more than make up for this!
- *
- ******************************************************************************/
-
-ACPI_OPERAND_OBJECT  *
-_cm_create_internal_object (
-	NATIVE_CHAR             *module_name,
-	u32                     line_number,
-	u32                     component_id,
-	OBJECT_TYPE_INTERNAL    type)
-{
-	ACPI_OPERAND_OBJECT     *object;
-
-
-	/* Allocate the raw object descriptor */
-
-	object = _cm_allocate_object_desc (module_name, line_number, component_id);
-	if (!object) {
-		/* Allocation failure */
-
-		return (NULL);
-	}
-
-	/* Save the object type in the object descriptor */
-
-	object->common.type = type;
-
-	/* Init the reference count */
-
-	object->common.reference_count = 1;
-
-	/* Any per-type initialization should go here */
-
-
-	return (object);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_cm_valid_internal_object
- *
- * PARAMETERS:  Operand             - Object to be validated
- *
- * RETURN:      Validate a pointer to be an ACPI_OPERAND_OBJECT
- *
- ******************************************************************************/
-
-u8
-acpi_cm_valid_internal_object (
-	void                    *object)
-{
-
-	/* Check for a null pointer */
-
-	if (!object) {
-		return (FALSE);
-	}
-
-	/* Check for a pointer within one of the ACPI tables */
-
-	if (acpi_tb_system_table_pointer (object)) {
-		return (FALSE);
-	}
-
-	/* Check the descriptor type field */
-
-	if (!VALID_DESCRIPTOR_TYPE (object, ACPI_DESC_TYPE_INTERNAL)) {
-		/* Not an ACPI internal object, do some further checking */
-
-
-
-
-		return (FALSE);
-	}
-
-
-	/* The object appears to be a valid ACPI_OPERAND_OBJECT  */
-
-	return (TRUE);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    _Cm_allocate_object_desc
- *
- * PARAMETERS:  Module_name         - Caller's module name (for error output)
- *              Line_number         - Caller's line number (for error output)
- *              Component_id        - Caller's component ID (for error output)
- *              Message             - Error message to use on failure
- *
- * RETURN:      Pointer to newly allocated object descriptor.  Null on error
- *
- * DESCRIPTION: Allocate a new object descriptor.  Gracefully handle
- *              error conditions.
- *
- ******************************************************************************/
-
-void *
-_cm_allocate_object_desc (
-	NATIVE_CHAR             *module_name,
-	u32                     line_number,
-	u32                     component_id)
-{
-	ACPI_OPERAND_OBJECT     *object;
-
-
-	acpi_cm_acquire_mutex (ACPI_MTX_CACHES);
-
-	acpi_gbl_object_cache_requests++;
-
-	/* Check the cache first */
-
-	if (acpi_gbl_object_cache) {
-		/* There is an object available, use it */
-
-		object = acpi_gbl_object_cache;
-		acpi_gbl_object_cache = object->cache.next;
-		object->cache.next = NULL;
-
-		acpi_gbl_object_cache_hits++;
-		acpi_gbl_object_cache_depth--;
-
-		acpi_cm_release_mutex (ACPI_MTX_CACHES);
-	}
-
-	else {
-		/* The cache is empty, create a new object */
-
-		acpi_cm_release_mutex (ACPI_MTX_CACHES);
-
-		/* Attempt to allocate new descriptor */
-
-		object = _cm_callocate (sizeof (ACPI_OPERAND_OBJECT), component_id,
-				  module_name, line_number);
-		if (!object) {
-			/* Allocation failed */
-
-			_REPORT_ERROR (module_name, line_number, component_id,
-					  ("Could not allocate an object descriptor\n"));
-
-			return (NULL);
-		}
-
-		/* Memory allocation metrics - compiled out in non debug mode. */
-
-		INCREMENT_OBJECT_METRICS (sizeof (ACPI_OPERAND_OBJECT));
-	}
-
-	/* Mark the descriptor type */
-
-	object->common.data_type = ACPI_DESC_TYPE_INTERNAL;
-
-	return (object);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_cm_delete_object_desc
- *
- * PARAMETERS:  Object          - Acpi internal object to be deleted
- *
- * RETURN:      None.
- *
- * DESCRIPTION: Free an ACPI object descriptor or add it to the object cache
- *
- ******************************************************************************/
-
-void
-acpi_cm_delete_object_desc (
-	ACPI_OPERAND_OBJECT     *object)
-{
-
-
-	/* Make sure that the object isn't already in the cache */
-
-	if (object->common.data_type == (ACPI_DESC_TYPE_INTERNAL | ACPI_CACHED_OBJECT)) {
-		return;
-	}
-
-	/* Object must be an ACPI_OPERAND_OBJECT  */
-
-	if (object->common.data_type != ACPI_DESC_TYPE_INTERNAL) {
-		return;
-	}
-
-
-	/* If cache is full, just free this object */
-
-	if (acpi_gbl_object_cache_depth >= MAX_OBJECT_CACHE_DEPTH) {
-		/*
-		 * Memory allocation metrics.  Call the macro here since we only
-		 * care about dynamically allocated objects.
-		 */
-		DECREMENT_OBJECT_METRICS (sizeof (ACPI_OPERAND_OBJECT));
-
-		acpi_cm_free (object);
-		return;
-	}
-
-	acpi_cm_acquire_mutex (ACPI_MTX_CACHES);
-
-	/* Clear the entire object.  This is important! */
-
-	MEMSET (object, 0, sizeof (ACPI_OPERAND_OBJECT));
-	object->common.data_type = ACPI_DESC_TYPE_INTERNAL | ACPI_CACHED_OBJECT;
-
-	/* Put the object at the head of the global cache list */
-
-	object->cache.next = acpi_gbl_object_cache;
-	acpi_gbl_object_cache = object;
-	acpi_gbl_object_cache_depth++;
-
-
-	acpi_cm_release_mutex (ACPI_MTX_CACHES);
-	return;
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_cm_delete_object_cache
- *
- * PARAMETERS:  None
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Purge the global state object cache.  Used during subsystem
- *              termination.
- *
- ******************************************************************************/
-
-void
-acpi_cm_delete_object_cache (
-	void)
-{
-	ACPI_OPERAND_OBJECT     *next;
-
-
-	/* Traverse the global cache list */
-
-	while (acpi_gbl_object_cache) {
-		/* Delete one cached state object */
-
-		next = acpi_gbl_object_cache->cache.next;
-		acpi_gbl_object_cache->cache.next = NULL;
-
-		/*
-		 * Memory allocation metrics.  Call the macro here since we only
-		 * care about dynamically allocated objects.
-		 */
-		DECREMENT_OBJECT_METRICS (sizeof (ACPI_OPERAND_OBJECT));
-
-		acpi_cm_free (acpi_gbl_object_cache);
-		acpi_gbl_object_cache = next;
-		acpi_gbl_object_cache_depth--;
-	}
-
-	return;
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_cm_init_static_object
- *
- * PARAMETERS:  Obj_desc            - Pointer to a "static" object - on stack
- *                                    or in the data segment.
- *
- * RETURN:      None.
- *
- * DESCRIPTION: Initialize a static object.  Sets flags to disallow dynamic
- *              deletion of the object.
- *
- ******************************************************************************/
-
-void
-acpi_cm_init_static_object (
-	ACPI_OPERAND_OBJECT     *obj_desc)
-{
-
-
-	if (!obj_desc) {
-		return;
-	}
-
-
-	/*
-	 * Clear the entire descriptor
-	 */
-	MEMSET ((void *) obj_desc, 0, sizeof (ACPI_OPERAND_OBJECT));
-
-
-	/*
-	 * Initialize the header fields
-	 * 1) This is an ACPI_OPERAND_OBJECT  descriptor
-	 * 2) The size is the full object (worst case)
-	 * 3) The flags field indicates static allocation
-	 * 4) Reference count starts at one (not really necessary since the
-	 *    object can't be deleted, but keeps everything sane)
-	 */
-
-	obj_desc->common.data_type      = ACPI_DESC_TYPE_INTERNAL;
-	obj_desc->common.flags          = AOPOBJ_STATIC_ALLOCATION;
-	obj_desc->common.reference_count = 1;
-
-	return;
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_cm_get_simple_object_size
- *
- * PARAMETERS:  *Internal_object    - Pointer to the object we are examining
- *              *Ret_length         - Where the length is returned
- *
- * RETURN:      Status
- *
- * DESCRIPTION: This function is called to determine the space required to
- *              contain a simple object for return to an API user.
- *
- *              The length includes the object structure plus any additional
- *              needed space.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-acpi_cm_get_simple_object_size (
-	ACPI_OPERAND_OBJECT     *internal_object,
-	u32                     *obj_length)
-{
-	u32                     length;
-	ACPI_STATUS             status = AE_OK;
-
-
-	/* Handle a null object (Could be a uninitialized package element -- which is legal) */
-
-	if (!internal_object) {
-		*obj_length = 0;
-		return (AE_OK);
-	}
-
-
-	/* Start with the length of the Acpi object */
-
-	length = sizeof (ACPI_OBJECT);
-
-	if (VALID_DESCRIPTOR_TYPE (internal_object, ACPI_DESC_TYPE_NAMED)) {
-		/* Object is a named object (reference), just return the length */
-
-		*obj_length = (u32) ROUND_UP_TO_NATIVE_WORD (length);
-		return (status);
-	}
-
-
-	/*
-	 * The final length depends on the object type
-	 * Strings and Buffers are packed right up against the parent object and
-	 * must be accessed bytewise or there may be alignment problems.
-	 *
-	 * TBD:[Investigate] do strings and buffers require alignment also?
-	 */
-
-	switch (internal_object->common.type)
-	{
-
-	case ACPI_TYPE_STRING:
-
-		length += internal_object->string.length + 1;
-		break;
-
-
-	case ACPI_TYPE_BUFFER:
-
-		length += internal_object->buffer.length;
-		break;
-
-
-	case ACPI_TYPE_INTEGER:
-	case ACPI_TYPE_PROCESSOR:
-	case ACPI_TYPE_POWER:
-
-		/*
-		 * No extra data for these types
-		 */
-		break;
-
-
-	case INTERNAL_TYPE_REFERENCE:
-
-		/*
-		 * The only type that should be here is opcode AML_NAMEPATH_OP -- since
-		 * this means an object reference
-		 */
-		if (internal_object->reference.op_code != AML_NAMEPATH_OP) {
-			status = AE_TYPE;
-		}
-		break;
-
-
-	default:
-
-		status = AE_TYPE;
-		break;
-	}
-
-
-	/*
-	 * Account for the space required by the object rounded up to the next
-	 * multiple of the machine word size.  This keeps each object aligned
-	 * on a machine word boundary. (preventing alignment faults on some
-	 * machines.)
-	 */
-	*obj_length = (u32) ROUND_UP_TO_NATIVE_WORD (length);
-
-	return (status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_cm_copy_package_to_internal
- *
- * PARAMETERS:  ACPI_PKG_CALLBACK
- *
- * RETURN:      Status          - the status of the call
- *
- * DESCRIPTION:
- *
- ******************************************************************************/
-
-ACPI_STATUS
-acpi_cm_get_element_length (
-	u8                      object_type,
-	ACPI_OPERAND_OBJECT     *source_object,
-	ACPI_GENERIC_STATE      *state,
-	void                    *context)
-{
-	ACPI_STATUS             status = AE_OK;
-	ACPI_PKG_INFO           *info = (ACPI_PKG_INFO *) context;
-	u32                     object_space;
-
-
-	switch (object_type)
-	{
-	case 0:
-
-		/*
-		 * Simple object - just get the size (Null object/entry is handled
-		 * here also) and sum it into the running package length
-		 */
-		status = acpi_cm_get_simple_object_size (source_object, &object_space);
-		if (ACPI_FAILURE (status)) {
-			return (status);
-		}
-
-		info->length += object_space;
-		break;
-
-
-	case 1:
-		/* Package - nothing much to do here, let the walk handle it */
-
-		info->num_packages++;
-		state->pkg.this_target_obj = NULL;
-		break;
-
-	default:
-		return (AE_BAD_PARAMETER);
-	}
-
-
-	return (status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_cm_get_package_object_size
- *
- * PARAMETERS:  *Internal_object    - Pointer to the object we are examining
- *              *Ret_length         - Where the length is returned
- *
- * RETURN:      Status
- *
- * DESCRIPTION: This function is called to determine the space required to
- *              contain a package object for return to an API user.
- *
- *              This is moderately complex since a package contains other
- *              objects including packages.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-acpi_cm_get_package_object_size (
-	ACPI_OPERAND_OBJECT     *internal_object,
-	u32                     *obj_length)
-{
-	ACPI_STATUS             status;
-	ACPI_PKG_INFO           info;
-
-
-	info.length      = 0;
-	info.object_space = 0;
-	info.num_packages = 1;
-
-	status = acpi_cm_walk_package_tree (internal_object, NULL,
-			 acpi_cm_get_element_length, &info);
-
-	/*
-	 * We have handled all of the objects in all levels of the package.
-	 * just add the length of the package objects themselves.
-	 * Round up to the next machine word.
-	 */
-	info.length += ROUND_UP_TO_NATIVE_WORD (sizeof (ACPI_OBJECT)) *
-			  info.num_packages;
-
-	/* Return the total package length */
-
-	*obj_length = info.length;
-	return (status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_cm_get_object_size
- *
- * PARAMETERS:  *Internal_object    - Pointer to the object we are examining
- *              *Ret_length         - Where the length will be returned
- *
- * RETURN:      Status
- *
- * DESCRIPTION: This function is called to determine the space required to
- *              contain an object for return to an API user.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-acpi_cm_get_object_size(
-	ACPI_OPERAND_OBJECT     *internal_object,
-	u32                     *obj_length)
-{
-	ACPI_STATUS             status;
-
-
-	if ((VALID_DESCRIPTOR_TYPE (internal_object, ACPI_DESC_TYPE_INTERNAL)) &&
-		(IS_THIS_OBJECT_TYPE (internal_object, ACPI_TYPE_PACKAGE)))
-	{
-		status = acpi_cm_get_package_object_size (internal_object, obj_length);
-	}
-
-	else {
-		status = acpi_cm_get_simple_object_size (internal_object, obj_length);
-	}
-
-	return (status);
-}
-
-
diff -urN linux-2.4.6-pre4/drivers/acpi/common/cmutils.c linux/drivers/acpi/common/cmutils.c
--- linux-2.4.6-pre4/drivers/acpi/common/cmutils.c	Fri Feb  9 11:45:58 2001
+++ linux/drivers/acpi/common/cmutils.c	Wed Dec 31 16:00:00 1969
@@ -1,952 +0,0 @@
-/*******************************************************************************
- *
- * Module Name: cmutils - common utility procedures
- *              $Revision: 27 $
- *
- ******************************************************************************/
-
-/*
- *  Copyright (C) 2000, 2001 R. Byron Moore
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-
-#include "acpi.h"
-#include "acevents.h"
-#include "achware.h"
-#include "acnamesp.h"
-#include "acinterp.h"
-#include "amlcode.h"
-#include "acdebug.h"
-
-
-#define _COMPONENT          MISCELLANEOUS
-	 MODULE_NAME         ("cmutils")
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_cm_valid_acpi_name
- *
- * PARAMETERS:  Character           - The character to be examined
- *
- * RETURN:      1 if Character may appear in a name, else 0
- *
- * DESCRIPTION: Check for a valid ACPI name.  Each character must be one of:
- *              1) Upper case alpha
- *              2) numeric
- *              3) underscore
- *
- ******************************************************************************/
-
-u8
-acpi_cm_valid_acpi_name (
-	u32                     name)
-{
-	NATIVE_CHAR             *name_ptr = (NATIVE_CHAR *) &name;
-	u32                     i;
-
-
-	for (i = 0; i < ACPI_NAME_SIZE; i++) {
-		if (!((name_ptr[i] == '_') ||
-			  (name_ptr[i] >= 'A' && name_ptr[i] <= 'Z') ||
-			  (name_ptr[i] >= '0' && name_ptr[i] <= '9')))
-		{
-			return (FALSE);
-		}
-	}
-
-
-	return (TRUE);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_cm_valid_acpi_character
- *
- * PARAMETERS:  Character           - The character to be examined
- *
- * RETURN:      1 if Character may appear in a name, else 0
- *
- * DESCRIPTION: Check for a printable character
- *
- ******************************************************************************/
-
-u8
-acpi_cm_valid_acpi_character (
-	NATIVE_CHAR             character)
-{
-
-	return ((u8)   ((character == '_') ||
-			   (character >= 'A' && character <= 'Z') ||
-			   (character >= '0' && character <= '9')));
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_cm_mutex_initialize
- *
- * PARAMETERS:  None.
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Create the system mutex objects.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-acpi_cm_mutex_initialize (
-	void)
-{
-	u32                     i;
-	ACPI_STATUS             status;
-
-
-	/*
-	 * Create each of the predefined mutex objects
-	 */
-	for (i = 0; i < NUM_MTX; i++) {
-		status = acpi_cm_create_mutex (i);
-		if (ACPI_FAILURE (status)) {
-			return (status);
-		}
-	}
-
-	return (AE_OK);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_cm_mutex_terminate
- *
- * PARAMETERS:  None.
- *
- * RETURN:      None.
- *
- * DESCRIPTION: Delete all of the system mutex objects.
- *
- ******************************************************************************/
-
-void
-acpi_cm_mutex_terminate (
-	void)
-{
-	u32                     i;
-
-
-	/*
-	 * Delete each predefined mutex object
-	 */
-	for (i = 0; i < NUM_MTX; i++) {
-		acpi_cm_delete_mutex (i);
-	}
-
-	return;
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_cm_create_mutex
- *
- * PARAMETERS:  Mutex_iD        - ID of the mutex to be created
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Create a mutex object.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-acpi_cm_create_mutex (
-	ACPI_MUTEX_HANDLE       mutex_id)
-{
-	ACPI_STATUS             status = AE_OK;
-
-
-	if (mutex_id > MAX_MTX) {
-		return (AE_BAD_PARAMETER);
-	}
-
-
-	if (!acpi_gbl_acpi_mutex_info[mutex_id].mutex) {
-		status = acpi_os_create_semaphore (1, 1,
-				   &acpi_gbl_acpi_mutex_info[mutex_id].mutex);
-		acpi_gbl_acpi_mutex_info[mutex_id].locked = FALSE;
-		acpi_gbl_acpi_mutex_info[mutex_id].use_count = 0;
-	}
-
-	return (status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_cm_delete_mutex
- *
- * PARAMETERS:  Mutex_iD        - ID of the mutex to be deleted
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Delete a mutex object.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-acpi_cm_delete_mutex (
-	ACPI_MUTEX_HANDLE       mutex_id)
-{
-	ACPI_STATUS             status;
-
-
-	if (mutex_id > MAX_MTX) {
-		return (AE_BAD_PARAMETER);
-	}
-
-
-	status = acpi_os_delete_semaphore (acpi_gbl_acpi_mutex_info[mutex_id].mutex);
-
-	acpi_gbl_acpi_mutex_info[mutex_id].mutex = NULL;
-	acpi_gbl_acpi_mutex_info[mutex_id].locked = FALSE;
-
-	return (status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_cm_acquire_mutex
- *
- * PARAMETERS:  Mutex_iD        - ID of the mutex to be acquired
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Acquire a mutex object.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-acpi_cm_acquire_mutex (
-	ACPI_MUTEX_HANDLE       mutex_id)
-{
-	ACPI_STATUS             status;
-
-
-	if (mutex_id > MAX_MTX) {
-		return (AE_BAD_PARAMETER);
-	}
-
-
-	status = acpi_os_wait_semaphore (acpi_gbl_acpi_mutex_info[mutex_id].mutex,
-			   1, WAIT_FOREVER);
-
-	if (ACPI_SUCCESS (status)) {
-		acpi_gbl_acpi_mutex_info[mutex_id].locked = TRUE;
-		acpi_gbl_acpi_mutex_info[mutex_id].use_count++;
-	}
-
-	return (status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_cm_release_mutex
- *
- * PARAMETERS:  Mutex_iD        - ID of the mutex to be released
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Release a mutex object.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-acpi_cm_release_mutex (
-	ACPI_MUTEX_HANDLE       mutex_id)
-{
-	ACPI_STATUS             status;
-
-
-	if (mutex_id > MAX_MTX) {
-		return (AE_BAD_PARAMETER);
-	}
-
-
-	acpi_gbl_acpi_mutex_info[mutex_id].locked = FALSE; /* Mark before unlocking */
-
-	status = acpi_os_signal_semaphore (acpi_gbl_acpi_mutex_info[mutex_id].mutex, 1);
-
-
-	return (status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_cm_create_update_state_and_push
- *
- * PARAMETERS:  *Object         - Object to be added to the new state
- *              Action          - Increment/Decrement
- *              State_list      - List the state will be added to
- *
- * RETURN:      None
- *
- * DESCRIPTION: Create a new state and push it
- *
- ******************************************************************************/
-
-ACPI_STATUS
-acpi_cm_create_update_state_and_push (
-	ACPI_OPERAND_OBJECT     *object,
-	u16                     action,
-	ACPI_GENERIC_STATE      **state_list)
-{
-	ACPI_GENERIC_STATE       *state;
-
-
-	/* Ignore null objects; these are expected */
-
-	if (!object) {
-		return (AE_OK);
-	}
-
-	state = acpi_cm_create_update_state (object, action);
-	if (!state) {
-		return (AE_NO_MEMORY);
-	}
-
-
-	acpi_cm_push_generic_state (state_list, state);
-	return (AE_OK);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_cm_create_pkg_state_and_push
- *
- * PARAMETERS:  *Object         - Object to be added to the new state
- *              Action          - Increment/Decrement
- *              State_list      - List the state will be added to
- *
- * RETURN:      None
- *
- * DESCRIPTION: Create a new state and push it
- *
- ******************************************************************************/
-
-ACPI_STATUS
-acpi_cm_create_pkg_state_and_push (
-	void                    *internal_object,
-	void                    *external_object,
-	u16                     index,
-	ACPI_GENERIC_STATE      **state_list)
-{
-	ACPI_GENERIC_STATE       *state;
-
-
-	state = acpi_cm_create_pkg_state (internal_object, external_object, index);
-	if (!state) {
-		return (AE_NO_MEMORY);
-	}
-
-
-	acpi_cm_push_generic_state (state_list, state);
-	return (AE_OK);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_cm_push_generic_state
- *
- * PARAMETERS:  List_head           - Head of the state stack
- *              State               - State object to push
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Push a state object onto a state stack
- *
- ******************************************************************************/
-
-void
-acpi_cm_push_generic_state (
-	ACPI_GENERIC_STATE      **list_head,
-	ACPI_GENERIC_STATE      *state)
-{
-	/* Push the state object onto the front of the list (stack) */
-
-	state->common.next = *list_head;
-	*list_head = state;
-
-	return;
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_cm_pop_generic_state
- *
- * PARAMETERS:  List_head           - Head of the state stack
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Pop a state object from a state stack
- *
- ******************************************************************************/
-
-ACPI_GENERIC_STATE *
-acpi_cm_pop_generic_state (
-	ACPI_GENERIC_STATE      **list_head)
-{
-	ACPI_GENERIC_STATE      *state;
-
-
-	/* Remove the state object at the head of the list (stack) */
-
-	state = *list_head;
-	if (state) {
-		/* Update the list head */
-
-		*list_head = state->common.next;
-	}
-
-	return (state);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_cm_create_generic_state
- *
- * PARAMETERS:  None
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Create a generic state object.  Attempt to obtain one from
- *              the global state cache;  If none available, create a new one.
- *
- ******************************************************************************/
-
-ACPI_GENERIC_STATE *
-acpi_cm_create_generic_state (void)
-{
-	ACPI_GENERIC_STATE      *state;
-
-
-	acpi_cm_acquire_mutex (ACPI_MTX_CACHES);
-
-	acpi_gbl_state_cache_requests++;
-
-	/* Check the cache first */
-
-	if (acpi_gbl_generic_state_cache) {
-		/* There is an object available, use it */
-
-		state = acpi_gbl_generic_state_cache;
-		acpi_gbl_generic_state_cache = state->common.next;
-		state->common.next = NULL;
-
-		acpi_gbl_state_cache_hits++;
-		acpi_gbl_generic_state_cache_depth--;
-
-		acpi_cm_release_mutex (ACPI_MTX_CACHES);
-
-	}
-
-	else {
-		/* The cache is empty, create a new object */
-
-		acpi_cm_release_mutex (ACPI_MTX_CACHES);
-
-		state = acpi_cm_callocate (sizeof (ACPI_GENERIC_STATE));
-	}
-
-	/* Initialize */
-
-	if (state) {
-		/* Always zero out the object before init */
-
-		MEMSET (state, 0, sizeof (ACPI_GENERIC_STATE));
-
-		state->common.data_type = ACPI_DESC_TYPE_STATE;
-	}
-
-	return (state);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_cm_create_update_state
- *
- * PARAMETERS:  Object              - Initial Object to be installed in the
- *                                    state
- *              Action              - Update action to be performed
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Create an "Update State" - a flavor of the generic state used
- *              to update reference counts and delete complex objects such
- *              as packages.
- *
- ******************************************************************************/
-
-ACPI_GENERIC_STATE *
-acpi_cm_create_update_state (
-	ACPI_OPERAND_OBJECT     *object,
-	u16                     action)
-{
-	ACPI_GENERIC_STATE      *state;
-
-
-	/* Create the generic state object */
-
-	state = acpi_cm_create_generic_state ();
-	if (!state) {
-		return (NULL);
-	}
-
-	/* Init fields specific to the update struct */
-
-	state->update.object = object;
-	state->update.value  = action;
-
-	return (state);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_cm_create_pkg_state
- *
- * PARAMETERS:  Object              - Initial Object to be installed in the
- *                                    state
- *              Action              - Update action to be performed
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Create an "Update State" - a flavor of the generic state used
- *              to update reference counts and delete complex objects such
- *              as packages.
- *
- ******************************************************************************/
-
-ACPI_GENERIC_STATE *
-acpi_cm_create_pkg_state (
-	void                    *internal_object,
-	void                    *external_object,
-	u16                     index)
-{
-	ACPI_GENERIC_STATE      *state;
-
-
-	/* Create the generic state object */
-
-	state = acpi_cm_create_generic_state ();
-	if (!state) {
-		return (NULL);
-	}
-
-	/* Init fields specific to the update struct */
-
-	state->pkg.source_object = (ACPI_OPERAND_OBJECT *) internal_object;
-	state->pkg.dest_object  = external_object;
-	state->pkg.index        = index;
-	state->pkg.num_packages = 1;
-
-	return (state);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_cm_create_control_state
- *
- * PARAMETERS:  None
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Create a "Control State" - a flavor of the generic state used
- *              to support nested IF/WHILE constructs in the AML.
- *
- ******************************************************************************/
-
-ACPI_GENERIC_STATE *
-acpi_cm_create_control_state (
-	void)
-{
-	ACPI_GENERIC_STATE      *state;
-
-
-	/* Create the generic state object */
-
-	state = acpi_cm_create_generic_state ();
-	if (!state) {
-		return (NULL);
-	}
-
-
-	/* Init fields specific to the control struct */
-
-	state->common.state = CONTROL_CONDITIONAL_EXECUTING;
-
-	return (state);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_cm_delete_generic_state
- *
- * PARAMETERS:  State               - The state object to be deleted
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Put a state object back into the global state cache.  The object
- *              is not actually freed at this time.
- *
- ******************************************************************************/
-
-void
-acpi_cm_delete_generic_state (
-	ACPI_GENERIC_STATE      *state)
-{
-
-	/* If cache is full, just free this state object */
-
-	if (acpi_gbl_generic_state_cache_depth >= MAX_STATE_CACHE_DEPTH) {
-		acpi_cm_free (state);
-	}
-
-	/* Otherwise put this object back into the cache */
-
-	else {
-		acpi_cm_acquire_mutex (ACPI_MTX_CACHES);
-
-		/* Clear the state */
-
-		MEMSET (state, 0, sizeof (ACPI_GENERIC_STATE));
-		state->common.data_type = ACPI_DESC_TYPE_STATE;
-
-		/* Put the object at the head of the global cache list */
-
-		state->common.next = acpi_gbl_generic_state_cache;
-		acpi_gbl_generic_state_cache = state;
-		acpi_gbl_generic_state_cache_depth++;
-
-
-		acpi_cm_release_mutex (ACPI_MTX_CACHES);
-	}
-	return;
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_cm_delete_generic_state_cache
- *
- * PARAMETERS:  None
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Purge the global state object cache.  Used during subsystem
- *              termination.
- *
- ******************************************************************************/
-
-void
-acpi_cm_delete_generic_state_cache (
-	void)
-{
-	ACPI_GENERIC_STATE      *next;
-
-
-	/* Traverse the global cache list */
-
-	while (acpi_gbl_generic_state_cache) {
-		/* Delete one cached state object */
-
-		next = acpi_gbl_generic_state_cache->common.next;
-		acpi_cm_free (acpi_gbl_generic_state_cache);
-		acpi_gbl_generic_state_cache = next;
-		acpi_gbl_generic_state_cache_depth--;
-	}
-
-	return;
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_cm_resolve_package_references
- *
- * PARAMETERS:  Obj_desc        - The Package object on which to resolve refs
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Walk through a package and turn internal references into values
- *
- ******************************************************************************/
-
-ACPI_STATUS
-acpi_cm_resolve_package_references (
-	ACPI_OPERAND_OBJECT     *obj_desc)
-{
-	u32                     count;
-	ACPI_OPERAND_OBJECT     *sub_object;
-
-
-	if (obj_desc->common.type != ACPI_TYPE_PACKAGE) {
-		/* The object must be a package */
-
-		REPORT_ERROR (("Must resolve Package Refs on a Package\n"));
-		return(AE_ERROR);
-	}
-
-	/*
-	 * TBD: what about nested packages? */
-
-	for (count = 0; count < obj_desc->package.count; count++) {
-		sub_object = obj_desc->package.elements[count];
-
-		if (sub_object->common.type == INTERNAL_TYPE_REFERENCE) {
-			if (sub_object->reference.op_code == AML_ZERO_OP) {
-				sub_object->common.type = ACPI_TYPE_INTEGER;
-				sub_object->integer.value = 0;
-			}
-			else if (sub_object->reference.op_code == AML_ONE_OP) {
-				sub_object->common.type = ACPI_TYPE_INTEGER;
-				sub_object->integer.value = 1;
-			}
-			else if (sub_object->reference.op_code == AML_ONES_OP) {
-				sub_object->common.type = ACPI_TYPE_INTEGER;
-				sub_object->integer.value = ACPI_INTEGER_MAX;
-			}
-		}
-	}
-
-	return(AE_OK);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_cm_walk_package_tree
- *
- * PARAMETERS:  Obj_desc        - The Package object on which to resolve refs
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Walk through a package
- *
- ******************************************************************************/
-
-ACPI_STATUS
-acpi_cm_walk_package_tree (
-	ACPI_OPERAND_OBJECT     *source_object,
-	void                    *target_object,
-	ACPI_PKG_CALLBACK       walk_callback,
-	void                    *context)
-{
-	ACPI_STATUS             status = AE_OK;
-	ACPI_GENERIC_STATE      *state_list = NULL;
-	ACPI_GENERIC_STATE      *state;
-	u32                     this_index;
-	ACPI_OPERAND_OBJECT     *this_source_obj;
-
-
-	state = acpi_cm_create_pkg_state (source_object, target_object, 0);
-	if (!state) {
-		return (AE_NO_MEMORY);
-	}
-
-	while (state) {
-		this_index       = state->pkg.index;
-		this_source_obj  = (ACPI_OPERAND_OBJECT *)
-				   state->pkg.source_object->package.elements[this_index];
-
-		/*
-		 * Check for
-		 * 1) An uninitialized package element.  It is completely
-		 *      legal to declare a package and leave it uninitialized
-		 * 2) Not an internal object - can be a namespace node instead
-		 * 3) Any type other than a package.  Packages are handled in else case below.
-		 */
-		if ((!this_source_obj) ||
-			(!VALID_DESCRIPTOR_TYPE (
-					this_source_obj, ACPI_DESC_TYPE_INTERNAL)) ||
-			(!IS_THIS_OBJECT_TYPE (
-					this_source_obj, ACPI_TYPE_PACKAGE)))
-		{
-
-			status = walk_callback (0, this_source_obj, state, context);
-			if (ACPI_FAILURE (status)) {
-				/* TBD: must delete package created up to this point */
-
-				return (status);
-			}
-
-			state->pkg.index++;
-			while (state->pkg.index >= state->pkg.source_object->package.count) {
-				/*
-				 * We've handled all of the objects at this level,  This means
-				 * that we have just completed a package.  That package may
-				 * have contained one or more packages itself.
-				 *
-				 * Delete this state and pop the previous state (package).
-				 */
-				acpi_cm_delete_generic_state (state);
-				state = acpi_cm_pop_generic_state (&state_list);
-
-
-				/* Finished when there are no more states */
-
-				if (!state) {
-					/*
-					 * We have handled all of the objects in the top level
-					 * package just add the length of the package objects
-					 * and exit
-					 */
-					return (AE_OK);
-				}
-
-				/*
-				 * Go back up a level and move the index past the just
-				 * completed package object.
-				 */
-				state->pkg.index++;
-			}
-		}
-
-		else {
-			/* This is a sub-object of type package */
-
-			status = walk_callback (1, this_source_obj, state, context);
-			if (ACPI_FAILURE (status)) {
-				/* TBD: must delete package created up to this point */
-
-				return (status);
-			}
-
-
-			/*
-			 * The callback above returned a new target package object.
-			 */
-
-			/*
-			 * Push the current state and create a new one
-			 */
-			acpi_cm_push_generic_state (&state_list, state);
-			state = acpi_cm_create_pkg_state (this_source_obj, state->pkg.this_target_obj, 0);
-			if (!state) {
-				/* TBD: must delete package created up to this point */
-
-				return (AE_NO_MEMORY);
-			}
-		}
-	}
-
-	/* We should never get here */
-
-	return (AE_AML_INTERNAL);
-
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    _Report_error
- *
- * PARAMETERS:  Module_name         - Caller's module name (for error output)
- *              Line_number         - Caller's line number (for error output)
- *              Component_id        - Caller's component ID (for error output)
- *              Message             - Error message to use on failure
- *
- * RETURN:      None
- *
- * DESCRIPTION: Print error message
- *
- ******************************************************************************/
-
-void
-_report_error (
-	NATIVE_CHAR             *module_name,
-	u32                     line_number,
-	u32                     component_id)
-{
-
-
-	acpi_os_printf ("%8s-%04d: *** Error: ", module_name, line_number);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    _Report_warning
- *
- * PARAMETERS:  Module_name         - Caller's module name (for error output)
- *              Line_number         - Caller's line number (for error output)
- *              Component_id        - Caller's component ID (for error output)
- *              Message             - Error message to use on failure
- *
- * RETURN:      None
- *
- * DESCRIPTION: Print warning message
- *
- ******************************************************************************/
-
-void
-_report_warning (
-	NATIVE_CHAR             *module_name,
-	u32                     line_number,
-	u32                     component_id)
-{
-
-	acpi_os_printf ("%8s-%04d: *** Warning: ", module_name, line_number);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    _Report_info
- *
- * PARAMETERS:  Module_name         - Caller's module name (for error output)
- *              Line_number         - Caller's line number (for error output)
- *              Component_id        - Caller's component ID (for error output)
- *              Message             - Error message to use on failure
- *
- * RETURN:      None
- *
- * DESCRIPTION: Print information message
- *
- ******************************************************************************/
-
-void
-_report_info (
-	NATIVE_CHAR             *module_name,
-	u32                     line_number,
-	u32                     component_id)
-{
-
-	acpi_os_printf ("%8s-%04d: *** Info: ", module_name, line_number);
-}
-
-
diff -urN linux-2.4.6-pre4/drivers/acpi/common/cmxface.c linux/drivers/acpi/common/cmxface.c
--- linux-2.4.6-pre4/drivers/acpi/common/cmxface.c	Fri Feb  9 11:45:58 2001
+++ linux/drivers/acpi/common/cmxface.c	Wed Dec 31 16:00:00 1969
@@ -1,396 +0,0 @@
-/******************************************************************************
- *
- * Module Name: cmxface - External interfaces for "global" ACPI functions
- *              $Revision: 64 $
- *
- *****************************************************************************/
-
-/*
- *  Copyright (C) 2000, 2001 R. Byron Moore
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-
-#include "acpi.h"
-#include "acevents.h"
-#include "achware.h"
-#include "acnamesp.h"
-#include "acinterp.h"
-#include "amlcode.h"
-#include "acdebug.h"
-
-
-#define _COMPONENT          MISCELLANEOUS
-	 MODULE_NAME         ("cmxface")
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_initialize_subsystem
- *
- * PARAMETERS:  None
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Initializes all global variables.  This is the first function
- *              called, so any early initialization belongs here.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-acpi_initialize_subsystem (
-	void)
-{
-	ACPI_STATUS             status;
-
-
-	/* Initialize all globals used by the subsystem */
-
-	acpi_cm_init_globals ();
-
-	/* Initialize the OS-Dependent layer */
-
-	status = acpi_os_initialize ();
-	if (ACPI_FAILURE (status)) {
-		REPORT_ERROR (("OSD failed to initialize, %s\n",
-			acpi_cm_format_exception (status)));
-		return (status);
-	}
-
-	/* Create the default mutex objects */
-
-	status = acpi_cm_mutex_initialize ();
-	if (ACPI_FAILURE (status)) {
-		REPORT_ERROR (("Global mutex creation failure, %s\n",
-			acpi_cm_format_exception (status)));
-		return (status);
-	}
-
-	/*
-	 * Initialize the namespace manager and
-	 * the root of the namespace tree
-	 */
-
-	status = acpi_ns_root_initialize ();
-	if (ACPI_FAILURE (status)) {
-		REPORT_ERROR (("Namespace initialization failure, %s\n",
-			acpi_cm_format_exception (status)));
-		return (status);
-	}
-
-
-	/* If configured, initialize the AML debugger */
-
-	DEBUGGER_EXEC (acpi_db_initialize ());
-
-	return (status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_enable_subsystem
- *
- * PARAMETERS:  Flags           - Init/enable Options
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Completes the subsystem initialization including hardware.
- *              Puts system into ACPI mode if it isn't already.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-acpi_enable_subsystem (
-	u32                     flags)
-{
-	ACPI_STATUS             status = AE_OK;
-
-
-	/* Sanity check the FADT for valid values */
-
-	status = acpi_cm_validate_fadt ();
-	if (ACPI_FAILURE (status)) {
-		return (status);
-	}
-
-	/*
-	 * Install the default Op_region handlers. These are
-	 * installed unless other handlers have already been
-	 * installed via the Install_address_space_handler interface
-	 */
-
-	if (!(flags & ACPI_NO_ADDRESS_SPACE_INIT)) {
-		status = acpi_ev_install_default_address_space_handlers ();
-		if (ACPI_FAILURE (status)) {
-			return (status);
-		}
-	}
-
-	/*
-	 * We must initialize the hardware before we can enable ACPI.
-	 */
-
-	if (!(flags & ACPI_NO_HARDWARE_INIT)) {
-		status = acpi_hw_initialize ();
-		if (ACPI_FAILURE (status)) {
-			return (status);
-		}
-	}
-
-	/*
-	 * Enable ACPI on this platform
-	 */
-
-	if (!(flags & ACPI_NO_ACPI_ENABLE)) {
-		status = acpi_enable ();
-		if (ACPI_FAILURE (status)) {
-			return (status);
-		}
-	}
-
-	/*
-	 * Note:
-	 * We must have the hardware AND events initialized before we can execute
-	 * ANY control methods SAFELY.  Any control method can require ACPI hardware
-	 * support, so the hardware MUST be initialized before execution!
-	 */
-
-	if (!(flags & ACPI_NO_EVENT_INIT)) {
-		status = acpi_ev_initialize ();
-		if (ACPI_FAILURE (status)) {
-			return (status);
-		}
-	}
-
-
-	/*
-	 * Initialize all device objects in the namespace
-	 * This runs the _STA and _INI methods.
-	 */
-
-	if (!(flags & ACPI_NO_DEVICE_INIT)) {
-		status = acpi_ns_initialize_devices ();
-		if (ACPI_FAILURE (status)) {
-			return (status);
-		}
-	}
-
-
-	/*
-	 * Initialize the objects that remain uninitialized.  This
-	 * runs the executable AML that is part of the declaration of Op_regions
-	 * and Fields.
-	 */
-
-	if (!(flags & ACPI_NO_OBJECT_INIT)) {
-		status = acpi_ns_initialize_objects ();
-		if (ACPI_FAILURE (status)) {
-			return (status);
-		}
-	}
-
-
-	return (status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_terminate
- *
- * PARAMETERS:  None
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Shutdown the ACPI subsystem.  Release all resources.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-acpi_terminate (void)
-{
-
-	/* Terminate the AML Debuger if present */
-
-	DEBUGGER_EXEC(acpi_gbl_db_terminate_threads = TRUE);
-
-	/* TBD: [Investigate] This is no longer needed?*/
-/*    Acpi_cm_release_mutex (ACPI_MTX_DEBUG_CMD_READY); */
-
-
-	/* Shutdown and free all resources */
-
-	acpi_cm_subsystem_shutdown ();
-
-
-	/* Free the mutex objects */
-
-	acpi_cm_mutex_terminate ();
-
-
-	/* Now we can shutdown the OS-dependent layer */
-
-	acpi_os_terminate ();
-
-	return (AE_OK);
-}
-
-
-/******************************************************************************
- *
- * FUNCTION:    Acpi_get_system_info
- *
- * PARAMETERS:  Out_buffer      - a pointer to a buffer to receive the
- *                                resources for the device
- *              Buffer_length   - the number of bytes available in the buffer
- *
- * RETURN:      Status          - the status of the call
- *
- * DESCRIPTION: This function is called to get information about the current
- *              state of the ACPI subsystem.  It will return system information
- *              in the Out_buffer.
- *
- *              If the function fails an appropriate status will be returned
- *              and the value of Out_buffer is undefined.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-acpi_get_system_info (
-	ACPI_BUFFER             *out_buffer)
-{
-	ACPI_SYSTEM_INFO        *info_ptr;
-	u32                     i;
-
-
-	/*
-	 *  Must have a valid buffer
-	 */
-	if ((!out_buffer)         ||
-		(!out_buffer->pointer))
-	{
-		return (AE_BAD_PARAMETER);
-	}
-
-	if (out_buffer->length < sizeof (ACPI_SYSTEM_INFO)) {
-		/*
-		 *  Caller's buffer is too small
-		 */
-		out_buffer->length = sizeof (ACPI_SYSTEM_INFO);
-
-		return (AE_BUFFER_OVERFLOW);
-	}
-
-
-	/*
-	 *  Set return length and get data
-	 */
-	out_buffer->length = sizeof (ACPI_SYSTEM_INFO);
-	info_ptr = (ACPI_SYSTEM_INFO *) out_buffer->pointer;
-
-	info_ptr->acpi_ca_version   = ACPI_CA_VERSION;
-
-	/* System flags (ACPI capabilities) */
-
-	info_ptr->flags             = acpi_gbl_system_flags;
-
-	/* Timer resolution - 24 or 32 bits  */
-	if (!acpi_gbl_FADT) {
-		info_ptr->timer_resolution = 0;
-	}
-	else if (acpi_gbl_FADT->tmr_val_ext == 0) {
-		info_ptr->timer_resolution = 24;
-	}
-	else {
-		info_ptr->timer_resolution = 32;
-	}
-
-	/* Clear the reserved fields */
-
-	info_ptr->reserved1         = 0;
-	info_ptr->reserved2         = 0;
-
-	/* Current debug levels */
-
-	info_ptr->debug_layer       = acpi_dbg_layer;
-	info_ptr->debug_level       = acpi_dbg_level;
-
-	/* Current status of the ACPI tables, per table type */
-
-	info_ptr->num_table_types = NUM_ACPI_TABLES;
-	for (i = 0; i < NUM_ACPI_TABLES; i++) {
-		info_ptr->table_info[i].count = acpi_gbl_acpi_tables[i].count;
-	}
-
-	return (AE_OK);
-}
-
-
-/******************************************************************************
- *
- * FUNCTION:    Acpi_format_exception
- *
- * PARAMETERS:  Out_buffer      - a pointer to a buffer to receive the
- *                                exception name
- *
- * RETURN:      Status          - the status of the call
- *
- * DESCRIPTION: This function translates an ACPI exception into an ASCII string.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-acpi_format_exception (
-	ACPI_STATUS             exception,
-	ACPI_BUFFER             *out_buffer)
-{
-	u32                     length;
-	NATIVE_CHAR             *formatted_exception;
-
-
-	/*
-	 *  Must have a valid buffer
-	 */
-	if ((!out_buffer)         ||
-		(!out_buffer->pointer))
-	{
-		return (AE_BAD_PARAMETER);
-	}
-
-
-	/* Convert the exception code (Handles bad exception codes) */
-
-	formatted_exception = acpi_cm_format_exception (exception);
-
-	/*
-	 * Get length of string and check if it will fit in caller's buffer
-	 */
-
-	length = STRLEN (formatted_exception);
-	if (out_buffer->length < length) {
-		out_buffer->length = length;
-		return (AE_BUFFER_OVERFLOW);
-	}
-
-
-	/* Copy the string, all done */
-
-	STRCPY (out_buffer->pointer, formatted_exception);
-
-	return (AE_OK);
-}
-
diff -urN linux-2.4.6-pre4/drivers/acpi/cpu.c linux/drivers/acpi/cpu.c
--- linux-2.4.6-pre4/drivers/acpi/cpu.c	Fri Feb  9 11:45:58 2001
+++ linux/drivers/acpi/cpu.c	Wed Dec 31 16:00:00 1969
@@ -1,353 +0,0 @@
-/*
- *  cpu.c - Processor handling
- *
- *  Copyright (C) 2000 Andrew Henroid
- *  Copyright (C) 2001 Andrew Grover
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-#include <linux/config.h>
-#include <linux/kernel.h>
-#include <linux/pm.h>
-#include <linux/acpi.h>
-#include "acpi.h"
-#include "driver.h"
-
-#define _COMPONENT	OS_DEPENDENT
-	MODULE_NAME	("cpu")
-
-u32 acpi_c2_exit_latency = ACPI_INFINITE;
-u32 acpi_c3_exit_latency = ACPI_INFINITE;
-u32 acpi_c2_enter_latency = ACPI_INFINITE;
-u32 acpi_c3_enter_latency = ACPI_INFINITE;
-u32 acpi_use_idle = TRUE;
-
-u32 acpi_c1_count = 0;
-u32 acpi_c2_count = 0;
-u32 acpi_c3_count = 0;
-
-static u32 acpi_pblk = ACPI_INVALID;
-static int acpi_c2_tested = 0;
-static int acpi_c3_tested = 0;
-static int acpi_max_c_state = 1;
-static int acpi_pm_tmr_len = 24;
-
-#define CPU_POWER_STATES	3
-#define MAX_C2_LATENCY		100
-#define MAX_C3_LATENCY		1000
-
-#define ACPI_STATE_C1		0
-#define ACPI_STATE_C2		1
-#define ACPI_STATE_C3		2
-
-/*
- * Clear busmaster activity flag
- */
-static inline void
-acpi_clear_bm_activity(void)
-{
-	acpi_hw_register_bit_access(ACPI_WRITE, ACPI_MTX_LOCK, BM_STS, 1);
-}
-
-/*
- * Returns 1 if there has been busmaster activity
- */
-static inline int
-acpi_bm_activity(void)
-{
-	return acpi_hw_register_bit_access(ACPI_READ, ACPI_MTX_LOCK, BM_STS);
-}
-
-/*
- * Set system to sleep through busmaster requests
- */
-static void
-acpi_sleep_on_busmaster(void)
-{
-	acpi_hw_register_bit_access (ACPI_WRITE, ACPI_MTX_LOCK, BM_RLD, 1);
-}
-
-/*
- * Set system to wake on busmaster requests
- */
-static void
-acpi_wake_on_busmaster(void)
-{
-	acpi_hw_register_bit_access (ACPI_WRITE, ACPI_MTX_LOCK, BM_RLD, 0);
-}
-
-u32
-acpi_read_pm_timer(void)
-{
-	return acpi_hw_register_read(ACPI_MTX_LOCK, PM_TIMER);
-}
-
-/*
- * Do a compare, accounting for 24/32bit rollover
- */
-static u32
-acpi_compare_pm_timers(u32 first, u32 second)
-{
-	if (first < second) {
-		return (second - first);
-	} else {
-		if (acpi_pm_tmr_len == 24)
-			return (second + (0xFFFFFF - first));
-		else
-			return (second + (0xFFFFFFFF - first));
-	}
-}
-
-
-/*
- * Idle loop (uniprocessor only)
- */
-static void
-acpi_idle(void)
-{
-	static int sleep_level = 1;
-	FADT_DESCRIPTOR *fadt = &acpi_fadt;
-
-	/*
-	 * start from the previous sleep level.
-	 * if not initialized, we goto sleep1
-	 */
-	if (sleep_level == 1
-	    || acpi_max_c_state < 2)
-		goto sleep1;
-
-	if (sleep_level == 2
-	    || acpi_max_c_state < 3)
-		goto sleep2;
-
-sleep3:
-	sleep_level = 3;
-	if (!acpi_c3_tested) {
-		DEBUG_PRINT(ACPI_INFO, ("C3 works\n"));
-		acpi_c3_tested = 1;
-	}
-	acpi_wake_on_busmaster();
-	if (fadt->Xpm2_cnt_blk.address)
-		goto sleep3_with_arbiter;
-
-	for (;;) {
-		unsigned long time;
-		unsigned long diff;
-		
-		__cli();
-		if (current->need_resched)
-			goto out;
-		if (acpi_bm_activity())
-			goto sleep2;
-
-		time = acpi_read_pm_timer();
-		acpi_c3_count++;
-		inb(acpi_pblk + ACPI_P_LVL3);
-		/* Dummy read, force synchronization with the PMU */
-		acpi_read_pm_timer();
-		diff = acpi_compare_pm_timers(time, acpi_read_pm_timer());
-
-		__sti();
-		if (diff < acpi_c3_exit_latency)
-			goto sleep1;
-	}
-
-sleep3_with_arbiter:
-	for (;;) {
-		unsigned long time;
-		unsigned long diff;
-
-		__cli();
-		if (current->need_resched)
-			goto out;
-		if (acpi_bm_activity())
-			goto sleep2;
-
-		time = acpi_read_pm_timer();
-		
-		/* Disable arbiter, park on CPU */
-		acpi_hw_register_bit_access(ACPI_WRITE, ACPI_MTX_LOCK, ARB_DIS, 1);
-		acpi_c3_count++;
-		inb(acpi_pblk + ACPI_P_LVL3);
-		/* Dummy read, force synchronization with the PMU */
-		acpi_read_pm_timer();
-		diff = acpi_compare_pm_timers(time, acpi_read_pm_timer());
-		/* Enable arbiter again.. */
-		acpi_hw_register_bit_access(ACPI_WRITE, ACPI_MTX_LOCK, ARB_DIS, 0);
-
-		__sti();
-		if (diff < acpi_c3_exit_latency)
-			goto sleep1;
-	}
-
-sleep2:
-	sleep_level = 2;
-	if (!acpi_c2_tested) {
-		DEBUG_PRINT(ACPI_INFO, ("C2 works\n"));
-		acpi_c2_tested = 1;
-	}
-	acpi_wake_on_busmaster();	/* Required to track BM activity.. */
-	for (;;) {
-		unsigned long time;
-		unsigned long diff;
-
-		__cli();
-		if (current->need_resched)
-			goto out;
-
-		time = acpi_read_pm_timer();
-		acpi_c2_count++;
-		inb(acpi_pblk + ACPI_P_LVL2);
-		/* Dummy read, force synchronization with the PMU */
-		acpi_read_pm_timer();
-		diff = acpi_compare_pm_timers(time, acpi_read_pm_timer());
-
-		__sti();
-		if (diff < acpi_c2_exit_latency)
-			goto sleep1;
-		if (acpi_bm_activity()) {
-			acpi_clear_bm_activity();
-			continue;
-		}
-		if (diff > acpi_c3_enter_latency
-		    && acpi_max_c_state >= 3)
-			goto sleep3;
-	}
-
-sleep1:
-	sleep_level = 1;
-	acpi_sleep_on_busmaster();
-	for (;;) {
-		unsigned long time;
-		unsigned long diff;
-
-		__cli();
-		if (current->need_resched)
-			goto out;
-		time = acpi_read_pm_timer();
-		acpi_c1_count++;
-		safe_halt();
-		diff = acpi_compare_pm_timers(time, acpi_read_pm_timer());
-		if (diff > acpi_c2_enter_latency
-		    && acpi_max_c_state >= 2)
-			goto sleep2;
-	}
-
-out:
-	__sti();
-}
-
-/*
- * Get processor information
- */
-static ACPI_STATUS
-acpi_found_cpu(ACPI_HANDLE handle, u32 level, void *ctx, void **value)
-{
-	ACPI_OBJECT obj;
-	ACPI_BUFFER buf;
-
-	buf.length = sizeof(obj);
-	buf.pointer = &obj;
-	if (!ACPI_SUCCESS(acpi_evaluate_object(handle, NULL, NULL, &buf)))
-		return AE_OK;
-
-	DEBUG_PRINT(ACPI_INFO, ("PBLK %d @ 0x%04x:%d\n",
-			obj.processor.proc_id,
-			obj.processor.pblk_address,
-			obj.processor.pblk_length));
-
-	if (acpi_pblk != ACPI_INVALID
-	    || !obj.processor.pblk_address
-	    || obj.processor.pblk_length != 6)
-		return AE_OK;
-
-	acpi_pblk = obj.processor.pblk_address;
-
-	if (acpi_fadt.plvl2_lat
-	    && acpi_fadt.plvl2_lat <= MAX_C2_LATENCY) {
-		acpi_c2_exit_latency
-			= ACPI_MICROSEC_TO_TMR_TICKS(acpi_fadt.plvl2_lat);
-		acpi_c2_enter_latency
-			= ACPI_MICROSEC_TO_TMR_TICKS(acpi_fadt.plvl2_lat * 4);
-		acpi_max_c_state = 2;
-
-		printk(KERN_INFO "ACPI: System firmware supports: C2");
-			
-		if (acpi_fadt.plvl3_lat
-		    && acpi_fadt.plvl3_lat <= MAX_C3_LATENCY) {
-			acpi_c3_exit_latency
-				= ACPI_MICROSEC_TO_TMR_TICKS(acpi_fadt.plvl3_lat);
-			acpi_c3_enter_latency
-				= ACPI_MICROSEC_TO_TMR_TICKS(acpi_fadt.plvl3_lat * 12);
-			acpi_max_c_state = 3;
-
-			printk(" C3");
-		}
-
-		printk("\n");
-	}
-
-	printk(KERN_INFO "ACPI: plvl2lat=%d plvl3lat=%d\n", acpi_fadt.plvl2_lat, acpi_fadt.plvl3_lat);
-	printk(KERN_INFO "ACPI: C2 enter=%d C2 exit=%d\n", acpi_c2_enter_latency, acpi_c2_exit_latency);
-	printk(KERN_INFO "ACPI: C3 enter=%d C3 exit=%d\n", acpi_c3_enter_latency, acpi_c3_exit_latency);
-
-	return AE_OK;
-}
-
-static int
-acpi_pm_timer_init(void)
-{
-	FADT_DESCRIPTOR *fadt = &acpi_fadt;
-
-	if (fadt->tmr_val_ext) {
-		acpi_pm_tmr_len = 32;
-	} else {
-		acpi_pm_tmr_len = 24;
-	}
-
-	DEBUG_PRINT(ACPI_INFO, ("PM Timer width: %d bits\n", acpi_pm_tmr_len));
-
-	return AE_OK;
-}
-
-int
-acpi_cpu_init(void)
-{
-	acpi_walk_namespace(ACPI_TYPE_PROCESSOR,
-			    ACPI_ROOT_OBJECT,
-			    ACPI_UINT32_MAX,
-			    acpi_found_cpu,
-			    NULL,
-			    NULL);
-
-	acpi_pm_timer_init();
-
-	if (acpi_use_idle) {
-#ifdef CONFIG_SMP
-		if (smp_num_cpus == 1)
-			pm_idle = acpi_idle;
-#else
-		pm_idle = acpi_idle;
-#endif
-		printk(KERN_INFO "ACPI: Using ACPI idle\n");
-		printk(KERN_INFO "ACPI: If experiencing system slowness, try adding \"acpi=no-idle\" to cmdline\n");
-	}
-	else {
-		printk(KERN_INFO "ACPI: Not using ACPI idle\n");
-	}
-
-	return 0;
-}
diff -urN linux-2.4.6-pre4/drivers/acpi/debugger/dbcmds.c linux/drivers/acpi/debugger/dbcmds.c
--- linux-2.4.6-pre4/drivers/acpi/debugger/dbcmds.c	Wed Dec 31 16:00:00 1969
+++ linux/drivers/acpi/debugger/dbcmds.c	Mon Dec  3 22:48:41 2001
@@ -0,0 +1,987 @@
+/*******************************************************************************
+ *
+ * Module Name: dbcmds - debug commands and output routines
+ *              $Revision: 60 $
+ *
+ ******************************************************************************/
+
+/*
+ *  Copyright (C) 2000, 2001 R. Byron Moore
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#include "acpi.h"
+#include "acparser.h"
+#include "acdispat.h"
+#include "amlcode.h"
+#include "acnamesp.h"
+#include "acparser.h"
+#include "acevents.h"
+#include "acinterp.h"
+#include "acdebug.h"
+#include "actables.h"
+#include "acresrc.h"
+
+#ifdef ENABLE_DEBUGGER
+
+#define _COMPONENT          ACPI_DEBUGGER
+	 MODULE_NAME         ("dbcmds")
+
+
+/*
+ * Arguments for the Objects command
+ * These object types map directly to the ACPI_TYPES
+ */
+
+ARGUMENT_INFO               acpi_db_object_types [] =
+{ {"ANY"},
+	{"NUMBERS"},
+	{"STRINGS"},
+	{"BUFFERS"},
+	{"PACKAGES"},
+	{"FIELDS"},
+	{"DEVICES"},
+	{"EVENTS"},
+	{"METHODS"},
+	{"MUTEXES"},
+	{"REGIONS"},
+	{"POWERRESOURCES"},
+	{"PROCESSORS"},
+	{"THERMALZONES"},
+	{"BUFFERFIELDS"},
+	{"DDBHANDLES"},
+	{NULL}           /* Must be null terminated */
+};
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_db_walk_for_references
+ *
+ * PARAMETERS:  Callback from Walk_namespace
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Check if this namespace object refers to the target object
+ *              that is passed in as the context value.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_db_walk_for_references (
+	ACPI_HANDLE             obj_handle,
+	u32                     nesting_level,
+	void                    *context,
+	void                    **return_value)
+{
+	ACPI_OPERAND_OBJECT     *obj_desc = (ACPI_OPERAND_OBJECT *) context;
+	ACPI_NAMESPACE_NODE     *node = (ACPI_NAMESPACE_NODE *) obj_handle;
+
+
+	/* Check for match against the namespace node itself */
+
+	if (node == (void *) obj_desc) {
+		acpi_os_printf ("Object is a Node [%4.4s]\n", &node->name);
+	}
+
+	/* Check for match against the object attached to the node */
+
+	if (node->object == obj_desc) {
+		acpi_os_printf ("Reference at Node->Object %p [%4.4s]\n", node, &node->name);
+	}
+
+	/* Check first child for a match */
+	/* TBD: [Investigate] probably now obsolete with new datastructure */
+
+	if (node->child == (void *) obj_desc) {
+		acpi_os_printf ("Reference at Node->Child %p [%4.4s]\n", node, &node->name);
+	}
+
+	return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_db_find_references
+ *
+ * PARAMETERS:  Object_arg      - String with hex value of the object
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Search namespace for all references to the input object
+ *
+ ******************************************************************************/
+
+void
+acpi_db_find_references (
+	NATIVE_CHAR             *object_arg)
+{
+	ACPI_OPERAND_OBJECT     *obj_desc;
+
+
+	/* Convert string to object pointer */
+
+	obj_desc = (ACPI_OPERAND_OBJECT *) STRTOUL (object_arg, NULL, 16);
+
+	/* Search all nodes in namespace */
+
+	acpi_walk_namespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
+			  acpi_db_walk_for_references, (void *) obj_desc, NULL);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_db_display_locks
+ *
+ * PARAMETERS:  None
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Display information about internal mutexes.
+ *
+ ******************************************************************************/
+
+void
+acpi_db_display_locks (void)
+{
+	u32                     i;
+
+
+	for (i = 0; i < MAX_MTX; i++) {
+		acpi_os_printf ("%26s : %s\n", acpi_ut_get_mutex_name (i),
+				 acpi_gbl_acpi_mutex_info[i].owner_id == ACPI_MUTEX_NOT_ACQUIRED
+						? "Locked" : "Unlocked");
+	}
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_db_display_table_info
+ *
+ * PARAMETERS:  Table_arg       - String with name of table to be displayed
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Display information about loaded tables.  Current
+ *              implementation displays all loaded tables.
+ *
+ ******************************************************************************/
+
+void
+acpi_db_display_table_info (
+	NATIVE_CHAR             *table_arg)
+{
+	u32                     i;
+
+
+	for (i = 0; i < NUM_ACPI_TABLES; i++) {
+		if (acpi_gbl_acpi_tables[i].pointer) {
+			acpi_os_printf ("%s at %p length %X\n", acpi_gbl_acpi_table_data[i].name,
+					 acpi_gbl_acpi_tables[i].pointer, acpi_gbl_acpi_tables[i].length);
+		}
+	}
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_db_unload_acpi_table
+ *
+ * PARAMETERS:  Table_arg       - Name of the table to be unloaded
+ *              Instance_arg    - Which instance of the table to unload (if
+ *                                there are multiple tables of the same type)
+ *
+ * RETURN:      Nonde
+ *
+ * DESCRIPTION: Unload an ACPI table.
+ *              Instance is not implemented
+ *
+ ******************************************************************************/
+
+void
+acpi_db_unload_acpi_table (
+	NATIVE_CHAR             *table_arg,
+	NATIVE_CHAR             *instance_arg)
+{
+	u32                     i;
+	ACPI_STATUS             status;
+
+
+	/* Search all tables for the target type */
+
+	for (i = 0; i < NUM_ACPI_TABLES; i++) {
+		if (!STRNCMP (table_arg, acpi_gbl_acpi_table_data[i].signature, acpi_gbl_acpi_table_data[i].sig_length)) {
+			/* Found the table, unload it */
+
+			status = acpi_unload_table (i);
+			if (ACPI_SUCCESS (status)) {
+				acpi_os_printf ("[%s] unloaded and uninstalled\n", table_arg);
+			}
+			else {
+				acpi_os_printf ("%s, while unloading [%s]\n", acpi_ut_format_exception (status), table_arg);
+			}
+
+			return;
+		}
+	}
+
+	acpi_os_printf ("Unknown table type [%s]\n", table_arg);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_db_set_method_breakpoint
+ *
+ * PARAMETERS:  Location            - AML offset of breakpoint
+ *              Walk_state          - Current walk info
+ *              Op                  - Current Op (from parse walk)
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Set a breakpoint in a control method at the specified
+ *              AML offset
+ *
+ ******************************************************************************/
+
+void
+acpi_db_set_method_breakpoint (
+	NATIVE_CHAR             *location,
+	ACPI_WALK_STATE         *walk_state,
+	ACPI_PARSE_OBJECT       *op)
+{
+	u32                     address;
+
+
+	if (!op) {
+		acpi_os_printf ("There is no method currently executing\n");
+		return;
+	}
+
+	/* Get and verify the breakpoint address */
+
+	address = STRTOUL (location, NULL, 16);
+	if (address <= op->aml_offset) {
+		acpi_os_printf ("Breakpoint %X is beyond current address %X\n", address, op->aml_offset);
+	}
+
+	/* Save breakpoint in current walk */
+
+	walk_state->method_breakpoint = address;
+	acpi_os_printf ("Breakpoint set at AML offset %X\n", address);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_db_set_method_call_breakpoint
+ *
+ * PARAMETERS:  Op                  - Current Op (from parse walk)
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Set a breakpoint in a control method at the specified
+ *              AML offset
+ *
+ ******************************************************************************/
+
+void
+acpi_db_set_method_call_breakpoint (
+	ACPI_PARSE_OBJECT       *op)
+{
+
+
+	if (!op) {
+		acpi_os_printf ("There is no method currently executing\n");
+		return;
+	}
+
+
+	acpi_gbl_step_to_next_call = TRUE;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_db_disassemble_aml
+ *
+ * PARAMETERS:  Statements          - Number of statements to disassemble
+ *              Op                  - Current Op (from parse walk)
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Display disassembled AML (ASL) starting from Op for the number
+ *              of statements specified.
+ *
+ ******************************************************************************/
+
+void
+acpi_db_disassemble_aml (
+	NATIVE_CHAR             *statements,
+	ACPI_PARSE_OBJECT       *op)
+{
+	u32                     num_statements = 8;
+
+
+	if (!op) {
+		acpi_os_printf ("There is no method currently executing\n");
+		return;
+	}
+
+	if (statements) {
+		num_statements = STRTOUL (statements, NULL, 0);
+	}
+
+
+	acpi_db_display_op (NULL, op, num_statements);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_db_dump_namespace
+ *
+ * PARAMETERS:  Start_arg       - Node to begin namespace dump
+ *              Depth_arg       - Maximum tree depth to be dumped
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Dump entire namespace or a subtree.  Each node is displayed
+ *              with type and other information.
+ *
+ ******************************************************************************/
+
+void
+acpi_db_dump_namespace (
+	NATIVE_CHAR             *start_arg,
+	NATIVE_CHAR             *depth_arg)
+{
+	ACPI_HANDLE             subtree_entry = acpi_gbl_root_node;
+	u32                     max_depth = ACPI_UINT32_MAX;
+
+
+	/* No argument given, just start at the root and dump entire namespace */
+
+	if (start_arg) {
+		/* Check if numeric argument, must be a Node */
+
+		if ((start_arg[0] >= 0x30) && (start_arg[0] <= 0x39)) {
+			subtree_entry = (ACPI_HANDLE) STRTOUL (start_arg, NULL, 16);
+			if (!acpi_os_readable (subtree_entry, sizeof (ACPI_NAMESPACE_NODE))) {
+				acpi_os_printf ("Address %p is invalid in this address space\n", subtree_entry);
+				return;
+			}
+
+			if (!VALID_DESCRIPTOR_TYPE ((subtree_entry), ACPI_DESC_TYPE_NAMED)) {
+				acpi_os_printf ("Address %p is not a valid Named object\n", subtree_entry);
+				return;
+			}
+		}
+
+		/* Alpha argument */
+
+		else {
+			/* The parameter is a name string that must be resolved to a Named obj*/
+
+			subtree_entry = acpi_db_local_ns_lookup (start_arg);
+			if (!subtree_entry) {
+				subtree_entry = acpi_gbl_root_node;
+			}
+		}
+
+		/* Now we can check for the depth argument */
+
+		if (depth_arg) {
+			max_depth = STRTOUL (depth_arg, NULL, 0);
+		}
+	}
+
+
+	acpi_db_set_output_destination (DB_DUPLICATE_OUTPUT);
+	acpi_os_printf ("ACPI Namespace (from %p subtree):\n", subtree_entry);
+
+	/* Display the subtree */
+
+	acpi_db_set_output_destination (DB_REDIRECTABLE_OUTPUT);
+	acpi_ns_dump_objects (ACPI_TYPE_ANY, max_depth, ACPI_UINT32_MAX, subtree_entry);
+	acpi_db_set_output_destination (DB_CONSOLE_OUTPUT);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_db_dump_namespace_by_owner
+ *
+ * PARAMETERS:  Owner_arg       - Owner ID whose nodes will be displayed
+ *              Depth_arg       - Maximum tree depth to be dumped
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Dump elements of the namespace that are owned by the Owner_id.
+ *
+ ******************************************************************************/
+
+void
+acpi_db_dump_namespace_by_owner (
+	NATIVE_CHAR             *owner_arg,
+	NATIVE_CHAR             *depth_arg)
+{
+	ACPI_HANDLE             subtree_entry = acpi_gbl_root_node;
+	u32                     max_depth = ACPI_UINT32_MAX;
+	u16                     owner_id;
+
+
+	owner_id = (u16) STRTOUL (owner_arg, NULL, 0);
+
+
+	/* Now we can check for the depth argument */
+
+	if (depth_arg) {
+		max_depth = STRTOUL (depth_arg, NULL, 0);
+	}
+
+
+	acpi_db_set_output_destination (DB_DUPLICATE_OUTPUT);
+	acpi_os_printf ("ACPI Namespace by owner %X:\n", owner_id);
+
+	/* Display the subtree */
+
+	acpi_db_set_output_destination (DB_REDIRECTABLE_OUTPUT);
+	acpi_ns_dump_objects (ACPI_TYPE_ANY, max_depth, owner_id, subtree_entry);
+	acpi_db_set_output_destination (DB_CONSOLE_OUTPUT);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_db_send_notify
+ *
+ * PARAMETERS:  Name            - Name of ACPI object to send the notify to
+ *              Value           - Value of the notify to send.
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Send an ACPI notification.  The value specified is sent to the
+ *              named object as an ACPI notify.
+ *
+ ******************************************************************************/
+
+void
+acpi_db_send_notify (
+	NATIVE_CHAR             *name,
+	u32                     value)
+{
+	ACPI_NAMESPACE_NODE     *node;
+
+
+	/* Translate name to an Named object */
+
+	node = acpi_db_local_ns_lookup (name);
+	if (!node) {
+		return;
+	}
+
+	/* Decode Named object type */
+
+	switch (node->type) {
+	case ACPI_TYPE_DEVICE:
+	case ACPI_TYPE_THERMAL:
+
+		 /* Send the notify */
+
+		acpi_ev_queue_notify_request (node, value);
+		break;
+
+	default:
+		acpi_os_printf ("Named object is not a device or a thermal object\n");
+		break;
+	}
+
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_db_set_method_data
+ *
+ * PARAMETERS:  Type_arg        - L for local, A for argument
+ *              Index_arg       - which one
+ *              Value_arg       - Value to set.
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Set a local or argument for the running control method.
+ *              NOTE: only object supported is Number.
+ *
+ ******************************************************************************/
+
+void
+acpi_db_set_method_data (
+	NATIVE_CHAR             *type_arg,
+	NATIVE_CHAR             *index_arg,
+	NATIVE_CHAR             *value_arg)
+{
+	NATIVE_CHAR             type;
+	u32                     index;
+	u32                     value;
+	ACPI_WALK_STATE         *walk_state;
+	ACPI_OPERAND_OBJECT     *obj_desc;
+
+
+	/* Validate Type_arg */
+
+	STRUPR (type_arg);
+	type = type_arg[0];
+	if ((type != 'L') &&
+		(type != 'A')) {
+		acpi_os_printf ("Invalid SET operand: %s\n", type_arg);
+		return;
+	}
+
+	/* Get the index and value */
+
+	index = STRTOUL (index_arg, NULL, 16);
+	value = STRTOUL (value_arg, NULL, 16);
+
+	walk_state = acpi_ds_get_current_walk_state (acpi_gbl_current_walk_list);
+	if (!walk_state) {
+		acpi_os_printf ("There is no method currently executing\n");
+		return;
+	}
+
+
+	/* Create and initialize the new object */
+
+	obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
+	if (!obj_desc) {
+		acpi_os_printf ("Could not create an internal object\n");
+		return;
+	}
+
+	obj_desc->integer.value = value;
+
+
+	/* Store the new object into the target */
+
+	switch (type) {
+	case 'A':
+
+		/* Set a method argument */
+
+		if (index > MTH_NUM_ARGS) {
+			acpi_os_printf ("Arg%d - Invalid argument name\n", index);
+			return;
+		}
+
+		acpi_ds_store_object_to_local (AML_ARG_OP, index, obj_desc, walk_state);
+		obj_desc = walk_state->arguments[index].object;
+
+		acpi_os_printf ("Arg%d: ", index);
+		acpi_db_display_internal_object (obj_desc, walk_state);
+		break;
+
+	case 'L':
+
+		/* Set a method local */
+
+		if (index > MTH_NUM_LOCALS) {
+			acpi_os_printf ("Local%d - Invalid local variable name\n", index);
+			return;
+		}
+
+		acpi_ds_store_object_to_local (AML_LOCAL_OP, index, obj_desc, walk_state);
+		obj_desc = walk_state->local_variables[index].object;
+
+		acpi_os_printf ("Local%d: ", index);
+		acpi_db_display_internal_object (obj_desc, walk_state);
+		break;
+
+	default:
+		break;
+	}
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_db_walk_for_specific_objects
+ *
+ * PARAMETERS:  Callback from Walk_namespace
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Display short info about objects in the namespace
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_db_walk_for_specific_objects (
+	ACPI_HANDLE             obj_handle,
+	u32                     nesting_level,
+	void                    *context,
+	void                    **return_value)
+{
+	ACPI_OPERAND_OBJECT     *obj_desc;
+	ACPI_STATUS             status;
+	u32                     buf_size;
+	NATIVE_CHAR             buffer[64];
+
+
+	obj_desc = ((ACPI_NAMESPACE_NODE *)obj_handle)->object;
+	buf_size = sizeof (buffer) / sizeof (*buffer);
+
+	/* Get and display the full pathname to this object */
+
+	status = acpi_ns_handle_to_pathname (obj_handle, &buf_size, buffer);
+
+	if (ACPI_FAILURE (status)) {
+		acpi_os_printf ("Could Not get pathname for object %p\n", obj_handle);
+		return (AE_OK);
+	}
+
+	acpi_os_printf ("%32s", buffer);
+
+
+	/* Display short information about the object */
+
+	if (obj_desc) {
+		switch (obj_desc->common.type) {
+		case ACPI_TYPE_METHOD:
+			acpi_os_printf (" #Args %d Concurrency %X", obj_desc->method.param_count, obj_desc->method.concurrency);
+			break;
+
+		case ACPI_TYPE_INTEGER:
+			acpi_os_printf (" Value %X", obj_desc->integer.value);
+			break;
+
+		case ACPI_TYPE_STRING:
+			acpi_os_printf (" \"%s\"", obj_desc->string.pointer);
+			break;
+
+		case ACPI_TYPE_REGION:
+			acpi_os_printf (" Space_id %X Address %X Length %X", obj_desc->region.space_id, obj_desc->region.address, obj_desc->region.length);
+			break;
+
+		case ACPI_TYPE_PACKAGE:
+			acpi_os_printf (" #Elements %X", obj_desc->package.count);
+			break;
+
+		case ACPI_TYPE_BUFFER:
+			acpi_os_printf (" Length %X", obj_desc->buffer.length);
+			break;
+		}
+	}
+
+	acpi_os_printf ("\n");
+	return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_db_display_objects
+ *
+ * PARAMETERS:  Obj_type_arg        - Type of object to display
+ *              Display_count_arg   - Max depth to display
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Display objects in the namespace of the requested type
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_db_display_objects (
+	NATIVE_CHAR             *obj_type_arg,
+	NATIVE_CHAR             *display_count_arg)
+{
+	ACPI_OBJECT_TYPE8       type;
+
+
+	/* Get the object type */
+
+	type = acpi_db_match_argument (obj_type_arg, acpi_db_object_types);
+	if (type == ACPI_TYPE_NOT_FOUND) {
+		acpi_os_printf ("Invalid or unsupported argument\n");
+		return (AE_OK);
+	}
+
+	acpi_db_set_output_destination (DB_DUPLICATE_OUTPUT);
+	acpi_os_printf ("Objects of type [%s] defined in the current ACPI Namespace: \n", acpi_ut_get_type_name (type));
+
+	acpi_db_set_output_destination (DB_REDIRECTABLE_OUTPUT);
+
+	/* Walk the namespace from the root */
+
+	acpi_walk_namespace (type, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
+			   acpi_db_walk_for_specific_objects, (void *) &type, NULL);
+
+	acpi_db_set_output_destination (DB_CONSOLE_OUTPUT);
+	return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_db_walk_and_match_name
+ *
+ * PARAMETERS:  Callback from Walk_namespace
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Find a particular name/names within the namespace.  Wildcards
+ *              are supported -- '?' matches any character.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_db_walk_and_match_name (
+	ACPI_HANDLE             obj_handle,
+	u32                     nesting_level,
+	void                    *context,
+	void                    **return_value)
+{
+	ACPI_STATUS             status;
+	NATIVE_CHAR             *requested_name = (NATIVE_CHAR *) context;
+	u32                     i;
+	u32                     buf_size;
+	NATIVE_CHAR             buffer[96];
+
+
+	/* Check for a name match */
+
+	for (i = 0; i < 4; i++) {
+		/* Wildcard support */
+
+		if ((requested_name[i] != '?') &&
+			(requested_name[i] != ((NATIVE_CHAR *) (&((ACPI_NAMESPACE_NODE *) obj_handle)->name))[i])) {
+			/* No match, just exit */
+
+			return (AE_OK);
+		}
+	}
+
+
+	/* Get the full pathname to this object */
+
+	buf_size = sizeof (buffer) / sizeof (*buffer);
+
+	status = acpi_ns_handle_to_pathname (obj_handle, &buf_size, buffer);
+	if (ACPI_FAILURE (status)) {
+		acpi_os_printf ("Could Not get pathname for object %p\n", obj_handle);
+	}
+
+	else {
+		acpi_os_printf ("%32s (%p) - %s\n", buffer, obj_handle,
+			acpi_ut_get_type_name (((ACPI_NAMESPACE_NODE *) obj_handle)->type));
+	}
+
+	return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_db_find_name_in_namespace
+ *
+ * PARAMETERS:  Name_arg        - The 4-character ACPI name to find.
+ *                                wildcards are supported.
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Search the namespace for a given name (with wildcards)
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_db_find_name_in_namespace (
+	NATIVE_CHAR             *name_arg)
+{
+
+	if (STRLEN (name_arg) > 4) {
+		acpi_os_printf ("Name must be no longer than 4 characters\n");
+		return (AE_OK);
+	}
+
+	/* Walk the namespace from the root */
+
+	acpi_walk_namespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
+			   acpi_db_walk_and_match_name, name_arg, NULL);
+
+	acpi_db_set_output_destination (DB_CONSOLE_OUTPUT);
+	return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_db_set_scope
+ *
+ * PARAMETERS:  Name                - New scope path
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Set the "current scope" as maintained by this utility.
+ *              The scope is used as a prefix to ACPI paths.
+ *
+ ******************************************************************************/
+
+void
+acpi_db_set_scope (
+	NATIVE_CHAR             *name)
+{
+
+	if (!name || name[0] == 0) {
+		acpi_os_printf ("Current scope: %s\n", scope_buf);
+		return;
+	}
+
+	acpi_db_prep_namestring (name);
+
+	/* TBD: [Future] Validate scope here */
+
+	if (name[0] == '\\') {
+		STRCPY (scope_buf, name);
+		STRCAT (scope_buf, "\\");
+	}
+
+	else {
+		STRCAT (scope_buf, name);
+		STRCAT (scope_buf, "\\");
+	}
+
+	acpi_os_printf ("New scope: %s\n", scope_buf);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_db_display_resources
+ *
+ * PARAMETERS:  Object_arg      - String with hex value of the object
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION:
+ *
+ ******************************************************************************/
+
+void
+acpi_db_display_resources (
+	NATIVE_CHAR             *object_arg)
+{
+#ifndef _IA16
+	ACPI_OPERAND_OBJECT     *obj_desc;
+	ACPI_STATUS             status;
+	ACPI_BUFFER             return_obj;
+
+
+	acpi_db_set_output_destination (DB_REDIRECTABLE_OUTPUT);
+
+	/* Convert string to object pointer */
+
+	obj_desc = (ACPI_OPERAND_OBJECT *) STRTOUL (object_arg, NULL, 16);
+
+	/* Prepare for a return object of arbitrary size */
+
+	return_obj.pointer          = buffer;
+	return_obj.length           = BUFFER_SIZE;
+
+	/* _PRT */
+
+	acpi_os_printf ("Evaluating _PRT\n");
+
+	status = acpi_evaluate_object (obj_desc, "_PRT", NULL, &return_obj);
+	if (ACPI_FAILURE (status)) {
+		acpi_os_printf ("Could not obtain _PRT: %s\n", acpi_ut_format_exception (status));
+		goto go_cRS;
+	}
+
+	return_obj.pointer          = buffer;
+	return_obj.length           = BUFFER_SIZE;
+
+	status = acpi_get_irq_routing_table (obj_desc, &return_obj);
+	if (ACPI_FAILURE (status)) {
+		acpi_os_printf ("Get_irq_routing_table failed: %s\n", acpi_ut_format_exception (status));
+		goto go_cRS;
+	}
+
+
+	acpi_rs_dump_irq_list((u8 *)buffer);
+
+	/* _CRS */
+go_cRS:
+	acpi_os_printf ("Evaluating _CRS\n");
+
+	return_obj.pointer          = buffer;
+	return_obj.length           = BUFFER_SIZE;
+
+	status = acpi_evaluate_object (obj_desc, "_CRS", NULL, &return_obj);
+	if (ACPI_FAILURE (status)) {
+		acpi_os_printf ("Could not obtain _CRS: %s\n", acpi_ut_format_exception (status));
+		goto go_pRS;
+	}
+
+	return_obj.pointer          = buffer;
+	return_obj.length           = BUFFER_SIZE;
+
+	status = acpi_get_current_resources (obj_desc, &return_obj);
+	if (ACPI_FAILURE (status)) {
+		acpi_os_printf ("Acpi_get_current_resources failed: %s\n", acpi_ut_format_exception (status));
+		goto go_pRS;
+	}
+
+	acpi_rs_dump_resource_list ((ACPI_RESOURCE *) buffer);
+
+	/* _PRS */
+go_pRS:
+	acpi_os_printf ("Evaluating _PRS\n");
+
+	return_obj.pointer          = buffer;
+	return_obj.length           = BUFFER_SIZE;
+
+	status = acpi_evaluate_object (obj_desc, "_PRS", NULL, &return_obj);
+	if (ACPI_FAILURE (status)) {
+		acpi_os_printf ("Could not obtain _PRS: %s\n", acpi_ut_format_exception (status));
+		goto cleanup;
+	}
+
+	return_obj.pointer          = buffer;
+	return_obj.length           = BUFFER_SIZE;
+
+	status = acpi_get_possible_resources (obj_desc, &return_obj);
+	if (ACPI_FAILURE (status)) {
+		acpi_os_printf ("Acpi_get_possible_resources failed: %s\n", acpi_ut_format_exception (status));
+		goto cleanup;
+	}
+
+	acpi_rs_dump_resource_list ((ACPI_RESOURCE *) buffer);
+
+
+cleanup:
+
+	acpi_db_set_output_destination (DB_CONSOLE_OUTPUT);
+	return;
+#endif
+
+}
+
+
+#endif /* ENABLE_DEBUGGER */
diff -urN linux-2.4.6-pre4/drivers/acpi/debugger/dbdisasm.c linux/drivers/acpi/debugger/dbdisasm.c
--- linux-2.4.6-pre4/drivers/acpi/debugger/dbdisasm.c	Wed Dec 31 16:00:00 1969
+++ linux/drivers/acpi/debugger/dbdisasm.c	Mon Dec  3 22:48:41 2001
@@ -0,0 +1,674 @@
+/*******************************************************************************
+ *
+ * Module Name: dbdisasm - parser op tree display routines
+ *              $Revision: 40 $
+ *
+ ******************************************************************************/
+
+/*
+ *  Copyright (C) 2000, 2001 R. Byron Moore
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#include "acpi.h"
+#include "acparser.h"
+#include "amlcode.h"
+#include "acnamesp.h"
+#include "acdebug.h"
+
+
+#ifdef ENABLE_DEBUGGER
+
+#define _COMPONENT          ACPI_DEBUGGER
+	 MODULE_NAME         ("dbdisasm")
+
+
+#define MAX_SHOW_ENTRY      128
+#define BLOCK_PAREN         1
+#define BLOCK_BRACE         2
+#define DB_NO_OP_INFO       "            [%2.2d]  "
+#define DB_FULL_OP_INFO     "%5.5X #%4.4X [%2.2d]  "
+
+
+NATIVE_CHAR                 *INDENT_STRING = "....";
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_db_block_type
+ *
+ * PARAMETERS:  Op              - Object to be examined
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Type of block for this op (parens or braces)
+ *
+ ******************************************************************************/
+
+u32
+acpi_db_block_type (
+	ACPI_PARSE_OBJECT       *op)
+{
+
+	switch (op->opcode) {
+	case AML_METHOD_OP:
+		return (BLOCK_BRACE);
+		break;
+
+	default:
+		break;
+	}
+
+	return (BLOCK_PAREN);
+
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ps_display_object_pathname
+ *
+ * PARAMETERS:  Op              - Object whose pathname is to be obtained
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Diplay the pathname associated with a named object.  Two
+ *              versions. One searches the parse tree (for parser-only
+ *              applications suchas Acpi_dump), and the other searches the
+ *              ACPI namespace (the parse tree is probably deleted)
+ *
+ ******************************************************************************/
+
+#ifdef PARSER_ONLY
+
+ACPI_STATUS
+acpi_ps_display_object_pathname (
+	ACPI_PARSE_OBJECT       *op)
+{
+	ACPI_PARSE_OBJECT       *target_op;
+
+
+	/* Search parent tree up to the root if necessary */
+
+	target_op = acpi_ps_find (op, op->value.name, 0, 0);
+	if (!target_op) {
+		/*
+		 * Didn't find the name in the parse tree.  This may be
+		 * a problem, or it may simply be one of the predefined names
+		 * (such as _OS_).  Rather than worry about looking up all
+		 * the predefined names, just display the name as given
+		 */
+
+		acpi_os_printf (" **** Path not found in parse tree");
+	}
+
+	else {
+		/* The target was found, print the name and complete path */
+
+		acpi_os_printf (" (Path ");
+		acpi_db_display_path (target_op);
+		acpi_os_printf (")");
+	}
+
+	return (AE_OK);
+}
+
+#else
+
+ACPI_STATUS
+acpi_ps_display_object_pathname (
+	ACPI_PARSE_OBJECT       *op)
+{
+	ACPI_STATUS             status;
+	ACPI_NAMESPACE_NODE     *node;
+	NATIVE_CHAR             buffer[MAX_SHOW_ENTRY];
+	u32                     buffer_size = MAX_SHOW_ENTRY;
+
+
+	acpi_os_printf (" (Path ");
+
+	/* Just get the Node out of the Op object */
+
+	node = op->node;
+	if (!node) {
+		/*
+		 * No Named obj,  so we can't get the pathname since the object
+		 * is not in the namespace.  This can happen during single
+		 * stepping where a dynamic named object is *about* to be created.
+		 */
+		return (AE_OK);
+	}
+
+	/* Convert Named_desc/handle to a full pathname */
+
+	status = acpi_ns_handle_to_pathname (node, &buffer_size, buffer);
+	if (ACPI_FAILURE (status)) {
+		acpi_os_printf ("****Could not get pathname****)");
+		return (status);
+	}
+
+	acpi_os_printf ("%s)", buffer);
+	return (AE_OK);
+}
+
+#endif
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_db_display_op
+ *
+ * PARAMETERS:  Origin          - Starting object
+ *              Num_opcodes     - Max number of opcodes to be displayed
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Display parser object and its children
+ *
+ ******************************************************************************/
+
+void
+acpi_db_display_op (
+	ACPI_WALK_STATE         *walk_state,
+	ACPI_PARSE_OBJECT       *origin,
+	u32                     num_opcodes)
+{
+	ACPI_PARSE_OBJECT       *op = origin;
+	ACPI_PARSE_OBJECT       *arg;
+	ACPI_PARSE_OBJECT       *depth;
+	u32                     depth_count = 0;
+	u32                     last_depth = 0;
+	u32                     i;
+	u32                     j;
+
+
+	if (op) {
+		while (op) {
+			/* indentation */
+
+			depth_count = 0;
+			if (!opt_verbose) {
+				depth_count++;
+			}
+
+			/* Determine the nesting depth of this argument */
+
+			for (depth = op->parent; depth; depth = depth->parent) {
+				arg = acpi_ps_get_arg (depth, 0);
+				while (arg && arg != origin) {
+					arg = arg->next;
+				}
+
+				if (arg) {
+					break;
+				}
+
+				depth_count++;
+			}
+
+
+			/* Open a new block if we are nested further than last time */
+
+			if (depth_count > last_depth) {
+				VERBOSE_PRINT ((DB_NO_OP_INFO, last_depth));
+				for (i = 0; i < last_depth; i++) {
+					acpi_os_printf (INDENT_STRING);
+				}
+
+				if (acpi_db_block_type (op) == BLOCK_PAREN) {
+					acpi_os_printf ("(\n");
+				}
+				else {
+					acpi_os_printf ("{\n");
+				}
+			}
+
+			/* Close a block if we are nested less than last time */
+
+			else if (depth_count < last_depth) {
+				for (j = 0; j < (last_depth - depth_count); j++) {
+					VERBOSE_PRINT ((DB_NO_OP_INFO, last_depth - j));
+					for (i = 0; i < (last_depth - j - 1); i++) {
+						acpi_os_printf (INDENT_STRING);
+					}
+
+					if (acpi_db_block_type (op) == BLOCK_PAREN) {
+						acpi_os_printf (")\n");
+					}
+					else {
+						acpi_os_printf ("}\n");
+					}
+				}
+			}
+
+			/* In verbose mode, print the AML offset, opcode and depth count */
+
+			VERBOSE_PRINT ((DB_FULL_OP_INFO, (unsigned) op->aml_offset, op->opcode, depth_count));
+
+
+			/* Indent the output according to the depth count */
+
+			for (i = 0; i < depth_count; i++) {
+				acpi_os_printf (INDENT_STRING);
+			}
+
+
+			/* Now print the opcode */
+
+			acpi_db_display_opcode (walk_state, op);
+
+			/* Resolve a name reference */
+
+			if ((op->opcode == AML_INT_NAMEPATH_OP && op->value.name)  &&
+				(op->parent) &&
+				(opt_verbose)) {
+				acpi_ps_display_object_pathname (op);
+			}
+
+			acpi_os_printf ("\n");
+
+			/* Get the next node in the tree */
+
+			op = acpi_ps_get_depth_next (origin, op);
+			last_depth = depth_count;
+
+			num_opcodes--;
+			if (!num_opcodes) {
+				op = NULL;
+			}
+		}
+
+		/* Close the last block(s) */
+
+		depth_count = last_depth -1;
+		for (i = 0; i < last_depth; i++) {
+			VERBOSE_PRINT ((DB_NO_OP_INFO, last_depth - i));
+			for (j = 0; j < depth_count; j++) {
+				acpi_os_printf (INDENT_STRING);
+			}
+			acpi_os_printf ("}\n");
+			depth_count--;
+		}
+
+	}
+
+	else {
+		acpi_db_display_opcode (walk_state, op);
+	}
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_db_display_namestring
+ *
+ * PARAMETERS:  Name                - ACPI Name string to store
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Display namestring. Handles prefix characters
+ *
+ ******************************************************************************/
+
+void
+acpi_db_display_namestring (
+	NATIVE_CHAR             *name)
+{
+	u32                     seg_count;
+	u8                      do_dot = FALSE;
+
+
+	if (!name) {
+		acpi_os_printf ("<NULL NAME PTR>");
+		return;
+	}
+
+	if (acpi_ps_is_prefix_char (GET8 (name))) {
+		/* append prefix character */
+
+		acpi_os_printf ("%1c", GET8 (name));
+		name++;
+	}
+
+	switch (GET8 (name)) {
+	case AML_DUAL_NAME_PREFIX:
+		seg_count = 2;
+		name++;
+		break;
+
+	case AML_MULTI_NAME_PREFIX_OP:
+		seg_count = (u32) GET8 (name + 1);
+		name += 2;
+		break;
+
+	default:
+		seg_count = 1;
+		break;
+	}
+
+	while (seg_count--) {
+		/* append Name segment */
+
+		if (do_dot) {
+			/* append dot */
+
+			acpi_os_printf (".");
+		}
+
+		acpi_os_printf ("%4.4s", name);
+		do_dot = TRUE;
+
+		name += 4;
+	}
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_db_display_path
+ *
+ * PARAMETERS:  Op                  - Named Op whose path is to be constructed
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Walk backwards from current scope and display the name
+ *              of each previous level of scope up to the root scope
+ *              (like "pwd" does with file systems)
+ *
+ ******************************************************************************/
+
+void
+acpi_db_display_path (
+	ACPI_PARSE_OBJECT       *op)
+{
+	ACPI_PARSE_OBJECT       *prev;
+	ACPI_PARSE_OBJECT       *search;
+	u32                     name;
+	u8                      do_dot = FALSE;
+	ACPI_PARSE_OBJECT       *name_path;
+
+
+	/* We are only interested in named objects */
+
+	if (!acpi_ps_is_node_op (op->opcode)) {
+		return;
+	}
+
+
+	if (acpi_ps_is_create_field_op (op->opcode)) {
+		/* Field creation - check for a fully qualified namepath */
+
+		if (op->opcode == AML_CREATE_FIELD_OP) {
+			name_path = acpi_ps_get_arg (op, 3);
+		}
+		else {
+			name_path = acpi_ps_get_arg (op, 2);
+		}
+
+		if ((name_path) &&
+			(name_path->value.string) &&
+			(name_path->value.string[0] == '\\')) {
+			acpi_db_display_namestring (name_path->value.string);
+			return;
+		}
+	}
+
+	prev = NULL;            /* Start with Root Node */
+
+	while (prev != op) {
+		/* Search upwards in the tree to find scope with "prev" as its parent */
+
+		search = op;
+		for (; ;) {
+			if (search->parent == prev) {
+				break;
+			}
+
+			/* Go up one level */
+
+			search = search->parent;
+		}
+
+		if (prev && !acpi_ps_is_field_op (search->opcode)) {
+			/* below root scope, append scope name */
+
+			if (do_dot) {
+				/* append dot */
+
+				acpi_os_printf (".");
+			}
+
+			if (acpi_ps_is_create_field_op (search->opcode)) {
+				if (op->opcode == AML_CREATE_FIELD_OP) {
+					name_path = acpi_ps_get_arg (op, 3);
+				}
+				else {
+					name_path = acpi_ps_get_arg (op, 2);
+				}
+
+				if ((name_path) &&
+					(name_path->value.string)) {
+					acpi_os_printf ("%4.4s", name_path->value.string);
+				}
+			}
+
+			else {
+				name = acpi_ps_get_name (search);
+				acpi_os_printf ("%4.4s", &name);
+			}
+
+			do_dot = TRUE;
+		}
+
+		prev = search;
+	}
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_db_display_opcode
+ *
+ * PARAMETERS:  Op                  - Op that is to be printed
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Store printed op in a Buffer and return its length
+ *              (or -1 if out of space)
+ *
+ * NOTE: Terse mode prints out ASL-like code.  Verbose mode adds more info.
+ *
+ ******************************************************************************/
+
+void
+acpi_db_display_opcode (
+	ACPI_WALK_STATE         *walk_state,
+	ACPI_PARSE_OBJECT       *op)
+{
+	u8                      *byte_data;
+	u32                     byte_count;
+	u32                     i;
+	ACPI_OPCODE_INFO        *opc = NULL;
+	u32                     name;
+
+
+	if (!op) {
+		acpi_os_printf ("<NULL OP PTR>");
+	}
+
+
+	/* op and arguments */
+
+	switch (op->opcode) {
+
+	case AML_BYTE_OP:
+
+		if (opt_verbose) {
+			acpi_os_printf ("(u8) 0x%2.2X", op->value.integer & ACPI_UINT8_MAX);
+		}
+
+		else {
+			acpi_os_printf ("0x%2.2X", op->value.integer & ACPI_UINT8_MAX);
+		}
+
+		break;
+
+
+	case AML_WORD_OP:
+
+		if (opt_verbose) {
+			acpi_os_printf ("(u16) 0x%4.4X", op->value.integer & ACPI_UINT16_MAX);
+		}
+
+		else {
+			acpi_os_printf ("0x%4.4X", op->value.integer & ACPI_UINT16_MAX);
+		}
+
+		break;
+
+
+	case AML_DWORD_OP:
+
+		if (opt_verbose) {
+			acpi_os_printf ("(u32) 0x%8.8X", op->value.integer);
+		}
+
+		else {
+			acpi_os_printf ("0x%8.8X", op->value.integer);
+		}
+
+		break;
+
+
+	case AML_STRING_OP:
+
+		if (op->value.string) {
+			acpi_os_printf ("\"%s\"", op->value.string);
+		}
+
+		else {
+			acpi_os_printf ("<\"NULL STRING PTR\">");
+		}
+
+		break;
+
+
+	case AML_INT_STATICSTRING_OP:
+
+		if (op->value.string) {
+			acpi_os_printf ("\"%s\"", op->value.string);
+		}
+
+		else {
+			acpi_os_printf ("\"<NULL STATIC STRING PTR>\"");
+		}
+
+		break;
+
+
+	case AML_INT_NAMEPATH_OP:
+
+		acpi_db_display_namestring (op->value.name);
+		break;
+
+
+	case AML_INT_NAMEDFIELD_OP:
+
+		acpi_os_printf ("Named_field (Length 0x%8.8X)  ", op->value.integer);
+		break;
+
+
+	case AML_INT_RESERVEDFIELD_OP:
+
+		acpi_os_printf ("Reserved_field (Length 0x%8.8X) ", op->value.integer);
+		break;
+
+
+	case AML_INT_ACCESSFIELD_OP:
+
+		acpi_os_printf ("Access_field (Length 0x%8.8X) ", op->value.integer);
+		break;
+
+
+	case AML_INT_BYTELIST_OP:
+
+		if (opt_verbose) {
+			acpi_os_printf ("Byte_list   (Length 0x%8.8X)  ", op->value.integer);
+		}
+
+		else {
+			acpi_os_printf ("0x%2.2X", op->value.integer);
+
+			byte_count = op->value.integer;
+			byte_data = ((ACPI_PARSE2_OBJECT *) op)->data;
+
+			for (i = 0; i < byte_count; i++) {
+				acpi_os_printf (", 0x%2.2X", byte_data[i]);
+			}
+		}
+
+		break;
+
+
+	default:
+
+		/* Just get the opcode name and print it */
+
+		opc = acpi_ps_get_opcode_info (op->opcode);
+		acpi_os_printf ("%s", opc->name);
+
+
+#ifndef PARSER_ONLY
+		if ((op->opcode == AML_INT_RETURN_VALUE_OP) &&
+			(walk_state->results) &&
+			(walk_state->results->results.num_results)) {
+			acpi_db_decode_internal_object (walk_state->results->results.obj_desc [walk_state->results->results.num_results-1]);
+		}
+#endif
+
+		break;
+	}
+
+
+	if (!opc) {
+		/* If there is another element in the list, add a comma */
+
+		if (op->next) {
+			acpi_os_printf (",");
+		}
+	}
+
+
+	/*
+	 * If this is a named opcode, print the associated name value
+	 */
+
+	if (op && acpi_ps_is_named_op (op->opcode)) {
+		name = acpi_ps_get_name (op);
+		acpi_os_printf (" %4.4s", &name);
+
+		if (opt_verbose) {
+			acpi_os_printf (" (Path \\");
+			acpi_db_display_path (op);
+			acpi_os_printf (")");
+		}
+	}
+}
+
+
+#endif  /* ENABLE_DEBUGGER */
+
diff -urN linux-2.4.6-pre4/drivers/acpi/debugger/dbdisply.c linux/drivers/acpi/debugger/dbdisply.c
--- linux-2.4.6-pre4/drivers/acpi/debugger/dbdisply.c	Wed Dec 31 16:00:00 1969
+++ linux/drivers/acpi/debugger/dbdisply.c	Mon Dec  3 22:48:41 2001
@@ -0,0 +1,780 @@
+/*******************************************************************************
+ *
+ * Module Name: dbdisply - debug display commands
+ *              $Revision: 45 $
+ *
+ ******************************************************************************/
+
+/*
+ *  Copyright (C) 2000, 2001 R. Byron Moore
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#include "acpi.h"
+#include "acparser.h"
+#include "amlcode.h"
+#include "acdispat.h"
+#include "acnamesp.h"
+#include "acparser.h"
+#include "acevents.h"
+#include "acinterp.h"
+#include "acdebug.h"
+
+
+#ifdef ENABLE_DEBUGGER
+
+
+#define _COMPONENT          ACPI_DEBUGGER
+	 MODULE_NAME         ("dbdisply")
+
+
+/******************************************************************************
+ *
+ * FUNCTION:    Acpi_db_get_pointer
+ *
+ * PARAMETERS:  Target          - Pointer to string to be converted
+ *
+ * RETURN:      Converted pointer
+ *
+ * DESCRIPTION: Convert an ascii pointer value to a real value
+ *
+ *****************************************************************************/
+
+void *
+acpi_db_get_pointer (
+	void                    *target)
+{
+	void                    *obj_ptr;
+
+
+#ifdef _IA16
+#include <stdio.h>
+
+	/* Have to handle 16-bit pointers of the form segment:offset */
+
+	if (!sscanf (target, "%p", &obj_ptr)) {
+		acpi_os_printf ("Invalid pointer: %s\n", target);
+		return (NULL);
+	}
+
+#else
+
+	/* Simple flat pointer */
+
+	obj_ptr = (void *) STRTOUL (target, NULL, 16);
+
+#endif
+
+	return (obj_ptr);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_db_dump_parser_descriptor
+ *
+ * PARAMETERS:  Op              - A parser Op descriptor
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Display a formatted parser object
+ *
+ ******************************************************************************/
+
+void
+acpi_db_dump_parser_descriptor (
+	ACPI_PARSE_OBJECT       *op)
+{
+	ACPI_OPCODE_INFO        *info;
+
+
+	info = acpi_ps_get_opcode_info (op->opcode);
+
+	acpi_os_printf ("Parser Op Descriptor:\n");
+	acpi_os_printf ("%20.20s : %4.4X\n", "Opcode", op->opcode);
+
+	DEBUG_ONLY_MEMBERS (acpi_os_printf ("%20.20s : %s\n", "Opcode Name", info->name));
+
+	acpi_os_printf ("%20.20s : %p\n", "Value/Arg_list", op->value);
+	acpi_os_printf ("%20.20s : %p\n", "Parent", op->parent);
+	acpi_os_printf ("%20.20s : %p\n", "Next_op", op->next);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_db_decode_and_display_object
+ *
+ * PARAMETERS:  Target          - String with object to be displayed.  Names
+ *                                and hex pointers are supported.
+ *              Output_type     - Byte, Word, Dword, or Qword (B|W|D|Q)
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Display a formatted ACPI object
+ *
+ ******************************************************************************/
+
+void
+acpi_db_decode_and_display_object (
+	NATIVE_CHAR             *target,
+	NATIVE_CHAR             *output_type)
+{
+	void                    *obj_ptr;
+	ACPI_NAMESPACE_NODE     *node;
+	u32                     display = DB_BYTE_DISPLAY;
+	NATIVE_CHAR             buffer[80];
+	ACPI_BUFFER             ret_buf;
+	ACPI_STATUS             status;
+	u32                     size;
+
+
+	if (!target) {
+		return;
+	}
+
+	/* Decode the output type */
+
+	if (output_type) {
+		STRUPR (output_type);
+		if (output_type[0] == 'W') {
+			display = DB_WORD_DISPLAY;
+		}
+		else if (output_type[0] == 'D') {
+			display = DB_DWORD_DISPLAY;
+		}
+		else if (output_type[0] == 'Q') {
+			display = DB_QWORD_DISPLAY;
+		}
+	}
+
+
+	ret_buf.length = sizeof (buffer);
+	ret_buf.pointer = buffer;
+
+	/* Differentiate between a number and a name */
+
+	if ((target[0] >= 0x30) && (target[0] <= 0x39)) {
+		obj_ptr = acpi_db_get_pointer (target);
+		if (!acpi_os_readable (obj_ptr, 16)) {
+			acpi_os_printf ("Address %p is invalid in this address space\n", obj_ptr);
+			return;
+		}
+
+		/* Decode the object type */
+
+		if (VALID_DESCRIPTOR_TYPE ((obj_ptr), ACPI_DESC_TYPE_NAMED)) {
+			/* This is a Node */
+
+			if (!acpi_os_readable (obj_ptr, sizeof (ACPI_NAMESPACE_NODE))) {
+				acpi_os_printf ("Cannot read entire Named object at address %p\n", obj_ptr);
+				return;
+			}
+
+			node = obj_ptr;
+			goto dump_nte;
+		}
+
+		else if (VALID_DESCRIPTOR_TYPE ((obj_ptr), ACPI_DESC_TYPE_INTERNAL)) {
+			/* This is an ACPI OBJECT */
+
+			if (!acpi_os_readable (obj_ptr, sizeof (ACPI_OPERAND_OBJECT))) {
+				acpi_os_printf ("Cannot read entire ACPI object at address %p\n", obj_ptr);
+				return;
+			}
+
+			acpi_ut_dump_buffer (obj_ptr, sizeof (ACPI_OPERAND_OBJECT), display, ACPI_UINT32_MAX);
+			acpi_ex_dump_object_descriptor (obj_ptr, 1);
+		}
+
+		else if (VALID_DESCRIPTOR_TYPE ((obj_ptr), ACPI_DESC_TYPE_PARSER)) {
+			/* This is an Parser Op object */
+
+			if (!acpi_os_readable (obj_ptr, sizeof (ACPI_PARSE_OBJECT))) {
+				acpi_os_printf ("Cannot read entire Parser object at address %p\n", obj_ptr);
+				return;
+			}
+
+
+			acpi_ut_dump_buffer (obj_ptr, sizeof (ACPI_PARSE_OBJECT), display, ACPI_UINT32_MAX);
+			acpi_db_dump_parser_descriptor ((ACPI_PARSE_OBJECT *) obj_ptr);
+		}
+
+		else {
+			size = 16;
+			if (acpi_os_readable (obj_ptr, 64)) {
+				size = 64;
+			}
+
+			/* Just dump some memory */
+
+			acpi_ut_dump_buffer (obj_ptr, size, display, ACPI_UINT32_MAX);
+		}
+
+		return;
+	}
+
+
+	/* The parameter is a name string that must be resolved to a Named obj */
+
+	node = acpi_db_local_ns_lookup (target);
+	if (!node) {
+		return;
+	}
+
+
+dump_nte:
+	/* Now dump the Named obj */
+
+	status = acpi_get_name (node, ACPI_FULL_PATHNAME, &ret_buf);
+	if (ACPI_FAILURE (status)) {
+		acpi_os_printf ("Could not convert name to pathname\n");
+	}
+
+	else {
+		acpi_os_printf ("Object Pathname: %s\n", ret_buf.pointer);
+	}
+
+	if (!acpi_os_readable (node, sizeof (ACPI_NAMESPACE_NODE))) {
+		acpi_os_printf ("Invalid Named object at address %p\n", node);
+		return;
+	}
+
+	acpi_ut_dump_buffer ((void *) node, sizeof (ACPI_NAMESPACE_NODE), display, ACPI_UINT32_MAX);
+	acpi_ex_dump_node (node, 1);
+
+	if (node->object) {
+		acpi_os_printf ("\n_attached Object (%p):\n", node->object);
+		if (!acpi_os_readable (node->object, sizeof (ACPI_OPERAND_OBJECT))) {
+			acpi_os_printf ("Invalid internal ACPI Object at address %p\n", node->object);
+			return;
+		}
+
+		acpi_ut_dump_buffer (node->object, sizeof (ACPI_OPERAND_OBJECT), display, ACPI_UINT32_MAX);
+		acpi_ex_dump_object_descriptor (node->object, 1);
+	}
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_db_decode_internal_object
+ *
+ * PARAMETERS:  Obj_desc        - Object to be displayed
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Short display of an internal object.  Numbers and Strings.
+ *
+ ******************************************************************************/
+
+void
+acpi_db_decode_internal_object (
+	ACPI_OPERAND_OBJECT     *obj_desc)
+{
+	u32                     i;
+
+
+	if (!obj_desc) {
+		return;
+	}
+
+	acpi_os_printf (" %s", acpi_ut_get_type_name (obj_desc->common.type));
+
+	switch (obj_desc->common.type) {
+	case ACPI_TYPE_INTEGER:
+		acpi_os_printf (" %.8X", obj_desc->integer.value);
+		break;
+
+	case ACPI_TYPE_STRING:
+		acpi_os_printf ("(%d) \"%.16s\"...",
+				obj_desc->string.length, obj_desc->string.pointer);
+		break;
+
+	case ACPI_TYPE_BUFFER:
+		acpi_os_printf ("(%d)", obj_desc->buffer.length);
+		for (i = 0; (i < 8) && (i < obj_desc->buffer.length); i++) {
+			acpi_os_printf (" %2.2X", obj_desc->buffer.pointer[i]);
+		}
+		break;
+	}
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_db_display_internal_object
+ *
+ * PARAMETERS:  Obj_desc        - Object to be displayed
+ *              Walk_state      - Current walk state
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Short display of an internal object
+ *
+ ******************************************************************************/
+
+void
+acpi_db_display_internal_object (
+	ACPI_OPERAND_OBJECT     *obj_desc,
+	ACPI_WALK_STATE         *walk_state)
+{
+	u8                      type;
+
+
+	acpi_os_printf ("%p ", obj_desc);
+
+	if (!obj_desc) {
+		acpi_os_printf ("<Null_obj>\n");
+		return;
+	}
+
+
+	/* Decode the object type */
+
+	else if (VALID_DESCRIPTOR_TYPE (obj_desc, ACPI_DESC_TYPE_PARSER)) {
+		acpi_os_printf ("<Parser> ");
+	}
+
+	else if (VALID_DESCRIPTOR_TYPE (obj_desc, ACPI_DESC_TYPE_NAMED)) {
+		acpi_os_printf ("<Node>          Name %4.4s Type-%s",
+				  &((ACPI_NAMESPACE_NODE *)obj_desc)->name,
+				  acpi_ut_get_type_name (((ACPI_NAMESPACE_NODE *) obj_desc)->type));
+		if (((ACPI_NAMESPACE_NODE *) obj_desc)->flags & ANOBJ_METHOD_ARG) {
+			acpi_os_printf (" [Method Arg]");
+		}
+		if (((ACPI_NAMESPACE_NODE *) obj_desc)->flags & ANOBJ_METHOD_LOCAL) {
+			acpi_os_printf (" [Method Local]");
+		}
+	}
+
+	else if (VALID_DESCRIPTOR_TYPE (obj_desc, ACPI_DESC_TYPE_INTERNAL)) {
+		acpi_os_printf ("<Obj> ");
+		type = obj_desc->common.type;
+		if (type > INTERNAL_TYPE_MAX) {
+			acpi_os_printf (" Type %x [Invalid Type]", type);
+			return;
+		}
+
+		/* Decode the ACPI object type */
+
+		switch (obj_desc->common.type) {
+		case INTERNAL_TYPE_REFERENCE:
+			switch (obj_desc->reference.opcode) {
+			case AML_ZERO_OP:
+				acpi_os_printf ("[Const]   Number %.8X", 0);
+				break;
+
+			case AML_ONES_OP:
+				acpi_os_printf ("[Const]   Number %.8X", ACPI_UINT32_MAX);
+				break;
+
+			case AML_ONE_OP:
+				acpi_os_printf ("[Const]   Number %.8X", 1);
+				break;
+
+			case AML_LOCAL_OP:
+				acpi_os_printf ("[Local%d] ", obj_desc->reference.offset);
+				if (walk_state) {
+					obj_desc = walk_state->local_variables[obj_desc->reference.offset].object;
+					acpi_db_decode_internal_object (obj_desc);
+				}
+				break;
+
+			case AML_ARG_OP:
+				acpi_os_printf ("[Arg%d]   ", obj_desc->reference.offset);
+				if (walk_state) {
+					obj_desc = walk_state->arguments[obj_desc->reference.offset].object;
+					acpi_db_decode_internal_object (obj_desc);
+				}
+				break;
+
+			case AML_DEBUG_OP:
+				acpi_os_printf ("[Debug] ");
+				break;
+
+			case AML_INDEX_OP:
+				acpi_os_printf ("[Index]   ");
+				acpi_db_decode_internal_object (obj_desc->reference.object);
+				break;
+
+			default:
+				break;
+
+			}
+			break;
+
+		default:
+			acpi_os_printf ("         ");
+			acpi_db_decode_internal_object (obj_desc);
+			break;
+		}
+	}
+
+	else {
+		acpi_os_printf ("<Not a valid ACPI Object Descriptor> ");
+	}
+
+	acpi_os_printf ("\n");
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_db_display_method_info
+ *
+ * PARAMETERS:  Start_op        - Root of the control method parse tree
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Display information about the current method
+ *
+ ******************************************************************************/
+
+void
+acpi_db_display_method_info (
+	ACPI_PARSE_OBJECT       *start_op)
+{
+	ACPI_WALK_STATE         *walk_state;
+	ACPI_OPERAND_OBJECT     *obj_desc;
+	ACPI_NAMESPACE_NODE     *node;
+	ACPI_PARSE_OBJECT       *root_op;
+	ACPI_PARSE_OBJECT       *op;
+	ACPI_OPCODE_INFO        *op_info;
+	u32                     num_ops = 0;
+	u32                     num_operands = 0;
+	u32                     num_operators = 0;
+	u32                     num_remaining_ops = 0;
+	u32                     num_remaining_operands = 0;
+	u32                     num_remaining_operators = 0;
+	u32                     num_args;
+	u32                     concurrency;
+	u8                      count_remaining = FALSE;
+
+
+	walk_state = acpi_ds_get_current_walk_state (acpi_gbl_current_walk_list);
+	if (!walk_state) {
+		acpi_os_printf ("There is no method currently executing\n");
+		return;
+	}
+
+	obj_desc = walk_state->method_desc;
+	node = walk_state->method_node;
+
+	num_args = obj_desc->method.param_count;
+	concurrency = obj_desc->method.concurrency;
+
+	acpi_os_printf ("Currently executing control method is [%4.4s]\n", &node->name);
+	acpi_os_printf ("%X arguments, max concurrency = %X\n", num_args, concurrency);
+
+
+	root_op = start_op;
+	while (root_op->parent) {
+		root_op = root_op->parent;
+	}
+
+	op = root_op;
+
+	while (op) {
+		if (op == start_op) {
+			count_remaining = TRUE;
+		}
+
+		num_ops++;
+		if (count_remaining) {
+			num_remaining_ops++;
+		}
+
+		op_info = acpi_ps_get_opcode_info (op->opcode);
+		if (ACPI_GET_OP_TYPE (op_info) != ACPI_OP_TYPE_OPCODE) {
+			/* Bad opcode or ASCII character */
+
+			continue;
+		}
+
+
+		/* Decode the opcode */
+
+		switch (ACPI_GET_OP_CLASS (op_info)) {
+		case OPTYPE_CONSTANT:           /* argument type only */
+		case OPTYPE_LITERAL:            /* argument type only */
+		case OPTYPE_DATA_TERM:          /* argument type only */
+		case OPTYPE_LOCAL_VARIABLE:     /* argument type only */
+		case OPTYPE_METHOD_ARGUMENT:    /* argument type only */
+			if (count_remaining) {
+				num_remaining_operands++;
+			}
+
+			num_operands++;
+			break;
+
+		default:
+			if (count_remaining) {
+				num_remaining_operators++;
+			}
+
+			num_operators++;
+			break;
+		}
+
+
+		op = acpi_ps_get_depth_next (start_op, op);
+	}
+
+	acpi_os_printf ("Method contains:     %X AML Opcodes - %X Operators, %X Operands\n",
+			 num_ops, num_operators, num_operands);
+
+	acpi_os_printf ("Remaining to execute: %X AML Opcodes - %X Operators, %X Operands\n",
+			 num_remaining_ops, num_remaining_operators, num_remaining_operands);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_db_display_locals
+ *
+ * PARAMETERS:  None
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Display all locals for the currently running control method
+ *
+ ******************************************************************************/
+
+void
+acpi_db_display_locals (void)
+{
+	u32                     i;
+	ACPI_WALK_STATE         *walk_state;
+	ACPI_OPERAND_OBJECT     *obj_desc;
+	ACPI_NAMESPACE_NODE     *node;
+
+
+	walk_state = acpi_ds_get_current_walk_state (acpi_gbl_current_walk_list);
+	if (!walk_state) {
+		acpi_os_printf ("There is no method currently executing\n");
+		return;
+	}
+
+	obj_desc = walk_state->method_desc;
+	node = walk_state->method_node;
+
+
+	acpi_os_printf ("Local Variables for method [%4.4s]:\n", &node->name);
+
+	for (i = 0; i < MTH_NUM_LOCALS; i++) {
+		obj_desc = walk_state->local_variables[i].object;
+		acpi_os_printf ("Local%d: ", i);
+		acpi_db_display_internal_object (obj_desc, walk_state);
+	}
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_db_display_arguments
+ *
+ * PARAMETERS:  None
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Display all arguments for the currently running control method
+ *
+ ******************************************************************************/
+
+void
+acpi_db_display_arguments (void)
+{
+	u32                     i;
+	ACPI_WALK_STATE         *walk_state;
+	ACPI_OPERAND_OBJECT     *obj_desc;
+	u32                     num_args;
+	u32                     concurrency;
+	ACPI_NAMESPACE_NODE     *node;
+
+
+	walk_state = acpi_ds_get_current_walk_state (acpi_gbl_current_walk_list);
+	if (!walk_state) {
+		acpi_os_printf ("There is no method currently executing\n");
+		return;
+	}
+
+	obj_desc = walk_state->method_desc;
+	node = walk_state->method_node;
+
+	num_args = obj_desc->method.param_count;
+	concurrency = obj_desc->method.concurrency;
+
+	acpi_os_printf ("Method [%4.4s] has %X arguments, max concurrency = %X\n", &node->name, num_args, concurrency);
+
+	for (i = 0; i < num_args; i++) {
+		obj_desc = walk_state->arguments[i].object;
+		acpi_os_printf ("Arg%d: ", i);
+		acpi_db_display_internal_object (obj_desc, walk_state);
+	}
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_db_display_results
+ *
+ * PARAMETERS:  None
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Display current contents of a method result stack
+ *
+ ******************************************************************************/
+
+void
+acpi_db_display_results (void)
+{
+	u32                     i;
+	ACPI_WALK_STATE         *walk_state;
+	ACPI_OPERAND_OBJECT     *obj_desc;
+	u32                     num_results = 0;
+	ACPI_NAMESPACE_NODE     *node;
+
+
+	walk_state = acpi_ds_get_current_walk_state (acpi_gbl_current_walk_list);
+	if (!walk_state) {
+		acpi_os_printf ("There is no method currently executing\n");
+		return;
+	}
+
+	obj_desc = walk_state->method_desc;
+	node = walk_state->method_node;
+
+	if (walk_state->results) {
+		num_results = walk_state->results->results.num_results;
+	}
+
+	acpi_os_printf ("Method [%4.4s] has %X stacked result objects\n", &node->name, num_results);
+
+	for (i = 0; i < num_results; i++) {
+		obj_desc = walk_state->results->results.obj_desc[i];
+		acpi_os_printf ("Result%d: ", i);
+		acpi_db_display_internal_object (obj_desc, walk_state);
+	}
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_db_display_calling_tree
+ *
+ * PARAMETERS:  None
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Display current calling tree of nested control methods
+ *
+ ******************************************************************************/
+
+void
+acpi_db_display_calling_tree (void)
+{
+	u32                     i;
+	ACPI_WALK_STATE         *walk_state;
+	ACPI_NAMESPACE_NODE     *node;
+
+
+	walk_state = acpi_ds_get_current_walk_state (acpi_gbl_current_walk_list);
+	if (!walk_state) {
+		acpi_os_printf ("There is no method currently executing\n");
+		return;
+	}
+
+	node = walk_state->method_node;
+
+	acpi_os_printf ("Current Control Method Call Tree\n");
+
+	for (i = 0; walk_state; i++) {
+		node = walk_state->method_node;
+
+		acpi_os_printf ("  [%4.4s]\n", &node->name);
+
+		walk_state = walk_state->next;
+	}
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_db_display_result_object
+ *
+ * PARAMETERS:  Obj_desc        - Object to be displayed
+ *              Walk_state      - Current walk state
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Display the result of an AML opcode
+ *
+ ******************************************************************************/
+
+void
+acpi_db_display_result_object (
+	ACPI_OPERAND_OBJECT     *obj_desc,
+	ACPI_WALK_STATE         *walk_state)
+{
+
+	/* TBD: [Future] We don't always want to display the result.
+	 * For now, only display if single stepping
+	 * however, this output is very useful in other contexts also
+	 */
+
+	if (!acpi_gbl_cm_single_step) {
+		return;
+	}
+
+	acpi_os_printf ("Result_obj: ");
+	acpi_db_display_internal_object (obj_desc, walk_state);
+	acpi_os_printf ("\n");
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_db_display_argument_object
+ *
+ * PARAMETERS:  Obj_desc        - Object to be displayed
+ *              Walk_state      - Current walk state
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Display the result of an AML opcode
+ *
+ ******************************************************************************/
+
+void
+acpi_db_display_argument_object (
+	ACPI_OPERAND_OBJECT     *obj_desc,
+	ACPI_WALK_STATE         *walk_state)
+{
+
+
+	if (!acpi_gbl_cm_single_step) {
+		return;
+	}
+
+	acpi_os_printf ("Arg_obj: ");
+	acpi_db_display_internal_object (obj_desc, walk_state);
+}
+
+#endif /* ENABLE_DEBUGGER */
+
diff -urN linux-2.4.6-pre4/drivers/acpi/debugger/dbexec.c linux/drivers/acpi/debugger/dbexec.c
--- linux-2.4.6-pre4/drivers/acpi/debugger/dbexec.c	Wed Dec 31 16:00:00 1969
+++ linux/drivers/acpi/debugger/dbexec.c	Mon Dec  3 22:48:41 2001
@@ -0,0 +1,341 @@
+/*******************************************************************************
+ *
+ * Module Name: dbexec - debugger control method execution
+ *              $Revision: 26 $
+ *
+ ******************************************************************************/
+
+/*
+ *  Copyright (C) 2000, 2001 R. Byron Moore
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#include "acpi.h"
+#include "acparser.h"
+#include "acdispat.h"
+#include "amlcode.h"
+#include "acnamesp.h"
+#include "acparser.h"
+#include "acevents.h"
+#include "acinterp.h"
+#include "acdebug.h"
+#include "actables.h"
+
+#ifdef ENABLE_DEBUGGER
+
+#define _COMPONENT          ACPI_DEBUGGER
+	 MODULE_NAME         ("dbexec")
+
+
+DB_METHOD_INFO              info;
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_db_execute_method
+ *
+ * PARAMETERS:  Info            - Valid info segment
+ *              Return_obj      - Where to put return object
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Execute a control method.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_db_execute_method (
+	DB_METHOD_INFO          *info,
+	ACPI_BUFFER             *return_obj)
+{
+	ACPI_STATUS             status;
+	ACPI_OBJECT_LIST        param_objects;
+	ACPI_OBJECT             params[MTH_NUM_ARGS];
+	u32                     i;
+
+
+	if (output_to_file && !acpi_dbg_level) {
+		acpi_os_printf ("Warning: debug output is not enabled!\n");
+	}
+
+	/* Are there arguments to the method? */
+
+	if (info->args && info->args[0]) {
+		for (i = 0; info->args[i] && i < MTH_NUM_ARGS; i++) {
+			params[i].type              = ACPI_TYPE_INTEGER;
+			params[i].integer.value     = STRTOUL (info->args[i], NULL, 16);
+		}
+
+		param_objects.pointer       = params;
+		param_objects.count         = i;
+	}
+
+	else {
+		/* Setup default parameters */
+
+		params[0].type              = ACPI_TYPE_INTEGER;
+		params[0].integer.value     = 0x01020304;
+
+		params[1].type              = ACPI_TYPE_STRING;
+		params[1].string.length     = 12;
+		params[1].string.pointer    = "AML Debugger";
+
+		param_objects.pointer       = params;
+		param_objects.count         = 2;
+	}
+
+	/* Prepare for a return object of arbitrary size */
+
+	return_obj->pointer          = buffer;
+	return_obj->length           = BUFFER_SIZE;
+
+
+	/* Do the actual method execution */
+
+	status = acpi_evaluate_object (NULL, info->pathname, &param_objects, return_obj);
+
+	acpi_gbl_cm_single_step = FALSE;
+	acpi_gbl_method_executing = FALSE;
+
+	return (status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_db_execute_setup
+ *
+ * PARAMETERS:  Info            - Valid method info
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Setup info segment prior to method execution
+ *
+ ******************************************************************************/
+
+void
+acpi_db_execute_setup (
+	DB_METHOD_INFO          *info)
+{
+
+	/* Catenate the current scope to the supplied name */
+
+	info->pathname[0] = 0;
+	if ((info->name[0] != '\\') &&
+		(info->name[0] != '/')) {
+		STRCAT (info->pathname, scope_buf);
+	}
+
+	STRCAT (info->pathname, info->name);
+	acpi_db_prep_namestring (info->pathname);
+
+	acpi_db_set_output_destination (DB_DUPLICATE_OUTPUT);
+	acpi_os_printf ("Executing %s\n", info->pathname);
+
+	if (info->flags & EX_SINGLE_STEP) {
+		acpi_gbl_cm_single_step = TRUE;
+		acpi_db_set_output_destination (DB_CONSOLE_OUTPUT);
+	}
+
+	else {
+		/* No single step, allow redirection to a file */
+
+		acpi_db_set_output_destination (DB_REDIRECTABLE_OUTPUT);
+	}
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_db_execute
+ *
+ * PARAMETERS:  Name                - Name of method to execute
+ *              Args                - Parameters to the method
+ *              Flags               - single step/no single step
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Execute a control method.  Name is relative to the current
+ *              scope.
+ *
+ ******************************************************************************/
+
+void
+acpi_db_execute (
+	NATIVE_CHAR             *name,
+	NATIVE_CHAR             **args,
+	u32                     flags)
+{
+	ACPI_STATUS             status;
+	ACPI_BUFFER             return_obj;
+
+
+	info.name = name;
+	info.args = args;
+	info.flags = flags;
+
+	acpi_db_execute_setup (&info);
+	status = acpi_db_execute_method (&info, &return_obj);
+
+
+	if (ACPI_FAILURE (status)) {
+		acpi_os_printf ("Execution of %s failed with status %s\n",
+			info.pathname, acpi_ut_format_exception (status));
+	}
+
+	else {
+		/* Display a return object, if any */
+
+		if (return_obj.length) {
+			acpi_os_printf ("Execution of %s returned object %p Buflen %X\n",
+				info.pathname, return_obj.pointer, return_obj.length);
+			acpi_db_dump_object (return_obj.pointer, 1);
+		}
+	}
+
+	acpi_db_set_output_destination (DB_CONSOLE_OUTPUT);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_db_method_thread
+ *
+ * PARAMETERS:  Context             - Execution info segment
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Debugger execute thread.  Waits for a command line, then
+ *              simply dispatches it.
+ *
+ ******************************************************************************/
+
+void
+acpi_db_method_thread (
+	void                    *context)
+{
+	ACPI_STATUS             status;
+	DB_METHOD_INFO          *info = context;
+	u32                     i;
+	ACPI_BUFFER             return_obj;
+
+
+	for (i = 0; i < info->num_loops; i++) {
+		status = acpi_db_execute_method (info, &return_obj);
+		if (ACPI_SUCCESS (status)) {
+			if (return_obj.length) {
+				acpi_os_printf ("Execution of %s returned object %p Buflen %X\n",
+					info->pathname, return_obj.pointer, return_obj.length);
+				acpi_db_dump_object (return_obj.pointer, 1);
+			}
+		}
+	}
+
+
+	/* Signal our completion */
+
+	acpi_os_signal_semaphore (info->thread_gate, 1);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_db_create_execution_threads
+ *
+ * PARAMETERS:  Num_threads_arg         - Number of threads to create
+ *              Num_loops_arg           - Loop count for the thread(s)
+ *              Method_name_arg         - Control method to execute
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Create threads to execute method(s)
+ *
+ ******************************************************************************/
+
+void
+acpi_db_create_execution_threads (
+	NATIVE_CHAR             *num_threads_arg,
+	NATIVE_CHAR             *num_loops_arg,
+	NATIVE_CHAR             *method_name_arg)
+{
+	ACPI_STATUS             status;
+	u32                     num_threads;
+	u32                     num_loops;
+	u32                     i;
+	ACPI_HANDLE             thread_gate;
+
+
+	/* Get the arguments */
+
+	num_threads = STRTOUL (num_threads_arg, NULL, 0);
+	num_loops = STRTOUL (num_loops_arg, NULL, 0);
+
+	if (!num_threads || !num_loops) {
+		acpi_os_printf ("Bad argument: Threads %X, Loops %X\n", num_threads, num_loops);
+		return;
+	}
+
+
+	/* Create the synchronization semaphore */
+
+	status = acpi_os_create_semaphore (1, 0, &thread_gate);
+	if (ACPI_FAILURE (status)) {
+		acpi_os_printf ("Could not create semaphore, %s\n", acpi_ut_format_exception (status));
+		return;
+	}
+
+	/* Setup the context to be passed to each thread */
+
+	info.name = method_name_arg;
+	info.args = NULL;
+	info.flags = 0;
+	info.num_loops = num_loops;
+	info.thread_gate = thread_gate;
+
+	acpi_db_execute_setup (&info);
+
+
+	/* Create the threads */
+
+	acpi_os_printf ("Creating %X threads to execute %X times each\n", num_threads, num_loops);
+
+	for (i = 0; i < (num_threads); i++) {
+		acpi_os_queue_for_execution (OSD_PRIORITY_MED, acpi_db_method_thread, &info);
+	}
+
+
+	/* Wait for all threads to complete */
+
+	i = num_threads;
+	while (i)   /* Brain damage for OSD implementations that only support wait of 1 unit */ {
+		status = acpi_os_wait_semaphore (thread_gate, 1, WAIT_FOREVER);
+		i--;
+	}
+
+	/* Cleanup and exit */
+
+	acpi_os_delete_semaphore (thread_gate);
+
+	acpi_db_set_output_destination (DB_DUPLICATE_OUTPUT);
+	acpi_os_printf ("All threads (%X) have completed\n", num_threads);
+	acpi_db_set_output_destination (DB_CONSOLE_OUTPUT);
+}
+
+
+#endif /* ENABLE_DEBUGGER */
+
+
diff -urN linux-2.4.6-pre4/drivers/acpi/debugger/dbfileio.c linux/drivers/acpi/debugger/dbfileio.c
--- linux-2.4.6-pre4/drivers/acpi/debugger/dbfileio.c	Wed Dec 31 16:00:00 1969
+++ linux/drivers/acpi/debugger/dbfileio.c	Mon Dec  3 22:48:41 2001
@@ -0,0 +1,378 @@
+/*******************************************************************************
+ *
+ * Module Name: dbfileio - Debugger file I/O commands.  These can't usually
+ *              be used when running the debugger in Ring 0 (Kernel mode)
+ *              $Revision: 41 $
+ *
+ ******************************************************************************/
+
+/*
+ *  Copyright (C) 2000, 2001 R. Byron Moore
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#include "acpi.h"
+#include "acdebug.h"
+#include "acnamesp.h"
+#include "acparser.h"
+#include "acevents.h"
+#include "actables.h"
+
+#ifdef ENABLE_DEBUGGER
+
+#define _COMPONENT          ACPI_DEBUGGER
+	 MODULE_NAME         ("dbfileio")
+
+
+ACPI_PARSE_OBJECT           *root;
+
+#ifdef ACPI_APPLICATION
+#include <stdio.h>
+FILE                        *debug_file = NULL;
+#endif
+
+
+/*
+ * NOTE: this is here for lack of a better place.  It is used in all
+ *  flavors of the debugger, need LCD file
+ */
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_db_match_argument
+ *
+ * PARAMETERS:  User_argument           - User command line
+ *              Arguments               - Array of commands to match against
+ *
+ * RETURN:      Index into command array or ACPI_TYPE_NOT_FOUND if not found
+ *
+ * DESCRIPTION: Search command array for a command match
+ *
+ ******************************************************************************/
+
+ACPI_OBJECT_TYPE8
+acpi_db_match_argument (
+	NATIVE_CHAR             *user_argument,
+	ARGUMENT_INFO           *arguments)
+{
+	u32                     i;
+
+
+	if (!user_argument || user_argument[0] == 0) {
+		return (ACPI_TYPE_NOT_FOUND);
+	}
+
+	for (i = 0; arguments[i].name; i++) {
+		if (STRSTR (arguments[i].name, user_argument) == arguments[i].name) {
+			return ((ACPI_OBJECT_TYPE8) i);
+		}
+	}
+
+	/* Argument not recognized */
+
+	return (ACPI_TYPE_NOT_FOUND);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_db_close_debug_file
+ *
+ * PARAMETERS:  None
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: If open, close the current debug output file
+ *
+ ******************************************************************************/
+
+void
+acpi_db_close_debug_file (
+	void)
+{
+
+#ifdef ACPI_APPLICATION
+
+	if (debug_file) {
+	   fclose (debug_file);
+	   debug_file = NULL;
+	   output_to_file = FALSE;
+	   acpi_os_printf ("Debug output file %s closed\n", debug_filename);
+	}
+#endif
+
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_db_open_debug_file
+ *
+ * PARAMETERS:  Name                - Filename to open
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Open a file where debug output will be directed.
+ *
+ ******************************************************************************/
+
+void
+acpi_db_open_debug_file (
+	NATIVE_CHAR             *name)
+{
+
+#ifdef ACPI_APPLICATION
+
+	acpi_db_close_debug_file ();
+	debug_file = fopen (name, "w+");
+	if (debug_file) {
+		acpi_os_printf ("Debug output file %s opened\n", name);
+		STRCPY (debug_filename, name);
+		output_to_file = TRUE;
+	}
+	else {
+		acpi_os_printf ("Could not open debug file %s\n", name);
+	}
+
+#endif
+}
+
+
+#ifdef ACPI_APPLICATION
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_db_load_table
+ *
+ * PARAMETERS:  fp              - File that contains table
+ *              Table_ptr       - Return value, buffer with table
+ *              Table_lenght    - Return value, length of table
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Load the DSDT from the file pointer
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_db_load_table(
+	FILE                    *fp,
+	ACPI_TABLE_HEADER       **table_ptr,
+	u32                     *table_length)
+{
+	ACPI_TABLE_HEADER       table_header;
+	u8                      *aml_ptr;
+	u32                     aml_length;
+	u32                     actual;
+	ACPI_STATUS             status;
+
+
+	/* Read the table header */
+
+	if (fread (&table_header, 1, sizeof (table_header), fp) != sizeof (ACPI_TABLE_HEADER)) {
+		acpi_os_printf ("Couldn't read the table header\n");
+		return (AE_BAD_SIGNATURE);
+	}
+
+
+	/* Validate the table header/length */
+
+	status = acpi_tb_validate_table_header (&table_header);
+	if ((ACPI_FAILURE (status)) ||
+		(table_header.length > 524288)) /* 1/2 Mbyte should be enough */ {
+		acpi_os_printf ("Table header is invalid!\n");
+		return (AE_ERROR);
+	}
+
+
+	/* We only support a limited number of table types */
+
+	if (STRNCMP ((char *) table_header.signature, DSDT_SIG, 4) &&
+		STRNCMP ((char *) table_header.signature, PSDT_SIG, 4) &&
+		STRNCMP ((char *) table_header.signature, SSDT_SIG, 4)) {
+		acpi_os_printf ("Table signature is invalid\n");
+		return (AE_ERROR);
+	}
+
+	/* Allocate a buffer for the table */
+
+	*table_length = table_header.length;
+	*table_ptr = (ACPI_TABLE_HEADER *) acpi_ut_allocate ((size_t) *table_length);
+	if (!*table_ptr) {
+		acpi_os_printf ("Could not allocate memory for the table (size=%X)\n", table_header.length);
+		return (AE_NO_MEMORY);
+	}
+
+
+	aml_ptr     = (u8 *) *table_ptr + sizeof (table_header);
+	aml_length  = *table_length - sizeof (table_header);
+
+	/* Copy the header to the buffer */
+
+	MEMCPY (*table_ptr, &table_header, sizeof (table_header));
+
+	/* Get the rest of the table */
+
+	actual = fread (aml_ptr, 1, (size_t) aml_length, fp);
+	if (actual == aml_length) {
+		return (AE_OK);
+	}
+
+	if (actual > 0) {
+		acpi_os_printf ("Warning - reading table, asked for %X got %X\n", aml_length, actual);
+	   return (AE_OK);
+	}
+
+
+	acpi_os_printf ("Error - could not read the table file\n");
+	acpi_ut_free (*table_ptr);
+	*table_ptr = NULL;
+	*table_length = 0;
+
+	return (AE_ERROR);
+}
+#endif
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Ae_local_load_table
+ *
+ * PARAMETERS:  Table_ptr       - pointer to a buffer containing the entire
+ *                                table to be loaded
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: This function is called to load a table from the caller's
+ *              buffer.  The buffer must contain an entire ACPI Table including
+ *              a valid header.  The header fields will be verified, and if it
+ *              is determined that the table is invalid, the call will fail.
+ *
+ *              If the call fails an appropriate status will be returned.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+ae_local_load_table (
+	ACPI_TABLE_HEADER       *table_ptr)
+{
+	ACPI_STATUS             status;
+	ACPI_TABLE_DESC         table_info;
+
+
+	if (!table_ptr) {
+		return (AE_BAD_PARAMETER);
+	}
+
+	/* Install the new table into the local data structures */
+
+	table_info.pointer = table_ptr;
+
+	status = acpi_tb_install_table (NULL, &table_info);
+	if (ACPI_FAILURE (status)) {
+		/* Free table allocated by Acpi_tb_get_table */
+
+		acpi_tb_delete_single_table (&table_info);
+		return (status);
+	}
+
+
+#ifndef PARSER_ONLY
+	status = acpi_ns_load_table (table_info.installed_desc, acpi_gbl_root_node);
+	if (ACPI_FAILURE (status)) {
+		/* Uninstall table and free the buffer */
+
+		acpi_tb_uninstall_table (table_info.installed_desc);
+		return (status);
+	}
+#endif
+
+	return (status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_db_load_acpi_table
+ *
+ * PARAMETERS:  Filname         - File where table is located
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Load an ACPI table from a file
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_db_load_acpi_table (
+	NATIVE_CHAR             *filename)
+{
+#ifdef ACPI_APPLICATION
+	FILE                    *fp;
+	ACPI_STATUS             status;
+	ACPI_TABLE_HEADER       *table_ptr;
+	u32                     table_length;
+
+
+	/* Open the file */
+
+	fp = fopen (filename, "rb");
+	if (!fp) {
+		acpi_os_printf ("Could not open file %s\n", filename);
+		return (AE_ERROR);
+	}
+
+
+	/* Get the entire file */
+
+	acpi_os_printf ("Loading Acpi table from file %s\n", filename);
+	status = acpi_db_load_table (fp, &table_ptr, &table_length);
+	fclose(fp);
+
+	if (ACPI_FAILURE (status)) {
+		acpi_os_printf ("Couldn't get table from the file\n");
+		return (status);
+	}
+
+
+	/* Attempt to recognize and install the table */
+	status = ae_local_load_table (table_ptr);
+
+	if (ACPI_FAILURE (status)) {
+		if (status == AE_EXIST) {
+			acpi_os_printf ("Table %4.4s is already installed\n",
+					  &table_ptr->signature);
+		}
+		else {
+			acpi_os_printf ("Could not install table, %s\n",
+					  acpi_ut_format_exception (status));
+		}
+		acpi_ut_free (table_ptr);
+		return (status);
+	}
+
+	acpi_os_printf ("%4.4s at %p successfully installed and loaded\n",
+			  &table_ptr->signature, table_ptr);
+
+	acpi_gbl_acpi_hardware_present = FALSE;
+
+#endif  /* ACPI_APPLICATION */
+	return (AE_OK);
+}
+
+
+#endif  /* ENABLE_DEBUGGER */
+
diff -urN linux-2.4.6-pre4/drivers/acpi/debugger/dbhistry.c linux/drivers/acpi/debugger/dbhistry.c
--- linux-2.4.6-pre4/drivers/acpi/debugger/dbhistry.c	Wed Dec 31 16:00:00 1969
+++ linux/drivers/acpi/debugger/dbhistry.c	Mon Dec  3 22:48:41 2001
@@ -0,0 +1,199 @@
+/******************************************************************************
+ *
+ * Module Name: dbhistry - debugger HISTORY command
+ *              $Revision: 18 $
+ *
+ *****************************************************************************/
+
+/*
+ *  Copyright (C) 2000, 2001 R. Byron Moore
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#include "acpi.h"
+#include "acparser.h"
+#include "acdispat.h"
+#include "amlcode.h"
+#include "acnamesp.h"
+#include "acparser.h"
+#include "acevents.h"
+#include "acinterp.h"
+#include "acdebug.h"
+#include "actables.h"
+
+#ifdef ENABLE_DEBUGGER
+
+#define _COMPONENT          ACPI_DEBUGGER
+	 MODULE_NAME         ("dbhistry")
+
+
+#define HI_NO_HISTORY       0
+#define HI_RECORD_HISTORY   1
+#define HISTORY_SIZE        20
+
+
+typedef struct history_info
+{
+	NATIVE_CHAR             command[80];
+	u32                     cmd_num;
+
+} HISTORY_INFO;
+
+
+HISTORY_INFO                history_buffer[HISTORY_SIZE];
+u16                         lo_history = 0;
+u16                         num_history = 0;
+u16                         next_history_index = 0;
+u32                         next_cmd_num = 1;
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_db_add_to_history
+ *
+ * PARAMETERS:  Command_line    - Command to add
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Add a command line to the history buffer.
+ *
+ ******************************************************************************/
+
+void
+acpi_db_add_to_history (
+	NATIVE_CHAR             *command_line)
+{
+
+
+	/* Put command into the next available slot */
+
+	STRCPY (history_buffer[next_history_index].command, command_line);
+	history_buffer[next_history_index].cmd_num = next_cmd_num;
+
+	/* Adjust indexes */
+
+	if ((num_history == HISTORY_SIZE) &&
+		(next_history_index == lo_history)) {
+		lo_history++;
+		if (lo_history >= HISTORY_SIZE) {
+			lo_history = 0;
+		}
+	}
+
+	next_history_index++;
+	if (next_history_index >= HISTORY_SIZE) {
+		next_history_index = 0;
+	}
+
+
+	next_cmd_num++;
+	if (num_history < HISTORY_SIZE) {
+		num_history++;
+	}
+
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_db_display_history
+ *
+ * PARAMETERS:  None
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Display the contents of the history buffer
+ *
+ ******************************************************************************/
+
+void
+acpi_db_display_history (void)
+{
+	NATIVE_UINT             i;
+	u16                     history_index;
+
+
+	history_index = lo_history;
+
+	/* Dump entire history buffer */
+
+	for (i = 0; i < num_history; i++) {
+		acpi_os_printf ("%ld %s\n", history_buffer[history_index].cmd_num, history_buffer[history_index].command);
+
+		history_index++;
+		if (history_index >= HISTORY_SIZE) {
+			history_index = 0;
+		}
+	}
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_db_get_from_history
+ *
+ * PARAMETERS:  Command_num_arg         - String containing the number of the
+ *                                        command to be retrieved
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Get a command from the history buffer
+ *
+ ******************************************************************************/
+
+NATIVE_CHAR *
+acpi_db_get_from_history (
+	NATIVE_CHAR             *command_num_arg)
+{
+	NATIVE_UINT             i;
+	u16                     history_index;
+	u32                     cmd_num;
+
+
+	if (command_num_arg == NULL) {
+		cmd_num = next_cmd_num - 1;
+	}
+
+	else {
+		cmd_num = STRTOUL (command_num_arg, NULL, 0);
+	}
+
+
+	/* Search history buffer */
+
+	history_index = lo_history;
+	for (i = 0; i < num_history; i++) {
+		if (history_buffer[history_index].cmd_num == cmd_num) {
+			/* Found the commnad, return it */
+
+			return (history_buffer[history_index].command);
+		}
+
+
+		history_index++;
+		if (history_index >= HISTORY_SIZE) {
+			history_index = 0;
+		}
+	}
+
+	acpi_os_printf ("Invalid history number: %d\n", history_index);
+	return (NULL);
+}
+
+
+#endif /* ENABLE_DEBUGGER */
+
diff -urN linux-2.4.6-pre4/drivers/acpi/debugger/dbinput.c linux/drivers/acpi/debugger/dbinput.c
--- linux-2.4.6-pre4/drivers/acpi/debugger/dbinput.c	Wed Dec 31 16:00:00 1969
+++ linux/drivers/acpi/debugger/dbinput.c	Mon Dec  3 22:48:41 2001
@@ -0,0 +1,909 @@
+/*******************************************************************************
+ *
+ * Module Name: dbinput - user front-end to the AML debugger
+ *              $Revision: 61 $
+ *
+ ******************************************************************************/
+
+/*
+ *  Copyright (C) 2000, 2001 R. Byron Moore
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#include "acpi.h"
+#include "acparser.h"
+#include "actables.h"
+#include "acnamesp.h"
+#include "acinterp.h"
+#include "acdebug.h"
+
+
+#ifdef ENABLE_DEBUGGER
+
+#define _COMPONENT          ACPI_DEBUGGER
+	 MODULE_NAME         ("dbinput")
+
+
+/*
+ * Globals that are specific to the debugger
+ */
+
+NATIVE_CHAR             line_buf[80];
+NATIVE_CHAR             parsed_buf[80];
+NATIVE_CHAR             scope_buf[40];
+NATIVE_CHAR             debug_filename[40];
+NATIVE_CHAR             *args[DB_MAX_ARGS];
+NATIVE_CHAR             *buffer;
+NATIVE_CHAR             *filename = NULL;
+u8                      output_to_file = FALSE;
+
+
+u32                     acpi_gbl_db_debug_level = 0x0FFFFFFF;
+u32                     acpi_gbl_db_console_debug_level = NORMAL_DEFAULT | TRACE_TABLES;
+u8                      acpi_gbl_db_output_flags = DB_CONSOLE_OUTPUT;
+
+
+u8                      opt_tables      = FALSE;
+u8                      opt_disasm      = FALSE;
+u8                      opt_stats       = FALSE;
+u8                      opt_parse_jit   = FALSE;
+u8                      opt_verbose     = TRUE;
+u8                      opt_ini_methods = TRUE;
+
+
+/*
+ * Top-level debugger commands.
+ *
+ * This list of commands must match the string table below it
+ */
+
+enum acpi_ex_debugger_commands
+{
+	CMD_NOT_FOUND = 0,
+	CMD_NULL,
+	CMD_ALLOCATIONS,
+	CMD_ARGS,
+	CMD_ARGUMENTS,
+	CMD_BREAKPOINT,
+	CMD_CALL,
+	CMD_CLOSE,
+	CMD_DEBUG,
+	CMD_DUMP,
+	CMD_ENABLEACPI,
+	CMD_EVENT,
+	CMD_EXECUTE,
+	CMD_EXIT,
+	CMD_FIND,
+	CMD_GO,
+	CMD_HELP,
+	CMD_HELP2,
+	CMD_HISTORY,
+	CMD_HISTORY_EXE,
+	CMD_HISTORY_LAST,
+	CMD_INFORMATION,
+	CMD_INTO,
+	CMD_LEVEL,
+	CMD_LIST,
+	CMD_LOAD,
+	CMD_LOCALS,
+	CMD_LOCKS,
+	CMD_METHODS,
+	CMD_NAMESPACE,
+	CMD_NOTIFY,
+	CMD_OBJECT,
+	CMD_OPEN,
+	CMD_OWNER,
+	CMD_PREFIX,
+	CMD_QUIT,
+	CMD_REFERENCES,
+	CMD_RESOURCES,
+	CMD_RESULTS,
+	CMD_SET,
+	CMD_STATS,
+	CMD_STOP,
+	CMD_TABLES,
+	CMD_TERMINATE,
+	CMD_THREADS,
+	CMD_TREE,
+	CMD_UNLOAD
+};
+
+#define CMD_FIRST_VALID     2
+
+
+COMMAND_INFO                commands[] =
+{ {"<NOT FOUND>",  0},
+	{"<NULL>",       0},
+	{"ALLOCATIONS",  0},
+	{"ARGS",         0},
+	{"ARGUMENTS",    0},
+	{"BREAKPOINT",   1},
+	{"CALL",         0},
+	{"CLOSE",        0},
+	{"DEBUG",        1},
+	{"DUMP",         1},
+	{"ENABLEACPI",   0},
+	{"EVENT",        1},
+	{"EXECUTE",      1},
+	{"EXIT",         0},
+	{"FIND",         1},
+	{"GO",           0},
+	{"HELP",         0},
+	{"?",            0},
+	{"HISTORY",      0},
+	{"!",            1},
+	{"!!",           0},
+	{"INFORMATION",  0},
+	{"INTO",         0},
+	{"LEVEL",        0},
+	{"LIST",         0},
+	{"LOAD",         1},
+	{"LOCALS",       0},
+	{"LOCKS",        0},
+	{"METHODS",      0},
+	{"NAMESPACE",    0},
+	{"NOTIFY",       2},
+	{"OBJECT",       1},
+	{"OPEN",         1},
+	{"OWNER",        1},
+	{"PREFIX",       0},
+	{"QUIT",         0},
+	{"REFERENCES",   1},
+	{"RESOURCES",    1},
+	{"RESULTS",      0},
+	{"SET",          3},
+	{"STATS",        0},
+	{"STOP",         0},
+	{"TABLES",       0},
+	{"TERMINATE",    0},
+	{"THREADS",      3},
+	{"TREE",         0},
+	{"UNLOAD",       0},
+	{NULL,           0}
+};
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_db_display_help
+ *
+ * PARAMETERS:  Help_type       - Subcommand (optional)
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Print a usage message.
+ *
+ ******************************************************************************/
+
+void
+acpi_db_display_help (
+	NATIVE_CHAR             *help_type)
+{
+
+
+	/* No parameter, just give the overview */
+
+	if (!help_type)
+	{
+		acpi_os_printf ("ACPI CA Debugger Commands\n\n");
+		acpi_os_printf ("The following classes of commands are available. Help is available for\n");
+		acpi_os_printf ("each class by entering \"help <class_name>\"\n\n");
+		acpi_os_printf ("  [GENERAL]       General-Purpose Commands\n");
+		acpi_os_printf ("  [NAMESPACE]     Namespace Access Commands\n");
+		acpi_os_printf ("  [METHOD]        Control Method Execution Commands\n");
+		acpi_os_printf ("  [FILE]          File I/O Commands\n");
+		return;
+
+	}
+
+
+	/*
+	 * Parameter is the command class
+	 *
+	 * The idea here is to keep each class of commands smaller than a screenful
+	 */
+
+	switch (help_type[0])
+	{
+	case 'G':
+		acpi_os_printf ("\n_general-Purpose Commands\n\n");
+		acpi_os_printf ("Allocations                       Display list of current memory allocations\n");
+		acpi_os_printf ("Dump <Address>|<Namepath>\n");
+		acpi_os_printf ("   [Byte|Word|Dword|Qword]        Display ACPI objects or memory\n");
+		acpi_os_printf ("Enable_acpi                       Enable ACPI (hardware) mode\n");
+		acpi_os_printf ("Help                              This help screen\n");
+		acpi_os_printf ("History                           Display command history buffer\n");
+		acpi_os_printf ("Level [<Debug_level>] [console]   Get/Set debug level for file or console\n");
+		acpi_os_printf ("Locks                             Current status of internal mutexes\n");
+		acpi_os_printf ("Quit or Exit                      Exit this command\n");
+		acpi_os_printf ("Stats [Allocations|Memory|Misc\n");
+		acpi_os_printf ("     |Objects|Tables]             Display namespace and memory statistics\n");
+		acpi_os_printf ("Tables                            Display info about loaded ACPI tables\n");
+		acpi_os_printf ("Unload                            Unload an ACPI table\n");
+		acpi_os_printf ("! <Command_number>                Execute command from history buffer\n");
+		acpi_os_printf ("!!                                Execute last command again\n");
+		return;
+
+	case 'N':
+		acpi_os_printf ("\n_namespace Access Commands\n\n");
+		acpi_os_printf ("Debug <Namepath> [Arguments]      Single Step a control method\n");
+		acpi_os_printf ("Event <F|G> <Value>               Generate Acpi_event (Fixed/GPE)\n");
+		acpi_os_printf ("Execute <Namepath> [Arguments]    Execute control method\n");
+		acpi_os_printf ("Find <Name> (? is wildcard)       Find ACPI name(s) with wildcards\n");
+		acpi_os_printf ("Method                            Display list of loaded control methods\n");
+		acpi_os_printf ("Namespace [<Addr>|<Path>] [Depth] Display loaded namespace tree/subtree\n");
+		acpi_os_printf ("Notify <Name_path> <Value>        Send a notification\n");
+		acpi_os_printf ("Objects <Object_type>             Display all objects of the given type\n");
+		acpi_os_printf ("Owner <Owner_id> [Depth]          Display loaded namespace by object owner\n");
+		acpi_os_printf ("Prefix [<Name_path>]              Set or Get current execution prefix\n");
+		acpi_os_printf ("References <Addr>                 Find all references to object at addr\n");
+		acpi_os_printf ("Resources xxx                     Get and display resources\n");
+		acpi_os_printf ("Terminate                         Delete namespace and all internal objects\n");
+		acpi_os_printf ("Thread <Threads><Loops><Name_path> Spawn threads to execute method(s)\n");
+		return;
+
+	case 'M':
+		acpi_os_printf ("\n_control Method Execution Commands\n\n");
+		acpi_os_printf ("Arguments (or Args)               Display method arguments\n");
+		acpi_os_printf ("Breakpoint <Aml_offset>           Set an AML execution breakpoint\n");
+		acpi_os_printf ("Call                              Run to next control method invocation\n");
+		acpi_os_printf ("Go                                Allow method to run to completion\n");
+		acpi_os_printf ("Information                       Display info about the current method\n");
+		acpi_os_printf ("Into                              Step into (not over) a method call\n");
+		acpi_os_printf ("List [# of Aml Opcodes]           Display method ASL statements\n");
+		acpi_os_printf ("Locals                            Display method local variables\n");
+		acpi_os_printf ("Results                           Display method result stack\n");
+		acpi_os_printf ("Set <A|L> <#> <Value>             Set method data (Arguments/Locals)\n");
+		acpi_os_printf ("Stop                              Terminate control method\n");
+		acpi_os_printf ("Tree                              Display control method calling tree\n");
+		acpi_os_printf ("<Enter>                           Single step next AML opcode (over calls)\n");
+		return;
+
+	case 'F':
+		acpi_os_printf ("\n_file I/O Commands\n\n");
+		acpi_os_printf ("Close                             Close debug output file\n");
+		acpi_os_printf ("Open <Output Filename>            Open a file for debug output\n");
+		acpi_os_printf ("Load <Input Filename>             Load ACPI table from a file\n");
+		return;
+
+	default:
+		acpi_os_printf ("Unrecognized Command Class: %x\n", help_type);
+		return;
+	}
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_db_get_next_token
+ *
+ * PARAMETERS:  String          - Command buffer
+ *              Next            - Return value, end of next token
+ *
+ * RETURN:      Pointer to the start of the next token.
+ *
+ * DESCRIPTION: Command line parsing.  Get the next token on the command line
+ *
+ ******************************************************************************/
+
+NATIVE_CHAR *
+acpi_db_get_next_token (
+	NATIVE_CHAR             *string,
+	NATIVE_CHAR             **next)
+{
+	NATIVE_CHAR             *start;
+
+	/* At end of buffer? */
+
+	if (!string || !(*string))
+	{
+		return (NULL);
+	}
+
+
+	/* Get rid of any spaces at the beginning */
+
+	if (*string == ' ')
+	{
+		while (*string && (*string == ' '))
+		{
+			string++;
+		}
+
+		if (!(*string))
+		{
+			return (NULL);
+		}
+	}
+
+	start = string;
+
+	/* Find end of token */
+
+	while (*string && (*string != ' '))
+	{
+		string++;
+	}
+
+
+	if (!(*string))
+	{
+		*next = NULL;
+	}
+
+	else
+	{
+		*string = 0;
+		*next = string + 1;
+	}
+
+	return (start);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_db_get_line
+ *
+ * PARAMETERS:  Input_buffer        - Command line buffer
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Get the next command line from the user.  Gets entire line
+ *              up to the next newline
+ *
+ ******************************************************************************/
+
+u32
+acpi_db_get_line (
+	NATIVE_CHAR             *input_buffer)
+{
+	u32                     i;
+	u32                     count;
+	NATIVE_CHAR             *next;
+	NATIVE_CHAR             *this;
+
+
+	STRCPY (parsed_buf, input_buffer);
+	STRUPR (parsed_buf);
+
+	this = parsed_buf;
+	for (i = 0; i < DB_MAX_ARGS; i++)
+	{
+		args[i] = acpi_db_get_next_token (this, &next);
+		if (!args[i])
+		{
+			break;
+		}
+
+		this = next;
+	}
+
+
+	/* Uppercase the actual command */
+
+	if (args[0])
+	{
+		STRUPR (args[0]);
+	}
+
+	count = i;
+	if (count)
+	{
+		count--;  /* Number of args only */
+	}
+
+	return (count);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_db_match_command
+ *
+ * PARAMETERS:  User_command            - User command line
+ *
+ * RETURN:      Index into command array, -1 if not found
+ *
+ * DESCRIPTION: Search command array for a command match
+ *
+ ******************************************************************************/
+
+u32
+acpi_db_match_command (
+	NATIVE_CHAR             *user_command)
+{
+	u32                     i;
+
+
+	if (!user_command || user_command[0] == 0)
+	{
+		return (CMD_NULL);
+	}
+
+	for (i = CMD_FIRST_VALID; commands[i].name; i++)
+	{
+		if (STRSTR (commands[i].name, user_command) == commands[i].name)
+		{
+			return (i);
+		}
+	}
+
+	/* Command not recognized */
+
+	return (CMD_NOT_FOUND);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_db_command_dispatch
+ *
+ * PARAMETERS:  Input_buffer        - Command line buffer
+ *              Walk_state          - Current walk
+ *              Op                  - Current (executing) parse op
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Command dispatcher.  Called from two places:
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_db_command_dispatch (
+	NATIVE_CHAR             *input_buffer,
+	ACPI_WALK_STATE         *walk_state,
+	ACPI_PARSE_OBJECT       *op)
+{
+	u32                     temp;
+	u32                     command_index;
+	u32                     param_count;
+	NATIVE_CHAR             *command_line;
+	ACPI_STATUS             status = AE_CTRL_TRUE;
+
+
+	/* If Acpi_terminate has been called, terminate this thread */
+
+	if (acpi_gbl_db_terminate_threads)
+	{
+		return (AE_CTRL_TERMINATE);
+	}
+
+	param_count = acpi_db_get_line (input_buffer);
+	command_index = acpi_db_match_command (args[0]);
+	temp = 0;
+
+	/* Verify that we have the minimum number of params */
+
+	if (param_count < commands[command_index].min_args)
+	{
+		acpi_os_printf ("%d parameters entered, [%s] requires %d parameters\n",
+				  param_count, commands[command_index].name, commands[command_index].min_args);
+		return (AE_CTRL_TRUE);
+	}
+
+	/* Decode and dispatch the command */
+
+	switch (command_index)
+	{
+	case CMD_NULL:
+		if (op)
+		{
+			return (AE_OK);
+		}
+		break;
+
+	case CMD_ALLOCATIONS:
+		acpi_ut_dump_current_allocations ((u32) -1, NULL);
+		break;
+
+	case CMD_ARGS:
+	case CMD_ARGUMENTS:
+		acpi_db_display_arguments ();
+		break;
+
+	case CMD_BREAKPOINT:
+		acpi_db_set_method_breakpoint (args[1], walk_state, op);
+		break;
+
+	case CMD_CALL:
+		acpi_db_set_method_call_breakpoint (op);
+		status = AE_OK;
+		break;
+
+	case CMD_CLOSE:
+		acpi_db_close_debug_file ();
+		break;
+
+	case CMD_DEBUG:
+		acpi_db_execute (args[1], &args[2], EX_SINGLE_STEP);
+		break;
+
+	case CMD_DUMP:
+		acpi_db_decode_and_display_object (args[1], args[2]);
+		break;
+
+	case CMD_ENABLEACPI:
+		status = acpi_enable();
+		if (ACPI_FAILURE(status))
+		{
+			acpi_os_printf("Acpi_enable failed (Status=%X)\n", status);
+			return (status);
+		}
+		break;
+
+	case CMD_EVENT:
+		acpi_os_printf ("Event command not implemented\n");
+		break;
+
+	case CMD_EXECUTE:
+		acpi_db_execute (args[1], &args[2], EX_NO_SINGLE_STEP);
+		break;
+
+	case CMD_FIND:
+		acpi_db_find_name_in_namespace (args[1]);
+		break;
+
+	case CMD_GO:
+		acpi_gbl_cm_single_step = FALSE;
+		return (AE_OK);
+
+	case CMD_HELP:
+	case CMD_HELP2:
+		acpi_db_display_help (args[1]);
+		break;
+
+	case CMD_HISTORY:
+		acpi_db_display_history ();
+		break;
+
+	case CMD_HISTORY_EXE:
+		command_line = acpi_db_get_from_history (args[1]);
+		if (!command_line)
+		{
+			return (AE_CTRL_TRUE);
+		}
+
+		status = acpi_db_command_dispatch (command_line, walk_state, op);
+		if (ACPI_SUCCESS (status))
+		{
+			status = AE_CTRL_TRUE;
+		}
+		return (status);
+		break;
+
+	case CMD_HISTORY_LAST:
+		command_line = acpi_db_get_from_history (NULL);
+		if (!command_line)
+		{
+			return (AE_CTRL_TRUE);
+		}
+
+		status = acpi_db_command_dispatch (command_line, walk_state, op);
+		if (ACPI_SUCCESS (status))
+		{
+			status = AE_CTRL_TRUE;
+		}
+		return (status);
+
+	case CMD_INFORMATION:
+		acpi_db_display_method_info (op);
+		break;
+
+	case CMD_INTO:
+		if (op)
+		{
+			acpi_gbl_cm_single_step = TRUE;
+
+/* TBD: Must get current walk state */
+			/* Acpi_gbl_Method_breakpoint = 0; */
+			return (AE_OK);
+		}
+		break;
+
+	case CMD_LEVEL:
+		if (param_count == 0)
+		{
+			acpi_os_printf ("Current debug level for file output is:  %8.8lX\n", acpi_gbl_db_debug_level);
+			acpi_os_printf ("Current debug level for console output is: %8.8lX\n", acpi_gbl_db_console_debug_level);
+		}
+		else if (param_count == 2)
+		{
+			temp = acpi_gbl_db_console_debug_level;
+			acpi_gbl_db_console_debug_level = STRTOUL (args[1], NULL, 16);
+			acpi_os_printf ("Debug Level for console output was %8.8lX, now %8.8lX\n", temp, acpi_gbl_db_console_debug_level);
+		}
+		else
+		{
+			temp = acpi_gbl_db_debug_level;
+			acpi_gbl_db_debug_level = STRTOUL (args[1], NULL, 16);
+			acpi_os_printf ("Debug Level for file output was %8.8lX, now %8.8lX\n", temp, acpi_gbl_db_debug_level);
+		}
+		break;
+
+	case CMD_LIST:
+		acpi_db_disassemble_aml (args[1], op);
+		break;
+
+	case CMD_LOAD:
+		status = acpi_db_load_acpi_table (args[1]);
+		if (ACPI_FAILURE (status))
+		{
+			return (status);
+		}
+		break;
+
+	case CMD_LOCKS:
+		acpi_db_display_locks ();
+		break;
+
+	case CMD_LOCALS:
+		acpi_db_display_locals ();
+		break;
+
+	case CMD_METHODS:
+		acpi_db_display_objects ("METHOD", args[1]);
+		break;
+
+	case CMD_NAMESPACE:
+		acpi_db_dump_namespace (args[1], args[2]);
+		break;
+
+	case CMD_NOTIFY:
+		temp = STRTOUL (args[2], NULL, 0);
+		acpi_db_send_notify (args[1], temp);
+		break;
+
+	case CMD_OBJECT:
+		acpi_db_display_objects (STRUPR (args[1]), args[2]);
+		break;
+
+	case CMD_OPEN:
+		acpi_db_open_debug_file (args[1]);
+		break;
+
+	case CMD_OWNER:
+		acpi_db_dump_namespace_by_owner (args[1], args[2]);
+		break;
+
+	case CMD_PREFIX:
+		acpi_db_set_scope (args[1]);
+		break;
+
+	case CMD_REFERENCES:
+		acpi_db_find_references (args[1]);
+		break;
+
+	case CMD_RESOURCES:
+		acpi_db_display_resources (args[1]);
+		break;
+
+	case CMD_RESULTS:
+		acpi_db_display_results ();
+		break;
+
+	case CMD_SET:
+		acpi_db_set_method_data (args[1], args[2], args[3]);
+		break;
+
+	case CMD_STATS:
+		acpi_db_display_statistics (args[1]);
+		break;
+
+	case CMD_STOP:
+		return (AE_AML_ERROR);
+		break;
+
+	case CMD_TABLES:
+		acpi_db_display_table_info (args[1]);
+		break;
+
+	case CMD_TERMINATE:
+		acpi_db_set_output_destination (DB_REDIRECTABLE_OUTPUT);
+		acpi_ut_subsystem_shutdown ();
+
+		/* TBD: [Restructure] Need some way to re-initialize without re-creating the semaphores! */
+
+		/*  Acpi_initialize (NULL); */
+		break;
+
+	case CMD_THREADS:
+		acpi_db_create_execution_threads (args[1], args[2], args[3]);
+		break;
+
+	case CMD_TREE:
+		acpi_db_display_calling_tree ();
+		break;
+
+	case CMD_UNLOAD:
+		acpi_db_unload_acpi_table (args[1], args[2]);
+		break;
+
+	case CMD_EXIT:
+	case CMD_QUIT:
+		if (op)
+		{
+			acpi_os_printf ("Method execution terminated\n");
+			return (AE_CTRL_TERMINATE);
+		}
+
+		if (!output_to_file)
+		{
+			acpi_dbg_level = DEBUG_DEFAULT;
+		}
+
+		/* Shutdown */
+
+		/* Acpi_ut_subsystem_shutdown (); */
+		acpi_db_close_debug_file ();
+
+		acpi_gbl_db_terminate_threads = TRUE;
+
+		return (AE_CTRL_TERMINATE);
+
+	case CMD_NOT_FOUND:
+		acpi_os_printf ("Unknown Command\n");
+		return (AE_CTRL_TRUE);
+	}
+
+
+	/* Add all commands that come here to the history buffer */
+
+	acpi_db_add_to_history (input_buffer);
+	return (status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_db_execute_thread
+ *
+ * PARAMETERS:  Context         - Not used
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Debugger execute thread.  Waits for a command line, then
+ *              simply dispatches it.
+ *
+ ******************************************************************************/
+
+void
+acpi_db_execute_thread (
+	void                    *context)
+{
+	ACPI_STATUS             status = AE_OK;
+
+
+	while (status != AE_CTRL_TERMINATE)
+	{
+		acpi_gbl_method_executing = FALSE;
+		acpi_gbl_step_to_next_call = FALSE;
+
+		acpi_ut_acquire_mutex (ACPI_MTX_DEBUG_CMD_READY);
+		status = acpi_db_command_dispatch (line_buf, NULL, NULL);
+		acpi_ut_release_mutex (ACPI_MTX_DEBUG_CMD_COMPLETE);
+	}
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_db_single_thread
+ *
+ * PARAMETERS:  None
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Debugger execute thread.  Waits for a command line, then
+ *              simply dispatches it.
+ *
+ ******************************************************************************/
+
+void
+acpi_db_single_thread (
+	void)
+{
+	ACPI_STATUS             status = AE_OK;
+
+
+	acpi_gbl_method_executing = FALSE;
+	acpi_gbl_step_to_next_call = FALSE;
+
+	status = acpi_db_command_dispatch (line_buf, NULL, NULL);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_db_user_commands
+ *
+ * PARAMETERS:  Prompt              - User prompt (depends on mode)
+ *              Op                  - Current executing parse op
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Command line execution for the AML debugger.  Commands are
+ *              matched and dispatched here.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_db_user_commands (
+	NATIVE_CHAR             prompt,
+	ACPI_PARSE_OBJECT       *op)
+{
+	ACPI_STATUS             status = AE_OK;
+
+
+	/* TBD: [Restructure] Need a separate command line buffer for step mode */
+
+	while (!acpi_gbl_db_terminate_threads)
+	{
+		/* Force output to console until a command is entered */
+
+		acpi_db_set_output_destination (DB_CONSOLE_OUTPUT);
+
+		/* Different prompt if method is executing */
+
+		if (!acpi_gbl_method_executing)
+		{
+			acpi_os_printf ("%1c ", DB_COMMAND_PROMPT);
+		}
+		else
+		{
+			acpi_os_printf ("%1c ", DB_EXECUTE_PROMPT);
+		}
+
+		/* Get the user input line */
+
+		acpi_os_get_line (line_buf);
+
+
+		/* Check for single or multithreaded debug */
+
+		if (acpi_gbl_debugger_configuration & DEBUGGER_MULTI_THREADED)
+		{
+			/*
+			 * Signal the debug thread that we have a command to execute,
+			 * and wait for the command to complete.
+			 */
+
+			acpi_ut_release_mutex (ACPI_MTX_DEBUG_CMD_READY);
+			acpi_ut_acquire_mutex (ACPI_MTX_DEBUG_CMD_COMPLETE);
+		}
+
+		else
+		{
+			/* Just call to the command line interpreter */
+
+			acpi_db_single_thread ();
+		}
+	}
+
+
+	/*
+	 * Only this thread (the original thread) should actually terminate the subsystem,
+	 * because all the semaphores are deleted during termination
+	 */
+	acpi_terminate ();
+
+	return (status);
+}
+
+
+#endif  /* ENABLE_DEBUGGER */
+
diff -urN linux-2.4.6-pre4/drivers/acpi/debugger/dbstats.c linux/drivers/acpi/debugger/dbstats.c
--- linux-2.4.6-pre4/drivers/acpi/debugger/dbstats.c	Wed Dec 31 16:00:00 1969
+++ linux/drivers/acpi/debugger/dbstats.c	Mon Dec  3 22:48:41 2001
@@ -0,0 +1,456 @@
+/*******************************************************************************
+ *
+ * Module Name: dbstats - Generation and display of ACPI table statistics
+ *              $Revision: 40 $
+ *
+ ******************************************************************************/
+
+/*
+ *  Copyright (C) 2000, 2001 R. Byron Moore
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#include <acpi.h>
+#include <acdebug.h>
+#include <amlcode.h>
+#include <acparser.h>
+#include <acnamesp.h>
+
+#ifdef ENABLE_DEBUGGER
+
+#define _COMPONENT          ACPI_DEBUGGER
+	 MODULE_NAME         ("dbstats")
+
+/*
+ * Statistics subcommands
+ */
+ARGUMENT_INFO               acpi_db_stat_types [] =
+{ {"ALLOCATIONS"},
+	{"OBJECTS"},
+	{"MEMORY"},
+	{"MISC"},
+	{"TABLES"},
+	{"SIZES"},
+	{NULL}           /* Must be null terminated */
+};
+
+#define CMD_ALLOCATIONS     0
+#define CMD_OBJECTS         1
+#define CMD_MEMORY          2
+#define CMD_MISC            3
+#define CMD_TABLES          4
+#define CMD_SIZES           5
+
+
+/*
+ * Statistic globals
+ */
+u16                         acpi_gbl_obj_type_count[INTERNAL_TYPE_NODE_MAX+1];
+u16                         acpi_gbl_node_type_count[INTERNAL_TYPE_NODE_MAX+1];
+u16                         acpi_gbl_obj_type_count_misc;
+u16                         acpi_gbl_node_type_count_misc;
+u32                         num_nodes;
+u32                         num_objects;
+
+
+u32                         size_of_parse_tree;
+u32                         size_of_method_trees;
+u32                         size_of_node_entries;
+u32                         size_of_acpi_objects;
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_db_enumerate_object
+ *
+ * PARAMETERS:  Obj_desc            - Object to be counted
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Add this object to the global counts, by object type.
+ *              Recursively handles subobjects and packages.
+ *
+ *              [TBD] Restructure - remove recursion.
+ *
+ ******************************************************************************/
+
+void
+acpi_db_enumerate_object (
+	ACPI_OPERAND_OBJECT     *obj_desc)
+{
+	u32                     type;
+	u32                     i;
+
+
+	if (!obj_desc)
+	{
+		return;
+	}
+
+
+	/* Enumerate this object first */
+
+	num_objects++;
+
+	type = obj_desc->common.type;
+	if (type > INTERNAL_TYPE_NODE_MAX)
+	{
+		acpi_gbl_obj_type_count_misc++;
+	}
+	else
+	{
+		acpi_gbl_obj_type_count [type]++;
+	}
+
+	/* Count the sub-objects */
+
+	switch (type)
+	{
+	case ACPI_TYPE_PACKAGE:
+		for (i = 0; i< obj_desc->package.count; i++)
+		{
+			acpi_db_enumerate_object (obj_desc->package.elements[i]);
+		}
+		break;
+
+	case ACPI_TYPE_DEVICE:
+		acpi_db_enumerate_object (obj_desc->device.sys_handler);
+		acpi_db_enumerate_object (obj_desc->device.drv_handler);
+		acpi_db_enumerate_object (obj_desc->device.addr_handler);
+		break;
+
+	case ACPI_TYPE_REGION:
+		acpi_db_enumerate_object (obj_desc->region.addr_handler);
+		break;
+
+	case ACPI_TYPE_POWER:
+		acpi_db_enumerate_object (obj_desc->power_resource.sys_handler);
+		acpi_db_enumerate_object (obj_desc->power_resource.drv_handler);
+		break;
+
+	case ACPI_TYPE_PROCESSOR:
+		acpi_db_enumerate_object (obj_desc->processor.sys_handler);
+		acpi_db_enumerate_object (obj_desc->processor.drv_handler);
+		acpi_db_enumerate_object (obj_desc->processor.addr_handler);
+		break;
+
+	case ACPI_TYPE_THERMAL:
+		acpi_db_enumerate_object (obj_desc->thermal_zone.sys_handler);
+		acpi_db_enumerate_object (obj_desc->thermal_zone.drv_handler);
+		acpi_db_enumerate_object (obj_desc->thermal_zone.addr_handler);
+		break;
+	}
+}
+
+
+#ifndef PARSER_ONLY
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_db_classify_one_object
+ *
+ * PARAMETERS:  Callback for Walk_namespace
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Enumerate both the object descriptor (including subobjects) and
+ *              the parent namespace node.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_db_classify_one_object (
+	ACPI_HANDLE             obj_handle,
+	u32                     nesting_level,
+	void                    *context,
+	void                    **return_value)
+{
+	ACPI_NAMESPACE_NODE     *node;
+	ACPI_OPERAND_OBJECT     *obj_desc;
+	u32                     type;
+
+
+	num_nodes++;
+
+	node = (ACPI_NAMESPACE_NODE *) obj_handle;
+	obj_desc = ((ACPI_NAMESPACE_NODE *) obj_handle)->object;
+
+	acpi_db_enumerate_object (obj_desc);
+
+	type = node->type;
+	if (type > INTERNAL_TYPE_INVALID)
+	{
+		acpi_gbl_node_type_count_misc++;
+	}
+
+	else
+	{
+		acpi_gbl_node_type_count [type]++;
+	}
+
+	return AE_OK;
+
+
+	/* TBD: These need to be counted during the initial parsing phase */
+	/*
+	if (Acpi_ps_is_named_op (Op->Opcode))
+	{
+		Num_nodes++;
+	}
+
+	if (Is_method)
+	{
+		Num_method_elements++;
+	}
+
+	Num_grammar_elements++;
+	Op = Acpi_ps_get_depth_next (Root, Op);
+
+	Size_of_parse_tree          = (Num_grammar_elements - Num_method_elements) * (u32) sizeof (ACPI_PARSE_OBJECT);
+	Size_of_method_trees        = Num_method_elements * (u32) sizeof (ACPI_PARSE_OBJECT);
+	Size_of_node_entries        = Num_nodes * (u32) sizeof (ACPI_NAMESPACE_NODE);
+	Size_of_acpi_objects        = Num_nodes * (u32) sizeof (ACPI_OPERAND_OBJECT);
+
+	*/
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_db_count_namespace_objects
+ *
+ * PARAMETERS:  None
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Count and classify the entire namespace, including all
+ *              namespace nodes and attached objects.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_db_count_namespace_objects (
+	void)
+{
+	u32                     i;
+
+
+	num_nodes = 0;
+	num_objects = 0;
+
+	acpi_gbl_obj_type_count_misc = 0;
+	for (i = 0; i < INTERNAL_TYPE_INVALID; i++)
+	{
+		acpi_gbl_obj_type_count [i] = 0;
+		acpi_gbl_node_type_count [i] = 0;
+	}
+
+	acpi_ns_walk_namespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
+			   FALSE, acpi_db_classify_one_object, NULL, NULL);
+
+	return (AE_OK);
+}
+
+#endif
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_db_display_statistics
+ *
+ * PARAMETERS:  Type_arg        - Subcommand
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Display various statistics
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_db_display_statistics (
+	NATIVE_CHAR             *type_arg)
+{
+	u32                     i;
+	u32                     type;
+
+
+	if (!acpi_gbl_DSDT)
+	{
+		acpi_os_printf ("*** Warning: There is no DSDT loaded\n");
+	}
+
+	if (!type_arg)
+	{
+		acpi_os_printf ("The following subcommands are available:\n  ALLOCATIONS, OBJECTS, MEMORY, MISC, SIZES, TABLES\n");
+		return (AE_OK);
+	}
+
+	STRUPR (type_arg);
+	type = acpi_db_match_argument (type_arg, acpi_db_stat_types);
+	if (type == (u32) -1)
+	{
+		acpi_os_printf ("Invalid or unsupported argument\n");
+		return (AE_OK);
+	}
+
+#ifndef PARSER_ONLY
+
+	acpi_db_count_namespace_objects ();
+#endif
+
+
+	switch (type)
+	{
+#ifndef PARSER_ONLY
+	case CMD_ALLOCATIONS:
+		acpi_ut_dump_allocation_info ();
+		break;
+#endif
+
+	case CMD_TABLES:
+
+		acpi_os_printf ("ACPI Table Information:\n\n");
+		if (acpi_gbl_DSDT)
+		{
+			acpi_os_printf ("DSDT Length:................% 7ld (%X)\n", acpi_gbl_DSDT->length, acpi_gbl_DSDT->length);
+		}
+		break;
+
+	case CMD_OBJECTS:
+
+		acpi_os_printf ("\n_objects defined in the current namespace:\n\n");
+
+		acpi_os_printf ("%16.16s % 10.10s % 10.10s\n", "ACPI_TYPE", "NODES", "OBJECTS");
+
+		for (i = 0; i < INTERNAL_TYPE_NODE_MAX; i++)
+		{
+			acpi_os_printf ("%16.16s % 10ld% 10ld\n", acpi_ut_get_type_name (i),
+				acpi_gbl_node_type_count [i], acpi_gbl_obj_type_count [i]);
+		}
+		acpi_os_printf ("%16.16s % 10ld% 10ld\n", "Misc/Unknown",
+			acpi_gbl_node_type_count_misc, acpi_gbl_obj_type_count_misc);
+
+		acpi_os_printf ("%16.16s % 10ld% 10ld\n", "TOTALS:",
+			num_nodes, num_objects);
+
+
+/*
+		Acpi_os_printf ("\n");
+
+		Acpi_os_printf ("ASL/AML Grammar Usage:\n\n");
+		Acpi_os_printf ("Elements Inside Methods:....% 7ld\n", Num_method_elements);
+		Acpi_os_printf ("Elements Outside Methods:...% 7ld\n", Num_grammar_elements - Num_method_elements);
+		Acpi_os_printf ("Total Grammar Elements:.....% 7ld\n", Num_grammar_elements);
+*/
+		break;
+
+	case CMD_MEMORY:
+
+		acpi_os_printf ("\n_dynamic Memory Estimates:\n\n");
+		acpi_os_printf ("Parse Tree without Methods:.% 7ld\n", size_of_parse_tree);
+		acpi_os_printf ("Control Method Parse Trees:.% 7ld (If parsed simultaneously)\n", size_of_method_trees);
+		acpi_os_printf ("Namespace Nodes:............% 7ld (%d nodes)\n", sizeof (ACPI_NAMESPACE_NODE) * num_nodes, num_nodes);
+		acpi_os_printf ("Named Internal Objects......% 7ld\n", size_of_acpi_objects);
+		acpi_os_printf ("State Cache size............% 7ld\n", acpi_gbl_generic_state_cache_depth * sizeof (ACPI_GENERIC_STATE));
+		acpi_os_printf ("Parse Cache size............% 7ld\n", acpi_gbl_parse_cache_depth * sizeof (ACPI_PARSE_OBJECT));
+		acpi_os_printf ("Object Cache size...........% 7ld\n", acpi_gbl_object_cache_depth * sizeof (ACPI_OPERAND_OBJECT));
+		acpi_os_printf ("Walk_state Cache size........% 7ld\n", acpi_gbl_walk_state_cache_depth * sizeof (ACPI_WALK_STATE));
+
+		acpi_os_printf ("\n");
+
+		acpi_os_printf ("Cache Statistics:\n\n");
+		acpi_os_printf ("State Cache requests........% 7ld\n", acpi_gbl_state_cache_requests);
+		acpi_os_printf ("State Cache hits............% 7ld\n", acpi_gbl_state_cache_hits);
+		acpi_os_printf ("State Cache depth...........% 7ld (%d remaining entries)\n", acpi_gbl_generic_state_cache_depth,
+				  MAX_STATE_CACHE_DEPTH - acpi_gbl_generic_state_cache_depth);
+		acpi_os_printf ("Parse Cache requests........% 7ld\n", acpi_gbl_parse_cache_requests);
+		acpi_os_printf ("Parse Cache hits............% 7ld\n", acpi_gbl_parse_cache_hits);
+		acpi_os_printf ("Parse Cache depth...........% 7ld (%d remaining entries)\n", acpi_gbl_parse_cache_depth,
+				  MAX_PARSE_CACHE_DEPTH - acpi_gbl_parse_cache_depth);
+		acpi_os_printf ("Ext Parse Cache requests....% 7ld\n", acpi_gbl_ext_parse_cache_requests);
+		acpi_os_printf ("Ext Parse Cache hits........% 7ld\n", acpi_gbl_ext_parse_cache_hits);
+		acpi_os_printf ("Ext Parse Cache depth.......% 7ld (%d remaining entries)\n", acpi_gbl_ext_parse_cache_depth,
+				  MAX_EXTPARSE_CACHE_DEPTH - acpi_gbl_ext_parse_cache_depth);
+		acpi_os_printf ("Object Cache requests.......% 7ld\n", acpi_gbl_object_cache_requests);
+		acpi_os_printf ("Object Cache hits...........% 7ld\n", acpi_gbl_object_cache_hits);
+		acpi_os_printf ("Object Cache depth..........% 7ld (%d remaining entries)\n", acpi_gbl_object_cache_depth,
+				  MAX_OBJECT_CACHE_DEPTH - acpi_gbl_object_cache_depth);
+		acpi_os_printf ("Walk_state Cache requests....% 7ld\n", acpi_gbl_walk_state_cache_requests);
+		acpi_os_printf ("Walk_state Cache hits........% 7ld\n", acpi_gbl_walk_state_cache_hits);
+		acpi_os_printf ("Walk_state Cache depth.......% 7ld (%d remaining entries)\n", acpi_gbl_walk_state_cache_depth,
+				  MAX_WALK_CACHE_DEPTH - acpi_gbl_walk_state_cache_depth);
+		break;
+
+	case CMD_MISC:
+
+		acpi_os_printf ("\n_miscellaneous Statistics:\n\n");
+		acpi_os_printf ("Calls to Acpi_ps_find:.. ........% 7ld\n", acpi_gbl_ps_find_count);
+		acpi_os_printf ("Calls to Acpi_ns_lookup:..........% 7ld\n", acpi_gbl_ns_lookup_count);
+
+		acpi_os_printf ("\n");
+
+		acpi_os_printf ("Mutex usage:\n\n");
+		for (i = 0; i < NUM_MTX; i++)
+		{
+			acpi_os_printf ("%-28s:     % 7ld\n", acpi_ut_get_mutex_name (i), acpi_gbl_acpi_mutex_info[i].use_count);
+		}
+		break;
+
+
+	case CMD_SIZES:
+
+		acpi_os_printf ("\n_internal object sizes:\n\n");
+
+		acpi_os_printf ("Common         %3d\n", sizeof (ACPI_OBJECT_COMMON));
+		acpi_os_printf ("Number         %3d\n", sizeof (ACPI_OBJECT_INTEGER));
+		acpi_os_printf ("String         %3d\n", sizeof (ACPI_OBJECT_STRING));
+		acpi_os_printf ("Buffer         %3d\n", sizeof (ACPI_OBJECT_BUFFER));
+		acpi_os_printf ("Package        %3d\n", sizeof (ACPI_OBJECT_PACKAGE));
+		acpi_os_printf ("Buffer_field   %3d\n", sizeof (ACPI_OBJECT_BUFFER_FIELD));
+		acpi_os_printf ("Device         %3d\n", sizeof (ACPI_OBJECT_DEVICE));
+		acpi_os_printf ("Event          %3d\n", sizeof (ACPI_OBJECT_EVENT));
+		acpi_os_printf ("Method         %3d\n", sizeof (ACPI_OBJECT_METHOD));
+		acpi_os_printf ("Mutex          %3d\n", sizeof (ACPI_OBJECT_MUTEX));
+		acpi_os_printf ("Region         %3d\n", sizeof (ACPI_OBJECT_REGION));
+		acpi_os_printf ("Power_resource %3d\n", sizeof (ACPI_OBJECT_POWER_RESOURCE));
+		acpi_os_printf ("Processor      %3d\n", sizeof (ACPI_OBJECT_PROCESSOR));
+		acpi_os_printf ("Thermal_zone   %3d\n", sizeof (ACPI_OBJECT_THERMAL_ZONE));
+		acpi_os_printf ("Region_field   %3d\n", sizeof (ACPI_OBJECT_REGION_FIELD));
+		acpi_os_printf ("Bank_field     %3d\n", sizeof (ACPI_OBJECT_BANK_FIELD));
+		acpi_os_printf ("Index_field    %3d\n", sizeof (ACPI_OBJECT_INDEX_FIELD));
+		acpi_os_printf ("Reference      %3d\n", sizeof (ACPI_OBJECT_REFERENCE));
+		acpi_os_printf ("Notify_handler %3d\n", sizeof (ACPI_OBJECT_NOTIFY_HANDLER));
+		acpi_os_printf ("Addr_handler   %3d\n", sizeof (ACPI_OBJECT_ADDR_HANDLER));
+		acpi_os_printf ("Extra          %3d\n", sizeof (ACPI_OBJECT_EXTRA));
+
+		acpi_os_printf ("\n");
+
+		acpi_os_printf ("Parse_object   %3d\n", sizeof (ACPI_PARSE_OBJECT));
+		acpi_os_printf ("Parse2_object  %3d\n", sizeof (ACPI_PARSE2_OBJECT));
+		acpi_os_printf ("Operand_object %3d\n", sizeof (ACPI_OPERAND_OBJECT));
+		acpi_os_printf ("Namespace_node %3d\n", sizeof (ACPI_NAMESPACE_NODE));
+
+		break;
+
+	}
+
+	acpi_os_printf ("\n");
+	return (AE_OK);
+}
+
+
+#endif /* ENABLE_DEBUGGER  */
diff -urN linux-2.4.6-pre4/drivers/acpi/debugger/dbutils.c linux/drivers/acpi/debugger/dbutils.c
--- linux-2.4.6-pre4/drivers/acpi/debugger/dbutils.c	Wed Dec 31 16:00:00 1969
+++ linux/drivers/acpi/debugger/dbutils.c	Mon Dec  3 22:48:41 2001
@@ -0,0 +1,354 @@
+/*******************************************************************************
+ *
+ * Module Name: dbutils - AML debugger utilities
+ *              $Revision: 37 $
+ *
+ ******************************************************************************/
+
+/*
+ *  Copyright (C) 2000, 2001 R. Byron Moore
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#include "acpi.h"
+#include "acparser.h"
+#include "amlcode.h"
+#include "acnamesp.h"
+#include "acparser.h"
+#include "acevents.h"
+#include "acinterp.h"
+#include "acdebug.h"
+#include "acdispat.h"
+
+
+#ifdef ENABLE_DEBUGGER
+
+#define _COMPONENT          ACPI_DEBUGGER
+	 MODULE_NAME         ("dbutils")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_db_set_output_destination
+ *
+ * PARAMETERS:  Output_flags        - Current flags word
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Set the current destination for debugger output.  Alos sets
+ *              the debug output level accordingly.
+ *
+ ******************************************************************************/
+
+void
+acpi_db_set_output_destination (
+	u32                     output_flags)
+{
+
+	acpi_gbl_db_output_flags = (u8) output_flags;
+
+	if (output_flags & DB_REDIRECTABLE_OUTPUT) {
+		if (output_to_file) {
+			acpi_dbg_level = acpi_gbl_db_debug_level;
+		}
+	}
+	else {
+		acpi_dbg_level = acpi_gbl_db_console_debug_level;
+	}
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_db_dump_buffer
+ *
+ * PARAMETERS:  Address             - Pointer to the buffer
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Print a portion of a buffer
+ *
+ ******************************************************************************/
+
+void
+acpi_db_dump_buffer (
+	u32                     address)
+{
+
+	acpi_os_printf ("\n_location %X:\n", address);
+
+	acpi_dbg_level |= TRACE_TABLES;
+	acpi_ut_dump_buffer ((u8 *) address, 64, DB_BYTE_DISPLAY, ACPI_UINT32_MAX);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_db_dump_object
+ *
+ * PARAMETERS:  Obj_desc        - External ACPI object to dump
+ *              Level           - Nesting level.
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Dump the contents of an ACPI external object
+ *
+ ******************************************************************************/
+
+void
+acpi_db_dump_object (
+	ACPI_OBJECT             *obj_desc,
+	u32                     level)
+{
+	u32                     i;
+
+
+	if (!obj_desc) {
+		acpi_os_printf ("[Null Object]\n");
+		return;
+	}
+
+	for (i = 0; i < level; i++) {
+		acpi_os_printf (" ");
+	}
+
+	switch (obj_desc->type) {
+	case ACPI_TYPE_ANY:
+
+		acpi_os_printf ("[Object Reference] Value: %p\n", obj_desc->reference.handle);
+		break;
+
+
+	case ACPI_TYPE_INTEGER:
+		acpi_os_printf ("[Number] Value: %ld (%lX)\n", obj_desc->integer.value, obj_desc->integer.value);
+		break;
+
+
+	case ACPI_TYPE_STRING:
+
+		acpi_os_printf ("[String] Value: ");
+		for (i = 0; i < obj_desc->string.length; i++) {
+			acpi_os_printf ("%c", obj_desc->string.pointer[i]);
+		}
+		acpi_os_printf ("\n");
+		break;
+
+
+	case ACPI_TYPE_BUFFER:
+
+		acpi_os_printf ("[Buffer] Value: ");
+		acpi_ut_dump_buffer ((u8 *) obj_desc->buffer.pointer, obj_desc->buffer.length, DB_DWORD_DISPLAY, _COMPONENT);
+		break;
+
+
+	case ACPI_TYPE_PACKAGE:
+
+		acpi_os_printf ("[Package] Contains %d Elements: \n", obj_desc->package.count);
+
+		for (i = 0; i < obj_desc->package.count; i++) {
+			acpi_db_dump_object (&obj_desc->package.elements[i], level+1);
+		}
+		break;
+
+
+	case INTERNAL_TYPE_REFERENCE:
+		acpi_os_printf ("[Object Reference] Value: %p\n", obj_desc->reference.handle);
+		break;
+
+	case ACPI_TYPE_PROCESSOR:
+		acpi_os_printf ("[Processor]\n");
+		break;
+
+	case ACPI_TYPE_POWER:
+		acpi_os_printf ("[Power Resource]\n");
+		break;
+
+	default:
+
+		acpi_os_printf ("[Unknown Type] %X \n", obj_desc->type);
+		break;
+	}
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_db_prep_namestring
+ *
+ * PARAMETERS:  Name            - String to prepare
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Translate all forward slashes and dots to backslashes.
+ *
+ ******************************************************************************/
+
+void
+acpi_db_prep_namestring (
+	NATIVE_CHAR             *name)
+{
+
+
+	if (!name) {
+		return;
+	}
+
+	STRUPR (name);
+
+	/* Convert a leading forward slash to a backslash */
+
+	if (*name == '/') {
+		*name = '\\';
+	}
+
+	/* Ignore a leading backslash, this is the root prefix */
+
+	if (*name == '\\') {
+		name++;
+	}
+
+	/* Convert all slash path separators to dots */
+
+	while (*name) {
+		if ((*name == '/') ||
+			(*name == '\\')) {
+			*name = '.';
+		}
+
+		name++;
+	}
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_db_second_pass_parse
+ *
+ * PARAMETERS:  Root            - Root of the parse tree
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Second pass parse of the ACPI tables.  We need to wait until
+ *              second pass to parse the control methods
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_db_second_pass_parse (
+	ACPI_PARSE_OBJECT       *root)
+{
+	ACPI_PARSE_OBJECT       *op = root;
+	ACPI_PARSE2_OBJECT      *method;
+	ACPI_PARSE_OBJECT       *search_op;
+	ACPI_PARSE_OBJECT       *start_op;
+	ACPI_STATUS             status = AE_OK;
+	u32                     base_aml_offset;
+
+
+	acpi_os_printf ("Pass two parse ....\n");
+
+	while (op) {
+		if (op->opcode == AML_METHOD_OP) {
+			method = (ACPI_PARSE2_OBJECT *) op;
+			status = acpi_ps_parse_aml (op, method->data, method->length, 0,
+					 NULL, NULL, NULL, acpi_ds_load1_begin_op, acpi_ds_load1_end_op);
+
+
+			base_aml_offset = (method->value.arg)->aml_offset + 1;
+			start_op = (method->value.arg)->next;
+			search_op = start_op;
+
+			while (search_op) {
+				search_op->aml_offset += base_aml_offset;
+				search_op = acpi_ps_get_depth_next (start_op, search_op);
+			}
+
+		}
+
+		if (op->opcode == AML_REGION_OP) {
+			/* TBD: [Investigate] this isn't quite the right thing to do! */
+			/*
+			 *
+			 * Method = (ACPI_DEFERRED_OP *) Op;
+			 * Status = Acpi_ps_parse_aml (Op, Method->Body, Method->Body_length);
+			 */
+		}
+
+		if (ACPI_FAILURE (status)) {
+			return (status);
+		}
+
+		op = acpi_ps_get_depth_next (root, op);
+	}
+
+	return (status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_db_local_ns_lookup
+ *
+ * PARAMETERS:  Name            - Name to lookup
+ *
+ * RETURN:      Pointer to a namespace node
+ *
+ * DESCRIPTION: Lookup a name in the ACPI namespace
+ *
+ ******************************************************************************/
+
+ACPI_NAMESPACE_NODE *
+acpi_db_local_ns_lookup (
+	NATIVE_CHAR             *name)
+{
+	NATIVE_CHAR             *internal_path;
+	ACPI_STATUS             status;
+	ACPI_NAMESPACE_NODE     *node = NULL;
+
+
+	acpi_db_prep_namestring (name);
+
+	/* Build an internal namestring */
+
+	status = acpi_ns_internalize_name (name, &internal_path);
+	if (ACPI_FAILURE (status)) {
+		acpi_os_printf ("Invalid namestring: %s\n", name);
+		return (NULL);
+	}
+
+	/* Lookup the name */
+
+	/* TBD: [Investigate] what scope do we use? */
+	/* Use the root scope for the start of the search */
+
+	status = acpi_ns_lookup (NULL, internal_path, ACPI_TYPE_ANY, IMODE_EXECUTE,
+			   NS_NO_UPSEARCH | NS_DONT_OPEN_SCOPE, NULL, &node);
+
+	if (ACPI_FAILURE (status)) {
+		acpi_os_printf ("Could not locate name: %s %s\n", name, acpi_ut_format_exception (status));
+	}
+
+
+	acpi_ut_free (internal_path);
+
+	return (node);
+}
+
+
+#endif /* ENABLE_DEBUGGER */
+
+
diff -urN linux-2.4.6-pre4/drivers/acpi/debugger/dbxface.c linux/drivers/acpi/debugger/dbxface.c
--- linux-2.4.6-pre4/drivers/acpi/debugger/dbxface.c	Wed Dec 31 16:00:00 1969
+++ linux/drivers/acpi/debugger/dbxface.c	Mon Dec  3 22:48:41 2001
@@ -0,0 +1,317 @@
+/*******************************************************************************
+ *
+ * Module Name: dbxface - AML Debugger external interfaces
+ *              $Revision: 37 $
+ *
+ ******************************************************************************/
+
+/*
+ *  Copyright (C) 2000, 2001 R. Byron Moore
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#include "acpi.h"
+#include "acparser.h"
+#include "amlcode.h"
+#include "acnamesp.h"
+#include "acparser.h"
+#include "acevents.h"
+#include "acinterp.h"
+#include "acdebug.h"
+
+
+#ifdef ENABLE_DEBUGGER
+
+#define _COMPONENT          ACPI_DEBUGGER
+	 MODULE_NAME         ("dbxface")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_db_single_step
+ *
+ * PARAMETERS:  Walk_state      - Current walk
+ *              Op              - Current executing op
+ *              Op_type         - Type of the current AML Opcode
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Called just before execution of an AML opcode.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_db_single_step (
+	ACPI_WALK_STATE         *walk_state,
+	ACPI_PARSE_OBJECT       *op,
+	u8                      op_type)
+{
+	ACPI_PARSE_OBJECT       *next;
+	ACPI_STATUS             status = AE_OK;
+	u32                     original_debug_level;
+	ACPI_PARSE_OBJECT       *display_op;
+
+
+	/* Is there a breakpoint set? */
+
+	if (walk_state->method_breakpoint) {
+		/* Check if the breakpoint has been reached or passed */
+
+		if (walk_state->method_breakpoint <= op->aml_offset) {
+			/* Hit the breakpoint, resume single step, reset breakpoint */
+
+			acpi_os_printf ("***Break*** at AML offset %X\n", op->aml_offset);
+			acpi_gbl_cm_single_step = TRUE;
+			acpi_gbl_step_to_next_call = FALSE;
+			walk_state->method_breakpoint = 0;
+		}
+	}
+
+
+	/*
+	 * Check if this is an opcode that we are interested in --
+	 * namely, opcodes that have arguments
+	 */
+
+	if (op->opcode == AML_INT_NAMEDFIELD_OP) {
+		return (AE_OK);
+	}
+
+	switch (op_type) {
+	case OPTYPE_UNDEFINED:
+	case OPTYPE_CONSTANT:           /* argument type only */
+	case OPTYPE_LITERAL:            /* argument type only */
+	case OPTYPE_DATA_TERM:          /* argument type only */
+	case OPTYPE_LOCAL_VARIABLE:     /* argument type only */
+	case OPTYPE_METHOD_ARGUMENT:    /* argument type only */
+		return (AE_OK);
+		break;
+
+	case OPTYPE_NAMED_OBJECT:
+		switch (op->opcode) {
+		case AML_INT_NAMEPATH_OP:
+			return (AE_OK);
+			break;
+		}
+	}
+
+
+	/*
+	 * Under certain debug conditions, display this opcode and its operands
+	 */
+
+	if ((output_to_file)                    ||
+		(acpi_gbl_cm_single_step)           ||
+		(acpi_dbg_level & TRACE_PARSE)) {
+		if ((output_to_file)                ||
+			(acpi_dbg_level & TRACE_PARSE)) {
+			acpi_os_printf ("\n[Aml_debug] Next AML Opcode to execute:\n");
+		}
+
+		/*
+		 * Display this op (and only this op - zero out the NEXT field temporarily,
+		 * and disable parser trace output for the duration of the display because
+		 * we don't want the extraneous debug output)
+		 */
+
+		original_debug_level = acpi_dbg_level;
+		acpi_dbg_level &= ~(TRACE_PARSE | TRACE_FUNCTIONS);
+		next = op->next;
+		op->next = NULL;
+
+
+		display_op = op;
+		if (op->parent) {
+			if ((op->parent->opcode == AML_IF_OP) ||
+				(op->parent->opcode == AML_WHILE_OP)) {
+				display_op = op->parent;
+			}
+		}
+
+		/* Now we can display it */
+
+		acpi_db_display_op (walk_state, display_op, ACPI_UINT32_MAX);
+
+		if ((op->opcode == AML_IF_OP) ||
+			(op->opcode == AML_WHILE_OP)) {
+			if (walk_state->control_state->common.value) {
+				acpi_os_printf ("Predicate was TRUE, executed block\n");
+			}
+			else {
+				acpi_os_printf ("Predicate is FALSE, skipping block\n");
+			}
+		}
+
+		else if (op->opcode == AML_ELSE_OP) {
+			/* TBD */
+		}
+
+
+		/* Restore everything */
+
+		op->next = next;
+		acpi_os_printf ("\n");
+		acpi_dbg_level = original_debug_level;
+   }
+
+
+	/* If we are not single stepping, just continue executing the method */
+
+	if (!acpi_gbl_cm_single_step) {
+		return (AE_OK);
+	}
+
+
+	/*
+	 * If we are executing a step-to-call command,
+	 * Check if this is a method call.
+	 */
+
+	if (acpi_gbl_step_to_next_call) {
+		if (op->opcode != AML_INT_METHODCALL_OP) {
+			/* Not a method call, just keep executing */
+
+			return (AE_OK);
+		}
+
+		/* Found a method call, stop executing */
+
+		acpi_gbl_step_to_next_call = FALSE;
+	}
+
+
+	/*
+	 * If the next opcode is a method call, we will "step over" it
+	 * by default.
+	 */
+
+	if (op->opcode == AML_INT_METHODCALL_OP) {
+		acpi_gbl_cm_single_step = FALSE; /* No more single step while executing called method */
+
+		/* Set the breakpoint on the call, it will stop execution as soon as we return */
+
+		/* TBD: [Future] don't kill the user breakpoint! */
+
+		walk_state->method_breakpoint = /* Op->Aml_offset + */ 1; /* Must be non-zero! */
+	}
+
+
+	/* TBD: [Investigate] what are the namespace locking issues here */
+
+	/* Acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); */
+
+	/* Go into the command loop and await next user command */
+
+	acpi_gbl_method_executing = TRUE;
+	status = AE_CTRL_TRUE;
+	while (status == AE_CTRL_TRUE) {
+		if (acpi_gbl_debugger_configuration == DEBUGGER_MULTI_THREADED) {
+			/* Handshake with the front-end that gets user command lines */
+
+			acpi_ut_release_mutex (ACPI_MTX_DEBUG_CMD_COMPLETE);
+			acpi_ut_acquire_mutex (ACPI_MTX_DEBUG_CMD_READY);
+		}
+
+		else {
+			/* Single threaded, we must get a command line ourselves */
+
+			/* Force output to console until a command is entered */
+
+			acpi_db_set_output_destination (DB_CONSOLE_OUTPUT);
+
+			/* Different prompt if method is executing */
+
+			if (!acpi_gbl_method_executing) {
+				acpi_os_printf ("%1c ", DB_COMMAND_PROMPT);
+			}
+			else {
+				acpi_os_printf ("%1c ", DB_EXECUTE_PROMPT);
+			}
+
+			/* Get the user input line */
+
+			acpi_os_get_line (line_buf);
+		}
+
+		status = acpi_db_command_dispatch (line_buf, walk_state, op);
+	}
+
+	/* Acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE); */
+
+
+	/* User commands complete, continue execution of the interrupted method */
+
+	return (status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_db_initialize
+ *
+ * PARAMETERS:  None
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Init and start debugger
+ *
+ ******************************************************************************/
+
+int
+acpi_db_initialize (void)
+{
+
+
+	/* Init globals */
+
+	buffer = acpi_os_allocate (BUFFER_SIZE);
+
+	/* Initial scope is the root */
+
+	scope_buf [0] = '\\';
+	scope_buf [1] = 0;
+
+
+	/*
+	 * If configured for multi-thread support, the debug executor runs in
+	 * a separate thread so that the front end can be in another address
+	 * space, environment, or even another machine.
+	 */
+
+	if (acpi_gbl_debugger_configuration & DEBUGGER_MULTI_THREADED) {
+		/* These were created with one unit, grab it */
+
+		acpi_ut_acquire_mutex (ACPI_MTX_DEBUG_CMD_COMPLETE);
+		acpi_ut_acquire_mutex (ACPI_MTX_DEBUG_CMD_READY);
+
+		/* Create the debug execution thread to execute commands */
+
+		acpi_os_queue_for_execution (0, acpi_db_execute_thread, NULL);
+	}
+
+	if (!opt_verbose) {
+		INDENT_STRING = "    ";
+		opt_disasm = TRUE;
+		opt_stats = FALSE;
+	}
+
+
+	return (0);
+}
+
+
+#endif /* ENABLE_DEBUGGER */
diff -urN linux-2.4.6-pre4/drivers/acpi/dispatcher/Makefile linux/drivers/acpi/dispatcher/Makefile
--- linux-2.4.6-pre4/drivers/acpi/dispatcher/Makefile	Fri Dec 29 14:07:21 2000
+++ linux/drivers/acpi/dispatcher/Makefile	Mon Dec  3 22:48:41 2001
@@ -1,16 +1,12 @@
 #
 # Makefile for all Linux ACPI interpreter subdirectories
+# EXCEPT for the ospm directory
 #
 
-O_TARGET := ../$(shell basename `pwd`).o
+O_TARGET := $(notdir $(CURDIR)).o
 
 obj-$(CONFIG_ACPI) := $(patsubst %.c,%.o,$(wildcard *.c))
 
-EXTRA_CFLAGS += -I../include
-
 EXTRA_CFLAGS += $(ACPI_CFLAGS)
 
 include $(TOPDIR)/Rules.make
-
-clean:
-	$(RM) *.o 
diff -urN linux-2.4.6-pre4/drivers/acpi/dispatcher/dsfield.c linux/drivers/acpi/dispatcher/dsfield.c
--- linux-2.4.6-pre4/drivers/acpi/dispatcher/dsfield.c	Mon Jan 22 13:23:42 2001
+++ linux/drivers/acpi/dispatcher/dsfield.c	Mon Dec  3 22:48:41 2001
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: dsfield - Dispatcher field routines
- *              $Revision: 31 $
+ *              $Revision: 41 $
  *
  *****************************************************************************/
 
@@ -31,7 +31,7 @@
 #include "acnamesp.h"
 
 
-#define _COMPONENT          DISPATCHER
+#define _COMPONENT          ACPI_DISPATCHER
 	 MODULE_NAME         ("dsfield")
 
 
@@ -51,7 +51,8 @@
  * FUNCTION:    Acpi_ds_create_field
  *
  * PARAMETERS:  Op              - Op containing the Field definition and args
- *              Region_node - Object for the containing Operation Region
+ *              Region_node     - Object for the containing Operation Region
+ *  `           Walk_state      - Current method state
  *
  * RETURN:      Status
  *
@@ -69,7 +70,6 @@
 	ACPI_PARSE_OBJECT       *arg;
 	ACPI_NAMESPACE_NODE     *node;
 	u8                      field_flags;
-	u8                      access_attribute = 0;
 	u32                     field_bit_position = 0;
 
 
@@ -78,10 +78,8 @@
 	arg = op->value.arg;
 	if (!region_node) {
 		status = acpi_ns_lookup (walk_state->scope_info, arg->value.name,
-				 ACPI_TYPE_REGION, IMODE_EXECUTE,
-				 NS_SEARCH_PARENT, walk_state,
-				 &region_node);
-
+				  ACPI_TYPE_REGION, IMODE_EXECUTE,
+				  NS_SEARCH_PARENT, walk_state, &region_node);
 		if (ACPI_FAILURE (status)) {
 			return (status);
 		}
@@ -96,37 +94,31 @@
 
 	arg = arg->next;
 	while (arg) {
-		switch (arg->opcode)
-		{
-		case AML_RESERVEDFIELD_OP:
+		switch (arg->opcode) {
+		case AML_INT_RESERVEDFIELD_OP:
 
 			field_bit_position += arg->value.size;
 			break;
 
 
-		case AML_ACCESSFIELD_OP:
+		case AML_INT_ACCESSFIELD_OP:
 
 			/*
 			 * Get a new Access_type and Access_attribute for all
 			 * entries (until end or another Access_as keyword)
 			 */
-
-			access_attribute = (u8) arg->value.integer;
-			field_flags     = (u8)
-					  ((field_flags & FIELD_ACCESS_TYPE_MASK) ||
-					  ((u8) (arg->value.integer >> 8)));
+			field_flags = (u8) ((field_flags & FIELD_ACCESS_TYPE_MASK) ||
+					   ((u8) (arg->value.integer >> 8)));
 			break;
 
 
-		case AML_NAMEDFIELD_OP:
+		case AML_INT_NAMEDFIELD_OP:
 
 			status = acpi_ns_lookup (walk_state->scope_info,
 					  (NATIVE_CHAR *) &((ACPI_PARSE2_OBJECT *)arg)->name,
-					  INTERNAL_TYPE_DEF_FIELD,
-					  IMODE_LOAD_PASS1,
+					  INTERNAL_TYPE_REGION_FIELD, IMODE_LOAD_PASS1,
 					  NS_NO_UPSEARCH | NS_DONT_OPEN_SCOPE,
 					  NULL, &node);
-
 			if (ACPI_FAILURE (status)) {
 				return (status);
 			}
@@ -136,9 +128,8 @@
 			 * the object stack
 			 */
 
-			status = acpi_aml_prep_def_field_value (node, region_node, field_flags,
-					  access_attribute, field_bit_position, arg->value.size);
-
+			status = acpi_ex_prep_region_field_value (node, region_node, field_flags,
+					  field_bit_position, arg->value.size);
 			if (ACPI_FAILURE (status)) {
 				return (status);
 			}
@@ -161,7 +152,8 @@
  * FUNCTION:    Acpi_ds_create_bank_field
  *
  * PARAMETERS:  Op              - Op containing the Field definition and args
- *              Region_node - Object for the containing Operation Region
+ *              Region_node     - Object for the containing Operation Region
+ *  `           Walk_state      - Current method state
  *
  * RETURN:      Status
  *
@@ -181,7 +173,6 @@
 	ACPI_NAMESPACE_NODE     *node;
 	u32                     bank_value;
 	u8                      field_flags;
-	u8                      access_attribute = 0;
 	u32                     field_bit_position = 0;
 
 
@@ -190,10 +181,8 @@
 	arg = op->value.arg;
 	if (!region_node) {
 		status = acpi_ns_lookup (walk_state->scope_info, arg->value.name,
-				 ACPI_TYPE_REGION, IMODE_EXECUTE,
-				 NS_SEARCH_PARENT, walk_state,
-				 &region_node);
-
+				  ACPI_TYPE_REGION, IMODE_EXECUTE,
+				  NS_SEARCH_PARENT, walk_state, &region_node);
 		if (ACPI_FAILURE (status)) {
 			return (status);
 		}
@@ -204,11 +193,9 @@
 	arg = arg->next;
 
 	status = acpi_ns_lookup (walk_state->scope_info, arg->value.string,
-			 INTERNAL_TYPE_BANK_FIELD_DEFN,
-			 IMODE_LOAD_PASS1,
-			 NS_NO_UPSEARCH | NS_DONT_OPEN_SCOPE,
-			 NULL, &register_node);
-
+			  INTERNAL_TYPE_BANK_FIELD_DEFN, IMODE_LOAD_PASS1,
+			  NS_NO_UPSEARCH | NS_DONT_OPEN_SCOPE,
+			  NULL, &register_node);
 	if (ACPI_FAILURE (status)) {
 		return (status);
 	}
@@ -228,37 +215,31 @@
 
 	arg = arg->next;
 	while (arg) {
-		switch (arg->opcode)
-		{
-		case AML_RESERVEDFIELD_OP:
+		switch (arg->opcode) {
+		case AML_INT_RESERVEDFIELD_OP:
 
 			field_bit_position += arg->value.size;
 			break;
 
 
-		case AML_ACCESSFIELD_OP:
+		case AML_INT_ACCESSFIELD_OP:
 
 			/*
 			 * Get a new Access_type and Access_attribute for
 			 * all entries (until end or another Access_as keyword)
 			 */
-
-			access_attribute = (u8) arg->value.integer;
-			field_flags     = (u8)
-					  ((field_flags & FIELD_ACCESS_TYPE_MASK) ||
-					  ((u8) (arg->value.integer >> 8)));
+			field_flags = (u8) ((field_flags & FIELD_ACCESS_TYPE_MASK) ||
+					 ((u8) (arg->value.integer >> 8)));
 			break;
 
 
-		case AML_NAMEDFIELD_OP:
+		case AML_INT_NAMEDFIELD_OP:
 
 			status = acpi_ns_lookup (walk_state->scope_info,
 					  (NATIVE_CHAR *) &((ACPI_PARSE2_OBJECT *)arg)->name,
-					  INTERNAL_TYPE_DEF_FIELD,
-					  IMODE_LOAD_PASS1,
+					  INTERNAL_TYPE_REGION_FIELD, IMODE_LOAD_PASS1,
 					  NS_NO_UPSEARCH | NS_DONT_OPEN_SCOPE,
 					  NULL, &node);
-
 			if (ACPI_FAILURE (status)) {
 				return (status);
 			}
@@ -268,10 +249,9 @@
 			 * the object stack
 			 */
 
-			status = acpi_aml_prep_bank_field_value (node, region_node, register_node,
-					  bank_value, field_flags, access_attribute,
-					  field_bit_position, arg->value.size);
-
+			status = acpi_ex_prep_bank_field_value (node, region_node, register_node,
+					  bank_value, field_flags, field_bit_position,
+					  arg->value.size);
 			if (ACPI_FAILURE (status)) {
 				return (status);
 			}
@@ -295,7 +275,8 @@
  * FUNCTION:    Acpi_ds_create_index_field
  *
  * PARAMETERS:  Op              - Op containing the Field definition and args
- *              Region_node - Object for the containing Operation Region
+ *              Region_node     - Object for the containing Operation Region
+ *  `           Walk_state      - Current method state
  *
  * RETURN:      Status
  *
@@ -306,7 +287,7 @@
 ACPI_STATUS
 acpi_ds_create_index_field (
 	ACPI_PARSE_OBJECT       *op,
-	ACPI_HANDLE             region_node,
+	ACPI_NAMESPACE_NODE     *region_node,
 	ACPI_WALK_STATE         *walk_state)
 {
 	ACPI_STATUS             status;
@@ -315,7 +296,6 @@
 	ACPI_NAMESPACE_NODE     *index_register_node;
 	ACPI_NAMESPACE_NODE     *data_register_node;
 	u8                      field_flags;
-	u8                      access_attribute = 0;
 	u32                     field_bit_position = 0;
 
 
@@ -324,10 +304,9 @@
 	/* First arg is the name of the Index register */
 
 	status = acpi_ns_lookup (walk_state->scope_info, arg->value.string,
-			 ACPI_TYPE_ANY, IMODE_LOAD_PASS1,
-			 NS_NO_UPSEARCH | NS_DONT_OPEN_SCOPE,
-			 NULL, &index_register_node);
-
+			  ACPI_TYPE_ANY, IMODE_LOAD_PASS1,
+			  NS_NO_UPSEARCH | NS_DONT_OPEN_SCOPE,
+			  NULL, &index_register_node);
 	if (ACPI_FAILURE (status)) {
 		return (status);
 	}
@@ -337,11 +316,9 @@
 	arg = arg->next;
 
 	status = acpi_ns_lookup (walk_state->scope_info, arg->value.string,
-			 INTERNAL_TYPE_INDEX_FIELD_DEFN,
-			 IMODE_LOAD_PASS1,
-			 NS_NO_UPSEARCH | NS_DONT_OPEN_SCOPE,
-			 NULL, &data_register_node);
-
+			  INTERNAL_TYPE_INDEX_FIELD_DEFN, IMODE_LOAD_PASS1,
+			  NS_NO_UPSEARCH | NS_DONT_OPEN_SCOPE,
+			  NULL, &data_register_node);
 	if (ACPI_FAILURE (status)) {
 		return (status);
 	}
@@ -357,37 +334,31 @@
 
 	arg = arg->next;
 	while (arg) {
-		switch (arg->opcode)
-		{
-		case AML_RESERVEDFIELD_OP:
+		switch (arg->opcode) {
+		case AML_INT_RESERVEDFIELD_OP:
 
 			field_bit_position += arg->value.size;
 			break;
 
 
-		case AML_ACCESSFIELD_OP:
+		case AML_INT_ACCESSFIELD_OP:
 
 			/*
 			 * Get a new Access_type and Access_attribute for all
 			 * entries (until end or another Access_as keyword)
 			 */
-
-			access_attribute = (u8) arg->value.integer;
-			field_flags     = (u8)
-					   ((field_flags & FIELD_ACCESS_TYPE_MASK) ||
-					   ((u8) (arg->value.integer >> 8)));
+			field_flags = (u8) ((field_flags & FIELD_ACCESS_TYPE_MASK) ||
+					 ((u8) (arg->value.integer >> 8)));
 			break;
 
 
-		case AML_NAMEDFIELD_OP:
+		case AML_INT_NAMEDFIELD_OP:
 
 			status = acpi_ns_lookup (walk_state->scope_info,
-					 (NATIVE_CHAR *) &((ACPI_PARSE2_OBJECT *)arg)->name,
-					 INTERNAL_TYPE_INDEX_FIELD,
-					 IMODE_LOAD_PASS1,
-					 NS_NO_UPSEARCH | NS_DONT_OPEN_SCOPE,
-					 NULL, &node);
-
+					  (NATIVE_CHAR *) &((ACPI_PARSE2_OBJECT *)arg)->name,
+					  INTERNAL_TYPE_INDEX_FIELD, IMODE_LOAD_PASS1,
+					  NS_NO_UPSEARCH | NS_DONT_OPEN_SCOPE,
+					  NULL, &node);
 			if (ACPI_FAILURE (status)) {
 				return (status);
 			}
@@ -397,10 +368,9 @@
 			 * the object stack
 			 */
 
-			status = acpi_aml_prep_index_field_value (node, index_register_node, data_register_node,
-					  field_flags, access_attribute,
+			status = acpi_ex_prep_index_field_value (node, index_register_node,
+					  data_register_node, field_flags,
 					  field_bit_position, arg->value.size);
-
 			if (ACPI_FAILURE (status)) {
 				return (status);
 			}
diff -urN linux-2.4.6-pre4/drivers/acpi/dispatcher/dsmethod.c linux/drivers/acpi/dispatcher/dsmethod.c
--- linux-2.4.6-pre4/drivers/acpi/dispatcher/dsmethod.c	Mon Jan 22 13:23:42 2001
+++ linux/drivers/acpi/dispatcher/dsmethod.c	Mon Dec  3 22:48:41 2001
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: dsmethod - Parser/Interpreter interface - control method parsing
- *              $Revision: 56 $
+ *              $Revision: 63 $
  *
  *****************************************************************************/
 
@@ -34,7 +34,7 @@
 #include "acdebug.h"
 
 
-#define _COMPONENT          DISPATCHER
+#define _COMPONENT          ACPI_DISPATCHER
 	 MODULE_NAME         ("dsmethod")
 
 
@@ -85,9 +85,9 @@
 	 /* Create a mutex for the method if there is a concurrency limit */
 
 	if ((obj_desc->method.concurrency != INFINITE_CONCURRENCY) &&
-		(!obj_desc->method.semaphore))
-	{
-		status = acpi_os_create_semaphore (1,obj_desc->method.concurrency,
+		(!obj_desc->method.semaphore)) {
+		status = acpi_os_create_semaphore (obj_desc->method.concurrency,
+				   obj_desc->method.concurrency,
 				   &obj_desc->method.semaphore);
 		if (ACPI_FAILURE (status)) {
 			return (status);
@@ -98,7 +98,6 @@
 	 * Allocate a new parser op to be the root of the parsed
 	 * method tree
 	 */
-
 	op = acpi_ps_alloc_op (AML_METHOD_OP);
 	if (!op) {
 		return (AE_NO_MEMORY);
@@ -113,15 +112,13 @@
 	/*
 	 * Parse the method, first pass
 	 *
-	 * The first pass load is
-	 * where newly declared named objects are
+	 * The first pass load is where newly declared named objects are
 	 * added into the namespace.  Actual evaluation of
 	 * the named objects (what would be called a "second
 	 * pass") happens during the actual execution of the
 	 * method so that operands to the named objects can
 	 * take on dynamic run-time values.
 	 */
-
 	status = acpi_ps_parse_aml (op, obj_desc->method.pcode,
 			   obj_desc->method.pcode_length,
 			   ACPI_PARSE_LOAD_PASS1 | ACPI_PARSE_DELETE_TREE,
@@ -134,7 +131,7 @@
 
 	/* Get a new Owner_id for objects created by this method */
 
-	owner_id = acpi_cm_allocate_owner_id (OWNER_TYPE_METHOD);
+	owner_id = acpi_ut_allocate_owner_id (OWNER_TYPE_METHOD);
 	obj_desc->method.owning_id = owner_id;
 
 	/* Install the parsed tree in the method object */
@@ -142,7 +139,6 @@
 
 	acpi_ps_delete_parse_tree (op);
 
-
 	return (status);
 }
 
@@ -151,8 +147,9 @@
  *
  * FUNCTION:    Acpi_ds_begin_method_execution
  *
- * PARAMETERS:  Method_node        - Node of the method
+ * PARAMETERS:  Method_node         - Node of the method
  *              Obj_desc            - The method object
+ *              Calling_method_node - Caller of this method (if non-null)
  *
  * RETURN:      Status
  *
@@ -167,7 +164,8 @@
 ACPI_STATUS
 acpi_ds_begin_method_execution (
 	ACPI_NAMESPACE_NODE     *method_node,
-	ACPI_OPERAND_OBJECT     *obj_desc)
+	ACPI_OPERAND_OBJECT     *obj_desc,
+	ACPI_NAMESPACE_NODE     *calling_method_node)
 {
 	ACPI_STATUS             status = AE_OK;
 
@@ -176,34 +174,41 @@
 		return (AE_NULL_ENTRY);
 	}
 
-	obj_desc = acpi_ns_get_attached_object (method_node);
-	if (!obj_desc) {
-		return (AE_NULL_OBJECT);
-	}
-
 
 	/*
 	 * If there is a concurrency limit on this method, we need to
-	 * obtain a unit from the method semaphore.  This releases the
-	 * interpreter if we block
+	 * obtain a unit from the method semaphore.
 	 */
-
 	if (obj_desc->method.semaphore) {
-		status = acpi_aml_system_wait_semaphore (obj_desc->method.semaphore,
+		/*
+		 * Allow recursive method calls, up to the reentrancy/concurrency
+		 * limit imposed by the SERIALIZED rule and the Sync_level method
+		 * parameter.
+		 *
+		 * The point of this code is to avoid permanently blocking a
+		 * thread that is making recursive method calls.
+		 */
+		if (method_node == calling_method_node) {
+			if (obj_desc->method.thread_count >= obj_desc->method.concurrency) {
+				return (AE_AML_METHOD_LIMIT);
+			}
+		}
+
+		/*
+		 * Get a unit from the method semaphore. This releases the
+		 * interpreter if we block
+		 */
+		status = acpi_ex_system_wait_semaphore (obj_desc->method.semaphore,
 				 WAIT_FOREVER);
 	}
 
 
 	/*
-	 * Increment the method parse tree thread count since there
-	 * is one additional thread executing in it.  If configured
-	 * for deletion-on-exit, the parse tree will be deleted when
-	 * the last thread completes execution of the method
+	 * Increment the method parse tree thread count since it has been
+	 * reentered one more time (even if it is the same thread)
 	 */
-
 	obj_desc->method.thread_count++;
 
-
 	return (status);
 }
 
@@ -238,7 +243,6 @@
 	/*
 	 * Get the namespace entry for the control method we are about to call
 	 */
-
 	method_node = this_walk_state->method_call_node;
 	if (!method_node) {
 		return (AE_NULL_ENTRY);
@@ -252,12 +256,12 @@
 
 	/* Init for new method, wait on concurrency semaphore */
 
-	status = acpi_ds_begin_method_execution (method_node, obj_desc);
+	status = acpi_ds_begin_method_execution (method_node, obj_desc,
+			  this_walk_state->method_node);
 	if (ACPI_FAILURE (status)) {
 		return (status);
 	}
 
-
 	/* Create and initialize a new parser state */
 
 	parser_state = acpi_ps_create_state (obj_desc->method.pcode,
@@ -307,7 +311,6 @@
 	 * stack.  Operands on the previous walk state stack always
 	 * start at index 0.
 	 */
-
 	status = acpi_ds_method_data_init_args (&this_walk_state->operands[0],
 			 this_walk_state->num_operands,
 			 next_walk_state);
@@ -335,9 +338,8 @@
 	 * Delete the operands on the previous walkstate operand stack
 	 * (they were copied to new objects)
 	 */
-
 	for (i = 0; i < obj_desc->method.param_count; i++) {
-		acpi_cm_remove_reference (this_walk_state->operands [i]);
+		acpi_ut_remove_reference (this_walk_state->operands [i]);
 		this_walk_state->operands [i] = NULL;
 	}
 
@@ -386,10 +388,9 @@
 			 * Get the return value (if any) from the previous method.
 			 * NULL if no return value
 			 */
-
 			status = acpi_ds_result_push (return_desc, walk_state);
 			if (ACPI_FAILURE (status)) {
-				acpi_cm_remove_reference (return_desc);
+				acpi_ut_remove_reference (return_desc);
 				return (status);
 			}
 		}
@@ -399,7 +400,7 @@
 			 * Delete the return value if it will not be used by the
 			 * calling method
 			 */
-			acpi_cm_remove_reference (return_desc);
+			acpi_ut_remove_reference (return_desc);
 		}
 
 	}
@@ -427,7 +428,6 @@
 acpi_ds_terminate_control_method (
 	ACPI_WALK_STATE         *walk_state)
 {
-	ACPI_STATUS             status;
 	ACPI_OPERAND_OBJECT     *obj_desc;
 	ACPI_NAMESPACE_NODE     *method_node;
 
@@ -448,15 +448,14 @@
 	 * If this is the last thread executing the method,
 	 * we have additional cleanup to perform
 	 */
-
-	acpi_cm_acquire_mutex (ACPI_MTX_PARSER);
+	acpi_ut_acquire_mutex (ACPI_MTX_PARSER);
 
 
 	/* Signal completion of the execution of this method if necessary */
 
 	if (walk_state->method_desc->method.semaphore) {
-		status = acpi_os_signal_semaphore (
-				 walk_state->method_desc->method.semaphore, 1);
+		acpi_os_signal_semaphore (
+			walk_state->method_desc->method.semaphore, 1);
 	}
 
 	/* Decrement the thread count on the method parse tree */
@@ -470,11 +469,12 @@
 		 * The method Node is stored in the walk state
 		 */
 		method_node = walk_state->method_node;
+
 		/*
 		 * Delete any namespace entries created immediately underneath
 		 * the method
 		 */
-		acpi_cm_acquire_mutex (ACPI_MTX_NAMESPACE);
+		acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
 		if (method_node->child) {
 			acpi_ns_delete_namespace_subtree (method_node);
 		}
@@ -484,10 +484,10 @@
 		 * the namespace
 		 */
 		acpi_ns_delete_namespace_by_owner (walk_state->method_desc->method.owning_id);
-		acpi_cm_release_mutex (ACPI_MTX_NAMESPACE);
+		acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
 	}
 
-	acpi_cm_release_mutex (ACPI_MTX_PARSER);
+	acpi_ut_release_mutex (ACPI_MTX_PARSER);
 	return (AE_OK);
 }
 
diff -urN linux-2.4.6-pre4/drivers/acpi/dispatcher/dsmthdat.c linux/drivers/acpi/dispatcher/dsmthdat.c
--- linux-2.4.6-pre4/drivers/acpi/dispatcher/dsmthdat.c	Mon Jan 29 10:15:58 2001
+++ linux/drivers/acpi/dispatcher/dsmthdat.c	Mon Dec  3 22:48:41 2001
@@ -1,7 +1,7 @@
 /*******************************************************************************
  *
  * Module Name: dsmthdat - control method arguments and local variables
- *              $Revision: 39 $
+ *              $Revision: 46 $
  *
  ******************************************************************************/
 
@@ -32,7 +32,7 @@
 #include "acnamesp.h"
 
 
-#define _COMPONENT          DISPATCHER
+#define _COMPONENT          ACPI_DISPATCHER
 	 MODULE_NAME         ("dsmthdat")
 
 
@@ -60,7 +60,7 @@
 
 	/*
 	 * Walk_state fields are initialized to zero by the
-	 * Acpi_cm_callocate().
+	 * Acpi_ut_callocate().
 	 *
 	 * An Node is assigned to each argument and local so
 	 * that Ref_of() can return a pointer to the Node.
@@ -125,7 +125,7 @@
 
 			/* Was given a ref when stored */
 
-			acpi_cm_remove_reference (object);
+			acpi_ut_remove_reference (object);
 	   }
 	}
 
@@ -141,7 +141,7 @@
 
 			 /* Was given a ref when stored */
 
-			acpi_cm_remove_reference (object);
+			acpi_ut_remove_reference (object);
 		}
 	}
 
@@ -182,16 +182,15 @@
 
 	for (pindex = mindex = 0;
 		(mindex < MTH_NUM_ARGS) && (pindex < max_param_count);
-		mindex++)
-	{
+		mindex++) {
 		if (params[pindex]) {
 			/*
 			 * A valid parameter.
 			 * Set the current method argument to the
 			 * Params[Pindex++] argument object descriptor
 			 */
-			status = acpi_ds_method_data_set_value (MTH_TYPE_ARG, mindex,
-					 params[pindex], walk_state);
+			status = acpi_ds_store_object_to_local (AML_ARG_OP, mindex,
+					  params[pindex], walk_state);
 			if (ACPI_FAILURE (status)) {
 				break;
 			}
@@ -212,7 +211,7 @@
  *
  * FUNCTION:    Acpi_ds_method_data_get_entry
  *
- * PARAMETERS:  Type                - Either MTH_TYPE_LOCAL or MTH_TYPE_ARG
+ * PARAMETERS:  Opcode              - Either AML_LOCAL_OP or AML_ARG_OP
  *              Index               - Which local_var or argument to get
  *              Entry               - Pointer to where a pointer to the stack
  *                                    entry is returned.
@@ -220,13 +219,13 @@
  *
  * RETURN:      Status
  *
- * DESCRIPTION: Get the address of the stack entry given by Type:Index
+ * DESCRIPTION: Get the address of the object entry given by Opcode:Index
  *
  ******************************************************************************/
 
 ACPI_STATUS
 acpi_ds_method_data_get_entry (
-	u32                     type,
+	u16                     opcode,
 	u32                     index,
 	ACPI_WALK_STATE         *walk_state,
 	ACPI_OPERAND_OBJECT     ***entry)
@@ -235,31 +234,30 @@
 
 	/*
 	 * Get the requested object.
-	 * The stack "Type" is either a Local_variable or an Argument
+	 * The stack "Opcode" is either a Local_variable or an Argument
 	 */
 
-	switch (type)
-	{
+	switch (opcode) {
 
-	case MTH_TYPE_LOCAL:
+	case AML_LOCAL_OP:
 
 		if (index > MTH_MAX_LOCAL) {
 			return (AE_BAD_PARAMETER);
 		}
 
-		*entry =
-			(ACPI_OPERAND_OBJECT  **) &walk_state->local_variables[index].object;
+		*entry = (ACPI_OPERAND_OBJECT  **)
+				 &walk_state->local_variables[index].object;
 		break;
 
 
-	case MTH_TYPE_ARG:
+	case AML_ARG_OP:
 
 		if (index > MTH_MAX_ARG) {
 			return (AE_BAD_PARAMETER);
 		}
 
-		*entry =
-			(ACPI_OPERAND_OBJECT  **) &walk_state->arguments[index].object;
+		*entry = (ACPI_OPERAND_OBJECT  **)
+				 &walk_state->arguments[index].object;
 		break;
 
 
@@ -276,20 +274,20 @@
  *
  * FUNCTION:    Acpi_ds_method_data_set_entry
  *
- * PARAMETERS:  Type                - Either MTH_TYPE_LOCAL or MTH_TYPE_ARG
+ * PARAMETERS:  Opcode              - Either AML_LOCAL_OP or AML_ARG_OP
  *              Index               - Which local_var or argument to get
  *              Object              - Object to be inserted into the stack entry
  *              Walk_state          - Current walk state object
  *
  * RETURN:      Status
  *
- * DESCRIPTION: Insert an object onto the method stack at entry Type:Index.
+ * DESCRIPTION: Insert an object onto the method stack at entry Opcode:Index.
  *
  ******************************************************************************/
 
 ACPI_STATUS
 acpi_ds_method_data_set_entry (
-	u32                     type,
+	u16                     opcode,
 	u32                     index,
 	ACPI_OPERAND_OBJECT     *object,
 	ACPI_WALK_STATE         *walk_state)
@@ -300,14 +298,14 @@
 
 	/* Get a pointer to the stack entry to set */
 
-	status = acpi_ds_method_data_get_entry (type, index, walk_state, &entry);
+	status = acpi_ds_method_data_get_entry (opcode, index, walk_state, &entry);
 	if (ACPI_FAILURE (status)) {
 		return (status);
 	}
 
 	/* Increment ref count so object can't be deleted while installed */
 
-	acpi_cm_add_reference (object);
+	acpi_ut_add_reference (object);
 
 	/* Install the object into the stack entry */
 
@@ -321,7 +319,7 @@
  *
  * FUNCTION:    Acpi_ds_method_data_get_type
  *
- * PARAMETERS:  Type                - Either MTH_TYPE_LOCAL or MTH_TYPE_ARG
+ * PARAMETERS:  Opcode              - Either AML_LOCAL_OP or AML_ARG_OP
  *              Index               - Which local_var or argument whose type
  *                                      to get
  *              Walk_state          - Current walk state object
@@ -331,9 +329,9 @@
  *
  ******************************************************************************/
 
-OBJECT_TYPE_INTERNAL
+ACPI_OBJECT_TYPE8
 acpi_ds_method_data_get_type (
-	u32                     type,
+	u16                     opcode,
 	u32                     index,
 	ACPI_WALK_STATE         *walk_state)
 {
@@ -344,7 +342,7 @@
 
 	/* Get a pointer to the requested stack entry */
 
-	status = acpi_ds_method_data_get_entry (type, index, walk_state, &entry);
+	status = acpi_ds_method_data_get_entry (opcode, index, walk_state, &entry);
 	if (ACPI_FAILURE (status)) {
 		return ((ACPI_TYPE_NOT_FOUND));
 	}
@@ -366,9 +364,9 @@
 
 /*******************************************************************************
  *
- * FUNCTION:    Acpi_ds_method_data_get_nte
+ * FUNCTION:    Acpi_ds_method_data_get_node
  *
- * PARAMETERS:  Type                - Either MTH_TYPE_LOCAL or MTH_TYPE_ARG
+ * PARAMETERS:  Opcode              - Either AML_LOCAL_OP or AML_ARG_OP
  *              Index               - Which local_var or argument whose type
  *                                      to get
  *              Walk_state          - Current walk state object
@@ -378,18 +376,17 @@
  ******************************************************************************/
 
 ACPI_NAMESPACE_NODE *
-acpi_ds_method_data_get_nte (
-	u32                     type,
+acpi_ds_method_data_get_node (
+	u16                     opcode,
 	u32                     index,
 	ACPI_WALK_STATE         *walk_state)
 {
 	ACPI_NAMESPACE_NODE     *node = NULL;
 
 
-	switch (type)
-	{
+	switch (opcode) {
 
-	case MTH_TYPE_LOCAL:
+	case AML_LOCAL_OP:
 
 		if (index > MTH_MAX_LOCAL) {
 			return (node);
@@ -399,7 +396,7 @@
 		break;
 
 
-	case MTH_TYPE_ARG:
+	case AML_ARG_OP:
 
 		if (index > MTH_MAX_ARG) {
 			return (node);
@@ -422,7 +419,7 @@
  *
  * FUNCTION:    Acpi_ds_method_data_get_value
  *
- * PARAMETERS:  Type                - Either MTH_TYPE_LOCAL or MTH_TYPE_ARG
+ * PARAMETERS:  Opcode              - Either AML_LOCAL_OP or AML_ARG_OP
  *              Index               - Which local_var or argument to get
  *              Walk_state          - Current walk state object
  *              *Dest_desc          - Ptr to Descriptor into which selected Arg
@@ -432,13 +429,13 @@
  *
  * DESCRIPTION: Retrieve value of selected Arg or Local from the method frame
  *              at the current top of the method stack.
- *              Used only in Acpi_aml_resolve_to_value().
+ *              Used only in Acpi_ex_resolve_to_value().
  *
  ******************************************************************************/
 
 ACPI_STATUS
 acpi_ds_method_data_get_value (
-	u32                     type,
+	u16                     opcode,
 	u32                     index,
 	ACPI_WALK_STATE         *walk_state,
 	ACPI_OPERAND_OBJECT     **dest_desc)
@@ -457,7 +454,7 @@
 
 	/* Get a pointer to the requested method stack entry */
 
-	status = acpi_ds_method_data_get_entry (type, index, walk_state, &entry);
+	status = acpi_ds_method_data_get_entry (opcode, index, walk_state, &entry);
 	if (ACPI_FAILURE (status)) {
 		return (status);
 	}
@@ -478,14 +475,13 @@
 		 * before it was initialized.  Either case is an error.
 		 */
 
-		switch (type)
-		{
-		case MTH_TYPE_ARG:
+		switch (opcode) {
+		case AML_ARG_OP:
 
 			return (AE_AML_UNINITIALIZED_ARG);
 			break;
 
-		case MTH_TYPE_LOCAL:
+		case AML_LOCAL_OP:
 
 			return (AE_AML_UNINITIALIZED_LOCAL);
 			break;
@@ -499,7 +495,7 @@
 	 */
 
 	*dest_desc = object;
-	acpi_cm_add_reference (object);
+	acpi_ut_add_reference (object);
 
 	return (AE_OK);
 }
@@ -509,20 +505,20 @@
  *
  * FUNCTION:    Acpi_ds_method_data_delete_value
  *
- * PARAMETERS:  Type                - Either MTH_TYPE_LOCAL or MTH_TYPE_ARG
+ * PARAMETERS:  Opcode              - Either AML_LOCAL_OP or AML_ARG_OP
  *              Index               - Which local_var or argument to delete
  *              Walk_state          - Current walk state object
  *
  * RETURN:      Status
  *
- * DESCRIPTION: Delete the entry at Type:Index on the method stack.  Inserts
+ * DESCRIPTION: Delete the entry at Opcode:Index on the method stack.  Inserts
  *              a null into the stack slot after the object is deleted.
  *
  ******************************************************************************/
 
 ACPI_STATUS
 acpi_ds_method_data_delete_value (
-	u32                     type,
+	u16                     opcode,
 	u32                     index,
 	ACPI_WALK_STATE         *walk_state)
 {
@@ -533,7 +529,7 @@
 
 	/* Get a pointer to the requested entry */
 
-	status = acpi_ds_method_data_get_entry (type, index, walk_state, &entry);
+	status = acpi_ds_method_data_get_entry (opcode, index, walk_state, &entry);
 	if (ACPI_FAILURE (status)) {
 		return (status);
 	}
@@ -551,14 +547,13 @@
 
 
 	if ((object) &&
-		(VALID_DESCRIPTOR_TYPE (object, ACPI_DESC_TYPE_INTERNAL)))
-	{
+		(VALID_DESCRIPTOR_TYPE (object, ACPI_DESC_TYPE_INTERNAL))) {
 		/*
 		 * There is a valid object in this slot
 		 * Decrement the reference count by one to balance the
 		 * increment when the object was stored in the slot.
 		 */
-		acpi_cm_remove_reference (object);
+		acpi_ut_remove_reference (object);
 	}
 
 
@@ -568,9 +563,9 @@
 
 /*******************************************************************************
  *
- * FUNCTION:    Acpi_ds_method_data_set_value
+ * FUNCTION:    Acpi_ds_store_object_to_local
  *
- * PARAMETERS:  Type                - Either MTH_TYPE_LOCAL or MTH_TYPE_ARG
+ * PARAMETERS:  Opcode              - Either AML_LOCAL_OP or AML_ARG_OP
  *              Index               - Which local_var or argument to set
  *              Src_desc            - Value to be stored
  *              Walk_state          - Current walk state
@@ -584,8 +579,8 @@
  ******************************************************************************/
 
 ACPI_STATUS
-acpi_ds_method_data_set_value (
-	u32                     type,
+acpi_ds_store_object_to_local (
+	u16                     opcode,
 	u32                     index,
 	ACPI_OPERAND_OBJECT     *src_desc,
 	ACPI_WALK_STATE         *walk_state)
@@ -603,7 +598,7 @@
 
 	/* Get a pointer to the requested method stack entry */
 
-	status = acpi_ds_method_data_get_entry (type, index, walk_state, &entry);
+	status = acpi_ds_method_data_get_entry (opcode, index, walk_state, &entry);
 	if (ACPI_FAILURE (status)) {
 		goto cleanup;
 	}
@@ -638,9 +633,8 @@
 		 * Weird, but true.
 		 */
 
-		if ((type == MTH_TYPE_ARG) &&
-			(VALID_DESCRIPTOR_TYPE (*entry, ACPI_DESC_TYPE_NAMED)))
-		{
+		if ((opcode == AML_ARG_OP) &&
+			(VALID_DESCRIPTOR_TYPE (*entry, ACPI_DESC_TYPE_NAMED))) {
 			/* Detach an existing object from the Node */
 
 			acpi_ns_detach_object ((ACPI_NAMESPACE_NODE *) *entry);
@@ -655,20 +649,22 @@
 		}
 
 
+#ifdef ACPI_ENABLE_IMPLICIT_CONVERSION
 		/*
 		 * Perform "Implicit conversion" of the new object to the type of the
 		 * existing object
 		 */
-		status = acpi_aml_convert_to_target_type ((*entry)->common.type, &src_desc, walk_state);
+		status = acpi_ex_convert_to_target_type ((*entry)->common.type, &src_desc, walk_state);
 		if (ACPI_FAILURE (status)) {
 			goto cleanup;
 		}
+#endif
 
 		/*
 		 * Delete the existing object
 		 * before storing the new one
 		 */
-		acpi_ds_method_data_delete_value (type, index, walk_state);
+		acpi_ds_method_data_delete_value (opcode, index, walk_state);
 	}
 
 
@@ -678,7 +674,7 @@
 	 * Install the new object in the stack entry
 	 * (increments the object reference count by one)
 	 */
-	status = acpi_ds_method_data_set_entry (type, index, src_desc, walk_state);
+	status = acpi_ds_method_data_set_entry (opcode, index, src_desc, walk_state);
 	if (ACPI_FAILURE (status)) {
 		goto cleanup;
 	}
diff -urN linux-2.4.6-pre4/drivers/acpi/dispatcher/dsobject.c linux/drivers/acpi/dispatcher/dsobject.c
--- linux-2.4.6-pre4/drivers/acpi/dispatcher/dsobject.c	Fri Feb  9 11:45:58 2001
+++ linux/drivers/acpi/dispatcher/dsobject.c	Mon Dec  3 22:48:41 2001
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: dsobject - Dispatcher object management routines
- *              $Revision: 57 $
+ *              $Revision: 65 $
  *
  *****************************************************************************/
 
@@ -31,7 +31,7 @@
 #include "acinterp.h"
 #include "acnamesp.h"
 
-#define _COMPONENT          DISPATCHER
+#define _COMPONENT          ACPI_DISPATCHER
 	 MODULE_NAME         ("dsobject")
 
 
@@ -62,12 +62,15 @@
 	void                    *context,
 	void                    **return_value)
 {
-	OBJECT_TYPE_INTERNAL    type;
+	ACPI_OBJECT_TYPE8       type;
 	ACPI_STATUS             status;
 	ACPI_INIT_WALK_INFO     *info = (ACPI_INIT_WALK_INFO *) context;
 	u8                      table_revision;
 
 
+	PROC_NAME ("Ds_init_one_object");
+
+
 	info->object_count++;
 	table_revision = info->table_desc->pointer->revision;
 
@@ -77,8 +80,7 @@
 	 */
 
 	if (((ACPI_NAMESPACE_NODE *) obj_handle)->owner_id !=
-			info->table_desc->table_id)
-	{
+			info->table_desc->table_id) {
 		return (AE_OK);
 	}
 
@@ -87,8 +89,7 @@
 
 	type = acpi_ns_get_type (obj_handle);
 
-	switch (type)
-	{
+	switch (type) {
 
 	case ACPI_TYPE_REGION:
 
@@ -174,9 +175,8 @@
 
 	/* Walk entire namespace from the supplied root */
 
-	status = acpi_walk_namespace (ACPI_TYPE_ANY, start_node,
-			  ACPI_UINT32_MAX, acpi_ds_init_one_object,
-			  &info, NULL);
+	status = acpi_walk_namespace (ACPI_TYPE_ANY, start_node, ACPI_UINT32_MAX,
+			  acpi_ds_init_one_object, &info, NULL);
 
 	return (AE_OK);
 }
@@ -212,6 +212,9 @@
 	ACPI_OPCODE_INFO        *op_info;
 
 
+	PROC_NAME ("Ds_init_object_from_op");
+
+
 	op_info = acpi_ps_get_opcode_info (opcode);
 	if (ACPI_GET_OP_TYPE (op_info) != ACPI_OP_TYPE_OPCODE) {
 		/* Unknown opcode */
@@ -222,8 +225,7 @@
 
 	/* Get and prepare the first argument */
 
-	switch ((*obj_desc)->common.type)
-	{
+	switch ((*obj_desc)->common.type) {
 	case ACPI_TYPE_BUFFER:
 
 		/* First arg is a number */
@@ -234,23 +236,23 @@
 
 		/* Resolve the object (could be an arg or local) */
 
-		status = acpi_aml_resolve_to_value (&arg_desc, walk_state);
+		status = acpi_ex_resolve_to_value (&arg_desc, walk_state);
 		if (ACPI_FAILURE (status)) {
-			acpi_cm_remove_reference (arg_desc);
+			acpi_ut_remove_reference (arg_desc);
 			return (status);
 		}
 
 		/* We are expecting a number */
 
 		if (arg_desc->common.type != ACPI_TYPE_INTEGER) {
-			acpi_cm_remove_reference (arg_desc);
+			acpi_ut_remove_reference (arg_desc);
 			return (AE_TYPE);
 		}
 
 		/* Get the value, delete the internal object */
 
 		(*obj_desc)->buffer.length = (u32) arg_desc->integer.value;
-		acpi_cm_remove_reference (arg_desc);
+		acpi_ut_remove_reference (arg_desc);
 
 		/* Allocate the buffer */
 
@@ -262,7 +264,7 @@
 
 		else {
 			(*obj_desc)->buffer.pointer =
-					  acpi_cm_callocate ((*obj_desc)->buffer.length);
+					  acpi_ut_callocate ((*obj_desc)->buffer.length);
 
 			if (!(*obj_desc)->buffer.pointer) {
 				return (AE_NO_MEMORY);
@@ -279,7 +281,7 @@
 		arg = op->value.arg;
 		byte_list = (ACPI_PARSE2_OBJECT *) arg->next;
 		if (byte_list) {
-			if (byte_list->opcode != AML_BYTELIST_OP) {
+			if (byte_list->opcode != AML_INT_BYTELIST_OP) {
 				return (AE_TYPE);
 			}
 
@@ -300,7 +302,7 @@
 		 *  so that it is deleted.  Error checking is done
 		 *  within the remove reference function.
 		 */
-		acpi_cm_remove_reference(*obj_desc);
+		acpi_ut_remove_reference(*obj_desc);
 
 		status = acpi_ds_build_internal_object (walk_state, op, obj_desc);
 		break;
@@ -322,13 +324,12 @@
 
 	case INTERNAL_TYPE_REFERENCE:
 
-		switch (ACPI_GET_OP_CLASS (op_info))
-		{
+		switch (ACPI_GET_OP_CLASS (op_info)) {
 		case OPTYPE_LOCAL_VARIABLE:
 
 			/* Split the opcode into a base opcode + offset */
 
-			(*obj_desc)->reference.op_code = AML_LOCAL_OP;
+			(*obj_desc)->reference.opcode = AML_LOCAL_OP;
 			(*obj_desc)->reference.offset = opcode - AML_LOCAL_OP;
 			break;
 
@@ -336,19 +337,19 @@
 
 			/* Split the opcode into a base opcode + offset */
 
-			(*obj_desc)->reference.op_code = AML_ARG_OP;
+			(*obj_desc)->reference.opcode = AML_ARG_OP;
 			(*obj_desc)->reference.offset = opcode - AML_ARG_OP;
 			break;
 
 		default: /* Constants, Literals, etc.. */
 
-			if (op->opcode == AML_NAMEPATH_OP) {
+			if (op->opcode == AML_INT_NAMEPATH_OP) {
 				/* Node was saved in Op */
 
 				(*obj_desc)->reference.node = op->node;
 			}
 
-			(*obj_desc)->reference.op_code = opcode;
+			(*obj_desc)->reference.opcode = opcode;
 			break;
 		}
 
@@ -385,13 +386,13 @@
 	ACPI_OPERAND_OBJECT     **obj_desc_ptr)
 {
 	ACPI_OPERAND_OBJECT     *obj_desc;
-	OBJECT_TYPE_INTERNAL    type;
+	ACPI_OBJECT_TYPE8       type;
 	ACPI_STATUS             status;
 	u32                     length;
 	char                    *name;
 
 
-	if (op->opcode == AML_NAMEPATH_OP) {
+	if (op->opcode == AML_INT_NAMEPATH_OP) {
 		/*
 		 * This is an object reference.  If The name was
 		 * previously looked up in the NS, it is stored in this op.
@@ -414,7 +415,7 @@
 					if (name) {
 						REPORT_WARNING (("Reference %s at AML %X not found\n",
 								 name, op->aml_offset));
-						acpi_cm_free (name);
+						acpi_ut_free (name);
 					}
 					else {
 						REPORT_WARNING (("Reference %s at AML %X not found\n",
@@ -444,16 +445,14 @@
 
 	/* Create and init the internal ACPI object */
 
-	obj_desc = acpi_cm_create_internal_object (type);
+	obj_desc = acpi_ut_create_internal_object (type);
 	if (!obj_desc) {
 		return (AE_NO_MEMORY);
 	}
 
-	status = acpi_ds_init_object_from_op (walk_state, op,
-			 op->opcode, &obj_desc);
-
+	status = acpi_ds_init_object_from_op (walk_state, op, op->opcode, &obj_desc);
 	if (ACPI_FAILURE (status)) {
-		acpi_cm_remove_reference (obj_desc);
+		acpi_ut_remove_reference (obj_desc);
 		return (status);
 	}
 
@@ -488,7 +487,7 @@
 	ACPI_STATUS             status = AE_OK;
 
 
-	obj_desc = acpi_cm_create_internal_object (ACPI_TYPE_PACKAGE);
+	obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_PACKAGE);
 	if (!obj_desc) {
 		return (AE_NO_MEMORY);
 	}
@@ -505,15 +504,10 @@
 	 */
 
 	obj_desc->package.elements =
-			 acpi_cm_callocate ((obj_desc->package.count + 1) *
-			 sizeof (void *));
+		acpi_ut_callocate ((obj_desc->package.count + 1) * sizeof (void *));
 
 	if (!obj_desc->package.elements) {
-		/* Package vector allocation failure   */
-
-		REPORT_ERROR (("Ds_build_internal_package_obj: Package vector allocation failure\n"));
-
-		acpi_cm_delete_object_desc (obj_desc);
+		acpi_ut_delete_object_desc (obj_desc);
 		return (AE_NO_MEMORY);
 	}
 
@@ -568,13 +562,11 @@
 
 
 	if (op->opcode == AML_PACKAGE_OP) {
-		status = acpi_ds_build_internal_package_obj (walk_state, op,
-				  obj_desc_ptr);
+		status = acpi_ds_build_internal_package_obj (walk_state, op, obj_desc_ptr);
 	}
 
 	else {
-		status = acpi_ds_build_internal_simple_obj (walk_state, op,
-				  obj_desc_ptr);
+		status = acpi_ds_build_internal_simple_obj (walk_state, op, obj_desc_ptr);
 	}
 
 	return (status);
@@ -613,8 +605,7 @@
 
 	/* Build an internal object for the argument(s) */
 
-	status = acpi_ds_build_internal_object (walk_state,
-			 op->value.arg, &obj_desc);
+	status = acpi_ds_build_internal_object (walk_state, op->value.arg, &obj_desc);
 	if (ACPI_FAILURE (status)) {
 		return (status);
 	}
@@ -626,8 +617,7 @@
 
 	/* Init obj */
 
-	status = acpi_ns_attach_object ((ACPI_HANDLE) node, obj_desc,
-			   (u8) node->type);
+	status = acpi_ns_attach_object (node, obj_desc, (u8) node->type);
 	if (ACPI_FAILURE (status)) {
 		goto cleanup;
 	}
@@ -637,7 +627,7 @@
 
 cleanup:
 
-	acpi_cm_remove_reference (obj_desc);
+	acpi_ut_remove_reference (obj_desc);
 
 	return (status);
 }
diff -urN linux-2.4.6-pre4/drivers/acpi/dispatcher/dsopcode.c linux/drivers/acpi/dispatcher/dsopcode.c
--- linux-2.4.6-pre4/drivers/acpi/dispatcher/dsopcode.c	Fri Feb  9 11:45:58 2001
+++ linux/drivers/acpi/dispatcher/dsopcode.c	Mon Dec  3 22:48:41 2001
@@ -2,7 +2,7 @@
  *
  * Module Name: dsopcode - Dispatcher Op Region support and handling of
  *                         "control" opcodes
- *              $Revision: 32 $
+ *              $Revision: 44 $
  *
  *****************************************************************************/
 
@@ -34,25 +34,25 @@
 #include "acevents.h"
 #include "actables.h"
 
-#define _COMPONENT          DISPATCHER
+#define _COMPONENT          ACPI_DISPATCHER
 	 MODULE_NAME         ("dsopcode")
 
 
 /*****************************************************************************
  *
- * FUNCTION:    Acpi_ds_get_field_unit_arguments
+ * FUNCTION:    Acpi_ds_get_buffer_field_arguments
  *
- * PARAMETERS:  Obj_desc        - A valid Field_unit object
+ * PARAMETERS:  Obj_desc        - A valid Buffer_field object
  *
  * RETURN:      Status.
  *
- * DESCRIPTION: Get Field_unit Buffer and Index. This implements the late
+ * DESCRIPTION: Get Buffer_field Buffer and Index. This implements the late
  *              evaluation of these field attributes.
  *
  ****************************************************************************/
 
 ACPI_STATUS
-acpi_ds_get_field_unit_arguments (
+acpi_ds_get_buffer_field_arguments (
 	ACPI_OPERAND_OBJECT     *obj_desc)
 {
 	ACPI_OPERAND_OBJECT     *extra_desc;
@@ -68,10 +68,10 @@
 	}
 
 
-	/* Get the AML pointer (method object) and Field_unit node */
+	/* Get the AML pointer (method object) and Buffer_field node */
 
-	extra_desc = obj_desc->field_unit.extra;
-	node = obj_desc->field_unit.node;
+	extra_desc = obj_desc->buffer_field.extra;
+	node = obj_desc->buffer_field.node;
 
 	/*
 	 * Allocate a new parser op to be the root of the parsed
@@ -94,7 +94,7 @@
 		return (status);
 	}
 
-	/* Pass1: Parse the entire Field_unit declaration */
+	/* Pass1: Parse the entire Buffer_field declaration */
 
 	status = acpi_ps_parse_aml (op, extra_desc->extra.pcode,
 			  extra_desc->extra.pcode_length, 0,
@@ -138,8 +138,8 @@
 	 * The pseudo-method object is no longer needed since the region is
 	 * now initialized
 	 */
-	acpi_cm_remove_reference (obj_desc->field_unit.extra);
-	obj_desc->field_unit.extra = NULL;
+	acpi_ut_remove_reference (obj_desc->buffer_field.extra);
+	obj_desc->buffer_field.extra = NULL;
 
 	return (status);
 }
@@ -278,29 +278,45 @@
 
 /*****************************************************************************
  *
- * FUNCTION:    Acpi_ds_eval_field_unit_operands
+ * FUNCTION:    Acpi_ds_eval_buffer_field_operands
  *
- * PARAMETERS:  Op              - A valid Field_unit Op object
+ * PARAMETERS:  Op              - A valid Buffer_field Op object
  *
  * RETURN:      Status
  *
- * DESCRIPTION: Get Field_unit Buffer and Index
- *              Called from Acpi_ds_exec_end_op during Field_unit parse tree walk
+ * DESCRIPTION: Get Buffer_field Buffer and Index
+ *              Called from Acpi_ds_exec_end_op during Buffer_field parse tree walk
+ *
+ * ACPI SPECIFICATION REFERENCES:
+ *  Each of the Buffer Field opcodes is defined as specified in in-line
+ *  comments below. For each one, use the following definitions.
+ *
+ *  Def_bit_field   :=  Bit_field_op    Src_buf Bit_idx Destination
+ *  Def_byte_field  :=  Byte_field_op   Src_buf Byte_idx Destination
+ *  Def_create_field := Create_field_op Src_buf Bit_idx Num_bits Name_string
+ *  Def_dWord_field :=  DWord_field_op  Src_buf Byte_idx Destination
+ *  Def_word_field  :=  Word_field_op   Src_buf Byte_idx Destination
+ *  Bit_index       :=  Term_arg=>Integer
+ *  Byte_index      :=  Term_arg=>Integer
+ *  Destination     :=  Name_string
+ *  Num_bits        :=  Term_arg=>Integer
+ *  Source_buf      :=  Term_arg=>Buffer
  *
  ****************************************************************************/
 
 ACPI_STATUS
-acpi_ds_eval_field_unit_operands (
+acpi_ds_eval_buffer_field_operands (
 	ACPI_WALK_STATE         *walk_state,
 	ACPI_PARSE_OBJECT       *op)
 {
 	ACPI_STATUS             status;
-	ACPI_OPERAND_OBJECT     *field_desc;
+	ACPI_OPERAND_OBJECT     *obj_desc;
 	ACPI_NAMESPACE_NODE     *node;
 	ACPI_PARSE_OBJECT       *next_op;
 	u32                     offset;
 	u32                     bit_offset;
-	u16                     bit_count;
+	u32                     bit_count;
+	u8                      field_flags;
 
 
 	ACPI_OPERAND_OBJECT     *res_desc = NULL;
@@ -311,12 +327,14 @@
 
 
 	/*
-	 * This is where we evaluate the address and length fields of the Op_field_unit declaration
+	 * This is where we evaluate the address and length fields of the
+	 * Create_xxx_field declaration
 	 */
 
 	node =  op->node;
 
 	/* Next_op points to the op that holds the Buffer */
+
 	next_op = op->value.arg;
 
 	/* Acpi_evaluate/create the address and length operands */
@@ -326,15 +344,15 @@
 		return (status);
 	}
 
-	field_desc = acpi_ns_get_attached_object (node);
-	if (!field_desc) {
+	obj_desc = acpi_ns_get_attached_object (node);
+	if (!obj_desc) {
 		return (AE_NOT_EXIST);
 	}
 
 
 	/* Resolve the operands */
 
-	status = acpi_aml_resolve_operands (op->opcode, WALK_OPERANDS, walk_state);
+	status = acpi_ex_resolve_operands (op->opcode, WALK_OPERANDS, walk_state);
 
 	/* Get the operands */
 
@@ -359,7 +377,7 @@
 
 	/*
 	 * If Res_desc is a Name, it will be a direct name pointer after
-	 * Acpi_aml_resolve_operands()
+	 * Acpi_ex_resolve_operands()
 	 */
 
 	if (!VALID_DESCRIPTOR_TYPE (res_desc, ACPI_DESC_TYPE_NAMED)) {
@@ -372,61 +390,77 @@
 	 * Setup the Bit offsets and counts, according to the opcode
 	 */
 
-	switch (op->opcode)
-	{
+	switch (op->opcode) {
+
+	/* Def_create_field */
+
+	case AML_CREATE_FIELD_OP:
+
+		/* Offset is in bits, count is in bits */
+
+		bit_offset  = offset;
+		bit_count   = (u32) cnt_desc->integer.value;
+		field_flags = ACCESS_BYTE_ACC;
+		break;
+
 
 	/* Def_create_bit_field */
 
-	case AML_BIT_FIELD_OP:
+	case AML_CREATE_BIT_FIELD_OP:
 
-		/* Offset is in bits, Field is a bit */
+		/* Offset is in bits, Field is one bit */
 
-		bit_offset = offset;
-		bit_count = 1;
+		bit_offset  = offset;
+		bit_count   = 1;
+		field_flags = ACCESS_BYTE_ACC;
 		break;
 
 
 	/* Def_create_byte_field */
 
-	case AML_BYTE_FIELD_OP:
+	case AML_CREATE_BYTE_FIELD_OP:
 
-		/* Offset is in bytes, field is a byte */
+		/* Offset is in bytes, field is one byte */
 
-		bit_offset = 8 * offset;
-		bit_count = 8;
+		bit_offset  = 8 * offset;
+		bit_count   = 8;
+		field_flags = ACCESS_BYTE_ACC;
 		break;
 
 
 	/* Def_create_word_field */
 
-	case AML_WORD_FIELD_OP:
+	case AML_CREATE_WORD_FIELD_OP:
 
-		/* Offset is in bytes, field is a word */
+		/* Offset is in bytes, field is one word */
 
-		bit_offset = 8 * offset;
-		bit_count = 16;
+		bit_offset  = 8 * offset;
+		bit_count   = 16;
+		field_flags = ACCESS_WORD_ACC;
 		break;
 
 
 	/* Def_create_dWord_field */
 
-	case AML_DWORD_FIELD_OP:
+	case AML_CREATE_DWORD_FIELD_OP:
 
-		/* Offset is in bytes, field is a dword */
+		/* Offset is in bytes, field is one dword */
 
-		bit_offset = 8 * offset;
-		bit_count = 32;
+		bit_offset  = 8 * offset;
+		bit_count   = 32;
+		field_flags = ACCESS_DWORD_ACC;
 		break;
 
 
-	/* Def_create_field */
+	/* Def_create_qWord_field */
 
-	case AML_CREATE_FIELD_OP:
+	case AML_CREATE_QWORD_FIELD_OP:
 
-		/* Offset is in bits, count is in bits */
+		/* Offset is in bytes, field is one qword */
 
-		bit_offset = offset;
-		bit_count = (u16) cnt_desc->integer.value;
+		bit_offset  = 8 * offset;
+		bit_count   = 64;
+		field_flags = ACCESS_QWORD_ACC;
 		break;
 
 
@@ -441,35 +475,35 @@
 	 * Setup field according to the object type
 	 */
 
-	switch (src_desc->common.type)
-	{
+	switch (src_desc->common.type) {
 
 	/* Source_buff :=  Term_arg=>Buffer */
 
 	case ACPI_TYPE_BUFFER:
 
-		if (bit_offset + (u32) bit_count >
-			(8 * (u32) src_desc->buffer.length))
-		{
+		if ((bit_offset + bit_count) >
+			(8 * (u32) src_desc->buffer.length)) {
 			status = AE_AML_BUFFER_LIMIT;
 			goto cleanup;
 		}
 
 
-		/* Construct the remainder of the field object */
+		/*
+		 * Initialize areas of the field object that are common to all fields
+		 * For Field_flags, use LOCK_RULE = 0 (NO_LOCK), UPDATE_RULE = 0 (UPDATE_PRESERVE)
+		 */
+		status = acpi_ex_prep_common_field_object (obj_desc, field_flags,
+				  bit_offset, bit_count);
+		if (ACPI_FAILURE (status)) {
+			return (status);
+		}
 
-		field_desc->field_unit.access     = (u8) ACCESS_ANY_ACC;
-		field_desc->field_unit.lock_rule  = (u8) GLOCK_NEVER_LOCK;
-		field_desc->field_unit.update_rule = (u8) UPDATE_PRESERVE;
-		field_desc->field_unit.length     = bit_count;
-		field_desc->field_unit.bit_offset = (u8) (bit_offset % 8);
-		field_desc->field_unit.offset     = DIV_8 (bit_offset);
-		field_desc->field_unit.container  = src_desc;
+		obj_desc->buffer_field.buffer_obj = src_desc;
 
-		/* Reference count for Src_desc inherits Field_desc count */
+		/* Reference count for Src_desc inherits Obj_desc count */
 
 		src_desc->common.reference_count = (u16) (src_desc->common.reference_count +
-				   field_desc->common.reference_count);
+				  obj_desc->common.reference_count);
 
 		break;
 
@@ -478,8 +512,6 @@
 
 	default:
 
-		if ((src_desc->common.type > (u8) INTERNAL_TYPE_REFERENCE) ||
-			!acpi_cm_valid_object_type (src_desc->common.type))
 
 
 		status = AE_AML_OPERAND_TYPE;
@@ -490,7 +522,7 @@
 	if (AML_CREATE_FIELD_OP == op->opcode) {
 		/* Delete object descriptor unique to Create_field */
 
-		acpi_cm_remove_reference (cnt_desc);
+		acpi_ut_remove_reference (cnt_desc);
 		cnt_desc = NULL;
 	}
 
@@ -499,23 +531,23 @@
 
 	/* Always delete the operands */
 
-	acpi_cm_remove_reference (off_desc);
-	acpi_cm_remove_reference (src_desc);
+	acpi_ut_remove_reference (off_desc);
+	acpi_ut_remove_reference (src_desc);
 
 	if (AML_CREATE_FIELD_OP == op->opcode) {
-		acpi_cm_remove_reference (cnt_desc);
+		acpi_ut_remove_reference (cnt_desc);
 	}
 
 	/* On failure, delete the result descriptor */
 
 	if (ACPI_FAILURE (status)) {
-		acpi_cm_remove_reference (res_desc); /* Result descriptor */
+		acpi_ut_remove_reference (res_desc); /* Result descriptor */
 	}
 
 	else {
-		/* Now the address and length are valid for this op_field_unit */
+		/* Now the address and length are valid for this Buffer_field */
 
-		field_desc->field_unit.flags |= AOPOBJ_DATA_VALID;
+		obj_desc->buffer_field.flags |= AOPOBJ_DATA_VALID;
 	}
 
 	return (status);
@@ -568,7 +600,7 @@
 
 	/* Resolve the length and address operands to numbers */
 
-	status = acpi_aml_resolve_operands (op->opcode, WALK_OPERANDS, walk_state);
+	status = acpi_ex_resolve_operands (op->opcode, WALK_OPERANDS, walk_state);
 	if (ACPI_FAILURE (status)) {
 		return (status);
 	}
@@ -586,7 +618,7 @@
 	operand_desc = walk_state->operands[walk_state->num_operands - 1];
 
 	obj_desc->region.length = (u32) operand_desc->integer.value;
-	acpi_cm_remove_reference (operand_desc);
+	acpi_ut_remove_reference (operand_desc);
 
 	/*
 	 * Get the address and save it
@@ -595,7 +627,7 @@
 	operand_desc = walk_state->operands[walk_state->num_operands - 2];
 
 	obj_desc->region.address = (ACPI_PHYSICAL_ADDRESS) operand_desc->integer.value;
-	acpi_cm_remove_reference (operand_desc);
+	acpi_ut_remove_reference (operand_desc);
 
 
 	/* Now the address and length are valid for this opregion */
@@ -629,8 +661,10 @@
 	ACPI_GENERIC_STATE      *control_state;
 
 
-	switch (op->opcode)
-	{
+	PROC_NAME ("Ds_exec_begin_control_op");
+
+
+	switch (op->opcode) {
 	case AML_IF_OP:
 	case AML_WHILE_OP:
 
@@ -640,13 +674,13 @@
 		 * to handle nesting.
 		 */
 
-		control_state = acpi_cm_create_control_state ();
+		control_state = acpi_ut_create_control_state ();
 		if (!control_state) {
 			status = AE_NO_MEMORY;
 			break;
 		}
 
-		acpi_cm_push_generic_state (&walk_state->control_state, control_state);
+		acpi_ut_push_generic_state (&walk_state->control_state, control_state);
 
 		/*
 		 * Save a pointer to the predicate for multiple executions
@@ -708,8 +742,10 @@
 	ACPI_GENERIC_STATE      *control_state;
 
 
-	switch (op->opcode)
-	{
+	PROC_NAME ("Ds_exec_end_control_op");
+
+
+	switch (op->opcode) {
 	case AML_IF_OP:
 
 		/*
@@ -718,18 +754,15 @@
 		 */
 
 		walk_state->last_predicate =
-				(u8) walk_state->control_state->common.value;
+			(u8) walk_state->control_state->common.value;
 
 		/*
 		 * Pop the control state that was created at the start
 		 * of the IF and free it
 		 */
 
-		control_state =
-				acpi_cm_pop_generic_state (&walk_state->control_state);
-
-		acpi_cm_delete_generic_state (control_state);
-
+		control_state = acpi_ut_pop_generic_state (&walk_state->control_state);
+		acpi_ut_delete_generic_state (control_state);
 		break;
 
 
@@ -746,15 +779,12 @@
 			status = AE_CTRL_PENDING;
 		}
 
-
 		/* Pop this control state and free it */
 
-		control_state =
-				acpi_cm_pop_generic_state (&walk_state->control_state);
+		control_state = acpi_ut_pop_generic_state (&walk_state->control_state);
 
 		walk_state->aml_last_while = control_state->control.aml_predicate_start;
-		acpi_cm_delete_generic_state (control_state);
-
+		acpi_ut_delete_generic_state (control_state);
 		break;
 
 
@@ -779,8 +809,7 @@
 			 * an arg or local), resolve it now because it may
 			 * cease to exist at the end of the method.
 			 */
-
-			status = acpi_aml_resolve_to_value (&walk_state->operands [0], walk_state);
+			status = acpi_ex_resolve_to_value (&walk_state->operands [0], walk_state);
 			if (ACPI_FAILURE (status)) {
 				return (status);
 			}
@@ -795,19 +824,24 @@
 		}
 
 		else if ((walk_state->results) &&
-				 (walk_state->results->results.num_results > 0))
-		{
+				 (walk_state->results->results.num_results > 0)) {
 			/*
 			 * The return value has come from a previous calculation.
 			 *
 			 * If value being returned is a Reference (such as
 			 * an arg or local), resolve it now because it may
 			 * cease to exist at the end of the method.
+			 *
+			 * Allow references created by the Index operator to return unchanged.
 			 */
 
-			status = acpi_aml_resolve_to_value (&walk_state->results->results.obj_desc [0], walk_state);
-			if (ACPI_FAILURE (status)) {
-				return (status);
+			if (VALID_DESCRIPTOR_TYPE (walk_state->results->results.obj_desc [0], ACPI_DESC_TYPE_INTERNAL) &&
+				((walk_state->results->results.obj_desc [0])->common.type == INTERNAL_TYPE_REFERENCE) &&
+				((walk_state->results->results.obj_desc [0])->reference.opcode != AML_INDEX_OP)) {
+					status = acpi_ex_resolve_to_value (&walk_state->results->results.obj_desc [0], walk_state);
+					if (ACPI_FAILURE (status)) {
+						return (status);
+					}
 			}
 
 			walk_state->return_desc = walk_state->results->results.obj_desc [0];
@@ -817,7 +851,7 @@
 			/* No return operand */
 
 			if (walk_state->num_operands) {
-				acpi_cm_remove_reference (walk_state->operands [0]);
+				acpi_ut_remove_reference (walk_state->operands [0]);
 			}
 
 			walk_state->operands [0]    = NULL;
diff -urN linux-2.4.6-pre4/drivers/acpi/dispatcher/dsutils.c linux/drivers/acpi/dispatcher/dsutils.c
--- linux-2.4.6-pre4/drivers/acpi/dispatcher/dsutils.c	Mon Jan 22 13:23:42 2001
+++ linux/drivers/acpi/dispatcher/dsutils.c	Mon Dec  3 22:48:41 2001
@@ -1,7 +1,7 @@
 /*******************************************************************************
  *
  * Module Name: dsutils - Dispatcher utilities
- *              $Revision: 52 $
+ *              $Revision: 58 $
  *
  ******************************************************************************/
 
@@ -32,7 +32,7 @@
 #include "acnamesp.h"
 #include "acdebug.h"
 
-#define _COMPONENT          PARSER
+#define _COMPONENT          ACPI_DISPATCHER
 	 MODULE_NAME         ("dsutils")
 
 
@@ -93,15 +93,13 @@
 	 * as an operand later.
 	 */
 
-	switch (ACPI_GET_OP_CLASS (parent_info))
-	{
+	switch (ACPI_GET_OP_CLASS (parent_info)) {
 	/*
 	 * In these cases, the parent will never use the return object
 	 */
 	case OPTYPE_CONTROL:        /* IF, ELSE, WHILE only */
 
-		switch (op->parent->opcode)
-		{
+		switch (op->parent->opcode) {
 		case AML_RETURN_OP:
 
 			/* Never delete the return value associated with a return opcode */
@@ -118,8 +116,7 @@
 			 */
 
 			if ((walk_state->control_state->common.state == CONTROL_PREDICATE_EXECUTING) &&
-				(walk_state->control_state->control.predicate_op == op))
-			{
+				(walk_state->control_state->control.predicate_op == op)) {
 				return (TRUE);
 			}
 
@@ -136,14 +133,13 @@
 		 * These opcodes allow Term_arg(s) as operands and therefore
 		 * method calls.  The result is used.
 		 */
-		if ((op->parent->opcode == AML_REGION_OP)       ||
-			(op->parent->opcode == AML_CREATE_FIELD_OP) ||
-			(op->parent->opcode == AML_BIT_FIELD_OP)    ||
-			(op->parent->opcode == AML_BYTE_FIELD_OP)   ||
-			(op->parent->opcode == AML_WORD_FIELD_OP)   ||
-			(op->parent->opcode == AML_DWORD_FIELD_OP)  ||
-			(op->parent->opcode == AML_QWORD_FIELD_OP))
-		{
+		if ((op->parent->opcode == AML_REGION_OP)               ||
+			(op->parent->opcode == AML_CREATE_FIELD_OP)         ||
+			(op->parent->opcode == AML_CREATE_BIT_FIELD_OP)     ||
+			(op->parent->opcode == AML_CREATE_BYTE_FIELD_OP)    ||
+			(op->parent->opcode == AML_CREATE_WORD_FIELD_OP)    ||
+			(op->parent->opcode == AML_CREATE_DWORD_FIELD_OP)   ||
+			(op->parent->opcode == AML_CREATE_QWORD_FIELD_OP)) {
 			return (TRUE);
 		}
 
@@ -206,7 +202,7 @@
 
 		status = acpi_ds_result_pop (&obj_desc, walk_state);
 		if (ACPI_SUCCESS (status)) {
-			acpi_cm_remove_reference (result_obj);
+			acpi_ut_remove_reference (result_obj);
 		}
 	}
 
@@ -239,7 +235,7 @@
 	ACPI_STATUS             status = AE_OK;
 	NATIVE_CHAR             *name_string;
 	u32                     name_length;
-	OBJECT_TYPE_INTERNAL    data_type;
+	ACPI_OBJECT_TYPE8       data_type;
 	ACPI_OPERAND_OBJECT     *obj_desc;
 	ACPI_PARSE_OBJECT       *parent_op;
 	u16                     opcode;
@@ -249,15 +245,12 @@
 
 	/* A valid name must be looked up in the namespace */
 
-	if ((arg->opcode == AML_NAMEPATH_OP) &&
-		(arg->value.string))
-	{
+	if ((arg->opcode == AML_INT_NAMEPATH_OP) &&
+		(arg->value.string)) {
 		/* Get the entire name string from the AML stream */
 
-		status = acpi_aml_get_name_string (ACPI_TYPE_ANY,
-				   arg->value.buffer,
-				   &name_string,
-				   &name_length);
+		status = acpi_ex_get_name_string (ACPI_TYPE_ANY, arg->value.buffer,
+				  &name_string, &name_length);
 
 		if (ACPI_FAILURE (status)) {
 			return (status);
@@ -277,10 +270,9 @@
 
 		parent_op = arg->parent;
 		if ((acpi_ps_is_node_op (parent_op->opcode)) &&
-			(parent_op->opcode != AML_METHODCALL_OP) &&
+			(parent_op->opcode != AML_INT_METHODCALL_OP) &&
 			(parent_op->opcode != AML_REGION_OP) &&
-			(parent_op->opcode != AML_NAMEPATH_OP))
-		{
+			(parent_op->opcode != AML_INT_NAMEPATH_OP)) {
 			/* Enter name into namespace if not found */
 
 			interpreter_mode = IMODE_LOAD_PASS2;
@@ -300,7 +292,7 @@
 
 		/* Free the namestring created above */
 
-		acpi_cm_free (name_string);
+		acpi_ut_free (name_string);
 
 		/*
 		 * The only case where we pass through (ignore) a NOT_FOUND
@@ -347,7 +339,7 @@
 	else {
 		/* Check for null name case */
 
-		if (arg->opcode == AML_NAMEPATH_OP) {
+		if (arg->opcode == AML_INT_NAMEPATH_OP) {
 			/*
 			 * If the name is null, this means that this is an
 			 * optional result parameter that was not specified
@@ -381,7 +373,6 @@
 			 * Use value that was already previously returned
 			 * by the evaluation of this argument
 			 */
-
 			status = acpi_ds_result_pop_from_bottom (&obj_desc, walk_state);
 			if (ACPI_FAILURE (status)) {
 				/*
@@ -396,7 +387,7 @@
 		else {
 			/* Create an ACPI_INTERNAL_OBJECT for the argument */
 
-			obj_desc = acpi_cm_create_internal_object (data_type);
+			obj_desc = acpi_ut_create_internal_object (data_type);
 			if (!obj_desc) {
 				return (AE_NO_MEMORY);
 			}
@@ -406,7 +397,7 @@
 			status = acpi_ds_init_object_from_op (walk_state, arg,
 					 opcode, &obj_desc);
 			if (ACPI_FAILURE (status)) {
-				acpi_cm_delete_object_desc (obj_desc);
+				acpi_ut_delete_object_desc (obj_desc);
 				return (status);
 			}
 	   }
@@ -509,11 +500,11 @@
 
 	/*
 	 * TBD: [Investigate] Note from previous parser:
-	 *   Ref_of problem with Acpi_aml_resolve_to_value() conversion.
+	 *   Ref_of problem with Acpi_ex_resolve_to_value() conversion.
 	 */
 
 	for (i = 0; i < walk_state->num_operands; i++) {
-		status = acpi_aml_resolve_to_value (&walk_state->operands[i], walk_state);
+		status = acpi_ex_resolve_to_value (&walk_state->operands[i], walk_state);
 		if (ACPI_FAILURE (status)) {
 			break;
 		}
@@ -538,16 +529,19 @@
  *
  ******************************************************************************/
 
-OBJECT_TYPE_INTERNAL
+ACPI_OBJECT_TYPE8
 acpi_ds_map_opcode_to_data_type (
 	u16                     opcode,
 	u32                     *out_flags)
 {
-	OBJECT_TYPE_INTERNAL    data_type = INTERNAL_TYPE_INVALID;
+	ACPI_OBJECT_TYPE8       data_type = INTERNAL_TYPE_INVALID;
 	ACPI_OPCODE_INFO        *op_info;
 	u32                     flags = 0;
 
 
+	PROC_NAME ("Ds_map_opcode_to_data_type");
+
+
 	op_info = acpi_ps_get_opcode_info (opcode);
 	if (ACPI_GET_OP_TYPE (op_info) != ACPI_OP_TYPE_OPCODE) {
 		/* Unknown opcode */
@@ -555,13 +549,11 @@
 		return (data_type);
 	}
 
-	switch (ACPI_GET_OP_CLASS (op_info))
-	{
+	switch (ACPI_GET_OP_CLASS (op_info)) {
 
 	case OPTYPE_LITERAL:
 
-		switch (opcode)
-		{
+		switch (opcode) {
 		case AML_BYTE_OP:
 		case AML_WORD_OP:
 		case AML_DWORD_OP:
@@ -575,7 +567,7 @@
 			data_type = ACPI_TYPE_STRING;
 			break;
 
-		case AML_NAMEPATH_OP:
+		case AML_INT_NAMEPATH_OP:
 			data_type = INTERNAL_TYPE_REFERENCE;
 			break;
 
@@ -587,8 +579,7 @@
 
 	case OPTYPE_DATA_TERM:
 
-		switch (opcode)
-		{
+		switch (opcode) {
 		case AML_BUFFER_OP:
 
 			data_type = ACPI_TYPE_BUFFER;
@@ -675,17 +666,16 @@
  *
  ******************************************************************************/
 
-OBJECT_TYPE_INTERNAL
+ACPI_OBJECT_TYPE8
 acpi_ds_map_named_opcode_to_data_type (
 	u16                     opcode)
 {
-	OBJECT_TYPE_INTERNAL    data_type;
+	ACPI_OBJECT_TYPE8       data_type;
 
 
 	/* Decode Opcode */
 
-	switch (opcode)
-	{
+	switch (opcode) {
 	case AML_SCOPE_OP:
 		data_type = INTERNAL_TYPE_SCOPE;
 		break;
@@ -710,8 +700,8 @@
 		data_type = ACPI_TYPE_PROCESSOR;
 		break;
 
-	case AML_DEF_FIELD_OP:                          /* Def_field_op */
-		data_type = INTERNAL_TYPE_DEF_FIELD_DEFN;
+	case AML_FIELD_OP:                              /* Field_op */
+		data_type = INTERNAL_TYPE_FIELD_DEFN;
 		break;
 
 	case AML_INDEX_FIELD_OP:                        /* Index_field_op */
@@ -722,12 +712,12 @@
 		data_type = INTERNAL_TYPE_BANK_FIELD_DEFN;
 		break;
 
-	case AML_NAMEDFIELD_OP:                         /* NO CASE IN ORIGINAL  */
+	case AML_INT_NAMEDFIELD_OP:                     /* NO CASE IN ORIGINAL  */
 		data_type = ACPI_TYPE_ANY;
 		break;
 
 	case AML_NAME_OP:                               /* Name_op - special code in original */
-	case AML_NAMEPATH_OP:
+	case AML_INT_NAMEPATH_OP:
 		data_type = ACPI_TYPE_ANY;
 		break;
 
diff -urN linux-2.4.6-pre4/drivers/acpi/dispatcher/dswexec.c linux/drivers/acpi/dispatcher/dswexec.c
--- linux-2.4.6-pre4/drivers/acpi/dispatcher/dswexec.c	Mon Jan 29 10:15:58 2001
+++ linux/drivers/acpi/dispatcher/dswexec.c	Mon Dec  3 22:48:41 2001
@@ -2,7 +2,7 @@
  *
  * Module Name: dswexec - Dispatcher method execution callbacks;
  *                        dispatch to interpreter.
- *              $Revision: 55 $
+ *              $Revision: 61 $
  *
  *****************************************************************************/
 
@@ -34,7 +34,7 @@
 #include "acdebug.h"
 
 
-#define _COMPONENT          DISPATCHER
+#define _COMPONENT          ACPI_DISPATCHER
 	 MODULE_NAME         ("dswexec")
 
 
@@ -75,7 +75,7 @@
 			return (status);
 		}
 
-		status = acpi_aml_resolve_to_value (&walk_state->operands [0], walk_state);
+		status = acpi_ex_resolve_to_value (&walk_state->operands [0], walk_state);
 		if (ACPI_FAILURE (status)) {
 			return (status);
 		}
@@ -101,7 +101,7 @@
 
 	/* Truncate the predicate to 32-bits if necessary */
 
-	acpi_aml_truncate_for32bit_table (obj_desc, walk_state);
+	acpi_ex_truncate_for32bit_table (obj_desc, walk_state);
 
 	/*
 	 * Save the result of the predicate evaluation on
@@ -134,7 +134,7 @@
 	 * we don't need it anymore)
 	 */
 
-	acpi_cm_remove_reference (obj_desc);
+	acpi_ut_remove_reference (obj_desc);
 
 	walk_state->control_state->common.state = CONTROL_NORMAL;
 
@@ -194,8 +194,7 @@
 
 	if ((walk_state->control_state) &&
 		(walk_state->control_state->common.state ==
-			CONTROL_CONDITIONAL_EXECUTING))
-	{
+			CONTROL_CONDITIONAL_EXECUTING)) {
 		walk_state->control_state->common.state = CONTROL_PREDICATE_EXECUTING;
 
 		/* Save start of predicate */
@@ -208,7 +207,7 @@
 
 	/* We want to send namepaths to the load code */
 
-	if (op->opcode == AML_NAMEPATH_OP) {
+	if (op->opcode == AML_INT_NAMEPATH_OP) {
 		op_info->flags = OPTYPE_NAMED_OBJECT;
 	}
 
@@ -217,8 +216,7 @@
 	 * Handle the opcode based upon the opcode type
 	 */
 
-	switch (ACPI_GET_OP_CLASS (op_info))
-	{
+	switch (ACPI_GET_OP_CLASS (op_info)) {
 	case OPTYPE_CONTROL:
 
 		status = acpi_ds_result_stack_push (walk_state);
@@ -308,11 +306,9 @@
 	u16                     opcode;
 	u8                      optype;
 	ACPI_PARSE_OBJECT       *next_op;
-	ACPI_NAMESPACE_NODE     *node;
 	ACPI_PARSE_OBJECT       *first_arg;
 	ACPI_OPERAND_OBJECT     *result_obj = NULL;
 	ACPI_OPCODE_INFO        *op_info;
-	u32                     operand_index;
 
 
 	opcode = (u16) op->opcode;
@@ -342,8 +338,7 @@
 
 	/* Decode the opcode */
 
-	switch (optype)
-	{
+	switch (optype) {
 	case OPTYPE_UNDEFINED:
 
 		return (AE_NOT_IMPLEMENTED);
@@ -383,9 +378,6 @@
 			goto cleanup;
 		}
 
-		operand_index = walk_state->num_operands - 1;
-
-
 		/* Done with this result state (Now that operand stack is built) */
 
 		status = acpi_ds_result_stack_pop (walk_state);
@@ -393,13 +385,12 @@
 			goto cleanup;
 		}
 
-		switch (optype)
-		{
+		switch (optype) {
 		case OPTYPE_MONADIC1:
 
 			/* 1 Operand, 0 External_result, 0 Internal_result */
 
-			status = acpi_aml_exec_monadic1 (opcode, walk_state);
+			status = acpi_ex_monadic1 (opcode, walk_state);
 			break;
 
 
@@ -407,7 +398,7 @@
 
 			/* 1 Operand, 0 External_result, 1 Internal_result */
 
-			status = acpi_aml_exec_monadic2 (opcode, walk_state, &result_obj);
+			status = acpi_ex_monadic2 (opcode, walk_state, &result_obj);
 			break;
 
 
@@ -415,7 +406,7 @@
 
 			/* 1 Operand, 1 External_result, 1 Internal_result */
 
-			status = acpi_aml_exec_monadic2_r (opcode, walk_state, &result_obj);
+			status = acpi_ex_monadic2_r (opcode, walk_state, &result_obj);
 			break;
 
 
@@ -423,7 +414,7 @@
 
 			/* 2 Operands, 0 External_result, 0 Internal_result */
 
-			status = acpi_aml_exec_dyadic1 (opcode, walk_state);
+			status = acpi_ex_dyadic1 (opcode, walk_state);
 			break;
 
 
@@ -431,7 +422,7 @@
 
 			/* 2 Operands, 0 External_result, 1 Internal_result */
 
-			status = acpi_aml_exec_dyadic2 (opcode, walk_state, &result_obj);
+			status = acpi_ex_dyadic2 (opcode, walk_state, &result_obj);
 			break;
 
 
@@ -439,7 +430,7 @@
 
 			/* 2 Operands, 1 or 2 External_results, 1 Internal_result */
 
-			status = acpi_aml_exec_dyadic2_r (opcode, walk_state, &result_obj);
+			status = acpi_ex_dyadic2_r (opcode, walk_state, &result_obj);
 			break;
 
 
@@ -447,7 +438,7 @@
 
 			/* 2 Operands, 0 External_result, 1 Internal_result */
 
-			status = acpi_aml_exec_dyadic2_s (opcode, walk_state, &result_obj);
+			status = acpi_ex_dyadic2_s (opcode, walk_state, &result_obj);
 			break;
 
 
@@ -455,7 +446,7 @@
 
 			/* 3 Operands, 1 External_result, 1 Internal_result */
 
-			status = acpi_aml_exec_index (walk_state, &result_obj);
+			status = acpi_ex_index (walk_state, &result_obj);
 			break;
 
 
@@ -463,7 +454,7 @@
 
 			/* 6 Operands, 0 External_result, 1 Internal_result */
 
-			status = acpi_aml_exec_match (walk_state, &result_obj);
+			status = acpi_ex_match (walk_state, &result_obj);
 			break;
 
 
@@ -471,7 +462,7 @@
 
 			/* 1 or 2 operands, 0 Internal Result */
 
-			status = acpi_aml_exec_reconfiguration (opcode, walk_state);
+			status = acpi_ex_reconfiguration (opcode, walk_state);
 			break;
 
 
@@ -479,7 +470,7 @@
 
 			/* 3 Operands, 0 External_result, 0 Internal_result */
 
-			status = acpi_aml_exec_fatal (walk_state);
+			status = acpi_ex_fatal (walk_state);
 			break;
 		}
 
@@ -488,8 +479,7 @@
 		 * current result stack
 		 */
 		if (ACPI_SUCCESS (status) &&
-			result_obj)
-		{
+			result_obj) {
 			status = acpi_ds_result_push (result_obj, walk_state);
 		}
 
@@ -515,7 +505,6 @@
 		/* Next_op points to the op that holds the method name */
 
 		next_op = first_arg;
-		node = next_op->node;
 
 		/* Next_op points to first argument op */
 
@@ -562,7 +551,7 @@
 			break;
 		}
 
-		status = acpi_ds_eval_field_unit_operands (walk_state, op);
+		status = acpi_ds_eval_buffer_field_operands (walk_state, op);
 		break;
 
 
@@ -573,8 +562,7 @@
 			break;
 		}
 
-		switch (op->opcode)
-		{
+		switch (op->opcode) {
 		case AML_REGION_OP:
 
 			status = acpi_ds_eval_region_operands (walk_state, op);
@@ -617,7 +605,7 @@
 	 * ACPI 2.0 support for 64-bit integers:
 	 * Truncate numeric result value if we are executing from a 32-bit ACPI table
 	 */
-	acpi_aml_truncate_for32bit_table (result_obj, walk_state);
+	acpi_ex_truncate_for32bit_table (result_obj, walk_state);
 
 	/*
 	 * Check if we just completed the evaluation of a
@@ -627,8 +615,7 @@
 	if ((walk_state->control_state) &&
 		(walk_state->control_state->common.state ==
 			CONTROL_PREDICATE_EXECUTING) &&
-		(walk_state->control_state->control.predicate_op == op))
-	{
+		(walk_state->control_state->control.predicate_op == op)) {
 		status = acpi_ds_get_predicate_value (walk_state, op, (u32) result_obj);
 		result_obj = NULL;
 	}
diff -urN linux-2.4.6-pre4/drivers/acpi/dispatcher/dswload.c linux/drivers/acpi/dispatcher/dswload.c
--- linux-2.4.6-pre4/drivers/acpi/dispatcher/dswload.c	Mon Jan 22 13:23:42 2001
+++ linux/drivers/acpi/dispatcher/dswload.c	Mon Dec  3 22:48:41 2001
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: dswload - Dispatcher namespace load callbacks
- *              $Revision: 26 $
+ *              $Revision: 37 $
  *
  *****************************************************************************/
 
@@ -33,11 +33,11 @@
 #include "acevents.h"
 
 
-#define _COMPONENT          DISPATCHER
+#define _COMPONENT          ACPI_DISPATCHER
 	 MODULE_NAME         ("dswload")
 
 
-/*****************************************************************************
+/*******************************************************************************
  *
  * FUNCTION:    Acpi_ds_load1_begin_op
  *
@@ -49,7 +49,7 @@
  *
  * DESCRIPTION: Descending callback used during the loading of ACPI tables.
  *
- ****************************************************************************/
+ ******************************************************************************/
 
 ACPI_STATUS
 acpi_ds_load1_begin_op (
@@ -60,10 +60,12 @@
 {
 	ACPI_NAMESPACE_NODE     *node;
 	ACPI_STATUS             status;
-	OBJECT_TYPE_INTERNAL    data_type;
+	ACPI_OBJECT_TYPE8       data_type;
 	NATIVE_CHAR             *path;
 
 
+	PROC_NAME ("Ds_load1_begin_op");
+
 	/* We are only interested in opcodes that have an associated name */
 
 	if (!acpi_ps_is_named_op (opcode)) {
@@ -92,9 +94,8 @@
 	 * as we go downward in the parse tree.  Any necessary subobjects that involve
 	 * arguments to the opcode must be created as we go back up the parse tree later.
 	 */
-	status = acpi_ns_lookup (walk_state->scope_info, path,
-			 data_type, IMODE_LOAD_PASS1,
-			 NS_NO_UPSEARCH, walk_state, &(node));
+	status = acpi_ns_lookup (walk_state->scope_info, path, data_type,
+			  IMODE_LOAD_PASS1, NS_NO_UPSEARCH, walk_state, &(node));
 
 	if (ACPI_FAILURE (status)) {
 		return (status);
@@ -128,7 +129,7 @@
 }
 
 
-/*****************************************************************************
+/*******************************************************************************
  *
  * FUNCTION:    Acpi_ds_load1_end_op
  *
@@ -141,16 +142,17 @@
  * DESCRIPTION: Ascending callback used during the loading of the namespace,
  *              both control methods and everything else.
  *
- ****************************************************************************/
+ ******************************************************************************/
 
 ACPI_STATUS
 acpi_ds_load1_end_op (
 	ACPI_WALK_STATE         *walk_state,
 	ACPI_PARSE_OBJECT       *op)
 {
-	OBJECT_TYPE_INTERNAL    data_type;
+	ACPI_OBJECT_TYPE8       data_type;
 
 
+	PROC_NAME ("Ds_load1_end_op");
 	/* We are only interested in opcodes that have an associated name */
 
 	if (!acpi_ps_is_named_op (op->opcode)) {
@@ -177,7 +179,6 @@
 	/* Pop the scope stack */
 
 	if (acpi_ns_opens_scope (data_type)) {
-
 		acpi_ds_scope_stack_pop (walk_state);
 	}
 
@@ -186,7 +187,7 @@
 }
 
 
-/*****************************************************************************
+/*******************************************************************************
  *
  * FUNCTION:    Acpi_ds_load2_begin_op
  *
@@ -198,7 +199,7 @@
  *
  * DESCRIPTION: Descending callback used during the loading of ACPI tables.
  *
- ****************************************************************************/
+ ******************************************************************************/
 
 ACPI_STATUS
 acpi_ds_load2_begin_op (
@@ -209,16 +210,17 @@
 {
 	ACPI_NAMESPACE_NODE     *node;
 	ACPI_STATUS             status;
-	OBJECT_TYPE_INTERNAL    data_type;
+	ACPI_OBJECT_TYPE8       data_type;
 	NATIVE_CHAR             *buffer_ptr;
 	void                    *original = NULL;
 
 
+	PROC_NAME ("Ds_load2_begin_op");
+
 	/* We only care about Namespace opcodes here */
 
 	if (!acpi_ps_is_namespace_op (opcode) &&
-		opcode != AML_NAMEPATH_OP)
-	{
+		opcode != AML_INT_NAMEPATH_OP) {
 		return (AE_OK);
 	}
 
@@ -233,7 +235,7 @@
 		/*
 		 * Get the name we are going to enter or lookup in the namespace
 		 */
-		if (opcode == AML_NAMEPATH_OP) {
+		if (opcode == AML_INT_NAMEPATH_OP) {
 			/* For Namepath op, get the path string */
 
 			buffer_ptr = op->value.string;
@@ -261,15 +263,14 @@
 	data_type = acpi_ds_map_named_opcode_to_data_type (opcode);
 
 
-	if (opcode == AML_DEF_FIELD_OP      ||
+	if (opcode == AML_FIELD_OP          ||
 		opcode == AML_BANK_FIELD_OP     ||
-		opcode == AML_INDEX_FIELD_OP)
-	{
+		opcode == AML_INDEX_FIELD_OP) {
 		node = NULL;
 		status = AE_OK;
 	}
 
-	else if (opcode == AML_NAMEPATH_OP) {
+	else if (opcode == AML_INT_NAMEPATH_OP) {
 		/*
 		 * The Name_path is an object reference to an existing object. Don't enter the
 		 * name into the namespace, but look it up for use later
@@ -302,10 +303,8 @@
 		 * as we go downward in the parse tree.  Any necessary subobjects that involve
 		 * arguments to the opcode must be created as we go back up the parse tree later.
 		 */
-		status = acpi_ns_lookup (walk_state->scope_info, buffer_ptr,
-				 data_type, IMODE_EXECUTE,
-				 NS_NO_UPSEARCH, walk_state,
-				 &(node));
+		status = acpi_ns_lookup (walk_state->scope_info, buffer_ptr, data_type,
+				  IMODE_EXECUTE, NS_NO_UPSEARCH, walk_state, &(node));
 	}
 
 	if (ACPI_SUCCESS (status)) {
@@ -332,12 +331,11 @@
 
 	}
 
-
 	return (status);
 }
 
 
-/*****************************************************************************
+/*******************************************************************************
  *
  * FUNCTION:    Acpi_ds_load2_end_op
  *
@@ -350,7 +348,7 @@
  * DESCRIPTION: Ascending callback used during the loading of the namespace,
  *              both control methods and everything else.
  *
- ****************************************************************************/
+ ******************************************************************************/
 
 ACPI_STATUS
 acpi_ds_load2_end_op (
@@ -358,12 +356,13 @@
 	ACPI_PARSE_OBJECT       *op)
 {
 	ACPI_STATUS             status = AE_OK;
-	OBJECT_TYPE_INTERNAL    data_type;
+	ACPI_OBJECT_TYPE8      data_type;
 	ACPI_NAMESPACE_NODE     *node;
 	ACPI_PARSE_OBJECT       *arg;
 	ACPI_NAMESPACE_NODE     *new_node;
 
 
+	PROC_NAME ("Ds_load2_end_op");
 	if (!acpi_ps_is_namespace_object_op (op->opcode)) {
 		return (AE_OK);
 	}
@@ -422,6 +421,7 @@
 	 * AML_CREATEBYTEFIELD
 	 * AML_CREATEWORDFIELD
 	 * AML_CREATEDWORDFIELD
+	 * AML_CREATEQWORDFIELD
 	 * AML_METHODCALL
 	 */
 
@@ -430,14 +430,14 @@
 
 	arg = op->value.arg;
 
-	switch (op->opcode)
-	{
+	switch (op->opcode) {
 
 	case AML_CREATE_FIELD_OP:
-	case AML_BIT_FIELD_OP:
-	case AML_BYTE_FIELD_OP:
-	case AML_WORD_FIELD_OP:
-	case AML_DWORD_FIELD_OP:
+	case AML_CREATE_BIT_FIELD_OP:
+	case AML_CREATE_BYTE_FIELD_OP:
+	case AML_CREATE_WORD_FIELD_OP:
+	case AML_CREATE_DWORD_FIELD_OP:
+	case AML_CREATE_QWORD_FIELD_OP:
 
 		/*
 		 * Create the field object, but the field buffer and index must
@@ -455,58 +455,59 @@
 			arg = acpi_ps_get_arg (op, 2);
 		}
 
+		if (!arg) {
+			status = AE_AML_NO_OPERAND;
+			goto cleanup;
+		}
+
 		/*
 		 * Enter the Name_string into the namespace
 		 */
-
-		status = acpi_ns_lookup (walk_state->scope_info,
-				 arg->value.string,
-				 INTERNAL_TYPE_DEF_ANY,
-				 IMODE_LOAD_PASS1,
+		status = acpi_ns_lookup (walk_state->scope_info, arg->value.string,
+				 INTERNAL_TYPE_DEF_ANY, IMODE_LOAD_PASS1,
 				 NS_NO_UPSEARCH | NS_DONT_OPEN_SCOPE,
 				 walk_state, &(new_node));
+		if (ACPI_FAILURE (status)) {
+			goto cleanup;
+		}
 
-		if (ACPI_SUCCESS (status)) {
-			/* We could put the returned object (Node) on the object stack for later, but
-			 * for now, we will put it in the "op" object that the parser uses, so we
-			 * can get it again at the end of this scope
-			 */
-			op->node = new_node;
+		/* We could put the returned object (Node) on the object stack for later, but
+		 * for now, we will put it in the "op" object that the parser uses, so we
+		 * can get it again at the end of this scope
+		 */
+		op->node = new_node;
 
+		/*
+		 * If there is no object attached to the node, this node was just created and
+		 * we need to create the field object.  Otherwise, this was a lookup of an
+		 * existing node and we don't want to create the field object again.
+		 */
+		if (!new_node->object) {
 			/*
-			 * If there is no object attached to the node, this node was just created and
-			 * we need to create the field object.  Otherwise, this was a lookup of an
-			 * existing node and we don't want to create the field object again.
+			 * The Field definition is not fully parsed at this time.
+			 * (We must save the address of the AML for the buffer and index operands)
 			 */
-			if (!new_node->object) {
-				/*
-				 * The Field definition is not fully parsed at this time.
-				 * (We must save the address of the AML for the buffer and index operands)
-				 */
-				status = acpi_aml_exec_create_field (((ACPI_PARSE2_OBJECT *) op)->data,
-						   ((ACPI_PARSE2_OBJECT *) op)->length,
-						   new_node, walk_state);
-			}
+			status = acpi_ex_create_buffer_field (((ACPI_PARSE2_OBJECT *) op)->data,
+					  ((ACPI_PARSE2_OBJECT *) op)->length,
+					  new_node, walk_state);
 		}
-
-
 		break;
 
 
-	case AML_METHODCALL_OP:
+	case AML_INT_METHODCALL_OP:
 
 		/*
 		 * Lookup the method name and save the Node
 		 */
 
 		status = acpi_ns_lookup (walk_state->scope_info, arg->value.string,
-				 ACPI_TYPE_ANY, IMODE_LOAD_PASS2,
-				 NS_SEARCH_PARENT | NS_DONT_OPEN_SCOPE,
-				 walk_state, &(new_node));
+				  ACPI_TYPE_ANY, IMODE_LOAD_PASS2,
+				  NS_SEARCH_PARENT | NS_DONT_OPEN_SCOPE,
+				  walk_state, &(new_node));
 
 		if (ACPI_SUCCESS (status)) {
 
-/* has name already been resolved by here ??*/
+			/* TBD: has name already been resolved by here ??*/
 
 			/* TBD: [Restructure] Make sure that what we found is indeed a method! */
 			/* We didn't search for a method on purpose, to see if the name would resolve! */
@@ -526,7 +527,7 @@
 
 		/* Nothing to do other than enter object into namespace */
 
-		status = acpi_aml_exec_create_processor (op, (ACPI_HANDLE) node);
+		status = acpi_ex_create_processor (op, node);
 		if (ACPI_FAILURE (status)) {
 			goto cleanup;
 		}
@@ -538,7 +539,7 @@
 
 		/* Nothing to do other than enter object into namespace */
 
-		status = acpi_aml_exec_create_power_resource (op, (ACPI_HANDLE) node);
+		status = acpi_ex_create_power_resource (op, node);
 		if (ACPI_FAILURE (status)) {
 			goto cleanup;
 		}
@@ -553,13 +554,11 @@
 		break;
 
 
-	case AML_DEF_FIELD_OP:
+	case AML_FIELD_OP:
 
 		arg = op->value.arg;
 
-		status = acpi_ds_create_field (op,
-				  arg->node,
-				  walk_state);
+		status = acpi_ds_create_field (op, arg->node, walk_state);
 		break;
 
 
@@ -567,8 +566,7 @@
 
 		arg = op->value.arg;
 
-		status = acpi_ds_create_index_field (op,
-				   (ACPI_HANDLE) arg->node,
+		status = acpi_ds_create_index_field (op, (ACPI_HANDLE) arg->node,
 				   walk_state);
 		break;
 
@@ -576,9 +574,7 @@
 	case AML_BANK_FIELD_OP:
 
 		arg = op->value.arg;
-		status = acpi_ds_create_bank_field (op,
-				   arg->node,
-				   walk_state);
+		status = acpi_ds_create_bank_field (op, arg->node, walk_state);
 		break;
 
 
@@ -588,11 +584,10 @@
 	case AML_METHOD_OP:
 
 		if (!node->object) {
-			status = acpi_aml_exec_create_method (((ACPI_PARSE2_OBJECT *) op)->data,
+			status = acpi_ex_create_method (((ACPI_PARSE2_OBJECT *) op)->data,
 					   ((ACPI_PARSE2_OBJECT *) op)->length,
-					   arg->value.integer, (ACPI_HANDLE) node);
+					   arg->value.integer, node);
 		}
-
 		break;
 
 
@@ -603,7 +598,7 @@
 			goto cleanup;
 		}
 
-		status = acpi_aml_exec_create_mutex (walk_state);
+		status = acpi_ex_create_mutex (walk_state);
 		break;
 
 
@@ -614,7 +609,7 @@
 			goto cleanup;
 		}
 
-		status = acpi_aml_exec_create_event (walk_state);
+		status = acpi_ex_create_event (walk_state);
 		break;
 
 
@@ -624,16 +619,13 @@
 			break;
 		}
 
-
 		/*
 		 * The Op_region is not fully parsed at this time. Only valid argument is the Space_id.
 		 * (We must save the address of the AML of the address and length operands)
 		 */
-
-		status = acpi_aml_exec_create_region (((ACPI_PARSE2_OBJECT *) op)->data,
-				   ((ACPI_PARSE2_OBJECT *) op)->length,
-				   (ACPI_ADDRESS_SPACE_TYPE) arg->value.integer,
-				   walk_state);
+		status = acpi_ex_create_region (((ACPI_PARSE2_OBJECT *) op)->data,
+				  ((ACPI_PARSE2_OBJECT *) op)->length,
+						 (ACPI_ADR_SPACE_TYPE) arg->value.integer, walk_state);
 
 		break;
 
@@ -647,7 +639,7 @@
 			goto cleanup;
 		}
 
-		status = acpi_aml_exec_create_alias (walk_state);
+		status = acpi_ex_create_alias (walk_state);
 		break;
 
 
@@ -666,7 +658,7 @@
 		break;
 
 
-	case AML_NAMEPATH_OP:
+	case AML_INT_NAMEPATH_OP:
 
 		break;
 
diff -urN linux-2.4.6-pre4/drivers/acpi/dispatcher/dswscope.c linux/drivers/acpi/dispatcher/dswscope.c
--- linux-2.4.6-pre4/drivers/acpi/dispatcher/dswscope.c	Mon Jan 22 13:23:42 2001
+++ linux/drivers/acpi/dispatcher/dswscope.c	Mon Dec  3 22:48:41 2001
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: dswscope - Scope stack manipulation
- *              $Revision: 42 $
+ *              $Revision: 45 $
  *
  *****************************************************************************/
 
@@ -29,7 +29,7 @@
 #include "acdispat.h"
 
 
-#define _COMPONENT          NAMESPACE
+#define _COMPONENT          ACPI_DISPATCHER
 	 MODULE_NAME         ("dswscope")
 
 
@@ -60,7 +60,7 @@
 		scope_info = walk_state->scope_info;
 		walk_state->scope_info = scope_info->scope.next;
 
-		acpi_cm_delete_generic_state (scope_info);
+		acpi_ut_delete_generic_state (scope_info);
 	}
 }
 
@@ -80,7 +80,7 @@
 ACPI_STATUS
 acpi_ds_scope_stack_push (
 	ACPI_NAMESPACE_NODE     *node,
-	OBJECT_TYPE_INTERNAL    type,
+	ACPI_OBJECT_TYPE8       type,
 	ACPI_WALK_STATE         *walk_state)
 {
 	ACPI_GENERIC_STATE      *scope_info;
@@ -95,14 +95,14 @@
 
 	/* Make sure object type is valid */
 
-	if (!acpi_aml_validate_object_type (type)) {
+	if (!acpi_ex_validate_object_type (type)) {
 		REPORT_WARNING (("Ds_scope_stack_push: type code out of range\n"));
 	}
 
 
 	/* Allocate a new scope object */
 
-	scope_info = acpi_cm_create_generic_state ();
+	scope_info = acpi_ut_create_generic_state ();
 	if (!scope_info) {
 		return (AE_NO_MEMORY);
 	}
@@ -114,7 +114,7 @@
 
 	/* Push new scope object onto stack */
 
-	acpi_cm_push_generic_state (&walk_state->scope_info, scope_info);
+	acpi_ut_push_generic_state (&walk_state->scope_info, scope_info);
 
 	return (AE_OK);
 }
@@ -148,12 +148,12 @@
 	 * Pop scope info object off the stack.
 	 */
 
-	scope_info = acpi_cm_pop_generic_state (&walk_state->scope_info);
+	scope_info = acpi_ut_pop_generic_state (&walk_state->scope_info);
 	if (!scope_info) {
 		return (AE_STACK_UNDERFLOW);
 	}
 
-	acpi_cm_delete_generic_state (scope_info);
+	acpi_ut_delete_generic_state (scope_info);
 
 	return (AE_OK);
 }
diff -urN linux-2.4.6-pre4/drivers/acpi/dispatcher/dswstate.c linux/drivers/acpi/dispatcher/dswstate.c
--- linux-2.4.6-pre4/drivers/acpi/dispatcher/dswstate.c	Mon Jan 22 13:23:42 2001
+++ linux/drivers/acpi/dispatcher/dswstate.c	Mon Dec  3 22:48:41 2001
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: dswstate - Dispatcher parse tree walk management routines
- *              $Revision: 38 $
+ *              $Revision: 45 $
  *
  *****************************************************************************/
 
@@ -31,7 +31,7 @@
 #include "acnamesp.h"
 #include "acinterp.h"
 
-#define _COMPONENT          DISPATCHER
+#define _COMPONENT          ACPI_DISPATCHER
 	 MODULE_NAME         ("dswstate")
 
 
@@ -57,6 +57,9 @@
 	ACPI_GENERIC_STATE      *state;
 
 
+	PROC_NAME ("Ds_result_insert");
+
+
 	state = walk_state->results;
 	if (!state) {
 		return (AE_NOT_EXIST);
@@ -100,6 +103,9 @@
 	ACPI_GENERIC_STATE      *state;
 
 
+	PROC_NAME ("Ds_result_remove");
+
+
 	state = walk_state->results;
 	if (!state) {
 		return (AE_NOT_EXIST);
@@ -147,6 +153,9 @@
 	ACPI_GENERIC_STATE      *state;
 
 
+	PROC_NAME ("Ds_result_pop");
+
+
 	state = walk_state->results;
 	if (!state) {
 		return (AE_OK);
@@ -199,6 +208,9 @@
 	ACPI_GENERIC_STATE      *state;
 
 
+	PROC_NAME ("Ds_result_pop_from_bottom");
+
+
 	state = walk_state->results;
 	if (!state) {
 		return (AE_NOT_EXIST);
@@ -254,6 +266,9 @@
 	ACPI_GENERIC_STATE      *state;
 
 
+	PROC_NAME ("Ds_result_push");
+
+
 	state = walk_state->results;
 	if (!state) {
 		return (AE_AML_INTERNAL);
@@ -295,12 +310,12 @@
 	ACPI_GENERIC_STATE      *state;
 
 
-	state = acpi_cm_create_generic_state ();
+	state = acpi_ut_create_generic_state ();
 	if (!state) {
 		return (AE_NO_MEMORY);
 	}
 
-	acpi_cm_push_generic_state (&walk_state->results, state);
+	acpi_ut_push_generic_state (&walk_state->results, state);
 
 	return (AE_OK);
 }
@@ -332,9 +347,9 @@
 	}
 
 
-	state = acpi_cm_pop_generic_state (&walk_state->results);
+	state = acpi_ut_pop_generic_state (&walk_state->results);
 
-	acpi_cm_delete_generic_state (state);
+	acpi_ut_delete_generic_state (state);
 
 	return (AE_OK);
 }
@@ -364,7 +379,7 @@
 
 	for (i = 0; i < OBJ_NUM_OPERANDS; i++) {
 		if (walk_state->operands[i]) {
-			acpi_cm_remove_reference (walk_state->operands[i]);
+			acpi_ut_remove_reference (walk_state->operands[i]);
 			walk_state->operands[i] = NULL;
 		}
 	}
@@ -432,10 +447,10 @@
 	/* Check for stack underflow */
 
 	if (walk_state->num_operands == 0) {
+		*object = NULL;
 		return (AE_AML_NO_OPERAND);
 	}
 
-
 	/* Pop the stack */
 
 	walk_state->num_operands--;
@@ -443,6 +458,7 @@
 	/* Check for a valid operand */
 
 	if (!walk_state->operands [walk_state->num_operands]) {
+		*object = NULL;
 		return (AE_AML_NO_OPERAND);
 	}
 
@@ -529,7 +545,7 @@
 		walk_state->num_operands--;
 		obj_desc = walk_state->operands [walk_state->num_operands];
 		if (obj_desc) {
-			acpi_cm_remove_reference (walk_state->operands [walk_state->num_operands]);
+			acpi_ut_remove_reference (walk_state->operands [walk_state->num_operands]);
 			walk_state->operands [walk_state->num_operands] = NULL;
 		}
 	}
@@ -696,7 +712,7 @@
 	ACPI_STATUS             status;
 
 
-	acpi_cm_acquire_mutex (ACPI_MTX_CACHES);
+	acpi_ut_acquire_mutex (ACPI_MTX_CACHES);
 	acpi_gbl_walk_state_cache_requests++;
 
 	/* Check the cache first */
@@ -710,17 +726,17 @@
 		acpi_gbl_walk_state_cache_hits++;
 		acpi_gbl_walk_state_cache_depth--;
 
-		acpi_cm_release_mutex (ACPI_MTX_CACHES);
+		acpi_ut_release_mutex (ACPI_MTX_CACHES);
 	}
 
 	else {
 		/* The cache is empty, create a new object */
 
-		/* Avoid deadlock with Acpi_cm_callocate */
+		/* Avoid deadlock with Acpi_ut_callocate */
 
-		acpi_cm_release_mutex (ACPI_MTX_CACHES);
+		acpi_ut_release_mutex (ACPI_MTX_CACHES);
 
-		walk_state = acpi_cm_callocate (sizeof (ACPI_WALK_STATE));
+		walk_state = acpi_ut_callocate (sizeof (ACPI_WALK_STATE));
 		if (!walk_state) {
 			return (NULL);
 		}
@@ -730,6 +746,7 @@
 	walk_state->owner_id        = owner_id;
 	walk_state->origin          = origin;
 	walk_state->method_desc     = mth_desc;
+	walk_state->walk_list       = walk_list;
 
 	/* Init the method args/local */
 
@@ -787,7 +804,7 @@
 		state = walk_state->control_state;
 		walk_state->control_state = state->common.next;
 
-		acpi_cm_delete_generic_state (state);
+		acpi_ut_delete_generic_state (state);
 	}
 
 	/* Always must free any linked parse states */
@@ -796,7 +813,7 @@
 		state = walk_state->scope_info;
 		walk_state->scope_info = state->common.next;
 
-		acpi_cm_delete_generic_state (state);
+		acpi_ut_delete_generic_state (state);
 	}
 
 	/* Always must free any stacked result states */
@@ -805,20 +822,20 @@
 		state = walk_state->results;
 		walk_state->results = state->common.next;
 
-		acpi_cm_delete_generic_state (state);
+		acpi_ut_delete_generic_state (state);
 	}
 
 
 	/* If walk cache is full, just free this wallkstate object */
 
 	if (acpi_gbl_walk_state_cache_depth >= MAX_WALK_CACHE_DEPTH) {
-		acpi_cm_free (walk_state);
+		acpi_ut_free (walk_state);
 	}
 
 	/* Otherwise put this object back into the cache */
 
 	else {
-		acpi_cm_acquire_mutex (ACPI_MTX_CACHES);
+		acpi_ut_acquire_mutex (ACPI_MTX_CACHES);
 
 		/* Clear the state */
 
@@ -832,7 +849,7 @@
 		acpi_gbl_walk_state_cache_depth++;
 
 
-		acpi_cm_release_mutex (ACPI_MTX_CACHES);
+		acpi_ut_release_mutex (ACPI_MTX_CACHES);
 	}
 
 	return;
@@ -865,7 +882,7 @@
 		/* Delete one cached state object */
 
 		next = acpi_gbl_walk_state_cache->next;
-		acpi_cm_free (acpi_gbl_walk_state_cache);
+		acpi_ut_free (acpi_gbl_walk_state_cache);
 		acpi_gbl_walk_state_cache = next;
 		acpi_gbl_walk_state_cache_depth--;
 	}
diff -urN linux-2.4.6-pre4/drivers/acpi/driver.c linux/drivers/acpi/driver.c
--- linux-2.4.6-pre4/drivers/acpi/driver.c	Tue May 22 09:38:51 2001
+++ linux/drivers/acpi/driver.c	Mon Dec  3 22:48:41 2001
@@ -2,6 +2,7 @@
  *  driver.c - ACPI driver
  *
  *  Copyright (C) 2000 Andrew Henroid
+ *  Copyright (C) 2001 Andrew Grover
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -21,6 +22,10 @@
  * Changes
  * David Woodhouse <dwmw2@redhat.com> 2000-12-6
  * - Fix interruptible_sleep_on() races
+ * Andrew Grover <andrew.grover@intel.com> 2001-2-28
+ * - Major revamping
+ * Peter Breuer <ptb@it.uc3m.es> 2001-5-20
+ * - parse boot time params.
  */
 
 #include <linux/config.h>
@@ -39,416 +44,44 @@
 
 #ifdef CONFIG_ACPI_KERNEL_CONFIG
 #include <asm/efi.h>
-#define ACPI_CAN_USE_EFI_STRUCT
+#define ACPI_USE_EFI
 #endif
 
 
 #define _COMPONENT	OS_DEPENDENT
 	MODULE_NAME	("driver")
 
-struct acpi_run_entry
-{
-	void (*callback)(void*);
-	void *context;
-	struct tq_struct task;
-};
-
-static spinlock_t acpi_event_lock = SPIN_LOCK_UNLOCKED;
-static volatile u32 acpi_event_status = 0;
-static volatile acpi_sstate_t acpi_event_state = ACPI_STATE_S0;
-static DECLARE_WAIT_QUEUE_HEAD(acpi_event_wait);
-
-static volatile int acpi_thread_pid = -1;
-
-static int acpi_start = 1;
-
-/************************************************/
-/* DECLARE_TASK_QUEUE is defined in             */
-/* /usr/src/linux/include/linux/tqueue.h        */
-/* So, acpi_thread_run is a pointer to a        */
-/* tq_struct structure,defined in the same file.*/
-/************************************************/
-static DECLARE_TASK_QUEUE(acpi_thread_run);
-
-static DECLARE_WAIT_QUEUE_HEAD(acpi_thread_wait);
-
-static struct ctl_table_header *acpi_sysctl = NULL;
-
-/*
- * Examine/modify value
- */
-static int 
-acpi_do_ulong(ctl_table * ctl,
-	      int write,
-	      struct file *file,
-	      void *buffer,
-	      size_t * len)
-{
-	char str[2 * sizeof(unsigned long) + 4], *strend;
-	unsigned long val;
-	int size;
-
-	if (!write) {
-		if (file->f_pos) {
-			*len = 0;
-			return 0;
-		}
-
-		val = *(unsigned long *) ctl->data;
-		size = sprintf(str, "0x%08lx\n", val);
-		if (*len >= size) {
-			copy_to_user(buffer, str, size);
-			*len = size;
-		}
-		else
-			*len = 0;
-	}
-	else {
-		size = sizeof(str) - 1;
-		if (size > *len)
-			size = *len;
-		copy_from_user(str, buffer, size);
-		str[size] = '\0';
-		val = simple_strtoul(str, &strend, 0);
-		if (strend == str)
-			return -EINVAL;
-		*(unsigned long *) ctl->data = val;
-	}
-
-	file->f_pos += *len;
-	return 0;
-}
-
-static int 
-acpi_do_pm_timer(ctl_table * ctl,
-	      int write,
-	      struct file *file,
-	      void *buffer,
-	      size_t * len)
-{
-	int size;
-	u32 val = 0;
-
-	char str[12];
-
-	if (file->f_pos) {
-		*len = 0;
-		return 0;
-	}
-
-	val = acpi_read_pm_timer();
-
-	size = sprintf(str, "0x%08x\n", val);
-	if (*len >= size) {
-		copy_to_user(buffer, str, size);
-		*len = size;
-	}
-	else
-		*len = 0;
-
-	file->f_pos += *len;
-
-	return 0;
-}
-
-/*
- * Handle ACPI event
- */
-static u32
-acpi_event(void *context)
-{
-	unsigned long flags;
-	int event = (int)(long)context;
-	int mask = 0;
-
-	switch (event) {
-	case ACPI_EVENT_POWER_BUTTON:
-		mask = ACPI_PWRBTN;
-		break;
-	case ACPI_EVENT_SLEEP_BUTTON:
-		mask = ACPI_SLPBTN;
-		break;
-	default:
-		return AE_ERROR;
-	}
-
-	if (mask) {
-		// notify process waiting on /dev/acpi
-		spin_lock_irqsave(&acpi_event_lock, flags);
-		acpi_event_status |= mask;
-		spin_unlock_irqrestore(&acpi_event_lock, flags);
-		acpi_event_state = acpi_sleep_state;
-		wake_up_interruptible(&acpi_event_wait);
-	}
-
-	return AE_OK;
-}
-
-/*
- * Wait for next event
- */
-static int
-acpi_do_event(ctl_table * ctl,
-	      int write,
-	      struct file *file,
-	      void *buffer,
-	      size_t * len)
-{
-	u32 event_status = 0;
-	acpi_sstate_t event_state = 0;
-	char str[27];
-	int size;
-
-	if (write)
-		return -EPERM;
-	if (*len < sizeof(str)) {
-		*len = 0;
-		return 0;
-	}
-
-	while (!event_status) {
-		unsigned long flags;
-		DECLARE_WAITQUEUE(wait, current);
-
-		set_current_state(TASK_INTERRUPTIBLE);
-		add_wait_queue(&acpi_event_wait, &wait);
-
-		// we need an atomic exchange here
-		spin_lock_irqsave(&acpi_event_lock, flags);
-		event_status = acpi_event_status;
-		acpi_event_status = 0;
-		spin_unlock_irqrestore(&acpi_event_lock, flags);
-		event_state = acpi_event_state;
-
-		if (!event_status)
-			schedule();
-
-		remove_wait_queue(&acpi_event_wait, &wait);
-		set_current_state(TASK_RUNNING);
-
-		if (signal_pending(current))
-			return -ERESTARTSYS;
-	}
-
-	size = sprintf(str,
-		       "0x%08x 0x%08x 0x%01x\n",
-		       event_status,
-		       0,
-		       event_state);
-	copy_to_user(buffer, str, size);
-	*len = size;
-	file->f_pos += size;
-
-	return 0;
-}
-
-/*
- * Enter system sleep state
- */
-/*static int 
-acpi_do_sleep(ctl_table * ctl,
-	      int write,
-	      struct file *file,
-	      void *buffer,
-	      size_t * len)
-{
-	if (!write) {
-		if (file->f_pos) {
-			*len = 0;
-			return 0;
-		}
-	}
-	else {
-		int status = acpi_enter_sx(ACPI_STATE_S1);
-		if (status)
-			return status;
-	}
-	file->f_pos += *len;
-	return 0;
-}*/
-
-
-/*
- * Output important ACPI tables to proc
- */
-static int 
-acpi_do_table(ctl_table * ctl,
-	      int write,
-	      struct file *file,
-	      void *buffer,
-	      size_t * len)
-{
-	u32 table_type;
-	size_t size;
-	ACPI_BUFFER buf;
-	u8* data;
-
-	table_type = (u32) ctl->data;
-	size = 0;
-	buf.length = 0;
-	buf.pointer = NULL;
-
-	/* determine what buffer size we will need */
-	if (acpi_get_table(table_type, 1, &buf) != AE_BUFFER_OVERFLOW) {
-		*len = 0;
-		return 0;
-	}
-
-	buf.pointer = kmalloc(buf.length, GFP_KERNEL);
-	if (!buf.pointer) {
-		return -ENOMEM;
-	}
-
-	/* get the table for real */
-	if (!ACPI_SUCCESS(acpi_get_table(table_type, 1, &buf))) {
-		kfree(buf.pointer);
-		*len = 0;
-		return 0;
-	}
-
-	if (file->f_pos < buf.length) {
-		data = buf.pointer + file->f_pos;
-		size = buf.length - file->f_pos;
-		if (size > *len)
-			size = *len;
-		if (copy_to_user(buffer, data, size)) {
-			kfree(buf.pointer);
-			return -EFAULT;
-		}
-	}
+FADT_DESCRIPTOR acpi_fadt;
 
-	kfree(buf.pointer);
-
-	*len = size;
-	file->f_pos += size;
-	return 0;
-}
-
-/********************************************************************/
-/*              R U N    Q U E U E D   C A L L B A C K              */
-/*                                                                  */
-/* The "callback" function address that was tramped through via     */
-/* "acpi_run" below is finally called and executed. If we trace all */
-/* this down, the function is acpi_ev_asynch_execute_gpe_method, in */ 
-/* evevent.c   The only other function that is ever queued is       */
-/* acpi_ev_global_lock_thread in evmisc.c.                          */
-/********************************************************************/
-static void
-acpi_run_exec(void *context)
-{
-	struct acpi_run_entry *entry
-		= (struct acpi_run_entry*) context;
-	(*entry->callback)(entry->context);
-	kfree(entry);
-}
+static int acpi_disabled = 0;
 
 /*
- * Queue for execution by the ACPI thread
+ * Start the interpreter
  */
 int
-acpi_run(void (*callback)(void*), void *context)
-{
-	struct acpi_run_entry *entry;
-
-	entry = kmalloc(sizeof(*entry), GFP_ATOMIC);
-	if (!entry)
-		return -1;
-
-	memset(entry, 0, sizeof(entry));
-	entry->callback = callback;
-	entry->context = context;
-	entry->task.routine = acpi_run_exec;
-	entry->task.data = entry;
-
-	queue_task(&entry->task, &acpi_thread_run);
-
-	if (waitqueue_active(&acpi_thread_wait))
-		wake_up(&acpi_thread_wait);
-
-	return 0;
-}
-
-static struct ctl_table acpi_table[] =
-{
-	{ACPI_P_LVL2_LAT, "c2_exit_latency",
-	 &acpi_c2_exit_latency, sizeof(acpi_c2_exit_latency),
-	 0644, NULL, &acpi_do_ulong},
-
-	{ACPI_ENTER_LVL2_LAT, "c2_enter_latency",
-	 &acpi_c2_enter_latency, sizeof(acpi_c2_enter_latency),
-	 0644, NULL, &acpi_do_ulong},
-
-	{ACPI_P_LVL3_LAT, "c3_exit_latency",
-	 &acpi_c3_exit_latency, sizeof(acpi_c3_exit_latency),
-	 0644, NULL, &acpi_do_ulong},
-
-	{ACPI_ENTER_LVL3_LAT, "c3_enter_latency",
-	 &acpi_c3_enter_latency, sizeof(acpi_c3_enter_latency),
-	 0644, NULL, &acpi_do_ulong},
-
-	{ACPI_C1_COUNT, "c1_count",
-	 &acpi_c1_count, sizeof(acpi_c1_count),
-	 0644, NULL, &acpi_do_ulong},
-
-	{ACPI_C2_COUNT, "c2_count",
-	 &acpi_c2_count, sizeof(acpi_c2_count),
-	 0644, NULL, &acpi_do_ulong},
-
-	{ACPI_C3_COUNT, "c3_count",
-	 &acpi_c3_count, sizeof(acpi_c3_count),
-	 0644, NULL, &acpi_do_ulong},
-
-	
-/* until it actually works */
-/*	{ACPI_SLEEP, "sleep", NULL, 0, 0600, NULL, &acpi_do_sleep},*/
-
-	{ACPI_EVENT, "event", NULL, 0, 0400, NULL, &acpi_do_event},
-
-	{ACPI_FADT, "fadt", (void *) ACPI_TABLE_FADT, sizeof(int),
-	 0444, NULL, &acpi_do_table},
-	
-	{ACPI_DSDT, "dsdt", (void *) ACPI_TABLE_DSDT, sizeof(int),
-	 0444, NULL, &acpi_do_table},
-
-	{ACPI_FACS, "facs", (void *) ACPI_TABLE_FACS, sizeof(int),
-	 0444, NULL, &acpi_do_table},
-
-	{ACPI_XSDT, "xsdt", (void *) ACPI_TABLE_XSDT, sizeof(int),
-	 0444, NULL, &acpi_do_table},
-
-	{ACPI_PMTIMER, "pm_timer", NULL, 0, 0444, NULL, &acpi_do_pm_timer},
-	
-	{0}
-};
-
-static struct ctl_table acpi_dir_table[] =
-{
-	{CTL_ACPI, "acpi", NULL, 0, 0555, acpi_table},
-	{0}
-};
-
-/*
- * Initialize and run interpreter within a kernel thread
- */
-static int
-acpi_thread(void *context)
+acpi_init(void)
 {
 	ACPI_PHYSICAL_ADDRESS	rsdp_phys;
 	ACPI_BUFFER		buffer;
 	ACPI_SYSTEM_INFO	sys_info;
 
-	/*
-	 * initialize
-	 */
-	daemonize();
-	strcpy(current->comm, "kacpid");
+	if (PM_IS_ACTIVE()) {
+		printk(KERN_NOTICE "ACPI: APM is already active, exiting\n");
+		return -ENODEV;
+	}
+
+
+	if (acpi_disabled) {
+		printk(KERN_NOTICE "ACPI: disabled by cmdline, exiting\n");
+		return -ENODEV;
+	}
 
 	if (!ACPI_SUCCESS(acpi_initialize_subsystem())) {
 		printk(KERN_ERR "ACPI: Driver initialization failed\n");
 		return -ENODEV;
 	}
 
-#ifndef ACPI_CAN_USE_EFI_STRUCT
+#ifndef ACPI_USE_EFI
 	if (!ACPI_SUCCESS(acpi_find_root_pointer(&rsdp_phys))) {
 		printk(KERN_ERR "ACPI: System description tables not found\n");
 		return -ENODEV;
@@ -456,12 +89,22 @@
 #else
 	rsdp_phys = efi.acpi;
 #endif
-		
-	if (!ACPI_SUCCESS(acpi_find_and_load_tables(rsdp_phys)))
+
+	/* from this point on, on error we must call acpi_terminate() */
+
+	if (!ACPI_SUCCESS(acpi_load_tables(rsdp_phys))) {
+		printk(KERN_ERR "ACPI: System description table load failed\n");
+		acpi_terminate();
 		return -ENODEV;
+	}
 
-	if (PM_IS_ACTIVE()) {
-		printk(KERN_NOTICE "ACPI: APM is already active, exiting\n");
+	/* get a separate copy of the FADT for use by other drivers */
+	memset(&acpi_fadt, 0, sizeof(acpi_fadt));
+	buffer.pointer = &acpi_fadt;
+	buffer.length = sizeof(acpi_fadt);
+
+	if (!ACPI_SUCCESS(acpi_get_table(ACPI_TABLE_FADT, 1, &buffer))) {
+		printk(KERN_ERR "ACPI: Could not get FADT\n");
 		acpi_terminate();
 		return -ENODEV;
 	}
@@ -483,129 +126,37 @@
 		return -ENODEV;
 	}
 
-	printk(KERN_ERR "ACPI: Subsystem enabled\n");
+	printk(KERN_INFO "ACPI: Subsystem enabled\n");
 
 	pm_active = 1;
 
-	acpi_cpu_init();
-	acpi_sys_init();
-	acpi_ec_init();
-	acpi_power_init();
-
-	/* 
-	 * Non-intuitive: 0 means pwr and sleep are implemented using the fixed
-	 * feature model, so we install handlers. 1 means a control method
-	 * implementation, or none at all, so do nothing. See ACPI spec.
-	 */
-	if (acpi_fadt.pwr_button == 0) {
-		if (!ACPI_SUCCESS(acpi_install_fixed_event_handler(
-			ACPI_EVENT_POWER_BUTTON,
-			acpi_event,
-			(void *) ACPI_EVENT_POWER_BUTTON))) {
-			printk(KERN_ERR "ACPI: power button enable failed\n");
-		}
-	}
-
-	if (acpi_fadt.sleep_button == 0) {
-		if (!ACPI_SUCCESS(acpi_install_fixed_event_handler(
-			ACPI_EVENT_SLEEP_BUTTON,
-			acpi_event,
-			(void *) ACPI_EVENT_SLEEP_BUTTON))) {
-			printk(KERN_ERR "ACPI: sleep button enable failed\n");
-		}
-	}
-
-	acpi_sysctl = register_sysctl_table(acpi_dir_table, 1);
-
-	/*
-	 * run
-	 */
-	for (;;) {
-		DECLARE_WAITQUEUE(wait, current);
-
-		set_current_state(TASK_INTERRUPTIBLE);
-		add_wait_queue(&acpi_thread_wait, &wait);
-
-		if (list_empty(&acpi_thread_run))
-			schedule();
-
-		remove_wait_queue(&acpi_thread_wait, &wait);
-		set_current_state(TASK_RUNNING);
-
-		if (signal_pending(current))
-			break;
-
-		run_task_queue(&acpi_thread_run);
-	}
-
-	/*
-	 * terminate
-	 */
-	unregister_sysctl_table(acpi_sysctl);
-
-	/* do not terminate, because we need acpi in order to shut down */
-	/*acpi_terminate();*/
-
-	acpi_thread_pid = -1;
-
 	return 0;
 }
 
 /*
- * Start the interpreter
- */
-int __init
-acpi_init(void)
-{
-	if (acpi_start) {
-		acpi_thread_pid = kernel_thread(acpi_thread,
-					NULL,
-					(CLONE_FS | CLONE_FILES
-					 | CLONE_SIGHAND | SIGCHLD));
-	}
-	else {
-		printk(KERN_INFO "ACPI: Disabled\n");
-	}
-
-	return ((acpi_thread_pid >= 0) ? 0:-ENODEV);
-}
-
-/*
  * Terminate the interpreter
  */
-void __exit
+void
 acpi_exit(void)
 {
-	int count;
+	acpi_terminate();
 
-	if (!kill_proc(acpi_thread_pid, SIGTERM, 1)) {
-		// wait until thread terminates (at most 5 seconds)
-		count = 5 * HZ;
-		while (acpi_thread_pid >= 0 && --count) {
-			current->state = TASK_INTERRUPTIBLE;
-			schedule_timeout(1);
-		}
-	}
-
-	pm_idle = NULL;
-	pm_power_off = NULL;
 	pm_active = 0;
+
+	printk(KERN_ERR "ACPI: Subsystem disabled\n");
 }
 
 module_init(acpi_init);
 module_exit(acpi_exit);
 
 #ifndef MODULE
-static int __init acpi_setup(char *str)
-{
-	while ((str != NULL) && (*str != '\0')) {
-		if (strncmp(str, "no-idle", 7) == 0)
-			acpi_use_idle = 0;
-		if (strncmp(str, "off", 3) == 0)
-			acpi_start = 0;
-		str = strchr(str, ',');
-		if (str != NULL)
-			str += strspn(str, ", \t");
+static int __init acpi_setup(char *str) {
+	while (str && *str) {
+	if (strncmp(str, "off", 3) == 0)
+		acpi_disabled = 1;
+	str = strchr(str, ',');
+	if (str)
+		str += strspn(str, ", \t");
 	}
 	return 1;
 }
diff -urN linux-2.4.6-pre4/drivers/acpi/driver.h linux/drivers/acpi/driver.h
--- linux-2.4.6-pre4/drivers/acpi/driver.h	Fri Feb  9 11:45:58 2001
+++ linux/drivers/acpi/driver.h	Mon Dec  3 22:48:42 2001
@@ -69,11 +69,4 @@
 
 extern volatile acpi_sstate_t acpi_sleep_state;
 
-/*
- * table.c
- */
-extern FADT_DESCRIPTOR acpi_fadt;
-
-int acpi_find_and_load_tables(u64 rsdp);
-
 #endif /* __DRIVER_H */
diff -urN linux-2.4.6-pre4/drivers/acpi/ec.c linux/drivers/acpi/ec.c
--- linux-2.4.6-pre4/drivers/acpi/ec.c	Fri Feb  9 11:45:58 2001
+++ linux/drivers/acpi/ec.c	Wed Dec 31 16:00:00 1969
@@ -1,600 +0,0 @@
-/*
- *  ec.c - Embedded controller support
- *
- *  Copyright (C) 2000 Andrew Henroid
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-#include <linux/kernel.h>
-#include <linux/acpi.h>
-#include <linux/slab.h>
-#include "acpi.h"
-#include "driver.h"
-#include "ec.h"
-
-#define _COMPONENT	OS_DEPENDENT
-	MODULE_NAME	("ec")
-
-#define ACPI_EC_HID	"PNP0C09"
-
-enum
-{
-	ACPI_EC_SMI = 0x40,
-	ACPI_EC_SCI = 0x20,
-	ACPI_EC_BURST = 0x10,
-	ACPI_EC_CMD = 0x08,
-	ACPI_EC_IBF = 0x02,
-	ACPI_EC_OBF = 0x01
-};
-
-enum
-{
-	ACPI_EC_READ = 0x80,
-	ACPI_EC_WRITE = 0x81,
-	ACPI_EC_BURST_ENABLE = 0x82,
-	ACPI_EC_BURST_DISABLE = 0x83,
-	ACPI_EC_QUERY = 0x84,
-};
-
-typedef struct
-{
-	ACPI_HANDLE		acpi_handle;
-	u32			gpe_bit;
-	ACPI_IO_ADDRESS 	status_port;
-	ACPI_IO_ADDRESS 	data_port;
-	u32			need_global_lock;
-} ec_context_t;
-
-
-typedef struct 
-{
-    ec_context_t	*ec;
-    u8			data;
-
-} EC_QUERY_DATA;
-
-static char object_name[] = {'_', 'Q', '0', '0', '\0'};
-
-static char hex[] = {'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'};
-
-
-static ACPI_STATUS
-ec_io_wait (
-    ec_context_t              *ec,
-    EC_EVENT                wait_event)
-{
-    EC_STATUS               ec_status = 0;
-    UINT32                  i = 100;
-
-    if (!ec || ((wait_event != EC_EVENT_OUTPUT_BUFFER_FULL) 
-        && (wait_event != EC_EVENT_INPUT_BUFFER_EMPTY)))
-        return(AE_BAD_PARAMETER);
-
-    /* 
-     * Wait for Event:
-     * ---------------
-     * Poll the EC status register waiting for the event to occur.
-     * Note that we'll wait a maximum of 1ms in 10us chunks.
-     */
-    switch (wait_event) {
-    case EC_EVENT_OUTPUT_BUFFER_FULL:
-        do {
-            ec_status = acpi_os_in8(ec->status_port);
-            if (ec_status & EC_FLAG_OUTPUT_BUFFER)
-                return(AE_OK);
-            acpi_os_sleep_usec(10);
-        } while (--i>0);
-        break;
-    case EC_EVENT_INPUT_BUFFER_EMPTY:
-        do {
-            ec_status = acpi_os_in8(ec->status_port);
-            if (!(ec_status & EC_FLAG_INPUT_BUFFER))
-                return(AE_OK);
-            acpi_os_sleep_usec(10);
-        } while (--i>0);
-        break;
-    }
-
-    return(AE_TIME);
-}
-
-static ACPI_STATUS
-ec_io_read (
-    ec_context_t              *ec,
-    ACPI_IO_ADDRESS         io_port,
-    UINT8                   *data,
-    EC_EVENT                wait_event)
-{
-    ACPI_STATUS             status = AE_OK;
-
-    if (!ec || !data)
-        return(AE_BAD_PARAMETER);
-
-    *data = acpi_os_in8(io_port);
-
-    if (wait_event)
-        status = ec_io_wait(ec, wait_event);
-
-    return(status);
-}
-
-static ACPI_STATUS
-ec_io_write (
-    ec_context_t              *ec,
-    ACPI_IO_ADDRESS         io_port,
-    UINT8                   data,
-    EC_EVENT                wait_event)
-{
-    ACPI_STATUS             status = AE_OK;
-
-    if (!ec)
-        return(AE_BAD_PARAMETER);
-
-    acpi_os_out8(io_port, data);
-
-    if (wait_event)
-        status = ec_io_wait(ec, wait_event);
-
-    return(status);
-}
-
-static ACPI_STATUS
-ec_read (
-    ec_context_t              *ec,
-    UINT8                   address,
-    UINT8                   *data)
-{
-    ACPI_STATUS             status = AE_OK;
-
-    FUNCTION_TRACE("ec_read");
-
-    if (!ec || !data)
-        return_ACPI_STATUS(AE_BAD_PARAMETER);
-
-    status = ec_io_write(ec, ec->status_port, EC_COMMAND_READ, EC_EVENT_INPUT_BUFFER_EMPTY);
-    if (ACPI_FAILURE(status)) {
-        DEBUG_PRINT(ACPI_WARN, ("Unable to send 'read command' to EC.\n"));
-        return_ACPI_STATUS(status);
-    }
-
-    status = ec_io_write(ec, ec->data_port, address, EC_EVENT_OUTPUT_BUFFER_FULL);
-    if (ACPI_FAILURE(status)) {
-        DEBUG_PRINT(ACPI_WARN, ("Unable to send 'read address' to EC.\n"));
-        return_ACPI_STATUS(status);
-    }
-
-    status = ec_io_read(ec, ec->data_port, data, EC_EVENT_NONE);
-
-    DEBUG_PRINT(ACPI_INFO, ("Read data[0x%02x] from address[0x%02x] on ec.\n", (*data), address));
-
-    return_ACPI_STATUS(status);
-}
-
-static ACPI_STATUS
-ec_write (
-    ec_context_t              *ec,
-    UINT8                   address,
-    UINT8                   data)
-{
-    ACPI_STATUS             status = AE_OK;
-
-    FUNCTION_TRACE("ec_write");
-
-    if (!ec)
-        return_ACPI_STATUS(AE_BAD_PARAMETER);
-
-    status = ec_io_write(ec, ec->status_port, EC_COMMAND_WRITE, EC_EVENT_INPUT_BUFFER_EMPTY);
-    if (ACPI_FAILURE(status)) {
-        DEBUG_PRINT(ACPI_WARN, ("Unable to send 'write command' to EC.\n"));
-        return_ACPI_STATUS(status);
-    }
-
-    status = ec_io_write(ec, ec->data_port, address, EC_EVENT_INPUT_BUFFER_EMPTY);
-    if (ACPI_FAILURE(status)) {
-        DEBUG_PRINT(ACPI_WARN, ("Unable to send 'write address' to EC.\n"));
-        return_ACPI_STATUS(status);
-    }
-
-    status = ec_io_write(ec, ec->data_port, data, EC_EVENT_INPUT_BUFFER_EMPTY);
-    if (ACPI_FAILURE(status)) {
-        DEBUG_PRINT(ACPI_WARN, ("Unable to send 'write data' to EC.\n"));
-        return_ACPI_STATUS(status);
-    }
-
-    DEBUG_PRINT(ACPI_INFO, ("Wrote data[0x%02x] to address[0x%02x] on ec.\n", data, address));
-
-    return_ACPI_STATUS(status);
-}
-
-static ACPI_STATUS
-ec_transaction (
-    ec_context_t              *ec,
-    EC_REQUEST              *request)
-{
-    ACPI_STATUS             status = AE_OK;
-
-    FUNCTION_TRACE("ec_transaction");
-
-    if (!ec || !request)
-        return_ACPI_STATUS(AE_BAD_PARAMETER);
-
-    /*
-     * Obtaining semaphore (mutex) to serialize all EC transactions.
-     */
-    /*
-    DEBUG_PRINT(ACPI_INFO, ("Calling acpi_os_wait_semaphore(%p, 1, %d)\n", ec->mutex, EC_DEFAULT_TIMEOUT));
-    status = acpi_os_wait_semaphore(ec->mutex, 1, EC_DEFAULT_TIMEOUT);
-    if (ACPI_FAILURE(status))
-        return_ACPI_STATUS(status);
-    */
-
-    /*
-     * Perform the transaction.
-     */
-    switch (request->command) {
-
-    case EC_COMMAND_READ:
-        status = ec_read(ec, request->address, &(request->data));
-        break;
-
-    case EC_COMMAND_WRITE:
-        status = ec_write(ec, request->address, request->data);
-        break;
-
-    default:
-        status = AE_SUPPORT;
-        break;
-    }
-
-    /*
-     * Signal the semaphore (mutex) to indicate transaction completion.
-     */
-    /*
-    DEBUG_PRINT(ACPI_INFO, ("Calling acpi_os_signal_semaphore(%p, 1)\n", ec->mutex));
-    acpi_os_signal_semaphore(ec->mutex, 1);
-    */
-
-    return_ACPI_STATUS(status);
-}
-
-
-static void
-ec_query_handler (
-    void                    *context)
-{
-    ACPI_STATUS             status = AE_OK;
-    EC_QUERY_DATA           *ec_q = (EC_QUERY_DATA*)context;
-
-    FUNCTION_TRACE("ec_query_handler");
-
-    if (!ec_q || !ec_q->ec) {
-        DEBUG_PRINT(ACPI_ERROR, ("Invalid (NULL) context.\n"));
-        return_VOID;
-    }
-
-    /*
-     * Evaluate _Qxx:
-     * --------------
-     * Evaluate corresponding _Qxx method.  Note that a zero query
-     * value indicates a spurious EC_SCI (no such thing as _Q00).
-     */
-    object_name[2] = hex[((ec_q->data >> 4) & 0x0F)];
-    object_name[3] = hex[(ec_q->data & 0x0F)];
-
-    DEBUG_PRINT(ACPI_INFO, ("Read query data[0x%02x] from ec - evaluating [%s].\n", ec_q->data, object_name));
-
-    status = acpi_evaluate_object(ec_q->ec->acpi_handle, object_name, NULL, NULL);
-
-    kfree(ec_q);
-
-    return_VOID;
-}
-
-/*
- * handle GPE
- */
-static void
-ec_gpe_handler(void *context)
-{
-    ACPI_STATUS             status = AE_OK;
-    ec_context_t            *ec = (ec_context_t *) context;
-    EC_QUERY_DATA           *ec_q = NULL;
-    EC_STATUS               ec_status = 0;
-
-    FUNCTION_TRACE("ec_gpe_handler");
-
-    if (!ec) {
-        DEBUG_PRINT(ACPI_INFO, ("Invalid (NULL) context.\n"));
-        return_VOID;
-    }
-
-    // GET SPINLOCK!
-
-    /*
-     * EC_SCI?
-     * -------
-     * Check the EC_SCI bit to see if this is an EC_SCI event.  If not (e.g.
-     * OBF/IBE) just return, as we already poll to detect these events.
-     */
-    ec_status = acpi_os_in8(ec->status_port);
-    DEBUG_PRINT(ACPI_INFO, ("EC Status Register: [0x%02x]\n", ec_status));
-    if (!(ec_status & EC_FLAG_SCI))
-        return_VOID;
-
-    DEBUG_PRINT(ACPI_INFO, ("EC_SCI detected - running QUERY.\n"));
-
-    // TODO: Need GFP_ATOMIC 'switch' for OSL interface...
-    ec_q = kmalloc(sizeof(EC_QUERY_DATA), GFP_ATOMIC);
-    if (!ec_q) {
-        DEBUG_PRINT(ACPI_INFO, ("Memory allocation failure.\n"));
-        return_VOID;
-    }
-
-    ec_q->ec = ec;
-    ec_q->data = 0;
-
-    /*
-     * Run Query:
-     * ----------
-     * Query the EC to find out which _Qxx method we need to evaluate.
-     * Note that successful completion of the query causes the EC_SCI
-     * bit to be cleared (and thus clearing the interrupt source).
-     */
-    status = ec_io_write(ec, ec->status_port, EC_COMMAND_QUERY, EC_EVENT_OUTPUT_BUFFER_FULL);
-    if (ACPI_FAILURE(status)) {
-        DEBUG_PRINT(ACPI_WARN, ("Unable to send 'query command' to EC.\n"));
-        goto End;
-    }
-
-    status = ec_io_read(ec, ec->data_port, &(ec_q->data), EC_EVENT_NONE);
-    if (ACPI_FAILURE(status)) {
-        DEBUG_PRINT(ACPI_WARN, ("Error reading query data.\n"));
-        goto End;
-    }
-
-    // RELEASE SPINLOCK!
-
-    if (!ec_q->data) {
-        DEBUG_PRINT(ACPI_WARN, ("Spurious EC SCI detected.\n"));
-        status = AE_ERROR;
-        goto End;
-    }
-
-    /*
-     * Defer _Qxx Execution:
-     * ---------------------
-     * Can't evaluate this method now 'cause we're at interrupt-level.
-     */
-    status = acpi_os_queue_for_execution(OSD_PRIORITY_GPE, ec_query_handler, ec_q);
-    if (ACPI_FAILURE(status)) {
-        DEBUG_PRINT(ACPI_ERROR, ("Unable to defer _Qxx method evaluation.\n"));
-        goto End;
-    }
-
-End:
-    if (ACPI_FAILURE(status))
-        kfree(ec_q);
-    
-    return_VOID;
-}
-
-static ACPI_STATUS
-ec_region_setup (
-    ACPI_HANDLE handle,
-    u32 function,
-    void *handler_context,
-    void **region_context)
-{
-	FUNCTION_TRACE("acpi_ec_region_setup");
-
-	if (function == ACPI_REGION_DEACTIVATE)
-	{
-		if (*region_context)
-		{
-			acpi_cm_free (*region_context);
-			*region_context = NULL;
-		}
-
-		return_ACPI_STATUS (AE_OK);
-	}
-
-	*region_context = NULL;
-
-	return_ACPI_STATUS (AE_OK);
-}
-
-/*****************************************************************************
- * 
- * FUNCTION:    ec_region_handler
- *
- * PARAMETERS:  function            - Read or Write operation
- *              address             - Where in the space to read or write
- *              bit_width            - Field width in bits (8, 16, or 32)
- *              value               - Pointer to in or out value
- *              context             - context pointer
- *
- * RETURN:      <TBD>
- *
- * DESCRIPTION: Handler for the Embedded Controller (EC) address space 
- *              (Op Region)
- *
- ****************************************************************************/
-
-static ACPI_STATUS
-ec_region_handler (
-    UINT32                  function,
-    ACPI_PHYSICAL_ADDRESS   address,
-    UINT32                  bit_width,
-    UINT32                  *value,
-    void                    *handler_context,
-    void                    *region_context)
-{
-    ACPI_STATUS             status = AE_OK;
-    ec_context_t              *ec = NULL;
-    EC_REQUEST              ec_request;
-
-    FUNCTION_TRACE("ec_space_handler");
-
-    if (address > 0xFF || bit_width != 8 || !value || !handler_context)
-        return_ACPI_STATUS(AE_BAD_PARAMETER);
-
-    ec = (ec_context_t*)handler_context;
-
-    switch (function) {
-
-    case ADDRESS_SPACE_READ:
-        ec_request.command = EC_COMMAND_READ;
-        ec_request.address = address;
-        ec_request.data = 0;
-        break;
-
-    case ADDRESS_SPACE_WRITE:
-        ec_request.command = EC_COMMAND_WRITE;
-        ec_request.address = address;
-        ec_request.data = (UINT8)(*value);
-        break;
-
-    default:
-        DEBUG_PRINT(ACPI_WARN, ("Received request with invalid function [0x%08X].\n", function));
-        return_ACPI_STATUS(AE_BAD_PARAMETER);
-        break;
-    }
-
-    DEBUG_PRINT(ACPI_INFO, ("device[ec] command[0x%02X] address[0x%02X] data[0x%02X]\n", ec_request.command, ec_request.address, ec_request.data));
-
-    /*
-     * Perform the Transaction.
-     */
-    status = ec_transaction(ec, &ec_request);
-    if (ACPI_SUCCESS(status))
-        (*value) = (UINT32)ec_request.data;
-
-    return_ACPI_STATUS(status);
-}
-
-/*
- * Get Embedded Controller information
- */
-static ACPI_STATUS
-found_ec(
-	ACPI_HANDLE handle,
-	u32 level, 
-	void *ctx, 
-	void **value)
-{
-	ACPI_STATUS status;
-	ACPI_OBJECT obj;
-	ACPI_BUFFER buf;
-	RESOURCE *res;
-	ec_context_t *ec_cxt;
-
-	buf.length = 0;
-	buf.pointer = NULL;
-	if (acpi_get_current_resources(handle, &buf) != AE_BUFFER_OVERFLOW)
-		return AE_OK;
-
-	buf.pointer = kmalloc(buf.length, GFP_KERNEL);
-	if (!buf.pointer)
-		return AE_NO_MEMORY;
-
-	if (!ACPI_SUCCESS(acpi_get_current_resources(handle, &buf))) {
-		kfree(buf.pointer);
-		return AE_OK;
-	}
-
-	ec_cxt = kmalloc(sizeof(ec_context_t), GFP_KERNEL);
-	if (!ec_cxt) {
-		kfree(buf.pointer);
-		return AE_NO_MEMORY;
-	}
-
-	ec_cxt->acpi_handle = handle;
-
-	res = (RESOURCE*) buf.pointer;
-	ec_cxt->data_port = res->data.io.min_base_address;
-	res = NEXT_RESOURCE(res);
-	ec_cxt->status_port = (int) res->data.io.min_base_address;
-
-	kfree(buf.pointer);
-
-	/* determine GPE bit */
-	/* BUG: in acpi 2.0 this could return a package */
-	buf.length = sizeof(obj);
-	buf.pointer = &obj;
-	if (!ACPI_SUCCESS(acpi_evaluate_object(handle, "_GPE", NULL, &buf))
-		|| obj.type != ACPI_TYPE_INTEGER)
-		return AE_OK;
-
-	ec_cxt->gpe_bit = obj.integer.value;
-
-	/* determine if we need the Global Lock when accessing */
-	buf.length = sizeof(obj);
-	buf.pointer = &obj;
-
-	status = acpi_evaluate_object(handle, "_GLK", NULL, &buf);
-	if (status == AE_NOT_FOUND)
-		ec_cxt->need_global_lock = 0;
-	else if (!ACPI_SUCCESS(status) || obj.type != ACPI_TYPE_INTEGER) {
-		DEBUG_PRINT(ACPI_ERROR, ("_GLK failed\n"));
-		return AE_OK;
-	}
-
-	ec_cxt->need_global_lock = obj.integer.value;
-
-	printk(KERN_INFO "ACPI: found EC @ (0x%02x,0x%02x,GPE %d GL %d)\n",
-		ec_cxt->data_port, ec_cxt->status_port, ec_cxt->gpe_bit,
-		ec_cxt->need_global_lock);
-
-	if (!ACPI_SUCCESS(acpi_install_gpe_handler(
-		ec_cxt->gpe_bit,
-		ACPI_EVENT_EDGE_TRIGGERED,
-		ec_gpe_handler,
-		ec_cxt))) {
-		
-		REPORT_ERROR(("Could not install GPE handler for EC.\n"));
-		return AE_OK;
-	}
-
-	status = acpi_install_address_space_handler (handle, ADDRESS_SPACE_EC, 
-		    ec_region_handler, ec_region_setup, ec_cxt);
-
-	if (!ACPI_SUCCESS(status)) {
-		REPORT_ERROR(("Could not install EC address "
-			"space handler, error %s\n", acpi_cm_format_exception (status)));
-	}
-	
-	return AE_OK;
-}
-
-int
-acpi_ec_init(void)
-{
-	acpi_get_devices(ACPI_EC_HID, 
-			found_ec,
-			NULL,
-			NULL);
-
-	return 0;
-}
-
-int
-acpi_ec_terminate(void)
-{
-	/* TODO */	
-	/* walk list of EC's */
-	/* free their context and release resources */
-	return 0;
-}
diff -urN linux-2.4.6-pre4/drivers/acpi/ec.h linux/drivers/acpi/ec.h
--- linux-2.4.6-pre4/drivers/acpi/ec.h	Fri Dec 29 14:07:21 2000
+++ linux/drivers/acpi/ec.h	Wed Dec 31 16:00:00 1969
@@ -1,100 +0,0 @@
-/*
- *  Copyright (C) 2000 Andrew Grover
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-
-#ifndef __EC_H__
-#define __EC_H__
-
-// TODO: Linux-specific
-#include <linux/spinlock.h>
-#include <asm/semaphore.h>
-
-#include <actypes.h>
-#include <acexcep.h>
-
-/*****************************************************************************
- *                             Types & Other Defines
- *****************************************************************************/
-
-#define EC_DEFAULT_TIMEOUT              1000            /* 1 second */
-#define EC_GPE_UNKNOWN                  0xFFFFFFFF
-#define EC_PORT_UNKNOWN                 0x00000000
-#define EC_BURST_ENABLE_ACKNOWLEDGE     0x90
-
-/* 
- * EC_COMMAND:
- * -----------
- */
-typedef UINT8                           EC_COMMAND;
-
-#define EC_COMMAND_UNKNOWN              ((EC_COMMAND) 0x00)
-#define EC_COMMAND_READ                 ((EC_COMMAND) 0x80)
-#define EC_COMMAND_WRITE                ((EC_COMMAND) 0x81)
-#define EC_COMMAND_QUERY                ((EC_COMMAND) 0x84)
-
-/*
- * EC_STATUS:
- * ----------
- * The encoding of the EC status register is illustrated below.
- * Note that a set bit (1) indicates the property is TRUE
- * (e.g. if bit 0 is set then the output buffer is full).
- * +-+-+-+-+-+-+-+-+
- * |7|6|5|4|3|2|1|0|    
- * +-+-+-+-+-+-+-+-+
- *  | | | | | | | |
- *  | | | | | | | +- Output Buffer Full (OBF)?
- *  | | | | | | +--- Input Buffer Full (IBF)?
- *  | | | | | +----- <reserved>
- *  | | | | +------- data Register is command Byte?
- *  | | | +--------- Burst Mode Enabled?
- *  | | +----------- SCI event?
- *  | +------------- SMI event?
- *  +--------------- <Reserved>
- *
- */
-typedef UINT8                           EC_STATUS;
-
-#define EC_FLAG_OUTPUT_BUFFER           ((EC_STATUS) 0x01)
-#define EC_FLAG_INPUT_BUFFER            ((EC_STATUS) 0x02)
-#define EC_FLAG_BURST_MODE              ((EC_STATUS) 0x10)
-#define EC_FLAG_SCI                     ((EC_STATUS) 0x20)
-
-/* 
- * EC_EVENT:
- * ---------
- */
-typedef UINT8                           EC_EVENT;
-
-#define EC_EVENT_UNKNOWN                ((EC_EVENT) 0x00)
-#define EC_EVENT_NONE                   ((EC_EVENT) 0x00)
-#define EC_EVENT_OUTPUT_BUFFER_FULL		((EC_EVENT) 0x01)
-#define EC_EVENT_INPUT_BUFFER_EMPTY  	((EC_EVENT) 0x02)
-#define EC_EVENT_SCI                    ((EC_EVENT) 0x03)
-
-/*
- * EC_REQUEST:
- * -----------
- */
-typedef struct
-{
-    EC_COMMAND              command;
-    UINT8                   address;
-    UINT8                   data;
-} EC_REQUEST;
-
-#endif  /* __EC_H__ */
diff -urN linux-2.4.6-pre4/drivers/acpi/events/Makefile linux/drivers/acpi/events/Makefile
--- linux-2.4.6-pre4/drivers/acpi/events/Makefile	Fri Dec 29 14:07:21 2000
+++ linux/drivers/acpi/events/Makefile	Mon Dec  3 22:48:42 2001
@@ -1,16 +1,12 @@
 #
 # Makefile for all Linux ACPI interpreter subdirectories
+# EXCEPT for the ospm directory
 #
 
-O_TARGET := ../$(shell basename `pwd`).o
+O_TARGET := $(notdir $(CURDIR)).o
 
 obj-$(CONFIG_ACPI) := $(patsubst %.c,%.o,$(wildcard *.c))
 
-EXTRA_CFLAGS += -I../include
-
 EXTRA_CFLAGS += $(ACPI_CFLAGS)
 
 include $(TOPDIR)/Rules.make
-
-clean:
-	$(RM) *.o 
diff -urN linux-2.4.6-pre4/drivers/acpi/events/evevent.c linux/drivers/acpi/events/evevent.c
--- linux-2.4.6-pre4/drivers/acpi/events/evevent.c	Fri Feb  9 11:45:58 2001
+++ linux/drivers/acpi/events/evevent.c	Mon Dec  3 22:48:42 2001
@@ -2,7 +2,7 @@
  *
  * Module Name: evevent - Fixed and General Purpose Acpi_event
  *                          handling and dispatch
- *              $Revision: 34 $
+ *              $Revision: 43 $
  *
  *****************************************************************************/
 
@@ -28,13 +28,12 @@
 #include "achware.h"
 #include "acevents.h"
 #include "acnamesp.h"
-#include "accommon.h"
 
-#define _COMPONENT          EVENT_HANDLING
+#define _COMPONENT          ACPI_EVENTS
 	 MODULE_NAME         ("evevent")
 
 
-/**************************************************************************
+/*******************************************************************************
  *
  * FUNCTION:    Acpi_ev_initialize
  *
@@ -46,7 +45,7 @@
  *              configured, disables SCI event sources, installs the SCI
  *              handler
  *
- *************************************************************************/
+ ******************************************************************************/
 
 ACPI_STATUS
 acpi_ev_initialize (
@@ -114,7 +113,7 @@
 }
 
 
-/******************************************************************************
+/*******************************************************************************
  *
  * FUNCTION:    Acpi_ev_fixed_event_initialize
  *
@@ -133,7 +132,7 @@
 
 	/* Initialize the structure that keeps track of fixed event handlers */
 
-	for (i = 0; i < NUM_FIXED_EVENTS; i++) {
+	for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++) {
 		acpi_gbl_fixed_event_handlers[i].handler = NULL;
 		acpi_gbl_fixed_event_handlers[i].context = NULL;
 	}
@@ -148,7 +147,7 @@
 }
 
 
-/******************************************************************************
+/*******************************************************************************
  *
  * FUNCTION:    Acpi_ev_fixed_event_detect
  *
@@ -179,32 +178,28 @@
 	/* power management timer roll over */
 
 	if ((status_register & ACPI_STATUS_PMTIMER) &&
-		(enable_register & ACPI_ENABLE_PMTIMER))
-	{
+		(enable_register & ACPI_ENABLE_PMTIMER)) {
 		int_status |= acpi_ev_fixed_event_dispatch (ACPI_EVENT_PMTIMER);
 	}
 
-	/* global event (BIOS want's the global lock) */
+	/* global event (BIOS wants the global lock) */
 
 	if ((status_register & ACPI_STATUS_GLOBAL) &&
-		(enable_register & ACPI_ENABLE_GLOBAL))
-	{
+		(enable_register & ACPI_ENABLE_GLOBAL)) {
 		int_status |= acpi_ev_fixed_event_dispatch (ACPI_EVENT_GLOBAL);
 	}
 
 	/* power button event */
 
 	if ((status_register & ACPI_STATUS_POWER_BUTTON) &&
-		(enable_register & ACPI_ENABLE_POWER_BUTTON))
-	{
+		(enable_register & ACPI_ENABLE_POWER_BUTTON)) {
 		int_status |= acpi_ev_fixed_event_dispatch (ACPI_EVENT_POWER_BUTTON);
 	}
 
 	/* sleep button event */
 
 	if ((status_register & ACPI_STATUS_SLEEP_BUTTON) &&
-		(enable_register & ACPI_ENABLE_SLEEP_BUTTON))
-	{
+		(enable_register & ACPI_ENABLE_SLEEP_BUTTON)) {
 		int_status |= acpi_ev_fixed_event_dispatch (ACPI_EVENT_SLEEP_BUTTON);
 	}
 
@@ -212,7 +207,7 @@
 }
 
 
-/******************************************************************************
+/*******************************************************************************
  *
  * FUNCTION:    Acpi_ev_fixed_event_dispatch
  *
@@ -233,8 +228,7 @@
 
 	/* Clear the status bit */
 
-	switch (event)
-	{
+	switch (event) {
 	case ACPI_EVENT_PMTIMER:
 		register_id = TMR_STS;
 		break;
@@ -286,7 +280,7 @@
 }
 
 
-/******************************************************************************
+/*******************************************************************************
  *
  * FUNCTION:    Acpi_ev_gpe_initialize
  *
@@ -339,7 +333,7 @@
 	 * Allocate the Gpe information block
 	 */
 
-	acpi_gbl_gpe_registers = acpi_cm_callocate (acpi_gbl_gpe_register_count *
+	acpi_gbl_gpe_registers = acpi_ut_callocate (acpi_gbl_gpe_register_count *
 			 sizeof (ACPI_GPE_REGISTERS));
 	if (!acpi_gbl_gpe_registers) {
 		return (AE_NO_MEMORY);
@@ -351,16 +345,16 @@
 	 * Initialization to zeros is sufficient
 	 */
 
-	acpi_gbl_gpe_info = acpi_cm_callocate (MUL_8 (acpi_gbl_gpe_register_count) *
+	acpi_gbl_gpe_info = acpi_ut_callocate (MUL_8 (acpi_gbl_gpe_register_count) *
 			 sizeof (ACPI_GPE_LEVEL_INFO));
 	if (!acpi_gbl_gpe_info) {
-		acpi_cm_free (acpi_gbl_gpe_registers);
+		acpi_ut_free (acpi_gbl_gpe_registers);
 		return (AE_NO_MEMORY);
 	}
 
 	/* Set the Gpe validation table to GPE_INVALID */
 
-	MEMSET (acpi_gbl_gpe_valid, (int) ACPI_GPE_INVALID, NUM_GPE);
+	MEMSET (acpi_gbl_gpe_valid, (int) ACPI_GPE_INVALID, ACPI_NUM_GPE);
 
 	/*
 	 * Initialize the Gpe information and validation blocks.  A goal of these
@@ -430,7 +424,7 @@
 }
 
 
-/******************************************************************************
+/*******************************************************************************
  *
  * FUNCTION:    Acpi_ev_save_method_info
  *
@@ -464,6 +458,9 @@
 	u8                      type;
 
 
+	PROC_NAME ("Ev_save_method_info");
+
+
 	/* Extract the name from the object and convert to a string */
 
 	MOVE_UNALIGNED32_TO_32 (name, &((ACPI_NAMESPACE_NODE *) obj_handle)->name);
@@ -520,7 +517,7 @@
 }
 
 
-/******************************************************************************
+/*******************************************************************************
  *
  * FUNCTION:    Acpi_ev_init_gpe_control_methods
  *
@@ -557,7 +554,7 @@
 }
 
 
-/******************************************************************************
+/*******************************************************************************
  *
  * FUNCTION:    Acpi_ev_gpe_detect
  *
@@ -623,7 +620,7 @@
 }
 
 
-/******************************************************************************
+/*******************************************************************************
  *
  * FUNCTION:    Acpi_ev_asynch_execute_gpe_method
  *
@@ -650,9 +647,9 @@
 	/*
 	 * Take a snapshot of the GPE info for this level
 	 */
-	acpi_cm_acquire_mutex (ACPI_MTX_EVENTS);
+	acpi_ut_acquire_mutex (ACPI_MTX_EVENTS);
 	gpe_info = acpi_gbl_gpe_info [gpe_number];
-	acpi_cm_release_mutex (ACPI_MTX_EVENTS);
+	acpi_ut_release_mutex (ACPI_MTX_EVENTS);
 
 	/*
 	 * Method Handler (_Lxx, _Exx):
@@ -681,7 +678,7 @@
 }
 
 
-/******************************************************************************
+/*******************************************************************************
  *
  * FUNCTION:    Acpi_ev_gpe_dispatch
  *
@@ -706,7 +703,6 @@
 {
 	ACPI_GPE_LEVEL_INFO     gpe_info;
 
-	/*DEBUG_INCREMENT_EVENT_COUNT (EVENT_GENERAL);*/
 
 	/*
 	 * Valid GPE number?
@@ -751,8 +747,7 @@
 	 */
 	else if (gpe_info.method_handle) {
 		if (ACPI_FAILURE(acpi_os_queue_for_execution (OSD_PRIORITY_GPE,
-			acpi_ev_asynch_execute_gpe_method, (void*)(NATIVE_UINT)gpe_number)))
-		{
+			acpi_ev_asynch_execute_gpe_method, (void*) gpe_number))) {
 			/*
 			 * Shoudn't occur, but if it does report an error. Note that
 			 * the GPE will remain disabled until the ACPI Core Subsystem
diff -urN linux-2.4.6-pre4/drivers/acpi/events/evmisc.c linux/drivers/acpi/events/evmisc.c
--- linux-2.4.6-pre4/drivers/acpi/events/evmisc.c	Mon Jan 22 13:23:42 2001
+++ linux/drivers/acpi/events/evmisc.c	Mon Dec  3 22:48:42 2001
@@ -2,7 +2,7 @@
  *
  * Module Name: evmisc - ACPI device notification handler dispatch
  *                       and ACPI Global Lock support
- *              $Revision: 22 $
+ *              $Revision: 31 $
  *
  *****************************************************************************/
 
@@ -30,13 +30,13 @@
 #include "acinterp.h"
 #include "achware.h"
 
-#define _COMPONENT          EVENT_HANDLING
+#define _COMPONENT          ACPI_EVENTS
 	 MODULE_NAME         ("evmisc")
 
 
-/**************************************************************************
+/*******************************************************************************
  *
- * FUNCTION:    Acpi_ev_notify_dispatch
+ * FUNCTION:    Acpi_ev_queue_notify_request
  *
  * PARAMETERS:
  *
@@ -45,16 +45,20 @@
  * DESCRIPTION: Dispatch a device notification event to a previously
  *              installed handler.
  *
- *************************************************************************/
+ ******************************************************************************/
 
-void
-acpi_ev_notify_dispatch (
-	ACPI_HANDLE             device,
+ACPI_STATUS
+acpi_ev_queue_notify_request (
+	ACPI_NAMESPACE_NODE     *node,
 	u32                     notify_value)
 {
 	ACPI_OPERAND_OBJECT     *obj_desc;
-	ACPI_OPERAND_OBJECT     *handler_obj;
-	NOTIFY_HANDLER          handler;
+	ACPI_OPERAND_OBJECT     *handler_obj = NULL;
+	ACPI_GENERIC_STATE      *notify_info;
+	ACPI_STATUS             status = AE_OK;
+
+
+	PROC_NAME ("Ev_queue_notify_request");
 
 
 	/*
@@ -64,9 +68,7 @@
 	 * initiate soft-off or sleep operation?
 	 */
 
-
-	switch (notify_value)
-	{
+	switch (notify_value) {
 	case 0:
 		break;
 
@@ -85,67 +87,136 @@
 
 
 	/*
-	 * Invoke a global notify handler if installed.
-	 * This is done _before_ we invoke the per-device handler attached to the device.
+	 * Get the notify object attached to the device Node
 	 */
 
-	if (notify_value <= MAX_SYS_NOTIFY) {
-		/* Global system notification handler */
+	obj_desc = acpi_ns_get_attached_object (node);
+	if (obj_desc) {
 
-		if (acpi_gbl_sys_notify.handler) {
-			acpi_gbl_sys_notify.handler (device, notify_value,
-					  acpi_gbl_sys_notify.context);
+		/* We have the notify object, Get the right handler */
+
+		switch (node->type) {
+		case ACPI_TYPE_DEVICE:
+			if (notify_value <= MAX_SYS_NOTIFY) {
+				handler_obj = obj_desc->device.sys_handler;
+			}
+			else {
+				handler_obj = obj_desc->device.drv_handler;
+			}
+			break;
+
+		case ACPI_TYPE_THERMAL:
+			if (notify_value <= MAX_SYS_NOTIFY) {
+				handler_obj = obj_desc->thermal_zone.sys_handler;
+			}
+			else {
+				handler_obj = obj_desc->thermal_zone.drv_handler;
+			}
+			break;
 		}
 	}
 
-	else {
-		/* Global driver notification handler */
 
-		if (acpi_gbl_drv_notify.handler) {
-			acpi_gbl_drv_notify.handler (device, notify_value,
-					  acpi_gbl_drv_notify.context);
+	/* If there is any handler to run, schedule the dispatcher */
+
+	if ((acpi_gbl_sys_notify.handler && (notify_value <= MAX_SYS_NOTIFY)) ||
+		(acpi_gbl_drv_notify.handler && (notify_value > MAX_SYS_NOTIFY)) ||
+		handler_obj) {
+
+		notify_info = acpi_ut_create_generic_state ();
+		if (!notify_info) {
+			return (AE_NO_MEMORY);
+		}
+
+		notify_info->notify.node      = node;
+		notify_info->notify.value     = (u16) notify_value;
+		notify_info->notify.handler_obj = handler_obj;
+
+		status = acpi_os_queue_for_execution (OSD_PRIORITY_HIGH,
+				  acpi_ev_notify_dispatch, notify_info);
+		if (ACPI_FAILURE (status)) {
+			acpi_ut_delete_generic_state (notify_info);
 		}
 	}
 
+	if (!handler_obj) {
+		/* There is no per-device notify handler for this device */
 
-	/*
-	 * Get the notify object which must be attached to the device Node
-	 */
+	}
 
-	obj_desc = acpi_ns_get_attached_object ((ACPI_HANDLE) device);
-	if (!obj_desc) {
-		/* There can be no notify handler for this device */
+	return (status);
+}
 
-		return;
-	}
 
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ev_notify_dispatch
+ *
+ * PARAMETERS:
+ *
+ * RETURN:      None.
+ *
+ * DESCRIPTION: Dispatch a device notification event to a previously
+ *              installed handler.
+ *
+ ******************************************************************************/
+
+void
+acpi_ev_notify_dispatch (
+	void                    *context)
+{
+	ACPI_GENERIC_STATE      *notify_info = (ACPI_GENERIC_STATE *) context;
+	ACPI_NOTIFY_HANDLER     global_handler = NULL;
+	void                    *global_context = NULL;
+	ACPI_OPERAND_OBJECT     *handler_obj;
 
-	/* We have the notify object, Get the right handler */
 
-	if (notify_value <= MAX_SYS_NOTIFY) {
-		handler_obj = obj_desc->device.sys_handler;
+	/*
+	 * We will invoke a global notify handler if installed.
+	 * This is done _before_ we invoke the per-device handler attached to the device.
+	 */
+
+	if (notify_info->notify.value <= MAX_SYS_NOTIFY) {
+		/* Global system notification handler */
+
+		if (acpi_gbl_sys_notify.handler) {
+			global_handler = acpi_gbl_sys_notify.handler;
+			global_context = acpi_gbl_sys_notify.context;
+		}
 	}
+
 	else {
-		handler_obj = obj_desc->device.drv_handler;
+		/* Global driver notification handler */
+
+		if (acpi_gbl_drv_notify.handler) {
+			global_handler = acpi_gbl_drv_notify.handler;
+			global_context = acpi_gbl_drv_notify.context;
+		}
 	}
 
-	/* Validate the handler */
 
-	if (!handler_obj) {
-		/* There is no notify handler for this device */
+	/* Invoke the system handler first, if present */
 
-		return;
+	if (global_handler) {
+		global_handler (notify_info->notify.node, notify_info->notify.value, global_context);
 	}
 
-	/* There is a handler, invoke it */
+	/* Now invoke the per-device handler, if present */
 
-	handler = handler_obj->notify_handler.handler;
-	handler (device, notify_value, handler_obj->notify_handler.context);
+	handler_obj = notify_info->notify.handler_obj;
+	if (handler_obj) {
+		handler_obj->notify_handler.handler (notify_info->notify.node, notify_info->notify.value,
+				  handler_obj->notify_handler.context);
+	}
 
+
+	/* All done with the info object */
+
+	acpi_ut_delete_generic_state (notify_info);
 }
 
 
-/***************************************************************************
+/*******************************************************************************
  *
  * FUNCTION:    Acpi_ev_global_lock_thread
  *
@@ -155,7 +226,7 @@
  *              Global Lock.  Simply signal all threads that are waiting
  *              for the lock.
  *
- **************************************************************************/
+ ******************************************************************************/
 
 static void
 acpi_ev_global_lock_thread (
@@ -173,7 +244,7 @@
 }
 
 
-/***************************************************************************
+/*******************************************************************************
  *
  * FUNCTION:    Acpi_ev_global_lock_handler
  *
@@ -183,7 +254,7 @@
  *              release interrupt occurs.  Grab the global lock and queue
  *              the global lock thread for execution
  *
- **************************************************************************/
+ ******************************************************************************/
 
 static u32
 acpi_ev_global_lock_handler (
@@ -216,7 +287,7 @@
 }
 
 
-/***************************************************************************
+/*******************************************************************************
  *
  * FUNCTION:    Acpi_ev_init_global_lock_handler
  *
@@ -224,7 +295,7 @@
  *
  * DESCRIPTION: Install a handler for the global lock release event
  *
- **************************************************************************/
+ ******************************************************************************/
 
 ACPI_STATUS
 acpi_ev_init_global_lock_handler (void)
@@ -232,14 +303,27 @@
 	ACPI_STATUS             status;
 
 
+	acpi_gbl_global_lock_present = TRUE;
 	status = acpi_install_fixed_event_handler (ACPI_EVENT_GLOBAL,
 			  acpi_ev_global_lock_handler, NULL);
 
+	/*
+	 * If the global lock does not exist on this platform, the attempt
+	 * to enable GBL_STS will fail (the GBL_EN bit will not stick)
+	 * Map to AE_OK, but mark global lock as not present.
+	 * Any attempt to actually use the global lock will be flagged
+	 * with an error.
+	 */
+	if (status == AE_NO_HARDWARE_RESPONSE) {
+		acpi_gbl_global_lock_present = FALSE;
+		status = AE_OK;
+	}
+
 	return (status);
 }
 
 
-/***************************************************************************
+/******************************************************************************
  *
  * FUNCTION:    Acpi_ev_acquire_global_lock
  *
@@ -247,7 +331,7 @@
  *
  * DESCRIPTION: Attempt to gain ownership of the Global Lock.
  *
- **************************************************************************/
+ *****************************************************************************/
 
 ACPI_STATUS
 acpi_ev_acquire_global_lock(void)
@@ -257,6 +341,12 @@
 	void                    *global_lock;
 
 
+	/* Make sure that we actually have a global lock */
+
+	if (!acpi_gbl_global_lock_present) {
+		return (AE_NO_GLOBAL_LOCK);
+	}
+
 	/* One more thread wants the global lock */
 
 	acpi_gbl_global_lock_thread_count++;
@@ -283,7 +373,6 @@
 	   /* We got the lock */
 
 		acpi_gbl_global_lock_acquired = TRUE;
-
 		return (AE_OK);
 	}
 
@@ -298,20 +387,19 @@
 	  * Since this wait will block, we must release the interpreter
 	  */
 
-	status = acpi_aml_system_wait_semaphore (acpi_gbl_global_lock_semaphore,
+	status = acpi_ex_system_wait_semaphore (acpi_gbl_global_lock_semaphore,
 			  ACPI_UINT32_MAX);
-
 	return (status);
 }
 
 
-/***************************************************************************
+/*******************************************************************************
  *
  * FUNCTION:    Acpi_ev_release_global_lock
  *
  * DESCRIPTION: Releases ownership of the Global Lock.
  *
- **************************************************************************/
+ ******************************************************************************/
 
 void
 acpi_ev_release_global_lock (void)
@@ -321,7 +409,7 @@
 
 
 	if (!acpi_gbl_global_lock_thread_count) {
-		REPORT_WARNING(("Releasing a non-acquired Global Lock\n"));
+		REPORT_WARNING(("Global Lock has not be acquired, cannot release\n"));
 		return;
 	}
 
diff -urN linux-2.4.6-pre4/drivers/acpi/events/evregion.c linux/drivers/acpi/events/evregion.c
--- linux-2.4.6-pre4/drivers/acpi/events/evregion.c	Fri Feb  9 11:45:58 2001
+++ linux/drivers/acpi/events/evregion.c	Mon Dec  3 22:48:42 2001
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: evregion - ACPI Address_space (Op_region) handler dispatch
- *              $Revision: 96 $
+ *              $Revision: 103 $
  *
  *****************************************************************************/
 
@@ -30,11 +30,11 @@
 #include "acinterp.h"
 #include "amlcode.h"
 
-#define _COMPONENT          EVENT_HANDLING
+#define _COMPONENT          ACPI_EVENTS
 	 MODULE_NAME         ("evregion")
 
 
-/**************************************************************************
+/*******************************************************************************
  *
  * FUNCTION:    Acpi_ev_install_default_address_space_handlers
  *
@@ -44,7 +44,7 @@
  *
  * DESCRIPTION: Installs the core subsystem address space handlers.
  *
- *************************************************************************/
+ ******************************************************************************/
 
 ACPI_STATUS
 acpi_ev_install_default_address_space_handlers (
@@ -70,29 +70,26 @@
 	 */
 
 	status = acpi_install_address_space_handler (acpi_gbl_root_node,
-			   ADDRESS_SPACE_SYSTEM_MEMORY,
+			   ACPI_ADR_SPACE_SYSTEM_MEMORY,
 			   ACPI_DEFAULT_HANDLER, NULL, NULL);
 	if ((ACPI_FAILURE (status)) &&
-		(status != AE_EXIST))
-	{
+		(status != AE_EXIST)) {
 		return (status);
 	}
 
 	status = acpi_install_address_space_handler (acpi_gbl_root_node,
-			   ADDRESS_SPACE_SYSTEM_IO,
+			   ACPI_ADR_SPACE_SYSTEM_IO,
 			   ACPI_DEFAULT_HANDLER, NULL, NULL);
 	if ((ACPI_FAILURE (status)) &&
-		(status != AE_EXIST))
-	{
+		(status != AE_EXIST)) {
 		return (status);
 	}
 
 	status = acpi_install_address_space_handler (acpi_gbl_root_node,
-			   ADDRESS_SPACE_PCI_CONFIG,
+			   ACPI_ADR_SPACE_PCI_CONFIG,
 			   ACPI_DEFAULT_HANDLER, NULL, NULL);
 	if ((ACPI_FAILURE (status)) &&
-		(status != AE_EXIST))
-	{
+		(status != AE_EXIST)) {
 		return (status);
 	}
 
@@ -103,7 +100,7 @@
 
 /* TBD: [Restructure] Move elsewhere */
 
-/**************************************************************************
+/*******************************************************************************
  *
  * FUNCTION:    Acpi_ev_execute_reg_method
  *
@@ -114,7 +111,7 @@
  *
  * DESCRIPTION: Execute _REG method for a region
  *
- *************************************************************************/
+ ******************************************************************************/
 
 static ACPI_STATUS
 acpi_ev_execute_reg_method (
@@ -141,8 +138,8 @@
 	 *          Passed as a parameter
 	 */
 
-	acpi_cm_init_static_object (&space_id_desc);
-	acpi_cm_init_static_object (&function_desc);
+	acpi_ut_init_static_object (&space_id_desc);
+	acpi_ut_init_static_object (&function_desc);
 
 	/*
 	 *  Method requires two parameters.
@@ -168,7 +165,7 @@
 }
 
 
-/**************************************************************************
+/*******************************************************************************
  *
  * FUNCTION:    Acpi_ev_address_space_dispatch
  *
@@ -184,7 +181,7 @@
  * DESCRIPTION: Dispatch an address space or operation region access to
  *              a previously installed handler.
  *
- *************************************************************************/
+ ******************************************************************************/
 
 ACPI_STATUS
 acpi_ev_address_space_dispatch (
@@ -195,28 +192,27 @@
 	u32                     *value)
 {
 	ACPI_STATUS             status;
-	ADDRESS_SPACE_HANDLER   handler;
-	ADDRESS_SPACE_SETUP     region_setup;
+	ACPI_ADR_SPACE_HANDLER  handler;
+	ACPI_ADR_SPACE_SETUP    region_setup;
 	ACPI_OPERAND_OBJECT     *handler_desc;
 	void                    *region_context = NULL;
 
 
 	/*
-	 *  Check for an installed handler
+	 * Ensure that there is a handler associated with this region
 	 */
 	handler_desc = region_obj->region.addr_handler;
-
 	if (!handler_desc) {
 		return(AE_NOT_EXIST);
 	}
 
 	/*
-	 *  It may be the case that the region has never been initialized
-	 *  Some types of regions require special init code
+	 * It may be the case that the region has never been initialized
+	 * Some types of regions require special init code
 	 */
 	if (!(region_obj->region.flags & AOPOBJ_INITIALIZED)) {
 		/*
-		 *  This region has not been initialized yet, do it
+		 * This region has not been initialized yet, do it
 		 */
 		region_setup = handler_desc->addr_handler.setup;
 		if (!region_setup) {
@@ -230,15 +226,14 @@
 		 * We must exit the interpreter because the region setup will potentially
 		 * execute control methods
 		 */
-		acpi_aml_exit_interpreter ();
+		acpi_ex_exit_interpreter ();
 
 		status = region_setup (region_obj, ACPI_REGION_ACTIVATE,
-				  handler_desc->addr_handler.context,
-				  &region_context);
+				  handler_desc->addr_handler.context, &region_context);
 
 		/* Re-enter the interpreter */
 
-		acpi_aml_enter_interpreter ();
+		acpi_ex_enter_interpreter ();
 
 		/*
 		 *  Init routine may fail
@@ -267,7 +262,7 @@
 		 *  exit the interpreter because the handler *might* block -- we don't
 		 *  know what it will do, so we can't hold the lock on the intepreter.
 		 */
-		acpi_aml_exit_interpreter();
+		acpi_ex_exit_interpreter();
 	}
 
 	/*
@@ -282,13 +277,13 @@
 		/* We just returned from a non-default handler, we must re-enter the
 		interpreter */
 
-		acpi_aml_enter_interpreter ();
+		acpi_ex_enter_interpreter ();
 	}
 
 	return (status);
 }
 
-/******************************************************************************
+/*******************************************************************************
  *
  * FUNCTION:    Acpi_ev_disassociate_region_from_handler
  *
@@ -310,7 +305,7 @@
 	ACPI_OPERAND_OBJECT     *handler_obj;
 	ACPI_OPERAND_OBJECT     *obj_desc;
 	ACPI_OPERAND_OBJECT     **last_obj_ptr;
-	ADDRESS_SPACE_SETUP     region_setup;
+	ACPI_ADR_SPACE_SETUP    region_setup;
 	void                    *region_context;
 	ACPI_STATUS             status;
 
@@ -349,7 +344,7 @@
 			obj_desc->region.next = NULL;           /* Must clear field */
 
 			if (acpi_ns_is_locked) {
-				acpi_cm_release_mutex (ACPI_MTX_NAMESPACE);
+				acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
 			}
 
 			/*
@@ -358,7 +353,7 @@
 			acpi_ev_execute_reg_method (region_obj, 0);
 
 			if (acpi_ns_is_locked) {
-				acpi_cm_acquire_mutex (ACPI_MTX_NAMESPACE);
+				acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
 			}
 
 			/*
@@ -366,8 +361,7 @@
 			 */
 			region_setup = handler_obj->addr_handler.setup;
 			status = region_setup (region_obj, ACPI_REGION_DEACTIVATE,
-					  handler_obj->addr_handler.context,
-					  &region_context);
+					  handler_obj->addr_handler.context, &region_context);
 
 			/*
 			 *  Init routine may fail, Just ignore errors
@@ -407,7 +401,7 @@
 }
 
 
-/******************************************************************************
+/*******************************************************************************
  *
  * FUNCTION:    Acpi_ev_associate_region_and_handler
  *
@@ -456,20 +450,20 @@
 	 *  Last thing, tell all users that this region is usable
 	 */
 	if (acpi_ns_is_locked) {
-		acpi_cm_release_mutex (ACPI_MTX_NAMESPACE);
+		acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
 	}
 
 	status = acpi_ev_execute_reg_method (region_obj, 1);
 
 	if (acpi_ns_is_locked) {
-		acpi_cm_acquire_mutex (ACPI_MTX_NAMESPACE);
+		acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
 	}
 
 	return (status);
 }
 
 
-/****************************************************************************
+/*******************************************************************************
  *
  * FUNCTION:    Acpi_ev_addr_handler_helper
  *
@@ -486,7 +480,7 @@
  *              This is because the existing handler is closer in proximity
  *              to any more regions than the one we are trying to install.
  *
- ***************************************************************************/
+ ******************************************************************************/
 
 ACPI_STATUS
 acpi_ev_addr_handler_helper (
@@ -502,6 +496,9 @@
 	ACPI_STATUS             status;
 
 
+	PROC_NAME ("Ev_addr_handler_helper");
+
+
 	handler_obj = (ACPI_OPERAND_OBJECT *) context;
 
 	/* Parameter validation */
@@ -524,14 +521,13 @@
 
 	if ((node->type != ACPI_TYPE_DEVICE) &&
 		(node->type != ACPI_TYPE_REGION) &&
-		(node != acpi_gbl_root_node))
-	{
+		(node != acpi_gbl_root_node)) {
 		return (AE_OK);
 	}
 
 	/* Check for an existing internal object */
 
-	obj_desc = acpi_ns_get_attached_object ((ACPI_HANDLE) node);
+	obj_desc = acpi_ns_get_attached_object (node);
 	if (!obj_desc) {
 		/*
 		 *  The object DNE, we don't care about it
@@ -555,7 +551,6 @@
 				/*
 				 *  It's for the same address space
 				 */
-
 				/*
 				 *  Since the object we found it on was a device, then it
 				 *  means that someone has already installed a handler for
diff -urN linux-2.4.6-pre4/drivers/acpi/events/evrgnini.c linux/drivers/acpi/events/evrgnini.c
--- linux-2.4.6-pre4/drivers/acpi/events/evrgnini.c	Mon Jan 22 13:23:42 2001
+++ linux/drivers/acpi/events/evrgnini.c	Mon Dec  3 22:48:42 2001
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: evrgnini- ACPI Address_space (Op_region) init
- *              $Revision: 33 $
+ *              $Revision: 40 $
  *
  *****************************************************************************/
 
@@ -30,11 +30,11 @@
 #include "acinterp.h"
 #include "amlcode.h"
 
-#define _COMPONENT          EVENT_HANDLING
+#define _COMPONENT          ACPI_EVENTS
 	 MODULE_NAME         ("evrgnini")
 
 
-/*****************************************************************************
+/*******************************************************************************
  *
  * FUNCTION:    Acpi_ev_system_memory_region_setup
  *
@@ -47,7 +47,7 @@
  *
  * DESCRIPTION: Do any prep work for region handling, a nop for now
  *
- ****************************************************************************/
+ ******************************************************************************/
 
 ACPI_STATUS
 acpi_ev_system_memory_region_setup (
@@ -59,7 +59,7 @@
 
 	if (function == ACPI_REGION_DEACTIVATE) {
 		if (*region_context) {
-			acpi_cm_free (*region_context);
+			acpi_ut_free (*region_context);
 			*region_context = NULL;
 		}
 		return (AE_OK);
@@ -68,7 +68,7 @@
 
 	/* Activate.  Create a new context */
 
-	*region_context = acpi_cm_callocate (sizeof (MEM_HANDLER_CONTEXT));
+	*region_context = acpi_ut_callocate (sizeof (ACPI_MEM_SPACE_CONTEXT));
 	if (!(*region_context)) {
 		return (AE_NO_MEMORY);
 	}
@@ -77,7 +77,7 @@
 }
 
 
-/*****************************************************************************
+/*******************************************************************************
  *
  * FUNCTION:    Acpi_ev_io_space_region_setup
  *
@@ -90,7 +90,7 @@
  *
  * DESCRIPTION: Do any prep work for region handling
  *
- ****************************************************************************/
+ ******************************************************************************/
 
 ACPI_STATUS
 acpi_ev_io_space_region_setup (
@@ -99,6 +99,7 @@
 	void                    *handler_context,
 	void                    **region_context)
 {
+
 	if (function == ACPI_REGION_DEACTIVATE) {
 		*region_context = NULL;
 	}
@@ -110,7 +111,7 @@
 }
 
 
-/*****************************************************************************
+/*******************************************************************************
  *
  * FUNCTION:    Acpi_ev_pci_config_region_setup
  *
@@ -125,7 +126,7 @@
  *
  * MUTEX:       Assumes namespace is not locked
  *
- ****************************************************************************/
+ ******************************************************************************/
 
 ACPI_STATUS
 acpi_ev_pci_config_region_setup (
@@ -136,25 +137,25 @@
 {
 	ACPI_STATUS             status = AE_OK;
 	ACPI_INTEGER            temp;
-	PCI_HANDLER_CONTEXT     *pci_context = *region_context;
+	ACPI_PCI_SPACE_CONTEXT  *pci_context = *region_context;
 	ACPI_OPERAND_OBJECT     *handler_obj;
 	ACPI_NAMESPACE_NODE     *node;
 	ACPI_OPERAND_OBJECT     *region_obj = (ACPI_OPERAND_OBJECT *) handle;
-	DEVICE_ID               object_hID;
+	ACPI_DEVICE_ID          object_hID;
 
-	handler_obj = region_obj->region.addr_handler;
 
+	handler_obj = region_obj->region.addr_handler;
 	if (!handler_obj) {
 		/*
 		 *  No installed handler. This shouldn't happen because the dispatch
 		 *  routine checks before we get here, but we check again just in case.
 		 */
-		return(AE_NOT_EXIST);
+		return (AE_NOT_EXIST);
 	}
 
 	if (function == ACPI_REGION_DEACTIVATE) {
 		if (pci_context) {
-			acpi_cm_free (pci_context);
+			acpi_ut_free (pci_context);
 			*region_context = NULL;
 		}
 
@@ -164,7 +165,7 @@
 
 	/* Create a new context */
 
-	pci_context = acpi_cm_callocate (sizeof(PCI_HANDLER_CONTEXT));
+	pci_context = acpi_ut_callocate (sizeof (ACPI_PCI_SPACE_CONTEXT));
 	if (!pci_context) {
 		return (AE_NO_MEMORY);
 	}
@@ -178,22 +179,20 @@
 	 *  First get device and function numbers from the _ADR object
 	 *  in the parent's scope.
 	 */
-	ACPI_ASSERT(region_obj->region.node);
+	ACPI_ASSERT (region_obj->region.node);
 
 	node = acpi_ns_get_parent_object (region_obj->region.node);
 
 
 	/* Acpi_evaluate the _ADR object */
 
-	status = acpi_cm_evaluate_numeric_object (METHOD_NAME__ADR, node, &temp);
+	status = acpi_ut_evaluate_numeric_object (METHOD_NAME__ADR, node, &temp);
+
 	/*
 	 *  The default is zero, since the allocation above zeroed the data, just
 	 *  do nothing on failures.
 	 */
 	if (ACPI_SUCCESS (status)) {
-		/*
-		 *  Got it..
-		 */
 		pci_context->dev_func = (u32) temp;
 	}
 
@@ -215,40 +214,31 @@
 		 * Node is currently the parent object
 		 */
 		while (node != acpi_gbl_root_node) {
-			status = acpi_cm_execute_HID(node, &object_hID);
-
+			status = acpi_ut_execute_HID (node, &object_hID);
 			if (ACPI_SUCCESS (status)) {
-				if (!(STRNCMP(object_hID.buffer, PCI_ROOT_HID_STRING,
-						   sizeof (PCI_ROOT_HID_STRING))))
-				{
-					acpi_install_address_space_handler(node,
-							   ADDRESS_SPACE_PCI_CONFIG,
+				if (!(STRNCMP (object_hID.buffer, PCI_ROOT_HID_STRING,
+						   sizeof (PCI_ROOT_HID_STRING)))) {
+					acpi_install_address_space_handler (node,
+							   ACPI_ADR_SPACE_PCI_CONFIG,
 							   ACPI_DEFAULT_HANDLER, NULL, NULL);
-
 					break;
 				}
 			}
 
-			node = acpi_ns_get_parent_object(node);
+			node = acpi_ns_get_parent_object (node);
 		}
 	}
 	else {
 		node = handler_obj->addr_handler.node;
 	}
 
-	status = acpi_cm_evaluate_numeric_object (METHOD_NAME__SEG, node, &temp);
+	status = acpi_ut_evaluate_numeric_object (METHOD_NAME__SEG, node, &temp);
 	if (ACPI_SUCCESS (status)) {
-		/*
-		 *  Got it..
-		 */
 		pci_context->seg = (u32) temp;
 	}
 
-	status = acpi_cm_evaluate_numeric_object (METHOD_NAME__BBN, node, &temp);
+	status = acpi_ut_evaluate_numeric_object (METHOD_NAME__BBN, node, &temp);
 	if (ACPI_SUCCESS (status)) {
-		/*
-		 *  Got it..
-		 */
 		pci_context->bus = (u32) temp;
 	}
 
@@ -258,7 +248,7 @@
 }
 
 
-/*****************************************************************************
+/*******************************************************************************
  *
  * FUNCTION:    Acpi_ev_default_region_setup
  *
@@ -271,7 +261,7 @@
  *
  * DESCRIPTION: Do any prep work for region handling
  *
- ****************************************************************************/
+ ******************************************************************************/
 
 ACPI_STATUS
 acpi_ev_default_region_setup (
@@ -280,6 +270,7 @@
 	void                    *handler_context,
 	void                    **region_context)
 {
+
 	if (function == ACPI_REGION_DEACTIVATE) {
 		*region_context = NULL;
 	}
@@ -291,7 +282,7 @@
 }
 
 
-/******************************************************************************
+/*******************************************************************************
  *
  * FUNCTION:    Acpi_ev_initialize_region
  *
@@ -307,7 +298,7 @@
  *
  *              This also performs address space specific intialization.  For
  *              example, PCI regions must have an _ADR object that contains
- *              a PCI address in the scope of the defintion.  This address is
+ *              a PCI address in the scope of the definition.  This address is
  *              required to perform an access to PCI config space.
  *
  ******************************************************************************/
@@ -317,20 +308,20 @@
 	ACPI_OPERAND_OBJECT     *region_obj,
 	u8                      acpi_ns_locked)
 {
-	ACPI_OPERAND_OBJECT    *handler_obj;
-	ACPI_OPERAND_OBJECT    *obj_desc;
-	ACPI_ADDRESS_SPACE_TYPE space_id;
-	ACPI_NAMESPACE_NODE    *node;
+	ACPI_OPERAND_OBJECT     *handler_obj;
+	ACPI_OPERAND_OBJECT     *obj_desc;
+	ACPI_ADR_SPACE_TYPE     space_id;
+	ACPI_NAMESPACE_NODE     *node;
 	ACPI_STATUS             status;
-	ACPI_NAMESPACE_NODE    *method_node;
-	ACPI_NAME              *reg_name_ptr = (ACPI_NAME *) METHOD_NAME__REG;
+	ACPI_NAMESPACE_NODE     *method_node;
+	ACPI_NAME               *reg_name_ptr = (ACPI_NAME *) METHOD_NAME__REG;
 
 
 	if (!region_obj) {
 		return (AE_BAD_PARAMETER);
 	}
 
-	ACPI_ASSERT(region_obj->region.node);
+	ACPI_ASSERT (region_obj->region.node);
 
 	node = acpi_ns_get_parent_object (region_obj->region.node);
 	space_id = region_obj->region.space_id;
@@ -362,13 +353,12 @@
 		 *  Check to see if a handler exists
 		 */
 		handler_obj = NULL;
-		obj_desc = acpi_ns_get_attached_object ((ACPI_HANDLE) node);
+		obj_desc = acpi_ns_get_attached_object (node);
 		if (obj_desc) {
 			/*
 			 *  can only be a handler if the object exists
 			 */
-			switch (node->type)
-			{
+			switch (node->type) {
 			case ACPI_TYPE_DEVICE:
 
 				handler_obj = obj_desc->device.addr_handler;
@@ -394,7 +384,8 @@
 					/*
 					 *  Found it! Now update the region and the handler
 					 */
-					acpi_ev_associate_region_and_handler (handler_obj, region_obj, acpi_ns_locked);
+					acpi_ev_associate_region_and_handler (handler_obj, region_obj,
+							acpi_ns_locked);
 					return (AE_OK);
 				}
 
diff -urN linux-2.4.6-pre4/drivers/acpi/events/evsci.c linux/drivers/acpi/events/evsci.c
--- linux-2.4.6-pre4/drivers/acpi/events/evsci.c	Tue Mar  6 19:44:36 2001
+++ linux/drivers/acpi/events/evsci.c	Mon Dec  3 22:48:42 2001
@@ -2,7 +2,7 @@
  *
  * Module Name: evsci - System Control Interrupt configuration and
  *                      legacy to ACPI mode state transition functions
- *              $Revision: 69 $
+ *              $Revision: 72 $
  *
  ******************************************************************************/
 
@@ -30,7 +30,7 @@
 #include "acevents.h"
 
 
-#define _COMPONENT          EVENT_HANDLING
+#define _COMPONENT          ACPI_EVENTS
 	 MODULE_NAME         ("evsci")
 
 
@@ -172,21 +172,6 @@
 
 /*******************************************************************************
  *
- * FUNCTION:    Acpi_ev_sci_count
- *
- * PARAMETERS:  Event       Event that generated an SCI.
- *
- * RETURN:      Number of SCI's for requested event since last time
- *              Sci_occurred() was called for this event.
- *
- * DESCRIPTION: Checks to see if SCI has been generated from requested source
- *              since the last time this function was called.
- *
- ******************************************************************************/
-
-
-/*******************************************************************************
- *
  * FUNCTION:    Acpi_ev_restore_acpi_state
  *
  * PARAMETERS:  none
@@ -209,8 +194,7 @@
 		/* Restore the fixed events */
 
 		if (acpi_hw_register_read (ACPI_MTX_LOCK, PM1_EN) !=
-				acpi_gbl_pm1_enable_register_save)
-		{
+				acpi_gbl_pm1_enable_register_save) {
 			acpi_hw_register_write (ACPI_MTX_LOCK, PM1_EN,
 				acpi_gbl_pm1_enable_register_save);
 		}
@@ -225,8 +209,7 @@
 
 		for (index = 0; index < DIV_2 (acpi_gbl_FADT->gpe0blk_len); index++) {
 			if (acpi_hw_register_read (ACPI_MTX_LOCK, GPE0_EN_BLOCK | index) !=
-					acpi_gbl_gpe0enable_register_save[index])
-			{
+					acpi_gbl_gpe0enable_register_save[index]) {
 				acpi_hw_register_write (ACPI_MTX_LOCK, GPE0_EN_BLOCK | index,
 					acpi_gbl_gpe0enable_register_save[index]);
 			}
@@ -237,8 +220,7 @@
 		if (acpi_gbl_FADT->gpe1_blk_len) {
 			for (index = 0; index < DIV_2 (acpi_gbl_FADT->gpe1_blk_len); index++) {
 				if (acpi_hw_register_read (ACPI_MTX_LOCK, GPE1_EN_BLOCK | index) !=
-					acpi_gbl_gpe1_enable_register_save[index])
-				{
+					acpi_gbl_gpe1_enable_register_save[index]) {
 					acpi_hw_register_write (ACPI_MTX_LOCK, GPE1_EN_BLOCK | index,
 						acpi_gbl_gpe1_enable_register_save[index]);
 				}
@@ -276,11 +258,11 @@
 	 */
 
 	if (acpi_gbl_gpe_registers) {
-		acpi_cm_free (acpi_gbl_gpe_registers);
+		acpi_ut_free (acpi_gbl_gpe_registers);
 	}
 
 	if (acpi_gbl_gpe_info) {
-		acpi_cm_free (acpi_gbl_gpe_info);
+		acpi_ut_free (acpi_gbl_gpe_info);
 	}
 
 	return;
diff -urN linux-2.4.6-pre4/drivers/acpi/events/evxface.c linux/drivers/acpi/events/evxface.c
--- linux-2.4.6-pre4/drivers/acpi/events/evxface.c	Mon Jan 22 13:23:42 2001
+++ linux/drivers/acpi/events/evxface.c	Mon Dec  3 22:48:42 2001
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: evxface - External interfaces for ACPI events
- *              $Revision: 101 $
+ *              $Revision: 110 $
  *
  *****************************************************************************/
 
@@ -31,11 +31,11 @@
 #include "amlcode.h"
 #include "acinterp.h"
 
-#define _COMPONENT          EVENT_HANDLING
+#define _COMPONENT          ACPI_EVENTS
 	 MODULE_NAME         ("evxface")
 
 
-/******************************************************************************
+/*******************************************************************************
  *
  * FUNCTION:    Acpi_install_fixed_event_handler
  *
@@ -54,19 +54,26 @@
 ACPI_STATUS
 acpi_install_fixed_event_handler (
 	u32                     event,
-	FIXED_EVENT_HANDLER     handler,
+	ACPI_EVENT_HANDLER      handler,
 	void                    *context)
 {
-	ACPI_STATUS             status = AE_OK;
+	ACPI_STATUS             status;
 
 
-	/* Sanity check the parameters. */
+	/* Ensure that ACPI has been initialized */
+
+	ACPI_IS_INITIALIZATION_COMPLETE (status);
+	if (ACPI_FAILURE (status)) {
+		return (status);
+	}
+
+	/* Parameter validation */
 
-	if (event >= NUM_FIXED_EVENTS) {
+	if (event > ACPI_EVENT_MAX) {
 		return (AE_BAD_PARAMETER);
 	}
 
-	acpi_cm_acquire_mutex (ACPI_MTX_EVENTS);
+	acpi_ut_acquire_mutex (ACPI_MTX_EVENTS);
 
 	/* Don't allow two handlers. */
 
@@ -81,26 +88,23 @@
 	acpi_gbl_fixed_event_handlers[event].handler = handler;
 	acpi_gbl_fixed_event_handlers[event].context = context;
 
-	status = acpi_enable_event(event, ACPI_EVENT_FIXED);
-
-	if (!ACPI_SUCCESS(status)) {
+	status = acpi_enable_event (event, ACPI_EVENT_FIXED);
+	if (!ACPI_SUCCESS (status)) {
 		/* Remove the handler */
 
 		acpi_gbl_fixed_event_handlers[event].handler = NULL;
 		acpi_gbl_fixed_event_handlers[event].context = NULL;
-
-		status = AE_ERROR;
-		goto cleanup;
 	}
 
 
+
 cleanup:
-	acpi_cm_release_mutex (ACPI_MTX_EVENTS);
+	acpi_ut_release_mutex (ACPI_MTX_EVENTS);
 	return (status);
 }
 
 
-/******************************************************************************
+/*******************************************************************************
  *
  * FUNCTION:    Acpi_remove_fixed_event_handler
  *
@@ -116,40 +120,44 @@
 ACPI_STATUS
 acpi_remove_fixed_event_handler (
 	u32                     event,
-	FIXED_EVENT_HANDLER     handler)
+	ACPI_EVENT_HANDLER      handler)
 {
 	ACPI_STATUS             status = AE_OK;
 
 
-	/* Sanity check the parameters. */
+	/* Ensure that ACPI has been initialized */
+
+	ACPI_IS_INITIALIZATION_COMPLETE (status);
+	if (ACPI_FAILURE (status)) {
+		return (status);
+	}
+
+	/* Parameter validation */
 
-	if (event >= NUM_FIXED_EVENTS) {
+	if (event > ACPI_EVENT_MAX) {
 		return (AE_BAD_PARAMETER);
 	}
 
-	acpi_cm_acquire_mutex (ACPI_MTX_EVENTS);
+	acpi_ut_acquire_mutex (ACPI_MTX_EVENTS);
 
 	/* Disable the event before removing the handler - just in case... */
 
 	status = acpi_disable_event(event, ACPI_EVENT_FIXED);
 
-	if (!ACPI_SUCCESS(status)) {
-		status = AE_ERROR;
-		acpi_cm_release_mutex (ACPI_MTX_EVENTS);
-		return (status);
-	}
-
-	/* Remove the handler */
+	/* Always Remove the handler */
 
 	acpi_gbl_fixed_event_handlers[event].handler = NULL;
 	acpi_gbl_fixed_event_handlers[event].context = NULL;
 
-	acpi_cm_release_mutex (ACPI_MTX_EVENTS);
+
+
+
+	acpi_ut_release_mutex (ACPI_MTX_EVENTS);
 	return (status);
 }
 
 
-/******************************************************************************
+/*******************************************************************************
  *
  * FUNCTION:    Acpi_install_notify_handler
  *
@@ -170,7 +178,7 @@
 acpi_install_notify_handler (
 	ACPI_HANDLE             device,
 	u32                     handler_type,
-	NOTIFY_HANDLER          handler,
+	ACPI_NOTIFY_HANDLER     handler,
 	void                    *context)
 {
 	ACPI_OPERAND_OBJECT     *obj_desc;
@@ -179,15 +187,21 @@
 	ACPI_STATUS             status = AE_OK;
 
 
+	/* Ensure that ACPI has been initialized */
+
+	ACPI_IS_INITIALIZATION_COMPLETE (status);
+	if (ACPI_FAILURE (status)) {
+		return (status);
+	}
+
 	/* Parameter validation */
 
 	if ((!handler) ||
-		(handler_type > ACPI_MAX_NOTIFY_HANDLER_TYPE))
-	{
+		(handler_type > ACPI_MAX_NOTIFY_HANDLER_TYPE)) {
 		return (AE_BAD_PARAMETER);
 	}
 
-	acpi_cm_acquire_mutex (ACPI_MTX_NAMESPACE);
+	acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
 
 	/* Convert and validate the device handle */
 
@@ -210,8 +224,7 @@
 		if (((handler_type == ACPI_SYSTEM_NOTIFY) &&
 			  acpi_gbl_sys_notify.handler) ||
 			((handler_type == ACPI_DEVICE_NOTIFY) &&
-			  acpi_gbl_drv_notify.handler))
-		{
+			  acpi_gbl_drv_notify.handler)) {
 			status = AE_EXIST;
 			goto unlock_and_exit;
 		}
@@ -243,15 +256,14 @@
 		if ((device_node->type != ACPI_TYPE_DEVICE)    &&
 			(device_node->type != ACPI_TYPE_PROCESSOR) &&
 			(device_node->type != ACPI_TYPE_POWER)     &&
-			(device_node->type != ACPI_TYPE_THERMAL))
-		{
+			(device_node->type != ACPI_TYPE_THERMAL)) {
 			status = AE_BAD_PARAMETER;
 			goto unlock_and_exit;
 		}
 
 		/* Check for an existing internal object */
 
-		obj_desc = acpi_ns_get_attached_object ((ACPI_HANDLE) device_node);
+		obj_desc = acpi_ns_get_attached_object (device_node);
 		if (obj_desc) {
 
 			/* Object exists - make sure there's no handler */
@@ -259,8 +271,7 @@
 			if (((handler_type == ACPI_SYSTEM_NOTIFY) &&
 				  obj_desc->device.sys_handler) ||
 				((handler_type == ACPI_DEVICE_NOTIFY) &&
-				  obj_desc->device.drv_handler))
-			{
+				  obj_desc->device.drv_handler)) {
 				status = AE_EXIST;
 				goto unlock_and_exit;
 			}
@@ -269,7 +280,7 @@
 		else {
 			/* Create a new object */
 
-			obj_desc = acpi_cm_create_internal_object (device_node->type);
+			obj_desc = acpi_ut_create_internal_object (device_node->type);
 			if (!obj_desc) {
 				status = AE_NO_MEMORY;
 				goto unlock_and_exit;
@@ -278,7 +289,6 @@
 			/* Attach new object to the Node */
 
 			status = acpi_ns_attach_object (device, obj_desc, (u8) device_node->type);
-
 			if (ACPI_FAILURE (status)) {
 				goto unlock_and_exit;
 			}
@@ -286,7 +296,7 @@
 
 		/* Install the handler */
 
-		notify_obj = acpi_cm_create_internal_object (INTERNAL_TYPE_NOTIFY);
+		notify_obj = acpi_ut_create_internal_object (INTERNAL_TYPE_NOTIFY);
 		if (!notify_obj) {
 			status = AE_NO_MEMORY;
 			goto unlock_and_exit;
@@ -300,18 +310,19 @@
 		if (handler_type == ACPI_SYSTEM_NOTIFY) {
 			obj_desc->device.sys_handler = notify_obj;
 		}
+
 		else /* ACPI_DEVICE_NOTIFY */ {
 			obj_desc->device.drv_handler = notify_obj;
 		}
 	}
 
 unlock_and_exit:
-	acpi_cm_release_mutex (ACPI_MTX_NAMESPACE);
+	acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
 	return (status);
 }
 
 
-/*****************************************************************************
+/*******************************************************************************
  *
  * FUNCTION:    Acpi_remove_notify_handler
  *
@@ -330,22 +341,29 @@
 acpi_remove_notify_handler (
 	ACPI_HANDLE             device,
 	u32                     handler_type,
-	NOTIFY_HANDLER          handler)
+	ACPI_NOTIFY_HANDLER     handler)
 {
 	ACPI_OPERAND_OBJECT     *notify_obj;
 	ACPI_OPERAND_OBJECT     *obj_desc;
 	ACPI_NAMESPACE_NODE     *device_node;
 	ACPI_STATUS             status = AE_OK;
 
+
+	/* Ensure that ACPI has been initialized */
+
+	ACPI_IS_INITIALIZATION_COMPLETE (status);
+	if (ACPI_FAILURE (status)) {
+		return (status);
+	}
+
 	/* Parameter validation */
 
 	if ((!handler) ||
-		(handler_type > ACPI_MAX_NOTIFY_HANDLER_TYPE))
-	{
+		(handler_type > ACPI_MAX_NOTIFY_HANDLER_TYPE)) {
 		return (AE_BAD_PARAMETER);
 	}
 
-	acpi_cm_acquire_mutex (ACPI_MTX_NAMESPACE);
+	acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
 
 	/* Convert and validate the device handle */
 
@@ -364,8 +382,7 @@
 		if (((handler_type == ACPI_SYSTEM_NOTIFY) &&
 			  !acpi_gbl_sys_notify.handler) ||
 			((handler_type == ACPI_DEVICE_NOTIFY) &&
-			  !acpi_gbl_drv_notify.handler))
-		{
+			  !acpi_gbl_drv_notify.handler)) {
 			status = AE_NOT_EXIST;
 			goto unlock_and_exit;
 		}
@@ -393,15 +410,14 @@
 		if ((device_node->type != ACPI_TYPE_DEVICE)    &&
 			(device_node->type != ACPI_TYPE_PROCESSOR) &&
 			(device_node->type != ACPI_TYPE_POWER)     &&
-			(device_node->type != ACPI_TYPE_THERMAL))
-		{
+			(device_node->type != ACPI_TYPE_THERMAL)) {
 			status = AE_BAD_PARAMETER;
 			goto unlock_and_exit;
 		}
 
 		/* Check for an existing internal object */
 
-		obj_desc = acpi_ns_get_attached_object ((ACPI_HANDLE) device_node);
+		obj_desc = acpi_ns_get_attached_object (device_node);
 		if (!obj_desc) {
 			status = AE_NOT_EXIST;
 			goto unlock_and_exit;
@@ -417,8 +433,7 @@
 		}
 
 		if ((!notify_obj) ||
-			(notify_obj->notify_handler.handler != handler))
-		{
+			(notify_obj->notify_handler.handler != handler)) {
 			status = AE_BAD_PARAMETER;
 			goto unlock_and_exit;
 		}
@@ -432,17 +447,17 @@
 			obj_desc->device.drv_handler = NULL;
 		}
 
-		acpi_cm_remove_reference (notify_obj);
+		acpi_ut_remove_reference (notify_obj);
 	}
 
 
 unlock_and_exit:
-	acpi_cm_release_mutex (ACPI_MTX_NAMESPACE);
+	acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
 	return (status);
 }
 
 
-/******************************************************************************
+/*******************************************************************************
  *
  * FUNCTION:    Acpi_install_gpe_handler
  *
@@ -463,14 +478,22 @@
 acpi_install_gpe_handler (
 	u32                     gpe_number,
 	u32                     type,
-	GPE_HANDLER             handler,
+	ACPI_GPE_HANDLER        handler,
 	void                    *context)
 {
 	ACPI_STATUS             status = AE_OK;
 
+
+	/* Ensure that ACPI has been initialized */
+
+	ACPI_IS_INITIALIZATION_COMPLETE (status);
+	if (ACPI_FAILURE (status)) {
+		return (status);
+	}
+
 	/* Parameter validation */
 
-	if (!handler || (gpe_number > NUM_GPE)) {
+	if (!handler || (gpe_number > ACPI_GPE_MAX)) {
 		return (AE_BAD_PARAMETER);
 	}
 
@@ -480,7 +503,7 @@
 		return (AE_BAD_PARAMETER);
 	}
 
-	acpi_cm_acquire_mutex (ACPI_MTX_EVENTS);
+	acpi_ut_acquire_mutex (ACPI_MTX_EVENTS);
 
 	/* Make sure that there isn't a handler there already */
 
@@ -501,12 +524,12 @@
 	acpi_hw_enable_gpe (gpe_number);
 
 cleanup:
-	acpi_cm_release_mutex (ACPI_MTX_EVENTS);
+	acpi_ut_release_mutex (ACPI_MTX_EVENTS);
 	return (status);
 }
 
 
-/******************************************************************************
+/*******************************************************************************
  *
  * FUNCTION:    Acpi_remove_gpe_handler
  *
@@ -522,14 +545,21 @@
 ACPI_STATUS
 acpi_remove_gpe_handler (
 	u32                     gpe_number,
-	GPE_HANDLER             handler)
+	ACPI_GPE_HANDLER        handler)
 {
 	ACPI_STATUS             status = AE_OK;
 
 
+	/* Ensure that ACPI has been initialized */
+
+	ACPI_IS_INITIALIZATION_COMPLETE (status);
+	if (ACPI_FAILURE (status)) {
+		return (status);
+	}
+
 	/* Parameter validation */
 
-	if (!handler || (gpe_number > NUM_GPE)) {
+	if (!handler || (gpe_number > ACPI_GPE_MAX)) {
 		return (AE_BAD_PARAMETER);
 	}
 
@@ -543,7 +573,7 @@
 
 	acpi_hw_disable_gpe (gpe_number);
 
-	acpi_cm_acquire_mutex (ACPI_MTX_EVENTS);
+	acpi_ut_acquire_mutex (ACPI_MTX_EVENTS);
 
 	/* Make sure that the installed handler is the same */
 
@@ -559,12 +589,12 @@
 	acpi_gbl_gpe_info[gpe_number].context = NULL;
 
 cleanup:
-	acpi_cm_release_mutex (ACPI_MTX_EVENTS);
+	acpi_ut_release_mutex (ACPI_MTX_EVENTS);
 	return (status);
 }
 
 
-/******************************************************************************
+/*******************************************************************************
  *
  * FUNCTION:    Acpi_acquire_global_lock
  *
@@ -583,7 +613,17 @@
 	ACPI_STATUS             status;
 
 
-	acpi_aml_enter_interpreter ();
+	/* Ensure that ACPI has been initialized */
+
+	ACPI_IS_INITIALIZATION_COMPLETE (status);
+	if (ACPI_FAILURE (status)) {
+		return (status);
+	}
+
+	status = acpi_ex_enter_interpreter ();
+	if (ACPI_FAILURE (status)) {
+		return (status);
+	}
 
 	/*
 	 * TBD: [Restructure] add timeout param to internal interface, and
@@ -591,13 +631,13 @@
 	 */
 
 	status = acpi_ev_acquire_global_lock ();
-	acpi_aml_exit_interpreter ();
+	acpi_ex_exit_interpreter ();
 
 	return (status);
 }
 
 
-/******************************************************************************
+/*******************************************************************************
  *
  * FUNCTION:    Acpi_release_global_lock
  *
@@ -613,6 +653,16 @@
 acpi_release_global_lock (
 	void)
 {
+	ACPI_STATUS             status;
+
+
+	/* Ensure that ACPI has been initialized */
+
+	ACPI_IS_INITIALIZATION_COMPLETE (status);
+	if (ACPI_FAILURE (status)) {
+		return (status);
+	}
+
 	acpi_ev_release_global_lock ();
 	return (AE_OK);
 }
diff -urN linux-2.4.6-pre4/drivers/acpi/events/evxfevnt.c linux/drivers/acpi/events/evxfevnt.c
--- linux-2.4.6-pre4/drivers/acpi/events/evxfevnt.c	Mon Jan 22 13:23:42 2001
+++ linux/drivers/acpi/events/evxfevnt.c	Mon Dec  3 22:48:42 2001
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: evxfevnt - External Interfaces, ACPI event disable/enable
- *              $Revision: 28 $
+ *              $Revision: 33 $
  *
  *****************************************************************************/
 
@@ -31,11 +31,11 @@
 #include "amlcode.h"
 #include "acinterp.h"
 
-#define _COMPONENT          EVENT_HANDLING
+#define _COMPONENT          ACPI_EVENTS
 	 MODULE_NAME         ("evxfevnt")
 
 
-/**************************************************************************
+/*******************************************************************************
  *
  * FUNCTION:    Acpi_enable
  *
@@ -45,7 +45,7 @@
  *
  * DESCRIPTION: Transfers the system into ACPI mode.
  *
- *************************************************************************/
+ ******************************************************************************/
 
 ACPI_STATUS
 acpi_enable (void)
@@ -76,7 +76,7 @@
 }
 
 
-/**************************************************************************
+/*******************************************************************************
  *
  * FUNCTION:    Acpi_disable
  *
@@ -87,7 +87,7 @@
  * DESCRIPTION: Returns the system to original ACPI/legacy mode, and
  *              uninstalls the SCI interrupt handler.
  *
- *************************************************************************/
+ ******************************************************************************/
 
 ACPI_STATUS
 acpi_disable (void)
@@ -95,6 +95,13 @@
 	ACPI_STATUS             status;
 
 
+	/* Ensure that ACPI has been initialized */
+
+	ACPI_IS_INITIALIZATION_COMPLETE (status);
+	if (ACPI_FAILURE (status)) {
+		return (status);
+	}
+
 	/* Restore original mode  */
 
 	status = acpi_hw_set_mode (acpi_gbl_original_mode);
@@ -111,7 +118,7 @@
 }
 
 
-/******************************************************************************
+/*******************************************************************************
  *
  * FUNCTION:    Acpi_enable_event
  *
@@ -133,17 +140,22 @@
 	u32                     register_id;
 
 
+	/* Ensure that ACPI has been initialized */
+
+	ACPI_IS_INITIALIZATION_COMPLETE (status);
+	if (ACPI_FAILURE (status)) {
+		return (status);
+	}
+
 	/* The Type must be either Fixed Acpi_event or GPE */
 
-	switch (type)
-	{
+	switch (type) {
 
 	case ACPI_EVENT_FIXED:
 
 		/* Decode the Fixed Acpi_event */
 
-		switch (event)
-		{
+		switch (event) {
 		case ACPI_EVENT_PMTIMER:
 			register_id = TMR_EN;
 			break;
@@ -177,7 +189,7 @@
 		acpi_hw_register_bit_access (ACPI_WRITE, ACPI_MTX_LOCK, register_id, 1);
 
 		if (1 != acpi_hw_register_bit_access(ACPI_READ, ACPI_MTX_LOCK, register_id)) {
-			return (AE_ERROR);
+			return (AE_NO_HARDWARE_RESPONSE);
 		}
 
 		break;
@@ -187,9 +199,8 @@
 
 		/* Ensure that we have a valid GPE number */
 
-		if ((event >= NUM_GPE) ||
-			(acpi_gbl_gpe_valid[event] == ACPI_GPE_INVALID))
-		{
+		if ((event > ACPI_GPE_MAX) ||
+			(acpi_gbl_gpe_valid[event] == ACPI_GPE_INVALID)) {
 			return (AE_BAD_PARAMETER);
 		}
 
@@ -210,7 +221,7 @@
 }
 
 
-/******************************************************************************
+/*******************************************************************************
  *
  * FUNCTION:    Acpi_disable_event
  *
@@ -232,17 +243,22 @@
 	u32                     register_id;
 
 
+	/* Ensure that ACPI has been initialized */
+
+	ACPI_IS_INITIALIZATION_COMPLETE (status);
+	if (ACPI_FAILURE (status)) {
+		return (status);
+	}
+
 	/* The Type must be either Fixed Acpi_event or GPE */
 
-	switch (type)
-	{
+	switch (type) {
 
 	case ACPI_EVENT_FIXED:
 
 		/* Decode the Fixed Acpi_event */
 
-		switch (event)
-		{
+		switch (event) {
 		case ACPI_EVENT_PMTIMER:
 			register_id = TMR_EN;
 			break;
@@ -276,7 +292,7 @@
 		acpi_hw_register_bit_access (ACPI_WRITE, ACPI_MTX_LOCK, register_id, 0);
 
 		if (0 != acpi_hw_register_bit_access(ACPI_READ, ACPI_MTX_LOCK, register_id)) {
-			return (AE_ERROR);
+			return (AE_NO_HARDWARE_RESPONSE);
 		}
 
 		break;
@@ -286,9 +302,8 @@
 
 		/* Ensure that we have a valid GPE number */
 
-		if ((event >= NUM_GPE) ||
-			(acpi_gbl_gpe_valid[event] == ACPI_GPE_INVALID))
-		{
+		if ((event > ACPI_GPE_MAX) ||
+			(acpi_gbl_gpe_valid[event] == ACPI_GPE_INVALID)) {
 			return (AE_BAD_PARAMETER);
 		}
 
@@ -306,7 +321,7 @@
 }
 
 
-/******************************************************************************
+/*******************************************************************************
  *
  * FUNCTION:    Acpi_clear_event
  *
@@ -328,17 +343,22 @@
 	u32                     register_id;
 
 
+	/* Ensure that ACPI has been initialized */
+
+	ACPI_IS_INITIALIZATION_COMPLETE (status);
+	if (ACPI_FAILURE (status)) {
+		return (status);
+	}
+
 	/* The Type must be either Fixed Acpi_event or GPE */
 
-	switch (type)
-	{
+	switch (type) {
 
 	case ACPI_EVENT_FIXED:
 
 		/* Decode the Fixed Acpi_event */
 
-		switch (event)
-		{
+		switch (event) {
 		case ACPI_EVENT_PMTIMER:
 			register_id = TMR_STS;
 			break;
@@ -377,9 +397,8 @@
 
 		/* Ensure that we have a valid GPE number */
 
-		if ((event >= NUM_GPE) ||
-			(acpi_gbl_gpe_valid[event] == ACPI_GPE_INVALID))
-		{
+		if ((event > ACPI_GPE_MAX) ||
+			(acpi_gbl_gpe_valid[event] == ACPI_GPE_INVALID)) {
 			return (AE_BAD_PARAMETER);
 		}
 
@@ -397,7 +416,7 @@
 }
 
 
-/******************************************************************************
+/*******************************************************************************
  *
  * FUNCTION:    Acpi_get_event_status
  *
@@ -423,6 +442,13 @@
 	u32                     register_id;
 
 
+	/* Ensure that ACPI has been initialized */
+
+	ACPI_IS_INITIALIZATION_COMPLETE (status);
+	if (ACPI_FAILURE (status)) {
+		return (status);
+	}
+
 	if (!event_status) {
 		return (AE_BAD_PARAMETER);
 	}
@@ -430,15 +456,13 @@
 
 	/* The Type must be either Fixed Acpi_event or GPE */
 
-	switch (type)
-	{
+	switch (type) {
 
 	case ACPI_EVENT_FIXED:
 
 		/* Decode the Fixed Acpi_event */
 
-		switch (event)
-		{
+		switch (event) {
 		case ACPI_EVENT_PMTIMER:
 			register_id = TMR_STS;
 			break;
@@ -474,9 +498,8 @@
 
 		/* Ensure that we have a valid GPE number */
 
-		if ((event >= NUM_GPE) ||
-			(acpi_gbl_gpe_valid[event] == ACPI_GPE_INVALID))
-		{
+		if ((event > ACPI_GPE_MAX) ||
+			(acpi_gbl_gpe_valid[event] == ACPI_GPE_INVALID)) {
 			return (AE_BAD_PARAMETER);
 		}
 
diff -urN linux-2.4.6-pre4/drivers/acpi/events/evxfregn.c linux/drivers/acpi/events/evxfregn.c
--- linux-2.4.6-pre4/drivers/acpi/events/evxfregn.c	Mon Jan 22 13:23:42 2001
+++ linux/drivers/acpi/events/evxfregn.c	Mon Dec  3 22:48:42 2001
@@ -2,7 +2,7 @@
  *
  * Module Name: evxfregn - External Interfaces, ACPI Operation Regions and
  *                         Address Spaces.
- *              $Revision: 27 $
+ *              $Revision: 34 $
  *
  *****************************************************************************/
 
@@ -32,11 +32,11 @@
 #include "amlcode.h"
 #include "acinterp.h"
 
-#define _COMPONENT          EVENT_HANDLING
+#define _COMPONENT          ACPI_EVENTS
 	 MODULE_NAME         ("evxfregn")
 
 
-/******************************************************************************
+/*******************************************************************************
  *
  * FUNCTION:    Acpi_install_address_space_handler
  *
@@ -55,29 +55,35 @@
 ACPI_STATUS
 acpi_install_address_space_handler (
 	ACPI_HANDLE             device,
-	ACPI_ADDRESS_SPACE_TYPE space_id,
-	ADDRESS_SPACE_HANDLER   handler,
-	ADDRESS_SPACE_SETUP     setup,
+	ACPI_ADR_SPACE_TYPE     space_id,
+	ACPI_ADR_SPACE_HANDLER  handler,
+	ACPI_ADR_SPACE_SETUP    setup,
 	void                    *context)
 {
 	ACPI_OPERAND_OBJECT     *obj_desc;
 	ACPI_OPERAND_OBJECT     *handler_obj;
 	ACPI_NAMESPACE_NODE     *node;
 	ACPI_STATUS             status = AE_OK;
-	OBJECT_TYPE_INTERNAL    type;
+	ACPI_OBJECT_TYPE8       type;
 	u16                     flags = 0;
 
 
+	/* Ensure that ACPI has been initialized */
+
+	ACPI_IS_INITIALIZATION_COMPLETE (status);
+	if (ACPI_FAILURE (status)) {
+		return (status);
+	}
+
 	/* Parameter validation */
 
 	if ((!device)   ||
 		((!handler)  && (handler != ACPI_DEFAULT_HANDLER)) ||
-		(space_id > ACPI_MAX_ADDRESS_SPACE))
-	{
+		(space_id > ACPI_MAX_ADDRESS_SPACE)) {
 		return (AE_BAD_PARAMETER);
 	}
 
-	acpi_cm_acquire_mutex (ACPI_MTX_NAMESPACE);
+	acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
 
 	/* Convert and validate the device handle */
 
@@ -96,8 +102,7 @@
 	if ((node->type != ACPI_TYPE_DEVICE)     &&
 		(node->type != ACPI_TYPE_PROCESSOR)  &&
 		(node->type != ACPI_TYPE_THERMAL)    &&
-		(node != acpi_gbl_root_node))
-	{
+		(node != acpi_gbl_root_node)) {
 		status = AE_BAD_PARAMETER;
 		goto unlock_and_exit;
 	}
@@ -105,20 +110,19 @@
 	if (handler == ACPI_DEFAULT_HANDLER) {
 		flags = ADDR_HANDLER_DEFAULT_INSTALLED;
 
-		switch (space_id)
-		{
-		case ADDRESS_SPACE_SYSTEM_MEMORY:
-			handler = acpi_aml_system_memory_space_handler;
+		switch (space_id) {
+		case ACPI_ADR_SPACE_SYSTEM_MEMORY:
+			handler = acpi_ex_system_memory_space_handler;
 			setup = acpi_ev_system_memory_region_setup;
 			break;
 
-		case ADDRESS_SPACE_SYSTEM_IO:
-			handler = acpi_aml_system_io_space_handler;
+		case ACPI_ADR_SPACE_SYSTEM_IO:
+			handler = acpi_ex_system_io_space_handler;
 			setup = acpi_ev_io_space_region_setup;
 			break;
 
-		case ADDRESS_SPACE_PCI_CONFIG:
-			handler = acpi_aml_pci_config_space_handler;
+		case ACPI_ADR_SPACE_PCI_CONFIG:
+			handler = acpi_ex_pci_config_space_handler;
 			setup = acpi_ev_pci_config_region_setup;
 			break;
 
@@ -140,7 +144,7 @@
 	 *  Check for an existing internal object
 	 */
 
-	obj_desc = acpi_ns_get_attached_object ((ACPI_HANDLE) node);
+	obj_desc = acpi_ns_get_attached_object (node);
 	if (obj_desc) {
 		/*
 		 *  The object exists.
@@ -178,7 +182,7 @@
 			type = node->type;
 		}
 
-		obj_desc = acpi_cm_create_internal_object (type);
+		obj_desc = acpi_ut_create_internal_object (type);
 		if (!obj_desc) {
 			status = AE_NO_MEMORY;
 			goto unlock_and_exit;
@@ -192,7 +196,7 @@
 
 		status = acpi_ns_attach_object (node, obj_desc, (u8) type);
 		if (ACPI_FAILURE (status)) {
-			acpi_cm_remove_reference (obj_desc);
+			acpi_ut_remove_reference (obj_desc);
 			goto unlock_and_exit;
 		}
 	}
@@ -204,7 +208,7 @@
 	 *  So, we just allocate the object for the handler and link it
 	 *  into the list.
 	 */
-	handler_obj = acpi_cm_create_internal_object (INTERNAL_TYPE_ADDRESS_HANDLER);
+	handler_obj = acpi_ut_create_internal_object (INTERNAL_TYPE_ADDRESS_HANDLER);
 	if (!handler_obj) {
 		status = AE_NO_MEMORY;
 		goto unlock_and_exit;
@@ -247,12 +251,12 @@
 
 
 unlock_and_exit:
-	acpi_cm_release_mutex (ACPI_MTX_NAMESPACE);
+	acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
 	return (status);
 }
 
 
-/******************************************************************************
+/*******************************************************************************
  *
  * FUNCTION:    Acpi_remove_address_space_handler
  *
@@ -268,8 +272,8 @@
 ACPI_STATUS
 acpi_remove_address_space_handler (
 	ACPI_HANDLE             device,
-	ACPI_ADDRESS_SPACE_TYPE space_id,
-	ADDRESS_SPACE_HANDLER   handler)
+	ACPI_ADR_SPACE_TYPE     space_id,
+	ACPI_ADR_SPACE_HANDLER  handler)
 {
 	ACPI_OPERAND_OBJECT     *obj_desc;
 	ACPI_OPERAND_OBJECT     *handler_obj;
@@ -279,16 +283,22 @@
 	ACPI_STATUS             status = AE_OK;
 
 
+	/* Ensure that ACPI has been initialized */
+
+	ACPI_IS_INITIALIZATION_COMPLETE (status);
+	if (ACPI_FAILURE (status)) {
+		return (status);
+	}
+
 	/* Parameter validation */
 
 	if ((!device)   ||
 		((!handler)  && (handler != ACPI_DEFAULT_HANDLER)) ||
-		(space_id > ACPI_MAX_ADDRESS_SPACE))
-	{
+		(space_id > ACPI_MAX_ADDRESS_SPACE)) {
 		return (AE_BAD_PARAMETER);
 	}
 
-	acpi_cm_acquire_mutex (ACPI_MTX_NAMESPACE);
+	acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
 
 	/* Convert and validate the device handle */
 
@@ -301,7 +311,7 @@
 
 	/* Make sure the internal object exists */
 
-	obj_desc = acpi_ns_get_attached_object ((ACPI_HANDLE) node);
+	obj_desc = acpi_ns_get_attached_object (node);
 	if (!obj_desc) {
 		/*
 		 *  The object DNE.
@@ -337,7 +347,7 @@
 				 *  The region is just inaccessible as indicated to
 				 *  the _REG method
 				 */
-				acpi_ev_disassociate_region_from_handler(region_obj, FALSE);
+				acpi_ev_disassociate_region_from_handler(region_obj, TRUE);
 
 				/*
 				 *  Walk the list, since we took the first region and it
@@ -356,8 +366,8 @@
 			/*
 			 *  Now we can delete the handler object
 			 */
-			acpi_cm_remove_reference (handler_obj);
-			acpi_cm_remove_reference (handler_obj);
+			acpi_ut_remove_reference (handler_obj);
+			acpi_ut_remove_reference (handler_obj);
 
 			goto unlock_and_exit;
 		}
@@ -377,7 +387,7 @@
 
 
 unlock_and_exit:
-	acpi_cm_release_mutex (ACPI_MTX_NAMESPACE);
+	acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
 	return (status);
 }
 
diff -urN linux-2.4.6-pre4/drivers/acpi/executer/Makefile linux/drivers/acpi/executer/Makefile
--- linux-2.4.6-pre4/drivers/acpi/executer/Makefile	Wed Dec 31 16:00:00 1969
+++ linux/drivers/acpi/executer/Makefile	Mon Dec  3 22:48:42 2001
@@ -0,0 +1,12 @@
+#
+# Makefile for all Linux ACPI interpreter subdirectories
+# EXCEPT for the ospm directory
+#
+
+O_TARGET := $(notdir $(CURDIR)).o
+
+obj-$(CONFIG_ACPI) := $(patsubst %.c,%.o,$(wildcard *.c))
+
+EXTRA_CFLAGS += $(ACPI_CFLAGS)
+
+include $(TOPDIR)/Rules.make
diff -urN linux-2.4.6-pre4/drivers/acpi/executer/exconfig.c linux/drivers/acpi/executer/exconfig.c
--- linux-2.4.6-pre4/drivers/acpi/executer/exconfig.c	Wed Dec 31 16:00:00 1969
+++ linux/drivers/acpi/executer/exconfig.c	Mon Dec  3 22:48:42 2001
@@ -0,0 +1,304 @@
+/******************************************************************************
+ *
+ * Module Name: exconfig - Namespace reconfiguration (Load/Unload opcodes)
+ *              $Revision: 34 $
+ *
+ *****************************************************************************/
+
+/*
+ *  Copyright (C) 2000, 2001 R. Byron Moore
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#include "acpi.h"
+#include "acparser.h"
+#include "acinterp.h"
+#include "amlcode.h"
+#include "acnamesp.h"
+#include "acevents.h"
+#include "actables.h"
+#include "acdispat.h"
+
+
+#define _COMPONENT          ACPI_EXECUTER
+	 MODULE_NAME         ("exconfig")
+
+
+/*****************************************************************************
+ *
+ * FUNCTION:    Acpi_ex_load_table_op
+ *
+ * PARAMETERS:  Rgn_desc        - Op region where the table will be obtained
+ *              Ddb_handle      - Where a handle to the table will be returned
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Load an ACPI table
+ *
+ ****************************************************************************/
+
+static ACPI_STATUS
+acpi_ex_load_table_op (
+	ACPI_OPERAND_OBJECT     *rgn_desc,
+	ACPI_HANDLE             *ddb_handle)
+{
+	ACPI_STATUS             status;
+	ACPI_OPERAND_OBJECT     *table_desc = NULL;
+	u8                      *table_ptr;
+	u8                      *table_data_ptr;
+	ACPI_TABLE_HEADER       table_header;
+	ACPI_TABLE_DESC         table_info;
+	u32                     i;
+
+
+	/* TBD: [Unhandled] Object can be either a field or an opregion */
+
+
+	/* Get the table header */
+
+	table_header.length = 0;
+	for (i = 0; i < sizeof (ACPI_TABLE_HEADER); i++) {
+		status = acpi_ev_address_space_dispatch (rgn_desc, ACPI_READ_ADR_SPACE,
+				   (ACPI_PHYSICAL_ADDRESS) i, 8,
+				   (u32 *) ((u8 *) &table_header + i));
+		if (ACPI_FAILURE (status)) {
+			return (status);
+		}
+	}
+
+	/* Allocate a buffer for the entire table */
+
+	table_ptr = acpi_ut_allocate (table_header.length);
+	if (!table_ptr) {
+		return (AE_NO_MEMORY);
+	}
+
+	/* Copy the header to the buffer */
+
+	MEMCPY (table_ptr, &table_header, sizeof (ACPI_TABLE_HEADER));
+	table_data_ptr = table_ptr + sizeof (ACPI_TABLE_HEADER);
+
+
+	/* Get the table from the op region */
+
+	for (i = 0; i < table_header.length; i++) {
+		status = acpi_ev_address_space_dispatch (rgn_desc, ACPI_READ_ADR_SPACE,
+				   (ACPI_PHYSICAL_ADDRESS) i, 8,
+				   (u32 *) (table_data_ptr + i));
+		if (ACPI_FAILURE (status)) {
+			goto cleanup;
+		}
+	}
+
+
+	/* Table must be either an SSDT or a PSDT */
+
+	if ((!STRNCMP (table_header.signature,
+			  acpi_gbl_acpi_table_data[ACPI_TABLE_PSDT].signature,
+			  acpi_gbl_acpi_table_data[ACPI_TABLE_PSDT].sig_length)) &&
+		(!STRNCMP (table_header.signature,
+				 acpi_gbl_acpi_table_data[ACPI_TABLE_SSDT].signature,
+				 acpi_gbl_acpi_table_data[ACPI_TABLE_SSDT].sig_length))) {
+		status = AE_BAD_SIGNATURE;
+		goto cleanup;
+	}
+
+	/* Create an object to be the table handle */
+
+	table_desc = acpi_ut_create_internal_object (INTERNAL_TYPE_REFERENCE);
+	if (!table_desc) {
+		status = AE_NO_MEMORY;
+		goto cleanup;
+	}
+
+
+	/* Install the new table into the local data structures */
+
+	table_info.pointer     = (ACPI_TABLE_HEADER *) table_ptr;
+	table_info.length      = table_header.length;
+	table_info.allocation  = ACPI_MEM_ALLOCATED;
+	table_info.base_pointer = table_ptr;
+
+	status = acpi_tb_install_table (NULL, &table_info);
+	if (ACPI_FAILURE (status)) {
+		goto cleanup;
+	}
+
+	/* Add the table to the namespace */
+
+	/* TBD: [Restructure] - change to whatever new interface is appropriate */
+/*
+	Status = Acpi_load_namespace ();
+	if (ACPI_FAILURE (Status))
+	{
+*/
+		/* TBD: [Errors] Unload the table on failure ? */
+/*
+		goto Cleanup;
+	}
+*/
+
+
+	/* TBD: [Investigate] we need a pointer to the table desc */
+
+	/* Init the table handle */
+
+	table_desc->reference.opcode = AML_LOAD_OP;
+	table_desc->reference.object = table_info.installed_desc;
+
+	*ddb_handle = table_desc;
+
+	return (status);
+
+
+cleanup:
+
+	acpi_ut_free (table_desc);
+	acpi_ut_free (table_ptr);
+	return (status);
+
+}
+
+
+/*****************************************************************************
+ *
+ * FUNCTION:    Acpi_ex_unload_table
+ *
+ * PARAMETERS:  Ddb_handle          - Handle to a previously loaded table
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Unload an ACPI table
+ *
+ ****************************************************************************/
+
+static ACPI_STATUS
+acpi_ex_unload_table (
+	ACPI_HANDLE             ddb_handle)
+{
+	ACPI_STATUS             status = AE_NOT_IMPLEMENTED;
+	ACPI_OPERAND_OBJECT     *table_desc = (ACPI_OPERAND_OBJECT *) ddb_handle;
+	ACPI_TABLE_DESC         *table_info;
+
+
+	/* Validate the handle */
+	/* Although the handle is partially validated in Acpi_ex_reconfiguration(),
+	 *  when it calls Acpi_ex_resolve_operands(), the handle is more completely
+	 *  validated here.
+	 */
+
+	if ((!ddb_handle) ||
+		(!VALID_DESCRIPTOR_TYPE (ddb_handle, ACPI_DESC_TYPE_INTERNAL)) ||
+		(((ACPI_OPERAND_OBJECT  *)ddb_handle)->common.type !=
+				INTERNAL_TYPE_REFERENCE)) {
+		return (AE_BAD_PARAMETER);
+	}
+
+
+	/* Get the actual table descriptor from the Ddb_handle */
+
+	table_info = (ACPI_TABLE_DESC *) table_desc->reference.object;
+
+	/*
+	 * Delete the entire namespace under this table Node
+	 * (Offset contains the Table_id)
+	 */
+
+	status = acpi_ns_delete_namespace_by_owner (table_info->table_id);
+	if (ACPI_FAILURE (status)) {
+		return (status);
+	}
+
+	/* Delete the table itself */
+
+	acpi_tb_uninstall_table (table_info->installed_desc);
+
+	/* Delete the table descriptor (Ddb_handle) */
+
+	acpi_ut_remove_reference (table_desc);
+
+	return (status);
+}
+
+
+/*****************************************************************************
+ *
+ * FUNCTION:    Acpi_ex_reconfiguration
+ *
+ * PARAMETERS:  Opcode              - The opcode to be executed
+ *              Walk_state          - Current state of the parse tree walk
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Reconfiguration opcodes such as LOAD and UNLOAD
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+acpi_ex_reconfiguration (
+	u16                     opcode,
+	ACPI_WALK_STATE         *walk_state)
+{
+	ACPI_STATUS             status;
+	ACPI_OPERAND_OBJECT     *region_desc = NULL;
+	ACPI_HANDLE             *ddb_handle;
+
+
+	/* Resolve the operands */
+
+	status = acpi_ex_resolve_operands (opcode, WALK_OPERANDS, walk_state);
+	/* Get the table handle, common for both opcodes */
+
+	status |= acpi_ds_obj_stack_pop_object ((ACPI_OPERAND_OBJECT **) &ddb_handle,
+			 walk_state);
+
+	switch (opcode) {
+
+	case AML_LOAD_OP:
+
+		/* Get the region or field descriptor */
+
+		status |= acpi_ds_obj_stack_pop_object (&region_desc, walk_state);
+		if (ACPI_FAILURE (status)) {
+			acpi_ut_remove_reference (region_desc);
+			return (status);
+		}
+
+		status = acpi_ex_load_table_op (region_desc, ddb_handle);
+		break;
+
+
+	case AML_UNLOAD_OP:
+
+		if (ACPI_FAILURE (status)) {
+			return (status);
+		}
+
+		status = acpi_ex_unload_table (ddb_handle);
+		break;
+
+
+	default:
+
+		status = AE_AML_BAD_OPCODE;
+		break;
+	}
+
+
+	return (status);
+}
+
diff -urN linux-2.4.6-pre4/drivers/acpi/executer/exconvrt.c linux/drivers/acpi/executer/exconvrt.c
--- linux-2.4.6-pre4/drivers/acpi/executer/exconvrt.c	Wed Dec 31 16:00:00 1969
+++ linux/drivers/acpi/executer/exconvrt.c	Mon Dec  3 22:48:42 2001
@@ -0,0 +1,518 @@
+/******************************************************************************
+ *
+ * Module Name: exconvrt - Object conversion routines
+ *              $Revision: 13 $
+ *
+ *****************************************************************************/
+
+/*
+ *  Copyright (C) 2000, 2001 R. Byron Moore
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#include "acpi.h"
+#include "acparser.h"
+#include "acnamesp.h"
+#include "acinterp.h"
+#include "acevents.h"
+#include "amlcode.h"
+#include "acdispat.h"
+
+
+#define _COMPONENT          ACPI_EXECUTER
+	 MODULE_NAME         ("exconvrt")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ex_convert_to_integer
+ *
+ * PARAMETERS:  *Obj_desc       - Object to be converted.  Must be an
+ *                                Integer, Buffer, or String
+ *              Walk_state      - Current method state
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Convert an ACPI Object to an integer.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_ex_convert_to_integer (
+	ACPI_OPERAND_OBJECT     **obj_desc,
+	ACPI_WALK_STATE         *walk_state)
+{
+	u32                     i;
+	ACPI_OPERAND_OBJECT     *ret_desc;
+	u32                     count;
+	char                    *pointer;
+	ACPI_INTEGER            result;
+	u32                     integer_size = sizeof (ACPI_INTEGER);
+
+
+	switch ((*obj_desc)->common.type) {
+	case ACPI_TYPE_INTEGER:
+		return (AE_OK);
+
+	case ACPI_TYPE_STRING:
+		pointer = (*obj_desc)->string.pointer;
+		count = (*obj_desc)->string.length;
+		break;
+
+	case ACPI_TYPE_BUFFER:
+		pointer = (char *) (*obj_desc)->buffer.pointer;
+		count = (*obj_desc)->buffer.length;
+		break;
+
+	default:
+		return (AE_TYPE);
+	}
+
+	/*
+	 * Create a new integer
+	 */
+	ret_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
+	if (!ret_desc) {
+		return (AE_NO_MEMORY);
+	}
+
+
+	/* Handle both ACPI 1.0 and ACPI 2.0 Integer widths */
+
+	if (walk_state->method_node->flags & ANOBJ_DATA_WIDTH_32) {
+		/*
+		 * We are running a method that exists in a 32-bit ACPI table.
+		 * Truncate the value to 32 bits by zeroing out the upper 32-bit field
+		 */
+		integer_size = sizeof (u32);
+	}
+
+
+	/*
+	 * Convert the buffer/string to an integer.  Note that both buffers and
+	 * strings are treated as raw data - we don't convert ascii to hex for
+	 * strings.
+	 *
+	 * There are two terminating conditions for the loop:
+	 * 1) The size of an integer has been reached, or
+	 * 2) The end of the buffer or string has been reached
+	 */
+	result = 0;
+
+	/* Transfer no more than an integer's worth of data */
+
+	if (count > integer_size) {
+		count = integer_size;
+	}
+
+	/*
+	 * String conversion is different than Buffer conversion
+	 */
+	switch ((*obj_desc)->common.type) {
+	case ACPI_TYPE_STRING:
+
+		/* TBD: Need to use 64-bit STRTOUL */
+
+		/*
+		 * Convert string to an integer
+		 * String must be hexadecimal as per the ACPI specification
+		 */
+
+		result = STRTOUL (pointer, NULL, 16);
+		break;
+
+
+	case ACPI_TYPE_BUFFER:
+
+		/*
+		 * Buffer conversion - we simply grab enough raw data from the
+		 * buffer to fill an integer
+		 */
+		for (i = 0; i < count; i++) {
+			/*
+			 * Get next byte and shift it into the Result.
+			 * Little endian is used, meaning that the first byte of the buffer
+			 * is the LSB of the integer
+			 */
+			result |= (((ACPI_INTEGER) pointer[i]) << (i * 8));
+		}
+
+		break;
+	}
+
+	/* Save the Result, delete original descriptor, store new descriptor */
+
+	ret_desc->integer.value = result;
+
+	if (walk_state->opcode != AML_STORE_OP) {
+		acpi_ut_remove_reference (*obj_desc);
+	}
+
+	*obj_desc = ret_desc;
+
+	return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ex_convert_to_buffer
+ *
+ * PARAMETERS:  *Obj_desc       - Object to be converted.  Must be an
+ *                                Integer, Buffer, or String
+ *              Walk_state      - Current method state
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Convert an ACPI Object to an Buffer
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_ex_convert_to_buffer (
+	ACPI_OPERAND_OBJECT     **obj_desc,
+	ACPI_WALK_STATE         *walk_state)
+{
+	ACPI_OPERAND_OBJECT     *ret_desc;
+	u32                     i;
+	u32                     integer_size = sizeof (ACPI_INTEGER);
+	u8                      *new_buf;
+
+
+	switch ((*obj_desc)->common.type) {
+	case ACPI_TYPE_INTEGER:
+
+		/*
+		 * Create a new Buffer
+		 */
+		ret_desc = acpi_ut_create_internal_object (ACPI_TYPE_BUFFER);
+		if (!ret_desc) {
+			return (AE_NO_MEMORY);
+		}
+
+		/* Handle both ACPI 1.0 and ACPI 2.0 Integer widths */
+
+		if (walk_state->method_node->flags & ANOBJ_DATA_WIDTH_32) {
+			/*
+			 * We are running a method that exists in a 32-bit ACPI table.
+			 * Truncate the value to 32 bits by zeroing out the upper
+			 * 32-bit field
+			 */
+			integer_size = sizeof (u32);
+		}
+
+		/* Need enough space for one integers */
+
+		ret_desc->buffer.length = integer_size;
+		new_buf = acpi_ut_callocate (integer_size);
+		if (!new_buf) {
+			REPORT_ERROR
+				(("Ex_dyadic2_r/Concat_op: Buffer allocation failure\n"));
+			acpi_ut_remove_reference (ret_desc);
+			return (AE_NO_MEMORY);
+		}
+
+		/* Copy the integer to the buffer */
+
+		for (i = 0; i < integer_size; i++) {
+			new_buf[i] = (u8) ((*obj_desc)->integer.value >> (i * 8));
+		}
+		ret_desc->buffer.pointer = new_buf;
+
+		/* Return the new buffer descriptor */
+
+		if (walk_state->opcode != AML_STORE_OP) {
+			acpi_ut_remove_reference (*obj_desc);
+		}
+		*obj_desc = ret_desc;
+		break;
+
+
+	case ACPI_TYPE_STRING:
+		break;
+
+
+	case ACPI_TYPE_BUFFER:
+		break;
+
+
+	default:
+		return (AE_TYPE);
+		break;
+   }
+
+	return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ex_convert_to_string
+ *
+ * PARAMETERS:  *Obj_desc       - Object to be converted.  Must be an
+ *                                Integer, Buffer, or String
+ *              Walk_state      - Current method state
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Convert an ACPI Object to a string
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_ex_convert_to_string (
+	ACPI_OPERAND_OBJECT     **obj_desc,
+	ACPI_WALK_STATE         *walk_state)
+{
+	ACPI_OPERAND_OBJECT     *ret_desc;
+	u32                     i;
+	u32                     index;
+	u32                     integer_size = sizeof (ACPI_INTEGER);
+	u8                      *new_buf;
+	u8                      *pointer;
+
+
+	switch ((*obj_desc)->common.type) {
+	case ACPI_TYPE_INTEGER:
+
+		/*
+		 * Create a new String
+		 */
+		ret_desc = acpi_ut_create_internal_object (ACPI_TYPE_STRING);
+		if (!ret_desc) {
+			return (AE_NO_MEMORY);
+		}
+
+		/* Handle both ACPI 1.0 and ACPI 2.0 Integer widths */
+
+		if (walk_state->method_node->flags & ANOBJ_DATA_WIDTH_32) {
+			/*
+			 * We are running a method that exists in a 32-bit ACPI table.
+			 * Truncate the value to 32 bits by zeroing out the upper
+			 * 32-bit field
+			 */
+			integer_size = sizeof (u32);
+		}
+
+		/* Need enough space for one ASCII integer plus null terminator */
+
+		ret_desc->string.length = (integer_size * 2) + 1;
+		new_buf = acpi_ut_callocate (ret_desc->string.length);
+		if (!new_buf) {
+			REPORT_ERROR
+				(("Ex_convert_to_string: Buffer allocation failure\n"));
+			acpi_ut_remove_reference (ret_desc);
+			return (AE_NO_MEMORY);
+		}
+
+		/* Copy the integer to the buffer */
+
+		for (i = 0; i < (integer_size * 2); i++) {
+			new_buf[i] = acpi_gbl_hex_to_ascii [((*obj_desc)->integer.value >> (i * 4)) & 0xF];
+		}
+
+		/* Null terminate */
+
+		new_buf [i] = 0;
+		ret_desc->buffer.pointer = new_buf;
+
+		/* Return the new buffer descriptor */
+
+		if (walk_state->opcode != AML_STORE_OP) {
+			acpi_ut_remove_reference (*obj_desc);
+		}
+		*obj_desc = ret_desc;
+
+		return (AE_OK);
+
+
+	case ACPI_TYPE_BUFFER:
+
+		if (((*obj_desc)->buffer.length * 3) > ACPI_MAX_STRING_CONVERSION) {
+			return (AE_AML_STRING_LIMIT);
+		}
+
+		/*
+		 * Create a new String
+		 */
+		ret_desc = acpi_ut_create_internal_object (ACPI_TYPE_STRING);
+		if (!ret_desc) {
+			return (AE_NO_MEMORY);
+		}
+
+		/* Need enough space for one ASCII integer plus null terminator */
+
+		ret_desc->string.length = (*obj_desc)->buffer.length * 3;
+		new_buf = acpi_ut_callocate (ret_desc->string.length + 1);
+		if (!new_buf) {
+			REPORT_ERROR
+				(("Ex_convert_to_string: Buffer allocation failure\n"));
+			acpi_ut_remove_reference (ret_desc);
+			return (AE_NO_MEMORY);
+		}
+
+		/*
+		 * Convert each byte of the buffer to two ASCII characters plus a space.
+		 */
+		pointer = (*obj_desc)->buffer.pointer;
+		index = 0;
+		for (i = 0; i < (*obj_desc)->buffer.length; i++) {
+			new_buf[index + 0] = acpi_gbl_hex_to_ascii [pointer[i] & 0x0F];
+			new_buf[index + 1] = acpi_gbl_hex_to_ascii [(pointer[i] >> 4) & 0x0F];
+			new_buf[index + 2] = ' ';
+			index += 3;
+		}
+
+		/* Null terminate */
+
+		new_buf [index] = 0;
+		ret_desc->buffer.pointer = new_buf;
+
+		/* Return the new buffer descriptor */
+
+		if (walk_state->opcode != AML_STORE_OP) {
+			acpi_ut_remove_reference (*obj_desc);
+		}
+		*obj_desc = ret_desc;
+		break;
+
+
+	case ACPI_TYPE_STRING:
+		break;
+
+
+	default:
+		return (AE_TYPE);
+		break;
+   }
+
+	return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ex_convert_to_target_type
+ *
+ * PARAMETERS:  *Obj_desc       - Object to be converted.
+ *              Walk_state      - Current method state
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION:
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_ex_convert_to_target_type (
+	ACPI_OBJECT_TYPE8       destination_type,
+	ACPI_OPERAND_OBJECT     **obj_desc,
+	ACPI_WALK_STATE         *walk_state)
+{
+	ACPI_STATUS             status = AE_OK;
+
+
+	/*
+	 * If required by the target,
+	 * perform implicit conversion on the source before we store it.
+	 */
+
+	switch (GET_CURRENT_ARG_TYPE (walk_state->op_info->runtime_args)) {
+	case ARGI_SIMPLE_TARGET:
+	case ARGI_FIXED_TARGET:
+	case ARGI_INTEGER_REF:      /* Handles Increment, Decrement cases */
+
+		switch (destination_type) {
+		case INTERNAL_TYPE_REGION_FIELD:
+			/*
+			 * Named field can always handle conversions
+			 */
+			break;
+
+		default:
+			/* No conversion allowed for these types */
+
+			if (destination_type != (*obj_desc)->common.type) {
+				status = AE_TYPE;
+			}
+		}
+		break;
+
+
+	case ARGI_TARGETREF:
+
+		switch (destination_type) {
+		case ACPI_TYPE_INTEGER:
+		case ACPI_TYPE_BUFFER_FIELD:
+		case INTERNAL_TYPE_BANK_FIELD:
+		case INTERNAL_TYPE_INDEX_FIELD:
+			/*
+			 * These types require an Integer operand.  We can convert
+			 * a Buffer or a String to an Integer if necessary.
+			 */
+			status = acpi_ex_convert_to_integer (obj_desc, walk_state);
+			break;
+
+
+		case ACPI_TYPE_STRING:
+
+			/*
+			 * The operand must be a String.  We can convert an
+			 * Integer or Buffer if necessary
+			 */
+			status = acpi_ex_convert_to_string (obj_desc, walk_state);
+			break;
+
+
+		case ACPI_TYPE_BUFFER:
+
+			/*
+			 * The operand must be a String.  We can convert an
+			 * Integer or Buffer if necessary
+			 */
+			status = acpi_ex_convert_to_buffer (obj_desc, walk_state);
+			break;
+		}
+		break;
+
+
+	case ARGI_REFERENCE:
+		/*
+		 * Create_xxxx_field cases - we are storing the field object into the name
+		 */
+		break;
+
+
+	default:
+		status = AE_AML_INTERNAL;
+	}
+
+
+	/*
+	 * Source-to-Target conversion semantics:
+	 *
+	 * If conversion to the target type cannot be performed, then simply
+	 * overwrite the target with the new object and type.
+	 */
+	if (status == AE_TYPE) {
+		status = AE_OK;
+	}
+
+	return (status);
+}
+
+
diff -urN linux-2.4.6-pre4/drivers/acpi/executer/excreate.c linux/drivers/acpi/executer/excreate.c
--- linux-2.4.6-pre4/drivers/acpi/executer/excreate.c	Wed Dec 31 16:00:00 1969
+++ linux/drivers/acpi/executer/excreate.c	Mon Dec  3 22:48:42 2001
@@ -0,0 +1,706 @@
+/******************************************************************************
+ *
+ * Module Name: excreate - Named object creation
+ *              $Revision: 63 $
+ *
+ *****************************************************************************/
+
+/*
+ *  Copyright (C) 2000, 2001 R. Byron Moore
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#include "acpi.h"
+#include "acparser.h"
+#include "acinterp.h"
+#include "amlcode.h"
+#include "acnamesp.h"
+#include "acevents.h"
+#include "acdispat.h"
+
+
+#define _COMPONENT          ACPI_EXECUTER
+	 MODULE_NAME         ("excreate")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ex_create_buffer_field
+ *
+ * PARAMETERS:  Opcode              - The opcode to be executed
+ *              Operands            - List of operands for the opcode
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Execute Create_field operators: Create_bit_field_op,
+ *              Create_byte_field_op, Create_word_field_op, Create_dWord_field_op,
+ *              Create_field_op (which define fields in buffers)
+ *
+ * ALLOCATION:  Deletes Create_field_op's count operand descriptor
+ *
+ *
+ *  ACPI SPECIFICATION REFERENCES:
+ *  Def_create_bit_field := Create_bit_field_op Src_buf Bit_idx   Name_string
+ *  Def_create_byte_field := Create_byte_field_op Src_buf Byte_idx Name_string
+ *  Def_create_dWord_field := Create_dWord_field_op Src_buf Byte_idx Name_string
+ *  Def_create_field    :=  Create_field_op     Src_buf Bit_idx   Num_bits    Name_string
+ *  Def_create_word_field := Create_word_field_op Src_buf Byte_idx Name_string
+ *  Bit_index           :=  Term_arg=>Integer
+ *  Byte_index          :=  Term_arg=>Integer
+ *  Num_bits            :=  Term_arg=>Integer
+ *  Source_buff         :=  Term_arg=>Buffer
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_ex_create_buffer_field (
+	u8                      *aml_ptr,
+	u32                     aml_length,
+	ACPI_NAMESPACE_NODE     *node,
+	ACPI_WALK_STATE         *walk_state)
+{
+	ACPI_STATUS             status;
+	ACPI_OPERAND_OBJECT     *obj_desc;
+	ACPI_OPERAND_OBJECT     *tmp_desc;
+
+
+	/* Create the descriptor */
+
+	obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_BUFFER_FIELD);
+	if (!obj_desc) {
+		status = AE_NO_MEMORY;
+		goto cleanup;
+	}
+
+
+	/*
+	 * Allocate a method object for this field unit
+	 */
+
+	obj_desc->buffer_field.extra = acpi_ut_create_internal_object (
+			   INTERNAL_TYPE_EXTRA);
+	if (!obj_desc->buffer_field.extra) {
+		status = AE_NO_MEMORY;
+		goto cleanup;
+	}
+
+	/*
+	 * Remember location in AML stream of the field unit
+	 * opcode and operands -- since the buffer and index
+	 * operands must be evaluated.
+	 */
+
+	obj_desc->buffer_field.extra->extra.pcode     = aml_ptr;
+	obj_desc->buffer_field.extra->extra.pcode_length = aml_length;
+	obj_desc->buffer_field.node = node;
+
+
+	/*
+	 * This operation is supposed to cause the destination Name to refer
+	 * to the defined Buffer_field -- it must not store the constructed
+	 * Buffer_field object (or its current value) in some location that the
+	 * Name may already be pointing to.  So, if the Name currently contains
+	 * a reference which would cause Acpi_ex_store() to perform an indirect
+	 * store rather than setting the value of the Name itself, clobber that
+	 * reference before calling Acpi_ex_store().
+	 */
+
+	/* Type of Name's existing value */
+
+	switch (acpi_ns_get_type (node)) {
+
+	case ACPI_TYPE_BUFFER_FIELD:
+	case INTERNAL_TYPE_ALIAS:
+	case INTERNAL_TYPE_REGION_FIELD:
+	case INTERNAL_TYPE_BANK_FIELD:
+	case INTERNAL_TYPE_INDEX_FIELD:
+
+		tmp_desc = acpi_ns_get_attached_object (node);
+		if (tmp_desc) {
+			/*
+			 * There is an existing object here;  delete it and zero out the
+			 * object field within the Node
+			 */
+
+			acpi_ut_remove_reference (tmp_desc);
+			acpi_ns_attach_object ((ACPI_NAMESPACE_NODE *) node, NULL,
+					 ACPI_TYPE_ANY);
+		}
+
+		/* Set the type to ANY (or the store below will fail) */
+
+		((ACPI_NAMESPACE_NODE *) node)->type = ACPI_TYPE_ANY;
+
+		break;
+
+
+	default:
+
+		break;
+	}
+
+
+	/* Store constructed field descriptor in result location */
+
+	status = acpi_ex_store (obj_desc, (ACPI_OPERAND_OBJECT *) node,
+			  walk_state);
+
+	/*
+	 * If the field descriptor was not physically stored (or if a failure
+	 * above), we must delete it
+	 */
+	if (obj_desc->common.reference_count <= 1) {
+		acpi_ut_remove_reference (obj_desc);
+	}
+
+
+	return (AE_OK);
+
+
+cleanup:
+
+	/* Delete region object and method subobject */
+
+	if (obj_desc) {
+		/* Remove deletes both objects! */
+
+		acpi_ut_remove_reference (obj_desc);
+		obj_desc = NULL;
+	}
+
+	return (status);
+}
+
+
+/*****************************************************************************
+ *
+ * FUNCTION:    Acpi_ex_create_alias
+ *
+ * PARAMETERS:  Walk_state           - Current state, contains List of
+ *                                      operands for the opcode
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Create a new named alias
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+acpi_ex_create_alias (
+	ACPI_WALK_STATE         *walk_state)
+{
+	ACPI_NAMESPACE_NODE     *source_node;
+	ACPI_NAMESPACE_NODE     *alias_node;
+	ACPI_STATUS             status;
+
+
+	/* Get the source/alias operands (both namespace nodes) */
+
+	status = acpi_ds_obj_stack_pop_object ((ACPI_OPERAND_OBJECT **) &source_node,
+			 walk_state);
+	if (ACPI_FAILURE (status)) {
+		return (status);
+	}
+
+	/*
+	 * Don't pop it, it gets removed in the calling routine
+	 */
+	alias_node = acpi_ds_obj_stack_get_value (0, walk_state);
+
+	/* Add an additional reference to the object */
+
+	acpi_ut_add_reference (source_node->object);
+
+	/*
+	 * Attach the original source Node to the new Alias Node.
+	 */
+	status = acpi_ns_attach_object (alias_node, source_node->object,
+			   source_node->type);
+
+
+	/*
+	 * The new alias assumes the type of the source, but it points
+	 * to the same object.  The reference count of the object has two
+	 * additional references to prevent deletion out from under either the
+	 * source or the alias Node
+	 */
+
+	/* Since both operands are Nodes, we don't need to delete them */
+
+	return (status);
+}
+
+
+/*****************************************************************************
+ *
+ * FUNCTION:    Acpi_ex_create_event
+ *
+ * PARAMETERS:  None
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Create a new event object
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+acpi_ex_create_event (
+	ACPI_WALK_STATE         *walk_state)
+{
+	ACPI_STATUS             status;
+	ACPI_OPERAND_OBJECT     *obj_desc;
+
+
+ BREAKPOINT3;
+
+	obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_EVENT);
+	if (!obj_desc) {
+		status = AE_NO_MEMORY;
+		goto cleanup;
+	}
+
+	/* Create the actual OS semaphore */
+
+	/* TBD: [Investigate] should be created with 0 or 1 units? */
+
+	status = acpi_os_create_semaphore (ACPI_NO_UNIT_LIMIT, 1,
+			   &obj_desc->event.semaphore);
+	if (ACPI_FAILURE (status)) {
+		acpi_ut_remove_reference (obj_desc);
+		goto cleanup;
+	}
+
+	/* Attach object to the Node */
+
+	status = acpi_ns_attach_object (acpi_ds_obj_stack_get_value (0, walk_state),
+			   obj_desc, (u8) ACPI_TYPE_EVENT);
+	if (ACPI_FAILURE (status)) {
+		acpi_os_delete_semaphore (obj_desc->event.semaphore);
+		acpi_ut_remove_reference (obj_desc);
+		goto cleanup;
+	}
+
+
+cleanup:
+
+	return (status);
+}
+
+
+/*****************************************************************************
+ *
+ * FUNCTION:    Acpi_ex_create_mutex
+ *
+ * PARAMETERS:  Interpreter_mode    - Current running mode (load1/Load2/Exec)
+ *              Operands            - List of operands for the opcode
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Create a new mutex object
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+acpi_ex_create_mutex (
+	ACPI_WALK_STATE         *walk_state)
+{
+	ACPI_STATUS             status = AE_OK;
+	ACPI_OPERAND_OBJECT     *sync_desc;
+	ACPI_OPERAND_OBJECT     *obj_desc;
+
+
+	/* Get the operand */
+
+	status = acpi_ds_obj_stack_pop_object (&sync_desc, walk_state);
+	if (ACPI_FAILURE (status)) {
+		return (status);
+	}
+
+	/* Attempt to allocate a new object */
+
+	obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_MUTEX);
+	if (!obj_desc) {
+		status = AE_NO_MEMORY;
+		goto cleanup;
+	}
+
+	/* Create the actual OS semaphore */
+
+	status = acpi_os_create_semaphore (1, 1, &obj_desc->mutex.semaphore);
+	if (ACPI_FAILURE (status)) {
+		acpi_ut_remove_reference (obj_desc);
+		goto cleanup;
+	}
+
+	obj_desc->mutex.sync_level = (u8) sync_desc->integer.value;
+
+	/* Obj_desc was on the stack top, and the name is below it */
+
+	status = acpi_ns_attach_object (acpi_ds_obj_stack_get_value (0, walk_state),
+			  obj_desc, (u8) ACPI_TYPE_MUTEX);
+	if (ACPI_FAILURE (status)) {
+		acpi_os_delete_semaphore (obj_desc->mutex.semaphore);
+		acpi_ut_remove_reference (obj_desc);
+		goto cleanup;
+	}
+
+
+cleanup:
+
+	/* Always delete the operand */
+
+	acpi_ut_remove_reference (sync_desc);
+
+	return (status);
+}
+
+
+/*****************************************************************************
+ *
+ * FUNCTION:    Acpi_ex_create_region
+ *
+ * PARAMETERS:  Aml_ptr             - Pointer to the region declaration AML
+ *              Aml_length          - Max length of the declaration AML
+ *              Operands            - List of operands for the opcode
+ *              Interpreter_mode    - Load1/Load2/Execute
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Create a new operation region object
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+acpi_ex_create_region (
+	u8                      *aml_ptr,
+	u32                     aml_length,
+	u8                      region_space,
+	ACPI_WALK_STATE         *walk_state)
+{
+	ACPI_STATUS             status;
+	ACPI_OPERAND_OBJECT     *obj_desc;
+	ACPI_NAMESPACE_NODE     *node;
+
+
+	/*
+	 * Space ID must be one of the predefined IDs, or in the user-defined
+	 * range
+	 */
+	if ((region_space >= NUM_REGION_TYPES) &&
+		(region_space < USER_REGION_BEGIN)) {
+		REPORT_ERROR (("Invalid Address_space type %X\n", region_space));
+		return (AE_AML_INVALID_SPACE_ID);
+	}
+
+
+	/* Get the Node from the object stack  */
+
+	node = (ACPI_NAMESPACE_NODE *) acpi_ds_obj_stack_get_value (0, walk_state);
+
+	/* Create the region descriptor */
+
+	obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_REGION);
+	if (!obj_desc) {
+		status = AE_NO_MEMORY;
+		goto cleanup;
+	}
+
+	/*
+	 * Allocate a method object for this region.
+	 */
+
+	obj_desc->region.extra = acpi_ut_create_internal_object (
+			 INTERNAL_TYPE_EXTRA);
+	if (!obj_desc->region.extra) {
+		status = AE_NO_MEMORY;
+		goto cleanup;
+	}
+
+	/*
+	 * Remember location in AML stream of address & length
+	 * operands since they need to be evaluated at run time.
+	 */
+
+	obj_desc->region.extra->extra.pcode      = aml_ptr;
+	obj_desc->region.extra->extra.pcode_length = aml_length;
+
+	/* Init the region from the operands */
+
+	obj_desc->region.space_id     = region_space;
+	obj_desc->region.address      = 0;
+	obj_desc->region.length       = 0;
+
+
+	/* Install the new region object in the parent Node */
+
+	obj_desc->region.node = node;
+
+	status = acpi_ns_attach_object (node, obj_desc,
+			  (u8) ACPI_TYPE_REGION);
+
+	if (ACPI_FAILURE (status)) {
+		goto cleanup;
+	}
+
+	/*
+	 * If we have a valid region, initialize it
+	 * Namespace is NOT locked at this point.
+	 */
+
+	status = acpi_ev_initialize_region (obj_desc, FALSE);
+
+	if (ACPI_FAILURE (status)) {
+		/*
+		 *  If AE_NOT_EXIST is returned, it is not fatal
+		 *  because many regions get created before a handler
+		 *  is installed for said region.
+		 */
+		if (AE_NOT_EXIST == status) {
+			status = AE_OK;
+		}
+	}
+
+cleanup:
+
+	if (ACPI_FAILURE (status)) {
+		/* Delete region object and method subobject */
+
+		if (obj_desc) {
+			/* Remove deletes both objects! */
+
+			acpi_ut_remove_reference (obj_desc);
+			obj_desc = NULL;
+		}
+	}
+
+	return (status);
+}
+
+
+/*****************************************************************************
+ *
+ * FUNCTION:    Acpi_ex_create_processor
+ *
+ * PARAMETERS:  Op              - Op containing the Processor definition and
+ *                                args
+ *              Processor_node  - Parent Node for the processor object
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Create a new processor object and populate the fields
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+acpi_ex_create_processor (
+	ACPI_PARSE_OBJECT       *op,
+	ACPI_NAMESPACE_NODE     *processor_node)
+{
+	ACPI_STATUS             status;
+	ACPI_PARSE_OBJECT       *arg;
+	ACPI_OPERAND_OBJECT     *obj_desc;
+
+
+	obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_PROCESSOR);
+	if (!obj_desc) {
+		return (AE_NO_MEMORY);
+	}
+
+	/* Install the new processor object in the parent Node */
+
+	status = acpi_ns_attach_object (processor_node, obj_desc,
+			   (u8) ACPI_TYPE_PROCESSOR);
+	if (ACPI_FAILURE (status)) {
+		acpi_ut_delete_object_desc (obj_desc);
+		return (status);
+	}
+
+	/* Get first arg and verify existence */
+
+	arg = op->value.arg;
+	if (!arg) {
+		return (AE_AML_NO_OPERAND);
+	}
+
+	/* First arg is the Processor ID */
+
+	obj_desc->processor.proc_id = (u8) arg->value.integer;
+
+	/* Get second arg and verify existence */
+
+	arg = arg->next;
+	if (!arg) {
+		return (AE_AML_NO_OPERAND);
+	}
+
+	/* Second arg is the PBlock Address */
+
+	obj_desc->processor.address = (ACPI_IO_ADDRESS) arg->value.integer;
+
+	/* Get third arg and verify existence */
+
+	arg = arg->next;
+	if (!arg) {
+		return (AE_AML_NO_OPERAND);
+	}
+
+	/* Third arg is the PBlock Length */
+
+	obj_desc->processor.length = (u8) arg->value.integer;
+	return (AE_OK);
+}
+
+
+/*****************************************************************************
+ *
+ * FUNCTION:    Acpi_ex_create_power_resource
+ *
+ * PARAMETERS:  Op              - Op containing the Power_resource definition
+ *                                and args
+ *              Power_node      - Parent Node for the power object
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Create a new Power_resource object and populate the fields
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+acpi_ex_create_power_resource (
+	ACPI_PARSE_OBJECT       *op,
+	ACPI_NAMESPACE_NODE     *power_node)
+{
+	ACPI_STATUS             status;
+	ACPI_PARSE_OBJECT       *arg;
+	ACPI_OPERAND_OBJECT     *obj_desc;
+
+
+	obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_POWER);
+	if (!obj_desc) {
+		return (AE_NO_MEMORY);
+	}
+
+	/* Install the new power resource object in the parent Node */
+
+	status = acpi_ns_attach_object (power_node, obj_desc,
+			  (u8) ACPI_TYPE_POWER);
+	if (ACPI_FAILURE (status)) {
+		return(status);
+	}
+
+
+	/* Get first arg and verify existence */
+
+	arg = op->value.arg;
+	if (!arg) {
+		return (AE_AML_NO_OPERAND);
+	}
+
+	/* First arg is the System_level */
+
+	obj_desc->power_resource.system_level = (u8) arg->value.integer;
+
+	/* Get second arg and check existence */
+
+	arg = arg->next;
+	if (!arg) {
+		return (AE_AML_NO_OPERAND);
+	}
+
+	/* Second arg is the PBlock Address */
+
+	obj_desc->power_resource.resource_order = (u16) arg->value.integer;
+
+	return (AE_OK);
+}
+
+
+/*****************************************************************************
+ *
+ * FUNCTION:    Acpi_ex_create_method
+ *
+ * PARAMETERS:  Aml_ptr         - First byte of the method's AML
+ *              Aml_length      - AML byte count for this method
+ *              Method_flags    - AML method flag byte
+ *              Method          - Method Node
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Create a new method object
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+acpi_ex_create_method (
+	u8                      *aml_ptr,
+	u32                     aml_length,
+	u32                     method_flags,
+	ACPI_NAMESPACE_NODE     *method)
+{
+	ACPI_OPERAND_OBJECT     *obj_desc;
+	ACPI_STATUS             status;
+
+
+	/* Create a new method object */
+
+	obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_METHOD);
+	if (!obj_desc) {
+	   return (AE_NO_MEMORY);
+	}
+
+	/* Get the method's AML pointer/length from the Op */
+
+	obj_desc->method.pcode      = aml_ptr;
+	obj_desc->method.pcode_length = aml_length;
+
+	/*
+	 * First argument is the Method Flags (contains parameter count for the
+	 * method)
+	 */
+
+	obj_desc->method.method_flags = (u8) method_flags;
+	obj_desc->method.param_count = (u8) (method_flags &
+			  METHOD_FLAGS_ARG_COUNT);
+
+	/*
+	 * Get the concurrency count.  If required, a semaphore will be
+	 * created for this method when it is parsed.
+	 */
+	if (method_flags & METHOD_FLAGS_SERIALIZED) {
+		/*
+		 * ACPI 1.0: Concurrency = 1
+		 * ACPI 2.0: Concurrency = (Sync_level (in method declaration) + 1)
+		 */
+		obj_desc->method.concurrency = (u8)
+				  (((method_flags & METHOD_FLAGS_SYNCH_LEVEL) >> 4) + 1);
+	}
+
+	else {
+		obj_desc->method.concurrency = INFINITE_CONCURRENCY;
+	}
+
+	/* Attach the new object to the method Node */
+
+	status = acpi_ns_attach_object (method, obj_desc, (u8) ACPI_TYPE_METHOD);
+	if (ACPI_FAILURE (status)) {
+		acpi_ut_delete_object_desc (obj_desc);
+	}
+
+	return (status);
+}
+
+
diff -urN linux-2.4.6-pre4/drivers/acpi/executer/exdump.c linux/drivers/acpi/executer/exdump.c
--- linux-2.4.6-pre4/drivers/acpi/executer/exdump.c	Wed Dec 31 16:00:00 1969
+++ linux/drivers/acpi/executer/exdump.c	Mon Dec  3 22:48:42 2001
@@ -0,0 +1,41 @@
+/******************************************************************************
+ *
+ * Module Name: exdump - Interpreter debug output routines
+ *              $Revision: 114 $
+ *
+ *****************************************************************************/
+
+/*
+ *  Copyright (C) 2000, 2001 R. Byron Moore
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#include "acpi.h"
+#include "acinterp.h"
+#include "amlcode.h"
+#include "acnamesp.h"
+#include "actables.h"
+
+#define _COMPONENT          ACPI_EXECUTER
+	 MODULE_NAME         ("exdump")
+
+
+/*
+ * The following routines are used for debug output only
+ */
+
+
diff -urN linux-2.4.6-pre4/drivers/acpi/executer/exdyadic.c linux/drivers/acpi/executer/exdyadic.c
--- linux-2.4.6-pre4/drivers/acpi/executer/exdyadic.c	Wed Dec 31 16:00:00 1969
+++ linux/drivers/acpi/executer/exdyadic.c	Mon Dec  3 22:48:42 2001
@@ -0,0 +1,874 @@
+/******************************************************************************
+ *
+ * Module Name: exdyadic - ACPI AML (p-code) execution for dyadic operators
+ *              $Revision: 77 $
+ *
+ *****************************************************************************/
+
+/*
+ *  Copyright (C) 2000, 2001 R. Byron Moore
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#include "acpi.h"
+#include "acparser.h"
+#include "acnamesp.h"
+#include "acinterp.h"
+#include "acevents.h"
+#include "amlcode.h"
+#include "acdispat.h"
+
+
+#define _COMPONENT          ACPI_EXECUTER
+	 MODULE_NAME         ("exdyadic")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ex_do_concatenate
+ *
+ * PARAMETERS:  *Obj_desc       - Object to be converted.  Must be an
+ *                                Integer, Buffer, or String
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Concatenate two objects OF THE SAME TYPE.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_ex_do_concatenate (
+	ACPI_OPERAND_OBJECT     *obj_desc,
+	ACPI_OPERAND_OBJECT     *obj_desc2,
+	ACPI_OPERAND_OBJECT     **actual_ret_desc,
+	ACPI_WALK_STATE         *walk_state)
+{
+	ACPI_STATUS             status;
+	u32                     i;
+	ACPI_INTEGER            this_integer;
+	ACPI_OPERAND_OBJECT     *ret_desc;
+	NATIVE_CHAR             *new_buf;
+	u32                     integer_size = sizeof (ACPI_INTEGER);
+
+
+	/*
+	 * There are three cases to handle:
+	 * 1) Two Integers concatenated to produce a buffer
+	 * 2) Two Strings concatenated to produce a string
+	 * 3) Two Buffers concatenated to produce a buffer
+	 */
+	switch (obj_desc->common.type) {
+	case ACPI_TYPE_INTEGER:
+
+		/* Handle both ACPI 1.0 and ACPI 2.0 Integer widths */
+
+		if (walk_state->method_node->flags & ANOBJ_DATA_WIDTH_32) {
+			/*
+			 * We are running a method that exists in a 32-bit ACPI table.
+			 * Truncate the value to 32 bits by zeroing out the upper
+			 * 32-bit field
+			 */
+			integer_size = sizeof (u32);
+		}
+
+		/* Result of two integers is a buffer */
+
+		ret_desc = acpi_ut_create_internal_object (ACPI_TYPE_BUFFER);
+		if (!ret_desc) {
+			return (AE_NO_MEMORY);
+		}
+
+		/* Need enough space for two integers */
+
+		ret_desc->buffer.length = integer_size * 2;
+		new_buf = acpi_ut_callocate (ret_desc->buffer.length);
+		if (!new_buf) {
+			REPORT_ERROR
+				(("Ex_do_concatenate: Buffer allocation failure\n"));
+			status = AE_NO_MEMORY;
+			goto cleanup;
+		}
+
+		ret_desc->buffer.pointer = (u8 *) new_buf;
+
+		/* Convert the first integer */
+
+		this_integer = obj_desc->integer.value;
+		for (i = 0; i < integer_size; i++) {
+			new_buf[i] = (u8) this_integer;
+			this_integer >>= 8;
+		}
+
+		/* Convert the second integer */
+
+		this_integer = obj_desc2->integer.value;
+		for (; i < (integer_size * 2); i++) {
+			new_buf[i] = (u8) this_integer;
+			this_integer >>= 8;
+		}
+
+		break;
+
+
+	case ACPI_TYPE_STRING:
+
+		ret_desc = acpi_ut_create_internal_object (ACPI_TYPE_STRING);
+		if (!ret_desc) {
+			return (AE_NO_MEMORY);
+		}
+
+		/* Operand1 is string  */
+
+		new_buf = acpi_ut_allocate (obj_desc->string.length +
+				  obj_desc2->string.length + 1);
+		if (!new_buf) {
+			REPORT_ERROR
+				(("Ex_do_concatenate: String allocation failure\n"));
+			status = AE_NO_MEMORY;
+			goto cleanup;
+		}
+
+		STRCPY (new_buf, obj_desc->string.pointer);
+		STRCPY (new_buf + obj_desc->string.length,
+				  obj_desc2->string.pointer);
+
+		/* Point the return object to the new string */
+
+		ret_desc->string.pointer = new_buf;
+		ret_desc->string.length = obj_desc->string.length +=
+				  obj_desc2->string.length;
+		break;
+
+
+	case ACPI_TYPE_BUFFER:
+
+		/* Operand1 is a buffer */
+
+		ret_desc = acpi_ut_create_internal_object (ACPI_TYPE_BUFFER);
+		if (!ret_desc) {
+			return (AE_NO_MEMORY);
+		}
+
+		new_buf = acpi_ut_allocate (obj_desc->buffer.length +
+				  obj_desc2->buffer.length);
+		if (!new_buf) {
+			REPORT_ERROR
+				(("Ex_do_concatenate: Buffer allocation failure\n"));
+			status = AE_NO_MEMORY;
+			goto cleanup;
+		}
+
+		MEMCPY (new_buf, obj_desc->buffer.pointer,
+				  obj_desc->buffer.length);
+		MEMCPY (new_buf + obj_desc->buffer.length, obj_desc2->buffer.pointer,
+				  obj_desc2->buffer.length);
+
+		/*
+		 * Point the return object to the new buffer
+		 */
+
+		ret_desc->buffer.pointer    = (u8 *) new_buf;
+		ret_desc->buffer.length     = obj_desc->buffer.length +
+				 obj_desc2->buffer.length;
+		break;
+
+	default:
+		status = AE_AML_INTERNAL;
+		ret_desc = NULL;
+	}
+
+
+	*actual_ret_desc = ret_desc;
+	return (AE_OK);
+
+
+cleanup:
+
+	acpi_ut_remove_reference (ret_desc);
+	return (status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ex_dyadic1
+ *
+ * PARAMETERS:  Opcode              - The opcode to be executed
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Execute Type 1 dyadic operator with numeric operands:
+ *              Notify_op
+ *
+ * ALLOCATION:  Deletes both operands
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_ex_dyadic1 (
+	u16                     opcode,
+	ACPI_WALK_STATE         *walk_state)
+{
+	ACPI_OPERAND_OBJECT     *obj_desc = NULL;
+	ACPI_OPERAND_OBJECT     *val_desc = NULL;
+	ACPI_NAMESPACE_NODE     *node;
+	ACPI_STATUS             status = AE_OK;
+
+
+	/* Resolve all operands */
+
+	status = acpi_ex_resolve_operands (opcode, WALK_OPERANDS, walk_state);
+	/* Get the operands */
+
+	status |= acpi_ds_obj_stack_pop_object (&val_desc, walk_state);
+	status |= acpi_ds_obj_stack_pop_object (&obj_desc, walk_state);
+	if (ACPI_FAILURE (status)) {
+		/* Invalid parameters on object stack  */
+
+		goto cleanup;
+	}
+
+
+	/* Examine the opcode */
+
+	switch (opcode) {
+
+	/* Def_notify  :=  Notify_op   Notify_object   Notify_value */
+
+	case AML_NOTIFY_OP:
+
+		/* The Obj_desc is actually an Node */
+
+		node = (ACPI_NAMESPACE_NODE *) obj_desc;
+		obj_desc = NULL;
+
+		/* Object must be a device or thermal zone */
+
+		if (node && val_desc) {
+			switch (node->type) {
+			case ACPI_TYPE_DEVICE:
+			case ACPI_TYPE_THERMAL:
+
+				/*
+				 * Dispatch the notify to the appropriate handler
+				 * NOTE: the request is queued for execution after this method
+				 * completes.  The notify handlers are NOT invoked synchronously
+				 * from this thread -- because handlers may in turn run other
+				 * control methods.
+				 */
+
+				status = acpi_ev_queue_notify_request (node,
+						 (u32) val_desc->integer.value);
+				break;
+
+			default:
+				status = AE_AML_OPERAND_TYPE;
+				break;
+			}
+		}
+		break;
+
+	default:
+
+		REPORT_ERROR (("Acpi_ex_dyadic1: Unknown dyadic opcode %X\n", opcode));
+		status = AE_AML_BAD_OPCODE;
+	}
+
+
+cleanup:
+
+	/* Always delete both operands */
+
+	acpi_ut_remove_reference (val_desc);
+	acpi_ut_remove_reference (obj_desc);
+
+
+	return (status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ex_dyadic2_r
+ *
+ * PARAMETERS:  Opcode              - The opcode to be executed
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Execute Type 2 dyadic operator with numeric operands and
+ *              one or two result operands.
+ *
+ * ALLOCATION:  Deletes one operand descriptor -- other remains on stack
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_ex_dyadic2_r (
+	u16                     opcode,
+	ACPI_WALK_STATE         *walk_state,
+	ACPI_OPERAND_OBJECT     **return_desc)
+{
+	ACPI_OPERAND_OBJECT     *obj_desc   = NULL;
+	ACPI_OPERAND_OBJECT     *obj_desc2  = NULL;
+	ACPI_OPERAND_OBJECT     *res_desc   = NULL;
+	ACPI_OPERAND_OBJECT     *res_desc2  = NULL;
+	ACPI_OPERAND_OBJECT     *ret_desc   = NULL;
+	ACPI_OPERAND_OBJECT     *ret_desc2  = NULL;
+	ACPI_STATUS             status      = AE_OK;
+	u32                     num_operands = 3;
+
+
+	/* Resolve all operands */
+
+	status = acpi_ex_resolve_operands (opcode, WALK_OPERANDS, walk_state);
+	/* Get all operands */
+
+	if (AML_DIVIDE_OP == opcode) {
+		num_operands = 4;
+		status |= acpi_ds_obj_stack_pop_object (&res_desc2, walk_state);
+	}
+
+	status |= acpi_ds_obj_stack_pop_object (&res_desc, walk_state);
+	status |= acpi_ds_obj_stack_pop_object (&obj_desc2, walk_state);
+	status |= acpi_ds_obj_stack_pop_object (&obj_desc, walk_state);
+	if (ACPI_FAILURE (status)) {
+		goto cleanup;
+	}
+
+
+	/* Create an internal return object if necessary */
+
+	switch (opcode) {
+	case AML_ADD_OP:
+	case AML_BIT_AND_OP:
+	case AML_BIT_NAND_OP:
+	case AML_BIT_OR_OP:
+	case AML_BIT_NOR_OP:
+	case AML_BIT_XOR_OP:
+	case AML_DIVIDE_OP:
+	case AML_MULTIPLY_OP:
+	case AML_SHIFT_LEFT_OP:
+	case AML_SHIFT_RIGHT_OP:
+	case AML_SUBTRACT_OP:
+
+		ret_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
+		if (!ret_desc) {
+			status = AE_NO_MEMORY;
+			goto cleanup;
+		}
+
+		break;
+	}
+
+
+	/*
+	 * Execute the opcode
+	 */
+
+	switch (opcode) {
+
+	/* Def_add :=  Add_op  Operand1    Operand2    Result  */
+
+	case AML_ADD_OP:
+
+		ret_desc->integer.value = obj_desc->integer.value +
+				 obj_desc2->integer.value;
+		break;
+
+
+	/* Def_and :=  And_op  Operand1    Operand2    Result  */
+
+	case AML_BIT_AND_OP:
+
+		ret_desc->integer.value = obj_desc->integer.value &
+				 obj_desc2->integer.value;
+		break;
+
+
+	/* Def_nAnd := NAnd_op Operand1    Operand2    Result  */
+
+	case AML_BIT_NAND_OP:
+
+		ret_desc->integer.value = ~(obj_desc->integer.value &
+				   obj_desc2->integer.value);
+		break;
+
+
+	/* Def_or  :=  Or_op   Operand1    Operand2    Result  */
+
+	case AML_BIT_OR_OP:
+
+		ret_desc->integer.value = obj_desc->integer.value |
+				 obj_desc2->integer.value;
+		break;
+
+
+	/* Def_nOr :=  NOr_op  Operand1    Operand2    Result  */
+
+	case AML_BIT_NOR_OP:
+
+		ret_desc->integer.value = ~(obj_desc->integer.value |
+				   obj_desc2->integer.value);
+		break;
+
+
+	/* Def_xOr :=  XOr_op  Operand1    Operand2    Result  */
+
+	case AML_BIT_XOR_OP:
+
+		ret_desc->integer.value = obj_desc->integer.value ^
+				 obj_desc2->integer.value;
+		break;
+
+
+	/* Def_divide  :=  Divide_op Dividend Divisor Remainder Quotient */
+
+	case AML_DIVIDE_OP:
+
+		if (!obj_desc2->integer.value) {
+			REPORT_ERROR
+				(("Ex_dyadic2_r/Divide_op: Divide by zero\n"));
+
+			status = AE_AML_DIVIDE_BY_ZERO;
+			goto cleanup;
+		}
+
+		ret_desc2 = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
+		if (!ret_desc2) {
+			status = AE_NO_MEMORY;
+			goto cleanup;
+		}
+
+		/* Remainder (modulo) */
+
+		ret_desc->integer.value  = ACPI_MODULO (obj_desc->integer.value,
+				  obj_desc2->integer.value);
+
+		/* Result (what we used to call the quotient) */
+
+		ret_desc2->integer.value = ACPI_DIVIDE (obj_desc->integer.value,
+				  obj_desc2->integer.value);
+		break;
+
+
+	/* Def_multiply := Multiply_op Operand1    Operand2    Result  */
+
+	case AML_MULTIPLY_OP:
+
+		ret_desc->integer.value = obj_desc->integer.value *
+				 obj_desc2->integer.value;
+		break;
+
+
+	/* Def_shift_left  :=  Shift_left_op Operand Shift_count Result */
+
+	case AML_SHIFT_LEFT_OP:
+
+		ret_desc->integer.value = obj_desc->integer.value <<
+				 obj_desc2->integer.value;
+		break;
+
+
+	/* Def_shift_right :=  Shift_right_op  Operand Shift_count Result  */
+
+	case AML_SHIFT_RIGHT_OP:
+
+		ret_desc->integer.value = obj_desc->integer.value >>
+				 obj_desc2->integer.value;
+		break;
+
+
+	/* Def_subtract := Subtract_op Operand1    Operand2    Result  */
+
+	case AML_SUBTRACT_OP:
+
+		ret_desc->integer.value = obj_desc->integer.value -
+				 obj_desc2->integer.value;
+		break;
+
+
+	/* Def_concat  :=  Concat_op   Data1   Data2   Result  */
+
+	case AML_CONCAT_OP:
+
+
+		/*
+		 * Convert the second operand if necessary.  The first operand
+		 * determines the type of the second operand, (See the Data Types
+		 * section of the ACPI specification.)  Both object types are
+		 * guaranteed to be either Integer/String/Buffer by the operand
+		 * resolution mechanism above.
+		 */
+
+		switch (obj_desc->common.type) {
+		case ACPI_TYPE_INTEGER:
+			status = acpi_ex_convert_to_integer (&obj_desc2, walk_state);
+			break;
+
+		case ACPI_TYPE_STRING:
+			status = acpi_ex_convert_to_string (&obj_desc2, walk_state);
+			break;
+
+		case ACPI_TYPE_BUFFER:
+			status = acpi_ex_convert_to_buffer (&obj_desc2, walk_state);
+			break;
+
+		default:
+			status = AE_AML_INTERNAL;
+		}
+
+		if (ACPI_FAILURE (status)) {
+			goto cleanup;
+		}
+
+
+		/*
+		 * Both operands are now known to be the same object type
+		 * (Both are Integer, String, or Buffer), and we can now perform the
+		 * concatenation.
+		 */
+		status = acpi_ex_do_concatenate (obj_desc, obj_desc2, &ret_desc, walk_state);
+		if (ACPI_FAILURE (status)) {
+			goto cleanup;
+		}
+		break;
+
+
+	default:
+
+		REPORT_ERROR (("Acpi_ex_dyadic2_r: Unknown dyadic opcode %X\n",
+				opcode));
+		status = AE_AML_BAD_OPCODE;
+		goto cleanup;
+	}
+
+
+	/*
+	 * Store the result of the operation (which is now in Obj_desc) into
+	 * the result descriptor, or the location pointed to by the result
+	 * descriptor (Res_desc).
+	 */
+
+	status = acpi_ex_store (ret_desc, res_desc, walk_state);
+	if (ACPI_FAILURE (status)) {
+		goto cleanup;
+	}
+
+	if (AML_DIVIDE_OP == opcode) {
+		status = acpi_ex_store (ret_desc2, res_desc2, walk_state);
+
+		/*
+		 * Since the remainder is not returned, remove a reference to
+		 * the object we created earlier
+		 */
+
+		acpi_ut_remove_reference (ret_desc2);
+	}
+
+
+cleanup:
+
+	/* Always delete the operands */
+
+	acpi_ut_remove_reference (obj_desc);
+	acpi_ut_remove_reference (obj_desc2);
+
+
+	/* Delete return object on error */
+
+	if (ACPI_FAILURE (status)) {
+		/* On failure, delete the result ops */
+
+		acpi_ut_remove_reference (res_desc);
+		acpi_ut_remove_reference (res_desc2);
+
+		if (ret_desc) {
+			/* And delete the internal return object */
+
+			acpi_ut_remove_reference (ret_desc);
+			ret_desc = NULL;
+		}
+	}
+
+	/* Set the return object and exit */
+
+	*return_desc = ret_desc;
+	return (status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ex_dyadic2_s
+ *
+ * PARAMETERS:  Opcode              - The opcode to be executed
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Execute Type 2 dyadic synchronization operator
+ *
+ * ALLOCATION:  Deletes one operand descriptor -- other remains on stack
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_ex_dyadic2_s (
+	u16                     opcode,
+	ACPI_WALK_STATE         *walk_state,
+	ACPI_OPERAND_OBJECT     **return_desc)
+{
+	ACPI_OPERAND_OBJECT     *obj_desc;
+	ACPI_OPERAND_OBJECT     *time_desc;
+	ACPI_OPERAND_OBJECT     *ret_desc = NULL;
+	ACPI_STATUS             status;
+
+
+	/* Resolve all operands */
+
+	status = acpi_ex_resolve_operands (opcode, WALK_OPERANDS, walk_state);
+	/* Get all operands */
+
+	status |= acpi_ds_obj_stack_pop_object (&time_desc, walk_state);
+	status |= acpi_ds_obj_stack_pop_object (&obj_desc, walk_state);
+	if (ACPI_FAILURE (status)) {
+		/* Invalid parameters on object stack  */
+
+		goto cleanup;
+	}
+
+
+	/* Create the internal return object */
+
+	ret_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
+	if (!ret_desc) {
+		status = AE_NO_MEMORY;
+		goto cleanup;
+	}
+
+	/* Default return value is FALSE, operation did not time out */
+
+	ret_desc->integer.value = 0;
+
+
+	/* Examine the opcode */
+
+	switch (opcode) {
+
+	/* Def_acquire :=  Acquire_op  Mutex_object Timeout */
+
+	case AML_ACQUIRE_OP:
+
+		status = acpi_ex_acquire_mutex (time_desc, obj_desc, walk_state);
+		break;
+
+
+	/* Def_wait := Wait_op Acpi_event_object Timeout */
+
+	case AML_WAIT_OP:
+
+		status = acpi_ex_system_wait_event (time_desc, obj_desc);
+		break;
+
+
+	default:
+
+		REPORT_ERROR (("Acpi_ex_dyadic2_s: Unknown dyadic synchronization opcode %X\n", opcode));
+		status = AE_AML_BAD_OPCODE;
+		goto cleanup;
+	}
+
+
+	/*
+	 * Return a boolean indicating if operation timed out
+	 * (TRUE) or not (FALSE)
+	 */
+
+	if (status == AE_TIME) {
+		ret_desc->integer.value = ACPI_INTEGER_MAX;  /* TRUE, op timed out */
+		status = AE_OK;
+	}
+
+
+cleanup:
+
+	/* Delete params */
+
+	acpi_ut_remove_reference (time_desc);
+	acpi_ut_remove_reference (obj_desc);
+
+	/* Delete return object on error */
+
+	if (ACPI_FAILURE (status) &&
+		(ret_desc)) {
+		acpi_ut_remove_reference (ret_desc);
+		ret_desc = NULL;
+	}
+
+
+	/* Set the return object and exit */
+
+	*return_desc = ret_desc;
+	return (status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ex_dyadic2
+ *
+ * PARAMETERS:  Opcode              - The opcode to be executed
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Execute Type 2 dyadic operator with numeric operands and
+ *              no result operands
+ *
+ * ALLOCATION:  Deletes one operand descriptor -- other remains on stack
+ *              containing result value
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_ex_dyadic2 (
+	u16                     opcode,
+	ACPI_WALK_STATE         *walk_state,
+	ACPI_OPERAND_OBJECT     **return_desc)
+{
+	ACPI_OPERAND_OBJECT     *obj_desc;
+	ACPI_OPERAND_OBJECT     *obj_desc2;
+	ACPI_OPERAND_OBJECT     *ret_desc = NULL;
+	ACPI_STATUS             status;
+	u8                      lboolean;
+
+
+	/* Resolve all operands */
+
+	status = acpi_ex_resolve_operands (opcode, WALK_OPERANDS, walk_state);
+	/* Get all operands */
+
+	status |= acpi_ds_obj_stack_pop_object (&obj_desc2, walk_state);
+	status |= acpi_ds_obj_stack_pop_object (&obj_desc, walk_state);
+	if (ACPI_FAILURE (status)) {
+		/* Invalid parameters on object stack  */
+
+		goto cleanup;
+	}
+
+
+	/* Create the internal return object */
+
+	ret_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
+	if (!ret_desc) {
+		status = AE_NO_MEMORY;
+		goto cleanup;
+	}
+
+	/*
+	 * Execute the Opcode
+	 */
+
+	lboolean = FALSE;
+	switch (opcode) {
+
+	/* Def_lAnd := LAnd_op Operand1    Operand2    */
+
+	case AML_LAND_OP:
+
+		lboolean = (u8) (obj_desc->integer.value &&
+				  obj_desc2->integer.value);
+		break;
+
+
+	/* Def_lEqual  :=  LEqual_op   Operand1    Operand2    */
+
+	case AML_LEQUAL_OP:
+
+		lboolean = (u8) (obj_desc->integer.value ==
+				  obj_desc2->integer.value);
+		break;
+
+
+	/* Def_lGreater := LGreater_op Operand1    Operand2    */
+
+	case AML_LGREATER_OP:
+
+		lboolean = (u8) (obj_desc->integer.value >
+				  obj_desc2->integer.value);
+		break;
+
+
+	/* Def_lLess   :=  LLess_op Operand1   Operand2    */
+
+	case AML_LLESS_OP:
+
+		lboolean = (u8) (obj_desc->integer.value <
+				  obj_desc2->integer.value);
+		break;
+
+
+	/* Def_lOr :=  LOr_op  Operand1    Operand2    */
+
+	case AML_LOR_OP:
+
+		lboolean = (u8) (obj_desc->integer.value ||
+				  obj_desc2->integer.value);
+		break;
+
+
+	default:
+
+		REPORT_ERROR (("Acpi_ex_dyadic2: Unknown dyadic opcode %X\n", opcode));
+		status = AE_AML_BAD_OPCODE;
+		goto cleanup;
+		break;
+	}
+
+
+	/* Set return value to logical TRUE (all ones) or FALSE (zero) */
+
+	if (lboolean) {
+		ret_desc->integer.value = ACPI_INTEGER_MAX;
+	}
+	else {
+		ret_desc->integer.value = 0;
+	}
+
+
+cleanup:
+
+	/* Always delete operands */
+
+	acpi_ut_remove_reference (obj_desc);
+	acpi_ut_remove_reference (obj_desc2);
+
+
+	/* Delete return object on error */
+
+	if (ACPI_FAILURE (status) &&
+		(ret_desc)) {
+		acpi_ut_remove_reference (ret_desc);
+		ret_desc = NULL;
+	}
+
+
+	/* Set the return object and exit */
+
+	*return_desc = ret_desc;
+	return (status);
+}
+
+
diff -urN linux-2.4.6-pre4/drivers/acpi/executer/exfield.c linux/drivers/acpi/executer/exfield.c
--- linux-2.4.6-pre4/drivers/acpi/executer/exfield.c	Wed Dec 31 16:00:00 1969
+++ linux/drivers/acpi/executer/exfield.c	Mon Dec  3 22:48:42 2001
@@ -0,0 +1,498 @@
+/******************************************************************************
+ *
+ * Module Name: exfield - ACPI AML (p-code) execution - field manipulation
+ *              $Revision: 90 $
+ *
+ *****************************************************************************/
+
+/*
+ *  Copyright (C) 2000, 2001 R. Byron Moore
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#include "acpi.h"
+#include "acdispat.h"
+#include "acinterp.h"
+#include "amlcode.h"
+#include "acnamesp.h"
+#include "achware.h"
+#include "acevents.h"
+
+
+#define _COMPONENT          ACPI_EXECUTER
+	 MODULE_NAME         ("exfield")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ex_read_data_from_field
+ *
+ * PARAMETERS:  Mode                - ACPI_READ or ACPI_WRITE
+ *              *Field_node         - Parent node for field to be accessed
+ *              *Buffer             - Value(s) to be read or written
+ *              Buffer_length       - Number of bytes to transfer
+ *
+ * RETURN:      Status3
+ *
+ * DESCRIPTION: Read or write a named field
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_ex_read_data_from_field (
+	ACPI_OPERAND_OBJECT     *obj_desc,
+	ACPI_OPERAND_OBJECT     **ret_buffer_desc)
+{
+	ACPI_STATUS             status;
+	ACPI_OPERAND_OBJECT     *buffer_desc;
+	u32                     length;
+	void                    *buffer;
+
+
+	/* Parameter validation */
+
+	if (!obj_desc) {
+		return (AE_AML_NO_OPERAND);
+	}
+
+	/*
+	 * Allocate a buffer for the contents of the field.
+	 *
+	 * If the field is larger than the size of an ACPI_INTEGER, create
+	 * a BUFFER to hold it.  Otherwise, use an INTEGER.  This allows
+	 * the use of arithmetic operators on the returned value if the
+	 * field size is equal or smaller than an Integer.
+	 *
+	 * Note: Field.length is in bits.
+	 */
+
+	length = ROUND_BITS_UP_TO_BYTES (obj_desc->field.bit_length);
+
+	if (length > sizeof (ACPI_INTEGER)) {
+		/* Field is too large for an Integer, create a Buffer instead */
+
+		buffer_desc = acpi_ut_create_internal_object (ACPI_TYPE_BUFFER);
+		if (!buffer_desc) {
+			return (AE_NO_MEMORY);
+		}
+
+		/* Create the actual read buffer */
+
+		buffer_desc->buffer.pointer = acpi_ut_callocate (length);
+		if (!buffer_desc->buffer.pointer) {
+			acpi_ut_remove_reference (buffer_desc);
+			return (AE_NO_MEMORY);
+		}
+
+		buffer_desc->buffer.length = length;
+		buffer = buffer_desc->buffer.pointer;
+	}
+
+	else {
+		/* Field will fit within an Integer (normal case) */
+
+		buffer_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
+		if (!buffer_desc) {
+			return (AE_NO_MEMORY);
+		}
+
+		length = sizeof (buffer_desc->integer.value);
+		buffer = &buffer_desc->integer.value;
+	}
+
+
+	/* Read from the appropriate field */
+
+	switch (obj_desc->common.type) {
+	case ACPI_TYPE_BUFFER_FIELD:
+		status = acpi_ex_access_buffer_field (ACPI_READ, obj_desc, buffer, length);
+		break;
+
+	case INTERNAL_TYPE_REGION_FIELD:
+		status = acpi_ex_access_region_field (ACPI_READ, obj_desc, buffer, length);
+		break;
+
+	case INTERNAL_TYPE_BANK_FIELD:
+		status = acpi_ex_access_bank_field (ACPI_READ, obj_desc, buffer, length);
+		break;
+
+	case INTERNAL_TYPE_INDEX_FIELD:
+		status = acpi_ex_access_index_field (ACPI_READ, obj_desc, buffer, length);
+		break;
+
+	default:
+		status = AE_AML_INTERNAL;
+	}
+
+
+	if (ACPI_FAILURE (status)) {
+		acpi_ut_remove_reference (buffer_desc);
+	}
+
+	else if (ret_buffer_desc) {
+		*ret_buffer_desc = buffer_desc;
+	}
+
+	return (status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ex_write_data_to_field
+ *
+ * PARAMETERS:  Mode                - ACPI_READ or ACPI_WRITE
+ *              *Field_node         - Parent node for field to be accessed
+ *              *Buffer             - Value(s) to be read or written
+ *              Buffer_length       - Number of bytes to transfer
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Read or write a named field
+ *
+ ******************************************************************************/
+
+
+ACPI_STATUS
+acpi_ex_write_data_to_field (
+	ACPI_OPERAND_OBJECT     *source_desc,
+	ACPI_OPERAND_OBJECT     *obj_desc)
+{
+	ACPI_STATUS             status;
+	u32                     length;
+	void                    *buffer;
+
+
+	/* Parameter validation */
+
+	if (!source_desc || !obj_desc) {
+		return (AE_AML_NO_OPERAND);
+	}
+
+
+	/*
+	 * Get a pointer to the data to be written
+	 */
+	switch (source_desc->common.type) {
+	case ACPI_TYPE_INTEGER:
+		buffer = &source_desc->integer.value;
+		length = sizeof (source_desc->integer.value);
+		break;
+
+	case ACPI_TYPE_BUFFER:
+		buffer = source_desc->buffer.pointer;
+		length = source_desc->buffer.length;
+		break;
+
+	case ACPI_TYPE_STRING:
+		buffer = source_desc->string.pointer;
+		length = source_desc->string.length;
+		break;
+
+	default:
+		return (AE_AML_OPERAND_TYPE);
+	}
+
+
+	/*
+	 * Decode the type of field to be written
+	 */
+	switch (obj_desc->common.type) {
+	case ACPI_TYPE_BUFFER_FIELD:
+		status = acpi_ex_access_buffer_field (ACPI_WRITE, obj_desc, buffer, length);
+		break;
+
+	case INTERNAL_TYPE_REGION_FIELD:
+		status = acpi_ex_access_region_field (ACPI_WRITE, obj_desc, buffer, length);
+		break;
+
+	case INTERNAL_TYPE_BANK_FIELD:
+		status = acpi_ex_access_bank_field (ACPI_WRITE, obj_desc, buffer, length);
+		break;
+
+	case INTERNAL_TYPE_INDEX_FIELD:
+		status = acpi_ex_access_index_field (ACPI_WRITE, obj_desc, buffer, length);
+		break;
+
+	default:
+		return (AE_AML_INTERNAL);
+	}
+
+
+	return (status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ex_access_buffer_field
+ *
+ * PARAMETERS:  Mode                - ACPI_READ or ACPI_WRITE
+ *              *Field_node         - Parent node for field to be accessed
+ *              *Buffer             - Value(s) to be read or written
+ *              Buffer_length       - Number of bytes to transfer
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Read or write a named field
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_ex_access_buffer_field (
+	u32                     mode,
+	ACPI_OPERAND_OBJECT     *obj_desc,
+	void                    *buffer,
+	u32                     buffer_length)
+{
+	ACPI_STATUS             status;
+
+
+	/*
+	 * If the Buffer_field arguments have not been previously evaluated,
+	 * evaluate them now and save the results.
+	 */
+	if (!(obj_desc->common.flags & AOPOBJ_DATA_VALID)) {
+		status = acpi_ds_get_buffer_field_arguments (obj_desc);
+		if (ACPI_FAILURE (status)) {
+			return (status);
+		}
+	}
+
+
+	status = acpi_ex_common_access_field (mode, obj_desc, buffer, buffer_length);
+
+	return (status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ex_access_region_field
+ *
+ * PARAMETERS:  Mode                - ACPI_READ or ACPI_WRITE
+ *              *Field_node         - Parent node for field to be accessed
+ *              *Buffer             - Value(s) to be read or written
+ *              Buffer_length       - Number of bytes to transfer
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Read or write a named field
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_ex_access_region_field (
+	u32                     mode,
+	ACPI_OPERAND_OBJECT     *obj_desc,
+	void                    *buffer,
+	u32                     buffer_length)
+{
+	ACPI_STATUS             status;
+	u8                      locked;
+
+
+	/*
+	 * Get the global lock if needed
+	 */
+	locked = acpi_ex_acquire_global_lock (obj_desc->field.lock_rule);
+
+	status = acpi_ex_common_access_field (mode, obj_desc, buffer, buffer_length);
+
+
+	/*
+	 * Release global lock if we acquired it earlier
+	 */
+	acpi_ex_release_global_lock (locked);
+
+	return (status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ex_access_bank_field
+ *
+ * PARAMETERS:  Mode                - ACPI_READ or ACPI_WRITE
+ *              *Field_node         - Parent node for field to be accessed
+ *              *Buffer             - Value(s) to be read or written
+ *              Buffer_length       - Number of bytes to transfer
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Read or write a Bank Field
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_ex_access_bank_field (
+	u32                     mode,
+	ACPI_OPERAND_OBJECT     *obj_desc,
+	void                    *buffer,
+	u32                     buffer_length)
+{
+	ACPI_STATUS             status;
+	u8                      locked;
+
+
+	/*
+	 * Get the global lock if needed
+	 */
+	locked = acpi_ex_acquire_global_lock (obj_desc->bank_field.lock_rule);
+
+
+	/*
+	 * Write the Bank_value to the Bank_register to select the bank.
+	 * The Bank_value for this Bank_field is specified in the
+	 * Bank_field ASL declaration. The Bank_register is always a Field in
+	 * an operation region.
+	 */
+
+	status = acpi_ex_common_access_field (ACPI_WRITE,
+			 obj_desc->bank_field.bank_register_obj,
+			 &obj_desc->bank_field.value,
+			 sizeof (obj_desc->bank_field.value));
+	if (ACPI_FAILURE (status)) {
+		goto cleanup;
+	}
+
+	/*
+	 * The bank was successfully selected, now read or write the actual
+	 * data.
+	 */
+	status = acpi_ex_common_access_field (mode, obj_desc, buffer, buffer_length);
+
+
+cleanup:
+	/*
+	 * Release global lock if we acquired it earlier
+	 */
+	acpi_ex_release_global_lock (locked);
+
+	return (status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ex_access_index_field
+ *
+ * PARAMETERS:  Mode                - ACPI_READ or ACPI_WRITE
+ *              *Field_node         - Parent node for field to be accessed
+ *              *Buffer             - Value(s) to be read or written
+ *              Buffer_length       - Number of bytes to transfer
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Read or write a Index Field
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_ex_access_index_field (
+	u32                     mode,
+	ACPI_OPERAND_OBJECT     *obj_desc,
+	void                    *buffer,
+	u32                     buffer_length)
+{
+	ACPI_STATUS             status;
+	u8                      locked;
+
+
+	/*
+	 * Get the global lock if needed
+	 */
+	locked = acpi_ex_acquire_global_lock (obj_desc->index_field.lock_rule);
+
+
+	/*
+	 * Set Index value to select proper Data register
+	 */
+	status = acpi_ex_common_access_field (ACPI_WRITE,
+			 obj_desc->index_field.index_obj,
+			 &obj_desc->index_field.value,
+			 sizeof (obj_desc->index_field.value));
+	if (ACPI_FAILURE (status)) {
+		goto cleanup;
+	}
+
+	/* Now read/write the data register */
+
+	status = acpi_ex_common_access_field (mode, obj_desc->index_field.data_obj,
+			  buffer, buffer_length);
+
+cleanup:
+	/*
+	 * Release global lock if we acquired it earlier
+	 */
+	acpi_ex_release_global_lock (locked);
+
+	return (status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ex_common_access_field
+ *
+ * PARAMETERS:  Mode                - ACPI_READ or ACPI_WRITE
+ *              *Field_node         - Parent node for field to be accessed
+ *              *Buffer             - Value(s) to be read or written
+ *              Buffer_length       - Size of buffer, in bytes.  Must be large
+ *                                    enough for all bits of the field.
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Read or write a named field
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_ex_common_access_field (
+	u32                     mode,
+	ACPI_OPERAND_OBJECT     *obj_desc,
+	void                    *buffer,
+	u32                     buffer_length)
+{
+	ACPI_STATUS             status;
+
+
+	/* Perform the actual read or write of the field */
+
+	switch (mode) {
+	case ACPI_READ:
+
+		status = acpi_ex_extract_from_field (obj_desc, buffer, buffer_length);
+		break;
+
+
+	case ACPI_WRITE:
+
+		status = acpi_ex_insert_into_field (obj_desc, buffer, buffer_length);
+		break;
+
+
+	default:
+
+		status = AE_BAD_PARAMETER;
+		break;
+	}
+
+
+	return (status);
+}
+
diff -urN linux-2.4.6-pre4/drivers/acpi/executer/exfldio.c linux/drivers/acpi/executer/exfldio.c
--- linux-2.4.6-pre4/drivers/acpi/executer/exfldio.c	Wed Dec 31 16:00:00 1969
+++ linux/drivers/acpi/executer/exfldio.c	Mon Dec  3 22:48:42 2001
@@ -0,0 +1,827 @@
+/******************************************************************************
+ *
+ * Module Name: exfldio - Aml Field I/O
+ *              $Revision: 57 $
+ *
+ *****************************************************************************/
+
+/*
+ *  Copyright (C) 2000, 2001 R. Byron Moore
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#include "acpi.h"
+#include "acinterp.h"
+#include "amlcode.h"
+#include "acnamesp.h"
+#include "achware.h"
+#include "acevents.h"
+#include "acdispat.h"
+
+
+#define _COMPONENT          ACPI_EXECUTER
+	 MODULE_NAME         ("exfldio")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ex_setup_field
+ *
+ * PARAMETERS:  *Obj_desc           - Field to be read or written
+ *              Field_datum_byte_offset  - Current offset into the field
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Common processing for Acpi_ex_extract_from_field and
+ *              Acpi_ex_insert_into_field
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_ex_setup_field (
+	ACPI_OPERAND_OBJECT     *obj_desc,
+	u32                     field_datum_byte_offset)
+{
+	ACPI_STATUS             status = AE_OK;
+	ACPI_OPERAND_OBJECT     *rgn_desc;
+
+
+	/* Parameter validation */
+
+	rgn_desc = obj_desc->common_field.region_obj;
+	if (!obj_desc || !rgn_desc) {
+		return (AE_AML_NO_OPERAND);
+	}
+
+	if (ACPI_TYPE_REGION != rgn_desc->common.type) {
+		return (AE_AML_OPERAND_TYPE);
+	}
+
+
+	/*
+	 * If the Region Address and Length have not been previously evaluated,
+	 * evaluate them now and save the results.
+	 */
+	if (!(rgn_desc->region.flags & AOPOBJ_DATA_VALID)) {
+
+		status = acpi_ds_get_region_arguments (rgn_desc);
+		if (ACPI_FAILURE (status)) {
+			return (status);
+		}
+	}
+
+
+	/*
+	 * Validate the request.  The entire request from the byte offset for a
+	 * length of one field datum (access width) must fit within the region.
+	 * (Region length is specified in bytes)
+	 */
+	if (rgn_desc->region.length < (obj_desc->common_field.base_byte_offset +
+			   field_datum_byte_offset +
+			   obj_desc->common_field.access_byte_width)) {
+		if (rgn_desc->region.length < obj_desc->common_field.access_byte_width) {
+			/*
+			 * This is the case where the Access_type (Acc_word, etc.) is wider
+			 * than the region itself.  For example, a region of length one
+			 * byte, and a field with Dword access specified.
+			 */
+		}
+
+		/*
+		 * Offset rounded up to next multiple of field width
+		 * exceeds region length, indicate an error
+		 */
+		return (AE_AML_REGION_LIMIT);
+	}
+
+	return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ex_read_field_datum
+ *
+ * PARAMETERS:  *Obj_desc           - Field to be read
+ *              *Value              - Where to store value (must be 32 bits)
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Retrieve the value of the given field
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_ex_read_field_datum (
+	ACPI_OPERAND_OBJECT     *obj_desc,
+	u32                     field_datum_byte_offset,
+	u32                     *value)
+{
+	ACPI_STATUS             status;
+	ACPI_OPERAND_OBJECT     *rgn_desc;
+	ACPI_PHYSICAL_ADDRESS   address;
+	u32                     local_value;
+
+
+	if (!value) {
+		local_value = 0;
+		value = &local_value;   /*  support reads without saving value  */
+	}
+
+	/* Clear the entire return buffer first, [Very Important!] */
+
+	*value = 0;
+
+
+	/*
+	 * Buffer_fields - Read from a Buffer
+	 * Other Fields - Read from a Operation Region.
+	 */
+	switch (obj_desc->common.type) {
+	case ACPI_TYPE_BUFFER_FIELD:
+
+		/*
+		 * For Buffer_fields, we only need to copy the data from the
+		 * source buffer.  Length is the field width in bytes.
+		 */
+		MEMCPY (value, (obj_desc->buffer_field.buffer_obj)->buffer.pointer
+				  + obj_desc->buffer_field.base_byte_offset + field_datum_byte_offset,
+				  obj_desc->common_field.access_byte_width);
+		status = AE_OK;
+		break;
+
+
+	case INTERNAL_TYPE_REGION_FIELD:
+	case INTERNAL_TYPE_BANK_FIELD:
+
+		/*
+		 * For other fields, we need to go through an Operation Region
+		 * (Only types that will get here are Region_fields and Bank_fields)
+		 */
+		status = acpi_ex_setup_field (obj_desc, field_datum_byte_offset);
+		if (ACPI_FAILURE (status)) {
+			return (status);
+		}
+
+
+		/*
+		 * The physical address of this field datum is:
+		 *
+		 * 1) The base of the region, plus
+		 * 2) The base offset of the field, plus
+		 * 3) The current offset into the field
+		 */
+		rgn_desc = obj_desc->common_field.region_obj;
+		address = rgn_desc->region.address + obj_desc->common_field.base_byte_offset +
+				 field_datum_byte_offset;
+
+
+		/* Invoke the appropriate Address_space/Op_region handler */
+
+		status = acpi_ev_address_space_dispatch (rgn_desc, ACPI_READ_ADR_SPACE,
+				  address, obj_desc->common_field.access_bit_width, value);
+
+		break;
+
+
+	default:
+
+		status = AE_AML_INTERNAL;
+		break;
+	}
+
+
+	return (status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ex_get_buffer_datum
+ *
+ * PARAMETERS:  Merged_datum        - Value to store
+ *              Buffer              - Receiving buffer
+ *              Byte_granularity    - 1/2/4 Granularity of the field
+ *                                    (aka Datum Size)
+ *              Offset              - Datum offset into the buffer
+ *
+ * RETURN:      none
+ *
+ * DESCRIPTION: Store the merged datum to the buffer according to the
+ *              byte granularity
+ *
+ ******************************************************************************/
+
+static void
+acpi_ex_get_buffer_datum(
+	u32                     *datum,
+	void                    *buffer,
+	u32                     byte_granularity,
+	u32                     offset)
+{
+
+	switch (byte_granularity) {
+	case ACPI_FIELD_BYTE_GRANULARITY:
+		*datum = ((u8 *) buffer) [offset];
+		break;
+
+	case ACPI_FIELD_WORD_GRANULARITY:
+		MOVE_UNALIGNED16_TO_32 (datum, &(((u16 *) buffer) [offset]));
+		break;
+
+	case ACPI_FIELD_DWORD_GRANULARITY:
+		MOVE_UNALIGNED32_TO_32 (datum, &(((u32 *) buffer) [offset]));
+		break;
+	}
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ex_set_buffer_datum
+ *
+ * PARAMETERS:  Merged_datum        - Value to store
+ *              Buffer              - Receiving buffer
+ *              Byte_granularity    - 1/2/4 Granularity of the field
+ *                                    (aka Datum Size)
+ *              Offset              - Datum offset into the buffer
+ *
+ * RETURN:      none
+ *
+ * DESCRIPTION: Store the merged datum to the buffer according to the
+ *              byte granularity
+ *
+ ******************************************************************************/
+
+static void
+acpi_ex_set_buffer_datum (
+	u32                     merged_datum,
+	void                    *buffer,
+	u32                     byte_granularity,
+	u32                     offset)
+{
+
+	switch (byte_granularity) {
+	case ACPI_FIELD_BYTE_GRANULARITY:
+		((u8 *) buffer) [offset] = (u8) merged_datum;
+		break;
+
+	case ACPI_FIELD_WORD_GRANULARITY:
+		MOVE_UNALIGNED16_TO_16 (&(((u16 *) buffer)[offset]), &merged_datum);
+		break;
+
+	case ACPI_FIELD_DWORD_GRANULARITY:
+		MOVE_UNALIGNED32_TO_32 (&(((u32 *) buffer)[offset]), &merged_datum);
+		break;
+	}
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ex_extract_from_field
+ *
+ * PARAMETERS:  *Obj_desc           - Field to be read
+ *              *Value              - Where to store value
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Retrieve the value of the given field
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_ex_extract_from_field (
+	ACPI_OPERAND_OBJECT     *obj_desc,
+	void                    *buffer,
+	u32                     buffer_length)
+{
+	ACPI_STATUS             status;
+	u32                     field_datum_byte_offset;
+	u32                     datum_offset;
+	u32                     previous_raw_datum;
+	u32                     this_raw_datum = 0;
+	u32                     merged_datum = 0;
+	u32                     byte_field_length;
+	u32                     datum_count;
+
+
+	/*
+	 * The field must fit within the caller's buffer
+	 */
+	byte_field_length = ROUND_BITS_UP_TO_BYTES (obj_desc->common_field.bit_length);
+	if (byte_field_length > buffer_length) {
+		return (AE_BUFFER_OVERFLOW);
+	}
+
+	/* Convert field byte count to datum count, round up if necessary */
+
+	datum_count = ROUND_UP_TO (byte_field_length, obj_desc->common_field.access_byte_width);
+
+
+	/*
+	 * Clear the caller's buffer (the whole buffer length as given)
+	 * This is very important, especially in the cases where a byte is read,
+	 * but the buffer is really a u32 (4 bytes).
+	 */
+	MEMSET (buffer, 0, buffer_length);
+
+	/* Read the first raw datum to prime the loop */
+
+	field_datum_byte_offset = 0;
+	datum_offset= 0;
+
+	status = acpi_ex_read_field_datum (obj_desc, field_datum_byte_offset, &previous_raw_datum);
+	if (ACPI_FAILURE (status)) {
+		return (status);
+	}
+
+
+	/* We might actually be done if the request fits in one datum */
+
+	if ((datum_count == 1) &&
+		(obj_desc->common_field.access_flags & AFIELD_SINGLE_DATUM)) {
+		/* 1) Shift the valid data bits down to start at bit 0 */
+
+		merged_datum = (previous_raw_datum >> obj_desc->common_field.start_field_bit_offset);
+
+		/* 2) Mask off any upper unused bits (bits not part of the field) */
+
+		if (obj_desc->common_field.end_buffer_valid_bits) {
+			merged_datum &= MASK_BITS_ABOVE (obj_desc->common_field.end_buffer_valid_bits);
+		}
+
+		/* Store the datum to the caller buffer */
+
+		acpi_ex_set_buffer_datum (merged_datum, buffer, obj_desc->common_field.access_byte_width,
+				datum_offset);
+
+		return (AE_OK);
+	}
+
+
+	/* We need to get more raw data to complete one or more field data */
+
+	while (datum_offset < datum_count) {
+		field_datum_byte_offset += obj_desc->common_field.access_byte_width;
+
+		/*
+		 * If the field is aligned on a byte boundary, we don't want
+		 * to perform a final read, since this would potentially read
+		 * past the end of the region.
+		 *
+		 * TBD: [Investigate] It may make more sense to just split the aligned
+		 * and non-aligned cases since the aligned case is so very simple,
+		 */
+		if ((obj_desc->common_field.start_field_bit_offset != 0)  ||
+			((obj_desc->common_field.start_field_bit_offset == 0) &&
+			(datum_offset < (datum_count -1)))) {
+			/*
+			 * Get the next raw datum, it contains some or all bits
+			 * of the current field datum
+			 */
+			status = acpi_ex_read_field_datum (obj_desc, field_datum_byte_offset, &this_raw_datum);
+			if (ACPI_FAILURE (status)) {
+				return (status);
+			}
+		}
+
+		/*
+		 * Create the (possibly) merged datum to be stored to the caller buffer
+		 */
+		if (obj_desc->common_field.start_field_bit_offset == 0) {
+			/* Field is not skewed and we can just copy the datum */
+
+			merged_datum = previous_raw_datum;
+		}
+
+		else {
+			/*
+			 * Put together the appropriate bits of the two raw data to make a
+			 * single complete field datum
+			 *
+			 * 1) Normalize the first datum down to bit 0
+			 */
+			merged_datum = (previous_raw_datum >> obj_desc->common_field.start_field_bit_offset);
+
+			/* 2) Insert the second datum "above" the first datum */
+
+			merged_datum |= (this_raw_datum << obj_desc->common_field.datum_valid_bits);
+
+			if ((datum_offset >= (datum_count -1))) {
+				/*
+				 * This is the last iteration of the loop.  We need to clear
+				 * any unused bits (bits that are not part of this field) that
+				 * came from the last raw datum before we store the final
+				 * merged datum into the caller buffer.
+				 */
+				if (obj_desc->common_field.end_buffer_valid_bits) {
+					merged_datum &=
+						MASK_BITS_ABOVE (obj_desc->common_field.end_buffer_valid_bits);
+				}
+			}
+		}
+
+
+		/*
+		 * Store the merged field datum in the caller's buffer, according to
+		 * the granularity of the field (size of each datum).
+		 */
+		acpi_ex_set_buffer_datum (merged_datum, buffer, obj_desc->common_field.access_byte_width,
+				datum_offset);
+
+		/*
+		 * Save the raw datum that was just acquired since it may contain bits
+		 * of the *next* field datum.  Update offsets
+		 */
+		previous_raw_datum = this_raw_datum;
+		datum_offset++;
+	}
+
+
+	return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ex_write_field_datum
+ *
+ * PARAMETERS:  *Obj_desc           - Field to be set
+ *              Value               - Value to store
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Store the value into the given field
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+acpi_ex_write_field_datum (
+	ACPI_OPERAND_OBJECT     *obj_desc,
+	u32                     field_datum_byte_offset,
+	u32                     value)
+{
+	ACPI_STATUS             status = AE_OK;
+	ACPI_OPERAND_OBJECT     *rgn_desc = NULL;
+	ACPI_PHYSICAL_ADDRESS   address;
+
+
+	/*
+	 * Buffer_fields - Read from a Buffer
+	 * Other Fields - Read from a Operation Region.
+	 */
+	switch (obj_desc->common.type) {
+	case ACPI_TYPE_BUFFER_FIELD:
+
+		/*
+		 * For Buffer_fields, we only need to copy the data to the
+		 * target buffer.  Length is the field width in bytes.
+		 */
+		MEMCPY ((obj_desc->buffer_field.buffer_obj)->buffer.pointer
+				+ obj_desc->buffer_field.base_byte_offset + field_datum_byte_offset,
+				&value, obj_desc->common_field.access_byte_width);
+		status = AE_OK;
+		break;
+
+
+	case INTERNAL_TYPE_REGION_FIELD:
+	case INTERNAL_TYPE_BANK_FIELD:
+
+		/*
+		 * For other fields, we need to go through an Operation Region
+		 * (Only types that will get here are Region_fields and Bank_fields)
+		 */
+		status = acpi_ex_setup_field (obj_desc, field_datum_byte_offset);
+		if (ACPI_FAILURE (status)) {
+			return (status);
+		}
+
+		/*
+		 * The physical address of this field datum is:
+		 *
+		 * 1) The base of the region, plus
+		 * 2) The base offset of the field, plus
+		 * 3) The current offset into the field
+		 */
+		rgn_desc = obj_desc->common_field.region_obj;
+		address = rgn_desc->region.address +
+				 obj_desc->common_field.base_byte_offset +
+				 field_datum_byte_offset;
+
+		/* Invoke the appropriate Address_space/Op_region handler */
+
+		status = acpi_ev_address_space_dispatch (rgn_desc, ACPI_WRITE_ADR_SPACE,
+				  address, obj_desc->common_field.access_bit_width, &value);
+
+
+
+		break;
+
+
+	default:
+
+		status = AE_AML_INTERNAL;
+		break;
+	}
+
+
+	return (status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ex_write_field_datum_with_update_rule
+ *
+ * PARAMETERS:  *Obj_desc           - Field to be set
+ *              Value               - Value to store
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Apply the field update rule to a field write
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+acpi_ex_write_field_datum_with_update_rule (
+	ACPI_OPERAND_OBJECT     *obj_desc,
+	u32                     mask,
+	u32                     field_value,
+	u32                     field_datum_byte_offset)
+{
+	ACPI_STATUS             status = AE_OK;
+	u32                     merged_value;
+	u32                     current_value;
+
+
+	/* Start with the new bits  */
+
+	merged_value = field_value;
+
+
+	/* If the mask is all ones, we don't need to worry about the update rule */
+
+	if (mask != ACPI_UINT32_MAX) {
+		/* Decode the update rule */
+
+		switch (obj_desc->common_field.update_rule) {
+
+		case UPDATE_PRESERVE:
+
+			/*
+			 * Check if update rule needs to be applied (not if mask is all
+			 * ones)  The left shift drops the bits we want to ignore.
+			 */
+			if ((~mask << (sizeof (mask) * 8 -
+					  obj_desc->common_field.access_bit_width)) != 0) {
+				/*
+				 * Read the current contents of the byte/word/dword containing
+				 * the field, and merge with the new field value.
+				 */
+				status = acpi_ex_read_field_datum (obj_desc, field_datum_byte_offset,
+						  &current_value);
+				merged_value |= (current_value & ~mask);
+			}
+			break;
+
+
+		case UPDATE_WRITE_AS_ONES:
+
+			/* Set positions outside the field to all ones */
+
+			merged_value |= ~mask;
+			break;
+
+
+		case UPDATE_WRITE_AS_ZEROS:
+
+			/* Set positions outside the field to all zeros */
+
+			merged_value &= mask;
+			break;
+
+
+		default:
+			return (AE_AML_OPERAND_VALUE);
+			break;
+		}
+	}
+
+
+	/* Write the merged value */
+
+	status = acpi_ex_write_field_datum (obj_desc, field_datum_byte_offset,
+			  merged_value);
+
+	return (status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ex_insert_into_field
+ *
+ * PARAMETERS:  *Obj_desc           - Field to be set
+ *              Buffer              - Value to store
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Store the value into the given field
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_ex_insert_into_field (
+	ACPI_OPERAND_OBJECT     *obj_desc,
+	void                    *buffer,
+	u32                     buffer_length)
+{
+	ACPI_STATUS             status;
+	u32                     field_datum_byte_offset;
+	u32                     datum_offset;
+	u32                     mask;
+	u32                     merged_datum;
+	u32                     previous_raw_datum;
+	u32                     this_raw_datum;
+	u32                     byte_field_length;
+	u32                     datum_count;
+
+
+	/*
+	 * Incoming buffer must be at least as long as the field, we do not
+	 * allow "partial" field writes.  We do not care if the buffer is
+	 * larger than the field, this typically happens when an integer is
+	 * written to a field that is actually smaller than an integer.
+	 */
+	byte_field_length = ROUND_BITS_UP_TO_BYTES (obj_desc->common_field.bit_length);
+	if (buffer_length < byte_field_length) {
+		/* TBD: Need a better error code */
+
+		return (AE_BUFFER_OVERFLOW);
+	}
+
+	/* Convert byte count to datum count, round up if necessary */
+
+	datum_count = ROUND_UP_TO (byte_field_length, obj_desc->common_field.access_byte_width);
+
+
+	/*
+	 * Break the request into up to three parts (similar to an I/O request):
+	 * 1) non-aligned part at start
+	 * 2) aligned part in middle
+	 * 3) non-aligned part at the end
+	 */
+	field_datum_byte_offset = 0;
+	datum_offset= 0;
+
+	/* Get a single datum from the caller's buffer */
+
+	acpi_ex_get_buffer_datum (&previous_raw_datum, buffer,
+			obj_desc->common_field.access_byte_width, datum_offset);
+
+	/*
+	 * Part1:
+	 * Write a partial field datum if field does not begin on a datum boundary
+	 * Note: The code in this section also handles the aligned case
+	 *
+	 * Construct Mask with 1 bits where the field is, 0 bits elsewhere
+	 * (Only the bottom 5 bits of Bit_length are valid for a shift operation)
+	 *
+	 * Mask off bits that are "below" the field (if any)
+	 */
+	mask = MASK_BITS_BELOW (obj_desc->common_field.start_field_bit_offset);
+
+	/* If the field fits in one datum, may need to mask upper bits */
+
+	if ((obj_desc->common_field.access_flags & AFIELD_SINGLE_DATUM) &&
+		 obj_desc->common_field.end_field_valid_bits) {
+		/* There are bits above the field, mask them off also */
+
+		mask &= MASK_BITS_ABOVE (obj_desc->common_field.end_field_valid_bits);
+	}
+
+	/* Shift and mask the value into the field position */
+
+	merged_datum = (previous_raw_datum << obj_desc->common_field.start_field_bit_offset);
+	merged_datum &= mask;
+
+	/* Apply the update rule (if necessary) and write the datum to the field */
+
+	status = acpi_ex_write_field_datum_with_update_rule (obj_desc, mask, merged_datum,
+			   field_datum_byte_offset);
+	if (ACPI_FAILURE (status)) {
+		return (status);
+	}
+
+	/* If the entire field fits within one datum, we are done. */
+
+	if ((datum_count == 1) &&
+	   (obj_desc->common_field.access_flags & AFIELD_SINGLE_DATUM)) {
+		return (AE_OK);
+	}
+
+	/*
+	 * Part2:
+	 * Write the aligned data.
+	 *
+	 * We don't need to worry about the update rule for these data, because
+	 * all of the bits in each datum are part of the field.
+	 *
+	 * The last datum must be special cased because it might contain bits
+	 * that are not part of the field -- therefore the "update rule" must be
+	 * applied in Part3 below.
+	 */
+	while (datum_offset < datum_count) {
+		datum_offset++;
+		field_datum_byte_offset += obj_desc->common_field.access_byte_width;
+
+		/*
+		 * Get the next raw buffer datum.  It may contain bits of the previous
+		 * field datum
+		 */
+		acpi_ex_get_buffer_datum (&this_raw_datum, buffer,
+				obj_desc->common_field.access_byte_width, datum_offset);
+
+		/* Create the field datum based on the field alignment */
+
+		if (obj_desc->common_field.start_field_bit_offset != 0) {
+			/*
+			 * Put together appropriate bits of the two raw buffer data to make
+			 * a single complete field datum
+			 */
+			merged_datum =
+				(previous_raw_datum >> obj_desc->common_field.datum_valid_bits) |
+				(this_raw_datum << obj_desc->common_field.start_field_bit_offset);
+		}
+
+		else {
+			/* Field began aligned on datum boundary */
+
+			merged_datum = this_raw_datum;
+		}
+
+
+		/*
+		 * Special handling for the last datum if the field does NOT end on
+		 * a datum boundary.  Update Rule must be applied to the bits outside
+		 * the field.
+		 */
+		if ((datum_offset == datum_count)           &&
+			obj_desc->common_field.end_field_valid_bits) {
+			/*
+			 * Part3:
+			 * This is the last datum and the field does not end on a datum boundary.
+			 * Build the partial datum and write with the update rule.
+			 */
+
+			/* Mask off the unused bits above (after) the end-of-field */
+
+			mask = MASK_BITS_ABOVE (obj_desc->common_field.end_field_valid_bits);
+			merged_datum &= mask;
+
+			/* Write the last datum with the update rule */
+
+			status = acpi_ex_write_field_datum_with_update_rule (obj_desc, mask,
+					  merged_datum, field_datum_byte_offset);
+			if (ACPI_FAILURE (status)) {
+				return (status);
+			}
+		}
+
+		else {
+			/* Normal case -- write the completed datum */
+
+			status = acpi_ex_write_field_datum (obj_desc,
+					  field_datum_byte_offset, merged_datum);
+			if (ACPI_FAILURE (status)) {
+				return (status);
+			}
+		}
+
+		/*
+		 * Save the most recent datum since it may contain bits of the *next*
+		 * field datum.  Update current byte offset.
+		 */
+		previous_raw_datum = this_raw_datum;
+	}
+
+
+	return (status);
+}
+
+
diff -urN linux-2.4.6-pre4/drivers/acpi/executer/exmisc.c linux/drivers/acpi/executer/exmisc.c
--- linux-2.4.6-pre4/drivers/acpi/executer/exmisc.c	Wed Dec 31 16:00:00 1969
+++ linux/drivers/acpi/executer/exmisc.c	Mon Dec  3 22:48:42 2001
@@ -0,0 +1,513 @@
+
+/******************************************************************************
+ *
+ * Module Name: exmisc - ACPI AML (p-code) execution - specific opcodes
+ *              $Revision: 77 $
+ *
+ *****************************************************************************/
+
+/*
+ *  Copyright (C) 2000, 2001 R. Byron Moore
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#include "acpi.h"
+#include "acparser.h"
+#include "acinterp.h"
+#include "amlcode.h"
+#include "acdispat.h"
+
+
+#define _COMPONENT          ACPI_EXECUTER
+	 MODULE_NAME         ("exmisc")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ex_fatal
+ *
+ * PARAMETERS:  none
+ *
+ * RETURN:      Status.  If the OS returns from the OSD call, we just keep
+ *              on going.
+ *
+ * DESCRIPTION: Execute Fatal operator
+ *
+ * ACPI SPECIFICATION REFERENCES:
+ *  Def_fatal   :=  Fatal_op Fatal_type Fatal_code  Fatal_arg
+ *  Fatal_type  :=  Byte_data
+ *  Fatal_code  :=  DWord_data
+ *  Fatal_arg   :=  Term_arg=>Integer
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_ex_fatal (
+	ACPI_WALK_STATE         *walk_state)
+{
+	ACPI_OPERAND_OBJECT     *type_desc;
+	ACPI_OPERAND_OBJECT     *code_desc;
+	ACPI_OPERAND_OBJECT     *arg_desc;
+	ACPI_STATUS             status;
+
+
+	/* Resolve operands */
+
+	status = acpi_ex_resolve_operands (AML_FATAL_OP, WALK_OPERANDS, walk_state);
+	/* Get operands */
+
+	status |= acpi_ds_obj_stack_pop_object (&arg_desc, walk_state);
+	status |= acpi_ds_obj_stack_pop_object (&code_desc, walk_state);
+	status |= acpi_ds_obj_stack_pop_object (&type_desc, walk_state);
+	if (ACPI_FAILURE (status)) {
+		/* Invalid parameters on object stack  */
+
+		goto cleanup;
+	}
+
+
+	/* Def_fatal   :=  Fatal_op Fatal_type Fatal_code  Fatal_arg   */
+
+
+	/*
+	 * TBD: [Unhandled] call OSD interface to notify OS of fatal error
+	 * requiring shutdown!
+	 */
+
+
+cleanup:
+
+	/* Free the operands */
+
+	acpi_ut_remove_reference (arg_desc);
+	acpi_ut_remove_reference (code_desc);
+	acpi_ut_remove_reference (type_desc);
+
+
+	/* If we get back from the OS call, we might as well keep going. */
+
+	REPORT_WARNING (("An AML \"fatal\" Opcode (Fatal_op) was executed\n"));
+	return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ex_index
+ *
+ * PARAMETERS:  none
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Execute Index operator
+ *
+ * ALLOCATION:  Deletes one operand descriptor -- other remains on stack
+ *
+ *  ACPI SPECIFICATION REFERENCES:
+ *  Def_index   :=  Index_op Buff_pkg_obj Index_value Result
+ *  Index_value :=  Term_arg=>Integer
+ *  Name_string :=  <Root_char Name_path> | <Prefix_path Name_path>
+ *  Result      :=  Super_name
+ *  Super_name  :=  Name_string | Arg_obj | Local_obj | Debug_obj | Def_index
+ *                             Local4_op | Local5_op | Local6_op | Local7_op
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_ex_index (
+	ACPI_WALK_STATE         *walk_state,
+	ACPI_OPERAND_OBJECT     **return_desc)
+{
+	ACPI_OPERAND_OBJECT     *obj_desc;
+	ACPI_OPERAND_OBJECT     *idx_desc;
+	ACPI_OPERAND_OBJECT     *res_desc;
+	ACPI_OPERAND_OBJECT     *ret_desc = NULL;
+	ACPI_OPERAND_OBJECT     *tmp_desc;
+	ACPI_STATUS             status;
+
+
+	/* Resolve operands */
+	/* First operand can be either a package or a buffer */
+
+	status = acpi_ex_resolve_operands (AML_INDEX_OP, WALK_OPERANDS, walk_state);
+	/* Get all operands */
+
+	status |= acpi_ds_obj_stack_pop_object (&res_desc, walk_state);
+	status |= acpi_ds_obj_stack_pop_object (&idx_desc, walk_state);
+	status |= acpi_ds_obj_stack_pop_object (&obj_desc, walk_state);
+	if (ACPI_FAILURE (status)) {
+		/* Invalid parameters on object stack  */
+
+		goto cleanup;
+	}
+
+
+	/* Create the internal return object */
+
+	ret_desc = acpi_ut_create_internal_object (INTERNAL_TYPE_REFERENCE);
+	if (!ret_desc) {
+		status = AE_NO_MEMORY;
+		goto cleanup;
+	}
+
+
+	/*
+	 * At this point, the Obj_desc operand is either a Package or a Buffer
+	 */
+
+	if (obj_desc->common.type == ACPI_TYPE_PACKAGE) {
+		/* Object to be indexed is a Package */
+
+		if (idx_desc->integer.value >= obj_desc->package.count) {
+			status = AE_AML_PACKAGE_LIMIT;
+			goto cleanup;
+		}
+
+		if ((res_desc->common.type == INTERNAL_TYPE_REFERENCE) &&
+			(res_desc->reference.opcode == AML_ZERO_OP)) {
+			/*
+			 * There is no actual result descriptor (the Zero_op Result
+			 * descriptor is a placeholder), so just delete the placeholder and
+			 * return a reference to the package element
+			 */
+
+			acpi_ut_remove_reference (res_desc);
+		}
+
+		else {
+			/*
+			 * Each element of the package is an internal object.  Get the one
+			 * we are after.
+			 */
+
+			tmp_desc                      = obj_desc->package.elements[idx_desc->integer.value];
+			ret_desc->reference.opcode    = AML_INDEX_OP;
+			ret_desc->reference.target_type = tmp_desc->common.type;
+			ret_desc->reference.object    = tmp_desc;
+
+			status = acpi_ex_store (ret_desc, res_desc, walk_state);
+			ret_desc->reference.object    = NULL;
+		}
+
+		/*
+		 * The local return object must always be a reference to the package element,
+		 * not the element itself.
+		 */
+		ret_desc->reference.opcode    = AML_INDEX_OP;
+		ret_desc->reference.target_type = ACPI_TYPE_PACKAGE;
+		ret_desc->reference.where     = &obj_desc->package.elements[idx_desc->integer.value];
+	}
+
+	else {
+		/* Object to be indexed is a Buffer */
+
+		if (idx_desc->integer.value >= obj_desc->buffer.length) {
+			status = AE_AML_BUFFER_LIMIT;
+			goto cleanup;
+		}
+
+		ret_desc->reference.opcode      = AML_INDEX_OP;
+		ret_desc->reference.target_type = ACPI_TYPE_BUFFER_FIELD;
+		ret_desc->reference.object      = obj_desc;
+		ret_desc->reference.offset      = (u32) idx_desc->integer.value;
+
+		status = acpi_ex_store (ret_desc, res_desc, walk_state);
+	}
+
+
+cleanup:
+
+	/* Always delete operands */
+
+	acpi_ut_remove_reference (obj_desc);
+	acpi_ut_remove_reference (idx_desc);
+
+	/* Delete return object on error */
+
+	if (ACPI_FAILURE (status)) {
+		acpi_ut_remove_reference (res_desc);
+
+		if (ret_desc) {
+			acpi_ut_remove_reference (ret_desc);
+			ret_desc = NULL;
+		}
+	}
+
+	/* Set the return object and exit */
+
+	*return_desc = ret_desc;
+	return (status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ex_match
+ *
+ * PARAMETERS:  none
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Execute Match operator
+ *
+ * ACPI SPECIFICATION REFERENCES:
+ *  Def_match   :=  Match_op Search_pkg Opcode1     Operand1
+ *                              Opcode2 Operand2    Start_index
+ *  Opcode1     :=  Byte_data: MTR, MEQ, MLE, MLT, MGE, or MGT
+ *  Opcode2     :=  Byte_data: MTR, MEQ, MLE, MLT, MGE, or MGT
+ *  Operand1    :=  Term_arg=>Integer
+ *  Operand2    :=  Term_arg=>Integer
+ *  Search_pkg  :=  Term_arg=>Package_object
+ *  Start_index :=  Term_arg=>Integer
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_ex_match (
+	ACPI_WALK_STATE         *walk_state,
+	ACPI_OPERAND_OBJECT     **return_desc)
+{
+	ACPI_OPERAND_OBJECT     *pkg_desc;
+	ACPI_OPERAND_OBJECT     *op1_desc;
+	ACPI_OPERAND_OBJECT     *V1_desc;
+	ACPI_OPERAND_OBJECT     *op2_desc;
+	ACPI_OPERAND_OBJECT     *V2_desc;
+	ACPI_OPERAND_OBJECT     *start_desc;
+	ACPI_OPERAND_OBJECT     *ret_desc = NULL;
+	ACPI_STATUS             status;
+	u32                     index;
+	u32                     match_value = (u32) -1;
+
+
+	/* Resolve all operands */
+
+	status = acpi_ex_resolve_operands (AML_MATCH_OP, WALK_OPERANDS, walk_state);
+	/* Get all operands */
+
+	status |= acpi_ds_obj_stack_pop_object (&start_desc, walk_state);
+	status |= acpi_ds_obj_stack_pop_object (&V2_desc, walk_state);
+	status |= acpi_ds_obj_stack_pop_object (&op2_desc, walk_state);
+	status |= acpi_ds_obj_stack_pop_object (&V1_desc, walk_state);
+	status |= acpi_ds_obj_stack_pop_object (&op1_desc, walk_state);
+	status |= acpi_ds_obj_stack_pop_object (&pkg_desc, walk_state);
+
+	if (ACPI_FAILURE (status)) {
+		/* Invalid parameters on object stack  */
+
+		goto cleanup;
+	}
+
+	/* Validate match comparison sub-opcodes */
+
+	if ((op1_desc->integer.value > MAX_MATCH_OPERATOR) ||
+		(op2_desc->integer.value > MAX_MATCH_OPERATOR)) {
+		status = AE_AML_OPERAND_VALUE;
+		goto cleanup;
+	}
+
+	index = (u32) start_desc->integer.value;
+	if (index >= (u32) pkg_desc->package.count) {
+		status = AE_AML_PACKAGE_LIMIT;
+		goto cleanup;
+	}
+
+	ret_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
+	if (!ret_desc) {
+		status = AE_NO_MEMORY;
+		goto cleanup;
+
+	}
+
+	/*
+	 * Examine each element until a match is found.  Within the loop,
+	 * "continue" signifies that the current element does not match
+	 * and the next should be examined.
+	 * Upon finding a match, the loop will terminate via "break" at
+	 * the bottom.  If it terminates "normally", Match_value will be -1
+	 * (its initial value) indicating that no match was found.  When
+	 * returned as a Number, this will produce the Ones value as specified.
+	 */
+
+	for ( ; index < pkg_desc->package.count; ++index) {
+		/*
+		 * Treat any NULL or non-numeric elements as non-matching.
+		 * TBD [Unhandled] - if an element is a Name,
+		 *      should we examine its value?
+		 */
+		if (!pkg_desc->package.elements[index] ||
+			ACPI_TYPE_INTEGER != pkg_desc->package.elements[index]->common.type) {
+			continue;
+		}
+
+		/*
+		 * Within these switch statements:
+		 *      "break" (exit from the switch) signifies a match;
+		 *      "continue" (proceed to next iteration of enclosing
+		 *          "for" loop) signifies a non-match.
+		 */
+		switch (op1_desc->integer.value) {
+
+		case MATCH_MTR:   /* always true */
+
+			break;
+
+
+		case MATCH_MEQ:   /* true if equal   */
+
+			if (pkg_desc->package.elements[index]->integer.value
+				 != V1_desc->integer.value) {
+				continue;
+			}
+			break;
+
+
+		case MATCH_MLE:   /* true if less than or equal  */
+
+			if (pkg_desc->package.elements[index]->integer.value
+				 > V1_desc->integer.value) {
+				continue;
+			}
+			break;
+
+
+		case MATCH_MLT:   /* true if less than   */
+
+			if (pkg_desc->package.elements[index]->integer.value
+				 >= V1_desc->integer.value) {
+				continue;
+			}
+			break;
+
+
+		case MATCH_MGE:   /* true if greater than or equal   */
+
+			if (pkg_desc->package.elements[index]->integer.value
+				 < V1_desc->integer.value) {
+				continue;
+			}
+			break;
+
+
+		case MATCH_MGT:   /* true if greater than    */
+
+			if (pkg_desc->package.elements[index]->integer.value
+				 <= V1_desc->integer.value) {
+				continue;
+			}
+			break;
+
+
+		default:    /* undefined   */
+
+			continue;
+		}
+
+
+		switch(op2_desc->integer.value) {
+
+		case MATCH_MTR:
+
+			break;
+
+
+		case MATCH_MEQ:
+
+			if (pkg_desc->package.elements[index]->integer.value
+				 != V2_desc->integer.value) {
+				continue;
+			}
+			break;
+
+
+		case MATCH_MLE:
+
+			if (pkg_desc->package.elements[index]->integer.value
+				 > V2_desc->integer.value) {
+				continue;
+			}
+			break;
+
+
+		case MATCH_MLT:
+
+			if (pkg_desc->package.elements[index]->integer.value
+				 >= V2_desc->integer.value) {
+				continue;
+			}
+			break;
+
+
+		case MATCH_MGE:
+
+			if (pkg_desc->package.elements[index]->integer.value
+				 < V2_desc->integer.value) {
+				continue;
+			}
+			break;
+
+
+		case MATCH_MGT:
+
+			if (pkg_desc->package.elements[index]->integer.value
+				 <= V2_desc->integer.value) {
+				continue;
+			}
+			break;
+
+
+		default:
+
+			continue;
+		}
+
+		/* Match found: exit from loop */
+
+		match_value = index;
+		break;
+	}
+
+	/* Match_value is the return value */
+
+	ret_desc->integer.value = match_value;
+
+
+cleanup:
+
+	/* Free the operands */
+
+	acpi_ut_remove_reference (start_desc);
+	acpi_ut_remove_reference (V2_desc);
+	acpi_ut_remove_reference (op2_desc);
+	acpi_ut_remove_reference (V1_desc);
+	acpi_ut_remove_reference (op1_desc);
+	acpi_ut_remove_reference (pkg_desc);
+
+
+	/* Delete return object on error */
+
+	if (ACPI_FAILURE (status) &&
+		(ret_desc)) {
+		acpi_ut_remove_reference (ret_desc);
+		ret_desc = NULL;
+	}
+
+
+	/* Set the return object and exit */
+
+	*return_desc = ret_desc;
+	return (status);
+}
diff -urN linux-2.4.6-pre4/drivers/acpi/executer/exmonad.c linux/drivers/acpi/executer/exmonad.c
--- linux-2.4.6-pre4/drivers/acpi/executer/exmonad.c	Wed Dec 31 16:00:00 1969
+++ linux/drivers/acpi/executer/exmonad.c	Mon Dec  3 22:48:42 2001
@@ -0,0 +1,972 @@
+
+/******************************************************************************
+ *
+ * Module Name: exmonad - ACPI AML (p-code) execution for monadic operators
+ *              $Revision: 99 $
+ *
+ *****************************************************************************/
+
+/*
+ *  Copyright (C) 2000, 2001 R. Byron Moore
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#include "acpi.h"
+#include "acparser.h"
+#include "acdispat.h"
+#include "acinterp.h"
+#include "amlcode.h"
+#include "acnamesp.h"
+
+
+#define _COMPONENT          ACPI_EXECUTER
+	 MODULE_NAME         ("exmonad")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ex_get_object_reference
+ *
+ * PARAMETERS:  Obj_desc        - Create a reference to this object
+ *              Ret_desc        - Where to store the reference
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Obtain and return a "reference" to the target object
+ *              Common code for the Ref_of_op and the Cond_ref_of_op.
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+acpi_ex_get_object_reference (
+	ACPI_OPERAND_OBJECT     *obj_desc,
+	ACPI_OPERAND_OBJECT     **ret_desc,
+	ACPI_WALK_STATE         *walk_state)
+{
+	ACPI_STATUS             status = AE_OK;
+
+
+	if (VALID_DESCRIPTOR_TYPE (obj_desc, ACPI_DESC_TYPE_INTERNAL)) {
+		if (obj_desc->common.type != INTERNAL_TYPE_REFERENCE) {
+			*ret_desc = NULL;
+			status = AE_TYPE;
+			goto cleanup;
+		}
+
+		/*
+		 * Not a Name -- an indirect name pointer would have
+		 * been converted to a direct name pointer in Acpi_ex_resolve_operands
+		 */
+		switch (obj_desc->reference.opcode) {
+		case AML_LOCAL_OP:
+		case AML_ARG_OP:
+
+			*ret_desc = (void *) acpi_ds_method_data_get_node (obj_desc->reference.opcode,
+					  obj_desc->reference.offset, walk_state);
+			break;
+
+		default:
+
+			*ret_desc = NULL;
+			status = AE_AML_INTERNAL;
+			goto cleanup;
+		}
+
+	}
+
+	else if (VALID_DESCRIPTOR_TYPE (obj_desc, ACPI_DESC_TYPE_NAMED)) {
+		/* Must be a named object;  Just return the Node */
+
+		*ret_desc = obj_desc;
+	}
+
+	else {
+		*ret_desc = NULL;
+		status = AE_TYPE;
+	}
+
+
+cleanup:
+
+	return (status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ex_monadic1
+ *
+ * PARAMETERS:  Opcode              - The opcode to be executed
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Execute Type 1 monadic operator with numeric operand on
+ *              object stack
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_ex_monadic1 (
+	u16                     opcode,
+	ACPI_WALK_STATE         *walk_state)
+{
+	ACPI_OPERAND_OBJECT     *obj_desc;
+	ACPI_STATUS             status;
+
+
+	/* Resolve all operands */
+
+	status = acpi_ex_resolve_operands (opcode, WALK_OPERANDS, walk_state);
+	/* Get all operands */
+
+	status |= acpi_ds_obj_stack_pop_object (&obj_desc, walk_state);
+	if (ACPI_FAILURE (status)) {
+		goto cleanup;
+	}
+
+
+	/* Examine the opcode */
+
+	switch (opcode) {
+
+	/*  Def_release :=  Release_op  Mutex_object */
+
+	case AML_RELEASE_OP:
+
+		status = acpi_ex_release_mutex (obj_desc, walk_state);
+		break;
+
+
+	/*  Def_reset   :=  Reset_op    Acpi_event_object */
+
+	case AML_RESET_OP:
+
+		status = acpi_ex_system_reset_event (obj_desc);
+		break;
+
+
+	/*  Def_signal  :=  Signal_op   Acpi_event_object */
+
+	case AML_SIGNAL_OP:
+
+		status = acpi_ex_system_signal_event (obj_desc);
+		break;
+
+
+	/*  Def_sleep   :=  Sleep_op    Msec_time   */
+
+	case AML_SLEEP_OP:
+
+		acpi_ex_system_do_suspend ((u32) obj_desc->integer.value);
+		break;
+
+
+	/*  Def_stall   :=  Stall_op    Usec_time   */
+
+	case AML_STALL_OP:
+
+		acpi_ex_system_do_stall ((u32) obj_desc->integer.value);
+		break;
+
+
+	/*  Unknown opcode  */
+
+	default:
+
+		REPORT_ERROR (("Acpi_ex_monadic1: Unknown monadic opcode %X\n",
+			opcode));
+		status = AE_AML_BAD_OPCODE;
+		break;
+
+	} /* switch */
+
+
+cleanup:
+
+	/* Always delete the operand */
+
+	acpi_ut_remove_reference (obj_desc);
+
+	return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ex_monadic2_r
+ *
+ * PARAMETERS:  Opcode              - The opcode to be executed
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Execute Type 2 monadic operator with numeric operand and
+ *              result operand on operand stack
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_ex_monadic2_r (
+	u16                     opcode,
+	ACPI_WALK_STATE         *walk_state,
+	ACPI_OPERAND_OBJECT     **return_desc)
+{
+	ACPI_OPERAND_OBJECT     *obj_desc;
+	ACPI_OPERAND_OBJECT     *res_desc;
+	ACPI_OPERAND_OBJECT     *ret_desc = NULL;
+	ACPI_OPERAND_OBJECT     *ret_desc2 = NULL;
+	u32                     res_val;
+	ACPI_STATUS             status;
+	u32                     i;
+	u32                     j;
+	ACPI_INTEGER            digit;
+
+
+	/* Resolve all operands */
+
+	status = acpi_ex_resolve_operands (opcode, WALK_OPERANDS, walk_state);
+	/* Get all operands */
+
+	status |= acpi_ds_obj_stack_pop_object (&res_desc, walk_state);
+	status |= acpi_ds_obj_stack_pop_object (&obj_desc, walk_state);
+	if (ACPI_FAILURE (status)) {
+		goto cleanup;
+	}
+
+
+	/* Create a return object of type NUMBER for most opcodes */
+
+	switch (opcode) {
+	case AML_BIT_NOT_OP:
+	case AML_FIND_SET_LEFT_BIT_OP:
+	case AML_FIND_SET_RIGHT_BIT_OP:
+	case AML_FROM_BCD_OP:
+	case AML_TO_BCD_OP:
+	case AML_COND_REF_OF_OP:
+
+		ret_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
+		if (!ret_desc) {
+			status = AE_NO_MEMORY;
+			goto cleanup;
+		}
+
+		break;
+	}
+
+
+	switch (opcode) {
+	/*  Def_not :=  Not_op  Operand Result  */
+
+	case AML_BIT_NOT_OP:
+
+		ret_desc->integer.value = ~obj_desc->integer.value;
+		break;
+
+
+	/*  Def_find_set_left_bit := Find_set_left_bit_op Operand Result */
+
+	case AML_FIND_SET_LEFT_BIT_OP:
+
+		ret_desc->integer.value = obj_desc->integer.value;
+
+		/*
+		 * Acpi specification describes Integer type as a little
+		 * endian unsigned value, so this boundary condition is valid.
+		 */
+		for (res_val = 0; ret_desc->integer.value && res_val < ACPI_INTEGER_BIT_SIZE; ++res_val) {
+			ret_desc->integer.value >>= 1;
+		}
+
+		ret_desc->integer.value = res_val;
+		break;
+
+
+	/*  Def_find_set_right_bit := Find_set_right_bit_op Operand Result */
+
+	case AML_FIND_SET_RIGHT_BIT_OP:
+
+		ret_desc->integer.value = obj_desc->integer.value;
+
+		/*
+		 * Acpi specification describes Integer type as a little
+		 * endian unsigned value, so this boundary condition is valid.
+		 */
+		for (res_val = 0; ret_desc->integer.value && res_val < ACPI_INTEGER_BIT_SIZE; ++res_val) {
+			ret_desc->integer.value <<= 1;
+		}
+
+		/* Since returns must be 1-based, subtract from 33 (65) */
+
+		ret_desc->integer.value = res_val == 0 ? 0 : (ACPI_INTEGER_BIT_SIZE + 1) - res_val;
+		break;
+
+
+	/*  Def_from_bDC := From_bCDOp  BCDValue    Result  */
+
+	case AML_FROM_BCD_OP:
+
+		/*
+		 * The 64-bit ACPI integer can hold 16 4-bit BCD integers
+		 */
+		ret_desc->integer.value = 0;
+		for (i = 0; i < ACPI_MAX_BCD_DIGITS; i++) {
+			/* Get one BCD digit */
+
+			digit = (ACPI_INTEGER) ((obj_desc->integer.value >> (i * 4)) & 0xF);
+
+			/* Check the range of the digit */
+
+			if (digit > 9) {
+				status = AE_AML_NUMERIC_OVERFLOW;
+				goto cleanup;
+			}
+
+			if (digit > 0) {
+				/* Sum into the result with the appropriate power of 10 */
+
+				for (j = 0; j < i; j++) {
+					digit *= 10;
+				}
+
+				ret_desc->integer.value += digit;
+			}
+		}
+		break;
+
+
+	/*  Def_to_bDC  :=  To_bCDOp Operand Result */
+
+	case AML_TO_BCD_OP:
+
+
+		if (obj_desc->integer.value > ACPI_MAX_BCD_VALUE) {
+			status = AE_AML_NUMERIC_OVERFLOW;
+			goto cleanup;
+		}
+
+		ret_desc->integer.value = 0;
+		for (i = 0; i < ACPI_MAX_BCD_DIGITS; i++) {
+			/* Divide by nth factor of 10 */
+
+			digit = obj_desc->integer.value;
+			for (j = 0; j < i; j++) {
+				digit /= 10;
+			}
+
+			/* Create the BCD digit */
+
+			if (digit > 0) {
+				ret_desc->integer.value += (ACPI_MODULO (digit, 10) << (i * 4));
+			}
+		}
+		break;
+
+
+	/*  Def_cond_ref_of     :=  Cond_ref_of_op  Source_object   Result  */
+
+	case AML_COND_REF_OF_OP:
+
+		/*
+		 * This op is a little strange because the internal return value is
+		 * different than the return value stored in the result descriptor
+		 * (There are really two return values)
+		 */
+
+		if ((ACPI_NAMESPACE_NODE *) obj_desc == acpi_gbl_root_node) {
+			/*
+			 * This means that the object does not exist in the namespace,
+			 * return FALSE
+			 */
+
+			ret_desc->integer.value = 0;
+
+			/*
+			 * Must delete the result descriptor since there is no reference
+			 * being returned
+			 */
+
+			acpi_ut_remove_reference (res_desc);
+			goto cleanup;
+		}
+
+		/* Get the object reference and store it */
+
+		status = acpi_ex_get_object_reference (obj_desc, &ret_desc2, walk_state);
+		if (ACPI_FAILURE (status)) {
+			goto cleanup;
+		}
+
+		status = acpi_ex_store (ret_desc2, res_desc, walk_state);
+
+		/* The object exists in the namespace, return TRUE */
+
+		ret_desc->integer.value = ACPI_INTEGER_MAX;
+		goto cleanup;
+		break;
+
+
+	case AML_STORE_OP:
+
+		/*
+		 * A store operand is typically a number, string, buffer or lvalue
+		 * TBD: [Unhandled] What about a store to a package?
+		 */
+
+		/*
+		 * Do the store, and be careful about deleting the source object,
+		 * since the object itself may have been stored.
+		 */
+
+		status = acpi_ex_store (obj_desc, res_desc, walk_state);
+		if (ACPI_FAILURE (status)) {
+			/* On failure, just delete the Obj_desc */
+
+			acpi_ut_remove_reference (obj_desc);
+		}
+
+		else {
+			/*
+			 * Normally, we would remove a reference on the Obj_desc parameter;
+			 * But since it is being used as the internal return object
+			 * (meaning we would normally increment it), the two cancel out,
+			 * and we simply don't do anything.
+			 */
+			*return_desc = obj_desc;
+		}
+
+		obj_desc = NULL;
+		return (status);
+
+		break;
+
+
+	case AML_DEBUG_OP:
+
+		/* Reference, returning an Reference */
+
+		return (AE_OK);
+		break;
+
+
+	/*
+	 * These are obsolete opcodes
+	 */
+
+	/*  Def_shift_left_bit  :=  Shift_left_bit_op   Source          Bit_num */
+	/*  Def_shift_right_bit :=  Shift_right_bit_op  Source          Bit_num */
+
+	case AML_SHIFT_LEFT_BIT_OP:
+	case AML_SHIFT_RIGHT_BIT_OP:
+
+		status = AE_SUPPORT;
+		goto cleanup;
+		break;
+
+
+	default:
+
+		REPORT_ERROR (("Acpi_ex_monadic2_r: Unknown monadic opcode %X\n",
+			opcode));
+		status = AE_AML_BAD_OPCODE;
+		goto cleanup;
+	}
+
+
+	status = acpi_ex_store (ret_desc, res_desc, walk_state);
+
+
+cleanup:
+	/* Always delete the operand object */
+
+	acpi_ut_remove_reference (obj_desc);
+
+	/* Delete return object(s) on error */
+
+	if (ACPI_FAILURE (status)) {
+		acpi_ut_remove_reference (res_desc); /* Result descriptor */
+		if (ret_desc) {
+			acpi_ut_remove_reference (ret_desc);
+			ret_desc = NULL;
+		}
+	}
+
+	/* Set the return object and exit */
+
+	*return_desc = ret_desc;
+	return (status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ex_monadic2
+ *
+ * PARAMETERS:  Opcode              - The opcode to be executed
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Execute Type 2 monadic operator with numeric operand:
+ *              Deref_of_op, Ref_of_op, Size_of_op, Type_op, Increment_op,
+ *              Decrement_op, LNot_op,
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_ex_monadic2 (
+	u16                     opcode,
+	ACPI_WALK_STATE         *walk_state,
+	ACPI_OPERAND_OBJECT     **return_desc)
+{
+	ACPI_OPERAND_OBJECT     *obj_desc;
+	ACPI_OPERAND_OBJECT     *tmp_desc;
+	ACPI_OPERAND_OBJECT     *ret_desc = NULL;
+	ACPI_STATUS             resolve_status;
+	ACPI_STATUS             status;
+	u32                     type;
+	ACPI_INTEGER            value;
+
+
+	/* Attempt to resolve the operands */
+
+	resolve_status = acpi_ex_resolve_operands (opcode, WALK_OPERANDS, walk_state);
+	/* Always get all operands */
+
+	status = acpi_ds_obj_stack_pop_object (&obj_desc, walk_state);
+
+	/* Now we can check the status codes */
+
+	if (ACPI_FAILURE (resolve_status)) {
+		goto cleanup;
+	}
+
+	if (ACPI_FAILURE (status)) {
+		goto cleanup;
+	}
+
+
+	/* Get the operand and decode the opcode */
+
+
+	switch (opcode) {
+
+	/*  Def_lNot := LNot_op Operand */
+
+	case AML_LNOT_OP:
+
+		ret_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
+		if (!ret_desc) {
+			status = AE_NO_MEMORY;
+			goto cleanup;
+		}
+
+		ret_desc->integer.value = !obj_desc->integer.value;
+		break;
+
+
+	/*  Def_decrement   :=  Decrement_op Target */
+	/*  Def_increment   :=  Increment_op Target */
+
+	case AML_DECREMENT_OP:
+	case AML_INCREMENT_OP:
+
+		/*
+		 * Since we are expecting an Reference on the top of the stack, it
+		 * can be either an Node or an internal object.
+		 *
+		 * TBD: [Future] This may be the prototype code for all cases where
+		 * an Reference is expected!! 10/99
+		 */
+
+		if (VALID_DESCRIPTOR_TYPE (obj_desc, ACPI_DESC_TYPE_NAMED)) {
+			ret_desc = obj_desc;
+		}
+
+		else {
+			/*
+			 * Duplicate the Reference in a new object so that we can resolve it
+			 * without destroying the original Reference object
+			 */
+
+			ret_desc = acpi_ut_create_internal_object (INTERNAL_TYPE_REFERENCE);
+			if (!ret_desc) {
+				status = AE_NO_MEMORY;
+				goto cleanup;
+			}
+
+			ret_desc->reference.opcode = obj_desc->reference.opcode;
+			ret_desc->reference.offset = obj_desc->reference.offset;
+			ret_desc->reference.object = obj_desc->reference.object;
+		}
+
+
+		/*
+		 * Convert the Ret_desc Reference to a Number
+		 * (This deletes the original Ret_desc)
+		 */
+
+		status = acpi_ex_resolve_operands (AML_LNOT_OP, &ret_desc, walk_state);
+		if (ACPI_FAILURE (status)) {
+			goto cleanup;
+		}
+
+		/* Do the actual increment or decrement */
+
+		if (AML_INCREMENT_OP == opcode) {
+			ret_desc->integer.value++;
+		}
+		else {
+			ret_desc->integer.value--;
+		}
+
+		/* Store the result back in the original descriptor */
+
+		status = acpi_ex_store (ret_desc, obj_desc, walk_state);
+
+		/* Objdesc was just deleted (because it is an Reference) */
+
+		obj_desc = NULL;
+
+		break;
+
+
+	/*  Def_object_type :=  Object_type_op  Source_object   */
+
+	case AML_TYPE_OP:
+
+		if (INTERNAL_TYPE_REFERENCE == obj_desc->common.type) {
+			/*
+			 * Not a Name -- an indirect name pointer would have
+			 * been converted to a direct name pointer in Resolve_operands
+			 */
+			switch (obj_desc->reference.opcode) {
+			case AML_ZERO_OP:
+			case AML_ONE_OP:
+			case AML_ONES_OP:
+
+				/* Constants are of type Number */
+
+				type = ACPI_TYPE_INTEGER;
+				break;
+
+
+			case AML_DEBUG_OP:
+
+				/* Per 1.0b spec, Debug object is of type Debug_object */
+
+				type = ACPI_TYPE_DEBUG_OBJECT;
+				break;
+
+
+			case AML_INDEX_OP:
+
+				/* Get the type of this reference (index into another object) */
+
+				type = obj_desc->reference.target_type;
+				if (type == ACPI_TYPE_PACKAGE) {
+					/*
+					 * The main object is a package, we want to get the type
+					 * of the individual package element that is referenced by
+					 * the index.
+					 */
+					type = (*(obj_desc->reference.where))->common.type;
+				}
+
+				break;
+
+
+			case AML_LOCAL_OP:
+			case AML_ARG_OP:
+
+				type = acpi_ds_method_data_get_type (obj_desc->reference.opcode,
+						  obj_desc->reference.offset, walk_state);
+				break;
+
+
+			default:
+
+				REPORT_ERROR (("Acpi_ex_monadic2/Type_op: Internal error - Unknown Reference subtype %X\n",
+					obj_desc->reference.opcode));
+				status = AE_AML_INTERNAL;
+				goto cleanup;
+			}
+		}
+
+		else {
+			/*
+			 * It's not a Reference, so it must be a direct name pointer.
+			 */
+			type = acpi_ns_get_type ((ACPI_NAMESPACE_NODE *) obj_desc);
+
+			/* Convert internal types to external types */
+
+			switch (type) {
+			case INTERNAL_TYPE_REGION_FIELD:
+			case INTERNAL_TYPE_BANK_FIELD:
+			case INTERNAL_TYPE_INDEX_FIELD:
+
+				type = ACPI_TYPE_FIELD_UNIT;
+			}
+
+		}
+
+		/* Allocate a descriptor to hold the type. */
+
+		ret_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
+		if (!ret_desc) {
+			status = AE_NO_MEMORY;
+			goto cleanup;
+		}
+
+		ret_desc->integer.value = type;
+		break;
+
+
+	/*  Def_size_of :=  Size_of_op  Source_object   */
+
+	case AML_SIZE_OF_OP:
+
+		if (VALID_DESCRIPTOR_TYPE (obj_desc, ACPI_DESC_TYPE_NAMED)) {
+			obj_desc = acpi_ns_get_attached_object ((ACPI_NAMESPACE_NODE *) obj_desc);
+		}
+
+		if (!obj_desc) {
+			value = 0;
+		}
+
+		else {
+			switch (obj_desc->common.type) {
+
+			case ACPI_TYPE_BUFFER:
+
+				value = obj_desc->buffer.length;
+				break;
+
+
+			case ACPI_TYPE_STRING:
+
+				value = obj_desc->string.length;
+				break;
+
+
+			case ACPI_TYPE_PACKAGE:
+
+				value = obj_desc->package.count;
+				break;
+
+			case INTERNAL_TYPE_REFERENCE:
+
+				value = 4;
+				break;
+
+			default:
+
+				status = AE_AML_OPERAND_TYPE;
+				goto cleanup;
+			}
+		}
+
+		/*
+		 * Now that we have the size of the object, create a result
+		 * object to hold the value
+		 */
+
+		ret_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
+		if (!ret_desc) {
+			status = AE_NO_MEMORY;
+			goto cleanup;
+		}
+
+		ret_desc->integer.value = value;
+		break;
+
+
+	/*  Def_ref_of  :=  Ref_of_op   Source_object   */
+
+	case AML_REF_OF_OP:
+
+		status = acpi_ex_get_object_reference (obj_desc, &ret_desc, walk_state);
+		if (ACPI_FAILURE (status)) {
+			goto cleanup;
+		}
+		break;
+
+
+	/*  Def_deref_of := Deref_of_op Obj_reference   */
+
+	case AML_DEREF_OF_OP:
+
+
+		/* Check for a method local or argument */
+
+		if (!VALID_DESCRIPTOR_TYPE (obj_desc, ACPI_DESC_TYPE_NAMED)) {
+			/*
+			 * Must resolve/dereference the local/arg reference first
+			 */
+			switch (obj_desc->reference.opcode) {
+			/* Set Obj_desc to the value of the local/arg */
+
+			case AML_LOCAL_OP:
+			case AML_ARG_OP:
+
+				acpi_ds_method_data_get_value (obj_desc->reference.opcode,
+						obj_desc->reference.offset, walk_state, &tmp_desc);
+
+				/*
+				 * Delete our reference to the input object and
+				 * point to the object just retrieved
+				 */
+				acpi_ut_remove_reference (obj_desc);
+				obj_desc = tmp_desc;
+				break;
+
+			default:
+
+				/* Index op - handled below */
+				break;
+			}
+		}
+
+
+		/* Obj_desc may have changed from the code above */
+
+		if (VALID_DESCRIPTOR_TYPE (obj_desc, ACPI_DESC_TYPE_NAMED)) {
+			/* Get the actual object from the Node (This is the dereference) */
+
+			ret_desc = ((ACPI_NAMESPACE_NODE *) obj_desc)->object;
+
+			/* Returning a pointer to the object, add another reference! */
+
+			acpi_ut_add_reference (ret_desc);
+		}
+
+		else {
+			/*
+			 * This must be a reference object produced by the Index
+			 * ASL operation -- check internal opcode
+			 */
+
+			if ((obj_desc->reference.opcode != AML_INDEX_OP) &&
+				(obj_desc->reference.opcode != AML_REF_OF_OP)) {
+				status = AE_TYPE;
+				goto cleanup;
+			}
+
+
+			switch (obj_desc->reference.opcode) {
+			case AML_INDEX_OP:
+
+				/*
+				 * Supported target types for the Index operator are
+				 * 1) A Buffer
+				 * 2) A Package
+				 */
+
+				if (obj_desc->reference.target_type == ACPI_TYPE_BUFFER_FIELD) {
+					/*
+					 * The target is a buffer, we must create a new object that
+					 * contains one element of the buffer, the element pointed
+					 * to by the index.
+					 *
+					 * NOTE: index into a buffer is NOT a pointer to a
+					 * sub-buffer of the main buffer, it is only a pointer to a
+					 * single element (byte) of the buffer!
+					 */
+					ret_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
+					if (!ret_desc) {
+						status = AE_NO_MEMORY;
+						goto cleanup;
+					}
+
+					tmp_desc = obj_desc->reference.object;
+					ret_desc->integer.value =
+						tmp_desc->buffer.pointer[obj_desc->reference.offset];
+
+					/* TBD: [Investigate] (see below) Don't add an additional
+					 * ref!
+					 */
+				}
+
+				else if (obj_desc->reference.target_type == ACPI_TYPE_PACKAGE) {
+					/*
+					 * The target is a package, we want to return the referenced
+					 * element of the package.  We must add another reference to
+					 * this object, however.
+					 */
+
+					ret_desc = *(obj_desc->reference.where);
+					if (!ret_desc) {
+						/*
+						 * We can't return a NULL dereferenced value.  This is
+						 * an uninitialized package element and is thus a
+						 * severe error.
+						 */
+
+						status = AE_AML_UNINITIALIZED_ELEMENT;
+						goto cleanup;
+					}
+
+					acpi_ut_add_reference (ret_desc);
+				}
+
+				else {
+					status = AE_AML_OPERAND_TYPE;
+					goto cleanup;
+				}
+
+				break;
+
+
+			case AML_REF_OF_OP:
+
+				ret_desc = obj_desc->reference.object;
+
+				/* Add another reference to the object! */
+
+				acpi_ut_add_reference (ret_desc);
+				break;
+			}
+		}
+
+		break;
+
+
+	default:
+
+		REPORT_ERROR (("Acpi_ex_monadic2: Unknown monadic opcode %X\n",
+			opcode));
+		status = AE_AML_BAD_OPCODE;
+		goto cleanup;
+	}
+
+
+cleanup:
+
+	if (obj_desc) {
+		acpi_ut_remove_reference (obj_desc);
+	}
+
+	/* Delete return object on error */
+
+	if (ACPI_FAILURE (status) &&
+		(ret_desc)) {
+		acpi_ut_remove_reference (ret_desc);
+		ret_desc = NULL;
+	}
+
+	*return_desc = ret_desc;
+	return (status);
+}
+
diff -urN linux-2.4.6-pre4/drivers/acpi/executer/exmutex.c linux/drivers/acpi/executer/exmutex.c
--- linux-2.4.6-pre4/drivers/acpi/executer/exmutex.c	Wed Dec 31 16:00:00 1969
+++ linux/drivers/acpi/executer/exmutex.c	Mon Dec  3 22:48:42 2001
@@ -0,0 +1,281 @@
+
+/******************************************************************************
+ *
+ * Module Name: exmutex - ASL Mutex Acquire/Release functions
+ *              $Revision: 5 $
+ *
+ *****************************************************************************/
+
+/*
+ *  Copyright (C) 2000, 2001 R. Byron Moore
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#include "acpi.h"
+#include "acinterp.h"
+#include "acnamesp.h"
+#include "achware.h"
+#include "acevents.h"
+
+#define _COMPONENT          ACPI_EXECUTER
+	 MODULE_NAME         ("exmutex")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ex_unlink_mutex
+ *
+ * PARAMETERS:  *Obj_desc           - The mutex to be unlinked
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Remove a mutex from the "Acquired_mutex" list
+ *
+ ******************************************************************************/
+
+void
+acpi_ex_unlink_mutex (
+	ACPI_OPERAND_OBJECT     *obj_desc)
+{
+
+	if (obj_desc->mutex.next) {
+		(obj_desc->mutex.next)->mutex.prev = obj_desc->mutex.prev;
+	}
+	if (obj_desc->mutex.prev) {
+		(obj_desc->mutex.prev)->mutex.next = obj_desc->mutex.next;
+	}
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ex_link_mutex
+ *
+ * PARAMETERS:  *Obj_desc           - The mutex to be linked
+ *              *List_head          - head of the "Acquired_mutex" list
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Add a mutex to the "Acquired_mutex" list for this walk
+ *
+ ******************************************************************************/
+
+void
+acpi_ex_link_mutex (
+	ACPI_OPERAND_OBJECT     *obj_desc,
+	ACPI_OPERAND_OBJECT     *list_head)
+{
+
+	/* This object will be the first object in the list */
+
+	obj_desc->mutex.prev = list_head;
+	obj_desc->mutex.next = list_head->mutex.next;
+
+	/* Update old first object to point back to this object */
+
+	if (list_head->mutex.next) {
+		(list_head->mutex.next)->mutex.prev = obj_desc;
+	}
+
+	/* Update list head */
+
+	list_head->mutex.next = obj_desc;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ex_acquire_mutex
+ *
+ * PARAMETERS:  *Time_desc          - The 'time to delay' object descriptor
+ *              *Obj_desc           - The object descriptor for this op
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Acquire an AML mutex
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_ex_acquire_mutex (
+	ACPI_OPERAND_OBJECT     *time_desc,
+	ACPI_OPERAND_OBJECT     *obj_desc,
+	ACPI_WALK_STATE         *walk_state)
+{
+	ACPI_STATUS             status;
+
+
+	if (!obj_desc) {
+		return (AE_BAD_PARAMETER);
+	}
+
+	/*
+	 * Current Sync must be less than or equal to the sync level of the
+	 * mutex.  This mechanism provides some deadlock prevention
+	 */
+	if (walk_state->current_sync_level > obj_desc->mutex.sync_level) {
+		return (AE_AML_MUTEX_ORDER);
+	}
+
+	/*
+	 * If the mutex is already owned by this thread,
+	 * just increment the acquisition depth
+	 */
+	if (obj_desc->mutex.owner == walk_state) {
+		obj_desc->mutex.acquisition_depth++;
+		return (AE_OK);
+	}
+
+	/* Acquire the mutex, wait if necessary */
+
+	status = acpi_ex_system_acquire_mutex (time_desc, obj_desc);
+	if (ACPI_FAILURE (status)) {
+		/* Includes failure from a timeout on Time_desc */
+
+		return (status);
+	}
+
+	/* Have the mutex, update mutex and walk info */
+
+	obj_desc->mutex.owner = walk_state;
+	obj_desc->mutex.acquisition_depth = 1;
+	walk_state->current_sync_level = obj_desc->mutex.sync_level;
+
+	/* Link the mutex to the walk state for force-unlock at method exit */
+
+	acpi_ex_link_mutex (obj_desc, (ACPI_OPERAND_OBJECT *)
+			 &(walk_state->walk_list->acquired_mutex_list));
+
+	return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ex_release_mutex
+ *
+ * PARAMETERS:  *Obj_desc           - The object descriptor for this op
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Release a previously acquired Mutex.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_ex_release_mutex (
+	ACPI_OPERAND_OBJECT     *obj_desc,
+	ACPI_WALK_STATE         *walk_state)
+{
+	ACPI_STATUS             status;
+
+
+	if (!obj_desc) {
+		return (AE_BAD_PARAMETER);
+	}
+
+	/*  The mutex must have been previously acquired in order to release it */
+
+	if (!obj_desc->mutex.owner) {
+		return (AE_AML_MUTEX_NOT_ACQUIRED);
+	}
+
+	/* The Mutex is owned, but this thread must be the owner */
+
+	if (obj_desc->mutex.owner != walk_state) {
+		return (AE_AML_NOT_OWNER);
+	}
+
+	/*
+	 * The sync level of the mutex must be less than or
+	 * equal to the current sync level
+	 */
+	if (obj_desc->mutex.sync_level > walk_state->current_sync_level) {
+		return (AE_AML_MUTEX_ORDER);
+	}
+
+	/*
+	 * Match multiple Acquires with multiple Releases
+	 */
+	obj_desc->mutex.acquisition_depth--;
+	if (obj_desc->mutex.acquisition_depth != 0) {
+		/* Just decrement the depth and return */
+
+		return (AE_OK);
+	}
+
+
+	/* Release the mutex */
+
+	status = acpi_ex_system_release_mutex (obj_desc);
+
+	/* Update the mutex and walk state */
+
+	obj_desc->mutex.owner = NULL;
+	walk_state->current_sync_level = obj_desc->mutex.sync_level;
+
+	/* Unlink the mutex from the owner's list */
+
+	acpi_ex_unlink_mutex (obj_desc);
+
+	return (status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ex_release_all_mutexes
+ *
+ * PARAMETERS:  *Mutex_list           - Head of the mutex list
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Release all mutexes in the list
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_ex_release_all_mutexes (
+	ACPI_OPERAND_OBJECT     *list_head)
+{
+	ACPI_OPERAND_OBJECT     *next = list_head->mutex.next;
+	ACPI_OPERAND_OBJECT     *this;
+
+
+	/*
+	 * Traverse the list of owned mutexes, releasing each one.
+	 */
+	while (next) {
+		this = next;
+		next = this->mutex.next;
+
+		/* Mark mutex un-owned */
+
+		this->mutex.owner = NULL;
+		this->mutex.prev = NULL;
+		this->mutex.next = NULL;
+		this->mutex.acquisition_depth = 0;
+
+		 /* Release the mutex */
+
+		acpi_ex_system_release_mutex (this);
+	}
+
+	return (AE_OK);
+}
+
+
diff -urN linux-2.4.6-pre4/drivers/acpi/executer/exnames.c linux/drivers/acpi/executer/exnames.c
--- linux-2.4.6-pre4/drivers/acpi/executer/exnames.c	Wed Dec 31 16:00:00 1969
+++ linux/drivers/acpi/executer/exnames.c	Mon Dec  3 22:48:42 2001
@@ -0,0 +1,387 @@
+
+/******************************************************************************
+ *
+ * Module Name: exnames - interpreter/scanner name load/execute
+ *              $Revision: 79 $
+ *
+ *****************************************************************************/
+
+/*
+ *  Copyright (C) 2000, 2001 R. Byron Moore
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#include "acpi.h"
+#include "acinterp.h"
+#include "amlcode.h"
+#include "acnamesp.h"
+
+#define _COMPONENT          ACPI_EXECUTER
+	 MODULE_NAME         ("exnames")
+
+
+/* AML Package Length encodings */
+
+#define ACPI_AML_PACKAGE_TYPE1   0x40
+#define ACPI_AML_PACKAGE_TYPE2   0x4000
+#define ACPI_AML_PACKAGE_TYPE3   0x400000
+#define ACPI_AML_PACKAGE_TYPE4   0x40000000
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ex_allocate_name_string
+ *
+ * PARAMETERS:  Prefix_count        - Count of parent levels. Special cases:
+ *                                    (-1) = root,  0 = none
+ *              Num_name_segs       - count of 4-character name segments
+ *
+ * RETURN:      A pointer to the allocated string segment.  This segment must
+ *              be deleted by the caller.
+ *
+ * DESCRIPTION: Allocate a buffer for a name string. Ensure allocated name
+ *              string is long enough, and set up prefix if any.
+ *
+ ******************************************************************************/
+
+NATIVE_CHAR *
+acpi_ex_allocate_name_string (
+	u32                     prefix_count,
+	u32                     num_name_segs)
+{
+	NATIVE_CHAR             *temp_ptr;
+	NATIVE_CHAR             *name_string;
+	u32                      size_needed;
+
+
+	/*
+	 * Allow room for all \ and ^ prefixes, all segments, and a Multi_name_prefix.
+	 * Also, one byte for the null terminator.
+	 * This may actually be somewhat longer than needed.
+	 */
+
+	if (prefix_count == (u32) -1) {
+		/* Special case for root */
+
+		size_needed = 1 + (ACPI_NAME_SIZE * num_name_segs) + 2 + 1;
+	}
+	else {
+		size_needed = prefix_count + (ACPI_NAME_SIZE * num_name_segs) + 2 + 1;
+	}
+
+	/*
+	 * Allocate a buffer for the name.
+	 * This buffer must be deleted by the caller!
+	 */
+
+	name_string = acpi_ut_allocate (size_needed);
+	if (!name_string) {
+		REPORT_ERROR (("Ex_allocate_name_string: name allocation failure\n"));
+		return (NULL);
+	}
+
+	temp_ptr = name_string;
+
+	/* Set up Root or Parent prefixes if needed */
+
+	if (prefix_count == (u32) -1) {
+		*temp_ptr++ = AML_ROOT_PREFIX;
+	}
+
+	else {
+		while (prefix_count--) {
+			*temp_ptr++ = AML_PARENT_PREFIX;
+		}
+	}
+
+
+	/* Set up Dual or Multi prefixes if needed */
+
+	if (num_name_segs > 2) {
+		/* Set up multi prefixes   */
+
+		*temp_ptr++ = AML_MULTI_NAME_PREFIX_OP;
+		*temp_ptr++ = (char) num_name_segs;
+	}
+
+	else if (2 == num_name_segs) {
+		/* Set up dual prefixes */
+
+		*temp_ptr++ = AML_DUAL_NAME_PREFIX;
+	}
+
+	/*
+	 * Terminate string following prefixes. Acpi_ex_name_segment() will
+	 * append the segment(s)
+	 */
+
+	*temp_ptr = 0;
+
+	return (name_string);
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ex_name_segment
+ *
+ * PARAMETERS:  Interpreter_mode    - Current running mode (load1/Load2/Exec)
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Execute a name segment (4 bytes)
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_ex_name_segment (
+	u8                      **in_aml_address,
+	NATIVE_CHAR             *name_string)
+{
+	u8                      *aml_address = *in_aml_address;
+	ACPI_STATUS             status = AE_OK;
+	u32                     index;
+	NATIVE_CHAR             char_buf[5];
+
+
+	/*
+	 * If first character is a digit, then we know that we aren't looking at a
+	 * valid name segment
+	 */
+	char_buf[0] = *aml_address;
+
+	if ('0' <= char_buf[0] && char_buf[0] <= '9') {
+		return (AE_CTRL_PENDING);
+	}
+
+	for (index = 4;
+		(index > 0) && (acpi_ut_valid_acpi_character (*aml_address));
+		--index) {
+		char_buf[4 - index] = *aml_address++;
+	}
+
+
+	/* Valid name segment  */
+
+	if (0 == index) {
+		/* Found 4 valid characters */
+
+		char_buf[4] = '\0';
+
+		if (name_string) {
+			STRCAT (name_string, char_buf);
+		}
+
+	}
+
+	else if (4 == index) {
+		/*
+		 * First character was not a valid name character,
+		 * so we are looking at something other than a name.
+		 */
+		status = AE_CTRL_PENDING;
+	}
+
+	else {
+		/* Segment started with one or more valid characters, but fewer than 4 */
+
+		status = AE_AML_BAD_NAME;
+	}
+
+	*in_aml_address = aml_address;
+	return (status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ex_get_name_string
+ *
+ * PARAMETERS:  Data_type           - Data type to be associated with this name
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Get a name, including any prefixes.
+ *
+ ******************************************************************************/
+
+
+ACPI_STATUS
+acpi_ex_get_name_string (
+	ACPI_OBJECT_TYPE8       data_type,
+	u8                      *in_aml_address,
+	NATIVE_CHAR             **out_name_string,
+	u32                     *out_name_length)
+{
+	ACPI_STATUS             status = AE_OK;
+	u8                      *aml_address = in_aml_address;
+	NATIVE_CHAR             *name_string = NULL;
+	u32                     num_segments;
+	u32                     prefix_count = 0;
+	u8                      prefix = 0;
+	u8                      has_prefix = FALSE;
+
+
+	if (INTERNAL_TYPE_REGION_FIELD == data_type  ||
+		INTERNAL_TYPE_BANK_FIELD == data_type    ||
+		INTERNAL_TYPE_INDEX_FIELD == data_type) {
+		/* Disallow prefixes for types associated with Field_unit names */
+
+		name_string = acpi_ex_allocate_name_string (0, 1);
+		if (!name_string) {
+			status = AE_NO_MEMORY;
+		}
+		else {
+			status = acpi_ex_name_segment (&aml_address, name_string);
+		}
+	}
+
+	else {
+		/*
+		 * Data_type is not a field name.
+		 * Examine first character of name for root or parent prefix operators
+		 */
+
+		switch (*aml_address) {
+
+		case AML_ROOT_PREFIX:
+
+			prefix = *aml_address++;
+			/*
+			 * Remember that we have a Root_prefix --
+			 * see comment in Acpi_ex_allocate_name_string()
+			 */
+			prefix_count = (u32) -1;
+			has_prefix = TRUE;
+			break;
+
+
+		case AML_PARENT_PREFIX:
+
+			/* Increment past possibly multiple parent prefixes */
+
+			do {
+				prefix = *aml_address++;
+				++prefix_count;
+
+			} while (*aml_address == AML_PARENT_PREFIX);
+			has_prefix = TRUE;
+			break;
+
+
+		default:
+
+			break;
+		}
+
+
+		/* Examine first character of name for name segment prefix operator */
+
+		switch (*aml_address) {
+
+		case AML_DUAL_NAME_PREFIX:
+
+			prefix = *aml_address++;
+			name_string = acpi_ex_allocate_name_string (prefix_count, 2);
+			if (!name_string) {
+				status = AE_NO_MEMORY;
+				break;
+			}
+
+			/* Indicate that we processed a prefix */
+			has_prefix = TRUE;
+
+			status = acpi_ex_name_segment (&aml_address, name_string);
+			if (ACPI_SUCCESS (status)) {
+				status = acpi_ex_name_segment (&aml_address, name_string);
+			}
+			break;
+
+
+		case AML_MULTI_NAME_PREFIX_OP:
+
+			prefix = *aml_address++;
+			/* Fetch count of segments remaining in name path */
+
+			num_segments = *aml_address++;
+
+			name_string = acpi_ex_allocate_name_string (prefix_count, num_segments);
+			if (!name_string) {
+				status = AE_NO_MEMORY;
+				break;
+			}
+
+			/* Indicate that we processed a prefix */
+			has_prefix = TRUE;
+
+			while (num_segments &&
+					(status = acpi_ex_name_segment (&aml_address, name_string)) == AE_OK) {
+				--num_segments;
+			}
+
+			break;
+
+
+		case 0:
+
+			/* Null_name valid as of 8-12-98 ASL/AML Grammar Update */
+
+
+			/* Consume the NULL byte */
+
+			aml_address++;
+			name_string = acpi_ex_allocate_name_string (prefix_count, 0);
+			if (!name_string) {
+				status = AE_NO_MEMORY;
+				break;
+			}
+
+			break;
+
+
+		default:
+
+			/* Name segment string */
+
+			name_string = acpi_ex_allocate_name_string (prefix_count, 1);
+			if (!name_string) {
+				status = AE_NO_MEMORY;
+				break;
+			}
+
+			status = acpi_ex_name_segment (&aml_address, name_string);
+			break;
+
+		}   /* Switch (Peek_op ())   */
+	}
+
+
+	if (AE_CTRL_PENDING == status && has_prefix) {
+		/* Ran out of segments after processing a prefix */
+
+		REPORT_ERROR (
+			("Ex_do_name: Malformed Name at %p\n", name_string));
+		status = AE_AML_BAD_NAME;
+	}
+
+
+	*out_name_string = name_string;
+	*out_name_length = (u32) (aml_address - in_aml_address);
+
+	return (status);
+}
+
+
diff -urN linux-2.4.6-pre4/drivers/acpi/executer/exprep.c linux/drivers/acpi/executer/exprep.c
--- linux-2.4.6-pre4/drivers/acpi/executer/exprep.c	Wed Dec 31 16:00:00 1969
+++ linux/drivers/acpi/executer/exprep.c	Mon Dec  3 22:48:42 2001
@@ -0,0 +1,459 @@
+
+/******************************************************************************
+ *
+ * Module Name: exprep - ACPI AML (p-code) execution - field prep utilities
+ *              $Revision: 90 $
+ *
+ *****************************************************************************/
+
+/*
+ *  Copyright (C) 2000, 2001 R. Byron Moore
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#include "acpi.h"
+#include "acinterp.h"
+#include "amlcode.h"
+#include "acnamesp.h"
+#include "acparser.h"
+
+
+#define _COMPONENT          ACPI_EXECUTER
+	 MODULE_NAME         ("exprep")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ex_decode_field_access_type
+ *
+ * PARAMETERS:  Access          - Encoded field access bits
+ *              Length          - Field length.
+ *
+ * RETURN:      Field granularity (8, 16, or 32)
+ *
+ * DESCRIPTION: Decode the Access_type bits of a field definition.
+ *
+ ******************************************************************************/
+
+static u32
+acpi_ex_decode_field_access_type (
+	u32                     access,
+	u16                     length)
+{
+
+	switch (access) {
+	case ACCESS_ANY_ACC:
+
+		/* Use the length to set the access type */
+
+		if (length <= 8) {
+			return (8);
+		}
+		else if (length <= 16) {
+			return (16);
+		}
+		else if (length <= 32) {
+			return (32);
+		}
+		else if (length <= 64) {
+			return (64);
+		}
+
+		/* Default is 8 (byte) */
+
+		return (8);
+		break;
+
+	case ACCESS_BYTE_ACC:
+		return (8);
+		break;
+
+	case ACCESS_WORD_ACC:
+		return (16);
+		break;
+
+	case ACCESS_DWORD_ACC:
+		return (32);
+		break;
+
+	case ACCESS_QWORD_ACC:  /* ACPI 2.0 */
+		return (64);
+		break;
+
+	default:
+		/* Invalid field access type */
+
+		return (0);
+	}
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ex_prep_common_field_object
+ *
+ * PARAMETERS:  Obj_desc            - The field object
+ *              Field_flags         - Access, Lock_rule, and Update_rule.
+ *                                    The format of a Field_flag is described
+ *                                    in the ACPI specification
+ *              Field_bit_position  - Field start position
+ *              Field_bit_length    - Field length in number of bits
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Initialize the areas of the field object that are common
+ *              to the various types of fields.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_ex_prep_common_field_object (
+	ACPI_OPERAND_OBJECT     *obj_desc,
+	u8                      field_flags,
+	u32                     field_bit_position,
+	u32                     field_bit_length)
+{
+	u32                     access_bit_width;
+	u32                     nearest_byte_address;
+
+
+	/*
+	 * Note: the structure being initialized is the
+	 * ACPI_COMMON_FIELD_INFO;  No structure fields outside of the common area
+	 * are initialized by this procedure.
+	 */
+
+	/* Demultiplex the Field_flags byte */
+
+	obj_desc->common_field.lock_rule = (u8) ((field_flags & LOCK_RULE_MASK)
+			 >> LOCK_RULE_SHIFT);
+	obj_desc->common_field.update_rule = (u8) ((field_flags & UPDATE_RULE_MASK)
+			 >> UPDATE_RULE_SHIFT);
+	/* Other misc fields */
+
+	obj_desc->common_field.bit_length = (u16) field_bit_length;
+
+	/* Decode the access type so we can compute offsets */
+
+	access_bit_width = acpi_ex_decode_field_access_type (
+			   ((field_flags & ACCESS_TYPE_MASK) >> ACCESS_TYPE_SHIFT),
+			   obj_desc->field.bit_length);
+	if (!access_bit_width) {
+		return (AE_AML_OPERAND_VALUE);
+	}
+
+	/* Setup width (access granularity) fields */
+
+	obj_desc->common_field.access_bit_width = (u8) access_bit_width;         /* 8, 16, 32, 64 */
+	obj_desc->common_field.access_byte_width = (u8) DIV_8 (access_bit_width); /* 1, 2,  4,  8 */
+
+	if (obj_desc->common.type == ACPI_TYPE_BUFFER_FIELD) {
+		/*
+		 * Buffer_field access can be on any byte boundary, so the
+		 * granularity is always 8
+		 */
+		access_bit_width = 8;
+	}
+
+
+	/*
+	 * Base_byte_offset is the address of the start of the field within the region. It is
+	 * the byte address of the first *datum* (field-width data unit) of the field.
+	 * (i.e., the first datum that contains at least the first *bit* of the field.)
+	 */
+	nearest_byte_address                      = ROUND_BITS_DOWN_TO_BYTES (field_bit_position);
+	obj_desc->common_field.base_byte_offset   = ROUND_DOWN (nearest_byte_address,
+			   DIV_8 (access_bit_width));
+
+	/*
+	 * Start_field_bit_offset is the offset of the first bit of the field within a field datum.
+	 * This is calculated as the number of bits from the Base_byte_offset. In other words,
+	 * the start of the field is relative to a byte address, regardless of the access type
+	 * of the field.
+	 */
+	obj_desc->common_field.start_field_bit_offset = (u8) (MOD_8 (field_bit_position));
+
+	/*
+	 * Datum_valid_bits is the number of valid field bits in the first field datum.
+	 */
+	obj_desc->common_field.datum_valid_bits   = (u8) (access_bit_width -
+			   obj_desc->common_field.start_field_bit_offset);
+
+	/*
+	 * Valid bits -- the number of bits that compose a partial datum,
+	 * 1) At the end of the field within the region (arbitrary starting bit offset)
+	 * 2) At the end of a buffer used to contain the field (starting offset always zero)
+	 */
+	obj_desc->common_field.end_field_valid_bits = (u8) ((obj_desc->common_field.start_field_bit_offset +
+			   field_bit_length) % access_bit_width);
+	obj_desc->common_field.end_buffer_valid_bits = (u8) (field_bit_length % access_bit_width); /* Start_buffer_bit_offset always = 0 */
+
+
+	/*
+	 * Does the entire field fit within a single field access element
+	 * (datum)?  (without crossing a datum boundary)
+	 */
+	if ((obj_desc->common_field.start_field_bit_offset + obj_desc->common_field.bit_length) <=
+		(u16) obj_desc->common_field.access_bit_width) {
+		obj_desc->common_field.access_flags |= AFIELD_SINGLE_DATUM;
+	}
+
+
+	return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ex_prep_region_field_value
+ *
+ * PARAMETERS:  Node                - Owning Node
+ *              Region_node         - Region in which field is being defined
+ *              Field_flags         - Access, Lock_rule, and Update_rule.
+ *              Field_bit_position  - Field start position
+ *              Field_bit_length    - Field length in number of bits
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Construct an ACPI_OPERAND_OBJECT  of type Def_field and
+ *              connect it to the parent Node.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_ex_prep_region_field_value (
+	ACPI_NAMESPACE_NODE     *node,
+	ACPI_HANDLE             region_node,
+	u8                      field_flags,
+	u32                     field_bit_position,
+	u32                     field_bit_length)
+{
+	ACPI_OPERAND_OBJECT     *obj_desc;
+	u32                     type;
+	ACPI_STATUS             status;
+
+
+	/* Parameter validation */
+
+	if (!region_node) {
+		return (AE_AML_NO_OPERAND);
+	}
+
+	type = acpi_ns_get_type (region_node);
+	if (type != ACPI_TYPE_REGION) {
+		return (AE_AML_OPERAND_TYPE);
+	}
+
+	/* Allocate a new object */
+
+	obj_desc = acpi_ut_create_internal_object (INTERNAL_TYPE_REGION_FIELD);
+	if (!obj_desc) {
+		return (AE_NO_MEMORY);
+	}
+
+
+	/* Obj_desc and Region valid */
+
+	/* Initialize areas of the object that are common to all fields */
+
+	status = acpi_ex_prep_common_field_object (obj_desc, field_flags,
+			  field_bit_position, field_bit_length);
+	if (ACPI_FAILURE (status)) {
+		return (status);
+	}
+
+	/* Initialize areas of the object that are specific to this field type */
+
+	obj_desc->field.region_obj = acpi_ns_get_attached_object (region_node);
+
+	/* An additional reference for the container */
+
+	acpi_ut_add_reference (obj_desc->field.region_obj);
+
+
+	/* Debug info */
+
+
+	/*
+	 * Store the constructed descriptor (Obj_desc) into the parent Node,
+	 * preserving the current type of that Named_obj.
+	 */
+	status = acpi_ns_attach_object (node, obj_desc, (u8) acpi_ns_get_type (node));
+	return (status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ex_prep_bank_field_value
+ *
+ * PARAMETERS:  Node                - Owning Node
+ *              Region_node         - Region in which field is being defined
+ *              Bank_register_node  - Bank selection register node
+ *              Bank_val            - Value to store in selection register
+ *              Field_flags         - Access, Lock_rule, and Update_rule
+ *              Field_bit_position  - Field start position
+ *              Field_bit_length    - Field length in number of bits
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Construct an object of type Bank_field and attach it to the
+ *              parent Node.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_ex_prep_bank_field_value (
+	ACPI_NAMESPACE_NODE     *node,
+	ACPI_NAMESPACE_NODE     *region_node,
+	ACPI_NAMESPACE_NODE     *bank_register_node,
+	u32                     bank_val,
+	u8                      field_flags,
+	u32                     field_bit_position,
+	u32                     field_bit_length)
+{
+	ACPI_OPERAND_OBJECT     *obj_desc;
+	u32                     type;
+	ACPI_STATUS             status;
+
+
+	/* Parameter validation */
+
+	if (!region_node) {
+		return (AE_AML_NO_OPERAND);
+	}
+
+	type = acpi_ns_get_type (region_node);
+	if (type != ACPI_TYPE_REGION) {
+		return (AE_AML_OPERAND_TYPE);
+	}
+
+	/* Allocate a new object */
+
+	obj_desc = acpi_ut_create_internal_object (INTERNAL_TYPE_BANK_FIELD);
+	if (!obj_desc) {
+		return (AE_NO_MEMORY);
+	}
+
+	/*  Obj_desc and Region valid   */
+
+	/* Initialize areas of the object that are common to all fields */
+
+	status = acpi_ex_prep_common_field_object (obj_desc, field_flags,
+			  field_bit_position, field_bit_length);
+	if (ACPI_FAILURE (status)) {
+		return (status);
+	}
+
+	/* Initialize areas of the object that are specific to this field type */
+
+	obj_desc->bank_field.value         = bank_val;
+	obj_desc->bank_field.region_obj    = acpi_ns_get_attached_object (region_node);
+	obj_desc->bank_field.bank_register_obj = acpi_ns_get_attached_object (bank_register_node);
+
+	/* An additional reference for the attached objects */
+
+	acpi_ut_add_reference (obj_desc->bank_field.region_obj);
+	acpi_ut_add_reference (obj_desc->bank_field.bank_register_obj);
+
+	/* Debug info */
+
+
+	/*
+	 * Store the constructed descriptor (Obj_desc) into the parent Node,
+	 * preserving the current type of that Named_obj.
+	 */
+	status = acpi_ns_attach_object (node, obj_desc, (u8) acpi_ns_get_type (node));
+	return (status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ex_prep_index_field_value
+ *
+ * PARAMETERS:  Node                - Owning Node
+ *              Index_reg           - Index register
+ *              Data_reg            - Data register
+ *              Field_flags         - Access, Lock_rule, and Update_rule
+ *              Field_bit_position  - Field start position
+ *              Field_bit_length    - Field length in number of bits
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Construct an ACPI_OPERAND_OBJECT  of type Index_field and
+ *              connect it to the parent Node.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_ex_prep_index_field_value (
+	ACPI_NAMESPACE_NODE     *node,
+	ACPI_NAMESPACE_NODE     *index_reg,
+	ACPI_NAMESPACE_NODE     *data_reg,
+	u8                      field_flags,
+	u32                     field_bit_position,
+	u32                     field_bit_length)
+{
+	ACPI_OPERAND_OBJECT     *obj_desc;
+	ACPI_STATUS             status;
+
+
+	/* Parameter validation */
+
+	if (!index_reg || !data_reg) {
+		return (AE_AML_NO_OPERAND);
+	}
+
+	/* Allocate a new object descriptor */
+
+	obj_desc = acpi_ut_create_internal_object (INTERNAL_TYPE_INDEX_FIELD);
+	if (!obj_desc) {
+		return (AE_NO_MEMORY);
+	}
+
+	/* Initialize areas of the object that are common to all fields */
+
+	status = acpi_ex_prep_common_field_object (obj_desc, field_flags,
+			  field_bit_position, field_bit_length);
+	if (ACPI_FAILURE (status)) {
+		return (status);
+	}
+
+	/* Initialize areas of the object that are specific to this field type */
+
+	obj_desc->index_field.data_obj = acpi_ns_get_attached_object (data_reg);
+	obj_desc->index_field.index_obj = acpi_ns_get_attached_object (index_reg);
+	obj_desc->index_field.value  = (u32) (field_bit_position /
+			  obj_desc->field.access_bit_width);
+
+	/* An additional reference for the attached objects */
+
+	acpi_ut_add_reference (obj_desc->index_field.data_obj);
+	acpi_ut_add_reference (obj_desc->index_field.index_obj);
+
+	/* Debug info */
+
+
+	/*
+	 * Store the constructed descriptor (Obj_desc) into the parent Node,
+	 * preserving the current type of that Named_obj.
+	 */
+	status = acpi_ns_attach_object (node, obj_desc, (u8) acpi_ns_get_type (node));
+	return (status);
+}
+
diff -urN linux-2.4.6-pre4/drivers/acpi/executer/exregion.c linux/drivers/acpi/executer/exregion.c
--- linux-2.4.6-pre4/drivers/acpi/executer/exregion.c	Wed Dec 31 16:00:00 1969
+++ linux/drivers/acpi/executer/exregion.c	Mon Dec  3 22:48:42 2001
@@ -0,0 +1,409 @@
+
+/******************************************************************************
+ *
+ * Module Name: exregion - ACPI default Op_region (address space) handlers
+ *              $Revision: 48 $
+ *
+ *****************************************************************************/
+
+/*
+ *  Copyright (C) 2000, 2001 R. Byron Moore
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#include "acpi.h"
+#include "acinterp.h"
+#include "amlcode.h"
+#include "acnamesp.h"
+#include "achware.h"
+#include "acevents.h"
+
+
+#define _COMPONENT          ACPI_EXECUTER
+	 MODULE_NAME         ("exregion")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ex_system_memory_space_handler
+ *
+ * PARAMETERS:  Function            - Read or Write operation
+ *              Address             - Where in the space to read or write
+ *              Bit_width           - Field width in bits (8, 16, or 32)
+ *              Value               - Pointer to in or out value
+ *              Handler_context     - Pointer to Handler's context
+ *              Region_context      - Pointer to context specific to the
+ *                                      accessed region
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Handler for the System Memory address space (Op Region)
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_ex_system_memory_space_handler (
+	u32                     function,
+	ACPI_PHYSICAL_ADDRESS   address,
+	u32                     bit_width,
+	u32                     *value,
+	void                    *handler_context,
+	void                    *region_context)
+{
+	ACPI_STATUS             status = AE_OK;
+	void                    *logical_addr_ptr = NULL;
+	ACPI_MEM_SPACE_CONTEXT  *mem_info = region_context;
+	u32                     length;
+
+
+	/* Validate and translate the bit width */
+
+	switch (bit_width) {
+	case 8:
+		length = 1;
+		break;
+
+	case 16:
+		length = 2;
+		break;
+
+	case 32:
+		length = 4;
+		break;
+
+	default:
+		return (AE_AML_OPERAND_VALUE);
+		break;
+	}
+
+
+	/*
+	 * Does the request fit into the cached memory mapping?
+	 * Is 1) Address below the current mapping? OR
+	 *    2) Address beyond the current mapping?
+	 */
+
+	if ((address < mem_info->mapped_physical_address) ||
+		(((ACPI_INTEGER) address + length) >
+			((ACPI_INTEGER) mem_info->mapped_physical_address + mem_info->mapped_length))) {
+		/*
+		 * The request cannot be resolved by the current memory mapping;
+		 * Delete the existing mapping and create a new one.
+		 */
+
+		if (mem_info->mapped_length) {
+			/* Valid mapping, delete it */
+
+			acpi_os_unmap_memory (mem_info->mapped_logical_address,
+					   mem_info->mapped_length);
+		}
+
+		mem_info->mapped_length = 0; /* In case of failure below */
+
+		/* Create a new mapping starting at the address given */
+
+		status = acpi_os_map_memory (address, SYSMEM_REGION_WINDOW_SIZE,
+				  (void **) &mem_info->mapped_logical_address);
+		if (ACPI_FAILURE (status)) {
+			return (status);
+		}
+
+		/* TBD: should these pointers go to 64-bit in all cases ? */
+
+		mem_info->mapped_physical_address = address;
+		mem_info->mapped_length = SYSMEM_REGION_WINDOW_SIZE;
+	}
+
+
+	/*
+	 * Generate a logical pointer corresponding to the address we want to
+	 * access
+	 */
+
+	/* TBD: should these pointers go to 64-bit in all cases ? */
+
+	logical_addr_ptr = mem_info->mapped_logical_address +
+			  ((ACPI_INTEGER) address - (ACPI_INTEGER) mem_info->mapped_physical_address);
+
+	/* Perform the memory read or write */
+
+	switch (function) {
+
+	case ACPI_READ_ADR_SPACE:
+
+		switch (bit_width) {
+		case 8:
+			*value = (u32)* (u8 *) logical_addr_ptr;
+			break;
+
+		case 16:
+			MOVE_UNALIGNED16_TO_32 (value, logical_addr_ptr);
+			break;
+
+		case 32:
+			MOVE_UNALIGNED32_TO_32 (value, logical_addr_ptr);
+			break;
+		}
+
+		break;
+
+
+	case ACPI_WRITE_ADR_SPACE:
+
+		switch (bit_width) {
+		case 8:
+			*(u8 *) logical_addr_ptr = (u8) *value;
+			break;
+
+		case 16:
+			MOVE_UNALIGNED16_TO_16 (logical_addr_ptr, value);
+			break;
+
+		case 32:
+			MOVE_UNALIGNED32_TO_32 (logical_addr_ptr, value);
+			break;
+		}
+
+		break;
+
+
+	default:
+		status = AE_BAD_PARAMETER;
+		break;
+	}
+
+	return (status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ex_system_io_space_handler
+ *
+ * PARAMETERS:  Function            - Read or Write operation
+ *              Address             - Where in the space to read or write
+ *              Bit_width           - Field width in bits (8, 16, or 32)
+ *              Value               - Pointer to in or out value
+ *              Handler_context     - Pointer to Handler's context
+ *              Region_context      - Pointer to context specific to the
+ *                                      accessed region
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Handler for the System IO address space (Op Region)
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_ex_system_io_space_handler (
+	u32                     function,
+	ACPI_PHYSICAL_ADDRESS   address,
+	u32                     bit_width,
+	u32                     *value,
+	void                    *handler_context,
+	void                    *region_context)
+{
+	ACPI_STATUS             status = AE_OK;
+
+
+	/* Decode the function parameter */
+
+	switch (function) {
+
+	case ACPI_READ_ADR_SPACE:
+
+		switch (bit_width) {
+		/* I/O Port width */
+
+		case 8:
+			*value = (u32) acpi_os_in8 ((ACPI_IO_ADDRESS) address);
+			break;
+
+		case 16:
+			*value = (u32) acpi_os_in16 ((ACPI_IO_ADDRESS) address);
+			break;
+
+		case 32:
+			*value = acpi_os_in32 ((ACPI_IO_ADDRESS) address);
+			break;
+
+		default:
+			status = AE_AML_OPERAND_VALUE;
+		}
+
+		break;
+
+
+	case ACPI_WRITE_ADR_SPACE:
+
+		switch (bit_width) {
+		/* I/O Port width */
+		case 8:
+			acpi_os_out8 ((ACPI_IO_ADDRESS) address, (u8) *value);
+			break;
+
+		case 16:
+			acpi_os_out16 ((ACPI_IO_ADDRESS) address, (u16) *value);
+			break;
+
+		case 32:
+			acpi_os_out32 ((ACPI_IO_ADDRESS) address, *value);
+			break;
+
+		default:
+			status = AE_AML_OPERAND_VALUE;
+		}
+
+		break;
+
+
+	default:
+		status = AE_BAD_PARAMETER;
+		break;
+	}
+
+	return (status);
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ex_pci_config_space_handler
+ *
+ * PARAMETERS:  Function            - Read or Write operation
+ *              Address             - Where in the space to read or write
+ *              Bit_width           - Field width in bits (8, 16, or 32)
+ *              Value               - Pointer to in or out value
+ *              Handler_context     - Pointer to Handler's context
+ *              Region_context      - Pointer to context specific to the
+ *                                      accessed region
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Handler for the PCI Config address space (Op Region)
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_ex_pci_config_space_handler (
+	u32                     function,
+	ACPI_PHYSICAL_ADDRESS   address,
+	u32                     bit_width,
+	u32                     *value,
+	void                    *handler_context,
+	void                    *region_context)
+{
+	ACPI_STATUS             status = AE_OK;
+	u32                     pci_bus;
+	u32                     dev_func;
+	u8                      pci_reg;
+	ACPI_PCI_SPACE_CONTEXT  *PCIcontext;
+
+
+	/*
+	 *  The arguments to Acpi_os(Read|Write)Pci_cfg(Byte|Word|Dword) are:
+	 *
+	 *  Seg_bus - 0xSSSSBBBB    - SSSS is the PCI bus segment
+	 *                            BBBB is the PCI bus number
+	 *
+	 *  Dev_func - 0xDDDDFFFF   - DDDD is the PCI device number
+	 *                            FFFF is the PCI device function number
+	 *
+	 *  Reg_num - Config space register must be < 40h
+	 *
+	 *  Value - input value for write, output for read
+	 *
+	 */
+
+	PCIcontext = (ACPI_PCI_SPACE_CONTEXT *) region_context;
+
+	pci_bus = LOWORD (PCIcontext->seg) << 16;
+	pci_bus |= LOWORD (PCIcontext->bus);
+
+	dev_func = PCIcontext->dev_func;
+
+	pci_reg = (u8) address;
+
+	switch (function) {
+
+	case ACPI_READ_ADR_SPACE:
+
+		*value  = 0;
+
+		switch (bit_width) {
+		/* PCI Register width */
+
+		case 8:
+			status = acpi_os_read_pci_cfg_byte (pci_bus, dev_func, pci_reg,
+					   (u8 *) value);
+			break;
+
+		case 16:
+			status = acpi_os_read_pci_cfg_word (pci_bus, dev_func, pci_reg,
+					   (u16 *) value);
+			break;
+
+		case 32:
+			status = acpi_os_read_pci_cfg_dword (pci_bus, dev_func, pci_reg,
+					   value);
+			break;
+
+		default:
+			status = AE_AML_OPERAND_VALUE;
+
+		} /* Switch bit_width */
+
+		break;
+
+
+	case ACPI_WRITE_ADR_SPACE:
+
+		switch (bit_width) {
+		/* PCI Register width */
+
+		case 8:
+			status = acpi_os_write_pci_cfg_byte (pci_bus, dev_func, pci_reg,
+					 *(u8 *) value);
+			break;
+
+		case 16:
+			status = acpi_os_write_pci_cfg_word (pci_bus, dev_func, pci_reg,
+					 *(u16 *) value);
+			break;
+
+		case 32:
+			status = acpi_os_write_pci_cfg_dword (pci_bus, dev_func, pci_reg,
+					 *value);
+			break;
+
+		default:
+			status = AE_AML_OPERAND_VALUE;
+
+		} /* Switch bit_width */
+
+		break;
+
+
+	default:
+
+		status = AE_BAD_PARAMETER;
+		break;
+
+	}
+
+	return (status);
+}
+
diff -urN linux-2.4.6-pre4/drivers/acpi/executer/exresnte.c linux/drivers/acpi/executer/exresnte.c
--- linux-2.4.6-pre4/drivers/acpi/executer/exresnte.c	Wed Dec 31 16:00:00 1969
+++ linux/drivers/acpi/executer/exresnte.c	Mon Dec  3 22:48:42 2001
@@ -0,0 +1,320 @@
+
+/******************************************************************************
+ *
+ * Module Name: exresnte - AML Interpreter object resolution
+ *              $Revision: 37 $
+ *
+ *****************************************************************************/
+
+/*
+ *  Copyright (C) 2000, 2001 R. Byron Moore
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#include "acpi.h"
+#include "amlcode.h"
+#include "acparser.h"
+#include "acdispat.h"
+#include "acinterp.h"
+#include "acnamesp.h"
+#include "actables.h"
+#include "acevents.h"
+
+
+#define _COMPONENT          ACPI_EXECUTER
+	 MODULE_NAME         ("exresnte")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ex_resolve_node_to_value
+ *
+ * PARAMETERS:  Stack_ptr       - Pointer to a location on a stack that contains
+ *                                a pointer to a Node
+ *              Walk_state      - Current state
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Resolve a Namespace node (AKA a "direct name pointer") to
+ *              a valued object
+ *
+ * Note: for some of the data types, the pointer attached to the Node
+ * can be either a pointer to an actual internal object or a pointer into the
+ * AML stream itself.  These types are currently:
+ *
+ *      ACPI_TYPE_INTEGER
+ *      ACPI_TYPE_STRING
+ *      ACPI_TYPE_BUFFER
+ *      ACPI_TYPE_MUTEX
+ *      ACPI_TYPE_PACKAGE
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_ex_resolve_node_to_value (
+	ACPI_NAMESPACE_NODE     **stack_ptr,
+	ACPI_WALK_STATE         *walk_state)
+
+{
+	ACPI_STATUS             status = AE_OK;
+	ACPI_OPERAND_OBJECT     *val_desc;
+	ACPI_OPERAND_OBJECT     *obj_desc = NULL;
+	ACPI_NAMESPACE_NODE     *node;
+	u8                      *aml_pointer = NULL;
+	ACPI_OBJECT_TYPE8       entry_type;
+	ACPI_INTEGER            temp_val;
+	u8                      attached_aml_pointer = FALSE;
+	u8                      aml_opcode = 0;
+
+
+	/*
+	 * The stack pointer points to a ACPI_NAMESPACE_NODE (Node).  Get the
+	 * object that is attached to the Node.
+	 */
+
+	node      = *stack_ptr;
+	val_desc  = acpi_ns_get_attached_object (node);
+	entry_type = acpi_ns_get_type ((ACPI_HANDLE) node);
+
+	/*
+	 * The Val_desc attached to the Node can be either:
+	 * 1) An internal ACPI object
+	 * 2) A pointer into the AML stream (into one of the ACPI system tables)
+	 */
+
+	if (acpi_tb_system_table_pointer (val_desc)) {
+		/* CAN THIS EVERY HAPPEN NOW?  TBD!!! */
+
+		attached_aml_pointer = TRUE;
+		aml_opcode = *((u8 *) val_desc);
+		aml_pointer = ((u8 *) val_desc) + 1;
+
+	}
+
+
+	/*
+	 * Several Entry_types do not require further processing, so
+	 *  we will return immediately
+	 */
+	/* Devices rarely have an attached object, return the Node
+	 *  and Method locals and arguments have a pseudo-Node
+	 */
+	if (entry_type == ACPI_TYPE_DEVICE ||
+		(node->flags & (ANOBJ_METHOD_ARG | ANOBJ_METHOD_LOCAL))) {
+		return (AE_OK);
+	}
+
+	if (!val_desc) {
+		return (AE_AML_NO_OPERAND);
+	}
+
+	/*
+	 * Action is based on the type of the Node, which indicates the type
+	 * of the attached object or pointer
+	 */
+	switch (entry_type) {
+
+	case ACPI_TYPE_PACKAGE:
+
+		if (attached_aml_pointer) {
+			/*
+			 * This means that the package initialization is not parsed
+			 * -- should not happen
+			 */
+			return (AE_NOT_IMPLEMENTED);
+		}
+
+		/* Val_desc is an internal object in all cases by the time we get here */
+
+		if (ACPI_TYPE_PACKAGE != val_desc->common.type) {
+			return (AE_AML_OPERAND_TYPE);
+		}
+
+		/* Return an additional reference to the object */
+
+		obj_desc = val_desc;
+		acpi_ut_add_reference (obj_desc);
+		break;
+
+
+	case ACPI_TYPE_BUFFER:
+
+		if (attached_aml_pointer) {
+			/*
+			 * This means that the buffer initialization is not parsed
+			 * -- should not happen
+			 */
+			return (AE_NOT_IMPLEMENTED);
+		}
+
+		/* Val_desc is an internal object in all cases by the time we get here */
+
+		if (ACPI_TYPE_BUFFER != val_desc->common.type) {
+			return (AE_AML_OPERAND_TYPE);
+		}
+
+		/* Return an additional reference to the object */
+
+		obj_desc = val_desc;
+		acpi_ut_add_reference (obj_desc);
+		break;
+
+
+	case ACPI_TYPE_STRING:
+
+		if (attached_aml_pointer) {
+			/* Allocate a new string object */
+
+			obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_STRING);
+			if (!obj_desc) {
+				return (AE_NO_MEMORY);
+			}
+
+			/* Init the internal object */
+
+			obj_desc->string.pointer = (NATIVE_CHAR *) aml_pointer;
+			obj_desc->string.length = STRLEN (obj_desc->string.pointer);
+		}
+
+		else {
+			if (ACPI_TYPE_STRING != val_desc->common.type) {
+				return (AE_AML_OPERAND_TYPE);
+			}
+
+			/* Return an additional reference to the object */
+
+			obj_desc = val_desc;
+			acpi_ut_add_reference (obj_desc);
+		}
+
+		break;
+
+
+	case ACPI_TYPE_INTEGER:
+
+		/*
+		 * The Node has an attached internal object, make sure that it's a
+		 * number
+		 */
+
+		if (ACPI_TYPE_INTEGER != val_desc->common.type) {
+			return (AE_AML_OPERAND_TYPE);
+		}
+
+		/* Return an additional reference to the object */
+
+		obj_desc = val_desc;
+		acpi_ut_add_reference (obj_desc);
+		break;
+
+
+	case ACPI_TYPE_BUFFER_FIELD:
+	case INTERNAL_TYPE_REGION_FIELD:
+	case INTERNAL_TYPE_BANK_FIELD:
+	case INTERNAL_TYPE_INDEX_FIELD:
+
+		status = acpi_ex_read_data_from_field (val_desc, &obj_desc);
+		break;
+
+
+	/*
+	 * For these objects, just return the object attached to the Node
+	 */
+
+	case ACPI_TYPE_MUTEX:
+	case ACPI_TYPE_METHOD:
+	case ACPI_TYPE_POWER:
+	case ACPI_TYPE_PROCESSOR:
+	case ACPI_TYPE_THERMAL:
+	case ACPI_TYPE_EVENT:
+	case ACPI_TYPE_REGION:
+
+
+		/* Return an additional reference to the object */
+
+		obj_desc = val_desc;
+		acpi_ut_add_reference (obj_desc);
+		break;
+
+
+	/* TYPE_Any is untyped, and thus there is no object associated with it */
+
+	case ACPI_TYPE_ANY:
+
+		return (AE_AML_OPERAND_TYPE);  /* Cannot be AE_TYPE */
+		break;
+
+
+	/*
+	 * The only named references allowed are named constants
+	 *   e.g. -- Name (\OSFL, Ones)
+	 */
+	case INTERNAL_TYPE_REFERENCE:
+
+		switch (val_desc->reference.opcode) {
+
+		case AML_ZERO_OP:
+
+			temp_val = 0;
+			break;
+
+		case AML_ONE_OP:
+
+			temp_val = 1;
+			break;
+
+		case AML_ONES_OP:
+
+			temp_val = ACPI_INTEGER_MAX;
+			break;
+
+		default:
+
+			return (AE_AML_BAD_OPCODE);
+		}
+
+		/* Create object for result */
+
+		obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
+		if (!obj_desc) {
+			return (AE_NO_MEMORY);
+		}
+
+		obj_desc->integer.value = temp_val;
+
+		/* Truncate value if we are executing from a 32-bit ACPI table */
+
+		acpi_ex_truncate_for32bit_table (obj_desc, walk_state);
+		break;
+
+
+	/* Default case is for unknown types */
+
+	default:
+
+		return (AE_AML_OPERAND_TYPE);
+
+	} /* switch (Entry_type) */
+
+
+	/* Put the object descriptor on the stack */
+
+	*stack_ptr = (void *) obj_desc;
+	return (status);
+}
+
+
diff -urN linux-2.4.6-pre4/drivers/acpi/executer/exresolv.c linux/drivers/acpi/executer/exresolv.c
--- linux-2.4.6-pre4/drivers/acpi/executer/exresolv.c	Wed Dec 31 16:00:00 1969
+++ linux/drivers/acpi/executer/exresolv.c	Mon Dec  3 22:48:42 2001
@@ -0,0 +1,401 @@
+
+/******************************************************************************
+ *
+ * Module Name: exresolv - AML Interpreter object resolution
+ *              $Revision: 95 $
+ *
+ *****************************************************************************/
+
+/*
+ *  Copyright (C) 2000, 2001 R. Byron Moore
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#include "acpi.h"
+#include "amlcode.h"
+#include "acparser.h"
+#include "acdispat.h"
+#include "acinterp.h"
+#include "acnamesp.h"
+#include "actables.h"
+#include "acevents.h"
+
+
+#define _COMPONENT          ACPI_EXECUTER
+	 MODULE_NAME         ("exresolv")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ex_get_buffer_field_value
+ *
+ * PARAMETERS:  *Obj_desc           - Pointer to a Buffer_field
+ *              *Result_desc        - Pointer to an empty descriptor which will
+ *                                    become an Integer with the field's value
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Retrieve the value from a Buffer_field
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_ex_get_buffer_field_value (
+	ACPI_OPERAND_OBJECT     *obj_desc,
+	ACPI_OPERAND_OBJECT     *result_desc)
+{
+	ACPI_STATUS             status;
+	u32                     mask;
+	u8                      *location;
+
+
+	/*
+	 * Parameter validation
+	 */
+	if (!obj_desc) {
+		return (AE_AML_NO_OPERAND);
+	}
+
+	if (!(obj_desc->common.flags & AOPOBJ_DATA_VALID)) {
+		status = acpi_ds_get_buffer_field_arguments (obj_desc);
+		if (ACPI_FAILURE (status)) {
+			return (status);
+		}
+	}
+
+	if (!obj_desc->buffer_field.buffer_obj) {
+		return (AE_AML_INTERNAL);
+	}
+
+	if (ACPI_TYPE_BUFFER != obj_desc->buffer_field.buffer_obj->common.type) {
+		return (AE_AML_OPERAND_TYPE);
+	}
+
+	if (!result_desc) {
+		return (AE_AML_INTERNAL);
+	}
+
+
+	/* Field location is (base of buffer) + (byte offset) */
+
+	location = obj_desc->buffer_field.buffer_obj->buffer.pointer
+			 + obj_desc->buffer_field.base_byte_offset;
+
+	/*
+	 * Construct Mask with as many 1 bits as the field width
+	 *
+	 * NOTE: Only the bottom 5 bits are valid for a shift operation, so
+	 *  special care must be taken for any shift greater than 31 bits.
+	 *
+	 * TBD: [Unhandled] Fields greater than 32 bits will not work.
+	 */
+	if (obj_desc->buffer_field.bit_length < 32) {
+		mask = ((u32) 1 << obj_desc->buffer_field.bit_length) - (u32) 1;
+	}
+	else {
+		mask = ACPI_UINT32_MAX;
+	}
+
+	result_desc->integer.type = (u8) ACPI_TYPE_INTEGER;
+
+	/* Get the 32 bit value at the location */
+
+	MOVE_UNALIGNED32_TO_32 (&result_desc->integer.value, location);
+
+	/*
+	 * Shift the 32-bit word containing the field, and mask off the
+	 * resulting value
+	 */
+	result_desc->integer.value =
+		(result_desc->integer.value >> obj_desc->buffer_field.start_field_bit_offset) & mask;
+
+	return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ex_resolve_to_value
+ *
+ * PARAMETERS:  **Stack_ptr         - Points to entry on Obj_stack, which can
+ *                                    be either an (ACPI_OPERAND_OBJECT *)
+ *                                    or an ACPI_HANDLE.
+ *              Walk_state          - Current method state
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Convert Reference objects to values
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_ex_resolve_to_value (
+	ACPI_OPERAND_OBJECT     **stack_ptr,
+	ACPI_WALK_STATE         *walk_state)
+{
+	ACPI_STATUS             status;
+
+
+	if (!stack_ptr || !*stack_ptr) {
+		return (AE_AML_NO_OPERAND);
+	}
+
+
+	/*
+	 * The entity pointed to by the Stack_ptr can be either
+	 * 1) A valid ACPI_OPERAND_OBJECT, or
+	 * 2) A ACPI_NAMESPACE_NODE (Named_obj)
+	 */
+	if (VALID_DESCRIPTOR_TYPE (*stack_ptr, ACPI_DESC_TYPE_INTERNAL)) {
+		status = acpi_ex_resolve_object_to_value (stack_ptr, walk_state);
+		if (ACPI_FAILURE (status)) {
+			return (status);
+		}
+	}
+
+	/*
+	 * Object on the stack may have changed if Acpi_ex_resolve_object_to_value()
+	 * was called (i.e., we can't use an _else_ here.)
+	 */
+	if (VALID_DESCRIPTOR_TYPE (*stack_ptr, ACPI_DESC_TYPE_NAMED)) {
+		status = acpi_ex_resolve_node_to_value ((ACPI_NAMESPACE_NODE **) stack_ptr,
+				  walk_state);
+		if (ACPI_FAILURE (status)) {
+			return (status);
+		}
+	}
+
+
+	return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ex_resolve_object_to_value
+ *
+ * PARAMETERS:  Stack_ptr       - Pointer to a stack location that contains a
+ *                                ptr to an internal object.
+ *              Walk_state      - Current method state
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Retrieve the value from an internal object.  The Reference type
+ *              uses the associated AML opcode to determine the value.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_ex_resolve_object_to_value (
+	ACPI_OPERAND_OBJECT     **stack_ptr,
+	ACPI_WALK_STATE         *walk_state)
+{
+	ACPI_STATUS             status = AE_OK;
+	ACPI_OPERAND_OBJECT     *stack_desc;
+	void                    *temp_node;
+	ACPI_OPERAND_OBJECT     *obj_desc;
+	u16                     opcode;
+
+
+	stack_desc = *stack_ptr;
+
+	/* This is an ACPI_OPERAND_OBJECT  */
+
+	switch (stack_desc->common.type) {
+
+	case INTERNAL_TYPE_REFERENCE:
+
+		opcode = stack_desc->reference.opcode;
+
+		switch (opcode) {
+
+		case AML_NAME_OP:
+
+			/*
+			 * Convert indirect name ptr to a direct name ptr.
+			 * Then, Acpi_ex_resolve_node_to_value can be used to get the value
+			 */
+			temp_node = stack_desc->reference.object;
+
+			/* Delete the Reference Object */
+
+			acpi_ut_remove_reference (stack_desc);
+
+			/* Put direct name pointer onto stack and exit */
+
+			(*stack_ptr) = temp_node;
+			break;
+
+
+		case AML_LOCAL_OP:
+		case AML_ARG_OP:
+
+			/*
+			 * Get the local from the method's state info
+			 * Note: this increments the local's object reference count
+			 */
+			status = acpi_ds_method_data_get_value (opcode,
+					  stack_desc->reference.offset, walk_state, &obj_desc);
+			if (ACPI_FAILURE (status)) {
+				return (status);
+			}
+
+			/*
+			 * Now we can delete the original Reference Object and
+			 * replace it with the resolve value
+			 */
+			acpi_ut_remove_reference (stack_desc);
+			*stack_ptr = obj_desc;
+
+			break;
+
+
+		/*
+		 * TBD: [Restructure] These next three opcodes change the type of
+		 * the object, which is actually a no-no.
+		 */
+		case AML_ZERO_OP:
+
+			stack_desc->common.type = (u8) ACPI_TYPE_INTEGER;
+			stack_desc->integer.value = 0;
+			break;
+
+
+		case AML_ONE_OP:
+
+			stack_desc->common.type = (u8) ACPI_TYPE_INTEGER;
+			stack_desc->integer.value = 1;
+			break;
+
+
+		case AML_ONES_OP:
+
+			stack_desc->common.type = (u8) ACPI_TYPE_INTEGER;
+			stack_desc->integer.value = ACPI_INTEGER_MAX;
+
+			/* Truncate value if we are executing from a 32-bit ACPI table */
+
+			acpi_ex_truncate_for32bit_table (stack_desc, walk_state);
+			break;
+
+
+		case AML_INDEX_OP:
+
+			switch (stack_desc->reference.target_type) {
+			case ACPI_TYPE_BUFFER_FIELD:
+
+				/* Just return - leave the Reference on the stack */
+				break;
+
+
+			case ACPI_TYPE_PACKAGE:
+				obj_desc = *stack_desc->reference.where;
+				if (obj_desc) {
+					/*
+					 * Valid obj descriptor, copy pointer to return value
+					 * (i.e., dereference the package index)
+					 * Delete the ref object, increment the returned object
+					 */
+					acpi_ut_remove_reference (stack_desc);
+					acpi_ut_add_reference (obj_desc);
+					*stack_ptr = obj_desc;
+				}
+
+				else {
+					/*
+					 * A NULL object descriptor means an unitialized element of
+					 * the package, can't dereference it
+					 */
+					status = AE_AML_UNINITIALIZED_ELEMENT;
+				}
+				break;
+
+			default:
+				/* Invalid reference object */
+
+				status = AE_AML_INTERNAL;
+				break;
+			}
+
+			break;
+
+
+		case AML_DEBUG_OP:
+
+			/* Just leave the object as-is */
+			break;
+
+
+		default:
+
+			status = AE_AML_INTERNAL;
+			break;
+
+		}   /* switch (Opcode) */
+
+		break; /* case INTERNAL_TYPE_REFERENCE */
+
+
+	case ACPI_TYPE_BUFFER_FIELD:
+
+		obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_ANY);
+		if (!obj_desc) {
+			return (AE_NO_MEMORY);
+		}
+
+		status = acpi_ex_get_buffer_field_value (stack_desc, obj_desc);
+		if (ACPI_FAILURE (status)) {
+			acpi_ut_remove_reference (obj_desc);
+			obj_desc = NULL;
+		}
+
+		*stack_ptr = (void *) obj_desc;
+		break;
+
+
+	case INTERNAL_TYPE_BANK_FIELD:
+
+		obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_ANY);
+		if (!obj_desc) {
+			return (AE_NO_MEMORY);
+		}
+
+		/* TBD: WRONG! */
+
+		status = acpi_ex_get_buffer_field_value (stack_desc, obj_desc);
+		if (ACPI_FAILURE (status)) {
+			acpi_ut_remove_reference (obj_desc);
+			obj_desc = NULL;
+		}
+
+		*stack_ptr = (void *) obj_desc;
+		break;
+
+
+	/* TBD: [Future] - may need to handle Index_field, and Def_field someday */
+
+	default:
+
+		break;
+
+	}   /* switch (Stack_desc->Common.Type) */
+
+
+	return (status);
+}
+
+
diff -urN linux-2.4.6-pre4/drivers/acpi/executer/exresop.c linux/drivers/acpi/executer/exresop.c
--- linux-2.4.6-pre4/drivers/acpi/executer/exresop.c	Wed Dec 31 16:00:00 1969
+++ linux/drivers/acpi/executer/exresop.c	Mon Dec  3 22:48:42 2001
@@ -0,0 +1,480 @@
+
+/******************************************************************************
+ *
+ * Module Name: exresop - AML Interpreter operand/object resolution
+ *              $Revision: 29 $
+ *
+ *****************************************************************************/
+
+/*
+ *  Copyright (C) 2000, 2001 R. Byron Moore
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#include "acpi.h"
+#include "amlcode.h"
+#include "acparser.h"
+#include "acdispat.h"
+#include "acinterp.h"
+#include "acnamesp.h"
+#include "actables.h"
+#include "acevents.h"
+
+
+#define _COMPONENT          ACPI_EXECUTER
+	 MODULE_NAME         ("exresop")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ex_check_object_type
+ *
+ * PARAMETERS:  Type_needed         Object type needed
+ *              This_type           Actual object type
+ *              Object              Object pointer
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Check required type against actual type
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_ex_check_object_type (
+	ACPI_OBJECT_TYPE        type_needed,
+	ACPI_OBJECT_TYPE        this_type,
+	void                    *object)
+{
+
+
+	if (type_needed == ACPI_TYPE_ANY) {
+		/* All types OK, so we don't perform any typechecks */
+
+		return (AE_OK);
+	}
+
+	if (type_needed != this_type) {
+		return (AE_AML_OPERAND_TYPE);
+	}
+
+	return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ex_resolve_operands
+ *
+ * PARAMETERS:  Opcode              Opcode being interpreted
+ *              Stack_ptr           Top of operand stack
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Convert stack entries to required types
+ *
+ *      Each nibble in Arg_types represents one required operand
+ *      and indicates the required Type:
+ *
+ *      The corresponding stack entry will be converted to the
+ *      required type if possible, else return an exception
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_ex_resolve_operands (
+	u16                     opcode,
+	ACPI_OPERAND_OBJECT     **stack_ptr,
+	ACPI_WALK_STATE         *walk_state)
+{
+	ACPI_OPERAND_OBJECT     *obj_desc;
+	ACPI_STATUS             status = AE_OK;
+	u8                      object_type;
+	void                    *temp_node;
+	u32                     arg_types;
+	ACPI_OPCODE_INFO        *op_info;
+	u32                     this_arg_type;
+	ACPI_OBJECT_TYPE        type_needed;
+
+
+	op_info = acpi_ps_get_opcode_info (opcode);
+	if (ACPI_GET_OP_TYPE (op_info) != ACPI_OP_TYPE_OPCODE) {
+		return (AE_AML_BAD_OPCODE);
+	}
+
+
+	arg_types = op_info->runtime_args;
+	if (arg_types == ARGI_INVALID_OPCODE) {
+		return (AE_AML_INTERNAL);
+	}
+
+
+	/*
+	 * Normal exit is with (Arg_types == 0) at end of argument list.
+	 * Function will return an exception from within the loop upon
+	 * finding an entry which is not (or cannot be converted
+	 * to) the required type; if stack underflows; or upon
+	 * finding a NULL stack entry (which should not happen).
+	 */
+
+	while (GET_CURRENT_ARG_TYPE (arg_types)) {
+		if (!stack_ptr || !*stack_ptr) {
+			return (AE_AML_INTERNAL);
+		}
+
+		/* Extract useful items */
+
+		obj_desc = *stack_ptr;
+
+		/* Decode the descriptor type */
+
+		if (VALID_DESCRIPTOR_TYPE (obj_desc, ACPI_DESC_TYPE_NAMED)) {
+			/* Node */
+
+			object_type = ((ACPI_NAMESPACE_NODE *) obj_desc)->type;
+		}
+
+		else if (VALID_DESCRIPTOR_TYPE (obj_desc, ACPI_DESC_TYPE_INTERNAL)) {
+			/* ACPI internal object */
+
+			object_type = obj_desc->common.type;
+
+			/* Check for bad ACPI_OBJECT_TYPE */
+
+			if (!acpi_ex_validate_object_type (object_type)) {
+				return (AE_AML_OPERAND_TYPE);
+			}
+
+			if (object_type == (u8) INTERNAL_TYPE_REFERENCE) {
+				/*
+				 * Decode the Reference
+				 */
+
+				op_info = acpi_ps_get_opcode_info (opcode);
+				if (ACPI_GET_OP_TYPE (op_info) != ACPI_OP_TYPE_OPCODE) {
+					return (AE_AML_BAD_OPCODE);
+				}
+
+
+				switch (obj_desc->reference.opcode) {
+				case AML_ZERO_OP:
+				case AML_ONE_OP:
+				case AML_ONES_OP:
+				case AML_DEBUG_OP:
+				case AML_NAME_OP:
+				case AML_INDEX_OP:
+				case AML_ARG_OP:
+				case AML_LOCAL_OP:
+
+					break;
+
+				default:
+					return (AE_AML_OPERAND_TYPE);
+					break;
+				}
+			}
+		}
+
+		else {
+			/* Invalid descriptor */
+
+			return (AE_AML_OPERAND_TYPE);
+		}
+
+
+		/*
+		 * Get one argument type, point to the next
+		 */
+
+		this_arg_type = GET_CURRENT_ARG_TYPE (arg_types);
+		INCREMENT_ARG_LIST (arg_types);
+
+
+		/*
+		 * Handle cases where the object does not need to be
+		 * resolved to a value
+		 */
+
+		switch (this_arg_type) {
+
+		case ARGI_REFERENCE:            /* References */
+		case ARGI_INTEGER_REF:
+		case ARGI_OBJECT_REF:
+		case ARGI_DEVICE_REF:
+		case ARGI_TARGETREF:            /* TBD: must implement implicit conversion rules before store */
+		case ARGI_FIXED_TARGET:         /* No implicit conversion before store to target */
+		case ARGI_SIMPLE_TARGET:        /* Name, Local, or Arg - no implicit conversion */
+
+			/* Need an operand of type INTERNAL_TYPE_REFERENCE */
+
+			if (VALID_DESCRIPTOR_TYPE (obj_desc, ACPI_DESC_TYPE_NAMED))            /* direct name ptr OK as-is */ {
+				goto next_operand;
+			}
+
+			status = acpi_ex_check_object_type (INTERNAL_TYPE_REFERENCE,
+					  object_type, obj_desc);
+			if (ACPI_FAILURE (status)) {
+				return (status);
+			}
+
+
+			if (AML_NAME_OP == obj_desc->reference.opcode) {
+				/*
+				 * Convert an indirect name ptr to direct name ptr and put
+				 * it on the stack
+				 */
+
+				temp_node = obj_desc->reference.object;
+				acpi_ut_remove_reference (obj_desc);
+				(*stack_ptr) = temp_node;
+			}
+
+			goto next_operand;
+			break;
+
+
+		case ARGI_ANYTYPE:
+
+			/*
+			 * We don't want to resolve Index_op reference objects during
+			 * a store because this would be an implicit De_ref_of operation.
+			 * Instead, we just want to store the reference object.
+			 * -- All others must be resolved below.
+			 */
+
+			if ((opcode == AML_STORE_OP) &&
+				((*stack_ptr)->common.type == INTERNAL_TYPE_REFERENCE) &&
+				((*stack_ptr)->reference.opcode == AML_INDEX_OP)) {
+				goto next_operand;
+			}
+			break;
+		}
+
+
+		/*
+		 * Resolve this object to a value
+		 */
+
+		status = acpi_ex_resolve_to_value (stack_ptr, walk_state);
+		if (ACPI_FAILURE (status)) {
+			return (status);
+		}
+
+
+		/*
+		 * Check the resulting object (value) type
+		 */
+		switch (this_arg_type) {
+		/*
+		 * For the simple cases, only one type of resolved object
+		 * is allowed
+		 */
+		case ARGI_MUTEX:
+
+			/* Need an operand of type ACPI_TYPE_MUTEX */
+
+			type_needed = ACPI_TYPE_MUTEX;
+			break;
+
+		case ARGI_EVENT:
+
+			/* Need an operand of type ACPI_TYPE_EVENT */
+
+			type_needed = ACPI_TYPE_EVENT;
+			break;
+
+		case ARGI_REGION:
+
+			/* Need an operand of type ACPI_TYPE_REGION */
+
+			type_needed = ACPI_TYPE_REGION;
+			break;
+
+		case ARGI_IF:   /* If */
+
+			/* Need an operand of type INTERNAL_TYPE_IF */
+
+			type_needed = INTERNAL_TYPE_IF;
+			break;
+
+		case ARGI_PACKAGE:   /* Package */
+
+			/* Need an operand of type ACPI_TYPE_PACKAGE */
+
+			type_needed = ACPI_TYPE_PACKAGE;
+			break;
+
+		case ARGI_ANYTYPE:
+
+			/* Any operand type will do */
+
+			type_needed = ACPI_TYPE_ANY;
+			break;
+
+
+		/*
+		 * The more complex cases allow multiple resolved object types
+		 */
+
+		case ARGI_INTEGER:   /* Number */
+
+			/*
+			 * Need an operand of type ACPI_TYPE_INTEGER,
+			 * But we can implicitly convert from a STRING or BUFFER
+			 */
+			status = acpi_ex_convert_to_integer (stack_ptr, walk_state);
+			if (ACPI_FAILURE (status)) {
+				if (status == AE_TYPE) {
+					return (AE_AML_OPERAND_TYPE);
+				}
+
+				return (status);
+			}
+
+			goto next_operand;
+			break;
+
+
+		case ARGI_BUFFER:
+
+			/*
+			 * Need an operand of type ACPI_TYPE_BUFFER,
+			 * But we can implicitly convert from a STRING or INTEGER
+			 */
+			status = acpi_ex_convert_to_buffer (stack_ptr, walk_state);
+			if (ACPI_FAILURE (status)) {
+				if (status == AE_TYPE) {
+					return (AE_AML_OPERAND_TYPE);
+				}
+
+				return (status);
+			}
+
+			goto next_operand;
+			break;
+
+
+		case ARGI_STRING:
+
+			/*
+			 * Need an operand of type ACPI_TYPE_STRING,
+			 * But we can implicitly convert from a BUFFER or INTEGER
+			 */
+			status = acpi_ex_convert_to_string (stack_ptr, walk_state);
+			if (ACPI_FAILURE (status)) {
+				if (status == AE_TYPE) {
+					return (AE_AML_OPERAND_TYPE);
+				}
+
+				return (status);
+			}
+
+			goto next_operand;
+			break;
+
+
+		case ARGI_COMPUTEDATA:
+
+			/* Need an operand of type INTEGER, STRING or BUFFER */
+
+			if ((ACPI_TYPE_INTEGER != (*stack_ptr)->common.type) &&
+				(ACPI_TYPE_STRING != (*stack_ptr)->common.type) &&
+				(ACPI_TYPE_BUFFER != (*stack_ptr)->common.type)) {
+				return (AE_AML_OPERAND_TYPE);
+			}
+			goto next_operand;
+			break;
+
+
+		case ARGI_DATAOBJECT:
+			/*
+			 * ARGI_DATAOBJECT is only used by the Size_of operator.
+			 *
+			 * The ACPI specification allows Size_of to return the size of
+			 *  a Buffer, String or Package.  However, the MS ACPI.SYS AML
+			 *  Interpreter also allows an Node reference to return without
+			 *  error with a size of 4.
+			 */
+
+			/* Need a buffer, string, package or Node reference */
+
+			if (((*stack_ptr)->common.type != ACPI_TYPE_BUFFER) &&
+				((*stack_ptr)->common.type != ACPI_TYPE_STRING) &&
+				((*stack_ptr)->common.type != ACPI_TYPE_PACKAGE) &&
+				((*stack_ptr)->common.type != INTERNAL_TYPE_REFERENCE)) {
+				return (AE_AML_OPERAND_TYPE);
+			}
+
+			/*
+			 * If this is a reference, only allow a reference to an Node.
+			 */
+			if ((*stack_ptr)->common.type == INTERNAL_TYPE_REFERENCE) {
+				if (!(*stack_ptr)->reference.node) {
+					return (AE_AML_OPERAND_TYPE);
+				}
+			}
+			goto next_operand;
+			break;
+
+
+		case ARGI_COMPLEXOBJ:
+
+			/* Need a buffer or package or (ACPI 2.0) String */
+
+			if (((*stack_ptr)->common.type != ACPI_TYPE_BUFFER) &&
+				((*stack_ptr)->common.type != ACPI_TYPE_STRING) &&
+				((*stack_ptr)->common.type != ACPI_TYPE_PACKAGE)) {
+				return (AE_AML_OPERAND_TYPE);
+			}
+			goto next_operand;
+			break;
+
+
+		default:
+
+			/* Unknown type */
+
+			return (AE_BAD_PARAMETER);
+		}
+
+
+		/*
+		 * Make sure that the original object was resolved to the
+		 * required object type (Simple cases only).
+		 */
+		status = acpi_ex_check_object_type (type_needed,
+				  (*stack_ptr)->common.type, *stack_ptr);
+		if (ACPI_FAILURE (status)) {
+			return (status);
+		}
+
+
+next_operand:
+		/*
+		 * If more operands needed, decrement Stack_ptr to point
+		 * to next operand on stack
+		 */
+		if (GET_CURRENT_ARG_TYPE (arg_types)) {
+			stack_ptr--;
+		}
+
+	}   /* while (*Types) */
+
+
+	return (status);
+}
+
+
diff -urN linux-2.4.6-pre4/drivers/acpi/executer/exstore.c linux/drivers/acpi/executer/exstore.c
--- linux-2.4.6-pre4/drivers/acpi/executer/exstore.c	Wed Dec 31 16:00:00 1969
+++ linux/drivers/acpi/executer/exstore.c	Mon Dec  3 22:48:42 2001
@@ -0,0 +1,600 @@
+
+/******************************************************************************
+ *
+ * Module Name: exstore - AML Interpreter object store support
+ *              $Revision: 139 $
+ *
+ *****************************************************************************/
+
+/*
+ *  Copyright (C) 2000, 2001 R. Byron Moore
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#include "acpi.h"
+#include "acparser.h"
+#include "acdispat.h"
+#include "acinterp.h"
+#include "amlcode.h"
+#include "acnamesp.h"
+#include "actables.h"
+
+
+#define _COMPONENT          ACPI_EXECUTER
+	 MODULE_NAME         ("exstore")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ex_store
+ *
+ * PARAMETERS:  *Val_desc           - Value to be stored
+ *              *Dest_desc          - Where to store it.  Must be an NS node
+ *                                    or an ACPI_OPERAND_OBJECT of type
+ *                                    Reference; if the latter the descriptor
+ *                                    will be either reused or deleted.
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Store the value described by Val_desc into the location
+ *              described by Dest_desc. Called by various interpreter
+ *              functions to store the result of an operation into
+ *              the destination operand.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_ex_store (
+	ACPI_OPERAND_OBJECT     *val_desc,
+	ACPI_OPERAND_OBJECT     *dest_desc,
+	ACPI_WALK_STATE         *walk_state)
+{
+	ACPI_STATUS             status = AE_OK;
+	ACPI_OPERAND_OBJECT     *ref_desc = dest_desc;
+
+
+	/* Validate parameters */
+
+	if (!val_desc || !dest_desc) {
+		return (AE_AML_NO_OPERAND);
+	}
+
+	/* Dest_desc can be either a namespace node or an ACPI object */
+
+	if (VALID_DESCRIPTOR_TYPE (dest_desc, ACPI_DESC_TYPE_NAMED)) {
+		/*
+		 * Dest is a namespace node,
+		 * Storing an object into a Name "container"
+		 */
+		status = acpi_ex_store_object_to_node (val_desc,
+				 (ACPI_NAMESPACE_NODE *) dest_desc, walk_state);
+
+		/* All done, that's it */
+
+		return (status);
+	}
+
+
+	/* Destination object must be an object of type Reference */
+
+	if (dest_desc->common.type != INTERNAL_TYPE_REFERENCE) {
+		/* Destination is not an Reference */
+
+		return (AE_AML_OPERAND_TYPE);
+	}
+
+
+	/*
+	 * Examine the Reference opcode.  These cases are handled:
+	 *
+	 * 1) Store to Name (Change the object associated with a name)
+	 * 2) Store to an indexed area of a Buffer or Package
+	 * 3) Store to a Method Local or Arg
+	 * 4) Store to the debug object
+	 * 5) Store to a constant -- a noop
+	 */
+
+	switch (ref_desc->reference.opcode) {
+
+	case AML_NAME_OP:
+
+		/* Storing an object into a Name "container" */
+
+		status = acpi_ex_store_object_to_node (val_desc, ref_desc->reference.object,
+				  walk_state);
+		break;
+
+
+	case AML_INDEX_OP:
+
+		/* Storing to an Index (pointer into a packager or buffer) */
+
+		status = acpi_ex_store_object_to_index (val_desc, ref_desc, walk_state);
+		break;
+
+
+	case AML_LOCAL_OP:
+	case AML_ARG_OP:
+
+		/* Store to a method local/arg  */
+
+		status = acpi_ds_store_object_to_local (ref_desc->reference.opcode,
+				  ref_desc->reference.offset, val_desc, walk_state);
+		break;
+
+
+	case AML_DEBUG_OP:
+
+		/*
+		 * Storing to the Debug object causes the value stored to be
+		 * displayed and otherwise has no effect -- see ACPI Specification
+		 */
+		switch (val_desc->common.type) {
+		case ACPI_TYPE_INTEGER:
+
+			break;
+
+
+		case ACPI_TYPE_BUFFER:
+
+			break;
+
+
+		case ACPI_TYPE_STRING:
+
+			break;
+
+
+		case ACPI_TYPE_PACKAGE:
+
+			break;
+
+
+		default:
+
+			break;
+		}
+
+		break;
+
+
+	case AML_ZERO_OP:
+	case AML_ONE_OP:
+	case AML_ONES_OP:
+
+		/*
+		 * Storing to a constant is a no-op -- see ACPI Specification
+		 * Delete the reference descriptor, however
+		 */
+		break;
+
+
+	default:
+
+		/* TBD: [Restructure] use object dump routine !! */
+
+		status = AE_AML_INTERNAL;
+		break;
+
+	}   /* switch (Ref_desc->Reference.Opcode) */
+
+
+	/* Always delete the reference descriptor object */
+
+	if (ref_desc) {
+		acpi_ut_remove_reference (ref_desc);
+	}
+
+	return (status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ex_store_object_to_index
+ *
+ * PARAMETERS:  *Val_desc           - Value to be stored
+ *              *Node               - Named object to receive the value
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Store the object to the named object.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_ex_store_object_to_index (
+	ACPI_OPERAND_OBJECT     *val_desc,
+	ACPI_OPERAND_OBJECT     *dest_desc,
+	ACPI_WALK_STATE         *walk_state)
+{
+	ACPI_STATUS             status = AE_OK;
+	ACPI_OPERAND_OBJECT     *obj_desc;
+	u32                     length;
+	u32                     i;
+	u8                      value = 0;
+
+
+	/*
+	 * Destination must be a reference pointer, and
+	 * must point to either a buffer or a package
+	 */
+
+	switch (dest_desc->reference.target_type) {
+	case ACPI_TYPE_PACKAGE:
+		/*
+		 * Storing to a package element is not simple.  The source must be
+		 * evaluated and converted to the type of the destination and then the
+		 * source is copied into the destination - we can't just point to the
+		 * source object.
+		 */
+		if (dest_desc->reference.target_type == ACPI_TYPE_PACKAGE) {
+			/*
+			 * The object at *(Dest_desc->Reference.Where) is the
+			 *  element within the package that is to be modified.
+			 */
+			obj_desc = *(dest_desc->reference.where);
+			if (obj_desc) {
+				/*
+				 * If the Destination element is a package, we will delete
+				 *  that object and construct a new one.
+				 *
+				 * TBD: [Investigate] Should both the src and dest be required
+				 *      to be packages?
+				 *       && (Val_desc->Common.Type == ACPI_TYPE_PACKAGE)
+				 */
+				if (obj_desc->common.type == ACPI_TYPE_PACKAGE) {
+					/*
+					 * Take away the reference for being part of a package and
+					 * delete
+					 */
+					acpi_ut_remove_reference (obj_desc);
+					acpi_ut_remove_reference (obj_desc);
+
+					obj_desc = NULL;
+				}
+			}
+
+			if (!obj_desc) {
+				/*
+				 * If the Obj_desc is NULL, it means that an uninitialized package
+				 * element has been used as a destination (this is OK), therefore,
+				 * we must create the destination element to match the type of the
+				 * source element NOTE: Val_desc can be of any type.
+				 */
+				obj_desc = acpi_ut_create_internal_object (val_desc->common.type);
+				if (!obj_desc) {
+					return (AE_NO_MEMORY);
+				}
+
+				/*
+				 * If the source is a package, copy the source to the new dest
+				 */
+				if (ACPI_TYPE_PACKAGE == obj_desc->common.type) {
+					status = acpi_ut_copy_ipackage_to_ipackage (val_desc, obj_desc, walk_state);
+					if (ACPI_FAILURE (status)) {
+						acpi_ut_remove_reference (obj_desc);
+						return (status);
+					}
+				}
+
+				/*
+				 * Install the new descriptor into the package and add a
+				 * reference to the newly created descriptor for now being
+				 * part of the parent package
+				 */
+
+				*(dest_desc->reference.where) = obj_desc;
+				acpi_ut_add_reference (obj_desc);
+			}
+
+			if (ACPI_TYPE_PACKAGE != obj_desc->common.type) {
+				/*
+				 * The destination element is not a package, so we need to
+				 * convert the contents of the source (Val_desc) and copy into
+				 * the destination (Obj_desc)
+				 */
+				status = acpi_ex_store_object_to_object (val_desc, obj_desc,
+						  walk_state);
+				if (ACPI_FAILURE (status)) {
+					/*
+					 * An error occurrered when copying the internal object
+					 * so delete the reference.
+					 */
+					return (AE_AML_OPERAND_TYPE);
+				}
+			}
+		}
+		break;
+
+
+	case ACPI_TYPE_BUFFER_FIELD:
+
+
+		/* TBD: can probably call the generic Buffer/Field routines */
+
+		/*
+		 * Storing into a buffer at a location defined by an Index.
+		 *
+		 * Each 8-bit element of the source object is written to the
+		 * 8-bit Buffer Field of the Index destination object.
+		 */
+
+		/*
+		 * Set the Obj_desc to the destination object and type check.
+		 */
+		obj_desc = dest_desc->reference.object;
+		if (obj_desc->common.type != ACPI_TYPE_BUFFER) {
+			return (AE_AML_OPERAND_TYPE);
+		}
+
+		/*
+		 * The assignment of the individual elements will be slightly
+		 * different for each source type.
+		 */
+
+		switch (val_desc->common.type) {
+		case ACPI_TYPE_INTEGER:
+			/*
+			 * Type is Integer, assign bytewise
+			 * This loop to assign each of the elements is somewhat
+			 * backward because of the Big Endian-ness of IA-64
+			 */
+			length = sizeof (ACPI_INTEGER);
+			for (i = length; i != 0; i--) {
+				value = (u8)(val_desc->integer.value >> (MUL_8 (i - 1)));
+				obj_desc->buffer.pointer[dest_desc->reference.offset] = value;
+			}
+			break;
+
+
+		case ACPI_TYPE_BUFFER:
+			/*
+			 * Type is Buffer, the Length is in the structure.
+			 * Just loop through the elements and assign each one in turn.
+			 */
+			length = val_desc->buffer.length;
+			for (i = 0; i < length; i++) {
+				value = *(val_desc->buffer.pointer + i);
+				obj_desc->buffer.pointer[dest_desc->reference.offset] = value;
+			}
+			break;
+
+
+		case ACPI_TYPE_STRING:
+			/*
+			 * Type is String, the Length is in the structure.
+			 * Just loop through the elements and assign each one in turn.
+			 */
+			length = val_desc->string.length;
+			for (i = 0; i < length; i++) {
+				value = *(val_desc->string.pointer + i);
+				obj_desc->buffer.pointer[dest_desc->reference.offset] = value;
+			}
+			break;
+
+
+		default:
+
+			/* Other types are invalid */
+
+			status = AE_AML_OPERAND_TYPE;
+			break;
+		}
+		break;
+
+
+	default:
+		status = AE_AML_OPERAND_TYPE;
+		break;
+	}
+
+
+	return (status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ex_store_object_to_node
+ *
+ * PARAMETERS:  *Source_desc           - Value to be stored
+ *              *Node                  - Named object to receive the value
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Store the object to the named object.
+ *
+ *              The Assignment of an object to a named object is handled here
+ *              The val passed in will replace the current value (if any)
+ *              with the input value.
+ *
+ *              When storing into an object the data is converted to the
+ *              target object type then stored in the object.  This means
+ *              that the target object type (for an initialized target) will
+ *              not be changed by a store operation.
+ *
+ *              NOTE: the global lock is acquired early.  This will result
+ *              in the global lock being held a bit longer.  Also, if the
+ *              function fails during set up we may get the lock when we
+ *              don't really need it.  I don't think we care.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_ex_store_object_to_node (
+	ACPI_OPERAND_OBJECT     *source_desc,
+	ACPI_NAMESPACE_NODE     *node,
+	ACPI_WALK_STATE         *walk_state)
+{
+	ACPI_STATUS             status = AE_OK;
+	ACPI_OPERAND_OBJECT     *target_desc;
+	ACPI_OBJECT_TYPE8       target_type = ACPI_TYPE_ANY;
+
+
+	/*
+	 * Assuming the parameters were already validated
+	 */
+	ACPI_ASSERT((node) && (source_desc));
+
+
+	/*
+	 * Get current type of the node, and object attached to Node
+	 */
+	target_type = acpi_ns_get_type (node);
+	target_desc = acpi_ns_get_attached_object (node);
+
+
+	/*
+	 * Resolve the source object to an actual value
+	 * (If it is a reference object)
+	 */
+	status = acpi_ex_resolve_object (&source_desc, target_type, walk_state);
+	if (ACPI_FAILURE (status)) {
+		return (status);
+	}
+
+
+	/*
+	 * Do the actual store operation
+	 */
+	switch (target_type) {
+	case ACPI_TYPE_BUFFER_FIELD:
+	case INTERNAL_TYPE_REGION_FIELD:
+	case INTERNAL_TYPE_BANK_FIELD:
+	case INTERNAL_TYPE_INDEX_FIELD:
+
+		/*
+		 * For fields, copy the source data to the target field.
+		 */
+		status = acpi_ex_write_data_to_field (source_desc, target_desc);
+		break;
+
+
+	case ACPI_TYPE_INTEGER:
+	case ACPI_TYPE_STRING:
+	case ACPI_TYPE_BUFFER:
+
+		/*
+		 * These target types are all of type Integer/String/Buffer, and
+		 * therefore support implicit conversion before the store.
+		 *
+		 * Copy and/or convert the source object to a new target object
+		 */
+		status = acpi_ex_store_object (source_desc, target_type, &target_desc, walk_state);
+		if (ACPI_FAILURE (status)) {
+			return (status);
+		}
+
+		/*
+		 * Store the new Target_desc as the new value of the Name, and set
+		 * the Name's type to that of the value being stored in it.
+		 * Source_desc reference count is incremented by Attach_object.
+		 */
+		status = acpi_ns_attach_object (node, target_desc, target_type);
+		break;
+
+
+	default:
+
+		/* No conversions for all other types.  Just attach the source object */
+
+		status = acpi_ns_attach_object (node, source_desc, source_desc->common.type);
+
+		break;
+	}
+
+
+	return (status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ex_store_object_to_object
+ *
+ * PARAMETERS:  *Source_desc           - Value to be stored
+ *              *Dest_desc          - Object to receive the value
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Store an object to another object.
+ *
+ *              The Assignment of an object to another (not named) object
+ *              is handled here.
+ *              The val passed in will replace the current value (if any)
+ *              with the input value.
+ *
+ *              When storing into an object the data is converted to the
+ *              target object type then stored in the object.  This means
+ *              that the target object type (for an initialized target) will
+ *              not be changed by a store operation.
+ *
+ *              This module allows destination types of Number, String,
+ *              and Buffer.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_ex_store_object_to_object (
+	ACPI_OPERAND_OBJECT     *source_desc,
+	ACPI_OPERAND_OBJECT     *dest_desc,
+	ACPI_WALK_STATE         *walk_state)
+{
+	ACPI_STATUS             status = AE_OK;
+	ACPI_OBJECT_TYPE8       destination_type = dest_desc->common.type;
+
+
+	/*
+	 *  Assuming the parameters are valid!
+	 */
+	ACPI_ASSERT((dest_desc) && (source_desc));
+
+
+	/*
+	 * From this interface, we only support Integers/Strings/Buffers
+	 */
+	switch (destination_type) {
+	case ACPI_TYPE_INTEGER:
+	case ACPI_TYPE_STRING:
+	case ACPI_TYPE_BUFFER:
+		break;
+
+	default:
+		return (AE_NOT_IMPLEMENTED);
+	}
+
+
+	/*
+	 * Resolve the source object to an actual value
+	 * (If it is a reference object)
+	 */
+	status = acpi_ex_resolve_object (&source_desc, destination_type, walk_state);
+	if (ACPI_FAILURE (status)) {
+		return (status);
+	}
+
+
+	/*
+	 * Copy and/or convert the source object to the destination object
+	 */
+	status = acpi_ex_store_object (source_desc, destination_type, &dest_desc, walk_state);
+
+
+	return (status);
+}
+
diff -urN linux-2.4.6-pre4/drivers/acpi/executer/exstoren.c linux/drivers/acpi/executer/exstoren.c
--- linux-2.4.6-pre4/drivers/acpi/executer/exstoren.c	Wed Dec 31 16:00:00 1969
+++ linux/drivers/acpi/executer/exstoren.c	Mon Dec  3 22:48:42 2001
@@ -0,0 +1,241 @@
+
+/******************************************************************************
+ *
+ * Module Name: exstoren - AML Interpreter object store support,
+ *                        Store to Node (namespace object)
+ *              $Revision: 38 $
+ *
+ *****************************************************************************/
+
+/*
+ *  Copyright (C) 2000, 2001 R. Byron Moore
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#include "acpi.h"
+#include "acparser.h"
+#include "acdispat.h"
+#include "acinterp.h"
+#include "amlcode.h"
+#include "acnamesp.h"
+#include "actables.h"
+
+
+#define _COMPONENT          ACPI_EXECUTER
+	 MODULE_NAME         ("exstoren")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ex_resolve_object
+ *
+ * PARAMETERS:  Source_desc_ptr     - Pointer to the source object
+ *              Target_type         - Current type of the target
+ *              Walk_state          - Current walk state
+ *
+ * RETURN:      Status, resolved object in Source_desc_ptr.
+ *
+ * DESCRIPTION: Resolve an object.  If the object is a reference, dereference
+ *              it and return the actual object in the Source_desc_ptr.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_ex_resolve_object (
+	ACPI_OPERAND_OBJECT     **source_desc_ptr,
+	ACPI_OBJECT_TYPE8       target_type,
+	ACPI_WALK_STATE         *walk_state)
+{
+	ACPI_OPERAND_OBJECT     *source_desc = *source_desc_ptr;
+	ACPI_STATUS             status = AE_OK;
+
+
+	/*
+	 * Ensure we have a Source that can be stored in the target
+	 */
+	switch (target_type) {
+
+	/* This case handles the "interchangeable" types Integer, String, and Buffer. */
+
+	/*
+	 * These cases all require only Integers or values that
+	 * can be converted to Integers (Strings or Buffers)
+	 */
+	case ACPI_TYPE_BUFFER_FIELD:
+	case INTERNAL_TYPE_REGION_FIELD:
+	case INTERNAL_TYPE_BANK_FIELD:
+	case INTERNAL_TYPE_INDEX_FIELD:
+
+	/*
+	 * Stores into a Field/Region or into a Buffer/String
+	 * are all essentially the same.
+	 */
+	case ACPI_TYPE_INTEGER:
+	case ACPI_TYPE_STRING:
+	case ACPI_TYPE_BUFFER:
+
+
+		/* TBD: FIX - check for source==REF, resolve, then check type */
+
+		/*
+		 * If Source_desc is not a valid type, try to resolve it to one.
+		 */
+		if ((source_desc->common.type != ACPI_TYPE_INTEGER)    &&
+			(source_desc->common.type != ACPI_TYPE_BUFFER)     &&
+			(source_desc->common.type != ACPI_TYPE_STRING)) {
+			/*
+			 * Initially not a valid type, convert
+			 */
+			status = acpi_ex_resolve_to_value (source_desc_ptr, walk_state);
+			if (ACPI_SUCCESS (status) &&
+				(source_desc->common.type != ACPI_TYPE_INTEGER)    &&
+				(source_desc->common.type != ACPI_TYPE_BUFFER)     &&
+				(source_desc->common.type != ACPI_TYPE_STRING)) {
+				/*
+				 * Conversion successful but still not a valid type
+				 */
+				status = AE_AML_OPERAND_TYPE;
+			}
+		}
+		break;
+
+
+	case INTERNAL_TYPE_ALIAS:
+
+		/*
+		 * Aliases are resolved by Acpi_ex_prep_operands
+		 */
+		status = AE_AML_INTERNAL;
+		break;
+
+
+	case ACPI_TYPE_PACKAGE:
+	default:
+
+		/*
+		 * All other types than Alias and the various Fields come here,
+		 * including the untyped case - ACPI_TYPE_ANY.
+		 */
+		break;
+	}
+
+	return (status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ex_store_object
+ *
+ * PARAMETERS:  Source_desc         - Object to store
+ *              Target_type         - Current type of the target
+ *              Target_desc_ptr     - Pointer to the target
+ *              Walk_state          - Current walk state
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: "Store" an object to another object.  This may include
+ *              converting the source type to the target type (implicit
+ *              conversion), and a copy of the value of the source to
+ *              the target.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_ex_store_object (
+	ACPI_OPERAND_OBJECT     *source_desc,
+	ACPI_OBJECT_TYPE8       target_type,
+	ACPI_OPERAND_OBJECT     **target_desc_ptr,
+	ACPI_WALK_STATE         *walk_state)
+{
+	ACPI_OPERAND_OBJECT     *target_desc = *target_desc_ptr;
+	ACPI_STATUS             status = AE_OK;
+
+
+	/*
+	 * Perform the "implicit conversion" of the source to the current type
+	 * of the target - As per the ACPI specification.
+	 *
+	 * If no conversion performed, Source_desc is left alone, otherwise it
+	 * is updated with a new object.
+	 */
+	status = acpi_ex_convert_to_target_type (target_type, &source_desc, walk_state);
+	if (ACPI_FAILURE (status)) {
+		return (status);
+	}
+
+	/*
+	 * We now have two objects of identical types, and we can perform a
+	 * copy of the *value* of the source object.
+	 */
+	switch (target_type) {
+	case ACPI_TYPE_ANY:
+	case INTERNAL_TYPE_DEF_ANY:
+
+		/*
+		 * The target namespace node is uninitialized (has no target object),
+		 * and will take on the type of the source object
+		 */
+
+		*target_desc_ptr = source_desc;
+		break;
+
+
+	case ACPI_TYPE_INTEGER:
+
+		target_desc->integer.value = source_desc->integer.value;
+
+		/* Truncate value if we are executing from a 32-bit ACPI table */
+
+		acpi_ex_truncate_for32bit_table (target_desc, walk_state);
+		break;
+
+	case ACPI_TYPE_STRING:
+
+		status = acpi_ex_copy_string_to_string (source_desc, target_desc);
+		break;
+
+
+	case ACPI_TYPE_BUFFER:
+
+		status = acpi_ex_copy_buffer_to_buffer (source_desc, target_desc);
+		break;
+
+
+	case ACPI_TYPE_PACKAGE:
+
+		/*
+		 * TBD: [Unhandled] Not real sure what to do here
+		 */
+		status = AE_NOT_IMPLEMENTED;
+		break;
+
+
+	default:
+
+		/*
+		 * All other types come here.
+		 */
+		status = AE_NOT_IMPLEMENTED;
+		break;
+	}
+
+
+	return (status);
+}
+
+
diff -urN linux-2.4.6-pre4/drivers/acpi/executer/exstorob.c linux/drivers/acpi/executer/exstorob.c
--- linux-2.4.6-pre4/drivers/acpi/executer/exstorob.c	Wed Dec 31 16:00:00 1969
+++ linux/drivers/acpi/executer/exstorob.c	Mon Dec  3 22:48:42 2001
@@ -0,0 +1,169 @@
+
+/******************************************************************************
+ *
+ * Module Name: exstorob - AML Interpreter object store support, store to object
+ *              $Revision: 32 $
+ *
+ *****************************************************************************/
+
+/*
+ *  Copyright (C) 2000, 2001 R. Byron Moore
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#include "acpi.h"
+#include "acparser.h"
+#include "acdispat.h"
+#include "acinterp.h"
+#include "amlcode.h"
+#include "acnamesp.h"
+#include "actables.h"
+
+
+#define _COMPONENT          ACPI_EXECUTER
+	 MODULE_NAME         ("exstorob")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ex_copy_buffer_to_buffer
+ *
+ * PARAMETERS:  Source_desc         - Source object to copy
+ *              Target_desc         - Destination object of the copy
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Copy a buffer object to another buffer object.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_ex_copy_buffer_to_buffer (
+	ACPI_OPERAND_OBJECT     *source_desc,
+	ACPI_OPERAND_OBJECT     *target_desc)
+{
+	u32                     length;
+	u8                      *buffer;
+
+
+	/*
+	 * We know that Source_desc is a buffer by now
+	 */
+	buffer = (u8 *) source_desc->buffer.pointer;
+	length = source_desc->buffer.length;
+
+	/*
+	 * If target is a buffer of length zero, allocate a new
+	 * buffer of the proper length
+	 */
+	if (target_desc->buffer.length == 0) {
+		target_desc->buffer.pointer = acpi_ut_allocate (length);
+		if (!target_desc->buffer.pointer) {
+			return (AE_NO_MEMORY);
+		}
+
+		target_desc->buffer.length = length;
+	}
+
+	/*
+	 * Buffer is a static allocation,
+	 * only place what will fit in the buffer.
+	 */
+	if (length <= target_desc->buffer.length) {
+		/* Clear existing buffer and copy in the new one */
+
+		MEMSET(target_desc->buffer.pointer, 0, target_desc->buffer.length);
+		MEMCPY(target_desc->buffer.pointer, buffer, length);
+	}
+
+	else {
+		/*
+		 * Truncate the source, copy only what will fit
+		 */
+		MEMCPY(target_desc->buffer.pointer, buffer, target_desc->buffer.length);
+
+	}
+
+	return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ex_copy_string_to_string
+ *
+ * PARAMETERS:  Source_desc         - Source object to copy
+ *              Target_desc         - Destination object of the copy
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Copy a String object to another String object
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_ex_copy_string_to_string (
+	ACPI_OPERAND_OBJECT     *source_desc,
+	ACPI_OPERAND_OBJECT     *target_desc)
+{
+	u32                     length;
+	u8                      *buffer;
+
+
+	/*
+	 * We know that Source_desc is a string by now.
+	 */
+	buffer = (u8 *) source_desc->string.pointer;
+	length = source_desc->string.length;
+
+	/*
+	 * Setting a string value replaces the old string
+	 */
+	if (length < target_desc->string.length) {
+		/* Clear old string and copy in the new one */
+
+		MEMSET(target_desc->string.pointer, 0, target_desc->string.length);
+		MEMCPY(target_desc->string.pointer, buffer, length);
+	}
+
+	else {
+		/*
+		 * Free the current buffer, then allocate a buffer
+		 * large enough to hold the value
+		 */
+		if (target_desc->string.pointer &&
+			!acpi_tb_system_table_pointer (target_desc->string.pointer)) {
+			/*
+			 * Only free if not a pointer into the DSDT
+			 */
+			acpi_ut_free(target_desc->string.pointer);
+		}
+
+		target_desc->string.pointer = acpi_ut_allocate (length + 1);
+		if (!target_desc->string.pointer) {
+			return (AE_NO_MEMORY);
+		}
+		target_desc->string.length = length;
+
+
+		MEMCPY(target_desc->string.pointer, buffer, length);
+	}
+
+	return (AE_OK);
+}
+
+
diff -urN linux-2.4.6-pre4/drivers/acpi/executer/exsystem.c linux/drivers/acpi/executer/exsystem.c
--- linux-2.4.6-pre4/drivers/acpi/executer/exsystem.c	Wed Dec 31 16:00:00 1969
+++ linux/drivers/acpi/executer/exsystem.c	Mon Dec  3 22:48:42 2001
@@ -0,0 +1,326 @@
+
+/******************************************************************************
+ *
+ * Module Name: exsystem - Interface to OS services
+ *              $Revision: 62 $
+ *
+ *****************************************************************************/
+
+/*
+ *  Copyright (C) 2000, 2001 R. Byron Moore
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#include "acpi.h"
+#include "acinterp.h"
+#include "acnamesp.h"
+#include "achware.h"
+#include "acevents.h"
+
+#define _COMPONENT          ACPI_EXECUTER
+	 MODULE_NAME         ("exsystem")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ex_system_wait_semaphore
+ *
+ * PARAMETERS:  Semaphore           - OSD semaphore to wait on
+ *              Timeout             - Max time to wait
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Implements a semaphore wait with a check to see if the
+ *              semaphore is available immediately.  If it is not, the
+ *              interpreter is released.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_ex_system_wait_semaphore (
+	ACPI_HANDLE             semaphore,
+	u32                     timeout)
+{
+	ACPI_STATUS             status;
+
+
+	status = acpi_os_wait_semaphore (semaphore, 1, 0);
+	if (ACPI_SUCCESS (status)) {
+		return (status);
+	}
+
+	if (status == AE_TIME) {
+		/* We must wait, so unlock the interpreter */
+
+		acpi_ex_exit_interpreter ();
+
+		status = acpi_os_wait_semaphore (semaphore, 1, timeout);
+
+		/* Reacquire the interpreter */
+
+		status = acpi_ex_enter_interpreter ();
+		if (ACPI_SUCCESS (status)) {
+			/* Restore the timeout exception */
+
+			status = AE_TIME;
+		}
+	}
+
+	return (status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ex_system_do_stall
+ *
+ * PARAMETERS:  How_long            - The amount of time to stall
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Suspend running thread for specified amount of time.
+ *
+ ******************************************************************************/
+
+void
+acpi_ex_system_do_stall (
+	u32                     how_long)
+{
+
+	if (how_long > 1000) /* 1 millisecond */ {
+		/* Since this thread will sleep, we must release the interpreter */
+
+		acpi_ex_exit_interpreter ();
+
+		acpi_os_sleep_usec (how_long);
+
+		/* And now we must get the interpreter again */
+
+		acpi_ex_enter_interpreter ();
+	}
+
+	else {
+		acpi_os_sleep_usec (how_long);
+	}
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ex_system_do_suspend
+ *
+ * PARAMETERS:  How_long            - The amount of time to suspend
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Suspend running thread for specified amount of time.
+ *
+ ******************************************************************************/
+
+void
+acpi_ex_system_do_suspend (
+	u32                     how_long)
+{
+	/* Since this thread will sleep, we must release the interpreter */
+
+	acpi_ex_exit_interpreter ();
+
+	acpi_os_sleep ((u16) (how_long / (u32) 1000),
+			  (u16) (how_long % (u32) 1000));
+
+	/* And now we must get the interpreter again */
+
+	acpi_ex_enter_interpreter ();
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ex_system_acquire_mutex
+ *
+ * PARAMETERS:  *Time_desc          - The 'time to delay' object descriptor
+ *              *Obj_desc           - The object descriptor for this op
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Provides an access point to perform synchronization operations
+ *              within the AML.  This function will cause a lock to be generated
+ *              for the Mutex pointed to by Obj_desc.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_ex_system_acquire_mutex (
+	ACPI_OPERAND_OBJECT     *time_desc,
+	ACPI_OPERAND_OBJECT     *obj_desc)
+{
+	ACPI_STATUS             status = AE_OK;
+
+
+	if (!obj_desc) {
+		return (AE_BAD_PARAMETER);
+	}
+
+	/*
+	 * Support for the _GL_ Mutex object -- go get the global lock
+	 */
+
+	if (obj_desc->mutex.semaphore == acpi_gbl_global_lock_semaphore) {
+		status = acpi_ev_acquire_global_lock ();
+		return (status);
+	}
+
+	status = acpi_ex_system_wait_semaphore (obj_desc->mutex.semaphore,
+			  (u32) time_desc->integer.value);
+	return (status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ex_system_release_mutex
+ *
+ * PARAMETERS:  *Obj_desc           - The object descriptor for this op
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Provides an access point to perform synchronization operations
+ *              within the AML.  This operation is a request to release a
+ *              previously acquired Mutex.  If the Mutex variable is set then
+ *              it will be decremented.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_ex_system_release_mutex (
+	ACPI_OPERAND_OBJECT     *obj_desc)
+{
+	ACPI_STATUS             status = AE_OK;
+
+
+	if (!obj_desc) {
+		return (AE_BAD_PARAMETER);
+	}
+
+	/*
+	 * Support for the _GL_ Mutex object -- release the global lock
+	 */
+	if (obj_desc->mutex.semaphore == acpi_gbl_global_lock_semaphore) {
+		acpi_ev_release_global_lock ();
+		return (AE_OK);
+	}
+
+	status = acpi_os_signal_semaphore (obj_desc->mutex.semaphore, 1);
+	return (status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ex_system_signal_event
+ *
+ * PARAMETERS:  *Obj_desc           - The object descriptor for this op
+ *
+ * RETURN:      AE_OK
+ *
+ * DESCRIPTION: Provides an access point to perform synchronization operations
+ *              within the AML.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_ex_system_signal_event (
+	ACPI_OPERAND_OBJECT     *obj_desc)
+{
+	ACPI_STATUS             status = AE_OK;
+
+
+	if (obj_desc) {
+		status = acpi_os_signal_semaphore (obj_desc->event.semaphore, 1);
+	}
+
+	return (status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ex_system_wait_event
+ *
+ * PARAMETERS:  *Time_desc          - The 'time to delay' object descriptor
+ *              *Obj_desc           - The object descriptor for this op
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Provides an access point to perform synchronization operations
+ *              within the AML.  This operation is a request to wait for an
+ *              event.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_ex_system_wait_event (
+	ACPI_OPERAND_OBJECT     *time_desc,
+	ACPI_OPERAND_OBJECT     *obj_desc)
+{
+	ACPI_STATUS             status = AE_OK;
+
+
+	if (obj_desc) {
+		status = acpi_ex_system_wait_semaphore (obj_desc->event.semaphore,
+				  (u32) time_desc->integer.value);
+	}
+
+
+	return (status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ex_system_reset_event
+ *
+ * PARAMETERS:  *Obj_desc           - The object descriptor for this op
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Reset an event to a known state.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_ex_system_reset_event (
+	ACPI_OPERAND_OBJECT     *obj_desc)
+{
+	ACPI_STATUS             status = AE_OK;
+	void                    *temp_semaphore;
+
+
+	/*
+	 * We are going to simply delete the existing semaphore and
+	 * create a new one!
+	 */
+
+	status = acpi_os_create_semaphore (ACPI_NO_UNIT_LIMIT, 0, &temp_semaphore);
+	if (ACPI_SUCCESS (status)) {
+		acpi_os_delete_semaphore (obj_desc->event.semaphore);
+		obj_desc->event.semaphore = temp_semaphore;
+	}
+
+	return (status);
+}
+
diff -urN linux-2.4.6-pre4/drivers/acpi/executer/exutils.c linux/drivers/acpi/executer/exutils.c
--- linux-2.4.6-pre4/drivers/acpi/executer/exutils.c	Wed Dec 31 16:00:00 1969
+++ linux/drivers/acpi/executer/exutils.c	Mon Dec  3 22:48:42 2001
@@ -0,0 +1,366 @@
+
+/******************************************************************************
+ *
+ * Module Name: exutils - interpreter/scanner utilities
+ *              $Revision: 79 $
+ *
+ *****************************************************************************/
+
+/*
+ *  Copyright (C) 2000, 2001 R. Byron Moore
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#include "acpi.h"
+#include "acparser.h"
+#include "acinterp.h"
+#include "amlcode.h"
+#include "acnamesp.h"
+#include "acevents.h"
+
+#define _COMPONENT          ACPI_EXECUTER
+	 MODULE_NAME         ("exutils")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ex_enter_interpreter
+ *
+ * PARAMETERS:  None
+ *
+ * DESCRIPTION: Enter the interpreter execution region
+ *              TBD: should be a macro
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_ex_enter_interpreter (void)
+{
+	ACPI_STATUS             status;
+
+
+	status = acpi_ut_acquire_mutex (ACPI_MTX_EXECUTE);
+	return (status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ex_exit_interpreter
+ *
+ * PARAMETERS:  None
+ *
+ * DESCRIPTION: Exit the interpreter execution region
+ *
+ * Cases where the interpreter is unlocked:
+ *      1) Completion of the execution of a control method
+ *      2) Method blocked on a Sleep() AML opcode
+ *      3) Method blocked on an Acquire() AML opcode
+ *      4) Method blocked on a Wait() AML opcode
+ *      5) Method blocked to acquire the global lock
+ *      6) Method blocked to execute a serialized control method that is
+ *          already executing
+ *      7) About to invoke a user-installed opregion handler
+ *
+ *              TBD: should be a macro
+ *
+ ******************************************************************************/
+
+void
+acpi_ex_exit_interpreter (void)
+{
+
+	acpi_ut_release_mutex (ACPI_MTX_EXECUTE);
+
+	return;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ex_validate_object_type
+ *
+ * PARAMETERS:  Type            Object type to validate
+ *
+ * DESCRIPTION: Determine if a type is a valid ACPI object type
+ *
+ ******************************************************************************/
+
+u8
+acpi_ex_validate_object_type (
+	ACPI_OBJECT_TYPE        type)
+{
+
+	if ((type > ACPI_TYPE_MAX && type < INTERNAL_TYPE_BEGIN) ||
+		(type > INTERNAL_TYPE_MAX)) {
+		return (FALSE);
+	}
+
+	return (TRUE);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ex_truncate_for32bit_table
+ *
+ * PARAMETERS:  Obj_desc        - Object to be truncated
+ *              Walk_state      - Current walk state
+ *                                (A method must be executing)
+ *
+ * RETURN:      none
+ *
+ * DESCRIPTION: Truncate a number to 32-bits if the currently executing method
+ *              belongs to a 32-bit ACPI table.
+ *
+ ******************************************************************************/
+
+void
+acpi_ex_truncate_for32bit_table (
+	ACPI_OPERAND_OBJECT     *obj_desc,
+	ACPI_WALK_STATE         *walk_state)
+{
+
+	/*
+	 * Object must be a valid number and we must be executing
+	 * a control method
+	 */
+
+	if ((!obj_desc) ||
+		(obj_desc->common.type != ACPI_TYPE_INTEGER) ||
+		(!walk_state->method_node)) {
+		return;
+	}
+
+	if (walk_state->method_node->flags & ANOBJ_DATA_WIDTH_32) {
+		/*
+		 * We are running a method that exists in a 32-bit ACPI table.
+		 * Truncate the value to 32 bits by zeroing out the upper 32-bit field
+		 */
+		obj_desc->integer.value &= (ACPI_INTEGER) ACPI_UINT32_MAX;
+	}
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ex_acquire_global_lock
+ *
+ * PARAMETERS:  Rule            - Lock rule: Always_lock, Never_lock
+ *
+ * RETURN:      TRUE/FALSE indicating whether the lock was actually acquired
+ *
+ * DESCRIPTION: Obtain the global lock and keep track of this fact via two
+ *              methods.  A global variable keeps the state of the lock, and
+ *              the state is returned to the caller.
+ *
+ ******************************************************************************/
+
+u8
+acpi_ex_acquire_global_lock (
+	u32                     rule)
+{
+	u8                      locked = FALSE;
+	ACPI_STATUS             status;
+
+
+	/* Only attempt lock if the Rule says so */
+
+	if (rule == (u32) GLOCK_ALWAYS_LOCK) {
+		/* We should attempt to get the lock */
+
+		status = acpi_ev_acquire_global_lock ();
+		if (ACPI_SUCCESS (status)) {
+			locked = TRUE;
+		}
+
+	}
+
+	return (locked);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ex_release_global_lock
+ *
+ * PARAMETERS:  Locked_by_me    - Return value from corresponding call to
+ *                                Acquire_global_lock.
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Release the global lock if it is locked.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_ex_release_global_lock (
+	u8                      locked_by_me)
+{
+
+
+	/* Only attempt unlock if the caller locked it */
+
+	if (locked_by_me) {
+		/* OK, now release the lock */
+
+		acpi_ev_release_global_lock ();
+	}
+
+
+	return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ex_digits_needed
+ *
+ * PARAMETERS:  val             - Value to be represented
+ *              base            - Base of representation
+ *
+ * RETURN:      the number of digits needed to represent val in base
+ *
+ ******************************************************************************/
+
+u32
+acpi_ex_digits_needed (
+	ACPI_INTEGER            val,
+	u32                     base)
+{
+	u32                     num_digits = 0;
+
+
+	if (base < 1) {
+		REPORT_ERROR (("Ex_digits_needed: Internal error - Invalid base\n"));
+	}
+
+	else {
+		/*
+		 * ACPI_INTEGER is unsigned, which is why we don't worry about the '-'
+		 */
+		for (num_digits = 1; (val = ACPI_DIVIDE (val,base)); ++num_digits) { ; }
+	}
+
+	return (num_digits);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    ntohl
+ *
+ * PARAMETERS:  Value           - Value to be converted
+ *
+ * DESCRIPTION: Convert a 32-bit value to big-endian (swap the bytes)
+ *
+ ******************************************************************************/
+
+static u32
+_ntohl (
+	u32                     value)
+{
+	union {
+		u32                 value;
+		u8                  bytes[4];
+	} out;
+
+	union {
+		u32                 value;
+		u8                  bytes[4];
+	} in;
+
+
+	in.value = value;
+
+	out.bytes[0] = in.bytes[3];
+	out.bytes[1] = in.bytes[2];
+	out.bytes[2] = in.bytes[1];
+	out.bytes[3] = in.bytes[0];
+
+	return (out.value);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ex_eisa_id_to_string
+ *
+ * PARAMETERS:  Numeric_id      - EISA ID to be converted
+ *              Out_string      - Where to put the converted string (8 bytes)
+ *
+ * DESCRIPTION: Convert a numeric EISA ID to string representation
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_ex_eisa_id_to_string (
+	u32                     numeric_id,
+	NATIVE_CHAR             *out_string)
+{
+	u32                     id;
+
+	/* swap to big-endian to get contiguous bits */
+
+	id = _ntohl (numeric_id);
+
+	out_string[0] = (char) ('@' + ((id >> 26) & 0x1f));
+	out_string[1] = (char) ('@' + ((id >> 21) & 0x1f));
+	out_string[2] = (char) ('@' + ((id >> 16) & 0x1f));
+	out_string[3] = acpi_gbl_hex_to_ascii[(id >> 12) & 0xf];
+	out_string[4] = acpi_gbl_hex_to_ascii[(id >> 8) & 0xf];
+	out_string[5] = acpi_gbl_hex_to_ascii[(id >> 4) & 0xf];
+	out_string[6] = acpi_gbl_hex_to_ascii[id & 0xf];
+	out_string[7] = 0;
+
+	return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ex_unsigned_integer_to_string
+ *
+ * PARAMETERS:  Value           - Value to be converted
+ *              Out_string      - Where to put the converted string (8 bytes)
+ *
+ * RETURN:      Convert a number to string representation
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_ex_unsigned_integer_to_string (
+	ACPI_INTEGER            value,
+	NATIVE_CHAR             *out_string)
+{
+	u32                     count;
+	u32                     digits_needed;
+
+
+	digits_needed = acpi_ex_digits_needed (value, 10);
+
+	out_string[digits_needed] = '\0';
+
+	for (count = digits_needed; count > 0; count--) {
+		out_string[count-1] = (NATIVE_CHAR) ('0' + (ACPI_MODULO (value, 10)));
+		value = ACPI_DIVIDE (value, 10);
+	}
+
+	return (AE_OK);
+}
+
+
diff -urN linux-2.4.6-pre4/drivers/acpi/executer/exxface.c linux/drivers/acpi/executer/exxface.c
--- linux-2.4.6-pre4/drivers/acpi/executer/exxface.c	Wed Dec 31 16:00:00 1969
+++ linux/drivers/acpi/executer/exxface.c	Mon Dec  3 22:48:42 2001
@@ -0,0 +1,98 @@
+
+/******************************************************************************
+ *
+ * Module Name: exxface - External interpreter interfaces
+ *              $Revision: 27 $
+ *
+ *****************************************************************************/
+
+/*
+ *  Copyright (C) 2000, 2001 R. Byron Moore
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#include "acpi.h"
+#include "acinterp.h"
+
+
+#define _COMPONENT          ACPI_EXECUTER
+	 MODULE_NAME         ("exxface")
+
+
+/*
+ * DEFINE_AML_GLOBALS is tested in amlcode.h
+ * to determine whether certain global names should be "defined" or only
+ * "declared" in the current compilation.  This enhances maintainability
+ * by enabling a single header file to embody all knowledge of the names
+ * in question.
+ *
+ * Exactly one module of any executable should #define DEFINE_GLOBALS
+ * before #including the header files which use this convention.  The
+ * names in question will be defined and initialized in that module,
+ * and declared as extern in all other modules which #include those
+ * header files.
+ */
+
+#define DEFINE_AML_GLOBALS
+#include "amlcode.h"
+#include "acparser.h"
+#include "acnamesp.h"
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ex_execute_method
+ *
+ * PARAMETERS:  Pcode               - Pointer to the pcode stream
+ *              Pcode_length        - Length of pcode that comprises the method
+ *              **Params            - List of parameters to pass to method,
+ *                                    terminated by NULL. Params itself may be
+ *                                    NULL if no parameters are being passed.
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Execute a control method
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_ex_execute_method (
+	ACPI_NAMESPACE_NODE     *method_node,
+	ACPI_OPERAND_OBJECT     **params,
+	ACPI_OPERAND_OBJECT     **return_obj_desc)
+{
+	ACPI_STATUS             status;
+
+
+	/*
+	 * The point here is to lock the interpreter and call the low
+	 * level execute.
+	 */
+
+	status = acpi_ex_enter_interpreter ();
+	if (ACPI_FAILURE (status)) {
+		return (status);
+	}
+
+	status = acpi_psx_execute (method_node, params, return_obj_desc);
+
+	acpi_ex_exit_interpreter ();
+
+	return (status);
+}
+
+
diff -urN linux-2.4.6-pre4/drivers/acpi/hardware/Makefile linux/drivers/acpi/hardware/Makefile
--- linux-2.4.6-pre4/drivers/acpi/hardware/Makefile	Fri Dec 29 14:07:21 2000
+++ linux/drivers/acpi/hardware/Makefile	Mon Dec  3 22:48:42 2001
@@ -1,16 +1,12 @@
 #
 # Makefile for all Linux ACPI interpreter subdirectories
+# EXCEPT for the ospm directory
 #
 
-O_TARGET := ../$(shell basename `pwd`).o
+O_TARGET := $(notdir $(CURDIR)).o
 
 obj-$(CONFIG_ACPI) := $(patsubst %.c,%.o,$(wildcard *.c))
 
-EXTRA_CFLAGS += -I../include
-
 EXTRA_CFLAGS += $(ACPI_CFLAGS)
 
 include $(TOPDIR)/Rules.make
-
-clean:
-	$(RM) *.o 
diff -urN linux-2.4.6-pre4/drivers/acpi/hardware/hwacpi.c linux/drivers/acpi/hardware/hwacpi.c
--- linux-2.4.6-pre4/drivers/acpi/hardware/hwacpi.c	Mon Jan 29 10:15:58 2001
+++ linux/drivers/acpi/hardware/hwacpi.c	Mon Dec  3 22:48:42 2001
@@ -2,7 +2,7 @@
 /******************************************************************************
  *
  * Module Name: hwacpi - ACPI Hardware Initialization/Mode Interface
- *              $Revision: 36 $
+ *              $Revision: 40 $
  *
  *****************************************************************************/
 
@@ -29,7 +29,7 @@
 #include "achware.h"
 
 
-#define _COMPONENT          HARDWARE
+#define _COMPONENT          ACPI_HARDWARE
 	 MODULE_NAME         ("hwacpi")
 
 
@@ -63,7 +63,8 @@
 
 	/* Must support *some* mode! */
 /*
-	if (!(System_flags & SYS_MODES_MASK)) {
+	if (!(System_flags & SYS_MODES_MASK))
+	{
 		Restore_acpi_chipset = FALSE;
 
 		return (AE_ERROR);
@@ -72,8 +73,7 @@
 */
 
 
-	switch (acpi_gbl_system_flags & SYS_MODES_MASK)
-	{
+	switch (acpi_gbl_system_flags & SYS_MODES_MASK) {
 		/* Identify current ACPI/legacy mode   */
 
 	case (SYS_MODE_ACPI):
@@ -128,12 +128,11 @@
 		 */
 
 		if (ACPI_VALID_ADDRESS (acpi_gbl_FADT->Xgpe0blk.address) &&
-			acpi_gbl_FADT->gpe0blk_len)
-		{
+			acpi_gbl_FADT->gpe0blk_len) {
 			/* GPE0 specified in FADT  */
 
 			acpi_gbl_gpe0enable_register_save =
-				acpi_cm_allocate (DIV_2 (acpi_gbl_FADT->gpe0blk_len));
+				acpi_ut_allocate (DIV_2 (acpi_gbl_FADT->gpe0blk_len));
 			if (!acpi_gbl_gpe0enable_register_save) {
 				return (AE_NO_MEMORY);
 			}
@@ -151,12 +150,11 @@
 		}
 
 		if (ACPI_VALID_ADDRESS (acpi_gbl_FADT->Xgpe1_blk.address) &&
-			acpi_gbl_FADT->gpe1_blk_len)
-		{
+			acpi_gbl_FADT->gpe1_blk_len) {
 			/* GPE1 defined */
 
 			acpi_gbl_gpe1_enable_register_save =
-				acpi_cm_allocate (DIV_2 (acpi_gbl_FADT->gpe1_blk_len));
+				acpi_ut_allocate (DIV_2 (acpi_gbl_FADT->gpe1_blk_len));
 			if (!acpi_gbl_gpe1_enable_register_save) {
 				return (AE_NO_MEMORY);
 			}
@@ -196,7 +194,7 @@
 	u32                     mode)
 {
 
-	ACPI_STATUS             status = AE_ERROR;
+	ACPI_STATUS             status = AE_NO_HARDWARE_RESPONSE;
 
 
 	if (mode == SYS_MODE_ACPI) {
diff -urN linux-2.4.6-pre4/drivers/acpi/hardware/hwgpe.c linux/drivers/acpi/hardware/hwgpe.c
--- linux-2.4.6-pre4/drivers/acpi/hardware/hwgpe.c	Mon Jan 29 10:15:58 2001
+++ linux/drivers/acpi/hardware/hwgpe.c	Mon Dec  3 22:48:42 2001
@@ -2,7 +2,7 @@
 /******************************************************************************
  *
  * Module Name: hwgpe - Low level GPE enable/disable/clear functions
- *              $Revision: 28 $
+ *              $Revision: 29 $
  *
  *****************************************************************************/
 
@@ -29,7 +29,7 @@
 #include "acnamesp.h"
 #include "acevents.h"
 
-#define _COMPONENT          HARDWARE
+#define _COMPONENT          ACPI_HARDWARE
 	 MODULE_NAME         ("hwgpe")
 
 
diff -urN linux-2.4.6-pre4/drivers/acpi/hardware/hwregs.c linux/drivers/acpi/hardware/hwregs.c
--- linux-2.4.6-pre4/drivers/acpi/hardware/hwregs.c	Mon Jan 29 10:15:58 2001
+++ linux/drivers/acpi/hardware/hwregs.c	Mon Dec  3 22:48:42 2001
@@ -3,7 +3,7 @@
  *
  * Module Name: hwregs - Read/write access functions for the various ACPI
  *                       control and status registers.
- *              $Revision: 88 $
+ *              $Revision: 97 $
  *
  ******************************************************************************/
 
@@ -30,7 +30,7 @@
 #include "achware.h"
 #include "acnamesp.h"
 
-#define _COMPONENT          HARDWARE
+#define _COMPONENT          ACPI_HARDWARE
 	 MODULE_NAME         ("hwregs")
 
 
@@ -55,8 +55,7 @@
 
 u32
 acpi_hw_get_bit_shift (
-	u32                     mask)
-{
+	u32                     mask) {
 	u32                     shift;
 
 
@@ -85,14 +84,14 @@
 	u16                     index;
 
 
-	acpi_cm_acquire_mutex (ACPI_MTX_HARDWARE);
+	acpi_ut_acquire_mutex (ACPI_MTX_HARDWARE);
 
 	acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, PM1_STS, ALL_FIXED_STS_BITS);
 
 
 	if (ACPI_VALID_ADDRESS (acpi_gbl_FADT->Xpm1b_evt_blk.address)) {
 		acpi_os_out16 ((ACPI_IO_ADDRESS) ACPI_GET_ADDRESS (acpi_gbl_FADT->Xpm1b_evt_blk.address),
-				  (u16) ALL_FIXED_STS_BITS);
+			(u16) ALL_FIXED_STS_BITS);
 	}
 
 	/* now clear the GPE Bits */
@@ -101,8 +100,9 @@
 		gpe_length = (u16) DIV_2 (acpi_gbl_FADT->gpe0blk_len);
 
 		for (index = 0; index < gpe_length; index++) {
-			acpi_os_out8 ((ACPI_IO_ADDRESS) (ACPI_GET_ADDRESS (acpi_gbl_FADT->Xgpe0blk.address) + index),
-					  (u8) 0xff);
+			acpi_os_out8 ((ACPI_IO_ADDRESS) (
+				ACPI_GET_ADDRESS (acpi_gbl_FADT->Xgpe0blk.address) + index),
+				(u8) 0xff);
 		}
 	}
 
@@ -110,12 +110,13 @@
 		gpe_length = (u16) DIV_2 (acpi_gbl_FADT->gpe1_blk_len);
 
 		for (index = 0; index < gpe_length; index++) {
-			acpi_os_out8 ((ACPI_IO_ADDRESS) (ACPI_GET_ADDRESS (acpi_gbl_FADT->Xgpe1_blk.address) + index),
-					  (u8) 0xff);
+			acpi_os_out8 ((ACPI_IO_ADDRESS) (
+				ACPI_GET_ADDRESS (acpi_gbl_FADT->Xgpe1_blk.address) + index),
+				(u8) 0xff);
 		}
 	}
 
-	acpi_cm_release_mutex (ACPI_MTX_HARDWARE);
+	acpi_ut_release_mutex (ACPI_MTX_HARDWARE);
 	return;
 }
 
@@ -150,8 +151,7 @@
 	 */
 
 	if ((sleep_state > ACPI_S_STATES_MAX) ||
-		!slp_typ_a || !slp_typ_b)
-	{
+		!slp_typ_a || !slp_typ_b) {
 		return (AE_BAD_PARAMETER);
 	}
 
@@ -175,7 +175,10 @@
 	 *  two elements
 	 */
 
-	status = acpi_cm_resolve_package_references(obj_desc);
+	/* Even though Acpi_evaluate_object resolves package references,
+	 * Ns_evaluate dpesn't. So, we do it here.
+	 */
+	status = acpi_ut_resolve_package_references(obj_desc);
 
 	if (obj_desc->package.count < 2) {
 		/* Must have at least two elements */
@@ -187,8 +190,7 @@
 	else if (((obj_desc->package.elements[0])->common.type !=
 			 ACPI_TYPE_INTEGER) ||
 			 ((obj_desc->package.elements[1])->common.type !=
-				ACPI_TYPE_INTEGER))
-	{
+				ACPI_TYPE_INTEGER)) {
 		/* Must have two  */
 
 		REPORT_ERROR (("Sleep State package elements are not both of type Number\n"));
@@ -206,7 +208,7 @@
 
 
 
-	acpi_cm_remove_reference (obj_desc);
+	acpi_ut_remove_reference (obj_desc);
 
 	return (status);
 }
@@ -239,34 +241,31 @@
 	u32                     register_value = 0;
 	u32                     mask = 0;
 	u32                     value = 0;
+	va_list                 marker;
 
 
 	if (read_write == ACPI_WRITE) {
-		va_list         marker;
-
 		va_start (marker, register_id);
 		value = va_arg (marker, u32);
 		va_end (marker);
 	}
 
 	if (ACPI_MTX_LOCK == use_lock) {
-		acpi_cm_acquire_mutex (ACPI_MTX_HARDWARE);
+		acpi_ut_acquire_mutex (ACPI_MTX_HARDWARE);
 	}
 
 	/*
 	 * Decode the Register ID
-	 *  Register id = Register block id | bit id
+	 * Register id = Register block id | bit id
 	 *
 	 * Check bit id to fine locate Register offset.
-	 *  check Mask to determine Register offset, and then read-write.
+	 * Check Mask to determine Register offset, and then read-write.
 	 */
 
-	switch (REGISTER_BLOCK_ID(register_id))
-	{
+	switch (REGISTER_BLOCK_ID (register_id)) {
 	case PM1_STS:
 
-		switch (register_id)
-		{
+		switch (register_id) {
 		case TMR_STS:
 			mask = TMR_STS_MASK;
 			break;
@@ -315,8 +314,8 @@
 			value &= mask;
 
 			if (value) {
-				acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, PM1_STS, (u16) value);
-
+				acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, PM1_STS,
+					(u16) value);
 				register_value = 0;
 			}
 		}
@@ -326,8 +325,7 @@
 
 	case PM1_EN:
 
-		switch (register_id)
-		{
+		switch (register_id) {
 		case TMR_EN:
 			mask = TMR_EN_MASK;
 			break;
@@ -369,8 +367,7 @@
 
 	case PM1_CONTROL:
 
-		switch (register_id)
-		{
+		switch (register_id) {
 		case SCI_EN:
 			mask = SCI_EN_MASK;
 			break;
@@ -421,16 +418,15 @@
 			 * because we need to do different things. Yuck.
 			 */
 
-			acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK,
-				register_id, (u16) register_value);
+			acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, register_id,
+					(u16) register_value);
 		}
 		break;
 
 
 	case PM2_CONTROL:
 
-		switch (register_id)
-		{
+		switch (register_id) {
 		case ARB_DIS:
 			mask = ARB_DIS_MASK;
 			break;
@@ -507,16 +503,18 @@
 			/* This write will put the Action state into the General Purpose */
 			/* Enable Register indexed by the value in Mask */
 
-			acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK,
-					   register_id, (u8) register_value);
-			register_value = acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK, register_id);
+			acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, register_id,
+				(u8) register_value);
+			register_value = acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK,
+					   register_id);
 		}
 		break;
 
 
 	case SMI_CMD_BLOCK:
 	case PROCESSOR_BLOCK:
-		/* not used */
+		/* Not used by any callers at this time - therefore, not implemented */
+
 	default:
 
 		mask = 0;
@@ -524,7 +522,7 @@
 	}
 
 	if (ACPI_MTX_LOCK == use_lock) {
-		acpi_cm_release_mutex (ACPI_MTX_HARDWARE);
+		acpi_ut_release_mutex (ACPI_MTX_HARDWARE);
 	}
 
 
@@ -557,13 +555,13 @@
 	u32                     value       = 0;
 	u32                     bank_offset;
 
+
 	if (ACPI_MTX_LOCK == use_lock) {
-		acpi_cm_acquire_mutex (ACPI_MTX_HARDWARE);
+		acpi_ut_acquire_mutex (ACPI_MTX_HARDWARE);
 	}
 
 
-	switch (REGISTER_BLOCK_ID(register_id))
-	{
+	switch (REGISTER_BLOCK_ID(register_id)) {
 	case PM1_STS: /* 16-bit access */
 
 		value =  acpi_hw_low_level_read (16, &acpi_gbl_FADT->Xpm1a_evt_blk, 0);
@@ -637,7 +635,7 @@
 
 
 	if (ACPI_MTX_LOCK == use_lock) {
-		acpi_cm_release_mutex (ACPI_MTX_HARDWARE);
+		acpi_ut_release_mutex (ACPI_MTX_HARDWARE);
 	}
 
 	return (value);
@@ -668,12 +666,11 @@
 
 
 	if (ACPI_MTX_LOCK == use_lock) {
-		acpi_cm_acquire_mutex (ACPI_MTX_HARDWARE);
+		acpi_ut_acquire_mutex (ACPI_MTX_HARDWARE);
 	}
 
 
-	switch (REGISTER_BLOCK_ID (register_id))
-	{
+	switch (REGISTER_BLOCK_ID (register_id)) {
 	case PM1_STS: /* 16-bit access */
 
 		acpi_hw_low_level_write (16, value, &acpi_gbl_FADT->Xpm1a_evt_blk, 0);
@@ -751,7 +748,7 @@
 		/* For 2.0, SMI_CMD is always in IO space */
 		/* TBD: what about 1.0? 0.71? */
 
-	   acpi_os_out8 (acpi_gbl_FADT->smi_cmd, (u8) value);
+		acpi_os_out8 (acpi_gbl_FADT->smi_cmd, (u8) value);
 		break;
 
 
@@ -762,7 +759,7 @@
 
 
 	if (ACPI_MTX_LOCK == use_lock) {
-		acpi_cm_release_mutex (ACPI_MTX_HARDWARE);
+		acpi_ut_release_mutex (ACPI_MTX_HARDWARE);
 	}
 
 	return;
@@ -786,7 +783,7 @@
 u32
 acpi_hw_low_level_read (
 	u32                     width,
-	ACPI_GAS                *reg,
+	ACPI_GENERIC_ADDRESS    *reg,
 	u32                     offset)
 {
 	u32                     value = 0;
@@ -801,8 +798,7 @@
 	 * a non-zero address within
 	 */
 	if ((!reg) ||
-		(!ACPI_VALID_ADDRESS (reg->address)))
-	{
+		(!ACPI_VALID_ADDRESS (reg->address))) {
 		return 0;
 	}
 
@@ -812,14 +808,12 @@
 	 * Memory, Io, or PCI config.
 	 */
 
-	switch (reg->address_space_id)
-	{
-	case ADDRESS_SPACE_SYSTEM_MEMORY:
+	switch (reg->address_space_id) {
+	case ACPI_ADR_SPACE_SYSTEM_MEMORY:
 
 		mem_address = (ACPI_PHYSICAL_ADDRESS) (ACPI_GET_ADDRESS (reg->address) + offset);
 
-		switch (width)
-		{
+		switch (width) {
 		case 8:
 			value = acpi_os_mem_in8 (mem_address);
 			break;
@@ -833,12 +827,11 @@
 		break;
 
 
-	case ADDRESS_SPACE_SYSTEM_IO:
+	case ACPI_ADR_SPACE_SYSTEM_IO:
 
 		io_address = (ACPI_IO_ADDRESS) (ACPI_GET_ADDRESS (reg->address) + offset);
 
-		switch (width)
-		{
+		switch (width) {
 		case 8:
 			value = acpi_os_in8 (io_address);
 			break;
@@ -852,13 +845,12 @@
 		break;
 
 
-	case ADDRESS_SPACE_PCI_CONFIG:
+	case ACPI_ADR_SPACE_PCI_CONFIG:
 
 		pci_dev_func = ACPI_PCI_DEVFUN  (ACPI_GET_ADDRESS (reg->address));
 		pci_register = ACPI_PCI_REGISTER (ACPI_GET_ADDRESS (reg->address)) + offset;
 
-		switch (width)
-		{
+		switch (width) {
 		case 8:
 			acpi_os_read_pci_cfg_byte (0, pci_dev_func, pci_register, (u8 *) &value);
 			break;
@@ -896,7 +888,7 @@
 acpi_hw_low_level_write (
 	u32                     width,
 	u32                     value,
-	ACPI_GAS                *reg,
+	ACPI_GENERIC_ADDRESS    *reg,
 	u32                     offset)
 {
 	ACPI_PHYSICAL_ADDRESS   mem_address;
@@ -910,8 +902,7 @@
 	 * a non-zero address within
 	 */
 	if ((!reg) ||
-		(!ACPI_VALID_ADDRESS (reg->address)))
-	{
+		(!ACPI_VALID_ADDRESS (reg->address))) {
 		return;
 	}
 
@@ -921,14 +912,12 @@
 	 * Memory, Io, or PCI config.
 	 */
 
-	switch (reg->address_space_id)
-	{
-	case ADDRESS_SPACE_SYSTEM_MEMORY:
+	switch (reg->address_space_id) {
+	case ACPI_ADR_SPACE_SYSTEM_MEMORY:
 
 		mem_address = (ACPI_PHYSICAL_ADDRESS) (ACPI_GET_ADDRESS (reg->address) + offset);
 
-		switch (width)
-		{
+		switch (width) {
 		case 8:
 			acpi_os_mem_out8 (mem_address, (u8) value);
 			break;
@@ -942,12 +931,11 @@
 		break;
 
 
-	case ADDRESS_SPACE_SYSTEM_IO:
+	case ACPI_ADR_SPACE_SYSTEM_IO:
 
 		io_address = (ACPI_IO_ADDRESS) (ACPI_GET_ADDRESS (reg->address) + offset);
 
-		switch (width)
-		{
+		switch (width) {
 		case 8:
 			acpi_os_out8 (io_address, (u8) value);
 			break;
@@ -961,13 +949,12 @@
 		break;
 
 
-	case ADDRESS_SPACE_PCI_CONFIG:
+	case ACPI_ADR_SPACE_PCI_CONFIG:
 
 		pci_dev_func = ACPI_PCI_DEVFUN  (ACPI_GET_ADDRESS (reg->address));
 		pci_register = ACPI_PCI_REGISTER (ACPI_GET_ADDRESS (reg->address)) + offset;
 
-		switch (width)
-		{
+		switch (width) {
 		case 8:
 			acpi_os_write_pci_cfg_byte (0, pci_dev_func, pci_register, (u8) value);
 			break;
diff -urN linux-2.4.6-pre4/drivers/acpi/hardware/hwsleep.c linux/drivers/acpi/hardware/hwsleep.c
--- linux-2.4.6-pre4/drivers/acpi/hardware/hwsleep.c	Fri Feb  9 11:45:58 2001
+++ linux/drivers/acpi/hardware/hwsleep.c	Mon Dec  3 22:48:42 2001
@@ -2,7 +2,7 @@
 /******************************************************************************
  *
  * Name: hwsleep.c - ACPI Hardware Sleep/Wake Interface
- *              $Revision: 7 $
+ *              $Revision: 12 $
  *
  *****************************************************************************/
 
@@ -28,7 +28,7 @@
 #include "acnamesp.h"
 #include "achware.h"
 
-#define _COMPONENT          HARDWARE
+#define _COMPONENT          ACPI_HARDWARE
 	 MODULE_NAME         ("hwsleep")
 
 
@@ -126,27 +126,28 @@
 
 ACPI_STATUS
 acpi_enter_sleep_state (
-	u8 sleep_state)
+	u8                  sleep_state)
 {
-	ACPI_STATUS status;
-	ACPI_OBJECT_LIST arg_list;
-	ACPI_OBJECT arg;
-	u8 type_a;
-	u8 type_b;
-	u16 PM1_acontrol;
-	u16 PM1_bcontrol;
+	ACPI_STATUS         status;
+	ACPI_OBJECT_LIST    arg_list;
+	ACPI_OBJECT         arg;
+	u8                  type_a;
+	u8                  type_b;
+	u16                 PM1_acontrol;
+	u16                 PM1_bcontrol;
+
 
 	/*
 	 * _PSW methods could be run here to enable wake-on keyboard, LAN, etc.
 	 */
 
-	status = acpi_hw_obtain_sleep_type_register_data(sleep_state, &type_a, &type_b);
-
-	if (!ACPI_SUCCESS(status)) {
+	status = acpi_hw_obtain_sleep_type_register_data (sleep_state, &type_a, &type_b);
+	if (!ACPI_SUCCESS (status)) {
 		return status;
 	}
 
 	/* run the _PTS and _GTS methods */
+
 	MEMSET(&arg_list, 0, sizeof(arg_list));
 	arg_list.count = 1;
 	arg_list.pointer = &arg;
@@ -159,28 +160,32 @@
 	acpi_evaluate_object(NULL, "\\_GTS", &arg_list, NULL);
 
 	/* clear wake status */
+
 	acpi_hw_register_bit_access(ACPI_WRITE, ACPI_MTX_LOCK, WAK_STS, 1);
 
+	disable();
+
 	PM1_acontrol = (u16) acpi_hw_register_read(ACPI_MTX_LOCK, PM1_CONTROL);
 
 	/* mask off SLP_EN and SLP_TYP fields */
 	PM1_acontrol &= 0xC3FF;
-
-	/* mask in SLP_EN */
-	PM1_acontrol |= (1 << acpi_hw_get_bit_shift (SLP_EN_MASK));
-
 	PM1_bcontrol = PM1_acontrol;
 
 	/* mask in SLP_TYP */
 	PM1_acontrol |= (type_a << acpi_hw_get_bit_shift (SLP_TYPE_X_MASK));
 	PM1_bcontrol |= (type_b << acpi_hw_get_bit_shift (SLP_TYPE_X_MASK));
 
-	disable();
+	/* write #1: fill in SLP_TYPE data */
+	acpi_hw_register_write(ACPI_MTX_LOCK, PM1_a_CONTROL, PM1_acontrol);
+	acpi_hw_register_write(ACPI_MTX_LOCK, PM1_b_CONTROL, PM1_bcontrol);
+
+	/* mask in SLP_EN */
+	PM1_acontrol |= (1 << acpi_hw_get_bit_shift (SLP_EN_MASK));
+	PM1_bcontrol |= (1 << acpi_hw_get_bit_shift (SLP_EN_MASK));
 
+	/* write #2: the whole tamale */
 	acpi_hw_register_write(ACPI_MTX_LOCK, PM1_a_CONTROL, PM1_acontrol);
 	acpi_hw_register_write(ACPI_MTX_LOCK, PM1_b_CONTROL, PM1_bcontrol);
-	acpi_hw_register_write(ACPI_MTX_LOCK, PM1_CONTROL,
-		(1 << acpi_hw_get_bit_shift (SLP_EN_MASK)));
 
 	enable();
 
diff -urN linux-2.4.6-pre4/drivers/acpi/hardware/hwtimer.c linux/drivers/acpi/hardware/hwtimer.c
--- linux-2.4.6-pre4/drivers/acpi/hardware/hwtimer.c	Fri Feb  9 11:45:58 2001
+++ linux/drivers/acpi/hardware/hwtimer.c	Mon Dec  3 22:48:42 2001
@@ -2,7 +2,7 @@
 /******************************************************************************
  *
  * Name: hwtimer.c - ACPI Power Management Timer Interface
- *              $Revision: 5 $
+ *              $Revision: 10 $
  *
  *****************************************************************************/
 
@@ -27,7 +27,7 @@
 #include "acpi.h"
 #include "achware.h"
 
-#define _COMPONENT          HARDWARE
+#define _COMPONENT          ACPI_HARDWARE
 	 MODULE_NAME         ("hwtimer")
 
 
@@ -47,6 +47,16 @@
 acpi_get_timer_resolution (
 	u32                     *resolution)
 {
+	ACPI_STATUS             status;
+
+
+	/* Ensure that ACPI has been initialized */
+
+	ACPI_IS_INITIALIZATION_COMPLETE (status);
+	if (ACPI_FAILURE (status)) {
+		return (status);
+	}
+
 	if (!resolution) {
 		return (AE_BAD_PARAMETER);
 	}
@@ -78,6 +88,16 @@
 acpi_get_timer (
 	u32                     *ticks)
 {
+	ACPI_STATUS             status;
+
+
+	/* Ensure that ACPI has been initialized */
+
+	ACPI_IS_INITIALIZATION_COMPLETE (status);
+	if (ACPI_FAILURE (status)) {
+		return (status);
+	}
+
 	if (!ticks) {
 		return (AE_BAD_PARAMETER);
 	}
@@ -126,6 +146,7 @@
 	u32                     microseconds = 0;
 	u32                     remainder = 0;
 
+
 	if (!time_elapsed) {
 		return (AE_BAD_PARAMETER);
 	}
@@ -160,7 +181,7 @@
 	 * divides in kernel-space we have to do some trickery to preserve
 	 * accuracy while using 32-bit math.
 	 *
-	 * TODO: Change to use 64-bit math when supported.
+	 * TBD: Change to use 64-bit math when supported.
 	 *
 	 * The process is as follows:
 	 *  1. Compute the number of seconds by dividing Delta Ticks by
diff -urN linux-2.4.6-pre4/drivers/acpi/include/accommon.h linux/drivers/acpi/include/accommon.h
--- linux-2.4.6-pre4/drivers/acpi/include/accommon.h	Fri Feb  9 11:45:58 2001
+++ linux/drivers/acpi/include/accommon.h	Wed Dec 31 16:00:00 1969
@@ -1,725 +0,0 @@
-/******************************************************************************
- *
- * Name: accommon.h -- prototypes for the common (subsystem-wide) procedures
- *       $Revision: 90 $
- *
- *****************************************************************************/
-
-/*
- *  Copyright (C) 2000, 2001 R. Byron Moore
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-#ifndef _ACCOMMON_H
-#define _ACCOMMON_H
-
-
-typedef
-ACPI_STATUS (*ACPI_PKG_CALLBACK) (
-	u8                      object_type,
-	ACPI_OPERAND_OBJECT     *source_object,
-	ACPI_GENERIC_STATE      *state,
-	void                    *context);
-
-
-ACPI_STATUS
-acpi_cm_walk_package_tree (
-	ACPI_OPERAND_OBJECT     *source_object,
-	void                    *target_object,
-	ACPI_PKG_CALLBACK       walk_callback,
-	void                    *context);
-
-
-typedef struct acpi_pkg_info
-{
-	u8                      *free_space;
-	u32                     length;
-	u32                     object_space;
-	u32                     num_packages;
-} ACPI_PKG_INFO;
-
-#define REF_INCREMENT       (u16) 0
-#define REF_DECREMENT       (u16) 1
-#define REF_FORCE_DELETE    (u16) 2
-
-/* Acpi_cm_dump_buffer */
-
-#define DB_BYTE_DISPLAY     1
-#define DB_WORD_DISPLAY     2
-#define DB_DWORD_DISPLAY    4
-#define DB_QWORD_DISPLAY    8
-
-
-/* Global initialization interfaces */
-
-void
-acpi_cm_init_globals (
-	void);
-
-void
-acpi_cm_terminate (
-	void);
-
-
-/*
- * Cm_init - miscellaneous initialization and shutdown
- */
-
-ACPI_STATUS
-acpi_cm_hardware_initialize (
-	void);
-
-ACPI_STATUS
-acpi_cm_subsystem_shutdown (
-	void);
-
-ACPI_STATUS
-acpi_cm_validate_fadt (
-	void);
-
-/*
- * Cm_global - Global data structures and procedures
- */
-
-#ifdef ACPI_DEBUG
-
-NATIVE_CHAR *
-acpi_cm_get_mutex_name (
-	u32                     mutex_id);
-
-NATIVE_CHAR *
-acpi_cm_get_type_name (
-	u32                     type);
-
-NATIVE_CHAR *
-acpi_cm_get_region_name (
-	u8                      space_id);
-
-#endif
-
-
-u8
-acpi_cm_valid_object_type (
-	u32                     type);
-
-ACPI_OWNER_ID
-acpi_cm_allocate_owner_id (
-	u32                     id_type);
-
-
-/*
- * Cm_clib - Local implementations of C library functions
- */
-
-#ifndef ACPI_USE_SYSTEM_CLIBRARY
-
-NATIVE_UINT
-acpi_cm_strlen (
-	const NATIVE_CHAR       *string);
-
-NATIVE_CHAR *
-acpi_cm_strcpy (
-	NATIVE_CHAR             *dst_string,
-	const NATIVE_CHAR       *src_string);
-
-NATIVE_CHAR *
-acpi_cm_strncpy (
-	NATIVE_CHAR             *dst_string,
-	const NATIVE_CHAR       *src_string,
-	NATIVE_UINT             count);
-
-u32
-acpi_cm_strncmp (
-	const NATIVE_CHAR       *string1,
-	const NATIVE_CHAR       *string2,
-	NATIVE_UINT             count);
-
-u32
-acpi_cm_strcmp (
-	const NATIVE_CHAR       *string1,
-	const NATIVE_CHAR       *string2);
-
-NATIVE_CHAR *
-acpi_cm_strcat (
-	NATIVE_CHAR             *dst_string,
-	const NATIVE_CHAR       *src_string);
-
-NATIVE_CHAR *
-acpi_cm_strncat (
-	NATIVE_CHAR             *dst_string,
-	const NATIVE_CHAR       *src_string,
-	NATIVE_UINT             count);
-
-u32
-acpi_cm_strtoul (
-	const NATIVE_CHAR       *string,
-	NATIVE_CHAR             **terminator,
-	NATIVE_UINT             base);
-
-NATIVE_CHAR *
-acpi_cm_strstr (
-	NATIVE_CHAR             *string1,
-	NATIVE_CHAR             *string2);
-
-NATIVE_CHAR *
-acpi_cm_strupr (
-	NATIVE_CHAR             *src_string);
-
-void *
-acpi_cm_memcpy (
-	void                    *dest,
-	const void              *src,
-	NATIVE_UINT             count);
-
-void *
-acpi_cm_memset (
-	void                    *dest,
-	NATIVE_UINT             value,
-	NATIVE_UINT             count);
-
-u32
-acpi_cm_to_upper (
-	u32                     c);
-
-u32
-acpi_cm_to_lower (
-	u32                     c);
-
-#endif /* ACPI_USE_SYSTEM_CLIBRARY */
-
-/*
- * Cm_copy - Object construction and conversion interfaces
- */
-
-ACPI_STATUS
-acpi_cm_build_simple_object(
-	ACPI_OPERAND_OBJECT     *obj,
-	ACPI_OBJECT             *user_obj,
-	u8                      *data_space,
-	u32                     *buffer_space_used);
-
-ACPI_STATUS
-acpi_cm_build_package_object (
-	ACPI_OPERAND_OBJECT     *obj,
-	u8                      *buffer,
-	u32                     *space_used);
-
-ACPI_STATUS
-acpi_cm_copy_iobject_to_eobject (
-	ACPI_OPERAND_OBJECT     *obj,
-	ACPI_BUFFER             *ret_buffer);
-
-ACPI_STATUS
-acpi_cm_copy_esimple_to_isimple(
-	ACPI_OBJECT             *user_obj,
-	ACPI_OPERAND_OBJECT     *obj);
-
-ACPI_STATUS
-acpi_cm_copy_eobject_to_iobject (
-	ACPI_OBJECT             *obj,
-	ACPI_OPERAND_OBJECT     *internal_obj);
-
-ACPI_STATUS
-acpi_cm_copy_isimple_to_isimple (
-	ACPI_OPERAND_OBJECT     *source_obj,
-	ACPI_OPERAND_OBJECT     *dest_obj);
-
-ACPI_STATUS
-acpi_cm_copy_ipackage_to_ipackage (
-	ACPI_OPERAND_OBJECT     *source_obj,
-	ACPI_OPERAND_OBJECT     *dest_obj,
-	ACPI_WALK_STATE         *walk_state);
-
-
-/*
- * Cm_create - Object creation
- */
-
-ACPI_STATUS
-acpi_cm_update_object_reference (
-	ACPI_OPERAND_OBJECT     *object,
-	u16                     action);
-
-ACPI_OPERAND_OBJECT  *
-_cm_create_internal_object (
-	NATIVE_CHAR             *module_name,
-	u32                     line_number,
-	u32                     component_id,
-	OBJECT_TYPE_INTERNAL    type);
-
-
-/*
- * Cm_debug - Debug interfaces
- */
-
-u32
-get_debug_level (
-	void);
-
-void
-set_debug_level (
-	u32                     level);
-
-void
-function_trace (
-	NATIVE_CHAR             *module_name,
-	u32                     line_number,
-	u32                     component_id,
-	NATIVE_CHAR             *function_name);
-
-void
-function_trace_ptr (
-	NATIVE_CHAR             *module_name,
-	u32                     line_number,
-	u32                     component_id,
-	NATIVE_CHAR             *function_name,
-	void                    *pointer);
-
-void
-function_trace_u32 (
-	NATIVE_CHAR             *module_name,
-	u32                     line_number,
-	u32                     component_id,
-	NATIVE_CHAR             *function_name,
-	u32                     integer);
-
-void
-function_trace_str (
-	NATIVE_CHAR             *module_name,
-	u32                     line_number,
-	u32                     component_id,
-	NATIVE_CHAR             *function_name,
-	NATIVE_CHAR             *string);
-
-void
-function_exit (
-	NATIVE_CHAR             *module_name,
-	u32                     line_number,
-	u32                     component_id,
-	NATIVE_CHAR             *function_name);
-
-void
-function_status_exit (
-	NATIVE_CHAR             *module_name,
-	u32                     line_number,
-	u32                     component_id,
-	NATIVE_CHAR             *function_name,
-	ACPI_STATUS             status);
-
-void
-function_value_exit (
-	NATIVE_CHAR             *module_name,
-	u32                     line_number,
-	u32                     component_id,
-	NATIVE_CHAR             *function_name,
-	ACPI_INTEGER            value);
-
-void
-function_ptr_exit (
-	NATIVE_CHAR             *module_name,
-	u32                     line_number,
-	u32                     component_id,
-	NATIVE_CHAR             *function_name,
-	u8                      *ptr);
-
-void
-debug_print_prefix (
-	NATIVE_CHAR             *module_name,
-	u32                     line_number);
-
-void
-debug_print (
-	NATIVE_CHAR             *module_name,
-	u32                     line_number,
-	u32                     component_id,
-	u32                     print_level,
-	NATIVE_CHAR             *format, ...);
-
-void
-debug_print_raw (
-	NATIVE_CHAR             *format, ...);
-
-void
-_report_info (
-	NATIVE_CHAR             *module_name,
-	u32                     line_number,
-	u32                     component_id);
-
-void
-_report_error (
-	NATIVE_CHAR             *module_name,
-	u32                     line_number,
-	u32                     component_id);
-
-void
-_report_warning (
-	NATIVE_CHAR             *module_name,
-	u32                     line_number,
-	u32                     component_id);
-
-void
-acpi_cm_dump_buffer (
-	u8                      *buffer,
-	u32                     count,
-	u32                     display,
-	u32                     component_id);
-
-
-/*
- * Cm_delete - Object deletion
- */
-
-void
-acpi_cm_delete_internal_obj (
-	ACPI_OPERAND_OBJECT     *object);
-
-void
-acpi_cm_delete_internal_package_object (
-	ACPI_OPERAND_OBJECT     *object);
-
-void
-acpi_cm_delete_internal_simple_object (
-	ACPI_OPERAND_OBJECT     *object);
-
-ACPI_STATUS
-acpi_cm_delete_internal_object_list (
-	ACPI_OPERAND_OBJECT     **obj_list);
-
-
-/*
- * Cm_eval - object evaluation
- */
-
-/* Method name strings */
-
-#define METHOD_NAME__HID        "_HID"
-#define METHOD_NAME__UID        "_UID"
-#define METHOD_NAME__ADR        "_ADR"
-#define METHOD_NAME__STA        "_STA"
-#define METHOD_NAME__REG        "_REG"
-#define METHOD_NAME__SEG        "_SEG"
-#define METHOD_NAME__BBN        "_BBN"
-
-
-ACPI_STATUS
-acpi_cm_evaluate_numeric_object (
-	NATIVE_CHAR             *object_name,
-	ACPI_NAMESPACE_NODE     *device_node,
-	ACPI_INTEGER            *address);
-
-ACPI_STATUS
-acpi_cm_execute_HID (
-	ACPI_NAMESPACE_NODE     *device_node,
-	DEVICE_ID               *hid);
-
-ACPI_STATUS
-acpi_cm_execute_STA (
-	ACPI_NAMESPACE_NODE     *device_node,
-	u32                     *status_flags);
-
-ACPI_STATUS
-acpi_cm_execute_UID (
-	ACPI_NAMESPACE_NODE     *device_node,
-	DEVICE_ID               *uid);
-
-
-/*
- * Cm_error - exception interfaces
- */
-
-NATIVE_CHAR *
-acpi_cm_format_exception (
-	ACPI_STATUS             status);
-
-
-/*
- * Cm_mutex - mutual exclusion interfaces
- */
-
-ACPI_STATUS
-acpi_cm_mutex_initialize (
-	void);
-
-void
-acpi_cm_mutex_terminate (
-	void);
-
-ACPI_STATUS
-acpi_cm_create_mutex (
-	ACPI_MUTEX_HANDLE       mutex_id);
-
-ACPI_STATUS
-acpi_cm_delete_mutex (
-	ACPI_MUTEX_HANDLE       mutex_id);
-
-ACPI_STATUS
-acpi_cm_acquire_mutex (
-	ACPI_MUTEX_HANDLE       mutex_id);
-
-ACPI_STATUS
-acpi_cm_release_mutex (
-	ACPI_MUTEX_HANDLE       mutex_id);
-
-
-/*
- * Cm_object - internal object create/delete/cache routines
- */
-
-void *
-_cm_allocate_object_desc (
-	NATIVE_CHAR             *module_name,
-	u32                     line_number,
-	u32                     component_id);
-
-#define acpi_cm_create_internal_object(t) _cm_create_internal_object(_THIS_MODULE,__LINE__,_COMPONENT,t)
-#define acpi_cm_allocate_object_desc()  _cm_allocate_object_desc(_THIS_MODULE,__LINE__,_COMPONENT)
-
-void
-acpi_cm_delete_object_desc (
-	ACPI_OPERAND_OBJECT     *object);
-
-u8
-acpi_cm_valid_internal_object (
-	void                    *object);
-
-
-/*
- * Cm_ref_cnt - Object reference count management
- */
-
-void
-acpi_cm_add_reference (
-	ACPI_OPERAND_OBJECT     *object);
-
-void
-acpi_cm_remove_reference (
-	ACPI_OPERAND_OBJECT     *object);
-
-/*
- * Cm_size - Object size routines
- */
-
-ACPI_STATUS
-acpi_cm_get_simple_object_size (
-	ACPI_OPERAND_OBJECT     *obj,
-	u32                     *obj_length);
-
-ACPI_STATUS
-acpi_cm_get_package_object_size (
-	ACPI_OPERAND_OBJECT     *obj,
-	u32                     *obj_length);
-
-ACPI_STATUS
-acpi_cm_get_object_size(
-	ACPI_OPERAND_OBJECT     *obj,
-	u32                     *obj_length);
-
-
-/*
- * Cm_state - Generic state creation/cache routines
- */
-
-void
-acpi_cm_push_generic_state (
-	ACPI_GENERIC_STATE      **list_head,
-	ACPI_GENERIC_STATE      *state);
-
-ACPI_GENERIC_STATE *
-acpi_cm_pop_generic_state (
-	ACPI_GENERIC_STATE      **list_head);
-
-
-ACPI_GENERIC_STATE *
-acpi_cm_create_generic_state (
-	void);
-
-ACPI_GENERIC_STATE *
-acpi_cm_create_update_state (
-	ACPI_OPERAND_OBJECT     *object,
-	u16                     action);
-
-ACPI_GENERIC_STATE *
-acpi_cm_create_pkg_state (
-	void                    *internal_object,
-	void                    *external_object,
-	u16                     index);
-
-ACPI_STATUS
-acpi_cm_create_update_state_and_push (
-	ACPI_OPERAND_OBJECT     *object,
-	u16                     action,
-	ACPI_GENERIC_STATE      **state_list);
-
-ACPI_STATUS
-acpi_cm_create_pkg_state_and_push (
-	void                    *internal_object,
-	void                    *external_object,
-	u16                     index,
-	ACPI_GENERIC_STATE      **state_list);
-
-ACPI_GENERIC_STATE *
-acpi_cm_create_control_state (
-	void);
-
-void
-acpi_cm_delete_generic_state (
-	ACPI_GENERIC_STATE      *state);
-
-void
-acpi_cm_delete_generic_state_cache (
-	void);
-
-void
-acpi_cm_delete_object_cache (
-	void);
-
-/*
- * Cmutils
- */
-
-u8
-acpi_cm_valid_acpi_name (
-	u32                     name);
-
-u8
-acpi_cm_valid_acpi_character (
-	NATIVE_CHAR             character);
-
-ACPI_STATUS
-acpi_cm_resolve_package_references (
-	ACPI_OPERAND_OBJECT     *obj_desc);
-
-#ifdef ACPI_DEBUG
-
-void
-acpi_cm_display_init_pathname (
-	ACPI_HANDLE             obj_handle,
-	char                    *path);
-
-#endif
-
-
-/*
- * Memory allocation functions and related macros.
- * Macros that expand to include filename and line number
- */
-
-void *
-_cm_allocate (
-	u32                     size,
-	u32                     component,
-	NATIVE_CHAR             *module,
-	u32                     line);
-
-void *
-_cm_callocate (
-	u32                     size,
-	u32                     component,
-	NATIVE_CHAR             *module,
-	u32                     line);
-
-void
-_cm_free (
-	void                    *address,
-	u32                     component,
-	NATIVE_CHAR             *module,
-	u32                     line);
-
-void
-acpi_cm_init_static_object (
-	ACPI_OPERAND_OBJECT     *obj_desc);
-
-#define acpi_cm_allocate(a)             _cm_allocate(a,_COMPONENT,_THIS_MODULE,__LINE__)
-#define acpi_cm_callocate(a)            _cm_callocate(a, _COMPONENT,_THIS_MODULE,__LINE__)
-#define acpi_cm_free(a)                 _cm_free(a,_COMPONENT,_THIS_MODULE,__LINE__)
-
-#ifndef ACPI_DEBUG_TRACK_ALLOCATIONS
-
-#define acpi_cm_add_element_to_alloc_list(a,b,c,d,e,f)
-#define acpi_cm_delete_element_from_alloc_list(a,b,c,d)
-#define acpi_cm_dump_current_allocations(a,b)
-#define acpi_cm_dump_allocation_info()
-
-#define DECREMENT_OBJECT_METRICS(a)
-#define INCREMENT_OBJECT_METRICS(a)
-#define INITIALIZE_ALLOCATION_METRICS()
-#define DECREMENT_NAME_TABLE_METRICS(a)
-#define INCREMENT_NAME_TABLE_METRICS(a)
-
-#else
-
-#define INITIALIZE_ALLOCATION_METRICS() \
-	acpi_gbl_current_object_count = 0; \
-	acpi_gbl_current_object_size = 0; \
-	acpi_gbl_running_object_count = 0; \
-	acpi_gbl_running_object_size = 0; \
-	acpi_gbl_max_concurrent_object_count = 0; \
-	acpi_gbl_max_concurrent_object_size = 0; \
-	acpi_gbl_current_alloc_size = 0; \
-	acpi_gbl_current_alloc_count = 0; \
-	acpi_gbl_running_alloc_size = 0; \
-	acpi_gbl_running_alloc_count = 0; \
-	acpi_gbl_max_concurrent_alloc_size = 0; \
-	acpi_gbl_max_concurrent_alloc_count = 0; \
-	acpi_gbl_current_node_count = 0; \
-	acpi_gbl_current_node_size = 0; \
-	acpi_gbl_max_concurrent_node_count = 0
-
-
-#define DECREMENT_OBJECT_METRICS(a) \
-	acpi_gbl_current_object_count--; \
-	acpi_gbl_current_object_size -= a
-
-#define INCREMENT_OBJECT_METRICS(a) \
-	acpi_gbl_current_object_count++; \
-	acpi_gbl_running_object_count++; \
-	if (acpi_gbl_max_concurrent_object_count < acpi_gbl_current_object_count) \
-	{ \
-		acpi_gbl_max_concurrent_object_count = acpi_gbl_current_object_count; \
-	} \
-	acpi_gbl_running_object_size += a; \
-	acpi_gbl_current_object_size += a; \
-	if (acpi_gbl_max_concurrent_object_size < acpi_gbl_current_object_size) \
-	{ \
-		acpi_gbl_max_concurrent_object_size = acpi_gbl_current_object_size; \
-	}
-
-#define DECREMENT_NAME_TABLE_METRICS(a) \
-	acpi_gbl_current_node_count--; \
-	acpi_gbl_current_node_size -= (a)
-
-#define INCREMENT_NAME_TABLE_METRICS(a) \
-	acpi_gbl_current_node_count++; \
-	acpi_gbl_current_node_size+= (a); \
-	if (acpi_gbl_max_concurrent_node_count < acpi_gbl_current_node_count) \
-	{ \
-		acpi_gbl_max_concurrent_node_count = acpi_gbl_current_node_count; \
-	} \
-
-
-void
-acpi_cm_dump_allocation_info (
-	void);
-
-void
-acpi_cm_dump_current_allocations (
-	u32                     component,
-	NATIVE_CHAR             *module);
-
-#endif
-
-
-#endif /* _ACCOMMON_H */
diff -urN linux-2.4.6-pre4/drivers/acpi/include/acconfig.h linux/drivers/acpi/include/acconfig.h
--- linux-2.4.6-pre4/drivers/acpi/include/acconfig.h	Tue Mar  6 19:44:36 2001
+++ linux/drivers/acpi/include/acconfig.h	Mon Dec  3 22:48:42 2001
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Name: acconfig.h - Global configuration constants
- *       $Revision: 55 $
+ *       $Revision: 65 $
  *
  *****************************************************************************/
 
@@ -53,7 +53,7 @@
 
 /* Version string */
 
-#define ACPI_CA_VERSION             0x20010208
+#define ACPI_CA_VERSION             0x20010615
 
 
 /* Maximum objects in the various object caches */
@@ -147,6 +147,11 @@
 #define LO_RSDP_WINDOW_SIZE         0x400
 #define HI_RSDP_WINDOW_SIZE         0x20000
 #define RSDP_SCAN_STEP              16
+
+/* Maximum Space_ids for Operation Regions */
+
+#define ACPI_MAX_ADDRESS_SPACE      255
+#define ACPI_NUM_ADDRESS_SPACES     256
 
 
 #endif /* _ACCONFIG_H */
diff -urN linux-2.4.6-pre4/drivers/acpi/include/acdebug.h linux/drivers/acpi/include/acdebug.h
--- linux-2.4.6-pre4/drivers/acpi/include/acdebug.h	Fri Feb  9 11:45:58 2001
+++ linux/drivers/acpi/include/acdebug.h	Mon Dec  3 22:48:42 2001
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Name: acdebug.h - ACPI/AML debugger
- *       $Revision: 41 $
+ *       $Revision: 44 $
  *
  *****************************************************************************/
 
@@ -36,7 +36,7 @@
 extern int                      optind;
 extern NATIVE_CHAR              *optarg;
 extern u8                       *aml_ptr;
-extern u32                      acpi_aml_length;
+extern u32                      aml_length;
 
 extern u8                       opt_tables;
 extern u8                       opt_disasm;
@@ -200,6 +200,10 @@
 	NATIVE_CHAR             *object_arg);
 
 void
+acpi_db_display_locks (void);
+
+
+void
 acpi_db_display_resources (
 	NATIVE_CHAR             *object_arg);
 
@@ -303,7 +307,7 @@
  * dbfileio - Debugger file I/O commands
  */
 
-OBJECT_TYPE_INTERNAL
+ACPI_OBJECT_TYPE8
 acpi_db_match_argument (
 	NATIVE_CHAR             *user_argument,
 	ARGUMENT_INFO           *arguments);
diff -urN linux-2.4.6-pre4/drivers/acpi/include/acdispat.h linux/drivers/acpi/include/acdispat.h
--- linux-2.4.6-pre4/drivers/acpi/include/acdispat.h	Mon Jan 22 13:23:42 2001
+++ linux/drivers/acpi/include/acdispat.h	Mon Dec  3 22:48:42 2001
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Name: acdispat.h - dispatcher (parser to interpreter interface)
- *       $Revision: 35 $
+ *       $Revision: 40 $
  *
  *****************************************************************************/
 
@@ -32,12 +32,6 @@
 #define NAMEOF_ARG_NTE      "__A0"
 
 
-/* For Acpi_ds_method_data_set_value */
-
-#define MTH_TYPE_LOCAL              0
-#define MTH_TYPE_ARG                1
-
-
 /* Common interfaces */
 
 ACPI_STATUS
@@ -64,7 +58,7 @@
 /* dsopcode - support for late evaluation */
 
 ACPI_STATUS
-acpi_ds_get_field_unit_arguments (
+acpi_ds_get_buffer_field_arguments (
 	ACPI_OPERAND_OBJECT     *obj_desc);
 
 ACPI_STATUS
@@ -126,7 +120,7 @@
 ACPI_STATUS
 acpi_ds_create_index_field (
 	ACPI_PARSE_OBJECT       *op,
-	ACPI_HANDLE             region_node,
+	ACPI_NAMESPACE_NODE     *region_node,
 	ACPI_WALK_STATE         *walk_state);
 
 
@@ -173,8 +167,15 @@
 
 
 ACPI_STATUS
+acpi_ds_store_object_to_local (
+	u16                     opcode,
+	u32                     index,
+	ACPI_OPERAND_OBJECT     *src_desc,
+	ACPI_WALK_STATE         *walk_state);
+
+ACPI_STATUS
 acpi_ds_method_data_get_entry (
-	u32                     type,
+	u16                     opcode,
 	u32                     index,
 	ACPI_WALK_STATE         *walk_state,
 	ACPI_OPERAND_OBJECT     ***node);
@@ -187,29 +188,22 @@
 acpi_ds_is_method_value (
 	ACPI_OPERAND_OBJECT     *obj_desc);
 
-OBJECT_TYPE_INTERNAL
+ACPI_OBJECT_TYPE8
 acpi_ds_method_data_get_type (
-	u32                     type,
+	u16                     opcode,
 	u32                     index,
 	ACPI_WALK_STATE         *walk_state);
 
 ACPI_STATUS
 acpi_ds_method_data_get_value (
-	u32                     type,
+	u16                     opcode,
 	u32                     index,
 	ACPI_WALK_STATE         *walk_state,
 	ACPI_OPERAND_OBJECT     **dest_desc);
 
 ACPI_STATUS
-acpi_ds_method_data_set_value (
-	u32                     type,
-	u32                     index,
-	ACPI_OPERAND_OBJECT     *src_desc,
-	ACPI_WALK_STATE         *walk_state);
-
-ACPI_STATUS
 acpi_ds_method_data_delete_value (
-	u32                     type,
+	u16                     opcode,
 	u32                     index,
 	ACPI_WALK_STATE         *walk_state);
 
@@ -220,8 +214,8 @@
 	ACPI_WALK_STATE         *walk_state);
 
 ACPI_NAMESPACE_NODE *
-acpi_ds_method_data_get_nte (
-	u32                     type,
+acpi_ds_method_data_get_node (
+	u16                     opcode,
 	u32                     index,
 	ACPI_WALK_STATE         *walk_state);
 
@@ -231,7 +225,7 @@
 
 ACPI_STATUS
 acpi_ds_method_data_set_entry (
-	u32                     type,
+	u16                     opcode,
 	u32                     index,
 	ACPI_OPERAND_OBJECT     *object,
 	ACPI_WALK_STATE         *walk_state);
@@ -261,7 +255,8 @@
 ACPI_STATUS
 acpi_ds_begin_method_execution (
 	ACPI_NAMESPACE_NODE     *method_node,
-	ACPI_OPERAND_OBJECT     *obj_desc);
+	ACPI_OPERAND_OBJECT     *obj_desc,
+	ACPI_NAMESPACE_NODE     *calling_method_node);
 
 
 /* dsobj - Parser/Interpreter interface - object initialization and conversion */
@@ -307,7 +302,7 @@
 /* dsregn - Parser/Interpreter interface - Op Region parsing */
 
 ACPI_STATUS
-acpi_ds_eval_field_unit_operands (
+acpi_ds_eval_buffer_field_operands (
 	ACPI_WALK_STATE         *walk_state,
 	ACPI_PARSE_OBJECT       *op);
 
@@ -349,12 +344,12 @@
 acpi_ds_resolve_operands (
 	ACPI_WALK_STATE         *walk_state);
 
-OBJECT_TYPE_INTERNAL
+ACPI_OBJECT_TYPE8
 acpi_ds_map_opcode_to_data_type (
 	u16                     opcode,
 	u32                     *out_flags);
 
-OBJECT_TYPE_INTERNAL
+ACPI_OBJECT_TYPE8
 acpi_ds_map_named_opcode_to_data_type (
 	u16                     opcode);
 
@@ -366,7 +361,7 @@
 ACPI_STATUS
 acpi_ds_scope_stack_push (
 	ACPI_NAMESPACE_NODE     *node,
-	OBJECT_TYPE_INTERNAL    type,
+	ACPI_OBJECT_TYPE8       type,
 	ACPI_WALK_STATE         *walk_state);
 
 
diff -urN linux-2.4.6-pre4/drivers/acpi/include/acenv.h linux/drivers/acpi/include/acenv.h
--- linux-2.4.6-pre4/drivers/acpi/include/acenv.h	Mon Jan 22 13:23:42 2001
+++ linux/drivers/acpi/include/acenv.h	Wed Dec 31 16:00:00 1969
@@ -1,288 +0,0 @@
-/******************************************************************************
- *
- * Name: acenv.h - Generation environment specific items
- *       $Revision: 70 $
- *
- *****************************************************************************/
-
-/*
- *  Copyright (C) 2000, 2001 R. Byron Moore
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-#ifndef __ACENV_H__
-#define __ACENV_H__
-
-
-/*
- * Configuration for ACPI tools and utilities
- */
-
-#ifdef _ACPI_DUMP_APP
-#define ACPI_DEBUG
-#define ACPI_APPLICATION
-#define ENABLE_DEBUGGER
-#define ACPI_USE_SYSTEM_CLIBRARY
-#define PARSER_ONLY
-#endif
-
-#ifdef _ACPI_EXEC_APP
-#undef DEBUGGER_THREADING
-#define DEBUGGER_THREADING      DEBUGGER_SINGLE_THREADED
-#define ACPI_DEBUG
-#define ACPI_APPLICATION
-#define ENABLE_DEBUGGER
-#define ACPI_USE_SYSTEM_CLIBRARY
-#endif
-
-#ifdef _ACPI_ASL_COMPILER
-#define ACPI_DEBUG
-#define ACPI_APPLICATION
-#define ENABLE_DEBUGGER
-#define ACPI_USE_SYSTEM_CLIBRARY
-#endif
-
-/*
- * Memory allocation tracking.  Used only if
- * 1) This is the debug version
- * 2) This is NOT a 16-bit version of the code (not enough real-mode memory)
- */
-#ifdef ACPI_DEBUG
-#ifndef _IA16
-#define ACPI_DEBUG_TRACK_ALLOCATIONS
-#endif
-#endif
-
-/*
- * Environment configuration.  The purpose of this file is to interface to the
- * local generation environment.
- *
- * 1) ACPI_USE_SYSTEM_CLIBRARY - Define this if linking to an actual C library.
- *      Otherwise, local versions of string/memory functions will be used.
- * 2) ACPI_USE_STANDARD_HEADERS - Define this if linking to a C library and
- *      the standard header files may be used.
- *
- * The ACPI subsystem only uses low level C library functions that do not call
- * operating system services and may therefore be inlined in the code.
- *
- * It may be necessary to tailor these include files to the target
- * generation environment.
- *
- *
- * Functions and constants used from each header:
- *
- * string.h:    memcpy
- *              memset
- *              strcat
- *              strcmp
- *              strcpy
- *              strlen
- *              strncmp
- *              strncat
- *              strncpy
- *
- * stdlib.h:    strtoul
- *
- * stdarg.h:    va_list
- *              va_arg
- *              va_start
- *              va_end
- *
- */
-
-/*! [Begin] no source code translation */
-
-#ifdef _LINUX
-#include "aclinux.h"
-
-#elif _AED_EFI
-#include "acefi.h"
-
-#elif WIN32
-#include "acwin.h"
-
-#elif __FreeBSD__
-#include "acfreebsd.h"
-
-#else
-
-/* All other environments */
-
-#define ACPI_USE_STANDARD_HEADERS
-
-/* Name of host operating system (returned by the _OS_ namespace object) */
-
-#define ACPI_OS_NAME         "Intel ACPI/CA Core Subsystem"
-
-#endif
-
-
-/*! [End] no source code translation !*/
-
-/******************************************************************************
- *
- * C library configuration
- *
- *****************************************************************************/
-
-#ifdef ACPI_USE_SYSTEM_CLIBRARY
-/*
- * Use the standard C library headers.
- * We want to keep these to a minimum.
- *
- */
-
-#ifdef ACPI_USE_STANDARD_HEADERS
-/*
- * Use the standard headers from the standard locations
- */
-#include <stdarg.h>
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
-
-#endif /* ACPI_USE_STANDARD_HEADERS */
-
-/*
- * We will be linking to the standard Clib functions
- */
-
-#define STRSTR(s1,s2)   strstr((s1), (s2))
-#define STRUPR(s)       strupr((s))
-#define STRLEN(s)       strlen((s))
-#define STRCPY(d,s)     strcpy((d), (s))
-#define STRNCPY(d,s,n)  strncpy((d), (s), (NATIVE_INT)(n))
-#define STRNCMP(d,s,n)  strncmp((d), (s), (NATIVE_INT)(n))
-#define STRCMP(d,s)     strcmp((d), (s))
-#define STRCAT(d,s)     strcat((d), (s))
-#define STRNCAT(d,s,n)  strncat((d), (s), (NATIVE_INT)(n))
-#define STRTOUL(d,s,n)  strtoul((d), (s), (NATIVE_INT)(n))
-#define MEMCPY(d,s,n)   memcpy((d), (s), (NATIVE_INT)(n))
-#define MEMSET(d,s,n)   memset((d), (s), (NATIVE_INT)(n))
-#define TOUPPER         toupper
-#define TOLOWER         tolower
-#define IS_XDIGIT       isxdigit
-
-/******************************************************************************
- *
- * Not using native C library, use local implementations
- *
- *****************************************************************************/
-#else
-
-/*
- * Use local definitions of C library macros and functions
- * NOTE: The function implementations may not be as efficient
- * as an inline or assembly code implementation provided by a
- * native C library.
- */
-
-#ifndef va_arg
-
-#ifndef _VALIST
-#define _VALIST
-typedef char *va_list;
-#endif /* _VALIST */
-
-/*
- * Storage alignment properties
- */
-
-#define  _AUPBND         (sizeof(int) - 1)
-#define  _ADNBND         (sizeof(int) - 1)
-
-/*
- * Variable argument list macro definitions
- */
-
-#define _bnd(X, bnd)    (((sizeof(X)) + (bnd)) & (~(bnd)))
-#define va_arg(ap, T)  (*(T *)(((ap)+=((_bnd(T, _AUPBND)))-(_bnd(T,_ADNBND)))))
-#define va_end(ap)      (void)0
-#define va_start(ap, A) (void)((ap)=(((char*)&(A))+(_bnd(A,_AUPBND))))
-
-#endif /* va_arg */
-
-
-#define STRSTR(s1,s2)    acpi_cm_strstr ((s1), (s2))
-#define STRUPR(s)        acpi_cm_strupr ((s))
-#define STRLEN(s)        acpi_cm_strlen ((s))
-#define STRCPY(d,s)      acpi_cm_strcpy ((d), (s))
-#define STRNCPY(d,s,n)   acpi_cm_strncpy ((d), (s), (n))
-#define STRNCMP(d,s,n)   acpi_cm_strncmp ((d), (s), (n))
-#define STRCMP(d,s)      acpi_cm_strcmp ((d), (s))
-#define STRCAT(d,s)      acpi_cm_strcat ((d), (s))
-#define STRNCAT(d,s,n)   acpi_cm_strncat ((d), (s), (n))
-#define STRTOUL(d,s,n)   acpi_cm_strtoul ((d), (s),(n))
-#define MEMCPY(d,s,n)    acpi_cm_memcpy ((d), (s), (n))
-#define MEMSET(d,v,n)    acpi_cm_memset ((d), (v), (n))
-#define TOUPPER          acpi_cm_to_upper
-#define TOLOWER          acpi_cm_to_lower
-
-#endif /* ACPI_USE_SYSTEM_CLIBRARY */
-
-
-/******************************************************************************
- *
- * Assembly code macros
- *
- *****************************************************************************/
-
-/*
- * Handle platform- and compiler-specific assembly language differences.
- * These should already have been defined by the platform includes above.
- *
- * Notes:
- * 1) Interrupt 3 is used to break into a debugger
- * 2) Interrupts are turned off during ACPI register setup
- */
-
-/* Unrecognized compiler, use defaults */
-#ifndef ACPI_ASM_MACROS
-
-#define ACPI_ASM_MACROS
-#define causeinterrupt(level)
-#define BREAKPOINT3
-#define disable()
-#define enable()
-#define halt()
-#define ACPI_ACQUIRE_GLOBAL_LOCK(Glptr, acq)
-#define ACPI_RELEASE_GLOBAL_LOCK(Glptr, acq)
-
-#endif /* ACPI_ASM_MACROS */
-
-
-#ifdef ACPI_APPLICATION
-
-/* Don't want software interrupts within a ring3 application */
-
-#undef causeinterrupt
-#undef BREAKPOINT3
-#define causeinterrupt(level)
-#define BREAKPOINT3
-#endif
-
-
-/******************************************************************************
- *
- * Compiler-specific
- *
- *****************************************************************************/
-
-/* this has been moved to compiler-specific headers, which are included from the
-   platform header. */
-
-
-#endif /* __ACENV_H__ */
diff -urN linux-2.4.6-pre4/drivers/acpi/include/acevents.h linux/drivers/acpi/include/acevents.h
--- linux-2.4.6-pre4/drivers/acpi/include/acevents.h	Mon Jan 22 13:23:42 2001
+++ linux/drivers/acpi/include/acevents.h	Mon Dec  3 22:48:42 2001
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Name: acevents.h - Event subcomponent prototypes and defines
- *       $Revision: 63 $
+ *       $Revision: 65 $
  *
  *****************************************************************************/
 
@@ -91,11 +91,14 @@
  * Acpi_evnotify - Device Notify handling and dispatch
  */
 
-void
-acpi_ev_notify_dispatch (
-	ACPI_HANDLE             device,
+ACPI_STATUS
+acpi_ev_queue_notify_request (
+	ACPI_NAMESPACE_NODE     *node,
 	u32                     notify_value);
 
+void
+acpi_ev_notify_dispatch (
+	void                    *context);
 
 /*
  * Acpi_evregion - Address Space handling
@@ -195,22 +198,6 @@
 void
 acpi_ev_terminate (
 	void);
-
-
-/* Debug support */
-
-#ifdef ACPI_DEBUG
-
-u32
-acpi_ev_sci_count (
-	u32                     acpi_event);
-
-#define DEBUG_INCREMENT_EVENT_COUNT(a)   acpi_gbl_event_count[a]++;
-
-#else
-
-#define DEBUG_INCREMENT_EVENT_COUNT(a)
-#endif
 
 
 #endif  /* __ACEVENTS_H__  */
diff -urN linux-2.4.6-pre4/drivers/acpi/include/acexcep.h linux/drivers/acpi/include/acexcep.h
--- linux-2.4.6-pre4/drivers/acpi/include/acexcep.h	Mon Jan 22 13:23:42 2001
+++ linux/drivers/acpi/include/acexcep.h	Mon Dec  3 22:48:42 2001
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Name: acexcep.h - Exception codes returned by the ACPI subsystem
- *       $Revision: 41 $
+ *       $Revision: 46 $
  *
  *****************************************************************************/
 
@@ -68,8 +68,14 @@
 #define AE_LIMIT                        (ACPI_STATUS) (0x0012 | AE_CODE_ENVIRONMENTAL)
 #define AE_TIME                         (ACPI_STATUS) (0x0013 | AE_CODE_ENVIRONMENTAL)
 #define AE_UNKNOWN_STATUS               (ACPI_STATUS) (0x0014 | AE_CODE_ENVIRONMENTAL)
+#define AE_ACQUIRE_DEADLOCK             (ACPI_STATUS) (0x0015 | AE_CODE_ENVIRONMENTAL)
+#define AE_RELEASE_DEADLOCK             (ACPI_STATUS) (0x0016 | AE_CODE_ENVIRONMENTAL)
+#define AE_NOT_ACQUIRED                 (ACPI_STATUS) (0x0017 | AE_CODE_ENVIRONMENTAL)
+#define AE_ALREADY_ACQUIRED             (ACPI_STATUS) (0x0018 | AE_CODE_ENVIRONMENTAL)
+#define AE_NO_HARDWARE_RESPONSE         (ACPI_STATUS) (0x0019 | AE_CODE_ENVIRONMENTAL)
+#define AE_NO_GLOBAL_LOCK               (ACPI_STATUS) (0x001A | AE_CODE_ENVIRONMENTAL)
 
-#define AE_CODE_ENV_MAX                 0x0014
+#define AE_CODE_ENV_MAX                 0x001A
 
 /*
  * Programmer exceptions
@@ -118,8 +124,13 @@
 #define AE_AML_INVALID_SPACE_ID         (ACPI_STATUS) (0x0012 | AE_CODE_AML)
 #define AE_AML_STRING_LIMIT             (ACPI_STATUS) (0x0013 | AE_CODE_AML)
 #define AE_AML_NO_RETURN_VALUE          (ACPI_STATUS) (0x0014 | AE_CODE_AML)
+#define AE_AML_METHOD_LIMIT             (ACPI_STATUS) (0x0015 | AE_CODE_AML)
+#define AE_AML_NOT_OWNER                (ACPI_STATUS) (0x0016 | AE_CODE_AML)
+#define AE_AML_MUTEX_ORDER              (ACPI_STATUS) (0x0017 | AE_CODE_AML)
+#define AE_AML_MUTEX_NOT_ACQUIRED       (ACPI_STATUS) (0x0018 | AE_CODE_AML)
+#define AE_AML_INVALID_RESOURCE_TYPE    (ACPI_STATUS) (0x0019 | AE_CODE_AML)
 
-#define AE_CODE_AML_MAX                 0x0014
+#define AE_CODE_AML_MAX                 0x0019
 
 /*
  * Internal exceptions used for control
@@ -165,6 +176,12 @@
 	"AE_LIMIT",
 	"AE_TIME",
 	"AE_UNKNOWN_STATUS",
+	"AE_ACQUIRE_DEADLOCK",
+	"AE_RELEASE_DEADLOCK",
+	"AE_NOT_ACQUIRED",
+	"AE_ALREADY_ACQUIRED",
+	"AE_NO_HARDWARE_RESPONSE",
+	"AE_NO_GLOBAL_LOCK",
 };
 
 static NATIVE_CHAR          *acpi_gbl_exception_names_pgm[] =
@@ -206,6 +223,11 @@
 	"AE_AML_INVALID_SPACE_ID",
 	"AE_AML_STRING_LIMIT",
 	"AE_AML_NO_RETURN_VALUE",
+	"AE_AML_METHOD_LIMIT",
+	"AE_AML_NOT_OWNER",
+	"AE_AML_MUTEX_ORDER",
+	"AE_AML_MUTEX_NOT_ACQUIRED",
+	"AE_AML_INVALID_RESOURCE_TYPE",
 };
 
 static NATIVE_CHAR          *acpi_gbl_exception_names_ctrl[] =
diff -urN linux-2.4.6-pre4/drivers/acpi/include/acgcc.h linux/drivers/acpi/include/acgcc.h
--- linux-2.4.6-pre4/drivers/acpi/include/acgcc.h	Fri Feb  9 11:45:58 2001
+++ linux/drivers/acpi/include/acgcc.h	Wed Dec 31 16:00:00 1969
@@ -1,147 +0,0 @@
-/******************************************************************************
- *
- * Name: acgcc.h - GCC specific defines, etc.
- *       $Revision: 5 $
- *
- *****************************************************************************/
-
-/*
- *  Copyright (C) 2000, 2001 R. Byron Moore
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-#ifndef __ACGCC_H__
-#define __ACGCC_H__
-
-
-#ifdef __ia64__
-#define _IA64
-
-#define COMPILER_DEPENDENT_UINT64   unsigned long
-/* Single threaded */
-#define ACPI_APPLICATION
-
-#define ACPI_ASM_MACROS
-#define causeinterrupt(level)
-#define BREAKPOINT3
-#define disable() __cli()
-#define enable()  __sti()
-#define wbinvd()
-
-/*! [Begin] no source code translation */
-
-#include <asm/pal.h>
-
-#define halt()              ia64_pal_halt_light()           /* PAL_HALT[_LIGHT] */
-#define safe_halt()         ia64_pal_halt(1)                /* PAL_HALT */
-
-
-#define ACPI_ACQUIRE_GLOBAL_LOCK(GLptr, Acq) \
-	do { \
-	__asm__ volatile ("1:  ld4      r29=%1\n"  \
-		";;\n"                  \
-		"mov    ar.ccv=r29\n"   \
-		"mov    r2=r29\n"       \
-		"shr.u  r30=r29,1\n"    \
-		"and    r29=-4,r29\n"   \
-		";;\n"                  \
-		"add    r29=2,r29\n"    \
-		"and    r30=1,r30\n"    \
-		";;\n"                  \
-		"add    r29=r29,r30\n"  \
-		";;\n"                  \
-		"cmpxchg4.acq   r30=%1,r29,ar.ccv\n" \
-		";;\n"                  \
-		"cmp.eq p6,p7=r2,r30\n" \
-		"(p7) br.dpnt.few 1b\n" \
-		"cmp.gt p8,p9=3,r29\n"  \
-		";;\n"                  \
-		"(p8) mov %0=-1\n"      \
-		"(p9) mov %0=r0\n"      \
-		:"=r"(Acq):"m"(GLptr):"r2","r29","r30","memory"); \
-	} while (0)
-
-#define ACPI_RELEASE_GLOBAL_LOCK(GLptr, Acq) \
-	do { \
-	__asm__ volatile ("1:  ld4      r29=%1\n" \
-		";;\n"                  \
-		"mov    ar.ccv=r29\n"   \
-		"mov    r2=r29\n"       \
-		"and    r29=-4,r29\n"   \
-		";;\n"                  \
-		"cmpxchg4.acq   r30=%1,r29,ar.ccv\n" \
-		";;\n"                  \
-		"cmp.eq p6,p7=r2,r30\n" \
-		"(p7) br.dpnt.few 1b\n" \
-		"and    %0=1,r2\n"      \
-		";;\n"                  \
-		:"=r"(Acq):"m"(GLptr):"r2","r29","r30","memory"); \
-	} while (0)
-/*! [End] no source code translation !*/
-
-
-#else /* DO IA32 */
-#define COMPILER_DEPENDENT_UINT64   unsigned long long
-#define ACPI_ASM_MACROS
-#define causeinterrupt(level)
-#define BREAKPOINT3
-#define disable() __cli()
-#define enable()  __sti()
-#define halt()    __asm__ __volatile__ ("sti; hlt":::"memory")
-#define wbinvd()
-
-/*! [Begin] no source code translation
- *
- * A brief explanation as GNU inline assembly is a bit hairy
- *  %0 is the output parameter in EAX ("=a")
- *  %1 and %2 are the input parameters in ECX ("c")
- *  and an immediate value ("i") respectively
- *  All actual register references are preceded with "%%" as in "%%edx"
- *  Immediate values in the assembly are preceded by "$" as in "$0x1"
- *  The final asm parameter are the operation altered non-output registers.
- */
-#define ACPI_ACQUIRE_GLOBAL_LOCK(GLptr, Acq) \
-	do { \
-		int dummy; \
-		asm("1:     movl (%1),%%eax;" \
-			"movl   %%eax,%%edx;" \
-			"andl   %2,%%edx;" \
-			"btsl   $0x1,%%edx;" \
-			"adcl   $0x0,%%edx;" \
-			"lock;  cmpxchgl %%edx,(%1);" \
-			"jnz    1b;" \
-			"cmpb   $0x3,%%dl;" \
-			"sbbl   %%eax,%%eax" \
-			:"=a"(Acq),"=c"(dummy):"c"(GLptr),"i"(~1L):"dx"); \
-	} while(0)
-
-#define ACPI_RELEASE_GLOBAL_LOCK(GLptr, Acq) \
-	do { \
-		int dummy; \
-		asm("1:     movl (%1),%%eax;" \
-			"movl   %%eax,%%edx;" \
-			"andl   %2,%%edx;" \
-			"lock;  cmpxchgl %%edx,(%1);" \
-			"jnz    1b;" \
-			"andl   $0x1,%%eax" \
-			:"=a"(Acq),"=c"(dummy):"c"(GLptr),"i"(~3L):"dx"); \
-	} while(0)
-
-/*! [End] no source code translation !*/
-
-#endif /* IA 32 */
-
-#endif /* __ACGCC_H__ */
diff -urN linux-2.4.6-pre4/drivers/acpi/include/acglobal.h linux/drivers/acpi/include/acglobal.h
--- linux-2.4.6-pre4/drivers/acpi/include/acglobal.h	Mon Jan 22 13:23:42 2001
+++ linux/drivers/acpi/include/acglobal.h	Mon Dec  3 22:48:42 2001
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Name: acglobal.h - Declarations for global variables
- *       $Revision: 96 $
+ *       $Revision: 101 $
  *
  *****************************************************************************/
 
@@ -150,19 +150,19 @@
 
 ACPI_EXTERN u8                          acpi_gbl_debugger_configuration;
 ACPI_EXTERN u8                          acpi_gbl_global_lock_acquired;
-ACPI_EXTERN u8                          acpi_gbl_global_lock_set; /* TBD: [Restructure] OBSOLETE?? */
 ACPI_EXTERN u8                          acpi_gbl_step_to_next_call;
 ACPI_EXTERN u8                          acpi_gbl_acpi_hardware_present;
+ACPI_EXTERN u8                          acpi_gbl_global_lock_present;
 
 ACPI_EXTERN ACPI_OBJECT_NOTIFY_HANDLER  acpi_gbl_drv_notify;
 ACPI_EXTERN ACPI_OBJECT_NOTIFY_HANDLER  acpi_gbl_sys_notify;
 
 
-extern      u8                          acpi_gbl_shutdown;
-extern      u32                         acpi_gbl_system_flags;
-extern      u32                         acpi_gbl_startup_flags;
-extern      u8                          acpi_gbl_decode_to8bit[8];
-extern NATIVE_CHAR                      acpi_gbl_hex_to_ascii[];
+extern u8                               acpi_gbl_shutdown;
+extern u32                              acpi_gbl_system_flags;
+extern u32                              acpi_gbl_startup_flags;
+extern u8                               acpi_gbl_decode_to8bit[8];
+extern NATIVE_CHAR                      acpi_gbl_hex_to_ascii[16];
 
 
 /*****************************************************************************
@@ -178,15 +178,15 @@
 ACPI_EXTERN ACPI_NAMESPACE_NODE         acpi_gbl_root_node_struct;
 ACPI_EXTERN ACPI_NAMESPACE_NODE        *acpi_gbl_root_node;
 
-extern      u8                          acpi_gbl_ns_properties[NUM_NS_TYPES];
-extern      PREDEFINED_NAMES            acpi_gbl_pre_defined_names [NUM_PREDEFINED_NAMES];
+extern u8                               acpi_gbl_ns_properties[NUM_NS_TYPES];
+extern PREDEFINED_NAMES                 acpi_gbl_pre_defined_names [NUM_PREDEFINED_NAMES];
 
 
 /* Used to detect memory leaks (DEBUG ONLY) */
 
 #ifdef ACPI_DEBUG
-ACPI_EXTERN ALLOCATION_INFO            *acpi_gbl_head_alloc_ptr;
-ACPI_EXTERN ALLOCATION_INFO            *acpi_gbl_tail_alloc_ptr;
+ACPI_EXTERN ACPI_ALLOCATION_INFO        *acpi_gbl_head_alloc_ptr;
+ACPI_EXTERN ACPI_ALLOCATION_INFO        *acpi_gbl_tail_alloc_ptr;
 #endif
 
 
@@ -200,15 +200,9 @@
 ACPI_EXTERN ACPI_WALK_LIST             *acpi_gbl_current_walk_list;
 
 /*
- * Handle to the last method found - used during pass1 of load
- */
-ACPI_EXTERN ACPI_HANDLE                 acpi_gbl_last_method;
-
-/*
  * Table of Address Space handlers
  */
-
-ACPI_EXTERN ACPI_ADDRESS_SPACE_INFO     acpi_gbl_address_spaces[ACPI_NUM_ADDRESS_SPACES];
+ACPI_EXTERN ACPI_ADR_SPACE_INFO         acpi_gbl_address_spaces[ACPI_NUM_ADDRESS_SPACES];
 
 
 /* Control method single step flag */
@@ -240,7 +234,7 @@
  *
  ****************************************************************************/
 
-ACPI_EXTERN ACPI_FIXED_EVENT_INFO       acpi_gbl_fixed_event_handlers[NUM_FIXED_EVENTS];
+ACPI_EXTERN ACPI_FIXED_EVENT_INFO       acpi_gbl_fixed_event_handlers[ACPI_NUM_FIXED_EVENTS];
 
 ACPI_EXTERN ACPI_HANDLE                 acpi_gbl_gpe_obj_handle;
 ACPI_EXTERN u32                         acpi_gbl_gpe_register_count;
@@ -255,12 +249,12 @@
  * This table is needed because the GPE numbers supported by block 1 do not
  * have to be contiguous with the GPE numbers supported by block 0.
  */
-ACPI_EXTERN u8                          acpi_gbl_gpe_valid [NUM_GPE];
+ACPI_EXTERN u8                          acpi_gbl_gpe_valid [ACPI_NUM_GPE];
 
 /* Acpi_event counter for debug only */
 
 #ifdef ACPI_DEBUG
-ACPI_EXTERN u32                         acpi_gbl_event_count[NUM_FIXED_EVENTS];
+ACPI_EXTERN u32                         acpi_gbl_event_count[ACPI_NUM_FIXED_EVENTS];
 #endif
 
 
diff -urN linux-2.4.6-pre4/drivers/acpi/include/achware.h linux/drivers/acpi/include/achware.h
--- linux-2.4.6-pre4/drivers/acpi/include/achware.h	Mon Jan 29 10:15:59 2001
+++ linux/drivers/acpi/include/achware.h	Mon Dec  3 22:48:42 2001
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Name: achware.h -- hardware specific interfaces
- *       $Revision: 53 $
+ *       $Revision: 55 $
  *
  *****************************************************************************/
 
@@ -82,14 +82,14 @@
 u32
 acpi_hw_low_level_read (
 	u32                     width,
-	ACPI_GAS                *reg,
+	ACPI_GENERIC_ADDRESS    *reg,
 	u32                     offset);
 
 void
 acpi_hw_low_level_write (
 	u32                     width,
 	u32                     value,
-	ACPI_GAS                *reg,
+	ACPI_GENERIC_ADDRESS    *reg,
 	u32                     offset);
 
 void
diff -urN linux-2.4.6-pre4/drivers/acpi/include/acinterp.h linux/drivers/acpi/include/acinterp.h
--- linux-2.4.6-pre4/drivers/acpi/include/acinterp.h	Fri Feb  9 11:45:58 2001
+++ linux/drivers/acpi/include/acinterp.h	Mon Dec  3 22:48:42 2001
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Name: acinterp.h - Interpreter subcomponent prototypes and defines
- *       $Revision: 92 $
+ *       $Revision: 102 $
  *
  *****************************************************************************/
 
@@ -48,7 +48,7 @@
 
 
 ACPI_STATUS
-acpi_aml_resolve_operands (
+acpi_ex_resolve_operands (
 	u16                     opcode,
 	ACPI_OPERAND_OBJECT     **stack_ptr,
 	ACPI_WALK_STATE         *walk_state);
@@ -59,11 +59,11 @@
  */
 
 ACPI_STATUS
-acpi_aml_load_table (
+acpi_ex_load_table (
 	ACPI_TABLE_TYPE         table_id);
 
 ACPI_STATUS
-acpi_aml_execute_method (
+acpi_ex_execute_method (
 	ACPI_NAMESPACE_NODE     *method_node,
 	ACPI_OPERAND_OBJECT     **params,
 	ACPI_OPERAND_OBJECT     **return_obj_desc);
@@ -74,23 +74,23 @@
  */
 
 ACPI_STATUS
-acpi_aml_convert_to_integer (
+acpi_ex_convert_to_integer (
 	ACPI_OPERAND_OBJECT     **obj_desc,
 	ACPI_WALK_STATE         *walk_state);
 
 ACPI_STATUS
-acpi_aml_convert_to_buffer (
+acpi_ex_convert_to_buffer (
 	ACPI_OPERAND_OBJECT     **obj_desc,
 	ACPI_WALK_STATE         *walk_state);
 
 ACPI_STATUS
-acpi_aml_convert_to_string (
+acpi_ex_convert_to_string (
 	ACPI_OPERAND_OBJECT     **obj_desc,
 	ACPI_WALK_STATE         *walk_state);
 
 ACPI_STATUS
-acpi_aml_convert_to_target_type (
-	OBJECT_TYPE_INTERNAL    destination_type,
+acpi_ex_convert_to_target_type (
+	ACPI_OBJECT_TYPE8       destination_type,
 	ACPI_OPERAND_OBJECT     **obj_desc,
 	ACPI_WALK_STATE         *walk_state);
 
@@ -100,110 +100,164 @@
  */
 
 ACPI_STATUS
-acpi_aml_read_field (
+acpi_ex_extract_from_field (
 	ACPI_OPERAND_OBJECT     *obj_desc,
 	void                    *buffer,
-	u32                     buffer_length,
-	u32                     byte_length,
-	u32                     datum_length,
-	u32                     bit_granularity,
-	u32                     byte_granularity);
+	u32                     buffer_length);
 
 ACPI_STATUS
-acpi_aml_write_field (
+acpi_ex_insert_into_field (
 	ACPI_OPERAND_OBJECT     *obj_desc,
 	void                    *buffer,
-	u32                     buffer_length,
-	u32                     byte_length,
-	u32                     datum_length,
-	u32                     bit_granularity,
-	u32                     byte_granularity);
+	u32                     buffer_length);
 
 ACPI_STATUS
-acpi_aml_setup_field (
+acpi_ex_setup_field (
 	ACPI_OPERAND_OBJECT     *obj_desc,
-	ACPI_OPERAND_OBJECT     *rgn_desc,
-	u32                     field_bit_width);
+	u32                     field_byte_offset);
 
 ACPI_STATUS
-acpi_aml_read_field_data (
+acpi_ex_read_field_datum (
 	ACPI_OPERAND_OBJECT     *obj_desc,
 	u32                     field_byte_offset,
-	u32                     field_bit_width,
 	u32                     *value);
 
 ACPI_STATUS
-acpi_aml_access_named_field (
+acpi_ex_common_access_field (
 	u32                     mode,
-	ACPI_HANDLE             named_field,
+	ACPI_OPERAND_OBJECT     *obj_desc,
+	void                    *buffer,
+	u32                     buffer_length);
+
+
+ACPI_STATUS
+acpi_ex_access_index_field (
+	u32                     mode,
+	ACPI_OPERAND_OBJECT     *obj_desc,
+	void                    *buffer,
+	u32                     buffer_length);
+
+ACPI_STATUS
+acpi_ex_access_bank_field (
+	u32                     mode,
+	ACPI_OPERAND_OBJECT     *obj_desc,
+	void                    *buffer,
+	u32                     buffer_length);
+
+ACPI_STATUS
+acpi_ex_access_region_field (
+	u32                     mode,
+	ACPI_OPERAND_OBJECT     *obj_desc,
+	void                    *buffer,
+	u32                     buffer_length);
+
+
+ACPI_STATUS
+acpi_ex_access_buffer_field (
+	u32                     mode,
+	ACPI_OPERAND_OBJECT     *obj_desc,
 	void                    *buffer,
-	u32                     length);
+	u32                     buffer_length);
+
+ACPI_STATUS
+acpi_ex_read_data_from_field (
+	ACPI_OPERAND_OBJECT     *obj_desc,
+	ACPI_OPERAND_OBJECT     **ret_buffer_desc);
+
+ACPI_STATUS
+acpi_ex_write_data_to_field (
+	ACPI_OPERAND_OBJECT     *source_desc,
+	ACPI_OPERAND_OBJECT     *obj_desc);
 
 /*
  * ammisc - ACPI AML (p-code) execution - specific opcodes
  */
 
 ACPI_STATUS
-acpi_aml_exec_create_field (
+acpi_ex_create_buffer_field (
 	u8                      *aml_ptr,
 	u32                     aml_length,
 	ACPI_NAMESPACE_NODE     *node,
 	ACPI_WALK_STATE         *walk_state);
 
 ACPI_STATUS
-acpi_aml_exec_reconfiguration (
+acpi_ex_reconfiguration (
 	u16                     opcode,
 	ACPI_WALK_STATE         *walk_state);
 
 ACPI_STATUS
-acpi_aml_exec_fatal (
+acpi_ex_fatal (
 	ACPI_WALK_STATE         *walk_state);
 
 ACPI_STATUS
-acpi_aml_exec_index (
+acpi_ex_index (
 	ACPI_WALK_STATE         *walk_state,
 	ACPI_OPERAND_OBJECT     **return_desc);
 
 ACPI_STATUS
-acpi_aml_exec_match (
+acpi_ex_match (
 	ACPI_WALK_STATE         *walk_state,
 	ACPI_OPERAND_OBJECT     **return_desc);
 
 ACPI_STATUS
-acpi_aml_exec_create_mutex (
+acpi_ex_create_mutex (
 	ACPI_WALK_STATE         *walk_state);
 
 ACPI_STATUS
-acpi_aml_exec_create_processor (
+acpi_ex_create_processor (
 	ACPI_PARSE_OBJECT       *op,
-	ACPI_HANDLE             processor_nTE);
+	ACPI_NAMESPACE_NODE     *processor_node);
 
 ACPI_STATUS
-acpi_aml_exec_create_power_resource (
+acpi_ex_create_power_resource (
 	ACPI_PARSE_OBJECT       *op,
-	ACPI_HANDLE             processor_nTE);
+	ACPI_NAMESPACE_NODE     *power_node);
 
 ACPI_STATUS
-acpi_aml_exec_create_region (
+acpi_ex_create_region (
 	u8                      *aml_ptr,
-	u32                     acpi_aml_length,
+	u32                     aml_length,
 	u8                      region_space,
 	ACPI_WALK_STATE         *walk_state);
 
 ACPI_STATUS
-acpi_aml_exec_create_event (
+acpi_ex_create_event (
 	ACPI_WALK_STATE         *walk_state);
 
 ACPI_STATUS
-acpi_aml_exec_create_alias (
+acpi_ex_create_alias (
 	ACPI_WALK_STATE         *walk_state);
 
 ACPI_STATUS
-acpi_aml_exec_create_method (
+acpi_ex_create_method (
 	u8                      *aml_ptr,
-	u32                     acpi_aml_length,
+	u32                     aml_length,
 	u32                     method_flags,
-	ACPI_HANDLE             method);
+	ACPI_NAMESPACE_NODE     *method);
+
+
+/*
+ * ammutex - mutex support
+ */
+
+ACPI_STATUS
+acpi_ex_acquire_mutex (
+	ACPI_OPERAND_OBJECT     *time_desc,
+	ACPI_OPERAND_OBJECT     *obj_desc,
+	ACPI_WALK_STATE         *walk_state);
+
+ACPI_STATUS
+acpi_ex_release_mutex (
+	ACPI_OPERAND_OBJECT     *obj_desc,
+	ACPI_WALK_STATE         *walk_state);
+
+ACPI_STATUS
+acpi_ex_release_all_mutexes (
+	ACPI_OPERAND_OBJECT     *mutex_list);
+
+void
+acpi_ex_unlink_mutex (
+	ACPI_OPERAND_OBJECT     *obj_desc);
 
 
 /*
@@ -211,32 +265,36 @@
  */
 
 ACPI_STATUS
-acpi_aml_prep_def_field_value (
+acpi_ex_prep_common_field_object (
+	ACPI_OPERAND_OBJECT     *obj_desc,
+	u8                      field_flags,
+	u32                     field_position,
+	u32                     field_length);
+
+ACPI_STATUS
+acpi_ex_prep_region_field_value (
 	ACPI_NAMESPACE_NODE     *node,
 	ACPI_HANDLE             region,
 	u8                      field_flags,
-	u8                      field_attribute,
 	u32                     field_position,
 	u32                     field_length);
 
 ACPI_STATUS
-acpi_aml_prep_bank_field_value (
+acpi_ex_prep_bank_field_value (
 	ACPI_NAMESPACE_NODE     *node,
-	ACPI_HANDLE             region,
-	ACPI_HANDLE             bank_reg,
+	ACPI_NAMESPACE_NODE     *region_node,
+	ACPI_NAMESPACE_NODE     *bank_register_node,
 	u32                     bank_val,
 	u8                      field_flags,
-	u8                      field_attribute,
 	u32                     field_position,
 	u32                     field_length);
 
 ACPI_STATUS
-acpi_aml_prep_index_field_value (
+acpi_ex_prep_index_field_value (
 	ACPI_NAMESPACE_NODE     *node,
-	ACPI_HANDLE             index_reg,
-	ACPI_HANDLE             data_reg,
+	ACPI_NAMESPACE_NODE     *index_reg,
+	ACPI_NAMESPACE_NODE     *data_reg,
 	u8                      field_flags,
-	u8                      field_attribute,
 	u32                     field_position,
 	u32                     field_length);
 
@@ -245,47 +303,43 @@
  * amsystem - Interface to OS services
  */
 
-u16
-acpi_aml_system_thread_id (
-	void);
-
 ACPI_STATUS
-acpi_aml_system_do_notify_op (
+acpi_ex_system_do_notify_op (
 	ACPI_OPERAND_OBJECT     *value,
 	ACPI_OPERAND_OBJECT     *obj_desc);
 
 void
-acpi_aml_system_do_suspend(
+acpi_ex_system_do_suspend(
 	u32                     time);
 
 void
-acpi_aml_system_do_stall (
+acpi_ex_system_do_stall (
 	u32                     time);
 
 ACPI_STATUS
-acpi_aml_system_acquire_mutex(
+acpi_ex_system_acquire_mutex(
 	ACPI_OPERAND_OBJECT     *time,
 	ACPI_OPERAND_OBJECT     *obj_desc);
 
 ACPI_STATUS
-acpi_aml_system_release_mutex(
+acpi_ex_system_release_mutex(
 	ACPI_OPERAND_OBJECT     *obj_desc);
 
 ACPI_STATUS
-acpi_aml_system_signal_event(
+acpi_ex_system_signal_event(
 	ACPI_OPERAND_OBJECT     *obj_desc);
 
 ACPI_STATUS
-acpi_aml_system_wait_event(
+acpi_ex_system_wait_event(
 	ACPI_OPERAND_OBJECT     *time,
 	ACPI_OPERAND_OBJECT     *obj_desc);
 
 ACPI_STATUS
-acpi_aml_system_reset_event(
+acpi_ex_system_reset_event(
 	ACPI_OPERAND_OBJECT     *obj_desc);
 
 ACPI_STATUS
-acpi_aml_system_wait_semaphore (
+acpi_ex_system_wait_semaphore (
 	ACPI_HANDLE             semaphore,
 	u32                     timeout);
 
@@ -295,18 +349,18 @@
  */
 
 ACPI_STATUS
-acpi_aml_exec_monadic1 (
+acpi_ex_monadic1 (
 	u16                     opcode,
 	ACPI_WALK_STATE         *walk_state);
 
 ACPI_STATUS
-acpi_aml_exec_monadic2 (
+acpi_ex_monadic2 (
 	u16                     opcode,
 	ACPI_WALK_STATE         *walk_state,
 	ACPI_OPERAND_OBJECT     **return_desc);
 
 ACPI_STATUS
-acpi_aml_exec_monadic2_r (
+acpi_ex_monadic2_r (
 	u16                     opcode,
 	ACPI_WALK_STATE         *walk_state,
 	ACPI_OPERAND_OBJECT     **return_desc);
@@ -317,24 +371,24 @@
  */
 
 ACPI_STATUS
-acpi_aml_exec_dyadic1 (
+acpi_ex_dyadic1 (
 	u16                     opcode,
 	ACPI_WALK_STATE         *walk_state);
 
 ACPI_STATUS
-acpi_aml_exec_dyadic2 (
+acpi_ex_dyadic2 (
 	u16                     opcode,
 	ACPI_WALK_STATE         *walk_state,
 	ACPI_OPERAND_OBJECT     **return_desc);
 
 ACPI_STATUS
-acpi_aml_exec_dyadic2_r (
+acpi_ex_dyadic2_r (
 	u16                     opcode,
 	ACPI_WALK_STATE         *walk_state,
 	ACPI_OPERAND_OBJECT     **return_desc);
 
 ACPI_STATUS
-acpi_aml_exec_dyadic2_s (
+acpi_ex_dyadic2_s (
 	u16                     opcode,
 	ACPI_WALK_STATE         *walk_state,
 	ACPI_OPERAND_OBJECT     **return_desc);
@@ -345,22 +399,22 @@
  */
 
 ACPI_STATUS
-acpi_aml_resolve_to_value (
+acpi_ex_resolve_to_value (
 	ACPI_OPERAND_OBJECT     **stack_ptr,
 	ACPI_WALK_STATE         *walk_state);
 
 ACPI_STATUS
-acpi_aml_resolve_node_to_value (
+acpi_ex_resolve_node_to_value (
 	ACPI_NAMESPACE_NODE     **stack_ptr,
 	ACPI_WALK_STATE         *walk_state);
 
 ACPI_STATUS
-acpi_aml_resolve_object_to_value (
+acpi_ex_resolve_object_to_value (
 	ACPI_OPERAND_OBJECT     **stack_ptr,
 	ACPI_WALK_STATE         *walk_state);
 
 ACPI_STATUS
-acpi_aml_get_field_unit_value (
+acpi_ex_get_buffer_field_value (
 	ACPI_OPERAND_OBJECT     *field_desc,
 	ACPI_OPERAND_OBJECT     *result_desc);
 
@@ -370,18 +424,18 @@
  */
 
 void
-acpi_aml_show_hex_value (
+acpi_ex_show_hex_value (
 	u32                     byte_count,
 	u8                      *aml_ptr,
 	u32                     lead_space);
 
 
 ACPI_STATUS
-acpi_aml_dump_operand (
+acpi_ex_dump_operand (
 	ACPI_OPERAND_OBJECT     *entry_desc);
 
 void
-acpi_aml_dump_operands (
+acpi_ex_dump_operands (
 	ACPI_OPERAND_OBJECT     **operands,
 	OPERATING_MODE          interpreter_mode,
 	NATIVE_CHAR             *ident,
@@ -391,13 +445,13 @@
 	u32                     line_number);
 
 void
-acpi_aml_dump_object_descriptor (
+acpi_ex_dump_object_descriptor (
 	ACPI_OPERAND_OBJECT     *object,
 	u32                     flags);
 
 
 void
-acpi_aml_dump_node (
+acpi_ex_dump_node (
 	ACPI_NAMESPACE_NODE     *node,
 	u32                     flags);
 
@@ -407,28 +461,28 @@
  */
 
 NATIVE_CHAR *
-acpi_aml_allocate_name_string (
+acpi_ex_allocate_name_string (
 	u32                     prefix_count,
 	u32                     num_name_segs);
 
 u32
-acpi_aml_good_char (
+acpi_ex_good_char (
 	u32                     character);
 
 ACPI_STATUS
-acpi_aml_exec_name_segment (
+acpi_ex_name_segment (
 	u8                      **in_aml_address,
 	NATIVE_CHAR             *name_string);
 
 ACPI_STATUS
-acpi_aml_get_name_string (
-	OBJECT_TYPE_INTERNAL    data_type,
+acpi_ex_get_name_string (
+	ACPI_OBJECT_TYPE8       data_type,
 	u8                      *in_aml_address,
 	NATIVE_CHAR             **out_name_string,
 	u32                     *out_name_length);
 
 ACPI_STATUS
-acpi_aml_do_name (
+acpi_ex_do_name (
 	ACPI_OBJECT_TYPE        data_type,
 	OPERATING_MODE          load_exec_mode);
 
@@ -438,25 +492,25 @@
  */
 
 ACPI_STATUS
-acpi_aml_exec_store (
+acpi_ex_store (
 	ACPI_OPERAND_OBJECT     *val_desc,
 	ACPI_OPERAND_OBJECT     *dest_desc,
 	ACPI_WALK_STATE         *walk_state);
 
 ACPI_STATUS
-acpi_aml_store_object_to_index (
+acpi_ex_store_object_to_index (
 	ACPI_OPERAND_OBJECT     *val_desc,
 	ACPI_OPERAND_OBJECT     *dest_desc,
 	ACPI_WALK_STATE         *walk_state);
 
 ACPI_STATUS
-acpi_aml_store_object_to_node (
+acpi_ex_store_object_to_node (
 	ACPI_OPERAND_OBJECT     *source_desc,
 	ACPI_NAMESPACE_NODE     *node,
 	ACPI_WALK_STATE         *walk_state);
 
 ACPI_STATUS
-acpi_aml_store_object_to_object (
+acpi_ex_store_object_to_object (
 	ACPI_OPERAND_OBJECT     *source_desc,
 	ACPI_OPERAND_OBJECT     *dest_desc,
 	ACPI_WALK_STATE         *walk_state);
@@ -467,15 +521,15 @@
  */
 
 ACPI_STATUS
-acpi_aml_resolve_object (
+acpi_ex_resolve_object (
 	ACPI_OPERAND_OBJECT     **source_desc_ptr,
-	OBJECT_TYPE_INTERNAL    target_type,
+	ACPI_OBJECT_TYPE8       target_type,
 	ACPI_WALK_STATE         *walk_state);
 
 ACPI_STATUS
-acpi_aml_store_object (
+acpi_ex_store_object (
 	ACPI_OPERAND_OBJECT     *source_desc,
-	OBJECT_TYPE_INTERNAL    target_type,
+	ACPI_OBJECT_TYPE8       target_type,
 	ACPI_OPERAND_OBJECT     **target_desc_ptr,
 	ACPI_WALK_STATE         *walk_state);
 
@@ -485,32 +539,32 @@
  */
 
 ACPI_STATUS
-acpi_aml_copy_buffer_to_buffer (
+acpi_ex_copy_buffer_to_buffer (
 	ACPI_OPERAND_OBJECT     *source_desc,
 	ACPI_OPERAND_OBJECT     *target_desc);
 
 ACPI_STATUS
-acpi_aml_copy_string_to_string (
+acpi_ex_copy_string_to_string (
 	ACPI_OPERAND_OBJECT     *source_desc,
 	ACPI_OPERAND_OBJECT     *target_desc);
 
 ACPI_STATUS
-acpi_aml_copy_integer_to_index_field (
+acpi_ex_copy_integer_to_index_field (
 	ACPI_OPERAND_OBJECT     *source_desc,
 	ACPI_OPERAND_OBJECT     *target_desc);
 
 ACPI_STATUS
-acpi_aml_copy_integer_to_bank_field (
+acpi_ex_copy_integer_to_bank_field (
 	ACPI_OPERAND_OBJECT     *source_desc,
 	ACPI_OPERAND_OBJECT     *target_desc);
 
 ACPI_STATUS
-acpi_aml_copy_data_to_named_field (
+acpi_ex_copy_data_to_named_field (
 	ACPI_OPERAND_OBJECT     *source_desc,
 	ACPI_NAMESPACE_NODE     *node);
 
 ACPI_STATUS
-acpi_aml_copy_integer_to_field_unit (
+acpi_ex_copy_integer_to_buffer_field (
 	ACPI_OPERAND_OBJECT     *source_desc,
 	ACPI_OPERAND_OBJECT     *target_desc);
 
@@ -518,43 +572,43 @@
  * amutils - interpreter/scanner utilities
  */
 
-void
-acpi_aml_enter_interpreter (
+ACPI_STATUS
+acpi_ex_enter_interpreter (
 	void);
 
 void
-acpi_aml_exit_interpreter (
+acpi_ex_exit_interpreter (
 	void);
 
 void
-acpi_aml_truncate_for32bit_table (
+acpi_ex_truncate_for32bit_table (
 	ACPI_OPERAND_OBJECT     *obj_desc,
 	ACPI_WALK_STATE         *walk_state);
 
 u8
-acpi_aml_validate_object_type (
+acpi_ex_validate_object_type (
 	ACPI_OBJECT_TYPE        type);
 
 u8
-acpi_aml_acquire_global_lock (
+acpi_ex_acquire_global_lock (
 	u32                     rule);
 
 ACPI_STATUS
-acpi_aml_release_global_lock (
+acpi_ex_release_global_lock (
 	u8                      locked);
 
 u32
-acpi_aml_digits_needed (
+acpi_ex_digits_needed (
 	ACPI_INTEGER            value,
 	u32                     base);
 
 ACPI_STATUS
-acpi_aml_eisa_id_to_string (
+acpi_ex_eisa_id_to_string (
 	u32                     numeric_id,
 	NATIVE_CHAR             *out_string);
 
 ACPI_STATUS
-acpi_aml_unsigned_integer_to_string (
+acpi_ex_unsigned_integer_to_string (
 	ACPI_INTEGER            value,
 	NATIVE_CHAR             *out_string);
 
@@ -564,7 +618,7 @@
  */
 
 ACPI_STATUS
-acpi_aml_system_memory_space_handler (
+acpi_ex_system_memory_space_handler (
 	u32                     function,
 	ACPI_PHYSICAL_ADDRESS   address,
 	u32                     bit_width,
@@ -573,7 +627,7 @@
 	void                    *region_context);
 
 ACPI_STATUS
-acpi_aml_system_io_space_handler (
+acpi_ex_system_io_space_handler (
 	u32                     function,
 	ACPI_PHYSICAL_ADDRESS   address,
 	u32                     bit_width,
@@ -582,7 +636,7 @@
 	void                    *region_context);
 
 ACPI_STATUS
-acpi_aml_pci_config_space_handler (
+acpi_ex_pci_config_space_handler (
 	u32                     function,
 	ACPI_PHYSICAL_ADDRESS   address,
 	u32                     bit_width,
@@ -591,7 +645,7 @@
 	void                    *region_context);
 
 ACPI_STATUS
-acpi_aml_embedded_controller_space_handler (
+acpi_ex_embedded_controller_space_handler (
 	u32                     function,
 	ACPI_PHYSICAL_ADDRESS   address,
 	u32                     bit_width,
@@ -600,7 +654,7 @@
 	void                    *region_context);
 
 ACPI_STATUS
-acpi_aml_sm_bus_space_handler (
+acpi_ex_sm_bus_space_handler (
 	u32                     function,
 	ACPI_PHYSICAL_ADDRESS   address,
 	u32                     bit_width,
diff -urN linux-2.4.6-pre4/drivers/acpi/include/aclinux.h linux/drivers/acpi/include/aclinux.h
--- linux-2.4.6-pre4/drivers/acpi/include/aclinux.h	Fri Feb 16 16:06:17 2001
+++ linux/drivers/acpi/include/aclinux.h	Wed Dec 31 16:00:00 1969
@@ -1,55 +0,0 @@
-/******************************************************************************
- *
- * Name: aclinux.h - OS specific defines, etc.
- *       $Revision: 9 $
- *
- *****************************************************************************/
-
-/*
- *  Copyright (C) 2000, 2001 R. Byron Moore
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-#ifndef __ACLINUX_H__
-#define __ACLINUX_H__
-
-#define ACPI_OS_NAME                "Linux"
-
-#include <linux/string.h>
-#include <linux/kernel.h>
-#include <linux/ctype.h>
-#include <asm/system.h>
-#include <asm/atomic.h>
-#include <asm/div64.h>
-
-/* Linux uses GCC */
-
-#include "acgcc.h"
-
-#undef DEBUGGER_THREADING
-#define DEBUGGER_THREADING          DEBUGGER_SINGLE_THREADED
-
-#ifndef _IA64
-/* Linux ia32 can't do int64 well */
-#define ACPI_NO_INTEGER64_SUPPORT
-/* And the ia32 kernel doesn't include 64-bit divide support */
-#define ACPI_DIV64(dividend, divisor) do_div(dividend, divisor)
-#else
-#define ACPI_DIV64(dividend, divisor) ACPI_DIVIDE(dividend, divisor)
-#endif
-
-
-#endif /* __ACLINUX_H__ */
diff -urN linux-2.4.6-pre4/drivers/acpi/include/aclocal.h linux/drivers/acpi/include/aclocal.h
--- linux-2.4.6-pre4/drivers/acpi/include/aclocal.h	Fri Feb  9 11:45:58 2001
+++ linux/drivers/acpi/include/aclocal.h	Mon Dec  3 22:48:42 2001
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Name: aclocal.h - Internal data types used across the ACPI subsystem
- *       $Revision: 104 $
+ *       $Revision: 123 $
  *
  *****************************************************************************/
 
@@ -27,20 +27,24 @@
 #define __ACLOCAL_H__
 
 
-#define WAIT_FOREVER                ((u32) -1)
+#define WAIT_FOREVER                    ((u32) -1)
 
-typedef void*                       ACPI_MUTEX;
-typedef u32                         ACPI_MUTEX_HANDLE;
+typedef void*                           ACPI_MUTEX;
+typedef u32                             ACPI_MUTEX_HANDLE;
 
 
+#define ACPI_MEMORY_MODE                0x01
+#define ACPI_LOGICAL_ADDRESSING         0x00
+#define ACPI_PHYSICAL_ADDRESSING        0x01
+
 /* Object descriptor types */
 
-#define ACPI_CACHED_OBJECT          0x11    /* ORed in when object is cached */
-#define ACPI_DESC_TYPE_STATE        0x22
-#define ACPI_DESC_TYPE_WALK         0x44
-#define ACPI_DESC_TYPE_PARSER       0x66
-#define ACPI_DESC_TYPE_INTERNAL     0x88
-#define ACPI_DESC_TYPE_NAMED        0xAA
+#define ACPI_CACHED_OBJECT              0x11    /* ORed in when object is cached */
+#define ACPI_DESC_TYPE_STATE            0x22
+#define ACPI_DESC_TYPE_WALK             0x44
+#define ACPI_DESC_TYPE_PARSER           0x66
+#define ACPI_DESC_TYPE_INTERNAL         0x88
+#define ACPI_DESC_TYPE_NAMED            0xAA
 
 
 /*****************************************************************************
@@ -52,26 +56,30 @@
 
 /*
  * Predefined handles for the mutex objects used within the subsystem
- * All mutex objects are automatically created by Acpi_cm_mutex_initialize.
+ * All mutex objects are automatically created by Acpi_ut_mutex_initialize.
+ *
+ * The acquire/release ordering protocol is implied via this list.  Mutexes
+ * with a lower value must be acquired before mutexes with a higher value.
+ *
  * NOTE: any changes here must be reflected in the Acpi_gbl_Mutex_names table also!
  */
 
-#define ACPI_MTX_HARDWARE           0
-#define ACPI_MTX_MEMORY             1
-#define ACPI_MTX_CACHES             2
-#define ACPI_MTX_TABLES             3
-#define ACPI_MTX_PARSER             4
-#define ACPI_MTX_DISPATCHER         5
-#define ACPI_MTX_INTERPRETER        6
-#define ACPI_MTX_EXECUTE            7
-#define ACPI_MTX_NAMESPACE          8
-#define ACPI_MTX_EVENTS             9
-#define ACPI_MTX_OP_REGIONS         10
-#define ACPI_MTX_DEBUG_CMD_READY    11
-#define ACPI_MTX_DEBUG_CMD_COMPLETE 12
+#define ACPI_MTX_EXECUTE                0
+#define ACPI_MTX_INTERPRETER            1
+#define ACPI_MTX_PARSER                 2
+#define ACPI_MTX_DISPATCHER             3
+#define ACPI_MTX_TABLES                 4
+#define ACPI_MTX_OP_REGIONS             5
+#define ACPI_MTX_NAMESPACE              6
+#define ACPI_MTX_EVENTS                 7
+#define ACPI_MTX_HARDWARE               8
+#define ACPI_MTX_CACHES                 9
+#define ACPI_MTX_MEMORY                 10
+#define ACPI_MTX_DEBUG_CMD_COMPLETE     11
+#define ACPI_MTX_DEBUG_CMD_READY        12
 
-#define MAX_MTX                     12
-#define NUM_MTX                     MAX_MTX+1
+#define MAX_MTX                         12
+#define NUM_MTX                         MAX_MTX+1
 
 
 #if defined(ACPI_DEBUG) || defined(ENABLE_DEBUGGER)
@@ -81,19 +89,19 @@
 
 static NATIVE_CHAR          *acpi_gbl_mutex_names[] =
 {
-	"ACPI_MTX_Hardware",
-	"ACPI_MTX_Memory",
-	"ACPI_MTX_Caches",
-	"ACPI_MTX_Tables",
+	"ACPI_MTX_Execute",
+	"ACPI_MTX_Interpreter",
 	"ACPI_MTX_Parser",
 	"ACPI_MTX_Dispatcher",
-	"ACPI_MTX_Interpreter",
-	"ACPI_MTX_Execute",
+	"ACPI_MTX_Tables",
+	"ACPI_MTX_Op_regions",
 	"ACPI_MTX_Namespace",
 	"ACPI_MTX_Events",
-	"ACPI_MTX_Op_regions",
+	"ACPI_MTX_Hardware",
+	"ACPI_MTX_Caches",
+	"ACPI_MTX_Memory",
+	"ACPI_MTX_Debug_cmd_complete",
 	"ACPI_MTX_Debug_cmd_ready",
-	"ACPI_MTX_Debug_cmd_complete"
 };
 
 #endif
@@ -106,26 +114,38 @@
 {
 	ACPI_MUTEX                  mutex;
 	u32                         use_count;
-	u8                          locked;
+	u32                         owner_id;
 
 } ACPI_MUTEX_INFO;
 
+/* This owner ID means that the mutex is not in use (unlocked) */
+
+#define ACPI_MUTEX_NOT_ACQUIRED         (u32) (-1)
+
 
 /* Lock flag parameter for various interfaces */
 
-#define ACPI_MTX_DO_NOT_LOCK        0
-#define ACPI_MTX_LOCK               1
+#define ACPI_MTX_DO_NOT_LOCK            0
+#define ACPI_MTX_LOCK                   1
 
 
-typedef u16                         ACPI_OWNER_ID;
-#define OWNER_TYPE_TABLE            0x0
-#define OWNER_TYPE_METHOD           0x1
-#define FIRST_METHOD_ID             0x0000
-#define FIRST_TABLE_ID              0x8000
+typedef u16                             ACPI_OWNER_ID;
+#define OWNER_TYPE_TABLE                0x0
+#define OWNER_TYPE_METHOD               0x1
+#define FIRST_METHOD_ID                 0x0000
+#define FIRST_TABLE_ID                  0x8000
 
 /* TBD: [Restructure] get rid of the need for this! */
 
-#define TABLE_ID_DSDT               (ACPI_OWNER_ID) 0x8000
+#define TABLE_ID_DSDT                   (ACPI_OWNER_ID) 0x8000
+
+
+/* Field access granularities */
+
+#define ACPI_FIELD_BYTE_GRANULARITY     1
+#define ACPI_FIELD_WORD_GRANULARITY     2
+#define ACPI_FIELD_DWORD_GRANULARITY    4
+#define ACPI_FIELD_QWORD_GRANULARITY    8
 
 /*****************************************************************************
  *
@@ -175,13 +195,15 @@
 
 /* Node flags */
 
-#define ANOBJ_AML_ATTACHMENT        0x01
-#define ANOBJ_END_OF_PEER_LIST      0x02
-#define ANOBJ_DATA_WIDTH_32         0x04     /* Parent table is 64-bits */
-#define ANOBJ_METHOD_ARG            0x08
-#define ANOBJ_METHOD_LOCAL          0x10
-#define ANOBJ_METHOD_NO_RETVAL      0x20
-#define ANOBJ_METHOD_SOME_NO_RETVAL 0x40
+#define ANOBJ_AML_ATTACHMENT            0x01
+#define ANOBJ_END_OF_PEER_LIST          0x02
+#define ANOBJ_DATA_WIDTH_32             0x04     /* Parent table is 64-bits */
+#define ANOBJ_METHOD_ARG                0x08
+#define ANOBJ_METHOD_LOCAL              0x10
+#define ANOBJ_METHOD_NO_RETVAL          0x20
+#define ANOBJ_METHOD_SOME_NO_RETVAL     0x40
+
+#define ANOBJ_IS_BIT_OFFSET             0x80
 
 
 /*
@@ -225,19 +247,36 @@
 /*
  * Predefined Namespace items
  */
-#define ACPI_MAX_ADDRESS_SPACE      255
-#define ACPI_NUM_ADDRESS_SPACES     256
-
-
 typedef struct
 {
 	NATIVE_CHAR             *name;
-	ACPI_OBJECT_TYPE        type;
+	ACPI_OBJECT_TYPE8       type;
 	NATIVE_CHAR             *val;
 
 } PREDEFINED_NAMES;
 
 
+/* Object types used during package copies */
+
+
+#define ACPI_COPY_TYPE_SIMPLE           0
+#define ACPI_COPY_TYPE_PACKAGE          1
+
+/* Info structure used to convert external<->internal namestrings */
+
+typedef struct acpi_namestring_info
+{
+	NATIVE_CHAR             *external_name;
+	NATIVE_CHAR             *next_external_char;
+	NATIVE_CHAR             *internal_name;
+	u32                     length;
+	u32                     num_segments;
+	u32                     num_carats;
+	u8                      fully_qualified;
+
+} ACPI_NAMESTRING_INFO;
+
+
 /*****************************************************************************
  *
  * Event typedefs and structs
@@ -247,19 +286,19 @@
 
 /* Status bits. */
 
-#define ACPI_STATUS_PMTIMER                  0x0001
-#define ACPI_STATUS_GLOBAL                   0x0020
-#define ACPI_STATUS_POWER_BUTTON             0x0100
-#define ACPI_STATUS_SLEEP_BUTTON             0x0200
-#define ACPI_STATUS_RTC_ALARM                0x0400
+#define ACPI_STATUS_PMTIMER             0x0001
+#define ACPI_STATUS_GLOBAL              0x0020
+#define ACPI_STATUS_POWER_BUTTON        0x0100
+#define ACPI_STATUS_SLEEP_BUTTON        0x0200
+#define ACPI_STATUS_RTC_ALARM           0x0400
 
 /* Enable bits. */
 
-#define ACPI_ENABLE_PMTIMER                  0x0001
-#define ACPI_ENABLE_GLOBAL                   0x0020
-#define ACPI_ENABLE_POWER_BUTTON             0x0100
-#define ACPI_ENABLE_SLEEP_BUTTON             0x0200
-#define ACPI_ENABLE_RTC_ALARM                0x0400
+#define ACPI_ENABLE_PMTIMER             0x0001
+#define ACPI_ENABLE_GLOBAL              0x0020
+#define ACPI_ENABLE_POWER_BUTTON        0x0100
+#define ACPI_ENABLE_SLEEP_BUTTON        0x0200
+#define ACPI_ENABLE_RTC_ALARM           0x0400
 
 
 /*
@@ -268,10 +307,10 @@
 
 typedef struct
 {
-	ADDRESS_SPACE_HANDLER   handler;
+	ACPI_ADR_SPACE_HANDLER  handler;
 	void                    *context;
 
-} ACPI_ADDRESS_SPACE_INFO;
+} ACPI_ADR_SPACE_INFO;
 
 
 /* Values and addresses of the GPE registers (both banks) */
@@ -287,8 +326,8 @@
 } ACPI_GPE_REGISTERS;
 
 
-#define ACPI_GPE_LEVEL_TRIGGERED            1
-#define ACPI_GPE_EDGE_TRIGGERED             2
+#define ACPI_GPE_LEVEL_TRIGGERED        1
+#define ACPI_GPE_EDGE_TRIGGERED         2
 
 
 /* Information about each particular GPE level */
@@ -298,7 +337,7 @@
 	u8                      type;           /* Level or Edge */
 
 	ACPI_HANDLE             method_handle;  /* Method handle for direct (fast) execution */
-	GPE_HANDLER             handler;        /* Address of handler, if any */
+	ACPI_GPE_HANDLER        handler;        /* Address of handler, if any */
 	void                    *context;       /* Context to be passed to handler */
 
 } ACPI_GPE_LEVEL_INFO;
@@ -308,7 +347,7 @@
 
 typedef struct
 {
-	FIXED_EVENT_HANDLER     handler;        /* Address of handler. */
+	ACPI_EVENT_HANDLER      handler;        /* Address of handler. */
 	void                    *context;       /* Context to be passed to handler */
 
 } ACPI_FIXED_EVENT_INFO;
@@ -332,16 +371,18 @@
  ****************************************************************************/
 
 
-#define CONTROL_NORMAL                        0xC0
-#define CONTROL_CONDITIONAL_EXECUTING         0xC1
-#define CONTROL_PREDICATE_EXECUTING           0xC2
-#define CONTROL_PREDICATE_FALSE               0xC3
-#define CONTROL_PREDICATE_TRUE                0xC4
+#define CONTROL_NORMAL                  0xC0
+#define CONTROL_CONDITIONAL_EXECUTING   0xC1
+#define CONTROL_PREDICATE_EXECUTING     0xC2
+#define CONTROL_PREDICATE_FALSE         0xC3
+#define CONTROL_PREDICATE_TRUE          0xC4
 
 
-/* Forward declaration */
+/* Forward declarations */
 struct acpi_walk_state;
-struct acpi_parse_obj ;
+struct acpi_walk_list;
+struct acpi_parse_obj;
+struct acpi_obj_mutex;
 
 
 #define ACPI_STATE_COMMON                  /* Two 32-bit fields and a pointer */\
@@ -401,7 +442,6 @@
 /*
  * Scope state - current scope during namespace lookups
  */
-
 typedef struct acpi_scope_state
 {
 	ACPI_STATE_COMMON
@@ -436,6 +476,19 @@
 } ACPI_RESULT_VALUES;
 
 
+/*
+ * Notify info - used to pass info to the deferred notify
+ * handler/dispatcher.
+ */
+typedef struct acpi_notify_info
+{
+	ACPI_STATE_COMMON
+	ACPI_NAMESPACE_NODE     *node;
+	union acpi_operand_obj  *handler_obj;
+
+} ACPI_NOTIFY_INFO;
+
+
 /* Generic state is union of structs above */
 
 typedef union acpi_gen_state
@@ -447,6 +500,7 @@
 	ACPI_PSCOPE_STATE       parse_scope;
 	ACPI_PKG_STATE          pkg;
 	ACPI_RESULT_VALUES      results;
+	ACPI_NOTIFY_INFO        notify;
 
 } ACPI_GENERIC_STATE;
 
@@ -470,19 +524,18 @@
  *
  ****************************************************************************/
 
-
-#define ACPI_OP_CLASS_MASK          0x1F
-#define ACPI_OP_ARGS_MASK           0x20
-#define ACPI_OP_TYPE_MASK           0xC0
-
-#define ACPI_OP_TYPE_OPCODE         0x00
-#define ACPI_OP_TYPE_ASCII          0x40
-#define ACPI_OP_TYPE_PREFIX         0x80
-#define ACPI_OP_TYPE_UNKNOWN        0xC0
-
-#define ACPI_GET_OP_CLASS(a)        ((a)->flags & ACPI_OP_CLASS_MASK)
-#define ACPI_GET_OP_ARGS(a)         ((a)->flags & ACPI_OP_ARGS_MASK)
-#define ACPI_GET_OP_TYPE(a)         ((a)->flags & ACPI_OP_TYPE_MASK)
+#define ACPI_OP_CLASS_MASK              0x1F
+#define ACPI_OP_ARGS_MASK               0x20
+#define ACPI_OP_TYPE_MASK               0xC0
+
+#define ACPI_OP_TYPE_OPCODE             0x00
+#define ACPI_OP_TYPE_ASCII              0x40
+#define ACPI_OP_TYPE_PREFIX             0x80
+#define ACPI_OP_TYPE_UNKNOWN            0xC0
+
+#define ACPI_GET_OP_CLASS(a)            ((a)->flags & ACPI_OP_CLASS_MASK)
+#define ACPI_GET_OP_ARGS(a)             ((a)->flags & ACPI_OP_ARGS_MASK)
+#define ACPI_GET_OP_TYPE(a)             ((a)->flags & ACPI_OP_TYPE_MASK)
 
 
 /*
@@ -572,130 +625,6 @@
 
 /*****************************************************************************
  *
- * Tree walking typedefs and structs
- *
- ****************************************************************************/
-
-
-/*
- * Walk state - current state of a parse tree walk.  Used for both a leisurely stroll through
- * the tree (for whatever reason), and for control method execution.
- */
-
-#define NEXT_OP_DOWNWARD    1
-#define NEXT_OP_UPWARD      2
-
-#define WALK_NON_METHOD     0
-#define WALK_METHOD         1
-#define WALK_METHOD_RESTART 2
-
-typedef struct acpi_walk_state
-{
-	u8                      data_type;                          /* To differentiate various internal objs */\
-	ACPI_OWNER_ID           owner_id;                           /* Owner of objects created during the walk */
-	u8                      last_predicate;                     /* Result of last predicate */
-	u8                      next_op_info;                       /* Info about Next_op */
-	u8                      num_operands;                       /* Stack pointer for Operands[] array */
-	u8                      current_result;                     /* */
-
-	struct acpi_walk_state  *next;                              /* Next Walk_state in list */
-	ACPI_PARSE_OBJECT       *origin;                            /* Start of walk [Obsolete] */
-
-/* TBD: Obsolete with removal of WALK procedure ? */
-	ACPI_PARSE_OBJECT       *prev_op;                           /* Last op that was processed */
-	ACPI_PARSE_OBJECT       *next_op;                           /* next op to be processed */
-
-
-	ACPI_GENERIC_STATE      *results;                           /* Stack of accumulated results */
-	ACPI_GENERIC_STATE      *control_state;                     /* List of control states (nested IFs) */
-	ACPI_GENERIC_STATE      *scope_info;                        /* Stack of nested scopes */
-	ACPI_PARSE_STATE        *parser_state;                      /* Current state of parser */
-	u8                      *aml_last_while;
-	ACPI_OPCODE_INFO        *op_info;                           /* Info on current opcode */
-	ACPI_PARSE_DOWNWARDS    descending_callback;
-	ACPI_PARSE_UPWARDS      ascending_callback;
-
-	union acpi_operand_obj  *return_desc;                       /* Return object, if any */
-	union acpi_operand_obj  *method_desc;                       /* Method descriptor if running a method */
-	struct acpi_node        *method_node;                       /* Method Node if running a method */
-	ACPI_PARSE_OBJECT       *method_call_op;                    /* Method_call Op if running a method */
-	struct acpi_node        *method_call_node;                  /* Called method Node*/
-	union acpi_operand_obj  *operands[OBJ_NUM_OPERANDS];        /* Operands passed to the interpreter */
-	struct acpi_node        arguments[MTH_NUM_ARGS];            /* Control method arguments */
-	struct acpi_node        local_variables[MTH_NUM_LOCALS];    /* Control method locals */
-	u32                     parse_flags;
-	u8                      walk_type;
-	u8                      return_used;
-	u16                     opcode;                             /* Current AML opcode */
-	u32                     prev_arg_types;
-
-	/* Debug support */
-
-	u32                     method_breakpoint;
-
-
-} ACPI_WALK_STATE;
-
-
-/*
- * Walk list - head of a tree of walk states.  Multiple walk states are created when there
- * are nested control methods executing.
- */
-typedef struct acpi_walk_list
-{
-
-	ACPI_WALK_STATE         *walk_state;
-
-} ACPI_WALK_LIST;
-
-
-/* Info used by Acpi_ps_init_objects */
-
-typedef struct acpi_init_walk_info
-{
-	u16                     method_count;
-	u16                     op_region_count;
-	u16                     field_count;
-	u16                     op_region_init;
-	u16                     field_init;
-	u16                     object_count;
-	ACPI_TABLE_DESC         *table_desc;
-
-} ACPI_INIT_WALK_INFO;
-
-
-/* Info used by TBD */
-
-typedef struct acpi_device_walk_info
-{
-	u16                     device_count;
-	u16                     num_STA;
-	u16                     num_INI;
-	ACPI_TABLE_DESC         *table_desc;
-
-} ACPI_DEVICE_WALK_INFO;
-
-
-/* TBD: [Restructure] Merge with struct above */
-
-typedef struct acpi_walk_info
-{
-	u32                     debug_level;
-	u32                     owner_id;
-
-} ACPI_WALK_INFO;
-
-typedef struct acpi_get_devices_info
-{
-	WALK_CALLBACK           user_function;
-	void                    *context;
-	NATIVE_CHAR             *hid;
-
-} ACPI_GET_DEVICES_INFO;
-
-
-/*****************************************************************************
- *
  * Hardware and PNP
  *
  ****************************************************************************/
@@ -703,20 +632,20 @@
 
 /* PCI */
 
-#define PCI_ROOT_HID_STRING         "PNP0A03"
-#define PCI_ROOT_HID_VALUE          0x030AD041       /* EISAID("PNP0A03") */
+#define PCI_ROOT_HID_STRING             "PNP0A03"
+#define PCI_ROOT_HID_VALUE              0x030AD041       /* EISAID("PNP0A03") */
 
 
 /* Sleep states */
 
-#define SLWA_DEBUG_LEVEL            4
-#define GTS_CALL                    0
-#define GTS_WAKE                    1
+#define SLWA_DEBUG_LEVEL                4
+#define GTS_CALL                        0
+#define GTS_WAKE                        1
 
 /* Cx States */
 
-#define MAX_CX_STATE_LATENCY        0xFFFFFFFF
-#define MAX_CX_STATES               4
+#define MAX_CX_STATE_LATENCY            0xFFFFFFFF
+#define MAX_CX_STATES                   4
 
 
 /*
@@ -725,13 +654,13 @@
  * values as they are used in switch statements and offset calculations.
  */
 
-#define REGISTER_BLOCK_MASK         0xFF00  /* Register Block Id    */
-#define BIT_IN_REGISTER_MASK        0x00FF  /* Bit Id in the Register Block Id    */
-#define BYTE_IN_REGISTER_MASK       0x00FF  /* Register Offset in the Register Block    */
-
-#define REGISTER_BLOCK_ID(reg_id)   (reg_id & REGISTER_BLOCK_MASK)
-#define REGISTER_BIT_ID(reg_id)     (reg_id & BIT_IN_REGISTER_MASK)
-#define REGISTER_OFFSET(reg_id)     (reg_id & BYTE_IN_REGISTER_MASK)
+#define REGISTER_BLOCK_MASK             0xFF00  /* Register Block Id    */
+#define BIT_IN_REGISTER_MASK            0x00FF  /* Bit Id in the Register Block Id    */
+#define BYTE_IN_REGISTER_MASK           0x00FF  /* Register Offset in the Register Block    */
+
+#define REGISTER_BLOCK_ID(reg_id)       (reg_id & REGISTER_BLOCK_MASK)
+#define REGISTER_BIT_ID(reg_id)         (reg_id & BIT_IN_REGISTER_MASK)
+#define REGISTER_OFFSET(reg_id)         (reg_id & BYTE_IN_REGISTER_MASK)
 
 /*
  * Access Rule
@@ -746,94 +675,94 @@
 /*
  * Register Block Id
  */
-#define PM1_STS                     0x0100
-#define PM1_EN                      0x0200
-#define PM1_CONTROL                 0x0300
-#define PM1_a_CONTROL               0x0400
-#define PM1_b_CONTROL               0x0500
-#define PM2_CONTROL                 0x0600
-#define PM_TIMER                    0x0700
-#define PROCESSOR_BLOCK             0x0800
-#define GPE0_STS_BLOCK              0x0900
-#define GPE0_EN_BLOCK               0x0A00
-#define GPE1_STS_BLOCK              0x0B00
-#define GPE1_EN_BLOCK               0x0C00
-#define SMI_CMD_BLOCK               0x0D00
+#define PM1_STS                         0x0100
+#define PM1_EN                          0x0200
+#define PM1_CONTROL                     0x0300
+#define PM1_a_CONTROL                   0x0400
+#define PM1_b_CONTROL                   0x0500
+#define PM2_CONTROL                     0x0600
+#define PM_TIMER                        0x0700
+#define PROCESSOR_BLOCK                 0x0800
+#define GPE0_STS_BLOCK                  0x0900
+#define GPE0_EN_BLOCK                   0x0A00
+#define GPE1_STS_BLOCK                  0x0B00
+#define GPE1_EN_BLOCK                   0x0C00
+#define SMI_CMD_BLOCK                   0x0D00
 
 /*
  * Address space bitmasks for mmio or io spaces
  */
 
-#define SMI_CMD_ADDRESS_SPACE       0x01
-#define PM1_BLK_ADDRESS_SPACE       0x02
-#define PM2_CNT_BLK_ADDRESS_SPACE   0x04
-#define PM_TMR_BLK_ADDRESS_SPACE    0x08
-#define GPE0_BLK_ADDRESS_SPACE      0x10
-#define GPE1_BLK_ADDRESS_SPACE      0x20
+#define SMI_CMD_ADDRESS_SPACE           0x01
+#define PM1_BLK_ADDRESS_SPACE           0x02
+#define PM2_CNT_BLK_ADDRESS_SPACE       0x04
+#define PM_TMR_BLK_ADDRESS_SPACE        0x08
+#define GPE0_BLK_ADDRESS_SPACE          0x10
+#define GPE1_BLK_ADDRESS_SPACE          0x20
 
 /*
  * Control bit definitions
  */
-#define TMR_STS                     (PM1_STS | 0x01)
-#define BM_STS                      (PM1_STS | 0x02)
-#define GBL_STS                     (PM1_STS | 0x03)
-#define PWRBTN_STS                  (PM1_STS | 0x04)
-#define SLPBTN_STS                  (PM1_STS | 0x05)
-#define RTC_STS                     (PM1_STS | 0x06)
-#define WAK_STS                     (PM1_STS | 0x07)
-
-#define TMR_EN                      (PM1_EN | 0x01)
-			   /* no BM_EN */
-#define GBL_EN                      (PM1_EN | 0x03)
-#define PWRBTN_EN                   (PM1_EN | 0x04)
-#define SLPBTN_EN                   (PM1_EN | 0x05)
-#define RTC_EN                      (PM1_EN | 0x06)
-#define WAK_EN                      (PM1_EN | 0x07)
-
-#define SCI_EN                      (PM1_CONTROL | 0x01)
-#define BM_RLD                      (PM1_CONTROL | 0x02)
-#define GBL_RLS                     (PM1_CONTROL | 0x03)
-#define SLP_TYPE_A                  (PM1_CONTROL | 0x04)
-#define SLP_TYPE_B                  (PM1_CONTROL | 0x05)
-#define SLP_EN                      (PM1_CONTROL | 0x06)
-
-#define ARB_DIS                     (PM2_CONTROL | 0x01)
-
-#define TMR_VAL                     (PM_TIMER | 0x01)
-
-#define GPE0_STS                    (GPE0_STS_BLOCK | 0x01)
-#define GPE0_EN                     (GPE0_EN_BLOCK  | 0x01)
-
-#define GPE1_STS                    (GPE1_STS_BLOCK | 0x01)
-#define GPE1_EN                     (GPE1_EN_BLOCK  | 0x01)
-
-
-#define TMR_STS_MASK                0x0001
-#define BM_STS_MASK                 0x0010
-#define GBL_STS_MASK                0x0020
-#define PWRBTN_STS_MASK             0x0100
-#define SLPBTN_STS_MASK             0x0200
-#define RTC_STS_MASK                0x0400
-#define WAK_STS_MASK                0x8000
-
-#define ALL_FIXED_STS_BITS          (TMR_STS_MASK   | BM_STS_MASK  | GBL_STS_MASK \
-					 | PWRBTN_STS_MASK | SLPBTN_STS_MASK \
-					 | RTC_STS_MASK | WAK_STS_MASK)
-
-#define TMR_EN_MASK                 0x0001
-#define GBL_EN_MASK                 0x0020
-#define PWRBTN_EN_MASK              0x0100
-#define SLPBTN_EN_MASK              0x0200
-#define RTC_EN_MASK                 0x0400
-
-#define SCI_EN_MASK                 0x0001
-#define BM_RLD_MASK                 0x0002
-#define GBL_RLS_MASK                0x0004
-#define SLP_TYPE_X_MASK             0x1C00
-#define SLP_EN_MASK                 0x2000
+#define TMR_STS                         (PM1_STS | 0x01)
+#define BM_STS                          (PM1_STS | 0x02)
+#define GBL_STS                         (PM1_STS | 0x03)
+#define PWRBTN_STS                      (PM1_STS | 0x04)
+#define SLPBTN_STS                      (PM1_STS | 0x05)
+#define RTC_STS                         (PM1_STS | 0x06)
+#define WAK_STS                         (PM1_STS | 0x07)
+
+#define TMR_EN                          (PM1_EN | 0x01)
+			 /* no BM_EN */
+#define GBL_EN                          (PM1_EN | 0x03)
+#define PWRBTN_EN                       (PM1_EN | 0x04)
+#define SLPBTN_EN                       (PM1_EN | 0x05)
+#define RTC_EN                          (PM1_EN | 0x06)
+#define WAK_EN                          (PM1_EN | 0x07)
+
+#define SCI_EN                          (PM1_CONTROL | 0x01)
+#define BM_RLD                          (PM1_CONTROL | 0x02)
+#define GBL_RLS                         (PM1_CONTROL | 0x03)
+#define SLP_TYPE_A                      (PM1_CONTROL | 0x04)
+#define SLP_TYPE_B                      (PM1_CONTROL | 0x05)
+#define SLP_EN                          (PM1_CONTROL | 0x06)
+
+#define ARB_DIS                         (PM2_CONTROL | 0x01)
+
+#define TMR_VAL                         (PM_TIMER | 0x01)
+
+#define GPE0_STS                        (GPE0_STS_BLOCK | 0x01)
+#define GPE0_EN                         (GPE0_EN_BLOCK  | 0x01)
+
+#define GPE1_STS                        (GPE1_STS_BLOCK | 0x01)
+#define GPE1_EN                         (GPE1_EN_BLOCK  | 0x01)
+
+
+#define TMR_STS_MASK                    0x0001
+#define BM_STS_MASK                     0x0010
+#define GBL_STS_MASK                    0x0020
+#define PWRBTN_STS_MASK                 0x0100
+#define SLPBTN_STS_MASK                 0x0200
+#define RTC_STS_MASK                    0x0400
+#define WAK_STS_MASK                    0x8000
+
+#define ALL_FIXED_STS_BITS              (TMR_STS_MASK   | BM_STS_MASK  | GBL_STS_MASK \
+					  | PWRBTN_STS_MASK | SLPBTN_STS_MASK \
+					  | RTC_STS_MASK | WAK_STS_MASK)
+
+#define TMR_EN_MASK                     0x0001
+#define GBL_EN_MASK                     0x0020
+#define PWRBTN_EN_MASK                  0x0100
+#define SLPBTN_EN_MASK                  0x0200
+#define RTC_EN_MASK                     0x0400
+
+#define SCI_EN_MASK                     0x0001
+#define BM_RLD_MASK                     0x0002
+#define GBL_RLS_MASK                    0x0004
+#define SLP_TYPE_X_MASK                 0x1C00
+#define SLP_EN_MASK                     0x2000
 
-#define ARB_DIS_MASK                0x0001
-#define TMR_VAL_MASK                0xFFFFFFFF
+#define ARB_DIS_MASK                    0x0001
+#define TMR_VAL_MASK                    0xFFFFFFFF
 
 #define GPE0_STS_MASK
 #define GPE0_EN_MASK
@@ -842,55 +771,87 @@
 #define GPE1_EN_MASK
 
 
-#define ACPI_READ                   1
-#define ACPI_WRITE                  2
+#define ACPI_READ                       1
+#define ACPI_WRITE                      2
+
+
+/*****************************************************************************
+ *
+ * Resource descriptors
+ *
+ ****************************************************************************/
+
+
+/* Resource_type values */
+
+#define RESOURCE_TYPE_MEMORY_RANGE              0
+#define RESOURCE_TYPE_IO_RANGE                  1
+#define RESOURCE_TYPE_BUS_NUMBER_RANGE          2
+
+/* Resource descriptor types and masks */
+
+#define RESOURCE_DESC_TYPE_LARGE                0x80
+#define RESOURCE_DESC_TYPE_SMALL                0x00
+
+#define RESOURCE_DESC_TYPE_MASK                 0x80
+#define RESOURCE_DESC_SMALL_MASK                0x78        /* Only bits 6:3 contain the type */
 
 
-/* Plug and play */
+/*
+ * Small resource descriptor types
+ * Note: The 3 length bits (2:0) must be zero
+ */
+#define RESOURCE_DESC_IRQ_FORMAT                0x20
+#define RESOURCE_DESC_DMA_FORMAT                0x28
+#define RESOURCE_DESC_START_DEPENDENT           0x30
+#define RESOURCE_DESC_END_DEPENDENT             0x38
+#define RESOURCE_DESC_IO_PORT                   0x40
+#define RESOURCE_DESC_FIXED_IO_PORT             0x48
+#define RESOURCE_DESC_SMALL_VENDOR              0x70
+#define RESOURCE_DESC_END_TAG                   0x78
+
+/*
+ * Large resource descriptor types
+ */
 
-/* Pnp and ACPI data */
+#define RESOURCE_DESC_MEMORY_24                 0x81
+#define RESOURCE_DESC_GENERAL_REGISTER          0x82
+#define RESOURCE_DESC_LARGE_VENDOR              0x84
+#define RESOURCE_DESC_MEMORY_32                 0x85
+#define RESOURCE_DESC_FIXED_MEMORY_32           0x86
+#define RESOURCE_DESC_DWORD_ADDRESS_SPACE       0x87
+#define RESOURCE_DESC_WORD_ADDRESS_SPACE        0x88
+#define RESOURCE_DESC_EXTENDED_XRUPT            0x89
+#define RESOURCE_DESC_QWORD_ADDRESS_SPACE       0x8A
 
-#define VERSION_NO                      0x01
-#define LOGICAL_DEVICE_ID               0x02
-#define COMPATIBLE_DEVICE_ID            0x03
-#define IRQ_FORMAT                      0x04
-#define DMA_FORMAT                      0x05
-#define START_DEPENDENT_TAG             0x06
-#define END_DEPENDENT_TAG               0x07
-#define IO_PORT_DESCRIPTOR              0x08
-#define FIXED_LOCATION_IO_DESCRIPTOR    0x09
-#define RESERVED_TYPE0                  0x0A
-#define RESERVED_TYPE1                  0x0B
-#define RESERVED_TYPE2                  0x0C
-#define RESERVED_TYPE3                  0x0D
-#define SMALL_VENDOR_DEFINED            0x0E
-#define END_TAG                         0x0F
-
-/* Pnp and ACPI data */
-
-#define MEMORY_RANGE_24                 0x81
-#define ISA_MEMORY_RANGE                0x81
-#define LARGE_VENDOR_DEFINED            0x84
-#define EISA_MEMORY_RANGE               0x85
-#define MEMORY_RANGE_32                 0x85
-#define FIXED_EISA_MEMORY_RANGE         0x86
-#define FIXED_MEMORY_RANGE_32           0x86
-
-/* ACPI only data */
-
-#define DWORD_ADDRESS_SPACE             0x87
-#define WORD_ADDRESS_SPACE              0x88
-#define EXTENDED_IRQ                    0x89
 
-/* MUST HAVES */
+/* String version of device HIDs and UIDs */
 
-#define DEVICE_ID_LENGTH                0x09
+#define ACPI_DEVICE_ID_LENGTH                   0x09
 
 typedef struct
 {
-		NATIVE_CHAR         buffer[DEVICE_ID_LENGTH];
+	NATIVE_CHAR             buffer[ACPI_DEVICE_ID_LENGTH];
+
+} ACPI_DEVICE_ID;
+
+
+/*****************************************************************************
+ *
+ * Debugger
+ *
+ ****************************************************************************/
+
+typedef struct dbmethodinfo
+{
+	ACPI_HANDLE             thread_gate;
+	NATIVE_CHAR             *name;
+	NATIVE_CHAR             **args;
+	u32                     flags;
+	u32                     num_loops;
+	NATIVE_CHAR             pathname[128];
 
-} DEVICE_ID;
+} DB_METHOD_INFO;
 
 
 /*****************************************************************************
@@ -904,22 +865,22 @@
 
 #ifdef ACPI_DEBUG
 
-#define MEM_MALLOC          0
-#define MEM_CALLOC          1
-#define MAX_MODULE_NAME     16
-
-typedef struct allocation_info
-{
-	struct allocation_info  *previous;
-	struct allocation_info  *next;
-	void                    *address;
-	u32                     size;
-	u32                     component;
-	u32                     line;
-	NATIVE_CHAR             module[MAX_MODULE_NAME];
-	u8                      alloc_type;
+#define MEM_MALLOC                      0
+#define MEM_CALLOC                      1
+#define MAX_MODULE_NAME                 16
+
+typedef struct acpi_allocation_info
+{
+	struct acpi_allocation_info *previous;
+	struct acpi_allocation_info *next;
+	void                        *address;
+	u32                         size;
+	u32                         component;
+	u32                         line;
+	NATIVE_CHAR                 module[MAX_MODULE_NAME];
+	u8                          alloc_type;
 
-} ALLOCATION_INFO;
+} ACPI_ALLOCATION_INFO;
 
 #endif
 
diff -urN linux-2.4.6-pre4/drivers/acpi/include/acmacros.h linux/drivers/acpi/include/acmacros.h
--- linux-2.4.6-pre4/drivers/acpi/include/acmacros.h	Mon Jan 22 13:23:42 2001
+++ linux/drivers/acpi/include/acmacros.h	Mon Dec  3 22:48:42 2001
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Name: acmacros.h - C macros for the entire subsystem.
- *       $Revision: 62 $
+ *       $Revision: 72 $
  *
  *****************************************************************************/
 
@@ -88,12 +88,18 @@
 #define ACPI_STORE_ADDRESS(a,b)         ((a)=(b))
 #define ACPI_VALID_ADDRESS(a)           (a)
 #endif
+
  /*
   * Extract a byte of data using a pointer.  Any more than a byte and we
   * get into potential aligment issues -- see the STORE macros below
   */
 #define GET8(addr)                      (*(u8*)(addr))
 
+/* Pointer arithmetic */
+
+
+#define POINTER_ADD(t,a,b)              (t *) ((NATIVE_UINT)(a) + (NATIVE_UINT)(b))
+#define POINTER_DIFF(a,b)               ((u32) ((NATIVE_UINT)(a) - (NATIVE_UINT)(b)))
 
 /*
  * Macros for moving data around to/from buffers that are possibly unaligned.
@@ -108,6 +114,7 @@
 #define MOVE_UNALIGNED16_TO_16(d,s)     *(u16*)(d) = *(u16*)(s)
 #define MOVE_UNALIGNED32_TO_32(d,s)     *(u32*)(d) = *(u32*)(s)
 #define MOVE_UNALIGNED16_TO_32(d,s)     *(u32*)(d) = *(u16*)(s)
+#define MOVE_UNALIGNED64_TO_64(d,s)     *(UINT64*)(d) = *(UINT64*)(s)
 
 #else
 /*
@@ -126,6 +133,15 @@
 
 #define MOVE_UNALIGNED16_TO_32(d,s)     {(*(u32*)(d)) = 0; MOVE_UNALIGNED16_TO_16(d,s);}
 
+#define MOVE_UNALIGNED64_TO_64(d,s)     {((u8 *)(d))[0] = ((u8 *)(s))[0];\
+					   ((u8 *)(d))[1] = ((u8 *)(s))[1];\
+					   ((u8 *)(d))[2] = ((u8 *)(s))[2];\
+					   ((u8 *)(d))[3] = ((u8 *)(s))[3];\
+					   ((u8 *)(d))[4] = ((u8 *)(s))[4];\
+					   ((u8 *)(d))[5] = ((u8 *)(s))[5];\
+					   ((u8 *)(d))[6] = ((u8 *)(s))[6];\
+					   ((u8 *)(d))[7] = ((u8 *)(s))[7];}
+
 #endif
 
 
@@ -177,8 +193,26 @@
 #define ROUND_PTR_UP_TO_4(a,b)          ((b *)(((NATIVE_UINT)(a) + 3) & ~3))
 #define ROUND_PTR_UP_TO_8(a,b)          ((b *)(((NATIVE_UINT)(a) + 7) & ~7))
 
+#define ROUND_BITS_UP_TO_BYTES(a)       DIV_8((a) + 7)
+#define ROUND_BITS_DOWN_TO_BYTES(a)     DIV_8((a))
+
 #define ROUND_UP_TO_1_k(a)              (((a) + 1023) >> 10)
 
+/* Generic (non-power-of-two) rounding */
+
+#define ROUND_UP_TO(value,boundary)     (((value) + ((boundary)-1)) / (boundary))
+
+/*
+ * Bitmask creation
+ * Bit positions start at zero.
+ * MASK_BITS_ABOVE creates a mask starting AT the position and above
+ * MASK_BITS_BELOW creates a mask starting one bit BELOW the position
+ */
+
+
+#define MASK_BITS_ABOVE(position)       (~(((u32)(-1)) << ((u32) (position))))
+#define MASK_BITS_BELOW(position)       (((u32)(-1)) << ((u32) (position)))
+
 #ifdef DEBUG_ASSERT
 #undef DEBUG_ASSERT
 #endif
@@ -222,6 +256,10 @@
 
 #define IS_SINGLE_TABLE(x)              (((x) & 0x01) == ACPI_TABLE_SINGLE ? 1 : 0)
 
+/* Check if ACPI has been initialized properly */
+
+#define ACPI_IS_INITIALIZATION_COMPLETE(s)  {if (acpi_gbl_root_node) s = AE_OK; else s=AE_NO_NAMESPACE;}
+
 /*
  * Macro to check if a pointer is within an ACPI table.
  * Parameter (a) is the pointer to check.  Parameter (b) must be defined
@@ -231,12 +269,12 @@
 
 #ifndef _IA16
 #define IS_IN_ACPI_TABLE(a,b)           (((u8 *)(a) >= (u8 *)(b + 1)) &&\
-					  ((u8 *)(a) < ((u8 *)b + b->length)))
+							   ((u8 *)(a) < ((u8 *)b + b->length)))
 
 #else
 #define IS_IN_ACPI_TABLE(a,b)           (_segment)(a) == (_segment)(b) &&\
-							   (((u8 *)(a) >= (u8 *)(b + 1)) &&\
-							   ((u8 *)(a) < ((u8 *)b + b->length)))
+									 (((u8 *)(a) >= (u8 *)(b + 1)) &&\
+									 ((u8 *)(a) < ((u8 *)b + b->length)))
 #endif
 
 /*
@@ -276,6 +314,26 @@
 
 
 /*
+ * Build a GAS structure from earlier ACPI table entries (V1.0 and 0.71 extensions)
+ *
+ * 1) Address space
+ * 2) Length in bytes -- convert to length in bits
+ * 3) Bit offset is zero
+ * 4) Reserved field is zero
+ * 5) Expand address to 64 bits
+ */
+#define ASL_BUILD_GAS_FROM_ENTRY(a,b,c,d)   {a.address_space_id = (u8) d;\
+											 a.register_bit_width = (u8) MUL_8 (b);\
+											 a.register_bit_offset = 0;\
+											 a.reserved = 0;\
+											 ACPI_STORE_ADDRESS (a.address,c);}
+
+/* ACPI V1.0 entries -- address space is always I/O */
+
+#define ASL_BUILD_GAS_FROM_V1_ENTRY(a,b,c)  ASL_BUILD_GAS_FROM_ENTRY(a,b,c,ACPI_ADR_SPACE_SYSTEM_IO)
+
+
+/*
  * Reporting macros that are never compiled out
  */
 
@@ -290,7 +348,7 @@
 #ifdef ACPI_DEBUG
 
 #define REPORT_INFO(fp)                 {_report_info(_THIS_MODULE,__LINE__,_COMPONENT); \
-									  debug_print_raw PARAM_LIST(fp);}
+											debug_print_raw PARAM_LIST(fp);}
 #define REPORT_ERROR(fp)                {_report_error(_THIS_MODULE,__LINE__,_COMPONENT); \
 											debug_print_raw PARAM_LIST(fp);}
 #define REPORT_WARNING(fp)              {_report_warning(_THIS_MODULE,__LINE__,_COMPONENT); \
@@ -318,7 +376,7 @@
 
 /* Buffer dump macros */
 
-#define DUMP_BUFFER(a,b)                acpi_cm_dump_buffer((u8 *)a,b,DB_BYTE_DISPLAY,_COMPONENT)
+#define DUMP_BUFFER(a,b)                acpi_ut_dump_buffer((u8 *)a,b,DB_BYTE_DISPLAY,_COMPONENT)
 
 /*
  * Debug macros that are conditionally compiled
@@ -334,6 +392,7 @@
  * as a local string ("_Proc_name) so that it can be also used by the function exit macros below.
  */
 
+#define PROC_NAME(a)                    char * _proc_name = a;
 #define FUNCTION_TRACE(a)               char * _proc_name = a;\
 										function_trace(_THIS_MODULE,__LINE__,_COMPONENT,a)
 #define FUNCTION_TRACE_PTR(a,b)         char * _proc_name = a;\
@@ -351,7 +410,7 @@
  */
 #define return_VOID                     {function_exit(_THIS_MODULE,__LINE__,_COMPONENT,_proc_name);return;}
 #define return_ACPI_STATUS(s)           {function_status_exit(_THIS_MODULE,__LINE__,_COMPONENT,_proc_name,s);return(s);}
-#define return_VALUE(s)                 {function_value_exit(_THIS_MODULE,__LINE__,_COMPONENT,_proc_name,(ACPI_INTEGER)s);return(s);}
+#define return_VALUE(s)                 {function_value_exit(_THIS_MODULE,__LINE__,_COMPONENT,_proc_name,s);return(s);}
 #define return_PTR(s)                   {function_ptr_exit(_THIS_MODULE,__LINE__,_COMPONENT,_proc_name,(u8 *)s);return(s);}
 
 
@@ -368,8 +427,8 @@
 
 /* Stack and buffer dumping */
 
-#define DUMP_STACK_ENTRY(a)             acpi_aml_dump_operand(a)
-#define DUMP_OPERANDS(a,b,c,d,e)        acpi_aml_dump_operands(a,b,c,d,e,_THIS_MODULE,__LINE__)
+#define DUMP_STACK_ENTRY(a)             acpi_ex_dump_operand(a)
+#define DUMP_OPERANDS(a,b,c,d,e)        acpi_ex_dump_operands(a,b,c,d,e,_THIS_MODULE,__LINE__)
 
 
 #define DUMP_ENTRY(a,b)                 acpi_ns_dump_entry (a,b)
@@ -404,6 +463,12 @@
 											debug_print_raw PARAM_LIST(fp);\
 											BREAK_ON_ERROR(lvl);}
 
+#define DEBUG_PRINTP(lvl,fp)            TEST_DEBUG_SWITCH(lvl) {\
+											debug_print_prefix (_THIS_MODULE,__LINE__);\
+											debug_print_raw ("%s: ",_proc_name);\
+											debug_print_raw PARAM_LIST(fp);\
+											BREAK_ON_ERROR(lvl);}
+
 #define DEBUG_PRINT_RAW(lvl,fp)         TEST_DEBUG_SWITCH(lvl) {\
 											debug_print_raw PARAM_LIST(fp);}
 
@@ -431,6 +496,7 @@
 
 #define DEBUG_DEFINE(a)
 #define DEBUG_ONLY_MEMBERS(a)
+#define PROC_NAME(a)
 #define FUNCTION_TRACE(a)
 #define FUNCTION_TRACE_PTR(a,b)
 #define FUNCTION_TRACE_U32(a,b)
@@ -445,6 +511,7 @@
 #define DUMP_PATHNAME(a,b,c,d)
 #define DUMP_RESOURCE_LIST(a)
 #define DEBUG_PRINT(l,f)
+#define DEBUG_PRINTP(l,f)
 #define DEBUG_PRINT_RAW(l,f)
 #define BREAK_MSG(a)
 
@@ -496,6 +563,75 @@
 #define ADD_OBJECT_NAME(a,b)
 
 #endif
+
+
+/*
+ * Memory allocation tracking (DEBUG ONLY)
+ */
+
+#ifndef ACPI_DEBUG_TRACK_ALLOCATIONS
+
+#define acpi_ut_add_element_to_alloc_list(a,b,c,d,e,f)
+#define acpi_ut_delete_element_from_alloc_list(a,b,c,d)
+#define acpi_ut_dump_current_allocations(a,b)
+#define acpi_ut_dump_allocation_info()
+
+#define DECREMENT_OBJECT_METRICS(a)
+#define INCREMENT_OBJECT_METRICS(a)
+#define INITIALIZE_ALLOCATION_METRICS()
+#define DECREMENT_NAME_TABLE_METRICS(a)
+#define INCREMENT_NAME_TABLE_METRICS(a)
+
+#else
+
+#define INITIALIZE_ALLOCATION_METRICS() \
+	acpi_gbl_current_object_count = 0; \
+	acpi_gbl_current_object_size = 0; \
+	acpi_gbl_running_object_count = 0; \
+	acpi_gbl_running_object_size = 0; \
+	acpi_gbl_max_concurrent_object_count = 0; \
+	acpi_gbl_max_concurrent_object_size = 0; \
+	acpi_gbl_current_alloc_size = 0; \
+	acpi_gbl_current_alloc_count = 0; \
+	acpi_gbl_running_alloc_size = 0; \
+	acpi_gbl_running_alloc_count = 0; \
+	acpi_gbl_max_concurrent_alloc_size = 0; \
+	acpi_gbl_max_concurrent_alloc_count = 0; \
+	acpi_gbl_current_node_count = 0; \
+	acpi_gbl_current_node_size = 0; \
+	acpi_gbl_max_concurrent_node_count = 0
+
+
+#define DECREMENT_OBJECT_METRICS(a) \
+	acpi_gbl_current_object_count--; \
+	acpi_gbl_current_object_size -= a
+
+#define INCREMENT_OBJECT_METRICS(a) \
+	acpi_gbl_current_object_count++; \
+	acpi_gbl_running_object_count++; \
+	if (acpi_gbl_max_concurrent_object_count < acpi_gbl_current_object_count) \
+	{ \
+		acpi_gbl_max_concurrent_object_count = acpi_gbl_current_object_count; \
+	} \
+	acpi_gbl_running_object_size += a; \
+	acpi_gbl_current_object_size += a; \
+	if (acpi_gbl_max_concurrent_object_size < acpi_gbl_current_object_size) \
+	{ \
+		acpi_gbl_max_concurrent_object_size = acpi_gbl_current_object_size; \
+	}
+
+#define DECREMENT_NAME_TABLE_METRICS(a) \
+	acpi_gbl_current_node_count--; \
+	acpi_gbl_current_node_size -= (a)
+
+#define INCREMENT_NAME_TABLE_METRICS(a) \
+	acpi_gbl_current_node_count++; \
+	acpi_gbl_current_node_size+= (a); \
+	if (acpi_gbl_max_concurrent_node_count < acpi_gbl_current_node_count) \
+	{ \
+		acpi_gbl_max_concurrent_node_count = acpi_gbl_current_node_count; \
+	}
+#endif /* ACPI_DEBUG_TRACK_ALLOCATIONS */
 
 
 #endif /* ACMACROS_H */
diff -urN linux-2.4.6-pre4/drivers/acpi/include/acnamesp.h linux/drivers/acpi/include/acnamesp.h
--- linux-2.4.6-pre4/drivers/acpi/include/acnamesp.h	Fri Feb  9 11:45:58 2001
+++ linux/drivers/acpi/include/acnamesp.h	Mon Dec  3 22:48:42 2001
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Name: acnamesp.h - Namespace subcomponent prototypes and defines
- *       $Revision: 103 $
+ *       $Revision: 106 $
  *
  *****************************************************************************/
 
@@ -94,18 +94,18 @@
 
 ACPI_STATUS
 acpi_ns_walk_namespace (
-	OBJECT_TYPE_INTERNAL    type,
+	ACPI_OBJECT_TYPE8       type,
 	ACPI_HANDLE             start_object,
 	u32                     max_depth,
 	u8                      unlock_before_callback,
-	WALK_CALLBACK           user_function,
+	ACPI_WALK_CALLBACK      user_function,
 	void                    *context,
 	void                    **return_value);
 
 
 ACPI_NAMESPACE_NODE *
 acpi_ns_get_next_object (
-	OBJECT_TYPE_INTERNAL    type,
+	ACPI_OBJECT_TYPE8       type,
 	ACPI_NAMESPACE_NODE     *parent,
 	ACPI_NAMESPACE_NODE     *child);
 
@@ -150,7 +150,7 @@
 acpi_ns_lookup (
 	ACPI_GENERIC_STATE      *scope_info,
 	NATIVE_CHAR             *name,
-	OBJECT_TYPE_INTERNAL    type,
+	ACPI_OBJECT_TYPE8       type,
 	OPERATING_MODE          interpreter_mode,
 	u32                     flags,
 	ACPI_WALK_STATE         *walk_state,
@@ -223,7 +223,7 @@
 
 void
 acpi_ns_dump_objects (
-	OBJECT_TYPE_INTERNAL    type,
+	ACPI_OBJECT_TYPE8       type,
 	u32                     max_depth,
 	u32                     ownder_id,
 	ACPI_HANDLE             start_handle);
@@ -283,7 +283,7 @@
 
 u32
 acpi_ns_opens_scope (
-	OBJECT_TYPE_INTERNAL    type);
+	ACPI_OBJECT_TYPE8       type);
 
 NATIVE_CHAR *
 acpi_ns_get_table_pathname (
@@ -304,12 +304,6 @@
 	ACPI_NAMESPACE_NODE     *obj_node,
 	NATIVE_CHAR             *search_for);
 
-ACPI_STATUS
-acpi_ns_name_compare (
-	ACPI_HANDLE             obj_handle,
-	u32                     level,
-	void                    *context,
-	void                    **return_value);
 
 ACPI_STATUS
 acpi_ns_get_node (
@@ -330,14 +324,7 @@
 acpi_ns_attach_object (
 	ACPI_NAMESPACE_NODE     *node,
 	ACPI_OPERAND_OBJECT     *object,
-	OBJECT_TYPE_INTERNAL    type);
-
-
-void *
-acpi_ns_compare_value (
-	ACPI_HANDLE             obj_handle,
-	u32                     level,
-	void                    *obj_desc);
+	ACPI_OBJECT_TYPE8       type);
 
 
 /*
@@ -350,7 +337,7 @@
 	ACPI_WALK_STATE         *walk_state,
 	ACPI_NAMESPACE_NODE     *node,
 	OPERATING_MODE          interpreter_mode,
-	OBJECT_TYPE_INTERNAL    type,
+	ACPI_OBJECT_TYPE8       type,
 	u32                     flags,
 	ACPI_NAMESPACE_NODE     **ret_node);
 
@@ -358,7 +345,7 @@
 acpi_ns_search_node (
 	u32                     entry_name,
 	ACPI_NAMESPACE_NODE     *node,
-	OBJECT_TYPE_INTERNAL    type,
+	ACPI_OBJECT_TYPE8       type,
 	ACPI_NAMESPACE_NODE     **ret_node);
 
 void
@@ -366,7 +353,7 @@
 	ACPI_WALK_STATE         *walk_state,
 	ACPI_NAMESPACE_NODE     *parent_node,   /* Parent */
 	ACPI_NAMESPACE_NODE     *node,      /* New Child*/
-	OBJECT_TYPE_INTERNAL    type);
+	ACPI_OBJECT_TYPE8       type);
 
 
 /*
@@ -381,17 +368,25 @@
 acpi_ns_valid_path_separator (
 	NATIVE_CHAR             sep);
 
-OBJECT_TYPE_INTERNAL
+ACPI_OBJECT_TYPE8
 acpi_ns_get_type (
-	ACPI_HANDLE             obj_handle);
+	ACPI_NAMESPACE_NODE     *node);
 
 void *
 acpi_ns_get_attached_object (
-	ACPI_HANDLE             obj_handle);
+	ACPI_NAMESPACE_NODE     *node);
 
 u32
 acpi_ns_local (
-	OBJECT_TYPE_INTERNAL    type);
+	ACPI_OBJECT_TYPE8       type);
+
+ACPI_STATUS
+acpi_ns_build_internal_name (
+	ACPI_NAMESTRING_INFO    *info);
+
+ACPI_STATUS
+acpi_ns_get_internal_name_length (
+	ACPI_NAMESTRING_INFO    *info);
 
 ACPI_STATUS
 acpi_ns_internalize_name (
diff -urN linux-2.4.6-pre4/drivers/acpi/include/acobject.h linux/drivers/acpi/include/acobject.h
--- linux-2.4.6-pre4/drivers/acpi/include/acobject.h	Mon Jan 22 13:23:42 2001
+++ linux/drivers/acpi/include/acobject.h	Mon Dec  3 22:48:42 2001
@@ -2,7 +2,7 @@
 /******************************************************************************
  *
  * Name: acobject.h - Definition of ACPI_OPERAND_OBJECT  (Internal object only)
- *       $Revision: 78 $
+ *       $Revision: 89 $
  *
  *****************************************************************************/
 
@@ -58,7 +58,7 @@
  */
 
 
-#define ACPI_OBJECT_COMMON_HEADER           /* 32-bits plus 8-bit flag */\
+#define ACPI_OBJECT_COMMON_HEADER           /* SIZE/ALIGNMENT: 32-bits plus trailing 8-bit flag */\
 	u8                          data_type;          /* To differentiate various internal objs */\
 	u8                          type;               /* ACPI_OBJECT_TYPE */\
 	u16                         reference_count;    /* For object deletion management */\
@@ -73,16 +73,27 @@
 
 /*
  * Common bitfield for the field objects
+ * "Field Datum"    -- a datum from the actual field object
+ * "Buffer Datum"   -- a datum from a user buffer, read from or to be written to the field
  */
-#define ACPI_COMMON_FIELD_INFO              /* Three 32-bit values plus 8*/\
-	u8                          granularity;\
-	u16                         length; \
-	u32                         offset;             /* Byte offset within containing object */\
-	u8                          bit_offset;         /* Bit offset within min read/write data unit */\
-	u8                          access;             /* Access_type */\
-	u8                          lock_rule;\
-	u8                          update_rule;\
-	u8                          access_attribute;
+#define ACPI_COMMON_FIELD_INFO              /* SIZE/ALIGNMENT: 24 bits + three 32-bit values */\
+	u8                          access_flags;\
+	u16                         bit_length;         /* Length of field in bits */\
+	u32                         base_byte_offset;   /* Byte offset within containing object */\
+	u8                          access_bit_width;   /* Read/Write size in bits (from ASL Access_type)*/\
+	u8                          access_byte_width;  /* Read/Write size in bytes */\
+	u8                          update_rule;        /* How neighboring field bits are handled */\
+	u8                          lock_rule;          /* Global Lock: 1 = "Must Lock" */\
+	u8                          start_field_bit_offset;/* Bit offset within first field datum (0-63) */\
+	u8                          datum_valid_bits;   /* Valid bit in first "Field datum" */\
+	u8                          end_field_valid_bits; /* Valid bits in the last "field datum" */\
+	u8                          end_buffer_valid_bits; /* Valid bits in the last "buffer datum" */\
+	u32                         value;              /* Value to store into the Bank or Index register */
+
+
+/* Access flag bits */
+
+#define AFIELD_SINGLE_DATUM         0x1
 
 
 /******************************************************************************
@@ -121,7 +132,7 @@
 	ACPI_OBJECT_COMMON_HEADER
 
 	u32                         length;
-	NATIVE_CHAR                 *pointer;       /* String value in AML stream or in allocated space */
+	NATIVE_CHAR                 *pointer;           /* String value in AML stream or in allocated space */
 
 } ACPI_OBJECT_STRING;
 
@@ -131,7 +142,7 @@
 	ACPI_OBJECT_COMMON_HEADER
 
 	u32                         length;
-	u8                          *pointer;       /* points to the buffer in allocated space */
+	u8                          *pointer;           /* points to the buffer in allocated space */
 
 } ACPI_OBJECT_BUFFER;
 
@@ -140,27 +151,14 @@
 {
 	ACPI_OBJECT_COMMON_HEADER
 
-	u32                         count;          /* # of elements in package */
+	u32                         count;              /* # of elements in package */
 
-	union acpi_operand_obj      **elements;     /* Array of pointers to Acpi_objects */
-	union acpi_operand_obj      **next_element; /* used only while initializing */
+	union acpi_operand_obj      **elements;         /* Array of pointers to Acpi_objects */
+	union acpi_operand_obj      **next_element;     /* used only while initializing */
 
 } ACPI_OBJECT_PACKAGE;
 
 
-typedef struct /* FIELD UNIT */
-{
-	ACPI_OBJECT_COMMON_HEADER
-
-	ACPI_COMMON_FIELD_INFO
-
-	union acpi_operand_obj      *extra;             /* Pointer to executable AML (in field definition) */
-	ACPI_NAMESPACE_NODE         *node;              /* containing object */
-	union acpi_operand_obj      *container;         /* Containing object (Buffer) */
-
-} ACPI_OBJECT_FIELD_UNIT;
-
-
 typedef struct /* DEVICE - has handle and notification handler/context */
 {
 	ACPI_OBJECT_COMMON_HEADER
@@ -175,7 +173,6 @@
 typedef struct /* EVENT */
 {
 	ACPI_OBJECT_COMMON_HEADER
-
 	void                        *semaphore;
 
 } ACPI_OBJECT_EVENT;
@@ -201,12 +198,16 @@
 } ACPI_OBJECT_METHOD;
 
 
-typedef struct /* MUTEX */
+typedef struct acpi_obj_mutex /* MUTEX */
 {
 	ACPI_OBJECT_COMMON_HEADER
 	u16                         sync_level;
+	u16                         acquisition_depth;
 
 	void                        *semaphore;
+	void                        *owner;
+	union acpi_operand_obj      *prev;              /* Link for list of acquired mutexes */
+	union acpi_operand_obj      *next;              /* Link for list of acquired mutexes */
 
 } ACPI_OBJECT_MUTEX;
 
@@ -267,57 +268,78 @@
 
 
 /*
- * Internal types
+ * Fields.  All share a common header/info field.
  */
 
-
-typedef struct /* FIELD */
+typedef struct /* COMMON FIELD (for BUFFER, REGION, BANK, and INDEX fields) */
 {
 	ACPI_OBJECT_COMMON_HEADER
-
 	ACPI_COMMON_FIELD_INFO
+	union acpi_operand_obj      *region_obj;        /* Containing Operation Region object */
+			 /* (REGION/BANK fields only) */
+} ACPI_OBJECT_FIELD_COMMON;
 
-	union acpi_operand_obj      *container;         /* Containing object */
 
-} ACPI_OBJECT_FIELD;
+typedef struct /* REGION FIELD */
+{
+	ACPI_OBJECT_COMMON_HEADER
+	ACPI_COMMON_FIELD_INFO
+	union acpi_operand_obj      *region_obj;        /* Containing Op_region object */
+
+} ACPI_OBJECT_REGION_FIELD;
 
 
 typedef struct /* BANK FIELD */
 {
 	ACPI_OBJECT_COMMON_HEADER
-
 	ACPI_COMMON_FIELD_INFO
-	u32                         value;              /* Value to store into Bank_select */
 
-	ACPI_HANDLE                 bank_select;        /* Bank select register */
-	union acpi_operand_obj      *container;         /* Containing object */
+	union acpi_operand_obj      *region_obj;        /* Containing Op_region object */
+	union acpi_operand_obj      *bank_register_obj; /* Bank_select Register object */
 
 } ACPI_OBJECT_BANK_FIELD;
 
 
 typedef struct /* INDEX FIELD */
 {
+	ACPI_OBJECT_COMMON_HEADER
+	ACPI_COMMON_FIELD_INFO
+
 	/*
-	 * No container pointer needed since the index and data register definitions
-	 * will define how to access the respective registers
+	 * No "Region_obj" pointer needed since the Index and Data registers
+	 * are each field definitions unto themselves.
 	 */
-	ACPI_OBJECT_COMMON_HEADER
+	union acpi_operand_obj      *index_obj;         /* Index register */
+	union acpi_operand_obj      *data_obj;          /* Data register */
+
+
+} ACPI_OBJECT_INDEX_FIELD;
 
+
+/* The Buffer_field is different in that it is part of a Buffer, not an Op_region */
+
+typedef struct /* BUFFER FIELD */
+{
+	ACPI_OBJECT_COMMON_HEADER
 	ACPI_COMMON_FIELD_INFO
-	u32                         value;              /* Value to store into Index register */
 
-	ACPI_HANDLE                 index;              /* Index register */
-	ACPI_HANDLE                 data;               /* Data register */
+	union acpi_operand_obj      *extra;             /* Pointer to executable AML (in field definition) */
+	ACPI_NAMESPACE_NODE         *node;              /* Parent (containing) object node */
+	union acpi_operand_obj      *buffer_obj;        /* Containing Buffer object */
+
+} ACPI_OBJECT_BUFFER_FIELD;
 
-} ACPI_OBJECT_INDEX_FIELD;
 
+/*
+ * Handlers
+ */
 
 typedef struct /* NOTIFY HANDLER */
 {
 	ACPI_OBJECT_COMMON_HEADER
 
 	ACPI_NAMESPACE_NODE         *node;               /* Parent device */
-	NOTIFY_HANDLER              handler;
+	ACPI_NOTIFY_HANDLER         handler;
 	void                        *context;
 
 } ACPI_OBJECT_NOTIFY_HANDLER;
@@ -334,11 +356,11 @@
 
 	u8                          space_id;
 	u16                         hflags;
-	ADDRESS_SPACE_HANDLER       handler;
+	ACPI_ADR_SPACE_HANDLER      handler;
 
 	ACPI_NAMESPACE_NODE         *node;              /* Parent device */
 	void                        *context;
-	ADDRESS_SPACE_SETUP         setup;
+	ACPI_ADR_SPACE_SETUP        setup;
 	union acpi_operand_obj      *region_list;       /* regions using this handler */
 	union acpi_operand_obj      *next;
 
@@ -355,7 +377,7 @@
 	ACPI_OBJECT_COMMON_HEADER
 
 	u8                          target_type;        /* Used for Index_op */
-	u16                         op_code;
+	u16                         opcode;
 	u32                         offset;             /* Used for Arg_op, Local_op, and Index_op */
 
 	void                        *object;            /* Name_op=>HANDLE to obj, Index_op=>ACPI_OPERAND_OBJECT */
@@ -400,7 +422,7 @@
 	ACPI_OBJECT_STRING          string;
 	ACPI_OBJECT_BUFFER          buffer;
 	ACPI_OBJECT_PACKAGE         package;
-	ACPI_OBJECT_FIELD_UNIT      field_unit;
+	ACPI_OBJECT_BUFFER_FIELD    buffer_field;
 	ACPI_OBJECT_DEVICE          device;
 	ACPI_OBJECT_EVENT           event;
 	ACPI_OBJECT_METHOD          method;
@@ -409,7 +431,8 @@
 	ACPI_OBJECT_POWER_RESOURCE  power_resource;
 	ACPI_OBJECT_PROCESSOR       processor;
 	ACPI_OBJECT_THERMAL_ZONE    thermal_zone;
-	ACPI_OBJECT_FIELD           field;
+	ACPI_OBJECT_FIELD_COMMON    common_field;
+	ACPI_OBJECT_REGION_FIELD    field;
 	ACPI_OBJECT_BANK_FIELD      bank_field;
 	ACPI_OBJECT_INDEX_FIELD     index_field;
 	ACPI_OBJECT_REFERENCE       reference;
diff -urN linux-2.4.6-pre4/drivers/acpi/include/acoutput.h linux/drivers/acpi/include/acoutput.h
--- linux-2.4.6-pre4/drivers/acpi/include/acoutput.h	Fri Feb  9 11:45:58 2001
+++ linux/drivers/acpi/include/acoutput.h	Mon Dec  3 22:48:42 2001
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Name: acoutput.h -- debug output
- *       $Revision: 70 $
+ *       $Revision: 78 $
  *
  *****************************************************************************/
 
@@ -34,34 +34,35 @@
 
 /* Component IDs -- used in the global "Debug_layer" */
 
-#define GLOBAL                      0x00000001
-#define COMMON                      0x00000002
-#define PARSER                      0x00000004
-#define DISPATCHER                  0x00000008
-#define INTERPRETER                 0x00000010
-#define NAMESPACE                   0x00000020
-#define RESOURCE_MANAGER            0x00000040
-#define TABLE_MANAGER               0x00000080
-#define EVENT_HANDLING              0x00000100
-#define HARDWARE                    0x00000200
-#define MISCELLANEOUS               0x00000400
-#define OS_DEPENDENT                0x00000800
-
-#define BUS_MANAGER                 0x00001000
-
-#define PROCESSOR_CONTROL           0x00002000
-#define SYSTEM_CONTROL              0x00004000
-#define THERMAL_CONTROL             0x00008000
-#define POWER_CONTROL               0x00010000
-
-#define EMBEDDED_CONTROLLER         0x00020000
-#define BATTERY                     0x00040000
-
-#define DEBUGGER                    0x00100000
-#define COMPILER                    0x00200000
-#define ALL_COMPONENTS              0x001FFFFF
+#define ACPI_UTILITIES              0x00000001
+#define ACPI_HARDWARE               0x00000002
+#define ACPI_EVENTS                 0x00000004
+#define ACPI_TABLES                 0x00000008
+#define ACPI_NAMESPACE              0x00000010
+#define ACPI_PARSER                 0x00000020
+#define ACPI_DISPATCHER             0x00000040
+#define ACPI_EXECUTER               0x00000080
+#define ACPI_RESOURCES              0x00000100
+#define ACPI_DEBUGGER               0x00000200
+#define ACPI_OS_SERVICES            0x00000400
+
+#define ACPI_BUS                    0x00001000
+#define ACPI_SYSTEM                 0x00002000
+#define ACPI_POWER                  0x00004000
+#define ACPI_EC                     0x00008000
+#define ACPI_AC_ADAPTER             0x00010000
+#define ACPI_BATTERY                0x00020000
+#define ACPI_BUTTON                 0x00040000
+#define ACPI_PROCESSOR              0x00080000
+#define ACPI_THERMAL                0x00100000
 
-#define COMPONENT_DEFAULT           (ALL_COMPONENTS)
+#define ACPI_ALL_COMPONENTS         0x00FFFFFF
+
+#define ACPI_COMPONENT_DEFAULT      (ACPI_ALL_COMPONENTS)
+
+
+#define ACPI_COMPILER               0x10000000
+#define ACPI_TOOLS                  0x20000000
 
 
 /* Exception level -- used in the global "Debug_level" */
@@ -77,6 +78,7 @@
 
 /* Trace level -- also used in the global "Debug_level" */
 
+#define TRACE_THREADS               0x00000080
 #define TRACE_PARSE                 0x00000100
 #define TRACE_DISPATCH              0x00000200
 #define TRACE_LOAD                  0x00000400
@@ -98,7 +100,7 @@
 #define TRACE_MUTEX                 0x04000000
 #define TRACE_INIT                  0x08000000
 
-#define TRACE_ALL                   0x0FFFFF00
+#define TRACE_ALL                   0x0FFFFF80
 
 
 /* Exceptionally verbose output -- also used in the global "Debug_level" */
diff -urN linux-2.4.6-pre4/drivers/acpi/include/acpi.h linux/drivers/acpi/include/acpi.h
--- linux-2.4.6-pre4/drivers/acpi/include/acpi.h	Mon Jan 22 13:23:42 2001
+++ linux/drivers/acpi/include/acpi.h	Mon Dec  3 22:48:42 2001
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Name: acpi.h - Master include file, Publics and external data.
- *       $Revision: 50 $
+ *       $Revision: 54 $
  *
  *****************************************************************************/
 
@@ -31,20 +31,21 @@
  * We put them here because we don't want to duplicate them
  * in the rest of the source code again and again.
  */
-#include "acconfig.h"       /* Configuration constants */
-#include "acenv.h"          /* Target environment specific items */
-#include "actypes.h"        /* Fundamental data types */
-#include "acexcep.h"        /* Local exception codes */
-#include "acmacros.h"       /* C macros */
-#include "actbl.h"          /* Acpi table definitions */
-#include "aclocal.h"        /* Internal data types */
-#include "acoutput.h"       /* Error output and Debug macros */
-#include "acpiosxf.h"       /* Interfaces to the Acpi-to-OS layer*/
-#include "acpixf.h"         /* Acpi core external interfaces */
-#include "acobject.h"       /* Acpi internal object */
-#include "acglobal.h"       /* All global variables */
-#include "achware.h"        /* Hardware defines and interfaces */
-#include "accommon.h"       /* Common (global) interfaces */
+#include "acconfig.h"           /* Configuration constants */
+#include "platform/acenv.h"     /* Target environment specific items */
+#include "actypes.h"            /* Fundamental common data types */
+#include "acexcep.h"            /* ACPI exception codes */
+#include "acmacros.h"           /* C macros */
+#include "actbl.h"              /* ACPI table definitions */
+#include "aclocal.h"            /* Internal data types */
+#include "acoutput.h"           /* Error output and Debug macros */
+#include "acpiosxf.h"           /* Interfaces to the ACPI-to-OS layer*/
+#include "acpixf.h"             /* ACPI core subsystem external interfaces */
+#include "acobject.h"           /* ACPI internal object */
+#include "acstruct.h"           /* Common structures */
+#include "acglobal.h"           /* All global variables */
+#include "achware.h"            /* Hardware defines and interfaces */
+#include "acutils.h"            /* Utility interfaces */
 
 
 #endif /* __ACPI_H__ */
diff -urN linux-2.4.6-pre4/drivers/acpi/include/acpiosxf.h linux/drivers/acpi/include/acpiosxf.h
--- linux-2.4.6-pre4/drivers/acpi/include/acpiosxf.h	Mon Jan 29 10:15:59 2001
+++ linux/drivers/acpi/include/acpiosxf.h	Mon Dec  3 22:48:42 2001
@@ -1,9 +1,9 @@
 
 /******************************************************************************
  *
- * Name: acpiosxf.h - All interfaces to the OS-dependent layer.  These
- *                    interfaces must be implemented by the OS-dependent
- *                    front-end to the ACPI subsystem.
+ * Name: acpiosxf.h - All interfaces to the OS Services Layer (OSL).  These
+ *                    interfaces must be implemented by OSL to interface the
+ *                    ACPI components to the host operating system.
  *
  *****************************************************************************/
 
@@ -26,26 +26,26 @@
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-#ifndef __ACPIOSD_H__
-#define __ACPIOSD_H__
+#ifndef __ACPIOSXF_H__
+#define __ACPIOSXF_H__
 
-#include "acenv.h"
+#include "platform/acenv.h"
 #include "actypes.h"
 
 
 /* Priorities for Acpi_os_queue_for_execution */
 
-#define OSD_PRIORITY_GPE    1
-#define OSD_PRIORITY_HIGH   2
-#define OSD_PRIORITY_MED    3
-#define OSD_PRIORITY_LO     4
+#define OSD_PRIORITY_GPE            1
+#define OSD_PRIORITY_HIGH           2
+#define OSD_PRIORITY_MED            3
+#define OSD_PRIORITY_LO             4
 
-#define ACPI_NO_UNIT_LIMIT  ((u32) -1)
-#define ACPI_MUTEX_SEM      1
+#define ACPI_NO_UNIT_LIMIT          ((u32) -1)
+#define ACPI_MUTEX_SEM              1
 
 
 /*
- * Types specific to the OS-dependent layer interfaces
+ * Types specific to the OS service interfaces
  */
 
 typedef
@@ -58,7 +58,7 @@
 
 
 /*
- * Initialization and shutdown primitives  (Optional)
+ * OSL Initialization and shutdown primitives
  */
 
 ACPI_STATUS
@@ -69,6 +69,7 @@
 acpi_os_terminate (
 	void);
 
+
 /*
  * Synchronization primitives
  */
@@ -94,6 +95,7 @@
 	ACPI_HANDLE             handle,
 	u32                     units);
 
+
 /*
  * Memory allocation and mapping
  */
@@ -126,6 +128,7 @@
 	void                    *logical_address,
 	ACPI_PHYSICAL_ADDRESS   *physical_address);
 
+
 /*
  * Interrupt handlers
  */
@@ -143,9 +146,13 @@
 
 
 /*
- * Scheduling
+ * Threads and Scheduling
  */
 
+u32
+acpi_os_get_thread_id (
+	void);
+
 ACPI_STATUS
 acpi_os_queue_for_execution (
 	u32                     priority,
@@ -161,6 +168,7 @@
 acpi_os_sleep_usec (
 	u32                     microseconds);
 
+
 /*
  * Platform/Hardware independent I/O interfaces
  */
@@ -193,6 +201,7 @@
 	ACPI_IO_ADDRESS         out_port,
 	u32                     value);
 
+
 /*
  * Platform/Hardware independent physical memory interfaces
  */
@@ -292,6 +301,10 @@
 	void                    *pointer,
 	u32                     length);
 
+u32
+acpi_os_get_timer (
+	void);
+
 
 /*
  * Debug print routines
@@ -307,6 +320,7 @@
 	const NATIVE_CHAR       *format,
 	va_list                 args);
 
+
 /*
  * Debug input
  */
@@ -328,4 +342,4 @@
 	NATIVE_CHAR             *message);
 
 
-#endif /* __ACPIOSD_H__ */
+#endif /* __ACPIOSXF_H__ */
diff -urN linux-2.4.6-pre4/drivers/acpi/include/acpixf.h linux/drivers/acpi/include/acpixf.h
--- linux-2.4.6-pre4/drivers/acpi/include/acpixf.h	Mon Jan 29 10:15:59 2001
+++ linux/drivers/acpi/include/acpixf.h	Mon Dec  3 22:48:42 2001
@@ -30,6 +30,7 @@
 #include "actypes.h"
 #include "actbl.h"
 
+
 /*
  * Global interfaces
  */
@@ -65,6 +66,23 @@
 
 
 /*
+ * ACPI Memory manager
+ */
+
+void *
+acpi_allocate (
+	u32                     size);
+
+void *
+acpi_callocate (
+	u32                     size);
+
+void
+acpi_free (
+	void                    *address);
+
+
+/*
  * ACPI table manipulation interfaces
  */
 
@@ -96,6 +114,13 @@
 	u32                     instance,
 	ACPI_BUFFER             *ret_buffer);
 
+ACPI_STATUS
+acpi_get_firmware_table (
+	ACPI_STRING             signature,
+	u32                     instance,
+	u32                     flags,
+	ACPI_TABLE_HEADER       **table_pointer);
+
 
 /*
  * Namespace and name interfaces
@@ -106,14 +131,14 @@
 	ACPI_OBJECT_TYPE        type,
 	ACPI_HANDLE             start_object,
 	u32                     max_depth,
-	WALK_CALLBACK           user_function,
+	ACPI_WALK_CALLBACK      user_function,
 	void                    *context,
 	void *                  *return_value);
 
 ACPI_STATUS
 acpi_get_devices (
 	NATIVE_CHAR             *HID,
-	WALK_CALLBACK           user_function,
+	ACPI_WALK_CALLBACK      user_function,
 	void                    *context,
 	void                    **return_value);
 
@@ -165,52 +190,52 @@
 
 
 /*
- * Acpi_event handler interfaces
+ * Event handler interfaces
  */
 
 ACPI_STATUS
 acpi_install_fixed_event_handler (
 	u32                     acpi_event,
-	FIXED_EVENT_HANDLER     handler,
+	ACPI_EVENT_HANDLER      handler,
 	void                    *context);
 
 ACPI_STATUS
 acpi_remove_fixed_event_handler (
 	u32                     acpi_event,
-	FIXED_EVENT_HANDLER     handler);
+	ACPI_EVENT_HANDLER      handler);
 
 ACPI_STATUS
 acpi_install_notify_handler (
 	ACPI_HANDLE             device,
 	u32                     handler_type,
-	NOTIFY_HANDLER          handler,
+	ACPI_NOTIFY_HANDLER     handler,
 	void                    *context);
 
 ACPI_STATUS
 acpi_remove_notify_handler (
 	ACPI_HANDLE             device,
 	u32                     handler_type,
-	NOTIFY_HANDLER          handler);
+	ACPI_NOTIFY_HANDLER     handler);
 
 ACPI_STATUS
 acpi_install_address_space_handler (
 	ACPI_HANDLE             device,
-	ACPI_ADDRESS_SPACE_TYPE space_id,
-	ADDRESS_SPACE_HANDLER   handler,
-	ADDRESS_SPACE_SETUP     setup,
+	ACPI_ADR_SPACE_TYPE     space_id,
+	ACPI_ADR_SPACE_HANDLER  handler,
+	ACPI_ADR_SPACE_SETUP    setup,
 	void                    *context);
 
 ACPI_STATUS
 acpi_remove_address_space_handler (
 	ACPI_HANDLE             device,
-	ACPI_ADDRESS_SPACE_TYPE space_id,
-	ADDRESS_SPACE_HANDLER   handler);
+	ACPI_ADR_SPACE_TYPE     space_id,
+	ACPI_ADR_SPACE_HANDLER  handler);
 
 ACPI_STATUS
 acpi_install_gpe_handler (
 	u32                     gpe_number,
 	u32                     type,
-	GPE_HANDLER             handler,
+	ACPI_GPE_HANDLER        handler,
 	void                    *context);
 
 ACPI_STATUS
@@ -224,7 +249,7 @@
 ACPI_STATUS
 acpi_remove_gpe_handler (
 	u32                     gpe_number,
-	GPE_HANDLER             handler);
+	ACPI_GPE_HANDLER        handler);
 
 ACPI_STATUS
 acpi_enable_event (
diff -urN linux-2.4.6-pre4/drivers/acpi/include/acresrc.h linux/drivers/acpi/include/acresrc.h
--- linux-2.4.6-pre4/drivers/acpi/include/acresrc.h	Mon Jan 22 13:23:42 2001
+++ linux/drivers/acpi/include/acresrc.h	Mon Dec  3 22:48:42 2001
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Name: acresrc.h - Resource Manager function prototypes
- *       $Revision: 22 $
+ *       $Revision: 25 $
  *
  *****************************************************************************/
 
@@ -60,7 +60,7 @@
 
 ACPI_STATUS
 acpi_rs_create_byte_stream (
-	RESOURCE                *linked_list_buffer,
+	ACPI_RESOURCE           *linked_list_buffer,
 	u8                      *output_buffer,
 	u32                     *output_buffer_length);
 
@@ -77,7 +77,7 @@
 
 void
 acpi_rs_dump_resource_list (
-	RESOURCE                *resource);
+	ACPI_RESOURCE           *resource);
 
 void
 acpi_rs_dump_irq_list (
@@ -97,7 +97,7 @@
 
 ACPI_STATUS
 acpi_rs_calculate_byte_stream_length (
-	RESOURCE                *linked_list_buffer,
+	ACPI_RESOURCE           *linked_list_buffer,
 	u32                     *size_needed);
 
 ACPI_STATUS
@@ -113,7 +113,7 @@
 
 ACPI_STATUS
 acpi_rs_list_to_byte_stream (
-	RESOURCE                *linked_list,
+	ACPI_RESOURCE           *linked_list,
 	u32                     byte_stream_size_needed,
 	u8                      **output_buffer);
 
@@ -133,13 +133,13 @@
 
 ACPI_STATUS
 acpi_rs_io_stream (
-	RESOURCE                *linked_list,
+	ACPI_RESOURCE           *linked_list,
 	u8                      **output_buffer,
 	u32                     *bytes_consumed);
 
 ACPI_STATUS
 acpi_rs_fixed_io_stream (
-	RESOURCE                *linked_list,
+	ACPI_RESOURCE           *linked_list,
 	u8                      **output_buffer,
 	u32                     *bytes_consumed);
 
@@ -152,7 +152,7 @@
 
 ACPI_STATUS
 acpi_rs_irq_stream (
-	RESOURCE                *linked_list,
+	ACPI_RESOURCE           *linked_list,
 	u8                      **output_buffer,
 	u32                     *bytes_consumed);
 
@@ -165,7 +165,7 @@
 
 ACPI_STATUS
 acpi_rs_dma_stream (
-	RESOURCE                *linked_list,
+	ACPI_RESOURCE           *linked_list,
 	u8                      **output_buffer,
 	u32                     *bytes_consumed);
 
@@ -178,7 +178,7 @@
 
 ACPI_STATUS
 acpi_rs_address16_stream (
-	RESOURCE                *linked_list,
+	ACPI_RESOURCE           *linked_list,
 	u8                      **output_buffer,
 	u32                     *bytes_consumed);
 
@@ -191,7 +191,20 @@
 
 ACPI_STATUS
 acpi_rs_address32_stream (
-	RESOURCE                *linked_list,
+	ACPI_RESOURCE           *linked_list,
+	u8                      **output_buffer,
+	u32                     *bytes_consumed);
+
+ACPI_STATUS
+acpi_rs_address64_resource (
+	u8                      *byte_stream_buffer,
+	u32                     *bytes_consumed,
+	u8                      **output_buffer,
+	u32                     *structure_size);
+
+ACPI_STATUS
+acpi_rs_address64_stream (
+	ACPI_RESOURCE           *linked_list,
 	u8                      **output_buffer,
 	u32                     *bytes_consumed);
 
@@ -211,13 +224,13 @@
 
 ACPI_STATUS
 acpi_rs_start_dependent_functions_stream (
-	RESOURCE                *linked_list,
+	ACPI_RESOURCE           *linked_list,
 	u8                      **output_buffer,
 	u32                     *bytes_consumed);
 
 ACPI_STATUS
 acpi_rs_end_dependent_functions_stream (
-	RESOURCE                *linked_list,
+	ACPI_RESOURCE           *linked_list,
 	u8                      **output_buffer,
 	u32                     *bytes_consumed);
 
@@ -230,7 +243,7 @@
 
 ACPI_STATUS
 acpi_rs_memory24_stream (
-	RESOURCE                *linked_list,
+	ACPI_RESOURCE           *linked_list,
 	u8                      **output_buffer,
 	u32                     *bytes_consumed);
 
@@ -251,13 +264,13 @@
 
 ACPI_STATUS
 acpi_rs_memory32_range_stream (
-	RESOURCE                *linked_list,
+	ACPI_RESOURCE           *linked_list,
 	u8                      **output_buffer,
 	u32                     *bytes_consumed);
 
 ACPI_STATUS
 acpi_rs_fixed_memory32_stream (
-	RESOURCE                *linked_list,
+	ACPI_RESOURCE           *linked_list,
 	u8                      **output_buffer,
 	u32                     *bytes_consumed);
 
@@ -270,7 +283,7 @@
 
 ACPI_STATUS
 acpi_rs_extended_irq_stream (
-	RESOURCE                *linked_list,
+	ACPI_RESOURCE           *linked_list,
 	u8                      **output_buffer,
 	u32                     *bytes_consumed);
 
@@ -283,7 +296,7 @@
 
 ACPI_STATUS
 acpi_rs_end_tag_stream (
-	RESOURCE                *linked_list,
+	ACPI_RESOURCE           *linked_list,
 	u8                      **output_buffer,
 	u32                     *bytes_consumed);
 
@@ -296,9 +309,12 @@
 
 ACPI_STATUS
 acpi_rs_vendor_stream (
-	RESOURCE                *linked_list,
+	ACPI_RESOURCE           *linked_list,
 	u8                      **output_buffer,
 	u32                     *bytes_consumed);
 
+u8
+acpi_rs_get_resource_type (
+	u8                      resource_start_byte);
 
 #endif  /* __ACRESRC_H__ */
diff -urN linux-2.4.6-pre4/drivers/acpi/include/acstruct.h linux/drivers/acpi/include/acstruct.h
--- linux-2.4.6-pre4/drivers/acpi/include/acstruct.h	Wed Dec 31 16:00:00 1969
+++ linux/drivers/acpi/include/acstruct.h	Mon Dec  3 22:48:42 2001
@@ -0,0 +1,157 @@
+/******************************************************************************
+ *
+ * Name: acstruct.h - Internal structs
+ *       $Revision: 3 $
+ *
+ *****************************************************************************/
+
+/*
+ *  Copyright (C) 2000, 2001 R. Byron Moore
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#ifndef __ACSTRUCT_H__
+#define __ACSTRUCT_H__
+
+
+/*****************************************************************************
+ *
+ * Tree walking typedefs and structs
+ *
+ ****************************************************************************/
+
+
+/*
+ * Walk state - current state of a parse tree walk.  Used for both a leisurely stroll through
+ * the tree (for whatever reason), and for control method execution.
+ */
+
+#define NEXT_OP_DOWNWARD    1
+#define NEXT_OP_UPWARD      2
+
+#define WALK_NON_METHOD     0
+#define WALK_METHOD         1
+#define WALK_METHOD_RESTART 2
+
+typedef struct acpi_walk_state
+{
+	u8                      data_type;                          /* To differentiate various internal objs */\
+	ACPI_OWNER_ID           owner_id;                           /* Owner of objects created during the walk */
+	u8                      last_predicate;                     /* Result of last predicate */
+	u8                      next_op_info;                       /* Info about Next_op */
+	u8                      num_operands;                       /* Stack pointer for Operands[] array */
+	u8                      current_result;                     /* */
+
+	struct acpi_walk_state  *next;                              /* Next Walk_state in list */
+	ACPI_PARSE_OBJECT       *origin;                            /* Start of walk [Obsolete] */
+
+/* TBD: Obsolete with removal of WALK procedure ? */
+	ACPI_PARSE_OBJECT       *prev_op;                           /* Last op that was processed */
+	ACPI_PARSE_OBJECT       *next_op;                           /* next op to be processed */
+
+
+	ACPI_GENERIC_STATE      *results;                           /* Stack of accumulated results */
+	ACPI_GENERIC_STATE      *control_state;                     /* List of control states (nested IFs) */
+	ACPI_GENERIC_STATE      *scope_info;                        /* Stack of nested scopes */
+	ACPI_PARSE_STATE        *parser_state;                      /* Current state of parser */
+	u8                      *aml_last_while;
+	ACPI_OPCODE_INFO        *op_info;                           /* Info on current opcode */
+	ACPI_PARSE_DOWNWARDS    descending_callback;
+	ACPI_PARSE_UPWARDS      ascending_callback;
+
+	union acpi_operand_obj  *return_desc;                       /* Return object, if any */
+	union acpi_operand_obj  *method_desc;                       /* Method descriptor if running a method */
+	struct acpi_node        *method_node;                       /* Method Node if running a method */
+	ACPI_PARSE_OBJECT       *method_call_op;                    /* Method_call Op if running a method */
+	struct acpi_node        *method_call_node;                  /* Called method Node*/
+	union acpi_operand_obj  *operands[OBJ_NUM_OPERANDS];        /* Operands passed to the interpreter */
+	struct acpi_node        arguments[MTH_NUM_ARGS];            /* Control method arguments */
+	struct acpi_node        local_variables[MTH_NUM_LOCALS];    /* Control method locals */
+	struct acpi_walk_list   *walk_list;
+	u32                     parse_flags;
+	u8                      walk_type;
+	u8                      return_used;
+	u16                     opcode;                             /* Current AML opcode */
+	u32                     prev_arg_types;
+	u16                     current_sync_level;                 /* Mutex Sync (nested acquire) level */
+
+	/* Debug support */
+
+	u32                     method_breakpoint;
+
+
+} ACPI_WALK_STATE;
+
+
+/*
+ * Walk list - head of a tree of walk states.  Multiple walk states are created when there
+ * are nested control methods executing.
+ */
+typedef struct acpi_walk_list
+{
+
+	ACPI_WALK_STATE         *walk_state;
+	ACPI_OBJECT_MUTEX       acquired_mutex_list;               /* List of all currently acquired mutexes */
+
+} ACPI_WALK_LIST;
+
+
+/* Info used by Acpi_ps_init_objects */
+
+typedef struct acpi_init_walk_info
+{
+	u16                     method_count;
+	u16                     op_region_count;
+	u16                     field_count;
+	u16                     op_region_init;
+	u16                     field_init;
+	u16                     object_count;
+	ACPI_TABLE_DESC         *table_desc;
+
+} ACPI_INIT_WALK_INFO;
+
+
+/* Info used by TBD */
+
+typedef struct acpi_device_walk_info
+{
+	u16                     device_count;
+	u16                     num_STA;
+	u16                     num_INI;
+	ACPI_TABLE_DESC         *table_desc;
+
+} ACPI_DEVICE_WALK_INFO;
+
+
+/* TBD: [Restructure] Merge with struct above */
+
+typedef struct acpi_walk_info
+{
+	u32                     debug_level;
+	u32                     owner_id;
+
+} ACPI_WALK_INFO;
+
+typedef struct acpi_get_devices_info
+{
+	ACPI_WALK_CALLBACK      user_function;
+	void                    *context;
+	NATIVE_CHAR             *hid;
+
+} ACPI_GET_DEVICES_INFO;
+
+
+#endif
diff -urN linux-2.4.6-pre4/drivers/acpi/include/actables.h linux/drivers/acpi/include/actables.h
--- linux-2.4.6-pre4/drivers/acpi/include/actables.h	Mon Jan 22 13:23:42 2001
+++ linux/drivers/acpi/include/actables.h	Mon Dec  3 22:48:42 2001
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Name: actables.h - ACPI table management
- *       $Revision: 29 $
+ *       $Revision: 31 $
  *
  *****************************************************************************/
 
@@ -54,6 +54,10 @@
 acpi_tb_build_common_facs (
 	ACPI_TABLE_DESC         *table_info);
 
+u32
+acpi_tb_get_table_count (
+	RSDP_DESCRIPTOR         *RSDP,
+	ACPI_TABLE_HEADER       *RSDT);
 
 /*
  * tbget - Table "get" routines
@@ -80,6 +84,20 @@
 	ACPI_TABLE_HEADER       *buffer_ptr,
 	ACPI_TABLE_DESC         *table_info);
 
+ACPI_PHYSICAL_ADDRESS
+acpi_tb_get_rsdt_address (
+	void);
+
+ACPI_STATUS
+acpi_tb_validate_rsdt (
+	ACPI_TABLE_HEADER       *table_ptr);
+
+ACPI_STATUS
+acpi_tb_get_table_pointer (
+	ACPI_PHYSICAL_ADDRESS   physical_address,
+	u32                     flags,
+	u32                     *size,
+	ACPI_TABLE_HEADER       **table_ptr);
 
 /*
  * tbgetall - Get all firmware ACPI tables
@@ -151,7 +169,8 @@
 
 ACPI_STATUS
 acpi_tb_find_rsdp (
-	ACPI_TABLE_DESC         *table_info);
+	ACPI_TABLE_DESC         *table_info,
+	u32                     flags);
 
 
 /*
@@ -166,7 +185,7 @@
 acpi_tb_map_acpi_table (
 	ACPI_PHYSICAL_ADDRESS   physical_address,
 	u32                     *size,
-	void                    **logical_address);
+	ACPI_TABLE_HEADER       **logical_address);
 
 ACPI_STATUS
 acpi_tb_verify_table_checksum (
diff -urN linux-2.4.6-pre4/drivers/acpi/include/actbl.h linux/drivers/acpi/include/actbl.h
--- linux-2.4.6-pre4/drivers/acpi/include/actbl.h	Mon Jan 22 13:23:42 2001
+++ linux/drivers/acpi/include/actbl.h	Mon Dec  3 22:48:42 2001
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Name: actbl.h - Table data structures defined in ACPI specification
- *       $Revision: 45 $
+ *       $Revision: 46 $
  *
  *****************************************************************************/
 
@@ -140,7 +140,7 @@
 	u8                      processor_apic_id;      /* ACPI processor id */
 	u8                      local_apic_id;          /* processor's local APIC id */
 	u32                     processor_enabled: 1;   /* Processor is usable if set */
-	u32                     reserved1       : 32;
+	u32                     reserved1       : 31;
 
 } PROCESSOR_APIC;
 
diff -urN linux-2.4.6-pre4/drivers/acpi/include/actbl2.h linux/drivers/acpi/include/actbl2.h
--- linux-2.4.6-pre4/drivers/acpi/include/actbl2.h	Mon Jan 29 10:15:59 2001
+++ linux/drivers/acpi/include/actbl2.h	Mon Dec  3 22:48:42 2001
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Name: actbl2.h - ACPI Specification Revision 2.0 Tables
- *       $Revision: 21 $
+ *       $Revision: 24 $
  *
  *****************************************************************************/
 
@@ -26,159 +26,156 @@
 #ifndef __ACTBL2_H__
 #define __ACTBL2_H__
 
-/**************************************/
-/* Prefered Power Management Profiles */
-/**************************************/
-#define PM_UNSPECIFIED        0
-#define PM_DESKTOP            1
-#define PM_MOBILE             2
-#define PM_WORKSTATION        3
-#define PM_ENTERPRISE_SERVER  4
-#define PM_SOHO_SERVER        5
-#define PM_APPLIANCE_PC       6
-
-/*********************************************/
-/* ACPI Boot Arch Flags, See spec Table 5-10 */
-/*********************************************/
-#define BAF_LEGACY_DEVICES             0x0001
-#define BAF_8042_KEYBOARD_CONTROLLER   0x0002
+/*
+ * Prefered Power Management Profiles
+ */
+#define PM_UNSPECIFIED                  0
+#define PM_DESKTOP                      1
+#define PM_MOBILE                       2
+#define PM_WORKSTATION                  3
+#define PM_ENTERPRISE_SERVER            4
+#define PM_SOHO_SERVER                  5
+#define PM_APPLIANCE_PC                 6
+
+/*
+ * ACPI Boot Arch Flags
+ */
+#define BAF_LEGACY_DEVICES              0x0001
+#define BAF_8042_KEYBOARD_CONTROLLER    0x0002
+
+#define FADT2_REVISION_ID               3
 
-#define FADT2_REVISION_ID     3
 
 #pragma pack(1)
 
-/*************************************/
-/* ACPI Specification Rev 2.0 for    */
-/* the Root System Description Table */
-/*************************************/
+/*
+ * ACPI Specification Rev 2.0 for the Root System Description Table
+ */
 typedef struct
 {
-	ACPI_TABLE_HEADER   header;                 /* Table header */
-	u32                 table_offset_entry [1]; /* Array of pointers to  */
-			   /* other tables' headers */
+	ACPI_TABLE_HEADER       header;                 /* Table header */
+	u32                     table_offset_entry [1]; /* Array of pointers to  */
+			 /* other tables' headers */
 } RSDT_DESCRIPTOR_REV2;
 
 
-/********************************************/
-/* ACPI Specification Rev 2.0 for the       */
-/* Extended System Description Table (XSDT) */
-/********************************************/
+/*
+ * ACPI Specification Rev 2.0 for the Extended System Description Table (XSDT)
+ */
 typedef struct
 {
-	ACPI_TABLE_HEADER   header;                 /* Table header */
-	UINT64              table_offset_entry [1]; /* Array of pointers to  */
-			   /* other tables' headers */
+	ACPI_TABLE_HEADER       header;                 /* Table header */
+	UINT64                  table_offset_entry [1]; /* Array of pointers to  */
+			 /* other tables' headers */
 } XSDT_DESCRIPTOR_REV2;
 
-/***************************************/
-/* ACPI Specification Rev 2.0 for      */
-/* the Firmware ACPI Control Structure */
-/***************************************/
+
+/*
+ * ACPI Specification Rev 2.0 for the Firmware ACPI Control Structure
+ */
 typedef struct
 {
-	NATIVE_CHAR         signature[4];           /* signature "FACS" */
-	u32                 length;                 /* length of structure, in bytes */
-	u32                 hardware_signature;     /* hardware configuration signature */
-	u32                 firmware_waking_vector; /* 32bit physical address of the Firmware Waking Vector. */
-	u32                 global_lock;            /* Global Lock used to synchronize access to shared hardware resources */
-	u32                 S4_bios_f       : 1;    /* Indicates if S4_bIOS support is present */
-	u32                 reserved1       : 31;   /* must be 0 */
-	UINT64              Xfirmware_waking_vector; /* 64bit physical address of the Firmware Waking Vector. */
-	u8                  version;                /* Version of this table */
-	u8                  reserved3 [31];         /* reserved - must be zero */
+	NATIVE_CHAR             signature[4];           /* signature "FACS" */
+	u32                     length;                 /* length of structure, in bytes */
+	u32                     hardware_signature;     /* hardware configuration signature */
+	u32                     firmware_waking_vector; /* 32bit physical address of the Firmware Waking Vector. */
+	u32                     global_lock;            /* Global Lock used to synchronize access to shared hardware resources */
+	u32                     S4_bios_f       : 1;    /* Indicates if S4_bIOS support is present */
+	u32                     reserved1       : 31;   /* must be 0 */
+	UINT64                  Xfirmware_waking_vector; /* 64bit physical address of the Firmware Waking Vector. */
+	u8                      version;                /* Version of this table */
+	u8                      reserved3 [31];         /* reserved - must be zero */
 
 } FACS_DESCRIPTOR_REV2;
 
 
-/***************************************/
-/* ACPI Specification Rev 2.0 for      */
-/* the Generic Address Structure (GAS) */
-/***************************************/
+/*
+ * ACPI Specification Rev 2.0 for the Generic Address Structure (GAS)
+ */
 typedef struct
 {
-	u8                  address_space_id;   /* Address space where struct or register exists. */
-	u8                  register_bit_width; /* Size in bits of given register */
-	u8                  register_bit_offset; /* Bit offset within the register */
-	u8                  reserved;           /* Must be 0 */
-	UINT64              address;            /* 64-bit address of struct or register */
-
-} ACPI_GAS;
+	u8                      address_space_id;       /* Address space where struct or register exists. */
+	u8                      register_bit_width;     /* Size in bits of given register */
+	u8                      register_bit_offset;    /* Bit offset within the register */
+	u8                      reserved;               /* Must be 0 */
+	UINT64                  address;                /* 64-bit address of struct or register */
+
+} ACPI_GENERIC_ADDRESS;
 
 
-/************************************/
-/* ACPI Specification Rev 2.0 for   */
-/* the Fixed ACPI Description Table */
-/************************************/
+/*
+ * ACPI Specification Rev 2.0 for the Fixed ACPI Description Table
+ */
 typedef struct
 {
-	ACPI_TABLE_HEADER   header;            /* table header */
-	u32                 V1_firmware_ctrl;  /* 32-bit physical address of FACS */
-	u32                 V1_dsdt;           /* 32-bit physical address of DSDT */
-	u8                  reserved1;         /* System Interrupt Model isn't used in ACPI 2.0*/
-	u8                  prefer_PM_profile; /* Conveys preferred power management profile to OSPM. */
-	u16                 sci_int;           /* System vector of SCI interrupt */
-	u32                 smi_cmd;           /* Port address of SMI command port */
-	u8                  acpi_enable;       /* value to write to smi_cmd to enable ACPI */
-	u8                  acpi_disable;      /* value to write to smi_cmd to disable ACPI */
-	u8                  S4_bios_req;       /* Value to write to SMI CMD to enter S4_bIOS state */
-	u8                  pstate_cnt;        /* processor performance state control*/
-	u32                 V1_pm1a_evt_blk;   /* Port address of Power Mgt 1a Acpi_event Reg Blk */
-	u32                 V1_pm1b_evt_blk;   /* Port address of Power Mgt 1b Acpi_event Reg Blk */
-	u32                 V1_pm1a_cnt_blk;   /* Port address of Power Mgt 1a Control Reg Blk */
-	u32                 V1_pm1b_cnt_blk;   /* Port address of Power Mgt 1b Control Reg Blk */
-	u32                 V1_pm2_cnt_blk;    /* Port address of Power Mgt 2 Control Reg Blk */
-	u32                 V1_pm_tmr_blk;     /* Port address of Power Mgt Timer Ctrl Reg Blk */
-	u32                 V1_gpe0blk;        /* Port addr of General Purpose Acpi_event 0 Reg Blk */
-	u32                 V1_gpe1_blk;       /* Port addr of General Purpose Acpi_event 1 Reg Blk */
-	u8                  pm1_evt_len;       /* Byte Length of ports at pm1_x_evt_blk */
-	u8                  pm1_cnt_len;       /* Byte Length of ports at pm1_x_cnt_blk */
-	u8                  pm2_cnt_len;       /* Byte Length of ports at pm2_cnt_blk */
-	u8                  pm_tm_len;         /* Byte Length of ports at pm_tm_blk */
-	u8                  gpe0blk_len;       /* Byte Length of ports at gpe0_blk */
-	u8                  gpe1_blk_len;      /* Byte Length of ports at gpe1_blk */
-	u8                  gpe1_base;         /* offset in gpe model where gpe1 events start */
-	u8                  cst_cnt;           /* Support for the _CST object and C States change notification.*/
-	u16                 plvl2_lat;         /* worst case HW latency to enter/exit C2 state */
-	u16                 plvl3_lat;         /* worst case HW latency to enter/exit C3 state */
-	u16                 flush_size;        /* number of flush strides that need to be read */
-	u16                 flush_stride;      /* Processor's memory cache line width, in bytes */
-	u8                  duty_offset;       /* Processor_’s duty cycle index in processor's P_CNT reg*/
-	u8                  duty_width;        /* Processor_’s duty cycle value bit width in P_CNT register.*/
-	u8                  day_alrm;          /* index to day-of-month alarm in RTC CMOS RAM */
-	u8                  mon_alrm;          /* index to month-of-year alarm in RTC CMOS RAM */
-	u8                  century;           /* index to century in RTC CMOS RAM */
-	u16                 iapc_boot_arch;    /* IA-PC Boot Architecture Flags. See Table 5-10 for description*/
-	u8                  reserved2;         /* reserved */
-	u32                 wb_invd     : 1;   /* wbinvd instruction works properly */
-	u32                 wb_invd_flush : 1; /* wbinvd flushes but does not invalidate */
-	u32                 proc_c1     : 1;   /* all processors support C1 state */
-	u32                 plvl2_up    : 1;   /* C2 state works on MP system */
-	u32                 pwr_button  : 1;   /* Power button is handled as a generic feature */
-	u32                 sleep_button : 1;  /* Sleep button is handled as a generic feature, or not present */
-	u32                 fixed_rTC   : 1;   /* RTC wakeup stat not in fixed register space */
-	u32                 rtcs4       : 1;   /* RTC wakeup stat not possible from S4 */
-	u32                 tmr_val_ext : 1;   /* tmr_val is 32 bits */
-	u32                 dock_cap    : 1;   /* Supports Docking */
-	u32                 reset_reg_sup : 1; /* Indicates system supports system reset via the FADT RESET_REG*/
-	u32                 sealed_case : 1;   /* Indicates system has no internal expansion capabilities and case is sealed. */
-	u32                 headless    : 1;   /* Indicates system does not have local video capabilities or local input devices.*/
-	u32                 cpu_sw_sleep : 1;  /* Indicates to OSPM that a processor native instruction */
-			 /* must be executed after writing the SLP_TYPx register. */
-	u32                 reserved6   : 18;  /* reserved - must be zero */
-
-	ACPI_GAS            reset_register;    /* Reset register address in GAS format */
-	u8                  reset_value;       /* Value to write to the Reset_register port to reset the system. */
-	u8                  reserved7[3];      /* These three bytes must be zero */
-	UINT64              Xfirmware_ctrl;     /* 64-bit physical address of FACS */
-	UINT64              Xdsdt;              /* 64-bit physical address of DSDT */
-	ACPI_GAS            Xpm1a_evt_blk;      /* Extended Power Mgt 1a Acpi_event Reg Blk address */
-	ACPI_GAS            Xpm1b_evt_blk;      /* Extended Power Mgt 1b Acpi_event Reg Blk address */
-	ACPI_GAS            Xpm1a_cnt_blk;      /* Extended Power Mgt 1a Control Reg Blk address */
-	ACPI_GAS            Xpm1b_cnt_blk;      /* Extended Power Mgt 1b Control Reg Blk address */
-	ACPI_GAS            Xpm2_cnt_blk;       /* Extended Power Mgt 2 Control Reg Blk address */
-	ACPI_GAS            Xpm_tmr_blk;        /* Extended Power Mgt Timer Ctrl Reg Blk address */
-	ACPI_GAS            Xgpe0blk;           /* Extended General Purpose Acpi_event 0 Reg Blk address */
-	ACPI_GAS            Xgpe1_blk;          /* Extended General Purpose Acpi_event 1 Reg Blk address */
+	ACPI_TABLE_HEADER       header;             /* table header */
+	u32                     V1_firmware_ctrl;   /* 32-bit physical address of FACS */
+	u32                     V1_dsdt;            /* 32-bit physical address of DSDT */
+	u8                      reserved1;          /* System Interrupt Model isn't used in ACPI 2.0*/
+	u8                      prefer_PM_profile;  /* Conveys preferred power management profile to OSPM. */
+	u16                     sci_int;            /* System vector of SCI interrupt */
+	u32                     smi_cmd;            /* Port address of SMI command port */
+	u8                      acpi_enable;        /* value to write to smi_cmd to enable ACPI */
+	u8                      acpi_disable;       /* value to write to smi_cmd to disable ACPI */
+	u8                      S4_bios_req;        /* Value to write to SMI CMD to enter S4_bIOS state */
+	u8                      pstate_cnt;         /* processor performance state control*/
+	u32                     V1_pm1a_evt_blk;    /* Port address of Power Mgt 1a Acpi_event Reg Blk */
+	u32                     V1_pm1b_evt_blk;    /* Port address of Power Mgt 1b Acpi_event Reg Blk */
+	u32                     V1_pm1a_cnt_blk;    /* Port address of Power Mgt 1a Control Reg Blk */
+	u32                     V1_pm1b_cnt_blk;    /* Port address of Power Mgt 1b Control Reg Blk */
+	u32                     V1_pm2_cnt_blk;     /* Port address of Power Mgt 2 Control Reg Blk */
+	u32                     V1_pm_tmr_blk;      /* Port address of Power Mgt Timer Ctrl Reg Blk */
+	u32                     V1_gpe0blk;         /* Port addr of General Purpose Acpi_event 0 Reg Blk */
+	u32                     V1_gpe1_blk;        /* Port addr of General Purpose Acpi_event 1 Reg Blk */
+	u8                      pm1_evt_len;        /* Byte Length of ports at pm1_x_evt_blk */
+	u8                      pm1_cnt_len;        /* Byte Length of ports at pm1_x_cnt_blk */
+	u8                      pm2_cnt_len;        /* Byte Length of ports at pm2_cnt_blk */
+	u8                      pm_tm_len;          /* Byte Length of ports at pm_tm_blk */
+	u8                      gpe0blk_len;        /* Byte Length of ports at gpe0_blk */
+	u8                      gpe1_blk_len;       /* Byte Length of ports at gpe1_blk */
+	u8                      gpe1_base;          /* offset in gpe model where gpe1 events start */
+	u8                      cst_cnt;            /* Support for the _CST object and C States change notification.*/
+	u16                     plvl2_lat;          /* worst case HW latency to enter/exit C2 state */
+	u16                     plvl3_lat;          /* worst case HW latency to enter/exit C3 state */
+	u16                     flush_size;         /* number of flush strides that need to be read */
+	u16                     flush_stride;       /* Processor's memory cache line width, in bytes */
+	u8                      duty_offset;        /* Processor’s duty cycle index in processor's P_CNT reg*/
+	u8                      duty_width;         /* Processor’s duty cycle value bit width in P_CNT register.*/
+	u8                      day_alrm;           /* index to day-of-month alarm in RTC CMOS RAM */
+	u8                      mon_alrm;           /* index to month-of-year alarm in RTC CMOS RAM */
+	u8                      century;            /* index to century in RTC CMOS RAM */
+	u16                     iapc_boot_arch;     /* IA-PC Boot Architecture Flags. See Table 5-10 for description*/
+	u8                      reserved2;          /* reserved */
+	u32                     wb_invd     : 1;    /* wbinvd instruction works properly */
+	u32                     wb_invd_flush : 1;  /* wbinvd flushes but does not invalidate */
+	u32                     proc_c1     : 1;    /* all processors support C1 state */
+	u32                     plvl2_up    : 1;    /* C2 state works on MP system */
+	u32                     pwr_button  : 1;    /* Power button is handled as a generic feature */
+	u32                     sleep_button : 1;   /* Sleep button is handled as a generic feature, or not present */
+	u32                     fixed_rTC   : 1;    /* RTC wakeup stat not in fixed register space */
+	u32                     rtcs4       : 1;    /* RTC wakeup stat not possible from S4 */
+	u32                     tmr_val_ext : 1;    /* tmr_val is 32 bits */
+	u32                     dock_cap    : 1;    /* Supports Docking */
+	u32                     reset_reg_sup : 1;  /* Indicates system supports system reset via the FADT RESET_REG*/
+	u32                     sealed_case : 1;    /* Indicates system has no internal expansion capabilities and case is sealed. */
+	u32                     headless    : 1;    /* Indicates system does not have local video capabilities or local input devices.*/
+	u32                     cpu_sw_sleep : 1;   /* Indicates to OSPM that a processor native instruction */
+			   /* must be executed after writing the SLP_TYPx register. */
+	u32                     reserved6   : 18;   /* reserved - must be zero */
+
+	ACPI_GENERIC_ADDRESS    reset_register;     /* Reset register address in GAS format */
+	u8                      reset_value;        /* Value to write to the Reset_register port to reset the system. */
+	u8                      reserved7[3];       /* These three bytes must be zero */
+	UINT64                  Xfirmware_ctrl;     /* 64-bit physical address of FACS */
+	UINT64                  Xdsdt;              /* 64-bit physical address of DSDT */
+	ACPI_GENERIC_ADDRESS    Xpm1a_evt_blk;      /* Extended Power Mgt 1a Acpi_event Reg Blk address */
+	ACPI_GENERIC_ADDRESS    Xpm1b_evt_blk;      /* Extended Power Mgt 1b Acpi_event Reg Blk address */
+	ACPI_GENERIC_ADDRESS    Xpm1a_cnt_blk;      /* Extended Power Mgt 1a Control Reg Blk address */
+	ACPI_GENERIC_ADDRESS    Xpm1b_cnt_blk;      /* Extended Power Mgt 1b Control Reg Blk address */
+	ACPI_GENERIC_ADDRESS    Xpm2_cnt_blk;       /* Extended Power Mgt 2 Control Reg Blk address */
+	ACPI_GENERIC_ADDRESS    Xpm_tmr_blk;        /* Extended Power Mgt Timer Ctrl Reg Blk address */
+	ACPI_GENERIC_ADDRESS    Xgpe0blk;           /* Extended General Purpose Acpi_event 0 Reg Blk address */
+	ACPI_GENERIC_ADDRESS    Xgpe1_blk;          /* Extended General Purpose Acpi_event 1 Reg Blk address */
 
 }  FADT_DESCRIPTOR_REV2;
 
diff -urN linux-2.4.6-pre4/drivers/acpi/include/actbl71.h linux/drivers/acpi/include/actbl71.h
--- linux-2.4.6-pre4/drivers/acpi/include/actbl71.h	Mon Jan 22 13:23:42 2001
+++ linux/drivers/acpi/include/actbl71.h	Mon Dec  3 22:48:42 2001
@@ -3,7 +3,7 @@
  * Name: actbl71.h - IA-64 Extensions to the ACPI Spec Rev. 0.71
  *                   This file includes tables specific to this
  *                   specification revision.
- *       $Revision: 9 $
+ *       $Revision: 11 $
  *
  *****************************************************************************/
 
@@ -28,8 +28,10 @@
 #ifndef __ACTBL71_H__
 #define __ACTBL71_H__
 
+
 /* 0.71 FADT Address_space data item bitmasks defines */
 /* If the associated bit is zero then it is in memory space else in io space */
+
 #define SMI_CMD_ADDRESS_SPACE       0x01
 #define PM1_BLK_ADDRESS_SPACE       0x02
 #define PM2_CNT_BLK_ADDRESS_SPACE   0x04
@@ -38,10 +40,11 @@
 #define GPE1_BLK_ADDRESS_SPACE      0x20
 
 /* Only for clarity in declarations */
+
 typedef UINT64              IO_ADDRESS;
 
-#pragma pack(1)
 
+#pragma pack(1)
 typedef struct  /* Root System Descriptor Pointer */
 {
 	NATIVE_CHAR             signature [8];          /* contains "RSD PTR " */
diff -urN linux-2.4.6-pre4/drivers/acpi/include/actypes.h linux/drivers/acpi/include/actypes.h
--- linux-2.4.6-pre4/drivers/acpi/include/actypes.h	Fri Feb  9 11:45:58 2001
+++ linux/drivers/acpi/include/actypes.h	Mon Dec  3 22:48:42 2001
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Name: actypes.h - Common data types for the entire ACPI subsystem
- *       $Revision: 165 $
+ *       $Revision: 180 $
  *
  *****************************************************************************/
 
@@ -231,6 +231,10 @@
 
 #define ACPI_ROOT_OBJECT                (ACPI_HANDLE)(-1)
 
+
+/*
+ * Initialization sequence
+ */
 #define ACPI_FULL_INITIALIZATION        0x00
 #define ACPI_NO_ADDRESS_SPACE_INIT      0x01
 #define ACPI_NO_HARDWARE_INIT           0x02
@@ -241,8 +245,11 @@
 
 
 /*
- * Sleep state constants
+ * Power state values
  */
+
+#define ACPI_STATE_UNKNOWN              (u8) 0xFF
+
 #define ACPI_STATE_S0                   (u8) 0
 #define ACPI_STATE_S1                   (u8) 1
 #define ACPI_STATE_S2                   (u8) 2
@@ -252,6 +259,26 @@
 /* let's pretend S4_bIOS didn't exist for now. ASG */
 #define ACPI_STATE_S4_bIOS              (u8) 6
 #define ACPI_S_STATES_MAX               ACPI_STATE_S5
+#define ACPI_S_STATE_COUNT              6
+
+#define ACPI_STATE_D0                   (u8) 0
+#define ACPI_STATE_D1                   (u8) 1
+#define ACPI_STATE_D2                   (u8) 2
+#define ACPI_STATE_D3                   (u8) 3
+#define ACPI_D_STATES_MAX               ACPI_STATE_D3
+#define ACPI_D_STATE_COUNT              4
+
+/*
+ * Standard notify values
+ */
+#define ACPI_NOTIFY_BUS_CHECK           (u8) 0
+#define ACPI_NOTIFY_DEVICE_CHECK        (u8) 1
+#define ACPI_NOTIFY_DEVICE_WAKE         (u8) 2
+#define ACPI_NOTIFY_EJECT_REQUEST       (u8) 3
+#define ACPI_NOTIFY_DEVICE_CHECK_LIGHT  (u8) 4
+#define ACPI_NOTIFY_FREQUENCY_MISMATCH  (u8) 5
+#define ACPI_NOTIFY_BUS_MODE_MISMATCH   (u8) 6
+#define ACPI_NOTIFY_POWER_FAULT	        (u8) 7
 
 
 /*
@@ -282,35 +309,7 @@
  */
 
 typedef u32                             ACPI_OBJECT_TYPE;
-typedef u8                              OBJECT_TYPE_INTERNAL;
-
-#define ACPI_BTYPE_ANY                  0x00000000
-#define ACPI_BTYPE_INTEGER               0x00000001
-#define ACPI_BTYPE_STRING               0x00000002
-#define ACPI_BTYPE_BUFFER               0x00000004
-#define ACPI_BTYPE_PACKAGE              0x00000008
-#define ACPI_BTYPE_FIELD_UNIT           0x00000010
-#define ACPI_BTYPE_DEVICE               0x00000020
-#define ACPI_BTYPE_EVENT                0x00000040
-#define ACPI_BTYPE_METHOD               0x00000080
-#define ACPI_BTYPE_MUTEX                0x00000100
-#define ACPI_BTYPE_REGION               0x00000200
-#define ACPI_BTYPE_POWER                0x00000400
-#define ACPI_BTYPE_PROCESSOR            0x00000800
-#define ACPI_BTYPE_THERMAL              0x00001000
-#define ACPI_BTYPE_BUFFER_FIELD         0x00002000
-#define ACPI_BTYPE_DDB_HANDLE           0x00004000
-#define ACPI_BTYPE_DEBUG_OBJECT         0x00008000
-#define ACPI_BTYPE_REFERENCE            0x00010000
-#define ACPI_BTYPE_RESOURCE             0x00020000
-
-#define ACPI_BTYPE_COMPUTE_DATA         (ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER)
-
-#define ACPI_BTYPE_DATA                 (ACPI_BTYPE_COMPUTE_DATA  | ACPI_BTYPE_PACKAGE)
-#define ACPI_BTYPE_DATA_REFERENCE       (ACPI_BTYPE_DATA | ACPI_BTYPE_REFERENCE | ACPI_BTYPE_DDB_HANDLE)
-#define ACPI_BTYPE_DEVICE_OBJECTS       (ACPI_BTYPE_DEVICE | ACPI_BTYPE_THERMAL | ACPI_BTYPE_PROCESSOR)
-#define ACPI_BTYPE_OBJECTS_AND_REFS     0x00017FFF  /* ARG or LOCAL */
-#define ACPI_BTYPE_ALL_OBJECTS          0x00007FFF
+typedef u8                              ACPI_OBJECT_TYPE8;
 
 
 #define ACPI_TYPE_ANY                   0  /* 0x00  */
@@ -342,7 +341,7 @@
  */
 #define INTERNAL_TYPE_BEGIN             17
 
-#define INTERNAL_TYPE_DEF_FIELD         17 /* 0x11  */
+#define INTERNAL_TYPE_REGION_FIELD      17 /* 0x11  */
 #define INTERNAL_TYPE_BANK_FIELD        18 /* 0x12  */
 #define INTERNAL_TYPE_INDEX_FIELD       19 /* 0x13  */
 #define INTERNAL_TYPE_REFERENCE         20 /* 0x14  Arg#, Local#, Name, Debug; used only in descriptors */
@@ -350,27 +349,62 @@
 #define INTERNAL_TYPE_NOTIFY            22 /* 0x16  */
 #define INTERNAL_TYPE_ADDRESS_HANDLER   23 /* 0x17  */
 #define INTERNAL_TYPE_RESOURCE          24 /* 0x18  */
+#define INTERNAL_TYPE_RESOURCE_FIELD    25 /* 0x19  */
 
 
-#define INTERNAL_TYPE_NODE_MAX          24
+#define INTERNAL_TYPE_NODE_MAX          25
 
 /* These are pseudo-types because there are never any namespace nodes with these types */
 
-#define INTERNAL_TYPE_DEF_FIELD_DEFN    25 /* 0x19  Name, Byte_const, multiple Field_element */
-#define INTERNAL_TYPE_BANK_FIELD_DEFN   26 /* 0x1A  2 Name,DWord_const,Byte_const,multi Field_element */
-#define INTERNAL_TYPE_INDEX_FIELD_DEFN  27 /* 0x1B  2 Name, Byte_const, multiple Field_element */
-#define INTERNAL_TYPE_IF                28 /* 0x1C  Op_code, multiple Code */
-#define INTERNAL_TYPE_ELSE              29 /* 0x1D  multiple Code */
-#define INTERNAL_TYPE_WHILE             30 /* 0x1E  Op_code, multiple Code */
-#define INTERNAL_TYPE_SCOPE             31 /* 0x1F  Name, multiple Node */
-#define INTERNAL_TYPE_DEF_ANY           32 /* 0x20  type is Any, suppress search of enclosing scopes */
-#define INTERNAL_TYPE_EXTRA             33 /* 0x21  */
+#define INTERNAL_TYPE_FIELD_DEFN        26 /* 0x1A  Name, Byte_const, multiple Field_element */
+#define INTERNAL_TYPE_BANK_FIELD_DEFN   27 /* 0x1B  2 Name,DWord_const,Byte_const,multi Field_element */
+#define INTERNAL_TYPE_INDEX_FIELD_DEFN  28 /* 0x1C  2 Name, Byte_const, multiple Field_element */
+#define INTERNAL_TYPE_IF                29 /* 0x1D  */
+#define INTERNAL_TYPE_ELSE              30 /* 0x1E  */
+#define INTERNAL_TYPE_WHILE             31 /* 0x1F  */
+#define INTERNAL_TYPE_SCOPE             32 /* 0x20  Name, multiple Node */
+#define INTERNAL_TYPE_DEF_ANY           33 /* 0x21  type is Any, suppress search of enclosing scopes */
+#define INTERNAL_TYPE_EXTRA             34 /* 0x22  */
 
-#define INTERNAL_TYPE_MAX               33
+#define INTERNAL_TYPE_MAX               34
 
-#define INTERNAL_TYPE_INVALID           34
+#define INTERNAL_TYPE_INVALID           35
 #define ACPI_TYPE_NOT_FOUND             0xFF
 
+
+/*
+ * Bitmapped ACPI types
+ * Used internally only
+ */
+#define ACPI_BTYPE_ANY                  0x00000000
+#define ACPI_BTYPE_INTEGER              0x00000001
+#define ACPI_BTYPE_STRING               0x00000002
+#define ACPI_BTYPE_BUFFER               0x00000004
+#define ACPI_BTYPE_PACKAGE              0x00000008
+#define ACPI_BTYPE_FIELD_UNIT           0x00000010
+#define ACPI_BTYPE_DEVICE               0x00000020
+#define ACPI_BTYPE_EVENT                0x00000040
+#define ACPI_BTYPE_METHOD               0x00000080
+#define ACPI_BTYPE_MUTEX                0x00000100
+#define ACPI_BTYPE_REGION               0x00000200
+#define ACPI_BTYPE_POWER                0x00000400
+#define ACPI_BTYPE_PROCESSOR            0x00000800
+#define ACPI_BTYPE_THERMAL              0x00001000
+#define ACPI_BTYPE_BUFFER_FIELD         0x00002000
+#define ACPI_BTYPE_DDB_HANDLE           0x00004000
+#define ACPI_BTYPE_DEBUG_OBJECT         0x00008000
+#define ACPI_BTYPE_REFERENCE            0x00010000
+#define ACPI_BTYPE_RESOURCE             0x00020000
+
+#define ACPI_BTYPE_COMPUTE_DATA         (ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER)
+
+#define ACPI_BTYPE_DATA                 (ACPI_BTYPE_COMPUTE_DATA  | ACPI_BTYPE_PACKAGE)
+#define ACPI_BTYPE_DATA_REFERENCE       (ACPI_BTYPE_DATA | ACPI_BTYPE_REFERENCE | ACPI_BTYPE_DDB_HANDLE)
+#define ACPI_BTYPE_DEVICE_OBJECTS       (ACPI_BTYPE_DEVICE | ACPI_BTYPE_THERMAL | ACPI_BTYPE_PROCESSOR)
+#define ACPI_BTYPE_OBJECTS_AND_REFS     0x0001FFFF  /* ARG or LOCAL */
+#define ACPI_BTYPE_ALL_OBJECTS          0x0000FFFF
+
+
 /*
  * Acpi_event Types:
  * ------------
@@ -398,11 +432,11 @@
 #define ACPI_EVENT_RTC                  (ACPI_EVENT_TYPE) 5
 #define ACPI_EVENT_GENERAL              (ACPI_EVENT_TYPE) 6
 #define ACPI_EVENT_MAX                  6
-#define NUM_FIXED_EVENTS                (ACPI_EVENT_TYPE) 7
+#define ACPI_NUM_FIXED_EVENTS           (ACPI_EVENT_TYPE) 7
 
 #define ACPI_GPE_INVALID                0xFF
 #define ACPI_GPE_MAX                    0xFF
-#define NUM_GPE                         256
+#define ACPI_NUM_GPE                    256
 
 #define ACPI_EVENT_LEVEL_TRIGGERED      (ACPI_EVENT_TYPE) 1
 #define ACPI_EVENT_EDGE_TRIGGERED       (ACPI_EVENT_TYPE) 2
@@ -439,15 +473,15 @@
 
 /* Address Space (Operation Region) Types */
 
-typedef u8                              ACPI_ADDRESS_SPACE_TYPE;
+typedef u8                              ACPI_ADR_SPACE_TYPE;
 
-#define ADDRESS_SPACE_SYSTEM_MEMORY     (ACPI_ADDRESS_SPACE_TYPE) 0
-#define ADDRESS_SPACE_SYSTEM_IO         (ACPI_ADDRESS_SPACE_TYPE) 1
-#define ADDRESS_SPACE_PCI_CONFIG        (ACPI_ADDRESS_SPACE_TYPE) 2
-#define ADDRESS_SPACE_EC                (ACPI_ADDRESS_SPACE_TYPE) 3
-#define ADDRESS_SPACE_SMBUS             (ACPI_ADDRESS_SPACE_TYPE) 4
-#define ADDRESS_SPACE_CMOS              (ACPI_ADDRESS_SPACE_TYPE) 5
-#define ADDRESS_SPACE_PCI_BAR_TARGET    (ACPI_ADDRESS_SPACE_TYPE) 6
+#define ACPI_ADR_SPACE_SYSTEM_MEMORY    (ACPI_ADR_SPACE_TYPE) 0
+#define ACPI_ADR_SPACE_SYSTEM_IO        (ACPI_ADR_SPACE_TYPE) 1
+#define ACPI_ADR_SPACE_PCI_CONFIG       (ACPI_ADR_SPACE_TYPE) 2
+#define ACPI_ADR_SPACE_EC               (ACPI_ADR_SPACE_TYPE) 3
+#define ACPI_ADR_SPACE_SMBUS            (ACPI_ADR_SPACE_TYPE) 4
+#define ACPI_ADR_SPACE_CMOS             (ACPI_ADR_SPACE_TYPE) 5
+#define ACPI_ADR_SPACE_PCI_BAR_TARGET   (ACPI_ADR_SPACE_TYPE) 6
 
 
 /*
@@ -495,7 +529,7 @@
 	{
 		ACPI_OBJECT_TYPE            type;
 		u32                         proc_id;
-		u32                         pblk_address;
+		ACPI_IO_ADDRESS             pblk_address;
 		u32                         pblk_length;
 	} processor;
 
@@ -616,29 +650,33 @@
 			  /*  not found in the IA32 manner        */
 } ACPI_INIT_DATA;
 
+
 /*
  * Various handlers and callback procedures
  */
 
 typedef
-u32 (*FIXED_EVENT_HANDLER) (
+u32 (*ACPI_EVENT_HANDLER) (
 	void                        *context);
 
 typedef
-void (*GPE_HANDLER) (
+void (*ACPI_GPE_HANDLER) (
 	void                        *context);
 
 typedef
-void (*NOTIFY_HANDLER) (
+void (*ACPI_NOTIFY_HANDLER) (
 	ACPI_HANDLE                 device,
 	u32                         value,
 	void                        *context);
 
-#define ADDRESS_SPACE_READ              1
-#define ADDRESS_SPACE_WRITE             2
+
+/* Address Spaces (Operation Regions */
+
+#define ACPI_READ_ADR_SPACE     1
+#define ACPI_WRITE_ADR_SPACE    2
 
 typedef
-ACPI_STATUS (*ADDRESS_SPACE_HANDLER) (
+ACPI_STATUS (*ACPI_ADR_SPACE_HANDLER) (
 	u32                         function,
 	ACPI_PHYSICAL_ADDRESS       address,
 	u32                         bit_width,
@@ -646,11 +684,11 @@
 	void                        *handler_context,
 	void                        *region_context);
 
-#define ACPI_DEFAULT_HANDLER            ((ADDRESS_SPACE_HANDLER) NULL)
+#define ACPI_DEFAULT_HANDLER            ((ACPI_ADR_SPACE_HANDLER) NULL)
 
 
 typedef
-ACPI_STATUS (*ADDRESS_SPACE_SETUP) (
+ACPI_STATUS (*ACPI_ADR_SPACE_SETUP) (
 	ACPI_HANDLE                 region_handle,
 	u32                         function,
 	void                        *handler_context,
@@ -660,7 +698,7 @@
 #define ACPI_REGION_DEACTIVATE  1
 
 typedef
-ACPI_STATUS (*WALK_CALLBACK) (
+ACPI_STATUS (*ACPI_WALK_CALLBACK) (
 	ACPI_HANDLE                 obj_handle,
 	u32                         nesting_level,
 	void                        *context,
@@ -697,7 +735,7 @@
 	ACPI_COMMON_OBJ_INFO;
 
 	u32                         valid;              /*  Are the next bits legit? */
-	NATIVE_CHAR                 hardware_id [9];    /*  _HID value if any */
+	NATIVE_CHAR                 hardware_id[9];     /*  _HID value if any */
 	NATIVE_CHAR                 unique_id[9];       /*  _UID value if any */
 	ACPI_INTEGER                address;            /*  _ADR value if any */
 	u32                         current_status;     /*  _STA value */
@@ -711,7 +749,7 @@
 	u32                         seg;
 	u32                         bus;
 	u32                         dev_func;
-} PCI_HANDLER_CONTEXT;
+} ACPI_PCI_SPACE_CONTEXT;
 
 
 typedef struct
@@ -719,7 +757,7 @@
 	ACPI_PHYSICAL_ADDRESS       mapped_physical_address;
 	u8                          *mapped_logical_address;
 	u32                         mapped_length;
-} MEM_HANDLER_CONTEXT;
+} ACPI_MEM_SPACE_CONTEXT;
 
 
 /*
@@ -821,7 +859,7 @@
 	u32                         number_of_interrupts;
 	u32                         interrupts[1];
 
-} IRQ_RESOURCE;
+} ACPI_RESOURCE_IRQ;
 
 typedef struct
 {
@@ -831,14 +869,14 @@
 	u32                         number_of_channels;
 	u32                         channels[1];
 
-} DMA_RESOURCE;
+} ACPI_RESOURCE_DMA;
 
 typedef struct
 {
 	u32                         compatibility_priority;
 	u32                         performance_robustness;
 
-} START_DEPENDENT_FUNCTIONS_RESOURCE;
+} ACPI_RESOURCE_START_DPF;
 
 /*
  * END_DEPENDENT_FUNCTIONS_RESOURCE struct is not
@@ -853,21 +891,21 @@
 	u32                         alignment;
 	u32                         range_length;
 
-} IO_RESOURCE;
+} ACPI_RESOURCE_IO;
 
 typedef struct
 {
 	u32                         base_address;
 	u32                         range_length;
 
-} FIXED_IO_RESOURCE;
+} ACPI_RESOURCE_FIXED_IO;
 
 typedef struct
 {
 	u32                         length;
 	u8                          reserved[1];
 
-} VENDOR_RESOURCE;
+} ACPI_RESOURCE_VENDOR;
 
 typedef struct
 {
@@ -877,7 +915,7 @@
 	u32                         alignment;
 	u32                         range_length;
 
-} MEMORY24_RESOURCE;
+} ACPI_RESOURCE_MEM24;
 
 typedef struct
 {
@@ -887,7 +925,7 @@
 	u32                         alignment;
 	u32                         range_length;
 
-} MEMORY32_RESOURCE;
+} ACPI_RESOURCE_MEM32;
 
 typedef struct
 {
@@ -895,36 +933,44 @@
 	u32                         range_base_address;
 	u32                         range_length;
 
-} FIXED_MEMORY32_RESOURCE;
+} ACPI_RESOURCE_FIXED_MEM32;
 
 typedef struct
 {
 	u16                         cache_attribute;
 	u16                         read_write_attribute;
 
-} MEMORY_ATTRIBUTE;
+} ACPI_MEMORY_ATTRIBUTE;
 
 typedef struct
 {
 	u16                         range_attribute;
 	u16                         reserved;
 
-} IO_ATTRIBUTE;
+} ACPI_IO_ATTRIBUTE;
 
 typedef struct
 {
 	u16                         reserved1;
 	u16                         reserved2;
 
-} BUS_ATTRIBUTE;
+} ACPI_BUS_ATTRIBUTE;
 
 typedef union
 {
-	MEMORY_ATTRIBUTE            memory;
-	IO_ATTRIBUTE                io;
-	BUS_ATTRIBUTE               bus;
+	ACPI_MEMORY_ATTRIBUTE       memory;
+	ACPI_IO_ATTRIBUTE           io;
+	ACPI_BUS_ATTRIBUTE          bus;
+
+} ACPI_RESOURCE_ATTRIBUTE;
+
+typedef struct
+{
+	u32                         index;
+	u32                         string_length;
+	NATIVE_CHAR                 *string_ptr;
 
-} ATTRIBUTE_DATA;
+} ACPI_RESOURCE_SOURCE;
 
 typedef struct
 {
@@ -933,17 +979,15 @@
 	u32                         decode;
 	u32                         min_address_fixed;
 	u32                         max_address_fixed;
-	ATTRIBUTE_DATA              attribute;
+	ACPI_RESOURCE_ATTRIBUTE     attribute;
 	u32                         granularity;
 	u32                         min_address_range;
 	u32                         max_address_range;
 	u32                         address_translation_offset;
 	u32                         address_length;
-	u32                         resource_source_index;
-	u32                         resource_source_string_length;
-	NATIVE_CHAR                 resource_source[1];
+	ACPI_RESOURCE_SOURCE        resource_source;
 
-} ADDRESS16_RESOURCE;
+} ACPI_RESOURCE_ADDRESS16;
 
 typedef struct
 {
@@ -952,17 +996,32 @@
 	u32                         decode;
 	u32                         min_address_fixed;
 	u32                         max_address_fixed;
-	ATTRIBUTE_DATA              attribute;
+	ACPI_RESOURCE_ATTRIBUTE     attribute;
 	u32                         granularity;
 	u32                         min_address_range;
 	u32                         max_address_range;
 	u32                         address_translation_offset;
 	u32                         address_length;
-	u32                         resource_source_index;
-	u32                         resource_source_string_length;
-	NATIVE_CHAR                 resource_source[1];
+	ACPI_RESOURCE_SOURCE        resource_source;
 
-} ADDRESS32_RESOURCE;
+} ACPI_RESOURCE_ADDRESS32;
+
+typedef struct
+{
+	u32                         resource_type;
+	u32                         producer_consumer;
+	u32                         decode;
+	u32                         min_address_fixed;
+	u32                         max_address_fixed;
+	ACPI_RESOURCE_ATTRIBUTE     attribute;
+	UINT64                      granularity;
+	UINT64                      min_address_range;
+	UINT64                      max_address_range;
+	UINT64                      address_translation_offset;
+	UINT64                      address_length;
+	ACPI_RESOURCE_SOURCE        resource_source;
+
+} ACPI_RESOURCE_ADDRESS64;
 
 typedef struct
 {
@@ -971,58 +1030,65 @@
 	u32                         active_high_low;
 	u32                         shared_exclusive;
 	u32                         number_of_interrupts;
+	ACPI_RESOURCE_SOURCE        resource_source;
 	u32                         interrupts[1];
-	u32                         resource_source_index;
-	u32                         resource_source_string_length;
-	NATIVE_CHAR                 resource_source[1];
-
-} EXTENDED_IRQ_RESOURCE;
-
-typedef enum
-{
-	irq,
-	dma,
-	start_dependent_functions,
-	end_dependent_functions,
-	io,
-	fixed_io,
-	vendor_specific,
-	end_tag,
-	memory24,
-	memory32,
-	fixed_memory32,
-	address16,
-	address32,
-	extended_irq
-} RESOURCE_TYPE;
+
+} ACPI_RESOURCE_EXT_IRQ;
+
+
+/* ACPI_RESOURCE_TYPEs */
+
+#define ACPI_RSTYPE_IRQ                 0
+#define ACPI_RSTYPE_DMA                 1
+#define ACPI_RSTYPE_START_DPF           2
+#define ACPI_RSTYPE_END_DPF             3
+#define ACPI_RSTYPE_IO                  4
+#define ACPI_RSTYPE_FIXED_IO            5
+#define ACPI_RSTYPE_VENDOR              6
+#define ACPI_RSTYPE_END_TAG             7
+#define ACPI_RSTYPE_MEM24               8
+#define ACPI_RSTYPE_MEM32               9
+#define ACPI_RSTYPE_FIXED_MEM32         10
+#define ACPI_RSTYPE_ADDRESS16           11
+#define ACPI_RSTYPE_ADDRESS32           12
+#define ACPI_RSTYPE_ADDRESS64           13
+#define ACPI_RSTYPE_EXT_IRQ             14
+
+typedef u32                     ACPI_RESOURCE_TYPE;
 
 typedef union
 {
-	IRQ_RESOURCE                        irq;
-	DMA_RESOURCE                        dma;
-	START_DEPENDENT_FUNCTIONS_RESOURCE  start_dependent_functions;
-	IO_RESOURCE                         io;
-	FIXED_IO_RESOURCE                   fixed_io;
-	VENDOR_RESOURCE                     vendor_specific;
-	MEMORY24_RESOURCE                   memory24;
-	MEMORY32_RESOURCE                   memory32;
-	FIXED_MEMORY32_RESOURCE             fixed_memory32;
-	ADDRESS16_RESOURCE                  address16;
-	ADDRESS32_RESOURCE                  address32;
-	EXTENDED_IRQ_RESOURCE               extended_irq;
-} RESOURCE_DATA;
+	ACPI_RESOURCE_IRQ           irq;
+	ACPI_RESOURCE_DMA           dma;
+	ACPI_RESOURCE_START_DPF     start_dpf;
+	ACPI_RESOURCE_IO            io;
+	ACPI_RESOURCE_FIXED_IO      fixed_io;
+	ACPI_RESOURCE_VENDOR        vendor_specific;
+	ACPI_RESOURCE_MEM24         memory24;
+	ACPI_RESOURCE_MEM32         memory32;
+	ACPI_RESOURCE_FIXED_MEM32   fixed_memory32;
+	ACPI_RESOURCE_ADDRESS16     address16;
+	ACPI_RESOURCE_ADDRESS32     address32;
+	ACPI_RESOURCE_ADDRESS64     address64;
+	ACPI_RESOURCE_EXT_IRQ       extended_irq;
+
+} ACPI_RESOURCE_DATA;
 
-typedef struct _resource_tag
+typedef struct acpi_resource
 {
-	RESOURCE_TYPE               id;
+	ACPI_RESOURCE_TYPE          id;
 	u32                         length;
-	RESOURCE_DATA               data;
-} RESOURCE;
+	ACPI_RESOURCE_DATA          data;
+
+} ACPI_RESOURCE;
+
+#define ACPI_RESOURCE_LENGTH            12
+#define ACPI_RESOURCE_LENGTH_NO_DATA    8       /* Id + Length fields */
+
+#define SIZEOF_RESOURCE(type)   (ACPI_RESOURCE_LENGTH_NO_DATA + sizeof (type))
 
-#define RESOURCE_LENGTH                 12
-#define RESOURCE_LENGTH_NO_DATA         8
+#define NEXT_RESOURCE(res)      (ACPI_RESOURCE *)((u8 *) res + res->length)
 
-#define NEXT_RESOURCE(res)    (RESOURCE*)((u8*) res + res->length)
 
 /*
  * END: Definitions for Resource Attributes
diff -urN linux-2.4.6-pre4/drivers/acpi/include/acutils.h linux/drivers/acpi/include/acutils.h
--- linux-2.4.6-pre4/drivers/acpi/include/acutils.h	Wed Dec 31 16:00:00 1969
+++ linux/drivers/acpi/include/acutils.h	Mon Dec  3 22:48:42 2001
@@ -0,0 +1,663 @@
+/******************************************************************************
+ *
+ * Name: acutils.h -- prototypes for the common (subsystem-wide) procedures
+ *       $Revision: 100 $
+ *
+ *****************************************************************************/
+
+/*
+ *  Copyright (C) 2000, 2001 R. Byron Moore
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#ifndef _ACUTILS_H
+#define _ACUTILS_H
+
+
+typedef
+ACPI_STATUS (*ACPI_PKG_CALLBACK) (
+	u8                      object_type,
+	ACPI_OPERAND_OBJECT     *source_object,
+	ACPI_GENERIC_STATE      *state,
+	void                    *context);
+
+
+ACPI_STATUS
+acpi_ut_walk_package_tree (
+	ACPI_OPERAND_OBJECT     *source_object,
+	void                    *target_object,
+	ACPI_PKG_CALLBACK       walk_callback,
+	void                    *context);
+
+
+typedef struct acpi_pkg_info
+{
+	u8                      *free_space;
+	u32                     length;
+	u32                     object_space;
+	u32                     num_packages;
+} ACPI_PKG_INFO;
+
+#define REF_INCREMENT       (u16) 0
+#define REF_DECREMENT       (u16) 1
+#define REF_FORCE_DELETE    (u16) 2
+
+/* Acpi_ut_dump_buffer */
+
+#define DB_BYTE_DISPLAY     1
+#define DB_WORD_DISPLAY     2
+#define DB_DWORD_DISPLAY    4
+#define DB_QWORD_DISPLAY    8
+
+
+/* Global initialization interfaces */
+
+void
+acpi_ut_init_globals (
+	void);
+
+void
+acpi_ut_terminate (
+	void);
+
+
+/*
+ * Ut_init - miscellaneous initialization and shutdown
+ */
+
+ACPI_STATUS
+acpi_ut_hardware_initialize (
+	void);
+
+ACPI_STATUS
+acpi_ut_subsystem_shutdown (
+	void);
+
+ACPI_STATUS
+acpi_ut_validate_fadt (
+	void);
+
+/*
+ * Ut_global - Global data structures and procedures
+ */
+
+#ifdef ACPI_DEBUG
+
+NATIVE_CHAR *
+acpi_ut_get_mutex_name (
+	u32                     mutex_id);
+
+NATIVE_CHAR *
+acpi_ut_get_type_name (
+	u32                     type);
+
+NATIVE_CHAR *
+acpi_ut_get_region_name (
+	u8                      space_id);
+
+#endif
+
+
+u8
+acpi_ut_valid_object_type (
+	u32                     type);
+
+ACPI_OWNER_ID
+acpi_ut_allocate_owner_id (
+	u32                     id_type);
+
+
+/*
+ * Ut_clib - Local implementations of C library functions
+ */
+
+#ifndef ACPI_USE_SYSTEM_CLIBRARY
+
+u32
+acpi_ut_strlen (
+	const NATIVE_CHAR       *string);
+
+NATIVE_CHAR *
+acpi_ut_strcpy (
+	NATIVE_CHAR             *dst_string,
+	const NATIVE_CHAR       *src_string);
+
+NATIVE_CHAR *
+acpi_ut_strncpy (
+	NATIVE_CHAR             *dst_string,
+	const NATIVE_CHAR       *src_string,
+	NATIVE_UINT             count);
+
+u32
+acpi_ut_strncmp (
+	const NATIVE_CHAR       *string1,
+	const NATIVE_CHAR       *string2,
+	NATIVE_UINT             count);
+
+u32
+acpi_ut_strcmp (
+	const NATIVE_CHAR       *string1,
+	const NATIVE_CHAR       *string2);
+
+NATIVE_CHAR *
+acpi_ut_strcat (
+	NATIVE_CHAR             *dst_string,
+	const NATIVE_CHAR       *src_string);
+
+NATIVE_CHAR *
+acpi_ut_strncat (
+	NATIVE_CHAR             *dst_string,
+	const NATIVE_CHAR       *src_string,
+	NATIVE_UINT             count);
+
+u32
+acpi_ut_strtoul (
+	const NATIVE_CHAR       *string,
+	NATIVE_CHAR             **terminator,
+	u32                     base);
+
+NATIVE_CHAR *
+acpi_ut_strstr (
+	NATIVE_CHAR             *string1,
+	NATIVE_CHAR             *string2);
+
+void *
+acpi_ut_memcpy (
+	void                    *dest,
+	const void              *src,
+	NATIVE_UINT             count);
+
+void *
+acpi_ut_memset (
+	void                    *dest,
+	NATIVE_UINT             value,
+	NATIVE_UINT             count);
+
+u32
+acpi_ut_to_upper (
+	u32                     c);
+
+u32
+acpi_ut_to_lower (
+	u32                     c);
+
+#endif /* ACPI_USE_SYSTEM_CLIBRARY */
+
+/*
+ * Ut_copy - Object construction and conversion interfaces
+ */
+
+ACPI_STATUS
+acpi_ut_build_simple_object(
+	ACPI_OPERAND_OBJECT     *obj,
+	ACPI_OBJECT             *user_obj,
+	u8                      *data_space,
+	u32                     *buffer_space_used);
+
+ACPI_STATUS
+acpi_ut_build_package_object (
+	ACPI_OPERAND_OBJECT     *obj,
+	u8                      *buffer,
+	u32                     *space_used);
+
+ACPI_STATUS
+acpi_ut_copy_iobject_to_eobject (
+	ACPI_OPERAND_OBJECT     *obj,
+	ACPI_BUFFER             *ret_buffer);
+
+ACPI_STATUS
+acpi_ut_copy_esimple_to_isimple(
+	ACPI_OBJECT             *user_obj,
+	ACPI_OPERAND_OBJECT     *obj);
+
+ACPI_STATUS
+acpi_ut_copy_eobject_to_iobject (
+	ACPI_OBJECT             *obj,
+	ACPI_OPERAND_OBJECT     *internal_obj);
+
+ACPI_STATUS
+acpi_ut_copy_isimple_to_isimple (
+	ACPI_OPERAND_OBJECT     *source_obj,
+	ACPI_OPERAND_OBJECT     *dest_obj);
+
+ACPI_STATUS
+acpi_ut_copy_ipackage_to_ipackage (
+	ACPI_OPERAND_OBJECT     *source_obj,
+	ACPI_OPERAND_OBJECT     *dest_obj,
+	ACPI_WALK_STATE         *walk_state);
+
+
+/*
+ * Ut_create - Object creation
+ */
+
+ACPI_STATUS
+acpi_ut_update_object_reference (
+	ACPI_OPERAND_OBJECT     *object,
+	u16                     action);
+
+ACPI_OPERAND_OBJECT  *
+_ut_create_internal_object (
+	NATIVE_CHAR             *module_name,
+	u32                     line_number,
+	u32                     component_id,
+	ACPI_OBJECT_TYPE8       type);
+
+
+/*
+ * Ut_debug - Debug interfaces
+ */
+
+u32
+get_debug_level (
+	void);
+
+void
+set_debug_level (
+	u32                     level);
+
+void
+function_trace (
+	NATIVE_CHAR             *module_name,
+	u32                     line_number,
+	u32                     component_id,
+	NATIVE_CHAR             *function_name);
+
+void
+function_trace_ptr (
+	NATIVE_CHAR             *module_name,
+	u32                     line_number,
+	u32                     component_id,
+	NATIVE_CHAR             *function_name,
+	void                    *pointer);
+
+void
+function_trace_u32 (
+	NATIVE_CHAR             *module_name,
+	u32                     line_number,
+	u32                     component_id,
+	NATIVE_CHAR             *function_name,
+	u32                     integer);
+
+void
+function_trace_str (
+	NATIVE_CHAR             *module_name,
+	u32                     line_number,
+	u32                     component_id,
+	NATIVE_CHAR             *function_name,
+	NATIVE_CHAR             *string);
+
+void
+function_exit (
+	NATIVE_CHAR             *module_name,
+	u32                     line_number,
+	u32                     component_id,
+	NATIVE_CHAR             *function_name);
+
+void
+function_status_exit (
+	NATIVE_CHAR             *module_name,
+	u32                     line_number,
+	u32                     component_id,
+	NATIVE_CHAR             *function_name,
+	ACPI_STATUS             status);
+
+void
+function_value_exit (
+	NATIVE_CHAR             *module_name,
+	u32                     line_number,
+	u32                     component_id,
+	NATIVE_CHAR             *function_name,
+	ACPI_INTEGER            value);
+
+void
+function_ptr_exit (
+	NATIVE_CHAR             *module_name,
+	u32                     line_number,
+	u32                     component_id,
+	NATIVE_CHAR             *function_name,
+	u8                      *ptr);
+
+void
+debug_print_prefix (
+	NATIVE_CHAR             *module_name,
+	u32                     line_number);
+
+void
+debug_print (
+	NATIVE_CHAR             *module_name,
+	u32                     line_number,
+	u32                     component_id,
+	u32                     print_level,
+	NATIVE_CHAR             *format, ...);
+
+void
+debug_print_raw (
+	NATIVE_CHAR             *format, ...);
+
+void
+_report_info (
+	NATIVE_CHAR             *module_name,
+	u32                     line_number,
+	u32                     component_id);
+
+void
+_report_error (
+	NATIVE_CHAR             *module_name,
+	u32                     line_number,
+	u32                     component_id);
+
+void
+_report_warning (
+	NATIVE_CHAR             *module_name,
+	u32                     line_number,
+	u32                     component_id);
+
+void
+acpi_ut_dump_buffer (
+	u8                      *buffer,
+	u32                     count,
+	u32                     display,
+	u32                     component_id);
+
+
+/*
+ * Ut_delete - Object deletion
+ */
+
+void
+acpi_ut_delete_internal_obj (
+	ACPI_OPERAND_OBJECT     *object);
+
+void
+acpi_ut_delete_internal_package_object (
+	ACPI_OPERAND_OBJECT     *object);
+
+void
+acpi_ut_delete_internal_simple_object (
+	ACPI_OPERAND_OBJECT     *object);
+
+ACPI_STATUS
+acpi_ut_delete_internal_object_list (
+	ACPI_OPERAND_OBJECT     **obj_list);
+
+
+/*
+ * Ut_eval - object evaluation
+ */
+
+/* Method name strings */
+
+#define METHOD_NAME__HID        "_HID"
+#define METHOD_NAME__UID        "_UID"
+#define METHOD_NAME__ADR        "_ADR"
+#define METHOD_NAME__STA        "_STA"
+#define METHOD_NAME__REG        "_REG"
+#define METHOD_NAME__SEG        "_SEG"
+#define METHOD_NAME__BBN        "_BBN"
+
+
+ACPI_STATUS
+acpi_ut_evaluate_numeric_object (
+	NATIVE_CHAR             *object_name,
+	ACPI_NAMESPACE_NODE     *device_node,
+	ACPI_INTEGER            *address);
+
+ACPI_STATUS
+acpi_ut_execute_HID (
+	ACPI_NAMESPACE_NODE     *device_node,
+	ACPI_DEVICE_ID          *hid);
+
+ACPI_STATUS
+acpi_ut_execute_STA (
+	ACPI_NAMESPACE_NODE     *device_node,
+	u32                     *status_flags);
+
+ACPI_STATUS
+acpi_ut_execute_UID (
+	ACPI_NAMESPACE_NODE     *device_node,
+	ACPI_DEVICE_ID          *uid);
+
+
+/*
+ * Ut_error - exception interfaces
+ */
+
+NATIVE_CHAR *
+acpi_ut_format_exception (
+	ACPI_STATUS             status);
+
+
+/*
+ * Ut_mutex - mutual exclusion interfaces
+ */
+
+ACPI_STATUS
+acpi_ut_mutex_initialize (
+	void);
+
+void
+acpi_ut_mutex_terminate (
+	void);
+
+ACPI_STATUS
+acpi_ut_create_mutex (
+	ACPI_MUTEX_HANDLE       mutex_id);
+
+ACPI_STATUS
+acpi_ut_delete_mutex (
+	ACPI_MUTEX_HANDLE       mutex_id);
+
+ACPI_STATUS
+acpi_ut_acquire_mutex (
+	ACPI_MUTEX_HANDLE       mutex_id);
+
+ACPI_STATUS
+acpi_ut_release_mutex (
+	ACPI_MUTEX_HANDLE       mutex_id);
+
+
+/*
+ * Ut_object - internal object create/delete/cache routines
+ */
+
+void *
+_ut_allocate_object_desc (
+	NATIVE_CHAR             *module_name,
+	u32                     line_number,
+	u32                     component_id);
+
+#define acpi_ut_create_internal_object(t) _ut_create_internal_object(_THIS_MODULE,__LINE__,_COMPONENT,t)
+#define acpi_ut_allocate_object_desc()  _ut_allocate_object_desc(_THIS_MODULE,__LINE__,_COMPONENT)
+
+void
+acpi_ut_delete_object_desc (
+	ACPI_OPERAND_OBJECT     *object);
+
+u8
+acpi_ut_valid_internal_object (
+	void                    *object);
+
+
+/*
+ * Ut_ref_cnt - Object reference count management
+ */
+
+void
+acpi_ut_add_reference (
+	ACPI_OPERAND_OBJECT     *object);
+
+void
+acpi_ut_remove_reference (
+	ACPI_OPERAND_OBJECT     *object);
+
+/*
+ * Ut_size - Object size routines
+ */
+
+ACPI_STATUS
+acpi_ut_get_simple_object_size (
+	ACPI_OPERAND_OBJECT     *obj,
+	u32                     *obj_length);
+
+ACPI_STATUS
+acpi_ut_get_package_object_size (
+	ACPI_OPERAND_OBJECT     *obj,
+	u32                     *obj_length);
+
+ACPI_STATUS
+acpi_ut_get_object_size(
+	ACPI_OPERAND_OBJECT     *obj,
+	u32                     *obj_length);
+
+
+/*
+ * Ut_state - Generic state creation/cache routines
+ */
+
+void
+acpi_ut_push_generic_state (
+	ACPI_GENERIC_STATE      **list_head,
+	ACPI_GENERIC_STATE      *state);
+
+ACPI_GENERIC_STATE *
+acpi_ut_pop_generic_state (
+	ACPI_GENERIC_STATE      **list_head);
+
+
+ACPI_GENERIC_STATE *
+acpi_ut_create_generic_state (
+	void);
+
+ACPI_GENERIC_STATE *
+acpi_ut_create_update_state (
+	ACPI_OPERAND_OBJECT     *object,
+	u16                     action);
+
+ACPI_GENERIC_STATE *
+acpi_ut_create_pkg_state (
+	void                    *internal_object,
+	void                    *external_object,
+	u16                     index);
+
+ACPI_STATUS
+acpi_ut_create_update_state_and_push (
+	ACPI_OPERAND_OBJECT     *object,
+	u16                     action,
+	ACPI_GENERIC_STATE      **state_list);
+
+ACPI_STATUS
+acpi_ut_create_pkg_state_and_push (
+	void                    *internal_object,
+	void                    *external_object,
+	u16                     index,
+	ACPI_GENERIC_STATE      **state_list);
+
+ACPI_GENERIC_STATE *
+acpi_ut_create_control_state (
+	void);
+
+void
+acpi_ut_delete_generic_state (
+	ACPI_GENERIC_STATE      *state);
+
+void
+acpi_ut_delete_generic_state_cache (
+	void);
+
+void
+acpi_ut_delete_object_cache (
+	void);
+
+/*
+ * Ututils
+ */
+
+u8
+acpi_ut_valid_acpi_name (
+	u32                     name);
+
+u8
+acpi_ut_valid_acpi_character (
+	NATIVE_CHAR             character);
+
+NATIVE_CHAR *
+acpi_ut_strupr (
+	NATIVE_CHAR             *src_string);
+
+ACPI_STATUS
+acpi_ut_resolve_package_references (
+	ACPI_OPERAND_OBJECT     *obj_desc);
+
+
+#ifdef ACPI_DEBUG
+void
+acpi_ut_display_init_pathname (
+	ACPI_HANDLE             obj_handle,
+	char                    *path);
+
+#endif
+
+
+/*
+ * Memory allocation functions and related macros.
+ * Macros that expand to include filename and line number
+ */
+
+void *
+_ut_allocate (
+	u32                     size,
+	u32                     component,
+	NATIVE_CHAR             *module,
+	u32                     line);
+
+void *
+_ut_callocate (
+	u32                     size,
+	u32                     component,
+	NATIVE_CHAR             *module,
+	u32                     line);
+
+void
+_ut_free (
+	void                    *address,
+	u32                     component,
+	NATIVE_CHAR             *module,
+	u32                     line);
+
+void
+acpi_ut_init_static_object (
+	ACPI_OPERAND_OBJECT     *obj_desc);
+
+
+#ifdef ACPI_DEBUG_TRACK_ALLOCATIONS
+void
+acpi_ut_dump_allocation_info (
+	void);
+
+void
+acpi_ut_dump_current_allocations (
+	u32                     component,
+	NATIVE_CHAR             *module);
+#endif
+
+
+#define acpi_ut_allocate(a) _ut_allocate(a,_COMPONENT,_THIS_MODULE,__LINE__)
+#define acpi_ut_callocate(a) _ut_callocate(a, _COMPONENT,_THIS_MODULE,__LINE__)
+#define acpi_ut_free(a)     _ut_free(a,_COMPONENT,_THIS_MODULE,__LINE__)
+
+
+#endif /* _ACUTILS_H */
diff -urN linux-2.4.6-pre4/drivers/acpi/include/amlcode.h linux/drivers/acpi/include/amlcode.h
--- linux-2.4.6-pre4/drivers/acpi/include/amlcode.h	Mon Jan 22 13:23:42 2001
+++ linux/drivers/acpi/include/amlcode.h	Mon Dec  3 22:48:42 2001
@@ -3,7 +3,7 @@
  * Name: amlcode.h - Definitions for AML, as included in "definition blocks"
  *                   Declarations and definitions contained herein are derived
  *                   directly from the ACPI specification.
- *       $Revision: 46 $
+ *       $Revision: 52 $
  *
  *****************************************************************************/
 
@@ -98,12 +98,12 @@
 #define AML_SIZE_OF_OP              (u16) 0x87
 #define AML_INDEX_OP                (u16) 0x88
 #define AML_MATCH_OP                (u16) 0x89
-#define AML_DWORD_FIELD_OP          (u16) 0x8a
-#define AML_WORD_FIELD_OP           (u16) 0x8b
-#define AML_BYTE_FIELD_OP           (u16) 0x8c
-#define AML_BIT_FIELD_OP            (u16) 0x8d
+#define AML_CREATE_DWORD_FIELD_OP   (u16) 0x8a
+#define AML_CREATE_WORD_FIELD_OP    (u16) 0x8b
+#define AML_CREATE_BYTE_FIELD_OP    (u16) 0x8c
+#define AML_CREATE_BIT_FIELD_OP     (u16) 0x8d
 #define AML_TYPE_OP                 (u16) 0x8e
-#define AML_QWORD_FIELD_OP          (u16) 0x8f     /* ACPI 2.0 */
+#define AML_CREATE_QWORD_FIELD_OP   (u16) 0x8f     /* ACPI 2.0 */
 #define AML_LAND_OP                 (u16) 0x90
 #define AML_LOR_OP                  (u16) 0x91
 #define AML_LNOT_OP                 (u16) 0x92
@@ -154,7 +154,7 @@
 #define AML_DEBUG_OP                (u16) 0x5b31
 #define AML_FATAL_OP                (u16) 0x5b32
 #define AML_REGION_OP               (u16) 0x5b80
-#define AML_DEF_FIELD_OP            (u16) 0x5b81
+#define AML_FIELD_OP                (u16) 0x5b81
 #define AML_DEVICE_OP               (u16) 0x5b82
 #define AML_PROCESSOR_OP            (u16) 0x5b83
 #define AML_POWER_RES_OP            (u16) 0x5b84
@@ -177,14 +177,14 @@
  * any valid ACPI ASCII values (A-Z, 0-9, '-')
  */
 
-#define AML_NAMEPATH_OP             (u16) 0x002d
-#define AML_NAMEDFIELD_OP           (u16) 0x0030
-#define AML_RESERVEDFIELD_OP        (u16) 0x0031
-#define AML_ACCESSFIELD_OP          (u16) 0x0032
-#define AML_BYTELIST_OP             (u16) 0x0033
-#define AML_STATICSTRING_OP         (u16) 0x0034
-#define AML_METHODCALL_OP           (u16) 0x0035
-#define AML_RETURN_VALUE_OP         (u16) 0x0036
+#define AML_INT_NAMEPATH_OP         (u16) 0x002d
+#define AML_INT_NAMEDFIELD_OP       (u16) 0x0030
+#define AML_INT_RESERVEDFIELD_OP    (u16) 0x0031
+#define AML_INT_ACCESSFIELD_OP      (u16) 0x0032
+#define AML_INT_BYTELIST_OP         (u16) 0x0033
+#define AML_INT_STATICSTRING_OP     (u16) 0x0034
+#define AML_INT_METHODCALL_OP       (u16) 0x0035
+#define AML_INT_RETURN_VALUE_OP     (u16) 0x0036
 
 
 #define ARG_NONE                    0x0
@@ -222,7 +222,7 @@
 
 /* "Standard" ACPI types are 1-15 (0x0F) */
 
-#define ARGI_INTEGER                 ACPI_TYPE_INTEGER        /* 1 */
+#define ARGI_INTEGER                ACPI_TYPE_INTEGER       /* 1 */
 #define ARGI_STRING                 ACPI_TYPE_STRING        /* 2 */
 #define ARGI_BUFFER                 ACPI_TYPE_BUFFER        /* 3 */
 #define ARGI_PACKAGE                ACPI_TYPE_PACKAGE       /* 4 */
@@ -237,8 +237,8 @@
 #define ARGI_ANYOBJECT              0x11
 #define ARGI_ANYTYPE                0x12
 #define ARGI_COMPUTEDATA            0x13     /* Buffer, String, or Integer */
-#define ARGI_DATAOBJECT             0x14     /* Buffer, string, package or reference to a Node - Used only by Size_of operator*/
-#define ARGI_COMPLEXOBJ             0x15     /* Buffer or package */
+#define ARGI_DATAOBJECT             0x14     /* Buffer, String, package or reference to a Node - Used only by Size_of operator*/
+#define ARGI_COMPLEXOBJ             0x15     /* Buffer, String, or package (Used by INDEX op only) */
 #define ARGI_INTEGER_REF            0x16
 #define ARGI_OBJECT_REF             0x17
 #define ARGI_DEVICE_REF             0x18
@@ -312,13 +312,14 @@
 
 typedef enum
 {
-	REGION_MEMORY               = 0,
+	REGION_MEMORY                   = 0,
 	REGION_IO,
 	REGION_PCI_CONFIG,
 	REGION_EC,
 	REGION_SMBUS,
 	REGION_CMOS,
-	REGION_PCI_BAR
+	REGION_PCI_BAR,
+	REGION_FIXED_HW                 = 0x7F,
 
 } AML_REGION_TYPES;
 
@@ -327,80 +328,82 @@
 
 typedef enum
 {
-	MATCH_MTR                   = 0,
-	MATCH_MEQ                   = 1,
-	MATCH_MLE                   = 2,
-	MATCH_MLT                   = 3,
-	MATCH_MGE                   = 4,
-	MATCH_MGT                   = 5
+	MATCH_MTR                       = 0,
+	MATCH_MEQ                       = 1,
+	MATCH_MLE                       = 2,
+	MATCH_MLT                       = 3,
+	MATCH_MGE                       = 4,
+	MATCH_MGT                       = 5
 
 } AML_MATCH_OPERATOR;
 
-#define MAX_MATCH_OPERATOR      5
+#define MAX_MATCH_OPERATOR          5
 
 
 /* Field Access Types */
 
-#define ACCESS_TYPE_MASK        0x0f
-#define ACCESS_TYPE_SHIFT       0
+#define ACCESS_TYPE_MASK            0x0f
+#define ACCESS_TYPE_SHIFT           0
 
 typedef enum
 {
-	ACCESS_ANY_ACC              = 0,
-	ACCESS_BYTE_ACC             = 1,
-	ACCESS_WORD_ACC             = 2,
-	ACCESS_DWORD_ACC            = 3,
-	ACCESS_BLOCK_ACC            = 4,
-	ACCESS_SMBSEND_RECV_ACC     = 5,
-	ACCESS_SMBQUICK_ACC         = 6
+	ACCESS_ANY_ACC                  = 0,
+	ACCESS_BYTE_ACC                 = 1,
+	ACCESS_WORD_ACC                 = 2,
+	ACCESS_DWORD_ACC                = 3,
+	ACCESS_QWORD_ACC                = 4,    /* ACPI 2.0 */
+	ACCESS_BLOCK_ACC                = 4,
+	ACCESS_SMBSEND_RECV_ACC         = 5,
+	ACCESS_SMBQUICK_ACC             = 6
 
 } AML_ACCESS_TYPE;
 
 
 /* Field Lock Rules */
 
-#define LOCK_RULE_MASK          0x10
-#define LOCK_RULE_SHIFT         4
+#define LOCK_RULE_MASK              0x10
+#define LOCK_RULE_SHIFT             4
 
 typedef enum
 {
-	GLOCK_NEVER_LOCK            = 0,
-	GLOCK_ALWAYS_LOCK           = 1
+	GLOCK_NEVER_LOCK                = 0,
+	GLOCK_ALWAYS_LOCK               = 1
 
 } AML_LOCK_RULE;
 
 
 /* Field Update Rules */
 
-#define UPDATE_RULE_MASK        0x060
-#define UPDATE_RULE_SHIFT       5
+#define UPDATE_RULE_MASK            0x060
+#define UPDATE_RULE_SHIFT           5
 
 typedef enum
 {
-	UPDATE_PRESERVE             = 0,
-	UPDATE_WRITE_AS_ONES        = 1,
-	UPDATE_WRITE_AS_ZEROS       = 2
+	UPDATE_PRESERVE                 = 0,
+	UPDATE_WRITE_AS_ONES            = 1,
+	UPDATE_WRITE_AS_ZEROS           = 2
 
 } AML_UPDATE_RULE;
 
 
 /* bit fields in Method_flags byte */
 
-#define METHOD_FLAGS_ARG_COUNT  0x07
-#define METHOD_FLAGS_SERIALIZED 0x08
+#define METHOD_FLAGS_ARG_COUNT      0x07
+#define METHOD_FLAGS_SERIALIZED     0x08
+#define METHOD_FLAGS_SYNCH_LEVEL    0xF0
 
 
 /* Array sizes.  Used for range checking also */
 
-#define NUM_REGION_TYPES        7
-#define NUM_ACCESS_TYPES        7
-#define NUM_UPDATE_RULES        3
-#define NUM_MATCH_OPS           7
-#define NUM_OPCODES             256
-#define NUM_FIELD_NAMES         2
+#define NUM_REGION_TYPES            7
+#define NUM_ACCESS_TYPES            7
+#define NUM_UPDATE_RULES            3
+#define NUM_MATCH_OPS               7
+#define NUM_OPCODES                 256
+#define NUM_FIELD_NAMES             2
 
 
-#define USER_REGION_BEGIN       0x80
+#define USER_REGION_BEGIN           0x80
 
 /*
  * AML tables
@@ -408,7 +411,7 @@
 
 #ifdef DEFINE_AML_GLOBALS
 
-/* External declarations of the AML tables */
+/* External declarations for the AML tables */
 
 extern u8                       acpi_gbl_aml            [NUM_OPCODES];
 extern u16                      acpi_gbl_pfx            [NUM_OPCODES];
diff -urN linux-2.4.6-pre4/drivers/acpi/include/platform/acenv.h linux/drivers/acpi/include/platform/acenv.h
--- linux-2.4.6-pre4/drivers/acpi/include/platform/acenv.h	Wed Dec 31 16:00:00 1969
+++ linux/drivers/acpi/include/platform/acenv.h	Mon Dec  3 22:48:42 2001
@@ -0,0 +1,288 @@
+/******************************************************************************
+ *
+ * Name: acenv.h - Generation environment specific items
+ *       $Revision: 75 $
+ *
+ *****************************************************************************/
+
+/*
+ *  Copyright (C) 2000, 2001 R. Byron Moore
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#ifndef __ACENV_H__
+#define __ACENV_H__
+
+
+/*
+ * Configuration for ACPI tools and utilities
+ */
+
+#ifdef _ACPI_DUMP_APP
+#define ACPI_DEBUG
+#define ACPI_APPLICATION
+#define ENABLE_DEBUGGER
+#define ACPI_USE_SYSTEM_CLIBRARY
+#define PARSER_ONLY
+#endif
+
+#ifdef _ACPI_EXEC_APP
+#undef DEBUGGER_THREADING
+#define DEBUGGER_THREADING      DEBUGGER_SINGLE_THREADED
+#define ACPI_DEBUG
+#define ACPI_APPLICATION
+#define ENABLE_DEBUGGER
+#define ACPI_USE_SYSTEM_CLIBRARY
+#endif
+
+#ifdef _ACPI_ASL_COMPILER
+#define ACPI_DEBUG
+#define ACPI_APPLICATION
+#define ENABLE_DEBUGGER
+#define ACPI_USE_SYSTEM_CLIBRARY
+#endif
+
+/*
+ * Memory allocation tracking.  Used only if
+ * 1) This is the debug version
+ * 2) This is NOT a 16-bit version of the code (not enough real-mode memory)
+ */
+#ifdef ACPI_DEBUG
+#ifndef _IA16
+#define ACPI_DEBUG_TRACK_ALLOCATIONS
+#endif
+#endif
+
+/*
+ * Environment configuration.  The purpose of this file is to interface to the
+ * local generation environment.
+ *
+ * 1) ACPI_USE_SYSTEM_CLIBRARY - Define this if linking to an actual C library.
+ *      Otherwise, local versions of string/memory functions will be used.
+ * 2) ACPI_USE_STANDARD_HEADERS - Define this if linking to a C library and
+ *      the standard header files may be used.
+ *
+ * The ACPI subsystem only uses low level C library functions that do not call
+ * operating system services and may therefore be inlined in the code.
+ *
+ * It may be necessary to tailor these include files to the target
+ * generation environment.
+ *
+ *
+ * Functions and constants used from each header:
+ *
+ * string.h:    memcpy
+ *              memset
+ *              strcat
+ *              strcmp
+ *              strcpy
+ *              strlen
+ *              strncmp
+ *              strncat
+ *              strncpy
+ *
+ * stdlib.h:    strtoul
+ *
+ * stdarg.h:    va_list
+ *              va_arg
+ *              va_start
+ *              va_end
+ *
+ */
+
+/*! [Begin] no source code translation */
+
+#ifdef _LINUX
+#include "aclinux.h"
+
+#elif _AED_EFI
+#include "acefi.h"
+
+#elif WIN32
+#include "acwin.h"
+
+#elif __FreeBSD__
+#include "acfreebsd.h"
+
+#else
+
+/* All other environments */
+
+#define ACPI_USE_STANDARD_HEADERS
+
+/* Name of host operating system (returned by the _OS_ namespace object) */
+
+#define ACPI_OS_NAME         "Intel ACPI/CA Core Subsystem"
+
+#endif
+
+
+/*! [End] no source code translation !*/
+
+/******************************************************************************
+ *
+ * C library configuration
+ *
+ *****************************************************************************/
+
+#ifdef ACPI_USE_SYSTEM_CLIBRARY
+/*
+ * Use the standard C library headers.
+ * We want to keep these to a minimum.
+ *
+ */
+
+#ifdef ACPI_USE_STANDARD_HEADERS
+/*
+ * Use the standard headers from the standard locations
+ */
+#include <stdarg.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+
+#endif /* ACPI_USE_STANDARD_HEADERS */
+
+/*
+ * We will be linking to the standard Clib functions
+ */
+
+#define STRSTR(s1,s2)   strstr((s1), (s2))
+#define STRUPR(s)       acpi_ut_strupr ((s))
+#define STRLEN(s)       (u32) strlen((s))
+#define STRCPY(d,s)     strcpy((d), (s))
+#define STRNCPY(d,s,n)  strncpy((d), (s), (NATIVE_INT)(n))
+#define STRNCMP(d,s,n)  strncmp((d), (s), (NATIVE_INT)(n))
+#define STRCMP(d,s)     strcmp((d), (s))
+#define STRCAT(d,s)     strcat((d), (s))
+#define STRNCAT(d,s,n)  strncat((d), (s), (NATIVE_INT)(n))
+#define STRTOUL(d,s,n)  strtoul((d), (s), (NATIVE_INT)(n))
+#define MEMCPY(d,s,n)   memcpy((d), (s), (NATIVE_INT)(n))
+#define MEMSET(d,s,n)   memset((d), (s), (NATIVE_INT)(n))
+#define TOUPPER         toupper
+#define TOLOWER         tolower
+#define IS_XDIGIT       isxdigit
+
+/******************************************************************************
+ *
+ * Not using native C library, use local implementations
+ *
+ *****************************************************************************/
+#else
+
+/*
+ * Use local definitions of C library macros and functions
+ * NOTE: The function implementations may not be as efficient
+ * as an inline or assembly code implementation provided by a
+ * native C library.
+ */
+
+#ifndef va_arg
+
+#ifndef _VALIST
+#define _VALIST
+typedef char *va_list;
+#endif /* _VALIST */
+
+/*
+ * Storage alignment properties
+ */
+
+#define  _AUPBND         (sizeof (NATIVE_INT) - 1)
+#define  _ADNBND         (sizeof (NATIVE_INT) - 1)
+
+/*
+ * Variable argument list macro definitions
+ */
+
+#define _bnd(X, bnd)    (((sizeof (X)) + (bnd)) & (~(bnd)))
+#define va_arg(ap, T)   (*(T *)(((ap) += (_bnd (T, _AUPBND))) - (_bnd (T,_ADNBND))))
+#define va_end(ap)      (void) 0
+#define va_start(ap, A) (void) ((ap) = (((char *) &(A)) + (_bnd (A,_AUPBND))))
+
+#endif /* va_arg */
+
+
+#define STRSTR(s1,s2)    acpi_ut_strstr ((s1), (s2))
+#define STRUPR(s)        acpi_ut_strupr ((s))
+#define STRLEN(s)        acpi_ut_strlen ((s))
+#define STRCPY(d,s)      acpi_ut_strcpy ((d), (s))
+#define STRNCPY(d,s,n)   acpi_ut_strncpy ((d), (s), (n))
+#define STRNCMP(d,s,n)   acpi_ut_strncmp ((d), (s), (n))
+#define STRCMP(d,s)      acpi_ut_strcmp ((d), (s))
+#define STRCAT(d,s)      acpi_ut_strcat ((d), (s))
+#define STRNCAT(d,s,n)   acpi_ut_strncat ((d), (s), (n))
+#define STRTOUL(d,s,n)   acpi_ut_strtoul ((d), (s),(n))
+#define MEMCPY(d,s,n)    acpi_ut_memcpy ((d), (s), (n))
+#define MEMSET(d,v,n)    acpi_ut_memset ((d), (v), (n))
+#define TOUPPER          acpi_ut_to_upper
+#define TOLOWER          acpi_ut_to_lower
+
+#endif /* ACPI_USE_SYSTEM_CLIBRARY */
+
+
+/******************************************************************************
+ *
+ * Assembly code macros
+ *
+ *****************************************************************************/
+
+/*
+ * Handle platform- and compiler-specific assembly language differences.
+ * These should already have been defined by the platform includes above.
+ *
+ * Notes:
+ * 1) Interrupt 3 is used to break into a debugger
+ * 2) Interrupts are turned off during ACPI register setup
+ */
+
+/* Unrecognized compiler, use defaults */
+#ifndef ACPI_ASM_MACROS
+
+#define ACPI_ASM_MACROS
+#define causeinterrupt(level)
+#define BREAKPOINT3
+#define disable()
+#define enable()
+#define halt()
+#define ACPI_ACQUIRE_GLOBAL_LOCK(Glptr, acq)
+#define ACPI_RELEASE_GLOBAL_LOCK(Glptr, acq)
+
+#endif /* ACPI_ASM_MACROS */
+
+
+#ifdef ACPI_APPLICATION
+
+/* Don't want software interrupts within a ring3 application */
+
+#undef causeinterrupt
+#undef BREAKPOINT3
+#define causeinterrupt(level)
+#define BREAKPOINT3
+#endif
+
+
+/******************************************************************************
+ *
+ * Compiler-specific
+ *
+ *****************************************************************************/
+
+/* this has been moved to compiler-specific headers, which are included from the
+   platform header. */
+
+
+#endif /* __ACENV_H__ */
diff -urN linux-2.4.6-pre4/drivers/acpi/include/platform/acgcc.h linux/drivers/acpi/include/platform/acgcc.h
--- linux-2.4.6-pre4/drivers/acpi/include/platform/acgcc.h	Wed Dec 31 16:00:00 1969
+++ linux/drivers/acpi/include/platform/acgcc.h	Mon Dec  3 22:48:42 2001
@@ -0,0 +1,147 @@
+/******************************************************************************
+ *
+ * Name: acgcc.h - GCC specific defines, etc.
+ *       $Revision: 6 $
+ *
+ *****************************************************************************/
+
+/*
+ *  Copyright (C) 2000, 2001 R. Byron Moore
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#ifndef __ACGCC_H__
+#define __ACGCC_H__
+
+
+#ifdef __ia64__
+#define _IA64
+
+#define COMPILER_DEPENDENT_UINT64   unsigned long
+/* Single threaded */
+#define ACPI_APPLICATION
+
+#define ACPI_ASM_MACROS
+#define causeinterrupt(level)
+#define BREAKPOINT3
+#define disable() __cli()
+#define enable()  __sti()
+#define wbinvd()
+
+/*! [Begin] no source code translation */
+
+#include <asm/pal.h>
+
+#define halt()              ia64_pal_halt_light()           /* PAL_HALT[_LIGHT] */
+#define safe_halt()         ia64_pal_halt(1)                /* PAL_HALT */
+
+
+#define ACPI_ACQUIRE_GLOBAL_LOCK(GLptr, Acq) \
+	do { \
+	__asm__ volatile ("1:  ld4      r29=%1\n"  \
+		";;\n"                  \
+		"mov    ar.ccv=r29\n"   \
+		"mov    r2=r29\n"       \
+		"shr.u  r30=r29,1\n"    \
+		"and    r29=-4,r29\n"   \
+		";;\n"                  \
+		"add    r29=2,r29\n"    \
+		"and    r30=1,r30\n"    \
+		";;\n"                  \
+		"add    r29=r29,r30\n"  \
+		";;\n"                  \
+		"cmpxchg4.acq   r30=%1,r29,ar.ccv\n" \
+		";;\n"                  \
+		"cmp.eq p6,p7=r2,r30\n" \
+		"(p7) br.dpnt.few 1b\n" \
+		"cmp.gt p8,p9=3,r29\n"  \
+		";;\n"                  \
+		"(p8) mov %0=-1\n"      \
+		"(p9) mov %0=r0\n"      \
+		:"=r"(Acq):"m"(GLptr):"r2","r29","r30","memory"); \
+	} while (0)
+
+#define ACPI_RELEASE_GLOBAL_LOCK(GLptr, Acq) \
+	do { \
+	__asm__ volatile ("1:  ld4      r29=%1\n" \
+		";;\n"                  \
+		"mov    ar.ccv=r29\n"   \
+		"mov    r2=r29\n"       \
+		"and    r29=-4,r29\n"   \
+		";;\n"                  \
+		"cmpxchg4.acq   r30=%1,r29,ar.ccv\n" \
+		";;\n"                  \
+		"cmp.eq p6,p7=r2,r30\n" \
+		"(p7) br.dpnt.few 1b\n" \
+		"and    %0=1,r2\n"      \
+		";;\n"                  \
+		:"=r"(Acq):"m"(GLptr):"r2","r29","r30","memory"); \
+	} while (0)
+/*! [End] no source code translation !*/
+
+
+#else /* DO IA32 */
+#define COMPILER_DEPENDENT_UINT64   unsigned long long
+#define ACPI_ASM_MACROS
+#define causeinterrupt(level)
+#define BREAKPOINT3
+#define disable() __cli()
+#define enable()  __sti()
+#define halt()    __asm__ __volatile__ ("sti; hlt":::"memory")
+#define wbinvd()
+
+/*! [Begin] no source code translation
+ *
+ * A brief explanation as GNU inline assembly is a bit hairy
+ *  %0 is the output parameter in EAX ("=a")
+ *  %1 and %2 are the input parameters in ECX ("c")
+ *  and an immediate value ("i") respectively
+ *  All actual register references are preceded with "%%" as in "%%edx"
+ *  Immediate values in the assembly are preceded by "$" as in "$0x1"
+ *  The final asm parameter are the operation altered non-output registers.
+ */
+#define ACPI_ACQUIRE_GLOBAL_LOCK(GLptr, Acq) \
+	do { \
+		int dummy; \
+		asm("1:     movl (%1),%%eax;" \
+			"movl   %%eax,%%edx;" \
+			"andl   %2,%%edx;" \
+			"btsl   $0x1,%%edx;" \
+			"adcl   $0x0,%%edx;" \
+			"lock;  cmpxchgl %%edx,(%1);" \
+			"jnz    1b;" \
+			"cmpb   $0x3,%%dl;" \
+			"sbbl   %%eax,%%eax" \
+			:"=a"(Acq),"=c"(dummy):"c"(GLptr),"i"(~1L):"dx"); \
+	} while(0)
+
+#define ACPI_RELEASE_GLOBAL_LOCK(GLptr, Acq) \
+	do { \
+		int dummy; \
+		asm("1:     movl (%1),%%eax;" \
+			"movl   %%eax,%%edx;" \
+			"andl   %2,%%edx;" \
+			"lock;  cmpxchgl %%edx,(%1);" \
+			"jnz    1b;" \
+			"andl   $0x1,%%eax" \
+			:"=a"(Acq),"=c"(dummy):"c"(GLptr),"i"(~3L):"dx"); \
+	} while(0)
+
+/*! [End] no source code translation !*/
+
+#endif /* IA 32 */
+
+#endif /* __ACGCC_H__ */
diff -urN linux-2.4.6-pre4/drivers/acpi/include/platform/aclinux.h linux/drivers/acpi/include/platform/aclinux.h
--- linux-2.4.6-pre4/drivers/acpi/include/platform/aclinux.h	Wed Dec 31 16:00:00 1969
+++ linux/drivers/acpi/include/platform/aclinux.h	Mon Dec  3 22:48:42 2001
@@ -0,0 +1,71 @@
+/******************************************************************************
+ *
+ * Name: aclinux.h - OS specific defines, etc.
+ *       $Revision: 13 $
+ *
+ *****************************************************************************/
+
+/*
+ *  Copyright (C) 2000, 2001 R. Byron Moore
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#ifndef __ACLINUX_H__
+#define __ACLINUX_H__
+
+#define ACPI_OS_NAME                "Linux"
+
+#define ACPI_USE_SYSTEM_CLIBRARY
+
+#ifdef __KERNEL__
+
+#include <linux/config.h>
+#include <linux/string.h>
+#include <linux/kernel.h>
+#include <linux/ctype.h>
+#include <asm/system.h>
+#include <asm/atomic.h>
+#include <asm/div64.h>
+
+#define strtoul simple_strtoul
+
+#else
+
+#include <stdarg.h>
+#include <string.h>
+#include <stdlib.h>
+#include <ctype.h>
+
+#endif
+
+/* Linux uses GCC */
+
+#include "acgcc.h"
+
+#undef DEBUGGER_THREADING
+#define DEBUGGER_THREADING          DEBUGGER_SINGLE_THREADED
+
+#ifndef _IA64
+/* Linux ia32 can't do int64 well */
+#define ACPI_NO_INTEGER64_SUPPORT
+/* And the ia32 kernel doesn't include 64-bit divide support */
+#define ACPI_DIV64(dividend, divisor) do_div(dividend, divisor)
+#else
+#define ACPI_DIV64(dividend, divisor) ACPI_DIVIDE(dividend, divisor)
+#endif
+
+
+#endif /* __ACLINUX_H__ */
diff -urN linux-2.4.6-pre4/drivers/acpi/interpreter/Makefile linux/drivers/acpi/interpreter/Makefile
--- linux-2.4.6-pre4/drivers/acpi/interpreter/Makefile	Fri Dec 29 14:07:21 2000
+++ linux/drivers/acpi/interpreter/Makefile	Wed Dec 31 16:00:00 1969
@@ -1,16 +0,0 @@
-#
-# Makefile for all Linux ACPI interpreter subdirectories
-#
-
-O_TARGET := ../$(shell basename `pwd`).o
-
-obj-$(CONFIG_ACPI) := $(patsubst %.c,%.o,$(wildcard *.c))
-
-EXTRA_CFLAGS += -I../include
-
-EXTRA_CFLAGS += $(ACPI_CFLAGS)
-
-include $(TOPDIR)/Rules.make
-
-clean:
-	$(RM) *.o 
diff -urN linux-2.4.6-pre4/drivers/acpi/interpreter/amconfig.c linux/drivers/acpi/interpreter/amconfig.c
--- linux-2.4.6-pre4/drivers/acpi/interpreter/amconfig.c	Mon Jan 22 13:23:42 2001
+++ linux/drivers/acpi/interpreter/amconfig.c	Wed Dec 31 16:00:00 1969
@@ -1,306 +0,0 @@
-/******************************************************************************
- *
- * Module Name: amconfig - Namespace reconfiguration (Load/Unload opcodes)
- *              $Revision: 29 $
- *
- *****************************************************************************/
-
-/*
- *  Copyright (C) 2000, 2001 R. Byron Moore
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-
-#include "acpi.h"
-#include "acparser.h"
-#include "acinterp.h"
-#include "amlcode.h"
-#include "acnamesp.h"
-#include "acevents.h"
-#include "actables.h"
-#include "acdispat.h"
-
-
-#define _COMPONENT          INTERPRETER
-	 MODULE_NAME         ("amconfig")
-
-
-/*****************************************************************************
- *
- * FUNCTION:    Acpi_aml_exec_load_table
- *
- * PARAMETERS:  Rgn_desc        - Op region where the table will be obtained
- *              Ddb_handle      - Where a handle to the table will be returned
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Load an ACPI table
- *
- ****************************************************************************/
-
-static ACPI_STATUS
-acpi_aml_exec_load_table (
-	ACPI_OPERAND_OBJECT     *rgn_desc,
-	ACPI_HANDLE             *ddb_handle)
-{
-	ACPI_STATUS             status;
-	ACPI_OPERAND_OBJECT     *table_desc = NULL;
-	u8                      *table_ptr;
-	u8                      *table_data_ptr;
-	ACPI_TABLE_HEADER       table_header;
-	ACPI_TABLE_DESC         table_info;
-	u32                     i;
-
-
-	/* TBD: [Unhandled] Object can be either a field or an opregion */
-
-
-	/* Get the table header */
-
-	table_header.length = 0;
-	for (i = 0; i < sizeof (ACPI_TABLE_HEADER); i++) {
-		status = acpi_ev_address_space_dispatch (rgn_desc, ADDRESS_SPACE_READ,
-				   (ACPI_PHYSICAL_ADDRESS) i, 8,
-				   (u32 *) ((u8 *) &table_header + i));
-		if (ACPI_FAILURE (status)) {
-			return (status);
-		}
-	}
-
-	/* Allocate a buffer for the entire table */
-
-	table_ptr = acpi_cm_allocate (table_header.length);
-	if (!table_ptr) {
-		return (AE_NO_MEMORY);
-	}
-
-	/* Copy the header to the buffer */
-
-	MEMCPY (table_ptr, &table_header, sizeof (ACPI_TABLE_HEADER));
-	table_data_ptr = table_ptr + sizeof (ACPI_TABLE_HEADER);
-
-
-	/* Get the table from the op region */
-
-	for (i = 0; i < table_header.length; i++) {
-		status = acpi_ev_address_space_dispatch (rgn_desc, ADDRESS_SPACE_READ,
-				   (ACPI_PHYSICAL_ADDRESS)i, 8,
-				   (u32 *) (table_data_ptr + i));
-		if (ACPI_FAILURE (status)) {
-			goto cleanup;
-		}
-	}
-
-
-	/* Table must be either an SSDT or a PSDT */
-
-	if ((!STRNCMP (table_header.signature,
-			  acpi_gbl_acpi_table_data[ACPI_TABLE_PSDT].signature,
-			  acpi_gbl_acpi_table_data[ACPI_TABLE_PSDT].sig_length)) &&
-		(!STRNCMP (table_header.signature,
-				 acpi_gbl_acpi_table_data[ACPI_TABLE_SSDT].signature,
-				 acpi_gbl_acpi_table_data[ACPI_TABLE_SSDT].sig_length)))
-	{
-		status = AE_BAD_SIGNATURE;
-		goto cleanup;
-	}
-
-	/* Create an object to be the table handle */
-
-	table_desc = acpi_cm_create_internal_object (INTERNAL_TYPE_REFERENCE);
-	if (!table_desc) {
-		status = AE_NO_MEMORY;
-		goto cleanup;
-	}
-
-
-	/* Install the new table into the local data structures */
-
-	table_info.pointer     = (ACPI_TABLE_HEADER *) table_ptr;
-	table_info.length      = table_header.length;
-	table_info.allocation  = ACPI_MEM_ALLOCATED;
-	table_info.base_pointer = table_ptr;
-
-	status = acpi_tb_install_table (NULL, &table_info);
-	if (ACPI_FAILURE (status)) {
-		goto cleanup;
-	}
-
-	/* Add the table to the namespace */
-
-	/* TBD: [Restructure] - change to whatever new interface is appropriate */
-/*
-	Status = Acpi_load_namespace ();
-	if (ACPI_FAILURE (Status)) {
-*/
-		/* TBD: [Errors] Unload the table on failure ? */
-/*
-		goto Cleanup;
-	}
-*/
-
-
-	/* TBD: [Investigate] we need a pointer to the table desc */
-
-	/* Init the table handle */
-
-	table_desc->reference.op_code = AML_LOAD_OP;
-	table_desc->reference.object = table_info.installed_desc;
-
-	*ddb_handle = table_desc;
-
-	return (status);
-
-
-cleanup:
-
-	acpi_cm_free (table_desc);
-	acpi_cm_free (table_ptr);
-	return (status);
-
-}
-
-
-/*****************************************************************************
- *
- * FUNCTION:    Acpi_aml_exec_unload_table
- *
- * PARAMETERS:  Ddb_handle          - Handle to a previously loaded table
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Unload an ACPI table
- *
- ****************************************************************************/
-
-static ACPI_STATUS
-acpi_aml_exec_unload_table (
-	ACPI_HANDLE             ddb_handle)
-{
-	ACPI_STATUS             status = AE_NOT_IMPLEMENTED;
-	ACPI_OPERAND_OBJECT     *table_desc = (ACPI_OPERAND_OBJECT *) ddb_handle;
-	ACPI_TABLE_DESC         *table_info;
-
-
-	/* Validate the handle */
-	/* Although the handle is partially validated in Acpi_aml_exec_reconfiguration(),
-	 *  when it calls Acpi_aml_resolve_operands(), the handle is more completely
-	 *  validated here.
-	 */
-
-	if ((!ddb_handle) ||
-		(!VALID_DESCRIPTOR_TYPE (ddb_handle, ACPI_DESC_TYPE_INTERNAL)) ||
-		(((ACPI_OPERAND_OBJECT  *)ddb_handle)->common.type !=
-				INTERNAL_TYPE_REFERENCE))
-	{
-		return (AE_BAD_PARAMETER);
-	}
-
-
-	/* Get the actual table descriptor from the Ddb_handle */
-
-	table_info = (ACPI_TABLE_DESC *) table_desc->reference.object;
-
-	/*
-	 * Delete the entire namespace under this table Node
-	 * (Offset contains the Table_id)
-	 */
-
-	status = acpi_ns_delete_namespace_by_owner (table_info->table_id);
-	if (ACPI_FAILURE (status)) {
-		return (status);
-	}
-
-	/* Delete the table itself */
-
-	acpi_tb_uninstall_table (table_info->installed_desc);
-
-	/* Delete the table descriptor (Ddb_handle) */
-
-	acpi_cm_remove_reference (table_desc);
-
-	return (status);
-}
-
-
-/*****************************************************************************
- *
- * FUNCTION:    Acpi_aml_exec_reconfiguration
- *
- * PARAMETERS:  Opcode              - The opcode to be executed
- *              Walk_state          - Current state of the parse tree walk
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Reconfiguration opcodes such as LOAD and UNLOAD
- *
- ****************************************************************************/
-
-ACPI_STATUS
-acpi_aml_exec_reconfiguration (
-	u16                     opcode,
-	ACPI_WALK_STATE         *walk_state)
-{
-	ACPI_STATUS             status;
-	ACPI_OPERAND_OBJECT     *region_desc = NULL;
-	ACPI_HANDLE             *ddb_handle;
-
-
-	/* Resolve the operands */
-
-	status = acpi_aml_resolve_operands (opcode, WALK_OPERANDS, walk_state);
-	/* Get the table handle, common for both opcodes */
-
-	status |= acpi_ds_obj_stack_pop_object ((ACPI_OPERAND_OBJECT **) &ddb_handle,
-			 walk_state);
-
-	switch (opcode)
-	{
-
-	case AML_LOAD_OP:
-
-		/* Get the region or field descriptor */
-
-		status |= acpi_ds_obj_stack_pop_object (&region_desc, walk_state);
-		if (ACPI_FAILURE (status)) {
-			acpi_cm_remove_reference (region_desc);
-			return (status);
-		}
-
-		status = acpi_aml_exec_load_table (region_desc, ddb_handle);
-		break;
-
-
-	case AML_UNLOAD_OP:
-
-		if (ACPI_FAILURE (status)) {
-			return (status);
-		}
-
-		status = acpi_aml_exec_unload_table (ddb_handle);
-		break;
-
-
-	default:
-
-		status = AE_AML_BAD_OPCODE;
-		break;
-	}
-
-
-	return (status);
-}
-
diff -urN linux-2.4.6-pre4/drivers/acpi/interpreter/amconvrt.c linux/drivers/acpi/interpreter/amconvrt.c
--- linux-2.4.6-pre4/drivers/acpi/interpreter/amconvrt.c	Mon Jan 29 10:15:59 2001
+++ linux/drivers/acpi/interpreter/amconvrt.c	Wed Dec 31 16:00:00 1969
@@ -1,525 +0,0 @@
-/******************************************************************************
- *
- * Module Name: amconvrt - Object conversion routines
- *              $Revision: 3 $
- *
- *****************************************************************************/
-
-/*
- *  Copyright (C) 2000, 2001 R. Byron Moore
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-
-#include "acpi.h"
-#include "acparser.h"
-#include "acnamesp.h"
-#include "acinterp.h"
-#include "acevents.h"
-#include "amlcode.h"
-#include "acdispat.h"
-
-
-#define _COMPONENT          INTERPRETER
-	 MODULE_NAME         ("amconvrt")
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_aml_convert_to_target_type
- *
- * PARAMETERS:  *Obj_desc       - Object to be converted.
- *              Walk_state      - Current method state
- *
- * RETURN:      Status
- *
- * DESCRIPTION:
- *
- ******************************************************************************/
-
-ACPI_STATUS
-acpi_aml_convert_to_target_type (
-	OBJECT_TYPE_INTERNAL    destination_type,
-	ACPI_OPERAND_OBJECT     **obj_desc,
-	ACPI_WALK_STATE         *walk_state)
-{
-	ACPI_STATUS             status = AE_OK;
-
-
-	/*
-	 * If required by the target,
-	 * perform implicit conversion on the source before we store it.
-	 */
-
-	switch (GET_CURRENT_ARG_TYPE (walk_state->op_info->runtime_args))
-	{
-	case ARGI_SIMPLE_TARGET:
-	case ARGI_FIXED_TARGET:
-	case ARGI_INTEGER_REF:      /* Handles Increment, Decrement cases */
-
-		switch (destination_type)
-		{
-		case INTERNAL_TYPE_DEF_FIELD:
-			/*
-			 * Named field can always handle conversions
-			 */
-			break;
-
-		default:
-			/* No conversion allowed for these types */
-
-			if (destination_type != (*obj_desc)->common.type) {
-				status = AE_TYPE;
-			}
-		}
-		break;
-
-
-	case ARGI_TARGETREF:
-
-		switch (destination_type)
-		{
-		case ACPI_TYPE_INTEGER:
-		case ACPI_TYPE_FIELD_UNIT:
-		case INTERNAL_TYPE_BANK_FIELD:
-		case INTERNAL_TYPE_INDEX_FIELD:
-			/*
-			 * These types require an Integer operand.  We can convert
-			 * a Buffer or a String to an Integer if necessary.
-			 */
-			status = acpi_aml_convert_to_integer (obj_desc, walk_state);
-			break;
-
-
-		case ACPI_TYPE_STRING:
-
-			/*
-			 * The operand must be a String.  We can convert an
-			 * Integer or Buffer if necessary
-			 */
-			status = acpi_aml_convert_to_string (obj_desc, walk_state);
-			break;
-
-
-		case ACPI_TYPE_BUFFER:
-
-			/*
-			 * The operand must be a String.  We can convert an
-			 * Integer or Buffer if necessary
-			 */
-			status = acpi_aml_convert_to_buffer (obj_desc, walk_state);
-			break;
-		}
-		break;
-
-
-	case ARGI_REFERENCE:
-		/*
-		 * Create_xxxx_field cases - we are storing the field object into the name
-		 */
-		break;
-
-
-	default:
-		status = AE_AML_INTERNAL;
-	}
-
-
-	/*
-	 * Source-to-Target conversion semantics:
-	 *
-	 * If conversion to the target type cannot be performed, then simply
-	 * overwrite the target with the new object and type.
-	 */
-	if (status == AE_TYPE) {
-		status = AE_OK;
-	}
-
-	return (status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_aml_convert_to_integer
- *
- * PARAMETERS:  *Obj_desc       - Object to be converted.  Must be an
- *                                Integer, Buffer, or String
- *              Walk_state      - Current method state
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Convert an ACPI Object to an integer.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-acpi_aml_convert_to_integer (
-	ACPI_OPERAND_OBJECT     **obj_desc,
-	ACPI_WALK_STATE         *walk_state)
-{
-	u32                     i;
-	ACPI_OPERAND_OBJECT     *ret_desc;
-	u32                     count;
-	char                    *pointer;
-	ACPI_INTEGER            result;
-	u32                     integer_size = sizeof (ACPI_INTEGER);
-
-
-	switch ((*obj_desc)->common.type)
-	{
-	case ACPI_TYPE_INTEGER:
-		return (AE_OK);
-
-	case ACPI_TYPE_STRING:
-		pointer = (*obj_desc)->string.pointer;
-		count = (*obj_desc)->string.length;
-		break;
-
-	case ACPI_TYPE_BUFFER:
-		pointer = (char *) (*obj_desc)->buffer.pointer;
-		count = (*obj_desc)->buffer.length;
-		break;
-
-	default:
-		return (AE_TYPE);
-	}
-
-	/*
-	 * Create a new integer
-	 */
-	ret_desc = acpi_cm_create_internal_object (ACPI_TYPE_INTEGER);
-	if (!ret_desc) {
-		return (AE_NO_MEMORY);
-	}
-
-
-	/* Handle both ACPI 1.0 and ACPI 2.0 Integer widths */
-
-	if (walk_state->method_node->flags & ANOBJ_DATA_WIDTH_32) {
-		/*
-		 * We are running a method that exists in a 32-bit ACPI table.
-		 * Truncate the value to 32 bits by zeroing out the upper 32-bit field
-		 */
-		integer_size = sizeof (u32);
-	}
-
-
-	/*
-	 * Convert the buffer/string to an integer.  Note that both buffers and
-	 * strings are treated as raw data - we don't convert ascii to hex for
-	 * strings.
-	 *
-	 * There are two terminating conditions for the loop:
-	 * 1) The size of an integer has been reached, or
-	 * 2) The end of the buffer or string has been reached
-	 */
-	result = 0;
-
-	/* Transfer no more than an integer's worth of data */
-
-	if (count > integer_size) {
-		count = integer_size;
-	}
-
-	/*
-	 * String conversion is different than Buffer conversion
-	 */
-	switch ((*obj_desc)->common.type)
-	{
-	case ACPI_TYPE_STRING:
-
-		/* TBD: Need to use 64-bit STRTOUL */
-
-		/*
-		 * Convert string to an integer
-		 * String must be hexadecimal as per the ACPI specification
-		 */
-
-		result = STRTOUL (pointer, NULL, 16);
-		break;
-
-
-	case ACPI_TYPE_BUFFER:
-
-		/*
-		 * Buffer conversion - we simply grab enough raw data from the
-		 * buffer to fill an integer
-		 */
-		for (i = 0; i < count; i++) {
-			/*
-			 * Get next byte and shift it into the Result.
-			 * Little endian is used, meaning that the first byte of the buffer
-			 * is the LSB of the integer
-			 */
-			result |= (((ACPI_INTEGER) pointer[i]) << (i * 8));
-		}
-
-		break;
-	}
-
-	/* Save the Result, delete original descriptor, store new descriptor */
-
-	ret_desc->integer.value = result;
-
-	if (walk_state->opcode != AML_STORE_OP) {
-		acpi_cm_remove_reference (*obj_desc);
-	}
-
-	*obj_desc = ret_desc;
-
-	return (AE_OK);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_aml_convert_to_buffer
- *
- * PARAMETERS:  *Obj_desc       - Object to be converted.  Must be an
- *                                Integer, Buffer, or String
- *              Walk_state      - Current method state
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Convert an ACPI Object to an Buffer
- *
- ******************************************************************************/
-
-ACPI_STATUS
-acpi_aml_convert_to_buffer (
-	ACPI_OPERAND_OBJECT     **obj_desc,
-	ACPI_WALK_STATE         *walk_state)
-{
-	ACPI_OPERAND_OBJECT     *ret_desc;
-	u32                     i;
-	u32                     integer_size = sizeof (ACPI_INTEGER);
-	u8                      *new_buf;
-
-
-	switch ((*obj_desc)->common.type)
-	{
-	case ACPI_TYPE_INTEGER:
-
-		/*
-		 * Create a new Buffer
-		 */
-		ret_desc = acpi_cm_create_internal_object (ACPI_TYPE_BUFFER);
-		if (!ret_desc) {
-			return (AE_NO_MEMORY);
-		}
-
-		/* Handle both ACPI 1.0 and ACPI 2.0 Integer widths */
-
-		if (walk_state->method_node->flags & ANOBJ_DATA_WIDTH_32) {
-			/*
-			 * We are running a method that exists in a 32-bit ACPI table.
-			 * Truncate the value to 32 bits by zeroing out the upper
-			 * 32-bit field
-			 */
-			integer_size = sizeof (u32);
-		}
-
-		/* Need enough space for one integers */
-
-		ret_desc->buffer.length = integer_size;
-		new_buf = acpi_cm_callocate (integer_size);
-		if (!new_buf) {
-			REPORT_ERROR
-				(("Aml_exec_dyadic2_r/Concat_op: Buffer allocation failure\n"));
-			acpi_cm_remove_reference (ret_desc);
-			return (AE_NO_MEMORY);
-		}
-
-		/* Copy the integer to the buffer */
-
-		for (i = 0; i < integer_size; i++) {
-			new_buf[i] = (u8) ((*obj_desc)->integer.value >> (i * 8));
-		}
-		ret_desc->buffer.pointer = new_buf;
-
-		/* Return the new buffer descriptor */
-
-		if (walk_state->opcode != AML_STORE_OP) {
-			acpi_cm_remove_reference (*obj_desc);
-		}
-		*obj_desc = ret_desc;
-		break;
-
-
-	case ACPI_TYPE_STRING:
-		break;
-
-
-	case ACPI_TYPE_BUFFER:
-		break;
-
-
-	default:
-		return (AE_TYPE);
-		break;
-   }
-
-	return (AE_OK);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_aml_convert_to_string
- *
- * PARAMETERS:  *Obj_desc       - Object to be converted.  Must be an
- *                                Integer, Buffer, or String
- *              Walk_state      - Current method state
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Convert an ACPI Object to a string
- *
- ******************************************************************************/
-
-ACPI_STATUS
-acpi_aml_convert_to_string (
-	ACPI_OPERAND_OBJECT     **obj_desc,
-	ACPI_WALK_STATE         *walk_state)
-{
-	ACPI_OPERAND_OBJECT     *ret_desc;
-	u32                     i;
-	u32                     index;
-	u32                     integer_size = sizeof (ACPI_INTEGER);
-	u8                      *new_buf;
-	u8                      *pointer;
-
-
-	switch ((*obj_desc)->common.type)
-	{
-	case ACPI_TYPE_INTEGER:
-
-		/*
-		 * Create a new String
-		 */
-		ret_desc = acpi_cm_create_internal_object (ACPI_TYPE_STRING);
-		if (!ret_desc) {
-			return (AE_NO_MEMORY);
-		}
-
-		/* Handle both ACPI 1.0 and ACPI 2.0 Integer widths */
-
-		if (walk_state->method_node->flags & ANOBJ_DATA_WIDTH_32) {
-			/*
-			 * We are running a method that exists in a 32-bit ACPI table.
-			 * Truncate the value to 32 bits by zeroing out the upper
-			 * 32-bit field
-			 */
-			integer_size = sizeof (u32);
-		}
-
-		/* Need enough space for one ASCII integer plus null terminator */
-
-		ret_desc->string.length = (integer_size * 2) + 1;
-		new_buf = acpi_cm_callocate (ret_desc->string.length);
-		if (!new_buf) {
-			REPORT_ERROR
-				(("Aml_exec_dyadic2_r/Concat_op: Buffer allocation failure\n"));
-			acpi_cm_remove_reference (ret_desc);
-			return (AE_NO_MEMORY);
-		}
-
-		/* Copy the integer to the buffer */
-
-		for (i = 0; i < (integer_size * 2); i++) {
-			new_buf[i] = acpi_gbl_hex_to_ascii [((*obj_desc)->integer.value >> (i * 4)) & 0xF];
-		}
-
-		/* Null terminate */
-
-		new_buf [i] = 0;
-		ret_desc->buffer.pointer = new_buf;
-
-		/* Return the new buffer descriptor */
-
-		if (walk_state->opcode != AML_STORE_OP) {
-			acpi_cm_remove_reference (*obj_desc);
-		}
-		*obj_desc = ret_desc;
-
-		return (AE_OK);
-
-
-	case ACPI_TYPE_BUFFER:
-
-		if (((*obj_desc)->buffer.length * 3) > ACPI_MAX_STRING_CONVERSION) {
-			return (AE_AML_STRING_LIMIT);
-		}
-
-		/*
-		 * Create a new String
-		 */
-		ret_desc = acpi_cm_create_internal_object (ACPI_TYPE_STRING);
-		if (!ret_desc) {
-			return (AE_NO_MEMORY);
-		}
-
-		/* Need enough space for one ASCII integer plus null terminator */
-
-		ret_desc->string.length = (*obj_desc)->buffer.length * 3;
-		new_buf = acpi_cm_callocate (ret_desc->string.length + 1);
-		if (!new_buf) {
-			REPORT_ERROR
-				(("Aml_exec_dyadic2_r/Concat_op: Buffer allocation failure\n"));
-			acpi_cm_remove_reference (ret_desc);
-			return (AE_NO_MEMORY);
-		}
-
-		/*
-		 * Convert each byte of the buffer to two ASCII characters plus a space.
-		 */
-		pointer = (*obj_desc)->buffer.pointer;
-		index = 0;
-		for (i = 0; i < (*obj_desc)->buffer.length; i++) {
-			new_buf[index + 0] = acpi_gbl_hex_to_ascii [pointer[i] & 0x0F];
-			new_buf[index + 1] = acpi_gbl_hex_to_ascii [(pointer[i] >> 4) & 0x0F];
-			new_buf[index + 2] = ' ';
-			index += 3;
-		}
-
-		/* Null terminate */
-
-		new_buf [index] = 0;
-		ret_desc->buffer.pointer = new_buf;
-
-		/* Return the new buffer descriptor */
-
-		if (walk_state->opcode != AML_STORE_OP) {
-			acpi_cm_remove_reference (*obj_desc);
-		}
-		*obj_desc = ret_desc;
-		break;
-
-
-	case ACPI_TYPE_STRING:
-		break;
-
-
-	default:
-		return (AE_TYPE);
-		break;
-   }
-
-	return (AE_OK);
-}
-
-
diff -urN linux-2.4.6-pre4/drivers/acpi/interpreter/amcreate.c linux/drivers/acpi/interpreter/amcreate.c
--- linux-2.4.6-pre4/drivers/acpi/interpreter/amcreate.c	Mon Jan 22 13:23:42 2001
+++ linux/drivers/acpi/interpreter/amcreate.c	Wed Dec 31 16:00:00 1969
@@ -1,722 +0,0 @@
-/******************************************************************************
- *
- * Module Name: amcreate - Named object creation
- *              $Revision: 53 $
- *
- *****************************************************************************/
-
-/*
- *  Copyright (C) 2000, 2001 R. Byron Moore
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-
-#include "acpi.h"
-#include "acparser.h"
-#include "acinterp.h"
-#include "amlcode.h"
-#include "acnamesp.h"
-#include "acevents.h"
-#include "acdispat.h"
-
-
-#define _COMPONENT          INTERPRETER
-	 MODULE_NAME         ("amcreate")
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_aml_exec_create_field
- *
- * PARAMETERS:  Opcode              - The opcode to be executed
- *              Operands            - List of operands for the opcode
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Execute Create_field operators: Create_bit_field_op,
- *              Create_byte_field_op, Create_word_field_op, Create_dWord_field_op,
- *              Create_field_op (which define fields in buffers)
- *
- * ALLOCATION:  Deletes Create_field_op's count operand descriptor
- *
- *
- *  ACPI SPECIFICATION REFERENCES:
- *  Def_create_bit_field := Create_bit_field_op Src_buf Bit_idx   Name_string
- *  Def_create_byte_field := Create_byte_field_op Src_buf Byte_idx Name_string
- *  Def_create_dWord_field := Create_dWord_field_op Src_buf Byte_idx Name_string
- *  Def_create_field    :=  Create_field_op     Src_buf Bit_idx   Num_bits    Name_string
- *  Def_create_word_field := Create_word_field_op Src_buf Byte_idx Name_string
- *  Bit_index           :=  Term_arg=>Integer
- *  Byte_index          :=  Term_arg=>Integer
- *  Num_bits            :=  Term_arg=>Integer
- *  Source_buff         :=  Term_arg=>Buffer
- *
- ******************************************************************************/
-
-
-ACPI_STATUS
-acpi_aml_exec_create_field (
-	u8                      *aml_ptr,
-	u32                     aml_length,
-	ACPI_NAMESPACE_NODE     *node,
-	ACPI_WALK_STATE         *walk_state)
-{
-	ACPI_STATUS             status;
-	ACPI_OPERAND_OBJECT     *obj_desc;
-	ACPI_OPERAND_OBJECT     *tmp_desc;
-
-
-	/* Create the region descriptor */
-
-	obj_desc = acpi_cm_create_internal_object (ACPI_TYPE_FIELD_UNIT);
-	if (!obj_desc) {
-		status = AE_NO_MEMORY;
-		goto cleanup;
-	}
-
-	/* Construct the field object */
-
-	obj_desc->field_unit.access     = (u8) ACCESS_ANY_ACC;
-	obj_desc->field_unit.lock_rule  = (u8) GLOCK_NEVER_LOCK;
-	obj_desc->field_unit.update_rule = (u8) UPDATE_PRESERVE;
-
-	/*
-	 * Allocate a method object for this field unit
-	 */
-
-	obj_desc->field_unit.extra = acpi_cm_create_internal_object (
-			 INTERNAL_TYPE_EXTRA);
-	if (!obj_desc->field_unit.extra) {
-		status = AE_NO_MEMORY;
-		goto cleanup;
-	}
-
-	/*
-	 * Remember location in AML stream of the field unit
-	 * opcode and operands -- since the buffer and index
-	 * operands must be evaluated.
-	 */
-
-	obj_desc->field_unit.extra->extra.pcode     = aml_ptr;
-	obj_desc->field_unit.extra->extra.pcode_length = aml_length;
-	obj_desc->field_unit.node = node;
-
-
-	/*
-	 * This operation is supposed to cause the destination Name to refer
-	 * to the defined Field_unit -- it must not store the constructed
-	 * Field_unit object (or its current value) in some location that the
-	 * Name may already be pointing to.  So, if the Name currently contains
-	 * a reference which would cause Acpi_aml_exec_store() to perform an indirect
-	 * store rather than setting the value of the Name itself, clobber that
-	 * reference before calling Acpi_aml_exec_store().
-	 */
-
-	/* Type of Name's existing value */
-
-	switch (acpi_ns_get_type (node))
-	{
-
-	case ACPI_TYPE_FIELD_UNIT:
-
-	case INTERNAL_TYPE_ALIAS:
-	case INTERNAL_TYPE_BANK_FIELD:
-	case INTERNAL_TYPE_DEF_FIELD:
-	case INTERNAL_TYPE_INDEX_FIELD:
-
-		tmp_desc = acpi_ns_get_attached_object (node);
-		if (tmp_desc) {
-			/*
-			 * There is an existing object here;  delete it and zero out the
-			 * object field within the Node
-			 */
-
-			acpi_cm_remove_reference (tmp_desc);
-			acpi_ns_attach_object ((ACPI_NAMESPACE_NODE *) node, NULL,
-					 ACPI_TYPE_ANY);
-		}
-
-		/* Set the type to ANY (or the store below will fail) */
-
-		((ACPI_NAMESPACE_NODE *) node)->type = ACPI_TYPE_ANY;
-
-		break;
-
-
-	default:
-
-		break;
-	}
-
-
-	/* Store constructed field descriptor in result location */
-
-	status = acpi_aml_exec_store (obj_desc, (ACPI_OPERAND_OBJECT *) node, walk_state);
-
-	/*
-	 * If the field descriptor was not physically stored (or if a failure
-	 * above), we must delete it
-	 */
-	if (obj_desc->common.reference_count <= 1) {
-		acpi_cm_remove_reference (obj_desc);
-	}
-
-
-	return (AE_OK);
-
-
-cleanup:
-
-	/* Delete region object and method subobject */
-
-	if (obj_desc) {
-		/* Remove deletes both objects! */
-
-		acpi_cm_remove_reference (obj_desc);
-		obj_desc = NULL;
-	}
-
-	return (status);
-}
-
-
-/*****************************************************************************
- *
- * FUNCTION:    Acpi_aml_exec_create_alias
- *
- * PARAMETERS:  Operands            - List of operands for the opcode
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Create a new named alias
- *
- ****************************************************************************/
-
-ACPI_STATUS
-acpi_aml_exec_create_alias (
-	ACPI_WALK_STATE         *walk_state)
-{
-	ACPI_NAMESPACE_NODE     *source_node;
-	ACPI_NAMESPACE_NODE     *alias_node;
-	ACPI_STATUS             status;
-
-
-	/* Get the source/alias operands (both NTEs) */
-
-	status = acpi_ds_obj_stack_pop_object ((ACPI_OPERAND_OBJECT **) &source_node,
-			 walk_state);
-	if (ACPI_FAILURE (status)) {
-		return (status);
-	}
-
-	/*
-	 * Don't pop it, it gets removed in the calling routine
-	 */
-
-	alias_node = acpi_ds_obj_stack_get_value (0, walk_state);
-
-	/* Add an additional reference to the object */
-
-	acpi_cm_add_reference (source_node->object);
-
-	/*
-	 * Attach the original source Node to the new Alias Node.
-	 */
-	status = acpi_ns_attach_object (alias_node, source_node->object,
-			   source_node->type);
-
-
-	/*
-	 * The new alias assumes the type of the source, but it points
-	 * to the same object.  The reference count of the object has two
-	 * additional references to prevent deletion out from under either the
-	 * source or the alias Node
-	 */
-
-	/* Since both operands are NTEs, we don't need to delete them */
-
-	return (status);
-}
-
-
-/*****************************************************************************
- *
- * FUNCTION:    Acpi_aml_exec_create_event
- *
- * PARAMETERS:  None
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Create a new event object
- *
- ****************************************************************************/
-
-ACPI_STATUS
-acpi_aml_exec_create_event (
-	ACPI_WALK_STATE         *walk_state)
-{
-	ACPI_STATUS             status;
-	ACPI_OPERAND_OBJECT     *obj_desc;
-
-
- BREAKPOINT3;
-
-	obj_desc = acpi_cm_create_internal_object (ACPI_TYPE_EVENT);
-	if (!obj_desc) {
-		status = AE_NO_MEMORY;
-		goto cleanup;
-	}
-
-	/* Create the actual OS semaphore */
-
-	/* TBD: [Investigate] should be created with 0 or 1 units? */
-
-	status = acpi_os_create_semaphore (ACPI_NO_UNIT_LIMIT, 1,
-			   &obj_desc->event.semaphore);
-	if (ACPI_FAILURE (status)) {
-		acpi_cm_remove_reference (obj_desc);
-		goto cleanup;
-	}
-
-	/* Attach object to the Node */
-
-	status = acpi_ns_attach_object (acpi_ds_obj_stack_get_value (0, walk_state),
-			   obj_desc, (u8) ACPI_TYPE_EVENT);
-	if (ACPI_FAILURE (status)) {
-		acpi_os_delete_semaphore (obj_desc->event.semaphore);
-		acpi_cm_remove_reference (obj_desc);
-		goto cleanup;
-	}
-
-
-cleanup:
-
-	return (status);
-}
-
-
-/*****************************************************************************
- *
- * FUNCTION:    Acpi_aml_exec_create_mutex
- *
- * PARAMETERS:  Interpreter_mode    - Current running mode (load1/Load2/Exec)
- *              Operands            - List of operands for the opcode
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Create a new mutex object
- *
- ****************************************************************************/
-
-ACPI_STATUS
-acpi_aml_exec_create_mutex (
-	ACPI_WALK_STATE         *walk_state)
-{
-	ACPI_STATUS             status = AE_OK;
-	ACPI_OPERAND_OBJECT     *sync_desc;
-	ACPI_OPERAND_OBJECT     *obj_desc;
-
-
-	/* Get the operand */
-
-	status = acpi_ds_obj_stack_pop_object (&sync_desc, walk_state);
-	if (ACPI_FAILURE (status)) {
-		return (status);
-	}
-
-	/* Attempt to allocate a new object */
-
-	obj_desc = acpi_cm_create_internal_object (ACPI_TYPE_MUTEX);
-	if (!obj_desc) {
-		status = AE_NO_MEMORY;
-		goto cleanup;
-	}
-
-	/* Create the actual OS semaphore */
-
-	status = acpi_os_create_semaphore (1, 1, &obj_desc->mutex.semaphore);
-	if (ACPI_FAILURE (status)) {
-		acpi_cm_remove_reference (obj_desc);
-		goto cleanup;
-	}
-
-	obj_desc->mutex.sync_level = (u8) sync_desc->integer.value;
-
-	/* Obj_desc was on the stack top, and the name is below it */
-
-	status = acpi_ns_attach_object (acpi_ds_obj_stack_get_value (0, walk_state),
-			  obj_desc, (u8) ACPI_TYPE_MUTEX);
-	if (ACPI_FAILURE (status)) {
-		acpi_os_delete_semaphore (obj_desc->mutex.semaphore);
-		acpi_cm_remove_reference (obj_desc);
-		goto cleanup;
-	}
-
-
-cleanup:
-
-	/* Always delete the operand */
-
-	acpi_cm_remove_reference (sync_desc);
-
-	return (status);
-}
-
-
-/*****************************************************************************
- *
- * FUNCTION:    Acpi_aml_exec_create_region
- *
- * PARAMETERS:  Aml_ptr             - Pointer to the region declaration AML
- *              Aml_length          - Max length of the declaration AML
- *              Operands            - List of operands for the opcode
- *              Interpreter_mode    - Load1/Load2/Execute
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Create a new operation region object
- *
- ****************************************************************************/
-
-ACPI_STATUS
-acpi_aml_exec_create_region (
-	u8                      *aml_ptr,
-	u32                     aml_length,
-	u8                      region_space,
-	ACPI_WALK_STATE         *walk_state)
-{
-	ACPI_STATUS             status;
-	ACPI_OPERAND_OBJECT     *obj_desc;
-	ACPI_NAMESPACE_NODE     *node;
-
-
-	/*
-	 * Space ID must be one of the predefined IDs, or in the user-defined
-	 * range
-	 */
-	if ((region_space >= NUM_REGION_TYPES) &&
-		(region_space < USER_REGION_BEGIN))
-	{
-		REPORT_ERROR (("Invalid Address_space type %X\n", region_space));
-		return (AE_AML_INVALID_SPACE_ID);
-	}
-
-
-	/* Get the Node from the object stack  */
-
-	node = (ACPI_NAMESPACE_NODE *) acpi_ds_obj_stack_get_value (0, walk_state);
-
-	/* Create the region descriptor */
-
-	obj_desc = acpi_cm_create_internal_object (ACPI_TYPE_REGION);
-	if (!obj_desc) {
-		status = AE_NO_MEMORY;
-		goto cleanup;
-	}
-
-	/*
-	 * Allocate a method object for this region.
-	 */
-
-	obj_desc->region.extra = acpi_cm_create_internal_object (
-			 INTERNAL_TYPE_EXTRA);
-	if (!obj_desc->region.extra) {
-		status = AE_NO_MEMORY;
-		goto cleanup;
-	}
-
-	/*
-	 * Remember location in AML stream of address & length
-	 * operands since they need to be evaluated at run time.
-	 */
-
-	obj_desc->region.extra->extra.pcode      = aml_ptr;
-	obj_desc->region.extra->extra.pcode_length = aml_length;
-
-	/* Init the region from the operands */
-
-	obj_desc->region.space_id     = region_space;
-	obj_desc->region.address      = 0;
-	obj_desc->region.length       = 0;
-
-
-	/* Install the new region object in the parent Node */
-
-	obj_desc->region.node = node;
-
-	status = acpi_ns_attach_object (node, obj_desc,
-			  (u8) ACPI_TYPE_REGION);
-
-	if (ACPI_FAILURE (status)) {
-		goto cleanup;
-	}
-
-	/*
-	 * If we have a valid region, initialize it
-	 * Namespace is NOT locked at this point.
-	 */
-
-	status = acpi_ev_initialize_region (obj_desc, FALSE);
-
-	if (ACPI_FAILURE (status)) {
-		/*
-		 *  If AE_NOT_EXIST is returned, it is not fatal
-		 *  because many regions get created before a handler
-		 *  is installed for said region.
-		 */
-		if (AE_NOT_EXIST == status) {
-			status = AE_OK;
-		}
-	}
-
-cleanup:
-
-	if (ACPI_FAILURE (status)) {
-		/* Delete region object and method subobject */
-
-		if (obj_desc) {
-			/* Remove deletes both objects! */
-
-			acpi_cm_remove_reference (obj_desc);
-			obj_desc = NULL;
-		}
-	}
-
-	return (status);
-}
-
-
-/*****************************************************************************
- *
- * FUNCTION:    Acpi_aml_exec_create_processor
- *
- * PARAMETERS:  Op              - Op containing the Processor definition and
- *                                args
- *              Processor_nTE   - Node for the containing Node
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Create a new processor object and populate the fields
- *
- ****************************************************************************/
-
-ACPI_STATUS
-acpi_aml_exec_create_processor (
-	ACPI_PARSE_OBJECT       *op,
-	ACPI_HANDLE             processor_nTE)
-{
-	ACPI_STATUS             status;
-	ACPI_PARSE_OBJECT       *arg;
-	ACPI_OPERAND_OBJECT     *obj_desc;
-
-
-	obj_desc = acpi_cm_create_internal_object (ACPI_TYPE_PROCESSOR);
-	if (!obj_desc) {
-		status = AE_NO_MEMORY;
-		return (status);
-	}
-
-	/* Install the new processor object in the parent Node */
-
-	status = acpi_ns_attach_object (processor_nTE, obj_desc,
-			   (u8) ACPI_TYPE_PROCESSOR);
-	if (ACPI_FAILURE (status)) {
-		return(status);
-	}
-
-	arg = op->value.arg;
-
-	/* check existence */
-
-	if (!arg) {
-		status = AE_AML_NO_OPERAND;
-		return (status);
-	}
-
-	/* First arg is the Processor ID */
-
-	obj_desc->processor.proc_id = (u8) arg->value.integer;
-
-	/* Move to next arg and check existence */
-
-	arg = arg->next;
-	if (!arg) {
-		status = AE_AML_NO_OPERAND;
-		return (status);
-	}
-
-	/* Second arg is the PBlock Address */
-
-	obj_desc->processor.address = (ACPI_IO_ADDRESS) arg->value.integer;
-
-	/* Move to next arg and check existence */
-
-	arg = arg->next;
-	if (!arg) {
-		status = AE_AML_NO_OPERAND;
-		return (status);
-	}
-
-	/* Third arg is the PBlock Length */
-
-	obj_desc->processor.length = (u8) arg->value.integer;
-
-	return (AE_OK);
-}
-
-
-/*****************************************************************************
- *
- * FUNCTION:    Acpi_aml_exec_create_power_resource
- *
- * PARAMETERS:  Op              - Op containing the Power_resource definition
- *                                and args
- *              Power_res_nTE   - Node for the containing Node
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Create a new Power_resource object and populate the fields
- *
- ****************************************************************************/
-
-ACPI_STATUS
-acpi_aml_exec_create_power_resource (
-	ACPI_PARSE_OBJECT       *op,
-	ACPI_HANDLE             power_res_nTE)
-{
-	ACPI_STATUS             status;
-	ACPI_PARSE_OBJECT       *arg;
-	ACPI_OPERAND_OBJECT     *obj_desc;
-
-
-	obj_desc = acpi_cm_create_internal_object (ACPI_TYPE_POWER);
-	if (!obj_desc) {
-		status = AE_NO_MEMORY;
-		return (status);
-	}
-
-	/* Install the new power resource object in the parent Node */
-
-	status = acpi_ns_attach_object (power_res_nTE, obj_desc,
-			  (u8) ACPI_TYPE_POWER);
-	if (ACPI_FAILURE (status)) {
-		return(status);
-	}
-
-	arg = op->value.arg;
-
-	/* check existence */
-
-	if (!arg) {
-		status = AE_AML_NO_OPERAND;
-		return (status);
-	}
-
-	/* First arg is the System_level */
-
-	obj_desc->power_resource.system_level = (u8) arg->value.integer;
-
-	/* Move to next arg and check existence */
-
-	arg = arg->next;
-	if (!arg) {
-		status = AE_AML_NO_OPERAND;
-		return (status);
-	}
-
-	/* Second arg is the PBlock Address */
-
-	obj_desc->power_resource.resource_order = (u16) arg->value.integer;
-
-	return (AE_OK);
-}
-
-
-/*****************************************************************************
- *
- * FUNCTION:    Acpi_aml_exec_create_method
- *
- * PARAMETERS:  Aml_ptr         - First byte of the method's AML
- *              Aml_length      - AML byte count for this method
- *              Method_flags    - AML method flag byte
- *              Method          - Method Node
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Create a new method object
- *
- ****************************************************************************/
-
-ACPI_STATUS
-acpi_aml_exec_create_method (
-	u8                      *aml_ptr,
-	u32                     aml_length,
-	u32                     method_flags,
-	ACPI_HANDLE             method)
-{
-	ACPI_OPERAND_OBJECT     *obj_desc;
-	ACPI_STATUS             status;
-
-
-	/* Create a new method object */
-
-	obj_desc = acpi_cm_create_internal_object (ACPI_TYPE_METHOD);
-	if (!obj_desc) {
-	   return (AE_NO_MEMORY);
-	}
-
-	/* Get the method's AML pointer/length from the Op */
-
-	obj_desc->method.pcode      = aml_ptr;
-	obj_desc->method.pcode_length = aml_length;
-
-	/*
-	 * First argument is the Method Flags (contains parameter count for the
-	 * method)
-	 */
-
-	obj_desc->method.method_flags = (u8) method_flags;
-	obj_desc->method.param_count = (u8) (method_flags &
-			  METHOD_FLAGS_ARG_COUNT);
-
-	/*
-	 * Get the concurrency count.  If required, a semaphore will be
-	 * created for this method when it is parsed.
-	 *
-	 * TBD: [Future]  for APCI 2.0, there will be a Sync_level value, not
-	 * just a flag
-	 * Concurrency = Sync_level + 1;.
-	 */
-
-	if (method_flags & METHOD_FLAGS_SERIALIZED) {
-		obj_desc->method.concurrency = 1;
-	}
-
-	else {
-		obj_desc->method.concurrency = INFINITE_CONCURRENCY;
-	}
-
-	/* Attach the new object to the method Node */
-
-	status = acpi_ns_attach_object (method, obj_desc, (u8) ACPI_TYPE_METHOD);
-	if (ACPI_FAILURE (status)) {
-		acpi_cm_delete_object_desc (obj_desc);
-	}
-
-	return (status);
-}
-
-
diff -urN linux-2.4.6-pre4/drivers/acpi/interpreter/amdyadic.c linux/drivers/acpi/interpreter/amdyadic.c
--- linux-2.4.6-pre4/drivers/acpi/interpreter/amdyadic.c	Mon Jan 22 13:23:42 2001
+++ linux/drivers/acpi/interpreter/amdyadic.c	Wed Dec 31 16:00:00 1969
@@ -1,882 +0,0 @@
-/******************************************************************************
- *
- * Module Name: amdyadic - ACPI AML (p-code) execution for dyadic operators
- *              $Revision: 71 $
- *
- *****************************************************************************/
-
-/*
- *  Copyright (C) 2000, 2001 R. Byron Moore
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-
-#include "acpi.h"
-#include "acparser.h"
-#include "acnamesp.h"
-#include "acinterp.h"
-#include "acevents.h"
-#include "amlcode.h"
-#include "acdispat.h"
-
-
-#define _COMPONENT          INTERPRETER
-	 MODULE_NAME         ("amdyadic")
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_aml_do_concatenate
- *
- * PARAMETERS:  *Obj_desc       - Object to be converted.  Must be an
- *                                Integer, Buffer, or String
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Concatenate two objects OF THE SAME TYPE.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-acpi_aml_do_concatenate (
-	ACPI_OPERAND_OBJECT     *obj_desc,
-	ACPI_OPERAND_OBJECT     *obj_desc2,
-	ACPI_OPERAND_OBJECT     **actual_ret_desc,
-	ACPI_WALK_STATE         *walk_state)
-{
-	ACPI_STATUS             status;
-	u32                     i;
-	ACPI_INTEGER            this_integer;
-	ACPI_OPERAND_OBJECT     *ret_desc;
-	NATIVE_CHAR             *new_buf;
-	u32                     integer_size = sizeof (ACPI_INTEGER);
-
-
-	/*
-	 * There are three cases to handle:
-	 * 1) Two Integers concatenated to produce a buffer
-	 * 2) Two Strings concatenated to produce a string
-	 * 3) Two Buffers concatenated to produce a buffer
-	 */
-	switch (obj_desc->common.type)
-	{
-	case ACPI_TYPE_INTEGER:
-
-		/* Handle both ACPI 1.0 and ACPI 2.0 Integer widths */
-
-		if (walk_state->method_node->flags & ANOBJ_DATA_WIDTH_32) {
-			/*
-			 * We are running a method that exists in a 32-bit ACPI table.
-			 * Truncate the value to 32 bits by zeroing out the upper
-			 * 32-bit field
-			 */
-			integer_size = sizeof (u32);
-		}
-
-		/* Result of two integers is a buffer */
-
-		ret_desc = acpi_cm_create_internal_object (ACPI_TYPE_BUFFER);
-		if (!ret_desc) {
-			return (AE_NO_MEMORY);
-		}
-
-		/* Need enough space for two integers */
-
-		ret_desc->buffer.length = integer_size * 2;
-		new_buf = acpi_cm_callocate (ret_desc->buffer.length);
-		if (!new_buf) {
-			REPORT_ERROR
-				(("Aml_exec_dyadic2_r/Concat_op: Buffer allocation failure\n"));
-			status = AE_NO_MEMORY;
-			goto cleanup;
-		}
-
-		ret_desc->buffer.pointer = (u8 *) new_buf;
-
-		/* Convert the first integer */
-
-		this_integer = obj_desc->integer.value;
-		for (i = 0; i < integer_size; i++) {
-			new_buf[i] = (u8) this_integer;
-			this_integer >>= 8;
-		}
-
-		/* Convert the second integer */
-
-		this_integer = obj_desc2->integer.value;
-		for (; i < (integer_size * 2); i++) {
-			new_buf[i] = (u8) this_integer;
-			this_integer >>= 8;
-		}
-
-		break;
-
-
-	case ACPI_TYPE_STRING:
-
-		ret_desc = acpi_cm_create_internal_object (ACPI_TYPE_STRING);
-		if (!ret_desc) {
-			return (AE_NO_MEMORY);
-		}
-
-		/* Operand1 is string  */
-
-		new_buf = acpi_cm_allocate (obj_desc->string.length +
-				  obj_desc2->string.length + 1);
-		if (!new_buf) {
-			REPORT_ERROR
-				(("Aml_exec_dyadic2_r/Concat_op: String allocation failure\n"));
-			status = AE_NO_MEMORY;
-			goto cleanup;
-		}
-
-		STRCPY (new_buf, obj_desc->string.pointer);
-		STRCPY (new_buf + obj_desc->string.length,
-				  obj_desc2->string.pointer);
-
-		/* Point the return object to the new string */
-
-		ret_desc->string.pointer = new_buf;
-		ret_desc->string.length = obj_desc->string.length +=
-				  obj_desc2->string.length;
-		break;
-
-
-	case ACPI_TYPE_BUFFER:
-
-		/* Operand1 is a buffer */
-
-		ret_desc = acpi_cm_create_internal_object (ACPI_TYPE_BUFFER);
-		if (!ret_desc) {
-			return (AE_NO_MEMORY);
-		}
-
-		new_buf = acpi_cm_allocate (obj_desc->buffer.length +
-				  obj_desc2->buffer.length);
-		if (!new_buf) {
-			REPORT_ERROR
-				(("Aml_exec_dyadic2_r/Concat_op: Buffer allocation failure\n"));
-			status = AE_NO_MEMORY;
-			goto cleanup;
-		}
-
-		MEMCPY (new_buf, obj_desc->buffer.pointer,
-				  obj_desc->buffer.length);
-		MEMCPY (new_buf + obj_desc->buffer.length, obj_desc2->buffer.pointer,
-				  obj_desc2->buffer.length);
-
-		/*
-		 * Point the return object to the new buffer
-		 */
-
-		ret_desc->buffer.pointer    = (u8 *) new_buf;
-		ret_desc->buffer.length     = obj_desc->buffer.length +
-				 obj_desc2->buffer.length;
-		break;
-
-	default:
-		status = AE_AML_INTERNAL;
-		ret_desc = NULL;
-	}
-
-
-	*actual_ret_desc = ret_desc;
-	return (AE_OK);
-
-
-cleanup:
-
-	acpi_cm_remove_reference (ret_desc);
-	return (status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_aml_exec_dyadic1
- *
- * PARAMETERS:  Opcode              - The opcode to be executed
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Execute Type 1 dyadic operator with numeric operands:
- *              Notify_op
- *
- * ALLOCATION:  Deletes both operands
- *
- ******************************************************************************/
-
-ACPI_STATUS
-acpi_aml_exec_dyadic1 (
-	u16                     opcode,
-	ACPI_WALK_STATE         *walk_state)
-{
-	ACPI_OPERAND_OBJECT     *obj_desc = NULL;
-	ACPI_OPERAND_OBJECT     *val_desc = NULL;
-	ACPI_NAMESPACE_NODE     *node;
-	ACPI_STATUS             status = AE_OK;
-
-
-	/* Resolve all operands */
-
-	status = acpi_aml_resolve_operands (opcode, WALK_OPERANDS, walk_state);
-	/* Get the operands */
-
-	status |= acpi_ds_obj_stack_pop_object (&val_desc, walk_state);
-	status |= acpi_ds_obj_stack_pop_object (&obj_desc, walk_state);
-	if (ACPI_FAILURE (status)) {
-		/* Invalid parameters on object stack  */
-
-		goto cleanup;
-	}
-
-
-	/* Examine the opcode */
-
-	switch (opcode)
-	{
-
-	/* Def_notify  :=  Notify_op   Notify_object   Notify_value */
-
-	case AML_NOTIFY_OP:
-
-		/* The Obj_desc is actually an Node */
-
-		node = (ACPI_NAMESPACE_NODE *) obj_desc;
-		obj_desc = NULL;
-
-		/* Object must be a device or thermal zone */
-
-		if (node && val_desc) {
-			switch (node->type)
-			{
-			case ACPI_TYPE_DEVICE:
-			case ACPI_TYPE_THERMAL:
-
-				/*
-				 * Requires that Device and Thermal_zone be compatible
-				 * mappings
-				 */
-
-				/* Dispatch the notify to the appropriate handler */
-
-				acpi_ev_notify_dispatch (node, (u32) val_desc->integer.value);
-				break;
-
-			default:
-				status = AE_AML_OPERAND_TYPE;
-			}
-		}
-		break;
-
-	default:
-
-		REPORT_ERROR (("Acpi_aml_exec_dyadic1: Unknown dyadic opcode %X\n",
-			opcode));
-		status = AE_AML_BAD_OPCODE;
-	}
-
-
-cleanup:
-
-	/* Always delete both operands */
-
-	acpi_cm_remove_reference (val_desc);
-	acpi_cm_remove_reference (obj_desc);
-
-
-	return (status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_aml_exec_dyadic2_r
- *
- * PARAMETERS:  Opcode              - The opcode to be executed
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Execute Type 2 dyadic operator with numeric operands and
- *              one or two result operands.
- *
- * ALLOCATION:  Deletes one operand descriptor -- other remains on stack
- *
- ******************************************************************************/
-
-ACPI_STATUS
-acpi_aml_exec_dyadic2_r (
-	u16                     opcode,
-	ACPI_WALK_STATE         *walk_state,
-	ACPI_OPERAND_OBJECT     **return_desc)
-{
-	ACPI_OPERAND_OBJECT     *obj_desc   = NULL;
-	ACPI_OPERAND_OBJECT     *obj_desc2  = NULL;
-	ACPI_OPERAND_OBJECT     *res_desc   = NULL;
-	ACPI_OPERAND_OBJECT     *res_desc2  = NULL;
-	ACPI_OPERAND_OBJECT     *ret_desc   = NULL;
-	ACPI_OPERAND_OBJECT     *ret_desc2  = NULL;
-	ACPI_STATUS             status      = AE_OK;
-	u32                     num_operands = 3;
-
-
-	/* Resolve all operands */
-
-	status = acpi_aml_resolve_operands (opcode, WALK_OPERANDS, walk_state);
-	/* Get all operands */
-
-	if (AML_DIVIDE_OP == opcode) {
-		num_operands = 4;
-		status |= acpi_ds_obj_stack_pop_object (&res_desc2, walk_state);
-	}
-
-	status |= acpi_ds_obj_stack_pop_object (&res_desc, walk_state);
-	status |= acpi_ds_obj_stack_pop_object (&obj_desc2, walk_state);
-	status |= acpi_ds_obj_stack_pop_object (&obj_desc, walk_state);
-	if (ACPI_FAILURE (status)) {
-		goto cleanup;
-	}
-
-
-	/* Create an internal return object if necessary */
-
-	switch (opcode)
-	{
-	case AML_ADD_OP:
-	case AML_BIT_AND_OP:
-	case AML_BIT_NAND_OP:
-	case AML_BIT_OR_OP:
-	case AML_BIT_NOR_OP:
-	case AML_BIT_XOR_OP:
-	case AML_DIVIDE_OP:
-	case AML_MULTIPLY_OP:
-	case AML_SHIFT_LEFT_OP:
-	case AML_SHIFT_RIGHT_OP:
-	case AML_SUBTRACT_OP:
-
-		ret_desc = acpi_cm_create_internal_object (ACPI_TYPE_INTEGER);
-		if (!ret_desc) {
-			status = AE_NO_MEMORY;
-			goto cleanup;
-		}
-
-		break;
-	}
-
-
-	/*
-	 * Execute the opcode
-	 */
-
-	switch (opcode)
-	{
-
-	/* Def_add :=  Add_op  Operand1    Operand2    Result  */
-
-	case AML_ADD_OP:
-
-		ret_desc->integer.value = obj_desc->integer.value +
-				 obj_desc2->integer.value;
-		break;
-
-
-	/* Def_and :=  And_op  Operand1    Operand2    Result  */
-
-	case AML_BIT_AND_OP:
-
-		ret_desc->integer.value = obj_desc->integer.value &
-				 obj_desc2->integer.value;
-		break;
-
-
-	/* Def_nAnd := NAnd_op Operand1    Operand2    Result  */
-
-	case AML_BIT_NAND_OP:
-
-		ret_desc->integer.value = ~(obj_desc->integer.value &
-				   obj_desc2->integer.value);
-		break;
-
-
-	/* Def_or  :=  Or_op   Operand1    Operand2    Result  */
-
-	case AML_BIT_OR_OP:
-
-		ret_desc->integer.value = obj_desc->integer.value |
-				 obj_desc2->integer.value;
-		break;
-
-
-	/* Def_nOr :=  NOr_op  Operand1    Operand2    Result  */
-
-	case AML_BIT_NOR_OP:
-
-		ret_desc->integer.value = ~(obj_desc->integer.value |
-				   obj_desc2->integer.value);
-		break;
-
-
-	/* Def_xOr :=  XOr_op  Operand1    Operand2    Result  */
-
-	case AML_BIT_XOR_OP:
-
-		ret_desc->integer.value = obj_desc->integer.value ^
-				 obj_desc2->integer.value;
-		break;
-
-
-	/* Def_divide  :=  Divide_op Dividend Divisor Remainder Quotient */
-
-	case AML_DIVIDE_OP:
-
-		if (!obj_desc2->integer.value) {
-			REPORT_ERROR
-				(("Aml_exec_dyadic2_r/Divide_op: Divide by zero\n"));
-
-			status = AE_AML_DIVIDE_BY_ZERO;
-			goto cleanup;
-		}
-
-		ret_desc2 = acpi_cm_create_internal_object (ACPI_TYPE_INTEGER);
-		if (!ret_desc2) {
-			status = AE_NO_MEMORY;
-			goto cleanup;
-		}
-
-		/* Remainder (modulo) */
-
-		ret_desc->integer.value  = ACPI_MODULO (obj_desc->integer.value,
-				  obj_desc2->integer.value);
-
-		/* Result (what we used to call the quotient) */
-
-		ret_desc2->integer.value = ACPI_DIVIDE (obj_desc->integer.value,
-				  obj_desc2->integer.value);
-		break;
-
-
-	/* Def_multiply := Multiply_op Operand1    Operand2    Result  */
-
-	case AML_MULTIPLY_OP:
-
-		ret_desc->integer.value = obj_desc->integer.value *
-				 obj_desc2->integer.value;
-		break;
-
-
-	/* Def_shift_left  :=  Shift_left_op Operand Shift_count Result */
-
-	case AML_SHIFT_LEFT_OP:
-
-		ret_desc->integer.value = obj_desc->integer.value <<
-				 obj_desc2->integer.value;
-		break;
-
-
-	/* Def_shift_right :=  Shift_right_op  Operand Shift_count Result  */
-
-	case AML_SHIFT_RIGHT_OP:
-
-		ret_desc->integer.value = obj_desc->integer.value >>
-				 obj_desc2->integer.value;
-		break;
-
-
-	/* Def_subtract := Subtract_op Operand1    Operand2    Result  */
-
-	case AML_SUBTRACT_OP:
-
-		ret_desc->integer.value = obj_desc->integer.value -
-				 obj_desc2->integer.value;
-		break;
-
-
-	/* Def_concat  :=  Concat_op   Data1   Data2   Result  */
-
-	case AML_CONCAT_OP:
-
-
-		/*
-		 * Convert the second operand if necessary.  The first operand
-		 * determines the type of the second operand, (See the Data Types
-		 * section of the ACPI specification.)  Both object types are
-		 * guaranteed to be either Integer/String/Buffer by the operand
-		 * resolution mechanism above.
-		 */
-
-		switch (obj_desc->common.type)
-		{
-		case ACPI_TYPE_INTEGER:
-			status = acpi_aml_convert_to_integer (&obj_desc2, walk_state);
-			break;
-
-		case ACPI_TYPE_STRING:
-			status = acpi_aml_convert_to_string (&obj_desc2, walk_state);
-			break;
-
-		case ACPI_TYPE_BUFFER:
-			status = acpi_aml_convert_to_buffer (&obj_desc2, walk_state);
-			break;
-
-		default:
-			status = AE_AML_INTERNAL;
-		}
-
-		if (ACPI_FAILURE (status)) {
-			goto cleanup;
-		}
-
-
-		/*
-		 * Both operands are now known to be the same object type
-		 * (Both are Integer, String, or Buffer), and we can now perform the
-		 * concatenation.
-		 */
-		status = acpi_aml_do_concatenate (obj_desc, obj_desc2, &ret_desc, walk_state);
-		if (ACPI_FAILURE (status)) {
-			goto cleanup;
-		}
-		break;
-
-
-	default:
-
-		REPORT_ERROR (("Acpi_aml_exec_dyadic2_r: Unknown dyadic opcode %X\n",
-				opcode));
-		status = AE_AML_BAD_OPCODE;
-		goto cleanup;
-	}
-
-
-	/*
-	 * Store the result of the operation (which is now in Obj_desc) into
-	 * the result descriptor, or the location pointed to by the result
-	 * descriptor (Res_desc).
-	 */
-
-	status = acpi_aml_exec_store (ret_desc, res_desc, walk_state);
-	if (ACPI_FAILURE (status)) {
-		goto cleanup;
-	}
-
-	if (AML_DIVIDE_OP == opcode) {
-		status = acpi_aml_exec_store (ret_desc2, res_desc2, walk_state);
-
-		/*
-		 * Since the remainder is not returned, remove a reference to
-		 * the object we created earlier
-		 */
-
-		acpi_cm_remove_reference (ret_desc2);
-	}
-
-
-cleanup:
-
-	/* Always delete the operands */
-
-	acpi_cm_remove_reference (obj_desc);
-	acpi_cm_remove_reference (obj_desc2);
-
-
-	/* Delete return object on error */
-
-	if (ACPI_FAILURE (status)) {
-		/* On failure, delete the result ops */
-
-		acpi_cm_remove_reference (res_desc);
-		acpi_cm_remove_reference (res_desc2);
-
-		if (ret_desc) {
-			/* And delete the internal return object */
-
-			acpi_cm_remove_reference (ret_desc);
-			ret_desc = NULL;
-		}
-	}
-
-	/* Set the return object and exit */
-
-	*return_desc = ret_desc;
-	return (status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_aml_exec_dyadic2_s
- *
- * PARAMETERS:  Opcode              - The opcode to be executed
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Execute Type 2 dyadic synchronization operator
- *
- * ALLOCATION:  Deletes one operand descriptor -- other remains on stack
- *
- ******************************************************************************/
-
-ACPI_STATUS
-acpi_aml_exec_dyadic2_s (
-	u16                     opcode,
-	ACPI_WALK_STATE         *walk_state,
-	ACPI_OPERAND_OBJECT     **return_desc)
-{
-	ACPI_OPERAND_OBJECT     *obj_desc;
-	ACPI_OPERAND_OBJECT     *time_desc;
-	ACPI_OPERAND_OBJECT     *ret_desc = NULL;
-	ACPI_STATUS             status;
-
-
-	/* Resolve all operands */
-
-	status = acpi_aml_resolve_operands (opcode, WALK_OPERANDS, walk_state);
-	/* Get all operands */
-
-	status |= acpi_ds_obj_stack_pop_object (&time_desc, walk_state);
-	status |= acpi_ds_obj_stack_pop_object (&obj_desc, walk_state);
-	if (ACPI_FAILURE (status)) {
-		/* Invalid parameters on object stack  */
-
-		goto cleanup;
-	}
-
-
-	/* Create the internal return object */
-
-	ret_desc = acpi_cm_create_internal_object (ACPI_TYPE_INTEGER);
-	if (!ret_desc) {
-		status = AE_NO_MEMORY;
-		goto cleanup;
-	}
-
-	/* Default return value is FALSE, operation did not time out */
-
-	ret_desc->integer.value = 0;
-
-
-	/* Examine the opcode */
-
-	switch (opcode)
-	{
-
-	/* Def_acquire :=  Acquire_op  Mutex_object Timeout */
-
-	case AML_ACQUIRE_OP:
-
-		status = acpi_aml_system_acquire_mutex (time_desc, obj_desc);
-		break;
-
-
-	/* Def_wait := Wait_op Acpi_event_object Timeout */
-
-	case AML_WAIT_OP:
-
-		status = acpi_aml_system_wait_event (time_desc, obj_desc);
-		break;
-
-
-	default:
-
-		REPORT_ERROR (("Acpi_aml_exec_dyadic2_s: Unknown dyadic synchronization opcode %X\n", opcode));
-		status = AE_AML_BAD_OPCODE;
-		goto cleanup;
-	}
-
-
-	/*
-	 * Return a boolean indicating if operation timed out
-	 * (TRUE) or not (FALSE)
-	 */
-
-	if (status == AE_TIME) {
-		ret_desc->integer.value = ACPI_INTEGER_MAX;  /* TRUE, op timed out */
-		status = AE_OK;
-	}
-
-
-cleanup:
-
-	/* Delete params */
-
-	acpi_cm_remove_reference (time_desc);
-	acpi_cm_remove_reference (obj_desc);
-
-	/* Delete return object on error */
-
-	if (ACPI_FAILURE (status) &&
-		(ret_desc))
-	{
-		acpi_cm_remove_reference (ret_desc);
-		ret_desc = NULL;
-	}
-
-
-	/* Set the return object and exit */
-
-	*return_desc = ret_desc;
-	return (status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_aml_exec_dyadic2
- *
- * PARAMETERS:  Opcode              - The opcode to be executed
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Execute Type 2 dyadic operator with numeric operands and
- *              no result operands
- *
- * ALLOCATION:  Deletes one operand descriptor -- other remains on stack
- *              containing result value
- *
- ******************************************************************************/
-
-ACPI_STATUS
-acpi_aml_exec_dyadic2 (
-	u16                     opcode,
-	ACPI_WALK_STATE         *walk_state,
-	ACPI_OPERAND_OBJECT     **return_desc)
-{
-	ACPI_OPERAND_OBJECT     *obj_desc;
-	ACPI_OPERAND_OBJECT     *obj_desc2;
-	ACPI_OPERAND_OBJECT     *ret_desc = NULL;
-	ACPI_STATUS             status;
-	u8                      lboolean;
-
-
-	/* Resolve all operands */
-
-	status = acpi_aml_resolve_operands (opcode, WALK_OPERANDS, walk_state);
-	/* Get all operands */
-
-	status |= acpi_ds_obj_stack_pop_object (&obj_desc2, walk_state);
-	status |= acpi_ds_obj_stack_pop_object (&obj_desc, walk_state);
-	if (ACPI_FAILURE (status)) {
-		/* Invalid parameters on object stack  */
-
-		goto cleanup;
-	}
-
-
-	/* Create the internal return object */
-
-	ret_desc = acpi_cm_create_internal_object (ACPI_TYPE_INTEGER);
-	if (!ret_desc) {
-		status = AE_NO_MEMORY;
-		goto cleanup;
-	}
-
-	/*
-	 * Execute the Opcode
-	 */
-
-	lboolean = FALSE;
-	switch (opcode)
-	{
-
-	/* Def_lAnd := LAnd_op Operand1    Operand2    */
-
-	case AML_LAND_OP:
-
-		lboolean = (u8) (obj_desc->integer.value &&
-				  obj_desc2->integer.value);
-		break;
-
-
-	/* Def_lEqual  :=  LEqual_op   Operand1    Operand2    */
-
-	case AML_LEQUAL_OP:
-
-		lboolean = (u8) (obj_desc->integer.value ==
-				  obj_desc2->integer.value);
-		break;
-
-
-	/* Def_lGreater := LGreater_op Operand1    Operand2    */
-
-	case AML_LGREATER_OP:
-
-		lboolean = (u8) (obj_desc->integer.value >
-				  obj_desc2->integer.value);
-		break;
-
-
-	/* Def_lLess   :=  LLess_op Operand1   Operand2    */
-
-	case AML_LLESS_OP:
-
-		lboolean = (u8) (obj_desc->integer.value <
-				  obj_desc2->integer.value);
-		break;
-
-
-	/* Def_lOr :=  LOr_op  Operand1    Operand2    */
-
-	case AML_LOR_OP:
-
-		lboolean = (u8) (obj_desc->integer.value ||
-				  obj_desc2->integer.value);
-		break;
-
-
-	default:
-
-		REPORT_ERROR (("Acpi_aml_exec_dyadic2: Unknown dyadic opcode %X\n", opcode));
-		status = AE_AML_BAD_OPCODE;
-		goto cleanup;
-		break;
-	}
-
-
-	/* Set return value to logical TRUE (all ones) or FALSE (zero) */
-
-	if (lboolean) {
-		ret_desc->integer.value = ACPI_INTEGER_MAX;
-	}
-	else {
-		ret_desc->integer.value = 0;
-	}
-
-
-cleanup:
-
-	/* Always delete operands */
-
-	acpi_cm_remove_reference (obj_desc);
-	acpi_cm_remove_reference (obj_desc2);
-
-
-	/* Delete return object on error */
-
-	if (ACPI_FAILURE (status) &&
-		(ret_desc))
-	{
-		acpi_cm_remove_reference (ret_desc);
-		ret_desc = NULL;
-	}
-
-
-	/* Set the return object and exit */
-
-	*return_desc = ret_desc;
-	return (status);
-}
-
-
diff -urN linux-2.4.6-pre4/drivers/acpi/interpreter/amfield.c linux/drivers/acpi/interpreter/amfield.c
--- linux-2.4.6-pre4/drivers/acpi/interpreter/amfield.c	Mon Jan 29 10:15:59 2001
+++ linux/drivers/acpi/interpreter/amfield.c	Wed Dec 31 16:00:00 1969
@@ -1,283 +0,0 @@
-/******************************************************************************
- *
- * Module Name: amfield - ACPI AML (p-code) execution - field manipulation
- *              $Revision: 77 $
- *
- *****************************************************************************/
-
-/*
- *  Copyright (C) 2000, 2001 R. Byron Moore
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-
-#include "acpi.h"
-#include "acdispat.h"
-#include "acinterp.h"
-#include "amlcode.h"
-#include "acnamesp.h"
-#include "achware.h"
-#include "acevents.h"
-
-
-#define _COMPONENT          INTERPRETER
-	 MODULE_NAME         ("amfield")
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_aml_setup_field
- *
- * PARAMETERS:  *Obj_desc           - Field to be read or written
- *              *Rgn_desc           - Region containing field
- *              Field_bit_width     - Field Width in bits (8, 16, or 32)
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Common processing for Acpi_aml_read_field and Acpi_aml_write_field
- *
- *  ACPI SPECIFICATION REFERENCES:
- *  Each of the Type1_opcodes is defined as specified in in-line
- *  comments below. For each one, use the following definitions.
- *
- *  Def_bit_field   :=  Bit_field_op    Src_buf Bit_idx Destination
- *  Def_byte_field  :=  Byte_field_op   Src_buf Byte_idx Destination
- *  Def_create_field := Create_field_op Src_buf Bit_idx Num_bits Name_string
- *  Def_dWord_field :=  DWord_field_op  Src_buf Byte_idx Destination
- *  Def_word_field  :=  Word_field_op   Src_buf Byte_idx Destination
- *  Bit_index       :=  Term_arg=>Integer
- *  Byte_index      :=  Term_arg=>Integer
- *  Destination     :=  Name_string
- *  Num_bits        :=  Term_arg=>Integer
- *  Source_buf      :=  Term_arg=>Buffer
- *
- ******************************************************************************/
-
-ACPI_STATUS
-acpi_aml_setup_field (
-	ACPI_OPERAND_OBJECT     *obj_desc,
-	ACPI_OPERAND_OBJECT     *rgn_desc,
-	u32                     field_bit_width)
-{
-	ACPI_STATUS             status = AE_OK;
-	u32                     field_byte_width;
-
-
-	/* Parameter validation */
-
-	if (!obj_desc || !rgn_desc) {
-		return (AE_AML_NO_OPERAND);
-	}
-
-	if (ACPI_TYPE_REGION != rgn_desc->common.type) {
-		return (AE_AML_OPERAND_TYPE);
-	}
-
-
-	/*
-	 * TBD: [Future] Acpi 2.0 supports Qword fields
-	 *
-	 * Init and validate Field width
-	 * Possible values are 1, 2, 4
-	 */
-
-	field_byte_width = DIV_8 (field_bit_width);
-
-	if ((field_bit_width != 8) &&
-		(field_bit_width != 16) &&
-		(field_bit_width != 32))
-	{
-		return (AE_AML_OPERAND_VALUE);
-	}
-
-
-	/*
-	 * If the Region Address and Length have not been previously evaluated,
-	 * evaluate them and save the results.
-	 */
-	if (!(rgn_desc->region.flags & AOPOBJ_DATA_VALID)) {
-
-		status = acpi_ds_get_region_arguments (rgn_desc);
-		if (ACPI_FAILURE (status)) {
-			return (status);
-		}
-	}
-
-
-	if ((obj_desc->common.type == ACPI_TYPE_FIELD_UNIT) &&
-		(!(obj_desc->common.flags & AOPOBJ_DATA_VALID)))
-	{
-		/*
-		 * Field Buffer and Index have not been previously evaluated,
-		 */
-		return (AE_AML_INTERNAL);
-	}
-
-	if (rgn_desc->region.length <
-	   (obj_desc->field.offset & ~((u32) field_byte_width - 1)) +
-			field_byte_width)
-	{
-		/*
-		 * Offset rounded up to next multiple of field width
-		 * exceeds region length, indicate an error
-		 */
-
-		return (AE_AML_REGION_LIMIT);
-	}
-
-	return (AE_OK);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_aml_access_named_field
- *
- * PARAMETERS:  Mode                - ACPI_READ or ACPI_WRITE
- *              Named_field         - Handle for field to be accessed
- *              *Buffer             - Value(s) to be read or written
- *              Buffer_length         - Number of bytes to transfer
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Read or write a named field
- *
- ******************************************************************************/
-
-ACPI_STATUS
-acpi_aml_access_named_field (
-	u32                     mode,
-	ACPI_HANDLE             named_field,
-	void                    *buffer,
-	u32                     buffer_length)
-{
-	ACPI_OPERAND_OBJECT     *obj_desc = NULL;
-	ACPI_STATUS             status = AE_OK;
-	u8                      locked = FALSE;
-	u32                     bit_granularity = 0;
-	u32                     byte_granularity;
-	u32                     datum_length;
-	u32                     actual_byte_length;
-	u32                     byte_field_length;
-
-
-	/* Parameter validation */
-
-	if ((!named_field) || (ACPI_READ == mode && !buffer)) {
-		return (AE_AML_INTERNAL);
-	}
-
-	/* Get the attached field object */
-
-	obj_desc = acpi_ns_get_attached_object (named_field);
-	if (!obj_desc) {
-		return (AE_AML_INTERNAL);
-	}
-
-	/* Check the type */
-
-	if (INTERNAL_TYPE_DEF_FIELD != acpi_ns_get_type (named_field)) {
-		return (AE_AML_OPERAND_TYPE);
-	}
-
-	/* Obj_desc valid and Named_field is a defined field */
-
-
-	/* Double-check that the attached object is also a field */
-
-	if (INTERNAL_TYPE_DEF_FIELD != obj_desc->common.type) {
-		return (AE_AML_OPERAND_TYPE);
-	}
-
-
-	/*
-	 * Granularity was decoded from the field access type
-	 * (Any_acc will be the same as Byte_acc)
-	 */
-
-	bit_granularity = obj_desc->field_unit.granularity;
-	byte_granularity = DIV_8 (bit_granularity);
-
-	/*
-	 * Check if request is too large for the field, and silently truncate
-	 * if necessary
-	 */
-
-	/* TBD: [Errors] should an error be returned in this case? */
-
-	byte_field_length = (u32) DIV_8 (obj_desc->field_unit.length + 7);
-
-
-	actual_byte_length = buffer_length;
-	if (buffer_length > byte_field_length) {
-		actual_byte_length = byte_field_length;
-	}
-
-	/* TBD: should these round down to a power of 2? */
-
-	if (DIV_8 (bit_granularity) > byte_field_length) {
-		bit_granularity = MUL_8(byte_field_length);
-	}
-
-	if (byte_granularity > byte_field_length) {
-		byte_granularity = byte_field_length;
-	}
-
-
-	/* Convert byte count to datum count, round up if necessary */
-
-	datum_length = (actual_byte_length + (byte_granularity-1)) / byte_granularity;
-
-
-	/* Get the global lock if needed */
-
-	locked = acpi_aml_acquire_global_lock (obj_desc->field_unit.lock_rule);
-
-
-	/* Perform the actual read or write of the buffer */
-
-	switch (mode)
-	{
-	case ACPI_READ:
-
-		status = acpi_aml_read_field (obj_desc, buffer, buffer_length,
-				  actual_byte_length, datum_length,
-				  bit_granularity, byte_granularity);
-		break;
-
-
-	case ACPI_WRITE:
-
-		status = acpi_aml_write_field (obj_desc, buffer, buffer_length,
-				  actual_byte_length, datum_length,
-				  bit_granularity, byte_granularity);
-		break;
-
-
-	default:
-
-		status = AE_BAD_PARAMETER;
-		break;
-	}
-
-
-	/* Release global lock if we acquired it earlier */
-
-	acpi_aml_release_global_lock (locked);
-
-	return (status);
-}
-
diff -urN linux-2.4.6-pre4/drivers/acpi/interpreter/amfldio.c linux/drivers/acpi/interpreter/amfldio.c
--- linux-2.4.6-pre4/drivers/acpi/interpreter/amfldio.c	Fri Feb  9 11:45:58 2001
+++ linux/drivers/acpi/interpreter/amfldio.c	Wed Dec 31 16:00:00 1969
@@ -1,685 +0,0 @@
-/******************************************************************************
- *
- * Module Name: amfldio - Aml Field I/O
- *              $Revision: 39 $
- *
- *****************************************************************************/
-
-/*
- *  Copyright (C) 2000, 2001 R. Byron Moore
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-
-#include "acpi.h"
-#include "acinterp.h"
-#include "amlcode.h"
-#include "acnamesp.h"
-#include "achware.h"
-#include "acevents.h"
-
-
-#define _COMPONENT          INTERPRETER
-	 MODULE_NAME         ("amfldio")
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_aml_read_field_data
- *
- * PARAMETERS:  *Obj_desc           - Field to be read
- *              *Value              - Where to store value
- *              Field_bit_width     - Field Width in bits (8, 16, or 32)
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Retrieve the value of the given field
- *
- ******************************************************************************/
-
-ACPI_STATUS
-acpi_aml_read_field_data (
-	ACPI_OPERAND_OBJECT     *obj_desc,
-	u32                     field_byte_offset,
-	u32                     field_bit_width,
-	u32                     *value)
-{
-	ACPI_STATUS             status;
-	ACPI_OPERAND_OBJECT     *rgn_desc = NULL;
-	ACPI_PHYSICAL_ADDRESS   address;
-	u32                     local_value = 0;
-	u32                     field_byte_width;
-
-
-	/* Obj_desc is validated by callers */
-
-	if (obj_desc) {
-		rgn_desc = obj_desc->field.container;
-	}
-
-
-	field_byte_width = DIV_8 (field_bit_width);
-	status = acpi_aml_setup_field (obj_desc, rgn_desc, field_bit_width);
-	if (ACPI_FAILURE (status)) {
-		return (status);
-	}
-
-	/* Setup_field validated Rgn_desc and Field_bit_width */
-
-	if (!value) {
-		value = &local_value;   /*  support reads without saving value  */
-	}
-
-
-	/*
-	 * Set offset to next multiple of field width,
-	 *  add region base address and offset within the field
-	 */
-	address = rgn_desc->region.address +
-			  (obj_desc->field.offset * field_byte_width) +
-			  field_byte_offset;
-
-
-	/* Invoke the appropriate Address_space/Op_region handler */
-
-	status = acpi_ev_address_space_dispatch (rgn_desc, ADDRESS_SPACE_READ,
-			 address, field_bit_width, value);
-
-
-
-	return (status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_aml_read_field
- *
- * PARAMETERS:  *Obj_desc           - Field to be read
- *              *Value              - Where to store value
- *              Field_bit_width     - Field Width in bits (8, 16, or 32)
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Retrieve the value of the given field
- *
- ******************************************************************************/
-
-ACPI_STATUS
-acpi_aml_read_field (
-	ACPI_OPERAND_OBJECT     *obj_desc,
-	void                    *buffer,
-	u32                     buffer_length,
-	u32                     byte_length,
-	u32                     datum_length,
-	u32                     bit_granularity,
-	u32                     byte_granularity)
-{
-	ACPI_STATUS             status;
-	u32                     this_field_byte_offset;
-	u32                     this_field_datum_offset;
-	u32                     previous_raw_datum;
-	u32                     this_raw_datum = 0;
-	u32                     valid_field_bits;
-	u32                     mask;
-	u32                     merged_datum = 0;
-
-
-	/*
-	 * Clear the caller's buffer (the whole buffer length as given)
-	 * This is very important, especially in the cases where a byte is read,
-	 * but the buffer is really a u32 (4 bytes).
-	 */
-
-	MEMSET (buffer, 0, buffer_length);
-
-	/* Read the first raw datum to prime the loop */
-
-	this_field_byte_offset = 0;
-	this_field_datum_offset= 0;
-
-	status = acpi_aml_read_field_data (obj_desc, this_field_byte_offset, bit_granularity,
-			   &previous_raw_datum);
-	if (ACPI_FAILURE (status)) {
-		goto cleanup;
-	}
-
-	/* We might actually be done if the request fits in one datum */
-
-	if ((datum_length == 1) &&
-		((obj_desc->field.bit_offset + obj_desc->field_unit.length) <=
-			(u16) bit_granularity))
-	{
-		merged_datum = previous_raw_datum;
-
-		merged_datum = (merged_datum >> obj_desc->field.bit_offset);
-
-		valid_field_bits = obj_desc->field_unit.length % bit_granularity;
-		if (valid_field_bits) {
-			mask = (((u32) 1 << valid_field_bits) - (u32) 1);
-			merged_datum &= mask;
-		}
-
-
-		/*
-		 * Place the Merged_datum into the proper format and return buffer
-		 * field
-		 */
-
-		switch (byte_granularity)
-		{
-		case 1:
-			((u8 *) buffer) [this_field_datum_offset] = (u8) merged_datum;
-			break;
-
-		case 2:
-			MOVE_UNALIGNED16_TO_16 (&(((u16 *) buffer)[this_field_datum_offset]), &merged_datum);
-			break;
-
-		case 4:
-			MOVE_UNALIGNED32_TO_32 (&(((u32 *) buffer)[this_field_datum_offset]), &merged_datum);
-			break;
-		}
-
-		this_field_byte_offset = 1;
-		this_field_datum_offset = 1;
-	}
-
-	else {
-		/* We need to get more raw data to complete one or more field data */
-
-		while (this_field_datum_offset < datum_length) {
-			/*
-			 * If the field is aligned on a byte boundary, we don't want
-			 * to perform a final read, since this would potentially read
-			 * past the end of the region.
-			 *
-			 * TBD: [Investigate] It may make more sense to just split the aligned
-			 * and non-aligned cases since the aligned case is so very simple,
-			 */
-			if ((obj_desc->field.bit_offset != 0) ||
-				((obj_desc->field.bit_offset == 0) &&
-				(this_field_datum_offset < (datum_length -1))))
-			{
-				/*
-				 * Get the next raw datum, it contains some or all bits
-				 * of the current field datum
-				 */
-
-				status = acpi_aml_read_field_data (obj_desc,
-						  this_field_byte_offset + byte_granularity,
-						  bit_granularity, &this_raw_datum);
-				if (ACPI_FAILURE (status)) {
-					goto cleanup;
-				}
-
-				/* Before merging the data, make sure the unused bits are clear */
-
-				switch (byte_granularity)
-				{
-				case 1:
-					this_raw_datum &= 0x000000FF;
-					previous_raw_datum &= 0x000000FF;
-					break;
-
-				case 2:
-					this_raw_datum &= 0x0000FFFF;
-					previous_raw_datum &= 0x0000FFFF;
-					break;
-				}
-			}
-
-
-			/*
-			 * Put together bits of the two raw data to make a complete
-			 * field datum
-			 */
-
-
-			if (obj_desc->field.bit_offset != 0) {
-				merged_datum =
-					(previous_raw_datum >> obj_desc->field.bit_offset) |
-					(this_raw_datum << (bit_granularity - obj_desc->field.bit_offset));
-			}
-
-			else {
-				merged_datum = previous_raw_datum;
-			}
-
-			/*
-			 * Prepare the merged datum for storing into the caller's
-			 *  buffer.  It is possible to have a 32-bit buffer
-			 *  (Byte_granularity == 4), but a Obj_desc->Field.Length
-			 *  of 8 or 16, meaning that the upper bytes of merged data
-			 *  are undesired.  This section fixes that.
-			 */
-			switch (obj_desc->field.length)
-			{
-			case 8:
-				merged_datum &= 0x000000FF;
-				break;
-
-			case 16:
-				merged_datum &= 0x0000FFFF;
-				break;
-			}
-
-			/*
-			 * Now store the datum in the caller's buffer, according to
-			 * the data type
-			 */
-			switch (byte_granularity)
-			{
-			case 1:
-				((u8 *) buffer) [this_field_datum_offset] = (u8) merged_datum;
-				break;
-
-			case 2:
-				MOVE_UNALIGNED16_TO_16 (&(((u16 *) buffer) [this_field_datum_offset]), &merged_datum);
-				break;
-
-			case 4:
-				MOVE_UNALIGNED32_TO_32 (&(((u32 *) buffer) [this_field_datum_offset]), &merged_datum);
-				break;
-			}
-
-			/*
-			 * Save the most recent datum since it contains bits of
-			 * the *next* field datum
-			 */
-
-			previous_raw_datum = this_raw_datum;
-
-			this_field_byte_offset += byte_granularity;
-			this_field_datum_offset++;
-
-		}  /* while */
-	}
-
-cleanup:
-
-	return (status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_aml_write_field_data
- *
- * PARAMETERS:  *Obj_desc           - Field to be set
- *              Value               - Value to store
- *              Field_bit_width     - Field Width in bits (8, 16, or 32)
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Store the value into the given field
- *
- ******************************************************************************/
-
-static ACPI_STATUS
-acpi_aml_write_field_data (
-	ACPI_OPERAND_OBJECT     *obj_desc,
-	u32                     field_byte_offset,
-	u32                     field_bit_width,
-	u32                     value)
-{
-	ACPI_STATUS             status = AE_OK;
-	ACPI_OPERAND_OBJECT     *rgn_desc = NULL;
-	ACPI_PHYSICAL_ADDRESS   address;
-	u32                     field_byte_width;
-
-
-	/* Obj_desc is validated by callers */
-
-	if (obj_desc) {
-		rgn_desc = obj_desc->field.container;
-	}
-
-	field_byte_width = DIV_8 (field_bit_width);
-	status = acpi_aml_setup_field (obj_desc, rgn_desc, field_bit_width);
-	if (ACPI_FAILURE (status)) {
-		return (status);
-	}
-
-
-	/*
-	 * Set offset to next multiple of field width,
-	 *  add region base address and offset within the field
-	 */
-	address = rgn_desc->region.address +
-			  (obj_desc->field.offset * field_byte_width) +
-			  field_byte_offset;
-
-	/* Invoke the appropriate Address_space/Op_region handler */
-
-	status = acpi_ev_address_space_dispatch (rgn_desc, ADDRESS_SPACE_WRITE,
-			 address, field_bit_width, &value);
-
-
-
-	return (status);
-}
-
-
-/*****************************************************************************
- *
- * FUNCTION:    Acpi_aml_write_field_data_with_update_rule
- *
- * PARAMETERS:  *Obj_desc           - Field to be set
- *              Value               - Value to store
- *              Field_bit_width     - Field Width in bits (8, 16, or 32)
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Apply the field update rule to a field write
- *
- ****************************************************************************/
-
-static ACPI_STATUS
-acpi_aml_write_field_data_with_update_rule (
-	ACPI_OPERAND_OBJECT     *obj_desc,
-	u32                     mask,
-	u32                     field_value,
-	u32                     this_field_byte_offset,
-	u32                     bit_granularity)
-{
-	ACPI_STATUS             status = AE_OK;
-	u32                     merged_value;
-	u32                     current_value;
-
-
-	/* Start with the new bits  */
-
-	merged_value = field_value;
-
-
-	/* Decode the update rule */
-
-	switch (obj_desc->field.update_rule)
-	{
-
-	case UPDATE_PRESERVE:
-
-		/* Check if update rule needs to be applied (not if mask is all ones) */
-
-		/* The left shift drops the bits we want to ignore. */
-		if ((~mask << (sizeof(mask)*8 - bit_granularity)) != 0) {
-			/*
-			 * Read the current contents of the byte/word/dword containing
-			 * the field, and merge with the new field value.
-			 */
-			status = acpi_aml_read_field_data (obj_desc, this_field_byte_offset,
-					   bit_granularity, &current_value);
-			merged_value |= (current_value & ~mask);
-		}
-		break;
-
-
-	case UPDATE_WRITE_AS_ONES:
-
-		/* Set positions outside the field to all ones */
-
-		merged_value |= ~mask;
-		break;
-
-
-	case UPDATE_WRITE_AS_ZEROS:
-
-		/* Set positions outside the field to all zeros */
-
-		merged_value &= mask;
-		break;
-
-
-	default:
-		status = AE_AML_OPERAND_VALUE;
-	}
-
-
-	/* Write the merged value */
-
-	if (ACPI_SUCCESS (status)) {
-		status = acpi_aml_write_field_data (obj_desc, this_field_byte_offset,
-				   bit_granularity, merged_value);
-	}
-
-	return (status);
-}
-
-
-/*****************************************************************************
- *
- * FUNCTION:    Acpi_aml_write_field
- *
- * PARAMETERS:  *Obj_desc           - Field to be set
- *              Value               - Value to store
- *              Field_bit_width     - Field Width in bits (8, 16, or 32)
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Store the value into the given field
- *
- ****************************************************************************/
-
-ACPI_STATUS
-acpi_aml_write_field (
-	ACPI_OPERAND_OBJECT     *obj_desc,
-	void                    *buffer,
-	u32                     buffer_length,
-	u32                     byte_length,
-	u32                     datum_length,
-	u32                     bit_granularity,
-	u32                     byte_granularity)
-{
-	ACPI_STATUS             status;
-	u32                     this_field_byte_offset;
-	u32                     this_field_datum_offset;
-	u32                     mask;
-	u32                     merged_datum;
-	u32                     previous_raw_datum;
-	u32                     this_raw_datum;
-	u32                     field_value;
-	u32                     valid_field_bits;
-
-
-	/*
-	 * Break the request into up to three parts:
-	 * non-aligned part at start, aligned part in middle, non-aligned part
-	 * at end --- Just like an I/O request ---
-	 */
-
-	this_field_byte_offset = 0;
-	this_field_datum_offset= 0;
-
-	/* Get a datum */
-
-	switch (byte_granularity)
-	{
-	case 1:
-		previous_raw_datum = ((u8 *) buffer) [this_field_datum_offset];
-		break;
-
-	case 2:
-		MOVE_UNALIGNED16_TO_32 (&previous_raw_datum, &(((u16 *) buffer) [this_field_datum_offset]));
-		break;
-
-	case 4:
-		MOVE_UNALIGNED32_TO_32 (&previous_raw_datum, &(((u32 *) buffer) [this_field_datum_offset]));
-		break;
-
-	default:
-		status = AE_AML_OPERAND_VALUE;
-		goto cleanup;
-	}
-
-
-	/*
-	 * Write a partial field datum if field does not begin on a datum boundary
-	 *
-	 * Construct Mask with 1 bits where the field is, 0 bits elsewhere
-	 *
-	 * 1) Bits above the field
-	 */
-
-	mask = (((u32)(-1)) << (u32)obj_desc->field.bit_offset);
-
-	/* 2) Only the bottom 5 bits are valid for a shift operation. */
-
-	if ((obj_desc->field.bit_offset + obj_desc->field_unit.length) < 32) {
-		/* Bits above the field */
-
-		mask &= (~(((u32)(-1)) << ((u32)obj_desc->field.bit_offset +
-				   (u32)obj_desc->field_unit.length)));
-	}
-
-	/* 3) Shift and mask the value into the field position */
-
-	field_value = (previous_raw_datum << obj_desc->field.bit_offset) & mask;
-
-	status = acpi_aml_write_field_data_with_update_rule (obj_desc, mask, field_value,
-			 this_field_byte_offset,
-			 bit_granularity);
-	if (ACPI_FAILURE (status)) {
-		goto cleanup;
-	}
-
-
-	/* If the field fits within one datum, we are done. */
-
-	if ((datum_length == 1) &&
-	   ((obj_desc->field.bit_offset + obj_desc->field_unit.length) <=
-			(u16) bit_granularity))
-	{
-		goto cleanup;
-	}
-
-	/*
-	 * We don't need to worry about the update rule for these data, because
-	 * all of the bits are part of the field.
-	 *
-	 * Can't write the last datum, however, because it might contain bits that
-	 * are not part of the field -- the update rule must be applied.
-	 */
-
-	while (this_field_datum_offset < (datum_length - 1)) {
-		this_field_datum_offset++;
-
-		/* Get the next raw datum, it contains bits of the current field datum... */
-
-		switch (byte_granularity)
-		{
-		case 1:
-			this_raw_datum = ((u8 *) buffer) [this_field_datum_offset];
-			break;
-
-		case 2:
-			MOVE_UNALIGNED16_TO_32 (&this_raw_datum, &(((u16 *) buffer) [this_field_datum_offset]));
-			break;
-
-		case 4:
-			MOVE_UNALIGNED32_TO_32 (&this_raw_datum, &(((u32 *) buffer) [this_field_datum_offset]));
-			break;
-
-		default:
-			status = AE_AML_OPERAND_VALUE;
-			goto cleanup;
-		}
-
-		/*
-		 * Put together bits of the two raw data to make a complete field
-		 * datum
-		 */
-
-		if (obj_desc->field.bit_offset != 0) {
-			merged_datum =
-				(previous_raw_datum >> (bit_granularity - obj_desc->field.bit_offset)) |
-				(this_raw_datum << obj_desc->field.bit_offset);
-		}
-
-		else {
-			merged_datum = this_raw_datum;
-		}
-
-		/* Now write the completed datum  */
-
-
-		status = acpi_aml_write_field_data (obj_desc,
-				   this_field_byte_offset + byte_granularity,
-				   bit_granularity, merged_datum);
-		if (ACPI_FAILURE (status)) {
-			goto cleanup;
-		}
-
-
-		/*
-		 * Save the most recent datum since it contains bits of
-		 * the *next* field datum
-		 */
-
-		previous_raw_datum = this_raw_datum;
-
-		this_field_byte_offset += byte_granularity;
-
-	}  /* while */
-
-
-	/* Write a partial field datum if field does not end on a datum boundary */
-
-	if ((obj_desc->field_unit.length + obj_desc->field_unit.bit_offset) %
-		bit_granularity)
-	{
-		switch (byte_granularity)
-		{
-		case 1:
-			this_raw_datum = ((u8 *) buffer) [this_field_datum_offset];
-			break;
-
-		case 2:
-			MOVE_UNALIGNED16_TO_32 (&this_raw_datum, &(((u16 *) buffer) [this_field_datum_offset]));
-			break;
-
-		case 4:
-			MOVE_UNALIGNED32_TO_32 (&this_raw_datum, &(((u32 *) buffer) [this_field_datum_offset]));
-			break;
-		}
-
-		/* Construct Mask with 1 bits where the field is, 0 bits elsewhere */
-
-		valid_field_bits = ((obj_desc->field_unit.length % bit_granularity) +
-				   obj_desc->field.bit_offset);
-
-		mask = (((u32) 1 << valid_field_bits) - (u32) 1);
-
-		/* Shift and mask the value into the field position */
-
-		field_value = (previous_raw_datum >>
-				  (bit_granularity - obj_desc->field.bit_offset)) & mask;
-
-		status = acpi_aml_write_field_data_with_update_rule (obj_desc, mask, field_value,
-				 this_field_byte_offset + byte_granularity,
-				 bit_granularity);
-		if (ACPI_FAILURE (status)) {
-			goto cleanup;
-		}
-	}
-
-
-cleanup:
-
-	return (status);
-}
-
-
diff -urN linux-2.4.6-pre4/drivers/acpi/interpreter/ammisc.c linux/drivers/acpi/interpreter/ammisc.c
--- linux-2.4.6-pre4/drivers/acpi/interpreter/ammisc.c	Mon Jan 22 13:23:42 2001
+++ linux/drivers/acpi/interpreter/ammisc.c	Wed Dec 31 16:00:00 1969
@@ -1,529 +0,0 @@
-
-/******************************************************************************
- *
- * Module Name: ammisc - ACPI AML (p-code) execution - specific opcodes
- *              $Revision: 73 $
- *
- *****************************************************************************/
-
-/*
- *  Copyright (C) 2000, 2001 R. Byron Moore
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-
-#include "acpi.h"
-#include "acparser.h"
-#include "acinterp.h"
-#include "amlcode.h"
-#include "acdispat.h"
-
-
-#define _COMPONENT          INTERPRETER
-	 MODULE_NAME         ("ammisc")
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_aml_exec_fatal
- *
- * PARAMETERS:  none
- *
- * RETURN:      Status.  If the OS returns from the OSD call, we just keep
- *              on going.
- *
- * DESCRIPTION: Execute Fatal operator
- *
- * ACPI SPECIFICATION REFERENCES:
- *  Def_fatal   :=  Fatal_op Fatal_type Fatal_code  Fatal_arg
- *  Fatal_type  :=  Byte_data
- *  Fatal_code  :=  DWord_data
- *  Fatal_arg   :=  Term_arg=>Integer
- *
- ******************************************************************************/
-
-ACPI_STATUS
-acpi_aml_exec_fatal (
-	ACPI_WALK_STATE         *walk_state)
-{
-	ACPI_OPERAND_OBJECT     *type_desc;
-	ACPI_OPERAND_OBJECT     *code_desc;
-	ACPI_OPERAND_OBJECT     *arg_desc;
-	ACPI_STATUS             status;
-
-
-	/* Resolve operands */
-
-	status = acpi_aml_resolve_operands (AML_FATAL_OP, WALK_OPERANDS, walk_state);
-	/* Get operands */
-
-	status |= acpi_ds_obj_stack_pop_object (&arg_desc, walk_state);
-	status |= acpi_ds_obj_stack_pop_object (&code_desc, walk_state);
-	status |= acpi_ds_obj_stack_pop_object (&type_desc, walk_state);
-	if (ACPI_FAILURE (status)) {
-		/* Invalid parameters on object stack  */
-
-		goto cleanup;
-	}
-
-
-	/* Def_fatal   :=  Fatal_op Fatal_type Fatal_code  Fatal_arg   */
-
-
-	/*
-	 * TBD: [Unhandled] call OSD interface to notify OS of fatal error
-	 * requiring shutdown!
-	 */
-
-
-cleanup:
-
-	/* Free the operands */
-
-	acpi_cm_remove_reference (arg_desc);
-	acpi_cm_remove_reference (code_desc);
-	acpi_cm_remove_reference (type_desc);
-
-
-	/* If we get back from the OS call, we might as well keep going. */
-
-	REPORT_WARNING (("An AML \"fatal\" Opcode (Fatal_op) was executed\n"));
-	return (AE_OK);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_aml_exec_index
- *
- * PARAMETERS:  none
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Execute Index operator
- *
- * ALLOCATION:  Deletes one operand descriptor -- other remains on stack
- *
- *  ACPI SPECIFICATION REFERENCES:
- *  Def_index   :=  Index_op Buff_pkg_obj Index_value Result
- *  Index_value :=  Term_arg=>Integer
- *  Name_string :=  <Root_char Name_path> | <Prefix_path Name_path>
- *  Result      :=  Super_name
- *  Super_name  :=  Name_string | Arg_obj | Local_obj | Debug_obj | Def_index
- *                             Local4_op | Local5_op | Local6_op | Local7_op
- *
- ******************************************************************************/
-
-ACPI_STATUS
-acpi_aml_exec_index (
-	ACPI_WALK_STATE         *walk_state,
-	ACPI_OPERAND_OBJECT     **return_desc)
-{
-	ACPI_OPERAND_OBJECT     *obj_desc;
-	ACPI_OPERAND_OBJECT     *idx_desc;
-	ACPI_OPERAND_OBJECT     *res_desc;
-	ACPI_OPERAND_OBJECT     *ret_desc = NULL;
-	ACPI_OPERAND_OBJECT     *tmp_desc;
-	ACPI_STATUS             status;
-
-
-	/* Resolve operands */
-	/* First operand can be either a package or a buffer */
-
-	status = acpi_aml_resolve_operands (AML_INDEX_OP, WALK_OPERANDS, walk_state);
-	/* Get all operands */
-
-	status |= acpi_ds_obj_stack_pop_object (&res_desc, walk_state);
-	status |= acpi_ds_obj_stack_pop_object (&idx_desc, walk_state);
-	status |= acpi_ds_obj_stack_pop_object (&obj_desc, walk_state);
-	if (ACPI_FAILURE (status)) {
-		/* Invalid parameters on object stack  */
-
-		goto cleanup;
-	}
-
-
-	/* Create the internal return object */
-
-	ret_desc = acpi_cm_create_internal_object (INTERNAL_TYPE_REFERENCE);
-	if (!ret_desc) {
-		status = AE_NO_MEMORY;
-		goto cleanup;
-	}
-
-
-	/*
-	 * At this point, the Obj_desc operand is either a Package or a Buffer
-	 */
-
-	if (obj_desc->common.type == ACPI_TYPE_PACKAGE) {
-		/* Object to be indexed is a Package */
-
-		if (idx_desc->integer.value >= obj_desc->package.count) {
-			status = AE_AML_PACKAGE_LIMIT;
-			goto cleanup;
-		}
-
-		if ((res_desc->common.type == INTERNAL_TYPE_REFERENCE) &&
-			(res_desc->reference.op_code == AML_ZERO_OP))
-		{
-			/*
-			 * There is no actual result descriptor (the Zero_op Result
-			 * descriptor is a placeholder), so just delete the placeholder and
-			 * return a reference to the package element
-			 */
-
-			acpi_cm_remove_reference (res_desc);
-		}
-
-		else {
-			/*
-			 * Each element of the package is an internal object.  Get the one
-			 * we are after.
-			 */
-
-			tmp_desc                      = obj_desc->package.elements[idx_desc->integer.value];
-			ret_desc->reference.op_code   = AML_INDEX_OP;
-			ret_desc->reference.target_type = tmp_desc->common.type;
-			ret_desc->reference.object    = tmp_desc;
-
-			status = acpi_aml_exec_store (ret_desc, res_desc, walk_state);
-			ret_desc->reference.object    = NULL;
-		}
-
-		/*
-		 * The local return object must always be a reference to the package element,
-		 * not the element itself.
-		 */
-		ret_desc->reference.op_code   = AML_INDEX_OP;
-		ret_desc->reference.target_type = ACPI_TYPE_PACKAGE;
-		ret_desc->reference.where     = &obj_desc->package.elements[idx_desc->integer.value];
-	}
-
-	else {
-		/* Object to be indexed is a Buffer */
-
-		if (idx_desc->integer.value >= obj_desc->buffer.length) {
-			status = AE_AML_BUFFER_LIMIT;
-			goto cleanup;
-		}
-
-		ret_desc->reference.op_code     = AML_INDEX_OP;
-		ret_desc->reference.target_type = ACPI_TYPE_BUFFER_FIELD;
-		ret_desc->reference.object      = obj_desc;
-		ret_desc->reference.offset      = (u32) idx_desc->integer.value;
-
-		status = acpi_aml_exec_store (ret_desc, res_desc, walk_state);
-	}
-
-
-cleanup:
-
-	/* Always delete operands */
-
-	acpi_cm_remove_reference (obj_desc);
-	acpi_cm_remove_reference (idx_desc);
-
-	/* Delete return object on error */
-
-	if (ACPI_FAILURE (status)) {
-		acpi_cm_remove_reference (res_desc);
-
-		if (ret_desc) {
-			acpi_cm_remove_reference (ret_desc);
-			ret_desc = NULL;
-		}
-	}
-
-	/* Set the return object and exit */
-
-	*return_desc = ret_desc;
-	return (status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_aml_exec_match
- *
- * PARAMETERS:  none
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Execute Match operator
- *
- * ACPI SPECIFICATION REFERENCES:
- *  Def_match   :=  Match_op Search_pkg Opcode1     Operand1
- *                              Opcode2 Operand2    Start_index
- *  Opcode1     :=  Byte_data: MTR, MEQ, MLE, MLT, MGE, or MGT
- *  Opcode2     :=  Byte_data: MTR, MEQ, MLE, MLT, MGE, or MGT
- *  Operand1    :=  Term_arg=>Integer
- *  Operand2    :=  Term_arg=>Integer
- *  Search_pkg  :=  Term_arg=>Package_object
- *  Start_index :=  Term_arg=>Integer
- *
- ******************************************************************************/
-
-ACPI_STATUS
-acpi_aml_exec_match (
-	ACPI_WALK_STATE         *walk_state,
-	ACPI_OPERAND_OBJECT     **return_desc)
-{
-	ACPI_OPERAND_OBJECT     *pkg_desc;
-	ACPI_OPERAND_OBJECT     *op1_desc;
-	ACPI_OPERAND_OBJECT     *V1_desc;
-	ACPI_OPERAND_OBJECT     *op2_desc;
-	ACPI_OPERAND_OBJECT     *V2_desc;
-	ACPI_OPERAND_OBJECT     *start_desc;
-	ACPI_OPERAND_OBJECT     *ret_desc = NULL;
-	ACPI_STATUS             status;
-	u32                     index;
-	u32                     match_value = (u32) -1;
-
-
-	/* Resolve all operands */
-
-	status = acpi_aml_resolve_operands (AML_MATCH_OP, WALK_OPERANDS, walk_state);
-	/* Get all operands */
-
-	status |= acpi_ds_obj_stack_pop_object (&start_desc, walk_state);
-	status |= acpi_ds_obj_stack_pop_object (&V2_desc, walk_state);
-	status |= acpi_ds_obj_stack_pop_object (&op2_desc, walk_state);
-	status |= acpi_ds_obj_stack_pop_object (&V1_desc, walk_state);
-	status |= acpi_ds_obj_stack_pop_object (&op1_desc, walk_state);
-	status |= acpi_ds_obj_stack_pop_object (&pkg_desc, walk_state);
-
-	if (ACPI_FAILURE (status)) {
-		/* Invalid parameters on object stack  */
-
-		goto cleanup;
-	}
-
-	/* Validate match comparison sub-opcodes */
-
-	if ((op1_desc->integer.value > MAX_MATCH_OPERATOR) ||
-		(op2_desc->integer.value > MAX_MATCH_OPERATOR))
-	{
-		status = AE_AML_OPERAND_VALUE;
-		goto cleanup;
-	}
-
-	index = (u32) start_desc->integer.value;
-	if (index >= (u32) pkg_desc->package.count) {
-		status = AE_AML_PACKAGE_LIMIT;
-		goto cleanup;
-	}
-
-	ret_desc = acpi_cm_create_internal_object (ACPI_TYPE_INTEGER);
-	if (!ret_desc) {
-		status = AE_NO_MEMORY;
-		goto cleanup;
-
-	}
-
-	/*
-	 * Examine each element until a match is found.  Within the loop,
-	 * "continue" signifies that the current element does not match
-	 * and the next should be examined.
-	 * Upon finding a match, the loop will terminate via "break" at
-	 * the bottom.  If it terminates "normally", Match_value will be -1
-	 * (its initial value) indicating that no match was found.  When
-	 * returned as a Number, this will produce the Ones value as specified.
-	 */
-
-	for ( ; index < pkg_desc->package.count; ++index) {
-		/*
-		 * Treat any NULL or non-numeric elements as non-matching.
-		 * TBD [Unhandled] - if an element is a Name,
-		 *      should we examine its value?
-		 */
-		if (!pkg_desc->package.elements[index] ||
-			ACPI_TYPE_INTEGER != pkg_desc->package.elements[index]->common.type)
-		{
-			continue;
-		}
-
-		/*
-		 * Within these switch statements:
-		 *      "break" (exit from the switch) signifies a match;
-		 *      "continue" (proceed to next iteration of enclosing
-		 *          "for" loop) signifies a non-match.
-		 */
-		switch (op1_desc->integer.value)
-		{
-
-		case MATCH_MTR:   /* always true */
-
-			break;
-
-
-		case MATCH_MEQ:   /* true if equal   */
-
-			if (pkg_desc->package.elements[index]->integer.value
-				 != V1_desc->integer.value)
-			{
-				continue;
-			}
-			break;
-
-
-		case MATCH_MLE:   /* true if less than or equal  */
-
-			if (pkg_desc->package.elements[index]->integer.value
-				 > V1_desc->integer.value)
-			{
-				continue;
-			}
-			break;
-
-
-		case MATCH_MLT:   /* true if less than   */
-
-			if (pkg_desc->package.elements[index]->integer.value
-				 >= V1_desc->integer.value)
-			{
-				continue;
-			}
-			break;
-
-
-		case MATCH_MGE:   /* true if greater than or equal   */
-
-			if (pkg_desc->package.elements[index]->integer.value
-				 < V1_desc->integer.value)
-			{
-				continue;
-			}
-			break;
-
-
-		case MATCH_MGT:   /* true if greater than    */
-
-			if (pkg_desc->package.elements[index]->integer.value
-				 <= V1_desc->integer.value)
-			{
-				continue;
-			}
-			break;
-
-
-		default:    /* undefined   */
-
-			continue;
-		}
-
-
-		switch(op2_desc->integer.value)
-		{
-
-		case MATCH_MTR:
-
-			break;
-
-
-		case MATCH_MEQ:
-
-			if (pkg_desc->package.elements[index]->integer.value
-				 != V2_desc->integer.value)
-			{
-				continue;
-			}
-			break;
-
-
-		case MATCH_MLE:
-
-			if (pkg_desc->package.elements[index]->integer.value
-				 > V2_desc->integer.value)
-			{
-				continue;
-			}
-			break;
-
-
-		case MATCH_MLT:
-
-			if (pkg_desc->package.elements[index]->integer.value
-				 >= V2_desc->integer.value)
-			{
-				continue;
-			}
-			break;
-
-
-		case MATCH_MGE:
-
-			if (pkg_desc->package.elements[index]->integer.value
-				 < V2_desc->integer.value)
-			{
-				continue;
-			}
-			break;
-
-
-		case MATCH_MGT:
-
-			if (pkg_desc->package.elements[index]->integer.value
-				 <= V2_desc->integer.value)
-			{
-				continue;
-			}
-			break;
-
-
-		default:
-
-			continue;
-		}
-
-		/* Match found: exit from loop */
-
-		match_value = index;
-		break;
-	}
-
-	/* Match_value is the return value */
-
-	ret_desc->integer.value = match_value;
-
-
-cleanup:
-
-	/* Free the operands */
-
-	acpi_cm_remove_reference (start_desc);
-	acpi_cm_remove_reference (V2_desc);
-	acpi_cm_remove_reference (op2_desc);
-	acpi_cm_remove_reference (V1_desc);
-	acpi_cm_remove_reference (op1_desc);
-	acpi_cm_remove_reference (pkg_desc);
-
-
-	/* Delete return object on error */
-
-	if (ACPI_FAILURE (status) &&
-		(ret_desc))
-	{
-		acpi_cm_remove_reference (ret_desc);
-		ret_desc = NULL;
-	}
-
-
-	/* Set the return object and exit */
-
-	*return_desc = ret_desc;
-	return (status);
-}
diff -urN linux-2.4.6-pre4/drivers/acpi/interpreter/ammonad.c linux/drivers/acpi/interpreter/ammonad.c
--- linux-2.4.6-pre4/drivers/acpi/interpreter/ammonad.c	Mon Jan 22 13:23:42 2001
+++ linux/drivers/acpi/interpreter/ammonad.c	Wed Dec 31 16:00:00 1969
@@ -1,999 +0,0 @@
-
-/******************************************************************************
- *
- * Module Name: ammonad - ACPI AML (p-code) execution for monadic operators
- *              $Revision: 89 $
- *
- *****************************************************************************/
-
-/*
- *  Copyright (C) 2000, 2001 R. Byron Moore
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-
-#include "acpi.h"
-#include "acparser.h"
-#include "acdispat.h"
-#include "acinterp.h"
-#include "amlcode.h"
-#include "acnamesp.h"
-
-
-#define _COMPONENT          INTERPRETER
-	 MODULE_NAME         ("ammonad")
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_aml_get_object_reference
- *
- * PARAMETERS:  Obj_desc        - Create a reference to this object
- *              Ret_desc        - Where to store the reference
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Obtain and return a "reference" to the target object
- *              Common code for the Ref_of_op and the Cond_ref_of_op.
- *
- ******************************************************************************/
-
-static ACPI_STATUS
-acpi_aml_get_object_reference (
-	ACPI_OPERAND_OBJECT     *obj_desc,
-	ACPI_OPERAND_OBJECT     **ret_desc,
-	ACPI_WALK_STATE         *walk_state)
-{
-	ACPI_STATUS             status = AE_OK;
-
-
-	if (VALID_DESCRIPTOR_TYPE (obj_desc, ACPI_DESC_TYPE_INTERNAL)) {
-		if (obj_desc->common.type != INTERNAL_TYPE_REFERENCE) {
-			*ret_desc = NULL;
-			status = AE_TYPE;
-			goto cleanup;
-		}
-
-		/*
-		 * Not a Name -- an indirect name pointer would have
-		 * been converted to a direct name pointer in Acpi_aml_resolve_operands
-		 */
-		switch (obj_desc->reference.op_code)
-		{
-		case AML_LOCAL_OP:
-
-			*ret_desc = (void *) acpi_ds_method_data_get_nte (MTH_TYPE_LOCAL,
-					  (obj_desc->reference.offset), walk_state);
-			break;
-
-
-		case AML_ARG_OP:
-
-			*ret_desc = (void *) acpi_ds_method_data_get_nte (MTH_TYPE_ARG,
-					  (obj_desc->reference.offset), walk_state);
-			break;
-
-
-		default:
-
-			*ret_desc = NULL;
-			status = AE_AML_INTERNAL;
-			goto cleanup;
-		}
-
-	}
-
-	else if (VALID_DESCRIPTOR_TYPE (obj_desc, ACPI_DESC_TYPE_NAMED)) {
-		/* Must be a named object;  Just return the Node */
-
-		*ret_desc = obj_desc;
-	}
-
-	else {
-		*ret_desc = NULL;
-		status = AE_TYPE;
-	}
-
-
-cleanup:
-
-	return (status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_aml_exec_monadic1
- *
- * PARAMETERS:  Opcode              - The opcode to be executed
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Execute Type 1 monadic operator with numeric operand on
- *              object stack
- *
- ******************************************************************************/
-
-ACPI_STATUS
-acpi_aml_exec_monadic1 (
-	u16                     opcode,
-	ACPI_WALK_STATE         *walk_state)
-{
-	ACPI_OPERAND_OBJECT     *obj_desc;
-	ACPI_STATUS             status;
-
-
-	/* Resolve all operands */
-
-	status = acpi_aml_resolve_operands (opcode, WALK_OPERANDS, walk_state);
-	/* Get all operands */
-
-	status |= acpi_ds_obj_stack_pop_object (&obj_desc, walk_state);
-	if (ACPI_FAILURE (status)) {
-		goto cleanup;
-	}
-
-
-	/* Examine the opcode */
-
-	switch (opcode)
-	{
-
-	/*  Def_release :=  Release_op  Mutex_object */
-
-	case AML_RELEASE_OP:
-
-		status = acpi_aml_system_release_mutex (obj_desc);
-		break;
-
-
-	/*  Def_reset   :=  Reset_op    Acpi_event_object */
-
-	case AML_RESET_OP:
-
-		status = acpi_aml_system_reset_event (obj_desc);
-		break;
-
-
-	/*  Def_signal  :=  Signal_op   Acpi_event_object */
-
-	case AML_SIGNAL_OP:
-
-		status = acpi_aml_system_signal_event (obj_desc);
-		break;
-
-
-	/*  Def_sleep   :=  Sleep_op    Msec_time   */
-
-	case AML_SLEEP_OP:
-
-		acpi_aml_system_do_suspend ((u32) obj_desc->integer.value);
-		break;
-
-
-	/*  Def_stall   :=  Stall_op    Usec_time   */
-
-	case AML_STALL_OP:
-
-		acpi_aml_system_do_stall ((u32) obj_desc->integer.value);
-		break;
-
-
-	/*  Unknown opcode  */
-
-	default:
-
-		REPORT_ERROR (("Acpi_aml_exec_monadic1: Unknown monadic opcode %X\n",
-			opcode));
-		status = AE_AML_BAD_OPCODE;
-		break;
-
-	} /* switch */
-
-
-cleanup:
-
-	/* Always delete the operand */
-
-	acpi_cm_remove_reference (obj_desc);
-
-	return (AE_OK);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_aml_exec_monadic2_r
- *
- * PARAMETERS:  Opcode              - The opcode to be executed
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Execute Type 2 monadic operator with numeric operand and
- *              result operand on operand stack
- *
- ******************************************************************************/
-
-ACPI_STATUS
-acpi_aml_exec_monadic2_r (
-	u16                     opcode,
-	ACPI_WALK_STATE         *walk_state,
-	ACPI_OPERAND_OBJECT     **return_desc)
-{
-	ACPI_OPERAND_OBJECT     *obj_desc;
-	ACPI_OPERAND_OBJECT     *res_desc;
-	ACPI_OPERAND_OBJECT     *ret_desc = NULL;
-	ACPI_OPERAND_OBJECT     *ret_desc2 = NULL;
-	u32                     res_val;
-	ACPI_STATUS             status;
-	u32                     i;
-	u32                     j;
-	ACPI_INTEGER            digit;
-
-
-	/* Resolve all operands */
-
-	status = acpi_aml_resolve_operands (opcode, WALK_OPERANDS, walk_state);
-	/* Get all operands */
-
-	status |= acpi_ds_obj_stack_pop_object (&res_desc, walk_state);
-	status |= acpi_ds_obj_stack_pop_object (&obj_desc, walk_state);
-	if (ACPI_FAILURE (status)) {
-		goto cleanup;
-	}
-
-
-	/* Create a return object of type NUMBER for most opcodes */
-
-	switch (opcode)
-	{
-	case AML_BIT_NOT_OP:
-	case AML_FIND_SET_LEFT_BIT_OP:
-	case AML_FIND_SET_RIGHT_BIT_OP:
-	case AML_FROM_BCD_OP:
-	case AML_TO_BCD_OP:
-	case AML_COND_REF_OF_OP:
-
-		ret_desc = acpi_cm_create_internal_object (ACPI_TYPE_INTEGER);
-		if (!ret_desc) {
-			status = AE_NO_MEMORY;
-			goto cleanup;
-		}
-
-		break;
-	}
-
-
-	switch (opcode)
-	{
-	/*  Def_not :=  Not_op  Operand Result  */
-
-	case AML_BIT_NOT_OP:
-
-		ret_desc->integer.value = ~obj_desc->integer.value;
-		break;
-
-
-	/*  Def_find_set_left_bit := Find_set_left_bit_op Operand Result */
-
-	case AML_FIND_SET_LEFT_BIT_OP:
-
-		ret_desc->integer.value = obj_desc->integer.value;
-
-		/*
-		 * Acpi specification describes Integer type as a little
-		 * endian unsigned value, so this boundry condition is valid.
-		 */
-		for (res_val = 0; ret_desc->integer.value && res_val < ACPI_INTEGER_BIT_SIZE; ++res_val) {
-			ret_desc->integer.value >>= 1;
-		}
-
-		ret_desc->integer.value = res_val;
-		break;
-
-
-	/*  Def_find_set_right_bit := Find_set_right_bit_op Operand Result */
-
-	case AML_FIND_SET_RIGHT_BIT_OP:
-
-		ret_desc->integer.value = obj_desc->integer.value;
-
-		/*
-		 * Acpi specification describes Integer type as a little
-		 * endian unsigned value, so this boundry condition is valid.
-		 */
-		for (res_val = 0; ret_desc->integer.value && res_val < ACPI_INTEGER_BIT_SIZE; ++res_val) {
-			ret_desc->integer.value <<= 1;
-		}
-
-		/* Since returns must be 1-based, subtract from 33 (65) */
-
-		ret_desc->integer.value = res_val == 0 ? 0 : (ACPI_INTEGER_BIT_SIZE + 1) - res_val;
-		break;
-
-
-	/*  Def_from_bDC := From_bCDOp  BCDValue    Result  */
-
-	case AML_FROM_BCD_OP:
-
-		/*
-		 * The 64-bit ACPI integer can hold 16 4-bit BCD integers
-		 */
-		ret_desc->integer.value = 0;
-		for (i = 0; i < ACPI_MAX_BCD_DIGITS; i++) {
-			/* Get one BCD digit */
-
-			digit = (ACPI_INTEGER) ((obj_desc->integer.value >> (i * 4)) & 0xF);
-
-			/* Check the range of the digit */
-
-			if (digit > 9) {
-				status = AE_AML_NUMERIC_OVERFLOW;
-				goto cleanup;
-			}
-
-			if (digit > 0) {
-				/* Sum into the result with the appropriate power of 10 */
-
-				for (j = 0; j < i; j++) {
-					digit *= 10;
-				}
-
-				ret_desc->integer.value += digit;
-			}
-		}
-		break;
-
-
-	/*  Def_to_bDC  :=  To_bCDOp Operand Result */
-
-	case AML_TO_BCD_OP:
-
-
-		if (obj_desc->integer.value > ACPI_MAX_BCD_VALUE) {
-			status = AE_AML_NUMERIC_OVERFLOW;
-			goto cleanup;
-		}
-
-		ret_desc->integer.value = 0;
-		for (i = 0; i < ACPI_MAX_BCD_DIGITS; i++) {
-			/* Divide by nth factor of 10 */
-
-			digit = obj_desc->integer.value;
-			for (j = 0; j < i; j++) {
-				digit /= 10;
-			}
-
-			/* Create the BCD digit */
-
-			if (digit > 0) {
-				ret_desc->integer.value += (ACPI_MODULO (digit, 10) << (i * 4));
-			}
-		}
-		break;
-
-
-	/*  Def_cond_ref_of     :=  Cond_ref_of_op  Source_object   Result  */
-
-	case AML_COND_REF_OF_OP:
-
-		/*
-		 * This op is a little strange because the internal return value is
-		 * different than the return value stored in the result descriptor
-		 * (There are really two return values)
-		 */
-
-		if ((ACPI_NAMESPACE_NODE *) obj_desc == acpi_gbl_root_node) {
-			/*
-			 * This means that the object does not exist in the namespace,
-			 * return FALSE
-			 */
-
-			ret_desc->integer.value = 0;
-
-			/*
-			 * Must delete the result descriptor since there is no reference
-			 * being returned
-			 */
-
-			acpi_cm_remove_reference (res_desc);
-			goto cleanup;
-		}
-
-		/* Get the object reference and store it */
-
-		status = acpi_aml_get_object_reference (obj_desc, &ret_desc2, walk_state);
-		if (ACPI_FAILURE (status)) {
-			goto cleanup;
-		}
-
-		status = acpi_aml_exec_store (ret_desc2, res_desc, walk_state);
-
-		/* The object exists in the namespace, return TRUE */
-
-		ret_desc->integer.value = ACPI_INTEGER_MAX;
-		goto cleanup;
-		break;
-
-
-	case AML_STORE_OP:
-
-		/*
-		 * A store operand is typically a number, string, buffer or lvalue
-		 * TBD: [Unhandled] What about a store to a package?
-		 */
-
-		/*
-		 * Do the store, and be careful about deleting the source object,
-		 * since the object itself may have been stored.
-		 */
-
-		status = acpi_aml_exec_store (obj_desc, res_desc, walk_state);
-		if (ACPI_FAILURE (status)) {
-			/* On failure, just delete the Obj_desc */
-
-			acpi_cm_remove_reference (obj_desc);
-		}
-
-		else {
-			/*
-			 * Normally, we would remove a reference on the Obj_desc parameter;
-			 * But since it is being used as the internal return object
-			 * (meaning we would normally increment it), the two cancel out,
-			 * and we simply don't do anything.
-			 */
-			*return_desc = obj_desc;
-		}
-
-		obj_desc = NULL;
-		return (status);
-
-		break;
-
-
-	case AML_DEBUG_OP:
-
-		/* Reference, returning an Reference */
-
-		return (AE_OK);
-		break;
-
-
-	/*
-	 * These are obsolete opcodes
-	 */
-
-	/*  Def_shift_left_bit  :=  Shift_left_bit_op   Source          Bit_num */
-	/*  Def_shift_right_bit :=  Shift_right_bit_op  Source          Bit_num */
-
-	case AML_SHIFT_LEFT_BIT_OP:
-	case AML_SHIFT_RIGHT_BIT_OP:
-
-		status = AE_SUPPORT;
-		goto cleanup;
-		break;
-
-
-	default:
-
-		REPORT_ERROR (("Acpi_aml_exec_monadic2_r: Unknown monadic opcode %X\n",
-			opcode));
-		status = AE_AML_BAD_OPCODE;
-		goto cleanup;
-	}
-
-
-	status = acpi_aml_exec_store (ret_desc, res_desc, walk_state);
-
-
-cleanup:
-	/* Always delete the operand object */
-
-	acpi_cm_remove_reference (obj_desc);
-
-	/* Delete return object(s) on error */
-
-	if (ACPI_FAILURE (status)) {
-		acpi_cm_remove_reference (res_desc); /* Result descriptor */
-		if (ret_desc) {
-			acpi_cm_remove_reference (ret_desc);
-			ret_desc = NULL;
-		}
-	}
-
-	/* Set the return object and exit */
-
-	*return_desc = ret_desc;
-	return (status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_aml_exec_monadic2
- *
- * PARAMETERS:  Opcode              - The opcode to be executed
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Execute Type 2 monadic operator with numeric operand:
- *              Deref_of_op, Ref_of_op, Size_of_op, Type_op, Increment_op,
- *              Decrement_op, LNot_op,
- *
- ******************************************************************************/
-
-ACPI_STATUS
-acpi_aml_exec_monadic2 (
-	u16                     opcode,
-	ACPI_WALK_STATE         *walk_state,
-	ACPI_OPERAND_OBJECT     **return_desc)
-{
-	ACPI_OPERAND_OBJECT     *obj_desc;
-	ACPI_OPERAND_OBJECT     *tmp_desc;
-	ACPI_OPERAND_OBJECT     *ret_desc = NULL;
-	ACPI_STATUS             resolve_status;
-	ACPI_STATUS             status;
-	u32                     type;
-	ACPI_INTEGER            value;
-
-
-	/* Attempt to resolve the operands */
-
-	resolve_status = acpi_aml_resolve_operands (opcode, WALK_OPERANDS, walk_state);
-	/* Always get all operands */
-
-	status = acpi_ds_obj_stack_pop_object (&obj_desc, walk_state);
-
-
-	/* Now we can check the status codes */
-
-	if (ACPI_FAILURE (resolve_status)) {
-		goto cleanup;
-	}
-
-	if (ACPI_FAILURE (status)) {
-		goto cleanup;
-	}
-
-
-	/* Get the operand and decode the opcode */
-
-
-	switch (opcode)
-	{
-
-	/*  Def_lNot := LNot_op Operand */
-
-	case AML_LNOT_OP:
-
-		ret_desc = acpi_cm_create_internal_object (ACPI_TYPE_INTEGER);
-		if (!ret_desc) {
-			status = AE_NO_MEMORY;
-			goto cleanup;
-		}
-
-		ret_desc->integer.value = !obj_desc->integer.value;
-		break;
-
-
-	/*  Def_decrement   :=  Decrement_op Target */
-	/*  Def_increment   :=  Increment_op Target */
-
-	case AML_DECREMENT_OP:
-	case AML_INCREMENT_OP:
-
-		/*
-		 * Since we are expecting an Reference on the top of the stack, it
-		 * can be either an Node or an internal object.
-		 *
-		 * TBD: [Future] This may be the prototype code for all cases where
-		 * an Reference is expected!! 10/99
-		 */
-
-	   if (VALID_DESCRIPTOR_TYPE (obj_desc, ACPI_DESC_TYPE_NAMED)) {
-		   ret_desc = obj_desc;
-	   }
-
-	   else {
-			/*
-			 * Duplicate the Reference in a new object so that we can resolve it
-			 * without destroying the original Reference object
-			 */
-
-			ret_desc = acpi_cm_create_internal_object (INTERNAL_TYPE_REFERENCE);
-			if (!ret_desc) {
-			  status = AE_NO_MEMORY;
-			   goto cleanup;
-			}
-
-			ret_desc->reference.op_code = obj_desc->reference.op_code;
-			ret_desc->reference.offset = obj_desc->reference.offset;
-			ret_desc->reference.object = obj_desc->reference.object;
-		}
-
-
-		/*
-		 * Convert the Ret_desc Reference to a Number
-		 * (This deletes the original Ret_desc)
-		 */
-
-		status = acpi_aml_resolve_operands (AML_LNOT_OP, &ret_desc, walk_state);
-		if (ACPI_FAILURE (status)) {
-			goto cleanup;
-		}
-
-		/* Do the actual increment or decrement */
-
-		if (AML_INCREMENT_OP == opcode) {
-			ret_desc->integer.value++;
-		}
-		else {
-			ret_desc->integer.value--;
-		}
-
-		/* Store the result back in the original descriptor */
-
-		status = acpi_aml_exec_store (ret_desc, obj_desc, walk_state);
-
-		/* Objdesc was just deleted (because it is an Reference) */
-
-		obj_desc = NULL;
-
-		break;
-
-
-	/*  Def_object_type :=  Object_type_op  Source_object   */
-
-	case AML_TYPE_OP:
-
-		if (INTERNAL_TYPE_REFERENCE == obj_desc->common.type) {
-			/*
-			 * Not a Name -- an indirect name pointer would have
-			 * been converted to a direct name pointer in Resolve_operands
-			 */
-			switch (obj_desc->reference.op_code)
-			{
-			case AML_ZERO_OP:
-			case AML_ONE_OP:
-			case AML_ONES_OP:
-
-				/* Constants are of type Number */
-
-				type = ACPI_TYPE_INTEGER;
-				break;
-
-
-			case AML_DEBUG_OP:
-
-				/* Per 1.0b spec, Debug object is of type Debug_object */
-
-				type = ACPI_TYPE_DEBUG_OBJECT;
-				break;
-
-
-			case AML_INDEX_OP:
-
-				/* Get the type of this reference (index into another object) */
-
-				type = obj_desc->reference.target_type;
-				if (type == ACPI_TYPE_PACKAGE) {
-					/*
-					 * The main object is a package, we want to get the type
-					 * of the individual package element that is referenced by
-					 * the index.
-					 */
-					type = (*(obj_desc->reference.where))->common.type;
-				}
-
-				break;
-
-
-			case AML_LOCAL_OP:
-
-				type = acpi_ds_method_data_get_type (MTH_TYPE_LOCAL,
-						  (obj_desc->reference.offset), walk_state);
-				break;
-
-
-			case AML_ARG_OP:
-
-				type = acpi_ds_method_data_get_type (MTH_TYPE_ARG,
-						  (obj_desc->reference.offset), walk_state);
-				break;
-
-
-			default:
-
-				REPORT_ERROR (("Acpi_aml_exec_monadic2/Type_op: Internal error - Unknown Reference subtype %X\n",
-					obj_desc->reference.op_code));
-				status = AE_AML_INTERNAL;
-				goto cleanup;
-			}
-		}
-
-		else {
-			/*
-			 * It's not a Reference, so it must be a direct name pointer.
-			 */
-			type = acpi_ns_get_type ((ACPI_HANDLE) obj_desc);
-		}
-
-		/* Allocate a descriptor to hold the type. */
-
-		ret_desc = acpi_cm_create_internal_object (ACPI_TYPE_INTEGER);
-		if (!ret_desc) {
-			status = AE_NO_MEMORY;
-			goto cleanup;
-		}
-
-		ret_desc->integer.value = type;
-		break;
-
-
-	/*  Def_size_of :=  Size_of_op  Source_object   */
-
-	case AML_SIZE_OF_OP:
-
-		if (VALID_DESCRIPTOR_TYPE (obj_desc, ACPI_DESC_TYPE_NAMED)) {
-			obj_desc = acpi_ns_get_attached_object (obj_desc);
-		}
-
-		if (!obj_desc) {
-			value = 0;
-		}
-
-		else {
-			switch (obj_desc->common.type)
-			{
-
-			case ACPI_TYPE_BUFFER:
-
-				value = obj_desc->buffer.length;
-				break;
-
-
-			case ACPI_TYPE_STRING:
-
-				value = obj_desc->string.length;
-				break;
-
-
-			case ACPI_TYPE_PACKAGE:
-
-				value = obj_desc->package.count;
-				break;
-
-			case INTERNAL_TYPE_REFERENCE:
-
-				value = 4;
-				break;
-
-			default:
-
-				status = AE_AML_OPERAND_TYPE;
-				goto cleanup;
-			}
-		}
-
-		/*
-		 * Now that we have the size of the object, create a result
-		 * object to hold the value
-		 */
-
-		ret_desc = acpi_cm_create_internal_object (ACPI_TYPE_INTEGER);
-		if (!ret_desc) {
-			status = AE_NO_MEMORY;
-			goto cleanup;
-		}
-
-		ret_desc->integer.value = value;
-		break;
-
-
-	/*  Def_ref_of  :=  Ref_of_op   Source_object   */
-
-	case AML_REF_OF_OP:
-
-		status = acpi_aml_get_object_reference (obj_desc, &ret_desc, walk_state);
-		if (ACPI_FAILURE (status)) {
-			goto cleanup;
-		}
-		break;
-
-
-	/*  Def_deref_of := Deref_of_op Obj_reference   */
-
-	case AML_DEREF_OF_OP:
-
-
-		/* Check for a method local or argument */
-
-		if (!VALID_DESCRIPTOR_TYPE (obj_desc, ACPI_DESC_TYPE_NAMED)) {
-			/*
-			 * Must resolve/dereference the local/arg reference first
-			 */
-			switch (obj_desc->reference.op_code)
-			{
-			/* Set Obj_desc to the value of the local/arg */
-
-			case AML_LOCAL_OP:
-
-				acpi_ds_method_data_get_value (MTH_TYPE_LOCAL,
-						(obj_desc->reference.offset), walk_state, &tmp_desc);
-
-				/*
-				 * Delete our reference to the input object and
-				 * point to the object just retrieved
-				 */
-				acpi_cm_remove_reference (obj_desc);
-				obj_desc = tmp_desc;
-				break;
-
-
-			case AML_ARG_OP:
-
-				acpi_ds_method_data_get_value (MTH_TYPE_ARG,
-						(obj_desc->reference.offset), walk_state, &tmp_desc);
-
-				/*
-				 * Delete our reference to the input object and
-				 * point to the object just retrieved
-				 */
-				acpi_cm_remove_reference (obj_desc);
-				obj_desc = tmp_desc;
-				break;
-
-			default:
-
-				/* Index op - handled below */
-				break;
-			}
-		}
-
-
-		/* Obj_desc may have changed from the code above */
-
-		if (VALID_DESCRIPTOR_TYPE (obj_desc, ACPI_DESC_TYPE_NAMED)) {
-			/* Get the actual object from the Node (This is the dereference) */
-
-			ret_desc = ((ACPI_NAMESPACE_NODE *) obj_desc)->object;
-
-			/* Returning a pointer to the object, add another reference! */
-
-			acpi_cm_add_reference (ret_desc);
-		}
-
-		else {
-			/*
-			 * This must be a reference object produced by the Index
-			 * ASL operation -- check internal opcode
-			 */
-
-			if ((obj_desc->reference.op_code != AML_INDEX_OP) &&
-				(obj_desc->reference.op_code != AML_REF_OF_OP))
-			{
-				status = AE_TYPE;
-				goto cleanup;
-			}
-
-
-			switch (obj_desc->reference.op_code)
-			{
-			case AML_INDEX_OP:
-
-				/*
-				 * Supported target types for the Index operator are
-				 * 1) A Buffer
-				 * 2) A Package
-				 */
-
-				if (obj_desc->reference.target_type == ACPI_TYPE_BUFFER_FIELD) {
-					/*
-					 * The target is a buffer, we must create a new object that
-					 * contains one element of the buffer, the element pointed
-					 * to by the index.
-					 *
-					 * NOTE: index into a buffer is NOT a pointer to a
-					 * sub-buffer of the main buffer, it is only a pointer to a
-					 * single element (byte) of the buffer!
-					 */
-					ret_desc = acpi_cm_create_internal_object (ACPI_TYPE_INTEGER);
-					if (!ret_desc) {
-						status = AE_NO_MEMORY;
-						goto cleanup;
-					}
-
-					tmp_desc = obj_desc->reference.object;
-					ret_desc->integer.value =
-						tmp_desc->buffer.pointer[obj_desc->reference.offset];
-
-					/* TBD: [Investigate] (see below) Don't add an additional
-					 * ref!
-					 */
-				}
-
-				else if (obj_desc->reference.target_type == ACPI_TYPE_PACKAGE) {
-					/*
-					 * The target is a package, we want to return the referenced
-					 * element of the package.  We must add another reference to
-					 * this object, however.
-					 */
-
-					ret_desc = *(obj_desc->reference.where);
-					if (!ret_desc) {
-						/*
-						 * We can't return a NULL dereferenced value.  This is
-						 * an uninitialized package element and is thus a
-						 * severe error.
-						 */
-
-						status = AE_AML_UNINITIALIZED_ELEMENT;
-						goto cleanup;
-					}
-
-					acpi_cm_add_reference (ret_desc);
-				}
-
-				else {
-					status = AE_AML_OPERAND_TYPE;
-					goto cleanup;
-				}
-
-				break;
-
-
-			case AML_REF_OF_OP:
-
-				ret_desc = obj_desc->reference.object;
-
-				/* Add another reference to the object! */
-
-				acpi_cm_add_reference (ret_desc);
-				break;
-			}
-		}
-
-		break;
-
-
-	default:
-
-		REPORT_ERROR (("Acpi_aml_exec_monadic2: Unknown monadic opcode %X\n",
-			opcode));
-		status = AE_AML_BAD_OPCODE;
-		goto cleanup;
-	}
-
-
-cleanup:
-
-	if (obj_desc) {
-		acpi_cm_remove_reference (obj_desc);
-	}
-
-	/* Delete return object on error */
-
-	if (ACPI_FAILURE (status) &&
-		(ret_desc))
-	{
-		acpi_cm_remove_reference (ret_desc);
-		ret_desc = NULL;
-	}
-
-	*return_desc = ret_desc;
-	return (status);
-}
-
diff -urN linux-2.4.6-pre4/drivers/acpi/interpreter/amnames.c linux/drivers/acpi/interpreter/amnames.c
--- linux-2.4.6-pre4/drivers/acpi/interpreter/amnames.c	Mon Jan 22 13:23:42 2001
+++ linux/drivers/acpi/interpreter/amnames.c	Wed Dec 31 16:00:00 1969
@@ -1,395 +0,0 @@
-
-/******************************************************************************
- *
- * Module Name: amnames - interpreter/scanner name load/execute
- *              $Revision: 73 $
- *
- *****************************************************************************/
-
-/*
- *  Copyright (C) 2000, 2001 R. Byron Moore
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-
-#include "acpi.h"
-#include "acinterp.h"
-#include "amlcode.h"
-#include "acnamesp.h"
-
-#define _COMPONENT          INTERPRETER
-	 MODULE_NAME         ("amnames")
-
-
-/* AML Package Length encodings */
-
-#define ACPI_AML_PACKAGE_TYPE1   0x40
-#define ACPI_AML_PACKAGE_TYPE2   0x4000
-#define ACPI_AML_PACKAGE_TYPE3   0x400000
-#define ACPI_AML_PACKAGE_TYPE4   0x40000000
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_aml_allocate_name_string
- *
- * PARAMETERS:  Prefix_count        - Count of parent levels. Special cases:
- *                                    (-1) = root,  0 = none
- *              Num_name_segs       - count of 4-character name segments
- *
- * RETURN:      A pointer to the allocated string segment.  This segment must
- *              be deleted by the caller.
- *
- * DESCRIPTION: Allocate a buffer for a name string. Ensure allocated name
- *              string is long enough, and set up prefix if any.
- *
- ******************************************************************************/
-
-NATIVE_CHAR *
-acpi_aml_allocate_name_string (
-	u32                     prefix_count,
-	u32                     num_name_segs)
-{
-	NATIVE_CHAR             *temp_ptr;
-	NATIVE_CHAR             *name_string;
-	u32                      size_needed;
-
-
-	/*
-	 * Allow room for all \ and ^ prefixes, all segments, and a Multi_name_prefix.
-	 * Also, one byte for the null terminator.
-	 * This may actually be somewhat longer than needed.
-	 */
-
-	if (prefix_count == (u32) -1) {
-		/* Special case for root */
-
-		size_needed = 1 + (ACPI_NAME_SIZE * num_name_segs) + 2 + 1;
-	}
-	else {
-		size_needed = prefix_count + (ACPI_NAME_SIZE * num_name_segs) + 2 + 1;
-	}
-
-	/*
-	 * Allocate a buffer for the name.
-	 * This buffer must be deleted by the caller!
-	 */
-
-	name_string = acpi_cm_allocate (size_needed);
-	if (!name_string) {
-		REPORT_ERROR (("Aml_allocate_name_string: name allocation failure\n"));
-		return (NULL);
-	}
-
-	temp_ptr = name_string;
-
-	/* Set up Root or Parent prefixes if needed */
-
-	if (prefix_count == (u32) -1) {
-		*temp_ptr++ = AML_ROOT_PREFIX;
-	}
-
-	else {
-		while (prefix_count--) {
-			*temp_ptr++ = AML_PARENT_PREFIX;
-		}
-	}
-
-
-	/* Set up Dual or Multi prefixes if needed */
-
-	if (num_name_segs > 2) {
-		/* Set up multi prefixes   */
-
-		*temp_ptr++ = AML_MULTI_NAME_PREFIX_OP;
-		*temp_ptr++ = (char) num_name_segs;
-	}
-
-	else if (2 == num_name_segs) {
-		/* Set up dual prefixes */
-
-		*temp_ptr++ = AML_DUAL_NAME_PREFIX;
-	}
-
-	/*
-	 * Terminate string following prefixes. Acpi_aml_exec_name_segment() will
-	 * append the segment(s)
-	 */
-
-	*temp_ptr = 0;
-
-	return (name_string);
-}
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_aml_exec_name_segment
- *
- * PARAMETERS:  Interpreter_mode    - Current running mode (load1/Load2/Exec)
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Execute a name segment (4 bytes)
- *
- ******************************************************************************/
-
-ACPI_STATUS
-acpi_aml_exec_name_segment (
-	u8                      **in_aml_address,
-	NATIVE_CHAR             *name_string)
-{
-	u8                      *aml_address = *in_aml_address;
-	ACPI_STATUS             status = AE_OK;
-	u32                     index;
-	NATIVE_CHAR             char_buf[5];
-
-
-	/*
-	 * If first character is a digit, then we know that we aren't looking at a
-	 * valid name segment
-	 */
-
-	char_buf[0] = *aml_address;
-
-	if ('0' <= char_buf[0] && char_buf[0] <= '9') {
-		return (AE_CTRL_PENDING);
-	}
-
-	for (index = 4;
-		(index > 0) && (acpi_cm_valid_acpi_character (*aml_address));
-		--index)
-	{
-		char_buf[4 - index] = *aml_address++;
-	}
-
-
-	/* Valid name segment  */
-
-	if (0 == index) {
-		/* Found 4 valid characters */
-
-		char_buf[4] = '\0';
-
-		if (name_string) {
-			STRCAT (name_string, char_buf);
-		}
-
-	}
-
-	else if (4 == index) {
-		/*
-		 * First character was not a valid name character,
-		 * so we are looking at something other than a name.
-		 */
-		status = AE_CTRL_PENDING;
-	}
-
-	else {
-		/* Segment started with one or more valid characters, but fewer than 4 */
-
-		status = AE_AML_BAD_NAME;
-	}
-
-	*in_aml_address = aml_address;
-
-	return (status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_aml_get_name_string
- *
- * PARAMETERS:  Data_type           - Data type to be associated with this name
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Get a name, including any prefixes.
- *
- ******************************************************************************/
-
-
-ACPI_STATUS
-acpi_aml_get_name_string (
-	OBJECT_TYPE_INTERNAL    data_type,
-	u8                      *in_aml_address,
-	NATIVE_CHAR             **out_name_string,
-	u32                     *out_name_length)
-{
-	ACPI_STATUS             status = AE_OK;
-	u8                      *aml_address = in_aml_address;
-	NATIVE_CHAR             *name_string = NULL;
-	u32                     num_segments;
-	u32                     prefix_count = 0;
-	u8                      prefix = 0;
-	u8                      has_prefix = FALSE;
-
-
-	if (INTERNAL_TYPE_DEF_FIELD == data_type  ||
-		INTERNAL_TYPE_BANK_FIELD == data_type ||
-		INTERNAL_TYPE_INDEX_FIELD == data_type)
-	{
-		/* Disallow prefixes for types associated with field names */
-
-		name_string = acpi_aml_allocate_name_string (0, 1);
-		if (!name_string) {
-			status = AE_NO_MEMORY;
-		}
-		else {
-			status = acpi_aml_exec_name_segment (&aml_address, name_string);
-		}
-	}
-
-	else {
-		/*
-		 * Data_type is not a field name.
-		 * Examine first character of name for root or parent prefix operators
-		 */
-
-		switch (*aml_address)
-		{
-
-		case AML_ROOT_PREFIX:
-
-			prefix = *aml_address++;
-			/*
-			 * Remember that we have a Root_prefix --
-			 * see comment in Acpi_aml_allocate_name_string()
-			 */
-			prefix_count = (u32) -1;
-			has_prefix = TRUE;
-			break;
-
-
-		case AML_PARENT_PREFIX:
-
-			/* Increment past possibly multiple parent prefixes */
-
-			do
-			{
-				prefix = *aml_address++;
-				++prefix_count;
-
-			} while (*aml_address == AML_PARENT_PREFIX);
-			has_prefix = TRUE;
-			break;
-
-
-		default:
-
-			break;
-		}
-
-
-		/* Examine first character of name for name segment prefix operator */
-
-		switch (*aml_address)
-		{
-
-		case AML_DUAL_NAME_PREFIX:
-
-			prefix = *aml_address++;
-			name_string = acpi_aml_allocate_name_string (prefix_count, 2);
-			if (!name_string) {
-				status = AE_NO_MEMORY;
-				break;
-			}
-
-			/* Indicate that we processed a prefix */
-			has_prefix = TRUE;
-
-			status = acpi_aml_exec_name_segment (&aml_address, name_string);
-			if (ACPI_SUCCESS (status)) {
-				status = acpi_aml_exec_name_segment (&aml_address, name_string);
-			}
-			break;
-
-
-		case AML_MULTI_NAME_PREFIX_OP:
-
-			prefix = *aml_address++;
-			/* Fetch count of segments remaining in name path */
-
-			num_segments = *aml_address++;
-
-			name_string = acpi_aml_allocate_name_string (prefix_count, num_segments);
-			if (!name_string) {
-				status = AE_NO_MEMORY;
-				break;
-			}
-
-			/* Indicate that we processed a prefix */
-			has_prefix = TRUE;
-
-			while (num_segments &&
-					(status = acpi_aml_exec_name_segment (&aml_address, name_string)) == AE_OK)
-			{
-				--num_segments;
-			}
-
-			break;
-
-
-		case 0:
-
-			/* Null_name valid as of 8-12-98 ASL/AML Grammar Update */
-
-
-			/* Consume the NULL byte */
-
-			aml_address++;
-			name_string = acpi_aml_allocate_name_string (prefix_count, 0);
-			if (!name_string) {
-				status = AE_NO_MEMORY;
-				break;
-			}
-
-			break;
-
-
-		default:
-
-			/* Name segment string */
-
-			name_string = acpi_aml_allocate_name_string (prefix_count, 1);
-			if (!name_string) {
-				status = AE_NO_MEMORY;
-				break;
-			}
-
-			status = acpi_aml_exec_name_segment (&aml_address, name_string);
-			break;
-
-		}   /* Switch (Peek_op ())   */
-	}
-
-
-	if (AE_CTRL_PENDING == status && has_prefix) {
-		/* Ran out of segments after processing a prefix */
-
-		REPORT_ERROR (
-			("Aml_do_name: Malformed Name at %p\n", name_string));
-		status = AE_AML_BAD_NAME;
-	}
-
-
-	*out_name_string = name_string;
-	*out_name_length = (u32) (aml_address - in_aml_address);
-
-	return (status);
-}
-
-
diff -urN linux-2.4.6-pre4/drivers/acpi/interpreter/amprep.c linux/drivers/acpi/interpreter/amprep.c
--- linux-2.4.6-pre4/drivers/acpi/interpreter/amprep.c	Mon Jan 22 13:23:42 2001
+++ linux/drivers/acpi/interpreter/amprep.c	Wed Dec 31 16:00:00 1969
@@ -1,405 +0,0 @@
-
-/******************************************************************************
- *
- * Module Name: amprep - ACPI AML (p-code) execution - field prep utilities
- *              $Revision: 73 $
- *
- *****************************************************************************/
-
-/*
- *  Copyright (C) 2000, 2001 R. Byron Moore
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-
-#include "acpi.h"
-#include "acinterp.h"
-#include "amlcode.h"
-#include "acnamesp.h"
-#include "acparser.h"
-
-
-#define _COMPONENT          INTERPRETER
-	 MODULE_NAME         ("amprep")
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_aml_decode_field_access_type
- *
- * PARAMETERS:  Access          - Encoded field access bits
- *
- * RETURN:      Field granularity (8, 16, or 32)
- *
- * DESCRIPTION: Decode the Access_type bits of a field definition.
- *
- ******************************************************************************/
-
-static u32
-acpi_aml_decode_field_access_type (
-	u32                     access,
-	u16                     length)
-{
-
-	switch (access)
-	{
-	case ACCESS_ANY_ACC:
-		if (length <= 8) {
-			return (8);
-		}
-		else if (length <= 16) {
-			return (16);
-		}
-		else if (length <= 32) {
-			return (32);
-		}
-		else {
-			return (8);
-		}
-		break;
-
-	case ACCESS_BYTE_ACC:
-		return (8);
-		break;
-
-	case ACCESS_WORD_ACC:
-		return (16);
-		break;
-
-	case ACCESS_DWORD_ACC:
-		return (32);
-		break;
-
-	default:
-		/* Invalid field access type */
-
-		return (0);
-	}
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_aml_prep_common_field_objec
- *
- * PARAMETERS:  Obj_desc            - The field object
- *              Field_flags         - Access, Lock_rule, or Update_rule.
- *                                    The format of a Field_flag is described
- *                                    in the ACPI specification
- *              Field_position      - Field position
- *              Field_length        - Field length
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Initialize the areas of the field object that are common
- *              to the various types of fields.
- *
- ******************************************************************************/
-
-static ACPI_STATUS
-acpi_aml_prep_common_field_object (
-	ACPI_OPERAND_OBJECT     *obj_desc,
-	u8                      field_flags,
-	u8                      field_attribute,
-	u32                     field_position,
-	u32                     field_length)
-{
-	u32                     granularity;
-
-
-	/*
-	 * Note: the structure being initialized is the
-	 * ACPI_COMMON_FIELD_INFO;  Therefore, we can just use the Field union to
-	 * access this common area.  No structure fields outside of the common area
-	 * are initialized by this procedure.
-	 */
-
-	/* Decode the Field_flags */
-
-	obj_desc->field.access          = (u8) ((field_flags & ACCESS_TYPE_MASK)
-			 >> ACCESS_TYPE_SHIFT);
-	obj_desc->field.lock_rule       = (u8) ((field_flags & LOCK_RULE_MASK)
-			 >> LOCK_RULE_SHIFT);
-	obj_desc->field.update_rule     = (u8) ((field_flags & UPDATE_RULE_MASK)
-			 >> UPDATE_RULE_SHIFT);
-
-	/* Other misc fields */
-
-	obj_desc->field.length          = (u16) field_length;
-	obj_desc->field.access_attribute = field_attribute;
-
-	/* Decode the access type so we can compute offsets */
-
-	granularity = acpi_aml_decode_field_access_type (obj_desc->field.access, obj_desc->field.length);
-	if (!granularity) {
-		return (AE_AML_OPERAND_VALUE);
-	}
-
-	/* Access granularity based fields */
-
-	obj_desc->field.granularity     = (u8) granularity;
-	obj_desc->field.bit_offset      = (u8) (field_position % granularity);
-	obj_desc->field.offset          = (u32) field_position / granularity;
-
-
-	return (AE_OK);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_aml_prep_def_field_value
- *
- * PARAMETERS:  Node            - Owning Node
- *              Region              - Region in which field is being defined
- *              Field_flags         - Access, Lock_rule, or Update_rule.
- *                                    The format of a Field_flag is described
- *                                    in the ACPI specification
- *              Field_position      - Field position
- *              Field_length        - Field length
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Construct an ACPI_OPERAND_OBJECT  of type Def_field and
- *              connect it to the parent Node.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-acpi_aml_prep_def_field_value (
-	ACPI_NAMESPACE_NODE     *node,
-	ACPI_HANDLE             region,
-	u8                      field_flags,
-	u8                      field_attribute,
-	u32                     field_position,
-	u32                     field_length)
-{
-	ACPI_OPERAND_OBJECT     *obj_desc;
-	u32                     type;
-	ACPI_STATUS             status;
-
-
-	/* Parameter validation */
-
-	if (!region) {
-		return (AE_AML_NO_OPERAND);
-	}
-
-	type = acpi_ns_get_type (region);
-	if (type != ACPI_TYPE_REGION) {
-		return (AE_AML_OPERAND_TYPE);
-	}
-
-	/* Allocate a new object */
-
-	obj_desc = acpi_cm_create_internal_object (INTERNAL_TYPE_DEF_FIELD);
-	if (!obj_desc) {
-		return (AE_NO_MEMORY);
-	}
-
-
-	/* Obj_desc and Region valid */
-
-	/* Initialize areas of the object that are common to all fields */
-
-	status = acpi_aml_prep_common_field_object (obj_desc, field_flags, field_attribute,
-			  field_position, field_length);
-	if (ACPI_FAILURE (status)) {
-		return (status);
-	}
-
-	/* Initialize areas of the object that are specific to this field type */
-
-	obj_desc->field.container = acpi_ns_get_attached_object (region);
-
-	/* An additional reference for the container */
-
-	acpi_cm_add_reference (obj_desc->field.container);
-
-
-	/* Debug info */
-
-	/*
-	 * Store the constructed descriptor (Obj_desc) into the Named_obj whose
-	 * handle is on TOS, preserving the current type of that Named_obj.
-	 */
-	status = acpi_ns_attach_object ((ACPI_HANDLE) node, obj_desc,
-			  (u8) acpi_ns_get_type ((ACPI_HANDLE) node));
-
-	return (status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_aml_prep_bank_field_value
- *
- * PARAMETERS:  Node            - Owning Node
- *              Region              - Region in which field is being defined
- *              Bank_reg            - Bank selection register
- *              Bank_val            - Value to store in selection register
- *              Field_flags         - Access, Lock_rule, or Update_rule
- *              Field_position      - Field position
- *              Field_length        - Field length
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Construct an ACPI_OPERAND_OBJECT  of type Bank_field and
- *              connect it to the parent Node.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-acpi_aml_prep_bank_field_value (
-	ACPI_NAMESPACE_NODE     *node,
-	ACPI_HANDLE             region,
-	ACPI_HANDLE             bank_reg,
-	u32                     bank_val,
-	u8                      field_flags,
-	u8                      field_attribute,
-	u32                     field_position,
-	u32                     field_length)
-{
-	ACPI_OPERAND_OBJECT     *obj_desc;
-	u32                     type;
-	ACPI_STATUS             status;
-
-
-	/* Parameter validation */
-
-	if (!region) {
-		return (AE_AML_NO_OPERAND);
-	}
-
-	type = acpi_ns_get_type (region);
-	if (type != ACPI_TYPE_REGION) {
-		return (AE_AML_OPERAND_TYPE);
-	}
-
-	/* Allocate a new object */
-
-	obj_desc = acpi_cm_create_internal_object (INTERNAL_TYPE_BANK_FIELD);
-	if (!obj_desc) {
-		return (AE_NO_MEMORY);
-	}
-
-	/*  Obj_desc and Region valid   */
-
-	/* Initialize areas of the object that are common to all fields */
-
-	status = acpi_aml_prep_common_field_object (obj_desc, field_flags, field_attribute,
-			  field_position, field_length);
-	if (ACPI_FAILURE (status)) {
-		return (status);
-	}
-
-	/* Initialize areas of the object that are specific to this field type */
-
-	obj_desc->bank_field.value      = bank_val;
-	obj_desc->bank_field.container  = acpi_ns_get_attached_object (region);
-	obj_desc->bank_field.bank_select = acpi_ns_get_attached_object (bank_reg);
-
-	/* An additional reference for the container and bank select */
-	/* TBD: [Restructure] is "Bank_select" ever a real internal object?? */
-
-	acpi_cm_add_reference (obj_desc->bank_field.container);
-	acpi_cm_add_reference (obj_desc->bank_field.bank_select);
-
-	/* Debug info */
-
-	/*
-	 * Store the constructed descriptor (Obj_desc) into the Named_obj whose
-	 * handle is on TOS, preserving the current type of that Named_obj.
-	 */
-	status = acpi_ns_attach_object ((ACPI_HANDLE) node, obj_desc,
-			 (u8) acpi_ns_get_type ((ACPI_HANDLE) node));
-
-	return (status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_aml_prep_index_field_value
- *
- * PARAMETERS:  Node            - Owning Node
- *              Index_reg           - Index register
- *              Data_reg            - Data register
- *              Field_flags         - Access, Lock_rule, or Update_rule
- *              Field_position      - Field position
- *              Field_length        - Field length
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Construct an ACPI_OPERAND_OBJECT  of type Index_field and
- *              connect it to the parent Node.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-acpi_aml_prep_index_field_value (
-	ACPI_NAMESPACE_NODE     *node,
-	ACPI_HANDLE             index_reg,
-	ACPI_HANDLE             data_reg,
-	u8                      field_flags,
-	u8                      field_attribute,
-	u32                     field_position,
-	u32                     field_length)
-{
-	ACPI_OPERAND_OBJECT     *obj_desc;
-	ACPI_STATUS             status;
-
-
-	/* Parameter validation */
-
-	if (!index_reg || !data_reg) {
-		return (AE_AML_NO_OPERAND);
-	}
-
-	/* Allocate a new object descriptor */
-
-	obj_desc = acpi_cm_create_internal_object (INTERNAL_TYPE_INDEX_FIELD);
-	if (!obj_desc) {
-		return (AE_NO_MEMORY);
-	}
-
-	/* Initialize areas of the object that are common to all fields */
-
-	status = acpi_aml_prep_common_field_object (obj_desc, field_flags, field_attribute,
-			  field_position, field_length);
-	if (ACPI_FAILURE (status)) {
-		return (status);
-	}
-
-	/* Initialize areas of the object that are specific to this field type */
-
-	obj_desc->index_field.value     = (u32) (field_position /
-			   obj_desc->field.granularity);
-	obj_desc->index_field.index     = index_reg;
-	obj_desc->index_field.data      = data_reg;
-
-	/* Debug info */
-
-	/*
-	 * Store the constructed descriptor (Obj_desc) into the Named_obj whose
-	 * handle is on TOS, preserving the current type of that Named_obj.
-	 */
-	status = acpi_ns_attach_object ((ACPI_HANDLE) node, obj_desc,
-			 (u8) acpi_ns_get_type ((ACPI_HANDLE) node));
-
-	return (status);
-}
-
diff -urN linux-2.4.6-pre4/drivers/acpi/interpreter/amregion.c linux/drivers/acpi/interpreter/amregion.c
--- linux-2.4.6-pre4/drivers/acpi/interpreter/amregion.c	Mon Jan 22 13:23:42 2001
+++ linux/drivers/acpi/interpreter/amregion.c	Wed Dec 31 16:00:00 1969
@@ -1,420 +0,0 @@
-
-/******************************************************************************
- *
- * Module Name: amregion - ACPI default Op_region (address space) handlers
- *              $Revision: 44 $
- *
- *****************************************************************************/
-
-/*
- *  Copyright (C) 2000, 2001 R. Byron Moore
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-
-#include "acpi.h"
-#include "acinterp.h"
-#include "amlcode.h"
-#include "acnamesp.h"
-#include "achware.h"
-#include "acevents.h"
-
-
-#define _COMPONENT          INTERPRETER
-	 MODULE_NAME         ("amregion")
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_aml_system_memory_space_handler
- *
- * PARAMETERS:  Function            - Read or Write operation
- *              Address             - Where in the space to read or write
- *              Bit_width           - Field width in bits (8, 16, or 32)
- *              Value               - Pointer to in or out value
- *              Handler_context     - Pointer to Handler's context
- *              Region_context      - Pointer to context specific to the
- *                                      accessed region
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Handler for the System Memory address space (Op Region)
- *
- ******************************************************************************/
-
-ACPI_STATUS
-acpi_aml_system_memory_space_handler (
-	u32                     function,
-	ACPI_PHYSICAL_ADDRESS   address,
-	u32                     bit_width,
-	u32                     *value,
-	void                    *handler_context,
-	void                    *region_context)
-{
-	ACPI_STATUS             status = AE_OK;
-	void                    *logical_addr_ptr = NULL;
-	MEM_HANDLER_CONTEXT     *mem_info = region_context;
-	u32                     length;
-
-
-	/* Validate and translate the bit width */
-
-	switch (bit_width)
-	{
-	case 8:
-		length = 1;
-		break;
-
-	case 16:
-		length = 2;
-		break;
-
-	case 32:
-		length = 4;
-		break;
-
-	default:
-		return (AE_AML_OPERAND_VALUE);
-		break;
-	}
-
-
-	/*
-	 * Does the request fit into the cached memory mapping?
-	 * Is 1) Address below the current mapping? OR
-	 *    2) Address beyond the current mapping?
-	 */
-
-	if ((address < mem_info->mapped_physical_address) ||
-		(((ACPI_INTEGER) address + length) >
-			((ACPI_INTEGER) mem_info->mapped_physical_address + mem_info->mapped_length)))
-	{
-		/*
-		 * The request cannot be resolved by the current memory mapping;
-		 * Delete the existing mapping and create a new one.
-		 */
-
-		if (mem_info->mapped_length) {
-			/* Valid mapping, delete it */
-
-			acpi_os_unmap_memory (mem_info->mapped_logical_address,
-					   mem_info->mapped_length);
-		}
-
-		mem_info->mapped_length = 0; /* In case of failure below */
-
-		/* Create a new mapping starting at the address given */
-
-		status = acpi_os_map_memory (address, SYSMEM_REGION_WINDOW_SIZE,
-				  (void **) &mem_info->mapped_logical_address);
-		if (ACPI_FAILURE (status)) {
-			return (status);
-		}
-
-		/* TBD: should these pointers go to 64-bit in all cases ? */
-
-		mem_info->mapped_physical_address = address;
-		mem_info->mapped_length = SYSMEM_REGION_WINDOW_SIZE;
-	}
-
-
-	/*
-	 * Generate a logical pointer corresponding to the address we want to
-	 * access
-	 */
-
-	/* TBD: should these pointers go to 64-bit in all cases ? */
-
-	logical_addr_ptr = mem_info->mapped_logical_address +
-			  ((ACPI_INTEGER) address - (ACPI_INTEGER) mem_info->mapped_physical_address);
-
-	/* Perform the memory read or write */
-
-	switch (function)
-	{
-
-	case ADDRESS_SPACE_READ:
-
-		switch (bit_width)
-		{
-		case 8:
-			*value = (u32)* (u8 *) logical_addr_ptr;
-			break;
-
-		case 16:
-			MOVE_UNALIGNED16_TO_32 (value, logical_addr_ptr);
-			break;
-
-		case 32:
-			MOVE_UNALIGNED32_TO_32 (value, logical_addr_ptr);
-			break;
-		}
-
-		break;
-
-
-	case ADDRESS_SPACE_WRITE:
-
-		switch (bit_width)
-		{
-		case 8:
-			*(u8 *) logical_addr_ptr = (u8) *value;
-			break;
-
-		case 16:
-			MOVE_UNALIGNED16_TO_16 (logical_addr_ptr, value);
-			break;
-
-		case 32:
-			MOVE_UNALIGNED32_TO_32 (logical_addr_ptr, value);
-			break;
-		}
-
-		break;
-
-
-	default:
-		status = AE_BAD_PARAMETER;
-		break;
-	}
-
-	return (status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_aml_system_io_space_handler
- *
- * PARAMETERS:  Function            - Read or Write operation
- *              Address             - Where in the space to read or write
- *              Bit_width           - Field width in bits (8, 16, or 32)
- *              Value               - Pointer to in or out value
- *              Handler_context     - Pointer to Handler's context
- *              Region_context      - Pointer to context specific to the
- *                                      accessed region
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Handler for the System IO address space (Op Region)
- *
- ******************************************************************************/
-
-ACPI_STATUS
-acpi_aml_system_io_space_handler (
-	u32                     function,
-	ACPI_PHYSICAL_ADDRESS   address,
-	u32                     bit_width,
-	u32                     *value,
-	void                    *handler_context,
-	void                    *region_context)
-{
-	ACPI_STATUS             status = AE_OK;
-
-
-	/* Decode the function parameter */
-
-	switch (function)
-	{
-
-	case ADDRESS_SPACE_READ:
-
-		switch (bit_width)
-		{
-		/* I/O Port width */
-
-		case 8:
-			*value = (u32) acpi_os_in8 ((ACPI_IO_ADDRESS) address);
-			break;
-
-		case 16:
-			*value = (u32) acpi_os_in16 ((ACPI_IO_ADDRESS) address);
-			break;
-
-		case 32:
-			*value = acpi_os_in32 ((ACPI_IO_ADDRESS) address);
-			break;
-
-		default:
-			status = AE_AML_OPERAND_VALUE;
-		}
-
-		break;
-
-
-	case ADDRESS_SPACE_WRITE:
-
-		switch (bit_width)
-		{
-		/* I/O Port width */
-		case 8:
-			acpi_os_out8 ((ACPI_IO_ADDRESS) address, (u8) *value);
-			break;
-
-		case 16:
-			acpi_os_out16 ((ACPI_IO_ADDRESS) address, (u16) *value);
-			break;
-
-		case 32:
-			acpi_os_out32 ((ACPI_IO_ADDRESS) address, *value);
-			break;
-
-		default:
-			status = AE_AML_OPERAND_VALUE;
-		}
-
-		break;
-
-
-	default:
-		status = AE_BAD_PARAMETER;
-		break;
-	}
-
-	return (status);
-}
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_aml_pci_config_space_handler
- *
- * PARAMETERS:  Function            - Read or Write operation
- *              Address             - Where in the space to read or write
- *              Bit_width           - Field width in bits (8, 16, or 32)
- *              Value               - Pointer to in or out value
- *              Handler_context     - Pointer to Handler's context
- *              Region_context      - Pointer to context specific to the
- *                                      accessed region
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Handler for the PCI Config address space (Op Region)
- *
- ******************************************************************************/
-
-ACPI_STATUS
-acpi_aml_pci_config_space_handler (
-	u32                     function,
-	ACPI_PHYSICAL_ADDRESS   address,
-	u32                     bit_width,
-	u32                     *value,
-	void                    *handler_context,
-	void                    *region_context)
-{
-	ACPI_STATUS             status = AE_OK;
-	u32                     pci_bus;
-	u32                     dev_func;
-	u8                      pci_reg;
-	PCI_HANDLER_CONTEXT    *PCIcontext;
-
-
-	/*
-	 *  The arguments to Acpi_os(Read|Write)Pci_cfg(Byte|Word|Dword) are:
-	 *
-	 *  Seg_bus - 0xSSSSBBBB    - SSSS is the PCI bus segment
-	 *                            BBBB is the PCI bus number
-	 *
-	 *  Dev_func - 0xDDDDFFFF   - DDDD is the PCI device number
-	 *                            FFFF is the PCI device function number
-	 *
-	 *  Reg_num - Config space register must be < 40h
-	 *
-	 *  Value - input value for write, output for read
-	 *
-	 */
-
-	PCIcontext = (PCI_HANDLER_CONTEXT *) region_context;
-
-	pci_bus = LOWORD(PCIcontext->seg) << 16;
-	pci_bus |= LOWORD(PCIcontext->bus);
-
-	dev_func = PCIcontext->dev_func;
-
-	pci_reg = (u8) address;
-
-	switch (function)
-	{
-
-	case ADDRESS_SPACE_READ:
-
-		*value  = 0;
-
-		switch (bit_width)
-		{
-		/* PCI Register width */
-
-		case 8:
-			status = acpi_os_read_pci_cfg_byte (pci_bus, dev_func, pci_reg,
-					   (u8 *) value);
-			break;
-
-		case 16:
-			status = acpi_os_read_pci_cfg_word (pci_bus, dev_func, pci_reg,
-					   (u16 *) value);
-			break;
-
-		case 32:
-			status = acpi_os_read_pci_cfg_dword (pci_bus, dev_func, pci_reg,
-					   value);
-			break;
-
-		default:
-			status = AE_AML_OPERAND_VALUE;
-
-		} /* Switch bit_width */
-
-		break;
-
-
-	case ADDRESS_SPACE_WRITE:
-
-		switch (bit_width)
-		{
-		/* PCI Register width */
-
-		case 8:
-			status = acpi_os_write_pci_cfg_byte (pci_bus, dev_func, pci_reg,
-					 *(u8 *) value);
-			break;
-
-		case 16:
-			status = acpi_os_write_pci_cfg_word (pci_bus, dev_func, pci_reg,
-					 *(u16 *) value);
-			break;
-
-		case 32:
-			status = acpi_os_write_pci_cfg_dword (pci_bus, dev_func, pci_reg,
-					 *value);
-			break;
-
-		default:
-			status = AE_AML_OPERAND_VALUE;
-
-		} /* Switch bit_width */
-
-		break;
-
-
-	default:
-
-		status = AE_BAD_PARAMETER;
-		break;
-
-	}
-
-	return (status);
-}
-
diff -urN linux-2.4.6-pre4/drivers/acpi/interpreter/amresnte.c linux/drivers/acpi/interpreter/amresnte.c
--- linux-2.4.6-pre4/drivers/acpi/interpreter/amresnte.c	Mon Jan 22 13:23:42 2001
+++ linux/drivers/acpi/interpreter/amresnte.c	Wed Dec 31 16:00:00 1969
@@ -1,509 +0,0 @@
-
-/******************************************************************************
- *
- * Module Name: amresnte - AML Interpreter object resolution
- *              $Revision: 27 $
- *
- *****************************************************************************/
-
-/*
- *  Copyright (C) 2000, 2001 R. Byron Moore
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-
-#include "acpi.h"
-#include "amlcode.h"
-#include "acparser.h"
-#include "acdispat.h"
-#include "acinterp.h"
-#include "acnamesp.h"
-#include "actables.h"
-#include "acevents.h"
-
-
-#define _COMPONENT          INTERPRETER
-	 MODULE_NAME         ("amresnte")
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_aml_resolve_node_to_value
- *
- * PARAMETERS:  Stack_ptr       - Pointer to a location on a stack that contains
- *                                a pointer to an Node
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Resolve a ACPI_NAMESPACE_NODE (Node,
- *              A.K.A. a "direct name pointer")
- *
- * Note: for some of the data types, the pointer attached to the Node
- * can be either a pointer to an actual internal object or a pointer into the
- * AML stream itself.  These types are currently:
- *
- *      ACPI_TYPE_INTEGER
- *      ACPI_TYPE_STRING
- *      ACPI_TYPE_BUFFER
- *      ACPI_TYPE_MUTEX
- *      ACPI_TYPE_PACKAGE
- *
- ******************************************************************************/
-
-ACPI_STATUS
-acpi_aml_resolve_node_to_value (
-	ACPI_NAMESPACE_NODE     **stack_ptr,
-	ACPI_WALK_STATE         *walk_state)
-
-{
-	ACPI_STATUS             status = AE_OK;
-	ACPI_OPERAND_OBJECT     *val_desc = NULL;
-	ACPI_OPERAND_OBJECT     *obj_desc = NULL;
-	ACPI_NAMESPACE_NODE     *node;
-	u8                      *aml_pointer = NULL;
-	OBJECT_TYPE_INTERNAL    entry_type;
-	u8                      locked;
-	u8                      attached_aml_pointer = FALSE;
-	u8                      aml_opcode = 0;
-	ACPI_INTEGER            temp_val;
-	OBJECT_TYPE_INTERNAL    object_type;
-
-
-	node = *stack_ptr;
-
-
-	/*
-	 * The stack pointer is a "Direct name ptr", and points to a
-	 * a ACPI_NAMESPACE_NODE (Node).  Get the pointer that is attached to
-	 * the Node.
-	 */
-
-	val_desc    = acpi_ns_get_attached_object ((ACPI_HANDLE) node);
-	entry_type  = acpi_ns_get_type ((ACPI_HANDLE) node);
-
-	/*
-	 * The Val_desc attached to the Node can be either:
-	 * 1) An internal ACPI object
-	 * 2) A pointer into the AML stream (into one of the ACPI system tables)
-	 */
-
-	if (acpi_tb_system_table_pointer (val_desc)) {
-		attached_aml_pointer = TRUE;
-		aml_opcode = *((u8 *) val_desc);
-		aml_pointer = ((u8 *) val_desc) + 1;
-
-	}
-
-
-	/*
-	 * Several Entry_types do not require further processing, so
-	 *  we will return immediately
-	 */
-	/* Devices rarely have an attached object, return the Node
-	 *  and Method locals and arguments have a pseudo-Node
-	 */
-	if (entry_type == ACPI_TYPE_DEVICE ||
-		(node->flags & (ANOBJ_METHOD_ARG | ANOBJ_METHOD_LOCAL)))
-	{
-		return (AE_OK);
-	}
-
-	if (!val_desc) {
-		return (AE_AML_NO_OPERAND);
-	}
-
-	/*
-	 * Action is based on the type of the Node, which indicates the type
-	 * of the attached object or pointer
-	 */
-	switch (entry_type)
-	{
-
-	case ACPI_TYPE_PACKAGE:
-
-		if (attached_aml_pointer) {
-			/*
-			 * This means that the package initialization is not parsed
-			 * -- should not happen
-			 */
-			return (AE_NOT_IMPLEMENTED);
-		}
-
-		/* Val_desc is an internal object in all cases by the time we get here */
-
-		if (ACPI_TYPE_PACKAGE != val_desc->common.type) {
-			return (AE_AML_OPERAND_TYPE);
-		}
-
-		/* Return an additional reference to the object */
-
-		obj_desc = val_desc;
-		acpi_cm_add_reference (obj_desc);
-		break;
-
-
-	case ACPI_TYPE_BUFFER:
-
-		if (attached_aml_pointer) {
-			/*
-			 * This means that the buffer initialization is not parsed
-			 * -- should not happen
-			 */
-			return (AE_NOT_IMPLEMENTED);
-		}
-
-		/* Val_desc is an internal object in all cases by the time we get here */
-
-		if (ACPI_TYPE_BUFFER != val_desc->common.type) {
-			return (AE_AML_OPERAND_TYPE);
-		}
-
-		/* Return an additional reference to the object */
-
-		obj_desc = val_desc;
-		acpi_cm_add_reference (obj_desc);
-		break;
-
-
-	case ACPI_TYPE_STRING:
-
-		if (attached_aml_pointer) {
-			/* Allocate a new string object */
-
-			obj_desc = acpi_cm_create_internal_object (ACPI_TYPE_STRING);
-			if (!obj_desc) {
-				return (AE_NO_MEMORY);
-			}
-
-			/* Init the internal object */
-
-			obj_desc->string.pointer = (NATIVE_CHAR *) aml_pointer;
-			obj_desc->string.length = STRLEN (obj_desc->string.pointer);
-		}
-
-		else {
-			if (ACPI_TYPE_STRING != val_desc->common.type) {
-				return (AE_AML_OPERAND_TYPE);
-			}
-
-			/* Return an additional reference to the object */
-
-			obj_desc = val_desc;
-			acpi_cm_add_reference (obj_desc);
-		}
-
-		break;
-
-
-	case ACPI_TYPE_INTEGER:
-
-		/*
-		 * The Node has an attached internal object, make sure that it's a
-		 * number
-		 */
-
-		if (ACPI_TYPE_INTEGER != val_desc->common.type) {
-			return (AE_AML_OPERAND_TYPE);
-		}
-
-		/* Return an additional reference to the object */
-
-		obj_desc = val_desc;
-		acpi_cm_add_reference (obj_desc);
-		break;
-
-
-	case INTERNAL_TYPE_DEF_FIELD:
-
-		/*
-		 * TBD: [Investigate] Is this the correct solution?
-		 *
-		 * This section was extended to convert to generic buffer if
-		 *  the return length is greater than 32 bits, but still allows
-		 *  for returning a type Number for smaller values because the
-		 *  caller can then apply arithmetic operators on those fields.
-		 *
-		 * XXX - Implementation limitation: Fields are implemented as type
-		 * XXX - Number, but they really are supposed to be type Buffer.
-		 * XXX - The two are interchangeable only for lengths <= 32 bits.
-		 */
-		if(val_desc->field.length > 32) {
-			object_type = ACPI_TYPE_BUFFER;
-		}
-		else {
-			object_type = ACPI_TYPE_INTEGER;
-		}
-
-		/*
-		 * Create the destination buffer object and the buffer space.
-		 */
-		obj_desc = acpi_cm_create_internal_object (object_type);
-		if (!obj_desc) {
-			return (AE_NO_MEMORY);
-		}
-
-		/*
-		 * Fill in the object specific details
-		 */
-		if (ACPI_TYPE_BUFFER == object_type) {
-			obj_desc->buffer.pointer = acpi_cm_callocate (val_desc->field.length);
-			if (!obj_desc->buffer.pointer) {
-				acpi_cm_remove_reference(obj_desc);
-				return (AE_NO_MEMORY);
-			}
-
-			obj_desc->buffer.length = val_desc->field.length;
-
-			status = acpi_aml_access_named_field (ACPI_READ, (ACPI_HANDLE) node,
-					  obj_desc->buffer.pointer, obj_desc->buffer.length);
-
-			if (ACPI_FAILURE (status)) {
-				return (status);
-			}
-		}
-		else {
-			status = acpi_aml_access_named_field (ACPI_READ, (ACPI_HANDLE) node,
-					  &temp_val, sizeof (temp_val));
-
-			if (ACPI_FAILURE (status)) {
-				return (status);
-			}
-
-			obj_desc->integer.value = temp_val;
-		}
-
-
-		break;
-
-
-	case INTERNAL_TYPE_BANK_FIELD:
-
-		if (attached_aml_pointer) {
-			return (AE_AML_OPERAND_TYPE);
-		}
-
-		if (INTERNAL_TYPE_BANK_FIELD != val_desc->common.type) {
-			return (AE_AML_OPERAND_TYPE);
-		}
-
-
-		/* Get the global lock if needed */
-
-		obj_desc = (ACPI_OPERAND_OBJECT *) *stack_ptr;
-		locked = acpi_aml_acquire_global_lock (obj_desc->field_unit.lock_rule);
-
-		/* Set Index value to select proper Data register */
-		/* perform the update */
-
-		status = acpi_aml_access_named_field (ACPI_WRITE,
-				 val_desc->bank_field.bank_select, &val_desc->bank_field.value,
-				 sizeof (val_desc->bank_field.value));
-
-		acpi_aml_release_global_lock (locked);
-
-
-		if (ACPI_FAILURE (status)) {
-			return (status);
-		}
-
-		/* Read Data value */
-
-		status = acpi_aml_access_named_field (ACPI_READ,
-				 (ACPI_HANDLE) val_desc->bank_field.container,
-				 &temp_val, sizeof (temp_val));
-		if (ACPI_FAILURE (status)) {
-			return (status);
-		}
-
-		/* Create an object for the result */
-
-		obj_desc = acpi_cm_create_internal_object (ACPI_TYPE_INTEGER);
-		if (!obj_desc) {
-			return (AE_NO_MEMORY);
-		}
-
-		obj_desc->integer.value = temp_val;
-		break;
-
-
-	case INTERNAL_TYPE_INDEX_FIELD:
-
-		if (attached_aml_pointer) {
-			return (AE_AML_OPERAND_TYPE);
-		}
-
-		if (INTERNAL_TYPE_INDEX_FIELD != val_desc->common.type) {
-			return (AE_AML_OPERAND_TYPE);
-		}
-
-
-		/* Set Index value to select proper Data register */
-		/* Get the global lock if needed */
-
-		obj_desc = (ACPI_OPERAND_OBJECT *) *stack_ptr;
-		locked = acpi_aml_acquire_global_lock (obj_desc->field_unit.lock_rule);
-
-		/* Perform the update */
-
-		status = acpi_aml_access_named_field (ACPI_WRITE,
-				  val_desc->index_field.index, &val_desc->index_field.value,
-				  sizeof (val_desc->index_field.value));
-
-		acpi_aml_release_global_lock (locked);
-
-		if (ACPI_FAILURE (status)) {
-			return (status);
-		}
-
-		/* Read Data value */
-
-		status = acpi_aml_access_named_field (ACPI_READ, val_desc->index_field.data,
-				  &temp_val, sizeof (temp_val));
-		if (ACPI_FAILURE (status)) {
-			return (status);
-		}
-
-		/* Create an object for the result */
-
-		obj_desc = acpi_cm_create_internal_object (ACPI_TYPE_INTEGER);
-		if (!obj_desc) {
-			return (AE_NO_MEMORY);
-		}
-
-		obj_desc->integer.value = temp_val;
-		break;
-
-
-	case ACPI_TYPE_FIELD_UNIT:
-
-		if (attached_aml_pointer) {
-			return (AE_AML_OPERAND_TYPE);
-		}
-
-		if (val_desc->common.type != (u8) entry_type) {
-			return (AE_AML_OPERAND_TYPE);
-			break;
-		}
-
-		/* Create object for result */
-
-		obj_desc = acpi_cm_create_internal_object (ACPI_TYPE_ANY);
-		if (!obj_desc) {
-			return (AE_NO_MEMORY);
-		}
-
-		status = acpi_aml_get_field_unit_value (val_desc, obj_desc);
-		if (ACPI_FAILURE (status)) {
-			acpi_cm_remove_reference (obj_desc);
-			return (status);
-		}
-
-		break;
-
-
-	/*
-	 * For these objects, just return the object attached to the Node
-	 */
-
-	case ACPI_TYPE_MUTEX:
-	case ACPI_TYPE_METHOD:
-	case ACPI_TYPE_POWER:
-	case ACPI_TYPE_PROCESSOR:
-	case ACPI_TYPE_THERMAL:
-	case ACPI_TYPE_EVENT:
-	case ACPI_TYPE_REGION:
-
-
-		/* Return an additional reference to the object */
-
-		obj_desc = val_desc;
-		acpi_cm_add_reference (obj_desc);
-		break;
-
-
-	/* TYPE_Any is untyped, and thus there is no object associated with it */
-
-	case ACPI_TYPE_ANY:
-
-		return (AE_AML_OPERAND_TYPE);  /* Cannot be AE_TYPE */
-		break;
-
-
-	/*
-	 * The only named references allowed are named constants
-	 *
-	 * e.g.     Name (\OSFL, Ones)
-	 */
-	case INTERNAL_TYPE_REFERENCE:
-
-		switch (val_desc->reference.op_code)
-		{
-
-		case AML_ZERO_OP:
-
-			temp_val = 0;
-			break;
-
-
-		case AML_ONE_OP:
-
-			temp_val = 1;
-			break;
-
-
-		case AML_ONES_OP:
-
-			temp_val = ACPI_INTEGER_MAX;
-			break;
-
-
-		default:
-
-			return (AE_AML_BAD_OPCODE);
-		}
-
-		/* Create object for result */
-
-		obj_desc = acpi_cm_create_internal_object (ACPI_TYPE_INTEGER);
-		if (!obj_desc) {
-			return (AE_NO_MEMORY);
-		}
-
-		obj_desc->integer.value = temp_val;
-
-		/* Truncate value if we are executing from a 32-bit ACPI table */
-
-		acpi_aml_truncate_for32bit_table (obj_desc, walk_state);
-		break;
-
-
-	/* Default case is for unknown types */
-
-	default:
-
-		return (AE_AML_OPERAND_TYPE);
-
-	} /* switch (Entry_type) */
-
-
-	/* Put the object descriptor on the stack */
-
-	*stack_ptr = (void *) obj_desc;
-
-	return (status);
-}
-
-
diff -urN linux-2.4.6-pre4/drivers/acpi/interpreter/amresolv.c linux/drivers/acpi/interpreter/amresolv.c
--- linux-2.4.6-pre4/drivers/acpi/interpreter/amresolv.c	Mon Jan 29 10:15:59 2001
+++ linux/drivers/acpi/interpreter/amresolv.c	Wed Dec 31 16:00:00 1969
@@ -1,465 +0,0 @@
-
-/******************************************************************************
- *
- * Module Name: amresolv - AML Interpreter object resolution
- *              $Revision: 81 $
- *
- *****************************************************************************/
-
-/*
- *  Copyright (C) 2000, 2001 R. Byron Moore
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-
-#include "acpi.h"
-#include "amlcode.h"
-#include "acparser.h"
-#include "acdispat.h"
-#include "acinterp.h"
-#include "acnamesp.h"
-#include "actables.h"
-#include "acevents.h"
-
-
-#define _COMPONENT          INTERPRETER
-	 MODULE_NAME         ("amresolv")
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_aml_get_field_unit_value
- *
- * PARAMETERS:  *Field_desc         - Pointer to a Field_unit
- *              *Result_desc        - Pointer to an empty descriptor
- *                                    which will become a Number
- *                                    containing the field's value.
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Retrieve the value from a Field_unit
- *
- ******************************************************************************/
-
-ACPI_STATUS
-acpi_aml_get_field_unit_value (
-	ACPI_OPERAND_OBJECT     *field_desc,
-	ACPI_OPERAND_OBJECT     *result_desc)
-{
-	ACPI_STATUS             status = AE_OK;
-	u32                     mask;
-	u8                      *location = NULL;
-	u8                      locked = FALSE;
-
-
-	if (!field_desc) {
-		status = AE_AML_NO_OPERAND;
-	}
-
-	if (!(field_desc->common.flags & AOPOBJ_DATA_VALID)) {
-		status = acpi_ds_get_field_unit_arguments (field_desc);
-		if (ACPI_FAILURE (status)) {
-			return (status);
-		}
-	}
-
-	if (!field_desc->field_unit.container) {
-		status = AE_AML_INTERNAL;
-	}
-
-	else if (ACPI_TYPE_BUFFER != field_desc->field_unit.container->common.type) {
-		status = AE_AML_OPERAND_TYPE;
-	}
-
-	else if (!result_desc) {
-		status = AE_AML_INTERNAL;
-	}
-
-	if (ACPI_FAILURE (status)) {
-		return (status);
-	}
-
-
-		/* Get the global lock if needed */
-
-	locked = acpi_aml_acquire_global_lock (field_desc->field_unit.lock_rule);
-
-	/* Field location is (base of buffer) + (byte offset) */
-
-	location = field_desc->field_unit.container->buffer.pointer
-			 + field_desc->field_unit.offset;
-
-	/*
-	 * Construct Mask with as many 1 bits as the field width
-	 *
-	 * NOTE: Only the bottom 5 bits are valid for a shift operation, so
-	 *  special care must be taken for any shift greater than 31 bits.
-	 *
-	 * TBD: [Unhandled] Fields greater than 32-bits will not work.
-	 */
-
-	if (field_desc->field_unit.length < 32) {
-		mask = ((u32) 1 << field_desc->field_unit.length) - (u32) 1;
-	}
-	else {
-		mask = ACPI_UINT32_MAX;
-	}
-
-	result_desc->integer.type = (u8) ACPI_TYPE_INTEGER;
-
-	/* Get the 32 bit value at the location */
-
-	MOVE_UNALIGNED32_TO_32 (&result_desc->integer.value, location);
-
-	/*
-	 * Shift the 32-bit word containing the field, and mask off the
-	 * resulting value
-	 */
-
-	result_desc->integer.value =
-		(result_desc->integer.value >> field_desc->field_unit.bit_offset) & mask;
-
-	/* Release global lock if we acquired it earlier */
-
-	acpi_aml_release_global_lock (locked);
-
-	return (status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_aml_resolve_to_value
- *
- * PARAMETERS:  **Stack_ptr         - Points to entry on Obj_stack, which can
- *                                    be either an (ACPI_OPERAND_OBJECT  *)
- *                                    or an ACPI_HANDLE.
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Convert Reference objects to values
- *
- ******************************************************************************/
-
-ACPI_STATUS
-acpi_aml_resolve_to_value (
-	ACPI_OPERAND_OBJECT     **stack_ptr,
-	ACPI_WALK_STATE         *walk_state)
-{
-	ACPI_STATUS             status = AE_OK;
-
-
-	if (!stack_ptr || !*stack_ptr) {
-		return (AE_AML_NO_OPERAND);
-	}
-
-
-	/*
-	 * The entity pointed to by the Stack_ptr can be either
-	 * 1) A valid ACPI_OPERAND_OBJECT, or
-	 * 2) A ACPI_NAMESPACE_NODE (Named_obj)
-	 */
-
-	if (VALID_DESCRIPTOR_TYPE (*stack_ptr, ACPI_DESC_TYPE_INTERNAL)) {
-
-		status = acpi_aml_resolve_object_to_value (stack_ptr, walk_state);
-		if (ACPI_FAILURE (status)) {
-			return (status);
-		}
-	}
-
-	/*
-	 * Object on the stack may have changed if Acpi_aml_resolve_object_to_value()
-	 * was called (i.e., we can't use an _else_ here.)
-	 */
-
-	if (VALID_DESCRIPTOR_TYPE (*stack_ptr, ACPI_DESC_TYPE_NAMED)) {
-		status = acpi_aml_resolve_node_to_value ((ACPI_NAMESPACE_NODE **) stack_ptr, walk_state);
-	}
-
-
-	return (status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_aml_resolve_object_to_value
- *
- * PARAMETERS:  Stack_ptr       - Pointer to a stack location that contains a
- *                                ptr to an internal object.
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Retrieve the value from an internal object.  The Reference type
- *              uses the associated AML opcode to determine the value.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-acpi_aml_resolve_object_to_value (
-	ACPI_OPERAND_OBJECT     **stack_ptr,
-	ACPI_WALK_STATE         *walk_state)
-{
-	ACPI_OPERAND_OBJECT     *stack_desc;
-	ACPI_STATUS             status = AE_OK;
-	ACPI_HANDLE             temp_handle = NULL;
-	ACPI_OPERAND_OBJECT     *obj_desc = NULL;
-	u32                     index = 0;
-	u16                     opcode;
-
-
-	stack_desc = *stack_ptr;
-
-	/* This is an ACPI_OPERAND_OBJECT  */
-
-	switch (stack_desc->common.type)
-	{
-
-	case INTERNAL_TYPE_REFERENCE:
-
-		opcode = stack_desc->reference.op_code;
-
-		switch (opcode)
-		{
-
-		case AML_NAME_OP:
-
-			/*
-			 * Convert indirect name ptr to a direct name ptr.
-			 * Then, Acpi_aml_resolve_node_to_value can be used to get the value
-			 */
-
-			temp_handle = stack_desc->reference.object;
-
-			/* Delete the Reference Object */
-
-			acpi_cm_remove_reference (stack_desc);
-
-			/* Put direct name pointer onto stack and exit */
-
-			(*stack_ptr) = temp_handle;
-			status = AE_OK;
-			break;
-
-
-		case AML_LOCAL_OP:
-
-			index = stack_desc->reference.offset;
-
-			/*
-			 * Get the local from the method's state info
-			 * Note: this increments the local's object reference count
-			 */
-
-			status = acpi_ds_method_data_get_value (MTH_TYPE_LOCAL, index,
-					 walk_state, &obj_desc);
-			if (ACPI_FAILURE (status)) {
-				return (status);
-			}
-
-			/*
-			 * Now we can delete the original Reference Object and
-			 * replace it with the resolve value
-			 */
-
-			acpi_cm_remove_reference (stack_desc);
-			*stack_ptr = obj_desc;
-
-			if (ACPI_TYPE_INTEGER == obj_desc->common.type) {
-				/* Value is a Number */
-
-			}
-
-			break;
-
-
-		case AML_ARG_OP:
-
-			index = stack_desc->reference.offset;
-
-
-			/*
-			 * Get the argument from the method's state info
-			 * Note: this increments the object reference count
-			 */
-
-			status = acpi_ds_method_data_get_value (MTH_TYPE_ARG, index,
-					 walk_state, &obj_desc);
-			if (ACPI_FAILURE (status)) {
-				return (status);
-			}
-
-			/*
-			 * Now we can delete the original Reference Object and
-			 * replace it with the resolve value
-			 */
-
-			acpi_cm_remove_reference (stack_desc);
-			*stack_ptr = obj_desc;
-
-			if (ACPI_TYPE_INTEGER == obj_desc->common.type) {
-				/* Value is a Number */
-
-			}
-
-			break;
-
-
-		/*
-		 * TBD: [Restructure] These next three opcodes change the type of
-		 * the object, which is actually a no-no.
-		 */
-
-		case AML_ZERO_OP:
-
-			stack_desc->common.type = (u8) ACPI_TYPE_INTEGER;
-			stack_desc->integer.value = 0;
-			break;
-
-
-		case AML_ONE_OP:
-
-			stack_desc->common.type = (u8) ACPI_TYPE_INTEGER;
-			stack_desc->integer.value = 1;
-			break;
-
-
-		case AML_ONES_OP:
-
-			stack_desc->common.type = (u8) ACPI_TYPE_INTEGER;
-			stack_desc->integer.value = ACPI_INTEGER_MAX;
-
-			/* Truncate value if we are executing from a 32-bit ACPI table */
-
-			acpi_aml_truncate_for32bit_table (stack_desc, walk_state);
-			break;
-
-
-		case AML_INDEX_OP:
-
-			switch (stack_desc->reference.target_type)
-			{
-			case ACPI_TYPE_BUFFER_FIELD:
-
-				/* Just return - leave the Reference on the stack */
-				break;
-
-
-			case ACPI_TYPE_PACKAGE:
-				obj_desc = *stack_desc->reference.where;
-				if (obj_desc) {
-					/*
-					 * Valid obj descriptor, copy pointer to return value
-					 * (i.e., dereference the package index)
-					 * Delete the ref object, increment the returned object
-					 */
-					acpi_cm_remove_reference (stack_desc);
-					acpi_cm_add_reference (obj_desc);
-					*stack_ptr = obj_desc;
-				}
-
-				else {
-					/*
-					 * A NULL object descriptor means an unitialized element of
-					 * the package, can't deref it
-					 */
-
-					status = AE_AML_UNINITIALIZED_ELEMENT;
-				}
-				break;
-
-			default:
-				/* Invalid reference OBJ*/
-
-				status = AE_AML_INTERNAL;
-				break;
-			}
-
-			break;
-
-
-		case AML_DEBUG_OP:
-
-			/* Just leave the object as-is */
-			break;
-
-
-		default:
-
-			status = AE_AML_INTERNAL;
-
-		}   /* switch (Opcode) */
-
-
-		if (ACPI_FAILURE (status)) {
-			return (status);
-		}
-
-		break; /* case INTERNAL_TYPE_REFERENCE */
-
-
-	case ACPI_TYPE_FIELD_UNIT:
-
-		obj_desc = acpi_cm_create_internal_object (ACPI_TYPE_ANY);
-		if (!obj_desc) {
-			/* Descriptor allocation failure  */
-
-			return (AE_NO_MEMORY);
-		}
-
-		status = acpi_aml_get_field_unit_value (stack_desc, obj_desc);
-		if (ACPI_FAILURE (status)) {
-			acpi_cm_remove_reference (obj_desc);
-			obj_desc = NULL;
-		}
-
-		*stack_ptr = (void *) obj_desc;
-		break;
-
-
-	case INTERNAL_TYPE_BANK_FIELD:
-
-		obj_desc = acpi_cm_create_internal_object (ACPI_TYPE_ANY);
-		if (!obj_desc) {
-			/* Descriptor allocation failure */
-
-			return (AE_NO_MEMORY);
-		}
-
-		status = acpi_aml_get_field_unit_value (stack_desc, obj_desc);
-		if (ACPI_FAILURE (status)) {
-			acpi_cm_remove_reference (obj_desc);
-			obj_desc = NULL;
-		}
-
-		*stack_ptr = (void *) obj_desc;
-		break;
-
-
-	/* TBD: [Future] - may need to handle Index_field, and Def_field someday */
-
-	default:
-
-		break;
-
-	}   /* switch (Stack_desc->Common.Type) */
-
-
-	return (status);
-}
-
-
diff -urN linux-2.4.6-pre4/drivers/acpi/interpreter/amresop.c linux/drivers/acpi/interpreter/amresop.c
--- linux-2.4.6-pre4/drivers/acpi/interpreter/amresop.c	Mon Jan 22 13:23:42 2001
+++ linux/drivers/acpi/interpreter/amresop.c	Wed Dec 31 16:00:00 1969
@@ -1,488 +0,0 @@
-
-/******************************************************************************
- *
- * Module Name: amresop - AML Interpreter operand/object resolution
- *              $Revision: 22 $
- *
- *****************************************************************************/
-
-/*
- *  Copyright (C) 2000, 2001 R. Byron Moore
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-
-#include "acpi.h"
-#include "amlcode.h"
-#include "acparser.h"
-#include "acdispat.h"
-#include "acinterp.h"
-#include "acnamesp.h"
-#include "actables.h"
-#include "acevents.h"
-
-
-#define _COMPONENT          INTERPRETER
-	 MODULE_NAME         ("amresop")
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_aml_check_object_type
- *
- * PARAMETERS:  Type_needed         Object type needed
- *              This_type           Actual object type
- *              Object              Object pointer
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Check required type against actual type
- *
- ******************************************************************************/
-
-ACPI_STATUS
-acpi_aml_check_object_type (
-	ACPI_OBJECT_TYPE        type_needed,
-	ACPI_OBJECT_TYPE        this_type,
-	void                    *object)
-{
-
-
-	if (type_needed == ACPI_TYPE_ANY) {
-		/* All types OK, so we don't perform any typechecks */
-
-		return (AE_OK);
-	}
-
-
-	if (type_needed != this_type) {
-		return (AE_AML_OPERAND_TYPE);
-	}
-
-
-	return (AE_OK);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_aml_resolve_operands
- *
- * PARAMETERS:  Opcode              Opcode being interpreted
- *              Stack_ptr           Top of operand stack
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Convert stack entries to required types
- *
- *      Each nibble in Arg_types represents one required operand
- *      and indicates the required Type:
- *
- *      The corresponding stack entry will be converted to the
- *      required type if possible, else return an exception
- *
- ******************************************************************************/
-
-ACPI_STATUS
-acpi_aml_resolve_operands (
-	u16                     opcode,
-	ACPI_OPERAND_OBJECT     **stack_ptr,
-	ACPI_WALK_STATE         *walk_state)
-{
-	ACPI_OPERAND_OBJECT     *obj_desc;
-	ACPI_STATUS             status = AE_OK;
-	u8                      object_type;
-	ACPI_HANDLE             temp_handle;
-	u32                     arg_types;
-	ACPI_OPCODE_INFO        *op_info;
-	u32                     this_arg_type;
-	ACPI_OBJECT_TYPE        type_needed;
-
-
-	op_info = acpi_ps_get_opcode_info (opcode);
-	if (ACPI_GET_OP_TYPE (op_info) != ACPI_OP_TYPE_OPCODE) {
-		return (AE_AML_BAD_OPCODE);
-	}
-
-
-	arg_types = op_info->runtime_args;
-	if (arg_types == ARGI_INVALID_OPCODE) {
-		return (AE_AML_INTERNAL);
-	}
-
-
-   /*
-	 * Normal exit is with *Types == '\0' at end of string.
-	 * Function will return an exception from within the loop upon
-	 * finding an entry which is not, and cannot be converted
-	 * to, the required type; if stack underflows; or upon
-	 * finding a NULL stack entry (which "should never happen").
-	 */
-
-	while (GET_CURRENT_ARG_TYPE (arg_types)) {
-		if (!stack_ptr || !*stack_ptr) {
-			return (AE_AML_INTERNAL);
-		}
-
-		/* Extract useful items */
-
-		obj_desc = *stack_ptr;
-
-		/* Decode the descriptor type */
-
-		if (VALID_DESCRIPTOR_TYPE (obj_desc, ACPI_DESC_TYPE_NAMED)) {
-			/* Node */
-
-			object_type = ((ACPI_NAMESPACE_NODE *) obj_desc)->type;
-		}
-
-		else if (VALID_DESCRIPTOR_TYPE (obj_desc, ACPI_DESC_TYPE_INTERNAL)) {
-			/* ACPI internal object */
-
-			object_type = obj_desc->common.type;
-
-			/* Check for bad ACPI_OBJECT_TYPE */
-
-			if (!acpi_aml_validate_object_type (object_type)) {
-				return (AE_AML_OPERAND_TYPE);
-			}
-
-			if (object_type == (u8) INTERNAL_TYPE_REFERENCE) {
-				/*
-				 * Decode the Reference
-				 */
-
-				op_info = acpi_ps_get_opcode_info (opcode);
-				if (ACPI_GET_OP_TYPE (op_info) != ACPI_OP_TYPE_OPCODE) {
-					return (AE_AML_BAD_OPCODE);
-				}
-
-
-				switch (obj_desc->reference.op_code)
-				{
-				case AML_ZERO_OP:
-				case AML_ONE_OP:
-				case AML_ONES_OP:
-				case AML_DEBUG_OP:
-				case AML_NAME_OP:
-				case AML_INDEX_OP:
-				case AML_ARG_OP:
-				case AML_LOCAL_OP:
-
-					break;
-
-				default:
-					return (AE_AML_OPERAND_TYPE);
-					break;
-				}
-			}
-		}
-
-		else {
-			/* Invalid descriptor */
-
-			return (AE_AML_OPERAND_TYPE);
-		}
-
-
-		/*
-		 * Get one argument type, point to the next
-		 */
-
-		this_arg_type = GET_CURRENT_ARG_TYPE (arg_types);
-		INCREMENT_ARG_LIST (arg_types);
-
-
-		/*
-		 * Handle cases where the object does not need to be
-		 * resolved to a value
-		 */
-
-		switch (this_arg_type)
-		{
-
-		case ARGI_REFERENCE:            /* References */
-		case ARGI_INTEGER_REF:
-		case ARGI_OBJECT_REF:
-		case ARGI_DEVICE_REF:
-		case ARGI_TARGETREF:            /* TBD: must implement implicit conversion rules before store */
-		case ARGI_FIXED_TARGET:         /* No implicit conversion before store to target */
-		case ARGI_SIMPLE_TARGET:        /* Name, Local, or Arg - no implicit conversion */
-
-			/* Need an operand of type INTERNAL_TYPE_REFERENCE */
-
-			if (VALID_DESCRIPTOR_TYPE (obj_desc, ACPI_DESC_TYPE_NAMED))            /* direct name ptr OK as-is */ {
-				goto next_operand;
-			}
-
-			status = acpi_aml_check_object_type (INTERNAL_TYPE_REFERENCE,
-					  object_type, obj_desc);
-			if (ACPI_FAILURE (status)) {
-				return (status);
-			}
-
-
-			if (AML_NAME_OP == obj_desc->reference.op_code) {
-				/*
-				 * Convert an indirect name ptr to direct name ptr and put
-				 * it on the stack
-				 */
-
-				temp_handle = obj_desc->reference.object;
-				acpi_cm_remove_reference (obj_desc);
-				(*stack_ptr) = temp_handle;
-			}
-
-			goto next_operand;
-			break;
-
-
-		case ARGI_ANYTYPE:
-
-			/*
-			 * We don't want to resolve Index_op reference objects during
-			 * a store because this would be an implicit De_ref_of operation.
-			 * Instead, we just want to store the reference object.
-			 * -- All others must be resolved below.
-			 */
-
-			if ((opcode == AML_STORE_OP) &&
-				((*stack_ptr)->common.type == INTERNAL_TYPE_REFERENCE) &&
-				((*stack_ptr)->reference.op_code == AML_INDEX_OP))
-			{
-				goto next_operand;
-			}
-			break;
-		}
-
-
-		/*
-		 * Resolve this object to a value
-		 */
-
-		status = acpi_aml_resolve_to_value (stack_ptr, walk_state);
-		if (ACPI_FAILURE (status)) {
-			return (status);
-		}
-
-
-		/*
-		 * Check the resulting object (value) type
-		 */
-		switch (this_arg_type)
-		{
-		/*
-		 * For the simple cases, only one type of resolved object
-		 * is allowed
-		 */
-		case ARGI_MUTEX:
-
-			/* Need an operand of type ACPI_TYPE_MUTEX */
-
-			type_needed = ACPI_TYPE_MUTEX;
-			break;
-
-		case ARGI_EVENT:
-
-			/* Need an operand of type ACPI_TYPE_EVENT */
-
-			type_needed = ACPI_TYPE_EVENT;
-			break;
-
-		case ARGI_REGION:
-
-			/* Need an operand of type ACPI_TYPE_REGION */
-
-			type_needed = ACPI_TYPE_REGION;
-			break;
-
-		case ARGI_IF:   /* If */
-
-			/* Need an operand of type INTERNAL_TYPE_IF */
-
-			type_needed = INTERNAL_TYPE_IF;
-			break;
-
-		case ARGI_PACKAGE:   /* Package */
-
-			/* Need an operand of type ACPI_TYPE_PACKAGE */
-
-			type_needed = ACPI_TYPE_PACKAGE;
-			break;
-
-		case ARGI_ANYTYPE:
-
-			/* Any operand type will do */
-
-			type_needed = ACPI_TYPE_ANY;
-			break;
-
-
-		/*
-		 * The more complex cases allow multiple resolved object types
-		 */
-
-		case ARGI_INTEGER:   /* Number */
-
-			/*
-			 * Need an operand of type ACPI_TYPE_INTEGER,
-			 * But we can implicitly convert from a STRING or BUFFER
-			 */
-			status = acpi_aml_convert_to_integer (stack_ptr, walk_state);
-			if (ACPI_FAILURE (status)) {
-				if (status == AE_TYPE) {
-					return (AE_AML_OPERAND_TYPE);
-				}
-
-				return (status);
-			}
-
-			goto next_operand;
-			break;
-
-
-		case ARGI_BUFFER:
-
-			/*
-			 * Need an operand of type ACPI_TYPE_BUFFER,
-			 * But we can implicitly convert from a STRING or INTEGER
-			 */
-			status = acpi_aml_convert_to_buffer (stack_ptr, walk_state);
-			if (ACPI_FAILURE (status)) {
-				if (status == AE_TYPE) {
-					return (AE_AML_OPERAND_TYPE);
-				}
-
-				return (status);
-			}
-
-			goto next_operand;
-			break;
-
-
-		case ARGI_STRING:
-
-			/*
-			 * Need an operand of type ACPI_TYPE_STRING,
-			 * But we can implicitly convert from a BUFFER or INTEGER
-			 */
-			status = acpi_aml_convert_to_string (stack_ptr, walk_state);
-			if (ACPI_FAILURE (status)) {
-				if (status == AE_TYPE) {
-					return (AE_AML_OPERAND_TYPE);
-				}
-
-				return (status);
-			}
-
-			goto next_operand;
-			break;
-
-
-		case ARGI_COMPUTEDATA:
-
-			/* Need an operand of type INTEGER, STRING or BUFFER */
-
-			if ((ACPI_TYPE_INTEGER != (*stack_ptr)->common.type) &&
-				(ACPI_TYPE_STRING != (*stack_ptr)->common.type) &&
-				(ACPI_TYPE_BUFFER != (*stack_ptr)->common.type))
-			{
-				return (AE_AML_OPERAND_TYPE);
-			}
-			goto next_operand;
-			break;
-
-
-		case ARGI_DATAOBJECT:
-			/*
-			 * ARGI_DATAOBJECT is only used by the Size_of operator.
-			 *
-			 * The ACPI specification allows Size_of to return the size of
-			 *  a Buffer, String or Package.  However, the MS ACPI.SYS AML
-			 *  Interpreter also allows an Node reference to return without
-			 *  error with a size of 4.
-			 */
-
-			/* Need a buffer, string, package or Node reference */
-
-			if (((*stack_ptr)->common.type != ACPI_TYPE_BUFFER) &&
-				((*stack_ptr)->common.type != ACPI_TYPE_STRING) &&
-				((*stack_ptr)->common.type != ACPI_TYPE_PACKAGE) &&
-				((*stack_ptr)->common.type != INTERNAL_TYPE_REFERENCE))
-			{
-				return (AE_AML_OPERAND_TYPE);
-			}
-
-			/*
-			 * If this is a reference, only allow a reference to an Node.
-			 */
-			if ((*stack_ptr)->common.type == INTERNAL_TYPE_REFERENCE) {
-				if (!(*stack_ptr)->reference.node) {
-					return (AE_AML_OPERAND_TYPE);
-				}
-			}
-			goto next_operand;
-			break;
-
-
-		case ARGI_COMPLEXOBJ:
-
-			/* Need a buffer or package */
-
-			if (((*stack_ptr)->common.type != ACPI_TYPE_BUFFER) &&
-				((*stack_ptr)->common.type != ACPI_TYPE_PACKAGE))
-			{
-				return (AE_AML_OPERAND_TYPE);
-			}
-			goto next_operand;
-			break;
-
-
-		default:
-
-			/* Unknown type */
-
-			return (AE_BAD_PARAMETER);
-		}
-
-
-		/*
-		 * Make sure that the original object was resolved to the
-		 * required object type (Simple cases only).
-		 */
-		status = acpi_aml_check_object_type (type_needed,
-				  (*stack_ptr)->common.type, *stack_ptr);
-		if (ACPI_FAILURE (status)) {
-			return (status);
-		}
-
-
-next_operand:
-		/*
-		 * If more operands needed, decrement Stack_ptr to point
-		 * to next operand on stack
-		 */
-		if (GET_CURRENT_ARG_TYPE (arg_types)) {
-			stack_ptr--;
-		}
-
-	}   /* while (*Types) */
-
-
-	return (status);
-}
-
-
diff -urN linux-2.4.6-pre4/drivers/acpi/interpreter/amstore.c linux/drivers/acpi/interpreter/amstore.c
--- linux-2.4.6-pre4/drivers/acpi/interpreter/amstore.c	Tue Mar  6 19:44:36 2001
+++ linux/drivers/acpi/interpreter/amstore.c	Wed Dec 31 16:00:00 1969
@@ -1,578 +0,0 @@
-
-/******************************************************************************
- *
- * Module Name: amstore - AML Interpreter object store support
- *              $Revision: 123 $
- *
- *****************************************************************************/
-
-/*
- *  Copyright (C) 2000, 2001 R. Byron Moore
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-
-#include "acpi.h"
-#include "acparser.h"
-#include "acdispat.h"
-#include "acinterp.h"
-#include "amlcode.h"
-#include "acnamesp.h"
-#include "actables.h"
-
-
-#define _COMPONENT          INTERPRETER
-	 MODULE_NAME         ("amstore")
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_aml_exec_store
- *
- * PARAMETERS:  *Val_desc           - Value to be stored
- *              *Dest_desc          - Where to store it 0 Must be (ACPI_HANDLE)
- *                                    or an ACPI_OPERAND_OBJECT  of type
- *                                    Reference; if the latter the descriptor
- *                                    will be either reused or deleted.
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Store the value described by Val_desc into the location
- *              described by Dest_desc. Called by various interpreter
- *              functions to store the result of an operation into
- *              the destination operand.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-acpi_aml_exec_store (
-	ACPI_OPERAND_OBJECT     *val_desc,
-	ACPI_OPERAND_OBJECT     *dest_desc,
-	ACPI_WALK_STATE         *walk_state)
-{
-	ACPI_STATUS             status = AE_OK;
-	ACPI_OPERAND_OBJECT     *ref_desc = dest_desc;
-
-
-	/* Validate parameters */
-
-	if (!val_desc || !dest_desc) {
-		return (AE_AML_NO_OPERAND);
-	}
-
-	/* Dest_desc can be either a namespace node or an ACPI object */
-
-	if (VALID_DESCRIPTOR_TYPE (dest_desc, ACPI_DESC_TYPE_NAMED)) {
-		/*
-		 * Dest is a namespace node,
-		 * Storing an object into a Name "container"
-		 */
-		status = acpi_aml_store_object_to_node (val_desc,
-				 (ACPI_NAMESPACE_NODE *) dest_desc, walk_state);
-
-		/* All done, that's it */
-
-		return (status);
-	}
-
-
-	/* Destination object must be an object of type Reference */
-
-	if (dest_desc->common.type != INTERNAL_TYPE_REFERENCE) {
-		/* Destination is not an Reference */
-
-		return (AE_AML_OPERAND_TYPE);
-	}
-
-
-	/*
-	 * Examine the Reference opcode.  These cases are handled:
-	 *
-	 * 1) Store to Name (Change the object associated with a name)
-	 * 2) Store to an indexed area of a Buffer or Package
-	 * 3) Store to a Method Local or Arg
-	 * 4) Store to the debug object
-	 * 5) Store to a constant -- a noop
-	 */
-
-	switch (ref_desc->reference.op_code)
-	{
-
-	case AML_NAME_OP:
-
-		/* Storing an object into a Name "container" */
-
-		status = acpi_aml_store_object_to_node (val_desc, ref_desc->reference.object,
-				  walk_state);
-		break;
-
-
-	case AML_INDEX_OP:
-
-		/* Storing to an Index (pointer into a packager or buffer) */
-
-		status = acpi_aml_store_object_to_index (val_desc, ref_desc, walk_state);
-		break;
-
-
-	case AML_LOCAL_OP:
-
-		status = acpi_ds_method_data_set_value (MTH_TYPE_LOCAL,
-				  (ref_desc->reference.offset), val_desc, walk_state);
-		break;
-
-
-	case AML_ARG_OP:
-
-		status = acpi_ds_method_data_set_value (MTH_TYPE_ARG,
-				  (ref_desc->reference.offset), val_desc, walk_state);
-		break;
-
-
-	case AML_DEBUG_OP:
-
-		/*
-		 * Storing to the Debug object causes the value stored to be
-		 * displayed and otherwise has no effect -- see ACPI Specification
-		 *
-		 * TBD: print known object types "prettier".
-		 */
-
-		break;
-
-
-	case AML_ZERO_OP:
-	case AML_ONE_OP:
-	case AML_ONES_OP:
-
-		/*
-		 * Storing to a constant is a no-op -- see ACPI Specification
-		 * Delete the reference descriptor, however
-		 */
-		break;
-
-
-	default:
-
-		/* TBD: [Restructure] use object dump routine !! */
-
-		status = AE_AML_INTERNAL;
-		break;
-
-	}   /* switch (Ref_desc->Reference.Op_code) */
-
-
-	/* Always delete the reference descriptor object */
-
-	if (ref_desc) {
-		acpi_cm_remove_reference (ref_desc);
-	}
-
-	return (status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_aml_store_object_to_index
- *
- * PARAMETERS:  *Val_desc           - Value to be stored
- *              *Node           - Named object to receive the value
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Store the object to the named object.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-acpi_aml_store_object_to_index (
-	ACPI_OPERAND_OBJECT     *val_desc,
-	ACPI_OPERAND_OBJECT     *dest_desc,
-	ACPI_WALK_STATE         *walk_state)
-{
-	ACPI_STATUS             status = AE_OK;
-	ACPI_OPERAND_OBJECT     *obj_desc;
-	u32                     length;
-	u32                     i;
-	u8                      value = 0;
-
-
-	/*
-	 * Destination must be a reference pointer, and
-	 * must point to either a buffer or a package
-	 */
-
-	switch (dest_desc->reference.target_type)
-	{
-	case ACPI_TYPE_PACKAGE:
-		/*
-		 * Storing to a package element is not simple.  The source must be
-		 * evaluated and converted to the type of the destination and then the
-		 * source is copied into the destination - we can't just point to the
-		 * source object.
-		 */
-		if (dest_desc->reference.target_type == ACPI_TYPE_PACKAGE) {
-			/*
-			 * The object at *(Dest_desc->Reference.Where) is the
-			 *  element within the package that is to be modified.
-			 */
-			obj_desc = *(dest_desc->reference.where);
-			if (obj_desc) {
-				/*
-				 * If the Destination element is a package, we will delete
-				 *  that object and construct a new one.
-				 *
-				 * TBD: [Investigate] Should both the src and dest be required
-				 *      to be packages?
-				 *       && (Val_desc->Common.Type == ACPI_TYPE_PACKAGE)
-				 */
-				if (obj_desc->common.type == ACPI_TYPE_PACKAGE) {
-					/*
-					 * Take away the reference for being part of a package and
-					 * delete
-					 */
-					acpi_cm_remove_reference (obj_desc);
-					acpi_cm_remove_reference (obj_desc);
-
-					obj_desc = NULL;
-				}
-			}
-
-			if (!obj_desc) {
-				/*
-				 * If the Obj_desc is NULL, it means that an uninitialized package
-				 * element has been used as a destination (this is OK), therefore,
-				 * we must create the destination element to match the type of the
-				 * source element NOTE: Val_desc can be of any type.
-				 */
-				obj_desc = acpi_cm_create_internal_object (val_desc->common.type);
-				if (!obj_desc) {
-					return (AE_NO_MEMORY);
-				}
-
-				/*
-				 * If the source is a package, copy the source to the new dest
-				 */
-				if (ACPI_TYPE_PACKAGE == obj_desc->common.type) {
-					status = acpi_cm_copy_ipackage_to_ipackage (val_desc, obj_desc, walk_state);
-					if (ACPI_FAILURE (status)) {
-						acpi_cm_remove_reference (obj_desc);
-						return (status);
-					}
-				}
-
-				/*
-				 * Install the new descriptor into the package and add a
-				 * reference to the newly created descriptor for now being
-				 * part of the parent package
-				 */
-
-				*(dest_desc->reference.where) = obj_desc;
-				acpi_cm_add_reference (obj_desc);
-			}
-
-			if (ACPI_TYPE_PACKAGE != obj_desc->common.type) {
-				/*
-				 * The destination element is not a package, so we need to
-				 * convert the contents of the source (Val_desc) and copy into
-				 * the destination (Obj_desc)
-				 */
-				status = acpi_aml_store_object_to_object (val_desc, obj_desc,
-						  walk_state);
-				if (ACPI_FAILURE (status)) {
-					/*
-					 * An error occurrered when copying the internal object
-					 * so delete the reference.
-					 */
-					return (AE_AML_OPERAND_TYPE);
-				}
-			}
-		}
-		break;
-
-
-	case ACPI_TYPE_BUFFER_FIELD:
-		/*
-		 * Storing into a buffer at a location defined by an Index.
-		 *
-		 * Each 8-bit element of the source object is written to the
-		 * 8-bit Buffer Field of the Index destination object.
-		 */
-
-		/*
-		 * Set the Obj_desc to the destination object and type check.
-		 */
-		obj_desc = dest_desc->reference.object;
-		if (obj_desc->common.type != ACPI_TYPE_BUFFER) {
-			return (AE_AML_OPERAND_TYPE);
-		}
-
-		/*
-		 * The assignment of the individual elements will be slightly
-		 * different for each source type.
-		 */
-
-		switch (val_desc->common.type)
-		{
-		/*
-		 * If the type is Integer, assign bytewise
-		 * This loop to assign each of the elements is somewhat
-		 * backward because of the Big Endian-ness of IA-64
-		 */
-		case ACPI_TYPE_INTEGER:
-			length = sizeof (ACPI_INTEGER);
-			for (i = length; i != 0; i--) {
-				value = (u8)(val_desc->integer.value >> (MUL_8 (i - 1)));
-				obj_desc->buffer.pointer[dest_desc->reference.offset] = value;
-			}
-			break;
-
-		/*
-		 * If the type is Buffer, the Length is in the structure.
-		 * Just loop through the elements and assign each one in turn.
-		 */
-		case ACPI_TYPE_BUFFER:
-			length = val_desc->buffer.length;
-			for (i = 0; i < length; i++) {
-				value = *(val_desc->buffer.pointer + i);
-				obj_desc->buffer.pointer[dest_desc->reference.offset] = value;
-			}
-			break;
-
-		/*
-		 * If the type is String, the Length is in the structure.
-		 * Just loop through the elements and assign each one in turn.
-		 */
-		case ACPI_TYPE_STRING:
-			length = val_desc->string.length;
-			for (i = 0; i < length; i++) {
-				value = *(val_desc->string.pointer + i);
-				obj_desc->buffer.pointer[dest_desc->reference.offset] = value;
-			}
-			break;
-
-		/*
-		 * If source is not a valid type so return an error.
-		 */
-		default:
-			status = AE_AML_OPERAND_TYPE;
-			break;
-		}
-		break;
-
-
-	default:
-		status = AE_AML_OPERAND_TYPE;
-		break;
-	}
-
-
-	return (status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_aml_store_object_to_node
- *
- * PARAMETERS:  *Source_desc           - Value to be stored
- *              *Node               - Named object to receive the value
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Store the object to the named object.
- *
- *              The Assignment of an object to a named object is handled here
- *              The val passed in will replace the current value (if any)
- *              with the input value.
- *
- *              When storing into an object the data is converted to the
- *              target object type then stored in the object.  This means
- *              that the target object type (for an initialized target) will
- *              not be changed by a store operation.
- *
- *              NOTE: the global lock is acquired early.  This will result
- *              in the global lock being held a bit longer.  Also, if the
- *              function fails during set up we may get the lock when we
- *              don't really need it.  I don't think we care.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-acpi_aml_store_object_to_node (
-	ACPI_OPERAND_OBJECT     *source_desc,
-	ACPI_NAMESPACE_NODE     *node,
-	ACPI_WALK_STATE         *walk_state)
-{
-	ACPI_STATUS             status = AE_OK;
-	ACPI_OPERAND_OBJECT     *target_desc;
-	OBJECT_TYPE_INTERNAL    target_type = ACPI_TYPE_ANY;
-
-
-	/*
-	 * Assuming the parameters were already validated
-	 */
-	ACPI_ASSERT((node) && (source_desc));
-
-
-	/*
-	 * Get current type of the node, and object attached to Node
-	 */
-	target_type = acpi_ns_get_type (node);
-	target_desc = acpi_ns_get_attached_object (node);
-
-
-	/*
-	 * Resolve the source object to an actual value
-	 * (If it is a reference object)
-	 */
-	status = acpi_aml_resolve_object (&source_desc, target_type, walk_state);
-	if (ACPI_FAILURE (status)) {
-		return (status);
-	}
-
-
-	/*
-	 * Do the actual store operation
-	 */
-	switch (target_type)
-	{
-	case INTERNAL_TYPE_DEF_FIELD:
-
-		/* Raw data copy for target types Integer/String/Buffer */
-
-		status = acpi_aml_copy_data_to_named_field (source_desc, node);
-		break;
-
-
-	case ACPI_TYPE_INTEGER:
-	case ACPI_TYPE_STRING:
-	case ACPI_TYPE_BUFFER:
-	case INTERNAL_TYPE_BANK_FIELD:
-	case INTERNAL_TYPE_INDEX_FIELD:
-	case ACPI_TYPE_FIELD_UNIT:
-
-		/*
-		 * These target types are all of type Integer/String/Buffer, and
-		 * therefore support implicit conversion before the store.
-		 *
-		 * Copy and/or convert the source object to a new target object
-		 */
-		status = acpi_aml_store_object (source_desc, target_type, &target_desc, walk_state);
-		if (ACPI_FAILURE (status)) {
-			return (status);
-		}
-
-		/*
-		 * Store the new Target_desc as the new value of the Name, and set
-		 * the Name's type to that of the value being stored in it.
-		 * Source_desc reference count is incremented by Attach_object.
-		 */
-		status = acpi_ns_attach_object (node, target_desc, target_type);
-		break;
-
-
-	default:
-
-		/* No conversions for all other types.  Just attach the source object */
-
-		status = acpi_ns_attach_object (node, source_desc, source_desc->common.type);
-
-		break;
-	}
-
-
-	return (status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_aml_store_object_to_object
- *
- * PARAMETERS:  *Source_desc           - Value to be stored
- *              *Dest_desc          - Object to receive the value
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Store an object to another object.
- *
- *              The Assignment of an object to another (not named) object
- *              is handled here.
- *              The val passed in will replace the current value (if any)
- *              with the input value.
- *
- *              When storing into an object the data is converted to the
- *              target object type then stored in the object.  This means
- *              that the target object type (for an initialized target) will
- *              not be changed by a store operation.
- *
- *              This module allows destination types of Number, String,
- *              and Buffer.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-acpi_aml_store_object_to_object (
-	ACPI_OPERAND_OBJECT     *source_desc,
-	ACPI_OPERAND_OBJECT     *dest_desc,
-	ACPI_WALK_STATE         *walk_state)
-{
-	ACPI_STATUS             status = AE_OK;
-	OBJECT_TYPE_INTERNAL    destination_type = dest_desc->common.type;
-
-
-	/*
-	 *  Assuming the parameters are valid!
-	 */
-	ACPI_ASSERT((dest_desc) && (source_desc));
-
-
-	/*
-	 * From this interface, we only support Integers/Strings/Buffers
-	 */
-	switch (destination_type)
-	{
-	case ACPI_TYPE_INTEGER:
-	case ACPI_TYPE_STRING:
-	case ACPI_TYPE_BUFFER:
-		break;
-
-	default:
-		return (AE_NOT_IMPLEMENTED);
-	}
-
-
-	/*
-	 * Resolve the source object to an actual value
-	 * (If it is a reference object)
-	 */
-	status = acpi_aml_resolve_object (&source_desc, destination_type, walk_state);
-	if (ACPI_FAILURE (status)) {
-		return (status);
-	}
-
-
-	/*
-	 * Copy and/or convert the source object to the destination object
-	 */
-	status = acpi_aml_store_object (source_desc, destination_type, &dest_desc, walk_state);
-
-
-	return (status);
-}
-
diff -urN linux-2.4.6-pre4/drivers/acpi/interpreter/amstoren.c linux/drivers/acpi/interpreter/amstoren.c
--- linux-2.4.6-pre4/drivers/acpi/interpreter/amstoren.c	Mon Jan 29 10:15:59 2001
+++ linux/drivers/acpi/interpreter/amstoren.c	Wed Dec 31 16:00:00 1969
@@ -1,262 +0,0 @@
-
-/******************************************************************************
- *
- * Module Name: amstoren - AML Interpreter object store support,
- *                        Store to Node (namespace object)
- *              $Revision: 28 $
- *
- *****************************************************************************/
-
-/*
- *  Copyright (C) 2000, 2001 R. Byron Moore
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-
-#include "acpi.h"
-#include "acparser.h"
-#include "acdispat.h"
-#include "acinterp.h"
-#include "amlcode.h"
-#include "acnamesp.h"
-#include "actables.h"
-
-
-#define _COMPONENT          INTERPRETER
-	 MODULE_NAME         ("amstoren")
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_aml_resolve_object
- *
- * PARAMETERS:  Source_desc_ptr     - Pointer to the source object
- *              Target_type         - Current type of the target
- *              Walk_state          - Current walk state
- *
- * RETURN:      Status, resolved object in Source_desc_ptr.
- *
- * DESCRIPTION: Resolve an object.  If the object is a reference, dereference
- *              it and return the actual object in the Source_desc_ptr.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-acpi_aml_resolve_object (
-	ACPI_OPERAND_OBJECT     **source_desc_ptr,
-	OBJECT_TYPE_INTERNAL    target_type,
-	ACPI_WALK_STATE         *walk_state)
-{
-	ACPI_OPERAND_OBJECT     *source_desc = *source_desc_ptr;
-	ACPI_STATUS             status = AE_OK;
-
-
-	/*
-	 * Ensure we have a Source that can be stored in the target
-	 */
-	switch (target_type)
-	{
-
-	/* This case handles the "interchangeable" types Integer, String, and Buffer. */
-
-	/*
-	 * These cases all require only Integers or values that
-	 * can be converted to Integers (Strings or Buffers)
-	 */
-	case ACPI_TYPE_INTEGER:
-	case ACPI_TYPE_FIELD_UNIT:
-	case INTERNAL_TYPE_BANK_FIELD:
-	case INTERNAL_TYPE_INDEX_FIELD:
-
-	/*
-	 * Stores into a Field/Region or into a Buffer/String
-	 * are all essentially the same.
-	 */
-	case ACPI_TYPE_STRING:
-	case ACPI_TYPE_BUFFER:
-	case INTERNAL_TYPE_DEF_FIELD:
-
-		/*
-		 * If Source_desc is not a valid type, try to resolve it to one.
-		 */
-		if ((source_desc->common.type != ACPI_TYPE_INTEGER)    &&
-			(source_desc->common.type != ACPI_TYPE_BUFFER)     &&
-			(source_desc->common.type != ACPI_TYPE_STRING))
-		{
-			/*
-			 * Initially not a valid type, convert
-			 */
-			status = acpi_aml_resolve_to_value (source_desc_ptr, walk_state);
-			if (ACPI_SUCCESS (status) &&
-				(source_desc->common.type != ACPI_TYPE_INTEGER)    &&
-				(source_desc->common.type != ACPI_TYPE_BUFFER)     &&
-				(source_desc->common.type != ACPI_TYPE_STRING))
-			{
-				/*
-				 * Conversion successful but still not a valid type
-				 */
-				status = AE_AML_OPERAND_TYPE;
-			}
-		}
-		break;
-
-
-	case INTERNAL_TYPE_ALIAS:
-
-		/*
-		 * Aliases are resolved by Acpi_aml_prep_operands
-		 */
-		status = AE_AML_INTERNAL;
-		break;
-
-
-	case ACPI_TYPE_PACKAGE:
-	default:
-
-		/*
-		 * All other types than Alias and the various Fields come here,
-		 * including the untyped case - ACPI_TYPE_ANY.
-		 */
-		break;
-	}
-
-	return (status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_aml_store_object
- *
- * PARAMETERS:  Source_desc         - Object to store
- *              Target_type         - Current type of the target
- *              Target_desc_ptr     - Pointer to the target
- *              Walk_state          - Current walk state
- *
- * RETURN:      Status
- *
- * DESCRIPTION: "Store" an object to another object.  This may include
- *              converting the source type to the target type (implicit
- *              conversion), and a copy of the value of the source to
- *              the target.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-acpi_aml_store_object (
-	ACPI_OPERAND_OBJECT     *source_desc,
-	OBJECT_TYPE_INTERNAL    target_type,
-	ACPI_OPERAND_OBJECT     **target_desc_ptr,
-	ACPI_WALK_STATE         *walk_state)
-{
-	ACPI_OPERAND_OBJECT     *target_desc = *target_desc_ptr;
-	ACPI_STATUS             status;
-
-
-	/*
-	 * Perform the "implicit conversion" of the source to the current type
-	 * of the target - As per the ACPI specification.
-	 *
-	 * If no conversion performed, Source_desc is left alone, otherwise it
-	 * is updated with a new object.
-	 */
-	status = acpi_aml_convert_to_target_type (target_type, &source_desc, walk_state);
-	if (ACPI_FAILURE (status)) {
-		return (status);
-	}
-
-
-	/*
-	 * We now have two objects of identical types, and we can perform a
-	 * copy of the *value* of the source object.
-	 */
-	switch (target_type)
-	{
-	case ACPI_TYPE_ANY:
-	case INTERNAL_TYPE_DEF_ANY:
-
-		/*
-		 * The target namespace node is uninitialized (has no target object),
-		 * and will take on the type of the source object
-		 */
-
-		*target_desc_ptr = source_desc;
-		break;
-
-
-	case ACPI_TYPE_INTEGER:
-
-		target_desc->integer.value = source_desc->integer.value;
-
-		/* Truncate value if we are executing from a 32-bit ACPI table */
-
-		acpi_aml_truncate_for32bit_table (target_desc, walk_state);
-		break;
-
-
-	case ACPI_TYPE_FIELD_UNIT:
-
-		status = acpi_aml_copy_integer_to_field_unit (source_desc, target_desc);
-		break;
-
-
-	case INTERNAL_TYPE_BANK_FIELD:
-
-		status = acpi_aml_copy_integer_to_bank_field (source_desc, target_desc);
-		break;
-
-
-	case INTERNAL_TYPE_INDEX_FIELD:
-
-		status = acpi_aml_copy_integer_to_index_field (source_desc, target_desc);
-		break;
-
-
-	case ACPI_TYPE_STRING:
-
-		status = acpi_aml_copy_string_to_string (source_desc, target_desc);
-		break;
-
-
-	case ACPI_TYPE_BUFFER:
-
-		status = acpi_aml_copy_buffer_to_buffer (source_desc, target_desc);
-		break;
-
-
-	case ACPI_TYPE_PACKAGE:
-
-		/*
-		 * TBD: [Unhandled] Not real sure what to do here
-		 */
-		status = AE_NOT_IMPLEMENTED;
-		break;
-
-
-	default:
-
-		/*
-		 * All other types come here.
-		 */
-		status = AE_NOT_IMPLEMENTED;
-		break;
-	}
-
-
-	return (status);
-}
-
-
diff -urN linux-2.4.6-pre4/drivers/acpi/interpreter/amstorob.c linux/drivers/acpi/interpreter/amstorob.c
--- linux-2.4.6-pre4/drivers/acpi/interpreter/amstorob.c	Fri Feb  9 11:45:58 2001
+++ linux/drivers/acpi/interpreter/amstorob.c	Wed Dec 31 16:00:00 1969
@@ -1,435 +0,0 @@
-
-/******************************************************************************
- *
- * Module Name: amstorob - AML Interpreter object store support, store to object
- *              $Revision: 23 $
- *
- *****************************************************************************/
-
-/*
- *  Copyright (C) 2000, 2001 R. Byron Moore
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-
-#include "acpi.h"
-#include "acparser.h"
-#include "acdispat.h"
-#include "acinterp.h"
-#include "amlcode.h"
-#include "acnamesp.h"
-#include "actables.h"
-
-
-#define _COMPONENT          INTERPRETER
-	 MODULE_NAME         ("amstorob")
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_aml_copy_buffer_to_buffer
- *
- * PARAMETERS:  Source_desc         - Source object to copy
- *              Target_desc         - Destination object of the copy
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Copy a buffer object to another buffer object.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-acpi_aml_copy_buffer_to_buffer (
-	ACPI_OPERAND_OBJECT     *source_desc,
-	ACPI_OPERAND_OBJECT     *target_desc)
-{
-	u32                     length;
-	u8                      *buffer;
-
- 	   /*
-	 * We know that Source_desc is a buffer by now
-	 */
-	buffer = (u8 *) source_desc->buffer.pointer;
-	length = source_desc->buffer.length;
-
-	/*
-	 * If target is a buffer of length zero, allocate a new
-	 * buffer of the proper length
-	 */
-	if (target_desc->buffer.length == 0) {
-		target_desc->buffer.pointer = acpi_cm_allocate (length);
-		if (!target_desc->buffer.pointer) {
-			return (AE_NO_MEMORY);
-		}
-
-		target_desc->buffer.length = length;
-	}
-
-	/*
-	 * Buffer is a static allocation,
-	 * only place what will fit in the buffer.
-	 */
-	if (length <= target_desc->buffer.length) {
-		/* Clear existing buffer and copy in the new one */
-
-		MEMSET(target_desc->buffer.pointer, 0, target_desc->buffer.length);
-		MEMCPY(target_desc->buffer.pointer, buffer, length);
-	}
-
-	else {
-		/*
-		 * Truncate the source, copy only what will fit
-		 */
-		MEMCPY(target_desc->buffer.pointer, buffer, target_desc->buffer.length);
-
-	}
-
-	return (AE_OK);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_aml_copy_string_to_string
- *
- * PARAMETERS:  Source_desc         - Source object to copy
- *              Target_desc         - Destination object of the copy
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Copy a String object to another String object
- *
- ******************************************************************************/
-
-ACPI_STATUS
-acpi_aml_copy_string_to_string (
-	ACPI_OPERAND_OBJECT     *source_desc,
-	ACPI_OPERAND_OBJECT     *target_desc)
-{
-	u32                     length;
-	u8                      *buffer;
-
-
-	/*
-	 * We know that Source_desc is a string by now.
-	 */
-	buffer = (u8 *) source_desc->string.pointer;
-	length = source_desc->string.length;
-
-	/*
-	 * Setting a string value replaces the old string
-	 */
-	if (length < target_desc->string.length) {
-		/* Clear old string and copy in the new one */
-
-		MEMSET(target_desc->string.pointer, 0, target_desc->string.length);
-		MEMCPY(target_desc->string.pointer, buffer, length);
-	}
-
-	else {
-		/*
-		 * Free the current buffer, then allocate a buffer
-		 * large enough to hold the value
-		 */
-		if (target_desc->string.pointer &&
-			!acpi_tb_system_table_pointer (target_desc->string.pointer))
-		{
-			/*
-			 * Only free if not a pointer into the DSDT
-			 */
-			acpi_cm_free(target_desc->string.pointer);
-		}
-
-		target_desc->string.pointer = acpi_cm_allocate (length + 1);
-		if (!target_desc->string.pointer) {
-			return (AE_NO_MEMORY);
-		}
-		target_desc->string.length = length;
-
-
-		MEMCPY(target_desc->string.pointer, buffer, length);
-	}
-
-	return (AE_OK);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_aml_copy_integer_to_index_field
- *
- * PARAMETERS:  Source_desc         - Source object to copy
- *              Target_desc         - Destination object of the copy
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Write an Integer to an Index Field
- *
- ******************************************************************************/
-
-ACPI_STATUS
-acpi_aml_copy_integer_to_index_field (
-	ACPI_OPERAND_OBJECT     *source_desc,
-	ACPI_OPERAND_OBJECT     *target_desc)
-{
-	ACPI_STATUS             status;
-	u8                      locked;
-
-
-	/*
-	 * Get the global lock if needed
-	 */
-	locked = acpi_aml_acquire_global_lock (target_desc->index_field.lock_rule);
-
-	/*
-	 * Set Index value to select proper Data register
-	 * perform the update (Set index)
-	 */
-	status = acpi_aml_access_named_field (ACPI_WRITE,
-			 target_desc->index_field.index,
-			 &target_desc->index_field.value,
-			 sizeof (target_desc->index_field.value));
-	if (ACPI_SUCCESS (status)) {
-		/* Set_index was successful, next set Data value */
-
-		status = acpi_aml_access_named_field (ACPI_WRITE,
-				   target_desc->index_field.data,
-				   &source_desc->integer.value,
-				   sizeof (source_desc->integer.value));
-
-	}
-
-
-
-	/*
-	 * Release global lock if we acquired it earlier
-	 */
-	acpi_aml_release_global_lock (locked);
-
-	return (status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_aml_copy_integer_to_bank_field
- *
- * PARAMETERS:  Source_desc         - Source object to copy
- *              Target_desc         - Destination object of the copy
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Write an Integer to a Bank Field
- *
- ******************************************************************************/
-
-ACPI_STATUS
-acpi_aml_copy_integer_to_bank_field (
-	ACPI_OPERAND_OBJECT     *source_desc,
-	ACPI_OPERAND_OBJECT     *target_desc)
-{
-	ACPI_STATUS             status;
-	u8                      locked;
-
-
-	/*
-	 * Get the global lock if needed
-	 */
-	locked = acpi_aml_acquire_global_lock (target_desc->index_field.lock_rule);
-
-
-	/*
-	 * Set Bank value to select proper Bank
-	 * Perform the update (Set Bank Select)
-	 */
-
-	status = acpi_aml_access_named_field (ACPI_WRITE,
-			 target_desc->bank_field.bank_select,
-			 &target_desc->bank_field.value,
-			 sizeof (target_desc->bank_field.value));
-	if (ACPI_SUCCESS (status)) {
-		/* Set bank select successful, set data value  */
-
-		status = acpi_aml_access_named_field (ACPI_WRITE,
-				   target_desc->bank_field.bank_select,
-				   &source_desc->bank_field.value,
-				   sizeof (source_desc->bank_field.value));
-	}
-
-
-
-	/*
-	 * Release global lock if we acquired it earlier
-	 */
-	acpi_aml_release_global_lock (locked);
-
-	return (status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_aml_copy_data_to_named_field
- *
- * PARAMETERS:  Source_desc         - Source object to copy
- *              Node                - Destination Namespace node
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Copy raw data to a Named Field.  No implicit conversion
- *              is performed on the source object
- *
- ******************************************************************************/
-
-ACPI_STATUS
-acpi_aml_copy_data_to_named_field (
-	ACPI_OPERAND_OBJECT     *source_desc,
-	ACPI_NAMESPACE_NODE     *node)
-{
-	ACPI_STATUS             status;
-	u8                      locked;
-	u32                     length;
-	u8                      *buffer;
-
-
-	/*
-	 * Named fields (Create_xxx_field) - We don't perform any conversions on the
-	 * source operand, just use the raw data
-	 */
-	switch (source_desc->common.type)
-	{
-	case ACPI_TYPE_INTEGER:
-		buffer = (u8 *) &source_desc->integer.value;
-		length = sizeof (source_desc->integer.value);
-		break;
-
-	case ACPI_TYPE_BUFFER:
-		buffer = (u8 *) source_desc->buffer.pointer;
-		length = source_desc->buffer.length;
-		break;
-
-	case ACPI_TYPE_STRING:
-		buffer = (u8 *) source_desc->string.pointer;
-		length = source_desc->string.length;
-		break;
-
-	default:
-		return (AE_TYPE);
-	}
-
-	/*
-	 * Get the global lock if needed before the update
-	 * TBD: not needed!
-	 */
-	locked = acpi_aml_acquire_global_lock (source_desc->field.lock_rule);
-
-	status = acpi_aml_access_named_field (ACPI_WRITE,
-			  node, buffer, length);
-
-	acpi_aml_release_global_lock (locked);
-
-	return (status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_aml_copy_integer_to_field_unit
- *
- * PARAMETERS:  Source_desc         - Source object to copy
- *              Target_desc         - Destination object of the copy
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Write an Integer to a Field Unit.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-acpi_aml_copy_integer_to_field_unit (
-	ACPI_OPERAND_OBJECT     *source_desc,
-	ACPI_OPERAND_OBJECT     *target_desc)
-{
-	ACPI_STATUS             status = AE_OK;
-	u8                      *location = NULL;
-	u32                     mask;
-	u32                     new_value;
-	u8                      locked = FALSE;
-
-
-	/*
-	 * If the Field Buffer and Index have not been previously evaluated,
-	 * evaluate them and save the results.
-	 */
-	if (!(target_desc->common.flags & AOPOBJ_DATA_VALID)) {
-		status = acpi_ds_get_field_unit_arguments (target_desc);
-		if (ACPI_FAILURE (status)) {
-			return (status);
-		}
-	}
-
-	if ((!target_desc->field_unit.container ||
-		ACPI_TYPE_BUFFER != target_desc->field_unit.container->common.type))
-	{
-		return (AE_AML_INTERNAL);
-	}
-
-	/*
-	 * Get the global lock if needed
-	 */
-	locked = acpi_aml_acquire_global_lock (target_desc->field_unit.lock_rule);
-
-	/*
-	 * TBD: [Unhandled] REMOVE this limitation
-	 * Make sure the operation is within the limits of our implementation
-	 * this is not a Spec limitation!!
-	 */
-	if (target_desc->field_unit.length + target_desc->field_unit.bit_offset > 32) {
-		return (AE_NOT_IMPLEMENTED);
-	}
-
-	/* Field location is (base of buffer) + (byte offset) */
-
-	location = target_desc->field_unit.container->buffer.pointer
-			  + target_desc->field_unit.offset;
-
-	/*
-	 * Construct Mask with 1 bits where the field is,
-	 * 0 bits elsewhere
-	 */
-	mask = ((u32) 1 << target_desc->field_unit.length) - ((u32)1
-			   << target_desc->field_unit.bit_offset);
-
-	/* Zero out the field in the buffer */
-
-	MOVE_UNALIGNED32_TO_32 (&new_value, location);
-	new_value &= ~mask;
-
-	/*
-	 * Shift and mask the new value into position,
-	 * and or it into the buffer.
-	 */
-	new_value |= (source_desc->integer.value << target_desc->field_unit.bit_offset) &
-			 mask;
-
-	/* Store back the value */
-
-	MOVE_UNALIGNED32_TO_32 (location, &new_value);
-
-	return (AE_OK);
-}
-
-
diff -urN linux-2.4.6-pre4/drivers/acpi/interpreter/amsystem.c linux/drivers/acpi/interpreter/amsystem.c
--- linux-2.4.6-pre4/drivers/acpi/interpreter/amsystem.c	Mon Jan 22 13:23:42 2001
+++ linux/drivers/acpi/interpreter/amsystem.c	Wed Dec 31 16:00:00 1969
@@ -1,344 +0,0 @@
-
-/******************************************************************************
- *
- * Module Name: amsystem - Interface to OS services
- *              $Revision: 54 $
- *
- *****************************************************************************/
-
-/*
- *  Copyright (C) 2000, 2001 R. Byron Moore
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-
-#include "acpi.h"
-#include "acinterp.h"
-#include "acnamesp.h"
-#include "achware.h"
-#include "acevents.h"
-
-#define _COMPONENT          INTERPRETER
-	 MODULE_NAME         ("amsystem")
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_aml_system_thread_id
- *
- * PARAMETERS:  None
- *
- * RETURN:      Current Thread ID (for this implementation a 1 is returned)
- *
- * DESCRIPTION: An invocation is identified by its Thread ID.  In a single
- *              threaded OS the Thread ID is undefined so a 1 will be
- *              returned.
- *
- ******************************************************************************/
-
-u16
-acpi_aml_system_thread_id (void)
-{
-	return (1);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_aml_system_wait_semaphore
- *
- * PARAMETERS:  Semaphore           - OSD semaphore to wait on
- *              Timeout             - Max time to wait
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Implements a semaphore wait with a check to see if the
- *              semaphore is available immediately.  If it is not, the
- *              interpreter is released.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-acpi_aml_system_wait_semaphore (
-	ACPI_HANDLE             semaphore,
-	u32                     timeout)
-{
-	ACPI_STATUS             status;
-
-
-	status = acpi_os_wait_semaphore (semaphore, 1, 0);
-	if (ACPI_SUCCESS (status)) {
-		return (status);
-	}
-
-	if (status == AE_TIME) {
-		/* We must wait, so unlock the interpreter */
-
-		acpi_aml_exit_interpreter ();
-
-		status = acpi_os_wait_semaphore (semaphore, 1, timeout);
-
-		/* Reacquire the interpreter */
-
-		acpi_aml_enter_interpreter ();
-
-	}
-
-	return (status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_aml_system_do_stall
- *
- * PARAMETERS:  How_long            - The amount of time to stall
- *
- * RETURN:      None
- *
- * DESCRIPTION: Suspend running thread for specified amount of time.
- *
- ******************************************************************************/
-
-void
-acpi_aml_system_do_stall (
-	u32                     how_long)
-{
-
-	if (how_long > 1000) /* 1 millisecond */ {
-		/* Since this thread will sleep, we must release the interpreter */
-
-		acpi_aml_exit_interpreter ();
-
-		acpi_os_sleep_usec (how_long);
-
-		/* And now we must get the interpreter again */
-
-		acpi_aml_enter_interpreter ();
-	}
-
-	else {
-		acpi_os_sleep_usec (how_long);
-	}
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_aml_system_do_suspend
- *
- * PARAMETERS:  How_long            - The amount of time to suspend
- *
- * RETURN:      None
- *
- * DESCRIPTION: Suspend running thread for specified amount of time.
- *
- ******************************************************************************/
-
-void
-acpi_aml_system_do_suspend (
-	u32                     how_long)
-{
-	/* Since this thread will sleep, we must release the interpreter */
-
-	acpi_aml_exit_interpreter ();
-
-	acpi_os_sleep ((u16) (how_long / (u32) 1000),
-			  (u16) (how_long % (u32) 1000));
-
-	/* And now we must get the interpreter again */
-
-	acpi_aml_enter_interpreter ();
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_aml_system_acquire_mutex
- *
- * PARAMETERS:  *Time_desc          - The 'time to delay' object descriptor
- *              *Obj_desc           - The object descriptor for this op
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Provides an access point to perform synchronization operations
- *              within the AML.  This function will cause a lock to be generated
- *              for the Mutex pointed to by Obj_desc.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-acpi_aml_system_acquire_mutex (
-	ACPI_OPERAND_OBJECT     *time_desc,
-	ACPI_OPERAND_OBJECT     *obj_desc)
-{
-	ACPI_STATUS             status = AE_OK;
-
-
-	if (!obj_desc) {
-		return (AE_BAD_PARAMETER);
-	}
-
-	/*
-	 * Support for the _GL_ Mutex object -- go get the global lock
-	 */
-
-	if (obj_desc->mutex.semaphore == acpi_gbl_global_lock_semaphore) {
-		status = acpi_ev_acquire_global_lock ();
-		return (status);
-	}
-
-	status = acpi_aml_system_wait_semaphore (obj_desc->mutex.semaphore,
-			  (u32) time_desc->integer.value);
-	return (status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_aml_system_release_mutex
- *
- * PARAMETERS:  *Obj_desc           - The object descriptor for this op
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Provides an access point to perform synchronization operations
- *              within the AML.  This operation is a request to release a
- *              previously acquired Mutex.  If the Mutex variable is set then
- *              it will be decremented.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-acpi_aml_system_release_mutex (
-	ACPI_OPERAND_OBJECT     *obj_desc)
-{
-	ACPI_STATUS             status = AE_OK;
-
-
-	if (!obj_desc) {
-		return (AE_BAD_PARAMETER);
-	}
-
-	/*
-	 * Support for the _GL_ Mutex object -- release the global lock
-	 */
-	if (obj_desc->mutex.semaphore == acpi_gbl_global_lock_semaphore) {
-		acpi_ev_release_global_lock ();
-		return (AE_OK);
-	}
-
-	status = acpi_os_signal_semaphore (obj_desc->mutex.semaphore, 1);
-	return (status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_aml_system_signal_event
- *
- * PARAMETERS:  *Obj_desc           - The object descriptor for this op
- *
- * RETURN:      AE_OK
- *
- * DESCRIPTION: Provides an access point to perform synchronization operations
- *              within the AML.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-acpi_aml_system_signal_event (
-	ACPI_OPERAND_OBJECT     *obj_desc)
-{
-	ACPI_STATUS             status = AE_OK;
-
-
-	if (obj_desc) {
-		status = acpi_os_signal_semaphore (obj_desc->event.semaphore, 1);
-	}
-
-	return (status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_aml_system_wait_event
- *
- * PARAMETERS:  *Time_desc          - The 'time to delay' object descriptor
- *              *Obj_desc           - The object descriptor for this op
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Provides an access point to perform synchronization operations
- *              within the AML.  This operation is a request to wait for an
- *              event.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-acpi_aml_system_wait_event (
-	ACPI_OPERAND_OBJECT     *time_desc,
-	ACPI_OPERAND_OBJECT     *obj_desc)
-{
-	ACPI_STATUS             status = AE_OK;
-
-
-	if (obj_desc) {
-		status = acpi_aml_system_wait_semaphore (obj_desc->event.semaphore,
-				  (u32) time_desc->integer.value);
-	}
-
-
-	return (status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_aml_system_reset_event
- *
- * PARAMETERS:  *Obj_desc           - The object descriptor for this op
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Provides an access point to perform synchronization operations
- *              within the AML.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-acpi_aml_system_reset_event (
-	ACPI_OPERAND_OBJECT     *obj_desc)
-{
-	ACPI_STATUS             status = AE_OK;
-	void                    *temp_semaphore;
-
-
-	/*
-	 * We are going to simply delete the existing semaphore and
-	 * create a new one!
-	 */
-
-	status = acpi_os_create_semaphore (ACPI_NO_UNIT_LIMIT, 0, &temp_semaphore);
-	if (ACPI_SUCCESS (status)) {
-		acpi_os_delete_semaphore (obj_desc->mutex.semaphore);
-		obj_desc->mutex.semaphore = temp_semaphore;
-	}
-
-	return (status);
-}
-
diff -urN linux-2.4.6-pre4/drivers/acpi/interpreter/amutils.c linux/drivers/acpi/interpreter/amutils.c
--- linux-2.4.6-pre4/drivers/acpi/interpreter/amutils.c	Fri Feb  9 11:45:58 2001
+++ linux/drivers/acpi/interpreter/amutils.c	Wed Dec 31 16:00:00 1969
@@ -1,370 +0,0 @@
-
-/******************************************************************************
- *
- * Module Name: amutils - interpreter/scanner utilities
- *              $Revision: 69 $
- *
- *****************************************************************************/
-
-/*
- *  Copyright (C) 2000, 2001 R. Byron Moore
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-
-#include "acpi.h"
-#include "acparser.h"
-#include "acinterp.h"
-#include "amlcode.h"
-#include "acnamesp.h"
-#include "acevents.h"
-
-#define _COMPONENT          INTERPRETER
-	 MODULE_NAME         ("amutils")
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_aml_enter_interpreter
- *
- * PARAMETERS:  None
- *
- * DESCRIPTION: Enter the interpreter execution region
- *
- ******************************************************************************/
-
-void
-acpi_aml_enter_interpreter (void)
-{
-
-	acpi_cm_acquire_mutex (ACPI_MTX_EXECUTE);
-
-	return;
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_aml_exit_interpreter
- *
- * PARAMETERS:  None
- *
- * DESCRIPTION: Exit the interpreter execution region
- *
- * Cases where the interpreter is unlocked:
- *      1) Completion of the execution of a control method
- *      2) Method blocked on a Sleep() AML opcode
- *      3) Method blocked on an Acquire() AML opcode
- *      4) Method blocked on a Wait() AML opcode
- *      5) Method blocked to acquire the global lock
- *      6) Method blocked to execute a serialized control method that is
- *          already executing
- *      7) About to invoke a user-installed opregion handler
- *
- ******************************************************************************/
-
-void
-acpi_aml_exit_interpreter (void)
-{
-
-	acpi_cm_release_mutex (ACPI_MTX_EXECUTE);
-
-	return;
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_aml_validate_object_type
- *
- * PARAMETERS:  Type            Object type to validate
- *
- * DESCRIPTION: Determine if a type is a valid ACPI object type
- *
- ******************************************************************************/
-
-u8
-acpi_aml_validate_object_type (
-	ACPI_OBJECT_TYPE        type)
-{
-
-	if ((type > ACPI_TYPE_MAX && type < INTERNAL_TYPE_BEGIN) ||
-		(type > INTERNAL_TYPE_MAX))
-	{
-		return (FALSE);
-	}
-
-	return (TRUE);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_aml_truncate_for32bit_table
- *
- * PARAMETERS:  Obj_desc        - Object to be truncated
- *              Walk_state      - Current walk state
- *                                (A method must be executing)
- *
- * RETURN:      none
- *
- * DESCRIPTION: Truncate a number to 32-bits if the currently executing method
- *              belongs to a 32-bit ACPI table.
- *
- ******************************************************************************/
-
-void
-acpi_aml_truncate_for32bit_table (
-	ACPI_OPERAND_OBJECT     *obj_desc,
-	ACPI_WALK_STATE         *walk_state)
-{
-
-	/*
-	 * Object must be a valid number and we must be executing
-	 * a control method
-	 */
-
-	if ((!obj_desc) ||
-		(obj_desc->common.type != ACPI_TYPE_INTEGER) ||
-		(!walk_state->method_node))
-	{
-		return;
-	}
-
-	if (walk_state->method_node->flags & ANOBJ_DATA_WIDTH_32) {
-		/*
-		 * We are running a method that exists in a 32-bit ACPI table.
-		 * Truncate the value to 32 bits by zeroing out the upper 32-bit field
-		 */
-		obj_desc->integer.value &= (ACPI_INTEGER) ACPI_UINT32_MAX;
-	}
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_aml_acquire_global_lock
- *
- * PARAMETERS:  Rule            - Lock rule: Always_lock, Never_lock
- *
- * RETURN:      TRUE/FALSE indicating whether the lock was actually acquired
- *
- * DESCRIPTION: Obtain the global lock and keep track of this fact via two
- *              methods.  A global variable keeps the state of the lock, and
- *              the state is returned to the caller.
- *
- ******************************************************************************/
-
-u8
-acpi_aml_acquire_global_lock (
-	u32                     rule)
-{
-	u8                      locked = FALSE;
-	ACPI_STATUS             status;
-
-
-	/*  Only attempt lock if the Rule says so */
-
-	if (rule == (u32) GLOCK_ALWAYS_LOCK) {
-		/*  OK to get the lock   */
-
-		status = acpi_ev_acquire_global_lock ();
-
-		if (ACPI_SUCCESS (status)) {
-			acpi_gbl_global_lock_set = TRUE;
-			locked = TRUE;
-		}
-	}
-
-	return (locked);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_aml_release_global_lock
- *
- * PARAMETERS:  Locked_by_me    - Return value from corresponding call to
- *                                Acquire_global_lock.
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Release the global lock if it is locked.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-acpi_aml_release_global_lock (
-	u8                      locked_by_me)
-{
-
-
-	/* Only attempt unlock if the caller locked it */
-
-	if (locked_by_me) {
-		/* Double check against the global flag */
-
-		if (acpi_gbl_global_lock_set) {
-			/* OK, now release the lock */
-
-			acpi_ev_release_global_lock ();
-			acpi_gbl_global_lock_set = FALSE;
-		}
-
-	}
-
-
-	return (AE_OK);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_aml_digits_needed
- *
- * PARAMETERS:  val             - Value to be represented
- *              base            - Base of representation
- *
- * RETURN:      the number of digits needed to represent val in base
- *
- ******************************************************************************/
-
-u32
-acpi_aml_digits_needed (
-	ACPI_INTEGER            val,
-	u32                     base)
-{
-	u32                     num_digits = 0;
-
-
-	if (base < 1) {
-		REPORT_ERROR (("Aml_digits_needed: Internal error - Invalid base\n"));
-	}
-
-	else {
-		for (num_digits = 1 + (val < 0); (val = ACPI_DIVIDE (val,base)); ++num_digits) { ; }
-	}
-
-	return (num_digits);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    ntohl
- *
- * PARAMETERS:  Value           - Value to be converted
- *
- * DESCRIPTION: Convert a 32-bit value to big-endian (swap the bytes)
- *
- ******************************************************************************/
-
-static u32
-_ntohl (
-	u32                     value)
-{
-	union
-	{
-		u32                 value;
-		u8                  bytes[4];
-	} out;
-
-	union
-	{
-		u32                 value;
-		u8                  bytes[4];
-	} in;
-
-
-	in.value = value;
-
-	out.bytes[0] = in.bytes[3];
-	out.bytes[1] = in.bytes[2];
-	out.bytes[2] = in.bytes[1];
-	out.bytes[3] = in.bytes[0];
-
-	return (out.value);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_aml_eisa_id_to_string
- *
- * PARAMETERS:  Numeric_id      - EISA ID to be converted
- *              Out_string      - Where to put the converted string (8 bytes)
- *
- * DESCRIPTION: Convert a numeric EISA ID to string representation
- *
- ******************************************************************************/
-
-ACPI_STATUS
-acpi_aml_eisa_id_to_string (
-	u32                     numeric_id,
-	NATIVE_CHAR             *out_string)
-{
-	u32                     id;
-
-	/* swap to big-endian to get contiguous bits */
-
-	id = _ntohl (numeric_id);
-
-	out_string[0] = (char) ('@' + ((id >> 26) & 0x1f));
-	out_string[1] = (char) ('@' + ((id >> 21) & 0x1f));
-	out_string[2] = (char) ('@' + ((id >> 16) & 0x1f));
-	out_string[3] = acpi_gbl_hex_to_ascii[(id >> 12) & 0xf];
-	out_string[4] = acpi_gbl_hex_to_ascii[(id >> 8) & 0xf];
-	out_string[5] = acpi_gbl_hex_to_ascii[(id >> 4) & 0xf];
-	out_string[6] = acpi_gbl_hex_to_ascii[id & 0xf];
-	out_string[7] = 0;
-
-	return (AE_OK);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_aml_unsigned_integer_to_string
- *
- * PARAMETERS:  Value           - Value to be converted
- *              Out_string      - Where to put the converted string (8 bytes)
- *
- * RETURN:      Convert a number to string representation
- *
- ******************************************************************************/
-
-ACPI_STATUS
-acpi_aml_unsigned_integer_to_string (
-	ACPI_INTEGER            value,
-	NATIVE_CHAR             *out_string)
-{
-	u32                     count;
-	u32                     digits_needed;
-
-
-	digits_needed = acpi_aml_digits_needed (value, 10);
-
-	out_string[digits_needed] = '\0';
-
-	for (count = digits_needed; count > 0; count--) {
-		out_string[count-1] = (NATIVE_CHAR) ('0' + (ACPI_MODULO (value, 10)));
-		value = ACPI_DIVIDE (value, 10);
-	}
-
-	return (AE_OK);
-}
-
-
diff -urN linux-2.4.6-pre4/drivers/acpi/interpreter/amxface.c linux/drivers/acpi/interpreter/amxface.c
--- linux-2.4.6-pre4/drivers/acpi/interpreter/amxface.c	Mon Jan 22 13:23:42 2001
+++ linux/drivers/acpi/interpreter/amxface.c	Wed Dec 31 16:00:00 1969
@@ -1,95 +0,0 @@
-
-/******************************************************************************
- *
- * Module Name: amxface - External interpreter interfaces
- *              $Revision: 24 $
- *
- *****************************************************************************/
-
-/*
- *  Copyright (C) 2000, 2001 R. Byron Moore
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-
-#include "acpi.h"
-#include "acinterp.h"
-
-
-#define _COMPONENT          INTERPRETER
-	 MODULE_NAME         ("amxface")
-
-
-/*
- * DEFINE_AML_GLOBALS is tested in amlcode.h
- * to determine whether certain global names should be "defined" or only
- * "declared" in the current compilation.  This enhances maintainability
- * by enabling a single header file to embody all knowledge of the names
- * in question.
- *
- * Exactly one module of any executable should #define DEFINE_GLOBALS
- * before #including the header files which use this convention.  The
- * names in question will be defined and initialized in that module,
- * and declared as extern in all other modules which #include those
- * header files.
- */
-
-#define DEFINE_AML_GLOBALS
-#include "amlcode.h"
-#include "acparser.h"
-#include "acnamesp.h"
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_aml_execute_method
- *
- * PARAMETERS:  Pcode               - Pointer to the pcode stream
- *              Pcode_length        - Length of pcode that comprises the method
- *              **Params            - List of parameters to pass to method,
- *                                    terminated by NULL. Params itself may be
- *                                    NULL if no parameters are being passed.
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Execute a control method
- *
- ******************************************************************************/
-
-ACPI_STATUS
-acpi_aml_execute_method (
-	ACPI_NAMESPACE_NODE     *method_node,
-	ACPI_OPERAND_OBJECT     **params,
-	ACPI_OPERAND_OBJECT     **return_obj_desc)
-{
-	ACPI_STATUS             status;
-
-
-	/*
-	 * The point here is to lock the interpreter and call the low
-	 * level execute.
-	 */
-
-	acpi_aml_enter_interpreter ();
-
-	status = acpi_psx_execute (method_node, params, return_obj_desc);
-
-	acpi_aml_exit_interpreter ();
-
-	return (status);
-}
-
-
diff -urN linux-2.4.6-pre4/drivers/acpi/namespace/Makefile linux/drivers/acpi/namespace/Makefile
--- linux-2.4.6-pre4/drivers/acpi/namespace/Makefile	Fri Dec 29 14:07:21 2000
+++ linux/drivers/acpi/namespace/Makefile	Mon Dec  3 22:48:42 2001
@@ -1,16 +1,12 @@
 #
 # Makefile for all Linux ACPI interpreter subdirectories
+# EXCEPT for the ospm directory
 #
 
-O_TARGET := ../$(shell basename `pwd`).o
+O_TARGET := $(notdir $(CURDIR)).o
 
 obj-$(CONFIG_ACPI) := $(patsubst %.c,%.o,$(wildcard *.c))
 
-EXTRA_CFLAGS += -I../include
-
 EXTRA_CFLAGS += $(ACPI_CFLAGS)
 
 include $(TOPDIR)/Rules.make
-
-clean:
-	$(RM) *.o 
diff -urN linux-2.4.6-pre4/drivers/acpi/namespace/nsaccess.c linux/drivers/acpi/namespace/nsaccess.c
--- linux-2.4.6-pre4/drivers/acpi/namespace/nsaccess.c	Mon Jan 22 13:23:43 2001
+++ linux/drivers/acpi/namespace/nsaccess.c	Mon Dec  3 22:48:42 2001
@@ -1,7 +1,7 @@
 /*******************************************************************************
  *
  * Module Name: nsaccess - Top-level functions for accessing ACPI namespace
- *              $Revision: 119 $
+ *              $Revision: 126 $
  *
  ******************************************************************************/
 
@@ -31,7 +31,7 @@
 #include "acdispat.h"
 
 
-#define _COMPONENT          NAMESPACE
+#define _COMPONENT          ACPI_NAMESPACE
 	 MODULE_NAME         ("nsaccess")
 
 
@@ -58,7 +58,7 @@
 	ACPI_OPERAND_OBJECT     *obj_desc;
 
 
-	acpi_cm_acquire_mutex (ACPI_MTX_NAMESPACE);
+	acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
 
 	/*
 	 * The global root ptr is initially NULL, so a non-NULL value indicates
@@ -82,8 +82,7 @@
 	/* Enter the pre-defined names in the name table */
 
 	for (init_val = acpi_gbl_pre_defined_names; init_val->name; init_val++) {
-		status = acpi_ns_lookup (NULL, init_val->name,
-				 (OBJECT_TYPE_INTERNAL) init_val->type,
+		status = acpi_ns_lookup (NULL, init_val->name, init_val->type,
 				 IMODE_LOAD_PASS2, NS_NO_UPSEARCH,
 				 NULL, &new_node);
 
@@ -100,9 +99,7 @@
 			 * descriptor for it.
 			 */
 
-			obj_desc = acpi_cm_create_internal_object (
-					  (OBJECT_TYPE_INTERNAL) init_val->type);
-
+			obj_desc = acpi_ut_create_internal_object (init_val->type);
 			if (!obj_desc) {
 				status = AE_NO_MEMORY;
 				goto unlock_and_exit;
@@ -114,8 +111,7 @@
 			 * used for initial values are implemented here.
 			 */
 
-			switch (init_val->type)
-			{
+			switch (init_val->type) {
 
 			case ACPI_TYPE_INTEGER:
 
@@ -126,18 +122,17 @@
 
 			case ACPI_TYPE_STRING:
 
-				obj_desc->string.length =
-						(u16) STRLEN (init_val->val);
+				obj_desc->string.length = STRLEN (init_val->val);
 
 				/*
 				 * Allocate a buffer for the string.  All
 				 * String.Pointers must be allocated buffers!
 				 * (makes deletion simpler)
 				 */
-				obj_desc->string.pointer = acpi_cm_allocate (
+				obj_desc->string.pointer = acpi_ut_allocate (
 						   (obj_desc->string.length + 1));
 				if (!obj_desc->string.pointer) {
-					acpi_cm_remove_reference (obj_desc);
+					acpi_ut_remove_reference (obj_desc);
 					status = AE_NO_MEMORY;
 					goto unlock_and_exit;
 				}
@@ -149,7 +144,7 @@
 			case ACPI_TYPE_MUTEX:
 
 				obj_desc->mutex.sync_level =
-						(u16) STRTOUL (init_val->val, NULL, 10);
+						 (u16) STRTOUL (init_val->val, NULL, 10);
 
 				if (STRCMP (init_val->name, "_GL_") == 0) {
 					/*
@@ -186,21 +181,20 @@
 			default:
 				REPORT_ERROR (("Unsupported initial type value %X\n",
 					init_val->type));
-				acpi_cm_remove_reference (obj_desc);
+				acpi_ut_remove_reference (obj_desc);
 				obj_desc = NULL;
 				continue;
 			}
 
 			/* Store pointer to value descriptor in the Node */
 
-			acpi_ns_attach_object (new_node, obj_desc,
-					   obj_desc->common.type);
+			acpi_ns_attach_object (new_node, obj_desc, obj_desc->common.type);
 		}
 	}
 
 
 unlock_and_exit:
-	acpi_cm_release_mutex (ACPI_MTX_NAMESPACE);
+	acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
 	return (status);
 }
 
@@ -232,7 +226,7 @@
 acpi_ns_lookup (
 	ACPI_GENERIC_STATE      *scope_info,
 	NATIVE_CHAR             *pathname,
-	OBJECT_TYPE_INTERNAL    type,
+	ACPI_OBJECT_TYPE8       type,
 	OPERATING_MODE          interpreter_mode,
 	u32                     flags,
 	ACPI_WALK_STATE         *walk_state,
@@ -246,8 +240,8 @@
 	u32                     num_segments;
 	ACPI_NAME               simple_name;
 	u8                      null_name_path = FALSE;
-	OBJECT_TYPE_INTERNAL    type_to_check_for;
-	OBJECT_TYPE_INTERNAL    this_search_type;
+	ACPI_OBJECT_TYPE8       type_to_check_for;
+	ACPI_OBJECT_TYPE8       this_search_type;
 	u32                     local_flags = flags & ~NS_ERROR_IF_FOUND;
 
 
@@ -271,8 +265,7 @@
 	 */
 
 	if ((!scope_info) ||
-		(!scope_info->scope.node))
-	{
+		(!scope_info->scope.node)) {
 		prefix_node = acpi_gbl_root_node;
 	}
 	else {
@@ -281,14 +274,14 @@
 
 
 	/*
-	 * This check is explicitly split provide relax the Type_to_check_for
+	 * This check is explicitly split to relax the Type_to_check_for
 	 * conditions for Bank_field_defn. Originally, both Bank_field_defn and
 	 * Def_field_defn caused Type_to_check_for to be set to ACPI_TYPE_REGION,
 	 * but the Bank_field_defn may also check for a Field definition as well
 	 * as an Operation_region.
 	 */
 
-	if (INTERNAL_TYPE_DEF_FIELD_DEFN == type) {
+	if (INTERNAL_TYPE_FIELD_DEFN == type) {
 		/* Def_field_defn defines fields in a Region */
 
 		type_to_check_for = ACPI_TYPE_REGION;
@@ -376,7 +369,8 @@
 				if (!this_node) {
 					/* Current scope has no parent scope */
 
-					REPORT_ERROR (("Too many parent prefixes (^) - reached root\n"));
+					REPORT_ERROR (
+						("Too many parent prefixes (^) - reached root\n"));
 					return (AE_NOT_FOUND);
 				}
 
@@ -480,8 +474,7 @@
 			(type_to_check_for  != INTERNAL_TYPE_SCOPE)             &&
 			(type_to_check_for  != INTERNAL_TYPE_INDEX_FIELD_DEFN)  &&
 			(this_node->type    != ACPI_TYPE_ANY)                   &&
-			(this_node->type    != type_to_check_for))
-		{
+			(this_node->type    != type_to_check_for)) {
 			/* Complain about a type mismatch */
 
 			REPORT_WARNING (
@@ -500,8 +493,7 @@
 		}
 
 		if ((num_segments || acpi_ns_opens_scope (type)) &&
-			(this_node->child == NULL))
-		{
+			(this_node->child == NULL)) {
 			/*
 			 * More segments or the type implies enclosed scope,
 			 * and the next scope has not been allocated.
diff -urN linux-2.4.6-pre4/drivers/acpi/namespace/nsalloc.c linux/drivers/acpi/namespace/nsalloc.c
--- linux-2.4.6-pre4/drivers/acpi/namespace/nsalloc.c	Mon Jan 22 13:23:43 2001
+++ linux/drivers/acpi/namespace/nsalloc.c	Mon Dec  3 22:48:42 2001
@@ -1,7 +1,7 @@
 /*******************************************************************************
  *
  * Module Name: nsalloc - Namespace allocation and deletion utilities
- *              $Revision: 45 $
+ *              $Revision: 50 $
  *
  ******************************************************************************/
 
@@ -29,7 +29,7 @@
 #include "acinterp.h"
 
 
-#define _COMPONENT          NAMESPACE
+#define _COMPONENT          ACPI_NAMESPACE
 	 MODULE_NAME         ("nsalloc")
 
 
@@ -52,7 +52,7 @@
 	ACPI_NAMESPACE_NODE     *node;
 
 
-	node = acpi_cm_callocate (sizeof (ACPI_NAMESPACE_NODE));
+	node = acpi_ut_callocate (sizeof (ACPI_NAMESPACE_NODE));
 	if (!node) {
 		return (NULL);
 	}
@@ -119,7 +119,7 @@
 		acpi_ns_detach_object (node);
 	}
 
-	acpi_cm_free (node);
+	acpi_ut_free (node);
 
 
 	return;
@@ -146,7 +146,7 @@
 	ACPI_WALK_STATE         *walk_state,
 	ACPI_NAMESPACE_NODE     *parent_node,   /* Parent */
 	ACPI_NAMESPACE_NODE     *node,      /* New Child*/
-	OBJECT_TYPE_INTERNAL    type)
+	ACPI_OBJECT_TYPE8       type)
 {
 	u16                     owner_id = TABLE_ID_DSDT;
 	ACPI_NAMESPACE_NODE     *child_node;
@@ -195,27 +195,22 @@
 	 * add the region in order to define fields in it, we
 	 * have a forward reference.
 	 */
-
 	if ((ACPI_TYPE_ANY == type) ||
-		(INTERNAL_TYPE_DEF_FIELD_DEFN == type) ||
-		(INTERNAL_TYPE_BANK_FIELD_DEFN == type))
-	{
+		(INTERNAL_TYPE_FIELD_DEFN == type) ||
+		(INTERNAL_TYPE_BANK_FIELD_DEFN == type)) {
 		/*
 		 * We don't want to abort here, however!
 		 * We will fill in the actual type when the
 		 * real definition is found later.
 		 */
-
 	}
 
 	/*
 	 * The Def_field_defn and Bank_field_defn cases are actually
 	 * looking up the Region in which the field will be defined
 	 */
-
-	if ((INTERNAL_TYPE_DEF_FIELD_DEFN == type) ||
-		(INTERNAL_TYPE_BANK_FIELD_DEFN == type))
-	{
+	if ((INTERNAL_TYPE_FIELD_DEFN == type) ||
+		(INTERNAL_TYPE_BANK_FIELD_DEFN == type)) {
 		type = ACPI_TYPE_REGION;
 	}
 
@@ -225,11 +220,9 @@
 	 * being looked up.  Save any other value of Type as the type of
 	 * the entry.
 	 */
-
 	if ((type != INTERNAL_TYPE_SCOPE) &&
 		(type != INTERNAL_TYPE_DEF_ANY) &&
-		(type != INTERNAL_TYPE_INDEX_FIELD_DEFN))
-	{
+		(type != INTERNAL_TYPE_INDEX_FIELD_DEFN)) {
 		node->type = (u8) type;
 	}
 
@@ -237,7 +230,6 @@
 	 * Increment the reference count(s) of all parents up to
 	 * the root!
 	 */
-
 	while ((node = acpi_ns_get_parent_object (node)) != NULL) {
 		node->reference_count++;
 	}
@@ -282,8 +274,7 @@
 	/*
 	 * Deallocate all children at this level
 	 */
-	do
-	{
+	do {
 		/* Get the things we need */
 
 		next_node   = child_node->peer;
@@ -304,7 +295,7 @@
 			acpi_ns_detach_object (child_node);
 		}
 
-		acpi_cm_free (child_node);
+		acpi_ut_free (child_node);
 
 		/* And move on to the next child in the list */
 
@@ -373,7 +364,7 @@
 			obj_desc = acpi_ns_get_attached_object (child_node);
 			if (obj_desc) {
 				acpi_ns_detach_object (child_node);
-				acpi_cm_remove_reference (obj_desc);
+				acpi_ut_remove_reference (obj_desc);
 			}
 
 
@@ -519,7 +510,7 @@
 				obj_desc = acpi_ns_get_attached_object (child_node);
 				if (obj_desc) {
 					acpi_ns_detach_object (child_node);
-					acpi_cm_remove_reference (obj_desc);
+					acpi_ut_remove_reference (obj_desc);
 				}
 			}
 
diff -urN linux-2.4.6-pre4/drivers/acpi/namespace/nseval.c linux/drivers/acpi/namespace/nseval.c
--- linux-2.4.6-pre4/drivers/acpi/namespace/nseval.c	Fri Feb  9 11:45:58 2001
+++ linux/drivers/acpi/namespace/nseval.c	Mon Dec  3 22:48:42 2001
@@ -2,7 +2,7 @@
  *
  * Module Name: nseval - Object evaluation interfaces -- includes control
  *                       method lookup and execution.
- *              $Revision: 83 $
+ *              $Revision: 91 $
  *
  ******************************************************************************/
 
@@ -32,7 +32,7 @@
 #include "acnamesp.h"
 
 
-#define _COMPONENT          NAMESPACE
+#define _COMPONENT          ACPI_NAMESPACE
 	 MODULE_NAME         ("nseval")
 
 
@@ -88,11 +88,11 @@
 
 	/* Get the prefix handle and Node */
 
-	acpi_cm_acquire_mutex (ACPI_MTX_NAMESPACE);
+	acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
 
 	prefix_node = acpi_ns_convert_handle_to_entry (handle);
 	if (!prefix_node) {
-		acpi_cm_release_mutex (ACPI_MTX_NAMESPACE);
+		acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
 		status = AE_BAD_PARAMETER;
 		goto cleanup;
 	}
@@ -104,7 +104,7 @@
 			 IMODE_EXECUTE, NS_NO_UPSEARCH, NULL,
 			 &node);
 
-	acpi_cm_release_mutex (ACPI_MTX_NAMESPACE);
+	acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
 
 	if (ACPI_FAILURE (status)) {
 		goto cleanup;
@@ -119,10 +119,7 @@
 
 cleanup:
 
-	/* Cleanup */
-
-	acpi_cm_free (internal_path);
-
+	acpi_ut_free (internal_path);
 	return (status);
 }
 
@@ -165,7 +162,7 @@
 		return (status);
 	}
 
-	acpi_cm_acquire_mutex (ACPI_MTX_NAMESPACE);
+	acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
 
 	/* Lookup the name in the namespace */
 
@@ -173,7 +170,7 @@
 			 IMODE_EXECUTE, NS_NO_UPSEARCH, NULL,
 			 &node);
 
-	acpi_cm_release_mutex (ACPI_MTX_NAMESPACE);
+	acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
 
 	if (ACPI_FAILURE (status)) {
 		goto cleanup;
@@ -192,7 +189,7 @@
 	/* Cleanup */
 
 	if (internal_path) {
-		acpi_cm_free (internal_path);
+		acpi_ut_free (internal_path);
 	}
 
 	return (status);
@@ -249,11 +246,11 @@
 
 	/* Get the prefix handle and Node */
 
-	acpi_cm_acquire_mutex (ACPI_MTX_NAMESPACE);
+	acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
 
 	node = acpi_ns_convert_handle_to_entry (handle);
 	if (!node) {
-		acpi_cm_release_mutex (ACPI_MTX_NAMESPACE);
+		acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
 		return (AE_BAD_PARAMETER);
 	}
 
@@ -348,6 +345,15 @@
 	ACPI_OPERAND_OBJECT     *obj_desc;
 
 
+	/* Verify that there is a method associated with this object */
+
+	obj_desc = acpi_ns_get_attached_object (method_node);
+	if (!obj_desc) {
+		acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+		return (AE_ERROR);
+	}
+
+
 	/*
 	 * Unlock the namespace before execution.  This allows namespace access
 	 * via the external Acpi* interfaces while a method is being executed.
@@ -355,21 +361,12 @@
 	 * interpreter locks to ensure that no thread is using the portion of the
 	 * namespace that is being deleted.
 	 */
-
-	acpi_cm_release_mutex (ACPI_MTX_NAMESPACE);
-
-	/* Verify that there is a method associated with this object */
-
-	obj_desc = acpi_ns_get_attached_object ((ACPI_HANDLE) method_node);
-	if (!obj_desc) {
-		return (AE_ERROR);
-	}
-
+	acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
 
 	/*
 	 * Execute the method via the interpreter
 	 */
-	status = acpi_aml_execute_method (method_node, params, return_obj_desc);
+	status = acpi_ex_execute_method (method_node, params, return_obj_desc);
 
 	return (status);
 }
@@ -404,12 +401,11 @@
 	 */
 
 	if ((node->type == ACPI_TYPE_PROCESSOR) ||
-		(node->type == ACPI_TYPE_POWER))
-	{
+		(node->type == ACPI_TYPE_POWER)) {
 		/*
 		 *  Create a Reference object to contain the object
 		 */
-		obj_desc = acpi_cm_create_internal_object (node->type);
+		obj_desc = acpi_ut_create_internal_object (node->type);
 		if (!obj_desc) {
 		   status = AE_NO_MEMORY;
 		   goto unlock_and_exit;
@@ -434,6 +430,7 @@
 
 		MEMCPY (obj_desc, val_desc, sizeof (ACPI_OPERAND_OBJECT));
 		obj_desc->common.reference_count = 1;
+		acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
 	}
 
 
@@ -444,7 +441,7 @@
 	else {
 		/* Create an Reference object to contain the object */
 
-		obj_desc = acpi_cm_create_internal_object (INTERNAL_TYPE_REFERENCE);
+		obj_desc = acpi_ut_create_internal_object (INTERNAL_TYPE_REFERENCE);
 		if (!obj_desc) {
 		   status = AE_NO_MEMORY;
 		   goto unlock_and_exit;
@@ -452,32 +449,37 @@
 
 		/* Construct a descriptor pointing to the name */
 
-		obj_desc->reference.op_code = (u8) AML_NAME_OP;
+		obj_desc->reference.opcode = (u8) AML_NAME_OP;
 		obj_desc->reference.object = (void *) node;
 
 		/*
-		 * Use Acpi_aml_resolve_to_value() to get the associated value.
-		 * The call to Acpi_aml_resolve_to_value causes
-		 * Obj_desc (allocated above) to always be deleted.
+		 * Use Resolve_to_value() to get the associated value. This call
+		 * always deletes Obj_desc (allocated above).
 		 *
 		 * NOTE: we can get away with passing in NULL for a walk state
 		 * because Obj_desc is guaranteed to not be a reference to either
 		 * a method local or a method argument
 		 *
-		 * Even though we do not technically need to use the interpreter
-		 * for this, we must enter it because we could hit an opregion.
-		 * The opregion access code assumes it is in the interpreter.
+		 * Even though we do not directly invoke the interpreter
+		 * for this, we must enter it because we could access an opregion.
+		 * The opregion access code assumes that the interpreter
+		 * is locked.
+		 *
+		 * We must release the namespace lock before entering the
+		 * intepreter.
 		 */
 
-		acpi_aml_enter_interpreter();
-
-		status = acpi_aml_resolve_to_value (&obj_desc, NULL);
+		acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+		status = acpi_ex_enter_interpreter ();
+		if (ACPI_SUCCESS (status)) {
+			status = acpi_ex_resolve_to_value (&obj_desc, NULL);
 
-		acpi_aml_exit_interpreter();
+			acpi_ex_exit_interpreter ();
+		}
 	}
 
 	/*
-	 * If Acpi_aml_resolve_to_value() succeeded, the return value was
+	 * If Acpi_ex_resolve_to_value() succeeded, the return value was
 	 * placed in Obj_desc.
 	 */
 
@@ -487,11 +489,15 @@
 		*return_obj_desc = obj_desc;
 	}
 
+	/* Namespace is unlocked */
+
+	return (status);
+
 
 unlock_and_exit:
 
 	/* Unlock the namespace */
 
-	acpi_cm_release_mutex (ACPI_MTX_NAMESPACE);
+	acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
 	return (status);
 }
diff -urN linux-2.4.6-pre4/drivers/acpi/namespace/nsinit.c linux/drivers/acpi/namespace/nsinit.c
--- linux-2.4.6-pre4/drivers/acpi/namespace/nsinit.c	Tue Mar  6 19:44:36 2001
+++ linux/drivers/acpi/namespace/nsinit.c	Mon Dec  3 22:48:42 2001
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: nsinit - namespace initialization
- *              $Revision: 15 $
+ *              $Revision: 25 $
  *
  *****************************************************************************/
 
@@ -28,7 +28,7 @@
 #include "acnamesp.h"
 #include "acdispat.h"
 
-#define _COMPONENT          NAMESPACE
+#define _COMPONENT          ACPI_NAMESPACE
 	 MODULE_NAME         ("nsinit")
 
 
@@ -70,7 +70,7 @@
 }
 
 
-/******************************************************************************
+/*******************************************************************************
  *
  * FUNCTION:    Acpi_ns_initialize_devices
  *
@@ -81,11 +81,10 @@
  * DESCRIPTION: Walk the entire namespace and initialize all ACPI devices.
  *              This means running _INI on all present devices.
  *
- *              Also: Install PCI config space handler for all PCI root bridges.
- *              A PCI root bridge is found by searching for devices containing
- *              a HID with the value EISAID("PNP0A03")
+ *              Note: We install PCI config space handler on region access,
+ *              not here.
  *
- *****************************************************************************/
+ ******************************************************************************/
 
 ACPI_STATUS
 acpi_ns_initialize_devices (
@@ -100,8 +99,8 @@
 	info.num_INI = 0;
 
 
-	status = acpi_ns_walk_namespace (ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
-			   FALSE, acpi_ns_init_one_device, &info, NULL);
+	status = acpi_ns_walk_namespace (ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
+			  ACPI_UINT32_MAX, FALSE, acpi_ns_init_one_device, &info, NULL);
 
 
 
@@ -136,7 +135,7 @@
 	void                    *context,
 	void                    **return_value)
 {
-	OBJECT_TYPE_INTERNAL    type;
+	ACPI_OBJECT_TYPE8       type;
 	ACPI_STATUS             status;
 	ACPI_INIT_WALK_INFO     *info = (ACPI_INIT_WALK_INFO *) context;
 	ACPI_NAMESPACE_NODE     *node = (ACPI_NAMESPACE_NODE *) obj_handle;
@@ -154,8 +153,7 @@
 		return (AE_OK);
 	}
 
-	switch (type)
-	{
+	switch (type) {
 
 	case ACPI_TYPE_REGION:
 
@@ -171,7 +169,7 @@
 		break;
 
 
-	case ACPI_TYPE_FIELD_UNIT:
+	case ACPI_TYPE_BUFFER_FIELD:
 
 		info->field_count++;
 		if (obj_desc->common.flags & AOPOBJ_DATA_VALID) {
@@ -179,7 +177,7 @@
 		}
 
 		info->field_init++;
-		status = acpi_ds_get_field_unit_arguments (obj_desc);
+		status = acpi_ds_get_buffer_field_arguments (obj_desc);
 
 
 		break;
@@ -196,11 +194,11 @@
 }
 
 
-/******************************************************************************
+/*******************************************************************************
  *
  * FUNCTION:    Acpi_ns_init_one_device
  *
- * PARAMETERS:  WALK_CALLBACK
+ * PARAMETERS:  ACPI_WALK_CALLBACK
  *
  * RETURN:      ACPI_STATUS
  *
@@ -208,7 +206,7 @@
  *              to initialize each device. It determines if the device is
  *              present, and if so, calls _INI.
  *
- *****************************************************************************/
+ ******************************************************************************/
 
 ACPI_STATUS
 acpi_ns_init_one_device (
@@ -226,21 +224,21 @@
 
 	info->device_count++;
 
-	acpi_cm_acquire_mutex (ACPI_MTX_NAMESPACE);
+	acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
 
 	node = acpi_ns_convert_handle_to_entry (obj_handle);
 	if (!node) {
-		acpi_cm_release_mutex (ACPI_MTX_NAMESPACE);
+		acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
 		return (AE_BAD_PARAMETER);
 	}
 
-	acpi_cm_release_mutex (ACPI_MTX_NAMESPACE);
+	acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
 
 	/*
 	 * Run _STA to determine if we can run _INI on the device.
 	 */
 
-	status = acpi_cm_execute_STA (node, &flags);
+	status = acpi_ut_execute_STA (node, &flags);
 	if (ACPI_FAILURE (status)) {
 		/* Ignore error and move on to next device */
 
@@ -251,6 +249,7 @@
 
 	if (!(flags & 0x01)) {
 		/* don't look at children of a not present device */
+
 		return(AE_CTRL_DEPTH);
 	}
 
@@ -258,10 +257,10 @@
 	/*
 	 * The device is present. Run _INI.
 	 */
-
 	status = acpi_ns_evaluate_relative (obj_handle, "_INI", NULL, NULL);
 	if (AE_NOT_FOUND == status) {
 		/* No _INI means device requires no initialization */
+
 		status = AE_OK;
 	}
 
diff -urN linux-2.4.6-pre4/drivers/acpi/namespace/nsload.c linux/drivers/acpi/namespace/nsload.c
--- linux-2.4.6-pre4/drivers/acpi/namespace/nsload.c	Mon Jan 22 13:23:43 2001
+++ linux/drivers/acpi/namespace/nsload.c	Mon Dec  3 22:48:42 2001
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: nsload - namespace loading/expanding/contracting procedures
- *              $Revision: 35 $
+ *              $Revision: 41 $
  *
  *****************************************************************************/
 
@@ -33,11 +33,11 @@
 #include "acdebug.h"
 
 
-#define _COMPONENT          NAMESPACE
+#define _COMPONENT          ACPI_NAMESPACE
 	 MODULE_NAME         ("nsload")
 
 
-/******************************************************************************
+/*******************************************************************************
  *
  * FUNCTION:    Acpi_load_namespace
  *
@@ -107,8 +107,7 @@
 	ACPI_STATUS             status;
 
 
-	switch (pass_number)
-	{
+	switch (pass_number) {
 	case 1:
 		descending_callback = acpi_ds_load1_begin_op;
 		ascending_callback = acpi_ds_load1_end_op;
@@ -140,16 +139,13 @@
 
 	/* Pass 1:  Parse everything except control method bodies */
 
-	status = acpi_ps_parse_aml (parse_root,
-			 table_desc->aml_pointer,
+	status = acpi_ps_parse_aml (parse_root, table_desc->aml_pointer,
 			 table_desc->aml_length,
 			 ACPI_PARSE_LOAD_PASS1 | ACPI_PARSE_DELETE_TREE,
-			 NULL, NULL, NULL,
-			 descending_callback,
+			 NULL, NULL, NULL, descending_callback,
 			 ascending_callback);
 
 	acpi_ps_delete_parse_tree (parse_root);
-
 	return (status);
 }
 
@@ -211,7 +207,7 @@
 }
 
 
-/*****************************************************************************
+/*******************************************************************************
  *
  * FUNCTION:    Acpi_ns_load_table
  *
@@ -222,7 +218,7 @@
  *
  * DESCRIPTION: Load one ACPI table into the namespace
  *
- ****************************************************************************/
+ ******************************************************************************/
 
 ACPI_STATUS
 acpi_ns_load_table (
@@ -252,9 +248,9 @@
 	 * because we don't know how many arguments to parse next!
 	 */
 
-	acpi_cm_acquire_mutex (ACPI_MTX_NAMESPACE);
+	acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
 	status = acpi_ns_parse_table (table_desc, node->child);
-	acpi_cm_release_mutex (ACPI_MTX_NAMESPACE);
+	acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
 
 	if (ACPI_FAILURE (status)) {
 		return (status);
@@ -273,7 +269,7 @@
 }
 
 
-/******************************************************************************
+/*******************************************************************************
  *
  * FUNCTION:    Acpi_ns_load_table_by_type
  *
@@ -285,7 +281,7 @@
  *              of the given type are loaded.  The mechanism allows this
  *              routine to be called repeatedly.
  *
- *****************************************************************************/
+ ******************************************************************************/
 
 ACPI_STATUS
 acpi_ns_load_table_by_type (
@@ -293,11 +289,10 @@
 {
 	u32                     i;
 	ACPI_STATUS             status = AE_OK;
-	ACPI_TABLE_HEADER       *table_ptr;
 	ACPI_TABLE_DESC         *table_desc;
 
 
-	acpi_cm_acquire_mutex (ACPI_MTX_TABLES);
+	acpi_ut_acquire_mutex (ACPI_MTX_TABLES);
 
 
 	/*
@@ -305,8 +300,7 @@
 	 * DSDT (one), SSDT/PSDT (multiple)
 	 */
 
-	switch (table_type)
-	{
+	switch (table_type) {
 
 	case ACPI_TABLE_DSDT:
 
@@ -338,16 +332,13 @@
 
 		table_desc = &acpi_gbl_acpi_tables[ACPI_TABLE_SSDT];
 		for (i = 0; i < acpi_gbl_acpi_tables[ACPI_TABLE_SSDT].count; i++) {
-			table_ptr = table_desc->pointer;
-
 			/*
 			 * Only attempt to load table if it is not
 			 * already loaded!
 			 */
 
 			if (!table_desc->loaded_into_namespace) {
-				status = acpi_ns_load_table (table_desc,
-						  acpi_gbl_root_node);
+				status = acpi_ns_load_table (table_desc, acpi_gbl_root_node);
 				if (ACPI_FAILURE (status)) {
 					break;
 				}
@@ -357,7 +348,6 @@
 
 			table_desc = table_desc->next;
 		}
-
 		break;
 
 
@@ -370,13 +360,10 @@
 		table_desc = &acpi_gbl_acpi_tables[ACPI_TABLE_PSDT];
 
 		for (i = 0; i < acpi_gbl_acpi_tables[ACPI_TABLE_PSDT].count; i++) {
-			table_ptr = table_desc->pointer;
-
 			/* Only attempt to load table if it is not already loaded! */
 
 			if (!table_desc->loaded_into_namespace) {
-				status = acpi_ns_load_table (table_desc,
-						  acpi_gbl_root_node);
+				status = acpi_ns_load_table (table_desc, acpi_gbl_root_node);
 				if (ACPI_FAILURE (status)) {
 					break;
 				}
@@ -392,19 +379,20 @@
 
 	default:
 		status = AE_SUPPORT;
+		break;
 	}
 
 
 unlock_and_exit:
 
-	acpi_cm_release_mutex (ACPI_MTX_TABLES);
+	acpi_ut_release_mutex (ACPI_MTX_TABLES);
 
 	return (status);
 
 }
 
 
-/******************************************************************************
+/*******************************************************************************
  *
  * FUNCTION:    Acpi_ns_delete_subtree
  *
@@ -432,9 +420,9 @@
 	u32                     level;
 
 
-	parent_handle   = start_handle;
-	child_handle    = 0;
-	level           = 1;
+	parent_handle = start_handle;
+	child_handle = 0;
+	level        = 1;
 
 	/*
 	 * Traverse the tree of objects until we bubble back up
@@ -445,8 +433,7 @@
 		/* Attempt to get the next object in this scope */
 
 		status = acpi_get_next_object (ACPI_TYPE_ANY, parent_handle,
-				  child_handle,
-				  &next_child_handle);
+				  child_handle, &next_child_handle);
 
 		child_handle = next_child_handle;
 
@@ -456,18 +443,16 @@
 		if (ACPI_SUCCESS (status)) {
 			/* Check if this object has any children */
 
-			if (ACPI_SUCCESS (acpi_get_next_object (ACPI_TYPE_ANY,
-					 child_handle, 0,
-					 &dummy)))
-			{
+			if (ACPI_SUCCESS (acpi_get_next_object (ACPI_TYPE_ANY, child_handle,
+					 0, &dummy))) {
 				/*
 				 * There is at least one child of this object,
 				 * visit the object
 				 */
 
 				level++;
-				parent_handle   = child_handle;
-				child_handle    = 0;
+				parent_handle = child_handle;
+				child_handle = 0;
 			}
 		}
 
@@ -491,12 +476,11 @@
 
 	acpi_ns_delete_node (child_handle);
 
-
 	return (AE_OK);
 }
 
 
-/****************************************************************************
+/*******************************************************************************
  *
  *  FUNCTION:       Acpi_ns_unload_name_space
  *
@@ -508,7 +492,7 @@
  *                  event.  Deletes an entire subtree starting from (and
  *                  including) the given handle.
  *
- ****************************************************************************/
+ ******************************************************************************/
 
 ACPI_STATUS
 acpi_ns_unload_namespace (
diff -urN linux-2.4.6-pre4/drivers/acpi/namespace/nsnames.c linux/drivers/acpi/namespace/nsnames.c
--- linux-2.4.6-pre4/drivers/acpi/namespace/nsnames.c	Fri Feb  9 11:45:58 2001
+++ linux/drivers/acpi/namespace/nsnames.c	Mon Dec  3 22:48:42 2001
@@ -1,7 +1,7 @@
 /*******************************************************************************
  *
  * Module Name: nsnames - Name manipulation and search
- *              $Revision: 54 $
+ *              $Revision: 59 $
  *
  ******************************************************************************/
 
@@ -30,7 +30,7 @@
 #include "acnamesp.h"
 
 
-#define _COMPONENT          NAMESPACE
+#define _COMPONENT          ACPI_NAMESPACE
 	 MODULE_NAME         ("nsnames")
 
 
@@ -84,7 +84,7 @@
 
 	/* Allocate a buffer to be returned to caller */
 
-	name_buffer = acpi_cm_callocate (size + 1);
+	name_buffer = acpi_ut_callocate (size + 1);
 	if (!name_buffer) {
 		REPORT_ERROR (("Ns_get_table_pathname: allocation failure\n"));
 		return (NULL);
@@ -95,8 +95,7 @@
 
 	name_buffer[size] = '\0';
 	while ((size > ACPI_NAME_SIZE) &&
-		acpi_ns_get_parent_object (child_node))
-	{
+		acpi_ns_get_parent_object (child_node)) {
 		size -= ACPI_NAME_SIZE;
 		name = acpi_ns_find_parent_name (child_node);
 
@@ -138,8 +137,7 @@
 	 */
 	for (size = 0, next_node = node;
 		  acpi_ns_get_parent_object (next_node);
-		  next_node = acpi_ns_get_parent_object (next_node))
-	{
+		  next_node = acpi_ns_get_parent_object (next_node)) {
 		size += PATH_SEGMENT_LENGTH;
 	}
 
@@ -184,7 +182,7 @@
 	u32                     size;
 
 
-	if (!acpi_gbl_root_node || !target_handle) {
+	if (!acpi_gbl_root_node) {
 		/*
 		 * If the name space has not been initialized,
 		 * this function should not have been called.
diff -urN linux-2.4.6-pre4/drivers/acpi/namespace/nsobject.c linux/drivers/acpi/namespace/nsobject.c
--- linux-2.4.6-pre4/drivers/acpi/namespace/nsobject.c	Mon Jan 22 13:23:43 2001
+++ linux/drivers/acpi/namespace/nsobject.c	Mon Dec  3 22:48:42 2001
@@ -2,7 +2,7 @@
  *
  * Module Name: nsobject - Utilities for objects attached to namespace
  *                         table entries
- *              $Revision: 49 $
+ *              $Revision: 55 $
  *
  ******************************************************************************/
 
@@ -32,7 +32,7 @@
 #include "actables.h"
 
 
-#define _COMPONENT          NAMESPACE
+#define _COMPONENT          ACPI_NAMESPACE
 	 MODULE_NAME         ("nsobject")
 
 
@@ -57,11 +57,11 @@
 acpi_ns_attach_object (
 	ACPI_NAMESPACE_NODE     *node,
 	ACPI_OPERAND_OBJECT     *object,
-	OBJECT_TYPE_INTERNAL    type)
+	ACPI_OBJECT_TYPE8       type)
 {
 	ACPI_OPERAND_OBJECT     *obj_desc;
 	ACPI_OPERAND_OBJECT     *previous_obj_desc;
-	OBJECT_TYPE_INTERNAL    obj_type = ACPI_TYPE_ANY;
+	ACPI_OBJECT_TYPE8      obj_type = ACPI_TYPE_ANY;
 	u8                      flags;
 	u16                     opcode;
 
@@ -124,8 +124,7 @@
 	 */
 
 	else if (VALID_DESCRIPTOR_TYPE (object, ACPI_DESC_TYPE_NAMED) &&
-			((ACPI_NAMESPACE_NODE *) object)->object)
-	{
+			((ACPI_NAMESPACE_NODE *) object)->object) {
 		/*
 		 * Value passed is a name handle and that name has a
 		 * non-null value.  Use that name's value and type.
@@ -183,10 +182,9 @@
 
 			MOVE_UNALIGNED16_TO_16 (&opcode, object);
 
-			/* Check for a recognized Op_code */
+			/* Check for a recognized Opcode */
 
-			switch ((u8) opcode)
-			{
+			switch ((u8) opcode) {
 
 			case AML_OP_PREFIX:
 
@@ -257,7 +255,7 @@
 	 * (if it is an internal object)
 	 */
 
-	acpi_cm_add_reference (obj_desc);
+	acpi_ut_add_reference (obj_desc);
 
 	/* Save the existing object (if any) for deletion later */
 
@@ -277,11 +275,11 @@
 	if (previous_obj_desc) {
 		/* One for the attach to the Node */
 
-		acpi_cm_remove_reference (previous_obj_desc);
+		acpi_ut_remove_reference (previous_obj_desc);
 
 		/* Now delete */
 
-		acpi_cm_remove_reference (previous_obj_desc);
+		acpi_ut_remove_reference (previous_obj_desc);
 	}
 
 	return (AE_OK);
@@ -321,14 +319,14 @@
 	/* Found a valid value */
 
 	/*
-	 * Not every value is an object allocated via Acpi_cm_callocate,
+	 * Not every value is an object allocated via Acpi_ut_callocate,
 	 * - must check
 	 */
 
 	if (!acpi_tb_system_table_pointer (obj_desc)) {
 		/* Attempt to delete the object (and all subobjects) */
 
-		acpi_cm_remove_reference (obj_desc);
+		acpi_ut_remove_reference (obj_desc);
 	}
 
 	return;
@@ -339,7 +337,7 @@
  *
  * FUNCTION:    Acpi_ns_get_attached_object
  *
- * PARAMETERS:  Handle              - Parent Node to be examined
+ * PARAMETERS:  Node             - Parent Node to be examined
  *
  * RETURN:      Current value of the object field from the Node whose
  *              handle is passed
@@ -348,16 +346,16 @@
 
 void *
 acpi_ns_get_attached_object (
-	ACPI_HANDLE             handle)
+	ACPI_NAMESPACE_NODE     *node)
 {
 
-	if (!handle) {
+	if (!node) {
 		/* handle invalid */
 
 		return (NULL);
 	}
 
-	return (((ACPI_NAMESPACE_NODE *) handle)->object);
+	return (node->object);
 }
 
 
diff -urN linux-2.4.6-pre4/drivers/acpi/namespace/nssearch.c linux/drivers/acpi/namespace/nssearch.c
--- linux-2.4.6-pre4/drivers/acpi/namespace/nssearch.c	Mon Jan 29 10:15:59 2001
+++ linux/drivers/acpi/namespace/nssearch.c	Mon Dec  3 22:48:42 2001
@@ -1,7 +1,7 @@
 /*******************************************************************************
  *
  * Module Name: nssearch - Namespace search
- *              $Revision: 64 $
+ *              $Revision: 70 $
  *
  ******************************************************************************/
 
@@ -30,7 +30,7 @@
 #include "acnamesp.h"
 
 
-#define _COMPONENT          NAMESPACE
+#define _COMPONENT          ACPI_NAMESPACE
 	 MODULE_NAME         ("nssearch")
 
 
@@ -39,9 +39,9 @@
  * FUNCTION:    Acpi_ns_search_node
  *
  * PARAMETERS:  *Target_name        - Ascii ACPI name to search for
- *              *Node           - Starting table where search will begin
+ *              *Node               - Starting table where search will begin
  *              Type                - Object type to match
- *              **Return_node   - Where the matched Named obj is returned
+ *              **Return_node       - Where the matched Named obj is returned
  *
  * RETURN:      Status
  *
@@ -64,7 +64,7 @@
 acpi_ns_search_node (
 	u32                     target_name,
 	ACPI_NAMESPACE_NODE     *node,
-	OBJECT_TYPE_INTERNAL    type,
+	ACPI_OBJECT_TYPE8       type,
 	ACPI_NAMESPACE_NODE     **return_node)
 {
 	ACPI_NAMESPACE_NODE     *next_node;
@@ -81,36 +81,29 @@
 
 		if (next_node->name == target_name) {
 			/*
-			 * Found matching entry.  Capture type if
-			 * appropriate before returning the entry.
+			 * Found matching entry.  Capture the type if appropriate, before
+			 * returning the entry.
+			 *
+			 * The Def_field_defn and Bank_field_defn cases are actually looking up
+			 * the Region in which the field will be defined
 			 */
 
-			/*
-			 * The Def_field_defn and Bank_field_defn cases
-			 * are actually looking up the Region in which
-			 * the field will be defined
-			 */
-
-			if ((INTERNAL_TYPE_DEF_FIELD_DEFN == type) ||
-				(INTERNAL_TYPE_BANK_FIELD_DEFN == type))
-			{
+			if ((INTERNAL_TYPE_FIELD_DEFN == type) ||
+				(INTERNAL_TYPE_BANK_FIELD_DEFN == type)) {
 				type = ACPI_TYPE_REGION;
 			}
 
 			/*
-			 * Scope, Def_any, and Index_field_defn are bogus
-			 * "types" which do not actually have anything
-			 * to do with the type of the name being looked
-			 * up.  For any other value of Type, if the type
-			 * stored in the entry is Any (i.e. unknown),
-			 * save the actual type.
+			 * Scope, Def_any, and Index_field_defn are bogus "types" which do not
+			 * actually have anything to do with the type of the name being
+			 * looked up.  For any other value of Type, if the type stored in
+			 * the entry is Any (i.e. unknown), save the actual type.
 			 */
 
 			if (type != INTERNAL_TYPE_SCOPE &&
 				type != INTERNAL_TYPE_DEF_ANY &&
 				type != INTERNAL_TYPE_INDEX_FIELD_DEFN &&
-				next_node->type == ACPI_TYPE_ANY)
-			{
+				next_node->type == ACPI_TYPE_ANY) {
 				next_node->type = (u8) type;
 			}
 
@@ -137,7 +130,6 @@
 
 	/* Searched entire table, not found */
 
-
 	return (AE_NOT_FOUND);
 }
 
@@ -147,9 +139,9 @@
  * FUNCTION:    Acpi_ns_search_parent_tree
  *
  * PARAMETERS:  *Target_name        - Ascii ACPI name to search for
- *              *Node           - Starting table where search will begin
+ *              *Node               - Starting table where search will begin
  *              Type                - Object type to match
- *              **Return_node   - Where the matched Named Obj is returned
+ *              **Return_node       - Where the matched Named Obj is returned
  *
  * RETURN:      Status
  *
@@ -171,7 +163,7 @@
 acpi_ns_search_parent_tree (
 	u32                     target_name,
 	ACPI_NAMESPACE_NODE     *node,
-	OBJECT_TYPE_INTERNAL    type,
+	ACPI_OBJECT_TYPE8       type,
 	ACPI_NAMESPACE_NODE     **return_node)
 {
 	ACPI_STATUS             status;
@@ -184,9 +176,8 @@
 	 * If there is no parent (at the root) or type is "local", we won't be
 	 * searching the parent tree.
 	 */
-	if ((acpi_ns_local (type))  ||
-		(!parent_node))
-	{
+	if ((acpi_ns_local (type)) ||
+		(!parent_node)) {
 
 
 		return (AE_NOT_FOUND);
@@ -199,7 +190,6 @@
 	 * Search parents until found the target or we have backed up to
 	 * the root
 	 */
-
 	while (parent_node) {
 		/* Search parent scope */
 		/* TBD: [Investigate] Why ACPI_TYPE_ANY? */
@@ -232,12 +222,12 @@
  *
  * PARAMETERS:  Target_name         - Ascii ACPI name to search for (4 chars)
  *              Walk_state          - Current state of the walk
- *              *Node           - Starting table where search will begin
+ *              *Node               - Starting table where search will begin
  *              Interpreter_mode    - Add names only in MODE_Load_pass_x.
  *                                    Otherwise,search only.
  *              Type                - Object type to match
  *              Flags               - Flags describing the search restrictions
- *              **Return_node   - Where the Node is returned
+ *              **Return_node       - Where the Node is returned
  *
  * RETURN:      Status
  *
@@ -257,7 +247,7 @@
 	ACPI_WALK_STATE         *walk_state,
 	ACPI_NAMESPACE_NODE     *node,
 	OPERATING_MODE          interpreter_mode,
-	OBJECT_TYPE_INTERNAL    type,
+	ACPI_OBJECT_TYPE8       type,
 	u32                     flags,
 	ACPI_NAMESPACE_NODE     **return_node)
 {
@@ -275,7 +265,7 @@
 
 	/* Name must consist of printable characters */
 
-	if (!acpi_cm_valid_acpi_name (target_name)) {
+	if (!acpi_ut_valid_acpi_name (target_name)) {
 		REPORT_ERROR (("Ns_search_and_enter: Bad character in ACPI Name\n"));
 		return (AE_BAD_CHARACTER);
 	}
@@ -284,16 +274,14 @@
 	/* Try to find the name in the table specified by the caller */
 
 	*return_node = ENTRY_NOT_FOUND;
-	status = acpi_ns_search_node (target_name, node,
-			   type, return_node);
+	status = acpi_ns_search_node (target_name, node, type, return_node);
 	if (status != AE_NOT_FOUND) {
 		/*
-		 * If we found it AND the request specifies that a
-		 * find is an error, return the error
+		 * If we found it AND the request specifies that a find is an error,
+		 * return the error
 		 */
 		if ((status == AE_OK) &&
-			(flags & NS_ERROR_IF_FOUND))
-		{
+			(flags & NS_ERROR_IF_FOUND)) {
 			status = AE_EXIST;
 		}
 
@@ -316,8 +304,7 @@
 	 */
 
 	if ((interpreter_mode != IMODE_LOAD_PASS1) &&
-		(flags & NS_SEARCH_PARENT))
-	{
+		(flags & NS_SEARCH_PARENT)) {
 		/*
 		 * Not found in table - search parent tree according
 		 * to ACPI specification
diff -urN linux-2.4.6-pre4/drivers/acpi/namespace/nsutils.c linux/drivers/acpi/namespace/nsutils.c
--- linux-2.4.6-pre4/drivers/acpi/namespace/nsutils.c	Mon Jan 29 10:15:59 2001
+++ linux/drivers/acpi/namespace/nsutils.c	Mon Dec  3 22:48:42 2001
@@ -2,7 +2,7 @@
  *
  * Module Name: nsutils - Utilities for accessing ACPI namespace, accessing
  *                        parents and siblings and Scope manipulation
- *              $Revision: 77 $
+ *              $Revision: 83 $
  *
  *****************************************************************************/
 
@@ -31,11 +31,11 @@
 #include "amlcode.h"
 #include "actables.h"
 
-#define _COMPONENT          NAMESPACE
+#define _COMPONENT          ACPI_NAMESPACE
 	 MODULE_NAME         ("nsutils")
 
 
-/****************************************************************************
+/*******************************************************************************
  *
  * FUNCTION:    Acpi_ns_valid_root_prefix
  *
@@ -45,7 +45,7 @@
  *
  * DESCRIPTION: Check if a character is a valid ACPI Root prefix
  *
- ***************************************************************************/
+ ******************************************************************************/
 
 u8
 acpi_ns_valid_root_prefix (
@@ -56,7 +56,7 @@
 }
 
 
-/****************************************************************************
+/*******************************************************************************
  *
  * FUNCTION:    Acpi_ns_valid_path_separator
  *
@@ -66,7 +66,7 @@
  *
  * DESCRIPTION: Check if a character is a valid ACPI path separator
  *
- ***************************************************************************/
+ ******************************************************************************/
 
 u8
 acpi_ns_valid_path_separator (
@@ -77,7 +77,7 @@
 }
 
 
-/****************************************************************************
+/*******************************************************************************
  *
  * FUNCTION:    Acpi_ns_get_type
  *
@@ -85,23 +85,23 @@
  *
  * RETURN:      Type field from Node whose handle is passed
  *
- ***************************************************************************/
+ ******************************************************************************/
 
-OBJECT_TYPE_INTERNAL
+ACPI_OBJECT_TYPE8
 acpi_ns_get_type (
-	ACPI_HANDLE             handle)
+	ACPI_NAMESPACE_NODE     *node)
 {
 
-	if (!handle) {
-		REPORT_WARNING (("Ns_get_type: Null handle\n"));
+	if (!node) {
+		REPORT_WARNING (("Ns_get_type: Null Node ptr"));
 		return (ACPI_TYPE_ANY);
 	}
 
-	return (((ACPI_NAMESPACE_NODE *) handle)->type);
+	return (node->type);
 }
 
 
-/****************************************************************************
+/*******************************************************************************
  *
  * FUNCTION:    Acpi_ns_local
  *
@@ -110,14 +110,14 @@
  * RETURN:      LOCAL if names must be found locally in objects of the
  *              passed type, 0 if enclosing scopes should be searched
  *
- ***************************************************************************/
+ ******************************************************************************/
 
 u32
 acpi_ns_local (
-	OBJECT_TYPE_INTERNAL    type)
+	ACPI_OBJECT_TYPE8       type)
 {
 
-	if (!acpi_cm_valid_object_type (type)) {
+	if (!acpi_ut_valid_object_type (type)) {
 		/* Type code out of range  */
 
 		REPORT_WARNING (("Ns_local: Invalid Object Type\n"));
@@ -128,41 +128,32 @@
 }
 
 
-/****************************************************************************
+/*******************************************************************************
  *
- * FUNCTION:    Acpi_ns_internalize_name
+ * FUNCTION:    Acpi_ns_get_internal_name_length
  *
- * PARAMETERS:  *External_name            - External representation of name
- *              **Converted Name        - Where to return the resulting
- *                                        internal represention of the name
+ * PARAMETERS:  Info            - Info struct initialized with the
+ *                                external name pointer.
  *
  * RETURN:      Status
  *
- * DESCRIPTION: Convert an external representation (e.g. "\_PR_.CPU0")
- *              to internal form (e.g. 5c 2f 02 5f 50 52 5f 43 50 55 30)
+ * DESCRIPTION: Calculate the length of the internal (AML) namestring
+ *              corresponding to the external (ASL) namestring.
  *
- ****************************************************************************/
+ ******************************************************************************/
 
 ACPI_STATUS
-acpi_ns_internalize_name (
-	NATIVE_CHAR             *external_name,
-	NATIVE_CHAR             **converted_name)
+acpi_ns_get_internal_name_length (
+	ACPI_NAMESTRING_INFO    *info)
 {
-	NATIVE_CHAR             *result = NULL;
-	NATIVE_CHAR             *internal_name;
-	u32                     num_segments = 0;
-	u8                      fully_qualified = FALSE;
+	NATIVE_CHAR             *next_external_char;
 	u32                     i;
-	u32                     num_carats = 0;
 
 
-	if ((!external_name)     ||
-		(*external_name == 0) ||
-		(!converted_name))
-	{
-		return (AE_BAD_PARAMETER);
-	}
-
+	next_external_char = info->external_name;
+	info->num_carats = 0;
+	info->num_segments = 0;
+	info->fully_qualified = FALSE;
 
 	/*
 	 * For the internal name, the required length is 4 bytes
@@ -173,10 +164,9 @@
 	 * strlen() + 1 covers the first Name_seg, which has no
 	 * path separator
 	 */
-
-	if (acpi_ns_valid_root_prefix (external_name[0])) {
-		fully_qualified = TRUE;
-		external_name++;
+	if (acpi_ns_valid_root_prefix (next_external_char[0])) {
+		info->fully_qualified = TRUE;
+		next_external_char++;
 	}
 
 	else {
@@ -184,9 +174,9 @@
 		 * Handle Carat prefixes
 		 */
 
-		while (*external_name == '^') {
-			num_carats++;
-			external_name++;
+		while (*next_external_char == '^') {
+			info->num_carats++;
+			next_external_char++;
 		}
 	}
 
@@ -196,28 +186,51 @@
 	 * with one segment since the segment count is (# separators)
 	 * + 1, and zero separators is ok.
 	 */
-
-	if (*external_name) {
-		num_segments = 1;
-		for (i = 0; external_name[i]; i++) {
-			if (acpi_ns_valid_path_separator (external_name[i])) {
-				num_segments++;
+	if (*next_external_char) {
+		info->num_segments = 1;
+		for (i = 0; next_external_char[i]; i++) {
+			if (acpi_ns_valid_path_separator (next_external_char[i])) {
+				info->num_segments++;
 			}
 		}
 	}
 
+	info->length = (ACPI_NAME_SIZE * info->num_segments) +
+			  4 + info->num_carats;
 
-	/* We need a segment to store the internal version of the name */
+	info->next_external_char = next_external_char;
 
-	internal_name = acpi_cm_callocate ((ACPI_NAME_SIZE * num_segments) + 4 + num_carats);
-	if (!internal_name) {
-		return (AE_NO_MEMORY);
-	}
+	return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ns_build_internal_name
+ *
+ * PARAMETERS:  Info            - Info struct fully initialized
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Construct the internal (AML) namestring
+ *              corresponding to the external (ASL) namestring.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_ns_build_internal_name (
+	ACPI_NAMESTRING_INFO    *info)
+{
+	u32                     num_segments = info->num_segments;
+	NATIVE_CHAR             *internal_name = info->internal_name;
+	NATIVE_CHAR             *external_name = info->next_external_char;
+	NATIVE_CHAR             *result = NULL;
+	u32                     i;
 
 
 	/* Setup the correct prefixes, counts, and pointers */
 
-	if (fully_qualified) {
+	if (info->fully_qualified) {
 		internal_name[0] = '\\';
 
 		if (num_segments <= 1) {
@@ -232,7 +245,6 @@
 			internal_name[2] = (char) num_segments;
 			result = &internal_name[3];
 		}
-
 	}
 
 	else {
@@ -240,10 +252,9 @@
 		 * Not fully qualified.
 		 * Handle Carats first, then append the name segments
 		 */
-
 		i = 0;
-		if (num_carats) {
-			for (i = 0; i < num_carats; i++) {
+		if (info->num_carats) {
+			for (i = 0; i < info->num_carats; i++) {
 				internal_name[i] = '^';
 			}
 		}
@@ -270,31 +281,24 @@
 	for (; num_segments; num_segments--) {
 		for (i = 0; i < ACPI_NAME_SIZE; i++) {
 			if (acpi_ns_valid_path_separator (*external_name) ||
-			   (*external_name == 0))
-			{
-				/*
-				 * Pad the segment with underscore(s) if
-				 * segment is short
-				 */
+			   (*external_name == 0)) {
+				/* Pad the segment with underscore(s) if segment is short */
 
 				result[i] = '_';
 			}
 
 			else {
-				/* Convert s8 to uppercase and save it */
+				/* Convert the character to uppercase and save it */
 
 				result[i] = (char) TOUPPER (*external_name);
 				external_name++;
 			}
-
 		}
 
 		/* Now we must have a path separator, or the pathname is bad */
 
 		if (!acpi_ns_valid_path_separator (*external_name) &&
-			(*external_name != 0))
-		{
-			acpi_cm_free (internal_name);
+			(*external_name != 0)) {
 			return (AE_BAD_PARAMETER);
 		}
 
@@ -305,32 +309,87 @@
 	}
 
 
-	/* Return the completed name */
+	/* Terminate the string */
 
-	/* Terminate the string! */
 	*result = 0;
-	*converted_name = internal_name;
 
 
+	return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ns_internalize_name
+ *
+ * PARAMETERS:  *External_name          - External representation of name
+ *              **Converted Name        - Where to return the resulting
+ *                                        internal represention of the name
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Convert an external representation (e.g. "\_PR_.CPU0")
+ *              to internal form (e.g. 5c 2f 02 5f 50 52 5f 43 50 55 30)
+ *
+ *******************************************************************************/
+
+ACPI_STATUS
+acpi_ns_internalize_name (
+	NATIVE_CHAR             *external_name,
+	NATIVE_CHAR             **converted_name)
+{
+	NATIVE_CHAR             *internal_name;
+	ACPI_NAMESTRING_INFO    info;
+	ACPI_STATUS             status;
+
+
+	if ((!external_name)     ||
+		(*external_name == 0) ||
+		(!converted_name)) {
+		return (AE_BAD_PARAMETER);
+	}
+
+
+	/* Get the length of the new internal name */
+
+	info.external_name = external_name;
+	acpi_ns_get_internal_name_length (&info);
+
+	/* We need a segment to store the internal  name */
+
+	internal_name = acpi_ut_callocate (info.length);
+	if (!internal_name) {
+		return (AE_NO_MEMORY);
+	}
+
+	/* Build the name */
 
+	info.internal_name = internal_name;
+	status = acpi_ns_build_internal_name (&info);
+	if (ACPI_FAILURE (status)) {
+		acpi_ut_free (internal_name);
+		return (status);
+	}
+
+	*converted_name = internal_name;
 	return (AE_OK);
 }
 
 
-/****************************************************************************
+/*******************************************************************************
  *
  * FUNCTION:    Acpi_ns_externalize_name
  *
  * PARAMETERS:  *Internal_name         - Internal representation of name
  *              **Converted_name       - Where to return the resulting
- *                                        external representation of name
+ *                                       external representation of name
  *
  * RETURN:      Status
  *
  * DESCRIPTION: Convert internal name (e.g. 5c 2f 02 5f 50 52 5f 43 50 55 30)
  *              to its external form (e.g. "\_PR_.CPU0")
  *
- ****************************************************************************/
+ ******************************************************************************/
 
 ACPI_STATUS
 acpi_ns_externalize_name (
@@ -349,8 +408,7 @@
 	if (!internal_name_length   ||
 		!internal_name          ||
 		!converted_name_length  ||
-		!converted_name)
-	{
+		!converted_name) {
 		return (AE_BAD_PARAMETER);
 	}
 
@@ -358,8 +416,7 @@
 	/*
 	 * Check for a prefix (one '\' | one or more '^').
 	 */
-	switch (internal_name[0])
-	{
+	switch (internal_name[0]) {
 	case '\\':
 		prefix_length = 1;
 		break;
@@ -383,8 +440,7 @@
 	 * 4-byte elements.
 	 */
 	if (prefix_length < internal_name_length) {
-		switch (internal_name[prefix_length])
-		{
+		switch (internal_name[prefix_length]) {
 
 		/* <count> 4-byte names */
 
@@ -440,7 +496,7 @@
 	 * Build Converted_name...
 	 */
 
-	(*converted_name) = acpi_cm_callocate (*converted_name_length);
+	(*converted_name) = acpi_ut_callocate (*converted_name_length);
 	if (!(*converted_name)) {
 		return (AE_NO_MEMORY);
 	}
@@ -468,7 +524,7 @@
 }
 
 
-/****************************************************************************
+/*******************************************************************************
  *
  * FUNCTION:    Acpi_ns_convert_handle_to_entry
  *
@@ -478,7 +534,7 @@
  *
  * DESCRIPTION: Convert a namespace handle to a real Node
  *
- ****************************************************************************/
+ ******************************************************************************/
 
 ACPI_NAMESPACE_NODE *
 acpi_ns_convert_handle_to_entry (
@@ -490,7 +546,6 @@
 	 * TBD: [Future] Real integer handles allow for more verification
 	 * and keep all pointers within this subsystem!
 	 */
-
 	if (!handle) {
 		return (NULL);
 	}
@@ -510,7 +565,7 @@
 }
 
 
-/****************************************************************************
+/*******************************************************************************
  *
  * FUNCTION:    Acpi_ns_convert_entry_to_handle
  *
@@ -520,7 +575,7 @@
  *
  * DESCRIPTION: Convert a real Node to a namespace handle
  *
- ****************************************************************************/
+ ******************************************************************************/
 
 ACPI_HANDLE
 acpi_ns_convert_entry_to_handle (
@@ -533,17 +588,18 @@
 	 * TBD: [Future] Real integer handles allow for more verification
 	 * and keep all pointers within this subsystem!
 	 */
-
 	return ((ACPI_HANDLE) node);
 
 
 /* ---------------------------------------------------
 
-	if (!Node) {
+	if (!Node)
+	{
 		return (NULL);
 	}
 
-	if (Node == Acpi_gbl_Root_node) {
+	if (Node == Acpi_gbl_Root_node)
+	{
 		return (ACPI_ROOT_OBJECT);
 	}
 
@@ -553,7 +609,7 @@
 }
 
 
-/******************************************************************************
+/*******************************************************************************
  *
  * FUNCTION:    Acpi_ns_terminate
  *
@@ -576,12 +632,10 @@
 
 	/*
 	 * 1) Free the entire namespace -- all objects, tables, and stacks
-	 */
-	/*
+	 *
 	 * Delete all objects linked to the root
 	 * (additional table descriptors)
 	 */
-
 	acpi_ns_delete_namespace_subtree (this_node);
 
 	/* Detach any object(s) attached to the root */
@@ -589,23 +643,20 @@
 	obj_desc = acpi_ns_get_attached_object (this_node);
 	if (obj_desc) {
 		acpi_ns_detach_object (this_node);
-		acpi_cm_remove_reference (obj_desc);
+		acpi_ut_remove_reference (obj_desc);
 	}
 
 	acpi_ns_delete_children (this_node);
 
-
 	/*
 	 * 2) Now we can delete the ACPI tables
 	 */
-
 	acpi_tb_delete_acpi_tables ();
-
 	return;
 }
 
 
-/****************************************************************************
+/*******************************************************************************
  *
  * FUNCTION:    Acpi_ns_opens_scope
  *
@@ -614,14 +665,14 @@
  * RETURN:      NEWSCOPE if the passed type "opens a name scope" according
  *              to the ACPI specification, else 0
  *
- ***************************************************************************/
+ ******************************************************************************/
 
 u32
 acpi_ns_opens_scope (
-	OBJECT_TYPE_INTERNAL    type)
+	ACPI_OBJECT_TYPE8       type)
 {
 
-	if (!acpi_cm_valid_object_type (type)) {
+	if (!acpi_ut_valid_object_type (type)) {
 		/* type code out of range  */
 
 		REPORT_WARNING (("Ns_opens_scope: Invalid Object Type\n"));
@@ -632,7 +683,7 @@
 }
 
 
-/****************************************************************************
+/*******************************************************************************
  *
  * FUNCTION:    Acpi_ns_get_node
  *
@@ -650,7 +701,7 @@
  *
  * MUTEX:       Locks namespace
  *
- ***************************************************************************/
+ ******************************************************************************/
 
 ACPI_STATUS
 acpi_ns_get_node (
@@ -682,7 +733,7 @@
 	}
 
 
-	acpi_cm_acquire_mutex (ACPI_MTX_NAMESPACE);
+	acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
 
 	/* Setup lookup scope (search starting point) */
 
@@ -697,17 +748,16 @@
 
 
 
-	acpi_cm_release_mutex (ACPI_MTX_NAMESPACE);
+	acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
 
 	/* Cleanup */
 
-	acpi_cm_free (internal_path);
-
+	acpi_ut_free (internal_path);
 	return (status);
 }
 
 
-/****************************************************************************
+/*******************************************************************************
  *
  * FUNCTION:    Acpi_ns_find_parent_name
  *
@@ -719,7 +769,7 @@
  *              name segment, or "????" if the parent name can't be found
  *              (which "should not happen").
  *
- ***************************************************************************/
+ ******************************************************************************/
 
 ACPI_NAME
 acpi_ns_find_parent_name (
@@ -740,12 +790,11 @@
 
 	}
 
-
 	return (ACPI_UNKNOWN_NAME);
 }
 
 
-/****************************************************************************
+/*******************************************************************************
  *
  * FUNCTION:    Acpi_ns_get_parent_object
  *
@@ -755,7 +804,7 @@
  *
  * DESCRIPTION: Obtain the parent entry for a given entry in the namespace.
  *
- ***************************************************************************/
+ ******************************************************************************/
 
 
 ACPI_NAMESPACE_NODE *
@@ -775,7 +824,6 @@
 	 * This saves putting a parent back pointer in each and
 	 * every named object!
 	 */
-
 	while (!(node->flags & ANOBJ_END_OF_PEER_LIST)) {
 		node = node->peer;
 	}
@@ -785,7 +833,7 @@
 }
 
 
-/****************************************************************************
+/*******************************************************************************
  *
  * FUNCTION:    Acpi_ns_get_next_valid_object
  *
@@ -797,7 +845,7 @@
  * DESCRIPTION: Find the next valid object within a name table.
  *              Useful for implementing NULL-end-of-list loops.
  *
- ***************************************************************************/
+ ******************************************************************************/
 
 
 ACPI_NAMESPACE_NODE *
diff -urN linux-2.4.6-pre4/drivers/acpi/namespace/nswalk.c linux/drivers/acpi/namespace/nswalk.c
--- linux-2.4.6-pre4/drivers/acpi/namespace/nswalk.c	Mon Jan 22 13:23:43 2001
+++ linux/drivers/acpi/namespace/nswalk.c	Mon Dec  3 22:48:42 2001
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: nswalk - Functions for walking the APCI namespace
- *              $Revision: 19 $
+ *              $Revision: 22 $
  *
  *****************************************************************************/
 
@@ -29,7 +29,7 @@
 #include "acnamesp.h"
 
 
-#define _COMPONENT          NAMESPACE
+#define _COMPONENT          ACPI_NAMESPACE
 	 MODULE_NAME         ("nswalk")
 
 
@@ -54,7 +54,7 @@
 
 ACPI_NAMESPACE_NODE *
 acpi_ns_get_next_object (
-	OBJECT_TYPE_INTERNAL    type,
+	ACPI_OBJECT_TYPE8       type,
 	ACPI_NAMESPACE_NODE     *parent_node,
 	ACPI_NAMESPACE_NODE     *child_node)
 {
@@ -139,18 +139,18 @@
 
 ACPI_STATUS
 acpi_ns_walk_namespace (
-	OBJECT_TYPE_INTERNAL    type,
+	ACPI_OBJECT_TYPE8       type,
 	ACPI_HANDLE             start_node,
 	u32                     max_depth,
 	u8                      unlock_before_callback,
-	WALK_CALLBACK           user_function,
+	ACPI_WALK_CALLBACK      user_function,
 	void                    *context,
 	void                    **return_value)
 {
 	ACPI_STATUS             status;
 	ACPI_NAMESPACE_NODE     *child_node;
 	ACPI_NAMESPACE_NODE     *parent_node;
-	OBJECT_TYPE_INTERNAL    child_type;
+	ACPI_OBJECT_TYPE8        child_type;
 	u32                     level;
 
 
@@ -202,18 +202,17 @@
 				 */
 
 				if (unlock_before_callback) {
-					acpi_cm_release_mutex (ACPI_MTX_NAMESPACE);
+					acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
 				}
 
 				status = user_function (child_node, level,
 						 context, return_value);
 
 				if (unlock_before_callback) {
-					acpi_cm_acquire_mutex (ACPI_MTX_NAMESPACE);
+					acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
 				}
 
-				switch (status)
-				{
+				switch (status) {
 				case AE_OK:
 				case AE_CTRL_DEPTH:
 					/* Just keep going */
@@ -242,8 +241,7 @@
 
 			if ((level < max_depth) && (status != AE_CTRL_DEPTH)) {
 				if (acpi_ns_get_next_object (ACPI_TYPE_ANY,
-						 child_node, 0))
-				{
+						 child_node, 0)) {
 					/*
 					 * There is at least one child of this
 					 * object, visit the object
diff -urN linux-2.4.6-pre4/drivers/acpi/namespace/nsxfname.c linux/drivers/acpi/namespace/nsxfname.c
--- linux-2.4.6-pre4/drivers/acpi/namespace/nsxfname.c	Mon Jan 22 13:23:43 2001
+++ linux/drivers/acpi/namespace/nsxfname.c	Mon Dec  3 22:48:42 2001
@@ -2,7 +2,7 @@
  *
  * Module Name: nsxfname - Public interfaces to the ACPI subsystem
  *                         ACPI Namespace oriented interfaces
- *              $Revision: 75 $
+ *              $Revision: 79 $
  *
  *****************************************************************************/
 
@@ -34,7 +34,7 @@
 #include "acevents.h"
 
 
-#define _COMPONENT          NAMESPACE
+#define _COMPONENT          ACPI_NAMESPACE
 	 MODULE_NAME         ("nsxfname")
 
 
@@ -67,6 +67,15 @@
 	ACPI_NAMESPACE_NODE     *prefix_node = NULL;
 
 
+	/* Ensure that ACPI has been initialized */
+
+	ACPI_IS_INITIALIZATION_COMPLETE (status);
+	if (ACPI_FAILURE (status)) {
+		return (status);
+	}
+
+	/* Parameter Validation */
+
 	if (!ret_handle || !pathname) {
 		return (AE_BAD_PARAMETER);
 	}
@@ -74,15 +83,15 @@
 	/* Convert a parent handle to a prefix node */
 
 	if (parent) {
-		acpi_cm_acquire_mutex (ACPI_MTX_NAMESPACE);
+		acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
 
 		prefix_node = acpi_ns_convert_handle_to_entry (parent);
 		if (!prefix_node) {
-			acpi_cm_release_mutex (ACPI_MTX_NAMESPACE);
+			acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
 			return (AE_BAD_PARAMETER);
 		}
 
-		acpi_cm_release_mutex (ACPI_MTX_NAMESPACE);
+		acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
 	}
 
 	/* Special case for root, since we can't search for it */
@@ -132,6 +141,13 @@
 	ACPI_NAMESPACE_NODE     *node;
 
 
+	/* Ensure that ACPI has been initialized */
+
+	ACPI_IS_INITIALIZATION_COMPLETE (status);
+	if (ACPI_FAILURE (status)) {
+		return (status);
+	}
+
 	/* Buffer pointer must be valid always */
 
 	if (!ret_path_ptr || (name_type > ACPI_NAME_TYPE_MAX)) {
@@ -141,8 +157,7 @@
 	/* Allow length to be zero and ignore the pointer */
 
 	if ((ret_path_ptr->length) &&
-	   (!ret_path_ptr->pointer))
-	{
+	   (!ret_path_ptr->pointer)) {
 		return (AE_BAD_PARAMETER);
 	}
 
@@ -159,7 +174,7 @@
 	 * Validate handle and convert to an Node
 	 */
 
-	acpi_cm_acquire_mutex (ACPI_MTX_NAMESPACE);
+	acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
 	node = acpi_ns_convert_handle_to_entry (handle);
 	if (!node) {
 		status = AE_BAD_PARAMETER;
@@ -184,7 +199,7 @@
 
 unlock_and_exit:
 
-	acpi_cm_release_mutex (ACPI_MTX_NAMESPACE);
+	acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
 	return (status);
 }
 
@@ -209,32 +224,39 @@
 	ACPI_HANDLE             handle,
 	ACPI_DEVICE_INFO        *info)
 {
-	DEVICE_ID               hid;
-	DEVICE_ID               uid;
+	ACPI_DEVICE_ID          hid;
+	ACPI_DEVICE_ID          uid;
 	ACPI_STATUS             status;
 	u32                     device_status = 0;
 	ACPI_INTEGER            address = 0;
 	ACPI_NAMESPACE_NODE     *node;
 
 
+	/* Ensure that ACPI has been initialized */
+
+	ACPI_IS_INITIALIZATION_COMPLETE (status);
+	if (ACPI_FAILURE (status)) {
+		return (status);
+	}
+
 	/* Parameter validation */
 
 	if (!handle || !info) {
 		return (AE_BAD_PARAMETER);
 	}
 
-	acpi_cm_acquire_mutex (ACPI_MTX_NAMESPACE);
+	acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
 
 	node = acpi_ns_convert_handle_to_entry (handle);
 	if (!node) {
-		acpi_cm_release_mutex (ACPI_MTX_NAMESPACE);
+		acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
 		return (AE_BAD_PARAMETER);
 	}
 
 	info->type      = node->type;
 	info->name      = node->name;
 
-	acpi_cm_release_mutex (ACPI_MTX_NAMESPACE);
+	acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
 
 	/*
 	 * If not a device, we are all done.
@@ -256,7 +278,7 @@
 
 	/* Execute the _HID method and save the result */
 
-	status = acpi_cm_execute_HID (node, &hid);
+	status = acpi_ut_execute_HID (node, &hid);
 	if (ACPI_SUCCESS (status)) {
 		STRNCPY (info->hardware_id, hid.buffer, sizeof(info->hardware_id));
 
@@ -265,7 +287,7 @@
 
 	/* Execute the _UID method and save the result */
 
-	status = acpi_cm_execute_UID (node, &uid);
+	status = acpi_ut_execute_UID (node, &uid);
 	if (ACPI_SUCCESS (status)) {
 		STRCPY (info->unique_id, uid.buffer);
 
@@ -277,7 +299,7 @@
 	 * _STA is not always present
 	 */
 
-	status = acpi_cm_execute_STA (node, &device_status);
+	status = acpi_ut_execute_STA (node, &device_status);
 	if (ACPI_SUCCESS (status)) {
 		info->current_status = device_status;
 		info->valid |= ACPI_VALID_STA;
@@ -288,7 +310,7 @@
 	 * _ADR is not always present
 	 */
 
-	status = acpi_cm_evaluate_numeric_object (METHOD_NAME__ADR,
+	status = acpi_ut_evaluate_numeric_object (METHOD_NAME__ADR,
 			  node, &address);
 
 	if (ACPI_SUCCESS (status)) {
diff -urN linux-2.4.6-pre4/drivers/acpi/namespace/nsxfobj.c linux/drivers/acpi/namespace/nsxfobj.c
--- linux-2.4.6-pre4/drivers/acpi/namespace/nsxfobj.c	Sun Apr  8 10:02:56 2001
+++ linux/drivers/acpi/namespace/nsxfobj.c	Mon Dec  3 22:48:42 2001
@@ -2,7 +2,7 @@
  *
  * Module Name: nsxfobj - Public interfaces to the ACPI subsystem
  *                         ACPI Object oriented interfaces
- *              $Revision: 80 $
+ *              $Revision: 86 $
  *
  ******************************************************************************/
 
@@ -31,7 +31,7 @@
 #include "acdispat.h"
 
 
-#define _COMPONENT          NAMESPACE
+#define _COMPONENT          ACPI_NAMESPACE
 	 MODULE_NAME         ("nsxfobj")
 
 
@@ -76,6 +76,13 @@
 	u32                     object_length;
 
 
+	/* Ensure that ACPI has been initialized */
+
+	ACPI_IS_INITIALIZATION_COMPLETE (status);
+	if (ACPI_FAILURE (status)) {
+		return (status);
+	}
+
 	/*
 	 * If there are parameters to be passed to the object
 	 * (which must be a control method), the external objects
@@ -92,7 +99,7 @@
 		param_length    = (count + 1) * sizeof (void *);
 		object_length   = count * sizeof (ACPI_OPERAND_OBJECT);
 
-		param_ptr = acpi_cm_callocate (param_length + /* Parameter List part */
+		param_ptr = acpi_ut_callocate (param_length + /* Parameter List part */
 				  object_length); /* Actual objects */
 		if (!param_ptr) {
 			return (AE_NO_MEMORY);
@@ -108,7 +115,7 @@
 
 		for (i = 0; i < count; i++) {
 			param_ptr[i] = &object_ptr[i];
-			acpi_cm_init_static_object (&object_ptr[i]);
+			acpi_ut_init_static_object (&object_ptr[i]);
 		}
 		param_ptr[count] = NULL;
 
@@ -117,11 +124,11 @@
 		 * internal object
 		 */
 		for (i = 0; i < count; i++) {
-			status = acpi_cm_copy_eobject_to_iobject (&param_objects->pointer[i],
+			status = acpi_ut_copy_eobject_to_iobject (&param_objects->pointer[i],
 					 param_ptr[i]);
 
 			if (ACPI_FAILURE (status)) {
-				acpi_cm_delete_internal_object_list (param_ptr);
+				acpi_ut_delete_internal_object_list (param_ptr);
 				return (status);
 			}
 		}
@@ -136,8 +143,7 @@
 	 */
 
 	if ((pathname) &&
-		(acpi_ns_valid_root_prefix (pathname[0])))
-	{
+		(acpi_ns_valid_root_prefix (pathname[0]))) {
 		/*
 		 *  The path is fully qualified, just evaluate by name
 		 */
@@ -212,7 +218,7 @@
 				 * Find out how large a buffer is needed
 				 * to contain the returned object
 				 */
-				status = acpi_cm_get_object_size (return_obj,
+				status = acpi_ut_get_object_size (return_obj,
 						   &buffer_space_needed);
 				if (ACPI_SUCCESS (status)) {
 					/*
@@ -235,7 +241,7 @@
 						/*
 						 *  We have enough space for the object, build it
 						 */
-						status = acpi_cm_copy_iobject_to_eobject (return_obj,
+						status = acpi_ut_copy_iobject_to_eobject (return_obj,
 								  return_buffer);
 						return_buffer->length = buffer_space_needed;
 					}
@@ -252,7 +258,7 @@
 		 * Delete the internal return object. (Or at least
 		 * decrement the reference count by one)
 		 */
-		acpi_cm_remove_reference (return_obj);
+		acpi_ut_remove_reference (return_obj);
 	}
 
 	/*
@@ -262,7 +268,7 @@
 	if (param_ptr) {
 		/* Free the allocated parameter block */
 
-		acpi_cm_delete_internal_object_list (param_ptr);
+		acpi_ut_delete_internal_object_list (param_ptr);
 	}
 
 	return (status);
@@ -300,13 +306,20 @@
 	ACPI_NAMESPACE_NODE     *child_node = NULL;
 
 
+	/* Ensure that ACPI has been initialized */
+
+	ACPI_IS_INITIALIZATION_COMPLETE (status);
+	if (ACPI_FAILURE (status)) {
+		return (status);
+	}
+
 	/* Parameter validation */
 
 	if (type > ACPI_TYPE_MAX) {
 		return (AE_BAD_PARAMETER);
 	}
 
-	acpi_cm_acquire_mutex (ACPI_MTX_NAMESPACE);
+	acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
 
 	/* If null handle, use the parent */
 
@@ -335,7 +348,7 @@
 
 	/* Internal function does the real work */
 
-	node = acpi_ns_get_next_object ((OBJECT_TYPE_INTERNAL) type,
+	node = acpi_ns_get_next_object ((ACPI_OBJECT_TYPE8) type,
 			   parent_node, child_node);
 	if (!node) {
 		status = AE_NOT_FOUND;
@@ -349,7 +362,7 @@
 
 unlock_and_exit:
 
-	acpi_cm_release_mutex (ACPI_MTX_NAMESPACE);
+	acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
 	return (status);
 }
 
@@ -373,7 +386,15 @@
 	ACPI_OBJECT_TYPE        *ret_type)
 {
 	ACPI_NAMESPACE_NODE     *node;
+	ACPI_STATUS             status;
+
 
+	/* Ensure that ACPI has been initialized */
+
+	ACPI_IS_INITIALIZATION_COMPLETE (status);
+	if (ACPI_FAILURE (status)) {
+		return (status);
+	}
 
 	/* Parameter Validation */
 
@@ -390,20 +411,20 @@
 		return (AE_OK);
 	}
 
-	acpi_cm_acquire_mutex (ACPI_MTX_NAMESPACE);
+	acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
 
 	/* Convert and validate the handle */
 
 	node = acpi_ns_convert_handle_to_entry (handle);
 	if (!node) {
-		acpi_cm_release_mutex (ACPI_MTX_NAMESPACE);
+		acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
 		return (AE_BAD_PARAMETER);
 	}
 
 	*ret_type = node->type;
 
 
-	acpi_cm_release_mutex (ACPI_MTX_NAMESPACE);
+	acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
 	return (AE_OK);
 }
 
@@ -431,8 +452,12 @@
 	ACPI_STATUS             status = AE_OK;
 
 
-	/* No trace macro, too verbose */
+	/* Ensure that ACPI has been initialized */
 
+	ACPI_IS_INITIALIZATION_COMPLETE (status);
+	if (ACPI_FAILURE (status)) {
+		return (status);
+	}
 
 	if (!ret_handle) {
 		return (AE_BAD_PARAMETER);
@@ -445,7 +470,7 @@
 	}
 
 
-	acpi_cm_acquire_mutex (ACPI_MTX_NAMESPACE);
+	acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
 
 	/* Convert and validate the handle */
 
@@ -470,7 +495,7 @@
 
 unlock_and_exit:
 
-	acpi_cm_release_mutex (ACPI_MTX_NAMESPACE);
+	acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
 	return (status);
 }
 
@@ -510,19 +535,25 @@
 	ACPI_OBJECT_TYPE        type,
 	ACPI_HANDLE             start_object,
 	u32                     max_depth,
-	WALK_CALLBACK           user_function,
+	ACPI_WALK_CALLBACK      user_function,
 	void                    *context,
 	void                    **return_value)
 {
 	ACPI_STATUS             status;
 
 
+	/* Ensure that ACPI has been initialized */
+
+	ACPI_IS_INITIALIZATION_COMPLETE (status);
+	if (ACPI_FAILURE (status)) {
+		return (status);
+	}
+
 	/* Parameter validation */
 
 	if ((type > ACPI_TYPE_MAX)  ||
 		(!max_depth)            ||
-		(!user_function))
-	{
+		(!user_function)) {
 		return (AE_BAD_PARAMETER);
 	}
 
@@ -533,14 +564,14 @@
 	 * must be allowed to make Acpi calls itself.
 	 */
 
-	acpi_cm_acquire_mutex (ACPI_MTX_NAMESPACE);
-	status = acpi_ns_walk_namespace ((OBJECT_TYPE_INTERNAL) type,
+	acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
+	status = acpi_ns_walk_namespace ((ACPI_OBJECT_TYPE8) type,
 			   start_object, max_depth,
 			   NS_WALK_UNLOCK,
 			   user_function, context,
 			   return_value);
 
-	acpi_cm_release_mutex (ACPI_MTX_NAMESPACE);
+	acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
 
 	return (status);
 }
@@ -570,17 +601,15 @@
 	ACPI_STATUS             status;
 	ACPI_NAMESPACE_NODE     *node;
 	u32                     flags;
-	DEVICE_ID               device_id;
+	ACPI_DEVICE_ID          device_id;
 	ACPI_GET_DEVICES_INFO   *info;
 
 
 	info = context;
 
-	acpi_cm_acquire_mutex (ACPI_MTX_NAMESPACE);
-
+	acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
 	node = acpi_ns_convert_handle_to_entry (obj_handle);
-
-	acpi_cm_release_mutex (ACPI_MTX_NAMESPACE);
+	acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
 
 	if (!node) {
 		return (AE_BAD_PARAMETER);
@@ -589,15 +618,13 @@
 	/*
 	 * Run _STA to determine if device is present
 	 */
-
-	status = acpi_cm_execute_STA (node, &flags);
+	status = acpi_ut_execute_STA (node, &flags);
 	if (ACPI_FAILURE (status)) {
-		return AE_OK;
+		return (AE_CTRL_DEPTH);
 	}
 
 	if (!(flags & 0x01)) {
 		/* don't return at the device or children of the device if not there */
-
 		return (AE_CTRL_DEPTH);
 	}
 
@@ -605,14 +632,13 @@
 	 * Filter based on device HID
 	 */
 	if (info->hid != NULL) {
-		status = acpi_cm_execute_HID (node, &device_id);
-
+		status = acpi_ut_execute_HID (node, &device_id);
 		if (status == AE_NOT_FOUND) {
 			return (AE_OK);
 		}
 
 		else if (ACPI_FAILURE (status)) {
-			return (status);
+			return (AE_CTRL_DEPTH);
 		}
 
 		if (STRNCMP (device_id.buffer, info->hid, sizeof (device_id.buffer)) != 0) {
@@ -621,7 +647,6 @@
 	}
 
 	info->user_function (obj_handle, nesting_level, info->context, return_value);
-
 	return (AE_OK);
 }
 
@@ -654,7 +679,7 @@
 ACPI_STATUS
 acpi_get_devices (
 	NATIVE_CHAR             *HID,
-	WALK_CALLBACK           user_function,
+	ACPI_WALK_CALLBACK      user_function,
 	void                    *context,
 	void                    **return_value)
 {
@@ -662,6 +687,13 @@
 	ACPI_GET_DEVICES_INFO   info;
 
 
+	/* Ensure that ACPI has been initialized */
+
+	ACPI_IS_INITIALIZATION_COMPLETE (status);
+	if (ACPI_FAILURE (status)) {
+		return (status);
+	}
+
 	/* Parameter validation */
 
 	if (!user_function) {
@@ -683,14 +715,14 @@
 	 * must be allowed to make Acpi calls itself.
 	 */
 
-	acpi_cm_acquire_mutex (ACPI_MTX_NAMESPACE);
+	acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
 	status = acpi_ns_walk_namespace (ACPI_TYPE_DEVICE,
 			   ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
 			   NS_WALK_UNLOCK,
 			   acpi_ns_get_device_callback, &info,
 			   return_value);
 
-	acpi_cm_release_mutex (ACPI_MTX_NAMESPACE);
+	acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
 
 	return (status);
 }
diff -urN linux-2.4.6-pre4/drivers/acpi/os.c linux/drivers/acpi/os.c
--- linux-2.4.6-pre4/drivers/acpi/os.c	Mon Jan 22 13:23:43 2001
+++ linux/drivers/acpi/os.c	Mon Dec  3 22:48:42 2001
@@ -1,7 +1,15 @@
+/******************************************************************************
+ * 
+ * Module Name: os.c - Linux OSL functions
+ *		$Revision: 28 $
+ *
+ *****************************************************************************/
+
 /*
  *  os.c - OS-dependent functions
  *
  *  Copyright (C) 2000 Andrew Henroid
+ *  Copyright (C) 2001 Andrew Grover
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -17,24 +25,36 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
+/* Changes
+ *
+ * Christopher Liebman <liebman@sponsera.com> 2001-5-15
+ * - Fixed improper kernel_thread parameters 
+ */
 
 #include <linux/kernel.h>
-#include <linux/types.h>
 #include <linux/slab.h>
 #include <linux/mm.h>
 #include <linux/pci.h>
-#include <linux/acpi.h>
+#include <linux/interrupt.h>
+#include <linux/kmod.h>
 #include <linux/delay.h>
 #include <asm/io.h>
-#include "acpi.h"
+#include <acpi.h>
 #include "driver.h"
 
-#define _COMPONENT	OS_DEPENDENT
+#define _COMPONENT	ACPI_OS_SERVICES
 	MODULE_NAME	("os")
 
-static int acpi_irq_irq = 0;
-static OSD_HANDLER acpi_irq_handler = NULL;
-static void *acpi_irq_context = NULL;
+typedef struct 
+{
+    OSD_EXECUTION_CALLBACK  function;
+    void		    *context;
+} ACPI_OS_DPC;
+
+
+/*****************************************************************************
+ *			       Debugger Stuff
+ *****************************************************************************/
 
 #ifdef ENABLE_DEBUGGER
 
@@ -47,6 +67,19 @@
 #endif
 
 
+/*****************************************************************************
+ *				    Globals
+ *****************************************************************************/
+
+static int acpi_irq_irq = 0;
+static OSD_HANDLER acpi_irq_handler = NULL;
+static void *acpi_irq_context = NULL;
+
+
+/******************************************************************************
+ *				   Functions
+ *****************************************************************************/
+
 ACPI_STATUS
 acpi_os_initialize(void)
 {
@@ -141,6 +174,17 @@
 		iounmap(virt);
 }
 
+ACPI_STATUS
+acpi_os_get_physical_address(void *virt, ACPI_PHYSICAL_ADDRESS *phys)
+{
+	if(!phys || !virt)
+		return AE_BAD_PARAMETER;
+
+	*phys = virt_to_phys(virt);
+
+	return AE_OK;
+}
+
 static void
 acpi_irq(int irq, void *dev_id, struct pt_regs *regs)
 {
@@ -171,6 +215,7 @@
 		free_irq(irq, acpi_irq);
 		acpi_irq_handler = NULL;
 	}
+
 	return AE_OK;
 }
 
@@ -265,10 +310,10 @@
 
 ACPI_STATUS
 acpi_os_read_pci_cfg_byte(
-			  u32 bus,
-			  u32 func,
-			  u32 addr,
-			  u8 * val)
+	u32 bus,
+	u32 func,
+	u32 addr,
+	u8 * val)
 {
 	int devfn = PCI_DEVFN((func >> 16) & 0xffff, func & 0xffff);
 	struct pci_dev *dev = pci_find_slot(bus & 0xffff, devfn);
@@ -279,10 +324,10 @@
 
 ACPI_STATUS
 acpi_os_read_pci_cfg_word(
-			  u32 bus,
-			  u32 func,
-			  u32 addr,
-			  u16 * val)
+	u32 bus,
+	u32 func,
+	u32 addr,
+	u16 * val)
 {
 	int devfn = PCI_DEVFN((func >> 16) & 0xffff, func & 0xffff);
 	struct pci_dev *dev = pci_find_slot(bus & 0xffff, devfn);
@@ -293,10 +338,10 @@
 
 ACPI_STATUS
 acpi_os_read_pci_cfg_dword(
-			   u32 bus,
-			   u32 func,
-			   u32 addr,
-			   u32 * val)
+	u32 bus,
+	u32 func,
+	u32 addr,
+	u32 * val)
 {
 	int devfn = PCI_DEVFN((func >> 16) & 0xffff, func & 0xffff);
 	struct pci_dev *dev = pci_find_slot(bus & 0xffff, devfn);
@@ -307,10 +352,10 @@
 
 ACPI_STATUS
 acpi_os_write_pci_cfg_byte(
-			   u32 bus,
-			   u32 func,
-			   u32 addr,
-			   u8 val)
+	u32 bus,
+	u32 func,
+	u32 addr,
+	u8 val)
 {
 	int devfn = PCI_DEVFN((func >> 16) & 0xffff, func & 0xffff);
 	struct pci_dev *dev = pci_find_slot(bus & 0xffff, devfn);
@@ -321,10 +366,10 @@
 
 ACPI_STATUS
 acpi_os_write_pci_cfg_word(
-			   u32 bus,
-			   u32 func,
-			   u32 addr,
-			   u16 val)
+	u32 bus,
+	u32 func,
+	u32 addr,
+	u16 val)
 {
 	int devfn = PCI_DEVFN((func >> 16) & 0xffff, func & 0xffff);
 	struct pci_dev *dev = pci_find_slot(bus & 0xffff, devfn);
@@ -335,10 +380,10 @@
 
 ACPI_STATUS
 acpi_os_write_pci_cfg_dword(
-			    u32 bus,
-			    u32 func,
-			    u32 addr,
-			    u32 val)
+	u32 bus,
+	u32 func,
+	u32 addr,
+	u32 val)
 {
 	int devfn = PCI_DEVFN((func >> 16) & 0xffff, func & 0xffff);
 	struct pci_dev *dev = pci_find_slot(bus & 0xffff, devfn);
@@ -347,49 +392,317 @@
 	return AE_OK;
 }
 
-/*
- * Queue for interpreter thread
- */
+ACPI_STATUS
+acpi_os_load_module (
+	char *module_name)
+{
+	FUNCTION_TRACE("acpi_os_load_module");
+
+	if (!module_name)
+		return_ACPI_STATUS(AE_BAD_PARAMETER);
+
+	if (0 > request_module(module_name)) {
+		DEBUG_PRINT(ACPI_WARN, ("Unable to load module [%s].\n", module_name));
+		return_ACPI_STATUS(AE_ERROR);
+	}
+
+	return_ACPI_STATUS(AE_OK);
+}
 
 ACPI_STATUS
-acpi_os_queue_for_execution(
-			    u32 priority,
-			    OSD_EXECUTION_CALLBACK callback,
-			    void *context)
+acpi_os_unload_module (
+	char *module_name)
 {
-	if (acpi_run(callback, context))
-		return AE_ERROR;
-	return AE_OK;
+	FUNCTION_TRACE("acpi_os_unload_module");
+
+	if (!module_name)
+		return_ACPI_STATUS(AE_BAD_PARAMETER);
+
+	/* TODO: How on Linux? */
+	/* this is done automatically for all modules with
+	use_count = 0, I think. see: MOD_INC_USE_COUNT -ASG */
+
+	return_ACPI_STATUS(AE_OK);
 }
 
+
 /*
- * Semaphores are unused, interpreter access is single threaded
+ * See acpi_os_queue_for_execution(), too
  */
+static int
+acpi_os_queue_exec (
+	void *context)
+{
+	ACPI_OS_DPC		*dpc = (ACPI_OS_DPC*)context;
 
-ACPI_STATUS
-acpi_os_create_semaphore(u32 max_units, u32 init, ACPI_HANDLE * handle)
+	FUNCTION_TRACE("acpi_os_queue_exec");
+
+	daemonize();
+	strcpy(current->comm, "kacpidpc");
+    
+	if (!dpc || !dpc->function)
+		return_ACPI_STATUS(AE_BAD_PARAMETER);
+
+	DEBUG_PRINT(ACPI_INFO, ("Executing function [%p(%p)].\n", dpc->function, dpc->context));
+
+	dpc->function(dpc->context);
+
+	acpi_os_free(dpc);
+
+	return_VALUE(1);
+}
+
+static void
+acpi_os_schedule_exec (
+	void *context)
 {
-	/* a hack to fake out sems until we implement them */
-	*handle = (ACPI_HANDLE) handle;
-	return AE_OK;
+	ACPI_OS_DPC		*dpc = NULL;
+	int			thread_pid = -1;
+
+	FUNCTION_TRACE("acpi_os_schedule_exec");
+
+	dpc = (ACPI_OS_DPC*)context;
+	if (!dpc) {
+		DEBUG_PRINT(ACPI_ERROR, ("Invalid (NULL) context.\n"));
+		return;
+	}
+
+	DEBUG_PRINT(ACPI_INFO, ("Creating new thread to run function [%p(%p)].\n", dpc->function, dpc->context));
+
+	thread_pid = kernel_thread(acpi_os_queue_exec, dpc, 
+		(CLONE_FS | CLONE_FILES | SIGCHLD));
+	if (thread_pid < 0) {
+		DEBUG_PRINT(ACPI_ERROR, ("Call to kernel_thread() failed.\n"));
+		acpi_os_free(dpc);
+	}
+
+	return_VOID;
 }
 
 ACPI_STATUS
-acpi_os_delete_semaphore(ACPI_HANDLE handle)
+acpi_os_queue_for_execution(
+	u32			priority,
+	OSD_EXECUTION_CALLBACK	function,
+	void			*context)
+{
+	ACPI_STATUS 		status = AE_OK;
+	ACPI_OS_DPC 		*dpc = NULL;
+
+	FUNCTION_TRACE("acpi_os_queue_for_execution");
+
+	DEBUG_PRINT(ACPI_INFO, ("Scheduling function [%p(%p)] for deferred execution.\n", function, context));
+
+	if (!function)
+		return_ACPI_STATUS(AE_BAD_PARAMETER);
+
+	/*
+	 * Allocate/initialize DPC structure.  Note that this memory will be
+	 * freed by the callee.
+	 */
+	dpc = acpi_os_callocate(sizeof(ACPI_OS_DPC));
+	if (!dpc) 
+		return AE_NO_MEMORY;
+
+	dpc->function = function;
+	dpc->context = context;
+
+	/*
+	 * Queue via DPC:
+	 * --------------
+	 * Note that we have to use two different processes for queuing DPCs:
+	 *	 Interrupt-Level: Use schedule_task; can't spawn a new thread.
+	 *	    Kernel-Level: Spawn a new kernel thread, as schedule_task has
+	 *			  its limitations (e.g. single-threaded model), and
+	 *			  all other task queues run at interrupt-level.
+	 */
+	switch (priority) {
+
+	case OSD_PRIORITY_GPE:
+	{
+		static struct tq_struct task;
+
+		memset(&task, 0, sizeof(struct tq_struct));
+
+		task.routine = acpi_os_schedule_exec;
+		task.data = (void*)dpc;
+
+		if (schedule_task(&task) < 0) {
+			DEBUG_PRINT(ACPI_ERROR, ("Call to schedule_task() failed.\n"));
+			status = AE_ERROR;
+		}
+	}
+	break;
+
+	default:
+		acpi_os_schedule_exec(dpc);
+		break;
+	}
+
+	return_ACPI_STATUS(status);
+}
+
+
+ACPI_STATUS
+acpi_os_create_semaphore(
+	u32		max_units,
+	u32		initial_units,
+	ACPI_HANDLE	*handle)
 {
-	return AE_OK;
+    struct semaphore	    *sem = NULL;
+
+    FUNCTION_TRACE("acpi_os_create_semaphore");
+
+    sem = acpi_os_callocate(sizeof(struct semaphore));
+    if (!sem)
+	return_ACPI_STATUS(AE_NO_MEMORY);
+
+    sema_init(sem, initial_units);
+
+    *handle = (ACPI_HANDLE*)sem;
+
+    DEBUG_PRINT(ACPI_INFO, ("Creating semaphore[%p|%d].\n", *handle, initial_units));
+
+    return_ACPI_STATUS(AE_OK);
 }
 
+
+/* 
+ * TODO: A better way to delete semaphores?  Linux doesn't have a
+ * 'delete_semaphore()' function -- may result in an invalid
+ * pointer dereference for non-synchronized consumers.	Should
+ * we at least check for blocked threads and signal/cancel them?
+ */
+
 ACPI_STATUS
-acpi_os_wait_semaphore(ACPI_HANDLE handle, u32 units, u32 timeout)
+acpi_os_delete_semaphore(
+	ACPI_HANDLE handle)
 {
-	return AE_OK;
+    struct semaphore	    *sem = (struct semaphore*)handle;
+
+    FUNCTION_TRACE("acpi_os_delete_semaphore");
+
+    if (!sem) 
+	return AE_BAD_PARAMETER;
+
+    DEBUG_PRINT(ACPI_INFO, ("Deleting semaphore[%p].\n", handle));
+
+    acpi_os_free(sem); sem =  NULL;
+
+    return_ACPI_STATUS(AE_OK);
 }
 
+
+/*
+ * TODO: The kernel doesn't have a 'down_timeout' function -- had to
+ * improvise.  The process is to sleep for one scheduler quantum
+ * until the semaphore becomes available.  Downside is that this
+ * may result in starvation for timeout-based waits when there's
+ * lots of semaphore activity.
+ *
+ * TODO: Support for units > 1?
+ */
+ACPI_STATUS
+acpi_os_wait_semaphore(
+	ACPI_HANDLE	handle,
+	u32			units,
+	u32			timeout)
+{
+	ACPI_STATUS		status = AE_OK;
+	struct semaphore	*sem = (struct semaphore*)handle;
+	int			ret = 0;
+
+	FUNCTION_TRACE("acpi_os_wait_semaphore");
+
+	if (!sem || (units < 1)) 
+		return_ACPI_STATUS(AE_BAD_PARAMETER);
+
+	if (units > 1)
+		return_ACPI_STATUS(AE_SUPPORT);
+
+	DEBUG_PRINT(ACPI_INFO, ("Waiting for semaphore[%p|%d|%d]\n", handle, units, timeout));
+
+	switch (timeout)
+	{
+		/*
+		 * No Wait:
+		 * --------
+		 * A zero timeout value indicates that we shouldn't wait - just
+		 * acquire the semaphore if available otherwise return AE_TIME
+		 * (a.k.a. 'would block').
+		 */
+		case 0:
+		ret = down_trylock(sem);
+		if (ret < 0)
+			status = AE_TIME;
+		break;
+
+		/*
+		 * Wait Indefinitely:
+		 * ------------------
+		 */
+		case WAIT_FOREVER:
+		ret = down_interruptible(sem);
+		if (ret < 0)
+			status = AE_ERROR;
+		break;
+
+		/*
+		 * Wait w/ Timeout:
+		 * ----------------
+		 */
+		default:
+		// TODO: A better timeout algorithm?
+		{
+			int i = 0;
+			static const int quantum_ms = 1000/HZ;
+
+			ret = down_trylock(sem);
+			for (i = timeout; (i > 0 && ret < 0); i -= quantum_ms) {
+				current->state = TASK_INTERRUPTIBLE;
+				schedule_timeout(1);
+				ret = down_trylock(sem);
+			}
+	
+			if (ret < 0)
+			 status = AE_TIME;
+			}
+		break;
+	}
+
+	if (ACPI_FAILURE(status)) {
+		DEBUG_PRINT(ACPI_INFO, ("Failed to acquire semaphore[%p|%d|%d]\n", handle, units, timeout));
+	}
+	else {
+		DEBUG_PRINT(ACPI_INFO, ("Acquired semaphore[%p|%d|%d]\n", handle, units, timeout));
+	}
+
+	return_ACPI_STATUS(status);
+}
+
+
+/*
+ * TODO: Support for units > 1?
+ */
 ACPI_STATUS
-acpi_os_signal_semaphore(ACPI_HANDLE handle, u32 units)
+acpi_os_signal_semaphore(
+    ACPI_HANDLE 	    handle, 
+    u32 		    units)
 {
-	return AE_OK;
+	struct semaphore *sem = (struct semaphore *) handle;
+
+	FUNCTION_TRACE("acpi_os_signal_semaphore");
+
+	if (!sem || (units < 1)) 
+		return_ACPI_STATUS(AE_BAD_PARAMETER);
+
+	if (units > 1)
+		return_ACPI_STATUS(AE_SUPPORT);
+
+	DEBUG_PRINT(ACPI_INFO, ("Signaling semaphore[%p|%d]\n", handle, units));
+
+	up(sem);
+
+	return_ACPI_STATUS(AE_OK);
 }
 
 ACPI_STATUS
@@ -399,8 +712,10 @@
 	return AE_OK;
 }
 
+
 void
 acpi_os_dbg_trap(char *msg)
+
 {
 	acpi_os_printf("trap: %s", msg);
 }
@@ -421,7 +736,7 @@
 
 		kdb_read(buffer, sizeof(line_buf));
 
-		/* remove the CR kdb includes */
+		/* remove the CR kdb includes */ 
 		chars = strlen(buffer) - 1;
 		buffer[chars] = '\0';
 	}
@@ -444,4 +759,15 @@
 acpi_os_writable(void *ptr, u32 len)
 {
 	return 1;
+}
+
+u32
+acpi_os_get_thread_id (void)
+{
+	if (!in_interrupt())
+		return current->pid;
+
+	/*acpi_os_printf("acpi_os_get_thread_id called from interrupt level!\n");*/
+
+	return 0;
 }
diff -urN linux-2.4.6-pre4/drivers/acpi/ospm/Makefile linux/drivers/acpi/ospm/Makefile
--- linux-2.4.6-pre4/drivers/acpi/ospm/Makefile	Wed Dec 31 16:00:00 1969
+++ linux/drivers/acpi/ospm/Makefile	Mon Dec  3 22:48:42 2001
@@ -0,0 +1,22 @@
+#
+# Makefile for the Linux OSPM code.
+#
+
+O_TARGET := $(notdir $(CURDIR)).o
+
+ACPI_CFLAGS += -I$(CURDIR)/include
+
+EXTRA_CFLAGS += $(ACPI_CFLAGS)
+
+subdir-$(CONFIG_ACPI_BUSMGR)	+= busmgr
+subdir-$(CONFIG_ACPI_EC)	+= ec
+subdir-$(CONFIG_ACPI_SYS)	+= system
+subdir-$(CONFIG_ACPI_CPU)	+= processor
+subdir-$(CONFIG_ACPI_CMBATT)	+= battery
+subdir-$(CONFIG_ACPI_AC)	+= ac_adapter
+subdir-$(CONFIG_ACPI_BUTTON)	+= button
+subdir-$(CONFIG_ACPI_THERMAL)	+= thermal
+
+obj-y				+= $(foreach dir,$(subdir-y),$(dir)/ospm_$(dir).o)
+
+include $(TOPDIR)/Rules.make
diff -urN linux-2.4.6-pre4/drivers/acpi/ospm/ac_adapter/Makefile linux/drivers/acpi/ospm/ac_adapter/Makefile
--- linux-2.4.6-pre4/drivers/acpi/ospm/ac_adapter/Makefile	Wed Dec 31 16:00:00 1969
+++ linux/drivers/acpi/ospm/ac_adapter/Makefile	Mon Dec  3 22:48:42 2001
@@ -0,0 +1,6 @@
+O_TARGET	:= ospm_$(notdir $(CURDIR)).o
+obj-m		:= $(O_TARGET)
+EXTRA_CFLAGS	+= $(ACPI_CFLAGS)
+obj-y		:= $(patsubst %.c,%.o,$(wildcard *.c))
+
+include $(TOPDIR)/Rules.make
diff -urN linux-2.4.6-pre4/drivers/acpi/ospm/ac_adapter/ac.c linux/drivers/acpi/ospm/ac_adapter/ac.c
--- linux-2.4.6-pre4/drivers/acpi/ospm/ac_adapter/ac.c	Wed Dec 31 16:00:00 1969
+++ linux/drivers/acpi/ospm/ac_adapter/ac.c	Mon Dec  3 22:48:42 2001
@@ -0,0 +1,348 @@
+/*****************************************************************************
+ *
+ * Module Name: ac.c
+ *   $Revision: 19 $
+ *
+ *****************************************************************************/
+
+/*
+ *  Copyright (C) 2000, 2001 Andrew Grover
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include <acpi.h>
+#include "ac.h"
+
+
+#define _COMPONENT		ACPI_AC_ADAPTER
+	MODULE_NAME 		("ac")
+
+
+/****************************************************************************
+ *                            Internal Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ *
+ * FUNCTION:	ac_print
+ *
+ * PARAMETERS:	
+ *
+ * RETURN:	
+ *
+ * DESCRIPTION: Prints out information on a specific ac_adapter.
+ *
+ ****************************************************************************/
+
+void
+ac_print (
+	AC_CONTEXT		*ac_adapter)
+{
+
+	return;
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:	ac_add_device
+ *
+ * PARAMETERS:	
+ *
+ * RETURN:	
+ *
+ * DESCRIPTION:
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+ac_add_device(
+	BM_HANDLE		device_handle,
+	void			**context)
+{
+	ACPI_STATUS 		status = AE_OK;
+	BM_DEVICE		*device = NULL;
+	AC_CONTEXT		*ac_adapter = NULL;
+	ACPI_DEVICE_INFO	info;
+
+	if (!context || *context) {
+		return(AE_BAD_PARAMETER);
+	}
+
+	/*
+	 * Get information on this device.
+	 */
+	status = bm_get_device_info(device_handle, &device);
+	if (ACPI_FAILURE(status)) {
+		return(status);
+	}
+
+	/*
+	 * Allocate a new AC_CONTEXT structure.
+	 */
+	ac_adapter = acpi_os_callocate(sizeof(AC_CONTEXT));
+	if (!ac_adapter) {
+		return(AE_NO_MEMORY);
+	}
+
+	ac_adapter->device_handle = device->handle;
+	ac_adapter->acpi_handle = device->acpi_handle;
+
+	/*
+	 * Get information on this object.
+	 */
+	status = acpi_get_object_info(ac_adapter->acpi_handle, &info);
+	if (ACPI_FAILURE(status)) {
+		goto end;
+	}
+
+	/*
+	 * _UID?
+	 * -----
+	 */
+	if (info.valid & ACPI_VALID_UID) {
+		strncpy(ac_adapter->uid, info.unique_id, sizeof(info.unique_id));
+	}
+	else {
+		strncpy(ac_adapter->uid, "0", sizeof("0"));
+	}
+
+	/*
+	 * _STA?
+	 * -----
+	 */
+	if (!(info.valid & ACPI_VALID_STA)) {
+		status = AE_ERROR;
+		goto end;
+	}
+
+	status = ac_osl_add_device(ac_adapter);
+	if (ACPI_FAILURE(status)) {
+		goto end;
+	}
+
+	*context = ac_adapter;
+
+	ac_print(ac_adapter);
+
+end:
+	if (ACPI_FAILURE(status)) {
+		acpi_os_free(ac_adapter);
+	}
+
+	return(status);
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:	ac_remove_device
+ *
+ * PARAMETERS:	
+ *
+ * RETURN:	
+ *
+ * DESCRIPTION:
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+ac_remove_device (
+	void			**context)
+{
+	ACPI_STATUS 		status = AE_OK;
+	AC_CONTEXT		*ac_adapter = NULL;
+
+	if (!context || !*context) {
+		return(AE_BAD_PARAMETER);
+	}
+
+	ac_adapter = (AC_CONTEXT*)*context;
+
+	ac_osl_remove_device(ac_adapter);
+
+	acpi_os_free(ac_adapter);
+
+	*context = NULL;
+
+	return(status);
+}
+
+
+/****************************************************************************
+ *                             External Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ *
+ * FUNCTION:	ac_initialize
+ *
+ * PARAMETERS:	<none>
+ *
+ * RETURN:	
+ *
+ * DESCRIPTION:
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+ac_initialize (void)
+{
+	ACPI_STATUS		status = AE_OK;
+	BM_DEVICE_ID		criteria;
+	BM_DRIVER		driver;
+
+	MEMSET(&criteria, 0, sizeof(BM_DEVICE_ID));
+	MEMSET(&driver, 0, sizeof(BM_DRIVER));
+
+	driver.notify = &ac_notify;
+	driver.request = &ac_request;
+
+	/*
+	 * Register driver for AC Adapter devices.
+	 */
+	MEMCPY(criteria.hid, AC_HID_AC_ADAPTER, sizeof(AC_HID_AC_ADAPTER));
+
+	status = bm_register_driver(&criteria, &driver);
+
+	return(status);
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:	ac_terminate
+ *
+ * PARAMETERS:	<none>
+ *
+ * RETURN:	
+ *
+ * DESCRIPTION:
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+ac_terminate (void)
+{
+	ACPI_STATUS 		status = AE_OK;
+	BM_DEVICE_ID		criteria;
+	BM_DRIVER		driver;
+
+	MEMSET(&criteria, 0, sizeof(BM_DEVICE_ID));
+	MEMSET(&driver, 0, sizeof(BM_DRIVER));
+
+	/*
+	 * Unregister driver for AC Adapter devices.
+	 */
+	MEMCPY(criteria.hid, AC_HID_AC_ADAPTER, sizeof(AC_HID_AC_ADAPTER));
+
+	driver.notify = &ac_notify;
+	driver.request = &ac_request;
+
+	status = bm_unregister_driver(&criteria, &driver);
+
+	return(status);
+}
+
+
+/*****************************************************************************
+ *
+ * FUNCTION:	ac_notify
+ *
+ * PARAMETERS:	<none>
+ *
+ * RETURN:	
+ *
+ * DESCRIPTION:
+ *
+ ****************************************************************************/
+ACPI_STATUS
+ac_notify (
+	BM_NOTIFY		notify_type,
+	BM_HANDLE		device_handle,
+	void			**context)
+{
+	ACPI_STATUS 		status = AE_OK;
+
+	if (!context) {
+		return(AE_BAD_PARAMETER);
+	}
+
+	switch (notify_type) {
+
+	case BM_NOTIFY_DEVICE_ADDED:
+		status = ac_add_device(device_handle, context);
+		break;
+
+	case BM_NOTIFY_DEVICE_REMOVED:
+		status = ac_remove_device(context);
+		break;
+
+	case AC_NOTIFY_STATUS_CHANGE:
+		status = ac_osl_generate_event(notify_type,
+			((AC_CONTEXT*)*context));
+		break;
+
+	default:
+		status = AE_SUPPORT;
+		break;
+	}
+
+	return(status);
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:	ac_request
+ *
+ * PARAMETERS:	
+ *
+ * RETURN:	
+ *
+ * DESCRIPTION:
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+ac_request (
+	BM_REQUEST		*request,
+	void			*context)
+{
+	ACPI_STATUS 		status = AE_OK;
+
+	/*
+	 * Must have a valid request structure and context.
+	 */
+	if (!request || !context) {
+		return(AE_BAD_PARAMETER);
+	}
+
+	/*
+	 * Handle Request:
+	 * ---------------
+	 */
+	switch (request->command) {
+
+	default:
+		status = AE_SUPPORT;
+		break;
+	}
+
+	request->status = status;
+
+	return(status);
+}
diff -urN linux-2.4.6-pre4/drivers/acpi/ospm/ac_adapter/ac_osl.c linux/drivers/acpi/ospm/ac_adapter/ac_osl.c
--- linux-2.4.6-pre4/drivers/acpi/ospm/ac_adapter/ac_osl.c	Wed Dec 31 16:00:00 1969
+++ linux/drivers/acpi/ospm/ac_adapter/ac_osl.c	Mon Dec  3 22:48:42 2001
@@ -0,0 +1,256 @@
+/*****************************************************************************
+ *
+ * Module Name: ac_osl.c
+ *   $Revision: 7 $
+ *
+ *****************************************************************************/
+
+/*
+ *  Copyright (C) 2000, 2001 Andrew Grover
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/types.h>
+#include <linux/proc_fs.h>
+#include <acpi.h>
+#include "ac.h"
+
+
+MODULE_AUTHOR("Andrew Grover");
+MODULE_DESCRIPTION("ACPI Component Architecture (CA) - AC Adapter Driver");
+
+
+#define AC_PROC_ROOT		"ac_adapter"
+#define AC_PROC_STATUS		"status"
+#define AC_ON_LINE		"on-line"
+#define AC_OFF_LINE		"off-line"
+
+extern struct proc_dir_entry	*bm_proc_root;
+static struct proc_dir_entry	*ac_proc_root = NULL;
+
+
+/****************************************************************************
+ *
+ * FUNCTION:	ac_osl_proc_read_status
+ *
+ ****************************************************************************/
+
+static int
+ac_osl_proc_read_status (
+	char			*page,
+	char			**start,
+	off_t			off,
+	int 			count,
+	int 			*eof,
+	void			*context)
+{
+	ACPI_STATUS 		status = AE_OK;
+	AC_CONTEXT		*ac_adapter = NULL;
+	char			*p = page;
+	int			len;
+
+	if (!context) {
+		goto end;
+	}
+
+	ac_adapter = (AC_CONTEXT*)context;
+
+	/* don't get status more than once for a single proc read */
+	if (off != 0) {
+		goto end;
+	}
+
+	status = bm_evaluate_simple_integer(ac_adapter->acpi_handle,
+		"_PSR", &(ac_adapter->is_online));
+	if (ACPI_FAILURE(status)) {
+		p += sprintf(p, "Error reading AC Adapter status\n");
+		goto end;
+	}
+
+	if (ac_adapter->is_online) {
+		p += sprintf(p, "Status:                  %s\n", 
+			AC_ON_LINE);
+	}
+	else {
+		p += sprintf(p, "Status:                  %s\n", 
+			AC_OFF_LINE);
+	}
+
+end:
+	len = (p - page);
+	if (len <= off+count) *eof = 1;
+	*start = page + off;
+	len -= off;
+	if (len>count) len = count;
+	if (len<0) len = 0;
+
+	return(len);
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:	ac_osl_add_device
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+ac_osl_add_device(
+	AC_CONTEXT		*ac_adapter)
+{
+	struct proc_dir_entry	*proc_entry = NULL;
+
+	if (!ac_adapter) {
+		return(AE_BAD_PARAMETER);
+	}
+
+	printk(KERN_INFO "AC Adapter: found\n");
+
+	proc_entry = proc_mkdir(ac_adapter->uid, ac_proc_root);
+	if (!proc_entry) {
+		return(AE_ERROR);
+	}
+
+	create_proc_read_entry(AC_PROC_STATUS, S_IFREG | S_IRUGO, 
+		proc_entry, ac_osl_proc_read_status, (void*)ac_adapter);
+
+	return(AE_OK);
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:	ac_osl_remove_device
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+ac_osl_remove_device (
+	AC_CONTEXT		*ac_adapter)
+{
+	char			proc_entry[64];
+
+	if (!ac_adapter) {
+		return(AE_BAD_PARAMETER);
+	}
+
+	sprintf(proc_entry, "%s/%s", ac_adapter->uid, AC_PROC_STATUS);
+	remove_proc_entry(proc_entry, ac_proc_root);
+
+	sprintf(proc_entry, "%s", ac_adapter->uid);
+	remove_proc_entry(proc_entry, ac_proc_root);
+
+	return(AE_OK);
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:	ac_osl_generate_event
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+ac_osl_generate_event (
+	u32			event,
+	AC_CONTEXT		*ac_adapter)
+{
+	ACPI_STATUS		status = AE_OK;
+
+	if (!ac_adapter) {
+		return(AE_BAD_PARAMETER);
+	}
+
+	switch (event) {
+
+	case AC_NOTIFY_STATUS_CHANGE:
+		status = bm_osl_generate_event(ac_adapter->device_handle, 
+			AC_PROC_ROOT, ac_adapter->uid, event, 0);
+		break;
+
+	default:
+		return(AE_BAD_PARAMETER);
+		break;
+	}
+
+	return(status);
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:	ac_osl_init
+ *
+ * PARAMETERS:	<none>
+ *
+ * RETURN:	0: Success
+ *
+ * DESCRIPTION: Module initialization.
+ *
+ ****************************************************************************/
+
+static int __init 
+ac_osl_init (void)
+{
+	ACPI_STATUS		status = AE_OK;
+
+	ac_proc_root = proc_mkdir(AC_PROC_ROOT, bm_proc_root);
+	if (!ac_proc_root) {
+		status = AE_ERROR;
+	}
+	else {
+		status = ac_initialize();
+		if (ACPI_FAILURE(status)) {
+			remove_proc_entry(AC_PROC_ROOT, bm_proc_root);
+		}
+
+	}
+
+	return (ACPI_SUCCESS(status)) ? 0 : -ENODEV;
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:	ac_osl_cleanup
+ *
+ * PARAMETERS:	<none>
+ *
+ * RETURN:	<none>
+ *
+ * DESCRIPTION: Module cleanup.
+ *
+ ****************************************************************************/
+
+static void __exit 
+ac_osl_cleanup (void)
+{
+	ac_terminate();
+
+	if (ac_proc_root) {
+		remove_proc_entry(AC_PROC_ROOT, bm_proc_root);
+	}
+
+	return;
+}
+
+
+module_init(ac_osl_init);
+module_exit(ac_osl_cleanup);
diff -urN linux-2.4.6-pre4/drivers/acpi/ospm/battery/Makefile linux/drivers/acpi/ospm/battery/Makefile
--- linux-2.4.6-pre4/drivers/acpi/ospm/battery/Makefile	Wed Dec 31 16:00:00 1969
+++ linux/drivers/acpi/ospm/battery/Makefile	Mon Dec  3 22:48:42 2001
@@ -0,0 +1,6 @@
+O_TARGET	:= ospm_$(notdir $(CURDIR)).o
+obj-m		:= $(O_TARGET)
+EXTRA_CFLAGS	+= $(ACPI_CFLAGS)
+obj-y		:= $(patsubst %.c,%.o,$(wildcard *.c))
+
+include $(TOPDIR)/Rules.make
diff -urN linux-2.4.6-pre4/drivers/acpi/ospm/battery/bt.c linux/drivers/acpi/ospm/battery/bt.c
--- linux-2.4.6-pre4/drivers/acpi/ospm/battery/bt.c	Wed Dec 31 16:00:00 1969
+++ linux/drivers/acpi/ospm/battery/bt.c	Mon Dec  3 22:48:42 2001
@@ -0,0 +1,593 @@
+/*****************************************************************************
+ *
+ * Module Name: bt.c
+ *   $Revision: 24 $
+ *
+ *****************************************************************************/
+
+/*
+ *  Copyright (C) 2000, 2001 Andrew Grover
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include <acpi.h>
+#include "bt.h"
+
+
+#define _COMPONENT		ACPI_BATTERY
+	MODULE_NAME 		("bt")
+
+
+/****************************************************************************
+ *                            Internal Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ *
+ * FUNCTION:	bt_print
+ *
+ * PARAMETERS:	
+ *
+ * RETURN:	
+ *
+ * DESCRIPTION: Prints out information on a specific battery.
+ *
+ ****************************************************************************/
+
+void
+bt_print (
+	BT_CONTEXT		*battery)
+{
+
+	return;
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:	bt_get_info
+ *
+ * PARAMETERS:	
+ *
+ * RETURN:	
+ *
+ * DESCRIPTION:
+ *
+ * NOTES:	Allocates battery_info - which must be freed by the caller.
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+bt_get_info (
+	BT_CONTEXT		*battery,
+	BT_BATTERY_INFO 	**battery_info)
+{
+	ACPI_STATUS 		status = AE_OK;
+	ACPI_BUFFER 		bif_buffer, package_format, package_data;
+	ACPI_OBJECT 		*package = NULL;
+
+	if (!battery || !battery_info || *battery_info) {
+		return(AE_BAD_PARAMETER);
+	}
+
+	MEMSET(&bif_buffer, 0, sizeof(ACPI_BUFFER));
+
+	/*
+	 * Evalute _BIF:
+	 * -------------
+	 * And be sure to deallocate bif_buffer.pointer!
+	 */
+	status = bm_evaluate_object(battery->acpi_handle, "_BIF", NULL,
+		&bif_buffer);
+	if (ACPI_FAILURE(status)) {
+		return(status);
+	}
+
+	/*
+	 * Extract Package Data:
+	 * ---------------------
+	 * Type-cast this bif_buffer to a package and use helper
+	 * functions to convert results into BT_BATTERY_INFO structure.
+	 * The first attempt is just to get the size of the package
+	 * data; the second gets the data (once we know the required
+	 * bif_buffer size).
+	 */
+	status = bm_cast_buffer(&bif_buffer, (void**)&package,
+		sizeof(ACPI_OBJECT));
+	if (ACPI_FAILURE(status)) {
+		goto end;
+	}
+
+	package_format.length = sizeof("NNNNNNNNNSSSS");
+	package_format.pointer = "NNNNNNNNNSSSS";
+
+	MEMSET(&package_data, 0, sizeof(ACPI_BUFFER));
+
+	status = bm_extract_package_data(package, &package_format,
+		&package_data);
+	if (status != AE_BUFFER_OVERFLOW) {
+		if (status == AE_OK) {
+			status = AE_ERROR;
+		}
+		goto end;
+	}
+
+	package_data.pointer = acpi_os_callocate(package_data.length);
+	if (!package_data.pointer) {
+		return(AE_NO_MEMORY);
+	}
+
+	status = bm_extract_package_data(package, &package_format,
+		&package_data);
+	if (ACPI_FAILURE(status)) {
+		acpi_os_free(package_data.pointer);
+		goto end;
+	}
+
+	*battery_info = package_data.pointer;
+
+end:
+	acpi_os_free(bif_buffer.pointer);
+
+	return(status);
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:	bt_get_status
+ *
+ * PARAMETERS:	
+ *
+ * RETURN:	
+ *
+ * DESCRIPTION:
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+bt_get_status (
+	BT_CONTEXT		*battery,
+	BT_BATTERY_STATUS	**battery_status)
+{
+	ACPI_STATUS 		status = AE_OK;
+	ACPI_BUFFER 		bst_buffer, package_format, package_data;
+	ACPI_OBJECT 		*package = NULL;
+
+	if (!battery || !battery_status || *battery_status) {
+		return(AE_BAD_PARAMETER);
+	}
+
+	MEMSET(&bst_buffer, 0, sizeof(ACPI_BUFFER));
+
+	/*
+	 * Evalute _BST:
+	 * -------------
+	 * And be sure to deallocate bst_buffer.pointer!
+	 */
+	status = bm_evaluate_object(battery->acpi_handle, "_BST",
+		NULL, &bst_buffer);
+	if (ACPI_FAILURE(status)) {
+		return(status);
+	}
+
+	/*
+	 * Extract Package Data:
+	 * ---------------------
+	 * Type-cast this bst_buffer to a package and use helper
+	 * functions to convert results into BT_BATTERY_STATUS structure.
+	 * The first attempt is just to get the size of the package data;
+	 * the second gets the data (once we know the required bst_buffer
+	 * size).
+	 */
+	status = bm_cast_buffer(&bst_buffer, (void**)&package,
+		sizeof(ACPI_OBJECT));
+	if (ACPI_FAILURE(status)) {
+		goto end;
+	}
+
+	package_format.length = sizeof("NNNN");
+	package_format.pointer = "NNNN";
+
+	MEMSET(&package_data, 0, sizeof(ACPI_BUFFER));
+
+	status = bm_extract_package_data(package, &package_format,
+		&package_data);
+	if (status != AE_BUFFER_OVERFLOW) {
+		if (status == AE_OK) {
+			status = AE_ERROR;
+		}
+		goto end;
+	}
+
+	package_data.pointer = acpi_os_callocate(package_data.length);
+	if (!package_data.pointer) {
+		return(AE_NO_MEMORY);
+	}
+
+	status = bm_extract_package_data(package, &package_format,
+		&package_data);
+	if (ACPI_FAILURE(status)) {
+		acpi_os_free(package_data.pointer);
+		goto end;
+	}
+
+	*battery_status = package_data.pointer;
+
+end:
+	acpi_os_free(bst_buffer.pointer);
+
+	return(status);
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:	bt_check_device
+ *
+ * PARAMETERS:	
+ *
+ * RETURN:	
+ *
+ * DESCRIPTION:
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+bt_check_device (
+	BT_CONTEXT		*battery)
+{
+	ACPI_STATUS 		status = AE_OK;
+	BM_DEVICE_STATUS	battery_status = BM_STATUS_UNKNOWN;
+	u32 			was_present = FALSE;
+	BT_BATTERY_INFO 	*battery_info = NULL;
+
+	if (!battery) {
+		return(AE_BAD_PARAMETER);
+	}
+
+	was_present = battery->is_present;
+
+	/*
+	 * Battery Present?
+	 * ----------------
+	 * Get the device status and check if battery slot is occupied.
+	 */
+	status = bm_get_device_status(battery->device_handle, &battery_status);
+	if (ACPI_FAILURE(status)) {
+		return(status);
+	}
+
+	if (battery_status & BM_STATUS_BATTERY_PRESENT) {
+		battery->is_present = TRUE;
+	}
+	else {
+		battery->is_present = FALSE;
+	}
+
+	/*
+	 * Battery Appeared?
+	 * -----------------
+	 */
+	if (!was_present && battery->is_present) {
+
+		/*
+		 * Units of Power?
+		 * ---------------
+		 * Get the 'units of power', as we'll need this to report
+		 * status information.
+		 */
+		status = bt_get_info(battery, &battery_info);
+		if (ACPI_SUCCESS(status)) {
+			battery->power_units = (battery_info->power_unit)
+				? BT_POWER_UNITS_AMPS : BT_POWER_UNITS_WATTS;
+			acpi_os_free(battery_info);
+		}
+	}
+
+	/*
+	 * Battery Disappeared?
+	 * --------------------
+	 */
+	else if (was_present && !battery->is_present) {
+		battery->power_units = BT_POWER_UNITS_DEFAULT;
+	}
+
+	return(status);
+}
+
+
+/*****************************************************************************
+ *
+ * FUNCTION:	bt_add_device
+ *
+ * PARAMETERS:	
+ *
+ * RETURN:	
+ *
+ * DESCRIPTION:
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+bt_add_device (
+	BM_HANDLE		device_handle,
+	void			**context)
+{
+	ACPI_STATUS 		status = AE_OK;
+	BM_DEVICE		*device = NULL;
+	BT_CONTEXT		*battery = NULL;
+
+	if (!context || *context) {
+		return(AE_BAD_PARAMETER);
+	}
+
+	/*
+	 * Get information on this device.
+	 */
+	status = bm_get_device_info(device_handle, &device);
+	if (ACPI_FAILURE(status)) {
+		return(status);
+	}
+
+	/*
+	 * Allocate a new BT_CONTEXT structure.
+	 */
+	battery = acpi_os_callocate(sizeof(BT_CONTEXT));
+	if (!battery) {
+		return(AE_NO_MEMORY);
+	}
+
+	battery->device_handle = device->handle;
+	battery->acpi_handle = device->acpi_handle;
+	strncpy(battery->uid, device->id.uid, sizeof(battery->uid));
+
+	battery->power_units = BT_POWER_UNITS_DEFAULT;
+	battery->is_present = FALSE;
+
+	/*
+	 * See if battery is really present.
+	 */
+	status = bt_check_device(battery);
+	if (ACPI_FAILURE(status)) {
+		goto end;
+	}
+
+	status = bt_osl_add_device(battery);
+	if (ACPI_FAILURE(status)) {
+		goto end;
+	}
+
+	*context = battery;
+
+	bt_print(battery);
+
+end:
+	if (ACPI_FAILURE(status)) {
+		acpi_os_free(battery);
+	}
+
+	return(status);
+}
+
+
+/*****************************************************************************
+ *
+ * FUNCTION:	bt_remove_device
+ *
+ * PARAMETERS:	
+ *
+ * RETURN:	
+ *
+ * DESCRIPTION:
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+bt_remove_device (
+	void			**context)
+{
+	ACPI_STATUS 		status = AE_OK;
+	BT_CONTEXT		*battery = NULL;
+
+	if (!context || !*context) {
+		return(AE_BAD_PARAMETER);
+	}
+
+	battery = (BT_CONTEXT*)*context;
+
+	bt_osl_remove_device(battery);
+
+	acpi_os_free(battery);
+
+	*context = NULL;
+
+	return(status);
+}
+
+
+/*****************************************************************************
+ *                               External Functions
+ *****************************************************************************/
+
+/*****************************************************************************
+ *
+ * FUNCTION:	bt_initialize
+ *
+ * PARAMETERS:	<none>
+ *
+ * RETURN:	
+ *
+ * DESCRIPTION:
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+bt_initialize (void)
+{
+	ACPI_STATUS		status = AE_OK;
+	BM_DEVICE_ID		criteria;
+	BM_DRIVER		driver;
+
+	MEMSET(&criteria, 0, sizeof(BM_DEVICE_ID));
+	MEMSET(&driver, 0, sizeof(BM_DRIVER));
+
+	/*
+	 * Register driver for driver method battery devices.
+	 */
+	MEMCPY(criteria.hid, BT_HID_CM_BATTERY, sizeof(BT_HID_CM_BATTERY));
+
+	driver.notify = &bt_notify;
+	driver.request = &bt_request;
+
+	status = bm_register_driver(&criteria, &driver);
+
+	return(status);
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:	bt_terminate
+ *
+ * PARAMETERS:	<none>
+ *
+ * RETURN:	
+ *
+ * DESCRIPTION:
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+bt_terminate (void)
+{
+	ACPI_STATUS		status = AE_OK;
+	BM_DEVICE_ID		criteria;
+	BM_DRIVER		driver;
+
+	MEMSET(&criteria, 0, sizeof(BM_DEVICE_ID));
+	MEMSET(&driver, 0, sizeof(BM_DRIVER));
+
+	/*
+	 * Unregister driver for driver method battery devices.
+	 */
+	MEMCPY(criteria.hid, BT_HID_CM_BATTERY, sizeof(BT_HID_CM_BATTERY));
+
+	driver.notify = &bt_notify;
+	driver.request = &bt_request;
+
+	status = bm_unregister_driver(&criteria, &driver);
+
+	return(status);
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:	bt_notify
+ *
+ * PARAMETERS:	<none>
+ *
+ * RETURN:	
+ *
+ * DESCRIPTION:
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+bt_notify (
+	BM_NOTIFY		notify_type,
+	BM_HANDLE		device_handle,
+	void			**context)
+{
+	ACPI_STATUS 		status = AE_OK;
+
+	if (!context) {
+		return(AE_BAD_PARAMETER);
+	}
+
+	switch (notify_type) {
+
+	case BM_NOTIFY_DEVICE_ADDED:
+		status = bt_add_device(device_handle, context);
+		break;
+
+	case BM_NOTIFY_DEVICE_REMOVED:
+		status = bt_remove_device(context);
+		break;
+
+	case BT_NOTIFY_STATUS_CHANGE:
+		status = bt_osl_generate_event(notify_type,
+			((BT_CONTEXT*)*context));
+		break;
+
+	case BT_NOTIFY_INFORMATION_CHANGE:
+		status = bt_check_device((BT_CONTEXT*)*context);
+		if (ACPI_SUCCESS(status)) {
+			status = bt_osl_generate_event(notify_type,
+				((BT_CONTEXT*)*context));
+		}
+		break;
+
+	default:
+		status = AE_SUPPORT;
+		break;
+	}
+
+	return(status);
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:	bt_request
+ *
+ * PARAMETERS:	
+ *
+ * RETURN:	
+ *
+ * DESCRIPTION:
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+bt_request (
+	BM_REQUEST		*request,
+	void			*context)
+{
+	ACPI_STATUS 		status = AE_OK;
+
+	/*
+	 * Must have a valid request structure and context.
+	 */
+	if (!request || !context)
+		return(AE_BAD_PARAMETER);
+
+	/*
+	 * Handle request:
+	 * ---------------
+	 */
+	switch (request->command) {
+
+	default:
+		status = AE_SUPPORT;
+		break;
+	}
+
+	request->status = status;
+
+	return(status);
+}
diff -urN linux-2.4.6-pre4/drivers/acpi/ospm/battery/bt_osl.c linux/drivers/acpi/ospm/battery/bt_osl.c
--- linux-2.4.6-pre4/drivers/acpi/ospm/battery/bt_osl.c	Wed Dec 31 16:00:00 1969
+++ linux/drivers/acpi/ospm/battery/bt_osl.c	Mon Dec  3 22:48:42 2001
@@ -0,0 +1,438 @@
+/******************************************************************************
+ *
+ * Module Name: bt_osl.c
+ *   $Revision: 18 $
+ *
+ *****************************************************************************/
+
+/*
+ *  Copyright (C) 2000, 2001 Andrew Grover
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+/*
+ * Changes:
+ * Brendan Burns <bburns@wso.williams.edu> 2000-11-15
+ * - added proc battery interface
+ * - parse returned data from _BST and _BIF
+ * Andy Grover <andrew.grover@intel.com> 2000-12-8
+ * - improved proc interface
+ */
+
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/types.h>
+#include <linux/proc_fs.h>
+#include <acpi.h>
+#include "bt.h"
+
+
+MODULE_AUTHOR("Andrew Grover");
+MODULE_DESCRIPTION("ACPI Component Architecture (CA) - Control Method Battery Driver");
+
+
+#define BT_PROC_ROOT		"battery"
+#define BT_PROC_STATUS		"status"
+#define BT_PROC_INFO		"info"
+
+extern struct proc_dir_entry	*bm_proc_root;
+static struct proc_dir_entry	*bt_proc_root = NULL;
+
+
+/****************************************************************************
+ * 
+ * FUNCTION:	bt_osl_proc_read_info
+ *
+ ****************************************************************************/
+
+static int
+bt_osl_proc_read_info (
+	char			*page, 
+	char			**start, 
+	off_t			off, 
+	int 			count, 
+	int 			*eof, 
+	void			*context)
+{
+	BT_CONTEXT		*battery = NULL;
+	BT_BATTERY_INFO 	*battery_info = NULL;
+	char			*p = page;
+	int 			len = 0;
+
+	if (!context || (off != 0)) {
+		goto end;
+	}
+
+	battery = (BT_CONTEXT*)context;
+
+	/*
+	 * Battery Present?
+	 * ----------------
+	 */
+	if (!battery->is_present) {
+		p += sprintf(p, "Present:                 no\n");
+		goto end;
+	}
+	else {
+		p += sprintf(p, "Present:                 yes\n");
+	}
+
+	/*
+	 * Get Battery Information:
+	 * ------------------------
+	 */
+	if (ACPI_FAILURE(bt_get_info(battery, &battery_info))) {
+		p += sprintf(p, "Error reading battery information (_BIF)\n");
+		goto end;
+	}
+
+	if (battery_info->design_capacity == BT_UNKNOWN) {
+		p += sprintf(p, "Design Capacity:         unknown\n");
+	}
+	else {
+		p += sprintf(p, "Design Capacity:         %d %sh\n", 
+			 battery_info->design_capacity, 
+			 battery->power_units);
+	}
+	
+	if (battery_info->last_full_capacity == BT_UNKNOWN) {
+		p += sprintf(p, "Last Full Capacity:      unknown\n");
+	} 
+	else {
+		p += sprintf(p, "Last Full Capacity:      %d %sh\n", 
+			 battery_info->last_full_capacity, 
+			 battery->power_units);
+	}
+
+	if (battery_info->battery_technology == 0) {
+		p += sprintf(p, "Battery Technology:      primary (non-rechargeable)\n");
+	}
+	else if (battery_info->battery_technology == 1) {
+		p += sprintf(p, "Battery Technology:      secondary (rechargeable)\n");
+	}
+	else {
+		p += sprintf(p, "Battery Technology:      unknown\n");
+	}
+
+	if (battery_info->design_voltage == BT_UNKNOWN) {
+		p += sprintf(p, "Design Voltage:          unknown\n");
+	}
+	else {
+		p += sprintf(p, "Design Voltage:          %d mV\n", 
+			 battery_info->design_voltage);
+	}
+	
+	p += sprintf(p, "Design Capacity Warning: %d %sh\n",
+		battery_info->design_capacity_warning, 
+		battery->power_units);
+	p += sprintf(p, "Design Capacity Low:     %d %sh\n",
+		battery_info->design_capacity_low, 
+		battery->power_units);
+	p += sprintf(p, "Capacity Granularity 1:  %d %sh\n",
+		battery_info->battery_capacity_granularity_1, 
+		battery->power_units);
+	p += sprintf(p, "Capacity Granularity 2:  %d %sh\n",
+		battery_info->battery_capacity_granularity_2, 
+		battery->power_units);
+	p += sprintf(p, "Model Number:            %s\n", 
+		battery_info->model_number);
+	p += sprintf(p, "Serial Number:           %s\n", 
+		battery_info->serial_number);
+	p += sprintf(p, "Battery Type:            %s\n", 
+		battery_info->battery_type);
+	p += sprintf(p, "OEM Info:                %s\n", 
+		battery_info->oem_info);
+	
+end:
+	len = (p - page);
+	if (len <= off+count) *eof = 1;
+	*start = page + off;
+	len -= off;
+	if (len>count) len = count;
+	if (len<0) len = 0;
+
+	acpi_os_free(battery_info);
+
+	return(len);
+}
+
+
+/****************************************************************************
+ * 
+ * FUNCTION:	bt_osl_proc_read_status
+ *
+ ****************************************************************************/
+
+static int
+bt_osl_proc_read_status (
+	char			*page, 
+	char			**start, 
+	off_t			off, 
+	int 			count, 
+	int 			*eof, 
+	void			*context)
+{
+	BT_CONTEXT		*battery = NULL;
+	BT_BATTERY_STATUS	*battery_status = NULL;
+	char			*p = page;
+	int 			len = 0;
+
+	if (!context || (off != 0)) {
+		goto end;
+	}
+
+	battery = (BT_CONTEXT*)context;
+
+	/*
+	 * Battery Present?
+	 * ----------------
+	 */
+	if (!battery->is_present) {
+		p += sprintf(p, "Present:                 no\n");
+		goto end;
+	}
+	else {
+		p += sprintf(p, "Present:                 yes\n");
+	}
+
+	/*
+	 * Get Battery Status:
+	 * -------------------
+	 */
+	if (ACPI_FAILURE(bt_get_status(battery, &battery_status))) {
+		p += sprintf(p, "Error reading battery status (_BST)\n");
+		goto end;
+	}
+
+	/*
+	 * Store Data:
+	 * -----------
+	 */
+
+	if (!battery_status->state) {
+		p += sprintf(p, "State:                   ok\n"); 
+	}
+	else {
+		if (battery_status->state & 0x1)
+			p += sprintf(p, "State:                   discharging\n");
+		if (battery_status->state & 0x2)
+			p += sprintf(p, "State:                   charging\n");
+		if (battery_status->state & 0x4)
+			p += sprintf(p, "State:                   critically low\n");
+	}
+
+	if (battery_status->present_rate == BT_UNKNOWN) {
+		p += sprintf(p, "Present Rate:            unknown\n");
+	}
+	else {
+		p += sprintf(p, "Present Rate:            %d %s\n",
+			battery_status->present_rate, 
+			battery->power_units);
+	}
+
+	if (battery_status->remaining_capacity == BT_UNKNOWN) {
+		p += sprintf(p, "Remaining Capacity:      unknown\n");
+	}
+	else {
+		p += sprintf(p, "Remaining Capacity:      %d %sh\n",
+			battery_status->remaining_capacity, 
+			battery->power_units);
+	}
+
+	if (battery_status->present_voltage == BT_UNKNOWN) {
+		p += sprintf(p, "Battery Voltage:         unknown\n");
+	}
+	else {
+		p += sprintf(p, "Battery Voltage:         %d mV\n",
+			battery_status->present_voltage);
+	}
+
+end:
+	len = (p - page);
+	if (len <= off+count) *eof = 1;
+	*start = page + off;
+	len -= off;
+	if (len>count) len = count;
+	if (len<0) len = 0;
+
+	acpi_os_free(battery_status);
+
+	return(len);
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:	bt_osl_add_device
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+bt_osl_add_device(
+	BT_CONTEXT		*battery)
+{
+	struct proc_dir_entry	*proc_entry = NULL;
+
+	if (!battery) {
+		return(AE_BAD_PARAMETER);
+	}
+
+	if (battery->is_present) {
+		printk("Battery: socket found, battery present\n");
+	}
+	else {
+		printk("Battery: socket found, battery absent\n");
+	}
+
+	proc_entry = proc_mkdir(battery->uid, bt_proc_root);
+	if (!proc_entry) {
+		return(AE_ERROR);
+	}
+
+	create_proc_read_entry(BT_PROC_STATUS, S_IFREG | S_IRUGO, 
+		proc_entry, bt_osl_proc_read_status, (void*)battery);
+
+	create_proc_read_entry(BT_PROC_INFO, S_IFREG | S_IRUGO, 
+		proc_entry, bt_osl_proc_read_info, (void*)battery);
+
+	return(AE_OK);
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:	bt_osl_remove_device
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+bt_osl_remove_device (
+	BT_CONTEXT		*battery)
+{
+	char			proc_entry[64];
+
+	if (!battery) {
+		return(AE_BAD_PARAMETER);
+	}
+
+	sprintf(proc_entry, "%s/%s", battery->uid, BT_PROC_INFO);
+	remove_proc_entry(proc_entry, bt_proc_root);
+
+	sprintf(proc_entry, "%s/%s", battery->uid, BT_PROC_STATUS);
+	remove_proc_entry(proc_entry, bt_proc_root);
+
+	sprintf(proc_entry, "%s", battery->uid);
+	remove_proc_entry(proc_entry, bt_proc_root);
+
+	return(AE_OK);
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:	bt_osl_generate_event
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+bt_osl_generate_event (
+	u32			event,
+	BT_CONTEXT		*battery)
+{
+	ACPI_STATUS		status = AE_OK;
+
+	if (!battery) {
+		return(AE_BAD_PARAMETER);
+	}
+
+	switch (event) {
+
+	case BT_NOTIFY_STATUS_CHANGE:
+	case BT_NOTIFY_INFORMATION_CHANGE:
+		status = bm_osl_generate_event(battery->device_handle, 
+			BT_PROC_ROOT, battery->uid, event, 0);
+		break;
+
+	default:
+		return(AE_BAD_PARAMETER);
+		break;
+	}
+
+	return(status);
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:	bt_osl_init
+ *
+ * PARAMETERS:	<none>
+ *
+ * RETURN:	0: Success
+ *
+ * DESCRIPTION: Module initialization.
+ *
+ ****************************************************************************/
+
+static int __init 
+bt_osl_init (void)
+{
+	ACPI_STATUS		status = AE_OK;
+
+	bt_proc_root = proc_mkdir(BT_PROC_ROOT, bm_proc_root);
+	if (!bt_proc_root) {
+		status = AE_ERROR;
+	}
+	else {
+		status = bt_initialize();
+		if (ACPI_FAILURE(status)) {
+			remove_proc_entry(BT_PROC_ROOT, bm_proc_root);
+		}
+	}
+
+	return (ACPI_SUCCESS(status)) ? 0 : -ENODEV;
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:	bt_osl_cleanup
+ *
+ * PARAMETERS:	<none>
+ *
+ * RETURN:	<none>
+ *
+ * DESCRIPTION: Module cleanup.
+ *
+ ****************************************************************************/
+
+static void __exit 
+bt_osl_cleanup (void)
+{
+	bt_terminate();
+
+	if (bt_proc_root) {
+		remove_proc_entry(BT_PROC_ROOT, bm_proc_root);
+	}
+
+	return;
+}
+
+
+module_init(bt_osl_init);
+module_exit(bt_osl_cleanup);
diff -urN linux-2.4.6-pre4/drivers/acpi/ospm/busmgr/Makefile linux/drivers/acpi/ospm/busmgr/Makefile
--- linux-2.4.6-pre4/drivers/acpi/ospm/busmgr/Makefile	Wed Dec 31 16:00:00 1969
+++ linux/drivers/acpi/ospm/busmgr/Makefile	Mon Dec  3 22:48:42 2001
@@ -0,0 +1,6 @@
+O_TARGET	:= ospm_$(notdir $(CURDIR)).o
+obj-m		:= $(O_TARGET)
+EXTRA_CFLAGS	+= $(ACPI_CFLAGS)
+obj-y		:= $(patsubst %.c,%.o,$(wildcard *.c))
+
+include $(TOPDIR)/Rules.make
diff -urN linux-2.4.6-pre4/drivers/acpi/ospm/busmgr/bm.c linux/drivers/acpi/ospm/busmgr/bm.c
--- linux-2.4.6-pre4/drivers/acpi/ospm/busmgr/bm.c	Wed Dec 31 16:00:00 1969
+++ linux/drivers/acpi/ospm/busmgr/bm.c	Mon Dec  3 22:48:42 2001
@@ -0,0 +1,1144 @@
+/******************************************************************************
+ *
+ * Module Name: bm.c
+ *   $Revision: 42 $
+ *
+ *****************************************************************************/
+
+/*
+ *  Copyright (C) 2000, 2001 Andrew Grover
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/init.h>
+#include <acpi.h>
+#include "bm.h"
+
+
+#define _COMPONENT		ACPI_BUS
+	MODULE_NAME		("bm")
+
+
+/****************************************************************************
+ *                                  Globals
+ ****************************************************************************/
+
+extern FADT_DESCRIPTOR_REV2	acpi_fadt;
+/* TBD: Make dynamically sizeable. */
+BM_NODE_LIST			node_list;
+
+
+/****************************************************************************
+ *                            Internal Functions
+ ****************************************************************************/
+
+/*****************************************************************************
+ * 
+ * FUNCTION:    bm_print_object
+ *
+ * PARAMETERS:  
+ *
+ * RETURN:      
+ *
+ * DESCRIPTION: 
+ *
+ ****************************************************************************/
+
+void
+bm_print_object (
+	ACPI_HANDLE		acpi_handle)
+{
+	ACPI_BUFFER		buffer;
+	ACPI_HANDLE		parent;
+	ACPI_OBJECT_TYPE	type;
+
+	buffer.length = 256;
+	buffer.pointer = acpi_os_callocate(buffer.length);
+	if (!buffer.pointer) {
+		return;
+	}
+
+	acpi_get_name(acpi_handle, ACPI_FULL_PATHNAME, &buffer);
+	acpi_get_parent(acpi_handle, &parent);
+	acpi_get_type(acpi_handle, &type);
+
+	/*
+	 * TBD: Hack to get around scope identification problem.
+	 */
+	if (type == ACPI_TYPE_ANY) {
+		if (ACPI_SUCCESS(acpi_get_next_object(ACPI_TYPE_ANY, 
+			acpi_handle, 0, NULL))) {
+			type = INTERNAL_TYPE_SCOPE;
+		}
+	}
+    
+	switch (type)
+	{
+	case INTERNAL_TYPE_SCOPE:
+		acpi_os_printf("SCOPE: ");
+		break;
+	case ACPI_TYPE_INTEGER:
+		acpi_os_printf("SIMPLE (number): ");
+		break;
+	case ACPI_TYPE_STRING:
+		acpi_os_printf("SIMPLE (string): ");
+		break;
+	case ACPI_TYPE_BUFFER:
+		acpi_os_printf("SIMPLE (buffer): ");
+		break;
+	case ACPI_TYPE_PACKAGE:
+		acpi_os_printf("SIMPLE (package): ");
+		break;
+	case ACPI_TYPE_FIELD_UNIT:
+		acpi_os_printf("FIELD UNIT: ");
+		break;
+	case ACPI_TYPE_DEVICE:
+		acpi_os_printf("DEVICE: ");
+		break;
+	case ACPI_TYPE_EVENT:
+		acpi_os_printf("EVENT: ");
+		break;
+	case ACPI_TYPE_METHOD:
+		acpi_os_printf("CONTROL METHOD: ");
+		break;
+	case ACPI_TYPE_MUTEX:
+		acpi_os_printf("MUTEX: ");
+		break;
+	case ACPI_TYPE_REGION:
+		acpi_os_printf("OPERATION REGION: ");
+		break;
+	case ACPI_TYPE_POWER:
+		acpi_os_printf("POWER RESOURCE: ");
+		break;
+	case ACPI_TYPE_PROCESSOR:
+		acpi_os_printf("PROCESSOR: ");
+		break;
+	case ACPI_TYPE_THERMAL:
+		acpi_os_printf("THERMAL ZONE: ");
+		break;
+	case ACPI_TYPE_BUFFER_FIELD:
+		acpi_os_printf("BUFFER FIELD: ");
+		break;
+	case ACPI_TYPE_DDB_HANDLE:
+		acpi_os_printf("DDB HANDLE: ");
+		break;
+	default:
+		acpi_os_printf("OTHER (%d): ", type);
+		break;
+	}
+
+	acpi_os_printf("Object[%p][%s] parent[%p].\n", acpi_handle, (char*)buffer.pointer, parent);
+
+	acpi_os_free(buffer.pointer);
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:    bm_print_node
+ *
+ * PARAMETERS:  
+ *
+ * RETURN:      
+ *
+ * DESCRIPTION: 
+ *
+ ****************************************************************************/
+
+void
+bm_print_node (
+	BM_NODE			*node,
+	u32                     flags)
+{
+#ifdef ACPI_DEBUG
+	ACPI_BUFFER             buffer;
+	BM_DEVICE		*device = NULL;
+	char                    *type_string = NULL;
+
+	if (!node) {
+		return;
+	}
+
+	device = &(node->device);
+
+	if (flags & BM_PRINT_PRESENT) {
+		if (!BM_DEVICE_PRESENT(device)) {
+			return;
+		}
+	}
+
+	buffer.length = 256;
+	buffer.pointer = acpi_os_callocate(buffer.length);
+	if (!buffer.pointer) {
+		return;
+	}
+
+	acpi_get_name(device->acpi_handle, ACPI_FULL_PATHNAME, &buffer);
+
+	switch(device->id.type) {
+	case BM_TYPE_SYSTEM:
+		type_string = " System";
+		break;
+	case BM_TYPE_SCOPE: 
+		type_string = "  Scope";
+		break;
+	case BM_TYPE_PROCESSOR:
+		type_string = "   Proc";
+		break;
+	case BM_TYPE_THERMAL_ZONE:
+		type_string = "Thermal";
+		break;
+	case BM_TYPE_POWER_RESOURCE:
+		type_string = "  Power";
+		break;
+	case BM_TYPE_FIXED_BUTTON:
+		type_string = " Button";
+		break;
+	case BM_TYPE_DEVICE:
+		type_string = " Device";
+		break;
+	default:
+		type_string = "Unknown";
+		break;
+	}
+
+	if (!(flags & BM_PRINT_GROUP)) {
+		DEBUG_PRINT_RAW(ACPI_INFO, ("+-------------------------------------------------------------------------------\n"));
+	}
+
+	DEBUG_PRINT_RAW(ACPI_INFO, ("| %s[%02x]:[%p] flags[%02x] hid[%s] %s\n", type_string, device->handle, device->acpi_handle, device->flags, (device->id.hid[0] ? device->id.hid : "       "), buffer.pointer));
+
+	if (flags & BM_PRINT_IDENTIFICATION) {
+		DEBUG_PRINT_RAW(ACPI_INFO, ("|   identification: uid[%s] adr[%08x]\n", device->id.uid, device->id.adr));
+	}
+
+	if (flags & BM_PRINT_LINKAGE) {
+		DEBUG_PRINT_RAW(ACPI_INFO, ("|   linkage: this[%p] parent[%p] next[%p]\n", node, node->parent, node->next));
+		DEBUG_PRINT_RAW(ACPI_INFO, ("|     scope.head[%p] scope.tail[%p]\n", node->scope.head, node->scope.tail));
+	}
+
+	if (flags & BM_PRINT_POWER) {
+		DEBUG_PRINT_RAW(ACPI_INFO, ("|   power: state[D%d] flags[%08x]\n", device->power.state, device->power.flags));
+		DEBUG_PRINT_RAW(ACPI_INFO, ("|     S0[%02x] S1[%02x] S2[%02x] S3[%02x] S4[%02x] S5[%02x]\n", device->power.dx_supported[0], device->power.dx_supported[1], device->power.dx_supported[2], device->power.dx_supported[3], device->power.dx_supported[4], device->power.dx_supported[5]));
+	}
+
+	if (!(flags & BM_PRINT_GROUP)) {
+		DEBUG_PRINT_RAW(ACPI_INFO, ("+-------------------------------------------------------------------------------\n"));
+	}
+
+	acpi_os_free(buffer.pointer);
+#endif /*ACPI_DEBUG*/
+
+	return;
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:    bm_print_hierarchy
+ *
+ * PARAMETERS:  
+ *
+ * RETURN:      
+ *
+ * DESCRIPTION: 
+ *
+ ****************************************************************************/
+
+void
+bm_print_hierarchy (void)
+{
+#ifdef ACPI_DEBUG
+	u32			i = 0;
+
+	FUNCTION_TRACE("bm_print_hierarchy");
+
+	DEBUG_PRINT_RAW(ACPI_INFO, ("+------------------------------------------------------------\n"));
+
+	for (i = 0; i < node_list.count; i++) {
+		bm_print_node(node_list.nodes[i], BM_PRINT_GROUP | BM_PRINT_PRESENT);
+	}
+
+	DEBUG_PRINT_RAW(ACPI_INFO, ("+------------------------------------------------------------\n"));
+#endif /*ACPI_DEBUG*/
+
+	return_VOID;
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:    bm_get_status
+ *
+ * PARAMETERS:  
+ *
+ * RETURN:      
+ *
+ * DESCRIPTION: 
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+bm_get_status (
+	BM_DEVICE		*device)
+{
+	ACPI_STATUS             status = AE_OK;
+
+	if (!device) {
+		return AE_BAD_PARAMETER;
+	}
+
+	device->status = BM_STATUS_UNKNOWN;
+
+	/*
+	 * Dynamic Status?
+	 * ---------------
+	 * If _STA isn't present we just return the default status.
+	 */
+	if (!(device->flags & BM_FLAGS_DYNAMIC_STATUS)) {
+		device->status = BM_STATUS_DEFAULT;
+		return AE_OK;
+	}
+
+	/*
+	 * Evaluate _STA:
+	 * --------------
+	 */
+	status = bm_evaluate_simple_integer(device->acpi_handle, "_STA", 
+		&(device->status));
+
+	return status;
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:    bm_get_identification
+ *
+ * PARAMETERS:  
+ *
+ * RETURN:      
+ *
+ * DESCRIPTION: 
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+bm_get_identification (
+	BM_DEVICE		*device)
+{
+	ACPI_STATUS             status = AE_OK;
+	ACPI_DEVICE_INFO        info;
+
+	if (!device) {
+		return AE_BAD_PARAMETER;
+	}
+
+	if (!(device->flags & BM_FLAGS_IDENTIFIABLE)) {
+		return AE_OK;
+	}
+
+	device->id.uid[0] = BM_UID_UNKNOWN;
+	device->id.hid[0] = BM_HID_UNKNOWN;
+	device->id.adr = BM_ADDRESS_UNKNOWN;
+
+	/*
+	 * Get Object Info:
+	 * ----------------
+	 * Evalute _UID, _HID, and _ADR...
+	 */
+	status = acpi_get_object_info(device->acpi_handle, &info);
+	if (ACPI_FAILURE(status)) {
+		return status;
+	}
+
+	if (info.valid & ACPI_VALID_UID) {
+		MEMCPY((void*)device->id.uid, (void*)info.unique_id, 
+			sizeof(BM_DEVICE_UID));
+	}
+
+	if (info.valid & ACPI_VALID_HID) {
+		MEMCPY((void*)device->id.hid, (void*)info.hardware_id, 
+			sizeof(BM_DEVICE_HID));
+	}
+
+	if (info.valid & ACPI_VALID_ADR) {
+		device->id.adr = info.address;
+	}
+
+	return status;
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:    bm_get_flags
+ *
+ * PARAMETERS:  
+ *
+ * RETURN:      
+ *
+ * DESCRIPTION: 
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+bm_get_flags (
+	BM_DEVICE		*device)
+{
+	ACPI_HANDLE             acpi_handle = NULL;
+
+	if (!device) {
+		return AE_BAD_PARAMETER;
+	}
+
+	device->flags = BM_FLAGS_UNKNOWN;
+
+	switch (device->id.type) {
+
+	case BM_TYPE_DEVICE:
+
+		/*
+		 * Presence of _DCK indicates a docking station.
+		 */
+		if (ACPI_SUCCESS(acpi_get_handle(device->acpi_handle, 
+			"_DCK", &acpi_handle))) {
+			device->flags |= BM_FLAGS_DOCKING_STATION;
+		}
+
+		/*
+		 * Presence of _EJD and/or _EJx indicates 'ejectable'.
+		 * TBD: _EJx...
+		 */
+		if (ACPI_SUCCESS(acpi_get_handle(device->acpi_handle, 
+			"_EJD", &acpi_handle))) {
+			device->flags |= BM_FLAGS_EJECTABLE;
+		}
+
+		/*
+		 * Presence of _PR0 or _PS0 indicates 'power manageable'.
+		 */
+		if (ACPI_SUCCESS(acpi_get_handle(device->acpi_handle, 
+			"_PR0", &acpi_handle)) ||
+			ACPI_SUCCESS(acpi_get_handle(device->acpi_handle, 
+			"_PS0", &acpi_handle))) {
+			device->flags |= BM_FLAGS_POWER_CONTROL;
+		}
+
+		/*
+		 * Presence of _CRS indicates 'configurable'.
+		 */
+		if (ACPI_SUCCESS(acpi_get_handle(device->acpi_handle, 
+			"_CRS", &acpi_handle))) {
+			device->flags |= BM_FLAGS_CONFIGURABLE;
+		}
+
+		/* Fall through to next case statement. */
+
+	case BM_TYPE_PROCESSOR:
+	case BM_TYPE_THERMAL_ZONE:
+	case BM_TYPE_POWER_RESOURCE:
+		/*
+		 * Presence of _HID or _ADR indicates 'identifiable'.
+		 */
+		if (ACPI_SUCCESS(acpi_get_handle(device->acpi_handle, 
+			"_HID", &acpi_handle)) ||
+		   ACPI_SUCCESS(acpi_get_handle(device->acpi_handle, 
+		   "_ADR", &acpi_handle))) {
+			device->flags |= BM_FLAGS_IDENTIFIABLE;
+		}
+
+		/*
+		 * Presence of _STA indicates 'dynamic status'.
+		 */
+		if (ACPI_SUCCESS(acpi_get_handle(device->acpi_handle, 
+			"_STA", &acpi_handle))) {
+			device->flags |= BM_FLAGS_DYNAMIC_STATUS;
+		}
+
+		break;
+	}
+
+	return AE_OK;
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:    bm_add_namespace_device
+ *
+ * PARAMETERS:  
+ *
+ * RETURN:      
+ *
+ * DESCRIPTION: 
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+bm_add_namespace_device (
+	ACPI_HANDLE             acpi_handle,
+	ACPI_OBJECT_TYPE        acpi_type,
+	BM_NODE			*parent,
+	BM_NODE			**child)
+{
+	ACPI_STATUS             status = AE_OK;
+	BM_NODE			*node = NULL;
+	BM_DEVICE		*device = NULL;
+
+	FUNCTION_TRACE("bm_add_namespace_device");
+
+	if (!parent || !child) {
+		return_ACPI_STATUS(AE_BAD_PARAMETER);
+	}
+
+	if (node_list.count > BM_HANDLES_MAX) {
+		return_ACPI_STATUS(AE_NO_MEMORY);
+	}
+
+	(*child) = NULL;
+
+	/*
+	 * Create Node:
+	 * ------------
+	 */
+	node = acpi_os_callocate(sizeof(BM_NODE));
+	if (!node) {
+		return_ACPI_STATUS(AE_NO_MEMORY);
+	}
+
+	node->parent = parent;
+	node->next = NULL;
+
+	device = &(node->device);
+
+	device->handle = node_list.count;
+	device->acpi_handle = acpi_handle;
+
+	/*
+	 * Device Type:
+	 * ------------
+	 */ 
+	switch (acpi_type) {
+	case INTERNAL_TYPE_SCOPE:
+		device->id.type = BM_TYPE_SCOPE;
+		break;
+	case ACPI_TYPE_PROCESSOR:
+		device->id.type = BM_TYPE_PROCESSOR;
+		break;
+	case ACPI_TYPE_THERMAL:
+		device->id.type = BM_TYPE_THERMAL_ZONE;
+		break;
+	case ACPI_TYPE_POWER:
+		device->id.type = BM_TYPE_POWER_RESOURCE;
+		break;
+	case ACPI_TYPE_DEVICE:
+		device->id.type = BM_TYPE_DEVICE;
+		break;
+	}
+
+	/*
+	 * Get Other Device Info:
+	 * ----------------------
+	 * But only if this device's parent is present (which implies
+	 * this device MAY be present).
+	 */
+	if (BM_NODE_PRESENT(node->parent)) {
+		/*
+		 * Device Flags
+		 */
+		status = bm_get_flags(device);
+		if (ACPI_FAILURE(status)) {
+			goto end;
+		}
+
+		/*
+		 * Device Identification
+		 */
+		status = bm_get_identification(device);
+		if (ACPI_FAILURE(status)) {
+			goto end;
+		}
+
+		/*
+		 * Device Status
+		 */
+		status = bm_get_status(device);
+		if (ACPI_FAILURE(status)) {
+			goto end;
+		}
+
+		/*
+		 * Power Management:
+		 * -----------------
+		 * If this node doesn't provide direct power control  
+		 * then we inherit PM capabilities from its parent.
+		 *
+		 * TBD: Inherit!
+		 */
+		if (BM_IS_POWER_CONTROL(device)) {
+			status = bm_get_pm_capabilities(node);
+			if (ACPI_FAILURE(status)) {
+				goto end;
+			}
+		}
+	}
+
+end:
+	if (ACPI_FAILURE(status)) {
+		acpi_os_free(node);
+	}
+	else {
+		/*
+		 * Add to the node_list.
+		 */
+		node_list.nodes[node_list.count++] = node;
+
+		/*
+		 * Formulate Hierarchy:
+		 * --------------------
+		 * Arrange within the namespace by assigning the parent and
+		 * adding to the parent device's list of children (scope).
+		 */
+		if (!parent->scope.head) {
+			parent->scope.head = node;
+		}
+		else {
+			if (!parent->scope.tail) {
+				(parent->scope.head)->next = node;
+			}
+			else {
+				(parent->scope.tail)->next = node;
+			}
+		}
+		parent->scope.tail = node;
+
+		(*child) = node;
+	}
+
+	return_ACPI_STATUS(status);
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:    bm_enumerate_namespace
+ *
+ * PARAMETERS:  <none>
+ *
+ * RETURN:      
+ *
+ * DESCRIPTION: 
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+bm_enumerate_namespace (void)
+{
+	ACPI_STATUS		status = AE_OK;
+	ACPI_HANDLE             parent_handle = ACPI_ROOT_OBJECT;
+	ACPI_HANDLE             child_handle = NULL;
+	BM_NODE			*parent = NULL;
+	BM_NODE			*child = NULL;
+	ACPI_OBJECT_TYPE        acpi_type = 0;
+	u32                     level = 1;
+
+	FUNCTION_TRACE("bm_enumerate_namespace");
+
+	parent = node_list.nodes[0];
+
+	/*
+	 * Enumerate ACPI Namespace:
+	 * -------------------------
+	 * Parse through the ACPI namespace, identify all 'devices',
+	 * and create a new entry for each in our collection.
+	 */
+	while (level > 0) {
+
+		/*
+		 * Get the next object at this level.
+		 */
+		status = acpi_get_next_object(ACPI_TYPE_ANY, parent_handle, child_handle, &child_handle);
+		if (ACPI_SUCCESS(status)) {
+			/*
+			 * TBD: This is a hack to get around the problem 
+			 *       identifying scope objects.  Scopes 
+			 *       somehow need to be uniquely identified.
+			 */
+			status = acpi_get_type(child_handle, &acpi_type);
+			if (ACPI_SUCCESS(status) && (acpi_type == ACPI_TYPE_ANY)) {
+				status = acpi_get_next_object(ACPI_TYPE_ANY, child_handle, 0, NULL);
+				if (ACPI_SUCCESS(status)) {
+					acpi_type = INTERNAL_TYPE_SCOPE;
+				}
+			}
+
+			/*
+			 * Device?
+			 * -------
+			 * If this object is a 'device', insert into the
+			 * ACPI Bus Manager's local hierarchy and search
+			 * the object's scope for any child devices (a
+			 * depth-first search).
+			 */
+			switch (acpi_type) {
+			case INTERNAL_TYPE_SCOPE:
+			case ACPI_TYPE_DEVICE:
+			case ACPI_TYPE_PROCESSOR:
+			case ACPI_TYPE_THERMAL:
+			case ACPI_TYPE_POWER:
+				status = bm_add_namespace_device(child_handle, acpi_type, parent, &child);
+				if (ACPI_SUCCESS(status)) {
+					status = acpi_get_next_object(ACPI_TYPE_ANY, child_handle, 0, NULL);
+					if (ACPI_SUCCESS(status)) {
+						level++;
+						parent_handle = child_handle;
+						child_handle = 0;
+						parent = child;
+					}
+				}
+				break;
+			}
+		}
+
+		/*
+		 * Scope Exhausted:
+		 * ----------------
+		 * No more children in this object's scope, Go back up
+		 * in the namespace tree to the object's parent.
+		 */
+		else {
+			level--;
+			child_handle = parent_handle;
+			acpi_get_parent(parent_handle, 
+				&parent_handle);
+
+			if (parent) {
+				parent = parent->parent;
+			}
+			else {
+				return_ACPI_STATUS(AE_NULL_ENTRY);
+			}
+		}
+	}
+
+	return_ACPI_STATUS(AE_OK);
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:    bm_add_fixed_feature_device
+ *
+ * PARAMETERS:  
+ *
+ * RETURN:      
+ *
+ * DESCRIPTION: 
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+bm_add_fixed_feature_device (
+	BM_NODE			*parent,
+	BM_DEVICE_TYPE		device_type,
+	char			*device_hid)
+{
+	ACPI_STATUS             status = AE_OK;
+	BM_NODE			*node = NULL;
+
+	FUNCTION_TRACE("bm_add_fixed_feature_device");
+
+	if (!parent) {
+		return_ACPI_STATUS(AE_BAD_PARAMETER);
+	}
+
+	if (node_list.count > BM_HANDLES_MAX) {
+		return_ACPI_STATUS(AE_NO_MEMORY);
+	}
+
+	/*
+	 * Allocate the new device and add to the device array.
+	 */
+	node = acpi_os_callocate(sizeof(BM_NODE));
+	if (!node) {
+		return_ACPI_STATUS(AE_NO_MEMORY);
+	}
+
+	/*
+	 * Get device info.
+	 */
+	node->device.handle = node_list.count;
+	node->device.acpi_handle = ACPI_ROOT_OBJECT;
+	node->device.id.type = BM_TYPE_FIXED_BUTTON;
+	if (device_hid) {
+		MEMCPY((void*)node->device.id.hid, device_hid, 
+			sizeof(node->device.id.hid));
+	}
+	node->device.flags = BM_FLAGS_FIXED_FEATURE;
+	node->device.status = BM_STATUS_DEFAULT;
+	/* TBD: Device PM capabilities */
+
+	/*
+	 * Add to the node_list.
+	 */
+	node_list.nodes[node_list.count++] = node;
+
+	/*
+	 * Formulate Hierarchy:
+	 * --------------------
+	 * Arrange within the namespace by assigning the parent and
+	 * adding to the parent device's list of children (scope).
+	 */
+	node->parent = parent;
+	node->next = NULL;
+
+	if (parent) {
+		if (!parent->scope.head) {
+			parent->scope.head = node;
+		}
+		else {
+			if (!parent->scope.tail) {
+				(parent->scope.head)->next = node;
+			}
+			else {
+				(parent->scope.tail)->next = node;
+			}
+		}
+		parent->scope.tail = node;
+	}
+
+	return_ACPI_STATUS(status);
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:    bm_enumerate_fixed_features
+ *
+ * PARAMETERS:  <none>
+ *
+ * RETURN:      
+ *
+ * DESCRIPTION: 
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+bm_enumerate_fixed_features (void)
+{
+	FUNCTION_TRACE("bm_enumerate_fixed_features");
+
+	/*
+	 * Root Object:
+	 * ------------
+	 * Fabricate the root object, which happens to always get a
+	 * device_handle of zero.
+	 */
+	node_list.nodes[0] = acpi_os_callocate(sizeof(BM_NODE));
+	if (NULL == (node_list.nodes[0])) {
+		return_ACPI_STATUS(AE_NO_MEMORY);
+	}
+
+	node_list.nodes[0]->device.handle = BM_HANDLE_ROOT;
+	node_list.nodes[0]->device.acpi_handle = ACPI_ROOT_OBJECT;
+	node_list.nodes[0]->device.flags = BM_FLAGS_UNKNOWN;
+	node_list.nodes[0]->device.status = BM_STATUS_DEFAULT;
+	node_list.nodes[0]->device.id.type = BM_TYPE_SYSTEM;
+	/* TBD: Get system PM capabilities (Sx states?) */
+
+	node_list.count++;
+
+	/*
+	 * Fixed Features:
+	 * ---------------
+	 * Enumerate fixed-feature devices (e.g. power and sleep buttons).
+	 */
+	if (acpi_fadt.pwr_button == 0) {
+		bm_add_fixed_feature_device(node_list.nodes[0],
+			BM_TYPE_FIXED_BUTTON, BM_HID_POWER_BUTTON);
+	}
+
+	if (acpi_fadt.sleep_button == 0) {
+		bm_add_fixed_feature_device(node_list.nodes[0],
+			BM_TYPE_FIXED_BUTTON, BM_HID_SLEEP_BUTTON);
+	}
+
+	return_ACPI_STATUS(AE_OK);
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:    bm_get_handle
+ *
+ * PARAMETERS:  
+ *
+ * RETURN:      
+ *
+ * DESCRIPTION: 
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+bm_get_handle (
+	ACPI_HANDLE             acpi_handle,
+	BM_HANDLE               *device_handle)
+{
+	ACPI_STATUS             status = AE_NOT_FOUND;
+	u32			i = 0;
+
+	FUNCTION_TRACE("bm_get_handle");
+
+	if (!device_handle) {
+		return_ACPI_STATUS(AE_BAD_PARAMETER);
+	}
+
+	*device_handle = BM_HANDLE_UNKNOWN;
+
+	/*
+	 * Search all devices for a match on the ACPI handle.
+	 */
+	for (i=0; i<node_list.count; i++) {
+
+		if (!node_list.nodes[i]) {
+			DEBUG_PRINT(ACPI_ERROR, ("Invalid (NULL) node entry [%02x] detected.\n", device_handle));
+			status = AE_NULL_ENTRY;
+			break;
+		}
+
+		if (node_list.nodes[i]->device.acpi_handle == acpi_handle) {
+			*device_handle = node_list.nodes[i]->device.handle;
+			status = AE_OK;
+			break;
+		}
+	}
+
+	return_ACPI_STATUS(status);
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:    bm_get_node
+ *
+ * PARAMETERS:  
+ *
+ * RETURN:      
+ *
+ * DESCRIPTION: 
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+bm_get_node (
+	BM_HANDLE               device_handle,
+	ACPI_HANDLE             acpi_handle,
+	BM_NODE			**node)
+{
+	ACPI_STATUS             status = AE_OK;
+
+	FUNCTION_TRACE("bm_get_node");
+
+	if (!node) {
+		return_ACPI_STATUS(AE_BAD_PARAMETER);
+	}
+
+	/* busmgr failed to init, but we're being called by subordinate drivers */
+	if (node_list.count < 1) {
+		return_ACPI_STATUS(AE_NOT_FOUND);
+	}
+
+	/*
+	 * If no device handle, resolve acpi handle to device handle.
+	 */
+	if (!device_handle && acpi_handle) {
+		status = bm_get_handle(acpi_handle, &device_handle);
+		if (ACPI_FAILURE(status))
+			return_ACPI_STATUS(status);
+	}
+
+	/*
+	 * Valid device handle?
+	 */
+	if (device_handle > BM_HANDLES_MAX) {
+		DEBUG_PRINT(ACPI_ERROR, ("Invalid node handle [%02x] detected.\n", device_handle));
+		return_ACPI_STATUS(AE_ERROR);
+	}
+
+	*node = node_list.nodes[device_handle];
+
+	/*
+	 * Valid node?
+	 */
+	if (!(*node)) {
+		DEBUG_PRINT(ACPI_ERROR, ("Invalid (NULL) node entry [%02x] detected.\n", device_handle));
+		return_ACPI_STATUS(AE_NULL_ENTRY);
+	}
+
+	return_ACPI_STATUS(AE_OK);
+}
+
+
+/****************************************************************************
+ *                            External Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ *
+ * FUNCTION:    bm_initialize
+ *
+ * PARAMETERS:  <none>
+ *
+ * RETURN:      Exception code.
+ *
+ * DESCRIPTION: 
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+bm_initialize (void)
+{
+	ACPI_STATUS             status = AE_OK;
+	u32                     start = 0;
+	u32                     stop = 0;
+	u32                     elapsed = 0;
+
+	FUNCTION_TRACE("bm_initialize");
+
+	MEMSET(&node_list, 0, sizeof(BM_NODE_LIST));
+
+	status = acpi_get_timer(&start);
+	if (ACPI_FAILURE(status)) {
+		return_ACPI_STATUS(status);
+	}
+
+	DEBUG_PRINT(ACPI_INFO, ("Building device hierarchy.\n"));
+
+	/*
+	 * Enumerate ACPI fixed-feature devices.
+	 */
+	status = bm_enumerate_fixed_features();
+	if (ACPI_FAILURE(status)) {
+		return_ACPI_STATUS(status);
+	}
+
+	/*
+	 * Enumerate the ACPI namespace.
+	 */
+	status = bm_enumerate_namespace();
+	if (ACPI_FAILURE(status)) {
+		return_ACPI_STATUS(status);
+	}
+
+	acpi_get_timer(&stop);
+	acpi_get_timer_duration(start, stop, &elapsed);
+
+	DEBUG_PRINT(ACPI_INFO, ("Building device hierarchy took [%d] microseconds.\n", elapsed));
+
+	/*
+	 * Display hierarchy.
+	 */
+	bm_print_hierarchy();
+
+	/*
+	 * Register for all standard and device-specific notifications.
+	 */
+	DEBUG_PRINT(ACPI_INFO, ("Registering for all device notifications.\n"));
+
+	status = acpi_install_notify_handler(ACPI_ROOT_OBJECT, 
+		ACPI_SYSTEM_NOTIFY, &bm_notify, NULL);
+	if (ACPI_FAILURE(status)) {
+		DEBUG_PRINT(ACPI_ERROR, ("Unable to register for standard notifications.\n"));
+		return_ACPI_STATUS(status);
+	}
+
+	status = acpi_install_notify_handler(ACPI_ROOT_OBJECT, 
+		ACPI_DEVICE_NOTIFY, &bm_notify, NULL);
+	if (ACPI_FAILURE(status)) {
+		DEBUG_PRINT(ACPI_ERROR, ("Unable to register for device-specific notifications.\n"));
+		return_ACPI_STATUS(status);
+	}
+
+	DEBUG_PRINT(ACPI_INFO, ("ACPI Bus Manager enabled.\n"));
+
+	/*
+	 * Initialize built-in power resource driver.
+	 */
+	bm_pr_initialize();
+
+	return_ACPI_STATUS(status);
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:    bm_terminate
+ *
+ * PARAMETERS:  <none>
+ *
+ * RETURN:      Exception code.
+ *
+ * DESCRIPTION: 
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+bm_terminate (void)
+{
+	ACPI_STATUS             status = AE_OK;
+	u32                     i = 0;
+
+	FUNCTION_TRACE("bm_terminate");
+
+	/*
+	 * Terminate built-in power resource driver.
+	 */
+	bm_pr_terminate();
+
+	/*
+	 * Unregister for all notifications.
+	 */
+	DEBUG_PRINT(ACPI_INFO, ("Unregistering for device notifications.\n"));
+
+	status = acpi_remove_notify_handler(ACPI_ROOT_OBJECT, 
+		ACPI_SYSTEM_NOTIFY, &bm_notify);
+	if (ACPI_FAILURE(status)) {
+		DEBUG_PRINT(ACPI_ERROR, ("Unable to un-register for standard notifications.\n"));
+	}
+
+	status = acpi_remove_notify_handler(ACPI_ROOT_OBJECT, 
+		ACPI_DEVICE_NOTIFY, &bm_notify);
+	if (ACPI_FAILURE(status)) {
+		DEBUG_PRINT(ACPI_ERROR, ("Unable to un-register for device-specific notifications.\n"));
+	}
+
+	/*
+	 * Parse through the device array, freeing all entries.
+	 */
+	DEBUG_PRINT(ACPI_INFO, ("Removing device hierarchy.\n"));
+	for (i = 0; i < node_list.count; i++) {
+		if (node_list.nodes[i]) {
+			acpi_os_free(node_list.nodes[i]);
+		}
+	}
+
+	DEBUG_PRINT(ACPI_INFO, ("ACPI Bus Manager disabled.\n"));
+
+	return_ACPI_STATUS(AE_OK);
+}
diff -urN linux-2.4.6-pre4/drivers/acpi/ospm/busmgr/bm_osl.c linux/drivers/acpi/ospm/busmgr/bm_osl.c
--- linux-2.4.6-pre4/drivers/acpi/ospm/busmgr/bm_osl.c	Wed Dec 31 16:00:00 1969
+++ linux/drivers/acpi/ospm/busmgr/bm_osl.c	Mon Dec  3 22:48:42 2001
@@ -0,0 +1,383 @@
+/*****************************************************************************
+ *
+ * Module Name: bm_osl.c
+ *   $Revision: 11 $
+ *
+ *****************************************************************************/
+
+/*
+ *  Copyright (C) 2000, 2001 Andrew Grover
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/types.h>
+#include <linux/proc_fs.h>
+#include <linux/spinlock.h>
+#include <asm/uaccess.h>
+#include <acpi.h>
+#include "bm.h"
+
+
+MODULE_AUTHOR("Andrew Grover");
+MODULE_DESCRIPTION("ACPI Component Architecture (CA) - ACPI Bus Manager");
+
+
+#ifdef ACPI_DEBUG
+
+static int dbg_layer = ACPI_COMPONENT_DEFAULT;
+MODULE_PARM(dbg_layer, "i");
+MODULE_PARM_DESC(dbg_layer, "Controls debug output (see acpi_dbg_layer).\n");
+
+static int dbg_level = DEBUG_DEFAULT;
+MODULE_PARM(dbg_level, "i");
+MODULE_PARM_DESC(dbg_level, "Controls debug output (see acpi_dbg_level).\n");
+
+#endif /*ACPI_DEBUG*/
+
+
+/*****************************************************************************
+ *                               Types & Defines
+ *****************************************************************************/
+
+typedef struct
+{
+	BM_HANDLE		device_handle;
+	char			*device_type;
+	char			*device_instance;
+	u32			event_type;
+	u32			event_data;
+	struct list_head	list;
+} BM_OSL_EVENT;
+
+
+#define BM_PROC_ROOT		"acpi"
+#define BM_PROC_EVENT		"event"
+#define BM_PROC_DEVICES		"devices"
+
+#define BM_MAX_STRING_LENGTH	80
+
+
+/****************************************************************************
+ *                                  Globals
+ ****************************************************************************/
+
+struct proc_dir_entry		*bm_proc_root = NULL;
+static struct proc_dir_entry	*bm_proc_event = NULL;
+
+#ifdef ACPI_DEBUG
+static u32			save_dbg_layer;
+static u32			save_dbg_level;
+#endif /*ACPI_DEBUG*/
+
+extern BM_NODE_LIST		node_list;
+
+static spinlock_t		bm_osl_event_lock = SPIN_LOCK_UNLOCKED;
+
+static LIST_HEAD(bm_event_list);
+
+static DECLARE_WAIT_QUEUE_HEAD(bm_event_wait_queue);
+
+static int event_is_open = 0;
+
+
+/****************************************************************************
+ *                                 Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ *
+ * FUNCTION:	bm_osl_generate_event
+ *
+ * DESCRIPTION: Generates an event for user-space consumption by writing
+ *              the event data to the 'event' file.
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+bm_osl_generate_event (
+	BM_HANDLE		device_handle,
+	char			*device_type,
+	char			*device_instance,
+	u32			event_type,
+	u32			event_data)
+{
+	BM_OSL_EVENT		*event = NULL;
+	u32			flags = 0;
+
+	/* drop event on the floor if no one's listening */
+	if (!event_is_open)
+		return (AE_OK);
+
+	/*
+	 * Allocate a new event structure.
+	 */
+	event = acpi_os_callocate(sizeof(BM_OSL_EVENT));
+	if (!event)
+		goto alloc_error;
+
+	event->device_type = acpi_os_callocate(strlen(device_type) 
+		+ sizeof(char));
+	if (!event->device_type)
+		goto alloc_error;
+
+	event->device_instance = acpi_os_callocate(strlen(device_instance) 
+		+ sizeof(char));
+	if (!event->device_instance)
+		goto alloc_error;
+
+	/*
+	 * Set event data.
+	 */
+	event->device_handle = device_handle;
+	strcpy(event->device_type, device_type);
+	strcpy(event->device_instance, device_instance);
+	event->event_type = event_type;
+	event->event_data = event_data;
+
+	/*
+	 * Add to the end of our event list.
+	 */
+	spin_lock_irqsave(&bm_osl_event_lock, flags);
+	list_add_tail(&event->list, &bm_event_list);
+	spin_unlock_irqrestore(&bm_osl_event_lock, flags);
+
+	/*
+	 * Signal waiting threads (if any).
+	 */
+	wake_up_interruptible(&bm_event_wait_queue);
+
+	return(AE_OK);
+
+alloc_error:
+	if (event->device_instance)
+		acpi_os_free(event->device_instance);
+
+	if (event->device_type)
+		acpi_os_free(event->device_type);
+
+	if (event)
+		acpi_os_free(event);		
+
+	return (AE_NO_MEMORY);
+}
+
+static int bm_osl_open_event(struct inode *inode, struct file *file)
+{
+	spin_lock_irq (&bm_osl_event_lock);
+
+	if(event_is_open)
+		goto out_busy;
+
+	event_is_open = 1;
+
+	spin_unlock_irq (&bm_osl_event_lock);
+	return 0;
+
+out_busy:
+	spin_unlock_irq (&bm_osl_event_lock);
+	return -EBUSY;
+}
+
+
+static int bm_osl_close_event(struct inode *inode, struct file *file)
+{
+	event_is_open = 0;
+	return 0;
+}
+
+/****************************************************************************
+ *
+ * FUNCTION:	bm_osl_read_event
+ *
+ * DESCRIPTION: Handles reads to the 'event' file by blocking user-mode 
+ *              threads until data (an event) is generated.
+ *
+ ****************************************************************************/
+static ssize_t
+bm_osl_read_event(
+	struct file		*file, 
+	char			*buf, 
+	size_t			count, 
+	loff_t			*ppos)
+{
+	char			str[BM_MAX_STRING_LENGTH];
+	int			size;
+	BM_OSL_EVENT		*event = NULL;
+	unsigned long		flags = 0;
+
+	DECLARE_WAITQUEUE(wait, current);
+
+	if (count < BM_MAX_STRING_LENGTH) {
+		return 0;
+	}
+
+	if (list_empty(&bm_event_list)) {
+
+		set_current_state(TASK_INTERRUPTIBLE);
+		add_wait_queue(&bm_event_wait_queue, &wait);
+
+		if (list_empty(&bm_event_list)) {
+			schedule();
+		}
+
+		remove_wait_queue(&bm_event_wait_queue, &wait);
+		set_current_state(TASK_RUNNING);
+
+		if (signal_pending(current)) {
+			return -ERESTARTSYS;
+		}
+	}
+
+	spin_lock_irqsave(&bm_osl_event_lock, flags);
+	event = list_entry(bm_event_list.next, BM_OSL_EVENT, list);
+	list_del(&event->list);
+	spin_unlock_irqrestore(&bm_osl_event_lock, flags);
+
+	/* BUG: buffer overrun? */
+	size = sprintf(str, "%s %s %08x %08x\n",
+		event->device_type, event->device_instance,
+		event->event_type, event->event_data);
+	
+	acpi_os_free(event->device_type);
+	acpi_os_free(event->device_instance);
+	acpi_os_free(event);
+
+	if (copy_to_user(buf, str, size))
+		return -EFAULT;
+
+	*ppos += size;
+
+	return size;
+}
+
+struct file_operations proc_event_operations = {
+	open:		bm_osl_open_event,
+	read:		bm_osl_read_event,
+	release:	bm_osl_close_event,
+};
+
+/****************************************************************************
+ *
+ * FUNCTION:    bm_osl_init
+ *
+ ****************************************************************************/
+
+int
+bm_osl_init(void)
+{
+	ACPI_STATUS		status = AE_OK;
+
+#ifdef ACPI_DEBUG
+	save_dbg_layer = acpi_dbg_layer;
+	acpi_dbg_layer = dbg_layer;
+
+	save_dbg_level = acpi_dbg_level;
+	acpi_dbg_level = dbg_level;
+#endif /*ACPI_DEBUG*/
+
+	bm_proc_root = proc_mkdir(BM_PROC_ROOT, NULL);
+	if (!bm_proc_root) {
+		return(AE_ERROR);
+	}
+
+	bm_proc_event = create_proc_entry(BM_PROC_EVENT, S_IRUSR, bm_proc_root);
+	if (bm_proc_event) {
+		bm_proc_event->proc_fops = &proc_event_operations;
+	}
+
+	status = bm_initialize();
+
+	return (ACPI_SUCCESS(status)) ? 0 : -ENODEV;
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:    bm_osl_cleanup
+ *
+ ****************************************************************************/
+
+void
+bm_osl_cleanup(void)
+{
+	bm_terminate();
+
+	if (bm_proc_event) {
+		remove_proc_entry(BM_PROC_EVENT, bm_proc_root);
+		bm_proc_event = NULL;
+	}
+
+	if (bm_proc_root) {
+		remove_proc_entry(BM_PROC_ROOT, NULL);
+		bm_proc_root = NULL;
+	}
+
+#ifdef ACPI_DEBUG
+	acpi_dbg_layer = save_dbg_layer;
+	acpi_dbg_level = save_dbg_level;
+#endif /*ACPI_DEBUG*/
+
+	return;
+}
+
+
+module_init(bm_osl_init);
+module_exit(bm_osl_cleanup);
+
+
+/****************************************************************************
+ *                                  Symbols
+ ****************************************************************************/
+
+/* bm.c */
+
+EXPORT_SYMBOL(bm_get_node);
+
+/* bmdriver.c */
+
+EXPORT_SYMBOL(bm_get_device_power_state);
+EXPORT_SYMBOL(bm_set_device_power_state);
+EXPORT_SYMBOL(bm_get_device_info);
+EXPORT_SYMBOL(bm_get_device_status);
+EXPORT_SYMBOL(bm_get_device_context);
+EXPORT_SYMBOL(bm_register_driver);
+EXPORT_SYMBOL(bm_unregister_driver);
+
+/* bmsearch.c */
+
+EXPORT_SYMBOL(bm_search);
+
+/* bmrequest.c */
+
+EXPORT_SYMBOL(bm_request);
+
+/* bmutils.c */
+
+EXPORT_SYMBOL(bm_extract_package_data);
+EXPORT_SYMBOL(bm_evaluate_object);
+EXPORT_SYMBOL(bm_evaluate_simple_integer);
+EXPORT_SYMBOL(bm_evaluate_reference_list);
+EXPORT_SYMBOL(bm_copy_to_buffer);
+EXPORT_SYMBOL(bm_cast_buffer);
+
+/* bm_proc.c */
+
+EXPORT_SYMBOL(bm_osl_generate_event);
+EXPORT_SYMBOL(bm_proc_root);
diff -urN linux-2.4.6-pre4/drivers/acpi/ospm/busmgr/bmdriver.c linux/drivers/acpi/ospm/busmgr/bmdriver.c
--- linux-2.4.6-pre4/drivers/acpi/ospm/busmgr/bmdriver.c	Wed Dec 31 16:00:00 1969
+++ linux/drivers/acpi/ospm/busmgr/bmdriver.c	Mon Dec  3 22:48:42 2001
@@ -0,0 +1,469 @@
+/*****************************************************************************
+ *
+ * Module Name: bmdriver.c
+ *   $Revision: 17 $
+ *
+ *****************************************************************************/
+
+/*
+ *  Copyright (C) 2000, 2001 Andrew Grover
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#include <acpi.h>
+#include "bm.h"
+
+#define _COMPONENT		ACPI_BUS
+	MODULE_NAME		("bmdriver")
+
+
+/****************************************************************************
+ *                            External Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ *
+ * FUNCTION:    bm_get_device_power_state
+ *
+ * PARAMETERS:  
+ *
+ * RETURN:      
+ *
+ * DESCRIPTION: 
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+bm_get_device_power_state (
+	BM_HANDLE               device_handle,
+	BM_POWER_STATE		*state)
+{
+	ACPI_STATUS             status = AE_OK;
+	BM_NODE			*node = NULL;
+
+	FUNCTION_TRACE("bm_get_device_power_state");
+
+	if (!state) {
+		return_ACPI_STATUS(AE_BAD_PARAMETER);
+	}
+
+	*state = ACPI_STATE_UNKNOWN;
+
+	/*
+	 * Resolve device handle to node.
+	 */
+	status = bm_get_node(device_handle, 0, &node);
+	if (ACPI_FAILURE(status)) {
+		return_ACPI_STATUS(status);
+	}
+
+	/*
+	 * Get the current power state.
+	 */
+	status = bm_get_power_state(node);
+	if (ACPI_FAILURE(status)) {
+		return_ACPI_STATUS(status);
+	}
+
+	*state = node->device.power.state;
+
+	return_ACPI_STATUS(status);
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:    bm_set_device_power_state
+ *
+ * PARAMETERS:  
+ *
+ * RETURN:      
+ *
+ * DESCRIPTION: 
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+bm_set_device_power_state (
+	BM_HANDLE               device_handle,
+	BM_POWER_STATE		state)
+{
+	ACPI_STATUS             status = AE_OK;
+	BM_NODE			*node = NULL;
+
+	FUNCTION_TRACE("bm_set_device_power_state");
+
+	/*
+	 * Resolve device handle to node.
+	 */
+	status = bm_get_node(device_handle, 0, &node);
+	if (ACPI_FAILURE(status)) {
+		return_ACPI_STATUS(status);
+	}
+
+	/*
+	 * Set the current power state.
+	 */
+	status = bm_set_power_state(node, state);
+	if (ACPI_FAILURE(status)) {
+		return_ACPI_STATUS(status);
+	}
+
+	return_ACPI_STATUS(status);
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:    bm_get_device_status
+ *
+ * PARAMETERS:  
+ *    device_handle is really an index number into the array of BM_DEVICE
+ *                  structures in info_list.  This data item is passed to
+ *                  the registered program's "notify" callback.  It is used
+ *                  to retrieve the specific BM_DEVICE structure instance
+ *                  associated with the callback.  
+ *    device_status is a pointer that receives the result of processing
+ *                  the device's associated ACPI _STA.
+ *
+ * RETURN:
+ *    The ACPI_STATUS value indicates success AE_OK or failure of the function
+ *
+ * DESCRIPTION: Evaluates the device's ACPI _STA, if it is present.
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+bm_get_device_status (
+	BM_HANDLE               device_handle,
+	BM_DEVICE_STATUS        *device_status)
+{
+	ACPI_STATUS             status = AE_OK;
+	BM_NODE			*node = NULL;
+
+	FUNCTION_TRACE("bm_get_device_status");
+
+	if (!device_status) {
+		return_ACPI_STATUS(AE_BAD_PARAMETER);
+	}
+
+	*device_status = BM_STATUS_UNKNOWN;
+
+	/*
+	 * Resolve device handle to node.
+	 */
+	status = bm_get_node(device_handle, 0, &node);
+	if (ACPI_FAILURE(status)) {
+		return_ACPI_STATUS(status);
+	}
+
+	/*
+	 * Parent Present?
+	 * ---------------
+	 * If the parent isn't present we can't evalute _STA on the child.
+	 * Return an unknown status.
+	 */
+	if (!BM_NODE_PRESENT(node->parent)) {
+		return_ACPI_STATUS(AE_OK);
+	}
+	
+	/*
+	 * Dynamic Status?
+	 * ---------------
+	 * If _STA isn't present we just return the default status.
+	 */
+	if (!(node->device.flags & BM_FLAGS_DYNAMIC_STATUS)) {
+		*device_status = BM_STATUS_DEFAULT;
+		return_ACPI_STATUS(AE_OK);
+	}
+
+	/*
+	 * Evaluate _STA:
+	 * --------------
+	 */
+	status = bm_evaluate_simple_integer(node->device.acpi_handle, "_STA", 
+		&(node->device.status));
+	if (ACPI_SUCCESS(status)) {
+		*device_status = node->device.status;
+	}
+
+	return_ACPI_STATUS(status);
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:    bm_get_device_info
+ *
+ * PARAMETERS:
+ *    device_handle An index used to retrieve the associated BM_DEVICE info.
+ *    device        A pointer to a BM_DEVICE structure instance pointer.
+ *                  This pointed to BM_DEVICE structure will contain the
+ *                  this device's information.
+ *
+ * RETURN:
+ *    The ACPI_STATUS value indicates success AE_OK or failure of the function
+ *
+ * DESCRIPTION:
+ *    Using the device_handle this function retrieves this device's
+ *    BM_DEVICE structure instance and save's it in device.
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+bm_get_device_info (
+	BM_HANDLE               device_handle,
+	BM_DEVICE               **device)
+{
+	ACPI_STATUS             status = AE_OK;
+	BM_NODE			*node = NULL;
+
+	FUNCTION_TRACE("bm_get_device_info");
+
+	if (!device) {
+		return_ACPI_STATUS(AE_BAD_PARAMETER);
+	}
+
+	/*
+	 * Resolve device handle to internal device.
+	 */
+	status = bm_get_node(device_handle, 0, &node);
+	if (ACPI_FAILURE(status)) {
+		return_ACPI_STATUS(status);
+	}
+
+	*device = &(node->device);
+
+	return_ACPI_STATUS(AE_OK);
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:    bm_get_device_context
+ *
+ *    device_handle An index used to retrieve the associated BM_DEVICE info.
+ *    context       A pointer to a BM_DRIVER_CONTEXT structure instance.
+ *
+ * RETURN:
+ *    The ACPI_STATUS value indicates success AE_OK or failure of the function
+ *
+ * DESCRIPTION:
+ *    Using the device_handle this function retrieves this device's
+ *    BM_DRIVER_CONTEXT structure instance and save's it in context.
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+bm_get_device_context (
+	BM_HANDLE               device_handle,
+	BM_DRIVER_CONTEXT	*context)
+{
+	ACPI_STATUS             status = AE_OK;
+	BM_NODE			*node = NULL;
+
+	FUNCTION_TRACE("bm_get_device_context");
+
+	if (!context) {
+		return_ACPI_STATUS(AE_BAD_PARAMETER);
+	}
+
+	*context = NULL;
+
+	/*
+	 * Resolve device handle to internal device.
+	 */
+	status = bm_get_node(device_handle, 0, &node);
+	if (ACPI_FAILURE(status)) {
+		return_ACPI_STATUS(status);
+	}
+
+	if (!node->driver.context) {
+		return_ACPI_STATUS(AE_NULL_ENTRY);
+	}
+
+	*context = node->driver.context;
+
+	return_ACPI_STATUS(AE_OK);
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:    bm_register_driver
+ *
+ * PARAMETERS:  
+ *
+ * RETURN:      
+ *
+ * DESCRIPTION: 
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+bm_register_driver (
+	BM_DEVICE_ID		*criteria,
+	BM_DRIVER		*driver)
+{
+	ACPI_STATUS             status = AE_NOT_FOUND;
+	BM_HANDLE_LIST          device_list;
+	BM_NODE			*node = NULL;
+	BM_DEVICE		*device = NULL;
+	u32                     i = 0;
+
+	FUNCTION_TRACE("bm_register_driver");
+
+	if (!criteria || !driver || !driver->notify || !driver->request) {
+		return_ACPI_STATUS(AE_BAD_PARAMETER);
+	}
+
+	MEMSET(&device_list, 0, sizeof(BM_HANDLE_LIST));
+
+	/*
+	 * Find Matches:
+	 * -------------
+	 * Search through the entire device hierarchy for matches against
+	 * the given device criteria.
+	 */
+	status = bm_search(BM_HANDLE_ROOT, criteria, &device_list);
+	if (ACPI_FAILURE(status)) {
+		return_ACPI_STATUS(status);
+	}
+
+	/*
+	 * Install driver:
+	 * ----------------
+	 * For each match, record the driver information and execute the 
+	 * driver's Notify() funciton (if present) to notify the driver
+	 * of the device's presence.
+	 */
+	for (i = 0; i < device_list.count; i++) {
+
+		/* Resolve the device handle. */
+		status = bm_get_node(device_list.handles[i], 0, &node);
+		if (ACPI_FAILURE(status)) {
+			continue;
+		}
+
+		device = &(node->device);
+
+		/* 
+		 * Make sure another driver hasn't already registered for 
+		 * this device. 
+		 */
+		if (BM_IS_DRIVER_CONTROL(device)) {
+			DEBUG_PRINT(ACPI_INFO, ("Another driver has already registered for device [%02x].\n", device->handle));
+			continue;
+		}
+
+		DEBUG_PRINT(ACPI_INFO, ("Registering driver for device [%02x].\n", device->handle));
+
+		/* Notify driver of new device. */
+		status = driver->notify(BM_NOTIFY_DEVICE_ADDED, 
+			node->device.handle, &(node->driver.context));
+		if (ACPI_SUCCESS(status)) {
+			node->driver.notify = driver->notify;
+			node->driver.request = driver->request;
+			node->device.flags |= BM_FLAGS_DRIVER_CONTROL;
+		}
+	}
+
+	return_ACPI_STATUS(AE_OK);
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:    bm_unregister_driver
+ *
+ * PARAMETERS:  
+ *
+ * RETURN:      
+ *
+ * DESCRIPTION: 
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+bm_unregister_driver (
+	BM_DEVICE_ID		*criteria,
+	BM_DRIVER		*driver)
+{
+	ACPI_STATUS             status = AE_NOT_FOUND;
+	BM_HANDLE_LIST          device_list;
+	BM_NODE			*node = NULL;
+	BM_DEVICE		*device = NULL;
+	u32                     i = 0;
+
+	FUNCTION_TRACE("bm_unregister_driver");
+
+	if (!criteria || !driver || !driver->notify || !driver->request) {
+		return_ACPI_STATUS(AE_BAD_PARAMETER);
+	}
+
+	MEMSET(&device_list, 0, sizeof(BM_HANDLE_LIST));
+
+	/*
+	 * Find Matches:
+	 * -------------
+	 * Search through the entire device hierarchy for matches against
+	 * the given device criteria.
+	 */
+	status = bm_search(BM_HANDLE_ROOT, criteria, &device_list);
+	if (ACPI_FAILURE(status)) {
+		return_ACPI_STATUS(status);
+	}
+
+	/*
+	 * Remove driver:
+	 * ---------------
+	 * For each match, execute the driver's Notify() function to allow
+	 * the driver to cleanup each device instance.
+	 */
+	for (i = 0; i < device_list.count; i++) {
+
+		/* Resolve the device handle. */
+		status = bm_get_node(device_list.handles[i], 0, &node);
+		if (ACPI_FAILURE(status)) {
+			continue;
+		}
+
+		device = &(node->device);
+
+		/* 
+		 * Make sure driver has really registered for this device. 
+		 */
+		if (!BM_IS_DRIVER_CONTROL(device)) {
+			DEBUG_PRINT(ACPI_INFO, ("Driver hasn't registered for device [%02x].\n", device->handle));
+			continue;
+		}
+
+		DEBUG_PRINT(ACPI_INFO, ("Unregistering driver for device [%02x].\n", device->handle));
+
+		/* Notify driver of device removal. */
+		status = node->driver.notify(BM_NOTIFY_DEVICE_REMOVED, 
+			node->device.handle, &(node->driver.context));
+		if (ACPI_SUCCESS(status)) {
+			node->driver.notify = NULL;
+			node->driver.request = NULL;
+			node->driver.context = NULL;
+			node->device.flags &= ~BM_FLAGS_DRIVER_CONTROL;
+		}
+	}
+
+	return_ACPI_STATUS(AE_OK);
+}
diff -urN linux-2.4.6-pre4/drivers/acpi/ospm/busmgr/bmnotify.c linux/drivers/acpi/ospm/busmgr/bmnotify.c
--- linux-2.4.6-pre4/drivers/acpi/ospm/busmgr/bmnotify.c	Wed Dec 31 16:00:00 1969
+++ linux/drivers/acpi/ospm/busmgr/bmnotify.c	Mon Dec  3 22:48:42 2001
@@ -0,0 +1,312 @@
+/*****************************************************************************
+ *
+ * Module Name: bmnotify.c
+ *   $Revision: 17 $
+ *
+ *****************************************************************************/
+
+/*
+ *  Copyright (C) 2000, 2001 Andrew Grover
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#include <acpi.h>
+#include "bm.h"
+
+
+#define _COMPONENT		ACPI_BUS
+	 MODULE_NAME		("bmnotify")
+
+
+/****************************************************************************
+ *                            Internal Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ *
+ * FUNCTION:    bm_generate_notify
+ *
+ * PARAMETERS:  
+ *
+ * RETURN:      
+ *
+ * DESCRIPTION: 
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+bm_generate_notify (
+	BM_NODE			*node,
+	u32			notify_type)
+{
+	ACPI_STATUS		status = AE_OK;
+	BM_DEVICE		*device = NULL;
+
+	FUNCTION_TRACE("bm_generate_notify");
+
+	if (!node) {
+		return_ACPI_STATUS(AE_BAD_PARAMETER);
+	}
+
+	device = &(node->device);
+
+	DEBUG_PRINT(ACPI_INFO, ("Sending notify [%02x] to device [%02x].\n", notify_type, node->device.handle));
+
+	if (!BM_IS_DRIVER_CONTROL(device)) {
+		DEBUG_PRINT(ACPI_INFO, ("No driver installed for device [%02x].\n", device->handle));
+		return_ACPI_STATUS(AE_NOT_EXIST);
+	}
+
+	status = node->driver.notify(notify_type, node->device.handle, 
+		&(node->driver.context));
+
+	return_ACPI_STATUS(status);
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:    bm_device_check
+ *
+ * PARAMETERS:  
+ *
+ * RETURN:      
+ *
+ * DESCRIPTION: 
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+bm_device_check (
+	BM_NODE			*node,
+	u32			*status_change)
+{
+	ACPI_STATUS             status = AE_OK;
+	BM_DEVICE		*device = NULL;
+	BM_DEVICE_STATUS	old_status = BM_STATUS_UNKNOWN;
+
+	FUNCTION_TRACE("bm_device_check");
+
+	if (!node) {
+		return_ACPI_STATUS(AE_BAD_PARAMETER);
+	}
+
+	device = &(node->device);
+
+	if (status_change) {
+		*status_change = FALSE;
+	}
+
+	old_status = device->status;
+
+	/*
+	 * Parent Present?
+	 * ---------------
+	 * Only check this device if its parent is present (which implies
+	 * this device MAY be present).
+	 */
+	if (!BM_NODE_PRESENT(node->parent)) {
+		return_ACPI_STATUS(AE_OK);
+	}
+
+	/*
+	 * Get Status:
+	 * -----------
+	 * And see if the status has changed.
+	 */
+	status = bm_get_status(device);
+	if (ACPI_FAILURE(status)) {
+		return_ACPI_STATUS(status);
+	}
+	
+	if (old_status == node->device.status) {
+		return_ACPI_STATUS(AE_OK);
+	}
+
+	if (status_change) {
+		*status_change = TRUE;
+	}
+	
+	/*
+	 * Device Insertion?
+	 * -----------------
+	 */
+	if ((device->status & BM_STATUS_PRESENT) && 
+		!(old_status & BM_STATUS_PRESENT)) {
+		/* TBD: Make sure driver is loaded, and if not, load. */
+		status = bm_generate_notify(node, BM_NOTIFY_DEVICE_ADDED);
+	}
+
+	/*
+	 * Device Removal?
+	 * ---------------
+	 */
+	else if (!(device->status & BM_STATUS_PRESENT) && 
+		(old_status & BM_STATUS_PRESENT)) {
+		/* TBD: Unload driver if last device instance. */
+		status = bm_generate_notify(node, BM_NOTIFY_DEVICE_REMOVED);
+	}
+
+	return_ACPI_STATUS(AE_OK);
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:    bm_bus_check
+ *
+ * PARAMETERS:  
+ *
+ * RETURN:      
+ *
+ * DESCRIPTION: 
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+bm_bus_check (
+	BM_NODE			*parent_node)
+{
+	ACPI_STATUS             status = AE_OK;
+	u32			status_change = FALSE;
+
+	FUNCTION_TRACE("bm_bus_check");
+
+	if (!parent_node) {
+		return_ACPI_STATUS(AE_BAD_PARAMETER);
+	}
+
+	/*
+	 * Status Change?
+	 * --------------
+	 */
+	status = bm_device_check(parent_node, &status_change);
+	if (ACPI_FAILURE(status) || !status_change) {
+		return_ACPI_STATUS(status);
+	}
+
+	/*
+	 * Enumerate Scope:
+	 * ----------------
+	 * TBD: Enumerate child devices within this device's scope and
+	 *       run bm_device_check()'s on them...
+	 */
+
+	return_ACPI_STATUS(AE_OK);
+}
+
+
+/****************************************************************************
+ *                            External Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ *
+ * FUNCTION:    bm_notify
+ *
+ * PARAMETERS:  
+ *
+ * RETURN:      
+ *
+ * DESCRIPTION: 
+ *
+ ****************************************************************************/
+
+void
+bm_notify (
+	ACPI_HANDLE             acpi_handle,
+	u32                     notify_value,
+	void                    *context)
+{
+	ACPI_STATUS             status = AE_OK;
+	BM_NODE			*node = NULL;
+
+	FUNCTION_TRACE("bm_notify");
+
+	/*
+	 * Resolve the ACPI handle.
+	 */
+	status = bm_get_node(0, acpi_handle, &node);
+	if (ACPI_FAILURE(status)) {
+		DEBUG_PRINT(ACPI_INFO, ("Recieved notify [%02x] for unknown device [%p].\n", notify_value, acpi_handle));
+		return_VOID;
+	}
+
+	/*
+	 * Device-Specific or Standard?
+	 * ----------------------------
+	 * Device-specific notifies are forwarded to the control module's 
+	 * notify() function for processing.  Standard notifies are handled
+	 * internally.
+	 */
+	if (notify_value > 0x7F) {
+		status = bm_generate_notify(node, notify_value);
+	}
+	else {
+		switch (notify_value) {
+
+		case BM_NOTIFY_BUS_CHECK:
+			DEBUG_PRINT(ACPI_INFO, ("Received BUS CHECK notification for device [%02x].\n", node->device.handle));
+			status = bm_bus_check(node);
+			break;
+
+		case BM_NOTIFY_DEVICE_CHECK:
+			DEBUG_PRINT(ACPI_INFO, ("Received DEVICE CHECK notification for device [%02x].\n", node->device.handle));
+			status = bm_device_check(node, NULL);
+			break;
+
+		case BM_NOTIFY_DEVICE_WAKE:
+			DEBUG_PRINT(ACPI_INFO, ("Received DEVICE WAKE notification for device [%02x].\n", node->device.handle));
+			/* TBD */
+			break;
+
+		case BM_NOTIFY_EJECT_REQUEST:
+			DEBUG_PRINT(ACPI_INFO, ("Received EJECT REQUEST notification for device [%02x].\n", node->device.handle));
+			/* TBD */
+			break;
+
+		case BM_NOTIFY_DEVICE_CHECK_LIGHT:
+			DEBUG_PRINT(ACPI_INFO, ("Received DEVICE CHECK LIGHT notification for device [%02x].\n", node->device.handle));
+			/* TBD: Exactly what does the 'light' mean? */
+			status = bm_device_check(node, NULL);
+			break;
+
+		case BM_NOTIFY_FREQUENCY_MISMATCH:
+			DEBUG_PRINT(ACPI_INFO, ("Received FREQUENCY MISMATCH notification for device [%02x].\n", node->device.handle));
+			/* TBD */
+			break;
+
+		case BM_NOTIFY_BUS_MODE_MISMATCH:
+			DEBUG_PRINT(ACPI_INFO, ("Received BUS MODE MISMATCH notification for device [%02x].\n", node->device.handle));
+			/* TBD */
+			break;
+
+		case BM_NOTIFY_POWER_FAULT:
+			DEBUG_PRINT(ACPI_INFO, ("Received POWER FAULT notification.\n"));
+			/* TBD */
+			break;
+
+		default:
+			DEBUG_PRINT(ACPI_INFO, ("Received unknown/unsupported notification.\n"));
+			break;
+		}
+	}
+
+	return_VOID;
+}
+
+
diff -urN linux-2.4.6-pre4/drivers/acpi/ospm/busmgr/bmpm.c linux/drivers/acpi/ospm/busmgr/bmpm.c
--- linux-2.4.6-pre4/drivers/acpi/ospm/busmgr/bmpm.c	Wed Dec 31 16:00:00 1969
+++ linux/drivers/acpi/ospm/busmgr/bmpm.c	Mon Dec  3 22:48:42 2001
@@ -0,0 +1,442 @@
+/*****************************************************************************
+ *
+ * Module Name: bmpm.c
+ *   $Revision: 10 $
+ *
+ *****************************************************************************/
+
+/*
+ *  Copyright (C) 2000, 2001 Andrew Grover
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#include <acpi.h>
+#include "bm.h"
+#include "bmpower.h"
+
+
+#define _COMPONENT		ACPI_BUS
+	MODULE_NAME		("bmpm")
+
+
+/****************************************************************************
+ *                             Internal Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ *
+ * FUNCTION:    bm_get_inferred_power_state
+ *
+ * PARAMETERS:  
+ *
+ * RETURN:      
+ *
+ * DESCRIPTION: 
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+bm_get_inferred_power_state (
+	BM_DEVICE               *device)
+{
+	ACPI_STATUS             status = AE_OK;
+	BM_HANDLE_LIST          pr_list;
+	BM_POWER_STATE          list_state = ACPI_STATE_UNKNOWN;
+	char                    object_name[5] = {'_','P','R','0','\0'};
+	u32                     i = 0;
+
+	FUNCTION_TRACE("bm_get_inferred_power_state");
+
+	if (!device) {
+		return_ACPI_STATUS(AE_BAD_PARAMETER);
+	}
+
+	MEMSET(&pr_list, 0, sizeof(BM_HANDLE_LIST));
+
+	device->power.state = ACPI_STATE_D3;
+
+	/*
+	 * Calculate Power State:
+	 * ----------------------
+	 * Try to infer the devices's power state by checking the state of 
+	 * the devices's power resources.  We start by evaluating _PR0
+	 * (resource requirements at D0) and work through _PR1 and _PR2.
+	 * We know the current devices power state when all resources (for 
+	 * a give Dx state) are ON.  If no power resources are on then the 
+	 * device is assumed to be off (D3).
+	 */
+	for (i=ACPI_STATE_D0; i<ACPI_STATE_D3; i++) {
+
+		object_name[3] = '0' + i;
+
+		status = bm_evaluate_reference_list(device->acpi_handle, 
+			object_name, &pr_list);
+
+		if (ACPI_SUCCESS(status)) {
+
+			status = bm_pr_list_get_state(&pr_list, &list_state);
+
+			if (ACPI_SUCCESS(status)) {
+
+				if (list_state == ACPI_STATE_D0) {
+					device->power.state = i;
+					break;
+				}
+			}
+		}
+	}
+
+	return_ACPI_STATUS(AE_OK);
+}
+
+
+/****************************************************************************
+ *                             External Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ *
+ * FUNCTION:    bm_get_power_state
+ *
+ * PARAMETERS:  
+ *
+ * RETURN:      
+ *
+ * DESCRIPTION: 
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+bm_get_power_state (
+	BM_NODE			*node)
+{
+	ACPI_STATUS             status = AE_OK;
+	BM_DEVICE               *device = NULL;
+
+	FUNCTION_TRACE("bm_get_power_state");
+
+	if (!node || !node->parent) {
+		return_ACPI_STATUS(AE_BAD_PARAMETER);
+	}
+
+	device = &(node->device);
+
+	device->power.state = ACPI_STATE_UNKNOWN;
+
+	/*
+	 * Power Control?
+	 * --------------
+	 * If this device isn't directly power manageable (e.g. doesn't 
+	 * include _PR0/_PS0) then there's nothing to do (state is static).
+	 */
+	if (!BM_IS_POWER_CONTROL(device)) {
+		return_ACPI_STATUS(AE_OK);
+	}
+
+	/*
+	 * Parent Present?
+	 * ---------------
+	 * Make sure the parent is present before mucking with the child.
+	 */
+	if (!BM_NODE_PRESENT(node->parent)) {
+		return_ACPI_STATUS(AE_NOT_EXIST);
+	}
+	
+	/*
+	 * Get Power State:
+	 * ----------------
+	 * Either directly (via _PSC) or inferred (via power resource
+	 * dependencies).
+	 */
+	if (BM_IS_POWER_STATE(device)) {
+		status = bm_evaluate_simple_integer(device->acpi_handle, 
+			"_PSC", &(device->power.state));
+	}
+	else {
+		status = bm_get_inferred_power_state(device);
+	}
+
+	if (ACPI_SUCCESS(status)) {
+		DEBUG_PRINT(ACPI_INFO, ("Device [%02x] is at power state [D%d].\n", device->handle, device->power.state));
+	}
+	else {
+		DEBUG_PRINT(ACPI_INFO, ("Error getting power state for device [%02x]\n", device->handle));
+	}
+
+	return_ACPI_STATUS(status);
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:    bm_set_power_state
+ *
+ * PARAMETERS:  
+ *
+ * RETURN:      
+ *
+ * DESCRIPTION: 
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+bm_set_power_state (
+	BM_NODE			*node,
+	BM_POWER_STATE          state)
+{
+	ACPI_STATUS             status = AE_OK;
+	BM_DEVICE		*device = NULL;
+	BM_DEVICE		*parent_device = NULL;
+	BM_HANDLE_LIST          current_list;
+	BM_HANDLE_LIST          target_list;
+	char                    object_name[5] = {'_','P','R','0','\0'};
+
+	FUNCTION_TRACE("bm_set_power_state");
+
+	if (!node || !node->parent || (state > ACPI_STATE_D3)) {
+		return_ACPI_STATUS(AE_BAD_PARAMETER);
+	}
+
+	MEMSET(&current_list, 0, sizeof(BM_HANDLE_LIST));
+	MEMSET(&target_list, 0, sizeof(BM_HANDLE_LIST));
+
+	device = &(node->device);
+	parent_device = &(node->parent->device);
+
+	/*
+	 * Power Control?
+	 * --------------
+	 * If this device isn't directly power manageable (e.g. doesn't 
+	 * include _PR0/_PS0) then return an error (can't set state).
+	 */
+	if (!BM_IS_POWER_CONTROL(device)) {
+		return_ACPI_STATUS(AE_ERROR);
+	}
+
+	/*
+	 * Parent Present?
+	 * ---------------
+	 * Make sure the parent is present before mucking with the child.
+	 */
+	if (!BM_NODE_PRESENT(node->parent)) {
+		return_ACPI_STATUS(AE_NOT_EXIST);
+	}
+	
+	/*
+	 * Check Parent's Power State:
+	 * ---------------------------
+	 * Can't be in a higher power state (lower Dx value) than parent.
+	 */
+	if (state < parent_device->power.state) {
+		DEBUG_PRINT(ACPI_WARN, ("Cannot set device [%02x] to a higher-powered state than parent_device.\n", device->handle));
+		return_ACPI_STATUS(AE_ERROR);
+	}
+
+	/*
+	 * Get Resources:
+	 * --------------
+	 * Get the power resources associated with the device's current 
+	 * and target power states.
+	 */
+	if (device->power.state != ACPI_STATE_UNKNOWN) {
+		object_name[3] = '0' + device->power.state;
+		bm_evaluate_reference_list(device->acpi_handle, 
+			object_name, &current_list);
+	}
+
+	object_name[3] = '0' + state;
+	bm_evaluate_reference_list(device->acpi_handle, object_name, 
+		&target_list);
+
+	/*
+	 * Transition Resources:
+	 * ---------------------
+	 * Transition all power resources referenced by this device to 
+	 * the correct power state (taking into consideration sequencing 
+	 * and dependencies to other devices).
+	 */
+	if (current_list.count || target_list.count) {
+		status = bm_pr_list_transition(&current_list, &target_list);
+	}
+	if (ACPI_FAILURE(status)) {
+		return_ACPI_STATUS(status);
+	}
+
+	/*
+	 * Execute _PSx:
+	 * -------------
+	 * Execute the _PSx method corresponding to the target Dx state, 
+	 * if it exists.
+	 */
+	object_name[2] = 'S';
+	object_name[3] = '0' + state;
+	bm_evaluate_object(device->acpi_handle, object_name, NULL, NULL);
+
+	if (ACPI_SUCCESS(status)) {
+		DEBUG_PRINT(ACPI_INFO, ("Device [%02x] is now at [D%d].\n", device->handle, state));
+		device->power.state = state;
+	}
+
+	return_ACPI_STATUS(status);
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:    bm_get_pm_capabilities
+ *
+ * PARAMETERS:  
+ *
+ * RETURN:      
+ *
+ * DESCRIPTION: 
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+bm_get_pm_capabilities (
+	BM_NODE			*node)
+{
+	ACPI_STATUS             status = AE_OK;
+	BM_DEVICE		*device = NULL;
+	BM_DEVICE		*parent_device = NULL;
+	ACPI_HANDLE             acpi_handle = NULL;
+	BM_POWER_STATE          dx_supported = ACPI_STATE_UNKNOWN;
+	char                    object_name[5] = {'_','S','0','D','\0'};
+	u32                     i = 0;
+
+	FUNCTION_TRACE("bm_get_pm_capabilities");
+
+	if (!node || !node->parent) {
+		return_ACPI_STATUS(AE_BAD_PARAMETER);
+	}
+
+	device = &(node->device);
+	parent_device = &(node->parent->device);
+
+	/*
+	 * Power Management Flags:
+	 * -----------------------
+	 */
+	if (ACPI_SUCCESS(acpi_get_handle(device->acpi_handle, "_PSC", 
+		&acpi_handle))) {
+		device->power.flags |= BM_FLAGS_POWER_STATE;
+	}
+
+	if (ACPI_SUCCESS(acpi_get_handle(device->acpi_handle, "_IRC", 
+		&acpi_handle))) {
+		device->power.flags |= BM_FLAGS_INRUSH_CURRENT;
+	}
+
+	if (ACPI_SUCCESS(acpi_get_handle(device->acpi_handle, "_PRW", 
+		&acpi_handle))) {
+		device->power.flags |= BM_FLAGS_WAKE_CAPABLE;
+	}
+
+	/*
+	 * Device Power State:
+	 * -------------------
+	 * Note that we can't get the device's power state until we've
+	 * initialized all power resources, so for now we just set to
+	 * unknown.
+	 */
+	device->power.state = ACPI_STATE_UNKNOWN;
+
+	/*
+	 * Dx Supported in S0:
+	 * -------------------
+	 * Figure out which Dx states are supported by this device for the
+	 * S0 (working) state.  Note that D0 and D3 are required (assumed).
+	 */
+	device->power.dx_supported[ACPI_STATE_S0] = BM_FLAGS_D0_SUPPORT | 
+		BM_FLAGS_D3_SUPPORT;
+
+	if ((ACPI_SUCCESS(acpi_get_handle(device->acpi_handle, "_PR1", 
+		&acpi_handle))) || 
+		(ACPI_SUCCESS(acpi_get_handle(device->acpi_handle, "_PS1", 
+		&acpi_handle)))) {
+		device->power.dx_supported[ACPI_STATE_S0] |= 
+			BM_FLAGS_D1_SUPPORT;
+	}
+
+	if ((ACPI_SUCCESS(acpi_get_handle(device->acpi_handle, "_PR2", 
+		&acpi_handle))) || 
+		(ACPI_SUCCESS(acpi_get_handle(device->acpi_handle, "_PS2", 
+		&acpi_handle)))) {
+		device->power.dx_supported[ACPI_STATE_S0] |= 
+			BM_FLAGS_D2_SUPPORT;
+	}
+
+	/*
+	 * Dx Supported in S1-S5:
+	 * ----------------------
+	 * Figure out which Dx states are supported by this device for
+	 * all other Sx states.
+	 */
+	for (i = ACPI_STATE_S1; i <= ACPI_STATE_S5; i++) {
+
+		/*
+		 * D3 support is assumed (off is always possible!).
+		 */
+		device->power.dx_supported[i] = BM_FLAGS_D3_SUPPORT;
+
+		/*
+		 * Evalute _SxD:
+		 * -------------
+		 * Which returns the highest (power) Dx state supported in 
+		 * this system (Sx) state.  We convert this value to a bit 
+		 * mask of supported states (conceptually simpler).
+		 */
+		status = bm_evaluate_simple_integer(device->acpi_handle, 
+			object_name, &dx_supported);
+		if (ACPI_SUCCESS(status)) {
+			switch (dx_supported) {
+			case 0:
+				device->power.dx_supported[i] |= 
+					BM_FLAGS_D0_SUPPORT;
+				/* fall through */
+			case 1:
+				device->power.dx_supported[i] |= 
+					BM_FLAGS_D1_SUPPORT;
+				/* fall through */
+			case 2:
+				device->power.dx_supported[i] |= 
+					BM_FLAGS_D2_SUPPORT;
+				/* fall through */
+			case 3:
+				device->power.dx_supported[i] |= 
+					BM_FLAGS_D3_SUPPORT;
+				break;
+			}
+
+			/*
+			 * Validate:
+			 * ---------
+			 * Mask of any states that _Sx_d falsely advertises 
+			 * (e.g.claims D1 support but neither _PR2 or _PS2 
+			 * exist).  In other words, S1-S5 can't offer a Dx 
+			 * state that isn't supported by S0.
+			 */
+			device->power.dx_supported[i] &= 
+				device->power.dx_supported[ACPI_STATE_S0];
+		}
+
+		object_name[2]++;
+	}
+
+	return_ACPI_STATUS(AE_OK);
+}
diff -urN linux-2.4.6-pre4/drivers/acpi/ospm/busmgr/bmpower.c linux/drivers/acpi/ospm/busmgr/bmpower.c
--- linux-2.4.6-pre4/drivers/acpi/ospm/busmgr/bmpower.c	Wed Dec 31 16:00:00 1969
+++ linux/drivers/acpi/ospm/busmgr/bmpower.c	Mon Dec  3 22:48:42 2001
@@ -0,0 +1,663 @@
+/****************************************************************************
+ *
+ * Module Name: bmpower.c - Driver for ACPI Power Resource 'devices'
+ *   $Revision: 14 $
+ *
+ ****************************************************************************/
+
+/*
+ *  Copyright (C) 2000, 2001 Andrew Grover
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+/*
+ * TBD: 1. Sequencing of power resource list transitions.
+ *	2. Global serialization of power resource transtions (see ACPI 
+ *         spec section 7.1.2/7.1.3).
+ *      3. Better error handling.
+ */
+
+
+#include <acpi.h>
+#include "bm.h"
+#include "bmpower.h"
+
+
+#define _COMPONENT		ACPI_BUS
+	MODULE_NAME		("bmpower")
+
+
+/****************************************************************************
+ *                             Function Prototypes
+ ****************************************************************************/
+
+ACPI_STATUS
+bm_pr_notify (
+	BM_NOTIFY               notify_type,
+	BM_HANDLE               device_handle,
+	void                    **context);
+	
+ACPI_STATUS
+bm_pr_request (
+	BM_REQUEST		*request,
+	void                    *context);
+
+	
+/****************************************************************************
+ *                             Internal Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ *
+ * FUNCTION:    bm_pr_print
+ *
+ * PARAMETERS:  
+ *
+ * RETURN:      
+ *
+ * DESCRIPTION: 
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+bm_pr_print (
+	BM_POWER_RESOURCE	*pr)
+{
+	ACPI_BUFFER             buffer;
+
+	if (!pr) {
+		return(AE_BAD_PARAMETER);
+	}
+
+	buffer.length = 256;
+	buffer.pointer = acpi_os_callocate(buffer.length);
+	if (!buffer.pointer) {
+		return(AE_NO_MEMORY);
+	}
+
+	acpi_get_name(pr->acpi_handle, ACPI_FULL_PATHNAME, &buffer);
+
+	acpi_os_printf("Power Resource: found\n");
+
+	DEBUG_PRINT_RAW(ACPI_INFO, ("+------------------------------------------------------------\n"));
+	DEBUG_PRINT_RAW(ACPI_INFO, ("| PowerResource[%02x]:[%p] %s\n", pr->device_handle, pr->acpi_handle, buffer.pointer));
+	DEBUG_PRINT_RAW(ACPI_INFO, ("|   system_level[S%d] resource_order[%d]\n", pr->system_level, pr->resource_order));
+	DEBUG_PRINT_RAW(ACPI_INFO, ("|   state[D%d] reference_count[%d]\n", pr->state, pr->reference_count));
+	DEBUG_PRINT_RAW(ACPI_INFO, ("+------------------------------------------------------------\n"));
+
+	acpi_os_free(buffer.pointer);
+
+	return(AE_OK);
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:    bm_pr_get_state
+ *
+ * PARAMETERS:  
+ *
+ * RETURN:      
+ *
+ * DESCRIPTION: 
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+bm_pr_get_state (
+	BM_POWER_RESOURCE	*pr)
+{
+	ACPI_STATUS             status = AE_OK;
+	BM_DEVICE_STATUS        device_status = BM_STATUS_UNKNOWN;
+
+	FUNCTION_TRACE("bm_pr_get_state");
+
+	if (!pr) {
+		return_ACPI_STATUS(AE_BAD_PARAMETER);
+	}
+
+	pr->state = ACPI_STATE_UNKNOWN;
+
+	/* 
+	 * Evaluate _STA:
+	 * --------------
+	 * Evalute _STA to determine whether the power resource is ON or OFF.
+	 * Note that if the power resource isn't present we'll get AE_OK but
+	 * an unknown status.
+	 */
+	status = bm_get_device_status(pr->device_handle, &device_status);
+	if (ACPI_FAILURE(status)) {
+		DEBUG_PRINT(ACPI_ERROR, ("Error reading status for power resource [%02x].\n", pr->device_handle));
+		return_ACPI_STATUS(status);
+	}
+
+	/*
+	 * Mask off all bits but the first as some systems return non-standard 
+	 * values (e.g. 0x51).
+	 */
+	switch (device_status & 0x01) {
+	case 0:
+		DEBUG_PRINT(ACPI_INFO, ("Power resource [%02x] is OFF.\n", pr->device_handle));
+		pr->state = ACPI_STATE_D3;
+		break;
+	case 1:
+		DEBUG_PRINT(ACPI_INFO, ("Power resource [%02x] is ON.\n", pr->device_handle));
+		pr->state = ACPI_STATE_D0;
+		break;
+	}
+
+	return_ACPI_STATUS(status);
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:    bm_pr_set_state
+ *
+ * PARAMETERS:  
+ *
+ * RETURN:      
+ *
+ * DESCRIPTION: 
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+bm_pr_set_state (
+	BM_POWER_RESOURCE	*pr,
+	BM_POWER_STATE          target_state)
+{
+	ACPI_STATUS             status = AE_OK;
+
+	FUNCTION_TRACE("bm_pr_set_state");
+
+	if (!pr) {
+		return_ACPI_STATUS(AE_BAD_PARAMETER);
+	}
+
+	status = bm_pr_get_state(pr);
+	if (ACPI_FAILURE(status)) {
+		return_ACPI_STATUS(status);
+	}
+
+	if (target_state == pr->state) {
+		DEBUG_PRINT(ACPI_INFO, ("Power resource [%02x] already at target power state [D%d].\n", pr->device_handle, pr->state));
+		return_ACPI_STATUS(AE_OK);
+	}
+
+	switch (target_state) {
+
+	case ACPI_STATE_D0:
+		DEBUG_PRINT(ACPI_INFO, ("Turning power resource [%02x] ON.\n", pr->device_handle));
+		status = bm_evaluate_object(pr->acpi_handle, "_ON", NULL, NULL);
+		break;
+
+	case ACPI_STATE_D3:
+		DEBUG_PRINT(ACPI_INFO, ("Turning power resource [%02x] OFF.\n", pr->device_handle));
+		status = bm_evaluate_object(pr->acpi_handle, "_OFF", NULL, NULL);
+		break;
+
+	default:
+		status = AE_BAD_PARAMETER;
+		break;
+	}
+
+	status = bm_pr_get_state(pr);
+	if (ACPI_FAILURE(status)) {
+		return_ACPI_STATUS(status);
+	}
+
+	return_ACPI_STATUS(status);
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:    bm_pr_list_get_state
+ *
+ * PARAMETERS:  
+ *
+ * RETURN:      
+ *
+ * DESCRIPTION: 
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+bm_pr_list_get_state (
+	BM_HANDLE_LIST          *pr_list,
+	BM_POWER_STATE          *power_state)
+{
+	ACPI_STATUS             status = AE_OK;
+	BM_POWER_RESOURCE	*pr = NULL;
+	u32                     i = 0;
+
+	FUNCTION_TRACE("bm_pr_list_get_state");
+
+	if (!pr_list || !power_state) {
+		return_ACPI_STATUS(AE_BAD_PARAMETER);
+	}
+
+	if (pr_list->count < 1) {
+		pr->state = ACPI_STATE_UNKNOWN;
+		return_ACPI_STATUS(AE_ERROR);
+	}
+
+	(*power_state) = ACPI_STATE_D0;
+
+	/*
+	 * Calculate Current power_state:
+	 * -----------------------------
+	 * The current state of a list of power resources is ON if all
+	 * power resources are currently in the ON state.  In other words,
+	 * if any power resource in the list is OFF then the collection 
+	 * isn't fully ON.
+	 */
+	for (i = 0; i < pr_list->count; i++) {
+
+		status = bm_get_device_context(pr_list->handles[i],
+			(BM_DRIVER_CONTEXT*)(&pr));
+		if (ACPI_FAILURE(status)) {
+			DEBUG_PRINT(ACPI_WARN, ("Invalid reference to power resource [%02x].\n", pr_list->handles[i]));
+			(*power_state) = ACPI_STATE_UNKNOWN;
+			break;
+		}
+
+		status = bm_pr_get_state(pr);
+		if (ACPI_FAILURE(status)) {
+			(*power_state) = ACPI_STATE_UNKNOWN;
+			break;
+		}
+
+		if (pr->state != ACPI_STATE_D0) {
+			(*power_state) = pr->state;
+			break;
+		}
+	}
+
+	return_ACPI_STATUS(status);
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:    bm_pr_list_transition
+ *
+ * PARAMETERS:  
+ *
+ * RETURN:      
+ *
+ * DESCRIPTION: 
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+bm_pr_list_transition (
+	BM_HANDLE_LIST          *current_list,
+	BM_HANDLE_LIST          *target_list)
+{
+	ACPI_STATUS             status = AE_OK;
+	BM_POWER_RESOURCE	*pr = NULL;
+	u32                     i = 0;
+
+	FUNCTION_TRACE("bm_pr_list_transition");
+
+	if (!current_list || !target_list) {
+		return_ACPI_STATUS(AE_BAD_PARAMETER);
+	}
+
+	/*
+	 * Reference Target:
+	 * -----------------
+	 * Reference all resources for the target power state first (so 
+	 * the device doesn't get turned off while transitioning).  Power 
+	 * resources that aren't on (new reference count of 1) are turned on.
+	 */
+	for (i = 0; i < target_list->count; i++) {
+
+		status = bm_get_device_context(target_list->handles[i], 
+			(BM_DRIVER_CONTEXT*)(&pr));
+		if (ACPI_FAILURE(status)) {
+			DEBUG_PRINT(ACPI_WARN, ("Invalid reference to power resource [%02x].\n", target_list->handles[i]));
+			continue;
+		}
+
+		if (++pr->reference_count == 1) {
+			/* TBD: Need ordering based upon resource_order */
+			status = bm_pr_set_state(pr, ACPI_STATE_D0);
+			if (ACPI_FAILURE(status)) {
+				/* TBD: How do we handle this? */
+				DEBUG_PRINT(ACPI_WARN, ("Unable to change power state for power resource [%02x].\n", target_list->handles[i]));
+			}
+		}
+	}
+
+	/*
+	 * Dereference Current:
+	 * --------------------
+	 * Dereference all resources for the current power state.  Power
+	 * resources no longer referenced (new reference count of 0) are 
+	 * turned off.
+	 */
+	for (i = 0; i < current_list->count; i++) {
+
+		status = bm_get_device_context(current_list->handles[i], 
+			(BM_DRIVER_CONTEXT*)(&pr));
+		if (ACPI_FAILURE(status)) {
+			DEBUG_PRINT(ACPI_WARN, ("Invalid reference to power resource [%02x].\n", target_list->handles[i]));
+			continue;
+		}
+
+		if (--pr->reference_count == 0) {
+			/* TBD: Need ordering based upon resource_order */
+			status = bm_pr_set_state(pr, ACPI_STATE_D3);
+			if (ACPI_FAILURE(status)) {
+				/* TBD: How do we handle this? */
+				DEBUG_PRINT(ACPI_ERROR, ("Unable to change power state for power resource [%02x].\n", current_list->handles[i]));
+			}
+		}
+	}
+
+	return_ACPI_STATUS(status);
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:    bm_pr_add_device
+ *
+ * PARAMETERS:  
+ *
+ * RETURN:      
+ *
+ * DESCRIPTION: 
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+bm_pr_add_device (
+	BM_HANDLE               device_handle,
+	void                    **context)
+{
+	ACPI_STATUS             status = AE_OK;
+	BM_POWER_RESOURCE	*pr = NULL;
+	BM_DEVICE		*device = NULL;
+	ACPI_BUFFER		buffer;
+	ACPI_OBJECT		acpi_object;
+
+	FUNCTION_TRACE("bm_pr_add_device");
+
+	DEBUG_PRINT(ACPI_INFO, ("Adding power resource [%02x].\n", device_handle));
+
+	if (!context || *context) {
+		return_ACPI_STATUS(AE_BAD_PARAMETER);
+	}
+
+	buffer.length = sizeof(ACPI_OBJECT);
+	buffer.pointer = &acpi_object;
+
+	/*
+	 * Get information on this device.
+	 */
+	status = bm_get_device_info(device_handle, &device);
+	if (ACPI_FAILURE(status)) {
+		return_ACPI_STATUS(status);
+	}
+
+	/*
+	 * Allocate a new BM_POWER_RESOURCE structure.
+	 */
+	pr = acpi_os_callocate(sizeof(BM_POWER_RESOURCE));
+	if (!pr) {
+		return_ACPI_STATUS(AE_NO_MEMORY);
+	}
+
+	pr->device_handle = device->handle;
+	pr->acpi_handle = device->acpi_handle;
+
+	/* 
+	 * Get information on this power resource.
+	 */
+	status = acpi_evaluate_object(pr->acpi_handle, NULL, NULL, &buffer);
+	if (ACPI_FAILURE(status)) {
+		goto end;
+	}
+
+	pr->system_level = acpi_object.power_resource.system_level;
+	pr->resource_order = acpi_object.power_resource.resource_order;
+	pr->state = ACPI_STATE_UNKNOWN;
+	pr->reference_count = 0;
+
+	/*
+	 * Get the power resource's current state (ON|OFF).
+	 */
+	status = bm_pr_get_state(pr);
+
+end:
+	if (ACPI_FAILURE(status)) {
+		acpi_os_free(pr);
+	}
+	else {
+		*context = pr;
+		bm_pr_print(pr);
+	}
+
+	return_ACPI_STATUS(status);
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:    bm_pr_remove_device
+ *
+ * PARAMETERS:  
+ *
+ * RETURN:      
+ *
+ * DESCRIPTION: 
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+bm_pr_remove_device (
+	void                    **context)
+{
+	ACPI_STATUS             status = AE_OK;
+	BM_POWER_RESOURCE	*pr = NULL;
+
+	FUNCTION_TRACE("bm_pr_remove_device");
+
+	if (!context || !*context) {
+		return_ACPI_STATUS(AE_BAD_PARAMETER);
+	}
+
+	pr = (BM_POWER_RESOURCE*)*context;
+
+	DEBUG_PRINT(ACPI_INFO, ("Removing power resource [%02x].\n", pr->device_handle));
+
+	acpi_os_free(pr);
+
+	return_ACPI_STATUS(status);
+}
+
+
+/****************************************************************************
+ *                             External Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ *
+ * FUNCTION:    bm_pr_initialize
+ *
+ * PARAMETERS:  <none>
+ *
+ * RETURN:
+ *
+ * DESCRIPTION: 
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+bm_pr_initialize (void)
+{
+	ACPI_STATUS             status = AE_OK;
+	BM_DEVICE_ID		criteria;
+	BM_DRIVER		driver;
+
+	FUNCTION_TRACE("bm_pr_initialize");
+
+	MEMSET(&criteria, 0, sizeof(BM_DEVICE_ID));
+	MEMSET(&driver, 0, sizeof(BM_DRIVER));
+
+	criteria.type = BM_TYPE_POWER_RESOURCE;
+
+	driver.notify = &bm_pr_notify;
+	driver.request = &bm_pr_request;
+
+	status = bm_register_driver(&criteria, &driver);
+
+	return_ACPI_STATUS(status);
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:    bm_pr_terminate
+ *
+ * PARAMETERS:  
+ *
+ * RETURN:	
+ *
+ * DESCRIPTION: 
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+bm_pr_terminate (void)
+{
+	ACPI_STATUS             status = AE_OK;
+	BM_DEVICE_ID		criteria;
+	BM_DRIVER		driver;
+
+	FUNCTION_TRACE("bm_pr_terminate");
+
+	MEMSET(&criteria, 0, sizeof(BM_DEVICE_ID));
+	MEMSET(&driver, 0, sizeof(BM_DRIVER));
+
+	criteria.type = BM_TYPE_POWER_RESOURCE;
+
+	driver.notify = &bm_pr_notify;
+	driver.request = &bm_pr_request;
+
+	status = bm_unregister_driver(&criteria, &driver);
+
+	return_ACPI_STATUS(status);
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:    bm_pr_notify
+ *
+ * PARAMETERS:  
+ *
+ * RETURN:	
+ *
+ * DESCRIPTION: 
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+bm_pr_notify (
+	BM_NOTIFY               notify_type,
+	BM_HANDLE               device_handle,
+	void                    **context)
+{
+	ACPI_STATUS             status = AE_OK;
+
+	FUNCTION_TRACE("bm_pr_notify");
+
+	switch (notify_type) {
+
+	case BM_NOTIFY_DEVICE_ADDED:
+		status = bm_pr_add_device(device_handle, context);
+		break;
+
+	case BM_NOTIFY_DEVICE_REMOVED:
+		status = bm_pr_remove_device(context);
+		break;
+
+	default:
+		status = AE_SUPPORT;
+		break;
+	}
+
+	return_ACPI_STATUS(status);
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:    bm_pr_request
+ *
+ * PARAMETERS:  
+ *
+ * RETURN:      
+ *
+ * DESCRIPTION: 
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+bm_pr_request (
+	BM_REQUEST		*request,
+	void                    *context)
+{
+	ACPI_STATUS             status = AE_OK;
+	BM_POWER_RESOURCE	*pr = NULL;
+
+	FUNCTION_TRACE("bm_pr_request");
+
+	/*
+	 * Must have a valid request structure and context.
+	 */
+	if (!request || !context) {
+		return_ACPI_STATUS(AE_BAD_PARAMETER);
+	}
+
+	/*
+	 * context contains information specific to this power resource.
+	 */
+	pr = (BM_POWER_RESOURCE*)context;
+
+	/*
+	 * Handle request:
+	 * ---------------
+	 */
+	switch (request->command) {
+
+	default:
+		status = AE_SUPPORT;
+		break;
+	}
+
+	request->status = status;
+
+	return_ACPI_STATUS(status);
+}
+
+
+
diff -urN linux-2.4.6-pre4/drivers/acpi/ospm/busmgr/bmrequest.c linux/drivers/acpi/ospm/busmgr/bmrequest.c
--- linux-2.4.6-pre4/drivers/acpi/ospm/busmgr/bmrequest.c	Wed Dec 31 16:00:00 1969
+++ linux/drivers/acpi/ospm/busmgr/bmrequest.c	Mon Dec  3 22:48:42 2001
@@ -0,0 +1,164 @@
+/******************************************************************************
+ *
+ * Module Name: bmrequest.c
+ *   $Revision: 12 $
+ *
+ *****************************************************************************/
+
+/*
+ *  Copyright (C) 2000, 2001 Andrew Grover
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#include <acpi.h>
+#include "bm.h"
+
+#define _COMPONENT		ACPI_BUS
+	MODULE_NAME		("bmrequest")
+
+
+/****************************************************************************
+ *                            External Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ *
+ * FUNCTION:    bm_generate_request
+ *
+ * PARAMETERS:  
+ *
+ * RETURN:      
+ *
+ * DESCRIPTION: 
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+bm_generate_request (
+	BM_NODE			*node,
+	BM_REQUEST		*request)
+{
+	ACPI_STATUS		status = AE_OK;
+	BM_DEVICE		*device = NULL;
+
+	FUNCTION_TRACE("bm_generate_request");
+
+	if (!node || !request) {
+		return_ACPI_STATUS(AE_BAD_PARAMETER);
+	}
+
+	device = &(node->device);
+
+	if (!BM_IS_DRIVER_CONTROL(device)) {
+		DEBUG_PRINT(ACPI_WARN, ("No driver installed for device [%02x].\n", device->handle));
+		return_ACPI_STATUS(AE_NOT_EXIST);
+	}
+
+	status = node->driver.request(request, node->driver.context);
+
+	return_ACPI_STATUS(status);
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:    bm_request
+ *
+ * PARAMETERS:  
+ *
+ * RETURN:      
+ *
+ * DESCRIPTION: 
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+bm_request (
+	BM_REQUEST              *request)
+{
+	ACPI_STATUS             status = AE_OK;
+	BM_NODE			*node = NULL;
+	BM_DEVICE		*device = NULL;
+
+	FUNCTION_TRACE("bm_request");
+
+	/*
+	 * Must have a valid request structure.
+	 */
+	if (!request) {
+		return_ACPI_STATUS(AE_BAD_PARAMETER);
+	}
+
+	DEBUG_PRINT(ACPI_INFO, ("Received request for device [%02x] command [%02x].\n", request->handle, request->command));
+
+	/*
+	 * Resolve the node.
+	 */
+	status = bm_get_node(request->handle, 0, &node);
+	if (ACPI_FAILURE(status)) {
+		return_ACPI_STATUS(status);
+	}
+
+	device = &(node->device);
+
+	/*
+	 * Device-Specific Request?
+	 * ------------------------
+	 * If a device-specific command (>=0x80) forward this request to
+	 * the appropriate driver.
+	 */
+	if (request->command & BM_COMMAND_DEVICE_SPECIFIC) {
+		status = bm_generate_request(node, request);
+		return_ACPI_STATUS(status);
+	}
+
+	/*
+	 * Bus-Specific Requests:
+	 * ----------------------
+	 */
+	switch (request->command) {
+
+	case BM_COMMAND_GET_POWER_STATE:
+		status = bm_get_power_state(node);
+		if (ACPI_FAILURE(status)) {
+			break;
+		}
+		status = bm_copy_to_buffer(&(request->buffer), 
+			&(device->power.state), sizeof(BM_POWER_STATE));
+		break;
+
+	case BM_COMMAND_SET_POWER_STATE:
+	{
+		BM_POWER_STATE *power_state = NULL;
+
+		status = bm_cast_buffer(&(request->buffer), 
+			(void**)&power_state, sizeof(BM_POWER_STATE));
+		if (ACPI_FAILURE(status)) {
+			break;
+		}
+		status = bm_set_power_state(node, *power_state);
+	}
+		break;
+
+	default:
+		status = AE_SUPPORT;
+		request->status = AE_SUPPORT;
+		break;
+	}
+
+	return_ACPI_STATUS(status);
+}
diff -urN linux-2.4.6-pre4/drivers/acpi/ospm/busmgr/bmsearch.c linux/drivers/acpi/ospm/busmgr/bmsearch.c
--- linux-2.4.6-pre4/drivers/acpi/ospm/busmgr/bmsearch.c	Wed Dec 31 16:00:00 1969
+++ linux/drivers/acpi/ospm/busmgr/bmsearch.c	Mon Dec  3 22:48:42 2001
@@ -0,0 +1,192 @@
+/******************************************************************************
+ *
+ * Module Name: bmsearch.c
+ *   $Revision: 13 $
+ *
+ *****************************************************************************/
+
+/*
+ *  Copyright (C) 2000, 2001 Andrew Grover
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#include <acpi.h>
+#include "bm.h"
+
+
+#define _COMPONENT		ACPI_BUS
+	MODULE_NAME		("bmsearch")
+
+
+/****************************************************************************
+ *                            External Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ *
+ * FUNCTION:    bm_compare
+ *
+ * PARAMETERS:  
+ *
+ * RETURN:      
+ *
+ * DESCRIPTION: 
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+bm_compare (
+	BM_DEVICE               *device,
+	BM_DEVICE_ID            *criteria)
+{
+	if (!device || !criteria) {
+		return AE_BAD_PARAMETER;
+	}
+
+	/* 
+	 * Present?
+	 * --------
+	 * We're only going to match on devices that are present.
+	 * TBD: Optimize in bm_search (don't have to call here).
+	 */
+	if (!BM_DEVICE_PRESENT(device)) {
+		return AE_NOT_FOUND;
+	}
+
+	/* 
+	 * Type?
+	 */
+	if (criteria->type && (criteria->type != device->id.type)) {
+		return AE_NOT_FOUND;
+	}
+
+	/* 
+	 * HID?
+	 */
+	if ((criteria->hid[0]) && (0 != STRNCMP(criteria->hid, 
+		device->id.hid, sizeof(BM_DEVICE_HID)))) {
+		return AE_NOT_FOUND;
+	}
+
+	/* 
+	 * ADR?
+	 */
+	if ((criteria->adr) && (criteria->adr != device->id.adr)) {
+		return AE_NOT_FOUND;
+	}
+
+	return AE_OK;
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:    bm_search
+ *
+ * PARAMETERS:  
+ *
+ * RETURN:      AE_BAD_PARAMETER- invalid input parameter
+ *              AE_NOT_EXIST    - start_device_handle doesn't exist
+ *              AE_NOT_FOUND    - no matches to Search_info.criteria found
+ *              AE_OK           - success
+ *
+ * DESCRIPTION: 
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+bm_search(
+	BM_HANDLE               device_handle,
+	BM_DEVICE_ID            *criteria,
+	BM_HANDLE_LIST          *results)
+{
+	ACPI_STATUS             status = AE_OK;
+	BM_NODE			*node = NULL;
+
+	FUNCTION_TRACE("bm_search");
+
+	if (!criteria || !results) {
+		return_ACPI_STATUS(AE_BAD_PARAMETER);
+	}
+
+	results->count = 0;
+
+	/*
+	 * Locate Starting Point:
+	 * ----------------------
+	 * Locate the node in the hierarchy where we'll begin our search.
+	 */
+	status = bm_get_node(device_handle, 0, &node);
+	if (ACPI_FAILURE(status)) {
+		return_ACPI_STATUS(status);
+	}
+
+	/*
+	 * Parse Hierarchy:
+	 * ----------------
+	 * Parse through the node hierarchy looking for matches.
+	 */
+	while (node && (results->count<=BM_HANDLES_MAX)) {
+		/*
+		 * Depth-first:
+		 * ------------
+		 * Searches are always performed depth-first.
+		 */
+		if (node->scope.head) {
+			status = bm_compare(&(node->device), criteria);
+			if (ACPI_SUCCESS(status)) {
+				results->handles[results->count++] = 
+					node->device.handle;
+			}
+			node = node->scope.head;
+		}
+
+		/*
+		 * Now Breadth:
+		 * ------------
+		 * Search all peers until scope is exhausted.
+		 */
+		else {
+			status = bm_compare(&(node->device), criteria);
+			if (ACPI_SUCCESS(status)) {
+				results->handles[results->count++] = 
+					node->device.handle;
+			}
+
+			/*
+			 * Locate Next Device:
+			 * -------------------
+			 * The next node is either a peer at this level 
+			 * (node->next is valid), or we work are way back 
+			 * up the tree until we either find a non-parsed 
+			 * peer or hit the top (node->parent is NULL).
+			 */
+			while (!node->next && node->parent) {
+				node = node->parent;
+			}
+			node = node->next;
+		}
+	}
+
+	if (results->count == 0) {
+		return_ACPI_STATUS(AE_NOT_FOUND);
+	}
+	else {
+		return_ACPI_STATUS(AE_OK);
+	}
+}
+
diff -urN linux-2.4.6-pre4/drivers/acpi/ospm/busmgr/bmutils.c linux/drivers/acpi/ospm/busmgr/bmutils.c
--- linux-2.4.6-pre4/drivers/acpi/ospm/busmgr/bmutils.c	Wed Dec 31 16:00:00 1969
+++ linux/drivers/acpi/ospm/busmgr/bmutils.c	Mon Dec  3 22:48:42 2001
@@ -0,0 +1,608 @@
+/*****************************************************************************
+ *
+ * Module Name: bmutils.c
+ *   $Revision: 28 $
+ *
+ *****************************************************************************/
+
+/*
+ *  Copyright (C) 2000, 2001 Andrew Grover
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#include <acpi.h>
+#include "bm.h"
+
+
+#define _COMPONENT		ACPI_BUS
+	MODULE_NAME		("bmutils")
+
+
+#ifdef ACPI_DEBUG
+#define DEBUG_EVAL_ERROR(l,h,p,s)    bm_print_eval_error(l,h,p,s)
+#else
+#define DEBUG_EVAL_ERROR(l,h,p,s)
+#endif
+
+
+/****************************************************************************
+ *                            External Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ *
+ * FUNCTION:    bm_print_eval_error
+ *
+ * PARAMETERS:  
+ *
+ * RETURN:      
+ *
+ * DESCRIPTION: 
+ *
+ ****************************************************************************/
+
+void
+bm_print_eval_error (
+	u32                     debug_level,
+	ACPI_HANDLE             acpi_handle,
+	ACPI_STRING             pathname,
+	ACPI_STATUS             status)
+{
+	ACPI_BUFFER             buffer;
+	ACPI_STRING             status_string = NULL;
+
+	buffer.length = 256;
+	buffer.pointer = acpi_os_callocate(buffer.length);
+	if (!buffer.pointer) {
+		return;
+	}
+
+	status_string = acpi_ut_format_exception(status);
+
+	status = acpi_get_name(acpi_handle, ACPI_FULL_PATHNAME, &buffer);
+	if (ACPI_FAILURE(status)) {
+		DEBUG_PRINT(debug_level, ("Evaluate object [%p], %s\n", acpi_handle, status_string));
+		return;
+	}
+
+	if (pathname) {
+		DEBUG_PRINT(ACPI_INFO, ("Evaluate object [%s.%s], %s\n", buffer.pointer, pathname, status_string));
+	}
+	else {
+		DEBUG_PRINT(ACPI_INFO, ("Evaluate object [%s], %s\n", buffer.pointer, status_string));
+	}
+
+	acpi_os_free(buffer.pointer);
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:    bm_copy_to_buffer
+ *
+ * PARAMETERS:  
+ *
+ * RETURN:      
+ *
+ * DESCRIPTION: 
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+bm_copy_to_buffer (
+	ACPI_BUFFER             *buffer,
+	void                    *data,
+	u32                     length)
+{
+	FUNCTION_TRACE("bm_copy_to_buffer");
+
+	if (!buffer || (!buffer->pointer) || !data || (length == 0)) {
+		return_ACPI_STATUS(AE_BAD_PARAMETER);
+	}
+
+	if (length > buffer->length) {
+		buffer->length = length;
+		return_ACPI_STATUS(AE_BUFFER_OVERFLOW);
+	}
+
+	buffer->length = length;
+	MEMCPY(buffer->pointer, data, length);
+
+	return_ACPI_STATUS(AE_OK);
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:    bm_cast_buffer
+ *
+ * PARAMETERS:  
+ *
+ * RETURN:      
+ *
+ * DESCRIPTION: 
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+bm_cast_buffer (
+	ACPI_BUFFER             *buffer,
+	void                    **pointer,
+	u32                     length)
+{
+	FUNCTION_TRACE("bm_cast_buffer");
+
+	if (!buffer || !buffer->pointer || !pointer || length == 0) {
+		return_ACPI_STATUS(AE_BAD_PARAMETER);
+	}
+
+	if (length > buffer->length) {
+		return_ACPI_STATUS(AE_BAD_DATA);
+	}
+
+	*pointer = buffer->pointer;
+
+	return_ACPI_STATUS(AE_OK);
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:    bm_extract_package_data
+ *
+ * PARAMETERS:  
+ *
+ * RETURN:      
+ *
+ * DESCRIPTION: 
+ *
+ ****************************************************************************/
+
+/*
+ * TBD: Don't assume numbers (in ASL) are 32-bit values!!!!  (IA64)
+ * TBD: Issue with 'assumed' types coming out of interpreter...
+ *       (e.g. toshiba _BIF)
+ */
+
+ACPI_STATUS
+bm_extract_package_data (
+	ACPI_OBJECT             *package,
+	ACPI_BUFFER             *package_format,
+	ACPI_BUFFER             *buffer)
+{
+	ACPI_STATUS             status = AE_OK;
+	u8                      *head = NULL;
+	u8                      *tail = NULL;
+	u8                      **pointer = NULL;
+	u32                     tail_offset = 0;
+	ACPI_OBJECT             *element = NULL;
+	u32                     size_required = 0;
+	char*                   format = NULL;
+	u32                     format_count = 0;
+	u32                     i = 0;
+
+	FUNCTION_TRACE("bm_extract_package_data");
+
+	if (!package || (package->type != ACPI_TYPE_PACKAGE) ||
+		(package->package.count == 0) || !package_format ||
+		(package_format->length < 1) || 
+		(!package_format->pointer) || !buffer) {
+		return_ACPI_STATUS(AE_BAD_PARAMETER);
+	}
+
+	format_count = package_format->length - 1;
+
+	if (format_count > package->package.count) {
+		DEBUG_PRINT(ACPI_WARN, ("Format specifies more objects [%d] than exist in package [%d].", format_count, package->package.count));
+		return_ACPI_STATUS(AE_BAD_DATA);
+	}
+
+	format = (char*)package_format->pointer;
+
+	/*
+	 * Calculate size_required.
+	 */
+	for (i=0; i<format_count; i++) {
+		element = &(package->package.elements[i]);
+
+		switch (element->type) {
+
+		case ACPI_TYPE_INTEGER:
+			switch (format[i]) {
+			case 'N':
+				size_required += sizeof(ACPI_INTEGER);
+				tail_offset += sizeof(ACPI_INTEGER);
+				break;
+			case 'S':
+				size_required += sizeof(u8*) + 
+					sizeof(ACPI_INTEGER) + 1;
+				tail_offset += sizeof(ACPI_INTEGER);
+				break;
+			default:
+				DEBUG_PRINT(ACPI_WARN, ("Invalid package element [%d]: got number, expecing [%c].\n", i, format[i]));
+				return_ACPI_STATUS(AE_BAD_DATA);
+				break;
+			}
+			break;
+
+		case ACPI_TYPE_STRING:
+		case ACPI_TYPE_BUFFER:
+			switch (format[i]) {
+			case 'S':
+				size_required += sizeof(u8*) + 
+					element->string.length + 1;
+				tail_offset += sizeof(u8*);
+				break;
+			case 'B':
+				size_required += sizeof(u8*) + 
+					element->buffer.length;
+				tail_offset += sizeof(u8*);
+				break;
+			default:
+				DEBUG_PRINT(ACPI_WARN, ("Invalid package element [%d] got string/buffer, expecing [%c].\n", i, format[i]));
+				return_ACPI_STATUS(AE_BAD_DATA);
+				break;
+			}
+			break;
+
+		case ACPI_TYPE_PACKAGE:
+		default:
+			/* TBD: handle nested packages... */
+			return_ACPI_STATUS(AE_SUPPORT);
+			break;
+		}
+	}
+
+	if (size_required > buffer->length) {
+		buffer->length = size_required;
+		return_ACPI_STATUS(AE_BUFFER_OVERFLOW);
+	}
+
+	buffer->length = size_required;
+
+	if (!buffer->pointer) {
+		return_ACPI_STATUS(AE_BAD_PARAMETER);
+	}
+
+	head = buffer->pointer;
+	tail = buffer->pointer + tail_offset;
+
+	/*
+	 * Extract package data:
+	 */
+	for (i=0; i<format_count; i++) {
+
+		element = &(package->package.elements[i]);
+
+		switch (element->type) {
+
+		case ACPI_TYPE_INTEGER:
+			switch (format[i]) {
+			case 'N':
+				*((ACPI_INTEGER*)head) = 
+					element->integer.value;
+				head += sizeof(ACPI_INTEGER);
+				break;
+			case 'S':
+				pointer = (u8**)head;
+				*pointer = tail;
+				*((ACPI_INTEGER*)tail) = 
+					element->integer.value;
+				head += sizeof(ACPI_INTEGER*);
+				tail += sizeof(ACPI_INTEGER);
+				/* NULL terminate string */
+				*tail = 0;
+				tail++;
+				break;
+			default:
+				/* Should never get here */
+				break;
+			}
+			break;
+
+		case ACPI_TYPE_STRING:
+		case ACPI_TYPE_BUFFER:
+			switch (format[i]) {
+			case 'S':
+				pointer = (u8**)head;
+				*pointer = tail;
+				memcpy(tail, element->string.pointer, 
+					element->string.length);
+				head += sizeof(u8*);
+				tail += element->string.length;
+				/* NULL terminate string */
+				*tail = 0;
+				tail++;
+				break;
+			case 'B':
+				pointer = (u8**)head;
+				*pointer = tail;
+				memcpy(tail, element->buffer.pointer, 
+					element->buffer.length);
+				head += sizeof(u8*);
+				tail += element->buffer.length;
+				break;
+			default:
+				/* Should never get here */
+				break;
+			}
+			break;
+
+		case ACPI_TYPE_PACKAGE:
+			/* TBD: handle nested packages... */
+		default:
+			/* Should never get here */
+			break;
+		}
+	}
+
+	return_ACPI_STATUS(status);
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:    bm_evaluate_object
+ *
+ * PARAMETERS:  
+ *
+ * RETURN:      AE_OK
+ *              AE_BUFFER_OVERFLOW  Evaluated object returned data, but 
+ *                                  caller did not provide buffer.
+ *
+ * DESCRIPTION: Helper for acpi_evaluate_object that handles buffer
+ *              allocation.  Note that the caller is responsible for 
+ *              freeing buffer->pointer!
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+bm_evaluate_object (
+	ACPI_HANDLE             acpi_handle,
+	ACPI_STRING             pathname,
+	ACPI_OBJECT_LIST        *arguments,
+	ACPI_BUFFER             *buffer)
+{
+	ACPI_STATUS             status = AE_OK;
+
+	FUNCTION_TRACE("bm_evaluate_object");
+
+	/* If caller provided a buffer it must be unallocated/zero'd. */
+	if ((buffer) && (buffer->length != 0 || buffer->pointer)) {
+		return_ACPI_STATUS(AE_BAD_PARAMETER);
+	}
+
+	/*
+	 * Evalute Object:
+	 * ---------------
+	 * The first attempt is just to get the size of the object data 
+	 * (that is unless there's no return data, e.g. _INI); the second 
+	 * gets the data.
+	 */
+	status = acpi_evaluate_object(acpi_handle, pathname, arguments, buffer);
+	if (ACPI_SUCCESS(status)) {
+		return_ACPI_STATUS(status);
+	}
+	else if ((buffer) && (status == AE_BUFFER_OVERFLOW)) {
+
+		/* Gotta allocate -- CALLER MUST FREE! */
+		buffer->pointer = acpi_os_callocate(buffer->length);
+		if (!buffer->pointer) {
+			return_ACPI_STATUS(AE_NO_MEMORY);
+		}
+
+		/* Re-evaluate -- this time it should work */
+		status = acpi_evaluate_object(acpi_handle, pathname, 
+			arguments, buffer);
+	}
+
+	if (ACPI_FAILURE(status)) {
+		if (status != AE_NOT_FOUND) {
+			DEBUG_EVAL_ERROR(ACPI_WARN, acpi_handle, pathname, 
+				status);
+		}
+		if (buffer && buffer->pointer) {
+			acpi_os_free(buffer->pointer); 
+			buffer->pointer = NULL;
+			buffer->length = 0;
+		}
+	}
+
+	return_ACPI_STATUS(status);
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:    bm_evaluate_simple_integer
+ *
+ * PARAMETERS:  
+ *
+ * RETURN:      
+ *
+ * DESCRIPTION: 
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+bm_evaluate_simple_integer (
+	ACPI_HANDLE             acpi_handle,
+	ACPI_STRING             pathname,
+	u32                     *data)
+{
+	ACPI_STATUS             status = AE_OK;
+	ACPI_OBJECT             *element = NULL;
+	ACPI_BUFFER             buffer;
+
+	FUNCTION_TRACE("bm_evaluate_simple_integer");
+
+	if (!data) {
+		return_ACPI_STATUS(AE_BAD_PARAMETER);
+	}
+
+	MEMSET(&buffer, 0, sizeof(ACPI_BUFFER));
+
+	/*
+	 * Evaluate Object:
+	 * ----------------
+	 */
+	status = bm_evaluate_object(acpi_handle, pathname, NULL, &buffer);
+	if (ACPI_FAILURE(status)) {
+		goto end;
+	}
+
+	/*
+	 * Validate Data:
+	 * --------------
+	 */
+	status = bm_cast_buffer(&buffer, (void**)&element, 
+		sizeof(ACPI_OBJECT));
+	if (ACPI_FAILURE(status)) {
+		DEBUG_EVAL_ERROR(ACPI_WARN, acpi_handle, pathname, status);
+		goto end;
+	}
+
+	if (element->type != ACPI_TYPE_INTEGER) {
+		status = AE_BAD_DATA;
+		DEBUG_EVAL_ERROR(ACPI_WARN, acpi_handle, pathname, status);
+		goto end;
+	}
+
+	*data = element->integer.value;
+
+end:
+	acpi_os_free(buffer.pointer);
+
+	return_ACPI_STATUS(status);
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:    bm_evaluate_reference_list
+ *
+ * PARAMETERS:  
+ *
+ * RETURN:      
+ *
+ * DESCRIPTION: 
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+bm_evaluate_reference_list (
+	ACPI_HANDLE             acpi_handle,
+	ACPI_STRING             pathname,
+	BM_HANDLE_LIST          *reference_list)
+{
+	ACPI_STATUS             status = AE_OK;
+	ACPI_OBJECT             *package = NULL;
+	ACPI_OBJECT             *element = NULL;
+	ACPI_HANDLE		reference_handle = NULL;
+	ACPI_BUFFER             buffer;
+	u32                     i = 0;
+
+	FUNCTION_TRACE("bm_evaluate_reference_list");
+
+	if (!reference_list) {
+		return_ACPI_STATUS(AE_BAD_PARAMETER);
+	}
+
+	MEMSET(&buffer, 0, sizeof(ACPI_BUFFER));
+
+	/*
+	 * Evaluate Object:
+	 * ----------------
+	 */
+	status = bm_evaluate_object(acpi_handle, pathname, NULL, &buffer);
+	if (ACPI_FAILURE(status)) {
+		goto end;
+	}
+
+	/*
+	 * Validate Package:
+	 * -----------------
+	 */
+	status = bm_cast_buffer(&buffer, (void**)&package, 
+		sizeof(ACPI_OBJECT));
+	if (ACPI_FAILURE(status)) {
+		DEBUG_EVAL_ERROR(ACPI_WARN, acpi_handle, pathname, status);
+		goto end;
+	}
+
+	if (package->type != ACPI_TYPE_PACKAGE) {
+		status = AE_BAD_DATA;
+		DEBUG_EVAL_ERROR(ACPI_WARN, acpi_handle, pathname, status);
+		goto end;
+	}
+
+	if (package->package.count > BM_HANDLES_MAX) {
+		package->package.count = BM_HANDLES_MAX;
+	}
+
+	/*
+	 * Parse Package Data:
+	 * -------------------
+	 */
+	for (i = 0; i < package->package.count; i++) {
+
+		element = &(package->package.elements[i]);
+
+		if (!element || (element->type != ACPI_TYPE_STRING)) {
+			status = AE_BAD_DATA;
+			DEBUG_PRINT(ACPI_WARN, ("Invalid element in package (not a device reference).\n"));
+			DEBUG_EVAL_ERROR(ACPI_WARN, acpi_handle, pathname, status);
+			break;
+		}
+
+		/*
+		 * Resolve reference string (e.g. "\_PR_.CPU_") to an
+		 * ACPI_HANDLE.
+		 */
+		status = acpi_get_handle(acpi_handle, 
+			element->string.pointer, &reference_handle);
+		if (ACPI_FAILURE(status)) {
+			status = AE_BAD_DATA;
+			DEBUG_PRINT(ACPI_WARN, ("Unable to resolve device reference [%s].\n", element->string.pointer));
+			DEBUG_EVAL_ERROR(ACPI_WARN, acpi_handle, pathname, status);
+			break;
+		}
+
+		/*
+		 * Resolve ACPI_HANDLE to BM_HANDLE.
+		 */
+		status = bm_get_handle(reference_handle, 
+			&(reference_list->handles[i]));
+		if (ACPI_FAILURE(status)) {
+			status = AE_BAD_DATA;
+			DEBUG_PRINT(ACPI_WARN, ("Unable to resolve device reference for [%p].\n", reference_handle));
+			DEBUG_EVAL_ERROR(ACPI_WARN, acpi_handle, pathname, status);
+			break;
+		}
+
+		DEBUG_PRINT(ACPI_INFO, ("Resolved reference [%s]->[%p]->[%02x]\n", element->string.pointer, reference_handle, reference_list->handles[i]));
+
+		(reference_list->count)++;
+	}
+
+end:
+	acpi_os_free(buffer.pointer);
+
+	return_ACPI_STATUS(status);
+}
+
+
diff -urN linux-2.4.6-pre4/drivers/acpi/ospm/button/Makefile linux/drivers/acpi/ospm/button/Makefile
--- linux-2.4.6-pre4/drivers/acpi/ospm/button/Makefile	Wed Dec 31 16:00:00 1969
+++ linux/drivers/acpi/ospm/button/Makefile	Mon Dec  3 22:48:42 2001
@@ -0,0 +1,6 @@
+O_TARGET	:= ospm_$(notdir $(CURDIR)).o
+obj-m		:= $(O_TARGET)
+EXTRA_CFLAGS	+= $(ACPI_CFLAGS)
+obj-y		:= $(patsubst %.c,%.o,$(wildcard *.c))
+
+include $(TOPDIR)/Rules.make
diff -urN linux-2.4.6-pre4/drivers/acpi/ospm/button/bn.c linux/drivers/acpi/ospm/button/bn.c
--- linux-2.4.6-pre4/drivers/acpi/ospm/button/bn.c	Wed Dec 31 16:00:00 1969
+++ linux/drivers/acpi/ospm/button/bn.c	Mon Dec  3 22:48:42 2001
@@ -0,0 +1,439 @@
+/*****************************************************************************
+ *
+ * Module Name: bn.c
+ *   $Revision: 22 $
+ *
+ *****************************************************************************/
+
+/*
+ *  Copyright (C) 2000, 2001 Andrew Grover
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Plxxe, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#include <acpi.h>
+#include "bn.h"
+
+
+#define _COMPONENT		ACPI_BUTTON
+	MODULE_NAME		("bn")
+
+
+/*****************************************************************************
+ *                            Internal Functions
+ *****************************************************************************/
+
+/*****************************************************************************
+ *
+ * FUNCTION:	bn_print
+ *
+ * PARAMETERS:	
+ *
+ * RETURN:	
+ *
+ * DESCRIPTION: Prints out information on a specific button.
+ *
+ ****************************************************************************/
+
+void
+bn_print (
+	BN_CONTEXT		*button)
+{
+
+	return;
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:	bn_add_device
+ *
+ * PARAMETERS:	
+ *
+ * RETURN:	
+ *
+ * DESCRIPTION:
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+bn_add_device(
+	BM_HANDLE		device_handle,
+	void			**context)
+{
+	ACPI_STATUS		status = AE_OK;
+	BM_DEVICE		*device = NULL;
+	BN_CONTEXT		*button = NULL;
+
+	if (!context || *context) {
+		return(AE_BAD_PARAMETER);
+	}
+
+	/*
+	 * Get information on this device.
+	 */
+	status = bm_get_device_info( device_handle, &device );
+	if (ACPI_FAILURE(status)) {
+		return(status);
+	}
+
+	/*
+	 * Allocate a new BN_CONTEXT structure.
+	 */
+	button = acpi_os_callocate(sizeof(BN_CONTEXT));
+	if (!button) {
+		return(AE_NO_MEMORY);
+	}
+
+	button->device_handle = device->handle;
+	button->acpi_handle = device->acpi_handle;
+
+	/*
+	 * Power Button?
+	 * -------------
+	 * Either fixed-feature or generic (namespace) types.
+	 */
+	if (strncmp(device->id.hid, BN_HID_POWER_BUTTON,
+		sizeof(BM_DEVICE_HID)) == 0) {
+
+		if (device->id.type == BM_TYPE_FIXED_BUTTON) {
+
+			button->type = BN_TYPE_POWER_BUTTON_FIXED;
+
+			/* Register for fixed-feature events. */
+			status = acpi_install_fixed_event_handler(
+				ACPI_EVENT_POWER_BUTTON, bn_notify_fixed,
+				(void*)button);
+		}
+		else {
+			button->type = BN_TYPE_POWER_BUTTON;
+		}
+
+	}
+
+	/*
+	 * Sleep Button?
+	 * -------------
+	 * Either fixed-feature or generic (namespace) types.
+	 */
+	else if (strncmp( device->id.hid, BN_HID_SLEEP_BUTTON,
+		sizeof(BM_DEVICE_HID)) == 0) {
+
+		if (device->id.type == BM_TYPE_FIXED_BUTTON) {
+
+			button->type = BN_TYPE_SLEEP_BUTTON_FIXED;
+
+			/* Register for fixed-feature events. */
+			status = acpi_install_fixed_event_handler(
+				ACPI_EVENT_SLEEP_BUTTON, bn_notify_fixed,
+				(void*)button);
+		}
+		else {
+			button->type = BN_TYPE_SLEEP_BUTTON;
+		}
+	}
+
+	/*
+	 * LID Switch?
+	 * -----------
+	 */
+	else if (strncmp( device->id.hid, BN_HID_LID_SWITCH,
+		sizeof(BM_DEVICE_HID)) == 0) {
+		button->type = BN_TYPE_LID_SWITCH;
+	}
+
+	status = bn_osl_add_device(button);
+	if (ACPI_FAILURE(status)) {
+		goto end;
+	}
+
+	*context = button;
+
+	bn_print(button);
+
+end:
+	if (ACPI_FAILURE(status)) {
+		acpi_os_free(button);
+	}
+
+	return(status);
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:	bn_remove_device
+ *
+ * PARAMETERS:	
+ *
+ * RETURN:	
+ *
+ * DESCRIPTION:
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+bn_remove_device(
+	void			**context)
+{
+	ACPI_STATUS		status = AE_OK;
+	BN_CONTEXT		*button = NULL;
+
+	if (!context || !*context) {
+		return(AE_BAD_PARAMETER);
+	}
+
+	button = (BN_CONTEXT*)*context;
+
+	/*
+	 * Unregister for fixed-feature events.
+	 */
+	switch (button->type) {
+	case BN_TYPE_POWER_BUTTON_FIXED:
+		status = acpi_remove_fixed_event_handler(
+			ACPI_EVENT_POWER_BUTTON, bn_notify_fixed);
+		break;
+	case BN_TYPE_SLEEP_BUTTON_FIXED:
+		status = acpi_remove_fixed_event_handler(
+			ACPI_EVENT_SLEEP_BUTTON, bn_notify_fixed);
+		break;
+	}
+
+	bn_osl_remove_device(button);
+
+	acpi_os_free(button);
+
+	*context = NULL;
+
+	return(status);
+}
+
+
+/*****************************************************************************
+ *			      External Functions
+ *****************************************************************************/
+
+/*****************************************************************************
+ *
+ * FUNCTION:	bn_initialize
+ *
+ * PARAMETERS:	<none>
+ *
+ * RETURN:
+ *
+ * DESCRIPTION:
+ *
+
+ ****************************************************************************/
+
+ACPI_STATUS
+bn_initialize (void)
+{
+	BM_DEVICE_ID		criteria;
+	BM_DRIVER		driver;
+
+	MEMSET(&criteria, 0, sizeof(BM_DEVICE_ID));
+	MEMSET(&driver, 0, sizeof(BM_DRIVER));
+
+	driver.notify = &bn_notify;
+	driver.request = &bn_request;
+
+	/*
+	 * Register for power buttons.
+	 */
+	MEMCPY(criteria.hid, BN_HID_POWER_BUTTON, sizeof(BN_HID_POWER_BUTTON));
+	bm_register_driver(&criteria, &driver);
+
+	/*
+	 * Register for sleep buttons.
+	 */
+	MEMCPY(criteria.hid, BN_HID_SLEEP_BUTTON, sizeof(BN_HID_SLEEP_BUTTON));
+	bm_register_driver(&criteria, &driver);
+
+	/*
+	 * Register for LID switches.
+	 */
+	MEMCPY(criteria.hid, BN_HID_LID_SWITCH, sizeof(BN_HID_LID_SWITCH));
+	bm_register_driver(&criteria, &driver);
+
+	return(AE_OK);
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:	bn_terminate
+ *
+ * PARAMETERS:	<none>
+ *
+ * RETURN:	
+ *
+ * DESCRIPTION:
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+bn_terminate (void)
+{
+	ACPI_STATUS		status = AE_OK;
+	BM_DEVICE_ID		criteria;
+	BM_DRIVER		driver;
+
+	MEMSET(&criteria, 0, sizeof(BM_DEVICE_ID));
+	MEMSET(&driver, 0, sizeof(BM_DRIVER));
+
+	driver.notify = &bn_notify;
+	driver.request = &bn_request;
+
+	/*
+	 * Unregister for power buttons.
+	 */
+	MEMCPY(criteria.hid, BN_HID_POWER_BUTTON, sizeof(BN_HID_POWER_BUTTON));
+	status = bm_unregister_driver(&criteria, &driver);
+
+	/*
+	 * Unregister for sleep buttons.
+	 */
+	MEMCPY(criteria.hid, BN_HID_SLEEP_BUTTON, sizeof(BN_HID_SLEEP_BUTTON));
+	status = bm_unregister_driver(&criteria, &driver);
+
+	/*
+	 * Unregister for LID switches.
+	 */
+	MEMCPY(criteria.hid, BN_HID_LID_SWITCH, sizeof(BN_HID_LID_SWITCH));
+	status = bm_unregister_driver(&criteria, &driver);
+
+	return(status);
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:	bn_notify_fixed
+ *
+ * PARAMETERS:	<none>
+ *
+ * RETURN:
+ *
+ * DESCRIPTION:
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+bn_notify_fixed (
+	void			*context)
+{
+	ACPI_STATUS		status = AE_OK;
+
+	if (!context) {
+		return(AE_BAD_PARAMETER);
+	}
+
+	status = bn_osl_generate_event(BN_NOTIFY_STATUS_CHANGE,
+		((BN_CONTEXT*)context));
+
+	return(status);
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:	bn_notify
+ *
+ * PARAMETERS:	<none>
+ *
+ * RETURN:
+ *
+ * DESCRIPTION:
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+bn_notify (
+	BM_NOTIFY		notify_type,
+	BM_HANDLE		device_handle,
+	void			**context)
+{
+	ACPI_STATUS		status = AE_OK;
+
+	if (!context) {
+		return(AE_BAD_PARAMETER);
+	}
+
+	switch (notify_type) {
+	case BM_NOTIFY_DEVICE_ADDED:
+		status = bn_add_device(device_handle, context);
+		break;
+		
+	case BM_NOTIFY_DEVICE_REMOVED:
+		status = bn_remove_device(context);
+		break;
+		
+	case BN_NOTIFY_STATUS_CHANGE:
+		status = bn_osl_generate_event(BN_NOTIFY_STATUS_CHANGE,
+			((BN_CONTEXT*)*context));
+		break;
+
+	default:
+		status = AE_SUPPORT;
+		break;
+	}
+
+	return(status);
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:	bn_request
+ *
+ * PARAMETERS:	
+ *
+ * RETURN:	
+ *
+ * DESCRIPTION:
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+bn_request (
+	BM_REQUEST		*request,
+	void			*context)
+{
+	ACPI_STATUS		status = AE_OK;
+
+	/*
+	 * Must have a valid request structure and context.
+	 */
+	if (!request || !context) {
+		return(AE_BAD_PARAMETER);
+	}
+
+	/*
+	 * Handle Request:
+	 * ---------------
+	 */
+	switch (request->command) {
+
+	default:
+		status = AE_SUPPORT;
+		break;
+	}
+
+	request->status = status;
+
+	return(status);
+}
diff -urN linux-2.4.6-pre4/drivers/acpi/ospm/button/bn_osl.c linux/drivers/acpi/ospm/button/bn_osl.c
--- linux-2.4.6-pre4/drivers/acpi/ospm/button/bn_osl.c	Wed Dec 31 16:00:00 1969
+++ linux/drivers/acpi/ospm/button/bn_osl.c	Mon Dec  3 22:48:42 2001
@@ -0,0 +1,244 @@
+/******************************************************************************
+ *
+ * Module Name: bn_osl.c
+ *   $Revision: 10 $
+ *
+ *****************************************************************************/
+
+/*
+ *  Copyright (C) 2000, 2001 Andrew Grover
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/types.h>
+#include <linux/proc_fs.h>
+#include <acpi.h>
+#include "bn.h"
+
+
+MODULE_AUTHOR("Andrew Grover");
+MODULE_DESCRIPTION("ACPI Component Architecture (CA) - Button Driver");
+
+
+#define BN_PROC_ROOT		"button"
+#define BN_PROC_POWER_BUTTON	"power"
+#define BN_PROC_SLEEP_BUTTON	"sleep"
+#define BN_PROC_LID_SWITCH	"lid"
+
+extern struct proc_dir_entry	*bm_proc_root;
+static struct proc_dir_entry	*bn_proc_root = NULL;
+
+
+/****************************************************************************
+ *
+ * FUNCTION:	bn_osl_add_device
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+bn_osl_add_device(
+	BN_CONTEXT		*button)
+{
+	ACPI_STATUS		status = AE_OK;
+
+	if (!button) {
+		return(AE_BAD_PARAMETER);
+	}
+
+	switch (button->type) {
+
+	case BN_TYPE_POWER_BUTTON:
+	case BN_TYPE_POWER_BUTTON_FIXED:
+		printk(KERN_INFO "Power Button: found\n");
+		if (!proc_mkdir(BN_PROC_POWER_BUTTON, bn_proc_root)) {
+			status = AE_ERROR;
+		}
+		break;
+
+	case BN_TYPE_SLEEP_BUTTON:
+	case BN_TYPE_SLEEP_BUTTON_FIXED:
+		printk(KERN_INFO "Sleep Button: found\n");
+		if (!proc_mkdir(BN_PROC_SLEEP_BUTTON, bn_proc_root)) {
+			status = AE_ERROR;
+		}
+		break;
+
+	case BN_TYPE_LID_SWITCH:
+		printk(KERN_INFO "Lid Switch: found\n");
+		if (!proc_mkdir(BN_PROC_LID_SWITCH, bn_proc_root)) {
+			status = AE_ERROR;
+		}
+		break;
+	}
+
+	return(status);
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:	bn_osl_remove_device
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+bn_osl_remove_device (
+	BN_CONTEXT		*button)
+{
+	if (!button) {
+		return(AE_BAD_PARAMETER);
+	}
+
+	switch (button->type) {
+
+	case BN_TYPE_POWER_BUTTON:
+	case BN_TYPE_POWER_BUTTON_FIXED:
+		remove_proc_entry(BN_PROC_POWER_BUTTON, bn_proc_root);
+		break;
+
+	case BN_TYPE_SLEEP_BUTTON:
+	case BN_TYPE_SLEEP_BUTTON_FIXED:
+		remove_proc_entry(BN_PROC_SLEEP_BUTTON, bn_proc_root);
+		break;
+
+	case BN_TYPE_LID_SWITCH:
+		remove_proc_entry(BN_PROC_LID_SWITCH, bn_proc_root);
+		break;
+	}
+
+	return(AE_OK);
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:	bn_osl_generate_event
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+bn_osl_generate_event (
+	u32			event,
+	BN_CONTEXT		*button)
+{
+	ACPI_STATUS		status = AE_OK;
+
+	if (!button) {
+		return(AE_BAD_PARAMETER);
+	}
+
+	switch (event) {
+
+	case BN_NOTIFY_STATUS_CHANGE:
+
+		switch(button->type) {
+
+		case BN_TYPE_POWER_BUTTON:
+		case BN_TYPE_POWER_BUTTON_FIXED:
+			status = bm_osl_generate_event(button->device_handle,
+				BN_PROC_ROOT, BN_PROC_POWER_BUTTON, event, 0);
+			break;
+
+		case BN_TYPE_SLEEP_BUTTON:
+		case BN_TYPE_SLEEP_BUTTON_FIXED:
+			status = bm_osl_generate_event(button->device_handle,
+				BN_PROC_ROOT, BN_PROC_SLEEP_BUTTON, event, 0);
+			break;
+
+		case BN_TYPE_LID_SWITCH:
+			status = bm_osl_generate_event(button->device_handle,
+				BN_PROC_ROOT, BN_PROC_LID_SWITCH, event, 0);
+			break;
+
+		default:
+			status = AE_SUPPORT;
+			break;
+		}
+
+		break;
+
+	default:
+		return(AE_BAD_PARAMETER);
+		break;
+	}
+
+	return(status);
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:    bn_osl_init
+ *
+ * PARAMETERS:	<none>
+ *
+ * RETURN:	0: Success
+ *
+ * DESCRIPTION: Module initialization.
+ *
+ ****************************************************************************/
+
+static int __init 
+bn_osl_init (void)
+{
+	ACPI_STATUS		status = AE_OK;
+
+	bn_proc_root = proc_mkdir(BN_PROC_ROOT, bm_proc_root);
+	if (!bn_proc_root) {
+		status = AE_ERROR;
+	}
+	else {
+		status = bn_initialize();
+		if (ACPI_FAILURE(status)) {
+			remove_proc_entry(BN_PROC_ROOT, bm_proc_root);
+		}
+	}
+
+	return (ACPI_SUCCESS(status)) ? 0 : -ENODEV;
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:    bn_osl_cleanup
+ *
+ * PARAMETERS:	<none>
+ *
+ * RETURN:	<none>
+ *
+ * DESCRIPTION: Module cleanup.
+ *
+ ****************************************************************************/
+
+static void __exit 
+bn_osl_cleanup (void)
+{
+	bn_terminate();
+
+	if (bn_proc_root) {
+		remove_proc_entry(BN_PROC_ROOT, bm_proc_root);
+	}
+
+	return;
+}
+
+
+module_init(bn_osl_init);
+module_exit(bn_osl_cleanup);
diff -urN linux-2.4.6-pre4/drivers/acpi/ospm/ec/Makefile linux/drivers/acpi/ospm/ec/Makefile
--- linux-2.4.6-pre4/drivers/acpi/ospm/ec/Makefile	Wed Dec 31 16:00:00 1969
+++ linux/drivers/acpi/ospm/ec/Makefile	Mon Dec  3 22:48:42 2001
@@ -0,0 +1,6 @@
+O_TARGET	:= ospm_$(notdir $(CURDIR)).o
+obj-m		:= $(O_TARGET)
+EXTRA_CFLAGS	+= $(ACPI_CFLAGS)
+obj-y		:= $(patsubst %.c,%.o,$(wildcard *.c))
+
+include $(TOPDIR)/Rules.make
diff -urN linux-2.4.6-pre4/drivers/acpi/ospm/ec/ec_osl.c linux/drivers/acpi/ospm/ec/ec_osl.c
--- linux-2.4.6-pre4/drivers/acpi/ospm/ec/ec_osl.c	Wed Dec 31 16:00:00 1969
+++ linux/drivers/acpi/ospm/ec/ec_osl.c	Mon Dec  3 22:48:42 2001
@@ -0,0 +1,115 @@
+/*****************************************************************************
+ *
+ * Module Name: ec_osl.c
+ *   $Revision: 6 $
+ *
+ *****************************************************************************/
+
+/*
+ *  Copyright (C) 2000, 2001 Andrew Grover
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/types.h>
+#include <linux/proc_fs.h>
+#include <acpi.h>
+#include <bm.h>
+#include "ec.h"
+
+
+MODULE_AUTHOR("Andrew Grover");
+MODULE_DESCRIPTION("ACPI Component Architecture (CA) - Embedded Controller Driver");
+
+#ifdef ACPI_DEBUG
+
+static int dbg_layer = ACPI_COMPONENT_DEFAULT;
+MODULE_PARM(dbg_layer, "i");
+MODULE_PARM_DESC(dbg_layer, "Controls debug output (see acpi_dbg_layer).\n");
+
+static int dbg_level = DEBUG_DEFAULT;
+MODULE_PARM(dbg_level, "i");
+MODULE_PARM_DESC(dbg_level, "Controls debug output (see acpi_dbg_level).\n");
+
+#endif /*ACPI_DEBUG*/
+
+
+#ifdef ACPI_DEBUG
+static u32			save_dbg_layer;
+static u32			save_dbg_level;
+#endif /*ACPI_DEBUG*/
+
+
+/****************************************************************************
+ *
+ * FUNCTION:    ec_osl_init
+ *
+ * PARAMETERS:	<none>
+ *
+ * RETURN:	0: Success
+ *
+ * DESCRIPTION: Module initialization.
+ *
+ ****************************************************************************/
+
+static int __init 
+ec_osl_init (void)
+{
+	ACPI_STATUS		status = AE_OK;
+
+#ifdef ACPI_DEBUG
+	save_dbg_layer = acpi_dbg_layer;
+	acpi_dbg_layer = dbg_layer;
+
+	save_dbg_level = acpi_dbg_level;
+	acpi_dbg_level = dbg_level;
+#endif /*ACPI_DEBUG*/
+
+	status = ec_initialize();
+
+	return (ACPI_SUCCESS(status)) ? 0 : -ENODEV;
+}
+
+/****************************************************************************
+ *
+ * FUNCTION:    ec_osl_cleanup
+ *
+ * PARAMETERS:	<none>
+ *
+ * RETURN:	<none>
+ *
+ * DESCRIPTION: Module cleanup.
+ *
+ ****************************************************************************/
+
+static void __exit 
+ec_osl_cleanup(void)
+{
+	ec_terminate();
+
+#ifdef ACPI_DEBUG
+	acpi_dbg_layer = save_dbg_layer;
+	acpi_dbg_level = save_dbg_level;
+#endif /*ACPI_DEBUG*/
+
+	return;
+}
+
+module_init(ec_osl_init);
+module_exit(ec_osl_cleanup);
diff -urN linux-2.4.6-pre4/drivers/acpi/ospm/ec/ecgpe.c linux/drivers/acpi/ospm/ec/ecgpe.c
--- linux-2.4.6-pre4/drivers/acpi/ospm/ec/ecgpe.c	Wed Dec 31 16:00:00 1969
+++ linux/drivers/acpi/ospm/ec/ecgpe.c	Mon Dec  3 22:48:42 2001
@@ -0,0 +1,230 @@
+/*****************************************************************************
+ *
+ * Module Name: ecgpe.c
+ *   $Revision: 26 $
+ *
+ *****************************************************************************/
+
+/*
+ *  Copyright (C) 2000, 2001 Andrew Grover
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#include <acpi.h>
+#include "ec.h"
+
+#define _COMPONENT		ACPI_EC
+	MODULE_NAME		("ecgpe")
+
+
+/****************************************************************************
+ *
+ * FUNCTION:    ec_query_handler
+ *
+ * PARAMETERS:
+ *
+ * RETURN:
+ *
+ * DESCRIPTION:
+ *
+ ****************************************************************************/
+
+void
+ec_query_handler (
+	void                    *context)
+{
+	EC_CONTEXT		*ec = (EC_CONTEXT*)context;
+	static char		object_name[5] = {'_','Q','0','0','\0'};
+	const char		hex[] = {'0','1','2','3','4','5','6','7','8',
+					'9','A','B','C','D','E','F'};
+
+	if (!ec) {
+		return;
+	}
+
+	/*
+	 * Evaluate _Qxx:
+	 * --------------
+	 * Evaluate corresponding _Qxx method.  Note that a zero query value
+	 * indicates a spurious EC_SCI (no such thing as _Q00).
+	 */
+	object_name[2] = hex[((ec->query_data >> 4) & 0x0F)];
+	object_name[3] = hex[(ec->query_data & 0x0F)];
+
+	bm_evaluate_object(ec->acpi_handle, object_name, NULL, NULL);
+
+	return;
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:    ec_gpe_handler
+ *
+ * PARAMETERS:
+ *
+ * RETURN:
+ *
+ * DESCRIPTION:
+ *
+ ****************************************************************************/
+
+void
+ec_gpe_handler (
+	void                    *context)
+{
+	ACPI_STATUS             status = AE_OK;
+	EC_CONTEXT              *ec = (EC_CONTEXT*)context;
+	EC_STATUS               ec_status = 0;
+
+	if (!ec) {
+		return;
+	}
+
+	/* TBD: synchronize w/ transaction (ectransx). */
+
+	/*
+	 * EC_SCI?
+	 * -------
+	 * Check the EC_SCI bit to see if this is an EC_SCI event.  If not (e.g.
+	 * OBF/IBE) just return, as we already poll to detect these events.
+	 */
+	ec_status = acpi_os_in8(ec->status_port);
+	if (!(ec_status & EC_FLAG_SCI)) {
+		return;
+	}
+
+	/*
+	 * Run Query:
+	 * ----------
+	 * Query the EC to find out which _Qxx method we need to evaluate.
+	 * Note that successful completion of the query causes the EC_SCI
+	 * bit to be cleared (and thus clearing the interrupt source).
+	 */
+	status = ec_io_write(ec, ec->command_port, EC_COMMAND_QUERY,
+		EC_EVENT_OUTPUT_BUFFER_FULL);
+	if (ACPI_FAILURE(status)) {
+		return;
+	}
+
+	status = ec_io_read(ec, ec->data_port, &(ec->query_data),
+		EC_EVENT_NONE);
+	if (ACPI_FAILURE(status)) {
+		return;
+	}
+
+	/* TBD: un-synchronize w/ transaction (ectransx). */
+
+	/*
+	 * Spurious EC_SCI?
+	 * ----------------
+	 */
+	if (!ec->query_data) {
+		return;
+	}
+
+	/*
+	 * Defer _Qxx Execution:
+	 * ---------------------
+	 * Can't evaluate this method now 'cause we're at interrupt-level.
+	 */
+	status = acpi_os_queue_for_execution(OSD_PRIORITY_GPE,
+		ec_query_handler, ec);
+	if (ACPI_FAILURE(status)) {
+		return;
+	}
+
+	return;
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:    ec_install_gpe_handler
+ *
+ * PARAMETERS:
+ *
+ * RETURN:
+ *
+ * DESCRIPTION:
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+ec_install_gpe_handler (
+	EC_CONTEXT              *ec)
+{
+	ACPI_STATUS             status = AE_OK;
+
+	if (!ec) {
+		return(AE_BAD_PARAMETER);
+	}
+
+	/*
+	 * Evaluate _GPE:
+	 * --------------
+	 * Evaluate the "_GPE" object (required) to find out which GPE bit
+	 * is used by this EC to signal events (SCIs).
+	 */
+	status = bm_evaluate_simple_integer(ec->acpi_handle,
+		"_GPE", &(ec->gpe_bit));
+	if (ACPI_FAILURE(status)) {
+		return(status);
+	}
+
+	/*
+	 * Install GPE Handler:
+	 * --------------------
+	 * Install a handler for this EC's GPE bit.
+	 */
+	status = acpi_install_gpe_handler(ec->gpe_bit, ACPI_EVENT_EDGE_TRIGGERED,
+		&ec_gpe_handler, ec);
+	if (ACPI_FAILURE(status)) {
+		ec->gpe_bit = EC_GPE_UNKNOWN;
+		return(status);
+	}
+
+	return(status);
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:    ec_remove_gpe_handler
+ *
+ * PARAMETERS:
+ *
+ * RETURN:
+ *
+ * DESCRIPTION:
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+ec_remove_gpe_handler (
+	EC_CONTEXT              *ec)
+{
+	ACPI_STATUS             status = AE_OK;
+
+	if (!ec) {
+		return(AE_BAD_PARAMETER);
+	}
+
+	status = acpi_remove_gpe_handler(ec->gpe_bit, &ec_gpe_handler);
+
+	return(status);
+}
diff -urN linux-2.4.6-pre4/drivers/acpi/ospm/ec/ecmain.c linux/drivers/acpi/ospm/ec/ecmain.c
--- linux-2.4.6-pre4/drivers/acpi/ospm/ec/ecmain.c	Wed Dec 31 16:00:00 1969
+++ linux/drivers/acpi/ospm/ec/ecmain.c	Mon Dec  3 22:48:42 2001
@@ -0,0 +1,452 @@
+/*****************************************************************************
+ *
+ * Module Name: ecmain.c
+ *   $Revision: 26 $
+ *
+ *****************************************************************************/
+
+/*
+ *  Copyright (C) 2000, 2001 Andrew Grover
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#include <acpi.h>
+#include "ec.h"
+
+#define _COMPONENT		ACPI_EC
+	MODULE_NAME		("ecmain")
+
+
+/****************************************************************************
+ *                            Internal Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ *
+ * FUNCTION:    ec_print
+ *
+ * PARAMETERS:
+ *
+ * RETURN:
+ *
+ * DESCRIPTION: Prints out information on a specific ec.
+ *
+ ****************************************************************************/
+
+void
+ec_print (
+	EC_CONTEXT              *ec)
+{
+
+	if (!ec) {
+		return;
+	}
+
+	acpi_os_printf("EC: found, GPE %d\n", ec->gpe_bit);
+
+
+	return;
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:    ec_get_port_values
+ *
+ * PARAMETERS:
+ *
+ * RETURN:
+ *
+ * DESCRIPTION: Evaluate _CRS to get the current resources (I/O port
+ *              addresses) for this EC.
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+ec_get_port_values(
+	EC_CONTEXT              *ec)
+{
+	ACPI_STATUS             status = AE_OK;
+	ACPI_BUFFER             buffer;
+	ACPI_RESOURCE           *resource = NULL;
+
+	if (!ec) {
+		return(AE_BAD_PARAMETER);
+	}
+
+	buffer.length = 0;
+	buffer.pointer = NULL;
+
+	status = acpi_get_current_resources(ec->acpi_handle, &buffer);
+	if (status != AE_BUFFER_OVERFLOW) {
+		return(status);
+	}
+
+	buffer.pointer = acpi_os_callocate(buffer.length);
+	if (!buffer.pointer) {
+		return(AE_NO_MEMORY);
+	}
+
+	status = acpi_get_current_resources(ec->acpi_handle, &buffer);
+	if (ACPI_FAILURE(status)) {
+		goto end;
+	}
+
+	resource = (ACPI_RESOURCE *) buffer.pointer;
+	ec->data_port = resource->data.io.min_base_address;
+
+	resource = NEXT_RESOURCE(resource);
+
+	ec->status_port = ec->command_port =
+		resource->data.io.min_base_address;
+end:
+	acpi_os_free(buffer.pointer);
+
+	return(status);
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:    ec_add_device
+ *
+ * PARAMETERS:
+ *
+ * RETURN:
+ *
+ * DESCRIPTION:
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+ec_add_device(
+	BM_HANDLE               device_handle,
+	void                    **context)
+{
+	ACPI_STATUS             status = AE_OK;
+	BM_DEVICE		*device = NULL;
+	EC_CONTEXT              *ec = NULL;
+	u8                      gpe_handler = FALSE;
+	u8                      space_handler = FALSE;
+
+	if (!context || *context) {
+		return(AE_BAD_PARAMETER);
+	}
+
+	/*
+	 * Get information on this device.
+	 */
+	status = bm_get_device_info(device_handle, &device);
+	if (ACPI_FAILURE(status)) {
+		return(status);
+	}
+
+	/*
+	 * Allocate a new EC_CONTEXT structure.
+	 */
+	ec = acpi_os_callocate(sizeof(EC_CONTEXT));
+	if (!ec) {
+		return(AE_NO_MEMORY);
+	}
+
+	ec->device_handle = device->handle;
+	ec->acpi_handle = device->acpi_handle;
+
+	/*
+	 * Get the I/O port addresses for the command/status and data ports.
+	 */
+	status = ec_get_port_values(ec);
+	if (ACPI_FAILURE(status)) {
+		goto end;
+	}
+
+	/*
+	 * See if we need to obtain the global lock for EC transactions.
+	 */
+	status = bm_evaluate_simple_integer(ec->acpi_handle, "_GLK",
+		&ec->use_global_lock);
+	if (status == AE_NOT_FOUND) {
+		ec->use_global_lock = 0;
+	}
+	else if (ACPI_FAILURE(status)) {
+		goto end;
+	}
+
+	/*
+	 * Install a handler for servicing this EC's GPE.
+	 */
+	status = ec_install_gpe_handler(ec);
+	if (ACPI_FAILURE(status)) {
+		goto end;
+	}
+	else {
+		gpe_handler = TRUE;
+	}
+
+	/*
+	 * Install a handler for servicing this EC's address space.
+	 */
+	status = ec_install_space_handler(ec);
+	if (ACPI_FAILURE(status)) {
+		goto end;
+	}
+	else {
+		space_handler = TRUE;
+	}
+
+	/*
+	 * Create a semaphore to serialize EC transactions.
+	 */
+	status = acpi_os_create_semaphore(1,1, &(ec->mutex));
+	if (ACPI_FAILURE(status)) {
+		goto end;
+	}
+
+	/*
+	 * Context now contains information specific to this EC.  Note
+	 * that we'll get this pointer back on every ec_request() and
+	 * ec_notify().
+	 */
+	*context = ec;
+
+	ec_print(ec);
+
+end:
+	if (ACPI_FAILURE(status)) {
+
+		if (gpe_handler) {
+			ec_remove_gpe_handler(ec);
+		}
+
+		if (space_handler) {
+			ec_remove_space_handler(ec);
+		}
+
+		if (ec->mutex) {
+			acpi_os_delete_semaphore(ec->mutex);
+		}
+
+		acpi_os_free(ec);
+	}
+
+	return(status);
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:    ec_remove_device
+ *
+ * PARAMETERS:
+ *
+ * RETURN:
+ *
+ * DESCRIPTION:
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+ec_remove_device(
+	void                    **context)
+{
+	ACPI_STATUS             status = AE_OK;
+	EC_CONTEXT              *ec = NULL;
+
+	if (!context || !*context) {
+		return(AE_BAD_PARAMETER);
+	}
+
+	ec = (EC_CONTEXT*)*context;
+
+	ec_remove_space_handler(ec);
+
+	ec_remove_gpe_handler(ec);
+
+	if (ec->mutex) {
+		acpi_os_delete_semaphore(ec->mutex);
+	}
+
+	acpi_os_free(ec);
+
+	*context = NULL;
+
+	return(status);
+}
+
+
+/****************************************************************************
+ *                             External Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ *
+ * FUNCTION:    ec_initialize
+ *
+ * PARAMETERS:
+ *
+ * RETURN:
+ *
+ * DESCRIPTION:
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+ec_initialize (void)
+{
+	ACPI_STATUS             status = AE_OK;
+	BM_DEVICE_ID		criteria;
+	BM_DRIVER		driver;
+
+	MEMSET(&criteria, 0, sizeof(BM_DEVICE_ID));
+	MEMSET(&driver, 0, sizeof(BM_DRIVER));
+
+	/*
+	 * Register driver for AC Adapter devices.
+	 */
+	MEMCPY(criteria.hid, EC_HID_EC, sizeof(EC_HID_EC));
+
+	driver.notify = &ec_notify;
+	driver.request = &ec_request;
+
+	status = bm_register_driver(&criteria, &driver);
+
+	return(status);
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:    ec_terminate
+ *
+ * PARAMETERS:
+ *
+ * RETURN:
+ *
+ * DESCRIPTION:
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+ec_terminate(void)
+{
+	ACPI_STATUS             status = AE_OK;
+	BM_DEVICE_ID		criteria;
+	BM_DRIVER		driver;
+
+	MEMSET(&criteria, 0, sizeof(BM_DEVICE_ID));
+	MEMSET(&driver, 0, sizeof(BM_DRIVER));
+
+	/*
+	 * Unregister driver for AC Adapter devices.
+	 */
+	MEMCPY(criteria.hid, EC_HID_EC, sizeof(EC_HID_EC));
+
+	driver.notify = &ec_notify;
+	driver.request = &ec_request;
+
+	status = bm_unregister_driver(&criteria, &driver);
+
+	return(status);
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:    ec_notify
+ *
+ * PARAMETERS:
+ *
+ * RETURN:
+ *
+ * DESCRIPTION:
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+ec_notify (
+	BM_NOTIFY               notify,
+	BM_HANDLE               device_handle,
+	void                    **context)
+{
+	ACPI_STATUS             status = AE_OK;
+
+	switch (notify) {
+
+	case BM_NOTIFY_DEVICE_ADDED:
+		status = ec_add_device(device_handle, context);
+		break;
+
+	case BM_NOTIFY_DEVICE_REMOVED:
+		status = ec_remove_device(context);
+		break;
+
+	default:
+		status = AE_SUPPORT;
+		break;
+	}
+
+	return(status);
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:    ec_request
+ *
+ * PARAMETERS:
+ *
+ * RETURN:
+ *
+ * DESCRIPTION:
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+ec_request (
+	BM_REQUEST              *request,
+	void                    *context)
+{
+	ACPI_STATUS             status = AE_OK;
+	EC_REQUEST              *ec_request = NULL;
+	EC_CONTEXT              *ec = NULL;
+
+	/*
+	 * Must have a valid request structure and context.
+	 */
+	if (!request || !context)
+		return(AE_BAD_PARAMETER);
+
+	/*
+	 * buffer must contain a valid EC_REQUEST structure.
+	 */
+	status = bm_cast_buffer(&(request->buffer), (void**)&ec_request,
+		sizeof(EC_REQUEST));
+	if (ACPI_FAILURE(status))
+		return(status);
+
+	/*
+	 * context contains information specific to this EC.
+	 */
+	ec = (EC_CONTEXT*)context;
+
+	/*
+	 * Perform the Transaction.
+	 */
+	status = ec_transaction(ec, ec_request);
+
+	return(status);
+}
diff -urN linux-2.4.6-pre4/drivers/acpi/ospm/ec/ecspace.c linux/drivers/acpi/ospm/ec/ecspace.c
--- linux-2.4.6-pre4/drivers/acpi/ospm/ec/ecspace.c	Wed Dec 31 16:00:00 1969
+++ linux/drivers/acpi/ospm/ec/ecspace.c	Mon Dec  3 22:48:42 2001
@@ -0,0 +1,185 @@
+/*****************************************************************************
+ *
+ * Module Name: ecspace.c
+ *   $Revision: 20 $
+ *
+ *****************************************************************************/
+
+/*
+ *  Copyright (C) 2000, 2001 Andrew Grover
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#include <acpi.h>
+#include "ec.h"
+
+#define _COMPONENT		ACPI_EC
+	MODULE_NAME		("ecspace")
+
+
+/****************************************************************************
+ *
+ * FUNCTION:    ec_space_setup
+ *
+ * PARAMETERS:
+ *
+ * RETURN:
+ *
+ * DESCRIPTION:
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+ec_space_setup (
+	ACPI_HANDLE		region_handle,
+	u32			function,
+	void			*handler_context,
+	void			**return_context)
+{
+	/*
+	 * The EC object is in the handler context and is needed
+	 * when calling the ec_space_handler.
+	 */
+	*return_context = handler_context;
+
+	return AE_OK;
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:    ec_space_handler
+ *
+ * PARAMETERS:  function            - Read or Write operation
+ *              address             - Where in the space to read or write
+ *              bit_width           - Field width in bits (8, 16, or 32)
+ *              value               - Pointer to in or out value
+ *              context             - context pointer
+ *
+ * RETURN:
+ *
+ * DESCRIPTION: Handler for the Embedded Controller (EC) address space
+ *              (Op Region)
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+ec_space_handler (
+	u32                     function,
+	ACPI_PHYSICAL_ADDRESS   address,
+	u32                     bit_width,
+	u32                     *value,
+	void                    *handler_context,
+	void                    *region_context)
+{
+	ACPI_STATUS             status = AE_OK;
+	EC_CONTEXT              *ec = NULL;
+	EC_REQUEST              ec_request;
+
+	if (address > 0xFF || bit_width != 8 || !value || !handler_context) {
+		return(AE_BAD_PARAMETER);
+	}
+
+	ec = (EC_CONTEXT*)handler_context;
+
+	switch (function) {
+
+	case ACPI_READ_ADR_SPACE:
+		ec_request.command = EC_COMMAND_READ;
+		ec_request.address = address;
+		ec_request.data = 0;
+		break;
+
+	case ACPI_WRITE_ADR_SPACE:
+		ec_request.command = EC_COMMAND_WRITE;
+		ec_request.address = address;
+		ec_request.data = (u8)(*value);
+		break;
+
+	default:
+		return(AE_BAD_PARAMETER);
+		break;
+	}
+
+	/*
+	 * Perform the Transaction.
+	 */
+	status = ec_transaction(ec, &ec_request);
+	if (ACPI_SUCCESS(status)) {
+		(*value) = (u32)ec_request.data;
+	}
+
+	return(status);
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:    ec_install_space_handler
+ *
+ * PARAMETERS:
+ *
+ * RETURN:
+ *
+ * DESCRIPTION:
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+ec_install_space_handler (
+	EC_CONTEXT              *ec)
+{
+	ACPI_STATUS             status = AE_OK;
+
+	if (!ec) {
+		return(AE_BAD_PARAMETER);
+	}
+
+	status = acpi_install_address_space_handler (ec->acpi_handle,
+		ACPI_ADR_SPACE_EC, &ec_space_handler, &ec_space_setup, ec);
+	
+	return(status);
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:    ec_remove_space_handler
+ *
+ * PARAMETERS:
+ *
+ * RETURN:
+ *
+ * DESCRIPTION:
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+ec_remove_space_handler (
+	EC_CONTEXT              *ec)
+{
+	ACPI_STATUS             status = AE_OK;
+
+	if (!ec) {
+		return(AE_BAD_PARAMETER);
+	}
+
+	status = acpi_remove_address_space_handler(ec->acpi_handle,
+		ACPI_ADR_SPACE_EC, &ec_space_handler);
+
+	return(status);
+}
diff -urN linux-2.4.6-pre4/drivers/acpi/ospm/ec/ectransx.c linux/drivers/acpi/ospm/ec/ectransx.c
--- linux-2.4.6-pre4/drivers/acpi/ospm/ec/ectransx.c	Wed Dec 31 16:00:00 1969
+++ linux/drivers/acpi/ospm/ec/ectransx.c	Mon Dec  3 22:48:42 2001
@@ -0,0 +1,326 @@
+/*****************************************************************************
+ *
+ * Module Name: ectransx.c
+ *   $Revision: 21 $
+ *
+ *****************************************************************************/
+
+/*
+ *  Copyright (C) 2000, 2001 Andrew Grover
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#include <acpi.h>
+#include "ec.h"
+
+#define _COMPONENT		ACPI_EC
+	MODULE_NAME             ("ectransx")
+
+
+/****************************************************************************
+ *
+ * FUNCTION:    ec_io_wait
+ *
+ * PARAMETERS:
+ *
+ * RETURN:
+ *
+ * DESCRIPTION:
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+ec_io_wait (
+	EC_CONTEXT              *ec,
+	EC_EVENT                wait_event)
+{
+	EC_STATUS               ec_status = 0;
+	u32                     i = 100;
+
+	if (!ec || ((wait_event != EC_EVENT_OUTPUT_BUFFER_FULL)
+		&& (wait_event != EC_EVENT_INPUT_BUFFER_EMPTY))) {
+		return(AE_BAD_PARAMETER);
+	}
+
+	/*
+	 * Wait for Event:
+	 * ---------------
+	 * Poll the EC status register waiting for the event to occur.
+	 * Note that we'll wait a maximum of 1ms in 10us chunks.
+	 */
+	switch (wait_event) {
+
+	case EC_EVENT_OUTPUT_BUFFER_FULL:
+		do {
+			ec_status = acpi_os_in8(ec->status_port);
+			if (ec_status & EC_FLAG_OUTPUT_BUFFER) {
+				return(AE_OK);
+			}
+			acpi_os_sleep_usec(10);
+		} while (--i>0);
+		break;
+
+	case EC_EVENT_INPUT_BUFFER_EMPTY:
+		do {
+			ec_status = acpi_os_in8(ec->status_port);
+			if (!(ec_status & EC_FLAG_INPUT_BUFFER)) {
+				return(AE_OK);
+			}
+			acpi_os_sleep_usec(10);
+		} while (--i>0);
+		break;
+	}
+
+	return(AE_TIME);
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:    ec_io_read
+ *
+ * PARAMETERS:
+ *
+ * RETURN:
+ *
+ * DESCRIPTION:
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+ec_io_read (
+	EC_CONTEXT              *ec,
+	ACPI_IO_ADDRESS         io_port,
+	u8                      *data,
+	EC_EVENT                wait_event)
+{
+	ACPI_STATUS             status = AE_OK;
+
+	if (!ec || !data) {
+		return(AE_BAD_PARAMETER);
+	}
+
+	*data = acpi_os_in8(io_port);
+
+	if (wait_event) {
+		status = ec_io_wait(ec, wait_event);
+	}
+
+	return(status);
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:    ec_io_write
+ *
+ * PARAMETERS:
+ *
+ * RETURN:
+ *
+ * DESCRIPTION:
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+ec_io_write (
+	EC_CONTEXT              *ec,
+	ACPI_IO_ADDRESS         io_port,
+	u8                      data,
+	EC_EVENT                wait_event)
+{
+	ACPI_STATUS             status = AE_OK;
+
+	if (!ec) {
+		return(AE_BAD_PARAMETER);
+	}
+
+	acpi_os_out8(io_port, data);
+
+	if (wait_event) {
+		status = ec_io_wait(ec, wait_event);
+	}
+
+	return(status);
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:    ec_read
+ *
+ * PARAMETERS:
+ *
+ * RETURN:
+ *
+ * DESCRIPTION:
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+ec_read (
+	EC_CONTEXT              *ec,
+	u8                      address,
+	u8                      *data)
+{
+	ACPI_STATUS             status = AE_OK;
+
+	if (!ec || !data) {
+		return(AE_BAD_PARAMETER);
+	}
+
+	if (ec->use_global_lock) {
+		status = acpi_acquire_global_lock();
+		if (ACPI_FAILURE(status)) {
+			return(status);
+		}
+	}
+
+	status = ec_io_write(ec, ec->command_port, EC_COMMAND_READ,
+		EC_EVENT_INPUT_BUFFER_EMPTY);
+	if (ACPI_FAILURE(status)) {
+		return(status);
+	}
+
+	status = ec_io_write(ec, ec->data_port, address,
+		EC_EVENT_OUTPUT_BUFFER_FULL);
+	if (ACPI_FAILURE(status)) {
+		return(status);
+	}
+
+	status = ec_io_read(ec, ec->data_port, data, EC_EVENT_NONE);
+
+	if (ec->use_global_lock) {
+		acpi_release_global_lock();
+	}
+
+	return(status);
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:    ec_write
+ *
+ * PARAMETERS:
+ *
+ * RETURN:
+ *
+ * DESCRIPTION:
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+ec_write (
+	EC_CONTEXT              *ec,
+	u8                      address,
+	u8                      data)
+{
+	ACPI_STATUS             status = AE_OK;
+
+	if (!ec)
+		return(AE_BAD_PARAMETER);
+
+	if (ec->use_global_lock) {
+		status = acpi_acquire_global_lock();
+		if (ACPI_FAILURE(status)) {
+			return(status);
+		}
+	}
+
+	status = ec_io_write(ec, ec->command_port, EC_COMMAND_WRITE,
+		EC_EVENT_INPUT_BUFFER_EMPTY);
+	if (ACPI_FAILURE(status)) {
+		return(status);
+	}
+
+	status = ec_io_write(ec, ec->data_port, address,
+		EC_EVENT_INPUT_BUFFER_EMPTY);
+	if (ACPI_FAILURE(status)) {
+		return(status);
+	}
+
+	status = ec_io_write(ec, ec->data_port, data,
+		EC_EVENT_INPUT_BUFFER_EMPTY);
+	if (ACPI_FAILURE(status)) {
+		return(status);
+	}
+
+	if (ec->use_global_lock) {
+		acpi_release_global_lock();
+	}
+
+	return(status);
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:    ec_transaction
+ *
+ * PARAMETERS:
+ *
+ * RETURN:
+ *
+ * DESCRIPTION:
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+ec_transaction (
+	EC_CONTEXT              *ec,
+	EC_REQUEST              *request)
+{
+	ACPI_STATUS             status = AE_OK;
+
+	if (!ec || !request) {
+		return(AE_BAD_PARAMETER);
+	}
+
+	/*
+	 * Obtain mutex to serialize all EC transactions.
+	 */
+	status = acpi_os_wait_semaphore(ec->mutex, 1, EC_DEFAULT_TIMEOUT);
+	if (ACPI_FAILURE(status)) {
+		return(status);
+	}
+
+	/*
+	 * Perform the transaction.
+	 */
+	switch (request->command) {
+
+	case EC_COMMAND_READ:
+		status = ec_read(ec, request->address, &(request->data));
+		break;
+
+	case EC_COMMAND_WRITE:
+		status = ec_write(ec, request->address, request->data);
+		break;
+
+	default:
+		status = AE_SUPPORT;
+		break;
+	}
+
+	/*
+	 * Signal the mutex to indicate transaction completion.
+	 */
+	acpi_os_signal_semaphore(ec->mutex, 1);
+
+	return(status);
+}
diff -urN linux-2.4.6-pre4/drivers/acpi/ospm/include/ac.h linux/drivers/acpi/ospm/include/ac.h
--- linux-2.4.6-pre4/drivers/acpi/ospm/include/ac.h	Wed Dec 31 16:00:00 1969
+++ linux/drivers/acpi/ospm/include/ac.h	Mon Dec  3 22:48:42 2001
@@ -0,0 +1,102 @@
+/*****************************************************************************
+ *
+ * Module Name: ac.h
+ *   $Revision: 6 $
+ *
+ *****************************************************************************/
+
+/*
+ *  Copyright (C) 2000, 2001 Andrew Grover
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#ifndef __AC_H__
+#define __AC_H__
+
+#include <actypes.h>
+#include <acexcep.h>
+#include <bm.h>
+
+
+/*****************************************************************************
+ *                            Types & Other Defines
+ *****************************************************************************/
+
+/*
+ * Notifications:
+ * --------------
+ */
+#define AC_NOTIFY_STATUS_CHANGE	((BM_NOTIFY) 0x80)
+
+/*
+ * Hardware IDs:
+ * -------------
+ */
+#define AC_HID_AC_ADAPTER	"ACPI0003"
+
+
+/*
+ * Device Context:
+ * ---------------
+ */
+typedef struct
+{
+	BM_HANDLE		device_handle;
+	ACPI_HANDLE		acpi_handle;
+	char			uid[9];
+	u32 			is_online;
+} AC_CONTEXT;
+
+
+/*****************************************************************************
+ *                              Function Prototypes
+ *****************************************************************************/
+
+ACPI_STATUS
+ac_initialize (void);
+
+ACPI_STATUS
+ac_terminate (void);
+
+ACPI_STATUS
+ac_notify (
+	u32			notify_type,
+	u32 			device,
+	void			**context);
+
+ACPI_STATUS
+ac_request(
+	BM_REQUEST		*request_info,
+	void			*context);
+
+/* AC Adapter Driver OSL */
+
+ACPI_STATUS
+ac_osl_add_device (
+	AC_CONTEXT		*ac_adapter);
+
+ACPI_STATUS
+ac_osl_remove_device (
+	AC_CONTEXT		*ac_adapter);
+
+ACPI_STATUS
+ac_osl_generate_event (
+	u32			event,
+	AC_CONTEXT		*ac_adapter);
+
+
+#endif	/* __AC_H__ */
diff -urN linux-2.4.6-pre4/drivers/acpi/ospm/include/bm.h linux/drivers/acpi/ospm/include/bm.h
--- linux-2.4.6-pre4/drivers/acpi/ospm/include/bm.h	Wed Dec 31 16:00:00 1969
+++ linux/drivers/acpi/ospm/include/bm.h	Mon Dec  3 22:48:42 2001
@@ -0,0 +1,584 @@
+/*****************************************************************************
+ *
+ * Module name: bm.h
+ *   $Revision: 39 $
+ *
+ *****************************************************************************/
+
+/*
+ *  Copyright (C) 2000, 2001 Andrew Grover
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#ifndef __BM_H__
+#define __BM_H__
+
+#include <actypes.h>
+#include <acexcep.h>
+
+
+/*****************************************************************************
+ *                               Types & Defines
+ *****************************************************************************/
+
+/*
+ * Output Flags (Debug):
+ * ---------------------
+ */
+#define BM_PRINT_ALL		(0x00000000)
+#define BM_PRINT_GROUP		(0x00000001)
+#define BM_PRINT_LINKAGE	(0x00000002)
+#define BM_PRINT_IDENTIFICATION	(0x00000004)
+#define BM_PRINT_POWER		(0x00000008)
+#define BM_PRINT_PRESENT	(0x00000010)
+
+
+/*
+ * BM_COMMAND:
+ * -----------
+ */
+typedef u32			BM_COMMAND;
+
+#define BM_COMMAND_UNKNOWN	((BM_COMMAND) 0x00)
+
+#define BM_COMMAND_GET_POWER_STATE ((BM_COMMAND) 0x01)
+#define BM_COMMAND_SET_POWER_STATE ((BM_COMMAND) 0x02)
+
+#define BM_COMMAND_DEVICE_SPECIFIC ((BM_COMMAND) 0x80)
+
+/*
+ * BM_NOTIFY:
+ * ----------
+ * Standard ACPI notification values, from section 5.6.3 of the ACPI 2.0
+ * specification.  Note that the Bus Manager internally handles all
+ * standard ACPI notifications -- driver modules are never sent these
+ * values (see "Bus Manager Notifications", below).
+ */
+typedef u32			BM_NOTIFY;
+
+#define BM_NOTIFY_BUS_CHECK	((BM_NOTIFY) 0x00)
+#define BM_NOTIFY_DEVICE_CHECK	((BM_NOTIFY) 0x01)
+#define BM_NOTIFY_DEVICE_WAKE	((BM_NOTIFY) 0x02)
+#define BM_NOTIFY_EJECT_REQUEST	((BM_NOTIFY) 0x03)
+#define BM_NOTIFY_DEVICE_CHECK_LIGHT ((BM_NOTIFY) 0x04)
+#define BM_NOTIFY_FREQUENCY_MISMATCH ((BM_NOTIFY) 0x05)
+#define BM_NOTIFY_BUS_MODE_MISMATCH ((BM_NOTIFY) 0x06)
+#define BM_NOTIFY_POWER_FAULT	((BM_NOTIFY) 0x07)
+
+/*
+ * These are a higher-level abstraction of ACPI notifications, intended
+ * for consumption by driver modules to facilitate PnP.
+ */
+#define BM_NOTIFY_UNKNOWN	((BM_NOTIFY) 0x00)
+#define BM_NOTIFY_DEVICE_ADDED	((BM_NOTIFY) 0x01)
+#define BM_NOTIFY_DEVICE_REMOVED ((BM_NOTIFY) 0x02)
+
+
+/*
+ * BM_HANDLE:
+ * ----------
+ */
+typedef u32			BM_HANDLE;
+
+#define BM_HANDLE_ROOT		((BM_HANDLE) 0x00000000)
+#define BM_HANDLE_UNKNOWN	((BM_HANDLE) 0xFFFFFFFF)
+#define BM_HANDLES_MAX		100
+
+
+
+/*
+ * BM_HANDLE_LIST:
+ * ---------------
+ */
+typedef struct
+{
+	u32			count;
+	BM_HANDLE		handles[BM_HANDLES_MAX];
+} BM_HANDLE_LIST;
+
+
+/*
+ * BM_DEVICE_TYPE:
+ * ---------------
+ */
+typedef u32			BM_DEVICE_TYPE;
+
+#define BM_TYPE_UNKNOWN		((BM_DEVICE_TYPE) 0x00000000)
+
+#define BM_TYPE_SYSTEM		((BM_DEVICE_TYPE) 0x00000001)
+#define BM_TYPE_SCOPE		((BM_DEVICE_TYPE) 0x00000002)
+#define BM_TYPE_PROCESSOR	((BM_DEVICE_TYPE) 0x00000003)
+#define BM_TYPE_THERMAL_ZONE	((BM_DEVICE_TYPE) 0x00000004)
+#define BM_TYPE_POWER_RESOURCE	((BM_DEVICE_TYPE) 0x00000005)
+#define BM_TYPE_DEVICE		((BM_DEVICE_TYPE) 0x00000006)
+#define BM_TYPE_FIXED_BUTTON	((BM_DEVICE_TYPE) 0x00000007)
+
+
+/*
+ * BM_DEVICE_UID:
+ * --------------
+ */
+typedef char			BM_DEVICE_UID[9];
+
+#define BM_UID_UNKNOWN		'0'
+
+
+/*
+ * BM_DEVICE_HID:
+ * --------------
+ */
+typedef char			BM_DEVICE_HID[9];
+
+#define BM_HID_UNKNOWN		'\0'
+#define BM_HID_POWER_BUTTON	"PNP0C0C"
+#define BM_HID_SLEEP_BUTTON	"PNP0C0E"
+
+/*
+ * BM_DEVICE_ADR:
+ * --------------
+ */
+typedef u32			BM_DEVICE_ADR;
+
+#define BM_ADDRESS_UNKNOWN	0
+
+
+/*
+ * BM_DEVICE_FLAGS:
+ * ----------------
+ * The encoding of BM_DEVICE_FLAGS is illustrated below.
+ * Note that a set bit (1) indicates the property is TRUE
+ * (e.g. if bit 0 is set then the device has dynamic status).
+ * +--+------------+-+-+-+-+-+-+-+
+ * |31| Bits 30:7  |6|5|4|3|2|1|0|
+ * +--+------------+-+-+-+-+-+-+-+
+ *   |       |      | | | | | | |
+ *   |       |      | | | | | | +- Dynamic status?
+ *   |       |      | | | | | +--- Identifiable?
+ *   |       |      | | | | +----- Configurable?
+ *   |       |      | | | +------- Power Control?
+ *   |       |      | | +--------- Ejectable?
+ *   |       |      | +----------- Docking Station?
+ *   |       |      +------------- Fixed-Feature?
+ *   |       +-------------------- <Reserved>
+ *   +---------------------------- Driver Control?
+ *
+ * Dynamic status:  Device has a _STA object.
+ * Identifiable:    Device has a _HID and/or _ADR and possibly other
+ *                  identification objects defined.
+ * Configurable:    Device has a _CRS and possibly other configuration
+ *                  objects defined.
+ * Power Control:   Device has a _PR0 and/or _PS0 and possibly other
+ *                  power management objects defined.
+ * Ejectable:       Device has an _EJD and/or _EJx and possibly other
+ *                  dynamic insertion/removal objects defined.
+ * Docking Station: Device has a _DCK object defined.
+ * Fixed-Feature:   Device does not exist in the namespace; was
+ *                  enumerated as a fixed-feature (e.g. power button).
+ * Driver Control:  A driver has been installed for this device.
+ */
+typedef u32			BM_DEVICE_FLAGS;
+
+#define BM_FLAGS_UNKNOWN	((BM_DEVICE_FLAGS) 0x00000000)
+
+#define BM_FLAGS_DYNAMIC_STATUS	((BM_DEVICE_FLAGS) 0x00000001)
+#define BM_FLAGS_IDENTIFIABLE	((BM_DEVICE_FLAGS) 0x00000002)
+#define BM_FLAGS_CONFIGURABLE	((BM_DEVICE_FLAGS) 0x00000004)
+#define BM_FLAGS_POWER_CONTROL	((BM_DEVICE_FLAGS) 0x00000008)
+#define BM_FLAGS_EJECTABLE	((BM_DEVICE_FLAGS) 0x00000010)
+#define BM_FLAGS_DOCKING_STATION ((BM_DEVICE_FLAGS) 0x00000020)
+#define BM_FLAGS_FIXED_FEATURE	((BM_DEVICE_FLAGS) 0x00000040)
+#define BM_FLAGS_DRIVER_CONTROL	((BM_DEVICE_FLAGS) 0x80000000)
+
+
+/*
+ * Device PM Flags:
+ * ----------------
+ * +-----------+-+-+-+-+-+-+-+
+ * | Bits 31:7 |6|5|4|3|2|1|0|
+ * +-----------+-+-+-+-+-+-+-+
+ *       |      | | | | | | |
+ *       |      | | | | | | +- D0 Support?
+ *       |      | | | | | +--- D1 Support?
+ *       |      | | | | +----- D2 Support?
+ *       |      | | | +------- D3 Support?
+ *       |      | | +--------- Power State Queriable?
+ *       |      | +----------- Inrush Current?
+ *       |      +------------- Wake Capable?
+ *       +-------------------- <Reserved>
+ *
+ * D0-D3 Support:   Device supports corresponding Dx state.
+ * Power State:     Device has a _PSC (current power state) object defined.
+ * Inrush Current:  Device has an _IRC (inrush current) object defined.
+ * Wake Capable:    Device has a _PRW (wake-capable) object defined.
+ */
+#define BM_FLAGS_D0_SUPPORT	((BM_DEVICE_FLAGS) 0x00000001)
+#define BM_FLAGS_D1_SUPPORT	((BM_DEVICE_FLAGS) 0x00000002)
+#define BM_FLAGS_D2_SUPPORT	((BM_DEVICE_FLAGS) 0x00000004)
+#define BM_FLAGS_D3_SUPPORT	((BM_DEVICE_FLAGS) 0x00000008)
+#define BM_FLAGS_POWER_STATE	((BM_DEVICE_FLAGS) 0x00000010)
+#define BM_FLAGS_INRUSH_CURRENT	((BM_DEVICE_FLAGS) 0x00000020)
+#define BM_FLAGS_WAKE_CAPABLE	((BM_DEVICE_FLAGS) 0x00000040)
+
+
+/*
+ * BM_DEVICE_STATUS:
+ * -----------------
+ * The encoding of BM_DEVICE_STATUS is illustrated below.
+ * Note that a set bit (1) indicates the property is TRUE
+ * (e.g. if bit 0 is set then the device is present).
+ * +-----------+-+-+-+-+-+
+ * | Bits 31:4 |4|3|2|1|0|
+ * +-----------+-+-+-+-+-+
+ *       |      | | | | |
+ *       |      | | | | +- Present?
+ *       |      | | | +--- Enabled?
+ *       |      | | +----- Show in UI?
+ *       |      | +------- Functioning?
+ *       |      +--------- Battery Present?
+ *       +---------------- <Reserved>
+ */
+typedef u32			BM_DEVICE_STATUS;
+
+#define BM_STATUS_UNKNOWN	((BM_DEVICE_STATUS) 0x00000000)
+#define BM_STATUS_PRESENT	((BM_DEVICE_STATUS) 0x00000001)
+#define BM_STATUS_ENABLED	((BM_DEVICE_STATUS) 0x00000002)
+#define BM_STATUS_SHOW_UI	((BM_DEVICE_STATUS) 0x00000004)
+#define BM_STATUS_FUNCTIONING	((BM_DEVICE_STATUS) 0x00000008)
+#define BM_STATUS_BATTERY_PRESENT ((BM_DEVICE_STATUS) 0x00000010)
+#define BM_STATUS_DEFAULT	((BM_DEVICE_STATUS) 0x0000000F)
+
+
+/*
+ * BM_POWER_STATE:
+ * ---------------
+ */
+typedef u32			BM_POWER_STATE;
+
+
+/*
+ * BM_DEVICE_ID:
+ * -------------
+ */
+typedef struct
+{
+	BM_DEVICE_TYPE		type;
+	BM_DEVICE_UID		uid;
+	BM_DEVICE_HID		hid;
+	BM_DEVICE_ADR		adr;
+} BM_DEVICE_ID;
+
+
+/*
+ * BM_DEVICE_POWER:
+ * ----------------
+ * Structure containing basic device power management information.
+ */
+typedef struct
+{
+	BM_DEVICE_FLAGS		flags;
+	BM_POWER_STATE		state;
+	BM_DEVICE_FLAGS		dx_supported[ACPI_S_STATE_COUNT];
+} BM_DEVICE_POWER;
+
+
+/*
+ * BM_DEVICE:
+ * ----------
+ */
+typedef struct
+{
+	BM_HANDLE		handle;
+	ACPI_HANDLE		acpi_handle;
+	BM_DEVICE_FLAGS		flags;
+	BM_DEVICE_STATUS	status;
+	BM_DEVICE_ID		id;
+	BM_DEVICE_POWER		power;
+} BM_DEVICE;
+
+
+/*
+ * BM_SEARCH:
+ * ----------
+ * Structure used for searching the ACPI Bus Manager's device hierarchy.
+ */
+typedef struct
+{
+	BM_DEVICE_ID		criteria;
+	BM_HANDLE_LIST		results;
+} BM_SEARCH;
+
+
+/*
+ * BM_REQUEST:
+ * -----------
+ * Structure used for sending requests to/through the ACPI Bus Manager.
+ */
+typedef struct
+{
+	ACPI_STATUS		status;
+	BM_COMMAND		command;
+	BM_HANDLE		handle;
+	ACPI_BUFFER		buffer;
+} BM_REQUEST;
+
+
+/*
+ * Driver Registration:
+ * --------------------
+ */
+
+/* Driver Context */
+typedef void *			BM_DRIVER_CONTEXT;
+
+/* Notification Callback Function */
+typedef
+ACPI_STATUS (*BM_DRIVER_NOTIFY) (
+	BM_NOTIFY		notify_type,
+	BM_HANDLE		device_handle,
+	BM_DRIVER_CONTEXT	*context);
+
+/* Request Callback Function */
+typedef
+ACPI_STATUS (*BM_DRIVER_REQUEST) (
+	BM_REQUEST		*request,
+	BM_DRIVER_CONTEXT	context);
+
+/* Driver Registration */
+typedef struct
+{
+	BM_DRIVER_NOTIFY	notify;
+	BM_DRIVER_REQUEST	request;
+	BM_DRIVER_CONTEXT	context;
+} BM_DRIVER;
+
+
+/*
+ * BM_NODE:
+ * --------
+ * Structure used to maintain the device hierarchy.
+ */
+typedef struct _BM_NODE
+{
+	BM_DEVICE		device;
+	BM_DRIVER		driver;
+	struct _BM_NODE		*parent;
+	struct _BM_NODE		*next;
+	struct
+	{
+		struct _BM_NODE		*head;
+		struct _BM_NODE		*tail;
+	}			scope;
+} BM_NODE;
+
+
+/*
+ * BM_NODE_LIST:
+ * -------------
+ * Structure used to maintain an array of node pointers.
+ */
+typedef struct
+{
+	u32			count;
+	BM_NODE			*nodes[BM_HANDLES_MAX];
+} BM_NODE_LIST;
+
+
+/*****************************************************************************
+ *                                  Macros
+ *****************************************************************************/
+
+/*
+ * Device Presence:
+ * ----------------
+ * Note that status (_STA) means something different for power resources
+ * (they're assumed to always be present).
+ */
+#define BM_DEVICE_PRESENT(d)	((d->id.type!=BM_TYPE_POWER_RESOURCE)?(d->status & BM_STATUS_PRESENT):TRUE)
+#define BM_NODE_PRESENT(n)	((n->device.id.type!=BM_TYPE_POWER_RESOURCE)?(n->device.status & BM_STATUS_PRESENT):TRUE)
+
+/*
+ * Device Flags:
+ * -------------
+ */
+#define BM_IS_DRIVER_CONTROL(d)	(d->flags & BM_FLAGS_DRIVER_CONTROL)
+#define BM_IS_POWER_CONTROL(d)	(d->flags & BM_FLAGS_POWER_CONTROL)
+
+ /*
+ * Device Power Flags:
+ * -------------------
+ */
+#define BM_IS_POWER_STATE(d)	(d->power.flags & BM_FLAGS_POWER_STATE)
+
+/*****************************************************************************
+ *                             Function Prototypes
+ *****************************************************************************/
+
+/* bm.c */
+
+ACPI_STATUS
+bm_initialize (void);
+
+ACPI_STATUS
+bm_terminate (void);
+
+ACPI_STATUS
+bm_get_status (
+	BM_DEVICE		*device);
+
+ACPI_STATUS
+bm_get_handle (
+	ACPI_HANDLE             acpi_handle,
+	BM_HANDLE               *device_handle);
+
+ACPI_STATUS
+bm_get_node (
+	BM_HANDLE               device_handle,
+	ACPI_HANDLE             acpi_handle,
+	BM_NODE			**node);
+
+/* bmsearch.c */
+
+ACPI_STATUS
+bm_search(
+	BM_HANDLE               device_handle,
+	BM_DEVICE_ID            *criteria,
+	BM_HANDLE_LIST          *results);
+
+/* bmnotify.c */
+
+void
+bm_notify (
+	ACPI_HANDLE             acpi_handle,
+	u32                     notify_value,
+	void                    *context);
+
+/* bm_request.c */
+
+ACPI_STATUS
+bm_request (
+	BM_REQUEST		*request_info);
+
+/* bmdriver.c */
+
+ACPI_STATUS
+bm_get_device_power_state (
+	BM_HANDLE               device_handle,
+	BM_POWER_STATE		*state);
+
+ACPI_STATUS
+bm_set_device_power_state (
+	BM_HANDLE               device_handle,
+	BM_POWER_STATE		state);
+
+ACPI_STATUS
+bm_get_device_status (
+	BM_HANDLE               device_handle,
+	BM_DEVICE_STATUS        *device_status);
+
+ACPI_STATUS
+bm_get_device_info (
+	BM_HANDLE               device_handle,
+	BM_DEVICE		**device_info);
+
+ACPI_STATUS
+bm_get_device_context (
+	BM_HANDLE               device_handle,
+	BM_DRIVER_CONTEXT	*context);
+
+ACPI_STATUS
+bm_register_driver (
+	BM_DEVICE_ID		*criteria,
+	BM_DRIVER		*driver);
+
+ACPI_STATUS
+bm_unregister_driver (
+	BM_DEVICE_ID		*criteria,
+	BM_DRIVER		*driver);
+
+/* bmpm.c */
+
+ACPI_STATUS
+bm_get_pm_capabilities (
+	BM_NODE			*node);
+
+ACPI_STATUS
+bm_get_power_state (
+	BM_NODE			*node);
+
+ACPI_STATUS
+bm_set_power_state (
+	BM_NODE			*node,
+	BM_POWER_STATE          target_state);
+
+/* bmpower.c */
+
+ACPI_STATUS
+bm_pr_initialize (void);
+
+ACPI_STATUS
+bm_pr_terminate (void);
+	
+/* bmutils.c */
+
+ACPI_STATUS
+bm_cast_buffer (
+	ACPI_BUFFER             *buffer,
+	void                    **pointer,
+	u32                     length);
+
+ACPI_STATUS
+bm_copy_to_buffer (
+	ACPI_BUFFER             *buffer,
+	void                    *data,
+	u32                     length);
+
+ACPI_STATUS
+bm_extract_package_data (
+	ACPI_OBJECT             *package,
+	ACPI_BUFFER             *format,
+	ACPI_BUFFER             *buffer);
+
+ACPI_STATUS
+bm_evaluate_object (
+	ACPI_HANDLE             acpi_handle,
+	ACPI_STRING             pathname,
+	ACPI_OBJECT_LIST        *arguments,
+	ACPI_BUFFER             *buffer);
+
+ACPI_STATUS
+bm_evaluate_simple_integer (
+	ACPI_HANDLE             acpi_handle,
+	ACPI_STRING             pathname,
+	u32                     *data);
+
+ACPI_STATUS
+bm_evaluate_reference_list (
+	ACPI_HANDLE             acpi_handle,
+	ACPI_STRING             pathname,
+	BM_HANDLE_LIST          *reference_list);
+
+/* ACPI Bus Driver OSL */
+
+ACPI_STATUS
+bm_osl_generate_event (
+	BM_HANDLE		device_handle,
+	char			*device_type,
+	char			*device_instance,
+	u32			event_type,
+	u32			event_data);
+
+
+#endif  /* __BM_H__ */
diff -urN linux-2.4.6-pre4/drivers/acpi/ospm/include/bmpower.h linux/drivers/acpi/ospm/include/bmpower.h
--- linux-2.4.6-pre4/drivers/acpi/ospm/include/bmpower.h	Wed Dec 31 16:00:00 1969
+++ linux/drivers/acpi/ospm/include/bmpower.h	Mon Dec  3 22:48:42 2001
@@ -0,0 +1,75 @@
+/*****************************************************************************
+ *
+ * Module name: bmpower.h
+ *   $Revision: 1 $
+ *
+ *****************************************************************************/
+
+/*
+ *  Copyright (C) 2000, 2001 Andrew Grover
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#ifndef __BMPOWER_H__
+#define __BMPOWER_H__
+
+#include "bm.h"
+
+
+/*****************************************************************************
+ *                               Types & Defines
+ *****************************************************************************/
+
+
+/*
+ * BM_POWER_RESOURCE:
+ * ------------------
+ */
+typedef struct
+{
+	BM_HANDLE           device_handle;
+	ACPI_HANDLE         acpi_handle;
+	BM_POWER_STATE      system_level;
+	u32                 resource_order;
+	BM_POWER_STATE      state;
+	u32                 reference_count;
+} BM_POWER_RESOURCE;
+
+
+/*****************************************************************************
+ *                             Function Prototypes
+ *****************************************************************************/
+
+/* bmpower.c */
+
+ACPI_STATUS
+bm_pr_initialize (void);
+
+ACPI_STATUS
+bm_pr_terminate (void);
+
+ACPI_STATUS
+bm_pr_list_get_state (
+	BM_HANDLE_LIST          *resource_list,
+	BM_POWER_STATE          *power_state);
+
+ACPI_STATUS
+bm_pr_list_transition (
+	BM_HANDLE_LIST          *current_list,
+	BM_HANDLE_LIST          *target_list);
+
+
+#endif  /* __BMPOWER_H__ */
diff -urN linux-2.4.6-pre4/drivers/acpi/ospm/include/bn.h linux/drivers/acpi/ospm/include/bn.h
--- linux-2.4.6-pre4/drivers/acpi/ospm/include/bn.h	Wed Dec 31 16:00:00 1969
+++ linux/drivers/acpi/ospm/include/bn.h	Mon Dec  3 22:48:42 2001
@@ -0,0 +1,122 @@
+/******************************************************************************
+ *
+ * Module Name: bn.h
+ *   $Revision: 10 $
+ *
+ *****************************************************************************/
+
+/*
+ *  Copyright (C) 2000, 2001 Andrew Grover
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#ifndef __BN_H__
+#define __BN_H__
+
+#include <actypes.h>
+#include <acexcep.h>
+#include <bm.h>
+
+
+/*****************************************************************************
+ *                            Types & Other Defines
+ *****************************************************************************/
+
+/*
+ * Notifications:
+ * ---------------------
+ */
+#define BN_NOTIFY_STATUS_CHANGE	((BM_NOTIFY) 0x80)
+
+
+/*
+ * Types:
+ * ------
+ */
+#define BN_TYPE_POWER_BUTTON	0x01
+#define BN_TYPE_POWER_BUTTON_FIXED 0x02
+#define BN_TYPE_SLEEP_BUTTON	0x03
+#define BN_TYPE_SLEEP_BUTTON_FIXED 0x04
+#define BN_TYPE_LID_SWITCH	0x05
+
+
+/*
+ * Hardware IDs:
+ * -------------
+ * TBD: Power and Sleep button HIDs also exist in <bm.h>.  Should all
+ *      HIDs (ACPI well-known devices) exist in one place (e.g.
+ *      acpi_hid.h)?
+ */
+#define BN_HID_POWER_BUTTON	"PNP0C0C"
+#define BN_HID_SLEEP_BUTTON	"PNP0C0E"
+#define BN_HID_LID_SWITCH	"PNP0C0D"
+
+
+/*
+ * Device Context:
+ * ---------------
+ */
+typedef struct
+{
+	BM_HANDLE		device_handle;
+	ACPI_HANDLE		acpi_handle;
+	u32			type;
+} BN_CONTEXT;
+
+
+/******************************************************************************
+ *                              Function Prototypes
+ *****************************************************************************/
+
+ACPI_STATUS
+bn_initialize (void);
+
+ACPI_STATUS
+bn_terminate (void);
+
+ACPI_STATUS
+bn_notify_fixed (
+	void			*context);
+
+ACPI_STATUS
+bn_notify (
+	u32			notify_type,
+	u32			device,
+	void			**context);
+
+ACPI_STATUS
+bn_request(
+	BM_REQUEST		*request_info,
+	void			*context);
+
+/* Button OSL */
+
+ACPI_STATUS
+bn_osl_add_device (
+	BN_CONTEXT		*button);
+
+ACPI_STATUS
+bn_osl_remove_device (
+	BN_CONTEXT		*button);
+
+ACPI_STATUS
+bn_osl_generate_event (
+	u32			event,
+	BN_CONTEXT		*button);
+
+
+#endif	/* __BN_H__ */
diff -urN linux-2.4.6-pre4/drivers/acpi/ospm/include/bt.h linux/drivers/acpi/ospm/include/bt.h
--- linux-2.4.6-pre4/drivers/acpi/ospm/include/bt.h	Wed Dec 31 16:00:00 1969
+++ linux/drivers/acpi/ospm/include/bt.h	Mon Dec  3 22:48:42 2001
@@ -0,0 +1,161 @@
+/******************************************************************************
+ *
+ * Module Name: bt.h
+ *   $Revision: 13 $
+ *
+ *****************************************************************************/
+
+/*
+ *  Copyright (C) 2000, 2001 Andrew Grover
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#ifndef __BT_H__
+#define __BT_H__
+
+#include <actypes.h>
+#include <acexcep.h>
+#include <bm.h>
+
+
+/*****************************************************************************
+ *                            Types & Other Defines
+ *****************************************************************************/
+
+/*! [Begin] no source code translation */
+
+#define BT_UNKNOWN		0xFFFFFFFF
+#define BT_POWER_UNITS_DEFAULT	"?"
+#define BT_POWER_UNITS_WATTS	"mW"
+#define BT_POWER_UNITS_AMPS	"mA"
+
+/*! [End] no source code translation */
+
+/*
+ * Battery Notifications:
+ * ----------------------
+ */
+#define BT_NOTIFY_STATUS_CHANGE ((BM_NOTIFY) 0x80)
+#define BT_NOTIFY_INFORMATION_CHANGE ((BM_NOTIFY) 0x81)
+
+
+/*
+ * Hardware IDs:
+ * -------------
+ */
+#define BT_HID_CM_BATTERY	"PNP0C0A"
+
+
+/*
+ * BT_CM_BATTERY_INFO:
+ * -------------------
+ */
+typedef struct
+{
+	u32			power_unit;
+	u32			design_capacity;
+	u32			last_full_capacity;
+	u32			battery_technology;
+	u32			design_voltage;
+	u32			design_capacity_warning;
+	u32			design_capacity_low;
+	u32			battery_capacity_granularity_1;
+	u32			battery_capacity_granularity_2;
+	ACPI_STRING 		model_number;
+	ACPI_STRING 		serial_number;
+	ACPI_STRING 		battery_type;
+	ACPI_STRING 		oem_info;
+} BT_BATTERY_INFO;
+
+
+/*
+ * BT_CM_BATTERY_STATUS:
+ * ---------------------
+ */
+typedef struct
+{
+	u32			state;
+	u32			present_rate;
+	u32			remaining_capacity;
+	u32			present_voltage;
+} BT_BATTERY_STATUS;
+
+
+/*
+ * BT_CONTEXT:
+ * -----------
+ */
+typedef struct
+{
+	BM_HANDLE		device_handle;
+	ACPI_HANDLE 		acpi_handle;
+	char			uid[9];
+	ACPI_STRING 		power_units;
+	BOOLEAN 		is_present;
+} BT_CONTEXT;
+
+
+/*****************************************************************************
+ *                              Function Prototypes
+ *****************************************************************************/
+
+/* bt.c */
+
+ACPI_STATUS
+bt_initialize (void);
+
+ACPI_STATUS
+bt_terminate (void);
+
+ACPI_STATUS
+bt_notify (
+	u32			notify_type,
+	u32			device,
+	void			**context);
+
+ACPI_STATUS
+bt_request(
+	BM_REQUEST		*request_info,
+	void			*context);
+
+ACPI_STATUS
+bt_get_status (
+	BT_CONTEXT		*battery,
+	BT_BATTERY_STATUS	**battery_status);
+
+ACPI_STATUS
+bt_get_info (
+	BT_CONTEXT		*battery,
+	BT_BATTERY_INFO 	**battery_info);
+
+/* Battery OSL */
+
+ACPI_STATUS
+bt_osl_add_device (
+	BT_CONTEXT		*battery);
+
+ACPI_STATUS
+bt_osl_remove_device (
+	BT_CONTEXT		*battery);
+
+ACPI_STATUS
+bt_osl_generate_event (
+	u32			event,
+	BT_CONTEXT		*battery);
+
+
+#endif	/* __BT_H__ */
diff -urN linux-2.4.6-pre4/drivers/acpi/ospm/include/ec.h linux/drivers/acpi/ospm/include/ec.h
--- linux-2.4.6-pre4/drivers/acpi/ospm/include/ec.h	Wed Dec 31 16:00:00 1969
+++ linux/drivers/acpi/ospm/include/ec.h	Mon Dec  3 22:48:42 2001
@@ -0,0 +1,202 @@
+/*****************************************************************************
+ *
+ * Module Name: ec.h
+ *   $Revision: 15 $
+ *
+ *****************************************************************************/
+
+/*
+ *  Copyright (C) 2000, 2001 Andrew Grover
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#ifndef __EC_H__
+#define __EC_H__
+
+#include <linux/spinlock.h>
+#include <asm/semaphore.h>
+#include <actypes.h>
+#include <acexcep.h>
+#include <bm.h>
+
+
+/*****************************************************************************
+ *                            Types & Other Defines
+ *****************************************************************************/
+
+#define EC_DEFAULT_TIMEOUT	1000		/* 1 second */
+#define EC_GPE_UNKNOWN		0xFFFFFFFF
+#define EC_PORT_UNKNOWN		0x00000000
+#define EC_BURST_ENABLE_ACKNOWLEDGE 0x90
+
+
+/*
+ * Commands:
+ * ---------
+ */
+typedef u8			EC_COMMAND;
+
+#define EC_COMMAND_UNKNOWN	((EC_COMMAND) 0x00)
+#define EC_COMMAND_READ		((EC_COMMAND) 0x80)
+#define EC_COMMAND_WRITE	((EC_COMMAND) 0x81)
+#define EC_COMMAND_QUERY	((EC_COMMAND) 0x84)
+
+
+/*
+ * EC_STATUS:
+ * ----------
+ * The encoding of the EC status register is illustrated below.
+ * Note that a set bit (1) indicates the property is TRUE
+ * (e.g. if bit 0 is set then the output buffer is full).
+ * +-+-+-+-+-+-+-+-+
+ * |7|6|5|4|3|2|1|0|
+ * +-+-+-+-+-+-+-+-+
+ *  | | | | | | | |
+ *  | | | | | | | +- Output Buffer Full (OBF)?
+ *  | | | | | | +--- Input Buffer Full (IBF)?
+ *  | | | | | +----- <reserved>
+ *  | | | | +------- data Register is command Byte?
+ *  | | | +--------- Burst Mode Enabled?
+ *  | | +----------- SCI event?
+ *  | +------------- SMI event?
+ *  +--------------- <Reserved>
+ *
+ */
+typedef u8			EC_STATUS;
+
+#define EC_FLAG_OUTPUT_BUFFER	((EC_STATUS) 0x01)
+#define EC_FLAG_INPUT_BUFFER	((EC_STATUS) 0x02)
+#define EC_FLAG_BURST_MODE	((EC_STATUS) 0x10)
+#define EC_FLAG_SCI		((EC_STATUS) 0x20)
+
+
+/*
+ * EC_EVENT:
+ * ---------
+ */
+typedef u8			EC_EVENT;
+
+#define EC_EVENT_UNKNOWN	((EC_EVENT) 0x00)
+#define EC_EVENT_NONE		((EC_EVENT) 0x00)
+#define EC_EVENT_OUTPUT_BUFFER_FULL ((EC_EVENT) 0x01)
+#define EC_EVENT_INPUT_BUFFER_EMPTY ((EC_EVENT) 0x02)
+#define EC_EVENT_SCI		((EC_EVENT) 0x03)
+
+
+/*
+ * Hardware IDs:
+ * -------------
+ */
+#define EC_HID_EC		"PNP0C09"
+
+
+/*
+ * EC_REQUEST:
+ * -----------
+ */
+typedef struct
+{
+	EC_COMMAND              command;
+	u8                      address;
+	u8                      data;
+} EC_REQUEST;
+
+
+/*
+ * Device Context:
+ * ---------------
+ */
+typedef struct
+{
+	BM_HANDLE               device_handle;
+	ACPI_HANDLE             acpi_handle;
+	u32                     gpe_bit;
+	u32			status_port;
+	u32			command_port;
+	u32			data_port;
+	u32			use_global_lock;
+	u8                      query_data;
+	ACPI_HANDLE             mutex;
+} EC_CONTEXT;
+
+
+/*****************************************************************************
+ *                             Function Prototypes
+ *****************************************************************************/
+
+/* ec.c */
+
+ACPI_STATUS
+ec_initialize(void);
+
+ACPI_STATUS
+ec_terminate(void);
+
+ACPI_STATUS
+ec_notify (
+	u32                     notify_type,
+	u32                     device,
+	void                    **context);
+
+ACPI_STATUS
+ec_request(
+	BM_REQUEST              *request_info,
+	void                    *context);
+
+/* ectransx.c */
+
+ACPI_STATUS
+ec_transaction (
+	EC_CONTEXT              *ec,
+	EC_REQUEST              *ec_request);
+
+ACPI_STATUS
+ec_io_read (
+	EC_CONTEXT              *ec,
+	u32         		io_port,
+	u8                      *data,
+	EC_EVENT                wait_event);
+
+ACPI_STATUS
+ec_io_write (
+	EC_CONTEXT              *ec,
+	u32         		io_port,
+	u8                      data,
+	EC_EVENT                wait_event);
+
+/* ecgpe.c */
+
+ACPI_STATUS
+ec_install_gpe_handler (
+	EC_CONTEXT              *ec);
+
+ACPI_STATUS
+ec_remove_gpe_handler (
+	EC_CONTEXT              *ec);
+
+/* ecspace.c */
+
+ACPI_STATUS
+ec_install_space_handler (
+	EC_CONTEXT              *ec);
+
+ACPI_STATUS
+ec_remove_space_handler (
+	EC_CONTEXT              *ec);
+
+
+#endif  /* __EC_H__ */
diff -urN linux-2.4.6-pre4/drivers/acpi/ospm/include/pr.h linux/drivers/acpi/ospm/include/pr.h
--- linux-2.4.6-pre4/drivers/acpi/ospm/include/pr.h	Wed Dec 31 16:00:00 1969
+++ linux/drivers/acpi/ospm/include/pr.h	Mon Dec  3 22:48:42 2001
@@ -0,0 +1,265 @@
+/******************************************************************************
+ *
+ * Module Name: processor.h
+ *              $Revision: 9 $
+ *
+ *****************************************************************************/
+
+/*
+ *  Copyright (C) 2000, 2001 Andrew Grover
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#ifndef __PR_H__
+#define __PR_H__
+
+#include <bm.h>
+
+
+/*****************************************************************************
+ *                             Types & Other Defines
+ *****************************************************************************/
+
+
+#define PR_MAX_POWER_STATES	4
+#define PR_MAX_THROTTLE_STATES  8
+#define PR_MAX_PERF_STATES	32
+#define PR_MAX_C2_LATENCY	100
+#define PR_MAX_C3_LATENCY	1000
+
+
+/*
+ * Commands:
+ * ---------
+ */
+#define PR_COMMAND_GET_POWER_INFO ((BM_COMMAND) 0x80)
+#define PR_COMMAND_SET_POWER_INFO ((BM_COMMAND) 0x81)
+#define PR_COMMAND_GET_PERF_INFO ((BM_COMMAND) 0x82)
+#define PR_COMMAND_GET_PERF_STATE ((BM_COMMAND) 0x83)
+#define PR_COMMAND_SET_PERF_LIMIT ((BM_COMMAND) 0x84)
+
+
+/*
+ * Notifications:
+ * --------------
+ */
+#define PR_NOTIFY_PERF_STATES	((BM_NOTIFY) 0x80)
+#define PR_NOTIFY_POWER_STATES	((BM_NOTIFY) 0x81)
+
+
+/*
+ * Performance Control:
+ * --------------------
+ */
+#define PR_PERF_DEC		0x00
+#define PR_PERF_INC		0x01
+#define PR_PERF_MAX		0xFF
+
+
+/*
+ * Power States:
+ * -------------
+ */
+#define PR_C0			0x00
+#define PR_C1			0x01
+#define PR_C2			0x02
+#define PR_C3			0x03
+
+#define PR_C1_FLAG		0x01;
+#define PR_C2_FLAG		0x02;
+#define PR_C3_FLAG		0x04;
+
+
+/*
+ * PR_CX_POLICY_VALUES:
+ * --------------------
+ */
+typedef struct
+{
+	u32			time_threshold;
+	u32			count_threshold;
+	u32                     bm_threshold;
+	u32         		target_state;
+	u32			count;
+} PR_CX_POLICY_VALUES;
+
+
+/*
+ * PR_CX:
+ * ------
+ */
+typedef struct
+{
+	u32                     latency;
+	u32                     utilization;
+	u8                      is_valid;
+	PR_CX_POLICY_VALUES     promotion;
+	PR_CX_POLICY_VALUES     demotion;
+} PR_CX;
+
+
+/*
+ * PR_POWER:
+ * ---------
+ */
+typedef struct
+{
+	ACPI_PHYSICAL_ADDRESS   p_lvl2;
+	ACPI_PHYSICAL_ADDRESS   p_lvl3;
+	u32                     bm_activity;
+	u32                     active_state;
+	u32			default_state;
+	u32			busy_metric;
+	u32                     state_count;
+	PR_CX                   state[PR_MAX_POWER_STATES];
+} PR_POWER;
+
+
+/*
+ * PR_PERFORMANCE_STATE:
+ * ---------------------
+ */
+typedef struct
+{
+	u32                     performance;
+	u32                     power;
+} PR_PERFORMANCE_STATE;
+
+
+/*
+ * PR_PERFORMANCE:
+ * ---------------
+ */
+typedef struct
+{
+	u32                     active_state;
+	u32			thermal_limit;
+	u32			power_limit;
+	u32                     state_count;
+	PR_PERFORMANCE_STATE    state[PR_MAX_PERF_STATES];
+} PR_PERFORMANCE;
+
+
+/*
+ * PR_PBLOCK:
+ * ----------
+ */
+typedef struct
+{
+	u32                     length;
+	ACPI_PHYSICAL_ADDRESS   address;
+} PR_PBLOCK;
+
+
+/*
+ * PR_CONTEXT:
+ * -----------
+ */
+typedef struct
+{
+	BM_HANDLE               device_handle;
+	ACPI_HANDLE             acpi_handle;
+	u32                     uid;
+	PR_PBLOCK               pblk;
+	PR_POWER		power;
+	PR_PERFORMANCE		performance;
+} PR_CONTEXT;
+
+
+/******************************************************************************
+ *                             Function Prototypes
+ *****************************************************************************/
+
+/* processor.c */
+
+ACPI_STATUS
+pr_initialize(void);
+
+ACPI_STATUS
+pr_terminate(void);
+
+ACPI_STATUS
+pr_notify (
+	BM_NOTIFY               notify_type,
+	BM_HANDLE               device_handle,
+	void                    **context);
+
+ACPI_STATUS
+pr_request(
+	BM_REQUEST		*request,
+	void                    *context);
+
+/* prpower.c */
+
+void
+pr_power_idle (void);
+
+ACPI_STATUS
+pr_power_add_device (
+	PR_CONTEXT              *processor);
+
+ACPI_STATUS
+pr_power_remove_device (
+	PR_CONTEXT              *processor);
+
+ACPI_STATUS
+pr_power_initialize (void);
+
+ACPI_STATUS
+pr_power_terminate (void);
+
+/* prperf.c */
+
+ACPI_STATUS
+pr_perf_get_state (
+	PR_CONTEXT              *processor,
+	u32                     *state);
+
+ACPI_STATUS
+pr_perf_set_state (
+	PR_CONTEXT              *processor,
+	u32                     state);
+
+ACPI_STATUS
+pr_perf_set_limit (
+	PR_CONTEXT              *processor,
+	u32                     limit);
+
+ACPI_STATUS
+pr_perf_add_device (
+	PR_CONTEXT              *processor);
+
+ACPI_STATUS
+pr_perf_remove_device (
+	PR_CONTEXT              *processor);
+
+/* Processor Driver OSL */
+
+ACPI_STATUS
+pr_osl_add_device (
+	PR_CONTEXT		*processor);
+
+ACPI_STATUS
+pr_osl_remove_device (
+	PR_CONTEXT		*processor);
+
+ACPI_STATUS
+pr_osl_generate_event (
+	u32			event,
+	PR_CONTEXT		*processor);
+
+
+#endif  /* __PR_H__ */
diff -urN linux-2.4.6-pre4/drivers/acpi/ospm/include/sm.h linux/drivers/acpi/ospm/include/sm.h
--- linux-2.4.6-pre4/drivers/acpi/ospm/include/sm.h	Wed Dec 31 16:00:00 1969
+++ linux/drivers/acpi/ospm/include/sm.h	Mon Dec  3 22:48:42 2001
@@ -0,0 +1,91 @@
+/*****************************************************************************
+ *
+ * Module Name: sm.h
+ *   $Revision: 3 $
+ *
+ *****************************************************************************/
+
+/*
+ *  Copyright (C) 2000, 2001 Andrew Grover
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#ifndef __SM_H__
+#define __SM_H__
+
+#include <actypes.h>
+#include <acexcep.h>
+#include <bm.h>
+
+
+/*****************************************************************************
+ *                            Types & Other Defines
+ *****************************************************************************/
+
+#define SM_MAX_SYSTEM_STATES	6	/* S0-S5 */
+
+
+ /*
+ * Device Context:
+ * ---------------
+ */
+typedef struct
+{
+	BM_HANDLE		device_handle;
+	ACPI_HANDLE 		acpi_handle;
+	u8			states[SM_MAX_SYSTEM_STATES];
+} SM_CONTEXT;
+
+
+/*****************************************************************************
+ *                              Function Prototypes
+ *****************************************************************************/
+
+ACPI_STATUS
+sm_initialize (void);
+
+ACPI_STATUS
+sm_terminate (void);
+
+ACPI_STATUS
+sm_notify (
+	u32			notify_type,
+	u32 			device,
+	void			**context);
+
+ACPI_STATUS
+sm_request(
+	BM_REQUEST		*request_info,
+	void			*context);
+
+/* System Driver OSL */
+
+ACPI_STATUS
+sm_osl_add_device (
+	SM_CONTEXT		*system);
+
+ACPI_STATUS
+sm_osl_remove_device (
+	SM_CONTEXT		*system);
+
+ACPI_STATUS
+sm_osl_generate_event (
+	u32			event,
+	SM_CONTEXT		*system);
+
+
+#endif	/* __SM_H__ */
diff -urN linux-2.4.6-pre4/drivers/acpi/ospm/include/tz.h linux/drivers/acpi/ospm/include/tz.h
--- linux-2.4.6-pre4/drivers/acpi/ospm/include/tz.h	Wed Dec 31 16:00:00 1969
+++ linux/drivers/acpi/ospm/include/tz.h	Mon Dec  3 22:48:42 2001
@@ -0,0 +1,279 @@
+/*****************************************************************************
+ *
+ * Module Name: tz.h
+ *   $Revision: 21 $
+ *
+ *****************************************************************************/
+
+/*
+ *  Copyright (C) 2000, 2001 Andrew Grover
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#ifndef __TZ_H__
+#define __TZ_H__
+
+/* TBD: Linux-specific */
+#include <linux/module.h>
+#include <linux/timer.h>
+
+#include <bm.h>
+#include <pr.h>
+
+
+/*****************************************************************************
+ *                             Types & Other Defines
+ *****************************************************************************/
+
+#define TZ_MAX_THRESHOLDS	12	/* _AC0 through _AC9 + _CRT + _PSV */
+#define TZ_MAX_ACTIVE_THRESHOLDS 10	/* _AC0 through _AC9 */
+#define TZ_MAX_COOLING_DEVICES	10	/* TBD: Make size dynamic */
+
+
+/*
+ * Notifications:
+ * --------------
+ */
+#define TZ_NOTIFY_TEMPERATURE_CHANGE ((BM_NOTIFY) 0x80)
+#define TZ_NOTIFY_THRESHOLD_CHANGE ((BM_NOTIFY) 0x81)
+#define TZ_NOTIFY_DEVICE_LISTS_CHANGE ((BM_NOTIFY) 0x82)
+
+
+/*
+ * TZ_THRESHOLD_TYPE:
+ * ------------------
+ */
+typedef u32			TZ_THRESHOLD_TYPE;
+
+#define TZ_THRESHOLD_UNKNOWN	((TZ_THRESHOLD_TYPE) 0x00)
+#define TZ_THRESHOLD_CRITICAL	((TZ_THRESHOLD_TYPE) 0x01)
+
+#define TZ_THRESHOLD_PASSIVE	((TZ_THRESHOLD_TYPE) 0x02)
+#define TZ_THRESHOLD_ACTIVE	((TZ_THRESHOLD_TYPE) 0x03)
+
+
+/*
+ * TZ_COOLING_STATE:
+ * -----------------
+ */
+typedef u32			TZ_COOLING_STATE;
+
+#define TZ_COOLING_UNKNOWN	((TZ_COOLING_STATE) 0x00)
+#define TZ_COOLING_ENABLED	((TZ_COOLING_STATE) 0x01)
+#define TZ_COOLING_DISABLED	((TZ_COOLING_STATE) 0x02)
+
+
+/*
+ * TZ_COOLING_MODE:
+ * ----------------
+ */
+typedef u32			TZ_COOLING_MODE;
+
+#define TZ_COOLING_MODE_ACTIVE	((TZ_COOLING_MODE) 0x00)
+#define TZ_COOLING_MODE_PASSIVE	((TZ_COOLING_MODE) 0x01)
+
+
+/*
+ * Thermal State:
+ * --------------
+ * The encoding of TZ_STATE is illustrated below.
+ * Note that a set bit (1) indicates the property is TRUE
+ * (e.g. if bit 0 is set then the device has dynamic status).
+ * No bits set indicates an OK cooling state.
+ * +--+--+--+-----------+----------+
+ * |31|30|29| Bits 27:4 | Bits 3:0 |
+ * +--+--+--+-----------+----------+
+ *  |  |  |       |          |
+ *  |  |  |       |          +------ Active Index
+ *  |  |  |       +----------------- <reserved>
+ *  |  |  +------------------------- Active
+ *  |  +---------------------------- Passive
+ *  +------------------------------- Critical
+ *
+ * Active Index:    Value representing the level of active cooling
+ *                  presently applied (e.g. 0=_AL0, 9=_AL9).  Only
+ *                  valid when 'Active' is set.
+ * Active:          If set, indicates that the system temperature
+ *                  has crossed at least one active threshold (_ALx).
+ * Passive:         If set, indicates that the system temperature
+ *                  has crossed the passive threshold (_PSL).
+ * Passive:         If set, indicates that the system temperature
+ *                  has crossed the critical threshold (_CRT).
+ */
+typedef u32			TZ_STATE;
+
+#define TZ_STATE_OK		((TZ_STATE) 0x00000000)
+#define TZ_STATE_ACTIVE		((TZ_STATE) 0x20000000)
+#define TZ_STATE_PASSIVE	((TZ_STATE) 0x40000000)
+#define TZ_STATE_CRITICAL	((TZ_STATE) 0x80000000)
+
+
+/*
+ * TZ_THRESHOLD:
+ * -------------
+ * Information on an individual threshold.
+ */
+typedef struct {
+	TZ_THRESHOLD_TYPE	type;
+	u32			index;
+	u32			temperature;
+	TZ_COOLING_STATE	cooling_state;
+	BM_HANDLE_LIST		cooling_devices;
+} TZ_THRESHOLD;
+
+
+/*
+ * TZ_THRESHOLD_LIST:
+ * ------------------
+ * Container for the thresholds of a given thermal zone.
+ * Note that thresholds are always ordered by increasing
+ * temperature value to simplify use by thermal policy.
+ */
+typedef struct {
+	u32			count;
+	TZ_THRESHOLD		thresholds[TZ_MAX_THRESHOLDS];
+} TZ_THRESHOLD_LIST;
+
+
+/*
+ * TZ_CRITICAL_POLICY:
+ * -------------------
+ */
+typedef struct {
+	TZ_THRESHOLD		*threshold;
+} TZ_CRITICAL_POLICY;
+
+
+/*
+ * TZ_PASSIVE_POLICY:
+ * ------------------
+ */
+typedef struct {
+	u32			tc1;
+	u32			tc2;
+	u32			tsp;
+	TZ_THRESHOLD		*threshold;
+} TZ_PASSIVE_POLICY;
+
+
+/*
+ * TZ_ACTIVE_POLICY:
+ * -----------------
+ */
+typedef struct {
+	u32			threshold_count;
+	TZ_THRESHOLD		*threshold[TZ_MAX_ACTIVE_THRESHOLDS];
+} TZ_ACTIVE_POLICY;
+
+
+/*
+ * TZ_POLICY:
+ * ---------
+ */
+typedef struct {
+	u32			temperature;
+	TZ_STATE		state;
+	TZ_COOLING_MODE		cooling_mode;
+	u32			polling_freq;
+	TZ_THRESHOLD_LIST	threshold_list;
+	TZ_CRITICAL_POLICY	critical;
+	TZ_PASSIVE_POLICY	passive;
+	TZ_ACTIVE_POLICY	active;
+	/* TBD: Linux-specific */
+	struct timer_list	timer;
+} TZ_POLICY;
+
+
+/*
+ * TZ_CONTEXT:
+ * -----------
+ */
+typedef struct {
+	BM_HANDLE		device_handle;
+	ACPI_HANDLE		acpi_handle;
+	char			uid[9];
+	TZ_POLICY		policy;
+} TZ_CONTEXT;
+
+
+/*****************************************************************************
+ *                             Function Prototypes
+ *****************************************************************************/
+
+/* thermal_zone.c */
+
+ACPI_STATUS
+tz_initialize (void);
+
+ACPI_STATUS
+tz_terminate (void);
+
+ACPI_STATUS
+tz_notify (
+	BM_NOTIFY               notify_type,
+	BM_HANDLE               device_handle,
+	BM_DRIVER_CONTEXT	*context);
+
+ACPI_STATUS
+tz_request (
+	BM_REQUEST              *request,
+	BM_DRIVER_CONTEXT	context);
+
+ACPI_STATUS
+tz_get_temperature (
+	TZ_CONTEXT              *thermal_zone,
+	u32                     *temperature);
+
+ACPI_STATUS
+tz_get_thresholds (
+	TZ_CONTEXT              *thermal_zone,
+	TZ_THRESHOLD_LIST       *threshold_list);
+
+void
+tz_print (
+	TZ_CONTEXT              *thermal_zone);
+
+/* tzpolicy.c */
+
+ACPI_STATUS
+tz_policy_add_device (
+	TZ_CONTEXT              *thermal_zone);
+
+ACPI_STATUS
+tz_policy_remove_device (
+	TZ_CONTEXT              *thermal_zone);
+
+void
+tz_policy_check (
+	void                    *context);
+
+/* Thermal Zone Driver OSL */
+
+ACPI_STATUS
+tz_osl_add_device (
+	TZ_CONTEXT		*thermal_zone);
+
+ACPI_STATUS
+tz_osl_remove_device (
+	TZ_CONTEXT		*thermal_zone);
+
+ACPI_STATUS
+tz_osl_generate_event (
+	u32			event,
+	TZ_CONTEXT		*thermal_zone);
+
+
+#endif  /* __TZ_H__ */
diff -urN linux-2.4.6-pre4/drivers/acpi/ospm/processor/Makefile linux/drivers/acpi/ospm/processor/Makefile
--- linux-2.4.6-pre4/drivers/acpi/ospm/processor/Makefile	Wed Dec 31 16:00:00 1969
+++ linux/drivers/acpi/ospm/processor/Makefile	Mon Dec  3 22:48:42 2001
@@ -0,0 +1,6 @@
+O_TARGET	:= ospm_$(notdir $(CURDIR)).o
+obj-m		:= $(O_TARGET)
+EXTRA_CFLAGS	+= $(ACPI_CFLAGS)
+obj-y		:= $(patsubst %.c,%.o,$(wildcard *.c))
+
+include $(TOPDIR)/Rules.make
diff -urN linux-2.4.6-pre4/drivers/acpi/ospm/processor/pr.c linux/drivers/acpi/ospm/processor/pr.c
--- linux-2.4.6-pre4/drivers/acpi/ospm/processor/pr.c	Wed Dec 31 16:00:00 1969
+++ linux/drivers/acpi/ospm/processor/pr.c	Mon Dec  3 22:48:42 2001
@@ -0,0 +1,454 @@
+/*****************************************************************************
+ *
+ * Module Name: pr.c
+ *   $Revision: 30 $
+ *
+ *****************************************************************************/
+
+/*
+ *  Copyright (C) 2000, 2001 Andrew Grover
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#include <acpi.h>
+#include <bm.h>
+#include "pr.h"
+
+
+#define _COMPONENT		ACPI_PROCESSOR
+	MODULE_NAME		("pr")
+
+
+/****************************************************************************
+ *                                  Globals
+ ****************************************************************************/
+
+extern FADT_DESCRIPTOR_REV2	acpi_fadt;
+
+
+/****************************************************************************
+ *                             Internal Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ *
+ * FUNCTION:    pr_print
+ *
+ * PARAMETERS:
+ *
+ * RETURN:
+ *
+ * DESCRIPTION: Prints out information on a specific thermal zone.
+ *
+ ****************************************************************************/
+
+void
+pr_print (
+	PR_CONTEXT              *processor)
+{
+
+	return;
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:    pr_add_device
+ *
+ * PARAMETERS:  <none>
+ *
+ * RETURN:	
+ *
+ * DESCRIPTION:
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+pr_add_device(
+	BM_HANDLE		device_handle,
+	void			**context)
+{
+	ACPI_STATUS		status = AE_OK;
+	PR_CONTEXT		*processor = NULL;
+	BM_DEVICE		*device = NULL;
+	ACPI_BUFFER		buffer;
+	ACPI_OBJECT		acpi_object;
+	static u32		processor_count = 0;
+
+
+	if (!context || *context) {
+		return(AE_BAD_PARAMETER);
+	}
+
+	status = bm_get_device_info(device_handle, &device);
+	if (ACPI_FAILURE(status)) {
+		return(status);
+	}
+
+	processor = acpi_os_callocate(sizeof(PR_CONTEXT));
+	if (!processor) {
+		return AE_NO_MEMORY;
+	}
+
+	processor->device_handle = device->handle;
+	processor->acpi_handle = device->acpi_handle;
+
+	/*
+	 * Processor Block:
+	 * ----------------
+	 */
+	MEMSET(&acpi_object, 0, sizeof(ACPI_OBJECT));
+
+	buffer.length = sizeof(ACPI_OBJECT);
+	buffer.pointer = &acpi_object;
+
+	status = acpi_evaluate_object(processor->acpi_handle, NULL, NULL, &buffer);
+	if (ACPI_FAILURE(status)) {
+		goto end;
+	}
+
+	/*
+	 * Processor ID:
+	 * -------------
+	 * TBD:  We need to synchronize the processor ID values in ACPI
+	 *       with those of the APIC.  For example, an IBM T20 has a
+	 *       proc_id value of '1', where the Linux value for the
+	 *       first CPU on this system is '0'.  Since x86 CPUs are
+	 *       mapped 1:1 we can simply use a zero-based counter.  Note
+	 *       that this assumes that processor objects are enumerated
+	 *       in the proper order.
+	 */
+	/* processor->uid = acpi_object.processor.proc_id; */
+	processor->uid = processor_count++;
+
+	processor->pblk.length = acpi_object.processor.pblk_length;
+	processor->pblk.address = acpi_object.processor.pblk_address;
+
+	status = pr_power_add_device(processor);
+	if (ACPI_FAILURE(status)) {
+		goto end;
+	}
+
+	status = pr_perf_add_device(processor);
+	if (ACPI_FAILURE(status)) {
+		goto end;
+	}
+
+	status = pr_osl_add_device(processor);
+	if (ACPI_FAILURE(status)) {
+		goto end;
+	}
+
+	*context = processor;
+
+	pr_print(processor);
+
+end:
+	if (ACPI_FAILURE(status)) {
+		acpi_os_free(processor);
+	}
+
+	return(status);
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:    pr_remove_device
+ *
+ * PARAMETERS:  <none>
+ *
+ * RETURN:	
+ *
+ * DESCRIPTION:
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+pr_remove_device (
+	void			**context)
+{
+	ACPI_STATUS		status = AE_OK;
+	PR_CONTEXT		*processor= NULL;
+
+	if (!context || !*context) {
+		return(AE_BAD_PARAMETER);
+	}
+
+	processor = (PR_CONTEXT*)(*context);
+
+	pr_osl_remove_device(processor);
+
+	pr_perf_remove_device(processor);
+
+	pr_power_remove_device(processor);
+
+	acpi_os_free(processor);
+
+	return(status);
+}
+
+
+/****************************************************************************
+ *                            External Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ *
+ * FUNCTION:    pr_initialize
+ *
+ * PARAMETERS:  <none>
+ *
+ * RETURN:
+ *
+ * DESCRIPTION:
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+pr_initialize (void)
+{
+	ACPI_STATUS		status = AE_OK;
+	BM_DEVICE_ID		criteria;
+	BM_DRIVER		driver;
+
+	MEMSET(&criteria, 0, sizeof(BM_DEVICE_ID));
+	MEMSET(&driver, 0, sizeof(BM_DRIVER));
+
+	/*
+	 * Initialize power (Cx state) policy.
+	 */
+	status = pr_power_initialize();
+	if (ACPI_FAILURE(status)) {
+		return(status);
+	}
+
+	/*
+	 * Register driver for processor devices.
+	 */
+	criteria.type = BM_TYPE_PROCESSOR;
+
+	driver.notify = &pr_notify;
+	driver.request = &pr_request;
+
+	status = bm_register_driver(&criteria, &driver);
+
+	return(status);
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:    pr_terminate
+ *
+ * PARAMETERS:  <none>
+ *
+ * RETURN:
+ *
+ * DESCRIPTION:
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+pr_terminate (void)
+{
+	ACPI_STATUS             status = AE_OK;
+	BM_DEVICE_ID		criteria;
+	BM_DRIVER		driver;
+
+	MEMSET(&criteria, 0, sizeof(BM_DEVICE_ID));
+	MEMSET(&driver, 0, sizeof(BM_DRIVER));
+
+	/*
+	 * Terminate power (Cx state) policy.
+	 */
+	status = pr_power_terminate();
+	if (ACPI_FAILURE(status)) {
+		return(status);
+	}
+
+	/*
+	 * Unegister driver for processor devices.
+	 */
+	criteria.type = BM_TYPE_PROCESSOR;
+
+	driver.notify = &pr_notify;
+	driver.request = &pr_request;
+
+	status = bm_unregister_driver(&criteria, &driver);
+
+	return(status);
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:    pr_notify
+ *
+ * PARAMETERS:
+ *
+ * RETURN:
+ *
+ * DESCRIPTION:
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+pr_notify (
+	BM_NOTIFY		notify_type,
+	BM_HANDLE		device_handle,
+	void			**context)
+{
+	ACPI_STATUS		status = AE_OK;
+	PR_CONTEXT		*processor = NULL;
+
+	processor = (PR_CONTEXT*)*context;
+
+	switch (notify_type) {
+
+	case BM_NOTIFY_DEVICE_ADDED:
+		status = pr_add_device(device_handle, context);
+		break;
+
+	case BM_NOTIFY_DEVICE_REMOVED:
+		status = pr_remove_device(context);
+		break;
+
+	case PR_NOTIFY_PERF_STATES:
+		/* TBD: Streamline (this is simple but overkill). */
+		status = pr_perf_remove_device(processor);
+		if (ACPI_SUCCESS(status)) {
+			status = pr_perf_add_device(processor);
+		}
+		if (ACPI_SUCCESS(status)) {
+			status = pr_osl_generate_event(notify_type,
+				(processor));
+		}
+		break;
+
+	case PR_NOTIFY_POWER_STATES:
+		/* TBD: Streamline (this is simple but overkill). */
+		status = pr_power_remove_device(processor);
+		if (ACPI_SUCCESS(status)) {
+			status = pr_power_add_device(processor);
+		}
+		if (ACPI_SUCCESS(status)) {
+			status = pr_osl_generate_event(notify_type,
+				(processor));
+		}
+		break;
+
+	default:
+		status = AE_SUPPORT;
+		break;
+	}
+
+	return(status);
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:    pr_request
+ *
+ * PARAMETERS:
+ *
+ * RETURN:
+ *
+ * DESCRIPTION:
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+pr_request (
+	BM_REQUEST		*request,
+	void			*context)
+{
+	ACPI_STATUS		status = AE_OK;
+	PR_CONTEXT		*processor = NULL;
+
+	/*
+	 * Must have a valid request structure and context.
+	 */
+	if (!request || !context) {
+		return(AE_BAD_PARAMETER);
+	}
+
+	processor = (PR_CONTEXT*)context;
+
+	/*
+	 * Handle request:
+	 * ---------------
+	 */
+	switch (request->command) {
+
+	case PR_COMMAND_GET_POWER_INFO:
+		status = bm_copy_to_buffer(&(request->buffer),
+			&(processor->power), sizeof(PR_POWER));
+		break;
+
+	case PR_COMMAND_SET_POWER_INFO:
+	 {
+		PR_POWER *power_info = NULL;
+		u32 i = 0;
+
+		status = bm_cast_buffer(&(request->buffer),
+			(void**)&power_info, sizeof(PR_POWER));
+		if (ACPI_SUCCESS(status)) {
+			for (i=0; i<processor->power.state_count; i++) {
+				MEMCPY(&(processor->power.state[i].promotion),
+					&(power_info->state[i].promotion),
+					sizeof(PR_CX_POLICY_VALUES));
+				MEMCPY(&(processor->power.state[i].demotion),
+					&(power_info->state[i].demotion),
+					sizeof(PR_CX_POLICY_VALUES));
+			}
+		}
+	}
+		break;
+
+	case PR_COMMAND_GET_PERF_INFO:
+		status = bm_copy_to_buffer(&(request->buffer),
+			&(processor->performance), sizeof(PR_PERFORMANCE));
+		break;
+
+	case PR_COMMAND_GET_PERF_STATE:
+		status = bm_copy_to_buffer(&(request->buffer),
+			&(processor->performance.active_state), sizeof(u32));
+		break;
+
+	case PR_COMMAND_SET_PERF_LIMIT:
+	 {
+		u32 *limit = NULL;
+
+		status = bm_cast_buffer(&(request->buffer),
+			(void**)&limit, sizeof(u32));
+		if (ACPI_SUCCESS(status)) {
+			status = pr_perf_set_limit(processor, *limit);
+		}
+	}
+		break;
+
+	default:
+		status = AE_SUPPORT;
+		break;
+	}
+
+	request->status = status;
+
+	return(status);
+}
diff -urN linux-2.4.6-pre4/drivers/acpi/ospm/processor/pr_osl.c linux/drivers/acpi/ospm/processor/pr_osl.c
--- linux-2.4.6-pre4/drivers/acpi/ospm/processor/pr_osl.c	Wed Dec 31 16:00:00 1969
+++ linux/drivers/acpi/ospm/processor/pr_osl.c	Mon Dec  3 22:48:42 2001
@@ -0,0 +1,305 @@
+/******************************************************************************
+ *
+ * Module Name: pr_osl.c
+ *   $Revision: 14 $
+ *
+ *****************************************************************************/
+
+/*
+ *  Copyright (C) 2000, 2001 Andrew Grover
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/types.h>
+#include <linux/proc_fs.h>
+#include <acpi.h>
+#include <bm.h>
+#include "pr.h"
+
+
+MODULE_AUTHOR("Andrew Grover");
+MODULE_DESCRIPTION("ACPI Component Architecture (CA) - IA32 Processor Driver");
+
+
+#define PR_PROC_ROOT		"processor"
+#define PR_PROC_STATUS		"status"
+#define PR_PROC_INFO		"info"
+
+extern struct proc_dir_entry	*bm_proc_root;
+static struct proc_dir_entry	*pr_proc_root = NULL;
+
+
+/****************************************************************************
+ * 
+ * FUNCTION:	pr_osl_proc_read_status
+ *
+ ****************************************************************************/
+
+static int
+pr_osl_proc_read_status (
+	char			*page, 
+	char			**start, 
+	off_t			off, 
+	int 			count, 
+	int 			*eof, 
+	void			*context)
+{
+	PR_CONTEXT		*processor = NULL;
+	char			*p = page;
+	int 			len = 0;
+
+	if (!context || (off != 0)) {
+		goto end;
+	}
+
+	processor = (PR_CONTEXT*)context;
+
+	p += sprintf(p, "Bus Mastering Activity:  %08x\n", 
+		processor->power.bm_activity);
+
+	p += sprintf(p, "C-State Utilization:     C1[%d] C2[%d] C3[%d]\n", 
+		processor->power.state[PR_C1].utilization,
+		processor->power.state[PR_C2].utilization,
+		processor->power.state[PR_C3].utilization);
+
+end:
+	len = (p - page);
+	if (len <= off+count) *eof = 1;
+	*start = page + off;
+	len -= off;
+	if (len>count) len = count;
+	if (len<0) len = 0;
+
+	return(len);
+}
+
+
+/****************************************************************************
+ * 
+ * FUNCTION:	pr_osl_proc_read_info
+ *
+ ****************************************************************************/
+
+static int
+pr_osl_proc_read_info (
+	char			*page, 
+	char			**start, 
+	off_t			off, 
+	int 			count, 
+	int 			*eof, 
+	void			*context)
+{
+	PR_CONTEXT		*processor = NULL;
+	char			*p = page;
+	int 			len = 0;
+
+	if (!context || (off != 0)) {
+		goto end;
+	}
+
+	processor = (PR_CONTEXT*)context;
+
+	p += sprintf(p, "<TBD>\n");
+
+end:
+	len = (p - page);
+	if (len <= off+count) *eof = 1;
+	*start = page + off;
+	len -= off;
+	if (len>count) len = count;
+	if (len<0) len = 0;
+
+	return(len);
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:	pr_osl_add_device
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+pr_osl_add_device(
+	PR_CONTEXT		*processor)
+{
+	u32			i = 0;
+	struct proc_dir_entry	*proc_entry = NULL;
+	char			processor_uid[16];
+
+	if (!processor) {
+		return(AE_BAD_PARAMETER);
+	}
+
+	printk("Processor[%x]:", processor->uid);
+	for (i=0; i<processor->power.state_count; i++) {
+		if (processor->power.state[i].is_valid) {
+			printk(" C%d", i);
+		}
+	}
+
+	if (processor->performance.state_count > 1) {
+		printk(", throttling states: %d", processor->performance.state_count);
+	}
+
+	printk("\n");
+
+	sprintf(processor_uid, "%d", processor->uid);
+
+	proc_entry = proc_mkdir(processor_uid, pr_proc_root);
+	if (!proc_entry) {
+		return(AE_ERROR);
+	}
+
+	create_proc_read_entry(PR_PROC_STATUS, S_IFREG | S_IRUGO, 
+		proc_entry, pr_osl_proc_read_status, (void*)processor);
+
+	create_proc_read_entry(PR_PROC_INFO, S_IFREG | S_IRUGO, 
+		proc_entry, pr_osl_proc_read_info, (void*)processor);
+
+	return(AE_OK);
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:	pr_osl_remove_device
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+pr_osl_remove_device (
+	PR_CONTEXT		*processor)
+{
+	char			proc_entry[64];
+
+	if (!processor) {
+		return(AE_BAD_PARAMETER);
+	}
+
+	sprintf(proc_entry, "%d/%s", processor->uid, PR_PROC_INFO);
+	remove_proc_entry(proc_entry, pr_proc_root);
+
+	sprintf(proc_entry, "%d/%s", processor->uid, PR_PROC_STATUS);
+	remove_proc_entry(proc_entry, pr_proc_root);
+
+	sprintf(proc_entry, "%d", processor->uid);
+	remove_proc_entry(proc_entry, pr_proc_root);
+
+	return(AE_OK);
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:	pr_osl_generate_event
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+pr_osl_generate_event (
+	u32			event,
+	PR_CONTEXT		*processor)
+{
+	ACPI_STATUS		status = AE_OK;
+	char			processor_uid[16];
+
+	if (!processor) {
+		return(AE_BAD_PARAMETER);
+	}
+
+	switch (event) {
+
+	case PR_NOTIFY_PERF_STATES:
+	case PR_NOTIFY_POWER_STATES:
+		sprintf(processor_uid, "%d", processor->uid);
+		status = bm_osl_generate_event(processor->device_handle, 
+			PR_PROC_ROOT, processor_uid, event, 0);
+		break;
+
+	default:
+		return(AE_BAD_PARAMETER);
+		break;
+	}
+
+	return(status);
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:	pr_osl_init
+ *
+ * PARAMETERS:	<none>
+ *
+ * RETURN:	0: Success
+ *
+ * DESCRIPTION: Module initialization.
+ *
+ ****************************************************************************/
+
+static int __init 
+pr_osl_init (void)
+{
+	ACPI_STATUS		status = AE_OK;
+
+	pr_proc_root = proc_mkdir(PR_PROC_ROOT, bm_proc_root);
+	if (!pr_proc_root) {
+		status = AE_ERROR;
+	}
+	else {
+		status = pr_initialize();
+		if (ACPI_FAILURE(status)) {
+			remove_proc_entry(PR_PROC_ROOT, bm_proc_root);
+		}
+
+	}
+
+	return (ACPI_SUCCESS(status)) ? 0 : -ENODEV;
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:    pr_osl_cleanup
+ *
+ * PARAMETERS:	<none>
+ *
+ * RETURN:	<none>
+ *
+ * DESCRIPTION: Module cleanup.
+ *
+ ****************************************************************************/
+
+static void __exit 
+pr_osl_cleanup (void)
+{
+	pr_terminate();
+
+	if (pr_proc_root) {
+		remove_proc_entry(PR_PROC_ROOT, bm_proc_root);
+	}
+
+	return;
+}
+
+
+module_init(pr_osl_init);
+module_exit(pr_osl_cleanup);
diff -urN linux-2.4.6-pre4/drivers/acpi/ospm/processor/prperf.c linux/drivers/acpi/ospm/processor/prperf.c
--- linux-2.4.6-pre4/drivers/acpi/ospm/processor/prperf.c	Wed Dec 31 16:00:00 1969
+++ linux/drivers/acpi/ospm/processor/prperf.c	Mon Dec  3 22:48:42 2001
@@ -0,0 +1,423 @@
+/*****************************************************************************
+ *
+ * Module Name: prperf.c
+ *              $Revision: 16 $
+ *
+ *****************************************************************************/
+
+/*
+ *  Copyright (C) 2000, 2001 Andrew Grover
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+/*
+ * TBD: 1. Support ACPI 2.0 processor performance states (not just throttling).
+ *      2. Fully implement thermal -vs- power management limit control.
+ */
+
+
+#include <acpi.h>
+#include <bm.h>
+#include "pr.h"
+
+#define _COMPONENT		ACPI_PROCESSOR
+	MODULE_NAME		("prperf")
+
+
+/****************************************************************************
+ *                                  Globals
+ ****************************************************************************/
+
+extern FADT_DESCRIPTOR_REV2	acpi_fadt;
+const u32			POWER_OF_2[] = {1,2,4,8,16,32,64,128,256,512};
+
+
+/****************************************************************************
+ *
+ * FUNCTION:    pr_perf_get_frequency
+ *
+ * PARAMETERS:
+ *
+ * RETURN:
+ *
+ * DESCRIPTION:
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+pr_perf_get_frequency (
+	PR_CONTEXT		*processor,
+	u32			*frequency) {
+	ACPI_STATUS		status = AE_OK;
+
+	if (!processor || !frequency) {
+		return(AE_BAD_PARAMETER);
+	}
+
+	/* TBD: Generic method to calculate processor frequency. */
+
+	return(status);
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:    pr_perf_get_state
+ *
+ * PARAMETERS:
+ *
+ * RETURN:	
+ *
+ * DESCRIPTION:
+ *
+ ****************************************************************************/
+
+/* TBD:	Include support for _real_ performance states (not just throttling). */
+
+ACPI_STATUS
+pr_perf_get_state (
+	PR_CONTEXT              *processor,
+	u32                     *state)
+{
+	u32                     pblk_value = 0;
+	u32                     duty_mask = 0;
+	u32                     duty_cycle = 0;
+
+	if (!processor || !state) {
+		return(AE_BAD_PARAMETER);
+	}
+
+	if (processor->performance.state_count == 1) {
+		*state = 0;
+		return(AE_OK);
+	}
+
+	pblk_value = acpi_os_in32(processor->pblk.address);
+
+	/*
+	 * Throttling Enabled?
+	 * -------------------
+	 * If so, calculate the current throttling state, otherwise return
+	 * '100% performance' (state 0).
+	 */
+	if (pblk_value & 0x00000010) {
+
+		duty_mask = processor->performance.state_count - 1;
+		duty_mask <<= acpi_fadt.duty_offset;
+
+		duty_cycle = pblk_value & duty_mask;
+		duty_cycle >>= acpi_fadt.duty_offset;
+
+		if (duty_cycle == 0) {
+			*state = 0;
+		}
+		else {
+			*state = processor->performance.state_count -
+				duty_cycle;
+		}
+	}
+	else {
+		*state = 0;
+	}
+
+	return(AE_OK);
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:    pr_perf_set_state
+ *
+ * PARAMETERS:
+ *
+ * RETURN:      AE_OK
+ *              AE_BAD_PARAMETER
+ *              AE_BAD_DATA         Invalid target throttling state.
+ *
+ * DESCRIPTION:
+ *
+ ****************************************************************************/
+
+/* TBD: Includes support for _real_ performance states (not just throttling). */
+
+ACPI_STATUS
+pr_perf_set_state (
+	PR_CONTEXT              *processor,
+	u32                     state)
+{
+	u32                     pblk_value = 0;
+	u32                     duty_mask = 0;
+	u32                     duty_cycle = 0;
+	u32                     i = 0;
+
+	if (!processor) {
+		return(AE_BAD_PARAMETER);
+	}
+
+	if (state > (processor->performance.state_count - 1)) {
+		return(AE_BAD_DATA);
+	}
+
+	if (processor->performance.state_count == 1) {
+		return(AE_OK);
+	}
+
+	/*
+	 * Calculate Duty Cycle/Mask:
+	 * --------------------------
+	 * Note that we don't support duty_cycle values that span bit 4.
+	 */
+	if (state) {
+		duty_cycle = processor->performance.state_count - state;
+		duty_cycle <<= acpi_fadt.duty_offset;
+	}
+	else {
+		duty_cycle = 0;
+	}
+
+	duty_mask = ~((u32)(processor->performance.state_count - 1));
+	for (i=0; i<acpi_fadt.duty_offset; i++) {
+		duty_mask <<= acpi_fadt.duty_offset;
+		duty_mask += 1;
+	}
+
+	/*
+	 * Disable Throttling:
+	 * -------------------
+	 * Got to turn it off before you can change the duty_cycle value.
+	 * Throttling is disabled by writing a 0 to bit 4.
+	 */
+	pblk_value = acpi_os_in32(processor->pblk.address);
+	if (pblk_value & 0x00000010) {
+		pblk_value &= 0xFFFFFFEF;
+		acpi_os_out32(processor->pblk.address, pblk_value);
+	}
+
+	/*
+	 * Set Duty Cycle:
+	 * ---------------
+	 * Mask off the old duty_cycle value, mask in the new.
+	 */
+	pblk_value &= duty_mask;
+	pblk_value |= duty_cycle;
+	acpi_os_out32(processor->pblk.address, pblk_value);
+
+	/*
+	 * Enable Throttling:
+	 * ------------------
+	 * But only for non-zero (non-100% performance) states.
+	 */
+	if (state) {
+		pblk_value |= 0x00000010;
+		acpi_os_out32(processor->pblk.address, pblk_value);
+	}
+
+	return(AE_OK);
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:    pr_perf_set_limit
+ *
+ * PARAMETERS:
+ *
+ * RETURN:
+ *
+ * DESCRIPTION:
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+pr_perf_set_limit (
+	PR_CONTEXT              *processor,
+	u32                     limit)
+{
+	ACPI_STATUS		status = AE_OK;
+	PR_PERFORMANCE		*performance = NULL;
+
+	if (!processor) {
+		return(AE_BAD_PARAMETER);
+	}
+
+	performance = &(processor->performance);
+
+	/*
+	 * Set Limit:
+	 * ----------
+	 * TBD:  Properly manage thermal and power limits (only set
+	 *	 performance state iff...).
+	 */
+	switch (limit) {
+
+	case PR_PERF_DEC:
+		if (performance->active_state <
+			(performance->state_count-1)) {
+			status = pr_perf_set_state(processor,
+				(performance->active_state-1));
+		}
+		break;
+
+	case PR_PERF_INC:
+		if (performance->active_state > 0) {
+			status = pr_perf_set_state(processor,
+				(performance->active_state+1));
+		}
+		break;
+
+	case PR_PERF_MAX:
+		if (performance->active_state != 0) {
+			status = pr_perf_set_state(processor, 0);
+		}
+		break;
+
+	default:
+		return(AE_BAD_DATA);
+		break;
+	}
+
+	if (ACPI_SUCCESS(status)) {
+		performance->thermal_limit = limit;
+	}
+
+	return(status);
+}
+
+
+/****************************************************************************
+ *                             External Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ *
+ * FUNCTION:    pr_perf_add_device
+ *
+ * PARAMETERS:  processor		Our processor-specific context.
+ *
+ * RETURN:      AE_OK
+ *              AE_BAD_PARAMETER
+ *
+ * DESCRIPTION: Calculates the number of throttling states and the state
+ *              performance/power values.
+ *
+ ****************************************************************************/
+
+/* TBD: Support duty_cycle values that span bit 4. */
+
+ACPI_STATUS
+pr_perf_add_device (
+	PR_CONTEXT              *processor)
+{
+	ACPI_STATUS             status = AE_OK;
+	u32                     i = 0;
+	u32                     performance_step = 0;
+	u32                     percentage = 0;
+
+	if (!processor) {
+		return(AE_BAD_PARAMETER);
+	}
+
+	/*
+	 * Valid PBLK?
+	 * -----------
+	 * For SMP it is common to have the first (boot) processor have a
+	 * valid PBLK while all others do not -- which implies that
+	 * throttling has system-wide effects (duty_cycle programmed into
+	 * the chipset effects all processors).
+	 */
+	if ((processor->pblk.length < 6) || !processor->pblk.address) {
+		processor->performance.state_count = 1;
+	}
+
+	/*
+	 * Valid Duty Offset/Width?
+	 * ------------------------
+	 * We currently only support duty_cycle values that fall within
+	 * bits 0-3, as things get complicated when this value spans bit 4
+	 * (the throttling enable/disable bit).
+	 */
+	else if ((acpi_fadt.duty_offset + acpi_fadt.duty_width) > 4) {
+		processor->performance.state_count = 1;
+	}
+
+	/*
+	 * Compute State Count:
+	 * --------------------
+	 * The number of throttling states is computed as 2^duty_width,
+	 * but limited by PR_MAX_THROTTLE_STATES.  Note that a duty_width
+	 * of zero results is one throttling state (100%).
+	 */
+	else {
+		processor->performance.state_count =
+			POWER_OF_2[acpi_fadt.duty_width];
+	}
+
+	if (processor->performance.state_count > PR_MAX_THROTTLE_STATES) {
+		processor->performance.state_count = PR_MAX_THROTTLE_STATES;
+	}
+
+	/*
+	 * Compute State Values:
+	 * ---------------------
+	 * Note that clock throttling displays a linear power/performance
+	 * relationship (at 50% performance the CPU will consume 50% power).
+	 */
+	performance_step = (1000 / processor->performance.state_count);
+
+	for (i=0; i<processor->performance.state_count; i++) {
+		percentage = (1000 - (performance_step * i))/10;
+		processor->performance.state[i].performance = percentage;
+		processor->performance.state[i].power = percentage;
+	}
+
+	/*
+	 * Get Current State:
+	 * ------------------
+	 */
+	status = pr_perf_get_state(processor,
+		&(processor->performance.active_state));
+
+	return(status);
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:    pr_perf_remove_device
+ *
+ * PARAMETERS:
+ *
+ * RETURN:	
+ *
+ * DESCRIPTION:
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+pr_perf_remove_device (
+	PR_CONTEXT              *processor)
+{
+	ACPI_STATUS             status = AE_OK;
+
+	if (!processor) {
+		return(AE_BAD_PARAMETER);
+	}
+
+	MEMSET(&(processor->performance), 0, sizeof(PR_PERFORMANCE));
+
+	return(status);
+}
+
diff -urN linux-2.4.6-pre4/drivers/acpi/ospm/processor/prpower.c linux/drivers/acpi/ospm/processor/prpower.c
--- linux-2.4.6-pre4/drivers/acpi/ospm/processor/prpower.c	Wed Dec 31 16:00:00 1969
+++ linux/drivers/acpi/ospm/processor/prpower.c	Mon Dec  3 22:48:42 2001
@@ -0,0 +1,640 @@
+/*****************************************************************************
+ *
+ * Module Name: prpower.c
+ *   $Revision: 25 $
+ *
+ *****************************************************************************/
+
+/*
+ *  Copyright (C) 2000, 2001 Andrew Grover
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+/* TBD: Linux specific */
+#include <linux/sched.h>
+#include <linux/pm.h>
+
+#include <acpi.h>
+#include <bm.h>
+#include "pr.h"
+
+#define _COMPONENT		ACPI_PROCESSOR
+	MODULE_NAME		("prpower")
+
+
+/****************************************************************************
+ *                                  Globals
+ ****************************************************************************/
+
+extern FADT_DESCRIPTOR_REV2	acpi_fadt;
+static u32			last_idle_jiffies = 0;
+static PR_CONTEXT		*processor_list[NR_CPUS];
+static void			(*pr_pm_idle_save)(void) = NULL;
+
+
+/****************************************************************************
+ *                             External Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ *
+ * FUNCTION:    pr_power_activate_state
+ *
+ * PARAMETERS:
+ *
+ * RETURN:
+ *
+ * DESCRIPTION:
+ *
+ ****************************************************************************/
+
+void
+pr_power_activate_state (
+	PR_CONTEXT		*processor,
+	u32			next_state)
+{
+	if (!processor) {
+		return;
+	}
+
+	processor->power.state[processor->power.active_state].promotion.count = 0;
+	processor->power.state[processor->power.active_state].demotion.count = 0;
+
+	/*
+	 * Cleanup from old state.
+	 */
+	switch (processor->power.active_state) {
+
+	case PR_C3:
+		/* Disable bus master reload */
+		acpi_hw_register_bit_access(ACPI_WRITE, ACPI_MTX_DO_NOT_LOCK,
+			BM_RLD, 0);
+		break;
+	}
+
+	/*
+	 * Prepare to use new state.
+	 */
+	switch (next_state) {
+
+	case PR_C3:
+		/* Enable bus master reload */
+		acpi_hw_register_bit_access(ACPI_WRITE, ACPI_MTX_DO_NOT_LOCK,
+			BM_RLD, 1);
+		break;
+	}
+
+	processor->power.active_state = next_state;
+	
+	return;
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:    pr_power_idle
+ *
+ * PARAMETERS:  <none>
+ *
+ * RETURN:
+ *
+ * DESCRIPTION:
+ *
+ ****************************************************************************/
+
+void
+pr_power_idle (void)
+{
+	PR_CX			*c_state = NULL;
+	u32			next_state = 0;
+	u32			start_ticks, end_ticks, time_elapsed;
+	PR_CONTEXT		*processor = NULL;
+
+	processor = processor_list[smp_processor_id()];
+
+	if (!processor || processor->power.active_state == PR_C0) {
+		return;
+	}
+
+	next_state = processor->power.active_state;
+
+	/*
+	 * Log BM Activity:
+	 * ----------------
+	 * Read BM_STS and record its value for later use by C3 policy.
+	 * Note that we save the BM_STS values for the last 32 call to
+	 * this function (cycles).  Also note that we must clear BM_STS
+	 * if set (sticky).
+	 */
+	processor->power.bm_activity <<= 1;
+	if (acpi_hw_register_bit_access(ACPI_READ, ACPI_MTX_DO_NOT_LOCK, BM_STS)) {
+		processor->power.bm_activity |= 1;
+		acpi_hw_register_bit_access(ACPI_WRITE, ACPI_MTX_DO_NOT_LOCK,
+			BM_STS, 1);
+	}
+
+	/*
+	 * Check OS Idleness:
+	 * ------------------
+	 * If the OS has been busy (hasn't called the idle handler in a while)
+	 * then automatically demote to the default power state (e.g. C1).
+	 *
+	 * TBD: Optimize by having scheduler determine business instead
+	 *      of having us try to calculate it.
+	 */
+	if (processor->power.active_state != processor->power.default_state) {
+		if ((jiffies - last_idle_jiffies) >= processor->power.busy_metric) {
+			next_state = processor->power.default_state;
+			if (next_state != processor->power.active_state) {
+				pr_power_activate_state(processor, next_state);
+			}
+		}
+	}
+
+	c_state = &(processor->power.state[processor->power.active_state]);
+
+	c_state->utilization++;
+
+	/*
+	 * Sleep:
+	 * ------
+	 * Invoke the current Cx state to put the processor to sleep.
+	 */
+	switch (processor->power.active_state) {
+
+	case PR_C1:
+		/* See how long we're asleep for */
+		acpi_get_timer(&start_ticks);
+		/* Invoke C1 */
+		enable(); halt();
+		/* Compute time elapsed */
+		acpi_get_timer(&end_ticks);
+		break;
+
+	case PR_C2:
+		/* Interrupts must be disabled during C2 transitions */
+		disable();
+		/* See how long we're asleep for */
+		acpi_get_timer(&start_ticks);
+		/* Invoke C2 */
+		acpi_os_in8(processor->power.p_lvl2);
+		/* Dummy op - must do something useless after P_LVL2 read */
+		acpi_hw_register_bit_access(ACPI_READ, ACPI_MTX_DO_NOT_LOCK,
+			BM_STS);
+		/* Compute time elapsed */
+		acpi_get_timer(&end_ticks);
+		/* Re-enable interrupts */
+		enable();
+		break;
+
+	case PR_C3:
+		/* Interrupts must be disabled during C3 transitions */
+		disable();
+		/* Disable bus master arbitration */
+		acpi_hw_register_bit_access(ACPI_WRITE, ACPI_MTX_DO_NOT_LOCK,
+			ARB_DIS, 1);
+		/* See how long we're asleep for */
+		acpi_get_timer(&start_ticks);
+		/* Invoke C2 */
+		acpi_os_in8(processor->power.p_lvl3);
+		/* Dummy op - must do something useless after P_LVL3 read */
+		acpi_hw_register_bit_access(ACPI_READ, ACPI_MTX_DO_NOT_LOCK,
+			BM_STS);
+		/* Compute time elapsed */
+		acpi_get_timer(&end_ticks);
+		/* Enable bus master arbitration */
+		acpi_hw_register_bit_access(ACPI_WRITE, ACPI_MTX_DO_NOT_LOCK,
+			ARB_DIS, 0);
+		/* Re-enable interrupts */
+		enable();
+		break;
+
+	default:
+		break;
+	}
+
+	/*
+	 * Compute the amount of time asleep (in the Cx state).
+	 *
+	 * TBD: Convert time_threshold to PM timer ticks initially to
+	 *      avoid having to do the math (acpi_get_timer_duration).
+	 */
+	acpi_get_timer_duration(start_ticks, end_ticks, &time_elapsed);
+
+	/*
+	 * Promotion?
+	 * ----------
+	 * Track the number of successful sleeps (time asleep is greater
+	 * than time_threshold) and promote when count_threashold is
+	 * reached.
+	 */
+	if ((c_state->promotion.target_state) && 	
+		(time_elapsed >= c_state->promotion.time_threshold)) {
+
+		c_state->promotion.count++;
+ 		c_state->demotion.count = 0;
+
+		if (c_state->promotion.count >=
+			c_state->promotion.count_threshold) {
+
+			/*
+			 * Bus Mastering Activity, if active and used
+			 * by this state's promotion policy, prevents
+			 * promotions from occuring.
+			 */
+			if (!(processor->power.bm_activity &
+				c_state->promotion.bm_threshold)) {
+				next_state = c_state->promotion.target_state;
+			}
+		}
+	}
+
+	/*
+	 * Demotion?
+	 * ---------
+	 * Track the number of shorts (time asleep is less than
+	 * time_threshold) and demote when count_threshold is reached.
+	 */
+	if (c_state->demotion.target_state) {
+			
+		if (time_elapsed < c_state->demotion.time_threshold) {
+
+			c_state->demotion.count++;
+			c_state->promotion.count = 0;
+
+			if (c_state->demotion.count >=
+				c_state->demotion.count_threshold) {
+				next_state = c_state->demotion.target_state;
+			}
+		}
+
+		/*
+		 * Bus Mastering Activity, if active and used by this
+		 * state's promotion policy, causes an immediate demotion
+		 * to occur.
+		 */
+		if (processor->power.bm_activity &
+			c_state->demotion.bm_threshold) {
+			next_state = c_state->demotion.target_state;
+		}
+	}
+
+	/*
+	 * New Cx State?
+	 * -------------
+	 * If we're going to start using a new Cx state we must clean up
+	 * from the previous and prepare to use the new.
+	 */
+	if (next_state != processor->power.active_state) {
+		pr_power_activate_state(processor, next_state);
+		processor->power.active_state = processor->power.active_state;
+	}
+
+	/*
+	 * Track OS Idleness:
+	 * ------------------
+	 * Record a jiffies timestamp to compute time elapsed between calls
+	 * to the idle handler.
+	 */
+	last_idle_jiffies = jiffies;
+
+	return;
+}
+
+
+/*****************************************************************************
+ *
+ * FUNCTION:    pr_power_set_default_policy
+ *
+ * PARAMETERS:
+ *
+ * RETURN:	
+ *
+ * DESCRIPTION: Sets the default Cx state policy (OS idle handler).  Our
+ *              scheme is to promote quickly to C2 but more conservatively
+ *              to C3.  We're favoring C2 for its characteristics of low
+ *              latency (quick response), good power savings, and ability
+ *              to allow bus mastering activity.
+ *
+ *              Note that Cx state policy is completely customizable, with
+ *              the goal of having heuristics to alter policy dynamically.
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+pr_power_set_default_policy (
+	PR_CONTEXT                 *processor)
+{
+	if (!processor) {
+		return(AE_BAD_PARAMETER);
+	}
+
+	/*
+	 * Busy Metric:
+	 * ------------
+	 * Used to determine when the OS has been busy and thus when
+	 * policy should return to using the default Cx state (e.g. C1).
+	 * On Linux we use the number of jiffies (scheduler quantums)
+	 * that transpire between calls to the idle handler.
+	 *
+	 * TBD: Linux-specific.
+	 */
+	processor->power.busy_metric = 2;
+
+	/*
+	 * C1:
+	 * ---
+	 * C1 serves as our default state.  It must be valid.
+	 */
+	if (processor->power.state[PR_C1].is_valid) {
+		processor->power.active_state =
+			processor->power.default_state = PR_C1;
+	}
+	else {
+		processor->power.active_state =
+			processor->power.default_state = PR_C0;
+		return(AE_OK);
+	}
+
+	/*
+	 * C2:
+	 * ---
+	 * Set default C1 promotion and C2 demotion policies.
+	 */
+	if (processor->power.state[PR_C2].is_valid) {
+		/*
+		 * Promote from C1 to C2 anytime we're asleep in C1 for
+		 * longer than two times the C2 latency (to amortize cost
+		 * of transition).  Demote from C2 to C1 anytime we're
+		 * asleep in C2 for less than this time.
+		 */
+		processor->power.state[PR_C1].promotion.count_threshold = 1;
+		processor->power.state[PR_C1].promotion.time_threshold =
+			2 * processor->power.state[PR_C2].latency;
+		processor->power.state[PR_C1].promotion.target_state = PR_C2;
+
+		processor->power.state[PR_C2].demotion.count_threshold = 1;
+		processor->power.state[PR_C2].demotion.time_threshold =
+			2 * processor->power.state[PR_C2].latency;
+		processor->power.state[PR_C2].demotion.target_state = PR_C1;
+	}
+
+	/*
+	 * C3:
+	 * ---
+	 * Set default C2 promotion and C3 demotion policies.
+	 */
+	if ((processor->power.state[PR_C2].is_valid) &&
+		(processor->power.state[PR_C3].is_valid)) {
+		/*
+		 * Promote from C2 to C3 after 4 cycles of no bus
+		 * mastering activity (while maintaining sleep time
+		 * criteria).  Demote immediately on a short or
+		 * whenever bus mastering activity occurs.
+		 */
+		processor->power.state[PR_C2].promotion.count_threshold = 1;
+		processor->power.state[PR_C2].promotion.time_threshold =
+			2 * processor->power.state[PR_C3].latency;
+		processor->power.state[PR_C2].promotion.bm_threshold =
+			0x0000000F;
+		processor->power.state[PR_C2].promotion.target_state =
+			PR_C3;
+
+		processor->power.state[PR_C3].demotion.count_threshold = 1;
+		processor->power.state[PR_C3].demotion.time_threshold =
+			2 * processor->power.state[PR_C3].latency;
+		processor->power.state[PR_C3].demotion.bm_threshold =
+			0x0000000F;
+		processor->power.state[PR_C3].demotion.target_state =
+			PR_C2;
+	}
+
+	return(AE_OK);
+}
+
+/*****************************************************************************
+ *
+ * FUNCTION:    pr_power_add_device
+ *
+ * PARAMETERS:  <none>
+ *
+ * RETURN:
+ *
+ * DESCRIPTION:
+ *
+ ****************************************************************************/
+
+/*
+ * TBD: 1. PROC_C1 support.
+ *      2. Symmetric Cx state support (different Cx states supported
+ *         by different CPUs results in lowest common denominator).
+ */
+
+ACPI_STATUS
+pr_power_add_device (
+	PR_CONTEXT                 *processor)
+{
+	if (!processor) {
+		return(AE_BAD_PARAMETER);
+	}
+
+	/*
+	 * State Count:
+	 * ------------
+	 * Fixed at four (C0-C3).  We use is_valid to determine whether or
+	 * not a state actually gets used.
+	 */
+	processor->power.state_count = PR_MAX_POWER_STATES;
+
+	/*
+	 * C0:
+	 * ---
+	 * C0 exists only as filler in our array. (Let's assume its valid!)
+	 */
+	processor->power.state[PR_C0].is_valid = TRUE;
+
+	/*
+	 * C1:
+	 * ---
+	 * ACPI states that C1 must be supported by all processors
+	 * with a latency so small that it can be ignored.
+	 *
+	 * TBD: What about PROC_C1 support?
+	 */
+	processor->power.state[PR_C1].is_valid = TRUE;
+
+	/*
+	 * C2:
+	 * ---
+	 * We're only supporting C2 on UP systems with latencies <= 100us.
+	 *
+	 * TBD: Support for C2 on MP (P_LVL2_UP) -- I'm taking the
+	 *      conservative approach for now.
+	 */
+	processor->power.state[PR_C2].latency = acpi_fadt.plvl2_lat;
+
+#ifdef CONFIG_SMP
+	if (smp_num_cpus == 1) {
+#endif /*CONFIG_SMP*/
+		if (acpi_fadt.plvl2_lat <= PR_MAX_C2_LATENCY) {
+			processor->power.state[PR_C2].is_valid = TRUE;
+			processor->power.p_lvl2 = processor->pblk.address + 4;
+		}
+#ifdef CONFIG_SMP
+	}
+#endif /*CONFIG_SMP*/
+
+
+	/*
+	 * C3:
+	 * ---
+	 * We're only supporting C3 on UP systems with latencies <= 1000us,
+	 * and that include the ability to disable bus mastering while in
+	 * C3 (ARB_DIS) but allows bus mastering requests to wake the system
+	 * from C3 (BM_RLD).  Note his method of maintaining cache coherency
+	 * (disabling of bus mastering) cannot be used on SMP systems, and
+	 * flushing caches (e.g. WBINVD) is simply too costly at this time.
+	 *
+	 * TBD: Support for C3 on MP -- I'm taking the conservative
+	 *      approach for now.
+	 */
+	processor->power.state[PR_C3].latency = acpi_fadt.plvl3_lat;
+
+#ifdef CONFIG_SMP
+	if (smp_num_cpus == 1) {
+#endif /*CONFIG_SMP*/
+		if ((acpi_fadt.plvl3_lat <= PR_MAX_C3_LATENCY) &&
+			(acpi_fadt.V1_pm2_cnt_blk && acpi_fadt.pm2_cnt_len)) {
+			/* TBD: Resolve issue with C3 and HDD corruption. */
+			processor->power.state[PR_C3].is_valid = FALSE;
+			/* processor->power.state[PR_C3].is_valid = TRUE;*/
+			processor->power.p_lvl3 = processor->pblk.address + 5;
+		}
+#ifdef CONFIG_SMP
+	}
+#endif /*CONFIG_SMP*/
+
+	/*
+	 * Set Default Policy:
+	 * -------------------
+	 * Now that we know which state are supported, set the default
+	 * policy.  Note that this policy can be changed dynamically
+	 * (e.g. encourage deeper sleeps to conserve battery life when
+	 * not on AC).
+	 */
+	pr_power_set_default_policy(processor);
+
+	/*
+	 * Save Processor Context:
+	 * -----------------------
+	 * TBD: Enhance Linux idle handler to take processor context
+	 *      parameter.
+	 */
+	processor_list[processor->uid] = processor;
+
+	return(AE_OK);
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:    pr_power_remove_device
+ *
+ * PARAMETERS:
+ *
+ * RETURN:	
+ *
+ * DESCRIPTION:
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+pr_power_remove_device (
+	PR_CONTEXT              *processor)
+{
+	ACPI_STATUS             status = AE_OK;
+
+	if (!processor) {
+		return(AE_BAD_PARAMETER);
+	}
+
+	MEMSET(&(processor->power), 0, sizeof(PR_POWER));
+
+	processor_list[processor->uid] = NULL;
+
+	return(status);
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:    pr_power_initialize
+ *
+ * PARAMETERS:  <none>
+ *
+ * RETURN:
+ *
+ * DESCRIPTION:
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+pr_power_initialize (void)
+{
+	u32			i = 0;
+
+	/* TBD: Linux-specific. */
+	for (i=0; i<NR_CPUS; i++) {
+		processor_list[i] = NULL;
+	}
+
+	/*
+	 * Install idle handler.
+	 *
+	 * TBD: Linux-specific (need OSL function).
+	 */
+	pr_pm_idle_save = pm_idle;
+	pm_idle = pr_power_idle;
+
+	return(AE_OK);
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:    pr_power_terminate
+ *
+ * PARAMETERS:  <none>
+ *
+ * RETURN:
+ *
+ * DESCRIPTION:
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+pr_power_terminate (void)
+{
+	/*
+	 * Remove idle handler.
+	 *
+	 * TBD: Linux-specific (need OSL function).
+	 */
+	pm_idle = pr_pm_idle_save;
+
+	return(AE_OK);
+}
diff -urN linux-2.4.6-pre4/drivers/acpi/ospm/system/Makefile linux/drivers/acpi/ospm/system/Makefile
--- linux-2.4.6-pre4/drivers/acpi/ospm/system/Makefile	Wed Dec 31 16:00:00 1969
+++ linux/drivers/acpi/ospm/system/Makefile	Mon Dec  3 22:48:42 2001
@@ -0,0 +1,6 @@
+O_TARGET	:= ospm_$(notdir $(CURDIR)).o
+obj-m		:= $(O_TARGET)
+EXTRA_CFLAGS	+= $(ACPI_CFLAGS)
+obj-y		:= $(patsubst %.c,%.o,$(wildcard *.c))
+
+include $(TOPDIR)/Rules.make
diff -urN linux-2.4.6-pre4/drivers/acpi/ospm/system/sm.c linux/drivers/acpi/ospm/system/sm.c
--- linux-2.4.6-pre4/drivers/acpi/ospm/system/sm.c	Wed Dec 31 16:00:00 1969
+++ linux/drivers/acpi/ospm/system/sm.c	Mon Dec  3 22:48:42 2001
@@ -0,0 +1,330 @@
+/*****************************************************************************
+ *
+ * Module Name: sm.c
+ *   $Revision: 16 $
+ *
+ *****************************************************************************/
+
+/*
+ *  Copyright (C) 2000, 2001 Andrew Grover
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include <acpi.h>
+#include "sm.h"
+
+
+#define _COMPONENT		ACPI_SYSTEM
+	MODULE_NAME 		("sm")
+
+
+/****************************************************************************
+ *                            Internal Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ *
+ * FUNCTION:	sm_print
+ *
+ * PARAMETERS:	
+ *
+ * RETURN:	
+ *
+ * DESCRIPTION: Prints out information on a specific system.
+ *
+ ****************************************************************************/
+
+void
+sm_print (
+	SM_CONTEXT		*system)
+{
+
+	return;
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:	sm_add_device
+ *
+ * PARAMETERS:	
+ *
+ * RETURN:	
+ *
+ * DESCRIPTION:
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+sm_add_device(
+	BM_HANDLE		device_handle,
+	void			**context)
+{
+	ACPI_STATUS 		status = AE_OK;
+	BM_DEVICE		*device = NULL;
+	SM_CONTEXT		*system = NULL;
+	u8			i, type_a, type_b;
+
+
+	if (!context || *context) {
+		return(AE_BAD_PARAMETER);
+	}
+
+	/*
+	 * Allocate a new SM_CONTEXT structure.
+	 */
+	system = acpi_os_callocate(sizeof(SM_CONTEXT));
+	if (!system) {
+		return(AE_NO_MEMORY);
+	}
+
+	/*
+	 * Get information on this device.
+	 */
+	status = bm_get_device_info(device_handle, &device);
+	if (ACPI_FAILURE(status)) {
+		goto end;
+	}
+
+	system->device_handle = device->handle;
+	system->acpi_handle = device->acpi_handle;
+
+	/*
+	 * Sx States:
+	 * ----------
+	 * Figure out which Sx states are supported.
+	 */
+	for (i=0; i<SM_MAX_SYSTEM_STATES; i++) {
+		if (ACPI_SUCCESS(acpi_hw_obtain_sleep_type_register_data(
+			i,
+			&type_a,
+			&type_b))) {
+			system->states[i] = TRUE;
+		}
+	}
+
+	status = sm_osl_add_device(system);
+	if (ACPI_FAILURE(status)) {
+		goto end;
+	}
+
+	*context = system;
+
+	sm_print(system);
+
+end:
+	if (ACPI_FAILURE(status)) {
+		acpi_os_free(system);
+	}
+
+	return(status);
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:	sm_remove_device
+ *
+ * PARAMETERS:	
+ *
+ * RETURN:	
+ *
+ * DESCRIPTION:
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+sm_remove_device (
+	void			**context)
+{
+	ACPI_STATUS 		status = AE_OK;
+	SM_CONTEXT		*system = NULL;
+
+	if (!context || !*context) {
+		return(AE_BAD_PARAMETER);
+	}
+
+	system = (SM_CONTEXT*)*context;
+
+	status = sm_osl_remove_device(system);
+
+	acpi_os_free(system);
+
+	*context = NULL;
+
+	return(status);
+}
+
+
+/****************************************************************************
+ *                             External Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ *
+ * FUNCTION:	sm_initialize
+ *
+ * PARAMETERS:	<none>
+ *
+ * RETURN:	
+ *
+ * DESCRIPTION:
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+sm_initialize (void)
+{
+	ACPI_STATUS		status = AE_OK;
+	BM_DEVICE_ID		criteria;
+	BM_DRIVER		driver;
+
+	MEMSET(&criteria, 0, sizeof(BM_DEVICE_ID));
+	MEMSET(&driver, 0, sizeof(BM_DRIVER));
+
+	/*
+	 * Register driver for the System device.
+	 */
+	criteria.type = BM_TYPE_SYSTEM;
+
+	driver.notify = &sm_notify;
+	driver.request = &sm_request;
+
+	status = bm_register_driver(&criteria, &driver);
+
+	return(status);
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:	sm_terminate
+ *
+ * PARAMETERS:	<none>
+ *
+ * RETURN:	
+ *
+ * DESCRIPTION:
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+sm_terminate (void)
+{
+	ACPI_STATUS 		status = AE_OK;
+	BM_DEVICE_ID		criteria;
+	BM_DRIVER		driver;
+
+	MEMSET(&criteria, 0, sizeof(BM_DEVICE_ID));
+	MEMSET(&driver, 0, sizeof(BM_DRIVER));
+
+	/*
+	 * Unregister driver for System devices.
+	 */
+	criteria.type = BM_TYPE_SYSTEM;
+
+	driver.notify = &sm_notify;
+	driver.request = &sm_request;
+
+	status = bm_unregister_driver(&criteria, &driver);
+
+	return(status);
+}
+
+
+/*****************************************************************************
+ *
+ * FUNCTION:	sm_notify
+ *
+ * PARAMETERS:	<none>
+ *
+ * RETURN:	
+ *
+ * DESCRIPTION:
+ *
+ ****************************************************************************/
+ACPI_STATUS
+sm_notify (
+	BM_NOTIFY		notify_type,
+	BM_HANDLE		device_handle,
+	void			**context)
+{
+	ACPI_STATUS 		status = AE_OK;
+
+	if (!context) {
+		return(AE_BAD_PARAMETER);
+	}
+
+	switch (notify_type) {
+
+	case BM_NOTIFY_DEVICE_ADDED:
+		status = sm_add_device(device_handle, context);
+		break;
+
+	case BM_NOTIFY_DEVICE_REMOVED:
+		status = sm_remove_device(context);
+		break;
+
+	default:
+		status = AE_SUPPORT;
+		break;
+	}
+
+	return(status);
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:	sm_request
+ *
+ * PARAMETERS:	
+ *
+ * RETURN:	
+ *
+ * DESCRIPTION:
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+sm_request (
+	BM_REQUEST		*request,
+	void			*context)
+{
+	ACPI_STATUS 		status = AE_OK;
+
+	/*
+	 * Must have a valid request structure and context.
+	 */
+	if (!request || !context) {
+		return(AE_BAD_PARAMETER);
+	}
+
+	/*
+	 * Handle Request:
+	 * ---------------
+	 */
+	switch (request->command) {
+
+	default:
+		status = AE_SUPPORT;
+		break;
+	}
+
+	request->status = status;
+
+	return(status);
+}
diff -urN linux-2.4.6-pre4/drivers/acpi/ospm/system/sm_osl.c linux/drivers/acpi/ospm/system/sm_osl.c
--- linux-2.4.6-pre4/drivers/acpi/ospm/system/sm_osl.c	Wed Dec 31 16:00:00 1969
+++ linux/drivers/acpi/ospm/system/sm_osl.c	Mon Dec  3 22:48:42 2001
@@ -0,0 +1,344 @@
+/******************************************************************************
+ *
+ * Module Name: sm_osl.c
+ *   $Revision: 10 $
+ *
+ *****************************************************************************/
+
+/*
+ *  Copyright (C) 2000, 2001 Andrew Grover
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/types.h>
+#include <linux/proc_fs.h>
+#include <linux/pm.h>
+#include <asm/uaccess.h>
+
+#include <acpi.h>
+#include "sm.h"
+
+
+MODULE_AUTHOR("Andrew Grover");
+MODULE_DESCRIPTION("ACPI Component Architecture (CA) - ACPI System Driver");
+
+
+#define SM_PROC_INFO		"info"
+#define SM_PROC_DSDT		"dsdt"
+
+extern struct proc_dir_entry	*bm_proc_root;
+struct proc_dir_entry		*sm_proc_root = NULL;
+static void 			(*sm_pm_power_off)(void) = NULL;
+
+static ssize_t sm_osl_read_dsdt(struct file *, char *, size_t, loff_t *);
+
+static struct file_operations proc_dsdt_operations = {
+	read:		sm_osl_read_dsdt,
+};
+
+
+
+/****************************************************************************
+ *
+ * FUNCTION:	sm_osl_proc_read_info
+ *
+ ****************************************************************************/
+
+static int
+sm_osl_proc_read_info (
+	char			*page,
+	char			**start,
+	off_t			off,
+	int 			count,
+	int 			*eof,
+	void			*context)
+{
+	ACPI_STATUS		status = AE_OK;
+	SM_CONTEXT		*system = NULL;
+	char			*p = page;
+	int			len;
+	ACPI_SYSTEM_INFO	system_info;
+	ACPI_BUFFER		buffer;
+	u32			i = 0;
+
+	if (!context) {
+		goto end;
+	}
+
+	system = (SM_CONTEXT*)context;
+
+	/* don't get status more than once for a single proc read */
+	if (off != 0) {
+		goto end;
+	}
+
+	/*
+	 * Get ACPI CA Information.
+	 */
+	buffer.length  = sizeof(system_info);
+	buffer.pointer = &system_info;
+
+	status = acpi_get_system_info(&buffer);
+	if (ACPI_FAILURE(status)) {
+		p += sprintf(p, "ACPI-CA Version:         unknown\n");
+	}
+	else {
+		p += sprintf(p, "ACPI-CA Version:         %x\n", 
+			system_info.acpi_ca_version);
+	}
+
+	p += sprintf(p, "Sx States Supported:     ");
+	for (i=0; i<SM_MAX_SYSTEM_STATES; i++) {
+		if (system->states[i]) {
+			p += sprintf(p, "S%d ", i);
+		}
+	}
+	p += sprintf(p, "\n");
+
+end:
+	len = (p - page);
+	if (len <= off+count) *eof = 1;
+	*start = page + off;
+	len -= off;
+	if (len>count) len = count;
+	if (len<0) len = 0;
+
+	return(len);
+}
+
+/****************************************************************************
+ *
+ * FUNCTION:	sm_osl_read_dsdt
+ *
+ ****************************************************************************/
+
+static ssize_t
+sm_osl_read_dsdt(
+	struct file		*file, 
+	char			*buf, 
+	size_t			count, 
+	loff_t			*ppos)
+{
+	ACPI_BUFFER		acpi_buf;
+	void			*data;
+	size_t			size = 0;
+
+	acpi_buf.length = 0;
+	acpi_buf.pointer = NULL;
+
+
+	/* determine what buffer size we will need */
+	if (acpi_get_table(ACPI_TABLE_DSDT, 1, &acpi_buf) != AE_BUFFER_OVERFLOW) {
+		return 0;
+	}
+
+	acpi_buf.pointer = kmalloc(acpi_buf.length, GFP_KERNEL);
+	if (!acpi_buf.pointer) {
+		return -ENOMEM;
+	}
+
+	/* get the table for real */
+	if (!ACPI_SUCCESS(acpi_get_table(ACPI_TABLE_DSDT, 1, &acpi_buf))) {
+		kfree(acpi_buf.pointer);
+		return 0;
+	}
+
+	if (*ppos < acpi_buf.length) {
+		data = acpi_buf.pointer + file->f_pos;
+		size = acpi_buf.length - file->f_pos;
+		if (size > count)
+			size = count;
+		if (copy_to_user(buf, data, size)) {
+			kfree(acpi_buf.pointer);
+			return -EFAULT;
+		}
+	}
+
+	kfree(acpi_buf.pointer);
+
+	*ppos += size;
+
+	return size;
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:	sm_osl_power_down
+ *
+ ****************************************************************************/
+
+void
+sm_osl_power_down (void)
+{
+	ACPI_STATUS		status = AE_OK;
+
+	/* Power down the system (S5 = soft off). */
+	status = acpi_enter_sleep_state(ACPI_STATE_S5);
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:	sm_osl_add_device
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+sm_osl_add_device(
+	SM_CONTEXT		*system)
+{
+	u32			i = 0;
+	struct proc_dir_entry	*bm_proc_dsdt;
+
+	if (!system) {
+		return(AE_BAD_PARAMETER);
+	}
+
+	printk("ACPI: System firmware supports");
+	for (i=0; i<SM_MAX_SYSTEM_STATES; i++) {
+		if (system->states[i]) {
+			printk(" S%d", i);
+		}
+	}
+	printk("\n");
+
+	if (system->states[ACPI_STATE_S5]) {
+		sm_pm_power_off = pm_power_off;
+		pm_power_off = sm_osl_power_down; 
+	}
+
+	create_proc_read_entry(SM_PROC_INFO, S_IRUGO, 
+		sm_proc_root, sm_osl_proc_read_info, (void*)system);
+
+	/* 
+	 * This returns more than a page, so we need to use our own file ops,
+	 * not proc's generic ones
+	 */
+	bm_proc_dsdt = create_proc_entry(SM_PROC_DSDT, S_IRUSR, sm_proc_root);
+	if (bm_proc_dsdt) {
+		bm_proc_dsdt->proc_fops = &proc_dsdt_operations;
+	}
+
+	return(AE_OK);
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:	sm_osl_remove_device
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+sm_osl_remove_device (
+	SM_CONTEXT		*system)
+{
+	if (!system) {
+		return(AE_BAD_PARAMETER);
+	}
+
+	remove_proc_entry(SM_PROC_INFO, sm_proc_root);
+	remove_proc_entry(SM_PROC_DSDT, sm_proc_root);
+
+	return(AE_OK);
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:	sm_osl_generate_event
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+sm_osl_generate_event (
+	u32			event,
+	SM_CONTEXT		*system)
+{
+	ACPI_STATUS		status = AE_OK;
+
+	if (!system) {
+		return(AE_BAD_PARAMETER);
+	}
+
+	switch (event) {
+
+	default:
+		return(AE_BAD_PARAMETER);
+		break;
+	}
+
+	return(status);
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:	sm_osl_init
+ *
+ * PARAMETERS:	<none>
+ *
+ * RETURN:	0: Success
+ *
+ * DESCRIPTION: Module initialization.
+ *
+ ****************************************************************************/
+
+static int __init 
+sm_osl_init (void)
+{
+	ACPI_STATUS		status = AE_OK;
+
+	sm_proc_root = bm_proc_root;
+	if (!sm_proc_root) {
+		status = AE_ERROR;
+	}
+	else {
+		status = sm_initialize();
+	}
+
+	return (ACPI_SUCCESS(status)) ? 0 : -ENODEV;
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:	sm_osl_cleanup
+ *
+ * PARAMETERS:	<none>
+ *
+ * RETURN:	<none>
+ *
+ * DESCRIPTION: Module cleanup.
+ *
+ ****************************************************************************/
+
+static void __exit 
+sm_osl_cleanup (void)
+{
+	sm_terminate();
+
+	return;
+}
+
+
+module_init(sm_osl_init);
+module_exit(sm_osl_cleanup);
diff -urN linux-2.4.6-pre4/drivers/acpi/ospm/thermal/Makefile linux/drivers/acpi/ospm/thermal/Makefile
--- linux-2.4.6-pre4/drivers/acpi/ospm/thermal/Makefile	Wed Dec 31 16:00:00 1969
+++ linux/drivers/acpi/ospm/thermal/Makefile	Mon Dec  3 22:48:42 2001
@@ -0,0 +1,6 @@
+O_TARGET	:= ospm_$(notdir $(CURDIR)).o
+obj-m		:= $(O_TARGET)
+EXTRA_CFLAGS	+= $(ACPI_CFLAGS)
+obj-y		:= $(patsubst %.c,%.o,$(wildcard *.c))
+
+include $(TOPDIR)/Rules.make
diff -urN linux-2.4.6-pre4/drivers/acpi/ospm/thermal/tz.c linux/drivers/acpi/ospm/thermal/tz.c
--- linux-2.4.6-pre4/drivers/acpi/ospm/thermal/tz.c	Wed Dec 31 16:00:00 1969
+++ linux/drivers/acpi/ospm/thermal/tz.c	Mon Dec  3 22:48:42 2001
@@ -0,0 +1,659 @@
+/*****************************************************************************
+ *
+ * Module Name: tz.c
+ *   $Revision: 38 $
+ *
+ *****************************************************************************/
+
+/*
+ *  Copyright (C) 2000, 2001 Andrew Grover
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+/*
+ * TBD: 1. Finish /proc interface (threshold values, _SCP changes, etc.)
+ *	2. Update policy for ACPI 2.0 compliance
+ *	3. Check for all required methods prior to enabling a threshold
+ *	4. Support for multiple processors in a zone (passive cooling devices)
+ */
+
+#include <acpi.h>
+#include <bm.h>
+#include "tz.h"
+
+#define _COMPONENT		ACPI_THERMAL
+	MODULE_NAME		("tz")
+
+
+/****************************************************************************
+ *                            Internal Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ *
+ * FUNCTION:    tz_print
+ *
+ * PARAMETERS:
+ *
+ * RETURN:
+ *
+ * DESCRIPTION: Prints out information on a specific thermal zone.
+ *
+ ****************************************************************************/
+
+void
+tz_print (
+	TZ_CONTEXT		*thermal_zone)
+{
+
+	return;
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:    tz_get_temperaturee
+ *
+ * PARAMETERS:
+ *
+ * RETURN:
+ *
+ * DESCRIPTION:
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+tz_get_temperature (
+	TZ_CONTEXT              *thermal_zone,
+	u32                     *temperature)
+{
+	ACPI_STATUS             status = AE_OK;
+
+	if (!thermal_zone || !temperature) {
+		return(AE_BAD_PARAMETER);
+	}
+
+	/*
+	 * Evaluate the _TMP driver method to get the current temperature.
+	 */
+	status = bm_evaluate_simple_integer(thermal_zone->acpi_handle,
+		"_TMP", temperature);
+
+	return(status);
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:    tz_set_cooling_preference
+ *
+ * PARAMETERS:
+ *
+ * RETURN:
+ *
+ * DESCRIPTION:
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+tz_set_cooling_preference (
+	TZ_CONTEXT              *thermal_zone,
+	TZ_COOLING_MODE         cooling_mode)
+{
+	ACPI_STATUS             status = AE_OK;
+	ACPI_OBJECT_LIST        arg_list;
+	ACPI_OBJECT             arg0;
+
+	if (!thermal_zone || ((cooling_mode != TZ_COOLING_MODE_ACTIVE) &&
+		(cooling_mode != TZ_COOLING_MODE_PASSIVE))) {
+		return(AE_BAD_PARAMETER);
+	}
+
+	/*
+	 * Build the argument list, which simply consists of the current
+	 * cooling preference.
+	 */
+	MEMSET(&arg_list, 0, sizeof(ACPI_OBJECT));
+	arg_list.count = 1;
+	arg_list.pointer = &arg0;
+
+	MEMSET(&arg0, 0, sizeof(ACPI_OBJECT));
+	arg0.type = ACPI_TYPE_INTEGER;
+	arg0.integer.value = cooling_mode;
+
+	/*
+	 * Evaluate "_SCP" - setting the new cooling preference.
+	 */
+	status = acpi_evaluate_object(thermal_zone->acpi_handle, "_SCP",
+		&arg_list, NULL);
+
+	return(status);
+}
+
+
+/***************************************************************************
+ *
+ * FUNCTION:    tz_get_single_threshold
+ *
+ * PARAMETERS:
+ *
+ * RETURN:
+ *
+ * DESCRIPTION:
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+tz_get_single_threshold (
+	TZ_CONTEXT              *thermal_zone,
+	TZ_THRESHOLD            *threshold)
+{
+	ACPI_STATUS             status = AE_OK;
+
+	if (!thermal_zone || !threshold) {
+		return(AE_BAD_PARAMETER);
+	}
+
+	switch (threshold->type) {
+
+	/*
+	 * Critical Threshold:
+	 * -------------------
+	 */
+	case TZ_THRESHOLD_CRITICAL:
+		threshold->index = 0;
+		threshold->cooling_devices.count = 0;
+		status = bm_evaluate_simple_integer(
+			thermal_zone->acpi_handle, "_CRT",
+			&(threshold->temperature));
+		break;
+
+	/*
+	 * Passive Threshold:
+	 * ------------------
+	 * Evaluate _PSV to get the threshold temperature and _PSL to get
+	 * references to all passive cooling devices.
+	 */
+	case TZ_THRESHOLD_PASSIVE:
+		threshold->index = 0;
+		threshold->cooling_devices.count = 0;
+		status = bm_evaluate_simple_integer(
+			thermal_zone->acpi_handle, "_PSV",
+			&(threshold->temperature));
+		if (ACPI_SUCCESS(status)) {
+			status = bm_evaluate_reference_list(
+				thermal_zone->acpi_handle, "_PSL",
+				&(threshold->cooling_devices));
+		}
+
+		break;
+
+	/*
+	 * Active Thresholds:
+	 * ------------------
+	 * Evaluate _ACx to get all threshold temperatures, and _ALx to get
+	 * references to all passive cooling devices.
+	 */
+	case TZ_THRESHOLD_ACTIVE:
+		 {
+			char object_name[5] = {'_','A', 'C',
+				('0'+threshold->index),'\0'};
+			status = bm_evaluate_simple_integer(
+				thermal_zone->acpi_handle, object_name,
+				&(threshold->temperature));
+			if (ACPI_SUCCESS(status)) {
+				object_name[2] = 'L';
+				status = bm_evaluate_reference_list(
+					thermal_zone->acpi_handle,
+					object_name,
+					&(threshold->cooling_devices));
+			}
+		}
+		break;
+
+	default:
+		status = AE_SUPPORT;
+		break;
+	}
+
+	return(status);
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:    tz_get_thresholds
+ *
+ * PARAMETERS:  thermal_zone          - Identifies the thermal zone to parse.
+ *              buffer      - Output buffer.
+ *
+ * RETURN:      ACPI_STATUS result code.
+ *
+ * DESCRIPTION: Builds a TZ_THRESHOLD_LIST structure containing information
+ *              on all thresholds for a given thermal zone.
+ *
+ * NOTES:       The current design limits the number of cooling devices
+ *              per theshold to the value specified by BM_MAX_HANDLES.
+ *              This simplifies parsing of thresholds by allowing a maximum
+ *              threshold list size to be computed (and enforced) -- which
+ *              allows all thresholds to be parsed in a single pass (since
+ *              memory must be contiguous when returned in the ACPI_BUFFER).
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+tz_get_thresholds (
+	TZ_CONTEXT              *thermal_zone,
+	TZ_THRESHOLD_LIST       *threshold_list)
+{
+	ACPI_STATUS             status = AE_OK;
+	TZ_THRESHOLD            *threshold = NULL;
+	u32                     i = 0;
+
+	if (!thermal_zone || !threshold_list) {
+		return(AE_BAD_PARAMETER);
+	}
+
+	threshold_list->count = 0;
+
+	/*
+	 * Critical threshold:
+	 * -------------------
+	 * Every thermal zone must have one!
+	 */
+	threshold = &(threshold_list->thresholds[threshold_list->count]);
+	threshold->type = TZ_THRESHOLD_CRITICAL;
+
+	status = tz_get_single_threshold(thermal_zone, threshold);
+	if (ACPI_SUCCESS(status)) {
+		(threshold_list->count)++;
+	}
+	else {
+		return(status);
+	}
+
+
+	/*
+	 * Passive threshold:
+	 * ------------------
+	 */
+	threshold = &(threshold_list->thresholds[threshold_list->count]);
+	threshold->type = TZ_THRESHOLD_PASSIVE;
+
+	status = tz_get_single_threshold(thermal_zone, threshold);
+	if (ACPI_SUCCESS(status)) {
+		(threshold_list->count)++;
+	}
+
+	/*
+	 * Active threshold:
+	 * -----------------
+	 * Note that active thresholds are sorted by index (e.g. _AC0,
+	 * _AC1, ...), and thus from highest (_AC0) to lowest (_AC9)
+	 * temperature.
+	 */
+	for (i = 0; i < TZ_MAX_ACTIVE_THRESHOLDS; i++) {
+
+		threshold = &(threshold_list->thresholds[threshold_list->count]);
+		threshold->type = TZ_THRESHOLD_ACTIVE;
+		threshold->index = i;
+
+		status = tz_get_single_threshold(thermal_zone, threshold);
+		if (ACPI_SUCCESS(status)) {
+			(threshold_list->count)++;
+		}
+		else {
+			threshold->type = TZ_THRESHOLD_UNKNOWN;
+			threshold->index = 0;
+			thermal_zone->policy.active.threshold_count = i;
+			break;
+		}
+	}
+
+	return(AE_OK);
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:    tz_add_device
+ *
+ * PARAMETERS:  <none>
+ *
+ * RETURN:	
+ *
+ * DESCRIPTION:
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+tz_add_device (
+	BM_HANDLE               device_handle,
+	void                    **context)
+{
+	ACPI_STATUS             status = AE_OK;
+	TZ_CONTEXT              *thermal_zone = NULL;
+	BM_DEVICE		*device = NULL;
+	ACPI_HANDLE             tmp_handle = NULL;
+	static u32		zone_count = 0;
+
+	if (!context || *context) {
+		return(AE_BAD_PARAMETER);
+	}
+
+	/*
+	 * Get information on this device.
+	 */
+	status = bm_get_device_info(device_handle, &device);
+	if (ACPI_FAILURE(status)) {
+		return(status);
+	}
+
+	/*
+	 * Allocate a new Thermal Zone device.
+	 */
+	thermal_zone = acpi_os_callocate(sizeof(TZ_CONTEXT));
+	if (!thermal_zone) {
+		return AE_NO_MEMORY;
+	}
+
+	thermal_zone->device_handle = device->handle;
+	thermal_zone->acpi_handle = device->acpi_handle;
+
+	/* TBD: How to manage 'uid' when zones are Pn_p? */
+	sprintf(thermal_zone->uid, "%d", zone_count++);
+
+	/*
+	 * _TMP?
+	 * -----
+	 */
+	status = acpi_get_handle(thermal_zone->acpi_handle, "_TMP",
+		&tmp_handle);
+	if (ACPI_FAILURE(status)) {
+		goto end;
+	}
+
+	/*
+	 * Initialize Policy:
+	 * ------------------
+	 * TBD: Move all thermal zone policy to user-mode daemon...
+	 */
+	status = tz_policy_add_device(thermal_zone);
+	if (ACPI_FAILURE(status)) {
+		goto end;
+	}
+
+	status = tz_osl_add_device(thermal_zone);
+	if (ACPI_FAILURE(status)) {
+		goto end;
+	}
+
+	*context = thermal_zone;
+
+	tz_print(thermal_zone);
+
+end:
+	if (ACPI_FAILURE(status)) {
+		acpi_os_free(thermal_zone);
+	}
+
+	return(status);
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:    tz_remove_device
+ *
+ * PARAMETERS:  <none>
+ *
+ * RETURN:	
+ *
+ * DESCRIPTION:
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+tz_remove_device (
+	void			**context)
+{
+	ACPI_STATUS		status = AE_OK;
+	TZ_CONTEXT		*thermal_zone = NULL;
+
+	if (!context || !*context) {
+		return(AE_BAD_PARAMETER);
+	}
+
+	thermal_zone = (TZ_CONTEXT*)(*context);
+
+	status = tz_osl_remove_device(thermal_zone);
+
+	/*
+	 * Remove Policy:
+	 * --------------
+	 * TBD: Move all thermal zone policy to user-mode daemon...
+	 */
+	status = tz_policy_remove_device(thermal_zone);
+	if (ACPI_FAILURE(status)) {
+		return(status);
+	}
+
+	acpi_os_free(thermal_zone);
+
+	return(status);
+}
+
+
+/****************************************************************************
+ *                            External Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ *
+ * FUNCTION:    tz_initialize
+ *
+ * PARAMETERS:  <none>
+ *
+ * RETURN:	
+ *
+ * DESCRIPTION:
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+tz_initialize (void)
+{
+	ACPI_STATUS             status = AE_OK;
+	BM_DEVICE_ID		criteria;
+	BM_DRIVER		driver;
+
+	MEMSET(&criteria, 0, sizeof(BM_DEVICE_ID));
+	MEMSET(&driver, 0, sizeof(BM_DRIVER));
+
+	/*
+	 * Register driver for thermal zone devices.
+	 */
+	criteria.type = BM_TYPE_THERMAL_ZONE;
+
+	driver.notify = &tz_notify;
+	driver.request = &tz_request;
+
+	status = bm_register_driver(&criteria, &driver);
+
+	return(status);
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:    tz_terminate
+ *
+ * PARAMETERS:  <none>
+ *
+ * RETURN:	
+ *
+ * DESCRIPTION:
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+tz_terminate (void)
+{
+	ACPI_STATUS             status = AE_OK;
+	BM_DEVICE_ID		criteria;
+	BM_DRIVER		driver;
+
+	MEMSET(&criteria, 0, sizeof(BM_DEVICE_ID));
+	MEMSET(&driver, 0, sizeof(BM_DRIVER));
+
+	/*
+	 * Unregister driver for thermal zone devices.
+	 */
+	criteria.type = BM_TYPE_THERMAL_ZONE;
+
+	driver.notify = &tz_notify;
+	driver.request = &tz_request;
+
+	status = bm_unregister_driver(&criteria, &driver);
+
+	return(status);
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:    tz_notify
+ *
+ * PARAMETERS:  <none>
+ *
+ * RETURN:	
+ *
+ * DESCRIPTION:
+ *
+ ****************************************************************************/
+ACPI_STATUS
+tz_notify (
+	BM_NOTIFY               notify_type,
+	BM_HANDLE               device_handle,
+	void                    **context)
+{
+	ACPI_STATUS             status = AE_OK;
+	TZ_CONTEXT		*thermal_zone = NULL;
+
+	if (!context) {
+		return(AE_BAD_PARAMETER);
+	}
+
+	thermal_zone = (TZ_CONTEXT*)*context;
+
+	switch (notify_type) {
+
+	case BM_NOTIFY_DEVICE_ADDED:
+		status = tz_add_device(device_handle, context);
+		break;
+
+	case BM_NOTIFY_DEVICE_REMOVED:
+		status = tz_remove_device(context);
+		break;
+
+	case TZ_NOTIFY_TEMPERATURE_CHANGE:
+		/* -------------------------------------------- */
+		/* TBD: Remove when policy moves to user-mode. */
+		tz_policy_check(*context);
+		/* -------------------------------------------- */
+		status = tz_get_temperature(thermal_zone,
+			&(thermal_zone->policy.temperature));
+		if (ACPI_SUCCESS(status)) {
+			status = tz_osl_generate_event(notify_type,
+				thermal_zone);
+		}
+		break;
+
+	case TZ_NOTIFY_THRESHOLD_CHANGE:
+		/* -------------------------------------------- */
+		/* TBD: Remove when policy moves to user-mode. */
+		status = tz_policy_remove_device(thermal_zone);
+		if (ACPI_SUCCESS(status)) {
+			status = tz_policy_add_device(thermal_zone);
+		}
+		/* -------------------------------------------- */
+		status = tz_osl_generate_event(notify_type, thermal_zone);
+		break;
+
+	case TZ_NOTIFY_DEVICE_LISTS_CHANGE:
+		/* -------------------------------------------- */
+		/* TBD: Remove when policy moves to user-mode. */
+		status = tz_policy_remove_device(thermal_zone);
+		if (ACPI_SUCCESS(status)) {
+			status = tz_policy_add_device(thermal_zone);
+		}
+		/* -------------------------------------------- */
+		status = tz_osl_generate_event(notify_type, thermal_zone);
+		break;
+
+	default:
+		status = AE_SUPPORT;
+		break;
+	}
+
+	return(status);
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:    tz_request
+ *
+ * PARAMETERS:
+ *
+ * RETURN:      Exception code.
+ *
+ * DESCRIPTION:
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+tz_request (
+	BM_REQUEST		*request,
+	void                    *context)
+{
+	ACPI_STATUS             status = AE_OK;
+	TZ_CONTEXT              *thermal_zone = NULL;
+
+	/*
+	 * Must have a valid request structure and context.
+	 */
+	if (!request || !context) {
+		return(AE_BAD_PARAMETER);
+	}
+
+	thermal_zone = (TZ_CONTEXT*)context;
+
+	/*
+	 * Handle request:
+	 * ---------------
+	 */
+	switch (request->command) {
+
+	default:
+		status = AE_SUPPORT;
+		break;
+	}
+
+	request->status = status;
+
+	return(status);
+}
diff -urN linux-2.4.6-pre4/drivers/acpi/ospm/thermal/tz_osl.c linux/drivers/acpi/ospm/thermal/tz_osl.c
--- linux-2.4.6-pre4/drivers/acpi/ospm/thermal/tz_osl.c	Wed Dec 31 16:00:00 1969
+++ linux/drivers/acpi/ospm/thermal/tz_osl.c	Mon Dec  3 22:48:42 2001
@@ -0,0 +1,330 @@
+/******************************************************************************
+ *
+ * Module Name: tz_osl.c
+ *   $Revision: 18 $
+ *
+ *****************************************************************************/
+
+/*
+ *  Copyright (C) 2000, 2001 Andrew Grover
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/types.h>
+#include <linux/proc_fs.h>
+#include <acpi.h>
+#include "tz.h"
+
+
+MODULE_AUTHOR("Andrew Grover");
+MODULE_DESCRIPTION("ACPI Component Architecture (CA) - Thermal Zone Driver");
+
+int TZP = 0;
+MODULE_PARM(TZP, "i");
+MODULE_PARM_DESC(TZP, "Thermal zone polling frequency, in 1/10 seconds.\n");
+
+
+#define TZ_PROC_ROOT		"thermal"
+#define TZ_PROC_STATUS		"status"
+#define TZ_PROC_INFO		"info"
+
+extern struct proc_dir_entry	*bm_proc_root;
+static struct proc_dir_entry	*tz_proc_root = NULL;
+
+
+/****************************************************************************
+ * 
+ * FUNCTION:	tz_osl_proc_read_info
+ *
+ ****************************************************************************/
+
+static int
+tz_osl_proc_read_info (
+	char			*page, 
+	char			**start, 
+	off_t			off, 
+	int 			count, 
+	int 			*eof, 
+	void			*context)
+{
+	TZ_CONTEXT		*thermal_zone = NULL;
+	char			*p = page;
+	int 			len = 0;
+
+	if (!context || (off != 0)) {
+		goto end;
+	}
+
+	thermal_zone = (TZ_CONTEXT*)context;
+
+	p += sprintf(p, "<TBD>\n");
+
+end:
+	len = (p - page);
+	if (len <= off+count) *eof = 1;
+	*start = page + off;
+	len -= off;
+	if (len>count) len = count;
+	if (len<0) len = 0;
+
+	return(len);
+}
+
+
+/****************************************************************************
+ * 
+ * FUNCTION:	tz_osl_proc_read_status
+ *
+ ****************************************************************************/
+
+static int
+tz_osl_proc_read_status (
+	char			*page, 
+	char			**start, 
+	off_t			off, 
+	int 			count, 
+	int 			*eof, 
+	void			*context)
+{
+	TZ_CONTEXT		*thermal_zone = NULL;
+	char			*p = page;
+	int 			len = 0;
+
+	if (!context || (off != 0)) {
+		goto end;
+	}
+
+	thermal_zone = (TZ_CONTEXT*)context;
+
+	p += sprintf(p, "Temperature:             %d (1/10th degrees Kelvin)\n", 
+		thermal_zone->policy.temperature);
+
+	p += sprintf(p, "State:                   ");
+	if (thermal_zone->policy.state & TZ_STATE_ACTIVE) {
+		p += sprintf(p, "active[%d] ", thermal_zone->policy.state & 0x07);
+	}
+	if (thermal_zone->policy.state & TZ_STATE_PASSIVE) {
+		p += sprintf(p, "passive ");
+	}
+	if (thermal_zone->policy.state & TZ_STATE_CRITICAL) {
+		p += sprintf(p, "critical ");
+	}
+	if (thermal_zone->policy.state == 0) {
+		p += sprintf(p, "ok ");
+	}
+	p += sprintf(p, "\n");
+
+	p += sprintf(p, "Cooling Mode:            ");
+	switch (thermal_zone->policy.cooling_mode) {
+	case TZ_COOLING_MODE_ACTIVE:
+		p += sprintf(p, "active (noisy)\n");
+		break;
+	case TZ_COOLING_MODE_PASSIVE:
+		p += sprintf(p, "passive (quiet)\n");
+		break;
+	default:
+		p += sprintf(p, "unknown\n");
+		break;
+	}
+
+	p += sprintf(p, "Polling Frequency:       ");
+	switch (thermal_zone->policy.polling_freq) {
+	case 0:
+		p += sprintf(p, "n/a\n");
+		break;
+	default:
+		p += sprintf(p, "%d (1/10th seconds)\n", thermal_zone->policy.polling_freq);
+		break;
+	}
+
+end:
+	len = (p - page);
+	if (len <= off+count) *eof = 1;
+	*start = page + off;
+	len -= off;
+	if (len>count) len = count;
+	if (len<0) len = 0;
+
+	return(len);
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:	tz_osl_add_device
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+tz_osl_add_device(
+	TZ_CONTEXT		*thermal_zone)
+{
+	struct proc_dir_entry	*proc_entry = NULL;
+
+	if (!thermal_zone) {
+		return(AE_BAD_PARAMETER);
+	}
+
+	printk("Thermal Zone: found\n");
+
+	proc_entry = proc_mkdir(thermal_zone->uid, tz_proc_root);
+	if (!proc_entry) {
+		return(AE_ERROR);
+	}
+
+	create_proc_read_entry(TZ_PROC_STATUS, S_IFREG | S_IRUGO, 
+		proc_entry, tz_osl_proc_read_status, (void*)thermal_zone);
+
+	create_proc_read_entry(TZ_PROC_INFO, S_IFREG | S_IRUGO, 
+		proc_entry, tz_osl_proc_read_info, (void*)thermal_zone);
+
+	return(AE_OK);
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:	tz_osl_remove_device
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+tz_osl_remove_device (
+	TZ_CONTEXT		*thermal_zone)
+{
+	char			proc_entry[64];
+
+	if (!thermal_zone) {
+		return(AE_BAD_PARAMETER);
+	}
+
+	sprintf(proc_entry, "%s/%s", thermal_zone->uid, TZ_PROC_INFO);
+	remove_proc_entry(proc_entry, tz_proc_root);
+
+	sprintf(proc_entry, "%s/%s", thermal_zone->uid, TZ_PROC_STATUS);
+	remove_proc_entry(proc_entry, tz_proc_root);
+
+	sprintf(proc_entry, "%s", thermal_zone->uid);
+	remove_proc_entry(proc_entry, tz_proc_root);
+
+	return(AE_OK);
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:	tz_osl_generate_event
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+tz_osl_generate_event (
+	u32			event,
+	TZ_CONTEXT		*thermal_zone)
+{
+	ACPI_STATUS		status = AE_OK;
+
+	if (!thermal_zone) {
+		return(AE_BAD_PARAMETER);
+	}
+
+	switch (event) {
+
+	case TZ_NOTIFY_TEMPERATURE_CHANGE:
+		status = bm_osl_generate_event(thermal_zone->device_handle, 
+			TZ_PROC_ROOT, thermal_zone->uid, event, 
+			thermal_zone->policy.temperature);
+		break;
+
+	case TZ_NOTIFY_THRESHOLD_CHANGE:
+	case TZ_NOTIFY_DEVICE_LISTS_CHANGE:
+		status = bm_osl_generate_event(thermal_zone->device_handle, 
+			TZ_PROC_ROOT, thermal_zone->uid, event, 0);
+		break;
+
+	default:
+		return(AE_BAD_PARAMETER);
+		break;
+	}
+
+	return(status);
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:	tz_osl_init
+ *
+ * PARAMETERS:	<none>
+ *
+ * RETURN:	0: Success
+ *
+ * DESCRIPTION: Module initialization.
+ *
+ ****************************************************************************/
+
+static int __init 
+tz_osl_init (void)
+{
+	ACPI_STATUS		status = AE_OK;
+
+	tz_proc_root = proc_mkdir(TZ_PROC_ROOT, bm_proc_root);
+	if (!tz_proc_root) {
+		status = AE_ERROR;
+	}
+	else {
+		status = tz_initialize();
+		if (ACPI_FAILURE(status)) {
+			remove_proc_entry(TZ_PROC_ROOT, bm_proc_root);
+		}
+
+	}
+
+	return (ACPI_SUCCESS(status)) ? 0 : -ENODEV;
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:	tz_osl_cleanup
+ *
+ * PARAMETERS:	<none>
+ *
+ * RETURN:	<none>
+ *
+ * DESCRIPTION: Module cleanup.
+ *
+ ****************************************************************************/
+
+static void __exit 
+tz_osl_cleanup (void)
+{
+	tz_terminate();
+
+	if (tz_proc_root) {
+		remove_proc_entry(TZ_PROC_ROOT, bm_proc_root);
+	}
+
+	return;
+}
+
+
+module_init(tz_osl_init);
+module_exit(tz_osl_cleanup);
diff -urN linux-2.4.6-pre4/drivers/acpi/ospm/thermal/tzpolicy.c linux/drivers/acpi/ospm/thermal/tzpolicy.c
--- linux-2.4.6-pre4/drivers/acpi/ospm/thermal/tzpolicy.c	Wed Dec 31 16:00:00 1969
+++ linux/drivers/acpi/ospm/thermal/tzpolicy.c	Mon Dec  3 22:48:42 2001
@@ -0,0 +1,640 @@
+/****************************************************************************
+ *
+ * Module Name: tzpolicy.c -
+ *   $Revision: 27 $
+ *
+ ****************************************************************************/
+
+/*
+ *  Copyright (C) 2000, 2001 Andrew Grover
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+/*
+ * TBD: 1. Move to user-space!
+ *	2. Support ACPI 2.0 items (e.g. _TZD, _HOT).
+ *      3. Support performance-limit control for non-processor devices
+ *         (those listed in _TZD, e.g. graphics).
+ */
+
+/* TBD: Linux specific */
+#include <linux/proc_fs.h>
+#include <linux/sysctl.h>
+#include <linux/pm.h>
+
+#include <acpi.h>
+#include <bm.h>
+#include "tz.h"
+
+
+#define _COMPONENT		ACPI_THERMAL
+	MODULE_NAME		("tzpolicy")
+
+
+/****************************************************************************
+ *                                  Globals
+ ****************************************************************************/
+
+extern int TZP;
+
+void
+tz_policy_run (
+	unsigned long           data);
+
+
+/****************************************************************************
+ *                              Internal Functions
+ ****************************************************************************/
+
+ACPI_STATUS
+set_performance_limit (
+	BM_HANDLE               device_handle,
+	u32			flag)
+{
+	ACPI_STATUS             status;
+	BM_REQUEST              request;
+
+	request.status = AE_OK;
+	request.handle = device_handle;
+	request.command = PR_COMMAND_SET_PERF_LIMIT;
+	request.buffer.length = sizeof(u32);
+	request.buffer.pointer = &flag;
+
+	status = bm_request(&request);
+
+	if (ACPI_FAILURE(status)) {
+		return status;
+	}
+	else {
+		return request.status;
+	}
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:    tz_policy_critical
+ *
+ * PARAMETERS:
+ *
+ * RETURN:
+ *
+ * DESCRIPTION:
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+tz_policy_critical(
+	TZ_CONTEXT		*tz)
+{
+	if (!tz || !tz->policy.critical.threshold) {
+		return(AE_BAD_PARAMETER);
+	}
+
+	if (tz->policy.temperature >=
+		tz->policy.critical.threshold->temperature) {
+		/* TBD:	Need method for calling 'halt' - OSL function? */
+	}
+
+	return(AE_OK);
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:    tz_policy_passive
+ *
+ * PARAMETERS:
+ *
+ * RETURN:
+ *
+ * DESCRIPTION:
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+tz_policy_passive(
+	TZ_CONTEXT		*tz)
+{
+	TZ_PASSIVE_POLICY	*passive = NULL;
+	static u32		last_temperature = 0;
+	s32			trend = 0;
+	u32			i = 0;
+
+	if (!tz || !tz->policy.passive.threshold) {
+		return(AE_BAD_PARAMETER);
+	}
+
+	passive = &(tz->policy.passive);
+
+	if (tz->policy.temperature >= passive->threshold->temperature) {
+		/*
+		 * Thermal trend?
+		 * --------------
+		 * Using the passive cooling equation (see the ACPI
+		 * Specification), calculate the current thermal trend
+		 * (a.k.a. performance delta).
+		 */
+		trend = passive->tc1 *
+			(tz->policy.temperature - last_temperature) +
+			passive->tc2 *
+			(tz->policy.temperature - passive->threshold->temperature);
+
+		last_temperature = tz->policy.temperature;
+
+		/*
+		 * Heating Up?
+		 * -----------
+		 * Decrease thermal performance limit on all passive
+		 * cooling devices (processors).
+		 */
+		if (trend > 0) {
+			for (i=0; i<passive->threshold->cooling_devices.count; i++) {
+				set_performance_limit(
+					passive->threshold->cooling_devices.handles[i],
+					PR_PERF_DEC);
+			}
+		}
+		/*
+		 * Cooling Off?
+		 * ------------
+		 * Increase thermal performance limit on all passive
+		 * cooling devices (processors).
+		 */
+		else if (trend < 0) {
+			for (i=0; i<passive->threshold->cooling_devices.count; i++) {
+				set_performance_limit(
+					passive->threshold->cooling_devices.handles[i],
+					PR_PERF_INC);
+			}
+		}
+	}
+
+	return(AE_OK);
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:    tz_policy_active
+ *
+ * PARAMETERS:
+ *
+ * RETURN:
+ *
+ * DESCRIPTION:
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+tz_policy_active(
+	TZ_CONTEXT              *tz)
+{
+	ACPI_STATUS             status = AE_OK;
+	TZ_THRESHOLD            *active = NULL;
+	u32                     i,j = 0;
+
+	if (!tz || !tz->policy.active.threshold) {
+		return(AE_BAD_PARAMETER);
+	}
+
+	for (i = 0; i < TZ_MAX_ACTIVE_THRESHOLDS; i++) {
+
+		active = tz->policy.active.threshold[i];
+		if (!active) {
+			break;
+		}
+
+		/*
+		 * Above Threshold?
+		 * ----------------
+		 * If not already enabled, turn ON all cooling devices
+		 * associated with this active threshold.
+		 */
+		if ((tz->policy.temperature >= active->temperature) &&
+			(active->cooling_state != TZ_COOLING_ENABLED)) {
+
+			for (j = 0; j < active->cooling_devices.count; j++) {
+
+				status = bm_set_device_power_state(
+					active->cooling_devices.handles[j],
+					ACPI_STATE_D0);
+
+				if (ACPI_SUCCESS(status)) {
+				}
+				else {
+				}
+			}
+
+			active->cooling_state = TZ_COOLING_ENABLED;
+		}
+		/*
+		 * Below Threshold?
+		 * ----------------
+		 * Turn OFF all cooling devices associated with this
+		 * threshold.  Note that by checking "if not disabled" we
+		 * turn off all cooling devices for thresholds in the
+		 * TZ_COOLING_STATE_UNKNOWN state, useful as a level-set
+		 * during the first pass.
+		 */
+		else if (active->cooling_state != TZ_COOLING_DISABLED) {
+
+			for (j = 0; j < active->cooling_devices.count; j++) {
+
+				status = bm_set_device_power_state(
+					active->cooling_devices.handles[j],
+					ACPI_STATE_D3);
+
+				if (ACPI_SUCCESS(status)) {
+				}
+				else {
+				}
+			}
+
+			active->cooling_state = TZ_COOLING_DISABLED;
+		}
+	}
+
+	return(AE_OK);
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:    tz_policy_check
+ *
+ * PARAMETERS:
+ *
+ * RETURN:
+ *
+ * DESCRIPTION: Note that this function will get called whenever:
+ *                1. A thermal event occurs.
+ *                2. The polling/sampling time period expires.
+ *
+ ****************************************************************************/
+
+void
+tz_policy_check (
+	void                    *context)
+{
+	ACPI_STATUS             status = AE_OK;
+	TZ_CONTEXT              *tz = NULL;
+	u32                     previous_temperature = 0;
+	u32                     previous_state = 0;
+	u32                     active_index = 0;
+	u32                     i = 0;
+	u32                     sleep_time = 0;
+
+	if (!context) {
+		return;
+	}
+
+	tz = (TZ_CONTEXT*)context;
+
+	/*
+	 * Preserve Previous State:
+	 * ------------------------
+	 */
+	previous_temperature = tz->policy.temperature;
+	previous_state = tz->policy.state;
+
+	/*
+	 * Get Temperature:
+	 * ----------------
+	 */
+	status = tz_get_temperature(tz, &(tz->policy.temperature));
+	if (ACPI_FAILURE(status)) {
+		return;
+	}
+
+	/*
+	 * Calculate State:
+	 * ----------------
+	 */
+	tz->policy.state = TZ_STATE_OK;
+
+	/* Critical? */
+	if ((tz->policy.critical.threshold) &&
+		(tz->policy.temperature >= tz->policy.critical.threshold->temperature)) {
+		tz->policy.state |= TZ_STATE_CRITICAL;
+	}
+
+	/* Passive? */
+	if ((tz->policy.passive.threshold) &&
+		(tz->policy.temperature >= tz->policy.passive.threshold->temperature)) {
+		tz->policy.state |= TZ_STATE_PASSIVE;
+	}
+
+	/* Active? */
+	if (tz->policy.active.threshold[0]) {
+		for (i=0; i<tz->policy.active.threshold_count; i++) {
+			if ((tz->policy.active.threshold[i]) &&
+				(tz->policy.temperature >= tz->policy.active.threshold[i]->temperature)) {
+			    tz->policy.state |= TZ_STATE_ACTIVE;
+			    if (tz->policy.active.threshold[i]->index > active_index) {
+				    active_index = tz->policy.active.threshold[i]->index;
+			    }
+			}
+		}
+		tz->policy.state |= active_index;
+	}
+
+	/*
+	 * Invoke Policy:
+	 * --------------
+	 * Note that policy must be invoked both when 'going into' a
+	 * policy state (e.g. to allow fans to be turned on) and 'going
+	 * out of' a policy state (e.g. to allow fans to be turned off);
+	 * thus we must preserve the previous state.
+	 */
+	if (tz->policy.state & TZ_STATE_CRITICAL) {
+		tz_policy_critical(tz);
+	}
+	if ((tz->policy.state & TZ_STATE_PASSIVE) ||
+		(previous_state & TZ_STATE_PASSIVE)) {
+		tz_policy_passive(tz);
+	}
+	if ((tz->policy.state & TZ_STATE_ACTIVE) ||
+		(previous_state & TZ_STATE_ACTIVE)) {
+		tz_policy_active(tz);
+	}
+
+	/*
+	 * Calculate Sleep Time:
+	 * ---------------------
+	 * If we're in the passive state, use _TSP's value.  Otherwise
+	 * use _TZP or the OS's default polling frequency.  If no polling
+	 * frequency is specified then we'll wait forever (that is, until
+	 * a thermal event occurs -- e.g. never poll).  Note that _TSP
+	 * and _TZD values are given in 1/10th seconds.
+	 */
+	if (tz->policy.state & TZ_STATE_PASSIVE) {
+		sleep_time = tz->policy.passive.tsp * 100;
+	}
+	else if (tz->policy.polling_freq > 0) {
+		sleep_time = tz->policy.polling_freq * 100;
+	}
+	else {
+		sleep_time = WAIT_FOREVER;
+	}
+
+
+	/*
+	 * Schedule Next Poll:
+	 * -------------------
+	 */
+	if (sleep_time < WAIT_FOREVER) {
+		if (timer_pending(&(tz->policy.timer))) {
+			mod_timer(&(tz->policy.timer),
+				(HZ*sleep_time)/1000);
+		}
+		else {
+			tz->policy.timer.data = (u32)tz;
+			tz->policy.timer.function = tz_policy_run;
+			tz->policy.timer.expires =
+				jiffies + (HZ*sleep_time)/1000;
+			add_timer(&(tz->policy.timer));
+		}
+	}
+	else {
+		if (timer_pending(&(tz->policy.timer))) {
+			del_timer(&(tz->policy.timer));
+		}
+	}
+
+	return;
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:    tz_policy_run
+ *
+ * PARAMETERS:
+ *
+ * RETURN:
+ *
+ * DESCRIPTION:
+ *
+ ****************************************************************************/
+
+void
+tz_policy_run (
+	unsigned long           data)
+{
+	ACPI_STATUS             status = AE_OK;
+
+	if (!data) {
+		return;
+	}
+
+	/*
+	 * Defer to Non-Interrupt Level:
+	 * -----------------------------
+	 * Note that all Linux kernel timers run at interrupt-level (ack!).
+	 */
+	status = acpi_os_queue_for_execution(OSD_PRIORITY_GPE,
+		tz_policy_check, (void*)data);
+	if (ACPI_FAILURE(status)) {
+	}
+
+	return;
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:    tz_policy_add_device
+ *
+ * PARAMETERS:
+ *
+ * RETURN:	
+ *
+ * DESCRIPTION:
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+tz_policy_add_device (
+	TZ_CONTEXT		*tz)
+{
+	ACPI_STATUS             status = AE_OK;
+	TZ_THRESHOLD            *threshold = NULL;
+	u32                     i,j = 0;
+
+	if (!tz) {
+		return(AE_BAD_PARAMETER);
+	}
+
+	/*
+	 * Temperature:
+	 * ------------
+	 * Make sure we can read the zone's current temperature (_TMP).
+	 * If we can't, there's no use in doing any policy (abort).
+	 */
+	status = tz_get_temperature(tz, &(tz->policy.temperature));
+	if (ACPI_FAILURE(status)) {
+		return(status);
+	}
+
+	/*
+	 * Polling Frequency:
+	 * ------------------
+	 * If a _TZP object doesn't exist, use the OS default polling
+	 * frequency.
+	 */
+	status = bm_evaluate_simple_integer(tz->acpi_handle, "_TZP",
+		&(tz->policy.polling_freq));
+	if (ACPI_FAILURE(status)) {
+		tz->policy.polling_freq = TZP;
+	}
+	status = AE_OK;
+
+	/*
+	 * Get Thresholds:
+	 * ---------------
+	 * Get all of the zone's thresholds, parse, and organize for
+	 * later use.
+	 */
+	status = tz_get_thresholds(tz, &(tz->policy.threshold_list));
+	if (ACPI_FAILURE(status)) {
+		return(status);
+	}
+
+	/*
+	 * Initialize Policies:
+	 * --------------------
+	 */
+	for (i = 0; i < tz->policy.threshold_list.count; i++) {
+
+		threshold = &(tz->policy.threshold_list.thresholds[i]);
+
+		switch (threshold->type) {
+
+		case TZ_THRESHOLD_CRITICAL:
+			tz->policy.critical.threshold = threshold;
+			break;
+
+		case TZ_THRESHOLD_PASSIVE:
+
+			/*
+			 * Set thermal performance limit on all processors
+			 * to max.
+			 */
+			for (j=0; j<threshold->cooling_devices.count; j++) {
+				set_performance_limit(
+					threshold->cooling_devices.handles[j],
+					PR_PERF_MAX);
+			}
+
+			/*
+			 * Get passive cooling constants.
+			 */
+			status = bm_evaluate_simple_integer(tz->acpi_handle,
+				"_TC1", &(tz->policy.passive.tc1));
+			if (ACPI_FAILURE(status)) {
+				break;
+			}
+
+			status = bm_evaluate_simple_integer(tz->acpi_handle,
+				"_TC2", &(tz->policy.passive.tc2));
+			if (ACPI_FAILURE(status)) {
+				break;
+			}
+
+			status = bm_evaluate_simple_integer(tz->acpi_handle,
+				"_TSP", &(tz->policy.passive.tsp));
+			if (ACPI_FAILURE(status)) {
+				break;
+			}
+
+			tz->policy.passive.threshold = threshold;
+
+			tz_policy_passive(tz);
+
+			break;
+
+		case TZ_THRESHOLD_ACTIVE:
+			tz->policy.active.threshold[threshold->index] = threshold;
+			tz_policy_active(tz);
+			break;
+		}
+	}
+
+	if (ACPI_FAILURE(status)) {
+		return(status);
+	}
+
+	/*
+	 * Initialize Policy Timer:
+	 * ------------------------
+	 * TBD: Linux-specific - remove when policy moves to user-space.
+	 */
+	init_timer(&(tz->policy.timer));
+
+	/*
+	 * Start Policy:
+	 * -------------
+	 * Run an initial check using this zone's policy.
+	 */
+	tz_policy_check(tz);
+
+	return(status);
+}
+
+
+/*****************************************************************************
+ *
+ * FUNCTION:    tz_policy_remove_device
+ *
+ * PARAMETERS:
+ *
+ * RETURN:	
+ *
+ * DESCRIPTION:
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+tz_policy_remove_device(
+	TZ_CONTEXT		*tz)
+{
+	u32			i = 0;
+
+	if (!tz) {
+		return(AE_BAD_PARAMETER);
+	}
+
+	/*
+	 * Delete the thermal zone policy timer entry, if exists.
+	 */
+	if (timer_pending(&(tz->policy.timer))) {
+		del_timer(&(tz->policy.timer));
+	}
+
+	/*
+	 * Reset thermal performance limit on all processors back to max.
+	 */
+	if (tz->policy.passive.threshold) {
+		for (i=0; i<tz->policy.passive.threshold->cooling_devices.count; i++) {
+			set_performance_limit(
+				tz->policy.passive.threshold->cooling_devices.handles[i],
+				PR_PERF_MAX);
+		}
+	}
+
+	return(AE_OK);
+}
diff -urN linux-2.4.6-pre4/drivers/acpi/parser/Makefile linux/drivers/acpi/parser/Makefile
--- linux-2.4.6-pre4/drivers/acpi/parser/Makefile	Fri Dec 29 14:07:21 2000
+++ linux/drivers/acpi/parser/Makefile	Mon Dec  3 22:48:42 2001
@@ -1,16 +1,12 @@
 #
 # Makefile for all Linux ACPI interpreter subdirectories
+# EXCEPT for the ospm directory
 #
 
-O_TARGET := ../$(shell basename `pwd`).o
+O_TARGET := $(notdir $(CURDIR)).o
 
 obj-$(CONFIG_ACPI) := $(patsubst %.c,%.o,$(wildcard *.c))
 
-EXTRA_CFLAGS += -I../include
-
 EXTRA_CFLAGS += $(ACPI_CFLAGS)
 
 include $(TOPDIR)/Rules.make
-
-clean:
-	$(RM) *.o 
diff -urN linux-2.4.6-pre4/drivers/acpi/parser/psargs.c linux/drivers/acpi/parser/psargs.c
--- linux-2.4.6-pre4/drivers/acpi/parser/psargs.c	Mon Jan 22 13:23:43 2001
+++ linux/drivers/acpi/parser/psargs.c	Mon Dec  3 22:48:42 2001
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: psargs - Parse AML opcode arguments
- *              $Revision: 43 $
+ *              $Revision: 47 $
  *
  *****************************************************************************/
 
@@ -29,7 +29,7 @@
 #include "amlcode.h"
 #include "acnamesp.h"
 
-#define _COMPONENT          PARSER
+#define _COMPONENT          ACPI_PARSER
 	 MODULE_NAME         ("psargs")
 
 
@@ -58,8 +58,7 @@
 	parser_state->aml++;
 
 
-	switch (encoded_length >> 6) /* bits 6-7 contain encoding scheme */
-	{
+	switch (encoded_length >> 6) /* bits 6-7 contain encoding scheme */ {
 	case 0: /* 1-byte encoding (bits 0-5) */
 
 		length = (encoded_length & 0x3F);
@@ -158,8 +157,7 @@
 
 	/* Decode the path */
 
-	switch (GET8 (end))
-	{
+	switch (GET8 (end)) {
 	case 0:
 
 		/* Null_name */
@@ -244,7 +242,7 @@
 	if (!path || !method_call) {
 		/* Null name case, create a null namepath object */
 
-		acpi_ps_init_op (arg, AML_NAMEPATH_OP);
+		acpi_ps_init_op (arg, AML_INT_NAMEPATH_OP);
 		arg->value.name = path;
 		return;
 	}
@@ -272,11 +270,11 @@
 
 				count = acpi_ps_get_arg (op, 0);
 				if (count && count->opcode == AML_BYTE_OP) {
-					name_op = acpi_ps_alloc_op (AML_NAMEPATH_OP);
+					name_op = acpi_ps_alloc_op (AML_INT_NAMEPATH_OP);
 					if (name_op) {
 						/* Change arg into a METHOD CALL and attach the name */
 
-						acpi_ps_init_op (arg, AML_METHODCALL_OP);
+						acpi_ps_init_op (arg, AML_INT_METHODCALL_OP);
 
 						name_op->value.name = path;
 
@@ -308,7 +306,7 @@
 	 * pathname
 	 */
 
-	acpi_ps_init_op (arg, AML_NAMEPATH_OP);
+	acpi_ps_init_op (arg, AML_INT_NAMEPATH_OP);
 	arg->value.name = path;
 
 
@@ -338,7 +336,7 @@
 	if (!path || !method_call) {
 		/* Null name case, create a null namepath object */
 
-		acpi_ps_init_op (arg, AML_NAMEPATH_OP);
+		acpi_ps_init_op (arg, AML_INT_NAMEPATH_OP);
 		arg->value.name = path;
 		return;
 	}
@@ -367,11 +365,11 @@
 		if (ACPI_SUCCESS (status)) {
 			if (node->type == ACPI_TYPE_METHOD) {
 				method_node = node;
-				name_op = acpi_ps_alloc_op (AML_NAMEPATH_OP);
+				name_op = acpi_ps_alloc_op (AML_INT_NAMEPATH_OP);
 				if (name_op) {
 					/* Change arg into a METHOD CALL and attach name to it */
 
-					acpi_ps_init_op (arg, AML_METHODCALL_OP);
+					acpi_ps_init_op (arg, AML_INT_METHODCALL_OP);
 
 					name_op->value.name = path;
 
@@ -404,7 +402,7 @@
 	 * pathname.
 	 */
 
-	acpi_ps_init_op (arg, AML_NAMEPATH_OP);
+	acpi_ps_init_op (arg, AML_INT_NAMEPATH_OP);
 	arg->value.name = path;
 
 
@@ -435,8 +433,7 @@
 {
 
 
-	switch (arg_type)
-	{
+	switch (arg_type) {
 
 	case ARGP_BYTEDATA:
 
@@ -483,7 +480,7 @@
 	case ARGP_NAME:
 	case ARGP_NAMESTRING:
 
-		acpi_ps_init_op (arg, AML_NAMEPATH_OP);
+		acpi_ps_init_op (arg, AML_INT_NAMEPATH_OP);
 		arg->value.name = acpi_ps_get_next_namestring (parser_state);
 		break;
 	}
@@ -508,7 +505,7 @@
 acpi_ps_get_next_field (
 	ACPI_PARSE_STATE        *parser_state)
 {
-	ACPI_PTRDIFF            aml_offset = parser_state->aml -
+	u32                     aml_offset = parser_state->aml -
 			 parser_state->aml_start;
 	ACPI_PARSE_OBJECT       *field;
 	u16                     opcode;
@@ -517,25 +514,24 @@
 
 	/* determine field type */
 
-	switch (GET8 (parser_state->aml))
-	{
+	switch (GET8 (parser_state->aml)) {
 
 	default:
 
-		opcode = AML_NAMEDFIELD_OP;
+		opcode = AML_INT_NAMEDFIELD_OP;
 		break;
 
 
 	case 0x00:
 
-		opcode = AML_RESERVEDFIELD_OP;
+		opcode = AML_INT_RESERVEDFIELD_OP;
 		parser_state->aml++;
 		break;
 
 
 	case 0x01:
 
-		opcode = AML_ACCESSFIELD_OP;
+		opcode = AML_INT_ACCESSFIELD_OP;
 		parser_state->aml++;
 		break;
 	}
@@ -549,9 +545,8 @@
 
 		/* Decode the field type */
 
-		switch (opcode)
-		{
-		case AML_NAMEDFIELD_OP:
+		switch (opcode) {
+		case AML_INT_NAMEDFIELD_OP:
 
 			/* Get the 4-character name */
 
@@ -565,7 +560,7 @@
 			break;
 
 
-		case AML_RESERVEDFIELD_OP:
+		case AML_INT_RESERVEDFIELD_OP:
 
 			/* Get the length which is encoded as a package length */
 
@@ -573,7 +568,7 @@
 			break;
 
 
-		case AML_ACCESSFIELD_OP:
+		case AML_INT_ACCESSFIELD_OP:
 
 			/* Get Access_type and Access_atrib and merge into the field Op */
 
@@ -616,8 +611,7 @@
 	u32                     subop;
 
 
-	switch (arg_type)
-	{
+	switch (arg_type) {
 	case ARGP_BYTEDATA:
 	case ARGP_WORDDATA:
 	case ARGP_DWORDDATA:
@@ -676,7 +670,7 @@
 		if (parser_state->aml < parser_state->pkg_end) {
 			/* non-empty list */
 
-			arg = acpi_ps_alloc_op (AML_BYTELIST_OP);
+			arg = acpi_ps_alloc_op (AML_INT_BYTELIST_OP);
 			if (arg) {
 				/* fill in bytelist data */
 
@@ -692,16 +686,14 @@
 
 
 	case ARGP_TARGET:
-	case ARGP_SUPERNAME:
-		{
+	case ARGP_SUPERNAME: {
 			subop = acpi_ps_peek_opcode (parser_state);
 			if (subop == 0              ||
 				acpi_ps_is_leading_char (subop) ||
-				acpi_ps_is_prefix_char (subop))
-			{
+				acpi_ps_is_prefix_char (subop)) {
 				/* Null_name or Name_string */
 
-				arg = acpi_ps_alloc_op (AML_NAMEPATH_OP);
+				arg = acpi_ps_alloc_op (AML_INT_NAMEPATH_OP);
 				if (arg) {
 					acpi_ps_get_next_namepath (parser_state, arg, arg_count, 0);
 				}
diff -urN linux-2.4.6-pre4/drivers/acpi/parser/psfind.c linux/drivers/acpi/parser/psfind.c
--- linux-2.4.6-pre4/drivers/acpi/parser/psfind.c	Wed Dec 31 16:00:00 1969
+++ linux/drivers/acpi/parser/psfind.c	Mon Dec  3 22:48:42 2001
@@ -0,0 +1,313 @@
+
+/******************************************************************************
+ *
+ * Module Name: psfind - Parse tree search routine
+ *              $Revision: 24 $
+ *
+ *****************************************************************************/
+
+/*
+ *  Copyright (C) 2000, 2001 R. Byron Moore
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#include "acpi.h"
+#include "acparser.h"
+#include "amlcode.h"
+
+#define _COMPONENT          ACPI_PARSER
+	 MODULE_NAME         ("psfind")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ps_get_parent
+ *
+ * PARAMETERS:  Op              - Get the parent of this Op
+ *
+ * RETURN:      The Parent op.
+ *
+ * DESCRIPTION: Get op's parent
+ *
+ ******************************************************************************/
+
+static ACPI_PARSE_OBJECT*
+acpi_ps_get_parent (
+	ACPI_PARSE_OBJECT       *op)
+{
+	ACPI_PARSE_OBJECT       *parent = op;
+
+
+	/* Traverse the tree upward (to root if necessary) */
+
+	while (parent) {
+		switch (parent->opcode) {
+		case AML_SCOPE_OP:
+		case AML_PACKAGE_OP:
+		case AML_METHOD_OP:
+		case AML_DEVICE_OP:
+		case AML_POWER_RES_OP:
+		case AML_THERMAL_ZONE_OP:
+
+			return (parent->parent);
+		}
+
+		parent = parent->parent;
+	}
+
+	return (parent);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ps_find_name
+ *
+ * PARAMETERS:  Scope           - Scope to search
+ *              Name            - ACPI name to search for
+ *              Opcode          - Opcode to search for
+ *
+ * RETURN:      Op containing the name
+ *
+ * DESCRIPTION: Find name segment from a list of acpi_ops.  Searches a single
+ *              scope, no more.
+ *
+ ******************************************************************************/
+
+static ACPI_PARSE_OBJECT *
+acpi_ps_find_name (
+	ACPI_PARSE_OBJECT       *scope,
+	u32                     name,
+	u32                     opcode)
+{
+	ACPI_PARSE_OBJECT       *op;
+	ACPI_PARSE_OBJECT       *field;
+
+
+	/* search scope level for matching name segment */
+
+	op = acpi_ps_get_child (scope);
+
+	while (op) {
+
+		if (acpi_ps_is_field_op (op->opcode)) {
+			/* Field, search named fields */
+
+			field = acpi_ps_get_child (op);
+			while (field) {
+				if (acpi_ps_is_named_op (field->opcode) &&
+				   acpi_ps_get_name (field) == name &&
+				   (!opcode || field->opcode == opcode)) {
+					return (field);
+				}
+
+				field = field->next;
+			}
+		}
+
+		else if (acpi_ps_is_create_field_op (op->opcode)) {
+			if (op->opcode == AML_CREATE_FIELD_OP) {
+				field = acpi_ps_get_arg (op, 3);
+			}
+
+			else {
+				/* Create_xXXField, check name */
+
+				field = acpi_ps_get_arg (op, 2);
+			}
+
+			if ((field) &&
+				(field->value.string) &&
+				(!STRNCMP (field->value.string, (char *) &name, ACPI_NAME_SIZE))) {
+				return (op);
+			}
+		}
+
+		else if ((acpi_ps_is_named_op (op->opcode)) &&
+				 (acpi_ps_get_name (op) == name) &&
+				 (!opcode || op->opcode == opcode || opcode == AML_SCOPE_OP)) {
+			break;
+		}
+
+		op = op->next;
+	}
+
+	return (op);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ps_find
+ *
+ * PARAMETERS:  Scope           - Where to begin the search
+ *              Path            - ACPI Path to the named object
+ *              Opcode          - Opcode associated with the object
+ *              Create          - if TRUE, create the object if not found.
+ *
+ * RETURN:      Op if found, NULL otherwise.
+ *
+ * DESCRIPTION: Find object within scope
+ *
+ ******************************************************************************/
+
+ACPI_PARSE_OBJECT*
+acpi_ps_find (
+	ACPI_PARSE_OBJECT       *scope,
+	NATIVE_CHAR             *path,
+	u16                     opcode,
+	u32                     create)
+{
+	u32                     seg_count;
+	u32                     name;
+	u32                     name_op;
+	ACPI_PARSE_OBJECT       *op = NULL;
+	u8                      unprefixed = TRUE;
+
+
+	if (!scope || !path) {
+		return (NULL);
+	}
+
+
+	acpi_gbl_ps_find_count++;
+
+
+	/* Handle all prefixes in the name path */
+
+	while (acpi_ps_is_prefix_char (GET8 (path))) {
+		switch (GET8 (path)) {
+
+		case '\\':
+
+			/* Could just use a global for "root scope" here */
+
+			while (scope->parent) {
+				scope = scope->parent;
+			}
+
+			/* get first object within the scope */
+			/* TBD: [Investigate] OR - set next in root scope to point to the same value as arg */
+
+			/* Scope = Scope->Value.Arg; */
+
+			break;
+
+
+		case '^':
+
+			/* Go up to the next valid scoping Op (method, scope, etc.) */
+
+			if (acpi_ps_get_parent (scope)) {
+				scope = acpi_ps_get_parent (scope);
+			}
+
+			break;
+		}
+
+		unprefixed = FALSE;
+		path++;
+	}
+
+	/* get name segment count */
+
+	switch (GET8 (path)) {
+	case '\0':
+		seg_count = 0;
+
+		/* Null name case */
+
+		if (unprefixed) {
+			op = NULL;
+		}
+		else {
+			op = scope;
+		}
+
+
+		return (op);
+		break;
+
+	case AML_DUAL_NAME_PREFIX:
+		seg_count = 2;
+		path++;
+		break;
+
+	case AML_MULTI_NAME_PREFIX_OP:
+		seg_count = GET8 (path + 1);
+		path += 2;
+		break;
+
+	default:
+		seg_count = 1;
+		break;
+	}
+
+	/* match each name segment */
+
+	while (scope && seg_count) {
+		MOVE_UNALIGNED32_TO_32 (&name, path);
+		path += 4;
+		seg_count --;
+
+		if (seg_count) {
+			name_op = 0;
+		}
+		else {
+			name_op = opcode;
+		}
+
+		op = acpi_ps_find_name (scope, name, name_op);
+
+		if (!op) {
+			if (create) {
+				/* Create a new Scope level */
+
+				if (seg_count) {
+					op = acpi_ps_alloc_op (AML_SCOPE_OP);
+				}
+				else {
+					op = acpi_ps_alloc_op (opcode);
+				}
+
+				if (op) {
+					acpi_ps_set_name (op, name);
+					acpi_ps_append_arg (scope, op);
+
+				}
+			}
+
+			else if (unprefixed) {
+				/* Search higher scopes for unprefixed name */
+
+				while (!op && scope->parent) {
+					scope = scope->parent;
+					op = acpi_ps_find_name (scope, name, opcode);
+
+				}
+			}
+
+		}
+
+		unprefixed = FALSE;
+		scope = op;
+	}
+
+	return (op);
+}
+
+
diff -urN linux-2.4.6-pre4/drivers/acpi/parser/psopcode.c linux/drivers/acpi/parser/psopcode.c
--- linux-2.4.6-pre4/drivers/acpi/parser/psopcode.c	Mon Jan 22 13:23:43 2001
+++ linux/drivers/acpi/parser/psopcode.c	Mon Dec  3 22:48:42 2001
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: psopcode - Parser opcode information table
- *              $Revision: 27 $
+ *              $Revision: 32 $
  *
  *****************************************************************************/
 
@@ -29,7 +29,7 @@
 #include "amlcode.h"
 
 
-#define _COMPONENT          PARSER
+#define _COMPONENT          ACPI_PARSER
 	 MODULE_NAME         ("psopcode")
 
 
@@ -130,12 +130,12 @@
 #define ARGP_SIZE_OF_OP                 ARGP_LIST1 (ARGP_SUPERNAME)
 #define ARGP_INDEX_OP                   ARGP_LIST3 (ARGP_TERMARG,    ARGP_TERMARG,       ARGP_TARGET)
 #define ARGP_MATCH_OP                   ARGP_LIST6 (ARGP_TERMARG,    ARGP_BYTEDATA,      ARGP_TERMARG,   ARGP_BYTEDATA,  ARGP_TERMARG,   ARGP_TERMARG)
-#define ARGP_DWORD_FIELD_OP             ARGP_LIST3 (ARGP_TERMARG,    ARGP_TERMARG,       ARGP_NAME)
-#define ARGP_WORD_FIELD_OP              ARGP_LIST3 (ARGP_TERMARG,    ARGP_TERMARG,       ARGP_NAME)
-#define ARGP_BYTE_FIELD_OP              ARGP_LIST3 (ARGP_TERMARG,    ARGP_TERMARG,       ARGP_NAME)
-#define ARGP_BIT_FIELD_OP               ARGP_LIST3 (ARGP_TERMARG,    ARGP_TERMARG,       ARGP_NAME)
+#define ARGP_CREATE_DWORD_FIELD_OP      ARGP_LIST3 (ARGP_TERMARG,    ARGP_TERMARG,       ARGP_NAME)
+#define ARGP_CREATE_WORD_FIELD_OP       ARGP_LIST3 (ARGP_TERMARG,    ARGP_TERMARG,       ARGP_NAME)
+#define ARGP_CREATE_BYTE_FIELD_OP       ARGP_LIST3 (ARGP_TERMARG,    ARGP_TERMARG,       ARGP_NAME)
+#define ARGP_CREATE_BIT_FIELD_OP        ARGP_LIST3 (ARGP_TERMARG,    ARGP_TERMARG,       ARGP_NAME)
 #define ARGP_TYPE_OP                    ARGP_LIST1 (ARGP_SUPERNAME)
-#define ARGP_QWORD_FIELD_OP             ARGP_LIST3 (ARGP_TERMARG,    ARGP_TERMARG,       ARGP_NAME)
+#define ARGP_CREATE_QWORD_FIELD_OP      ARGP_LIST3 (ARGP_TERMARG,    ARGP_TERMARG,       ARGP_NAME)
 #define ARGP_LAND_OP                    ARGP_LIST2 (ARGP_TERMARG,    ARGP_TERMARG)
 #define ARGP_LOR_OP                     ARGP_LIST2 (ARGP_TERMARG,    ARGP_TERMARG)
 #define ARGP_LNOT_OP                    ARGP_LIST1 (ARGP_TERMARG)
@@ -178,7 +178,7 @@
 #define ARGP_DEBUG_OP                   ARG_NONE
 #define ARGP_FATAL_OP                   ARGP_LIST3 (ARGP_BYTEDATA,   ARGP_DWORDDATA,     ARGP_TERMARG)
 #define ARGP_REGION_OP                  ARGP_LIST4 (ARGP_NAME,       ARGP_BYTEDATA,      ARGP_TERMARG,   ARGP_TERMARG)
-#define ARGP_DEF_FIELD_OP               ARGP_LIST4 (ARGP_PKGLENGTH,  ARGP_NAMESTRING,    ARGP_BYTEDATA,  ARGP_FIELDLIST)
+#define ARGP_FIELD_OP                   ARGP_LIST4 (ARGP_PKGLENGTH,  ARGP_NAMESTRING,    ARGP_BYTEDATA,  ARGP_FIELDLIST)
 #define ARGP_DEVICE_OP                  ARGP_LIST3 (ARGP_PKGLENGTH,  ARGP_NAME,          ARGP_OBJLIST)
 #define ARGP_PROCESSOR_OP               ARGP_LIST6 (ARGP_PKGLENGTH,  ARGP_NAME,          ARGP_BYTEDATA,  ARGP_DWORDDATA, ARGP_BYTEDATA,  ARGP_OBJLIST)
 #define ARGP_POWER_RES_OP               ARGP_LIST5 (ARGP_PKGLENGTH,  ARGP_NAME,          ARGP_BYTEDATA,  ARGP_WORDDATA,  ARGP_OBJLIST)
@@ -202,7 +202,7 @@
  * All AML opcodes and the runtime arguments for each.  Used by the AML interpreter  Each list is compressed
  * into a 32-bit number and stored in the master opcode table at the end of this file.
  *
- * (Used by Acpi_aml_prep_operands procedure and the ASL Compiler)
+ * (Used by Prep_operands procedure and the ASL Compiler)
  */
 
 #define ARGI_ZERO_OP                    ARG_NONE
@@ -260,12 +260,12 @@
 #define ARGI_SIZE_OF_OP                 ARGI_LIST1 (ARGI_DATAOBJECT)
 #define ARGI_INDEX_OP                   ARGI_LIST3 (ARGI_COMPLEXOBJ, ARGI_INTEGER,       ARGI_TARGETREF)
 #define ARGI_MATCH_OP                   ARGI_LIST6 (ARGI_PACKAGE,    ARGI_INTEGER,       ARGI_INTEGER,      ARGI_INTEGER,   ARGI_INTEGER,   ARGI_INTEGER)
-#define ARGI_DWORD_FIELD_OP             ARGI_LIST3 (ARGI_BUFFER,     ARGI_INTEGER,       ARGI_REFERENCE)
-#define ARGI_WORD_FIELD_OP              ARGI_LIST3 (ARGI_BUFFER,     ARGI_INTEGER,       ARGI_REFERENCE)
-#define ARGI_BYTE_FIELD_OP              ARGI_LIST3 (ARGI_BUFFER,     ARGI_INTEGER,       ARGI_REFERENCE)
-#define ARGI_BIT_FIELD_OP               ARGI_LIST3 (ARGI_BUFFER,     ARGI_INTEGER,       ARGI_REFERENCE)
+#define ARGI_CREATE_DWORD_FIELD_OP      ARGI_LIST3 (ARGI_BUFFER,     ARGI_INTEGER,       ARGI_REFERENCE)
+#define ARGI_CREATE_WORD_FIELD_OP       ARGI_LIST3 (ARGI_BUFFER,     ARGI_INTEGER,       ARGI_REFERENCE)
+#define ARGI_CREATE_BYTE_FIELD_OP       ARGI_LIST3 (ARGI_BUFFER,     ARGI_INTEGER,       ARGI_REFERENCE)
+#define ARGI_CREATE_BIT_FIELD_OP        ARGI_LIST3 (ARGI_BUFFER,     ARGI_INTEGER,       ARGI_REFERENCE)
 #define ARGI_TYPE_OP                    ARGI_LIST1 (ARGI_ANYTYPE)
-#define ARGI_QWORD_FIELD_OP             ARGI_LIST3 (ARGI_BUFFER,     ARGI_INTEGER,       ARGI_REFERENCE)
+#define ARGI_CREATE_QWORD_FIELD_OP      ARGI_LIST3 (ARGI_BUFFER,     ARGI_INTEGER,       ARGI_REFERENCE)
 #define ARGI_LAND_OP                    ARGI_LIST2 (ARGI_INTEGER,    ARGI_INTEGER)
 #define ARGI_LOR_OP                     ARGI_LIST2 (ARGI_INTEGER,    ARGI_INTEGER)
 #define ARGI_LNOT_OP                    ARGI_LIST1 (ARGI_INTEGER)
@@ -308,7 +308,7 @@
 #define ARGI_DEBUG_OP                   ARG_NONE
 #define ARGI_FATAL_OP                   ARGI_LIST3 (ARGI_INTEGER,    ARGI_INTEGER,       ARGI_INTEGER)
 #define ARGI_REGION_OP                  ARGI_LIST2 (ARGI_INTEGER,    ARGI_INTEGER)
-#define ARGI_DEF_FIELD_OP               ARGI_INVALID_OPCODE
+#define ARGI_FIELD_OP                   ARGI_INVALID_OPCODE
 #define ARGI_DEVICE_OP                  ARGI_INVALID_OPCODE
 #define ARGI_PROCESSOR_OP               ARGI_INVALID_OPCODE
 #define ARGI_POWER_RES_OP               ARGI_INVALID_OPCODE
@@ -335,143 +335,143 @@
 
 static ACPI_OPCODE_INFO    aml_op_info[] =
 {
-/* Index          Opcode                                   Type                   Class                 Has Arguments?   Name                 Parser Args             Interpreter Args */
+/* Index          Opcode                                   Type                   Class                 Has Arguments?   Name                 Parser Args               Interpreter Args */
 
-/*  00 */   /* AML_ZERO_OP */               OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CONSTANT|        AML_NO_ARGS,  "Zero",               ARGP_ZERO_OP,           ARGI_ZERO_OP),
-/*  01 */   /* AML_ONE_OP */                OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CONSTANT|        AML_NO_ARGS,  "One",                ARGP_ONE_OP,            ARGI_ONE_OP),
-/*  02 */   /* AML_ALIAS_OP */              OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT|    AML_HAS_ARGS, "Alias",              ARGP_ALIAS_OP,          ARGI_ALIAS_OP),
-/*  03 */   /* AML_NAME_OP */               OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT|    AML_HAS_ARGS, "Name",               ARGP_NAME_OP,           ARGI_NAME_OP),
-/*  04 */   /* AML_BYTE_OP */               OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_LITERAL|         AML_NO_ARGS,  "Byte_const",         ARGP_BYTE_OP,           ARGI_BYTE_OP),
-/*  05 */   /* AML_WORD_OP */               OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_LITERAL|         AML_NO_ARGS,  "Word_const",         ARGP_WORD_OP,           ARGI_WORD_OP),
-/*  06 */   /* AML_DWORD_OP */              OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_LITERAL|         AML_NO_ARGS,  "Dword_const",        ARGP_DWORD_OP,          ARGI_DWORD_OP),
-/*  07 */   /* AML_STRING_OP */             OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_LITERAL|         AML_NO_ARGS,  "String",             ARGP_STRING_OP,         ARGI_STRING_OP),
-/*  08 */   /* AML_SCOPE_OP */              OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT|    AML_HAS_ARGS, "Scope",              ARGP_SCOPE_OP,          ARGI_SCOPE_OP),
-/*  09 */   /* AML_BUFFER_OP */             OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DATA_TERM|       AML_HAS_ARGS, "Buffer",             ARGP_BUFFER_OP,         ARGI_BUFFER_OP),
-/*  0A */   /* AML_PACKAGE_OP */            OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DATA_TERM|       AML_HAS_ARGS, "Package",            ARGP_PACKAGE_OP,        ARGI_PACKAGE_OP),
-/*  0B */   /* AML_METHOD_OP */             OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT|    AML_HAS_ARGS, "Method",             ARGP_METHOD_OP,         ARGI_METHOD_OP),
-/*  0C */   /* AML_LOCAL0 */                OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_LOCAL_VARIABLE|  AML_NO_ARGS,  "Local0",             ARGP_LOCAL0,            ARGI_LOCAL0),
-/*  0D */   /* AML_LOCAL1 */                OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_LOCAL_VARIABLE|  AML_NO_ARGS,  "Local1",             ARGP_LOCAL1,            ARGI_LOCAL1),
-/*  0E */   /* AML_LOCAL2 */                OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_LOCAL_VARIABLE|  AML_NO_ARGS,  "Local2",             ARGP_LOCAL2,            ARGI_LOCAL2),
-/*  0F */   /* AML_LOCAL3 */                OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_LOCAL_VARIABLE|  AML_NO_ARGS,  "Local3",             ARGP_LOCAL3,            ARGI_LOCAL3),
-/*  10 */   /* AML_LOCAL4 */                OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_LOCAL_VARIABLE|  AML_NO_ARGS,  "Local4",             ARGP_LOCAL4,            ARGI_LOCAL4),
-/*  11 */   /* AML_LOCAL5 */                OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_LOCAL_VARIABLE|  AML_NO_ARGS,  "Local5",             ARGP_LOCAL5,            ARGI_LOCAL5),
-/*  12 */   /* AML_LOCAL6 */                OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_LOCAL_VARIABLE|  AML_NO_ARGS,  "Local6",             ARGP_LOCAL6,            ARGI_LOCAL6),
-/*  13 */   /* AML_LOCAL7 */                OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_LOCAL_VARIABLE|  AML_NO_ARGS,  "Local7",             ARGP_LOCAL7,            ARGI_LOCAL7),
-/*  14 */   /* AML_ARG0 */                  OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_METHOD_ARGUMENT| AML_NO_ARGS,  "Arg0",               ARGP_ARG0,              ARGI_ARG0),
-/*  15 */   /* AML_ARG1 */                  OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_METHOD_ARGUMENT| AML_NO_ARGS,  "Arg1",               ARGP_ARG1,              ARGI_ARG1),
-/*  16 */   /* AML_ARG2 */                  OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_METHOD_ARGUMENT| AML_NO_ARGS,  "Arg2",               ARGP_ARG2,              ARGI_ARG2),
-/*  17 */   /* AML_ARG3 */                  OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_METHOD_ARGUMENT| AML_NO_ARGS,  "Arg3",               ARGP_ARG3,              ARGI_ARG3),
-/*  18 */   /* AML_ARG4 */                  OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_METHOD_ARGUMENT| AML_NO_ARGS,  "Arg4",               ARGP_ARG4,              ARGI_ARG4),
-/*  19 */   /* AML_ARG5 */                  OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_METHOD_ARGUMENT| AML_NO_ARGS,  "Arg5",               ARGP_ARG5,              ARGI_ARG5),
-/*  1_a */  /* AML_ARG6 */                  OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_METHOD_ARGUMENT| AML_NO_ARGS,  "Arg6",               ARGP_ARG6,              ARGI_ARG6),
-/*  1_b */  /* AML_STORE_OP */              OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2_r|      AML_HAS_ARGS, "Store",              ARGP_STORE_OP,          ARGI_STORE_OP),
-/*  1_c */  /* AML_REF_OF_OP */             OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2|        AML_HAS_ARGS, "Ref_of",             ARGP_REF_OF_OP,         ARGI_REF_OF_OP),
-/*  1_d */  /* AML_ADD_OP */                OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_r|       AML_HAS_ARGS, "Add",                ARGP_ADD_OP,            ARGI_ADD_OP),
-/*  1_e */  /* AML_CONCAT_OP */             OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_r|       AML_HAS_ARGS, "Concatenate",        ARGP_CONCAT_OP,         ARGI_CONCAT_OP),
-/*  1_f */  /* AML_SUBTRACT_OP */           OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_r|       AML_HAS_ARGS, "Subtract",           ARGP_SUBTRACT_OP,       ARGI_SUBTRACT_OP),
-/*  20 */   /* AML_INCREMENT_OP */          OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2|        AML_HAS_ARGS, "Increment",          ARGP_INCREMENT_OP,      ARGI_INCREMENT_OP),
-/*  21 */   /* AML_DECREMENT_OP */          OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2|        AML_HAS_ARGS, "Decrement",          ARGP_DECREMENT_OP,      ARGI_DECREMENT_OP),
-/*  22 */   /* AML_MULTIPLY_OP */           OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_r|       AML_HAS_ARGS, "Multiply",           ARGP_MULTIPLY_OP,       ARGI_MULTIPLY_OP),
-/*  23 */   /* AML_DIVIDE_OP */             OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_r|       AML_HAS_ARGS, "Divide",             ARGP_DIVIDE_OP,         ARGI_DIVIDE_OP),
-/*  24 */   /* AML_SHIFT_LEFT_OP */         OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_r|       AML_HAS_ARGS, "Shift_left",         ARGP_SHIFT_LEFT_OP,     ARGI_SHIFT_LEFT_OP),
-/*  25 */   /* AML_SHIFT_RIGHT_OP */        OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_r|       AML_HAS_ARGS, "Shift_right",        ARGP_SHIFT_RIGHT_OP,    ARGI_SHIFT_RIGHT_OP),
-/*  26 */   /* AML_BIT_AND_OP */            OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_r|       AML_HAS_ARGS, "And",                ARGP_BIT_AND_OP,        ARGI_BIT_AND_OP),
-/*  27 */   /* AML_BIT_NAND_OP */           OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_r|       AML_HAS_ARGS, "NAnd",               ARGP_BIT_NAND_OP,       ARGI_BIT_NAND_OP),
-/*  28 */   /* AML_BIT_OR_OP */             OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_r|       AML_HAS_ARGS, "Or",                 ARGP_BIT_OR_OP,         ARGI_BIT_OR_OP),
-/*  29 */   /* AML_BIT_NOR_OP */            OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_r|       AML_HAS_ARGS, "NOr",                ARGP_BIT_NOR_OP,        ARGI_BIT_NOR_OP),
-/*  2_a */  /* AML_BIT_XOR_OP */            OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_r|       AML_HAS_ARGS, "XOr",                ARGP_BIT_XOR_OP,        ARGI_BIT_XOR_OP),
-/*  2_b */  /* AML_BIT_NOT_OP */            OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2_r|      AML_HAS_ARGS, "Not",                ARGP_BIT_NOT_OP,        ARGI_BIT_NOT_OP),
+/*  00 */   /* AML_ZERO_OP */	  OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CONSTANT|        AML_NO_ARGS,  "Zero",               ARGP_ZERO_OP,              ARGI_ZERO_OP),
+/*  01 */   /* AML_ONE_OP */	   OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CONSTANT|        AML_NO_ARGS,  "One",                ARGP_ONE_OP,               ARGI_ONE_OP),
+/*  02 */   /* AML_ALIAS_OP */	 OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT|    AML_HAS_ARGS, "Alias",              ARGP_ALIAS_OP,             ARGI_ALIAS_OP),
+/*  03 */   /* AML_NAME_OP */	  OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT|    AML_HAS_ARGS, "Name",               ARGP_NAME_OP,              ARGI_NAME_OP),
+/*  04 */   /* AML_BYTE_OP */	  OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_LITERAL|         AML_NO_ARGS,  "Byte_const",         ARGP_BYTE_OP,              ARGI_BYTE_OP),
+/*  05 */   /* AML_WORD_OP */	  OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_LITERAL|         AML_NO_ARGS,  "Word_const",         ARGP_WORD_OP,              ARGI_WORD_OP),
+/*  06 */   /* AML_DWORD_OP */	 OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_LITERAL|         AML_NO_ARGS,  "Dword_const",        ARGP_DWORD_OP,             ARGI_DWORD_OP),
+/*  07 */   /* AML_STRING_OP */	   OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_LITERAL|         AML_NO_ARGS,  "String",             ARGP_STRING_OP,            ARGI_STRING_OP),
+/*  08 */   /* AML_SCOPE_OP */	 OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT|    AML_HAS_ARGS, "Scope",              ARGP_SCOPE_OP,             ARGI_SCOPE_OP),
+/*  09 */   /* AML_BUFFER_OP */	   OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DATA_TERM|       AML_HAS_ARGS, "Buffer",             ARGP_BUFFER_OP,            ARGI_BUFFER_OP),
+/*  0A */   /* AML_PACKAGE_OP */	  OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DATA_TERM|       AML_HAS_ARGS, "Package",            ARGP_PACKAGE_OP,           ARGI_PACKAGE_OP),
+/*  0B */   /* AML_METHOD_OP */	   OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT|    AML_HAS_ARGS, "Method",             ARGP_METHOD_OP,            ARGI_METHOD_OP),
+/*  0C */   /* AML_LOCAL0 */	   OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_LOCAL_VARIABLE|  AML_NO_ARGS,  "Local0",             ARGP_LOCAL0,               ARGI_LOCAL0),
+/*  0D */   /* AML_LOCAL1 */	   OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_LOCAL_VARIABLE|  AML_NO_ARGS,  "Local1",             ARGP_LOCAL1,               ARGI_LOCAL1),
+/*  0E */   /* AML_LOCAL2 */	   OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_LOCAL_VARIABLE|  AML_NO_ARGS,  "Local2",             ARGP_LOCAL2,               ARGI_LOCAL2),
+/*  0F */   /* AML_LOCAL3 */	   OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_LOCAL_VARIABLE|  AML_NO_ARGS,  "Local3",             ARGP_LOCAL3,               ARGI_LOCAL3),
+/*  10 */   /* AML_LOCAL4 */	   OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_LOCAL_VARIABLE|  AML_NO_ARGS,  "Local4",             ARGP_LOCAL4,               ARGI_LOCAL4),
+/*  11 */   /* AML_LOCAL5 */	   OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_LOCAL_VARIABLE|  AML_NO_ARGS,  "Local5",             ARGP_LOCAL5,               ARGI_LOCAL5),
+/*  12 */   /* AML_LOCAL6 */	   OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_LOCAL_VARIABLE|  AML_NO_ARGS,  "Local6",             ARGP_LOCAL6,               ARGI_LOCAL6),
+/*  13 */   /* AML_LOCAL7 */	   OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_LOCAL_VARIABLE|  AML_NO_ARGS,  "Local7",             ARGP_LOCAL7,               ARGI_LOCAL7),
+/*  14 */   /* AML_ARG0 */	  OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_METHOD_ARGUMENT| AML_NO_ARGS,  "Arg0",               ARGP_ARG0,                 ARGI_ARG0),
+/*  15 */   /* AML_ARG1 */	  OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_METHOD_ARGUMENT| AML_NO_ARGS,  "Arg1",               ARGP_ARG1,                 ARGI_ARG1),
+/*  16 */   /* AML_ARG2 */	  OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_METHOD_ARGUMENT| AML_NO_ARGS,  "Arg2",               ARGP_ARG2,                 ARGI_ARG2),
+/*  17 */   /* AML_ARG3 */	  OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_METHOD_ARGUMENT| AML_NO_ARGS,  "Arg3",               ARGP_ARG3,                 ARGI_ARG3),
+/*  18 */   /* AML_ARG4 */	  OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_METHOD_ARGUMENT| AML_NO_ARGS,  "Arg4",               ARGP_ARG4,                 ARGI_ARG4),
+/*  19 */   /* AML_ARG5 */	  OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_METHOD_ARGUMENT| AML_NO_ARGS,  "Arg5",               ARGP_ARG5,                 ARGI_ARG5),
+/*  1_a */  /* AML_ARG6 */	  OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_METHOD_ARGUMENT| AML_NO_ARGS,  "Arg6",               ARGP_ARG6,                 ARGI_ARG6),
+/*  1_b */  /* AML_STORE_OP */	 OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2_r|      AML_HAS_ARGS, "Store",              ARGP_STORE_OP,             ARGI_STORE_OP),
+/*  1_c */  /* AML_REF_OF_OP */	   OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2|        AML_HAS_ARGS, "Ref_of",             ARGP_REF_OF_OP,            ARGI_REF_OF_OP),
+/*  1_d */  /* AML_ADD_OP */	   OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_r|       AML_HAS_ARGS, "Add",                ARGP_ADD_OP,               ARGI_ADD_OP),
+/*  1_e */  /* AML_CONCAT_OP */	   OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_r|       AML_HAS_ARGS, "Concatenate",        ARGP_CONCAT_OP,            ARGI_CONCAT_OP),
+/*  1_f */  /* AML_SUBTRACT_OP */	 OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_r|       AML_HAS_ARGS, "Subtract",           ARGP_SUBTRACT_OP,          ARGI_SUBTRACT_OP),
+/*  20 */   /* AML_INCREMENT_OP */	   OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2|        AML_HAS_ARGS, "Increment",          ARGP_INCREMENT_OP,         ARGI_INCREMENT_OP),
+/*  21 */   /* AML_DECREMENT_OP */	   OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2|        AML_HAS_ARGS, "Decrement",          ARGP_DECREMENT_OP,         ARGI_DECREMENT_OP),
+/*  22 */   /* AML_MULTIPLY_OP */	 OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_r|       AML_HAS_ARGS, "Multiply",           ARGP_MULTIPLY_OP,          ARGI_MULTIPLY_OP),
+/*  23 */   /* AML_DIVIDE_OP */	   OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_r|       AML_HAS_ARGS, "Divide",             ARGP_DIVIDE_OP,            ARGI_DIVIDE_OP),
+/*  24 */   /* AML_SHIFT_LEFT_OP */	  OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_r|       AML_HAS_ARGS, "Shift_left",         ARGP_SHIFT_LEFT_OP,        ARGI_SHIFT_LEFT_OP),
+/*  25 */   /* AML_SHIFT_RIGHT_OP */	 OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_r|       AML_HAS_ARGS, "Shift_right",        ARGP_SHIFT_RIGHT_OP,       ARGI_SHIFT_RIGHT_OP),
+/*  26 */   /* AML_BIT_AND_OP */	  OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_r|       AML_HAS_ARGS, "And",                ARGP_BIT_AND_OP,           ARGI_BIT_AND_OP),
+/*  27 */   /* AML_BIT_NAND_OP */	 OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_r|       AML_HAS_ARGS, "NAnd",               ARGP_BIT_NAND_OP,          ARGI_BIT_NAND_OP),
+/*  28 */   /* AML_BIT_OR_OP */	   OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_r|       AML_HAS_ARGS, "Or",                 ARGP_BIT_OR_OP,            ARGI_BIT_OR_OP),
+/*  29 */   /* AML_BIT_NOR_OP */	  OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_r|       AML_HAS_ARGS, "NOr",                ARGP_BIT_NOR_OP,           ARGI_BIT_NOR_OP),
+/*  2_a */  /* AML_BIT_XOR_OP */	  OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_r|       AML_HAS_ARGS, "XOr",                ARGP_BIT_XOR_OP,           ARGI_BIT_XOR_OP),
+/*  2_b */  /* AML_BIT_NOT_OP */	  OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2_r|      AML_HAS_ARGS, "Not",                ARGP_BIT_NOT_OP,           ARGI_BIT_NOT_OP),
 /*  2_c */  /* AML_FIND_SET_LEFT_BIT_OP */  OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2_r|      AML_HAS_ARGS, "Find_set_left_bit",  ARGP_FIND_SET_LEFT_BIT_OP, ARGI_FIND_SET_LEFT_BIT_OP),
-/*  2_d */  /* AML_FIND_SET_RIGHT_BIT_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2_r|      AML_HAS_ARGS, "Find_set_right_bit", ARGP_FIND_SET_RIGHT_BIT_OP, ARGI_FIND_SET_RIGHT_BIT_OP),
-/*  2_e */  /* AML_DEREF_OF_OP */           OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2|        AML_HAS_ARGS, "Deref_of",           ARGP_DEREF_OF_OP,       ARGI_DEREF_OF_OP),
-/*  2_f */  /* AML_NOTIFY_OP */             OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC1|         AML_HAS_ARGS, "Notify",             ARGP_NOTIFY_OP,         ARGI_NOTIFY_OP),
-/*  30 */   /* AML_SIZE_OF_OP */            OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2|        AML_HAS_ARGS, "Size_of",            ARGP_SIZE_OF_OP,        ARGI_SIZE_OF_OP),
-/*  31 */   /* AML_INDEX_OP */              OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_INDEX|           AML_HAS_ARGS, "Index",              ARGP_INDEX_OP,          ARGI_INDEX_OP),
-/*  32 */   /* AML_MATCH_OP */              OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MATCH|           AML_HAS_ARGS, "Match",              ARGP_MATCH_OP,          ARGI_MATCH_OP),
-/*  33 */   /* AML_DWORD_FIELD_OP */        OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CREATE_FIELD|    AML_HAS_ARGS, "Create_dWord_field", ARGP_DWORD_FIELD_OP,    ARGI_DWORD_FIELD_OP),
-/*  34 */   /* AML_WORD_FIELD_OP */         OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CREATE_FIELD|    AML_HAS_ARGS, "Create_word_field",  ARGP_WORD_FIELD_OP,     ARGI_WORD_FIELD_OP),
-/*  35 */   /* AML_BYTE_FIELD_OP */         OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CREATE_FIELD|    AML_HAS_ARGS, "Create_byte_field",  ARGP_BYTE_FIELD_OP,     ARGI_BYTE_FIELD_OP),
-/*  36 */   /* AML_BIT_FIELD_OP */          OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CREATE_FIELD|    AML_HAS_ARGS, "Create_bit_field",   ARGP_BIT_FIELD_OP,      ARGI_BIT_FIELD_OP),
-/*  37 */   /* AML_TYPE_OP */               OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2|        AML_HAS_ARGS, "Object_type",        ARGP_TYPE_OP,           ARGI_TYPE_OP),
-/*  38 */   /* AML_LAND_OP */               OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2|         AML_HAS_ARGS, "LAnd",               ARGP_LAND_OP,           ARGI_LAND_OP),
-/*  39 */   /* AML_LOR_OP */                OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2|         AML_HAS_ARGS, "LOr",                ARGP_LOR_OP,            ARGI_LOR_OP),
-/*  3_a */  /* AML_LNOT_OP */               OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2|        AML_HAS_ARGS, "LNot",               ARGP_LNOT_OP,           ARGI_LNOT_OP),
-/*  3_b */  /* AML_LEQUAL_OP */             OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2|         AML_HAS_ARGS, "LEqual",             ARGP_LEQUAL_OP,         ARGI_LEQUAL_OP),
-/*  3_c */  /* AML_LGREATER_OP */           OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2|         AML_HAS_ARGS, "LGreater",           ARGP_LGREATER_OP,       ARGI_LGREATER_OP),
-/*  3_d */  /* AML_LLESS_OP */              OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2|         AML_HAS_ARGS, "LLess",              ARGP_LLESS_OP,          ARGI_LLESS_OP),
-/*  3_e */  /* AML_IF_OP */                 OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CONTROL|         AML_HAS_ARGS, "If",                 ARGP_IF_OP,             ARGI_IF_OP),
-/*  3_f */  /* AML_ELSE_OP */               OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CONTROL|         AML_HAS_ARGS, "Else",               ARGP_ELSE_OP,           ARGI_ELSE_OP),
-/*  40 */   /* AML_WHILE_OP */              OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CONTROL|         AML_HAS_ARGS, "While",              ARGP_WHILE_OP,          ARGI_WHILE_OP),
-/*  41 */   /* AML_NOOP_OP   */             OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CONTROL|         AML_NO_ARGS,  "Noop",               ARGP_NOOP_OP,           ARGI_NOOP_OP),
-/*  42 */   /* AML_RETURN_OP */             OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CONTROL|         AML_HAS_ARGS, "Return",             ARGP_RETURN_OP,         ARGI_RETURN_OP),
-/*  43 */   /* AML_BREAK_OP */              OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CONTROL|         AML_NO_ARGS,  "Break",              ARGP_BREAK_OP,          ARGI_BREAK_OP),
-/*  44 */   /* AML_BREAK_POINT_OP */        OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CONTROL|         AML_NO_ARGS,  "Break_point",        ARGP_BREAK_POINT_OP,    ARGI_BREAK_POINT_OP),
-/*  45 */   /* AML_ONES_OP */               OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CONSTANT|        AML_NO_ARGS,  "Ones",               ARGP_ONES_OP,           ARGI_ONES_OP),
+/*  2_d */  /* AML_FIND_SET_RIGHT_BIT_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2_r|      AML_HAS_ARGS, "Find_set_right_bit", ARGP_FIND_SET_RIGHT_BIT_OP,ARGI_FIND_SET_RIGHT_BIT_OP),
+/*  2_e */  /* AML_DEREF_OF_OP */	 OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2|        AML_HAS_ARGS, "Deref_of",           ARGP_DEREF_OF_OP,          ARGI_DEREF_OF_OP),
+/*  2_f */  /* AML_NOTIFY_OP */	   OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC1|         AML_HAS_ARGS, "Notify",             ARGP_NOTIFY_OP,            ARGI_NOTIFY_OP),
+/*  30 */   /* AML_SIZE_OF_OP */	  OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2|        AML_HAS_ARGS, "Size_of",            ARGP_SIZE_OF_OP,           ARGI_SIZE_OF_OP),
+/*  31 */   /* AML_INDEX_OP */	 OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_INDEX|           AML_HAS_ARGS, "Index",              ARGP_INDEX_OP,             ARGI_INDEX_OP),
+/*  32 */   /* AML_MATCH_OP */	 OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MATCH|           AML_HAS_ARGS, "Match",              ARGP_MATCH_OP,             ARGI_MATCH_OP),
+/*  33 */   /* AML_CREATE_DWORD_FIELD_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CREATE_FIELD|    AML_HAS_ARGS, "Create_dWord_field", ARGP_CREATE_DWORD_FIELD_OP,ARGI_CREATE_DWORD_FIELD_OP),
+/*  34 */   /* AML_CREATE_WORD_FIELD_OP */  OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CREATE_FIELD|    AML_HAS_ARGS, "Create_word_field",  ARGP_CREATE_WORD_FIELD_OP, ARGI_CREATE_WORD_FIELD_OP),
+/*  35 */   /* AML_CREATE_BYTE_FIELD_OP */  OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CREATE_FIELD|    AML_HAS_ARGS, "Create_byte_field",  ARGP_CREATE_BYTE_FIELD_OP, ARGI_CREATE_BYTE_FIELD_OP),
+/*  36 */   /* AML_CREATE_BIT_FIELD_OP */   OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CREATE_FIELD|    AML_HAS_ARGS, "Create_bit_field",   ARGP_CREATE_BIT_FIELD_OP,  ARGI_CREATE_BIT_FIELD_OP),
+/*  37 */   /* AML_TYPE_OP */	  OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2|        AML_HAS_ARGS, "Object_type",        ARGP_TYPE_OP,              ARGI_TYPE_OP),
+/*  38 */   /* AML_LAND_OP */	  OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2|         AML_HAS_ARGS, "LAnd",               ARGP_LAND_OP,              ARGI_LAND_OP),
+/*  39 */   /* AML_LOR_OP */	   OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2|         AML_HAS_ARGS, "LOr",                ARGP_LOR_OP,               ARGI_LOR_OP),
+/*  3_a */  /* AML_LNOT_OP */	  OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2|        AML_HAS_ARGS, "LNot",               ARGP_LNOT_OP,              ARGI_LNOT_OP),
+/*  3_b */  /* AML_LEQUAL_OP */	   OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2|         AML_HAS_ARGS, "LEqual",             ARGP_LEQUAL_OP,            ARGI_LEQUAL_OP),
+/*  3_c */  /* AML_LGREATER_OP */	 OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2|         AML_HAS_ARGS, "LGreater",           ARGP_LGREATER_OP,          ARGI_LGREATER_OP),
+/*  3_d */  /* AML_LLESS_OP */	 OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2|         AML_HAS_ARGS, "LLess",              ARGP_LLESS_OP,             ARGI_LLESS_OP),
+/*  3_e */  /* AML_IF_OP */	 OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CONTROL|         AML_HAS_ARGS, "If",                 ARGP_IF_OP,                ARGI_IF_OP),
+/*  3_f */  /* AML_ELSE_OP */	  OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CONTROL|         AML_HAS_ARGS, "Else",               ARGP_ELSE_OP,              ARGI_ELSE_OP),
+/*  40 */   /* AML_WHILE_OP */	 OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CONTROL|         AML_HAS_ARGS, "While",              ARGP_WHILE_OP,             ARGI_WHILE_OP),
+/*  41 */   /* AML_NOOP_OP   */	   OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CONTROL|         AML_NO_ARGS,  "Noop",               ARGP_NOOP_OP,              ARGI_NOOP_OP),
+/*  42 */   /* AML_RETURN_OP */	   OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CONTROL|         AML_HAS_ARGS, "Return",             ARGP_RETURN_OP,            ARGI_RETURN_OP),
+/*  43 */   /* AML_BREAK_OP */	 OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CONTROL|         AML_NO_ARGS,  "Break",              ARGP_BREAK_OP,             ARGI_BREAK_OP),
+/*  44 */   /* AML_BREAK_POINT_OP */	 OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CONTROL|         AML_NO_ARGS,  "Break_point",        ARGP_BREAK_POINT_OP,       ARGI_BREAK_POINT_OP),
+/*  45 */   /* AML_ONES_OP */	  OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CONSTANT|        AML_NO_ARGS,  "Ones",               ARGP_ONES_OP,              ARGI_ONES_OP),
 
 /* Prefixed opcodes (Two-byte opcodes with a prefix op) */
 
-/*  46 */   /* AML_MUTEX_OP */              OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT|    AML_HAS_ARGS, "Mutex",              ARGP_MUTEX_OP,          ARGI_MUTEX_OP),
-/*  47 */   /* AML_EVENT_OP */              OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT|    AML_NO_ARGS,  "Event",              ARGP_EVENT_OP,          ARGI_EVENT_OP),
-/*  48 */   /* AML_COND_REF_OF_OP */        OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2_r|      AML_HAS_ARGS, "Cond_ref_of",        ARGP_COND_REF_OF_OP,    ARGI_COND_REF_OF_OP),
-/*  49 */   /* AML_CREATE_FIELD_OP */       OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CREATE_FIELD|    AML_HAS_ARGS, "Create_field",       ARGP_CREATE_FIELD_OP,   ARGI_CREATE_FIELD_OP),
-/*  4_a */  /* AML_LOAD_OP */               OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_RECONFIGURATION| AML_HAS_ARGS, "Load",               ARGP_LOAD_OP,           ARGI_LOAD_OP),
-/*  4_b */  /* AML_STALL_OP */              OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC1|        AML_HAS_ARGS, "Stall",              ARGP_STALL_OP,          ARGI_STALL_OP),
-/*  4_c */  /* AML_SLEEP_OP */              OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC1|        AML_HAS_ARGS, "Sleep",              ARGP_SLEEP_OP,          ARGI_SLEEP_OP),
-/*  4_d */  /* AML_ACQUIRE_OP */            OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_s|       AML_HAS_ARGS, "Acquire",            ARGP_ACQUIRE_OP,        ARGI_ACQUIRE_OP),
-/*  4_e */  /* AML_SIGNAL_OP */             OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC1|        AML_HAS_ARGS, "Signal",             ARGP_SIGNAL_OP,         ARGI_SIGNAL_OP),
-/*  4_f */  /* AML_WAIT_OP */               OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_s|       AML_HAS_ARGS, "Wait",               ARGP_WAIT_OP,           ARGI_WAIT_OP),
-/*  50 */   /* AML_RESET_OP */              OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC1|        AML_HAS_ARGS, "Reset",              ARGP_RESET_OP,          ARGI_RESET_OP),
-/*  51 */   /* AML_RELEASE_OP */            OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC1|        AML_HAS_ARGS, "Release",            ARGP_RELEASE_OP,        ARGI_RELEASE_OP),
-/*  52 */   /* AML_FROM_BCD_OP */           OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2_r|      AML_HAS_ARGS, "From_bCD",           ARGP_FROM_BCD_OP,       ARGI_FROM_BCD_OP),
-/*  53 */   /* AML_TO_BCD_OP */             OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2_r|      AML_HAS_ARGS, "To_bCD",             ARGP_TO_BCD_OP,         ARGI_TO_BCD_OP),
-/*  54 */   /* AML_UNLOAD_OP */             OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_RECONFIGURATION| AML_HAS_ARGS, "Unload",             ARGP_UNLOAD_OP,         ARGI_UNLOAD_OP),
-/*  55 */   /* AML_REVISION_OP */           OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CONSTANT|        AML_NO_ARGS,  "Revision",           ARGP_REVISION_OP,       ARGI_REVISION_OP),
-/*  56 */   /* AML_DEBUG_OP */              OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CONSTANT|        AML_NO_ARGS,  "Debug",              ARGP_DEBUG_OP,          ARGI_DEBUG_OP),
-/*  57 */   /* AML_FATAL_OP */              OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_FATAL|           AML_HAS_ARGS, "Fatal",              ARGP_FATAL_OP,          ARGI_FATAL_OP),
-/*  58 */   /* AML_REGION_OP */             OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT|    AML_HAS_ARGS, "Op_region",          ARGP_REGION_OP,         ARGI_REGION_OP),
-/*  59 */   /* AML_DEF_FIELD_OP */          OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT|    AML_HAS_ARGS, "Field",              ARGP_DEF_FIELD_OP,      ARGI_DEF_FIELD_OP),
-/*  5_a */  /* AML_DEVICE_OP */             OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT|    AML_HAS_ARGS, "Device",             ARGP_DEVICE_OP,         ARGI_DEVICE_OP),
-/*  5_b */  /* AML_PROCESSOR_OP */          OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT|    AML_HAS_ARGS, "Processor",          ARGP_PROCESSOR_OP,      ARGI_PROCESSOR_OP),
-/*  5_c */  /* AML_POWER_RES_OP */          OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT|    AML_HAS_ARGS, "Power_resource",     ARGP_POWER_RES_OP,      ARGI_POWER_RES_OP),
-/*  5_d */  /* AML_THERMAL_ZONE_OP */       OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT|    AML_HAS_ARGS, "Thermal_zone",       ARGP_THERMAL_ZONE_OP,   ARGI_THERMAL_ZONE_OP),
-/*  5_e */  /* AML_INDEX_FIELD_OP */        OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT|    AML_HAS_ARGS, "Index_field",        ARGP_INDEX_FIELD_OP,    ARGI_INDEX_FIELD_OP),
-/*  5_f */  /* AML_BANK_FIELD_OP */         OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT|    AML_HAS_ARGS, "Bank_field",         ARGP_BANK_FIELD_OP,     ARGI_BANK_FIELD_OP),
+/*  46 */   /* AML_MUTEX_OP */	 OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT|    AML_HAS_ARGS, "Mutex",              ARGP_MUTEX_OP,             ARGI_MUTEX_OP),
+/*  47 */   /* AML_EVENT_OP */	 OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT|    AML_NO_ARGS,  "Event",              ARGP_EVENT_OP,             ARGI_EVENT_OP),
+/*  48 */   /* AML_COND_REF_OF_OP */	 OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2_r|      AML_HAS_ARGS, "Cond_ref_of",        ARGP_COND_REF_OF_OP,       ARGI_COND_REF_OF_OP),
+/*  49 */   /* AML_CREATE_FIELD_OP */	   OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CREATE_FIELD|    AML_HAS_ARGS, "Create_field",       ARGP_CREATE_FIELD_OP,      ARGI_CREATE_FIELD_OP),
+/*  4_a */  /* AML_LOAD_OP */	  OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_RECONFIGURATION| AML_HAS_ARGS, "Load",               ARGP_LOAD_OP,              ARGI_LOAD_OP),
+/*  4_b */  /* AML_STALL_OP */	 OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC1|        AML_HAS_ARGS, "Stall",              ARGP_STALL_OP,             ARGI_STALL_OP),
+/*  4_c */  /* AML_SLEEP_OP */	 OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC1|        AML_HAS_ARGS, "Sleep",              ARGP_SLEEP_OP,             ARGI_SLEEP_OP),
+/*  4_d */  /* AML_ACQUIRE_OP */	  OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_s|       AML_HAS_ARGS, "Acquire",            ARGP_ACQUIRE_OP,           ARGI_ACQUIRE_OP),
+/*  4_e */  /* AML_SIGNAL_OP */	   OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC1|        AML_HAS_ARGS, "Signal",             ARGP_SIGNAL_OP,            ARGI_SIGNAL_OP),
+/*  4_f */  /* AML_WAIT_OP */	  OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_s|       AML_HAS_ARGS, "Wait",               ARGP_WAIT_OP,              ARGI_WAIT_OP),
+/*  50 */   /* AML_RESET_OP */	 OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC1|        AML_HAS_ARGS, "Reset",              ARGP_RESET_OP,             ARGI_RESET_OP),
+/*  51 */   /* AML_RELEASE_OP */	  OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC1|        AML_HAS_ARGS, "Release",            ARGP_RELEASE_OP,           ARGI_RELEASE_OP),
+/*  52 */   /* AML_FROM_BCD_OP */	 OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2_r|      AML_HAS_ARGS, "From_bCD",           ARGP_FROM_BCD_OP,          ARGI_FROM_BCD_OP),
+/*  53 */   /* AML_TO_BCD_OP */	   OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2_r|      AML_HAS_ARGS, "To_bCD",             ARGP_TO_BCD_OP,            ARGI_TO_BCD_OP),
+/*  54 */   /* AML_UNLOAD_OP */	   OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_RECONFIGURATION| AML_HAS_ARGS, "Unload",             ARGP_UNLOAD_OP,            ARGI_UNLOAD_OP),
+/*  55 */   /* AML_REVISION_OP */	 OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CONSTANT|        AML_NO_ARGS,  "Revision",           ARGP_REVISION_OP,          ARGI_REVISION_OP),
+/*  56 */   /* AML_DEBUG_OP */	 OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CONSTANT|        AML_NO_ARGS,  "Debug",              ARGP_DEBUG_OP,             ARGI_DEBUG_OP),
+/*  57 */   /* AML_FATAL_OP */	 OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_FATAL|           AML_HAS_ARGS, "Fatal",              ARGP_FATAL_OP,             ARGI_FATAL_OP),
+/*  58 */   /* AML_REGION_OP */	   OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT|    AML_HAS_ARGS, "Op_region",          ARGP_REGION_OP,            ARGI_REGION_OP),
+/*  59 */   /* AML_FIELD_OP */	 OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT|    AML_HAS_ARGS, "Field",              ARGP_FIELD_OP,             ARGI_FIELD_OP),
+/*  5_a */  /* AML_DEVICE_OP */	   OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT|    AML_HAS_ARGS, "Device",             ARGP_DEVICE_OP,            ARGI_DEVICE_OP),
+/*  5_b */  /* AML_PROCESSOR_OP */	   OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT|    AML_HAS_ARGS, "Processor",          ARGP_PROCESSOR_OP,         ARGI_PROCESSOR_OP),
+/*  5_c */  /* AML_POWER_RES_OP */	   OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT|    AML_HAS_ARGS, "Power_resource",     ARGP_POWER_RES_OP,         ARGI_POWER_RES_OP),
+/*  5_d */  /* AML_THERMAL_ZONE_OP */	   OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT|    AML_HAS_ARGS, "Thermal_zone",       ARGP_THERMAL_ZONE_OP,      ARGI_THERMAL_ZONE_OP),
+/*  5_e */  /* AML_INDEX_FIELD_OP */	 OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT|    AML_HAS_ARGS, "Index_field",        ARGP_INDEX_FIELD_OP,       ARGI_INDEX_FIELD_OP),
+/*  5_f */  /* AML_BANK_FIELD_OP */	  OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT|    AML_HAS_ARGS, "Bank_field",         ARGP_BANK_FIELD_OP,        ARGI_BANK_FIELD_OP),
 
 /* Internal opcodes that map to invalid AML opcodes */
 
-/*  60 */   /* AML_LNOTEQUAL_OP */          OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_BOGUS|           AML_HAS_ARGS, "LNot_equal",         ARGP_LNOTEQUAL_OP,      ARGI_LNOTEQUAL_OP),
-/*  61 */   /* AML_LLESSEQUAL_OP */         OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_BOGUS|           AML_HAS_ARGS, "LLess_equal",        ARGP_LLESSEQUAL_OP,     ARGI_LLESSEQUAL_OP),
-/*  62 */   /* AML_LGREATEREQUAL_OP */      OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_BOGUS|           AML_HAS_ARGS, "LGreater_equal",     ARGP_LGREATEREQUAL_OP,  ARGI_LGREATEREQUAL_OP),
-/*  63 */   /* AML_NAMEPATH_OP */           OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_LITERAL|         AML_NO_ARGS,  "Name_path",          ARGP_NAMEPATH_OP,       ARGI_NAMEPATH_OP),
-/*  64 */   /* AML_METHODCALL_OP */         OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_METHOD_CALL|     AML_HAS_ARGS, "Method_call",        ARGP_METHODCALL_OP,     ARGI_METHODCALL_OP),
-/*  65 */   /* AML_BYTELIST_OP */           OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_LITERAL|         AML_NO_ARGS,  "Byte_list",          ARGP_BYTELIST_OP,       ARGI_BYTELIST_OP),
-/*  66 */   /* AML_RESERVEDFIELD_OP */      OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_BOGUS|           AML_NO_ARGS,  "Reserved_field",     ARGP_RESERVEDFIELD_OP,  ARGI_RESERVEDFIELD_OP),
-/*  67 */   /* AML_NAMEDFIELD_OP */         OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_BOGUS|           AML_NO_ARGS,  "Named_field",        ARGP_NAMEDFIELD_OP,     ARGI_NAMEDFIELD_OP),
-/*  68 */   /* AML_ACCESSFIELD_OP */        OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_BOGUS|           AML_NO_ARGS,  "Access_field",       ARGP_ACCESSFIELD_OP,    ARGI_ACCESSFIELD_OP),
-/*  69 */   /* AML_STATICSTRING_OP */       OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_BOGUS|           AML_NO_ARGS,  "Static_string",      ARGP_STATICSTRING_OP,   ARGI_STATICSTRING_OP),
-/*  6_a */  /* AML_RETURN_VALUE_OP */       OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_RETURN|          AML_HAS_ARGS, "[Return Value]",     ARG_NONE,               ARG_NONE),
-/*  6_b */  /* UNKNOWN OPCODES */           OP_INFO_ENTRY (ACPI_OP_TYPE_UNKNOWN | OPTYPE_BOGUS|          AML_HAS_ARGS, "UNKNOWN_OP!",        ARG_NONE,               ARG_NONE),
-/*  6_c */  /* ASCII CHARACTERS */          OP_INFO_ENTRY (ACPI_OP_TYPE_ASCII  | OPTYPE_BOGUS|           AML_HAS_ARGS, "ASCII_ONLY!",        ARG_NONE,               ARG_NONE),
-/*  6_d */  /* PREFIX CHARACTERS */         OP_INFO_ENTRY (ACPI_OP_TYPE_PREFIX | OPTYPE_BOGUS|           AML_HAS_ARGS, "PREFIX_ONLY!",       ARG_NONE,               ARG_NONE),
+/*  60 */   /* AML_LNOTEQUAL_OP */	   OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_BOGUS|           AML_HAS_ARGS, "LNot_equal",         ARGP_LNOTEQUAL_OP,         ARGI_LNOTEQUAL_OP),
+/*  61 */   /* AML_LLESSEQUAL_OP */	  OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_BOGUS|           AML_HAS_ARGS, "LLess_equal",        ARGP_LLESSEQUAL_OP,        ARGI_LLESSEQUAL_OP),
+/*  62 */   /* AML_LGREATEREQUAL_OP */	  OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_BOGUS|           AML_HAS_ARGS, "LGreater_equal",     ARGP_LGREATEREQUAL_OP,     ARGI_LGREATEREQUAL_OP),
+/*  63 */   /* AML_INT_NAMEPATH_OP */	   OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_LITERAL|         AML_NO_ARGS,  "Name_path",          ARGP_NAMEPATH_OP,          ARGI_NAMEPATH_OP),
+/*  64 */   /* AML_INT_METHODCALL_OP */	 OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_METHOD_CALL|     AML_HAS_ARGS, "Method_call",        ARGP_METHODCALL_OP,        ARGI_METHODCALL_OP),
+/*  65 */   /* AML_INT_BYTELIST_OP */	   OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_LITERAL|         AML_NO_ARGS,  "Byte_list",          ARGP_BYTELIST_OP,          ARGI_BYTELIST_OP),
+/*  66 */   /* AML_INT_RESERVEDFIELD_OP */  OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_BOGUS|           AML_NO_ARGS,  "Reserved_field",     ARGP_RESERVEDFIELD_OP,     ARGI_RESERVEDFIELD_OP),
+/*  67 */   /* AML_INT_NAMEDFIELD_OP */	 OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_BOGUS|           AML_NO_ARGS,  "Named_field",        ARGP_NAMEDFIELD_OP,        ARGI_NAMEDFIELD_OP),
+/*  68 */   /* AML_INT_ACCESSFIELD_OP */	OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_BOGUS|           AML_NO_ARGS,  "Access_field",       ARGP_ACCESSFIELD_OP,       ARGI_ACCESSFIELD_OP),
+/*  69 */   /* AML_INT_STATICSTRING_OP */   OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_BOGUS|           AML_NO_ARGS,  "Static_string",      ARGP_STATICSTRING_OP,      ARGI_STATICSTRING_OP),
+/*  6_a */  /* AML_INT_RETURN_VALUE_OP */   OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_RETURN|          AML_HAS_ARGS, "[Return Value]",     ARG_NONE,                  ARG_NONE),
+/*  6_b */  /* UNKNOWN OPCODES */	 OP_INFO_ENTRY (ACPI_OP_TYPE_UNKNOWN | OPTYPE_BOGUS|          AML_HAS_ARGS, "UNKNOWN_OP!",        ARG_NONE,                  ARG_NONE),
+/*  6_c */  /* ASCII CHARACTERS */	   OP_INFO_ENTRY (ACPI_OP_TYPE_ASCII  | OPTYPE_BOGUS|           AML_HAS_ARGS, "ASCII_ONLY!",        ARG_NONE,                  ARG_NONE),
+/*  6_d */  /* PREFIX CHARACTERS */	  OP_INFO_ENTRY (ACPI_OP_TYPE_PREFIX | OPTYPE_BOGUS|           AML_HAS_ARGS, "PREFIX_ONLY!",       ARG_NONE,                  ARG_NONE),
 
 
 /* ACPI 2.0 (new) opcodes */
 
-/*  6_e */  /* AML_QWORD_OP */              OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_LITERAL|         AML_NO_ARGS,  "Qword_const",        ARGP_QWORD_OP,          ARGI_QWORD_OP),
-/*  6_f */  /* AML_VAR_PACKAGE_OP */        OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DATA_TERM|       AML_HAS_ARGS, "Var_package",        ARGP_VAR_PACKAGE_OP,    ARGI_VAR_PACKAGE_OP),
-/*  70 */   /* AML_CONCAT_RES_OP */         OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_r|       AML_HAS_ARGS, "Concat_res",         ARGP_CONCAT_RES_OP,     ARGI_CONCAT_RES_OP),
-/*  71 */   /* AML_MOD_OP */                OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_r|       AML_HAS_ARGS, "Mod",                ARGP_MOD_OP,            ARGI_MOD_OP),
-/*  72 */   /* AML_QWORD_FIELD_OP */        OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CREATE_FIELD|    AML_HAS_ARGS, "Create_qWord_field", ARGP_QWORD_FIELD_OP,    ARGI_QWORD_FIELD_OP),
-/*  73 */   /* AML_TO_BUFFER_OP */          OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2_r|      AML_HAS_ARGS, "To_buffer",          ARGP_TO_BUFFER_OP,      ARGI_TO_BUFFER_OP),
-/*  74 */   /* AML_TO_DEC_STR_OP */         OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2_r|      AML_HAS_ARGS, "To_dec_string",      ARGP_TO_DEC_STR_OP,     ARGI_TO_DEC_STR_OP),
-/*  75 */   /* AML_TO_HEX_STR_OP */         OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2_r|      AML_HAS_ARGS, "To_hex_string",      ARGP_TO_HEX_STR_OP,     ARGI_TO_HEX_STR_OP),
-/*  76 */   /* AML_TO_INTEGER_OP */         OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2_r|      AML_HAS_ARGS, "To_integer",         ARGP_TO_INTEGER_OP,     ARGI_TO_INTEGER_OP),
-/*  77 */   /* AML_TO_STRING_OP */          OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2_r|      AML_HAS_ARGS, "To_string",          ARGP_TO_STRING_OP,      ARGI_TO_STRING_OP),
-/*  78 */   /* AML_COPY_OP */               OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2_r|      AML_HAS_ARGS, "Copy",               ARGP_COPY_OP,           ARGI_COPY_OP),
-/*  79 */   /* AML_MID_OP */                OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2_r|      AML_HAS_ARGS, "Mid",                ARGP_MID_OP,            ARGI_MID_OP),
-/*  7_a */  /* AML_CONTINUE_OP */           OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CONTROL|         AML_NO_ARGS,  "Continue",           ARGP_CONTINUE_OP,       ARGI_CONTINUE_OP),
-/*  7_b */  /* AML_LOAD_TABLE_OP */         OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2_r|      AML_HAS_ARGS, "Load_table",         ARGP_LOAD_TABLE_OP,     ARGI_LOAD_TABLE_OP),
-/*  7_c */  /* AML_DATA_REGION_OP */        OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2_r|      AML_HAS_ARGS, "Data_op_region",     ARGP_DATA_REGION_OP,    ARGI_DATA_REGION_OP),
+/*  6_e */  /* AML_QWORD_OP */	 OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_LITERAL|         AML_NO_ARGS,  "Qword_const",        ARGP_QWORD_OP,             ARGI_QWORD_OP),
+/*  6_f */  /* AML_VAR_PACKAGE_OP */	 OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DATA_TERM|       AML_HAS_ARGS, "Var_package",        ARGP_VAR_PACKAGE_OP,       ARGI_VAR_PACKAGE_OP),
+/*  70 */   /* AML_CONCAT_RES_OP */	  OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_r|       AML_HAS_ARGS, "Concat_res",         ARGP_CONCAT_RES_OP,        ARGI_CONCAT_RES_OP),
+/*  71 */   /* AML_MOD_OP */	   OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_r|       AML_HAS_ARGS, "Mod",                ARGP_MOD_OP,               ARGI_MOD_OP),
+/*  72 */   /* AML_CREATE_QWORD_FIELD_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CREATE_FIELD|    AML_HAS_ARGS, "Create_qWord_field", ARGP_CREATE_QWORD_FIELD_OP,ARGI_CREATE_QWORD_FIELD_OP),
+/*  73 */   /* AML_TO_BUFFER_OP */	   OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2_r|      AML_HAS_ARGS, "To_buffer",          ARGP_TO_BUFFER_OP,         ARGI_TO_BUFFER_OP),
+/*  74 */   /* AML_TO_DEC_STR_OP */	  OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2_r|      AML_HAS_ARGS, "To_dec_string",      ARGP_TO_DEC_STR_OP,        ARGI_TO_DEC_STR_OP),
+/*  75 */   /* AML_TO_HEX_STR_OP */	  OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2_r|      AML_HAS_ARGS, "To_hex_string",      ARGP_TO_HEX_STR_OP,        ARGI_TO_HEX_STR_OP),
+/*  76 */   /* AML_TO_INTEGER_OP */	  OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2_r|      AML_HAS_ARGS, "To_integer",         ARGP_TO_INTEGER_OP,        ARGI_TO_INTEGER_OP),
+/*  77 */   /* AML_TO_STRING_OP */	   OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2_r|      AML_HAS_ARGS, "To_string",          ARGP_TO_STRING_OP,         ARGI_TO_STRING_OP),
+/*  78 */   /* AML_COPY_OP */	  OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2_r|      AML_HAS_ARGS, "Copy_object",        ARGP_COPY_OP,              ARGI_COPY_OP),
+/*  79 */   /* AML_MID_OP */	   OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2_r|      AML_HAS_ARGS, "Mid",                ARGP_MID_OP,               ARGI_MID_OP),
+/*  7_a */  /* AML_CONTINUE_OP */	 OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CONTROL|         AML_NO_ARGS,  "Continue",           ARGP_CONTINUE_OP,          ARGI_CONTINUE_OP),
+/*  7_b */  /* AML_LOAD_TABLE_OP */	  OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2_r|      AML_HAS_ARGS, "Load_table",         ARGP_LOAD_TABLE_OP,        ARGI_LOAD_TABLE_OP),
+/*  7_c */  /* AML_DATA_REGION_OP */	 OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2_r|      AML_HAS_ARGS, "Data_op_region",     ARGP_DATA_REGION_OP,       ARGI_DATA_REGION_OP),
 
 };
 
@@ -484,38 +484,38 @@
 {
 /*              0     1     2     3     4     5     6     7  */
 /*              8     9     A     B     C     D     E     F  */
-/* 0x00 */    0x00, 0x01, _UNK, _UNK, _UNK, _UNK, 0x02, _UNK,
-/* 0x08 */    0x03, _UNK, 0x04, 0x05, 0x06, 0x07, 0x6E, _UNK,
-/* 0x10 */    0x08, 0x09, 0x0a, 0x6F, 0x0b, _UNK, _UNK, _UNK,
-/* 0x18 */    _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
-/* 0x20 */    _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
-/* 0x28 */    _UNK, _UNK, _UNK, _UNK, _UNK, 0x63, _PFX, _PFX,
-/* 0x30 */    0x67, 0x66, 0x68, 0x65, 0x69, 0x64, 0x6A, _UNK,
-/* 0x38 */    _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
-/* 0x40 */    _UNK, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC,
-/* 0x48 */    _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC,
-/* 0x50 */    _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC,
-/* 0x58 */    _ASC, _ASC, _ASC, _UNK, _PFX, _UNK, _PFX, _ASC,
-/* 0x60 */    0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13,
-/* 0x68 */    0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, _UNK,
-/* 0x70 */    0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22,
-/* 0x78 */    0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a,
-/* 0x80 */    0x2b, 0x2c, 0x2d, 0x2e, 0x70, 0x71, 0x2f, 0x30,
-/* 0x88 */    0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x72,
-/* 0x90 */    0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x73, 0x74,
-/* 0x98 */    0x75, 0x76, _UNK, _UNK, 0x77, 0x78, 0x79, 0x7A,
-/* 0xA0 */    0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43, 0x60, 0x61,
-/* 0xA8 */    0x62, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
-/* 0xB0 */    _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
-/* 0xB8 */    _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
-/* 0xC0 */    _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
-/* 0xC8 */    _UNK, _UNK, _UNK, _UNK, 0x44, _UNK, _UNK, _UNK,
-/* 0xD0 */    _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
-/* 0xD8 */    _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
-/* 0xE0 */    _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
-/* 0xE8 */    _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
-/* 0xF0 */    _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
-/* 0xF8 */    _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, 0x45,
+/* 0x00 */	0x00, 0x01, _UNK, _UNK, _UNK, _UNK, 0x02, _UNK,
+/* 0x08 */	0x03, _UNK, 0x04, 0x05, 0x06, 0x07, 0x6E, _UNK,
+/* 0x10 */	0x08, 0x09, 0x0a, 0x6F, 0x0b, _UNK, _UNK, _UNK,
+/* 0x18 */	_UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
+/* 0x20 */	_UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
+/* 0x28 */	_UNK, _UNK, _UNK, _UNK, _UNK, 0x63, _PFX, _PFX,
+/* 0x30 */	0x67, 0x66, 0x68, 0x65, 0x69, 0x64, 0x6A, _UNK,
+/* 0x38 */	_UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
+/* 0x40 */	_UNK, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC,
+/* 0x48 */	_ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC,
+/* 0x50 */	_ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC,
+/* 0x58 */	_ASC, _ASC, _ASC, _UNK, _PFX, _UNK, _PFX, _ASC,
+/* 0x60 */	0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13,
+/* 0x68 */	0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, _UNK,
+/* 0x70 */	0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22,
+/* 0x78 */	0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a,
+/* 0x80 */	0x2b, 0x2c, 0x2d, 0x2e, 0x70, 0x71, 0x2f, 0x30,
+/* 0x88 */	0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x72,
+/* 0x90 */	0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x73, 0x74,
+/* 0x98 */	0x75, 0x76, _UNK, _UNK, 0x77, 0x78, 0x79, 0x7A,
+/* 0xA0 */	0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43, 0x60, 0x61,
+/* 0xA8 */	0x62, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
+/* 0xB0 */	_UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
+/* 0xB8 */	_UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
+/* 0xC0 */	_UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
+/* 0xC8 */	_UNK, _UNK, _UNK, _UNK, 0x44, _UNK, _UNK, _UNK,
+/* 0xD0 */	_UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
+/* 0xD8 */	_UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
+/* 0xE0 */	_UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
+/* 0xE8 */	_UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
+/* 0xF0 */	_UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
+/* 0xF8 */	_UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, 0x45,
 };
 
 
@@ -523,24 +523,24 @@
 {
 /*              0     1     2     3     4     5     6     7  */
 /*              8     9     A     B     C     D     E     F  */
-/* 0x00 */    _UNK, 0x46, 0x47, _UNK, _UNK, _UNK, _UNK, _UNK,
-/* 0x08 */    _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
-/* 0x10 */    _UNK, _UNK, 0x48, 0x49, _UNK, _UNK, _UNK, _UNK,
-/* 0x18 */    _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, 0x7B,
-/* 0x20 */    0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51,
-/* 0x28 */    0x52, 0x53, 0x54, _UNK, _UNK, _UNK, _UNK, _UNK,
-/* 0x30 */    0x55, 0x56, 0x57, _UNK, _UNK, _UNK, _UNK, _UNK,
-/* 0x38 */    _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
-/* 0x40 */    _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
-/* 0x48 */    _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
-/* 0x50 */    _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
-/* 0x58 */    _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
-/* 0x60 */    _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
-/* 0x68 */    _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
-/* 0x70 */    _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
-/* 0x78 */    _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
-/* 0x80 */    0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f,
-/* 0x88 */    0x7C,
+/* 0x00 */	_UNK, 0x46, 0x47, _UNK, _UNK, _UNK, _UNK, _UNK,
+/* 0x08 */	_UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
+/* 0x10 */	_UNK, _UNK, 0x48, 0x49, _UNK, _UNK, _UNK, _UNK,
+/* 0x18 */	_UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, 0x7B,
+/* 0x20 */	0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51,
+/* 0x28 */	0x52, 0x53, 0x54, _UNK, _UNK, _UNK, _UNK, _UNK,
+/* 0x30 */	0x55, 0x56, 0x57, _UNK, _UNK, _UNK, _UNK, _UNK,
+/* 0x38 */	_UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
+/* 0x40 */	_UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
+/* 0x48 */	_UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
+/* 0x50 */	_UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
+/* 0x58 */	_UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
+/* 0x60 */	_UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
+/* 0x68 */	_UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
+/* 0x70 */	_UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
+/* 0x78 */	_UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
+/* 0x80 */	0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f,
+/* 0x88 */	0x7C,
 };
 
 
@@ -567,6 +567,9 @@
 	u8                      lower_opcode;
 
 
+	PROC_NAME ("Ps_get_opcode_info");
+
+
 	/* Split the 16-bit opcode into separate bytes */
 
 	upper_opcode = (u8) (opcode >> 8);
@@ -581,8 +584,7 @@
 	 * Detect normal 8-bit opcode or extended 16-bit opcode
 	 */
 
-	switch (upper_opcode)
-	{
+	switch (upper_opcode) {
 	case 0:
 
 		/* Simple (8-bit) opcode: 0-255, can't index beyond table  */
diff -urN linux-2.4.6-pre4/drivers/acpi/parser/psparse.c linux/drivers/acpi/parser/psparse.c
--- linux-2.4.6-pre4/drivers/acpi/parser/psparse.c	Mon Jan 29 10:15:59 2001
+++ linux/drivers/acpi/parser/psparse.c	Mon Dec  3 22:48:42 2001
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: psparse - Parser top level AML parse routines
- *              $Revision: 74 $
+ *              $Revision: 85 $
  *
  *****************************************************************************/
 
@@ -39,8 +39,9 @@
 #include "amlcode.h"
 #include "acnamesp.h"
 #include "acdebug.h"
+#include "acinterp.h"
 
-#define _COMPONENT          PARSER
+#define _COMPONENT          ACPI_PARSER
 	 MODULE_NAME         ("psparse")
 
 
@@ -111,9 +112,9 @@
 	 *
 	 *    if (Opcode == AML_EXTOP
 	 *       || (Opcode == AML_LNOT
-	 *          && (GET8 (Acpi_aml) == AML_LEQUAL
-	 *               || GET8 (Acpi_aml) == AML_LGREATER
-	 *               || GET8 (Acpi_aml) == AML_LLESS)))
+	 *          && (GET8 (Aml) == AML_LEQUAL
+	 *               || GET8 (Aml) == AML_LGREATER
+	 *               || GET8 (Aml) == AML_LLESS)))
 	 *
 	 *     extended Opcode, !=, <=, or >=
 	 */
@@ -135,8 +136,8 @@
  *
  * FUNCTION:    Acpi_ps_create_state
  *
- * PARAMETERS:  Acpi_aml            - Acpi_aml code pointer
- *              Acpi_aml_size       - Length of AML code
+ * PARAMETERS:  Aml             - Aml code pointer
+ *              Aml_size        - Length of AML code
  *
  * RETURN:      A new parser state object
  *
@@ -152,7 +153,7 @@
 	ACPI_PARSE_STATE        *parser_state;
 
 
-	parser_state = acpi_cm_callocate (sizeof (ACPI_PARSE_STATE));
+	parser_state = acpi_ut_callocate (sizeof (ACPI_PARSE_STATE));
 	if (!parser_state) {
 		return (NULL);
 	}
@@ -260,8 +261,7 @@
 		(opcode_class != OPTYPE_LOCAL_VARIABLE) &&
 		(opcode_class != OPTYPE_METHOD_ARGUMENT) &&
 		(opcode_class != OPTYPE_DATA_TERM)      &&
-		(op->opcode  != AML_NAMEPATH_OP))
-	{
+		(op->opcode  != AML_INT_NAMEPATH_OP)) {
 		/* Make sure that we only delete this subtree */
 
 		if (op->parent) {
@@ -272,8 +272,7 @@
 
 			parent_info = acpi_ps_get_opcode_info (op->parent->opcode);
 
-			switch (ACPI_GET_OP_CLASS (parent_info))
-			{
+			switch (ACPI_GET_OP_CLASS (parent_info)) {
 			case OPTYPE_CONTROL:        /* IF, ELSE, WHILE only */
 				break;
 
@@ -284,15 +283,14 @@
 				 * op must be replace by a placeholder return op
 				 */
 
-				if ((op->parent->opcode == AML_REGION_OP)       ||
-					(op->parent->opcode == AML_CREATE_FIELD_OP) ||
-					(op->parent->opcode == AML_BIT_FIELD_OP)    ||
-					(op->parent->opcode == AML_BYTE_FIELD_OP)   ||
-					(op->parent->opcode == AML_WORD_FIELD_OP)   ||
-					(op->parent->opcode == AML_DWORD_FIELD_OP)  ||
-					(op->parent->opcode == AML_QWORD_FIELD_OP))
-				{
-					replacement_op = acpi_ps_alloc_op (AML_RETURN_VALUE_OP);
+				if ((op->parent->opcode == AML_REGION_OP)               ||
+					(op->parent->opcode == AML_CREATE_FIELD_OP)         ||
+					(op->parent->opcode == AML_CREATE_BIT_FIELD_OP)     ||
+					(op->parent->opcode == AML_CREATE_BYTE_FIELD_OP)    ||
+					(op->parent->opcode == AML_CREATE_WORD_FIELD_OP)    ||
+					(op->parent->opcode == AML_CREATE_DWORD_FIELD_OP)   ||
+					(op->parent->opcode == AML_CREATE_QWORD_FIELD_OP)) {
+					replacement_op = acpi_ps_alloc_op (AML_INT_RETURN_VALUE_OP);
 					if (!replacement_op) {
 						return (FALSE);
 					}
@@ -301,7 +299,7 @@
 				break;
 
 			default:
-				replacement_op = acpi_ps_alloc_op (AML_RETURN_VALUE_OP);
+				replacement_op = acpi_ps_alloc_op (AML_INT_RETURN_VALUE_OP);
 				if (!replacement_op) {
 					return (FALSE);
 				}
@@ -388,8 +386,7 @@
 	u32                     package_length;
 
 
-	switch (callback_status)
-	{
+	switch (callback_status) {
 	case AE_CTRL_TERMINATE:
 
 		/*
@@ -505,7 +502,7 @@
 	ACPI_PARSE2_OBJECT      *deferred_op;
 	u32                     arg_count;      /* push for fixed or var args */
 	u32                     arg_types = 0;
-	ACPI_PTRDIFF            aml_offset;
+	u32                     aml_offset;
 	u16                     opcode;
 	ACPI_PARSE_OBJECT       pre_op;
 	ACPI_PARSE_STATE        *parser_state;
@@ -528,8 +525,7 @@
 				(parser_state->scope->parse_scope.op->opcode == AML_WHILE_OP)) &&
 				(walk_state->control_state) &&
 				(walk_state->control_state->common.state ==
-					CONTROL_PREDICATE_EXECUTING))
-			{
+					CONTROL_PREDICATE_EXECUTING)) {
 
 				/*
 				 * A predicate was just completed, get the value of the
@@ -538,8 +534,7 @@
 
 				status = acpi_ds_get_predicate_value (walk_state, NULL, TRUE);
 				if (ACPI_FAILURE (status) &&
-					((status & AE_CODE_MASK) != AE_CODE_CONTROL))
-				{
+					((status & AE_CODE_MASK) != AE_CODE_CONTROL)) {
 					return (status);
 				}
 
@@ -577,8 +572,7 @@
 			 */
 
 			op_info = acpi_ps_get_opcode_info (opcode);
-			switch (ACPI_GET_OP_TYPE (op_info))
-			{
+			switch (ACPI_GET_OP_TYPE (op_info)) {
 			case ACPI_OP_TYPE_OPCODE:
 
 				/* Found opcode info, this is a normal opcode */
@@ -594,7 +588,7 @@
 				 * string.  Convert the bare name string to a namepath.
 				 */
 
-				opcode = AML_NAMEPATH_OP;
+				opcode = AML_INT_NAMEPATH_OP;
 				arg_types = ARGP_NAMESTRING;
 				break;
 
@@ -684,12 +678,12 @@
 				}
 
 
-				if ((op->opcode == AML_CREATE_FIELD_OP) ||
-					(op->opcode == AML_BIT_FIELD_OP)    ||
-					(op->opcode == AML_BYTE_FIELD_OP)   ||
-					(op->opcode == AML_WORD_FIELD_OP)   ||
-					(op->opcode == AML_DWORD_FIELD_OP))
-				 {
+				if ((op->opcode == AML_CREATE_FIELD_OP)        ||
+					(op->opcode == AML_CREATE_BIT_FIELD_OP)    ||
+					(op->opcode == AML_CREATE_BYTE_FIELD_OP)   ||
+					(op->opcode == AML_CREATE_WORD_FIELD_OP)   ||
+					(op->opcode == AML_CREATE_DWORD_FIELD_OP)  ||
+					(op->opcode == AML_CREATE_QWORD_FIELD_OP)) {
 					/*
 					 * Backup to beginning of Create_xXXfield declaration
 					 * Body_length is unknown until we parse the body
@@ -733,8 +727,7 @@
 		if (arg_types)  /* Are there any arguments that must be processed? */ {
 			/* get arguments */
 
-			switch (op->opcode)
-			{
+			switch (op->opcode) {
 			case AML_BYTE_OP:       /* AML_BYTEDATA_ARG */
 			case AML_WORD_OP:       /* AML_WORDDATA_ARG */
 			case AML_DWORD_OP:      /* AML_DWORDATA_ARG */
@@ -746,7 +739,7 @@
 						 GET_CURRENT_ARG_TYPE (arg_types), op);
 				break;
 
-			case AML_NAMEPATH_OP:   /* AML_NAMESTRING_ARG */
+			case AML_INT_NAMEPATH_OP:   /* AML_NAMESTRING_ARG */
 
 				acpi_ps_get_next_namepath (parser_state, op, &arg_count, 1);
 				arg_types = 0;
@@ -783,8 +776,8 @@
 						 */
 
 						deferred_op->data   = parser_state->aml;
-						deferred_op->length = parser_state->pkg_end -
-								  parser_state->aml;
+						deferred_op->length = (u32) (parser_state->pkg_end -
+								   parser_state->aml);
 
 						/*
 						 * Skip body of method.  For Op_regions, we must continue
@@ -824,19 +817,18 @@
 						 * know the length.
 						 */
 
-						deferred_op->length = parser_state->aml -
-								 deferred_op->data;
+						deferred_op->length = (u32) (parser_state->aml -
+								   deferred_op->data);
 					}
 				}
 			}
 
-			if ((op->opcode == AML_CREATE_FIELD_OP) ||
-				(op->opcode == AML_BIT_FIELD_OP)    ||
-				(op->opcode == AML_BYTE_FIELD_OP)   ||
-				(op->opcode == AML_WORD_FIELD_OP)   ||
-				(op->opcode == AML_DWORD_FIELD_OP)  ||
-				(op->opcode == AML_QWORD_FIELD_OP))
-			{
+			if ((op->opcode == AML_CREATE_FIELD_OP)         ||
+				(op->opcode == AML_CREATE_BIT_FIELD_OP)     ||
+				(op->opcode == AML_CREATE_BYTE_FIELD_OP)    ||
+				(op->opcode == AML_CREATE_WORD_FIELD_OP)    ||
+				(op->opcode == AML_CREATE_DWORD_FIELD_OP)   ||
+				(op->opcode == AML_CREATE_QWORD_FIELD_OP)) {
 				/*
 				 * Backup to beginning of Create_xXXfield declaration (1 for
 				 * Opcode)
@@ -844,7 +836,8 @@
 				 * Body_length is unknown until we parse the body
 				 */
 				deferred_op = (ACPI_PARSE2_OBJECT *) op;
-				deferred_op->length = parser_state->aml - deferred_op->data;
+				deferred_op->length = (u32) (parser_state->aml -
+						  deferred_op->data);
 			}
 
 			/* This op complete, notify the dispatcher */
@@ -873,8 +866,7 @@
 			}
 
 
-			switch (status)
-			{
+			switch (status) {
 			case AE_OK:
 				break;
 
@@ -908,8 +900,7 @@
 				status = AE_OK;
 
 				/* Clean up */
-				do
-				{
+				do {
 					if (op) {
 						acpi_ps_complete_this_op (walk_state, op);
 					}
@@ -970,8 +961,7 @@
 	 * sequential closing braces).  We want to terminate each one cleanly.
 	 */
 
-	do
-	{
+	do {
 		if (op) {
 			if (walk_state->ascending_callback != NULL) {
 				status = walk_state->ascending_callback (walk_state, op);
@@ -985,8 +975,7 @@
 					status = AE_OK;
 
 					/* Clean up */
-					do
-					{
+					do {
 						if (op) {
 							acpi_ps_complete_this_op (walk_state, op);
 						}
@@ -1068,8 +1057,11 @@
 	/* Create and initialize a new walk list */
 
 	walk_list.walk_state = NULL;
+	walk_list.acquired_mutex_list.prev = NULL;
+	walk_list.acquired_mutex_list.next = NULL;
 
-	walk_state = acpi_ds_create_walk_state (TABLE_ID_DSDT, parser_state->start_op, mth_desc, &walk_list);
+	walk_state = acpi_ds_create_walk_state (TABLE_ID_DSDT, parser_state->start_op,
+			   mth_desc, &walk_list);
 	if (!walk_state) {
 		status = AE_NO_MEMORY;
 		goto cleanup;
@@ -1180,15 +1172,14 @@
 		 /* Delete this walk state and all linked control states */
 
 		acpi_ps_cleanup_scope (walk_state->parser_state);
-		acpi_cm_free (walk_state->parser_state);
+		acpi_ut_free (walk_state->parser_state);
 		acpi_ds_delete_walk_state (walk_state);
 
 	   /* Check if we have restarted a preempted walk */
 
 		walk_state = acpi_ds_get_current_walk_state (&walk_list);
 		if (walk_state &&
-			ACPI_SUCCESS (status))
-		{
+			ACPI_SUCCESS (status)) {
 			/* There is another walk state, restart it */
 
 			/*
@@ -1212,13 +1203,14 @@
 		else if (return_desc) {
 			/* Caller doesn't want it, must delete it */
 
-			acpi_cm_remove_reference (return_desc);
+			acpi_ut_remove_reference (return_desc);
 		}
 	}
 
 
 	/* Normal exit */
 
+	acpi_ex_release_all_mutexes ((ACPI_OPERAND_OBJECT *) &walk_list.acquired_mutex_list);
 	acpi_gbl_current_walk_list = prev_walk_list;
 	return (status);
 
@@ -1229,8 +1221,9 @@
 
 	acpi_ds_delete_walk_state (walk_state);
 	acpi_ps_cleanup_scope (parser_state);
-	acpi_cm_free (parser_state);
+	acpi_ut_free (parser_state);
 
+	acpi_ex_release_all_mutexes ((ACPI_OPERAND_OBJECT *)&walk_list.acquired_mutex_list);
 	acpi_gbl_current_walk_list = prev_walk_list;
 
 	return (status);
diff -urN linux-2.4.6-pre4/drivers/acpi/parser/psscope.c linux/drivers/acpi/parser/psscope.c
--- linux-2.4.6-pre4/drivers/acpi/parser/psscope.c	Mon Jan 22 13:23:43 2001
+++ linux/drivers/acpi/parser/psscope.c	Mon Dec  3 22:48:42 2001
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: psscope - Parser scope stack management routines
- *              $Revision: 24 $
+ *              $Revision: 27 $
  *
  *****************************************************************************/
 
@@ -27,7 +27,7 @@
 #include "acpi.h"
 #include "acparser.h"
 
-#define _COMPONENT          PARSER
+#define _COMPONENT          ACPI_PARSER
 	 MODULE_NAME         ("psscope")
 
 
@@ -95,7 +95,7 @@
 	ACPI_GENERIC_STATE      *scope;
 
 
-	scope = acpi_cm_create_generic_state ();
+	scope = acpi_ut_create_generic_state ();
 	if (!scope) {
 		return (AE_NO_MEMORY);
 	}
@@ -137,7 +137,7 @@
 	ACPI_GENERIC_STATE      *scope;
 
 
-	scope = acpi_cm_create_generic_state ();
+	scope = acpi_ut_create_generic_state ();
 	if (!scope) {
 		return (AE_NO_MEMORY);
 	}
@@ -150,7 +150,7 @@
 
 	/* Push onto scope stack */
 
-	acpi_cm_push_generic_state (&parser_state->scope, scope);
+	acpi_ut_push_generic_state (&parser_state->scope, scope);
 
 
 	if (arg_count == ACPI_VAR_ARGS) {
@@ -199,7 +199,7 @@
 	 * Only pop the scope if there is in fact a next scope
 	 */
 	if (scope->common.next) {
-		scope = acpi_cm_pop_generic_state (&parser_state->scope);
+		scope = acpi_ut_pop_generic_state (&parser_state->scope);
 
 
 		/* return to parsing previous op */
@@ -211,7 +211,7 @@
 
 		/* All done with this scope state structure */
 
-		acpi_cm_delete_generic_state (scope);
+		acpi_ut_delete_generic_state (scope);
 	}
 
 	else {
@@ -255,8 +255,8 @@
 	/* Delete anything on the scope stack */
 
 	while (parser_state->scope) {
-		scope = acpi_cm_pop_generic_state (&parser_state->scope);
-		acpi_cm_delete_generic_state (scope);
+		scope = acpi_ut_pop_generic_state (&parser_state->scope);
+		acpi_ut_delete_generic_state (scope);
 	}
 
 	return;
diff -urN linux-2.4.6-pre4/drivers/acpi/parser/pstree.c linux/drivers/acpi/parser/pstree.c
--- linux-2.4.6-pre4/drivers/acpi/parser/pstree.c	Mon Jan 22 13:23:43 2001
+++ linux/drivers/acpi/parser/pstree.c	Mon Dec  3 22:48:42 2001
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: pstree - Parser op tree manipulation/traversal/search
- *              $Revision: 27 $
+ *              $Revision: 30 $
  *
  *****************************************************************************/
 
@@ -28,7 +28,7 @@
 #include "acparser.h"
 #include "amlcode.h"
 
-#define _COMPONENT          PARSER
+#define _COMPONENT          ACPI_PARSER
 	 MODULE_NAME         ("pstree")
 
 
@@ -174,13 +174,12 @@
 	ACPI_PARSE_OBJECT       *child = NULL;
 
 
-	switch (op->opcode)
-	{
+	switch (op->opcode) {
 	case AML_SCOPE_OP:
 	case AML_ELSE_OP:
 	case AML_DEVICE_OP:
 	case AML_THERMAL_ZONE_OP:
-	case AML_METHODCALL_OP:
+	case AML_INT_METHODCALL_OP:
 
 		child = acpi_ps_get_arg (op, 0);
 		break;
@@ -191,7 +190,7 @@
 	case AML_METHOD_OP:
 	case AML_IF_OP:
 	case AML_WHILE_OP:
-	case AML_DEF_FIELD_OP:
+	case AML_FIELD_OP:
 
 		child = acpi_ps_get_arg (op, 1);
 		break;
diff -urN linux-2.4.6-pre4/drivers/acpi/parser/psutils.c linux/drivers/acpi/parser/psutils.c
--- linux-2.4.6-pre4/drivers/acpi/parser/psutils.c	Mon Jan 22 13:23:43 2001
+++ linux/drivers/acpi/parser/psutils.c	Mon Dec  3 22:48:42 2001
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: psutils - Parser miscellaneous utilities (Parser only)
- *              $Revision: 32 $
+ *              $Revision: 37 $
  *
  *****************************************************************************/
 
@@ -28,7 +28,7 @@
 #include "acparser.h"
 #include "amlcode.h"
 
-#define _COMPONENT          PARSER
+#define _COMPONENT          ACPI_PARSER
 	 MODULE_NAME         ("psutils")
 
 
@@ -94,6 +94,9 @@
 	u8                      flags;
 
 
+	PROC_NAME ("Ps_alloc_op");
+
+
 	/* Allocate the minimum required size object */
 
 	if (acpi_ps_is_deferred_op (opcode)) {
@@ -125,7 +128,7 @@
 		 * Check if there is an Op already available in the cache
 		 */
 
-		acpi_cm_acquire_mutex (ACPI_MTX_CACHES);
+		acpi_ut_acquire_mutex (ACPI_MTX_CACHES);
 		acpi_gbl_parse_cache_requests++;
 		if (acpi_gbl_parse_cache) {
 			/* Extract an op from the front of the cache list */
@@ -142,7 +145,7 @@
 			MEMSET (op, 0, sizeof (ACPI_PARSE_OBJECT));
 
 		}
-		acpi_cm_release_mutex (ACPI_MTX_CACHES);
+		acpi_ut_release_mutex (ACPI_MTX_CACHES);
 	}
 
 	else {
@@ -153,7 +156,7 @@
 		 * Check if there is an Op already available in the cache
 		 */
 
-		acpi_cm_acquire_mutex (ACPI_MTX_CACHES);
+		acpi_ut_acquire_mutex (ACPI_MTX_CACHES);
 		acpi_gbl_ext_parse_cache_requests++;
 		if (acpi_gbl_ext_parse_cache) {
 			/* Extract an op from the front of the cache list */
@@ -170,14 +173,14 @@
 			MEMSET (op, 0, sizeof (ACPI_PARSE2_OBJECT));
 
 		}
-		acpi_cm_release_mutex (ACPI_MTX_CACHES);
+		acpi_ut_release_mutex (ACPI_MTX_CACHES);
 	}
 
 
 	/* Allocate a new Op if necessary */
 
 	if (!op) {
-		op = acpi_cm_callocate (size);
+		op = acpi_ut_callocate (size);
 	}
 
 	/* Initialize the Op */
@@ -207,6 +210,7 @@
 acpi_ps_free_op (
 	ACPI_PARSE_OBJECT       *op)
 {
+	PROC_NAME ("Ps_free_op");
 
 
 
@@ -221,13 +225,13 @@
 			MEMSET (op, 0, sizeof (ACPI_PARSE_OBJECT));
 			op->flags = PARSEOP_IN_CACHE;
 
-			acpi_cm_acquire_mutex (ACPI_MTX_CACHES);
+			acpi_ut_acquire_mutex (ACPI_MTX_CACHES);
 			acpi_gbl_parse_cache_depth++;
 
 			op->next = acpi_gbl_parse_cache;
 			acpi_gbl_parse_cache = op;
 
-			acpi_cm_release_mutex (ACPI_MTX_CACHES);
+			acpi_ut_release_mutex (ACPI_MTX_CACHES);
 			return;
 		}
 	}
@@ -243,13 +247,13 @@
 			MEMSET (op, 0, sizeof (ACPI_PARSE2_OBJECT));
 			op->flags = PARSEOP_IN_CACHE;
 
-			acpi_cm_acquire_mutex (ACPI_MTX_CACHES);
+			acpi_ut_acquire_mutex (ACPI_MTX_CACHES);
 			acpi_gbl_ext_parse_cache_depth++;
 
 			op->next = (ACPI_PARSE_OBJECT *) acpi_gbl_ext_parse_cache;
 			acpi_gbl_ext_parse_cache = (ACPI_PARSE2_OBJECT *) op;
 
-			acpi_cm_release_mutex (ACPI_MTX_CACHES);
+			acpi_ut_release_mutex (ACPI_MTX_CACHES);
 			return;
 		}
 	}
@@ -259,7 +263,7 @@
 	 * Not a GENERIC OP, or the cache is full, just free the Op
 	 */
 
-	acpi_cm_free (op);
+	acpi_ut_free (op);
 }
 
 
@@ -288,7 +292,7 @@
 		/* Delete one cached state object */
 
 		next = acpi_gbl_parse_cache->next;
-		acpi_cm_free (acpi_gbl_parse_cache);
+		acpi_ut_free (acpi_gbl_parse_cache);
 		acpi_gbl_parse_cache = next;
 		acpi_gbl_parse_cache_depth--;
 	}
@@ -299,7 +303,7 @@
 		/* Delete one cached state object */
 
 		next = acpi_gbl_ext_parse_cache->next;
-		acpi_cm_free (acpi_gbl_ext_parse_cache);
+		acpi_ut_free (acpi_gbl_ext_parse_cache);
 		acpi_gbl_ext_parse_cache = (ACPI_PARSE2_OBJECT *) next;
 		acpi_gbl_ext_parse_cache_depth--;
 	}
@@ -350,28 +354,29 @@
 	u16                     opcode)
 {
 	return ((u8)
-		   (opcode == AML_SCOPE_OP          ||
-			opcode == AML_DEVICE_OP         ||
-			opcode == AML_THERMAL_ZONE_OP   ||
-			opcode == AML_METHOD_OP         ||
-			opcode == AML_POWER_RES_OP      ||
-			opcode == AML_PROCESSOR_OP      ||
-			opcode == AML_DEF_FIELD_OP      ||
-			opcode == AML_INDEX_FIELD_OP    ||
-			opcode == AML_BANK_FIELD_OP     ||
-			opcode == AML_NAMEDFIELD_OP     ||
-			opcode == AML_NAME_OP           ||
-			opcode == AML_ALIAS_OP          ||
-			opcode == AML_MUTEX_OP          ||
-			opcode == AML_EVENT_OP          ||
-			opcode == AML_REGION_OP         ||
-			opcode == AML_CREATE_FIELD_OP   ||
-			opcode == AML_BIT_FIELD_OP      ||
-			opcode == AML_BYTE_FIELD_OP     ||
-			opcode == AML_WORD_FIELD_OP     ||
-			opcode == AML_DWORD_FIELD_OP    ||
-			opcode == AML_METHODCALL_OP     ||
-			opcode == AML_NAMEPATH_OP));
+		   (opcode == AML_SCOPE_OP              ||
+			opcode == AML_DEVICE_OP             ||
+			opcode == AML_THERMAL_ZONE_OP       ||
+			opcode == AML_METHOD_OP             ||
+			opcode == AML_POWER_RES_OP          ||
+			opcode == AML_PROCESSOR_OP          ||
+			opcode == AML_FIELD_OP              ||
+			opcode == AML_INDEX_FIELD_OP        ||
+			opcode == AML_BANK_FIELD_OP         ||
+			opcode == AML_INT_NAMEDFIELD_OP     ||
+			opcode == AML_NAME_OP               ||
+			opcode == AML_ALIAS_OP              ||
+			opcode == AML_MUTEX_OP              ||
+			opcode == AML_EVENT_OP              ||
+			opcode == AML_REGION_OP             ||
+			opcode == AML_CREATE_FIELD_OP       ||
+			opcode == AML_CREATE_BIT_FIELD_OP   ||
+			opcode == AML_CREATE_BYTE_FIELD_OP  ||
+			opcode == AML_CREATE_WORD_FIELD_OP  ||
+			opcode == AML_CREATE_DWORD_FIELD_OP ||
+			opcode == AML_CREATE_QWORD_FIELD_OP ||
+			opcode == AML_INT_METHODCALL_OP     ||
+			opcode == AML_INT_NAMEPATH_OP));
 }
 
 u8
@@ -385,7 +390,7 @@
 			opcode == AML_METHOD_OP         ||
 			opcode == AML_POWER_RES_OP      ||
 			opcode == AML_PROCESSOR_OP      ||
-			opcode == AML_DEF_FIELD_OP      ||
+			opcode == AML_FIELD_OP          ||
 			opcode == AML_INDEX_FIELD_OP    ||
 			opcode == AML_BANK_FIELD_OP     ||
 			opcode == AML_NAME_OP           ||
@@ -393,7 +398,7 @@
 			opcode == AML_MUTEX_OP          ||
 			opcode == AML_EVENT_OP          ||
 			opcode == AML_REGION_OP         ||
-			opcode == AML_NAMEDFIELD_OP));
+			opcode == AML_INT_NAMEDFIELD_OP));
 }
 
 
@@ -408,27 +413,28 @@
 	u16                     opcode)
 {
 	return ((u8)
-		   (opcode == AML_SCOPE_OP          ||
-			opcode == AML_DEVICE_OP         ||
-			opcode == AML_THERMAL_ZONE_OP   ||
-			opcode == AML_METHOD_OP         ||
-			opcode == AML_POWER_RES_OP      ||
-			opcode == AML_PROCESSOR_OP      ||
-			opcode == AML_NAMEDFIELD_OP     ||
-			opcode == AML_NAME_OP           ||
-			opcode == AML_ALIAS_OP          ||
-			opcode == AML_MUTEX_OP          ||
-			opcode == AML_EVENT_OP          ||
-			opcode == AML_REGION_OP         ||
-
-
-			opcode == AML_CREATE_FIELD_OP   ||
-			opcode == AML_BIT_FIELD_OP      ||
-			opcode == AML_BYTE_FIELD_OP     ||
-			opcode == AML_WORD_FIELD_OP     ||
-			opcode == AML_DWORD_FIELD_OP    ||
-			opcode == AML_METHODCALL_OP     ||
-			opcode == AML_NAMEPATH_OP));
+		   (opcode == AML_SCOPE_OP              ||
+			opcode == AML_DEVICE_OP             ||
+			opcode == AML_THERMAL_ZONE_OP       ||
+			opcode == AML_METHOD_OP             ||
+			opcode == AML_POWER_RES_OP          ||
+			opcode == AML_PROCESSOR_OP          ||
+			opcode == AML_INT_NAMEDFIELD_OP     ||
+			opcode == AML_NAME_OP               ||
+			opcode == AML_ALIAS_OP              ||
+			opcode == AML_MUTEX_OP              ||
+			opcode == AML_EVENT_OP              ||
+			opcode == AML_REGION_OP             ||
+
+
+			opcode == AML_CREATE_FIELD_OP       ||
+			opcode == AML_CREATE_BIT_FIELD_OP   ||
+			opcode == AML_CREATE_BYTE_FIELD_OP  ||
+			opcode == AML_CREATE_WORD_FIELD_OP  ||
+			opcode == AML_CREATE_DWORD_FIELD_OP ||
+			opcode == AML_CREATE_QWORD_FIELD_OP ||
+			opcode == AML_INT_METHODCALL_OP     ||
+			opcode == AML_INT_NAMEPATH_OP));
 }
 
 
@@ -451,7 +457,7 @@
 			opcode == AML_MUTEX_OP          ||
 			opcode == AML_EVENT_OP          ||
 			opcode == AML_REGION_OP         ||
-			opcode == AML_NAMEDFIELD_OP));
+			opcode == AML_INT_NAMEDFIELD_OP));
 }
 
 
@@ -460,12 +466,13 @@
 	u16                     opcode)
 {
 	return ((u8)
-		   (opcode == AML_METHOD_OP         ||
-			opcode == AML_CREATE_FIELD_OP   ||
-			opcode == AML_BIT_FIELD_OP      ||
-			opcode == AML_BYTE_FIELD_OP     ||
-			opcode == AML_WORD_FIELD_OP     ||
-			opcode == AML_DWORD_FIELD_OP    ||
+		   (opcode == AML_METHOD_OP                 ||
+			opcode == AML_CREATE_FIELD_OP           ||
+			opcode == AML_CREATE_BIT_FIELD_OP       ||
+			opcode == AML_CREATE_BYTE_FIELD_OP      ||
+			opcode == AML_CREATE_WORD_FIELD_OP      ||
+			opcode == AML_CREATE_DWORD_FIELD_OP     ||
+			opcode == AML_CREATE_QWORD_FIELD_OP     ||
 			opcode == AML_REGION_OP));
 }
 
@@ -477,7 +484,7 @@
 acpi_ps_is_bytelist_op (
 	u16                     opcode)
 {
-	return ((u8) (opcode == AML_BYTELIST_OP));
+	return ((u8) (opcode == AML_INT_BYTELIST_OP));
 }
 
 
@@ -490,7 +497,7 @@
 {
 	return ((u8)
 			  (opcode == AML_CREATE_FIELD_OP
-			|| opcode == AML_DEF_FIELD_OP
+			|| opcode == AML_FIELD_OP
 			|| opcode == AML_INDEX_FIELD_OP
 			|| opcode == AML_BANK_FIELD_OP));
 }
@@ -504,11 +511,12 @@
 	u16                     opcode)
 {
 	return ((u8)
-		   (opcode == AML_CREATE_FIELD_OP   ||
-			opcode == AML_BIT_FIELD_OP      ||
-			opcode == AML_BYTE_FIELD_OP     ||
-			opcode == AML_WORD_FIELD_OP     ||
-			opcode == AML_DWORD_FIELD_OP));
+		   (opcode == AML_CREATE_FIELD_OP           ||
+			opcode == AML_CREATE_BIT_FIELD_OP       ||
+			opcode == AML_CREATE_BYTE_FIELD_OP      ||
+			opcode == AML_CREATE_WORD_FIELD_OP      ||
+			opcode == AML_CREATE_DWORD_FIELD_OP     ||
+			opcode == AML_CREATE_QWORD_FIELD_OP));
 }
 
 
diff -urN linux-2.4.6-pre4/drivers/acpi/parser/pswalk.c linux/drivers/acpi/parser/pswalk.c
--- linux-2.4.6-pre4/drivers/acpi/parser/pswalk.c	Mon Jan 22 13:23:43 2001
+++ linux/drivers/acpi/parser/pswalk.c	Mon Dec  3 22:48:42 2001
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: pswalk - Parser routines to walk parsed op tree(s)
- *              $Revision: 52 $
+ *              $Revision: 55 $
  *
  *****************************************************************************/
 
@@ -31,7 +31,7 @@
 #include "acnamesp.h"
 #include "acinterp.h"
 
-#define _COMPONENT          PARSER
+#define _COMPONENT          ACPI_PARSER
 	 MODULE_NAME         ("pswalk")
 
 
@@ -243,6 +243,9 @@
 	/* Create and initialize a new walk list */
 
 	walk_list.walk_state = NULL;
+	walk_list.acquired_mutex_list.prev = NULL;
+	walk_list.acquired_mutex_list.next = NULL;
+
 	walk_state = acpi_ds_create_walk_state (TABLE_ID_DSDT, NULL, NULL, &walk_list);
 	if (!walk_state) {
 		return;
@@ -271,6 +274,7 @@
 
 	/* We are done with this walk */
 
+	acpi_ex_release_all_mutexes ((ACPI_OPERAND_OBJECT *) &walk_list.acquired_mutex_list);
 	acpi_ds_delete_walk_state (walk_state);
 
 	return;
diff -urN linux-2.4.6-pre4/drivers/acpi/parser/psxface.c linux/drivers/acpi/parser/psxface.c
--- linux-2.4.6-pre4/drivers/acpi/parser/psxface.c	Mon Jan 29 10:15:59 2001
+++ linux/drivers/acpi/parser/psxface.c	Mon Dec  3 22:48:42 2001
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: psxface - Parser external interfaces
- *              $Revision: 40 $
+ *              $Revision: 44 $
  *
  *****************************************************************************/
 
@@ -32,7 +32,7 @@
 #include "acnamesp.h"
 
 
-#define _COMPONENT          PARSER
+#define _COMPONENT          ACPI_PARSER
 	 MODULE_NAME         ("psxface")
 
 
@@ -79,7 +79,7 @@
 
 	/* Init for new method, wait on concurrency semaphore */
 
-	status = acpi_ds_begin_method_execution (method_node, obj_desc);
+	status = acpi_ds_begin_method_execution (method_node, obj_desc, NULL);
 	if (ACPI_FAILURE (status)) {
 		return (status);
 	}
@@ -91,7 +91,7 @@
 		 */
 
 		for (i = 0; params[i]; i++) {
-			acpi_cm_add_reference (params[i]);
+			acpi_ut_add_reference (params[i]);
 		}
 	}
 
@@ -141,7 +141,7 @@
 		/* Take away the extra reference that we gave the parameters above */
 
 		for (i = 0; params[i]; i++) {
-			acpi_cm_update_object_reference (params[i], REF_DECREMENT);
+			acpi_ut_update_object_reference (params[i], REF_DECREMENT);
 		}
 	}
 
diff -urN linux-2.4.6-pre4/drivers/acpi/power.c linux/drivers/acpi/power.c
--- linux-2.4.6-pre4/drivers/acpi/power.c	Mon Jan 22 13:23:43 2001
+++ linux/drivers/acpi/power.c	Wed Dec 31 16:00:00 1969
@@ -1,137 +0,0 @@
-/*
- *  power.c - Overall power driver. Also handles AC adapter device.
- *
- *  Copyright (C) 2000 Andrew Grover
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-#include <linux/kernel.h>
-#include <linux/types.h>
-#include <linux/proc_fs.h>
-#include "acpi.h"
-#include "driver.h"
-
-#define _COMPONENT	OS_DEPENDENT
-	MODULE_NAME	("power")
-
-int acpi_cmbatt_init(void);
-int acpi_cmbatt_terminate(void);
-
-/* ACPI-specific defines */
-#define ACPI_AC_ADAPTER_HID	"ACPI0003"
-
-static int ac_count = 0;
-static ACPI_HANDLE ac_handle = 0;
-
-/*
- * We found a device with the correct HID
- */
-static ACPI_STATUS
-acpi_found_ac_adapter(ACPI_HANDLE handle, u32 level, void *ctx, void **value)
-{
-	ACPI_DEVICE_INFO	info;
-
-	if (ac_count > 0) {
-		printk(KERN_ERR "AC Adapter: more than one!\n");
-		return (AE_OK);
-	}
-
-	if (!ACPI_SUCCESS(acpi_get_object_info(handle, &info))) {
-		printk(KERN_ERR "AC Adapter: Could not get AC Adapter object info\n");
-		return (AE_OK);
-	}
-
-	if (!(info.valid & ACPI_VALID_STA)) {
-		printk(KERN_ERR "AC Adapter: Battery _STA invalid\n");
-		return AE_OK;
-	}
-
-	printk(KERN_INFO "AC Adapter: found\n");
-
-	ac_handle = handle;
-
-	ac_count++;
-
-	return AE_OK;
-}
-
-static int
-proc_read_ac_adapter_status(char *page, char **start, off_t off,
-				int count, int *eof, void *data)
-{
-	ACPI_OBJECT obj;
-	ACPI_BUFFER buf;
-
-	char *p = page;
-	int len;
-
-	buf.length = sizeof(obj);
-	buf.pointer = &obj;
-	if (!ACPI_SUCCESS(acpi_evaluate_object(ac_handle, "_PSR", NULL, &buf))
-		|| obj.type != ACPI_TYPE_INTEGER) {
-		p += sprintf(p, "Could not read AC status\n");
-		goto end;
-	}
-
-	if (obj.integer.value)
-		p += sprintf(p, "on-line\n");
-	else
-		p += sprintf(p, "off-line\n");
-
-end:
-	len = (p - page);
-	if (len <= off+count) *eof = 1;
-	*start = page + off;
-	len -= off;
-	if (len>count) len = count;
-	if (len<0) len = 0;
-	return len;
-}
-
-int
-acpi_power_init(void)
-{
-	acpi_get_devices(ACPI_AC_ADAPTER_HID, 
-			acpi_found_ac_adapter,
-			NULL,
-			NULL);
-
-	if (!proc_mkdir("power", NULL))
-		return 0;
-
-	if (ac_handle) {
-		create_proc_read_entry("power/ac", 0, NULL,
-			proc_read_ac_adapter_status, NULL);
-	}
-
-	acpi_cmbatt_init();
-
-	return 0;
-}
-
-int
-acpi_power_terminate(void)
-{
-	acpi_cmbatt_terminate();
-
-	if (ac_handle) {
-		remove_proc_entry("power/ac", NULL);
-	}
-
-	remove_proc_entry("power", NULL);
-
-	return 0;
-}
diff -urN linux-2.4.6-pre4/drivers/acpi/resources/Makefile linux/drivers/acpi/resources/Makefile
--- linux-2.4.6-pre4/drivers/acpi/resources/Makefile	Fri Dec 29 14:07:21 2000
+++ linux/drivers/acpi/resources/Makefile	Mon Dec  3 22:48:42 2001
@@ -1,16 +1,12 @@
 #
 # Makefile for all Linux ACPI interpreter subdirectories
+# EXCEPT for the ospm directory
 #
 
-O_TARGET := ../$(shell basename `pwd`).o
+O_TARGET := $(notdir $(CURDIR)).o
 
 obj-$(CONFIG_ACPI) := $(patsubst %.c,%.o,$(wildcard *.c))
 
-EXTRA_CFLAGS += -I../include
-
 EXTRA_CFLAGS += $(ACPI_CFLAGS)
 
 include $(TOPDIR)/Rules.make
-
-clean:
-	$(RM) *.o 
diff -urN linux-2.4.6-pre4/drivers/acpi/resources/rsaddr.c linux/drivers/acpi/resources/rsaddr.c
--- linux-2.4.6-pre4/drivers/acpi/resources/rsaddr.c	Mon Jan 22 13:23:43 2001
+++ linux/drivers/acpi/resources/rsaddr.c	Mon Dec  3 22:48:42 2001
@@ -1,10 +1,7 @@
 /*******************************************************************************
  *
- * Module Name: rsaddr - Acpi_rs_address16_resource
- *                       Acpi_rs_address16_stream
- *                       Acpi_rs_address32_resource
- *                       Acpi_rs_address32_stream
- *              $Revision: 14 $
+ * Module Name: rsaddr - Address resource descriptors (16/32/64)
+ *              $Revision: 18 $
  *
  ******************************************************************************/
 
@@ -30,7 +27,7 @@
 #include "acpi.h"
 #include "acresrc.h"
 
-#define _COMPONENT          RESOURCE_MANAGER
+#define _COMPONENT          ACPI_RESOURCES
 	 MODULE_NAME         ("rsaddr")
 
 
@@ -39,20 +36,20 @@
  * FUNCTION:    Acpi_rs_address16_resource
  *
  * PARAMETERS:  Byte_stream_buffer      - Pointer to the resource input byte
- *                                              stream
+ *                                        stream
  *              Bytes_consumed          - u32 pointer that is filled with
- *                                          the number of bytes consumed from
- *                                          the Byte_stream_buffer
+ *                                        the number of bytes consumed from
+ *                                        the Byte_stream_buffer
  *              Output_buffer           - Pointer to the user's return buffer
  *              Structure_size          - u32 pointer that is filled with
- *                                          the number of bytes in the filled
- *                                          in structure
+ *                                        the number of bytes in the filled
+ *                                        in structure
  *
- * RETURN:      Status  AE_OK if okay, else a valid ACPI_STATUS code
+ * RETURN:      Status
  *
  * DESCRIPTION: Take the resource byte stream and fill out the appropriate
- *                  structure pointed to by the Output_buffer. Return the
- *                  number of bytes consumed from the byte stream.
+ *              structure pointed to by the Output_buffer. Return the
+ *              number of bytes consumed from the byte stream.
  *
  ******************************************************************************/
 
@@ -64,26 +61,22 @@
 	u32                     *structure_size)
 {
 	u8                      *buffer = byte_stream_buffer;
-	RESOURCE                *output_struct = (RESOURCE *) * output_buffer;
+	ACPI_RESOURCE           *output_struct = (ACPI_RESOURCE *) *output_buffer;
+	NATIVE_CHAR             *temp_ptr;
+	u32                     struct_size = SIZEOF_RESOURCE (ACPI_RESOURCE_ADDRESS16);
+	u32                     index;
 	u16                     temp16;
 	u8                      temp8;
-	u32                     index;
-	u32                     struct_size = sizeof(ADDRESS16_RESOURCE) +
-			  RESOURCE_LENGTH_NO_DATA;
 
 
 	/*
 	 * Point past the Descriptor to get the number of bytes consumed
 	 */
 	buffer += 1;
-
 	MOVE_UNALIGNED16_TO_16 (&temp16, buffer);
 
 	*bytes_consumed = temp16 + 3;
-
-	output_struct->id = address16;
-
-	output_struct->length = struct_size;
+	output_struct->id = ACPI_RSTYPE_ADDRESS16;
 
 	/*
 	 * Get the Resource Type (Byte3)
@@ -93,7 +86,7 @@
 
 	/* Values 0-2 are valid */
 	if (temp8 > 2) {
-		return (AE_AML_ERROR);
+		return (AE_AML_INVALID_RESOURCE_TYPE);
 	}
 
 	output_struct->data.address16.resource_type = temp8 & 0x03;
@@ -144,7 +137,7 @@
 		}
 
 		else {
-			/* BUS_NUMBER_RANGE == Address32_data->Resource_type */
+			/* BUS_NUMBER_RANGE == Address16.Data->Resource_type */
 			/* Nothing needs to be filled in */
 		}
 	}
@@ -167,25 +160,22 @@
 	 * Get Max_address_range (Bytes 10-11)
 	 */
 	buffer += 2;
-	MOVE_UNALIGNED16_TO_16
-		(&output_struct->data.address16.max_address_range,
-		 buffer);
+	MOVE_UNALIGNED16_TO_16 (&output_struct->data.address16.max_address_range,
+			 buffer);
 
 	/*
 	 * Get Address_translation_offset (Bytes 12-13)
 	 */
 	buffer += 2;
-	MOVE_UNALIGNED16_TO_16
-		(&output_struct->data.address16.address_translation_offset,
-		 buffer);
+	MOVE_UNALIGNED16_TO_16 (&output_struct->data.address16.address_translation_offset,
+			 buffer);
 
 	/*
 	 * Get Address_length (Bytes 14-15)
 	 */
 	buffer += 2;
-	MOVE_UNALIGNED16_TO_16
-		(&output_struct->data.address16.address_length,
-		 buffer);
+	MOVE_UNALIGNED16_TO_16 (&output_struct->data.address16.address_length,
+			 buffer);
 
 	/*
 	 * Resource Source Index (if present)
@@ -194,30 +184,36 @@
 
 	/*
 	 * This will leave us pointing to the Resource Source Index
-	 *  If it is present, then save it off and calculate the
-	 *  pointer to where the null terminated string goes:
-	 *  Each Interrupt takes 32-bits + the 5 bytes of the
-	 *  stream that are default.
+	 * If it is present, then save it off and calculate the
+	 * pointer to where the null terminated string goes:
+	 * Each Interrupt takes 32-bits + the 5 bytes of the
+	 * stream that are default.
 	 */
 	if (*bytes_consumed > 16) {
 		/* Dereference the Index */
 
 		temp8 = *buffer;
-		output_struct->data.address16.resource_source_index =
-				(u32) temp8;
+		output_struct->data.address16.resource_source.index = (u32) temp8;
 
 		/* Point to the String */
 
 		buffer += 1;
 
+		/* Point the String pointer to the end of this structure */
+
+		output_struct->data.address16.resource_source.string_ptr =
+				(NATIVE_CHAR *)((u8 * )output_struct + struct_size);
+
+		temp_ptr = output_struct->data.address16.resource_source.string_ptr;
+
 		/* Copy the string into the buffer */
 
 		index = 0;
 
 		while (0x00 != *buffer) {
-			output_struct->data.address16.resource_source[index] =
-				*buffer;
+			*temp_ptr = *buffer;
 
+			temp_ptr += 1;
 			buffer += 1;
 			index += 1;
 		}
@@ -225,31 +221,34 @@
 		/*
 		 * Add the terminating null
 		 */
-		output_struct->data.address16.resource_source[index] = 0x00;
+		*temp_ptr = 0x00;
 
-		output_struct->data.address16.resource_source_string_length =
-				index + 1;
+		output_struct->data.address16.resource_source.string_length = index + 1;
 
 		/*
-		 * In order for the Struct_size to fall on a 32-bit boundry,
-		 *  calculate the length of the string and expand the
-		 *  Struct_size to the next 32-bit boundry.
+		 * In order for the Struct_size to fall on a 32-bit boundary,
+		 * calculate the length of the string and expand the
+		 * Struct_size to the next 32-bit boundary.
 		 */
 		temp8 = (u8) (index + 1);
 		struct_size += ROUND_UP_TO_32_bITS (temp8);
-		output_struct->length = struct_size;
 	}
+
 	else {
-		output_struct->data.address16.resource_source_index = 0x00;
-		output_struct->data.address16.resource_source_string_length = 0;
-		output_struct->data.address16.resource_source[0] = 0x00;
+		output_struct->data.address16.resource_source.index = 0x00;
+		output_struct->data.address16.resource_source.string_length = 0;
+		output_struct->data.address16.resource_source.string_ptr = NULL;
 	}
 
 	/*
+	 * Set the Length parameter
+	 */
+	output_struct->length = struct_size;
+
+	/*
 	 * Return the final size of the structure
 	 */
 	*structure_size = struct_size;
-
 	return (AE_OK);
 }
 
@@ -261,19 +260,19 @@
  * PARAMETERS:  Linked_list             - Pointer to the resource linked list
  *              Output_buffer           - Pointer to the user's return buffer
  *              Bytes_consumed          - u32 pointer that is filled with
- *                                          the number of bytes of the
- *                                          Output_buffer used
+ *                                        the number of bytes of the
+ *                                        Output_buffer used
  *
- * RETURN:      Status  AE_OK if okay, else a valid ACPI_STATUS code
+ * RETURN:      Status
  *
  * DESCRIPTION: Take the linked list resource structure and fills in the
- *                  the appropriate bytes in a byte stream
+ *              the appropriate bytes in a byte stream
  *
  ******************************************************************************/
 
 ACPI_STATUS
 acpi_rs_address16_stream (
-	RESOURCE                *linked_list,
+	ACPI_RESOURCE           *linked_list,
 	u8                      **output_buffer,
 	u32                     *bytes_consumed)
 {
@@ -343,42 +342,42 @@
 	 * Set the address space granularity
 	 */
 	MOVE_UNALIGNED16_TO_16 (buffer,
-			 &linked_list->data.address16.granularity);
+			   &linked_list->data.address16.granularity);
 	buffer += 2;
 
 	/*
 	 * Set the address range minimum
 	 */
 	MOVE_UNALIGNED16_TO_16 (buffer,
-			 &linked_list->data.address16.min_address_range);
+			   &linked_list->data.address16.min_address_range);
 	buffer += 2;
 
 	/*
 	 * Set the address range maximum
 	 */
 	MOVE_UNALIGNED16_TO_16 (buffer,
-			 &linked_list->data.address16.max_address_range);
+			   &linked_list->data.address16.max_address_range);
 	buffer += 2;
 
 	/*
 	 * Set the address translation offset
 	 */
 	MOVE_UNALIGNED16_TO_16 (buffer,
-			  &linked_list->data.address16.address_translation_offset);
+			   &linked_list->data.address16.address_translation_offset);
 	buffer += 2;
 
 	/*
 	 * Set the address length
 	 */
 	MOVE_UNALIGNED16_TO_16 (buffer,
-			 &linked_list->data.address16.address_length);
+			   &linked_list->data.address16.address_length);
 	buffer += 2;
 
 	/*
 	 * Resource Source Index and Resource Source are optional
 	 */
-	if (0 != linked_list->data.address16.resource_source_string_length) {
-		temp8 = (u8) linked_list->data.address16.resource_source_index;
+	if (0 != linked_list->data.address16.resource_source.string_length) {
+		temp8 = (u8) linked_list->data.address16.resource_source.index;
 
 		*buffer = temp8;
 		buffer += 1;
@@ -388,21 +387,21 @@
 		/*
 		 * Copy the string
 		 */
-		STRCPY (temp_pointer, linked_list->data.address16.resource_source);
+		STRCPY (temp_pointer,
+				linked_list->data.address16.resource_source.string_ptr);
 
 		/*
 		 * Buffer needs to be set to the length of the sting + one for the
 		 *  terminating null
 		 */
-		buffer += (STRLEN (linked_list->data.address16.resource_source) + 1);
+		buffer += (STRLEN (linked_list->data.address16.resource_source.string_ptr)
+				 + 1);
 	}
 
 	/*
 	 * Return the number of bytes consumed in this operation
 	 */
-	actual_bytes = (u32) ((NATIVE_UINT) buffer -
-			   (NATIVE_UINT) *output_buffer);
-
+	actual_bytes = POINTER_DIFF (buffer, *output_buffer);
 	*bytes_consumed = actual_bytes;
 
 	/*
@@ -411,7 +410,6 @@
 	 */
 	actual_bytes -= 3;
 	MOVE_UNALIGNED16_TO_16 (length_field, &actual_bytes);
-
 	return (AE_OK);
 }
 
@@ -421,20 +419,20 @@
  * FUNCTION:    Acpi_rs_address32_resource
  *
  * PARAMETERS:  Byte_stream_buffer      - Pointer to the resource input byte
- *                                          stream
+ *                                        stream
  *              Bytes_consumed          - u32 pointer that is filled with
- *                                          the number of bytes consumed from
- *                                          the Byte_stream_buffer
+ *                                        the number of bytes consumed from
+ *                                        the Byte_stream_buffer
  *              Output_buffer           - Pointer to the user's return buffer
  *              Structure_size          - u32 pointer that is filled with
- *                                          the number of bytes in the filled
- *                                          in structure
+ *                                        the number of bytes in the filled
+ *                                        in structure
  *
- * RETURN:      Status  AE_OK if okay, else a valid ACPI_STATUS code
+ * RETURN:      Status
  *
  * DESCRIPTION: Take the resource byte stream and fill out the appropriate
- *                  structure pointed to by the Output_buffer. Return the
- *                  number of bytes consumed from the byte stream.
+ *              structure pointed to by the Output_buffer. Return the
+ *              number of bytes consumed from the byte stream.
  *
  ******************************************************************************/
 
@@ -446,19 +444,18 @@
 	u32                     *structure_size)
 {
 	u8                      *buffer;
-	RESOURCE                *output_struct;
+	ACPI_RESOURCE           *output_struct;
 	u16                     temp16;
 	u8                      temp8;
+	NATIVE_CHAR             *temp_ptr;
 	u32                     struct_size;
 	u32                     index;
 
 
 	buffer = byte_stream_buffer;
+	output_struct = (ACPI_RESOURCE *) *output_buffer;
 
-	output_struct = (RESOURCE *) *output_buffer;
-
-	struct_size = sizeof (ADDRESS32_RESOURCE) +
-			  RESOURCE_LENGTH_NO_DATA;
+	struct_size = SIZEOF_RESOURCE (ACPI_RESOURCE_ADDRESS32);
 
 	/*
 	 * Point past the Descriptor to get the number of bytes consumed
@@ -468,7 +465,7 @@
 
 	*bytes_consumed = temp16 + 3;
 
-	output_struct->id = address32;
+	output_struct->id = ACPI_RSTYPE_ADDRESS32;
 
 	/*
 	 * Get the Resource Type (Byte3)
@@ -478,7 +475,7 @@
 
 	/* Values 0-2 are valid */
 	if(temp8 > 2) {
-		return (AE_AML_ERROR);
+		return (AE_AML_INVALID_RESOURCE_TYPE);
 	}
 
 	output_struct->data.address32.resource_type = temp8 & 0x03;
@@ -560,9 +557,8 @@
 	 * Get Address_translation_offset (Bytes 18-21)
 	 */
 	buffer += 4;
-	MOVE_UNALIGNED32_TO_32
-			 (&output_struct->data.address32.address_translation_offset,
-				 buffer);
+	MOVE_UNALIGNED32_TO_32 (&output_struct->data.address32.address_translation_offset,
+			 buffer);
 
 	/*
 	 * Get Address_length (Bytes 22-25)
@@ -578,27 +574,35 @@
 
 	/*
 	 * This will leave us pointing to the Resource Source Index
-	 *  If it is present, then save it off and calculate the
-	 *  pointer to where the null terminated string goes:
-	 *  Each Interrupt takes 32-bits + the 5 bytes of the
-	 *  stream that are default.
+	 * If it is present, then save it off and calculate the
+	 * pointer to where the null terminated string goes:
 	 */
 	if (*bytes_consumed > 26) {
 		/* Dereference the Index */
 
 		temp8 = *buffer;
-		output_struct->data.address32.resource_source_index = (u32)temp8;
+		output_struct->data.address32.resource_source.index =
+				(u32) temp8;
 
 		/* Point to the String */
 
 		buffer += 1;
 
+		/* Point the String pointer to the end of this structure */
+
+		output_struct->data.address32.resource_source.string_ptr =
+				(NATIVE_CHAR *)((u8 *)output_struct + struct_size);
+
+		temp_ptr = output_struct->data.address32.resource_source.string_ptr;
+
 		/* Copy the string into the buffer */
 
 		index = 0;
 
 		while (0x00 != *buffer) {
-			output_struct->data.address32.resource_source[index] = *buffer;
+			*temp_ptr = *buffer;
+
+			temp_ptr += 1;
 			buffer += 1;
 			index += 1;
 		}
@@ -606,23 +610,22 @@
 		/*
 		 * Add the terminating null
 		 */
-		output_struct->data.address32.resource_source[index] = 0x00;
-
-		output_struct->data.address32.resource_source_string_length = index + 1;
+		*temp_ptr = 0x00;
+		output_struct->data.address32.resource_source.string_length = index + 1;
 
 		/*
-		 * In order for the Struct_size to fall on a 32-bit boundry,
+		 * In order for the Struct_size to fall on a 32-bit boundary,
 		 *  calculate the length of the string and expand the
-		 *  Struct_size to the next 32-bit boundry.
+		 *  Struct_size to the next 32-bit boundary.
 		 */
 		temp8 = (u8) (index + 1);
 		struct_size += ROUND_UP_TO_32_bITS (temp8);
 	}
 
 	else {
-		output_struct->data.address32.resource_source_index = 0x00;
-		output_struct->data.address32.resource_source_string_length = 0;
-		output_struct->data.address32.resource_source[0] = 0x00;
+		output_struct->data.address32.resource_source.index = 0x00;
+		output_struct->data.address32.resource_source.string_length = 0;
+		output_struct->data.address32.resource_source.string_ptr = NULL;
 	}
 
 	/*
@@ -634,7 +637,6 @@
 	 * Return the final size of the structure
 	 */
 	*structure_size = struct_size;
-
 	return (AE_OK);
 }
 
@@ -646,19 +648,19 @@
  * PARAMETERS:  Linked_list             - Pointer to the resource linked list
  *              Output_buffer           - Pointer to the user's return buffer
  *              Bytes_consumed          - u32 pointer that is filled with
- *                                          the number of bytes of the
- *                                          Output_buffer used
+ *                                        the number of bytes of the
+ *                                        Output_buffer used
  *
- * RETURN:      Status  AE_OK if okay, else a valid ACPI_STATUS code
+ * RETURN:      Status
  *
  * DESCRIPTION: Take the linked list resource structure and fills in the
- *                  the appropriate bytes in a byte stream
+ *              the appropriate bytes in a byte stream
  *
  ******************************************************************************/
 
 ACPI_STATUS
 acpi_rs_address32_stream (
-	RESOURCE                *linked_list,
+	ACPI_RESOURCE           *linked_list,
 	u8                      **output_buffer,
 	u32                     *bytes_consumed)
 {
@@ -680,7 +682,7 @@
 	 * Set a pointer to the Length field - to be filled in later
 	 */
 
-	length_field = (u16 *)buffer;
+	length_field = (u16 *) buffer;
 	buffer += 2;
 
 	/*
@@ -730,21 +732,21 @@
 	 * Set the address space granularity
 	 */
 	MOVE_UNALIGNED32_TO_32 (buffer,
-			 &linked_list->data.address32.granularity);
+			  &linked_list->data.address32.granularity);
 	buffer += 4;
 
 	/*
 	 * Set the address range minimum
 	 */
 	MOVE_UNALIGNED32_TO_32 (buffer,
-			 &linked_list->data.address32.min_address_range);
+			  &linked_list->data.address32.min_address_range);
 	buffer += 4;
 
 	/*
 	 * Set the address range maximum
 	 */
 	MOVE_UNALIGNED32_TO_32 (buffer,
-			 &linked_list->data.address32.max_address_range);
+			  &linked_list->data.address32.max_address_range);
 	buffer += 4;
 
 	/*
@@ -758,14 +760,14 @@
 	 * Set the address length
 	 */
 	MOVE_UNALIGNED32_TO_32 (buffer,
-			 &linked_list->data.address32.address_length);
+			  &linked_list->data.address32.address_length);
 	buffer += 4;
 
 	/*
 	 * Resource Source Index and Resource Source are optional
 	 */
-	if (0 != linked_list->data.address32.resource_source_string_length) {
-		temp8 = (u8) linked_list->data.address32.resource_source_index;
+	if (0 != linked_list->data.address32.resource_source.string_length) {
+		temp8 = (u8) linked_list->data.address32.resource_source.index;
 
 		*buffer = temp8;
 		buffer += 1;
@@ -775,27 +777,414 @@
 		/*
 		 * Copy the string
 		 */
-		STRCPY (temp_pointer, linked_list->data.address32.resource_source);
+		STRCPY (temp_pointer,
+			linked_list->data.address32.resource_source.string_ptr);
 
 		/*
 		 * Buffer needs to be set to the length of the sting + one for the
 		 *  terminating null
 		 */
-		buffer += (STRLEN (linked_list->data.address32.resource_source) + 1);
+		buffer += (STRLEN (linked_list->data.address32.resource_source.string_ptr) + 1);
 	}
 
 	/*
 	 * Return the number of bytes consumed in this operation
 	 */
-	*bytes_consumed = (u32) ((NATIVE_UINT) buffer -
-			   (NATIVE_UINT) *output_buffer);
+	*bytes_consumed = POINTER_DIFF (buffer, *output_buffer);
 
 	/*
 	 * Set the length field to the number of bytes consumed
 	 *  minus the header size (3 bytes)
 	 */
 	*length_field = (u16) (*bytes_consumed - 3);
+	return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_rs_address64_resource
+ *
+ * PARAMETERS:  Byte_stream_buffer      - Pointer to the resource input byte
+ *                                        stream
+ *              Bytes_consumed          - u32 pointer that is filled with
+ *                                        the number of bytes consumed from
+ *                                        the Byte_stream_buffer
+ *              Output_buffer           - Pointer to the user's return buffer
+ *              Structure_size          - u32 pointer that is filled with
+ *                                        the number of bytes in the filled
+ *                                        in structure
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Take the resource byte stream and fill out the appropriate
+ *              structure pointed to by the Output_buffer. Return the
+ *              number of bytes consumed from the byte stream.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_rs_address64_resource (
+	u8                      *byte_stream_buffer,
+	u32                     *bytes_consumed,
+	u8                      **output_buffer,
+	u32                     *structure_size)
+{
+	u8                      *buffer;
+	ACPI_RESOURCE           *output_struct;
+	u16                     temp16;
+	u8                      temp8;
+	NATIVE_CHAR             *temp_ptr;
+	u32                     struct_size;
+	u32                     index;
+
+
+	buffer = byte_stream_buffer;
+	output_struct = (ACPI_RESOURCE *) *output_buffer;
+
+	struct_size = SIZEOF_RESOURCE (ACPI_RESOURCE_ADDRESS64);
+
+	/*
+	 * Point past the Descriptor to get the number of bytes consumed
+	 */
+	buffer += 1;
+	MOVE_UNALIGNED16_TO_16 (&temp16, buffer);
+
+	*bytes_consumed = temp16 + 3;
+	output_struct->id = ACPI_RSTYPE_ADDRESS64;
+
+	/*
+	 * Get the Resource Type (Byte3)
+	 */
+	buffer += 2;
+	temp8 = *buffer;
+
+	/* Values 0-2 are valid */
+	if(temp8 > 2) {
+		return (AE_AML_INVALID_RESOURCE_TYPE);
+	}
+
+	output_struct->data.address64.resource_type = temp8 & 0x03;
+
+	/*
+	 * Get the General Flags (Byte4)
+	 */
+	buffer += 1;
+	temp8 = *buffer;
+
+	/*
+	 * Producer / Consumer
+	 */
+	output_struct->data.address64.producer_consumer = temp8 & 0x01;
+
+	/*
+	 * Decode
+	 */
+	output_struct->data.address64.decode = (temp8 >> 1) & 0x01;
+
+	/*
+	 * Min Address Fixed
+	 */
+	output_struct->data.address64.min_address_fixed = (temp8 >> 2) & 0x01;
+
+	/*
+	 * Max Address Fixed
+	 */
+	output_struct->data.address64.max_address_fixed = (temp8 >> 3) & 0x01;
+
+	/*
+	 * Get the Type Specific Flags (Byte5)
+	 */
+	buffer += 1;
+	temp8 = *buffer;
+
+	if (MEMORY_RANGE == output_struct->data.address64.resource_type) {
+		output_struct->data.address64.attribute.memory.read_write_attribute =
+				(u16) (temp8 & 0x01);
+
+		output_struct->data.address64.attribute.memory.cache_attribute =
+				(u16) ((temp8 >> 1) & 0x0F);
+	}
+
+	else {
+		if (IO_RANGE == output_struct->data.address64.resource_type) {
+			output_struct->data.address64.attribute.io.range_attribute =
+				(u16) (temp8 & 0x03);
+		}
+
+		else {
+			/* BUS_NUMBER_RANGE == Output_struct->Data.Address64.Resource_type */
+			/* Nothing needs to be filled in */
+		}
+	}
+
+	/*
+	 * Get Granularity (Bytes 6-13)
+	 */
+	buffer += 1;
+	MOVE_UNALIGNED64_TO_64 (&output_struct->data.address64.granularity,
+			 buffer);
+
+	/*
+	 * Get Min_address_range (Bytes 14-21)
+	 */
+	buffer += 8;
+	MOVE_UNALIGNED64_TO_64 (&output_struct->data.address64.min_address_range,
+			 buffer);
+
+	/*
+	 * Get Max_address_range (Bytes 22-29)
+	 */
+	buffer += 8;
+	MOVE_UNALIGNED64_TO_64 (&output_struct->data.address64.max_address_range,
+			 buffer);
+
+	/*
+	 * Get Address_translation_offset (Bytes 30-37)
+	 */
+	buffer += 8;
+	MOVE_UNALIGNED64_TO_64 (&output_struct->data.address64.address_translation_offset,
+			 buffer);
+
+	/*
+	 * Get Address_length (Bytes 38-45)
+	 */
+	buffer += 8;
+	MOVE_UNALIGNED64_TO_64 (&output_struct->data.address64.address_length,
+			 buffer);
+
+	/*
+	 * Resource Source Index (if present)
+	 */
+	buffer += 8;
+
+	/*
+	 * This will leave us pointing to the Resource Source Index
+	 * If it is present, then save it off and calculate the
+	 * pointer to where the null terminated string goes:
+	 * Each Interrupt takes 32-bits + the 5 bytes of the
+	 * stream that are default.
+	 */
+	if (*bytes_consumed > 46) {
+		/* Dereference the Index */
+
+		temp8 = *buffer;
+		output_struct->data.address64.resource_source.index =
+				(u32) temp8;
+
+		/* Point to the String */
+
+		buffer += 1;
+
+		/* Point the String pointer to the end of this structure */
+
+		output_struct->data.address64.resource_source.string_ptr =
+				(NATIVE_CHAR *)((u8 *)output_struct + struct_size);
+
+		temp_ptr = output_struct->data.address64.resource_source.string_ptr;
+
+		/* Copy the string into the buffer */
+
+		index = 0;
+
+		while (0x00 != *buffer) {
+			*temp_ptr = *buffer;
+
+			temp_ptr += 1;
+			buffer += 1;
+			index += 1;
+		}
+
+		/*
+		 * Add the terminating null
+		 */
+		*temp_ptr = 0x00;
+
+		output_struct->data.address64.resource_source.string_length = index + 1;
+
+		/*
+		 * In order for the Struct_size to fall on a 32-bit boundary,
+		 * calculate the length of the string and expand the
+		 * Struct_size to the next 32-bit boundary.
+		 */
+		temp8 = (u8) (index + 1);
+		struct_size += ROUND_UP_TO_32_bITS (temp8);
+	}
+
+	else {
+		output_struct->data.address64.resource_source.index = 0x00;
+		output_struct->data.address64.resource_source.string_length = 0;
+		output_struct->data.address64.resource_source.string_ptr = NULL;
+	}
+
+	/*
+	 * Set the Length parameter
+	 */
+	output_struct->length = struct_size;
+
+	/*
+	 * Return the final size of the structure
+	 */
+	*structure_size = struct_size;
+	return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_rs_address64_stream
+ *
+ * PARAMETERS:  Linked_list             - Pointer to the resource linked list
+ *              Output_buffer           - Pointer to the user's return buffer
+ *              Bytes_consumed          - u32 pointer that is filled with
+ *                                        the number of bytes of the
+ *                                        Output_buffer used
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Take the linked list resource structure and fills in the
+ *              the appropriate bytes in a byte stream
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_rs_address64_stream (
+	ACPI_RESOURCE           *linked_list,
+	u8                      **output_buffer,
+	u32                     *bytes_consumed)
+{
+	u8                      *buffer;
+	u16                     *length_field;
+	u8                      temp8;
+	NATIVE_CHAR             *temp_pointer;
+
+
+	buffer = *output_buffer;
+
+	/*
+	 * The descriptor field is static
+	 */
+	*buffer = 0x8A;
+	buffer += 1;
+
+	/*
+	 * Set a pointer to the Length field - to be filled in later
+	 */
+
+	length_field = (u16 *)buffer;
+	buffer += 2;
+
+	/*
+	 * Set the Resource Type (Memory, Io, Bus_number)
+	 */
+	temp8 = (u8) (linked_list->data.address64.resource_type & 0x03);
+
+	*buffer = temp8;
+	buffer += 1;
+
+	/*
+	 * Set the general flags
+	 */
+	temp8 = (u8) (linked_list->data.address64.producer_consumer & 0x01);
+	temp8 |= (linked_list->data.address64.decode & 0x01) << 1;
+	temp8 |= (linked_list->data.address64.min_address_fixed & 0x01) << 2;
+	temp8 |= (linked_list->data.address64.max_address_fixed & 0x01) << 3;
+
+	*buffer = temp8;
+	buffer += 1;
+
+	/*
+	 * Set the type specific flags
+	 */
+	temp8 = 0;
+
+	if(MEMORY_RANGE == linked_list->data.address64.resource_type) {
+		temp8 = (u8)
+			(linked_list->data.address64.attribute.memory.read_write_attribute &
+			0x01);
+
+		temp8 |=
+			(linked_list->data.address64.attribute.memory.cache_attribute &
+			 0x0F) << 1;
+	}
+
+	else if (IO_RANGE == linked_list->data.address64.resource_type) {
+		temp8 = (u8)
+			(linked_list->data.address64.attribute.io.range_attribute &
+			 0x03);
+	}
+
+	*buffer = temp8;
+	buffer += 1;
+
+	/*
+	 * Set the address space granularity
+	 */
+	MOVE_UNALIGNED64_TO_64 (buffer,
+			   &linked_list->data.address64.granularity);
+	buffer += 8;
+
+	/*
+	 * Set the address range minimum
+	 */
+	MOVE_UNALIGNED64_TO_64 (buffer,
+			   &linked_list->data.address64.min_address_range);
+	buffer += 8;
 
+	/*
+	 * Set the address range maximum
+	 */
+	MOVE_UNALIGNED64_TO_64 (buffer,
+			   &linked_list->data.address64.max_address_range);
+	buffer += 8;
+
+	/*
+	 * Set the address translation offset
+	 */
+	MOVE_UNALIGNED64_TO_64 (buffer,
+			   &linked_list->data.address64.address_translation_offset);
+	buffer += 8;
+
+	/*
+	 * Set the address length
+	 */
+	MOVE_UNALIGNED64_TO_64 (buffer,
+			   &linked_list->data.address64.address_length);
+	buffer += 8;
+
+	/*
+	 * Resource Source Index and Resource Source are optional
+	 */
+	if (0 != linked_list->data.address64.resource_source.string_length) {
+		temp8 = (u8) linked_list->data.address64.resource_source.index;
+
+		*buffer = temp8;
+		buffer += 1;
+
+		temp_pointer = (NATIVE_CHAR *) buffer;
+
+		/*
+		 * Copy the string
+		 */
+		STRCPY (temp_pointer, linked_list->data.address64.resource_source.string_ptr);
+
+		/*
+		 * Buffer needs to be set to the length of the sting + one for the
+		 *  terminating null
+		 */
+		buffer += (STRLEN (linked_list->data.address64.resource_source.string_ptr) + 1);
+	}
+
+	/*
+	 * Return the number of bytes consumed in this operation
+	 */
+	*bytes_consumed = POINTER_DIFF (buffer, *output_buffer);
+
+	/*
+	 * Set the length field to the number of bytes consumed
+	 * minus the header size (3 bytes)
+	 */
+	*length_field = (u16) (*bytes_consumed - 3);
 	return (AE_OK);
 }
 
diff -urN linux-2.4.6-pre4/drivers/acpi/resources/rscalc.c linux/drivers/acpi/resources/rscalc.c
--- linux-2.4.6-pre4/drivers/acpi/resources/rscalc.c	Fri Feb  9 11:45:58 2001
+++ linux/drivers/acpi/resources/rscalc.c	Mon Dec  3 22:48:42 2001
@@ -1,8 +1,7 @@
 /*******************************************************************************
  *
- * Module Name: rscalc - Acpi_rs_calculate_byte_stream_length
- *                       Acpi_rs_calculate_list_length
- *              $Revision: 21 $
+ * Module Name: rscalc - Calculate stream and list lengths
+ *              $Revision: 30 $
  *
  ******************************************************************************/
 
@@ -30,7 +29,7 @@
 #include "amlcode.h"
 #include "acnamesp.h"
 
-#define _COMPONENT          RESOURCE_MANAGER
+#define _COMPONENT          ACPI_RESOURCES
 	 MODULE_NAME         ("rscalc")
 
 
@@ -40,9 +39,9 @@
  *
  * PARAMETERS:  Linked_list         - Pointer to the resource linked list
  *              Size_needed         - u32 pointer of the size buffer needed
- *                                      to properly return the parsed data
+ *                                    to properly return the parsed data
  *
- * RETURN:      Status  AE_OK if okay, else a valid ACPI_STATUS code
+ * RETURN:      Status
  *
  * DESCRIPTION: Takes the resource byte stream and parses it once, calculating
  *              the size buffer needed to hold the linked list that conveys
@@ -52,214 +51,195 @@
 
 ACPI_STATUS
 acpi_rs_calculate_byte_stream_length (
-	RESOURCE                *linked_list,
+	ACPI_RESOURCE           *linked_list,
 	u32                     *size_needed)
 {
 	u32                     byte_stream_size_needed = 0;
 	u32                     segment_size;
-	EXTENDED_IRQ_RESOURCE   *ex_irq = NULL;
+	ACPI_RESOURCE_EXT_IRQ   *ex_irq = NULL;
 	u8                      done = FALSE;
 
 
 	while (!done) {
-
 		/*
-		 * Init the variable that will hold the size to add to the
-		 *  total.
+		 * Init the variable that will hold the size to add to the total.
 		 */
 		segment_size = 0;
 
-		switch (linked_list->id)
-		{
-		case irq:
+		switch (linked_list->id) {
+		case ACPI_RSTYPE_IRQ:
 			/*
 			 * IRQ Resource
-			 */
-			/*
 			 * For an IRQ Resource, Byte 3, although optional, will
-			 *  always be created - it holds IRQ information.
+			 * always be created - it holds IRQ information.
 			 */
 			segment_size = 4;
 			break;
 
-		case dma:
+		case ACPI_RSTYPE_DMA:
 			/*
 			 * DMA Resource
-			 */
-			/*
 			 * For this resource the size is static
 			 */
 			segment_size = 3;
 			break;
 
-		case start_dependent_functions:
+		case ACPI_RSTYPE_START_DPF:
 			/*
 			 * Start Dependent Functions Resource
-			 */
-			/*
 			 * For a Start_dependent_functions Resource, Byte 1,
 			 * although optional, will always be created.
 			 */
 			segment_size = 2;
 			break;
 
-		case end_dependent_functions:
+		case ACPI_RSTYPE_END_DPF:
 			/*
 			 * End Dependent Functions Resource
-			 */
-			/*
 			 * For this resource the size is static
 			 */
 			segment_size = 1;
 			break;
 
-		case io:
+		case ACPI_RSTYPE_IO:
 			/*
 			 * IO Port Resource
-			 */
-			/*
 			 * For this resource the size is static
 			 */
 			segment_size = 8;
 			break;
 
-		case fixed_io:
+		case ACPI_RSTYPE_FIXED_IO:
 			/*
 			 * Fixed IO Port Resource
-			 */
-			/*
 			 * For this resource the size is static
 			 */
 			segment_size = 4;
 			break;
 
-		case vendor_specific:
+		case ACPI_RSTYPE_VENDOR:
 			/*
 			 * Vendor Defined Resource
-			 */
-			/*
 			 * For a Vendor Specific resource, if the Length is
-			 *  between 1 and 7 it will be created as a Small
-			 *  Resource data type, otherwise it is a Large
-			 *  Resource data type.
+			 * between 1 and 7 it will be created as a Small
+			 * Resource data type, otherwise it is a Large
+			 * Resource data type.
 			 */
-			if(linked_list->data.vendor_specific.length > 7) {
+			if (linked_list->data.vendor_specific.length > 7) {
 				segment_size = 3;
 			}
 			else {
 				segment_size = 1;
 			}
-			segment_size +=
-				linked_list->data.vendor_specific.length;
+			segment_size += linked_list->data.vendor_specific.length;
 			break;
 
-		case end_tag:
+		case ACPI_RSTYPE_END_TAG:
 			/*
 			 * End Tag
-			 */
-			/*
 			 * For this resource the size is static
 			 */
 			segment_size = 2;
 			done = TRUE;
 			break;
 
-		case memory24:
+		case ACPI_RSTYPE_MEM24:
 			/*
 			 * 24-Bit Memory Resource
-			 */
-			/*
 			 * For this resource the size is static
 			 */
 			segment_size = 12;
 			break;
 
-		case memory32:
+		case ACPI_RSTYPE_MEM32:
 			/*
 			 * 32-Bit Memory Range Resource
-			 */
-			/*
 			 * For this resource the size is static
 			 */
 			segment_size = 20;
 			break;
 
-		case fixed_memory32:
+		case ACPI_RSTYPE_FIXED_MEM32:
 			/*
 			 * 32-Bit Fixed Memory Resource
-			 */
-			/*
 			 * For this resource the size is static
 			 */
 			segment_size = 12;
 			break;
 
-		case address16:
+		case ACPI_RSTYPE_ADDRESS16:
 			/*
 			 * 16-Bit Address Resource
-			 */
-			/*
 			 * The base size of this byte stream is 16. If a
-			 *  Resource Source string is not NULL, add 1 for
-			 *  the Index + the length of the null terminated
-			 *  string Resource Source + 1 for the null.
+			 * Resource Source string is not NULL, add 1 for
+			 * the Index + the length of the null terminated
+			 * string Resource Source + 1 for the null.
 			 */
 			segment_size = 16;
 
-			if(NULL != linked_list->data.address16.resource_source) {
+			if (NULL != linked_list->data.address16.resource_source.string_ptr) {
 				segment_size += (1 +
-					linked_list->data.address16.resource_source_string_length);
+					linked_list->data.address16.resource_source.string_length);
 			}
 			break;
 
-		case address32:
+		case ACPI_RSTYPE_ADDRESS32:
 			/*
 			 * 32-Bit Address Resource
-			 */
-			/*
 			 * The base size of this byte stream is 26. If a Resource
-			 *  Source string is not NULL, add 1 for the Index + the
-			 *  length of the null terminated string Resource Source +
-			 *  1 for the null.
+			 * Source string is not NULL, add 1 for the Index + the
+			 * length of the null terminated string Resource Source +
+			 * 1 for the null.
 			 */
 			segment_size = 26;
 
-			if(NULL != linked_list->data.address16.resource_source) {
+			if (NULL != linked_list->data.address32.resource_source.string_ptr) {
 				segment_size += (1 +
-					linked_list->data.address16.resource_source_string_length);
+					linked_list->data.address32.resource_source.string_length);
 			}
 			break;
 
-		case extended_irq:
+		case ACPI_RSTYPE_ADDRESS64:
 			/*
-			 * Extended IRQ Resource
+			 * 64-Bit Address Resource
+			 * The base size of this byte stream is 46. If a Resource
+			 * Source string is not NULL, add 1 for the Index + the
+			 * length of the null terminated string Resource Source +
+			 * 1 for the null.
 			 */
+			segment_size = 46;
+
+			if (NULL != linked_list->data.address64.resource_source.string_ptr) {
+				segment_size += (1 +
+					linked_list->data.address64.resource_source.string_length);
+			}
+			break;
+
+		case ACPI_RSTYPE_EXT_IRQ:
 			/*
+			 * Extended IRQ Resource
 			 * The base size of this byte stream is 9. This is for an
-			 *  Interrupt table length of 1.  For each additional
-			 *  interrupt, add 4.
+			 * Interrupt table length of 1.  For each additional
+			 * interrupt, add 4.
 			 * If a Resource Source string is not NULL, add 1 for the
-			 *  Index + the length of the null terminated string
-			 *  Resource Source + 1 for the null.
+			 * Index + the length of the null terminated string
+			 * Resource Source + 1 for the null.
 			 */
-			segment_size = 9;
+			segment_size = 9 +
+				((linked_list->data.extended_irq.number_of_interrupts - 1) * 4);
 
-			segment_size +=
-				(linked_list->data.extended_irq.number_of_interrupts -
-				 1) * 4;
-
-			if(NULL != ex_irq->resource_source) {
+			if (NULL != ex_irq->resource_source.string_ptr) {
 				segment_size += (1 +
-					linked_list->data.extended_irq.resource_source_string_length);
+					linked_list->data.extended_irq.resource_source.string_length);
 			}
 			break;
 
 		default:
 			/*
 			 * If we get here, everything is out of sync,
-			 *  so exit with an error
+			 * so exit with an error
 			 */
-			return (AE_AML_ERROR);
+			return (AE_AML_INVALID_RESOURCE_TYPE);
 			break;
 
 		} /* switch (Linked_list->Id) */
@@ -272,15 +252,14 @@
 		/*
 		 * Point to the next object
 		 */
-		linked_list = (RESOURCE *) ((NATIVE_UINT) linked_list +
-				  (NATIVE_UINT) linked_list->length);
+		linked_list = POINTER_ADD (ACPI_RESOURCE,
+				  linked_list, linked_list->length);
 	}
 
 	/*
 	 * This is the data the caller needs
 	 */
 	*size_needed = byte_stream_size_needed;
-
 	return (AE_OK);
 }
 
@@ -292,10 +271,10 @@
  * PARAMETERS:  Byte_stream_buffer      - Pointer to the resource byte stream
  *              Byte_stream_buffer_length - Size of Byte_stream_buffer
  *              Size_needed             - u32 pointer of the size buffer
- *                                          needed to properly return the
- *                                          parsed data
+ *                                        needed to properly return the
+ *                                        parsed data
  *
- * RETURN:      Status  AE_OK if okay, else a valid ACPI_STATUS code
+ * RETURN:      Status
  *
  * DESCRIPTION: Takes the resource byte stream and parses it once, calculating
  *              the size buffer needed to hold the linked list that conveys
@@ -325,402 +304,383 @@
 
 	while (bytes_parsed < byte_stream_buffer_length) {
 		/*
-		 * Look at the next byte in the stream
+		 * The next byte in the stream is the resource type
 		 */
-		resource_type = *byte_stream_buffer;
+		resource_type = acpi_rs_get_resource_type (*byte_stream_buffer);
 
-		/*
-		 * See if this is a small or large resource
-		 */
-		if(resource_type & 0x80) {
+		switch (resource_type) {
+		case RESOURCE_DESC_MEMORY_24:
 			/*
-			 * Large Resource Type
+			 * 24-Bit Memory Resource
 			 */
-			switch (resource_type)
-			{
-			case MEMORY_RANGE_24:
-				/*
-				 * 24-Bit Memory Resource
-				 */
-				bytes_consumed = 12;
+			bytes_consumed = 12;
 
-				structure_size = sizeof (MEMORY24_RESOURCE) +
-						  RESOURCE_LENGTH_NO_DATA;
-				break;
+			structure_size = SIZEOF_RESOURCE (ACPI_RESOURCE_MEM24);
+			break;
 
-			case LARGE_VENDOR_DEFINED:
-				/*
-				 * Vendor Defined Resource
-				 */
-				buffer = byte_stream_buffer;
-				++buffer;
 
-				MOVE_UNALIGNED16_TO_16 (&temp16, buffer);
-				bytes_consumed = temp16 + 3;
+		case RESOURCE_DESC_LARGE_VENDOR:
+			/*
+			 * Vendor Defined Resource
+			 */
+			buffer = byte_stream_buffer;
+			++buffer;
 
-				/*
-				 * Ensure a 32-bit boundary for the structure
-				 */
-				temp16 = (u16) ROUND_UP_TO_32_bITS (temp16);
+			MOVE_UNALIGNED16_TO_16 (&temp16, buffer);
+			bytes_consumed = temp16 + 3;
 
-				structure_size = sizeof (VENDOR_RESOURCE) +
-						  RESOURCE_LENGTH_NO_DATA +
-						  (temp16 * sizeof (u8));
-				break;
+			/*
+			 * Ensure a 32-bit boundary for the structure
+			 */
+			temp16 = (u16) ROUND_UP_TO_32_bITS (temp16);
 
-			case MEMORY_RANGE_32:
-				/*
-				 * 32-Bit Memory Range Resource
-				 */
+			structure_size = SIZEOF_RESOURCE (ACPI_RESOURCE_VENDOR) +
+					   (temp16 * sizeof (u8));
+			break;
 
-				bytes_consumed = 20;
 
-				structure_size = sizeof (MEMORY32_RESOURCE) +
-						  RESOURCE_LENGTH_NO_DATA;
-				break;
+		case RESOURCE_DESC_MEMORY_32:
+			/*
+			 * 32-Bit Memory Range Resource
+			 */
 
-			case FIXED_MEMORY_RANGE_32:
-				/*
-				 * 32-Bit Fixed Memory Resource
-				 */
-				bytes_consumed = 12;
+			bytes_consumed = 20;
 
-				structure_size = sizeof(FIXED_MEMORY32_RESOURCE) +
-						  RESOURCE_LENGTH_NO_DATA;
-				break;
+			structure_size = SIZEOF_RESOURCE (ACPI_RESOURCE_MEM32);
+			break;
 
-			case DWORD_ADDRESS_SPACE:
-				/*
-				 * 32-Bit Address Resource
-				 */
-				buffer = byte_stream_buffer;
 
-				++buffer;
-				MOVE_UNALIGNED16_TO_16 (&temp16, buffer);
+		case RESOURCE_DESC_FIXED_MEMORY_32:
+			/*
+			 * 32-Bit Fixed Memory Resource
+			 */
+			bytes_consumed = 12;
 
-				bytes_consumed = temp16 + 3;
+			structure_size = SIZEOF_RESOURCE (ACPI_RESOURCE_FIXED_MEM32);
+			break;
 
-				/*
-				 * Resource Source Index and Resource Source are
-				 *  optional elements.  Check the length of the
-				 *  Bytestream.  If it is greater than 23, that
-				 *  means that an Index exists and is followed by
-				 *  a null termininated string.  Therefore, set
-				 *  the temp variable to the length minus the minimum
-				 *  byte stream length plus the byte for the Index to
-				 *  determine the size of the NULL terminiated string.
-				 */
-				if (23 < temp16) {
-					temp8 = (u8) (temp16 - 24);
-				}
-				else {
-					temp8 = 0;
-				}
 
-				/*
-				 * Ensure a 32-bit boundary for the structure
-				 */
-				temp8 = (u8) ROUND_UP_TO_32_bITS (temp8);
+		case RESOURCE_DESC_QWORD_ADDRESS_SPACE:
+			/*
+			 * 64-Bit Address Resource
+			 */
+			buffer = byte_stream_buffer;
 
-				structure_size = sizeof (ADDRESS32_RESOURCE) +
-						  RESOURCE_LENGTH_NO_DATA +
-						  (temp8 * sizeof (u8));
-				break;
+			++buffer;
+			MOVE_UNALIGNED16_TO_16 (&temp16, buffer);
 
-			case WORD_ADDRESS_SPACE:
-				/*
-				 * 16-Bit Address Resource
-				 */
-				buffer = byte_stream_buffer;
+			bytes_consumed = temp16 + 3;
 
-				++buffer;
-				MOVE_UNALIGNED16_TO_16 (&temp16, buffer);
+			/*
+			 * Resource Source Index and Resource Source are
+			 * optional elements.  Check the length of the
+			 * Bytestream.  If it is greater than 43, that
+			 * means that an Index exists and is followed by
+			 * a null termininated string.  Therefore, set
+			 * the temp variable to the length minus the minimum
+			 * byte stream length plus the byte for the Index to
+			 * determine the size of the NULL terminiated string.
+			 */
+			if (43 < temp16) {
+				temp8 = (u8) (temp16 - 44);
+			}
+			else {
+				temp8 = 0;
+			}
 
-				bytes_consumed = temp16 + 3;
+			/*
+			 * Ensure a 64-bit boundary for the structure
+			 */
+			temp8 = (u8) ROUND_UP_TO_64_bITS (temp8);
 
-				/*
-				 * Resource Source Index and Resource Source are
-				 *  optional elements.  Check the length of the
-				 *  Bytestream.  If it is greater than 13, that
-				 *  means that an Index exists and is followed by
-				 *  a null termininated string.  Therefore, set
-				 *  the temp variable to the length minus the minimum
-				 *  byte stream length plus the byte for the Index to
-				 *  determine the size of the NULL terminiated string.
-				 */
-				if (13 < temp16) {
-					temp8 = (u8) (temp16 - 14);
-				}
-				else {
-					temp8 = 0;
-				}
+			structure_size = SIZEOF_RESOURCE (ACPI_RESOURCE_ADDRESS64) +
+					   (temp8 * sizeof (u8));
+			break;
 
-				/*
-				 * Ensure a 32-bit boundry for the structure
-				 */
-				temp8 = (u8) ROUND_UP_TO_32_bITS (temp8);
 
-				structure_size = sizeof (ADDRESS16_RESOURCE) +
-						  RESOURCE_LENGTH_NO_DATA +
-						  (temp8 * sizeof (u8));
-				break;
+		case RESOURCE_DESC_DWORD_ADDRESS_SPACE:
+			/*
+			 * 32-Bit Address Resource
+			 */
+			buffer = byte_stream_buffer;
 
-			case EXTENDED_IRQ:
-				/*
-				 * Extended IRQ
-				 */
-				buffer = byte_stream_buffer;
+			++buffer;
+			MOVE_UNALIGNED16_TO_16 (&temp16, buffer);
 
-				++buffer;
-				MOVE_UNALIGNED16_TO_16 (&temp16, buffer);
+			bytes_consumed = temp16 + 3;
 
-				bytes_consumed = temp16 + 3;
+			/*
+			 * Resource Source Index and Resource Source are
+			 * optional elements.  Check the length of the
+			 * Bytestream.  If it is greater than 23, that
+			 * means that an Index exists and is followed by
+			 * a null termininated string.  Therefore, set
+			 * the temp variable to the length minus the minimum
+			 * byte stream length plus the byte for the Index to
+			 * determine the size of the NULL terminiated string.
+			 */
+			if (23 < temp16) {
+				temp8 = (u8) (temp16 - 24);
+			}
+			else {
+				temp8 = 0;
+			}
 
-				/*
-				 * Point past the length field and the
-				 *  Interrupt vector flags to save off the
-				 *  Interrupt table length to the Temp8 variable.
-				 */
-				buffer += 3;
-				temp8 = *buffer;
+			/*
+			 * Ensure a 32-bit boundary for the structure
+			 */
+			temp8 = (u8) ROUND_UP_TO_32_bITS (temp8);
 
-				/*
-				 * To compensate for multiple interrupt numbers,
-				 *  Add 4 bytes for each additional interrupts
-				 *  greater than 1
-				 */
-				additional_bytes = (u8) ((temp8 - 1) * 4);
+			structure_size = SIZEOF_RESOURCE (ACPI_RESOURCE_ADDRESS32) +
+					   (temp8 * sizeof (u8));
+			break;
 
-				/*
-				 * Resource Source Index and Resource Source are
-				 *  optional elements.  Check the length of the
-				 *  Bytestream.  If it is greater than 9, that
-				 *  means that an Index exists and is followed by
-				 *  a null termininated string.  Therefore, set
-				 *  the temp variable to the length minus the minimum
-				 *  byte stream length plus the byte for the Index to
-				 *  determine the size of the NULL terminiated string.
-				 */
-				if (9 + additional_bytes < temp16) {
-					temp8 = (u8) (temp16 - (9 + additional_bytes));
-				}
 
-				else {
-					temp8 = 0;
-				}
+		case RESOURCE_DESC_WORD_ADDRESS_SPACE:
+			/*
+			 * 16-Bit Address Resource
+			 */
+			buffer = byte_stream_buffer;
 
-				/*
-				 * Ensure a 32-bit boundry for the structure
-				 */
-				temp8 = (u8) ROUND_UP_TO_32_bITS (temp8);
+			++buffer;
+			MOVE_UNALIGNED16_TO_16 (&temp16, buffer);
 
-				structure_size = sizeof (EXTENDED_IRQ_RESOURCE) +
-						  RESOURCE_LENGTH_NO_DATA +
-						  (additional_bytes * sizeof (u8)) +
-						  (temp8 * sizeof (u8));
+			bytes_consumed = temp16 + 3;
 
-				break;
+			/*
+			 * Resource Source Index and Resource Source are
+			 * optional elements.  Check the length of the
+			 * Bytestream.  If it is greater than 13, that
+			 * means that an Index exists and is followed by
+			 * a null termininated string.  Therefore, set
+			 * the temp variable to the length minus the minimum
+			 * byte stream length plus the byte for the Index to
+			 * determine the size of the NULL terminiated string.
+			 */
+			if (13 < temp16) {
+				temp8 = (u8) (temp16 - 14);
+			}
+			else {
+				temp8 = 0;
+			}
 
-/* TBD: [Future] 64-bit not currently supported */
-/*
-			case 0x8A:
-				break;
-*/
+			/*
+			 * Ensure a 32-bit boundary for the structure
+			 */
+			temp8 = (u8) ROUND_UP_TO_32_bITS (temp8);
 
-			default:
-				/*
-				 * If we get here, everything is out of sync,
-				 *  so exit with an error
-				 */
-				return (AE_AML_ERROR);
-				break;
-			}
-		}
+			structure_size = SIZEOF_RESOURCE (ACPI_RESOURCE_ADDRESS16) +
+					   (temp8 * sizeof (u8));
+			break;
 
-		else {
+
+		case RESOURCE_DESC_EXTENDED_XRUPT:
 			/*
-			 * Small Resource Type
-			 *  Only bits 7:3 are valid
+			 * Extended IRQ
 			 */
-			resource_type >>= 3;
+			buffer = byte_stream_buffer;
 
-			switch (resource_type)
-			{
-			case IRQ_FORMAT:
-				/*
-				 * IRQ Resource
-				 */
-				/*
-				 * Determine if it there are two or three
-				 *  trailing bytes
-				 */
-				buffer = byte_stream_buffer;
-				temp8 = *buffer;
+			++buffer;
+			MOVE_UNALIGNED16_TO_16 (&temp16, buffer);
 
-				if(temp8 & 0x01) {
-					bytes_consumed = 4;
-				}
+			bytes_consumed = temp16 + 3;
 
-				else {
-					bytes_consumed = 3;
-				}
+			/*
+			 * Point past the length field and the
+			 * Interrupt vector flags to save off the
+			 * Interrupt table length to the Temp8 variable.
+			 */
+			buffer += 3;
+			temp8 = *buffer;
 
-				/*
-				 * Point past the descriptor
-				 */
-				++buffer;
+			/*
+			 * To compensate for multiple interrupt numbers, add 4 bytes for
+			 * each additional interrupts greater than 1
+			 */
+			additional_bytes = (u8) ((temp8 - 1) * 4);
 
-				/*
-				 * Look at the number of bits set
-				 */
-				MOVE_UNALIGNED16_TO_16 (&temp16, buffer);
+			/*
+			 * Resource Source Index and Resource Source are
+			 * optional elements.  Check the length of the
+			 * Bytestream.  If it is greater than 9, that
+			 * means that an Index exists and is followed by
+			 * a null termininated string.  Therefore, set
+			 * the temp variable to the length minus the minimum
+			 * byte stream length plus the byte for the Index to
+			 * determine the size of the NULL terminiated string.
+			 */
+			if (9 + additional_bytes < temp16) {
+				temp8 = (u8) (temp16 - (9 + additional_bytes));
+			}
 
-				for (index = 0; index < 16; index++) {
-					if (temp16 & 0x1) {
-						++number_of_interrupts;
-					}
+			else {
+				temp8 = 0;
+			}
 
-					temp16 >>= 1;
-				}
+			/*
+			 * Ensure a 32-bit boundary for the structure
+			 */
+			temp8 = (u8) ROUND_UP_TO_32_bITS (temp8);
 
-				structure_size = sizeof (IO_RESOURCE) +
-						  RESOURCE_LENGTH_NO_DATA +
-						  (number_of_interrupts * sizeof (u32));
-				break;
+			structure_size = SIZEOF_RESOURCE (ACPI_RESOURCE_EXT_IRQ) +
+					   (additional_bytes * sizeof (u8)) +
+					   (temp8 * sizeof (u8));
+			break;
 
 
-			case DMA_FORMAT:
+		case RESOURCE_DESC_IRQ_FORMAT:
+			/*
+			 * IRQ Resource.
+			 * Determine if it there are two or three trailing bytes
+			 */
+			buffer = byte_stream_buffer;
+			temp8 = *buffer;
 
-				/*
-				 * DMA Resource
-				 */
-				buffer = byte_stream_buffer;
+			if(temp8 & 0x01) {
+				bytes_consumed = 4;
+			}
 
+			else {
 				bytes_consumed = 3;
+			}
 
-				/*
-				 * Point past the descriptor
-				 */
-				++buffer;
-
-				/*
-				 * Look at the number of bits set
-				 */
-				temp8 = *buffer;
+			/*
+			 * Point past the descriptor
+			 */
+			++buffer;
 
-				for(index = 0; index < 8; index++) {
-					if(temp8 & 0x1) {
-						++number_of_channels;
-					}
+			/*
+			 * Look at the number of bits set
+			 */
+			MOVE_UNALIGNED16_TO_16 (&temp16, buffer);
 
-					temp8 >>= 1;
+			for (index = 0; index < 16; index++) {
+				if (temp16 & 0x1) {
+					++number_of_interrupts;
 				}
 
-				structure_size = sizeof (DMA_RESOURCE) +
-						  RESOURCE_LENGTH_NO_DATA +
-						  (number_of_channels * sizeof (u32));
-				break;
+				temp16 >>= 1;
+			}
 
+			structure_size = SIZEOF_RESOURCE (ACPI_RESOURCE_IO) +
+					   (number_of_interrupts * sizeof (u32));
+			break;
 
-			case START_DEPENDENT_TAG:
 
-				/*
-				 * Start Dependent Functions Resource
-				 */
-				/*
-				 * Determine if it there are two or three trailing bytes
-				 */
-				buffer = byte_stream_buffer;
-				temp8 = *buffer;
+		case RESOURCE_DESC_DMA_FORMAT:
+			/*
+			 * DMA Resource
+			 */
+			buffer = byte_stream_buffer;
+			bytes_consumed = 3;
 
-				if(temp8 & 0x01) {
-					bytes_consumed = 2;
-				}
-				else {
-					bytes_consumed = 1;
+			/*
+			 * Point past the descriptor
+			 */
+			++buffer;
+
+			/*
+			 * Look at the number of bits set
+			 */
+			temp8 = *buffer;
+
+			for(index = 0; index < 8; index++) {
+				if(temp8 & 0x1) {
+					++number_of_channels;
 				}
 
+				temp8 >>= 1;
+			}
 
-				structure_size =
-						sizeof (START_DEPENDENT_FUNCTIONS_RESOURCE) +
-						RESOURCE_LENGTH_NO_DATA;
-				break;
+			structure_size = SIZEOF_RESOURCE (ACPI_RESOURCE_DMA) +
+					   (number_of_channels * sizeof (u32));
+			break;
 
 
-			case END_DEPENDENT_TAG:
+		case RESOURCE_DESC_START_DEPENDENT:
+			/*
+			 * Start Dependent Functions Resource
+			 * Determine if it there are two or three trailing bytes
+			 */
+			buffer = byte_stream_buffer;
+			temp8 = *buffer;
 
-				/*
-				 * End Dependent Functions Resource
-				 */
+			if(temp8 & 0x01) {
+				bytes_consumed = 2;
+			}
+			else {
 				bytes_consumed = 1;
-				structure_size = RESOURCE_LENGTH;
-				break;
-
+			}
 
-			case IO_PORT_DESCRIPTOR:
-				/*
-				 * IO Port Resource
-				 */
-				bytes_consumed = 8;
-				structure_size = sizeof (IO_RESOURCE) +
-						  RESOURCE_LENGTH_NO_DATA;
-				break;
+			structure_size = SIZEOF_RESOURCE (ACPI_RESOURCE_START_DPF);
+			break;
 
 
-			case FIXED_LOCATION_IO_DESCRIPTOR:
+		case RESOURCE_DESC_END_DEPENDENT:
+			/*
+			 * End Dependent Functions Resource
+			 */
+			bytes_consumed = 1;
+			structure_size = ACPI_RESOURCE_LENGTH;
+			break;
 
-				/*
-				 * Fixed IO Port Resource
-				 */
-				bytes_consumed = 4;
-				structure_size = sizeof (FIXED_IO_RESOURCE) +
-						  RESOURCE_LENGTH_NO_DATA;
-				break;
 
+		case RESOURCE_DESC_IO_PORT:
+			/*
+			 * IO Port Resource
+			 */
+			bytes_consumed = 8;
+			structure_size = SIZEOF_RESOURCE (ACPI_RESOURCE_IO);
+			break;
 
-			case SMALL_VENDOR_DEFINED:
 
-				/*
-				 * Vendor Specific Resource
-				 */
-				buffer = byte_stream_buffer;
+		case RESOURCE_DESC_FIXED_IO_PORT:
+			/*
+			 * Fixed IO Port Resource
+			 */
+			bytes_consumed = 4;
+			structure_size = SIZEOF_RESOURCE (ACPI_RESOURCE_FIXED_IO);
+			break;
 
-				temp8 = *buffer;
-				temp8 = (u8) (temp8 & 0x7);
-				bytes_consumed = temp8 + 1;
 
-				/*
-				 * Ensure a 32-bit boundry for the structure
-				 */
-				temp8 = (u8) ROUND_UP_TO_32_bITS (temp8);
-				structure_size = sizeof (VENDOR_RESOURCE) +
-						  RESOURCE_LENGTH_NO_DATA +
-						  (temp8 * sizeof (u8));
-				break;
+		case RESOURCE_DESC_SMALL_VENDOR:
+			/*
+			 * Vendor Specific Resource
+			 */
+			buffer = byte_stream_buffer;
 
+			temp8 = *buffer;
+			temp8 = (u8) (temp8 & 0x7);
+			bytes_consumed = temp8 + 1;
 
-			case END_TAG:
+			/*
+			 * Ensure a 32-bit boundary for the structure
+			 */
+			temp8 = (u8) ROUND_UP_TO_32_bITS (temp8);
+			structure_size = SIZEOF_RESOURCE (ACPI_RESOURCE_VENDOR) +
+					   (temp8 * sizeof (u8));
+			break;
 
-				/*
-				 * End Tag
-				 */
-				bytes_consumed = 2;
-				structure_size = RESOURCE_LENGTH;
-				byte_stream_buffer_length = bytes_parsed;
-				break;
 
+		case RESOURCE_DESC_END_TAG:
+			/*
+			 * End Tag
+			 */
+			bytes_consumed = 2;
+			structure_size = ACPI_RESOURCE_LENGTH;
+			byte_stream_buffer_length = bytes_parsed;
+			break;
 
-			default:
-				/*
-				 * If we get here, everything is out of sync,
-				 *  so exit with an error
-				 */
-				return (AE_AML_ERROR);
-				break;
 
-			} /* switch */
+		default:
+			/*
+			 * If we get here, everything is out of sync,
+			 *  so exit with an error
+			 */
+			return (AE_AML_INVALID_RESOURCE_TYPE);
+			break;
+		}
 
-		}  /* if(Resource_type & 0x80) */
 
 		/*
 		 * Update the return value and counter
@@ -732,14 +692,13 @@
 		 * Set the byte stream to point to the next resource
 		 */
 		byte_stream_buffer += bytes_consumed;
-
 	}
 
+
 	/*
 	 * This is the data the caller needs
 	 */
 	*size_needed = buffer_size;
-
 	return (AE_OK);
 }
 
@@ -750,14 +709,14 @@
  *
  * PARAMETERS:  Package_object          - Pointer to the package object
  *              Buffer_size_needed      - u32 pointer of the size buffer
- *                                          needed to properly return the
- *                                          parsed data
+ *                                        needed to properly return the
+ *                                        parsed data
  *
- * RETURN:      Status  AE_OK
+ * RETURN:      Status
  *
  * DESCRIPTION: Given a package representing a PCI routing table, this
- *                calculates the size of the corresponding linked list of
- *                descriptions.
+ *              calculates the size of the corresponding linked list of
+ *              descriptions.
  *
  ******************************************************************************/
 
@@ -785,11 +744,6 @@
 	 * The minus one is to subtract the size of the u8 Source[1]
 	 * member because it is added below.
 	 *
-	 * NOTE: The Number_of_elements is incremented by one to add an end
-	 * table structure that is essentially a structure of zeros.
-	 */
-
-	/*
 	 * But each PRT_ENTRY structure has a pointer to a string and
 	 * the size of that string must be found.
 	 */
@@ -815,8 +769,7 @@
 		for (table_index = 0; table_index < 4 && !name_found; table_index++) {
 			if ((ACPI_TYPE_STRING == (*sub_object_list)->common.type) ||
 				((INTERNAL_TYPE_REFERENCE == (*sub_object_list)->common.type) &&
-					((*sub_object_list)->reference.op_code == AML_NAMEPATH_OP)))
-			{
+					((*sub_object_list)->reference.opcode == AML_INT_NAMEPATH_OP))) {
 				name_found = TRUE;
 			}
 
@@ -841,20 +794,21 @@
 				 */
 				temp_size_needed += (*sub_object_list)->string.length;
 			}
+
 			else {
-				temp_size_needed += acpi_ns_get_pathname_length ((*sub_object_list)->reference.node);
+				temp_size_needed += acpi_ns_get_pathname_length (
+						   (*sub_object_list)->reference.node);
 			}
 		}
 
 		else {
 			/*
 			 * If no name was found, then this is a NULL, which is
-			 *  translated as a u32 zero.
+			 * translated as a u32 zero.
 			 */
-			temp_size_needed += sizeof(u32);
+			temp_size_needed += sizeof (u32);
 		}
 
-
 		/* Round up the size since each element must be aligned */
 
 		temp_size_needed = ROUND_UP_TO_64_bITS (temp_size_needed);
@@ -866,7 +820,9 @@
 	}
 
 
-	*buffer_size_needed = temp_size_needed;
-
+	/*
+	 * Adding an extra element to the end of the list, essentially a NULL terminator
+	 */
+	*buffer_size_needed = temp_size_needed + sizeof (PCI_ROUTING_TABLE);
 	return (AE_OK);
 }
diff -urN linux-2.4.6-pre4/drivers/acpi/resources/rscreate.c linux/drivers/acpi/resources/rscreate.c
--- linux-2.4.6-pre4/drivers/acpi/resources/rscreate.c	Fri Feb  9 11:45:58 2001
+++ linux/drivers/acpi/resources/rscreate.c	Mon Dec  3 22:48:42 2001
@@ -1,9 +1,7 @@
 /*******************************************************************************
  *
- * Module Name: rscreate - Acpi_rs_create_resource_list
- *                         Acpi_rs_create_pci_routing_table
- *                         Acpi_rs_create_byte_stream
- *              $Revision: 25 $
+ * Module Name: rscreate - Create resource lists/tables
+ *              $Revision: 33 $
  *
  ******************************************************************************/
 
@@ -31,7 +29,7 @@
 #include "amlcode.h"
 #include "acnamesp.h"
 
-#define _COMPONENT          RESOURCE_MANAGER
+#define _COMPONENT          ACPI_RESOURCES
 	 MODULE_NAME         ("rscreate")
 
 
@@ -39,8 +37,7 @@
  *
  * FUNCTION:    Acpi_rs_create_resource_list
  *
- * PARAMETERS:
- *              Byte_stream_buffer      - Pointer to the resource byte stream
+ * PARAMETERS:  Byte_stream_buffer      - Pointer to the resource byte stream
  *              Output_buffer           - Pointer to the user's buffer
  *              Output_buffer_length    - Pointer to the size of Output_buffer
  *
@@ -63,9 +60,9 @@
 {
 
 	ACPI_STATUS             status;
-	u8                      *byte_stream_start = NULL;
+	u8                      *byte_stream_start;
 	u32                     list_size_needed = 0;
-	u32                     byte_stream_buffer_length = 0;
+	u32                     byte_stream_buffer_length;
 
 
 	/*
@@ -79,8 +76,7 @@
 	 * Pass the Byte_stream_buffer into a module that can calculate
 	 * the buffer size needed for the linked list
 	 */
-	status = acpi_rs_calculate_list_length (byte_stream_start,
-			 byte_stream_buffer_length,
+	status = acpi_rs_calculate_list_length (byte_stream_start, byte_stream_buffer_length,
 			 &list_size_needed);
 
 	/*
@@ -101,8 +97,7 @@
 		 */
 		MEMSET (output_buffer, 0x00, *output_buffer_length);
 
-		status = acpi_rs_byte_stream_to_list (byte_stream_start,
-				 byte_stream_buffer_length,
+		status = acpi_rs_byte_stream_to_list (byte_stream_start, byte_stream_buffer_length,
 				 &output_buffer);
 
 		/*
@@ -121,7 +116,6 @@
 
 	*output_buffer_length = list_size_needed;
 	return (AE_OK);
-
 }
 
 
@@ -129,9 +123,8 @@
  *
  * FUNCTION:    Acpi_rs_create_pci_routing_table
  *
- * PARAMETERS:
- *              Package_object          - Pointer to an ACPI_OPERAND_OBJECT
- *                                          package
+ * PARAMETERS:  Package_object          - Pointer to an ACPI_OPERAND_OBJECT
+ *                                        package
  *              Output_buffer           - Pointer to the user's buffer
  *              Output_buffer_length    - Size of Output_buffer
  *
@@ -167,8 +160,12 @@
 	 * Params already validated, so we don't re-validate here
 	 */
 
-	status = acpi_rs_calculate_pci_routing_table_length(package_object,
-			  &buffer_size_needed);
+	status = acpi_rs_calculate_pci_routing_table_length (package_object,
+			 &buffer_size_needed);
+
+	if (!ACPI_SUCCESS(status)) {
+		return (status);
+	}
 
 	/*
 	 * If the data will fit into the available buffer
@@ -240,8 +237,7 @@
 			sub_object_list++;
 
 			if (ACPI_TYPE_INTEGER == (*sub_object_list)->common.type) {
-				user_prt->pin =
-						(u32) (*sub_object_list)->integer.value;
+				user_prt->pin = (u32) (*sub_object_list)->integer.value;
 			}
 
 			else {
@@ -253,10 +249,10 @@
 			 */
 			sub_object_list++;
 
-			switch ((*sub_object_list)->common.type)
-			{
+			switch ((*sub_object_list)->common.type) {
 			case INTERNAL_TYPE_REFERENCE:
-				if ((*sub_object_list)->reference.op_code != AML_NAMEPATH_OP) {
+
+				if ((*sub_object_list)->reference.opcode != AML_INT_NAMEPATH_OP) {
 					return (AE_BAD_DATA);
 				}
 
@@ -298,6 +294,7 @@
 
 
 			default:
+
 			   return (AE_BAD_DATA);
 			   break;
 			}
@@ -312,8 +309,7 @@
 			sub_object_list++;
 
 			if (ACPI_TYPE_INTEGER == (*sub_object_list)->common.type) {
-				user_prt->source_index =
-						(u32) (*sub_object_list)->integer.value;
+				user_prt->source_index = (u32) (*sub_object_list)->integer.value;
 			}
 
 			else {
@@ -338,7 +334,6 @@
 	 * Report the amount of buffer used
 	 */
 	*output_buffer_length = buffer_size_needed;
-
 	return (AE_OK);
 }
 
@@ -347,8 +342,7 @@
  *
  * FUNCTION:    Acpi_rs_create_byte_stream
  *
- * PARAMETERS:
- *              Linked_list_buffer      - Pointer to the resource linked list
+ * PARAMETERS:  Linked_list_buffer      - Pointer to the resource linked list
  *              Output_buffer           - Pointer to the user's buffer
  *              Output_buffer_length    - Size of Output_buffer
  *
@@ -365,7 +359,7 @@
 
 ACPI_STATUS
 acpi_rs_create_byte_stream (
-	RESOURCE                *linked_list_buffer,
+	ACPI_RESOURCE           *linked_list_buffer,
 	u8                      *output_buffer,
 	u32                     *output_buffer_length)
 {
@@ -400,8 +394,7 @@
 		 */
 		MEMSET (output_buffer, 0x00, *output_buffer_length);
 
-		status = acpi_rs_list_to_byte_stream (linked_list_buffer,
-				 byte_stream_size_needed,
+		status = acpi_rs_list_to_byte_stream (linked_list_buffer, byte_stream_size_needed,
 				 &output_buffer);
 
 		/*
@@ -412,6 +405,7 @@
 		}
 
 	}
+
 	else {
 		*output_buffer_length = byte_stream_size_needed;
 		return (AE_BUFFER_OVERFLOW);
diff -urN linux-2.4.6-pre4/drivers/acpi/resources/rsdump.c linux/drivers/acpi/resources/rsdump.c
--- linux-2.4.6-pre4/drivers/acpi/resources/rsdump.c	Fri Feb  9 11:45:58 2001
+++ linux/drivers/acpi/resources/rsdump.c	Mon Dec  3 22:48:42 2001
@@ -1,7 +1,7 @@
 /*******************************************************************************
  *
- * Module Name: rsdump - Functions do dump out the resource structures.
- *              $Revision: 16 $
+ * Module Name: rsdump - Functions to display the resource structures.
+ *              $Revision: 20 $
  *
  ******************************************************************************/
 
@@ -27,7 +27,7 @@
 #include "acpi.h"
 #include "acresrc.h"
 
-#define _COMPONENT          RESOURCE_MANAGER
+#define _COMPONENT          ACPI_RESOURCES
 	 MODULE_NAME         ("rsdump")
 
 
@@ -37,7 +37,7 @@
  *
  * PARAMETERS:  Data            - pointer to the resource structure to dump.
  *
- * RETURN:
+ * RETURN:      None
  *
  * DESCRIPTION: Prints out the various members of the Data structure type.
  *
@@ -45,28 +45,24 @@
 
 void
 acpi_rs_dump_irq (
-	RESOURCE_DATA           *data)
+	ACPI_RESOURCE_DATA      *data)
 {
-	IRQ_RESOURCE            *irq_data = (IRQ_RESOURCE*) data;
+	ACPI_RESOURCE_IRQ       *irq_data = (ACPI_RESOURCE_IRQ *) data;
 	u8                      index = 0;
 
 
-	acpi_os_printf ("\t_iRQ Resource\n");
+	acpi_os_printf ("IRQ Resource\n");
 
-	acpi_os_printf ("\t\t%s Triggered\n",
-			 LEVEL_SENSITIVE == irq_data->edge_level ?
-			 "Level" : "Edge");
+	acpi_os_printf ("  %s Triggered\n",
+			 LEVEL_SENSITIVE == irq_data->edge_level ? "Level" : "Edge");
 
-	acpi_os_printf ("\t\t_active %s\n",
-			 ACTIVE_LOW == irq_data->active_high_low ?
-			 "Low" : "High");
+	acpi_os_printf ("  Active %s\n",
+			 ACTIVE_LOW == irq_data->active_high_low ? "Low" : "High");
 
-	acpi_os_printf ("\t\t%s\n",
-			 SHARED == irq_data->shared_exclusive ?
-			 "Shared" : "Exclusive");
+	acpi_os_printf ("  %s\n",
+			 SHARED == irq_data->shared_exclusive ? "Shared" : "Exclusive");
 
-	acpi_os_printf ("\t\t%X Interrupts ( ",
-			 irq_data->number_of_interrupts);
+	acpi_os_printf ("  %X Interrupts ( ", irq_data->number_of_interrupts);
 
 	for (index = 0; index < irq_data->number_of_interrupts; index++) {
 		acpi_os_printf ("%X ", irq_data->interrupts[index]);
@@ -83,7 +79,7 @@
  *
  * PARAMETERS:  Data            - pointer to the resource structure to dump.
  *
- * RETURN:
+ * RETURN:      None
  *
  * DESCRIPTION: Prints out the various members of the Data structure type.
  *
@@ -91,62 +87,59 @@
 
 void
 acpi_rs_dump_dma (
-	RESOURCE_DATA           *data)
+	ACPI_RESOURCE_DATA      *data)
 {
-	DMA_RESOURCE            *dma_data = (DMA_RESOURCE*) data;
+	ACPI_RESOURCE_DMA       *dma_data = (ACPI_RESOURCE_DMA *) data;
 	u8                      index = 0;
 
 
-	acpi_os_printf ("\t_dMA Resource\n");
+	acpi_os_printf ("DMA Resource\n");
 
-	switch (dma_data->type)
-	{
+	switch (dma_data->type) {
 	case COMPATIBILITY:
-		acpi_os_printf ("\t\t_compatibility mode\n");
+		acpi_os_printf ("  Compatibility mode\n");
 		break;
 
 	case TYPE_A:
-		acpi_os_printf ("\t\t_type A\n");
+		acpi_os_printf ("  Type A\n");
 		break;
 
 	case TYPE_B:
-		acpi_os_printf ("\t\t_type B\n");
+		acpi_os_printf ("  Type B\n");
 		break;
 
 	case TYPE_F:
-		acpi_os_printf ("\t\t_type F\n");
+		acpi_os_printf ("  Type F\n");
 		break;
 
 	default:
-		acpi_os_printf ("\t\t_invalid DMA type\n");
+		acpi_os_printf ("  Invalid DMA type\n");
 		break;
 	}
 
-	acpi_os_printf ("\t\t%sBus Master\n",
-			 BUS_MASTER == dma_data->bus_master ?
-			 "" : "Not a ");
+	acpi_os_printf ("  %sBus Master\n",
+			 BUS_MASTER == dma_data->bus_master ? "" : "Not a ");
 
-	switch (dma_data->transfer)
-	{
+
+	switch (dma_data->transfer) {
 	case TRANSFER_8:
-		acpi_os_printf ("\t\t8-bit only transfer\n");
+		acpi_os_printf ("  8-bit only transfer\n");
 		break;
 
 	case TRANSFER_8_16:
-		acpi_os_printf ("\t\t8 and 16-bit transfer\n");
+		acpi_os_printf ("  8 and 16-bit transfer\n");
 		break;
 
 	case TRANSFER_16:
-		acpi_os_printf ("\t\t16 bit only transfer\n");
+		acpi_os_printf ("  16 bit only transfer\n");
 		break;
 
 	default:
-		acpi_os_printf ("\t\t_invalid transfer preference\n");
+		acpi_os_printf ("  Invalid transfer preference\n");
 		break;
 	}
 
-	acpi_os_printf ("\t\t_number of Channels: %X ( ",
-			 dma_data->number_of_channels);
+	acpi_os_printf ("  Number of Channels: %X ( ", dma_data->number_of_channels);
 
 	for (index = 0; index < dma_data->number_of_channels; index++) {
 		acpi_os_printf ("%X ", dma_data->channels[index]);
@@ -163,7 +156,7 @@
  *
  * PARAMETERS:  Data            - pointer to the resource structure to dump.
  *
- * RETURN:
+ * RETURN:      None
  *
  * DESCRIPTION: Prints out the various members of the Data structure type.
  *
@@ -171,49 +164,47 @@
 
 void
 acpi_rs_dump_start_dependent_functions (
-	RESOURCE_DATA               *data)
+	ACPI_RESOURCE_DATA          *data)
 {
-	START_DEPENDENT_FUNCTIONS_RESOURCE *sdf_data =
-			   (START_DEPENDENT_FUNCTIONS_RESOURCE*) data;
+	ACPI_RESOURCE_START_DPF     *sdf_data = (ACPI_RESOURCE_START_DPF *) data;
+
 
+	acpi_os_printf ("Start Dependent Functions Resource\n");
 
-	acpi_os_printf ("\t_start Dependent Functions Resource\n");
 
-	switch (sdf_data->compatibility_priority)
-	{
+	switch (sdf_data->compatibility_priority) {
 	case GOOD_CONFIGURATION:
-		acpi_os_printf ("\t\t_good configuration\n");
+		acpi_os_printf ("  Good configuration\n");
 		break;
 
 	case ACCEPTABLE_CONFIGURATION:
-		acpi_os_printf ("\t\t_acceptable configuration\n");
+		acpi_os_printf ("  Acceptable configuration\n");
 		break;
 
 	case SUB_OPTIMAL_CONFIGURATION:
-		acpi_os_printf ("\t\t_sub-optimal configuration\n");
+		acpi_os_printf ("  Sub-optimal configuration\n");
 		break;
 
 	default:
-		acpi_os_printf ("\t\t_invalid compatibility priority\n");
+		acpi_os_printf ("  Invalid compatibility priority\n");
 		break;
 	}
 
-	switch(sdf_data->performance_robustness)
-	{
+	switch(sdf_data->performance_robustness) {
 	case GOOD_CONFIGURATION:
-		acpi_os_printf ("\t\t_good configuration\n");
+		acpi_os_printf ("  Good configuration\n");
 		break;
 
 	case ACCEPTABLE_CONFIGURATION:
-		acpi_os_printf ("\t\t_acceptable configuration\n");
+		acpi_os_printf ("  Acceptable configuration\n");
 		break;
 
 	case SUB_OPTIMAL_CONFIGURATION:
-		acpi_os_printf ("\t\t_sub-optimal configuration\n");
+		acpi_os_printf ("  Sub-optimal configuration\n");
 		break;
 
 	default:
-		acpi_os_printf ("\t\t_invalid performance "
+		acpi_os_printf ("  Invalid performance "
 				  "robustness preference\n");
 		break;
 	}
@@ -228,7 +219,7 @@
  *
  * PARAMETERS:  Data            - pointer to the resource structure to dump.
  *
- * RETURN:
+ * RETURN:      None
  *
  * DESCRIPTION: Prints out the various members of the Data structure type.
  *
@@ -236,26 +227,26 @@
 
 void
 acpi_rs_dump_io (
-	RESOURCE_DATA       *data)
+	ACPI_RESOURCE_DATA      *data)
 {
-	IO_RESOURCE         *io_data = (IO_RESOURCE*) data;
+	ACPI_RESOURCE_IO        *io_data = (ACPI_RESOURCE_IO *) data;
 
 
-	acpi_os_printf ("\t_io Resource\n");
+	acpi_os_printf ("Io Resource\n");
 
-	acpi_os_printf ("\t\t%d bit decode\n",
+	acpi_os_printf ("  %d bit decode\n",
 			 DECODE_16 == io_data->io_decode ? 16 : 10);
 
-	acpi_os_printf ("\t\t_range minimum base: %08X\n",
+	acpi_os_printf ("  Range minimum base: %08X\n",
 			 io_data->min_base_address);
 
-	acpi_os_printf ("\t\t_range maximum base: %08X\n",
+	acpi_os_printf ("  Range maximum base: %08X\n",
 			 io_data->max_base_address);
 
-	acpi_os_printf ("\t\t_alignment: %08X\n",
+	acpi_os_printf ("  Alignment: %08X\n",
 			 io_data->alignment);
 
-	acpi_os_printf ("\t\t_range Length: %08X\n",
+	acpi_os_printf ("  Range Length: %08X\n",
 			 io_data->range_length);
 
 	return;
@@ -268,7 +259,7 @@
  *
  * PARAMETERS:  Data            - pointer to the resource structure to dump.
  *
- * RETURN:
+ * RETURN:      None
  *
  * DESCRIPTION: Prints out the various members of the Data structure type.
  *
@@ -276,16 +267,16 @@
 
 void
 acpi_rs_dump_fixed_io (
-	RESOURCE_DATA           *data)
+	ACPI_RESOURCE_DATA      *data)
 {
-	FIXED_IO_RESOURCE       *fixed_io_data = (FIXED_IO_RESOURCE*) data;
+	ACPI_RESOURCE_FIXED_IO  *fixed_io_data = (ACPI_RESOURCE_FIXED_IO *) data;
 
 
-	acpi_os_printf ("\t_fixed Io Resource\n");
-	acpi_os_printf ("\t\t_range base address: %08X",
+	acpi_os_printf ("Fixed Io Resource\n");
+	acpi_os_printf ("  Range base address: %08X",
 			 fixed_io_data->base_address);
 
-	acpi_os_printf ("\t\t_range length: %08X",
+	acpi_os_printf ("  Range length: %08X",
 			 fixed_io_data->range_length);
 
 	return;
@@ -298,7 +289,7 @@
  *
  * PARAMETERS:  Data            - pointer to the resource structure to dump.
  *
- * RETURN:
+ * RETURN:      None
  *
  * DESCRIPTION: Prints out the various members of the Data structure type.
  *
@@ -306,18 +297,18 @@
 
 void
 acpi_rs_dump_vendor_specific (
-	RESOURCE_DATA           *data)
+	ACPI_RESOURCE_DATA      *data)
 {
-	VENDOR_RESOURCE         *vendor_data = (VENDOR_RESOURCE*) data;
+	ACPI_RESOURCE_VENDOR    *vendor_data = (ACPI_RESOURCE_VENDOR *) data;
 	u16                     index = 0;
 
 
-	acpi_os_printf ("\t_vendor Specific Resource\n");
+	acpi_os_printf ("Vendor Specific Resource\n");
 
-	acpi_os_printf ("\t\t_length: %08X\n", vendor_data->length);
+	acpi_os_printf ("  Length: %08X\n", vendor_data->length);
 
 	for (index = 0; index < vendor_data->length; index++) {
-		acpi_os_printf ("\t\t_byte %X: %08X\n",
+		acpi_os_printf ("  Byte %X: %08X\n",
 				 index, vendor_data->reserved[index]);
 	}
 
@@ -331,7 +322,7 @@
  *
  * PARAMETERS:  Data            - pointer to the resource structure to dump.
  *
- * RETURN:
+ * RETURN:      None
  *
  * DESCRIPTION: Prints out the various members of the Data structure type.
  *
@@ -339,28 +330,28 @@
 
 void
 acpi_rs_dump_memory24 (
-	RESOURCE_DATA           *data)
+	ACPI_RESOURCE_DATA      *data)
 {
-	MEMORY24_RESOURCE       *memory24_data = (MEMORY24_RESOURCE*) data;
+	ACPI_RESOURCE_MEM24     *memory24_data = (ACPI_RESOURCE_MEM24 *) data;
 
 
-	acpi_os_printf ("\t24-Bit Memory Range Resource\n");
+	acpi_os_printf ("24-Bit Memory Range Resource\n");
 
-	acpi_os_printf ("\t\t_read%s\n",
+	acpi_os_printf ("  Read%s\n",
 			 READ_WRITE_MEMORY ==
 			 memory24_data->read_write_attribute ?
 			 "/Write" : " only");
 
-	acpi_os_printf ("\t\t_range minimum base: %08X\n",
+	acpi_os_printf ("  Range minimum base: %08X\n",
 			 memory24_data->min_base_address);
 
-	acpi_os_printf ("\t\t_range maximum base: %08X\n",
+	acpi_os_printf ("  Range maximum base: %08X\n",
 			 memory24_data->max_base_address);
 
-	acpi_os_printf ("\t\t_alignment: %08X\n",
+	acpi_os_printf ("  Alignment: %08X\n",
 			 memory24_data->alignment);
 
-	acpi_os_printf ("\t\t_range length: %08X\n",
+	acpi_os_printf ("  Range length: %08X\n",
 			 memory24_data->range_length);
 
 	return;
@@ -373,7 +364,7 @@
  *
  * PARAMETERS:  Data            - pointer to the resource structure to dump.
  *
- * RETURN:
+ * RETURN:      None
  *
  * DESCRIPTION: Prints out the various members of the Data structure type.
  *
@@ -381,28 +372,28 @@
 
 void
 acpi_rs_dump_memory32 (
-	RESOURCE_DATA           *data)
+	ACPI_RESOURCE_DATA      *data)
 {
-	MEMORY32_RESOURCE       *memory32_data = (MEMORY32_RESOURCE*) data;
+	ACPI_RESOURCE_MEM32     *memory32_data = (ACPI_RESOURCE_MEM32 *) data;
 
 
-	acpi_os_printf ("\t32-Bit Memory Range Resource\n");
+	acpi_os_printf ("32-Bit Memory Range Resource\n");
 
-	acpi_os_printf ("\t\t_read%s\n",
+	acpi_os_printf ("  Read%s\n",
 			 READ_WRITE_MEMORY ==
 			 memory32_data->read_write_attribute ?
 			 "/Write" : " only");
 
-	acpi_os_printf ("\t\t_range minimum base: %08X\n",
+	acpi_os_printf ("  Range minimum base: %08X\n",
 			 memory32_data->min_base_address);
 
-	acpi_os_printf ("\t\t_range maximum base: %08X\n",
+	acpi_os_printf ("  Range maximum base: %08X\n",
 			 memory32_data->max_base_address);
 
-	acpi_os_printf ("\t\t_alignment: %08X\n",
+	acpi_os_printf ("  Alignment: %08X\n",
 			 memory32_data->alignment);
 
-	acpi_os_printf ("\t\t_range length: %08X\n",
+	acpi_os_printf ("  Range length: %08X\n",
 			 memory32_data->range_length);
 
 	return;
@@ -423,22 +414,22 @@
 
 void
 acpi_rs_dump_fixed_memory32 (
-	RESOURCE_DATA           *data)
+	ACPI_RESOURCE_DATA          *data)
 {
-	FIXED_MEMORY32_RESOURCE *fixed_memory32_data = (FIXED_MEMORY32_RESOURCE*) data;
+	ACPI_RESOURCE_FIXED_MEM32   *fixed_memory32_data = (ACPI_RESOURCE_FIXED_MEM32 *) data;
 
 
-	acpi_os_printf ("\t32-Bit Fixed Location Memory Range Resource\n");
+	acpi_os_printf ("32-Bit Fixed Location Memory Range Resource\n");
 
-	acpi_os_printf ("\t\t_read%s\n",
+	acpi_os_printf ("  Read%s\n",
 			 READ_WRITE_MEMORY ==
 			 fixed_memory32_data->read_write_attribute ?
 			 "/Write" : " Only");
 
-	acpi_os_printf ("\t\t_range base address: %08X\n",
+	acpi_os_printf ("  Range base address: %08X\n",
 			 fixed_memory32_data->range_base_address);
 
-	acpi_os_printf ("\t\t_range length: %08X\n",
+	acpi_os_printf ("  Range length: %08X\n",
 			 fixed_memory32_data->range_length);
 
 	return;
@@ -451,7 +442,7 @@
  *
  * PARAMETERS:  Data            - pointer to the resource structure to dump.
  *
- * RETURN:
+ * RETURN:      None
  *
  * DESCRIPTION: Prints out the various members of the Data structure type.
  *
@@ -459,49 +450,47 @@
 
 void
 acpi_rs_dump_address16 (
-	RESOURCE_DATA           *data)
+	ACPI_RESOURCE_DATA      *data)
 {
-	ADDRESS16_RESOURCE      *address16_data = (ADDRESS16_RESOURCE*) data;
+	ACPI_RESOURCE_ADDRESS16 *address16_data = (ACPI_RESOURCE_ADDRESS16 *) data;
 
 
-	acpi_os_printf ("\t16-Bit Address Space Resource\n");
-	acpi_os_printf ("\t\t_resource Type: ");
+	acpi_os_printf ("16-Bit Address Space Resource\n");
+	acpi_os_printf ("  Resource Type: ");
 
-	switch (address16_data->resource_type)
-	{
+	switch (address16_data->resource_type) {
 	case MEMORY_RANGE:
 
 		acpi_os_printf ("Memory Range\n");
 
-		switch (address16_data->attribute.memory.cache_attribute)
-		{
+		switch (address16_data->attribute.memory.cache_attribute) {
 		case NON_CACHEABLE_MEMORY:
-			acpi_os_printf ("\t\t_type Specific: "
+			acpi_os_printf ("  Type Specific: "
 					  "Noncacheable memory\n");
 			break;
 
 		case CACHABLE_MEMORY:
-			acpi_os_printf ("\t\t_type Specific: "
+			acpi_os_printf ("  Type Specific: "
 					  "Cacheable memory\n");
 			break;
 
 		case WRITE_COMBINING_MEMORY:
-			acpi_os_printf ("\t\t_type Specific: "
+			acpi_os_printf ("  Type Specific: "
 					  "Write-combining memory\n");
 			break;
 
 		case PREFETCHABLE_MEMORY:
-			acpi_os_printf ("\t\t_type Specific: "
+			acpi_os_printf ("  Type Specific: "
 					  "Prefetchable memory\n");
 			break;
 
 		default:
-			acpi_os_printf ("\t\t_type Specific: "
+			acpi_os_printf ("  Type Specific: "
 					  "Invalid cache attribute\n");
 			break;
 		}
 
-		acpi_os_printf ("\t\t_type Specific: Read%s\n",
+		acpi_os_printf ("  Type Specific: Read%s\n",
 			READ_WRITE_MEMORY ==
 			address16_data->attribute.memory.read_write_attribute ?
 			"/Write" : " Only");
@@ -511,25 +500,24 @@
 
 		acpi_os_printf ("I/O Range\n");
 
-		switch (address16_data->attribute.io.range_attribute)
-		{
+		switch (address16_data->attribute.io.range_attribute) {
 		case NON_ISA_ONLY_RANGES:
-			acpi_os_printf ("\t\t_type Specific: "
+			acpi_os_printf ("  Type Specific: "
 					  "Non-ISA Io Addresses\n");
 			break;
 
 		case ISA_ONLY_RANGES:
-			acpi_os_printf ("\t\t_type Specific: "
+			acpi_os_printf ("  Type Specific: "
 					  "ISA Io Addresses\n");
 			break;
 
 		case ENTIRE_RANGE:
-			acpi_os_printf ("\t\t_type Specific: "
+			acpi_os_printf ("  Type Specific: "
 					  "ISA and non-ISA Io Addresses\n");
 			break;
 
 		default:
-			acpi_os_printf ("\t\t_type Specific: "
+			acpi_os_printf ("  Type Specific: "
 					  "Invalid range attribute\n");
 			break;
 		}
@@ -546,42 +534,42 @@
 		return;
 	}
 
-	acpi_os_printf ("\t\t_resource %s\n",
+	acpi_os_printf ("  Resource %s\n",
 			CONSUMER == address16_data->producer_consumer ?
 			"Consumer" : "Producer");
 
-	acpi_os_printf ("\t\t%s decode\n",
+	acpi_os_printf ("  %s decode\n",
 			 SUB_DECODE == address16_data->decode ?
 			 "Subtractive" : "Positive");
 
-	acpi_os_printf ("\t\t_min address is %s fixed\n",
+	acpi_os_printf ("  Min address is %s fixed\n",
 			 ADDRESS_FIXED == address16_data->min_address_fixed ?
 			 "" : "not");
 
-	acpi_os_printf ("\t\t_max address is %s fixed\n",
+	acpi_os_printf ("  Max address is %s fixed\n",
 			 ADDRESS_FIXED == address16_data->max_address_fixed ?
 			 "" : "not");
 
-	acpi_os_printf ("\t\t_granularity: %08X\n",
+	acpi_os_printf ("  Granularity: %08X\n",
 			 address16_data->granularity);
 
-	acpi_os_printf ("\t\t_address range min: %08X\n",
+	acpi_os_printf ("  Address range min: %08X\n",
 			 address16_data->min_address_range);
 
-	acpi_os_printf ("\t\t_address range max: %08X\n",
+	acpi_os_printf ("  Address range max: %08X\n",
 			 address16_data->max_address_range);
 
-	acpi_os_printf ("\t\t_address translation offset: %08X\n",
+	acpi_os_printf ("  Address translation offset: %08X\n",
 			 address16_data->address_translation_offset);
 
-	acpi_os_printf ("\t\t_address Length: %08X\n",
+	acpi_os_printf ("  Address Length: %08X\n",
 			 address16_data->address_length);
 
-	if (0xFF != address16_data->resource_source_index) {
-		acpi_os_printf ("\t\t_resource Source Index: %X\n",
-				 address16_data->resource_source_index);
-		acpi_os_printf ("\t\t_resource Source: %s\n",
-				 address16_data->resource_source);
+	if (0xFF != address16_data->resource_source.index) {
+		acpi_os_printf ("  Resource Source Index: %X\n",
+				 address16_data->resource_source.index);
+		acpi_os_printf ("  Resource Source: %s\n",
+				 address16_data->resource_source.string_ptr);
 	}
 
 	return;
@@ -594,7 +582,7 @@
  *
  * PARAMETERS:  Data            - pointer to the resource structure to dump.
  *
- * RETURN:
+ * RETURN:      None
  *
  * DESCRIPTION: Prints out the various members of the Data structure type.
  *
@@ -602,48 +590,46 @@
 
 void
 acpi_rs_dump_address32 (
-	RESOURCE_DATA           *data)
+	ACPI_RESOURCE_DATA      *data)
 {
-	ADDRESS32_RESOURCE      *address32_data = (ADDRESS32_RESOURCE*) data;
+	ACPI_RESOURCE_ADDRESS32 *address32_data = (ACPI_RESOURCE_ADDRESS32 *) data;
 
 
-	acpi_os_printf ("\t32-Bit Address Space Resource\n");
+	acpi_os_printf ("32-Bit Address Space Resource\n");
 
-	switch (address32_data->resource_type)
-	{
+	switch (address32_data->resource_type) {
 	case MEMORY_RANGE:
 
-		acpi_os_printf ("\t\t_resource Type: Memory Range\n");
+		acpi_os_printf ("  Resource Type: Memory Range\n");
 
-		switch (address32_data->attribute.memory.cache_attribute)
-		{
+		switch (address32_data->attribute.memory.cache_attribute) {
 		case NON_CACHEABLE_MEMORY:
-			acpi_os_printf ("\t\t_type Specific: "
+			acpi_os_printf ("  Type Specific: "
 					  "Noncacheable memory\n");
 			break;
 
 		case CACHABLE_MEMORY:
-			acpi_os_printf ("\t\t_type Specific: "
+			acpi_os_printf ("  Type Specific: "
 					  "Cacheable memory\n");
 			break;
 
 		case WRITE_COMBINING_MEMORY:
-			acpi_os_printf ("\t\t_type Specific: "
+			acpi_os_printf ("  Type Specific: "
 					  "Write-combining memory\n");
 			break;
 
 		case PREFETCHABLE_MEMORY:
-			acpi_os_printf ("\t\t_type Specific: "
+			acpi_os_printf ("  Type Specific: "
 					  "Prefetchable memory\n");
 			break;
 
 		default:
-			acpi_os_printf ("\t\t_type Specific: "
+			acpi_os_printf ("  Type Specific: "
 					  "Invalid cache attribute\n");
 			break;
 		}
 
-		acpi_os_printf ("\t\t_type Specific: Read%s\n",
+		acpi_os_printf ("  Type Specific: Read%s\n",
 			READ_WRITE_MEMORY ==
 			address32_data->attribute.memory.read_write_attribute ?
 			"/Write" : " Only");
@@ -651,27 +637,26 @@
 
 	case IO_RANGE:
 
-		acpi_os_printf ("\t\t_resource Type: Io Range\n");
+		acpi_os_printf ("  Resource Type: Io Range\n");
 
-		switch (address32_data->attribute.io.range_attribute)
-			{
+		switch (address32_data->attribute.io.range_attribute) {
 			case NON_ISA_ONLY_RANGES:
-				acpi_os_printf ("\t\t_type Specific: "
+				acpi_os_printf ("  Type Specific: "
 						  "Non-ISA Io Addresses\n");
 				break;
 
 			case ISA_ONLY_RANGES:
-				acpi_os_printf ("\t\t_type Specific: "
+				acpi_os_printf ("  Type Specific: "
 						  "ISA Io Addresses\n");
 				break;
 
 			case ENTIRE_RANGE:
-				acpi_os_printf ("\t\t_type Specific: "
+				acpi_os_printf ("  Type Specific: "
 						  "ISA and non-ISA Io Addresses\n");
 				break;
 
 			default:
-				acpi_os_printf ("\t\t_type Specific: "
+				acpi_os_printf ("  Type Specific: "
 						  "Invalid Range attribute");
 				break;
 			}
@@ -679,51 +664,190 @@
 
 	case BUS_NUMBER_RANGE:
 
-		acpi_os_printf ("\t\t_resource Type: Bus Number Range\n");
+		acpi_os_printf ("  Resource Type: Bus Number Range\n");
 		break;
 
 	default:
 
-		acpi_os_printf ("\t\t_invalid Resource Type..exiting.\n");
+		acpi_os_printf ("  Invalid Resource Type..exiting.\n");
 		return;
 	}
 
-	acpi_os_printf ("\t\t_resource %s\n",
+	acpi_os_printf ("  Resource %s\n",
 			 CONSUMER == address32_data->producer_consumer ?
 			 "Consumer" : "Producer");
 
-	acpi_os_printf ("\t\t%s decode\n",
+	acpi_os_printf ("  %s decode\n",
 			 SUB_DECODE == address32_data->decode ?
 			 "Subtractive" : "Positive");
 
-	acpi_os_printf ("\t\t_min address is %s fixed\n",
+	acpi_os_printf ("  Min address is %s fixed\n",
 			 ADDRESS_FIXED == address32_data->min_address_fixed ?
 			 "" : "not ");
 
-	acpi_os_printf ("\t\t_max address is %s fixed\n",
+	acpi_os_printf ("  Max address is %s fixed\n",
 			 ADDRESS_FIXED == address32_data->max_address_fixed ?
 			 "" : "not ");
 
-	acpi_os_printf ("\t\t_granularity: %08X\n",
+	acpi_os_printf ("  Granularity: %08X\n",
 			 address32_data->granularity);
 
-	acpi_os_printf ("\t\t_address range min: %08X\n",
+	acpi_os_printf ("  Address range min: %08X\n",
 			 address32_data->min_address_range);
 
-	acpi_os_printf ("\t\t_address range max: %08X\n",
+	acpi_os_printf ("  Address range max: %08X\n",
 			 address32_data->max_address_range);
 
-	acpi_os_printf ("\t\t_address translation offset: %08X\n",
+	acpi_os_printf ("  Address translation offset: %08X\n",
 			 address32_data->address_translation_offset);
 
-	acpi_os_printf ("\t\t_address Length: %08X\n",
+	acpi_os_printf ("  Address Length: %08X\n",
 			 address32_data->address_length);
 
-	if(0xFF != address32_data->resource_source_index) {
-		acpi_os_printf ("\t\t_resource Source Index: %X\n",
-				 address32_data->resource_source_index);
-		acpi_os_printf ("\t\t_resource Source: %s\n",
-				 address32_data->resource_source);
+	if(0xFF != address32_data->resource_source.index) {
+		acpi_os_printf ("  Resource Source Index: %X\n",
+				 address32_data->resource_source.index);
+		acpi_os_printf ("  Resource Source: %s\n",
+				 address32_data->resource_source.string_ptr);
+	}
+
+	return;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_rs_dump_address64
+ *
+ * PARAMETERS:  Data            - pointer to the resource structure to dump.
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Prints out the various members of the Data structure type.
+ *
+ ******************************************************************************/
+
+void
+acpi_rs_dump_address64 (
+	ACPI_RESOURCE_DATA      *data)
+{
+	ACPI_RESOURCE_ADDRESS64 *address64_data = (ACPI_RESOURCE_ADDRESS64 *) data;
+
+
+	acpi_os_printf ("64-Bit Address Space Resource\n");
+
+	switch (address64_data->resource_type) {
+	case MEMORY_RANGE:
+
+		acpi_os_printf ("  Resource Type: Memory Range\n");
+
+		switch (address64_data->attribute.memory.cache_attribute) {
+		case NON_CACHEABLE_MEMORY:
+			acpi_os_printf ("  Type Specific: "
+					  "Noncacheable memory\n");
+			break;
+
+		case CACHABLE_MEMORY:
+			acpi_os_printf ("  Type Specific: "
+					  "Cacheable memory\n");
+			break;
+
+		case WRITE_COMBINING_MEMORY:
+			acpi_os_printf ("  Type Specific: "
+					  "Write-combining memory\n");
+			break;
+
+		case PREFETCHABLE_MEMORY:
+			acpi_os_printf ("  Type Specific: "
+					  "Prefetchable memory\n");
+			break;
+
+		default:
+			acpi_os_printf ("  Type Specific: "
+					  "Invalid cache attribute\n");
+			break;
+		}
+
+		acpi_os_printf ("  Type Specific: Read%s\n",
+			READ_WRITE_MEMORY ==
+			address64_data->attribute.memory.read_write_attribute ?
+			"/Write" : " Only");
+		break;
+
+	case IO_RANGE:
+
+		acpi_os_printf ("  Resource Type: Io Range\n");
+
+		switch (address64_data->attribute.io.range_attribute) {
+			case NON_ISA_ONLY_RANGES:
+				acpi_os_printf ("  Type Specific: "
+						  "Non-ISA Io Addresses\n");
+				break;
+
+			case ISA_ONLY_RANGES:
+				acpi_os_printf ("  Type Specific: "
+						  "ISA Io Addresses\n");
+				break;
+
+			case ENTIRE_RANGE:
+				acpi_os_printf ("  Type Specific: "
+						  "ISA and non-ISA Io Addresses\n");
+				break;
+
+			default:
+				acpi_os_printf ("  Type Specific: "
+						  "Invalid Range attribute");
+				break;
+			}
+		break;
+
+	case BUS_NUMBER_RANGE:
+
+		acpi_os_printf ("  Resource Type: Bus Number Range\n");
+		break;
+
+	default:
+
+		acpi_os_printf ("  Invalid Resource Type..exiting.\n");
+		return;
+	}
+
+	acpi_os_printf ("  Resource %s\n",
+			 CONSUMER == address64_data->producer_consumer ?
+			 "Consumer" : "Producer");
+
+	acpi_os_printf ("  %s decode\n",
+			 SUB_DECODE == address64_data->decode ?
+			 "Subtractive" : "Positive");
+
+	acpi_os_printf ("  Min address is %s fixed\n",
+			 ADDRESS_FIXED == address64_data->min_address_fixed ?
+			 "" : "not ");
+
+	acpi_os_printf ("  Max address is %s fixed\n",
+			 ADDRESS_FIXED == address64_data->max_address_fixed ?
+			 "" : "not ");
+
+	acpi_os_printf ("  Granularity: %16X\n",
+			 address64_data->granularity);
+
+	acpi_os_printf ("  Address range min: %16X\n",
+			 address64_data->min_address_range);
+
+	acpi_os_printf ("  Address range max: %16X\n",
+			 address64_data->max_address_range);
+
+	acpi_os_printf ("  Address translation offset: %16X\n",
+			 address64_data->address_translation_offset);
+
+	acpi_os_printf ("  Address Length: %16X\n",
+			 address64_data->address_length);
+
+	if(0xFF != address64_data->resource_source.index) {
+		acpi_os_printf ("  Resource Source Index: %X\n",
+				 address64_data->resource_source.index);
+		acpi_os_printf ("  Resource Source: %s\n",
+				 address64_data->resource_source.string_ptr);
 	}
 
 	return;
@@ -736,7 +860,7 @@
  *
  * PARAMETERS:  Data            - pointer to the resource structure to dump.
  *
- * RETURN:
+ * RETURN:      None
  *
  * DESCRIPTION: Prints out the various members of the Data structure type.
  *
@@ -744,31 +868,31 @@
 
 void
 acpi_rs_dump_extended_irq (
-	RESOURCE_DATA           *data)
+	ACPI_RESOURCE_DATA      *data)
 {
-	EXTENDED_IRQ_RESOURCE   *ext_irq_data = (EXTENDED_IRQ_RESOURCE*) data;
+	ACPI_RESOURCE_EXT_IRQ   *ext_irq_data = (ACPI_RESOURCE_EXT_IRQ *) data;
 	u8                      index = 0;
 
 
-	acpi_os_printf ("\t_extended IRQ Resource\n");
+	acpi_os_printf ("Extended IRQ Resource\n");
 
-	acpi_os_printf ("\t\t_resource %s\n",
+	acpi_os_printf ("  Resource %s\n",
 			 CONSUMER == ext_irq_data->producer_consumer ?
 			 "Consumer" : "Producer");
 
-	acpi_os_printf ("\t\t%s\n",
+	acpi_os_printf ("  %s\n",
 			 LEVEL_SENSITIVE == ext_irq_data->edge_level ?
 			 "Level" : "Edge");
 
-	acpi_os_printf ("\t\t_active %s\n",
+	acpi_os_printf ("  Active %s\n",
 			 ACTIVE_LOW == ext_irq_data->active_high_low ?
 			 "low" : "high");
 
-	acpi_os_printf ("\t\t%s\n",
+	acpi_os_printf ("  %s\n",
 			 SHARED == ext_irq_data->shared_exclusive ?
 			 "Shared" : "Exclusive");
 
-	acpi_os_printf ("\t\t_interrupts : %X ( ",
+	acpi_os_printf ("  Interrupts : %X ( ",
 			 ext_irq_data->number_of_interrupts);
 
 	for (index = 0; index < ext_irq_data->number_of_interrupts; index++) {
@@ -777,11 +901,11 @@
 
 	acpi_os_printf (")\n");
 
-	if(0xFF != ext_irq_data->resource_source_index) {
-		acpi_os_printf ("\t\t_resource Source Index: %X",
-				 ext_irq_data->resource_source_index);
-		acpi_os_printf ("\t\t_resource Source: %s",
-				 ext_irq_data->resource_source);
+	if(0xFF != ext_irq_data->resource_source.index) {
+		acpi_os_printf ("  Resource Source Index: %X",
+				 ext_irq_data->resource_source.index);
+		acpi_os_printf ("  Resource Source: %s",
+				 ext_irq_data->resource_source.string_ptr);
 	}
 
 	return;
@@ -794,7 +918,7 @@
  *
  * PARAMETERS:  Data            - pointer to the resource structure to dump.
  *
- * RETURN:
+ * RETURN:      None
  *
  * DESCRIPTION: Dispatches the structure to the correct dump routine.
  *
@@ -802,7 +926,7 @@
 
 void
 acpi_rs_dump_resource_list (
-	RESOURCE            *resource)
+	ACPI_RESOURCE       *resource)
 {
 	u8                  count = 0;
 	u8                  done = FALSE;
@@ -810,66 +934,69 @@
 
 	if (acpi_dbg_level & TRACE_RESOURCES && _COMPONENT & acpi_dbg_layer) {
 		while (!done) {
-			acpi_os_printf ("\t_resource structure %x.\n", count++);
+			acpi_os_printf ("Resource structure %x.\n", count++);
 
-			switch (resource->id)
-			{
-			case irq:
+			switch (resource->id) {
+			case ACPI_RSTYPE_IRQ:
 				acpi_rs_dump_irq (&resource->data);
 				break;
 
-			case dma:
+			case ACPI_RSTYPE_DMA:
 				acpi_rs_dump_dma (&resource->data);
 				break;
 
-			case start_dependent_functions:
+			case ACPI_RSTYPE_START_DPF:
 				acpi_rs_dump_start_dependent_functions (&resource->data);
 				break;
 
-			case end_dependent_functions:
-				acpi_os_printf ("\t_end_dependent_functions Resource\n");
+			case ACPI_RSTYPE_END_DPF:
+				acpi_os_printf ("End_dependent_functions Resource\n");
 				/* Acpi_rs_dump_end_dependent_functions (Resource->Data);*/
 				break;
 
-			case io:
+			case ACPI_RSTYPE_IO:
 				acpi_rs_dump_io (&resource->data);
 				break;
 
-			case fixed_io:
+			case ACPI_RSTYPE_FIXED_IO:
 				acpi_rs_dump_fixed_io (&resource->data);
 				break;
 
-			case vendor_specific:
+			case ACPI_RSTYPE_VENDOR:
 				acpi_rs_dump_vendor_specific (&resource->data);
 				break;
 
-			case end_tag:
+			case ACPI_RSTYPE_END_TAG:
 				/*Rs_dump_end_tag (Resource->Data);*/
-				acpi_os_printf ("\t_end_tag Resource\n");
+				acpi_os_printf ("End_tag Resource\n");
 				done = TRUE;
 				break;
 
-			case memory24:
+			case ACPI_RSTYPE_MEM24:
 				acpi_rs_dump_memory24 (&resource->data);
 				break;
 
-			case memory32:
+			case ACPI_RSTYPE_MEM32:
 				acpi_rs_dump_memory32 (&resource->data);
 				break;
 
-			case fixed_memory32:
+			case ACPI_RSTYPE_FIXED_MEM32:
 				acpi_rs_dump_fixed_memory32 (&resource->data);
 				break;
 
-			case address16:
+			case ACPI_RSTYPE_ADDRESS16:
 				acpi_rs_dump_address16 (&resource->data);
 				break;
 
-			case address32:
+			case ACPI_RSTYPE_ADDRESS32:
 				acpi_rs_dump_address32 (&resource->data);
 				break;
 
-			case extended_irq:
+			case ACPI_RSTYPE_ADDRESS64:
+				acpi_rs_dump_address64 (&resource->data);
+				break;
+
+			case ACPI_RSTYPE_EXT_IRQ:
 				acpi_rs_dump_extended_irq (&resource->data);
 				break;
 
@@ -879,8 +1006,7 @@
 
 			}
 
-			resource = (RESOURCE *) ((NATIVE_UINT) resource +
-					 (NATIVE_UINT) resource->length);
+			resource = POINTER_ADD (ACPI_RESOURCE, resource, resource->length);
 		}
 	}
 
@@ -893,7 +1019,7 @@
  *
  * PARAMETERS:  Data            - pointer to the routing table to dump.
  *
- * RETURN:
+ * RETURN:      None
  *
  * DESCRIPTION: Dispatches the structures to the correct dump routine.
  *
@@ -913,16 +1039,16 @@
 		prt_element = (PCI_ROUTING_TABLE *) buffer;
 
 		while (!done) {
-			acpi_os_printf ("\t_pCI IRQ Routing Table structure %X.\n", count++);
+			acpi_os_printf ("PCI IRQ Routing Table structure %X.\n", count++);
 
-			acpi_os_printf ("\t\t_address: %X\n",
+			acpi_os_printf ("  Address: %X\n",
 					 prt_element->address);
 
-			acpi_os_printf ("\t\t_pin: %X\n", prt_element->pin);
+			acpi_os_printf ("  Pin: %X\n", prt_element->pin);
 
-			acpi_os_printf ("\t\t_source: %s\n", prt_element->source);
+			acpi_os_printf ("  Source: %s\n", prt_element->source);
 
-			acpi_os_printf ("\t\t_source_index: %X\n",
+			acpi_os_printf ("  Source_index: %X\n",
 					 prt_element->source_index);
 
 			buffer += prt_element->length;
diff -urN linux-2.4.6-pre4/drivers/acpi/resources/rsio.c linux/drivers/acpi/resources/rsio.c
--- linux-2.4.6-pre4/drivers/acpi/resources/rsio.c	Mon Jan 22 13:23:43 2001
+++ linux/drivers/acpi/resources/rsio.c	Mon Dec  3 22:48:42 2001
@@ -1,12 +1,7 @@
 /*******************************************************************************
  *
- * Module Name: rsio - Acpi_rs_io_resource
- *                     Acpi_rs_fixed_io_resource
- *                     Acpi_rs_io_stream
- *                     Acpi_rs_fixed_io_stream
- *                     Acpi_rs_dma_resource
- *                     Acpi_rs_dma_stream
- *              $Revision: 12 $
+ * Module Name: rsio - IO and DMA resource descriptors
+ *              $Revision: 14 $
  *
  ******************************************************************************/
 
@@ -32,7 +27,7 @@
 #include "acpi.h"
 #include "acresrc.h"
 
-#define _COMPONENT          RESOURCE_MANAGER
+#define _COMPONENT          ACPI_RESOURCES
 	 MODULE_NAME         ("rsio")
 
 
@@ -41,20 +36,20 @@
  * FUNCTION:    Acpi_rs_io_resource
  *
  * PARAMETERS:  Byte_stream_buffer      - Pointer to the resource input byte
- *                                          stream
+ *                                        stream
  *              Bytes_consumed          - u32 pointer that is filled with
- *                                          the number of bytes consumed from
- *                                          the Byte_stream_buffer
+ *                                        the number of bytes consumed from
+ *                                        the Byte_stream_buffer
  *              Output_buffer           - Pointer to the user's return buffer
  *              Structure_size          - u32 pointer that is filled with
- *                                          the number of bytes in the filled
- *                                          in structure
+ *                                        the number of bytes in the filled
+ *                                        in structure
  *
- * RETURN:      Status  AE_OK if okay, else a valid ACPI_STATUS code
+ * RETURN:      Status
  *
  * DESCRIPTION: Take the resource byte stream and fill out the appropriate
- *                  structure pointed to by the Output_buffer. Return the
- *                  number of bytes consumed from the byte stream.
+ *              structure pointed to by the Output_buffer. Return the
+ *              number of bytes consumed from the byte stream.
  *
  ******************************************************************************/
 
@@ -66,11 +61,10 @@
 	u32                     *structure_size)
 {
 	u8                      *buffer = byte_stream_buffer;
-	RESOURCE                *output_struct = (RESOURCE *) * output_buffer;
+	ACPI_RESOURCE           *output_struct = (ACPI_RESOURCE *) *output_buffer;
 	u16                     temp16 = 0;
 	u8                      temp8 = 0;
-	u32                     struct_size = sizeof (IO_RESOURCE) +
-			  RESOURCE_LENGTH_NO_DATA;
+	u32                     struct_size = SIZEOF_RESOURCE (ACPI_RESOURCE_IO);
 
 
 	/*
@@ -78,7 +72,7 @@
 	 */
 	*bytes_consumed = 8;
 
-	output_struct->id = io;
+	output_struct->id = ACPI_RSTYPE_IO;
 
 	/*
 	 * Check Decode
@@ -129,7 +123,6 @@
 	 * Return the final size of the structure
 	 */
 	*structure_size = struct_size;
-
 	return (AE_OK);
 }
 
@@ -139,20 +132,20 @@
  * FUNCTION:    Acpi_rs_fixed_io_resource
  *
  * PARAMETERS:  Byte_stream_buffer      - Pointer to the resource input byte
- *                                          stream
+ *                                        stream
  *              Bytes_consumed          - u32 pointer that is filled with
- *                                          the number of bytes consumed from
- *                                          the Byte_stream_buffer
+ *                                        the number of bytes consumed from
+ *                                        the Byte_stream_buffer
  *              Output_buffer           - Pointer to the user's return buffer
  *              Structure_size          - u32 pointer that is filled with
- *                                          the number of bytes in the filled
- *                                          in structure
+ *                                        the number of bytes in the filled
+ *                                        in structure
  *
- * RETURN:      Status  AE_OK if okay, else a valid ACPI_STATUS code
+ * RETURN:      Status
  *
  * DESCRIPTION: Take the resource byte stream and fill out the appropriate
- *                  structure pointed to by the Output_buffer. Return the
- *                  number of bytes consumed from the byte stream.
+ *              structure pointed to by the Output_buffer. Return the
+ *              number of bytes consumed from the byte stream.
  *
  ******************************************************************************/
 
@@ -164,11 +157,10 @@
 	u32                     *structure_size)
 {
 	u8                      *buffer = byte_stream_buffer;
-	RESOURCE                *output_struct = (RESOURCE *) * output_buffer;
+	ACPI_RESOURCE           *output_struct = (ACPI_RESOURCE *) *output_buffer;
 	u16                     temp16 = 0;
 	u8                      temp8 = 0;
-	u32                     struct_size = sizeof (FIXED_IO_RESOURCE) +
-			  RESOURCE_LENGTH_NO_DATA;
+	u32                     struct_size = SIZEOF_RESOURCE (ACPI_RESOURCE_FIXED_IO);
 
 
 	/*
@@ -176,7 +168,7 @@
 	 */
 	*bytes_consumed = 4;
 
-	output_struct->id = fixed_io;
+	output_struct->id = ACPI_RSTYPE_FIXED_IO;
 
 	/*
 	 * Check Range Base Address
@@ -203,7 +195,6 @@
 	 * Return the final size of the structure
 	 */
 	*structure_size = struct_size;
-
 	return (AE_OK);
 }
 
@@ -215,19 +206,19 @@
  * PARAMETERS:  Linked_list             - Pointer to the resource linked list
  *              Output_buffer           - Pointer to the user's return buffer
  *              Bytes_consumed          - u32 pointer that is filled with
- *                                          the number of bytes of the
- *                                          Output_buffer used
+ *                                        the number of bytes of the
+ *                                        Output_buffer used
  *
- * RETURN:      Status  AE_OK if okay, else a valid ACPI_STATUS code
+ * RETURN:      Status
  *
  * DESCRIPTION: Take the linked list resource structure and fills in the
- *                  the appropriate bytes in a byte stream
+ *              the appropriate bytes in a byte stream
  *
  ******************************************************************************/
 
 ACPI_STATUS
 acpi_rs_io_stream (
-	RESOURCE                *linked_list,
+	ACPI_RESOURCE           *linked_list,
 	u8                      **output_buffer,
 	u32                     *bytes_consumed)
 {
@@ -285,9 +276,7 @@
 	/*
 	 * Return the number of bytes consumed in this operation
 	 */
-	*bytes_consumed = (u32) ((NATIVE_UINT) buffer -
-			   (NATIVE_UINT) *output_buffer);
-
+	*bytes_consumed = POINTER_DIFF (buffer, *output_buffer);
 	return (AE_OK);
 }
 
@@ -299,19 +288,19 @@
  * PARAMETERS:  Linked_list             - Pointer to the resource linked list
  *              Output_buffer           - Pointer to the user's return buffer
  *              Bytes_consumed          - u32 pointer that is filled with
- *                                          the number of bytes of the
- *                                          Output_buffer used
+ *                                        the number of bytes of the
+ *                                        Output_buffer used
  *
- * RETURN:      Status  AE_OK if okay, else a valid ACPI_STATUS code
+ * RETURN:      Status
  *
  * DESCRIPTION: Take the linked list resource structure and fills in the
- *                  the appropriate bytes in a byte stream
+ *              the appropriate bytes in a byte stream
  *
  ******************************************************************************/
 
 ACPI_STATUS
 acpi_rs_fixed_io_stream (
-	RESOURCE                *linked_list,
+	ACPI_RESOURCE           *linked_list,
 	u8                      **output_buffer,
 	u32                     *bytes_consumed)
 {
@@ -346,9 +335,7 @@
 	/*
 	 * Return the number of bytes consumed in this operation
 	 */
-	*bytes_consumed = (u32) ((NATIVE_UINT) buffer -
-			   (NATIVE_UINT) *output_buffer);
-
+	*bytes_consumed = POINTER_DIFF (buffer, *output_buffer);
 	return (AE_OK);
 }
 
@@ -358,20 +345,20 @@
  * FUNCTION:    Acpi_rs_dma_resource
  *
  * PARAMETERS:  Byte_stream_buffer      - Pointer to the resource input byte
- *                                          stream
+ *                                        stream
  *              Bytes_consumed          - u32 pointer that is filled with
- *                                          the number of bytes consumed from
- *                                          the Byte_stream_buffer
+ *                                        the number of bytes consumed from
+ *                                        the Byte_stream_buffer
  *              Output_buffer           - Pointer to the user's return buffer
  *              Structure_size          - u32 pointer that is filled with
- *                                          the number of bytes in the filled
- *                                          in structure
+ *                                        the number of bytes in the filled
+ *                                        in structure
  *
- * RETURN:      Status  AE_OK if okay, else a valid ACPI_STATUS code
+ * RETURN:      Status
  *
  * DESCRIPTION: Take the resource byte stream and fill out the appropriate
- *                  structure pointed to by the Output_buffer. Return the
- *                  number of bytes consumed from the byte stream.
+ *              structure pointed to by the Output_buffer. Return the
+ *              number of bytes consumed from the byte stream.
  *
  ******************************************************************************/
 
@@ -383,19 +370,18 @@
 	u32                     *structure_size)
 {
 	u8                      *buffer = byte_stream_buffer;
-	RESOURCE                *output_struct = (RESOURCE *) * output_buffer;
+	ACPI_RESOURCE           *output_struct = (ACPI_RESOURCE *) *output_buffer;
 	u8                      temp8 = 0;
 	u8                      index;
 	u8                      i;
-	u32                     struct_size = sizeof(DMA_RESOURCE) +
-			  RESOURCE_LENGTH_NO_DATA;
+	u32                     struct_size = SIZEOF_RESOURCE (ACPI_RESOURCE_DMA);
 
 
 	/*
 	 * The number of bytes consumed are Constant
 	 */
 	*bytes_consumed = 3;
-	output_struct->id = dma;
+	output_struct->id = ACPI_RSTYPE_DMA;
 
 	/*
 	 * Point to the 8-bits of Byte 1
@@ -453,7 +439,6 @@
 	 * Return the final size of the structure
 	 */
 	*structure_size = struct_size;
-
 	return (AE_OK);
 }
 
@@ -465,19 +450,19 @@
  * PARAMETERS:  Linked_list             - Pointer to the resource linked list
  *              Output_buffer           - Pointer to the user's return buffer
  *              Bytes_consumed          - u32 pointer that is filled with
- *                                          the number of bytes of the
- *                                          Output_buffer used
+ *                                        the number of bytes of the
+ *                                        Output_buffer used
  *
- * RETURN:      Status  AE_OK if okay, else a valid ACPI_STATUS code
+ * RETURN:      Status
  *
  * DESCRIPTION: Take the linked list resource structure and fills in the
- *                  the appropriate bytes in a byte stream
+ *              the appropriate bytes in a byte stream
  *
  ******************************************************************************/
 
 ACPI_STATUS
 acpi_rs_dma_stream (
-	RESOURCE                *linked_list,
+	ACPI_RESOURCE           *linked_list,
 	u8                      **output_buffer,
 	u32                     *bytes_consumed)
 {
@@ -499,8 +484,7 @@
 	 */
 	for (index = 0;
 		 index < linked_list->data.dma.number_of_channels;
-		 index++)
-	{
+		 index++) {
 		temp16 = (u16) linked_list->data.dma.channels[index];
 		temp8 |= 0x1 << temp16;
 	}
@@ -521,9 +505,7 @@
 	/*
 	 * Return the number of bytes consumed in this operation
 	 */
-	*bytes_consumed = (u32) ((NATIVE_UINT) buffer -
-			   (NATIVE_UINT) *output_buffer);
-
+	*bytes_consumed = POINTER_DIFF (buffer, *output_buffer);
 	return (AE_OK);
 }
 
diff -urN linux-2.4.6-pre4/drivers/acpi/resources/rsirq.c linux/drivers/acpi/resources/rsirq.c
--- linux-2.4.6-pre4/drivers/acpi/resources/rsirq.c	Mon Jan 22 13:23:43 2001
+++ linux/drivers/acpi/resources/rsirq.c	Mon Dec  3 22:48:42 2001
@@ -1,10 +1,7 @@
 /*******************************************************************************
  *
- * Module Name: rsirq - Acpi_rs_irq_resource,
- *                      Acpi_rs_irq_stream
- *                      Acpi_rs_extended_irq_resource
- *                      Acpi_rs_extended_irq_stream
- *              $Revision: 13 $
+ * Module Name: rsirq - IRQ resource descriptors
+ *              $Revision: 17 $
  *
  ******************************************************************************/
 
@@ -30,7 +27,7 @@
 #include "acpi.h"
 #include "acresrc.h"
 
-#define _COMPONENT          RESOURCE_MANAGER
+#define _COMPONENT          ACPI_RESOURCES
 	 MODULE_NAME         ("rsirq")
 
 
@@ -39,20 +36,20 @@
  * FUNCTION:    Acpi_rs_irq_resource
  *
  * PARAMETERS:  Byte_stream_buffer      - Pointer to the resource input byte
- *                                          stream
+ *                                        stream
  *              Bytes_consumed          - u32 pointer that is filled with
- *                                          the number of bytes consumed from
- *                                          the Byte_stream_buffer
+ *                                        the number of bytes consumed from
+ *                                        the Byte_stream_buffer
  *              Output_buffer           - Pointer to the user's return buffer
  *              Structure_size          - u32 pointer that is filled with
- *                                          the number of bytes in the filled
- *                                          in structure
+ *                                        the number of bytes in the filled
+ *                                        in structure
  *
- * RETURN:      Status  AE_OK if okay, else a valid ACPI_STATUS code
+ * RETURN:      Status
  *
  * DESCRIPTION: Take the resource byte stream and fill out the appropriate
- *                  structure pointed to by the Output_buffer. Return the
- *                  number of bytes consumed from the byte stream.
+ *              structure pointed to by the Output_buffer. Return the
+ *              number of bytes consumed from the byte stream.
  *
  ******************************************************************************/
 
@@ -64,13 +61,12 @@
 	u32                     *structure_size)
 {
 	u8                      *buffer = byte_stream_buffer;
-	RESOURCE                *output_struct = (RESOURCE *) * output_buffer;
+	ACPI_RESOURCE           *output_struct = (ACPI_RESOURCE *) *output_buffer;
 	u16                     temp16 = 0;
 	u8                      temp8 = 0;
 	u8                      index;
 	u8                      i;
-	u32                     struct_size = sizeof (IRQ_RESOURCE) +
-			  RESOURCE_LENGTH_NO_DATA;
+	u32                     struct_size = SIZEOF_RESOURCE (ACPI_RESOURCE_IRQ);
 
 
 	/*
@@ -79,7 +75,7 @@
 	 */
 	temp8 = *buffer;
 	*bytes_consumed = (temp8 & 0x03) + 1;
-	output_struct->id = irq;
+	output_struct->id = ACPI_RSTYPE_IRQ;
 
 	/*
 	 * Point to the 16-bits of Bytes 1 and 2
@@ -128,8 +124,8 @@
 			else {
 				/*
 				 * Only _LL and _HE polarity/trigger interrupts
-				 *  are allowed (ACPI spec v1.0b ection 6.4.2.1),
-				 *  so an error will occur if we reach this point
+				 * are allowed (ACPI spec v1.0b ection 6.4.2.1),
+				 * so an error will occur if we reach this point
 				 */
 				return (AE_BAD_DATA);
 			}
@@ -144,7 +140,7 @@
 	else {
 		/*
 		 * Assume Edge Sensitive, Active High, Non-Sharable
-		 *  per ACPI Specification
+		 * per ACPI Specification
 		 */
 		output_struct->data.irq.edge_level = EDGE_SENSITIVE;
 		output_struct->data.irq.active_high_low = ACTIVE_HIGH;
@@ -160,7 +156,6 @@
 	 * Return the final size of the structure
 	 */
 	*structure_size = struct_size;
-
 	return (AE_OK);
 }
 
@@ -172,19 +167,19 @@
  * PARAMETERS:  Linked_list             - Pointer to the resource linked list
  *              Output_buffer           - Pointer to the user's return buffer
  *              Bytes_consumed          - u32 pointer that is filled with
- *                                          the number of bytes of the
- *                                          Output_buffer used
+ *                                        the number of bytes of the
+ *                                        Output_buffer used
  *
- * RETURN:      Status  AE_OK if okay, else a valid ACPI_STATUS code
+ * RETURN:      Status
  *
  * DESCRIPTION: Take the linked list resource structure and fills in the
- *                  the appropriate bytes in a byte stream
+ *              the appropriate bytes in a byte stream
  *
  ******************************************************************************/
 
 ACPI_STATUS
 acpi_rs_irq_stream (
-	RESOURCE                *linked_list,
+	ACPI_RESOURCE           *linked_list,
 	u8                      **output_buffer,
 	u32                     *bytes_consumed)
 {
@@ -197,15 +192,15 @@
 
 	/*
 	 * The descriptor field is set based upon whether a third byte is
-	 *  needed to contain the IRQ Information.
+	 * needed to contain the IRQ Information.
 	 */
 	if (EDGE_SENSITIVE == linked_list->data.irq.edge_level &&
 		ACTIVE_HIGH == linked_list->data.irq.active_high_low &&
-		EXCLUSIVE == linked_list->data.irq.shared_exclusive)
-	{
+		EXCLUSIVE == linked_list->data.irq.shared_exclusive) {
 		*buffer = 0x22;
 		IRQinfo_byte_needed = FALSE;
 	}
+
 	else {
 		*buffer = 0x23;
 		IRQinfo_byte_needed = TRUE;
@@ -219,8 +214,7 @@
 	 */
 	for(index = 0;
 		index < linked_list->data.irq.number_of_interrupts;
-		index++)
-	{
+		index++) {
 		temp8 = (u8) linked_list->data.irq.interrupts[index];
 		temp16 |= 0x1 << temp8;
 	}
@@ -237,8 +231,7 @@
 				 0x01) << 4);
 
 		if (LEVEL_SENSITIVE == linked_list->data.irq.edge_level &&
-			ACTIVE_LOW == linked_list->data.irq.active_high_low)
-		{
+			ACTIVE_LOW == linked_list->data.irq.active_high_low) {
 			temp8 |= 0x08;
 		}
 
@@ -253,9 +246,7 @@
 	/*
 	 * Return the number of bytes consumed in this operation
 	 */
-	*bytes_consumed = (u32) ((NATIVE_UINT) buffer -
-			   (NATIVE_UINT) *output_buffer);
-
+	*bytes_consumed = POINTER_DIFF (buffer, *output_buffer);
 	return (AE_OK);
 }
 
@@ -265,20 +256,20 @@
  * FUNCTION:    Acpi_rs_extended_irq_resource
  *
  * PARAMETERS:  Byte_stream_buffer      - Pointer to the resource input byte
- *                                          stream
+ *                                        stream
  *              Bytes_consumed          - u32 pointer that is filled with
- *                                          the number of bytes consumed from
- *                                          the Byte_stream_buffer
+ *                                        the number of bytes consumed from
+ *                                        the Byte_stream_buffer
  *              Output_buffer           - Pointer to the user's return buffer
  *              Structure_size          - u32 pointer that is filled with
- *                                          the number of bytes in the filled
- *                                          in structure
+ *                                        the number of bytes in the filled
+ *                                        in structure
  *
- * RETURN:      Status  AE_OK if okay, else a valid ACPI_STATUS code
+ * RETURN:      Status
  *
  * DESCRIPTION: Take the resource byte stream and fill out the appropriate
- *                  structure pointed to by the Output_buffer. Return the
- *                  number of bytes consumed from the byte stream.
+ *              structure pointed to by the Output_buffer. Return the
+ *              number of bytes consumed from the byte stream.
  *
  ******************************************************************************/
 
@@ -290,12 +281,12 @@
 	u32                     *structure_size)
 {
 	u8                      *buffer = byte_stream_buffer;
-	RESOURCE                *output_struct = (RESOURCE *) * output_buffer;
+	ACPI_RESOURCE           *output_struct = (ACPI_RESOURCE *) *output_buffer;
 	u16                     temp16 = 0;
 	u8                      temp8 = 0;
+	NATIVE_CHAR             *temp_ptr;
 	u8                      index;
-	u32                     struct_size = sizeof (EXTENDED_IRQ_RESOURCE) +
-			  RESOURCE_LENGTH_NO_DATA;
+	u32                     struct_size = SIZEOF_RESOURCE (ACPI_RESOURCE_EXT_IRQ);
 
 
 	/*
@@ -305,7 +296,7 @@
 	MOVE_UNALIGNED16_TO_16 (&temp16, buffer);
 
 	*bytes_consumed = temp16 + 3;
-	output_struct->id = extended_irq;
+	output_struct->id = ACPI_RSTYPE_EXT_IRQ;
 
 	/*
 	 * Point to the Byte3
@@ -332,8 +323,8 @@
 		else {
 			/*
 			 * Only _LL and _HE polarity/trigger interrupts
-			 *  are allowed (ACPI spec v1.0b ection 6.4.2.1),
-			 *  so an error will occur if we reach this point
+			 * are allowed (ACPI spec v1.0b ection 6.4.2.1),
+			 * so an error will occur if we reach this point
 			 */
 			return (AE_BAD_DATA);
 		}
@@ -342,8 +333,7 @@
 	/*
 	 * Check for sharable
 	 */
-	output_struct->data.extended_irq.shared_exclusive =
-			(temp8 >> 3) & 0x01;
+	output_struct->data.extended_irq.shared_exclusive = (temp8 >> 3) & 0x01;
 
 	/*
 	 * Point to Byte4 (IRQ Table length)
@@ -355,9 +345,9 @@
 
 	/*
 	 * Add any additional structure size to properly calculate
-	 *  the next pointer at the end of this function
+	 * the next pointer at the end of this function
 	 */
-	 struct_size += (temp8 - 1) * 4;
+	struct_size += (temp8 - 1) * 4;
 
 	/*
 	 * Point to Byte5 (First IRQ Number)
@@ -378,33 +368,38 @@
 
 	/*
 	 * This will leave us pointing to the Resource Source Index
-	 *  If it is present, then save it off and calculate the
-	 *  pointer to where the null terminated string goes:
-	 *  Each Interrupt takes 32-bits + the 5 bytes of the
-	 *  stream that are default.
+	 * If it is present, then save it off and calculate the
+	 * pointer to where the null terminated string goes:
+	 * Each Interrupt takes 32-bits + the 5 bytes of the
+	 * stream that are default.
 	 */
 	if (*bytes_consumed >
-		(u32)(output_struct->data.extended_irq.number_of_interrupts *
-		 4) + 5)
-	{
+		(u32)(output_struct->data.extended_irq.number_of_interrupts * 4) + 5) {
 		/* Dereference the Index */
 
 		temp8 = *buffer;
-		output_struct->data.extended_irq.resource_source_index =
-				(u32)temp8;
+		output_struct->data.extended_irq.resource_source.index = (u32) temp8;
 
 		/* Point to the String */
 
 		buffer += 1;
 
+		/*
+		 * Point the String pointer to the end of this structure.
+		 */
+		output_struct->data.extended_irq.resource_source.string_ptr =
+				(NATIVE_CHAR *)(output_struct + struct_size);
+
+		temp_ptr = output_struct->data.extended_irq.resource_source.string_ptr;
+
 		/* Copy the string into the buffer */
 
 		index = 0;
 
 		while (0x00 != *buffer) {
-			output_struct->data.extended_irq.resource_source[index] =
-					*buffer;
+			*temp_ptr = *buffer;
 
+			temp_ptr += 1;
 			buffer += 1;
 			index += 1;
 		}
@@ -412,23 +407,22 @@
 		/*
 		 * Add the terminating null
 		 */
-		output_struct->data.extended_irq.resource_source[index] = 0x00;
-		output_struct->data.extended_irq.resource_source_string_length =
-				index + 1;
+		*temp_ptr = 0x00;
+		output_struct->data.extended_irq.resource_source.string_length = index + 1;
 
 		/*
-		 * In order for the Struct_size to fall on a 32-bit boundry,
-		 *  calculate the length of the string and expand the
-		 *  Struct_size to the next 32-bit boundry.
+		 * In order for the Struct_size to fall on a 32-bit boundary,
+		 * calculate the length of the string and expand the
+		 * Struct_size to the next 32-bit boundary.
 		 */
 		temp8 = (u8) (index + 1);
-		temp8 = (u8) ROUND_UP_TO_32_bITS (temp8);
+		struct_size += ROUND_UP_TO_32_bITS (temp8);
 	}
 
 	else {
-		output_struct->data.extended_irq.resource_source_index = 0x00;
-		output_struct->data.extended_irq.resource_source_string_length = 0;
-		output_struct->data.extended_irq.resource_source[0] = 0x00;
+		output_struct->data.extended_irq.resource_source.index = 0x00;
+		output_struct->data.extended_irq.resource_source.string_length = 0;
+		output_struct->data.extended_irq.resource_source.string_ptr = NULL;
 	}
 
 	/*
@@ -440,7 +434,6 @@
 	 * Return the final size of the structure
 	 */
 	*structure_size = struct_size;
-
 	return (AE_OK);
 }
 
@@ -452,10 +445,10 @@
  * PARAMETERS:  Linked_list             - Pointer to the resource linked list
  *              Output_buffer           - Pointer to the user's return buffer
  *              Bytes_consumed          - u32 pointer that is filled with
- *                                          the number of bytes of the
- *                                          Output_buffer used
+ *                                        the number of bytes of the
+ *                                        Output_buffer used
  *
- * RETURN:      Status  AE_OK if okay, else a valid ACPI_STATUS code
+ * RETURN:      Status
  *
  * DESCRIPTION: Take the linked list resource structure and fills in the
  *              the appropriate bytes in a byte stream
@@ -464,7 +457,7 @@
 
 ACPI_STATUS
 acpi_rs_extended_irq_stream (
-	RESOURCE                *linked_list,
+	ACPI_RESOURCE           *linked_list,
 	u8                      **output_buffer,
 	u32                     *bytes_consumed)
 {
@@ -484,7 +477,6 @@
 	/*
 	 * Set a pointer to the Length field - to be filled in later
 	 */
-
 	length_field = (u16 *)buffer;
 	buffer += 2;
 
@@ -492,12 +484,10 @@
 	 * Set the Interrupt vector flags
 	 */
 	temp8 = (u8)(linked_list->data.extended_irq.producer_consumer & 0x01);
-
 	temp8 |= ((linked_list->data.extended_irq.shared_exclusive & 0x01) << 3);
 
 	if (LEVEL_SENSITIVE == linked_list->data.extended_irq.edge_level &&
-	   ACTIVE_LOW == linked_list->data.extended_irq.active_high_low)
-	{
+	   ACTIVE_LOW == linked_list->data.extended_irq.active_high_low) {
 		temp8 |= 0x04;
 	}
 	else {
@@ -515,10 +505,8 @@
 	*buffer = temp8;
 	buffer += 1;
 
-	for (index = 0;
-		 index < linked_list->data.extended_irq.number_of_interrupts;
-		 index++)
-	{
+	for (index = 0; index < linked_list->data.extended_irq.number_of_interrupts;
+		 index++) {
 		MOVE_UNALIGNED32_TO_32 (buffer,
 				  &linked_list->data.extended_irq.interrupts[index]);
 		buffer += 4;
@@ -527,8 +515,8 @@
 	/*
 	 * Resource Source Index and Resource Source are optional
 	 */
-	if (0 != linked_list->data.extended_irq.resource_source_string_length) {
-		*buffer = (u8) linked_list->data.extended_irq.resource_source_index;
+	if (0 != linked_list->data.extended_irq.resource_source.string_length) {
+		*buffer = (u8) linked_list->data.extended_irq.resource_source.index;
 		buffer += 1;
 
 		temp_pointer = (NATIVE_CHAR *) buffer;
@@ -536,27 +524,26 @@
 		/*
 		 * Copy the string
 		 */
-		STRCPY (temp_pointer, linked_list->data.extended_irq.resource_source);
+		STRCPY (temp_pointer,
+			linked_list->data.extended_irq.resource_source.string_ptr);
 
 		/*
 		 * Buffer needs to be set to the length of the sting + one for the
-		 *  terminating null
+		 * terminating null
 		 */
-		buffer += (STRLEN (linked_list->data.extended_irq.resource_source) + 1);
+		buffer += (STRLEN (linked_list->data.extended_irq.resource_source.string_ptr) + 1);
 	}
 
 	/*
 	 * Return the number of bytes consumed in this operation
 	 */
-	*bytes_consumed = (u32) ((NATIVE_UINT) buffer -
-			   (NATIVE_UINT) *output_buffer);
+	*bytes_consumed = POINTER_DIFF (buffer, *output_buffer);
 
 	/*
 	 * Set the length field to the number of bytes consumed
-	 *  minus the header size (3 bytes)
+	 * minus the header size (3 bytes)
 	 */
 	*length_field = (u16) (*bytes_consumed - 3);
-
 	return (AE_OK);
 }
 
diff -urN linux-2.4.6-pre4/drivers/acpi/resources/rslist.c linux/drivers/acpi/resources/rslist.c
--- linux-2.4.6-pre4/drivers/acpi/resources/rslist.c	Fri Feb  9 11:45:58 2001
+++ linux/drivers/acpi/resources/rslist.c	Mon Dec  3 22:48:42 2001
@@ -1,8 +1,7 @@
 /*******************************************************************************
  *
- * Module Name: rslist - Acpi_rs_byte_stream_to_list
- *                       Acpi_list_to_byte_stream
- *              $Revision: 11 $
+ * Module Name: rslist - Linked list utilities
+ *              $Revision: 17 $
  *
  ******************************************************************************/
 
@@ -28,20 +27,64 @@
 #include "acpi.h"
 #include "acresrc.h"
 
-#define _COMPONENT          RESOURCE_MANAGER
+#define _COMPONENT          ACPI_RESOURCES
 	 MODULE_NAME         ("rslist")
 
 
 /*******************************************************************************
  *
+ * FUNCTION:    Acpi_rs_get_resource_type
+ *
+ * PARAMETERS:  Resource_start_byte     - Byte 0 of a resource descriptor
+ *
+ * RETURN:      The Resource Type (Name) with no extraneous bits
+ *
+ * DESCRIPTION: Extract the Resource Type/Name from the first byte of
+ *              a resource descriptor.
+ *
+ ******************************************************************************/
+
+u8
+acpi_rs_get_resource_type (
+	u8                      resource_start_byte)
+{
+
+	/*
+	 * Determine if this is a small or large resource
+	 */
+	switch (resource_start_byte & RESOURCE_DESC_TYPE_MASK) {
+	case RESOURCE_DESC_TYPE_SMALL:
+
+		/*
+		 * Small Resource Type -- Only bits 6:3 are valid
+		 */
+		return ((u8) (resource_start_byte & RESOURCE_DESC_SMALL_MASK));
+		break;
+
+
+	case RESOURCE_DESC_TYPE_LARGE:
+
+		/*
+		 * Large Resource Type -- All bits are valid
+		 */
+		return (resource_start_byte);
+		break;
+	}
+
+	return (0xFF);
+}
+
+
+/*******************************************************************************
+ *
  * FUNCTION:    Acpi_rs_byte_stream_to_list
  *
  * PARAMETERS:  Byte_stream_buffer      - Pointer to the resource byte stream
  *              Byte_stream_buffer_length - Length of Byte_stream_buffer
  *              Output_buffer           - Pointer to the buffer that will
- *                                          contain the output structures
+ *                                        contain the output structures
  *
- * RETURN:      Status  AE_OK if okay, else a valid ACPI_STATUS code
+ * RETURN:      Status
  *
  * DESCRIPTION: Takes the resource byte stream and parses it, creating a
  *              linked list of resources in the caller's output buffer
@@ -64,223 +107,170 @@
 
 
 	while (bytes_parsed < byte_stream_buffer_length &&
-			FALSE == end_tag_processed)
-	{
+			FALSE == end_tag_processed) {
 		/*
-		 * Look at the next byte in the stream
+		 * The next byte in the stream is the resource type
 		 */
-		resource_type = *byte_stream_buffer;
+		resource_type = acpi_rs_get_resource_type (*byte_stream_buffer);
 
-		/*
-		 * See if this is a small or large resource
-		 */
-		if(resource_type & 0x80) {
+		switch (resource_type) {
+		case RESOURCE_DESC_MEMORY_24:
 			/*
-			 * Large Resource Type
+			 * 24-Bit Memory Resource
 			 */
-			switch (resource_type)
-			{
-			case MEMORY_RANGE_24:
-				/*
-				 * 24-Bit Memory Resource
-				 */
-				status = acpi_rs_memory24_resource(byte_stream_buffer,
-						   &bytes_consumed,
-						   buffer,
-						   &structure_size);
-
-				break;
-
-			case LARGE_VENDOR_DEFINED:
-				/*
-				 * Vendor Defined Resource
-				 */
-				status = acpi_rs_vendor_resource(byte_stream_buffer,
-						 &bytes_consumed,
-						 buffer,
-						 &structure_size);
-
-				break;
-
-			case MEMORY_RANGE_32:
-				/*
-				 * 32-Bit Memory Range Resource
-				 */
-				status = acpi_rs_memory32_range_resource(byte_stream_buffer,
-						  &bytes_consumed,
-						  buffer,
-						  &structure_size);
-
-				break;
-
-			case FIXED_MEMORY_RANGE_32:
-				/*
-				 * 32-Bit Fixed Memory Resource
-				 */
-				status = acpi_rs_fixed_memory32_resource(byte_stream_buffer,
-						  &bytes_consumed,
-						  buffer,
-						  &structure_size);
-
-				break;
-
-			case DWORD_ADDRESS_SPACE:
-				/*
-				 * 32-Bit Address Resource
-				 */
-				status = acpi_rs_address32_resource(byte_stream_buffer,
-						 &bytes_consumed,
-						 buffer,
-						 &structure_size);
-
-				break;
-
-			case WORD_ADDRESS_SPACE:
-				/*
-				 * 16-Bit Address Resource
-				 */
-				status = acpi_rs_address16_resource(byte_stream_buffer,
-						 &bytes_consumed,
-						 buffer,
-						 &structure_size);
-
-				break;
-
-			case EXTENDED_IRQ:
-				/*
-				 * Extended IRQ
-				 */
-				status = acpi_rs_extended_irq_resource(byte_stream_buffer,
-						   &bytes_consumed,
-						   buffer,
-						   &structure_size);
+			status = acpi_rs_memory24_resource (byte_stream_buffer,
+					 &bytes_consumed, buffer, &structure_size);
+			break;
 
-				break;
 
-/* TBD: [Future] 64-bit not currently supported */
-/*
-			case 0x8A:
-				break;
-*/
-
-			default:
-				/*
-				 * If we get here, everything is out of sync,
-				 *  so exit with an error
-				 */
-				return (AE_AML_ERROR);
-				break;
-			}
-		}
+		case RESOURCE_DESC_LARGE_VENDOR:
+			/*
+			 * Vendor Defined Resource
+			 */
+			status = acpi_rs_vendor_resource (byte_stream_buffer,
+					 &bytes_consumed, buffer, &structure_size);
+			break;
+
+
+		case RESOURCE_DESC_MEMORY_32:
+			/*
+			 * 32-Bit Memory Range Resource
+			 */
+			status = acpi_rs_memory32_range_resource (byte_stream_buffer,
+					 &bytes_consumed, buffer, &structure_size);
+			break;
+
+
+		case RESOURCE_DESC_FIXED_MEMORY_32:
+			/*
+			 * 32-Bit Fixed Memory Resource
+			 */
+			status = acpi_rs_fixed_memory32_resource (byte_stream_buffer,
+					 &bytes_consumed, buffer, &structure_size);
+			break;
+
+
+		case RESOURCE_DESC_QWORD_ADDRESS_SPACE:
+			/*
+			 * 64-Bit Address Resource
+			 */
+			status = acpi_rs_address64_resource (byte_stream_buffer,
+					 &bytes_consumed, buffer, &structure_size);
+			break;
+
+
+		case RESOURCE_DESC_DWORD_ADDRESS_SPACE:
+			/*
+			 * 32-Bit Address Resource
+			 */
+			status = acpi_rs_address32_resource (byte_stream_buffer,
+					 &bytes_consumed, buffer, &structure_size);
+			break;
+
+
+		case RESOURCE_DESC_WORD_ADDRESS_SPACE:
+			/*
+			 * 16-Bit Address Resource
+			 */
+			status = acpi_rs_address16_resource (byte_stream_buffer,
+					 &bytes_consumed, buffer, &structure_size);
+			break;
+
+
+		case RESOURCE_DESC_EXTENDED_XRUPT:
+			/*
+			 * Extended IRQ
+			 */
+			status = acpi_rs_extended_irq_resource (byte_stream_buffer,
+					 &bytes_consumed, buffer, &structure_size);
+			break;
+
+
+		case RESOURCE_DESC_IRQ_FORMAT:
+			/*
+			 * IRQ Resource
+			 */
+			status = acpi_rs_irq_resource (byte_stream_buffer,
+					 &bytes_consumed, buffer, &structure_size);
+			break;
+
+
+		case RESOURCE_DESC_DMA_FORMAT:
+			/*
+			 * DMA Resource
+			 */
+			status = acpi_rs_dma_resource (byte_stream_buffer,
+					 &bytes_consumed, buffer, &structure_size);
+			break;
+
+
+		case RESOURCE_DESC_START_DEPENDENT:
+			/*
+			 * Start Dependent Functions Resource
+			 */
+			status = acpi_rs_start_dependent_functions_resource (byte_stream_buffer,
+					 &bytes_consumed, buffer, &structure_size);
+			break;
+
+
+		case RESOURCE_DESC_END_DEPENDENT:
+			/*
+			 * End Dependent Functions Resource
+			 */
+			status = acpi_rs_end_dependent_functions_resource (byte_stream_buffer,
+					 &bytes_consumed, buffer, &structure_size);
+			break;
+
+
+		case RESOURCE_DESC_IO_PORT:
+			/*
+			 * IO Port Resource
+			 */
+			status = acpi_rs_io_resource (byte_stream_buffer,
+					 &bytes_consumed, buffer, &structure_size);
+			break;
+
+
+		case RESOURCE_DESC_FIXED_IO_PORT:
+			/*
+			 * Fixed IO Port Resource
+			 */
+			status = acpi_rs_fixed_io_resource (byte_stream_buffer,
+					 &bytes_consumed, buffer, &structure_size);
+			break;
+
 
-		else {
+		case RESOURCE_DESC_SMALL_VENDOR:
 			/*
-			 * Small Resource Type
-			 *  Only bits 7:3 are valid
+			 * Vendor Specific Resource
 			 */
-			resource_type >>= 3;
+			status = acpi_rs_vendor_resource (byte_stream_buffer,
+					 &bytes_consumed, buffer, &structure_size);
+			break;
 
-			switch(resource_type)
-			{
-			case IRQ_FORMAT:
-				/*
-				 * IRQ Resource
-				 */
-				status = acpi_rs_irq_resource(byte_stream_buffer,
-						 &bytes_consumed,
-						 buffer,
-						 &structure_size);
-
-				break;
-
-			case DMA_FORMAT:
-				/*
-				 * DMA Resource
-				 */
-				status = acpi_rs_dma_resource(byte_stream_buffer,
-						 &bytes_consumed,
-						 buffer,
-						 &structure_size);
-
-				break;
-
-			case START_DEPENDENT_TAG:
-				/*
-				 * Start Dependent Functions Resource
-				 */
-				status = acpi_rs_start_dependent_functions_resource(byte_stream_buffer,
-						   &bytes_consumed,
-						   buffer,
-						   &structure_size);
-
-				break;
-
-			case END_DEPENDENT_TAG:
-				/*
-				 * End Dependent Functions Resource
-				 */
-				status = acpi_rs_end_dependent_functions_resource(byte_stream_buffer,
-						 &bytes_consumed,
-						 buffer,
-						 &structure_size);
-
-				break;
-
-			case IO_PORT_DESCRIPTOR:
-				/*
-				 * IO Port Resource
-				 */
-				status = acpi_rs_io_resource(byte_stream_buffer,
-						   &bytes_consumed,
-						   buffer,
-						   &structure_size);
-
-				break;
-
-			case FIXED_LOCATION_IO_DESCRIPTOR:
-				/*
-				 * Fixed IO Port Resource
-				 */
-				status = acpi_rs_fixed_io_resource(byte_stream_buffer,
-						  &bytes_consumed,
-						  buffer,
-						  &structure_size);
-
-				break;
-
-			case SMALL_VENDOR_DEFINED:
-				/*
-				 * Vendor Specific Resource
-				 */
-				status = acpi_rs_vendor_resource(byte_stream_buffer,
-						 &bytes_consumed,
-						 buffer,
-						 &structure_size);
-
-				break;
-
-			case END_TAG:
-				/*
-				 * End Tag
-				 */
-				status = acpi_rs_end_tag_resource(byte_stream_buffer,
-						 &bytes_consumed,
-						 buffer,
-						 &structure_size);
-				end_tag_processed = TRUE;
-
-				break;
-
-			default:
-				/*
-				 * If we get here, everything is out of sync,
-				 *  so exit with an error
-				 */
-				return (AE_AML_ERROR);
-				break;
 
-			} /* switch */
-		}  /* end else */
+		case RESOURCE_DESC_END_TAG:
+			/*
+			 * End Tag
+			 */
+			end_tag_processed = TRUE;
+			status = acpi_rs_end_tag_resource (byte_stream_buffer,
+					 &bytes_consumed, buffer, &structure_size);
+			break;
+
+
+		default:
+			/*
+			 * Invalid/Unknowns resource type
+			 */
+			status = AE_AML_ERROR;
+			break;
+		}
+
+
+		if (!ACPI_SUCCESS(status)) {
+			return (status);
+		}
 
 		/*
 		 * Update the return value and counter
@@ -316,15 +306,15 @@
  *
  * PARAMETERS:  Linked_list             - Pointer to the resource linked list
  *              Byte_steam_size_needed  - Calculated size of the byte stream
- *                                          needed from calling
- *                                          Acpi_rs_calculate_byte_stream_length()
- *                                          The size of the Output_buffer is
- *                                          guaranteed to be >=
- *                                          Byte_stream_size_needed
+ *                                        needed from calling
+ *                                        Acpi_rs_calculate_byte_stream_length()
+ *                                        The size of the Output_buffer is
+ *                                        guaranteed to be >=
+ *                                        Byte_stream_size_needed
  *              Output_buffer           - Pointer to the buffer that will
- *                                          contain the byte stream
+ *                                        contain the byte stream
  *
- * RETURN:      Status  AE_OK if okay, else a valid ACPI_STATUS code
+ * RETURN:      Status
  *
  * DESCRIPTION: Takes the resource linked list and parses it, creating a
  *              byte stream of resources in the caller's output buffer
@@ -333,7 +323,7 @@
 
 ACPI_STATUS
 acpi_rs_list_to_byte_stream (
-	RESOURCE                *linked_list,
+	ACPI_RESOURCE           *linked_list,
 	u32                     byte_stream_size_needed,
 	u8                      **output_buffer)
 {
@@ -344,78 +334,63 @@
 
 
 	while (!done) {
-		switch (linked_list->id)
-		{
-		case irq:
+		switch (linked_list->id) {
+		case ACPI_RSTYPE_IRQ:
 			/*
 			 * IRQ Resource
 			 */
-			status = acpi_rs_irq_stream (linked_list,
-					   &buffer,
-					   &bytes_consumed);
+			status = acpi_rs_irq_stream (linked_list, &buffer, &bytes_consumed);
 			break;
 
-		case dma:
+		case ACPI_RSTYPE_DMA:
 			/*
 			 * DMA Resource
 			 */
-			status = acpi_rs_dma_stream (linked_list,
-					   &buffer,
-					   &bytes_consumed);
+			status = acpi_rs_dma_stream (linked_list, &buffer, &bytes_consumed);
 			break;
 
-		case start_dependent_functions:
+		case ACPI_RSTYPE_START_DPF:
 			/*
 			 * Start Dependent Functions Resource
 			 */
 			status = acpi_rs_start_dependent_functions_stream (linked_list,
-					  &buffer,
-					  &bytes_consumed);
+					  &buffer, &bytes_consumed);
 			break;
 
-		case end_dependent_functions:
+		case ACPI_RSTYPE_END_DPF:
 			/*
 			 * End Dependent Functions Resource
 			 */
 			status = acpi_rs_end_dependent_functions_stream (linked_list,
-					   &buffer,
-					   &bytes_consumed);
+					  &buffer, &bytes_consumed);
 			break;
 
-		case io:
+		case ACPI_RSTYPE_IO:
 			/*
 			 * IO Port Resource
 			 */
-			status = acpi_rs_io_stream (linked_list,
-					  &buffer,
-					  &bytes_consumed);
+			status = acpi_rs_io_stream (linked_list, &buffer, &bytes_consumed);
 			break;
 
-		case fixed_io:
+		case ACPI_RSTYPE_FIXED_IO:
 			/*
 			 * Fixed IO Port Resource
 			 */
-			status = acpi_rs_fixed_io_stream (linked_list,
-					 &buffer,
-					 &bytes_consumed);
+			status = acpi_rs_fixed_io_stream (linked_list, &buffer, &bytes_consumed);
 			break;
 
-		case vendor_specific:
+		case ACPI_RSTYPE_VENDOR:
 			/*
 			 * Vendor Defined Resource
 			 */
-			status = acpi_rs_vendor_stream (linked_list,
-					   &buffer,
-					   &bytes_consumed);
+			status = acpi_rs_vendor_stream (linked_list, &buffer, &bytes_consumed);
 			break;
 
-		case end_tag:
+		case ACPI_RSTYPE_END_TAG:
 			/*
 			 * End Tag
 			 */
-			status = acpi_rs_end_tag_stream (linked_list,
-					   &buffer,
-					   &bytes_consumed);
+			status = acpi_rs_end_tag_stream (linked_list, &buffer, &bytes_consumed);
 
 			/*
 			 * An End Tag indicates the end of the Resource Template
@@ -423,58 +398,59 @@
 			done = TRUE;
 			break;
 
-		case memory24:
+		case ACPI_RSTYPE_MEM24:
 			/*
 			 * 24-Bit Memory Resource
 			 */
-			status = acpi_rs_memory24_stream (linked_list,
-					  &buffer,
-					  &bytes_consumed);
+			status = acpi_rs_memory24_stream (linked_list, &buffer, &bytes_consumed);
 			break;
 
-		case memory32:
+		case ACPI_RSTYPE_MEM32:
 			/*
 			 * 32-Bit Memory Range Resource
 			 */
-			status = acpi_rs_memory32_range_stream (linked_list,
-					 &buffer,
+			status = acpi_rs_memory32_range_stream (linked_list, &buffer,
 					 &bytes_consumed);
 			break;
 
-		case fixed_memory32:
+		case ACPI_RSTYPE_FIXED_MEM32:
 			/*
 			 * 32-Bit Fixed Memory Resource
 			 */
-			status = acpi_rs_fixed_memory32_stream (linked_list,
-					 &buffer,
+			status = acpi_rs_fixed_memory32_stream (linked_list, &buffer,
 					 &bytes_consumed);
 			break;
 
-		case address16:
+		case ACPI_RSTYPE_ADDRESS16:
 			/*
 			 * 16-Bit Address Descriptor Resource
 			 */
-			status = acpi_rs_address16_stream (linked_list,
-					   &buffer,
-					   &bytes_consumed);
+			status = acpi_rs_address16_stream (linked_list, &buffer,
+					 &bytes_consumed);
 			break;
 
-		case address32:
+		case ACPI_RSTYPE_ADDRESS32:
 			/*
 			 * 32-Bit Address Descriptor Resource
 			 */
-			status = acpi_rs_address32_stream (linked_list,
-					   &buffer,
-					   &bytes_consumed);
+			status = acpi_rs_address32_stream (linked_list, &buffer,
+					 &bytes_consumed);
+			break;
+
+		case ACPI_RSTYPE_ADDRESS64:
+			/*
+			 * 64-Bit Address Descriptor Resource
+			 */
+			status = acpi_rs_address64_stream (linked_list, &buffer,
+					 &bytes_consumed);
 			break;
 
-		case extended_irq:
+		case ACPI_RSTYPE_EXT_IRQ:
 			/*
 			 * Extended IRQ Resource
 			 */
-			status = acpi_rs_extended_irq_stream (linked_list,
-					  &buffer,
-					  &bytes_consumed);
+			status = acpi_rs_extended_irq_stream (linked_list, &buffer,
+					 &bytes_consumed);
 			break;
 
 		default:
@@ -482,11 +458,16 @@
 			 * If we get here, everything is out of sync,
 			 *  so exit with an error
 			 */
-			return (AE_BAD_DATA);
+			status = AE_BAD_DATA;
 			break;
 
 		} /* switch (Linked_list->Id) */
 
+
+		if (!ACPI_SUCCESS(status)) {
+			return (status);
+		}
+
 		/*
 		 * Set the Buffer to point to the open byte
 		 */
@@ -495,10 +476,10 @@
 		/*
 		 * Point to the next object
 		 */
-		linked_list = (RESOURCE *) ((NATIVE_UINT) linked_list +
-				  (NATIVE_UINT) linked_list->length);
+		linked_list = POINTER_ADD (ACPI_RESOURCE,
+				  linked_list, linked_list->length);
 	}
 
-	return  (AE_OK);
+	return (AE_OK);
 }
 
diff -urN linux-2.4.6-pre4/drivers/acpi/resources/rsmemory.c linux/drivers/acpi/resources/rsmemory.c
--- linux-2.4.6-pre4/drivers/acpi/resources/rsmemory.c	Mon Jan 22 13:23:43 2001
+++ linux/drivers/acpi/resources/rsmemory.c	Mon Dec  3 22:48:42 2001
@@ -1,12 +1,7 @@
 /*******************************************************************************
  *
- * Module Name: rsmem24 - Acpi_rs_memory24_resource
- *                        Acpi_rs_memory24_stream
- *                        Acpi_rs_memory32_range_resource
- *                        Acpi_rs_fixed_memory32_resource
- *                        Acpi_rs_memory32_range_stream
- *                        Acpi_rs_fixed_memory32_stream
- *              $Revision: 12 $
+ * Module Name: rsmem24 - Memory resource descriptors
+ *              $Revision: 14 $
  *
  ******************************************************************************/
 
@@ -32,7 +27,7 @@
 #include "acpi.h"
 #include "acresrc.h"
 
-#define _COMPONENT          RESOURCE_MANAGER
+#define _COMPONENT          ACPI_RESOURCES
 	 MODULE_NAME         ("rsmemory")
 
 
@@ -41,20 +36,20 @@
  * FUNCTION:    Acpi_rs_memory24_resource
  *
  * PARAMETERS:  Byte_stream_buffer      - Pointer to the resource input byte
- *                                          stream
+ *                                        stream
  *              Bytes_consumed          - u32 pointer that is filled with
- *                                          the number of bytes consumed from
- *                                          the Byte_stream_buffer
+ *                                        the number of bytes consumed from
+ *                                        the Byte_stream_buffer
  *              Output_buffer           - Pointer to the user's return buffer
  *              Structure_size          - u32 pointer that is filled with
- *                                          the number of bytes in the filled
- *                                          in structure
+ *                                        the number of bytes in the filled
+ *                                        in structure
  *
- * RETURN:      Status  AE_OK if okay, else a valid ACPI_STATUS code
+ * RETURN:      Status
  *
  * DESCRIPTION: Take the resource byte stream and fill out the appropriate
- *                  structure pointed to by the Output_buffer. Return the
- *                  number of bytes consumed from the byte stream.
+ *              structure pointed to by the Output_buffer. Return the
+ *              number of bytes consumed from the byte stream.
  *
  ******************************************************************************/
 
@@ -66,11 +61,10 @@
 	u32                     *structure_size)
 {
 	u8                      *buffer = byte_stream_buffer;
-	RESOURCE                *output_struct = (RESOURCE *) * output_buffer;
+	ACPI_RESOURCE           *output_struct = (ACPI_RESOURCE *) *output_buffer;
 	u16                     temp16 = 0;
 	u8                      temp8 = 0;
-	u32                     struct_size = sizeof (MEMORY24_RESOURCE) +
-			  RESOURCE_LENGTH_NO_DATA;
+	u32                     struct_size = SIZEOF_RESOURCE (ACPI_RESOURCE_MEM24);
 
 
 	/*
@@ -81,7 +75,7 @@
 	MOVE_UNALIGNED16_TO_16 (&temp16, buffer);
 	buffer += 2;
 	*bytes_consumed = temp16 + 3;
-	output_struct->id = memory24;
+	output_struct->id = ACPI_RSTYPE_MEM24;
 
 	/*
 	 * Check Byte 3 the Read/Write bit
@@ -126,7 +120,6 @@
 	 * Return the final size of the structure
 	 */
 	*structure_size = struct_size;
-
 	return (AE_OK);
 }
 
@@ -138,19 +131,19 @@
  * PARAMETERS:  Linked_list             - Pointer to the resource linked list
  *              Output_buffer           - Pointer to the user's return buffer
  *              Bytes_consumed          - u32 pointer that is filled with
- *                                          the number of bytes of the
- *                                          Output_buffer used
+ *                                        the number of bytes of the
+ *                                        Output_buffer used
  *
- * RETURN:      Status  AE_OK if okay, else a valid ACPI_STATUS code
+ * RETURN:      Status
  *
  * DESCRIPTION: Take the linked list resource structure and fills in the
- *                  the appropriate bytes in a byte stream
+ *              the appropriate bytes in a byte stream
  *
  ******************************************************************************/
 
 ACPI_STATUS
 acpi_rs_memory24_stream (
-	RESOURCE                *linked_list,
+	ACPI_RESOURCE           *linked_list,
 	u8                      **output_buffer,
 	u32                     *bytes_consumed)
 {
@@ -206,9 +199,7 @@
 	/*
 	 * Return the number of bytes consumed in this operation
 	 */
-	*bytes_consumed = (u32) ((NATIVE_UINT) buffer -
-			   (NATIVE_UINT) *output_buffer);
-
+	*bytes_consumed = POINTER_DIFF (buffer, *output_buffer);
 	return (AE_OK);
 }
 
@@ -218,20 +209,20 @@
  * FUNCTION:    Acpi_rs_memory32_range_resource
  *
  * PARAMETERS:  Byte_stream_buffer      - Pointer to the resource input byte
- *                                          stream
+ *                                        stream
  *              Bytes_consumed          - u32 pointer that is filled with
- *                                          the number of bytes consumed from
- *                                          the Byte_stream_buffer
+ *                                        the number of bytes consumed from
+ *                                        the Byte_stream_buffer
  *              Output_buffer           - Pointer to the user's return buffer
  *              Structure_size          - u32 pointer that is filled with
- *                                          the number of bytes in the filled
- *                                          in structure
+ *                                        the number of bytes in the filled
+ *                                        in structure
  *
- * RETURN:      Status  AE_OK if okay, else a valid ACPI_STATUS code
+ * RETURN:      Status
  *
  * DESCRIPTION: Take the resource byte stream and fill out the appropriate
- *                  structure pointed to by the Output_buffer. Return the
- *                  number of bytes consumed from the byte stream.
+ *              structure pointed to by the Output_buffer. Return the
+ *              number of bytes consumed from the byte stream.
  *
  ******************************************************************************/
 
@@ -243,11 +234,10 @@
 	u32                     *structure_size)
 {
 	u8                      *buffer = byte_stream_buffer;
-	RESOURCE                *output_struct = (RESOURCE *) * output_buffer;
+	ACPI_RESOURCE           *output_struct = (ACPI_RESOURCE *) *output_buffer;
 	u16                     temp16 = 0;
 	u8                      temp8 = 0;
-	u32                     struct_size = sizeof (MEMORY32_RESOURCE) +
-			  RESOURCE_LENGTH_NO_DATA;
+	u32                     struct_size = SIZEOF_RESOURCE (ACPI_RESOURCE_MEM32);
 
 
 	/*
@@ -259,11 +249,11 @@
 	buffer += 2;
 	*bytes_consumed = temp16 + 3;
 
-	output_struct->id = memory32;
+	output_struct->id = ACPI_RSTYPE_MEM32;
 
 	/*
 	 *  Point to the place in the output buffer where the data portion will
-	 *    begin.
+	 *  begin.
 	 *  1. Set the RESOURCE_DATA * Data to point to it's own address, then
 	 *  2. Set the pointer to the next address.
 	 *
@@ -313,7 +303,6 @@
 	 * Return the final size of the structure
 	 */
 	*structure_size = struct_size;
-
 	return (AE_OK);
 }
 
@@ -323,20 +312,20 @@
  * FUNCTION:    Acpi_rs_fixed_memory32_resource
  *
  * PARAMETERS:  Byte_stream_buffer      - Pointer to the resource input byte
- *                                          stream
+ *                                        stream
  *              Bytes_consumed          - u32 pointer that is filled with
- *                                          the number of bytes consumed from
- *                                          the Byte_stream_buffer
+ *                                        the number of bytes consumed from
+ *                                        the Byte_stream_buffer
  *              Output_buffer           - Pointer to the user's return buffer
  *              Structure_size          - u32 pointer that is filled with
- *                                          the number of bytes in the filled
- *                                          in structure
+ *                                        the number of bytes in the filled
+ *                                        in structure
  *
- * RETURN:      Status  AE_OK if okay, else a valid ACPI_STATUS code
+ * RETURN:      Status
  *
  * DESCRIPTION: Take the resource byte stream and fill out the appropriate
- *                  structure pointed to by the Output_buffer. Return the
- *                  number of bytes consumed from the byte stream.
+ *              structure pointed to by the Output_buffer. Return the
+ *              number of bytes consumed from the byte stream.
  *
  ******************************************************************************/
 
@@ -348,11 +337,10 @@
 	u32                     *structure_size)
 {
 	u8                      *buffer = byte_stream_buffer;
-	RESOURCE                *output_struct = (RESOURCE *) * output_buffer;
+	ACPI_RESOURCE           *output_struct = (ACPI_RESOURCE *) *output_buffer;
 	u16                     temp16 = 0;
 	u8                      temp8 = 0;
-	u32                     struct_size = sizeof (FIXED_MEMORY32_RESOURCE) +
-			  RESOURCE_LENGTH_NO_DATA;
+	u32                     struct_size = SIZEOF_RESOURCE (ACPI_RESOURCE_FIXED_MEM32);
 
 
 	/*
@@ -364,7 +352,7 @@
 	buffer += 2;
 	*bytes_consumed = temp16 + 3;
 
-	output_struct->id = fixed_memory32;
+	output_struct->id = ACPI_RSTYPE_FIXED_MEM32;
 
 	/*
 	 * Check Byte 3 the Read/Write bit
@@ -395,7 +383,6 @@
 	 * Return the final size of the structure
 	 */
 	*structure_size = struct_size;
-
 	return (AE_OK);
 }
 
@@ -407,19 +394,19 @@
  * PARAMETERS:  Linked_list             - Pointer to the resource linked list
  *              Output_buffer           - Pointer to the user's return buffer
  *              Bytes_consumed          - u32 pointer that is filled with
- *                                          the number of bytes of the
- *                                          Output_buffer used
+ *                                        the number of bytes of the
+ *                                        Output_buffer used
  *
- * RETURN:      Status  AE_OK if okay, else a valid ACPI_STATUS code
+ * RETURN:      Status
  *
  * DESCRIPTION: Take the linked list resource structure and fills in the
- *                  the appropriate bytes in a byte stream
+ *              the appropriate bytes in a byte stream
  *
  ******************************************************************************/
 
 ACPI_STATUS
 acpi_rs_memory32_range_stream (
-	RESOURCE                *linked_list,
+	ACPI_RESOURCE           *linked_list,
 	u8                      **output_buffer,
 	u32                     *bytes_consumed)
 {
@@ -476,9 +463,7 @@
 	/*
 	 * Return the number of bytes consumed in this operation
 	 */
-	*bytes_consumed = (u32) ((NATIVE_UINT) buffer -
-			   (NATIVE_UINT) *output_buffer);
-
+	*bytes_consumed = POINTER_DIFF (buffer, *output_buffer);
 	return (AE_OK);
 }
 
@@ -490,19 +475,19 @@
  * PARAMETERS:  Linked_list             - Pointer to the resource linked list
  *              Output_buffer           - Pointer to the user's return buffer
  *              Bytes_consumed          - u32 pointer that is filled with
- *                                          the number of bytes of the
- *                                          Output_buffer used
+ *                                        the number of bytes of the
+ *                                        Output_buffer used
  *
- * RETURN:      Status  AE_OK if okay, else a valid ACPI_STATUS code
+ * RETURN:      Status
  *
  * DESCRIPTION: Take the linked list resource structure and fills in the
- *                  the appropriate bytes in a byte stream
+ *              the appropriate bytes in a byte stream
  *
  ******************************************************************************/
 
 ACPI_STATUS
 acpi_rs_fixed_memory32_stream (
-	RESOURCE                *linked_list,
+	ACPI_RESOURCE           *linked_list,
 	u8                      **output_buffer,
 	u32                     *bytes_consumed)
 {
@@ -549,9 +534,7 @@
 	/*
 	 * Return the number of bytes consumed in this operation
 	 */
-	*bytes_consumed = (u32) ((NATIVE_UINT) buffer -
-			   (NATIVE_UINT) *output_buffer);
-
+	*bytes_consumed = POINTER_DIFF (buffer, *output_buffer);
 	return (AE_OK);
 }
 
diff -urN linux-2.4.6-pre4/drivers/acpi/resources/rsmisc.c linux/drivers/acpi/resources/rsmisc.c
--- linux-2.4.6-pre4/drivers/acpi/resources/rsmisc.c	Mon Jan 22 13:23:43 2001
+++ linux/drivers/acpi/resources/rsmisc.c	Mon Dec  3 22:48:42 2001
@@ -1,14 +1,7 @@
 /*******************************************************************************
  *
- * Module Name: rsmisc - Acpi_rs_end_tag_resource
- *                       Acpi_rs_end_tag_stream
- *                       Acpi_rs_vendor_resource
- *                       Acpi_rs_vendor_stream
- *                       Acpi_rs_start_dependent_functions_resource
- *                       Acpi_rs_end_dependent_functions_resource
- *                       Acpi_rs_start_dependent_functions_stream
- *                       Acpi_rs_end_dependent_functions_stream
- *              $Revision: 12 $
+ * Module Name: rsmisc - Miscellaneous resource descriptors
+ *              $Revision: 15 $
  *
  ******************************************************************************/
 
@@ -34,7 +27,7 @@
 #include "acpi.h"
 #include "acresrc.h"
 
-#define _COMPONENT          RESOURCE_MANAGER
+#define _COMPONENT          ACPI_RESOURCES
 	 MODULE_NAME         ("rsmisc")
 
 
@@ -43,20 +36,20 @@
  * FUNCTION:    Acpi_rs_end_tag_resource
  *
  * PARAMETERS:  Byte_stream_buffer      - Pointer to the resource input byte
- *                                          stream
+ *                                        stream
  *              Bytes_consumed          - u32 pointer that is filled with
- *                                          the number of bytes consumed from
- *                                          the Byte_stream_buffer
+ *                                        the number of bytes consumed from
+ *                                        the Byte_stream_buffer
  *              Output_buffer           - Pointer to the user's return buffer
  *              Structure_size          - u32 pointer that is filled with
- *                                          the number of bytes in the filled
- *                                          in structure
+ *                                        the number of bytes in the filled
+ *                                        in structure
  *
- * RETURN:      Status  AE_OK if okay, else a valid ACPI_STATUS code
+ * RETURN:      Status
  *
  * DESCRIPTION: Take the resource byte stream and fill out the appropriate
- *                  structure pointed to by the Output_buffer. Return the
- *                  number of bytes consumed from the byte stream.
+ *              structure pointed to by the Output_buffer. Return the
+ *              number of bytes consumed from the byte stream.
  *
  ******************************************************************************/
 
@@ -67,8 +60,8 @@
 	u8                      **output_buffer,
 	u32                     *structure_size)
 {
-	RESOURCE                *output_struct = (RESOURCE *) * output_buffer;
-	u32                     struct_size = RESOURCE_LENGTH;
+	ACPI_RESOURCE           *output_struct = (ACPI_RESOURCE *) *output_buffer;
+	u32                     struct_size = ACPI_RESOURCE_LENGTH;
 
 
 	/*
@@ -79,7 +72,7 @@
 	/*
 	 *  Fill out the structure
 	 */
-	output_struct->id = end_tag;
+	output_struct->id = ACPI_RSTYPE_END_TAG;
 
 	/*
 	 * Set the Length parameter
@@ -90,7 +83,6 @@
 	 * Return the final size of the structure
 	 */
 	*structure_size = struct_size;
-
 	return (AE_OK);
 }
 
@@ -102,19 +94,19 @@
  * PARAMETERS:  Linked_list             - Pointer to the resource linked list
  *              Output_buffer           - Pointer to the user's return buffer
  *              Bytes_consumed          - u32 pointer that is filled with
- *                                          the number of bytes of the
- *                                          Output_buffer used
+ *                                        the number of bytes of the
+ *                                        Output_buffer used
  *
- * RETURN:      Status  AE_OK if okay, else a valid ACPI_STATUS code
+ * RETURN:      Status
  *
  * DESCRIPTION: Take the linked list resource structure and fills in the
- *                  the appropriate bytes in a byte stream
+ *              the appropriate bytes in a byte stream
  *
  ******************************************************************************/
 
 ACPI_STATUS
 acpi_rs_end_tag_stream (
-	RESOURCE                *linked_list,
+	ACPI_RESOURCE           *linked_list,
 	u8                      **output_buffer,
 	u32                     *bytes_consumed)
 {
@@ -130,7 +122,7 @@
 
 	/*
 	 * Set the Checksum - zero means that the resource data is treated as if
-	 *  the checksum operation succeeded (ACPI Spec 1.0b Section 6.4.2.8)
+	 * the checksum operation succeeded (ACPI Spec 1.0b Section 6.4.2.8)
 	 */
 	temp8 = 0;
 
@@ -140,9 +132,7 @@
 	/*
 	 * Return the number of bytes consumed in this operation
 	 */
-	*bytes_consumed = (u32) ((NATIVE_UINT) buffer -
-			   (NATIVE_UINT) *output_buffer);
-
+	*bytes_consumed = POINTER_DIFF (buffer, *output_buffer);
 	return (AE_OK);
 }
 
@@ -152,20 +142,20 @@
  * FUNCTION:    Acpi_rs_vendor_resource
  *
  * PARAMETERS:  Byte_stream_buffer      - Pointer to the resource input byte
- *                                          stream
+ *                                        stream
  *              Bytes_consumed          - u32 pointer that is filled with
- *                                          the number of bytes consumed from
- *                                          the Byte_stream_buffer
+ *                                        the number of bytes consumed from
+ *                                        the Byte_stream_buffer
  *              Output_buffer           - Pointer to the user's return buffer
  *              Structure_size          - u32 pointer that is filled with
- *                                          the number of bytes in the filled
- *                                          in structure
+ *                                        the number of bytes in the filled
+ *                                        in structure
  *
- * RETURN:      Status  AE_OK if okay, else a valid ACPI_STATUS code
+ * RETURN:      Status
  *
  * DESCRIPTION: Take the resource byte stream and fill out the appropriate
- *                  structure pointed to by the Output_buffer. Return the
- *                  number of bytes consumed from the byte stream.
+ *              structure pointed to by the Output_buffer. Return the
+ *              number of bytes consumed from the byte stream.
  *
  ******************************************************************************/
 
@@ -177,12 +167,11 @@
 	u32                     *structure_size)
 {
 	u8                      *buffer = byte_stream_buffer;
-	RESOURCE                *output_struct = (RESOURCE *) * output_buffer;
+	ACPI_RESOURCE           *output_struct = (ACPI_RESOURCE *) *output_buffer;
 	u16                     temp16 = 0;
 	u8                      temp8 = 0;
 	u8                      index;
-	u32                     struct_size = sizeof (VENDOR_RESOURCE) +
-			  RESOURCE_LENGTH_NO_DATA;
+	u32                     struct_size = SIZEOF_RESOURCE (ACPI_RESOURCE_VENDOR);
 
 
 	/*
@@ -193,9 +182,8 @@
 	if (temp8 & 0x80) {
 		/*
 		 * Large Item
+		 * Point to the length field
 		 */
-		/* Point to the length field */
-
 		buffer += 1;
 
 		/* Dereference */
@@ -214,10 +202,8 @@
 	else {
 		/*
 		 * Small Item
+		 * Dereference the size
 		 */
-
-		/* Dereference the size */
-
 		temp16 = (u8)(*buffer & 0x07);
 
 		/* Calculate bytes consumed */
@@ -229,7 +215,7 @@
 		buffer += 1;
 	}
 
-	output_struct->id = vendor_specific;
+	output_struct->id = ACPI_RSTYPE_VENDOR;
 	output_struct->data.vendor_specific.length = temp16;
 
 	for (index = 0; index < temp16; index++) {
@@ -238,9 +224,9 @@
 	}
 
 	/*
-	 * In order for the Struct_size to fall on a 32-bit boundry,
-	 *  calculate the length of the vendor string and expand the
-	 *  Struct_size to the next 32-bit boundry.
+	 * In order for the Struct_size to fall on a 32-bit boundary,
+	 * calculate the length of the vendor string and expand the
+	 * Struct_size to the next 32-bit boundary.
 	 */
 	struct_size += ROUND_UP_TO_32_bITS (temp16);
 
@@ -253,7 +239,6 @@
 	 * Return the final size of the structure
 	 */
 	*structure_size = struct_size;
-
 	return (AE_OK);
 }
 
@@ -265,19 +250,19 @@
  * PARAMETERS:  Linked_list             - Pointer to the resource linked list
  *              Output_buffer           - Pointer to the user's return buffer
  *              Bytes_consumed          - u32 pointer that is filled with
- *                                          the number of bytes of the
- *                                          Output_buffer used
+ *                                        the number of bytes of the
+ *                                        Output_buffer used
  *
- * RETURN:      Status  AE_OK if okay, else a valid ACPI_STATUS code
+ * RETURN:      Status
  *
  * DESCRIPTION: Take the linked list resource structure and fills in the
- *                  the appropriate bytes in a byte stream
+ *              the appropriate bytes in a byte stream
  *
  ******************************************************************************/
 
 ACPI_STATUS
 acpi_rs_vendor_stream (
-	RESOURCE                *linked_list,
+	ACPI_RESOURCE           *linked_list,
 	u8                      **output_buffer,
 	u32                     *bytes_consumed)
 {
@@ -290,12 +275,9 @@
 	/*
 	 * Dereference the length to find if this is a large or small item.
 	 */
-
 	if(linked_list->data.vendor_specific.length > 7) {
 		/*
 		 * Large Item
-		 */
-		/*
 		 * Set the descriptor field and length bytes
 		 */
 		*buffer = 0x84;
@@ -310,9 +292,6 @@
 	else {
 		/*
 		 * Small Item
-		 */
-
-		/*
 		 * Set the descriptor field
 		 */
 		temp8 = 0x70;
@@ -335,9 +314,7 @@
 	/*
 	 * Return the number of bytes consumed in this operation
 	 */
-	*bytes_consumed = (u32) ((NATIVE_UINT) buffer -
-			   (NATIVE_UINT) *output_buffer);
-
+	*bytes_consumed = POINTER_DIFF (buffer, *output_buffer);
 	return (AE_OK);
 }
 
@@ -347,20 +324,20 @@
  * FUNCTION:    Acpi_rs_start_dependent_functions_resource
  *
  * PARAMETERS:  Byte_stream_buffer      - Pointer to the resource input byte
- *                                          stream
+ *                                        stream
  *              Bytes_consumed          - u32 pointer that is filled with
- *                                          the number of bytes consumed from
- *                                          the Byte_stream_buffer
+ *                                        the number of bytes consumed from
+ *                                        the Byte_stream_buffer
  *              Output_buffer           - Pointer to the user's return buffer
  *              Structure_size          - u32 pointer that is filled with
- *                                          the number of bytes in the filled
- *                                          in structure
+ *                                        the number of bytes in the filled
+ *                                        in structure
  *
- * RETURN:      Status  AE_OK if okay, else a valid ACPI_STATUS code
+ * RETURN:      Status
  *
  * DESCRIPTION: Take the resource byte stream and fill out the appropriate
- *                  structure pointed to by the Output_buffer. Return the
- *                  number of bytes consumed from the byte stream.
+ *              structure pointed to by the Output_buffer. Return the
+ *              number of bytes consumed from the byte stream.
  *
  ******************************************************************************/
 
@@ -372,11 +349,9 @@
 	u32                     *structure_size)
 {
 	u8                      *buffer = byte_stream_buffer;
-	RESOURCE                *output_struct = (RESOURCE *) * output_buffer;
+	ACPI_RESOURCE          *output_struct = (ACPI_RESOURCE *) *output_buffer;
 	u8                      temp8 = 0;
-	u32                     struct_size =
-			  sizeof(START_DEPENDENT_FUNCTIONS_RESOURCE) +
-			  RESOURCE_LENGTH_NO_DATA;
+	u32                     struct_size = SIZEOF_RESOURCE (ACPI_RESOURCE_START_DPF);
 
 
 	/*
@@ -386,7 +361,7 @@
 
 	*bytes_consumed = (temp8 & 0x01) + 1;
 
-	output_struct->id = start_dependent_functions;
+	output_struct->id = ACPI_RSTYPE_START_DPF;
 
 	/*
 	 * Point to Byte 1 if it is used
@@ -398,29 +373,27 @@
 		/*
 		 * Check Compatibility priority
 		 */
-		output_struct->data.start_dependent_functions.compatibility_priority =
-				temp8 & 0x03;
+		output_struct->data.start_dpf.compatibility_priority = temp8 & 0x03;
 
-		if (3 == output_struct->data.start_dependent_functions.compatibility_priority) {
+		if (3 == output_struct->data.start_dpf.compatibility_priority) {
 			return (AE_AML_ERROR);
 		}
 
 		/*
 		 * Check Performance/Robustness preference
 		 */
-		output_struct->data.start_dependent_functions.performance_robustness =
-				(temp8 >> 2) & 0x03;
+		output_struct->data.start_dpf.performance_robustness = (temp8 >> 2) & 0x03;
 
-		if (3 == output_struct->data.start_dependent_functions.performance_robustness) {
+		if (3 == output_struct->data.start_dpf.performance_robustness) {
 			return (AE_AML_ERROR);
 		}
 	}
 
 	else {
-		output_struct->data.start_dependent_functions.compatibility_priority =
+		output_struct->data.start_dpf.compatibility_priority =
 				ACCEPTABLE_CONFIGURATION;
 
-		output_struct->data.start_dependent_functions.performance_robustness =
+		output_struct->data.start_dpf.performance_robustness =
 				ACCEPTABLE_CONFIGURATION;
 	}
 
@@ -433,7 +406,6 @@
 	 * Return the final size of the structure
 	 */
 	*structure_size = struct_size;
-
 	return (AE_OK);
 }
 
@@ -443,20 +415,20 @@
  * FUNCTION:    Acpi_rs_end_dependent_functions_resource
  *
  * PARAMETERS:  Byte_stream_buffer      - Pointer to the resource input byte
- *                                          stream
+ *                                        stream
  *              Bytes_consumed          - u32 pointer that is filled with
- *                                          the number of bytes consumed from
- *                                          the Byte_stream_buffer
+ *                                        the number of bytes consumed from
+ *                                        the Byte_stream_buffer
  *              Output_buffer           - Pointer to the user's return buffer
  *              Structure_size          - u32 pointer that is filled with
- *                                          the number of bytes in the filled
- *                                          in structure
+ *                                        the number of bytes in the filled
+ *                                        in structure
  *
- * RETURN:      Status  AE_OK if okay, else a valid ACPI_STATUS code
+ * RETURN:      Status
  *
  * DESCRIPTION: Take the resource byte stream and fill out the appropriate
- *                  structure pointed to by the Output_buffer. Return the
- *                  number of bytes consumed from the byte stream.
+ *              structure pointed to by the Output_buffer. Return the
+ *              number of bytes consumed from the byte stream.
  *
  ******************************************************************************/
 
@@ -467,8 +439,8 @@
 	u8                      **output_buffer,
 	u32                     *structure_size)
 {
-	RESOURCE                *output_struct = (RESOURCE *) * output_buffer;
-	u32                     struct_size = RESOURCE_LENGTH;
+	ACPI_RESOURCE           *output_struct = (ACPI_RESOURCE *) *output_buffer;
+	u32                     struct_size = ACPI_RESOURCE_LENGTH;
 
 
 	/*
@@ -479,7 +451,7 @@
 	/*
 	 *  Fill out the structure
 	 */
-	output_struct->id = end_dependent_functions;
+	output_struct->id = ACPI_RSTYPE_END_DPF;
 
 	/*
 	 * Set the Length parameter
@@ -490,7 +462,6 @@
 	 * Return the final size of the structure
 	 */
 	*structure_size = struct_size;
-
 	return (AE_OK);
 }
 
@@ -502,19 +473,19 @@
  * PARAMETERS:  Linked_list             - Pointer to the resource linked list
  *              Output_buffer           - Pointer to the user's return buffer
  *              Bytes_consumed          - u32 pointer that is filled with
- *                                          the number of bytes of the
- *                                          Output_buffer used
+ *                                        the number of bytes of the
+ *                                        Output_buffer used
  *
- * RETURN:      Status  AE_OK if okay, else a valid ACPI_STATUS code
+ * RETURN:      Status
  *
  * DESCRIPTION: Take the linked list resource structure and fills in the
- *                  the appropriate bytes in a byte stream
+ *              the appropriate bytes in a byte stream
  *
  ******************************************************************************/
 
 ACPI_STATUS
 acpi_rs_start_dependent_functions_stream (
-	RESOURCE                *linked_list,
+	ACPI_RESOURCE           *linked_list,
 	u8                      **output_buffer,
 	u32                     *bytes_consumed)
 {
@@ -524,13 +495,12 @@
 
 	/*
 	 * The descriptor field is set based upon whether a byte is needed
-	 *  to contain Priority data.
+	 * to contain Priority data.
 	 */
 	if (ACCEPTABLE_CONFIGURATION ==
-			linked_list->data.start_dependent_functions.compatibility_priority &&
+			linked_list->data.start_dpf.compatibility_priority &&
 		ACCEPTABLE_CONFIGURATION ==
-			linked_list->data.start_dependent_functions.performance_robustness)
-	{
+			linked_list->data.start_dpf.performance_robustness) {
 		*buffer = 0x30;
 	}
 	else {
@@ -541,13 +511,10 @@
 		 * Set the Priority Byte Definition
 		 */
 		temp8 = 0;
-		temp8 = (u8)
-			((linked_list->data.start_dependent_functions.performance_robustness &
-			  0x03) << 2);
-		temp8 |=
-			(linked_list->data.start_dependent_functions.compatibility_priority &
-			 0x03);
-
+		temp8 = (u8) ((linked_list->data.start_dpf.performance_robustness &
+				   0x03) << 2);
+		temp8 |= (linked_list->data.start_dpf.compatibility_priority &
+				   0x03);
 		*buffer = temp8;
 	}
 
@@ -556,9 +523,7 @@
 	/*
 	 * Return the number of bytes consumed in this operation
 	 */
-	*bytes_consumed = (u32) ((NATIVE_UINT) buffer -
-			   (NATIVE_UINT) *output_buffer);
-
+	*bytes_consumed = POINTER_DIFF (buffer, *output_buffer);
 	return (AE_OK);
 }
 
@@ -570,19 +535,19 @@
  * PARAMETERS:  Linked_list             - Pointer to the resource linked list
  *              Output_buffer           - Pointer to the user's return buffer
  *              Bytes_consumed          - u32 pointer that is filled with
- *                                          the number of bytes of the
- *                                          Output_buffer used
+ *                                        the number of bytes of the
+ *                                        Output_buffer used
  *
- * RETURN:      Status  AE_OK if okay, else a valid ACPI_STATUS code
+ * RETURN:      Status
  *
  * DESCRIPTION: Take the linked list resource structure and fills in the
- *                  the appropriate bytes in a byte stream
+ *              the appropriate bytes in a byte stream
  *
  ******************************************************************************/
 
 ACPI_STATUS
 acpi_rs_end_dependent_functions_stream (
-	RESOURCE                *linked_list,
+	ACPI_RESOURCE           *linked_list,
 	u8                      **output_buffer,
 	u32                     *bytes_consumed
 	)
@@ -599,9 +564,7 @@
 	/*
 	 * Return the number of bytes consumed in this operation
 	 */
-	*bytes_consumed = (u32) ((NATIVE_UINT) buffer -
-			   (NATIVE_UINT) *output_buffer);
-
+	*bytes_consumed = POINTER_DIFF (buffer, *output_buffer);
 	return (AE_OK);
 }
 
diff -urN linux-2.4.6-pre4/drivers/acpi/resources/rsutils.c linux/drivers/acpi/resources/rsutils.c
--- linux-2.4.6-pre4/drivers/acpi/resources/rsutils.c	Mon Jan 22 13:23:43 2001
+++ linux/drivers/acpi/resources/rsutils.c	Mon Dec  3 22:48:42 2001
@@ -1,7 +1,7 @@
 /*******************************************************************************
  *
  * Module Name: rsutils - Utilities for the resource manager
- *              $Revision: 14 $
+ *              $Revision: 19 $
  *
  ******************************************************************************/
 
@@ -29,7 +29,7 @@
 #include "acresrc.h"
 
 
-#define _COMPONENT          RESOURCE_MANAGER
+#define _COMPONENT          ACPI_RESOURCES
 	 MODULE_NAME         ("rsutils")
 
 
@@ -41,7 +41,7 @@
  *              Ret_buffer      - a pointer to a buffer structure for the
  *                                  results
  *
- * RETURN:      Status          - the status of the call
+ * RETURN:      Status
  *
  * DESCRIPTION: This function is called to get the _PRT value of an object
  *              contained in an object specified by the handle passed in
@@ -96,8 +96,7 @@
 	 *  byte stream buffer that comes back from the _CRS method
 	 *  execution.
 	 */
-	status = acpi_rs_create_pci_routing_table (ret_obj,
-			  ret_buffer->pointer,
+	status = acpi_rs_create_pci_routing_table (ret_obj, ret_buffer->pointer,
 			  &buffer_space_needed);
 
 	/*
@@ -111,8 +110,7 @@
 
 cleanup:
 
-	acpi_cm_remove_reference (ret_obj);
-
+	acpi_ut_remove_reference (ret_obj);
 	return (status);
 }
 
@@ -125,7 +123,7 @@
  *              Ret_buffer      - a pointer to a buffer structure for the
  *                                  results
  *
- * RETURN:      Status          - the status of the call
+ * RETURN:      Status
  *
  * DESCRIPTION: This function is called to get the _CRS value of an object
  *              contained in an object specified by the handle passed in
@@ -177,10 +175,8 @@
 	 *  byte stream buffer that comes back from the _CRS method
 	 *  execution.
 	 */
-	status = acpi_rs_create_resource_list (ret_obj,
-			  ret_buffer->pointer,
-			  &buffer_space_needed);
-
+	status = acpi_rs_create_resource_list (ret_obj, ret_buffer->pointer,
+			 &buffer_space_needed);
 
 
 	/*
@@ -194,8 +190,7 @@
 
 cleanup:
 
-	acpi_cm_remove_reference (ret_obj);
-
+	acpi_ut_remove_reference (ret_obj);
 	return (status);
 }
 
@@ -208,7 +203,7 @@
  *              Ret_buffer      - a pointer to a buffer structure for the
  *                                  results
  *
- * RETURN:      Status          - the status of the call
+ * RETURN:      Status
  *
  * DESCRIPTION: This function is called to get the _PRS value of an object
  *              contained in an object specified by the handle passed in
@@ -260,9 +255,8 @@
 	 *  byte stream buffer that comes back from the _CRS method
 	 *  execution.
 	 */
-	status = acpi_rs_create_resource_list (ret_obj,
-			  ret_buffer->pointer,
-			  &buffer_space_needed);
+	status = acpi_rs_create_resource_list (ret_obj, ret_buffer->pointer,
+			 &buffer_space_needed);
 
 	/*
 	 * Tell the user how much of the buffer we have used or is needed
@@ -275,8 +269,7 @@
 
 cleanup:
 
-	acpi_cm_remove_reference (ret_obj);
-
+	acpi_ut_remove_reference (ret_obj);
 	return (status);
 }
 
@@ -289,7 +282,7 @@
  *              In_buffer       - a pointer to a buffer structure of the
  *                                  parameter
  *
- * RETURN:      Status          - the status of the call
+ * RETURN:      Status
  *
  * DESCRIPTION: This function is called to set the _SRS of an object contained
  *              in an object specified by the handle passed in
@@ -315,20 +308,19 @@
 
 	/*
 	 * The In_buffer parameter will point to a linked list of
-	 *  resource parameters.  It needs to be formatted into a
-	 *  byte stream to be sent in as an input parameter.
+	 * resource parameters.  It needs to be formatted into a
+	 * byte stream to be sent in as an input parameter.
 	 */
 	buffer_size_needed = 0;
 
 	/*
 	 * First call is to get the buffer size needed
 	 */
-	status = acpi_rs_create_byte_stream (in_buffer->pointer,
-			   byte_stream,
-			   &buffer_size_needed);
+	status = acpi_rs_create_byte_stream (in_buffer->pointer, byte_stream,
+			 &buffer_size_needed);
 	/*
 	 * We expect a return of AE_BUFFER_OVERFLOW
-	 *  if not, exit with the error
+	 * if not, exit with the error
 	 */
 	if (AE_BUFFER_OVERFLOW != status) {
 		return (status);
@@ -337,7 +329,7 @@
 	/*
 	 * Allocate the buffer needed
 	 */
-	byte_stream = acpi_cm_callocate(buffer_size_needed);
+	byte_stream = acpi_ut_callocate(buffer_size_needed);
 	if (NULL == byte_stream) {
 		return (AE_NO_MEMORY);
 	}
@@ -345,20 +337,19 @@
 	/*
 	 * Now call to convert the linked list into a byte stream
 	 */
-	status = acpi_rs_create_byte_stream (in_buffer->pointer,
-			   byte_stream,
-			   &buffer_size_needed);
+	status = acpi_rs_create_byte_stream (in_buffer->pointer, byte_stream,
+			 &buffer_size_needed);
 	if (ACPI_FAILURE (status)) {
 		goto cleanup;
 	}
 
 	/*
-	 *  Init the param object
+	 * Init the param object
 	 */
-	acpi_cm_init_static_object (&param_obj);
+	acpi_ut_init_static_object (&param_obj);
 
 	/*
-	 *  Method requires one parameter.  Set it up
+	 * Method requires one parameter.  Set it up
 	 */
 	params [0] = &param_obj;
 	params [1] = NULL;
@@ -371,17 +362,16 @@
 	param_obj.buffer.pointer = byte_stream;
 
 	/*
-	 *  Execute the method, no return value
+	 * Execute the method, no return value
 	 */
 	status = acpi_ns_evaluate_relative (handle, "_SRS", params, NULL);
 
 	/*
-	 *  Clean up and return the status from Acpi_ns_evaluate_relative
+	 * Clean up and return the status from Acpi_ns_evaluate_relative
 	 */
-
 cleanup:
 
-	acpi_cm_free (byte_stream);
+	acpi_ut_free (byte_stream);
 	return (status);
 }
 
diff -urN linux-2.4.6-pre4/drivers/acpi/resources/rsxface.c linux/drivers/acpi/resources/rsxface.c
--- linux-2.4.6-pre4/drivers/acpi/resources/rsxface.c	Mon Jan 22 13:23:43 2001
+++ linux/drivers/acpi/resources/rsxface.c	Mon Dec  3 22:48:42 2001
@@ -1,7 +1,7 @@
 /*******************************************************************************
  *
- * Module Name: rsxface - Public interfaces to the ACPI subsystem
- *              $Revision: 10 $
+ * Module Name: rsxface - Public interfaces to the resource manager
+ *              $Revision: 13 $
  *
  ******************************************************************************/
 
@@ -29,7 +29,7 @@
 #include "acnamesp.h"
 #include "acresrc.h"
 
-#define _COMPONENT          RESOURCE_MANAGER
+#define _COMPONENT          ACPI_RESOURCES
 	 MODULE_NAME         ("rsxface")
 
 
@@ -41,7 +41,7 @@
  *              Ret_buffer      - a pointer to a buffer to receive the
  *                                current resources for the device
  *
- * RETURN:      Status          - the status of the call
+ * RETURN:      Status
  *
  * DESCRIPTION: This function is called to get the IRQ routing table for a
  *              specific bus.  The caller must first acquire a handle for the
@@ -64,21 +64,26 @@
 	ACPI_STATUS             status;
 
 
+	/* Ensure that ACPI has been initialized */
+
+	ACPI_IS_INITIALIZATION_COMPLETE (status);
+	if (ACPI_FAILURE (status)) {
+		return (status);
+	}
+
 	/*
-	 *  Must have a valid handle and buffer, So we have to have a handle
-	 *  and a return buffer structure, and if there is a non-zero buffer length
-	 *  we also need a valid pointer in the buffer. If it's a zero buffer length,
-	 *  we'll be returning the needed buffer size, so keep going.
+	 * Must have a valid handle and buffer, So we have to have a handle
+	 * and a return buffer structure, and if there is a non-zero buffer length
+	 * we also need a valid pointer in the buffer. If it's a zero buffer length,
+	 * we'll be returning the needed buffer size, so keep going.
 	 */
 	if ((!device_handle)        ||
 		(!ret_buffer)           ||
-		((!ret_buffer->pointer) && (ret_buffer->length)))
-	{
+		((!ret_buffer->pointer) && (ret_buffer->length))) {
 		return (AE_BAD_PARAMETER);
 	}
 
 	status = acpi_rs_get_prt_method_data (device_handle, ret_buffer);
-
 	return (status);
 }
 
@@ -92,7 +97,7 @@
  *              Ret_buffer      - a pointer to a buffer to receive the
  *                                current resources for the device
  *
- * RETURN:      Status          - the status of the call
+ * RETURN:      Status
  *
  * DESCRIPTION: This function is called to get the current resources for a
  *              specific device.  The caller must first acquire a handle for
@@ -115,21 +120,26 @@
 	ACPI_STATUS             status;
 
 
+	/* Ensure that ACPI has been initialized */
+
+	ACPI_IS_INITIALIZATION_COMPLETE (status);
+	if (ACPI_FAILURE (status)) {
+		return (status);
+	}
+
 	/*
-	 *  Must have a valid handle and buffer, So we have to have a handle
-	 *  and a return buffer structure, and if there is a non-zero buffer length
-	 *  we also need a valid pointer in the buffer. If it's a zero buffer length,
-	 *  we'll be returning the needed buffer size, so keep going.
+	 * Must have a valid handle and buffer, So we have to have a handle
+	 * and a return buffer structure, and if there is a non-zero buffer length
+	 * we also need a valid pointer in the buffer. If it's a zero buffer length,
+	 * we'll be returning the needed buffer size, so keep going.
 	 */
 	if ((!device_handle)        ||
 		(!ret_buffer)           ||
-		((ret_buffer->length) && (!ret_buffer->pointer)))
-	{
+		((ret_buffer->length) && (!ret_buffer->pointer))) {
 		return (AE_BAD_PARAMETER);
 	}
 
 	status = acpi_rs_get_crs_method_data (device_handle, ret_buffer);
-
 	return (status);
 }
 
@@ -143,7 +153,7 @@
  *              Ret_buffer      - a pointer to a buffer to receive the
  *                                resources for the device
  *
- * RETURN:      Status          - the status of the call
+ * RETURN:      Status
  *
  * DESCRIPTION: This function is called to get a list of the possible resources
  *              for a specific device.  The caller must first acquire a handle
@@ -163,21 +173,26 @@
 	ACPI_STATUS             status;
 
 
+	/* Ensure that ACPI has been initialized */
+
+	ACPI_IS_INITIALIZATION_COMPLETE (status);
+	if (ACPI_FAILURE (status)) {
+		return (status);
+	}
+
 	/*
-	 *  Must have a valid handle and buffer, So we have to have a handle
-	 *  and a return buffer structure, and if there is a non-zero buffer length
-	 *  we also need a valid pointer in the buffer. If it's a zero buffer length,
-	 *  we'll be returning the needed buffer size, so keep going.
+	 * Must have a valid handle and buffer, So we have to have a handle
+	 * and a return buffer structure, and if there is a non-zero buffer length
+	 * we also need a valid pointer in the buffer. If it's a zero buffer length,
+	 * we'll be returning the needed buffer size, so keep going.
 	 */
 	if ((!device_handle)        ||
 		(!ret_buffer)           ||
-		((ret_buffer->length) && (!ret_buffer->pointer)))
-	{
+		((ret_buffer->length) && (!ret_buffer->pointer))) {
 		return (AE_BAD_PARAMETER);
-   }
+	}
 
 	status = acpi_rs_get_prs_method_data (device_handle, ret_buffer);
-
 	return (status);
 }
 
@@ -191,7 +206,7 @@
  *              In_buffer       - a pointer to a buffer containing the
  *                                resources to be set for the device
  *
- * RETURN:      Status          - the status of the call
+ * RETURN:      Status
  *
  * DESCRIPTION: This function is called to set the current resources for a
  *              specific device.  The caller must first acquire a handle for
@@ -208,18 +223,23 @@
 	ACPI_STATUS             status;
 
 
+	/* Ensure that ACPI has been initialized */
+
+	ACPI_IS_INITIALIZATION_COMPLETE (status);
+	if (ACPI_FAILURE (status)) {
+		return (status);
+	}
+
 	/*
-	 *  Must have a valid handle and buffer
+	 * Must have a valid handle and buffer
 	 */
 	if ((!device_handle)      ||
 		(!in_buffer)          ||
 		(!in_buffer->pointer) ||
-		(!in_buffer->length))
-	{
+		(!in_buffer->length)) {
 		return (AE_BAD_PARAMETER);
 	}
 
 	status = acpi_rs_set_srs_method_data (device_handle, in_buffer);
-
 	return (status);
 }
diff -urN linux-2.4.6-pre4/drivers/acpi/sys.c linux/drivers/acpi/sys.c
--- linux-2.4.6-pre4/drivers/acpi/sys.c	Mon Jan 29 10:15:59 2001
+++ linux/drivers/acpi/sys.c	Wed Dec 31 16:00:00 1969
@@ -1,146 +0,0 @@
-/*
- *  sys.c - System management (suspend, ...)
- *
- *  Copyright (C) 2000 Andrew Henroid
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-#include <linux/kernel.h>
-#include <linux/pm.h>
-#include <linux/acpi.h>
-#include "acpi.h"
-#include "driver.h"
-
-#define _COMPONENT	OS_DEPENDENT
-	MODULE_NAME	("sys")
-
-struct acpi_enter_sx_ctx
-{
-	wait_queue_head_t wait;
-	unsigned int      state;
-};
-
-volatile acpi_sstate_t acpi_sleep_state = ACPI_STATE_S0;
-
-/*
- * Enter system sleep state
- */
-static void
-acpi_enter_sx_async(void *context)
-{
-	struct acpi_enter_sx_ctx *ctx = (struct acpi_enter_sx_ctx*) context;
-	ACPI_OBJECT_LIST arg_list;
-	ACPI_OBJECT arg;
-
-	acpi_enter_sleep_state(ctx->state);
-
-	/* either we are in S1, or the transition failed, as the other states resume
-           from the waking vector */
-	if (ctx->state != ACPI_STATE_S1) {
-		printk(KERN_ERR "Could not enter S%d\n", ctx->state);
-		goto out;
-	}
-
-	/* wait until S1 is entered */
-	while (!(acpi_hw_register_bit_access(ACPI_READ, ACPI_MTX_LOCK, WAK_STS)))
-		safe_halt();
-
-	/* run the _WAK method */
-	memset(&arg_list, 0, sizeof(arg_list));
-	arg_list.count = 1;
-	arg_list.pointer = &arg;
-
-	memset(&arg, 0, sizeof(arg));
-	arg.type = ACPI_TYPE_INTEGER;
-	arg.integer.value = ctx->state;
-
-	acpi_evaluate_object(NULL, "\\_WAK", &arg_list, NULL);
-
- out:
-	acpi_sleep_state = ACPI_STATE_S0;
-
-	if (waitqueue_active(&ctx->wait))
-		wake_up_interruptible(&ctx->wait);
-}
-
-/*
- * Enter soft-off (S5)
- */
-static void
-acpi_power_off(void)
-{
-	struct acpi_enter_sx_ctx ctx;
-	
-	init_waitqueue_head(&ctx.wait);
-	ctx.state = ACPI_STATE_S5;
-	acpi_enter_sx_async(&ctx);
-}
-
-/*
- * Enter system sleep state and wait for completion
- */
-int
-acpi_enter_sx(acpi_sstate_t state)
-{
-	struct acpi_enter_sx_ctx ctx;
-	DECLARE_WAITQUEUE(wait, current);
-	int ret = 0;
-
-	init_waitqueue_head(&ctx.wait);
-	ctx.state = state;
-
-	set_current_state(TASK_INTERRUPTIBLE);
-	add_wait_queue(&ctx.wait, &wait);
-
-	if (acpi_os_queue_for_execution(0, acpi_enter_sx_async, &ctx))
-		ret = -1;
-
-	if (!ret)
-		schedule();
-
-	set_current_state(TASK_RUNNING);
-	remove_wait_queue(&ctx.wait, &wait);
-
-	if (!ret && signal_pending(current))
-		ret = -ERESTARTSYS;
-
-	return ret;
-}
-
-int
-acpi_sys_init(void)
-{
-	u8 sx;
-	u8 type_a;
-	u8 type_b;
-
-	printk(KERN_INFO "ACPI: System firmware supports:");
-
-	for (sx = ACPI_STATE_S0; sx <= ACPI_STATE_S5; sx++) {
-		if (ACPI_SUCCESS(
-			   acpi_hw_obtain_sleep_type_register_data(sx,
-								   &type_a,
-								   &type_b))) {
-
-			printk(" S%d", sx);
-		}
-	}
-	printk("\n");
-	
-	pm_power_off = acpi_power_off;
-
-	return 0;
-}
diff -urN linux-2.4.6-pre4/drivers/acpi/table.c linux/drivers/acpi/table.c
--- linux-2.4.6-pre4/drivers/acpi/table.c	Mon Jan 29 10:15:59 2001
+++ linux/drivers/acpi/table.c	Wed Dec 31 16:00:00 1969
@@ -1,71 +0,0 @@
-/*
- *  table.c - ACPI tables, chipset, and errata handling
- *
- *  Copyright (C) 2000 Andrew Henroid
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-#include <linux/kernel.h>
-#include <linux/types.h>
-#include <linux/pci.h>
-#include <linux/pm.h>
-#include <linux/acpi.h>
-#include "acpi.h"
-#include "driver.h"
-
-#define _COMPONENT	OS_DEPENDENT
-	MODULE_NAME	("table")
-
-FADT_DESCRIPTOR acpi_fadt;
-
-/*
- * Fetch the fadt information
- */
-static int
-acpi_fetch_fadt(void)
-{
-	ACPI_BUFFER buffer;
-
-	memset(&acpi_fadt, 0, sizeof(acpi_fadt));
-	buffer.pointer = &acpi_fadt;
-	buffer.length = sizeof(acpi_fadt);
-	if (!ACPI_SUCCESS(acpi_get_table(ACPI_TABLE_FADT, 1, &buffer))) {
-		printk(KERN_ERR "ACPI: missing fadt\n");
-		return -ENODEV;
-	}
-
-	return 0;
-}
-
-/*
- * Find and load ACPI tables
- */
-int
-acpi_find_and_load_tables(u64 rsdp)
-{
-	if (!ACPI_SUCCESS(acpi_load_tables(rsdp))) {
-		printk(KERN_INFO "ACPI: System description table load failed\n");
-		acpi_terminate();
-		return -1;
-	}
-
-	if (acpi_fetch_fadt()) {
-		acpi_terminate();
-		return -1;
-	}
-
-	return 0;
-}
diff -urN linux-2.4.6-pre4/drivers/acpi/tables/Makefile linux/drivers/acpi/tables/Makefile
--- linux-2.4.6-pre4/drivers/acpi/tables/Makefile	Fri Dec 29 14:07:21 2000
+++ linux/drivers/acpi/tables/Makefile	Mon Dec  3 22:48:42 2001
@@ -1,16 +1,12 @@
 #
 # Makefile for all Linux ACPI interpreter subdirectories
+# EXCEPT for the ospm directory
 #
 
-O_TARGET := ../$(shell basename `pwd`).o
+O_TARGET := $(notdir $(CURDIR)).o
 
 obj-$(CONFIG_ACPI) := $(patsubst %.c,%.o,$(wildcard *.c))
 
-EXTRA_CFLAGS += -I../include
-
 EXTRA_CFLAGS += $(ACPI_CFLAGS)
 
 include $(TOPDIR)/Rules.make
-
-clean:
-	$(RM) *.o 
diff -urN linux-2.4.6-pre4/drivers/acpi/tables/tbconvrt.c linux/drivers/acpi/tables/tbconvrt.c
--- linux-2.4.6-pre4/drivers/acpi/tables/tbconvrt.c	Fri Feb  9 11:45:58 2001
+++ linux/drivers/acpi/tables/tbconvrt.c	Mon Dec  3 22:48:42 2001
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: tbconvrt - ACPI Table conversion utilities
- *              $Revision: 19 $
+ *              $Revision: 23 $
  *
  *****************************************************************************/
 
@@ -30,34 +30,13 @@
 #include "actbl.h"
 
 
-#define _COMPONENT          TABLE_MANAGER
+#define _COMPONENT          ACPI_TABLES
 	 MODULE_NAME         ("tbconvrt")
 
 
-/*
- * Build a GAS structure from earlier ACPI table entries (V1.0 and 0.71 extensions)
- *
- * 1) Address space
- * 2) Length in bytes -- convert to length in bits
- * 3) Bit offset is zero
- * 4) Reserved field is zero
- * 5) Expand address to 64 bits
- */
-#define ASL_BUILD_GAS_FROM_ENTRY(a,b,c,d)   {a.address_space_id = (u8) d;\
-			   a.register_bit_width = (u8) MUL_8 (b);\
-			   a.register_bit_offset = 0;\
-			   a.reserved = 0;\
-			   ACPI_STORE_ADDRESS (a.address,c);}
-
-
-/* ACPI V1.0 entries -- address space is always I/O */
-
-#define ASL_BUILD_GAS_FROM_V1_ENTRY(a,b,c)  ASL_BUILD_GAS_FROM_ENTRY(a,b,c,ADDRESS_SPACE_SYSTEM_IO)
-
-
 /*******************************************************************************
  *
- * FUNCTION:    Acpi_tb_convert_to_xsdt
+ * FUNCTION:    Acpi_tb_get_table_count
  *
  * PARAMETERS:
  *
@@ -67,20 +46,17 @@
  *
  ******************************************************************************/
 
-ACPI_STATUS
-acpi_tb_convert_to_xsdt (
-	ACPI_TABLE_DESC         *table_info,
-	u32                     *number_of_tables)
+u32
+acpi_tb_get_table_count (
+	RSDP_DESCRIPTOR         *RSDP,
+	ACPI_TABLE_HEADER       *RSDT)
 {
-	u32                     table_size;
 	u32                     pointer_size;
-	u32                     i;
-	XSDT_DESCRIPTOR         *new_table;
 
 
 #ifndef _IA64
 
-	if (acpi_gbl_RSDP->revision < 2) {
+	if (RSDP->revision < 2) {
 		pointer_size = sizeof (u32);
 	}
 
@@ -97,9 +73,34 @@
 	 * is architecture-dependent.
 	 */
 
-	table_size = table_info->pointer->length;
-	*number_of_tables = (table_size -
-			   sizeof (ACPI_TABLE_HEADER)) / pointer_size;
+	return ((RSDT->length - sizeof (ACPI_TABLE_HEADER)) / pointer_size);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_tb_convert_to_xsdt
+ *
+ * PARAMETERS:
+ *
+ * RETURN:
+ *
+ * DESCRIPTION:
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_tb_convert_to_xsdt (
+	ACPI_TABLE_DESC         *table_info,
+	u32                     *number_of_tables)
+{
+	u32                     table_size;
+	u32                     i;
+	XSDT_DESCRIPTOR         *new_table;
+
+
+	*number_of_tables = acpi_tb_get_table_count (acpi_gbl_RSDP, table_info->pointer);
+
 
 	/* Compute size of the converted XSDT */
 
@@ -108,7 +109,7 @@
 
 	/* Allocate an XSDT */
 
-	new_table = acpi_cm_callocate (table_size);
+	new_table = acpi_ut_callocate (table_size);
 	if (!new_table) {
 		return (AE_NO_MEMORY);
 	}
@@ -193,7 +194,7 @@
 	/* Acpi_gbl_FADT is valid */
 	/* Allocate and zero the 2.0 buffer */
 
-	FADT2 = acpi_cm_callocate (sizeof (FADT_DESCRIPTOR_REV2));
+	FADT2 = acpi_ut_callocate (sizeof (FADT_DESCRIPTOR_REV2));
 	if (FADT2 == NULL) {
 		return (AE_NO_MEMORY);
 	}
@@ -501,7 +502,7 @@
 
 	/* Allocate a common FACS */
 
-	common_facs = acpi_cm_callocate (sizeof (ACPI_COMMON_FACS));
+	common_facs = acpi_ut_callocate (sizeof (ACPI_COMMON_FACS));
 	if (!common_facs) {
 		return (AE_NO_MEMORY);
 	}
diff -urN linux-2.4.6-pre4/drivers/acpi/tables/tbget.c linux/drivers/acpi/tables/tbget.c
--- linux-2.4.6-pre4/drivers/acpi/tables/tbget.c	Mon Jan 22 13:23:43 2001
+++ linux/drivers/acpi/tables/tbget.c	Mon Dec  3 22:48:42 2001
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: tbget - ACPI Table get* routines
- *              $Revision: 43 $
+ *              $Revision: 48 $
  *
  *****************************************************************************/
 
@@ -29,11 +29,12 @@
 #include "actables.h"
 
 
-#define _COMPONENT          TABLE_MANAGER
+#define _COMPONENT          ACPI_TABLES
 	 MODULE_NAME         ("tbget")
 
 #define RSDP_CHECKSUM_LENGTH 20
 
+
 /*******************************************************************************
  *
  * FUNCTION:    Acpi_tb_get_table_ptr
@@ -72,13 +73,11 @@
 	 * For all table types (Single/Multiple), the first
 	 * instance is always in the list head.
 	 */
-
 	if (instance == 1) {
 		/*
 		 * Just pluck the pointer out of the global table!
 		 * Will be null if no table is present
 		 */
-
 		*table_ptr_loc = acpi_gbl_acpi_tables[table_type].pointer;
 		return (AE_OK);
 	}
@@ -92,11 +91,11 @@
 	}
 
 	/* Walk the list to get the desired table
-	 *  Since the if (Instance == 1) check above checked for the
-	 *  first table, setting Table_desc equal to the .Next member
-	 *  is actually pointing to the second table.  Therefore, we
-	 *  need to walk from the 2nd table until we reach the Instance
-	 *  that the user is looking for and return its table pointer.
+	 * Since the if (Instance == 1) check above checked for the
+	 * first table, setting Table_desc equal to the .Next member
+	 * is actually pointing to the second table.  Therefore, we
+	 * need to walk from the 2nd table until we reach the Instance
+	 * that the user is looking for and return its table pointer.
 	 */
 	table_desc = acpi_gbl_acpi_tables[table_type].next;
 	for (i = 2; i < instance; i++) {
@@ -159,7 +158,7 @@
 
 		/* Allocate buffer for the entire table */
 
-		full_table = acpi_cm_allocate (table_header->length);
+		full_table = acpi_ut_allocate (table_header->length);
 		if (!full_table) {
 			return (AE_NO_MEMORY);
 		}
@@ -182,8 +181,7 @@
 	else {
 		size = SIZE_IN_HEADER;
 
-		status = acpi_tb_map_acpi_table (physical_address, &size,
-				  (void **) &full_table);
+		status = acpi_tb_map_acpi_table (physical_address, &size, &full_table);
 		if (ACPI_FAILURE (status)) {
 			return (status);
 		}
@@ -382,8 +380,7 @@
 	/*
 	 * Obtain access to the RSDP structure
 	 */
-	status = acpi_os_map_memory (rsdp_physical_address,
-			  sizeof (RSDP_DESCRIPTOR),
+	status = acpi_os_map_memory (rsdp_physical_address, sizeof (RSDP_DESCRIPTOR),
 			  (void **) &table_ptr);
 	if (ACPI_FAILURE (status)) {
 		return (status);
@@ -439,32 +436,24 @@
 
 /*******************************************************************************
  *
- * FUNCTION:    Acpi_tb_get_table_rsdt
+ * FUNCTION:    Acpi_tb_get_rsdt_address
  *
- * PARAMETERS:  Number_of_tables    - Where the table count is placed
+ * PARAMETERS:  None
  *
- * RETURN:      Status
+ * RETURN:      RSDT physical address
  *
- * DESCRIPTION: Load and validate the RSDP (ptr) and RSDT (table)
+ * DESCRIPTION: Extract the address of the RSDT or XSDT, depending on the
+ *              version of the RSDP
  *
  ******************************************************************************/
 
-ACPI_STATUS
-acpi_tb_get_table_rsdt (
-	u32                     *number_of_tables)
+ACPI_PHYSICAL_ADDRESS
+acpi_tb_get_rsdt_address (void)
 {
-	ACPI_TABLE_DESC         table_info;
-	ACPI_STATUS             status = AE_OK;
 	ACPI_PHYSICAL_ADDRESS   physical_address;
-	u32                     signature_length;
-	char                    *table_signature;
 
 
 	/*
-	 * Get the RSDT from the RSDP
-	 */
-
-	/*
 	 * For RSDP revision 0 or 1, we use the RSDT.
 	 * For RSDP revision 2 (and above), we use the XSDT
 	 */
@@ -475,17 +464,132 @@
 #else
 		physical_address = (ACPI_PHYSICAL_ADDRESS) acpi_gbl_RSDP->rsdt_physical_address;
 #endif
-		table_signature = RSDT_SIG;
-		signature_length = sizeof (RSDT_SIG) -1;
 	}
+
 	else {
 		physical_address = (ACPI_PHYSICAL_ADDRESS)
 				   ACPI_GET_ADDRESS (acpi_gbl_RSDP->xsdt_physical_address);
-		table_signature = XSDT_SIG;
-		signature_length = sizeof (XSDT_SIG) -1;
 	}
 
 
+	return (physical_address);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_tb_validate_rsdt
+ *
+ * PARAMETERS:  Table_ptr       - Addressable pointer to the RSDT.
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Validate signature for the RSDT or XSDT
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_tb_validate_rsdt (
+	ACPI_TABLE_HEADER       *table_ptr)
+{
+	u32                     no_match;
+
+
+	/*
+	 * For RSDP revision 0 or 1, we use the RSDT.
+	 * For RSDP revision 2 (and above), we use the XSDT
+	 */
+	if (acpi_gbl_RSDP->revision < 2) {
+		no_match = STRNCMP ((char *) table_ptr, RSDT_SIG,
+				  sizeof (RSDT_SIG) -1);
+	}
+	else {
+		no_match = STRNCMP ((char *) table_ptr, XSDT_SIG,
+				  sizeof (XSDT_SIG) -1);
+	}
+
+
+	if (no_match) {
+		/* Invalid RSDT or XSDT signature */
+
+		REPORT_ERROR (("Invalid signature where RSDP indicates RSDT/XSDT should be located\n"));
+
+		return (AE_BAD_SIGNATURE);
+	}
+
+	return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_tb_get_table_pointer
+ *
+ * PARAMETERS:  Physical_address    - Address from RSDT
+ *              Flags               - virtual or physical addressing
+ *              Table_ptr           - Addressable address (output)
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Create an addressable pointer to an ACPI table
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_tb_get_table_pointer (
+	ACPI_PHYSICAL_ADDRESS   physical_address,
+	u32                     flags,
+	u32                     *size,
+	ACPI_TABLE_HEADER       **table_ptr)
+{
+	ACPI_STATUS             status;
+
+
+	if ((flags & ACPI_MEMORY_MODE) == ACPI_LOGICAL_ADDRESSING) {
+		*size = SIZE_IN_HEADER;
+		status = acpi_tb_map_acpi_table (physical_address, size, table_ptr);
+	}
+
+	else {
+		*size = 0;
+		*table_ptr = (ACPI_TABLE_HEADER *) (ACPI_TBLPTR) physical_address;
+
+		status = AE_OK;
+	}
+
+	return (status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_tb_get_table_rsdt
+ *
+ * PARAMETERS:  Number_of_tables    - Where the table count is placed
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Load and validate the RSDP (ptr) and RSDT (table)
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_tb_get_table_rsdt (
+	u32                     *number_of_tables)
+{
+	ACPI_TABLE_DESC         table_info;
+	ACPI_STATUS             status;
+	ACPI_PHYSICAL_ADDRESS   physical_address;
+
+
+	/*
+	 * Get the RSDT from the RSDP
+	 */
+
+
+	physical_address = acpi_tb_get_rsdt_address ();
+
+
 	/* Get the RSDT/XSDT */
 
 	status = acpi_tb_get_table (physical_address, NULL, &table_info);
@@ -496,20 +600,16 @@
 
 	/* Check the RSDT or XSDT signature */
 
-	if (STRNCMP ((char *) table_info.pointer, table_signature,
-			  signature_length))
-	{
-		/* Invalid RSDT or XSDT signature */
-
-		REPORT_ERROR (("Invalid signature where RSDP indicates %s should be located\n",
-				  table_signature));
-
+	status = acpi_tb_validate_rsdt (table_info.pointer);
+	if (ACPI_FAILURE (status)) {
 		return (status);
 	}
 
 
-	/* Valid RSDT signature, verify the checksum */
-
+	/*
+	 * Valid RSDT signature, verify the checksum.  If it fails, just
+	 * print a warning and ignore it.
+	 */
 	status = acpi_tb_verify_table_checksum (table_info.pointer);
 
 
@@ -538,7 +638,7 @@
  * FUNCTION:    Acpi_tb_get_table_facs
  *
  * PARAMETERS:  *Buffer_ptr             - If Buffer_ptr is valid, read data from
- *                                          buffer rather than searching memory
+ *                                        buffer rather than searching memory
  *              *Table_info             - Where the table info is returned
  *
  * RETURN:      Status
@@ -555,7 +655,7 @@
 	ACPI_TABLE_HEADER       *buffer_ptr,
 	ACPI_TABLE_DESC         *table_info)
 {
-	void                    *table_ptr = NULL;
+	ACPI_TABLE_HEADER       *table_ptr = NULL;
 	u32                     size;
 	u8                      allocation;
 	ACPI_STATUS             status = AE_OK;
@@ -573,7 +673,7 @@
 		 * Getting table from a file -- allocate a buffer and
 		 * read the table.
 		 */
-		table_ptr = acpi_cm_allocate (size);
+		table_ptr = acpi_ut_allocate (size);
 		if(!table_ptr) {
 			return (AE_NO_MEMORY);
 		}
@@ -590,7 +690,7 @@
 
 		status = acpi_tb_map_acpi_table ((ACPI_PHYSICAL_ADDRESS) ACPI_GET_ADDRESS (acpi_gbl_FADT->Xfirmware_ctrl),
 				   &size, &table_ptr);
-		if (ACPI_FAILURE(status)) {
+		if (ACPI_FAILURE (status)) {
 			return (status);
 		}
 
diff -urN linux-2.4.6-pre4/drivers/acpi/tables/tbinstal.c linux/drivers/acpi/tables/tbinstal.c
--- linux-2.4.6-pre4/drivers/acpi/tables/tbinstal.c	Mon Jan 22 13:23:43 2001
+++ linux/drivers/acpi/tables/tbinstal.c	Mon Dec  3 22:48:42 2001
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: tbinstal - ACPI table installation and removal
- *              $Revision: 36 $
+ *              $Revision: 39 $
  *
  *****************************************************************************/
 
@@ -29,7 +29,7 @@
 #include "actables.h"
 
 
-#define _COMPONENT          TABLE_MANAGER
+#define _COMPONENT          ACPI_TABLES
 	 MODULE_NAME         ("tbinstal")
 
 
@@ -68,13 +68,13 @@
 
 	/* Lock tables while installing */
 
-	acpi_cm_acquire_mutex (ACPI_MTX_TABLES);
+	acpi_ut_acquire_mutex (ACPI_MTX_TABLES);
 
 	/* Install the table into the global data structure */
 
 	status = acpi_tb_init_table_descriptor (table_info->type, table_info);
 
-	acpi_cm_release_mutex (ACPI_MTX_TABLES);
+	acpi_ut_release_mutex (ACPI_MTX_TABLES);
 	return (status);
 }
 
@@ -127,8 +127,7 @@
 	for (i = 1; i < NUM_ACPI_TABLES; i++) {
 		if (!STRNCMP (table_header->signature,
 				  acpi_gbl_acpi_table_data[i].signature,
-				  acpi_gbl_acpi_table_data[i].sig_length))
-		{
+				  acpi_gbl_acpi_table_data[i].sig_length)) {
 			/*
 			 * Found a signature match, get the pertinent info from the
 			 * Table_data structure
@@ -226,7 +225,7 @@
 		 */
 
 		if (list_head->pointer) {
-			table_desc = acpi_cm_callocate (sizeof (ACPI_TABLE_DESC));
+			table_desc = acpi_ut_callocate (sizeof (ACPI_TABLE_DESC));
 			if (!table_desc) {
 				return (AE_NO_MEMORY);
 			}
@@ -262,7 +261,7 @@
 	table_desc->aml_pointer         = (u8 *) (table_desc->pointer + 1),
 	table_desc->aml_length          = (u32) (table_desc->length -
 			 (u32) sizeof (ACPI_TABLE_HEADER));
-	table_desc->table_id            = acpi_cm_allocate_owner_id (OWNER_TYPE_TABLE);
+	table_desc->table_id            = acpi_ut_allocate_owner_id (OWNER_TYPE_TABLE);
 	table_desc->loaded_into_namespace = FALSE;
 
 	/*
@@ -337,7 +336,7 @@
 	}
 
 
-	acpi_cm_acquire_mutex (ACPI_MTX_TABLES);
+	acpi_ut_acquire_mutex (ACPI_MTX_TABLES);
 
 	/* Free the table */
 
@@ -346,8 +345,7 @@
 
 	/* Clear the appropriate "typed" global table pointer */
 
-	switch (type)
-	{
+	switch (type) {
 	case ACPI_TABLE_RSDP:
 		acpi_gbl_RSDP = NULL;
 		break;
@@ -374,7 +372,7 @@
 		break;
 	}
 
-	acpi_cm_release_mutex (ACPI_MTX_TABLES);
+	acpi_ut_release_mutex (ACPI_MTX_TABLES);
 
 	return;
 }
@@ -445,8 +443,7 @@
 	if (table_desc->pointer) {
 		/* Valid table, determine type of memory allocation */
 
-		switch (table_desc->allocation)
-		{
+		switch (table_desc->allocation) {
 
 		case ACPI_MEM_NOT_ALLOCATED:
 			break;
@@ -454,7 +451,7 @@
 
 		case ACPI_MEM_ALLOCATED:
 
-			acpi_cm_free (table_desc->base_pointer);
+			acpi_ut_free (table_desc->base_pointer);
 			break;
 
 
@@ -527,7 +524,7 @@
 		/* Free the table descriptor */
 
 		next_desc = table_desc->next;
-		acpi_cm_free (table_desc);
+		acpi_ut_free (table_desc);
 	}
 
 
diff -urN linux-2.4.6-pre4/drivers/acpi/tables/tbutils.c linux/drivers/acpi/tables/tbutils.c
--- linux-2.4.6-pre4/drivers/acpi/tables/tbutils.c	Mon Jan 22 13:23:43 2001
+++ linux/drivers/acpi/tables/tbutils.c	Mon Dec  3 22:48:42 2001
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: tbutils - Table manipulation utilities
- *              $Revision: 33 $
+ *              $Revision: 38 $
  *
  *****************************************************************************/
 
@@ -29,7 +29,7 @@
 #include "acinterp.h"
 
 
-#define _COMPONENT          TABLE_MANAGER
+#define _COMPONENT          ACPI_TABLES
 	 MODULE_NAME         ("tbutils")
 
 
@@ -57,8 +57,7 @@
 
 	for (i = 0; i < ACPI_TABLE_MAX; i++) {
 		list_head = &acpi_gbl_acpi_tables[i];
-		do
-		{
+		do {
 			if (list_head->table_id == table_id) {
 				*table_desc = list_head;
 				return (AE_OK);
@@ -108,8 +107,7 @@
 	/* Check for a pointer within the DSDT */
 
 	if ((acpi_gbl_DSDT) &&
-		(IS_IN_ACPI_TABLE (where, acpi_gbl_DSDT)))
-	{
+		(IS_IN_ACPI_TABLE (where, acpi_gbl_DSDT))) {
 		return (TRUE);
 	}
 
@@ -177,6 +175,9 @@
 	ACPI_NAME               signature;
 
 
+	PROC_NAME ("Tb_validate_table_header");
+
+
 	/* Verify that this is a valid address */
 
 	if (!acpi_os_readable (table_header, sizeof (ACPI_TABLE_HEADER))) {
@@ -187,8 +188,8 @@
 	/* Ensure that the signature is 4 ASCII characters */
 
 	MOVE_UNALIGNED32_TO_32 (&signature, &table_header->signature);
-	if (!acpi_cm_valid_acpi_name (signature)) {
-		REPORT_WARNING (("Invalid table signature found\n"));
+	if (!acpi_ut_valid_acpi_name (signature)) {
+		REPORT_WARNING (("Invalid table signature %4.4s found\n", &signature));
 		return (AE_BAD_SIGNATURE);
 	}
 
@@ -224,7 +225,7 @@
 acpi_tb_map_acpi_table (
 	ACPI_PHYSICAL_ADDRESS   physical_address,
 	u32                     *size,
-	void                    **logical_address)
+	ACPI_TABLE_HEADER       **logical_address)
 {
 	ACPI_TABLE_HEADER       *table;
 	u32                     table_size = *size;
diff -urN linux-2.4.6-pre4/drivers/acpi/tables/tbxface.c linux/drivers/acpi/tables/tbxface.c
--- linux-2.4.6-pre4/drivers/acpi/tables/tbxface.c	Mon Jan 22 13:23:43 2001
+++ linux/drivers/acpi/tables/tbxface.c	Mon Dec  3 22:48:42 2001
@@ -2,7 +2,7 @@
  *
  * Module Name: tbxface - Public interfaces to the ACPI subsystem
  *                         ACPI table oriented interfaces
- *              $Revision: 34 $
+ *              $Revision: 39 $
  *
  *****************************************************************************/
 
@@ -31,7 +31,7 @@
 #include "actables.h"
 
 
-#define _COMPONENT          TABLE_MANAGER
+#define _COMPONENT          ACPI_TABLES
 	 MODULE_NAME         ("tbxface")
 
 
@@ -52,16 +52,23 @@
 acpi_load_tables (
 	ACPI_PHYSICAL_ADDRESS   rsdp_physical_address)
 {
-	ACPI_STATUS             status = AE_OK;
+	ACPI_STATUS             status;
 	u32                     number_of_tables = 0;
 
 
+	/* Ensure that ACPI has been initialized */
+
+	ACPI_IS_INITIALIZATION_COMPLETE (status);
+	if (ACPI_FAILURE (status)) {
+		return (status);
+	}
+
 	/* Map and validate the RSDP */
 
 	status = acpi_tb_verify_rsdp (rsdp_physical_address);
 	if (ACPI_FAILURE (status)) {
 		REPORT_ERROR (("Acpi_load_tables: RSDP Failed validation: %s\n",
-				  acpi_cm_format_exception (status)));
+				  acpi_ut_format_exception (status)));
 		goto error_exit;
 	}
 
@@ -70,7 +77,7 @@
 	status = acpi_tb_get_table_rsdt (&number_of_tables);
 	if (ACPI_FAILURE (status)) {
 		REPORT_ERROR (("Acpi_load_tables: Could not load RSDT: %s\n",
-				  acpi_cm_format_exception (status)));
+				  acpi_ut_format_exception (status)));
 		goto error_exit;
 	}
 
@@ -79,7 +86,7 @@
 	status = acpi_tb_get_all_tables (number_of_tables, NULL);
 	if (ACPI_FAILURE (status)) {
 		REPORT_ERROR (("Acpi_load_tables: Error getting required tables (DSDT/FADT/FACS): %s\n",
-				  acpi_cm_format_exception (status)));
+				  acpi_ut_format_exception (status)));
 		goto error_exit;
 	}
 
@@ -89,7 +96,7 @@
 	status = acpi_ns_load_namespace ();
 	if (ACPI_FAILURE (status)) {
 		REPORT_ERROR (("Acpi_load_tables: Could not load namespace: %s\n",
-				  acpi_cm_format_exception (status)));
+				  acpi_ut_format_exception (status)));
 		goto error_exit;
 	}
 
@@ -98,7 +105,7 @@
 
 error_exit:
 	REPORT_ERROR (("Acpi_load_tables: Could not load tables: %s\n",
-			  acpi_cm_format_exception (status)));
+			  acpi_ut_format_exception (status)));
 
 	return (status);
 }
@@ -118,8 +125,6 @@
  *              a valid header.  The header fields will be verified, and if it
  *              is determined that the table is invalid, the call will fail.
  *
- *              If the call fails an appropriate status will be returned.
- *
  ******************************************************************************/
 
 ACPI_STATUS
@@ -130,6 +135,13 @@
 	ACPI_TABLE_DESC         table_info;
 
 
+	/* Ensure that ACPI has been initialized */
+
+	ACPI_IS_INITIALIZATION_COMPLETE (status);
+	if (ACPI_FAILURE (status)) {
+		return (status);
+	}
+
 	if (!table_ptr) {
 		return (AE_BAD_PARAMETER);
 	}
@@ -182,7 +194,15 @@
 	ACPI_TABLE_TYPE         table_type)
 {
 	ACPI_TABLE_DESC         *list_head;
+	ACPI_STATUS             status;
+
 
+	/* Ensure that ACPI has been initialized */
+
+	ACPI_IS_INITIALIZATION_COMPLETE (status);
+	if (ACPI_FAILURE (status)) {
+		return (status);
+	}
 
 	/* Parameter validation */
 
@@ -194,15 +214,13 @@
 	/* Find all tables of the requested type */
 
 	list_head = &acpi_gbl_acpi_tables[table_type];
-	do
-	{
+	do {
 		/*
 		 * Delete all namespace entries owned by this table.  Note that these
 		 * entries can appear anywhere in the namespace by virtue of the AML
 		 * "Scope" operator.  Thus, we need to track ownership by an ID, not
 		 * simply a position within the hierarchy
 		 */
-
 		acpi_ns_delete_namespace_by_owner (list_head->table_id);
 
 		/* Delete (or unmap) the actual table */
@@ -234,9 +252,6 @@
  *              function is not valid for the RSD PTR table since it does not
  *              have a standard header and is fixed length.
  *
- *              If the operation fails for any reason an appropriate status will
- *              be returned and the contents of Out_table_header are undefined.
- *
  ******************************************************************************/
 
 ACPI_STATUS
@@ -249,10 +264,16 @@
 	ACPI_STATUS             status;
 
 
+	/* Ensure that ACPI has been initialized */
+
+	ACPI_IS_INITIALIZATION_COMPLETE (status);
+	if (ACPI_FAILURE (status)) {
+		return (status);
+	}
+
 	if ((instance == 0)                 ||
 		(table_type == ACPI_TABLE_RSDP) ||
-		(!out_table_header))
-	{
+		(!out_table_header)) {
 		return (AE_BAD_PARAMETER);
 	}
 
@@ -260,8 +281,7 @@
 
 	if ((table_type > ACPI_TABLE_MAX)   ||
 		(IS_SINGLE_TABLE (acpi_gbl_acpi_table_data[table_type].flags) &&
-		 instance > 1))
-	{
+		 instance > 1)) {
 		return (AE_BAD_PARAMETER);
 	}
 
@@ -311,9 +331,6 @@
  *              copied into the Out_buffer->Buf_ptr buffer. This table will be
  *              a complete table including the header.
  *
- *              If the operation fails an appropriate status will be returned
- *              and the contents of Out_buffer are undefined.
- *
  ******************************************************************************/
 
 ACPI_STATUS
@@ -327,13 +344,19 @@
 	u32                     ret_buf_len;
 
 
+	/* Ensure that ACPI has been initialized */
+
+	ACPI_IS_INITIALIZATION_COMPLETE (status);
+	if (ACPI_FAILURE (status)) {
+		return (status);
+	}
+
 	/*
 	 *  If we have a buffer, we must have a length too
 	 */
 	if ((instance == 0)                 ||
 		(!ret_buffer)                   ||
-		((!ret_buffer->pointer) && (ret_buffer->length)))
-	{
+		((!ret_buffer->pointer) && (ret_buffer->length))) {
 		return (AE_BAD_PARAMETER);
 	}
 
@@ -341,8 +364,7 @@
 
 	if ((table_type > ACPI_TABLE_MAX)   ||
 		(IS_SINGLE_TABLE (acpi_gbl_acpi_table_data[table_type].flags) &&
-		 instance > 1))
-	{
+		 instance > 1)) {
 		return (AE_BAD_PARAMETER);
 	}
 
@@ -356,7 +378,7 @@
 
 	/*
 	 * Acpi_tb_get_table_ptr will return a NULL pointer if the
-	 *  table is not loaded.
+	 * table is not loaded.
 	 */
 	if (tbl_ptr == NULL) {
 		return (AE_NOT_EXIST);
@@ -389,4 +411,5 @@
 
 	return (AE_OK);
 }
+
 
diff -urN linux-2.4.6-pre4/drivers/acpi/tables/tbxfroot.c linux/drivers/acpi/tables/tbxfroot.c
--- linux-2.4.6-pre4/drivers/acpi/tables/tbxfroot.c	Mon Jan 22 13:23:43 2001
+++ linux/drivers/acpi/tables/tbxfroot.c	Mon Dec  3 22:48:42 2001
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: tbxfroot - Find the root ACPI table (RSDT)
- *              $Revision: 35 $
+ *              $Revision: 39 $
  *
  *****************************************************************************/
 
@@ -29,7 +29,7 @@
 #include "actables.h"
 
 
-#define _COMPONENT          TABLE_MANAGER
+#define _COMPONENT          ACPI_TABLES
 	 MODULE_NAME         ("tbxfroot")
 
 #define RSDP_CHECKSUM_LENGTH 20
@@ -57,7 +57,7 @@
 
 	/* Get the RSDP */
 
-	status = acpi_tb_find_rsdp (&table_info);
+	status = acpi_tb_find_rsdp (&table_info, ACPI_LOGICAL_ADDRESSING);
 	if (ACPI_FAILURE (status)) {
 		return (AE_NO_ACPI_TABLES);
 	}
@@ -94,15 +94,13 @@
 
 	for (offset = 0, mem_rover = start_address;
 		 offset < length;
-		 offset += RSDP_SCAN_STEP, mem_rover += RSDP_SCAN_STEP)
-	{
+		 offset += RSDP_SCAN_STEP, mem_rover += RSDP_SCAN_STEP) {
 
 		/* The signature and checksum must both be correct */
 
 		if (STRNCMP ((NATIVE_CHAR *) mem_rover,
 				RSDP_SIG, sizeof (RSDP_SIG)-1) == 0 &&
-			acpi_tb_checksum (mem_rover, RSDP_CHECKSUM_LENGTH) == 0)
-		{
+			acpi_tb_checksum (mem_rover, RSDP_CHECKSUM_LENGTH) == 0) {
 			/* If so, we have found the RSDP */
 
 			return (mem_rover);
@@ -119,9 +117,9 @@
  *
  * FUNCTION:    Acpi_tb_find_rsdp
  *
- * PARAMETERS:  *Buffer_ptr             - If == NULL, read data from buffer
- *                                        rather than searching memory
- *              *Table_info             - Where the table info is returned
+ * PARAMETERS:  *Table_info             - Where the table info is returned
+ *              Flags                   - Current memory mode (logical vs.
+ *                                        physical addressing)
  *
  * RETURN:      Status
  *
@@ -136,7 +134,8 @@
 
 ACPI_STATUS
 acpi_tb_find_rsdp (
-	ACPI_TABLE_DESC         *table_info)
+	ACPI_TABLE_DESC         *table_info,
+	u32                     flags)
 {
 	u8                      *table_ptr;
 	u8                      *mem_rover;
@@ -145,70 +144,231 @@
 
 
 	/*
-	 * Search memory for RSDP.  First map low physical memory.
+	 * Scan supports either 1) Logical addressing or 2) Physical addressing
 	 */
+	if ((flags & ACPI_MEMORY_MODE) == ACPI_LOGICAL_ADDRESSING) {
+		/*
+		 * 1) Search EBDA (low memory) paragraphs
+		 */
+		status = acpi_os_map_memory (LO_RSDP_WINDOW_BASE, LO_RSDP_WINDOW_SIZE,
+				  (void **) &table_ptr);
+		if (ACPI_FAILURE (status)) {
+			return (status);
+		}
 
-	status = acpi_os_map_memory (LO_RSDP_WINDOW_BASE, LO_RSDP_WINDOW_SIZE,
-			  (void **)&table_ptr);
+		mem_rover = acpi_tb_scan_memory_for_rsdp (table_ptr, LO_RSDP_WINDOW_SIZE);
+		acpi_os_unmap_memory (table_ptr, LO_RSDP_WINDOW_SIZE);
 
-	if (ACPI_FAILURE (status)) {
-		return (status);
+		if (mem_rover) {
+			/* Found it, return the physical address */
+
+			phys_addr = LO_RSDP_WINDOW_BASE;
+			phys_addr += (mem_rover - table_ptr);
+
+			table_info->physical_address = phys_addr;
+
+			return (AE_OK);
+		}
+
+		/*
+		 * 2) Search upper memory: 16-byte boundaries in E0000h-F0000h
+		 */
+		status = acpi_os_map_memory (HI_RSDP_WINDOW_BASE, HI_RSDP_WINDOW_SIZE,
+				  (void **) &table_ptr);
+		if (ACPI_FAILURE (status)) {
+			return (status);
+		}
+
+		mem_rover = acpi_tb_scan_memory_for_rsdp (table_ptr, HI_RSDP_WINDOW_SIZE);
+		acpi_os_unmap_memory (table_ptr, HI_RSDP_WINDOW_SIZE);
+
+		if (mem_rover) {
+			/* Found it, return the physical address */
+
+			phys_addr = HI_RSDP_WINDOW_BASE;
+			phys_addr += (mem_rover - table_ptr);
+
+			table_info->physical_address = phys_addr;
+
+			return (AE_OK);
+		}
 	}
 
+
 	/*
-	 * 1) Search EBDA (low memory) paragraphs
+	 * Physical addressing
 	 */
+	else {
+		/*
+		 * 1) Search EBDA (low memory) paragraphs
+		 */
+		mem_rover = acpi_tb_scan_memory_for_rsdp ((u8 *) LO_RSDP_WINDOW_BASE,
+				  LO_RSDP_WINDOW_SIZE);
+		if (mem_rover) {
+			/* Found it, return the physical address */
 
-	mem_rover = acpi_tb_scan_memory_for_rsdp (table_ptr, LO_RSDP_WINDOW_SIZE);
+			table_info->physical_address = (ACPI_TBLPTR) mem_rover;
+			return (AE_OK);
+		}
 
-	/* This mapping is no longer needed */
+		/*
+		 * 2) Search upper memory: 16-byte boundaries in E0000h-F0000h
+		 */
+		mem_rover = acpi_tb_scan_memory_for_rsdp ((u8 *) HI_RSDP_WINDOW_BASE,
+				  HI_RSDP_WINDOW_SIZE);
+		if (mem_rover) {
+			/* Found it, return the physical address */
 
-	acpi_os_unmap_memory (table_ptr, LO_RSDP_WINDOW_SIZE);
+			table_info->physical_address = (ACPI_TBLPTR) mem_rover;
+			return (AE_OK);
+		}
+	}
 
-	if (mem_rover) {
-		/* Found it, return the physical address */
 
-		phys_addr = LO_RSDP_WINDOW_BASE;
-		phys_addr += (mem_rover - table_ptr);
+	/* RSDP signature was not found */
 
-		table_info->physical_address = phys_addr;
+	return (AE_NOT_FOUND);
+}
 
-		return (AE_OK);
-	}
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_get_firmware_table
+ *
+ * PARAMETERS:  Signature       - Any ACPI table signature
+ *              Instance        - the non zero instance of the table, allows
+ *                                support for multiple tables of the same type
+ *              Flags           - 0: Physical/Virtual support
+ *              Ret_buffer      - pointer to a structure containing a buffer to
+ *                                receive the table
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: This function is called to get an ACPI table.  The caller
+ *              supplies an Out_buffer large enough to contain the entire ACPI
+ *              table.  Upon completion
+ *              the Out_buffer->Length field will indicate the number of bytes
+ *              copied into the Out_buffer->Buf_ptr buffer. This table will be
+ *              a complete table including the header.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_get_firmware_table (
+	ACPI_STRING             signature,
+	u32                     instance,
+	u32                     flags,
+	ACPI_TABLE_HEADER       **table_pointer)
+{
+	ACPI_PHYSICAL_ADDRESS   physical_address;
+	ACPI_TABLE_DESC         table_info;
+	ACPI_TABLE_HEADER       *rsdt_ptr;
+	ACPI_TABLE_HEADER       *table_ptr;
+	ACPI_STATUS             status;
+	u32                     rsdt_size;
+	u32                     table_size;
+	u32                     table_count;
+	u32                     i;
+	u32                     j;
 
 
 	/*
-	 * 2) Search upper memory: 16-byte boundaries in E0000h-F0000h
+	 * Ensure that at least the table manager is initialized.  We don't
+	 * require that the entire ACPI subsystem is up for this interface
 	 */
 
-	status = acpi_os_map_memory (HI_RSDP_WINDOW_BASE, HI_RSDP_WINDOW_SIZE,
-			  (void **)&table_ptr);
 
+	/*
+	 *  If we have a buffer, we must have a length too
+	 */
+	if ((instance == 0)                 ||
+		(!signature)                    ||
+		(!table_pointer)) {
+		return (AE_BAD_PARAMETER);
+	}
+
+	/* Get the RSDP by scanning low memory */
+
+	status = acpi_tb_find_rsdp (&table_info, flags);
+	if (ACPI_FAILURE (status)) {
+		return (AE_NO_ACPI_TABLES);
+	}
+
+	acpi_gbl_RSDP = (RSDP_DESCRIPTOR *) table_info.pointer;
+
+
+	/* Get the RSDT and validate it */
+
+	physical_address = acpi_tb_get_rsdt_address ();
+	status = acpi_tb_get_table_pointer (physical_address, flags, &rsdt_size, &rsdt_ptr);
 	if (ACPI_FAILURE (status)) {
 		return (status);
 	}
 
-	mem_rover = acpi_tb_scan_memory_for_rsdp (table_ptr, HI_RSDP_WINDOW_SIZE);
+	status = acpi_tb_validate_rsdt (rsdt_ptr);
+	if (ACPI_FAILURE (status)) {
+		goto cleanup;
+	}
+
 
-	/* This mapping is no longer needed */
+	/* Get the number of table pointers within the RSDT */
 
-	acpi_os_unmap_memory (table_ptr, HI_RSDP_WINDOW_SIZE);
+	table_count = acpi_tb_get_table_count (acpi_gbl_RSDP, rsdt_ptr);
 
-	if (mem_rover) {
-		/* Found it, return the physical address */
 
-		phys_addr = HI_RSDP_WINDOW_BASE;
-		phys_addr += (mem_rover - table_ptr);
+	/*
+	 * Search the RSDT/XSDT for the correct instance of the
+	 * requested table
+	 */
+	for (i = 0, j = 0; i < table_count; i++) {
+		/* Get the next table pointer */
+
+		if (acpi_gbl_RSDP->revision < 2) {
+			physical_address = ((RSDT_DESCRIPTOR *) rsdt_ptr)->table_offset_entry[i];
+		}
+		else {
+			physical_address = (ACPI_PHYSICAL_ADDRESS)
+				ACPI_GET_ADDRESS (((XSDT_DESCRIPTOR *) rsdt_ptr)->table_offset_entry[i]);
+		}
+
+		/* Get addressibility if necessary */
+
+		status = acpi_tb_get_table_pointer (physical_address, flags, &table_size, &table_ptr);
+		if (ACPI_FAILURE (status)) {
+			goto cleanup;
+		}
+
+		/* Compare table signatures and table instance */
 
-		table_info->physical_address = phys_addr;
+		if (!STRNCMP ((char *) table_ptr, signature, STRLEN (signature))) {
+			/* An instance of the table was found */
 
-		return (AE_OK);
+			j++;
+			if (j >= instance) {
+				/* Found the correct instance */
+
+				*table_pointer = table_ptr;
+				goto cleanup;
+			}
+		}
+
+		/* Delete table mapping if using virtual addressing */
+
+		if (table_size) {
+			acpi_os_unmap_memory (table_ptr, table_size);
+		}
 	}
 
+	/* Did not find the table */
 
-	/* RSDP signature was not found */
+	status = AE_NOT_EXIST;
 
-	return (AE_NOT_FOUND);
+
+cleanup:
+	if (rsdt_size) {
+		acpi_os_unmap_memory (rsdt_ptr, rsdt_size);
+	}
+	return (status);
 }
 
 
diff -urN linux-2.4.6-pre4/drivers/acpi/utilities/Makefile linux/drivers/acpi/utilities/Makefile
--- linux-2.4.6-pre4/drivers/acpi/utilities/Makefile	Wed Dec 31 16:00:00 1969
+++ linux/drivers/acpi/utilities/Makefile	Mon Dec  3 22:48:42 2001
@@ -0,0 +1,12 @@
+#
+# Makefile for all Linux ACPI interpreter subdirectories
+# EXCEPT for the ospm directory
+#
+
+O_TARGET := $(notdir $(CURDIR)).o
+
+obj-$(CONFIG_ACPI) := $(patsubst %.c,%.o,$(wildcard *.c))
+
+EXTRA_CFLAGS += $(ACPI_CFLAGS)
+
+include $(TOPDIR)/Rules.make
diff -urN linux-2.4.6-pre4/drivers/acpi/utilities/utalloc.c linux/drivers/acpi/utilities/utalloc.c
--- linux-2.4.6-pre4/drivers/acpi/utilities/utalloc.c	Wed Dec 31 16:00:00 1969
+++ linux/drivers/acpi/utilities/utalloc.c	Mon Dec  3 22:48:42 2001
@@ -0,0 +1,169 @@
+/******************************************************************************
+ *
+ * Module Name: utalloc - local memory allocation routines
+ *              $Revision: 90 $
+ *
+ *****************************************************************************/
+
+/*
+ *  Copyright (C) 2000, 2001 R. Byron Moore
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#include "acpi.h"
+#include "acparser.h"
+#include "acinterp.h"
+#include "acnamesp.h"
+#include "acglobal.h"
+
+#define _COMPONENT          ACPI_UTILITIES
+	 MODULE_NAME         ("utalloc")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    _Ut_allocate
+ *
+ * PARAMETERS:  Size                - Size of the allocation
+ *              Component           - Component type of caller
+ *              Module              - Source file name of caller
+ *              Line                - Line number of caller
+ *
+ * RETURN:      Address of the allocated memory on success, NULL on failure.
+ *
+ * DESCRIPTION: The subsystem's equivalent of malloc.
+ *
+ ******************************************************************************/
+
+void *
+_ut_allocate (
+	u32                     size,
+	u32                     component,
+	NATIVE_CHAR             *module,
+	u32                     line)
+{
+	void                    *address = NULL;
+
+
+	/* Check for an inadvertent size of zero bytes */
+
+	if (!size) {
+		_REPORT_ERROR (module, line, component,
+				("Ut_allocate: Attempt to allocate zero bytes\n"));
+		size = 1;
+	}
+
+	address = acpi_os_allocate (size);
+	if (!address) {
+		/* Report allocation error */
+
+		_REPORT_ERROR (module, line, component,
+				("Ut_allocate: Could not allocate size %X\n", size));
+
+		return (NULL);
+	}
+
+
+	return (address);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    _Ut_callocate
+ *
+ * PARAMETERS:  Size                - Size of the allocation
+ *              Component           - Component type of caller
+ *              Module              - Source file name of caller
+ *              Line                - Line number of caller
+ *
+ * RETURN:      Address of the allocated memory on success, NULL on failure.
+ *
+ * DESCRIPTION: Subsystem equivalent of calloc.
+ *
+ ******************************************************************************/
+
+void *
+_ut_callocate (
+	u32                     size,
+	u32                     component,
+	NATIVE_CHAR             *module,
+	u32                     line)
+{
+	void                    *address = NULL;
+
+
+	/* Check for an inadvertent size of zero bytes */
+
+	if (!size) {
+		_REPORT_ERROR (module, line, component,
+				("Ut_callocate: Attempt to allocate zero bytes\n"));
+		return (NULL);
+	}
+
+
+	address = acpi_os_callocate (size);
+	if (!address) {
+		/* Report allocation error */
+
+		_REPORT_ERROR (module, line, component,
+				("Ut_callocate: Could not allocate size %X\n", size));
+		return (NULL);
+	}
+
+
+	return (address);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    _Ut_free
+ *
+ * PARAMETERS:  Address             - Address of the memory to deallocate
+ *              Component           - Component type of caller
+ *              Module              - Source file name of caller
+ *              Line                - Line number of caller
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Frees the memory at Address
+ *
+ ******************************************************************************/
+
+void
+_ut_free (
+	void                    *address,
+	u32                     component,
+	NATIVE_CHAR             *module,
+	u32                     line)
+{
+
+	if (NULL == address) {
+		_REPORT_ERROR (module, line, component,
+			("_Ut_free: Trying to delete a NULL address\n"));
+
+		return;
+	}
+
+
+	acpi_os_free (address);
+
+	return;
+}
+
+
diff -urN linux-2.4.6-pre4/drivers/acpi/utilities/utcopy.c linux/drivers/acpi/utilities/utcopy.c
--- linux-2.4.6-pre4/drivers/acpi/utilities/utcopy.c	Wed Dec 31 16:00:00 1969
+++ linux/drivers/acpi/utilities/utcopy.c	Mon Dec  3 22:48:42 2001
@@ -0,0 +1,707 @@
+/******************************************************************************
+ *
+ * Module Name: utcopy - Internal to external object translation utilities
+ *              $Revision: 74 $
+ *
+ *****************************************************************************/
+
+/*
+ *  Copyright (C) 2000, 2001 R. Byron Moore
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#include "acpi.h"
+#include "acinterp.h"
+#include "acnamesp.h"
+#include "amlcode.h"
+
+
+#define _COMPONENT          ACPI_UTILITIES
+	 MODULE_NAME         ("utcopy")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ut_copy_isimple_to_esimple
+ *
+ * PARAMETERS:  *Internal_object    - Pointer to the object we are examining
+ *              *Buffer             - Where the object is returned
+ *              *Space_used         - Where the data length is returned
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: This function is called to place a simple object in a user
+ *              buffer.
+ *
+ *              The buffer is assumed to have sufficient space for the object.
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+acpi_ut_copy_isimple_to_esimple (
+	ACPI_OPERAND_OBJECT     *internal_object,
+	ACPI_OBJECT             *external_object,
+	u8                      *data_space,
+	u32                     *buffer_space_used)
+{
+	u32                     length = 0;
+	ACPI_STATUS             status = AE_OK;
+
+
+	/*
+	 * Check for NULL object case (could be an uninitialized
+	 * package element
+	 */
+
+	if (!internal_object) {
+		*buffer_space_used = 0;
+		return (AE_OK);
+	}
+
+	/* Always clear the external object */
+
+	MEMSET (external_object, 0, sizeof (ACPI_OBJECT));
+
+	/*
+	 * In general, the external object will be the same type as
+	 * the internal object
+	 */
+
+	external_object->type = internal_object->common.type;
+
+	/* However, only a limited number of external types are supported */
+
+	switch (internal_object->common.type) {
+
+	case ACPI_TYPE_STRING:
+
+		length = internal_object->string.length + 1;
+		external_object->string.length = internal_object->string.length;
+		external_object->string.pointer = (NATIVE_CHAR *) data_space;
+		MEMCPY ((void *) data_space, (void *) internal_object->string.pointer, length);
+		break;
+
+
+	case ACPI_TYPE_BUFFER:
+
+		length = internal_object->buffer.length;
+		external_object->buffer.length = internal_object->buffer.length;
+		external_object->buffer.pointer = data_space;
+		MEMCPY ((void *) data_space, (void *) internal_object->buffer.pointer, length);
+		break;
+
+
+	case ACPI_TYPE_INTEGER:
+
+		external_object->integer.value= internal_object->integer.value;
+		break;
+
+
+	case INTERNAL_TYPE_REFERENCE:
+
+		/*
+		 * This is an object reference.  Attempt to dereference it.
+		 */
+
+		switch (internal_object->reference.opcode) {
+		case AML_ZERO_OP:
+			external_object->type = ACPI_TYPE_INTEGER;
+			external_object->integer.value = 0;
+			break;
+
+		case AML_ONE_OP:
+			external_object->type = ACPI_TYPE_INTEGER;
+			external_object->integer.value = 1;
+			break;
+
+		case AML_ONES_OP:
+			external_object->type = ACPI_TYPE_INTEGER;
+			external_object->integer.value = ACPI_INTEGER_MAX;
+			break;
+
+		case AML_INT_NAMEPATH_OP:
+			/*
+			 * This is a named reference, get the string.  We already know that
+			 * we have room for it, use max length
+			 */
+			length = MAX_STRING_LENGTH;
+			external_object->type = ACPI_TYPE_STRING;
+			external_object->string.pointer = (NATIVE_CHAR *) data_space;
+			status = acpi_ns_handle_to_pathname ((ACPI_HANDLE *) internal_object->reference.node,
+					 &length, (char *) data_space);
+
+			/* Converted (external) string length is returned from above */
+
+			external_object->string.length = length;
+			break;
+
+		default:
+			/*
+			 * Use the object type of "Any" to indicate a reference
+			 * to object containing a handle to an ACPI named object.
+			 */
+			external_object->type = ACPI_TYPE_ANY;
+			external_object->reference.handle = internal_object->reference.node;
+			break;
+		}
+		break;
+
+
+	case ACPI_TYPE_PROCESSOR:
+
+		external_object->processor.proc_id = internal_object->processor.proc_id;
+		external_object->processor.pblk_address = internal_object->processor.address;
+		external_object->processor.pblk_length = internal_object->processor.length;
+		break;
+
+
+	case ACPI_TYPE_POWER:
+
+		external_object->power_resource.system_level =
+				   internal_object->power_resource.system_level;
+
+		external_object->power_resource.resource_order =
+				   internal_object->power_resource.resource_order;
+		break;
+
+
+	default:
+		/*
+		 * There is no corresponding external object type
+		 */
+		return (AE_SUPPORT);
+		break;
+	}
+
+
+	*buffer_space_used = (u32) ROUND_UP_TO_NATIVE_WORD (length);
+
+	return (status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ut_copy_ielement_to_eelement
+ *
+ * PARAMETERS:  ACPI_PKG_CALLBACK
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Copy one package element to another package element
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_ut_copy_ielement_to_eelement (
+	u8                      object_type,
+	ACPI_OPERAND_OBJECT     *source_object,
+	ACPI_GENERIC_STATE      *state,
+	void                    *context)
+{
+	ACPI_STATUS             status = AE_OK;
+	ACPI_PKG_INFO           *info = (ACPI_PKG_INFO *) context;
+	u32                     object_space;
+	u32                     this_index;
+	ACPI_OBJECT             *target_object;
+
+
+	this_index      = state->pkg.index;
+	target_object   = (ACPI_OBJECT *)
+			   &((ACPI_OBJECT *)(state->pkg.dest_object))->package.elements[this_index];
+
+
+	switch (object_type) {
+	case ACPI_COPY_TYPE_SIMPLE:
+
+		/*
+		 * This is a simple or null object -- get the size
+		 */
+
+		status = acpi_ut_copy_isimple_to_esimple (source_object,
+				  target_object, info->free_space, &object_space);
+		if (ACPI_FAILURE (status)) {
+			return (status);
+		}
+
+		break;
+
+	case ACPI_COPY_TYPE_PACKAGE:
+
+		/*
+		 * Build the package object
+		 */
+		target_object->type             = ACPI_TYPE_PACKAGE;
+		target_object->package.count    = source_object->package.count;
+		target_object->package.elements = (ACPI_OBJECT *) info->free_space;
+
+		/*
+		 * Pass the new package object back to the package walk routine
+		 */
+		state->pkg.this_target_obj = target_object;
+
+		/*
+		 * Save space for the array of objects (Package elements)
+		 * update the buffer length counter
+		 */
+		object_space = (u32) ROUND_UP_TO_NATIVE_WORD (
+				   target_object->package.count * sizeof (ACPI_OBJECT));
+		break;
+
+	default:
+		return (AE_BAD_PARAMETER);
+	}
+
+
+	info->free_space  += object_space;
+	info->length      += object_space;
+
+	return (status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ut_copy_ipackage_to_epackage
+ *
+ * PARAMETERS:  *Internal_object    - Pointer to the object we are returning
+ *              *Buffer             - Where the object is returned
+ *              *Space_used         - Where the object length is returned
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: This function is called to place a package object in a user
+ *              buffer.  A package object by definition contains other objects.
+ *
+ *              The buffer is assumed to have sufficient space for the object.
+ *              The caller must have verified the buffer length needed using the
+ *              Acpi_ut_get_object_size function before calling this function.
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+acpi_ut_copy_ipackage_to_epackage (
+	ACPI_OPERAND_OBJECT     *internal_object,
+	u8                      *buffer,
+	u32                     *space_used)
+{
+	ACPI_OBJECT             *external_object;
+	ACPI_STATUS             status;
+	ACPI_PKG_INFO           info;
+
+
+	/*
+	 * First package at head of the buffer
+	 */
+	external_object = (ACPI_OBJECT *) buffer;
+
+	/*
+	 * Free space begins right after the first package
+	 */
+	info.length      = 0;
+	info.object_space = 0;
+	info.num_packages = 1;
+	info.free_space  = buffer + ROUND_UP_TO_NATIVE_WORD (sizeof (ACPI_OBJECT));
+
+
+	external_object->type              = internal_object->common.type;
+	external_object->package.count     = internal_object->package.count;
+	external_object->package.elements  = (ACPI_OBJECT *) info.free_space;
+
+
+	/*
+	 * Build an array of ACPI_OBJECTS in the buffer
+	 * and move the free space past it
+	 */
+
+	info.free_space += external_object->package.count *
+			  ROUND_UP_TO_NATIVE_WORD (sizeof (ACPI_OBJECT));
+
+
+	status = acpi_ut_walk_package_tree (internal_object, external_object,
+			 acpi_ut_copy_ielement_to_eelement, &info);
+
+	*space_used = info.length;
+
+	return (status);
+
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ut_copy_iobject_to_eobject
+ *
+ * PARAMETERS:  *Internal_object    - The internal object to be converted
+ *              *Buffer_ptr         - Where the object is returned
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: This function is called to build an API object to be returned to
+ *              the caller.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_ut_copy_iobject_to_eobject (
+	ACPI_OPERAND_OBJECT     *internal_object,
+	ACPI_BUFFER             *ret_buffer)
+{
+	ACPI_STATUS             status;
+
+
+	if (IS_THIS_OBJECT_TYPE (internal_object, ACPI_TYPE_PACKAGE)) {
+		/*
+		 * Package object:  Copy all subobjects (including
+		 * nested packages)
+		 */
+		status = acpi_ut_copy_ipackage_to_epackage (internal_object,
+				  ret_buffer->pointer, &ret_buffer->length);
+	}
+
+	else {
+		/*
+		 * Build a simple object (no nested objects)
+		 */
+		status = acpi_ut_copy_isimple_to_esimple (internal_object,
+				  (ACPI_OBJECT *) ret_buffer->pointer,
+				  ((u8 *) ret_buffer->pointer +
+				  ROUND_UP_TO_NATIVE_WORD (sizeof (ACPI_OBJECT))),
+				  &ret_buffer->length);
+		/*
+		 * build simple does not include the object size in the length
+		 * so we add it in here
+		 */
+		ret_buffer->length += sizeof (ACPI_OBJECT);
+	}
+
+	return (status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ut_copy_esimple_to_isimple
+ *
+ * PARAMETERS:  *External_object   - The external object to be converted
+ *              *Internal_object   - Where the internal object is returned
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: This function copies an external object to an internal one.
+ *              NOTE: Pointers can be copied, we don't need to copy data.
+ *              (The pointers have to be valid in our address space no matter
+ *              what we do with them!)
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_ut_copy_esimple_to_isimple (
+	ACPI_OBJECT             *external_object,
+	ACPI_OPERAND_OBJECT     *internal_object)
+{
+
+
+	internal_object->common.type = (u8) external_object->type;
+
+	switch (external_object->type) {
+
+	case ACPI_TYPE_STRING:
+
+		internal_object->string.length = external_object->string.length;
+		internal_object->string.pointer = external_object->string.pointer;
+		break;
+
+
+	case ACPI_TYPE_BUFFER:
+
+		internal_object->buffer.length = external_object->buffer.length;
+		internal_object->buffer.pointer = external_object->buffer.pointer;
+		break;
+
+
+	case ACPI_TYPE_INTEGER:
+		/*
+		 * Number is included in the object itself
+		 */
+		internal_object->integer.value  = external_object->integer.value;
+		break;
+
+
+	default:
+		return (AE_CTRL_RETURN_VALUE);
+		break;
+	}
+
+
+	return (AE_OK);
+}
+
+
+#ifdef ACPI_FUTURE_IMPLEMENTATION
+
+/* Code to convert packages that are parameters to control methods */
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ut_copy_epackage_to_ipackage
+ *
+ * PARAMETERS:  *Internal_object   - Pointer to the object we are returning
+ *              *Buffer         - Where the object is returned
+ *              *Space_used     - Where the length of the object is returned
+ *
+ * RETURN:      Status          - the status of the call
+ *
+ * DESCRIPTION: This function is called to place a package object in a user
+ *              buffer.  A package object by definition contains other objects.
+ *
+ *              The buffer is assumed to have sufficient space for the object.
+ *              The caller must have verified the buffer length needed using the
+ *              Acpi_ut_get_object_size function before calling this function.
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+acpi_ut_copy_epackage_to_ipackage (
+	ACPI_OPERAND_OBJECT     *internal_object,
+	u8                      *buffer,
+	u32                     *space_used)
+{
+	u8                      *free_space;
+	ACPI_OBJECT             *external_object;
+	u32                     length = 0;
+	u32                     this_index;
+	u32                     object_space = 0;
+	ACPI_OPERAND_OBJECT     *this_internal_obj;
+	ACPI_OBJECT             *this_external_obj;
+
+
+	/*
+	 * First package at head of the buffer
+	 */
+	external_object = (ACPI_OBJECT *)buffer;
+
+	/*
+	 * Free space begins right after the first package
+	 */
+	free_space = buffer + sizeof(ACPI_OBJECT);
+
+
+	external_object->type              = internal_object->common.type;
+	external_object->package.count     = internal_object->package.count;
+	external_object->package.elements  = (ACPI_OBJECT *)free_space;
+
+
+	/*
+	 * Build an array of ACPI_OBJECTS in the buffer
+	 * and move the free space past it
+	 */
+
+	free_space += external_object->package.count * sizeof(ACPI_OBJECT);
+
+
+	/* Call Walk_package */
+
+}
+
+#endif /* Future implementation */
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ut_copy_eobject_to_iobject
+ *
+ * PARAMETERS:  *Internal_object   - The external object to be converted
+ *              *Buffer_ptr     - Where the internal object is returned
+ *
+ * RETURN:      Status          - the status of the call
+ *
+ * DESCRIPTION: Converts an external object to an internal object.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_ut_copy_eobject_to_iobject (
+	ACPI_OBJECT             *external_object,
+	ACPI_OPERAND_OBJECT     *internal_object)
+{
+	ACPI_STATUS             status;
+
+
+	if (external_object->type == ACPI_TYPE_PACKAGE) {
+		/*
+		 * Package objects contain other objects (which can be objects)
+		 * buildpackage does it all
+		 *
+		 * TBD: Package conversion must be completed and tested
+		 * NOTE: this code converts packages as input parameters to
+		 * control methods only.  This is a very, very rare case.
+		 */
+/*
+		Status = Acpi_ut_copy_epackage_to_ipackage(Internal_object,
+				 Ret_buffer->Pointer,
+				 &Ret_buffer->Length);
+*/
+		return (AE_NOT_IMPLEMENTED);
+	}
+
+	else {
+		/*
+		 * Build a simple object (no nested objects)
+		 */
+		status = acpi_ut_copy_esimple_to_isimple (external_object, internal_object);
+		/*
+		 * build simple does not include the object size in the length
+		 * so we add it in here
+		 */
+	}
+
+	return (status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ut_copy_ielement_to_ielement
+ *
+ * PARAMETERS:  ACPI_PKG_CALLBACK
+ *
+ * RETURN:      Status          - the status of the call
+ *
+ * DESCRIPTION: Copy one package element to another package element
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_ut_copy_ielement_to_ielement (
+	u8                      object_type,
+	ACPI_OPERAND_OBJECT     *source_object,
+	ACPI_GENERIC_STATE      *state,
+	void                    *context)
+{
+	ACPI_STATUS             status = AE_OK;
+	u32                     this_index;
+	ACPI_OPERAND_OBJECT     **this_target_ptr;
+	ACPI_OPERAND_OBJECT     *target_object;
+
+
+	this_index    = state->pkg.index;
+	this_target_ptr = (ACPI_OPERAND_OBJECT **)
+			   &state->pkg.dest_object->package.elements[this_index];
+
+	switch (object_type) {
+	case 0:
+
+		/*
+		 * This is a simple object, just copy it
+		 */
+		target_object = acpi_ut_create_internal_object (source_object->common.type);
+		if (!target_object) {
+			return (AE_NO_MEMORY);
+		}
+
+		status = acpi_ex_store_object_to_object (source_object, target_object,
+				  (ACPI_WALK_STATE *) context);
+		if (ACPI_FAILURE (status)) {
+			return (status);
+		}
+
+		*this_target_ptr = target_object;
+		break;
+
+
+	case 1:
+		/*
+		 * This object is a package - go down another nesting level
+		 * Create and build the package object
+		 */
+		target_object = acpi_ut_create_internal_object (ACPI_TYPE_PACKAGE);
+		if (!target_object) {
+			/* TBD: must delete package created up to this point */
+
+			return (AE_NO_MEMORY);
+		}
+
+		target_object->package.count = source_object->package.count;
+
+		/*
+		 * Pass the new package object back to the package walk routine
+		 */
+		state->pkg.this_target_obj = target_object;
+
+		/*
+		 * Store the object pointer in the parent package object
+		 */
+		*this_target_ptr = target_object;
+		break;
+
+	default:
+		return (AE_BAD_PARAMETER);
+	}
+
+
+	return (status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ut_copy_ipackage_to_ipackage
+ *
+ * PARAMETERS:  *Source_obj     - Pointer to the source package object
+ *              *Dest_obj       - Where the internal object is returned
+ *
+ * RETURN:      Status          - the status of the call
+ *
+ * DESCRIPTION: This function is called to copy an internal package object
+ *              into another internal package object.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_ut_copy_ipackage_to_ipackage (
+	ACPI_OPERAND_OBJECT     *source_obj,
+	ACPI_OPERAND_OBJECT     *dest_obj,
+	ACPI_WALK_STATE         *walk_state)
+{
+	ACPI_STATUS             status = AE_OK;
+
+
+	dest_obj->common.type   = source_obj->common.type;
+	dest_obj->package.count = source_obj->package.count;
+
+
+	/*
+	 * Create the object array and walk the source package tree
+	 */
+
+	dest_obj->package.elements = acpi_ut_callocate ((source_obj->package.count + 1) *
+			 sizeof (void *));
+	dest_obj->package.next_element = dest_obj->package.elements;
+
+	if (!dest_obj->package.elements) {
+		REPORT_ERROR (
+			("Aml_build_copy_internal_package_object: Package allocation failure\n"));
+		return (AE_NO_MEMORY);
+	}
+
+
+	status = acpi_ut_walk_package_tree (source_obj, dest_obj,
+			 acpi_ut_copy_ielement_to_ielement, walk_state);
+
+	return (status);
+}
+
diff -urN linux-2.4.6-pre4/drivers/acpi/utilities/utdebug.c linux/drivers/acpi/utilities/utdebug.c
--- linux-2.4.6-pre4/drivers/acpi/utilities/utdebug.c	Wed Dec 31 16:00:00 1969
+++ linux/drivers/acpi/utilities/utdebug.c	Mon Dec  3 22:48:42 2001
@@ -0,0 +1,594 @@
+/******************************************************************************
+ *
+ * Module Name: utdebug - Debug print routines
+ *              $Revision: 72 $
+ *
+ *****************************************************************************/
+
+/*
+ *  Copyright (C) 2000, 2001 R. Byron Moore
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#include "acpi.h"
+
+#define _COMPONENT          ACPI_UTILITIES
+	 MODULE_NAME         ("utdebug")
+
+
+u32             prev_thread_id = 0xFFFFFFFF;
+
+/*****************************************************************************
+ *
+ * FUNCTION:    Get/Set debug level
+ *
+ * DESCRIPTION: Get or set value of the debug flag
+ *
+ *              These are used to allow user's to get/set the debug level
+ *
+ ****************************************************************************/
+
+
+u32
+get_debug_level (void)
+{
+
+	return (acpi_dbg_level);
+}
+
+void
+set_debug_level (
+	u32                     new_debug_level)
+{
+
+	acpi_dbg_level = new_debug_level;
+}
+
+
+/*****************************************************************************
+ *
+ * FUNCTION:    Function_trace
+ *
+ * PARAMETERS:  Module_name         - Caller's module name (for error output)
+ *              Line_number         - Caller's line number (for error output)
+ *              Component_id        - Caller's component ID (for error output)
+ *              Function_name       - Name of Caller's function
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Function entry trace.  Prints only if TRACE_FUNCTIONS bit is
+ *              set in Debug_level
+ *
+ ****************************************************************************/
+
+void
+function_trace (
+	NATIVE_CHAR             *module_name,
+	u32                     line_number,
+	u32                     component_id,
+	NATIVE_CHAR             *function_name)
+{
+
+	acpi_gbl_nesting_level++;
+
+	debug_print (module_name, line_number, component_id,
+			 TRACE_FUNCTIONS,
+			 " %2.2ld Entered Function: %s\n",
+			 acpi_gbl_nesting_level, function_name);
+}
+
+
+/*****************************************************************************
+ *
+ * FUNCTION:    Function_trace_ptr
+ *
+ * PARAMETERS:  Module_name         - Caller's module name (for error output)
+ *              Line_number         - Caller's line number (for error output)
+ *              Component_id        - Caller's component ID (for error output)
+ *              Function_name       - Name of Caller's function
+ *              Pointer             - Pointer to display
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Function entry trace.  Prints only if TRACE_FUNCTIONS bit is
+ *              set in Debug_level
+ *
+ ****************************************************************************/
+
+void
+function_trace_ptr (
+	NATIVE_CHAR             *module_name,
+	u32                     line_number,
+	u32                     component_id,
+	NATIVE_CHAR             *function_name,
+	void                    *pointer)
+{
+
+	acpi_gbl_nesting_level++;
+	debug_print (module_name, line_number, component_id, TRACE_FUNCTIONS,
+			 " %2.2ld Entered Function: %s, %p\n",
+			 acpi_gbl_nesting_level, function_name, pointer);
+}
+
+
+/*****************************************************************************
+ *
+ * FUNCTION:    Function_trace_str
+ *
+ * PARAMETERS:  Module_name         - Caller's module name (for error output)
+ *              Line_number         - Caller's line number (for error output)
+ *              Component_id        - Caller's component ID (for error output)
+ *              Function_name       - Name of Caller's function
+ *              String              - Additional string to display
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Function entry trace.  Prints only if TRACE_FUNCTIONS bit is
+ *              set in Debug_level
+ *
+ ****************************************************************************/
+
+void
+function_trace_str (
+	NATIVE_CHAR             *module_name,
+	u32                     line_number,
+	u32                     component_id,
+	NATIVE_CHAR             *function_name,
+	NATIVE_CHAR             *string)
+{
+
+	acpi_gbl_nesting_level++;
+	debug_print (module_name, line_number, component_id, TRACE_FUNCTIONS,
+			 " %2.2ld Entered Function: %s, %s\n",
+			 acpi_gbl_nesting_level, function_name, string);
+}
+
+
+/*****************************************************************************
+ *
+ * FUNCTION:    Function_trace_u32
+ *
+ * PARAMETERS:  Module_name         - Caller's module name (for error output)
+ *              Line_number         - Caller's line number (for error output)
+ *              Component_id        - Caller's component ID (for error output)
+ *              Function_name       - Name of Caller's function
+ *              Integer             - Integer to display
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Function entry trace.  Prints only if TRACE_FUNCTIONS bit is
+ *              set in Debug_level
+ *
+ ****************************************************************************/
+
+void
+function_trace_u32 (
+	NATIVE_CHAR             *module_name,
+	u32                     line_number,
+	u32                     component_id,
+	NATIVE_CHAR             *function_name,
+	u32                     integer)
+{
+
+	acpi_gbl_nesting_level++;
+	debug_print (module_name, line_number, component_id, TRACE_FUNCTIONS,
+			 " %2.2ld Entered Function: %s, %lX\n",
+			 acpi_gbl_nesting_level, function_name, integer);
+}
+
+
+/*****************************************************************************
+ *
+ * FUNCTION:    Function_exit
+ *
+ * PARAMETERS:  Module_name         - Caller's module name (for error output)
+ *              Line_number         - Caller's line number (for error output)
+ *              Component_id        - Caller's component ID (for error output)
+ *              Function_name       - Name of Caller's function
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Function exit trace.  Prints only if TRACE_FUNCTIONS bit is
+ *              set in Debug_level
+ *
+ ****************************************************************************/
+
+void
+function_exit (
+	NATIVE_CHAR             *module_name,
+	u32                     line_number,
+	u32                     component_id,
+	NATIVE_CHAR             *function_name)
+{
+
+	debug_print (module_name, line_number, component_id, TRACE_FUNCTIONS,
+			 " %2.2ld Exiting Function: %s\n",
+			 acpi_gbl_nesting_level, function_name);
+
+	acpi_gbl_nesting_level--;
+}
+
+
+/*****************************************************************************
+ *
+ * FUNCTION:    Function_status_exit
+ *
+ * PARAMETERS:  Module_name         - Caller's module name (for error output)
+ *              Line_number         - Caller's line number (for error output)
+ *              Component_id        - Caller's component ID (for error output)
+ *              Function_name       - Name of Caller's function
+ *              Status              - Exit status code
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Function exit trace.  Prints only if TRACE_FUNCTIONS bit is
+ *              set in Debug_level. Prints exit status also.
+ *
+ ****************************************************************************/
+
+void
+function_status_exit (
+	NATIVE_CHAR             *module_name,
+	u32                     line_number,
+	u32                     component_id,
+	NATIVE_CHAR             *function_name,
+	ACPI_STATUS             status)
+{
+
+	debug_print (module_name, line_number, component_id,
+		TRACE_FUNCTIONS,
+		" %2.2ld Exiting Function: %s, %s\n",
+		acpi_gbl_nesting_level,
+		function_name,
+		acpi_ut_format_exception (status));
+
+	acpi_gbl_nesting_level--;
+}
+
+
+/*****************************************************************************
+ *
+ * FUNCTION:    Function_value_exit
+ *
+ * PARAMETERS:  Module_name         - Caller's module name (for error output)
+ *              Line_number         - Caller's line number (for error output)
+ *              Component_id        - Caller's component ID (for error output)
+ *              Function_name       - Name of Caller's function
+ *              Value               - Value to be printed with exit msg
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Function exit trace.  Prints only if TRACE_FUNCTIONS bit is
+ *              set in Debug_level. Prints exit value also.
+ *
+ ****************************************************************************/
+
+void
+function_value_exit (
+	NATIVE_CHAR             *module_name,
+	u32                     line_number,
+	u32                     component_id,
+	NATIVE_CHAR             *function_name,
+	ACPI_INTEGER            value)
+{
+
+	debug_print (module_name, line_number, component_id, TRACE_FUNCTIONS,
+			 " %2.2ld Exiting Function: %s, %X\n",
+			 acpi_gbl_nesting_level, function_name, value);
+
+	acpi_gbl_nesting_level--;
+}
+
+
+/*****************************************************************************
+ *
+ * FUNCTION:    Function_ptr_exit
+ *
+ * PARAMETERS:  Module_name         - Caller's module name (for error output)
+ *              Line_number         - Caller's line number (for error output)
+ *              Component_id        - Caller's component ID (for error output)
+ *              Function_name       - Name of Caller's function
+ *              Value               - Value to be printed with exit msg
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Function exit trace.  Prints only if TRACE_FUNCTIONS bit is
+ *              set in Debug_level. Prints exit value also.
+ *
+ ****************************************************************************/
+
+void
+function_ptr_exit (
+	NATIVE_CHAR             *module_name,
+	u32                     line_number,
+	u32                     component_id,
+	NATIVE_CHAR             *function_name,
+	u8                      *ptr)
+{
+
+	debug_print (module_name, line_number, component_id, TRACE_FUNCTIONS,
+			 " %2.2ld Exiting Function: %s, %p\n",
+			 acpi_gbl_nesting_level, function_name, ptr);
+
+	acpi_gbl_nesting_level--;
+}
+
+
+/*****************************************************************************
+ *
+ * FUNCTION:    Debug_print
+ *
+ * PARAMETERS:  Module_name         - Caller's module name (for error output)
+ *              Line_number         - Caller's line number (for error output)
+ *              Component_id        - Caller's component ID (for error output)
+ *              Print_level         - Requested debug print level
+ *              Format              - Printf format field
+ *              ...                 - Optional printf arguments
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Print error message with prefix consisting of the module name,
+ *              line number, and component ID.
+ *
+ ****************************************************************************/
+
+void
+debug_print (
+	NATIVE_CHAR             *module_name,
+	u32                     line_number,
+	u32                     component_id,
+	u32                     print_level,
+	NATIVE_CHAR             *format,
+	...)
+{
+	va_list                 args;
+	u32                     thread_id;
+
+
+	thread_id = acpi_os_get_thread_id ();
+
+
+	/* Both the level and the component must be enabled */
+
+	if ((print_level & acpi_dbg_level) &&
+		(component_id & acpi_dbg_layer)) {
+		va_start (args, format);
+
+		if (thread_id != prev_thread_id) {
+			if (TRACE_THREADS & acpi_dbg_level) {
+				acpi_os_printf ("\n**** Context Switch from TID %X to TID %X ****\n\n",
+					prev_thread_id, thread_id);
+			}
+
+			prev_thread_id = thread_id;
+		}
+
+		if (TRACE_THREADS & acpi_dbg_level) {
+			acpi_os_printf ("%8s-%04d[%04X]: ", module_name, line_number, thread_id);
+		}
+		else {
+			acpi_os_printf ("%8s-%04d: ", module_name, line_number);
+		}
+
+		acpi_os_vprintf (format, args);
+	}
+}
+
+
+/*****************************************************************************
+ *
+ * FUNCTION:    Debug_print_prefix
+ *
+ * PARAMETERS:  Module_name         - Caller's module name (for error output)
+ *              Line_number         - Caller's line number (for error output)
+ *              Component_id        - Caller's component ID (for error output)
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Print the prefix part of an error message, consisting of the
+ *              module name, and line number
+ *
+ ****************************************************************************/
+
+void
+debug_print_prefix (
+	NATIVE_CHAR             *module_name,
+	u32                     line_number)
+{
+	u32                     thread_id;
+
+
+	thread_id = acpi_os_get_thread_id ();
+
+	if (thread_id != prev_thread_id) {
+		if (TRACE_THREADS & acpi_dbg_level) {
+			acpi_os_printf ("\n**** Context Switch from TID %X to TID %X ****\n\n",
+				prev_thread_id, thread_id);
+		}
+
+		prev_thread_id = thread_id;
+	}
+
+	if (TRACE_THREADS & acpi_dbg_level) {
+		acpi_os_printf ("%8s-%04d[%04X]: ", module_name, line_number, thread_id);
+	}
+	else {
+		acpi_os_printf ("%8s-%04d: ", module_name, line_number);
+	}
+
+}
+
+
+/*****************************************************************************
+ *
+ * FUNCTION:    Debug_print_raw
+ *
+ * PARAMETERS:  Format              - Printf format field
+ *              ...                 - Optional printf arguments
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Print error message -- without module/line indentifiers
+ *
+ ****************************************************************************/
+
+void
+debug_print_raw (
+	NATIVE_CHAR             *format,
+	...)
+{
+	va_list                 args;
+
+
+	va_start (args, format);
+
+	acpi_os_vprintf (format, args);
+
+	va_end (args);
+}
+
+
+/*****************************************************************************
+ *
+ * FUNCTION:    Acpi_ut_dump_buffer
+ *
+ * PARAMETERS:  Buffer              - Buffer to dump
+ *              Count               - Amount to dump, in bytes
+ *              Component_iD        - Caller's component ID
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Generic dump buffer in both hex and ascii.
+ *
+ ****************************************************************************/
+
+void
+acpi_ut_dump_buffer (
+	u8                      *buffer,
+	u32                     count,
+	u32                     display,
+	u32                     component_id)
+{
+	u32                     i = 0;
+	u32                     j;
+	u32                     temp32;
+	u8                      buf_char;
+
+
+	/* Only dump the buffer if tracing is enabled */
+
+	if (!((TRACE_TABLES & acpi_dbg_level) &&
+		(component_id & acpi_dbg_layer))) {
+		return;
+	}
+
+
+	/*
+	 * Nasty little dump buffer routine!
+	 */
+	while (i < count) {
+		/* Print current offset */
+
+		acpi_os_printf ("%05X  ", i);
+
+
+		/* Print 16 hex chars */
+
+		for (j = 0; j < 16;) {
+			if (i + j >= count) {
+				acpi_os_printf ("\n");
+				return;
+			}
+
+			/* Make sure that the s8 doesn't get sign-extended! */
+
+			switch (display) {
+			/* Default is BYTE display */
+
+			default:
+
+				acpi_os_printf ("%02X ",
+						*((u8 *) &buffer[i + j]));
+				j += 1;
+				break;
+
+
+			case DB_WORD_DISPLAY:
+
+				MOVE_UNALIGNED16_TO_32 (&temp32,
+						 &buffer[i + j]);
+				acpi_os_printf ("%04X ", temp32);
+				j += 2;
+				break;
+
+
+			case DB_DWORD_DISPLAY:
+
+				MOVE_UNALIGNED32_TO_32 (&temp32,
+						 &buffer[i + j]);
+				acpi_os_printf ("%08X ", temp32);
+				j += 4;
+				break;
+
+
+			case DB_QWORD_DISPLAY:
+
+				MOVE_UNALIGNED32_TO_32 (&temp32,
+						 &buffer[i + j]);
+				acpi_os_printf ("%08X", temp32);
+
+				MOVE_UNALIGNED32_TO_32 (&temp32,
+						 &buffer[i + j + 4]);
+				acpi_os_printf ("%08X ", temp32);
+				j += 8;
+				break;
+			}
+		}
+
+
+		/*
+		 * Print the ASCII equivalent characters
+		 * But watch out for the bad unprintable ones...
+		 */
+
+		for (j = 0; j < 16; j++) {
+			if (i + j >= count) {
+				acpi_os_printf ("\n");
+				return;
+			}
+
+			buf_char = buffer[i + j];
+			if ((buf_char > 0x1F && buf_char < 0x2E) ||
+				(buf_char > 0x2F && buf_char < 0x61) ||
+				(buf_char > 0x60 && buf_char < 0x7F)) {
+				acpi_os_printf ("%c", buf_char);
+			}
+			else {
+				acpi_os_printf (".");
+			}
+		}
+
+		/* Done with that line. */
+
+		acpi_os_printf ("\n");
+		i += 16;
+	}
+
+	return;
+}
+
+
diff -urN linux-2.4.6-pre4/drivers/acpi/utilities/utdelete.c linux/drivers/acpi/utilities/utdelete.c
--- linux-2.4.6-pre4/drivers/acpi/utilities/utdelete.c	Wed Dec 31 16:00:00 1969
+++ linux/drivers/acpi/utilities/utdelete.c	Mon Dec  3 22:48:42 2001
@@ -0,0 +1,602 @@
+/*******************************************************************************
+ *
+ * Module Name: utdelete - object deletion and reference count utilities
+ *              $Revision: 71 $
+ *
+ ******************************************************************************/
+
+/*
+ *  Copyright (C) 2000, 2001 R. Byron Moore
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#include "acpi.h"
+#include "acinterp.h"
+#include "acnamesp.h"
+#include "actables.h"
+#include "acparser.h"
+
+#define _COMPONENT          ACPI_UTILITIES
+	 MODULE_NAME         ("utdelete")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ut_delete_internal_obj
+ *
+ * PARAMETERS:  *Object        - Pointer to the list to be deleted
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Low level object deletion, after reference counts have been
+ *              updated (All reference counts, including sub-objects!)
+ *
+ ******************************************************************************/
+
+void
+acpi_ut_delete_internal_obj (
+	ACPI_OPERAND_OBJECT     *object)
+{
+	void                    *obj_pointer = NULL;
+	ACPI_OPERAND_OBJECT     *handler_desc;
+
+
+	if (!object) {
+		return;
+	}
+
+	/*
+	 * Must delete or free any pointers within the object that are not
+	 * actual ACPI objects (for example, a raw buffer pointer).
+	 */
+
+	switch (object->common.type) {
+
+	case ACPI_TYPE_STRING:
+
+		/* Free the actual string buffer */
+
+		obj_pointer = object->string.pointer;
+		break;
+
+
+	case ACPI_TYPE_BUFFER:
+
+		/* Free the actual buffer */
+
+		obj_pointer = object->buffer.pointer;
+		break;
+
+
+	case ACPI_TYPE_PACKAGE:
+
+		/*
+		 * Elements of the package are not handled here, they are deleted
+		 * separately
+		 */
+
+		/* Free the (variable length) element pointer array */
+
+		obj_pointer = object->package.elements;
+		break;
+
+
+	case ACPI_TYPE_MUTEX:
+
+		acpi_ex_unlink_mutex (object);
+		acpi_os_delete_semaphore (object->mutex.semaphore);
+		break;
+
+
+	case ACPI_TYPE_EVENT:
+
+		acpi_os_delete_semaphore (object->event.semaphore);
+		object->event.semaphore = NULL;
+		break;
+
+
+	case ACPI_TYPE_METHOD:
+
+		/* Delete the method semaphore if it exists */
+
+		if (object->method.semaphore) {
+			acpi_os_delete_semaphore (object->method.semaphore);
+			object->method.semaphore = NULL;
+		}
+
+		break;
+
+
+	case ACPI_TYPE_REGION:
+
+		if (object->region.extra) {
+			/*
+			 * Free the Region_context if and only if the handler is one of the
+			 * default handlers -- and therefore, we created the context object
+			 * locally, it was not created by an external caller.
+			 */
+			handler_desc = object->region.addr_handler;
+			if ((handler_desc) &&
+				(handler_desc->addr_handler.hflags == ADDR_HANDLER_DEFAULT_INSTALLED)) {
+				obj_pointer = object->region.extra->extra.region_context;
+			}
+
+			/* Now we can free the Extra object */
+
+			acpi_ut_delete_object_desc (object->region.extra);
+		}
+		break;
+
+
+	case ACPI_TYPE_BUFFER_FIELD:
+
+		if (object->buffer_field.extra) {
+			acpi_ut_delete_object_desc (object->buffer_field.extra);
+		}
+		break;
+
+	default:
+		break;
+	}
+
+
+	/*
+	 * Delete any allocated memory found above
+	 */
+	if (obj_pointer) {
+		if (!acpi_tb_system_table_pointer (obj_pointer)) {
+			acpi_ut_free (obj_pointer);
+		}
+	}
+
+
+	/* Only delete the object if it was dynamically allocated */
+
+
+	if (!(object->common.flags & AOPOBJ_STATIC_ALLOCATION)) {
+		acpi_ut_delete_object_desc (object);
+	}
+
+	return;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ut_delete_internal_object_list
+ *
+ * PARAMETERS:  *Obj_list       - Pointer to the list to be deleted
+ *
+ * RETURN:      Status          - the status of the call
+ *
+ * DESCRIPTION: This function deletes an internal object list, including both
+ *              simple objects and package objects
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_ut_delete_internal_object_list (
+	ACPI_OPERAND_OBJECT     **obj_list)
+{
+	ACPI_OPERAND_OBJECT     **internal_obj;
+
+
+	/* Walk the null-terminated internal list */
+
+	for (internal_obj = obj_list; *internal_obj; internal_obj++) {
+		/*
+		 * Check for a package
+		 * Simple objects are simply stored in the array and do not
+		 * need to be deleted separately.
+		 */
+
+		if (IS_THIS_OBJECT_TYPE ((*internal_obj), ACPI_TYPE_PACKAGE)) {
+			/* Delete the package */
+
+			/*
+			 * TBD: [Investigate] This might not be the right thing to do,
+			 * depending on how the internal package object was allocated!!!
+			 */
+			acpi_ut_delete_internal_obj (*internal_obj);
+		}
+
+	}
+
+	/* Free the combined parameter pointer list and object array */
+
+	acpi_ut_free (obj_list);
+
+	return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ut_update_ref_count
+ *
+ * PARAMETERS:  *Object         - Object whose ref count is to be updated
+ *              Action          - What to do
+ *
+ * RETURN:      New ref count
+ *
+ * DESCRIPTION: Modify the ref count and return it.
+ *
+ ******************************************************************************/
+
+static void
+acpi_ut_update_ref_count (
+	ACPI_OPERAND_OBJECT     *object,
+	u32                     action)
+{
+	u16                     count;
+	u16                     new_count;
+
+
+	PROC_NAME ("Ut_update_ref_count");
+
+	if (!object) {
+		return;
+	}
+
+
+	count = object->common.reference_count;
+	new_count = count;
+
+	/*
+	 * Reference count action (increment, decrement, or force delete)
+	 */
+
+	switch (action) {
+
+	case REF_INCREMENT:
+
+		new_count++;
+		object->common.reference_count = new_count;
+
+		break;
+
+
+	case REF_DECREMENT:
+
+		if (count < 1) {
+			new_count = 0;
+		}
+
+		else {
+			new_count--;
+
+		}
+
+
+		object->common.reference_count = new_count;
+		if (new_count == 0) {
+			acpi_ut_delete_internal_obj (object);
+		}
+
+		break;
+
+
+	case REF_FORCE_DELETE:
+
+		new_count = 0;
+		object->common.reference_count = new_count;
+		acpi_ut_delete_internal_obj (object);
+		break;
+
+
+	default:
+
+		break;
+	}
+
+
+	/*
+	 * Sanity check the reference count, for debug purposes only.
+	 * (A deleted object will have a huge reference count)
+	 */
+
+
+	return;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ut_update_object_reference
+ *
+ * PARAMETERS:  *Object             - Increment ref count for this object
+ *                                    and all sub-objects
+ *              Action              - Either REF_INCREMENT or REF_DECREMENT or
+ *                                    REF_FORCE_DELETE
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Increment the object reference count
+ *
+ * Object references are incremented when:
+ * 1) An object is attached to a Node (namespace object)
+ * 2) An object is copied (all subobjects must be incremented)
+ *
+ * Object references are decremented when:
+ * 1) An object is detached from an Node
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_ut_update_object_reference (
+	ACPI_OPERAND_OBJECT     *object,
+	u16                     action)
+{
+	ACPI_STATUS             status;
+	u32                     i;
+	ACPI_OPERAND_OBJECT     *next;
+	ACPI_OPERAND_OBJECT     *new;
+	ACPI_GENERIC_STATE       *state_list = NULL;
+	ACPI_GENERIC_STATE       *state;
+
+
+	/* Ignore a null object ptr */
+
+	if (!object) {
+		return (AE_OK);
+	}
+
+
+	/*
+	 * Make sure that this isn't a namespace handle or an AML pointer
+	 */
+
+	if (VALID_DESCRIPTOR_TYPE (object, ACPI_DESC_TYPE_NAMED)) {
+		return (AE_OK);
+	}
+
+	if (acpi_tb_system_table_pointer (object)) {
+		return (AE_OK);
+	}
+
+
+	state = acpi_ut_create_update_state (object, action);
+
+	while (state) {
+		object = state->update.object;
+		action = state->update.value;
+		acpi_ut_delete_generic_state (state);
+
+		/*
+		 * All sub-objects must have their reference count incremented also.
+		 * Different object types have different subobjects.
+		 */
+		switch (object->common.type) {
+
+		case ACPI_TYPE_DEVICE:
+
+			status = acpi_ut_create_update_state_and_push (object->device.addr_handler,
+					   action, &state_list);
+			if (ACPI_FAILURE (status)) {
+				return (status);
+			}
+
+			acpi_ut_update_ref_count (object->device.sys_handler, action);
+			acpi_ut_update_ref_count (object->device.drv_handler, action);
+			break;
+
+
+		case INTERNAL_TYPE_ADDRESS_HANDLER:
+
+			/* Must walk list of address handlers */
+
+			next = object->addr_handler.next;
+			while (next) {
+				new = next->addr_handler.next;
+				acpi_ut_update_ref_count (next, action);
+
+				next = new;
+			}
+			break;
+
+
+		case ACPI_TYPE_PACKAGE:
+
+			/*
+			 * We must update all the sub-objects of the package
+			 * (Each of whom may have their own sub-objects, etc.
+			 */
+			for (i = 0; i < object->package.count; i++) {
+				/*
+				 * Push each element onto the stack for later processing.
+				 * Note: There can be null elements within the package,
+				 * these are simply ignored
+				 */
+
+				status = acpi_ut_create_update_state_and_push (
+						 object->package.elements[i], action, &state_list);
+				if (ACPI_FAILURE (status)) {
+					return (status);
+				}
+			}
+			break;
+
+
+		case ACPI_TYPE_BUFFER_FIELD:
+
+			status = acpi_ut_create_update_state_and_push (
+					 object->buffer_field.buffer_obj, action, &state_list);
+
+			if (ACPI_FAILURE (status)) {
+				return (status);
+			}
+			break;
+
+
+		case INTERNAL_TYPE_REGION_FIELD:
+
+			status = acpi_ut_create_update_state_and_push (
+					 object->field.region_obj, action, &state_list);
+			if (ACPI_FAILURE (status)) {
+				return (status);
+			}
+		   break;
+
+
+		case INTERNAL_TYPE_BANK_FIELD:
+
+			status = acpi_ut_create_update_state_and_push (
+					 object->bank_field.bank_register_obj, action, &state_list);
+			if (ACPI_FAILURE (status)) {
+				return (status);
+			}
+
+			status = acpi_ut_create_update_state_and_push (
+					 object->bank_field.region_obj, action, &state_list);
+			if (ACPI_FAILURE (status)) {
+				return (status);
+			}
+			break;
+
+
+		case INTERNAL_TYPE_INDEX_FIELD:
+
+			status = acpi_ut_create_update_state_and_push (
+					 object->index_field.index_obj, action, &state_list);
+			if (ACPI_FAILURE (status)) {
+				return (status);
+			}
+
+			status = acpi_ut_create_update_state_and_push (
+					 object->index_field.data_obj, action, &state_list);
+			if (ACPI_FAILURE (status)) {
+				return (status);
+			}
+			break;
+
+
+		case ACPI_TYPE_REGION:
+
+	/* TBD: [Investigate]
+			Acpi_ut_update_ref_count (Object->Region.Addr_handler, Action);
+	*/
+/*
+			Status =
+				Acpi_ut_create_update_state_and_push (Object->Region.Addr_handler,
+						   Action, &State_list);
+			if (ACPI_FAILURE (Status))
+			{
+				return (Status);
+			}
+*/
+			break;
+
+
+		case INTERNAL_TYPE_REFERENCE:
+
+			break;
+		}
+
+
+		/*
+		 * Now we can update the count in the main object.  This can only
+		 * happen after we update the sub-objects in case this causes the
+		 * main object to be deleted.
+		 */
+
+		acpi_ut_update_ref_count (object, action);
+
+
+		/* Move on to the next object to be updated */
+
+		state = acpi_ut_pop_generic_state (&state_list);
+	}
+
+
+	return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ut_add_reference
+ *
+ * PARAMETERS:  *Object        - Object whose reference count is to be
+ *                                  incremented
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Add one reference to an ACPI object
+ *
+ ******************************************************************************/
+
+void
+acpi_ut_add_reference (
+	ACPI_OPERAND_OBJECT     *object)
+{
+
+
+	/*
+	 * Ensure that we have a valid object
+	 */
+
+	if (!acpi_ut_valid_internal_object (object)) {
+		return;
+	}
+
+	/*
+	 * We have a valid ACPI internal object, now increment the reference count
+	 */
+
+	acpi_ut_update_object_reference (object, REF_INCREMENT);
+
+	return;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ut_remove_reference
+ *
+ * PARAMETERS:  *Object        - Object whose ref count will be decremented
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Decrement the reference count of an ACPI internal object
+ *
+ ******************************************************************************/
+
+void
+acpi_ut_remove_reference (
+	ACPI_OPERAND_OBJECT     *object)
+{
+
+
+	/*
+	 * Ensure that we have a valid object
+	 */
+
+	if (!acpi_ut_valid_internal_object (object)) {
+		return;
+	}
+
+	/*
+	 * Decrement the reference count, and only actually delete the object
+	 * if the reference count becomes 0.  (Must also decrement the ref count
+	 * of all subobjects!)
+	 */
+
+	acpi_ut_update_object_reference (object, REF_DECREMENT);
+	return;
+}
+
+
diff -urN linux-2.4.6-pre4/drivers/acpi/utilities/uteval.c linux/drivers/acpi/utilities/uteval.c
--- linux-2.4.6-pre4/drivers/acpi/utilities/uteval.c	Wed Dec 31 16:00:00 1969
+++ linux/drivers/acpi/utilities/uteval.c	Mon Dec  3 22:48:42 2001
@@ -0,0 +1,308 @@
+/******************************************************************************
+ *
+ * Module Name: uteval - Object evaluation
+ *              $Revision: 27 $
+ *
+ *****************************************************************************/
+
+/*
+ *  Copyright (C) 2000, 2001 R. Byron Moore
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#include "acpi.h"
+#include "acnamesp.h"
+#include "acinterp.h"
+
+
+#define _COMPONENT          ACPI_UTILITIES
+	 MODULE_NAME         ("uteval")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ut_evaluate_numeric_object
+ *
+ * PARAMETERS:  *Object_name        - Object name to be evaluated
+ *              Device_node         - Node for the device
+ *              *Address            - Where the value is returned
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: evaluates a numeric namespace object for a selected device
+ *              and stores results in *Address.
+ *
+ *              NOTE: Internal function, no parameter validation
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_ut_evaluate_numeric_object (
+	NATIVE_CHAR             *object_name,
+	ACPI_NAMESPACE_NODE     *device_node,
+	ACPI_INTEGER            *address)
+{
+	ACPI_OPERAND_OBJECT     *obj_desc;
+	ACPI_STATUS             status;
+
+
+	/* Execute the method */
+
+	status = acpi_ns_evaluate_relative (device_node, object_name, NULL, &obj_desc);
+	if (ACPI_FAILURE (status)) {
+
+		return (status);
+	}
+
+
+	/* Did we get a return object? */
+
+	if (!obj_desc) {
+		return (AE_TYPE);
+	}
+
+	/* Is the return object of the correct type? */
+
+	if (obj_desc->common.type != ACPI_TYPE_INTEGER) {
+		status = AE_TYPE;
+	}
+	else {
+		/*
+		 * Since the structure is a union, setting any field will set all
+		 * of the variables in the union
+		 */
+		*address = obj_desc->integer.value;
+	}
+
+	/* On exit, we must delete the return object */
+
+	acpi_ut_remove_reference (obj_desc);
+
+	return (status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ut_execute_HID
+ *
+ * PARAMETERS:  Device_node         - Node for the device
+ *              *Hid                - Where the HID is returned
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Executes the _HID control method that returns the hardware
+ *              ID of the device.
+ *
+ *              NOTE: Internal function, no parameter validation
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_ut_execute_HID (
+	ACPI_NAMESPACE_NODE     *device_node,
+	ACPI_DEVICE_ID          *hid)
+{
+	ACPI_OPERAND_OBJECT     *obj_desc;
+	ACPI_STATUS             status;
+
+
+	/* Execute the method */
+
+	status = acpi_ns_evaluate_relative (device_node,
+			 METHOD_NAME__HID, NULL, &obj_desc);
+	if (ACPI_FAILURE (status)) {
+
+
+		return (status);
+	}
+
+	/* Did we get a return object? */
+
+	if (!obj_desc) {
+		return (AE_TYPE);
+	}
+
+	/*
+	 *  A _HID can return either a Number (32 bit compressed EISA ID) or
+	 *  a string
+	 */
+	if ((obj_desc->common.type != ACPI_TYPE_INTEGER) &&
+		(obj_desc->common.type != ACPI_TYPE_STRING)) {
+		status = AE_TYPE;
+	}
+
+	else {
+		if (obj_desc->common.type == ACPI_TYPE_INTEGER) {
+			/* Convert the Numeric HID to string */
+
+			acpi_ex_eisa_id_to_string ((u32) obj_desc->integer.value, hid->buffer);
+		}
+
+		else {
+			/* Copy the String HID from the returned object */
+
+			STRNCPY(hid->buffer, obj_desc->string.pointer, sizeof(hid->buffer));
+		}
+	}
+
+
+	/* On exit, we must delete the return object */
+
+	acpi_ut_remove_reference (obj_desc);
+
+	return (status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ut_execute_UID
+ *
+ * PARAMETERS:  Device_node         - Node for the device
+ *              *Uid                - Where the UID is returned
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Executes the _UID control method that returns the hardware
+ *              ID of the device.
+ *
+ *              NOTE: Internal function, no parameter validation
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_ut_execute_UID (
+	ACPI_NAMESPACE_NODE     *device_node,
+	ACPI_DEVICE_ID          *uid)
+{
+	ACPI_OPERAND_OBJECT     *obj_desc;
+	ACPI_STATUS             status;
+
+
+	PROC_NAME ("Ut_execute_UID");
+
+
+	/* Execute the method */
+
+	status = acpi_ns_evaluate_relative (device_node,
+			 METHOD_NAME__UID, NULL, &obj_desc);
+	if (ACPI_FAILURE (status)) {
+
+
+		return (status);
+	}
+
+	/* Did we get a return object? */
+
+	if (!obj_desc) {
+		return (AE_TYPE);
+	}
+
+	/*
+	 *  A _UID can return either a Number (32 bit compressed EISA ID) or
+	 *  a string
+	 */
+	if ((obj_desc->common.type != ACPI_TYPE_INTEGER) &&
+		(obj_desc->common.type != ACPI_TYPE_STRING)) {
+		status = AE_TYPE;
+	}
+
+	else {
+		if (obj_desc->common.type == ACPI_TYPE_INTEGER) {
+			/* Convert the Numeric UID to string */
+
+			acpi_ex_unsigned_integer_to_string (obj_desc->integer.value, uid->buffer);
+		}
+
+		else {
+			/* Copy the String UID from the returned object */
+
+			STRNCPY(uid->buffer, obj_desc->string.pointer, sizeof(uid->buffer));
+		}
+	}
+
+
+	/* On exit, we must delete the return object */
+
+	acpi_ut_remove_reference (obj_desc);
+
+	return (status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ut_execute_STA
+ *
+ * PARAMETERS:  Device_node         - Node for the device
+ *              *Flags              - Where the status flags are returned
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Executes _STA for selected device and stores results in
+ *              *Flags.
+ *
+ *              NOTE: Internal function, no parameter validation
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_ut_execute_STA (
+	ACPI_NAMESPACE_NODE     *device_node,
+	u32                     *flags)
+{
+	ACPI_OPERAND_OBJECT     *obj_desc;
+	ACPI_STATUS             status;
+
+
+	/* Execute the method */
+
+	status = acpi_ns_evaluate_relative (device_node,
+			 METHOD_NAME__STA, NULL, &obj_desc);
+	if (AE_NOT_FOUND == status) {
+		*flags = 0x0F;
+		status = AE_OK;
+	}
+
+
+	else /* success */ {
+		/* Did we get a return object? */
+
+		if (!obj_desc) {
+			return (AE_TYPE);
+		}
+
+		/* Is the return object of the correct type? */
+
+		if (obj_desc->common.type != ACPI_TYPE_INTEGER) {
+			status = AE_TYPE;
+		}
+
+		else {
+			/* Extract the status flags */
+
+			*flags = (u32) obj_desc->integer.value;
+		}
+
+		/* On exit, we must delete the return object */
+
+		acpi_ut_remove_reference (obj_desc);
+	}
+
+	return (status);
+}
diff -urN linux-2.4.6-pre4/drivers/acpi/utilities/utglobal.c linux/drivers/acpi/utilities/utglobal.c
--- linux-2.4.6-pre4/drivers/acpi/utilities/utglobal.c	Wed Dec 31 16:00:00 1969
+++ linux/drivers/acpi/utilities/utglobal.c	Mon Dec  3 22:48:42 2001
@@ -0,0 +1,483 @@
+/******************************************************************************
+ *
+ * Module Name: utglobal - Global variables for the ACPI subsystem
+ *              $Revision: 123 $
+ *
+ *****************************************************************************/
+
+/*
+ *  Copyright (C) 2000, 2001 R. Byron Moore
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#define DEFINE_ACPI_GLOBALS
+
+#include "acpi.h"
+#include "acevents.h"
+#include "acnamesp.h"
+#include "acinterp.h"
+#include "amlcode.h"
+
+
+#define _COMPONENT          ACPI_UTILITIES
+	 MODULE_NAME         ("utglobal")
+
+
+/******************************************************************************
+ *
+ * Static global variable initialization.
+ *
+ ******************************************************************************/
+
+/*
+ * We want the debug switches statically initialized so they
+ * are already set when the debugger is entered.
+ */
+
+/* Debug switch - level and trace mask */
+
+u32                         acpi_dbg_level = NORMAL_DEFAULT;
+
+/* Debug switch - layer (component) mask */
+
+u32                         acpi_dbg_layer = ACPI_COMPONENT_DEFAULT;
+u32                         acpi_gbl_nesting_level = 0;
+
+
+/* Debugger globals */
+
+u8                          acpi_gbl_db_terminate_threads = FALSE;
+u8                          acpi_gbl_method_executing = FALSE;
+
+/* System flags */
+
+u32                         acpi_gbl_system_flags = 0;
+u32                         acpi_gbl_startup_flags = 0;
+
+/* System starts unitialized! */
+u8                          acpi_gbl_shutdown = TRUE;
+
+
+u8                          acpi_gbl_decode_to8bit [8] = {1,2,4,8,16,32,64,128};
+
+
+/******************************************************************************
+ *
+ * Namespace globals
+ *
+ ******************************************************************************/
+
+
+/*
+ * Names built-in to the interpreter
+ *
+ * Initial values are currently supported only for types String and Number.
+ * To avoid type punning, both are specified as strings in this table.
+ *
+ * NOTES:
+ * 1) _SB_ is defined to be a device to allow _SB_/_INI to be run
+ *    during the initialization sequence.
+ */
+
+PREDEFINED_NAMES            acpi_gbl_pre_defined_names[] =
+{ {"_GPE",    INTERNAL_TYPE_DEF_ANY},
+	{"_PR_",    INTERNAL_TYPE_DEF_ANY},
+	{"_SB_",    ACPI_TYPE_DEVICE},
+	{"_SI_",    INTERNAL_TYPE_DEF_ANY},
+	{"_TZ_",    INTERNAL_TYPE_DEF_ANY},
+	{"_REV",    ACPI_TYPE_INTEGER, "2"},
+	{"_OS_",    ACPI_TYPE_STRING, ACPI_OS_NAME},
+	{"_GL_",    ACPI_TYPE_MUTEX, "0"},
+	{NULL,      ACPI_TYPE_ANY}           /* Table terminator */
+};
+
+
+/*
+ * Properties of the ACPI Object Types, both internal and external.
+ *
+ * Elements of Acpi_ns_properties are bit significant
+ * and the table is indexed by values of ACPI_OBJECT_TYPE
+ */
+
+u8                          acpi_gbl_ns_properties[] =
+{
+	NSP_NORMAL,                 /* 00 Any              */
+	NSP_NORMAL,                 /* 01 Number           */
+	NSP_NORMAL,                 /* 02 String           */
+	NSP_NORMAL,                 /* 03 Buffer           */
+	NSP_LOCAL,                  /* 04 Package          */
+	NSP_NORMAL,                 /* 05 Field_unit       */
+	NSP_NEWSCOPE | NSP_LOCAL,   /* 06 Device           */
+	NSP_LOCAL,                  /* 07 Acpi_event       */
+	NSP_NEWSCOPE | NSP_LOCAL,   /* 08 Method           */
+	NSP_LOCAL,                  /* 09 Mutex            */
+	NSP_LOCAL,                  /* 10 Region           */
+	NSP_NEWSCOPE | NSP_LOCAL,   /* 11 Power            */
+	NSP_NEWSCOPE | NSP_LOCAL,   /* 12 Processor        */
+	NSP_NEWSCOPE | NSP_LOCAL,   /* 13 Thermal          */
+	NSP_NORMAL,                 /* 14 Buffer_field     */
+	NSP_NORMAL,                 /* 15 Ddb_handle       */
+	NSP_NORMAL,                 /* 16 Debug Object     */
+	NSP_NORMAL,                 /* 17 Def_field        */
+	NSP_NORMAL,                 /* 18 Bank_field       */
+	NSP_NORMAL,                 /* 19 Index_field      */
+	NSP_NORMAL,                 /* 20 Reference        */
+	NSP_NORMAL,                 /* 21 Alias            */
+	NSP_NORMAL,                 /* 22 Notify           */
+	NSP_NORMAL,                 /* 23 Address Handler  */
+	NSP_NEWSCOPE | NSP_LOCAL,   /* 24 Resource Desc    */
+	NSP_NEWSCOPE | NSP_LOCAL,   /* 25 Resource Field   */
+	NSP_NORMAL,                 /* 26 Def_field_defn   */
+	NSP_NORMAL,                 /* 27 Bank_field_defn  */
+	NSP_NORMAL,                 /* 28 Index_field_defn */
+	NSP_NORMAL,                 /* 29 If               */
+	NSP_NORMAL,                 /* 30 Else             */
+	NSP_NORMAL,                 /* 31 While            */
+	NSP_NEWSCOPE,               /* 32 Scope            */
+	NSP_LOCAL,                  /* 33 Def_any          */
+	NSP_NORMAL,                 /* 34 Extra            */
+	NSP_NORMAL                  /* 35 Invalid          */
+};
+
+
+/* Hex to ASCII conversion table */
+
+NATIVE_CHAR                 acpi_gbl_hex_to_ascii[] =
+			  {'0','1','2','3','4','5','6','7',
+			  '8','9','A','B','C','D','E','F'};
+
+
+/******************************************************************************
+ *
+ * Table globals
+ *
+ * NOTE: This table includes ONLY the ACPI tables that the subsystem consumes.
+ * it is NOT an exhaustive list of all possible ACPI tables.  All ACPI tables
+ * that are not used by the subsystem are simply ignored.
+ *
+ ******************************************************************************/
+
+
+ACPI_TABLE_DESC             acpi_gbl_acpi_tables[NUM_ACPI_TABLES];
+
+
+ACPI_TABLE_SUPPORT          acpi_gbl_acpi_table_data[NUM_ACPI_TABLES] =
+{
+	/***********    Name,    Signature,  Signature size,    How many allowed?,   Supported?  Global typed pointer */
+
+	/* RSDP 0 */ {RSDP_NAME, RSDP_SIG, sizeof (RSDP_SIG)-1, ACPI_TABLE_SINGLE,   AE_OK,      NULL},
+	/* DSDT 1 */ {DSDT_SIG,  DSDT_SIG, sizeof (DSDT_SIG)-1, ACPI_TABLE_SINGLE,   AE_OK,      (void **) &acpi_gbl_DSDT},
+	/* FADT 2 */ {FADT_SIG,  FADT_SIG, sizeof (FADT_SIG)-1, ACPI_TABLE_SINGLE,   AE_OK,      (void **) &acpi_gbl_FADT},
+	/* FACS 3 */ {FACS_SIG,  FACS_SIG, sizeof (FACS_SIG)-1, ACPI_TABLE_SINGLE,   AE_OK,      (void **) &acpi_gbl_FACS},
+	/* PSDT 4 */ {PSDT_SIG,  PSDT_SIG, sizeof (PSDT_SIG)-1, ACPI_TABLE_MULTIPLE, AE_OK,      NULL},
+	/* SSDT 5 */ {SSDT_SIG,  SSDT_SIG, sizeof (SSDT_SIG)-1, ACPI_TABLE_MULTIPLE, AE_OK,      NULL},
+	/* XSDT 6 */ {XSDT_SIG,  XSDT_SIG, sizeof (RSDT_SIG)-1, ACPI_TABLE_SINGLE,   AE_OK,      NULL},
+};
+
+
+/*****************************************************************************
+ *
+ * FUNCTION:    Acpi_ut_valid_object_type
+ *
+ * PARAMETERS:  None.
+ *
+ * RETURN:      TRUE if valid object type
+ *
+ * DESCRIPTION: Validate an object type
+ *
+ ****************************************************************************/
+
+u8
+acpi_ut_valid_object_type (
+	u32                     type)
+{
+
+	if (type > ACPI_TYPE_MAX)
+	{
+		if ((type < INTERNAL_TYPE_BEGIN) ||
+			(type > INTERNAL_TYPE_MAX))
+		{
+			return (FALSE);
+		}
+	}
+
+	return (TRUE);
+}
+
+
+/*****************************************************************************
+ *
+ * FUNCTION:    Acpi_ut_format_exception
+ *
+ * PARAMETERS:  Status              - Acpi status to be formatted
+ *
+ * RETURN:      Formatted status string
+ *
+ * DESCRIPTION: Convert an ACPI exception to a string
+ *
+ ****************************************************************************/
+
+NATIVE_CHAR *
+acpi_ut_format_exception (
+	ACPI_STATUS             status)
+{
+	NATIVE_CHAR             *exception = "UNKNOWN_STATUS";
+	ACPI_STATUS             sub_status;
+
+
+	sub_status = (status & ~AE_CODE_MASK);
+
+
+	switch (status & AE_CODE_MASK)
+	{
+	case AE_CODE_ENVIRONMENTAL:
+
+		if (sub_status <= AE_CODE_ENV_MAX)
+		{
+			exception = acpi_gbl_exception_names_env [sub_status];
+		}
+		break;
+
+	case AE_CODE_PROGRAMMER:
+
+		if (sub_status <= AE_CODE_PGM_MAX)
+		{
+			exception = acpi_gbl_exception_names_pgm [sub_status -1];
+		}
+		break;
+
+	case AE_CODE_ACPI_TABLES:
+
+		if (sub_status <= AE_CODE_TBL_MAX)
+		{
+			exception = acpi_gbl_exception_names_tbl [sub_status -1];
+		}
+		break;
+
+	case AE_CODE_AML:
+
+		if (sub_status <= AE_CODE_AML_MAX)
+		{
+			exception = acpi_gbl_exception_names_aml [sub_status -1];
+		}
+		break;
+
+	case AE_CODE_CONTROL:
+
+		if (sub_status <= AE_CODE_CTRL_MAX)
+		{
+			exception = acpi_gbl_exception_names_ctrl [sub_status -1];
+		}
+		break;
+
+	default:
+		break;
+	}
+
+
+	return (exception);
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:    Acpi_ut_allocate_owner_id
+ *
+ * PARAMETERS:  Id_type         - Type of ID (method or table)
+ *
+ * DESCRIPTION: Allocate a table or method owner id
+ *
+ ***************************************************************************/
+
+ACPI_OWNER_ID
+acpi_ut_allocate_owner_id (
+	u32                     id_type)
+{
+	ACPI_OWNER_ID           owner_id = 0xFFFF;
+
+
+	acpi_ut_acquire_mutex (ACPI_MTX_CACHES);
+
+	switch (id_type)
+	{
+	case OWNER_TYPE_TABLE:
+
+		owner_id = acpi_gbl_next_table_owner_id;
+		acpi_gbl_next_table_owner_id++;
+
+		if (acpi_gbl_next_table_owner_id == FIRST_METHOD_ID)
+		{
+			acpi_gbl_next_table_owner_id = FIRST_TABLE_ID;
+		}
+		break;
+
+
+	case OWNER_TYPE_METHOD:
+
+		owner_id = acpi_gbl_next_method_owner_id;
+		acpi_gbl_next_method_owner_id++;
+
+		if (acpi_gbl_next_method_owner_id == FIRST_TABLE_ID)
+		{
+			acpi_gbl_next_method_owner_id = FIRST_METHOD_ID;
+		}
+		break;
+	}
+
+
+	acpi_ut_release_mutex (ACPI_MTX_CACHES);
+
+	return (owner_id);
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:    Acpi_ut_init_globals
+ *
+ * PARAMETERS:  none
+ *
+ * DESCRIPTION: Init library globals.  All globals that require specific
+ *              initialization should be initialized here!
+ *
+ ***************************************************************************/
+
+void
+acpi_ut_init_globals (
+	void)
+{
+	u32                     i;
+
+
+	/* ACPI table structure */
+
+	for (i = 0; i < NUM_ACPI_TABLES; i++)
+	{
+		acpi_gbl_acpi_tables[i].prev        = &acpi_gbl_acpi_tables[i];
+		acpi_gbl_acpi_tables[i].next        = &acpi_gbl_acpi_tables[i];
+		acpi_gbl_acpi_tables[i].pointer     = NULL;
+		acpi_gbl_acpi_tables[i].length      = 0;
+		acpi_gbl_acpi_tables[i].allocation  = ACPI_MEM_NOT_ALLOCATED;
+		acpi_gbl_acpi_tables[i].count       = 0;
+	}
+
+
+	/* Address Space handler array */
+
+	for (i = 0; i < ACPI_NUM_ADDRESS_SPACES; i++)
+	{
+		acpi_gbl_address_spaces[i].handler  = NULL;
+		acpi_gbl_address_spaces[i].context  = NULL;
+	}
+
+	/* Mutex locked flags */
+
+	for (i = 0; i < NUM_MTX; i++)
+	{
+		acpi_gbl_acpi_mutex_info[i].mutex   = NULL;
+		acpi_gbl_acpi_mutex_info[i].owner_id = ACPI_MUTEX_NOT_ACQUIRED;
+		acpi_gbl_acpi_mutex_info[i].use_count = 0;
+	}
+
+	/* Global notify handlers */
+
+	acpi_gbl_sys_notify.handler         = NULL;
+	acpi_gbl_drv_notify.handler         = NULL;
+
+	/* Global "typed" ACPI table pointers */
+
+	acpi_gbl_RSDP                       = NULL;
+	acpi_gbl_XSDT                       = NULL;
+	acpi_gbl_FACS                       = NULL;
+	acpi_gbl_FADT                       = NULL;
+	acpi_gbl_DSDT                       = NULL;
+
+
+	/* Global Lock support */
+
+	acpi_gbl_global_lock_acquired       = FALSE;
+	acpi_gbl_global_lock_thread_count   = 0;
+
+	/* Miscellaneous variables */
+
+	acpi_gbl_system_flags               = 0;
+	acpi_gbl_startup_flags              = 0;
+	acpi_gbl_rsdp_original_location     = 0;
+	acpi_gbl_cm_single_step             = FALSE;
+	acpi_gbl_db_terminate_threads       = FALSE;
+	acpi_gbl_shutdown                   = FALSE;
+	acpi_gbl_ns_lookup_count            = 0;
+	acpi_gbl_ps_find_count              = 0;
+	acpi_gbl_acpi_hardware_present      = TRUE;
+	acpi_gbl_next_table_owner_id        = FIRST_TABLE_ID;
+	acpi_gbl_next_method_owner_id       = FIRST_METHOD_ID;
+	acpi_gbl_debugger_configuration     = DEBUGGER_THREADING;
+
+	/* Cache of small "state" objects */
+
+	acpi_gbl_generic_state_cache        = NULL;
+	acpi_gbl_generic_state_cache_depth  = 0;
+	acpi_gbl_state_cache_requests       = 0;
+	acpi_gbl_state_cache_hits           = 0;
+
+	acpi_gbl_parse_cache                = NULL;
+	acpi_gbl_parse_cache_depth          = 0;
+	acpi_gbl_parse_cache_requests       = 0;
+	acpi_gbl_parse_cache_hits           = 0;
+
+	acpi_gbl_ext_parse_cache            = NULL;
+	acpi_gbl_ext_parse_cache_depth      = 0;
+	acpi_gbl_ext_parse_cache_requests   = 0;
+	acpi_gbl_ext_parse_cache_hits       = 0;
+
+	acpi_gbl_object_cache               = NULL;
+	acpi_gbl_object_cache_depth         = 0;
+	acpi_gbl_object_cache_requests      = 0;
+	acpi_gbl_object_cache_hits          = 0;
+
+	acpi_gbl_walk_state_cache           = NULL;
+	acpi_gbl_walk_state_cache_depth     = 0;
+	acpi_gbl_walk_state_cache_requests  = 0;
+	acpi_gbl_walk_state_cache_hits      = 0;
+
+	/* Hardware oriented */
+
+	acpi_gbl_gpe0enable_register_save   = NULL;
+	acpi_gbl_gpe1_enable_register_save  = NULL;
+	acpi_gbl_original_mode              = SYS_MODE_UNKNOWN;   /*  original ACPI/legacy mode   */
+	acpi_gbl_gpe_registers              = NULL;
+	acpi_gbl_gpe_info                   = NULL;
+
+	/* Namespace */
+
+	acpi_gbl_root_node                  = NULL;
+
+	acpi_gbl_root_node_struct.name      = ACPI_ROOT_NAME;
+	acpi_gbl_root_node_struct.data_type = ACPI_DESC_TYPE_NAMED;
+	acpi_gbl_root_node_struct.type      = ACPI_TYPE_ANY;
+	acpi_gbl_root_node_struct.child     = NULL;
+	acpi_gbl_root_node_struct.peer      = NULL;
+	acpi_gbl_root_node_struct.object    = NULL;
+	acpi_gbl_root_node_struct.flags     = ANOBJ_END_OF_PEER_LIST;
+
+	/* Memory allocation metrics - compiled out in non-debug mode. */
+
+	INITIALIZE_ALLOCATION_METRICS();
+
+	return;
+}
+
+
diff -urN linux-2.4.6-pre4/drivers/acpi/utilities/utinit.c linux/drivers/acpi/utilities/utinit.c
--- linux-2.4.6-pre4/drivers/acpi/utilities/utinit.c	Wed Dec 31 16:00:00 1969
+++ linux/drivers/acpi/utilities/utinit.c	Mon Dec  3 22:48:42 2001
@@ -0,0 +1,247 @@
+/******************************************************************************
+ *
+ * Module Name: utinit - Common ACPI subsystem initialization
+ *              $Revision: 96 $
+ *
+ *****************************************************************************/
+
+/*
+ *  Copyright (C) 2000, 2001 R. Byron Moore
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#include "acpi.h"
+#include "achware.h"
+#include "acnamesp.h"
+#include "acevents.h"
+#include "acparser.h"
+#include "acdispat.h"
+
+#define _COMPONENT          ACPI_UTILITIES
+	 MODULE_NAME         ("utinit")
+
+
+#define ACPI_OFFSET(d,o)    ((u32) &(((d *)0)->o))
+#define ACPI_FADT_OFFSET(o) ACPI_OFFSET (FADT_DESCRIPTOR, o)
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ut_fadt_register_error
+ *
+ * PARAMETERS:  *Register_name          - Pointer to string identifying register
+ *              Value                   - Actual register contents value
+ *              Acpi_test_spec_section  - TDS section containing assertion
+ *              Acpi_assertion          - Assertion number being tested
+ *
+ * RETURN:      AE_BAD_VALUE
+ *
+ * DESCRIPTION: Display failure message and link failure to TDS assertion
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+acpi_ut_fadt_register_error (
+	NATIVE_CHAR             *register_name,
+	u32                     value,
+	u32                     offset)
+{
+
+	REPORT_ERROR (
+		("Invalid FADT value %s=%lX at offset %lX FADT=%p\n",
+		register_name, value, offset, acpi_gbl_FADT));
+
+
+	return (AE_BAD_VALUE);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION:    Acpi_ut_validate_fadt
+ *
+ * PARAMETERS:  None
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Validate various ACPI registers in the FADT
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_ut_validate_fadt (
+	void)
+{
+	ACPI_STATUS                 status = AE_OK;
+
+
+	/*
+	 * Verify Fixed ACPI Description Table fields,
+	 * but don't abort on any problems, just display error
+	 */
+
+	if (acpi_gbl_FADT->pm1_evt_len < 4) {
+		status = acpi_ut_fadt_register_error ("PM1_EVT_LEN",
+				  (u32) acpi_gbl_FADT->pm1_evt_len,
+				  ACPI_FADT_OFFSET (pm1_evt_len));
+	}
+
+	if (!acpi_gbl_FADT->pm1_cnt_len) {
+		status = acpi_ut_fadt_register_error ("PM1_CNT_LEN", 0,
+				  ACPI_FADT_OFFSET (pm1_cnt_len));
+	}
+
+	if (!ACPI_VALID_ADDRESS (acpi_gbl_FADT->Xpm1a_evt_blk.address)) {
+		status = acpi_ut_fadt_register_error ("X_PM1a_EVT_BLK", 0,
+				  ACPI_FADT_OFFSET (Xpm1a_evt_blk.address));
+	}
+
+	if (!ACPI_VALID_ADDRESS (acpi_gbl_FADT->Xpm1a_cnt_blk.address)) {
+		status = acpi_ut_fadt_register_error ("X_PM1a_CNT_BLK", 0,
+				  ACPI_FADT_OFFSET (Xpm1a_cnt_blk.address));
+	}
+
+	if (!ACPI_VALID_ADDRESS (acpi_gbl_FADT->Xpm_tmr_blk.address)) {
+		status = acpi_ut_fadt_register_error ("X_PM_TMR_BLK", 0,
+				  ACPI_FADT_OFFSET (Xpm_tmr_blk.address));
+	}
+
+	if ((ACPI_VALID_ADDRESS (acpi_gbl_FADT->Xpm2_cnt_blk.address) &&
+		!acpi_gbl_FADT->pm2_cnt_len)) {
+		status = acpi_ut_fadt_register_error ("PM2_CNT_LEN",
+				  (u32) acpi_gbl_FADT->pm2_cnt_len,
+				  ACPI_FADT_OFFSET (pm2_cnt_len));
+	}
+
+	if (acpi_gbl_FADT->pm_tm_len < 4) {
+		status = acpi_ut_fadt_register_error ("PM_TM_LEN",
+				  (u32) acpi_gbl_FADT->pm_tm_len,
+				  ACPI_FADT_OFFSET (pm_tm_len));
+	}
+
+	/* length of GPE blocks must be a multiple of 2 */
+
+
+	if (ACPI_VALID_ADDRESS (acpi_gbl_FADT->Xgpe0blk.address) &&
+		(acpi_gbl_FADT->gpe0blk_len & 1)) {
+		status = acpi_ut_fadt_register_error ("(x)GPE0_BLK_LEN",
+				  (u32) acpi_gbl_FADT->gpe0blk_len,
+				  ACPI_FADT_OFFSET (gpe0blk_len));
+	}
+
+	if (ACPI_VALID_ADDRESS (acpi_gbl_FADT->Xgpe1_blk.address) &&
+		(acpi_gbl_FADT->gpe1_blk_len & 1)) {
+		status = acpi_ut_fadt_register_error ("(x)GPE1_BLK_LEN",
+				  (u32) acpi_gbl_FADT->gpe1_blk_len,
+				  ACPI_FADT_OFFSET (gpe1_blk_len));
+	}
+
+	return (status);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION:    Acpi_ut_terminate
+ *
+ * PARAMETERS:  none
+ *
+ * RETURN:      none
+ *
+ * DESCRIPTION: free memory allocated for table storage.
+ *
+ ******************************************************************************/
+
+void
+acpi_ut_terminate (void)
+{
+
+
+	/* Free global tables, etc. */
+
+	if (acpi_gbl_gpe0enable_register_save) {
+		acpi_ut_free (acpi_gbl_gpe0enable_register_save);
+	}
+
+	if (acpi_gbl_gpe1_enable_register_save) {
+		acpi_ut_free (acpi_gbl_gpe1_enable_register_save);
+	}
+
+
+	return;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ut_subsystem_shutdown
+ *
+ * PARAMETERS:  none
+ *
+ * RETURN:      none
+ *
+ * DESCRIPTION: Shutdown the various subsystems.  Don't delete the mutex
+ *              objects here -- because the AML debugger may be still running.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_ut_subsystem_shutdown (void)
+{
+
+	/* Just exit if subsystem is already shutdown */
+
+	if (acpi_gbl_shutdown) {
+		return (AE_OK);
+	}
+
+	/* Subsystem appears active, go ahead and shut it down */
+
+	acpi_gbl_shutdown = TRUE;
+
+	/* Close the Namespace */
+
+	acpi_ns_terminate ();
+
+	/* Close the Acpi_event Handling */
+
+	acpi_ev_terminate ();
+
+	/* Close the globals */
+
+	acpi_ut_terminate ();
+
+	/* Flush the local cache(s) */
+
+	acpi_ut_delete_generic_state_cache ();
+	acpi_ut_delete_object_cache ();
+	acpi_ds_delete_walk_state_cache ();
+
+	/* Close the Parser */
+
+	/* TBD: [Restructure] Acpi_ps_terminate () */
+
+	acpi_ps_delete_parse_cache ();
+
+	/* Debug only - display leftover memory allocation, if any */
+#ifdef ENABLE_DEBUGGER
+	acpi_ut_dump_current_allocations (ACPI_UINT32_MAX, NULL);
+#endif
+
+	return (AE_OK);
+}
+
+
diff -urN linux-2.4.6-pre4/drivers/acpi/utilities/utmisc.c linux/drivers/acpi/utilities/utmisc.c
--- linux-2.4.6-pre4/drivers/acpi/utilities/utmisc.c	Wed Dec 31 16:00:00 1969
+++ linux/drivers/acpi/utilities/utmisc.c	Mon Dec  3 22:48:42 2001
@@ -0,0 +1,1043 @@
+/*******************************************************************************
+ *
+ * Module Name: utmisc - common utility procedures
+ *              $Revision: 42 $
+ *
+ ******************************************************************************/
+
+/*
+ *  Copyright (C) 2000, 2001 R. Byron Moore
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#include "acpi.h"
+#include "acevents.h"
+#include "achware.h"
+#include "acnamesp.h"
+#include "acinterp.h"
+#include "amlcode.h"
+#include "acdebug.h"
+
+
+#define _COMPONENT          ACPI_UTILITIES
+	 MODULE_NAME         ("utmisc")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ut_valid_acpi_name
+ *
+ * PARAMETERS:  Character           - The character to be examined
+ *
+ * RETURN:      1 if Character may appear in a name, else 0
+ *
+ * DESCRIPTION: Check for a valid ACPI name.  Each character must be one of:
+ *              1) Upper case alpha
+ *              2) numeric
+ *              3) underscore
+ *
+ ******************************************************************************/
+
+u8
+acpi_ut_valid_acpi_name (
+	u32                     name)
+{
+	NATIVE_CHAR             *name_ptr = (NATIVE_CHAR *) &name;
+	u32                     i;
+
+
+	for (i = 0; i < ACPI_NAME_SIZE; i++) {
+		if (!((name_ptr[i] == '_') ||
+			  (name_ptr[i] >= 'A' && name_ptr[i] <= 'Z') ||
+			  (name_ptr[i] >= '0' && name_ptr[i] <= '9'))) {
+			return (FALSE);
+		}
+	}
+
+
+	return (TRUE);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ut_valid_acpi_character
+ *
+ * PARAMETERS:  Character           - The character to be examined
+ *
+ * RETURN:      1 if Character may appear in a name, else 0
+ *
+ * DESCRIPTION: Check for a printable character
+ *
+ ******************************************************************************/
+
+u8
+acpi_ut_valid_acpi_character (
+	NATIVE_CHAR             character)
+{
+
+	return ((u8)   ((character == '_') ||
+			   (character >= 'A' && character <= 'Z') ||
+			   (character >= '0' && character <= '9')));
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ut_strupr
+ *
+ * PARAMETERS:  Src_string      - The source string to convert to
+ *
+ * RETURN:      Src_string
+ *
+ * DESCRIPTION: Convert string to uppercase
+ *
+ ******************************************************************************/
+
+NATIVE_CHAR *
+acpi_ut_strupr (
+	NATIVE_CHAR             *src_string)
+{
+	NATIVE_CHAR             *string;
+
+
+	/* Walk entire string, uppercasing the letters */
+
+	for (string = src_string; *string; ) {
+		*string = (char) TOUPPER (*string);
+		string++;
+	}
+
+
+	return (src_string);
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ut_mutex_initialize
+ *
+ * PARAMETERS:  None.
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Create the system mutex objects.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_ut_mutex_initialize (
+	void)
+{
+	u32                     i;
+	ACPI_STATUS             status;
+
+
+	/*
+	 * Create each of the predefined mutex objects
+	 */
+	for (i = 0; i < NUM_MTX; i++) {
+		status = acpi_ut_create_mutex (i);
+		if (ACPI_FAILURE (status)) {
+			return (status);
+		}
+	}
+
+	return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ut_mutex_terminate
+ *
+ * PARAMETERS:  None.
+ *
+ * RETURN:      None.
+ *
+ * DESCRIPTION: Delete all of the system mutex objects.
+ *
+ ******************************************************************************/
+
+void
+acpi_ut_mutex_terminate (
+	void)
+{
+	u32                     i;
+
+
+	/*
+	 * Delete each predefined mutex object
+	 */
+	for (i = 0; i < NUM_MTX; i++) {
+		acpi_ut_delete_mutex (i);
+	}
+
+	return;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ut_create_mutex
+ *
+ * PARAMETERS:  Mutex_iD        - ID of the mutex to be created
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Create a mutex object.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_ut_create_mutex (
+	ACPI_MUTEX_HANDLE       mutex_id)
+{
+	ACPI_STATUS             status = AE_OK;
+
+
+	if (mutex_id > MAX_MTX) {
+		return (AE_BAD_PARAMETER);
+	}
+
+
+	if (!acpi_gbl_acpi_mutex_info[mutex_id].mutex) {
+		status = acpi_os_create_semaphore (1, 1,
+				  &acpi_gbl_acpi_mutex_info[mutex_id].mutex);
+		acpi_gbl_acpi_mutex_info[mutex_id].owner_id = ACPI_MUTEX_NOT_ACQUIRED;
+		acpi_gbl_acpi_mutex_info[mutex_id].use_count = 0;
+	}
+
+	return (status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ut_delete_mutex
+ *
+ * PARAMETERS:  Mutex_iD        - ID of the mutex to be deleted
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Delete a mutex object.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_ut_delete_mutex (
+	ACPI_MUTEX_HANDLE       mutex_id)
+{
+	ACPI_STATUS             status;
+
+
+	if (mutex_id > MAX_MTX) {
+		return (AE_BAD_PARAMETER);
+	}
+
+
+	status = acpi_os_delete_semaphore (acpi_gbl_acpi_mutex_info[mutex_id].mutex);
+
+	acpi_gbl_acpi_mutex_info[mutex_id].mutex = NULL;
+	acpi_gbl_acpi_mutex_info[mutex_id].owner_id = ACPI_MUTEX_NOT_ACQUIRED;
+
+	return (status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ut_acquire_mutex
+ *
+ * PARAMETERS:  Mutex_iD        - ID of the mutex to be acquired
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Acquire a mutex object.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_ut_acquire_mutex (
+	ACPI_MUTEX_HANDLE       mutex_id)
+{
+	ACPI_STATUS             status;
+	u32                     i;
+	u32                     this_thread_id;
+
+
+	PROC_NAME ("Ut_acquire_mutex");
+
+
+	if (mutex_id > MAX_MTX) {
+		return (AE_BAD_PARAMETER);
+	}
+
+
+	this_thread_id = acpi_os_get_thread_id ();
+
+	/*
+	 * Deadlock prevention.  Check if this thread owns any mutexes of value
+	 * greater than or equal to this one.  If so, the thread has violated
+	 * the mutex ordering rule.  This indicates a coding error somewhere in
+	 * the ACPI subsystem code.
+	 */
+	for (i = mutex_id; i < MAX_MTX; i++) {
+		if (acpi_gbl_acpi_mutex_info[i].owner_id == this_thread_id) {
+			if (i == mutex_id) {
+				return (AE_ALREADY_ACQUIRED);
+			}
+
+			return (AE_ACQUIRE_DEADLOCK);
+		}
+	}
+
+
+	status = acpi_os_wait_semaphore (acpi_gbl_acpi_mutex_info[mutex_id].mutex,
+			   1, WAIT_FOREVER);
+
+	if (ACPI_SUCCESS (status)) {
+		acpi_gbl_acpi_mutex_info[mutex_id].use_count++;
+		acpi_gbl_acpi_mutex_info[mutex_id].owner_id = this_thread_id;
+	}
+
+
+	return (status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ut_release_mutex
+ *
+ * PARAMETERS:  Mutex_iD        - ID of the mutex to be released
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Release a mutex object.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_ut_release_mutex (
+	ACPI_MUTEX_HANDLE       mutex_id)
+{
+	ACPI_STATUS             status;
+	u32                     i;
+	u32                     this_thread_id;
+
+
+	PROC_NAME ("Ut_release_mutex");
+
+
+	this_thread_id = acpi_os_get_thread_id ();
+	if (mutex_id > MAX_MTX) {
+		return (AE_BAD_PARAMETER);
+	}
+
+
+	/*
+	 * Mutex must be acquired in order to release it!
+	 */
+	if (acpi_gbl_acpi_mutex_info[mutex_id].owner_id == ACPI_MUTEX_NOT_ACQUIRED) {
+		return (AE_NOT_ACQUIRED);
+	}
+
+
+	/*
+	 * Deadlock prevention.  Check if this thread owns any mutexes of value
+	 * greater than this one.  If so, the thread has violated the mutex
+	 * ordering rule.  This indicates a coding error somewhere in
+	 * the ACPI subsystem code.
+	 */
+	for (i = mutex_id; i < MAX_MTX; i++) {
+		if (acpi_gbl_acpi_mutex_info[i].owner_id == this_thread_id) {
+			if (i == mutex_id) {
+				continue;
+			}
+
+			return (AE_RELEASE_DEADLOCK);
+		}
+	}
+
+
+	/* Mark unlocked FIRST */
+
+	acpi_gbl_acpi_mutex_info[mutex_id].owner_id = ACPI_MUTEX_NOT_ACQUIRED;
+
+	status = acpi_os_signal_semaphore (acpi_gbl_acpi_mutex_info[mutex_id].mutex, 1);
+
+
+	return (status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ut_create_update_state_and_push
+ *
+ * PARAMETERS:  *Object         - Object to be added to the new state
+ *              Action          - Increment/Decrement
+ *              State_list      - List the state will be added to
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Create a new state and push it
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_ut_create_update_state_and_push (
+	ACPI_OPERAND_OBJECT     *object,
+	u16                     action,
+	ACPI_GENERIC_STATE      **state_list)
+{
+	ACPI_GENERIC_STATE       *state;
+
+
+	/* Ignore null objects; these are expected */
+
+	if (!object) {
+		return (AE_OK);
+	}
+
+	state = acpi_ut_create_update_state (object, action);
+	if (!state) {
+		return (AE_NO_MEMORY);
+	}
+
+
+	acpi_ut_push_generic_state (state_list, state);
+	return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ut_create_pkg_state_and_push
+ *
+ * PARAMETERS:  *Object         - Object to be added to the new state
+ *              Action          - Increment/Decrement
+ *              State_list      - List the state will be added to
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Create a new state and push it
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_ut_create_pkg_state_and_push (
+	void                    *internal_object,
+	void                    *external_object,
+	u16                     index,
+	ACPI_GENERIC_STATE      **state_list)
+{
+	ACPI_GENERIC_STATE       *state;
+
+
+	state = acpi_ut_create_pkg_state (internal_object, external_object, index);
+	if (!state) {
+		return (AE_NO_MEMORY);
+	}
+
+
+	acpi_ut_push_generic_state (state_list, state);
+	return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ut_push_generic_state
+ *
+ * PARAMETERS:  List_head           - Head of the state stack
+ *              State               - State object to push
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Push a state object onto a state stack
+ *
+ ******************************************************************************/
+
+void
+acpi_ut_push_generic_state (
+	ACPI_GENERIC_STATE      **list_head,
+	ACPI_GENERIC_STATE      *state)
+{
+	/* Push the state object onto the front of the list (stack) */
+
+	state->common.next = *list_head;
+	*list_head = state;
+
+	return;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ut_pop_generic_state
+ *
+ * PARAMETERS:  List_head           - Head of the state stack
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Pop a state object from a state stack
+ *
+ ******************************************************************************/
+
+ACPI_GENERIC_STATE *
+acpi_ut_pop_generic_state (
+	ACPI_GENERIC_STATE      **list_head)
+{
+	ACPI_GENERIC_STATE      *state;
+
+
+	/* Remove the state object at the head of the list (stack) */
+
+	state = *list_head;
+	if (state) {
+		/* Update the list head */
+
+		*list_head = state->common.next;
+	}
+
+	return (state);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ut_create_generic_state
+ *
+ * PARAMETERS:  None
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Create a generic state object.  Attempt to obtain one from
+ *              the global state cache;  If none available, create a new one.
+ *
+ ******************************************************************************/
+
+ACPI_GENERIC_STATE *
+acpi_ut_create_generic_state (void)
+{
+	ACPI_GENERIC_STATE      *state;
+
+
+	acpi_ut_acquire_mutex (ACPI_MTX_CACHES);
+
+	acpi_gbl_state_cache_requests++;
+
+	/* Check the cache first */
+
+	if (acpi_gbl_generic_state_cache) {
+		/* There is an object available, use it */
+
+		state = acpi_gbl_generic_state_cache;
+		acpi_gbl_generic_state_cache = state->common.next;
+		state->common.next = NULL;
+
+		acpi_gbl_state_cache_hits++;
+		acpi_gbl_generic_state_cache_depth--;
+
+		acpi_ut_release_mutex (ACPI_MTX_CACHES);
+
+	}
+
+	else {
+		/* The cache is empty, create a new object */
+
+		acpi_ut_release_mutex (ACPI_MTX_CACHES);
+
+		state = acpi_ut_callocate (sizeof (ACPI_GENERIC_STATE));
+	}
+
+	/* Initialize */
+
+	if (state) {
+		/* Always zero out the object before init */
+
+		MEMSET (state, 0, sizeof (ACPI_GENERIC_STATE));
+
+		state->common.data_type = ACPI_DESC_TYPE_STATE;
+	}
+
+	return (state);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ut_create_update_state
+ *
+ * PARAMETERS:  Object              - Initial Object to be installed in the
+ *                                    state
+ *              Action              - Update action to be performed
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Create an "Update State" - a flavor of the generic state used
+ *              to update reference counts and delete complex objects such
+ *              as packages.
+ *
+ ******************************************************************************/
+
+ACPI_GENERIC_STATE *
+acpi_ut_create_update_state (
+	ACPI_OPERAND_OBJECT     *object,
+	u16                     action)
+{
+	ACPI_GENERIC_STATE      *state;
+
+
+	/* Create the generic state object */
+
+	state = acpi_ut_create_generic_state ();
+	if (!state) {
+		return (NULL);
+	}
+
+	/* Init fields specific to the update struct */
+
+	state->update.object = object;
+	state->update.value  = action;
+
+	return (state);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ut_create_pkg_state
+ *
+ * PARAMETERS:  Object              - Initial Object to be installed in the
+ *                                    state
+ *              Action              - Update action to be performed
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Create an "Update State" - a flavor of the generic state used
+ *              to update reference counts and delete complex objects such
+ *              as packages.
+ *
+ ******************************************************************************/
+
+ACPI_GENERIC_STATE *
+acpi_ut_create_pkg_state (
+	void                    *internal_object,
+	void                    *external_object,
+	u16                     index)
+{
+	ACPI_GENERIC_STATE      *state;
+
+
+	/* Create the generic state object */
+
+	state = acpi_ut_create_generic_state ();
+	if (!state) {
+		return (NULL);
+	}
+
+	/* Init fields specific to the update struct */
+
+	state->pkg.source_object = (ACPI_OPERAND_OBJECT *) internal_object;
+	state->pkg.dest_object  = external_object;
+	state->pkg.index        = index;
+	state->pkg.num_packages = 1;
+
+	return (state);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ut_create_control_state
+ *
+ * PARAMETERS:  None
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Create a "Control State" - a flavor of the generic state used
+ *              to support nested IF/WHILE constructs in the AML.
+ *
+ ******************************************************************************/
+
+ACPI_GENERIC_STATE *
+acpi_ut_create_control_state (
+	void)
+{
+	ACPI_GENERIC_STATE      *state;
+
+
+	/* Create the generic state object */
+
+	state = acpi_ut_create_generic_state ();
+	if (!state) {
+		return (NULL);
+	}
+
+
+	/* Init fields specific to the control struct */
+
+	state->common.state = CONTROL_CONDITIONAL_EXECUTING;
+
+	return (state);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ut_delete_generic_state
+ *
+ * PARAMETERS:  State               - The state object to be deleted
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Put a state object back into the global state cache.  The object
+ *              is not actually freed at this time.
+ *
+ ******************************************************************************/
+
+void
+acpi_ut_delete_generic_state (
+	ACPI_GENERIC_STATE      *state)
+{
+
+	/* If cache is full, just free this state object */
+
+	if (acpi_gbl_generic_state_cache_depth >= MAX_STATE_CACHE_DEPTH) {
+		acpi_ut_free (state);
+	}
+
+	/* Otherwise put this object back into the cache */
+
+	else {
+		acpi_ut_acquire_mutex (ACPI_MTX_CACHES);
+
+		/* Clear the state */
+
+		MEMSET (state, 0, sizeof (ACPI_GENERIC_STATE));
+		state->common.data_type = ACPI_DESC_TYPE_STATE;
+
+		/* Put the object at the head of the global cache list */
+
+		state->common.next = acpi_gbl_generic_state_cache;
+		acpi_gbl_generic_state_cache = state;
+		acpi_gbl_generic_state_cache_depth++;
+
+
+		acpi_ut_release_mutex (ACPI_MTX_CACHES);
+	}
+	return;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ut_delete_generic_state_cache
+ *
+ * PARAMETERS:  None
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Purge the global state object cache.  Used during subsystem
+ *              termination.
+ *
+ ******************************************************************************/
+
+void
+acpi_ut_delete_generic_state_cache (
+	void)
+{
+	ACPI_GENERIC_STATE      *next;
+
+
+	/* Traverse the global cache list */
+
+	while (acpi_gbl_generic_state_cache) {
+		/* Delete one cached state object */
+
+		next = acpi_gbl_generic_state_cache->common.next;
+		acpi_ut_free (acpi_gbl_generic_state_cache);
+		acpi_gbl_generic_state_cache = next;
+		acpi_gbl_generic_state_cache_depth--;
+	}
+
+	return;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ut_resolve_package_references
+ *
+ * PARAMETERS:  Obj_desc        - The Package object on which to resolve refs
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Walk through a package and turn internal references into values
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_ut_resolve_package_references (
+	ACPI_OPERAND_OBJECT     *obj_desc)
+{
+	u32                     count;
+	ACPI_OPERAND_OBJECT     *sub_object;
+
+
+	if (obj_desc->common.type != ACPI_TYPE_PACKAGE) {
+		/* The object must be a package */
+
+		REPORT_ERROR (("Must resolve Package Refs on a Package\n"));
+		return(AE_ERROR);
+	}
+
+	/*
+	 * TBD: what about nested packages? */
+
+	for (count = 0; count < obj_desc->package.count; count++) {
+		sub_object = obj_desc->package.elements[count];
+
+		if (sub_object->common.type == INTERNAL_TYPE_REFERENCE) {
+			if (sub_object->reference.opcode == AML_ZERO_OP) {
+				sub_object->common.type = ACPI_TYPE_INTEGER;
+				sub_object->integer.value = 0;
+			}
+
+			else if (sub_object->reference.opcode == AML_ONE_OP) {
+				sub_object->common.type = ACPI_TYPE_INTEGER;
+				sub_object->integer.value = 1;
+			}
+
+			else if (sub_object->reference.opcode == AML_ONES_OP) {
+				sub_object->common.type = ACPI_TYPE_INTEGER;
+				sub_object->integer.value = ACPI_INTEGER_MAX;
+			}
+		}
+	}
+
+	return(AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ut_walk_package_tree
+ *
+ * PARAMETERS:  Obj_desc        - The Package object on which to resolve refs
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Walk through a package
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_ut_walk_package_tree (
+	ACPI_OPERAND_OBJECT     *source_object,
+	void                    *target_object,
+	ACPI_PKG_CALLBACK       walk_callback,
+	void                    *context)
+{
+	ACPI_STATUS             status = AE_OK;
+	ACPI_GENERIC_STATE      *state_list = NULL;
+	ACPI_GENERIC_STATE      *state;
+	u32                     this_index;
+	ACPI_OPERAND_OBJECT     *this_source_obj;
+
+
+	state = acpi_ut_create_pkg_state (source_object, target_object, 0);
+	if (!state) {
+		return (AE_NO_MEMORY);
+	}
+
+	while (state) {
+		this_index    = state->pkg.index;
+		this_source_obj = (ACPI_OPERAND_OBJECT *)
+				  state->pkg.source_object->package.elements[this_index];
+
+		/*
+		 * Check for
+		 * 1) An uninitialized package element.  It is completely
+		 *      legal to declare a package and leave it uninitialized
+		 * 2) Not an internal object - can be a namespace node instead
+		 * 3) Any type other than a package.  Packages are handled in else
+		 *      case below.
+		 */
+		if ((!this_source_obj) ||
+			(!VALID_DESCRIPTOR_TYPE (
+					this_source_obj, ACPI_DESC_TYPE_INTERNAL)) ||
+			(!IS_THIS_OBJECT_TYPE (
+					this_source_obj, ACPI_TYPE_PACKAGE))) {
+
+			status = walk_callback (ACPI_COPY_TYPE_SIMPLE, this_source_obj,
+					 state, context);
+			if (ACPI_FAILURE (status)) {
+				/* TBD: must delete package created up to this point */
+
+				return (status);
+			}
+
+			state->pkg.index++;
+			while (state->pkg.index >= state->pkg.source_object->package.count) {
+				/*
+				 * We've handled all of the objects at this level,  This means
+				 * that we have just completed a package.  That package may
+				 * have contained one or more packages itself.
+				 *
+				 * Delete this state and pop the previous state (package).
+				 */
+				acpi_ut_delete_generic_state (state);
+				state = acpi_ut_pop_generic_state (&state_list);
+
+
+				/* Finished when there are no more states */
+
+				if (!state) {
+					/*
+					 * We have handled all of the objects in the top level
+					 * package just add the length of the package objects
+					 * and exit
+					 */
+					return (AE_OK);
+				}
+
+				/*
+				 * Go back up a level and move the index past the just
+				 * completed package object.
+				 */
+				state->pkg.index++;
+			}
+		}
+
+		else {
+			/* This is a sub-object of type package */
+
+			status = walk_callback (ACPI_COPY_TYPE_PACKAGE, this_source_obj,
+					  state, context);
+			if (ACPI_FAILURE (status)) {
+				/* TBD: must delete package created up to this point */
+
+				return (status);
+			}
+
+
+			/*
+			 * The callback above returned a new target package object.
+			 */
+
+			/*
+			 * Push the current state and create a new one
+			 */
+			acpi_ut_push_generic_state (&state_list, state);
+			state = acpi_ut_create_pkg_state (this_source_obj,
+					   state->pkg.this_target_obj, 0);
+			if (!state) {
+				/* TBD: must delete package created up to this point */
+
+				return (AE_NO_MEMORY);
+			}
+		}
+	}
+
+	/* We should never get here */
+
+	return (AE_AML_INTERNAL);
+
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    _Report_error
+ *
+ * PARAMETERS:  Module_name         - Caller's module name (for error output)
+ *              Line_number         - Caller's line number (for error output)
+ *              Component_id        - Caller's component ID (for error output)
+ *              Message             - Error message to use on failure
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Print error message
+ *
+ ******************************************************************************/
+
+void
+_report_error (
+	NATIVE_CHAR             *module_name,
+	u32                     line_number,
+	u32                     component_id)
+{
+
+
+	acpi_os_printf ("%8s-%04d: *** Error: ", module_name, line_number);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    _Report_warning
+ *
+ * PARAMETERS:  Module_name         - Caller's module name (for error output)
+ *              Line_number         - Caller's line number (for error output)
+ *              Component_id        - Caller's component ID (for error output)
+ *              Message             - Error message to use on failure
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Print warning message
+ *
+ ******************************************************************************/
+
+void
+_report_warning (
+	NATIVE_CHAR             *module_name,
+	u32                     line_number,
+	u32                     component_id)
+{
+
+	acpi_os_printf ("%8s-%04d: *** Warning: ", module_name, line_number);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    _Report_info
+ *
+ * PARAMETERS:  Module_name         - Caller's module name (for error output)
+ *              Line_number         - Caller's line number (for error output)
+ *              Component_id        - Caller's component ID (for error output)
+ *              Message             - Error message to use on failure
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Print information message
+ *
+ ******************************************************************************/
+
+void
+_report_info (
+	NATIVE_CHAR             *module_name,
+	u32                     line_number,
+	u32                     component_id)
+{
+
+	acpi_os_printf ("%8s-%04d: *** Info: ", module_name, line_number);
+}
+
+
diff -urN linux-2.4.6-pre4/drivers/acpi/utilities/utobject.c linux/drivers/acpi/utilities/utobject.c
--- linux-2.4.6-pre4/drivers/acpi/utilities/utobject.c	Wed Dec 31 16:00:00 1969
+++ linux/drivers/acpi/utilities/utobject.c	Mon Dec  3 22:48:42 2001
@@ -0,0 +1,625 @@
+/******************************************************************************
+ *
+ * Module Name: utobject - ACPI object create/delete/size/cache routines
+ *              $Revision: 46 $
+ *
+ *****************************************************************************/
+
+/*
+ *  Copyright (C) 2000, 2001 R. Byron Moore
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#include "acpi.h"
+#include "acinterp.h"
+#include "acnamesp.h"
+#include "actables.h"
+#include "amlcode.h"
+
+
+#define _COMPONENT          ACPI_UTILITIES
+	 MODULE_NAME         ("utobject")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    _Ut_create_internal_object
+ *
+ * PARAMETERS:  Address             - Address of the memory to deallocate
+ *              Component           - Component type of caller
+ *              Module              - Source file name of caller
+ *              Line                - Line number of caller
+ *              Type                - ACPI Type of the new object
+ *
+ * RETURN:      Object              - The new object.  Null on failure
+ *
+ * DESCRIPTION: Create and initialize a new internal object.
+ *
+ * NOTE:        We always allocate the worst-case object descriptor because
+ *              these objects are cached, and we want them to be
+ *              one-size-satisifies-any-request.  This in itself may not be
+ *              the most memory efficient, but the efficiency of the object
+ *              cache should more than make up for this!
+ *
+ ******************************************************************************/
+
+ACPI_OPERAND_OBJECT  *
+_ut_create_internal_object (
+	NATIVE_CHAR             *module_name,
+	u32                     line_number,
+	u32                     component_id,
+	ACPI_OBJECT_TYPE8       type)
+{
+	ACPI_OPERAND_OBJECT     *object;
+
+
+	/* Allocate the raw object descriptor */
+
+	object = _ut_allocate_object_desc (module_name, line_number, component_id);
+	if (!object) {
+		/* Allocation failure */
+
+		return (NULL);
+	}
+
+	/* Save the object type in the object descriptor */
+
+	object->common.type = type;
+
+	/* Init the reference count */
+
+	object->common.reference_count = 1;
+
+	/* Any per-type initialization should go here */
+
+
+	return (object);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ut_valid_internal_object
+ *
+ * PARAMETERS:  Operand             - Object to be validated
+ *
+ * RETURN:      Validate a pointer to be an ACPI_OPERAND_OBJECT
+ *
+ ******************************************************************************/
+
+u8
+acpi_ut_valid_internal_object (
+	void                    *object)
+{
+
+	PROC_NAME ("Ut_valid_internal_object");
+
+
+	/* Check for a null pointer */
+
+	if (!object) {
+		return (FALSE);
+	}
+
+	/* Check for a pointer within one of the ACPI tables */
+
+	if (acpi_tb_system_table_pointer (object)) {
+		return (FALSE);
+	}
+
+	/* Check the descriptor type field */
+
+	if (!VALID_DESCRIPTOR_TYPE (object, ACPI_DESC_TYPE_INTERNAL)) {
+		/* Not an ACPI internal object, do some further checking */
+
+
+
+
+		return (FALSE);
+	}
+
+
+	/* The object appears to be a valid ACPI_OPERAND_OBJECT  */
+
+	return (TRUE);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    _Ut_allocate_object_desc
+ *
+ * PARAMETERS:  Module_name         - Caller's module name (for error output)
+ *              Line_number         - Caller's line number (for error output)
+ *              Component_id        - Caller's component ID (for error output)
+ *              Message             - Error message to use on failure
+ *
+ * RETURN:      Pointer to newly allocated object descriptor.  Null on error
+ *
+ * DESCRIPTION: Allocate a new object descriptor.  Gracefully handle
+ *              error conditions.
+ *
+ ******************************************************************************/
+
+void *
+_ut_allocate_object_desc (
+	NATIVE_CHAR             *module_name,
+	u32                     line_number,
+	u32                     component_id)
+{
+	ACPI_OPERAND_OBJECT     *object;
+
+
+	acpi_ut_acquire_mutex (ACPI_MTX_CACHES);
+
+	acpi_gbl_object_cache_requests++;
+
+	/* Check the cache first */
+
+	if (acpi_gbl_object_cache) {
+		/* There is an object available, use it */
+
+		object = acpi_gbl_object_cache;
+		acpi_gbl_object_cache = object->cache.next;
+		object->cache.next = NULL;
+
+		acpi_gbl_object_cache_hits++;
+		acpi_gbl_object_cache_depth--;
+
+		acpi_ut_release_mutex (ACPI_MTX_CACHES);
+	}
+
+	else {
+		/* The cache is empty, create a new object */
+
+		acpi_ut_release_mutex (ACPI_MTX_CACHES);
+
+		/* Attempt to allocate new descriptor */
+
+		object = _ut_callocate (sizeof (ACPI_OPERAND_OBJECT), component_id,
+				  module_name, line_number);
+		if (!object) {
+			/* Allocation failed */
+
+			_REPORT_ERROR (module_name, line_number, component_id,
+					  ("Could not allocate an object descriptor\n"));
+
+			return (NULL);
+		}
+
+		/* Memory allocation metrics - compiled out in non debug mode. */
+
+		INCREMENT_OBJECT_METRICS (sizeof (ACPI_OPERAND_OBJECT));
+	}
+
+	/* Mark the descriptor type */
+
+	object->common.data_type = ACPI_DESC_TYPE_INTERNAL;
+
+	return (object);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ut_delete_object_desc
+ *
+ * PARAMETERS:  Object          - Acpi internal object to be deleted
+ *
+ * RETURN:      None.
+ *
+ * DESCRIPTION: Free an ACPI object descriptor or add it to the object cache
+ *
+ ******************************************************************************/
+
+void
+acpi_ut_delete_object_desc (
+	ACPI_OPERAND_OBJECT     *object)
+{
+
+
+	/* Make sure that the object isn't already in the cache */
+
+	if (object->common.data_type == (ACPI_DESC_TYPE_INTERNAL | ACPI_CACHED_OBJECT)) {
+		return;
+	}
+
+	/* Object must be an ACPI_OPERAND_OBJECT  */
+
+	if (object->common.data_type != ACPI_DESC_TYPE_INTERNAL) {
+		return;
+	}
+
+
+	/* If cache is full, just free this object */
+
+	if (acpi_gbl_object_cache_depth >= MAX_OBJECT_CACHE_DEPTH) {
+		/*
+		 * Memory allocation metrics.  Call the macro here since we only
+		 * care about dynamically allocated objects.
+		 */
+		DECREMENT_OBJECT_METRICS (sizeof (ACPI_OPERAND_OBJECT));
+
+		acpi_ut_free (object);
+		return;
+	}
+
+	acpi_ut_acquire_mutex (ACPI_MTX_CACHES);
+
+	/* Clear the entire object.  This is important! */
+
+	MEMSET (object, 0, sizeof (ACPI_OPERAND_OBJECT));
+	object->common.data_type = ACPI_DESC_TYPE_INTERNAL | ACPI_CACHED_OBJECT;
+
+	/* Put the object at the head of the global cache list */
+
+	object->cache.next = acpi_gbl_object_cache;
+	acpi_gbl_object_cache = object;
+	acpi_gbl_object_cache_depth++;
+
+
+	acpi_ut_release_mutex (ACPI_MTX_CACHES);
+	return;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ut_delete_object_cache
+ *
+ * PARAMETERS:  None
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Purge the global state object cache.  Used during subsystem
+ *              termination.
+ *
+ ******************************************************************************/
+
+void
+acpi_ut_delete_object_cache (
+	void)
+{
+	ACPI_OPERAND_OBJECT     *next;
+
+
+	/* Traverse the global cache list */
+
+	while (acpi_gbl_object_cache) {
+		/* Delete one cached state object */
+
+		next = acpi_gbl_object_cache->cache.next;
+		acpi_gbl_object_cache->cache.next = NULL;
+
+		/*
+		 * Memory allocation metrics.  Call the macro here since we only
+		 * care about dynamically allocated objects.
+		 */
+		DECREMENT_OBJECT_METRICS (sizeof (ACPI_OPERAND_OBJECT));
+
+		acpi_ut_free (acpi_gbl_object_cache);
+		acpi_gbl_object_cache = next;
+		acpi_gbl_object_cache_depth--;
+	}
+
+	return;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ut_init_static_object
+ *
+ * PARAMETERS:  Obj_desc            - Pointer to a "static" object - on stack
+ *                                    or in the data segment.
+ *
+ * RETURN:      None.
+ *
+ * DESCRIPTION: Initialize a static object.  Sets flags to disallow dynamic
+ *              deletion of the object.
+ *
+ ******************************************************************************/
+
+void
+acpi_ut_init_static_object (
+	ACPI_OPERAND_OBJECT     *obj_desc)
+{
+
+
+	if (!obj_desc) {
+		return;
+	}
+
+
+	/*
+	 * Clear the entire descriptor
+	 */
+	MEMSET ((void *) obj_desc, 0, sizeof (ACPI_OPERAND_OBJECT));
+
+
+	/*
+	 * Initialize the header fields
+	 * 1) This is an ACPI_OPERAND_OBJECT  descriptor
+	 * 2) The size is the full object (worst case)
+	 * 3) The flags field indicates static allocation
+	 * 4) Reference count starts at one (not really necessary since the
+	 *    object can't be deleted, but keeps everything sane)
+	 */
+
+	obj_desc->common.data_type      = ACPI_DESC_TYPE_INTERNAL;
+	obj_desc->common.flags          = AOPOBJ_STATIC_ALLOCATION;
+	obj_desc->common.reference_count = 1;
+
+	return;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ut_get_simple_object_size
+ *
+ * PARAMETERS:  *Internal_object    - Pointer to the object we are examining
+ *              *Ret_length         - Where the length is returned
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: This function is called to determine the space required to
+ *              contain a simple object for return to an API user.
+ *
+ *              The length includes the object structure plus any additional
+ *              needed space.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_ut_get_simple_object_size (
+	ACPI_OPERAND_OBJECT     *internal_object,
+	u32                     *obj_length)
+{
+	u32                     length;
+	ACPI_STATUS             status = AE_OK;
+
+
+	/* Handle a null object (Could be a uninitialized package element -- which is legal) */
+
+	if (!internal_object) {
+		*obj_length = 0;
+		return (AE_OK);
+	}
+
+
+	/* Start with the length of the Acpi object */
+
+	length = sizeof (ACPI_OBJECT);
+
+	if (VALID_DESCRIPTOR_TYPE (internal_object, ACPI_DESC_TYPE_NAMED)) {
+		/* Object is a named object (reference), just return the length */
+
+		*obj_length = (u32) ROUND_UP_TO_NATIVE_WORD (length);
+		return (status);
+	}
+
+
+	/*
+	 * The final length depends on the object type
+	 * Strings and Buffers are packed right up against the parent object and
+	 * must be accessed bytewise or there may be alignment problems on
+	 * certain processors
+	 */
+
+	switch (internal_object->common.type) {
+
+	case ACPI_TYPE_STRING:
+
+		length += internal_object->string.length + 1;
+		break;
+
+
+	case ACPI_TYPE_BUFFER:
+
+		length += internal_object->buffer.length;
+		break;
+
+
+	case ACPI_TYPE_INTEGER:
+	case ACPI_TYPE_PROCESSOR:
+	case ACPI_TYPE_POWER:
+
+		/*
+		 * No extra data for these types
+		 */
+		break;
+
+
+	case INTERNAL_TYPE_REFERENCE:
+
+		/*
+		 * The only type that should be here is internal opcode NAMEPATH_OP -- since
+		 * this means an object reference
+		 */
+		if (internal_object->reference.opcode != AML_INT_NAMEPATH_OP) {
+			status = AE_TYPE;
+		}
+
+		else {
+			/*
+			 * Get the actual length of the full pathname to this object.
+			 * The reference will be converted to the pathname to the object
+			 */
+			length += ROUND_UP_TO_NATIVE_WORD (acpi_ns_get_pathname_length (internal_object->reference.node));
+		}
+		break;
+
+
+	default:
+
+		status = AE_TYPE;
+		break;
+	}
+
+
+	/*
+	 * Account for the space required by the object rounded up to the next
+	 * multiple of the machine word size.  This keeps each object aligned
+	 * on a machine word boundary. (preventing alignment faults on some
+	 * machines.)
+	 */
+	*obj_length = (u32) ROUND_UP_TO_NATIVE_WORD (length);
+
+	return (status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ut_get_element_length
+ *
+ * PARAMETERS:  ACPI_PKG_CALLBACK
+ *
+ * RETURN:      Status          - the status of the call
+ *
+ * DESCRIPTION: Get the length of one package element.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_ut_get_element_length (
+	u8                      object_type,
+	ACPI_OPERAND_OBJECT     *source_object,
+	ACPI_GENERIC_STATE      *state,
+	void                    *context)
+{
+	ACPI_STATUS             status = AE_OK;
+	ACPI_PKG_INFO           *info = (ACPI_PKG_INFO *) context;
+	u32                     object_space;
+
+
+	switch (object_type) {
+	case 0:
+
+		/*
+		 * Simple object - just get the size (Null object/entry is handled
+		 * here also) and sum it into the running package length
+		 */
+		status = acpi_ut_get_simple_object_size (source_object, &object_space);
+		if (ACPI_FAILURE (status)) {
+			return (status);
+		}
+
+		info->length += object_space;
+		break;
+
+
+	case 1:
+		/* Package - nothing much to do here, let the walk handle it */
+
+		info->num_packages++;
+		state->pkg.this_target_obj = NULL;
+		break;
+
+	default:
+		return (AE_BAD_PARAMETER);
+	}
+
+
+	return (status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ut_get_package_object_size
+ *
+ * PARAMETERS:  *Internal_object    - Pointer to the object we are examining
+ *              *Ret_length         - Where the length is returned
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: This function is called to determine the space required to
+ *              contain a package object for return to an API user.
+ *
+ *              This is moderately complex since a package contains other
+ *              objects including packages.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_ut_get_package_object_size (
+	ACPI_OPERAND_OBJECT     *internal_object,
+	u32                     *obj_length)
+{
+	ACPI_STATUS             status;
+	ACPI_PKG_INFO           info;
+
+
+	info.length      = 0;
+	info.object_space = 0;
+	info.num_packages = 1;
+
+	status = acpi_ut_walk_package_tree (internal_object, NULL,
+			 acpi_ut_get_element_length, &info);
+
+	/*
+	 * We have handled all of the objects in all levels of the package.
+	 * just add the length of the package objects themselves.
+	 * Round up to the next machine word.
+	 */
+	info.length += ROUND_UP_TO_NATIVE_WORD (sizeof (ACPI_OBJECT)) *
+			  info.num_packages;
+
+	/* Return the total package length */
+
+	*obj_length = info.length;
+	return (status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ut_get_object_size
+ *
+ * PARAMETERS:  *Internal_object    - Pointer to the object we are examining
+ *              *Ret_length         - Where the length will be returned
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: This function is called to determine the space required to
+ *              contain an object for return to an API user.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_ut_get_object_size(
+	ACPI_OPERAND_OBJECT     *internal_object,
+	u32                     *obj_length)
+{
+	ACPI_STATUS             status;
+
+
+	if ((VALID_DESCRIPTOR_TYPE (internal_object, ACPI_DESC_TYPE_INTERNAL)) &&
+		(IS_THIS_OBJECT_TYPE (internal_object, ACPI_TYPE_PACKAGE))) {
+		status = acpi_ut_get_package_object_size (internal_object, obj_length);
+	}
+
+	else {
+		status = acpi_ut_get_simple_object_size (internal_object, obj_length);
+	}
+
+	return (status);
+}
+
+
diff -urN linux-2.4.6-pre4/drivers/acpi/utilities/utxface.c linux/drivers/acpi/utilities/utxface.c
--- linux-2.4.6-pre4/drivers/acpi/utilities/utxface.c	Wed Dec 31 16:00:00 1969
+++ linux/drivers/acpi/utilities/utxface.c	Mon Dec  3 22:48:42 2001
@@ -0,0 +1,476 @@
+/******************************************************************************
+ *
+ * Module Name: utxface - External interfaces for "global" ACPI functions
+ *              $Revision: 72 $
+ *
+ *****************************************************************************/
+
+/*
+ *  Copyright (C) 2000, 2001 R. Byron Moore
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#include "acpi.h"
+#include "acevents.h"
+#include "achware.h"
+#include "acnamesp.h"
+#include "acinterp.h"
+#include "amlcode.h"
+#include "acdebug.h"
+
+
+#define _COMPONENT          ACPI_UTILITIES
+	 MODULE_NAME         ("utxface")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_initialize_subsystem
+ *
+ * PARAMETERS:  None
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Initializes all global variables.  This is the first function
+ *              called, so any early initialization belongs here.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_initialize_subsystem (
+	void)
+{
+	ACPI_STATUS             status;
+
+
+	/* Initialize all globals used by the subsystem */
+
+	acpi_ut_init_globals ();
+
+	/* Initialize the OS-Dependent layer */
+
+	status = acpi_os_initialize ();
+	if (ACPI_FAILURE (status)) {
+		REPORT_ERROR (("OSD failed to initialize, %s\n",
+			acpi_ut_format_exception (status)));
+		return (status);
+	}
+
+	/* Create the default mutex objects */
+
+	status = acpi_ut_mutex_initialize ();
+	if (ACPI_FAILURE (status)) {
+		REPORT_ERROR (("Global mutex creation failure, %s\n",
+			acpi_ut_format_exception (status)));
+		return (status);
+	}
+
+	/*
+	 * Initialize the namespace manager and
+	 * the root of the namespace tree
+	 */
+
+	status = acpi_ns_root_initialize ();
+	if (ACPI_FAILURE (status)) {
+		REPORT_ERROR (("Namespace initialization failure, %s\n",
+			acpi_ut_format_exception (status)));
+		return (status);
+	}
+
+
+	/* If configured, initialize the AML debugger */
+
+	DEBUGGER_EXEC (acpi_db_initialize ());
+
+	return (status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_enable_subsystem
+ *
+ * PARAMETERS:  Flags           - Init/enable Options
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Completes the subsystem initialization including hardware.
+ *              Puts system into ACPI mode if it isn't already.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_enable_subsystem (
+	u32                     flags)
+{
+	ACPI_STATUS             status = AE_OK;
+
+
+	/* Sanity check the FADT for valid values */
+
+	status = acpi_ut_validate_fadt ();
+	if (ACPI_FAILURE (status)) {
+		return (status);
+	}
+
+	/*
+	 * Install the default Op_region handlers. These are
+	 * installed unless other handlers have already been
+	 * installed via the Install_address_space_handler interface
+	 */
+
+	if (!(flags & ACPI_NO_ADDRESS_SPACE_INIT)) {
+		status = acpi_ev_install_default_address_space_handlers ();
+		if (ACPI_FAILURE (status)) {
+			return (status);
+		}
+	}
+
+	/*
+	 * We must initialize the hardware before we can enable ACPI.
+	 */
+
+	if (!(flags & ACPI_NO_HARDWARE_INIT)) {
+		status = acpi_hw_initialize ();
+		if (ACPI_FAILURE (status)) {
+			return (status);
+		}
+	}
+
+	/*
+	 * Enable ACPI on this platform
+	 */
+
+	if (!(flags & ACPI_NO_ACPI_ENABLE)) {
+		status = acpi_enable ();
+		if (ACPI_FAILURE (status)) {
+			return (status);
+		}
+	}
+
+	/*
+	 * Note:
+	 * We must have the hardware AND events initialized before we can execute
+	 * ANY control methods SAFELY.  Any control method can require ACPI hardware
+	 * support, so the hardware MUST be initialized before execution!
+	 */
+
+	if (!(flags & ACPI_NO_EVENT_INIT)) {
+		status = acpi_ev_initialize ();
+		if (ACPI_FAILURE (status)) {
+			return (status);
+		}
+	}
+
+
+	/*
+	 * Initialize all device objects in the namespace
+	 * This runs the _STA and _INI methods.
+	 */
+
+	if (!(flags & ACPI_NO_DEVICE_INIT)) {
+		status = acpi_ns_initialize_devices ();
+		if (ACPI_FAILURE (status)) {
+			return (status);
+		}
+	}
+
+
+	/*
+	 * Initialize the objects that remain uninitialized.  This
+	 * runs the executable AML that is part of the declaration of Op_regions
+	 * and Fields.
+	 */
+
+	if (!(flags & ACPI_NO_OBJECT_INIT)) {
+		status = acpi_ns_initialize_objects ();
+		if (ACPI_FAILURE (status)) {
+			return (status);
+		}
+	}
+
+
+	return (status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_terminate
+ *
+ * PARAMETERS:  None
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Shutdown the ACPI subsystem.  Release all resources.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_terminate (void)
+{
+	ACPI_STATUS             status;
+
+
+	/* Ensure that ACPI has been initialized */
+
+	ACPI_IS_INITIALIZATION_COMPLETE (status);
+	if (ACPI_FAILURE (status)) {
+		return (status);
+	}
+
+	/* Terminate the AML Debugger if present */
+
+	DEBUGGER_EXEC(acpi_gbl_db_terminate_threads = TRUE);
+
+	/* TBD: [Investigate] This is no longer needed?*/
+/*    Acpi_ut_release_mutex (ACPI_MTX_DEBUG_CMD_READY); */
+
+
+	/* Shutdown and free all resources */
+
+	acpi_ut_subsystem_shutdown ();
+
+
+	/* Free the mutex objects */
+
+	acpi_ut_mutex_terminate ();
+
+
+	/* Now we can shutdown the OS-dependent layer */
+
+	acpi_os_terminate ();
+
+	return (AE_OK);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION:    Acpi_get_system_info
+ *
+ * PARAMETERS:  Out_buffer      - a pointer to a buffer to receive the
+ *                                resources for the device
+ *              Buffer_length   - the number of bytes available in the buffer
+ *
+ * RETURN:      Status          - the status of the call
+ *
+ * DESCRIPTION: This function is called to get information about the current
+ *              state of the ACPI subsystem.  It will return system information
+ *              in the Out_buffer.
+ *
+ *              If the function fails an appropriate status will be returned
+ *              and the value of Out_buffer is undefined.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_get_system_info (
+	ACPI_BUFFER             *out_buffer)
+{
+	ACPI_SYSTEM_INFO        *info_ptr;
+	u32                     i;
+	ACPI_STATUS             status;
+
+
+	/* Ensure that ACPI has been initialized */
+
+	ACPI_IS_INITIALIZATION_COMPLETE (status);
+	if (ACPI_FAILURE (status)) {
+		return (status);
+	}
+
+	/*
+	 *  Must have a valid buffer
+	 */
+	if ((!out_buffer)         ||
+		(!out_buffer->pointer)) {
+		return (AE_BAD_PARAMETER);
+	}
+
+	if (out_buffer->length < sizeof (ACPI_SYSTEM_INFO)) {
+		/*
+		 *  Caller's buffer is too small
+		 */
+		out_buffer->length = sizeof (ACPI_SYSTEM_INFO);
+
+		return (AE_BUFFER_OVERFLOW);
+	}
+
+
+	/*
+	 *  Set return length and get data
+	 */
+	out_buffer->length = sizeof (ACPI_SYSTEM_INFO);
+	info_ptr = (ACPI_SYSTEM_INFO *) out_buffer->pointer;
+
+	info_ptr->acpi_ca_version   = ACPI_CA_VERSION;
+
+	/* System flags (ACPI capabilities) */
+
+	info_ptr->flags             = acpi_gbl_system_flags;
+
+	/* Timer resolution - 24 or 32 bits  */
+	if (!acpi_gbl_FADT) {
+		info_ptr->timer_resolution = 0;
+	}
+	else if (acpi_gbl_FADT->tmr_val_ext == 0) {
+		info_ptr->timer_resolution = 24;
+	}
+	else {
+		info_ptr->timer_resolution = 32;
+	}
+
+	/* Clear the reserved fields */
+
+	info_ptr->reserved1         = 0;
+	info_ptr->reserved2         = 0;
+
+	/* Current debug levels */
+
+	info_ptr->debug_layer       = acpi_dbg_layer;
+	info_ptr->debug_level       = acpi_dbg_level;
+
+	/* Current status of the ACPI tables, per table type */
+
+	info_ptr->num_table_types = NUM_ACPI_TABLES;
+	for (i = 0; i < NUM_ACPI_TABLES; i++) {
+		info_ptr->table_info[i].count = acpi_gbl_acpi_tables[i].count;
+	}
+
+	return (AE_OK);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION:    Acpi_format_exception
+ *
+ * PARAMETERS:  Out_buffer      - a pointer to a buffer to receive the
+ *                                exception name
+ *
+ * RETURN:      Status          - the status of the call
+ *
+ * DESCRIPTION: This function translates an ACPI exception into an ASCII string.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_format_exception (
+	ACPI_STATUS             exception,
+	ACPI_BUFFER             *out_buffer)
+{
+	u32                     length;
+	NATIVE_CHAR             *formatted_exception;
+
+
+	/*
+	 *  Must have a valid buffer
+	 */
+	if ((!out_buffer)         ||
+		(!out_buffer->pointer)) {
+		return (AE_BAD_PARAMETER);
+	}
+
+
+	/* Convert the exception code (Handles bad exception codes) */
+
+	formatted_exception = acpi_ut_format_exception (exception);
+
+	/*
+	 * Get length of string and check if it will fit in caller's buffer
+	 */
+
+	length = STRLEN (formatted_exception);
+	if (out_buffer->length < length) {
+		out_buffer->length = length;
+		return (AE_BUFFER_OVERFLOW);
+	}
+
+
+	/* Copy the string, all done */
+
+	STRCPY (out_buffer->pointer, formatted_exception);
+
+	return (AE_OK);
+}
+
+
+/*****************************************************************************
+ *
+ * FUNCTION:    Acpi_allocate
+ *
+ * PARAMETERS:  Size                - Size of the allocation
+ *
+ * RETURN:      Address of the allocated memory on success, NULL on failure.
+ *
+ * DESCRIPTION: The subsystem's equivalent of malloc.
+ *              External front-end to the Ut* memory manager
+ *
+ ****************************************************************************/
+
+void *
+acpi_allocate (
+	u32                     size)
+{
+
+	return (acpi_ut_allocate (size));
+}
+
+
+/*****************************************************************************
+ *
+ * FUNCTION:    Acpi_callocate
+ *
+ * PARAMETERS:  Size                - Size of the allocation
+ *
+ * RETURN:      Address of the allocated memory on success, NULL on failure.
+ *
+ * DESCRIPTION: The subsystem's equivalent of calloc.
+ *              External front-end to the Ut* memory manager
+ *
+ ****************************************************************************/
+
+void *
+acpi_callocate (
+	u32                     size)
+{
+
+	return (acpi_ut_callocate (size));
+}
+
+
+/*****************************************************************************
+ *
+ * FUNCTION:    Acpi_free
+ *
+ * PARAMETERS:  Address             - Address of the memory to deallocate
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Frees the memory at Address
+ *              External front-end to the Ut* memory manager
+ *
+ ****************************************************************************/
+
+void
+acpi_free (
+	void                    *address)
+{
+
+	acpi_ut_free (address);
+}
diff -urN linux-2.4.6-pre4/drivers/char/agp/agp.h linux/drivers/char/agp/agp.h
--- linux-2.4.6-pre4/drivers/char/agp/agp.h	Tue Feb 13 14:13:43 2001
+++ linux/drivers/char/agp/agp.h	Mon Dec  3 22:48:42 2001
@@ -92,7 +92,7 @@
 	u32 mode;
 	enum chipset_type type;
 	enum aper_size_type size_type;
-	u32 *key_list;
+	unsigned long *key_list;
 	atomic_t current_memory_agp;
 	atomic_t agp_in_use;
 	int max_memory_agp;	/* in number of pages */
diff -urN linux-2.4.6-pre4/drivers/char/agp/agpgart_be.c linux/drivers/char/agp/agpgart_be.c
--- linux-2.4.6-pre4/drivers/char/agp/agpgart_be.c	Tue Feb 13 14:13:43 2001
+++ linux/drivers/char/agp/agpgart_be.c	Mon Dec  3 22:48:42 2001
@@ -67,7 +67,7 @@
 {
 #if defined(__i386__)
 	asm volatile ("wbinvd":::"memory");
-#elif defined(__alpha__) || defined(__ia64__)
+#elif defined(__alpha__) || defined(__ia64__) || defined(__sparc__)
 	/* ??? I wonder if we'll really need to flush caches, or if the
 	   core logic can manage to keep the system coherent.  The ARM
 	   speaks only of using `cflush' to get things in memory in
diff -urN linux-2.4.6-pre4/drivers/char/drm/r128_drv.h linux/drivers/char/drm/r128_drv.h
--- linux-2.4.6-pre4/drivers/char/drm/r128_drv.h	Fri Mar  2 18:38:37 2001
+++ linux/drivers/char/drm/r128_drv.h	Mon Dec  3 22:48:42 2001
@@ -385,16 +385,14 @@
 #define R128_MAX_VB_VERTS		(0xffff)
 
 
-#define R128_BASE(reg)		((u32)(dev_priv->mmio->handle))
+#define R128_BASE(reg)		((unsigned long)(dev_priv->mmio->handle))
 #define R128_ADDR(reg)		(R128_BASE(reg) + reg)
 
-#define R128_DEREF(reg)		*(__volatile__ int *)R128_ADDR(reg)
-#define R128_READ(reg)		R128_DEREF(reg)
-#define R128_WRITE(reg,val)	do { R128_DEREF(reg) = val; } while (0)
+#define R128_READ(reg)		readl(R128_ADDR(reg))
+#define R128_WRITE(reg,val)	writel(val,R128_ADDR(reg))
 
-#define R128_DEREF8(reg)	*(__volatile__ char *)R128_ADDR(reg)
-#define R128_READ8(reg)		R128_DEREF8(reg)
-#define R128_WRITE8(reg,val)	do { R128_DEREF8(reg) = val; } while (0)
+#define R128_READ8(reg)		readb(R128_ADDR(reg))
+#define R128_WRITE8(reg,val)	writeb(val,R128_ADDR(reg))
 
 #define R128_WRITE_PLL(addr,val)                                              \
 do {                                                                          \
diff -urN linux-2.4.6-pre4/drivers/md/md.c linux/drivers/md/md.c
--- linux-2.4.6-pre4/drivers/md/md.c	Fri May 25 09:48:49 2001
+++ linux/drivers/md/md.c	Mon Dec  3 22:48:42 2001
@@ -634,7 +634,7 @@
 	md_list_add(&rdev->same_set, &mddev->disks);
 	rdev->mddev = mddev;
 	mddev->nb_dev++;
-	printk("bind<%s,%d>\n", partition_name(rdev->dev), mddev->nb_dev);
+	printk("md: bind<%s,%d>\n", partition_name(rdev->dev), mddev->nb_dev);
 }
 
 static void unbind_rdev_from_array (mdk_rdev_t * rdev)
@@ -646,7 +646,7 @@
 	md_list_del(&rdev->same_set);
 	MD_INIT_LIST_HEAD(&rdev->same_set);
 	rdev->mddev->nb_dev--;
-	printk("unbind<%s,%d>\n", partition_name(rdev->dev),
+	printk("md: unbind<%s,%d>\n", partition_name(rdev->dev),
 						 rdev->mddev->nb_dev);
 	rdev->mddev = NULL;
 }
@@ -686,7 +686,7 @@
 
 static void export_rdev (mdk_rdev_t * rdev)
 {
-	printk("export_rdev(%s)\n",partition_name(rdev->dev));
+	printk("md: export_rdev(%s)\n",partition_name(rdev->dev));
 	if (rdev->mddev)
 		MD_BUG();
 	unlock_rdev(rdev);
@@ -694,7 +694,7 @@
 	md_list_del(&rdev->all);
 	MD_INIT_LIST_HEAD(&rdev->all);
 	if (rdev->pending.next != &rdev->pending) {
-		printk("(%s was pending)\n",partition_name(rdev->dev));
+		printk("md: (%s was pending)\n",partition_name(rdev->dev));
 		md_list_del(&rdev->pending);
 		MD_INIT_LIST_HEAD(&rdev->pending);
 	}
@@ -777,14 +777,14 @@
 {
 	int i;
 
-	printk("  SB: (V:%d.%d.%d) ID:<%08x.%08x.%08x.%08x> CT:%08x\n",
+	printk("md:  SB: (V:%d.%d.%d) ID:<%08x.%08x.%08x.%08x> CT:%08x\n",
 		sb->major_version, sb->minor_version, sb->patch_version,
 		sb->set_uuid0, sb->set_uuid1, sb->set_uuid2, sb->set_uuid3,
 		sb->ctime);
-	printk("     L%d S%08d ND:%d RD:%d md%d LO:%d CS:%d\n", sb->level,
+	printk("md:     L%d S%08d ND:%d RD:%d md%d LO:%d CS:%d\n", sb->level,
 		sb->size, sb->nr_disks, sb->raid_disks, sb->md_minor,
 		sb->layout, sb->chunk_size);
-	printk("     UT:%08x ST:%d AD:%d WD:%d FD:%d SD:%d CSUM:%08x E:%08lx\n",
+	printk("md:     UT:%08x ST:%d AD:%d WD:%d FD:%d SD:%d CSUM:%08x E:%08lx\n",
 		sb->utime, sb->state, sb->active_disks, sb->working_disks,
 		sb->failed_disks, sb->spare_disks,
 		sb->sb_csum, (unsigned long)sb->events_lo);
@@ -793,24 +793,24 @@
 		mdp_disk_t *desc;
 
 		desc = sb->disks + i;
-		printk("     D %2d: ", i);
+		printk("md:     D %2d: ", i);
 		print_desc(desc);
 	}
-	printk("     THIS: ");
+	printk("md:     THIS: ");
 	print_desc(&sb->this_disk);
 
 }
 
 static void print_rdev(mdk_rdev_t *rdev)
 {
-	printk(" rdev %s: O:%s, SZ:%08ld F:%d DN:%d ",
+	printk("md: rdev %s: O:%s, SZ:%08ld F:%d DN:%d ",
 		partition_name(rdev->dev), partition_name(rdev->old_dev),
 		rdev->size, rdev->faulty, rdev->desc_nr);
 	if (rdev->sb) {
-		printk("rdev superblock:\n");
+		printk("md: rdev superblock:\n");
 		print_sb(rdev->sb);
 	} else
-		printk("no rdev superblock!\n");
+		printk("md: no rdev superblock!\n");
 }
 
 void md_print_devices (void)
@@ -820,9 +820,9 @@
 	mddev_t *mddev;
 
 	printk("\n");
-	printk("	**********************************\n");
-	printk("	* <COMPLETE RAID STATE PRINTOUT> *\n");
-	printk("	**********************************\n");
+	printk("md:	**********************************\n");
+	printk("md:	* <COMPLETE RAID STATE PRINTOUT> *\n");
+	printk("md:	**********************************\n");
 	ITERATE_MDDEV(mddev,tmp) {
 		printk("md%d: ", mdidx(mddev));
 
@@ -838,7 +838,7 @@
 		ITERATE_RDEV(mddev,rdev,tmp2)
 			print_rdev(rdev);
 	}
-	printk("	**********************************\n");
+	printk("md:	**********************************\n");
 	printk("\n");
 }
 
@@ -917,15 +917,15 @@
 
 	if (!rdev->sb) {
 		MD_BUG();
-		return -1;
+		return 1;
 	}
 	if (rdev->faulty) {
 		MD_BUG();
-		return -1;
+		return 1;
 	}
 	if (rdev->sb->md_magic != MD_SB_MAGIC) {
 		MD_BUG();
-		return -1;
+		return 1;
 	}
 
 	dev = rdev->dev;
@@ -1014,7 +1014,7 @@
 
 int md_update_sb(mddev_t * mddev)
 {
-	int first, err, count = 100;
+	int err, count = 100;
 	struct md_list_head *tmp;
 	mdk_rdev_t *rdev;
 
@@ -1044,13 +1044,9 @@
 	printk(KERN_INFO "md: updating md%d RAID superblock on device\n",
 					mdidx(mddev));
 
-	first = 1;
 	err = 0;
 	ITERATE_RDEV(mddev,rdev,tmp) {
-		if (!first) {
-			first = 0;
-			printk(", ");
-		}
+		printk("md: ");
 		if (rdev->faulty)
 			printk("(skipping faulty ");
 		printk("%s ", partition_name(rdev->dev));
@@ -1061,12 +1057,12 @@
 		} else
 			printk(")\n");
 	}
-	printk(".\n");
 	if (err) {
-		printk("errors occurred during superblock update, repeating\n");
-		if (--count)
+		if (--count) {
+			printk("md: errors occurred during superblock update, repeating\n");
 			goto repeat;
-		printk("excessive errors occurred during superblock update, exiting\n");
+		}
+		printk("md: excessive errors occurred during superblock update, exiting\n");
 	}
 	return 0;
 }
@@ -1092,7 +1088,7 @@
 
 	rdev = (mdk_rdev_t *) kmalloc(sizeof(*rdev), GFP_KERNEL);
 	if (!rdev) {
-		printk("could not alloc mem for %s!\n", partition_name(newdev));
+		printk("md: could not alloc mem for %s!\n", partition_name(newdev));
 		return -ENOMEM;
 	}
 	memset(rdev, 0, sizeof(*rdev));
@@ -1244,7 +1240,7 @@
 					rdev->sb->events_hi--;
 		}
 
-		printk("%s's event counter: %08lx\n", partition_name(rdev->dev),
+		printk("md: %s's event counter: %08lx\n", partition_name(rdev->dev),
 			(unsigned long)rdev->sb->events_lo);
 		if (!freshest) {
 			freshest = rdev;
@@ -1263,7 +1259,7 @@
 	}
 	if (out_of_date) {
 		printk(OUT_OF_DATE);
-		printk("freshest: %s\n", partition_name(freshest->dev));
+		printk("md: freshest: %s\n", partition_name(freshest->dev));
 	}
 	memcpy (sb, freshest->sb, sizeof(*sb));
 
@@ -1489,7 +1485,7 @@
 		rdev->size = calc_dev_size(rdev->dev, mddev, persistent);
 		if (rdev->size < sb->chunk_size / 1024) {
 			printk (KERN_WARNING
-				"Dev %s smaller than chunk_size: %ldk < %dk\n",
+				"md: Dev %s smaller than chunk_size: %ldk < %dk\n",
 				partition_name(rdev->dev),
 				rdev->size, sb->chunk_size / 1024);
 			return -EINVAL;
@@ -1663,7 +1659,7 @@
 
 	err = mddev->pers->run(mddev);
 	if (err) {
-		printk("pers->run() failed ...\n");
+		printk("md: pers->run() failed ...\n");
 		mddev->pers = NULL;
 		return -EINVAL;
 	}
@@ -1705,7 +1701,7 @@
 		set_device_ro(mddev_to_kdev(mddev), 0);
 
 		printk (KERN_INFO
-			"md%d switched to read-write mode.\n", mdidx(mddev));
+			"md: md%d switched to read-write mode.\n", mdidx(mddev));
 		/*
 		 * Kick recovery or resync if necessary
 		 */
@@ -1793,7 +1789,7 @@
 			 * interrupted.
 			 */
 			if (!mddev->recovery_running && !resync_interrupted) {
-				printk("marking sb clean...\n");
+				printk("md: marking sb clean...\n");
 				mddev->sb->state |= 1 << MD_SB_CLEAN;
 			}
 			md_update_sb(mddev);
@@ -1806,12 +1802,12 @@
 	 * Free resources if final stop
 	 */
 	if (!ro) {
-		printk (KERN_INFO "md%d stopped.\n", mdidx(mddev));
+		printk (KERN_INFO "md: md%d stopped.\n", mdidx(mddev));
 		free_mddev(mddev);
 
 	} else
 		printk (KERN_INFO
-			"md%d switched to read-only mode.\n", mdidx(mddev));
+			"md: md%d switched to read-only mode.\n", mdidx(mddev));
 out:
 	return err;
 }
@@ -1843,16 +1839,16 @@
 		return;
 	}
 
-	printk("running: ");
+	printk("md: running: ");
 
 	ITERATE_RDEV(mddev,rdev,tmp) {
 		printk("<%s>", partition_name(rdev->dev));
 	}
-	printk("\nnow!\n");
+	printk("\nmd: now!\n");
 
 	err = do_md_run (mddev);
 	if (err) {
-		printk("do_md_run() returned %d\n", err);
+		printk("md :do_md_run() returned %d\n", err);
 		/*
 		 * prevent the writeback of an unrunnable array
 		 */
@@ -1882,20 +1878,20 @@
 	kdev_t md_kdev;
 
 
-	printk("autorun ...\n");
+	printk("md: autorun ...\n");
 	while (pending_raid_disks.next != &pending_raid_disks) {
 		rdev0 = md_list_entry(pending_raid_disks.next,
 					 mdk_rdev_t, pending);
 
-		printk("considering %s ...\n", partition_name(rdev0->dev));
+		printk("md: considering %s ...\n", partition_name(rdev0->dev));
 		MD_INIT_LIST_HEAD(&candidates);
 		ITERATE_RDEV_PENDING(rdev,tmp) {
 			if (uuid_equal(rdev0, rdev)) {
 				if (!sb_equal(rdev0->sb, rdev->sb)) {
-					printk("%s has same UUID as %s, but superblocks differ ...\n", partition_name(rdev->dev), partition_name(rdev0->dev));
+					printk("md: %s has same UUID as %s, but superblocks differ ...\n", partition_name(rdev->dev), partition_name(rdev0->dev));
 					continue;
 				}
-				printk("  adding %s ...\n", partition_name(rdev->dev));
+				printk("md:  adding %s ...\n", partition_name(rdev->dev));
 				md_list_del(&rdev->pending);
 				md_list_add(&rdev->pending, &candidates);
 			}
@@ -1908,7 +1904,7 @@
 		md_kdev = MKDEV(MD_MAJOR, rdev0->sb->md_minor);
 		mddev = kdev_to_mddev(md_kdev);
 		if (mddev) {
-			printk("md%d already running, cannot run %s\n",
+			printk("md: md%d already running, cannot run %s\n",
 				 mdidx(mddev), partition_name(rdev0->dev));
 			ITERATE_RDEV_GENERIC(candidates,pending,rdev,tmp)
 				export_rdev(rdev);
@@ -1921,7 +1917,7 @@
  		}
  		if (md_kdev == countdev)
  			atomic_inc(&mddev->active);
-		printk("created md%d\n", mdidx(mddev));
+		printk("md: created md%d\n", mdidx(mddev));
 		ITERATE_RDEV_GENERIC(candidates,pending,rdev,tmp) {
 			bind_rdev_to_array(rdev, mddev);
 			md_list_del(&rdev->pending);
@@ -1929,7 +1925,7 @@
 		}
 		autorun_array(mddev);
 	}
-	printk("... autorun DONE.\n");
+	printk("md: ... autorun DONE.\n");
 }
 
 /*
@@ -1971,7 +1967,7 @@
 	mdk_rdev_t *start_rdev = NULL, *rdev;
 
 	if (md_import_device(startdev, 1)) {
-		printk("could not import %s!\n", partition_name(startdev));
+		printk("md: could not import %s!\n", partition_name(startdev));
 		goto abort;
 	}
 
@@ -1981,7 +1977,7 @@
 		goto abort;
 	}
 	if (start_rdev->faulty) {
-		printk("can not autostart based on faulty %s!\n",
+		printk("md: can not autostart based on faulty %s!\n",
 						partition_name(startdev));
 		goto abort;
 	}
@@ -1991,7 +1987,7 @@
 
 	err = detect_old_array(sb);
 	if (err) {
-		printk("array version is too old to be autostarted, use raidtools 0.90 mkraid --upgrade\nto upgrade the array without data loss!\n");
+		printk("md: array version is too old to be autostarted, use raidtools 0.90 mkraid --upgrade\nto upgrade the array without data loss!\n");
 		goto abort;
 	}
 
@@ -2007,7 +2003,7 @@
 		if (dev == startdev)
 			continue;
 		if (md_import_device(dev, 1)) {
-			printk("could not import %s, trying to run array nevertheless.\n", partition_name(dev));
+			printk("md: could not import %s, trying to run array nevertheless.\n", partition_name(dev));
 			continue;
 		}
 		rdev = find_rdev_all(dev);
@@ -2129,7 +2125,7 @@
 	dev = MKDEV(info->major,info->minor);
 
 	if (find_rdev_all(dev)) {
-		printk("device %s already used in a RAID array!\n",
+		printk("md: device %s already used in a RAID array!\n",
 				partition_name(dev));
 		return -EBUSY;
 	}
@@ -2137,7 +2133,7 @@
 		/* expecting a device which has a superblock */
 		err = md_import_device(dev, 1);
 		if (err) {
-			printk("md error, md_import_device returned %d\n", err);
+			printk("md: md_import_device returned %d\n", err);
 			return -EINVAL;
 		}
 		rdev = find_rdev_all(dev);
@@ -2192,9 +2188,9 @@
 
 		persistent = !mddev->sb->not_persistent;
 		if (!persistent)
-			printk("nonpersistent superblock ...\n");
+			printk("md: nonpersistent superblock ...\n");
 		if (!mddev->sb->chunk_size)
-			printk("no chunksize?\n");
+			printk("md: no chunksize?\n");
 
 		size = calc_dev_size(dev, mddev, persistent);
 		rdev->sb_offset = calc_dev_sboffset(dev, mddev, persistent);
@@ -2221,7 +2217,7 @@
 	if (!mddev->pers)
 		return -ENODEV;
 
-	printk("trying to remove %s from md%d ... \n",
+	printk("md: trying to remove %s from md%d ... \n",
 		partition_name(dev), mdidx(mddev));
 
 	if (!mddev->pers->diskop) {
@@ -2261,7 +2257,7 @@
 
 	return 0;
 busy:
-	printk("cannot remove active disk %s from md%d ... \n",
+	printk("md: cannot remove active disk %s from md%d ... \n",
 		partition_name(dev), mdidx(mddev));
 	return -EBUSY;
 }
@@ -2276,7 +2272,7 @@
 	if (!mddev->pers)
 		return -ENODEV;
 
-	printk("trying to hot-add %s to md%d ... \n",
+	printk("md: trying to hot-add %s to md%d ... \n",
 		partition_name(dev), mdidx(mddev));
 
 	if (!mddev->pers->diskop) {
@@ -2431,31 +2427,31 @@
 
 static int set_disk_info (mddev_t * mddev, void * arg)
 {
-	printk("not yet");
+	printk("md: not yet");
 	return -EINVAL;
 }
 
 static int clear_array (mddev_t * mddev)
 {
-	printk("not yet");
+	printk("md: not yet");
 	return -EINVAL;
 }
 
 static int write_raid_info (mddev_t * mddev)
 {
-	printk("not yet");
+	printk("md: not yet");
 	return -EINVAL;
 }
 
 static int protect_array (mddev_t * mddev)
 {
-	printk("not yet");
+	printk("md: not yet");
 	return -EINVAL;
 }
 
 static int unprotect_array (mddev_t * mddev)
 {
-	printk("not yet");
+	printk("md: not yet");
 	return -EINVAL;
 }
 
@@ -2551,7 +2547,7 @@
 		case SET_ARRAY_INFO:
 		case START_ARRAY:
 			if (mddev) {
-				printk("array md%d already exists!\n",
+				printk("md: array md%d already exists!\n",
 								mdidx(mddev));
 				err = -EEXIST;
 				goto abort;
@@ -2573,12 +2569,12 @@
 			 */
 			err = lock_mddev(mddev);
 			if (err) {
-				printk("ioctl, reason %d, cmd %d\n", err, cmd);
+				printk("md: ioctl, reason %d, cmd %d\n", err, cmd);
 				goto abort;
 			}
 
 			if (mddev->sb) {
-				printk("array md%d already has a superblock!\n",
+				printk("md: array md%d already has a superblock!\n",
 				       mdidx(mddev));
 				err = -EBUSY;
 				goto abort_unlock;
@@ -2591,7 +2587,7 @@
 				}
 				err = set_array_info(mddev, &info);
 				if (err) {
-					printk("couldnt set array info. %d\n", err);
+					printk("md: couldnt set array info. %d\n", err);
 					goto abort_unlock;
 				}
 			}
@@ -2603,7 +2599,7 @@
 			 */
 			err = autostart_array((kdev_t)arg, dev);
 			if (err) {
-				printk("autostart %s failed!\n",
+				printk("md: autostart %s failed!\n",
 					partition_name((kdev_t)arg));
 				goto abort;
 			}
@@ -2622,7 +2618,7 @@
 	}
 	err = lock_mddev(mddev);
 	if (err) {
-		printk("ioctl lock interrupted, reason %d, cmd %d\n",err, cmd);
+		printk("md: ioctl lock interrupted, reason %d, cmd %d\n",err, cmd);
 		goto abort;
 	}
 	/* if we don't have a superblock yet, only ADD_NEW_DISK or STOP_ARRAY is allowed */
@@ -2760,7 +2756,7 @@
 		}
 
 		default:
-			printk(KERN_WARNING "%s(pid %d) used obsolete MD ioctl, upgrade your software to use new ictls.\n", current->comm, current->pid);
+			printk(KERN_WARNING "md: %s(pid %d) used obsolete MD ioctl, upgrade your software to use new ictls.\n", current->comm, current->pid);
 			err = -EINVAL;
 			goto abort_unlock;
 	}
@@ -2773,7 +2769,7 @@
 	return err;
 done:
 	if (err)
-		printk("huh12?\n");
+		printk("md: huh12?\n");
 abort:
 	return err;
 }
@@ -2835,7 +2831,7 @@
 	 */
 	current->policy = SCHED_OTHER;
 	current->nice = -20;
-//	md_unlock_kernel();
+	md_unlock_kernel();
 
 	up(thread->sem);
 
@@ -2845,9 +2841,9 @@
 		add_wait_queue(&thread->wqueue, &wait);
 		set_task_state(current, TASK_INTERRUPTIBLE);
 		if (!test_bit(THREAD_WAKEUP, &thread->flags)) {
-			dprintk("thread %p went to sleep.\n", thread);
+			dprintk("md: thread %p went to sleep.\n", thread);
 			schedule();
-			dprintk("thread %p woke up.\n", thread);
+			dprintk("md: thread %p woke up.\n", thread);
 		}
 		current->state = TASK_RUNNING;
 		remove_wait_queue(&thread->wqueue, &wait);
@@ -2859,7 +2855,7 @@
 		} else
 			break;
 		if (md_signal_pending(current)) {
-			printk("%8s(%d) flushing signals.\n", current->comm,
+			printk("md: %8s(%d) flushing signals.\n", current->comm,
 				current->pid);
 			md_flush_signals();
 		}
@@ -2870,7 +2866,7 @@
 
 void md_wakeup_thread(mdk_thread_t *thread)
 {
-	dprintk("waking up MD thread %p.\n", thread);
+	dprintk("md: waking up MD thread %p.\n", thread);
 	set_bit(THREAD_WAKEUP, &thread->flags);
 	wake_up(&thread->wqueue);
 }
@@ -2909,7 +2905,7 @@
 		MD_BUG();
 		return;
 	}
-	printk("interrupting MD-thread pid %d\n", thread->tsk->pid);
+	printk("md: interrupting MD-thread pid %d\n", thread->tsk->pid);
 	send_sig(SIGKILL, thread->tsk, 1);
 }
 
@@ -3132,7 +3128,7 @@
 		return -EBUSY;
 
 	pers[pnum] = p;
-	printk(KERN_INFO "%s personality registered\n", p->name);
+	printk(KERN_INFO "md: %s personality registered\n", p->name);
 	return 0;
 }
 
@@ -3141,7 +3137,7 @@
 	if (pnum >= MAX_PERSONALITY)
 		return -EINVAL;
 
-	printk(KERN_INFO "%s personality unregistered\n", pers[pnum]->name);
+	printk(KERN_INFO "md: %s personality unregistered\n", pers[pnum]->name);
 	pers[pnum] = NULL;
 	return 0;
 }
@@ -3203,9 +3199,9 @@
 		curr_events = kstat.dk_drive_rblk[major][idx] +
 						kstat.dk_drive_wblk[major][idx] ;
 		curr_events -= sync_io[major][idx];
-//		printk("events(major: %d, idx: %d): %ld\n", major, idx, curr_events);
-		if (curr_events != rdev->last_events) {
-//			printk("!I(%ld)", curr_events - rdev->last_events);
+//		printk("md: events(major: %d, idx: %d): %ld\n", major, idx, curr_events);
+		if ((curr_events - rdev->last_events) > 32) {
+//			printk("!I(%ld)%x", curr_events - rdev->last_events, rdev->dev);
 			rdev->last_events = curr_events;
 			idle = 0;
 		}
@@ -3332,7 +3328,7 @@
 			 * got a signal, exit.
 			 */
 			mddev->curr_resync = 0;
-			printk("md_do_sync() got signal ... exiting\n");
+			printk("md: md_do_sync() got signal ... exiting\n");
 			md_flush_signals();
 			err = -EINTR;
 			goto out;
@@ -3481,7 +3477,7 @@
 	if ((code == MD_SYS_DOWN) || (code == MD_SYS_HALT)
 				  || (code == MD_SYS_POWER_OFF)) {
 
-		printk(KERN_INFO "stopping all md devices.\n");
+		printk(KERN_INFO "md: stopping all md devices.\n");
 
 		ITERATE_MDDEV(mddev,tmp)
 			do_md_stop (mddev, 1);
@@ -3518,7 +3514,7 @@
 	max_readahead[MAJOR_NR] = md_maxreadahead;
 	hardsect_size[MAJOR_NR] = md_hardsect_sizes;
 
-	printk("md.c: sizeof(mdp_super_t) = %d\n", (int)sizeof(mdp_super_t));
+	dprintk("md: sizeof(mdp_super_t) = %d\n", (int)sizeof(mdp_super_t));
 
 #ifdef CONFIG_PROC_FS
 	create_proc_read_entry("mdstat", 0, NULL, md_status_read_proc, NULL);
@@ -3530,13 +3526,13 @@
 	static char * name = "mdrecoveryd";
 	int minor;
 	
-	printk (KERN_INFO "md driver %d.%d.%d MAX_MD_DEVS=%d, MD_SB_DISKS=%d\n",
+	printk (KERN_INFO "md: md driver %d.%d.%d MAX_MD_DEVS=%d, MD_SB_DISKS=%d\n",
 			MD_MAJOR_VERSION, MD_MINOR_VERSION,
 			MD_PATCHLEVEL_VERSION, MAX_MD_DEVS, MD_SB_DISKS);
 
 	if (devfs_register_blkdev (MAJOR_NR, "md", &md_fops))
 	{
-		printk (KERN_ALERT "Unable to get major %d for md\n", MAJOR_NR);
+		printk (KERN_ALERT "md: Unable to get major %d for md\n", MAJOR_NR);
 		return (-1);
 	}
 	devfs_handle = devfs_mk_dir (NULL, "md", NULL);
@@ -3560,7 +3556,7 @@
 
 	md_recovery_thread = md_register_thread(md_do_recovery, NULL, name);
 	if (!md_recovery_thread)
-		printk(KERN_ALERT "bug: couldn't allocate md_recovery_thread\n");
+		printk(KERN_ALERT "md: bug: couldn't allocate md_recovery_thread\n");
 
 	md_register_reboot_notifier(&md_notifier);
 	raid_table_header = register_sysctl_table(raid_root_table, 1);
@@ -3605,13 +3601,13 @@
 	mdk_rdev_t *rdev;
 	int i;
 
-	printk(KERN_INFO "autodetecting RAID arrays\n");
+	printk(KERN_INFO "md: Autodetecting RAID arrays.\n");
 
 	for (i = 0; i < dev_cnt; i++) {
 		kdev_t dev = detected_devices[i];
 
 		if (md_import_device(dev,1)) {
-			printk(KERN_ALERT "could not import %s!\n",
+			printk(KERN_ALERT "md: could not import %s!\n",
 			       partition_name(dev));
 			continue;
 		}
@@ -3638,7 +3634,7 @@
 	char device_set [MAX_MD_DEVS];
 	int pers[MAX_MD_DEVS];
 	int chunk[MAX_MD_DEVS];
-	kdev_t devices[MAX_MD_DEVS][MD_SB_DISKS];
+	char *device_names[MAX_MD_DEVS];
 } md_setup_args md__initdata;
 
 /*
@@ -3657,25 +3653,25 @@
  *             md=n,device-list      reads a RAID superblock from the devices
  *             elements in device-list are read by name_to_kdev_t so can be
  *             a hex number or something like /dev/hda1 /dev/sdb
+ * 2001-06-03: Dave Cinege <dcinege@psychosis.com>
+ *		Shifted name_to_kdev_t() and related operations to md_set_drive()
+ *		for later execution. Rewrote section to make devfs compatible.
  */
-#ifndef MODULE
-extern kdev_t name_to_kdev_t(char *line) md__init;
 static int md__init md_setup(char *str)
 {
-	int minor, level, factor, fault, i=0;
-	kdev_t device;
-	char *devnames, *pername = "";
+	int minor, level, factor, fault;
+	char *pername = "";
+	char *str1 = str;
 
 	if (get_option(&str, &minor) != 2) {	/* MD Number */
 		printk("md: Too few arguments supplied to md=.\n");
 		return 0;
 	}
 	if (minor >= MAX_MD_DEVS) {
-		printk ("md: Minor device number too high.\n");
+		printk ("md: md=%d, Minor device number too high.\n", minor);
 		return 0;
-	} else if (md_setup_args.device_set[minor]) {
-		printk ("md: Warning - md=%d,... has been specified twice;\n"
-			"    will discard the first definition.\n", minor);
+	} else if (md_setup_args.device_names[minor]) {
+		printk ("md: md=%d, Specified more then once. Replacing previous definition.\n", minor);
 	}
 	switch (get_option(&str, &level)) {	/* RAID Personality */
 	case 2: /* could be 0 or -1.. */
@@ -3706,53 +3702,72 @@
 		}
 		/* FALL THROUGH */
 	case 1: /* the first device is numeric */
-		md_setup_args.devices[minor][i++] = level;
+		str = str1;
 		/* FALL THROUGH */
 	case 0:
 		md_setup_args.pers[minor] = 0;
 		pername="super-block";
 	}
-	devnames = str;
-	for (; i<MD_SB_DISKS && str; i++) {
-		if ((device = name_to_kdev_t(str))) {
-			md_setup_args.devices[minor][i] = device;
-		} else {
-			printk ("md: Unknown device name, %s.\n", str);
-			return 0;
-		}
-		if ((str = strchr(str, ',')) != NULL)
-			str++;
-	}
-	if (!i) {
-		printk ("md: No devices specified for md%d?\n", minor);
-		return 0;
-	}
-
+	
 	printk ("md: Will configure md%d (%s) from %s, below.\n",
-		minor, pername, devnames);
-	md_setup_args.devices[minor][i] = (kdev_t) 0;
-	md_setup_args.device_set[minor] = 1;
+		minor, pername, str);
+	md_setup_args.device_names[minor] = str;
+			
 	return 1;
 }
-#endif /* !MODULE */
 
+extern kdev_t name_to_kdev_t(char *line) md__init;
 void md__init md_setup_drive(void)
 {
 	int minor, i;
 	kdev_t dev;
 	mddev_t*mddev;
+	kdev_t devices[MD_SB_DISKS+1];
 
 	for (minor = 0; minor < MAX_MD_DEVS; minor++) {
+		int err = 0;
+		char *devname;
 		mdu_disk_info_t dinfo;
 
-		int err = 0;
-		if (!md_setup_args.device_set[minor])
+		if ((devname = md_setup_args.device_names[minor]) == 0)	continue;
+	
+		for (i = 0; i < MD_SB_DISKS && devname != 0; i++) {
+
+			char *p;
+			void *handle;
+	
+			if ((p = strchr(devname, ',')) != NULL)
+				*p++ = 0;
+
+			dev = name_to_kdev_t(devname);
+			handle = devfs_find_handle(NULL, devname, MAJOR (dev), MINOR (dev),
+						    DEVFS_SPECIAL_BLK, 1);
+			if (handle != 0) {
+				unsigned major, minor;
+				devfs_get_maj_min(handle, &major, &minor);
+				dev = MKDEV(major, minor);
+			}
+			if (dev == 0) {
+				printk ("md: Unknown device name: %s\n", devname);
+				break;
+			}
+			
+			devices[i] = dev;
+			md_setup_args.device_set[minor] = 1;
+			
+			devname = p;
+		}
+		devices[i] = 0;
+		
+		if (md_setup_args.device_set[minor] == 0)
 			continue;
-		printk("md: Loading md%d.\n", minor);
+		
 		if (mddev_map[minor].mddev) {
-			printk(".. md%d already autodetected - use raid=noautodetect\n", minor);
+			printk("md: Ignoring md=%d, already autodetected. (Use raid=noautodetect)\n", minor);
 			continue;
 		}
+		printk("md: Loading md%d: %s\n", minor, md_setup_args.device_names[minor]);
+		
 		mddev = alloc_mddev(MKDEV(MD_MAJOR,minor));
 		if (mddev == NULL) {
 			printk("md: kmalloc failed - cannot start array %d\n", minor);
@@ -3776,7 +3791,7 @@
 			ainfo.layout = 0;
 			ainfo.chunk_size = md_setup_args.chunk[minor];
 			err = set_array_info(mddev, &ainfo);
-			for (i = 0; !err && (dev = md_setup_args.devices[minor][i]); i++) {
+			for (i = 0; !err && (dev = devices[i]); i++) {
 				dinfo.number = i;
 				dinfo.raid_disk = i;
 				dinfo.state = (1<<MD_DISK_ACTIVE)|(1<<MD_DISK_SYNC);
@@ -3790,7 +3805,7 @@
 			}
 		} else {
 			/* persistent */
-			for (i = 0; (dev = md_setup_args.devices[minor][i]); i++) {
+			for (i = 0; (dev = devices[i]); i++) {
 				dinfo.major = MAJOR(dev);
 				dinfo.minor = MINOR(dev);
 				add_new_disk (mddev, &dinfo);
@@ -3831,7 +3846,7 @@
 int md__init md_run_setup(void)
 {
 	if (raid_setup_args.noautodetect)
-		printk(KERN_INFO "skipping autodetection of RAID arrays\n");
+		printk(KERN_INFO "md: Skipping autodetection of RAID arrays. (raid=noautodetect)\n");
 	else
 		autostart_arrays();
 	md_setup_drive();
diff -urN linux-2.4.6-pre4/drivers/md/raid0.c linux/drivers/md/raid0.c
--- linux-2.4.6-pre4/drivers/md/raid0.c	Mon Dec 11 13:19:35 2000
+++ linux/drivers/md/raid0.c	Mon Dec  3 22:48:42 2001
@@ -80,14 +80,14 @@
 	{
 		struct strip_zone *zone = conf->strip_zone + i;
 
-		printk("zone %d\n", i);
+		printk("raid0: zone %d\n", i);
 		zone->dev_offset = current_offset;
 		smallest = NULL;
 		c = 0;
 
 		ITERATE_RDEV_ORDERED(mddev,rdev,j) {
 
-			printk(" checking %s ...", partition_name(rdev->dev));
+			printk("raid0: checking %s ...", partition_name(rdev->dev));
 			if (rdev->size > current_offset)
 			{
 				printk(" contained as device %d\n", c);
@@ -103,7 +103,7 @@
 
 		zone->nb_dev = c;
 		zone->size = (smallest->size - current_offset) * c;
-		printk(" zone->nb_dev: %d, size: %ld\n",zone->nb_dev,zone->size);
+		printk("raid0: zone->nb_dev: %d, size: %ld\n",zone->nb_dev,zone->size);
 
 		if (!conf->smallest || (zone->size < conf->smallest->size))
 			conf->smallest = zone;
@@ -112,9 +112,9 @@
 		curr_zone_offset += zone->size;
 
 		current_offset = smallest->size;
-		printk("current zone offset: %ld\n", current_offset);
+		printk("raid0: current zone offset: %ld\n", current_offset);
 	}
-	printk("done.\n");
+	printk("raid0: done.\n");
 	return 0;
 }
 
diff -urN linux-2.4.6-pre4/drivers/md/raid1.c linux/drivers/md/raid1.c
--- linux-2.4.6-pre4/drivers/md/raid1.c	Thu May 24 15:40:59 2001
+++ linux/drivers/md/raid1.c	Mon Dec  3 22:48:42 2001
@@ -82,7 +82,7 @@
 			bh = t;
 			cnt--;
 		} else {
-			PRINTK("waiting for %d bh\n", cnt);
+			PRINTK("raid1: waiting for %d bh\n", cnt);
 			wait_event(conf->wait_buffer, conf->freebh_cnt >= cnt);
 		}
 	}
@@ -1123,7 +1123,7 @@
 
 		mddev = r1_bh->mddev;
 		if (mddev->sb_dirty) {
-			printk(KERN_INFO "dirty sb detected, updating.\n");
+			printk(KERN_INFO "raid1: dirty sb detected, updating.\n");
 			mddev->sb_dirty = 0;
 			md_update_sb(mddev);
 		}
diff -urN linux-2.4.6-pre4/drivers/md/raid5.c linux/drivers/md/raid5.c
--- linux-2.4.6-pre4/drivers/md/raid5.c	Thu May 24 15:40:59 2001
+++ linux/drivers/md/raid5.c	Mon Dec  3 22:48:42 2001
@@ -31,6 +31,7 @@
  */
 
 #define NR_STRIPES		256
+#define	IO_THRESHOLD		1
 #define HASH_PAGES		1
 #define HASH_PAGES_ORDER	0
 #define NR_HASH			(HASH_PAGES * PAGE_SIZE / sizeof(struct stripe_head *))
@@ -65,24 +66,33 @@
 			BUG();
 		if (atomic_read(&conf->active_stripes)==0)
 			BUG();
-		if (test_bit(STRIPE_HANDLE, &sh->state)) {
+		if (test_bit(STRIPE_DELAYED, &sh->state))
+			list_add_tail(&sh->lru, &conf->delayed_list);
+		else if (test_bit(STRIPE_HANDLE, &sh->state)) {
 			list_add_tail(&sh->lru, &conf->handle_list);
 			md_wakeup_thread(conf->thread);
-		}
-		else {
+		} else {
+			if (test_and_clear_bit(STRIPE_PREREAD_ACTIVE, &sh->state)) {
+				atomic_dec(&conf->preread_active_stripes);
+				if (atomic_read(&conf->preread_active_stripes) < IO_THRESHOLD)
+					md_wakeup_thread(conf->thread);
+			}
 			list_add_tail(&sh->lru, &conf->inactive_list);
 			atomic_dec(&conf->active_stripes);
-			wake_up(&conf->wait_for_stripe);
+			if (!conf->inactive_blocked ||
+			    atomic_read(&conf->active_stripes) < (NR_STRIPES*3/4))
+				wake_up(&conf->wait_for_stripe);
 		}
 	}
 }
 static void release_stripe(struct stripe_head *sh)
 {
 	raid5_conf_t *conf = sh->raid_conf;
-
-	spin_lock_irq(&conf->device_lock);
+	unsigned long flags;
+	
+	spin_lock_irqsave(&conf->device_lock, flags);
 	__release_stripe(conf, sh);
-	spin_unlock_irq(&conf->device_lock);
+	spin_unlock_irqrestore(&conf->device_lock, flags);
 }
 
 static void remove_hash(struct stripe_head *sh)
@@ -284,13 +294,18 @@
 
 		sh = __find_stripe(conf, sector);
 		if (!sh) {
-			sh = get_free_stripe(conf);
+			if (!conf->inactive_blocked)
+				sh = get_free_stripe(conf);
 			if (noblock && sh == NULL)
 				break;
 			if (!sh) {
+				conf->inactive_blocked = 1;
 				wait_event_lock_irq(conf->wait_for_stripe,
-						    !list_empty(&conf->inactive_list),
+						    !list_empty(&conf->inactive_list) &&
+						    (atomic_read(&conf->active_stripes) < (NR_STRIPES *3/4)
+						     || !conf->inactive_blocked),
 						    conf->device_lock);
+				conf->inactive_blocked = 0;
 			} else
 				init_stripe(sh, sector);
 		} else {
@@ -359,23 +374,12 @@
 }
 
 
-static inline void raid5_end_buffer_read(struct buffer_head *blist, struct buffer_head *bh)
-{
-	while (blist) {
-		struct buffer_head *new = blist;
-		blist = new->b_reqnext;
-		memcpy(new->b_data, bh->b_data, bh->b_size);
-		new->b_end_io(new, 1);
-	}
-}
-
 static void raid5_end_read_request (struct buffer_head * bh, int uptodate)
 {
  	struct stripe_head *sh = bh->b_private;
 	raid5_conf_t *conf = sh->raid_conf;
 	int disks = conf->raid_disks, i;
 	unsigned long flags;
-	struct buffer_head *buffers = NULL;
 
 	for (i=0 ; i<disks; i++)
 		if (bh == sh->bh_cache[i])
@@ -387,38 +391,45 @@
 		return;
 	}
 
-	md_spin_lock_irqsave(&conf->device_lock, flags);
 	if (uptodate) {
-#ifdef CONFIG_HIGHMEM
-		/* cannot map highmem bufferheads from irq,
-		 * so leave it for stripe_handle if there might
-		 * be a problem
+		struct buffer_head *buffer;
+		spin_lock_irqsave(&conf->device_lock, flags);
+		/* we can return a buffer if we bypassed the cache or
+		 * if the top buffer is not in highmem.  If there are
+		 * multiple buffers, leave the extra work to
+		 * handle_stripe
 		 */
-		if (sh->bh_read[i] &&
-		    sh->bh_read[i]->b_reqnext == NULL &&
-		    !PageHighMem(sh->bh_read[i]->b_page)) {
-			/* it's safe */
-			buffers = sh->bh_read[i];
-			sh->bh_read[i] = NULL;
-		}
-#else
-		buffers = sh->bh_read[i];
-		sh->bh_read[i] = NULL;
-#endif
-		set_bit(BH_Uptodate, &bh->b_state);
-		if (buffers) {
-			spin_unlock_irqrestore(&conf->device_lock, flags);
-			raid5_end_buffer_read(buffers, bh);
-			spin_lock_irqsave(&conf->device_lock, flags);
+		buffer = sh->bh_read[i];
+		if (buffer &&
+		    (!PageHighMem(buffer->b_page)
+		     || buffer->b_page == bh->b_page )
+			) {
+			sh->bh_read[i] = buffer->b_reqnext;
+			buffer->b_reqnext = NULL;
+		} else
+			buffer = NULL;
+		spin_unlock_irqrestore(&conf->device_lock, flags);
+		if (sh->bh_page[i]==NULL)
+			set_bit(BH_Uptodate, &bh->b_state);
+		if (buffer) {
+			if (buffer->b_page != bh->b_page)
+				memcpy(buffer->b_data, bh->b_data, bh->b_size);
+			buffer->b_end_io(buffer, 1);
 		}
 	} else {
 		md_error(conf->mddev, bh->b_dev);
 		clear_bit(BH_Uptodate, &bh->b_state);
 	}
+	/* must restore b_page before unlocking buffer... */
+	if (sh->bh_page[i]) {
+		bh->b_page = sh->bh_page[i];
+		bh->b_data = page_address(bh->b_page);
+		sh->bh_page[i] = NULL;
+		clear_bit(BH_Uptodate, &bh->b_state);
+	}
 	clear_bit(BH_Lock, &bh->b_state);
 	set_bit(STRIPE_HANDLE, &sh->state);
-	__release_stripe(conf, sh);
-	md_spin_unlock_irqrestore(&conf->device_lock, flags);
+	release_stripe(sh);
 }
 
 static void raid5_end_write_request (struct buffer_head *bh, int uptodate)
@@ -819,6 +830,7 @@
 
 	spin_lock(&sh->lock);
 	clear_bit(STRIPE_HANDLE, &sh->state);
+	clear_bit(STRIPE_DELAYED, &sh->state);
 
 	syncing = test_bit(STRIPE_SYNCING, &sh->state);
 	/* Now to look around and see what can be done */
@@ -939,6 +951,15 @@
 				} else if (conf->disks[i].operational) {
 					set_bit(BH_Lock, &bh->b_state);
 					action[i] = READ+1;
+					/* if I am just reading this block and we don't have
+					   a failed drive, or any pending writes then sidestep the cache */
+					if (sh->bh_page[i]) BUG();
+					if (sh->bh_read[i] && !sh->bh_read[i]->b_reqnext &&
+					    ! syncing && !failed && !to_write) {
+						sh->bh_page[i] = sh->bh_cache[i]->b_page;
+						sh->bh_cache[i]->b_page =  sh->bh_read[i]->b_page;
+						sh->bh_cache[i]->b_data =  sh->bh_read[i]->b_data;
+					}
 					locked++;
 					PRINTK("Reading block %d (sync=%d)\n", i, syncing);
 					if (syncing)
@@ -956,7 +977,8 @@
 			/* would I have to read this buffer for read_modify_write */
 			bh = sh->bh_cache[i];
 			if ((sh->bh_write[i] || i == sh->pd_idx) &&
-			    !buffer_locked(bh) && !buffer_uptodate(bh)) {
+			    (!buffer_locked(bh) || sh->bh_page[i]) &&
+			    !buffer_uptodate(bh)) {
 				if (conf->disks[i].operational 
 /*				    && !(conf->resync_parity && i == sh->pd_idx) */
 					)
@@ -965,7 +987,8 @@
 			}
 			/* Would I have to read this buffer for reconstruct_write */
 			if (!sh->bh_write[i] && i != sh->pd_idx &&
-			    !buffer_locked(bh) && !buffer_uptodate(bh)) {
+			    (!buffer_locked(bh) || sh->bh_page[i]) &&
+			    !buffer_uptodate(bh)) {
 				if (conf->disks[i].operational) rcw++;
 				else rcw += 2*disks;
 			}
@@ -979,10 +1002,16 @@
 				if ((sh->bh_write[i] || i == sh->pd_idx) &&
 				    !buffer_locked(bh) && !buffer_uptodate(bh) &&
 				    conf->disks[i].operational) {
-					PRINTK("Read_old block %d for r-m-w\n", i);
-					set_bit(BH_Lock, &bh->b_state);
-					action[i] = READ+1;
-					locked++;
+					if (test_bit(STRIPE_PREREAD_ACTIVE, &sh->state))
+					{
+						PRINTK("Read_old block %d for r-m-w\n", i);
+						set_bit(BH_Lock, &bh->b_state);
+						action[i] = READ+1;
+						locked++;
+					} else {
+						set_bit(STRIPE_DELAYED, &sh->state);
+						set_bit(STRIPE_HANDLE, &sh->state);
+					}
 				}
 			}
 		if (rcw <= rmw && rcw > 0)
@@ -992,10 +1021,16 @@
 				if (!sh->bh_write[i]  && i != sh->pd_idx &&
 				    !buffer_locked(bh) && !buffer_uptodate(bh) &&
 				    conf->disks[i].operational) {
-					PRINTK("Read_old block %d for Reconstruct\n", i);
-					set_bit(BH_Lock, &bh->b_state);
-					action[i] = READ+1;
-					locked++;
+					if (test_bit(STRIPE_PREREAD_ACTIVE, &sh->state))
+					{
+						PRINTK("Read_old block %d for Reconstruct\n", i);
+						set_bit(BH_Lock, &bh->b_state);
+						action[i] = READ+1;
+						locked++;
+					} else {
+						set_bit(STRIPE_DELAYED, &sh->state);
+						set_bit(STRIPE_HANDLE, &sh->state);
+					}
 				}
 			}
 		/* now if nothing is locked, and if we have enough data, we can start a write request */
@@ -1012,6 +1047,11 @@
 					    || (i==sh->pd_idx && failed == 0))
 						set_bit(STRIPE_INSYNC, &sh->state);
 				}
+			if (test_and_clear_bit(STRIPE_PREREAD_ACTIVE, &sh->state)) {
+				atomic_dec(&conf->preread_active_stripes);
+				if (atomic_read(&conf->preread_active_stripes) < IO_THRESHOLD)
+					md_wakeup_thread(conf->thread);
+			}
 		}
 	}
 
@@ -1103,6 +1143,47 @@
 		}
 }
 
+static inline void raid5_activate_delayed(raid5_conf_t *conf)
+{
+	if (atomic_read(&conf->preread_active_stripes) < IO_THRESHOLD) {
+		while (!list_empty(&conf->delayed_list)) {
+			struct list_head *l = conf->delayed_list.next;
+			struct stripe_head *sh;
+			sh = list_entry(l, struct stripe_head, lru);
+			list_del_init(l);
+			clear_bit(STRIPE_DELAYED, &sh->state);
+			if (!test_and_set_bit(STRIPE_PREREAD_ACTIVE, &sh->state))
+				atomic_inc(&conf->preread_active_stripes);
+			list_add_tail(&sh->lru, &conf->handle_list);
+		}
+	}
+}
+static void raid5_unplug_device(void *data)
+{
+	raid5_conf_t *conf = (raid5_conf_t *)data;
+	unsigned long flags;
+
+	spin_lock_irqsave(&conf->device_lock, flags);
+
+	raid5_activate_delayed(conf);
+	
+	if (conf->plugged) {
+		conf->plugged = 0;
+		md_wakeup_thread(conf->thread);
+	}	
+	spin_unlock_irqrestore(&conf->device_lock, flags);
+}
+
+static inline void raid5_plug_device(raid5_conf_t *conf)
+{
+	spin_lock_irq(&conf->device_lock);
+	if (list_empty(&conf->delayed_list))
+		if (!conf->plugged) {
+			conf->plugged = 1;
+			queue_task(&conf->plug_tq, &tq_disk);
+		}
+	spin_unlock_irq(&conf->device_lock);
+}
 
 static int raid5_make_request (mddev_t *mddev, int rw, struct buffer_head * bh)
 {
@@ -1129,6 +1210,8 @@
 		sh->pd_idx = pd_idx;
 
 		add_stripe_bh(sh, bh, dd_idx, rw);
+
+		raid5_plug_device(conf);
 		handle_stripe(sh);
 		release_stripe(sh);
 	} else
@@ -1208,8 +1291,19 @@
 		md_update_sb(mddev);
 	}
 	md_spin_lock_irq(&conf->device_lock);
-	while (!list_empty(&conf->handle_list)) {
-		struct list_head *first = conf->handle_list.next;
+	while (1) {
+		struct list_head *first;
+
+		if (list_empty(&conf->handle_list) &&
+		    atomic_read(&conf->preread_active_stripes) < IO_THRESHOLD &&
+		    !conf->plugged &&
+		    !list_empty(&conf->delayed_list))
+			raid5_activate_delayed(conf);
+
+		if (list_empty(&conf->handle_list))
+			break;
+
+		first = conf->handle_list.next;
 		sh = list_entry(first, struct stripe_head, lru);
 
 		list_del_init(first);
@@ -1288,9 +1382,16 @@
 	conf->device_lock = MD_SPIN_LOCK_UNLOCKED;
 	md_init_waitqueue_head(&conf->wait_for_stripe);
 	INIT_LIST_HEAD(&conf->handle_list);
+	INIT_LIST_HEAD(&conf->delayed_list);
 	INIT_LIST_HEAD(&conf->inactive_list);
 	atomic_set(&conf->active_stripes, 0);
+	atomic_set(&conf->preread_active_stripes, 0);
 	conf->buffer_size = PAGE_SIZE; /* good default for rebuild */
+
+	conf->plugged = 0;
+	conf->plug_tq.sync = 0;
+	conf->plug_tq.routine = &raid5_unplug_device;
+	conf->plug_tq.data = conf;
 
 	PRINTK("raid5_run(md%d) called.\n", mdidx(mddev));
 
diff -urN linux-2.4.6-pre4/drivers/net/dgrs.c linux/drivers/net/dgrs.c
--- linux-2.4.6-pre4/drivers/net/dgrs.c	Mon Dec  3 22:48:33 2001
+++ linux/drivers/net/dgrs.c	Mon Dec  3 22:48:42 2001
@@ -538,7 +538,7 @@
 				break; /* For safety */
 			if ( (p-putp) >= len)
 			{
-				printk("%s: cbp = %x\n", devN->name, H2S(cbp));
+				printk("%s: cbp = %lx\n", devN->name, (long) H2S(cbp));
 				proc_reset(dev0, 1);	/* Freeze IDT */
 				break; /* For Safety */
 			}
@@ -607,7 +607,7 @@
 				break; /* For safety */
 			if ( (p-putp) >= len)
 			{
-				printk("%s: cbp = %x\n", devN->name, H2S(cbp));
+				printk("%s: cbp = %lx\n", devN->name, (long) H2S(cbp));
 				proc_reset(dev0, 1);	/* Freeze IDT */
 				break; /* For Safety */
 			}
@@ -642,7 +642,7 @@
 				break; /* For safety */
 			if ( (p-putp) >= len)
 			{
-				printk("%s: cbp = %x\n", devN->name, H2S(cbp));
+				printk("%s: cbp = %lx\n", devN->name, (long) H2S(cbp));
 				proc_reset(dev0, 1);	/* Freeze IDT */
 				break; /* For Safety */
 			}
diff -urN linux-2.4.6-pre4/drivers/net/starfire.c linux/drivers/net/starfire.c
--- linux-2.4.6-pre4/drivers/net/starfire.c	Mon Dec  3 22:48:33 2001
+++ linux/drivers/net/starfire.c	Mon Dec  3 22:48:42 2001
@@ -208,6 +208,7 @@
 #include <linux/delay.h>
 #include <asm/processor.h>		/* Processor type for cache alignment. */
 #include <asm/uaccess.h>
+#include <asm/io.h>
 
 #ifdef HAS_FIRMWARE
 #include "starfire_firmware.h"
@@ -584,7 +585,7 @@
 static void	netdev_error(struct net_device *dev, int intr_status);
 static void	set_rx_mode(struct net_device *dev);
 static struct net_device_stats *get_stats(struct net_device *dev);
-static int	netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
+static int	mii_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
 static int	netdev_close(struct net_device *dev);
 static void	netdev_media_change(struct net_device *dev);
 
@@ -725,7 +726,7 @@
 	dev->stop = &netdev_close;
 	dev->get_stats = &get_stats;
 	dev->set_multicast_list = &set_rx_mode;
-	dev->do_ioctl = &netdev_ioctl;
+	dev->do_ioctl = &mii_ioctl;
 
 	if (mtu)
 		dev->mtu = mtu;
diff -urN linux-2.4.6-pre4/drivers/net/sungem.c linux/drivers/net/sungem.c
--- linux-2.4.6-pre4/drivers/net/sungem.c	Mon Dec  3 22:48:33 2001
+++ linux/drivers/net/sungem.c	Mon Dec  3 22:48:42 2001
@@ -1,4 +1,4 @@
-/* $Id: sungem.c,v 1.13 2001/04/20 08:16:28 davem Exp $
+/* $Id: sungem.c,v 1.17 2001/06/17 09:22:46 jgarzik Exp $
  * sungem.c: Sun GEM ethernet driver.
  *
  * Copyright (C) 2000, 2001 David S. Miller (davem@redhat.com)
@@ -565,6 +565,7 @@
 
 		gp->net_stats.rx_packets++;
 		gp->net_stats.rx_bytes += len;
+		gp->dev->last_rx = jiffies;
 
 	next:
 		entry = NEXT_RX(entry);
@@ -1616,12 +1617,17 @@
 	unsigned long gemreg_base, gemreg_len;
 	struct net_device *dev;
 	struct gem *gp;
-	int i;
+	int i, err;
 
 	if (gem_version_printed++ == 0)
 		printk(KERN_INFO "%s", version);
 
-	pci_enable_device(pdev);
+	err = pci_enable_device(pdev);
+	if (err) {
+		printk(KERN_ERR PFX "Cannot enable MMIO operation, "
+		       "aborting.\n");
+		return err;
+	}
 	pci_set_master(pdev);
 
 	gemreg_base = pci_resource_start(pdev, 0);
@@ -1646,16 +1652,7 @@
 		goto err_out_free_netdev;
 	}
 
-	if (pci_enable_device(pdev)) {
-		printk(KERN_ERR PFX "Cannot enable MMIO operation, "
-		       "aborting.\n");
-		goto err_out_free_mmio_res;
-	}
-
-	pci_set_master(pdev);
-
 	gp = dev->priv;
-	memset(gp, 0, sizeof(*gp));
 
 	gp->pdev = pdev;
 	dev->base_addr = (long) pdev;
diff -urN linux-2.4.6-pre4/drivers/pci/pci.ids linux/drivers/pci/pci.ids
--- linux-2.4.6-pre4/drivers/pci/pci.ids	Mon Dec  3 22:48:33 2001
+++ linux/drivers/pci/pci.ids	Mon Dec  3 22:48:42 2001
@@ -3893,6 +3893,7 @@
 14e2  INFOLIBRIA
 14e3  AMTELCO
 14e4  BROADCOM Corporation
+	1644  Tigon3
 14e5  Pixelfusion Ltd
 14e6  SHINING Technology Inc
 14e7  3CX
diff -urN linux-2.4.6-pre4/drivers/sbus/char/pcikbd.c linux/drivers/sbus/char/pcikbd.c
--- linux-2.4.6-pre4/drivers/sbus/char/pcikbd.c	Mon Dec  3 22:48:33 2001
+++ linux/drivers/sbus/char/pcikbd.c	Mon Dec  3 22:48:42 2001
@@ -1,4 +1,4 @@
-/* $Id: pcikbd.c,v 1.57 2001/06/03 13:41:13 ecd Exp $
+/* $Id: pcikbd.c,v 1.58 2001/06/10 06:51:03 davem Exp $
  * pcikbd.c: Ultra/AX PC keyboard support.
  *
  * Copyright (C) 1997  Eddie C. Dost  (ecd@skynet.be)
@@ -332,7 +332,15 @@
 	pcikbd_write(KBD_DATA_REG, mode);
 	pcikbd_write(KBD_DATA_REG, KBD_CMD_ENABLE);
 	if (pcikbd_wait_for_input() != KBD_REPLY_ACK)
-		printk("Prom Enter: Enable Keyboard: no ACK\n");
+		printk("Prom Leave: Enable Keyboard: no ACK\n");
+
+	/* Reset keyboard rate */
+	pcikbd_write(KBD_DATA_REG, KBD_CMD_SET_RATE);
+	if(pcikbd_wait_for_input() != KBD_REPLY_ACK)
+		printk("Prom Leave: Set rate: no ACK\n");
+	pcikbd_write(KBD_DATA_REG, 0x00);
+	if(pcikbd_wait_for_input() != KBD_REPLY_ACK)
+		printk("Prom Leave: Set rate: no ACK\n");
 }
 
 int pcikbd_translate(unsigned char scancode, unsigned char *keycode,
diff -urN linux-2.4.6-pre4/drivers/sbus/char/sab82532.c linux/drivers/sbus/char/sab82532.c
--- linux-2.4.6-pre4/drivers/sbus/char/sab82532.c	Mon Dec  3 22:48:33 2001
+++ linux/drivers/sbus/char/sab82532.c	Mon Dec  3 22:48:42 2001
@@ -1,4 +1,4 @@
-/* $Id: sab82532.c,v 1.60 2001/05/29 05:56:06 ecd Exp $
+/* $Id: sab82532.c,v 1.62 2001/06/10 06:48:47 davem Exp $
  * sab82532.c: ASYNC Driver for the SIEMENS SAB82532 DUSCC.
  *
  * Copyright (C) 1997  Eddie C. Dost  (ecd@skynet.be)
@@ -410,7 +410,7 @@
 
 	if (!(readb(&info->regs->r.star) & SAB82532_STAR_XFW)) {
 #ifdef SERIAL_DEBUG_FIFO
-		printk("%s: XPR, but no XFW (???)\n", __FUNCTION__);
+		printk("%s: XPR, but no XFW (?)\n", __FUNCTION__);
 #endif
 		return;
 	}
@@ -631,6 +631,7 @@
 		transmit_chars(info, &status);
 
 done:
+	;
 #ifdef SERIAL_DEBUG_INTR
 	printk("end.\n");
 #endif
@@ -2211,7 +2212,7 @@
 
 static inline void __init show_serial_version(void)
 {
-	char *revision = "$Revision: 1.60 $";
+	char *revision = "$Revision: 1.62 $";
 	char *version, *p;
 
 	version = strchr(revision, ' ');
diff -urN linux-2.4.6-pre4/drivers/usb/Config.in linux/drivers/usb/Config.in
--- linux-2.4.6-pre4/drivers/usb/Config.in	Mon Dec  3 22:48:33 2001
+++ linux/drivers/usb/Config.in	Mon Dec  3 22:48:43 2001
@@ -65,6 +65,7 @@
    comment 'USB Network adaptors'
    dep_tristate '  PLUSB Prolific USB-Network driver (EXPERIMENTAL)' CONFIG_USB_PLUSB $CONFIG_USB $CONFIG_NET $CONFIG_EXPERIMENTAL
    dep_tristate '  USB ADMtek Pegasus-based ethernet device support (EXPERIMENTAL)' CONFIG_USB_PEGASUS $CONFIG_USB $CONFIG_NET $CONFIG_EXPERIMENTAL
+   dep_tristate '  USB CATC NetMate-based Ethernet driver (EXPERIMENTAL)' CONFIG_USB_CATC $CONFIG_USB $CONFIG_NET $CONFIG_EXPERIMENTAL
    dep_tristate '  NetChip 1080-based USB Host-to-Host Link (EXPERIMENTAL)' CONFIG_USB_NET1080 $CONFIG_USB $CONFIG_NET $CONFIG_EXPERIMENTAL
 
    comment 'USB port drivers'
diff -urN linux-2.4.6-pre4/drivers/usb/Makefile linux/drivers/usb/Makefile
--- linux-2.4.6-pre4/drivers/usb/Makefile	Fri May 25 09:48:50 2001
+++ linux/drivers/usb/Makefile	Mon Dec  3 22:48:43 2001
@@ -63,6 +63,7 @@
 obj-$(CONFIG_USB_PLUSB)		+= plusb.o
 obj-$(CONFIG_USB_OV511)		+= ov511.o
 obj-$(CONFIG_USB_PEGASUS)	+= pegasus.o
+obj-$(CONFIG_USB_CATC)		+= catc.o
 obj-$(CONFIG_USB_RIO500)	+= rio500.o
 obj-$(CONFIG_USB_DSBR)		+= dsbr100.o
 obj-$(CONFIG_USB_MICROTEK)	+= microtek.o
diff -urN linux-2.4.6-pre4/drivers/usb/bluetooth.c linux/drivers/usb/bluetooth.c
--- linux-2.4.6-pre4/drivers/usb/bluetooth.c	Mon Dec  3 22:48:33 2001
+++ linux/drivers/usb/bluetooth.c	Mon Dec  3 22:48:43 2001
@@ -1,11 +1,15 @@
 /*
- * bluetooth.c   Version 0.10
+ * bluetooth.c   Version 0.11
  *
  * Copyright (c) 2000, 2001 Greg Kroah-Hartman	<greg@kroah.com>
  * Copyright (c) 2000 Mark Douglas Corner	<mcorner@umich.edu>
  *
  * USB Bluetooth driver, based on the Bluetooth Spec version 1.0B
  * 
+ * (2001/06/05) Version 0.11 gkh
+ *	- Fixed problem with read urb status saying that we have shutdown,
+ *	  and that we shouldn't resubmit the urb.  Patch from unknown.
+ *
  * (2001/05/28) Version 0.10 gkh
  *	- Fixed problem with using data from userspace in the bluetooth_write
  *	  function as found by the CHECKER project.
@@ -110,7 +114,7 @@
 /*
  * Version Information
  */
-#define DRIVER_VERSION "v0.10"
+#define DRIVER_VERSION "v0.11"
 #define DRIVER_AUTHOR "Greg Kroah-Hartman, Mark Douglas Corner"
 #define DRIVER_DESC "USB Bluetooth driver"
 
@@ -877,6 +881,10 @@
 
 	if (urb->status) {
 		dbg(__FUNCTION__ " - nonzero read bulk status received: %d", urb->status);
+		if (urb->status == -ENOENT) {                   
+			dbg(__FUNCTION__ " - URB canceled, won't reschedule");
+			return;
+		}
 		goto exit;
 	}
 
diff -urN linux-2.4.6-pre4/drivers/usb/catc.c linux/drivers/usb/catc.c
--- linux-2.4.6-pre4/drivers/usb/catc.c	Wed Dec 31 16:00:00 1969
+++ linux/drivers/usb/catc.c	Mon Dec  3 22:48:43 2001
@@ -0,0 +1,758 @@
+/*
+ *  Copyright (c) 2001 Vojtech Pavlik
+ *
+ *  CATC EL1210A NetMate USB Ethernet driver
+ *
+ *  Sponsored by SuSE
+ *
+ *  Based on the work of
+ *		Donald Becker
+ */
+
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or 
+ * (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * 
+ * Should you need to contact me, the author, you can do so either by
+ * e-mail - mail your message to <vojtech@suse.cz>, or by paper mail:
+ * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
+ */
+
+#include <linux/init.h>
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/string.h>
+#include <linux/malloc.h>
+#include <linux/netdevice.h>
+#include <linux/etherdevice.h>
+#include <linux/skbuff.h>
+#include <linux/spinlock.h>
+#include <asm/bitops.h>
+
+#undef DEBUG
+
+#include <linux/usb.h>
+
+/*
+ * Version information.
+ */
+
+#define DRIVER_VERSION "v2.7"
+#define DRIVER_AUTHOR "Vojtech Pavlik <vojtech@suse.cz>"
+#define DRIVER_DESC "CATC EL1210A NetMate USB Ethernet driver"
+
+MODULE_AUTHOR(DRIVER_AUTHOR);
+MODULE_DESCRIPTION(DRIVER_DESC);
+
+/*
+ * Some defines.
+ */ 
+
+#define STATS_UPDATE		(HZ)	/* Time between stats updates */
+#define TX_TIMEOUT		(5*HZ)	/* Max time the queue can be stopped */
+#define PKT_SZ			1536	/* Max Ethernet packet size */
+#define RX_MAX_BURST		15	/* Max packets per rx buffer (> 0, < 16) */
+#define TX_MAX_BURST		15	/* Max full sized packets per tx buffer (> 0) */
+#define CTRL_QUEUE		16	/* Max control requests in flight (power of two) */
+
+/*
+ * Control requests.
+ */
+
+enum control_requests {
+	ReadMem =	0xf1,
+	GetMac =	0xf2,
+	Reset =		0xf4,
+	SetMac =	0xf5,
+	WriteROM =	0xf8,
+	SetReg =	0xfa,
+	GetReg =	0xfb,
+	WriteMem =	0xfc,
+	ReadROM =	0xfd,
+};
+
+/*
+ * Registers.
+ */
+
+enum register_offsets {
+	TxBufCount =	0x20,
+	RxBufCount =	0x21,
+	OpModes =	0x22,
+	TxQed =		0x23,
+	RxQed =		0x24,
+	MaxBurst =	0x25,
+	RxUnit =	0x60,
+	EthStatus =	0x61,
+	StationAddr0 =	0x67,
+	EthStats =	0x69,
+	LEDCtrl =	0x81,
+};
+
+enum eth_stats {
+	TxSingleColl =	0x00,
+        TxMultiColl =	0x02,
+        TxExcessColl =	0x04,
+        RxFramErr =	0x06,
+};
+
+enum op_mode_bits {
+	Op3MemWaits =	0x03,
+	OpLenInclude =	0x08,
+	OpRxMerge =	0x10,
+	OpTxMerge =	0x20,
+	OpWin95bugfix =	0x40,
+	OpLoopback =	0x80,
+};
+
+enum rx_filter_bits {
+	RxEnable =	0x01,
+	RxPolarity =	0x02,
+	RxForceOK =	0x04,
+	RxMultiCast =	0x08,
+	RxPromisc =	0x10,
+};
+
+enum led_values {
+	LEDFast = 	0x01,
+	LEDSlow =	0x02,
+	LEDFlash =	0x03,
+	LEDPulse =	0x04,
+	LEDLink =	0x08,
+};
+
+/*
+ * The catc struct.
+ */
+
+#define CTRL_RUNNING	0
+#define RX_RUNNING	1
+#define TX_RUNNING	2
+
+struct catc {
+	struct net_device *netdev;
+	struct usb_device *usbdev;
+
+	struct net_device_stats stats;
+	unsigned long flags;
+
+	unsigned int tx_ptr, tx_idx;
+	unsigned int ctrl_head, ctrl_tail;
+	spinlock_t tx_lock, ctrl_lock;
+
+	u8 tx_buf[2][TX_MAX_BURST * (PKT_SZ + 2)];
+	u8 rx_buf[RX_MAX_BURST * (PKT_SZ + 2)];
+	u8 irq_buf[2];
+	u8 ctrl_buf[64];
+	devrequest ctrl_dr;
+
+	struct timer_list timer;
+	u8 stats_buf[8];
+	u16 stats_vals[4];
+	unsigned long last_stats;
+
+	u8 multicast[64];
+
+	struct ctrl_queue {
+		u8 dir;
+		u8 request;
+		u16 value;
+		u16 index;
+		void *buf;
+		int len;
+		void (*callback)(struct catc *catc, struct ctrl_queue *q);
+	} ctrl_queue[CTRL_QUEUE];
+
+	struct urb tx_urb, rx_urb, irq_urb, ctrl_urb;
+};
+
+/*
+ * Useful macros.
+ */
+
+#define catc_get_mac(catc, mac)				catc_ctrl_msg(catc, USB_DIR_IN,  GetMac, 0, 0, mac,  6)
+#define catc_reset(catc)				catc_ctrl_msg(catc, USB_DIR_OUT, Reset, 0, 0, NULL, 0)
+#define catc_set_reg(catc, reg, val)			catc_ctrl_msg(catc, USB_DIR_OUT, SetReg, val, reg, NULL, 0)
+#define catc_get_reg(catc, reg, buf)			catc_ctrl_msg(catc, USB_DIR_IN,  GetReg, 0, reg, buf, 1)
+#define catc_write_mem(catc, addr, buf, size)		catc_ctrl_msg(catc, USB_DIR_OUT, WriteMem, 0, addr, buf, size)
+#define catc_read_mem(catc, addr, buf, size)		catc_ctrl_msg(catc, USB_DIR_IN,  ReadMem, 0, addr, buf, size)
+
+#define catc_set_reg_async(catc, reg, val)		catc_ctrl_async(catc, USB_DIR_OUT, SetReg, val, reg, NULL, 0, NULL)
+#define catc_get_reg_async(catc, reg, cb)		catc_ctrl_async(catc, USB_DIR_IN, GetReg, 0, reg, NULL, 1, cb)
+#define catc_write_mem_async(catc, addr, buf, size)	catc_ctrl_async(catc, USB_DIR_OUT, WriteMem, 0, addr, buf, size, NULL)
+
+/*
+ * Receive routines.
+ */
+
+static void catc_rx_done(struct urb *urb)
+{
+	struct catc *catc = urb->context;
+	u8 *pkt_start = urb->transfer_buffer;
+	struct sk_buff *skb;
+	int pkt_len;
+
+	clear_bit(RX_RUNNING, &catc->flags);
+
+	if (urb->status) {
+		dbg("rx_done, status %d, length %d", urb->status, urb->actual_length);
+		return;
+	}
+
+	do {
+		pkt_len = le16_to_cpup((u16*)pkt_start);
+
+		if (pkt_len > urb->actual_length) {
+			catc->stats.rx_length_errors++;
+			catc->stats.rx_errors++;
+			break;
+		}
+
+		if (!(skb = dev_alloc_skb(pkt_len)))
+			return;
+
+		skb->dev = catc->netdev;
+		eth_copy_and_sum(skb, pkt_start + 2, pkt_len, 0);
+		skb_put(skb, pkt_len);
+
+		skb->protocol = eth_type_trans(skb, catc->netdev);
+		netif_rx(skb);
+
+		catc->stats.rx_packets++;
+		catc->stats.rx_bytes += pkt_len;
+
+		pkt_start += (((pkt_len + 1) >> 6) + 1) << 6;
+
+	} while (pkt_start - (u8 *) urb->transfer_buffer < urb->actual_length);
+
+	catc->netdev->last_rx = jiffies;
+}
+
+static void catc_irq_done(struct urb *urb)
+{
+	struct catc *catc = urb->context;
+	u8 *data = urb->transfer_buffer;
+	int status;
+
+	if (urb->status) {
+		dbg("irq_done, status %d, data %02x %02x.", urb->status, data[0], data[1]);
+		return;
+	}
+
+	if ((data[1] & 0x80) && !test_and_set_bit(RX_RUNNING, &catc->flags)) {
+		catc->rx_urb.dev = catc->usbdev;
+		if ((status = usb_submit_urb(&catc->rx_urb)) < 0) {
+			err("submit(rx_urb) status %d", status);
+			return;
+		} 
+	}
+
+	if (data[1] & 0x40)
+		dbg("link ok");
+
+	if (data[1] & 0x20) 
+		dbg("link bad");
+}
+
+/*
+ * Transmit routines.
+ */
+
+static void catc_tx_run(struct catc *catc)
+{
+	int status;
+
+	catc->tx_urb.transfer_buffer_length = catc->tx_ptr;
+	catc->tx_urb.transfer_buffer = catc->tx_buf[catc->tx_idx];
+	catc->tx_urb.dev = catc->usbdev;
+
+	if ((status = usb_submit_urb(&catc->tx_urb)) < 0)
+		err("submit(tx_urb), status %d", status);
+
+	catc->tx_idx = !catc->tx_idx;
+	catc->tx_ptr = 0;
+
+	catc->netdev->trans_start = jiffies;
+}
+
+static void catc_tx_done(struct urb *urb)
+{
+	struct catc *catc = urb->context;
+	unsigned long flags;
+
+	if (urb->status == -ECONNRESET) {
+		dbg("Tx Reset.");
+		urb->transfer_flags &= ~USB_ASYNC_UNLINK;
+		urb->status = 0;
+		catc->netdev->trans_start = jiffies;
+		catc->stats.tx_errors++;
+		clear_bit(TX_RUNNING, &catc->flags);
+		netif_wake_queue(catc->netdev);
+		return;
+	}
+
+	if (urb->status) {
+		dbg("tx_done, status %d, length %d", urb->status, urb->actual_length);
+		return;
+	}
+
+	spin_lock_irqsave(&catc->tx_lock, flags);
+
+	if (catc->tx_ptr)
+		catc_tx_run(catc);
+	else
+		clear_bit(TX_RUNNING, &catc->flags);
+
+	netif_wake_queue(catc->netdev);
+
+	spin_unlock_irqrestore(&catc->tx_lock, flags);
+}
+
+static int catc_hard_start_xmit(struct sk_buff *skb, struct net_device *netdev)
+{
+	struct catc *catc = netdev->priv;
+	unsigned long flags;
+	char *tx_buf;
+
+	spin_lock_irqsave(&catc->tx_lock, flags);
+
+	catc->tx_ptr = (((catc->tx_ptr - 1) >> 6) + 1) << 6;
+	tx_buf = catc->tx_buf[catc->tx_idx] + catc->tx_ptr;
+	*((u16*)tx_buf) = cpu_to_le16p(&skb->len);
+	memcpy(tx_buf + 2, skb->data, skb->len);
+	catc->tx_ptr += skb->len + 2;
+
+	if (!test_and_set_bit(TX_RUNNING, &catc->flags))
+		catc_tx_run(catc);
+
+	if (catc->tx_ptr >= ((TX_MAX_BURST - 1) * (PKT_SZ + 2)))
+		netif_stop_queue(netdev);
+
+	spin_unlock_irqrestore(&catc->tx_lock, flags);
+
+	catc->stats.tx_bytes += skb->len;
+	catc->stats.tx_packets++;
+
+	dev_kfree_skb(skb);
+
+	return 0;
+}
+
+static void catc_tx_timeout(struct net_device *netdev)
+{
+	struct catc *catc = netdev->priv;
+
+	warn("Transmit timed out.");
+	catc->tx_urb.transfer_flags |= USB_ASYNC_UNLINK;
+	usb_unlink_urb(&catc->tx_urb);
+}
+
+/*
+ * Control messages.
+ */
+
+static int catc_ctrl_msg(struct catc *catc, u8 dir, u8 request, u16 value, u16 index, void *buf, int len)
+{
+        int retval = usb_control_msg(catc->usbdev,
+		dir ? usb_rcvctrlpipe(catc->usbdev, 0) : usb_sndctrlpipe(catc->usbdev, 0),
+		 request, 0x40 | dir, value, index, buf, len, HZ);
+        return retval < 0 ? retval : 0;
+}
+
+static void catc_ctrl_run(struct catc *catc)
+{
+	struct ctrl_queue *q = catc->ctrl_queue + catc->ctrl_tail;
+	struct usb_device *usbdev = catc->usbdev;
+	struct urb *urb = &catc->ctrl_urb;
+	devrequest *dr = &catc->ctrl_dr;
+	int status;
+
+	dr->request = q->request;
+	dr->requesttype = 0x40 | q->dir;
+	dr->value = cpu_to_le16(q->value);
+	dr->index = cpu_to_le16(q->index);
+	dr->length = cpu_to_le16(q->len);
+
+        urb->pipe = q->dir ? usb_rcvctrlpipe(usbdev, 0) : usb_sndctrlpipe(usbdev, 0);
+	urb->transfer_buffer_length = q->len;
+	urb->transfer_buffer = catc->ctrl_buf;
+	urb->setup_packet = (void *) dr;
+	urb->dev = usbdev;
+
+	if (!q->dir && q->buf && q->len)
+		memcpy(catc->ctrl_buf, q->buf, q->len);
+
+	if ((status = usb_submit_urb(&catc->ctrl_urb)))
+		err("submit(ctrl_urb) status %d", status);
+}
+
+static void catc_ctrl_done(struct urb *urb)
+{
+	struct catc *catc = urb->context;
+	struct ctrl_queue *q;
+	long flags;
+
+	if (urb->status)
+		dbg("ctrl_done, status %d, len %d.", urb->status, urb->actual_length);
+
+	spin_lock_irqsave(&catc->ctrl_lock, flags);
+
+	q = catc->ctrl_queue + catc->ctrl_tail;
+
+	if (q->dir) {
+		if (q->buf && q->len)
+			memcpy(q->buf, catc->ctrl_buf, q->len);
+		else
+			q->buf = catc->ctrl_buf;
+	}
+
+	if (q->callback)
+		q->callback(catc, q);
+
+	catc->ctrl_tail = (catc->ctrl_tail + 1) & (CTRL_QUEUE - 1);
+
+	if (catc->ctrl_head != catc->ctrl_tail)
+		catc_ctrl_run(catc);
+	else
+		clear_bit(CTRL_RUNNING, &catc->flags);
+
+	spin_unlock_irqrestore(&catc->ctrl_lock, flags);
+}
+
+static int catc_ctrl_async(struct catc *catc, u8 dir, u8 request, u16 value,
+	u16 index, void *buf, int len, void (*callback)(struct catc *catc, struct ctrl_queue *q))
+{
+	struct ctrl_queue *q;
+	int retval = 0;
+	long flags;
+
+	spin_lock_irqsave(&catc->ctrl_lock, flags);
+	
+	q = catc->ctrl_queue + catc->ctrl_head;
+
+	q->dir = dir;
+	q->request = request;
+	q->value = value;
+	q->index = index;
+	q->buf = buf;
+	q->len = len;
+	q->callback = callback;
+
+	catc->ctrl_head = (catc->ctrl_head + 1) & (CTRL_QUEUE - 1);
+
+	if (catc->ctrl_head == catc->ctrl_tail) {
+		err("ctrl queue full");
+		catc->ctrl_tail = (catc->ctrl_tail + 1) & (CTRL_QUEUE - 1);
+		retval = -1;
+	}
+
+	if (!test_and_set_bit(CTRL_RUNNING, &catc->flags))
+		catc_ctrl_run(catc);
+
+	spin_unlock_irqrestore(&catc->ctrl_lock, flags);
+
+	return retval;
+}
+
+/*
+ * Statistics.
+ */
+
+static void catc_stats_done(struct catc *catc, struct ctrl_queue *q)
+{
+	int index = q->index - EthStats;
+	u16 data, last;
+
+	catc->stats_buf[index] = *((char *)q->buf);
+
+	if (index & 1)
+		return;
+
+	data = ((u16)catc->stats_buf[index] << 8) | catc->stats_buf[index + 1];
+	last = catc->stats_vals[index >> 1];
+
+	switch (index) {
+		case TxSingleColl:
+		case TxMultiColl:
+			catc->stats.collisions += data - last;
+			break;
+		case TxExcessColl:
+			catc->stats.tx_aborted_errors += data - last;
+			catc->stats.tx_errors += data - last;
+			break;
+		case RxFramErr:
+			catc->stats.rx_frame_errors += data - last;
+			catc->stats.rx_errors += data - last;
+			break;
+	}
+
+	catc->stats_vals[index >> 1] = data;
+}
+
+static void catc_stats_timer(unsigned long data)
+{
+	struct catc *catc = (void *) data;
+	int i;
+
+	for (i = 0; i < 8; i++)
+		catc_get_reg_async(catc, EthStats + 7 - i, catc_stats_done);
+
+	mod_timer(&catc->timer, jiffies + STATS_UPDATE);
+}
+
+static struct net_device_stats *catc_get_stats(struct net_device *netdev)
+{
+	struct catc *catc = netdev->priv;
+	return &catc->stats;
+}
+
+/*
+ * Receive modes. Broadcast, Multicast, Promisc.
+ */
+
+static void catc_multicast(unsigned char *addr, u8 *multicast)
+{
+	unsigned int crc = 0xffffffff;
+	u8 byte, idx, bit;
+
+        for (idx = 0; idx < 6; idx++)
+                for (byte = *addr++, bit = 0; bit < 8; bit++, byte >>= 1)
+                        crc = (crc >> 1) ^ (((crc ^ byte) & 1) ? 0xedb88320U : 0);
+
+	multicast[(crc >> 3) & 0x3f] |= 1 << (crc & 7);
+}
+
+static void catc_set_multicast_list(struct net_device *netdev)
+{
+	struct catc *catc = netdev->priv;
+	struct dev_mc_list *mc;
+	u8 broadcast[6];
+	u8 rx = RxEnable | RxPolarity | RxMultiCast;
+	int i;
+
+	memset(broadcast, 0xff, 6);
+	memset(catc->multicast, 0, 64);
+
+	catc_multicast(broadcast, catc->multicast);
+	catc_multicast(netdev->dev_addr, catc->multicast);
+
+	if (netdev->flags & IFF_PROMISC) {
+		memset(catc->multicast, 0xff, 64);
+		rx |= RxPromisc;
+	} 
+
+	if (netdev->flags & IFF_ALLMULTI)
+		memset(catc->multicast, 0xff, 64);
+
+	for (i = 0, mc = netdev->mc_list; mc && i < netdev->mc_count; i++, mc = mc->next)
+		catc_multicast(mc->dmi_addr, catc->multicast);
+
+	catc_set_reg_async(catc, RxUnit, rx);
+	catc_write_mem_async(catc, 0xfa80, catc->multicast, 64);
+}
+
+/*
+ * Open, close.
+ */
+
+static int catc_open(struct net_device *netdev)
+{
+	struct catc *catc = netdev->priv;
+	int status;
+
+	catc->irq_urb.dev = catc->usbdev;
+	if ((status = usb_submit_urb(&catc->irq_urb)) < 0) {
+		err("submit(irq_urb) status %d", status);
+		return -1;
+	}
+
+	netif_start_queue(netdev);
+
+	mod_timer(&catc->timer, jiffies + STATS_UPDATE);
+
+	return 0;
+}
+
+static int catc_stop(struct net_device *netdev)
+{
+	struct catc *catc = netdev->priv;
+
+	netif_stop_queue(netdev);
+
+	del_timer_sync(&catc->timer);
+
+	usb_unlink_urb(&catc->rx_urb);
+	usb_unlink_urb(&catc->tx_urb);
+	usb_unlink_urb(&catc->irq_urb);
+	usb_unlink_urb(&catc->ctrl_urb);
+
+	return 0;
+}
+
+/*
+ * USB probe, disconnect.
+ */
+
+static void *catc_probe(struct usb_device *usbdev, unsigned int ifnum, const struct usb_device_id *id)
+{
+	struct net_device *netdev;
+	struct catc *catc;
+	u8 broadcast[6];
+	int i;
+
+	if (usb_set_interface(usbdev, ifnum, 1)) {
+                err("Can't set altsetting 1.");
+		return NULL;
+	}
+
+	catc = kmalloc(sizeof(struct catc), GFP_KERNEL);
+	memset(catc, 0, sizeof(struct catc));
+
+	netdev = init_etherdev(0, 0);
+
+	netdev->open = catc_open;
+	netdev->hard_start_xmit = catc_hard_start_xmit;
+	netdev->stop = catc_stop;
+	netdev->get_stats = catc_get_stats;
+	netdev->tx_timeout = catc_tx_timeout;
+	netdev->watchdog_timeo = TX_TIMEOUT;
+	netdev->set_multicast_list = catc_set_multicast_list;
+	netdev->priv = catc;
+
+	catc->usbdev = usbdev;
+	catc->netdev = netdev;
+
+	catc->tx_lock = SPIN_LOCK_UNLOCKED;
+	catc->ctrl_lock = SPIN_LOCK_UNLOCKED;
+
+	init_timer(&catc->timer);
+	catc->timer.data = (long) catc;
+	catc->timer.function = catc_stats_timer;
+
+	FILL_CONTROL_URB(&catc->ctrl_urb, usbdev, usb_sndctrlpipe(usbdev, 0),
+		NULL, NULL, 0, catc_ctrl_done, catc);
+
+	FILL_BULK_URB(&catc->tx_urb, usbdev, usb_sndbulkpipe(usbdev, 1),
+		NULL, 0, catc_tx_done, catc);
+
+	FILL_BULK_URB(&catc->rx_urb, usbdev, usb_rcvbulkpipe(usbdev, 1),
+		catc->rx_buf, RX_MAX_BURST * (PKT_SZ + 2), catc_rx_done, catc);
+
+	FILL_INT_URB(&catc->irq_urb, usbdev, usb_rcvintpipe(usbdev, 2),
+                catc->irq_buf, 2, catc_irq_done, catc, 1);
+
+	dbg("Checking memory size\n");
+
+	i = 0x12345678;
+	catc_write_mem(catc, 0x7a80, &i, 4);
+	i = 0x87654321;	
+	catc_write_mem(catc, 0xfa80, &i, 4);
+	catc_read_mem(catc, 0x7a80, &i, 4);
+
+	switch (i) {
+		case 0x12345678:
+			catc_set_reg(catc, TxBufCount, 8);
+			catc_set_reg(catc, RxBufCount, 32);
+			dbg("64k Memory\n");
+			break;
+		default:
+			warn("Couldn't detect memory size, assuming 32k");
+		case 0x87654321:
+			catc_set_reg(catc, TxBufCount, 4);
+			catc_set_reg(catc, RxBufCount, 16);
+			dbg("32k Memory\n");
+			break;
+	}
+
+	dbg("Getting MAC from SEEROM.");
+
+	catc_get_mac(catc, netdev->dev_addr);
+
+	dbg("Setting MAC into registers.");
+
+	for (i = 0; i < 6; i++)
+		catc_set_reg(catc, StationAddr0 - i, netdev->dev_addr[i]);
+
+	dbg("Filling the multicast list.");
+
+	memset(broadcast, 0xff, 8);
+	catc_multicast(broadcast, catc->multicast);
+	catc_multicast(netdev->dev_addr, catc->multicast);
+	catc_write_mem(catc, 0xfa80, catc->multicast, 64);
+
+	dbg("Clearing error counters.");
+
+	for (i = 0; i < 8; i++)
+		catc_set_reg(catc, EthStats + i, 0);
+	catc->last_stats = jiffies;
+
+	dbg("Enabling.");
+
+	catc_set_reg(catc, MaxBurst, RX_MAX_BURST);
+	catc_set_reg(catc, OpModes, OpTxMerge | OpRxMerge | OpLenInclude | Op3MemWaits);
+	catc_set_reg(catc, LEDCtrl, LEDLink);
+	catc_set_reg(catc, RxUnit, RxEnable | RxPolarity | RxMultiCast);
+
+	dbg("Init done.");
+
+	printk(KERN_INFO "%s: CATC EL1210A NetMate USB Ethernet at usb%d:%d.%d, ",
+		netdev->name, usbdev->bus->busnum, usbdev->devnum, ifnum);
+	for (i = 0; i < 5; i++) printk("%2.2x:", netdev->dev_addr[i]);
+	printk("%2.2x.\n", netdev->dev_addr[i]);
+
+	return catc;
+}
+
+static void catc_disconnect(struct usb_device *usbdev, void *dev_ptr)
+{
+	struct catc *catc = dev_ptr;
+	unregister_netdev(catc->netdev);
+	kfree(catc->netdev);
+	kfree(catc);
+}
+
+/*
+ * Module functions and tables.
+ */
+
+static struct usb_device_id catc_id_table [] = {
+	{ USB_DEVICE(0x0423, 0xa) },	/* CATC Netmate */
+	{ USB_DEVICE(0x0423, 0xc) },	/* CATC Netmate II, Belkin F5U111 */
+	{ USB_DEVICE(0x08d1, 0x1) },	/* smartBridges smartNIC */
+	{ }
+};
+
+MODULE_DEVICE_TABLE(usb, catc_id_table);
+
+static struct usb_driver catc_driver = {
+	name:		"catc",
+	probe:		catc_probe,
+	disconnect:	catc_disconnect,
+	id_table:	catc_id_table,
+};
+
+static int __init catc_init(void)
+{
+	info(DRIVER_VERSION " " DRIVER_DESC);
+	usb_register(&catc_driver);
+	return 0;
+}
+
+static void __exit catc_exit(void)
+{
+	usb_deregister(&catc_driver);
+}
+
+module_init(catc_init);
+module_exit(catc_exit);
diff -urN linux-2.4.6-pre4/drivers/usb/pwc-ctrl.c linux/drivers/usb/pwc-ctrl.c
--- linux-2.4.6-pre4/drivers/usb/pwc-ctrl.c	Fri May 25 09:48:50 2001
+++ linux/drivers/usb/pwc-ctrl.c	Mon Dec  3 22:48:43 2001
@@ -236,9 +236,7 @@
 	if (ret < 0)
 		return ret;
 	if (pEntry->compressed)
-		ret = pdev->decompressor->init(pdev->release, buf, &pdev->decompress_data);
-	if (ret < 0)
-		return ret;
+		pdev->decompressor->init(pdev->release, buf, pdev->decompress_data);
 		
 	/* Set various parameters */
 	pdev->vframes = frames;
@@ -303,9 +301,7 @@
 		return ret;
 
 	if (pChoose->bandlength > 0)
-		ret = pdev->decompressor->init(pdev->release, buf, &pdev->decompress_data);
-	if (ret < 0)
-		return ret;
+		pdev->decompressor->init(pdev->release, buf, pdev->decompress_data);
 	
 	/* Set various parameters */
 	pdev->vframes = frames;
@@ -366,9 +362,7 @@
 		return ret;
 
 	if (pChoose->bandlength > 0)
-		ret = pdev->decompressor->init(pdev->release, buf, &pdev->decompress_data);
-	if (ret < 0)
-		return ret;
+		pdev->decompressor->init(pdev->release, buf, pdev->decompress_data);
 		
 	/* All set and go */
 	pdev->vframes = frames;
@@ -429,14 +423,11 @@
 			return ret;
 		}
 	}
-	/* If the video mode was not supported, we still adjust the view size,
-	   since xawtv (Again! Stupid program...) doesn't care zit about 
-	   return values.
-	 */
 	pdev->view.x = width;
 	pdev->view.y = height;
 	pwc_set_image_buffer_size(pdev);
-	Trace(TRACE_SIZE, "Set viewport to %dx%d, image size is %dx%d. Palette = %d.\n", width, height, pwc_image_sizes[size].x, pwc_image_sizes[size].y, pdev->vpalette);
+	Trace(TRACE_SIZE, "Set viewport to %dx%d, image size is %dx%d, palette = %d.\n", width, height, pwc_image_sizes[size].x, pwc_image_sizes[size].y, pdev->vpalette);
+Debug("bandlength = %d\n", pdev->vbandlength);	
 	return 0;
 }
 
@@ -482,22 +473,15 @@
 	pdev->image.size = pdev->image.x * pdev->image.y * factor / 4;
 	pdev->view.size  = pdev->view.x  * pdev->view.y  * factor / 4;
 
-	pdev->offset.x = (pdev->view.x - pdev->image.x) / 2;
-	pdev->offset.y = (pdev->view.y - pdev->image.y) / 2;
-	if (pdev->vpalette == VIDEO_PALETTE_YUV420 || pdev->vpalette == VIDEO_PALETTE_YUV420P) {
-		/* Align offset, or you'll get some very weird results in
-		   YUV mode... x must be multiple of 4 (to get the Y's in 
-		   place), and y even (or you'll mixup U & V).
-		 */
-		pdev->offset.x &= 0xFFFC;
-		pdev->offset.y &= 0xFFFE;	
-		/* This is the offset in the Y area, hence no factor */
-		pdev->offset.size = (pdev->offset.y * pdev->view.x + pdev->offset.x);
-	}
-	else
-		pdev->offset.size = (pdev->offset.y * pdev->view.x + pdev->offset.x) * factor / 4;
+	/* Align offset, or you'll get some very weird results in
+	   YUV420 mode... x must be multiple of 4 (to get the Y's in 
+	   place), and y even (or you'll mixup U & V). This is less of a
+	   problem for YUV420P.
+	 */
+	pdev->offset.x = ((pdev->view.x - pdev->image.x) / 2) & 0xFFFC;
+	pdev->offset.y = ((pdev->view.y - pdev->image.y) / 2) & 0xFFFE;
 	
-	/* Set buffers to gray */
+	/* Fill buffers with gray or black */
 	for (i = 0; i < MAX_IMAGES; i++) {
 		if (pdev->image_ptr[i] != NULL)
 			memset(pdev->image_ptr[i], filler, pdev->view.size);
diff -urN linux-2.4.6-pre4/drivers/usb/pwc-if.c linux/drivers/usb/pwc-if.c
--- linux-2.4.6-pre4/drivers/usb/pwc-if.c	Fri May 25 09:48:50 2001
+++ linux/drivers/usb/pwc-if.c	Mon Dec  3 22:48:43 2001
@@ -84,10 +84,10 @@
 
 static int default_size = PSZ_QCIF;
 static int default_fps = 10;
-static int default_palette = VIDEO_PALETTE_RGB24; /* This is normal for webcams */
+static int default_palette = VIDEO_PALETTE_YUV420P; /* This format is understood by most tools */
 static int default_fbufs = 3;   /* Default number of frame buffers */
 static int default_mbufs = 2;	/* Default number of mmap() buffers */
-       int pwc_trace = TRACE_MODULE | TRACE_FLOW;
+       int pwc_trace = TRACE_MODULE | TRACE_FLOW | TRACE_PWCX;
 static int power_save = 0;
 int pwc_preferred_compression = 2; /* 0..3 = uncompressed..high */
 
@@ -110,7 +110,7 @@
 	owner:		THIS_MODULE,
 	name:		"Philips Webcam",	/* Filled in later */
 	type:		VID_TYPE_CAPTURE,
-	hardware:	VID_HARDWARE_PWC,	/* Let's pretend for now */
+	hardware:	VID_HARDWARE_PWC,
 	open:		pwc_video_open,
 	close:		pwc_video_close,
 	read:		pwc_video_read,
@@ -321,14 +321,16 @@
 		}
 	}
 	
-	/* Allocate decompressor buffer space */
-	kbuf = vmalloc(FRAME_SIZE);
-	if (kbuf == NULL) {
-		Err("Failed to allocate compressed image buffer.\n");
-		return -ENOMEM;
+	/* Allocate decompressor table space */
+	kbuf = NULL;
+	if (pdev->decompressor != NULL) {
+		kbuf = kmalloc(pdev->decompressor->table_size, GFP_KERNEL);
+		if (kbuf == NULL) {
+			Err("Failed to allocate decompress table.\n");
+			return -ENOMEM;
+		}
 	}
-	memset(kbuf, 0, FRAME_SIZE);
-	pdev->decompress_buffer = kbuf;
+	pdev->decompress_data = kbuf;
 	
 	/* Allocate image buffer; double buffer for mmap() */
 	kbuf = rvmalloc(default_mbufs * pdev->view_max.size * 4);
@@ -361,6 +363,7 @@
 		return;
 	}
 #endif	
+
 	/* Release Iso-pipe buffers */
 	Trace(TRACE_MEMORY, "Freeing ISO buffers.\n");
 	for (i = 0; i < MAX_ISO_BUFS; i++)
@@ -368,6 +371,7 @@
 			kfree(pdev->sbuf[i].data);
 			pdev->sbuf[i].data = NULL;
 		}
+
 	/* The same for frame buffers */
 	Trace(TRACE_MEMORY, "Freeing frame buffers.\n");
 	if (pdev->fbuf != NULL) {
@@ -380,11 +384,14 @@
 		kfree(pdev->fbuf);
 		pdev->fbuf = NULL;
 	}
-	/* Intermediate decompression buffer */
+
+	/* Intermediate decompression buffer & tables */
 	Trace(TRACE_MEMORY, "Freeing decompression buffer\n");
-	if (pdev->decompress_buffer != NULL)
-		vfree(pdev->decompress_buffer);
-	pdev->decompress_buffer = NULL;
+	if (pdev->decompress_data != NULL) {
+		kfree(pdev->decompress_data);
+		pdev->decompress_data = NULL;
+	}
+	pdev->decompressor = NULL;
 
 	/* Release image buffers */
 	Trace(TRACE_MEMORY, "Freeing image buffers\n");
@@ -401,7 +408,7 @@
    the user program. The first scheme involves the ISO buffers (called thus
    since they transport ISO data from the USB controller), and not really
    interesting. Suffices to say the data from this buffer is quickly 
-   gathered in an interrupt handler (pwc_isoc_hanlder) and placed into the 
+   gathered in an interrupt handler (pwc_isoc_handler) and placed into the 
    frame buffer.
    
    The frame buffer is the second scheme, and is the central element here.
@@ -412,8 +419,8 @@
    either read() or mmap().
    
    The image buffer is the third scheme, in which frames are decompressed
-   and converted into any of the desired image formats (rgb, bgr, yuv, etc).
-   For mmap() there is more than one image buffer available.
+   and possibly converted into planar format. For mmap() there is more than
+   one image buffer available.
 
    The frame buffers provide the image buffering, in case the user process
    is a bit slow. This introduces lag and some undesired side-effects.
@@ -500,7 +507,7 @@
 /**
   \brief Reset all buffers, pointers and lists, except for the image_used[] buffer. 
   
-  If the image_used[] buffer is cleared too mmap()/VIDIOCSYNC will run into trouble.
+  If the image_used[] buffer is cleared too, mmap()/VIDIOCSYNC will run into trouble.
  */
 static void pwc_reset_buffers(struct pwc_device *pdev)
 {
@@ -589,10 +596,11 @@
 	pdev->fill_image = (pdev->fill_image + 1) % default_mbufs;
 }
 
+/* XXX: 2001-06-17: The YUV420 palette will be phased out soon */
 static int pwc_set_palette(struct pwc_device *pdev, int pal)
 {
-	if (
-            pal == VIDEO_PALETTE_YUV420
+	if (   pal == VIDEO_PALETTE_YUV420
+            || pal == VIDEO_PALETTE_YUV420P
 #if PWC_DEBUG
             || pal == VIDEO_PALETTE_RAW
 #endif
@@ -640,10 +648,7 @@
 	fbuf = pdev->fill_frame;
 	if (fbuf == NULL) {
 		Err("pwc_isoc_handler without valid fill frame.\n");
-		if (waitqueue_active(&pdev->frameq))
-			wake_up_interruptible(&pdev->frameq);
-		if (waitqueue_active(&pdev->pollq))
-			wake_up_interruptible(&pdev->pollq);
+		wake_up_interruptible(&pdev->frameq);
 		return;
 	}
 	fillptr = fbuf->data + fbuf->filled;
@@ -750,12 +755,8 @@
 			pdev->vlast_packet_size = flen;
 		} /* ..status == 0 */
 	}
-	if (awake) {
-		if (waitqueue_active(&pdev->frameq))
-			wake_up_interruptible(&pdev->frameq);
-		if (waitqueue_active(&pdev->pollq))
-			wake_up_interruptible(&pdev->pollq);
-	}
+	if (awake)
+		wake_up_interruptible(&pdev->frameq);
 }
 
 
@@ -811,6 +812,7 @@
 		while (i >= 0) {
 			if (pdev->sbuf[i].urb != NULL)
 				usb_free_urb(pdev->sbuf[i].urb);
+			pdev->sbuf[i].urb = NULL;
 			i--;
 		}
 		return ret;
@@ -842,6 +844,8 @@
 		ret = usb_submit_urb(pdev->sbuf[i].urb);
 		if (ret)
 			Err("isoc_init() submit_urb %d failed with error %d\n", i, ret);
+		else
+			Trace(TRACE_OPEN, "pwc_isoc_init(): URB submitted.\n");
 	}
 
 	/* data should stream in now */
@@ -945,10 +949,16 @@
 		}
 	}
 
+	/* Find our decompressor, if any */
+	pdev->decompressor = pwc_find_decompressor(pdev->type);
+#if PWC_DEBUG	
+	Debug("Found decompressor for %d at 0x%p\n", pdev->type, pdev->decompressor);
+#endif
+
 	/* So far, so good. Allocate memory. */
 	i = pwc_allocate_buffers(pdev);
 	if (i < 0) {
-		Trace(TRACE_OPEN, "Failed to allocate memory.\n");
+		Trace(TRACE_OPEN, "Failed to allocate buffer memory.\n");
 		up(&pdev->modlock);
 		return i;
 	}
@@ -965,12 +975,6 @@
 	pdev->sequence = 0;
 #endif
 
-	/* Find our decompressor, if any */
-	pdev->decompressor = pwc_find_decompressor(pdev->type);
-#if PWC_DEBUG	
-	Debug("Found decompressor for %d at 0x%p\n", pdev->type, pdev->decompressor);
-#endif
-
 	/* Set some defaults */
 	pdev->vsnapshot = 0;
 	if (pdev->type == 730 || pdev->type == 740)
@@ -1064,12 +1068,11 @@
 	}
 
 	pdev->vopen = 0;
-	pwc_free_buffers(pdev);
 	if (pdev->decompressor != NULL) {
-		pdev->decompressor->exit(&pdev->decompress_data);
+		pdev->decompressor->exit();
 		pdev->decompressor->unlock();
 	}
-	pdev->decompressor = NULL;
+	pwc_free_buffers(pdev);
 
 	/* wake up _disconnect() routine */
 	if (pdev->unplugged)
@@ -1078,11 +1081,20 @@
 
 /*
  *	FIXME: what about two parallel reads ????
+ *      ANSWER: Not supported. You can't open the device more than once,
+                despite what the V4L1 interface says. First, I don't see 
+                the need, second there's no mechanism of alerting the 
+                2nd/3rd/... process of events like changing image size.
+                And I don't see the point of blocking that for the 
+                2nd/3rd/... process.
+                In multi-threaded environments reading parallel from any
+                device is tricky anyhow.
  */
  
 static long pwc_video_read(struct video_device *vdev, char *buf, unsigned long count, int noblock)
 {
 	struct pwc_device *pdev;
+	DECLARE_WAITQUEUE(wait, current);
 
 	Trace(TRACE_READ, "video_read(0x%p, %p, %ld, %d) called.\n", vdev, buf, count, noblock);
 	if (vdev == NULL)
@@ -1097,20 +1109,26 @@
 
 	/* In case we're doing partial reads, we don't have to wait for a frame */
 	if (pdev->image_read_pos == 0) {
-		/* See if a frame is completed, process that */
-		if (noblock && pdev->full_frames == NULL)
-			return -EAGAIN;
+		/* Do wait queueing according to the (doc)book */
+		add_wait_queue(&pdev->frameq, &wait);
 		while (pdev->full_frames == NULL) {
-			interruptible_sleep_on(&pdev->frameq);
-			if (pdev->unplugged) {
-				Debug("pwc_video_read: Device got unplugged (2).\n");
-				return -EPIPE;
-			}
-			if (signal_pending(current))
-				return -EINTR;
-		}
- 
-		/* Decompress & convert now */
+	                if (noblock) {
+	                	remove_wait_queue(&pdev->frameq, &wait);
+	                	current->state = TASK_RUNNING;
+	                	return -EWOULDBLOCK;
+	                }
+	                if (signal_pending(current)) {
+	                	remove_wait_queue(&pdev->frameq, &wait);
+	                	current->state = TASK_RUNNING;
+	                	return -ERESTARTSYS;
+	                }
+	                schedule();
+	                current->state = TASK_INTERRUPTIBLE;
+		}
+		remove_wait_queue(&pdev->frameq, &wait);
+		current->state = TASK_RUNNING;
+	                                                                                                                                                                                
+		/* Decompress [, convert] and release frame */
 		if (pwc_handle_frame(pdev))
 			return -EFAULT;
 	}
@@ -1145,7 +1163,7 @@
 	if (pdev == NULL)
 		return -EFAULT;
 	
-	poll_wait(file, &pdev->pollq, wait);
+	poll_wait(file, &pdev->frameq, wait);
 	if (pdev->unplugged) {
 		Debug("pwc_video_poll: Device got unplugged.\n");
 		return POLLERR;
@@ -1159,6 +1177,7 @@
 static int pwc_video_ioctl(struct video_device *vdev, unsigned int cmd, void *arg)
 {
 	struct pwc_device *pdev;
+	DECLARE_WAITQUEUE(wait, current);
 	
 	if (vdev == NULL)
 		return -EFAULT;
@@ -1271,6 +1290,11 @@
 
 			/*
 			 *	FIXME:	Suppose we are mid read
+			        ANSWER: No problem: the firmware of the camera
+			                can handle brightness/contrast/etc
+			                changes at _any_ time, and the palette
+			                is used exactly once in the uncompress
+			                routine.
 			 */
 			pwc_set_brightness(pdev, p.brightness);
 			pwc_set_contrast(pdev, p.contrast);
@@ -1309,11 +1333,6 @@
 			if (copy_from_user(&vw, arg, sizeof(vw)))
 				return -EFAULT;
 
-/*
-			size = pwc_decode_size(pdev, vw.width, vw.height);
-			if (size < 0)
-				return -EINVAL;
-*/				
 			fps = (vw.flags & PWC_FPS_FRMASK) >> PWC_FPS_SHIFT;
 			snapshot = vw.flags & PWC_FPS_SNAPSHOT;
 			if (fps == 0)
@@ -1385,11 +1404,6 @@
 				int ret;
 				
 				Trace(TRACE_OPEN, "VIDIOCMCAPTURE: changing size to please xawtv :-(.\n");
-/*
-				size = pwc_decode_size(pdev, vm.width, vm.height);
-				if (size < 0)
-					return -EINVAL;
-*/					
 				ret = pwc_try_video_mode(pdev, vm.width, vm.height, pdev->vframes, pdev->vcompression, pdev->vsnapshot);
 				if (ret)
 					return ret;
@@ -1435,28 +1449,32 @@
 
 			Trace(TRACE_READ, "VIDIOCSYNC called (%d).\n", mbuf);
 
+			/* bounds check */
 			if (mbuf < 0 || mbuf >= default_mbufs)
 				return -EINVAL;
 			/* check if this buffer was requested anyway */
 			if (pdev->image_used[mbuf] == 0)
 				return -EINVAL;
 
-			/* We (re)use the frame-waitqueue here. That may
-			   conflict with read(), but any programmer that uses
-			   read() and mmap() simultaneously should be given 
-			   a job at Micro$oft. As janitor.
+			/* Add ourselves to the frame wait-queue.
 			   
 			   FIXME: needs auditing for safety.
+			   QUSTION: In what respect? I think that using the
+			            frameq is safe now.
 			 */
+			add_wait_queue(&pdev->frameq, &wait);
 			while (pdev->full_frames == NULL) {
-				interruptible_sleep_on(&pdev->frameq);
-				if (pdev->unplugged) {
-					Debug("VIDIOCSYNC: Device got unplugged.\n");
-					return -EPIPE;
-				}
-				if (signal_pending(current))
-					return -EINTR;
+	                	if (signal_pending(current)) {
+	                		remove_wait_queue(&pdev->frameq, &wait);
+		                	current->state = TASK_RUNNING;
+		                	return -ERESTARTSYS;
+	        	        }
+	                	schedule();
+		                current->state = TASK_INTERRUPTIBLE;
 			}
+			remove_wait_queue(&pdev->frameq, &wait);
+			current->state = TASK_RUNNING;
+				
 			/* The frame is ready. Expand in the image buffer 
 			   requested by the user. I don't care if you 
 			   mmap() 5 buffers and request data in this order: 
@@ -1537,7 +1555,6 @@
 
 	vendor_id = udev->descriptor.idVendor;
 	product_id = udev->descriptor.idProduct;
-	
 
 	if (vendor_id == 0x0471) {
 		switch (product_id) {
@@ -1612,7 +1629,6 @@
 
 	pdev->udev = udev;
 	init_waitqueue_head(&pdev->frameq);
-	init_waitqueue_head(&pdev->pollq);
 	init_waitqueue_head(&pdev->remove_ok);
 	pdev->vcompression = pwc_preferred_compression;
 
@@ -1691,7 +1707,6 @@
 			   a frame, let them return an error condition
 			 */
 			wake_up(&pdev->frameq);
-			wake_up(&pdev->pollq);
 			
 			/* Wait until we get a 'go' from _close(). This
 			   had a gigantic race condition, since we kfree()
@@ -1736,7 +1751,7 @@
 MODULE_PARM(fps, "i");
 MODULE_PARM_DESC(fps, "Initial frames per second. Varies with model, useful range 5-30");
 MODULE_PARM(palette, "s");
-MODULE_PARM_DESC(palette, "Initial colour format of images. One of rgb24, bgr24, rgb32, bgr32, yuyv, yuv420, yuv420p");
+MODULE_PARM_DESC(palette, "Initial colour format of images. One of yuv420, yuv420p");
 MODULE_PARM(fbufs, "i");
 MODULE_PARM_DESC(fbufs, "Number of internal frame buffers to reserve");
 MODULE_PARM(mbufs, "i");
@@ -1786,8 +1801,10 @@
 		/* Determine default palette */
 		if (!strcmp(palette, "yuv420"))
 			default_palette = VIDEO_PALETTE_YUV420;
+		if (!strcmp(palette, "yuv420p"))
+			default_palette = VIDEO_PALETTE_YUV420P;
 		else {
-			Err("Palette not recognized: try palette=yuv420.\n");
+			Err("Palette not recognized: try palette=yuv420 or yuv420p.\n");
 			return -EINVAL;
 		}
 		Info("Default palette set to %d.\n", default_palette);
diff -urN linux-2.4.6-pre4/drivers/usb/pwc-uncompress.c linux/drivers/usb/pwc-uncompress.c
--- linux-2.4.6-pre4/drivers/usb/pwc-uncompress.c	Fri May 25 09:48:50 2001
+++ linux/drivers/usb/pwc-uncompress.c	Mon Dec  3 22:48:43 2001
@@ -21,6 +21,8 @@
    themselves. It also has a decompressor wrapper function.
 */
 
+#include <asm/types.h>
+
 #include "pwc.h"
 #include "pwc-uncompress.h"
 
@@ -38,7 +40,7 @@
 void pwc_register_decompressor(struct pwc_decompressor *pwcd)
 {
 	if (pwc_find_decompressor(pwcd->type) == NULL) {
-		Debug("Adding decompressor for model %d.\n", pwcd->type);
+		Trace(TRACE_PWCX, "Adding decompressor for model %d.\n", pwcd->type);
 		list_add_tail(&pwcd->pwcd_list, &pwc_decompressor_list);
 	}
 }
@@ -50,7 +52,7 @@
 	
 	find = pwc_find_decompressor(type);
 	if (find != NULL) {
-		Debug("Removing decompressor for model %d.\n", type);
+		Trace(TRACE_PWCX, "Removing decompressor for model %d.\n", type);
 		list_del(&find->pwcd_list);
 	}
 }
@@ -74,8 +76,11 @@
 int pwc_decompress(struct pwc_device *pdev)
 {
 	struct pwc_frame_buf *fbuf;
-	int n, l, c, w;
+	int n, line, col, stride;
 	void *yuv, *image, *dst;
+	u16 *src;
+	u16 *dsty, *dstu, *dstv;
+
 	
 	if (pdev == NULL)
 		return -EFAULT;
@@ -92,7 +97,7 @@
 	image = pdev->image_ptr[pdev->fill_image];
 	if (!image)
 		return -EFAULT;
-
+	
 #if PWC_DEBUG
 	/* This is a quickie */
 	if (pdev->vpalette == VIDEO_PALETTE_RAW) {
@@ -101,49 +106,78 @@
 	}
 #endif
 
-	/* Compressed formats are decompressed in decompress_buffer, then 
-	 * transformed into the desired format 
-	 */
-	yuv = pdev->decompress_buffer;
-	n = 0;
-	if (pdev->vbandlength == 0) { /* uncompressed */
-		yuv = fbuf->data + pdev->frame_header_size;  /* Skip header */
-	}
-	else {
-		if (pdev->decompressor)
-			n = pdev->decompressor->decompress(pdev->decompress_data, pdev->image.x, pdev->image.y, pdev->vbandlength, yuv, fbuf->data + pdev->frame_header_size, 0);
-		else
-			n = -ENXIO; /* No such device or address: missing decompressor */
-	}
-	if (n < 0) {
-		Err("Error in decompression engine: %d\n", n);
-		return n;
-	}
-
-	/* At this point 'yuv' always points to the uncompressed, non-scaled YUV420I data */
-	if (pdev->image.x == pdev->view.x && pdev->image.y == pdev->view.y) {
-		/* Sizes matches; make it quick */
-		switch(pdev->vpalette) {
+	yuv = fbuf->data + pdev->frame_header_size;  /* Skip header */
+	if (pdev->vbandlength == 0) { 
+		/* Uncompressed mode. We copy the data into the output buffer,
+		   using the viewport size (which may be larger than the image
+		   size). Unfortunately we have to do a bit of byte stuffing
+		   to get the desired output format/size.
+		 */
+		switch (pdev->vpalette) {
 		case VIDEO_PALETTE_YUV420:
-			memcpy(image, yuv, pdev->image.size);
+			/* Calculate byte offsets per line in image & view */
+			n   = (pdev->image.x * 3) / 2;
+			col = (pdev->view.x  * 3) / 2;
+			/* Offset into image */
+			dst = image + (pdev->view.x * pdev->offset.y + pdev->offset.x) * 3 / 2;
+			for (line = 0; line < pdev->image.y; line++) {
+				memcpy(dst, yuv, n);
+				yuv += n;
+				dst += col;
+			}
 			break;
-		}
-	}
-	else {
- 		/* Size mismatch; use viewport conversion routines */
-	 	switch(pdev->vpalette) {
-		case VIDEO_PALETTE_YUV420:
-			dst = image + pdev->offset.size;
-			w = pdev->view.x * 6;
-			c = pdev->image.x * 6;
-			for (l = 0; l < pdev->image.y; l++) {
-				memcpy(dst, yuv, c);
-				dst += w;
-				yuv += c;
+
+		case VIDEO_PALETTE_YUV420P:
+			/* 
+			 * We do some byte shuffling here to go from the 
+			 * native format to YUV420P.
+			 */
+			src = (u16 *)yuv;
+			n = pdev->view.x * pdev->view.y;
+
+			/* offset in Y plane */
+			stride = pdev->view.x * pdev->offset.y + pdev->offset.x;
+			dsty = (u16 *)(image + stride);
+
+			/* offsets in U/V planes */
+			stride = pdev->view.x * pdev->offset.y / 4 + pdev->offset.x / 2;
+			dstu = (u16 *)(image + n +         stride);
+			dstv = (u16 *)(image + n + n / 4 + stride);
+
+			/* increment after each line */
+			stride = (pdev->view.x - pdev->image.x) / 2; /* u16 is 2 bytes */
+
+			for (line = 0; line < pdev->image.y; line++) {
+				for (col = 0; col < pdev->image.x; col += 4) {
+					*dsty++ = *src++;
+					*dsty++ = *src++;
+					if (line & 1)
+						*dstv++ = *src++;
+					else
+						*dstu++ = *src++;
+				}
+				dsty += stride;
+				if (line & 1)
+					dstv += (stride >> 1);
+				else
+					dstu += (stride >> 1);
 			}
 			break;
- 		}
- 	}
+		}
+	}
+	else { 
+		/* Compressed; the decompressor routines will write the data 
+		   in interlaced or planar format immediately.
+		 */
+		if (pdev->decompressor)
+			pdev->decompressor->decompress(
+				&pdev->image, &pdev->view, &pdev->offset,
+				yuv, image, 
+				pdev->vpalette == VIDEO_PALETTE_YUV420P ? 1 : 0,
+				pdev->decompress_data, pdev->vbandlength);
+		else
+			return -ENXIO; /* No such device or address: missing decompressor */
+	}
 	return 0;
 }
 
@@ -154,4 +188,3 @@
 EXPORT_SYMBOL_NOVERS(pwc_decompressor_version);
 EXPORT_SYMBOL(pwc_register_decompressor);
 EXPORT_SYMBOL(pwc_unregister_decompressor);
-EXPORT_SYMBOL(pwc_find_decompressor);
diff -urN linux-2.4.6-pre4/drivers/usb/pwc-uncompress.h linux/drivers/usb/pwc-uncompress.h
--- linux-2.4.6-pre4/drivers/usb/pwc-uncompress.h	Tue May 22 10:25:36 2001
+++ linux/drivers/usb/pwc-uncompress.h	Mon Dec  3 22:48:43 2001
@@ -15,13 +15,19 @@
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */
 
+/* This file is the bridge between the kernel module and the plugin; it
+   describes the structures and datatypes used in both modules. Any
+   significant change should be reflected by increasing the 
+   pwc_decompressor_version major number.
+ */
 #ifndef PWC_DEC_H
 #define PWC_DEC_H
 
 #include <linux/config.h>
-
 #include <linux/list.h>
 
+#include "pwc.h"
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -33,12 +39,16 @@
  */
 struct pwc_decompressor
 {
-	int  type;	/* type of camera (645, 646, etc) */
-	int  (* init)(int release, void *buffer, void **data);	/* Initialization routine; should be called after each set_video_mode */
-	void (* exit)(void **data);	/* Cleanup routine */
-	int  (* decompress)(void *data, int width, int height, int bandlength, void *dst, void *src, int planar); /* The decompression routine itself */
-	void (* lock)(void); /* make sure module cannot be unloaded */
-	void (* unlock)(void); /* release lock on module */
+	int  type;		/* type of camera (645, 680, etc) */
+	int  table_size;	/* memory needed */
+
+	void (* init)(int release, void *buffer, void *table);	/* Initialization routine; should be called after each set_video_mode */
+	void (* exit)(void);	/* Cleanup routine */
+	void (* decompress)(struct pwc_coord *image, struct pwc_coord *view, struct pwc_coord *offset,
+                            void *src, void *dst, int planar,
+	                    void *table, int bandlength);
+	void (* lock)(void);	/* make sure module cannot be unloaded */
+	void (* unlock)(void);	/* release lock on module */
 
 	struct list_head pwcd_list;
 };
diff -urN linux-2.4.6-pre4/drivers/usb/pwc.h linux/drivers/usb/pwc.h
--- linux-2.4.6-pre4/drivers/usb/pwc.h	Fri May 25 09:48:50 2001
+++ linux/drivers/usb/pwc.h	Mon Dec  3 22:48:43 2001
@@ -43,6 +43,7 @@
 #define TRACE_MEMORY	0x0010
 #define TRACE_FLOW	0x0020
 #define TRACE_SIZE	0x0040
+#define TRACE_PWCX	0x0080
 #define TRACE_SEQUENCE	0x1000
 
 #define Trace(R, A...) if (pwc_trace & R) printk(KERN_DEBUG PWC_NAME " " A)
@@ -56,28 +57,10 @@
 #define TOUCAM_TRAILER_SIZE		4
 
 /* Version block */
-#define PWC_MAJOR	7
-#define PWC_MINOR	1
-#define PWC_RELEASE 	"7.1"
-
-#if defined(CONFIG_ARM)
-  #define PWC_PROCESSOR "ARM"
-#endif
-#if defined(CONFIG_M686)
-  #define PWC_PROCESSOR "PPro"
-#endif
-#if !defined(PWC_PROCESSOR)
-  #define PWC_PROCESSOR "P5"
-#endif  
-
-#if defined(__SMP__) || defined(CONFIG_SMP)
-#define PWC_SMP "(SMP)"
-#else
-#define PWC_SMP "(UP)"
-#endif
-
-#define PWC_VERSION PWC_RELEASE " " PWC_PROCESSOR " " PWC_SMP
-#define PWC_NAME "pwc"
+#define PWC_MAJOR	8
+#define PWC_MINOR	0
+#define PWC_VERSION 	"8.0"
+#define PWC_NAME 	"pwc"
 
 /* Turn certain features on/off */
 #define PWC_INT_PIPE 0
@@ -156,12 +139,12 @@
    char vsnapshot;		/* snapshot mode */
    char vsync;			/* used by isoc handler */
 
-   /* The image acquisition requires 3 to 5 steps:
+   /* The image acquisition requires 3 to 4 steps:
       1. data is gathered in short packets from the USB controller
       2. data is synchronized and packed into a frame buffer
-      3. in case data is compressed, decompress it into a separate buffer
-      4. data is optionally converted to RGB/YUV 
-      5. data is transfered to the user process
+      3a. in case data is compressed, decompress it directly into image buffer
+      3b. in case data is uncompressed, copy into image buffer with viewport
+      4. data is transfered to the user process
 
       Note that MAX_ISO_BUFS != MAX_FRAMES != MAX_IMAGES.... 
       We have in effect a back-to-back-double-buffer system.
@@ -171,11 +154,11 @@
    char iso_init;
    
    /* 2: frame */
-   struct pwc_frame_buf *fbuf;
-   struct pwc_frame_buf *empty_frames, *empty_frames_tail;
-   struct pwc_frame_buf *full_frames, *full_frames_tail;
-   struct pwc_frame_buf *read_frame;
-   struct pwc_frame_buf *fill_frame;
+   struct pwc_frame_buf *fbuf;	/* all frames */
+   struct pwc_frame_buf *empty_frames, *empty_frames_tail;	/* all empty frames */
+   struct pwc_frame_buf *full_frames, *full_frames_tail;	/* all filled frames */
+   struct pwc_frame_buf *fill_frame;	/* frame currently filled */
+   struct pwc_frame_buf *read_frame;	/* frame currently read by user process */
    int frame_size;
    int frame_header_size, frame_trailer_size;
    int drop_frames;
@@ -186,7 +169,6 @@
    /* 3: decompression */
    struct pwc_decompressor *decompressor;	/* function block with decompression routines */
    void *decompress_data;		/* private data for decompression engine */
-   void *decompress_buffer;		/* decompressed data */
 
    /* 4: image */
    /* We have an 'image' and a 'view', where 'image' is the fixed-size image
@@ -205,20 +187,11 @@
    int image_read_pos;			/* In case we read data in pieces, keep track of were we are in the imagebuffer */
    int image_used[MAX_IMAGES];		/* For MCAPTURE and SYNC */
 
-   /* Kernel specific structures. These were once moved to the end 
-      of the structure and padded with bytes after I found out
-      some of these have different sizes in different kernel versions.
-      But since this is now a source release, I don't have this problem
-      anymore.
-
-      Fortunately none of these structures are needed in the pwcx module.
-    */
    struct semaphore modlock;		/* to prevent races in video_open(), etc */
    spinlock_t ptrlock;			/* for manipulating the buffer pointers */
 
    /*** Misc. data ***/
    wait_queue_head_t frameq;		/* When waiting for a frame to finish... */
-   wait_queue_head_t pollq;		/* poll() has it's own waitqueue */
    wait_queue_head_t remove_ok;		/* When we got hot unplugged, we have to avoid a few race conditions */
 #if PWC_INT_PIPE
    void *usb_int_handler;		/* for the interrupt endpoint */
diff -urN linux-2.4.6-pre4/drivers/usb/serial/belkin_sa.c linux/drivers/usb/serial/belkin_sa.c
--- linux-2.4.6-pre4/drivers/usb/serial/belkin_sa.c	Mon Dec  3 22:48:33 2001
+++ linux/drivers/usb/serial/belkin_sa.c	Mon Dec  3 22:48:43 2001
@@ -24,6 +24,9 @@
  * -- Add support for flush commands
  * -- Add everything that is missing :)
  * 
+ * (30-May-2001 gkh
+ *	switched from using spinlock to a semaphore, which fixes lots of problems.
+ *
  * 08-Apr-2001 gb
  *	- Identify version on module load.
  *
@@ -85,7 +88,7 @@
 /*
  * Version Information
  */
-#define DRIVER_VERSION "v1.0.0"
+#define DRIVER_VERSION "v1.1"
 #define DRIVER_AUTHOR "William Greathouse <wgreathouse@smva.com>"
 #define DRIVER_DESC "USB Belkin Serial converter driver"
 
@@ -282,11 +285,11 @@
 
 static int  belkin_sa_open (struct usb_serial_port *port, struct file *filp)
 {
-	unsigned long flags;
+	int retval = 0;
 
 	dbg(__FUNCTION__" port %d", port->number);
 
-	spin_lock_irqsave (&port->port_lock, flags);
+	down (&port->sem);
 	
 	++port->open_count;
 	MOD_INC_USE_COUNT;
@@ -299,30 +302,32 @@
 		 *       enhance buffering.  Win trace shows 16 initial read URBs.
 		 */
 		port->read_urb->dev = port->serial->dev;
-		if (usb_submit_urb(port->read_urb))
+		retval = usb_submit_urb(port->read_urb);
+		if (retval) {
 			err("usb_submit_urb(read bulk) failed");
+			goto exit;
+		}
 
 		port->interrupt_in_urb->dev = port->serial->dev;
-		if (usb_submit_urb(port->interrupt_in_urb))
+		retval = usb_submit_urb(port->interrupt_in_urb);
+		if (retval)
 			err(" usb_submit_urb(read int) failed");
 	}
 	
-	spin_unlock_irqrestore (&port->port_lock, flags);
+exit:
+	up (&port->sem);
 
-	return 0;
+	return retval;
 } /* belkin_sa_open */
 
 
 static void belkin_sa_close (struct usb_serial_port *port, struct file *filp)
 {
-	unsigned long flags;
-
 	dbg(__FUNCTION__" port %d", port->number);
 
-	spin_lock_irqsave (&port->port_lock, flags);
+	down (&port->sem);
 
 	--port->open_count;
-	MOD_DEC_USE_COUNT;
 
 	if (port->open_count <= 0) {
 		/* shutdown our bulk reads and writes */
@@ -332,7 +337,8 @@
 		port->active = 0;
 	}
 	
-	spin_unlock_irqrestore (&port->port_lock, flags);
+	up (&port->sem);
+	MOD_DEC_USE_COUNT;
 } /* belkin_sa_close */
 
 
diff -urN linux-2.4.6-pre4/drivers/usb/serial/empeg.c linux/drivers/usb/serial/empeg.c
--- linux-2.4.6-pre4/drivers/usb/serial/empeg.c	Mon Dec  3 22:48:33 2001
+++ linux/drivers/usb/serial/empeg.c	Mon Dec  3 22:48:43 2001
@@ -1,10 +1,10 @@
 /*
  * USB Empeg empeg-car player driver
  *
- *	Copyright (C) 2000
+ *	Copyright (C) 2000, 2001
  *	    Gary Brubaker (xavyer@ix.netcom.com)
  *
- *	Copyright (C) 1999, 2000
+ *	Copyright (C) 1999 - 2001
  *	    Greg Kroah-Hartman (greg@kroah.com)
  *
  *	This program is free software; you can redistribute it and/or modify
@@ -13,6 +13,9 @@
  *
  * See Documentation/usb/usb-serial.txt for more information on using this driver
  * 
+ * (05/30/2001) gkh
+ *	switched from using spinlock to a semaphore, which fixes lots of problems.
+ *
  * (04/08/2001) gb
  *      Identify version on module load.
  * 
@@ -71,7 +74,7 @@
 /*
  * Version Information
  */
-#define DRIVER_VERSION "v1.0.0"
+#define DRIVER_VERSION "v1.1"
 #define DRIVER_AUTHOR "Greg Kroah-Hartman <greg@kroah.com>, Gary Brubaker <xavyer@ix.netcom.com>"
 #define DRIVER_DESC "USB Empeg Mark I/II Driver"
 
@@ -147,15 +150,14 @@
 static int empeg_open (struct usb_serial_port *port, struct file *filp)
 {
 	struct usb_serial *serial = port->serial;
-	unsigned long flags;
-	int result;
+	int result = 0;;
 
 	if (port_paranoia_check (port, __FUNCTION__))
 		return -ENODEV;
 
 	dbg(__FUNCTION__ " - port %d", port->number);
 
-	spin_lock_irqsave (&port->port_lock, flags);
+	down (&port->sem);
 
 	++port->open_count;
 	MOD_INC_USE_COUNT;
@@ -236,9 +238,9 @@
 
 	}
 
-	spin_unlock_irqrestore (&port->port_lock, flags);
+	up (&port->sem);
 
-	return 0;
+	return result;
 }
 
 
@@ -246,7 +248,6 @@
 {
 	struct usb_serial *serial;
 	unsigned char *transfer_buffer;
-	unsigned long flags;
 
 	if (port_paranoia_check (port, __FUNCTION__))
 		return;
@@ -257,7 +258,7 @@
 	if (!serial)
 		return;
 
-	spin_lock_irqsave (&port->port_lock, flags);
+	down (&port->sem);
 
 	--port->open_count;
 
@@ -276,13 +277,12 @@
 		port->open_count = 0;
 	}
 
-	spin_unlock_irqrestore (&port->port_lock, flags);
+	up (&port->sem);
 
 	/* Uncomment the following line if you want to see some statistics in your syslog */
 	/* info ("Bytes In = %d  Bytes Out = %d", bytes_in, bytes_out); */
 
 	MOD_DEC_USE_COUNT;
-
 }
 
 
@@ -377,7 +377,7 @@
 
 	dbg(__FUNCTION__ " - port %d", port->number);
 
-	spin_lock_irqsave (&port->port_lock, flags);
+	spin_lock_irqsave (&write_urb_pool_lock, flags);
 
 	/* tally up the number of bytes available */
 	for (i = 0; i < NUM_URBS; ++i) {
@@ -386,7 +386,7 @@
 		}
 	} 
 
-	spin_unlock_irqrestore (&port->port_lock, flags);
+	spin_unlock_irqrestore (&write_urb_pool_lock, flags);
 
 	dbg(__FUNCTION__ " - returns %d", room);
 
@@ -403,7 +403,7 @@
 
 	dbg(__FUNCTION__ " - port %d", port->number);
 
-	spin_lock_irqsave (&port->port_lock, flags);
+	spin_lock_irqsave (&write_urb_pool_lock, flags);
 
 	/* tally up the number of bytes waiting */
 	for (i = 0; i < NUM_URBS; ++i) {
@@ -412,7 +412,7 @@
 		}
 	}
 
-	spin_unlock_irqrestore (&port->port_lock, flags);
+	spin_unlock_irqrestore (&write_urb_pool_lock, flags);
 
 	dbg (__FUNCTION__ " - returns %d", chars);
 
@@ -514,15 +514,13 @@
 
 static void empeg_throttle (struct usb_serial_port *port)
 {
-	unsigned long flags;
-
 	dbg(__FUNCTION__ " - port %d", port->number);
 
-	spin_lock_irqsave (&port->port_lock, flags);
+	down (&port->sem);
 
 	usb_unlink_urb (port->read_urb);
 
-	spin_unlock_irqrestore (&port->port_lock, flags);
+	up (&port->sem);
 
 	return;
 
@@ -531,12 +529,11 @@
 
 static void empeg_unthrottle (struct usb_serial_port *port)
 {
-	unsigned long flags;
 	int result;
 
 	dbg(__FUNCTION__ " - port %d", port->number);
 
-	spin_lock_irqsave (&port->port_lock, flags);
+	down (&port->sem);
 
 	port->read_urb->dev = port->serial->dev;
 
@@ -545,7 +542,7 @@
 	if (result)
 		err(__FUNCTION__ " - failed submitting read urb, error %d", result);
 
-	spin_unlock_irqrestore (&port->port_lock, flags);
+	up (&port->sem);
 
 	return;
 
diff -urN linux-2.4.6-pre4/drivers/usb/serial/ftdi_sio.c linux/drivers/usb/serial/ftdi_sio.c
--- linux-2.4.6-pre4/drivers/usb/serial/ftdi_sio.c	Mon Dec  3 22:48:33 2001
+++ linux/drivers/usb/serial/ftdi_sio.c	Mon Dec  3 22:48:43 2001
@@ -1,7 +1,7 @@
 /*
  * USB FTDI SIO driver
  *
- * 	Copyright (C) 1999, 2000
+ * 	Copyright (C) 1999 - 2001
  * 	    Greg Kroah-Hartman (greg@kroah.com)
  *          Bill Ryder (bryder@sgi.com)
  *
@@ -15,6 +15,9 @@
  * See http://reality.sgi.com/bryder_wellington/ftdi_sio for upto date testing info
  *     and extra documentation
  * 
+ * (31/May/2001) gkh
+ *	switched from using spinlock to a semaphore, which fixes lots of problems.
+ *
  * (23/May/2001)   Bill Ryder
  *     Added runtime debug patch (thanx Tyson D Sawyer).
  *     Cleaned up comments for 8U232
@@ -301,13 +304,12 @@
 { /* ftdi_sio_open */
 	struct termios tmp_termios;
 	struct usb_serial *serial = port->serial;
-	unsigned long flags;	/* Used for spinlock */
-	int result;
+	int result = 0;
 	char buf[1]; /* Needed for the usb_control_msg I think */
 
 	dbg(__FUNCTION__);
 
-	spin_lock_irqsave (&port->port_lock, flags);
+	down (&port->sem);
 	
 	MOD_INC_USE_COUNT;
 	++port->open_count;
@@ -315,8 +317,6 @@
 	if (!port->active){
 		port->active = 1;
 
-		spin_unlock_irqrestore (&port->port_lock, flags);
-
 		/* This will push the characters through immediately rather 
 		   than queue a task to deliver them */
 		port->tty->low_latency = 1;
@@ -352,11 +352,10 @@
 		result = usb_submit_urb(port->read_urb);
 		if (result)
 			err(__FUNCTION__ " - failed submitting read urb, error %d", result);
-	} else { /* the port was already active - so no initialisation is done */
-		spin_unlock_irqrestore (&port->port_lock, flags);
 	}
 
-	return (0);
+	up (&port->sem);
+	return result;
 } /* ftdi_sio_open */
 
 
@@ -365,15 +364,13 @@
 	struct usb_serial *serial = port->serial;
 	unsigned int c_cflag = port->tty->termios->c_cflag;
 	char buf[1];
-	unsigned long flags;
 
 	dbg( __FUNCTION__);
 
-	spin_lock_irqsave (&port->port_lock, flags);
+	down (&port->sem);
 	--port->open_count;
 
 	if (port->open_count <= 0) {
-		spin_unlock_irqrestore (&port->port_lock, flags);
 		if (c_cflag & HUPCL){
 			/* Disable flow control */
 			if (usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0),
@@ -400,8 +397,6 @@
 		port->active = 0;
 		port->open_count = 0;
 	} else {  
-		spin_unlock_irqrestore (&port->port_lock, flags);
-
 		/* Send a HUP if necessary */
 		if (!(port->tty->termios->c_cflag & CLOCAL)){
 			tty_hangup(port->tty);
@@ -409,6 +404,7 @@
 		
 	}
 
+	up (&port->sem);
 	MOD_DEC_USE_COUNT;
 
 } /* ftdi_sio_close */
diff -urN linux-2.4.6-pre4/drivers/usb/serial/keyspan.c linux/drivers/usb/serial/keyspan.c
--- linux-2.4.6-pre4/drivers/usb/serial/keyspan.c	Mon Dec  3 22:48:33 2001
+++ linux/drivers/usb/serial/keyspan.c	Mon Dec  3 22:48:43 2001
@@ -28,6 +28,9 @@
   open source projects.
 
   Change History
+    Thu May 31 11:56:42 PDT 2001 gkh
+      switched from using spinlock to a semaphore
+   
    (04/08/2001) gb
 	Identify version on module load.
    
@@ -832,7 +835,6 @@
 	struct usb_serial 		*serial = port->serial;
 	const keyspan_device_details	*d_details;
 	int				i, already_active, err;
-	unsigned long flags;
 	urb_t *urb;
 
 	s_priv = (struct keyspan_serial_private *)(serial->private);
@@ -842,11 +844,11 @@
 	/*  dbg("keyspan_open called."); */
 	MOD_INC_USE_COUNT;
 
-	spin_lock_irqsave (&port->port_lock, flags);
+	down (&port->sem);
 	++port->open_count;
 	already_active = port->active;
 	port->active = 1;
-	spin_unlock_irqrestore (&port->port_lock, flags);
+	up (&port->sem);
 
 	if (already_active)
 		return 0;
@@ -886,13 +888,12 @@
 	struct usb_serial	*serial = port->serial; /* FIXME should so sanity check */
 	struct keyspan_serial_private 	*s_priv;
 	struct keyspan_port_private 	*p_priv;
-	unsigned long flags;
 
 	/*  dbg("keyspan_close called"); */
 	s_priv = (struct keyspan_serial_private *)(serial->private);
 	p_priv = (struct keyspan_port_private *)(port->private);
 
-	spin_lock_irqsave (&port->port_lock, flags);
+	down (&port->sem);
 
 	if (--port->open_count <= 0) {
 		if (port->active) {
@@ -913,7 +914,7 @@
 		port->open_count = 0;
 		port->tty = 0;
 	}
-	spin_unlock_irqrestore (&port->port_lock, flags);
+	up (&port->sem);
 
 	MOD_DEC_USE_COUNT;
 }
diff -urN linux-2.4.6-pre4/drivers/usb/serial/keyspan_pda.c linux/drivers/usb/serial/keyspan_pda.c
--- linux-2.4.6-pre4/drivers/usb/serial/keyspan_pda.c	Mon Dec  3 22:48:33 2001
+++ linux/drivers/usb/serial/keyspan_pda.c	Mon Dec  3 22:48:43 2001
@@ -1,7 +1,7 @@
 /*
  * USB Keyspan PDA Converter driver
  *
- * Copyright (c) 1999, 2000 Greg Kroah-Hartman	<greg@kroah.com>
+ * Copyright (c) 1999 - 2001 Greg Kroah-Hartman	<greg@kroah.com>
  * Copyright (c) 1999, 2000 Brian Warner	<warner@lothar.com>
  * Copyright (c) 2000 Al Borchers		<borchers@steinerpoint.com>
  *
@@ -12,6 +12,9 @@
  *
  * See Documentation/usb/usb-serial.txt for more information on using this driver
  * 
+ * (05/31/2001) gkh
+ *	switched from using spinlock to a semaphore, which fixes lots of problems.
+ *
  * (04/08/2001) gb
  *	Identify version on module load.
  * 
@@ -452,7 +455,6 @@
 	int request_unthrottle = 0;
 	int rc = 0;
 	struct keyspan_pda_private *priv;
-	unsigned long flags;
 
 	priv = (struct keyspan_pda_private *)(port->private);
 	/* guess how much room is left in the device's ring buffer, and if we
@@ -482,7 +484,6 @@
 	   finished).  Also, the tx process is not throttled. So we are
 	   ready to write. */
 
-	spin_lock_irqsave (&port->port_lock, flags);
 	count = (count > port->bulk_out_size) ? port->bulk_out_size : count;
 
 	/* Check if we might overrun the Tx buffer.   If so, ask the
@@ -502,13 +503,12 @@
 				     2*HZ);
 		if (rc < 0) {
 			dbg(" roomquery failed");
-			spin_unlock_irqrestore (&port->port_lock, flags);
-			return rc; /* failed */
+			goto exit;
 		}
 		if (rc == 0) {
 			dbg(" roomquery returned 0 bytes");
-			spin_unlock_irqrestore (&port->port_lock, flags);
-			return -EIO; /* device didn't return any data */
+			rc = -EIO; /* device didn't return any data */
+			goto exit;
 		}
 		dbg(" roomquery says %d", room);
 		priv->tx_room = room;
@@ -525,8 +525,8 @@
 		if (from_user) {
 			if( copy_from_user(port->write_urb->transfer_buffer,
 			buf, count) ) {
-				spin_unlock_irqrestore (&port->port_lock, flags);
-				return( -EFAULT );
+				rc = -EFAULT;
+				goto exit;
 			}
 		}
 		else {
@@ -538,10 +538,10 @@
 		priv->tx_room -= count;
 
 		port->write_urb->dev = port->serial->dev;
-		if (usb_submit_urb(port->write_urb)) {
+		rc = usb_submit_urb(port->write_urb);
+		if (rc) {
 			dbg(" usb_submit_urb(write bulk) failed");
-			spin_unlock_irqrestore (&port->port_lock, flags);
-			return (0);
+			goto exit;
 		}
 	}
 	else {
@@ -557,8 +557,9 @@
 			MOD_DEC_USE_COUNT;
 	}
 
-	spin_unlock_irqrestore (&port->port_lock, flags);
-	return (count);
+	rc = count;
+exit:
+	return rc;
 }
 
 
@@ -616,11 +617,10 @@
 {
 	struct usb_serial *serial = port->serial;
 	unsigned char room;
-	int rc;
+	int rc = 0;
 	struct keyspan_pda_private *priv;
-	unsigned long flags;
 
-	spin_lock_irqsave (&port->port_lock, flags);
+	down (&port->sem);
 
 	MOD_INC_USE_COUNT;
 	++port->open_count;
@@ -629,7 +629,6 @@
 		port->active = 1;
  
 		/* find out how much room is in the Tx ring */
-		spin_unlock_irqrestore (&port->port_lock, flags);
 		rc = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0),
 				     6, /* write_room */
 				     USB_TYPE_VENDOR | USB_RECIP_INTERFACE
@@ -639,7 +638,6 @@
 				     &room,
 				     1,
 				     2*HZ);
-		spin_lock_irqsave (&port->port_lock, flags);
 		if (rc < 0) {
 			dbg(__FUNCTION__" - roomquery failed");
 			goto error;
@@ -655,7 +653,6 @@
 
 		/* the normal serial device seems to always turn on DTR and RTS here,
 		   so do the same */
-		spin_unlock_irqrestore (&port->port_lock, flags);
 		if (port->tty->termios->c_cflag & CBAUD)
 			keyspan_pda_set_modem_info(serial, (1<<7) | (1<<2) );
 		else
@@ -663,19 +660,22 @@
 
 		/*Start reading from the device*/
 		port->interrupt_in_urb->dev = serial->dev;
-		if (usb_submit_urb(port->interrupt_in_urb))
+		rc = usb_submit_urb(port->interrupt_in_urb);
+		if (rc) {
 			dbg(__FUNCTION__" - usb_submit_urb(read int) failed");
-	} else {
-		spin_unlock_irqrestore (&port->port_lock, flags);
+			goto error;
+		}
+
 	}
 
 
-	return (0);
+	up (&port->sem);
+	return rc;
 error:
 	--port->open_count;
 	port->active = 0;
 	MOD_DEC_USE_COUNT;
-	spin_unlock_irqrestore (&port->port_lock, flags);
+	up (&port->sem);
 	return rc;
 }
 
@@ -683,19 +683,15 @@
 static void keyspan_pda_close(struct usb_serial_port *port, struct file *filp)
 {
 	struct usb_serial *serial = port->serial;
-	unsigned long flags;
 
-	spin_lock_irqsave (&port->port_lock, flags);
+	down (&port->sem);
 
 	--port->open_count;
-	MOD_DEC_USE_COUNT;
 
 	if (port->open_count <= 0) {
 		/* the normal serial device seems to always shut off DTR and RTS now */
-		spin_unlock_irqrestore (&port->port_lock, flags);
 		if (port->tty->termios->c_cflag & HUPCL)
 			keyspan_pda_set_modem_info(serial, 0);
-		spin_lock_irqsave (&port->port_lock, flags);
 
 		/* shutdown our bulk reads and writes */
 		usb_unlink_urb (port->write_urb);
@@ -704,7 +700,8 @@
 		port->open_count = 0;
 	}
 
-	spin_unlock_irqrestore (&port->port_lock, flags);
+	up (&port->sem);
+	MOD_DEC_USE_COUNT;
 }
 
 
diff -urN linux-2.4.6-pre4/drivers/usb/serial/mct_u232.c linux/drivers/usb/serial/mct_u232.c
--- linux-2.4.6-pre4/drivers/usb/serial/mct_u232.c	Mon Dec  3 22:48:33 2001
+++ linux/drivers/usb/serial/mct_u232.c	Mon Dec  3 22:48:43 2001
@@ -24,6 +24,9 @@
  *   Basic tests have been performed with minicom/zmodem transfers and
  *   modem dialing under Linux 2.4.0-test10 (for me it works fine).
  *
+ * 30-May-2001 Greg Kroah-Hartman
+ *	switched from using spinlock to a semaphore, which fixes lots of problems.
+ *
  * 04-May-2001 Stelian Pop
  *   - Set the maximum bulk output size for Sitecom U232-P25 model to 16 bytes
  *     instead of the device reported 32 (using 32 bytes causes many data
@@ -79,7 +82,7 @@
 /*
  * Version Information
  */
-#define DRIVER_VERSION "v1.0.0"
+#define DRIVER_VERSION "v1.1"
 #define DRIVER_AUTHOR "Wolfgang Grandegger <wolfgang@ces.ch>"
 #define DRIVER_DESC "Magic Control Technology USB-RS232 converter driver"
 
@@ -391,13 +394,13 @@
 
 static int  mct_u232_open (struct usb_serial_port *port, struct file *filp)
 {
-	unsigned long flags;
 	struct usb_serial *serial = port->serial;
 	struct mct_u232_private *priv = (struct mct_u232_private *)port->private;
+	int retval = 0;
 
 	dbg(__FUNCTION__" port %d", port->number);
 
-	spin_lock_irqsave (&port->port_lock, flags);
+	down (&port->sem);
 	
 	++port->open_count;
 	MOD_INC_USE_COUNT;
@@ -443,16 +446,21 @@
 		}
 
 		port->read_urb->dev = port->serial->dev;
-		if (usb_submit_urb(port->read_urb))
+		retval = usb_submit_urb(port->read_urb);
+		if (retval) {
 			err("usb_submit_urb(read bulk) failed");
+			goto exit;
+		}
 
 		port->interrupt_in_urb->dev = port->serial->dev;
-		if (usb_submit_urb(port->interrupt_in_urb))
+		retval = usb_submit_urb(port->interrupt_in_urb);
+		if (retval)
 			err(" usb_submit_urb(read int) failed");
 
 	}
 
-	spin_unlock_irqrestore (&port->port_lock, flags);
+exit:
+	up (&port->sem);
 	
 	return 0;
 } /* mct_u232_open */
@@ -460,14 +468,11 @@
 
 static void mct_u232_close (struct usb_serial_port *port, struct file *filp)
 {
-	unsigned long flags;
-
 	dbg(__FUNCTION__" port %d", port->number);
 
-	spin_lock_irqsave (&port->port_lock, flags);
+	down (&port->sem);
 
 	--port->open_count;
-	MOD_DEC_USE_COUNT;
 
 	if (port->open_count <= 0) {
 		/* shutdown our bulk reads and writes */
@@ -478,8 +483,8 @@
 		port->active = 0;
 	}
 	
-	spin_unlock_irqrestore (&port->port_lock, flags);
-
+	up (&port->sem);
+	MOD_DEC_USE_COUNT;
 } /* mct_u232_close */
 
 
@@ -490,7 +495,6 @@
 			   const unsigned char *buf, int count)
 {
 	struct usb_serial *serial = port->serial;
-	unsigned long flags;
 	int result, bytes_sent, size;
 
 	dbg(__FUNCTION__ " - port %d", port->number);
@@ -513,7 +517,7 @@
 	bytes_sent = 0;
 	while (count > 0) {
 		
-		spin_lock_irqsave (&port->port_lock, flags);
+		down (&port->sem);
 		
 		size = (count > port->bulk_out_size) ? port->bulk_out_size : count;
 		
@@ -541,11 +545,11 @@
 		if (result) {
 			err(__FUNCTION__
 			    " - failed submitting write urb, error %d", result);
-			spin_unlock_irqrestore (&port->port_lock, flags);
-			return bytes_sent;
+			up (&port->sem);
+			return result;
 		}
 
-		spin_unlock_irqrestore (&port->port_lock, flags);
+		up (&port->sem);
 
 		bytes_sent += size;
 		if (write_blocking)
diff -urN linux-2.4.6-pre4/drivers/usb/serial/omninet.c linux/drivers/usb/serial/omninet.c
--- linux-2.4.6-pre4/drivers/usb/serial/omninet.c	Mon Dec  3 22:48:33 2001
+++ linux/drivers/usb/serial/omninet.c	Mon Dec  3 22:48:43 2001
@@ -10,6 +10,9 @@
  *
  * Please report both successes and troubles to the author at omninet@kroah.com
  * 
+ * (05/30/2001) gkh
+ *	switched from using spinlock to a semaphore, which fixes lots of problems.
+ *
  * (04/08/2001) gb
  *	Identify version on module load.
  *
@@ -60,7 +63,7 @@
 /*
  * Version Information
  */
-#define DRIVER_VERSION "v1.0.0"
+#define DRIVER_VERSION "v1.1"
 #define DRIVER_AUTHOR "Anonymous"
 #define DRIVER_DESC "USB ZyXEL omni.net LCD PLUS Driver"
 
@@ -145,8 +148,7 @@
 	struct usb_serial	*serial;
 	struct usb_serial_port	*wport;
 	struct omninet_data	*od;
-	unsigned long		flags;
-	int			result;
+	int			result = 0;
 
 	if (port_paranoia_check (port, __FUNCTION__))
 		return -ENODEV;
@@ -157,7 +159,7 @@
 	if (!serial)
 		return -ENODEV;
 
-	spin_lock_irqsave (&port->port_lock, flags);
+	down (&port->sem);
 
 	MOD_INC_USE_COUNT;
 	++port->open_count;
@@ -170,7 +172,7 @@
 			err(__FUNCTION__"- kmalloc(%Zd) failed.", sizeof(struct omninet_data));
 			--port->open_count;
 			port->active = 0;
-			spin_unlock_irqrestore (&port->port_lock, flags);
+			up (&port->sem);
 			MOD_DEC_USE_COUNT;
 			return -ENOMEM;
 		}
@@ -189,9 +191,9 @@
 			err(__FUNCTION__ " - failed submitting read urb, error %d", result);
 	}
 
-	spin_unlock_irqrestore (&port->port_lock, flags);
+	up (&port->sem);
 
-	return (0);
+	return result;
 }
 
 static void omninet_close (struct usb_serial_port *port, struct file * filp)
@@ -199,7 +201,6 @@
 	struct usb_serial 	*serial;
 	struct usb_serial_port 	*wport;
 	struct omninet_data 	*od;
-	unsigned long		flags;
 
 	if (port_paranoia_check (port, __FUNCTION__))
 		return;
@@ -210,10 +211,9 @@
 	if (!serial)
 		return;
 
-	spin_lock_irqsave (&port->port_lock, flags);
+	down (&port->sem);
 
 	--port->open_count;
-	MOD_DEC_USE_COUNT;
 
 	if (port->open_count <= 0) {
 		od = (struct omninet_data *)port->private;
@@ -228,7 +228,8 @@
 			kfree(od);
 	}
 
-	spin_unlock_irqrestore (&port->port_lock, flags);
+	up (&port->sem);
+	MOD_DEC_USE_COUNT;
 }
 
 
@@ -296,7 +297,6 @@
 	struct omninet_data 	*od 	= (struct omninet_data   *) port->private;
 	struct omninet_header	*header = (struct omninet_header *) wport->write_urb->transfer_buffer;
 
-	unsigned long		flags;
 	int			result;
 
 //	dbg("omninet_write port %d", port->number);
@@ -310,12 +310,13 @@
 		return (0);
 	}
 
-	spin_lock_irqsave (&port->port_lock, flags);
-	
 	count = (count > OMNINET_BULKOUTSIZE) ? OMNINET_BULKOUTSIZE : count;
 
 	if (from_user) {
-		copy_from_user(wport->write_urb->transfer_buffer + OMNINET_DATAOFFSET, buf, count);
+		if (copy_from_user(wport->write_urb->transfer_buffer + OMNINET_DATAOFFSET, buf, count) != 0) {
+			result = -EFAULT;
+			goto exit;
+		}
 	}
 	else {
 		memcpy (wport->write_urb->transfer_buffer + OMNINET_DATAOFFSET, buf, count);
@@ -333,16 +334,13 @@
 
 	wport->write_urb->dev = serial->dev;
 	result = usb_submit_urb(wport->write_urb);
-	if (result) {
+	if (result)
 		err(__FUNCTION__ " - failed submitting write urb, error %d", result);
-		spin_unlock_irqrestore (&port->port_lock, flags);
-		return 0;
-	}
-
-//	dbg("omninet_write returns %d", count);
+	else
+		result = count;
 
-	spin_unlock_irqrestore (&port->port_lock, flags);
-	return (count);
+exit:	
+	return result;
 }
 
 
diff -urN linux-2.4.6-pre4/drivers/usb/serial/pl2303.h linux/drivers/usb/serial/pl2303.h
--- linux-2.4.6-pre4/drivers/usb/serial/pl2303.h	Wed Dec 31 16:00:00 1969
+++ linux/drivers/usb/serial/pl2303.h	Mon Dec  3 22:48:43 2001
@@ -0,0 +1,15 @@
+/*
+ * Prolific PL2303 USB to serial adaptor driver header file
+ *
+ *	This program is free software; you can redistribute it and/or modify
+ *	it under the terms of the GNU General Public License as published by
+ *	the Free Software Foundation; either version 2 of the License, or
+ *	(at your option) any later version.
+ * 
+ */
+#define PL2303_VENDOR_ID	0x067b
+#define PL2303_PRODUCT_ID	0x2303
+
+#define ATEN_VENDOR_ID		0x0557
+#define ATEN_PRODUCT_ID		0x2008
+
diff -urN linux-2.4.6-pre4/drivers/usb/serial/usb-serial.h linux/drivers/usb/serial/usb-serial.h
--- linux-2.4.6-pre4/drivers/usb/serial/usb-serial.h	Fri Apr  6 15:51:52 2001
+++ linux/drivers/usb/serial/usb-serial.h	Mon Dec  3 22:48:43 2001
@@ -1,7 +1,7 @@
 /*
  * USB Serial Converter driver
  *
- *	Copyright (C) 1999, 2000
+ *	Copyright (C) 1999 - 2001
  *	    Greg Kroah-Hartman (greg@kroah.com)
  *
  *	This program is free software; you can redistribute it and/or modify
@@ -11,6 +11,9 @@
  *
  * See Documentation/usb/usb-serial.txt for more information on using this driver
  *
+ * (05/30/2001) gkh
+ *	added sem to port structure and removed port_lock
+ *
  * (10/05/2000) gkh
  *	Added interrupt_in_endpointAddress and bulk_in_endpointAddress to help
  *	fix bug with urb->dev not being set properly, now that the usb core
@@ -77,7 +80,7 @@
 
 	struct tq_struct	tqueue;		/* task queue for line discipline waking up */
 	int			open_count;	/* number of times this port has been opened */
-	spinlock_t		port_lock;
+	struct semaphore	sem;		/* locks this structure */
 	
 	void *			private;	/* data private to the specific port */
 };
diff -urN linux-2.4.6-pre4/drivers/usb/serial/usbserial.c linux/drivers/usb/serial/usbserial.c
--- linux-2.4.6-pre4/drivers/usb/serial/usbserial.c	Mon Dec  3 22:48:33 2001
+++ linux/drivers/usb/serial/usbserial.c	Mon Dec  3 22:48:43 2001
@@ -1,7 +1,7 @@
 /*
  * USB Serial Converter driver
  *
- * Copyright (C) 1999, 2000 Greg Kroah-Hartman (greg@kroah.com)
+ * Copyright (C) 1999 - 2001 Greg Kroah-Hartman (greg@kroah.com)
  * Copyright (c) 2000 Peter Berger (pberger@brimson.com)
  * Copyright (c) 2000 Al Borchers (borchers@steinerpoint.com)
  *
@@ -15,6 +15,13 @@
  *
  * See Documentation/usb/usb-serial.txt for more information on using this driver
  * 
+ * (06/06/2001) gkh
+ *	added evil hack that is needed for the prolific pl2303 device due to the
+ *	crazy way its endpoints are set up.
+ *
+ * (05/30/2001) gkh
+ *	switched from using spinlock to a semaphore, which fixes lots of problems.
+ *
  * (04/08/2001) gb
  *	Identify version on module load.
  *
@@ -284,13 +291,14 @@
 #endif
 
 #include "usb-serial.h"
+#include "pl2303.h"
 
 /*
  * Version Information
  */
-#define DRIVER_VERSION "v1.0.0"
+#define DRIVER_VERSION "v1.2"
 #define DRIVER_AUTHOR "Greg Kroah-Hartman, greg@kroah.com, http://www.kroah.com/linux-usb/"
-#define DRIVER_DESC "USB Serial Driver"
+#define DRIVER_DESC "USB Serial Driver core"
 
 #define MAX(a,b)	(((a)>(b))?(a):(b))
 
@@ -735,8 +743,7 @@
 static int generic_open (struct usb_serial_port *port, struct file *filp)
 {
 	struct usb_serial *serial = port->serial;
-	unsigned long flags;
-	int result;
+	int result = 0;
 
 	if (port_paranoia_check (port, __FUNCTION__))
 		return -ENODEV;
@@ -745,7 +752,7 @@
 
 	dbg(__FUNCTION__ " - port %d", port->number);
 
-	spin_lock_irqsave (&port->port_lock, flags);
+	down (&port->sem);
 	
 	++port->open_count;
 	
@@ -773,20 +780,19 @@
 		}
 	}
 	
-	spin_unlock_irqrestore (&port->port_lock, flags);
+	up (&port->sem);
 	
-	return 0;
+	return result;
 }
 
 
 static void generic_close (struct usb_serial_port *port, struct file * filp)
 {
 	struct usb_serial *serial = port->serial;
-	unsigned long flags;
 
 	dbg(__FUNCTION__ " - port %d", port->number);
 
-	spin_lock_irqsave (&port->port_lock, flags);
+	down (&port->sem);
 
 	--port->open_count;
 
@@ -801,7 +807,7 @@
 		port->open_count = 0;
 	}
 
-	spin_unlock_irqrestore (&port->port_lock, flags);
+	up (&port->sem);
 	MOD_DEC_USE_COUNT;
 }
 
@@ -809,7 +815,6 @@
 static int generic_write (struct usb_serial_port *port, int from_user, const unsigned char *buf, int count)
 {
 	struct usb_serial *serial = port->serial;
-	unsigned long flags;
 	int result;
 
 	dbg(__FUNCTION__ " - port %d", port->number);
@@ -826,7 +831,6 @@
 			return (0);
 		}
 
-		spin_lock_irqsave (&port->port_lock, flags);
 		count = (count > port->bulk_out_size) ? port->bulk_out_size : count;
 
 		if (from_user) {
@@ -849,14 +853,12 @@
 
 		/* send the data out the bulk port */
 		result = usb_submit_urb(port->write_urb);
-		if (result) {
+		if (result)
 			err(__FUNCTION__ " - failed submitting write urb, error %d", result);
-			spin_unlock_irqrestore (&port->port_lock, flags);
-			return 0;
-		}
+		else
+			result = count;
 
-		spin_unlock_irqrestore (&port->port_lock, flags);
-		return (count);
+		return result;
 	}
 	
 	/* no bulk out, so return 0 bytes written */
@@ -871,9 +873,10 @@
 
 	dbg(__FUNCTION__ " - port %d", port->number);
 	
-	if (serial->num_bulk_out)
+	if (serial->num_bulk_out) {
 		if (port->write_urb->status != -EINPROGRESS)
 			room = port->bulk_out_size;
+	}
 	
 	dbg(__FUNCTION__ " - returns %d", room);
 	return (room);
@@ -887,9 +890,10 @@
 
 	dbg(__FUNCTION__ " - port %d", port->number);
 	
-	if (serial->num_bulk_out)
+	if (serial->num_bulk_out) {
 		if (port->write_urb->status == -EINPROGRESS)
 			chars = port->write_urb->transfer_buffer_length;
+	}
 
 	dbg (__FUNCTION__ " - returns %d", chars);
 	return (chars);
@@ -1091,6 +1095,33 @@
 		}
 	}
 	
+#if defined(CONFIG_USB_SERIAL_PL2303) || defined(CONFIG_USB_SERIAL_PL2303_MODULE)
+	/* BEGIN HORRIBLE HACK FOR PL2303 */ 
+	/* this is needed due to the looney way its endpoints are set up */
+	if (ifnum == 1) {
+		if (((dev->descriptor.idVendor == PL2303_VENDOR_ID) &&
+		     (dev->descriptor.idProduct == PL2303_PRODUCT_ID)) ||
+		    ((dev->descriptor.idVendor == ATEN_VENDOR_ID) &&
+		     (dev->descriptor.idProduct == ATEN_PRODUCT_ID))) {
+			/* check out the endpoints of the other interface*/
+			interface = &dev->actconfig->interface[ifnum ^ 1];
+			iface_desc = &interface->altsetting[0];
+			for (i = 0; i < iface_desc->bNumEndpoints; ++i) {
+				endpoint = &iface_desc->endpoint[i];
+				if ((endpoint->bEndpointAddress & 0x80) &&
+				    ((endpoint->bmAttributes & 3) == 0x03)) {
+					/* we found a interrupt in endpoint */
+					dbg("found interrupt in for Prolific device on separate interface");
+					interrupt_pipe = HAS;
+					interrupt_in_endpoint[num_interrupt_in] = endpoint;
+					++num_interrupt_in;
+				}
+			}
+		}
+	}
+	/* END HORRIBLE HACK FOR PL2303 */
+#endif
+	
 	/* verify that we found all of the endpoints that we need */
 	if (!((interrupt_pipe & type->needs_interrupt_in) &&
 	      (bulk_in_pipe & type->needs_bulk_in) &&
@@ -1222,7 +1253,7 @@
 		port->magic = USB_SERIAL_PORT_MAGIC;
 		port->tqueue.routine = port_softint;
 		port->tqueue.data = port;
-		spin_lock_init (&port->port_lock);
+		init_MUTEX (&port->sem);
 	}
 	
 	/* initialize the devfs nodes for this device and let the user know what ports we are bound to */
diff -urN linux-2.4.6-pre4/drivers/usb/serial/visor.c linux/drivers/usb/serial/visor.c
--- linux-2.4.6-pre4/drivers/usb/serial/visor.c	Mon Dec  3 22:48:33 2001
+++ linux/drivers/usb/serial/visor.c	Mon Dec  3 22:48:43 2001
@@ -11,6 +11,9 @@
  *
  * See Documentation/usb/usb-serial.txt for more information on using this driver
  * 
+ * (05/30/2001) gkh
+ *	switched from using spinlock to a semaphore, which fixes lots of problems.
+ *
  * (05/28/2000) gkh
  *	Added initial support for the Palm m500 and Palm m505 devices.
  *
@@ -112,7 +115,7 @@
 /*
  * Version Information
  */
-#define DRIVER_VERSION "v1.1"
+#define DRIVER_VERSION "v1.2"
 #define DRIVER_AUTHOR "Greg Kroah-Hartman <greg@kroah.com>"
 #define DRIVER_DESC "USB HandSpring Visor driver"
 
@@ -253,15 +256,14 @@
 static int visor_open (struct usb_serial_port *port, struct file *filp)
 {
 	struct usb_serial *serial = port->serial;
-	unsigned long flags;
-	int result;
+	int result = 0;
 
 	if (port_paranoia_check (port, __FUNCTION__))
 		return -ENODEV;
 	
 	dbg(__FUNCTION__ " - port %d", port->number);
 
-	spin_lock_irqsave (&port->port_lock, flags);
+	down (&port->sem);
 	
 	++port->open_count;
 	MOD_INC_USE_COUNT;
@@ -286,9 +288,9 @@
 			err(__FUNCTION__ " - failed submitting read urb, error %d", result);
 	}
 	
-	spin_unlock_irqrestore (&port->port_lock, flags);
+	up (&port->sem);
 	
-	return 0;
+	return result;
 }
 
 
@@ -296,7 +298,6 @@
 {
 	struct usb_serial *serial;
 	unsigned char *transfer_buffer;
-	unsigned long flags;
 
 	if (port_paranoia_check (port, __FUNCTION__))
 		return;
@@ -307,7 +308,7 @@
 	if (!serial)
 		return;
 	
-	spin_lock_irqsave (&port->port_lock, flags);
+	down (&port->sem);
 
 	--port->open_count;
 
@@ -328,7 +329,7 @@
 		port->open_count = 0;
 
 	}
-	spin_unlock_irqrestore (&port->port_lock, flags);
+	up (&port->sem);
 
 	/* Uncomment the following line if you want to see some statistics in your syslog */
 	/* info ("Bytes In = %d  Bytes Out = %d", bytes_in, bytes_out); */
@@ -410,7 +411,7 @@
 
 	dbg(__FUNCTION__ " - port %d", port->number);
 	
-	spin_lock_irqsave (&port->port_lock, flags);
+	spin_lock_irqsave (&write_urb_pool_lock, flags);
 
 	for (i = 0; i < NUM_URBS; ++i) {
 		if (write_urb_pool[i]->status != -EINPROGRESS) {
@@ -418,7 +419,7 @@
 		}
 	}
 	
-	spin_unlock_irqrestore (&port->port_lock, flags);
+	spin_unlock_irqrestore (&write_urb_pool_lock, flags);
 	
 	dbg(__FUNCTION__ " - returns %d", room);
 	return (room);
@@ -433,7 +434,7 @@
 
 	dbg(__FUNCTION__ " - port %d", port->number);
 	
-	spin_lock_irqsave (&port->port_lock, flags);
+	spin_lock_irqsave (&write_urb_pool_lock, flags);
 
 	for (i = 0; i < NUM_URBS; ++i) {
 		if (write_urb_pool[i]->status == -EINPROGRESS) {
@@ -441,7 +442,7 @@
 		}
 	}
 	
-	spin_unlock_irqrestore (&port->port_lock, flags);
+	spin_unlock_irqrestore (&write_urb_pool_lock, flags);
 
 	dbg (__FUNCTION__ " - returns %d", chars);
 	return (chars);
@@ -523,15 +524,14 @@
 
 static void visor_throttle (struct usb_serial_port *port)
 {
-	unsigned long flags;
 
 	dbg(__FUNCTION__ " - port %d", port->number);
 
-	spin_lock_irqsave (&port->port_lock, flags);
+	down (&port->sem);
 
 	usb_unlink_urb (port->read_urb);
 
-	spin_unlock_irqrestore (&port->port_lock, flags);
+	up (&port->sem);
 
 	return;
 }
@@ -539,19 +539,18 @@
 
 static void visor_unthrottle (struct usb_serial_port *port)
 {
-	unsigned long flags;
 	int result;
 
 	dbg(__FUNCTION__ " - port %d", port->number);
 
-	spin_lock_irqsave (&port->port_lock, flags);
+	down (&port->sem);
 
 	port->read_urb->dev = port->serial->dev;
 	result = usb_submit_urb(port->read_urb);
 	if (result)
 		err(__FUNCTION__ " - failed submitting read urb, error %d", result);
 
-	spin_unlock_irqrestore (&port->port_lock, flags);
+	up (&port->sem);
 
 	return;
 }
diff -urN linux-2.4.6-pre4/drivers/usb/serial/whiteheat.c linux/drivers/usb/serial/whiteheat.c
--- linux-2.4.6-pre4/drivers/usb/serial/whiteheat.c	Mon Dec  3 22:48:33 2001
+++ linux/drivers/usb/serial/whiteheat.c	Mon Dec  3 22:48:43 2001
@@ -11,6 +11,9 @@
  *
  * See Documentation/usb/usb-serial.txt for more information on using this driver
  *
+ * (05/30/2001) gkh
+ *	switched from using spinlock to a semaphore, which fixes lots of problems.
+ *
  * (04/08/2001) gb
  *	Identify version on module load.
  * 
@@ -85,7 +88,7 @@
 /*
  * Version Information
  */
-#define DRIVER_VERSION "v1.0.0"
+#define DRIVER_VERSION "v1.1"
 #define DRIVER_AUTHOR "Greg Kroah-Hartman <greg@kroah.com>"
 #define DRIVER_DESC "USB ConnectTech WhiteHEAT driver"
 
@@ -251,6 +254,7 @@
 	struct usb_serial_port *port;
 	int timeout;
 	__u8 *transfer_buffer;
+	int retval = 0;
 
 	dbg(__FUNCTION__" - command %d", command);
 
@@ -263,9 +267,10 @@
 	memcpy (&transfer_buffer[1], data, datasize);
 	port->write_urb->transfer_buffer_length = datasize + 1;
 	port->write_urb->dev = serial->dev;
-	if (usb_submit_urb (port->write_urb)) {
+	retval = usb_submit_urb (port->write_urb);
+	if (retval) {
 		dbg (__FUNCTION__" - submit urb failed");
-		return -1;
+		goto exit;
 	}
 
 	/* wait for the command to complete */
@@ -276,20 +281,21 @@
 
 	if (info->command_finished == FALSE) {
 		dbg (__FUNCTION__ " - command timed out.");
-		return -1;
+		retval = -ETIMEDOUT;
+		goto exit;
 	}
 
 	if (info->command_finished == WHITEHEAT_CMD_FAILURE) {
 		dbg (__FUNCTION__ " - command failed.");
-		return -1;
+		retval = -EIO;
+		goto exit;
 	}
 
-	if (info->command_finished == WHITEHEAT_CMD_COMPLETE) {
+	if (info->command_finished == WHITEHEAT_CMD_COMPLETE)
 		dbg (__FUNCTION__ " - command completed.");
-		return 0;
-	}
 
-	return 0;
+exit:
+	return retval;
 }
 
 
@@ -298,10 +304,12 @@
 	struct whiteheat_min_set	open_command;
 	struct usb_serial_port 		*command_port;
 	struct whiteheat_private	*info;
-	int				result;
+	int				retval = 0;
 
 	dbg(__FUNCTION__" - port %d", port->number);
 
+	down (&port->sem);
+
 	++port->open_count;
 	MOD_INC_USE_COUNT;
 	
@@ -314,7 +322,8 @@
 			info = (struct whiteheat_private *)kmalloc (sizeof(struct whiteheat_private), GFP_KERNEL);
 			if (info == NULL) {
 				err(__FUNCTION__ " - out of memory");
-				return -ENOMEM;
+				retval = -ENOMEM;
+				goto error_exit;
 			}
 			
 			init_waitqueue_head(&info->wait_command);
@@ -323,27 +332,45 @@
 			command_port->read_urb->complete = command_port_read_callback;
 			command_port->read_urb->dev = port->serial->dev;
 			command_port->tty = port->tty;		/* need this to "fake" our our sanity check macros */
-			usb_submit_urb (command_port->read_urb);
+			retval = usb_submit_urb (command_port->read_urb);
+			if (retval) {
+				err(__FUNCTION__ " - failed submitting read urb, error %d", retval);
+				goto error_exit;
+			}
 		}
 		
 		/* Start reading from the device */
 		port->read_urb->dev = port->serial->dev;
-		result = usb_submit_urb(port->read_urb);
-		if (result)
-			err(__FUNCTION__ " - failed submitting read urb, error %d", result);
+		retval = usb_submit_urb(port->read_urb);
+		if (retval) {
+			err(__FUNCTION__ " - failed submitting read urb, error %d", retval);
+			goto error_exit;
+		}
 	
 		/* send an open port command */
 		/* firmware uses 1 based port numbering */
 		open_command.port = port->number - port->serial->minor + 1;
-		whiteheat_send_cmd (port->serial, WHITEHEAT_OPEN, (__u8 *)&open_command, sizeof(open_command));
+		retval = whiteheat_send_cmd (port->serial, WHITEHEAT_OPEN, (__u8 *)&open_command, sizeof(open_command));
+		if (retval)
+			goto error_exit;
 	
 		/* Need to do device specific setup here (control lines, baud rate, etc.) */
 		/* FIXME!!! */
 	}
 
 	dbg(__FUNCTION__ " - exit");
+	up (&port->sem);
 	
-	return 0;
+	return retval;
+
+error_exit:
+	--port->open_count;
+	MOD_DEC_USE_COUNT;
+
+	dbg(__FUNCTION__ " - error_exit");
+	up (&port->sem);
+	
+	return retval;
 }
 
 
@@ -353,6 +380,7 @@
 	
 	dbg(__FUNCTION__ " - port %d", port->number);
 	
+	down (&port->sem);
 	--port->open_count;
 
 	if (port->open_count <= 0) {
@@ -370,6 +398,7 @@
 		port->active = 0;
 	}
 	MOD_DEC_USE_COUNT;
+	up (&port->sem);
 }
 
 
@@ -388,18 +417,19 @@
 
 	dbg(__FUNCTION__ " -port %d", port->number);
 
+	down (&port->sem);
 	/* check that they really want us to change something */
 	if (old_termios) {
 		if ((cflag == old_termios->c_cflag) &&
 		    (RELEVANT_IFLAG(port->tty->termios->c_iflag) == RELEVANT_IFLAG(old_termios->c_iflag))) {
 			dbg(__FUNCTION__ " - nothing to change...");
-			return;
+			goto exit;
 		}
 	}
 
 	if ((!port->tty) || (!port->tty->termios)) {
 		dbg(__FUNCTION__" - no tty structures");
-		return;
+		goto exit;
 	}
 	
 	/* set the port number */
@@ -466,6 +496,8 @@
 	/* now send the message to the device */
 	whiteheat_send_cmd (port->serial, WHITEHEAT_SETUP_PORT, (__u8 *)&port_settings, sizeof(port_settings));
 	
+exit:
+	up (&port->sem);
 	return;
 }
 
diff -urN linux-2.4.6-pre4/drivers/video/aty128fb.c linux/drivers/video/aty128fb.c
--- linux-2.4.6-pre4/drivers/video/aty128fb.c	Fri Feb  9 11:30:23 2001
+++ linux/drivers/video/aty128fb.c	Mon Dec  3 22:48:43 2001
@@ -274,10 +274,10 @@
     struct fb_info fb_info;
     struct fb_info_aty128 *next;
     struct aty128_constants constants;  /* PLL and others      */
-    u32 regbase_phys;                   /* physical mmio       */
+    unsigned long regbase_phys;         /* physical mmio       */
     void *regbase;                      /* remapped mmio       */
-    u32 frame_buffer_phys;              /* physical fb memory  */
-    u32 frame_buffer;                   /* remaped framebuffer */
+    unsigned long frame_buffer_phys;    /* physical fb memory  */
+    void *frame_buffer;                 /* remaped framebuffer */
     u32 vram_size;                      /* onboard video ram   */
     int chip_gen;
     const struct aty128_meminfo *mem;   /* onboard mem info    */
@@ -1380,7 +1380,7 @@
 	struct fb_fix_screeninfo fix;
 
 	aty128_encode_fix(&fix, &par, info);
-        display->screen_base = (char *)info->frame_buffer;
+        display->screen_base = info->frame_buffer;
 	display->visual = fix.visual;
 	display->type = fix.type;
 	display->type_aux = fix.type_aux;
@@ -1833,7 +1833,7 @@
                                const struct aty128_chip_info *aci)
 {
 	struct fb_info_aty128 *info = NULL;
-	u32 fb_addr, reg_addr;
+	unsigned long fb_addr, reg_addr;
 	int err;
 #if !defined(CONFIG_PPC) && !defined(__sparc__)
 	char *bios_seg = NULL;
@@ -1885,7 +1885,7 @@
 
 	/* Virtualize the framebuffer */
 	info->frame_buffer_phys = fb_addr;
-	info->frame_buffer = (u32)ioremap(fb_addr, info->vram_size);
+	info->frame_buffer = ioremap(fb_addr, info->vram_size);
 
 	if (!info->frame_buffer) {
 		iounmap((void *)info->regbase);
@@ -1931,8 +1931,8 @@
 	return 0;
 
 err_out:
-	iounmap((void *)info->frame_buffer);
-	iounmap((void *)info->regbase);
+	iounmap(info->frame_buffer);
+	iounmap(info->regbase);
 err_free_info:
 	kfree(info);
 err_unmap_out:
@@ -2622,7 +2622,7 @@
                      info->vram_size);
 #endif /* CONFIG_MTRR */
         iounmap(info->regbase);
-        iounmap(&info->frame_buffer);
+        iounmap(info->frame_buffer);
 
         release_mem_region(pci_resource_start(info->pdev, 0),
                            pci_resource_len(info->pdev, 0));
diff -urN linux-2.4.6-pre4/include/asm-alpha/socket.h linux/include/asm-alpha/socket.h
--- linux-2.4.6-pre4/include/asm-alpha/socket.h	Sat Feb  3 11:26:44 2001
+++ linux/include/asm-alpha/socket.h	Mon Dec  3 22:48:43 2001
@@ -66,6 +66,7 @@
 					/* level.  For writing rarp and	*/
 					/* other similar things on the	*/
 					/* user level.			*/
+#define	SOCK_MAX	(SOCK_PACKET+1)
 #endif
 
 #endif /* _ASM_SOCKET_H */
diff -urN linux-2.4.6-pre4/include/asm-arm/socket.h linux/include/asm-arm/socket.h
--- linux-2.4.6-pre4/include/asm-arm/socket.h	Sat Feb  3 11:26:44 2001
+++ linux/include/asm-arm/socket.h	Mon Dec  3 22:48:43 2001
@@ -58,6 +58,7 @@
 					/* level.  For writing rarp and	*/
 					/* other similar things on the	*/
 					/* user level.			*/
+#define	SOCK_MAX	(SOCK_PACKET+1)
 #endif
 
 #endif /* _ASM_SOCKET_H */
diff -urN linux-2.4.6-pre4/include/asm-cris/socket.h linux/include/asm-cris/socket.h
--- linux-2.4.6-pre4/include/asm-cris/socket.h	Fri Apr  6 10:51:19 2001
+++ linux/include/asm-cris/socket.h	Mon Dec  3 22:48:43 2001
@@ -59,6 +59,7 @@
                                         /* level.  For writing rarp and */
                                         /* other similar things on the  */
                                         /* user level.                  */
+#define	SOCK_MAX	(SOCK_PACKET+1)
 #endif
 
 #endif /* _ASM_SOCKET_H */
diff -urN linux-2.4.6-pre4/include/asm-i386/socket.h linux/include/asm-i386/socket.h
--- linux-2.4.6-pre4/include/asm-i386/socket.h	Sat Feb  3 11:26:44 2001
+++ linux/include/asm-i386/socket.h	Mon Dec  3 22:48:43 2001
@@ -58,6 +58,7 @@
 					/* level.  For writing rarp and	*/
 					/* other similar things on the	*/
 					/* user level.			*/
+#define	SOCK_MAX	(SOCK_PACKET+1)
 #endif
 
 #endif /* _ASM_SOCKET_H */
diff -urN linux-2.4.6-pre4/include/asm-i386/softirq.h linux/include/asm-i386/softirq.h
--- linux-2.4.6-pre4/include/asm-i386/softirq.h	Mon Dec  3 22:48:33 2001
+++ linux/include/asm-i386/softirq.h	Mon Dec  3 22:48:43 2001
@@ -36,13 +36,13 @@
 									\
 			".section .text.lock,\"ax\";"			\
 			"2: pushl %%eax; pushl %%ecx; pushl %%edx;"	\
-			"call do_softirq;"				\
+			"call %c1;"					\
 			"popl %%edx; popl %%ecx; popl %%eax;"		\
 			"jmp 1b;"					\
 			".previous;"					\
 									\
 		: /* no output */					\
-		: "r" (ptr)						\
+		: "r" (ptr), "i" (do_softirq)				\
 		/* no registers clobbered */ );				\
 } while (0)
 
diff -urN linux-2.4.6-pre4/include/asm-ia64/socket.h linux/include/asm-ia64/socket.h
--- linux-2.4.6-pre4/include/asm-ia64/socket.h	Sat Feb  3 11:26:44 2001
+++ linux/include/asm-ia64/socket.h	Mon Dec  3 22:48:43 2001
@@ -65,6 +65,7 @@
 					/* level.  For writing rarp and	*/
 					/* other similar things on the	*/
 					/* user level.			*/
+#define	SOCK_MAX	(SOCK_PACKET+1)
 #endif
 
 #endif /* _ASM_IA64_SOCKET_H */
diff -urN linux-2.4.6-pre4/include/asm-m68k/socket.h linux/include/asm-m68k/socket.h
--- linux-2.4.6-pre4/include/asm-m68k/socket.h	Sat Feb  3 11:26:44 2001
+++ linux/include/asm-m68k/socket.h	Mon Dec  3 22:48:43 2001
@@ -58,6 +58,7 @@
 					/* level.  For writing rarp and	*/
 					/* other similar things on the	*/
 					/* user level.			*/
+#define	SOCK_MAX	(SOCK_PACKET+1)
 #endif
 
 #endif /* _ASM_SOCKET_H */
diff -urN linux-2.4.6-pre4/include/asm-mips/socket.h linux/include/asm-mips/socket.h
--- linux-2.4.6-pre4/include/asm-mips/socket.h	Sat Feb  3 11:26:44 2001
+++ linux/include/asm-mips/socket.h	Mon Dec  3 22:48:43 2001
@@ -71,6 +71,7 @@
 					/* level.  For writing rarp and	*/
 					/* other similar things on the	*/
 					/* user level.			*/
+#define	SOCK_MAX	(SOCK_PACKET+1)
 #endif
 
 #endif /* _ASM_SOCKET_H */
diff -urN linux-2.4.6-pre4/include/asm-mips64/socket.h linux/include/asm-mips64/socket.h
--- linux-2.4.6-pre4/include/asm-mips64/socket.h	Sat Feb  3 11:26:44 2001
+++ linux/include/asm-mips64/socket.h	Mon Dec  3 22:48:43 2001
@@ -79,6 +79,7 @@
 					/* level.  For writing rarp and	*/
 					/* other similar things on the	*/
 					/* user level.			*/
+#define	SOCK_MAX	(SOCK_PACKET+1)
 #endif
 
 #endif /* _ASM_SOCKET_H */
diff -urN linux-2.4.6-pre4/include/asm-parisc/socket.h linux/include/asm-parisc/socket.h
--- linux-2.4.6-pre4/include/asm-parisc/socket.h	Sat Feb  3 11:26:44 2001
+++ linux/include/asm-parisc/socket.h	Mon Dec  3 22:48:43 2001
@@ -56,6 +56,7 @@
 				/* level.  For writing rarp and	*/
 				/* other similar things on the	*/
 				/* user level.			*/
+#define	SOCK_MAX	(SOCK_PACKET+1)
 #endif
 
 #endif /* _ASM_SOCKET_H */
diff -urN linux-2.4.6-pre4/include/asm-ppc/socket.h linux/include/asm-ppc/socket.h
--- linux-2.4.6-pre4/include/asm-ppc/socket.h	Mon May 21 15:02:06 2001
+++ linux/include/asm-ppc/socket.h	Mon Dec  3 22:48:43 2001
@@ -67,6 +67,7 @@
 					/* level.  For writing rarp and	*/
 					/* other similar things on the	*/
 					/* user level.			*/
+#define	SOCK_MAX	(SOCK_PACKET+1)
 #endif
 
 #endif /* _ASM_SOCKET_H */
diff -urN linux-2.4.6-pre4/include/asm-s390/socket.h linux/include/asm-s390/socket.h
--- linux-2.4.6-pre4/include/asm-s390/socket.h	Sat Feb  3 11:26:44 2001
+++ linux/include/asm-s390/socket.h	Mon Dec  3 22:48:43 2001
@@ -66,6 +66,7 @@
 					/* level.  For writing rarp and	*/
 					/* other similar things on the	*/
 					/* user level.			*/
+#define	SOCK_MAX	(SOCK_PACKET+1)
 #endif
 
 #endif /* _ASM_SOCKET_H */
diff -urN linux-2.4.6-pre4/include/asm-s390x/socket.h linux/include/asm-s390x/socket.h
--- linux-2.4.6-pre4/include/asm-s390x/socket.h	Fri Mar  2 11:12:06 2001
+++ linux/include/asm-s390x/socket.h	Mon Dec  3 22:48:43 2001
@@ -65,6 +65,7 @@
 					/* level.  For writing rarp and	*/
 					/* other similar things on the	*/
 					/* user level.			*/
+#define	SOCK_MAX	(SOCK_PACKET+1)
 #endif
 
 #endif /* _ASM_SOCKET_H */
diff -urN linux-2.4.6-pre4/include/asm-sh/socket.h linux/include/asm-sh/socket.h
--- linux-2.4.6-pre4/include/asm-sh/socket.h	Sat Feb  3 11:26:44 2001
+++ linux/include/asm-sh/socket.h	Mon Dec  3 22:48:43 2001
@@ -58,6 +58,7 @@
 					/* level.  For writing rarp and	*/
 					/* other similar things on the	*/
 					/* user level.			*/
+#define	SOCK_MAX	(SOCK_PACKET+1)
 #endif
 
 #endif /* __ASM_SH_SOCKET_H */
diff -urN linux-2.4.6-pre4/include/asm-sparc/socket.h linux/include/asm-sparc/socket.h
--- linux-2.4.6-pre4/include/asm-sparc/socket.h	Sat Feb  3 11:26:44 2001
+++ linux/include/asm-sparc/socket.h	Mon Dec  3 22:48:43 2001
@@ -1,4 +1,4 @@
-/* $Id: socket.h,v 1.16 2001/01/30 07:48:30 davem Exp $ */
+/* $Id: socket.h,v 1.17 2001/06/13 16:25:03 davem Exp $ */
 #ifndef _ASM_SOCKET_H
 #define _ASM_SOCKET_H
 
@@ -63,6 +63,7 @@
 					/* level.  For writing rarp and	*/
 					/* other similar things on the	*/
 					/* user level.			*/
+#define	SOCK_MAX	(SOCK_PACKET+1)
 #endif
 
 #endif /* _ASM_SOCKET_H */
diff -urN linux-2.4.6-pre4/include/asm-sparc64/bitops.h linux/include/asm-sparc64/bitops.h
--- linux-2.4.6-pre4/include/asm-sparc64/bitops.h	Mon Dec  3 22:48:34 2001
+++ linux/include/asm-sparc64/bitops.h	Mon Dec  3 22:48:43 2001
@@ -1,4 +1,4 @@
-/* $Id: bitops.h,v 1.34 2001/05/27 00:09:29 davem Exp $
+/* $Id: bitops.h,v 1.36 2001/06/14 12:34:49 davem Exp $
  * bitops.h: Bit string operations on the V9.
  *
  * Copyright 1996, 1997 David S. Miller (davem@caip.rutgers.edu)
diff -urN linux-2.4.6-pre4/include/asm-sparc64/socket.h linux/include/asm-sparc64/socket.h
--- linux-2.4.6-pre4/include/asm-sparc64/socket.h	Sat Feb  3 11:26:44 2001
+++ linux/include/asm-sparc64/socket.h	Mon Dec  3 22:48:43 2001
@@ -1,4 +1,4 @@
-/* $Id: socket.h,v 1.9 2001/01/30 07:48:30 davem Exp $ */
+/* $Id: socket.h,v 1.10 2001/06/13 16:25:03 davem Exp $ */
 #ifndef _ASM_SOCKET_H
 #define _ASM_SOCKET_H
 
@@ -63,6 +63,7 @@
 					/* level.  For writing rarp and	*/
 					/* other similar things on the	*/
 					/* user level.			*/
+#define	SOCK_MAX	(SOCK_PACKET+1)
 #endif
 
 #endif /* _ASM_SOCKET_H */
diff -urN linux-2.4.6-pre4/include/linux/acpi.h linux/include/linux/acpi.h
--- linux-2.4.6-pre4/include/linux/acpi.h	Fri Feb  9 11:45:58 2001
+++ linux/include/linux/acpi.h	Mon Dec  3 22:48:43 2001
@@ -155,7 +155,7 @@
 	ACPI_FACS,
 	ACPI_XSDT,
 	ACPI_PMTIMER,
-	ACPI_BATTERY,
+	ACPI_BATT,
 };
 
 #define ACPI_SLP_TYP_DISABLED	(~0UL)
diff -urN linux-2.4.6-pre4/include/linux/if_hippi.h linux/include/linux/if_hippi.h
--- linux-2.4.6-pre4/include/linux/if_hippi.h	Fri May 25 18:02:32 2001
+++ linux/include/linux/if_hippi.h	Mon Dec  3 22:48:43 2001
@@ -110,13 +110,13 @@
 struct hippi_le_hdr
 {
 #if defined (__BIG_ENDIAN_BITFIELD)
-	unsigned long	fc:3;
-	unsigned long	double_wide:1;
-	unsigned long	message_type:4;
+	__u8		fc:3;
+	__u8		double_wide:1;
+	__u8		message_type:4;
 #elif defined(__LITTLE_ENDIAN_BITFIELD)
-	unsigned long	message_type:4;
-	unsigned long	double_wide:1;
-	unsigned long	fc:3;
+	__u8		message_type:4;
+	__u8		double_wide:1;
+	__u8		fc:3;
 #endif
 	__u8		dest_switch_addr[3];
 #if defined (__BIG_ENDIAN_BITFIELD)
diff -urN linux-2.4.6-pre4/include/linux/pci_ids.h linux/include/linux/pci_ids.h
--- linux-2.4.6-pre4/include/linux/pci_ids.h	Mon Dec  3 22:48:34 2001
+++ linux/include/linux/pci_ids.h	Mon Dec  3 22:48:43 2001
@@ -1384,6 +1384,9 @@
 #define PCI_VENDOR_ID_AFAVLAB		0x14db
 #define PCI_DEVICE_ID_AFAVLAB_TK9902	0x2120
 
+#define PCI_VENDOR_ID_BROADCOM		0x14e4
+#define PCI_DEVICE_ID_TIGON3		0x1644
+
 #define PCI_VENDOR_ID_SYBA		0x1592
 #define PCI_DEVICE_ID_SYBA_2P_EPP	0x0782
 #define PCI_DEVICE_ID_SYBA_1P_ECP	0x0783
diff -urN linux-2.4.6-pre4/include/linux/raid/raid5.h linux/include/linux/raid/raid5.h
--- linux-2.4.6-pre4/include/linux/raid/raid5.h	Thu Feb  8 19:38:38 2001
+++ linux/include/linux/raid/raid5.h	Mon Dec  3 22:48:43 2001
@@ -132,6 +132,7 @@
 	struct buffer_head	*bh_read[MD_SB_DISKS];	/* read request buffers of the MD device */
 	struct buffer_head	*bh_write[MD_SB_DISKS];	/* write request buffers of the MD device */
 	struct buffer_head	*bh_written[MD_SB_DISKS]; /* write request buffers of the MD device that have been scheduled for write */
+	struct page		*bh_page[MD_SB_DISKS];	/* saved bh_cache[n]->b_page when reading around the cache */
 	unsigned long		sector;			/* sector of this row */
 	int			size;			/* buffers size */
 	int			pd_idx;			/* parity disk index */
@@ -157,6 +158,32 @@
 #define STRIPE_HANDLE		2
 #define	STRIPE_SYNCING		3
 #define	STRIPE_INSYNC		4
+#define	STRIPE_PREREAD_ACTIVE	5
+#define	STRIPE_DELAYED		6
+
+/*
+ * Plugging:
+ *
+ * To improve write throughput, we need to delay the handling of some
+ * stripes until there has been a chance that several write requests
+ * for the one stripe have all been collected.
+ * In particular, any write request that would require pre-reading
+ * is put on a "delayed" queue until there are no stripes currently
+ * in a pre-read phase.  Further, if the "delayed" queue is empty when
+ * a stripe is put on it then we "plug" the queue and do not process it
+ * until an unplg call is made. (the tq_disk list is run).
+ *
+ * When preread is initiated on a stripe, we set PREREAD_ACTIVE and add
+ * it to the count of prereading stripes.
+ * When write is initiated, or the stripe refcnt == 0 (just in case) we
+ * clear the PREREAD_ACTIVE flag and decrement the count
+ * Whenever the delayed queue is empty and the device is not plugged, we
+ * move any strips from delayed to handle and clear the DELAYED flag and set PREREAD_ACTIVE.
+ * In stripe_handle, if we find pre-reading is necessary, we do it if
+ * PREREAD_ACTIVE is set, else we set DELAYED which will send it to the delayed queue.
+ * HANDLE gets cleared if stripe_handle leave nothing locked.
+ */
+ 
 
 struct disk_info {
 	kdev_t	dev;
@@ -181,14 +208,21 @@
 	int			max_nr_stripes;
 
 	struct list_head	handle_list; /* stripes needing handling */
+	struct list_head	delayed_list; /* stripes that have plugged requests */
+	atomic_t		preread_active_stripes; /* stripes with scheduled io */
 	/*
 	 * Free stripes pool
 	 */
 	atomic_t		active_stripes;
 	struct list_head	inactive_list;
 	md_wait_queue_head_t	wait_for_stripe;
-
+	int			inactive_blocked;	/* release of inactive stripes blocked,
+							 * waiting for 25% to be free
+							 */        
 	md_spinlock_t		device_lock;
+
+	int			plugged;
+	struct tq_struct	plug_tq;
 };
 
 typedef struct raid5_private_data raid5_conf_t;
diff -urN linux-2.4.6-pre4/include/net/protocol.h linux/include/net/protocol.h
--- linux-2.4.6-pre4/include/net/protocol.h	Fri May 25 18:01:27 2001
+++ linux/include/net/protocol.h	Mon Dec  3 22:48:43 2001
@@ -63,19 +63,46 @@
 
 #endif
 
+/* This is used to register socket interfaces for IP protocols.  */
+struct inet_protosw {
+	struct list_head list;
+
+        /* These two fields form the lookup key.  */
+	unsigned short	 type;	   /* This is the 2nd argument to socket(2). */
+	int		 protocol; /* This is the L4 protocol number.  */
+
+	struct proto	 *prot;
+	struct proto_ops *ops;
+  
+	int              capability; /* Which (if any) capability do
+				      * we need to use this socket
+				      * interface?
+                                      */
+	char             no_check;   /* checksum on rcv/xmit/none? */
+	unsigned char	 flags;      /* See INET_PROTOSW_* below.  */
+};
+#define INET_PROTOSW_REUSE 0x01	     /* Are ports automatically reusable? */
+#define INET_PROTOSW_PERMANENT 0x02  /* Permanent protocols are unremovable. */
+
 extern struct inet_protocol *inet_protocol_base;
 extern struct inet_protocol *inet_protos[MAX_INET_PROTOS];
+extern struct list_head inetsw[SOCK_MAX];
 
 #if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
 extern struct inet6_protocol *inet6_protos[MAX_INET_PROTOS];
+extern struct list_head inetsw6[SOCK_MAX];
 #endif
 
 extern void	inet_add_protocol(struct inet_protocol *prot);
 extern int	inet_del_protocol(struct inet_protocol *prot);
+extern void	inet_register_protosw(struct inet_protosw *p);
+extern void	inet_unregister_protosw(struct inet_protosw *p);
 
 #if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
 extern void	inet6_add_protocol(struct inet6_protocol *prot);
 extern int	inet6_del_protocol(struct inet6_protocol *prot);
+extern void	inet6_register_protosw(struct inet_protosw *p);
+extern void	inet6_unregister_protosw(struct inet_protosw *p);
 #endif
 
 #endif	/* _PROTOCOL_H */
diff -urN linux-2.4.6-pre4/include/net/snmp.h linux/include/net/snmp.h
--- linux-2.4.6-pre4/include/net/snmp.h	Fri May 25 18:01:27 2001
+++ linux/include/net/snmp.h	Mon Dec  3 22:48:43 2001
@@ -14,7 +14,7 @@
  *		as published by the Free Software Foundation; either version
  *		2 of the License, or (at your option) any later version.
  *
- *		$Id: snmp.h,v 1.18 2001/05/16 16:45:35 davem Exp $
+ *		$Id: snmp.h,v 1.19 2001/06/14 13:40:46 davem Exp $
  *
  */
  
@@ -119,6 +119,7 @@
  	unsigned long	IcmpOutTimestampReps;
  	unsigned long	IcmpOutAddrMasks;
  	unsigned long	IcmpOutAddrMaskReps;
+	unsigned long	dummy;
 	unsigned long   __pad[0]; 
 } ____cacheline_aligned;
 
diff -urN linux-2.4.6-pre4/mm/page_alloc.c linux/mm/page_alloc.c
--- linux-2.4.6-pre4/mm/page_alloc.c	Mon Dec  3 22:48:34 2001
+++ linux/mm/page_alloc.c	Mon Dec  3 22:48:43 2001
@@ -451,8 +451,13 @@
 			memory_pressure++;
 			if (!order || free_shortage()) {
 				int progress = try_to_free_pages(gfp_mask);
-				if (progress || gfp_mask & __GFP_IO)
+				if (progress || (gfp_mask & __GFP_IO))
 					goto try_again;
+				/*
+				 * Fail in case no progress was made and the
+				 * allocation may not be able to block on IO.
+				 */
+				return NULL;
 			}
 		}
 	}
diff -urN linux-2.4.6-pre4/net/802/hippi.c linux/net/802/hippi.c
--- linux-2.4.6-pre4/net/802/hippi.c	Wed Aug 18 11:38:48 1999
+++ linux/net/802/hippi.c	Mon Dec  3 22:48:43 2001
@@ -98,7 +98,7 @@
 		memcpy(&skb->private.ifield, daddr + 2, 4);
 		return HIPPI_HLEN;
 	}
-	return -HIPPI_HLEN;
+	return -((int)HIPPI_HLEN);
 }
 
 
diff -urN linux-2.4.6-pre4/net/core/dev.c linux/net/core/dev.c
--- linux-2.4.6-pre4/net/core/dev.c	Mon Dec  3 22:48:34 2001
+++ linux/net/core/dev.c	Mon Dec  3 22:48:43 2001
@@ -20,6 +20,10 @@
  *              Pekka Riikonen <priikone@poesidon.pspt.fi>
  *
  *	Changes:
+ *              D.J. Barrow     :       Fixed bug where dev->refcnt gets set to 2
+ *                                      if register_netdev gets called before
+ *                                      net_dev_init & also removed a few lines
+ *                                      of code in the process.
  *		Alan Cox	:	device private ioctl copies fields back.
  *		Alan Cox	:	Transmit queue code does relevant stunts to
  *					keep the queue safe.
@@ -2382,6 +2386,8 @@
  *	will not get the same name.
  */
 
+int net_dev_init(void);
+
 int register_netdevice(struct net_device *dev)
 {
 	struct net_device *d, **dp;
@@ -2396,47 +2402,8 @@
 	dev->fastpath_lock=RW_LOCK_UNLOCKED;
 #endif
 
-	if (dev_boot_phase) {
-#ifdef CONFIG_NET_DIVERT
-		ret = alloc_divert_blk(dev);
-		if (ret)
-			return ret;
-#endif /* CONFIG_NET_DIVERT */
-		
-		/* This is NOT bug, but I am not sure, that all the
-		   devices, initialized before netdev module is started
-		   are sane. 
-
-		   Now they are chained to device boot list
-		   and probed later. If a module is initialized
-		   before netdev, but assumes that dev->init
-		   is really called by register_netdev(), it will fail.
-
-		   So that this message should be printed for a while.
-		 */
-		printk(KERN_INFO "early initialization of device %s is deferred\n", dev->name);
-
-		/* Check for existence, and append to tail of chain */
-		for (dp=&dev_base; (d=*dp) != NULL; dp=&d->next) {
-			if (d == dev || strcmp(d->name, dev->name) == 0) {
-				return -EEXIST;
-			}
-		}
-		dev->next = NULL;
-		write_lock_bh(&dev_base_lock);
-		*dp = dev;
-		dev_hold(dev);
-		write_unlock_bh(&dev_base_lock);
-
-		/*
-		 *	Default initial state at registry is that the
-		 *	device is present.
-		 */
-
-		set_bit(__LINK_STATE_PRESENT, &dev->state);
-
-		return 0;
-	}
+	if (dev_boot_phase)
+		net_dev_init();
 
 #ifdef CONFIG_NET_DIVERT
 	ret = alloc_divert_blk(dev);
@@ -2679,6 +2646,9 @@
 {
 	struct net_device *dev, **dp;
 	int i;
+
+	if (!dev_boot_phase)
+		return 0;
 
 #ifdef CONFIG_NET_SCHED
 	pktsched_init();
diff -urN linux-2.4.6-pre4/net/ipv4/af_inet.c linux/net/ipv4/af_inet.c
--- linux-2.4.6-pre4/net/ipv4/af_inet.c	Tue May  1 20:59:24 2001
+++ linux/net/ipv4/af_inet.c	Mon Dec  3 22:48:43 2001
@@ -5,7 +5,7 @@
  *
  *		PF_INET protocol family socket handler.
  *
- * Version:	$Id: af_inet.c,v 1.130 2001/04/29 08:21:32 davem Exp $
+ * Version:	$Id: af_inet.c,v 1.131 2001/06/13 16:25:03 davem Exp $
  *
  * Authors:	Ross Biro, <bir7@leland.Stanford.Edu>
  *		Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
@@ -14,6 +14,8 @@
  *
  * Changes (see also sock.c)
  *
+ *		piggy,
+ *		Karl Knutson	:	Socket protocol table
  *		A.N.Kuznetsov	:	Socket death error in accept().
  *		John Richardson :	Fix non blocking error in connect()
  *					so sockets that fail to connect
@@ -88,6 +90,7 @@
 #include <linux/smp_lock.h>
 #include <linux/inet.h>
 #include <linux/netdevice.h>
+#include <linux/brlock.h>
 #include <net/ip.h>
 #include <net/protocol.h>
 #include <net/arp.h>
@@ -142,6 +145,11 @@
 int (*br_ioctl_hook)(unsigned long);
 #endif
 
+/* The inetsw table contains everything that inet_create needs to
+ * build a new socket.
+ */
+struct list_head inetsw[SOCK_MAX];
+
 /* New destruction routine */
 
 void inet_sock_destruct(struct sock *sk)
@@ -309,45 +317,54 @@
 static int inet_create(struct socket *sock, int protocol)
 {
 	struct sock *sk;
-	struct proto *prot;
+        struct list_head *p;
+        struct inet_protosw *answer;
 
 	sock->state = SS_UNCONNECTED;
 	sk = sk_alloc(PF_INET, GFP_KERNEL, 1);
 	if (sk == NULL) 
 		goto do_oom;
+  
+	/* Look for the requested type/protocol pair. */
+	answer = NULL;
+	br_read_lock_bh(BR_NETPROTO_LOCK);
+	list_for_each(p, &inetsw[sock->type]) {
+		answer = list_entry(p, struct inet_protosw, list);
+
+		/* Check the non-wild match. */
+		if (protocol == answer->protocol) {
+			if (protocol != IPPROTO_IP)
+				break;
+		} else {
+			/* Check for the two wild cases. */
+			if (IPPROTO_IP == protocol) {
+				protocol = answer->protocol;
+				break;
+			}
+			if (IPPROTO_IP == answer->protocol)
+				break;
+		}
+		answer = NULL;
+	}
+	br_read_unlock_bh(BR_NETPROTO_LOCK);
 
-	switch (sock->type) {
-	case SOCK_STREAM:
-		if (protocol && protocol != IPPROTO_TCP)
-			goto free_and_noproto;
-		protocol = IPPROTO_TCP;
-		prot = &tcp_prot;
-		sock->ops = &inet_stream_ops;
-		break;
-	case SOCK_SEQPACKET:
+	if (!answer)
 		goto free_and_badtype;
-	case SOCK_DGRAM:
-		if (protocol && protocol != IPPROTO_UDP)
-			goto free_and_noproto;
-		protocol = IPPROTO_UDP;
-		sk->no_check = UDP_CSUM_DEFAULT;
-		prot=&udp_prot;
-		sock->ops = &inet_dgram_ops;
-		break;
-	case SOCK_RAW:
-		if (!capable(CAP_NET_RAW))
-			goto free_and_badperm;
-		if (!protocol)
-			goto free_and_noproto;
-		prot = &raw_prot;
+	if (answer->capability > 0 && !capable(answer->capability))
+		goto free_and_badperm;
+	if (!protocol)
+		goto free_and_noproto;
+
+	sock->ops = answer->ops;
+	sk->prot = answer->prot;
+	sk->no_check = answer->no_check;
+	if (INET_PROTOSW_REUSE & answer->flags)
 		sk->reuse = 1;
+
+	if (SOCK_RAW == sock->type) {
 		sk->num = protocol;
-		sock->ops = &inet_dgram_ops;
-		if (protocol == IPPROTO_RAW)
+		if (IPPROTO_RAW == protocol)
 			sk->protinfo.af_inet.hdrincl = 1;
-		break;
-	default:
-		goto free_and_badtype;
 	}
 
 	if (ipv4_config.no_pmtu_disc)
@@ -365,8 +382,7 @@
 	sk->family	= PF_INET;
 	sk->protocol	= protocol;
 
-	sk->prot	= prot;
-	sk->backlog_rcv = prot->backlog_rcv;
+	sk->backlog_rcv = sk->prot->backlog_rcv;
 
 	sk->protinfo.af_inet.ttl	= sysctl_ip_default_ttl;
 
@@ -395,10 +411,10 @@
 		int err = sk->prot->init(sk);
 		if (err != 0) {
 			inet_sock_release(sk);
-			return(err);
+			return err;
 		}
 	}
-	return(0);
+	return 0;
 
 free_and_badtype:
 	sk_free(sk);
@@ -969,6 +985,107 @@
 extern void tcp_init(void);
 extern void tcp_v4_init(struct net_proto_family *);
 
+/* Upon startup we insert all the elements in inetsw_array[] into
+ * the linked list inetsw.
+ */
+static struct inet_protosw inetsw_array[] =
+{
+        {
+                type:        SOCK_STREAM,
+                protocol:    IPPROTO_TCP,
+                prot:        &tcp_prot,
+                ops:         &inet_stream_ops,
+                capability:  -1,
+                no_check:    0,
+                flags:       INET_PROTOSW_PERMANENT,
+        },
+
+        {
+                type:        SOCK_DGRAM,
+                protocol:    IPPROTO_UDP,
+                prot:        &udp_prot,
+                ops:         &inet_dgram_ops,
+                capability:  -1,
+                no_check:    UDP_CSUM_DEFAULT,
+                flags:       INET_PROTOSW_PERMANENT,
+       },
+        
+
+       {
+               type:        SOCK_RAW,
+               protocol:    IPPROTO_IP,	/* wild card */
+               prot:        &raw_prot,
+               ops:         &inet_dgram_ops,
+               capability:  CAP_NET_RAW,
+               no_check:    UDP_CSUM_DEFAULT,
+               flags:       INET_PROTOSW_REUSE,
+       }
+};
+
+#define INETSW_ARRAY_LEN (sizeof(inetsw_array) / sizeof(struct inet_protosw))
+
+void
+inet_register_protosw(struct inet_protosw *p)
+{
+	struct list_head *lh;
+	struct inet_protosw *answer;
+	int protocol = p->protocol;
+
+	br_write_lock_bh(BR_NETPROTO_LOCK);
+
+	if (p->type > SOCK_MAX)
+		goto out_illegal;
+
+	/* If we are trying to override a permanent protocol, bail. */
+	answer = NULL;
+	list_for_each(lh, &inetsw[p->type]) {
+		answer = list_entry(lh, struct inet_protosw, list);
+
+		/* Check only the non-wild match. */
+		if (protocol == answer->protocol &&
+		    (INET_PROTOSW_PERMANENT & answer->flags))
+			break;
+
+		answer = NULL;
+	}
+	if (answer)
+		goto out_permanent;
+
+	/* Add to the BEGINNING so that we override any existing
+	 * entry.  This means that when we remove this entry, the
+	 * system automatically returns to the old behavior.
+	 */
+	list_add(&p->list, &inetsw[p->type]);
+out:
+	br_write_unlock_bh(BR_NETPROTO_LOCK);
+	return;
+
+out_permanent:
+	printk(KERN_ERR "Attempt to override permanent protocol %d.\n",
+	       protocol);
+	goto out;
+
+out_illegal:
+	printk(KERN_ERR
+	       "Ignoring attempt to register illegal socket type %d.\n",
+	       p->type);
+	goto out;
+}
+
+void
+inet_unregister_protosw(struct inet_protosw *p)
+{
+	if (INET_PROTOSW_PERMANENT & p->flags) {
+		printk(KERN_ERR
+		       "Attempt to unregister permanent protocol %d.\n",
+		       p->protocol);
+	} else {
+		br_write_lock_bh(BR_NETPROTO_LOCK);
+		list_del(&p->list);
+		br_write_unlock_bh(BR_NETPROTO_LOCK);
+	}
+}
+
 
 /*
  *	Called by socket.c on kernel startup.  
@@ -978,6 +1095,8 @@
 {
 	struct sk_buff *dummy_skb;
 	struct inet_protocol *p;
+	struct inet_protosw *q;
+	struct list_head *r;
 
 	printk(KERN_INFO "NET4: Linux TCP/IP 1.0 for NET4.0\n");
 
@@ -1003,6 +1122,13 @@
 		printk("%s%s",p->name,tmp?", ":"\n");
 		p = tmp;
 	}
+
+	/* Register the socket-side information for inet_create. */
+	for(r = &inetsw[0]; r < &inetsw[SOCK_MAX]; ++r)
+		INIT_LIST_HEAD(r);
+
+	for(q = inetsw_array; q < &inetsw_array[INETSW_ARRAY_LEN]; ++q)
+		inet_register_protosw(q);
 
 	/*
 	 *	Set the ARP module up
diff -urN linux-2.4.6-pre4/net/ipv4/icmp.c linux/net/ipv4/icmp.c
--- linux-2.4.6-pre4/net/ipv4/icmp.c	Wed May 16 10:31:26 2001
+++ linux/net/ipv4/icmp.c	Mon Dec  3 22:48:43 2001
@@ -3,7 +3,7 @@
  *	
  *		Alan Cox, <alan@redhat.com>
  *
- *	Version: $Id: icmp.c,v 1.76 2001/05/10 01:20:58 davem Exp $
+ *	Version: $Id: icmp.c,v 1.77 2001/06/14 13:40:46 davem Exp $
  *
  *	This program is free software; you can redistribute it and/or
  *	modify it under the terms of the GNU General Public License
@@ -928,11 +928,6 @@
 	goto drop;
 }
 
-/*
- *	A spare long used to speed up statistics updating
- */
- 
-static unsigned long dummy;
 
 /* 
  * 	Configurable rate limits.
@@ -954,20 +949,20 @@
 static struct icmp_control icmp_pointers[NR_ICMP_TYPES+1] = {
 /* ECHO REPLY (0) */
  { &icmp_statistics[0].IcmpOutEchoReps, &icmp_statistics[0].IcmpInEchoReps, icmp_discard, 0, &sysctl_icmp_echoreply_time},
- { &dummy, &icmp_statistics[0].IcmpInErrors, icmp_discard, 1, },
- { &dummy, &icmp_statistics[0].IcmpInErrors, icmp_discard, 1, },
+ { &icmp_statistics[0].dummy, &icmp_statistics[0].IcmpInErrors, icmp_discard, 1, },
+ { &icmp_statistics[0].dummy, &icmp_statistics[0].IcmpInErrors, icmp_discard, 1, },
 /* DEST UNREACH (3) */
  { &icmp_statistics[0].IcmpOutDestUnreachs, &icmp_statistics[0].IcmpInDestUnreachs, icmp_unreach, 1, &sysctl_icmp_destunreach_time },
 /* SOURCE QUENCH (4) */
  { &icmp_statistics[0].IcmpOutSrcQuenchs, &icmp_statistics[0].IcmpInSrcQuenchs, icmp_unreach, 1, },
 /* REDIRECT (5) */
  { &icmp_statistics[0].IcmpOutRedirects, &icmp_statistics[0].IcmpInRedirects, icmp_redirect, 1, },
- { &dummy, &icmp_statistics[0].IcmpInErrors, icmp_discard, 1, },
- { &dummy, &icmp_statistics[0].IcmpInErrors, icmp_discard, 1, },
+ { &icmp_statistics[0].dummy, &icmp_statistics[0].IcmpInErrors, icmp_discard, 1, },
+ { &icmp_statistics[0].dummy, &icmp_statistics[0].IcmpInErrors, icmp_discard, 1, },
 /* ECHO (8) */
  { &icmp_statistics[0].IcmpOutEchos, &icmp_statistics[0].IcmpInEchos, icmp_echo, 0, },
- { &dummy, &icmp_statistics[0].IcmpInErrors, icmp_discard, 1, },
- { &dummy, &icmp_statistics[0].IcmpInErrors, icmp_discard, 1, },
+ { &icmp_statistics[0].dummy, &icmp_statistics[0].IcmpInErrors, icmp_discard, 1, },
+ { &icmp_statistics[0].dummy, &icmp_statistics[0].IcmpInErrors, icmp_discard, 1, },
 /* TIME EXCEEDED (11) */
  { &icmp_statistics[0].IcmpOutTimeExcds, &icmp_statistics[0].IcmpInTimeExcds, icmp_unreach, 1, &sysctl_icmp_timeexceed_time },
 /* PARAMETER PROBLEM (12) */
@@ -977,9 +972,9 @@
 /* TIMESTAMP REPLY (14) */
  { &icmp_statistics[0].IcmpOutTimestampReps, &icmp_statistics[0].IcmpInTimestampReps, icmp_discard, 0, },
 /* INFO (15) */
- { &dummy, &dummy, icmp_discard, 0, },
+ { &icmp_statistics[0].dummy, &icmp_statistics[0].dummy, icmp_discard, 0, },
 /* INFO REPLY (16) */
- { &dummy, &dummy, icmp_discard, 0, },
+ { &icmp_statistics[0].dummy, &icmp_statistics[0].dummy, icmp_discard, 0, },
 /* ADDR MASK (17) */
  { &icmp_statistics[0].IcmpOutAddrMasks, &icmp_statistics[0].IcmpInAddrMasks, icmp_address, 0,  },
 /* ADDR MASK REPLY (18) */
diff -urN linux-2.4.6-pre4/net/ipv6/addrconf.c linux/net/ipv6/addrconf.c
--- linux-2.4.6-pre4/net/ipv6/addrconf.c	Wed May 16 10:31:27 2001
+++ linux/net/ipv6/addrconf.c	Mon Dec  3 22:48:43 2001
@@ -6,7 +6,7 @@
  *	Pedro Roque		<roque@di.fc.ul.pt>	
  *	Alexey Kuznetsov	<kuznet@ms2.inr.ac.ru>
  *
- *	$Id: addrconf.c,v 1.65 2001/05/03 07:02:47 davem Exp $
+ *	$Id: addrconf.c,v 1.66 2001/06/11 00:39:29 davem Exp $
  *
  *	This program is free software; you can redistribute it and/or
  *      modify it under the terms of the GNU General Public License
@@ -1389,7 +1389,10 @@
 	if (ifp->probes++ < ifp->idev->cnf.rtr_solicits) {
 		struct in6_addr all_routers;
 
+		/* The wait after the last probe can be shorter */
 		addrconf_mod_timer(ifp, AC_RS,
+				   (ifp->probes == ifp->idev->cnf.rtr_solicits) ?
+				   ifp->idev->cnf.rtr_solicit_delay :
 				   ifp->idev->cnf.rtr_solicit_interval);
 		spin_unlock(&ifp->lock);
 
diff -urN linux-2.4.6-pre4/net/ipv6/af_inet6.c linux/net/ipv6/af_inet6.c
--- linux-2.4.6-pre4/net/ipv6/af_inet6.c	Thu Apr 12 12:11:39 2001
+++ linux/net/ipv6/af_inet6.c	Mon Dec  3 22:48:43 2001
@@ -7,9 +7,10 @@
  *
  *	Adapted from linux/net/ipv4/af_inet.c
  *
- *	$Id: af_inet6.c,v 1.63 2001/03/02 03:13:05 davem Exp $
+ *	$Id: af_inet6.c,v 1.64 2001/06/13 16:25:03 davem Exp $
  *
  * 	Fixes:
+ *	piggy, Karl Knutson	:	Socket protocol table
  * 	Hideaki YOSHIFUJI	:	sin6_scope_id support
  * 	Arnaldo Melo		: 	check proc_net_create return, cleanups
  *
@@ -44,6 +45,7 @@
 #include <linux/inet.h>
 #include <linux/netdevice.h>
 #include <linux/icmpv6.h>
+#include <linux/brlock.h>
 #include <linux/smp_lock.h>
 
 #include <net/ip.h>
@@ -71,9 +73,6 @@
 MODULE_PARM(unloadable, "i");
 #endif
 
-extern struct proto_ops inet6_stream_ops;
-extern struct proto_ops inet6_dgram_ops;
-
 /* IPv6 procfs goodies... */
 
 #ifdef CONFIG_PROC_FS
@@ -93,6 +92,11 @@
 atomic_t inet6_sock_nr;
 #endif
 
+/* The inetsw table contains everything that inet_create needs to
+ * build a new socket.
+ */
+struct list_head inetsw6[SOCK_MAX];
+
 static void inet6_sock_destruct(struct sock *sk)
 {
 	inet_sock_destruct(sk);
@@ -106,47 +110,63 @@
 static int inet6_create(struct socket *sock, int protocol)
 {
 	struct sock *sk;
-	struct proto *prot;
+	struct list_head *p;
+	struct inet_protosw *answer;
 
 	sk = sk_alloc(PF_INET6, GFP_KERNEL, 1);
 	if (sk == NULL) 
 		goto do_oom;
 
-	if(sock->type == SOCK_STREAM || sock->type == SOCK_SEQPACKET) {
-		if (protocol && protocol != IPPROTO_TCP) 
-			goto free_and_noproto;
-		protocol = IPPROTO_TCP;
-		prot = &tcpv6_prot;
-		sock->ops = &inet6_stream_ops;
-	} else if(sock->type == SOCK_DGRAM) {
-		if (protocol && protocol != IPPROTO_UDP) 
-			goto free_and_noproto;
-		protocol = IPPROTO_UDP;
-		sk->no_check = UDP_CSUM_DEFAULT;
-		prot=&udpv6_prot;
-		sock->ops = &inet6_dgram_ops;
-	} else if(sock->type == SOCK_RAW) {
-		if (!capable(CAP_NET_RAW))
-			goto free_and_badperm;
-		if (!protocol) 
-			goto free_and_noproto;
-		prot = &rawv6_prot;
-		sock->ops = &inet6_dgram_ops;
+	/* Look for the requested type/protocol pair. */
+	answer = NULL;
+	br_read_lock_bh(BR_NETPROTO_LOCK);
+	list_for_each(p, &inetsw6[sock->type]) {
+		answer = list_entry(p, struct inet_protosw, list);
+
+		/* Check the non-wild match. */
+		if (protocol == answer->protocol) {
+			if (protocol != IPPROTO_IP)
+				break;
+		} else {
+			/* Check for the two wild cases. */
+			if (IPPROTO_IP == protocol) {
+				protocol = answer->protocol;
+				break;
+			}
+			if (IPPROTO_IP == answer->protocol)
+				break;
+		}
+		answer = NULL;
+	}
+	br_read_unlock_bh(BR_NETPROTO_LOCK);
+
+	if (!answer)
+		goto free_and_badtype;
+	if (answer->capability > 0 && !capable(answer->capability))
+		goto free_and_badperm;
+	if (!protocol)
+		goto free_and_noproto;
+
+	sock->ops = answer->ops;
+	sock_init_data(sock, sk);
+
+	sk->prot = answer->prot;
+	sk->no_check = answer->no_check;
+	if (INET_PROTOSW_REUSE & answer->flags)
 		sk->reuse = 1;
+
+	if (SOCK_RAW == sock->type) {
 		sk->num = protocol;
-	} else {
-		goto free_and_badtype;
+		if (IPPROTO_RAW == protocol)
+			sk->protinfo.af_inet.hdrincl = 1;
 	}
-	
-	sock_init_data(sock, sk);
 
 	sk->destruct            = inet6_sock_destruct;
 	sk->zapped		= 0;
 	sk->family		= PF_INET6;
 	sk->protocol		= protocol;
 
-	sk->prot		= prot;
-	sk->backlog_rcv		= prot->backlog_rcv;
+	sk->backlog_rcv		= answer->prot->backlog_rcv;
 
 	sk->net_pinfo.af_inet6.hop_limit  = -1;
 	sk->net_pinfo.af_inet6.mcast_hops = -1;
@@ -175,9 +195,6 @@
 #endif
 	MOD_INC_USE_COUNT;
 
-	if (sk->type==SOCK_RAW && protocol==IPPROTO_RAW)
-		sk->protinfo.af_inet.hdrincl=1;
-
 	if (sk->num) {
 		/* It assumes that any protocol which allows
 		 * the user to assign a number at socket
@@ -186,16 +203,15 @@
 		sk->sport = ntohs(sk->num);
 		sk->prot->hash(sk);
 	}
-
 	if (sk->prot->init) {
 		int err = sk->prot->init(sk);
 		if (err != 0) {
 			MOD_DEC_USE_COUNT;
 			inet_sock_release(sk);
-			return(err);
+			return err;
 		}
 	}
-	return(0);
+	return 0;
 
 free_and_badtype:
 	sk_free(sk);
@@ -504,9 +520,76 @@
 extern void ipv6_sysctl_unregister(void);
 #endif
 
+static struct inet_protosw rawv6_protosw = {
+	type:        SOCK_RAW,
+	protocol:    IPPROTO_IP,	/* wild card */
+	prot:        &rawv6_prot,
+	ops:         &inet6_dgram_ops,
+	capability:  CAP_NET_RAW,
+	no_check:    UDP_CSUM_DEFAULT,
+	flags:       INET_PROTOSW_REUSE,
+};
+
+#define INETSW6_ARRAY_LEN (sizeof(inetsw6_array) / sizeof(struct inet_protosw))
+
+void
+inet6_register_protosw(struct inet_protosw *p)
+{
+	struct list_head *lh;
+	struct inet_protosw *answer;
+	int protocol = p->protocol;
+
+	br_write_lock_bh(BR_NETPROTO_LOCK);
+
+	if (p->type > SOCK_MAX)
+		goto out_illegal;
+
+	/* If we are trying to override a permanent protocol, bail. */
+	answer = NULL;
+	list_for_each(lh, &inetsw6[p->type]) {
+		answer = list_entry(lh, struct inet_protosw, list);
+
+		/* Check only the non-wild match. */
+		if (protocol == answer->protocol &&
+		    (INET_PROTOSW_PERMANENT & answer->flags))
+			break;
+
+		answer = NULL;
+	}
+	if (answer)
+		goto out_permanent;
+
+	/* Add to the BEGINNING so that we override any existing
+	 * entry.  This means that when we remove this entry, the
+	 * system automatically returns to the old behavior.
+	 */
+	list_add(&p->list, &inetsw6[p->type]);
+out:
+	br_write_unlock_bh(BR_NETPROTO_LOCK);
+	return;
+
+out_permanent:
+	printk(KERN_ERR "Attempt to override permanent protocol %d.\n",
+	       protocol);
+	goto out;
+
+out_illegal:
+	printk(KERN_ERR
+	       "Ignoring attempt to register illegal socket type %d.\n",
+	       p->type);
+	goto out;
+}
+
+void
+inet6_unregister_protosw(struct inet_protosw *p)
+{
+	inet_unregister_protosw(p);
+}
+
 static int __init inet6_init(void)
 {
 	struct sk_buff *dummy_skb;
+        struct list_head *r;
 	int err;
 
 #ifdef MODULE
@@ -523,6 +606,15 @@
 		printk(KERN_CRIT "inet6_proto_init: size fault\n");
 		return -EINVAL;
 	}
+
+	/* Register the socket-side information for inet6_create.  */
+	for(r = &inetsw6[0]; r < &inetsw6[SOCK_MAX]; ++r)
+		INIT_LIST_HEAD(r);
+
+	/* We MUST register RAW sockets before we create the ICMP6,
+	 * IGMP6, or NDISC control sockets.
+	 */
+	inet6_register_protosw(&rawv6_protosw);
 
 	/*
 	 *	ipngwg API draft makes clear that the correct semantics
diff -urN linux-2.4.6-pre4/net/ipv6/exthdrs.c linux/net/ipv6/exthdrs.c
--- linux-2.4.6-pre4/net/ipv6/exthdrs.c	Thu Apr 12 12:11:39 2001
+++ linux/net/ipv6/exthdrs.c	Mon Dec  3 22:48:43 2001
@@ -7,7 +7,7 @@
  *	Andi Kleen		<ak@muc.de>
  *	Alexey Kuznetsov	<kuznet@ms2.inr.ac.ru>
  *
- *	$Id: exthdrs.c,v 1.12 2001/01/22 02:36:37 davem Exp $
+ *	$Id: exthdrs.c,v 1.13 2001/06/19 15:58:56 davem Exp $
  *
  *	This program is free software; you can redistribute it and/or
  *      modify it under the terms of the GNU General Public License
@@ -112,6 +112,7 @@
 	if ((skb->h.raw + len) - skb->data > skb_headlen(skb))
 		goto bad;
 
+	off += 2;
 	len -= 2;
 
 	while (len > 0) {
diff -urN linux-2.4.6-pre4/net/ipv6/icmp.c linux/net/ipv6/icmp.c
--- linux-2.4.6-pre4/net/ipv6/icmp.c	Thu Apr 12 12:11:39 2001
+++ linux/net/ipv6/icmp.c	Mon Dec  3 22:48:43 2001
@@ -5,7 +5,7 @@
  *	Authors:
  *	Pedro Roque		<roque@di.fc.ul.pt>
  *
- *	$Id: icmp.c,v 1.31 2001/01/22 02:36:37 davem Exp $
+ *	$Id: icmp.c,v 1.32 2001/06/10 09:20:07 davem Exp $
  *
  *	Based on net/ipv4/icmp.c
  *
@@ -564,7 +564,7 @@
 		 */
 		if (!pskb_may_pull(skb, sizeof(struct ipv6hdr)))
 			goto discard_it;
-		hdr = (struct icmp6hdr *) skb->data;
+		hdr = (struct icmp6hdr *) skb->h.raw;
 		orig_hdr = (struct ipv6hdr *) (hdr + 1);
 		rt6_pmtu_discovery(&orig_hdr->daddr, &orig_hdr->saddr, dev,
 				   ntohl(hdr->icmp6_mtu));
diff -urN linux-2.4.6-pre4/net/ipv6/tcp_ipv6.c linux/net/ipv6/tcp_ipv6.c
--- linux-2.4.6-pre4/net/ipv6/tcp_ipv6.c	Wed Apr 25 14:57:39 2001
+++ linux/net/ipv6/tcp_ipv6.c	Mon Dec  3 22:48:43 2001
@@ -5,7 +5,7 @@
  *	Authors:
  *	Pedro Roque		<roque@di.fc.ul.pt>	
  *
- *	$Id: tcp_ipv6.c,v 1.136 2001/04/20 20:46:19 davem Exp $
+ *	$Id: tcp_ipv6.c,v 1.137 2001/06/13 16:25:03 davem Exp $
  *
  *	Based on: 
  *	linux/net/ipv4/tcp.c
@@ -2125,8 +2125,21 @@
 	"TCPv6"			/* name			*/
 };
 
+extern struct proto_ops inet6_stream_ops;
+
+static struct inet_protosw tcpv6_protosw = {
+	type:        SOCK_STREAM,
+	protocol:    IPPROTO_TCP,
+	prot:        &tcpv6_prot,
+	ops:         &inet6_stream_ops,
+	capability:  -1,
+	no_check:    0,
+	flags:       INET_PROTOSW_PERMANENT,
+};
+
 void __init tcpv6_init(void)
 {
 	/* register inet6 protocol */
 	inet6_add_protocol(&tcpv6_protocol);
+	inet6_register_protosw(&tcpv6_protosw);
 }
diff -urN linux-2.4.6-pre4/net/ipv6/udp.c linux/net/ipv6/udp.c
--- linux-2.4.6-pre4/net/ipv6/udp.c	Thu Apr 12 12:11:39 2001
+++ linux/net/ipv6/udp.c	Mon Dec  3 22:48:43 2001
@@ -7,7 +7,7 @@
  *
  *	Based on linux/ipv4/udp.c
  *
- *	$Id: udp.c,v 1.62 2001/03/06 21:15:11 davem Exp $
+ *	$Id: udp.c,v 1.63 2001/06/13 16:25:03 davem Exp $
  *
  *	Fixes:
  *	Hideaki YOSHIFUJI	:	sin6_scope_id support
@@ -992,7 +992,21 @@
 	get_port:	udp_v6_get_port,
 };
 
+extern struct proto_ops inet6_dgram_ops;
+
+static struct inet_protosw udpv6_protosw = {
+	type:        SOCK_DGRAM,
+	protocol:    IPPROTO_UDP,
+	prot:        &udpv6_prot,
+	ops:         &inet6_dgram_ops,
+	capability:  -1,
+	no_check:    UDP_CSUM_DEFAULT,
+	flags:       INET_PROTOSW_PERMANENT,
+};
+
+
 void __init udpv6_init(void)
 {
 	inet6_add_protocol(&udpv6_protocol);
+	inet6_register_protosw(&udpv6_protosw);
 }
diff -urN linux-2.4.6-pre4/net/netsyms.c linux/net/netsyms.c
--- linux-2.4.6-pre4/net/netsyms.c	Fri Apr 27 14:15:01 2001
+++ linux/net/netsyms.c	Mon Dec  3 22:48:43 2001
@@ -234,6 +234,8 @@
 EXPORT_SYMBOL(inetdev_lock);
 EXPORT_SYMBOL(inet_add_protocol);
 EXPORT_SYMBOL(inet_del_protocol);
+EXPORT_SYMBOL(inet_register_protosw);
+EXPORT_SYMBOL(inet_unregister_protosw);
 EXPORT_SYMBOL(ip_route_output_key);
 EXPORT_SYMBOL(ip_route_input);
 EXPORT_SYMBOL(icmp_send);
diff -urN linux-2.4.6-pre4/net/sunrpc/svc.c linux/net/sunrpc/svc.c
--- linux-2.4.6-pre4/net/sunrpc/svc.c	Wed Jun 21 12:43:37 2000
+++ linux/net/sunrpc/svc.c	Mon Dec  3 22:48:43 2001
@@ -368,7 +368,9 @@
 
 err_bad_prog:
 #ifdef RPC_PARANOIA
-	printk("svc: unknown program %d (me %d)\n", prog, progp->pg_prog);
+	if (prog != 100227 || progp->pg_prog != 100003)
+		printk("svc: unknown program %d (me %d)\n", prog, progp->pg_prog);
+	/* else it is just a Solaris client seeing if ACLs are supported */
 #endif
 	serv->sv_stats->rpcbadfmt++;
 	svc_putlong(resp, rpc_prog_unavail);
diff -urN linux-2.4.6-pre4/scripts/docgen linux/scripts/docgen
--- linux-2.4.6-pre4/scripts/docgen	Tue Mar 14 17:54:42 2000
+++ linux/scripts/docgen	Mon Dec  3 22:48:43 2001
@@ -1,3 +1,10 @@
 #!/bin/sh
-X=`$TOPDIR/scripts/gen-all-syms "$*"`
-$TOPDIR/scripts/docproc $X
+set -e
+if [ -z "$scripts_objtree" ]
+then
+	X=`$TOPDIR/scripts/gen-all-syms "$*"`
+	$TOPDIR/scripts/docproc $X
+else
+	X=`${scripts_objtree}gen-all-syms "$*"`
+	TOPDIR=. ${scripts_objtree}docproc $X
+fi
diff -urN linux-2.4.6-pre4/scripts/docproc.c linux/scripts/docproc.c
--- linux-2.4.6-pre4/scripts/docproc.c	Wed Apr 12 09:47:30 2000
+++ linux/scripts/docproc.c	Mon Dec  3 22:48:43 2001
@@ -18,6 +18,7 @@
 	char type[64];
 	int i;
 	int vp=2;
+	int ret=0;
 	pid_t pid;
 
 
@@ -96,8 +97,8 @@
 			perror("exec scripts/kernel-doc");
 			exit(1);
 		default:
-			waitpid(pid, NULL,0);
+			waitpid(pid, &ret ,0);
 		}
 	}
-	exit(0);
+	exit(ret);
 }
diff -urN linux-2.4.6-pre4/scripts/kernel-doc linux/scripts/kernel-doc
--- linux-2.4.6-pre4/scripts/kernel-doc	Wed Apr 25 16:31:16 2001
+++ linux/scripts/kernel-doc	Mon Dec  3 22:48:43 2001
@@ -22,6 +22,10 @@
 # 	- add perldoc documentation
 # 	- Look more closely at some of the scarier bits :)
 
+# 26/05/2001 - 	Support for separate source and object trees.
+#		Return error code.
+# 		Keith Owens <kaos@ocs.com.au>
+
 #
 # This will read a 'c' file and scan for embedded comments in the
 # style of gnome comments (+minor extensions - see below).
@@ -97,6 +101,8 @@
 # '@parameter' - name of a parameter
 # '%CONST' - name of a constant.
 
+my $errors = 0;
+
 # match expressions used to find embedded type information
 my $type_constant = '\%([-_\w]+)';
 my $type_func = '(\w+)\(\)';
@@ -198,6 +204,7 @@
 my @parameterlist = ();
 my %sections = ();
 my @sectionlist = ();
+my %source_map = ();
 
 my $contents = "";
 my $section_default = "Description";	# default section
@@ -776,6 +783,7 @@
             if (defined $type && $type && !defined $parameters{$param}) {
 	        $parameters{$param} = "-- undescribed --";
 	        print STDERR "Warning($file:$.): Function parameter '$param' not described in '$function_name'\n";
+		++$errors;
 	    }
 
 	    push @parameterlist, $param;
@@ -784,6 +792,7 @@
 	}
     } else {
 	print STDERR "Error($.): cannot understand prototype: '$prototype'\n";
+	++$errors;
 	return;
     }
 
@@ -837,6 +846,19 @@
 
 sub process_file($);
 
+# Read the file that maps relative names to absolute names for
+# separate source and object directories and for shadow trees.
+if (open(SOURCE_MAP, "<.tmp_filelist.txt")) {
+	my ($relname, $absname);
+	while(<SOURCE_MAP>) {
+		chop();
+		($relname, $absname) = (split())[0..1];
+		$relname =~ s:^/+::;
+		$source_map{$relname} = $absname;
+	}
+	close(SOURCE_MAP);
+}
+
 if ($filelist) {
 	open(FLIST,"<$filelist") or die "Can't open file list $filelist";
 	while(<FLIST>) {
@@ -850,11 +872,17 @@
     process_file($_);
 }
 
+exit($errors);
+
 sub process_file($) {
     my ($file) = @_;
+    if (defined($source_map{$file})) {
+	$file = $source_map{$file};
+    }
 
     if (!open(IN,"<$file")) {
 	print STDERR "Error: Cannot open file $file\n";
+	++$errors;
 	return;
     }
 
@@ -887,6 +915,7 @@
 	    } else {
 		print STDERR "WARN($.): Cannot understand $_ on line $.",
 		" - I thought it was a doc line\n";
+		++$errors;
 		$state = 0;
 	    }
 	} elsif ($state == 2) {	# look for head: lines, and include content
@@ -937,6 +966,7 @@
 	    } else {
 		# i dont know - bad line?  ignore.
 		print STDERR "WARNING($.): bad line: $_"; 
+		++$errors;
 	    }
 	} elsif ($state == 3) {	# scanning for function { (end of prototype)
 	    if (m#\s*/\*\s+MACDOC\s*#io) {
