]> git.neil.brown.name Git - history.git/commitdiff
- Kai Germaschewski: ISDN update (including Makefiles) 2.4.0-test13pre2
authorLinus Torvalds <torvalds@linuxfoundation.org>
Fri, 23 Nov 2007 20:40:52 +0000 (15:40 -0500)
committerLinus Torvalds <torvalds@linuxfoundation.org>
Fri, 23 Nov 2007 20:40:52 +0000 (15:40 -0500)
- Jens Axboe: cdrom updates
- Petr Vandrovec; Matrox G450 support
- Bill Nottingham: fix FAT32 filesystems on 64-bit platforms
- David Miller: sparc (and other) Makefile fixup
- Andrea Arkangeli: alpha SMP TLB context fix (and cleanups)
- Niels Kristian Bech Jensen: checkconfig, USB warnings
- Andrew Grover: large ACPI update

301 files changed:
Documentation/Changes
Documentation/Configure.help
Documentation/parport.txt
Makefile
Rules.make
arch/alpha/kernel/Makefile
arch/alpha/kernel/smp.c
arch/alpha/mm/fault.c
arch/i386/Makefile
arch/i386/config.in
arch/i386/kernel/Makefile
arch/i386/kernel/acpi.c
arch/i386/kernel/bluesmoke.c
arch/i386/kernel/dmi_scan.c
arch/i386/kernel/ldt.c
arch/i386/kernel/process.c
arch/i386/kernel/smpboot.c
arch/sparc/Makefile
arch/sparc/kernel/Makefile
arch/sparc/lib/Makefile
arch/sparc/math-emu/Makefile
arch/sparc/mm/Makefile
arch/sparc/prom/Makefile
arch/sparc64/Makefile
arch/sparc64/kernel/Makefile
arch/sparc64/kernel/pci.c
arch/sparc64/kernel/sys_sparc32.c
arch/sparc64/lib/Makefile
arch/sparc64/math-emu/Makefile
arch/sparc64/mm/Makefile
arch/sparc64/prom/Makefile
arch/sparc64/solaris/Makefile
arch/sparc64/solaris/misc.c
drivers/Makefile
drivers/acpi/Makefile
drivers/acpi/cmbatt.c [new file with mode: 0644]
drivers/acpi/common/Makefile
drivers/acpi/common/cmalloc.c
drivers/acpi/common/cmclib.c
drivers/acpi/common/cmcopy.c
drivers/acpi/common/cmdebug.c
drivers/acpi/common/cmdelete.c
drivers/acpi/common/cmeval.c
drivers/acpi/common/cmglobal.c
drivers/acpi/common/cminit.c
drivers/acpi/common/cmobject.c
drivers/acpi/common/cmutils.c
drivers/acpi/common/cmxface.c
drivers/acpi/cpu.c
drivers/acpi/dispatcher/Makefile
drivers/acpi/dispatcher/dsmethod.c
drivers/acpi/dispatcher/dsmthdat.c
drivers/acpi/dispatcher/dsobject.c
drivers/acpi/dispatcher/dsopcode.c
drivers/acpi/dispatcher/dsutils.c
drivers/acpi/dispatcher/dswexec.c
drivers/acpi/dispatcher/dswload.c
drivers/acpi/dispatcher/dswscope.c
drivers/acpi/dispatcher/dswstate.c
drivers/acpi/driver.c
drivers/acpi/driver.h
drivers/acpi/ec.c
drivers/acpi/events/Makefile
drivers/acpi/events/evevent.c
drivers/acpi/events/evmisc.c
drivers/acpi/events/evregion.c
drivers/acpi/events/evrgnini.c
drivers/acpi/events/evsci.c
drivers/acpi/events/evxface.c
drivers/acpi/events/evxfevnt.c
drivers/acpi/events/evxfregn.c
drivers/acpi/hardware/Makefile
drivers/acpi/hardware/hwacpi.c
drivers/acpi/hardware/hwcpu32.c
drivers/acpi/hardware/hwgpe.c
drivers/acpi/hardware/hwregs.c
drivers/acpi/hardware/hwxface.c
drivers/acpi/include/accommon.h
drivers/acpi/include/acconfig.h
drivers/acpi/include/acdebug.h
drivers/acpi/include/acdispat.h
drivers/acpi/include/acenv.h
drivers/acpi/include/acevents.h
drivers/acpi/include/acexcep.h
drivers/acpi/include/acgcc.h [new file with mode: 0644]
drivers/acpi/include/acglobal.h
drivers/acpi/include/achware.h
drivers/acpi/include/acinterp.h
drivers/acpi/include/aclinux.h [new file with mode: 0644]
drivers/acpi/include/aclocal.h
drivers/acpi/include/acmacros.h
drivers/acpi/include/acnamesp.h
drivers/acpi/include/acobject.h
drivers/acpi/include/acoutput.h
drivers/acpi/include/acparser.h
drivers/acpi/include/acpiosxf.h
drivers/acpi/include/acpixf.h
drivers/acpi/include/actables.h
drivers/acpi/include/actbl.h
drivers/acpi/include/actbl1.h [new file with mode: 0644]
drivers/acpi/include/actbl2.h [new file with mode: 0644]
drivers/acpi/include/actbl32.h [deleted file]
drivers/acpi/include/actbl64.h [deleted file]
drivers/acpi/include/actbl71.h [new file with mode: 0644]
drivers/acpi/include/actypes.h
drivers/acpi/include/amlcode.h
drivers/acpi/interpreter/Makefile
drivers/acpi/interpreter/amconfig.c
drivers/acpi/interpreter/amcreate.c
drivers/acpi/interpreter/amdump.c [deleted file]
drivers/acpi/interpreter/amdyadic.c
drivers/acpi/interpreter/amfield.c
drivers/acpi/interpreter/amfldio.c
drivers/acpi/interpreter/ammisc.c
drivers/acpi/interpreter/ammonad.c
drivers/acpi/interpreter/amnames.c
drivers/acpi/interpreter/amprep.c
drivers/acpi/interpreter/amregion.c
drivers/acpi/interpreter/amresnte.c
drivers/acpi/interpreter/amresolv.c
drivers/acpi/interpreter/amresop.c
drivers/acpi/interpreter/amstore.c
drivers/acpi/interpreter/amstoren.c
drivers/acpi/interpreter/amstorob.c
drivers/acpi/interpreter/amsystem.c
drivers/acpi/interpreter/amutils.c
drivers/acpi/ksyms.c [new file with mode: 0644]
drivers/acpi/namespace/Makefile
drivers/acpi/namespace/nsaccess.c
drivers/acpi/namespace/nsalloc.c
drivers/acpi/namespace/nsdump.c [deleted file]
drivers/acpi/namespace/nseval.c
drivers/acpi/namespace/nsinit.c [new file with mode: 0644]
drivers/acpi/namespace/nsload.c
drivers/acpi/namespace/nsnames.c
drivers/acpi/namespace/nsobject.c
drivers/acpi/namespace/nssearch.c
drivers/acpi/namespace/nsutils.c
drivers/acpi/namespace/nsxfname.c
drivers/acpi/namespace/nsxfobj.c
drivers/acpi/os.c
drivers/acpi/parser/Makefile
drivers/acpi/parser/psargs.c
drivers/acpi/parser/psfind.c [deleted file]
drivers/acpi/parser/psopcode.c
drivers/acpi/parser/psparse.c
drivers/acpi/parser/psscope.c
drivers/acpi/parser/pstree.c
drivers/acpi/parser/psutils.c
drivers/acpi/parser/pswalk.c
drivers/acpi/parser/psxface.c
drivers/acpi/resources/Makefile
drivers/acpi/resources/rsaddr.c
drivers/acpi/resources/rscalc.c
drivers/acpi/resources/rscreate.c
drivers/acpi/resources/rsdump.c
drivers/acpi/resources/rsio.c
drivers/acpi/resources/rsirq.c
drivers/acpi/resources/rslist.c
drivers/acpi/resources/rsmemory.c
drivers/acpi/resources/rsmisc.c
drivers/acpi/resources/rsutils.c
drivers/acpi/resources/rsxface.c
drivers/acpi/sys.c
drivers/acpi/table.c
drivers/acpi/tables/Makefile
drivers/acpi/tables/tbconvrt.c [new file with mode: 0644]
drivers/acpi/tables/tbget.c
drivers/acpi/tables/tbinstal.c
drivers/acpi/tables/tbtable.c [deleted file]
drivers/acpi/tables/tbutils.c
drivers/acpi/tables/tbxface.c
drivers/acpi/tables/tbxfroot.c [new file with mode: 0644]
drivers/atm/Makefile
drivers/cdrom/cdrom.c
drivers/char/Makefile
drivers/char/drm/Makefile
drivers/char/ftape/Makefile
drivers/char/ftape/compressor/Makefile
drivers/char/ftape/lowlevel/Makefile
drivers/char/ftape/zftape/Makefile
drivers/char/joystick/Makefile
drivers/fc4/Makefile
drivers/i2c/Makefile
drivers/i2o/Makefile
drivers/ide/ide-cd.c
drivers/ide/ide-cd.h
drivers/ieee1394/Makefile
drivers/input/Makefile
drivers/isdn/Config.in
drivers/isdn/Makefile
drivers/isdn/act2000/Makefile
drivers/isdn/avmb1/Makefile
drivers/isdn/avmb1/b1capi.c [deleted file]
drivers/isdn/avmb1/b1lli.c [deleted file]
drivers/isdn/avmb1/capi.c
drivers/isdn/avmb1/kcapi.c
drivers/isdn/divert/Makefile
drivers/isdn/eicon/Makefile
drivers/isdn/hisax/Makefile
drivers/isdn/hisax/config.c
drivers/isdn/hisax/foreign.c [deleted file]
drivers/isdn/hisax/foreign.h [deleted file]
drivers/isdn/hisax/hfc_pci.c
drivers/isdn/hisax/hisax.h
drivers/isdn/hisax/isdnl1.c
drivers/isdn/hisax/l3ni1.c
drivers/isdn/hisax/netjet.c
drivers/isdn/hysdn/Makefile
drivers/isdn/hysdn/boardergo.c
drivers/isdn/icn/Makefile
drivers/isdn/isdn_net.c
drivers/isdn/isdnloop/Makefile
drivers/isdn/pcbit/Makefile
drivers/isdn/pcbit/drv.c
drivers/isdn/sc/Makefile
drivers/macintosh/Makefile
drivers/md/Makefile
drivers/md/raid5.c
drivers/media/Makefile
drivers/media/radio/Makefile
drivers/media/video/Makefile
drivers/mtd/Makefile
drivers/mtd/docprobe.c
drivers/mtd/mtdblock.c
drivers/mtd/mtdchar.c
drivers/mtd/nftlmount.c
drivers/nubus/Makefile
drivers/parport/parport_gsc.c
drivers/pcmcia/Makefile
drivers/pnp/Makefile
drivers/sbus/Makefile
drivers/sbus/audio/Makefile
drivers/sbus/audio/dmy.c
drivers/sbus/char/Makefile
drivers/scsi/sr.c
drivers/scsi/sr.h
drivers/scsi/sr_ioctl.c
drivers/scsi/sr_vendor.c
drivers/telephony/Makefile
drivers/usb/storage/scsiglue.c
drivers/usb/storage/usb.c
drivers/video/Config.in
drivers/video/Makefile
drivers/video/matrox/Makefile
drivers/video/matrox/matroxfb_DAC1064.c
drivers/video/matrox/matroxfb_DAC1064.h
drivers/video/matrox/matroxfb_base.c
drivers/video/matrox/matroxfb_base.h
drivers/video/matrox/matroxfb_crtc2.c
drivers/video/matrox/matroxfb_g450.c [new file with mode: 0644]
drivers/video/matrox/matroxfb_g450.h [new file with mode: 0644]
fs/exec.c
fs/fat/cache.c
include/asm-alpha/mmu.h [new file with mode: 0644]
include/asm-alpha/mmu_context.h
include/asm-alpha/pgalloc.h
include/asm-alpha/processor.h
include/asm-alpha/processor.h.lock~ [new file with mode: 0644]
include/asm-alpha/smp.h
include/asm-alpha/system.h
include/asm-arm/mmu.h [new file with mode: 0644]
include/asm-arm/processor.h
include/asm-i386/desc.h
include/asm-i386/mmu.h [new file with mode: 0644]
include/asm-i386/mmu_context.h
include/asm-i386/processor.h
include/asm-ia64/mmu.h [new file with mode: 0644]
include/asm-ia64/processor.h
include/asm-m68k/mmu.h [new file with mode: 0644]
include/asm-m68k/processor.h
include/asm-mips/mmu.h [new file with mode: 0644]
include/asm-mips/processor.h
include/asm-mips64/mmu.h [new file with mode: 0644]
include/asm-mips64/processor.h
include/asm-parisc/mmu.h
include/asm-parisc/processor.h
include/asm-ppc/mmu.h
include/asm-ppc/processor.h
include/asm-s390/mmu.h [new file with mode: 0644]
include/asm-s390/processor.h
include/asm-sh/mmu.h [new file with mode: 0644]
include/asm-sh/processor.h
include/asm-sparc/mmu.h [new file with mode: 0644]
include/asm-sparc/processor.h
include/asm-sparc64/mmu.h [new file with mode: 0644]
include/asm-sparc64/processor.h
include/linux/acpi.h
include/linux/cdrom.h
include/linux/mtd/map.h
include/linux/mtd/mtd.h
include/linux/nfs_page.h
include/linux/pci_ids.h
include/linux/sched.h
kernel/Makefile
kernel/exit.c
kernel/fork.c
mm/mmap.c
net/802/transit/Makefile
net/Makefile
net/ipv6/netfilter/Makefile

index ed3bfb6024eb9eb27c3b727ed40b64f7582069f2..76cb01f77036823d816169c280b7f50629eee86e 100644 (file)
@@ -51,7 +51,7 @@ with pcmcia-cs.
 o  Gnu C                  2.91.66                 # gcc --version
 o  Gnu make               3.77                    # make --version
 o  binutils               2.9.1.0.25              # ld -v
-o  util-linux             2.10o                   # kbdrate -v
+o  util-linux             2.10o                   # fdformat --version
 o  modutils               2.3.18                  # insmod -V
 o  e2fsprogs              1.19                    # tune2fs --version
 o  pcmcia-cs              3.1.21                  # cardmgr -V
index 7ac3fdd28fda31b799f5802d1f23555cc31cceb6..60ff8b1d2e8ba8f163d39bbf5f68db541da7b8a3 100644 (file)
@@ -3210,9 +3210,9 @@ Matrox unified accelerated driver (EXPERIMENTAL)
 CONFIG_FB_MATROX
   Say Y here if you have a Matrox Millennium, Matrox Millennium II,
   Matrox Mystique, Matrox Mystique 220, Matrox Productiva G100, Matrox
-  Mystique G200, Matrox Millennium G200, Matrox Marvel G200 video or
-  Matrox G400 card in your box. At this time, support for the G100,
-  Mystique G200 and Marvel G200 is untested.
+  Mystique G200, Matrox Millennium G200, Matrox Marvel G200 video,
+  Matrox G400 or G450 card in your box. At this time, support for the G100
+  is untested and support for G450 is highly experimental.
 
   This driver is also available as a module ( = code which can be
   inserted and removed from the running kernel whenever you want).
@@ -3241,13 +3241,13 @@ CONFIG_FB_MATROX_MYSTIQUE
   packed pixel and 32 bpp packed pixel. You can also use font widths
   different from 8.
 
-Matrox G100/G200/G400 support
+Matrox G100/G200/G400/G450 support
 CONFIG_FB_MATROX_G100
-  Say Y here if you have a Matrox Productiva G100, Matrox Mystique
-  G200, Matrox Marvel G200 or Matrox Millennium G200 video card. If
-  you select "Advanced lowlevel driver options", you should check 8
-  bpp packed pixel, 16 bpp packed pixel, 24 bpp packed pixel and 32
-  bpp packed pixel. You can also use font widths different from 8.
+  Say Y here if you have a Matrox G100, G200, G400 or G450 based
+  video card. If you select "Advanced lowlevel driver options", you 
+  should check 8 bpp packed pixel, 16 bpp packed pixel, 24 bpp packed 
+  pixel and 32 bpp packed pixel. You can also use font widths 
+  different from 8.
 
   If you need support for G400 secondary head, you must first say Y to
   "I2C support" and "I2C bit-banging support" in the character devices
@@ -3270,6 +3270,8 @@ CONFIG_FB_MATROX_I2C
   
 Matrox G400 second head support
 CONFIG_FB_MATROX_MAVEN
+  WARNING !!! This support does not work with G450 !!!
+
   Say Y or M here if you want to use a secondary head (meaning two
   monitors in parallel) on G400 or MGA-TVO add-on on G200. Secondary
   head is not compatible with accelerated XFree 3.3.x SVGA servers -
@@ -3297,6 +3299,30 @@ CONFIG_FB_MATROX_MAVEN
   There is no need for enabling 'Matrox multihead support' if you have
   only one Matrox card in the box.
 
+Matrox G450 second head support
+CONFIG_FB_MATROX_G450
+  Say Y or M here if you want to use a secondary head (meaning two
+  monitors in parallel) on G450.
+
+  If you compile it as module, two modules are created,
+  matroxfb_crtc2.o and matroxfb_g450.o. Both modules are needed if you
+  want two independent display devices.
+
+  The driver starts in monitor mode and currently does not support
+  output in TV modes. You must use the matroxset tool (available
+  at ftp://platan.vc.cvut.cz/pub/linux/matrox-latest) to swap primary
+  and secondary head outputs. Secondary head driver always start in
+  640x480 resolution and you must use fbset to change it.
+
+  Also do not forget that second head supports only 16 and 32 bpp
+  packed pixels, so it is a good idea to compile them into the kernel
+  too. You can use only some font widths, as the driver uses generic
+  painting procedures (the secondary head does not use acceleration
+  engine).
+
+  There is no need for enabling 'Matrox multihead support' if you have
+  only one Matrox card in the box.
+
 Matrox unified driver multihead support
 CONFIG_FB_MATROX_MULTIHEAD
   Say Y here if you have more than one (supported) Matrox device in
@@ -3548,6 +3574,30 @@ CONFIG_PARPORT_OTHER
   other non-standard types of parallel ports. This causes a
   performance loss, so most people say N.
 
+Sun Ultra/AX-style hardware 
+CONFIG_PARPORT_AX
+  Say Y here if you need support for the parallel port hardware on Sun
+  Ultra/AX machines. This code is also available as a module (say M),
+  called parport_ax.o. If in doubt, saying N is the safe plan.
+
+Amiga built-in parallel port support
+CONFIG_PARPORT_AMIGA
+  Say Y here if you need support for the parallel port hardware on
+  Amiga machines. This code is also available as a module (say M),
+  called parport_amiga.o. If in doubt, saying N is the safe plan.
+
+Atari built-in parallel port support
+CONFIG_PARPORT_ATARI
+  Say Y here if you need support for the parallel port hardware on
+  Atari machines. This code is also available as a module (say M),
+  called parport_atari.o. If in doubt, saying N is the safe plan.
+
+Multiface 3 parallel port card support
+CONFIG_PARPORT_MFC3
+  Say Y here if you need parallel port support for the MFC3 card.
+  This code is also available as a module (say M), called
+  parport_mfc3.o. If in doubt, saying N is the safe plan.
+
 Support IEEE1284 status readback
 CONFIG_PRINTER_READBACK
   If you have a device on your parallel port that support this
@@ -13140,40 +13190,35 @@ CONFIG_PM
   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
-  The Advanced Configuration and Power Interface is a standard
-  designed to allow the operating system more control over power
-  management issues, such as suspending a computer in a low power
-  consumption state after a certain time of inaction. It aims to be
-  an improved version of APM (see below). ACPI has to be
-  supported by the motherboard. You can read more about the standard
-  at http://www.teleport.com/~acpi/ . 
-
-  If your computer supports ACPI and you want to use it, say Y here.
-  You will then need supporting software; for location and more
-  information, please read Documentation/pm.txt and the Battery
-  Powered Linux mini-HOWTO, available from
-  http://www.linuxdoc.org/docs.html#howto .
-
-  If you say Y here and also to "Advanced Power Management" (APM)
-  below, then ACPI has precedence in the sense that, if your hardware
-  supports ACPI, it will be used and APM won't.
-
-ACPI interpreter (EXPERIMENTAL)
-CONFIG_ACPI_INTERPRETER
-  If you say Y here, an ACPI interpreter will be included in your
-  kernel, eventually making the full range of ACPI features
-  available on systems that support ACPI.  Note, this option will
-  enlarge your kernel by about 120K.
-
-  The interpreter is currently experimental so only say Y if
-  you know what you are doing.
-
-Enter S1 for sleep (EXPERIMENTAL)
-CONFIG_ACPI_S1_SLEEP
-  If you say Y here, ACPI compliant devices can enter level 1 of ACPI
-  saving power levels. Basically, this will let them enter sleep mode.
+  ACPI/OSPM support for Linux is currently under development. As such, 
+  this support is preliminary and EXPERIMENTAL. Configuring ACPI support
+  enables kernel interfaces that allow higher level software (OSPM) to
+  manipulate ACPI defined hardware and software interfaces, including
+  the evaluation of ACPI control methods. If unsure, choose N here.
+  Note, this option will enlarge your kernel by about 120K.
+
+  This support requires an ACPI compliant platform (hardware/firmware).
+  If both ACPI and Advanced Power Management (APM) support are
+  configured, ACPI is used.
+
+  This code DOES NOT currently provide a complete OSPM implementation --
+  it has not yet reached APM's level of functionality. When fully
+  implemented, Linux ACPI/OSPM will provide a more robust functional
+  replacement for legacy configuration and power management interfaces,
+  including the Plug-and-Play BIOS specification (PNP BIOS), the Multi-
+  Processor Specification (MPS), and the Advanced Power Management 
+  specification (APM).
+
+  Linux support for ACPI/OSPM is based on Intel Corporation's ACPI
+  Component Architecture (ACPI CA). The latest ACPI CA source code,
+  documentation, debug builds, and implementation status information
+  can be downloaded from:
+  http://developer.intel.com/technology/iapc/acpi/downloads.htm
+  
+  The ACPI mailing list may also be of interest:
+  http://phobos.fs.tum.de/acpi/index.html
 
 Advanced Power Management BIOS support
 CONFIG_APM
index 59e75b5faeb35eeaf6a20b864ba66ec0af97d7a6..27c6d1c4069086e4cefeb4583e2ad6f8f534e61f 100644 (file)
@@ -219,6 +219,46 @@ Also:
 
  * IRQ autoprobing works only for a few port types at the moment.
 
+Reporting printer problems with parport
+=======================================
+
+If you are having problems printing, please go through these steps to
+try to narrow down where the problem area is.
+
+When reporting problems with parport, really you need to give all of
+the messages that parport_pc spits out when it initialises.  There are
+several code paths:
+
+o polling
+o interrupt-driven, protocol in software
+o interrupt-driven, protocol in hardware using PIO
+o interrupt-driven, protocol in hardware using DMA
+
+The kernel messages that parport_pc logs give an indication of which
+code path is being used. (They could be a lot better actually..)
+
+For normal printer protocol, having IEEE 1284 modes enabled or not
+should not make a difference.
+
+To turn off the 'protocol in hardware' code paths, disable
+CONFIG_PARPORT_PC_FIFO.  Note that when they are enabled they are not
+necessarily _used_; it depends on whether the hardware is available,
+enabled by the BIOS, and detected by the driver.
+
+So, to start with, disable CONFIG_PARPORT_PC_FIFO, and load parport_pc
+with 'irq=none'. See if printing works then.  It really should,
+because this is the simplest code path.
+
+If that works fine, try with 'io=0x378 irq=7' (adjust for your
+hardware), to make it use interrupt-driven in-software protocol.
+
+If _that_ works fine, then one of the hardware modes isn't working
+right.  Enable CONFIG_PARPORT_PC_FIFO (no, it isn't a module option,
+and yes, it should be), set the port to ECP mode in the BIOS and note
+the DMA channel, and try with:
+
+    io=0x378 irq=7 dma=none (for PIO)
+    io=0x378 irq=7 dma=3 (for DMA)
 --
 Philip.Blundell@pobox.com
 tim@cyberelk.demon.co.uk
index dcf976d50666a1e6c5bfb91cfb776d1b0816bc37..4be096ba4125fa02630780d99d56b95094bc2521 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
 VERSION = 2
 PATCHLEVEL = 4
 SUBLEVEL = 0
-EXTRAVERSION = -test12
+EXTRAVERSION = -test13-pre2
 
 KERNELRELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
 
@@ -175,7 +175,7 @@ DRIVERS-$(CONFIG_I2O) += drivers/i2o/i2o.o
 DRIVERS-$(CONFIG_IRDA) += drivers/net/irda/irda.o
 DRIVERS-$(CONFIG_I2C) += drivers/i2c/i2c.o
 DRIVERS-$(CONFIG_PHONE) += drivers/telephony/telephony.o
-DRIVERS-$(CONFIG_ACPI_INTERPRETER) += drivers/acpi/acpi.o
+DRIVERS-$(CONFIG_ACPI) += drivers/acpi/acpi.o
 DRIVERS-$(CONFIG_MD) += drivers/md/mddev.o
 
 DRIVERS += $(DRIVERS-y)
index 192709a617bc1602f62b07cc614b54a9c5dc33db..3093254217ea7f0b08f9d802914c8d706fb54800 100644 (file)
@@ -19,9 +19,6 @@ unexport SUB_DIRS
 unexport ALL_SUB_DIRS
 unexport MOD_SUB_DIRS
 unexport O_TARGET
-unexport O_OBJS
-unexport L_OBJS
-unexport M_OBJS
 unexport ALL_MOBJS
 
 unexport obj-y
@@ -40,6 +37,7 @@ unexport subdir-
 first_rule: sub_dirs
        $(MAKE) all_targets
 
+both-m          := $(filter $(mod-subdirs), $(subdir-y))
 SUB_DIRS       := $(subdir-y)
 MOD_SUB_DIRS   := $(sort $(subdir-m) $(both-m))
 ALL_SUB_DIRS   := $(sort $(subdir-y) $(subdir-m) $(subdir-n) $(subdir-))
@@ -112,7 +110,7 @@ endif # O_TARGET
 ifdef L_TARGET
 $(L_TARGET): $(obj-y)
        rm -f $@
-       $(AR) $(EXTRA_ARFLAGS) rcs $@ $(LX_OBJS) $(obj-y)
+       $(AR) $(EXTRA_ARFLAGS) rcs $@ $(obj-y)
        @ ( \
            echo 'ifeq ($(strip $(subst $(comma),:,$(EXTRA_ARFLAGS) $(obj-y))),$$(strip $$(subst $$(comma),:,$$(EXTRA_ARFLAGS) $$(obj-y))))' ; \
            echo 'FILES_FLAGS_UP_TO_DATE += $@' ; \
@@ -139,10 +137,11 @@ endif
 #
 # A rule to make subdirectories
 #
-sub_dirs: dummy $(patsubst %,_subdir_%,$(SUB_DIRS))
+subdir-list = $(sort $(patsubst %,_subdir_%,$(SUB_DIRS)))
+sub_dirs: dummy $(subdir-list)
 
 ifdef SUB_DIRS
-$(patsubst %,_subdir_%,$(SUB_DIRS)) : dummy
+$(subdir-list) : dummy
        $(MAKE) -C $(patsubst _subdir_%,%,$@)
 endif
 
@@ -194,7 +193,6 @@ script:
 
 #
 # This sets version suffixes on exported symbols
-# Uses SYMTAB_OBJS
 # Separate the object into "normal" objects and "exporting" objects
 # Exporting objects are: all objects that define symbol tables
 #
@@ -203,10 +201,9 @@ ifdef CONFIG_MODULES
 multi-used     := $(filter $(list-multi), $(obj-y) $(obj-m))
 multi-objs     := $(foreach m, $(multi-used), $($(basename $(m))-objs))
 active-objs    := $(sort $(multi-objs) $(obj-y) $(obj-m))
-SYMTAB_OBJS    := $(filter $(export-objs), $(active-objs))
 
 ifdef CONFIG_MODVERSIONS
-ifneq "$(strip $(SYMTAB_OBJS))" ""
+ifneq "$(strip $(export-objs))" ""
 
 MODINCL = $(TOPDIR)/include/linux/modules
 
@@ -233,15 +230,15 @@ $(MODINCL)/%.ver: %.c
                else echo mv $@.tmp $@; mv -f $@.tmp $@; fi; \
        fi; touch $(MODINCL)/$*.stamp
        
-$(addprefix $(MODINCL)/,$(SYMTAB_OBJS:.o=.ver)): $(TOPDIR)/include/linux/autoconf.h
+$(addprefix $(MODINCL)/,$(export-objs:.o=.ver)): $(TOPDIR)/include/linux/autoconf.h
 
 # updates .ver files but not modversions.h
-fastdep: $(addprefix $(MODINCL)/,$(SYMTAB_OBJS:.o=.ver))
+fastdep: $(addprefix $(MODINCL)/,$(export-objs:.o=.ver))
 
 # updates .ver files and modversions.h like before (is this needed?)
 dep: fastdep update-modverfile
 
-endif # SYMTAB_OBJS 
+endif # export-objs 
 
 # update modversions.h, but only if it would change
 update-modverfile:
@@ -262,10 +259,7 @@ update-modverfile:
                mv -f $(TOPDIR)/include/linux/modversions.h.tmp $(TOPDIR)/include/linux/modversions.h; \
        fi
 
-$(M_OBJS): $(TOPDIR)/include/linux/modversions.h
-ifdef MAKING_MODULES
-$(O_OBJS) $(L_OBJS): $(TOPDIR)/include/linux/modversions.h
-endif
+$(active-objs): $(TOPDIR)/include/linux/modversions.h
 
 else
 
@@ -274,8 +268,8 @@ $(TOPDIR)/include/linux/modversions.h:
 
 endif # CONFIG_MODVERSIONS
 
-ifneq "$(strip $(SYMTAB_OBJS))" ""
-$(SYMTAB_OBJS): $(SYMTAB_OBJS:.o=.c) $(TOPDIR)/include/linux/modversions.h
+ifneq "$(strip $(export-objs))" ""
+$(export-objs): $(export-objs:.o=.c) $(TOPDIR)/include/linux/modversions.h
        $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$@) -DEXPORT_SYMTAB -c $(@:.o=.c)
        @ ( \
            echo 'ifeq ($(strip $(subst $(comma),:,$(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$@) -DEXPORT_SYMTAB)),$$(strip $$(subst $$(comma),:,$$(CFLAGS) $$(EXTRA_CFLAGS) $$(CFLAGS_$@) -DEXPORT_SYMTAB)))' ; \
@@ -315,9 +309,7 @@ endif
 
 FILES_FLAGS_CHANGED := $(strip \
     $(filter-out $(FILES_FLAGS_UP_TO_DATE), \
-       $(O_TARGET) $(O_OBJS) $(OX_OBJS) \
-       $(L_TARGET) $(L_OBJS) $(LX_OBJS) \
-       $(M_OBJS) $(MX_OBJS) \
+       $(O_TARGET) $(L_TARGET) $(active-objs) \
        ))
 
 # A kludge: .S files don't get flag dependencies (yet),
index 3b8d98bd29f8f6e33ba813a40c069dae7cac01b9..85cc7ed483094b77ae8ab78b91c274cb4fa4cc91 100644 (file)
        $(CC) $(AFLAGS) -c -o $*.o $<
 
 O_TARGET := kernel.o
-O_OBJS   := entry.o traps.o process.o osf_sys.o irq.o irq_alpha.o \
-           signal.o setup.o ptrace.o time.o semaphore.o
-OX_OBJS  := alpha_ksyms.o
 
-L_TARGET := rest.a
-L_OBJS  := irq_i8259.o irq_srm.o irq_pyxis.o \
-           es1888.o smc37c669.o smc37c93x.o ns87312.o
+export-objs := alpha_ksyms.o
 
-ifdef CONFIG_SMP
-O_OBJS   += smp.o irq_smp.o
-endif
+obj-y    := entry.o traps.o process.o osf_sys.o irq.o irq_alpha.o \
+           signal.o setup.o ptrace.o time.o semaphore.o alpha_ksyms.o
 
-ifdef CONFIG_PCI
-O_OBJS   += pci.o pci_iommu.o
-endif
+#
+# FIXME!
+# These should be made conditional on the stuff that needs them!
+#
+obj-y   += irq_i8259.o irq_srm.o irq_pyxis.o \
+           es1888.o smc37c669.o smc37c93x.o ns87312.o
 
 ifdef CONFIG_VGA_HOSE
-L_OBJS  += console.o
+obj-y   += console.o
 endif
 
+
+obj-$(CONFIG_SMP)    += smp.o irq_smp.o
+
+obj-$(CONFIG_PCI)    += pci.o pci_iommu.o
+
 ifdef CONFIG_ALPHA_GENERIC
 
-O_OBJS  += core_apecs.o core_cia.o core_irongate.o core_lca.o core_mcpcia.o \
+obj-y   += core_apecs.o core_cia.o core_irongate.o core_lca.o core_mcpcia.o \
            core_polaris.o core_t2.o core_tsunami.o core_titan.o \
            sys_alcor.o sys_cabriolet.o sys_dp264.o sys_eb64p.o sys_eiger.o \
            sys_jensen.o sys_miata.o sys_mikasa.o sys_nautilus.o sys_titan.o \
@@ -46,99 +48,53 @@ O_OBJS       += core_apecs.o core_cia.o core_irongate.o core_lca.o core_mcpcia.o \
 else
 
 # Core logic support
-ifdef CONFIG_ALPHA_APECS
-O_OBJS   += core_apecs.o
-endif
-ifdef CONFIG_ALPHA_CIA
-O_OBJS   += core_cia.o
-endif
-ifdef CONFIG_ALPHA_IRONGATE
-O_OBJS   += core_irongate.o
-endif
-ifdef CONFIG_ALPHA_LCA
-O_OBJS   += core_lca.o
-endif
-ifdef CONFIG_ALPHA_MCPCIA
-O_OBJS   += core_mcpcia.o
-endif
-ifdef CONFIG_ALPHA_T2
-O_OBJS   += core_t2.o
-endif
-ifdef CONFIG_ALPHA_TSUNAMI
-O_OBJS   += core_tsunami.o
-endif
-ifdef CONFIG_ALPHA_TITAN
-O_OBJS   += core_titan.o
-endif
-ifdef CONFIG_ALPHA_POLARIS
-O_OBJS   += core_polaris.o
-endif
-ifdef CONFIG_ALPHA_WILDFIRE
-O_OBJS += core_wildfire.o
-endif
+obj-$(CONFIG_ALPHA_APECS) += core_apecs.o
+obj-$(CONFIG_ALPHA_CIA) += core_cia.o
+
+obj-$(CONFIG_ALPHA_IRONGATE) += core_irongate.o
+obj-$(CONFIG_ALPHA_LCA) += core_lca.o
+obj-$(CONFIG_ALPHA_MCPCIA) += core_mcpcia.o
+obj-$(CONFIG_ALPHA_T2) += core_t2.o
+obj-$(CONFIG_ALPHA_TSUNAMI) += core_tsunami.o
+obj-$(CONFIG_ALPHA_TITAN) += core_titan.o
+obj-$(CONFIG_ALPHA_POLARIS) += core_polaris.o
+obj-$(CONFIG_ALPHA_WILDFIRE) += core_wildfire.o
 
 # Board support
 ifneq ($(CONFIG_ALPHA_ALCOR)$(CONFIG_ALPHA_XLT),)
-O_OBJS   += sys_alcor.o
+obj-y    += sys_alcor.o
 endif
 ifneq ($(CONFIG_ALPHA_CABRIOLET)$(CONFIG_ALPHA_EB164)$(CONFIG_ALPHA_EB66P)$(CONFIG_ALPHA_LX164)$(CONFIG_ALPHA_PC164),)
-O_OBJS   += sys_cabriolet.o
-endif
-ifdef CONFIG_ALPHA_DP264
-O_OBJS   += sys_dp264.o
-endif
-ifdef CONFIG_ALPHA_TITAN
-O_OBJS   += sys_titan.o
+obj-y    += sys_cabriolet.o
 endif
+
+obj-$(CONFIG_ALPHA_DP264) += sys_dp264.o
+obj-$(CONFIG_ALPHA_TITAN) += sys_titan.o
+
 ifneq ($(CONFIG_ALPHA_EB64P)$(CONFIG_ALPHA_EB66),)
-O_OBJS   += sys_eb64p.o
-endif
-ifdef CONFIG_ALPHA_EIGER
-O_OBJS   += sys_eiger.o
-endif
-ifdef CONFIG_ALPHA_JENSEN
-O_OBJS   += sys_jensen.o
-endif
-ifdef CONFIG_ALPHA_MIATA
-O_OBJS   += sys_miata.o
-endif
-ifdef CONFIG_ALPHA_MIKASA
-O_OBJS   += sys_mikasa.o
-endif
-ifdef CONFIG_ALPHA_NAUTILUS
-O_OBJS   += sys_nautilus.o
-endif
-ifdef CONFIG_ALPHA_NORITAKE
-O_OBJS   += sys_noritake.o
-endif
-ifdef CONFIG_ALPHA_RAWHIDE
-O_OBJS   += sys_rawhide.o
-endif
-ifdef CONFIG_ALPHA_RUFFIAN
-O_OBJS   += sys_ruffian.o
-endif
-ifdef CONFIG_ALPHA_RX164
-O_OBJS   += sys_rx164.o
-endif
-ifdef CONFIG_ALPHA_SABLE
-O_OBJS   += sys_sable.o
+obj-y    += sys_eb64p.o
 endif
+
+obj-$(CONFIG_ALPHA_EIGER) += sys_eiger.o
+obj-$(CONFIG_ALPHA_JENSEN) += sys_jensen.o
+obj-$(CONFIG_ALPHA_MIATA) += sys_miata.o
+obj-$(CONFIG_ALPHA_MIKASA) += sys_mikasa.o
+obj-$(CONFIG_ALPHA_NAUTILUS) += sys_nautilus.o
+obj-$(CONFIG_ALPHA_NORITAKE) += sys_noritake.o
+obj-$(CONFIG_ALPHA_RAWHIDE) += sys_rawhide.o
+obj-$(CONFIG_ALPHA_RUFFIAN) += sys_ruffian.o
+obj-$(CONFIG_ALPHA_RX164) += sys_rx164.o
+obj-$(CONFIG_ALPHA_SABLE) += sys_sable.o
+
 ifneq ($(CONFIG_ALPHA_BOOK1)$(CONFIG_ALPHA_AVANTI)$(CONFIG_ALPHA_NONAME)$(CONFIG_ALPHA_P2K)$(CONFIG_ALPHA_XL),)
-O_OBJS   += sys_sio.o
-endif
-ifdef CONFIG_ALPHA_SX164
-O_OBJS   += sys_sx164.o
-endif
-ifdef CONFIG_ALPHA_TAKARA
-O_OBJS   += sys_takara.o
-endif
-ifdef CONFIG_ALPHA_WILDFIRE
-O_OBJS += sys_wildfire.o
+obj-y    += sys_sio.o
 endif
 
-endif # GENERIC
+obj-$(CONFIG_ALPHA_SX164) += sys_sx164.o
+obj-$(CONFIG_ALPHA_TAKARA) += sys_takara.o
+obj-$(CONFIG_ALPHA_WILDFIRE) += sys_wildfire.o
 
-O_OBJS += $(L_TARGET)
+endif # GENERIC
 
 all: kernel.o head.o
 
index dd882dc14f2a8548246cbec037bcc3df5a0e8ad0..94a3872c37dc2d2317bb8d9c452b2ba9e4eb0935 100644 (file)
@@ -106,8 +106,9 @@ static inline void __init
 smp_store_cpu_info(int cpuid)
 {
        cpu_data[cpuid].loops_per_sec = loops_per_sec;
-       cpu_data[cpuid].last_asn
-         = (cpuid << WIDTH_HARDWARE_ASN) + ASN_FIRST_VERSION;
+       cpu_data[cpuid].last_asn = ASN_FIRST_VERSION;
+       cpu_data[cpuid].need_new_asn = 0;
+       cpu_data[cpuid].asn_lock = 0;
        local_irq_count(cpuid) = 0;
        local_bh_count(cpuid) = 0;
 }
@@ -898,12 +899,16 @@ flush_tlb_all(void)
        tbia();
 }
 
+#define asn_locked() (cpu_data[smp_processor_id()].asn_lock)
+
 static void
 ipi_flush_tlb_mm(void *x)
 {
        struct mm_struct *mm = (struct mm_struct *) x;
-       if (mm == current->active_mm)
+       if (mm == current->active_mm && !asn_locked())
                flush_tlb_current(mm);
+       else
+               flush_tlb_other(mm);
 }
 
 void
@@ -911,10 +916,18 @@ flush_tlb_mm(struct mm_struct *mm)
 {
        if (mm == current->active_mm) {
                flush_tlb_current(mm);
-               if (atomic_read(&mm->mm_users) <= 1)
+               if (atomic_read(&mm->mm_users) <= 1) {
+                       int i, cpu, this_cpu = smp_processor_id();
+                       for (i = 0; i < smp_num_cpus; i++) {
+                               cpu = cpu_logical_map(i);
+                               if (cpu == this_cpu)
+                                       continue;
+                               if (mm->context[cpu])
+                                       mm->context[cpu] = 0;
+                       }
                        return;
-       } else
-               flush_tlb_other(mm);
+               }
+       }
 
        if (smp_call_function(ipi_flush_tlb_mm, mm, 1, 1)) {
                printk(KERN_CRIT "flush_tlb_mm: timed out\n");
@@ -931,8 +944,12 @@ static void
 ipi_flush_tlb_page(void *x)
 {
        struct flush_tlb_page_struct *data = (struct flush_tlb_page_struct *)x;
-       if (data->mm == current->active_mm)
-               flush_tlb_current_page(data->mm, data->vma, data->addr);
+       struct mm_struct * mm = data->mm;
+
+       if (mm == current->active_mm && !asn_locked())
+               flush_tlb_current_page(mm, data->vma, data->addr);
+       else
+               flush_tlb_other(mm);
 }
 
 void
@@ -943,10 +960,18 @@ flush_tlb_page(struct vm_area_struct *vma, unsigned long addr)
 
        if (mm == current->active_mm) {
                flush_tlb_current_page(mm, vma, addr);
-               if (atomic_read(&mm->mm_users) <= 1)
+               if (atomic_read(&mm->mm_users) <= 1) {
+                       int i, cpu, this_cpu = smp_processor_id();
+                       for (i = 0; i < smp_num_cpus; i++) {
+                               cpu = cpu_logical_map(i);
+                               if (cpu == this_cpu)
+                                       continue;
+                               if (mm->context[cpu])
+                                       mm->context[cpu] = 0;
+                       }
                        return;
-       } else
-               flush_tlb_other(mm);
+               }
+       }
 
        data.vma = vma;
        data.mm = mm;
@@ -968,8 +993,10 @@ static void
 ipi_flush_icache_page(void *x)
 {
        struct mm_struct *mm = (struct mm_struct *) x;
-       if (mm == current->active_mm)
+       if (mm == current->active_mm && !asn_locked())
                __load_new_mm_context(mm);
+       else
+               flush_tlb_other(mm);
 }
 
 void
@@ -980,11 +1007,19 @@ flush_icache_page(struct vm_area_struct *vma, struct page *page)
        if ((vma->vm_flags & VM_EXEC) == 0)
                return;
 
-       mm->context = 0;
        if (mm == current->active_mm) {
                __load_new_mm_context(mm);
-               if (atomic_read(&mm->mm_users) <= 1)
+               if (atomic_read(&mm->mm_users) <= 1) {
+                       int i, cpu, this_cpu = smp_processor_id();
+                       for (i = 0; i < smp_num_cpus; i++) {
+                               cpu = cpu_logical_map(i);
+                               if (cpu == this_cpu)
+                                       continue;
+                               if (mm->context[cpu])
+                                       mm->context[cpu] = 0;
+                       }
                        return;
+               }
        }
 
        if (smp_call_function(ipi_flush_icache_page, mm, 1, 1)) {
index a5140ce1cb78a1715f909dc7679ecc751209e0d6..ddc677339477ae5e9be4f45a0398b73603b2a336 100644 (file)
@@ -45,7 +45,7 @@ __load_new_mm_context(struct mm_struct *next_mm)
        unsigned long mmc;
 
        mmc = __get_new_mm_context(next_mm, smp_processor_id());
-       next_mm->context = mmc;
+       next_mm->context[smp_processor_id()] = mmc;
        current->thread.asn = mmc & HARDWARE_ASN_MASK;
         current->thread.ptbr
          = ((unsigned long) next_mm->pgd - IDENT_ADDR) >> PAGE_SHIFT;
index 64828b33555712cee39bdeb5b257f2ce46da05ba..25b5230268117b9b6ab668bec085dd7b62ea31e6 100644 (file)
@@ -91,7 +91,7 @@ LIBS := $(TOPDIR)/arch/i386/lib/lib.a $(LIBS) $(TOPDIR)/arch/i386/lib/lib.a
 
 ifdef CONFIG_MATH_EMULATION
 SUBDIRS += arch/i386/math-emu
-SUBDIRS += arch/i386/math-emu/math.o
+DRIVERS += arch/i386/math-emu/math.o
 endif
 
 arch/i386/kernel: dummy
index 87fc106f87a75619d9f178e78b8d2fa33f1f5403..ecbb22b340fd1173f72b2d11b7535a3fc253de00 100644 (file)
@@ -235,12 +235,8 @@ tristate 'Kernel support for MISC binaries' CONFIG_BINFMT_MISC
 
 bool 'Power Management support' CONFIG_PM
 
-dep_bool '  ACPI support' CONFIG_ACPI $CONFIG_PM
-if [ "$CONFIG_ACPI" != "n" ]; then
-   if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
-      bool '    ACPI interpreter (EXPERIMENTAL)' CONFIG_ACPI_INTERPRETER
-      bool '    Enter S1 for sleep (EXPERIMENTAL)' CONFIG_ACPI_S1_SLEEP
-   fi
+if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
+   dep_bool '  ACPI support' CONFIG_ACPI $CONFIG_PM
 fi
 
 dep_tristate '  Advanced Power Management BIOS support' CONFIG_APM $CONFIG_PM
index a41ef4fda4659921cf960f11ed167aade2b8e8b9..cb41a22bbde556cad618cbfe098bb24c851929ed 100644 (file)
@@ -40,10 +40,6 @@ obj-$(CONFIG_SMP)    += smp.o smpboot.o trampoline.o
 obj-$(CONFIG_X86_LOCAL_APIC)   += apic.o
 obj-$(CONFIG_X86_IO_APIC)      += io_apic.o mpparse.o
 obj-$(CONFIG_X86_VISWS_APIC)   += visws_apic.o
-
-# if the interpreter is used, it overrides acpi.c
-ifneq ($(CONFIG_ACPI_INTERPRETER),y)
 obj-$(CONFIG_ACPI)     += acpi.o
-endif
 
 include $(TOPDIR)/Rules.make
index 98079f060fd8476f8692c510336fa93124179d44..becbe8840719f09826de3e332b74ba5af4c4dee0 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  acpi.c - Linux ACPI driver
+ *  acpi.c - Linux ACPI arch-specific functions
  *
  *  Copyright (C) 1999-2000 Andrew Henroid
  *
@@ -19,9 +19,6 @@
  */
 
 /*
- * See http://www.geocities.com/SiliconValley/Hardware/3165/
- * for the user-level ACPI stuff
- *
  * Changes:
  * Arnaldo Carvalho de Melo <acme@conectiva.com.br> - 2000/08/31
  * - check copy*user return
  * - get rid of verify_area
  * Arnaldo Carvalho de Melo <acme@conectiva.com.br> - 2000/09/28
  * - do proper release on failure in acpi_claim_ioports and acpi_init
+ * Andrew Grover <andrew.grover@intel.com> - 2000/11/13
+ * - Took out support for user-level interpreter. ACPI 2.0 changes preclude
+ *   its maintenance.
  */
 
 #include <linux/config.h>
 #include <linux/module.h>
 #include <linux/init.h>
-#include <linux/string.h>
-#include <linux/miscdevice.h>
-#include <linux/sched.h>
-#include <linux/time.h>
-#include <linux/wait.h>
-#include <linux/spinlock.h>
-#include <linux/ioport.h>
-#include <linux/slab.h>
-#include <linux/mm.h>
-#include <linux/pci.h>
-#include <asm/uaccess.h>
-#include <asm/io.h>
-#include <linux/sysctl.h>
-#include <linux/delay.h>
 #include <linux/pm.h>
-#include <linux/acpi.h>
-
-/*
- * Yes, it's unfortunate that we are relying on get_cmos_time
- * because it is slow (> 1 sec.) and i386 only.         It might be better
- * to use some of the code from drivers/char/rtc.c in the near future
- */
-extern unsigned long get_cmos_time(void);
-
-static int acpi_do_ulong(ctl_table *ctl,
-                        int write,
-                        struct file *file,
-                        void *buffer,
-                        size_t *len);
-static int acpi_do_table(ctl_table *ctl,
-                        int write,
-                        struct file *file,
-                        void *buffer,
-                        size_t *len);
-static int acpi_do_event_reg(ctl_table *ctl,
-                            int write,
-                            struct file *file,
-                            void *buffer,
-                            size_t *len);
-static int acpi_do_event(ctl_table *ctl,
-                        int write,
-                        struct file *file,
-                        void *buffer,
-                        size_t *len);
-static int acpi_do_sleep(ctl_table *ctl,
-                        int write,
-                        struct file *file,
-                        void *buffer,
-                        size_t *len);
-static void acpi_release(unsigned long start, unsigned long size);
-
-static struct ctl_table_header *acpi_sysctl = NULL;
-
-// current system sleep state (S0 - S4)
-static acpi_sstate_t acpi_sleep_state = ACPI_S0;
-// time sleep began
-static unsigned long acpi_sleep_start = 0;
-
-static spinlock_t acpi_event_lock = SPIN_LOCK_UNLOCKED;
-static volatile u32 acpi_pm1_status = 0;
-static volatile u32 acpi_gpe_status = 0;
-static volatile u32 acpi_gpe_level = 0;
-static volatile acpi_sstate_t acpi_event_state = ACPI_S0;
-static DECLARE_WAIT_QUEUE_HEAD(acpi_event_wait);
-
-/* Make it impossible to enter C2/C3 until after we've initialized */
-static unsigned long acpi_enter_lvl2_lat = ACPI_INFINITE_LAT;
-static unsigned long acpi_enter_lvl3_lat = ACPI_INFINITE_LAT;
-static unsigned long acpi_p_lvl2_lat = ACPI_INFINITE_LAT;
-static unsigned long acpi_p_lvl3_lat = ACPI_INFINITE_LAT;
-
-/* Statistics.. */
-struct Cx_stat_struct {
-       unsigned long time;
-       unsigned long min;
-       unsigned long max;
-       unsigned long avg;
-} Cx_stat[3];
-
-static int acpi_do_stat(ctl_table *ctl,
-                        int write,
-                        struct file *file,
-                        void *buffer,
-                        size_t *len)
-{
-       int size;
-       char str[4*10];
-       struct Cx_stat_struct *stat = (struct Cx_stat_struct *)ctl->data;
-
-       if (write) {
-               stat->time = 0;
-               stat->min = 0;
-               stat->max = 0;
-               stat->avg = 0;
-               return 0;
-       }
-
-       if (file->f_pos) {
-               *len = 0;
-               return 0;
-       }
-       size = sprintf(str, "%9lu %9lu %9lu %9lu",
-               stat->time,
-               stat->min,
-               stat->max,
-               stat->avg);
-       if (*len < size) {
-               *len = 0;
-               return 0;
-       }
-       return copy_to_user(buffer, str, size) ? -EFAULT : 0;
-}
-
-static void cx_statistics(unsigned int x, unsigned long time)
-{
-       struct Cx_stat_struct *stat = Cx_stat + (x-1);
-
-       stat->time += time;
-       if (time <= stat->min-1)
-               stat->min = time;
-       if (time > stat->max)
-               stat->max = time;
-       stat->avg = time + (stat->avg >> 1);
-}
-
-static unsigned long acpi_p_blk = 0;
-
-static int acpi_p_lvl2_tested = 0;
-static int acpi_p_lvl3_tested = 0;
-
-enum
-{
-       ACPI_ENABLED =       0x00000000, // use ACPI if present
-       ACPI_DISABLED =      0x00000001, // never use ACPI
-       ACPI_TABLES_ONLY =   0x00000002, // never use chipset-specific driver
-       ACPI_CHIPSET_ONLY =  0x00000004, // always use chipset-specific driver
-       ACPI_IGNORE_ERRATA = 0x00000008, // ignore any listed platform errata
-       ACPI_COPY_TABLES  =  0x00000010, // copy ACPI tables before use
-       ACPI_TRUST_TABLES =  0x00000020, // use tables even after ioremap fails
-       ACPI_SCI_DISABLED =  0x00000040, // never enable ACPI (info. only)
-       ACPI_C2_DISABLED  =  0x00000080, // never enter C2
-       ACPI_C3_DISABLED  =  0x00000100, // never enter C3
-       ACPI_S1_DISABLED  =  0x00000200, // never enter S1
-       ACPI_S5_DISABLED  =  0x00000400, // never enter S5
-};
-
-struct acpi_option_info
-{
-       const char *name;
-       unsigned long value;
-};
-
-static struct acpi_option_info acpi_options[] =
-{
-       {"on", ACPI_ENABLED},
-       {"off", ACPI_DISABLED},
-       {"tables", ACPI_TABLES_ONLY},
-       {"chipset", ACPI_CHIPSET_ONLY},
-       {"no-errata", ACPI_IGNORE_ERRATA},
-       {"copy-tables", ACPI_COPY_TABLES},
-       {"trust-tables", ACPI_TRUST_TABLES},
-       {"no-sci", ACPI_SCI_DISABLED},
-       {"no-c2", ACPI_C2_DISABLED},
-       {"no-c3", ACPI_C3_DISABLED},
-       {"no-s1", ACPI_S1_DISABLED},
-       {"no-s5", ACPI_S5_DISABLED},
-       {NULL, 0},
-};
-
-static unsigned long acpi_opts = ACPI_ENABLED;
-
-struct acpi_errata_info
-{
-       const char *signature; // table signature (eg. "RSDT")
-       const char *oem;       // OEM name
-       const char *oem_table; // OEM table identifier (optional)
-       u32 oem_rev;           // OEM table revision (optional)
-       unsigned long options; // errata options
-};
-
-/*
- * We must identify systems that need ACPI_TRUST_TABLES solely from the
- * RSDP ("RSD PTR ").  All other options should be flagged from the
- * RSDT ("RSDT") which can be better identified.
- */
-struct acpi_errata_info acpi_errata[] =
-{
-       {"RSD PTR ", "AMI   ", NULL, 0, ACPI_TRUST_TABLES | ACPI_COPY_TABLES},
-       {NULL, NULL, 0, 0},
-};
-
-// bits 8-15 are SLP_TYPa, bits 0-7 are SLP_TYPb
-static unsigned long acpi_slp_typ[] = 
-{
-       ACPI_SLP_TYP_DISABLED, /* S0 */
-       ACPI_SLP_TYP_DISABLED, /* S1 */
-       ACPI_SLP_TYP_DISABLED, /* S2 */
-       ACPI_SLP_TYP_DISABLED, /* S3 */
-       ACPI_SLP_TYP_DISABLED, /* S4 */
-       ACPI_SLP_TYP_DISABLED  /* S5 */
-};
-
-struct acpi_table_info
-{
-       u32 expected_signature;
-       u32 expected_size;
-
-       struct acpi_table *table;
-       size_t size;
-       int mapped;
-};
-
-static struct acpi_table_info acpi_facp
-       = {ACPI_FACP_SIG, sizeof(struct acpi_facp), NULL, 0, 0};
-static struct acpi_table_info acpi_dsdt = {ACPI_DSDT_SIG, 0, NULL, 0, 0};
-static struct acpi_table_info acpi_facs
-       = {ACPI_FACS_SIG, sizeof(struct acpi_facs), NULL, 0, 0};
-static rwlock_t acpi_do_table_lock = RW_LOCK_UNLOCKED;
-
-static struct ctl_table acpi_table[] =
-{
-       {ACPI_FACP, "facp", &acpi_facp, 0, 0644, NULL, &acpi_do_table},
-
-       {ACPI_DSDT, "dsdt", &acpi_dsdt, 0, 0644, NULL, &acpi_do_table},
-       
-       {ACPI_FACS, "facs", &acpi_facs, 0, 0644, NULL, &acpi_do_table},
-
-       {ACPI_PM1_ENABLE, "pm1_enable",
-        NULL, 0,
-        0600, NULL, &acpi_do_event_reg},
-
-       {ACPI_GPE_ENABLE, "gpe_enable",
-        NULL, 0,
-        0600, NULL, &acpi_do_event_reg},
-
-       {ACPI_GPE_LEVEL, "gpe_level",
-        NULL, 0,
-        0600, NULL, &acpi_do_event_reg},
-
-       {ACPI_EVENT, "event", NULL, 0, 0400, NULL, &acpi_do_event},
-
-       {ACPI_P_BLK, "p_blk",
-        &acpi_p_blk, sizeof(acpi_p_blk),
-        0600, NULL, &acpi_do_ulong},
-
-       {ACPI_P_LVL2_LAT, "p_lvl2_lat",
-        &acpi_p_lvl2_lat, sizeof(acpi_p_lvl2_lat),
-        0644, NULL, &acpi_do_ulong},
-
-       {ACPI_P_LVL3_LAT, "p_lvl3_lat",
-        &acpi_p_lvl3_lat, sizeof(acpi_p_lvl3_lat),
-        0644, NULL, &acpi_do_ulong},
-
-       {ACPI_ENTER_LVL2_LAT, "enter_lvl2_lat",
-        &acpi_enter_lvl2_lat, sizeof(acpi_enter_lvl2_lat),
-        0644, NULL, &acpi_do_ulong},
-
-       {ACPI_ENTER_LVL3_LAT, "enter_lvl3_lat",
-        &acpi_enter_lvl3_lat, sizeof(acpi_enter_lvl3_lat),
-        0644, NULL, &acpi_do_ulong},
-
-       {ACPI_C1_TIME, "c1_time",
-        Cx_stat+0, sizeof(struct Cx_stat_struct),
-        0644, NULL, &acpi_do_stat},
-
-       {ACPI_C2_TIME, "c2_time",
-        Cx_stat+1, sizeof(struct Cx_stat_struct),
-        0644, NULL, &acpi_do_stat},
-
-       {ACPI_C3_TIME, "c3_time",
-        Cx_stat+2, sizeof(struct Cx_stat_struct),
-        0644, NULL, &acpi_do_stat},
-
-       {ACPI_S0_SLP_TYP, "s0_slp_typ",
-        &acpi_slp_typ[ACPI_S0], sizeof(acpi_slp_typ[ACPI_S0]),
-        0600, NULL, &acpi_do_ulong},
-
-       {ACPI_S1_SLP_TYP, "s1_slp_typ",
-        &acpi_slp_typ[ACPI_S1], sizeof(acpi_slp_typ[ACPI_S1]),
-        0600, NULL, &acpi_do_ulong},
-
-       {ACPI_S5_SLP_TYP, "s5_slp_typ",
-        &acpi_slp_typ[ACPI_S5], sizeof(acpi_slp_typ[ACPI_S5]),
-        0600, NULL, &acpi_do_ulong},
-
-       {ACPI_SLEEP, "sleep", NULL, 0, 0600, NULL, &acpi_do_sleep},
-
-       {0}
-};
-
-static struct ctl_table acpi_dir_table[] =
-{
-       {CTL_ACPI, "acpi", NULL, 0, 0555, acpi_table},
-       {0}
-};
-
-static u32 FASTCALL(acpi_read_pm1_control(struct acpi_facp *));
-static u32 FASTCALL(acpi_read_pm1_status(struct acpi_facp *));
-static u32 FASTCALL(acpi_read_pm1_enable(struct acpi_facp *));
-static u32 FASTCALL(acpi_read_gpe_status(struct acpi_facp *));
-static u32 FASTCALL(acpi_read_gpe_enable(struct acpi_facp *));
-
-static void FASTCALL(acpi_write_pm1_control(struct acpi_facp *, u32));
-static void FASTCALL(acpi_write_pm1_status(struct acpi_facp *, u32));
-static void FASTCALL(acpi_write_pm1_enable(struct acpi_facp *, u32));
-static void FASTCALL(acpi_write_gpe_status(struct acpi_facp *, u32));
-static void FASTCALL(acpi_write_gpe_enable(struct acpi_facp *, u32));
-
-/*
- * Get the value of the PM1 control register (SCI_EN, ...)
- */
-static u32 acpi_read_pm1_control(struct acpi_facp *facp)
-{
-       u32 value = 0;
-       if (facp->pm1a_cnt)
-               value = inw(facp->pm1a_cnt);
-       if (facp->pm1b_cnt)
-               value |= inw(facp->pm1b_cnt);
-       return value;
-}
-
-/*
- * Set the value of the PM1 control register (BM_RLD, ...)
- */
-static void acpi_write_pm1_control(struct acpi_facp *facp, u32 value)
-{
-       if (facp->pm1a_cnt)
-               outw(value, facp->pm1a_cnt);
-       if (facp->pm1b_cnt)
-               outw(value, facp->pm1b_cnt);
-}
-
-/*
- * Get the value of the fixed event status register
- */
-static u32 acpi_read_pm1_status(struct acpi_facp *facp)
-{
-       u32 value = 0;
-       if (facp->pm1a_evt)
-               value = inw(facp->pm1a_evt);
-       if (facp->pm1b_evt)
-               value |= inw(facp->pm1b_evt);
-       return value;
-}
-
-/*
- * Set the value of the fixed event status register (clear events)
- */
-static void acpi_write_pm1_status(struct acpi_facp *facp, u32 value)
-{
-       if (facp->pm1a_evt)
-               outw(value, facp->pm1a_evt);
-       if (facp->pm1b_evt)
-               outw(value, facp->pm1b_evt);
-}
-
-/*
- * Get the value of the fixed event enable register
- */
-static u32 acpi_read_pm1_enable(struct acpi_facp *facp)
-{
-       int offset = facp->pm1_evt_len >> 1;
-       u32 value = 0;
-       if (facp->pm1a_evt)
-               value = inw(facp->pm1a_evt + offset);
-       if (facp->pm1b_evt)
-               value |= inw(facp->pm1b_evt + offset);
-       return value;
-}
-
-/*
- * Set the value of the fixed event enable register (enable events)
- */
-static void acpi_write_pm1_enable(struct acpi_facp *facp, u32 value)
-{
-       int offset = facp->pm1_evt_len >> 1;
-       if (facp->pm1a_evt)
-               outw(value, facp->pm1a_evt + offset);
-       if (facp->pm1b_evt)
-               outw(value, facp->pm1b_evt + offset);
-}
-
-/*
- * Get the value of the general-purpose event status register
- */
-static u32 acpi_read_gpe_status(struct acpi_facp *facp)
-{
-       u32 value = 0;
-       int i, size;
-
-       if (facp->gpe1) {
-               size = facp->gpe1_len >> 1;
-               for (i = size - 1; i >= 0; i--)
-                       value = (value << 8) | inb(facp->gpe1 + i);
-       }
-       if (facp->gpe0) {
-               size = facp->gpe0_len >> 1;
-               for (i = size - 1; i >= 0; i--)
-                       value = (value << 8) | inb(facp->gpe0 + i);
-       }
-       return value;
-}
-
-/*
- * Set the value of the general-purpose event status register (clear events)
- */
-static void acpi_write_gpe_status(struct acpi_facp *facp, u32 value)
-{
-       int i, size;
-
-       if (facp->gpe0) {
-               size = facp->gpe0_len >> 1;
-               for (i = 0; i < size; i++) {
-                       outb(value & 0xff, facp->gpe0 + i);
-                       value >>= 8;
-               }
-       }
-       if (facp->gpe1) {
-               size = facp->gpe1_len >> 1;
-               for (i = 0; i < size; i++) {
-                       outb(value & 0xff, facp->gpe1 + i);
-                       value >>= 8;
-               }
-       }
-}
-
-/*
- * Get the value of the general-purpose event enable register
- */
-static u32 acpi_read_gpe_enable(struct acpi_facp *facp)
-{
-       u32 value = 0;
-       int i, size, offset;
-       
-       offset = facp->gpe0_len >> 1;
-       if (facp->gpe1) {
-               size = facp->gpe1_len >> 1;
-               for (i = size - 1; i >= 0; i--) {
-                       value = (value << 8) | inb(facp->gpe1 + offset + i);
-               }
-       }
-       if (facp->gpe0) {
-               size = facp->gpe0_len >> 1;
-               for (i = size - 1; i >= 0; i--)
-                       value = (value << 8) | inb(facp->gpe0 + offset + i);
-       }
-       return value;
-}
-
-/*
- * Set the value of the general-purpose event enable register (enable events)
- */
-static void acpi_write_gpe_enable(struct acpi_facp *facp, u32 value)
-{
-       int i, offset;
-
-       offset = facp->gpe0_len >> 1;
-       if (facp->gpe0) {
-               for (i = 0; i < offset; i++) {
-                       outb(value & 0xff, facp->gpe0 + offset + i);
-                       value >>= 8;
-               }
-       }
-       if (facp->gpe1) {
-               offset = facp->gpe1_len >> 1;
-               for (i = 0; i < offset; i++) {
-                       outb(value & 0xff, facp->gpe1 + offset + i);
-                       value >>= 8;
-               }
-       }
-}
-
-/*
- * Map an ACPI table into virtual memory
- */
-static struct acpi_table *__init acpi_map_table(u32 addr)
-{
-       struct acpi_table *table = NULL;
-       if (addr) {
-               // map table header to determine size
-               table = (struct acpi_table *)
-                       ioremap((unsigned long) addr,
-                               sizeof(struct acpi_table));
-               if (table) {
-                       unsigned long table_size = table->length;
-                       iounmap(table);
-                       // remap entire table
-                       table = (struct acpi_table *)
-                               ioremap((unsigned long) addr, table_size);
-               }
-
-               if (!table && addr < virt_to_phys(high_memory)) {
-                       /* sometimes we see ACPI tables in low memory
-                        * and not reserved by the memory map (E820) code,
-                        * who is at fault for this?  BIOS?
-                        */
-                       printk(KERN_ERR
-                              "ACPI: unreserved table memory @ 0x%p!\n",
-                              (void*) addr);
-
-                       if (acpi_opts & ACPI_TRUST_TABLES) {
-                               /* OK, trust that the table is there
-                                * if it isn't you'll get an OOPS here
-                                */
-                               static u32 sig;
-                               table = (struct acpi_table *)
-                                       phys_to_virt(addr);
-                               sig = table->signature;
-                       }
-               }
-       }
-       return table;
-}
-
-/*
- * Unmap an ACPI table from virtual memory
- */
-static void acpi_unmap_table(struct acpi_table *table)
-{
-       // iounmap ignores addresses within physical memory
-       if (table)
-               iounmap(table);
-}
-
-/*
- * Initialize an ACPI table
- */
-static int acpi_init_table(struct acpi_table_info *info,
-                          void *data,
-                          int mapped)
-{
-       struct acpi_table *table = (struct acpi_table*) data;
-
-       info->table = NULL;
-       info->size = 0;
-       info->mapped = 0;
-
-       if (!table || table->signature != info->expected_signature)
-               return -EINVAL;
-
-       if (mapped && (acpi_opts & ACPI_COPY_TABLES)) {
-               struct acpi_table *copy
-                       = kmalloc(table->length, GFP_KERNEL);
-               if (!copy)
-                       return -ENOMEM;
-               memcpy(copy, table, table->length);
-               table = copy;
-               mapped = 0;
-       }
-
-       info->table = table;
-       info->size = (size_t) table->length;
-       info->mapped = mapped;
-       return 0;
-}
-
-/*
- * Destroy an ACPI table
- */
-static void acpi_destroy_table(struct acpi_table_info *info)
-{
-       if (info->table) {
-               if (info->mapped)
-                       acpi_unmap_table(info->table);
-               else
-                       kfree(info->table);
-               info->table = NULL;
-       }
-}
-
-/*
- * Match ACPI table and set options based on platform errata, if any
- */
-static int __init acpi_find_errata(struct acpi_table *table)
-{
-       struct acpi_errata_info *info;
-       int size;
-
-       for (info = acpi_errata; info->signature && info->oem; info++) {
-               size = strlen(info->signature);
-               if (memcmp(&table->signature, info->signature, size))
-                       continue;
-               if (strcmp(info->signature, "RSD PTR ")) {
-                       // ordinary ACPI table
-                       size = strlen(info->oem);
-                       if (memcmp(table->oem, info->oem, size))
-                               continue;
-                       if (info->oem_table) {
-                               size = strlen(info->oem_table);
-                               if (memcmp(table->oem_table,
-                                          info->oem_table,
-                                          size))
-                                       continue;
-                       }
-                       if (info->oem_rev && table->oem_rev != info->oem_rev)
-                               continue;
-               }
-               else {
-                       // special handling for RSDP
-                       size = strlen(info->oem);
-                       if (memcmp(((struct acpi_rsdp*) table)->oem,
-                                  info->oem,
-                                  size))
-                               continue;
-               }
-
-               printk(KERN_INFO
-                      "ACPI: found platform errata 0x%08lx\n",
-                      info->options);
-               acpi_opts |= info->options;
-               return 0;
-       }
-       return -1;
-}
-
-/*
- * Locate and map ACPI tables
- */
-static int __init acpi_find_tables(void)
-{
-       struct acpi_rsdp *rsdp;
-       struct acpi_table *rsdt;
-       u32 *rsdt_entry;
-       int rsdt_entry_count;
-       unsigned long i;
-
-       // search BIOS memory for RSDP
-       for (i = ACPI_BIOS_ROM_BASE; i < ACPI_BIOS_ROM_END; i += 16) {
-               rsdp = (struct acpi_rsdp *) phys_to_virt(i);
-               if (rsdp->signature[0] == ACPI_RSDP1_SIG
-                   && rsdp->signature[1] == ACPI_RSDP2_SIG) {
-                       char oem[7];
-                       int j;
-
-                       // strip trailing space and print OEM identifier
-                       memcpy(oem, rsdp->oem, 6);
-                       oem[6] = '\0';
-                       for (j = 5;
-                            j > 0 && (oem[j] == '\0' || oem[j] == ' ');
-                            j--) {
-                               oem[j] = '\0';
-                       }
-                       printk(KERN_INFO "ACPI: \"%s\" found at 0x%p\n",
-                              oem, (void *) i);
-
-                       break;
-               }
-       }
-       if (i >= ACPI_BIOS_ROM_END)
-               return -ENODEV;
-
-       // find any errata based on the RSDP
-       if (!acpi_find_errata((struct acpi_table*) rsdp)) {
-               if (acpi_opts & ACPI_DISABLED)
-                       return -EINVAL;
-               else if (acpi_opts & ACPI_CHIPSET_ONLY)
-                       return -ENODEV;
-       }
-
-       // fetch RSDT from RSDP
-       rsdt = acpi_map_table(rsdp->rsdt);
-       if (!rsdt) {
-               printk(KERN_ERR "ACPI: missing RSDT at 0x%p\n",
-                      (void*) rsdp->rsdt);
-               return -EINVAL;
-       }
-       else if (rsdt->signature != ACPI_RSDT_SIG) {
-               printk(KERN_ERR "ACPI: bad RSDT at 0x%p (%08x)\n",
-                      (void*) rsdp->rsdt, (unsigned) rsdt->signature);
-               acpi_unmap_table(rsdt);
-               return -EINVAL;
-       }
-
-       // find any errata based on the RSDT
-       if (!acpi_find_errata(rsdt)) {
-               if (acpi_opts & ACPI_DISABLED)
-                       return -EINVAL;
-               else if (acpi_opts & ACPI_CHIPSET_ONLY)
-                       return -ENODEV;
-       }
-
-       // search RSDT for FACP
-       acpi_facp.table = NULL;
-       rsdt_entry = (u32 *) (rsdt + 1);
-       rsdt_entry_count = (int) ((rsdt->length - sizeof(*rsdt)) >> 2);
-       while (rsdt_entry_count) {
-               struct acpi_table *dt = acpi_map_table(*rsdt_entry);
-               if (!acpi_init_table(&acpi_facp, dt, 1)) {
-                       struct acpi_facp *facp
-                               = (struct acpi_facp*) acpi_facp.table;
-                       struct acpi_table *facs;
-
-                       // map DSDT if it exists
-                       if ((dt = acpi_map_table(facp->dsdt))) {
-                               if (acpi_init_table(&acpi_dsdt, dt, 1))
-                                       acpi_unmap_table(dt);
-                       }
-                       
-                       /*
-                        * map FACS if it exists
-                        */
-                       if ((facs = acpi_map_table(facp->facs))) {
-                               if (acpi_init_table(&acpi_facs,facs,1))
-                                       acpi_unmap_table(facs);
-                       }
-                       break;
-               }
-               else {
-                       acpi_unmap_table(dt);
-               }
-
-               rsdt_entry++;
-               rsdt_entry_count--;
-       }
-
-       acpi_unmap_table(rsdt);
-
-       if (!acpi_facp.table) {
-               printk(KERN_ERR "ACPI: missing FACP\n");
-               return -EINVAL;
-       }
-       return 0;
-}
-
-/*
- * Unmap or destroy ACPI tables
- */
-static void acpi_destroy_tables(void)
-{
-       acpi_destroy_table(&acpi_facs);
-       acpi_destroy_table(&acpi_dsdt);
-       acpi_destroy_table(&acpi_facp);
-}
-
-/*
- * Init PIIX4 device, create a fake FACP
- */
-static int __init acpi_init_piix4(struct pci_dev *dev)
-{
-       struct acpi_facp *facp;
-       u32 base;
-       u16 cmd;
-       u8 pmregmisc;
-
-       pci_read_config_word(dev, PCI_COMMAND, &cmd);
-       if (!(cmd & PCI_COMMAND_IO))
-               return -ENODEV;
-       
-       pci_read_config_byte(dev, ACPI_PIIX4_PMREGMISC, &pmregmisc);
-       if (!(pmregmisc & ACPI_PIIX4_PMIOSE))
-               return -ENODEV;
-       
-       base = pci_resource_start (dev, PCI_BRIDGE_RESOURCES);
-       if (!base)
-               return -ENODEV;
-
-       printk(KERN_INFO "ACPI: found PIIX4 at 0x%04x\n", base);
-
-       facp = kmalloc(sizeof(struct acpi_facp), GFP_KERNEL);
-       if (!facp)
-               return -ENOMEM;
-
-       memset(facp, 0, sizeof(struct acpi_facp));
-       facp->hdr.signature = ACPI_FACP_SIG;
-       facp->hdr.length = sizeof(struct acpi_facp);
-       facp->int_model = ACPI_PIIX4_INT_MODEL;
-       facp->sci_int = ACPI_PIIX4_SCI_INT;
-       facp->smi_cmd = ACPI_PIIX4_SMI_CMD;
-       facp->acpi_enable = ACPI_PIIX4_ACPI_ENABLE;
-       facp->acpi_disable = ACPI_PIIX4_ACPI_DISABLE;
-       facp->s4bios_req = ACPI_PIIX4_S4BIOS_REQ;
-       facp->pm1a_evt = base + ACPI_PIIX4_PM1_EVT;
-       facp->pm1a_cnt = base + ACPI_PIIX4_PM1_CNT;
-       facp->pm2_cnt = ACPI_PIIX4_PM2_CNT;
-       facp->pm_tmr = base + ACPI_PIIX4_PM_TMR;
-       facp->gpe0 = base + ACPI_PIIX4_GPE0;
-       facp->pm1_evt_len = ACPI_PIIX4_PM1_EVT_LEN;
-       facp->pm1_cnt_len = ACPI_PIIX4_PM1_CNT_LEN;
-       facp->pm2_cnt_len = ACPI_PIIX4_PM2_CNT_LEN;
-       facp->pm_tm_len = ACPI_PIIX4_PM_TM_LEN;
-       facp->gpe0_len = ACPI_PIIX4_GPE0_LEN;
-       facp->p_lvl2_lat = (__u16) ACPI_INFINITE_LAT;
-       facp->p_lvl3_lat = (__u16) ACPI_INFINITE_LAT;
-
-       acpi_init_table(&acpi_facp, facp, 0);
-       acpi_init_table(&acpi_dsdt, NULL, 0);
-
-       acpi_p_blk = base + ACPI_PIIX4_P_BLK;
-
-       return 0;
-}
-
-/*
- * Init VIA ACPI device and create a fake FACP
- */
-static int __init acpi_init_via(struct pci_dev *dev)
-{
-       struct acpi_facp *facp;
-       u32 base;
-       u8 tmp, irq;
-
-       pci_read_config_byte(dev, 0x41, &tmp);
-       if (!(tmp & 0x80))
-               return -ENODEV;
-
-       base = pci_resource_start(dev, PCI_BRIDGE_RESOURCES);
-       if (!base) {
-               base = pci_resource_start(dev, PCI_BASE_ADDRESS_4);
-               if (!base)
-                       return -ENODEV;
-       }
-
-       pci_read_config_byte(dev, 0x42, &irq);
-
-       printk(KERN_INFO "ACPI: found %s at 0x%04x\n", dev->name, base);
-
-       facp = kmalloc(sizeof(struct acpi_facp), GFP_KERNEL);
-       if (!facp)
-               return -ENOMEM;
-
-       memset(facp, 0, sizeof(struct acpi_facp));
-       facp->hdr.signature = ACPI_FACP_SIG;
-       facp->hdr.length = sizeof(struct acpi_facp);
-       facp->int_model = ACPI_VIA_INT_MODEL;
-       facp->sci_int = irq;
-       facp->smi_cmd = base + ACPI_VIA_SMI_CMD;
-       facp->acpi_enable = ACPI_VIA_ACPI_ENABLE;
-       facp->acpi_disable = ACPI_VIA_ACPI_DISABLE;
-       facp->pm1a_evt = base + ACPI_VIA_PM1_EVT;
-       facp->pm1a_cnt = base + ACPI_VIA_PM1_CNT;
-       facp->pm_tmr = base + ACPI_VIA_PM_TMR;
-       facp->gpe0 = base + ACPI_VIA_GPE0;
-
-       facp->pm1_evt_len = ACPI_VIA_PM1_EVT_LEN;
-       facp->pm1_cnt_len = ACPI_VIA_PM1_CNT_LEN;
-       facp->pm_tm_len = ACPI_VIA_PM_TM_LEN;
-       facp->gpe0_len = ACPI_VIA_GPE0_LEN;
-       facp->p_lvl2_lat = (__u16) ACPI_INFINITE_LAT;
-       facp->p_lvl3_lat = (__u16) ACPI_INFINITE_LAT;
-
-       facp->duty_offset = ACPI_VIA_DUTY_OFFSET;
-       facp->duty_width = ACPI_VIA_DUTY_WIDTH;
-
-       facp->day_alarm = ACPI_VIA_DAY_ALARM;
-       facp->mon_alarm = ACPI_VIA_MON_ALARM;
-       facp->century = ACPI_VIA_CENTURY;
-
-       acpi_init_table(&acpi_facp, facp, 0);
-       acpi_init_table(&acpi_dsdt, NULL, 0);
-
-       acpi_p_blk = base + ACPI_VIA_P_BLK;
-
-       return 0;
-}
-
-typedef enum
-{
-       CH_UNKNOWN = 0,
-       CH_INTEL_PIIX4,
-       CH_VIA_586,
-       CH_VIA_686A,
-} acpi_chip_t;
-
-/* indexed by value of each enum in acpi_chip_t */
-const static struct
-{
-       int (*chip_init)(struct pci_dev *dev);
-} acpi_chip_info[] =
-{
-       {NULL,},
-       {acpi_init_piix4},
-       {acpi_init_via},
-       {acpi_init_via},
-};
-       
-static struct pci_device_id acpi_pci_tbl[] __initdata =
-{
-       {0x8086, 0x7113, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CH_INTEL_PIIX4},
-       {0x1106, 0x3040, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CH_VIA_586},
-       {0x1106, 0x3057, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CH_VIA_686A},
-       {0,} /* terminate list */
-};
-
-static int __init acpi_probe(struct pci_dev *dev,
-                            const struct pci_device_id *id)
-{
-       return acpi_chip_info[id->driver_data].chip_init(dev);
-}
-
-static struct pci_driver acpi_driver =
-{
-       name:           "acpi",
-       id_table:       acpi_pci_tbl,
-       probe:          acpi_probe,
-};
-static int pci_driver_registered = 0;
-
-/*
- * Locate a known ACPI chipset
- */
-static int __init acpi_find_chipset(void)
-{
-       if (pci_register_driver(&acpi_driver) < 1)
-               return -ENODEV;
-
-       pci_driver_registered = 1;
-
-       return 0;
-}
-
-/*
- * Handle an ACPI SCI (fixed or general purpose event)
- */
-static void acpi_irq(int irq, void *dev_id, struct pt_regs *regs)
-{
-       struct acpi_facp *facp = (struct acpi_facp*) acpi_facp.table;
-       u32 pm1_status, gpe_status, gpe_level, gpe_edge;
-       unsigned long flags;
-
-       // detect and clear fixed events
-       pm1_status = (acpi_read_pm1_status(facp) & acpi_read_pm1_enable(facp));
-       acpi_write_pm1_status(facp, pm1_status);
-       
-       // detect and handle general-purpose events
-       gpe_status = (acpi_read_gpe_status(facp) & acpi_read_gpe_enable(facp));
-       gpe_level = gpe_status & acpi_gpe_level;
-       if (gpe_level) {
-               // disable level-triggered events (re-enabled after handling)
-               acpi_write_gpe_enable(facp,
-                                     acpi_read_gpe_enable(facp) & ~gpe_level);
-       }
-       gpe_edge = gpe_status & ~gpe_level;
-       if (gpe_edge) {
-               // clear edge-triggered events
-               while (acpi_read_gpe_status(facp) & gpe_edge)
-                       acpi_write_gpe_status(facp, gpe_edge);
-       }
-
-       // notify process waiting on /dev/acpi
-       spin_lock_irqsave(&acpi_event_lock, flags);
-       acpi_pm1_status |= pm1_status;
-       acpi_gpe_status |= gpe_status;
-       spin_unlock_irqrestore(&acpi_event_lock, flags);
-       acpi_event_state = acpi_sleep_state;
-       wake_up_interruptible(&acpi_event_wait);
-}
-
-/*
- * Is SCI to be enabled?
- */
-static inline int
-acpi_sci_enabled(void)
-{
-       return !(acpi_opts & ACPI_SCI_DISABLED);
-}
-
-/*
- * Is ACPI enabled or not?
- */
-static inline int acpi_is_enabled(struct acpi_facp *facp)
-{
-       return ((acpi_read_pm1_control(facp) & ACPI_SCI_EN) ? 1:0);
-}
-
-/*
- * Enable SCI
- */
-static int acpi_enable(struct acpi_facp *facp)
-{
-       if (facp->smi_cmd && acpi_sci_enabled())
-               outb(facp->acpi_enable, facp->smi_cmd);
-       return (acpi_is_enabled(facp) ? 0:-1);
-}
-
-/*
- * Disable SCI
- */
-static int acpi_disable(struct acpi_facp *facp)
-{
-       if (facp->smi_cmd && acpi_sci_enabled()) {
-               // disable and clear any pending events
-               acpi_write_gpe_enable(facp, 0);
-               while (acpi_read_gpe_status(facp)) {
-                       acpi_write_gpe_status(facp,
-                                             acpi_read_gpe_status(facp));
-               }
-               acpi_write_pm1_enable(facp, 0);
-               acpi_write_pm1_status(facp, acpi_read_pm1_status(facp));
-
-               /* writing acpi_disable to smi_cmd would be appropriate
-                * here but this causes a nasty crash on many systems
-                */
-       }
-
-       return 0;
-}
-
-static inline int bm_activity(struct acpi_facp *facp)
-{
-       return acpi_read_pm1_status(facp) & ACPI_BM;
-}
-
-static inline void clear_bm_activity(struct acpi_facp *facp)
-{
-       acpi_write_pm1_status(facp, ACPI_BM);
-}
-
-static void sleep_on_busmaster(struct acpi_facp *facp)
-{
-       u32 pm1_cntr = acpi_read_pm1_control(facp);
-       if (pm1_cntr & ACPI_BM_RLD) {
-               pm1_cntr &= ~ACPI_BM_RLD;
-               acpi_write_pm1_control(facp, pm1_cntr);
-       }
-}
-
-static void wake_on_busmaster(struct acpi_facp *facp)
-{
-       u32 pm1_cntr = acpi_read_pm1_control(facp);
-       if (!(pm1_cntr & ACPI_BM_RLD)) {
-               pm1_cntr |= ACPI_BM_RLD;
-               acpi_write_pm1_control(facp, pm1_cntr);
-       }
-       clear_bm_activity(facp);
-}
-
-/* The ACPI timer is just the low 24 bits */
-#define TIME_BEGIN(tmr)                        inl(tmr)
-#define TIME_END(tmr, begin)           ((inl(tmr) - (begin)) & 0x00ffffff)
-
-
-/*
- * Idle loop (uniprocessor only)
- */
-static void acpi_idle(void)
-{
-       static int sleep_level = 1;
-       struct acpi_facp *facp = (struct acpi_facp*) acpi_facp.table;
-
-       if (!facp || !facp->pm_tmr || !acpi_p_blk)
-               goto not_initialized;
-
-       /*
-        * start from the previous sleep level..
-        */
-       if (sleep_level == 1)
-               goto sleep1;
-       if (sleep_level == 2)
-               goto sleep2;
-sleep3:
-       sleep_level = 3;
-       if (!acpi_p_lvl3_tested) {
-               printk(KERN_INFO "ACPI C3 works\n");
-               acpi_p_lvl3_tested = 1;
-       }
-       wake_on_busmaster(facp);
-       if (facp->pm2_cnt)
-               goto sleep3_with_arbiter;
 
-       for (;;) {
-               unsigned long time;
-               unsigned int pm_tmr = facp->pm_tmr;
-
-               __cli();
-               if (current->need_resched)
-                       goto out;
-               if (bm_activity(facp))
-                       goto sleep2;
-
-               time = TIME_BEGIN(pm_tmr);
-               inb(acpi_p_blk + ACPI_P_LVL3);
-               inl(pm_tmr);                                    /* Dummy read, force synchronization with the PMU */
-               time = TIME_END(pm_tmr, time);
-
-               __sti();
-               cx_statistics(3, time);
-               if (time < acpi_p_lvl3_lat)
-                       goto sleep2;
-       }
-
-sleep3_with_arbiter:
-       for (;;) {
-               unsigned long time;
-               u8 arbiter;
-               unsigned int pm2_cntr = facp->pm2_cnt;
-               unsigned int pm_tmr = facp->pm_tmr;
-
-               __cli();
-               if (current->need_resched)
-                       goto out;
-               if (bm_activity(facp))
-                       goto sleep2;
-
-               time = TIME_BEGIN(pm_tmr);
-               arbiter = inb(pm2_cntr) & ~ACPI_ARB_DIS;
-               outb(arbiter | ACPI_ARB_DIS, pm2_cntr);         /* Disable arbiter, park on CPU */
-               inb(acpi_p_blk + ACPI_P_LVL3);
-               inl(pm_tmr);                                    /* Dummy read, force synchronization with the PMU */
-               time = TIME_END(pm_tmr, time);
-               outb(arbiter, pm2_cntr);                        /* Enable arbiter again.. */
-
-               __sti();
-               cx_statistics(3, time);
-               if (time < acpi_p_lvl3_lat)
-                       goto sleep2;
-       }
-
-sleep2:
-       sleep_level = 2;
-       if (!acpi_p_lvl2_tested) {
-               printk(KERN_INFO "ACPI C2 works\n");
-               acpi_p_lvl2_tested = 1;
-       }
-       wake_on_busmaster(facp);        /* Required to track BM activity.. */
-       for (;;) {
-               unsigned long time;
-               unsigned int pm_tmr = facp->pm_tmr;
-
-               __cli();
-               if (current->need_resched)
-                       goto out;
-
-               time = TIME_BEGIN(pm_tmr);
-               inb(acpi_p_blk + ACPI_P_LVL2);
-               inl(pm_tmr);                                    /* Dummy read, force synchronization with the PMU */
-               time = TIME_END(pm_tmr, time);
-
-               __sti();
-               cx_statistics(2, time);
-               if (time < acpi_p_lvl2_lat)
-                       goto sleep1;
-               if (bm_activity(facp)) {
-                       clear_bm_activity(facp);
-                       continue;
-               }
-               if (time > acpi_enter_lvl3_lat)
-                       goto sleep3;
-       }
-
-sleep1:
-       sleep_level = 1;
-       sleep_on_busmaster(facp);
-       for (;;) {
-               unsigned long time;
-               unsigned int pm_tmr = facp->pm_tmr;
-
-               __cli();
-               if (current->need_resched)
-                       goto out;
-               time = TIME_BEGIN(pm_tmr);
-               __asm__ __volatile__("sti ; hlt": : :"memory");
-               time = TIME_END(pm_tmr, time);
-               cx_statistics(1, time);
-               if (time > acpi_enter_lvl2_lat)
-                       goto sleep2;
-       }
-
-not_initialized:
-       for (;;) {
-               __cli();
-               if (current->need_resched)
-                       goto out;
-               __asm__ __volatile__("sti ; hlt": : :"memory");
-       }
-
-out:
-       __sti();
-}
-
-/*
- * Put all devices into specified D-state
- */
-static int acpi_enter_dx(acpi_dstate_t state)
-{
-       int status = 0;
-       
-       if (state == ACPI_D0)
-               status = pm_send_all(PM_RESUME, (void*) state);
-       else
-               status = pm_send_all(PM_SUSPEND, (void*) state);
-
-       return status;
-}
-
-/*
- * Update system time from real-time clock
- */
-static void acpi_update_clock(void)
-{
-       if (acpi_sleep_start) {
-               unsigned long delta;
-               struct timeval tv;
-               
-               delta = get_cmos_time() - acpi_sleep_start;
-               do_gettimeofday(&tv);
-               tv.tv_sec += delta;
-               do_settimeofday(&tv);
-               
-               acpi_sleep_start = 0;
-       }
-}
-
-/*
- * Enter system sleep state
- */
-static int acpi_enter_sx(acpi_sstate_t state)
-{
-       unsigned long slp_typ;
-       u16 typa, typb, value;
-       struct acpi_facp *facp;
-
-       slp_typ = acpi_slp_typ[(int) state];
-       if (slp_typ == ACPI_SLP_TYP_DISABLED)
-               return -EPERM;
-
-       // bits 8-15 are SLP_TYPa, bits 0-7 are SLP_TYPb
-       typa = (slp_typ >> 8) & 0xff;
-       typb = slp_typ & 0xff;
-       
-       typa = ((typa << ACPI_SLP_TYP_SHIFT) & ACPI_SLP_TYP_MASK);
-       typb = ((typb << ACPI_SLP_TYP_SHIFT) & ACPI_SLP_TYP_MASK);
-
-       acpi_sleep_start = get_cmos_time();
-       acpi_enter_dx(ACPI_D3);
-       // disable interrupts globally while suspended
-       cli();
-       acpi_sleep_state = state;
-
-       facp = (struct acpi_facp*) acpi_facp.table;
-       
-       // clear wake status
-       acpi_write_pm1_status(facp, ACPI_WAK);
-       
-       // set SLP_TYPa/b and SLP_EN
-       if (facp->pm1a_cnt) {
-               value = inw(facp->pm1a_cnt) & ~ACPI_SLP_TYP_MASK;
-               outw(value | typa | ACPI_SLP_EN, facp->pm1a_cnt);
-       }
-       if (facp->pm1b_cnt) {
-               value = inw(facp->pm1b_cnt) & ~ACPI_SLP_TYP_MASK;
-               outw(value | typb | ACPI_SLP_EN, facp->pm1b_cnt);
-       }
-       
-       // wait until S1 is entered
-       while (!(acpi_read_pm1_status(facp) & ACPI_WAK)) ;
-       // finished sleeping, update system time
-       acpi_update_clock();
-       acpi_enter_dx(ACPI_D0);
-       // reenable interrupts globally after resume
-       sti();
-       acpi_sleep_state = ACPI_S0;
-       
-       return 0;
-}
-
-/*
- * Enter soft-off (S5)
- */
-static void acpi_power_off(void)
-{
-       acpi_enter_sx(ACPI_S5);
-}
-
-/*
- * Claim I/O port if available
- */
-static int acpi_claim(unsigned long start, unsigned long size)
-{
-       if (start && size)
-               if (!request_region(start, size, "acpi"))
-                       return -EBUSY;
-       return 0;
-}
-
-/*
- * Claim ACPI I/O ports
- */
-static int acpi_claim_ioports(struct acpi_facp *facp)
-{
-       // we don't get a guarantee of contiguity for any of the ACPI registers
-       if (acpi_claim(facp->pm1a_evt, facp->pm1_evt_len))
-               goto return_ebusy;
-       if (acpi_claim(facp->pm1b_evt, facp->pm1_evt_len))
-               goto release_pm1a_evt;
-       if (acpi_claim(facp->pm1a_cnt, facp->pm1_cnt_len))
-               goto release_pm1b_evt;
-       if (acpi_claim(facp->pm1b_cnt, facp->pm1_cnt_len))
-               goto release_pm1a_cnt;
-       if (acpi_claim(facp->pm_tmr, facp->pm_tm_len))
-               goto release_pm1b_cnt;
-       if (acpi_claim(facp->gpe0, facp->gpe0_len))
-               goto release_pm_tmr;
-       if (acpi_claim(facp->gpe1, facp->gpe1_len))
-               goto release_gpe0;
-       return 0;
-release_gpe0:          acpi_release(facp->gpe0, facp->gpe0_len);
-release_pm_tmr:                acpi_release(facp->pm_tmr, facp->pm_tm_len);
-release_pm1b_cnt:      acpi_release(facp->pm1b_cnt, facp->pm1_cnt_len);
-release_pm1a_cnt:      acpi_release(facp->pm1a_cnt, facp->pm1_cnt_len);
-release_pm1b_evt:      acpi_release(facp->pm1b_evt, facp->pm1_evt_len);
-release_pm1a_evt:      acpi_release(facp->pm1a_evt, facp->pm1_evt_len);
-return_ebusy:          return -EBUSY;
-}
-
-/*
- * Release I/O port if claimed
- */
-static void acpi_release(unsigned long start, unsigned long size)
-{
-       if (start && size)
-               release_region(start, size);
-}
-
-/*
- * Free ACPI I/O ports
- */
-static int acpi_release_ioports(struct acpi_facp *facp)
-{
-       // we don't get a guarantee of contiguity for any of the ACPI registers
-       acpi_release(facp->gpe1, facp->gpe1_len);
-       acpi_release(facp->gpe0, facp->gpe0_len);
-       acpi_release(facp->pm_tmr, facp->pm_tm_len);
-       acpi_release(facp->pm1b_cnt, facp->pm1_cnt_len);
-       acpi_release(facp->pm1a_cnt, facp->pm1_cnt_len);
-       acpi_release(facp->pm1b_evt, facp->pm1_evt_len);
-       acpi_release(facp->pm1a_evt, facp->pm1_evt_len);
-       return 0;
-}
-
-/*
- * Determine if modification of value is permitted
- */
-static int
-acpi_verify_mod(int ctl_name)
-{
-       switch (ctl_name) {
-       case ACPI_PM1_ENABLE:
-       case ACPI_GPE_ENABLE:
-       case ACPI_GPE_LEVEL:
-               if (!acpi_sci_enabled())
-                       return -EPERM;
-               break;
-       case ACPI_P_LVL2_LAT:
-       case ACPI_ENTER_LVL2_LAT:
-               if (acpi_opts & ACPI_C2_DISABLED)
-                       return -EPERM;
-               break;
-       case ACPI_P_LVL3_LAT:
-       case ACPI_ENTER_LVL3_LAT:
-               if (acpi_opts & ACPI_C3_DISABLED)
-                       return -EPERM;
-               break;
-       case ACPI_S1_SLP_TYP:
-       case ACPI_SLEEP:
-               if (acpi_opts & ACPI_S1_DISABLED)
-                       return -EPERM;
-               break;
-       case ACPI_S5_SLP_TYP:
-               if (acpi_opts & ACPI_S5_DISABLED)
-                       return -EPERM;
-               break;
-       }
-       return 0;
-}
-
-/*
- * 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) {
-                       if (copy_to_user(buffer, str, size))
-                               return -EFAULT;
-                       *len = size;
-               }
-               else
-                       *len = 0;
-       }
-       else {
-               if (acpi_verify_mod(ctl->ctl_name))
-                       return -EPERM;
-
-               size = sizeof(str) - 1;
-               if (size > *len)
-                       size = *len;
-               if (copy_from_user(str, buffer, size))
-                       return -EFAULT;
-               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;
-}
-
-/*
- * Determine if user buffer contains a valid table
- */
-static int acpi_verify_table(void *buffer,
-                            size_t size,
-                            struct acpi_table_info *info)
-{
-       struct acpi_table hdr;
-       size_t table_size;
-
-       if (size < sizeof(struct acpi_table))
-               return -EINVAL;
-
-       if (copy_from_user(&hdr, buffer, sizeof(hdr)))
-               return -EFAULT;
-
-       table_size = (size_t) hdr.length;
-       if (hdr.signature != info->expected_signature
-           || table_size < size
-           || (info->expected_size
-               && table_size != info->expected_size))
-               return -EINVAL;
-
-       return 0;
-}
-
-/*
- * Examine/replace an ACPI table
- */
-static int acpi_do_table(ctl_table *ctl,
-                        int write,
-                        struct file *file,
-                        void *buffer,
-                        size_t *len)
-{
-       struct acpi_table_info *info = (struct acpi_table_info *) ctl->data;
-       u8 *data = NULL;
-       size_t size = 0;
-       int error = 0;
-
-       if (!info) {
-               *len = 0;
-               return 0;
-       }
-
-       if (!write) {
-               // table read
-               read_lock(&acpi_do_table_lock);
-               if (info->table && file->f_pos < info->size) {
-                       data = (u8*) info->table + file->f_pos;
-                       size = info->size - file->f_pos;
-                       if (size > *len)
-                               size = *len;
-                       if (copy_to_user(buffer, data, size))
-                               error = -EFAULT;
-               }
-               read_unlock(&acpi_do_table_lock);
-       }
-       else if (file->f_pos) {
-               // table body replacement
-               write_lock(&acpi_do_table_lock);
-               if (info->table && file->f_pos < info->size) {
-                       data = (u8*) info->table + file->f_pos;
-                       size = info->size - file->f_pos;
-                       if (size > *len)
-                               size = *len;
-                       if (copy_from_user(data, buffer, size))
-                               error = -EFAULT;
-               }
-               write_unlock(&acpi_do_table_lock);
-       }
-       else {
-               // table header/body replacement
-               struct acpi_table hdr;
-               size_t table_size;
-
-               // make sure we are being given a valid table
-               error = acpi_verify_table(buffer, *len, info);
-               if (error)
-                       return error;
-               if (copy_from_user(&hdr, buffer, sizeof(hdr)))
-                       return -EFAULT;
-               table_size = (size_t) hdr.length;
-               
-               write_lock(&acpi_do_table_lock);
-               
-               data = (u8*) info->table;
-               size = *len;
-               
-               if (!data || info->mapped || table_size != info->size) {
-                       // allocate a (different sized) table
-                       data = kmalloc(table_size, GFP_KERNEL);
-                       if (data) {
-                               memset(data, 0, table_size);
-                               memcpy(data, &hdr, sizeof(hdr));
-                               acpi_destroy_table(info);
-                               acpi_init_table(info, data, 0);
-                       }
-                       else
-                               error = -ENOMEM;
-               }
-               if (data)
-                       if (copy_from_user(data, buffer, size)) {
-                               acpi_destroy_table(info);
-                               error = -EFAULT;
-                       }
-               
-               write_unlock(&acpi_do_table_lock);
-       }
-
-       if (error)
-               return error;
-
-       *len = size;
-       file->f_pos += size;
-       return 0;
-}
-
-/*
- * Examine/modify event register
- */
-static int acpi_do_event_reg(ctl_table *ctl,
-                            int write,
-                            struct file *file,
-                            void *buffer,
-                            size_t *len)
-{
-       struct acpi_facp *facp = (struct acpi_facp*) acpi_facp.table;
-       char str[2 * sizeof(u32) + 4], *strend;
-       u32 val, enabling;
-       int size;
-
-       if (!write) {
-               if (file->f_pos) {
-                       *len = 0;
-                       return 0;
-               }
-
-               val = 0;
-               switch (ctl->ctl_name) {
-               case ACPI_PM1_ENABLE:
-                       val = acpi_read_pm1_enable(facp);
-                       break;
-               case ACPI_GPE_ENABLE:
-                       val = acpi_read_gpe_enable(facp);
-                       break;
-               case ACPI_GPE_LEVEL:
-                       val = acpi_gpe_level;
-                       break;
-               }
-               
-               size = sprintf(str, "0x%08x\n", val);
-               if (*len >= size) {
-                       if (copy_to_user(buffer, str, size))
-                               return -EFAULT;
-                       *len = size;
-               }
-               else
-                       *len = 0;
-       }
-       else
-       {
-               if (acpi_verify_mod(ctl->ctl_name))
-                       return -EPERM;
-
-               // fetch user value
-               size = sizeof(str) - 1;
-               if (size > *len)
-                       size = *len;
-               if (copy_from_user(str, buffer, size))
-                       return -EFAULT;
-               str[size] = '\0';
-               val = (u32) simple_strtoul(str, &strend, 0);
-               if (strend == str)
-                       return -EINVAL;
-
-               // store value in register
-               switch (ctl->ctl_name) {
-               case ACPI_PM1_ENABLE:
-                       // clear previously disabled events
-                       enabling = (val & ~acpi_read_pm1_enable(facp));
-                       acpi_write_pm1_status(facp, enabling);
-                       
-                       if (val) {
-                               // enable ACPI unless it is already
-                               if (!acpi_is_enabled(facp))
-                                       acpi_enable(facp);
-                       }
-                       else if (!acpi_read_gpe_enable(facp)) {
-                               // disable ACPI unless it is already
-                               if (acpi_is_enabled(facp))
-                                       acpi_disable(facp);
-                       }
-                       
-                       acpi_write_pm1_enable(facp, val);
-                       break;
-               case ACPI_GPE_ENABLE:
-                       // clear previously disabled events
-                       enabling = (val
-                                   & ~acpi_read_gpe_enable(facp));
-                       while (acpi_read_gpe_status(facp) & enabling)
-                               acpi_write_gpe_status(facp, enabling);
-                       
-                       if (val) {
-                               // enable ACPI unless it is already
-                               if (!acpi_is_enabled(facp))
-                                       acpi_enable(facp);
-                       }
-                       else if (!acpi_read_pm1_enable(facp)) {
-                               // disable ACPI unless it is already
-                               if (acpi_is_enabled(facp))
-                                       acpi_disable(facp);
-                       }
-                       
-                       acpi_write_gpe_enable(facp, val);
-                       break;
-               case ACPI_GPE_LEVEL:
-                       acpi_gpe_level = val;
-                       break;
-               }
-       }
-
-       file->f_pos += *len;
-       return 0;
-}
+#define _LINUX
+#include <linux/acpi.h>
+/* Is there a better way to include this? */
+#include <../drivers/acpi/include/acpi.h>
 
-/*
- * Wait for next event
- */
-static int acpi_do_event(ctl_table *ctl,
-                        int write,
-                        struct file *file,
-                        void *buffer,
-                        size_t *len)
+ACPI_PHYSICAL_ADDRESS
+acpi_get_rsdp_ptr()
 {
-       u32 pm1_status = 0, gpe_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;
-       }
-
-       for (;;) {
-               unsigned long flags;
-               
-               // we need an atomic exchange here
-               spin_lock_irqsave(&acpi_event_lock, flags);
-               pm1_status = acpi_pm1_status;
-               acpi_pm1_status = 0;
-               gpe_status = acpi_gpe_status;
-               acpi_gpe_status = 0;
-               spin_unlock_irqrestore(&acpi_event_lock, flags);
-               event_state = acpi_event_state;
-               
-               if (pm1_status || gpe_status)
-                       break;
-               
-               // wait for an event to arrive
-               interruptible_sleep_on(&acpi_event_wait);
-               if (signal_pending(current))
-                       return -ERESTARTSYS;
-       }
-
-       size = sprintf(str, "0x%08x 0x%08x 0x%01x\n",
-                      pm1_status,
-                      gpe_status,
-                      event_state);
-       if (copy_to_user(buffer, str, size))
-               return -EFAULT;
-       *len = size;
-       file->f_pos += size;
-
-       return 0;
-}
+       ACPI_PHYSICAL_ADDRESS rsdp_phys;
 
-/*
- * 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;
-               }
-       }
+       if(ACPI_SUCCESS(acpi_find_root_pointer(&rsdp_phys)))
+               return rsdp_phys;
        else
-       {
-               if (acpi_verify_mod(ctl->ctl_name) || acpi_enter_sx(ACPI_S1))
-                       return -EPERM;
-       }
-       file->f_pos += *len;
-       return 0;
-}
-
-/*
- * Parse command line options
- */
-static int __init acpi_setup(char *str)
-{
-       while (str && *str) {
-               struct acpi_option_info *opt = acpi_options;
-               while (opt->name) {
-                       if (!strncmp(str, opt->name, strlen(opt->name))) {
-                               acpi_opts |= opt->value;
-                               break;
-                       }
-                       opt++;
-               }
-               str = strpbrk(str, ",");
-               if (str)
-                       str += strspn(str, ",");
-       }
-
-       if (acpi_opts)
-               printk(KERN_INFO "ACPI: options 0x%08lx\n", acpi_opts);
-
-       return 1;
-}
-
-/*
- * kernel/module command line interfaces are both "acpi=OPTION,OPTION,..."
- */
-__setup("acpi=", acpi_setup);
-
-static char * __initdata acpi = NULL;
-
-MODULE_DESCRIPTION("ACPI driver");
-MODULE_PARM(acpi, "s");
-MODULE_PARM_DESC(acpi, "ACPI driver command line");
-
-/*
- * Initialize and enable ACPI
- */
-int __init acpi_init(void)
-{
-       struct acpi_facp *facp = NULL;
-
-       if (acpi)
-               acpi_setup(acpi);
-
-       if (acpi_opts & ACPI_DISABLED) {
-               return -ENODEV;
-       }
-       else if (acpi_opts & ACPI_TABLES_ONLY) {
-               if (acpi_find_tables())
-                       return -ENODEV;
-       }
-       else if (acpi_opts & ACPI_CHIPSET_ONLY) {
-               if (acpi_find_chipset())
-                       return -ENODEV;
-       }
-       else {
-               switch (acpi_find_tables()) {
-               case 0:
-                       // found valid ACPI tables
-                       break;
-               case -ENODEV:
-                       // found no ACPI tables, try chipset-specific
-                       if (acpi_find_chipset())
-                               return -ENODEV;
-                       break;
-               default:
-                       // found broken ACPI tables
-                       return -ENODEV;
-               }
-       }
-
-       facp = (struct acpi_facp*) acpi_facp.table;
-
-       if (PM_IS_ACTIVE()) {
-               printk(KERN_NOTICE "acpi: APM is already active.\n");
-               goto err_out;
-       }
-       pm_active = 1;
-
-       /*
-        * Internally we always keep latencies in timer
-        * ticks, which is simpler and more consistent (what is
-        * an uS to us?). Besides, that gives people more
-        * control in the /proc interfaces.
-        */
-       if (facp->p_lvl2_lat
-           && facp->p_lvl2_lat <= ACPI_MAX_P_LVL2_LAT
-           && !acpi_verify_mod(ACPI_P_LVL2_LAT)) {
-               acpi_p_lvl2_lat = ACPI_uS_TO_TMR_TICKS(facp->p_lvl2_lat);
-               acpi_enter_lvl2_lat = ACPI_uS_TO_TMR_TICKS(ACPI_TMR_HZ / 1000);
-       }
-       if (facp->p_lvl3_lat
-           && facp->p_lvl3_lat <= ACPI_MAX_P_LVL3_LAT
-           && !acpi_verify_mod(ACPI_P_LVL3_LAT)) {
-               acpi_p_lvl3_lat = ACPI_uS_TO_TMR_TICKS(facp->p_lvl3_lat);
-               acpi_enter_lvl3_lat
-                       = ACPI_uS_TO_TMR_TICKS(facp->p_lvl3_lat * 5);
-       }
-
-       if (acpi_claim_ioports(facp)) {
-               printk(KERN_ERR "ACPI: I/O port allocation failed\n");
-               goto err_out;
-       }
-
-       if (facp->sci_int
-           && acpi_sci_enabled()
-           && request_irq(facp->sci_int,
-                          acpi_irq,
-                          SA_INTERRUPT | SA_SHIRQ,
-                          "acpi",
-                          &acpi_facp)) {
-               printk(KERN_ERR "ACPI: SCI (IRQ%d) allocation failed\n",
-                      facp->sci_int);
-               goto cleanup_ioports;
-       }
-
-#ifndef CONFIG_ACPI_S1_SLEEP
-       acpi_opts |= ACPI_S1_DISABLED;
-#endif
-
-       acpi_sysctl = register_sysctl_table(acpi_dir_table, 1);
-       if (!acpi_sysctl)
-               goto cleanup_irq;
-
-       pm_power_off = acpi_power_off;
-
-       /*
-        * Set up the ACPI idle function. Note that we can't really
-        * do this with multiple CPU's, we'd need a per-CPU ACPI
-        * device..
-        */
-#ifdef CONFIG_SMP
-       if (smp_num_cpus > 1)
                return 0;
-#endif
-
-       if (facp->pm_tmr)
-               pm_idle = acpi_idle;
-
-       return 0;
-cleanup_irq:
-    free_irq(facp->sci_int, &acpi_facp);
-cleanup_ioports:
-    acpi_release_ioports(facp);
-err_out:
-       if (pci_driver_registered)
-               pci_unregister_driver(&acpi_driver);
-       acpi_destroy_tables();
-
-       return -ENODEV;
 }
-
-/*
- * Disable and deinitialize ACPI
- */
-void __exit acpi_exit(void)
-{
-       struct acpi_facp *facp = (struct acpi_facp*) acpi_facp.table;
-
-       pm_idle = NULL;
-       pm_power_off = NULL;
-
-       unregister_sysctl_table(acpi_sysctl);
-       acpi_disable(facp);
-       acpi_release_ioports(facp);
-
-       if (facp->sci_int && acpi_sci_enabled())
-               free_irq(facp->sci_int, &acpi_facp);
-
-       acpi_destroy_tables();
-
-       if (pci_driver_registered)
-               pci_unregister_driver(&acpi_driver);
-
-       pm_active = 0;
-}
-
-module_init(acpi_init);
-module_exit(acpi_exit);
index 59826db68388802b135424f533bb9001706b60f8..c76754af265c15b83dc4517290d0d8366b880cd5 100644 (file)
@@ -75,7 +75,7 @@ void mcheck_init(struct cpuinfo_x86 *c)
        if( c->x86_vendor != X86_VENDOR_INTEL )
                return;
        
-       if( !test_bit(X86_FEATURE_TSC, &c->x86_capability) )
+       if( !test_bit(X86_FEATURE_MCE, &c->x86_capability) )
                return;
                
        if( !test_bit(X86_FEATURE_MCA, &c->x86_capability) )
index b439568c1f97fd0b86ff52e495746783faebbb04..8d5a9efb30b2dfed0935fb7d67e2d7bafda152ec 100644 (file)
@@ -1,4 +1,3 @@
-#include <linux/config.h>
 #include <linux/types.h>
 #include <linux/kernel.h>
 #include <linux/string.h>
index e3b5c2f75a660857c1812ecf374b137de0a1a6b0..e94cbfbdc61562c19d3f8d9bada786699591b2ce 100644 (file)
@@ -31,7 +31,7 @@ static int read_ldt(void * ptr, unsigned long bytecount)
        struct mm_struct * mm = current->mm;
 
        err = 0;
-       if (!mm->segments)
+       if (!mm->context.segments)
                goto out;
 
        size = LDT_ENTRIES*LDT_ENTRY_SIZE;
@@ -39,7 +39,7 @@ static int read_ldt(void * ptr, unsigned long bytecount)
                size = bytecount;
 
        err = size;
-       if (copy_to_user(ptr, mm->segments, size))
+       if (copy_to_user(ptr, mm->context.segments, size))
                err = -EFAULT;
 out:
        return err;
@@ -87,13 +87,12 @@ static int write_ldt(void * ptr, unsigned long bytecount, int oldmode)
         * limited by MAX_LDT_DESCRIPTORS.
         */
        down(&mm->mmap_sem);
-       if (!mm->segments) {
-               
+       if (!mm->context.segments) {
                error = -ENOMEM;
-               mm->segments = vmalloc(LDT_ENTRIES*LDT_ENTRY_SIZE);
-               if (!mm->segments)
+               mm->context.segments = vmalloc(LDT_ENTRIES*LDT_ENTRY_SIZE);
+               if (!mm->context.segments)
                        goto out_unlock;
-               memset(mm->segments, 0, LDT_ENTRIES*LDT_ENTRY_SIZE);
+               memset(mm->context.segments, 0, LDT_ENTRIES*LDT_ENTRY_SIZE);
                
                if (atomic_read(&mm->mm_users) > 1)
                        printk(KERN_WARNING "LDT allocated for cloned task!\n");
@@ -104,7 +103,7 @@ static int write_ldt(void * ptr, unsigned long bytecount, int oldmode)
                load_LDT(mm);
        }
 
-       lp = (__u32 *) ((ldt_info.entry_number << 3) + (char *) mm->segments);
+       lp = (__u32 *) ((ldt_info.entry_number << 3) + (char *) mm->context.segments);
 
        /* Allow LDTs to be cleared by the user. */
        if (ldt_info.base_addr == 0 && ldt_info.limit == 0) {
index 8e7176c32447f8f03776b3262c6c3dc41c1363df..686821205500cdaa4a0b1d89129cdd3317e95e1f 100644 (file)
@@ -412,15 +412,15 @@ void show_regs(struct pt_regs * regs)
 /*
  * No need to lock the MM as we are the last user
  */
-void release_segments(struct mm_struct *mm)
+void destroy_context(struct mm_struct *mm)
 {
-       void * ldt = mm->segments;
+       void * ldt = mm->context.segments;
 
        /*
         * free the LDT
         */
        if (ldt) {
-               mm->segments = NULL;
+               mm->context.segments = NULL;
                clear_LDT();
                vfree(ldt);
        }
@@ -478,7 +478,7 @@ void flush_thread(void)
 void release_thread(struct task_struct *dead_task)
 {
        if (dead_task->mm) {
-               void * ldt = dead_task->mm->segments;
+               void * ldt = dead_task->mm->context.segments;
 
                // temporary debugging check
                if (ldt) {
@@ -493,29 +493,24 @@ void release_thread(struct task_struct *dead_task)
  * we do not have to muck with descriptors here, that is
  * done in switch_mm() as needed.
  */
-void copy_segments(struct task_struct *p, struct mm_struct *new_mm)
+int init_new_context(struct task_struct *p, struct mm_struct *new_mm)
 {
-       struct mm_struct * old_mm = current->mm;
-       void * old_ldt = old_mm->segments, * ldt;
+       struct mm_struct * old_mm;
+       void *old_ldt, *ldt;
 
-       if (!old_ldt) {
+       ldt = NULL;
+       old_mm = current->mm;
+       if (old_mm && (old_ldt = old_mm->context.segments) != NULL) {
                /*
-                * default LDT - use the one from init_task
+                * Completely new LDT, we initialize it from the parent:
                 */
-               new_mm->segments = NULL;
-               return;
-       }
-
-       /*
-        * Completely new LDT, we initialize it from the parent:
-        */
-       ldt = vmalloc(LDT_ENTRIES*LDT_ENTRY_SIZE);
-       if (!ldt)
-               printk(KERN_WARNING "ldt allocation failed\n");
-       else
+               ldt = vmalloc(LDT_ENTRIES*LDT_ENTRY_SIZE);
+               if (!ldt)
+                       return -ENOMEM;
                memcpy(ldt, old_ldt, LDT_ENTRIES*LDT_ENTRY_SIZE);
-       new_mm->segments = ldt;
-       return;
+       }
+       new_mm->context.segments = ldt;
+       return 0;
 }
 
 /*
index 858e7dda0bc76489c9774c8962681ec6ce5e8153..540ef9a988eab222664a89fdf4b866e8d3574665 100644 (file)
@@ -694,6 +694,11 @@ static void __init do_boot_cpu (int apicid)
                apic_write_around(APIC_ICR, APIC_DM_STARTUP
                                        | (start_eip >> 12));
 
+               /*
+                * Give the other CPU some time to accept the IPI.
+                */
+               udelay(300);
+
                Dprintk("Startup point 1.\n");
 
                Dprintk("Waiting for send to finish...\n");
index b7156415ad9d6bfcb6a52d708a9dcdda0563316a..dc3f3a93c86662fa5b995e7035a2e6760c6cb7ac 100644 (file)
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.47 2000/07/15 00:04:27 davem Exp $
+# $Id: Makefile,v 1.48 2000/12/15 00:41:24 davem Exp $
 # sparc/Makefile
 #
 # Makefile for the architecture dependent flags and dependencies on the
@@ -35,7 +35,7 @@ LINKFLAGS = -T arch/sparc/vmlinux.lds
 
 HEAD := arch/sparc/kernel/head.o arch/sparc/kernel/init_task.o
 
-SUBDIRS := $(SUBDIRS) arch/sparc/kernel arch/sparc/lib arch/sparc/prom \
+SUBDIRS += arch/sparc/kernel arch/sparc/lib arch/sparc/prom \
        arch/sparc/mm arch/sparc/math-emu
 
 CORE_FILES := arch/sparc/kernel/kernel.o arch/sparc/mm/mm.o $(CORE_FILES) \
index d57c23c1f6c1f4eb248edb3a6c7574021192f48f..8143d2acc05fe2941aefec4f0c5aad4f7c64260c 100644 (file)
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.61 2000/09/03 13:58:04 anton Exp $
+# $Id: Makefile,v 1.62 2000/12/15 00:41:17 davem Exp $
 # Makefile for the linux kernel.
 #
 # Note! Dependencies are done automagically by 'make dep', which also
@@ -18,34 +18,23 @@ SH = $(CONFIG_SHELL)
 all: kernel.o head.o init_task.o
 
 O_TARGET := kernel.o
+
+export-objs := sparc_ksyms.o
 IRQ_OBJS := irq.o sun4m_irq.o sun4c_irq.o sun4d_irq.o
-O_OBJS   := entry.o wof.o wuf.o etrap.o rtrap.o traps.o ${IRQ_OBJS} \
+obj-y    := entry.o wof.o wuf.o etrap.o rtrap.o traps.o ${IRQ_OBJS} \
            process.o signal.o ioport.o setup.o idprom.o \
            sys_sparc.o sunos_asm.o sparc-stub.o systbls.o \
            time.o windows.o cpu.o devices.o sclow.o \
            tadpole.o tick14.o ptrace.o sys_solaris.o \
-           unaligned.o muldiv.o pcic.o semaphore.o
-
-OX_OBJS  := sparc_ksyms.o
+           unaligned.o muldiv.o pcic.o semaphore.o sparc_ksyms.o
 
-ifdef CONFIG_SUN4
-O_OBJS += sun4setup.o
-endif
+obj-$(CONFIG_SUN4) += sun4setup.o
+obj-$(CONFIG_SMP) += trampoline.o smp.o sun4m_smp.o sun4d_smp.o
+obj-$(CONFIG_SUN_AUXIO) += auxio.o
+obj-$(CONFIG_PCI) += ebus.o
 
 ifdef CONFIG_SUNOS_EMUL
-O_OBJS += sys_sunos.o sunos_ioctl.o
-endif
-
-ifdef CONFIG_SMP
-O_OBJS += trampoline.o smp.o sun4m_smp.o sun4d_smp.o
-endif
-
-ifdef CONFIG_SUN_AUXIO
-O_OBJS += auxio.o
-endif
-
-ifdef CONFIG_PCI
-O_OBJS += ebus.o
+obj-y += sys_sunos.o sunos_ioctl.o
 endif
 
 head.o: head.S
index d7b3c75546919179d9a254526cbcb2bb369ebe7f..164e144ea15815d73e0a52e1bc80d1710d4cf431 100644 (file)
@@ -1,23 +1,19 @@
-# $Id: Makefile,v 1.34 2000/03/31 04:06:20 davem Exp $
+# $Id: Makefile,v 1.35 2000/12/15 00:41:18 davem Exp $
 # Makefile for Sparc library files..
 #
 
-OBJS  = mul.o rem.o sdiv.o udiv.o umul.o urem.o ashrdi3.o memcpy.o memset.o \
-        strlen.o checksum.o blockops.o memscan.o memcmp.o strncmp.o \
-       strncpy_from_user.o divdi3.o udivdi3.o strlen_user.o \
-       copy_user.o locks.o atomic.o bitops.o debuglocks.o lshrdi3.o \
-       ashldi3.o rwsem.o muldi3.o
-
-lib.a: $(OBJS)
-       $(AR) rcs lib.a $(OBJS)
-       sync
-
 .S.s:
        $(CPP) $(AFLAGS) -ansi -DST_DIV0=0x2 $< -o $*.s
 
 .S.o:
        $(CC) $(AFLAGS) -ansi -DST_DIV0=0x2 -c $< -o $*.o
 
-dep:
+L_TARGET = lib.a
+
+obj-y := mul.o rem.o sdiv.o udiv.o umul.o urem.o ashrdi3.o memcpy.o memset.o \
+         strlen.o checksum.o blockops.o memscan.o memcmp.o strncmp.o \
+        strncpy_from_user.o divdi3.o udivdi3.o strlen_user.o \
+        copy_user.o locks.o atomic.o bitops.o debuglocks.o lshrdi3.o \
+        ashldi3.o rwsem.o muldi3.o
 
 include $(TOPDIR)/Rules.make
index 586eba5bb455eecfff6b3cd32131d97337d7d8e6..29a6e5bd175546b129799bd84309e331864d7807 100644 (file)
@@ -8,7 +8,7 @@
 # Note 2! The CFLAGS definition is now in the main makefile...
 
 O_TARGET := math-emu.o
-O_OBJS   := math.o ashldi3.o
+obj-y    := math.o ashldi3.o
 
 .S.s:
        $(CPP) $(AFLAGS) -ansi $< -o $*.s
index 82bfaf6bf28775acae47afb279f4fe9b88e3af74..fd6be240b7f6ab1a56a2d1c879a2a54a419c6fc1 100644 (file)
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.37 2000/03/31 04:06:22 davem Exp $
+# $Id: Makefile,v 1.38 2000/12/15 00:41:22 davem Exp $
 # Makefile for the linux Sparc-specific parts of the memory manager.
 #
 # Note! Dependencies are done automagically by 'make dep', which also
        $(CC) $(AFLAGS) -ansi -c -o $*.o $<
 
 O_TARGET := mm.o
-O_OBJS   := fault.o init.o loadmmu.o generic.o extable.o btfixup.o
+obj-y    := fault.o init.o loadmmu.o generic.o extable.o btfixup.o
+
 ifeq ($(CONFIG_SUN4),y)
-O_OBJS  += nosrmmu.o
+obj-y   += nosrmmu.o
 else
-O_OBJS  += srmmu.o iommu.o io-unit.o hypersparc.o viking.o tsunami.o swift.o
+obj-y   += srmmu.o iommu.o io-unit.o hypersparc.o viking.o tsunami.o swift.o
 endif
+
 ifdef CONFIG_SMP
-O_OBJS   += nosun4c.o
+obj-y   += nosun4c.o
 else
-O_OBJS   += sun4c.o
+obj-y   += sun4c.o
 endif
 
 include $(TOPDIR)/Rules.make
index f8c41ccdf2131f6b1b05d9ebbe7ebb68507b7c9e..f625a75cb8205641753a8d70edff6bcba26ac099 100644 (file)
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.7 1999/12/21 04:02:21 davem Exp $
+# $Id: Makefile,v 1.8 2000/12/15 00:41:22 davem Exp $
 # Makefile for the Sun Boot PROM interface library under
 # Linux.
 #
@@ -8,20 +8,11 @@
 #
 # Note 2! The CFLAGS definitions are now in the main makefile...
 
-OBJS  = bootstr.o devmap.o devops.o init.o memory.o misc.o mp.o \
-       palloc.o ranges.o segment.o console.o printf.o tree.o
+L_TARGET = promlib.a
 
-ifeq ($(CONFIG_SUN4),y)
-OBJS += sun4prom.o
-endif
+obj-y := bootstr.o devmap.o devops.o init.o memory.o misc.o mp.o \
+        palloc.o ranges.o segment.o console.o printf.o tree.o
 
-all: promlib.a
-
-promlib.a: $(OBJS)
-       $(AR) rcs promlib.a $(OBJS)
-       sync
-
-dep:
-       $(CPP) $(CPPFLAGS) -M *.c > .depend
+obj-$(CONFIG_SUN4) += sun4prom.o
 
 include $(TOPDIR)/Rules.make
index e97248906ed20a94c706e3cd721d42ff425e3899..f95dc46f93347a9df3a998d795a1a3d0b6bc4f13 100644 (file)
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.45 2000/07/18 15:24:28 jj Exp $
+# $Id: Makefile,v 1.46 2000/12/14 22:57:26 davem Exp $
 # sparc64/Makefile
 #
 # Makefile for the architecture dependent flags and dependencies on the
@@ -67,7 +67,7 @@ LINKFLAGS = -T arch/sparc64/vmlinux.lds
 
 HEAD := arch/sparc64/kernel/head.o arch/sparc64/kernel/init_task.o
 
-SUBDIRS := $(SUBDIRS) arch/sparc64/kernel arch/sparc64/lib arch/sparc64/mm \
+SUBDIRS += arch/sparc64/kernel arch/sparc64/lib arch/sparc64/mm \
        arch/sparc64/prom
 
 ifneq ($(CONFIG_SOLARIS_EMUL),n)
index 9bbc2e1931cf9c6d7e32eb8a2daaaafb71921a7d..8648bb190b69b1cee69ffc1242b0523cc597b198 100644 (file)
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.62 2000/08/12 08:35:53 ecd Exp $
+# $Id: Makefile,v 1.63 2000/12/14 22:57:25 davem Exp $
 # Makefile for the linux kernel.
 #
 # Note! Dependencies are done automagically by 'make dep', which also
@@ -18,42 +18,29 @@ SH = $(CONFIG_SHELL)
 all: kernel.o head.o init_task.o
 
 O_TARGET := kernel.o
-O_OBJS   := process.o setup.o cpu.o idprom.o \
-           traps.o devices.o auxio.o \
-           irq.o ptrace.o time.o sys_sparc.o signal.o \
-           unaligned.o central.o pci.o starfire.o semaphore.o \
-           power.o sbus.o iommu_common.o
-OX_OBJS  := sparc64_ksyms.o
 
-ifdef CONFIG_PCI
-  O_OBJS += ebus.o pci_common.o pci_iommu.o \
-           pci_psycho.o pci_sabre.o 
-endif
+export-objs    := sparc64_ksyms.o
+obj-y          := process.o setup.o cpu.o idprom.o \
+                  traps.o devices.o auxio.o \
+                  irq.o ptrace.o time.o sys_sparc.o signal.o \
+                  unaligned.o central.o pci.o starfire.o semaphore.o \
+                  power.o sbus.o iommu_common.o sparc64_ksyms.o
+
+obj-$(CONFIG_PCI)       += ebus.o pci_common.o pci_iommu.o \
+                           pci_psycho.o pci_sabre.o 
+obj-$(CONFIG_SMP)       += smp.o trampoline.o
+obj-$(CONFIG_SPARC32_COMPAT) += sys32.o sys_sparc32.o signal32.o ioctl32.o
+obj-$(CONFIG_BINFMT_ELF32) += binfmt_elf32.o
+obj-$(CONFIG_BINFMT_AOUT32) += binfmt_aout32.o
 
 ifdef CONFIG_SUNOS_EMUL
-  O_OBJS += sys_sunos32.o sunos_ioctl32.o
+  obj-y += sys_sunos32.o sunos_ioctl32.o
 else
   ifdef CONFIG_SOLARIS_EMUL
-    O_OBJS += sys_sunos32.o sunos_ioctl32.o
+    obj-y += sys_sunos32.o sunos_ioctl32.o
   endif
 endif
 
-ifdef CONFIG_SMP
-O_OBJS += smp.o trampoline.o
-endif
-
-ifdef CONFIG_SPARC32_COMPAT
-  O_OBJS += sys32.o sys_sparc32.o signal32.o ioctl32.o
-endif
-
-ifdef CONFIG_BINFMT_ELF32
-  O_OBJS += binfmt_elf32.o
-endif
-
-ifdef CONFIG_BINFMT_AOUT32
-  O_OBJS += binfmt_aout32.o
-endif
-
 head.o: head.S ttable.S itlb_base.S dtlb_base.S dtlb_backend.S dtlb_prot.S \
        etrap.S rtrap.S winfixup.S entry.S
        $(CC) $(AFLAGS) -ansi -c $*.S -o $*.o
index 1abef824f63fce1effb4b249f304ce600ec64175..2b697dd8726c0246c30d10c358be77d74b378e7b 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: pci.c,v 1.19 2000/11/08 04:49:17 davem Exp $
+/* $Id: pci.c,v 1.20 2000/12/14 22:57:25 davem Exp $
  * pci.c: UltraSparc PCI controller support.
  *
  * Copyright (C) 1997, 1998, 1999 David S. Miller (davem@redhat.com)
@@ -229,116 +229,4 @@ char * __init pcibios_setup(char *str)
        return str;
 }
 
-asmlinkage int sys_pciconfig_read(unsigned long bus,
-                                 unsigned long dfn,
-                                 unsigned long off,
-                                 unsigned long len,
-                                 unsigned char *buf)
-{
-       struct pci_dev *dev;
-       u8 byte;
-       u16 word;
-       u32 dword;
-       int err = 0;
-
-       if(!capable(CAP_SYS_ADMIN))
-               return -EPERM;
-
-       dev = pci_find_slot(bus, dfn);
-       if (!dev) {
-               /* Xfree86 is such a turd, it does not check the
-                * return value and just relies on the buffer being
-                * set to all 1's to mean "device not present".
-                */
-               switch(len) {
-               case 1:
-                       put_user(0xff, (unsigned char *)buf);
-                       break;
-               case 2:
-                       put_user(0xffff, (unsigned short *)buf);
-                       break;
-               case 4:
-                       put_user(0xffffffff, (unsigned int *)buf);
-                       break;
-               default:
-                       err = -EINVAL;
-                       break;
-               };
-               goto out;
-       }
-
-       switch(len) {
-       case 1:
-               pci_read_config_byte(dev, off, &byte);
-               put_user(byte, (unsigned char *)buf);
-               break;
-       case 2:
-               pci_read_config_word(dev, off, &word);
-               put_user(word, (unsigned short *)buf);
-               break;
-       case 4:
-               pci_read_config_dword(dev, off, &dword);
-               put_user(dword, (unsigned int *)buf);
-               break;
-
-       default:
-               err = -EINVAL;
-               break;
-       };
-out:
-       return err;
-}
-
-asmlinkage int sys_pciconfig_write(unsigned long bus,
-                                  unsigned long dfn,
-                                  unsigned long off,
-                                  unsigned long len,
-                                  unsigned char *buf)
-{
-       struct pci_dev *dev;
-       u8 byte;
-       u16 word;
-       u32 dword;
-       int err = 0;
-
-       if(!capable(CAP_SYS_ADMIN))
-               return -EPERM;
-       dev = pci_find_slot(bus, dfn);
-       if (!dev) {
-               /* See commentary above about Xfree86 */
-               goto out;
-       }
-
-       switch(len) {
-       case 1:
-               err = get_user(byte, (u8 *)buf);
-               if(err)
-                       break;
-               pci_write_config_byte(dev, off, byte);
-               break;
-
-       case 2:
-               err = get_user(word, (u16 *)buf);
-               if(err)
-                       break;
-               pci_write_config_byte(dev, off, word);
-               break;
-
-       case 4:
-               err = get_user(dword, (u32 *)buf);
-               if(err)
-                       break;
-               pci_write_config_byte(dev, off, dword);
-               break;
-
-       default:
-               err = -EINVAL;
-               break;
-
-       };
-
-out:
-       return err;
-}
-
 #endif /* !(CONFIG_PCI) */
index 0964409c9a919b300b6c519cdbeaec9f034b8d78..775c986c850aa1872e86831d13e136a6084a1ca1 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: sys_sparc32.c,v 1.168 2000/12/11 18:59:35 davem Exp $
+/* $Id: sys_sparc32.c,v 1.171 2000/12/13 16:34:55 davem Exp $
  * sys_sparc32.c: Conversion between 32bit and 64bit native syscalls.
  *
  * Copyright (C) 1997,1998 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
@@ -865,17 +865,13 @@ asmlinkage long sys32_fcntl(unsigned int fd, unsigned int cmd, unsigned long arg
                        mm_segment_t old_fs;
                        long ret;
                        
-                       if(get_flock(&f, (struct flock32 *)arg))
+                       if (get_flock(&f, (struct flock32 *)arg))
                                return -EFAULT;
                        old_fs = get_fs(); set_fs (KERNEL_DS);
                        ret = sys_fcntl(fd, cmd, (unsigned long)&f);
                        set_fs (old_fs);
                        if (ret) return ret;
-                       if (f.l_start >= 0x7fffffffUL ||
-                           f.l_len >= 0x7fffffffUL ||
-                           f.l_start + f.l_len >= 0x7fffffffUL)
-                               return -EOVERFLOW;
-                       if(put_flock(&f, (struct flock32 *)arg))
+                       if (put_flock(&f, (struct flock32 *)arg))
                                return -EFAULT;
                        return 0;
                }
@@ -2966,8 +2962,6 @@ static int copy_strings32(int argc, u32 * argv, struct linux_binprm *bprm)
 
                        err = copy_from_user(kaddr + offset, (char *)A(str),
                                             bytes_to_copy);
-                       flush_dcache_page(page);
-                       flush_page_to_ram(page);
                        kunmap(page);
 
                        if (err)
@@ -3453,7 +3447,7 @@ asmlinkage int sys32_get_kernel_syms(struct kernel_sym32 *table)
        set_fs (KERNEL_DS);
        sys_get_kernel_syms(tbl);
        set_fs (old_fs);
-       for (i = 0; i < len; i++, table += sizeof (struct kernel_sym32)) {
+       for (i = 0; i < len; i++, table++) {
                if (put_user (tbl[i].value, &table->value) ||
                    copy_to_user (table->name, tbl[i].name, 60))
                        break;
index 77531321d387e4c9350cc2840874cb5f52be3458..7f8dc10535ba3fdac4437638325facf8c28d0ad0 100644 (file)
@@ -1,29 +1,21 @@
-# $Id: Makefile,v 1.24 2000/11/01 07:33:47 davem Exp $
+# $Id: Makefile,v 1.25 2000/12/14 22:57:25 davem Exp $
 # Makefile for Sparc64 library files..
 #
 
-CFLAGS := $(CFLAGS)
-
-OBJS  = PeeCeeI.o blockops.o debuglocks.o strlen.o strncmp.o \
-       memscan.o strncpy_from_user.o strlen_user.o memcmp.o checksum.o \
-       VIScopy.o VISbzero.o VISmemset.o VIScsum.o VIScsumcopy.o \
-       VIScsumcopyusr.o VISsave.o atomic.o rwlock.o bitops.o \
-       dec_and_lock.o U3memcpy.o U3copy_from_user.o U3copy_to_user.o \
-       U3copy_in_user.o
-
-lib.a: $(OBJS)
-       $(AR) rcs lib.a $(OBJS)
-       sync
-
-VIScopy.o: VIScopy.S VIS.h
-VISbzero.o: VISbzero.S VIS.h
-
 .S.s:
        $(CPP) $(AFLAGS) -ansi $< -o $*.s
 
 .S.o:
        $(CC) $(AFLAGS) -ansi -c $< -o $*.o
 
-dep:
+CFLAGS := $(CFLAGS)
+
+L_TARGET = lib.a
+obj-y := PeeCeeI.o blockops.o debuglocks.o strlen.o strncmp.o \
+        memscan.o strncpy_from_user.o strlen_user.o memcmp.o checksum.o \
+        VIScopy.o VISbzero.o VISmemset.o VIScsum.o VIScsumcopy.o \
+        VIScsumcopyusr.o VISsave.o atomic.o rwlock.o bitops.o \
+        dec_and_lock.o U3memcpy.o U3copy_from_user.o U3copy_to_user.o \
+        U3copy_in_user.o
 
 include $(TOPDIR)/Rules.make
index 215583800c6a1a67f0bf4708f4a8e236cae87a4c..b4d79d177b811662158b7f96f7c1a1cd68dcccfa 100644 (file)
@@ -8,7 +8,7 @@
 # Note 2! The CFLAGS definition is now in the main makefile...
 
 O_TARGET := math-emu.o
-O_OBJS   := math.o
+obj-y    := math.o
 
 EXTRA_CFLAGS = -I. -I$(TOPDIR)/include/math-emu -w
 
index 36b871af5cbdca907504b2628dcf2edb950c70c3..031421cac2929187b1076c8c07cfe29b6f6d23f4 100644 (file)
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.7 2000/03/31 04:06:24 davem Exp $
+# $Id: Makefile,v 1.8 2000/12/14 22:57:25 davem Exp $
 # Makefile for the linux Sparc64-specific parts of the memory manager.
 #
 # Note! Dependencies are done automagically by 'make dep', which also
@@ -14,6 +14,6 @@
        $(CC) $(AFLAGS) -ansi -c $< -o $*.o
 
 O_TARGET := mm.o
-O_OBJS   := ultra.o fault.o init.o generic.o extable.o modutil.o
+obj-y    := ultra.o fault.o init.o generic.o extable.o modutil.o
 
 include $(TOPDIR)/Rules.make
index 04471ab8510ce251f09284f6f98082c423b18bcd..7387b9c24dfa46b31c779070f394f64397c9fa0c 100644 (file)
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.6 2000/03/31 04:06:25 davem Exp $
+# $Id: Makefile,v 1.7 2000/12/14 22:57:25 davem Exp $
 # Makefile for the Sun Boot PROM interface library under
 # Linux.
 #
@@ -8,14 +8,9 @@
 #
 # Note 2! The CFLAGS definitions are now in the main makefile...
 
-OBJS  = bootstr.o devops.o init.o memory.o misc.o \
-        tree.o console.o printf.o p1275.o map.o
-
-all: promlib.a
-
-promlib.a: $(OBJS)
-       $(AR) rcs promlib.a $(OBJS)
-       sync
+L_TARGET = promlib.a
+obj-y   := bootstr.o devops.o init.o memory.o misc.o \
+          tree.o console.o printf.o p1275.o map.o
 
 .S.s:
        $(CPP) $(AFLAGS) -ansi $< -o $*.s
@@ -23,7 +18,4 @@ promlib.a: $(OBJS)
 .S.o:
        $(CC) $(AFLAGS) -ansi -c $< -o $*.o
 
-dep:
-       $(CPP) $(CPPFLAGS) -M *.c > .depend
-
 include $(TOPDIR)/Rules.make
index 51598f7273cedfb627fe0807a30b1afc4aa85209..d3a2880d80b6ddfad78926c95482f6fa1c846e64 100644 (file)
@@ -7,10 +7,7 @@
 #
 # Note 2! The CFLAGS definition is now in the main makefile...
 
-O_TARGET := solaris.o
-O_OBJS   := entry64.o fs.o misc.o signal.o systbl.o socket.o ioctl.o ipc.o socksys.o timod.o
 ifeq ($(CONFIG_SOLARIS_EMUL),m)
-M_OBJS   := $(O_TARGET)
 CPPFLAGS = $(MODFLAGS)
 endif
 
@@ -20,8 +17,18 @@ endif
 .S.o:
        $(CC) $(AFLAGS) $(CPPFLAGS) -ansi -c $< -o $*.o
 
+list-multi := solaris.o
+
+solaris-objs := entry64.o fs.o misc.o signal.o systbl.o socket.o \
+               ioctl.o ipc.o socksys.o timod.o
+
+obj-$(CONFIG_SOLARIS_EMUL) += solaris.o
+
 ifneq ($(CONFIG_SOLARIS_EMUL),y)
 do_it_all:
 endif
 
+solaris.o: $(solaris-objs)
+       $(LD) -r -o $@ $(solaris-objs)
+
 include $(TOPDIR)/Rules.make
index ca8bf25f3915252de13d4e0cf17b0e8ea2d28710..15c8736efb5d18c4f4807480b50a70ba86e8d15f 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: misc.c,v 1.30 2000/08/29 07:01:54 davem Exp $
+/* $Id: misc.c,v 1.31 2000/12/14 22:57:25 davem Exp $
  * misc.c: Miscelaneous syscall emulation for Solaris
  *
  * Copyright (C) 1997,1998 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
@@ -763,6 +763,7 @@ int init_solaris_emul(void)
 {
        register_exec_domain(&solaris_exec_domain);
        init_socksys();
+       return 0;
 }
 #endif
 
index 462ceea7b9401921f0dbe144b0664f9c6c6f8108..b8ee715c80eba970979010196b70ec6e7c7c4db1 100644 (file)
@@ -43,9 +43,5 @@ subdir-$(CONFIG_HAMRADIO)     += net/hamradio
 subdir-$(CONFIG_I2C)           += i2c
 subdir-$(CONFIG_ACPI)          += acpi
 
-
-# Subdirectories that should be entered when MAKING_MODULES=1, even if set to 'y'.
-both-m         := $(filter $(mod-subdirs), $(subdir-y))
-
 include $(TOPDIR)/Rules.make
 
index c5f3d5ed871912d02a795ab5f7e3ba5a17d8e832..ccac0a12a667446be6bfbab604d2678bd49f5a26 100644 (file)
@@ -2,32 +2,36 @@
 # Makefile for the Linux ACPI interpreter
 #
 
-SUB_DIRS        := 
-MOD_SUB_DIRS    := $(SUB_DIRS)
-MOD_IN_SUB_DIRS :=
-ALL_SUB_DIRS    := $(SUB_DIRS)
-
 O_TARGET := acpi.o
-O_OBJS   :=
-M_OBJS   :=
+
+export-objs := ksyms.o
 
 export ACPI_CFLAGS
 ACPI_CFLAGS := -D_LINUX
 
+#
+# CONFIG_ACPI_KERNEL_CONFIG is currently only IA64
+#
+ifdef CONFIG_ACPI_KERNEL_CONFIG
+  ACPI_CFLAGS += -DCONFIG_ACPI_KERNEL_CONFIG_ONLY
+endif
+
 EXTRA_CFLAGS += -I./include
 
 EXTRA_CFLAGS += $(ACPI_CFLAGS)
 
-# if the interpreter is used, it overrides arch/i386/kernel/acpi.c
-ifeq ($(CONFIG_ACPI_INTERPRETER),y)
+acpi-subdirs := common dispatcher events hardware \
+               interpreter namespace parser resources tables
 
-  SUB_DIRS += common dispatcher events hardware\
-             interpreter namespace parser resources tables
+subdir-$(CONFIG_ACPI) += $(acpi-subdirs)
 
-  ACPI_OBJS := $(patsubst %,%.o,$(SUB_DIRS))
-  ACPI_OBJS += $(patsubst %.c,%.o,$(wildcard *.c))
+obj-$(CONFIG_ACPI) := $(patsubst %,%.o,$(acpi-subdirs))
+obj-$(CONFIG_ACPI) += os.o ksyms.o
 
-  O_OBJS += $(ACPI_OBJS)
+ifdef CONFIG_ACPI_KERNEL_CONFIG
+  obj-$(CONFIG_ACPI) += acpiconf.o osconf.o
+else
+  obj-$(CONFIG_ACPI) += driver.o cmbatt.o cpu.o ec.o ksyms.o sys.o table.o
 endif
 
 include $(TOPDIR)/Rules.make
diff --git a/drivers/acpi/cmbatt.c b/drivers/acpi/cmbatt.c
new file mode 100644 (file)
index 0000000..ce78087
--- /dev/null
@@ -0,0 +1,141 @@
+/*
+ *  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
+ */
+
+#include <linux/kernel.h>
+#include <linux/types.h>
+#include <linux/slab.h>
+#include <linux/pm.h>
+#include <linux/acpi.h>
+#include <linux/delay.h>
+#include <asm/io.h>
+#include "acpi.h"
+#include "driver.h"
+
+#define _COMPONENT     OS_DEPENDENT
+       MODULE_NAME     ("cmbatt")
+
+#define ACPI_CMBATT_HID                "PNP0C0A"
+
+#define ACPI_BATT_PRESENT      0x10
+
+#define ACPI_MAX_BATTERIES     0x8
+
+struct cmbatt_context
+{
+       char                    UID[9];
+       u8                      is_present;
+       ACPI_HANDLE             handle;
+};
+
+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[ACPI_MAX_BATTERIES];
+
+/*
+ * 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 (!ACPI_SUCCESS(acpi_get_object_info(handle, &info))) {
+               printk(KERN_ERR "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 "ACPI: No UID but more than 1 battery\n");
+       }
+
+       if ((info.valid & ACPI_VALID_STA) &&
+           (info.current_status & ACPI_BATT_PRESENT)) {
+
+               ACPI_BUFFER buf;
+
+               printk("ACPI: Found a battery\n");
+               batt_list[batt_count].is_present = TRUE;
+
+               buf.length = 0;
+               buf.pointer = NULL;
+
+               /* determine buffer length needed */
+               if (acpi_evaluate_object(handle, "_BST", NULL, &buf) != AE_BUFFER_OVERFLOW)
+                       return AE_OK;
+
+               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 "Could not get battery status\n");
+                       kfree (buf.pointer);
+                       return AE_OK;
+               }
+
+               kfree(buf.pointer);
+
+               /* TODO: parse the battery data */
+               /* TODO: add proc interface */
+       }
+       else {
+               printk("ACPI: Found an empty battery socket\n");
+               batt_list[batt_count].is_present = FALSE;
+       }
+
+       batt_list[batt_count].handle = handle;
+
+       batt_count++;
+
+       return (AE_OK);
+}
+
+int
+acpi_cmbatt_init(void)
+{
+       acpi_get_devices(ACPI_CMBATT_HID, 
+                       acpi_found_cmbatt,
+                       NULL,
+                       NULL);
+
+       return 0;
+}
+
+int
+acpi_cmbatt_terminate(void)
+{
+       /* TODO */      
+       /* walk list of batteries */
+       /* free their context and release resources */
+       return 0;
+}
index edd89713320bbf7177a46838fb379b30259e39fb..751ef5de8f1902c93309a10e6556b84e3b5e6d78 100644 (file)
@@ -2,26 +2,14 @@
 # Makefile for all Linux ACPI interpreter subdirectories
 #
 
-SUB_DIRS        := 
-MOD_SUB_DIRS    := $(SUB_DIRS)
-MOD_IN_SUB_DIRS :=
-ALL_SUB_DIRS    := $(SUB_DIRS)
-
 O_TARGET := ../$(shell basename `pwd`).o
-O_OBJS   :=
-M_OBJS   :=
 
-ACPI_OBJS := $(patsubst %.c,%.o,$(wildcard *.c))
+obj-$(CONFIG_ACPI) := $(patsubst %.c,%.o,$(wildcard *.c))
 
 EXTRA_CFLAGS += -I../include
 
 EXTRA_CFLAGS += $(ACPI_CFLAGS)
 
-# if the interpreter is used, it overrides arch/i386/kernel/acpi.c
-ifeq ($(CONFIG_ACPI_INTERPRETER),y)
-  O_OBJS := $(ACPI_OBJS)
-endif
-
 include $(TOPDIR)/Rules.make
 
 clean:
index cd67322b4621bdadf2bf33d5aab8806313c87307..b7a64e5b6166800de70068d106193e8dd84b7195 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: cmalloc - local memory allocation routines
- *              $Revision: 73 $
+ *              $Revision: 79 $
  *
  *****************************************************************************/
 
@@ -57,11 +57,15 @@ _cm_allocate (
        u32                     line)
 {
        void                    *address = NULL;
+       DEBUG_ONLY_MEMBERS (\
+       ACPI_STATUS             status)
+
 
        /* Check for an inadvertent size of zero bytes */
 
        if (!size) {
-               REPORT_ERROR ("Cm_allocate: Attempt to allocate zero bytes");
+               _REPORT_ERROR (module, line, component,
+                               ("Cm_allocate: Attempt to allocate zero bytes\n"));
                size = 1;
        }
 
@@ -70,7 +74,7 @@ _cm_allocate (
                /* Report allocation error */
 
                _REPORT_ERROR (module, line, component,
-                       "Cm_allocate: Memory allocation failure");
+                               ("Cm_allocate: Could not allocate size %X\n", size));
 
                return (NULL);
        }
@@ -103,11 +107,15 @@ _cm_callocate (
        u32                     line)
 {
        void                    *address = NULL;
+       DEBUG_ONLY_MEMBERS (\
+       ACPI_STATUS             status)
+
 
        /* Check for an inadvertent size of zero bytes */
 
        if (!size) {
-               REPORT_ERROR ("Cm_callocate: Attempt to allocate zero bytes");
+               _REPORT_ERROR (module, line, component,
+                               ("Cm_callocate: Attempt to allocate zero bytes\n"));
                return (NULL);
        }
 
@@ -118,8 +126,7 @@ _cm_callocate (
                /* Report allocation error */
 
                _REPORT_ERROR (module, line, component,
-                       "Cm_callocate: Memory allocation failure");
-
+                               ("Cm_callocate: Could not allocate size %X\n", size));
                return (NULL);
        }
 
@@ -153,7 +160,7 @@ _cm_free (
 
        if (NULL == address) {
                _REPORT_ERROR (module, line, component,
-                       "_Cm_free: Trying to delete a NULL address.");
+                       ("_Cm_free: Trying to delete a NULL address\n"));
 
                return;
        }
index 4309ac465dd8ce297462a171733eae941e230078..5146b09c56fb97267ad8732e95844c0744db7a11 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: cmclib - Local implementation of C library functions
- * $Revision: 24 $
+ * $Revision: 28 $
  *
  *****************************************************************************/
 
         MODULE_NAME         ("cmclib")
 
 
-#ifdef _MSC_VER                 /* disable some level-4 warnings for VC++ */
-#pragma warning(disable:4706)   /* warning C4706: assignment within conditional expression */
-#endif
-
 #ifndef ACPI_USE_SYSTEM_CLIBRARY
 
 /*******************************************************************************
@@ -371,146 +367,146 @@ acpi_cm_memset (
 #define POSITIVE    0
 
 
-#define _XA     0x00    /* extra alphabetic - not supported */
-#define _XS     0x40    /* extra space */
-#define _BB     0x00    /* BEL, BS, etc. - not supported */
-#define _CN     0x20    /* CR, FF, HT, NL, VT */
-#define _DI     0x04    /* '0'-'9' */
-#define _LO     0x02    /* 'a'-'z' */
-#define _PU     0x10    /* punctuation */
-#define _SP     0x08    /* space */
-#define _UP     0x01    /* 'A'-'Z' */
-#define _XD     0x80    /* '0'-'9', 'A'-'F', 'a'-'f' */
-
-const u8 _ctype[257] = {
-       _CN,            /* 0x0      0.     */
-       _CN,            /* 0x1      1.     */
-       _CN,            /* 0x2      2.     */
-       _CN,            /* 0x3      3.     */
-       _CN,            /* 0x4      4.     */
-       _CN,            /* 0x5      5.     */
-       _CN,            /* 0x6      6.     */
-       _CN,            /* 0x7      7.     */
-       _CN,            /* 0x8      8.     */
-       _CN|_SP,        /* 0x9      9.     */
-       _CN|_SP,        /* 0xA     10.     */
-       _CN|_SP,        /* 0xB     11.     */
-       _CN|_SP,        /* 0xC     12.     */
-       _CN|_SP,        /* 0xD     13.     */
-       _CN,            /* 0xE     14.     */
-       _CN,            /* 0xF     15.     */
-       _CN,            /* 0x10    16.     */
-       _CN,            /* 0x11    17.     */
-       _CN,            /* 0x12    18.     */
-       _CN,            /* 0x13    19.     */
-       _CN,            /* 0x14    20.     */
-       _CN,            /* 0x15    21.     */
-       _CN,            /* 0x16    22.     */
-       _CN,            /* 0x17    23.     */
-       _CN,            /* 0x18    24.     */
-       _CN,            /* 0x19    25.     */
-       _CN,            /* 0x1A    26.     */
-       _CN,            /* 0x1B    27.     */
-       _CN,            /* 0x1C    28.     */
-       _CN,            /* 0x1D    29.     */
-       _CN,            /* 0x1E    30.     */
-       _CN,            /* 0x1F    31.     */
-       _XS|_SP,        /* 0x20    32. ' ' */
-       _PU,            /* 0x21    33. '!' */
-       _PU,            /* 0x22    34. '"' */
-       _PU,            /* 0x23    35. '#' */
-       _PU,            /* 0x24    36. '$' */
-       _PU,            /* 0x25    37. '%' */
-       _PU,            /* 0x26    38. '&' */
-       _PU,            /* 0x27    39. ''' */
-       _PU,            /* 0x28    40. '(' */
-       _PU,            /* 0x29    41. ')' */
-       _PU,            /* 0x2A    42. '*' */
-       _PU,            /* 0x2B    43. '+' */
-       _PU,            /* 0x2C    44. ',' */
-       _PU,            /* 0x2D    45. '-' */
-       _PU,            /* 0x2E    46. '.' */
-       _PU,            /* 0x2F    47. '/' */
-       _XD|_DI,        /* 0x30    48. '0' */
-       _XD|_DI,        /* 0x31    49. '1' */
-       _XD|_DI,        /* 0x32    50. '2' */
-       _XD|_DI,        /* 0x33    51. '3' */
-       _XD|_DI,        /* 0x34    52. '4' */
-       _XD|_DI,        /* 0x35    53. '5' */
-       _XD|_DI,        /* 0x36    54. '6' */
-       _XD|_DI,        /* 0x37    55. '7' */
-       _XD|_DI,        /* 0x38    56. '8' */
-       _XD|_DI,        /* 0x39    57. '9' */
-       _PU,            /* 0x3A    58. ':' */
-       _PU,            /* 0x3B    59. ';' */
-       _PU,            /* 0x3C    60. '<' */
-       _PU,            /* 0x3D    61. '=' */
-       _PU,            /* 0x3E    62. '>' */
-       _PU,            /* 0x3F    63. '?' */
-       _PU,            /* 0x40    64. '@' */
-       _XD|_UP,        /* 0x41    65. 'A' */
-       _XD|_UP,        /* 0x42    66. 'B' */
-       _XD|_UP,        /* 0x43    67. 'C' */
-       _XD|_UP,        /* 0x44    68. 'D' */
-       _XD|_UP,        /* 0x45    69. 'E' */
-       _XD|_UP,        /* 0x46    70. 'F' */
-       _UP,            /* 0x47    71. 'G' */
-       _UP,            /* 0x48    72. 'H' */
-       _UP,            /* 0x49    73. 'I' */
-       _UP,            /* 0x4A    74. 'J' */
-       _UP,            /* 0x4B    75. 'K' */
-       _UP,            /* 0x4C    76. 'L' */
-       _UP,            /* 0x4D    77. 'M' */
-       _UP,            /* 0x4E    78. 'N' */
-       _UP,            /* 0x4F    79. 'O' */
-       _UP,            /* 0x50    80. 'P' */
-       _UP,            /* 0x51    81. 'Q' */
-       _UP,            /* 0x52    82. 'R' */
-       _UP,            /* 0x53    83. 'S' */
-       _UP,            /* 0x54    84. 'T' */
-       _UP,            /* 0x55    85. 'U' */
-       _UP,            /* 0x56    86. 'V' */
-       _UP,            /* 0x57    87. 'W' */
-       _UP,            /* 0x58    88. 'X' */
-       _UP,            /* 0x59    89. 'Y' */
-       _UP,            /* 0x5A    90. 'Z' */
-       _PU,            /* 0x5B    91. '[' */
-       _PU,            /* 0x5C    92. '\' */
-       _PU,            /* 0x5D    93. ']' */
-       _PU,            /* 0x5E    94. '^' */
-       _PU,            /* 0x5F    95. '_' */
-       _PU,            /* 0x60    96. '`' */
-       _XD|_LO,        /* 0x61    97. 'a' */
-       _XD|_LO,        /* 0x62    98. 'b' */
-       _XD|_LO,        /* 0x63    99. 'c' */
-       _XD|_LO,        /* 0x64   100. 'd' */
-       _XD|_LO,        /* 0x65   101. 'e' */
-       _XD|_LO,        /* 0x66   102. 'f' */
-       _LO,            /* 0x67   103. 'g' */
-       _LO,            /* 0x68   104. 'h' */
-       _LO,            /* 0x69   105. 'i' */
-       _LO,            /* 0x6A   106. 'j' */
-       _LO,            /* 0x6B   107. 'k' */
-       _LO,            /* 0x6C   108. 'l' */
-       _LO,            /* 0x6D   109. 'm' */
-       _LO,            /* 0x6E   110. 'n' */
-       _LO,            /* 0x6F   111. 'o' */
-       _LO,            /* 0x70   112. 'p' */
-       _LO,            /* 0x71   113. 'q' */
-       _LO,            /* 0x72   114. 'r' */
-       _LO,            /* 0x73   115. 's' */
-       _LO,            /* 0x74   116. 't' */
-       _LO,            /* 0x75   117. 'u' */
-       _LO,            /* 0x76   118. 'v' */
-       _LO,            /* 0x77   119. 'w' */
-       _LO,            /* 0x78   120. 'x' */
-       _LO,            /* 0x79   121. 'y' */
-       _LO,            /* 0x7A   122. 'z' */
-       _PU,            /* 0x7B   123. '{' */
-       _PU,            /* 0x7C   124. '|' */
-       _PU,            /* 0x7D   125. '}' */
-       _PU,            /* 0x7E   126. '~' */
-       _CN,            /* 0x7F   127.     */
+#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    */
@@ -522,10 +518,10 @@ const u8 _ctype[257] = {
        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* 0xF0 to 0x100   */
 };
 
-#define IS_UPPER(c)  (_ctype[(unsigned char)(c)] & (_UP))
-#define IS_LOWER(c)  (_ctype[(unsigned char)(c)] & (_LO))
-#define IS_DIGIT(c)  (_ctype[(unsigned char)(c)] & (_DI))
-#define IS_SPACE(c)  (_ctype[(unsigned char)(c)] & (_SP))
+#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))
 
 
 /*******************************************************************************
@@ -628,7 +624,7 @@ acpi_cm_strstr (
                return (NULL);
        }
 
-       /* Walk entire string, uppercasing the letters */
+       /* Walk entire string, comparing the letters */
 
        for (string = string1; *string2; ) {
                if (*string2 != *string) {
index 08b498601755070b116d6ac24cb9d72ca600bf4b..293c728905d62365185d5827c649f06c9a3c800e 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: cmcopy - Internal to external object translation utilities
- *              $Revision: 56 $
+ *              $Revision: 59 $
  *
  *****************************************************************************/
 
@@ -63,7 +63,7 @@ PKG_SEARCH_INFO                 level[MAX_PACKAGE_DEPTH];
  *
  ******************************************************************************/
 
-ACPI_STATUS
+static ACPI_STATUS
 acpi_cm_build_external_simple_object (
        ACPI_OPERAND_OBJECT     *internal_obj,
        ACPI_OBJECT             *external_obj,
@@ -199,7 +199,7 @@ acpi_cm_build_external_simple_object (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+static ACPI_STATUS
 acpi_cm_build_external_package_object (
        ACPI_OPERAND_OBJECT     *internal_obj,
        u8                      *buffer,
@@ -487,6 +487,10 @@ acpi_cm_build_internal_simple_object (
 }
 
 
+#ifdef ACPI_FUTURE_IMPLEMENTATION
+
+/* Code to convert packages that are parameters to control methods */
+
 /******************************************************************************
  *
  * FUNCTION:    Acpi_cm_build_internal_package_object
@@ -506,7 +510,7 @@ acpi_cm_build_internal_simple_object (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+static ACPI_STATUS
 acpi_cm_build_internal_package_object (
        ACPI_OPERAND_OBJECT     *internal_obj,
        u8                      *buffer,
@@ -641,6 +645,8 @@ acpi_cm_build_internal_package_object (
        }   /* while (1)  */
 }
 
+#endif /* Future implementation */
+
 
 /******************************************************************************
  *
@@ -667,6 +673,10 @@ acpi_cm_build_internal_object (
                /*
                 * 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_build_internal_package_object(Internal_obj,
index 8e5fc096969bf4efd3f283be19f3886fb891ed3d..a55372d5c48918567367acaea0a916078ecf2019 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: cmdebug - Debug print routines
- *              $Revision: 60 $
+ *              $Revision: 61 $
  *
  *****************************************************************************/
 
@@ -118,7 +118,7 @@ function_trace_ptr (
 
        acpi_gbl_nesting_level++;
        debug_print (module_name, line_number, component_id, TRACE_FUNCTIONS,
-                        " %2.2ld Entered Function: %s, 0x%p\n",
+                        " %2.2ld Entered Function: %s, %p\n",
                         acpi_gbl_nesting_level, function_name, pointer);
 }
 
@@ -184,7 +184,7 @@ function_trace_u32 (
 
        acpi_gbl_nesting_level++;
        debug_print (module_name, line_number, component_id, TRACE_FUNCTIONS,
-                        " %2.2ld Entered Function: %s, 0x%lX\n",
+                        " %2.2ld Entered Function: %s, %lX\n",
                         acpi_gbl_nesting_level, function_name, integer);
 }
 
@@ -285,7 +285,7 @@ function_value_exit (
 {
 
        debug_print (module_name, line_number, component_id, TRACE_FUNCTIONS,
-                        " %2.2ld Exiting Function: %s, 0x%X\n",
+                        " %2.2ld Exiting Function: %s, %X\n",
                         acpi_gbl_nesting_level, function_name, value);
 
        acpi_gbl_nesting_level--;
@@ -319,7 +319,7 @@ function_ptr_exit (
 {
 
        debug_print (module_name, line_number, component_id, TRACE_FUNCTIONS,
-                        " %2.2ld Exiting Function: %s, 0x%p\n",
+                        " %2.2ld Exiting Function: %s, %p\n",
                         acpi_gbl_nesting_level, function_name, ptr);
 
        acpi_gbl_nesting_level--;
index 9eca0ca2976f6efbadbe7a7e011713b123b15067..a6e74c12f142b8a453f792f0078703017848dc74 100644 (file)
@@ -1,9 +1,9 @@
-/******************************************************************************
+/*******************************************************************************
  *
  * Module Name: cmdelete - object deletion and reference count utilities
- *              $Revision: 53 $
+ *              $Revision: 60 $
  *
- *****************************************************************************/
+ ******************************************************************************/
 
 /*
  *  Copyright (C) 2000 R. Byron Moore
@@ -34,7 +34,7 @@
         MODULE_NAME         ("cmdelete")
 
 
-/******************************************************************************
+/*******************************************************************************
  *
  * FUNCTION:    Acpi_cm_delete_internal_obj
  *
@@ -52,6 +52,7 @@ acpi_cm_delete_internal_obj (
        ACPI_OPERAND_OBJECT     *object)
 {
        void                    *obj_pointer = NULL;
+       ACPI_OPERAND_OBJECT     *handler_desc;
 
 
        if (!object) {
@@ -120,6 +121,36 @@ acpi_cm_delete_internal_obj (
                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;
        }
@@ -148,7 +179,7 @@ acpi_cm_delete_internal_obj (
 }
 
 
-/******************************************************************************
+/*******************************************************************************
  *
  * FUNCTION:    Acpi_cm_delete_internal_object_list
  *
@@ -197,12 +228,11 @@ acpi_cm_delete_internal_object_list (
 }
 
 
-/******************************************************************************
+/*******************************************************************************
  *
  * FUNCTION:    Acpi_cm_update_ref_count
  *
  * PARAMETERS:  *Object         - Object whose ref count is to be updated
- *              Count           - Current ref count
  *              Action          - What to do
  *
  * RETURN:      New ref count
@@ -211,7 +241,7 @@ acpi_cm_delete_internal_object_list (
  *
  ******************************************************************************/
 
-void
+static void
 acpi_cm_update_ref_count (
        ACPI_OPERAND_OBJECT     *object,
        u32                     action)
@@ -287,7 +317,7 @@ acpi_cm_update_ref_count (
 }
 
 
-/******************************************************************************
+/*******************************************************************************
  *
  * FUNCTION:    Acpi_cm_update_object_reference
  *
@@ -397,9 +427,8 @@ acpi_cm_update_object_reference (
                                 * these are simply ignored
                                 */
 
-                               status =
-                                       acpi_cm_create_update_state_and_push (object->package.elements[i],
-                                                          action, &state_list);
+                               status = acpi_cm_create_update_state_and_push (
+                                                object->package.elements[i], action, &state_list);
                                if (ACPI_FAILURE (status)) {
                                        return (status);
                                }
@@ -409,9 +438,9 @@ acpi_cm_update_object_reference (
 
                case ACPI_TYPE_FIELD_UNIT:
 
-                       status =
-                               acpi_cm_create_update_state_and_push (object->field_unit.container,
-                                                  action, &state_list);
+                       status = acpi_cm_create_update_state_and_push (
+                                        object->field_unit.container, action, &state_list);
+
                        if (ACPI_FAILURE (status)) {
                                return (status);
                        }
@@ -420,9 +449,8 @@ acpi_cm_update_object_reference (
 
                case INTERNAL_TYPE_DEF_FIELD:
 
-                       status =
-                               acpi_cm_create_update_state_and_push (object->field.container,
-                                                  action, &state_list);
+                       status = acpi_cm_create_update_state_and_push (
+                                        object->field.container, action, &state_list);
                        if (ACPI_FAILURE (status)) {
                                return (status);
                        }
@@ -431,16 +459,14 @@ acpi_cm_update_object_reference (
 
                case INTERNAL_TYPE_BANK_FIELD:
 
-                       status =
-                               acpi_cm_create_update_state_and_push (object->bank_field.bank_select,
-                                                  action, &state_list);
+                       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);
+                       status = acpi_cm_create_update_state_and_push (
+                                        object->bank_field.container, action, &state_list);
                        if (ACPI_FAILURE (status)) {
                                return (status);
                        }
@@ -449,8 +475,6 @@ acpi_cm_update_object_reference (
 
                case ACPI_TYPE_REGION:
 
-                       acpi_cm_update_ref_count (object->region.method, action);
-
        /* TBD: [Investigate]
                        Acpi_cm_update_ref_count (Object->Region.Addr_handler, Action);
        */
@@ -490,7 +514,7 @@ acpi_cm_update_object_reference (
 }
 
 
-/******************************************************************************
+/*******************************************************************************
  *
  * FUNCTION:    Acpi_cm_add_reference
  *
@@ -517,7 +541,6 @@ acpi_cm_add_reference (
                return;
        }
 
-
        /*
         * We have a valid ACPI internal object, now increment the reference count
         */
@@ -528,7 +551,7 @@ acpi_cm_add_reference (
 }
 
 
-/******************************************************************************
+/*******************************************************************************
  *
  * FUNCTION:    Acpi_cm_remove_reference
  *
@@ -562,15 +585,6 @@ acpi_cm_remove_reference (
 
        acpi_cm_update_object_reference (object, REF_DECREMENT);
 
-       /*
-        * If the reference count has reached zero,
-        * delete the object and all sub-objects contained within it
-        */
-/*
-       if (Object->Common.Reference_count == 0) {
-               Acpi_cm_delete_internal_obj (Object);
-       }
-*/
        return;
 }
 
index 21fd86b0cd4c7f7caf95fb8e2e027f7fc306089c..29a5cefa6411789f957ed90421e03b0c7fa00796 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: cmeval - Object evaluation
- *              $Revision: 14 $
+ *              $Revision: 19 $
  *
  *****************************************************************************/
 
@@ -37,7 +37,8 @@
  *
  * FUNCTION:    Acpi_cm_evaluate_numeric_object
  *
- * PARAMETERS:  Device_node         - Node for the device
+ * PARAMETERS:  *Object_name        - Object name to be evaluated
+ *              Device_node         - Node for the device
  *              *Address            - Where the value is returned
  *
  * RETURN:      Status
@@ -53,7 +54,7 @@ ACPI_STATUS
 acpi_cm_evaluate_numeric_object (
        NATIVE_CHAR             *object_name,
        ACPI_NAMESPACE_NODE     *device_node,
-       u32                     *address)
+       ACPI_INTEGER            *address)
 {
        ACPI_OPERAND_OBJECT     *obj_desc;
        ACPI_STATUS             status;
@@ -151,15 +152,13 @@ acpi_cm_execute_HID (
                if (obj_desc->common.type == ACPI_TYPE_NUMBER) {
                        /* Convert the Numeric HID to string */
 
-                       acpi_aml_eisa_id_to_string (obj_desc->number.value, hid->data.buffer);
-                       hid->type = STRING_DEVICE_ID;
+                       acpi_aml_eisa_id_to_string ((u32) obj_desc->number.value, hid->buffer);
                }
 
                else {
                        /* Copy the String HID from the returned object */
 
-                       hid->data.string_ptr = obj_desc->string.pointer;
-                       hid->type = STRING_PTR_DEVICE_ID;
+                       STRNCPY(hid->buffer, obj_desc->string.pointer, sizeof(hid->buffer));
                }
        }
 
@@ -226,16 +225,15 @@ acpi_cm_execute_UID (
 
        else {
                if (obj_desc->common.type == ACPI_TYPE_NUMBER) {
-                       /* Convert the Numeric HID to string */
+                       /* Convert the Numeric UID to string */
 
-                       uid->data.number = obj_desc->number.value;
+                       acpi_aml_unsigned_integer_to_string (obj_desc->number.value, uid->buffer);
                }
 
                else {
-                       /* Copy the String HID from the returned object */
+                       /* Copy the String UID from the returned object */
 
-                       uid->data.string_ptr = obj_desc->string.pointer;
-                       uid->type = STRING_PTR_DEVICE_ID;
+                       STRNCPY(uid->buffer, obj_desc->string.pointer, sizeof(uid->buffer));
                }
        }
 
@@ -276,35 +274,35 @@ acpi_cm_execute_STA (
 
        status = acpi_ns_evaluate_relative (device_node,
                         METHOD_NAME__STA, NULL, &obj_desc);
-       if (ACPI_FAILURE (status)) {
-
-
-               return (status);
+       if (AE_NOT_FOUND == status) {
+               *flags = 0x0F;
+               status = AE_OK;
        }
 
 
-       /* Did we get a return object? */
-
-       if (!obj_desc) {
-               return (AE_TYPE);
-       }
+       else /* success */ {
+               /* Did we get a return object? */
 
-       /* Is the return object of the correct type? */
+               if (!obj_desc) {
+                       return (AE_TYPE);
+               }
 
-       if (obj_desc->common.type != ACPI_TYPE_NUMBER) {
-               status = AE_TYPE;
-       }
+               /* Is the return object of the correct type? */
 
-       else {
-               /* Extract the status flags */
+               if (obj_desc->common.type != ACPI_TYPE_NUMBER) {
+                       status = AE_TYPE;
+               }
 
-               *flags = obj_desc->number.value;
-       }
+               else {
+                       /* Extract the status flags */
 
+                       *flags = (u32) obj_desc->number.value;
+               }
 
-       /* On exit, we must delete the return object */
+               /* On exit, we must delete the return object */
 
-       acpi_cm_remove_reference (obj_desc);
+               acpi_cm_remove_reference (obj_desc);
+       }
 
        return (status);
 }
index 82b810e4c25184cc0a5781d5fd8b5fe8fe9c35c6..4b4460f4690965747702f53e945d93b8693c3872 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: cmglobal - Global variables for the ACPI subsystem
- *              $Revision: 99 $
+ *              $Revision: 112 $
  *
  *****************************************************************************/
 
@@ -29,6 +29,7 @@
 #include "acevents.h"
 #include "acnamesp.h"
 #include "acinterp.h"
+#include "amlcode.h"
 
 
 #define _COMPONENT          MISCELLANEOUS
@@ -52,7 +53,7 @@ u32                         acpi_dbg_level = NORMAL_DEFAULT;
 
 /* Debug switch - layer (component) mask */
 
-u32                         acpi_dbg_layer = ALL_COMPONENTS;
+u32                         acpi_dbg_layer = COMPONENT_DEFAULT;
 u32                         acpi_gbl_nesting_level = 0;
 
 
@@ -70,6 +71,9 @@ u32                         acpi_gbl_startup_flags = 0;
 u8                          acpi_gbl_shutdown = TRUE;
 
 
+u8                          acpi_gbl_decode_to8bit [8] = {1,2,4,8,16,32,64,128};
+
+
 /******************************************************************************
  *
  * Namespace globals
@@ -134,16 +138,16 @@ u8                          acpi_gbl_ns_properties[] =
        NSP_NORMAL,                 /* 21 Alias            */
        NSP_NORMAL,                 /* 22 Notify           */
        NSP_NORMAL,                 /* 23 Address Handler  */
-       NSP_NORMAL,                 /* 24 Def_field_defn   */
-       NSP_NORMAL,                 /* 25 Bank_field_defn  */
-       NSP_NORMAL,                 /* 26 Index_field_defn */
-       NSP_NORMAL,                 /* 27 If               */
-       NSP_NORMAL,                 /* 28 Else             */
-       NSP_NORMAL,                 /* 29 While            */
-       NSP_NEWSCOPE,               /* 30 Scope            */
-       NSP_LOCAL,                  /* 31 Def_any          */
-       NSP_NORMAL,                 /* 32 Method Arg       */
-       NSP_NORMAL,                 /* 33 Method Local     */
+       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          */
 };
 
@@ -152,6 +156,10 @@ u8                          acpi_gbl_ns_properties[] =
  *
  * 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.
+ *
  ******************************************************************************/
 
 
@@ -160,22 +168,17 @@ 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",   RSDP_SIG, sizeof (RSDP_SIG)-1, ACPI_TABLE_SINGLE,   AE_OK,      NULL},
-       /* APIC 1 */ {APIC_SIG, APIC_SIG, sizeof (APIC_SIG)-1, ACPI_TABLE_SINGLE,   AE_OK,      (void **) &acpi_gbl_APIC},
-       /* DSDT 2 */ {DSDT_SIG, DSDT_SIG, sizeof (DSDT_SIG)-1, ACPI_TABLE_SINGLE,   AE_OK,      (void **) &acpi_gbl_DSDT},
-       /* FACP 3 */ {FACP_SIG, FACP_SIG, sizeof (FACP_SIG)-1, ACPI_TABLE_SINGLE,   AE_OK,      (void **) &acpi_gbl_FACP},
-       /* FACS 4 */ {FACS_SIG, FACS_SIG, sizeof (FACS_SIG)-1, ACPI_TABLE_SINGLE,   AE_OK,      (void **) &acpi_gbl_FACS},
-       /* PSDT 5 */ {PSDT_SIG, PSDT_SIG, sizeof (PSDT_SIG)-1, ACPI_TABLE_MULTIPLE, AE_OK,      NULL},
-       /* RSDT 6 */ {RSDT_SIG, RSDT_SIG, sizeof (RSDT_SIG)-1, ACPI_TABLE_SINGLE,   AE_OK,      NULL},
-       /* SSDT 7 */ {SSDT_SIG, SSDT_SIG, sizeof (SSDT_SIG)-1, ACPI_TABLE_MULTIPLE, AE_OK,      NULL},
-       /* SBST 8 */ {SBST_SIG, SBST_SIG, sizeof (SBST_SIG)-1, ACPI_TABLE_SINGLE,   AE_OK,      (void **) &acpi_gbl_SBST},
-       /* BOOT 9 */ {BOOT_SIG, BOOT_SIG, sizeof (BOOT_SIG)-1, ACPI_TABLE_SINGLE,   AE_SUPPORT, NULL}
+       /***********    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},
 };
 
-ACPI_INIT_DATA acpi_gbl_acpi_init_data;
-
 
 /*****************************************************************************
  *
@@ -337,22 +340,15 @@ acpi_cm_allocate_owner_id (
  ***************************************************************************/
 
 void
-acpi_cm_init_globals (ACPI_INIT_DATA *init_data)
+acpi_cm_init_globals (
+       void)
 {
        u32                     i;
 
 
-       if (init_data) {
-               MEMCPY (&acpi_gbl_acpi_init_data, init_data, sizeof (ACPI_INIT_DATA));
-       }
-
-       else {
-               MEMSET (&acpi_gbl_acpi_init_data, 0, sizeof (ACPI_INIT_DATA));
-       }
-
        /* ACPI table structure */
 
-       for (i = 0; i < ACPI_TABLE_MAX; i++) {
+       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;
@@ -364,7 +360,7 @@ acpi_cm_init_globals (ACPI_INIT_DATA *init_data)
 
        /* Address Space handler array */
 
-       for (i = 0; i < ACPI_MAX_ADDRESS_SPACE; i++) {
+       for (i = 0; i < ACPI_NUM_ADDRESS_SPACES; i++) {
                acpi_gbl_address_spaces[i].handler  = NULL;
                acpi_gbl_address_spaces[i].context  = NULL;
        }
@@ -385,12 +381,10 @@ acpi_cm_init_globals (ACPI_INIT_DATA *init_data)
        /* Global "typed" ACPI table pointers */
 
        acpi_gbl_RSDP                       = NULL;
-       acpi_gbl_RSDT                       = NULL;
+       acpi_gbl_XSDT                       = NULL;
        acpi_gbl_FACS                       = NULL;
-       acpi_gbl_FACP                       = NULL;
-       acpi_gbl_APIC                       = NULL;
+       acpi_gbl_FADT                       = NULL;
        acpi_gbl_DSDT                       = NULL;
-       acpi_gbl_SBST                       = NULL;
 
 
        /* Global Lock support */
@@ -404,7 +398,6 @@ acpi_cm_init_globals (ACPI_INIT_DATA *init_data)
        acpi_gbl_startup_flags              = 0;
        acpi_gbl_global_lock_set            = FALSE;
        acpi_gbl_rsdp_original_location     = 0;
-       acpi_gbl_when_to_parse_methods      = METHOD_PARSE_CONFIGURATION;
        acpi_gbl_cm_single_step             = FALSE;
        acpi_gbl_db_terminate_threads       = FALSE;
        acpi_gbl_shutdown                   = FALSE;
@@ -442,15 +435,6 @@ acpi_cm_init_globals (ACPI_INIT_DATA *init_data)
        acpi_gbl_walk_state_cache_requests  = 0;
        acpi_gbl_walk_state_cache_hits      = 0;
 
-       /* Interpreter */
-
-       acpi_gbl_buf_seq                    = 0;
-       acpi_gbl_node_err                   = FALSE;
-
-       /* Parser */
-
-       acpi_gbl_parsed_namespace_root      = NULL;
-
        /* Hardware oriented */
 
        acpi_gbl_gpe0enable_register_save   = NULL;
index 18b243a0fa2de702dd9cc4db56db796f3bd50820..babf941d2f779e9640153f1365329c3d0115d881 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: cminit - Common ACPI subsystem initialization
- *              $Revision: 79 $
+ *              $Revision: 89 $
  *
  *****************************************************************************/
 
 
 /*******************************************************************************
  *
- * FUNCTION:    Acpi_cm_facp_register_error
+ * 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:      none
+ * RETURN:      AE_BAD_VALUE
  *
  * DESCRIPTION: Display failure message and link failure to TDS assertion
  *
  ******************************************************************************/
 
-void
-acpi_cm_facp_register_error (
+static ACPI_STATUS
+acpi_cm_fadt_register_error (
        NATIVE_CHAR             *register_name,
-       u32                     value)
+       UINT64                  value)
 {
 
-       REPORT_ERROR ("Invalid FACP register value");
+       REPORT_ERROR (
+               ("Invalid FADT register value, %s=%X (FADT=%p)\n",
+               register_name, value, acpi_gbl_FADT));
+
 
+       return (AE_BAD_VALUE);
 }
 
 
 /******************************************************************************
  *
- * FUNCTION:    Acpi_cm_hardware_initialize
+ * FUNCTION:    Acpi_cm_validate_fadt
  *
  * PARAMETERS:  None
  *
  * RETURN:      Status
  *
- * DESCRIPTION: Initialize and validate various ACPI registers
+ * DESCRIPTION: Validate various ACPI registers in the FADT
  *
  ******************************************************************************/
 
 ACPI_STATUS
-acpi_cm_hardware_initialize (void)
+acpi_cm_validate_fadt (
+       void)
 {
-       ACPI_STATUS             status = AE_OK;
-       u32                     index;
+       ACPI_STATUS                 status = AE_OK;
 
 
-       /* Are we running on the actual hardware */
+       /*
+        * Verify Fixed ACPI Description Table fields,
+        * but don't abort on any problems, just display error
+        */
 
-       if (!acpi_gbl_acpi_hardware_present) {
-               /* No, just return */
-
-               return (AE_OK);
+       if (acpi_gbl_FADT->pm1_evt_len < 4) {
+               status = acpi_cm_fadt_register_error ("PM1_EVT_LEN",
+                                 (u32) acpi_gbl_FADT->pm1_evt_len);
        }
 
-       /* We must have the ACPI tables by the time we get here */
-
-       if (!acpi_gbl_FACP) {
-               acpi_gbl_restore_acpi_chipset = FALSE;
-
-               return (AE_NO_ACPI_TABLES);
+       if (!acpi_gbl_FADT->pm1_cnt_len) {
+               status = acpi_cm_fadt_register_error ("PM1_CNT_LEN",
+                                 (u32) acpi_gbl_FADT->pm1_cnt_len);
        }
 
-       /* Must support *some* mode! */
-/*
-       if (!(System_flags & SYS_MODES_MASK)) {
-               Restore_acpi_chipset = FALSE;
-
-               return (AE_ERROR);
+       if (!acpi_gbl_FADT->Xpm1a_evt_blk.address) {
+               status = acpi_cm_fadt_register_error ("PM1a_EVT_BLK",
+                                 acpi_gbl_FADT->Xpm1a_evt_blk.address);
        }
 
-*/
+       if (!acpi_gbl_FADT->Xpm1a_cnt_blk.address) {
+               status = acpi_cm_fadt_register_error ("PM1a_CNT_BLK",
+                                 acpi_gbl_FADT->Xpm1a_cnt_blk.address);
+       }
 
+       if (!acpi_gbl_FADT->Xpm_tmr_blk.address) {
+               status = acpi_cm_fadt_register_error ("PM_TMR_BLK",
+                                 acpi_gbl_FADT->Xpm_tmr_blk.address);
+       }
 
-       switch (acpi_gbl_system_flags & SYS_MODES_MASK)
+       if ((acpi_gbl_FADT->Xpm2_cnt_blk.address &&
+               !acpi_gbl_FADT->pm2_cnt_len))
        {
-               /* Identify current ACPI/legacy mode   */
-
-       case (SYS_MODE_ACPI):
-
-               acpi_gbl_original_mode = SYS_MODE_ACPI;
-               break;
-
-
-       case (SYS_MODE_LEGACY):
-
-               acpi_gbl_original_mode = SYS_MODE_LEGACY;
-               break;
+               status = acpi_cm_fadt_register_error ("PM2_CNT_LEN",
+                                 (u32) acpi_gbl_FADT->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);
+       }
 
-       case (SYS_MODE_ACPI | SYS_MODE_LEGACY):
+       /* length of GPE blocks must be a multiple of 2 */
 
-               if (acpi_hw_get_mode () == SYS_MODE_ACPI) {
-                       acpi_gbl_original_mode = SYS_MODE_ACPI;
-               }
-               else {
-                       acpi_gbl_original_mode = SYS_MODE_LEGACY;
-               }
 
-               break;
+       if (acpi_gbl_FADT->Xgpe0blk.address &&
+               (acpi_gbl_FADT->gpe0blk_len & 1))
+       {
+               status = acpi_cm_fadt_register_error ("GPE0_BLK_LEN",
+                                 (u32) acpi_gbl_FADT->gpe0blk_len);
        }
 
-
-       if (acpi_gbl_system_flags & SYS_MODE_ACPI) {
-               /* Target system supports ACPI mode */
-
-               /*
-                * The purpose of this block of code is to save the initial state
-                * of the ACPI event enable registers. An exit function will be
-                * registered which will restore this state when the application
-                * exits. The exit function will also clear all of the ACPI event
-                * status bits prior to restoring the original mode.
-                *
-                * The location of the PM1a_evt_blk enable registers is defined as the
-                * base of PM1a_evt_blk + PM1a_evt_blk_length / 2. Since the spec further
-                * fully defines the PM1a_evt_blk to be a total of 4 bytes, the offset
-                * for the enable registers is always 2 from the base. It is hard
-                * coded here. If this changes in the spec, this code will need to
-                * be modified. The PM1b_evt_blk behaves as expected.
-                */
-
-               acpi_gbl_pm1_enable_register_save =
-                       acpi_os_in16 ((acpi_gbl_FACP->pm1a_evt_blk + 2));
-               if (acpi_gbl_FACP->pm1b_evt_blk) {
-                       acpi_gbl_pm1_enable_register_save |=
-                               acpi_os_in16 ((acpi_gbl_FACP->pm1b_evt_blk + 2));
-               }
-
-
-               /*
-                * The GPEs behave similarly, except that the length of the register
-                * block is not fixed, so the buffer must be allocated with malloc
-                */
-
-               if (acpi_gbl_FACP->gpe0blk && acpi_gbl_FACP->gpe0blk_len) {
-                       /* GPE0 specified in FACP  */
-
-                       acpi_gbl_gpe0enable_register_save =
-                               acpi_cm_allocate (DIV_2 (acpi_gbl_FACP->gpe0blk_len));
-                       if (!acpi_gbl_gpe0enable_register_save) {
-                               return (AE_NO_MEMORY);
-                       }
-
-                       /* Save state of GPE0 enable bits */
-
-                       for (index = 0; index < DIV_2 (acpi_gbl_FACP->gpe0blk_len); index++) {
-                               acpi_gbl_gpe0enable_register_save[index] =
-                                       acpi_os_in8 (acpi_gbl_FACP->gpe0blk +
-                                       DIV_2 (acpi_gbl_FACP->gpe0blk_len));
-                       }
-               }
-
-               else {
-                       acpi_gbl_gpe0enable_register_save = NULL;
-               }
-
-               if (acpi_gbl_FACP->gpe1_blk && acpi_gbl_FACP->gpe1_blk_len) {
-                       /* GPE1 defined */
-
-                       acpi_gbl_gpe1_enable_register_save =
-                               acpi_cm_allocate (DIV_2 (acpi_gbl_FACP->gpe1_blk_len));
-                       if (!acpi_gbl_gpe1_enable_register_save) {
-                               return (AE_NO_MEMORY);
-                       }
-
-                       /* save state of GPE1 enable bits */
-
-                       for (index = 0; index < DIV_2 (acpi_gbl_FACP->gpe1_blk_len); index++) {
-                               acpi_gbl_gpe1_enable_register_save[index] =
-                                       acpi_os_in8 (acpi_gbl_FACP->gpe1_blk +
-                                       DIV_2 (acpi_gbl_FACP->gpe1_blk_len));
-                       }
-               }
-
-               else {
-                       acpi_gbl_gpe1_enable_register_save = NULL;
-               }
-
-
-               /*
-                * Verify Fixed ACPI Description Table fields,
-                * but don't abort on any problems, just display error
-                */
-
-               if (acpi_gbl_FACP->pm1_evt_len < 4) {
-                       acpi_cm_facp_register_error ("PM1_EVT_LEN",
-                                        (u32) acpi_gbl_FACP->pm1_evt_len);
-               }
-
-               if (!acpi_gbl_FACP->pm1_cnt_len) {
-                       acpi_cm_facp_register_error ("PM1_CNT_LEN",
-                                        (u32) acpi_gbl_FACP->pm1_cnt_len);
-               }
-
-               if (!acpi_gbl_FACP->pm1a_evt_blk) {
-                       acpi_cm_facp_register_error ("PM1a_EVT_BLK", acpi_gbl_FACP->pm1a_evt_blk);
-               }
-
-               if (!acpi_gbl_FACP->pm1a_cnt_blk) {
-                       acpi_cm_facp_register_error ("PM1a_CNT_BLK", acpi_gbl_FACP->pm1a_cnt_blk);
-               }
-
-               if (!acpi_gbl_FACP->pm_tmr_blk) {
-                       acpi_cm_facp_register_error ("PM_TMR_BLK", acpi_gbl_FACP->pm_tmr_blk);
-               }
-
-               if (acpi_gbl_FACP->pm2_cnt_blk && !acpi_gbl_FACP->pm2_cnt_len) {
-                       acpi_cm_facp_register_error ("PM2_CNT_LEN",
-                                        (u32) acpi_gbl_FACP->pm2_cnt_len);
-               }
-
-               if (acpi_gbl_FACP->pm_tm_len < 4) {
-                       acpi_cm_facp_register_error ("PM_TM_LEN",
-                                        (u32) acpi_gbl_FACP->pm_tm_len);
-               }
-
-               /* length not multiple of 2    */
-               if (acpi_gbl_FACP->gpe0blk && (acpi_gbl_FACP->gpe0blk_len & 1)) {
-                       acpi_cm_facp_register_error ("GPE0_BLK_LEN",
-                                        (u32) acpi_gbl_FACP->gpe0blk_len);
-               }
-
-               /* length not multiple of 2    */
-               if (acpi_gbl_FACP->gpe1_blk && (acpi_gbl_FACP->gpe1_blk_len & 1)) {
-                       acpi_cm_facp_register_error ("GPE1_BLK_LEN",
-                                        (u32) acpi_gbl_FACP->gpe1_blk_len);
-               }
+       if (acpi_gbl_FADT->Xgpe1_blk.address &&
+               (acpi_gbl_FADT->gpe1_blk_len & 1))
+       {
+               status = acpi_cm_fadt_register_error ("GPE1_BLK_LEN",
+                                 (u32) acpi_gbl_FADT->gpe1_blk_len);
        }
 
-
        return (status);
 }
 
@@ -355,8 +235,6 @@ acpi_cm_subsystem_shutdown (void)
        acpi_cm_dump_current_allocations (ACPI_UINT32_MAX, NULL);
 #endif
 
-       BREAKPOINT3;
-
        return (AE_OK);
 }
 
index a60e58f688cef01523e5e81315cf8ffa8709169f..1cce4a5524ef99c3690429c37164187d68d0f899 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: cmobject - ACPI object create/delete/size/cache routines
- *              $Revision: 27 $
+ *              $Revision: 32 $
  *
  *****************************************************************************/
 
@@ -193,7 +193,7 @@ _cm_allocate_object_desc (
                        /* Allocation failed */
 
                        _REPORT_ERROR (module_name, line_number, component_id,
-                                         "Could not allocate Object Descriptor");
+                                         ("Could not allocate an object descriptor\n"));
 
                        return (NULL);
                }
@@ -499,10 +499,10 @@ acpi_cm_get_package_object_size (
 {
 
        ACPI_OPERAND_OBJECT     *this_internal_obj;
-       ACPI_OPERAND_OBJECT     *parent_obj[MAX_PACKAGE_DEPTH] = { 0,0,0,0,0 };
+       ACPI_OPERAND_OBJECT     *parent_obj[MAX_PACKAGE_DEPTH];
        ACPI_OPERAND_OBJECT     *this_parent;
        u32                     this_index;
-       u32                     index[MAX_PACKAGE_DEPTH] = { 0,0,0,0,0 };
+       u32                     index[MAX_PACKAGE_DEPTH];
        u32                     length = 0;
        u32                     object_space;
        u32                     current_depth = 0;
@@ -510,6 +510,11 @@ acpi_cm_get_package_object_size (
        ACPI_STATUS             status;
 
 
+       /* Init the package stack TBD: replace with linked list */
+
+       MEMSET(parent_obj, 0, MAX_PACKAGE_DEPTH);
+       MEMSET(index, 0, MAX_PACKAGE_DEPTH);
+
        parent_obj[0] = internal_obj;
 
        while (1) {
@@ -519,7 +524,7 @@ acpi_cm_get_package_object_size (
 
 
                /*
-                * Check for 1) An unitialized package element.  It is completely
+                * Check for 1) An uninitialized package element.  It is completely
                 *              legal to declare a package and leave it uninitialized
                 *           2) Any type other than a package.  Packages are handled
                 *              below.
index 6ebf3fb422c4c1ca66482fb4052430c283fa4d81..cb3d959c854d7926259ba4c6f6d34c56add1fdf7 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************************
  *
  * Module Name: cmutils - common utility procedures
- *              $Revision: 18 $
+ *              $Revision: 21 $
  *
  ******************************************************************************/
 
@@ -616,6 +616,55 @@ acpi_cm_delete_generic_state_cache (
 }
 
 
+/*******************************************************************************
+ *
+ * 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) {
+               /* Must be a package */
+
+               REPORT_ERROR (("Must resolve Package Refs on a Package\n"));
+               return(AE_ERROR);
+       }
+
+       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_NUMBER;
+                               sub_object->number.value = 0;
+                       }
+                       else if (sub_object->reference.op_code == AML_ONE_OP) {
+                               sub_object->common.type = ACPI_TYPE_NUMBER;
+                               sub_object->number.value = 1;
+                       }
+                       else if (sub_object->reference.op_code == AML_ONES_OP) {
+                               sub_object->common.type = ACPI_TYPE_NUMBER;
+                               sub_object->number.value = ACPI_INTEGER_MAX;
+                       }
+               }
+       }
+
+       return(AE_OK);
+}
+
+
 /*******************************************************************************
  *
  * FUNCTION:    _Report_error
@@ -635,13 +684,11 @@ void
 _report_error (
        NATIVE_CHAR             *module_name,
        u32                     line_number,
-       u32                     component_id,
-       NATIVE_CHAR             *message)
+       u32                     component_id)
 {
 
-       debug_print (module_name, line_number, component_id, ACPI_ERROR,
-                        "*** Error: %s\n", message);
 
+       acpi_os_printf ("%8s-%04d: *** Error: ", module_name, line_number);
 }
 
 
@@ -664,13 +711,10 @@ void
 _report_warning (
        NATIVE_CHAR             *module_name,
        u32                     line_number,
-       u32                     component_id,
-       NATIVE_CHAR             *message)
+       u32                     component_id)
 {
 
-       debug_print (module_name, line_number, component_id, ACPI_WARN,
-                        "*** Warning: %s\n", message);
-
+       acpi_os_printf ("%8s-%04d: *** Warning: ", module_name, line_number);
 }
 
 
@@ -693,13 +737,10 @@ void
 _report_info (
        NATIVE_CHAR             *module_name,
        u32                     line_number,
-       u32                     component_id,
-       NATIVE_CHAR             *message)
+       u32                     component_id)
 {
 
-       debug_print (module_name, line_number, component_id, ACPI_INFO,
-                        "*** Info: %s\n", message);
-
+       acpi_os_printf ("%8s-%04d: *** Info: ", module_name, line_number);
 }
 
 
index 4b4d2d06b7b90b530b9dfb21be17b23a021936e3..fc063850cabbeb30880cd43977618df0fb9be12d 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: cmxface - External interfaces for "global" ACPI functions
- *              $Revision: 43 $
+ *              $Revision: 55 $
  *
  *****************************************************************************/
 
@@ -39,7 +39,7 @@
 
 /*******************************************************************************
  *
- * FUNCTION:    Acpi_initialize
+ * FUNCTION:    Acpi_initialize_subsystem
  *
  * PARAMETERS:  None
  *
  ******************************************************************************/
 
 ACPI_STATUS
-acpi_initialize (ACPI_INIT_DATA *init_data)
+acpi_initialize_subsystem (
+       void)
 {
        ACPI_STATUS             status;
 
 
        /* Initialize all globals used by the subsystem */
 
-       acpi_cm_init_globals (init_data);
+       acpi_cm_init_globals ();
 
        /* Initialize the OS-Dependent layer */
 
        status = acpi_os_initialize ();
        if (ACPI_FAILURE (status)) {
-               REPORT_ERROR ("OSD Initialization Failure");
+               REPORT_ERROR (("OSD failed to initialize, %s\n",
+                       acpi_cm_format_exception (status)));
                return (status);
        }
 
@@ -72,10 +74,24 @@ acpi_initialize (ACPI_INIT_DATA *init_data)
 
        status = acpi_cm_mutex_initialize ();
        if (ACPI_FAILURE (status)) {
-               REPORT_ERROR ("Global Mutex Initialization Failure");
+               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 ());
@@ -84,6 +100,116 @@ acpi_initialize (ACPI_INIT_DATA *init_data)
 }
 
 
+/*******************************************************************************
+ *
+ * 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)) {
+                       /* TBD: workaround. Old Lions don't enable properly */
+                       /*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, _INI, and _HID methods, and detects
+        * the PCI root bus(es)
+        */
+
+       if (!(flags & ACPI_NO_DEVICE_INIT)) {
+               status = acpi_ns_initialize_devices (flags & ACPI_NO_PCI_INIT);
+               if (ACPI_FAILURE (status)) {
+                       return (status);
+               }
+       }
+
+
+       /*
+        * Initialize the objects that remain unitialized.  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
@@ -102,7 +228,7 @@ acpi_terminate (void)
 
        /* Terminate the AML Debuger if present */
 
-       acpi_gbl_db_terminate_threads = TRUE;
+       DEBUGGER_EXEC(acpi_gbl_db_terminate_threads = TRUE);
 
        /* TBD: [Investigate] This is no longer needed?*/
 /*    Acpi_cm_release_mutex (ACPI_MTX_DEBUG_CMD_READY); */
@@ -202,7 +328,7 @@ acpi_get_system_info (
        /* 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++); {
+       for (i = 0; i < NUM_ACPI_TABLES; i++) {
                info_ptr->table_info[i].count = acpi_gbl_acpi_tables[i].count;
        }
 
index 2736e86a9cc4d7825f6d21565f3385afdca52617..00ec59da52149da8c6562b5f9506a52eb7e2569e 100644 (file)
@@ -37,55 +37,65 @@ static unsigned long 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;
 
 /*
  * Clear busmaster activity flag
  */
 static inline void
-acpi_clear_bm_activity(struct acpi_facp *facp)
+acpi_clear_bm_activity(void)
 {
-       acpi_write_pm1_status(facp, ACPI_BM);
+       acpi_hw_register_bit_access(ACPI_WRITE, ACPI_MTX_LOCK, BM_STS, 0);
 }
 
 /*
  * Returns 1 if there has been busmaster activity
  */
 static inline int
-acpi_bm_activity(struct acpi_facp *facp)
+acpi_bm_activity(void)
 {
-       return acpi_read_pm1_status(facp) & ACPI_BM;
+       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(struct acpi_facp *facp)
+acpi_sleep_on_busmaster(void)
 {
-       u32 pm1_cntr = acpi_read_pm1_control(facp);
-       if (pm1_cntr & ACPI_BM_RLD) {
-               pm1_cntr &= ~ACPI_BM_RLD;
-               acpi_write_pm1_control(facp, pm1_cntr);
-       }
+       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(struct acpi_facp *facp)
+acpi_wake_on_busmaster(void)
 {
-       u32 pm1_cntr = acpi_read_pm1_control(facp);
-       if (!(pm1_cntr & ACPI_BM_RLD)) {
-               pm1_cntr |= ACPI_BM_RLD;
-               acpi_write_pm1_control(facp, pm1_cntr);
-       }
-       acpi_clear_bm_activity(facp);
+       acpi_hw_register_bit_access (ACPI_WRITE, ACPI_MTX_LOCK, BM_RLD, 0);
 }
 
-/* The ACPI timer is just the low 24 bits */
-#define TIME_BEGIN(tmr) inl(tmr)
-#define TIME_END(tmr, begin) ((inl(tmr) - (begin)) & 0x00ffffff)
+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)
@@ -94,11 +104,11 @@ static void
 acpi_idle(void)
 {
        static int sleep_level = 1;
-       struct acpi_facp *facp = &acpi_facp;
+       FADT_DESCRIPTOR *fadt = &acpi_fadt;
 
-       if (!facp
-           || facp->hdr.signature != ACPI_FACP_SIG
-           || !facp->pm_tmr
+       if (!fadt
+           || (STRNCMP(fadt->header.signature, ACPI_FADT_SIGNATURE, ACPI_SIG_LEN) != 0)
+           || !fadt->Xpm_tmr_blk.address
            || !acpi_pblk)
                goto not_initialized;
 
@@ -116,110 +126,108 @@ acpi_idle(void)
       sleep3:
        sleep_level = 3;
        if (!acpi_c3_tested) {
-               printk(KERN_DEBUG "ACPI C3 works\n");
+               DEBUG_PRINT(ACPI_INFO, ("C3 works\n"));
                acpi_c3_tested = 1;
        }
-       acpi_wake_on_busmaster(facp);
-       if (facp->pm2_cnt)
+       acpi_wake_on_busmaster();
+       if (fadt->Xpm2_cnt_blk.address)
                goto sleep3_with_arbiter;
 
        for (;;) {
                unsigned long time;
-               unsigned int pm_tmr = facp->pm_tmr;
-
+               unsigned long diff;
+               
                __cli();
                if (current->need_resched)
                        goto out;
-               if (acpi_bm_activity(facp))
+               if (acpi_bm_activity())
                        goto sleep2;
 
-               time = TIME_BEGIN(pm_tmr);
+               time = acpi_read_pm_timer();
                inb(acpi_pblk + ACPI_P_LVL3);
                /* Dummy read, force synchronization with the PMU */
-               inl(pm_tmr);
-               time = TIME_END(pm_tmr, time);
+               acpi_read_pm_timer();
+               diff = acpi_compare_pm_timers(time, acpi_read_pm_timer());
 
                __sti();
-               if (time < acpi_c3_exit_latency)
+               if (diff < acpi_c3_exit_latency)
                        goto sleep2;
        }
 
       sleep3_with_arbiter:
        for (;;) {
                unsigned long time;
-               u8 arbiter;
-               unsigned int pm2_cntr = facp->pm2_cnt;
-               unsigned int pm_tmr = facp->pm_tmr;
+               unsigned long diff;
 
                __cli();
                if (current->need_resched)
                        goto out;
-               if (acpi_bm_activity(facp))
+               if (acpi_bm_activity())
                        goto sleep2;
 
-               time = TIME_BEGIN(pm_tmr);
-               arbiter = inb(pm2_cntr) & ~ACPI_ARB_DIS;
+               time = acpi_read_pm_timer();
+               
                /* Disable arbiter, park on CPU */
-               outb(arbiter | ACPI_ARB_DIS, pm2_cntr);
+               acpi_hw_register_bit_access(ACPI_WRITE, ACPI_MTX_LOCK, ARB_DIS, 1);
                inb(acpi_pblk + ACPI_P_LVL3);
                /* Dummy read, force synchronization with the PMU */
-               inl(pm_tmr);
-               time = TIME_END(pm_tmr, time);
+               acpi_read_pm_timer();
+               diff = acpi_compare_pm_timers(time, acpi_read_pm_timer());
                /* Enable arbiter again.. */
-               outb(arbiter, pm2_cntr);
+               acpi_hw_register_bit_access(ACPI_WRITE, ACPI_MTX_LOCK, ARB_DIS, 0);
 
                __sti();
-               if (time < acpi_c3_exit_latency)
+               if (diff < acpi_c3_exit_latency)
                        goto sleep2;
        }
 
       sleep2:
        sleep_level = 2;
        if (!acpi_c2_tested) {
-               printk(KERN_DEBUG "ACPI C2 works\n");
+               DEBUG_PRINT(ACPI_INFO, ("C2 works\n"));
                acpi_c2_tested = 1;
        }
-       acpi_wake_on_busmaster(facp);   /* Required to track BM activity.. */
+       acpi_wake_on_busmaster();       /* Required to track BM activity.. */
        for (;;) {
                unsigned long time;
-               unsigned int pm_tmr = facp->pm_tmr;
+               unsigned long diff;
 
                __cli();
                if (current->need_resched)
                        goto out;
 
-               time = TIME_BEGIN(pm_tmr);
+               time = acpi_read_pm_timer();
                inb(acpi_pblk + ACPI_P_LVL2);
                /* Dummy read, force synchronization with the PMU */
-               inl(pm_tmr);
-               time = TIME_END(pm_tmr, time);
+               acpi_read_pm_timer();
+               diff = acpi_compare_pm_timers(time, acpi_read_pm_timer());
 
                __sti();
-               if (time < acpi_c2_exit_latency)
+               if (diff < acpi_c2_exit_latency)
                        goto sleep1;
-               if (acpi_bm_activity(facp)) {
-                       acpi_clear_bm_activity(facp);
+               if (acpi_bm_activity()) {
+                       acpi_clear_bm_activity();
                        continue;
                }
-               if (time > acpi_c3_enter_latency
+               if (diff > acpi_c3_enter_latency
                    && acpi_max_c_state >= 3)
                        goto sleep3;
        }
 
       sleep1:
        sleep_level = 1;
-       acpi_sleep_on_busmaster(facp);
+       acpi_sleep_on_busmaster();
        for (;;) {
                unsigned long time;
-               unsigned int pm_tmr = facp->pm_tmr;
+               unsigned long diff;
 
                __cli();
                if (current->need_resched)
                        goto out;
-               time = TIME_BEGIN(pm_tmr);
+               time = acpi_read_pm_timer();
                safe_halt();
-               time = TIME_END(pm_tmr, time);
-               if (time > acpi_c2_enter_latency
+               diff = acpi_compare_pm_timers(time, acpi_read_pm_timer());
+               if (diff > acpi_c2_enter_latency
                    && acpi_max_c_state >= 2)
                        goto sleep2;
        }
@@ -240,7 +248,7 @@ acpi_idle(void)
  * Get processor information
  */
 static ACPI_STATUS
-acpi_find_cpu(ACPI_HANDLE handle, u32 level, void *ctx, void **value)
+acpi_found_cpu(ACPI_HANDLE handle, u32 level, void *ctx, void **value)
 {
        ACPI_OBJECT obj;
        ACPI_CX_STATE lat[4];
@@ -253,10 +261,11 @@ acpi_find_cpu(ACPI_HANDLE handle, u32 level, void *ctx, void **value)
        if (!ACPI_SUCCESS(acpi_evaluate_object(handle, NULL, NULL, &buf)))
                return AE_OK;
 
-       printk(KERN_INFO "ACPI: PBLK %d @ 0x%04x:%d\n",
-              obj.processor.proc_id,
-              obj.processor.pblk_address,
-              obj.processor.pblk_length);
+       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)
@@ -270,19 +279,16 @@ acpi_find_cpu(ACPI_HANDLE handle, u32 level, void *ctx, void **value)
                return AE_OK;
 
        if (lat[2].latency < MAX_CX_STATE_LATENCY) {
-               printk(KERN_INFO "ACPI: C2");
+               printk(KERN_INFO "ACPI: System firmware supports: C2");
                acpi_c2_exit_latency = lat[2].latency;
                acpi_max_c_state = 2;
        
                if (lat[3].latency < MAX_CX_STATE_LATENCY) {
-                       printk(", C3 supported\n");
+                       printk(" C3");
                        acpi_c3_exit_latency = lat[3].latency;
                        acpi_max_c_state = 3;
                }
-               else {
-                       printk(" supported\n");
-               }
-                       
+               printk("\n");
        }
 
        memset(throttle, 0, sizeof(throttle));
@@ -296,9 +302,29 @@ acpi_find_cpu(ACPI_HANDLE handle, u32 level, void *ctx, void **value)
                if (throttle[i].percent_of_clock)
                        count++;
        }
+
+       /* 0% throttled really doesn't count */
        count--;
-       if (count > 0)
-               printk(KERN_INFO "ACPI: %d throttling states\n", count);
+
+       if (count > 0) {
+               DEBUG_PRINT(ACPI_INFO, ("%d throttling states\n", count));
+       }
+
+       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;
 }
@@ -309,10 +335,13 @@ acpi_cpu_init(void)
        acpi_walk_namespace(ACPI_TYPE_PROCESSOR,
                            ACPI_ROOT_OBJECT,
                            ACPI_UINT32_MAX,
-                           acpi_find_cpu,
+                           acpi_found_cpu,
                            NULL,
                            NULL);
 
+       acpi_pm_timer_init();
+
+
 #ifdef CONFIG_SMP
        if (smp_num_cpus == 1)
                pm_idle = acpi_idle;
index edd89713320bbf7177a46838fb379b30259e39fb..751ef5de8f1902c93309a10e6556b84e3b5e6d78 100644 (file)
@@ -2,26 +2,14 @@
 # Makefile for all Linux ACPI interpreter subdirectories
 #
 
-SUB_DIRS        := 
-MOD_SUB_DIRS    := $(SUB_DIRS)
-MOD_IN_SUB_DIRS :=
-ALL_SUB_DIRS    := $(SUB_DIRS)
-
 O_TARGET := ../$(shell basename `pwd`).o
-O_OBJS   :=
-M_OBJS   :=
 
-ACPI_OBJS := $(patsubst %.c,%.o,$(wildcard *.c))
+obj-$(CONFIG_ACPI) := $(patsubst %.c,%.o,$(wildcard *.c))
 
 EXTRA_CFLAGS += -I../include
 
 EXTRA_CFLAGS += $(ACPI_CFLAGS)
 
-# if the interpreter is used, it overrides arch/i386/kernel/acpi.c
-ifeq ($(CONFIG_ACPI_INTERPRETER),y)
-  O_OBJS := $(ACPI_OBJS)
-endif
-
 include $(TOPDIR)/Rules.make
 
 clean:
index cea6a98831773213ec1b658c34b2f5479caac4ab..d9d73ccea3845188461718d3d80dce2ff55395eb 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: dsmethod - Parser/Interpreter interface - control method parsing
- *              $Revision: 52 $
+ *              $Revision: 53 $
  *
  *****************************************************************************/
 
@@ -387,7 +387,7 @@ acpi_ds_restart_control_method (
                         * NULL if no return value
                         */
 
-                       status = acpi_ds_result_stack_push (return_desc, walk_state);
+                       status = acpi_ds_result_push (return_desc, walk_state);
                        if (ACPI_FAILURE (status)) {
                                acpi_cm_remove_reference (return_desc);
                                return (status);
index bc19feacabfdc1164236db0f30f3c8f46c5a5dc5..e6913fabf4345a0659d04e58c8bcea20687e53fe 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************************
  *
  * Module Name: dsmthdat - control method arguments and local variables
- *              $Revision: 34 $
+ *              $Revision: 36 $
  *
  ******************************************************************************/
 
@@ -71,10 +71,10 @@ acpi_ds_method_data_init (
        for (i = 0; i < MTH_NUM_ARGS; i++) {
                MOVE_UNALIGNED32_TO_32 (&walk_state->arguments[i].name,
                                 NAMEOF_ARG_NTE);
-
                walk_state->arguments[i].name      |= (i << 24);
                walk_state->arguments[i].data_type  = ACPI_DESC_TYPE_NAMED;
-               walk_state->arguments[i].type       = INTERNAL_TYPE_METHOD_ARGUMENT;
+               walk_state->arguments[i].type       = ACPI_TYPE_ANY;
+               walk_state->arguments[i].flags      = ANOBJ_END_OF_PEER_LIST | ANOBJ_METHOD_ARG;
        }
 
        /* Init the method locals */
@@ -85,7 +85,8 @@ acpi_ds_method_data_init (
 
                walk_state->local_variables[i].name  |= (i << 24);
                walk_state->local_variables[i].data_type = ACPI_DESC_TYPE_NAMED;
-               walk_state->local_variables[i].type   = INTERNAL_TYPE_METHOD_LOCAL_VAR;
+               walk_state->local_variables[i].type   = ACPI_TYPE_ANY;
+               walk_state->local_variables[i].flags  = ANOBJ_END_OF_PEER_LIST | ANOBJ_METHOD_LOCAL;
        }
 
        return (AE_OK);
index db0531ad6eaae198494643eef5d4f28f1bb800dc..042cc4a8093cdf11f089e0c51029402ee7e86de5 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: dsobject - Dispatcher object management routines
- *              $Revision: 43 $
+ *              $Revision: 53 $
  *
  *****************************************************************************/
 
@@ -64,9 +64,13 @@ acpi_ds_init_one_object (
 {
        OBJECT_TYPE_INTERNAL    type;
        ACPI_STATUS             status;
-       INIT_WALK_INFO          *info = (INIT_WALK_INFO *) context;
+       ACPI_INIT_WALK_INFO     *info = (ACPI_INIT_WALK_INFO *) context;
+       u8                      table_revision;
 
 
+       info->object_count++;
+       table_revision = info->table_desc->pointer->revision;
+
        /*
         * We are only interested in objects owned by the table that
         * was just loaded
@@ -98,6 +102,14 @@ acpi_ds_init_one_object (
 
                info->method_count++;
 
+               /*
+                * Set the execution data width (32 or 64) based upon the
+                * revision number of the parent ACPI table.
+                */
+
+               if (table_revision == 1) {
+                       ((ACPI_NAMESPACE_NODE *)obj_handle)->flags |= ANOBJ_DATA_WIDTH_32;
+               }
 
                /*
                 * Always parse methods to detect errors, we may delete
@@ -113,14 +125,10 @@ acpi_ds_init_one_object (
                }
 
                /*
-                * Keep the parse tree only if we are parsing all methods
-                * at init time (versus just-in-time)
+                * Delete the parse tree.  We simple re-parse the method
+                * for every execution since there isn't much overhead
                 */
-
-               if (acpi_gbl_when_to_parse_methods != METHOD_PARSE_AT_INIT) {
-                       acpi_ns_delete_namespace_subtree (obj_handle);
-               }
-
+               acpi_ns_delete_namespace_subtree (obj_handle);
                break;
 
        default:
@@ -154,12 +162,13 @@ acpi_ds_initialize_objects (
        ACPI_NAMESPACE_NODE     *start_node)
 {
        ACPI_STATUS             status;
-       INIT_WALK_INFO          info;
+       ACPI_INIT_WALK_INFO     info;
 
 
-       info.method_count = 0;
+       info.method_count   = 0;
        info.op_region_count = 0;
-       info.table_desc = table_desc;
+       info.object_count   = 0;
+       info.table_desc     = table_desc;
 
 
        /* Walk entire namespace from the supplied root */
@@ -218,7 +227,7 @@ acpi_ds_init_object_from_op (
 
                /* First arg is a number */
 
-               acpi_ds_create_operand (walk_state, op->value.arg);
+               acpi_ds_create_operand (walk_state, op->value.arg, 0);
                arg_desc = walk_state->operands [walk_state->num_operands - 1];
                acpi_ds_obj_stack_pop (1, walk_state);
 
@@ -239,16 +248,24 @@ acpi_ds_init_object_from_op (
 
                /* Get the value, delete the internal object */
 
-               (*obj_desc)->buffer.length = arg_desc->number.value;
+               (*obj_desc)->buffer.length = (u32) arg_desc->number.value;
                acpi_cm_remove_reference (arg_desc);
 
                /* Allocate the buffer */
 
-               (*obj_desc)->buffer.pointer =
-                                 acpi_cm_callocate ((*obj_desc)->buffer.length);
+               if ((*obj_desc)->buffer.length == 0) {
+                       (*obj_desc)->buffer.pointer = NULL;
+                       REPORT_WARNING (("Buffer created with zero length in AML\n"));
+                       break;
+               }
+
+               else {
+                       (*obj_desc)->buffer.pointer =
+                                         acpi_cm_callocate ((*obj_desc)->buffer.length);
 
-               if (!(*obj_desc)->buffer.pointer) {
-                       return (AE_NO_MEMORY);
+                       if (!(*obj_desc)->buffer.pointer) {
+                               return (AE_NO_MEMORY);
+                       }
                }
 
                /*
@@ -360,7 +377,7 @@ acpi_ds_init_object_from_op (
  *
  ****************************************************************************/
 
-ACPI_STATUS
+static ACPI_STATUS
 acpi_ds_build_internal_simple_obj (
        ACPI_WALK_STATE         *walk_state,
        ACPI_PARSE_OBJECT       *op,
@@ -369,6 +386,8 @@ acpi_ds_build_internal_simple_obj (
        ACPI_OPERAND_OBJECT     *obj_desc;
        OBJECT_TYPE_INTERNAL    type;
        ACPI_STATUS             status;
+       u32                     length;
+       char                    *name;
 
 
        if (op->opcode == AML_NAMEPATH_OP) {
@@ -387,6 +406,22 @@ acpi_ds_build_internal_simple_obj (
                                          (ACPI_NAMESPACE_NODE **)&(op->node));
 
                        if (ACPI_FAILURE (status)) {
+                               if (status == AE_NOT_FOUND) {
+                                       name = NULL;
+                                       acpi_ns_externalize_name (ACPI_UINT32_MAX, op->value.string, &length, &name);
+
+                                       if (name) {
+                                               REPORT_WARNING (("Reference %s AML %X not found\n",
+                                                                name, op->aml_offset));
+                                               acpi_cm_free (name);
+                                       }
+                                       else {
+                                               REPORT_WARNING (("Reference %s AML %X not found\n",
+                                                                  op->value.string, op->aml_offset));
+                                       }
+                                       *obj_desc_ptr = NULL;
+                               }
+
                                return (status);
                        }
                }
@@ -473,7 +508,7 @@ acpi_ds_build_internal_package_obj (
        if (!obj_desc->package.elements) {
                /* Package vector allocation failure   */
 
-               REPORT_ERROR ("Ds_build_internal_package_obj: Package vector allocation failure");
+               REPORT_ERROR (("Ds_build_internal_package_obj: Package vector allocation failure\n"));
 
                acpi_cm_delete_object_desc (obj_desc);
                return (AE_NO_MEMORY);
@@ -578,7 +613,7 @@ acpi_ds_create_node (
        status = acpi_ds_build_internal_object (walk_state,
                         op->value.arg, &obj_desc);
        if (ACPI_FAILURE (status)) {
-               goto cleanup;
+               return (status);
        }
 
 
index 80fc3ebe21f839ac1957af67abd22d747bd382ed..21e15bc2613e0b8f580dbd2a70350d1f6366bf11 100644 (file)
@@ -2,7 +2,7 @@
  *
  * Module Name: dsopcode - Dispatcher Op Region support and handling of
  *                         "control" opcodes
- *              $Revision: 17 $
+ *              $Revision: 28 $
  *
  *****************************************************************************/
 
         MODULE_NAME         ("dsopcode")
 
 
+/*****************************************************************************
+ *
+ * FUNCTION:    Acpi_ds_get_field_unit_arguments
+ *
+ * PARAMETERS:  Obj_desc        - A valid Field_unit object
+ *
+ * RETURN:      Status.
+ *
+ * DESCRIPTION: Get Field_unit Buffer and Index. This implements the late
+ *              evaluation of these field attributes.
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+acpi_ds_get_field_unit_arguments (
+       ACPI_OPERAND_OBJECT     *obj_desc)
+{
+       ACPI_OPERAND_OBJECT     *extra_desc;
+       ACPI_NAMESPACE_NODE     *node;
+       ACPI_PARSE_OBJECT       *op;
+       ACPI_PARSE_OBJECT       *field_op;
+       ACPI_STATUS             status;
+       ACPI_TABLE_DESC         *table_desc;
+
+
+       if (obj_desc->common.flags & AOPOBJ_DATA_VALID) {
+               return (AE_OK);
+       }
+
+
+       /* Get the AML pointer (method object) and Field_unit node */
+
+       extra_desc = obj_desc->field_unit.extra;
+       node = obj_desc->field_unit.node;
+
+
+       /*
+        * Allocate a new parser op to be the root of the parsed
+        * Op_region tree
+        */
+
+       op = acpi_ps_alloc_op (AML_SCOPE_OP);
+       if (!op) {
+               return (AE_NO_MEMORY);
+       }
+
+       /* Save the Node for use in Acpi_ps_parse_aml */
+
+       op->node = acpi_ns_get_parent_object (node);
+
+       /* Get a handle to the parent ACPI table */
+
+       status = acpi_tb_handle_to_object (node->owner_id, &table_desc);
+       if (ACPI_FAILURE (status)) {
+               return (status);
+       }
+
+       /* Pass1: Parse the entire Field_unit declaration */
+
+       status = acpi_ps_parse_aml (op, extra_desc->extra.pcode,
+                         extra_desc->extra.pcode_length, 0,
+                         NULL, NULL, NULL, acpi_ds_load1_begin_op, acpi_ds_load1_end_op);
+       if (ACPI_FAILURE (status)) {
+               acpi_ps_delete_parse_tree (op);
+               return (status);
+       }
+
+
+       /* Get and init the actual Fiel_unit_op created above */
+
+       field_op = op->value.arg;
+       op->node = node;
+
+
+       field_op = op->value.arg;
+       field_op->node = node;
+       acpi_ps_delete_parse_tree (op);
+
+       /* Acpi_evaluate the address and length arguments for the Op_region */
+
+       op = acpi_ps_alloc_op (AML_SCOPE_OP);
+       if (!op) {
+               return (AE_NO_MEMORY);
+       }
+
+       op->node = acpi_ns_get_parent_object (node);
+
+       status = acpi_ps_parse_aml (op, extra_desc->extra.pcode,
+                         extra_desc->extra.pcode_length,
+                         ACPI_PARSE_EXECUTE | ACPI_PARSE_DELETE_TREE,
+                         NULL /*Method_desc*/, NULL, NULL,
+                         acpi_ds_exec_begin_op, acpi_ds_exec_end_op);
+       /* All done with the parse tree, delete it */
+
+       acpi_ps_delete_parse_tree (op);
+
+
+       /*
+        * 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;
+
+       return (status);
+}
+
+
 /*****************************************************************************
  *
  * FUNCTION:    Acpi_ds_get_region_arguments
  *
- * PARAMETERS:  Rgn_desc        - A valid region object
+ * PARAMETERS:  Obj_desc        - A valid region object
  *
  * RETURN:      Status.
  *
 
 ACPI_STATUS
 acpi_ds_get_region_arguments (
-       ACPI_OPERAND_OBJECT     *rgn_desc)
+       ACPI_OPERAND_OBJECT     *obj_desc)
 {
-       ACPI_OPERAND_OBJECT     *method_desc;
+       ACPI_OPERAND_OBJECT     *extra_desc = NULL;
        ACPI_NAMESPACE_NODE     *node;
        ACPI_PARSE_OBJECT       *op;
        ACPI_PARSE_OBJECT       *region_op;
@@ -63,14 +171,15 @@ acpi_ds_get_region_arguments (
        ACPI_TABLE_DESC         *table_desc;
 
 
-       if (rgn_desc->region.flags & AOPOBJ_DATA_VALID) {
+       if (obj_desc->region.flags & AOPOBJ_DATA_VALID) {
                return (AE_OK);
        }
 
 
-       method_desc = rgn_desc->region.method;
-       node = rgn_desc->region.node;
+       /* Get the AML pointer (method object) and region node */
 
+       extra_desc = obj_desc->region.extra;
+       node = obj_desc->region.node;
 
        /*
         * Allocate a new parser op to be the root of the parsed
@@ -95,8 +204,8 @@ acpi_ds_get_region_arguments (
 
        /* Parse the entire Op_region declaration, creating a parse tree */
 
-       status = acpi_ps_parse_aml (op, method_desc->method.pcode,
-                         method_desc->method.pcode_length, 0,
+       status = acpi_ps_parse_aml (op, extra_desc->extra.pcode,
+                         extra_desc->extra.pcode_length, 0,
                          NULL, NULL, NULL, acpi_ds_load1_begin_op, acpi_ds_load1_end_op);
 
        if (ACPI_FAILURE (status)) {
@@ -107,8 +216,8 @@ acpi_ds_get_region_arguments (
 
        /* Get and init the actual Region_op created above */
 
-/*    Region_op = Op->Value.Arg;
-       Op->Node = Node;*/
+       region_op = op->value.arg;
+       op->node = node;
 
 
        region_op = op->value.arg;
@@ -124,16 +233,12 @@ acpi_ds_get_region_arguments (
 
        op->node = acpi_ns_get_parent_object (node);
 
-       status = acpi_ps_parse_aml (op, method_desc->method.pcode,
-                         method_desc->method.pcode_length,
+       status = acpi_ps_parse_aml (op, extra_desc->extra.pcode,
+                         extra_desc->extra.pcode_length,
                          ACPI_PARSE_EXECUTE | ACPI_PARSE_DELETE_TREE,
                          NULL /*Method_desc*/, NULL, NULL,
                          acpi_ds_exec_begin_op, acpi_ds_exec_end_op);
-/*
-       Acpi_ps_walk_parsed_aml (Region_op, Region_op, NULL, NULL, NULL,
-                        NULL, Table_desc->Table_id,
-                        Acpi_ds_exec_begin_op, Acpi_ds_exec_end_op);
-*/
+
        /* All done with the parse tree, delete it */
 
        acpi_ps_delete_parse_tree (op);
@@ -172,6 +277,252 @@ acpi_ds_initialize_region (
 }
 
 
+/*****************************************************************************
+ *
+ * FUNCTION:    Acpi_ds_eval_field_unit_operands
+ *
+ * PARAMETERS:  Op              - A valid Field_unit Op object
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Get Field_unit Buffer and Index
+ *              Called from Acpi_ds_exec_end_op during Field_unit parse tree walk
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+acpi_ds_eval_field_unit_operands (
+       ACPI_WALK_STATE         *walk_state,
+       ACPI_PARSE_OBJECT       *op)
+{
+       ACPI_STATUS             status;
+       ACPI_OPERAND_OBJECT     *field_desc;
+       ACPI_NAMESPACE_NODE     *node;
+       ACPI_PARSE_OBJECT       *next_op;
+       u32                     offset;
+       u32                     bit_offset;
+       u16                     bit_count;
+
+
+       ACPI_OPERAND_OBJECT     *res_desc = NULL;
+       ACPI_OPERAND_OBJECT     *cnt_desc = NULL;
+       ACPI_OPERAND_OBJECT     *off_desc = NULL;
+       ACPI_OPERAND_OBJECT     *src_desc = NULL;
+       u32                     num_operands = 3;
+
+
+       /*
+        * This is where we evaluate the address and length fields of the Op_field_unit 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 */
+
+       status = acpi_ds_create_operands (walk_state, next_op);
+       if (ACPI_FAILURE (status)) {
+               return (status);
+       }
+
+       field_desc = acpi_ns_get_attached_object (node);
+       if (!field_desc) {
+               return (AE_NOT_EXIST);
+       }
+
+
+       /* Resolve the operands */
+
+       status = acpi_aml_resolve_operands (op->opcode, WALK_OPERANDS, walk_state);
+
+       /* Get the operands */
+
+       status |= acpi_ds_obj_stack_pop_object (&res_desc, walk_state);
+       if (AML_CREATE_FIELD_OP == op->opcode) {
+               num_operands = 4;
+               status |= acpi_ds_obj_stack_pop_object (&cnt_desc, walk_state);
+       }
+
+       status |= acpi_ds_obj_stack_pop_object (&off_desc, walk_state);
+       status |= acpi_ds_obj_stack_pop_object (&src_desc, walk_state);
+
+       if (ACPI_FAILURE (status)) {
+               /* Invalid parameters on object stack  */
+
+               goto cleanup;
+       }
+
+
+       offset = (u32) off_desc->number.value;
+
+
+       /*
+        * If Res_desc is a Name, it will be a direct name pointer after
+        * Acpi_aml_resolve_operands()
+        */
+
+       if (!VALID_DESCRIPTOR_TYPE (res_desc, ACPI_DESC_TYPE_NAMED)) {
+               status = AE_AML_OPERAND_TYPE;
+               goto cleanup;
+       }
+
+
+       /*
+        * Setup the Bit offsets and counts, according to the opcode
+        */
+
+       switch (op->opcode)
+       {
+
+       /* Def_create_bit_field */
+
+       case AML_BIT_FIELD_OP:
+
+               /* Offset is in bits, Field is a bit */
+
+               bit_offset = offset;
+               bit_count = 1;
+               break;
+
+
+       /* Def_create_byte_field */
+
+       case AML_BYTE_FIELD_OP:
+
+               /* Offset is in bytes, field is a byte */
+
+               bit_offset = 8 * offset;
+               bit_count = 8;
+               break;
+
+
+       /* Def_create_word_field */
+
+       case AML_WORD_FIELD_OP:
+
+               /* Offset is in bytes, field is a word */
+
+               bit_offset = 8 * offset;
+               bit_count = 16;
+               break;
+
+
+       /* Def_create_dWord_field */
+
+       case AML_DWORD_FIELD_OP:
+
+               /* Offset is in bytes, field is a dword */
+
+               bit_offset = 8 * offset;
+               bit_count = 32;
+               break;
+
+
+       /* Def_create_field */
+
+       case AML_CREATE_FIELD_OP:
+
+               /* Offset is in bits, count is in bits */
+
+               bit_offset = offset;
+               bit_count = (u16) cnt_desc->number.value;
+               break;
+
+
+       default:
+
+               status = AE_AML_BAD_OPCODE;
+               goto cleanup;
+       }
+
+
+       /*
+        * Setup field according to the object 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))
+               {
+                       status = AE_AML_BUFFER_LIMIT;
+                       goto cleanup;
+               }
+
+
+               /* Construct the remainder of the field object */
+
+               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;
+
+               /* Reference count for Src_desc inherits Field_desc count */
+
+               src_desc->common.reference_count = (u16) (src_desc->common.reference_count +
+                                  field_desc->common.reference_count);
+
+               break;
+
+
+       /* Improper object type */
+
+       default:
+
+               if ((src_desc->common.type > (u8) INTERNAL_TYPE_REFERENCE) ||
+                       !acpi_cm_valid_object_type (src_desc->common.type))
+
+
+               status = AE_AML_OPERAND_TYPE;
+               goto cleanup;
+       }
+
+
+       if (AML_CREATE_FIELD_OP == op->opcode) {
+               /* Delete object descriptor unique to Create_field */
+
+               acpi_cm_remove_reference (cnt_desc);
+               cnt_desc = NULL;
+       }
+
+
+cleanup:
+
+       /* Always delete the operands */
+
+       acpi_cm_remove_reference (off_desc);
+       acpi_cm_remove_reference (src_desc);
+
+       if (AML_CREATE_FIELD_OP == op->opcode) {
+               acpi_cm_remove_reference (cnt_desc);
+       }
+
+       /* On failure, delete the result descriptor */
+
+       if (ACPI_FAILURE (status)) {
+               acpi_cm_remove_reference (res_desc); /* Result descriptor */
+       }
+
+       else {
+               /* Now the address and length are valid for this op_field_unit */
+
+               field_desc->field_unit.flags |= AOPOBJ_DATA_VALID;
+       }
+
+       return (status);
+}
+
+
 /*****************************************************************************
  *
  * FUNCTION:    Acpi_ds_eval_region_operands
@@ -192,7 +543,7 @@ acpi_ds_eval_region_operands (
 {
        ACPI_STATUS             status;
        ACPI_OPERAND_OBJECT     *obj_desc;
-       ACPI_OPERAND_OBJECT     *region_desc;
+       ACPI_OPERAND_OBJECT     *operand_desc;
        ACPI_NAMESPACE_NODE     *node;
        ACPI_PARSE_OBJECT       *next_op;
 
@@ -216,31 +567,41 @@ acpi_ds_eval_region_operands (
                return (status);
        }
 
-       region_desc = acpi_ns_get_attached_object (node);
-       if (!region_desc) {
-               return (AE_NOT_EXIST);
+       /* Resolve the length and address operands to numbers */
+
+       status = acpi_aml_resolve_operands (op->opcode, WALK_OPERANDS, walk_state);
+       if (ACPI_FAILURE (status)) {
+               return (status);
        }
 
-       /* Get the length and save it */
 
-       /* Top of stack */
-       obj_desc = walk_state->operands[walk_state->num_operands - 1];
+       obj_desc = acpi_ns_get_attached_object (node);
+       if (!obj_desc) {
+               return (AE_NOT_EXIST);
+       }
 
-       region_desc->region.length = obj_desc->number.value;
-       acpi_cm_remove_reference (obj_desc);
+       /*
+        * Get the length operand and save it
+        * (at Top of stack)
+        */
+       operand_desc = walk_state->operands[walk_state->num_operands - 1];
 
-       /* Get the address and save it */
+       obj_desc->region.length = (u32) operand_desc->number.value;
+       acpi_cm_remove_reference (operand_desc);
 
-       /* Top of stack - 1 */
-       obj_desc = walk_state->operands[walk_state->num_operands - 2];
+       /*
+        * Get the address and save it
+        * (at top of stack - 1)
+        */
+       operand_desc = walk_state->operands[walk_state->num_operands - 2];
 
-       region_desc->region.address = obj_desc->number.value;
-       acpi_cm_remove_reference (obj_desc);
+       obj_desc->region.address = (ACPI_PHYSICAL_ADDRESS) operand_desc->number.value;
+       acpi_cm_remove_reference (operand_desc);
 
 
        /* Now the address and length are valid for this opregion */
 
-       region_desc->region.flags |= AOPOBJ_DATA_VALID;
+       obj_desc->region.flags |= AOPOBJ_DATA_VALID;
 
        return (status);
 }
@@ -294,6 +655,7 @@ acpi_ds_exec_begin_control_op (
                 */
                walk_state->control_state->control.aml_predicate_start =
                                 walk_state->parser_state->aml - 1;
+                                /* TBD: can this be removed? */
                                 /*Acpi_ps_pkg_length_encoding_size (GET8 (Walk_state->Parser_state->Aml));*/
                break;
 
@@ -385,15 +747,14 @@ acpi_ds_exec_end_control_op (
                        status = AE_CTRL_PENDING;
                }
 
-/*        else {*/
-                       /* Pop this control state and free it */
 
-                       control_state =
-                                       acpi_cm_pop_generic_state (&walk_state->control_state);
+               /* Pop this control state and free it */
 
-                       walk_state->aml_last_while = control_state->control.aml_predicate_start;
-                       acpi_cm_delete_generic_state (control_state);
-/*        }*/
+               control_state =
+                               acpi_cm_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);
 
                break;
 
@@ -434,7 +795,9 @@ acpi_ds_exec_end_control_op (
                        walk_state->return_desc = walk_state->operands[0];
                }
 
-               else if (walk_state->num_results > 0) {
+               else if ((walk_state->results) &&
+                                (walk_state->results->results.num_results > 0))
+               {
                        /*
                         * The return value has come from a previous calculation.
                         *
@@ -443,12 +806,12 @@ acpi_ds_exec_end_control_op (
                         * cease to exist at the end of the method.
                         */
 
-                       status = acpi_aml_resolve_to_value (&walk_state->results [0], walk_state);
+                       status = acpi_aml_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 [0];
+                       walk_state->return_desc = walk_state->results->results.obj_desc [0];
                }
 
                else {
index 0b811bebd9c9a7df312d60fc196685a52172f9f4..2efa43e5164bc7a0f7f00e728f645f6ab1c5f92f 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************************
  *
  * Module Name: dsutils - Dispatcher utilities
- *              $Revision: 44 $
+ *              $Revision: 50 $
  *
  ******************************************************************************/
 
@@ -52,7 +52,8 @@
 
 u8
 acpi_ds_is_result_used (
-       ACPI_PARSE_OBJECT       *op)
+       ACPI_PARSE_OBJECT       *op,
+       ACPI_WALK_STATE         *walk_state)
 {
        ACPI_OPCODE_INFO        *parent_info;
 
@@ -85,13 +86,6 @@ acpi_ds_is_result_used (
        }
 
 
-       /* Never delete the return value associated with a return opcode */
-
-       if (op->parent->opcode == AML_RETURN_OP) {
-               return (TRUE);
-       }
-
-
        /*
         * Decide what to do with the result based on the parent.  If
         * the parent opcode will not use the result, delete the object.
@@ -105,8 +99,54 @@ acpi_ds_is_result_used (
         * In these cases, the parent will never use the return object
         */
        case OPTYPE_CONTROL:        /* IF, ELSE, WHILE only */
+
+               switch (op->parent->opcode)
+               {
+               case AML_RETURN_OP:
+
+                       /* Never delete the return value associated with a return opcode */
+
+                       return (TRUE);
+                       break;
+
+               case AML_IF_OP:
+               case AML_WHILE_OP:
+
+                       /*
+                        * If we are executing the predicate AND this is the predicate op,
+                        * we will use the return value!
+                        */
+
+                       if ((walk_state->control_state->common.state == CONTROL_PREDICATE_EXECUTING) &&
+                               (walk_state->control_state->control.predicate_op == op))
+                       {
+                               return (TRUE);
+                       }
+
+                       break;
+               }
+
+
+               /* Fall through to not used case below */
+
+
        case OPTYPE_NAMED_OBJECT:   /* Scope, method, etc. */
 
+               /*
+                * 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))
+               {
+                       return (TRUE);
+               }
+
                return (FALSE);
                break;
 
@@ -158,13 +198,13 @@ acpi_ds_delete_result_if_not_used (
        }
 
 
-       if (!acpi_ds_is_result_used (op)) {
+       if (!acpi_ds_is_result_used (op, walk_state)) {
                /*
                 * Must pop the result stack (Obj_desc should be equal
                 *  to Result_obj)
                 */
 
-               status = acpi_ds_result_stack_pop (&obj_desc, walk_state);
+               status = acpi_ds_result_pop (&obj_desc, walk_state);
                if (ACPI_SUCCESS (status)) {
                        acpi_cm_remove_reference (result_obj);
                }
@@ -193,7 +233,8 @@ acpi_ds_delete_result_if_not_used (
 ACPI_STATUS
 acpi_ds_create_operand (
        ACPI_WALK_STATE         *walk_state,
-       ACPI_PARSE_OBJECT       *arg)
+       ACPI_PARSE_OBJECT       *arg,
+       u32                     arg_index)
 {
        ACPI_STATUS             status = AE_OK;
        NATIVE_CHAR             *name_string;
@@ -237,6 +278,7 @@ acpi_ds_create_operand (
                parent_op = arg->parent;
                if ((acpi_ps_is_node_op (parent_op->opcode)) &&
                        (parent_op->opcode != AML_METHODCALL_OP) &&
+                       (parent_op->opcode != AML_REGION_OP) &&
                        (parent_op->opcode != AML_NAMEPATH_OP))
                {
                        /* Enter name into namespace if not found */
@@ -340,7 +382,7 @@ acpi_ds_create_operand (
                         * by the evaluation of this argument
                         */
 
-                       status = acpi_ds_result_stack_pop (&obj_desc, walk_state);
+                       status = acpi_ds_result_pop_from_bottom (&obj_desc, walk_state);
                        if (ACPI_FAILURE (status)) {
                                /*
                                 * Only error is underflow, and this indicates
@@ -404,17 +446,14 @@ acpi_ds_create_operands (
 {
        ACPI_STATUS             status = AE_OK;
        ACPI_PARSE_OBJECT       *arg;
-       u32                     args_pushed = 0;
-
-
-       arg = first_arg;
+       u32                     arg_count = 0;
 
 
        /* For all arguments in the list... */
 
+       arg = first_arg;
        while (arg) {
-
-               status = acpi_ds_create_operand (walk_state, arg);
+               status = acpi_ds_create_operand (walk_state, arg, arg_count);
                if (ACPI_FAILURE (status)) {
                        goto cleanup;
                }
@@ -422,7 +461,7 @@ acpi_ds_create_operands (
                /* Move on to next argument, if any */
 
                arg = arg->next;
-               args_pushed++;
+               arg_count++;
        }
 
        return (status);
@@ -435,7 +474,7 @@ cleanup:
         * objects
         */
 
-       acpi_ds_obj_stack_pop_and_delete (args_pushed, walk_state);
+       acpi_ds_obj_stack_pop_and_delete (arg_count, walk_state);
 
        return (status);
 }
@@ -539,8 +578,10 @@ acpi_ds_map_opcode_to_data_type (
                case AML_NAMEPATH_OP:
                        data_type = INTERNAL_TYPE_REFERENCE;
                        break;
-               }
 
+               default:
+                       break;
+               }
                break;
 
 
@@ -557,8 +598,10 @@ acpi_ds_map_opcode_to_data_type (
 
                        data_type = ACPI_TYPE_PACKAGE;
                        break;
-               }
 
+               default:
+                       break;
+               }
                break;
 
 
@@ -581,21 +624,18 @@ acpi_ds_map_opcode_to_data_type (
 
                flags = OP_HAS_RETURN_VALUE;
                data_type = ACPI_TYPE_ANY;
-
                break;
 
        case OPTYPE_METHOD_CALL:
 
                flags = OP_HAS_RETURN_VALUE;
                data_type = ACPI_TYPE_METHOD;
-
                break;
 
 
        case OPTYPE_NAMED_OBJECT:
 
                data_type = acpi_ds_map_named_opcode_to_data_type (opcode);
-
                break;
 
 
index 9cac0aac3019904c54f30b3a8949e210bbb481c9..1f7e329adb97bdd1579766baccc6131b0f57fe1d 100644 (file)
@@ -2,7 +2,7 @@
  *
  * Module Name: dswexec - Dispatcher method execution callbacks;
  *                        dispatch to interpreter.
- *              $Revision: 42 $
+ *              $Revision: 50 $
  *
  *****************************************************************************/
 
         MODULE_NAME         ("dswexec")
 
 
+/*****************************************************************************
+ *
+ * FUNCTION:    Acpi_ds_get_predicate_value
+ *
+ * PARAMETERS:  Walk_state      - Current state of the parse tree walk
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION:
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+acpi_ds_get_predicate_value (
+       ACPI_WALK_STATE         *walk_state,
+       ACPI_PARSE_OBJECT       *op,
+       u32                     has_result_obj)
+{
+       ACPI_STATUS             status = AE_OK;
+       ACPI_OPERAND_OBJECT     *obj_desc;
+
+
+       walk_state->control_state->common.state = 0;
+
+       if (has_result_obj) {
+               status = acpi_ds_result_pop (&obj_desc, walk_state);
+               if (ACPI_FAILURE (status)) {
+                       return (status);
+               }
+       }
+
+       else {
+               status = acpi_ds_create_operand (walk_state, op, 0);
+               if (ACPI_FAILURE (status)) {
+                       return (status);
+               }
+
+               status = acpi_aml_resolve_to_value (&walk_state->operands [0], walk_state);
+               if (ACPI_FAILURE (status)) {
+                       return (status);
+               }
+
+               obj_desc = walk_state->operands [0];
+       }
+
+       if (!obj_desc) {
+               return (AE_AML_NO_OPERAND);
+       }
+
+
+       /*
+        * Result of predicate evaluation currently must
+        * be a number
+        */
+
+       if (obj_desc->common.type != ACPI_TYPE_NUMBER) {
+               status = AE_AML_OPERAND_TYPE;
+               goto cleanup;
+       }
+
+
+       /* TBD: 64/32-bit */
+
+       obj_desc->number.value &= (UINT64) 0x00000000FFFFFFFF;
+
+       /*
+        * Save the result of the predicate evaluation on
+        * the control stack
+        */
+
+       if (obj_desc->number.value) {
+               walk_state->control_state->common.value = TRUE;
+       }
+
+       else {
+               /*
+                * Predicate is FALSE, we will just toss the
+                * rest of the package
+                */
+
+               walk_state->control_state->common.value = FALSE;
+               status = AE_CTRL_FALSE;
+       }
+
+
+cleanup:
+
+        /* Break to debugger to display result */
+
+       DEBUGGER_EXEC (acpi_db_display_result_object (obj_desc, walk_state));
+
+       /*
+        * Delete the predicate result object (we know that
+        * we don't need it anymore)
+        */
+
+       acpi_cm_remove_reference (obj_desc);
+
+       walk_state->control_state->common.state = CONTROL_NORMAL;
+
+       return (status);
+}
+
+
 /*****************************************************************************
  *
  * FUNCTION:    Acpi_ds_exec_begin_op
@@ -117,6 +221,11 @@ acpi_ds_exec_begin_op (
        {
        case OPTYPE_CONTROL:
 
+               status = acpi_ds_result_stack_push (walk_state);
+               if (ACPI_FAILURE (status)) {
+                       return (status);
+               }
+
                status = acpi_ds_exec_begin_control_op (walk_state, op);
                break;
 
@@ -134,6 +243,33 @@ acpi_ds_exec_begin_op (
 
                        status = acpi_ds_load2_begin_op (op->opcode, op, walk_state, NULL);
                }
+
+
+               if (op->opcode == AML_REGION_OP) {
+                       status = acpi_ds_result_stack_push (walk_state);
+               }
+
+               break;
+
+
+       /* most operators with arguments */
+
+       case OPTYPE_MONADIC1:
+       case OPTYPE_DYADIC1:
+       case OPTYPE_MONADIC2:
+       case OPTYPE_MONADIC2_r:
+       case OPTYPE_DYADIC2:
+       case OPTYPE_DYADIC2_r:
+       case OPTYPE_DYADIC2_s:
+       case OPTYPE_RECONFIGURATION:
+       case OPTYPE_INDEX:
+       case OPTYPE_MATCH:
+       case OPTYPE_FATAL:
+       case OPTYPE_CREATE_FIELD:
+
+               /* Start a new result/operand state */
+
+               status = acpi_ds_result_stack_push (walk_state);
                break;
 
 
@@ -171,7 +307,6 @@ acpi_ds_exec_end_op (
        ACPI_STATUS             status = AE_OK;
        u16                     opcode;
        u8                      optype;
-       ACPI_OPERAND_OBJECT     *obj_desc;
        ACPI_PARSE_OBJECT       *next_op;
        ACPI_NAMESPACE_NODE     *node;
        ACPI_PARSE_OBJECT       *first_arg;
@@ -236,10 +371,11 @@ acpi_ds_exec_end_op (
        case OPTYPE_RECONFIGURATION:
        case OPTYPE_INDEX:
        case OPTYPE_MATCH:
-       case OPTYPE_CREATE_FIELD:
        case OPTYPE_FATAL:
 
 
+               /* Build resolved operand stack */
+
                status = acpi_ds_create_operands (walk_state, first_arg);
                if (ACPI_FAILURE (status)) {
                        goto cleanup;
@@ -247,9 +383,16 @@ acpi_ds_exec_end_op (
 
                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);
+               if (ACPI_FAILURE (status)) {
+                       goto cleanup;
+               }
+
                switch (optype)
                {
-
                case OPTYPE_MONADIC1:
 
                        /* 1 Operand, 0 External_result, 0 Internal_result */
@@ -263,10 +406,6 @@ acpi_ds_exec_end_op (
                        /* 1 Operand, 0 External_result, 1 Internal_result */
 
                        status = acpi_aml_exec_monadic2 (opcode, walk_state, &result_obj);
-                       if (ACPI_SUCCESS (status)) {
-                               status = acpi_ds_result_stack_push (result_obj, walk_state);
-                       }
-
                        break;
 
 
@@ -275,10 +414,6 @@ acpi_ds_exec_end_op (
                        /* 1 Operand, 1 External_result, 1 Internal_result */
 
                        status = acpi_aml_exec_monadic2_r (opcode, walk_state, &result_obj);
-                       if (ACPI_SUCCESS (status)) {
-                               status = acpi_ds_result_stack_push (result_obj, walk_state);
-                       }
-
                        break;
 
 
@@ -287,7 +422,6 @@ acpi_ds_exec_end_op (
                        /* 2 Operands, 0 External_result, 0 Internal_result */
 
                        status = acpi_aml_exec_dyadic1 (opcode, walk_state);
-
                        break;
 
 
@@ -296,10 +430,6 @@ acpi_ds_exec_end_op (
                        /* 2 Operands, 0 External_result, 1 Internal_result */
 
                        status = acpi_aml_exec_dyadic2 (opcode, walk_state, &result_obj);
-                       if (ACPI_SUCCESS (status)) {
-                               status = acpi_ds_result_stack_push (result_obj, walk_state);
-                       }
-
                        break;
 
 
@@ -307,17 +437,7 @@ acpi_ds_exec_end_op (
 
                        /* 2 Operands, 1 or 2 External_results, 1 Internal_result */
 
-
-                       /* NEW INTERFACE:
-                        * Pass in Walk_state, keep result obj but let interpreter
-                        * push the result
-                        */
-
                        status = acpi_aml_exec_dyadic2_r (opcode, walk_state, &result_obj);
-                       if (ACPI_SUCCESS (status)) {
-                               status = acpi_ds_result_stack_push (result_obj, walk_state);
-                       }
-
                        break;
 
 
@@ -326,59 +446,49 @@ acpi_ds_exec_end_op (
                        /* 2 Operands, 0 External_result, 1 Internal_result */
 
                        status = acpi_aml_exec_dyadic2_s (opcode, walk_state, &result_obj);
-                       if (ACPI_SUCCESS (status)) {
-                               status = acpi_ds_result_stack_push (result_obj, walk_state);
-                       }
-
                        break;
 
 
-               case OPTYPE_RECONFIGURATION:
+               case OPTYPE_INDEX:  /* Type 2 opcode with 3 operands */
 
-                       /* 1 or 2 operands, 0 Internal Result */
+                       /* 3 Operands, 1 External_result, 1 Internal_result */
 
-                       status = acpi_aml_exec_reconfiguration (opcode, walk_state);
+                       status = acpi_aml_exec_index (walk_state, &result_obj);
                        break;
 
 
-               case OPTYPE_CREATE_FIELD:
+               case OPTYPE_MATCH:  /* Type 2 opcode with 6 operands */
 
-                       /* 3 or 4 Operands, 0 External_result, 0 Internal_result */
+                       /* 6 Operands, 0 External_result, 1 Internal_result */
 
-                       status = acpi_aml_exec_create_field (opcode, walk_state);
+                       status = acpi_aml_exec_match (walk_state, &result_obj);
                        break;
 
 
-               case OPTYPE_FATAL:
+               case OPTYPE_RECONFIGURATION:
 
-                       /* 3 Operands, 0 External_result, 0 Internal_result */
+                       /* 1 or 2 operands, 0 Internal Result */
 
-                       status = acpi_aml_exec_fatal (walk_state);
+                       status = acpi_aml_exec_reconfiguration (opcode, walk_state);
                        break;
 
 
-               case OPTYPE_INDEX:  /* Type 2 opcode with 3 operands */
-
-                       /* 3 Operands, 1 External_result, 1 Internal_result */
+               case OPTYPE_FATAL:
 
-                       status = acpi_aml_exec_index (walk_state, &result_obj);
-                       if (ACPI_SUCCESS (status)) {
-                               status = acpi_ds_result_stack_push (result_obj, walk_state);
-                       }
+                       /* 3 Operands, 0 External_result, 0 Internal_result */
 
+                       status = acpi_aml_exec_fatal (walk_state);
                        break;
+               }
 
-
-               case OPTYPE_MATCH:  /* Type 2 opcode with 6 operands */
-
-                       /* 6 Operands, 0 External_result, 1 Internal_result */
-
-                       status = acpi_aml_exec_match (walk_state, &result_obj);
-                       if (ACPI_SUCCESS (status)) {
-                               status = acpi_ds_result_stack_push (result_obj, walk_state);
-                       }
-
-                       break;
+               /*
+                * If a result object was returned from above, push it on the
+                * current result stack
+                */
+               if (ACPI_SUCCESS (status) &&
+                       result_obj)
+               {
+                       status = acpi_ds_result_push (result_obj, walk_state);
                }
 
                break;
@@ -390,6 +500,7 @@ acpi_ds_exec_end_op (
 
                status = acpi_ds_exec_end_control_op (walk_state, op);
 
+               acpi_ds_result_stack_pop (walk_state);
                break;
 
 
@@ -400,17 +511,17 @@ acpi_ds_exec_end_op (
                 * the method Node pointer
                 */
                /* 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 */
-               next_op = next_op->next;
 
+               next_op = next_op->next;
 
                /*
                 * Get the method's arguments and put them on the operand stack
                 */
-
                status = acpi_ds_create_operands (walk_state, next_op);
                if (ACPI_FAILURE (status)) {
                        break;
@@ -428,55 +539,52 @@ acpi_ds_exec_end_op (
                        break;
                }
 
-               /* Open new scope on the scope stack */
-/*
-               Status = Acpi_ns_scope_stack_push_entry (Node);
-               if (ACPI_FAILURE (Status)) {
-                       break;
-               }
-*/
+               /*
+                * Tell the walk loop to preempt this running method and
+                * execute the new method
+                */
+               status = AE_CTRL_TRANSFER;
 
-               /* Tell the walk loop to preempt this running method and
-               execute the new method */
+               /*
+                * Return now; we don't want to disturb anything,
+                * especially the operand count!
+                */
+               return (status);
+               break;
 
-               status = AE_CTRL_TRANSFER;
 
-               /* Return now; we don't want to disturb anything,
-               especially the operand count! */
+       case OPTYPE_CREATE_FIELD:
+
+               status = acpi_ds_load2_end_op (walk_state, op);
+               if (ACPI_FAILURE (status)) {
+                       break;
+               }
 
-               return (status);
+               status = acpi_ds_eval_field_unit_operands (walk_state, op);
                break;
 
 
        case OPTYPE_NAMED_OBJECT:
 
-
                status = acpi_ds_load2_end_op (walk_state, op);
                if (ACPI_FAILURE (status)) {
                        break;
                }
-/*
-               if ((Walk_state->Origin->Opcode == AML_METHOD_OP) &&
-                       (Walk_state->Origin != Op))
-               {
-                       Status = Acpi_ds_load2_end_op (Walk_state, Op);
-                       if (ACPI_FAILURE (Status)) {
-                               break;
-                       }
-               }
-*/
 
                switch (op->opcode)
                {
                case AML_REGION_OP:
 
                        status = acpi_ds_eval_region_operands (walk_state, op);
+                       if (ACPI_FAILURE (status)) {
+                               break;
+                       }
 
+                       status = acpi_ds_result_stack_pop (walk_state);
                        break;
 
 
                case AML_METHOD_OP:
-
                        break;
 
 
@@ -503,6 +611,12 @@ acpi_ds_exec_end_op (
        }
 
 
+       /*
+        * 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);
+
        /*
         * Check if we just completed the evaluation of a
         * conditional predicate
@@ -513,70 +627,12 @@ acpi_ds_exec_end_op (
                        CONTROL_PREDICATE_EXECUTING) &&
                (walk_state->control_state->control.predicate_op == op))
        {
-               /* Completed the predicate, the result must be a number */
-
-               walk_state->control_state->common.state = 0;
-
-               if (result_obj) {
-                       status = acpi_ds_result_stack_pop (&obj_desc, walk_state);
-                       if (ACPI_FAILURE (status)) {
-                               goto cleanup;
-                       }
-               }
-
-               else {
-                       status = acpi_ds_create_operand (walk_state, op);
-                       if (ACPI_FAILURE (status)) {
-                               goto cleanup;
-                       }
-
-                       status = acpi_aml_resolve_to_value (&walk_state->operands [0], walk_state);
-                       if (ACPI_FAILURE (status)) {
-                               goto cleanup;
-                       }
-
-                       obj_desc = walk_state->operands [0];
-               }
-
-               if (!obj_desc) {
-                       status = AE_AML_NO_OPERAND;
-                       goto cleanup;
-               }
-
-               if (obj_desc->common.type != ACPI_TYPE_NUMBER) {
-                       status = AE_AML_OPERAND_TYPE;
-                       goto cleanup;
-               }
-               /* Save the result of the predicate evaluation on
-               the control stack */
-
-               if (obj_desc->number.value) {
-                       walk_state->control_state->common.value = TRUE;
-               }
-               else {
-                       /* Predicate is FALSE, we will just toss the
-                       rest of the package */
-
-                       walk_state->control_state->common.value = FALSE;
-                       status = AE_CTRL_FALSE;
-               }
-
-                /* Break to debugger to display result */
-
-               DEBUGGER_EXEC (acpi_db_display_result_object (obj_desc, walk_state));
-
-               /* Delete the predicate result object (we know that
-               we don't need it anymore) and cleanup the stack */
-
-               acpi_cm_remove_reference (obj_desc);
+               status = acpi_ds_get_predicate_value (walk_state, op, (u32) result_obj);
                result_obj = NULL;
-
-               walk_state->control_state->common.state = CONTROL_NORMAL;
        }
 
 
 cleanup:
-
        if (result_obj) {
                /* Break to debugger to display result */
 
index fd82d5a0eba772b59e42e315b275d37e17af04fc..b3f1dc06230e5824a64bd3ada530109b105bc86a 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: dswload - Dispatcher namespace load callbacks
- *              $Revision: 19 $
+ *              $Revision: 24 $
  *
  *****************************************************************************/
 
@@ -86,6 +86,7 @@ acpi_ds_load1_begin_op (
        data_type = acpi_ds_map_named_opcode_to_data_type (opcode);
 
 
+
        /*
         * Enter the named type into the internal namespace.  We enter the name
         * as we go downward in the parse tree.  Any necessary subobjects that involve
@@ -438,6 +439,11 @@ acpi_ds_load2_end_op (
        case AML_WORD_FIELD_OP:
        case AML_DWORD_FIELD_OP:
 
+               /*
+                * Create the field object, but the field buffer and index must
+                * be evaluated later during the execution phase
+                */
+
                /* Get the Name_string argument */
 
                if (op->opcode == AML_CREATE_FIELD_OP) {
@@ -468,15 +474,22 @@ acpi_ds_load2_end_op (
                        op->node = new_node;
 
                        /*
-                        * If this is NOT a control method, we need to evaluate this opcode now.
+                        * 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.
                         */
-
-                       /* THIS WON"T WORK. Must execute all operands like Add().  => Must do an execute pass
-                       if (!Walk_state->Method_desc) {
-                               Status = Acpi_ds_exec_end_op (Walk_state, Op);
+                       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);
                        }
-                       */
                }
+
+
                break;
 
 
@@ -619,7 +632,8 @@ acpi_ds_load2_end_op (
 
                status = acpi_aml_exec_create_region (((ACPI_PARSE2_OBJECT *) op)->data,
                                   ((ACPI_PARSE2_OBJECT *) op)->length,
-                                  arg->value.integer, walk_state);
+                                  (ACPI_ADDRESS_SPACE_TYPE) arg->value.integer,
+                                  walk_state);
 
                break;
 
@@ -639,7 +653,15 @@ acpi_ds_load2_end_op (
 
        case AML_NAME_OP:
 
-               status = acpi_ds_create_node (walk_state, node, op);
+               /*
+                * Because of the execution pass through the non-control-method
+                * parts of the table, we can arrive here twice.  Only init
+                * the named object node the first time through
+                */
+
+               if (!node->object) {
+                       status = acpi_ds_create_node (walk_state, node, op);
+               }
 
                break;
 
@@ -662,3 +684,4 @@ cleanup:
        return (status);
 }
 
+
index 89750b34174a4917790946b3a4c493a3b12bdec3..11b6a6cb96dceccf0103d1fe65175054b62c5e3e 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: dswscope - Scope stack manipulation
- *              $Revision: 38 $
+ *              $Revision: 40 $
  *
  *****************************************************************************/
 
@@ -89,14 +89,14 @@ acpi_ds_scope_stack_push (
        if (!node) {
                /*  invalid scope   */
 
-               REPORT_ERROR ("Ds_scope_stack_push: null scope passed");
+               REPORT_ERROR (("Ds_scope_stack_push: null scope passed\n"));
                return (AE_BAD_PARAMETER);
        }
 
        /* Make sure object type is valid */
 
        if (!acpi_aml_validate_object_type (type)) {
-               REPORT_WARNING ("Ds_scope_stack_push: type code out of range");
+               REPORT_WARNING (("Ds_scope_stack_push: type code out of range\n"));
        }
 
 
index cc2088492f80b9d099ba5a6be4f1c312e8924d98..cac9f24caa07bf989f39cb634778acbb62598955 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: dswstate - Dispatcher parse tree walk management routines
- *              $Revision: 31 $
+ *              $Revision: 35 $
  *
  *****************************************************************************/
 
  ******************************************************************************/
 
 ACPI_STATUS
-acpi_ds_result_stack_clear (
+xxx_acpi_ds_result_stack_clear (
        ACPI_WALK_STATE         *walk_state)
 {
-
-       walk_state->num_results = 0;
-       walk_state->current_result = 0;
-
+/*
+       Walk_state->Num_results = 0;
+       Walk_state->Current_result = 0;
+*/
        return (AE_OK);
 }
 
 
 /*******************************************************************************
  *
- * FUNCTION:    Acpi_ds_result_stack_push
+ * FUNCTION:    Acpi_ds_result_insert
  *
  * PARAMETERS:  Object              - Object to push
  *              Walk_state          - Current Walk state
@@ -74,18 +74,29 @@ acpi_ds_result_stack_clear (
  ******************************************************************************/
 
 ACPI_STATUS
-acpi_ds_result_stack_push (
+acpi_ds_result_insert (
        void                    *object,
+       u32                     index,
        ACPI_WALK_STATE         *walk_state)
 {
+       ACPI_GENERIC_STATE      *state;
 
 
-       if (walk_state->num_results >= OBJ_NUM_OPERANDS) {
-               return (AE_STACK_OVERFLOW);
+       state = walk_state->results;
+       if (!state) {
+               return (AE_NOT_EXIST);
+       }
+
+       if (index >= OBJ_NUM_OPERANDS) {
+               return (AE_BAD_PARAMETER);
+       }
+
+       if (!object) {
+               return (AE_BAD_PARAMETER);
        }
 
-       walk_state->results [walk_state->num_results] = object;
-       walk_state->num_results++;
+       state->results.obj_desc [index] = object;
+       state->results.num_results++;
 
        return (AE_OK);
 }
@@ -93,7 +104,7 @@ acpi_ds_result_stack_push (
 
 /*******************************************************************************
  *
- * FUNCTION:    Acpi_ds_result_stack_pop
+ * FUNCTION:    Acpi_ds_result_remove
  *
  * PARAMETERS:  Object              - Where to return the popped object
  *              Walk_state          - Current Walk state
@@ -106,31 +117,250 @@ acpi_ds_result_stack_push (
  ******************************************************************************/
 
 ACPI_STATUS
-acpi_ds_result_stack_pop (
+acpi_ds_result_remove (
        ACPI_OPERAND_OBJECT     **object,
+       u32                     index,
        ACPI_WALK_STATE         *walk_state)
 {
+       ACPI_GENERIC_STATE      *state;
 
 
-       /* Check for stack underflow */
+       state = walk_state->results;
+       if (!state) {
+               return (AE_NOT_EXIST);
+       }
 
-       if (walk_state->num_results == 0) {
+
+
+       /* Check for a valid result object */
+
+       if (!state->results.obj_desc [index]) {
                return (AE_AML_NO_OPERAND);
        }
 
+       /* Remove the object */
 
-       /* Pop the stack */
+       state->results.num_results--;
+
+       *object = state->results.obj_desc [index];
+       state->results.obj_desc [index] = NULL;
+
+       return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ds_result_pop
+ *
+ * PARAMETERS:  Object              - Where to return the popped object
+ *              Walk_state          - Current Walk state
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Pop an object off the bottom of this walk's result stack.  In
+ *              other words, this is a FIFO.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_ds_result_pop (
+       ACPI_OPERAND_OBJECT     **object,
+       ACPI_WALK_STATE         *walk_state)
+{
+       u32                     index;
+       ACPI_GENERIC_STATE      *state;
 
-       walk_state->num_results--;
+
+       state = walk_state->results;
+       if (!state) {
+               return (AE_OK);
+       }
+
+
+       if (!state->results.num_results) {
+               return (AE_STACK_UNDERFLOW);
+       }
+
+       /* Remove top element */
+
+       state->results.num_results--;
+
+       for (index = OBJ_NUM_OPERANDS; index; index--) {
+               /* Check for a valid result object */
+
+               if (state->results.obj_desc [index -1]) {
+                       *object = state->results.obj_desc [index -1];
+                       state->results.obj_desc [index -1] = NULL;
+
+                       return (AE_OK);
+               }
+       }
+
+
+       return (AE_STACK_UNDERFLOW);
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ds_result_pop
+ *
+ * PARAMETERS:  Object              - Where to return the popped object
+ *              Walk_state          - Current Walk state
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Pop an object off the bottom of this walk's result stack.  In
+ *              other words, this is a FIFO.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_ds_result_pop_from_bottom (
+       ACPI_OPERAND_OBJECT     **object,
+       ACPI_WALK_STATE         *walk_state)
+{
+       u32                     index;
+       ACPI_GENERIC_STATE      *state;
+
+
+       state = walk_state->results;
+       if (!state) {
+               return (AE_NOT_EXIST);
+       }
+
+
+       if (!state->results.num_results) {
+               return (AE_STACK_UNDERFLOW);
+       }
+
+       /* Remove Bottom element */
+
+       *object = state->results.obj_desc [0];
+
+
+       /* Push entire stack down one element */
+
+       for (index = 0; index < state->results.num_results; index++) {
+               state->results.obj_desc [index] = state->results.obj_desc [index + 1];
+       }
+
+       state->results.num_results--;
 
        /* Check for a valid result object */
 
-       if (!walk_state->results [walk_state->num_results]) {
+       if (!*object) {
+               return (AE_AML_NO_OPERAND);
+       }
+
+       
+       return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ds_result_pop
+ *
+ * PARAMETERS:  Object              - Where to return the popped object
+ *              Walk_state          - Current Walk state
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Pop an object off the bottom of this walk's result stack.  In
+ *              other words, this is a FIFO.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_ds_result_push (
+       ACPI_OPERAND_OBJECT     *object,
+       ACPI_WALK_STATE         *walk_state)
+{
+       ACPI_GENERIC_STATE      *state;
+
+
+       state = walk_state->results;
+       if (!state) {
+               return (AE_OK);
+       }
+
+       if (state->results.num_results == OBJ_NUM_OPERANDS) {
+               return (AE_STACK_OVERFLOW);
+       }
+
+       if (!object) {
+               return (AE_BAD_PARAMETER);
+       }
+
+
+       state->results.obj_desc [state->results.num_results] = object;
+       state->results.num_results++;
+
+       return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ds_result_stack_push
+ *
+ * PARAMETERS:  Object              - Object to push
+ *              Walk_state          - Current Walk state
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION:
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_ds_result_stack_push (
+       ACPI_WALK_STATE         *walk_state)
+{
+       ACPI_GENERIC_STATE      *state;
+
+
+       state = acpi_cm_create_generic_state ();
+       if (!state) {
+               return (AE_NO_MEMORY);
+       }
+
+       acpi_cm_push_generic_state (&walk_state->results, state);
+
+       return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ds_result_stack_pop
+ *
+ * PARAMETERS:  Walk_state          - Current Walk state
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION:
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_ds_result_stack_pop (
+       ACPI_WALK_STATE         *walk_state)
+{
+       ACPI_GENERIC_STATE      *state;
+
+
+       /* Check for stack underflow */
+
+       if (walk_state->results == NULL) {
                return (AE_AML_NO_OPERAND);
        }
 
-       *object = walk_state->results [walk_state->num_results];
-       walk_state->results [walk_state->num_results] = NULL;
+
+       state = acpi_cm_pop_generic_state (&walk_state->results);
+
+       acpi_cm_delete_generic_state (state);
 
        return (AE_OK);
 }
@@ -414,7 +644,7 @@ acpi_ds_get_current_walk_state (
  *
  ******************************************************************************/
 
-void
+static void
 acpi_ds_push_walk_state (
        ACPI_WALK_STATE         *walk_state,
        ACPI_WALK_LIST          *walk_list)
@@ -528,7 +758,9 @@ acpi_ds_create_walk_state (
 
        /* Init the method args/local */
 
+#ifndef _ACPI_ASL_COMPILER
        acpi_ds_method_data_init (walk_state);
+#endif
 
        /* Put the new state at the head of the walk list */
 
@@ -565,6 +797,7 @@ acpi_ds_delete_walk_state (
                return;
        }
 
+
        /* Always must free any linked control states */
 
        while (walk_state->control_state) {
@@ -574,7 +807,6 @@ acpi_ds_delete_walk_state (
                acpi_cm_delete_generic_state (state);
        }
 
-
        /* Always must free any linked parse states */
 
        while (walk_state->scope_info) {
@@ -584,6 +816,16 @@ acpi_ds_delete_walk_state (
                acpi_cm_delete_generic_state (state);
        }
 
+       /* Always must free any stacked result states */
+
+       while (walk_state->results) {
+               state = walk_state->results;
+               walk_state->results = state->common.next;
+
+               acpi_cm_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) {
index 5015551eb59412f55c9f832cc8bc872564f40d97..7173cb817d0bdd670e212e3e01409c5d4047f09e 100644 (file)
@@ -48,7 +48,15 @@ static volatile acpi_sstate_t acpi_event_state = ACPI_S0;
 static DECLARE_WAIT_QUEUE_HEAD(acpi_event_wait);
 
 static volatile int acpi_thread_pid = -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;
@@ -98,6 +106,38 @@ acpi_do_ulong(ctl_table * ctl,
        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
  */
@@ -105,13 +145,18 @@ static u32
 acpi_event(void *context)
 {
        unsigned long flags;
-       int event = (int) context;
+       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;
+       case ACPI_EVENT_POWER_BUTTON:
+               mask = ACPI_PWRBTN;
+               break;
+       case ACPI_EVENT_SLEEP_BUTTON:
+               mask = ACPI_SLPBTN;
+               break;
+       default:
+               return AE_ERROR;
        }
 
        if (mask) {
@@ -196,19 +241,78 @@ acpi_do_sleep(ctl_table * ctl,
                }
        }
        else {
-#ifdef CONFIG_ACPI_S1_SLEEP
                int status = acpi_enter_sx(ACPI_S1);
                if (status)
                        return status;
-#endif
        }
        file->f_pos += *len;
        return 0;
 }
 
+
 /*
- * Run queued callback
+ * 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))
+                       return -EFAULT;
+       }
+
+       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)
 {
@@ -266,6 +370,20 @@ static struct ctl_table acpi_table[] =
 
        {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}
 };
 
@@ -281,50 +399,73 @@ static struct ctl_table acpi_dir_table[] =
 static int
 acpi_thread(void *context)
 {
+       ACPI_PHYSICAL_ADDRESS rsdp_phys;
+
        /*
         * initialize
         */
-
        daemonize();
-       strcpy(current->comm, "acpi");
+       strcpy(current->comm, "kacpid");
 
-       if (!ACPI_SUCCESS(acpi_initialize(NULL))) {
-               printk(KERN_ERR "ACPI: initialize failed\n");
+       if (!ACPI_SUCCESS(acpi_initialize_subsystem())) {
+               printk(KERN_ERR "ACPI: Driver initialization failed\n");
                return -ENODEV;
        }
+
+       /* arch-specific call to get rsdp ptr */
+       rsdp_phys = acpi_get_rsdp_ptr();
+       if (!rsdp_phys) {
+               printk(KERN_ERR "ACPI: System description tables not found\n");
+               return -ENODEV;
+       }
+               
+       printk(KERN_ERR "ACPI: System description tables found\n");
        
-       if (acpi_load_tables())
+       if (!ACPI_SUCCESS(acpi_find_and_load_tables(rsdp_phys)))
                return -ENODEV;
 
        if (PM_IS_ACTIVE()) {
-               printk(KERN_NOTICE "ACPI: APM is already active.\n");
+               printk(KERN_NOTICE "ACPI: APM is already active, exiting\n");
                acpi_terminate();
                return -ENODEV;
        }
 
-       pm_active = 1;
-
-       if (!ACPI_SUCCESS(acpi_enable())) {
-               printk(KERN_ERR "ACPI: enable failed\n");
+       if (!ACPI_SUCCESS(acpi_enable_subsystem(ACPI_FULL_INITIALIZATION))) {
+               printk(KERN_ERR "ACPI: Subsystem enable failed\n");
                acpi_terminate();
                return -ENODEV;
        }
 
+       printk(KERN_ERR "ACPI: Subsystem enabled\n");
+
+       pm_active = 1;
+
        acpi_cpu_init();
        acpi_sys_init();
        acpi_ec_init();
+       acpi_cmbatt_init();
 
-       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");
+       /* 
+        * 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_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");
+
+       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);
@@ -343,7 +484,9 @@ acpi_thread(void *context)
         * terminate
         */
        unregister_sysctl_table(acpi_sysctl);
-       acpi_terminate();
+
+       /* do not terminate, because we need acpi in order to shut down */
+       /*acpi_terminate();*/
 
        acpi_thread_pid = -1;
 
index a26402b4097dfe843880bdd95c607ac8644800e2..ea99f4d4814d3ec4b1813766c952410d468bc8ba 100644 (file)
@@ -35,6 +35,7 @@
  * cpu.c
  */
 int acpi_cpu_init(void);
+u32 acpi_read_pm_timer(void);
 
 extern unsigned long acpi_c2_exit_latency;
 extern unsigned long acpi_c3_exit_latency;
@@ -50,8 +51,11 @@ int acpi_run(void (*callback)(void*), void *context);
  * ec.c
  */
 int acpi_ec_init(void);
-int acpi_ec_read(int addr, int *value);
-int acpi_ec_write(int addr, int value);
+
+/*
+ * cmbatt.c
+ */
+int acpi_cmbatt_init(void);
 
 /*
  * sys.c
@@ -62,54 +66,10 @@ int acpi_enter_sx(acpi_sstate_t state);
 extern volatile acpi_sstate_t acpi_sleep_state;
 
 /*
- * tables.c
- */
-extern struct acpi_facp acpi_facp;
-
-int acpi_load_tables(void);
-
-/*
- * access ACPI registers
+ * table.c
  */
+extern FADT_DESCRIPTOR acpi_fadt;
 
-extern inline u32
-acpi_read_pm1_control(struct acpi_facp *facp)
-{
-       u32 value = 0;
-       if (facp->pm1a_cnt)
-               value = inw(facp->pm1a_cnt);
-       if (facp->pm1b_cnt)
-               value |= inw(facp->pm1b_cnt);
-       return value;
-}
-
-extern inline void 
-acpi_write_pm1_control(struct acpi_facp *facp, u32 value)
-{
-       if (facp->pm1a_cnt)
-               outw(value, facp->pm1a_cnt);
-       if (facp->pm1b_cnt)
-               outw(value, facp->pm1b_cnt);
-}
-
-extern inline u32 
-acpi_read_pm1_status(struct acpi_facp *facp)
-{
-       u32 value = 0;
-       if (facp->pm1a_evt)
-               value = inw(facp->pm1a_evt);
-       if (facp->pm1b_evt)
-               value |= inw(facp->pm1b_evt);
-       return value;
-}
-
-extern inline void 
-acpi_write_pm1_status(struct acpi_facp *facp, u32 value)
-{
-       if (facp->pm1a_evt)
-               outw(value, facp->pm1a_evt);
-       if (facp->pm1b_evt)
-               outw(value, facp->pm1b_evt);
-}
+int acpi_find_and_load_tables(u64 rsdp);
 
 #endif /* __DRIVER_H */
index 16067d1e7783d0ebc481bf767171d40569b703c5..8bf7c0c687fb4104d8db4780f450927a4ef39e60 100644 (file)
@@ -1,21 +1,21 @@
 /*
- *     ec.c - Embedded controller support
+ *  ec.c - Embedded controller support
  *
- *     Copyright (C) 2000 Andrew Henroid
+ *  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 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.
+ *  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
+ *  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>
@@ -31,7 +31,7 @@
 #define _COMPONENT     OS_DEPENDENT
        MODULE_NAME     ("ec")
 
-#define ACPI_EC_HID    "PNP0A09"
+#define ACPI_EC_HID    "PNP0C09"
 
 enum
 {
@@ -52,9 +52,15 @@ enum
        ACPI_EC_QUERY = 0x84,
 };
 
+struct ec_context
+{
+       u32                     gpe_bit;
+       ACPI_IO_ADDRESS         status_port;
+       ACPI_IO_ADDRESS         data_port;
+       u32                     need_global_lock;
+};
+
 
-static int acpi_ec_data = 0;
-static int acpi_ec_status = 0;
 static DECLARE_WAIT_QUEUE_HEAD(acpi_ec_wait);
 
 /*
@@ -64,6 +70,7 @@ static void
 acpi_ec_gpe(void *context)
 {
        printk(KERN_INFO "ACPI: EC GPE\n");
+       /* TODO fix this to use per-device sem */
        if (waitqueue_active(&acpi_ec_wait))
                wake_up_interruptible(&acpi_ec_wait);
 }
@@ -72,28 +79,36 @@ acpi_ec_gpe(void *context)
  * wait for read/write status to clear
  */
 static void
-acpi_ec_wait_control(void)
+acpi_ec_wait_control(struct ec_context *ec_cxt)
 {
-               udelay(1);
-               while(inb(acpi_ec_status) & ACPI_EC_IBF)
-                               udelay(10);
+       udelay(1);
+       while(inb(ec_cxt->status_port) & ACPI_EC_IBF)
+               udelay(10);
 }
 
 /*
  * read a byte from the EC
  */
 int
-acpi_ec_read(int addr, int *value)
+acpi_ec_read(struct ec_context *ec_cxt,
+               int addr,
+               int *value)
 {
-       if (!acpi_ec_data || !acpi_ec_status)
+       if (!ec_cxt->data_port || !ec_cxt->status_port)
                return -1;
 
-               outb(ACPI_EC_READ, acpi_ec_status);
-               acpi_ec_wait_control();
-               outb(addr, acpi_ec_data);
-               acpi_ec_wait_control();
-               interruptible_sleep_on(&acpi_ec_wait);
-               *value = inb(acpi_ec_data);
+       if (ec_cxt->need_global_lock)
+               acpi_acquire_global_lock();
+
+       outb(ACPI_EC_READ, ec_cxt->status_port);
+       acpi_ec_wait_control(ec_cxt);
+       outb(addr, ec_cxt->data_port);
+       acpi_ec_wait_control(ec_cxt);
+       /*interruptible_sleep_on(&acpi_ec_wait);*/
+       *value = inb(ec_cxt->data_port);
+
+       if (ec_cxt->need_global_lock)
+               acpi_release_global_lock();
 
        return 0;
 }
@@ -102,38 +117,95 @@ acpi_ec_read(int addr, int *value)
  * write a byte to the EC
  */
 int
-acpi_ec_write(int addr, int value)
+acpi_ec_write(struct ec_context *ec_cxt,
+               int addr,
+               int value)
 {
-       if (!acpi_ec_data || !acpi_ec_status)
+       if (!ec_cxt->data_port || !ec_cxt->status_port)
                return -1;
 
-               outb(ACPI_EC_WRITE, acpi_ec_status);
-               acpi_ec_wait_control();
-               outb(addr, acpi_ec_data);
-               acpi_ec_wait_control();
-               outb(value, acpi_ec_data);
-               acpi_ec_wait_control();
-               interruptible_sleep_on(&acpi_ec_wait);
+       if (ec_cxt->need_global_lock)
+               acpi_acquire_global_lock();
+
+       outb(ACPI_EC_WRITE, ec_cxt->status_port);
+       acpi_ec_wait_control(ec_cxt);
+       outb(addr, ec_cxt->data_port);
+       acpi_ec_wait_control(ec_cxt);
+       outb(value, ec_cxt->data_port);
+       acpi_ec_wait_control(ec_cxt);
+       /*interruptible_sleep_on(&acpi_ec_wait);*/
+
+       if (ec_cxt->need_global_lock)
+               acpi_release_global_lock();
 
        return 0;
 }
 
+static ACPI_STATUS
+acpi_ec_region_setup (
+    ACPI_HANDLE handle,
+    u32 function,
+    void *handler_context,
+    void **region_context)
+{
+       FUNCTION_TRACE("acpi_ec_region_setup");
+
+       printk("acpi_ec_region_setup\n");
+
+       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);
+}
+
+static ACPI_STATUS
+acpi_ec_region_handler (u32 function,
+                       ACPI_PHYSICAL_ADDRESS address,
+                       u32 bitwidth,
+                       u32 *value,
+                       void *handler_context,
+                       void *region_context)
+{
+       struct ec_context       *ec_cxt;
+
+       FUNCTION_TRACE("acpi_ec_region_handler");
+
+       ec_cxt = handler_context;
+
+       if (function == ADDRESS_SPACE_READ) {
+               *value = 0;
+               acpi_ec_read(ec_cxt, address, value);
+               /*printk("EC read %x from %x\n", *value, address);*/
+       }
+       else {
+               acpi_ec_write(ec_cxt, address, *value);
+               /*printk("EC write value %x to %x\n", *value, address);*/
+       }
+       
+       return_ACPI_STATUS (AE_OK);
+}
+
 /*
  * Get Embedded Controller information
  */
 static ACPI_STATUS
-acpi_find_ec(ACPI_HANDLE handle, u32 level, void *ctx, void **value)
+acpi_found_ec(ACPI_HANDLE handle, u32 level, void *ctx, void **value)
 {
-       ACPI_DEVICE_INFO dev_info;
+       ACPI_STATUS status;
        ACPI_OBJECT obj;
        ACPI_BUFFER buf;
        RESOURCE *res;
-       int gpe;
-
-       if (!ACPI_SUCCESS(acpi_get_object_info(handle, &dev_info))
-               || !(dev_info.valid & ACPI_VALID_HID)
-               || 0 != STRCMP(dev_info.hardware_id, ACPI_EC_HID))
-               return AE_OK;
+       struct ec_context *ec_cxt;
 
        buf.length = 0;
        buf.pointer = NULL;
@@ -142,40 +214,72 @@ acpi_find_ec(ACPI_HANDLE handle, u32 level, void *ctx, void **value)
 
        buf.pointer = kmalloc(buf.length, GFP_KERNEL);
        if (!buf.pointer)
-               return AE_OK;
+               return AE_NO_MEMORY;
 
        if (!ACPI_SUCCESS(acpi_get_current_resources(handle, &buf))) {
                kfree(buf.pointer);
                return AE_OK;
        }
 
+       ec_cxt = kmalloc(sizeof(struct ec_context), GFP_KERNEL);
+       if (!ec_cxt) {
+               kfree(buf.pointer);
+               return AE_NO_MEMORY;
+       }
+
        res = (RESOURCE*) buf.pointer;
-       acpi_ec_data = (int) res->data.io.min_base_address;
-       res = (RESOURCE*)((u8*) buf.pointer + res->length);
-       acpi_ec_status = (int) res->data.io.min_base_address;
+       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_NUMBER)
                return AE_OK;
-       gpe = (int) obj.number.value;
 
-       printk(KERN_INFO "ACPI: found EC @ (0x%02x,0x%02x,%d)\n",
-                  acpi_ec_data, acpi_ec_status, gpe);
+       ec_cxt->gpe_bit = obj.number.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_NUMBER) {
+               DEBUG_PRINT(ACPI_ERROR, ("_GLK failed\n"));
+               return AE_OK;
+       }
+
+       ec_cxt->need_global_lock = obj.number.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(
-               gpe,
+               ec_cxt->gpe_bit,
                (ACPI_EVENT_LEVEL_TRIGGERED
                 | ACPI_EVENT_EDGE_TRIGGERED),
                acpi_ec_gpe,
                NULL))) {
                
-               DEBUG_PRINT(ACPI_ERROR, ("Could not install GPE handler for EC.\n"));
+               REPORT_ERROR(("Could not install GPE handler for EC.\n"));
                return AE_OK;
        }
+
+       status = acpi_install_address_space_handler (handle, ADDRESS_SPACE_EC, 
+                   acpi_ec_region_handler, acpi_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;
 }
@@ -183,11 +287,19 @@ acpi_find_ec(ACPI_HANDLE handle, u32 level, void *ctx, void **value)
 int
 acpi_ec_init(void)
 {
-       acpi_walk_namespace(ACPI_TYPE_DEVICE,
-                               ACPI_ROOT_OBJECT,
-                               ACPI_UINT32_MAX,
-                               acpi_find_ec,
-                               NULL,
-                               NULL);
+       acpi_get_devices(ACPI_EC_HID, 
+                       acpi_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;
 }
index edd89713320bbf7177a46838fb379b30259e39fb..751ef5de8f1902c93309a10e6556b84e3b5e6d78 100644 (file)
@@ -2,26 +2,14 @@
 # Makefile for all Linux ACPI interpreter subdirectories
 #
 
-SUB_DIRS        := 
-MOD_SUB_DIRS    := $(SUB_DIRS)
-MOD_IN_SUB_DIRS :=
-ALL_SUB_DIRS    := $(SUB_DIRS)
-
 O_TARGET := ../$(shell basename `pwd`).o
-O_OBJS   :=
-M_OBJS   :=
 
-ACPI_OBJS := $(patsubst %.c,%.o,$(wildcard *.c))
+obj-$(CONFIG_ACPI) := $(patsubst %.c,%.o,$(wildcard *.c))
 
 EXTRA_CFLAGS += -I../include
 
 EXTRA_CFLAGS += $(ACPI_CFLAGS)
 
-# if the interpreter is used, it overrides arch/i386/kernel/acpi.c
-ifeq ($(CONFIG_ACPI_INTERPRETER),y)
-  O_OBJS := $(ACPI_OBJS)
-endif
-
 include $(TOPDIR)/Rules.make
 
 clean:
index b3e57cd79edabbb5d7de2e8d5385b7fb31e5febc..4ae76eb599331ff06f826d37a633e05337ba116f 100644 (file)
@@ -2,7 +2,7 @@
  *
  * Module Name: evevent - Fixed and General Purpose Acpi_event
  *                          handling and dispatch
- *              $Revision: 13 $
+ *              $Revision: 30 $
  *
  *****************************************************************************/
 
         MODULE_NAME         ("evevent")
 
 
+/**************************************************************************
+ *
+ * FUNCTION:    Acpi_ev_initialize
+ *
+ * PARAMETERS:  None
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Ensures that the system control interrupt (SCI) is properly
+ *              configured, disables SCI event sources, installs the SCI
+ *              handler
+ *
+ *************************************************************************/
+
+ACPI_STATUS
+acpi_ev_initialize (
+       void)
+{
+       ACPI_STATUS             status;
+
+
+       /* Make sure we've got ACPI tables */
+
+       if (!acpi_gbl_DSDT) {
+               return (AE_NO_ACPI_TABLES);
+       }
+
+
+       /* Make sure the BIOS supports ACPI mode */
+
+       if (SYS_MODE_LEGACY == acpi_hw_get_mode_capabilities()) {
+               return (AE_ERROR);
+       }
+
+
+       acpi_gbl_original_mode = acpi_hw_get_mode();
+
+       /*
+        * Initialize the Fixed and General Purpose Acpi_events prior. This is
+        * done prior to enabling SCIs to prevent interrupts from occuring
+        * before handers are installed.
+        */
+
+       status = acpi_ev_fixed_event_initialize ();
+       if (ACPI_FAILURE (status)) {
+               return (status);
+       }
+
+       status = acpi_ev_gpe_initialize ();
+       if (ACPI_FAILURE (status)) {
+               return (status);
+       }
+
+       /* Install the SCI handler */
+
+       status = acpi_ev_install_sci_handler ();
+       if (ACPI_FAILURE (status)) {
+               return (status);
+       }
+
+
+       /* Install handlers for control method GPE handlers (_Lxx, _Exx) */
+
+       status = acpi_ev_init_gpe_control_methods ();
+       if (ACPI_FAILURE (status)) {
+               return (status);
+       }
+
+       /* Install the handler for the Global Lock */
+
+       status = acpi_ev_init_global_lock_handler ();
+       if (ACPI_FAILURE (status)) {
+               return (status);
+       }
+
+
+       return (status);
+}
+
+
 /******************************************************************************
  *
  * FUNCTION:    Acpi_ev_fixed_event_initialize
@@ -58,16 +138,11 @@ acpi_ev_fixed_event_initialize(void)
                acpi_gbl_fixed_event_handlers[i].context = NULL;
        }
 
-       acpi_hw_register_access (ACPI_WRITE, ACPI_MTX_LOCK, ACPI_EVENT_PMTIMER +
-                        TMR_EN, 0);
-       acpi_hw_register_access (ACPI_WRITE, ACPI_MTX_LOCK, ACPI_EVENT_GLOBAL +
-                        TMR_EN, 0);
-       acpi_hw_register_access (ACPI_WRITE, ACPI_MTX_LOCK, ACPI_EVENT_POWER_BUTTON +
-                        TMR_EN, 0);
-       acpi_hw_register_access (ACPI_WRITE, ACPI_MTX_LOCK, ACPI_EVENT_SLEEP_BUTTON +
-                        TMR_EN, 0);
-       acpi_hw_register_access (ACPI_WRITE, ACPI_MTX_LOCK, ACPI_EVENT_RTC +
-                        TMR_EN, 0);
+       acpi_hw_register_bit_access (ACPI_WRITE, ACPI_MTX_LOCK, TMR_EN, 0);
+       acpi_hw_register_bit_access (ACPI_WRITE, ACPI_MTX_LOCK, GBL_EN, 0);
+       acpi_hw_register_bit_access (ACPI_WRITE, ACPI_MTX_LOCK, PWRBTN_EN, 0);
+       acpi_hw_register_bit_access (ACPI_WRITE, ACPI_MTX_LOCK, SLPBTN_EN, 0);
+       acpi_hw_register_bit_access (ACPI_WRITE, ACPI_MTX_LOCK, RTC_EN, 0);
 
        return (AE_OK);
 }
@@ -89,25 +164,17 @@ u32
 acpi_ev_fixed_event_detect(void)
 {
        u32                     int_status = INTERRUPT_NOT_HANDLED;
-       u32                     status_register = 0;
-       u32                     enable_register = 0;
+       u32                     status_register;
+       u32                     enable_register;
 
        /*
         * Read the fixed feature status and enable registers, as all the cases
         * depend on their values.
         */
 
-       status_register = (u32) acpi_os_in16 (acpi_gbl_FACP->pm1a_evt_blk);
-       if (acpi_gbl_FACP->pm1b_evt_blk) {
-               status_register |= (u32) acpi_os_in16 (acpi_gbl_FACP->pm1b_evt_blk);
-       }
+       status_register = acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK, PM1_STS);
+       enable_register = acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK, PM1_EN);
 
-       enable_register = (u32) acpi_os_in16 (acpi_gbl_FACP->pm1a_evt_blk +
-                          DIV_2 (acpi_gbl_FACP->pm1_evt_len));
-       if (acpi_gbl_FACP->pm1b_evt_blk) {
-               enable_register |= (u32) acpi_os_in16 (acpi_gbl_FACP->pm1b_evt_blk +
-                                  DIV_2 (acpi_gbl_FACP->pm1_evt_len));
-       }
 
        /* power management timer roll over */
 
@@ -162,20 +229,53 @@ u32
 acpi_ev_fixed_event_dispatch (
        u32                     event)
 {
+       u32 register_id;
+
        /* Clear the status bit */
 
-       acpi_hw_register_access (ACPI_WRITE, ACPI_MTX_DO_NOT_LOCK, TMR_STS +
-                        event, 1);
+       switch (event)
+       {
+       case ACPI_EVENT_PMTIMER:
+               register_id = TMR_STS;
+               break;
+
+       case ACPI_EVENT_GLOBAL:
+               register_id = GBL_STS;
+               break;
+
+       case ACPI_EVENT_POWER_BUTTON:
+               register_id = PWRBTN_STS;
+               break;
+
+       case ACPI_EVENT_SLEEP_BUTTON:
+               register_id = SLPBTN_STS;
+               break;
+
+       case ACPI_EVENT_RTC:
+               register_id = RTC_STS;
+               break;
+
+       default:
+               return 0;
+               break;
+       }
+
+       acpi_hw_register_bit_access (ACPI_WRITE, ACPI_MTX_DO_NOT_LOCK, register_id, 1);
 
        /*
         * Make sure we've got a handler.  If not, report an error.
         * The event is disabled to prevent further interrupts.
         */
        if (NULL == acpi_gbl_fixed_event_handlers[event].handler) {
-               acpi_hw_register_access (ACPI_WRITE, ACPI_MTX_DO_NOT_LOCK,
-                                TMR_EN + event, 0);
+               register_id = (PM1_EN | REGISTER_BIT_ID(register_id));
+
+               acpi_hw_register_bit_access (ACPI_WRITE, ACPI_MTX_DO_NOT_LOCK,
+                                register_id, 0);
+
+               REPORT_ERROR (
+                       ("Ev_gpe_dispatch: No installed handler for fixed event [%08X]\n",
+                       event));
 
-               REPORT_ERROR("No installed handler for fixed event.");
                return (INTERRUPT_NOT_HANDLED);
        }
 
@@ -210,15 +310,28 @@ acpi_ev_gpe_initialize (void)
 
 
        /*
-        * Setup various GPE counts
+        * Set up various GPE counts
+        *
+        * You may ask,why are the GPE register block lengths divided by 2?
+        * From the ACPI 2.0 Spec, section, 4.7.1.6 General-Purpose Event
+        * Registers, we have,
+        *
+        * "Each register block contains two registers of equal length
+        * GPEx_STS and GPEx_EN (where x is 0 or 1). The length of the
+        * GPE0_STS and GPE0_EN registers is equal to half the GPE0_LEN
+        * The length of the GPE1_STS and GPE1_EN registers is equal to
+        * half the GPE1_LEN. If a generic register block is not supported
+        * then its respective block pointer and block length values in the
+        * FADT table contain zeros. The GPE0_LEN and GPE1_LEN do not need
+        * to be the same size."
         */
 
-       gpe0register_count      = (u16) DIV_2 (acpi_gbl_FACP->gpe0blk_len);
-       gpe1_register_count     = (u16) DIV_2 (acpi_gbl_FACP->gpe1_blk_len);
+       gpe0register_count          = (u16) DIV_2 (acpi_gbl_FADT->gpe0blk_len);
+       gpe1_register_count         = (u16) DIV_2 (acpi_gbl_FADT->gpe1_blk_len);
        acpi_gbl_gpe_register_count = gpe0register_count + gpe1_register_count;
 
        if (!acpi_gbl_gpe_register_count) {
-               REPORT_WARNING ("No GPEs defined in the FACP");
+               REPORT_WARNING (("Zero GPEs are defined in the FADT\n"));
                return (AE_OK);
        }
 
@@ -262,10 +375,10 @@ acpi_ev_gpe_initialize (void)
 
        for (i = 0; i < gpe0register_count; i++) {
                acpi_gbl_gpe_registers[register_index].status_addr =
-                                (u16) (acpi_gbl_FACP->gpe0blk + i);
+                                (u16) (acpi_gbl_FADT->Xgpe0blk.address + i);
 
                acpi_gbl_gpe_registers[register_index].enable_addr =
-                                (u16) (acpi_gbl_FACP->gpe0blk + i + gpe0register_count);
+                                (u16) (acpi_gbl_FADT->Xgpe0blk.address + i + gpe0register_count);
 
                acpi_gbl_gpe_registers[register_index].gpe_base = (u8) MUL_8 (i);
 
@@ -289,13 +402,13 @@ acpi_ev_gpe_initialize (void)
 
        for (i = 0; i < gpe1_register_count; i++) {
                acpi_gbl_gpe_registers[register_index].status_addr =
-                                (u16) (acpi_gbl_FACP->gpe1_blk + i);
+                                (u16) (acpi_gbl_FADT->Xgpe1_blk.address + i);
 
                acpi_gbl_gpe_registers[register_index].enable_addr =
-                                (u16) (acpi_gbl_FACP->gpe1_blk + i + gpe1_register_count);
+                                (u16) (acpi_gbl_FADT->Xgpe1_blk.address + i + gpe1_register_count);
 
                acpi_gbl_gpe_registers[register_index].gpe_base =
-                                (u8) (acpi_gbl_FACP->gpe1_base + MUL_8 (i));
+                                (u8) (acpi_gbl_FADT->gpe1_base + MUL_8 (i));
 
                for (j = 0; j < 8; j++) {
                        gpe_number = acpi_gbl_gpe_registers[register_index].gpe_base + j;
@@ -339,7 +452,7 @@ acpi_ev_gpe_initialize (void)
  *
  ******************************************************************************/
 
-ACPI_STATUS
+static ACPI_STATUS
 acpi_ev_save_method_info (
        ACPI_HANDLE             obj_handle,
        u32                     level,
@@ -444,29 +557,6 @@ acpi_ev_init_gpe_control_methods (void)
 }
 
 
-/******************************************************************************
- *
- * FUNCTION:    Acpi_ev_gpe_cleanup
- *
- * PARAMETERS:  None
- *
- * RETURN:      None
- *
- * DESCRIPTION: Cleanup in preparation for unload.
- *
- ******************************************************************************/
-
-void
-acpi_ev_gpe_cleanup (void)
-{
-
-       acpi_cm_free (acpi_gbl_gpe_registers);
-       acpi_cm_free (acpi_gbl_gpe_info);
-
-       return;
-}
-
-
 /******************************************************************************
  *
  * FUNCTION:    Acpi_ev_gpe_detect
@@ -549,7 +639,7 @@ acpi_ev_gpe_detect (void)
  *
  ******************************************************************************/
 
-void
+static void
 acpi_ev_asynch_execute_gpe_method (
        void                    *context)
 {
@@ -557,38 +647,28 @@ acpi_ev_asynch_execute_gpe_method (
        ACPI_GPE_LEVEL_INFO     gpe_info;
 
 
-       /* Take a snapshot of the GPE info for this level */
-
+       /*
+        * Take a snapshot of the GPE info for this level
+        */
        acpi_cm_acquire_mutex (ACPI_MTX_EVENTS);
        gpe_info = acpi_gbl_gpe_info [gpe_number];
        acpi_cm_release_mutex (ACPI_MTX_EVENTS);
 
-       /*
-        * Function Handler (e.g. EC):
-        * ---------------------------
-        * Execute the installed function handler to handle this event.
-        */
-       if (gpe_info.handler) {
-               gpe_info.handler (gpe_info.context);
-       }
-
        /*
         * Method Handler (_Lxx, _Exx):
         * ----------------------------
-        * Acpi_evaluate the _Lxx/_Exx control method that corresponds to this GPE.
+        * Evaluate the _Lxx/_Exx control method that corresponds to this GPE.
         */
-       else if (gpe_info.method_handle) {
+       if (gpe_info.method_handle) {
                acpi_ns_evaluate_by_handle (gpe_info.method_handle, NULL, NULL);
        }
 
        /*
         * Level-Triggered?
         * ----------------
-        * If level-triggered, clear the GPE status bit after execution.  Note
-        * that edge-triggered events are cleared prior to calling (via DPC)
-        * this function.
+        * If level-triggered we clear the GPE status bit after handling the event.
         */
-       if (gpe_info.type | ACPI_EVENT_LEVEL_TRIGGERED) {
+       if (gpe_info.type & ACPI_EVENT_LEVEL_TRIGGERED) {
                acpi_hw_clear_gpe (gpe_number);
        }
 
@@ -624,11 +704,13 @@ u32
 acpi_ev_gpe_dispatch (
        u32                     gpe_number)
 {
+               ACPI_GPE_LEVEL_INFO     gpe_info;
 
        /*DEBUG_INCREMENT_EVENT_COUNT (EVENT_GENERAL);*/
 
-       /* Ensure that we have a valid GPE number */
-
+       /*
+        * Valid GPE number?
+        */
        if (acpi_gbl_gpe_valid[gpe_number] == ACPI_GPE_INVALID) {
                return (INTERRUPT_NOT_HANDLED);
        }
@@ -638,48 +720,59 @@ acpi_ev_gpe_dispatch (
         */
        acpi_hw_disable_gpe (gpe_number);
 
-       /*
-        * Edge-Triggered?
-        * ---------------
-        * If edge-triggered, clear the GPE status bit now.  Note that
-        * level-triggered events are cleared after the GPE is serviced
-        * (see Acpi_ev_asynch_execute_gpe_method).
-        */
-       if (acpi_gbl_gpe_info [gpe_number].type | ACPI_EVENT_EDGE_TRIGGERED) {
-               acpi_hw_clear_gpe (gpe_number);
-       }
+               gpe_info = acpi_gbl_gpe_info [gpe_number];
 
-       /*
-        * Queue-up the Handler:
-        * ---------------------
-        * Queue the handler, which is either an installable function handler
-        * (e.g. EC) or a control method (e.g. _Lxx/_Exx) for later execution.
-        */
-       if (acpi_gbl_gpe_info [gpe_number].handler ||
-               acpi_gbl_gpe_info [gpe_number].method_handle)
-       {
-               if (ACPI_FAILURE (acpi_os_queue_for_execution (OSD_PRIORITY_GPE,
-                                acpi_ev_asynch_execute_gpe_method,
-                                (void*)(NATIVE_UINT)gpe_number)))
-               {
-                       /*
-                        * Shoudn't occur, but if it does report an error. Note that
-                        * the GPE will remain disabled until the ACPI Core Subsystem
-                        * is restarted, or the handler is removed/reinstalled.
-                        */
-                       REPORT_ERROR ("Unable to queue-up handler for GPE.");
+               /*
+                * Edge-Triggered?
+                * ---------------
+                * If edge-triggered, clear the GPE status bit now.  Note that
+                * level-triggered events are cleared after the GPE is serviced.
+                */
+               if (gpe_info.type & ACPI_EVENT_EDGE_TRIGGERED) {
+                               acpi_hw_clear_gpe (gpe_number);
                }
-       }
 
-       /*
-        * Non Handled GPEs:
-        * -----------------
-        * GPEs without handlers are disabled and kept that way until a handler
-        * is registered for them.
-        */
-       else {
-               REPORT_ERROR ("No installed handler for GPE.");
-       }
+               /*
+                * Function Handler (e.g. EC)?
+                */
+               if (gpe_info.handler) {
+                               /* Invoke function handler (at interrupt level). */
+                               gpe_info.handler (gpe_info.context);
+
+                               /* Level-Triggered? */
+                               if (gpe_info.type & ACPI_EVENT_LEVEL_TRIGGERED) {
+                                               acpi_hw_clear_gpe (gpe_number);
+                               }
+
+                               /* Enable GPE */
+                               acpi_hw_enable_gpe (gpe_number);
+               }
+               /*
+                * Method Handler (e.g. _Exx/_Lxx)?
+                */
+               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)))
+                               {
+                                               /*
+                                                * Shoudn't occur, but if it does report an error. Note that
+                                                * the GPE will remain disabled until the ACPI Core Subsystem
+                                                * is restarted, or the handler is removed/reinstalled.
+                                                */
+                                               REPORT_ERROR (("Acpi_ev_gpe_dispatch: Unable to queue handler for GPE bit [%X]\n", gpe_number));
+                               }
+               }
+               /*
+                * No Handler? Report an error and leave the GPE disabled.
+                */
+               else {
+                               REPORT_ERROR (("Acpi_ev_gpe_dispatch: No installed handler for GPE [%X]\n", gpe_number));
+
+                               /* Level-Triggered? */
+                               if (gpe_info.type & ACPI_EVENT_LEVEL_TRIGGERED) {
+                                               acpi_hw_clear_gpe (gpe_number);
+                               }
+               }
 
        return (INTERRUPT_HANDLED);
 }
index 5ca325c46b346aa085a6d24ced233db3902fd682..a52f2dc3ddad461b3a6b4508fac40d025b9696c9 100644 (file)
@@ -2,7 +2,7 @@
  *
  * Module Name: evmisc - ACPI device notification handler dispatch
  *                       and ACPI Global Lock support
- *              $Revision: 13 $
+ *              $Revision: 20 $
  *
  *****************************************************************************/
 
@@ -157,7 +157,7 @@ acpi_ev_notify_dispatch (
  *
  **************************************************************************/
 
-void
+static void
 acpi_ev_global_lock_thread (
        void                    *context)
 {
@@ -185,7 +185,7 @@ acpi_ev_global_lock_thread (
  *
  **************************************************************************/
 
-u32
+static u32
 acpi_ev_global_lock_handler (
        void                    *context)
 {
@@ -199,7 +199,7 @@ acpi_ev_global_lock_handler (
         * take another interrupt when it becomes free.
         */
 
-       global_lock = &acpi_gbl_FACS->global_lock;
+       global_lock = acpi_gbl_FACS->global_lock;
        ACPI_ACQUIRE_GLOBAL_LOCK (global_lock, acquired);
        if (acquired) {
                /* Got the lock, now wake all threads waiting for it */
@@ -275,9 +275,9 @@ acpi_ev_acquire_global_lock(void)
        }
 
 
-       /* We must acquire the actualy hardware lock */
+       /* We must acquire the actual hardware lock */
 
-       global_lock = &acpi_gbl_FACS->global_lock;
+       global_lock = acpi_gbl_FACS->global_lock;
        ACPI_ACQUIRE_GLOBAL_LOCK (global_lock, acquired);
        if (acquired) {
           /* We got the lock */
@@ -298,11 +298,8 @@ acpi_ev_acquire_global_lock(void)
          * Since this wait will block, we must release the interpreter
          */
 
-       acpi_aml_exit_interpreter ();
        status = acpi_aml_system_wait_semaphore (acpi_gbl_global_lock_semaphore,
                          ACPI_UINT32_MAX);
-       acpi_aml_enter_interpreter ();
-
 
        return (status);
 }
@@ -323,7 +320,8 @@ acpi_ev_release_global_lock (void)
        void                    *global_lock;
 
 
-       if (!acpi_gbl_FACS) {
+       if (!acpi_gbl_global_lock_thread_count) {
+               REPORT_WARNING(("Releasing a non-acquired Global Lock\n"));
                return;
        }
 
@@ -331,7 +329,6 @@ acpi_ev_release_global_lock (void)
 
        acpi_gbl_global_lock_thread_count--;
 
-
        /* Have all threads released the lock? */
 
        if (!acpi_gbl_global_lock_thread_count) {
@@ -340,7 +337,7 @@ acpi_ev_release_global_lock (void)
                 * release
                 */
 
-               global_lock = &acpi_gbl_FACS->global_lock;
+               global_lock = acpi_gbl_FACS->global_lock;
                ACPI_RELEASE_GLOBAL_LOCK (global_lock, pending);
                acpi_gbl_global_lock_acquired = FALSE;
 
@@ -349,8 +346,8 @@ acpi_ev_release_global_lock (void)
                 * register
                 */
                if (pending) {
-                       acpi_hw_register_access (ACPI_WRITE, ACPI_MTX_LOCK,
-                                        PM1_CONTROL | GBL_RLS, 1);
+                       acpi_hw_register_bit_access (ACPI_WRITE, ACPI_MTX_LOCK,
+                                        GBL_RLS, 1);
                }
        }
 
index d544b1bbc686b2766558448cbbedfa98668e299c..a1781d7c3aa231bee64495a7a4b97f281417ab83 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
- * Module Name: evregion - ACPI Address_space / Op_region handler dispatch
- *              $Revision: 76 $
+ * Module Name: evregion - ACPI Address_space (Op_region) handler dispatch
+ *              $Revision: 90 $
  *
  *****************************************************************************/
 
         MODULE_NAME         ("evregion")
 
 
-#define PCI_ROOT_HID_STRING        "PNP0A03"
-#define PCI_ROOT_HID_VALUE         0x030AD041       /* EISAID("PNP0A03") */
-
-
-/******************************************************************************
- *
- * FUNCTION:    Acpi_ev_find_one_pci_root_bus
- *
- * PARAMETERS:
- *
- * RETURN:      None
- *
- * DESCRIPTION:
- *
- *****************************************************************************/
-
-ACPI_STATUS
-acpi_ev_find_one_pci_root_bus (
-       ACPI_HANDLE             obj_handle,
-       u32                     nesting_level,
-       void                    *context,
-       void                    **return_value)
-{
-       ACPI_NAMESPACE_NODE     *node;
-       ACPI_OPERAND_OBJECT     *obj_desc;
-       ACPI_STATUS             status;
-
-
-       node = (ACPI_NAMESPACE_NODE *) obj_handle;
-       obj_desc = ((ACPI_NAMESPACE_NODE *) obj_handle)->object;
-
-
-       /*
-        * We are looking for all valid _HID objects.
-        */
-
-       if (STRNCMP ((NATIVE_CHAR *) &node->name, METHOD_NAME__HID, ACPI_NAME_SIZE) ||
-               (!obj_desc))
-       {
-               return (AE_OK);
-       }
-
-
-       /*
-        * Found an _HID object.
-        * Now we need a HID with the value EISAID("PNP0A03")
-        * HID can be either a number or a string.
-        */
-
-       switch (obj_desc->common.type)
-       {
-       case ACPI_TYPE_NUMBER:
-
-               if (obj_desc->number.value != PCI_ROOT_HID_VALUE) {
-                       return (AE_OK);
-               }
-
-               break;
-
-       case ACPI_TYPE_STRING:
-
-               if (STRNCMP (obj_desc->string.pointer, PCI_ROOT_HID_STRING,
-                                 sizeof (PCI_ROOT_HID_STRING)))
-               {
-                       return (AE_OK);
-               }
-
-               break;
-
-       default:
-
-               return (AE_OK);
-       }
-
-
-       /*
-        * We found a valid PCI_ROOT_HID.
-        * The parent of the HID entry is the PCI device;  Install the default PCI
-        * handler for this PCI device.
-        */
-
-       status = acpi_install_address_space_handler (acpi_ns_get_parent_object (node),
-                          ADDRESS_SPACE_PCI_CONFIG,
-                          ACPI_DEFAULT_HANDLER, NULL, NULL);
-
-       return (AE_OK);
-}
-
-
-/******************************************************************************
- *
- * FUNCTION:    Acpi_ev_find_pci_root_buses
- *
- * PARAMETERS:
- *
- * RETURN:      None
- *
- * DESCRIPTION:
- *
- *****************************************************************************/
-
-ACPI_STATUS
-acpi_ev_find_pci_root_buses (
-       void)
-{
-
-       acpi_ns_walk_namespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
-                          FALSE, acpi_ev_find_one_pci_root_bus, NULL, NULL);
-
-       return (AE_OK);
-}
-
-/******************************************************************************
- *
- * FUNCTION:    Acpi_ev_init_one_device
- *
- * PARAMETERS:  The usual "I'm a namespace callback" stuff
- *
- * RETURN:      ACPI_STATUS
- *
- * DESCRIPTION: This is called once per device soon after ACPI is enabled
- *              to initialize each device. It determines if the device is
- *              present, and if so, calls _INI.
- *
- *****************************************************************************/
-
-ACPI_STATUS
-acpi_ev_init_one_device (
-       ACPI_HANDLE             obj_handle,
-       u32                     nesting_level,
-       void                    *context,
-       void                    **return_value)
-{
-       ACPI_STATUS             status;
-       ACPI_OPERAND_OBJECT    *ret_obj;
-
-
-       /*
-        * Run _STA to determine if we can run _INI on the device.
-        */
-       status = acpi_ns_evaluate_relative(obj_handle, "_STA", NULL, &ret_obj);
-       if (AE_NOT_FOUND == status) {
-                /* No _STA means device is present */
-       }
-       else if (ACPI_FAILURE (status)) {
-               return (status);
-       }
-       else if (ret_obj) {
-               if (ACPI_TYPE_NUMBER != ret_obj->common.type) {
-                       status = AE_AML_OPERAND_TYPE;
-                       goto cleanup;
-               }
-
-               /*
-                * if _STA "present" bit not set, we're done.
-                */
-               if (!(ret_obj->number.value & 1)) {
-                       goto cleanup;
-               }
-       }
-
-       /*
-        * The device is present. Run _INI.
-        */
-
-       status = acpi_ns_evaluate_relative(obj_handle, "_INI", NULL, NULL);
-
-cleanup:
-
-       acpi_cm_remove_reference (ret_obj);
-       return (status);
-}
-
-/******************************************************************************
- *
- * FUNCTION:    Acpi_ev_init_devices
- *
- * PARAMETERS:  None
- *
- * RETURN:      ACPI_STATUS
- *
- * DESCRIPTION: This initializes all ACPI devices.
- *
- *****************************************************************************/
-
-ACPI_STATUS
-acpi_ev_init_devices (
-       void)
-{
-       acpi_ns_walk_namespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
-                          FALSE, acpi_ev_init_one_device, NULL, NULL);
-
-       return (AE_OK);
-}
-
-
 /**************************************************************************
  *
  * FUNCTION:    Acpi_ev_install_default_address_space_handlers
@@ -250,23 +54,45 @@ acpi_ev_install_default_address_space_handlers (
 
 
        /*
-        * NOTE:    All address spaces (PCI Config, EC, SMBus) are scope dependent
-        *          and registration must occur for a specific device.  In the case
-        *          system memory and IO address spaces there is currently no device
-        *          associated with the address space.  For these we use the root.
+        * All address spaces (PCI Config, EC, SMBus) are scope dependent
+        * and registration must occur for a specific device.  In the case
+        * system memory and IO address spaces there is currently no device
+        * associated with the address space.  For these we use the root.
+        * We install the default PCI config space handler at the root so
+        * that this space is immediately available even though the we have
+        * not enumerated all the PCI Root Buses yet.  This is to conform
+        * to the ACPI specification which states that the PCI config
+        * space must be always available -- even though we are nowhere
+        * near ready to find the PCI root buses at this point.
+        *
+        * NOTE: We ignore AE_EXIST because this means that a handler has
+        * already been installed (via Acpi_install_address_space_handler)
         */
 
        status = acpi_install_address_space_handler (acpi_gbl_root_node,
                           ADDRESS_SPACE_SYSTEM_MEMORY,
                           ACPI_DEFAULT_HANDLER, NULL, NULL);
-       if (ACPI_FAILURE (status)) {
+       if ((ACPI_FAILURE (status)) &&
+               (status != AE_EXIST))
+       {
                return (status);
        }
 
        status = acpi_install_address_space_handler (acpi_gbl_root_node,
                           ADDRESS_SPACE_SYSTEM_IO,
                           ACPI_DEFAULT_HANDLER, NULL, NULL);
-       if (ACPI_FAILURE (status)) {
+       if ((ACPI_FAILURE (status)) &&
+               (status != AE_EXIST))
+       {
+               return (status);
+       }
+
+       status = acpi_install_address_space_handler (acpi_gbl_root_node,
+                          ADDRESS_SPACE_PCI_CONFIG,
+                          ACPI_DEFAULT_HANDLER, NULL, NULL);
+       if ((ACPI_FAILURE (status)) &&
+               (status != AE_EXIST))
+       {
                return (status);
        }
 
@@ -275,7 +101,7 @@ acpi_ev_install_default_address_space_handlers (
 }
 
 
-/* TBD: [Restructure] Move to the methods directory */
+/* TBD: [Restructure] Move elsewhere */
 
 /**************************************************************************
  *
@@ -290,7 +116,7 @@ acpi_ev_install_default_address_space_handlers (
  *
  *************************************************************************/
 
-ACPI_STATUS
+static ACPI_STATUS
 acpi_ev_execute_reg_method (
        ACPI_OPERAND_OBJECT    *region_obj,
        u32                     function)
@@ -301,7 +127,7 @@ acpi_ev_execute_reg_method (
        ACPI_STATUS             status;
 
 
-       if (region_obj->region.REGmethod == NULL) {
+       if (region_obj->region.extra->extra.method_REG == NULL) {
                return (AE_OK);
        }
 
@@ -337,7 +163,7 @@ acpi_ev_execute_reg_method (
        /*
         *  Execute the method, no return value
         */
-       status = acpi_ns_evaluate_by_handle (region_obj->region.REGmethod, params, NULL);
+       status = acpi_ns_evaluate_by_handle (region_obj->region.extra->extra.method_REG, params, NULL);
        return (status);
 }
 
@@ -364,7 +190,7 @@ ACPI_STATUS
 acpi_ev_address_space_dispatch (
        ACPI_OPERAND_OBJECT     *region_obj,
        u32                     function,
-       u32                     address,
+       ACPI_PHYSICAL_ADDRESS   address,
        u32                     bit_width,
        u32                     *value)
 {
@@ -381,7 +207,7 @@ acpi_ev_address_space_dispatch (
        handler_desc = region_obj->region.addr_handler;
 
        if (!handler_desc) {
-               return(AE_EXIST);
+               return(AE_NOT_EXIST);
        }
 
        /*
@@ -421,11 +247,13 @@ acpi_ev_address_space_dispatch (
                        return(status);
                }
 
+               region_obj->region.flags |= AOPOBJ_INITIALIZED;
+
                /*
                 *  Save the returned context for use in all accesses to
                 *  this particular region.
                 */
-               region_obj->region.region_context = region_context;
+               region_obj->region.extra->extra.region_context = region_context;
        }
 
        /*
@@ -447,7 +275,7 @@ acpi_ev_address_space_dispatch (
         */
        status = handler (function, address, bit_width, value,
                         handler_desc->addr_handler.context,
-                        region_obj->region.region_context);
+                        region_obj->region.extra->extra.region_context);
 
 
        if (!(handler_desc->addr_handler.flags & ADDR_HANDLER_DEFAULT_INSTALLED)) {
@@ -462,7 +290,7 @@ acpi_ev_address_space_dispatch (
 
 /******************************************************************************
  *
- * FUNCTION:    Acpi_ev_disassociate_region_and_handler
+ * FUNCTION:    Acpi_ev_disassociate_region_from_handler
  *
  * PARAMETERS:  Handler_obj     - Handler Object
  *              Region_obj      - Region Object
@@ -482,10 +310,12 @@ acpi_ev_disassociate_region_from_handler(
        ACPI_OPERAND_OBJECT     *obj_desc;
        ACPI_OPERAND_OBJECT     **last_obj_ptr;
        ADDRESS_SPACE_SETUP     region_setup;
-       void                    *region_context = region_obj->region.region_context;
+       void                    *region_context;
        ACPI_STATUS             status;
 
 
+       region_context = region_obj->region.extra->extra.region_context;
+
        /*
         *  Get the address handler from the region object
         */
@@ -534,6 +364,8 @@ acpi_ev_disassociate_region_from_handler(
                         *  Init routine may fail, Just ignore errors
                         */
 
+                       region_obj->region.flags &= ~(AOPOBJ_INITIALIZED);
+
                        /*
                         *  Remove handler reference in the region
                         *
index cb1b2de5b875cf17dbbf21d4c9dcfda97b771f3c..92e5f198fac93d609470d8639f7e133046fbe400 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
- * Module Name: evrgnini- ACPI Address_space / Op_region init
- *              $Revision: 22 $
+ * Module Name: evrgnini- ACPI Address_space (Op_region) init
+ *              $Revision: 31 $
  *
  *****************************************************************************/
 
@@ -56,12 +56,8 @@ acpi_ev_system_memory_region_setup (
        void                    *handler_context,
        void                    **region_context)
 {
-       ACPI_OPERAND_OBJECT     *region_obj = (ACPI_OPERAND_OBJECT *) handle;
-
 
        if (function == ACPI_REGION_DEACTIVATE) {
-               region_obj->region.flags &= ~(AOPOBJ_INITIALIZED);
-
                if (*region_context) {
                        acpi_cm_free (*region_context);
                        *region_context = NULL;
@@ -77,10 +73,6 @@ acpi_ev_system_memory_region_setup (
                return (AE_NO_MEMORY);
        }
 
-       /* Init.  (Mapping fields are all set to zeros above) */
-
-       region_obj->region.flags |= AOPOBJ_INITIALIZED;
-
        return (AE_OK);
 }
 
@@ -107,15 +99,11 @@ acpi_ev_io_space_region_setup (
        void                    *handler_context,
        void                    **region_context)
 {
-       ACPI_OPERAND_OBJECT     *region_obj = (ACPI_OPERAND_OBJECT *) handle;
-
        if (function == ACPI_REGION_DEACTIVATE) {
                *region_context = NULL;
-               region_obj->region.flags &= ~(AOPOBJ_INITIALIZED);
        }
        else {
                *region_context = handler_context;
-               region_obj->region.flags |= AOPOBJ_INITIALIZED;
        }
 
        return (AE_OK);
@@ -135,7 +123,7 @@ acpi_ev_io_space_region_setup (
  *
  * DESCRIPTION: Do any prep work for region handling
  *
- * MUTEX:       Assumes namespace is locked
+ * MUTEX:       Assumes namespace is not locked
  *
  ****************************************************************************/
 
@@ -147,12 +135,12 @@ acpi_ev_pci_config_region_setup (
        void                    **region_context)
 {
        ACPI_STATUS             status = AE_OK;
-       u32                     temp;
+       ACPI_INTEGER            temp;
        PCI_HANDLER_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;
 
        handler_obj = region_obj->region.addr_handler;
 
@@ -161,12 +149,10 @@ acpi_ev_pci_config_region_setup (
                 *  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_EXIST);
+               return(AE_NOT_EXIST);
        }
 
        if (function == ACPI_REGION_DEACTIVATE) {
-               region_obj->region.flags &= ~(AOPOBJ_INITIALIZED);
-
                if (pci_context) {
                        acpi_cm_free (pci_context);
                        *region_context = NULL;
@@ -197,8 +183,6 @@ acpi_ev_pci_config_region_setup (
        node = acpi_ns_get_parent_object (region_obj->region.node);
 
 
-       acpi_cm_release_mutex (ACPI_MTX_NAMESPACE);
-
        /* Acpi_evaluate the _ADR object */
 
        status = acpi_cm_evaluate_numeric_object (METHOD_NAME__ADR, node, &temp);
@@ -210,7 +194,7 @@ acpi_ev_pci_config_region_setup (
                /*
                 *  Got it..
                 */
-               pci_context->dev_func = temp;
+               pci_context->dev_func = (u32) temp;
        }
 
        /*
@@ -221,14 +205,43 @@ acpi_ev_pci_config_region_setup (
         *  This is the device the handler has been registered to handle.
         */
 
-       node = handler_obj->addr_handler.node;
+       /*
+        *  If the Addr_handler.Node is still pointing to the root, we need
+        *  to scan upward for a PCI Root bridge and re-associate the Op_region
+        *  handlers with that device.
+        */
+       if (handler_obj->addr_handler.node == acpi_gbl_root_node) {
+               /*
+                * Node is currently the parent object
+                */
+               while (node != acpi_gbl_root_node) {
+                       status = acpi_cm_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,
+                                                          ACPI_DEFAULT_HANDLER, NULL, NULL);
+
+                                       break;
+                               }
+                       }
+
+                       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);
        if (ACPI_SUCCESS (status)) {
                /*
                 *  Got it..
                 */
-               pci_context->seg = temp;
+               pci_context->seg = (u32) temp;
        }
 
        status = acpi_cm_evaluate_numeric_object (METHOD_NAME__BBN, node, &temp);
@@ -236,15 +249,11 @@ acpi_ev_pci_config_region_setup (
                /*
                 *  Got it..
                 */
-               pci_context->bus = temp;
+               pci_context->bus = (u32) temp;
        }
 
        *region_context = pci_context;
 
-       acpi_cm_acquire_mutex (ACPI_MTX_NAMESPACE);
-
-       region_obj->region.flags |= AOPOBJ_INITIALIZED;
-
        return (AE_OK);
 }
 
@@ -271,16 +280,11 @@ acpi_ev_default_region_setup (
        void                    *handler_context,
        void                    **region_context)
 {
-       ACPI_OPERAND_OBJECT     *region_obj = (ACPI_OPERAND_OBJECT *) handle;
-
-
        if (function == ACPI_REGION_DEACTIVATE) {
                *region_context = NULL;
-               region_obj->region.flags &= ~(AOPOBJ_INITIALIZED);
        }
        else {
                *region_context = handler_context;
-               region_obj->region.flags |= AOPOBJ_INITIALIZED;
        }
 
        return (AE_OK);
@@ -315,7 +319,7 @@ acpi_ev_initialize_region (
 {
        ACPI_OPERAND_OBJECT    *handler_obj;
        ACPI_OPERAND_OBJECT    *obj_desc;
-       u32                     space_id;
+       ACPI_ADDRESS_SPACE_TYPE space_id;
        ACPI_NAMESPACE_NODE    *node;
        ACPI_STATUS             status;
        ACPI_NAMESPACE_NODE    *method_node;
@@ -332,7 +336,7 @@ acpi_ev_initialize_region (
        space_id = region_obj->region.space_id;
 
        region_obj->region.addr_handler = NULL;
-       region_obj->region.REGmethod = NULL;
+       region_obj->region.extra->extra.method_REG = NULL;
        region_obj->region.flags &= ~(AOPOBJ_INITIALIZED);
 
        /*
@@ -346,7 +350,7 @@ acpi_ev_initialize_region (
                 *  definition.  This will be executed when the handler is attached
                 *  or removed
                 */
-               region_obj->region.REGmethod = method_node;
+               region_obj->region.extra->extra.method_REG = method_node;
        }
 
        /*
index ef307998a94052414c043d09afa1689ff21eac3a..02320e93c34e75e4c3ca1612fc8c3a5d7d65b4e1 100644 (file)
@@ -2,7 +2,7 @@
  *
  * Module Name: evsci - System Control Interrupt configuration and
  *                      legacy to ACPI mode state transition functions
- *              $Revision: 59 $
+ *              $Revision: 67 $
  *
  ******************************************************************************/
 
@@ -48,7 +48,7 @@
  *
  * FUNCTION:    Acpi_ev_sci_handler
  *
- * PARAMETERS:  none
+ * PARAMETERS:  Context   - Calling Context
  *
  * RETURN:      Status code indicates whether interrupt was handled.
  *
@@ -58,7 +58,7 @@
  *
  ******************************************************************************/
 
-u32
+static u32
 acpi_ev_sci_handler (void *context)
 {
        u32                     interrupt_handled = INTERRUPT_NOT_HANDLED;
@@ -68,7 +68,7 @@ acpi_ev_sci_handler (void *context)
         * Make sure that ACPI is enabled by checking SCI_EN.  Note that we are
         * required to treat the SCI interrupt as sharable, level, active low.
         */
-       if (!acpi_hw_register_access (ACPI_READ, ACPI_MTX_DO_NOT_LOCK, SCI_EN)) {
+       if (!acpi_hw_register_bit_access (ACPI_READ, ACPI_MTX_DO_NOT_LOCK, SCI_EN)) {
                /* ACPI is not enabled;  this interrupt cannot be for us */
 
                return (INTERRUPT_NOT_HANDLED);
@@ -110,7 +110,7 @@ acpi_ev_install_sci_handler (void)
        u32                     except = AE_OK;
 
 
-       except = acpi_os_install_interrupt_handler ((u32) acpi_gbl_FACP->sci_int,
+       except = acpi_os_install_interrupt_handler ((u32) acpi_gbl_FADT->sci_int,
                          acpi_ev_sci_handler,
                          NULL);
 
@@ -163,7 +163,7 @@ acpi_ev_remove_sci_handler (void)
 
 #endif
 
-       acpi_os_remove_interrupt_handler ((u32) acpi_gbl_FACP->sci_int,
+       acpi_os_remove_interrupt_handler ((u32) acpi_gbl_FADT->sci_int,
                           acpi_ev_sci_handler);
 
        return (AE_OK);
@@ -208,20 +208,11 @@ acpi_ev_restore_acpi_state (void)
        if (acpi_gbl_restore_acpi_chipset == TRUE) {
                /* Restore the fixed events */
 
-               if (acpi_os_in16 (acpi_gbl_FACP->pm1a_evt_blk + 2) !=
-                       acpi_gbl_pm1_enable_register_save)
-               {
-                       acpi_os_out16 ((acpi_gbl_FACP->pm1a_evt_blk + 2),
-                                          acpi_gbl_pm1_enable_register_save);
-               }
-
-               if (acpi_gbl_FACP->pm1b_evt_blk) {
-                       if (acpi_os_in16 (acpi_gbl_FACP->pm1b_evt_blk + 2) !=
+               if (acpi_hw_register_read (ACPI_MTX_LOCK, PM1_EN) !=
                                acpi_gbl_pm1_enable_register_save)
-                       {
-                               acpi_os_out16 ((acpi_gbl_FACP->pm1b_evt_blk + 2),
-                                                  acpi_gbl_pm1_enable_register_save);
-                       }
+               {
+                       acpi_hw_register_write (ACPI_MTX_LOCK, PM1_EN,
+                               acpi_gbl_pm1_enable_register_save);
                }
 
 
@@ -232,26 +223,24 @@ acpi_ev_restore_acpi_state (void)
 
                /* Now restore the GPEs */
 
-               for (index = 0; index < DIV_2 (acpi_gbl_FACP->gpe0blk_len); index++) {
-                       if (acpi_os_in8 (acpi_gbl_FACP->gpe0blk +
-                               DIV_2 (acpi_gbl_FACP->gpe0blk_len)) !=
-                               acpi_gbl_gpe0enable_register_save[index])
+               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_os_out8 ((acpi_gbl_FACP->gpe0blk +
-                                                 DIV_2 (acpi_gbl_FACP->gpe0blk_len)),
-                                                 acpi_gbl_gpe0enable_register_save[index]);
+                               acpi_hw_register_write (ACPI_MTX_LOCK, GPE0_EN_BLOCK | index,
+                                       acpi_gbl_gpe0enable_register_save[index]);
                        }
                }
 
-               if (acpi_gbl_FACP->gpe1_blk && acpi_gbl_FACP->gpe1_blk_len) {
-                       for (index = 0; index < DIV_2 (acpi_gbl_FACP->gpe1_blk_len); index++) {
-                               if (acpi_os_in8 (acpi_gbl_FACP->gpe1_blk +
-                                       DIV_2 (acpi_gbl_FACP->gpe1_blk_len)) !=
+               /* GPE 1 present? */
+
+               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_os_out8 ((acpi_gbl_FACP->gpe1_blk +
-                                                         DIV_2 (acpi_gbl_FACP->gpe1_blk_len)),
-                                                         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]);
                                }
                        }
                }
index 761b661517802e4ccc801b08a30f5e0672b8e5d0..c3bbad0ffbc23d48c054ebb36e49e87f4b26f503 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: evxface - External interfaces for ACPI events
- *              $Revision: 88 $
+ *              $Revision: 97 $
  *
  *****************************************************************************/
 
@@ -81,9 +81,9 @@ acpi_install_fixed_event_handler (
        acpi_gbl_fixed_event_handlers[event].handler = handler;
        acpi_gbl_fixed_event_handlers[event].context = context;
 
-       if (1 != acpi_hw_register_access (ACPI_WRITE,
-                         ACPI_MTX_LOCK, event + TMR_EN, 1))
-       {
+       status = acpi_enable_event(event, ACPI_EVENT_FIXED);
+
+       if (!ACPI_SUCCESS(status)) {
                /* Remove the handler */
 
                acpi_gbl_fixed_event_handlers[event].handler = NULL;
@@ -131,11 +131,12 @@ acpi_remove_fixed_event_handler (
 
        /* Disable the event before removing the handler - just in case... */
 
-       if (0 != acpi_hw_register_access (ACPI_WRITE,
-                         ACPI_MTX_LOCK, event + TMR_EN, 0))
-       {
+       status = acpi_disable_event(event, ACPI_EVENT_FIXED);
+
+       if (!ACPI_SUCCESS(status)) {
                status = AE_ERROR;
-               goto cleanup;
+               acpi_cm_release_mutex (ACPI_MTX_EVENTS);
+               return (status);
        }
 
        /* Remove the handler */
@@ -143,7 +144,6 @@ acpi_remove_fixed_event_handler (
        acpi_gbl_fixed_event_handlers[event].handler = NULL;
        acpi_gbl_fixed_event_handlers[event].context = NULL;
 
-cleanup:
        acpi_cm_release_mutex (ACPI_MTX_EVENTS);
        return (status);
 }
@@ -426,14 +426,14 @@ unlock_and_exit:
  *
  * PARAMETERS:  Gpe_number      - The GPE number.  The numbering scheme is
  *                                bank 0 first, then bank 1.
- *              Trigger         - Whether this GPE should be treated as an
+ *              Type            - Whether this GPE should be treated as an
  *                                edge- or level-triggered interrupt.
  *              Handler         - Address of the handler
  *              Context         - Value passed to the handler on each GPE
  *
  * RETURN:      Status
  *
- * DESCRIPTION: Install a handler for a General Purpose Acpi_event.
+ * DESCRIPTION: Install a handler for a General Purpose Event.
  *
  ******************************************************************************/
 
@@ -554,11 +554,9 @@ cleanup:
  * DESCRIPTION: Acquire the ACPI Global Lock
  *
  ******************************************************************************/
-
 ACPI_STATUS
 acpi_acquire_global_lock (
-       u32                     timeout,
-       u32                     *out_handle)
+       void)
 {
        ACPI_STATUS             status;
 
@@ -573,7 +571,6 @@ acpi_acquire_global_lock (
        status = acpi_ev_acquire_global_lock ();
        acpi_aml_exit_interpreter ();
 
-       *out_handle = 0;
        return (status);
 }
 
@@ -592,12 +589,8 @@ acpi_acquire_global_lock (
 
 ACPI_STATUS
 acpi_release_global_lock (
-       u32                     handle)
+       void)
 {
-
-
-       /* TBD: [Restructure] Validate handle */
-
        acpi_ev_release_global_lock ();
        return (AE_OK);
 }
index aee0ba1ba5f4f8d70836970b5a11d12ce413c8b3..5b7652e52bd7e194383674432757dcd8ae3b1f66 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: evxfevnt - External Interfaces, ACPI event disable/enable
- *              $Revision: 19 $
+ *              $Revision: 26 $
  *
  *****************************************************************************/
 
         MODULE_NAME         ("evxfevnt")
 
 
-ACPI_STATUS
-acpi_ev_find_pci_root_buses (
-       void);
-
-ACPI_STATUS
-acpi_ev_init_devices (
-       void);
-
 /**************************************************************************
  *
  * FUNCTION:    Acpi_enable
@@ -51,9 +43,7 @@ acpi_ev_init_devices (
  *
  * RETURN:      Status
  *
- * DESCRIPTION: Ensures that the system control interrupt (SCI) is properly
- *              configured, disables SCI event sources, installs the SCI
- *              handler, and transfers the system into ACPI mode.
+ * DESCRIPTION: Transfers the system into ACPI mode.
  *
  *************************************************************************/
 
@@ -69,52 +59,12 @@ acpi_enable (void)
                return (AE_NO_ACPI_TABLES);
        }
 
-       /* Init the hardware */
-
-       /*
-        * With the advent of a 3-pass parser, we need to be
-        *  prepared to execute on initialized HW before the
-        *  namespace has completed its load.
-        */
-
-       status = acpi_cm_hardware_initialize ();
-       if (ACPI_FAILURE (status)) {
-               return (status);
-       }
-
-
        /* Make sure the BIOS supports ACPI mode */
 
        if (SYS_MODE_LEGACY == acpi_hw_get_mode_capabilities()) {
                return (AE_ERROR);
        }
 
-
-       acpi_gbl_original_mode = acpi_hw_get_mode();
-
-       /*
-        * Initialize the Fixed and General Purpose Acpi_events prior. This is
-        * done prior to enabling SCIs to prevent interrupts from occuring
-        * before handers are installed.
-        */
-
-       status = acpi_ev_fixed_event_initialize ();
-       if (ACPI_FAILURE (status)) {
-               return (status);
-       }
-
-       status = acpi_ev_gpe_initialize ();
-       if (ACPI_FAILURE (status)) {
-               return (status);
-       }
-
-       /* Install the SCI handler */
-
-       status = acpi_ev_install_sci_handler ();
-       if (ACPI_FAILURE (status)) {
-               return (status);
-       }
-
        /* Transition to ACPI mode */
 
        status = acpi_hw_set_mode (SYS_MODE_ACPI);
@@ -122,32 +72,6 @@ acpi_enable (void)
                return (status);
        }
 
-       /* Install handlers for control method GPE handlers (_Lxx, _Exx) */
-
-       acpi_ev_init_gpe_control_methods ();
-
-       status = acpi_ev_init_global_lock_handler ();
-
-       /*
-        * Perform additional initialization that may cause control methods
-        * to be executed
-        *
-        * It may be wise to move this code to a new interface
-        */
-
-
-       /*
-        *  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")
-        */
-
-       acpi_ev_find_pci_root_buses ();
-
-       /* Call _INI on all devices */
-
-       acpi_ev_init_devices ();
-
        return (status);
 }
 
@@ -250,7 +174,12 @@ acpi_enable_event (
                 * enable register bit)
                 */
 
-               acpi_hw_register_access (ACPI_WRITE, TRUE, register_id, 1);
+               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);
+               }
+
                break;
 
 
@@ -344,7 +273,12 @@ acpi_disable_event (
                 * enable register bit)
                 */
 
-               acpi_hw_register_access (ACPI_WRITE, TRUE, register_id, 0);
+               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);
+               }
+
                break;
 
 
@@ -435,7 +369,7 @@ acpi_clear_event (
                 * status register bit)
                 */
 
-               acpi_hw_register_access (ACPI_WRITE, TRUE, register_id, 1);
+               acpi_hw_register_bit_access (ACPI_WRITE, ACPI_MTX_LOCK, register_id, 1);
                break;
 
 
@@ -532,7 +466,7 @@ acpi_get_event_status (
 
                /* Get the status of the requested fixed event */
 
-               *event_status = acpi_hw_register_access (ACPI_READ, TRUE, register_id);
+               *event_status = acpi_hw_register_bit_access (ACPI_READ, ACPI_MTX_LOCK, register_id);
                break;
 
 
index 61a04be9e8a2761fced0af328c46e7a5c127543d..ade6f08b950ba36906ddee09d85490c0dbe666d0 100644 (file)
@@ -2,7 +2,7 @@
  *
  * Module Name: evxfregn - External Interfaces, ACPI Operation Regions and
  *                         Address Spaces.
- *              $Revision: 20 $
+ *              $Revision: 24 $
  *
  *****************************************************************************/
 
  * PARAMETERS:  Device          - Handle for the device
  *              Space_id        - The address space ID
  *              Handler         - Address of the handler
+ *              Setup           - Address of the setup function
  *              Context         - Value passed to the handler on each access
  *
  * RETURN:      Status
  *
- * DESCRIPTION: Install a handler for accesses on an address space controlled
- *              a specific device.
+ * DESCRIPTION: Install a handler for all Op_regions of a given Space_id.
  *
  ******************************************************************************/
 
@@ -190,7 +190,7 @@ acpi_install_address_space_handler (
 
                /* Attach the new object to the Node */
 
-               status = acpi_ns_attach_object (device, obj_desc, (u8) type);
+               status = acpi_ns_attach_object (node, obj_desc, (u8) type);
                if (ACPI_FAILURE (status)) {
                        acpi_cm_remove_reference (obj_desc);
                        goto unlock_and_exit;
index edd89713320bbf7177a46838fb379b30259e39fb..751ef5de8f1902c93309a10e6556b84e3b5e6d78 100644 (file)
@@ -2,26 +2,14 @@
 # Makefile for all Linux ACPI interpreter subdirectories
 #
 
-SUB_DIRS        := 
-MOD_SUB_DIRS    := $(SUB_DIRS)
-MOD_IN_SUB_DIRS :=
-ALL_SUB_DIRS    := $(SUB_DIRS)
-
 O_TARGET := ../$(shell basename `pwd`).o
-O_OBJS   :=
-M_OBJS   :=
 
-ACPI_OBJS := $(patsubst %.c,%.o,$(wildcard *.c))
+obj-$(CONFIG_ACPI) := $(patsubst %.c,%.o,$(wildcard *.c))
 
 EXTRA_CFLAGS += -I../include
 
 EXTRA_CFLAGS += $(ACPI_CFLAGS)
 
-# if the interpreter is used, it overrides arch/i386/kernel/acpi.c
-ifeq ($(CONFIG_ACPI_INTERPRETER),y)
-  O_OBJS := $(ACPI_OBJS)
-endif
-
 include $(TOPDIR)/Rules.make
 
 clean:
index 5ccfc1924f2dd00d0f9ddcb93b9db6413107371f..da6f8c1ac97e36e7c4e1572644a0efbd8b565a70 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: hwacpi - ACPI hardware functions - mode and timer
- *              $Revision: 22 $
+ *              $Revision: 32 $
  *
  *****************************************************************************/
 
         MODULE_NAME         ("hwacpi")
 
 
+/******************************************************************************
+ *
+ * FUNCTION:    Acpi_hw_initialize
+ *
+ * PARAMETERS:  None
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Initialize and validate various ACPI registers
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_hw_initialize (
+       void)
+{
+       ACPI_STATUS             status = AE_OK;
+       u32                     index;
+
+
+       /* We must have the ACPI tables by the time we get here */
+
+       if (!acpi_gbl_FADT) {
+               acpi_gbl_restore_acpi_chipset = FALSE;
+
+               return (AE_NO_ACPI_TABLES);
+       }
+
+       /* Must support *some* mode! */
+/*
+       if (!(System_flags & SYS_MODES_MASK)) {
+               Restore_acpi_chipset = FALSE;
+
+               return (AE_ERROR);
+       }
+
+*/
+
+
+       switch (acpi_gbl_system_flags & SYS_MODES_MASK)
+       {
+               /* Identify current ACPI/legacy mode   */
+
+       case (SYS_MODE_ACPI):
+
+               acpi_gbl_original_mode = SYS_MODE_ACPI;
+               break;
+
+
+       case (SYS_MODE_LEGACY):
+
+               acpi_gbl_original_mode = SYS_MODE_LEGACY;
+               break;
+
+
+       case (SYS_MODE_ACPI | SYS_MODE_LEGACY):
+
+               if (acpi_hw_get_mode () == SYS_MODE_ACPI) {
+                       acpi_gbl_original_mode = SYS_MODE_ACPI;
+               }
+               else {
+                       acpi_gbl_original_mode = SYS_MODE_LEGACY;
+               }
+
+               break;
+       }
+
+
+       if (acpi_gbl_system_flags & SYS_MODE_ACPI) {
+               /* Target system supports ACPI mode */
+
+               /*
+                * The purpose of this code is to save the initial state
+                * of the ACPI event enable registers. An exit function will be
+                * registered which will restore this state when the application
+                * exits. The exit function will also clear all of the ACPI event
+                * status bits prior to restoring the original mode.
+                *
+                * The location of the PM1a_evt_blk enable registers is defined as the
+                * base of PM1a_evt_blk + DIV_2(PM1a_evt_blk_length). Since the spec further
+                * fully defines the PM1a_evt_blk to be a total of 4 bytes, the offset
+                * for the enable registers is always 2 from the base. It is hard
+                * coded here. If this changes in the spec, this code will need to
+                * be modified. The PM1b_evt_blk behaves as expected.
+                */
+
+               acpi_gbl_pm1_enable_register_save = (u16) acpi_hw_register_read (ACPI_MTX_LOCK, PM1_EN);
+
+
+               /*
+                * The GPEs behave similarly, except that the length of the register
+                * block is not fixed, so the buffer must be allocated with malloc
+                */
+
+               if (acpi_gbl_FADT->Xgpe0blk.address && acpi_gbl_FADT->gpe0blk_len) {
+                       /* GPE0 specified in FADT  */
+
+                       acpi_gbl_gpe0enable_register_save =
+                               acpi_cm_allocate (DIV_2 (acpi_gbl_FADT->gpe0blk_len));
+                       if (!acpi_gbl_gpe0enable_register_save) {
+                               return (AE_NO_MEMORY);
+                       }
+
+                       /* Save state of GPE0 enable bits */
+
+                       for (index = 0; index < DIV_2 (acpi_gbl_FADT->gpe0blk_len); index++) {
+                               acpi_gbl_gpe0enable_register_save[index] =
+                                       (u8) acpi_hw_register_read (ACPI_MTX_LOCK, GPE0_EN_BLOCK | index);
+                       }
+               }
+
+               else {
+                       acpi_gbl_gpe0enable_register_save = NULL;
+               }
+
+               if (acpi_gbl_FADT->Xgpe1_blk.address && 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));
+                       if (!acpi_gbl_gpe1_enable_register_save) {
+                               return (AE_NO_MEMORY);
+                       }
+
+                       /* save state of GPE1 enable bits */
+
+                       for (index = 0; index < DIV_2 (acpi_gbl_FADT->gpe1_blk_len); index++) {
+                               acpi_gbl_gpe1_enable_register_save[index] =
+                                       (u8) acpi_hw_register_read (ACPI_MTX_LOCK, GPE1_EN_BLOCK | index);
+                       }
+               }
+
+               else {
+                       acpi_gbl_gpe1_enable_register_save = NULL;
+               }
+       }
+
+       return (status);
+}
+
+
 /******************************************************************************
  *
  * FUNCTION:    Acpi_hw_set_mode
@@ -56,7 +197,7 @@ acpi_hw_set_mode (
        if (mode == SYS_MODE_ACPI) {
                /* BIOS should have disabled ALL fixed and GP events */
 
-               acpi_os_out8 (acpi_gbl_FACP->smi_cmd, acpi_gbl_FACP->acpi_enable);
+               acpi_os_out8 (acpi_gbl_FADT->smi_cmd, acpi_gbl_FADT->acpi_enable);
        }
 
        else if (mode == SYS_MODE_LEGACY) {
@@ -65,7 +206,7 @@ acpi_hw_set_mode (
                 * enable bits to default
                 */
 
-               acpi_os_out8 (acpi_gbl_FACP->smi_cmd, acpi_gbl_FACP->acpi_disable);
+               acpi_os_out8 (acpi_gbl_FADT->smi_cmd, acpi_gbl_FADT->acpi_disable);
        }
 
        if (acpi_hw_get_mode () == mode) {
@@ -78,8 +219,7 @@ acpi_hw_set_mode (
 
 /******************************************************************************
  *
- * FUNCTION:    Acpi_hw
-
+ * FUNCTION:    Acpi_hw_get_mode
  *
  * PARAMETERS:  none
  *
@@ -95,7 +235,7 @@ acpi_hw_get_mode (void)
 {
 
 
-       if (acpi_hw_register_access (ACPI_READ, ACPI_MTX_LOCK, SCI_EN)) {
+       if (acpi_hw_register_bit_access (ACPI_READ, ACPI_MTX_LOCK, SCI_EN)) {
                return (SYS_MODE_ACPI);
        }
        else {
@@ -177,7 +317,7 @@ acpi_hw_pmt_ticks (void)
 {
        u32                      ticks;
 
-       ticks = acpi_os_in32 (acpi_gbl_FACP->pm_tmr_blk);
+       ticks = acpi_os_in32 ((ACPI_IO_ADDRESS) acpi_gbl_FADT->Xpm_tmr_blk.address);
 
        return (ticks);
 }
@@ -198,7 +338,7 @@ acpi_hw_pmt_ticks (void)
 u32
 acpi_hw_pmt_resolution (void)
 {
-       if (0 == acpi_gbl_FACP->tmr_val_ext) {
+       if (0 == acpi_gbl_FADT->tmr_val_ext) {
                return (24);
        }
 
index bf1027ec52213b028c479eaca7d0d5aa1e7934b1..fba28acc726340bb00321b8b7e26bf747c69be11 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Name: hwcpu32.c - CPU support for IA32 (Throttling, Cx_states)
- *              $Revision: 33 $
+ *              $Revision: 39 $
  *
  *****************************************************************************/
 
@@ -132,7 +132,7 @@ acpi_hw_enter_c2(
         * We have to do something useless after reading LVL2 because chipsets
         * cannot guarantee that STPCLK# gets asserted in time to freeze execution.
         */
-       acpi_os_in8 ((ACPI_IO_ADDRESS) acpi_gbl_FACP->pm2_cnt_blk);
+       acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK, PM2_CONTROL);
 
        /*
         * Compute Time in C2:
@@ -171,7 +171,6 @@ acpi_hw_enter_c3(
        u32                     *pm_timer_ticks)
 {
        u32                     timer = 0;
-       u8                      pm2_cnt_blk = 0;
        u32                     bus_master_status = 0;
 
 
@@ -187,12 +186,12 @@ acpi_hw_enter_c3(
         *  eventually cause a demotion to C2
         */
        if (1 == (bus_master_status =
-               acpi_hw_register_access (ACPI_READ, ACPI_MTX_LOCK, BM_STS)))
+               acpi_hw_register_bit_access (ACPI_READ, ACPI_MTX_LOCK, BM_STS)))
        {
                /*
                 * Clear the BM_STS bit by setting it.
                 */
-               acpi_hw_register_access (ACPI_WRITE, ACPI_MTX_LOCK, BM_STS, 1);
+               acpi_hw_register_bit_access (ACPI_WRITE, ACPI_MTX_LOCK, BM_STS, 1);
                *pm_timer_ticks = 0;
                return (AE_OK);
        }
@@ -207,9 +206,7 @@ acpi_hw_enter_c3(
         * ----------------------
         * Set the PM2_CNT.ARB_DIS bit (bit #0), preserving all other bits.
         */
-       pm2_cnt_blk = acpi_os_in8 ((ACPI_IO_ADDRESS) acpi_gbl_FACP->pm2_cnt_blk);
-       pm2_cnt_blk |= 0x01;
-       acpi_os_out8 ((ACPI_IO_ADDRESS) acpi_gbl_FACP->pm2_cnt_blk, pm2_cnt_blk);
+        acpi_hw_register_bit_access(ACPI_WRITE, ACPI_MTX_LOCK, ARB_DIS, 1);
 
        /*
         * Get the timer base before entering C state
@@ -229,8 +226,7 @@ acpi_hw_enter_c3(
         * We have to do something useless after reading LVL3 because chipsets
         * cannot guarantee that STPCLK# gets asserted in time to freeze execution.
         */
-       acpi_os_in8 ((ACPI_IO_ADDRESS) acpi_gbl_FACP->pm2_cnt_blk);
-
+       acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK, PM2_CONTROL);
        /*
         * Immediately compute the time in the C state
         */
@@ -241,9 +237,7 @@ acpi_hw_enter_c3(
         * ------------------------
         * Clear the PM2_CNT.ARB_DIS bit (bit #0), preserving all other bits.
         */
-       pm2_cnt_blk = acpi_os_in8 ((ACPI_IO_ADDRESS) acpi_gbl_FACP->pm2_cnt_blk);
-       pm2_cnt_blk &= 0xFE;
-       acpi_os_out8 ((ACPI_IO_ADDRESS) acpi_gbl_FACP->pm2_cnt_blk, pm2_cnt_blk);
+       acpi_hw_register_bit_access(ACPI_WRITE, ACPI_MTX_LOCK, ARB_DIS, 0);
 
        /* TBD: [Unhandled]: Support 24-bit timers (this algorithm assumes 32-bit) */
 
@@ -332,7 +326,7 @@ acpi_hw_set_cx (
        switch (cx_state)
        {
        case 3:
-               acpi_hw_register_access (ACPI_WRITE, ACPI_MTX_LOCK, BM_RLD, 1);
+               acpi_hw_register_bit_access (ACPI_WRITE, ACPI_MTX_LOCK, BM_RLD, 1);
                break;
        }
 
@@ -346,7 +340,7 @@ acpi_hw_set_cx (
        switch (acpi_hw_active_cx_state)
        {
        case 3:
-               acpi_hw_register_access (ACPI_WRITE, ACPI_MTX_LOCK, BM_RLD, 0);
+               acpi_hw_register_bit_access (ACPI_WRITE, ACPI_MTX_LOCK, BM_RLD, 0);
                break;
        }
 
@@ -408,15 +402,15 @@ acpi_hw_get_cx_info (
         * and on SMP systems when P_LVL2_UP (which indicates C2 only on UP)
         * is not set.
         */
-       if (acpi_gbl_FACP->plvl2_lat <= 100) {
+       if (acpi_gbl_FADT->plvl2_lat <= 100) {
                if (!SMP_system) {
                        acpi_hw_cx_handlers[2] = acpi_hw_enter_c2;
-                       cx_states[2] = acpi_gbl_FACP->plvl2_lat;
+                       cx_states[2] = acpi_gbl_FADT->plvl2_lat;
                }
 
-               else if (!acpi_gbl_FACP->plvl2_up) {
+               else if (!acpi_gbl_FADT->plvl2_up) {
                        acpi_hw_cx_handlers[2] = acpi_hw_enter_c2;
-                       cx_states[2] = acpi_gbl_FACP->plvl2_lat;
+                       cx_states[2] = acpi_gbl_FADT->plvl2_lat;
                }
        }
 
@@ -431,12 +425,12 @@ acpi_hw_get_cx_info (
         * cannot be used on SMP systems, and flushing caches (e.g. WBINVD)
         * is simply too costly (at this time).
         */
-       if (acpi_gbl_FACP->plvl3_lat <= 1000) {
-               if (!SMP_system && (acpi_gbl_FACP->pm2_cnt_blk &&
-                       acpi_gbl_FACP->pm2_cnt_len))
+       if (acpi_gbl_FADT->plvl3_lat <= 1000) {
+               if (!SMP_system && (acpi_gbl_FADT->Xpm2_cnt_blk.address &&
+                       acpi_gbl_FADT->pm2_cnt_len))
                {
                        acpi_hw_cx_handlers[3] = acpi_hw_enter_c3;
-                       cx_states[3] = acpi_gbl_FACP->plvl3_lat;
+                       cx_states[3] = acpi_gbl_FADT->plvl3_lat;
                }
        }
 
index e4fa7ad98e55125a63659829d0af72d2a4ef574f..2b413fac803b44022ef0d0f15df81ea576ac9381 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: hwgpe - Low level GPE enable/disable/clear functions
- *              $Revision: 22 $
+ *              $Revision: 25 $
  *
  *****************************************************************************/
 
@@ -32,9 +32,6 @@
         MODULE_NAME         ("hwgpe")
 
 
-u8 decode_to8bit [8] = {1,2,4,8,16,32,64,128};
-
-
 /******************************************************************************
  *
  * FUNCTION:    Acpi_hw_enable_gpe
@@ -63,7 +60,7 @@ acpi_hw_enable_gpe (
        /*
         * Figure out the bit offset for this GPE within the target register.
         */
-       bit_mask = decode_to8bit [MOD_8 (gpe_number)];
+       bit_mask = acpi_gbl_decode_to8bit [MOD_8 (gpe_number)];
 
        /*
         * Read the current value of the register, set the appropriate bit
@@ -103,7 +100,7 @@ acpi_hw_disable_gpe (
        /*
         * Figure out the bit offset for this GPE within the target register.
         */
-       bit_mask = decode_to8bit [MOD_8 (gpe_number)];
+       bit_mask = acpi_gbl_decode_to8bit [MOD_8 (gpe_number)];
 
        /*
         * Read the current value of the register, clear the appropriate bit,
@@ -142,7 +139,7 @@ acpi_hw_clear_gpe (
        /*
         * Figure out the bit offset for this GPE within the target register.
         */
-       bit_mask = decode_to8bit [MOD_8 (gpe_number)];
+       bit_mask = acpi_gbl_decode_to8bit [MOD_8 (gpe_number)];
 
        /*
         * Write a one to the appropriate bit in the status register to
@@ -187,7 +184,7 @@ acpi_hw_get_gpe_status (
        /*
         * Figure out the bit offset for this GPE within the target register.
         */
-       bit_mask = decode_to8bit [MOD_8 (gpe_number)];
+       bit_mask = acpi_gbl_decode_to8bit [MOD_8 (gpe_number)];
 
        /*
         * Enabled?:
index 2ab4b1d9521966b8bf4a6f86e1bb2f76029c82ea..8d8d254755b85b0c3d0f5ec093e46b422d2f6b47 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Module Name: hwregs - Read/write access functions for the various ACPI
  *                       control and status registers.
- *              $Revision: 67 $
+ *              $Revision: 84 $
  *
  ******************************************************************************/
 
@@ -36,8 +36,8 @@
 
 /* This matches the #defines in actypes.h. */
 
-NATIVE_CHAR *sleep_state_table[] = {"\\_S0_","\\_S1_","\\_S2_","\\_S3_",
-                          "\\_S4_","\\_S4_b","\\_S5_"};
+NATIVE_CHAR                 *sleep_state_table[] = {"\\_S0_","\\_S1_","\\_S2_","\\_S3_",
+                         "\\_S4_","\\_S4_b","\\_S5_"};
 
 
 /*******************************************************************************
@@ -53,7 +53,7 @@ NATIVE_CHAR *sleep_state_table[] = {"\\_S0_","\\_S1_","\\_S2_","\\_S3_",
  *
  ******************************************************************************/
 
-u32
+static u32
 acpi_hw_get_bit_shift (
        u32                     mask)
 {
@@ -87,28 +87,31 @@ acpi_hw_clear_acpi_status (void)
 
        acpi_cm_acquire_mutex (ACPI_MTX_HARDWARE);
 
-       acpi_os_out16 (acpi_gbl_FACP->pm1a_evt_blk, (u16) ALL_FIXED_STS_BITS);
+       acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, PM1_STS, ALL_FIXED_STS_BITS);
+
 
-       if (acpi_gbl_FACP->pm1b_evt_blk) {
-               acpi_os_out16 ((u16) acpi_gbl_FACP->pm1b_evt_blk,
+       if (acpi_gbl_FADT->Xpm1b_evt_blk.address) {
+               acpi_os_out16 ((ACPI_IO_ADDRESS) acpi_gbl_FADT->Xpm1b_evt_blk.address,
                                  (u16) ALL_FIXED_STS_BITS);
        }
 
        /* now clear the GPE Bits */
 
-       if (acpi_gbl_FACP->gpe0blk_len) {
-               gpe_length = (u16) DIV_2 (acpi_gbl_FACP->gpe0blk_len);
+       if (acpi_gbl_FADT->gpe0blk_len) {
+               gpe_length = (u16) DIV_2 (acpi_gbl_FADT->gpe0blk_len);
 
                for (index = 0; index < gpe_length; index++) {
-                       acpi_os_out8 ((acpi_gbl_FACP->gpe0blk + index), (u8) 0xff);
+                       acpi_os_out8 ((ACPI_IO_ADDRESS) (acpi_gbl_FADT->Xgpe0blk.address + index),
+                                         (u8) 0xff);
                }
        }
 
-       if (acpi_gbl_FACP->gpe1_blk_len) {
-               gpe_length = (u16) DIV_2 (acpi_gbl_FACP->gpe1_blk_len);
+       if (acpi_gbl_FADT->gpe1_blk_len) {
+               gpe_length = (u16) DIV_2 (acpi_gbl_FADT->gpe1_blk_len);
 
                for (index = 0; index < gpe_length; index++) {
-                       acpi_os_out8 ((acpi_gbl_FACP->gpe1_blk + index), (u8) 0xff);
+                       acpi_os_out8 ((ACPI_IO_ADDRESS) (acpi_gbl_FADT->Xgpe1_blk.address + index),
+                                         (u8) 0xff);
                }
        }
 
@@ -162,7 +165,7 @@ acpi_hw_obtain_sleep_type_register_data (
        }
 
        if (!obj_desc) {
-               REPORT_ERROR ("Missing Sleep State object");
+               REPORT_ERROR (("Missing Sleep State object\n"));
                return (AE_NOT_EXIST);
        }
 
@@ -172,17 +175,12 @@ acpi_hw_obtain_sleep_type_register_data (
         *  two elements
         */
 
-       if (obj_desc->common.type != ACPI_TYPE_PACKAGE) {
-               /* Must be a package */
-
-               REPORT_ERROR ("Sleep State object is not of type Package");
-               status = AE_ERROR;
-       }
+       status = acpi_cm_resolve_package_references(obj_desc);
 
-       else if (obj_desc->package.count < 2) {
+       if (obj_desc->package.count < 2) {
                /* Must have at least two elements */
 
-               REPORT_ERROR ("Sleep State package does not have at least two elements");
+               REPORT_ERROR (("Sleep State package does not have at least two elements\n"));
                status = AE_ERROR;
        }
 
@@ -193,7 +191,7 @@ acpi_hw_obtain_sleep_type_register_data (
        {
                /* Must have two  */
 
-               REPORT_ERROR ("Sleep State package elements are not both of type Number");
+               REPORT_ERROR (("Sleep State package elements are not both of type Number\n"));
                status = AE_ERROR;
        }
 
@@ -216,23 +214,23 @@ acpi_hw_obtain_sleep_type_register_data (
 
 /*******************************************************************************
  *
- * FUNCTION:    Acpi_hw_register_access
+ * FUNCTION:    Acpi_hw_register_bit_access
  *
  * PARAMETERS:  Read_write      - Either ACPI_READ or ACPI_WRITE.
  *              Use_lock        - Lock the hardware
- *              Register_id     - index of ACPI register to access
+ *              Register_id     - index of ACPI Register to access
  *              Value           - (only used on write) value to write to the
- *                                 register.  Shifted all the way right.
+ *                                Register.  Shifted all the way right.
  *
- * RETURN:      Value written to or read from specified register.  This value
+ * RETURN:      Value written to or read from specified Register.  This value
  *              is shifted all the way right.
  *
- * DESCRIPTION: Generic ACPI register read/write function.
+ * DESCRIPTION: Generic ACPI Register read/write function.
  *
  ******************************************************************************/
 
 u32
-acpi_hw_register_access (
+acpi_hw_register_bit_access (
        NATIVE_UINT             read_write,
        u8                      use_lock,
        u32                     register_id,
@@ -241,7 +239,6 @@ acpi_hw_register_access (
        u32                     register_value = 0;
        u32                     mask = 0;
        u32                     value = 0;
-       ACPI_IO_ADDRESS         gpe_reg = 0;
 
 
        if (read_write == ACPI_WRITE) {
@@ -252,183 +249,125 @@ acpi_hw_register_access (
                va_end (marker);
        }
 
-       /*
-        * TBD: [Restructure] May want to split the Acpi_event code and the
-        * Control code
-        */
+       if (ACPI_MTX_LOCK == use_lock) {
+               acpi_cm_acquire_mutex (ACPI_MTX_HARDWARE);
+       }
 
        /*
         * Decode the Register 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.
         */
 
-       switch (register_id & REGISTER_BLOCK_MASK)
+       switch (REGISTER_BLOCK_ID(register_id))
        {
-       case PM1_EVT:
-
-               if (register_id < TMR_EN) {
-                       /* status register */
-
-                       if (ACPI_MTX_LOCK == use_lock) {
-                               acpi_cm_acquire_mutex (ACPI_MTX_HARDWARE);
-                       }
-
+       case PM1_STS:
 
-                       register_value = (u32) acpi_os_in16 (acpi_gbl_FACP->pm1a_evt_blk);
-                       if (acpi_gbl_FACP->pm1b_evt_blk) {
-                               register_value |= (u32) acpi_os_in16 (acpi_gbl_FACP->pm1b_evt_blk);
-                       }
-
-                       switch (register_id)
-                       {
-                       case TMR_STS:
-                               mask = TMR_STS_MASK;
-                               break;
-
-                       case BM_STS:
-                               mask = BM_STS_MASK;
-                               break;
+               switch (register_id)
+               {
+               case TMR_STS:
+                       mask = TMR_STS_MASK;
+                       break;
 
-                       case GBL_STS:
-                               mask = GBL_STS_MASK;
-                               break;
+               case BM_STS:
+                       mask = BM_STS_MASK;
+                       break;
 
-                       case PWRBTN_STS:
-                               mask = PWRBTN_STS_MASK;
-                               break;
+               case GBL_STS:
+                       mask = GBL_STS_MASK;
+                       break;
 
-                       case SLPBTN_STS:
-                               mask = SLPBTN_STS_MASK;
-                               break;
+               case PWRBTN_STS:
+                       mask = PWRBTN_STS_MASK;
+                       break;
 
-                       case RTC_STS:
-                               mask = RTC_STS_MASK;
-                               break;
+               case SLPBTN_STS:
+                       mask = SLPBTN_STS_MASK;
+                       break;
 
-                       case WAK_STS:
-                               mask = WAK_STS_MASK;
-                               break;
+               case RTC_STS:
+                       mask = RTC_STS_MASK;
+                       break;
 
-                       default:
-                               mask = 0;
-                               break;
-                       }
+               case WAK_STS:
+                       mask = WAK_STS_MASK;
+                       break;
 
-                       if (read_write == ACPI_WRITE) {
-                               /*
-                                * Status registers are different from the rest.  Clear by
-                                * writing 1, writing 0 has no effect.  So, the only relevent
-                                * information is the single bit we're interested in, all
-                                * others should be written as 0 so they will be left
-                                * unchanged
-                                */
+               default:
+                       mask = 0;
+                       break;
+               }
 
-                               value <<= acpi_hw_get_bit_shift (mask);
-                               value &= mask;
+               register_value = acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK, PM1_STS);
 
-                               if (value) {
-                                       acpi_os_out16 (acpi_gbl_FACP->pm1a_evt_blk, (u16) value);
+               if (read_write == ACPI_WRITE) {
+                       /*
+                        * Status Registers are different from the rest.  Clear by
+                        * writing 1, writing 0 has no effect.  So, the only relevent
+                        * information is the single bit we're interested in, all
+                        * others should be written as 0 so they will be left
+                        * unchanged
+                        */
 
-                                       if (acpi_gbl_FACP->pm1b_evt_blk) {
-                                               acpi_os_out16 (acpi_gbl_FACP->pm1b_evt_blk, (u16) value);
-                                       }
+                       value <<= acpi_hw_get_bit_shift (mask);
+                       value &= mask;
 
-                                       register_value = 0;
-                               }
-                       }
+                       if (value) {
+                               acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, PM1_STS, (u16) value);
 
-                       if (ACPI_MTX_LOCK == use_lock) {
-                               acpi_cm_release_mutex (ACPI_MTX_HARDWARE);
+                               register_value = 0;
                        }
                }
 
-               else {
-                       /* enable register */
-
-                       if (ACPI_MTX_LOCK == use_lock) {
-                               acpi_cm_acquire_mutex (ACPI_MTX_HARDWARE);
-                       }
-
-                       register_value = (u32) acpi_os_in16 (acpi_gbl_FACP->pm1a_evt_blk +
-                                         DIV_2 (acpi_gbl_FACP->pm1_evt_len));
-
-                       if (acpi_gbl_FACP->pm1b_evt_blk) {
-                               register_value |= (u32) acpi_os_in16 (acpi_gbl_FACP->pm1b_evt_blk +
-                                                  DIV_2 (acpi_gbl_FACP->pm1_evt_len));
+               break;
 
-                       }
 
-                       switch (register_id)
-                       {
-                       case TMR_EN:
-                               mask = TMR_EN_MASK;
-                               break;
+       case PM1_EN:
 
-                       case GBL_EN:
-                               mask = GBL_EN_MASK;
-                               break;
+               switch (register_id)
+               {
+               case TMR_EN:
+                       mask = TMR_EN_MASK;
+                       break;
 
-                       case PWRBTN_EN:
-                               mask = PWRBTN_EN_MASK;
-                               break;
+               case GBL_EN:
+                       mask = GBL_EN_MASK;
+                       break;
 
-                       case SLPBTN_EN:
-                               mask = SLPBTN_EN_MASK;
-                               break;
+               case PWRBTN_EN:
+                       mask = PWRBTN_EN_MASK;
+                       break;
 
-                       case RTC_EN:
-                               mask = RTC_EN_MASK;
-                               break;
+               case SLPBTN_EN:
+                       mask = SLPBTN_EN_MASK;
+                       break;
 
-                       default:
-                               mask = 0;
-                               break;
-                       }
+               case RTC_EN:
+                       mask = RTC_EN_MASK;
+                       break;
 
-                       if (read_write == ACPI_WRITE) {
-                               register_value &= ~mask;
-                               value          <<= acpi_hw_get_bit_shift (mask);
-                               value          &= mask;
-                               register_value |= value;
-
-                               acpi_os_out16 ((acpi_gbl_FACP->pm1a_evt_blk +
-                                                DIV_2 (acpi_gbl_FACP->pm1_evt_len)),
-                                                (u16) register_value);
-
-                               if (acpi_gbl_FACP->pm1b_evt_blk) {
-                                       acpi_os_out16 ((acpi_gbl_FACP->pm1b_evt_blk +
-                                                        DIV_2 (acpi_gbl_FACP->pm1_evt_len)),
-                                                        (u16) register_value);
-                               }
-                       }
-                       if(ACPI_MTX_LOCK == use_lock) {
-                               acpi_cm_release_mutex (ACPI_MTX_HARDWARE);
-                       }
+               default:
+                       mask = 0;
+                       break;
                }
-               break;
-
 
-       case PM1_CONTROL:
+               register_value = acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK, PM1_EN);
 
-               register_value = 0;
+               if (read_write == ACPI_WRITE) {
+                       register_value &= ~mask;
+                       value          <<= acpi_hw_get_bit_shift (mask);
+                       value          &= mask;
+                       register_value |= value;
 
-               if (ACPI_MTX_LOCK == use_lock) {
-                       acpi_cm_acquire_mutex (ACPI_MTX_HARDWARE);
+                       acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, PM1_EN, (u16) register_value);
                }
 
-               if (register_id != SLP_TYPE_B) {
-                       /*
-                        * SLP_TYPx registers are written differently
-                        * than any other control registers with
-                        * respect to A and B registers.  The value
-                        * for A may be different than the value for B
-                        */
+               break;
 
-                       register_value = (u32) acpi_os_in16 (acpi_gbl_FACP->pm1a_cnt_blk);
-               }
 
-               if (acpi_gbl_FACP->pm1b_cnt_blk && register_id != (u32) SLP_TYPE_A) {
-                       register_value |= (u32) acpi_os_in16 (acpi_gbl_FACP->pm1b_cnt_blk);
-               }
+       case PM1_CONTROL:
 
                switch (register_id)
                {
@@ -458,6 +397,14 @@ acpi_hw_register_access (
                        break;
                }
 
+
+               /*
+                * Read the PM1 Control register.
+                * Note that at this level, the fact that there are actually TWO
+                * registers (A and B) and that B may not exist, are abstracted.
+                */
+               register_value = acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK, PM1_CONTROL);
+
                if (read_write == ACPI_WRITE) {
                        register_value &= ~mask;
                        value          <<= acpi_hw_get_bit_shift (mask);
@@ -465,47 +412,23 @@ acpi_hw_register_access (
                        register_value |= value;
 
                        /*
-                        * SLP_TYPE_x registers are written differently
-                        * than any other control registers with
-                        * respect to A and B registers.  The value
+                        * SLP_TYPE_x Registers are written differently
+                        * than any other control Registers with
+                        * respect to A and B Registers.  The value
                         * for A may be different than the value for B
+                        *
+                        * Therefore, pass the Register_id, not just generic PM1_CONTROL,
+                        * because we need to do different things. Yuck.
                         */
 
-                       if (register_id != SLP_TYPE_B) {
-                               if (mask == SLP_EN_MASK) {
-                                       disable();  /* disable interrupts */
-                               }
-
-                               acpi_os_out16 (acpi_gbl_FACP->pm1a_cnt_blk, (u16) register_value);
-
-                               if (mask == SLP_EN_MASK) {
-                                       /*
-                                        * Enable interrupts, the SCI handler is likely going to
-                                        * be invoked as soon as interrupts are enabled, since gpe's
-                                        * and most fixed resume events also generate SCI's.
-                                        */
-                                       enable();
-                               }
-                       }
-
-                       if (acpi_gbl_FACP->pm1b_cnt_blk && register_id != (u32) SLP_TYPE_A) {
-                               acpi_os_out16 (acpi_gbl_FACP->pm1b_cnt_blk, (u16) register_value);
-                       }
-               }
-
-               if (ACPI_MTX_LOCK == use_lock) {
-                       acpi_cm_release_mutex (ACPI_MTX_HARDWARE);
+                       acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK,
+                               register_id, (u16) register_value);
                }
                break;
 
 
        case PM2_CONTROL:
 
-               if (ACPI_MTX_LOCK == use_lock) {
-                       acpi_cm_acquire_mutex (ACPI_MTX_HARDWARE);
-               }
-
-               register_value = (u32) acpi_os_in16 (acpi_gbl_FACP->pm2_cnt_blk);
                switch (register_id)
                {
                case ARB_DIS:
@@ -517,85 +440,64 @@ acpi_hw_register_access (
                        break;
                }
 
+               register_value = acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK, PM2_CONTROL);
+
                if (read_write == ACPI_WRITE) {
                        register_value &= ~mask;
                        value          <<= acpi_hw_get_bit_shift (mask);
                        value          &= mask;
                        register_value |= value;
 
-                       acpi_os_out16 (acpi_gbl_FACP->pm2_cnt_blk, (u16) register_value);
-               }
-
-               if (ACPI_MTX_LOCK == use_lock) {
-                       acpi_cm_release_mutex (ACPI_MTX_HARDWARE);
+                       acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK,
+                                          PM2_CONTROL, (u8) (register_value));
                }
                break;
 
 
        case PM_TIMER:
 
-               register_value = acpi_os_in32 (acpi_gbl_FACP->pm_tmr_blk);
-               mask = 0xFFFFFFFF;
+               mask = TMR_VAL_MASK;
+               register_value = acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK,
+                                PM_TIMER);
                break;
 
 
        case GPE1_EN_BLOCK:
-
-               gpe_reg = (acpi_gbl_FACP->gpe1_blk + acpi_gbl_FACP->gpe1_base) +
-                                (gpe_reg + (DIV_2 (acpi_gbl_FACP->gpe1_blk_len)));
-
-
        case GPE1_STS_BLOCK:
-
-               if (!gpe_reg) {
-                       gpe_reg = (acpi_gbl_FACP->gpe1_blk + acpi_gbl_FACP->gpe1_base);
-               }
-
-
        case GPE0_EN_BLOCK:
-
-               if (!gpe_reg) {
-                       gpe_reg = acpi_gbl_FACP->gpe0blk + DIV_2 (acpi_gbl_FACP->gpe0blk_len);
-               }
-
-
        case GPE0_STS_BLOCK:
 
-               if (!gpe_reg) {
-                       gpe_reg = acpi_gbl_FACP->gpe0blk;
-               }
-
-               /* Determine the bit to be accessed */
+               /* Determine the bit to be accessed
+                *
+                *  (u32) Register_id:
+                *      31      24       16       8        0
+                *      +--------+--------+--------+--------+
+                *      |  gpe_block_id   |  gpe_bit_number |
+                *      +--------+--------+--------+--------+
+                *
+                *     gpe_block_id is one of GPE[01]_EN_BLOCK and GPE[01]_STS_BLOCK
+                *     gpe_bit_number is relative from the gpe_block (0x00~0xFF)
+                */
 
-               mask = (((u32) register_id) & BIT_IN_REGISTER_MASK);
-               mask = 1 << (mask-1);
+               mask = REGISTER_BIT_ID(register_id); /* gpe_bit_number */
+               register_id = REGISTER_BLOCK_ID(register_id) | (mask >> 3);
+               mask = acpi_gbl_decode_to8bit [mask % 8];
 
                /*
                 * The base address of the GPE 0 Register Block
                 * Plus 1/2 the length of the GPE 0 Register Block
-                * The enable register is the register following the Status Register
-                * and each register is defined as 1/2 of the total Register Block
+                * The enable Register is the Register following the Status Register
+                * and each Register is defined as 1/2 of the total Register Block
                 */
 
                /*
                 * This sets the bit within Enable_bit that needs to be written to
-                * the register indicated in Mask to a 1, all others are 0
+                * the Register indicated in Mask to a 1, all others are 0
                 */
 
-               if (mask > LOW_BYTE) {
-                       /* Shift the value 1 byte to the right and add 1 to the register */
-
-                       mask >>= ONE_BYTE;
-                       gpe_reg++;
-               }
-
                /* Now get the current Enable Bits in the selected Reg */
 
-               if(ACPI_MTX_LOCK == use_lock) {
-                       acpi_cm_acquire_mutex (ACPI_MTX_HARDWARE);
-               }
-
-               register_value = (u32) acpi_os_in8 (gpe_reg);
+               register_value = acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK, register_id);
                if (read_write == ACPI_WRITE) {
                        register_value &= ~mask;
                        value          <<= acpi_hw_get_bit_shift (mask);
@@ -603,29 +505,494 @@ acpi_hw_register_access (
                        register_value |= value;
 
                        /* This write will put the Action state into the General Purpose */
-
                        /* Enable Register indexed by the value in Mask */
 
-                       acpi_os_out8 (gpe_reg, (u8) register_value);
-                       register_value = (u32) acpi_os_in8 (gpe_reg);
-               }
-
-               if(ACPI_MTX_LOCK == use_lock) {
-                       acpi_cm_release_mutex (ACPI_MTX_HARDWARE);
+                       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 */
        default:
 
                mask = 0;
                break;
        }
 
+       if (ACPI_MTX_LOCK == use_lock) {
+               acpi_cm_release_mutex (ACPI_MTX_HARDWARE);
+       }
+
 
        register_value &= mask;
        register_value >>= acpi_hw_get_bit_shift (mask);
 
        return (register_value);
 }
+
+
+/******************************************************************************
+ *
+ * FUNCTION:    Acpi_hw_register_read
+ *
+ * PARAMETERS:  Use_lock               - Mutex hw access.
+ *              Register_id            - Register_iD + Offset.
+ *
+ * RETURN:      Value read or written.
+ *
+ * DESCRIPTION: Acpi register read function.  Registers are read at the
+ *              given offset.
+ *
+ ******************************************************************************/
+
+u32
+acpi_hw_register_read (
+       u8                      use_lock,
+       u32                     register_id)
+{
+       u32                     value       = 0;
+       u32                     bank_offset;
+
+       if (ACPI_MTX_LOCK == use_lock) {
+               acpi_cm_acquire_mutex (ACPI_MTX_HARDWARE);
+       }
+
+
+       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);
+               value |= acpi_hw_low_level_read (16, &acpi_gbl_FADT->Xpm1b_evt_blk, 0);
+               break;
+
+
+       case PM1_EN: /* 16-bit access*/
+
+               bank_offset = DIV_2 (acpi_gbl_FADT->pm1_evt_len);
+               value =  acpi_hw_low_level_read (16, &acpi_gbl_FADT->Xpm1a_evt_blk, bank_offset);
+               value |= acpi_hw_low_level_read (16, &acpi_gbl_FADT->Xpm1b_evt_blk, bank_offset);
+               break;
+
+
+       case PM1_CONTROL: /* 16-bit access */
+
+               if (register_id != SLP_TYPE_B) {
+                       value |= acpi_hw_low_level_read (16, &acpi_gbl_FADT->Xpm1a_cnt_blk, 0);
+               }
+
+               if (register_id != SLP_TYPE_A) {
+                       value |= acpi_hw_low_level_read (16, &acpi_gbl_FADT->Xpm1b_cnt_blk, 0);
+               }
+               break;
+
+
+       case PM2_CONTROL: /* 8-bit access */
+
+               value =  acpi_hw_low_level_read (8, &acpi_gbl_FADT->Xpm2_cnt_blk, 0);
+               break;
+
+
+       case PM_TIMER: /* 32-bit access */
+
+               value =  acpi_hw_low_level_read (32, &acpi_gbl_FADT->Xpm_tmr_blk, 0);
+               break;
+
+
+       case GPE0_STS_BLOCK: /* 8-bit access */
+
+               value =  acpi_hw_low_level_read (8, &acpi_gbl_FADT->Xgpe0blk, 0);
+               break;
+
+
+       case GPE0_EN_BLOCK: /* 8-bit access */
+
+               bank_offset = DIV_2 (acpi_gbl_FADT->gpe0blk_len);
+               value =  acpi_hw_low_level_read (8, &acpi_gbl_FADT->Xgpe0blk, bank_offset);
+               break;
+
+
+       case GPE1_STS_BLOCK: /* 8-bit access */
+
+               value =  acpi_hw_low_level_read (8, &acpi_gbl_FADT->Xgpe1_blk, 0);
+               break;
+
+
+       case GPE1_EN_BLOCK: /* 8-bit access */
+
+               bank_offset = DIV_2 (acpi_gbl_FADT->gpe1_blk_len);
+               value =  acpi_hw_low_level_read (8, &acpi_gbl_FADT->Xgpe1_blk, bank_offset);
+               break;
+
+
+       case SMI_CMD_BLOCK: /* 8bit */
+
+               value = (u32) acpi_os_in8 (acpi_gbl_FADT->smi_cmd);
+               break;
+
+
+       default:
+               value = 0;
+               break;
+       }
+
+
+       if (ACPI_MTX_LOCK == use_lock) {
+               acpi_cm_release_mutex (ACPI_MTX_HARDWARE);
+       }
+
+       return (value);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION:    Acpi_hw_register_write
+ *
+ * PARAMETERS:  Use_lock               - Mutex hw access.
+ *              Register_id            - Register_iD + Offset.
+ *
+ * RETURN:      Value read or written.
+ *
+ * DESCRIPTION: Acpi register Write function.  Registers are written at the
+ *              given offset.
+ *
+ ******************************************************************************/
+
+void
+acpi_hw_register_write (
+       u8                      use_lock,
+       u32                     register_id,
+       u32                     value)
+{
+       u32                     bank_offset;
+
+
+       if (ACPI_MTX_LOCK == use_lock) {
+               acpi_cm_acquire_mutex (ACPI_MTX_HARDWARE);
+       }
+
+
+       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);
+               acpi_hw_low_level_write (16, value, &acpi_gbl_FADT->Xpm1b_evt_blk, 0);
+               break;
+
+
+       case PM1_EN: /* 16-bit access*/
+
+               bank_offset = DIV_2 (acpi_gbl_FADT->pm1_evt_len);
+               acpi_hw_low_level_write (16, value, &acpi_gbl_FADT->Xpm1a_evt_blk, bank_offset);
+               acpi_hw_low_level_write (16, value, &acpi_gbl_FADT->Xpm1b_evt_blk, bank_offset);
+               break;
+
+
+       case PM1_CONTROL: /* 16-bit access */
+
+               /*
+                * If SLP_TYP_A or SLP_TYP_B, only write to one reg block.
+                * Otherwise, write to both.
+                */
+               if (register_id == SLP_TYPE_A) {
+                       acpi_hw_low_level_write (16, value, &acpi_gbl_FADT->Xpm1a_cnt_blk, 0);
+               }
+               else if (register_id == SLP_TYPE_B) {
+                       acpi_hw_low_level_write (16, value, &acpi_gbl_FADT->Xpm1b_cnt_blk, 0);
+               }
+               else {
+                       /* disable/re-enable interrupts if sleeping */
+                       if (register_id == SLP_EN) {
+                               disable();
+                       }
+
+                       acpi_hw_low_level_write (16, value, &acpi_gbl_FADT->Xpm1a_cnt_blk, 0);
+                       acpi_hw_low_level_write (16, value, &acpi_gbl_FADT->Xpm1b_cnt_blk, 0);
+
+                       if (register_id == SLP_EN) {
+                               enable();
+                       }
+               }
+
+               break;
+
+
+       case PM2_CONTROL: /* 8-bit access */
+
+               acpi_hw_low_level_write (8, value, &acpi_gbl_FADT->Xpm2_cnt_blk, 0);
+               break;
+
+
+       case PM_TIMER: /* 32-bit access */
+
+               acpi_hw_low_level_write (32, value, &acpi_gbl_FADT->Xpm_tmr_blk, 0);
+               break;
+
+
+       case GPE0_STS_BLOCK: /* 8-bit access */
+
+               acpi_hw_low_level_write (8, value, &acpi_gbl_FADT->Xgpe0blk, 0);
+               break;
+
+
+       case GPE0_EN_BLOCK: /* 8-bit access */
+
+               bank_offset = DIV_2 (acpi_gbl_FADT->gpe0blk_len);
+               acpi_hw_low_level_write (8, value, &acpi_gbl_FADT->Xgpe0blk, bank_offset);
+               break;
+
+
+       case GPE1_STS_BLOCK: /* 8-bit access */
+
+               acpi_hw_low_level_write (8, value, &acpi_gbl_FADT->Xgpe1_blk, 0);
+               break;
+
+
+       case GPE1_EN_BLOCK: /* 8-bit access */
+
+               bank_offset = DIV_2 (acpi_gbl_FADT->gpe1_blk_len);
+               acpi_hw_low_level_write (8, value, &acpi_gbl_FADT->Xgpe1_blk, bank_offset);
+               break;
+
+
+       case SMI_CMD_BLOCK: /* 8bit */
+
+               /* 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);
+               break;
+
+
+       default:
+               value = 0;
+               break;
+       }
+
+
+       if (ACPI_MTX_LOCK == use_lock) {
+               acpi_cm_release_mutex (ACPI_MTX_HARDWARE);
+       }
+
+       return;
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION:    Acpi_hw_low_level_read
+ *
+ * PARAMETERS:  Register            - GAS register structure
+ *              Offset              - Offset from the base address in the GAS
+ *              Width               - 8, 16, or 32
+ *
+ * RETURN:      Value read
+ *
+ * DESCRIPTION: Read from either memory, IO, or PCI config space.
+ *
+ ******************************************************************************/
+
+u32
+acpi_hw_low_level_read (
+       u32                     width,
+       ACPI_GAS                *reg,
+       u32                     offset)
+{
+       u32                     value = 0;
+       ACPI_PHYSICAL_ADDRESS   mem_address;
+       ACPI_IO_ADDRESS         io_address;
+       u32                     pci_register;
+       u32                     pci_dev_func;
+
+
+       /*
+        * Must have a valid pointer to a GAS structure, and
+        * a non-zero address within
+        */
+       if ((!reg) ||
+               (!reg->address))
+       {
+               return 0;
+       }
+
+
+       /*
+        * Three address spaces supported:
+        * Memory, Io, or PCI config.
+        */
+
+       switch (reg->address_space_id)
+       {
+       case ADDRESS_SPACE_SYSTEM_MEMORY:
+
+               mem_address = (ACPI_PHYSICAL_ADDRESS) reg->address + offset;
+
+               switch (width)
+               {
+               case 8:
+                       value = acpi_os_mem_in8 (mem_address);
+                       break;
+               case 16:
+                       value = acpi_os_mem_in16 (mem_address);
+                       break;
+               case 32:
+                       value = acpi_os_mem_in32 (mem_address);
+                       break;
+               }
+               break;
+
+
+       case ADDRESS_SPACE_SYSTEM_IO:
+
+               io_address = (ACPI_IO_ADDRESS) reg->address + offset;
+
+               switch (width)
+               {
+               case 8:
+                       value = acpi_os_in8 (io_address);
+                       break;
+               case 16:
+                       value = acpi_os_in16 (io_address);
+                       break;
+               case 32:
+                       value = acpi_os_in32 (io_address);
+                       break;
+               }
+               break;
+
+
+       case ADDRESS_SPACE_PCI_CONFIG:
+
+               pci_dev_func = ACPI_PCI_DEVFUN  (reg->address);
+               pci_register = ACPI_PCI_REGISTER (reg->address) + offset;
+
+               switch (width)
+               {
+               case 8:
+                       acpi_os_read_pci_cfg_byte (0, pci_dev_func, pci_register, (u8 *) &value);
+                       break;
+               case 16:
+                       acpi_os_read_pci_cfg_word (0, pci_dev_func, pci_register, (u16 *) &value);
+                       break;
+               case 32:
+                       acpi_os_read_pci_cfg_dword (0, pci_dev_func, pci_register, (u32 *) &value);
+                       break;
+               }
+               break;
+       }
+
+       return value;
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION:    Acpi_hw_low_level_write
+ *
+ * PARAMETERS:  Width               - 8, 16, or 32
+ *              Value               - To be written
+ *              Register            - GAS register structure
+ *              Offset              - Offset from the base address in the GAS
+ *
+ *
+ * RETURN:      Value read
+ *
+ * DESCRIPTION: Read from either memory, IO, or PCI config space.
+ *
+ ******************************************************************************/
+
+void
+acpi_hw_low_level_write (
+       u32                     width,
+       u32                     value,
+       ACPI_GAS                *reg,
+       u32                     offset)
+{
+       ACPI_PHYSICAL_ADDRESS   mem_address;
+       ACPI_IO_ADDRESS         io_address;
+       u32                     pci_register;
+       u32                     pci_dev_func;
+
+
+       /*
+        * Must have a valid pointer to a GAS structure, and
+        * a non-zero address within
+        */
+       if ((!reg) ||
+               (!reg->address))
+       {
+               return;
+       }
+
+
+       /*
+        * Three address spaces supported:
+        * Memory, Io, or PCI config.
+        */
+
+       switch (reg->address_space_id)
+       {
+       case ADDRESS_SPACE_SYSTEM_MEMORY:
+
+               mem_address = (ACPI_PHYSICAL_ADDRESS) reg->address + offset;
+
+               switch (width)
+               {
+               case 8:
+                       acpi_os_mem_out8 (mem_address, (u8) value);
+                       break;
+               case 16:
+                       acpi_os_mem_out16 (mem_address, (u16) value);
+                       break;
+               case 32:
+                       acpi_os_mem_out32 (mem_address, (u32) value);
+                       break;
+               }
+               break;
+
+
+       case ADDRESS_SPACE_SYSTEM_IO:
+
+               io_address = (ACPI_IO_ADDRESS) reg->address + offset;
+
+               switch (width)
+               {
+               case 8:
+                       acpi_os_out8 (io_address, (u8) value);
+                       break;
+               case 16:
+                       acpi_os_out16 (io_address, (u16) value);
+                       break;
+               case 32:
+                       acpi_os_out32 (io_address, (u32) value);
+                       break;
+               }
+               break;
+
+
+       case ADDRESS_SPACE_PCI_CONFIG:
+
+               pci_dev_func = ACPI_PCI_DEVFUN  (reg->address);
+               pci_register = ACPI_PCI_REGISTER (reg->address) + offset;
+
+               switch (width)
+               {
+               case 8:
+                       acpi_os_write_pci_cfg_byte (0, pci_dev_func, pci_register, (u8) value);
+                       break;
+               case 16:
+                       acpi_os_write_pci_cfg_word (0, pci_dev_func, pci_register, (u16) value);
+                       break;
+               case 32:
+                       acpi_os_write_pci_cfg_dword (0, pci_dev_func, pci_register, (u32) value);
+                       break;
+               }
+               break;
+       }
+}
index fbe564b46e2e507894c047cf0cbef9b4d6088ee7..156c946e73f862bd10cb1f1e0a092f75696f22fe 100644 (file)
@@ -2,7 +2,7 @@
 /******************************************************************************
  *
  * Name: hwxface.c - Hardware access external interfaces
- *              $Revision: 31 $
+ *              $Revision: 36 $
  *
  *****************************************************************************/
 
@@ -69,7 +69,7 @@ acpi_get_processor_throttling_info (
        NATIVE_UINT             num_throttle_states;
        NATIVE_UINT             buffer_space_needed;
        NATIVE_UINT             i;
-       u8                      duty_width = 0;
+       u8                      duty_width;
        ACPI_NAMESPACE_NODE     *cpu_node;
        ACPI_OPERAND_OBJECT     *cpu_obj;
        ACPI_CPU_THROTTLING_STATE *state_ptr;
@@ -100,12 +100,10 @@ acpi_get_processor_throttling_info (
                return (AE_NOT_FOUND);
        }
 
-#ifndef _IA64
        /*
-        * No Duty fields in IA64 tables
+        * (Duty Width on IA-64 is zero)
         */
-       duty_width = acpi_gbl_FACP->duty_width;
-#endif
+       duty_width = acpi_gbl_FADT->duty_width;
 
        /*
         *  P0 must always have a P_BLK all others may be null
@@ -115,7 +113,7 @@ acpi_get_processor_throttling_info (
         *
         */
        if (!cpu_obj->processor.length || !duty_width ||
-               (0xFFFF < cpu_obj->processor.address))
+               (ACPI_UINT16_MAX < cpu_obj->processor.address))
        {
                /*
                 *  Acpi_even though we can't throttle, we still have one state (100%)
@@ -177,8 +175,8 @@ acpi_get_processor_throttling_state (
        ACPI_OPERAND_OBJECT     *cpu_obj;
        u32                     num_throttle_states;
        u32                     duty_cycle;
-       u8                      duty_offset = 0;
-       u8                      duty_width = 0;
+       u8                      duty_offset;
+       u8                      duty_width;
 
 
        /* Convert and validate the device handle */
@@ -195,13 +193,11 @@ acpi_get_processor_throttling_state (
                return (AE_NOT_FOUND);
        }
 
-#ifndef _IA64
        /*
         * No Duty fields in IA64 tables
         */
-       duty_offset = acpi_gbl_FACP->duty_offset;
-       duty_width = acpi_gbl_FACP->duty_width;
-#endif
+       duty_offset = acpi_gbl_FADT->duty_offset;
+       duty_width = acpi_gbl_FADT->duty_width;
 
        /*
         *  Must have a valid P_BLK P0 must have a P_BLK all others may be null
@@ -211,7 +207,7 @@ acpi_get_processor_throttling_state (
         *  also, if Duty_width is zero there are no additional states
         */
        if (!cpu_obj->processor.length || !duty_width ||
-               (0xFFFF < cpu_obj->processor.address))
+               (ACPI_UINT16_MAX < cpu_obj->processor.address))
        {
                *throttle_state = 0;
                return(AE_OK);
@@ -263,8 +259,8 @@ acpi_set_processor_throttling_state (
        ACPI_NAMESPACE_NODE    *cpu_node;
        ACPI_OPERAND_OBJECT    *cpu_obj;
        u32                     num_throttle_states = 0;
-       u8                      duty_offset = 0;
-       u8                      duty_width = 0;
+       u8                      duty_offset;
+       u8                      duty_width;
        u32                     duty_cycle = 0;
 
 
@@ -282,13 +278,11 @@ acpi_set_processor_throttling_state (
                return (AE_NOT_FOUND);
        }
 
-#ifndef _IA64
        /*
         * No Duty fields in IA64 tables
         */
-       duty_offset = acpi_gbl_FACP->duty_offset;
-       duty_width = acpi_gbl_FACP->duty_width;
-#endif
+       duty_offset = acpi_gbl_FADT->duty_offset;
+       duty_width = acpi_gbl_FADT->duty_width;
 
        /*
         *  Must have a valid P_BLK P0 must have a P_BLK all others may be null
@@ -298,7 +292,7 @@ acpi_set_processor_throttling_state (
         *  also, if Duty_width is zero there are no additional states
         */
        if (!cpu_obj->processor.length || !duty_width ||
-               (0xFFFF < cpu_obj->processor.address))
+               (ACPI_UINT16_MAX < cpu_obj->processor.address))
        {
                /*
                 *  If caller wants to set the state to the only state we handle
@@ -314,7 +308,7 @@ acpi_set_processor_throttling_state (
                return (AE_SUPPORT);
        }
 
-       num_throttle_states = (int) acpi_hw_local_pow (2,duty_width);
+       num_throttle_states = (u32) acpi_hw_local_pow (2,duty_width);
 
        /*
         * Convert throttling state to duty cycle (invert).
@@ -533,9 +527,10 @@ acpi_get_timer (
 
 ACPI_STATUS
 acpi_set_firmware_waking_vector (
-       void                    *physical_address)
+       ACPI_PHYSICAL_ADDRESS physical_address)
 {
 
+
        /* Make sure that we have an FACS */
 
        if (!acpi_gbl_FACS) {
@@ -544,7 +539,12 @@ acpi_set_firmware_waking_vector (
 
        /* Set the vector */
 
-       * ((void **) acpi_gbl_FACS->firmware_waking_vector) = physical_address;
+       if (acpi_gbl_FACS->vector_width == 32) {
+               * (u32 *) acpi_gbl_FACS->firmware_waking_vector = (u32) physical_address;
+       }
+       else {
+               *acpi_gbl_FACS->firmware_waking_vector = physical_address;
+       }
 
        return (AE_OK);
 }
@@ -555,7 +555,7 @@ acpi_set_firmware_waking_vector (
  * FUNCTION:    Acpi_get_firmware_waking_vector
  *
  * PARAMETERS:  *Physical_address   - Output buffer where contents of
- *                                    the d_firmware_waking_vector field of
+ *                                    the Firmware_waking_vector field of
  *                                    the FACS will be stored.
  *
  * RETURN:      Status
@@ -566,9 +566,10 @@ acpi_set_firmware_waking_vector (
 
 ACPI_STATUS
 acpi_get_firmware_waking_vector (
-       void                    **physical_address)
+       ACPI_PHYSICAL_ADDRESS *physical_address)
 {
 
+
        if (!physical_address) {
                return (AE_BAD_PARAMETER);
        }
@@ -581,8 +582,12 @@ acpi_get_firmware_waking_vector (
 
        /* Get the vector */
 
-       *physical_address = * ((void **) acpi_gbl_FACS->firmware_waking_vector);
-
+       if (acpi_gbl_FACS->vector_width == 32) {
+               *physical_address = * (u32 *) acpi_gbl_FACS->firmware_waking_vector;
+       }
+       else {
+               *physical_address = *acpi_gbl_FACS->firmware_waking_vector;
+       }
 
        return (AE_OK);
 }
index e914ffeb20a56ef975373d2e8dc0ad87ce518d0f..37e13b2285e4d95e84cbcc9135a8b4a9dce46b5d 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Name: accommon.h -- prototypes for the common (subsystem-wide) procedures
- *       $Revision: 74 $
+ *       $Revision: 82 $
  *
  *****************************************************************************/
 
@@ -43,7 +43,7 @@
 
 void
 acpi_cm_init_globals (
-       ACPI_INIT_DATA *init_data);
+       void);
 
 void
 acpi_cm_terminate (
@@ -51,7 +51,7 @@ acpi_cm_terminate (
 
 
 /*
- * Acpi_cm_init - miscellaneous initialization and shutdown
+ * Cm_init - miscellaneous initialization and shutdown
  */
 
 ACPI_STATUS
@@ -62,10 +62,16 @@ ACPI_STATUS
 acpi_cm_subsystem_shutdown (
        void);
 
+ACPI_STATUS
+acpi_cm_validate_fadt (
+       void);
+
 /*
- * Acpi_cm_global - Global data structures and procedures
+ * Cm_global - Global data structures and procedures
  */
 
+#ifdef ACPI_DEBUG
+
 NATIVE_CHAR *
 acpi_cm_get_mutex_name (
        u32                     mutex_id);
@@ -74,6 +80,13 @@ 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);
@@ -84,7 +97,7 @@ acpi_cm_allocate_owner_id (
 
 
 /*
- * Acpi_cm_clib - Local implementations of C library functions
+ * Cm_clib - Local implementations of C library functions
  */
 
 NATIVE_UINT
@@ -161,7 +174,7 @@ acpi_cm_to_lower (
 
 
 /*
- * Acpi_cm_copy - Object construction and conversion interfaces
+ * Cm_copy - Object construction and conversion interfaces
  */
 
 ACPI_STATUS
@@ -204,7 +217,7 @@ acpi_cm_build_copy_internal_package_object (
 
 
 /*
- * Acpi_cm_create - Object creation
+ * Cm_create - Object creation
  */
 
 ACPI_STATUS
@@ -221,7 +234,7 @@ _cm_create_internal_object (
 
 
 /*
- * Acpi_cm_debug - Debug interfaces
+ * Cm_debug - Debug interfaces
  */
 
 u32
@@ -315,22 +328,19 @@ void
 _report_info (
        NATIVE_CHAR             *module_name,
        u32                     line_number,
-       u32                     component_id,
-       NATIVE_CHAR             *message);
+       u32                     component_id);
 
 void
 _report_error (
        NATIVE_CHAR             *module_name,
        u32                     line_number,
-       u32                     component_id,
-       NATIVE_CHAR             *message);
+       u32                     component_id);
 
 void
 _report_warning (
        NATIVE_CHAR             *module_name,
        u32                     line_number,
-       u32                     component_id,
-       NATIVE_CHAR             *message);
+       u32                     component_id);
 
 void
 acpi_cm_dump_buffer (
@@ -341,7 +351,7 @@ acpi_cm_dump_buffer (
 
 
 /*
- * Acpi_cm_delete - Object deletion
+ * Cm_delete - Object deletion
  */
 
 void
@@ -362,7 +372,7 @@ acpi_cm_delete_internal_object_list (
 
 
 /*
- * Acpi_cm_eval - object evaluation
+ * Cm_eval - object evaluation
  */
 
 /* Method name strings */
@@ -378,9 +388,9 @@ acpi_cm_delete_internal_object_list (
 
 ACPI_STATUS
 acpi_cm_evaluate_numeric_object (
-       NATIVE_CHAR             *method_name,
+       NATIVE_CHAR             *object_name,
        ACPI_NAMESPACE_NODE     *device_node,
-       u32                     *address);
+       ACPI_INTEGER            *address);
 
 ACPI_STATUS
 acpi_cm_execute_HID (
@@ -399,7 +409,7 @@ acpi_cm_execute_UID (
 
 
 /*
- * Acpi_cm_error - exception interfaces
+ * Cm_error - exception interfaces
  */
 
 NATIVE_CHAR *
@@ -408,7 +418,7 @@ acpi_cm_format_exception (
 
 
 /*
- * Acpi_cm_mutex - mutual exclusion interfaces
+ * Cm_mutex - mutual exclusion interfaces
  */
 
 ACPI_STATUS
@@ -437,7 +447,7 @@ acpi_cm_release_mutex (
 
 
 /*
- * Acpi_cm_object - internal object create/delete/cache routines
+ * Cm_object - internal object create/delete/cache routines
  */
 
 void *
@@ -459,7 +469,7 @@ acpi_cm_valid_internal_object (
 
 
 /*
- * Acpi_cm_ref_cnt - Object reference count management
+ * Cm_ref_cnt - Object reference count management
  */
 
 void
@@ -471,7 +481,7 @@ acpi_cm_remove_reference (
        ACPI_OPERAND_OBJECT     *object);
 
 /*
- * Acpi_cm_size - Object size routines
+ * Cm_size - Object size routines
  */
 
 ACPI_STATUS
@@ -491,7 +501,7 @@ acpi_cm_get_object_size(
 
 
 /*
- * Acpi_cm_state - Generic state creation/cache routines
+ * Cm_state - Generic state creation/cache routines
  */
 
 void
@@ -536,7 +546,7 @@ acpi_cm_delete_object_cache (
        void);
 
 /*
- * Acpi_cmutils
+ * Cmutils
  */
 
 u8
@@ -547,6 +557,10 @@ u8
 acpi_cm_valid_acpi_character (
        NATIVE_CHAR             character);
 
+ACPI_STATUS
+acpi_cm_resolve_package_references (
+       ACPI_OPERAND_OBJECT     *obj_desc);
+
 
 /*
  * Memory allocation functions and related macros.
index 5e1427950f930ef908aace43bc5fe51cf7266f63..2b210339b5e7a2324ce9177f4f074db0d99ba258 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Name: acconfig.h - Global configuration constants
- *       $Revision: 42 $
+ *       $Revision: 48 $
  *
  *****************************************************************************/
 
 
 #define ACPI_CA_VERSION             __DATE__
 
-/* Name of host operating system (returned by the _OS_ namespace object) */
-
-#ifdef _LINUX
-#define ACPI_OS_NAME                "Linux"
-#else
-#define ACPI_OS_NAME                "Intel ACPI/CA Core Subsystem"
-#endif
-
-
-/*
- * How and when control methods will be parsed
- * The default action is to parse all methods at table load time to verify them, but delete the parse trees
- * to conserve memory.  Methods are parsed just in time before execution and the parse tree is deleted
- * when execution completes.
- */
-#define METHOD_PARSE_AT_INIT        0x0     /* Parse at table init, never delete the method parse tree */
-#define METHOD_PARSE_JUST_IN_TIME   0x1     /* Parse only when a method is invoked */
-#define METHOD_DELETE_AT_COMPLETION 0x2     /* Delete parse tree on method completion */
-
-/* Default parsing configuration */
-
-#define METHOD_PARSE_CONFIGURATION  (METHOD_PARSE_JUST_IN_TIME | METHOD_DELETE_AT_COMPLETION)
-
 
 /* Maximum objects in the various object caches */
 
 #define MAX_OBJECT_CACHE_DEPTH      64          /* Interpreter operand objects */
 #define MAX_WALK_CACHE_DEPTH        2           /* Objects for parse tree walks (method execution) */
 
-/*
- * Name_space Table size
- *
- * All tables are the same size to simplify the implementation.
- * Tables may be extended by allocating additional tables that
- * are in turn linked together to form a chain of tables.
- */
-
-#define NS_TABLE_SIZE               4
 
 /* String size constants */
 
 /* Names within the namespace are 4 bytes long */
 
 #define ACPI_NAME_SIZE              4
-#define PATH_SEGMENT_LENGTH         5       /* 4 chars for name + 1 s8 for separator */
+#define PATH_SEGMENT_LENGTH         5           /* 4 chars for name + 1 s8 for separator */
 #define PATH_SEPARATOR              '.'
 
 
 /* Constants used in searching for the RSDP in low memory */
 
-#define LO_RSDP_WINDOW_BASE         (void *) 0
-#define HI_RSDP_WINDOW_BASE         (void *) 0xE0000
+#define LO_RSDP_WINDOW_BASE         0           /* Physical Address */
+#define HI_RSDP_WINDOW_BASE         0xE0000     /* Physical Address */
 #define LO_RSDP_WINDOW_SIZE         0x400
 #define HI_RSDP_WINDOW_SIZE         0x20000
 #define RSDP_SCAN_STEP              16
index 02efd62e87574a5b512b3f396a70efaa06b6523d..2bc9e7165420cf1be7257578f3337ca89c8e32d2 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Name: acdebug.h - ACPI/AML debugger
- *       $Revision: 35 $
+ *       $Revision: 37 $
  *
  *****************************************************************************/
 
@@ -205,6 +205,7 @@ acpi_db_find_references (
 
 void
 acpi_db_display_op (
+       ACPI_WALK_STATE         *walk_state,
        ACPI_PARSE_OBJECT       *origin,
        u32                     num_opcodes);
 
@@ -218,8 +219,13 @@ acpi_db_display_path (
 
 void
 acpi_db_display_opcode (
+       ACPI_WALK_STATE         *walk_state,
        ACPI_PARSE_OBJECT       *op);
 
+void
+acpi_db_decode_internal_object (
+       ACPI_OPERAND_OBJECT     *obj_desc);
+
 
 /*
  * dbdisply - debug display commands
index d87bb47fdd4c07a6528afad4b3151eeecdb88fcd..599e46c365ed88fe97393aeb38da754c981955b8 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Name: acdispat.h - dispatcher (parser to interpreter interface)
- *       $Revision: 29 $
+ *       $Revision: 33 $
  *
  *****************************************************************************/
 
@@ -61,7 +61,11 @@ acpi_ds_obj_stack_pop_object (
        ACPI_WALK_STATE         *walk_state);
 
 
-/* dsregion - Op region support */
+/* dsopcode - support for late evaluation */
+
+ACPI_STATUS
+acpi_ds_get_field_unit_arguments (
+       ACPI_OPERAND_OBJECT     *obj_desc);
 
 ACPI_STATUS
 acpi_ds_get_region_arguments (
@@ -84,6 +88,13 @@ acpi_ds_exec_end_control_op (
 
 /* dsexec - Parser/Interpreter interface, method execution callbacks */
 
+
+ACPI_STATUS
+acpi_ds_get_predicate_value (
+       ACPI_WALK_STATE         *walk_state,
+       ACPI_PARSE_OBJECT       *op,
+       u32                     has_result_obj);
+
 ACPI_STATUS
 acpi_ds_exec_begin_op (
        u16                     opcode,
@@ -145,6 +156,18 @@ acpi_ds_load2_end_op (
        ACPI_WALK_STATE         *state,
        ACPI_PARSE_OBJECT       *op);
 
+ACPI_STATUS
+acpi_ds_load3_begin_op (
+       u16                     opcode,
+       ACPI_PARSE_OBJECT       *op,
+       ACPI_WALK_STATE         *walk_state,
+       ACPI_PARSE_OBJECT       **out_op);
+
+ACPI_STATUS
+acpi_ds_load3_end_op (
+       ACPI_WALK_STATE         *state,
+       ACPI_PARSE_OBJECT       *op);
+
 
 /* dsmthdat - method data (locals/args) */
 
@@ -283,6 +306,11 @@ acpi_ds_create_node (
 
 /* dsregn - Parser/Interpreter interface - Op Region parsing */
 
+ACPI_STATUS
+acpi_ds_eval_field_unit_operands (
+       ACPI_WALK_STATE         *walk_state,
+       ACPI_PARSE_OBJECT       *op);
+
 ACPI_STATUS
 acpi_ds_eval_region_operands (
        ACPI_WALK_STATE         *walk_state,
@@ -297,7 +325,8 @@ acpi_ds_initialize_region (
 
 u8
 acpi_ds_is_result_used (
-       ACPI_PARSE_OBJECT       *op);
+       ACPI_PARSE_OBJECT       *op,
+       ACPI_WALK_STATE         *walk_state);
 
 void
 acpi_ds_delete_result_if_not_used (
@@ -308,7 +337,8 @@ acpi_ds_delete_result_if_not_used (
 ACPI_STATUS
 acpi_ds_create_operand (
        ACPI_WALK_STATE         *walk_state,
-       ACPI_PARSE_OBJECT       *arg);
+       ACPI_PARSE_OBJECT       *arg,
+       u32                     args_remaining);
 
 ACPI_STATUS
 acpi_ds_create_operands (
@@ -377,12 +407,10 @@ acpi_ds_pop_walk_state (
 
 ACPI_STATUS
 acpi_ds_result_stack_pop (
-       ACPI_OPERAND_OBJECT     **object,
        ACPI_WALK_STATE         *walk_state);
 
 ACPI_STATUS
 acpi_ds_result_stack_push (
-       void                    *object,
        ACPI_WALK_STATE         *walk_state);
 
 ACPI_STATUS
@@ -397,5 +425,31 @@ void
 acpi_ds_delete_walk_state_cache (
        void);
 
+ACPI_STATUS
+acpi_ds_result_insert (
+       void                    *object,
+       u32                     index,
+       ACPI_WALK_STATE         *walk_state);
+
+ACPI_STATUS
+acpi_ds_result_remove (
+       ACPI_OPERAND_OBJECT     **object,
+       u32                     index,
+       ACPI_WALK_STATE         *walk_state);
+
+ACPI_STATUS
+acpi_ds_result_pop (
+       ACPI_OPERAND_OBJECT     **object,
+       ACPI_WALK_STATE         *walk_state);
+
+ACPI_STATUS
+acpi_ds_result_push (
+       ACPI_OPERAND_OBJECT     *object,
+       ACPI_WALK_STATE         *walk_state);
+
+ACPI_STATUS
+acpi_ds_result_pop_from_bottom (
+       ACPI_OPERAND_OBJECT     **object,
+       ACPI_WALK_STATE         *walk_state);
 
 #endif /* _ACDISPAT_H_ */
index 30c347b5fd7fd297df30a062d0d2ba16797ad374..f867a348f90771ec52300ce6ae2c790bc80ca07e 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Name: acenv.h - Generation environment specific items
- *       $Revision: 53 $
+ *       $Revision: 65 $
  *
  *****************************************************************************/
 
 #define __ACENV_H__
 
 
+/*
+ * Configuration for ACPI 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
+
+
 /*
  * Environment configuration.  The purpose of this file is to interface to the
  * local generation environment.
  *
  */
 
-
-/*
- * Environment-specific configuration
- */
+/*! [Begin] no source code translation */
 
 #ifdef _LINUX
+#include "aclinux.h"
 
-#include <linux/string.h>
-#include <linux/kernel.h>
-#include <linux/ctype.h>
-#include <asm/system.h>
-#include <asm/atomic.h>
-
-/* Use native Linux string library */
-
-#define ACPI_USE_SYSTEM_CLIBRARY
-
-/* Special functions */
-
-#define strtoul             simple_strtoul
+#elif _AED_EFI
+#include "acefi.h"
 
-/* Linux clib doesn't to strupr, but we do. */
-char *
-strupr(char *str);
+#elif WIN32
+#include "acwin.h"
 
-#else
-
-#ifdef _AED_EFI
-
-#include <efi.h>
-#include <efistdarg.h>
-#include <efilib.h>
+#elif __FreeBSD__
+#include "acfreebsd.h"
 
 #else
 
-
 /* All other environments */
 
 #define ACPI_USE_STANDARD_HEADERS
 
-#endif
+/* 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
@@ -218,132 +232,13 @@ typedef char *va_list;
 
 /*
  * 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
  */
 
-
-#ifdef __GNUC__
-
-
-#ifdef __ia64__
-
-/* 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>
-
-/* PAL_HALT[_LIGHT] */
-#define halt() ia64_pal_halt_light()
-
-/* PAL_HALT */
-#define safe_halt() ia64_pal_halt(1)
-
-#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" __atomic_fool_gcc((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" __atomic_fool_gcc((GLptr)):"r2","r29","r30","memory"); \
-       } while (0)
-/*! [End] no source code translation !*/
-
-#else /* DO IA32 */
-
-#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 /* __GNUC__ */
-
-
 /* Unrecognized compiler, use defaults */
 #ifndef ACPI_ASM_MACROS
 
@@ -370,4 +265,14 @@ typedef char *va_list;
 #endif
 
 
+/******************************************************************************
+ *
+ * Compiler-specific
+ *
+ *****************************************************************************/
+
+/* this has been moved to compiler-specific headers, which are included from the
+   platform header. */
+
+
 #endif /* __ACENV_H__ */
index 89029782571973a87d2fd4304c543dbaaacba27e..706862d24907a63384a6300af911c1ad33e9f1b2 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Name: acevents.h - Event subcomponent prototypes and defines
- *       $Revision: 56 $
+ *       $Revision: 60 $
  *
  *****************************************************************************/
 
 #define __ACEVENTS_H__
 
 
+ACPI_STATUS
+acpi_ev_initialize (
+       void);
+
+
 /*
  * Acpi_evfixed - Fixed event handling
  */
@@ -104,7 +109,7 @@ ACPI_STATUS
 acpi_ev_address_space_dispatch (
        ACPI_OPERAND_OBJECT    *region_obj,
        u32                     function,
-       u32                     address,
+       ACPI_PHYSICAL_ADDRESS   address,
        u32                     bit_width,
        u32                     *value);
 
index 1b02ba16afb050222f94f9767ab6ba5d4b201f38..1629a0934d2aeb26e008e7f52623d00c6368807d 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Name: acexcep.h - Exception codes returned by the ACPI subsystem
- *       $Revision: 35 $
+ *       $Revision: 37 $
  *
  *****************************************************************************/
 
@@ -89,6 +89,7 @@
 #define AE_BAD_SIGNATURE                (ACPI_STATUS) (0x0001 | AE_CODE_ACPI_TABLES)
 #define AE_BAD_HEADER                   (ACPI_STATUS) (0x0002 | AE_CODE_ACPI_TABLES)
 #define AE_BAD_CHECKSUM                 (ACPI_STATUS) (0x0003 | AE_CODE_ACPI_TABLES)
+#define AE_BAD_VALUE                    (ACPI_STATUS) (0x0004 | AE_CODE_ACPI_TABLES)
 
 #define AE_CODE_TBL_MAX                 0x0003
 
 #define AE_AML_BAD_NAME                 (ACPI_STATUS) (0x000F | AE_CODE_AML)
 #define AE_AML_NAME_NOT_FOUND           (ACPI_STATUS) (0x0010 | AE_CODE_AML)
 #define AE_AML_INTERNAL                 (ACPI_STATUS) (0x0011 | AE_CODE_AML)
+#define AE_AML_INVALID_SPACE_ID         (ACPI_STATUS) (0x0012 | AE_CODE_AML)
 
-#define AE_CODE_AML_MAX                 0x0011
+#define AE_CODE_AML_MAX                 0x0012
 
 /*
  * Internal exceptions used for control
@@ -177,6 +179,7 @@ static NATIVE_CHAR          *acpi_gbl_exception_names_tbl[] =
        "AE_BAD_SIGNATURE",
        "AE_BAD_HEADER",
        "AE_BAD_CHECKSUM",
+       "AE_BAD_VALUE",
 };
 
 static NATIVE_CHAR          *acpi_gbl_exception_names_aml[] =
@@ -198,6 +201,7 @@ static NATIVE_CHAR          *acpi_gbl_exception_names_aml[] =
        "AE_AML_BAD_NAME",
        "AE_AML_NAME_NOT_FOUND",
        "AE_AML_INTERNAL",
+       "AE_AML_INVALID_SPACE_ID",
 };
 
 static NATIVE_CHAR          *acpi_gbl_exception_names_ctrl[] =
diff --git a/drivers/acpi/include/acgcc.h b/drivers/acpi/include/acgcc.h
new file mode 100644 (file)
index 0000000..5992f49
--- /dev/null
@@ -0,0 +1,149 @@
+/******************************************************************************
+ *
+ * Name: acgcc.h - GCC specific defines, etc.
+ *       $Revision: 2 $
+ *
+ *****************************************************************************/
+
+/*
+ *  Copyright (C) 2000 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__
+
+#define COMPILER_DEPENDENT_UINT64   unsigned long long
+
+
+#ifdef __ia64__
+#define _IA64
+
+/* 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 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__ */
index 15e617e3283c1f954353516da0c865ceeaae3e1d..248f72c9d75b827869d223a124c832db694a5db0 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Name: acglobal.h - Declarations for global variables
- *       $Revision: 84 $
+ *       $Revision: 92 $
  *
  *****************************************************************************/
 
@@ -74,13 +74,12 @@ extern      u32                         acpi_gbl_nesting_level;
  * of each in the system.  Each global points to the actual table.
  *
  */
-ACPI_EXTERN ROOT_SYSTEM_DESCRIPTOR_POINTER      *acpi_gbl_RSDP;
-ACPI_EXTERN ROOT_SYSTEM_DESCRIPTION_TABLE       *acpi_gbl_RSDT;
-ACPI_EXTERN FIRMWARE_ACPI_CONTROL_STRUCTURE     *acpi_gbl_FACS;
-ACPI_EXTERN FIXED_ACPI_DESCRIPTION_TABLE        *acpi_gbl_FACP;
-ACPI_EXTERN APIC_TABLE                          *acpi_gbl_APIC;
-ACPI_EXTERN ACPI_TABLE_HEADER                   *acpi_gbl_DSDT;
-ACPI_EXTERN ACPI_TABLE_HEADER                   *acpi_gbl_SBST;
+ACPI_EXTERN RSDP_DESCRIPTOR             *acpi_gbl_RSDP;
+ACPI_EXTERN XSDT_DESCRIPTOR             *acpi_gbl_XSDT;
+ACPI_EXTERN FADT_DESCRIPTOR             *acpi_gbl_FADT;
+ACPI_EXTERN ACPI_TABLE_HEADER           *acpi_gbl_DSDT;
+ACPI_EXTERN ACPI_COMMON_FACS            *acpi_gbl_FACS;
+
 /*
  * Since there may be multiple SSDTs and PSDTS, a single pointer is not
  * sufficient; Therefore, there isn't one!
@@ -99,7 +98,6 @@ extern      ACPI_TABLE_SUPPORT          acpi_gbl_acpi_table_data[NUM_ACPI_TABLES
  * (The table maps local handles to the real OS handles)
  */
 ACPI_EXTERN ACPI_MUTEX_INFO             acpi_gbl_acpi_mutex_info [NUM_MTX];
-extern      ACPI_INIT_DATA              acpi_gbl_acpi_init_data;
 
 
 /*****************************************************************************
@@ -164,6 +162,7 @@ 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[];
 
 
 /*****************************************************************************
@@ -198,23 +197,8 @@ ACPI_EXTERN ALLOCATION_INFO            *acpi_gbl_tail_alloc_ptr;
  ****************************************************************************/
 
 
-ACPI_EXTERN u32                         acpi_gbl_when_to_parse_methods;
 ACPI_EXTERN ACPI_WALK_LIST             *acpi_gbl_current_walk_list;
 
-/* Base of AML block, and pointer to current location in it */
-
-ACPI_EXTERN u8                         *acpi_gbl_Pcode_base;
-ACPI_EXTERN u8                         *acpi_gbl_Pcode;
-
-/*
- * Length of AML block, and remaining length of current package.
- */
-ACPI_EXTERN u32                         acpi_gbl_Pcode_block_len;
-ACPI_EXTERN u32                         acpi_gbl_Pcode_len;
-
-ACPI_EXTERN u32                         acpi_gbl_buf_seq;           /* Counts allocated Buffer descriptors */
-ACPI_EXTERN u32                         acpi_gbl_node_err;   /* Indicate if inc_error should be called */
-
 /*
  * Handle to the last method found - used during pass1 of load
  */
@@ -240,10 +224,6 @@ ACPI_EXTERN u8                          acpi_gbl_cm_single_step;
 
 ACPI_EXTERN ACPI_PARSE_OBJECT           *acpi_gbl_parsed_namespace_root;
 
-extern ACPI_OPCODE_INFO                 acpi_gbl_aml_op_info[];
-extern u8                               acpi_gbl_aml_op_info_index[256];
-
-
 /*****************************************************************************
  *
  * Hardware globals
@@ -290,9 +270,10 @@ ACPI_EXTERN u32                         acpi_gbl_event_count[NUM_FIXED_EVENTS];
  *
  ****************************************************************************/
 
+#ifdef ENABLE_DEBUGGER
 ACPI_EXTERN u8                          acpi_gbl_method_executing;
 ACPI_EXTERN u8                          acpi_gbl_db_terminate_threads;
-
+#endif
 
 /* Memory allocation metrics - Debug Only! */
 
index e537d6549d796239296334a9060d2bc7f49eb141..1a206e8d24d760fee30282708b68989bf62f74b3 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Name: achware.h -- hardware specific interfaces
- *       $Revision: 41 $
+ *       $Revision: 48 $
  *
  *****************************************************************************/
 
 
 
 ACPI_STATUS
-acpi_hw_initialize(
+acpi_hw_initialize (
        void);
 
 ACPI_STATUS
-acpi_hw_shutdown(
+acpi_hw_shutdown (
        void);
 
 ACPI_STATUS
-acpi_hw_initialize_system_info(
+acpi_hw_initialize_system_info (
        void);
 
 ACPI_STATUS
@@ -56,11 +56,37 @@ acpi_hw_get_mode_capabilities (
 
 /* Register I/O Prototypes */
 
+
 u32
-acpi_hw_register_access (
+acpi_hw_register_bit_access (
        NATIVE_UINT             read_write,
        u8                      use_lock,
-       u32                     register_id, ... /* DWORD Value */);
+       u32                     register_id,
+       ... /* DWORD Write Value */);
+
+u32
+acpi_hw_register_read (
+       u8                      use_lock,
+       u32                     register_id);
+
+void
+acpi_hw_register_write (
+       u8                      use_lock,
+       u32                     register_id,
+       u32                     value);
+
+u32
+acpi_hw_low_level_read (
+       u32                     width,
+       ACPI_GAS                *reg,
+       u32                     offset);
+
+void
+acpi_hw_low_level_write (
+       u32                     width,
+       u32                     value,
+       ACPI_GAS                *reg,
+       u32                     offset);
 
 void
 acpi_hw_clear_acpi_status (
@@ -125,6 +151,16 @@ ACPI_STATUS
 acpi_hw_get_cx_info (
        u32                     cx_states[]);
 
+ACPI_STATUS
+acpi_hw_get_cx_handler (
+       u32                     cx_state,
+       ACPI_C_STATE_HANDLER    *handler);
+
+ACPI_STATUS
+acpi_hw_set_cx_handler (
+       u32                     cx_state,
+       ACPI_C_STATE_HANDLER    handler);
+
 
 /* Throttling Prototypes */
 
@@ -165,5 +201,9 @@ u32
 acpi_hw_pmt_resolution (
        void);
 
+ACPI_STATUS
+acpi_get_timer (
+       u32                     *out_ticks);
+
 
 #endif /* __ACHWARE_H__ */
index 70bfc568209fd218ac664b8a65c68c5bece24090..c8c967492bcd8d767ff066b2f774ae90b415f80f 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Name: acinterp.h - Interpreter subcomponent prototypes and defines
- *       $Revision: 79 $
+ *       $Revision: 86 $
  *
  *****************************************************************************/
 
@@ -120,7 +120,9 @@ acpi_aml_access_named_field (
 
 ACPI_STATUS
 acpi_aml_exec_create_field (
-       u16                     opcode,
+       u8                      *aml_ptr,
+       u32                     aml_length,
+       ACPI_NAMESPACE_NODE     *node,
        ACPI_WALK_STATE         *walk_state);
 
 ACPI_STATUS
@@ -160,7 +162,7 @@ ACPI_STATUS
 acpi_aml_exec_create_region (
        u8                      *aml_ptr,
        u32                     acpi_aml_length,
-       u32                     region_space,
+       u                     region_space,
        ACPI_WALK_STATE         *walk_state);
 
 ACPI_STATUS
@@ -324,7 +326,8 @@ acpi_aml_resolve_to_value (
 
 ACPI_STATUS
 acpi_aml_resolve_node_to_value (
-       ACPI_NAMESPACE_NODE     **stack_ptr);
+       ACPI_NAMESPACE_NODE     **stack_ptr,
+       ACPI_WALK_STATE         *walk_state);
 
 ACPI_STATUS
 acpi_aml_resolve_object_to_value (
@@ -440,6 +443,11 @@ void
 acpi_aml_exit_interpreter (
        void);
 
+void
+acpi_aml_truncate_for32bit_table (
+       ACPI_OPERAND_OBJECT     *obj_desc,
+       ACPI_WALK_STATE         *walk_state);
+
 u8
 acpi_aml_validate_object_type (
        ACPI_OBJECT_TYPE        type);
@@ -452,13 +460,9 @@ ACPI_STATUS
 acpi_aml_release_global_lock (
        u8                      locked);
 
-u32
-acpi_aml_buf_seq (
-       void);
-
 u32
 acpi_aml_digits_needed (
-       u32                     value,
+       ACPI_INTEGER            value,
        u32                     base);
 
 ACPI_STATUS
@@ -466,6 +470,11 @@ acpi_aml_eisa_id_to_string (
        u32                     numeric_id,
        NATIVE_CHAR             *out_string);
 
+ACPI_STATUS
+acpi_aml_unsigned_integer_to_string (
+       ACPI_INTEGER            value,
+       NATIVE_CHAR             *out_string);
+
 ACPI_STATUS
 acpi_aml_build_copy_internal_package_object (
        ACPI_OPERAND_OBJECT     *source_obj,
@@ -480,7 +489,7 @@ acpi_aml_build_copy_internal_package_object (
 ACPI_STATUS
 acpi_aml_system_memory_space_handler (
        u32                     function,
-       u32                     address,
+       ACPI_PHYSICAL_ADDRESS   address,
        u32                     bit_width,
        u32                     *value,
        void                    *handler_context,
@@ -489,7 +498,7 @@ acpi_aml_system_memory_space_handler (
 ACPI_STATUS
 acpi_aml_system_io_space_handler (
        u32                     function,
-       u32                     address,
+       ACPI_PHYSICAL_ADDRESS   address,
        u32                     bit_width,
        u32                     *value,
        void                    *handler_context,
@@ -498,7 +507,7 @@ acpi_aml_system_io_space_handler (
 ACPI_STATUS
 acpi_aml_pci_config_space_handler (
        u32                     function,
-       u32                     address,
+       ACPI_PHYSICAL_ADDRESS   address,
        u32                     bit_width,
        u32                     *value,
        void                    *handler_context,
@@ -507,7 +516,7 @@ acpi_aml_pci_config_space_handler (
 ACPI_STATUS
 acpi_aml_embedded_controller_space_handler (
        u32                     function,
-       u32                     address,
+       ACPI_PHYSICAL_ADDRESS   address,
        u32                     bit_width,
        u32                     *value,
        void                    *handler_context,
@@ -516,7 +525,7 @@ acpi_aml_embedded_controller_space_handler (
 ACPI_STATUS
 acpi_aml_sm_bus_space_handler (
        u32                     function,
-       u32                     address,
+       ACPI_PHYSICAL_ADDRESS   address,
        u32                     bit_width,
        u32                     *value,
        void                    *handler_context,
diff --git a/drivers/acpi/include/aclinux.h b/drivers/acpi/include/aclinux.h
new file mode 100644 (file)
index 0000000..40446b0
--- /dev/null
@@ -0,0 +1,67 @@
+/******************************************************************************
+ *
+ * Name: aclinux.h - OS specific defines, etc.
+ *       $Revision: 4 $
+ *
+ *****************************************************************************/
+
+/*
+ *  Copyright (C) 2000 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/config.h>
+#include <linux/string.h>
+#include <linux/kernel.h>
+#include <linux/ctype.h>
+#include <asm/system.h>
+#include <asm/atomic.h>
+
+/* Linux uses GCC */
+
+#include "acgcc.h"
+
+#undef DEBUGGER_THREADING
+#define DEBUGGER_THREADING          DEBUGGER_SINGLE_THREADED
+
+/* Linux ia32 can't do int64 well */
+#ifndef _IA64
+#define ACPI_NO_INTEGER64_SUPPORT
+#endif
+
+#if 0
+
+/* Use native Linux string library */
+
+#define ACPI_USE_SYSTEM_CLIBRARY
+
+/* Special functions */
+
+#define strtoul             simple_strtoul
+
+/* Linux clib doesn't to strupr, but we do. */
+char *
+strupr(char *str);
+
+#endif /* 0 */
+
+#endif /* __ACLINUX_H__ */
index c2f052f60f02b544f447ff76ec72d4b40809d0c5..965d2ad117eedbbc0b94d5733dc4a9d5fbc252e0 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Name: aclocal.h - Internal data types used across the ACPI subsystem
- *       $Revision: 77 $
+ *       $Revision: 93 $
  *
  *****************************************************************************/
 
@@ -125,7 +125,7 @@ typedef u16                         ACPI_OWNER_ID;
 
 /* TBD: [Restructure] get rid of the need for this! */
 
-#define TABLE_ID_DSDT               (ACPI_OWNER_ID) 0xD1D1
+#define TABLE_ID_DSDT               (ACPI_OWNER_ID) 0x8000
 
 /*****************************************************************************
  *
@@ -157,8 +157,8 @@ typedef struct acpi_node
 {
        u8                      data_type;
        u8                      type;           /* Type associated with this name */
-       u32                     name;           /* ACPI Name, always 4 chars per ACPI spec */
        u16                     owner_id;
+       u32                     name;           /* ACPI Name, always 4 chars per ACPI spec */
 
 
        void                    *object;        /* Pointer to attached ACPI object (optional) */
@@ -175,9 +175,11 @@ typedef struct acpi_node
 
 /* Node flags */
 
-#define ANOBJ_AML_ATTACHMENT        0x1
-#define ANOBJ_END_OF_PEER_LIST      0x2
-
+#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            0x40
+#define ANOBJ_METHOD_LOCAL          0x80
 
 /*
  * ACPI Table Descriptor.  One per ACPI table
@@ -190,6 +192,7 @@ typedef struct acpi_table_desc
        ACPI_TABLE_HEADER       *pointer;
        void                    *base_pointer;
        u8                      *aml_pointer;
+       UINT64                  physical_address;
        u32                     aml_length;
        u32                     length;
        u32                     count;
@@ -399,6 +402,22 @@ typedef struct acpi_pscope_state
 } ACPI_PSCOPE_STATE;
 
 
+/*
+ * Result values - used to accumulate the results of nested
+ * AML arguments
+ */
+typedef struct acpi_result_values
+{
+       ACPI_STATE_COMMON
+       union acpi_operand_obj  *obj_desc [OBJ_NUM_OPERANDS];
+       u8                      num_results;
+       u8                      last_insert;
+
+} ACPI_RESULT_VALUES;
+
+
+/* Generic state is union of structs above */
+
 typedef union acpi_gen_state
 {
        ACPI_COMMON_STATE       common;
@@ -406,6 +425,7 @@ typedef union acpi_gen_state
        ACPI_UPDATE_STATE       update;
        ACPI_SCOPE_STATE        scope;
        ACPI_PSCOPE_STATE       parse_scope;
+       ACPI_RESULT_VALUES      results;
 
 } ACPI_GENERIC_STATE;
 
@@ -453,8 +473,7 @@ typedef struct acpi_opcode_info
        u32                     parse_args;     /* Grammar/Parse time arguments */
        u32                     runtime_args;   /* Interpret time arguments */
 
-       DEBUG_ONLY_MEMBERS (
-       NATIVE_CHAR             *name)          /* op name (debug only) */
+       DEBUG_ONLY_MEMBERS (NATIVE_CHAR *name)  /* op name (debug only) */
 
 } ACPI_OPCODE_INFO;
 
@@ -481,7 +500,7 @@ typedef union acpi_parse_val
        DEBUG_ONLY_MEMBERS (\
        NATIVE_CHAR             op_name[16])    /* op name (debug only) */\
                          /* NON-DEBUG members below: */\
-       ACPI_NAMESPACE_NODE     *node;/* for use by interpreter */\
+       ACPI_NAMESPACE_NODE     *node;          /* for use by interpreter */\
        ACPI_PARSE_VALUE        value;          /* Value or args associated with the opcode */\
 
 
@@ -543,8 +562,9 @@ typedef struct acpi_parse_state
 #define NEXT_OP_DOWNWARD    1
 #define NEXT_OP_UPWARD      2
 
-#define WALK_METHOD         1
 #define WALK_NON_METHOD     0
+#define WALK_METHOD         1
+#define WALK_METHOD_RESTART 2
 
 typedef struct acpi_walk_state
 {
@@ -553,17 +573,17 @@ typedef struct acpi_walk_state
        u8                      last_predicate;                     /* Result of last predicate */
        u8                      next_op_info;                       /* Info about Next_op */
        u8                      num_operands;                       /* Stack pointer for Operands[] array */
-       u8                      num_results;                        /* Stack pointer for Results[] array */
        u8                      current_result;                     /* */
 
        struct acpi_walk_state  *next;                              /* Next Walk_state in list */
-       ACPI_PARSE_OBJECT       *origin;                            /* Start of walk */
+       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 */
@@ -577,7 +597,6 @@ typedef struct acpi_walk_state
        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 */
-       union acpi_operand_obj  *results[OBJ_NUM_OPERANDS];         /* Accumulated results */
        struct acpi_node        arguments[MTH_NUM_ARGS];            /* Control method arguments */
        struct acpi_node        local_variables[MTH_NUM_LOCALS];    /* Control method locals */
        u32                     parse_flags;
@@ -607,13 +626,30 @@ typedef struct acpi_walk_list
 
 /* Info used by Acpi_ps_init_objects */
 
-typedef struct init_walk_info
+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
 {
-       u32                     method_count;
-       u32                     op_region_count;
+       u32                     flags;
+       u16                     device_count;
+       u16                     num_STA;
+       u16                     num_INI;
        ACPI_TABLE_DESC         *table_desc;
 
-} INIT_WALK_INFO;
+} ACPI_DEVICE_WALK_INFO;
 
 
 /* TBD: [Restructure] Merge with struct above */
@@ -625,6 +661,14 @@ typedef struct acpi_walk_info
 
 } ACPI_WALK_INFO;
 
+typedef struct acpi_get_devices_info
+{
+       WALK_CALLBACK           user_function;
+       void                    *context;
+       NATIVE_CHAR             *hid;
+
+} ACPI_GET_DEVICES_INFO;
+
 
 /*****************************************************************************
  *
@@ -633,16 +677,23 @@ typedef struct acpi_walk_info
  ****************************************************************************/
 
 
+/* PCI */
+
+#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
+
 
 /*
  * The #define's and enum below establish an abstract way of identifying what
@@ -650,66 +701,85 @@ typedef struct acpi_walk_info
  * values as they are used in switch statements and offset calculations.
  */
 
-#define REGISTER_BLOCK_MASK     0xFF00
-#define BIT_IN_REGISTER_MASK    0x00FF
-#define PM1_EVT                 0x0100
-#define PM1_CONTROL             0x0200
-#define PM2_CONTROL             0x0300
-#define PM_TIMER                0x0400
-#define PROCESSOR_BLOCK         0x0500
-#define GPE0_STS_BLOCK          0x0600
-#define GPE0_EN_BLOCK           0x0700
-#define GPE1_STS_BLOCK          0x0800
-#define GPE1_EN_BLOCK           0x0900
+#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    */
 
-enum
-{
-       /* PM1 status register ids */
-
-       TMR_STS =   (PM1_EVT        | 0x01),
-       BM_STS,
-       GBL_STS,
-       PWRBTN_STS,
-       SLPBTN_STS,
-       RTC_STS,
-       WAK_STS,
+#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)
 
-       /* PM1 enable register ids */
+/*
+ * Access Rule
+ *  To access a Register Bit:
+ *  -> Use Bit Name (= Register Block Id | Bit Id) defined in the enum.
+ *
+ *  To access a Register:
+ *  -> Use Register Id (= Register Block Id | Register Offset)
+ */
 
-       TMR_EN,
-       /* need to skip 1 enable number since there's no bus master enable register */
-       GBL_EN =    (PM1_EVT        | 0x0A),
-       PWRBTN_EN,
-       SLPBTN_EN,
-       RTC_EN,
 
-       /* PM1 control register ids */
+/*
+ * Register Block Id
+ */
+#define PM1_STS                     0x0100
+#define PM1_EN                      0x0200
+#define PM1_CONTROL                 0x0300
+#define PM2_CONTROL                 0x0400
+#define PM_TIMER                    0x0500
+#define PROCESSOR_BLOCK             0x0600
+#define GPE0_STS_BLOCK              0x0700
+#define GPE0_EN_BLOCK               0x0800
+#define GPE1_STS_BLOCK              0x0900
+#define GPE1_EN_BLOCK               0x0A00
+#define SMI_CMD_BLOCK               0x0B00
 
-       SCI_EN =    (PM1_CONTROL    | 0x01),
-       BM_RLD,
-       GBL_RLS,
-       SLP_TYPE_A,
-       SLP_TYPE_B,
-       SLP_EN,
+/*
+ * Address space bitmasks for mmio or io spaces
+ */
 
-       /* PM2 control register ids */
+#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
 
-       ARB_DIS =   (PM2_CONTROL    | 0x01),
+/*
+ * 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)
 
-       /* PM Timer register ids */
+#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)
 
-       TMR_VAL =   (PM_TIMER       | 0x01),
+#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)
 
-       GPE0_STS =  (GPE0_STS_BLOCK | 0x01),
-       GPE0_EN =   (GPE0_EN_BLOCK  | 0x01),
+#define ARB_DIS     (PM2_CONTROL | 0x01)
 
-       GPE1_STS =  (GPE1_STS_BLOCK | 0x01),
-       GPE1_EN =   (GPE0_EN_BLOCK  | 0x01),
+#define TMR_VAL     (PM_TIMER | 0x01)
 
-       /* Last register value is one less than LAST_REG */
+#define GPE0_STS    (GPE0_STS_BLOCK | 0x01)
+#define GPE0_EN     (GPE0_EN_BLOCK  | 0x01)
 
-       LAST_REG
-};
+#define GPE1_STS    (GPE1_STS_BLOCK | 0x01)
+#define GPE1_EN     (GPE1_EN_BLOCK  | 0x01)
 
 
 #define TMR_STS_MASK        0x0001
@@ -720,8 +790,9 @@ enum
 #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 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
@@ -736,6 +807,7 @@ enum
 #define SLP_EN_MASK         0x2000
 
 #define ARB_DIS_MASK        0x0001
+#define TMR_VAL_MASK        0xFFFFFFFF
 
 #define GPE0_STS_MASK
 #define GPE0_EN_MASK
@@ -747,16 +819,6 @@ enum
 #define ACPI_READ           1
 #define ACPI_WRITE          2
 
-#define LOW_BYTE            0x00FF
-#define ONE_BYTE            0x08
-
-#ifndef SET
-       #define SET             1
-#endif
-#ifndef CLEAR
-       #define CLEAR           0
-#endif
-
 
 /* Plug and play */
 
@@ -796,24 +858,11 @@ enum
 
 /* MUST HAVES */
 
-
-typedef enum
-{
-       DWORD_DEVICE_ID,
-       STRING_PTR_DEVICE_ID,
-       STRING_DEVICE_ID
-
-}   DEVICE_ID_TYPE;
+#define DEVICE_ID_LENGTH                0x09
 
 typedef struct
 {
-       DEVICE_ID_TYPE      type;
-       union
-       {
-               u32                 number;
-               NATIVE_CHAR         *string_ptr;
-               NATIVE_CHAR         buffer[9];
-       } data;
+               NATIVE_CHAR         buffer[DEVICE_ID_LENGTH];
 
 } DEVICE_ID;
 
index a1e58d1d3404094d3faee2c1e78dc7882a1367a8..c1fcd376f9bf8242b21f4a4143786cf0595e0fc3 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Name: acmacros.h - C macros for the entire subsystem.
- *       $Revision: 48 $
+ *       $Revision: 56 $
  *
  *****************************************************************************/
 
 #define MUL_16(a)                       _MUL(a,4)
 #define MOD_16(a)                       _MOD(a,16)
 
+/*
+ * Divide and Modulo
+ */
+#define ACPI_DIVIDE(n,d)                ((n) / (d))
+#define ACPI_MODULO(n,d)                ((n) % (d))
 
 /*
  * Rounding macros (Power of two boundaries only)
 #define ROUND_UP(value,boundary)        (((value) + ((boundary)-1)) & (~((boundary)-1)))
 
 #define ROUND_DOWN_TO_32_BITS(a)        ROUND_DOWN(a,4)
+#define ROUND_DOWN_TO_64_BITS(a)        ROUND_DOWN(a,8)
 #define ROUND_DOWN_TO_NATIVE_WORD(a)    ROUND_DOWN(a,ALIGNED_ADDRESS_BOUNDARY)
 
 #define ROUND_UP_TO_32_bITS(a)          ROUND_UP(a,4)
+#define ROUND_UP_TO_64_bITS(a)          ROUND_UP(a,8)
 #define ROUND_UP_TO_NATIVE_WORD(a)      ROUND_UP(a,ALIGNED_ADDRESS_BOUNDARY)
 
+#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_UP_TO_1_k(a)              (((a) + 1023) >> 10)
 
 #ifdef DEBUG_ASSERT
 #undef DEBUG_ASSERT
 #endif
 
 
+/* Macros for GAS addressing */
+
+#define ACPI_PCI_DEVICE_MASK            (UINT64) 0x0000FFFF00000000
+#define ACPI_PCI_FUNCTION_MASK          (UINT64) 0x00000000FFFF0000
+#define ACPI_PCI_REGISTER_MASK          (UINT64) 0x000000000000FFFF
+
+#define ACPI_PCI_FUNCTION(a)            (u32) ((((a) & ACPI_PCI_FUNCTION_MASK) >> 16))
+#define ACPI_PCI_DEVICE(a)              (u32) ((((a) & ACPI_PCI_DEVICE_MASK) >> 32))
+#define ACPI_PCI_REGISTER(a)            (u32) (((a) & ACPI_PCI_REGISTER_MASK))
+#define ACPI_PCI_DEVFUN(a)              (u32) ((ACPI_PCI_DEVICE(a) << 16) | ACPI_PCI_FUNCTION(a))
+
+
 /*
  * An ACPI_HANDLE (which is actually an ACPI_NAMESPACE_NODE *) can appear in some contexts,
  * such as on ap_obj_stack, where a pointer to an ACPI_OPERAND_OBJECT can also
 #define ARGP_LIST5(a,b,c,d,e)           (ARG_1(a)|ARG_2(b)|ARG_3(c)|ARG_4(d)|ARG_5(e))
 #define ARGP_LIST6(a,b,c,d,e,f)         (ARG_1(a)|ARG_2(b)|ARG_3(c)|ARG_4(d)|ARG_5(e)|ARG_6(f))
 
-#define GET_CURRENT_ARG_TYPE(list)      (list & 0x1F)
-#define INCREMENT_ARG_LIST(list)        (list >>= ARG_TYPE_WIDTH)
+#define GET_CURRENT_ARG_TYPE(list)      (list & ((u32) 0x1F))
+#define INCREMENT_ARG_LIST(list)        (list >>= ((u32) ARG_TYPE_WIDTH))
 
 
 /*
  * Reporting macros that are never compiled out
  */
 
+#define PARAM_LIST(pl)                  pl
+
 /*
  * Error reporting.  These versions add callers module and line#.  Since
  * _THIS_MODULE gets compiled out when ACPI_DEBUG isn't defined, only
 
 #ifdef ACPI_DEBUG
 
-#define REPORT_INFO(a)                  _report_info(_THIS_MODULE,__LINE__,_COMPONENT,a)
-#define REPORT_ERROR(a)                 _report_error(_THIS_MODULE,__LINE__,_COMPONENT,a)
-#define REPORT_WARNING(a)               _report_warning(_THIS_MODULE,__LINE__,_COMPONENT,a)
+#define REPORT_INFO(fp)                 {_report_info(_THIS_MODULE,__LINE__,_COMPONENT); \
+                                                                         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); \
+                                                                                       debug_print_raw PARAM_LIST(fp);}
 
 #else
 
-#define REPORT_INFO(a)                  _report_info("",__LINE__,_COMPONENT,a)
-#define REPORT_ERROR(a)                 _report_error("",__LINE__,_COMPONENT,a)
-#define REPORT_WARNING(a)               _report_warning("",__LINE__,_COMPONENT,a)
+#define REPORT_INFO(fp)                 {_report_info("ACPI",__LINE__,_COMPONENT); \
+                                                                                       debug_print_raw PARAM_LIST(fp);}
+#define REPORT_ERROR(fp)                {_report_error("ACPI",__LINE__,_COMPONENT); \
+                                                                                       debug_print_raw PARAM_LIST(fp);}
+#define REPORT_WARNING(fp)              {_report_warning("ACPI",__LINE__,_COMPONENT); \
+                                                                                       debug_print_raw PARAM_LIST(fp);}
 
 #endif
 
 /* Error reporting.  These versions pass thru the module and line# */
 
-#define _REPORT_INFO(a,b,c,d)           _report_info(a,b,c,d)
-#define _REPORT_ERROR(a,b,c,d)          _report_error(a,b,c,d)
-#define _REPORT_WARNING(a,b,c,d)        _report_warning(a,b,c,d)
+#define _REPORT_INFO(a,b,c,fp)          {_report_info(a,b,c); \
+                                                                                       debug_print_raw PARAM_LIST(fp);}
+#define _REPORT_ERROR(a,b,c,fp)         {_report_error(a,b,c); \
+                                                                                       debug_print_raw PARAM_LIST(fp);}
+#define _REPORT_WARNING(a,b,c,fp)       {_report_warning(a,b,c); \
+                                                                                       debug_print_raw PARAM_LIST(fp);}
 
 /* Buffer dump macros */
 
  */
 
 #define FUNCTION_TRACE(a)               char * _proc_name = a;\
-                                                                        function_trace(_THIS_MODULE,__LINE__,_COMPONENT,a)
+                                                                               function_trace(_THIS_MODULE,__LINE__,_COMPONENT,a)
 #define FUNCTION_TRACE_PTR(a,b)         char * _proc_name = a;\
                                                                                function_trace_ptr(_THIS_MODULE,__LINE__,_COMPONENT,a,(void *)b)
 #define FUNCTION_TRACE_U32(a,b)         char * _proc_name = a;\
 
 /* Conditional execution */
 
-#define DEBUG_EXEC(a)                   a;
+#define DEBUG_EXEC(a)                   a
 #define NORMAL_EXEC(a)
 
 #define DEBUG_DEFINE(a)                 a;
  *
  */
 
-#define PARAM_LIST(pl)                  pl
-
 #define TEST_DEBUG_SWITCH(lvl)          if (((lvl) & acpi_dbg_level) && (_COMPONENT & acpi_dbg_layer))
 
 #define DEBUG_PRINT(lvl,fp)             TEST_DEBUG_SWITCH(lvl) {\
  * DEBUG_PRINT stuff (set by ACPI_DEBUG) is on, or not.
  */
 #ifdef ENABLE_DEBUGGER
-#define DEBUGGER_EXEC(a)                a;
+#define DEBUGGER_EXEC(a)                a
 #else
 #define DEBUGGER_EXEC(a)
 #endif
 #undef DEBUG_ONLY_MEMBERS
 #define DEBUG_ONLY_MEMBERS(a)
 #undef OP_INFO_ENTRY
-#define OP_INFO_ENTRY(opcode,flags,name,Pargs,Iargs)     {opcode,flags,Pargs,Iargs}
+#define OP_INFO_ENTRY(flags,name,Pargs,Iargs)     {flags,Pargs,Iargs}
 #endif
 
 
 
 #endif
 
+
 #endif /* ACMACROS_H */
index 696a554ce9a080c7583e067119cf63ea75d909f6..55006650bfca7baf57cb95bb76a294e5de4331f9 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Name: acnamesp.h - Namespace subcomponent prototypes and defines
- *       $Revision: 94 $
+ *       $Revision: 98 $
  *
  *****************************************************************************/
 
 #define NS_WALK_NO_UNLOCK       FALSE
 
 
+ACPI_STATUS
+acpi_ns_load_namespace (
+       void);
+
+ACPI_STATUS
+acpi_ns_initialize_objects (
+       void);
+
+ACPI_STATUS
+acpi_ns_initialize_devices (
+       u32                     flags);
+
+
+/* Namespace init - nsxfinit */
+
+ACPI_STATUS
+acpi_ns_init_one_device (
+       ACPI_HANDLE             obj_handle,
+       u32                     nesting_level,
+       void                    *context,
+       void                    **return_value);
+
+ACPI_STATUS
+acpi_ns_init_one_object (
+       ACPI_HANDLE             obj_handle,
+       u32                     level,
+       void                    *context,
+       void                    **return_value);
+
+
 ACPI_STATUS
 acpi_ns_walk_namespace (
        OBJECT_TYPE_INTERNAL    type,
@@ -86,6 +116,11 @@ acpi_ns_delete_namespace_by_owner (
 
 /* Namespace loading - nsload */
 
+ACPI_STATUS
+acpi_ns_one_complete_parse (
+       u32                     pass_number,
+       ACPI_TABLE_DESC         *table_desc);
+
 ACPI_STATUS
 acpi_ns_parse_table (
        ACPI_TABLE_DESC         *table_desc,
@@ -320,10 +355,6 @@ acpi_ns_search_node (
        OBJECT_TYPE_INTERNAL    type,
        ACPI_NAMESPACE_NODE     **ret_node);
 
-ACPI_NAMESPACE_NODE *
-acpi_ns_create_node (
-       u32                     acpi_name);
-
 void
 acpi_ns_install_node (
        ACPI_WALK_STATE         *walk_state,
index aeb8f201a28a04c8b543ecfd5b38e9fd31dd39dd..c801ff117bd9f8031d83073434c201bf3d513879 100644 (file)
@@ -2,7 +2,7 @@
 /******************************************************************************
  *
  * Name: acobject.h - Definition of ACPI_OPERAND_OBJECT  (Internal object only)
- *       $Revision: 71 $
+ *       $Revision: 75 $
  *
  *****************************************************************************/
 
@@ -58,7 +58,7 @@
  */
 
 
-#define ACPI_OBJECT_COMMON_HEADER           /* Two 32-bit fields, one pointer, 8-bit flag */\
+#define ACPI_OBJECT_COMMON_HEADER           /* 32-bits plus 8-bit flag */\
        u8                          data_type;          /* To differentiate various internal objs */\
        u8                          type;               /* ACPI_OBJECT_TYPE */\
        u16                         reference_count;    /* For object deletion management */\
@@ -74,7 +74,7 @@
 /*
  * Common bitfield for the field objects
  */
-#define ACPI_COMMON_FIELD_INFO              /* Three 32-bit values */\
+#define ACPI_COMMON_FIELD_INFO              /* Three 32-bit values plus 8*/\
        u8                          granularity;\
        u16                         length; \
        u32                         offset;             /* Byte offset within containing object */\
@@ -111,7 +111,7 @@ typedef struct /* NUMBER - has value */
 {
        ACPI_OBJECT_COMMON_HEADER
 
-       u32                         value;
+       ACPI_INTEGER                value;
 
 } ACPI_OBJECT_NUMBER;
 
@@ -155,8 +155,9 @@ typedef struct /* FIELD UNIT */
        ACPI_OBJECT_COMMON_HEADER
 
        ACPI_COMMON_FIELD_INFO
-       u32                         sequence;           /* Container's sequence number */
 
+       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;
@@ -218,16 +219,10 @@ typedef struct /* REGION */
 
        u8                          space_id;
        u32                         length;
-       u32                         address;
-       void                        *region_context;    /* Region Specific data (Handler->Context
-                         optional things like PCI _ADR) */
-
-       /* TBD: [Restructure] This field can go away when Pass3 is implemented */
-       union acpi_operand_obj      *method;            /* Associated control method */
-
+       ACPI_PHYSICAL_ADDRESS       address;
+       union acpi_operand_obj      *extra;             /* Pointer to executable AML (in region definition) */
 
        union acpi_operand_obj      *addr_handler;      /* Handler for system notifies */
-       ACPI_NAMESPACE_NODE         *REGmethod;         /* _REG method for this region (if any) */
        ACPI_NAMESPACE_NODE         *node;              /* containing object */
        union acpi_operand_obj      *next;
 
@@ -372,6 +367,27 @@ typedef struct /* Reference - Local object type */
 } ACPI_OBJECT_REFERENCE;
 
 
+/*
+ * Extra object is used as additional storage for types that
+ * have AML code in their declarations (Term_args) that must be
+ * evaluated at run time.
+ *
+ * Currently: Region and Field_unit types
+ */
+
+typedef struct /* EXTRA */
+{
+       ACPI_OBJECT_COMMON_HEADER
+       u8                          byte_fill1;
+       u16                         word_fill1;
+       u32                         pcode_length;
+       u8                          *pcode;
+       ACPI_NAMESPACE_NODE         *method_REG;        /* _REG method for this region (if any) */
+       void                        *region_context;    /* Region-specific data */
+
+} ACPI_OBJECT_EXTRA;
+
+
 /******************************************************************************
  *
  * ACPI_OPERAND_OBJECT  Descriptor - a giant union of all of the above
@@ -401,6 +417,7 @@ typedef union acpi_operand_obj
        ACPI_OBJECT_REFERENCE       reference;
        ACPI_OBJECT_NOTIFY_HANDLER  notify_handler;
        ACPI_OBJECT_ADDR_HANDLER    addr_handler;
+       ACPI_OBJECT_EXTRA           extra;
 
 } ACPI_OPERAND_OBJECT;
 
index c9983c8f7461cc67c2fb55944cecb3c51fb6f7e2..664a5f8a81ab20c771bc06fdadfb63eca5e2f062 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Name: acoutput.h -- debug output
- *       $Revision: 63 $
+ *       $Revision: 66 $
  *
  *****************************************************************************/
 
@@ -60,6 +60,8 @@
 #define DEBUGGER                    0x00100000
 #define ALL_COMPONENTS              0x001FFFFF
 
+#define COMPONENT_DEFAULT           (ALL_COMPONENTS)
+
 
 /* Exception level -- used in the global "Debug_level" */
 
 #define VERBOSE_TABLES              0x40000000
 #define VERBOSE_EVENTS              0x80000000
 
-#define VERBOSE_ALL                 0x70000000
+#define VERBOSE_ALL                 0xF0000000
 
 
 /* Defaults for Debug_level, debug and normal */
 
-#define DEBUG_DEFAULT               (ACPI_OK | ACPI_WARN | ACPI_ERROR | ACPI_DEBUG_OBJECT | TRACE_TABLES | TRACE_IO)
+#define DEBUG_DEFAULT               (ACPI_OK | ACPI_WARN | ACPI_ERROR | ACPI_DEBUG_OBJECT)
 #define NORMAL_DEFAULT              (ACPI_OK | ACPI_WARN | ACPI_ERROR | ACPI_DEBUG_OBJECT)
 #define DEBUG_ALL                   (VERBOSE_AML_DISASSEMBLE | TRACE_ALL | ACPI_ALL)
 
index 0f3271d6f4c8fc4e5f8dd953da053462ab5d1560..d657749da7c196bd455e55bf0551567965a7c013 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: acparser.h - AML Parser subcomponent prototypes and defines
- *       $Revision: 46 $
+ *       $Revision: 47 $
  *
  *****************************************************************************/
 
@@ -188,7 +188,8 @@ void
 acpi_ps_pop_scope (
        ACPI_PARSE_STATE        *parser_state,
        ACPI_PARSE_OBJECT       **op,
-       u32                     *arg_list);
+       u32                     *arg_list,
+       u32                     *arg_count);
 
 ACPI_STATUS
 acpi_ps_push_scope (
index d589ae93d57eea2aa652220168910cf2b6f8f632..47b1f28e522178f10330122ab0172d22265ec2db 100644 (file)
@@ -112,7 +112,7 @@ acpi_os_free (
 
 ACPI_STATUS
 acpi_os_map_memory (
-       void                    *physical_address,
+       ACPI_PHYSICAL_ADDRESS   physical_address,
        u32                     length,
        void                    **logical_address);
 
@@ -189,6 +189,37 @@ acpi_os_out32 (
        ACPI_IO_ADDRESS         out_port,
        u32                     value);
 
+/*
+ * Platform/Hardware independent physical memory interfaces
+ */
+
+u8
+acpi_os_mem_in8 (
+       ACPI_PHYSICAL_ADDRESS   in_addr);
+
+u16
+acpi_os_mem_in16 (
+       ACPI_PHYSICAL_ADDRESS   in_addr);
+
+u32
+acpi_os_mem_in32 (
+       ACPI_PHYSICAL_ADDRESS   in_addr);
+
+void
+acpi_os_mem_out8 (
+       ACPI_PHYSICAL_ADDRESS   out_addr,
+       u8                      value);
+
+void
+acpi_os_mem_out16 (
+       ACPI_PHYSICAL_ADDRESS   out_addr,
+       u16                     value);
+
+void
+acpi_os_mem_out32 (
+       ACPI_PHYSICAL_ADDRESS   out_addr,
+       u32                     value);
+
 
 /*
  * Standard access to PCI configuration space
index ca2afbae5d38aa583bdcaba9f4c5e7357e5ff9cb..96b013b6161248f4a85854feef593a582651f19a 100644 (file)
  */
 
 ACPI_STATUS
-acpi_initialize (
-       ACPI_INIT_DATA          *init_data);
+acpi_initialize_subsystem (
+       void);
+
+ACPI_STATUS
+acpi_enable_subsystem (
+       u32                     flags);
 
 ACPI_STATUS
 acpi_terminate (
@@ -65,8 +69,12 @@ acpi_format_exception (
  */
 
 ACPI_STATUS
-acpi_load_firmware_tables (
-       void);
+acpi_find_root_pointer (
+       ACPI_PHYSICAL_ADDRESS   *rsdp_physical_address);
+
+ACPI_STATUS
+acpi_load_tables (
+       ACPI_PHYSICAL_ADDRESS   rsdp_physical_address);
 
 ACPI_STATUS
 acpi_load_table (
@@ -93,10 +101,6 @@ acpi_get_table (
  * Namespace and name interfaces
  */
 
-ACPI_STATUS
-acpi_load_namespace (
-       void);
-
 ACPI_STATUS
 acpi_walk_namespace (
        ACPI_OBJECT_TYPE        type,
@@ -106,6 +110,13 @@ acpi_walk_namespace (
        void                    *context,
        void *                  *return_value);
 
+ACPI_STATUS
+acpi_get_devices (
+       NATIVE_CHAR             *HID,
+       WALK_CALLBACK           user_function,
+       void                    *context,
+       void                    **return_value);
+
 ACPI_STATUS
 acpi_get_name (
        ACPI_HANDLE             handle,
@@ -202,6 +213,14 @@ acpi_install_gpe_handler (
        GPE_HANDLER             handler,
        void                    *context);
 
+ACPI_STATUS
+acpi_acquire_global_lock (
+       void);
+
+ACPI_STATUS
+acpi_release_global_lock (
+       void);
+
 ACPI_STATUS
 acpi_remove_gpe_handler (
        u32                     gpe_number,
@@ -259,11 +278,11 @@ acpi_get_irq_routing_table (
 
 ACPI_STATUS
 acpi_set_firmware_waking_vector (
-       void                    *physical_address);
+       ACPI_PHYSICAL_ADDRESS   physical_address);
 
 ACPI_STATUS
 acpi_get_firmware_waking_vector (
-       void                    **physical_address);
+       ACPI_PHYSICAL_ADDRESS   *physical_address);
 
 ACPI_STATUS
 acpi_get_processor_throttling_info (
index abc83c7780299a99cf97d98a8e83056400ca9d61..4dd724517b9cf558c80e8e07183b02a541a49bd5 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Name: actables.h - ACPI table management
- *       $Revision: 20 $
+ *       $Revision: 27 $
  *
  *****************************************************************************/
 
@@ -37,19 +37,26 @@ acpi_tb_handle_to_object (
        u16                     table_id,
        ACPI_TABLE_DESC         **table_desc);
 
-
 /*
- * Acpi_tbfac - FACP, FACS utilities
+ * tbconvrt - Table conversion routines
  */
 
 ACPI_STATUS
-acpi_tb_get_table_facs (
-       ACPI_TABLE_HEADER       *buffer_ptr,
+acpi_tb_convert_to_xsdt (
+       ACPI_TABLE_DESC         *table_info,
+       u32                     *number_of_tables);
+
+ACPI_STATUS
+acpi_tb_convert_table_fadt (
+       void);
+
+ACPI_STATUS
+acpi_tb_build_common_facs (
        ACPI_TABLE_DESC         *table_info);
 
 
 /*
- * Acpi_tbget - Table "get" routines
+ * tbget - Table "get" routines
  */
 
 ACPI_STATUS
@@ -60,13 +67,22 @@ acpi_tb_get_table_ptr (
 
 ACPI_STATUS
 acpi_tb_get_table (
-       void                    *physical_address,
+       ACPI_PHYSICAL_ADDRESS   physical_address,
+       ACPI_TABLE_HEADER       *buffer_ptr,
+       ACPI_TABLE_DESC         *table_info);
+
+ACPI_STATUS
+acpi_tb_verify_rsdp (
+       ACPI_PHYSICAL_ADDRESS   RSDP_physical_address);
+
+ACPI_STATUS
+acpi_tb_get_table_facs (
        ACPI_TABLE_HEADER       *buffer_ptr,
        ACPI_TABLE_DESC         *table_info);
 
 
 /*
- * Acpi_tbgetall - Get all firmware ACPI tables
+ * tbgetall - Get all firmware ACPI tables
  */
 
 ACPI_STATUS
@@ -76,7 +92,7 @@ acpi_tb_get_all_tables (
 
 
 /*
- * Acpi_tbinstall - Table installation
+ * tbinstall - Table installation
  */
 
 ACPI_STATUS
@@ -96,7 +112,7 @@ acpi_tb_init_table_descriptor (
 
 
 /*
- * Acpi_tbremove - Table removal and deletion
+ * tbremove - Table removal and deletion
  */
 
 void
@@ -107,17 +123,21 @@ void
 acpi_tb_delete_acpi_table (
        ACPI_TABLE_TYPE         type);
 
-ACPI_TABLE_DESC *
+void
 acpi_tb_delete_single_table (
        ACPI_TABLE_DESC         *table_desc);
 
+ACPI_TABLE_DESC *
+acpi_tb_uninstall_table (
+       ACPI_TABLE_DESC         *table_desc);
+
 void
 acpi_tb_free_acpi_tables_of_type (
        ACPI_TABLE_DESC         *table_info);
 
 
 /*
- * Acpi_tbrsd - RSDP, RSDT utilities
+ * tbrsd - RSDP, RSDT utilities
  */
 
 ACPI_STATUS
@@ -135,7 +155,7 @@ acpi_tb_find_rsdp (
 
 
 /*
- * Acpi_tbutils - common table utilities
+ * tbutils - common table utilities
  */
 
 u8
@@ -144,7 +164,7 @@ acpi_tb_system_table_pointer (
 
 ACPI_STATUS
 acpi_tb_map_acpi_table (
-       void                    *physical_address,
+       ACPI_PHYSICAL_ADDRESS   physical_address,
        u32                     *size,
        void                    **logical_address);
 
index fd1f6615af2e8b8858542e2ce2a987ba9821b9c3..34631e82050922a25e4b910268c9ef287241c91c 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Name: actbl.h - Table data structures defined in ACPI specification
- *       $Revision: 34 $
+ *       $Revision: 43 $
  *
  *****************************************************************************/
 
  *  Values for description table header signatures
  */
 
-#define RSDP_SIG            "RSD PTR "              /* RSDT Pointer signature */
-#define APIC_SIG            "APIC"                  /* Multiple APIC Description Table */
-#define DSDT_SIG            "DSDT"                  /* Differentiated System Description Table */
-#define FACP_SIG            "FACP"                  /* Fixed ACPI Description Table */
-#define FACS_SIG            "FACS"                  /* Firmware ACPI Control Structure */
-#define PSDT_SIG            "PSDT"                  /* Persistent System Description Table */
-#define RSDT_SIG            "RSDT"                  /* Root System Description Table */
-#define SSDT_SIG            "SSDT"                  /* Secondary System Description Table */
-#define SBST_SIG            "SBST"                  /* Smart Battery Specification Table */
-#define BOOT_SIG            "BOOT"                  /* Boot table */
+#define RSDP_NAME               "RSDP"
+#define RSDP_SIG                "RSD PTR "  /* RSDT Pointer signature */
+#define APIC_SIG                "APIC"      /* Multiple APIC Description Table */
+#define DSDT_SIG                "DSDT"      /* Differentiated System Description Table */
+#define FADT_SIG                "FACP"      /* Fixed ACPI Description Table */
+#define FACS_SIG                "FACS"      /* Firmware ACPI Control Structure */
+#define PSDT_SIG                "PSDT"      /* Persistent System Description Table */
+#define RSDT_SIG                "RSDT"      /* Root System Description Table */
+#define XSDT_SIG                "XSDT"      /* Extended  System Description Table */
+#define SSDT_SIG                "SSDT"      /* Secondary System Description Table */
+#define SBST_SIG                "SBST"      /* Smart Battery Specification Table */
+#define SPIC_SIG                "SPIC"      /* iosapic table */
+#define BOOT_SIG                "BOOT"      /* Boot table */
 
 
-#define GL_OWNED            0x02                    /* Ownership of global lock is bit 1 */
+#define GL_OWNED                0x02        /* Ownership of global lock is bit 1 */
 
 /* values of Mapic.Model */
 
-#define DUAL_PIC            0
-#define MULTIPLE_APIC       1
+#define DUAL_PIC                0
+#define MULTIPLE_APIC           1
 
 /* values of Type in APIC_HEADER */
 
-#define APIC_PROC           0
-#define APIC_IO             1
+#define APIC_PROC               0
+#define APIC_IO                 1
 
 
+/*
+ * Common table types.  The base code can remain
+ * constant if the underlying tables are changed
+ */
+#define RSDT_DESCRIPTOR         RSDT_DESCRIPTOR_REV2
+#define XSDT_DESCRIPTOR         XSDT_DESCRIPTOR_REV2
+#define FACS_DESCRIPTOR         FACS_DESCRIPTOR_REV2
+#define FADT_DESCRIPTOR         FADT_DESCRIPTOR_REV2
+
+
+#pragma pack(1)
+
 /*
  * Architecture-independent tables
  * The architecture dependent tables are in separate files
@@ -66,10 +81,14 @@ typedef struct  /* Root System Descriptor Pointer */
        NATIVE_CHAR             signature [8];          /* contains "RSD PTR " */
        u8                      checksum;               /* to make sum of struct == 0 */
        NATIVE_CHAR             oem_id [6];             /* OEM identification */
-       u8                      reserved;               /* reserved - must be zero */
-       u32                     rsdt_physical_address;  /* physical address of RSDT */
+       u8                      revision;               /* Must be 0 for 1.0, 2 for 2.0 */
+       u32                     rsdt_physical_address;  /* 32-bit physical address of RSDT */
+       u32                     length;                 /* XSDT Length in bytes including hdr */
+       UINT64                  xsdt_physical_address;  /* 64-bit physical address of XSDT */
+       u8                      extended_checksum;      /* Checksum of entire table */
+       NATIVE_CHAR             reserved [3];           /* reserved field must be 0 */
 
-} ROOT_SYSTEM_DESCRIPTOR_POINTER;
+} RSDP_DESCRIPTOR;
 
 
 typedef struct  /* ACPI common table header */
@@ -88,6 +107,15 @@ typedef struct  /* ACPI common table header */
 } ACPI_TABLE_HEADER;
 
 
+typedef struct  /* Common FACS for internal use */
+{
+       u32                     *global_lock;
+       UINT64                  *firmware_waking_vector;
+       u8                      vector_width;
+
+} ACPI_COMMON_FACS;
+
+
 typedef struct  /* APIC Table */
 {
        ACPI_TABLE_HEADER       header;                 /* table header */
@@ -146,6 +174,9 @@ typedef struct  /* Smart Battery Description Table */
 } SMART_BATTERY_DESCRIPTION_TABLE;
 
 
+#pragma pack()
+
+
 /*
  * ACPI Table information.  We save the table address, length,
  * and type of memory allocation (mapped or allocated) for each
@@ -175,16 +206,12 @@ typedef struct _acpi_table_support
 
 } ACPI_TABLE_SUPPORT;
 
-
 /*
  * Get the architecture-specific tables
  */
 
-#ifdef IA64
-#include "actbl64.h"
-#else
-#include "actbl32.h"
-#endif
-
+#include "actbl1.h"   /* Acpi 1.0 table defintions */
+#include "actbl71.h"  /* Acpi 0.71 IA-64 Extension table defintions */
+#include "actbl2.h"   /* Acpi 2.0 table definitions */
 
 #endif /* __ACTBL_H__ */
diff --git a/drivers/acpi/include/actbl1.h b/drivers/acpi/include/actbl1.h
new file mode 100644 (file)
index 0000000..019ba16
--- /dev/null
@@ -0,0 +1,123 @@
+/******************************************************************************
+ *
+ * Name: actbl1.h - ACPI 1.0 tables
+ *       $Revision: 15 $
+ *
+ *****************************************************************************/
+
+/*
+ *  Copyright (C) 2000 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 __ACTBL1_H__
+#define __ACTBL1_H__
+
+#pragma pack(1)
+
+/*************************************/
+/* ACPI Specification Rev 1.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 */
+                        /* ACPI tables */
+} RSDT_DESCRIPTOR_REV1;
+
+
+/***************************************/
+/* ACPI Specification Rev 1.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; /* ACPI OS waking vector */
+       u32                     global_lock;            /* Global Lock */
+       u32                     S4_bios_f       : 1;    /* Indicates if S4_bIOS support is present */
+       u32                     reserved1       : 31;   /* must be 0 */
+       u8                      resverved3 [40];        /* reserved - must be zero */
+
+} FACS_DESCRIPTOR_REV1;
+
+
+/************************************/
+/* ACPI Specification Rev 1.0 for   */
+/* the Fixed ACPI Description Table */
+/************************************/
+typedef struct
+{
+       ACPI_TABLE_HEADER       header;                 /* table header */
+       u32                     firmware_ctrl;          /* Physical address of FACS */
+       u32                     dsdt;                   /* Physical address of DSDT */
+       u8                      model;                  /* System Interrupt Model */
+       u8                      reserved1;              /* reserved */
+       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                      reserved2;              /* reserved - must be zero */
+       u32                     pm1a_evt_blk;           /* Port address of Power Mgt 1a Acpi_event Reg Blk */
+       u32                     pm1b_evt_blk;           /* Port address of Power Mgt 1b Acpi_event Reg Blk */
+       u32                     pm1a_cnt_blk;           /* Port address of Power Mgt 1a Control Reg Blk */
+       u32                     pm1b_cnt_blk;           /* Port address of Power Mgt 1b Control Reg Blk */
+       u32                     pm2_cnt_blk;            /* Port address of Power Mgt 2 Control Reg Blk */
+       u32                     pm_tmr_blk;             /* Port address of Power Mgt Timer Ctrl Reg Blk */
+       u32                     gpe0blk;                /* Port addr of General Purpose Acpi_event 0 Reg Blk */
+       u32                     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                      reserved3;              /* reserved */
+       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;             /* Size of area read to flush caches */
+       u16                     flush_stride;           /* Stride used in flushing caches */
+       u8                      duty_offset;            /* bit location of duty cycle field in p_cnt reg */
+       u8                      duty_width;             /* bit width of duty cycle field in p_cnt reg */
+       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 */
+       u8                      reserved4;              /* reserved */
+       u8                      reserved4a;             /* reserved */
+       u8                      reserved4b;             /* 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                     reserved5       : 23;   /* reserved - must be zero */
+
+}  FADT_DESCRIPTOR_REV1;
+
+#pragma pack()
+
+#endif /* __ACTBL1_H__ */
+
+
diff --git a/drivers/acpi/include/actbl2.h b/drivers/acpi/include/actbl2.h
new file mode 100644 (file)
index 0000000..e3ccf21
--- /dev/null
@@ -0,0 +1,189 @@
+/******************************************************************************
+ *
+ * Name: actbl2.h - ACPI Specification Revision 2.0 Tables
+ *       $Revision: 19 $
+ *
+ *****************************************************************************/
+
+/*
+ *  Copyright (C) 2000 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 __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
+
+#define FADT2_REVISION_ID     3
+
+#pragma pack(1)
+
+/*************************************/
+/* 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 */
+} RSDT_DESCRIPTOR_REV2;
+
+
+/********************************************/
+/* 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 */
+} XSDT_DESCRIPTOR_REV2;
+
+/***************************************/
+/* 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 */
+
+} FACS_DESCRIPTOR_REV2;
+
+
+/***************************************/
+/* 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;
+
+
+/************************************/
+/* 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\92s duty cycle index in processor's P_CNT reg*/
+       u8                  duty_width;        /* Processor\92s 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 */
+
+}  FADT_DESCRIPTOR_REV2;
+
+
+#pragma pack()
+
+#endif /* __ACTBL2_H__ */
+
diff --git a/drivers/acpi/include/actbl32.h b/drivers/acpi/include/actbl32.h
deleted file mode 100644 (file)
index 3c60229..0000000
+++ /dev/null
@@ -1,115 +0,0 @@
-/******************************************************************************
- *
- * Name: actbl32.h - ACPI tables specific to IA32
- *       $Revision: 11 $
- *
- *****************************************************************************/
-
-/*
- *  Copyright (C) 2000 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 __ACTBL32_H__
-#define __ACTBL32_H__
-
-
-/* IA32 Root System Description Table */
-
-typedef struct
-{
-       ACPI_TABLE_HEADER       header;                 /* Table header */
-       void                    *table_offset_entry [1]; /* Array of pointers to other */
-                        /* tables' headers */
-} ROOT_SYSTEM_DESCRIPTION_TABLE;
-
-
-/* IA32 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; /* ACPI OS waking vector */
-       u32                     global_lock;            /* Global Lock */
-       u32                     S4_bios_f       : 1;    /* Indicates if S4_bIOS support is present */
-       u32                     reserved1       : 31;   /* must be 0 */
-       u8                      resverved3 [40];        /* reserved - must be zero */
-
-} FIRMWARE_ACPI_CONTROL_STRUCTURE;
-
-
-/* IA32 Fixed ACPI Description Table */
-
-typedef struct
-{
-       ACPI_TABLE_HEADER       header;                 /* table header */
-       ACPI_TBLPTR             firmware_ctrl;          /* Physical address of FACS */
-       ACPI_TBLPTR             dsdt;                   /* Physical address of DSDT */
-       u8                      model;                  /* System Interrupt Model */
-       u8                      reserved1;              /* reserved */
-       u16                     sci_int;                /* System vector of SCI interrupt */
-       ACPI_IO_ADDRESS         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                      reserved2;              /* reserved - must be zero */
-       ACPI_IO_ADDRESS         pm1a_evt_blk;           /* Port address of Power Mgt 1a Acpi_event Reg Blk */
-       ACPI_IO_ADDRESS         pm1b_evt_blk;           /* Port address of Power Mgt 1b Acpi_event Reg Blk */
-       ACPI_IO_ADDRESS         pm1a_cnt_blk;           /* Port address of Power Mgt 1a Control Reg Blk */
-       ACPI_IO_ADDRESS         pm1b_cnt_blk;           /* Port address of Power Mgt 1b Control Reg Blk */
-       ACPI_IO_ADDRESS         pm2_cnt_blk;            /* Port address of Power Mgt 2 Control Reg Blk */
-       ACPI_IO_ADDRESS         pm_tmr_blk;             /* Port address of Power Mgt Timer Ctrl Reg Blk */
-       ACPI_IO_ADDRESS         gpe0blk;                /* Port addr of General Purpose Acpi_event 0 Reg Blk */
-       ACPI_IO_ADDRESS         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                      reserved3;              /* reserved */
-       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;             /* Size of area read to flush caches */
-       u16                     flush_stride;           /* Stride used in flushing caches */
-       u8                      duty_offset;            /* bit location of duty cycle field in p_cnt reg */
-       u8                      duty_width;             /* bit width of duty cycle field in p_cnt reg */
-       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 */
-       u8                      reserved4;              /* reserved */
-       u8                      reserved4a;             /* reserved */
-       u8                      reserved4b;             /* 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                     reserved5       : 23;   /* reserved - must be zero */
-
-}  FIXED_ACPI_DESCRIPTION_TABLE;
-
-
-#endif /* __ACTBL32_H__ */
-
-
diff --git a/drivers/acpi/include/actbl64.h b/drivers/acpi/include/actbl64.h
deleted file mode 100644 (file)
index fea6d13..0000000
+++ /dev/null
@@ -1,115 +0,0 @@
-/******************************************************************************
- *
- * Name: actbl64.h - ACPI tables specific to IA64
- *       $Revision: 12 $
- *
- *****************************************************************************/
-
-/*
- *  Copyright (C) 2000 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 __ACTBL64_H__
-#define __ACTBL64_H__
-
-
-typedef UINT64              IO_ADDRESS;             /* Only for clarity in declarations */
-
-
-/* IA64 Root System Description Table */
-
-typedef struct
-{
-       ACPI_TABLE_HEADER       header;                 /* Table header */
-       u32                     reserved_pad;           /* IA64 alignment, must be 0 */
-       void                    *table_offset_entry [1]; /* Array of pointers to other */
-                        /* tables' headers */
-} ROOT_SYSTEM_DESCRIPTION_TABLE;
-
-
-/* IA64 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                     reserved4;              /* must be 0 */
-       UINT64                  firmware_waking_vector; /* ACPI OS waking vector */
-       UINT64                  global_lock;            /* Global Lock */
-       u32                     S4_bios_f       : 1;    /* Indicates if S4_bIOS support is present */
-       u32                     reserved1       : 31;   /* must be 0 */
-       u8                      resverved3 [28];        /* reserved - must be zero */
-
-} FIRMWARE_ACPI_CONTROL_STRUCTURE;
-
-
-/* IA64 Fixed ACPI Description Table */
-
-typedef struct
-{
-       ACPI_TABLE_HEADER       header;                 /* table header */
-       u32                     reserved_pad;           /* IA64 alignment, must be 0 */
-       ACPI_TBLPTR             firmware_ctrl;          /* Physical address of FACS */
-       ACPI_TBLPTR             dsdt;                   /* Physical address of DSDT */
-       u8                      model;                  /* System Interrupt Model */
-       u8                      address_space;          /* Address Space Bitmask */
-       u16                     sci_int;                /* System vector of SCI interrupt */
-       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                      reserved2;              /* reserved - must be zero */
-       UINT64                  smi_cmd;                /* Port address of SMI command port */
-       UINT64                  pm1a_evt_blk;           /* Port address of Power Mgt 1a Acpi_event Reg Blk */
-       UINT64                  pm1b_evt_blk;           /* Port address of Power Mgt 1b Acpi_event Reg Blk */
-       UINT64                  pm1a_cnt_blk;           /* Port address of Power Mgt 1a Control Reg Blk */
-       UINT64                  pm1b_cnt_blk;           /* Port address of Power Mgt 1b Control Reg Blk */
-       UINT64                  pm2_cnt_blk;            /* Port address of Power Mgt 2 Control Reg Blk */
-       UINT64                  pm_tmr_blk;             /* Port address of Power Mgt Timer Ctrl Reg Blk */
-       UINT64                  gpe0blk;                /* Port addr of General Purpose Acpi_event 0 Reg Blk */
-       UINT64                  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                      reserved3;              /* reserved */
-       u16                     plvl2_lat;              /* worst case HW latency to enter/exit C2 state */
-       u16                     plvl3_lat;              /* worst case HW latency to enter/exit C3 state */
-       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 */
-       u8                      reserved4;              /* reserved */
-       u32                     flush_cash      : 1;    /* PAL_FLUSH_CACHE is correctly supported */
-       u32                     reserved5       : 1;    /* reserved - must be zero */
-       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                     reserved6       : 22;    /* reserved - must be zero */
-
-}  FIXED_ACPI_DESCRIPTION_TABLE;
-
-
-#endif /* __ACTBL64_H__ */
-
diff --git a/drivers/acpi/include/actbl71.h b/drivers/acpi/include/actbl71.h
new file mode 100644 (file)
index 0000000..408ec40
--- /dev/null
@@ -0,0 +1,144 @@
+/******************************************************************************
+ *
+ * Name: actbl71.h - IA-64 Extensions to the ACPI Spec Rev. 0.71
+ *                   This file includes tables specific to this
+ *                   specification revision.
+ *       $Revision: 7 $
+ *
+ *****************************************************************************/
+
+/*
+ *  Copyright (C) 2000 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 __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
+#define PM_TMR_BLK_ADDRESS_SPACE    0x08
+#define GPE0_BLK_ADDRESS_SPACE      0x10
+#define GPE1_BLK_ADDRESS_SPACE      0x20
+
+/* Only for clarity in declarations */
+typedef UINT64              IO_ADDRESS;
+
+#pragma pack(1)
+
+typedef struct  /* Root System Descriptor Pointer */
+{
+       NATIVE_CHAR             signature [8];          /* contains "RSD PTR " */
+       u8                      checksum;               /* to make sum of struct == 0 */
+       NATIVE_CHAR             oem_id [6];             /* OEM identification */
+       u8                      reserved;               /* Must be 0 for 1.0, 2 for 2.0 */
+       UINT64                  rsdt_physical_address;  /* 64-bit physical address of RSDT */
+} RSDP_DESCRIPTOR_REV071;
+
+
+/*****************************************/
+/* IA64 Extensions to ACPI Spec Rev 0.71 */
+/* for the Root System Description Table */
+/*****************************************/
+typedef struct
+{
+       ACPI_TABLE_HEADER   header;                 /* Table header */
+       u32                 reserved_pad;           /* IA64 alignment, must be 0 */
+       UINT64              table_offset_entry [1]; /* Array of pointers to other */
+                          /* tables' headers */
+} RSDT_DESCRIPTOR_REV071;
+
+
+/*******************************************/
+/* IA64 Extensions to ACPI Spec Rev 0.71   */
+/* 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                 reserved4;            /* must be 0 */
+       UINT64              firmware_waking_vector; /* ACPI OS waking vector */
+       UINT64              global_lock;          /* Global Lock */
+       u32                 S4_bios_f     : 1;    /* Indicates if S4_bIOS support is present */
+       u32                 reserved1     : 31;   /* must be 0 */
+       u8                  reserved3 [28];       /* reserved - must be zero */
+
+} FACS_DESCRIPTOR_REV071;
+
+
+/******************************************/
+/* IA64 Extensions to ACPI Spec Rev 0.71  */
+/* for the Fixed ACPI Description Table   */
+/******************************************/
+typedef struct
+{
+       ACPI_TABLE_HEADER   header;             /* table header */
+       u32                 reserved_pad;       /* IA64 alignment, must be 0 */
+       UINT64              firmware_ctrl;      /* 64-bit Physical address of FACS */
+       UINT64              dsdt;               /* 64-bit Physical address of DSDT */
+       u8                  model;              /* System Interrupt Model */
+       u8                  address_space;      /* Address Space Bitmask */
+       u16                 sci_int;            /* System vector of SCI interrupt */
+       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                  reserved2;          /* reserved - must be zero */
+       UINT64              smi_cmd;            /* Port address of SMI command port */
+       UINT64              pm1a_evt_blk;       /* Port address of Power Mgt 1a Acpi_event Reg Blk */
+       UINT64              pm1b_evt_blk;       /* Port address of Power Mgt 1b Acpi_event Reg Blk */
+       UINT64              pm1a_cnt_blk;       /* Port address of Power Mgt 1a Control Reg Blk */
+       UINT64              pm1b_cnt_blk;       /* Port address of Power Mgt 1b Control Reg Blk */
+       UINT64              pm2_cnt_blk;        /* Port address of Power Mgt 2 Control Reg Blk */
+       UINT64              pm_tmr_blk;         /* Port address of Power Mgt Timer Ctrl Reg Blk */
+       UINT64              gpe0blk;            /* Port addr of General Purpose Acpi_event 0 Reg Blk */
+       UINT64              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                  reserved3;          /* reserved */
+       u16                 plvl2_lat;          /* worst case HW latency to enter/exit C2 state */
+       u16                 plvl3_lat;          /* worst case HW latency to enter/exit C3 state */
+       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 */
+       u8                  reserved4;          /* reserved */
+       u32                 flush_cash  : 1;    /* PAL_FLUSH_CACHE is correctly supported */
+       u32                 reserved5   : 1;    /* reserved - must be zero */
+       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                 reserved6   : 22;    /* reserved - must be zero */
+
+}  FADT_DESCRIPTOR_REV071;
+
+#pragma pack()
+
+#endif /* __ACTBL71_H__ */
+
index e3ac5f2995e7d4a759677bea43b3b1bf7ab1ca8e..a29d5c24dfd90d946514a5156203c0eaea8eadf1 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Name: actypes.h - Common data types for the entire ACPI subsystem
- *       $Revision: 131 $
+ *       $Revision: 155 $
  *
  *****************************************************************************/
 
@@ -48,9 +48,6 @@
  * UCHAR        Character. 1 byte unsigned value.
  */
 
-#ifdef __ia64__
-#define _IA64
-#endif
 
 #ifdef _IA64
 /*
@@ -62,14 +59,14 @@ typedef unsigned char                   UCHAR;
 typedef unsigned short                  UINT16;
 typedef int                             INT32;
 typedef unsigned int                    UINT32;
-typedef long                            INT64;
-typedef unsigned long                   UINT64;
+typedef COMPILER_DEPENDENT_UINT64       UINT64;
 
 typedef UINT64                          NATIVE_UINT;
 typedef INT64                           NATIVE_INT;
 
 typedef NATIVE_UINT                     ACPI_TBLPTR;
 typedef UINT64                          ACPI_IO_ADDRESS;
+typedef UINT64                          ACPI_PHYSICAL_ADDRESS;
 
 #define ALIGNED_ADDRESS_BOUNDARY        0x00000008
 
@@ -85,6 +82,7 @@ typedef unsigned char                   BOOLEAN;
 typedef unsigned char                   UCHAR;
 typedef unsigned int                    UINT16;
 typedef long                            INT32;
+typedef int                             INT16;
 typedef unsigned long                   UINT32;
 
 typedef UINT16                          NATIVE_UINT;
@@ -92,10 +90,17 @@ typedef INT16                           NATIVE_INT;
 
 typedef UINT32                          ACPI_TBLPTR;
 typedef UINT32                          ACPI_IO_ADDRESS;
+typedef UINT32                          ACPI_PHYSICAL_ADDRESS;
 
 #define ALIGNED_ADDRESS_BOUNDARY        0x00000002
 #define _HW_ALIGNMENT_SUPPORT
 
+/*
+ * (16-bit only) internal integers must be 32-bits, so
+ * 64-bit integers cannot be supported
+ */
+#define ACPI_NO_INTEGER64_SUPPORT
+
 
 #else
 /*
@@ -107,18 +112,21 @@ typedef unsigned char                   UCHAR;
 typedef unsigned short                  UINT16;
 typedef int                             INT32;
 typedef unsigned int                    UINT32;
+typedef COMPILER_DEPENDENT_UINT64       UINT64;
 
 typedef UINT32                          NATIVE_UINT;
 typedef INT32                           NATIVE_INT;
 
 typedef NATIVE_UINT                     ACPI_TBLPTR;
 typedef UINT32                          ACPI_IO_ADDRESS;
+typedef UINT64                          ACPI_PHYSICAL_ADDRESS;
 
 #define ALIGNED_ADDRESS_BOUNDARY        0x00000004
 #define _HW_ALIGNMENT_SUPPORT
-
 #endif
 
+
+
 /*
  * Miscellaneous common types
  */
@@ -132,8 +140,10 @@ typedef char                            NATIVE_CHAR;
  * Data type ranges
  */
 
-#define ACPI_UCHAR_MAX                  (UCHAR)  0xFF
+#define ACPI_UINT8_MAX                  (UINT8)  0xFF
+#define ACPI_UINT16_MAX                 (UINT16) 0xFFFF
 #define ACPI_UINT32_MAX                 (UINT32) 0xFFFFFFFF
+#define ACPI_UINT64_MAX                 (UINT64) 0xFFFFFFFFFFFFFFFF
 
 
 #ifdef DEFINE_ALTERNATE_TYPES
@@ -144,6 +154,7 @@ typedef INT32                           s32;
 typedef UINT8                           u8;
 typedef UINT16                          u16;
 typedef UINT32                          u32;
+typedef UINT64                          u64;
 #endif
 /*! [End] no source code translation !*/
 
@@ -177,12 +188,47 @@ typedef char*                           ACPI_STRING;    /* Null terminated ASCII
 typedef void*                           ACPI_HANDLE;    /* Actually a ptr to an Node */
 
 
+/*
+ * Acpi integer width. In ACPI version 1, integers are
+ * 32 bits.  In ACPI version 2, integers are 64 bits.
+ * Note that this pertains to the ACPI integer type only, not
+ * other integers used in the implementation of the ACPI CA
+ * subsystem.
+ */
+#ifdef ACPI_NO_INTEGER64_SUPPORT
+
+/* 32-bit Integers */
+
+typedef u32                             ACPI_INTEGER;
+#define ACPI_INTEGER_MAX                ACPI_UINT32_MAX;
+#define ACPI_INTEGER_BIT_SIZE           32
+
+#else
+
+/* 64-bit Integers */
+
+typedef UINT64                          ACPI_INTEGER;
+#define ACPI_INTEGER_MAX                ACPI_UINT64_MAX;
+#define ACPI_INTEGER_BIT_SIZE           64
+
+#endif
+
+
 /*
  * Constants with special meanings
  */
 
 #define ACPI_ROOT_OBJECT                (ACPI_HANDLE)(-1)
 
+#define ACPI_FULL_INITIALIZATION        0x00
+#define ACPI_NO_ADDRESS_SPACE_INIT      0x01
+#define ACPI_NO_HARDWARE_INIT           0x02
+#define ACPI_NO_EVENT_INIT              0x04
+#define ACPI_NO_ACPI_ENABLE             0x08
+#define ACPI_NO_DEVICE_INIT             0x10
+#define ACPI_NO_PCI_INIT                0x20
+#define ACPI_NO_OBJECT_INIT             0x40
+
 
 /*
  * Sleep state constants
@@ -204,17 +250,14 @@ typedef void*                           ACPI_HANDLE;    /* Actually a ptr to an
 typedef u32                             ACPI_TABLE_TYPE;
 
 #define ACPI_TABLE_RSDP                 (ACPI_TABLE_TYPE) 0
-#define ACPI_TABLE_APIC                 (ACPI_TABLE_TYPE) 1
-#define ACPI_TABLE_DSDT                 (ACPI_TABLE_TYPE) 2
-#define ACPI_TABLE_FACP                 (ACPI_TABLE_TYPE) 3
-#define ACPI_TABLE_FACS                 (ACPI_TABLE_TYPE) 4
-#define ACPI_TABLE_PSDT                 (ACPI_TABLE_TYPE) 5
-#define ACPI_TABLE_RSDT                 (ACPI_TABLE_TYPE) 6
-#define ACPI_TABLE_SSDT                 (ACPI_TABLE_TYPE) 7
-#define ACPI_TABLE_SBST                 (ACPI_TABLE_TYPE) 8
-#define ACPI_TABLE_BOOT                 (ACPI_TABLE_TYPE) 9
-#define ACPI_TABLE_MAX                  9
-#define NUM_ACPI_TABLES                 10
+#define ACPI_TABLE_DSDT                 (ACPI_TABLE_TYPE) 1
+#define ACPI_TABLE_FADT                 (ACPI_TABLE_TYPE) 2
+#define ACPI_TABLE_FACS                 (ACPI_TABLE_TYPE) 3
+#define ACPI_TABLE_PSDT                 (ACPI_TABLE_TYPE) 4
+#define ACPI_TABLE_SSDT                 (ACPI_TABLE_TYPE) 5
+#define ACPI_TABLE_XSDT                 (ACPI_TABLE_TYPE) 6
+#define ACPI_TABLE_MAX                  6
+#define NUM_ACPI_TABLES                 (ACPI_TABLE_MAX+1)
 
 
 /*
@@ -266,21 +309,22 @@ typedef u8                              OBJECT_TYPE_INTERNAL;
 #define INTERNAL_TYPE_ALIAS             21 /* 0x15  */
 #define INTERNAL_TYPE_NOTIFY            22 /* 0x16  */
 #define INTERNAL_TYPE_ADDRESS_HANDLER   23 /* 0x17  */
+#define INTERNAL_TYPE_RESOURCE          24 /* 0x18  */
+
 
-#define INTERNAL_TYPE_NODE_MAX          23
+#define INTERNAL_TYPE_NODE_MAX          24
 
 /* These are pseudo-types because there are never any namespace nodes with these types */
 
-#define INTERNAL_TYPE_DEF_FIELD_DEFN    24 /* 0x18  Name, Byte_const, multiple Field_element */
-#define INTERNAL_TYPE_BANK_FIELD_DEFN   25 /* 0x19  2 Name,DWord_const,Byte_const,multi Field_element */
-#define INTERNAL_TYPE_INDEX_FIELD_DEFN  26 /* 0x1A  2 Name, Byte_const, multiple Field_element */
-#define INTERNAL_TYPE_IF                27 /* 0x1B  Op_code, multiple Code */
-#define INTERNAL_TYPE_ELSE              28 /* 0x1C  multiple Code */
-#define INTERNAL_TYPE_WHILE             29 /* 0x1D  Op_code, multiple Code */
-#define INTERNAL_TYPE_SCOPE             30 /* 0x1E  Name, multiple Node */
-#define INTERNAL_TYPE_DEF_ANY           31 /* 0x1F  type is Any, suppress search of enclosing scopes */
-#define INTERNAL_TYPE_METHOD_ARGUMENT   32 /* 0x20  */
-#define INTERNAL_TYPE_METHOD_LOCAL_VAR  33 /* 0x21  */
+#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_MAX               33
 
@@ -339,6 +383,7 @@ typedef u32                             ACPI_EVENT_TYPE;
  */
 typedef u32                             ACPI_EVENT_STATUS;
 
+#define ACPI_EVENT_FLAG_DISABLED        (ACPI_EVENT_STATUS) 0x00
 #define ACPI_EVENT_FLAG_ENABLED         (ACPI_EVENT_STATUS) 0x01
 #define ACPI_EVENT_FLAG_SET             (ACPI_EVENT_STATUS) 0x02
 
@@ -354,13 +399,15 @@ typedef u32                             ACPI_EVENT_STATUS;
 
 /* Address Space (Operation Region) Types */
 
-typedef u32                             ACPI_ADDRESS_SPACE_TYPE;
+typedef u                             ACPI_ADDRESS_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
 
 
 /*
@@ -373,7 +420,7 @@ typedef union acpi_obj
        struct
        {
                ACPI_OBJECT_TYPE            type;
-               u32                         value;      /* The actual number */
+               ACPI_INTEGER                value;      /* The actual number */
        } number;
 
        struct
@@ -553,7 +600,7 @@ void (*NOTIFY_HANDLER) (
 typedef
 ACPI_STATUS (*ADDRESS_SPACE_HANDLER) (
        u32                         function,
-       u32                         address,
+       ACPI_PHYSICAL_ADDRESS       address,
        u32                         bit_width,
        u32                         *value,
        void                        *handler_context,
@@ -596,11 +643,8 @@ ACPI_STATUS (*WALK_CALLBACK) (
 
 #define ACPI_COMMON_OBJ_INFO \
        ACPI_OBJECT_TYPE            type;           /* ACPI object type */ \
-       ACPI_NAME                   name;           /* ACPI object Name */ \
-       /*  TBD: [Restructure] Do we want or need these next two??*/ \
-       ACPI_HANDLE                 parent;         /* Parent object */ \
-       ACPI_HANDLE                 children;       /* Linked list of children */ \
-       u32                         valid           /* ?????    */
+       ACPI_NAME                   name            /* ACPI object Name */
+
 
 typedef struct
 {
@@ -612,12 +656,10 @@ typedef struct
 {
        ACPI_COMMON_OBJ_INFO;
 
-       /*
-        *  TBD: [Restructure]: a HID or a _UID can return either a number or a string
-        */
+       u32                         valid;              /*  Are the next bits legit? */
        NATIVE_CHAR                 hardware_id [9];    /*  _HID value if any */
        NATIVE_CHAR                 unique_id[9];       /*  _UID value if any */
-       u32                         address;            /*  _ADR value if any */
+       ACPI_INTEGER                address;            /*  _ADR value if any */
        u32                         current_status;     /*  _STA value */
 } ACPI_DEVICE_INFO;
 
@@ -634,7 +676,7 @@ typedef struct
 
 typedef struct
 {
-       u8                          *mapped_physical_address;
+       UINT64                      mapped_physical_address;
        u8                          *mapped_logical_address;
        u32                         mapped_length;
 } MEM_HANDLER_CONTEXT;
@@ -940,6 +982,8 @@ typedef struct _resource_tag
 #define RESOURCE_LENGTH                 12
 #define RESOURCE_LENGTH_NO_DATA         8
 
+#define NEXT_RESOURCE(res)    (RESOURCE*)((u8*) res + res->length)
+
 /*
  * END: Definitions for Resource Attributes
  */
@@ -949,7 +993,7 @@ typedef struct _resource_tag
  */
 typedef struct
 {
-       u32                         address;
+       ACPI_INTEGER                address;
        u32                         pin;
        u32                         source_index;
        NATIVE_CHAR                 source[1];
index 4c0b1a4b09adcaf9688a64d11bcfcd87478f9875..9a5cb2c52dc9ceb4752667621266e3f533843003 100644 (file)
@@ -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: 39 $
+ *       $Revision: 42 $
  *
  *****************************************************************************/
 
 #define AML_WORD_OP                 (u16) 0x0b
 #define AML_DWORD_OP                (u16) 0x0c
 #define AML_STRING_OP               (u16) 0x0d
+#define AML_QWORD_OP                (u16) 0x0e     /* ACPI 2.0 */
 #define AML_SCOPE_OP                (u16) 0x10
 #define AML_BUFFER_OP               (u16) 0x11
 #define AML_PACKAGE_OP              (u16) 0x12
+#define AML_VAR_PACKAGE_OP          (u16) 0x13     /* ACPI 2.0 */
 #define AML_METHOD_OP               (u16) 0x14
 #define AML_DUAL_NAME_PREFIX        (u16) 0x2e
 #define AML_MULTI_NAME_PREFIX_OP    (u16) 0x2f
@@ -90,6 +92,8 @@
 #define AML_FIND_SET_LEFT_BIT_OP    (u16) 0x81
 #define AML_FIND_SET_RIGHT_BIT_OP   (u16) 0x82
 #define AML_DEREF_OF_OP             (u16) 0x83
+#define AML_CONCAT_RES_OP           (u16) 0x84     /* ACPI 2.0 */
+#define AML_MOD_OP                  (u16) 0x85     /* ACPI 2.0 */
 #define AML_NOTIFY_OP               (u16) 0x86
 #define AML_SIZE_OF_OP              (u16) 0x87
 #define AML_INDEX_OP                (u16) 0x88
 #define AML_BYTE_FIELD_OP           (u16) 0x8c
 #define AML_BIT_FIELD_OP            (u16) 0x8d
 #define AML_TYPE_OP                 (u16) 0x8e
+#define AML_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
 #define AML_LEQUAL_OP               (u16) 0x93
 #define AML_LGREATER_OP             (u16) 0x94
 #define AML_LLESS_OP                (u16) 0x95
+#define AML_TO_BUFFER_OP            (u16) 0x96     /* ACPI 2.0 */
+#define AML_TO_DECSTRING_OP         (u16) 0x97     /* ACPI 2.0 */
+#define AML_TO_HEXSTRING_OP         (u16) 0x98     /* ACPI 2.0 */
+#define AML_TO_INTEGER_OP           (u16) 0x99     /* ACPI 2.0 */
+#define AML_TO_STRING_OP            (u16) 0x9c     /* ACPI 2.0 */
+#define AML_COPY_OP                 (u16) 0x9d     /* ACPI 2.0 */
+#define AML_MID_OP                  (u16) 0x9e     /* ACPI 2.0 */
+#define AML_CONTINUE_OP             (u16) 0x9f     /* ACPI 2.0 */
 #define AML_IF_OP                   (u16) 0xa0
 #define AML_ELSE_OP                 (u16) 0xa1
 #define AML_WHILE_OP                (u16) 0xa2
 #define AML_SHIFT_LEFT_BIT_OP       (u16) 0x5b11
 #define AML_COND_REF_OF_OP          (u16) 0x5b12
 #define AML_CREATE_FIELD_OP         (u16) 0x5b13
+#define AML_LOAD_TABLE_OP           (u16) 0x5b1f     /* ACPI 2.0 */
 #define AML_LOAD_OP                 (u16) 0x5b20
 #define AML_STALL_OP                (u16) 0x5b21
 #define AML_SLEEP_OP                (u16) 0x5b22
 #define AML_THERMAL_ZONE_OP         (u16) 0x5b85
 #define AML_INDEX_FIELD_OP          (u16) 0x5b86
 #define AML_BANK_FIELD_OP           (u16) 0x5b87
+#define AML_DATA_REGION_OP          (u16) 0x5b88     /* ACPI 2.0 */
 
 
 /* Bogus opcodes (they are actually two separate opcodes) */
 #define OPTYPE_BOGUS                22
 
 
+/* Predefined Operation Region Space_iDs */
+
+typedef enum
+{
+       REGION_MEMORY               = 0,
+       REGION_IO,
+       REGION_PCI_CONFIG,
+       REGION_EC,
+       REGION_SMBUS,
+       REGION_CMOS,
+       REGION_PCI_BAR
+
+} AML_REGION_TYPES;
+
+
 /* Comparison operation codes for Match_op operator */
 
 typedef enum
@@ -347,23 +377,15 @@ typedef enum
 
 /* Array sizes.  Used for range checking also */
 
-#define NUM_REGION_TYPES        5
+#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
 
-/* External declarations of the AML tables */
-
-extern u8                       acpi_gbl_aml            [NUM_OPCODES];
-extern u16                      acpi_gbl_pfx            [NUM_OPCODES];
-extern NATIVE_CHAR              *acpi_gbl_region_types  [NUM_REGION_TYPES];
-extern NATIVE_CHAR              *acpi_gbl_match_ops     [NUM_MATCH_OPS];
-extern NATIVE_CHAR              *acpi_gbl_access_types  [NUM_ACCESS_TYPES];
-extern NATIVE_CHAR              *acpi_gbl_update_rules  [NUM_UPDATE_RULES];
-extern NATIVE_CHAR              *acpi_gbl_FEnames       [NUM_FIELD_NAMES];
 
+#define USER_REGION_BEGIN       0x80
 
 /*
  * AML tables
@@ -371,61 +393,10 @@ extern NATIVE_CHAR              *acpi_gbl_FEnames       [NUM_FIELD_NAMES];
 
 #ifdef DEFINE_AML_GLOBALS
 
-/* Data used in keeping track of fields */
-
-NATIVE_CHAR *acpi_gbl_FEnames[NUM_FIELD_NAMES] =
-{
-       "skip",
-       "?access?"
-};              /* FE = Field Element */
-
-
-/* Region type decoding */
-
-NATIVE_CHAR *acpi_gbl_region_types[NUM_REGION_TYPES] =
-{
-       "System_memory",
-       "System_iO",
-       "PCIConfig",
-       "Embedded_control",
-       "SMBus"
-};
-
-
-NATIVE_CHAR *acpi_gbl_match_ops[NUM_MATCH_OPS] =
-{
-       "Error",
-       "MTR",
-       "MEQ",
-       "MLE",
-       "MLT",
-       "MGE",
-       "MGT"
-};
-
-
-/* Access type decoding */
-
-NATIVE_CHAR *acpi_gbl_access_types[NUM_ACCESS_TYPES] =
-{
-       "Any_acc",
-       "Byte_acc",
-       "Word_acc",
-       "DWord_acc",
-       "Block_acc",
-       "SMBSend_recv_acc",
-       "SMBQuick_acc"
-};
-
-
-/* Update rule decoding */
+/* External declarations of the AML tables */
 
-NATIVE_CHAR *acpi_gbl_update_rules[NUM_UPDATE_RULES] =
-{
-       "Preserve",
-       "Write_as_ones",
-       "Write_as_zeros"
-};
+extern u8                       acpi_gbl_aml            [NUM_OPCODES];
+extern u16                      acpi_gbl_pfx            [NUM_OPCODES];
 
 
 #endif /* DEFINE_AML_GLOBALS */
index edd89713320bbf7177a46838fb379b30259e39fb..751ef5de8f1902c93309a10e6556b84e3b5e6d78 100644 (file)
@@ -2,26 +2,14 @@
 # Makefile for all Linux ACPI interpreter subdirectories
 #
 
-SUB_DIRS        := 
-MOD_SUB_DIRS    := $(SUB_DIRS)
-MOD_IN_SUB_DIRS :=
-ALL_SUB_DIRS    := $(SUB_DIRS)
-
 O_TARGET := ../$(shell basename `pwd`).o
-O_OBJS   :=
-M_OBJS   :=
 
-ACPI_OBJS := $(patsubst %.c,%.o,$(wildcard *.c))
+obj-$(CONFIG_ACPI) := $(patsubst %.c,%.o,$(wildcard *.c))
 
 EXTRA_CFLAGS += -I../include
 
 EXTRA_CFLAGS += $(ACPI_CFLAGS)
 
-# if the interpreter is used, it overrides arch/i386/kernel/acpi.c
-ifeq ($(CONFIG_ACPI_INTERPRETER),y)
-  O_OBJS := $(ACPI_OBJS)
-endif
-
 include $(TOPDIR)/Rules.make
 
 clean:
index ccd6d2f7a558e558b5558ab827ffd4ec90618620..55e5b05106d84f94a65e4c6e0371e9a4fec6744e 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: amconfig - Namespace reconfiguration (Load/Unload opcodes)
- *              $Revision: 23 $
+ *              $Revision: 26 $
  *
  *****************************************************************************/
 
@@ -51,7 +51,7 @@
  *
  ****************************************************************************/
 
-ACPI_STATUS
+static ACPI_STATUS
 acpi_aml_exec_load_table (
        ACPI_OPERAND_OBJECT     *rgn_desc,
        ACPI_HANDLE             *ddb_handle)
@@ -139,12 +139,17 @@ acpi_aml_exec_load_table (
 
        /* Add the table to the namespace */
 
-       status = acpi_load_namespace ();
-       if (ACPI_FAILURE (status)) {
+       /* 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;
+/*
+               goto Cleanup;
        }
+*/
+
 
        /* TBD: [Investigate] we need a pointer to the table desc */
 
@@ -179,7 +184,7 @@ cleanup:
  *
  ****************************************************************************/
 
-ACPI_STATUS
+static ACPI_STATUS
 acpi_aml_exec_unload_table (
        ACPI_HANDLE             ddb_handle)
 {
@@ -219,7 +224,7 @@ acpi_aml_exec_unload_table (
 
        /* Delete the table itself */
 
-       acpi_tb_delete_single_table (table_info->installed_desc);
+       acpi_tb_uninstall_table (table_info->installed_desc);
 
        /* Delete the table descriptor (Ddb_handle) */
 
index acba7994677b5e79e1c72a876b3eb7c60d862766..02d7933e1d3796be514950f4cfb12a185c050ded 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: amcreate - Named object creation
- *              $Revision: 44 $
+ *              $Revision: 51 $
  *
  *****************************************************************************/
 
  *
  ******************************************************************************/
 
+
 ACPI_STATUS
 acpi_aml_exec_create_field (
-       u16                     opcode,
+       u8                      *aml_ptr,
+       u32                     aml_length,
+       ACPI_NAMESPACE_NODE     *node,
        ACPI_WALK_STATE         *walk_state)
 {
-       ACPI_OPERAND_OBJECT     *res_desc = NULL;
-       ACPI_OPERAND_OBJECT     *cnt_desc = NULL;
-       ACPI_OPERAND_OBJECT     *off_desc = NULL;
-       ACPI_OPERAND_OBJECT     *src_desc = NULL;
-       ACPI_OPERAND_OBJECT     *field_desc;
-       ACPI_OPERAND_OBJECT     *obj_desc;
-       OBJECT_TYPE_INTERNAL    res_type;
        ACPI_STATUS             status;
-       u32                     num_operands = 3;
-       u32                     offset;
-       u32                     bit_offset;
-       u16                     bit_count;
-       u8                      type_found;
-
-
-       /* Resolve the operands */
-
-       status = acpi_aml_resolve_operands (opcode, WALK_OPERANDS, walk_state);
-
-       /* Get the operands */
-
-       status |= acpi_ds_obj_stack_pop_object (&res_desc, walk_state);
-       if (AML_CREATE_FIELD_OP == opcode) {
-               num_operands = 4;
-               status |= acpi_ds_obj_stack_pop_object (&cnt_desc, walk_state);
-       }
+       ACPI_OPERAND_OBJECT     *obj_desc;
+       ACPI_OPERAND_OBJECT     *tmp_desc;
 
-       status |= acpi_ds_obj_stack_pop_object (&off_desc, walk_state);
-       status |= acpi_ds_obj_stack_pop_object (&src_desc, walk_state);
 
-       if (ACPI_FAILURE (status)) {
-               /* Invalid parameters on object stack  */
+       /* 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 */
 
-       offset = off_desc->number.value;
-
-
-       /*
-        * If Res_desc is a Name, it will be a direct name pointer after
-        * Acpi_aml_resolve_operands()
-        */
-
-       if (!VALID_DESCRIPTOR_TYPE (res_desc, ACPI_DESC_TYPE_NAMED)) {
-               status = AE_AML_OPERAND_TYPE;
-               goto cleanup;
-       }
-
+       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;
 
        /*
-        * Setup the Bit offsets and counts, according to the opcode
+        * Allocate a method object for this field unit
         */
 
-       switch (opcode)
-       {
-
-       /* Def_create_bit_field */
-
-       case AML_BIT_FIELD_OP:
-
-               /* Offset is in bits, Field is a bit */
-
-               bit_offset = offset;
-               bit_count = 1;
-               break;
-
-
-       /* Def_create_byte_field */
-
-       case AML_BYTE_FIELD_OP:
-
-               /* Offset is in bytes, field is a byte */
-
-               bit_offset = 8 * offset;
-               bit_count = 8;
-               break;
-
-
-       /* Def_create_word_field */
-
-       case AML_WORD_FIELD_OP:
-
-               /* Offset is in bytes, field is a word */
-
-               bit_offset = 8 * offset;
-               bit_count = 16;
-               break;
-
-
-       /* Def_create_dWord_field */
-
-       case AML_DWORD_FIELD_OP:
-
-               /* Offset is in bytes, field is a dword */
-
-               bit_offset = 8 * offset;
-               bit_count = 32;
-               break;
-
-
-       /* Def_create_field */
-
-       case AML_CREATE_FIELD_OP:
-
-               /* Offset is in bits, count is in bits */
-
-               bit_offset = offset;
-               bit_count = (u16) cnt_desc->number.value;
-               break;
-
-
-       default:
-
-               status = AE_AML_BAD_OPCODE;
+       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;
        }
 
-
        /*
-        * Setup field according to the object type
+        * Remember location in AML stream of the field unit
+        * opcode and operands -- since the buffer and index
+        * operands must be evaluated.
         */
 
-       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))
-               {
-                       status = AE_AML_BUFFER_LIMIT;
-                       goto cleanup;
-               }
-
+       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;
 
-               /* Allocate an object for the field */
-
-               field_desc = acpi_cm_create_internal_object (ACPI_TYPE_FIELD_UNIT);
-               if (!field_desc) {
-                       status = AE_NO_MEMORY;
-                       goto cleanup;
-               }
-
-               /* Construct the field object */
-
-               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;
-               field_desc->field_unit.sequence   = src_desc->buffer.sequence;
-
-               /* An additional reference for Src_desc */
-
-               acpi_cm_add_reference (src_desc);
-
-               break;
-
-
-       /* Improper object type */
-
-       default:
-
-               type_found = src_desc->common.type;
-
-               if ((type_found > (u8) INTERNAL_TYPE_REFERENCE) ||
-                       !acpi_cm_valid_object_type (type_found))
-
-
-               status = AE_AML_OPERAND_TYPE;
-               goto cleanup;
-       }
-
-
-       if (AML_CREATE_FIELD_OP == opcode) {
-               /* Delete object descriptor unique to Create_field */
-
-               acpi_cm_remove_reference (cnt_desc);
-               cnt_desc = NULL;
-       }
 
        /*
         * This operation is supposed to cause the destination Name to refer
@@ -268,11 +125,9 @@ acpi_aml_exec_create_field (
         * reference before calling Acpi_aml_exec_store().
         */
 
-       res_type = acpi_ns_get_type (res_desc);
-
        /* Type of Name's existing value */
 
-       switch (res_type)
+       switch (acpi_ns_get_type (node))
        {
 
        case ACPI_TYPE_FIELD_UNIT:
@@ -282,21 +137,21 @@ acpi_aml_exec_create_field (
        case INTERNAL_TYPE_DEF_FIELD:
        case INTERNAL_TYPE_INDEX_FIELD:
 
-               obj_desc = acpi_ns_get_attached_object (res_desc);
-               if (obj_desc) {
+               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 (obj_desc);
-                       acpi_ns_attach_object ((ACPI_NAMESPACE_NODE *) res_desc, NULL,
+                       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 *) res_desc)->type = ACPI_TYPE_ANY;
+               ((ACPI_NAMESPACE_NODE *) node)->type = ACPI_TYPE_ANY;
 
                break;
 
@@ -309,32 +164,29 @@ acpi_aml_exec_create_field (
 
        /* Store constructed field descriptor in result location */
 
-       status = acpi_aml_exec_store (field_desc, res_desc, walk_state);
+       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 (field_desc->common.reference_count <= 1) {
-               acpi_cm_remove_reference (field_desc);
+       if (obj_desc->common.reference_count <= 1) {
+               acpi_cm_remove_reference (obj_desc);
        }
 
 
-cleanup:
+       return (AE_OK);
 
-       /* Always delete the operands */
 
-       acpi_cm_remove_reference (off_desc);
-       acpi_cm_remove_reference (src_desc);
+cleanup:
 
-       if (AML_CREATE_FIELD_OP == opcode) {
-               acpi_cm_remove_reference (cnt_desc);
-       }
+       /* Delete region object and method subobject */
 
-       /* On failure, delete the result descriptor */
+       if (obj_desc) {
+               /* Remove deletes both objects! */
 
-       if (ACPI_FAILURE (status)) {
-               acpi_cm_remove_reference (res_desc); /* Result descriptor */
+               acpi_cm_remove_reference (obj_desc);
+               obj_desc = NULL;
        }
 
        return (status);
@@ -543,25 +395,23 @@ ACPI_STATUS
 acpi_aml_exec_create_region (
        u8                      *aml_ptr,
        u32                     aml_length,
-       u32                     region_space,
+       u                     region_space,
        ACPI_WALK_STATE         *walk_state)
 {
        ACPI_STATUS             status;
-       ACPI_OPERAND_OBJECT     *obj_desc_region;
+       ACPI_OPERAND_OBJECT     *obj_desc;
        ACPI_NAMESPACE_NODE     *node;
 
 
-       if (region_space >= NUM_REGION_TYPES) {
-               /* TBD: [Future] In ACPI 2.0, valid region space
-                *  includes types 0-6 (Adding CMOS and PCIBARTarget).
-                *  Also, types 0x80-0xff are defined as "OEM Region
-                *  Space handler"
-                *
-                * Should this return an error, or should we just keep
-                * going?  How do we handle the OEM region handlers?
-                */
-
-               REPORT_WARNING ("Unable to decode the Region_space");
+       /*
+        * 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);
        }
 
 
@@ -571,8 +421,8 @@ acpi_aml_exec_create_region (
 
        /* Create the region descriptor */
 
-       obj_desc_region = acpi_cm_create_internal_object (ACPI_TYPE_REGION);
-       if (!obj_desc_region) {
+       obj_desc = acpi_cm_create_internal_object (ACPI_TYPE_REGION);
+       if (!obj_desc) {
                status = AE_NO_MEMORY;
                goto cleanup;
        }
@@ -580,32 +430,34 @@ acpi_aml_exec_create_region (
        /*
         * Allocate a method object for this region.
         */
-       obj_desc_region->region.method = acpi_cm_create_internal_object (
-                        ACPI_TYPE_METHOD);
-       if (!obj_desc_region->region.method) {
+
+       obj_desc->region.extra = acpi_cm_create_internal_object (
+                        INTERNAL_TYPE_EXTRA);
+       if (!obj_desc->region.extra) {
                status = AE_NO_MEMORY;
                goto cleanup;
        }
 
-       /* Init the region from the operands */
-
-       obj_desc_region->region.space_id    = (u8) region_space;
-       obj_desc_region->region.address     = 0;
-       obj_desc_region->region.length      = 0;
-
        /*
         * Remember location in AML stream of address & length
         * operands since they need to be evaluated at run time.
         */
-       obj_desc_region->region.method->method.pcode     = aml_ptr;
-       obj_desc_region->region.method->method.pcode_length = aml_length;
+
+       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->region.node = node;
+       obj_desc->region.node = node;
 
-       status = acpi_ns_attach_object (node, obj_desc_region,
+       status = acpi_ns_attach_object (node, obj_desc,
                          (u8) ACPI_TYPE_REGION);
 
        if (ACPI_FAILURE (status)) {
@@ -617,7 +469,7 @@ acpi_aml_exec_create_region (
         * Namespace is NOT locked at this point.
         */
 
-       status = acpi_ev_initialize_region (obj_desc_region, FALSE);
+       status = acpi_ev_initialize_region (obj_desc, FALSE);
 
        if (ACPI_FAILURE (status)) {
                /*
@@ -635,11 +487,11 @@ cleanup:
        if (ACPI_FAILURE (status)) {
                /* Delete region object and method subobject */
 
-               if (obj_desc_region) {
+               if (obj_desc) {
                        /* Remove deletes both objects! */
 
-                       acpi_cm_remove_reference (obj_desc_region);
-                       obj_desc_region = NULL;
+                       acpi_cm_remove_reference (obj_desc);
+                       obj_desc = NULL;
                }
        }
 
diff --git a/drivers/acpi/interpreter/amdump.c b/drivers/acpi/interpreter/amdump.c
deleted file mode 100644 (file)
index 1499bea..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-/******************************************************************************
- *
- * Module Name: amdump - Interpreter debug output routines
- *              $Revision: 90 $
- *
- *****************************************************************************/
-
-/*
- *  Copyright (C) 2000 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          INTERPRETER
-        MODULE_NAME         ("amdump")
-
-
-/*
- * The following routines are used for debug output only
- */
-
-
index 69980c293b20d7fe1b19fec024f95e2088479623..ba67b062aa79b532e4d381fdbcb7df7c2264b940 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: amdyadic - ACPI AML (p-code) execution for dyadic operators
- *              $Revision: 63 $
+ *              $Revision: 68 $
  *
  *****************************************************************************/
 
@@ -106,7 +106,7 @@ acpi_aml_exec_dyadic1 (
 
                                /* Dispatch the notify to the appropriate handler */
 
-                               acpi_ev_notify_dispatch (node, val_desc->number.value);
+                               acpi_ev_notify_dispatch (node, (u32) val_desc->number.value);
                                break;
 
                        default:
@@ -117,7 +117,8 @@ acpi_aml_exec_dyadic1 (
 
        default:
 
-               REPORT_ERROR ("Acpi_aml_exec_dyadic1: Unknown dyadic opcode");
+               REPORT_ERROR (("Acpi_aml_exec_dyadic1: Unknown dyadic opcode %X\n",
+                       opcode));
                status = AE_AML_BAD_OPCODE;
        }
 
@@ -162,7 +163,6 @@ acpi_aml_exec_dyadic2_r (
        ACPI_OPERAND_OBJECT     *ret_desc   = NULL;
        ACPI_OPERAND_OBJECT     *ret_desc2  = NULL;
        ACPI_STATUS             status      = AE_OK;
-       u32                     remainder;
        u32                     num_operands = 3;
        NATIVE_CHAR             *new_buf;
 
@@ -276,8 +276,9 @@ acpi_aml_exec_dyadic2_r (
 
        case AML_DIVIDE_OP:
 
-               if ((u32) 0 == obj_desc2->number.value) {
-                       REPORT_ERROR ("Aml_exec_dyadic2_r/Divide_op: Divide by zero");
+               if (!obj_desc2->number.value) {
+                       REPORT_ERROR
+                               (("Aml_exec_dyadic2_r/Divide_op: Divide by zero\n"));
 
                        status = AE_AML_DIVIDE_BY_ZERO;
                        goto cleanup;
@@ -289,14 +290,15 @@ acpi_aml_exec_dyadic2_r (
                        goto cleanup;
                }
 
-               remainder               = obj_desc->number.value %
-                                  obj_desc2->number.value;
-               ret_desc->number.value  = remainder;
+               /* Remainder (modulo) */
+
+               ret_desc->number.value  = ACPI_MODULO (obj_desc->number.value,
+                                 obj_desc2->number.value);
 
                /* Result (what we used to call the quotient) */
 
-               ret_desc2->number.value = obj_desc->number.value /
-                                 obj_desc2->number.value;
+               ret_desc2->number.value = ACPI_DIVIDE (obj_desc->number.value,
+                                 obj_desc2->number.value);
                break;
 
 
@@ -360,7 +362,7 @@ acpi_aml_exec_dyadic2_r (
                                          obj_desc2->string.length + 1);
                        if (!new_buf) {
                                REPORT_ERROR
-                                       ("Aml_exec_dyadic2_r/Concat_op: String allocation failure");
+                                       (("Aml_exec_dyadic2_r/Concat_op: String allocation failure\n"));
                                status = AE_NO_MEMORY;
                                goto cleanup;
                        }
@@ -389,7 +391,7 @@ acpi_aml_exec_dyadic2_r (
                                          obj_desc2->buffer.length);
                        if (!new_buf) {
                                REPORT_ERROR
-                                       ("Aml_exec_dyadic2_r/Concat_op: Buffer allocation failure");
+                                       (("Aml_exec_dyadic2_r/Concat_op: Buffer allocation failure\n"));
                                status = AE_NO_MEMORY;
                                goto cleanup;
                        }
@@ -412,7 +414,7 @@ acpi_aml_exec_dyadic2_r (
 
        default:
 
-               REPORT_ERROR ("Acpi_aml_exec_dyadic2_r: Unknown dyadic opcode");
+               REPORT_ERROR (("Acpi_aml_exec_dyadic2_r: Unknown dyadic opcode %X\n", opcode));
                status = AE_AML_BAD_OPCODE;
                goto cleanup;
        }
@@ -548,7 +550,7 @@ acpi_aml_exec_dyadic2_s (
 
        default:
 
-               REPORT_ERROR ("Acpi_aml_exec_dyadic2_s: Unknown dyadic synchronization opcode");
+               REPORT_ERROR (("Acpi_aml_exec_dyadic2_s: Unknown dyadic synchronization opcode %X\n", opcode));
                status = AE_AML_BAD_OPCODE;
                goto cleanup;
        }
@@ -560,7 +562,7 @@ acpi_aml_exec_dyadic2_s (
         */
 
        if (status == AE_TIME) {
-               ret_desc->number.value = (u32)(-1);  /* TRUE, op timed out */
+               ret_desc->number.value = ACPI_INTEGER_MAX;  /* TRUE, op timed out */
                status = AE_OK;
        }
 
@@ -695,7 +697,7 @@ acpi_aml_exec_dyadic2 (
 
        default:
 
-               REPORT_ERROR ("Acpi_aml_exec_dyadic2: Unknown dyadic opcode");
+               REPORT_ERROR (("Acpi_aml_exec_dyadic2: Unknown dyadic opcode %X\n", opcode));
                status = AE_AML_BAD_OPCODE;
                goto cleanup;
                break;
@@ -705,7 +707,7 @@ acpi_aml_exec_dyadic2 (
        /* Set return value to logical TRUE (all ones) or FALSE (zero) */
 
        if (lboolean) {
-               ret_desc->number.value = 0xffffffff;
+               ret_desc->number.value = ACPI_INTEGER_MAX;
        }
        else {
                ret_desc->number.value = 0;
index d12770854f8f2dbe80bbd0165d8ff6fcf10545b4..356be14c230be5317f64a6453ca8080dfb2aa308 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: amfield - ACPI AML (p-code) execution - field manipulation
- *              $Revision: 70 $
+ *              $Revision: 74 $
  *
  *****************************************************************************/
 
@@ -105,7 +105,7 @@ acpi_aml_setup_field (
 
 
        /*
-        * If the address and length have not been previously evaluated,
+        * 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)) {
@@ -116,6 +116,16 @@ acpi_aml_setup_field (
                }
        }
 
+
+       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)
@@ -213,7 +223,16 @@ acpi_aml_access_named_field (
        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;
        }
 
 
index bdedfda3ba2216ae59e9470a3f363574f1673675..ce877c982829bb7019503abfc5ab0e9c90d78300 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: amfldio - Aml Field I/O
- *              $Revision: 26 $
+ *              $Revision: 32 $
  *
  *****************************************************************************/
 
@@ -59,7 +59,7 @@ acpi_aml_read_field_data (
 {
        ACPI_STATUS             status;
        ACPI_OPERAND_OBJECT     *rgn_desc = NULL;
-       u32                     address;
+       ACPI_PHYSICAL_ADDRESS   address;
        u32                     local_value = 0;
        u32                     field_byte_width;
 
@@ -93,9 +93,6 @@ acpi_aml_read_field_data (
                          field_byte_offset;
 
 
-
-
-
        /* Invoke the appropriate Address_space/Op_region handler */
 
        status = acpi_ev_address_space_dispatch (rgn_desc, ADDRESS_SPACE_READ,
@@ -318,7 +315,7 @@ cleanup:
  *
  ******************************************************************************/
 
-ACPI_STATUS
+static ACPI_STATUS
 acpi_aml_write_field_data (
        ACPI_OPERAND_OBJECT     *obj_desc,
        u32                     field_byte_offset,
@@ -327,7 +324,7 @@ acpi_aml_write_field_data (
 {
        ACPI_STATUS             status = AE_OK;
        ACPI_OPERAND_OBJECT     *rgn_desc = NULL;
-       u32                     address;
+       ACPI_PHYSICAL_ADDRESS   address;
        u32                     field_byte_width;
 
 
@@ -352,8 +349,6 @@ acpi_aml_write_field_data (
                          (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,
@@ -379,7 +374,7 @@ acpi_aml_write_field_data (
  *
  ****************************************************************************/
 
-ACPI_STATUS
+static ACPI_STATUS
 acpi_aml_write_field_data_with_update_rule (
        ACPI_OPERAND_OBJECT     *obj_desc,
        u32                     mask,
index fb2c4874ab888431b58d4025abb60eb96b3bb680..907169dfcb9a0da8ab681a25f3cc1be09c2b529c 100644 (file)
@@ -2,7 +2,7 @@
 /******************************************************************************
  *
  * Module Name: ammisc - ACPI AML (p-code) execution - specific opcodes
- *              $Revision: 67 $
+ *              $Revision: 71 $
  *
  *****************************************************************************/
 
@@ -100,6 +100,7 @@ cleanup:
 
        /* 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);
 }
 
@@ -223,7 +224,7 @@ acpi_aml_exec_index (
                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      = idx_desc->number.value;
+               ret_desc->reference.offset      = (u32) idx_desc->number.value;
 
                status = acpi_aml_exec_store (ret_desc, res_desc, walk_state);
        }
@@ -320,7 +321,7 @@ acpi_aml_exec_match (
                goto cleanup;
        }
 
-       index = start_desc->number.value;
+       index = (u32) start_desc->number.value;
        if (index >= (u32) pkg_desc->package.count) {
                status = AE_AML_PACKAGE_LIMIT;
                goto cleanup;
index 7c3ba69c4d8eabffb77773dbb5407187c706b5b7..ac721583e115f2db647e92f4c57f139c15067e48 100644 (file)
@@ -2,7 +2,7 @@
 /******************************************************************************
  *
  * Module Name: ammonad - ACPI AML (p-code) execution for monadic operators
- *              $Revision: 79 $
+ *              $Revision: 85 $
  *
  *****************************************************************************/
 
@@ -51,7 +51,7 @@
  *
  ******************************************************************************/
 
-ACPI_STATUS
+static ACPI_STATUS
 acpi_aml_get_object_reference (
        ACPI_OPERAND_OBJECT     *obj_desc,
        ACPI_OPERAND_OBJECT     **ret_desc,
@@ -180,7 +180,7 @@ acpi_aml_exec_monadic1 (
 
        case AML_SLEEP_OP:
 
-               acpi_aml_system_do_suspend (obj_desc->number.value);
+               acpi_aml_system_do_suspend ((u32) obj_desc->number.value);
                break;
 
 
@@ -188,7 +188,7 @@ acpi_aml_exec_monadic1 (
 
        case AML_STALL_OP:
 
-               acpi_aml_system_do_stall (obj_desc->number.value);
+               acpi_aml_system_do_stall ((u32) obj_desc->number.value);
                break;
 
 
@@ -196,7 +196,8 @@ acpi_aml_exec_monadic1 (
 
        default:
 
-               REPORT_ERROR ("Acpi_aml_exec_monadic1: Unknown monadic opcode");
+               REPORT_ERROR (("Acpi_aml_exec_monadic1: Unknown monadic opcode %X\n",
+                       opcode));
                status = AE_AML_BAD_OPCODE;
                break;
 
@@ -294,11 +295,10 @@ acpi_aml_exec_monadic2_r (
                ret_desc->number.value = obj_desc->number.value;
 
                /*
-                * Acpi x1.94 spec, Chapter 16 describes Integer as a 32-bit
-                *  little endian unsigned value, so this boundry condition
-                *  is valid.
+                * Acpi specification describes Integer type as a little
+                * endian unsigned value, so this boundry condition is valid.
                 */
-               for (res_val = 0; ret_desc->number.value && res_val < 32; ++res_val) {
+               for (res_val = 0; ret_desc->number.value && res_val < ACPI_INTEGER_BIT_SIZE; ++res_val) {
                        ret_desc->number.value >>= 1;
                }
 
@@ -313,16 +313,16 @@ acpi_aml_exec_monadic2_r (
                ret_desc->number.value = obj_desc->number.value;
 
                /*
-                * Acpi x1.94 spec, Chapter 16 describes Integer as a 32-bit
-                *  little endian unsigned value, so this boundry condition
-                *  is valid.
+                * Acpi specification describes Integer type as a little
+                * endian unsigned value, so this boundry condition is valid.
                 */
-               for (res_val = 0; ret_desc->number.value && res_val < 32; ++res_val) {
+               for (res_val = 0; ret_desc->number.value && res_val < ACPI_INTEGER_BIT_SIZE; ++res_val) {
                        ret_desc->number.value <<= 1;
                }
 
-               /* Since returns must be 1-based, subtract from 33 */
-               ret_desc->number.value = res_val == 0 ? 0 : 33 - res_val;
+               /* Since returns must be 1-based, subtract from 33 (65) */
+
+               ret_desc->number.value = res_val == 0 ? 0 : (ACPI_INTEGER_BIT_SIZE + 1) - res_val;
                break;
 
 
@@ -330,6 +330,8 @@ acpi_aml_exec_monadic2_r (
 
        case AML_FROM_BCD_OP:
 
+               /* TBD: for ACPI 2.0, expand to 64 bits */
+
                d0 = (u32) (obj_desc->number.value & 15);
                d1 = (u32) (obj_desc->number.value >> 4 & 15);
                d2 = (u32) (obj_desc->number.value >> 8 & 15);
@@ -348,6 +350,7 @@ acpi_aml_exec_monadic2_r (
 
        case AML_TO_BCD_OP:
 
+               /* TBD: for ACPI 2.0, expand to 64 bits */
 
                if (obj_desc->number.value > 9999) {
                        status = AE_AML_NUMERIC_OVERFLOW;
@@ -355,10 +358,10 @@ acpi_aml_exec_monadic2_r (
                }
 
                ret_desc->number.value
-                       = obj_desc->number.value % 10
-                       + (obj_desc->number.value / 10 % 10 << 4)
-                       + (obj_desc->number.value / 100 % 10 << 8)
-                       + (obj_desc->number.value / 1000 % 10 << 12);
+                       = ACPI_MODULO (obj_desc->number.value, 10)
+                       + (ACPI_MODULO (ACPI_DIVIDE (obj_desc->number.value, 10), 10) << 4)
+                       + (ACPI_MODULO (ACPI_DIVIDE (obj_desc->number.value, 100), 10) << 8)
+                       + (ACPI_MODULO (ACPI_DIVIDE (obj_desc->number.value, 1000), 10) << 12);
 
                break;
 
@@ -401,7 +404,7 @@ acpi_aml_exec_monadic2_r (
 
                /* The object exists in the namespace, return TRUE */
 
-               ret_desc->number.value = (u32) -1;
+               ret_desc->number.value = ACPI_INTEGER_MAX
                goto cleanup;
                break;
 
@@ -466,7 +469,8 @@ acpi_aml_exec_monadic2_r (
 
        default:
 
-               REPORT_ERROR ("Acpi_aml_exec_monadic2_r: Unknown monadic opcode");
+               REPORT_ERROR (("Acpi_aml_exec_monadic2_r: Unknown monadic opcode %X\n",
+                       opcode));
                status = AE_AML_BAD_OPCODE;
                goto cleanup;
        }
@@ -523,7 +527,7 @@ acpi_aml_exec_monadic2 (
        ACPI_STATUS             resolve_status;
        ACPI_STATUS             status;
        u32                     type;
-       u32                     value;
+       ACPI_INTEGER            value;
 
 
        /* Attempt to resolve the operands */
@@ -693,7 +697,8 @@ acpi_aml_exec_monadic2 (
 
                        default:
 
-                               REPORT_ERROR ("Acpi_aml_exec_monadic2/Type_op:internal error: Unknown Reference subtype");
+                               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;
                        }
@@ -946,7 +951,8 @@ acpi_aml_exec_monadic2 (
 
        default:
 
-               REPORT_ERROR ("Acpi_aml_exec_monadic2: Internal error, unknown monadic opcode");
+               REPORT_ERROR (("Acpi_aml_exec_monadic2: Unknown monadic opcode %X\n",
+                       opcode));
                status = AE_AML_BAD_OPCODE;
                goto cleanup;
        }
index 00661a43c9c2070e361913ce0293b72b70e476f1..ea4c26e088f52b03d77ea4c3a105ec37a7007591 100644 (file)
@@ -2,7 +2,7 @@
 /******************************************************************************
  *
  * Module Name: amnames - interpreter/scanner name load/execute
- *              $Revision: 70 $
+ *              $Revision: 71 $
  *
  *****************************************************************************/
 
@@ -90,7 +90,7 @@ acpi_aml_allocate_name_string (
 
        name_string = acpi_cm_allocate (size_needed);
        if (!name_string) {
-               REPORT_ERROR ("Aml_allocate_name_string: name allocation failure");
+               REPORT_ERROR (("Aml_allocate_name_string: name allocation failure\n"));
                return (NULL);
        }
 
@@ -380,8 +380,8 @@ acpi_aml_get_name_string (
        if (AE_CTRL_PENDING == status && has_prefix) {
                /* Ran out of segments after processing a prefix */
 
-               REPORT_ERROR ("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;
        }
 
index 4bdc4f8531d71ab881e0ebe9a4ecfa6f93328757..a4aa6b834217ac676606f15986c004092f41fbe5 100644 (file)
@@ -2,7 +2,7 @@
 /******************************************************************************
  *
  * Module Name: amprep - ACPI AML (p-code) execution - field prep utilities
- *              $Revision: 67 $
+ *              $Revision: 69 $
  *
  *****************************************************************************/
 
@@ -48,7 +48,7 @@
  *
  ******************************************************************************/
 
-u32
+static u32
 acpi_aml_decode_field_access_type (
        u32                     access)
 {
@@ -97,7 +97,7 @@ acpi_aml_decode_field_access_type (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+static ACPI_STATUS
 acpi_aml_prep_common_field_object (
        ACPI_OPERAND_OBJECT     *obj_desc,
        u8                      field_flags,
index 6b89a0aa70fe9f041b2cce69eccda9a303e1390d..dfe4fab85928950f5e1861dea675f39dda175149 100644 (file)
@@ -2,7 +2,7 @@
 /******************************************************************************
  *
  * Module Name: amregion - ACPI default Op_region (address space) handlers
- *              $Revision: 35 $
+ *              $Revision: 41 $
  *
  *****************************************************************************/
 
@@ -58,7 +58,7 @@
 ACPI_STATUS
 acpi_aml_system_memory_space_handler (
        u32                     function,
-       u32                     address, /* TBD: [Future] Should this be A POINTER for 64-bit support? */
+       ACPI_PHYSICAL_ADDRESS   address,
        u32                     bit_width,
        u32                     *value,
        void                    *handler_context,
@@ -98,8 +98,8 @@ acpi_aml_system_memory_space_handler (
         *    2) Address beyond the current mapping?
         */
 
-       if (((u8 *) address < mem_info->mapped_physical_address) ||
-               (((u8 *) address + length) >
+       if ((address < mem_info->mapped_physical_address) ||
+               ((address + length) >
                        (mem_info->mapped_physical_address + mem_info->mapped_length)))
        {
                /*
@@ -118,13 +118,15 @@ acpi_aml_system_memory_space_handler (
 
                /* Create a new mapping starting at the address given */
 
-               status = acpi_os_map_memory ((void *) address, SYSMEM_REGION_WINDOW_SIZE,
+               status = acpi_os_map_memory (address, SYSMEM_REGION_WINDOW_SIZE,
                                  (void **) &mem_info->mapped_logical_address);
                if (ACPI_FAILURE (status)) {
                        return (status);
                }
 
-               mem_info->mapped_physical_address = (u8 *) address;
+               /* 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;
        }
 
@@ -134,8 +136,10 @@ acpi_aml_system_memory_space_handler (
         * access
         */
 
+       /* TBD: should these pointers go to 64-bit in all cases ? */
+
        logical_addr_ptr = mem_info->mapped_logical_address +
-                         ((u8 *) address - mem_info->mapped_physical_address);
+                         (address - mem_info->mapped_physical_address);
 
        /* Perform the memory read or write */
 
@@ -212,7 +216,7 @@ acpi_aml_system_memory_space_handler (
 ACPI_STATUS
 acpi_aml_system_io_space_handler (
        u32                     function,
-       u32                     address,
+       ACPI_PHYSICAL_ADDRESS   address,
        u32                     bit_width,
        u32                     *value,
        void                    *handler_context,
@@ -304,7 +308,7 @@ acpi_aml_system_io_space_handler (
 ACPI_STATUS
 acpi_aml_pci_config_space_handler (
        u32                     function,
-       u32                     address,
+       ACPI_PHYSICAL_ADDRESS   address,
        u32                     bit_width,
        u32                     *value,
        void                    *handler_context,
index e2db2bfdea99715df69bbd51d2430487faab0e24..20c6a0b11a8dc68a675ddb807f080ee6918a4df5 100644 (file)
@@ -2,7 +2,7 @@
 /******************************************************************************
  *
  * Module Name: amresnte - AML Interpreter object resolution
- *              $Revision: 21 $
+ *              $Revision: 25 $
  *
  *****************************************************************************/
 
@@ -65,7 +65,9 @@
 
 ACPI_STATUS
 acpi_aml_resolve_node_to_value (
-       ACPI_NAMESPACE_NODE     **stack_ptr)
+       ACPI_NAMESPACE_NODE     **stack_ptr,
+       ACPI_WALK_STATE         *walk_state)
+
 {
        ACPI_STATUS             status = AE_OK;
        ACPI_OPERAND_OBJECT     *val_desc = NULL;
@@ -76,7 +78,7 @@ acpi_aml_resolve_node_to_value (
        u8                      locked;
        u8                      attached_aml_pointer = FALSE;
        u8                      aml_opcode = 0;
-       u32                     temp_val;
+       ACPI_INTEGER            temp_val;
        OBJECT_TYPE_INTERNAL    object_type;
 
 
@@ -114,8 +116,7 @@ acpi_aml_resolve_node_to_value (
         *  and Method locals and arguments have a pseudo-Node
         */
        if (entry_type == ACPI_TYPE_DEVICE ||
-               entry_type == INTERNAL_TYPE_METHOD_ARGUMENT ||
-               entry_type == INTERNAL_TYPE_METHOD_LOCAL_VAR)
+               (node->flags & (ANOBJ_METHOD_ARG | ANOBJ_METHOD_LOCAL)))
        {
                return (AE_OK);
        }
@@ -174,7 +175,6 @@ acpi_aml_resolve_node_to_value (
 
                obj_desc = val_desc;
                acpi_cm_add_reference (obj_desc);
-
                break;
 
 
@@ -211,90 +211,18 @@ acpi_aml_resolve_node_to_value (
        case ACPI_TYPE_NUMBER:
 
                /*
-                * An ACPI_TYPE_NUMBER can be either an object or an AML pointer
+                * The Node has an attached internal object, make sure that it's a
+                * number
                 */
 
-               if (attached_aml_pointer) {
-                       /*
-                        * The attachment points into the AML stream, get the number from
-                        * there.  The actual number is based upon the AML opcode
-                        *
-                        * Note: Word_op and DWord_op will not work properly if the
-                        *       processor's endianness does not match the AML's.
-                        */
-
-                       switch (aml_opcode)
-                       {
-
-                       case AML_ZERO_OP:
-
-                               temp_val = 0;
-                               break;
-
-
-                       case AML_ONE_OP:
-
-                               temp_val = 1;
-                               break;
-
-
-                       case AML_ONES_OP:
-
-                               temp_val = 0xFFFFFFFF;
-                               break;
-
-
-                       case AML_BYTE_OP:
-
-                               temp_val = (u32) ((u8 *) val_desc)[1];
-                               break;
-
-
-                       case AML_WORD_OP:
-
-                               MOVE_UNALIGNED16_TO_32 (&temp_val, &((u8 *) val_desc)[1]);
-                               break;
-
-
-                       case AML_DWORD_OP:
-
-                               MOVE_UNALIGNED32_TO_32 (&temp_val, &((u8 *) val_desc)[1]);
-                               break;
-
-
-                       default:
-
-                               return (AE_AML_BAD_OPCODE);
-
-                       } /* switch */
-
-
-                       /* Create and initialize a new object */
-
-                       obj_desc = acpi_cm_create_internal_object (ACPI_TYPE_NUMBER);
-                       if (!obj_desc) {
-                               return (AE_NO_MEMORY);
-                       }
-
-                       obj_desc->number.value = temp_val;
+               if (ACPI_TYPE_NUMBER != val_desc->common.type) {
+                       return (AE_AML_OPERAND_TYPE);
                }
 
-               else {
-                       /*
-                        * The Node has an attached internal object, make sure that it's a
-                        * number
-                        */
-
-                       if (ACPI_TYPE_NUMBER != 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);
-               }
+               /* Return an additional reference to the object */
 
+               obj_desc = val_desc;
+               acpi_cm_add_reference (obj_desc);
                break;
 
 
@@ -331,7 +259,7 @@ acpi_aml_resolve_node_to_value (
                 * Fill in the object specific details
                 */
                if (ACPI_TYPE_BUFFER == object_type) {
-                       obj_desc->buffer.pointer = acpi_cm_callocate(val_desc->field.length);
+                       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);
@@ -339,18 +267,15 @@ acpi_aml_resolve_node_to_value (
 
                        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);
+                       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,
+                       status = acpi_aml_access_named_field (ACPI_READ, (ACPI_HANDLE) node,
                                          &temp_val, sizeof (temp_val));
 
                        if (ACPI_FAILURE (status)) {
@@ -384,8 +309,7 @@ acpi_aml_resolve_node_to_value (
                /* perform the update */
 
                status = acpi_aml_access_named_field (ACPI_WRITE,
-                                val_desc->bank_field.bank_select,
-                                &val_desc->bank_field.value,
+                                val_desc->bank_field.bank_select, &val_desc->bank_field.value,
                                 sizeof (val_desc->bank_field.value));
 
                acpi_aml_release_global_lock (locked);
@@ -404,6 +328,8 @@ acpi_aml_resolve_node_to_value (
                        return (status);
                }
 
+               /* Create an object for the result */
+
                obj_desc = acpi_cm_create_internal_object (ACPI_TYPE_NUMBER);
                if (!obj_desc) {
                        return (AE_NO_MEMORY);
@@ -431,10 +357,10 @@ acpi_aml_resolve_node_to_value (
                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));
+                                 val_desc->index_field.index, &val_desc->index_field.value,
+                                 sizeof (val_desc->index_field.value));
 
                acpi_aml_release_global_lock (locked);
 
@@ -444,13 +370,14 @@ acpi_aml_resolve_node_to_value (
 
                /* Read Data value */
 
-               status = acpi_aml_access_named_field (ACPI_READ,
-                                  val_desc->index_field.data,
-                                  &temp_val, sizeof (temp_val));
+               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_NUMBER);
                if (!obj_desc) {
                        return (AE_NO_MEMORY);
@@ -471,6 +398,8 @@ acpi_aml_resolve_node_to_value (
                        break;
                }
 
+               /* Create object for result */
+
                obj_desc = acpi_cm_create_internal_object (ACPI_TYPE_ANY);
                if (!obj_desc) {
                        return (AE_NO_MEMORY);
@@ -504,11 +433,61 @@ acpi_aml_resolve_node_to_value (
                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_NUMBER);
+               if (!obj_desc) {
+                       return (AE_NO_MEMORY);
+               }
+
+               obj_desc->number.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 */
index 508b140abf75b2a04dc8814589f8fb31ef6bbfa7..2fa59e9bb4249c44890f73cbdbb088ff392e39c8 100644 (file)
@@ -2,7 +2,7 @@
 /******************************************************************************
  *
  * Module Name: amresolv - AML Interpreter object resolution
- *              $Revision: 74 $
+ *              $Revision: 78 $
  *
  *****************************************************************************/
 
@@ -69,7 +69,14 @@ acpi_aml_get_field_unit_value (
                status = AE_AML_NO_OPERAND;
        }
 
-       else if (!field_desc->field_unit.container) {
+       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;
        }
 
@@ -77,12 +84,6 @@ acpi_aml_get_field_unit_value (
                status = AE_AML_OPERAND_TYPE;
        }
 
-       else if (field_desc->field_unit.sequence
-                        != field_desc->field_unit.container->buffer.sequence)
-       {
-               status = AE_AML_INTERNAL;
-       }
-
        else if (!result_desc) {
                status = AE_AML_INTERNAL;
        }
@@ -114,7 +115,7 @@ acpi_aml_get_field_unit_value (
                mask = ((u32) 1 << field_desc->field_unit.length) - (u32) 1;
        }
        else {
-               mask = 0xFFFFFFFF;
+               mask = ACPI_UINT32_MAX;
        }
 
        result_desc->number.type = (u8) ACPI_TYPE_NUMBER;
@@ -186,7 +187,7 @@ acpi_aml_resolve_to_value (
         */
 
        if (VALID_DESCRIPTOR_TYPE (*stack_ptr, ACPI_DESC_TYPE_NAMED)) {
-               status = acpi_aml_resolve_node_to_value ((ACPI_NAMESPACE_NODE **) stack_ptr);
+               status = acpi_aml_resolve_node_to_value ((ACPI_NAMESPACE_NODE **) stack_ptr, walk_state);
        }
 
 
@@ -340,7 +341,11 @@ acpi_aml_resolve_object_to_value (
                case AML_ONES_OP:
 
                        stack_desc->common.type = (u8) ACPI_TYPE_NUMBER;
-                       stack_desc->number.value = 0xFFFFFFFF;
+                       stack_desc->number.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;
 
 
index 4c67e52152ba5273d69ff242ebce9cafe9bf5e4c..83fda445505b5efd3f51fb690ac3868a595635ca 100644 (file)
@@ -2,7 +2,7 @@
 /******************************************************************************
  *
  * Module Name: amresop - AML Interpreter operand/object resolution
- *              $Revision: 15 $
+ *              $Revision: 18 $
  *
  *****************************************************************************/
 
         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
@@ -71,6 +109,7 @@ acpi_aml_resolve_operands (
        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);
@@ -81,8 +120,7 @@ acpi_aml_resolve_operands (
 
        arg_types = op_info->runtime_args;
        if (arg_types == ARGI_INVALID_OPCODE) {
-               status = AE_AML_INTERNAL;
-               goto cleanup;
+               return (AE_AML_INTERNAL);
        }
 
 
@@ -96,8 +134,7 @@ acpi_aml_resolve_operands (
 
        while (GET_CURRENT_ARG_TYPE (arg_types)) {
                if (!stack_ptr || !*stack_ptr) {
-                       status = AE_AML_INTERNAL;
-                       goto cleanup;
+                       return (AE_AML_INTERNAL);
                }
 
                /* Extract useful items */
@@ -120,8 +157,7 @@ acpi_aml_resolve_operands (
                        /* Check for bad ACPI_OBJECT_TYPE */
 
                        if (!acpi_aml_validate_object_type (object_type)) {
-                               status = AE_AML_OPERAND_TYPE;
-                               goto cleanup;
+                               return (AE_AML_OPERAND_TYPE);
                        }
 
                        if (object_type == (u8) INTERNAL_TYPE_REFERENCE) {
@@ -149,30 +185,32 @@ acpi_aml_resolve_operands (
                                        break;
 
                                default:
-                                       status = AE_AML_OPERAND_TYPE;
-                                       goto cleanup;
+                                       return (AE_AML_OPERAND_TYPE);
                                        break;
                                }
                        }
-
                }
 
                else {
                        /* Invalid descriptor */
 
-                       status = AE_AML_OPERAND_TYPE;
-                       goto cleanup;
+                       return (AE_AML_OPERAND_TYPE);
                }
 
 
                /*
-                * Decode a character from the type string
+                * 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)
                {
 
@@ -182,14 +220,16 @@ acpi_aml_resolve_operands (
                        /* Need an operand of type INTERNAL_TYPE_REFERENCE */
 
                        if (VALID_DESCRIPTOR_TYPE (obj_desc, ACPI_DESC_TYPE_NAMED))            /* direct name ptr OK as-is */ {
-                               break;
+                               goto next_operand;
                        }
 
-                       if (INTERNAL_TYPE_REFERENCE != object_type) {
-                               status = AE_AML_OPERAND_TYPE;
-                               goto cleanup;
+                       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
@@ -200,159 +240,120 @@ acpi_aml_resolve_operands (
                                acpi_cm_remove_reference (obj_desc);
                                (*stack_ptr) = temp_handle;
                        }
-                       break;
 
+                       goto next_operand;
+                       break;
 
-               case ARGI_NUMBER:   /* Number */
 
-                       /* Need an operand of type ACPI_TYPE_NUMBER */
+               case ARGI_ANYTYPE:
 
-                       status = acpi_aml_resolve_to_value (stack_ptr, walk_state);
-                       if (ACPI_FAILURE (status)) {
-                               goto cleanup;
-                       }
+                       /*
+                        * 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 (ACPI_TYPE_NUMBER != (*stack_ptr)->common.type) {
-                               status = AE_AML_OPERAND_TYPE;
-                               goto cleanup;
+                       if ((opcode == AML_STORE_OP) &&
+                               ((*stack_ptr)->common.type == INTERNAL_TYPE_REFERENCE) &&
+                               ((*stack_ptr)->reference.op_code == AML_INDEX_OP))
+                       {
+                               goto next_operand;
                        }
                        break;
+               }
 
 
-               case ARGI_STRING:
+               /*
+                * Resolve this object to a value
+                */
 
-                       /* Need an operand of type ACPI_TYPE_STRING or ACPI_TYPE_BUFFER */
+               status = acpi_aml_resolve_to_value (stack_ptr, walk_state);
+               if (ACPI_FAILURE (status)) {
+                       return (status);
+               }
 
-                       status = acpi_aml_resolve_to_value (stack_ptr, walk_state);
-                       if (ACPI_FAILURE (status)) {
-                               goto cleanup;
-                       }
 
-                       if ((ACPI_TYPE_STRING != (*stack_ptr)->common.type) &&
-                               (ACPI_TYPE_BUFFER != (*stack_ptr)->common.type))
-                       {
-                               status = AE_AML_OPERAND_TYPE;
-                               goto cleanup;
-                       }
-                       break;
+               /*
+                * Check the resulting object (value) type
+                */
+               switch (this_arg_type)
+               {
+               /*
+                * For the simple cases, only one type of resolved object
+                * is allowed
+                */
+               case ARGI_NUMBER:   /* Number */
+
+                       /* Need an operand of type ACPI_TYPE_NUMBER */
 
+                       type_needed = ACPI_TYPE_NUMBER;
+                       break;
 
                case ARGI_BUFFER:
 
                        /* Need an operand of type ACPI_TYPE_BUFFER */
 
-                       status = acpi_aml_resolve_to_value (stack_ptr, walk_state);
-                       if (ACPI_FAILURE (status)) {
-                               goto cleanup;
-                       }
-
-                       if (ACPI_TYPE_BUFFER != (*stack_ptr)->common.type) {
-                               status = AE_AML_OPERAND_TYPE;
-                               goto cleanup;
-                       }
+                       type_needed = ACPI_TYPE_BUFFER;
                        break;
 
-
                case ARGI_MUTEX:
 
                        /* Need an operand of type ACPI_TYPE_MUTEX */
 
-                       status = acpi_aml_resolve_to_value (stack_ptr, walk_state);
-                       if (ACPI_FAILURE (status)) {
-                               goto cleanup;
-                       }
-
-                       if (ACPI_TYPE_MUTEX != (*stack_ptr)->common.type) {
-                               status = AE_AML_OPERAND_TYPE;
-                               goto cleanup;
-                       }
+                       type_needed = ACPI_TYPE_MUTEX;
                        break;
 
-
                case ARGI_EVENT:
 
                        /* Need an operand of type ACPI_TYPE_EVENT */
 
-                       status = acpi_aml_resolve_to_value (stack_ptr, walk_state);
-                       if (ACPI_FAILURE (status)) {
-                               goto cleanup;
-                       }
-
-                       if (ACPI_TYPE_EVENT != (*stack_ptr)->common.type) {
-                               status = AE_AML_OPERAND_TYPE;
-                               goto cleanup;
-                       }
+                       type_needed = ACPI_TYPE_EVENT;
                        break;
 
-
                case ARGI_REGION:
 
                        /* Need an operand of type ACPI_TYPE_REGION */
 
-                       status = acpi_aml_resolve_to_value (stack_ptr, walk_state);
-                       if (ACPI_FAILURE (status)) {
-                               goto cleanup;
-                       }
-
-                       if (ACPI_TYPE_REGION != (*stack_ptr)->common.type) {
-                               status = AE_AML_OPERAND_TYPE;
-                               goto cleanup;
-                       }
+                       type_needed = ACPI_TYPE_REGION;
                        break;
 
-
-                case ARGI_IF:   /* If */
+               case ARGI_IF:   /* If */
 
                        /* Need an operand of type INTERNAL_TYPE_IF */
 
-                       if (INTERNAL_TYPE_IF != (*stack_ptr)->common.type) {
-                               status = AE_AML_OPERAND_TYPE;
-                               goto cleanup;
-                       }
+                       type_needed = INTERNAL_TYPE_IF;
                        break;
 
-
                case ARGI_PACKAGE:   /* Package */
 
                        /* Need an operand of type ACPI_TYPE_PACKAGE */
 
-                       status = acpi_aml_resolve_to_value (stack_ptr, walk_state);
-                       if (ACPI_FAILURE (status)) {
-                               goto cleanup;
-                       }
-
-                       if (ACPI_TYPE_PACKAGE != (*stack_ptr)->common.type) {
-                               status = AE_AML_OPERAND_TYPE;
-                               goto cleanup;
-                       }
+                       type_needed = ACPI_TYPE_PACKAGE;
                        break;
 
-
                case ARGI_ANYTYPE:
 
+                       /* Any operand type will do */
 
-                       /*
-                        * 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.
-                        */
+                       type_needed = ACPI_TYPE_ANY;
+                       break;
 
-                       if ((opcode == AML_STORE_OP) &&
-                               ((*stack_ptr)->common.type == INTERNAL_TYPE_REFERENCE) &&
-                               ((*stack_ptr)->reference.op_code == AML_INDEX_OP))
-                       {
-                               break;
-                       }
 
-                       /* All others must be resolved */
+               /*
+                * The more complex cases allow multiple resolved object types
+                */
 
-                       status = acpi_aml_resolve_to_value (stack_ptr, walk_state);
-                       if (ACPI_FAILURE (status)) {
-                               goto cleanup;
-                       }
+               case ARGI_STRING:
 
-                       /* All types OK, so we don't perform any typechecks */
+                       /* Need an operand of type ACPI_TYPE_STRING or ACPI_TYPE_BUFFER */
 
+                       if ((ACPI_TYPE_STRING != (*stack_ptr)->common.type) &&
+                               (ACPI_TYPE_BUFFER != (*stack_ptr)->common.type))
+                       {
+                               return (AE_AML_OPERAND_TYPE);
+                       }
+                       goto next_operand;
                        break;
 
 
@@ -366,11 +367,6 @@ acpi_aml_resolve_operands (
                         *  error with a size of 4.
                         */
 
-                       status = acpi_aml_resolve_to_value (stack_ptr, walk_state);
-                       if (ACPI_FAILURE (status)) {
-                               goto cleanup;
-                       }
-
                        /* Need a buffer, string, package or Node reference */
 
                        if (((*stack_ptr)->common.type != ACPI_TYPE_BUFFER) &&
@@ -378,8 +374,7 @@ acpi_aml_resolve_operands (
                                ((*stack_ptr)->common.type != ACPI_TYPE_PACKAGE) &&
                                ((*stack_ptr)->common.type != INTERNAL_TYPE_REFERENCE))
                        {
-                               status = AE_AML_OPERAND_TYPE;
-                               goto cleanup;
+                               return (AE_AML_OPERAND_TYPE);
                        }
 
                        /*
@@ -387,44 +382,49 @@ acpi_aml_resolve_operands (
                         */
                        if ((*stack_ptr)->common.type == INTERNAL_TYPE_REFERENCE) {
                                if (!(*stack_ptr)->reference.node) {
-                                       status = AE_AML_OPERAND_TYPE;
-                                       goto cleanup;
+                                       return (AE_AML_OPERAND_TYPE);
                                }
                        }
-
+                       goto next_operand;
                        break;
 
 
                case ARGI_COMPLEXOBJ:
 
-                       status = acpi_aml_resolve_to_value (stack_ptr, walk_state);
-                       if (ACPI_FAILURE (status)) {
-                               goto cleanup;
-                       }
-
                        /* Need a buffer or package */
 
                        if (((*stack_ptr)->common.type != ACPI_TYPE_BUFFER) &&
                                ((*stack_ptr)->common.type != ACPI_TYPE_PACKAGE))
                        {
-                               status = AE_AML_OPERAND_TYPE;
-                               goto cleanup;
+                               return (AE_AML_OPERAND_TYPE);
                        }
+                       goto next_operand;
                        break;
 
 
-               /* Unknown abbreviation passed in */
-
                default:
-                       status = AE_BAD_PARAMETER;
-                       goto cleanup;
 
-               }   /* switch (*Types++) */
+                       /* 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 (after checking for underflow).
+                * to next operand on stack
                 */
                if (GET_CURRENT_ARG_TYPE (arg_types)) {
                        stack_ptr--;
@@ -433,9 +433,7 @@ acpi_aml_resolve_operands (
        }   /* while (*Types) */
 
 
-cleanup:
-
-  return (status);
+       return (status);
 }
 
 
index f7f34cb4fa3c607e55622a983dec81fea07182a2..8887e09978433b532d212b3b9c3da7b48cb58236 100644 (file)
@@ -2,7 +2,7 @@
 /******************************************************************************
  *
  * Module Name: amstore - AML Interpreter object store support
- *              $Revision: 116 $
+ *              $Revision: 117 $
  *
  *****************************************************************************/
 
index 123f791ad6a3eb956b2a203665c6b7fdfb239aea..91b2095c59790ea899acc015af607d441bc12526 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Module Name: amstoren - AML Interpreter object store support,
  *                         Store to Node (namespace object)
- *              $Revision: 21 $
+ *              $Revision: 24 $
  *
  *****************************************************************************/
 
@@ -430,10 +430,20 @@ acpi_aml_store_object_to_node (
 
        case ACPI_TYPE_FIELD_UNIT:
 
+
+               /*
+                * If the Field Buffer and Index have not been previously evaluated,
+                * evaluate them and save the results.
+                */
+               if (!(dest_desc->common.flags & AOPOBJ_DATA_VALID)) {
+                       status = acpi_ds_get_field_unit_arguments (dest_desc);
+                       if (ACPI_FAILURE (status)) {
+                               return (status);
+                       }
+               }
+
                if ((!dest_desc->field_unit.container ||
-                       ACPI_TYPE_BUFFER != dest_desc->field_unit.container->common.type ||
-                       dest_desc->field_unit.sequence !=
-                               dest_desc->field_unit.container->buffer.sequence))
+                       ACPI_TYPE_BUFFER != dest_desc->field_unit.container->common.type))
                {
                        status = AE_AML_INTERNAL;
                        goto clean_up_and_bail_out;
@@ -487,7 +497,12 @@ acpi_aml_store_object_to_node (
 
        case ACPI_TYPE_NUMBER:
 
+
                dest_desc->number.value = val_desc->number.value;
+
+               /* Truncate value if we are executing from a 32-bit ACPI table */
+
+               acpi_aml_truncate_for32bit_table (dest_desc, walk_state);
                break;
 
 
index 734e49b15b3effa4c25bfd8563b301a8b44b7884..f3a098bd2585a62d74b862e54f8463f2c4bd812c 100644 (file)
@@ -2,7 +2,7 @@
 /******************************************************************************
  *
  * Module Name: amstorob - AML Interpreter object store support, store to object
- *              $Revision: 16 $
+ *              $Revision: 18 $
  *
  *****************************************************************************/
 
@@ -294,6 +294,10 @@ acpi_aml_store_object_to_object (
        case ACPI_TYPE_NUMBER:
 
                dest_desc->number.value = val_desc->number.value;
+
+               /* Truncate value if we are executing from a 32-bit ACPI table */
+
+               acpi_aml_truncate_for32bit_table (dest_desc, walk_state);
                break;
 
        default:
index 8bfe5a1cbcaa2751fafe5acb70891197469242f4..9ad72c1615234cfec69790509dd978875c43bff6 100644 (file)
@@ -2,7 +2,7 @@
 /******************************************************************************
  *
  * Module Name: amsystem - Interface to OS services
- *              $Revision: 51 $
+ *              $Revision: 52 $
  *
  *****************************************************************************/
 
@@ -202,7 +202,7 @@ acpi_aml_system_acquire_mutex (
        }
 
        status = acpi_aml_system_wait_semaphore (obj_desc->mutex.semaphore,
-                         time_desc->number.value);
+                         (u32) time_desc->number.value);
        return (status);
 }
 
@@ -299,7 +299,7 @@ acpi_aml_system_wait_event (
 
        if (obj_desc) {
                status = acpi_aml_system_wait_semaphore (obj_desc->event.semaphore,
-                                 time_desc->number.value);
+                                 (u32) time_desc->number.value);
        }
 
 
index e888856522e88f241ae5098b090cc247eb1159b1..2c5e803fb74f6d88a42e3c8e7edfc327883a2f91 100644 (file)
@@ -2,7 +2,7 @@
 /******************************************************************************
  *
  * Module Name: amutils - interpreter/scanner utilities
- *              $Revision: 53 $
+ *              $Revision: 64 $
  *
  *****************************************************************************/
 
@@ -131,24 +131,44 @@ acpi_aml_validate_object_type (
 
 /*******************************************************************************
  *
- * FUNCTION:    Acpi_aml_buf_seq
+ * FUNCTION:    Acpi_aml_truncate_for32bit_table
  *
- * RETURN:      The next buffer descriptor sequence number
+ * PARAMETERS:  Obj_desc        - Object to be truncated
+ *              Walk_state      - Current walk state
+ *                                (A method must be executing)
  *
- * DESCRIPTION: Provide a unique sequence number for each Buffer descriptor
- *              allocated during the interpreter's existence.  These numbers
- *              are used to relate Field_unit descriptors to the Buffers
- *              within which the fields are defined.
+ * RETURN:      none
  *
- *              Just increment the global counter and return it.
+ * DESCRIPTION: Truncate a number to 32-bits if the currently executing method
+ *              belongs to a 32-bit ACPI table.
  *
  ******************************************************************************/
 
-u32
-acpi_aml_buf_seq (void)
+void
+acpi_aml_truncate_for32bit_table (
+       ACPI_OPERAND_OBJECT     *obj_desc,
+       ACPI_WALK_STATE         *walk_state)
 {
 
-       return (++acpi_gbl_buf_seq);
+       /*
+        * Object must be a valid number and we must be executing
+        * a control method
+        */
+
+       if ((!obj_desc) ||
+               (obj_desc->common.type != ACPI_TYPE_NUMBER) ||
+               (!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->number.value &= (UINT64) ACPI_UINT32_MAX;
+       }
 }
 
 
@@ -242,20 +262,18 @@ acpi_aml_release_global_lock (
 
 u32
 acpi_aml_digits_needed (
-       u32                     val,
+       ACPI_INTEGER            val,
        u32                     base)
 {
        u32                     num_digits = 0;
 
 
        if (base < 1) {
-               /*  impossible base */
-
-               REPORT_ERROR ("Aml_digits_needed: Impossible base");
+               REPORT_ERROR (("Aml_digits_needed: Internal error - Invalid base\n"));
        }
 
        else {
-               for (num_digits = 1 + (val < 0) ; val /= base ; ++num_digits) { ; }
+               for (num_digits = 1 + (val < 0); (val = ACPI_DIVIDE (val,base)); ++num_digits) { ; }
        }
 
        return (num_digits);
@@ -268,11 +286,11 @@ acpi_aml_digits_needed (
  *
  * PARAMETERS:  Value           - Value to be converted
  *
- * RETURN:      Convert a 32-bit value to big-endian (swap the bytes)
+ * DESCRIPTION: Convert a 32-bit value to big-endian (swap the bytes)
  *
  ******************************************************************************/
 
-u32
+static u32
 _ntohl (
        u32                     value)
 {
@@ -307,7 +325,7 @@ _ntohl (
  * PARAMETERS:  Numeric_id      - EISA ID to be converted
  *              Out_string      - Where to put the converted string (8 bytes)
  *
- * RETURN:      Convert a numeric EISA ID to string representation
+ * DESCRIPTION: Convert a numeric EISA ID to string representation
  *
  ******************************************************************************/
 
@@ -335,6 +353,39 @@ acpi_aml_eisa_id_to_string (
 }
 
 
+/*******************************************************************************
+ *
+ * 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);
+}
+
+
 /*******************************************************************************
  *
  * FUNCTION:    Acpi_aml_build_copy_internal_package_object
@@ -376,8 +427,8 @@ acpi_aml_build_copy_internal_package_object (
        level_ptr               = &copy_level[0];
        current_depth           = 0;
 
-       dest_obj->common.type       = source_obj->common.type;
-       dest_obj->package.count     = source_obj->package.count;
+       dest_obj->common.type   = source_obj->common.type;
+       dest_obj->package.count = source_obj->package.count;
 
 
        /*
@@ -391,7 +442,7 @@ acpi_aml_build_copy_internal_package_object (
        if (!dest_obj->package.elements) {
                /* Package vector allocation failure   */
 
-               REPORT_ERROR ("Aml_build_copy_internal_package_object: Package vector allocation failure");
+               REPORT_ERROR (("Aml_build_copy_internal_package_object: Package vector allocation failure\n"));
                return (AE_NO_MEMORY);
        }
 
@@ -400,8 +451,8 @@ acpi_aml_build_copy_internal_package_object (
 
        while (1) {
                this_index      = level_ptr->index;
-               this_dest_obj   = (ACPI_OPERAND_OBJECT  *) level_ptr->dest_obj->package.elements[this_index];
-               this_source_obj = (ACPI_OPERAND_OBJECT  *) level_ptr->source_obj->package.elements[this_index];
+               this_dest_obj   = (ACPI_OPERAND_OBJECT *) level_ptr->dest_obj->package.elements[this_index];
+               this_source_obj = (ACPI_OPERAND_OBJECT *) level_ptr->source_obj->package.elements[this_index];
 
                if (IS_THIS_OBJECT_TYPE (this_source_obj, ACPI_TYPE_PACKAGE)) {
                        /*
diff --git a/drivers/acpi/ksyms.c b/drivers/acpi/ksyms.c
new file mode 100644 (file)
index 0000000..cb4c5a4
--- /dev/null
@@ -0,0 +1,92 @@
+/*
+ *  ksyms.c - ACPI exported symbols
+ *
+ *  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/config.h>
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/types.h>
+#include <linux/acpi.h>
+#include "acpi.h"
+#include "acdebug.h"
+
+extern int acpi_in_debugger;
+
+#define _COMPONENT     OS_DEPENDENT
+       MODULE_NAME     ("symbols")
+
+#ifdef ENABLE_DEBUGGER
+EXPORT_SYMBOL(acpi_in_debugger);
+EXPORT_SYMBOL(acpi_db_user_commands);
+#endif
+
+EXPORT_SYMBOL(acpi_os_free);
+EXPORT_SYMBOL(acpi_os_breakpoint);
+EXPORT_SYMBOL(acpi_os_printf);
+EXPORT_SYMBOL(acpi_os_callocate);
+EXPORT_SYMBOL(acpi_os_sleep);
+EXPORT_SYMBOL(acpi_os_sleep_usec);
+EXPORT_SYMBOL(acpi_os_in8);
+EXPORT_SYMBOL(acpi_os_out8);
+EXPORT_SYMBOL(acpi_os_queue_for_execution);
+
+EXPORT_SYMBOL(acpi_dbg_layer);
+EXPORT_SYMBOL(acpi_dbg_level);
+EXPORT_SYMBOL(function_exit);
+EXPORT_SYMBOL(function_trace);
+EXPORT_SYMBOL(function_status_exit);
+EXPORT_SYMBOL(function_value_exit);
+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_get_handle);
+EXPORT_SYMBOL(acpi_get_parent);
+EXPORT_SYMBOL(acpi_get_type);
+EXPORT_SYMBOL(acpi_get_name);
+EXPORT_SYMBOL(acpi_get_object_info);
+EXPORT_SYMBOL(acpi_get_next_object);
+EXPORT_SYMBOL(acpi_evaluate_object);
+
+EXPORT_SYMBOL(acpi_install_notify_handler);
+EXPORT_SYMBOL(acpi_remove_notify_handler);
+EXPORT_SYMBOL(acpi_install_gpe_handler);
+EXPORT_SYMBOL(acpi_remove_gpe_handler);
+EXPORT_SYMBOL(acpi_install_address_space_handler);
+EXPORT_SYMBOL(acpi_remove_address_space_handler);
+
+EXPORT_SYMBOL(acpi_get_current_resources);
+EXPORT_SYMBOL(acpi_get_possible_resources);
+EXPORT_SYMBOL(acpi_set_current_resources);
+
+EXPORT_SYMBOL(acpi_enable_event);
+EXPORT_SYMBOL(acpi_disable_event);
+EXPORT_SYMBOL(acpi_clear_event);
+
+EXPORT_SYMBOL(acpi_get_processor_throttling_info);
+EXPORT_SYMBOL(acpi_get_processor_throttling_state);
+EXPORT_SYMBOL(acpi_set_processor_throttling_state);
+
+EXPORT_SYMBOL(acpi_get_processor_cx_info);
+EXPORT_SYMBOL(acpi_set_processor_sleep_state);
+EXPORT_SYMBOL(acpi_processor_sleep);
index edd89713320bbf7177a46838fb379b30259e39fb..751ef5de8f1902c93309a10e6556b84e3b5e6d78 100644 (file)
@@ -2,26 +2,14 @@
 # Makefile for all Linux ACPI interpreter subdirectories
 #
 
-SUB_DIRS        := 
-MOD_SUB_DIRS    := $(SUB_DIRS)
-MOD_IN_SUB_DIRS :=
-ALL_SUB_DIRS    := $(SUB_DIRS)
-
 O_TARGET := ../$(shell basename `pwd`).o
-O_OBJS   :=
-M_OBJS   :=
 
-ACPI_OBJS := $(patsubst %.c,%.o,$(wildcard *.c))
+obj-$(CONFIG_ACPI) := $(patsubst %.c,%.o,$(wildcard *.c))
 
 EXTRA_CFLAGS += -I../include
 
 EXTRA_CFLAGS += $(ACPI_CFLAGS)
 
-# if the interpreter is used, it overrides arch/i386/kernel/acpi.c
-ifeq ($(CONFIG_ACPI_INTERPRETER),y)
-  O_OBJS := $(ACPI_OBJS)
-endif
-
 include $(TOPDIR)/Rules.make
 
 clean:
index e04ffe4e9b8382ddb7825ce5fba9b884c0483e08..4b420edff12c5cc6ddb848e9344e09e7fc7b3289 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************************
  *
  * Module Name: nsaccess - Top-level functions for accessing ACPI namespace
- *              $Revision: 108 $
+ *              $Revision: 115 $
  *
  ******************************************************************************/
 
@@ -87,8 +87,6 @@ acpi_ns_root_initialize (void)
                                 IMODE_LOAD_PASS2, NS_NO_UPSEARCH,
                                 NULL, &new_node);
 
-               if (ACPI_FAILURE (status) ||
-                       (!new_node))
 
                /*
                 * Name entered successfully.
@@ -122,7 +120,7 @@ acpi_ns_root_initialize (void)
                        case ACPI_TYPE_NUMBER:
 
                                obj_desc->number.value =
-                                               (u32) STRTOUL (init_val->val, NULL, 10);
+                                               (ACPI_INTEGER) STRTOUL (init_val->val, NULL, 10);
                                break;
 
 
@@ -138,11 +136,7 @@ acpi_ns_root_initialize (void)
                                 */
                                obj_desc->string.pointer = acpi_cm_allocate (
                                                   (obj_desc->string.length + 1));
-
                                if (!obj_desc->string.pointer) {
-                                       REPORT_ERROR ("Initial value string"
-                                                         "allocation failure");
-
                                        acpi_cm_remove_reference (obj_desc);
                                        status = AE_NO_MEMORY;
                                        goto unlock_and_exit;
@@ -190,7 +184,8 @@ acpi_ns_root_initialize (void)
 
 
                        default:
-                               REPORT_ERROR ("Unsupported initial type value");
+                               REPORT_ERROR (("Unsupported initial type value %X\n",
+                                       init_val->type));
                                acpi_cm_remove_reference (obj_desc);
                                obj_desc = NULL;
                                continue;
@@ -254,6 +249,9 @@ acpi_ns_lookup (
        OBJECT_TYPE_INTERNAL    type_to_check_for;
        OBJECT_TYPE_INTERNAL    this_search_type;
 
+       DEBUG_ONLY_MEMBERS      (u32 i)
+
+
        if (!return_node) {
                return (AE_BAD_PARAMETER);
        }
@@ -379,8 +377,7 @@ acpi_ns_lookup (
                                if (!this_node) {
                                        /* Current scope has no parent scope */
 
-                                       REPORT_ERROR ("Too many parent prefixes (^) - reached root");
-
+                                       REPORT_ERROR (("Too many parent prefixes (^) - reached root\n"));
                                        return (AE_NOT_FOUND);
                                }
 
@@ -442,7 +439,7 @@ acpi_ns_lookup (
                        this_search_type = type;
                }
 
-               /* Pluck and ACPI name from the front of the pathname */
+               /* Pluck one ACPI name from the front of the pathname */
 
                MOVE_UNALIGNED32_TO_32 (&simple_name, pathname);
 
@@ -467,25 +464,29 @@ acpi_ns_lookup (
                 * If 1) This is the last segment (Num_segments == 0)
                 *    2) and looking for a specific type
                 *       (Not checking for TYPE_ANY)
-                *    3) which is not a local type (TYPE_DEF_ANY)
-                *    4) which is not a local type (TYPE_SCOPE)
-                *    5) which is not a local type (TYPE_INDEX_FIELD_DEFN)
-                *    6) and type of object is known (not TYPE_ANY)
-                *    7) and object does not match request
+                *    3) Which is not an alias
+                *    4) which is not a local type (TYPE_DEF_ANY)
+                *    5) which is not a local type (TYPE_SCOPE)
+                *    6) which is not a local type (TYPE_INDEX_FIELD_DEFN)
+                *    7) and type of object is known (not TYPE_ANY)
+                *    8) and object does not match request
                 *
                 * Then we have a type mismatch.  Just warn and ignore it.
                 */
                if ((num_segments       == 0)                               &&
                        (type_to_check_for  != ACPI_TYPE_ANY)                   &&
+                       (type_to_check_for  != INTERNAL_TYPE_ALIAS)             &&
                        (type_to_check_for  != INTERNAL_TYPE_DEF_ANY)           &&
                        (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    != ACPI_TYPE_ANY)                   &&
+                       (this_node->type    != type_to_check_for))
                {
                        /* Complain about a type mismatch */
 
-                       REPORT_WARNING ("Type mismatch");
+                       REPORT_WARNING (
+                               ("Ns_lookup: %4.4s, type %X, checking for type %X\n",
+                               &simple_name, this_node->type, type_to_check_for));
                }
 
                /*
index 0b8272724a473e85ddbaba75b8607c7599787363..9f1d5377e2235941f648ff86408a138405c04493 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************************
  *
  * Module Name: nsalloc - Namespace allocation and deletion utilities
- *              $Revision: 41 $
+ *              $Revision: 43 $
  *
  ******************************************************************************/
 
@@ -434,7 +434,7 @@ acpi_ns_delete_namespace_subtree (
  *
  ******************************************************************************/
 
-void
+static void
 acpi_ns_remove_reference (
        ACPI_NAMESPACE_NODE     *node)
 {
diff --git a/drivers/acpi/namespace/nsdump.c b/drivers/acpi/namespace/nsdump.c
deleted file mode 100644 (file)
index 117af81..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-/******************************************************************************
- *
- * Module Name: nsdump - table dumping routines for debug
- *              $Revision: 78 $
- *
- *****************************************************************************/
-
-/*
- *  Copyright (C) 2000 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"
-
-
-#define _COMPONENT          NAMESPACE
-        MODULE_NAME         ("nsdump")
-
-
index 2df17e94f333a33dfb96a0c7c5dd968287962a36..fbba7840cf6f81ef9faa8e722b1917579f412c7f 100644 (file)
@@ -2,7 +2,7 @@
  *
  * Module Name: nseval - Object evaluation interfaces -- includes control
  *                       method lookup and execution.
- *              $Revision: 76 $
+ *              $Revision: 79 $
  *
  ******************************************************************************/
 
@@ -99,7 +99,7 @@ acpi_ns_evaluate_relative (
 
        /* Lookup the name in the namespace */
 
-       scope_info.scope.node = prefix_node->child;
+       scope_info.scope.node = prefix_node;
        status = acpi_ns_lookup (&scope_info, internal_path, ACPI_TYPE_ANY,
                         IMODE_EXECUTE, NS_NO_UPSEARCH, NULL,
                         &node);
@@ -432,28 +432,14 @@ acpi_ns_get_object_value (
                }
 
                /*
-                *  Just copy from the original to the return object
+                * Just copy from the original to the return object
+                *
+                * TBD: [Future] - need a low-level object copy that handles
+                * the reference count automatically.  (Don't want to copy it)
                 */
 
-               switch (node->type)
-               {
-               case ACPI_TYPE_PROCESSOR:
-                  obj_desc->processor.proc_id      = val_desc->processor.proc_id;
-                  obj_desc->processor.address      = val_desc->processor.address;
-                  obj_desc->processor.sys_handler  = val_desc->processor.sys_handler;
-                  obj_desc->processor.drv_handler  = val_desc->processor.drv_handler;
-                  obj_desc->processor.addr_handler = val_desc->processor.addr_handler;
-
-                  break;
-
-               case ACPI_TYPE_POWER:
-                       obj_desc->power_resource.system_level   = val_desc->power_resource.system_level;
-                       obj_desc->power_resource.resource_order = val_desc->power_resource.resource_order;
-                       obj_desc->power_resource.sys_handler    = val_desc->power_resource.sys_handler;
-                       obj_desc->power_resource.drv_handler    = val_desc->power_resource.drv_handler;
-
-                       break;
-               }
+               MEMCPY (obj_desc, val_desc, sizeof (ACPI_OPERAND_OBJECT));
+               obj_desc->common.reference_count = 1;
        }
 
 
@@ -483,9 +469,17 @@ acpi_ns_get_object_value (
                 * 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.
                 */
 
+               acpi_aml_enter_interpreter();
+
                status = acpi_aml_resolve_to_value (&obj_desc, NULL);
+
+               acpi_aml_exit_interpreter();
        }
 
        /*
diff --git a/drivers/acpi/namespace/nsinit.c b/drivers/acpi/namespace/nsinit.c
new file mode 100644 (file)
index 0000000..ddacd7b
--- /dev/null
@@ -0,0 +1,271 @@
+/******************************************************************************
+ *
+ * Module Name: nsinit - namespace initialization
+ *              $Revision: 9 $
+ *
+ *****************************************************************************/
+
+/*
+ *  Copyright (C) 2000 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 "acdispat.h"
+
+#define _COMPONENT          NAMESPACE
+        MODULE_NAME         ("nsinit")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ns_initialize_objects
+ *
+ * PARAMETERS:  None
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Walk the entire namespace and perform any necessary
+ *              initialization on the objects found therein
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_ns_initialize_objects (
+       void)
+{
+       ACPI_STATUS             status;
+       ACPI_INIT_WALK_INFO     info;
+
+
+       info.field_count = 0;
+       info.field_init = 0;
+       info.op_region_count = 0;
+       info.op_region_init = 0;
+       info.object_count = 0;
+
+
+       /* Walk entire namespace from the supplied root */
+
+       status = acpi_walk_namespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
+                         ACPI_UINT32_MAX, acpi_ns_init_one_object,
+                         &info, NULL);
+
+       return (AE_OK);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION:    Acpi_ns_initialize_devices
+ *
+ * PARAMETERS:  None
+ *
+ * RETURN:      ACPI_STATUS
+ *
+ * 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")
+ *
+ *****************************************************************************/
+
+ACPI_STATUS
+acpi_ns_initialize_devices (
+       u32                     flags)
+{
+       ACPI_STATUS             status;
+       ACPI_DEVICE_WALK_INFO   info;
+
+
+       info.flags = flags;
+       info.device_count = 0;
+       info.num_STA = 0;
+       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);
+
+
+
+       return (status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ns_init_one_object
+ *
+ * PARAMETERS:  Obj_handle      - Node
+ *              Level           - Current nesting level
+ *              Context         - Points to a init info struct
+ *              Return_value    - Not used
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Callback from Acpi_walk_namespace. Invoked for every object
+ *              within the  namespace.
+ *
+ *              Currently, the only objects that require initialization are:
+ *              1) Methods
+ *              2) Op Regions
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_ns_init_one_object (
+       ACPI_HANDLE             obj_handle,
+       u32                     level,
+       void                    *context,
+       void                    **return_value)
+{
+       OBJECT_TYPE_INTERNAL    type;
+       ACPI_STATUS             status;
+       ACPI_INIT_WALK_INFO     *info = (ACPI_INIT_WALK_INFO *) context;
+       ACPI_NAMESPACE_NODE     *node = (ACPI_NAMESPACE_NODE *) obj_handle;
+       ACPI_OPERAND_OBJECT     *obj_desc;
+
+
+       info->object_count++;
+
+
+       /* And even then, we are only interested in a few object types */
+
+       type = acpi_ns_get_type (obj_handle);
+       obj_desc = node->object;
+       if (!obj_desc) {
+               return (AE_OK);
+       }
+
+       switch (type)
+       {
+
+       case ACPI_TYPE_REGION:
+
+               info->op_region_count++;
+               if (obj_desc->common.flags & AOPOBJ_DATA_VALID) {
+                       break;
+               }
+
+               info->op_region_init++;
+               status = acpi_ds_get_region_arguments (obj_desc);
+
+               break;
+
+
+       case ACPI_TYPE_FIELD_UNIT:
+
+               info->field_count++;
+               if (obj_desc->common.flags & AOPOBJ_DATA_VALID) {
+                       break;
+               }
+
+               info->field_init++;
+               status = acpi_ds_get_field_unit_arguments (obj_desc);
+               break;
+
+       default:
+               break;
+       }
+
+       /*
+        * We ignore errors from above, and always return OK, since
+        * we don't want to abort the walk on a single error.
+        */
+       return (AE_OK);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION:    Acpi_ns_init_one_device
+ *
+ * PARAMETERS:  The usual "I'm a namespace callback" stuff
+ *
+ * RETURN:      ACPI_STATUS
+ *
+ * DESCRIPTION: This is called once per device soon after ACPI is enabled
+ *              to initialize each device. It determines if the device is
+ *              present, and if so, calls _INI.
+ *
+ *****************************************************************************/
+
+ACPI_STATUS
+acpi_ns_init_one_device (
+       ACPI_HANDLE             obj_handle,
+       u32                     nesting_level,
+       void                    *context,
+       void                    **return_value)
+{
+       ACPI_STATUS             status;
+       ACPI_NAMESPACE_NODE    *node;
+       u32                     flags;
+       ACPI_DEVICE_WALK_INFO  *info = (ACPI_DEVICE_WALK_INFO *) context;
+
+
+       info->device_count++;
+
+       acpi_cm_acquire_mutex (ACPI_MTX_NAMESPACE);
+
+       node = acpi_ns_convert_handle_to_entry (obj_handle);
+       if (!node) {
+               acpi_cm_release_mutex (ACPI_MTX_NAMESPACE);
+               return (AE_BAD_PARAMETER);
+       }
+
+       acpi_cm_release_mutex (ACPI_MTX_NAMESPACE);
+
+       /*
+        * Run _STA to determine if we can run _INI on the device.
+        */
+
+       status = acpi_cm_execute_STA (node, &flags);
+       if (ACPI_FAILURE (status)) {
+               return (status);
+       }
+
+       info->num_STA++;
+
+       if (!(flags & 0x01)) {
+               /* don't look at children of a not present device */
+               return(AE_CTRL_DEPTH);
+       }
+
+       /*
+        * 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;
+       }
+
+       else if (ACPI_FAILURE (status)) {
+               return (status);
+       }
+
+       else {
+               info->num_INI++;
+       }
+
+       return (status);
+}
index 8faa8ea4fc31b1eaeaf7421c77e62eb6c6d91ab7..28a26376d4002da06d179f225af9e2aff2ab3386 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: nsload - namespace loading/expanding/contracting procedures
- *              $Revision: 28 $
+ *              $Revision: 33 $
  *
  *****************************************************************************/
 
         MODULE_NAME         ("nsload")
 
 
+/******************************************************************************
+ *
+ * FUNCTION:    Acpi_load_namespace
+ *
+ * PARAMETERS:  Display_aml_during_load
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Load the name space from what ever is pointed to by DSDT.
+ *              (DSDT points to either the BIOS or a buffer.)
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_ns_load_namespace (
+       void)
+{
+       ACPI_STATUS             status;
+
+
+       /* There must be at least a DSDT installed */
+
+       if (acpi_gbl_DSDT == NULL) {
+               return (AE_NO_ACPI_TABLES);
+       }
+
+
+       /*
+        * Load the namespace.  The DSDT is required,
+        * but the SSDT and PSDT tables are optional.
+        */
+
+       status = acpi_ns_load_table_by_type (ACPI_TABLE_DSDT);
+       if (ACPI_FAILURE (status)) {
+               return (status);
+       }
+
+       /* Ignore exceptions from these */
+
+       acpi_ns_load_table_by_type (ACPI_TABLE_SSDT);
+       acpi_ns_load_table_by_type (ACPI_TABLE_PSDT);
+
+
+       return (status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ns_one_parse_pass
+ *
+ * PARAMETERS:
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION:
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_ns_one_complete_parse (
+       u32                     pass_number,
+       ACPI_TABLE_DESC         *table_desc)
+{
+       ACPI_PARSE_DOWNWARDS    descending_callback;
+       ACPI_PARSE_UPWARDS      ascending_callback;
+       ACPI_PARSE_OBJECT       *parse_root;
+       ACPI_STATUS             status;
+
+
+       switch (pass_number)
+       {
+       case 1:
+               descending_callback = acpi_ds_load1_begin_op;
+               ascending_callback = acpi_ds_load1_end_op;
+               break;
+
+       case 2:
+               descending_callback = acpi_ds_load2_begin_op;
+               ascending_callback = acpi_ds_load2_end_op;
+               break;
+
+       case 3:
+               descending_callback = acpi_ds_exec_begin_op;
+               ascending_callback = acpi_ds_exec_end_op;
+               break;
+
+       default:
+               return (AE_BAD_PARAMETER);
+       }
+
+       /* Create and init a Root Node */
+
+       parse_root = acpi_ps_alloc_op (AML_SCOPE_OP);
+       if (!parse_root) {
+               return (AE_NO_MEMORY);
+       }
+
+       ((ACPI_PARSE2_OBJECT *) parse_root)->name = ACPI_ROOT_NAME;
+
+
+       /* Pass 1:  Parse everything except control method bodies */
+
+       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,
+                        ascending_callback);
+
+       acpi_ps_delete_parse_tree (parse_root);
+
+       return (status);
+}
+
+
 /*******************************************************************************
  *
  * FUNCTION:    Acpi_ns_parse_table
@@ -69,32 +186,11 @@ acpi_ns_parse_table (
         * performs another complete parse of the AML..
         */
 
-       /* Create and init a Root Node */
-
-       acpi_gbl_parsed_namespace_root = acpi_ps_alloc_op (AML_SCOPE_OP);
-       if (!acpi_gbl_parsed_namespace_root) {
-               return (AE_NO_MEMORY);
-       }
-
-       ((ACPI_PARSE2_OBJECT *) acpi_gbl_parsed_namespace_root)->name = ACPI_ROOT_NAME;
-
-
-       /* Pass 1:  Parse everything except control method bodies */
-
-       status = acpi_ps_parse_aml (acpi_gbl_parsed_namespace_root,
-                        table_desc->aml_pointer,
-                        table_desc->aml_length,
-                        ACPI_PARSE_LOAD_PASS1 | ACPI_PARSE_DELETE_TREE,
-                        NULL, NULL, NULL,
-                        acpi_ds_load1_begin_op,
-                        acpi_ds_load1_end_op);
-
+       status = acpi_ns_one_complete_parse (1, table_desc);
        if (ACPI_FAILURE (status)) {
                return (status);
        }
 
-       acpi_ps_delete_parse_tree (acpi_gbl_parsed_namespace_root);
-
 
        /*
         * AML Parse, pass 2
@@ -106,34 +202,11 @@ acpi_ns_parse_table (
         * parse objects are all cached.
         */
 
-       /* Create and init a Root Node */
-
-       acpi_gbl_parsed_namespace_root = acpi_ps_alloc_op (AML_SCOPE_OP);
-       if (!acpi_gbl_parsed_namespace_root) {
-               return (AE_NO_MEMORY);
-       }
-
-       ((ACPI_PARSE2_OBJECT *) acpi_gbl_parsed_namespace_root)->name = ACPI_ROOT_NAME;
-
-
-       /* Pass 2: Resolve forward references */
-
-       status = acpi_ps_parse_aml (acpi_gbl_parsed_namespace_root,
-                        table_desc->aml_pointer,
-                        table_desc->aml_length,
-                        ACPI_PARSE_LOAD_PASS1 | ACPI_PARSE_DELETE_TREE,
-                        NULL, NULL, NULL,
-                        acpi_ds_load2_begin_op,
-                        acpi_ds_load2_end_op);
-
+       status = acpi_ns_one_complete_parse (2, table_desc);
        if (ACPI_FAILURE (status)) {
                return (status);
        }
 
-       acpi_ps_delete_parse_tree (acpi_gbl_parsed_namespace_root);
-       acpi_gbl_parsed_namespace_root = NULL;
-
-
        return (status);
 }
 
@@ -147,8 +220,7 @@ acpi_ns_parse_table (
  *
  * RETURN:      Status
  *
- * DESCRIPTION: Mainline of the AML load/dump subsystem. Sets up the
- *              input engine, calls handler for outermost object type.
+ * DESCRIPTION: Load one ACPI table into the namespace
  *
  ****************************************************************************/
 
@@ -248,13 +320,6 @@ acpi_ns_load_table_by_type (
 
                table_desc->table_id = TABLE_ID_DSDT;
 
-               /* Initialize the root of the namespace tree */
-
-               status = acpi_ns_root_initialize ();
-               if (ACPI_FAILURE (status)) {
-                       goto unlock_and_exit;
-               }
-
                /* Now load the single DSDT */
 
                status = acpi_ns_load_table (table_desc, acpi_gbl_root_node);
index 3c18cf87f894b2e59b91b9d248d58935ad1e2137..faf8fe56a2417480b29ea814d03ee3b782ec30a9 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************************
  *
  * Module Name: nsnames - Name manipulation and search
- *              $Revision: 48 $
+ *              $Revision: 51 $
  *
  ******************************************************************************/
 
@@ -86,7 +86,7 @@ acpi_ns_get_table_pathname (
 
        name_buffer = acpi_cm_callocate (size + 1);
        if (!name_buffer) {
-               REPORT_ERROR ("Ns_get_table_pathname: allocation failure");
+               REPORT_ERROR (("Ns_get_table_pathname: allocation failure\n"));
                return (NULL);
        }
 
@@ -170,6 +170,12 @@ acpi_ns_handle_to_pathname (
                size += PATH_SEGMENT_LENGTH;
        }
 
+       /* Special case for size still 0 - no parent for "special" nodes */
+
+       if (!size) {
+               size = PATH_SEGMENT_LENGTH;
+       }
+
        /* Set return length to the required path length */
 
        path_length = size + 1;
index df4c282399a97699badcf91f8c8cd0eb60db3516..6d41b91ce3af02e81d1886962d635b0ed0e023be 100644 (file)
@@ -2,7 +2,7 @@
  *
  * Module Name: nsobject - Utilities for objects attached to namespace
  *                         table entries
- *              $Revision: 44 $
+ *              $Revision: 47 $
  *
  ******************************************************************************/
 
@@ -73,29 +73,28 @@ acpi_ns_attach_object (
        if (!acpi_gbl_root_node) {
                /* Name space not initialized  */
 
-               REPORT_ERROR ("Ns_attach_object: Name space not initialized");
+               REPORT_ERROR (("Ns_attach_object: Namespace not initialized\n"));
                return (AE_NO_NAMESPACE);
        }
 
        if (!node) {
                /* Invalid handle */
 
-               REPORT_ERROR ("Ns_attach_object: Null Named_obj handle");
+               REPORT_ERROR (("Ns_attach_object: Null Named_obj handle\n"));
                return (AE_BAD_PARAMETER);
        }
 
        if (!object && (ACPI_TYPE_ANY != type)) {
                /* Null object */
 
-               REPORT_ERROR ("Ns_attach_object: Null object, but type"
-                                 "not ACPI_TYPE_ANY");
+               REPORT_ERROR (("Ns_attach_object: Null object, but type not ACPI_TYPE_ANY\n"));
                return (AE_BAD_PARAMETER);
        }
 
        if (!VALID_DESCRIPTOR_TYPE (node, ACPI_DESC_TYPE_NAMED)) {
                /* Not a name handle */
 
-               REPORT_ERROR ("Ns_attach_object: Invalid handle");
+               REPORT_ERROR (("Ns_attach_object: Invalid handle\n"));
                return (AE_BAD_PARAMETER);
        }
 
@@ -355,7 +354,6 @@ acpi_ns_get_attached_object (
        if (!handle) {
                /* handle invalid */
 
-               REPORT_WARNING ("Ns_get_attached_object: Null handle");
                return (NULL);
        }
 
index b6abbd7829daa493095cb62658312f883b22d812..78cb405854bb32230402cc49fc0e61edbf194d29 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************************
  *
  * Module Name: nssearch - Namespace search
- *              $Revision: 57 $
+ *              $Revision: 60 $
  *
  ******************************************************************************/
 
@@ -169,7 +169,7 @@ acpi_ns_search_node (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+static ACPI_STATUS
 acpi_ns_search_parent_tree (
        u32                     target_name,
        ACPI_NAMESPACE_NODE     *node,
@@ -270,7 +270,7 @@ acpi_ns_search_and_enter (
        /* Parameter validation */
 
        if (!node || !target_name || !return_node) {
-               REPORT_ERROR ("Ns_search_and_enter: bad (null)parameter");
+               REPORT_ERROR (("Ns_search_and_enter: bad (null) parameter\n"));
                return (AE_BAD_PARAMETER);
        }
 
@@ -278,7 +278,7 @@ acpi_ns_search_and_enter (
        /* Name must consist of printable characters */
 
        if (!acpi_cm_valid_acpi_name (target_name)) {
-               REPORT_ERROR ("Ns_search_and_enter: Bad character in ACPI Name");
+               REPORT_ERROR (("Ns_search_and_enter: Bad character in ACPI Name\n"));
                return (AE_BAD_CHARACTER);
        }
 
index 3d5a98a0753ae76b3451ca670d7f6821fc4f51ed..593064dbb97e6968df110fc45f6c9c423089ed02 100644 (file)
@@ -2,7 +2,7 @@
  *
  * Module Name: nsutils - Utilities for accessing ACPI namespace, accessing
  *                        parents and siblings and Scope manipulation
- *              $Revision: 69 $
+ *              $Revision: 74 $
  *
  *****************************************************************************/
 
@@ -93,7 +93,7 @@ acpi_ns_get_type (
 {
 
        if (!handle) {
-               REPORT_WARNING ("Ns_get_type: Null handle");
+               REPORT_WARNING (("Ns_get_type: Null handle\n"));
                return (ACPI_TYPE_ANY);
        }
 
@@ -120,7 +120,7 @@ acpi_ns_local (
        if (!acpi_cm_valid_object_type (type)) {
                /* Type code out of range  */
 
-               REPORT_WARNING ("Ns_local: Invalid Object Type");
+               REPORT_WARNING (("Ns_local: Invalid Object Type\n"));
                return (NSP_NORMAL);
        }
 
@@ -150,9 +150,10 @@ acpi_ns_internalize_name (
 {
        NATIVE_CHAR             *result = NULL;
        NATIVE_CHAR             *internal_name;
-       u32                     num_segments;
+       u32                     num_segments = 0;
        u8                      fully_qualified = FALSE;
        u32                     i;
+       u32                     num_carats = 0;
 
 
        if ((!external_name)     ||
@@ -178,6 +179,16 @@ acpi_ns_internalize_name (
                external_name++;
        }
 
+       else {
+               /*
+                * Handle Carat prefixes
+                */
+
+               while (*external_name == '^') {
+                       num_carats++;
+                       external_name++;
+               }
+       }
 
        /*
         * Determine the number of ACPI name "segments" by counting
@@ -186,17 +197,19 @@ acpi_ns_internalize_name (
         * + 1, and zero separators is ok.
         */
 
-       num_segments = 1;
-       for (i = 0; external_name[i]; i++) {
-               if (acpi_ns_valid_path_separator (external_name[i])) {
-                       num_segments++;
+       if (*external_name) {
+               num_segments = 1;
+               for (i = 0; external_name[i]; i++) {
+                       if (acpi_ns_valid_path_separator (external_name[i])) {
+                               num_segments++;
+                       }
                }
        }
 
 
        /* We need a segment to store the internal version of the name */
 
-       internal_name = acpi_cm_callocate ((ACPI_NAME_SIZE * num_segments) + 4);
+       internal_name = acpi_cm_callocate ((ACPI_NAME_SIZE * num_segments) + 4 + num_carats);
        if (!internal_name) {
                return (AE_NO_MEMORY);
        }
@@ -206,14 +219,49 @@ acpi_ns_internalize_name (
 
        if (fully_qualified) {
                internal_name[0] = '\\';
-               internal_name[1] = AML_MULTI_NAME_PREFIX_OP;
-               internal_name[2] = (char) num_segments;
-               result = &internal_name[3];
+
+               if (num_segments <= 1) {
+                       result = &internal_name[1];
+               }
+               else if (num_segments == 2) {
+                       internal_name[1] = AML_DUAL_NAME_PREFIX;
+                       result = &internal_name[2];
+               }
+               else {
+                       internal_name[1] = AML_MULTI_NAME_PREFIX_OP;
+                       internal_name[2] = (char) num_segments;
+                       result = &internal_name[3];
+               }
+
        }
+
        else {
-               internal_name[0] = AML_MULTI_NAME_PREFIX_OP;
-               internal_name[1] = (char) num_segments;
-               result = &internal_name[2];
+               /*
+                * Not fully qualified.
+                * Handle Carats first, then append the name segments
+                */
+
+               i = 0;
+               if (num_carats) {
+                       for (i = 0; i < num_carats; i++) {
+                               internal_name[i] = '^';
+                       }
+               }
+
+               if (num_segments == 1) {
+                       result = &internal_name[i];
+               }
+
+               else if (num_segments == 2) {
+                       internal_name[i] = AML_DUAL_NAME_PREFIX;
+                       result = &internal_name[i+1];
+               }
+
+               else {
+                       internal_name[i] = AML_MULTI_NAME_PREFIX_OP;
+                       internal_name[i+1] = (char) num_segments;
+                       result = &internal_name[i+2];
+               }
        }
 
 
@@ -269,6 +317,157 @@ acpi_ns_internalize_name (
 }
 
 
+/****************************************************************************
+ *
+ * FUNCTION:    Acpi_ns_externalize_name
+ *
+ * PARAMETERS:  *Internal_name         - Internal representation of name
+ *              **Converted_name       - Where to return the resulting
+ *                                        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 (
+       u32                     internal_name_length,
+       char                    *internal_name,
+       u32                     *converted_name_length,
+       char                    **converted_name)
+{
+       u32                     prefix_length = 0;
+       u32                     names_index = 0;
+       u32                     names_count = 0;
+       u32                     i = 0;
+       u32                     j = 0;
+
+
+       if (!internal_name_length   ||
+               !internal_name          ||
+               !converted_name_length  ||
+               !converted_name)
+       {
+               return (AE_BAD_PARAMETER);
+       }
+
+
+       /*
+        * Check for a prefix (one '\' | one or more '^').
+        */
+       switch (internal_name[0])
+       {
+       case '\\':
+               prefix_length = 1;
+               break;
+
+       case '^':
+               for (i = 0; i < internal_name_length; i++) {
+                       if (internal_name[i] != '^') {
+                               prefix_length = i + 1;
+                       }
+               }
+
+               if (i == internal_name_length) {
+                       prefix_length = i;
+               }
+
+               break;
+       }
+
+       /*
+        * Check for object names.  Note that there could be 0-255 of these
+        * 4-byte elements.
+        */
+       if (prefix_length < internal_name_length) {
+               switch (internal_name[prefix_length])
+               {
+
+               /* <count> 4-byte names */
+
+               case AML_MULTI_NAME_PREFIX_OP:
+                       names_index = prefix_length + 2;
+                       names_count = (u32) internal_name[prefix_length + 1];
+                       break;
+
+
+               /* two 4-byte names */
+
+               case AML_DUAL_NAME_PREFIX:
+                       names_index = prefix_length + 1;
+                       names_count = 2;
+                       break;
+
+
+               /* Null_name */
+
+               case 0:
+                       names_index = 0;
+                       names_count = 0;
+                       break;
+
+
+               /* one 4-byte name */
+
+               default:
+                       names_index = prefix_length;
+                       names_count = 1;
+                       break;
+               }
+       }
+
+       /*
+        * Calculate the length of Converted_name, which equals the length
+        * of the prefix, length of all object names, length of any required
+        * punctuation ('.') between object names, plus the NULL terminator.
+        */
+       *converted_name_length = prefix_length + (4 * names_count) +
+                          ((names_count > 0) ? (names_count - 1) : 0) + 1;
+
+       /*
+        * Check to see if we're still in bounds.  If not, there's a problem
+        * with Internal_name (invalid format).
+        */
+       if (*converted_name_length > internal_name_length) {
+               REPORT_ERROR (("Ns_externalize_name: Invalid internal name\n"));
+               return (AE_BAD_PATHNAME);
+       }
+
+       /*
+        * Build Converted_name...
+        */
+
+       (*converted_name) = acpi_cm_callocate (*converted_name_length);
+       if (!(*converted_name)) {
+               return (AE_NO_MEMORY);
+       }
+
+       j = 0;
+
+       for (i = 0; i < prefix_length; i++) {
+               (*converted_name)[j++] = internal_name[i];
+       }
+
+       if (names_count > 0) {
+               for (i = 0; i < names_count; i++) {
+                       if (i > 0) {
+                               (*converted_name)[j++] = '.';
+                       }
+
+                       (*converted_name)[j++] = internal_name[names_index++];
+                       (*converted_name)[j++] = internal_name[names_index++];
+                       (*converted_name)[j++] = internal_name[names_index++];
+                       (*converted_name)[j++] = internal_name[names_index++];
+               }
+       }
+
+       return (AE_OK);
+}
+
+
 /****************************************************************************
  *
  * FUNCTION:    Acpi_ns_convert_handle_to_entry
@@ -425,7 +624,7 @@ acpi_ns_opens_scope (
        if (!acpi_cm_valid_object_type (type)) {
                /* type code out of range  */
 
-               REPORT_WARNING ("Ns_opens_scope: Invalid Object Type");
+               REPORT_WARNING (("Ns_opens_scope: Invalid Object Type\n"));
                return (NSP_NORMAL);
        }
 
@@ -464,8 +663,6 @@ acpi_ns_get_node (
        NATIVE_CHAR             *internal_path = NULL;
 
 
-       scope_info.scope.node = start_node;
-
        /* Ensure that the namespace has been initialized */
 
        if (!acpi_gbl_root_node) {
@@ -487,19 +684,9 @@ acpi_ns_get_node (
 
        acpi_cm_acquire_mutex (ACPI_MTX_NAMESPACE);
 
-       /* NS_ALL means start from the root */
-
-       if (NS_ALL == scope_info.scope.node) {
-               scope_info.scope.node = acpi_gbl_root_node;
-       }
+       /* Setup lookup scope (search starting point) */
 
-       else {
-               scope_info.scope.node = start_node;
-               if (!scope_info.scope.node) {
-                       status = AE_BAD_PARAMETER;
-                       goto unlock_and_exit;
-               }
-       }
+       scope_info.scope.node = start_node;
 
        /* Lookup the name in the namespace */
 
@@ -510,8 +697,6 @@ acpi_ns_get_node (
 
 
 
-unlock_and_exit:
-
        acpi_cm_release_mutex (ACPI_MTX_NAMESPACE);
 
        /* Cleanup */
@@ -579,6 +764,10 @@ acpi_ns_get_parent_object (
 {
 
 
+       if (!node) {
+               return (NULL);
+       }
+
        /*
         * Walk to the end of this peer list.
         * The last entry is marked with a flag and the peer
index dc02c6407d738439feba8328b4c57095a92e6396..2947f7f06eba976a3249571b97fba1d5a859f024 100644 (file)
@@ -2,7 +2,7 @@
  *
  * Module Name: nsxfname - Public interfaces to the ACPI subsystem
  *                         ACPI Namespace oriented interfaces
- *              $Revision: 64 $
+ *              $Revision: 73 $
  *
  *****************************************************************************/
 
         MODULE_NAME         ("nsxfname")
 
 
-/******************************************************************************
- *
- * FUNCTION:    Acpi_load_namespace
- *
- * PARAMETERS:  Display_aml_during_load
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Load the name space from what ever is pointed to by DSDT.
- *              (DSDT points to either the BIOS or a buffer.)
- *
- ******************************************************************************/
-
-ACPI_STATUS
-acpi_load_namespace (
-       void)
-{
-       ACPI_STATUS             status;
-
-
-       /* There must be at least a DSDT installed */
-
-       if (acpi_gbl_DSDT == NULL) {
-               return (AE_NO_ACPI_TABLES);
-       }
-
-
-       /*
-        * Load the namespace.  The DSDT is required,
-        * but the SSDT and PSDT tables are optional.
-        */
-
-       status = acpi_ns_load_table_by_type (ACPI_TABLE_DSDT);
-       if (ACPI_FAILURE (status)) {
-               return (status);
-       }
-
-       /* Ignore exceptions from these */
-
-       acpi_ns_load_table_by_type (ACPI_TABLE_SSDT);
-       acpi_ns_load_table_by_type (ACPI_TABLE_PSDT);
-
-
-       /*
-        * Install the default Op_region handlers, ignore the return
-        * code right now.
-        */
-
-       acpi_ev_install_default_address_space_handlers ();
-
-       return (status);
-}
-
-
 /****************************************************************************
  *
  * FUNCTION:    Acpi_get_handle
@@ -117,7 +63,7 @@ acpi_get_handle (
        ACPI_HANDLE             *ret_handle)
 {
        ACPI_STATUS             status;
-       ACPI_NAMESPACE_NODE     *node;
+       ACPI_NAMESPACE_NODE     *node = NULL;
        ACPI_NAMESPACE_NODE     *prefix_node = NULL;
 
 
@@ -125,21 +71,21 @@ acpi_get_handle (
                return (AE_BAD_PARAMETER);
        }
 
+       /* Convert a parent handle to a prefix node */
+
        if (parent) {
                acpi_cm_acquire_mutex (ACPI_MTX_NAMESPACE);
 
-               node = acpi_ns_convert_handle_to_entry (parent);
-               if (!node) {
+               prefix_node = acpi_ns_convert_handle_to_entry (parent);
+               if (!prefix_node) {
                        acpi_cm_release_mutex (ACPI_MTX_NAMESPACE);
                        return (AE_BAD_PARAMETER);
                }
 
-               prefix_node = node->child;
                acpi_cm_release_mutex (ACPI_MTX_NAMESPACE);
        }
 
        /* Special case for root, since we can't search for it */
-       /* TBD: [Investigate] Check for both forward and backslash?? */
 
        if (STRCMP (pathname, NS_ROOT_PATH) == 0) {
                *ret_handle = acpi_ns_convert_entry_to_handle (acpi_gbl_root_node);
@@ -147,13 +93,12 @@ acpi_get_handle (
        }
 
        /*
-        *  Find the Node and convert to the user format
+        *  Find the Node and convert to a handle
         */
-       node = NULL;
        status = acpi_ns_get_node (pathname, prefix_node, &node);
 
        *ret_handle = NULL;
-       if(ACPI_SUCCESS(status)) {
+       if (ACPI_SUCCESS (status)) {
                *ret_handle = acpi_ns_convert_entry_to_handle (node);
        }
 
@@ -253,42 +198,41 @@ unlock_and_exit:
  *
  * RETURN:      Status
  *
- * DESCRIPTION: Returns information about an object as gleaned from running
- *              several standard control methods.
+ * DESCRIPTION: Returns information about an object as gleaned from the
+ *              namespace node and possibly by running several standard
+ *              control methods (Such as in the case of a device.)
  *
  ******************************************************************************/
 
 ACPI_STATUS
 acpi_get_object_info (
-       ACPI_HANDLE             device,
+       ACPI_HANDLE             handle,
        ACPI_DEVICE_INFO        *info)
 {
        DEVICE_ID               hid;
        DEVICE_ID               uid;
        ACPI_STATUS             status;
        u32                     device_status = 0;
-       u32                     address = 0;
-       ACPI_NAMESPACE_NODE     *device_node;
+       ACPI_INTEGER            address = 0;
+       ACPI_NAMESPACE_NODE     *node;
 
 
        /* Parameter validation */
 
-       if (!device || !info) {
+       if (!handle || !info) {
                return (AE_BAD_PARAMETER);
        }
 
        acpi_cm_acquire_mutex (ACPI_MTX_NAMESPACE);
 
-       device_node = acpi_ns_convert_handle_to_entry (device);
-       if (!device_node) {
+       node = acpi_ns_convert_handle_to_entry (handle);
+       if (!node) {
                acpi_cm_release_mutex (ACPI_MTX_NAMESPACE);
                return (AE_BAD_PARAMETER);
        }
 
-       info->type      = device_node->type;
-       info->name      = device_node->name;
-       info->parent    = acpi_ns_convert_entry_to_handle (
-                          acpi_ns_get_parent_object (device_node));
+       info->type      = node->type;
+       info->name      = node->name;
 
        acpi_cm_release_mutex (ACPI_MTX_NAMESPACE);
 
@@ -300,34 +244,30 @@ acpi_get_object_info (
        }
 
 
-       /* Get extra info for ACPI devices */
+       /*
+        * Get extra info for ACPI devices only.  Run the
+        * _HID, _UID, _STA, and _ADR methods.  Note: none
+        * of these methods are required, so they may or may
+        * not be present.  The Info->Valid bits are used
+        * to indicate which methods ran successfully.
+        */
 
        info->valid = 0;
 
        /* Execute the _HID method and save the result */
 
-       status = acpi_cm_execute_HID (device_node, &hid);
+       status = acpi_cm_execute_HID (node, &hid);
        if (ACPI_SUCCESS (status)) {
-               if (hid.type == STRING_PTR_DEVICE_ID) {
-                       STRCPY (info->hardware_id, hid.data.string_ptr);
-               }
-               else {
-                       STRCPY (info->hardware_id, hid.data.buffer);
-               }
+               STRNCPY (info->hardware_id, hid.buffer, sizeof(info->hardware_id));
 
                info->valid |= ACPI_VALID_HID;
        }
 
        /* Execute the _UID method and save the result */
 
-       status = acpi_cm_execute_UID (device_node, &uid);
+       status = acpi_cm_execute_UID (node, &uid);
        if (ACPI_SUCCESS (status)) {
-               if (hid.type == STRING_PTR_DEVICE_ID) {
-                       STRCPY (info->unique_id, uid.data.string_ptr);
-               }
-               else {
-                       STRCPY (info->unique_id, uid.data.buffer);
-               }
+               STRCPY (info->unique_id, uid.buffer);
 
                info->valid |= ACPI_VALID_UID;
        }
@@ -337,7 +277,7 @@ acpi_get_object_info (
         * _STA is not always present
         */
 
-       status = acpi_cm_execute_STA (device_node, &device_status);
+       status = acpi_cm_execute_STA (node, &device_status);
        if (ACPI_SUCCESS (status)) {
                info->current_status = device_status;
                info->valid |= ACPI_VALID_STA;
@@ -349,7 +289,7 @@ acpi_get_object_info (
         */
 
        status = acpi_cm_evaluate_numeric_object (METHOD_NAME__ADR,
-                         device_node, &address);
+                         node, &address);
 
        if (ACPI_SUCCESS (status)) {
                info->address = address;
index 9b254ea99bdeb8f1df41618b511102224495088d..b9f93fdcbb0e98230f34754b3075525db679db85 100644 (file)
@@ -2,7 +2,7 @@
  *
  * Module Name: nsxfobj - Public interfaces to the ACPI subsystem
  *                         ACPI Object oriented interfaces
- *              $Revision: 65 $
+ *              $Revision: 75 $
  *
  ******************************************************************************/
 
@@ -28,6 +28,7 @@
 #include "acpi.h"
 #include "acinterp.h"
 #include "acnamesp.h"
+#include "acdispat.h"
 
 
 #define _COMPONENT          NAMESPACE
@@ -484,6 +485,8 @@ unlock_and_exit:
  *              Max_depth           - Depth to which search is to reach
  *              User_function       - Called when an object of "Type" is found
  *              Context             - Passed to user function
+ *              Return_value        - Location where return value of
+ *                                    User_function is put if terminated early
  *
  * RETURNS      Return value from the User_function if terminated early.
  *              Otherwise, returns NULL.
@@ -544,3 +547,151 @@ acpi_walk_namespace (
 }
 
 
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ns_get_device_callback
+ *
+ * PARAMETERS:  Callback from Acpi_get_device
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Takes callbacks from Walk_namespace and filters out all non-
+ *              present devices, or if they specified a HID, it filters based
+ *              on that.
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+acpi_ns_get_device_callback (
+       ACPI_HANDLE             obj_handle,
+       u32                     nesting_level,
+       void                    *context,
+       void                    **return_value)
+{
+       ACPI_STATUS             status;
+       ACPI_NAMESPACE_NODE     *node;
+       u32                     flags;
+       DEVICE_ID               device_id;
+       ACPI_GET_DEVICES_INFO   *info;
+
+
+       info = context;
+
+       acpi_cm_acquire_mutex (ACPI_MTX_NAMESPACE);
+
+       node = acpi_ns_convert_handle_to_entry (obj_handle);
+       if (!node) {
+               acpi_cm_release_mutex (ACPI_MTX_NAMESPACE);
+               return (AE_BAD_PARAMETER);
+       }
+
+       acpi_cm_release_mutex (ACPI_MTX_NAMESPACE);
+
+       /*
+        * Run _STA to determine if device is present
+        */
+
+       status = acpi_cm_execute_STA (node, &flags);
+       if (ACPI_FAILURE (status)) {
+               return (status);
+       }
+
+       if (!(flags & 0x01)) {
+               /* don't return at the device or children of the device if not there */
+
+               return (AE_CTRL_DEPTH);
+       }
+
+       /*
+        * Filter based on device HID
+        */
+       if (info->hid != NULL) {
+               status = acpi_cm_execute_HID (node, &device_id);
+
+               if (status == AE_NOT_FOUND) {
+                       return (AE_OK);
+               }
+
+               else if (ACPI_FAILURE (status)) {
+                       return (status);
+               }
+
+               if (STRNCMP (device_id.buffer, info->hid, sizeof (device_id.buffer)) != 0) {
+                       return (AE_OK);
+               }
+       }
+
+       info->user_function (obj_handle, nesting_level, info->context, return_value);
+
+       return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_get_devices
+ *
+ * PARAMETERS:  HID                 - HID to search for. Can be NULL.
+ *              User_function       - Called when a matching object is found
+ *              Context             - Passed to user function
+ *              Return_value        - Location where return value of
+ *                                    User_function is put if terminated early
+ *
+ * RETURNS      Return value from the User_function if terminated early.
+ *              Otherwise, returns NULL.
+ *
+ * DESCRIPTION: Performs a modified depth-first walk of the namespace tree,
+ *              starting (and ending) at the object specified by Start_handle.
+ *              The User_function is called whenever an object that matches
+ *              the type parameter is found.  If the user function returns
+ *              a non-zero value, the search is terminated immediately and this
+ *              value is returned to the caller.
+ *
+ *              This is a wrapper for Walk_namespace, but the callback performs
+ *              additional filtering. Please see Acpi_get_device_callback.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_get_devices (
+       NATIVE_CHAR             *HID,
+       WALK_CALLBACK           user_function,
+       void                    *context,
+       void                    **return_value)
+{
+       ACPI_STATUS             status;
+       ACPI_GET_DEVICES_INFO   info;
+
+
+       /* Parameter validation */
+
+       if (!user_function) {
+               return (AE_BAD_PARAMETER);
+       }
+
+       /*
+        * We're going to call their callback from OUR callback, so we need
+        * to know what it is, and their context parameter.
+        */
+       info.context      = context;
+       info.user_function = user_function;
+       info.hid          = HID;
+
+       /*
+        * Lock the namespace around the walk.
+        * The namespace will be unlocked/locked around each call
+        * to the user function - since this function
+        * must be allowed to make Acpi calls itself.
+        */
+
+       acpi_cm_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);
+
+       return (status);
+}
\ No newline at end of file
index b4ae03d0541cdd3535cae735e002f5cafac3b12e..7bf86171bb2cad7ccb0ed1dc530680b7f8e3e48e 100644 (file)
@@ -24,8 +24,8 @@
 #include <linux/mm.h>
 #include <linux/pci.h>
 #include <linux/acpi.h>
-#include <linux/delay.h>
 #include <asm/io.h>
+#include <asm/delay.h>
 #include "acpi.h"
 #include "driver.h"
 
@@ -36,16 +36,16 @@ static int acpi_irq_irq = 0;
 static OSD_HANDLER acpi_irq_handler = NULL;
 static void *acpi_irq_context = NULL;
 
-char *
-strupr(char *str)
-{
-       char *s = str;
-       while (*s) {
-               *s = TOUPPER(*s);
-               s++;
-       }
-       return str;
-}
+#ifdef ENABLE_DEBUGGER
+
+#include <linux/kdb.h>
+
+/* stuff for debugger support */
+int acpi_in_debugger = 0;
+extern NATIVE_CHAR line_buf[80];
+
+#endif
+
 
 ACPI_STATUS
 acpi_os_initialize(void)
@@ -79,7 +79,17 @@ acpi_os_vprintf(const NATIVE_CHAR *fmt, va_list args)
 {
        static char buffer[512];
        int size = vsprintf(buffer, fmt, args);
+
+#ifdef ENABLE_DEBUGGER
+       if (acpi_in_debugger) {
+               kdb_printf("%s", buffer);
+       } else {
+               printk("%s", buffer);
+       }
+#else
        printk("%s", buffer);
+#endif
+
        return size;
 }
 
@@ -105,8 +115,13 @@ acpi_os_free(void *ptr)
 }
 
 ACPI_STATUS
-acpi_os_map_memory(void *phys, u32 size, void **virt)
+acpi_os_map_memory(ACPI_PHYSICAL_ADDRESS phys, u32 size, void **virt)
 {
+       if (phys > ULONG_MAX) {
+               printk(KERN_ERR "ACPI: Cannot map memory that high\n");
+               return AE_ERROR;
+       }
+
        if ((unsigned long) phys < virt_to_phys(high_memory)) {
                *virt = phys_to_virt((unsigned long) phys);
                return AE_OK;
@@ -212,12 +227,48 @@ acpi_os_out32(ACPI_IO_ADDRESS port, u32 val)
        outl(val, port);
 }
 
+UINT8
+acpi_os_mem_in8 (ACPI_PHYSICAL_ADDRESS phys_addr)
+{
+       return (*(u8*) (u32) phys_addr);
+}
+
+UINT16
+acpi_os_mem_in16 (ACPI_PHYSICAL_ADDRESS phys_addr)
+{
+       return (*(u16*) (u32) phys_addr);
+}
+
+UINT32
+acpi_os_mem_in32 (ACPI_PHYSICAL_ADDRESS phys_addr)
+{
+       return (*(u32*) (u32) phys_addr);
+}
+
+void
+acpi_os_mem_out8 (ACPI_PHYSICAL_ADDRESS phys_addr, UINT8 value)
+{
+       *(u8*) (u32) phys_addr = value;
+}
+
+void
+acpi_os_mem_out16 (ACPI_PHYSICAL_ADDRESS phys_addr, UINT16 value)
+{
+       *(u16*) (u32) phys_addr = value;
+}
+
+void
+acpi_os_mem_out32 (ACPI_PHYSICAL_ADDRESS phys_addr, UINT32 value)
+{
+       *(u32*) (u32) phys_addr = value;
+}
+
 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);
@@ -228,10 +279,10 @@ acpi_os_read_pci_cfg_byte(
 
 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);
@@ -242,10 +293,10 @@ acpi_os_read_pci_cfg_word(
 
 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);
@@ -256,10 +307,10 @@ acpi_os_read_pci_cfg_dword(
 
 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);
@@ -270,10 +321,10 @@ acpi_os_write_pci_cfg_byte(
 
 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);
@@ -284,10 +335,10 @@ acpi_os_write_pci_cfg_word(
 
 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);
@@ -302,9 +353,9 @@ acpi_os_write_pci_cfg_dword(
 
 ACPI_STATUS
 acpi_os_queue_for_execution(
-                                   u32 priority,
-                                   OSD_EXECUTION_CALLBACK callback,
-                                   void *context)
+                           u32 priority,
+                           OSD_EXECUTION_CALLBACK callback,
+                           void *context)
 {
        if (acpi_run(callback, context))
                return AE_ERROR;
@@ -318,7 +369,8 @@ acpi_os_queue_for_execution(
 ACPI_STATUS
 acpi_os_create_semaphore(u32 max_units, u32 init, ACPI_HANDLE * handle)
 {
-       *handle = (ACPI_HANDLE) 0;
+       /* a hack to fake out sems until we implement them */
+       *handle = (ACPI_HANDLE) handle;
        return AE_OK;
 }
 
@@ -362,6 +414,19 @@ acpi_os_dbg_assert(void *failure, void *file, u32 line, NATIVE_CHAR *msg)
 u32
 acpi_os_get_line(NATIVE_CHAR *buffer)
 {
+
+#ifdef ENABLE_DEBUGGER
+       if (acpi_in_debugger) {
+               u32 chars;
+
+               kdb_read(buffer, sizeof(line_buf));
+
+               /* remove the CR kdb includes */
+               chars = strlen(buffer) - 1;
+               buffer[chars] = '\0';
+       }
+#endif
+
        return 0;
 }
 
index edd89713320bbf7177a46838fb379b30259e39fb..751ef5de8f1902c93309a10e6556b84e3b5e6d78 100644 (file)
@@ -2,26 +2,14 @@
 # Makefile for all Linux ACPI interpreter subdirectories
 #
 
-SUB_DIRS        := 
-MOD_SUB_DIRS    := $(SUB_DIRS)
-MOD_IN_SUB_DIRS :=
-ALL_SUB_DIRS    := $(SUB_DIRS)
-
 O_TARGET := ../$(shell basename `pwd`).o
-O_OBJS   :=
-M_OBJS   :=
 
-ACPI_OBJS := $(patsubst %.c,%.o,$(wildcard *.c))
+obj-$(CONFIG_ACPI) := $(patsubst %.c,%.o,$(wildcard *.c))
 
 EXTRA_CFLAGS += -I../include
 
 EXTRA_CFLAGS += $(ACPI_CFLAGS)
 
-# if the interpreter is used, it overrides arch/i386/kernel/acpi.c
-ifeq ($(CONFIG_ACPI_INTERPRETER),y)
-  O_OBJS := $(ACPI_OBJS)
-endif
-
 include $(TOPDIR)/Rules.make
 
 clean:
index 21315b331af526cf7cf97474a015782eb36b48db..9115ac0363bd1ceb13fb549ea77c2e6f732160bc 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: psargs - Parse AML opcode arguments
- *              $Revision: 35 $
+ *              $Revision: 40 $
  *
  *****************************************************************************/
 
         MODULE_NAME         ("psargs")
 
 
-u32
-acpi_ps_pkg_length_encoding_size (
-       u32                     first_byte)
-{
-
-       /*
-        * Bits 6-7 contain the number of bytes
-        * in the encoded package length (-1)
-        */
-
-       return ((first_byte >> 6) + 1);
-}
-
-
 /*******************************************************************************
  *
  * FUNCTION:    Acpi_ps_get_next_package_length
@@ -60,55 +46,6 @@ acpi_ps_pkg_length_encoding_size (
  *
  ******************************************************************************/
 
-u32
-xxx_acpi_ps_get_next_package_length (
-       ACPI_PARSE_STATE        *parser_state)
-{
-       u32                     encoding_length;
-       u32                     package_length = 0;
-       u8                      *aml_ptr = parser_state->aml;
-
-
-       encoding_length = acpi_ps_pkg_length_encoding_size ((u32) GET8 (aml_ptr));
-
-
-       switch (encoding_length)
-       {
-       case 1: /* 1-byte encoding (bits 0-5) */
-
-               package_length = ((u32) GET8 (aml_ptr) & 0x3f);
-               break;
-
-
-       case 2: /* 2-byte encoding (next byte + bits 0-3) */
-
-               package_length = ((((u32) GET8 (aml_ptr + 1)) << 4) |
-                                  (((u32) GET8 (aml_ptr)) & 0x0f));
-               break;
-
-
-       case 3: /* 3-byte encoding (next 2 bytes + bits 0-3) */
-
-               package_length = ((((u32) GET8 (aml_ptr + 2)) << 12) |
-                                  (((u32) GET8 (aml_ptr + 1)) << 4) |
-                                  (((u32) GET8 (aml_ptr)) & 0x0f));
-               break;
-
-
-       case 4: /* 4-byte encoding (next 3 bytes + bits 0-3) */
-
-               package_length = ((((u32) GET8 (aml_ptr + 3)) << 20) |
-                                  (((u32) GET8 (aml_ptr + 2)) << 12) |
-                                  (((u32) GET8 (aml_ptr + 1)) << 4) |
-                                  (((u32) GET8 (aml_ptr)) & 0x0f));
-               break;
-       }
-
-       parser_state->aml += encoding_length;
-
-       return (package_length);
-}
-
 u32
 acpi_ps_get_next_package_length (
        ACPI_PARSE_STATE        *parser_state)
@@ -125,32 +62,33 @@ acpi_ps_get_next_package_length (
        {
        case 0: /* 1-byte encoding (bits 0-5) */
 
-               length = (encoded_length & 0x3f);
+               length = (encoded_length & 0x3F);
                break;
 
 
        case 1: /* 2-byte encoding (next byte + bits 0-3) */
 
-               length = (GET8 (parser_state->aml) << 4) | (encoded_length & 0xf);
+               length = ((GET8 (parser_state->aml) << 04) |
+                                (encoded_length & 0x0F));
                parser_state->aml++;
                break;
 
 
        case 2: /* 3-byte encoding (next 2 bytes + bits 0-3) */
 
-               length = ( (GET8 (parser_state->aml + 1) << 12)
-                          | (GET8 (parser_state->aml) << 4)
-                          | (encoded_length & 0xf));
+               length = ((GET8 (parser_state->aml + 1) << 12) |
+                                 (GET8 (parser_state->aml)    << 04) |
+                                 (encoded_length & 0x0F));
                parser_state->aml += 2;
                break;
 
 
        case 3: /* 4-byte encoding (next 3 bytes + bits 0-3) */
 
-               length = ( (GET8 (parser_state->aml + 2) << 20)
-                          | (GET8 (parser_state->aml + 1) << 12)
-                          | (GET8 (parser_state->aml) << 4)
-                          | (encoded_length & 0xf));
+               length = ((GET8 (parser_state->aml + 2) << 20) |
+                                 (GET8 (parser_state->aml + 1) << 12) |
+                                 (GET8 (parser_state->aml)    << 04) |
+                                 (encoded_length & 0x0F));
                parser_state->aml += 3;
                break;
        }
@@ -442,6 +380,10 @@ acpi_ps_get_next_namepath (
                                        name_op->node = method_node;
                                        acpi_ps_append_arg (arg, name_op);
 
+                                       if (!(ACPI_OPERAND_OBJECT  *) method_node->object) {
+                                               return;
+                                       }
+
                                        *arg_count = ((ACPI_OPERAND_OBJECT *) method_node->object)->method.param_count;
                                }
 
diff --git a/drivers/acpi/parser/psfind.c b/drivers/acpi/parser/psfind.c
deleted file mode 100644 (file)
index 95ffb3b..0000000
+++ /dev/null
@@ -1,319 +0,0 @@
-
-/******************************************************************************
- *
- * Module Name: psfind - Parse tree search routine
- *              $Revision: 16 $
- *
- *****************************************************************************/
-
-/*
- *  Copyright (C) 2000 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          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
- *
- ******************************************************************************/
-
-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.
- *
- ******************************************************************************/
-
-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))
-               {
-                       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);
-}
-
-
index 8ce0154ab022263ced33a2c83f40477c8313304f..a7f061363b827e89c0a30ed1c95b0bd61c2167ab 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: psopcode - Parser opcode information table
- *              $Revision: 20 $
+ *              $Revision: 24 $
  *
  *****************************************************************************/
 
@@ -33,9 +33,6 @@
         MODULE_NAME         ("psopcode")
 
 
-u8 acpi_gbl_aml_short_op_info_index[];
-u8 acpi_gbl_aml_long_op_info_index[];
-
 #define _UNK                        0x6B
 /*
  * Reserved ASCII characters.  Do not use any of these for
@@ -53,112 +50,6 @@ u8 acpi_gbl_aml_long_op_info_index[];
 #define NUM_INTERNAL_OPCODE         MAX_INTERNAL_OPCODE + 1
 
 
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_ps_get_opcode_info
- *
- * PARAMETERS:  Opcode              - The AML opcode
- *
- * RETURN:      A pointer to the info about the opcode.  NULL if the opcode was
- *              not found in the table.
- *
- * DESCRIPTION: Find AML opcode description based on the opcode.
- *              NOTE: This procedure must ALWAYS return a valid pointer!
- *
- ******************************************************************************/
-
-ACPI_OPCODE_INFO *
-acpi_ps_get_opcode_info (
-       u16                     opcode)
-{
-       ACPI_OPCODE_INFO        *op_info;
-       u8                      upper_opcode;
-       u8                      lower_opcode;
-
-
-       /* Split the 16-bit opcode into separate bytes */
-
-       upper_opcode = (u8) (opcode >> 8);
-       lower_opcode = (u8) opcode;
-
-       /* Default is "unknown opcode" */
-
-       op_info = &acpi_gbl_aml_op_info [_UNK];
-
-
-       /*
-        * Detect normal 8-bit opcode or extended 16-bit opcode
-        */
-
-       switch (upper_opcode)
-       {
-       case 0:
-
-               /* Simple (8-bit) opcode: 0-255, can't index beyond table  */
-
-               op_info = &acpi_gbl_aml_op_info [acpi_gbl_aml_short_op_info_index [lower_opcode]];
-               break;
-
-
-       case AML_EXTOP:
-
-               /* Extended (16-bit, prefix+opcode) opcode */
-
-               if (lower_opcode <= MAX_EXTENDED_OPCODE) {
-                       op_info = &acpi_gbl_aml_op_info [acpi_gbl_aml_long_op_info_index [lower_opcode]];
-               }
-               break;
-
-
-       case AML_LNOT_OP:
-
-               /* This case is for the bogus opcodes LNOTEQUAL, LLESSEQUAL, LGREATEREQUAL */
-               /* TBD: [Investigate] remove this case? */
-
-               break;
-
-
-       default:
-
-               break;
-       }
-
-
-       /* Get the Op info pointer for this opcode */
-
-       return (op_info);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_ps_get_opcode_name
- *
- * PARAMETERS:  Opcode              - The AML opcode
- *
- * RETURN:      A pointer to the name of the opcode (ASCII String)
- *              Note: Never returns NULL.
- *
- * DESCRIPTION: Translate an opcode into a human-readable string
- *
- ******************************************************************************/
-
-NATIVE_CHAR *
-acpi_ps_get_opcode_name (
-       u16                     opcode)
-{
-       ACPI_OPCODE_INFO             *op;
-
-
-       op = acpi_ps_get_opcode_info (opcode);
-
-       /* Always guaranteed to return a valid pointer */
-
-       DEBUG_ONLY_MEMBERS (return op->name);
-       return ("AE_NOT_CONFIGURED");
-}
-
-
 /*******************************************************************************
  *
  * NAME:        Acpi_gbl_Aml_op_info
@@ -387,7 +278,7 @@ acpi_ps_get_opcode_name (
 #define ARGI_REVISION_OP                ARG_NONE
 #define ARGI_DEBUG_OP                   ARG_NONE
 #define ARGI_FATAL_OP                   ARGI_LIST3 (ARGI_NUMBER,     ARGI_NUMBER,        ARGI_NUMBER)
-#define ARGI_REGION_OP                  ARGI_INVALID_OPCODE
+#define ARGI_REGION_OP                  ARGI_LIST2 (ARGI_NUMBER,     ARGI_NUMBER)
 #define ARGI_DEF_FIELD_OP               ARGI_INVALID_OPCODE
 #define ARGI_DEVICE_OP                  ARGI_INVALID_OPCODE
 #define ARGI_PROCESSOR_OP               ARGI_INVALID_OPCODE
@@ -412,7 +303,7 @@ acpi_ps_get_opcode_name (
  */
 
 
-ACPI_OPCODE_INFO    acpi_gbl_aml_op_info[] =
+static ACPI_OPCODE_INFO    aml_op_info[] =
 {
 /* Index          Opcode                                   Type                   Class                 Has Arguments?   Name                 Parser Args             Interpreter Args */
 
@@ -539,7 +430,7 @@ ACPI_OPCODE_INFO    acpi_gbl_aml_op_info[] =
  * index into the table above
  */
 
-u8 acpi_gbl_aml_short_op_info_index[256] =
+static u8 aml_short_op_info_index[256] =
 {
 /*              0     1     2     3     4     5     6     7  */
 /* 0x00 */    0x00, 0x01, _UNK, _UNK, _UNK, _UNK, 0x02, _UNK,
@@ -577,7 +468,7 @@ u8 acpi_gbl_aml_short_op_info_index[256] =
 };
 
 
-u8 acpi_gbl_aml_long_op_info_index[NUM_EXTENDED_OPCODE] =
+static u8 aml_long_op_info_index[NUM_EXTENDED_OPCODE] =
 {
 /*              0     1     2     3     4     5     6     7  */
 /* 0x00 */    _UNK, 0x46, 0x47, _UNK, _UNK, _UNK, _UNK, _UNK,
@@ -604,3 +495,108 @@ u8 acpi_gbl_aml_long_op_info_index[NUM_EXTENDED_OPCODE] =
 /* 0x00 */
 
 
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ps_get_opcode_info
+ *
+ * PARAMETERS:  Opcode              - The AML opcode
+ *
+ * RETURN:      A pointer to the info about the opcode.  NULL if the opcode was
+ *              not found in the table.
+ *
+ * DESCRIPTION: Find AML opcode description based on the opcode.
+ *              NOTE: This procedure must ALWAYS return a valid pointer!
+ *
+ ******************************************************************************/
+
+ACPI_OPCODE_INFO *
+acpi_ps_get_opcode_info (
+       u16                     opcode)
+{
+       ACPI_OPCODE_INFO        *op_info;
+       u8                      upper_opcode;
+       u8                      lower_opcode;
+
+
+       /* Split the 16-bit opcode into separate bytes */
+
+       upper_opcode = (u8) (opcode >> 8);
+       lower_opcode = (u8) opcode;
+
+       /* Default is "unknown opcode" */
+
+       op_info = &aml_op_info [_UNK];
+
+
+       /*
+        * Detect normal 8-bit opcode or extended 16-bit opcode
+        */
+
+       switch (upper_opcode)
+       {
+       case 0:
+
+               /* Simple (8-bit) opcode: 0-255, can't index beyond table  */
+
+               op_info = &aml_op_info [aml_short_op_info_index [lower_opcode]];
+               break;
+
+
+       case AML_EXTOP:
+
+               /* Extended (16-bit, prefix+opcode) opcode */
+
+               if (lower_opcode <= MAX_EXTENDED_OPCODE) {
+                       op_info = &aml_op_info [aml_long_op_info_index [lower_opcode]];
+               }
+               break;
+
+
+       case AML_LNOT_OP:
+
+               /* This case is for the bogus opcodes LNOTEQUAL, LLESSEQUAL, LGREATEREQUAL */
+               /* TBD: [Investigate] remove this case? */
+
+               break;
+
+
+       default:
+
+               break;
+       }
+
+
+       /* Get the Op info pointer for this opcode */
+
+       return (op_info);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ps_get_opcode_name
+ *
+ * PARAMETERS:  Opcode              - The AML opcode
+ *
+ * RETURN:      A pointer to the name of the opcode (ASCII String)
+ *              Note: Never returns NULL.
+ *
+ * DESCRIPTION: Translate an opcode into a human-readable string
+ *
+ ******************************************************************************/
+
+NATIVE_CHAR *
+acpi_ps_get_opcode_name (
+       u16                     opcode)
+{
+       ACPI_OPCODE_INFO             *op;
+
+
+       op = acpi_ps_get_opcode_info (opcode);
+
+       /* Always guaranteed to return a valid pointer */
+
+       return ("AE_NOT_CONFIGURED");
+}
+
+
index 8351e8b6928deddd66057da4692acd2ba474f671..6066b27e353726147d3f11b5ca397777159ca9b2 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: psparse - Parser top level AML parse routines
- *              $Revision: 51 $
+ *              $Revision: 69 $
  *
  *****************************************************************************/
 
@@ -30,7 +30,7 @@
  * generated parser to tightly constrain stack and dynamic memory
  * usage.  At the same time, parsing is kept flexible and the code
  * fairly compact by parsing based on a list of AML opcode
- * templates in Acpi_gbl_Aml_op_info[]
+ * templates in Aml_op_info[]
  */
 
 #include "acpi.h"
@@ -48,95 +48,6 @@ u32                         acpi_gbl_depth = 0;
 extern u32                  acpi_gbl_scope_depth;
 
 
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_ps_delete_completed_op
- *
- * PARAMETERS:  State           - Walk state
- *              Op              - Completed op
- *
- * RETURN:      AE_OK
- *
- * DESCRIPTION: Callback function for Acpi_ps_get_next_walk_op(). Used during
- *              Acpi_ps_delete_parse tree to delete Op objects when all sub-objects
- *              have been visited (and deleted.)
- *
- ******************************************************************************/
-
-ACPI_STATUS
-acpi_ps_delete_completed_op (
-       ACPI_WALK_STATE         *state,
-       ACPI_PARSE_OBJECT       *op)
-{
-
-       acpi_ps_free_op (op);
-       return (AE_OK);
-}
-
-
-#ifndef PARSER_ONLY
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_ps_delete_parse_tree
- *
- * PARAMETERS:  Subtree_root        - Root of tree (or subtree) to delete
- *
- * RETURN:      None
- *
- * DESCRIPTION: Delete a portion of or an entire parse tree.
- *
- ******************************************************************************/
-
-void
-acpi_ps_delete_parse_tree (
-       ACPI_PARSE_OBJECT       *subtree_root)
-{
-       ACPI_WALK_STATE         *walk_state;
-       ACPI_WALK_LIST          walk_list;
-
-
-       if (!subtree_root) {
-               return;
-       }
-
-       /* Create and initialize a new walk list */
-
-       walk_list.walk_state = NULL;
-       walk_state = acpi_ds_create_walk_state (TABLE_ID_DSDT, NULL, NULL, &walk_list);
-       if (!walk_state) {
-               return;
-       }
-
-       walk_state->parser_state        = NULL;
-       walk_state->parse_flags         = 0;
-       walk_state->descending_callback = NULL;
-       walk_state->ascending_callback  = NULL;
-
-
-       walk_state->origin = subtree_root;
-       walk_state->next_op = subtree_root;
-
-
-       /* Head downward in the tree */
-
-       walk_state->next_op_info = NEXT_OP_DOWNWARD;
-
-       /* Visit all nodes in the subtree */
-
-       while (walk_state->next_op) {
-               acpi_ps_get_next_walk_op (walk_state, walk_state->next_op,
-                                acpi_ps_delete_completed_op);
-       }
-
-       /* We are done with this walk */
-
-       acpi_ds_delete_walk_state (walk_state);
-
-       return;
-}
-#endif
-
-
 /*******************************************************************************
  *
  * FUNCTION:    Acpi_ps_peek_opcode
@@ -149,7 +60,7 @@ acpi_ps_delete_parse_tree (
  *
  ******************************************************************************/
 
-u32
+static u32
 acpi_ps_get_opcode_size (
        u32                     opcode)
 {
@@ -323,7 +234,7 @@ acpi_ps_find_object (
  *
  ******************************************************************************/
 
-u8
+static u8
 acpi_ps_complete_this_op (
        ACPI_WALK_STATE         *walk_state,
        ACPI_PARSE_OBJECT       *op)
@@ -344,11 +255,11 @@ acpi_ps_complete_this_op (
        /* Delete this op and the subtree below it if asked to */
 
        if (((walk_state->parse_flags & ACPI_PARSE_TREE_MASK) == ACPI_PARSE_DELETE_TREE) &&
-               (opcode_class != OPTYPE_CONSTANT) &&
-               (opcode_class != OPTYPE_LITERAL) &&
+               (opcode_class != OPTYPE_CONSTANT)       &&
+               (opcode_class != OPTYPE_LITERAL)        &&
                (opcode_class != OPTYPE_LOCAL_VARIABLE) &&
                (opcode_class != OPTYPE_METHOD_ARGUMENT) &&
-               (opcode_class != OPTYPE_DATA_TERM) &&
+               (opcode_class != OPTYPE_DATA_TERM)      &&
                (op->opcode  != AML_NAMEPATH_OP))
        {
                /* Make sure that we only delete this subtree */
@@ -356,7 +267,7 @@ acpi_ps_complete_this_op (
                if (op->parent) {
                        /*
                         * Check if we need to replace the operator and its subtree
-                        * with a return value op
+                        * with a return value op (placeholder op)
                         */
 
                        parent_info = acpi_ps_get_opcode_info (op->parent->opcode);
@@ -364,7 +275,29 @@ acpi_ps_complete_this_op (
                        switch (ACPI_GET_OP_CLASS (parent_info))
                        {
                        case OPTYPE_CONTROL:        /* IF, ELSE, WHILE only */
+                               break;
+
                        case OPTYPE_NAMED_OBJECT:   /* Scope, method, etc. */
+
+                               /*
+                                * These opcodes contain Term_arg operands. The current
+                                * 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 (!replacement_op) {
+                                               return (FALSE);
+                                       }
+                               }
+
                                break;
 
                        default:
@@ -381,13 +314,13 @@ acpi_ps_complete_this_op (
                                /* This op is the first in the list */
 
                                if (replacement_op) {
-                                       replacement_op->parent = op->parent;
+                                       replacement_op->parent   = op->parent;
                                        replacement_op->value.arg = NULL;
-                                       op->parent->value.arg = replacement_op;
-                                       replacement_op->next = op->next;
+                                       op->parent->value.arg    = replacement_op;
+                                       replacement_op->next     = op->next;
                                }
                                else {
-                                       op->parent->value.arg = op->next;
+                                       op->parent->value.arg    = op->next;
                                }
                        }
 
@@ -443,8 +376,7 @@ acpi_ps_complete_this_op (
  *
  ******************************************************************************/
 
-
-ACPI_STATUS
+static ACPI_STATUS
 acpi_ps_next_parse_state (
        ACPI_WALK_STATE         *walk_state,
        ACPI_PARSE_OBJECT       *op,
@@ -452,6 +384,8 @@ acpi_ps_next_parse_state (
 {
        ACPI_PARSE_STATE        *parser_state = walk_state->parser_state;
        ACPI_STATUS             status = AE_CTRL_PENDING;
+       u8                      *start;
+       u32                     package_length;
 
 
        switch (callback_status)
@@ -490,10 +424,12 @@ acpi_ps_next_parse_state (
                         * Predicate of an IF was true, and we are at the matching ELSE.
                         * Just close out this package
                         *
-                        * Parser_state->Aml is modified by the package length procedure
+                        * Note: Parser_state->Aml is modified by the package length procedure
+                        * TBD: [Investigate] perhaps it shouldn't, too much trouble
                         */
-               parser_state->aml = (parser_state->aml +
-                                acpi_ps_get_next_package_length (parser_state)) -1;
+               start = parser_state->aml;
+               package_length = acpi_ps_get_next_package_length (parser_state);
+               parser_state->aml = start + package_length;
                break;
 
 
@@ -528,7 +464,7 @@ acpi_ps_next_parse_state (
 
                /* Will return value (if any) be used by the caller? */
 
-               walk_state->return_used = acpi_ds_is_result_used (op);
+               walk_state->return_used = acpi_ds_is_result_used (op, walk_state);
                break;
 
 
@@ -573,24 +509,59 @@ acpi_ps_parse_loop (
        u16                     opcode;
        ACPI_PARSE_OBJECT       pre_op;
        ACPI_PARSE_STATE        *parser_state;
+       u8                      *aml_op_start;
 
 
        parser_state = walk_state->parser_state;
 
-       if (walk_state->prev_op) {
-               op = walk_state->prev_op;
-               arg_types = walk_state->prev_arg_types;
+#ifndef PARSER_ONLY
+       if (walk_state->walk_type & WALK_METHOD_RESTART) {
+               /* We are restarting a preempted control method */
+
+               if (acpi_ps_has_completed_scope (parser_state)) {
+                       /*
+                        * We must check if a predicate to an IF or WHILE statement
+                        * was just completed
+                        */
+                       if ((parser_state->scope->parse_scope.op) &&
+                               ((parser_state->scope->parse_scope.op->opcode == AML_IF_OP) ||
+                               (parser_state->scope->parse_scope.op->opcode == AML_WHILE_OP)) &&
+                               (walk_state->control_state) &&
+                               (walk_state->control_state->common.state ==
+                                       CONTROL_PREDICATE_EXECUTING))
+                       {
+
+                               /*
+                                * A predicate was just completed, get the value of the
+                                * predicate and branch based on that value
+                                */
+
+                               status = acpi_ds_get_predicate_value (walk_state, NULL, TRUE);
+                               status = acpi_ps_next_parse_state (walk_state, op, status);
+                       }
+
+                       acpi_ps_pop_scope (parser_state, &op, &arg_types, &arg_count);
+               }
+
+               else if (walk_state->prev_op) {
+                       /* We were in the middle of an op */
+
+                       op = walk_state->prev_op;
+                       arg_types = walk_state->prev_arg_types;
+               }
        }
+#endif
 
        /*
         * Iterative parsing loop, while there is more aml to process:
         */
-       while (parser_state->aml < parser_state->aml_end) {
+       while ((parser_state->aml < parser_state->aml_end) || (op)) {
                if (!op) {
                        /* Get the next opcode from the AML stream */
 
+                       aml_op_start = parser_state->aml;
                        aml_offset = parser_state->aml - parser_state->aml_start;
-                       opcode    = acpi_ps_peek_opcode (parser_state);
+                       opcode     = acpi_ps_peek_opcode (parser_state);
 
                        /*
                         * First cut to determine what we have found:
@@ -625,7 +596,9 @@ acpi_ps_parse_loop (
 
                                /* The opcode is unrecognized.  Just skip unknown opcodes */
 
-                               parser_state->aml += acpi_ps_get_opcode_size (opcode);
+                               /* Assume one-byte bad opcode */
+
+                               parser_state->aml++;
                                continue;
                        }
 
@@ -677,25 +650,26 @@ acpi_ps_parse_loop (
                                        deferred_op = acpi_ps_to_extended_op (op);
                                        if (deferred_op) {
                                                /*
-                                                * Skip parsing of control method or opregion body,
+                                                * Defer final parsing of an Operation_region body,
                                                 * because we don't have enough info in the first pass
-                                                * to parse them correctly.
+                                                * to parse it correctly (i.e., there may be method
+                                                * calls within the Term_arg elements of the body.
                                                 *
-                                                * Backup to beginning of Op_region declaration (2 for
-                                                * Opcode, 4 for name)
+                                                * However, we must continue parsing because
+                                                * the opregion is not a standalone package --
+                                                * we don't know where the end is at this point.
                                                 *
-                                                * Body_length is unknown until we parse the body
+                                                * (Length is unknown until parse of the body complete)
                                                 */
 
-                                               deferred_op->data   = parser_state->aml - 6;
+                                               deferred_op->data   = aml_op_start;
                                                deferred_op->length = 0;
                                        }
                                }
                        }
 
-                       else {
-
 
+                       else {
                                /* Not a named opcode, just allocate Op and append to parent */
 
                                op = acpi_ps_alloc_op (opcode);
@@ -703,6 +677,23 @@ acpi_ps_parse_loop (
                                        return (AE_NO_MEMORY);
                                }
 
+
+                               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))
+                                {
+                                       /*
+                                        * Backup to beginning of Create_xXXfield declaration
+                                        * Body_length is unknown until we parse the body
+                                        */
+                                       deferred_op = (ACPI_PARSE2_OBJECT *) op;
+
+                                       deferred_op->data   = aml_op_start;
+                                       deferred_op->length = 0;
+                               }
+
                                acpi_ps_append_arg (acpi_ps_get_parent_scope (parser_state), op);
 
                                if ((walk_state->descending_callback != NULL)) {
@@ -728,7 +719,11 @@ acpi_ps_parse_loop (
                }
 
 
+               /* Start Arg_count at zero because we don't know if there are any args yet */
+
                arg_count = 0;
+
+
                if (arg_types)  /* Are there any arguments that must be processed? */ {
                        /* get arguments */
 
@@ -761,12 +756,11 @@ acpi_ps_parse_loop (
                                        arg = acpi_ps_get_next_arg (parser_state,
                                                         GET_CURRENT_ARG_TYPE (arg_types),
                                                         &arg_count);
-
                                        if (arg) {
                                                arg->aml_offset = aml_offset;
+                                               acpi_ps_append_arg (op, arg);
                                        }
 
-                                       acpi_ps_append_arg (op, arg);
                                        INCREMENT_ARG_LIST (arg_types);
                                }
 
@@ -800,6 +794,10 @@ acpi_ps_parse_loop (
                        }
                }
 
+
+               /*
+                * Zero Arg_count means that all arguments for this op have been processed
+                */
                if (!arg_count) {
                        /* completed Op, prepare for next */
 
@@ -821,11 +819,27 @@ acpi_ps_parse_loop (
                                                 */
 
                                                deferred_op->length = parser_state->aml -
-                                                                 deferred_op->data;
+                                                                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))
+                       {
+                               /*
+                                * Backup to beginning of Create_xXXfield declaration (1 for
+                                * Opcode)
+                                *
+                                * Body_length is unknown until we parse the body
+                                */
+                               deferred_op = (ACPI_PARSE2_OBJECT *) op;
+                               deferred_op->length = parser_state->aml - deferred_op->data;
+                       }
 
                        /* This op complete, notify the dispatcher */
 
@@ -841,6 +855,9 @@ acpi_ps_parse_loop (
 
 close_this_op:
 
+                       /*
+                        * Finished one argument of the containing scope
+                        */
                        parser_state->scope->parse_scope.arg_count--;
 
                        /* Close this Op (may result in parse subtree deletion) */
@@ -850,18 +867,58 @@ close_this_op:
                        }
 
 
-                       if (status == AE_CTRL_END) {
-                               acpi_ps_pop_scope (parser_state, &op, &arg_types);
+                       switch (status)
+                       {
+                       case AE_OK:
+                               break;
+
+
+                       case AE_CTRL_TRANSFER:
+
+                               /*
+                                * We are about to transfer to a called method.
+                                */
+                               walk_state->prev_op = op;
+                               walk_state->prev_arg_types = arg_types;
+                               return (status);
+                               break;
+
+
+                       case AE_CTRL_END:
+
+                               acpi_ps_pop_scope (parser_state, &op, &arg_types, &arg_count);
+
                                status = walk_state->ascending_callback (walk_state, op);
                                status = acpi_ps_next_parse_state (walk_state, op, status);
+
                                acpi_ps_complete_this_op (walk_state, op);
                                op = NULL;
                                status = AE_OK;
-                       }
+                               break;
+
+
+                       case AE_CTRL_TERMINATE:
+
+                               status = AE_OK;
+
+                               /* Clean up */
+                               do
+                               {
+                                       if (op) {
+                                               acpi_ps_complete_this_op (walk_state, op);
+                                       }
+
+                                       acpi_ps_pop_scope (parser_state, &op, &arg_types, &arg_count);
+                               } while (op);
+
+                               return (status);
+                               break;
+
+
+                       default:  /* All other non-AE_OK status */
 
-                       else if (ACPI_FAILURE (status)) {
                                if (op == NULL) {
-                                       acpi_ps_pop_scope (parser_state, &op, &arg_types);
+                                       acpi_ps_pop_scope (parser_state, &op, &arg_types, &arg_count);
                                }
                                walk_state->prev_op = op;
                                walk_state->prev_arg_types = arg_types;
@@ -870,27 +927,15 @@ close_this_op:
                                 * TEMP:
                                 */
 
-                               if (status == AE_CTRL_TERMINATE) {
-                                       status = AE_OK;
-
-                                       /* Clean up */
-                                       do
-                                       {
-                                               if (op) {
-                                                       acpi_ps_complete_this_op (walk_state, op);
-                                               }
-
-                                               acpi_ps_pop_scope (parser_state, &op, &arg_types);
-                                       } while (op);
-                               }
                                return (status);
+                               break;
                        }
 
 
                        /* This scope complete? */
 
                        if (acpi_ps_has_completed_scope (parser_state)) {
-                               acpi_ps_pop_scope (parser_state, &op, &arg_types);
+                               acpi_ps_pop_scope (parser_state, &op, &arg_types, &arg_count);
                        }
 
                        else {
@@ -899,6 +944,9 @@ close_this_op:
 
                }
 
+
+               /* Arg_count is non-zero */
+
                else {
                        /* complex argument, push Op and prepare for argument */
 
@@ -937,7 +985,7 @@ close_this_op:
                                                        acpi_ps_complete_this_op (walk_state, op);
                                                }
 
-                                               acpi_ps_pop_scope (parser_state, &op, &arg_types);
+                                               acpi_ps_pop_scope (parser_state, &op, &arg_types, &arg_count);
 
                                        } while (op);
 
@@ -953,7 +1001,7 @@ close_this_op:
                        acpi_ps_complete_this_op (walk_state, op);
                }
 
-               acpi_ps_pop_scope (parser_state, &op, &arg_types);
+               acpi_ps_pop_scope (parser_state, &op, &arg_types, &arg_count);
 
        } while (op);
 
@@ -1145,6 +1193,7 @@ acpi_ps_parse_aml (
                         */
 
                        acpi_ds_restart_control_method (walk_state, return_desc);
+                       walk_state->walk_type |= WALK_METHOD_RESTART;
                }
 
                /*
index 727afaa08014fa65a1d69d61d078e8165c4fe4e0..2e8926ad159b205f22f945d21a7eeea9e9b9f8a5 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: psscope - Parser scope stack management routines
- *              $Revision: 18 $
+ *              $Revision: 22 $
  *
  *****************************************************************************/
 
@@ -118,7 +118,7 @@ acpi_ps_init_scope (
  *
  * PARAMETERS:  Parser_state        - Current parser state object
  *              Op                  - Current op to be pushed
- *              Next_arg            - Next op argument (to be pushed)
+ *              Remaining_args      - List of args remaining
  *              Arg_count           - Fixed or variable number of args
  *
  * RETURN:      Status
@@ -175,8 +175,9 @@ acpi_ps_push_scope (
  *
  * PARAMETERS:  Parser_state        - Current parser state object
  *              Op                  - Where the popped op is returned
- *              Next_arg            - Where the popped "next argument" is
+ *              Arg_list            - Where the popped "next argument" is
  *                                    returned
+ *              Arg_count           - Count of objects in Arg_list
  *
  * RETURN:      Status
  *
@@ -188,7 +189,8 @@ void
 acpi_ps_pop_scope (
        ACPI_PARSE_STATE        *parser_state,
        ACPI_PARSE_OBJECT       **op,
-       u32                     *arg_list)
+       u32                     *arg_list,
+       u32                     *arg_count)
 {
        ACPI_GENERIC_STATE      *scope = parser_state->scope;
 
@@ -204,6 +206,7 @@ acpi_ps_pop_scope (
 
                *op                     = scope->parse_scope.op;
                *arg_list               = scope->parse_scope.arg_list;
+               *arg_count              = scope->parse_scope.arg_count;
                parser_state->pkg_end   = scope->parse_scope.pkg_end;
 
                /* All done with this scope state structure */
@@ -216,6 +219,7 @@ acpi_ps_pop_scope (
 
                *op                     = NULL;
                *arg_list               = 0;
+               *arg_count              = 0;
        }
 
 
index 55a897414113f9011c85a298506090e4ddcc1738..a22bb646df08460d46cd9568e7fe8c58c316d1fa 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: pstree - Parser op tree manipulation/traversal/search
- *              $Revision: 23 $
+ *              $Revision: 25 $
  *
  *****************************************************************************/
 
@@ -287,114 +287,3 @@ acpi_ps_get_depth_next (
 }
 
 
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_ps_fetch_prefix
- *
- * PARAMETERS:  Scope           - Op to fetch prefix for
- *              Path            - A namestring containing the prefix
- *              io              - Direction flag
- *
- * RETURN:      Op referenced by the prefix
- *
- * DESCRIPTION: Fetch and handle path prefix ('\\' or '^')
- *
- ******************************************************************************/
-
-ACPI_PARSE_OBJECT *
-acpi_ps_fetch_prefix (
-       ACPI_PARSE_OBJECT       *scope,
-       NATIVE_CHAR             **path,
-       u32                     io)
-{
-       u32                     prefix = io ? GET8 (*path):**path;
-
-
-       switch (prefix)
-       {
-       case '\\':
-       case '/':
-
-               /* go to the root */
-
-               *path += 1;
-               while (scope->parent) {
-                       scope = scope->parent;
-               }
-               break;
-
-
-       case '^':
-
-               /* go up one level */
-
-               *path += 1;
-               scope = scope->parent;
-               break;
-       }
-
-       if (scope && !scope->parent) {
-               /* searching from the root, start with its children */
-
-               scope = acpi_ps_get_child (scope);
-       }
-
-       return (scope);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_ps_fetch_name
- *
- * PARAMETERS:  Path            - A string containing the name segment
- *              io              - Direction flag
- *
- * RETURN:      The 4-s8 ASCII ACPI Name as a u32
- *
- * DESCRIPTION: Fetch ACPI name segment (dot-delimited)
- *
- ******************************************************************************/
-
-u32
-acpi_ps_fetch_name (
-       NATIVE_CHAR             **path,
-       u32                     io)
-{
-       u32                     name = 0;
-       NATIVE_CHAR             *nm;
-       u32                     i;
-       NATIVE_CHAR             ch;
-
-
-       if (io) {
-               /* Get the name from the path pointer */
-
-               MOVE_UNALIGNED32_TO_32 (&name, *path);
-               *path += 4;
-       }
-
-       else {
-               if (**path == '.') {
-                       *path += 1;
-               }
-
-               nm = (NATIVE_CHAR *) &name;
-               for (i = 0; i < 4; i++) {
-                       ch = **path;
-                       if (ch && ch != '.') {
-                               *nm = ch;
-                               *path += 1;
-                       }
-
-                       else {
-                               *nm = '_';
-                       }
-                       nm++;
-               }
-       }
-
-       return (name);
-}
-
-
index d190a2755dcca936eac79f1b71484046466fbc06..3bac4a647012ac60481d2b853738c61370e87fab 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: psutils - Parser miscellaneous utilities (Parser only)
- *              $Revision: 29 $
+ *              $Revision: 30 $
  *
  *****************************************************************************/
 
@@ -460,7 +460,12 @@ acpi_ps_is_deferred_op (
        u16                     opcode)
 {
        return ((u8)
-                  (opcode == AML_METHOD_OP ||
+                  (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_REGION_OP));
 }
 
index 77a287d6d2321f75a07deeabd9c5973db42e9197..04a75917d6ffe7d3fea0380947dbb3b149be5d1a 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: pswalk - Parser routines to walk parsed op tree(s)
- *              $Revision: 45 $
+ *              $Revision: 50 $
  *
  *****************************************************************************/
 
@@ -42,8 +42,6 @@
  * PARAMETERS:  Walk_state          - Current state of the walk
  *              Op                  - Current Op to be walked
  *              Ascending_callback  - Procedure called when Op is complete
- *              Prev_op             - Where the previous Op is stored
- *              Next_op             - Where the next Op in the walk is stored
  *
  * RETURN:      Status
  *
@@ -90,112 +88,40 @@ acpi_ps_get_next_walk_op (
 
                status = ascending_callback (walk_state, op);
 
-               switch (status)
-               {
-               case AE_CTRL_TERMINATE:
+               /*
+                * If we are back to the starting point, the walk is complete.
+                */
+               if (op == walk_state->origin) {
+                       /* Reached the point of origin, the walk is complete */
 
-                       /*
-                        * A control method was terminated via a RETURN statement.
-                        * The walk of this method is complete.
-                        */
-                       walk_state->prev_op     = walk_state->origin;
+                       walk_state->prev_op     = op;
                        walk_state->next_op     = NULL;
 
-                       return (AE_OK);
-                       break;
-
-
-               case AE_CTRL_FALSE:
-
-                       /*
-                        * Either an IF/WHILE Predicate was false or we encountered a BREAK
-                        * opcode.  In both cases, we do not execute the rest of the
-                        * package;  We simply close out the parent (finishing the walk of
-                        * this branch of the tree) and continue execution at the parent
-                        * level.
-                        */
-
-                       next        = parent->next;
-                       status      = AE_OK;
-
-                       /*
-                        * If there is a sibling to the parent, we must close out the
-                        * parent now, because we are going to continue to go downward (to
-                        * the sibling) in the parse tree.
-                        */
-                       if (next) {
-                               status = ascending_callback (walk_state, parent);
-
-                               /* The parent sibling will be next */
-
-                               walk_state->prev_op     = op;
-                               walk_state->next_op     = next;
-                               walk_state->next_op_info = NEXT_OP_DOWNWARD;
-
-                               /* Continue downward */
-
-                               return (AE_OK);
-                       }
-
-                       /*
-                        * Drop into the loop below because we are moving upwards in
-                        * the tree
-                        */
-
-                       break;
-
-
-               default:
-                       /*
-                        * If we are back to the starting point, the walk is complete.
-                        */
-                       if (op == walk_state->origin) {
-                               /* Reached the point of origin, the walk is complete */
-
-                               walk_state->prev_op     = op;
-                               walk_state->next_op     = NULL;
-
-                               return (status);
-                       }
-
-                       /*
-                        * Check for a sibling to the current op.  A sibling means
-                        * we are still going "downward" in the tree.
-                        */
-
-                       if (next) {
-                               /* There is a sibling, it will be next */
-
-                               walk_state->prev_op     = op;
-                               walk_state->next_op     = next;
-                               walk_state->next_op_info = NEXT_OP_DOWNWARD;
+                       return (status);
+               }
 
-                               /* Continue downward */
+               /*
+                * Check for a sibling to the current op.  A sibling means
+                * we are still going "downward" in the tree.
+                */
 
-                               return (status);
-                       }
+               if (next) {
+                       /* There is a sibling, it will be next */
 
-                       /*
-                        * No sibling, but check status.
-                        * Abort on error from callback routine
-                        */
-                       if (ACPI_FAILURE (status)) {
-                               /* Next op will be the parent */
+                       walk_state->prev_op     = op;
+                       walk_state->next_op     = next;
+                       walk_state->next_op_info = NEXT_OP_DOWNWARD;
 
-                               walk_state->prev_op     = op;
-                               walk_state->next_op     = parent;
-                               walk_state->next_op_info = NEXT_OP_UPWARD;
+                       /* Continue downward */
 
-                               return (status);
-                       }
+                       return (status);
+               }
 
-                       /*
-                        * Drop into the loop below because we are moving upwards in
-                        * the tree
-                        */
 
-                       break;
-               }
+               /*
+                * Drop into the loop below because we are moving upwards in
+                * the tree
+                */
        }
 
        else {
@@ -221,69 +147,6 @@ acpi_ps_get_next_walk_op (
 
                status = ascending_callback (walk_state, parent);
 
-
-               switch (status)
-               {
-               case AE_CTRL_FALSE:
-
-                       /*
-                        * Either an IF/WHILE Predicate was false or we encountered a
-                        * BREAK opcode.  In both cases, we do not execute the rest of the
-                        * package;  We simply close out the parent (finishing the walk of
-                        * this branch of the tree) and continue execution at the parent
-                        * level.
-                        */
-
-                       parent      = grand_parent;
-                       next        = grand_parent->next;
-                       grand_parent = grand_parent->parent;
-
-                       status = ascending_callback (walk_state, parent);
-
-                       /* Now continue to the next node in the tree */
-
-                       break;
-
-
-               case AE_CTRL_TRUE:
-
-                       /*
-                        * Predicate of a WHILE was true and the loop just completed an
-                        * execution.  Go back to the start of the loop and reevaluate the
-                        * predicate.
-                        */
-
-                       op = walk_state->control_state->control.predicate_op;
-
-                       walk_state->control_state->common.state = CONTROL_PREDICATE_EXECUTING;
-
-                       /*
-                        * Acpi_evaluate the predicate again (next)
-                        * Because we will traverse WHILE tree again
-                        */
-
-                       walk_state->prev_op     = op->parent;
-                       walk_state->next_op     = op;
-                       walk_state->next_op_info = NEXT_OP_DOWNWARD;
-
-                       return (AE_OK);
-                       break;
-
-
-               case AE_CTRL_TERMINATE:
-
-                       /*
-                        * A control method was terminated via a RETURN statement.
-                        * The walk of this method is complete.
-                        */
-                       walk_state->prev_op     = walk_state->origin;
-                       walk_state->next_op     = NULL;
-
-                       return (AE_OK);
-                       break;
-               }
-
-
                /*
                 * If we are back to the starting point, the walk is complete.
                 */
@@ -296,7 +159,6 @@ acpi_ps_get_next_walk_op (
                        return (status);
                }
 
-
                /*
                 * If there is a sibling to this parent (it is not the starting point
                 * Op), then we will visit it.
@@ -311,18 +173,6 @@ acpi_ps_get_next_walk_op (
                        return (status);
                }
 
-               /*
-                * No sibling, check for an error from closing the parent
-                * (Also, AE_PENDING if a method call was encountered)
-                */
-               if (ACPI_FAILURE (status)) {
-                       walk_state->prev_op     = parent;
-                       walk_state->next_op     = grand_parent;
-                       walk_state->next_op_info = NEXT_OP_UPWARD;
-
-                       return (status);
-               }
-
                /* No siblings, no errors, just move up one more level in the tree */
 
                op                  = parent;
@@ -342,251 +192,88 @@ acpi_ps_get_next_walk_op (
 
 /*******************************************************************************
  *
- * FUNCTION:    Acpi_ps_walk_loop
+ * FUNCTION:    Acpi_ps_delete_completed_op
  *
- * PARAMETERS:  Walk_list           - State of the walk
- *              Start_op            - Starting Op of the subtree to be walked
- *              Descending_callback - Procedure called when a new Op is
- *                                    encountered
- *              Ascending_callback  - Procedure called when Op is complete
+ * PARAMETERS:  State           - Walk state
+ *              Op              - Completed op
  *
- * RETURN:      Status
+ * RETURN:      AE_OK
  *
- * DESCRIPTION: Perform a walk of the parsed AML tree.  Begins and terminates at
- *              the Start_op.
+ * DESCRIPTION: Callback function for Acpi_ps_get_next_walk_op(). Used during
+ *              Acpi_ps_delete_parse tree to delete Op objects when all sub-objects
+ *              have been visited (and deleted.)
  *
  ******************************************************************************/
 
-ACPI_STATUS
-acpi_ps_walk_loop (
-       ACPI_WALK_LIST          *walk_list,
-       ACPI_PARSE_OBJECT       *start_op,
-       ACPI_PARSE_DOWNWARDS    descending_callback,
-       ACPI_PARSE_UPWARDS      ascending_callback)
+static ACPI_STATUS
+acpi_ps_delete_completed_op (
+       ACPI_WALK_STATE         *state,
+       ACPI_PARSE_OBJECT       *op)
 {
-       ACPI_STATUS             status = AE_OK;
-       ACPI_WALK_STATE         *walk_state;
-       ACPI_PARSE_OBJECT       *op = start_op;
-
-
-       walk_state = acpi_ds_get_current_walk_state (walk_list);
-
-
-       /* Walk entire subtree, visiting all nodes depth-first */
-
-       while (op) {
-               if (walk_state->next_op_info != NEXT_OP_UPWARD) {
-                       status = descending_callback (op->opcode, op, walk_state, NULL);
-               }
-
-               /*
-                * A TRUE exception means that an ELSE was detected, but the IF
-                * predicate evaluated TRUE.
-                */
-               if (status == AE_CTRL_TRUE) {
-                       /*
-                        * Ignore the entire ELSE block by moving on to the the next opcode.
-                        * And we do that by simply going up in the tree (either to the next
-                        * sibling or to the parent) from here.
-                        */
-
-                       walk_state->next_op_info = NEXT_OP_UPWARD;
-               }
-
-               /* Get the next node (op) in the depth-first walk */
-
-               status = acpi_ps_get_next_walk_op (walk_state, op, ascending_callback);
-
-               /*
-                * A PENDING exception means that a control method invocation has been
-                * detected
-                */
-
-               if (status == AE_CTRL_PENDING) {
-                       /* Transfer control to the called control method */
-
-                       status = acpi_ds_call_control_method (walk_list, walk_state, op);
-
-                       /*
-                        * If the transfer to the new method method call worked, a new walk
-                        * state was created -- get it
-                        */
-
-                       walk_state = acpi_ds_get_current_walk_state (walk_list);
-               }
-
-               /* Abort the walk on any exception */
-
-               if (ACPI_FAILURE (status)) {
-                       return (status);
-               }
-
-               op = walk_state->next_op;
-       }
 
+       acpi_ps_free_op (op);
        return (AE_OK);
 }
 
 
 /*******************************************************************************
  *
- * FUNCTION:    Acpi_ps_walk_parsed_aml
- *
- * PARAMETERS:  Start_op            - Starting Op of the subtree to be walked
- *              End_op              - Where to terminate the walk
- *              Descending_callback - Procedure called when a new Op is
- *                                    encountered
- *              Ascending_callback  - Procedure called when Op is complete
+ * FUNCTION:    Acpi_ps_delete_parse_tree
  *
- * RETURN:      Status
+ * PARAMETERS:  Subtree_root        - Root of tree (or subtree) to delete
  *
- * DESCRIPTION: Top level interface to walk the parsed AML tree.  Handles
- *              preemption of executing control methods.
+ * RETURN:      None
  *
- *              NOTE: The End_op is usually only different from the Start_op if
- *              we don't want to visit the Start_op during the tree descent.
+ * DESCRIPTION: Delete a portion of or an entire parse tree.
  *
  ******************************************************************************/
 
-ACPI_STATUS
-acpi_ps_walk_parsed_aml (
-       ACPI_PARSE_OBJECT       *start_op,
-       ACPI_PARSE_OBJECT       *end_op,
-       ACPI_OPERAND_OBJECT     *mth_desc,
-       ACPI_NAMESPACE_NODE     *start_node,
-       ACPI_OPERAND_OBJECT     **params,
-       ACPI_OPERAND_OBJECT     **caller_return_desc,
-       ACPI_OWNER_ID           owner_id,
-       ACPI_PARSE_DOWNWARDS    descending_callback,
-       ACPI_PARSE_UPWARDS      ascending_callback)
+void
+acpi_ps_delete_parse_tree (
+       ACPI_PARSE_OBJECT       *subtree_root)
 {
-       ACPI_PARSE_OBJECT       *op;
        ACPI_WALK_STATE         *walk_state;
-       ACPI_OPERAND_OBJECT     *return_desc;
-       ACPI_STATUS             status;
        ACPI_WALK_LIST          walk_list;
-       ACPI_WALK_LIST          *prev_walk_list;
 
 
-       /* Parameter Validation */
-
-       if (!start_op || !end_op) {
-               return (AE_BAD_PARAMETER);
+       if (!subtree_root) {
+               return;
        }
 
-       /* Initialize a new walk list */
+       /* Create and initialize a new walk list */
 
        walk_list.walk_state = NULL;
-
-       walk_state = acpi_ds_create_walk_state (owner_id, end_op, mth_desc, &walk_list);
+       walk_state = acpi_ds_create_walk_state (TABLE_ID_DSDT, NULL, NULL, &walk_list);
        if (!walk_state) {
-               return (AE_NO_MEMORY);
-       }
-
-       /* TBD: [Restructure] TEMP until we pass Walk_state to the interpreter
-        */
-       prev_walk_list = acpi_gbl_current_walk_list;
-       acpi_gbl_current_walk_list = &walk_list;
-
-       if (start_node) {
-               /* Push start scope on scope stack and make it current  */
-
-               status = acpi_ds_scope_stack_push (start_node, ACPI_TYPE_METHOD, walk_state);
-               if (ACPI_FAILURE (status)) {
-                       return (status);
-               }
-
+               return;
        }
 
-       if (mth_desc) {
-               /* Init arguments if this is a control method */
-               /* TBD: [Restructure] add walkstate as a param */
+       walk_state->parser_state        = NULL;
+       walk_state->parse_flags         = 0;
+       walk_state->descending_callback = NULL;
+       walk_state->ascending_callback  = NULL;
 
-               acpi_ds_method_data_init_args (params, MTH_NUM_ARGS, walk_state);
-       }
 
-       op = start_op;
-       status = AE_OK;
+       walk_state->origin = subtree_root;
+       walk_state->next_op = subtree_root;
 
 
-       /*
-        * Execute the walk loop as long as there is a valid Walk State.  This
-        * handles nested control method invocations without recursion.
-        */
+       /* Head downward in the tree */
 
-       while (walk_state) {
-               if (ACPI_SUCCESS (status)) {
-                       status = acpi_ps_walk_loop (&walk_list, op, descending_callback,
-                                        ascending_callback);
-               }
+       walk_state->next_op_info = NEXT_OP_DOWNWARD;
 
-               /* We are done with this walk, move on to the parent if any */
-
-               BREAKPOINT3;
-
-               walk_state = acpi_ds_pop_walk_state (&walk_list);
-
-               /* Extract return value before we delete Walk_state */
-
-               return_desc = walk_state->return_desc;
-
-               /* Reset the current scope to the beginning of scope stack */
-
-               acpi_ds_scope_stack_clear (walk_state);
-
-               /*
-                * If we just returned from the execution of a control method,
-                * there's lots of cleanup to do
-                */
+       /* Visit all nodes in the subtree */
 
-               if (walk_state->method_desc) {
-                       acpi_ds_terminate_control_method (walk_state);
-               }
-
-                /* Delete this walk state and all linked control states */
-
-               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))
-               {
-                       /* There is another walk state, restart it */
-
-                       /*
-                        * If the method returned value is not used by the parent,
-                        * The object is deleted
-                        */
-
-                       acpi_ds_restart_control_method (walk_state, return_desc);
-
-                       /* Get the next Op to process */
-
-                       op = walk_state->next_op;
-               }
-
-               /*
-                * Just completed a 1st-level method, save the final internal return
-                * value (if any)
-                */
-
-               else if (caller_return_desc) {
-                       *caller_return_desc = return_desc; /* NULL if no return value */
-               }
-
-               else if (return_desc) {
-                       /* Caller doesn't want it, must delete it */
-
-                       acpi_cm_remove_reference (return_desc);
-               }
+       while (walk_state->next_op) {
+               acpi_ps_get_next_walk_op (walk_state, walk_state->next_op,
+                                acpi_ps_delete_completed_op);
        }
 
+       /* We are done with this walk */
 
-       acpi_gbl_current_walk_list = prev_walk_list;
+       acpi_ds_delete_walk_state (walk_state);
 
-       return (status);
+       return;
 }
 
 
index 70451d31808230e23ce75c5c096554fb54036604..a33ace05117f65ffd70c34dde7ea111c84a264b8 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: psxface - Parser external interfaces
- *              $Revision: 36 $
+ *              $Revision: 37 $
  *
  *****************************************************************************/
 
  *
  * FUNCTION:    Acpi_psx_execute
  *
- * PARAMETERS:  Obj_desc            - A method object containing both the AML
+ * PARAMETERS:  Method_node         - A method object containing both the AML
  *                                    address and length.
  *              **Params            - List of parameters to pass to method,
  *                                    terminated by NULL. Params itself may be
  *                                    NULL if no parameters are being passed.
+ *              **Return_obj_desc   - Return object from execution of the
+ *                                    method.
  *
  * RETURN:      Status
  *
index edd89713320bbf7177a46838fb379b30259e39fb..751ef5de8f1902c93309a10e6556b84e3b5e6d78 100644 (file)
@@ -2,26 +2,14 @@
 # Makefile for all Linux ACPI interpreter subdirectories
 #
 
-SUB_DIRS        := 
-MOD_SUB_DIRS    := $(SUB_DIRS)
-MOD_IN_SUB_DIRS :=
-ALL_SUB_DIRS    := $(SUB_DIRS)
-
 O_TARGET := ../$(shell basename `pwd`).o
-O_OBJS   :=
-M_OBJS   :=
 
-ACPI_OBJS := $(patsubst %.c,%.o,$(wildcard *.c))
+obj-$(CONFIG_ACPI) := $(patsubst %.c,%.o,$(wildcard *.c))
 
 EXTRA_CFLAGS += -I../include
 
 EXTRA_CFLAGS += $(ACPI_CFLAGS)
 
-# if the interpreter is used, it overrides arch/i386/kernel/acpi.c
-ifeq ($(CONFIG_ACPI_INTERPRETER),y)
-  O_OBJS := $(ACPI_OBJS)
-endif
-
 include $(TOPDIR)/Rules.make
 
 clean:
index 6b02344811d38271c05c8d64b24f045b82ecd6a7..e48666113f97542c11f88f057419415d876b31bb 100644 (file)
@@ -1,12 +1,12 @@
-/******************************************************************************
+/*******************************************************************************
  *
  * Module Name: rsaddr - Acpi_rs_address16_resource
  *                       Acpi_rs_address16_stream
  *                       Acpi_rs_address32_resource
  *                       Acpi_rs_address32_stream
- *              $Revision: 9 $
+ *              $Revision: 12 $
  *
- *****************************************************************************/
+ ******************************************************************************/
 
 /*
  *  Copyright (C) 2000 R. Byron Moore
 
 
 #include "acpi.h"
+#include "acresrc.h"
 
 #define _COMPONENT          RESOURCE_MANAGER
         MODULE_NAME         ("rsaddr")
 
 
-/***************************************************************************
+/*******************************************************************************
+ *
  * FUNCTION:    Acpi_rs_address16_resource
  *
- * PARAMETERS:
- *              Byte_stream_buffer      - Pointer to the resource input byte
+ * 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
@@ -53,7 +54,7 @@
  *                  structure pointed to by the Output_buffer. Return the
  *                  number of bytes consumed from the byte stream.
  *
- ***************************************************************************/
+ ******************************************************************************/
 
 ACPI_STATUS
 acpi_rs_address16_resource (
@@ -253,11 +254,11 @@ acpi_rs_address16_resource (
 }
 
 
-/***************************************************************************
+/*******************************************************************************
+ *
  * FUNCTION:    Acpi_rs_address16_stream
  *
- * PARAMETERS:
- *              Linked_list             - Pointer to the resource linked list
+ * 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
@@ -268,7 +269,7 @@ acpi_rs_address16_resource (
  * DESCRIPTION: Take the linked list resource structure and fills in the
  *                  the appropriate bytes in a byte stream
  *
- ***************************************************************************/
+ ******************************************************************************/
 
 ACPI_STATUS
 acpi_rs_address16_stream (
@@ -350,7 +351,6 @@ acpi_rs_address16_stream (
         */
        MOVE_UNALIGNED16_TO_16 (buffer,
                         &linked_list->data.address16.min_address_range);
-
        buffer += 2;
 
        /*
@@ -358,7 +358,6 @@ acpi_rs_address16_stream (
         */
        MOVE_UNALIGNED16_TO_16 (buffer,
                         &linked_list->data.address16.max_address_range);
-
        buffer += 2;
 
        /*
@@ -366,7 +365,6 @@ acpi_rs_address16_stream (
         */
        MOVE_UNALIGNED16_TO_16 (buffer,
                          &linked_list->data.address16.address_translation_offset);
-
        buffer += 2;
 
        /*
@@ -374,7 +372,6 @@ acpi_rs_address16_stream (
         */
        MOVE_UNALIGNED16_TO_16 (buffer,
                         &linked_list->data.address16.address_length);
-
        buffer += 2;
 
        /*
@@ -418,11 +415,12 @@ acpi_rs_address16_stream (
        return (AE_OK);
 }
 
-/***************************************************************************
+
+/*******************************************************************************
+ *
  * FUNCTION:    Acpi_rs_address32_resource
  *
- * PARAMETERS:
- *              Byte_stream_buffer      - Pointer to the resource input byte
+ * 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
@@ -438,7 +436,7 @@ acpi_rs_address16_stream (
  *                  structure pointed to by the Output_buffer. Return the
  *                  number of bytes consumed from the byte stream.
  *
- ***************************************************************************/
+ ******************************************************************************/
 
 ACPI_STATUS
 acpi_rs_address32_resource (
@@ -641,11 +639,11 @@ acpi_rs_address32_resource (
 }
 
 
-/***************************************************************************
+/*******************************************************************************
+ *
  * FUNCTION:    Acpi_rs_address32_stream
  *
- * PARAMETERS:
- *              Linked_list             - Pointer to the resource linked list
+ * 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
@@ -656,7 +654,7 @@ acpi_rs_address32_resource (
  * DESCRIPTION: Take the linked list resource structure and fills in the
  *                  the appropriate bytes in a byte stream
  *
- ***************************************************************************/
+ ******************************************************************************/
 
 ACPI_STATUS
 acpi_rs_address32_stream (
@@ -676,7 +674,6 @@ acpi_rs_address32_stream (
         * The descriptor field is static
         */
        *buffer = 0x87;
-
        buffer += 1;
 
        /*
@@ -684,7 +681,6 @@ acpi_rs_address32_stream (
         */
 
        length_field = (u16 *)buffer;
-
        buffer += 2;
 
        /*
@@ -693,22 +689,17 @@ acpi_rs_address32_stream (
        temp8 = (u8) (linked_list->data.address32.resource_type & 0x03);
 
        *buffer = temp8;
-
        buffer += 1;
 
        /*
         * Set the general flags
         */
        temp8 = (u8) (linked_list->data.address32.producer_consumer & 0x01);
-
        temp8 |= (linked_list->data.address32.decode & 0x01) << 1;
-
        temp8 |= (linked_list->data.address32.min_address_fixed & 0x01) << 2;
-
        temp8 |= (linked_list->data.address32.max_address_fixed & 0x01) << 3;
 
        *buffer = temp8;
-
        buffer += 1;
 
        /*
@@ -747,7 +738,6 @@ acpi_rs_address32_stream (
         */
        MOVE_UNALIGNED32_TO_32 (buffer,
                         &linked_list->data.address32.min_address_range);
-
        buffer += 4;
 
        /*
@@ -755,7 +745,6 @@ acpi_rs_address32_stream (
         */
        MOVE_UNALIGNED32_TO_32 (buffer,
                         &linked_list->data.address32.max_address_range);
-
        buffer += 4;
 
        /*
@@ -763,7 +752,6 @@ acpi_rs_address32_stream (
         */
        MOVE_UNALIGNED32_TO_32 (buffer,
                          &linked_list->data.address32.address_translation_offset);
-
        buffer += 4;
 
        /*
@@ -771,7 +759,6 @@ acpi_rs_address32_stream (
         */
        MOVE_UNALIGNED32_TO_32 (buffer,
                         &linked_list->data.address32.address_length);
-
        buffer += 4;
 
        /*
@@ -781,7 +768,6 @@ acpi_rs_address32_stream (
                temp8 = (u8) linked_list->data.address32.resource_source_index;
 
                *buffer = temp8;
-
                buffer += 1;
 
                temp_pointer = (NATIVE_CHAR *) buffer;
index 7d1a75c800c75d3cd2e3b8a24dae16e0f84d3382..2874aa3d05946c0030764b44031ca14032900ef0 100644 (file)
@@ -1,10 +1,10 @@
-/******************************************************************************
+/*******************************************************************************
  *
  * Module Name: rscalc - Acpi_rs_calculate_byte_stream_length
  *                       Acpi_rs_calculate_list_length
- *              $Revision: 9 $
+ *              $Revision: 16 $
  *
- *****************************************************************************/
+ ******************************************************************************/
 
 /*
  *  Copyright (C) 2000 R. Byron Moore
 
 
 #include "acpi.h"
+#include "acresrc.h"
 
 #define _COMPONENT          RESOURCE_MANAGER
         MODULE_NAME         ("rscalc")
 
 
-/***************************************************************************
+/*******************************************************************************
+ *
  * FUNCTION:    Acpi_rs_calculate_byte_stream_length
  *
- * PARAMETERS:
- *              Linked_list         - Pointer to the resource linked list
+ * PARAMETERS:  Linked_list         - Pointer to the resource linked list
  *              Size_needed         - u32 pointer of the size buffer needed
  *                                      to properly return the parsed data
  *
@@ -45,7 +46,7 @@
  *              the size buffer needed to hold the linked list that conveys
  *              the resource data.
  *
- ***************************************************************************/
+ ******************************************************************************/
 
 ACPI_STATUS
 acpi_rs_calculate_byte_stream_length (
@@ -279,15 +280,14 @@ acpi_rs_calculate_byte_stream_length (
        *size_needed = byte_stream_size_needed;
 
        return (AE_OK);
-
-} /* Acpi_rs_calculate_byte_stream_length */
+}
 
 
-/***************************************************************************
+/*******************************************************************************
+ *
  * FUNCTION:    Acpi_rs_calculate_list_length
  *
- * PARAMETERS:
- *              Byte_stream_buffer      - Pointer to the resource byte stream
+ * 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
@@ -299,7 +299,7 @@ acpi_rs_calculate_byte_stream_length (
  *              the size buffer needed to hold the linked list that conveys
  *              the resource data.
  *
- ***************************************************************************/
+ ******************************************************************************/
 
 ACPI_STATUS
 acpi_rs_calculate_list_length (
@@ -344,7 +344,6 @@ acpi_rs_calculate_list_length (
 
                                structure_size = sizeof (MEMORY24_RESOURCE) +
                                                  RESOURCE_LENGTH_NO_DATA;
-
                                break;
 
                        case LARGE_VENDOR_DEFINED:
@@ -481,7 +480,6 @@ acpi_rs_calculate_list_length (
                                 *  Interrupt table length to the Temp8 variable.
                                 */
                                buffer += 3;
-
                                temp8 = *buffer;
 
                                /*
@@ -521,7 +519,7 @@ acpi_rs_calculate_list_length (
 
                                break;
 
-/* 64-bit not currently supported */
+/* TBD: [Future] 64-bit not currently supported */
 /*
                        case 0x8A:
                                break;
@@ -555,7 +553,6 @@ acpi_rs_calculate_list_length (
                                 *  trailing bytes
                                 */
                                buffer = byte_stream_buffer;
-
                                temp8 = *buffer;
 
                                if(temp8 & 0x01) {
@@ -587,7 +584,6 @@ acpi_rs_calculate_list_length (
                                structure_size = sizeof (IO_RESOURCE) +
                                                  RESOURCE_LENGTH_NO_DATA +
                                                  (number_of_interrupts * sizeof (u32));
-
                                break;
 
 
@@ -621,7 +617,6 @@ acpi_rs_calculate_list_length (
                                structure_size = sizeof (DMA_RESOURCE) +
                                                  RESOURCE_LENGTH_NO_DATA +
                                                  (number_of_channels * sizeof (u32));
-
                                break;
 
 
@@ -634,7 +629,6 @@ acpi_rs_calculate_list_length (
                                 * Determine if it there are two or three trailing bytes
                                 */
                                buffer = byte_stream_buffer;
-
                                temp8 = *buffer;
 
                                if(temp8 & 0x01) {
@@ -657,7 +651,6 @@ acpi_rs_calculate_list_length (
                                 * End Dependent Functions Resource
                                 */
                                bytes_consumed = 1;
-
                                structure_size = RESOURCE_LENGTH;
                                break;
 
@@ -667,7 +660,6 @@ acpi_rs_calculate_list_length (
                                 * IO Port Resource
                                 */
                                bytes_consumed = 8;
-
                                structure_size = sizeof (IO_RESOURCE) +
                                                  RESOURCE_LENGTH_NO_DATA;
                                break;
@@ -679,7 +671,6 @@ acpi_rs_calculate_list_length (
                                 * Fixed IO Port Resource
                                 */
                                bytes_consumed = 4;
-
                                structure_size = sizeof (FIXED_IO_RESOURCE) +
                                                  RESOURCE_LENGTH_NO_DATA;
                                break;
@@ -700,7 +691,6 @@ acpi_rs_calculate_list_length (
                                 * 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));
@@ -713,7 +703,6 @@ acpi_rs_calculate_list_length (
                                 * End Tag
                                 */
                                bytes_consumed = 2;
-
                                structure_size = RESOURCE_LENGTH;
                                break;
 
@@ -749,14 +738,14 @@ acpi_rs_calculate_list_length (
        *size_needed = buffer_size;
 
        return (AE_OK);
+}
 
-} /* Acpi_rs_calculate_list_length */
 
-/***************************************************************************
+/*******************************************************************************
+ *
  * FUNCTION:    Acpi_rs_calculate_pci_routing_table_length
  *
- * PARAMETERS:
- *              Package_object          - Pointer to the package object
+ * PARAMETERS:  Package_object          - Pointer to the package object
  *              Buffer_size_needed      - u32 pointer of the size buffer
  *                                          needed to properly return the
  *                                          parsed data
@@ -767,17 +756,22 @@ acpi_rs_calculate_list_length (
  *                calculates the size of the corresponding linked list of
  *                descriptions.
  *
- ***************************************************************************/
+ ******************************************************************************/
 
 ACPI_STATUS
 acpi_rs_calculate_pci_routing_table_length (
        ACPI_OPERAND_OBJECT     *package_object,
        u32                     *buffer_size_needed)
 {
-       u32                      number_of_elements;
-       u32                      temp_size_needed;
-       ACPI_OPERAND_OBJECT      **top_object_list;
-       u32                      index;
+       u32                     number_of_elements;
+       u32                     temp_size_needed = 0;
+       ACPI_OPERAND_OBJECT     **top_object_list;
+       u32                     index;
+       ACPI_OPERAND_OBJECT     *package_element;
+       ACPI_OPERAND_OBJECT     **sub_object_list;
+       u8                      name_found;
+       u32                     table_index;
+
 
        number_of_elements = package_object->package.count;
 
@@ -791,8 +785,6 @@ acpi_rs_calculate_pci_routing_table_length (
         * NOTE: The Number_of_elements is incremented by one to add an end
         * table structure that is essentially a structure of zeros.
         */
-       temp_size_needed = (number_of_elements + 1) *
-                         (sizeof (PCI_ROUTING_TABLE) - 1);
 
        /*
         * But each PRT_ENTRY structure has a pointer to a string and
@@ -801,11 +793,6 @@ acpi_rs_calculate_pci_routing_table_length (
        top_object_list = package_object->package.elements;
 
        for (index = 0; index < number_of_elements; index++) {
-               ACPI_OPERAND_OBJECT     *package_element;
-               ACPI_OPERAND_OBJECT     **sub_object_list;
-               u8                      name_found;
-               u32                     table_index;
-
                /*
                 * Dereference the sub-package
                 */
@@ -835,6 +822,8 @@ acpi_rs_calculate_pci_routing_table_length (
                        }
                }
 
+               temp_size_needed += (sizeof (PCI_ROUTING_TABLE) - 1);
+
                /*
                 * Was a String type found?
                 */
@@ -844,7 +833,6 @@ acpi_rs_calculate_pci_routing_table_length (
                         * terminating NULL
                         */
                        temp_size_needed += (*sub_object_list)->string.length;
-                       temp_size_needed = ROUND_UP_TO_32_bITS (temp_size_needed);
                }
 
                else {
@@ -855,13 +843,19 @@ acpi_rs_calculate_pci_routing_table_length (
                        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);
+
                /*
                 * Point to the next ACPI_OPERAND_OBJECT
                 */
                top_object_list++;
        }
 
-       *buffer_size_needed = temp_size_needed;
+
+       *buffer_size_needed = temp_size_needed + sizeof (PCI_ROUTING_TABLE);
 
        return (AE_OK);
-}
\ No newline at end of file
+}
index 01b3909da20488190693b371babbc6543f66948d..bc95686a7a6290655eb0526bb33ecbcc44bad4dc 100644 (file)
@@ -1,11 +1,11 @@
-/******************************************************************************
+/*******************************************************************************
  *
  * Module Name: rscreate - Acpi_rs_create_resource_list
  *                         Acpi_rs_create_pci_routing_table
  *                         Acpi_rs_create_byte_stream
- *              $Revision: 16 $
+ *              $Revision: 22 $
  *
- *****************************************************************************/
+ ******************************************************************************/
 
 /*
  *  Copyright (C) 2000 R. Byron Moore
@@ -182,11 +182,12 @@ acpi_rs_create_pci_routing_table (
                 * contain a u32 Address, a u8 Pin, a Name and a u8
                 * Source_index.
                 */
-               top_object_list = package_object->package.elements;
+               top_object_list     = package_object->package.elements;
+               number_of_elements  = package_object->package.count;
+               user_prt            = (PCI_ROUTING_TABLE *) buffer;
 
-               number_of_elements = package_object->package.count;
 
-               user_prt = (PCI_ROUTING_TABLE *) buffer;
+               buffer = ROUND_PTR_UP_TO_8 (buffer, u8);
 
                for (index = 0; index < number_of_elements; index++) {
                        /*
@@ -198,6 +199,7 @@ acpi_rs_create_pci_routing_table (
                        buffer += user_prt->length;
                        user_prt = (PCI_ROUTING_TABLE *) buffer;
 
+
                        /*
                         * Fill in the Length field with the information we
                         * have at this point.
@@ -237,7 +239,7 @@ acpi_rs_create_pci_routing_table (
 
                        if (ACPI_TYPE_NUMBER == (*sub_object_list)->common.type) {
                                user_prt->data.pin =
-                                               (*sub_object_list)->number.value;
+                                               (u32) (*sub_object_list)->number.value;
                        }
 
                        else {
@@ -257,8 +259,6 @@ acpi_rs_create_pci_routing_table (
                                 * Add to the Length field the length of the string
                                 */
                                user_prt->length += (*sub_object_list)->string.length;
-                               user_prt->length =
-                                       ROUND_UP_TO_32_bITS (user_prt->length);
                        }
 
                        else {
@@ -280,6 +280,10 @@ acpi_rs_create_pci_routing_table (
                                }
                        }
 
+                       /* Now align the current length */
+
+                       user_prt->length = ROUND_UP_TO_64_bITS (user_prt->length);
+
                        /*
                         * Dereference the Source Index
                         */
@@ -287,7 +291,7 @@ acpi_rs_create_pci_routing_table (
 
                        if (ACPI_TYPE_NUMBER == (*sub_object_list)->common.type) {
                                user_prt->data.source_index =
-                                               (*sub_object_list)->number.value;
+                                               (u32) (*sub_object_list)->number.value;
                        }
 
                        else {
@@ -314,7 +318,6 @@ acpi_rs_create_pci_routing_table (
        *output_buffer_length = buffer_size_needed;
 
        return (AE_OK);
-
 }
 
 
@@ -393,6 +396,5 @@ acpi_rs_create_byte_stream (
        }
 
        return (AE_OK);
-
 }
 
index ae697840c121d760b950a4d447c832d868dfa395..073f4ddd4a1b859e11d47d40b9721b7ad53fd052 100644 (file)
@@ -1,9 +1,9 @@
-/******************************************************************************
+/*******************************************************************************
  *
  * Module Name: rsdump - Functions do dump out the resource structures.
- *              $Revision: 10 $
+ *              $Revision: 13 $
  *
- *****************************************************************************/
+ ******************************************************************************/
 
 /*
  *  Copyright (C) 2000 R. Byron Moore
 
 
 #include "acpi.h"
+#include "acresrc.h"
 
 #define _COMPONENT          RESOURCE_MANAGER
         MODULE_NAME         ("rsdump")
 
 
-/******************************************************************************
+/*******************************************************************************
  *
  * FUNCTION:    Acpi_rs_dump_irq
  *
@@ -64,11 +65,11 @@ acpi_rs_dump_irq (
                         SHARED == irq_data->shared_exclusive ?
                         "Shared" : "Exclusive");
 
-       acpi_os_printf ("\t\t%d Interrupts ( ",
+       acpi_os_printf ("\t\t%X Interrupts ( ",
                         irq_data->number_of_interrupts);
 
        for (index = 0; index < irq_data->number_of_interrupts; index++) {
-               acpi_os_printf ("%d ", irq_data->interrupts[index]);
+               acpi_os_printf ("%X ", irq_data->interrupts[index]);
        }
 
        acpi_os_printf (")\n");
@@ -76,7 +77,7 @@ acpi_rs_dump_irq (
 }
 
 
-/******************************************************************************
+/*******************************************************************************
  *
  * FUNCTION:    Acpi_rs_dump_dma
  *
@@ -144,11 +145,11 @@ acpi_rs_dump_dma (
                break;
        }
 
-       acpi_os_printf ("\t\t_number of Channels: %d ( ",
+       acpi_os_printf ("\t\t_number of Channels: %X ( ",
                         dma_data->number_of_channels);
 
        for (index = 0; index < dma_data->number_of_channels; index++) {
-               acpi_os_printf ("%d ", dma_data->channels[index]);
+               acpi_os_printf ("%X ", dma_data->channels[index]);
        }
 
        acpi_os_printf (")\n");
@@ -156,7 +157,7 @@ acpi_rs_dump_dma (
 }
 
 
-/******************************************************************************
+/*******************************************************************************
  *
  * FUNCTION:    Acpi_rs_dump_start_dependent_functions
  *
@@ -221,7 +222,7 @@ acpi_rs_dump_start_dependent_functions (
 }
 
 
-/******************************************************************************
+/*******************************************************************************
  *
  * FUNCTION:    Acpi_rs_dump_io
  *
@@ -245,23 +246,23 @@ acpi_rs_dump_io (
        acpi_os_printf ("\t\t%d bit decode\n",
                         DECODE_16 == io_data->io_decode ? 16 : 10);
 
-       acpi_os_printf ("\t\t_range minimum base: 0x%08x\n",
+       acpi_os_printf ("\t\t_range minimum base: %08X\n",
                         io_data->min_base_address);
 
-       acpi_os_printf ("\t\t_range maximum base: 0x%08x\n",
+       acpi_os_printf ("\t\t_range maximum base: %08X\n",
                         io_data->max_base_address);
 
-       acpi_os_printf ("\t\t_alignment: 0x%08x\n",
+       acpi_os_printf ("\t\t_alignment: %08X\n",
                         io_data->alignment);
 
-       acpi_os_printf ("\t\t_range Length: 0x%08x\n",
+       acpi_os_printf ("\t\t_range Length: %08X\n",
                         io_data->range_length);
 
        return;
 }
 
 
-/******************************************************************************
+/*******************************************************************************
  *
  * FUNCTION:    Acpi_rs_dump_fixed_io
  *
@@ -281,17 +282,17 @@ acpi_rs_dump_fixed_io (
 
 
        acpi_os_printf ("\t_fixed Io Resource\n");
-       acpi_os_printf ("\t\t_range base address: 0x%08x",
+       acpi_os_printf ("\t\t_range base address: %08X",
                         fixed_io_data->base_address);
 
-       acpi_os_printf ("\t\t_range length: 0x%08x",
+       acpi_os_printf ("\t\t_range length: %08X",
                         fixed_io_data->range_length);
 
        return;
 }
 
 
-/******************************************************************************
+/*******************************************************************************
  *
  * FUNCTION:    Acpi_rs_dump_vendor_specific
  *
@@ -313,10 +314,10 @@ acpi_rs_dump_vendor_specific (
 
        acpi_os_printf ("\t_vendor Specific Resource\n");
 
-       acpi_os_printf ("\t\t_length: 0x%08x\n", vendor_data->length);
+       acpi_os_printf ("\t\t_length: %08X\n", vendor_data->length);
 
        for (index = 0; index < vendor_data->length; index++) {
-               acpi_os_printf ("\t\t_byte %d: 0x%08x\n",
+               acpi_os_printf ("\t\t_byte %X: %08X\n",
                                 index, vendor_data->reserved[index]);
        }
 
@@ -324,7 +325,7 @@ acpi_rs_dump_vendor_specific (
 }
 
 
-/******************************************************************************
+/*******************************************************************************
  *
  * FUNCTION:    Acpi_rs_dump_memory24
  *
@@ -350,23 +351,23 @@ acpi_rs_dump_memory24 (
                         memory24_data->read_write_attribute ?
                         "/Write" : " only");
 
-       acpi_os_printf ("\t\t_range minimum base: 0x%08x\n",
+       acpi_os_printf ("\t\t_range minimum base: %08X\n",
                         memory24_data->min_base_address);
 
-       acpi_os_printf ("\t\t_range maximum base: 0x%08x\n",
+       acpi_os_printf ("\t\t_range maximum base: %08X\n",
                         memory24_data->max_base_address);
 
-       acpi_os_printf ("\t\t_alignment: 0x%08x\n",
+       acpi_os_printf ("\t\t_alignment: %08X\n",
                         memory24_data->alignment);
 
-       acpi_os_printf ("\t\t_range length: 0x%08x\n",
+       acpi_os_printf ("\t\t_range length: %08X\n",
                         memory24_data->range_length);
 
        return;
 }
 
 
-/******************************************************************************
+/*******************************************************************************
  *
  * FUNCTION:    Acpi_rs_dump_memory32
  *
@@ -392,23 +393,23 @@ acpi_rs_dump_memory32 (
                         memory32_data->read_write_attribute ?
                         "/Write" : " only");
 
-       acpi_os_printf ("\t\t_range minimum base: 0x%08x\n",
+       acpi_os_printf ("\t\t_range minimum base: %08X\n",
                         memory32_data->min_base_address);
 
-       acpi_os_printf ("\t\t_range maximum base: 0x%08x\n",
+       acpi_os_printf ("\t\t_range maximum base: %08X\n",
                         memory32_data->max_base_address);
 
-       acpi_os_printf ("\t\t_alignment: 0x%08x\n",
+       acpi_os_printf ("\t\t_alignment: %08X\n",
                         memory32_data->alignment);
 
-       acpi_os_printf ("\t\t_range length: 0x%08x\n",
+       acpi_os_printf ("\t\t_range length: %08X\n",
                         memory32_data->range_length);
 
        return;
 }
 
 
-/******************************************************************************
+/*******************************************************************************
  *
  * FUNCTION:    Acpi_rs_dump_fixed_memory32
  *
@@ -434,17 +435,17 @@ acpi_rs_dump_fixed_memory32 (
                         fixed_memory32_data->read_write_attribute ?
                         "/Write" : " Only");
 
-       acpi_os_printf ("\t\t_range base address: 0x%08x\n",
+       acpi_os_printf ("\t\t_range base address: %08X\n",
                         fixed_memory32_data->range_base_address);
 
-       acpi_os_printf ("\t\t_range length: 0x%08x\n",
+       acpi_os_printf ("\t\t_range length: %08X\n",
                         fixed_memory32_data->range_length);
 
        return;
 }
 
 
-/******************************************************************************
+/*******************************************************************************
  *
  * FUNCTION:    Acpi_rs_dump_address16
  *
@@ -561,23 +562,23 @@ acpi_rs_dump_address16 (
                         ADDRESS_FIXED == address16_data->max_address_fixed ?
                         "" : "not");
 
-       acpi_os_printf ("\t\t_granularity: 0x%08x\n",
+       acpi_os_printf ("\t\t_granularity: %08X\n",
                         address16_data->granularity);
 
-       acpi_os_printf ("\t\t_address range min: 0x%08x\n",
+       acpi_os_printf ("\t\t_address range min: %08X\n",
                         address16_data->min_address_range);
 
-       acpi_os_printf ("\t\t_address range max: 0x%08x\n",
+       acpi_os_printf ("\t\t_address range max: %08X\n",
                         address16_data->max_address_range);
 
-       acpi_os_printf ("\t\t_address translation offset: 0x%08x\n",
+       acpi_os_printf ("\t\t_address translation offset: %08X\n",
                         address16_data->address_translation_offset);
 
-       acpi_os_printf ("\t\t_address Length: 0x%08x\n",
+       acpi_os_printf ("\t\t_address Length: %08X\n",
                         address16_data->address_length);
 
        if (0xFF != address16_data->resource_source_index) {
-               acpi_os_printf ("\t\t_resource Source Index: %d\n",
+               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);
@@ -587,7 +588,7 @@ acpi_rs_dump_address16 (
 }
 
 
-/******************************************************************************
+/*******************************************************************************
  *
  * FUNCTION:    Acpi_rs_dump_address32
  *
@@ -703,23 +704,23 @@ acpi_rs_dump_address32 (
                         ADDRESS_FIXED == address32_data->max_address_fixed ?
                         "" : "not ");
 
-       acpi_os_printf ("\t\t_granularity: 0x%08x\n",
+       acpi_os_printf ("\t\t_granularity: %08X\n",
                         address32_data->granularity);
 
-       acpi_os_printf ("\t\t_address range min: 0x%08x\n",
+       acpi_os_printf ("\t\t_address range min: %08X\n",
                         address32_data->min_address_range);
 
-       acpi_os_printf ("\t\t_address range max: 0x%08x\n",
+       acpi_os_printf ("\t\t_address range max: %08X\n",
                         address32_data->max_address_range);
 
-       acpi_os_printf ("\t\t_address translation offset: 0x%08x\n",
+       acpi_os_printf ("\t\t_address translation offset: %08X\n",
                         address32_data->address_translation_offset);
 
-       acpi_os_printf ("\t\t_address Length: 0x%08x\n",
+       acpi_os_printf ("\t\t_address Length: %08X\n",
                         address32_data->address_length);
 
        if(0xFF != address32_data->resource_source_index) {
-               acpi_os_printf ("\t\t_resource Source Index: %d\n",
+               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);
@@ -729,7 +730,7 @@ acpi_rs_dump_address32 (
 }
 
 
-/******************************************************************************
+/*******************************************************************************
  *
  * FUNCTION:    Acpi_rs_dump_extended_irq
  *
@@ -767,17 +768,17 @@ acpi_rs_dump_extended_irq (
                         SHARED == ext_irq_data->shared_exclusive ?
                         "Shared" : "Exclusive");
 
-       acpi_os_printf ("\t\t_interrupts : %d ( ",
+       acpi_os_printf ("\t\t_interrupts : %X ( ",
                         ext_irq_data->number_of_interrupts);
 
        for (index = 0; index < ext_irq_data->number_of_interrupts; index++) {
-               acpi_os_printf ("%d ", ext_irq_data->interrupts[index]);
+               acpi_os_printf ("%X ", ext_irq_data->interrupts[index]);
        }
 
        acpi_os_printf (")\n");
 
        if(0xFF != ext_irq_data->resource_source_index) {
-               acpi_os_printf ("\t\t_resource Source Index: %d",
+               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);
@@ -787,7 +788,7 @@ acpi_rs_dump_extended_irq (
 }
 
 
-/******************************************************************************
+/*******************************************************************************
  *
  * FUNCTION:    Acpi_rs_dump_resource_list
  *
@@ -886,7 +887,7 @@ acpi_rs_dump_resource_list (
        return;
 }
 
-/******************************************************************************
+/*******************************************************************************
  *
  * FUNCTION:    Acpi_rs_dump_irq_list
  *
@@ -912,16 +913,16 @@ acpi_rs_dump_irq_list (
                prt_element = (PCI_ROUTING_TABLE *)buffer;
 
                while (!done) {
-                       acpi_os_printf ("\t_pCI IRQ Routing Table structure %x.\n", count++);
+                       acpi_os_printf ("\t_pCI IRQ Routing Table structure %X.\n", count++);
 
-                       acpi_os_printf ("\t\t_address: 0x%x\n",
+                       acpi_os_printf ("\t\t_address: %X\n",
                                         prt_element->data.address);
 
-                       acpi_os_printf ("\t\t_pin: 0x%x\n", prt_element->data.pin);
+                       acpi_os_printf ("\t\t_pin: %X\n", prt_element->data.pin);
 
                        acpi_os_printf ("\t\t_source: %s\n", prt_element->data.source);
 
-                       acpi_os_printf ("\t\t_source_index: 0x%x\n",
+                       acpi_os_printf ("\t\t_source_index: %X\n",
                                         prt_element->data.source_index);
 
                        buffer += prt_element->length;
index 4620bbf0ae4b6cdb2f10d451e356f393f2ecfd9e..0d6c507c03db7127c4e2903895becb8313e0de29 100644 (file)
@@ -1,4 +1,4 @@
-/******************************************************************************
+/*******************************************************************************
  *
  * Module Name: rsio - Acpi_rs_io_resource
  *                     Acpi_rs_fixed_io_resource
@@ -6,9 +6,9 @@
  *                     Acpi_rs_fixed_io_stream
  *                     Acpi_rs_dma_resource
  *                     Acpi_rs_dma_stream
- *              $Revision: 7 $
+ *              $Revision: 10 $
  *
- *****************************************************************************/
+ ******************************************************************************/
 
 /*
  *  Copyright (C) 2000 R. Byron Moore
 
 
 #include "acpi.h"
+#include "acresrc.h"
 
 #define _COMPONENT          RESOURCE_MANAGER
         MODULE_NAME         ("rsio")
 
 
-/***************************************************************************
+/*******************************************************************************
+ *
  * FUNCTION:    Acpi_rs_io_resource
  *
- * PARAMETERS:
- *              Byte_stream_buffer      - Pointer to the resource input byte
+ * 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
@@ -55,7 +56,7 @@
  *                  structure pointed to by the Output_buffer. Return the
  *                  number of bytes consumed from the byte stream.
  *
- ***************************************************************************/
+ ******************************************************************************/
 
 ACPI_STATUS
 acpi_rs_io_resource (
@@ -133,11 +134,11 @@ acpi_rs_io_resource (
 }
 
 
-/***************************************************************************
+/*******************************************************************************
+ *
  * FUNCTION:    Acpi_rs_fixed_io_resource
  *
- * PARAMETERS:
- *              Byte_stream_buffer      - Pointer to the resource input byte
+ * 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
@@ -153,7 +154,7 @@ acpi_rs_io_resource (
  *                  structure pointed to by the Output_buffer. Return the
  *                  number of bytes consumed from the byte stream.
  *
- ***************************************************************************/
+ ******************************************************************************/
 
 ACPI_STATUS
 acpi_rs_fixed_io_resource (
@@ -207,11 +208,11 @@ acpi_rs_fixed_io_resource (
 }
 
 
-/***************************************************************************
+/*******************************************************************************
+ *
  * FUNCTION:    Acpi_rs_io_stream
  *
- * PARAMETERS:
- *              Linked_list             - Pointer to the resource linked list
+ * 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
@@ -222,7 +223,7 @@ acpi_rs_fixed_io_resource (
  * DESCRIPTION: Take the linked list resource structure and fills in the
  *                  the appropriate bytes in a byte stream
  *
- ***************************************************************************/
+ ******************************************************************************/
 
 ACPI_STATUS
 acpi_rs_io_stream (
@@ -239,7 +240,6 @@ acpi_rs_io_stream (
         * The descriptor field is static
         */
        *buffer = 0x47;
-
        buffer += 1;
 
        /*
@@ -248,7 +248,6 @@ acpi_rs_io_stream (
        temp8 = (u8) (linked_list->data.io.io_decode & 0x01);
 
        *buffer = temp8;
-
        buffer += 1;
 
        /*
@@ -256,8 +255,7 @@ acpi_rs_io_stream (
         */
        temp16 = (u16) linked_list->data.io.min_base_address;
 
-       MOVE_UNALIGNED16_TO_16 (&temp16, buffer);
-
+       MOVE_UNALIGNED16_TO_16 (buffer, &temp16);
        buffer += 2;
 
        /*
@@ -265,8 +263,7 @@ acpi_rs_io_stream (
         */
        temp16 = (u16) linked_list->data.io.max_base_address;
 
-       MOVE_UNALIGNED16_TO_16 (&temp16, buffer);
-
+       MOVE_UNALIGNED16_TO_16 (buffer, &temp16);
        buffer += 2;
 
        /*
@@ -275,7 +272,6 @@ acpi_rs_io_stream (
        temp8 = (u8) linked_list->data.io.alignment;
 
        *buffer = temp8;
-
        buffer += 1;
 
        /*
@@ -284,7 +280,6 @@ acpi_rs_io_stream (
        temp8 = (u8) linked_list->data.io.range_length;
 
        *buffer = temp8;
-
        buffer += 1;
 
        /*
@@ -297,11 +292,11 @@ acpi_rs_io_stream (
 }
 
 
-/***************************************************************************
+/*******************************************************************************
+ *
  * FUNCTION:    Acpi_rs_fixed_io_stream
  *
- * PARAMETERS:
- *              Linked_list             - Pointer to the resource linked list
+ * 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
@@ -312,7 +307,7 @@ acpi_rs_io_stream (
  * DESCRIPTION: Take the linked list resource structure and fills in the
  *                  the appropriate bytes in a byte stream
  *
- ***************************************************************************/
+ ******************************************************************************/
 
 ACPI_STATUS
 acpi_rs_fixed_io_stream (
@@ -337,8 +332,7 @@ acpi_rs_fixed_io_stream (
         */
        temp16 = (u16) linked_list->data.fixed_io.base_address;
 
-       MOVE_UNALIGNED16_TO_16 (&temp16, buffer);
-
+       MOVE_UNALIGNED16_TO_16 (buffer, &temp16);
        buffer += 2;
 
        /*
@@ -347,7 +341,6 @@ acpi_rs_fixed_io_stream (
        temp8 = (u8) linked_list->data.fixed_io.range_length;
 
        *buffer = temp8;
-
        buffer += 1;
 
        /*
@@ -360,11 +353,11 @@ acpi_rs_fixed_io_stream (
 }
 
 
-/***************************************************************************
+/*******************************************************************************
+ *
  * FUNCTION:    Acpi_rs_dma_resource
  *
- * PARAMETERS:
- *              Byte_stream_buffer      - Pointer to the resource input byte
+ * 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
@@ -380,7 +373,7 @@ acpi_rs_fixed_io_stream (
  *                  structure pointed to by the Output_buffer. Return the
  *                  number of bytes consumed from the byte stream.
  *
- ***************************************************************************/
+ ******************************************************************************/
 
 ACPI_STATUS
 acpi_rs_dma_resource (
@@ -402,14 +395,12 @@ acpi_rs_dma_resource (
         * The number of bytes consumed are Constant
         */
        *bytes_consumed = 3;
-
        output_struct->id = dma;
 
        /*
         * Point to the 8-bits of Byte 1
         */
        buffer += 1;
-
        temp8 = *buffer;
 
        /* Decode the IRQ bits */
@@ -431,9 +422,8 @@ acpi_rs_dma_resource (
        /*
         * Point to Byte 2
         */
-        buffer += 1;
-
-        temp8 = *buffer;
+       buffer += 1;
+       temp8 = *buffer;
 
        /*
         * Check for transfer preference (Bits[1:0])
@@ -468,11 +458,11 @@ acpi_rs_dma_resource (
 }
 
 
-/***************************************************************************
+/*******************************************************************************
+ *
  * FUNCTION:    Acpi_rs_dma_stream
  *
- * PARAMETERS:
- *              Linked_list             - Pointer to the resource linked list
+ * 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
@@ -483,7 +473,7 @@ acpi_rs_dma_resource (
  * DESCRIPTION: Take the linked list resource structure and fills in the
  *                  the appropriate bytes in a byte stream
  *
- ***************************************************************************/
+ ******************************************************************************/
 
 ACPI_STATUS
 acpi_rs_dma_stream (
@@ -501,9 +491,7 @@ acpi_rs_dma_stream (
         * The descriptor field is static
         */
        *buffer = 0x2A;
-
        buffer += 1;
-
        temp8 = 0;
 
        /*
@@ -518,20 +506,16 @@ acpi_rs_dma_stream (
        }
 
        *buffer = temp8;
-
        buffer += 1;
 
        /*
         * Set the DMA Info
         */
        temp8 = (u8) ((linked_list->data.dma.type & 0x03) << 5);
-
        temp8 |= ((linked_list->data.dma.bus_master & 0x01) << 2);
-
        temp8 |= (linked_list->data.dma.transfer & 0x03);
 
        *buffer = temp8;
-
        buffer += 1;
 
        /*
index a5749d5c2324e8552f030947ede00fe6110b1d10..28a3a5045c16dbd205e2f9bf25539133c3b3c6e9 100644 (file)
@@ -1,12 +1,12 @@
-/******************************************************************************
+/*******************************************************************************
  *
  * Module Name: rsirq - Acpi_rs_irq_resource,
  *                      Acpi_rs_irq_stream
  *                      Acpi_rs_extended_irq_resource
  *                      Acpi_rs_extended_irq_stream
- *              $Revision: 8 $
+ *              $Revision: 11 $
  *
- *****************************************************************************/
+ ******************************************************************************/
 
 /*
  *  Copyright (C) 2000 R. Byron Moore
 
 
 #include "acpi.h"
+#include "acresrc.h"
 
 #define _COMPONENT          RESOURCE_MANAGER
         MODULE_NAME         ("rsirq")
 
 
-/***************************************************************************
+/*******************************************************************************
+ *
  * FUNCTION:    Acpi_rs_irq_resource
  *
- * PARAMETERS:
- *              Byte_stream_buffer      - Pointer to the resource input byte
+ * 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
@@ -53,7 +54,7 @@
  *                  structure pointed to by the Output_buffer. Return the
  *                  number of bytes consumed from the byte stream.
  *
- ***************************************************************************/
+ ******************************************************************************/
 
 ACPI_STATUS
 acpi_rs_irq_resource (
@@ -77,9 +78,7 @@ acpi_rs_irq_resource (
         *  (Bits:0-1)
         */
        temp8 = *buffer;
-
        *bytes_consumed = (temp8 & 0x03) + 1;
-
        output_struct->id = irq;
 
        /*
@@ -91,6 +90,7 @@ acpi_rs_irq_resource (
        output_struct->data.irq.number_of_interrupts = 0;
 
        /* Decode the IRQ bits */
+
        for (i = 0, index = 0; index < 16; index++) {
                if((temp16 >> index) & 0x01) {
                        output_struct->data.irq.interrupts[i] = index;
@@ -109,7 +109,6 @@ acpi_rs_irq_resource (
         */
        if (4 == *bytes_consumed) {
                buffer += 2;
-
                temp8 = *buffer;
 
                /*
@@ -166,11 +165,11 @@ acpi_rs_irq_resource (
 }
 
 
-/***************************************************************************
+/*******************************************************************************
+ *
  * FUNCTION:    Acpi_rs_irq_stream
  *
- * PARAMETERS:
- *              Linked_list             - Pointer to the resource linked list
+ * 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
@@ -181,7 +180,7 @@ acpi_rs_irq_resource (
  * DESCRIPTION: Take the linked list resource structure and fills in the
  *                  the appropriate bytes in a byte stream
  *
- ***************************************************************************/
+ ******************************************************************************/
 
 ACPI_STATUS
 acpi_rs_irq_stream (
@@ -213,7 +212,6 @@ acpi_rs_irq_stream (
        }
 
        buffer += 1;
-
        temp16 = 0;
 
        /*
@@ -227,8 +225,7 @@ acpi_rs_irq_stream (
                temp16 |= 0x1 << temp8;
        }
 
-       MOVE_UNALIGNED16_TO_16 (&temp16, buffer);
-
+       MOVE_UNALIGNED16_TO_16 (buffer, &temp16);
        buffer += 2;
 
        /*
@@ -236,7 +233,6 @@ acpi_rs_irq_stream (
         */
        if (IRQinfo_byte_needed) {
                temp8 = 0;
-
                temp8 = (u8) ((linked_list->data.irq.shared_exclusive &
                                 0x01) << 4);
 
@@ -251,7 +247,6 @@ acpi_rs_irq_stream (
                }
 
                *buffer = temp8;
-
                buffer += 1;
        }
 
@@ -265,11 +260,11 @@ acpi_rs_irq_stream (
 }
 
 
-/***************************************************************************
+/*******************************************************************************
+ *
  * FUNCTION:    Acpi_rs_extended_irq_resource
  *
- * PARAMETERS:
- *              Byte_stream_buffer      - Pointer to the resource input byte
+ * 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
@@ -285,7 +280,7 @@ acpi_rs_irq_stream (
  *                  structure pointed to by the Output_buffer. Return the
  *                  number of bytes consumed from the byte stream.
  *
- ***************************************************************************/
+ ******************************************************************************/
 
 ACPI_STATUS
 acpi_rs_extended_irq_resource (
@@ -450,11 +445,11 @@ acpi_rs_extended_irq_resource (
 }
 
 
-/***************************************************************************
+/*******************************************************************************
+ *
  * FUNCTION:    Acpi_rs_extended_irq_stream
  *
- * PARAMETERS:
- *              Linked_list             - Pointer to the resource linked list
+ * 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
@@ -463,9 +458,9 @@ acpi_rs_extended_irq_resource (
  * RETURN:      Status  AE_OK if okay, else a valid ACPI_STATUS code
  *
  * 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_extended_irq_stream (
@@ -518,7 +513,6 @@ acpi_rs_extended_irq_stream (
        temp8 = (u8) linked_list->data.extended_irq.number_of_interrupts;
 
        *buffer = temp8;
-
        buffer += 1;
 
        for (index = 0;
index 095325c43b96554707533f77f0c737ff93fd64e1..8e39ddded00a66eafac2f89459aa3bfaf613d2d4 100644 (file)
@@ -1,10 +1,10 @@
-/******************************************************************************
+/*******************************************************************************
  *
  * Module Name: rslist - Acpi_rs_byte_stream_to_list
  *                       Acpi_list_to_byte_stream
- *              $Revision: 6 $
+ *              $Revision: 8 $
  *
- *****************************************************************************/
+ ******************************************************************************/
 
 /*
  *  Copyright (C) 2000 R. Byron Moore
         MODULE_NAME         ("rslist")
 
 
-/***************************************************************************
+/*******************************************************************************
+ *
  * FUNCTION:    Acpi_rs_byte_stream_to_list
  *
- * PARAMETERS:
- *              Byte_stream_buffer      - Pointer to the resource byte stream
+ * 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
@@ -46,7 +46,7 @@
  * DESCRIPTION: Takes the resource byte stream and parses it, creating a
  *              linked list of resources in the caller's output buffer
  *
- ***************************************************************************/
+ ******************************************************************************/
 
 ACPI_STATUS
 acpi_rs_byte_stream_to_list (
@@ -157,7 +157,7 @@ acpi_rs_byte_stream_to_list (
 
                                break;
 
-/* 64-bit not currently supported */
+/* TBD: [Future] 64-bit not currently supported */
 /*
                        case 0x8A:
                                break;
@@ -309,15 +309,14 @@ acpi_rs_byte_stream_to_list (
        }
 
        return (AE_OK);
-
-} /* Acpi_rs_byte_stream_to_list */
+}
 
 
-/***************************************************************************
+/*******************************************************************************
+ *
  * FUNCTION:    Acpi_rs_list_to_byte_stream
  *
- * PARAMETERS:
- *              Linked_list             - Pointer to the resource linked list
+ * 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()
@@ -332,7 +331,7 @@ acpi_rs_byte_stream_to_list (
  * DESCRIPTION: Takes the resource linked list and parses it, creating a
  *              byte stream of resources in the caller's output buffer
  *
- ***************************************************************************/
+ ******************************************************************************/
 
 ACPI_STATUS
 acpi_rs_list_to_byte_stream (
@@ -503,6 +502,5 @@ acpi_rs_list_to_byte_stream (
        }
 
        return  (AE_OK);
-
-} /* Acpi_rs_list_to_byte_stream */
+}
 
index 7d1c7b8a39878fa959dae230a7cb5a98b3fa4121..8aa4914f46ca2e59e1ac9a55c408b8e76359186e 100644 (file)
@@ -1,4 +1,4 @@
-/******************************************************************************
+/*******************************************************************************
  *
  * Module Name: rsmem24 - Acpi_rs_memory24_resource
  *                        Acpi_rs_memory24_stream
@@ -6,9 +6,9 @@
  *                        Acpi_rs_fixed_memory32_resource
  *                        Acpi_rs_memory32_range_stream
  *                        Acpi_rs_fixed_memory32_stream
- *              $Revision: 7 $
+ *              $Revision: 10 $
  *
- *****************************************************************************/
+ ******************************************************************************/
 
 /*
  *  Copyright (C) 2000 R. Byron Moore
 
 
 #include "acpi.h"
+#include "acresrc.h"
 
 #define _COMPONENT          RESOURCE_MANAGER
         MODULE_NAME         ("rsmemory")
 
 
-/***************************************************************************
+/*******************************************************************************
+ *
  * FUNCTION:    Acpi_rs_memory24_resource
  *
- * PARAMETERS:
- *              Byte_stream_buffer      - Pointer to the resource input byte
+ * 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
@@ -55,7 +56,7 @@
  *                  structure pointed to by the Output_buffer. Return the
  *                  number of bytes consumed from the byte stream.
  *
- ***************************************************************************/
+ ******************************************************************************/
 
 ACPI_STATUS
 acpi_rs_memory24_resource (
@@ -78,54 +79,42 @@ acpi_rs_memory24_resource (
        buffer += 1;
 
        MOVE_UNALIGNED16_TO_16 (&temp16, buffer);
-
        buffer += 2;
-
        *bytes_consumed = temp16 + 3;
-
        output_struct->id = memory24;
 
        /*
         * Check Byte 3 the Read/Write bit
         */
        temp8 = *buffer;
-
        buffer += 1;
-
        output_struct->data.memory24.read_write_attribute = temp8 & 0x01;
 
        /*
         * Get Min_base_address (Bytes 4-5)
         */
        MOVE_UNALIGNED16_TO_16 (&temp16, buffer);
-
        buffer += 2;
-
        output_struct->data.memory24.min_base_address = temp16;
 
        /*
         * Get Max_base_address (Bytes 6-7)
         */
        MOVE_UNALIGNED16_TO_16 (&temp16, buffer);
-
        buffer += 2;
-
        output_struct->data.memory24.max_base_address = temp16;
 
        /*
         * Get Alignment (Bytes 8-9)
         */
        MOVE_UNALIGNED16_TO_16 (&temp16, buffer);
-
        buffer += 2;
-
        output_struct->data.memory24.alignment = temp16;
 
        /*
         * Get Range_length (Bytes 10-11)
         */
        MOVE_UNALIGNED16_TO_16 (&temp16, buffer);
-
        output_struct->data.memory24.range_length = temp16;
 
        /*
@@ -142,11 +131,11 @@ acpi_rs_memory24_resource (
 }
 
 
-/***************************************************************************
+/*******************************************************************************
+ *
  * FUNCTION:    Acpi_rs_memory24_stream
  *
- * PARAMETERS:
- *              Linked_list             - Pointer to the resource linked list
+ * 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
@@ -157,7 +146,7 @@ acpi_rs_memory24_resource (
  * DESCRIPTION: Take the linked list resource structure and fills in the
  *                  the appropriate bytes in a byte stream
  *
- ***************************************************************************/
+ ******************************************************************************/
 
 ACPI_STATUS
 acpi_rs_memory24_stream (
@@ -174,16 +163,13 @@ acpi_rs_memory24_stream (
         * The descriptor field is static
         */
        *buffer = 0x81;
-
        buffer += 1;
 
        /*
         * The length field is static
         */
        temp16 = 0x09;
-
        MOVE_UNALIGNED16_TO_16 (buffer, &temp16);
-
        buffer += 2;
 
        /*
@@ -227,11 +213,11 @@ acpi_rs_memory24_stream (
 }
 
 
-/***************************************************************************
+/*******************************************************************************
+ *
  * FUNCTION:    Acpi_rs_memory32_range_resource
  *
- * PARAMETERS:
- *              Byte_stream_buffer      - Pointer to the resource input byte
+ * 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
@@ -247,7 +233,7 @@ acpi_rs_memory24_stream (
  *                  structure pointed to by the Output_buffer. Return the
  *                  number of bytes consumed from the byte stream.
  *
- ***************************************************************************/
+ ******************************************************************************/
 
 ACPI_STATUS
 acpi_rs_memory32_range_resource (
@@ -332,11 +318,11 @@ acpi_rs_memory32_range_resource (
 }
 
 
-/***************************************************************************
+/*******************************************************************************
+ *
  * FUNCTION:    Acpi_rs_fixed_memory32_resource
  *
- * PARAMETERS:
- *              Byte_stream_buffer      - Pointer to the resource input byte
+ * 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
@@ -352,7 +338,7 @@ acpi_rs_memory32_range_resource (
  *                  structure pointed to by the Output_buffer. Return the
  *                  number of bytes consumed from the byte stream.
  *
- ***************************************************************************/
+ ******************************************************************************/
 
 ACPI_STATUS
 acpi_rs_fixed_memory32_resource (
@@ -414,11 +400,11 @@ acpi_rs_fixed_memory32_resource (
 }
 
 
-/***************************************************************************
+/*******************************************************************************
+ *
  * FUNCTION:    Acpi_rs_memory32_range_stream
  *
- * PARAMETERS:
- *              Linked_list             - Pointer to the resource linked list
+ * 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
@@ -429,7 +415,7 @@ acpi_rs_fixed_memory32_resource (
  * DESCRIPTION: Take the linked list resource structure and fills in the
  *                  the appropriate bytes in a byte stream
  *
- ***************************************************************************/
+ ******************************************************************************/
 
 ACPI_STATUS
 acpi_rs_memory32_range_stream (
@@ -497,11 +483,11 @@ acpi_rs_memory32_range_stream (
 }
 
 
-/***************************************************************************
+/*******************************************************************************
+ *
  * FUNCTION:    Acpi_rs_fixed_memory32_stream
  *
- * PARAMETERS:
- *              Linked_list             - Pointer to the resource linked list
+ * 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
@@ -512,7 +498,7 @@ acpi_rs_memory32_range_stream (
  * DESCRIPTION: Take the linked list resource structure and fills in the
  *                  the appropriate bytes in a byte stream
  *
- ***************************************************************************/
+ ******************************************************************************/
 
 ACPI_STATUS
 acpi_rs_fixed_memory32_stream (
index c86700abb0c5b584016c65483c12c2e234c1466a..01bbb377e32cb4660221af94cea97967c27bbcca 100644 (file)
@@ -1,4 +1,4 @@
-/******************************************************************************
+/*******************************************************************************
  *
  * Module Name: rsmisc - Acpi_rs_end_tag_resource
  *                       Acpi_rs_end_tag_stream
@@ -8,9 +8,9 @@
  *                       Acpi_rs_end_dependent_functions_resource
  *                       Acpi_rs_start_dependent_functions_stream
  *                       Acpi_rs_end_dependent_functions_stream
- *              $Revision: 7 $
+ *              $Revision: 10 $
  *
- *****************************************************************************/
+ ******************************************************************************/
 
 /*
  *  Copyright (C) 2000 R. Byron Moore
 
 
 #include "acpi.h"
+#include "acresrc.h"
 
 #define _COMPONENT          RESOURCE_MANAGER
         MODULE_NAME         ("rsmisc")
 
 
-/***************************************************************************
+/*******************************************************************************
+ *
  * FUNCTION:    Acpi_rs_end_tag_resource
  *
- * PARAMETERS:
- *              Byte_stream_buffer      - Pointer to the resource input byte
+ * 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
@@ -57,7 +58,7 @@
  *                  structure pointed to by the Output_buffer. Return the
  *                  number of bytes consumed from the byte stream.
  *
- ***************************************************************************/
+ ******************************************************************************/
 
 ACPI_STATUS
 acpi_rs_end_tag_resource (
@@ -94,11 +95,11 @@ acpi_rs_end_tag_resource (
 }
 
 
-/***************************************************************************
+/*******************************************************************************
+ *
  * FUNCTION:    Acpi_rs_end_tag_stream
  *
- * PARAMETERS:
- *              Linked_list             - Pointer to the resource linked list
+ * 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
@@ -109,7 +110,7 @@ acpi_rs_end_tag_resource (
  * DESCRIPTION: Take the linked list resource structure and fills in the
  *                  the appropriate bytes in a byte stream
  *
- ***************************************************************************/
+ ******************************************************************************/
 
 ACPI_STATUS
 acpi_rs_end_tag_stream (
@@ -125,7 +126,6 @@ acpi_rs_end_tag_stream (
         * The descriptor field is static
         */
        *buffer = 0x79;
-
        buffer += 1;
 
        /*
@@ -135,7 +135,6 @@ acpi_rs_end_tag_stream (
        temp8 = 0;
 
        *buffer = temp8;
-
        buffer += 1;
 
        /*
@@ -147,11 +146,12 @@ acpi_rs_end_tag_stream (
        return (AE_OK);
 }
 
-/***************************************************************************
+
+/*******************************************************************************
+ *
  * FUNCTION:    Acpi_rs_vendor_resource
  *
- * PARAMETERS:
- *              Byte_stream_buffer      - Pointer to the resource input byte
+ * 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
@@ -167,7 +167,7 @@ acpi_rs_end_tag_stream (
  *                  structure pointed to by the Output_buffer. Return the
  *                  number of bytes consumed from the byte stream.
  *
- ***************************************************************************/
+ ******************************************************************************/
 
 ACPI_STATUS
 acpi_rs_vendor_resource (
@@ -230,7 +230,6 @@ acpi_rs_vendor_resource (
        }
 
        output_struct->id = vendor_specific;
-
        output_struct->data.vendor_specific.length = temp16;
 
        for (index = 0; index < temp16; index++) {
@@ -259,11 +258,11 @@ acpi_rs_vendor_resource (
 }
 
 
-/***************************************************************************
+/*******************************************************************************
+ *
  * FUNCTION:    Acpi_rs_vendor_stream
  *
- * PARAMETERS:
- *              Linked_list             - Pointer to the resource linked list
+ * 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
@@ -274,7 +273,7 @@ acpi_rs_vendor_resource (
  * DESCRIPTION: Take the linked list resource structure and fills in the
  *                  the appropriate bytes in a byte stream
  *
- ***************************************************************************/
+ ******************************************************************************/
 
 ACPI_STATUS
 acpi_rs_vendor_stream (
@@ -300,13 +299,11 @@ acpi_rs_vendor_stream (
                 * Set the descriptor field and length bytes
                 */
                *buffer = 0x84;
-
                buffer += 1;
 
                temp16 = (u16) linked_list->data.vendor_specific.length;
 
-               MOVE_UNALIGNED16_TO_16 (&temp16, buffer);
-
+               MOVE_UNALIGNED16_TO_16 (buffer, &temp16);
                buffer += 2;
        }
 
@@ -319,11 +316,9 @@ acpi_rs_vendor_stream (
                 * Set the descriptor field
                 */
                temp8 = 0x70;
-
                temp8 |= linked_list->data.vendor_specific.length;
 
                *buffer = temp8;
-
                buffer += 1;
        }
 
@@ -332,6 +327,7 @@ acpi_rs_vendor_stream (
         */
        for (index = 0; index < linked_list->data.vendor_specific.length; index++) {
                temp8 = linked_list->data.vendor_specific.reserved[index];
+
                *buffer = temp8;
                buffer += 1;
        }
@@ -345,11 +341,12 @@ acpi_rs_vendor_stream (
        return (AE_OK);
 }
 
-/***************************************************************************
+
+/*******************************************************************************
+ *
  * FUNCTION:    Acpi_rs_start_dependent_functions_resource
  *
- * PARAMETERS:
- *              Byte_stream_buffer      - Pointer to the resource input byte
+ * 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
@@ -365,7 +362,7 @@ acpi_rs_vendor_stream (
  *                  structure pointed to by the Output_buffer. Return the
  *                  number of bytes consumed from the byte stream.
  *
- ***************************************************************************/
+ ******************************************************************************/
 
 ACPI_STATUS
 acpi_rs_start_dependent_functions_resource (
@@ -441,11 +438,11 @@ acpi_rs_start_dependent_functions_resource (
 }
 
 
-/***************************************************************************
+/*******************************************************************************
+ *
  * FUNCTION:    Acpi_rs_end_dependent_functions_resource
  *
- * PARAMETERS:
- *              Byte_stream_buffer      - Pointer to the resource input byte
+ * 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
@@ -461,7 +458,7 @@ acpi_rs_start_dependent_functions_resource (
  *                  structure pointed to by the Output_buffer. Return the
  *                  number of bytes consumed from the byte stream.
  *
- ***************************************************************************/
+ ******************************************************************************/
 
 ACPI_STATUS
 acpi_rs_end_dependent_functions_resource (
@@ -498,11 +495,11 @@ acpi_rs_end_dependent_functions_resource (
 }
 
 
-/***************************************************************************
+/*******************************************************************************
+ *
  * FUNCTION:    Acpi_rs_start_dependent_functions_stream
  *
- * PARAMETERS:
- *              Linked_list             - Pointer to the resource linked list
+ * 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
@@ -513,7 +510,8 @@ acpi_rs_end_dependent_functions_resource (
  * DESCRIPTION: Take the linked list resource structure and fills in the
  *                  the appropriate bytes in a byte stream
  *
- ***************************************************************************/
+ ******************************************************************************/
+
 ACPI_STATUS
 acpi_rs_start_dependent_functions_stream (
        RESOURCE                *linked_list,
@@ -537,18 +535,15 @@ acpi_rs_start_dependent_functions_stream (
        }
        else {
                *buffer = 0x31;
-
                buffer += 1;
 
                /*
                 * 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);
@@ -568,11 +563,11 @@ acpi_rs_start_dependent_functions_stream (
 }
 
 
-/***************************************************************************
+/*******************************************************************************
+ *
  * FUNCTION:    Acpi_rs_end_dependent_functions_stream
  *
- * PARAMETERS:
- *              Linked_list             - Pointer to the resource linked list
+ * 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
@@ -583,7 +578,7 @@ acpi_rs_start_dependent_functions_stream (
  * DESCRIPTION: Take the linked list resource structure and fills in the
  *                  the appropriate bytes in a byte stream
  *
- ***************************************************************************/
+ ******************************************************************************/
 
 ACPI_STATUS
 acpi_rs_end_dependent_functions_stream (
@@ -599,7 +594,6 @@ acpi_rs_end_dependent_functions_stream (
         * The descriptor field is static
         */
        *buffer = 0x38;
-
        buffer += 1;
 
        /*
index 659b2fe408877a8a1665a0b88702df11cd03be04..0a3f766680e965f7877dc67820442b3cc058d71c 100644 (file)
@@ -1,9 +1,9 @@
-/******************************************************************************
+/*******************************************************************************
  *
  * Module Name: rsutils - Utilities for the resource manager
- *              $Revision: 10 $
+ *              $Revision: 12 $
  *
- *****************************************************************************/
+ ******************************************************************************/
 
 /*
  *  Copyright (C) 2000 R. Byron Moore
@@ -33,7 +33,7 @@
         MODULE_NAME         ("rsutils")
 
 
-/******************************************************************************
+/*******************************************************************************
  *
  * FUNCTION:    Acpi_rs_get_prt_method_data
  *
@@ -117,7 +117,7 @@ cleanup:
 }
 
 
-/******************************************************************************
+/*******************************************************************************
  *
  * FUNCTION:    Acpi_rs_get_crs_method_data
  *
@@ -200,7 +200,7 @@ cleanup:
 }
 
 
-/******************************************************************************
+/*******************************************************************************
  *
  * FUNCTION:    Acpi_rs_get_prs_method_data
  *
@@ -281,7 +281,7 @@ cleanup:
 }
 
 
-/******************************************************************************
+/*******************************************************************************
  *
  * FUNCTION:    Acpi_rs_set_srs_method_data
  *
@@ -310,6 +310,7 @@ acpi_rs_set_srs_method_data (
        u8                      *byte_stream = NULL;
        u32                     buffer_size_needed = 0;
 
+
        /* already validated params, so we won't repeat here */
 
        /*
@@ -325,7 +326,6 @@ acpi_rs_set_srs_method_data (
        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
@@ -338,7 +338,6 @@ acpi_rs_set_srs_method_data (
         * Allocate the buffer needed
         */
        byte_stream = acpi_cm_callocate(buffer_size_needed);
-
        if (NULL == byte_stream) {
                return (AE_NO_MEMORY);
        }
@@ -349,7 +348,6 @@ acpi_rs_set_srs_method_data (
        status = acpi_rs_create_byte_stream (in_buffer->pointer,
                           byte_stream,
                           &buffer_size_needed);
-
        if (ACPI_FAILURE (status)) {
                goto cleanup;
        }
index f09643399184307b894185d95ae84f1f977047c2..8691f8200b33ebfa536cfcf3f2c0111035b6aedc 100644 (file)
@@ -1,9 +1,9 @@
-/******************************************************************************
+/*******************************************************************************
  *
  * Module Name: rsxface - Public interfaces to the ACPI subsystem
- *              $Revision: 7 $
+ *              $Revision: 8 $
  *
- *****************************************************************************/
+ ******************************************************************************/
 
 /*
  *  Copyright (C) 2000 R. Byron Moore
@@ -33,7 +33,7 @@
         MODULE_NAME         ("rsxface")
 
 
-/******************************************************************************
+/*******************************************************************************
  *
  * FUNCTION:    Acpi_get_irq_routing_table
  *
@@ -83,7 +83,7 @@ acpi_get_irq_routing_table (
 }
 
 
-/******************************************************************************
+/*******************************************************************************
  *
  * FUNCTION:    Acpi_get_current_resources
  *
@@ -134,7 +134,7 @@ acpi_get_current_resources (
 }
 
 
-/******************************************************************************
+/*******************************************************************************
  *
  * FUNCTION:    Acpi_get_possible_resources
  *
@@ -142,7 +142,7 @@ acpi_get_current_resources (
  *                                device we are querying
  *              Ret_buffer      - a pointer to a buffer to receive the
  *                                resources for the device
 *
+ *
  * RETURN:      Status          - the status of the call
  *
  * DESCRIPTION: This function is called to get a list of the possible resources
@@ -182,7 +182,7 @@ acpi_get_possible_resources (
 }
 
 
-/******************************************************************************
+/*******************************************************************************
  *
  * FUNCTION:    Acpi_set_current_resources
  *
index d4206631e6513d1c0efaaae0f7c8f8ca692a912f..a920e399e451608e0c7d38ecca593d8ed810a7ff 100644 (file)
 #define _COMPONENT     OS_DEPENDENT
        MODULE_NAME     ("sys")
 
-#define ACPI_SLP_TYP(typa, typb) (((int)(typa) << 8) | (int)(typb))
-#define ACPI_SLP_TYPA(value) \
-        ((((value) >> 8) << ACPI_SLP_TYP_SHIFT) & ACPI_SLP_TYP_MASK)
-#define ACPI_SLP_TYPB(value) \
-        ((((value) & 0xff) << ACPI_SLP_TYP_SHIFT) & ACPI_SLP_TYP_MASK)
+#define ACPI_SLP_TYP(typa, typb)       (((int)(typa) << 8) | (int)(typb))
+#define ACPI_SLP_TYPA(value)           ((value) >> 8)
+#define ACPI_SLP_TYPB(value)           ((value) & 0xff)
 
 struct acpi_enter_sx_ctx
 {
        wait_queue_head_t wait;
-       int state;
+       unsigned int      state;
 };
 
 volatile acpi_sstate_t acpi_sleep_state = ACPI_S0;
@@ -49,10 +47,8 @@ static void
 acpi_enter_sx_async(void *context)
 {
        struct acpi_enter_sx_ctx *ctx = (struct acpi_enter_sx_ctx*) context;
-       struct acpi_facp *facp = &acpi_facp;
        ACPI_OBJECT_LIST arg_list;
        ACPI_OBJECT arg;
-       u16 value;
 
        /*
          * _PSW methods could be run here to enable wake-on keyboard, LAN, etc.
@@ -69,34 +65,26 @@ acpi_enter_sx_async(void *context)
 
        acpi_evaluate_object(NULL, "\\_PTS", &arg_list, NULL);
        
-       // clear wake status
-       acpi_write_pm1_status(facp, ACPI_WAK);
-       
+       // clear wake status by writing a 1
+       acpi_hw_register_bit_access(ACPI_WRITE, ACPI_MTX_LOCK, WAK_STS, 1);
+               
        acpi_sleep_state = ctx->state;
 
        // set ACPI_SLP_TYPA/b and ACPI_SLP_EN
-       __cli();
-       if (facp->pm1a_cnt) {
-               value = inw(facp->pm1a_cnt) & ~ACPI_SLP_TYP_MASK;
-               value |= (ACPI_SLP_TYPA(acpi_slptyp[ctx->state])
-                         | ACPI_SLP_EN);
-               outw(value, facp->pm1a_cnt);
-       }
-       if (facp->pm1b_cnt) {
-               value = inw(facp->pm1b_cnt) & ~ACPI_SLP_TYP_MASK;
-               value |= (ACPI_SLP_TYPB(acpi_slptyp[ctx->state])
-                         | ACPI_SLP_EN);
-               outw(value, facp->pm1b_cnt);
-       }
-       __sti();
+       acpi_hw_register_bit_access(ACPI_WRITE, ACPI_MTX_LOCK, SLP_TYPE_A,
+               ACPI_SLP_TYPA(acpi_slptyp[ctx->state]));
+       acpi_hw_register_bit_access(ACPI_WRITE, ACPI_MTX_LOCK, SLP_TYPE_B,
+               ACPI_SLP_TYPB(acpi_slptyp[ctx->state]));
+       acpi_hw_register_bit_access(ACPI_WRITE, ACPI_MTX_LOCK, SLP_EN, 1);
        
        if (ctx->state != ACPI_S1) {
+               /* we should have just shut off - what are we doing here? */
                printk(KERN_ERR "ACPI: S%d failed\n", ctx->state);
                goto out;
        }
 
        // wait until S1 is entered
-       while (!(acpi_read_pm1_status(facp) & ACPI_WAK))
+       while (!(acpi_hw_register_bit_access(ACPI_READ, ACPI_MTX_LOCK, WAK_STS)))
                safe_halt();
 
        // run the _WAK method
@@ -125,7 +113,7 @@ acpi_power_off(void)
 {
        struct acpi_enter_sx_ctx ctx;
 
-       if (acpi_facp.hdr.signature != ACPI_FACP_SIG
+       if ((STRNCMP(acpi_fadt.header.signature, ACPI_FADT_SIGNATURE, ACPI_SIG_LEN) != 0)
            || acpi_slptyp[ACPI_S5] == ACPI_INVALID)
                return;
        
@@ -142,7 +130,7 @@ acpi_enter_sx(acpi_sstate_t state)
 {
        struct acpi_enter_sx_ctx ctx;
 
-       if (acpi_facp.hdr.signature != ACPI_FACP_SIG
+       if ((STRNCMP(acpi_fadt.header.signature, ACPI_FADT_SIGNATURE, ACPI_SIG_LEN) != 0)
            || acpi_slptyp[state] == ACPI_INVALID)
                return -EINVAL;
        
@@ -162,23 +150,28 @@ acpi_enter_sx(acpi_sstate_t state)
 int
 acpi_sys_init(void)
 {
-       u8 sx, typa, typb;
+       u8 sx;
+       u8 type_a;
+       u8 type_b;
+
+       printk(KERN_INFO "ACPI: System firmware supports:");
 
        for (sx = ACPI_S0; sx <= ACPI_S5; sx++) {
                int ca_sx = (sx <= ACPI_S4) ? sx : (sx + 1);
                if (ACPI_SUCCESS(
                           acpi_hw_obtain_sleep_type_register_data(ca_sx,
-                                                                  &typa,
-                                                                  &typb)))
-                       acpi_slptyp[sx] = ACPI_SLP_TYP(typa, typb);
-               else
+                                                                  &type_a,
+                                                                  &type_b))) {
+
+                       acpi_slptyp[sx] = ACPI_SLP_TYP(type_a, type_b);
+                       printk(" S%d", sx);
+               }
+               else {
                        acpi_slptyp[sx] = ACPI_INVALID;
+               }
        }
-       if (acpi_slptyp[ACPI_S1] != ACPI_INVALID)
-               printk(KERN_INFO "ACPI: S1 supported\n");
-       if (acpi_slptyp[ACPI_S5] != ACPI_INVALID)
-               printk(KERN_INFO "ACPI: S5 supported\n");
-
+       printk("\n");
+       
        pm_power_off = acpi_power_off;
 
        return 0;
index 5123b94ff49bf268431cf7681532efc131d34157..8379b4204d440a6a0441dc7404e6d65b0730c493 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  tables.c - ACPI tables, chipset, and errata handling
+ *  table.c - ACPI tables, chipset, and errata handling
  *
  *  Copyright (C) 2000 Andrew Henroid
  *
 #include "driver.h"
 
 #define _COMPONENT     OS_DEPENDENT
-       MODULE_NAME     ("tables")
+       MODULE_NAME     ("table")
 
-struct acpi_facp acpi_facp;
-
-#define ACPI_DUMMY_CHECKSUM 9
-#define ACPI_DUMMY_PBLK 51
-
-static u8 acpi_dummy_dsdt[] =
-{
-       0x44, 0x53, 0x44, 0x54,                         // "DSDT"
-       0x38, 0x00, 0x00, 0x00,                         // length
-       0x01,                                           // revision
-       0x00,                                           // checksum
-       0x4c, 0x49, 0x4e, 0x55, 0x58, 0x00,             // "LINUX"
-       0x44, 0x55, 0x4d, 0x4d, 0x59, 0x00, 0x00, 0x00, // "DUMMY"
-       0x01, 0x00, 0x00, 0x00,                         // OEM rev
-       0x4c, 0x4e, 0x55, 0x58,                         // "LNUX"
-       0x01, 0x00, 0x00, 0x00,                         // creator rev
-       0x10,                                           // Scope
-       0x13,                                           //   PkgLength
-       0x5c, 0x5f, 0x50, 0x52, 0x5f,                   //   \_PR_
-       0x5b, 0x83,                                     //   Processor
-       0x0b,                                           //     PkgLength
-       0x43, 0x50, 0x55, 0x30,                         //     CPU0
-       0x00,                                           //     ID
-       0x00, 0x00, 0x00, 0x00,                         //     PBLK
-       0x06                                            //     PBLK size
-};
-
-/*
- * Calculate and set ACPI table checksum
- */
-static void
-acpi_set_checksum(u8 *table, int size)
-{
-       int i, sum = 0;
-       for (i = 0; i < size; i++)
-               sum += (int) table[i];
-       sum = (0x100 - ((sum - table[ACPI_DUMMY_CHECKSUM]) & 0xff));
-       table[ACPI_DUMMY_CHECKSUM] = sum;
-}
-
-/*
- * Init PIIX4 device, create a fake FACP
- */
-static int
-acpi_init_piix4(struct pci_dev *dev)
-{
-       u32 base, pblk;
-       u16 cmd;
-       u8 pmregmisc;
-
-       pci_read_config_word(dev, PCI_COMMAND, &cmd);
-       if (!(cmd & PCI_COMMAND_IO))
-               return -ENODEV;
-       
-       pci_read_config_byte(dev, ACPI_PIIX4_PMREGMISC, &pmregmisc);
-       if (!(pmregmisc & ACPI_PIIX4_PMIOSE))
-               return -ENODEV;
-       
-       base = pci_resource_start (dev, PCI_BRIDGE_RESOURCES);
-       if (!base)
-               return -ENODEV;
-
-       printk(KERN_INFO "ACPI: found \"%s\" at 0x%04x\n", dev->name, base);
-
-       memset(&acpi_facp, 0, sizeof(acpi_facp));
-       acpi_facp.hdr.signature = ACPI_FACP_SIG;
-       acpi_facp.hdr.length = sizeof(acpi_facp);
-       acpi_facp.int_model = ACPI_PIIX4_INT_MODEL;
-       acpi_facp.sci_int = ACPI_PIIX4_SCI_INT;
-       acpi_facp.smi_cmd = ACPI_PIIX4_SMI_CMD;
-       acpi_facp.acpi_enable = ACPI_PIIX4_ACPI_ENABLE;
-       acpi_facp.acpi_disable = ACPI_PIIX4_ACPI_DISABLE;
-       acpi_facp.s4bios_req = ACPI_PIIX4_S4BIOS_REQ;
-       acpi_facp.pm1a_evt = base + ACPI_PIIX4_PM1_EVT;
-       acpi_facp.pm1a_cnt = base + ACPI_PIIX4_PM1_CNT;
-       acpi_facp.pm2_cnt = ACPI_PIIX4_PM2_CNT;
-       acpi_facp.pm_tmr = base + ACPI_PIIX4_PM_TMR;
-       acpi_facp.gpe0 = base + ACPI_PIIX4_GPE0;
-       acpi_facp.pm1_evt_len = ACPI_PIIX4_PM1_EVT_LEN;
-       acpi_facp.pm1_cnt_len = ACPI_PIIX4_PM1_CNT_LEN;
-       acpi_facp.pm2_cnt_len = ACPI_PIIX4_PM2_CNT_LEN;
-       acpi_facp.pm_tm_len = ACPI_PIIX4_PM_TM_LEN;
-       acpi_facp.gpe0_len = ACPI_PIIX4_GPE0_LEN;
-       acpi_facp.p_lvl2_lat = (__u16) ACPI_INFINITE_LAT;
-       acpi_facp.p_lvl3_lat = (__u16) ACPI_INFINITE_LAT;
-
-       acpi_set_checksum((u8*) &acpi_facp, sizeof(acpi_facp));
-       acpi_load_table((ACPI_TABLE_HEADER*) &acpi_facp);
-
-       pblk = base + ACPI_PIIX4_P_BLK;
-       memcpy(acpi_dummy_dsdt + ACPI_DUMMY_PBLK, &pblk, sizeof(pblk));
-       acpi_set_checksum(acpi_dummy_dsdt, sizeof(acpi_dummy_dsdt));
-       acpi_load_table((ACPI_TABLE_HEADER*) acpi_dummy_dsdt);
-
-       return 0;
-}
+FADT_DESCRIPTOR acpi_fadt;
 
 /*
- * Init VIA ACPI device and create a fake FACP
+ * Fetch the fadt information
  */
 static int
-acpi_init_via(struct pci_dev *dev)
-{
-       u32 base, pblk;
-       u8 tmp, irq;
-
-       pci_read_config_byte(dev, 0x41, &tmp);
-       if (!(tmp & 0x80))
-               return -ENODEV;
-
-       base = pci_resource_start(dev, PCI_BRIDGE_RESOURCES);
-       if (!base) {
-               base = pci_resource_start(dev, PCI_BASE_ADDRESS_4);
-               if (!base)
-                       return -ENODEV;
-       }
-
-       pci_read_config_byte(dev, 0x42, &irq);
-
-       printk(KERN_INFO "ACPI: found \"%s\" at 0x%04x\n", dev->name, base);
-
-       memset(&acpi_facp, 0, sizeof(acpi_facp));
-       acpi_facp.hdr.signature = ACPI_FACP_SIG;
-       acpi_facp.hdr.length = sizeof(acpi_facp);
-       acpi_facp.int_model = ACPI_VIA_INT_MODEL;
-       acpi_facp.sci_int = irq;
-       acpi_facp.smi_cmd = base + ACPI_VIA_SMI_CMD;
-       acpi_facp.acpi_enable = ACPI_VIA_ACPI_ENABLE;
-       acpi_facp.acpi_disable = ACPI_VIA_ACPI_DISABLE;
-       acpi_facp.pm1a_evt = base + ACPI_VIA_PM1_EVT;
-       acpi_facp.pm1a_cnt = base + ACPI_VIA_PM1_CNT;
-       acpi_facp.pm_tmr = base + ACPI_VIA_PM_TMR;
-       acpi_facp.gpe0 = base + ACPI_VIA_GPE0;
-
-       acpi_facp.pm1_evt_len = ACPI_VIA_PM1_EVT_LEN;
-       acpi_facp.pm1_cnt_len = ACPI_VIA_PM1_CNT_LEN;
-       acpi_facp.pm_tm_len = ACPI_VIA_PM_TM_LEN;
-       acpi_facp.gpe0_len = ACPI_VIA_GPE0_LEN;
-       acpi_facp.p_lvl2_lat = (__u16) ACPI_INFINITE_LAT;
-       acpi_facp.p_lvl3_lat = (__u16) ACPI_INFINITE_LAT;
-
-       acpi_facp.duty_offset = ACPI_VIA_DUTY_OFFSET;
-       acpi_facp.duty_width = ACPI_VIA_DUTY_WIDTH;
-
-       acpi_facp.day_alarm = ACPI_VIA_DAY_ALARM;
-       acpi_facp.mon_alarm = ACPI_VIA_MON_ALARM;
-       acpi_facp.century = ACPI_VIA_CENTURY;
-
-       acpi_set_checksum((u8*) &acpi_facp, sizeof(acpi_facp));
-       acpi_load_table((ACPI_TABLE_HEADER*) &acpi_facp);
-
-       pblk = base + ACPI_VIA_P_BLK;
-       memcpy(acpi_dummy_dsdt + ACPI_DUMMY_PBLK, &pblk, sizeof(pblk));
-       acpi_set_checksum(acpi_dummy_dsdt, sizeof(acpi_dummy_dsdt));
-       acpi_load_table((ACPI_TABLE_HEADER*) acpi_dummy_dsdt);
-
-       return 0;
-}
-
-typedef enum
-{
-        CH_UNKNOWN = 0,
-        CH_INTEL_PIIX4,
-        CH_VIA_586,
-        CH_VIA_686A,
-} acpi_chip_t;
-
-/* indexed by value of each enum in acpi_chip_t */
-const static struct
-{
-        int (*chip_init)(struct pci_dev *dev);
-} acpi_chip_info[] =
-{
-        {NULL,},
-        {acpi_init_piix4},
-        {acpi_init_via},
-        {acpi_init_via},
-};
-
-static struct pci_device_id acpi_pci_tbl[] =
-{
-        {0x8086, 0x7113, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CH_INTEL_PIIX4},
-        {0x1106, 0x3040, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CH_VIA_586},
-        {0x1106, 0x3057, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CH_VIA_686A},
-        {0,} /* terminate list */
-};
-
-static int
-acpi_probe(struct pci_dev *dev, const struct pci_device_id *id)
-{
-        return acpi_chip_info[id->driver_data].chip_init(dev);
-}
-
-static struct pci_driver acpi_driver =
-{
-        name:           "acpi",
-        id_table:       acpi_pci_tbl,
-        probe:          acpi_probe,
-};
-static int acpi_driver_registered = 0;
-
-/*
- * Locate a known ACPI chipset
- */
-static int
-acpi_find_chipset(void)
-{
-        if (pci_register_driver(&acpi_driver) < 1)
-                return -ENODEV;
-        acpi_driver_registered = 1;
-        return 0;
-}
-
-/*
- * Fetch the FACP information
- */
-static int
-acpi_fetch_facp(void)
+acpi_fetch_fadt(void)
 {
        ACPI_BUFFER buffer;
 
-       memset(&acpi_facp, 0, sizeof(acpi_facp));
-       buffer.pointer = &acpi_facp;
-       buffer.length = sizeof(acpi_facp);
-       if (!ACPI_SUCCESS(acpi_get_table(ACPI_TABLE_FACP, 1, &buffer))) {
-               printk(KERN_ERR "ACPI: missing FACP\n");
+       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;
        }
 
-       if (acpi_facp.p_lvl2_lat
-           && acpi_facp.p_lvl2_lat <= ACPI_MAX_P_LVL2_LAT) {
+       if (acpi_fadt.plvl2_lat
+           && acpi_fadt.plvl2_lat <= ACPI_MAX_P_LVL2_LAT) {
                acpi_c2_exit_latency
-                       = ACPI_uS_TO_TMR_TICKS(acpi_facp.p_lvl2_lat);
+                       = ACPI_MICROSEC_TO_TMR_TICKS(acpi_fadt.plvl2_lat);
                acpi_c2_enter_latency
-                       = ACPI_uS_TO_TMR_TICKS(ACPI_TMR_HZ / 1000);
+                       = ACPI_MICROSEC_TO_TMR_TICKS(ACPI_TMR_HZ / 1000);
        }
-       if (acpi_facp.p_lvl3_lat
-           && acpi_facp.p_lvl3_lat <= ACPI_MAX_P_LVL3_LAT) {
+       if (acpi_fadt.plvl3_lat
+           && acpi_fadt.plvl3_lat <= ACPI_MAX_P_LVL3_LAT) {
                acpi_c3_exit_latency
-                       = ACPI_uS_TO_TMR_TICKS(acpi_facp.p_lvl3_lat);
+                       = ACPI_MICROSEC_TO_TMR_TICKS(acpi_fadt.plvl3_lat);
                acpi_c3_enter_latency
-                       = ACPI_uS_TO_TMR_TICKS(acpi_facp.p_lvl3_lat * 5);
+                       = ACPI_MICROSEC_TO_TMR_TICKS(acpi_fadt.plvl3_lat * 5);
        }
 
        return 0;
@@ -280,24 +69,19 @@ acpi_fetch_facp(void)
  * Find and load ACPI tables
  */
 int
-acpi_load_tables(void)
+acpi_find_and_load_tables(u64 rsdp)
 {
-       if (ACPI_SUCCESS(acpi_load_firmware_tables()))
+       if (ACPI_SUCCESS(acpi_load_tables(rsdp)))
        {
-               printk(KERN_INFO "ACPI: support found\n");
+               printk(KERN_INFO "ACPI: System description tables loaded\n");
        }
-       else if (acpi_find_chipset()) {
-               acpi_terminate();
-               return -1;
-       }
-
-       if (acpi_fetch_facp()) {
+       else {
+               printk(KERN_INFO "ACPI: System description table load failed\n");
                acpi_terminate();
                return -1;
        }
 
-       if (!ACPI_SUCCESS(acpi_load_namespace())) {
-               printk(KERN_ERR "ACPI: namespace load failed\n");
+       if (acpi_fetch_fadt()) {
                acpi_terminate();
                return -1;
        }
index edd89713320bbf7177a46838fb379b30259e39fb..751ef5de8f1902c93309a10e6556b84e3b5e6d78 100644 (file)
@@ -2,26 +2,14 @@
 # Makefile for all Linux ACPI interpreter subdirectories
 #
 
-SUB_DIRS        := 
-MOD_SUB_DIRS    := $(SUB_DIRS)
-MOD_IN_SUB_DIRS :=
-ALL_SUB_DIRS    := $(SUB_DIRS)
-
 O_TARGET := ../$(shell basename `pwd`).o
-O_OBJS   :=
-M_OBJS   :=
 
-ACPI_OBJS := $(patsubst %.c,%.o,$(wildcard *.c))
+obj-$(CONFIG_ACPI) := $(patsubst %.c,%.o,$(wildcard *.c))
 
 EXTRA_CFLAGS += -I../include
 
 EXTRA_CFLAGS += $(ACPI_CFLAGS)
 
-# if the interpreter is used, it overrides arch/i386/kernel/acpi.c
-ifeq ($(CONFIG_ACPI_INTERPRETER),y)
-  O_OBJS := $(ACPI_OBJS)
-endif
-
 include $(TOPDIR)/Rules.make
 
 clean:
diff --git a/drivers/acpi/tables/tbconvrt.c b/drivers/acpi/tables/tbconvrt.c
new file mode 100644 (file)
index 0000000..624926d
--- /dev/null
@@ -0,0 +1,553 @@
+/******************************************************************************
+ *
+ * Module Name: tbconvrt - ACPI Table conversion utilities
+ *              $Revision: 15 $
+ *
+ *****************************************************************************/
+
+/*
+ *  Copyright (C) 2000 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 "actables.h"
+#include "actbl.h"
+
+
+#define _COMPONENT          TABLE_MANAGER
+        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;\
+                          a.address = (UINT64) 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
+ *
+ * PARAMETERS:
+ *
+ * RETURN:
+ *
+ * DESCRIPTION:
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_tb_convert_to_xsdt (
+       ACPI_TABLE_DESC         *table_info,
+       u32                     *number_of_tables)
+{
+       u32                     table_size;
+       u32                     pointer_size;
+       u32                     i;
+       XSDT_DESCRIPTOR         *new_table;
+
+
+#ifndef _IA64
+
+       if (acpi_gbl_RSDP->revision < 2) {
+               pointer_size = sizeof (u32);
+       }
+
+       else
+#endif
+       {
+               pointer_size = sizeof (UINT64);
+       }
+
+       /*
+        * Determine the number of tables pointed to by the RSDT/XSDT.
+        * This is defined by the ACPI Specification to be the number of
+        * pointers contained within the RSDT/XSDT.  The size of the pointers
+        * is architecture-dependent.
+        */
+
+       table_size = table_info->pointer->length;
+       *number_of_tables = (table_size -
+                          sizeof (ACPI_TABLE_HEADER)) / pointer_size;
+
+       /* Compute size of the converted XSDT */
+
+       table_size = (*number_of_tables * sizeof (UINT64)) + sizeof (ACPI_TABLE_HEADER);
+
+
+       /* Allocate an XSDT */
+
+       new_table = acpi_cm_callocate (table_size);
+       if (!new_table) {
+               return (AE_NO_MEMORY);
+       }
+
+       /* Copy the header and set the length */
+
+       MEMCPY (new_table, table_info->pointer, sizeof (ACPI_TABLE_HEADER));
+       new_table->header.length = table_size;
+
+       /* Copy the table pointers */
+
+       for (i = 0; i < *number_of_tables; i++) {
+               if (acpi_gbl_RSDP->revision < 2) {
+#ifdef _IA64
+                       new_table->table_offset_entry[i] =
+                               ((RSDT_DESCRIPTOR_REV071 *) table_info->pointer)->table_offset_entry[i];
+#else
+                       new_table->table_offset_entry[i] =
+                               ((RSDT_DESCRIPTOR_REV1 *) table_info->pointer)->table_offset_entry[i];
+#endif
+               }
+               else {
+                       new_table->table_offset_entry[i] =
+                               ((XSDT_DESCRIPTOR *) table_info->pointer)->table_offset_entry[i];
+               }
+       }
+
+
+       /* Delete the original table (either mapped or in a buffer) */
+
+       acpi_tb_delete_single_table (table_info);
+
+
+       /* Point the table descriptor to the new table */
+
+       table_info->pointer     = (ACPI_TABLE_HEADER *) new_table;
+       table_info->base_pointer = (ACPI_TABLE_HEADER *) new_table;
+       table_info->length      = table_size;
+       table_info->allocation  = ACPI_MEM_ALLOCATED;
+
+       return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_tb_convert_table_fadt
+ *
+ * PARAMETERS:
+ *
+ * RETURN:
+ *
+ * DESCRIPTION:
+ *    Converts BIOS supplied 1.0 and 0.71 ACPI FADT to an intermediate
+ *    ACPI 2.0 FADT. If the BIOS supplied a 2.0 FADT then it is simply
+ *    copied to the intermediate FADT.  The ACPI CA software uses this
+ *    intermediate FADT. Thus a significant amount of special #ifdef
+ *    type codeing is saved. This intermediate FADT will need to be
+ *    freed at some point.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_tb_convert_table_fadt (void)
+{
+
+#ifdef _IA64
+       FADT_DESCRIPTOR_REV071 *FADT71;
+       u8                      pm1_address_space;
+       u8                      pm2_address_space;
+       u8                      pm_timer_address_space;
+       u8                      gpe0address_space;
+       u8                      gpe1_address_space;
+#else
+       FADT_DESCRIPTOR_REV1   *FADT1;
+#endif
+
+       FADT_DESCRIPTOR_REV2   *FADT2;
+       ACPI_TABLE_DESC        *table_desc;
+
+
+       /* Acpi_gbl_FADT is valid */
+       /* Allocate and zero the 2.0 buffer */
+
+       FADT2 = acpi_cm_callocate (sizeof (FADT_DESCRIPTOR_REV2));
+       if (FADT2 == NULL) {
+               return (AE_NO_MEMORY);
+       }
+
+
+       /* The ACPI FADT revision number is FADT2_REVISION_ID=3 */
+       /* So, if the current table revision is less than 3 it is type 1.0 or 0.71 */
+
+       if (acpi_gbl_FADT->header.revision >= FADT2_REVISION_ID) {
+               /* We have an ACPI 2.0 FADT but we must copy it to our local buffer */
+
+               *FADT2 = *((FADT_DESCRIPTOR_REV2*) acpi_gbl_FADT);
+
+       }
+
+       else {
+
+#ifdef _IA64
+               /*
+                * For the 64-bit case only, a revision ID less than V2.0 means the
+                * tables are the 0.71 extensions
+                */
+
+               /* The BIOS stored FADT should agree with Revision 0.71 */
+
+               FADT71 = (FADT_DESCRIPTOR_REV071 *) acpi_gbl_FADT;
+
+               /* Copy the table header*/
+
+               FADT2->header       = FADT71->header;
+
+               /* Copy the common fields */
+
+               FADT2->sci_int      = FADT71->sci_int;
+               FADT2->acpi_enable  = FADT71->acpi_enable;
+               FADT2->acpi_disable = FADT71->acpi_disable;
+               FADT2->S4_bios_req  = FADT71->S4_bios_req;
+               FADT2->plvl2_lat    = FADT71->plvl2_lat;
+               FADT2->plvl3_lat    = FADT71->plvl3_lat;
+               FADT2->day_alrm     = FADT71->day_alrm;
+               FADT2->mon_alrm     = FADT71->mon_alrm;
+               FADT2->century      = FADT71->century;
+               FADT2->gpe1_base    = FADT71->gpe1_base;
+
+               /*
+                * We still use the block length registers even though
+                * the GAS structure should obsolete them.  This is because
+                * these registers are byte lengths versus the GAS which
+                * contains a bit width
+                */
+               FADT2->pm1_evt_len  = FADT71->pm1_evt_len;
+               FADT2->pm1_cnt_len  = FADT71->pm1_cnt_len;
+               FADT2->pm2_cnt_len  = FADT71->pm2_cnt_len;
+               FADT2->pm_tm_len    = FADT71->pm_tm_len;
+               FADT2->gpe0blk_len  = FADT71->gpe0blk_len;
+               FADT2->gpe1_blk_len = FADT71->gpe1_blk_len;
+               FADT2->gpe1_base    = FADT71->gpe1_base;
+
+               /* Copy the existing 0.71 flags to 2.0. The other bits are zero.*/
+
+               FADT2->wb_invd      = FADT71->flush_cash;
+               FADT2->proc_c1      = FADT71->proc_c1;
+               FADT2->plvl2_up     = FADT71->plvl2_up;
+               FADT2->pwr_button   = FADT71->pwr_button;
+               FADT2->sleep_button = FADT71->sleep_button;
+               FADT2->fixed_rTC    = FADT71->fixed_rTC;
+               FADT2->rtcs4        = FADT71->rtcs4;
+               FADT2->tmr_val_ext  = FADT71->tmr_val_ext;
+               FADT2->dock_cap     = FADT71->dock_cap;
+
+
+               /* We should not use these next two addresses */
+               /* Since our buffer is pre-zeroed nothing to do for */
+               /* the next three data items in the structure */
+               /* FADT2->Firmware_ctrl = 0; */
+               /* FADT2->Dsdt = 0; */
+
+               /* System Interrupt Model isn't used in ACPI 2.0*/
+               /* FADT2->Reserved1 = 0; */
+
+               /* This field is set by the OEM to convey the preferred */
+               /* power management profile to OSPM. It doesn't have any*/
+               /* 0.71 equivalence.  Since we don't know what kind of  */
+               /* 64-bit system this is, we will pick unspecified.     */
+
+               FADT2->prefer_PM_profile = PM_UNSPECIFIED;
+
+
+               /* Port address of SMI command port */
+               /* We shouldn't use this port because IA64 doesn't */
+               /* have or use SMI.  It has PMI. */
+
+               FADT2->smi_cmd      = (u32)(FADT71->smi_cmd & 0xFFFFFFFF);
+
+
+               /* processor performance state control*/
+               /* The value OSPM writes to the SMI_CMD register to assume */
+               /* processor performance state control responsibility. */
+               /* There isn't any equivalence in 0.71 */
+               /* Again this should be meaningless for IA64 */
+               /* FADT2->Pstate_cnt = 0; */
+
+               /* The 32-bit Power management and GPE registers are */
+               /* not valid in IA-64 and we are not going to use them */
+               /* so leaving them pre-zeroed. */
+
+               /* Support for the _CST object and C States change notification.*/
+               /* This data item hasn't any 0.71 equivalence so leaving it zero.*/
+               /* FADT2->Cst_cnt = 0; */
+
+               /* number of flush strides that need to be read */
+               /* No 0.71 equivalence. Leave pre-zeroed. */
+               /* FADT2->Flush_size = 0; */
+
+               /* Processor's memory cache line width, in bytes */
+               /* No 0.71 equivalence. Leave pre-zeroed. */
+               /* FADT2->Flush_stride = 0; */
+
+               /* Processor\92s duty cycle index in processor's P_CNT reg*/
+               /* No 0.71 equivalence. Leave pre-zeroed. */
+               /* FADT2->Duty_offset = 0; */
+
+               /* Processor\92s duty cycle value bit width in P_CNT register.*/
+               /* No 0.71 equivalence. Leave pre-zeroed. */
+               /* FADT2->Duty_width = 0; */
+
+
+               /* Since there isn't any equivalence in 0.71 */
+               /* and since Big_sur had to support legacy */
+
+               FADT2->iapc_boot_arch = BAF_LEGACY_DEVICES;
+
+               /* Copy to ACPI 2.0 64-BIT Extended Addresses */
+
+               FADT2->Xfirmware_ctrl = FADT71->firmware_ctrl;
+               FADT2->Xdsdt         = FADT71->dsdt;
+
+
+               /* Extract the address space IDs */
+
+               pm1_address_space   = (u8)((FADT71->address_space & PM1_BLK_ADDRESS_SPACE)    >> 1);
+               pm2_address_space   = (u8)((FADT71->address_space & PM2_CNT_BLK_ADDRESS_SPACE) >> 2);
+               pm_timer_address_space = (u8)((FADT71->address_space & PM_TMR_BLK_ADDRESS_SPACE) >> 3);
+               gpe0address_space   = (u8)((FADT71->address_space & GPE0_BLK_ADDRESS_SPACE)   >> 4);
+               gpe1_address_space  = (u8)((FADT71->address_space & GPE1_BLK_ADDRESS_SPACE)   >> 5);
+
+               /*
+                * Convert the 0.71 (non-GAS style) Block addresses to V2.0 GAS structures,
+                * in this order:
+                *
+                * PM 1_a Events
+                * PM 1_b Events
+                * PM 1_a Control
+                * PM 1_b Control
+                * PM 2 Control
+                * PM Timer Control
+                * GPE Block 0
+                * GPE Block 1
+                */
+
+               ASL_BUILD_GAS_FROM_ENTRY (FADT2->Xpm1a_evt_blk, FADT71->pm1_evt_len, FADT71->pm1a_evt_blk, pm1_address_space);
+               ASL_BUILD_GAS_FROM_ENTRY (FADT2->Xpm1b_evt_blk, FADT71->pm1_evt_len, FADT71->pm1b_evt_blk, pm1_address_space);
+               ASL_BUILD_GAS_FROM_ENTRY (FADT2->Xpm1a_cnt_blk, FADT71->pm1_cnt_len, FADT71->pm1a_cnt_blk, pm1_address_space);
+               ASL_BUILD_GAS_FROM_ENTRY (FADT2->Xpm1b_cnt_blk, FADT71->pm1_cnt_len, FADT71->pm1b_cnt_blk, pm1_address_space);
+               ASL_BUILD_GAS_FROM_ENTRY (FADT2->Xpm2_cnt_blk, FADT71->pm2_cnt_len, FADT71->pm2_cnt_blk, pm2_address_space);
+               ASL_BUILD_GAS_FROM_ENTRY (FADT2->Xpm_tmr_blk, FADT71->pm_tm_len,  FADT71->pm_tmr_blk, pm_timer_address_space);
+               ASL_BUILD_GAS_FROM_ENTRY (FADT2->Xgpe0blk,    FADT71->gpe0blk_len, FADT71->gpe0blk,   gpe0address_space);
+               ASL_BUILD_GAS_FROM_ENTRY (FADT2->Xgpe1_blk,   FADT71->gpe1_blk_len, FADT71->gpe1_blk, gpe1_address_space);
+
+#else
+
+               /* ACPI 1.0 FACS */
+
+
+               /* The BIOS stored FADT should agree with Revision 1.0 */
+
+               FADT1 = (FADT_DESCRIPTOR_REV1*) acpi_gbl_FADT;
+
+               /*
+                * Copy the table header and the common part of the tables
+                * The 2.0 table is an extension of the 1.0 table, so the
+                * entire 1.0 table can be copied first, then expand some
+                * fields to 64 bits.
+                */
+
+               MEMCPY (FADT2, FADT1, sizeof (FADT_DESCRIPTOR_REV1));
+
+
+               /* Convert table pointers to 64-bit fields */
+
+               FADT2->Xfirmware_ctrl = (UINT64) FADT1->firmware_ctrl;
+               FADT2->Xdsdt         = (UINT64) FADT1->dsdt;
+
+               /* System Interrupt Model isn't used in ACPI 2.0*/
+               /* FADT2->Reserved1 = 0; */
+
+               /* This field is set by the OEM to convey the preferred */
+               /* power management profile to OSPM. It doesn't have any*/
+               /* 1.0 equivalence.  Since we don't know what kind of   */
+               /* 32-bit system this is, we will pick unspecified.     */
+
+               FADT2->prefer_PM_profile = PM_UNSPECIFIED;
+
+
+               /* Processor Performance State Control. This is the value  */
+               /* OSPM writes to the SMI_CMD register to assume processor */
+               /* performance state control responsibility. There isn't   */
+               /* any equivalence in 1.0.  So leave it zeroed.            */
+
+               FADT2->pstate_cnt = 0;
+
+
+               /* Support for the _CST object and C States change notification.*/
+               /* This data item hasn't any 1.0 equivalence so leaving it zero.*/
+
+               FADT2->cst_cnt = 0;
+
+
+               /* Since there isn't any equivalence in 1.0 and since it   */
+               /* is highly likely that a 1.0 system has legacy  support. */
+
+               FADT2->iapc_boot_arch = BAF_LEGACY_DEVICES;
+
+
+               /*
+                * Convert the V1.0 Block addresses to V2.0 GAS structures
+                * in this order:
+                *
+                * PM 1_a Events
+                * PM 1_b Events
+                * PM 1_a Control
+                * PM 1_b Control
+                * PM 2 Control
+                * PM Timer Control
+                * GPE Block 0
+                * GPE Block 1
+                */
+
+               ASL_BUILD_GAS_FROM_V1_ENTRY (FADT2->Xpm1a_evt_blk, FADT1->pm1_evt_len, FADT1->pm1a_evt_blk);
+               ASL_BUILD_GAS_FROM_V1_ENTRY (FADT2->Xpm1b_evt_blk, FADT1->pm1_evt_len, FADT1->pm1b_evt_blk);
+               ASL_BUILD_GAS_FROM_V1_ENTRY (FADT2->Xpm1a_cnt_blk, FADT1->pm1_cnt_len, FADT1->pm1a_cnt_blk);
+               ASL_BUILD_GAS_FROM_V1_ENTRY (FADT2->Xpm1b_cnt_blk, FADT1->pm1_cnt_len, FADT1->pm1b_cnt_blk);
+               ASL_BUILD_GAS_FROM_V1_ENTRY (FADT2->Xpm2_cnt_blk, FADT1->pm2_cnt_len, FADT1->pm2_cnt_blk);
+               ASL_BUILD_GAS_FROM_V1_ENTRY (FADT2->Xpm_tmr_blk, FADT1->pm_tm_len,  FADT1->pm_tmr_blk);
+               ASL_BUILD_GAS_FROM_V1_ENTRY (FADT2->Xgpe0blk,    FADT1->gpe0blk_len, FADT1->gpe0blk);
+               ASL_BUILD_GAS_FROM_V1_ENTRY (FADT2->Xgpe1_blk,   FADT1->gpe1_blk_len, FADT1->gpe1_blk);
+#endif
+       }
+
+
+       /*
+        * Global FADT pointer will point to the common V2.0 FADT
+        */
+       acpi_gbl_FADT = FADT2;
+
+
+       /* Free the original table */
+
+       table_desc = &acpi_gbl_acpi_tables[ACPI_TABLE_FADT];
+       acpi_tb_delete_single_table (table_desc);
+
+
+       /* Install the new table */
+
+       table_desc->pointer = (ACPI_TABLE_HEADER *) acpi_gbl_FADT;
+       table_desc->base_pointer = acpi_gbl_FADT;
+       table_desc->allocation = ACPI_MEM_ALLOCATED;
+       table_desc->length = sizeof (FADT_DESCRIPTOR_REV2);
+
+
+       /* Dump the FADT Header */
+
+       /* Dump the entire FADT */
+
+
+       return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_tb_convert_table_facs
+ *
+ * PARAMETERS:
+ *
+ * RETURN:
+ *
+ * DESCRIPTION:
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_tb_build_common_facs (
+       ACPI_TABLE_DESC         *table_info)
+{
+       ACPI_COMMON_FACS        *common_facs;
+
+#ifdef _IA64
+       FACS_DESCRIPTOR_REV071  *FACS71;
+#else
+       FACS_DESCRIPTOR_REV1    *FACS1;
+#endif
+
+       FACS_DESCRIPTOR_REV2    *FACS2;
+
+
+       /* Allocate a common FACS */
+
+       common_facs = acpi_cm_callocate (sizeof (ACPI_COMMON_FACS));
+       if (!common_facs) {
+               return (AE_NO_MEMORY);
+       }
+
+
+       /* Copy fields to the new FACS */
+
+       if (acpi_gbl_RSDP->revision < 2) {
+#ifdef _IA64
+               /* 0.71 FACS */
+
+               FACS71 = (FACS_DESCRIPTOR_REV071 *) acpi_gbl_FACS;
+
+               common_facs->global_lock = (u32 *) &(FACS71->global_lock);
+               common_facs->firmware_waking_vector = &FACS71->firmware_waking_vector;
+               common_facs->vector_width = 64;
+#else
+               /* ACPI 1.0 FACS */
+
+               FACS1 = (FACS_DESCRIPTOR_REV1 *) acpi_gbl_FACS;
+
+               common_facs->global_lock = &(FACS1->global_lock);
+               common_facs->firmware_waking_vector = (UINT64 *) &FACS1->firmware_waking_vector;
+               common_facs->vector_width = 32;
+
+#endif
+       }
+
+       else {
+               /* ACPI 2.0 FACS */
+
+               FACS2 = (FACS_DESCRIPTOR_REV2 *) acpi_gbl_FACS;
+
+               common_facs->global_lock = &(FACS2->global_lock);
+               common_facs->firmware_waking_vector = &FACS2->Xfirmware_waking_vector;
+               common_facs->vector_width = 64;
+       }
+
+
+       /* Set the global FACS pointer to point to the common FACS */
+
+
+       acpi_gbl_FACS = common_facs;
+
+       return  (AE_OK);
+}
+
+
index 19a8f0a2ab1333884e0b4fe48ffcf0efbc673c83..2cf8eede7781105ba69239c2e31bb9a1397286b5 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: tbget - ACPI Table get* routines
- *              $Revision: 22 $
+ *              $Revision: 40 $
  *
  *****************************************************************************/
 
@@ -32,6 +32,7 @@
 #define _COMPONENT          TABLE_MANAGER
         MODULE_NAME         ("tbget")
 
+#define RSDP_CHECKSUM_LENGTH 20
 
 /*******************************************************************************
  *
@@ -127,7 +128,7 @@ acpi_tb_get_table_ptr (
 
 ACPI_STATUS
 acpi_tb_get_table (
-       void                    *physical_address,
+       ACPI_PHYSICAL_ADDRESS   physical_address,
        ACPI_TABLE_HEADER       *buffer_ptr,
        ACPI_TABLE_DESC         *table_info)
 {
@@ -239,9 +240,10 @@ acpi_tb_get_all_tables (
 
                MEMSET (&table_info, 0, sizeof (ACPI_TABLE_DESC));
 
-               /* Get the table via the RSDT */
+               /* Get the table via the XSDT */
 
-               status = acpi_tb_get_table ((void *) acpi_gbl_RSDT->table_offset_entry[index],
+               status = acpi_tb_get_table ((ACPI_PHYSICAL_ADDRESS)
+                                acpi_gbl_XSDT->table_offset_entry[index],
                                 table_ptr, &table_info);
 
                /* Ignore a table that failed verification */
@@ -266,15 +268,25 @@ acpi_tb_get_all_tables (
                         * determine if there are enough tables to continue.
                         */
 
-                       acpi_tb_delete_single_table (&table_info);
+                       acpi_tb_uninstall_table (&table_info);
                }
        }
 
 
+       /*
+        * Convert the FADT to a common format.  This allows earlier revisions of the
+        * table to coexist with newer versions, using common access code.
+        */
+       status = acpi_tb_convert_table_fadt ();
+       if (ACPI_FAILURE (status)) {
+               return (status);
+       }
+
+
        /*
         * Get the minimum set of ACPI tables, namely:
         *
-        * 1) FACP (via RSDT in loop above)
+        * 1) FADT (via RSDT in loop above)
         * 2) FACS
         * 3) DSDT
         *
@@ -282,8 +294,8 @@ acpi_tb_get_all_tables (
 
 
        /*
-        * Get the FACS (must have the FACP first, from loop above)
-        * Acpi_tb_get_table_facs will fail if FACP pointer is not valid
+        * Get the FACS (must have the FADT first, from loop above)
+        * Acpi_tb_get_table_facs will fail if FADT pointer is not valid
         */
 
        status = acpi_tb_get_table_facs (table_ptr, &table_info);
@@ -291,6 +303,7 @@ acpi_tb_get_all_tables (
                return (status);
        }
 
+
        /* Install the FACS */
 
        status = acpi_tb_install_table (table_ptr, &table_info);
@@ -298,10 +311,22 @@ acpi_tb_get_all_tables (
                return (status);
        }
 
+       /*
+        * Create the common FACS pointer table
+        * (Contains pointers to the original table)
+        */
 
-       /* Get the DSDT (We know that the FACP if valid now) */
+       status = acpi_tb_build_common_facs (&table_info);
+       if (ACPI_FAILURE (status)) {
+               return (status);
+       }
+
+
+       /*
+        * Get the DSDT (We know that the FADT is valid now)
+        */
 
-       status = acpi_tb_get_table ((void *) acpi_gbl_FACP->dsdt, table_ptr, &table_info);
+       status = acpi_tb_get_table (acpi_gbl_FADT->Xdsdt, table_ptr, &table_info);
        if (ACPI_FAILURE (status)) {
                return (status);
        }
@@ -321,9 +346,265 @@ acpi_tb_get_all_tables (
         * Initialize the capabilities flags.
         * Assumes that platform supports ACPI_MODE since we have tables!
         */
-
        acpi_gbl_system_flags |= acpi_hw_get_mode_capabilities ();
 
+
+       /* Always delete the RSDP mapping, we are done with it */
+
+       acpi_tb_delete_acpi_table (ACPI_TABLE_RSDP);
+
+       return (status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_tb_verify_rsdp
+ *
+ * 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_verify_rsdp (
+       ACPI_PHYSICAL_ADDRESS   rsdp_physical_address)
+{
+       ACPI_TABLE_DESC         table_info;
+       ACPI_STATUS             status;
+       u8                      *table_ptr;
+
+
+       /*
+        * Obtain access to the RSDP structure
+        */
+       status = acpi_os_map_memory (rsdp_physical_address,
+                         sizeof (RSDP_DESCRIPTOR),
+                         (void **) &table_ptr);
+       if (ACPI_FAILURE (status)) {
+               return (status);
+       }
+
+       /*
+        *  The signature and checksum must both be correct
+        */
+       if (STRNCMP ((NATIVE_CHAR *) table_ptr, RSDP_SIG, sizeof (RSDP_SIG)-1) != 0) {
+               /* Nope, BAD Signature */
+
+               status = AE_BAD_SIGNATURE;
+               goto cleanup;
+       }
+
+       if (acpi_tb_checksum (table_ptr, RSDP_CHECKSUM_LENGTH) != 0) {
+               /* Nope, BAD Checksum */
+
+               status = AE_BAD_CHECKSUM;
+               goto cleanup;
+       }
+
+       /* TBD: Check extended checksum if table version >= 2 */
+
+       /* The RSDP supplied is OK */
+
+       table_info.pointer     = (ACPI_TABLE_HEADER *) table_ptr;
+       table_info.length      = sizeof (RSDP_DESCRIPTOR);
+       table_info.allocation  = ACPI_MEM_MAPPED;
+       table_info.base_pointer = table_ptr;
+
+       /* Save the table pointers and allocation info */
+
+       status = acpi_tb_init_table_descriptor (ACPI_TABLE_RSDP, &table_info);
+       if (ACPI_FAILURE (status)) {
+               goto cleanup;
+       }
+
+
+       /* Save the RSDP in a global for easy access */
+
+       acpi_gbl_RSDP = (RSDP_DESCRIPTOR *) table_info.pointer;
+       return (status);
+
+
+       /* Error exit */
+cleanup:
+
+       acpi_os_unmap_memory (table_ptr, sizeof (RSDP_DESCRIPTOR));
+       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 = 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
+        */
+       if (acpi_gbl_RSDP->revision < 2) {
+#ifdef _IA64
+               /* 0.71 RSDP has 64bit Rsdt address field */
+               physical_address = ((RSDP_DESCRIPTOR_REV071 *)acpi_gbl_RSDP)->rsdt_physical_address;
+#else
+               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_gbl_RSDP->xsdt_physical_address;
+               table_signature = XSDT_SIG;
+               signature_length = sizeof (XSDT_SIG) -1;
+       }
+
+
+       /* Get the RSDT/XSDT */
+
+       status = acpi_tb_get_table (physical_address, NULL, &table_info);
+       if (ACPI_FAILURE (status)) {
+               return (status);
+       }
+
+
+       /* 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));
+
+               return (status);
+       }
+
+
+       /* Valid RSDT signature, verify the checksum */
+
+       status = acpi_tb_verify_table_checksum (table_info.pointer);
+
+
+       /* Convert and/or copy to an XSDT structure */
+
+       status = acpi_tb_convert_to_xsdt (&table_info, number_of_tables);
+       if (ACPI_FAILURE (status)) {
+               return (status);
+       }
+
+       /* Save the table pointers and allocation info */
+
+       status = acpi_tb_init_table_descriptor (ACPI_TABLE_XSDT, &table_info);
+       if (ACPI_FAILURE (status)) {
+               return (status);
+       }
+
+       acpi_gbl_XSDT = (XSDT_DESCRIPTOR *) table_info.pointer;
+
+       return (status);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION:    Acpi_tb_get_table_facs
+ *
+ * PARAMETERS:  *Buffer_ptr             - If Buffer_ptr is valid, read data from
+ *                                          buffer rather than searching memory
+ *              *Table_info             - Where the table info is returned
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Returns a pointer to the FACS as defined in FADT.  This
+ *              function assumes the global variable FADT has been
+ *              correctly initialized.  The value of FADT->Firmware_ctrl
+ *              into a far pointer which is returned.
+ *
+ *****************************************************************************/
+
+ACPI_STATUS
+acpi_tb_get_table_facs (
+       ACPI_TABLE_HEADER       *buffer_ptr,
+       ACPI_TABLE_DESC         *table_info)
+{
+       void                    *table_ptr = NULL;
+       u32                     size;
+       u8                      allocation;
+       ACPI_STATUS             status = AE_OK;
+
+
+       /* Must have a valid FADT pointer */
+
+       if (!acpi_gbl_FADT) {
+               return (AE_NO_ACPI_TABLES);
+       }
+
+       size = sizeof (FACS_DESCRIPTOR);
+       if (buffer_ptr) {
+               /*
+                * Getting table from a file -- allocate a buffer and
+                * read the table.
+                */
+               table_ptr = acpi_cm_allocate (size);
+               if(!table_ptr) {
+                       return (AE_NO_MEMORY);
+               }
+
+               MEMCPY (table_ptr, buffer_ptr, size);
+
+               /* Save allocation type */
+
+               allocation = ACPI_MEM_ALLOCATED;
+       }
+
+       else {
+               /* Just map the physical memory to our address space */
+
+               status = acpi_tb_map_acpi_table (acpi_gbl_FADT->Xfirmware_ctrl,
+                                  &size, &table_ptr);
+               if (ACPI_FAILURE(status)) {
+                       return (status);
+               }
+
+               /* Save allocation type */
+
+               allocation = ACPI_MEM_MAPPED;
+       }
+
+
+       /* Return values */
+
+       table_info->pointer     = table_ptr;
+       table_info->length      = size;
+       table_info->allocation  = allocation;
+       table_info->base_pointer = table_ptr;
+
        return (status);
 }
 
index 56e211ecf425b032072a2fc8cf280d5adf559276..b3926a0e36fdf4cb679ba3add3dc94d9903d150d 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: tbinstal - ACPI table installation and removal
- *              $Revision: 29 $
+ *              $Revision: 34 $
  *
  *****************************************************************************/
 
@@ -307,7 +307,7 @@ acpi_tb_delete_acpi_tables (void)
         * Memory can either be mapped or allocated
         */
 
-       for (type = 0; type < ACPI_TABLE_MAX; type++) {
+       for (type = 0; type < NUM_ACPI_TABLES; type++) {
                acpi_tb_delete_acpi_table (type);
        }
 
@@ -352,35 +352,24 @@ acpi_tb_delete_acpi_table (
                acpi_gbl_RSDP = NULL;
                break;
 
-       case ACPI_TABLE_APIC:
-               acpi_gbl_APIC = NULL;
-               break;
-
        case ACPI_TABLE_DSDT:
                acpi_gbl_DSDT = NULL;
                break;
 
-       case ACPI_TABLE_FACP:
-               acpi_gbl_FACP = NULL;
+       case ACPI_TABLE_FADT:
+               acpi_gbl_FADT = NULL;
                break;
 
        case ACPI_TABLE_FACS:
                acpi_gbl_FACS = NULL;
                break;
 
-       case ACPI_TABLE_PSDT:
-               break;
-
-       case ACPI_TABLE_RSDT:
-               acpi_gbl_RSDT = NULL;
+       case ACPI_TABLE_XSDT:
+               acpi_gbl_XSDT = NULL;
                break;
 
        case ACPI_TABLE_SSDT:
-               break;
-
-       case ACPI_TABLE_SBST:
-               acpi_gbl_SBST = NULL;
-
+       case ACPI_TABLE_PSDT:
        default:
                break;
        }
@@ -424,7 +413,7 @@ acpi_tb_free_acpi_tables_of_type (
         */
 
        for (i = 0; i < count; i++) {
-               table_desc = acpi_tb_delete_single_table (table_desc);
+               table_desc = acpi_tb_uninstall_table (table_desc);
        }
 
        return;
@@ -439,37 +428,20 @@ acpi_tb_free_acpi_tables_of_type (
  *
  * RETURN:      None.
  *
- * DESCRIPTION: Free the memory associated with an internal ACPI table that
- *              is either installed or has never been installed.
- *              Table mutex should be locked.
+ * DESCRIPTION: Low-level free for a single ACPI table.  Handles cases where
+ *              the table was allocated a buffer or was mapped.
  *
  ******************************************************************************/
 
-ACPI_TABLE_DESC *
+void
 acpi_tb_delete_single_table (
        ACPI_TABLE_DESC         *table_desc)
 {
-       ACPI_TABLE_DESC         *next_desc;
-
 
        if (!table_desc) {
-               return (NULL);
-       }
-
-
-       /* Unlink the descriptor */
-
-       if (table_desc->prev) {
-               table_desc->prev->next = table_desc->next;
-       }
-
-       if (table_desc->next) {
-               table_desc->next->prev = table_desc->prev;
+               return;
        }
 
-
-       /* Free the memory allocated for the table itself */
-
        if (table_desc->pointer) {
                /* Valid table, determine type of memory allocation */
 
@@ -477,7 +449,6 @@ acpi_tb_delete_single_table (
                {
 
                case ACPI_MEM_NOT_ALLOCATED:
-
                        break;
 
 
@@ -493,10 +464,52 @@ acpi_tb_delete_single_table (
                        break;
                }
        }
+}
 
 
-       /* Free the table descriptor (Don't delete the list head, tho) */
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_tb_uninstall_table
+ *
+ * PARAMETERS:  Table_info          - A table info struct
+ *
+ * RETURN:      None.
+ *
+ * DESCRIPTION: Free the memory associated with an internal ACPI table that
+ *              is either installed or has never been installed.
+ *              Table mutex should be locked.
+ *
+ ******************************************************************************/
 
+ACPI_TABLE_DESC *
+acpi_tb_uninstall_table (
+       ACPI_TABLE_DESC         *table_desc)
+{
+       ACPI_TABLE_DESC         *next_desc;
+
+
+       if (!table_desc) {
+               return (NULL);
+       }
+
+
+       /* Unlink the descriptor */
+
+       if (table_desc->prev) {
+               table_desc->prev->next = table_desc->next;
+       }
+
+       if (table_desc->next) {
+               table_desc->next->prev = table_desc->prev;
+       }
+
+
+       /* Free the memory allocated for the table itself */
+
+       acpi_tb_delete_single_table (table_desc);
+
+
+       /* Free the table descriptor (Don't delete the list head, tho) */
 
        if ((table_desc->prev) == (table_desc->next)) {
 
diff --git a/drivers/acpi/tables/tbtable.c b/drivers/acpi/tables/tbtable.c
deleted file mode 100644 (file)
index fe006bf..0000000
+++ /dev/null
@@ -1,392 +0,0 @@
-/******************************************************************************
- *
- * Module Name: tbtable - ACPI tables: FACP, FACS, and RSDP utilities
- *              $Revision: 24 $
- *
- *****************************************************************************/
-
-/*
- *  Copyright (C) 2000 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 "actables.h"
-
-
-#define _COMPONENT          TABLE_MANAGER
-        MODULE_NAME         ("tbtable")
-
-
-/*******************************************************************************
- *
- * 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_STATUS             status = AE_OK;
-       ACPI_TABLE_DESC         table_info;
-
-
-       /* Get the RSDP */
-
-       status = acpi_tb_find_rsdp (&table_info);
-       if (ACPI_FAILURE (status)) {
-               REPORT_WARNING ("RSDP structure not found");
-               return (AE_NO_ACPI_TABLES);
-       }
-
-       /* Save the table pointers and allocation info */
-
-       status = acpi_tb_init_table_descriptor (ACPI_TABLE_RSDP, &table_info);
-       if (ACPI_FAILURE (status)) {
-               return (status);
-       }
-
-       acpi_gbl_RSDP = (ROOT_SYSTEM_DESCRIPTOR_POINTER *) table_info.pointer;
-
-
-       /*
-        * RSDP structure was found;  Now get the RSDT
-        */
-
-       status = acpi_tb_get_table ((void *) acpi_gbl_RSDP->rsdt_physical_address, NULL,
-                        &table_info);
-       if (ACPI_FAILURE (status)) {
-               if (status == AE_BAD_SIGNATURE) {
-                       /* Invalid RSDT signature */
-
-                       REPORT_ERROR ("Invalid signature where RSDP indicates RSDT should be located");
-
-               }
-               REPORT_ERROR ("Unable to locate RSDT");
-
-               return (status);
-       }
-
-
-       /* Always delete the RSDP mapping */
-
-       acpi_tb_delete_acpi_table (ACPI_TABLE_RSDP);
-
-       /* Save the table pointers and allocation info */
-
-       status = acpi_tb_init_table_descriptor (ACPI_TABLE_RSDT, &table_info);
-       if (ACPI_FAILURE (status)) {
-               return (status);
-       }
-
-       acpi_gbl_RSDT = (ROOT_SYSTEM_DESCRIPTION_TABLE *) table_info.pointer;
-
-
-       /* Valid RSDT signature, verify the checksum */
-
-       status = acpi_tb_verify_table_checksum ((ACPI_TABLE_HEADER *) acpi_gbl_RSDT);
-
-       /*
-        * Determine the number of tables pointed to by the RSDT.
-        * This is defined by the ACPI Specification to be the number of
-        * pointers contained within the RSDT.  The size of the pointers
-        * is architecture-dependent.
-        */
-
-       *number_of_tables = ((acpi_gbl_RSDT->header.length -
-                          sizeof (ACPI_TABLE_HEADER)) / sizeof (void *));
-
-
-       return (status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_tb_scan_memory_for_rsdp
- *
- * PARAMETERS:  Start_address       - Starting pointer for search
- *              Length              - Maximum length to search
- *
- * RETURN:      Pointer to the RSDP if found, otherwise NULL.
- *
- * DESCRIPTION: Search a block of memory for the RSDP signature
- *
- ******************************************************************************/
-
-u8 *
-acpi_tb_scan_memory_for_rsdp (
-       u8                      *start_address,
-       u32                     length)
-{
-       u32                     offset;
-       u8                      *mem_rover;
-
-
-       /* Search from given start addr for the requested length  */
-
-       for (offset = 0, mem_rover = start_address;
-                offset < length;
-                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,
-                               sizeof (ROOT_SYSTEM_DESCRIPTOR_POINTER)) == 0)
-               {
-                       /* If so, we have found the RSDP */
-
-                       return (mem_rover);
-               }
-       }
-
-       /* Searched entire block, no RSDP was found */
-
-       return (NULL);
-}
-
-
-/*******************************************************************************
- *
- * 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
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Search lower 1_mbyte of memory for the root system descriptor
- *              pointer structure.  If it is found, set *RSDP to point to it.
- *
- *              NOTE: The RSDP must be either in the first 1_k of the Extended
- *              BIOS Data Area or between E0000 and FFFFF (ACPI 1.0 section
- *              5.2.2; assertion #421).
- *
- ******************************************************************************/
-
-ACPI_STATUS
-acpi_tb_find_rsdp (
-       ACPI_TABLE_DESC         *table_info)
-{
-       u8                      *table_ptr;
-       u8                      *mem_rover;
-       ACPI_STATUS             status = AE_OK;
-
-       if (acpi_gbl_acpi_init_data.RSDP_physical_address) {
-               /*
-                *  RSDP address was supplied as part of the initialization data
-                */
-
-               status = acpi_os_map_memory(acpi_gbl_acpi_init_data.RSDP_physical_address,
-                                sizeof (ROOT_SYSTEM_DESCRIPTOR_POINTER),
-                                (void **)&table_ptr);
-
-               if (ACPI_FAILURE (status)) {
-                       return (status);
-               }
-
-               if (!table_ptr) {
-                       return (AE_NO_MEMORY);
-               }
-
-               /*
-                *  The signature and checksum must both be correct
-                */
-
-               if (STRNCMP ((NATIVE_CHAR *) table_ptr, RSDP_SIG, sizeof (RSDP_SIG)-1) != 0) {
-                       /* Nope, BAD Signature */
-                       acpi_os_unmap_memory (table_ptr, sizeof (ROOT_SYSTEM_DESCRIPTOR_POINTER));
-                       return (AE_BAD_SIGNATURE);
-               }
-
-               /* The signature and checksum must both be correct */
-
-               if (acpi_tb_checksum (table_ptr,
-                               sizeof (ROOT_SYSTEM_DESCRIPTOR_POINTER)) != 0)
-               {
-                       /* Nope, BAD Checksum */
-                       acpi_os_unmap_memory (table_ptr, sizeof (ROOT_SYSTEM_DESCRIPTOR_POINTER));
-                       return (AE_BAD_CHECKSUM);
-               }
-
-               /* RSDP supplied is OK */
-               /* If so, we have found the RSDP */
-
-               table_info->pointer     = (ACPI_TABLE_HEADER *) table_ptr;
-               table_info->length      = sizeof (ROOT_SYSTEM_DESCRIPTOR_POINTER);
-               table_info->allocation  = ACPI_MEM_MAPPED;
-               table_info->base_pointer = table_ptr;
-
-               return (AE_OK);
-       }
-
-       /*
-        * Search memory for RSDP.  First map low physical memory.
-        */
-
-       status = acpi_os_map_memory (LO_RSDP_WINDOW_BASE, LO_RSDP_WINDOW_SIZE,
-                         (void **)&table_ptr);
-
-       if (ACPI_FAILURE (status)) {
-               return (status);
-       }
-
-       /*
-        * 1) Search EBDA (low memory) paragraphs
-        */
-
-       if (NULL != (mem_rover = acpi_tb_scan_memory_for_rsdp (table_ptr,
-                         LO_RSDP_WINDOW_SIZE)))
-       {
-               /* Found it, return pointer and don't delete the mapping */
-
-               table_info->pointer     = (ACPI_TABLE_HEADER *) mem_rover;
-               table_info->length      = LO_RSDP_WINDOW_SIZE;
-               table_info->allocation  = ACPI_MEM_MAPPED;
-               table_info->base_pointer = table_ptr;
-
-               return (AE_OK);
-       }
-
-       /* This mapping is no longer needed */
-
-       acpi_os_unmap_memory (table_ptr, LO_RSDP_WINDOW_SIZE);
-
-
-       /*
-        * 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);
-       }
-
-       if (NULL != (mem_rover = acpi_tb_scan_memory_for_rsdp (table_ptr,
-                         HI_RSDP_WINDOW_SIZE)))
-       {
-               /* Found it, return pointer and don't delete the mapping */
-
-               table_info->pointer     = (ACPI_TABLE_HEADER *) mem_rover;
-               table_info->length      = HI_RSDP_WINDOW_SIZE;
-               table_info->allocation  = ACPI_MEM_MAPPED;
-               table_info->base_pointer = table_ptr;
-
-               return (AE_OK);
-       }
-
-       /* This mapping is no longer needed */
-
-       acpi_os_unmap_memory (table_ptr, HI_RSDP_WINDOW_SIZE);
-
-
-       /* RSDP signature was not found */
-
-       return (AE_NOT_FOUND);
-}
-
-
-/******************************************************************************
- *
- * FUNCTION:    Acpi_tb_get_table_facs
- *
- * PARAMETERS:  *Buffer_ptr             - If Buffer_ptr is valid, read data from
- *                                          buffer rather than searching memory
- *              *Table_info             - Where the table info is returned
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Returns a pointer to the FACS as defined in FACP.  This
- *              function assumes the global variable FACP has been
- *              correctly initialized.  The value of FACP->Firmware_ctrl
- *              into a far pointer which is returned.
- *
- *****************************************************************************/
-
-ACPI_STATUS
-acpi_tb_get_table_facs (
-       ACPI_TABLE_HEADER       *buffer_ptr,
-       ACPI_TABLE_DESC         *table_info)
-{
-       void                    *table_ptr = NULL;
-       u32                     size;
-       u8                      allocation;
-       ACPI_STATUS             status = AE_OK;
-
-
-       /* Must have a valid FACP pointer */
-
-       if (!acpi_gbl_FACP) {
-               return (AE_NO_ACPI_TABLES);
-       }
-
-       size = sizeof (FIRMWARE_ACPI_CONTROL_STRUCTURE);
-       if (buffer_ptr) {
-               /*
-                * Getting table from a file -- allocate a buffer and
-                * read the table.
-                */
-               table_ptr = acpi_cm_allocate (size);
-               if(!table_ptr) {
-                       return (AE_NO_MEMORY);
-               }
-
-               MEMCPY (table_ptr, buffer_ptr, size);
-
-               /* Save allocation type */
-
-               allocation = ACPI_MEM_ALLOCATED;
-       }
-
-       else {
-               /* Just map the physical memory to our address space */
-
-               status = acpi_tb_map_acpi_table ((void *) acpi_gbl_FACP->firmware_ctrl,
-                                  &size, &table_ptr);
-               if (ACPI_FAILURE(status)) {
-                       return (status);
-               }
-
-               /* Save allocation type */
-
-               allocation = ACPI_MEM_MAPPED;
-       }
-
-
-       /* Return values */
-
-       table_info->pointer     = table_ptr;
-       table_info->length      = size;
-       table_info->allocation  = allocation;
-       table_info->base_pointer = table_ptr;
-
-       return (status);
-}
-
index 2a6b7da4b78d31496ceddb476a0e53411537f7b3..baae6fb4c8c4d3d6a16cf8157cbe3e9fef471637 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: tbutils - Table manipulation utilities
- *              $Revision: 26 $
+ *              $Revision: 31 $
  *
  *****************************************************************************/
 
@@ -107,7 +107,9 @@ acpi_tb_system_table_pointer (
 
        /* Check for a pointer within the DSDT */
 
-       if (IS_IN_ACPI_TABLE (where, acpi_gbl_DSDT)) {
+       if ((acpi_gbl_DSDT) &&
+               (IS_IN_ACPI_TABLE (where, acpi_gbl_DSDT)))
+       {
                return (TRUE);
        }
 
@@ -186,7 +188,7 @@ acpi_tb_validate_table_header (
 
        MOVE_UNALIGNED32_TO_32 (&signature, &table_header->signature);
        if (!acpi_cm_valid_acpi_name (signature)) {
-               REPORT_WARNING ("Invalid table signature found");
+               REPORT_WARNING (("Invalid table signature found\n"));
                return (AE_BAD_SIGNATURE);
        }
 
@@ -194,7 +196,7 @@ acpi_tb_validate_table_header (
        /* Validate the table length */
 
        if (table_header->length < sizeof (ACPI_TABLE_HEADER)) {
-               REPORT_WARNING ("Invalid table header length found");
+               REPORT_WARNING (("Invalid table header length found\n"));
                return (AE_BAD_HEADER);
        }
 
@@ -220,7 +222,7 @@ acpi_tb_validate_table_header (
 
 ACPI_STATUS
 acpi_tb_map_acpi_table (
-       void                    *physical_address,
+       ACPI_PHYSICAL_ADDRESS   physical_address,
        u32                     *size,
        void                    **logical_address)
 {
@@ -294,18 +296,20 @@ ACPI_STATUS
 acpi_tb_verify_table_checksum (
        ACPI_TABLE_HEADER       *table_header)
 {
-       u8                      check_sum;
+       u8                      checksum;
        ACPI_STATUS             status = AE_OK;
 
 
        /* Compute the checksum on the table */
 
-       check_sum = acpi_tb_checksum (table_header, table_header->length);
+       checksum = acpi_tb_checksum (table_header, table_header->length);
 
        /* Return the appropriate exception */
 
-       if (check_sum) {
-               REPORT_ERROR ("Invalid ACPI table checksum");
+       if (checksum) {
+               REPORT_WARNING (("Invalid checksum (%X) in table %4.4s\n",
+                       checksum, &table_header->signature));
+
                status = AE_BAD_CHECKSUM;
        }
 
index e1946e5729ea91124965388c5f2a02032272aafd..ee9eba62a02ecc7d94cbc13d1d65faa6e36cc18b 100644 (file)
@@ -2,7 +2,7 @@
  *
  * Module Name: tbxface - Public interfaces to the ACPI subsystem
  *                         ACPI table oriented interfaces
- *              $Revision: 24 $
+ *              $Revision: 32 $
  *
  *****************************************************************************/
 
 
 /*******************************************************************************
  *
- * FUNCTION:    Acpi_load_firmware_tables
+ * FUNCTION:    Acpi_load_tables
  *
  * PARAMETERS:  None
  *
  * RETURN:      Status
  *
- * DESCRIPTION: This function is called to load the ACPI tables from BIOS
+ * DESCRIPTION: This function is called to load the ACPI tables from the
+ *              provided RSDT
  *
  ******************************************************************************/
 
 ACPI_STATUS
-acpi_load_firmware_tables (void)
+acpi_load_tables (
+       ACPI_PHYSICAL_ADDRESS   rsdp_physical_address)
 {
        ACPI_STATUS             status = AE_OK;
        u32                     number_of_tables = 0;
 
 
-       /* Get the RSDT first */
+       /* Map and validate the RSDP */
 
-       status = acpi_tb_get_table_rsdt (&number_of_tables);
+       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)));
                goto error_exit;
        }
 
+       /* Get the RSDT via the RSDP */
+
+       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)));
+               goto error_exit;
+       }
 
        /* Now get the rest of the tables */
 
        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)));
                goto error_exit;
        }
 
 
+       /* Load the namespace from the tables */
+
+       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)));
+               goto error_exit;
+       }
+
        return (AE_OK);
 
 
 error_exit:
+       REPORT_ERROR (("Acpi_load_tables: Could not load tables: %s\n",
+                         acpi_cm_format_exception (status)));
+
        return (status);
 }
 
@@ -110,7 +136,7 @@ acpi_load_table (
 
        /* Copy the table to a local buffer */
 
-       status = acpi_tb_get_table (NULL, table_ptr, &table_info);
+       status = acpi_tb_get_table (0, table_ptr, &table_info);
        if (ACPI_FAILURE (status)) {
                return (status);
        }
@@ -119,9 +145,22 @@ acpi_load_table (
 
        status = acpi_tb_install_table (NULL, &table_info);
        if (ACPI_FAILURE (status)) {
-               /* TBD: [Errors] must free table allocated by Acpi_tb_get_table */
+               /* Free table allocated by Acpi_tb_get_table */
+
+               acpi_tb_delete_single_table (&table_info);
+               return (status);
+       }
+
+
+       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);
        }
 
+
        return (status);
 }
 
@@ -289,12 +328,11 @@ acpi_get_table (
 
 
        /*
-        *  Must have a buffer
+        *  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);
        }
@@ -331,7 +369,7 @@ acpi_get_table (
                /*
                 *  RSD PTR is the only "table" without a header
                 */
-               ret_buf_len = sizeof (ROOT_SYSTEM_DESCRIPTOR_POINTER);
+               ret_buf_len = sizeof (RSDP_DESCRIPTOR);
        }
        else {
                ret_buf_len = tbl_ptr->length;
diff --git a/drivers/acpi/tables/tbxfroot.c b/drivers/acpi/tables/tbxfroot.c
new file mode 100644 (file)
index 0000000..4c31f1c
--- /dev/null
@@ -0,0 +1,214 @@
+/******************************************************************************
+ *
+ * Module Name: tbxfroot - Find the root ACPI table (RSDT)
+ *              $Revision: 33 $
+ *
+ *****************************************************************************/
+
+/*
+ *  Copyright (C) 2000 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 "actables.h"
+
+
+#define _COMPONENT          TABLE_MANAGER
+        MODULE_NAME         ("tbxfroot")
+
+#define RSDP_CHECKSUM_LENGTH 20
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_find_root_pointer
+ *
+ * PARAMETERS:  **Rsdp_physical_address     - Where to place the RSDP address
+ *
+ * RETURN:      Status, Physical address of the RSDP
+ *
+ * DESCRIPTION: Find the RSDP
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_find_root_pointer (
+       ACPI_PHYSICAL_ADDRESS   *rsdp_physical_address)
+{
+       ACPI_TABLE_DESC         table_info;
+       ACPI_STATUS             status;
+
+
+       /* Get the RSDP */
+
+       status = acpi_tb_find_rsdp (&table_info);
+       if (ACPI_FAILURE (status)) {
+               return (AE_NO_ACPI_TABLES);
+       }
+
+       *rsdp_physical_address = table_info.physical_address;
+
+       return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_tb_scan_memory_for_rsdp
+ *
+ * PARAMETERS:  Start_address       - Starting pointer for search
+ *              Length              - Maximum length to search
+ *
+ * RETURN:      Pointer to the RSDP if found, otherwise NULL.
+ *
+ * DESCRIPTION: Search a block of memory for the RSDP signature
+ *
+ ******************************************************************************/
+
+u8 *
+acpi_tb_scan_memory_for_rsdp (
+       u8                      *start_address,
+       u32                     length)
+{
+       u32                     offset;
+       u8                      *mem_rover;
+
+
+       /* Search from given start addr for the requested length  */
+
+       for (offset = 0, mem_rover = start_address;
+                offset < length;
+                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)
+               {
+                       /* If so, we have found the RSDP */
+
+                       return (mem_rover);
+               }
+       }
+
+       /* Searched entire block, no RSDP was found */
+
+       return (NULL);
+}
+
+
+/*******************************************************************************
+ *
+ * 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
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Search lower 1_mbyte of memory for the root system descriptor
+ *              pointer structure.  If it is found, set *RSDP to point to it.
+ *
+ *              NOTE: The RSDP must be either in the first 1_k of the Extended
+ *              BIOS Data Area or between E0000 and FFFFF (ACPI 1.0 section
+ *              5.2.2; assertion #421).
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_tb_find_rsdp (
+       ACPI_TABLE_DESC         *table_info)
+{
+       u8                      *table_ptr;
+       u8                      *mem_rover;
+       UINT64                  phys_addr;
+       ACPI_STATUS             status = AE_OK;
+
+
+       /*
+        * Search memory for RSDP.  First map low physical memory.
+        */
+
+       status = acpi_os_map_memory (LO_RSDP_WINDOW_BASE, LO_RSDP_WINDOW_SIZE,
+                         (void **)&table_ptr);
+
+       if (ACPI_FAILURE (status)) {
+               return (status);
+       }
+
+       /*
+        * 1) Search EBDA (low memory) paragraphs
+        */
+
+       mem_rover = acpi_tb_scan_memory_for_rsdp (table_ptr, LO_RSDP_WINDOW_SIZE);
+
+       /* This mapping is no longer needed */
+
+       acpi_os_unmap_memory (table_ptr, LO_RSDP_WINDOW_SIZE);
+
+       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);
+
+       /* This mapping is no longer needed */
+
+       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);
+       }
+
+
+       /* RSDP signature was not found */
+
+       return (AE_NOT_FOUND);
+}
+
+
index 8550b8a840aa78750277eed9e0b341d8ec20f9aa..2157f15703cad456b42a9bb39436353a15664711 100644 (file)
@@ -4,96 +4,27 @@
 #
 
 O_TARGET := atm.o
-O_OBJS  := atmdev_init.o
-M_OBJS  :=
-
-include ../../.config
-
-ifeq ($(CONFIG_ATM_ENI),y)
-O_OBJS += eni.o
-NEED_SUNI_LX = suni.o
-else
-  ifeq ($(CONFIG_ATM_ENI),m)
-  M_OBJS += eni.o
-  NEED_SUNI_MX = suni.o
-  endif
-endif
 
-ifeq ($(CONFIG_ATM_ZATM),y)
-O_OBJS += zatm.o
-OX_OBJS += uPD98402.o
-else
-  ifeq ($(CONFIG_ATM_ZATM),m)
-  M_OBJS += zatm.o
-  MX_OBJS += uPD98402.o
-  endif
-endif
+export-objs := uPD98402.o suni.o idt77105.o
 
-ifeq ($(CONFIG_ATM_NICSTAR),y)
-O_OBJS += nicstar.o
-  ifeq ($(CONFIG_ATM_NICSTAR_USE_SUNI),y)
-  NEED_SUNI_LX = suni.o
-  endif
-  ifeq ($(CONFIG_ATM_NICSTAR_USE_IDT77105),y)
-  NEED_IDT77105_LX = idt77105.o
-  endif
-else
-  ifeq ($(CONFIG_ATM_NICSTAR),m)
-  M_OBJS += nicstar.o
-    ifeq ($(CONFIG_ATM_NICSTAR_USE_SUNI),y)
-    NEED_SUNI_MX = suni.o
-    endif
-    ifeq ($(CONFIG_ATM_NICSTAR_USE_IDT77105),y)
-    NEED_IDT77105_MX = idt77105.o
-    endif
-  endif
-endif
+obj-y := atmdev_init.o
 
-ifeq ($(CONFIG_ATM_HORIZON),y)
-O_OBJS += horizon.o
-else
-  ifeq ($(CONFIG_ATM_HORIZON),m)
-  M_OBJS += horizon.o
-  endif
-endif
+obj-$(CONFIG_ATM_ENI) += eni.o suni.o
+obj-$(CONFIG_ATM_ZATM) += zatm.o uPD98402.o
+obj-$(CONFIG_ATM_NICSTAR) += nicstar.o
 
-ifeq ($(CONFIG_ATM_AMBASSADOR),y)
-O_OBJS += ambassador.o
-else
-  ifeq ($(CONFIG_ATM_AMBASSADOR),m)
-  M_OBJS += ambassador.o
-  endif
+ifeq ($(CONFIG_ATM_NICSTAR_USE_SUNI),y)
+  obj-$(CONFIG_ATM_NICSTAR) += suni.o
 endif
 
-ifeq ($(CONFIG_ATM_TCP),y)
-O_OBJS += atmtcp.o
-else
-  ifeq ($(CONFIG_ATM_TCP),m)
-  M_OBJS += atmtcp.o
-  endif
-endif
-
-ifeq ($(CONFIG_ATM_IA),y)
-O_OBJS += iphase.o
-NEED_SUNI_LX = suni.o
-else
-ifeq ($(CONFIG_ATM_IA),m)
-  M_OBJS += iphase.o
-  NEED_SUNI_MX = suni.o
-  endif
-endif
-
-ifeq ($(NEED_SUNI_LX),)
-  MX_OBJS += $(NEED_SUNI_MX)
-else
-  OX_OBJS += $(NEED_SUNI_LX)
+ifeq ($(CONFIG_ATM_NICSTAR_USE_IDT77105),y)
+  obj-$(CONFIG_ATM_NICSTAR) += idt77105.o
 endif
 
-ifeq ($(NEED_IDT77105_LX),)
-  MX_OBJS += $(NEED_IDT77105_MX)
-else
-  OX_OBJS += $(NEED_IDT77105_LX)
-endif
+obj-$(CONFIG_ATM_HORIZON) += horizon.o
+obj-$(CONFIG_ATM_AMBASSADOR) += ambassador.o
+obj-$(CONFIG_ATM_TCP) += atmtcp.o
+obj-$(CONFIG_ATM_IA) += iphase.o suni.o
 
 ifeq ($(CONFIG_ATM_FORE200E_PCA),y)
   FORE200E_FW_OBJS += fore200e_pca_fw.o
@@ -114,13 +45,8 @@ ifeq ($(CONFIG_ATM_FORE200E_SBA),y)
     CONFIG_ATM_FORE200E_SBA_FW := sba200e_ecd.bin2
   endif
 endif
-ifeq ($(CONFIG_ATM_FORE200E),y)
-  O_OBJS += fore200e.o $(FORE200E_FW_OBJS)
-else
-  ifeq ($(CONFIG_ATM_FORE200E),m)
-    M_OBJS += fore_200e.o
-  endif
-endif
+
+obj-$(CONFIG_ATM_FORE200E) += fore200e.o $(FORE200E_FW_OBJS)
 
 EXTRA_CFLAGS=-g
 
index 23fe035847cce6164784e83e089dc69b8ccd1d6d..7cbdf229166645d38f88b970b29539ec006a46d7 100644 (file)
   3.11 Jun 12, 2000 - Jens Axboe <axboe@suse.de>
   -- Fix bug in getting rpc phase 2 region info.
   -- Reinstate "correct" CDROMPLAYTRKIND
+
+   3.12 Oct 18, 2000 - Jens Axboe <axboe@suse.de>
+  -- Use quiet bit on packet commands not known to work
+
 -------------------------------------------------------------------------*/
 
-#define REVISION "Revision: 3.11"
-#define VERSION "Id: cdrom.c 3.11 2000/06/12"
+#define REVISION "Revision: 3.12"
+#define VERSION "Id: cdrom.c 3.12 2000/10/18"
 
 /* I use an error-log mask to give fine grain control over the type of
    messages dumped to the system logs.  The available masks include: */
@@ -701,6 +704,21 @@ static int cdrom_read_mech_status(struct cdrom_device_info *cdi,
        struct cdrom_device_ops *cdo = cdi->ops;
        int length;
 
+       /*
+        * Sanyo changer isn't spec compliant (doesn't use regular change
+        * LOAD_UNLOAD command, and it doesn't implement the mech status
+        * command below
+        */
+       if (cdi->sanyo_slot) {
+               buf->hdr.nslots = 3;
+               buf->hdr.curslot = cdi->sanyo_slot == 3 ? 0 : cdi->sanyo_slot;
+               for (length = 0; length < 3; length++) {
+                       buf->slots[length].disc_present = 1;
+                       buf->slots[length].change = 0;
+               }
+               return 0;
+       }
+
        length = sizeof(struct cdrom_mechstat_header) +
                 cdi->capacity * sizeof(struct cdrom_slot);
 
@@ -767,9 +785,10 @@ static int cdrom_load_unload(struct cdrom_device_info *cdi, int slot)
        /* The Sanyo 3 CD changer uses byte 7 of the 
        GPCMD_TEST_UNIT_READY to command to switch CDs instead of
        using the GPCMD_LOAD_UNLOAD opcode. */
-       if (cdi->sanyo_slot && slot) {
+       if (cdi->sanyo_slot && -1 < slot) {
                cgc.cmd[0] = GPCMD_TEST_UNIT_READY;
                cgc.cmd[7] = slot;
+               cgc.cmd[4] = cgc.cmd[8] = 0;
                cdi->sanyo_slot = slot ? slot : 3;
        }
 
@@ -953,6 +972,7 @@ void init_cdrom_command(struct cdrom_generic_command *cgc, void *buf, int len,
        cgc->buffer = (char *) buf;
        cgc->buflen = len;
        cgc->data_direction = type;
+       cgc->timeout = 5*HZ;
 }
 
 /* DVD handling */
@@ -1860,6 +1880,48 @@ static int cdrom_switch_blocksize(struct cdrom_device_info *cdi, int size)
        return cdo->generic_packet(cdi, &cgc);
 }
 
+static int cdrom_do_cmd(struct cdrom_device_info *cdi,
+                       struct cdrom_generic_command *cgc)
+{
+       struct request_sense *usense, sense;
+       unsigned char *ubuf;
+       int ret;
+
+       if (cgc->data_direction == CGC_DATA_UNKNOWN)
+               return -EINVAL;
+
+       if (cgc->buflen < 0 || cgc->buflen >= 131072)
+               return -EINVAL;
+
+       if ((ubuf = cgc->buffer)) {
+               cgc->buffer = kmalloc(cgc->buflen, GFP_KERNEL);
+               if (cgc->buffer == NULL)
+                       return -ENOMEM;
+       }
+
+       usense = cgc->sense;
+       cgc->sense = &sense;
+       if (usense && !access_ok(VERIFY_WRITE, usense, sizeof(*usense)))
+               return -EFAULT;
+
+       if (cgc->data_direction == CGC_DATA_READ) {
+               if (!access_ok(VERIFY_READ, ubuf, cgc->buflen))
+                       return -EFAULT;
+       } else if (cgc->data_direction == CGC_DATA_WRITE) {
+               if (copy_from_user(cgc->buffer, ubuf, cgc->buflen)) {
+                       kfree(cgc->buffer);
+                       return -EFAULT;
+               }
+       }
+
+       ret = cdi->ops->generic_packet(cdi, cgc);
+       __copy_to_user(usense, cgc->sense, sizeof(*usense));
+       if (!ret && cgc->data_direction == CGC_DATA_READ)
+               __copy_to_user(ubuf, cgc->buffer, cgc->buflen);
+       kfree(cgc->buffer);
+       return ret;
+}
+
 static int mmc_ioctl(struct cdrom_device_info *cdi, unsigned int cmd,
                     unsigned long arg)
 {              
@@ -1923,7 +1985,7 @@ static int mmc_ioctl(struct cdrom_device_info *cdi, unsigned int cmd,
                }
        case CDROMREADAUDIO: {
                struct cdrom_read_audio ra;
-               int lba, frames;
+               int lba;
 
                IOCTL_IN(arg, struct cdrom_read_audio, ra);
 
@@ -1937,14 +1999,10 @@ static int mmc_ioctl(struct cdrom_device_info *cdi, unsigned int cmd,
                        return -EINVAL;
 
                /* FIXME: we need upper bound checking, too!! */
-               if (lba < 0)
+               if (lba < 0 || ra.nframes <= 0)
                        return -EINVAL;
 
-               /* do max 8 frames at the time */
-               frames = ra.nframes > 8 ? 8 : ra.nframes;
-
-               if ((cgc.buffer = (char *) kmalloc(CD_FRAMESIZE_RAW * frames,
-                                                  GFP_KERNEL)) == NULL)
+               if ((cgc.buffer = (char *) kmalloc(CD_FRAMESIZE_RAW, GFP_KERNEL)) == NULL)
                        return -ENOMEM;
 
                if (!access_ok(VERIFY_WRITE, ra.buf, ra.nframes*CD_FRAMESIZE_RAW)) {
@@ -1953,13 +2011,12 @@ static int mmc_ioctl(struct cdrom_device_info *cdi, unsigned int cmd,
                }
                cgc.data_direction = CGC_DATA_READ;
                while (ra.nframes > 0) {
-                       ret = cdrom_read_block(cdi, &cgc, lba, frames, 1, CD_FRAMESIZE_RAW);
+                       ret = cdrom_read_block(cdi, &cgc, lba, 1, 1, CD_FRAMESIZE_RAW);
                        if (ret) break;
-                       __copy_to_user(ra.buf, cgc.buffer,
-                                      CD_FRAMESIZE_RAW * frames);
-                       ra.buf += (CD_FRAMESIZE_RAW * frames);
-                       ra.nframes -= frames;
-                       lba += frames;
+                       __copy_to_user(ra.buf, cgc.buffer, CD_FRAMESIZE_RAW);
+                       ra.buf += CD_FRAMESIZE_RAW;
+                       ra.nframes--;
+                       lba++;
                }
                kfree(cgc.buffer);
                return ret;
@@ -2051,7 +2108,7 @@ static int mmc_ioctl(struct cdrom_device_info *cdi, unsigned int cmd,
                cgc.buffer = mask;
                if ((ret = cdrom_mode_sense(cdi, &cgc, 
                                GPMODE_AUDIO_CTL_PAGE, 1)))
-                   return ret;
+                       return ret;
 
                buffer[offset+9] = volctrl.channel0 & mask[offset+9];
                buffer[offset+11] = volctrl.channel1 & mask[offset+11];
@@ -2117,52 +2174,11 @@ static int mmc_ioctl(struct cdrom_device_info *cdi, unsigned int cmd,
                }
 
        case CDROM_SEND_PACKET: {
-               __u8 *userbuf, copy = 0;
-               struct request_sense *sense;
                if (!CDROM_CAN(CDC_GENERIC_PACKET))
                        return -ENOSYS;
                cdinfo(CD_DO_IOCTL, "entering CDROM_SEND_PACKET\n"); 
                IOCTL_IN(arg, struct cdrom_generic_command, cgc);
-               copy = !!cgc.buflen;
-               userbuf = cgc.buffer;
-               cgc.buffer = NULL;
-               sense = cgc.sense;
-               if (userbuf != NULL && copy) {
-                       /* usually commands just copy data one way, i.e.
-                        * we send a buffer to the drive and the command
-                        * specifies whether the drive will read or
-                        * write to that buffer. usually the buffers
-                        * are very small, so we don't loose that much
-                        * by doing a redundant copy each time. */
-                       if (!access_ok(VERIFY_WRITE, userbuf, cgc.buflen)) {
-                               printk("can't get write perms\n");
-                               return -EFAULT;
-                       }
-                       if (!access_ok(VERIFY_READ, userbuf, cgc.buflen)) {
-                               printk("can't get read perms\n");
-                               return -EFAULT;
-                       }
-               }
-               /* reasonable limits */
-               if (cgc.buflen < 0 || cgc.buflen > 131072) {
-                       printk("invalid size given\n");
-                       return -EINVAL;
-               }
-               if (copy) {
-                       cgc.buffer = kmalloc(cgc.buflen, GFP_KERNEL);
-                       if (cgc.buffer == NULL)
-                               return -ENOMEM;
-                       __copy_from_user(cgc.buffer, userbuf, cgc.buflen);
-               }
-               ret = cdo->generic_packet(cdi, &cgc);
-               if (copy && !ret)
-                       __copy_to_user(userbuf, cgc.buffer, cgc.buflen);
-               /* copy back sense data */
-               if (sense != NULL)
-                       if (copy_to_user(sense, cgc.sense, sizeof(struct request_sense)))
-                               ret = -EFAULT;
-               kfree(cgc.buffer);
-               return ret;
+               return cdrom_do_cmd(cdi, &cgc);
                }
        case CDROM_NEXT_WRITABLE: {
                long next = 0;
@@ -2199,6 +2215,7 @@ int cdrom_get_track_info(kdev_t dev, __u16 track, __u8 type,
        cgc.cmd[4] = (track & 0xff00) >> 8;
        cgc.cmd[5] = track & 0xff;
        cgc.cmd[8] = 8;
+       cgc.quiet = 1;
 
        if ((ret = cdo->generic_packet(cdi, &cgc)))
                return ret;
@@ -2220,6 +2237,7 @@ int cdrom_get_disc_info(kdev_t dev, disc_information *di)
        init_cdrom_command(&cgc, di, sizeof(*di), CGC_DATA_READ);
        cgc.cmd[0] = GPCMD_READ_DISC_INFO;
        cgc.cmd[8] = cgc.buflen = 2;
+       cgc.quiet = 1;
 
        if ((ret = cdo->generic_packet(cdi, &cgc)))
                return ret;
@@ -2252,9 +2270,6 @@ int cdrom_get_last_written(kdev_t dev, long *last_written)
        if (!CDROM_CAN(CDC_GENERIC_PACKET))
                goto use_toc;
 
-       if (!CDROM_CAN(CDC_CD_R | CDC_CD_RW | CDC_DVD_R | CDC_DVD_RAM))
-               goto use_toc;
-
        if ((ret = cdrom_get_disc_info(dev, &di)))
                goto use_toc;
 
@@ -2556,12 +2571,13 @@ ctl_table cdrom_cdrom_table[] = {
        {0}
        };
 
+#ifdef CONFIG_PROC_FS
 /* Make sure that /proc/sys/dev is there */
 ctl_table cdrom_root_table[] = {
        {CTL_DEV, "dev", NULL, 0, 0555, cdrom_cdrom_table},
        {0}
        };
-
+#endif /* CONFIG_PROC_FS */
 static struct ctl_table_header *cdrom_sysctl_header;
 
 static void cdrom_sysctl_register(void)
@@ -2572,9 +2588,8 @@ static void cdrom_sysctl_register(void)
                return;
 
        cdrom_sysctl_header = register_sysctl_table(cdrom_root_table, 1);
-#ifdef CONFIG_PROC_FS
        cdrom_root_table->child->de->owner = THIS_MODULE;
-#endif /* CONFIG_PROC_FS */
+
        /* set the defaults */
        cdrom_sysctl_settings.autoclose = autoclose;
        cdrom_sysctl_settings.autoeject = autoeject;
index fd2da8725b62847da0f590c05c718235d68d7af0..de73c312dcd5c1155ea329a7378d1ad043ee0daa 100644 (file)
@@ -155,7 +155,7 @@ obj-$(CONFIG_QIC02_TAPE) += tpqic02.o
 subdir-$(CONFIG_FTAPE) += ftape
 subdir-$(CONFIG_DRM) += drm
 subdir-$(CONFIG_PCMCIA) += pcmcia
-subdir-$(CONFIG_agp) += agp
+subdir-$(CONFIG_AGP) += agp
 
 ifeq ($(CONFIG_FTAPE),y)
 obj-y       += ftape/ftape.o
index 995aa7d502921c96e46259c710e33c0f7edcad1d..6195289dc3fab0d9ec2c62d6082f45211b930334 100644 (file)
@@ -37,40 +37,50 @@ else
  endif
 endif
 
-gamma-objs := $(lib-objs) gamma_drv.o gamma_dma.o
-tdfx-objs  := $(lib-objs) tdfx_drv.o                tdfx_context.o
-r128-objs  := $(lib-objs) r128_drv.o  r128_dma.o    r128_context.o r128_bufs.o
-ffb-objs   := $(lib-objs) ffb_drv.o                 ffb_context.o
-mga-objs   := $(lib-objs) mga_drv.o   mga_dma.o     mga_context.o  mga_bufs.o \
-             mga_state.o
-i810-objs  := $(lib-objs) i810_drv.o  i810_dma.o    i810_context.o i810_bufs.o
+gamma-objs := gamma_drv.o gamma_dma.o
+tdfx-objs  := tdfx_drv.o                tdfx_context.o
+r128-objs  := r128_drv.o  r128_dma.o    r128_context.o r128_bufs.o
+ffb-objs   := ffb_drv.o                 ffb_context.o
+mga-objs   := mga_drv.o   mga_dma.o     mga_context.o  mga_bufs.o  mga_state.o
+i810-objs  := i810_drv.o  i810_dma.o    i810_context.o i810_bufs.o
 
 obj-$(CONFIG_DRM_GAMMA) += gamma.o
 obj-$(CONFIG_DRM_TDFX)  += tdfx.o
 obj-$(CONFIG_DRM_R128)  += r128.o
 obj-$(CONFIG_DRM_FFB)   += ffb.o
-
-ifneq ($CONFIG_AGP),)
 obj-$(CONFIG_DRM_MGA)   += mga.o
 obj-$(CONFIG_DRM_I810)  += i810.o
+
+
+# When linking into the kernel, link the library just once. 
+# If making modules, we include the library into each module
+
+ifdef MAKING_MODULES
+  lib = drmlib.a
+else
+  obj-y += drmlib.a
 endif
 
 include $(TOPDIR)/Rules.make
 
-gamma.o: $(gamma-objs)
-       $(LD) -r -o $@ $(gamma-objs)
+drmlib.a: $(lib-objs)
+       rm -f $@
+       $(AR) $(EXTRA_ARFLAGS) rcs $@ $(lib-objs)
+
+gamma.o: $(gamma-objs) $(lib)
+       $(LD) -r -o $@ $(gamma-objs) $(lib)
 
-tdfx.o: $(tdfx-objs)
-       $(LD) -r -o $@ $(tdfx-objs)
+tdfx.o: $(tdfx-objs) $(lib)
+       $(LD) -r -o $@ $(tdfx-objs) $(lib)
 
-mga.o: $(mga-objs)
-       $(LD) -r -o $@ $(mga-objs)
+mga.o: $(mga-objs) $(lib)
+       $(LD) -r -o $@ $(mga-objs) $(lib)
 
-i810.o: $(i810-objs)
-       $(LD) -r -o $@ $(i810-objs)
+i810.o: $(i810-objs) $(lib)
+       $(LD) -r -o $@ $(i810-objs) $(lib)
 
-r128.o: $(r128-objs)
-       $(LD) -r -o $@ $(r128-objs)
+r128.o: $(r128-objs) $(lib)
+       $(LD) -r -o $@ $(r128-objs) $(lib)
 
-ffb.o: $(ffb-objs)
-       $(LD) -r -o $@ $(ffb-objs)
+ffb.o: $(ffb-objs) $(lib)
+       $(LD) -r -o $@ $(ffb-objs) $(lib)
index 5726e788ede18bce8dfcb1ccfd789752b14db1cb..e76d51e48ba7bc4cff7f5f53922a9fd7ae6deffb 100644 (file)
 #      Linux.
 #
 
-#
-#  This isn't used inside the kernel, only for my private development
-#  version
-#
-ifndef TOPDIR
-TOPDIR= ..
-include $(TOPDIR)/MCONFIG
-endif
+O_TARGET := ftape.o
 
-SUB_DIRS     := 
-MOD_SUB_DIRS := $(SUB_DIRS)
-ALL_SUB_DIRS := $(SUB_DIRS) lowlevel zftape compressor
+subdir-$(CONFIG_FTAPE) += lowlevel
+subdir-$(CONFIG_ZFTAPE) += zftape
+subdir-$(CONFIG_ZFT_COMPRESSOR) += compressor
 
 ifeq ($(CONFIG_FTAPE),y)
-  O_TARGET := ftape.o
-  SUB_DIRS += lowlevel
-  O_OBJS   += lowlevel/ftape.o
-else
-  ifeq ($(CONFIG_FTAPE),m)
-  MOD_SUB_DIRS += lowlevel
-  endif
+  obj-y    += lowlevel/ftape.o
 endif
 
 ifeq ($(CONFIG_ZFTAPE),y)
-  SUB_DIRS += zftape
-  O_OBJS   += zftape/zftape.o
-else
-  ifeq ($(CONFIG_ZFTAPE),m)
-  MOD_SUB_DIRS += zftape
-  endif
+  obj-y   += zftape/zftape.o
 endif
 
 ifeq ($(CONFIG_ZFT_COMPRESSOR),y)
-  SUB_DIRS += compressor
-  O_OBJS   += compressor/zft-compressor.o
-else
-  ifeq ($(CONFIG_ZFT_COMPRESSOR),m)
-  MOD_SUB_DIRS += compressor
-  endif
+  obj-y += compressor/zft-compressor.o
 endif
 
 include $(TOPDIR)/Rules.make
index 50a7123ac7be538dd3856e7c05c0b9dbb1252a5d..46255f355282599870056caaf73de7867f67b44c 100644 (file)
 #      Linux.
 #
 
-#
-#  This isn't used inside the kernel, only for my private development
-#  version
-#
-ifndef TOPDIR
-TOPDIR=../..
-include $(TOPDIR)/MCONFIG
-endif
-
 O_TARGET := zft-compressor.o
-O_OBJS    = zftape-compress.o lzrw3.o
 
-M_OBJS    = $(O_TARGET)
+obj-y    = zftape-compress.o lzrw3.o
+
+obj-m    = $(O_TARGET)
 
 CFLAGS_lzrw3.o := -O6 -funroll-all-loops
 
index 36834e85e35e67ece02703e808b44e4fac8341c4..3c62c59395f3f0e1101e9922c1b49f7e5413c9b4 100644 (file)
 #      driver for Linux.
 #
 
-#
-#  This isn't used inside the kernel, only for my private development
-#  version
-#
-ifndef TOPDIR
-TOPDIR=../..
-include $(TOPDIR)/MCONFIG
-endif
-
 O_TARGET := ftape.o
-O_OBJS    = ftape-init.o fdc-io.o fdc-isr.o \
+
+export-objs := ftape_syms.o
+
+obj-y     = ftape-init.o fdc-io.o fdc-isr.o \
            ftape-bsm.o ftape-ctl.o ftape-read.o ftape-rw.o \
            ftape-write.o ftape-io.o ftape-calibr.o ftape-ecc.o fc-10.o \
-           ftape-buffer.o ftape-format.o
+           ftape-buffer.o ftape-format.o ftape_syms.o
 
-ifeq ($(CONFIG_FTAPE),y)
-O_OBJS   += ftape-setup.o
-endif
+obj-$(CONFIG_FTAPE) += ftape-setup.o
 
 ifndef CONFIG_FT_NO_TRACE_AT_ALL
-O_OBJS   += ftape-tracing.o
+obj-y   += ftape-tracing.o
 endif
 
 ifeq ($(CONFIG_PROC_FS),y)
 ifeq ($(CONFIG_FT_PROC_FS),y)
-O_OBJS += ftape-proc.o
+obj-y += ftape-proc.o
 endif
 endif
 
-OX_OBJS = ftape_syms.o
-
-M_OBJS  = $(O_TARGET)
+obj-m  = $(O_TARGET)
 
 include $(TOPDIR)/Rules.make
 
index f0cb73a96f270f0d1ead0b66e2bffac1064840eb..bc73998f9fd11cacb076b6f673209e3528070f58 100644 (file)
 #      ftape
 #
 
-#
-#  This isn't used inside the kernel, only for my private development
-#  version
-#
-ifndef TOPDIR
-TOPDIR=../..
-include $(TOPDIR)/MCONFIG
-endif
-
-SUB_DIRS     := 
-MOD_SUB_DIRS := $(SUB_DIRS)
-ALL_SUB_DIRS := $(SUB_DIRS)
 
 # ZFT_OBSOLETE - enable the MTIOC_ZFTAPE_GETBLKSZ ioctl. You should
 #                leave this enabled for compatibility with taper.
@@ -42,13 +30,14 @@ ALL_SUB_DIRS := $(SUB_DIRS)
 EXTRA_CFLAGS := -DZFT_OBSOLETE
 
 O_TARGET := zftape.o
-O_OBJS   := zftape-rw.o zftape-ctl.o zftape-read.o \
-           zftape-write.o zftape-vtbl.o zftape-eof.o \
-           zftape-init.o zftape-buffers.o
 
-OX_OBJS  += zftape_syms.o
+export-objs := zftape_syms.o
+
+obj-y    := zftape-rw.o zftape-ctl.o zftape-read.o \
+           zftape-write.o zftape-vtbl.o zftape-eof.o \
+           zftape-init.o zftape-buffers.o zftape_syms.o
 
-M_OBJS   := $(O_TARGET)
+obj-m    := $(O_TARGET)
 
 include $(TOPDIR)/Rules.make
 
index e8eadc870e806c7045a03beed1551e192df4a907..5c4a5cd7b9c68f567cd79b67aad79bc41673998a 100644 (file)
@@ -2,18 +2,7 @@
 # Makefile for the joystick drivers.
 #
 
-# Subdirs.
-
-SUB_DIRS       :=
-MOD_SUB_DIRS   := $(SUB_DIRS)
-MOD_IN_SUB_DIRS        := $(SUB_DIRS)
-ALL_SUB_DIRS   := $(SUB_DIRS)
-
-# The target object and module list name.
-
 O_TARGET       := js.o
-M_OBJS         :=
-O_OBJS         :=
 
 # Objects that export symbols.
 
@@ -70,18 +59,6 @@ obj-$(CONFIG_INPUT_TURBOGRAFX)       += turbografx.o
 
 obj-$(CONFIG_INPUT_AMIJOY)     += amijoy.o
 
-# Files that are both resident and modular: remove from modular.
-
-obj-m          := $(filter-out $(obj-y), $(obj-m))
-int-m          := $(filter-out $(int-y), $(int-m))
-
-# Translate to Rules.make lists.
-
-O_OBJS         := $(sort $(filter-out $(export-objs), $(obj-y)))
-OX_OBJS                := $(sort $(filter     $(export-objs), $(obj-y)))
-M_OBJS         := $(sort $(filter-out $(export-objs), $(obj-m)))
-MX_OBJS                := $(sort $(filter     $(export-objs), $(obj-m)))
-
 # The global Rules.make.
 
 include $(TOPDIR)/Rules.make
index bd636f7692d0830d59f9ebadbb942a73aac94cce..64021781ab10306df2122b5bef579236359e1178 100644 (file)
@@ -4,41 +4,17 @@
 #
 
 L_TARGET := fc4.a
-M_OBJS   :=
 
-ifeq ($(CONFIG_FC4),y)
-  FC4 = fc.o
-  ifeq ($(CONFIG_MODULES),y)
-    O_TARGET := fc_n_syms.o
-    O_OBJS   := fc.o
-    OX_OBJS  := fc_syms.o
-    FC4      := $(O_TARGET)
-  endif
-  L_OBJS += $(FC4)
-else
-  ifeq ($(CONFIG_FC4),m)
-    MIX_OBJS += fc_syms.o
-    M_OBJS += fc4.o
-  endif
-endif
+export-objs := fc_syms.o
 
-ifeq ($(CONFIG_FC4_SOC),y)
-L_OBJS += soc.o
-else
-  ifeq ($(CONFIG_FC4_SOC),m)
-  M_OBJS += soc.o
-  endif
-endif
+list-multi := fc4.o
+fc4-objs := fc.o fc_syms.o
 
-ifeq ($(CONFIG_FC4_SOCAL),y)
-L_OBJS += socal.o
-else
-  ifeq ($(CONFIG_FC4_SOCAL),m)
-  M_OBJS += socal.o
-  endif
-endif
+obj-$(CONFIG_FC4) += fc4.o
+obj-$(CONFIG_FC4_SOC) += soc.o
+obj-$(CONFIG_FC4_SOCAL) += socal.o
 
-include $(TOPDIR)/Rules.make
+fc4.o: $(fc4-objs)
+       $(LD) -r -o $@ $(fc4-objs)
 
-fc4.o: $(MIX_OBJS) fc.o
-       $(LD) $(LD_RFLAG) -r -o $@ $(MIX_OBJS) fc.o
+include $(TOPDIR)/Rules.make
index ab140ee2a6208adf9690fd5598a8b1d9f35c03ac..d25ed14f36e2b2811f8075bcd953e4b35d7cd05e 100644 (file)
@@ -18,10 +18,5 @@ obj-$(CONFIG_I2C_ELEKTOR)    += i2c-elektor.o
 # This is needed for automatic patch generation: sensors code starts here
 # This is needed for automatic patch generation: sensors code ends here
 
-O_OBJS         := $(filter-out $(export-objs), $(obj-y))
-OX_OBJS                := $(filter     $(export-objs), $(obj-y))
-M_OBJS         := $(sort $(filter-out  $(export-objs), $(obj-m)))
-MX_OBJS                := $(sort $(filter      $(export-objs), $(obj-m)))
-
 include $(TOPDIR)/Rules.make
 
index 3d16f1ff153d4847f42523d9cfcd20bc02d9a1dc..49fd7dcc3ad440dbc2364bf8cafb542babe6b182 100644 (file)
@@ -16,10 +16,5 @@ obj-$(CONFIG_I2O_LAN)        += i2o_lan.o
 obj-$(CONFIG_I2O_SCSI) += i2o_scsi.o
 obj-$(CONFIG_I2O_PROC) += i2o_proc.o
 
-O_OBJS         := $(filter-out $(export-objs), $(obj-y))
-OX_OBJS                := $(filter     $(export-objs), $(obj-y))
-M_OBJS         := $(sort $(filter-out  $(export-objs), $(obj-m)))
-MX_OBJS                := $(sort $(filter      $(export-objs), $(obj-m)))
-
 include $(TOPDIR)/Rules.make
 
index f00c68ed450c8a9a7e12aee194f5b898251e3537..4d7cb52409d422d0002d930f75f14a845b9226f7 100644 (file)
  * 4.58  May 1, 2000   - Clean up ACER50 stuff.
  *                     - Fix small problem with ide_cdrom_capacity
  *
+ * 4.59  Aug 11, 2000  - Fix changer problem in cdrom_read_toc, we weren't
+ *                       correctly sensing a disc change.
+ *                     - Rearranged some code
+ *
  *************************************************************************/
  
-#define IDECD_VERSION "4.58"
+#define IDECD_VERSION "4.59"
 
 #include <linux/config.h>
 #include <linux/module.h>
@@ -324,41 +328,50 @@ static void cdrom_saw_media_change (ide_drive_t *drive)
        info->nsectors_buffered = 0;
 }
 
+static int cdrom_log_sense(ide_drive_t *drive, struct packet_command *pc,
+                          struct request_sense *sense)
+{
+       int log = 0;
+
+       if (sense == NULL || pc->quiet)
+               return 0;
+
+       switch (sense->sense_key) {
+               case NO_SENSE: case RECOVERED_ERROR:
+                       break;
+               case NOT_READY:
+                       /*
+                        * don't care about tray state messages for
+                        * e.g. capacity commands or in-progress or
+                        * becoming ready
+                        */
+                       if (sense->asc == 0x3a || sense->asc == 0x04)
+                               break;
+                       log = 1;
+                       break;
+               case UNIT_ATTENTION:
+                       /*
+                        * Make good and sure we've seen this potential media
+                        * change. Some drives (i.e. Creative) fail to present
+                        * the correct sense key in the error register.
+                        */
+                       cdrom_saw_media_change(drive);
+                       break;
+               default:
+                       log = 1;
+                       break;
+       }
+       return log;
+}
 
 static
 void cdrom_analyze_sense_data(ide_drive_t *drive,
                              struct packet_command *failed_command,
                              struct request_sense *sense)
 {
-       if (sense->sense_key == NOT_READY ||
-           sense->sense_key == UNIT_ATTENTION) {
-               /* Make good and sure we've seen this potential media change.
-                  Some drives (i.e. Creative) fail to present the correct
-                  sense key in the error register. */
-               cdrom_saw_media_change (drive);
-
-
-               /* Don't print not ready or unit attention errors for
-                  READ_SUBCHANNEL.  Workman (and probably other programs)
-                  uses this command to poll the drive, and we don't want
-                  to fill the syslog with useless errors. */
-               if (failed_command &&
-                   (failed_command->c[0] == GPCMD_READ_SUBCHANNEL ||
-                    failed_command->c[0] == GPCMD_TEST_UNIT_READY))
-                       return;
-       }
 
-       if (sense->error_code == 0x70 && sense->sense_key  == 0x02
-        && ((sense->asc      == 0x3a && sense->ascq       == 0x00) ||
-            (sense->asc      == 0x04 && sense->ascq       == 0x01)))
-       {
-               /*
-                * Suppress the following errors:
-                * "Medium not present", "in progress of becoming ready",
-                * and "writing" to keep the noise level down to a dull roar.
-                */
+       if (!cdrom_log_sense(drive, failed_command, sense))
                return;
-       }
 
        /*
         * If a read toc is executed for a CD-R or CD-RW medium where
@@ -590,7 +603,7 @@ static int cdrom_decode_status (ide_startstop_t *startstop, ide_drive_t *drive,
                        cdrom_saw_media_change (drive);
                        /*printk("%s: media changed\n",drive->name);*/
                        return 0;
-               } else {
+               } else if (!pc->quiet) {
                        /* Otherwise, print an error. */
                        ide_dump_status(drive, "packet command error", stat);
                }
@@ -726,26 +739,27 @@ static ide_startstop_t cdrom_start_packet_command(ide_drive_t *drive,
    or there's data ready. */
 static ide_startstop_t cdrom_transfer_packet_command (ide_drive_t *drive,
                                           unsigned char *cmd_buf, int cmd_len,
-                                         ide_handler_t *handler)
+                                         ide_handler_t *handler,
+                                         unsigned int timeout)
 {
+       ide_startstop_t startstop;
+
        if (CDROM_CONFIG_FLAGS (drive)->drq_interrupt) {
                /* Here we should have been called after receiving an interrupt
                   from the device.  DRQ should how be set. */
                int stat_dum;
-               ide_startstop_t startstop;
 
                /* Check for errors. */
                if (cdrom_decode_status (&startstop, drive, DRQ_STAT, &stat_dum))
                        return startstop;
        } else {
-               ide_startstop_t startstop;
                /* Otherwise, we must wait for DRQ to get set. */
                if (ide_wait_stat (&startstop, drive, DRQ_STAT, BUSY_STAT, WAIT_READY))
                        return startstop;
        }
 
        /* Arm the interrupt handler. */
-       ide_set_handler (drive, handler, WAIT_CMD, cdrom_timer_expiry);
+       ide_set_handler (drive, handler, timeout, cdrom_timer_expiry);
 
        /* Send the command to the device. */
        atapi_output_bytes (drive, cmd_buf, cmd_len);
@@ -1090,7 +1104,7 @@ static ide_startstop_t cdrom_start_read_continuation (ide_drive_t *drive)
 
        /* Send the command to the drive and return. */
        return cdrom_transfer_packet_command(drive, pc.c, sizeof(pc.c),
-                                            &cdrom_read_intr);
+                                            &cdrom_read_intr, WAIT_CMD);
 }
 
 
@@ -1111,7 +1125,13 @@ static ide_startstop_t cdrom_seek_intr (ide_drive_t *drive)
 
        if (retry && jiffies - info->start_seek > IDECD_SEEK_TIMER) {
                if (--retry == 0) {
+                       /*
+                        * this condition is far too common, to bother
+                        * users about it
+                        */
+#if 0
                        printk("%s: disabled DSC seek overlap\n", drive->name);
+#endif
                        drive->dsc_overlap = 0;
                }
        }
@@ -1133,7 +1153,7 @@ static ide_startstop_t cdrom_start_seek_continuation (ide_drive_t *drive)
        memset (&pc.c, 0, sizeof (pc.c));
        pc.c[0] = GPCMD_SEEK;
        put_unaligned(cpu_to_be32(frame), (unsigned int *) &pc.c[2]);
-       return cdrom_transfer_packet_command (drive, pc.c, sizeof (pc.c), &cdrom_seek_intr);
+       return cdrom_transfer_packet_command(drive, pc.c, sizeof(pc.c), &cdrom_seek_intr, WAIT_CMD);
 }
 
 static ide_startstop_t cdrom_start_seek (ide_drive_t *drive, unsigned int block)
@@ -1308,9 +1328,12 @@ static ide_startstop_t cdrom_do_pc_continuation (ide_drive_t *drive)
        struct request *rq = HWGROUP(drive)->rq;
        struct packet_command *pc = (struct packet_command *)rq->buffer;
 
+       if (!pc->timeout)
+               pc->timeout = WAIT_CMD;
+
        /* Send the command to the drive and return. */
-       return cdrom_transfer_packet_command (drive, pc->c,
-                                      sizeof (pc->c), &cdrom_pc_intr);
+       return cdrom_transfer_packet_command(drive, pc->c, sizeof(pc->c),
+                                            &cdrom_pc_intr, pc->timeout);
 }
 
 
@@ -1335,8 +1358,12 @@ static ide_startstop_t cdrom_do_packet_command (ide_drive_t *drive)
 static
 void cdrom_sleep (int time)
 {
-       current->state = TASK_INTERRUPTIBLE;
-       schedule_timeout(time);
+       int sleep = time;
+
+       do {
+               set_current_state(TASK_INTERRUPTIBLE);
+               sleep = schedule_timeout(sleep);
+       } while (sleep);
 }
 
 static
@@ -1372,7 +1399,7 @@ int cdrom_queue_packet_command(ide_drive_t *drive, struct packet_command *pc)
                                /* The drive is in the process of loading
                                   a disk.  Retry, but wait a little to give
                                   the drive time to complete the load. */
-                               cdrom_sleep (HZ);
+                               cdrom_sleep(2 * HZ);
                        } else {
                                /* Otherwise, don't retry. */
                                retries = 0;
@@ -1886,6 +1913,9 @@ static int ide_cdrom_packet(struct cdrom_device_info *cdi,
        struct packet_command pc;
        ide_drive_t *drive = (ide_drive_t*) cdi->handle;
 
+       if (cgc->timeout <= 0)
+               cgc->timeout = WAIT_CMD;
+
        /* here we queue the commands from the uniform CD-ROM
           layer. the packet must be complete, as we do not
           touch it at all. */
@@ -1893,14 +1923,10 @@ static int ide_cdrom_packet(struct cdrom_device_info *cdi,
        memcpy(pc.c, cgc->cmd, CDROM_PACKET_SIZE);
        pc.buffer = cgc->buffer;
        pc.buflen = cgc->buflen;
-       cgc->stat = cdrom_queue_packet_command(drive, &pc);
-
-       /*
-        * FIXME: copy sense, don't just assign pointer!!
-        */
-       cgc->sense = pc.sense;
-
-       return cgc->stat;
+       pc.quiet = cgc->quiet;
+       pc.timeout = cgc->timeout;
+       pc.sense = cgc->sense;
+       return cgc->stat = cdrom_queue_packet_command(drive, &pc);
 }
 
 static
@@ -1956,6 +1982,7 @@ int ide_cdrom_audio_ioctl (struct cdrom_device_info *cdi,
 {
        ide_drive_t *drive = (ide_drive_t*) cdi->handle;
        struct cdrom_info *info = drive->driver_data;
+       int stat;
 
        switch (cmd) {
        /*
@@ -1963,7 +1990,7 @@ int ide_cdrom_audio_ioctl (struct cdrom_device_info *cdi,
         * atapi doesn't support it
         */
        case CDROMPLAYTRKIND: {
-               int stat, lba_start, lba_end;
+               unsigned long lba_start, lba_end;
                struct cdrom_ti *ti = (struct cdrom_ti *)arg;
                struct atapi_toc_entry *first_toc, *last_toc;
 
@@ -1987,7 +2014,6 @@ int ide_cdrom_audio_ioctl (struct cdrom_device_info *cdi,
        }
 
        case CDROMREADTOCHDR: {
-               int stat;
                struct cdrom_tochdr *tochdr = (struct cdrom_tochdr *) arg;
                struct atapi_toc *toc;
 
@@ -2003,7 +2029,6 @@ int ide_cdrom_audio_ioctl (struct cdrom_device_info *cdi,
        }
 
        case CDROMREADTOCENTRY: {
-               int stat;
                struct cdrom_tocentry *tocentry = (struct cdrom_tocentry*) arg;
                struct atapi_toc_entry *toce;
 
index 1d901d3c7730af1267ff55834cb5c7247b365976..ee0a44a79dc471dfb6fa505502dd696fa0105f7f 100644 (file)
@@ -106,6 +106,7 @@ struct packet_command {
        int buflen;
        int stat;
        int quiet;
+       int timeout;
        struct request_sense *sense;
        unsigned char c[12];
 };
@@ -628,7 +629,9 @@ const struct {
          "Logical unit not ready - in progress [sic] of becoming ready" },
        { 0x020402, "Logical unit not ready - initializing command required" },
        { 0x020403, "Logical unit not ready - manual intervention required" },
-       { 0x020404, "In process of becoming ready - writing" },
+       { 0x020404, "Logical unit not ready - format in progress" },
+       { 0x020407, "Logical unit not ready - operation in progress" },
+       { 0x020408, "Logical unit not ready - long write in progress" },
        { 0x020600, "No reference position found (media may be upside down)" },
        { 0x023000, "Incompatible medium installed" },
        { 0x023a00, "Medium not present" },
@@ -678,7 +681,6 @@ const struct {
        { 0x04b600, "Media load mechanism failed" },
        { 0x051a00, "Parameter list length error" },
        { 0x052000, "Invalid command operation code" },
-       { 0x052c00, "Command sequence error" },
        { 0x052100, "Logical block address out of range" },
        { 0x052102, "Invalid address for write" },
        { 0x052400, "Invalid field in command packet" },
index ac8edfd755665070f0206d852490af533b5f2dd0..2e07f364ae42ebedb4052654d6421fc7ef7791f9 100644 (file)
@@ -8,71 +8,22 @@
 # Note 2! The CFLAGS definitions are now in the main makefile.
 #
 
-SUB_DIRS     :=
-MOD_SUB_DIRS := $(SUB_DIRS)
-ALL_SUB_DIRS := $(SUB_DIRS)
-
 L_TARGET := ieee1394.a
-L_OBJS   :=
-LX_OBJS  :=
-M_OBJS   :=
-MX_OBJS  :=
-MI_OBJS  :=
-MIX_OBJS :=
-O_OBJS   :=
-OX_OBJS  :=
-
-ifeq ($(CONFIG_IEEE1394),y)
-L_OBJS  += ieee1394_core.o ieee1394_transactions.o hosts.o highlevel.o csr.o guid.o
-LX_OBJS += ieee1394_syms.o
-else
-  ifeq ($(CONFIG_IEEE1394),m)
-  M_OBJS  += ieee1394.o
-  O_TARGET = ieee1394.o
-  O_OBJS  += ieee1394_core.o ieee1394_transactions.o hosts.o highlevel.o csr.o guid.o
-  OX_OBJS += ieee1394_syms.o
-  endif
-endif
-
-ifeq ($(CONFIG_IEEE1394_PCILYNX),y)
-L_OBJS += pcilynx.o
-else
-  ifeq ($(CONFIG_IEEE1394_PCILYNX),m)
-  M_OBJS += pcilynx.o
-  endif
-endif
-
-ifeq ($(CONFIG_IEEE1394_AIC5800),y)
-L_OBJS += aic5800.o
-else
-  ifeq ($(CONFIG_IEEE1394_AIC5800),m)
-  M_OBJS += aic5800.o
-  endif
-endif
 
-ifeq ($(CONFIG_IEEE1394_OHCI1394),y)
-LX_OBJS += ohci1394.o
-else
-  ifeq ($(CONFIG_IEEE1394_OHCI1394),m)
-  MX_OBJS += ohci1394.o
-  endif
-endif
+export-objs := ieee1394_syms.o
 
-ifeq ($(CONFIG_IEEE1394_VIDEO1394),y)
-L_OBJS += video1394.o
-else
-  ifeq ($(CONFIG_IEEE1394_VIDEO1394),m)
-  M_OBJS += video1394.o
-  endif
-endif
+list-multi := ieee1394.o
+ieee1394-objs := ieee1394_core.o ieee1394_transactions.o hosts.o \
+                highlevel.o csr.o guid.o ieee1394_syms.o
 
-ifeq ($(CONFIG_IEEE1394_RAWIO),y)
-L_OBJS += raw1394.o
-else
-  ifeq ($(CONFIG_IEEE1394_RAWIO),m)
-  M_OBJS += raw1394.o
-  endif
-endif
+obj-$(CONFIG_IEEE1394) += ieee1394.o
+obj-$(CONFIG_IEEE1394_PCILYNX) += pcilynx.o
+obj-$(CONFIG_IEEE1394_AIC5800) += aic5800.o
+obj-$(CONFIG_IEEE1394_OHCI1394) += ohci1394.o
+obj-$(CONFIG_IEEE1394_VIDEO1394) += video1394.o
+obj-$(CONFIG_IEEE1394_RAWIO) += raw1394.o
 
+ieee1394.o: $(ieee1394-objs)
+       $(LD) -r -o $@ $(ieee1394-objs)
 
 include $(TOPDIR)/Rules.make
index af6305cec567ea29a7a6ab7516fa92695bf95fed..4e60129dca0bdfc75cb8272ebe7fe405558d37f2 100644 (file)
@@ -2,18 +2,9 @@
 # Makefile for the input core drivers.
 #
 
-# Subdirs.
-
-SUB_DIRS       :=
-MOD_SUB_DIRS   := $(SUB_DIRS)
-MOD_IN_SUB_DIRS        := $(SUB_DIRS)
-ALL_SUB_DIRS   := $(SUB_DIRS)
-
 # The target object and module list name.
 
 O_TARGET       := inputdrv.o
-M_OBJS         :=
-O_OBJS         :=
 
 # Objects that export symbols.
 
@@ -34,18 +25,6 @@ obj-$(CONFIG_INPUT_MOUSEDEV) += mousedev.o
 obj-$(CONFIG_INPUT_JOYDEV)     += joydev.o
 obj-$(CONFIG_INPUT_EVDEV)      += evdev.o
 
-# Files that are both resident and modular: remove from modular.
-
-obj-m          := $(filter-out $(obj-y), $(obj-m))
-int-m          := $(filter-out $(int-y), $(int-m))
-
-# Translate to Rules.make lists.
-
-O_OBJS         := $(sort $(filter-out $(export-objs), $(obj-y)))
-OX_OBJS                := $(sort $(filter     $(export-objs), $(obj-y)))
-M_OBJS         := $(sort $(filter-out $(export-objs), $(obj-m)))
-MX_OBJS                := $(sort $(filter     $(export-objs), $(obj-m)))
-
 # The global Rules.make.
 
 include $(TOPDIR)/Rules.make
index f42516b12d176c4acc86f09cc8fc449b9d3f470e..680f6000d1f07a48d9f011496836544b706bad7b 100644 (file)
@@ -4,8 +4,9 @@
 if [ "$CONFIG_INET" != "n" ]; then
    bool '  Support synchronous PPP' CONFIG_ISDN_PPP
    if [ "$CONFIG_ISDN_PPP" != "n" ]; then
-      bool '    Use VJ-compression with synchronous PPP' CONFIG_ISDN_PPP_VJ
-      bool '    Support generic MP (RFC 1717)' CONFIG_ISDN_MPP
+      bool     '    Use VJ-compression with synchronous PPP' CONFIG_ISDN_PPP_VJ
+      bool     '    Support generic MP (RFC 1717)' CONFIG_ISDN_MPP
+      tristate '    Support BSD compression with sync PPP' CONFIG_ISDN_PPP_BSDCOMP
    fi
 fi
 bool '  Support audio via ISDN' CONFIG_ISDN_AUDIO
@@ -75,57 +76,54 @@ if [ "$CONFIG_ISDN_DRV_HISAX" != "n" ]; then
 fi
 endmenu
 
+### Active ISDN cards
+
 mainmenu_option next_comment
 comment 'Active ISDN cards'
+
 dep_tristate 'ICN 2B and 4B support' CONFIG_ISDN_DRV_ICN $CONFIG_ISDN
 dep_tristate 'PCBIT-D support' CONFIG_ISDN_DRV_PCBIT $CONFIG_ISDN
 if [ "$CONFIG_EXPERIMENTAL" != "n" ]; then
    dep_tristate 'Spellcaster support (EXPERIMENTAL)' CONFIG_ISDN_DRV_SC $CONFIG_ISDN
    dep_tristate 'IBM Active 2000 support (EXPERIMENTAL)' CONFIG_ISDN_DRV_ACT2000 $CONFIG_ISDN
 fi
+
 dep_tristate 'Eicon active card support' CONFIG_ISDN_DRV_EICON $CONFIG_ISDN
 if [ "$CONFIG_ISDN_DRV_EICON" != "n" ]; then
-   if [ "$CONFIG_ISDN_DRV_EICON_STANDALONE" != "y" ]; then
-      if [ "$CONFIG_PCI" = "y" ]; then
-         bool '    Eicon PCI DIVA Server BRI/PRI/4BRI support' CONFIG_ISDN_DRV_EICON_PCI
-      fi
-      bool '    Eicon S,SX,SCOM,Quadro,S2M support' CONFIG_ISDN_DRV_EICON_ISA
-   fi
-   if [ "$CONFIG_PCI" = "y" ]; then
-      bool '    build eicon driver type standalone' CONFIG_ISDN_DRV_EICON_STANDALONE
-   fi
-fi
-dep_tristate 'CAPI2.0 support' CONFIG_ISDN_CAPI $CONFIG_ISDN
-if [ "$CONFIG_EXPERIMENTAL" != "n" ]; then
-   bool 'CAPI2.0 Middleware support' CONFIG_ISDN_CAPI_MIDDLEWARE
-   if [ "$CONFIG_ISDN_CAPI_MIDDLEWARE" != "n" ]; then
-       bool 'CAPI2.0 filesystem support' CONFIG_ISDN_CAPIFS
+   tristate '  Old Eicon driver' CONFIG_ISDN_DRV_EICON_OLD
+   if [ "$CONFIG_ISDN_DRV_EICON_OLD" != "n" ]; then 
+      dep_bool  '    Eicon PCI DIVA Server BRI/PRI/4BRI support' CONFIG_ISDN_DRV_EICON_PCI $CONFIG_PCI
+      bool      '    Eicon S,SX,SCOM,Quadro,S2M support' CONFIG_ISDN_DRV_EICON_ISA
    fi
+   dep_tristate '  Build Eicon driver type standalone' CONFIG_ISDN_DRV_EICON_DIVAS
 fi
+
+# CAPI subsystem
+
+tristate     'CAPI2.0 support' CONFIG_ISDN_CAPI
 if [ "$CONFIG_ISDN_CAPI" != "n" ]; then
-   bool '  AVM B1 ISA support' CONFIG_ISDN_DRV_AVMB1_B1ISA
-   bool '  AVM B1 PCI support' CONFIG_ISDN_DRV_AVMB1_B1PCI
-   if [ "$CONFIG_ISDN_DRV_AVMB1_B1PCI" != "n" ]; then
-      if [ "$CONFIG_EXPERIMENTAL" != "n" ]; then
-         bool '  AVM B1 PCI V4 support' CONFIG_ISDN_DRV_AVMB1_B1PCIV4
-      fi
-   fi
-   bool '  AVM T1/T1-B ISA support' CONFIG_ISDN_DRV_AVMB1_T1ISA
-   bool '  AVM B1/M1/M2 PCMCIA support' CONFIG_ISDN_DRV_AVMB1_B1PCMCIA
-   bool '  AVM T1/T1-B PCI support' CONFIG_ISDN_DRV_AVMB1_T1PCI
-   if [ "$CONFIG_EXPERIMENTAL" != "n" ]; then
-      bool '  AVM C4 support' CONFIG_ISDN_DRV_AVMB1_C4
-   fi
-   bool '  Verbose reason code reporting (kernel size +=7K)' CONFIG_ISDN_DRV_AVMB1_VERBOSE_REASON
-fi
-if [ "$CONFIG_PROC_FS" != "n" ]; then
-   if [ "$CONFIG_MODULES" != "n" ]; then
-      bool 'Hypercope HYSDN cards (Champ, Ergo, Metro) support (module)' CONFIG_HYSDN
-   fi
+   dep_bool     '  CAPI2.0 Middleware support (EXPERIMENTAL)' CONFIG_ISDN_CAPI_MIDDLEWARE $CONFIG_EXPERIMENTAL
+   dep_tristate '  CAPI2.0 filesystem support' CONFIG_ISDN_CAPI_CAPIFS $CONFIG_ISDN_CAPI_MIDDLEWARE
+   dep_tristate '  CAPI2.0 /dev/capi support' CONFIG_ISDN_CAPI_CAPI20 $CONFIG_ISDN_CAPIFS
+   dep_tristate '  CAPI2.0 capidrv interface support' CONFIG_ISDN_CAPI_CAPIDRV $CONFIG_ISDN
+   bool         '  Verbose reason code reporting (kernel size +=7K)' CONFIG_ISDN_DRV_AVMB1_VERBOSE_REASON
 fi
-if [ "$CONFIG_HYSDN" != "n" ]; then
-   if [ "$CONFIG_ISDN_CAPI" != "n" ]; then
-      bool '  HYSDN CAPI 2.0 support' CONFIG_HYSDN_CAPI
-   fi 
+
+# CAPI drivers
+
+if [ "$CONFIG_ISDN_CAPI" != "n" ]; then
+   tristate     '  AVM B1 ISA support' CONFIG_ISDN_DRV_AVMB1_B1ISA
+   dep_tristate '  AVM B1 PCI support' CONFIG_ISDN_DRV_AVMB1_B1PCI $CONFIG_PCI
+   dep_mbool    '    AVM B1 PCI V4 support' CONFIG_ISDN_DRV_AVMB1_B1PCIV4 $CONFIG_ISDN_DRV_AVMB1_B1PCI
+   tristate     '  AVM T1/T1-B ISA support' CONFIG_ISDN_DRV_AVMB1_T1ISA
+   dep_tristate '  AVM B1/M1/M2 PCMCIA support' CONFIG_ISDN_DRV_AVMB1_B1PCMCIA $CONFIG_PCMCIA
+   dep_tristate '  AVM B1/M1/M2 PCMCIA cs module' CONFIG_ISDN_DRV_AVMB1_AVM_CS $CONFIG_ISDN_DRV_AVMB1_B1PCMCIA
+   dep_tristate '  AVM T1/T1-B PCI support' CONFIG_ISDN_DRV_AVMB1_T1PCI $CONFIG_PCI
+   dep_tristate '  AVM C4 support' CONFIG_ISDN_DRV_AVMB1_C4 $CONFIG_PCI
 fi
+
+# HYSDN
+
+dep_tristate '  Hypercope HYSDN cards (Champ, Ergo, Metro) support (module)' CONFIG_HYSDN m $CONFIG_PROC_FS
+dep_mbool    '    HYSDN CAPI 2.0 support' CONFIG_HYSDN_CAPI $CONFIG_HYSDN $CONFIG_ISDN_CAPI
 endmenu
index b1e43f48736b6b90544236d305a0870c98832b41..11ea08c2d55c21974dd98baa0b8a174f50d5813c 100644 (file)
-SUB_DIRS     :=
-MOD_SUB_DIRS :=
-ALL_SUB_DIRS := icn pcbit hisax avmb1 act2000 eicon divert hysdn
-
-L_OBJS :=
-LX_OBJS :=
-M_OBJS :=
-MX_OBJS :=
-O_OBJS :=
-OX_OBJS :=
-L_TARGET :=
-O_TARGET :=
-
-ifeq ($(CONFIG_ISDN),y)
-  L_TARGET := isdn.a
-  L_OBJS += isdn_net.o isdn_tty.o isdn_cards.o isdn_v110.o
-  LX_OBJS += isdn_common.o 
-  ifdef CONFIG_ISDN_PPP
-    L_OBJS += isdn_ppp.o
-  endif
-  ifdef CONFIG_ISDN_X25
-    L_OBJS += isdn_x25iface.o
-    L_OBJS += isdn_concap.o
-  endif
-  ifdef CONFIG_ISDN_AUDIO
-    L_OBJS += isdn_audio.o
-    ifdef CONFIG_ISDN_TTY_FAX
-      L_OBJS += isdn_ttyfax.o
-    endif
-  endif
-else
-  ifeq ($(CONFIG_ISDN),m)
-    M_OBJS += isdn.o
-    O_TARGET += isdn.o
-    O_OBJS += isdn_net.o isdn_tty.o isdn_v110.o
-    OX_OBJS += isdn_common.o
-    ifdef CONFIG_ISDN_PPP
-      O_OBJS += isdn_ppp.o
-      M_OBJS += isdn_bsdcomp.o
-    endif
-    ifdef CONFIG_ISDN_X25
-      O_OBJS += isdn_x25iface.o
-      O_OBJS += isdn_concap.o
-    endif  
-    ifdef CONFIG_ISDN_AUDIO
-      O_OBJS += isdn_audio.o
-      ifdef CONFIG_ISDN_TTY_FAX
-        O_OBJS += isdn_ttyfax.o
-      endif
-    endif
-  endif
-endif
-
-ifeq ($(CONFIG_ISDN_DIVERSION),y)
- ifeq ($(CONFIG_MODULES),y)
-    MOD_SUB_DIRS += divert
- endif
-endif
-
-ifeq ($(CONFIG_ISDN_DRV_HISAX),y)
-  L_OBJS += hisax/hisax.o
-  SUB_DIRS += hisax
-  MOD_SUB_DIRS += hisax
-else
-  ifeq ($(CONFIG_ISDN_DRV_HISAX),m)
-    MOD_SUB_DIRS += hisax
-  endif
-endif
-
-ifeq ($(CONFIG_ISDN_DRV_ICN),y)
-  L_OBJS += icn/icn_obj.o
-  SUB_DIRS += icn
-  MOD_SUB_DIRS += icn
-else
-  ifeq ($(CONFIG_ISDN_DRV_ICN),m)
-    MOD_SUB_DIRS += icn
-  endif
-endif
-
-ifeq ($(CONFIG_ISDN_DRV_PCBIT),y)
-  L_OBJS += pcbit/pcbit.o
-  SUB_DIRS += pcbit
-  MOD_SUB_DIRS += pcbit
-else
-  ifeq ($(CONFIG_ISDN_DRV_PCBIT),m)
-    MOD_SUB_DIRS += pcbit
-  endif
-endif
-
-ifeq ($(CONFIG_ISDN_DRV_SC),y)
-  L_OBJS += sc/sc.o
-  SUB_DIRS += sc
-  MOD_SUB_DIRS += sc
-else
-  ifeq ($(CONFIG_ISDN_DRV_SC),m)
-    MOD_SUB_DIRS += sc
-  endif
-endif
-
-ifeq ($(CONFIG_ISDN_CAPI),y)
-  L_OBJS += avmb1/avmb1.o
-  SUB_DIRS += avmb1
-  MOD_SUB_DIRS += avmb1
-else
-  ifeq ($(CONFIG_ISDN_CAPI),m)
-    MOD_SUB_DIRS += avmb1
-  endif
-endif
-
-ifeq ($(CONFIG_ISDN_DRV_LOOP),y)
-  L_OBJS += isdnloop/isdnloop.o
-  SUB_DIRS += isdnloop
-  MOD_SUB_DIRS += isdnloop
-else
-  ifeq ($(CONFIG_ISDN_DRV_LOOP),m)
-    MOD_SUB_DIRS += isdnloop
-  endif
-endif
-
-ifeq ($(CONFIG_ISDN_DRV_ACT2000),y)
-  L_OBJS += act2000/act2000.o
-  SUB_DIRS += act2000
-  MOD_SUB_DIRS += act2000
-else
-  ifeq ($(CONFIG_ISDN_DRV_ACT2000),m)
-    MOD_SUB_DIRS += act2000
-  endif
-endif
-
-ifeq ($(CONFIG_ISDN_DRV_EICON),y)
-  L_OBJS += eicon/eicon.o
-  SUB_DIRS += eicon
-  MOD_SUB_DIRS += eicon
-else
-  ifeq ($(CONFIG_ISDN_DRV_EICON),m)
-    MOD_SUB_DIRS += eicon
-  endif
-endif
-
-ifeq ($(CONFIG_HYSDN),y)
-  MOD_SUB_DIRS += hysdn
-endif
+# Makefile for the kernel ISDN subsystem and device drivers.
+
+# The target object and module list name.
+
+O_TARGET       := isdn.a
+
+# Objects that export symbols.
+
+export-objs    := isdn_common.o
+
+# Multipart objects.
+
+list-multi     := isdn.o
+isdn-objs      := isdn_net.o isdn_tty.o isdn_cards.o isdn_v110.o \
+                  isdn_common.o
+
+# Optional parts of multipart objects.
+
+isdn-objs-$(CONFIG_ISDN_PPP)           += isdn_ppp.o
+isdn-objs-$(CONFIG_ISDN_X25)           += isdn_concap.o isdn_x25iface.o
+isdn-objs-$(CONFIG_ISDN_AUDIO)         += isdn_audio.o
+isdn-objs-$(CONFIG_ISDN_TTY_FAX)       += isdn_ttyfax.o
+isdn-objs-$(CONFIG_ISDN_WITH_ABC)      += isdn_dwabc.o
+
+isdn-objs                              += $(isdn-objs-y)
+
+# Object file lists.
+
+obj-y  :=
+obj-m  :=
+obj-n  :=
+obj-   :=
+
+# Object files in subdirectories
+
+subdir-$(CONFIG_ISDN_DIVERSION)                += divert
+subdir-$(CONFIG_ISDN_DRV_HISAX)                += hisax
+subobj-$(CONFIG_ISDN_DRV_HISAX)                += hisax/hisax_drv.o
+subdir-$(CONFIG_ISDN_DRV_ICN)          += icn
+subobj-$(CONFIG_ISDN_DRV_ICN)          += icn/icn_drv.o
+subdir-$(CONFIG_ISDN_DRV_PCBIT)                += pcbit
+subobj-$(CONFIG_ISDN_DRV_PCBIT)                += pcbit/pcbit_drv.o
+subdir-$(CONFIG_ISDN_DRV_SC)           += sc
+subobj-$(CONFIG_ISDN_DRV_SC)           += sc/sc_drv.o
+subdir-$(CONFIG_ISDN_CAPI)             += avmb1
+subobj-$(CONFIG_ISDN_CAPI)             += avmb1/avmb1.o
+subdir-$(CONFIG_ISDN_DRV_LOOP)         += isdnloop
+subobj-$(CONFIG_ISDN_DRV_LOOP)         += isdnloop/isdnloop_drv.o
+subdir-$(CONFIG_ISDN_DRV_ACT2000)      += act2000
+subobj-$(CONFIG_ISDN_DRV_ACT2000)      += act2000/act2000_drv.o
+subdir-$(CONFIG_ISDN_DRV_EICON)                += eicon
+subobj-$(CONFIG_ISDN_DRV_EICON)                += eicon/eicon_drv.o
+subdir-$(CONFIG_HYSDN)                 += hysdn
+subobj-$(CONFIG_HYSDN)                 += hysdn/hysdn_drv.o
+
+obj-y                                  += $(subobj-y)
+
+# Each configuration option enables a list of files.
+
+obj-$(CONFIG_ISDN)                     += isdn.o
+obj-$(CONFIG_ISDN_PPP_BSDCOMP)         += isdn_bsdcomp.o
+
+# The global Rules.make.
 
 include $(TOPDIR)/Rules.make
 
+# Link rules for multi-part drivers.
+
+isdn.o: $(isdn-objs)
+       $(LD) -r -o $@ $(isdn-objs)
index 31312e8f6df195f1cf0acccb1467a6208e3e5503..e8946317ae950bbf46cdb420f6e2874bf4b08723 100644 (file)
@@ -1,15 +1,32 @@
-L_OBJS :=
-M_OBJS :=
-O_OBJS := module.o capi.o act2000_isa.o
-
-O_TARGET :=
-ifeq ($(CONFIG_ISDN_DRV_ACT2000),y)
-  O_TARGET += act2000.o
-else
-  ifeq ($(CONFIG_ISDN_DRV_ACT2000),m)
-       O_TARGET += act2000.o
-       M_OBJS = act2000.o
-  endif
-endif
+# Makefile for the act2000 ISDN device driver
+
+# The target object and module list name.
+
+O_TARGET       := act2000_drv.o
+
+# Objects that export symbols.
+
+export-objs    :=
+
+# Multipart objects.
+
+list-multi     := act2000.o
+act2000-objs   := module.o capi.o act2000_isa.o
+
+# Object file lists.
+
+obj-y  :=
+obj-m  :=
+obj-n  :=
+obj-   :=
+
+# Each configuration option enables a list of files.
+
+obj-$(CONFIG_ISDN_DRV_ACT2000) += act2000.o
 
 include $(TOPDIR)/Rules.make
+
+# Link rules for multi-part drivers.
+
+act2000.o: $(act2000-objs)
+       $(LD) -r -o $@ $(act2000-objs)
index a076ef7c3a1a9a2eaacc06db4faece3eaf4b7230..d1f090d3d89d3779ef3d12bca4d6bc3afb734451 100644 (file)
-#
-# $Id: Makefile,v 1.22 2000/11/23 20:45:14 kai Exp $
-#
-# Makefile for the CAPI and AVM-B1 device drivers.
-#
-# Note! Dependencies are done automagically by 'make dep', which also
-# removes any old dependencies. DON'T put your own dependencies here
-# unless it's something special (ie not a .c file).
-#
-# Note 2! The CFLAGS definitions are now inherited from the
-# parent makes..
-#
-# $Log: Makefile,v $
-# Revision 1.22  2000/11/23 20:45:14  kai
-# fixed module_init/exit stuff
-# Note: compiled-in kernel doesn't work pre 2.2.18 anymore.
-#
-# Revision 1.21  2000/11/01 14:05:02  calle
-# - use module_init/module_exit from linux/init.h.
-# - all static struct variables are initialized with "membername:" now.
-# - avm_cs.c, let it work with newer pcmcia-cs.
-#
-# Revision 1.20  2000/10/18 06:13:34  ostoyke
-# Removing CAPI4Linux from I4L CVS.
-#
-# Revision 1.19  2000/08/10 14:46:25  ostoyke
-# CAPI4Linux.
-#
-# Revision 1.18  2000/04/03 16:39:25  calle
-# Makefile checked in with future things :-(
-#
-# Revision 1.17  2000/04/03 16:38:05  calle
-# made suppress_pollack static.
-#
-# Revision 1.16  2000/03/17 12:15:44  calle
-# ALL_SUB_DIRS were wrong.
-#
-# Revision 1.15  2000/03/16 15:21:03  calle
-# Bugfix in c4_remove: loop 5 times instead of 4 :-(
-#
-# Revision 1.14  2000/03/13 17:50:55  calle
-# Added avm_cs.c for 2.3.x PCMCIA support.
-#
-# Revision 1.13  2000/03/08 17:06:33  calle
-# - changes for devfs and 2.3.49
-# - capifs now configurable (no need with devfs)
-# - New Middleware ioctl CAPI_NCCI_GETUNIT
-# - Middleware again tested with 2.2.14 and 2.3.49 (with and without devfs)
-#
-# Revision 1.12  2000/03/06 18:00:23  calle
-# - Middleware extention now working with 2.3.49 (capifs).
-# - Fixed typos in debug section of capi.c
-# - Bugfix: Makefile corrected for b1pcmcia.c
-#
-# Revision 1.11  2000/03/06 09:17:07  calle
-# - capifs: fileoperations now in inode (change for 2.3.49)
-# - Config.in: Middleware extention not a tristate, uups.
-#
-# Revision 1.10  2000/03/03 16:48:38  calle
-# - Added CAPI2.0 Middleware support (CONFIG_ISDN_CAPI)
-#   It is now possible to create a connection with a CAPI2.0 applikation
-#   and than to handle the data connection from /dev/capi/ (capifs) and also
-#   using async or sync PPP on this connection.
-#   The two major device number 190 and 191 are not confirmed yet,
-#   but I want to save the code in cvs, before I go on.
-#
-# Revision 1.9  2000/03/03 15:50:42  calle
-# - kernel CAPI:
-#   - Changed parameter "param" in capi_signal from __u32 to void *.
-#   - rewrote notifier handling in kcapi.c
-#   - new notifier NCCI_UP and NCCI_DOWN
-# - User CAPI:
-#   - /dev/capi20 is now a cloning device.
-#   - middleware extentions prepared.
-# - capidrv.c
-#   - locking of list operations and module count updates.
-#
-# Revision 1.8  2000/01/25 14:33:38  calle
-# - Added Support AVM B1 PCI V4.0 (tested with prototype)
-#   - splitted up t1pci.c into b1dma.c for common function with b1pciv4
-#   - support for revision register
-#
-# Revision 1.7  1999/09/15 08:16:03  calle
-# Implementation of 64Bit extention complete.
-#
-# Revision 1.6  1999/07/20 06:41:44  calle
-# Bugfix: After the redesign of the AVM B1 driver, the driver didn't even
-#         compile, if not selected as modules.
-#
-# Revision 1.5  1999/07/01 15:26:20  calle
-# complete new version (I love it):
-# + new hardware independed "capi_driver" interface that will make it easy to:
-#   - support other controllers with CAPI-2.0 (i.e. USB Controller)
-#   - write a CAPI-2.0 for the passive cards
-#   - support serial link CAPI-2.0 boxes.
-# + wrote "capi_driver" for all supported cards.
-# + "capi_driver" (supported cards) now have to be configured with
-#   make menuconfig, in the past all supported cards where included
-#   at once.
-# + new and better informations in /proc/capi/
-# + new ioctl to switch trace of capi messages per controller
-#   using "avmcapictrl trace [contr] on|off|...."
-# + complete testcircle with all supported cards and also the
-#   PCMCIA cards (now patch for pcmcia-cs-3.0.13 needed) done.
-#
-# Revision 1.4  1997/03/30 17:10:40  calle
-# added support for AVM-B1-PCI card.
-#
-# Revision 1.3  1997/03/22 02:00:57  fritz
-# -Reworked toplevel Makefile. From now on, no different Makefiles
-#  for standalone- and in-kernel-compilation are needed any more.
-# -Added local Rules.make for above reason.
-# -Experimental changes in teles3.c for enhanced IRQ-checking with
-#  2.1.X and SMP kernels.
-# -Removed diffstd-script, same functionality is in stddiff -r.
-# -Enhanced scripts std2kern and stddiff.
-#
-# Revision 1.1  1997/03/05 21:26:14  fritz
-# Renamed, according naming conventions in CVS tree.
-#
-# Revision 1.1  1997/03/04 21:50:26  calle
-# Frirst version in isdn4linux
-#
-# Revision 2.2  1997/02/12 09:31:39  calle
-#
-# Revision 1.1  1997/01/31 10:32:20  calle
-# Initial revision
-#
-#
+# Makefile for the AVM ISDN device drivers and CAPI subsystem.
 
-SUB_DIRS     :=
-MOD_SUB_DIRS :=
-ALL_SUB_DIRS :=
-#
-# Objects that don't export a symtab
-#
-L_OBJS := # used as component of an L_TARGET
-O_OBJS := # used as component of an O_TARGET
-M_OBJS := # used as module
-#
-# Objects that do export a symtab
-#
-LX_OBJS := # used as component of an L_TARGET
-OX_OBJS := # used as component of an O_TARGET
-MX_OBJS := # used as module
-#
-# Targets, created by linking others
-#
-O_TARGET := # used for .o targets (from O and OX objects)
-L_TARGET := # used for .a targets (from L and LX objects)
+# The target object and module list name.
 
-ifeq ($(CONFIG_ISDN_CAPI),y)
-  O_TARGET += avmb1.o
-  OX_OBJS  += kcapi.o
-  O_OBJS   += capi.o
-  ifdef CONFIG_ISDN_CAPIFS
-       OX_OBJS   += capifs.o
-  endif
-  ifdef CONFIG_ISDN_DRV_AVMB1_B1ISA
-       O_OBJS   += b1isa.o
-  endif
-  ifdef CONFIG_ISDN_DRV_AVMB1_B1PCI
-       O_OBJS  += b1pci.o
-  endif
-  ifdef CONFIG_ISDN_DRV_AVMB1_T1ISA
-       O_OBJS   += t1isa.o
-  endif
-  ifdef CONFIG_ISDN_DRV_AVMB1_B1PCMCIA
-       OX_OBJS   += b1pcmcia.o
-       ifeq ($(CONFIG_HOTPLUG),y)
-               ifneq ($(CONFIG_PCMCIA),n)
-                       M_OBJS   += avm_cs.o
-               endif
-       endif
-  endif
-  ifdef CONFIG_ISDN_DRV_AVMB1_T1PCI
-       O_OBJS   += t1pci.o
-  endif
-  ifdef CONFIG_ISDN_DRV_AVMB1_C4
-       O_OBJS   += c4.o
-  endif
-  OX_OBJS  += capiutil.o capidrv.o b1.o b1dma.o
-else
-  ifeq ($(CONFIG_ISDN_CAPI),m)
-       O_TARGET += kernelcapi.o
-       OX_OBJS  += kcapi.o
-       M_OBJS   += capi.o kernelcapi.o
-       ifdef CONFIG_ISDN_CAPIFS
-               MX_OBJS   += capifs.o
-       endif
-       ifdef CONFIG_ISDN_DRV_AVMB1_B1ISA
-               M_OBJS   += b1isa.o
-       endif
-       ifdef CONFIG_ISDN_DRV_AVMB1_B1PCI
-               M_OBJS  += b1pci.o
-       endif
-       ifdef CONFIG_ISDN_DRV_AVMB1_T1ISA
-               M_OBJS   += t1isa.o
-       endif
-       ifdef CONFIG_ISDN_DRV_AVMB1_B1PCMCIA
-               MX_OBJS  += b1pcmcia.o
-               ifeq ($(CONFIG_HOTPLUG),y)
-                       ifneq ($(CONFIG_PCMCIA),n)
-                               M_OBJS   += avm_cs.o
-                       endif
-               endif
-       endif
-       ifdef CONFIG_ISDN_DRV_AVMB1_T1PCI
-               M_OBJS   += t1pci.o
-       endif
-       ifdef CONFIG_ISDN_DRV_AVMB1_C4
-               M_OBJS   += c4.o
-       endif
-       MX_OBJS  += capiutil.o capidrv.o b1.o b1dma.o
-  endif
-endif
+O_TARGET       := avmb1.o
+
+# Objects that export symbols.
+
+export-objs    := kcapi.o capiutil.o b1dma.o b1pcmcia.o b1.o capifs.o
+
+# Multipart objects.
+
+list-multi     := kernelcapi.o
+kernelcapi-objs        := kcapi.o
+
+# Object file lists.
+
+obj-y  :=
+obj-m  :=
+obj-n  :=
+obj-   :=
+
+# Each configuration option enables a list of files.
+
+obj-$(CONFIG_ISDN_CAPI)                        += kernelcapi.o capiutil.o
+obj-$(CONFIG_ISDN_CAPI_CAPI20)         += capi.o 
+obj-$(CONFIG_ISDN_CAPI_CAPIDRV)                += capidrv.o
+obj-$(CONFIG_ISDN_CAPI_CAPIFS)         += capifs.o
+obj-$(CONFIG_ISDN_DRV_AVMB1_B1ISA)     += b1isa.o b1.o
+obj-$(CONFIG_ISDN_DRV_AVMB1_B1PCI)     += b1pci.o b1.o b1dma.o
+obj-$(CONFIG_ISDN_DRV_AVMB1_B1PCMCIA)  += b1pcmcia.o b1.o
+obj-$(CONFIG_ISDN_DRV_AVMB1_AVM_CS)    += avm_cs.o
+obj-$(CONFIG_ISDN_DRV_AVMB1_T1ISA)     += t1isa.o b1.o
+obj-$(CONFIG_ISDN_DRV_AVMB1_T1PCI)     += t1pci.o b1.o b1dma.o
+obj-$(CONFIG_ISDN_DRV_AVMB1_C4)                += c4.o b1.o
+
+# The global Rules.make.
 
 include $(TOPDIR)/Rules.make
+
+# Link rules for multi-part drivers.
+
+kernelcapi.o: $(kernelcapi-objs)
+       $(LD) -r -o $@ $(kernelcapi-objs)
+
diff --git a/drivers/isdn/avmb1/b1capi.c b/drivers/isdn/avmb1/b1capi.c
deleted file mode 100644 (file)
index 117701a..0000000
+++ /dev/null
@@ -1,1272 +0,0 @@
-/*
- * $Id: b1capi.c,v 1.14 1999/04/15 19:49:29 calle Exp $
- * 
- * CAPI 2.0 Module for AVM B1-card.
- * 
- * (c) Copyright 1997 by Carsten Paeth (calle@calle.in-berlin.de)
- * 
- * $Log: b1capi.c,v $
- * Revision 1.14  1999/04/15 19:49:29  calle
- * fix fuer die B1-PCI. Jetzt geht z.B. auch IRQ 17 ...
- *
- * Revision 1.13  1999/01/05 18:29:31  he
- * merged remaining schedule_timeout() changes from 2.1.127
- *
- * Revision 1.12  1998/10/25 14:38:58  fritz
- * Backported from MIPS (Cobalt).
- *
- * Revision 1.11  1998/03/29 16:05:58  calle
- * changes from 2.0 tree merged.
- *
- * Revision 1.4.2.18  1998/03/20 20:34:37  calle
- * port valid check now only for T1, because of the PCI and PCMCIA cards.
- *
- * Revision 1.4.2.17  1998/03/20 14:38:17  calle
- * capidrv: prepared state machines for suspend/resume/hold
- * capidrv: fix bug in state machine if B1/T1 is out of nccis
- * b1capi: changed some errno returns.
- * b1capi: detect if you try to add same T1 to different io address.
- * b1capi: change number of nccis depending on number of channels.
- * b1lli: cosmetics
- *
- * Revision 1.4.2.16  1998/03/20 09:01:08  calle
- * Changes capi_register handling to get full support for 30 bchannels.
- *
- * Revision 1.4.2.15  1998/03/18 17:43:26  calle
- * T1 with fastlink, bugfix for multicontroller support in capidrv.c
- *
- * Revision 1.4.2.14  1998/03/04 17:33:47  calle
- * Changes for T1.
- *
- * Revision 1.4.2.13  1998/02/27 15:40:41  calle
- * T1 running with slow link. bugfix in capi_release.
- *
- * Revision 1.4.2.12  1998/02/24 17:58:25  calle
- * changes for T1.
- *
- * Revision 1.10  1998/02/13 07:09:10  calle
- * change for 2.1.86 (removing FREE_READ/FREE_WRITE from [dev]_kfree_skb()
- *
- * Revision 1.9  1998/01/31 11:14:39  calle
- * merged changes to 2.0 tree, prepare 2.1.82 to work.
- *
- * Revision 1.8  1997/12/10 20:00:46  calle
- * get changes from 2.0 version
- *
- * Revision 1.4.2.5  1997/12/07 19:59:54  calle
- * more changes for M1/T1/B1 + config
- *
- * Revision 1.4.2.4  1997/11/26 16:57:20  calle
- * more changes for B1/M1/T1.
- *
- * Revision 1.7  1997/10/19 14:45:40  calle
- * fixed capi_get_version.
- *
- * Revision 1.6  1997/10/01 09:21:09  fritz
- * Removed old compatibility stuff for 2.0.X kernels.
- * From now on, this code is for 2.1.X ONLY!
- * Old stuff is still in the separate branch.
- *
- * Revision 1.5  1997/07/12 08:22:26  calle
- * Correct bug in CARD_NR macro, so now more than one card will work.
- * Allow card reset, even if card is in running state.
- *
- *
- * Revision 1.4  1997/05/27 15:17:45  fritz
- * Added changes for recent 2.1.x kernels:
- *   changed return type of isdn_close
- *   queue_task_* -> queue_task
- *   clear/set_bit -> test_and_... where apropriate.
- *   changed type of hard_header_cache parameter.
- *
- * Revision 1.3  1997/05/18 09:24:09  calle
- * added verbose disconnect reason reporting to avmb1.
- * some fixes in capi20 interface.
- * changed info messages for B1-PCI
- *
- * Revision 1.2  1997/03/05 21:20:41  fritz
- * Removed include of config.h (mkdep stated this is unneded).
- *
- * Revision 1.1  1997/03/04 21:50:27  calle
- * Frirst version in isdn4linux
- *
- * Revision 2.2  1997/02/12 09:31:39  calle
- * new version
- *
- * Revision 1.1  1997/01/31 10:32:20  calle
- * Initial revision
- *
- * 
- */
-
-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/mm.h>
-#include <linux/interrupt.h>
-#include <linux/ioport.h>
-#include <asm/segment.h>
-#include <linux/skbuff.h>
-#include <linux/tqueue.h>
-#include <linux/capi.h>
-#include <linux/b1lli.h>
-#include <linux/kernelcapi.h>
-#include "compat.h"
-#include "capicmd.h"
-#include "capiutil.h"
-
-static char *revision = "$Revision: 1.14 $";
-
-/* ------------------------------------------------------------- */
-
-int showcapimsgs = 0;          /* used in lli.c */
-int loaddebug = 0;
-
-MODULE_AUTHOR("Carsten Paeth <calle@calle.in-berlin.de>");
-MODULE_PARM(showcapimsgs, "0-5i");
-MODULE_PARM(loaddebug, "0-1i");
-
-/* ------------------------------------------------------------- */
-
-struct msgidqueue {
-       struct msgidqueue *next;
-       __u16 msgid;
-};
-
-typedef struct avmb1_ncci {
-       struct avmb1_ncci *next;
-       __u16 applid;
-       __u32 ncci;
-       __u32 winsize;
-       struct msgidqueue *msgidqueue;
-       struct msgidqueue *msgidlast;
-       struct msgidqueue *msgidfree;
-       struct msgidqueue msgidpool[CAPI_MAXDATAWINDOW];
-} avmb1_ncci;
-
-typedef struct avmb1_appl {
-       __u16 applid;
-       capi_register_params rparam;
-       int releasing;
-       __u32 param;
-       void (*signal) (__u16 applid, __u32 param);
-       struct sk_buff_head recv_queue;
-       struct avmb1_ncci *nccilist;
-} avmb1_appl;
-
-/* ------------------------------------------------------------- */
-
-static struct capi_version driver_version = {2, 0, 1, 1<<4};
-static char driver_serial[CAPI_SERIAL_LEN] = "4711";
-static char capi_manufakturer[64] = "AVM Berlin";
-
-#define APPL(a)                   (&applications[(a)-1])
-#define        VALID_APPLID(a)    ((a) && (a) <= CAPI_MAXAPPL && APPL(a)->applid == a)
-#define APPL_IS_FREE(a)    (APPL(a)->applid == 0)
-#define APPL_MARK_FREE(a)  do{ APPL(a)->applid=0; MOD_DEC_USE_COUNT; }while(0);
-#define APPL_MARK_USED(a)  do{ APPL(a)->applid=(a); MOD_INC_USE_COUNT; }while(0);
-
-#define NCCI2CTRL(ncci)    (((ncci) >> 24) & 0x7f)
-
-#define VALID_CARD(c)     ((c) > 0 && (c) <= CAPI_MAXCONTR)
-#define CARD(c)                   (&cards[(c)-1])
-#define CARDNR(cp)        (((cp)-cards)+1)
-
-static avmb1_appl applications[CAPI_MAXAPPL];
-static avmb1_card cards[CAPI_MAXCONTR];
-static int ncards = 0;
-static struct sk_buff_head recv_queue;
-static struct capi_interface_user *capi_users = 0;
-static long notify_up_set = 0;
-static long notify_down_set = 0;
-
-static struct tq_struct tq_state_notify;
-static struct tq_struct tq_recv_notify;
-
-/* -------- util functions ------------------------------------ */
-
-static char *cardtype2str(int cardtype)
-{
-       switch (cardtype) {
-               default:
-               case AVM_CARDTYPE_B1:    return "B1-ISA";
-               case AVM_CARDTYPE_B1PCI: return "B1-PCI";
-               case AVM_CARDTYPE_M1:    return "M1";
-               case AVM_CARDTYPE_M2:    return "M2";
-               case AVM_CARDTYPE_T1:    return "T1";
-       }
-}
-
-static inline int capi_cmd_valid(__u8 cmd)
-{
-       switch (cmd) {
-       case CAPI_ALERT:
-       case CAPI_CONNECT:
-       case CAPI_CONNECT_ACTIVE:
-       case CAPI_CONNECT_B3_ACTIVE:
-       case CAPI_CONNECT_B3:
-       case CAPI_CONNECT_B3_T90_ACTIVE:
-       case CAPI_DATA_B3:
-       case CAPI_DISCONNECT_B3:
-       case CAPI_DISCONNECT:
-       case CAPI_FACILITY:
-       case CAPI_INFO:
-       case CAPI_LISTEN:
-       case CAPI_MANUFACTURER:
-       case CAPI_RESET_B3:
-       case CAPI_SELECT_B_PROTOCOL:
-               return 1;
-       }
-       return 0;
-}
-
-static inline int capi_subcmd_valid(__u8 subcmd)
-{
-       switch (subcmd) {
-       case CAPI_REQ:
-       case CAPI_CONF:
-       case CAPI_IND:
-       case CAPI_RESP:
-               return 1;
-       }
-       return 0;
-}
-
-/* -------- NCCI Handling ------------------------------------- */
-
-static inline void mq_init(avmb1_ncci * np)
-{
-       int i;
-       np->msgidqueue = 0;
-       np->msgidlast = 0;
-       memset(np->msgidpool, 0, sizeof(np->msgidpool));
-       np->msgidfree = &np->msgidpool[0];
-       for (i = 1; i < np->winsize; i++) {
-               np->msgidpool[i].next = np->msgidfree;
-               np->msgidfree = &np->msgidpool[i];
-       }
-}
-
-static inline int mq_enqueue(avmb1_ncci * np, __u16 msgid)
-{
-       struct msgidqueue *mq;
-       if ((mq = np->msgidfree) == 0)
-               return 0;
-       np->msgidfree = mq->next;
-       mq->msgid = msgid;
-       mq->next = 0;
-       if (np->msgidlast)
-               np->msgidlast->next = mq;
-       np->msgidlast = mq;
-       if (!np->msgidqueue)
-               np->msgidqueue = mq;
-       return 1;
-}
-
-static inline int mq_dequeue(avmb1_ncci * np, __u16 msgid)
-{
-       struct msgidqueue **pp;
-       for (pp = &np->msgidqueue; *pp; pp = &(*pp)->next) {
-               if ((*pp)->msgid == msgid) {
-                       struct msgidqueue *mq = *pp;
-                       *pp = mq->next;
-                       if (mq == np->msgidlast)
-                               np->msgidlast = 0;
-                       mq->next = np->msgidfree;
-                       np->msgidfree = mq;
-                       return 1;
-               }
-       }
-       return 0;
-}
-
-void avmb1_handle_new_ncci(avmb1_card * card,
-                          __u16 appl, __u32 ncci, __u32 winsize)
-{
-       avmb1_ncci *np;
-       if (!VALID_APPLID(appl)) {
-               printk(KERN_ERR "avmb1_handle_new_ncci: illegal appl %d\n", appl);
-               return;
-       }
-       if ((np = (avmb1_ncci *) kmalloc(sizeof(avmb1_ncci), GFP_ATOMIC)) == 0) {
-               printk(KERN_ERR "avmb1_handle_new_ncci: alloc failed ncci 0x%x\n", ncci);
-               return;
-       }
-       if (winsize > CAPI_MAXDATAWINDOW) {
-               printk(KERN_ERR "avmb1_handle_new_ncci: winsize %d too big, set to %d\n",
-                      winsize, CAPI_MAXDATAWINDOW);
-               winsize = CAPI_MAXDATAWINDOW;
-       }
-       np->applid = appl;
-       np->ncci = ncci;
-       np->winsize = winsize;
-       mq_init(np);
-       np->next = APPL(appl)->nccilist;
-       APPL(appl)->nccilist = np;
-       printk(KERN_INFO "b1capi: appl %d ncci 0x%x up\n", appl, ncci);
-
-}
-
-void avmb1_handle_free_ncci(avmb1_card * card,
-                           __u16 appl, __u32 ncci)
-{
-       if (!VALID_APPLID(appl)) {
-               printk(KERN_ERR "avmb1_handle_free_ncci: illegal appl %d\n", appl);
-               return;
-       }
-       if (ncci != 0xffffffff) {
-               avmb1_ncci **pp;
-               for (pp = &APPL(appl)->nccilist; *pp; pp = &(*pp)->next) {
-                       if ((*pp)->ncci == ncci) {
-                               avmb1_ncci *np = *pp;
-                               *pp = np->next;
-                               kfree(np);
-                               printk(KERN_INFO "b1capi: appl %d ncci 0x%x down\n", appl, ncci);
-                               return;
-                       }
-               }
-               printk(KERN_ERR "avmb1_handle_free_ncci: ncci 0x%x not found\n", ncci);
-       } else {
-               avmb1_ncci **pp, **nextpp;
-               for (pp = &APPL(appl)->nccilist; *pp; pp = nextpp) {
-                       if (NCCI2CTRL((*pp)->ncci) == card->cnr) {
-                               avmb1_ncci *np = *pp;
-                               *pp = np->next;
-                               printk(KERN_INFO "b1capi: appl %d ncci 0x%x down!\n", appl, np->ncci);
-                               kfree(np);
-                               nextpp = pp;
-                       } else {
-                               nextpp = &(*pp)->next;
-                       }
-               }
-               APPL(appl)->releasing--;
-               if (APPL(appl)->releasing <= 0) {
-                       APPL(appl)->signal = 0;
-                       APPL_MARK_FREE(appl);
-                       printk(KERN_INFO "b1capi: appl %d down\n", appl);
-               }
-       }
-}
-
-static avmb1_ncci *find_ncci(avmb1_appl * app, __u32 ncci)
-{
-       avmb1_ncci *np;
-       for (np = app->nccilist; np; np = np->next) {
-               if (np->ncci == ncci)
-                       return np;
-       }
-       return 0;
-}
-
-
-
-/* -------- Receiver ------------------------------------------ */
-
-
-static void recv_handler(void *dummy)
-{
-       struct sk_buff *skb;
-
-       while ((skb = skb_dequeue(&recv_queue)) != 0) {
-               __u16 appl = CAPIMSG_APPID(skb->data);
-               struct avmb1_ncci *np;
-               if (!VALID_APPLID(appl)) {
-                       printk(KERN_ERR "b1capi: recv_handler: applid %d ? (%s)\n",
-                              appl, capi_message2str(skb->data));
-                       kfree_skb(skb);
-                       continue;
-               }
-               if (APPL(appl)->signal == 0) {
-                       printk(KERN_ERR "b1capi: recv_handler: applid %d has no signal function\n",
-                              appl);
-                       kfree_skb(skb);
-                       continue;
-               }
-               if (   CAPIMSG_COMMAND(skb->data) == CAPI_DATA_B3
-                   && CAPIMSG_SUBCOMMAND(skb->data) == CAPI_CONF
-                   && (np = find_ncci(APPL(appl), CAPIMSG_NCCI(skb->data))) != 0
-                   && mq_dequeue(np, CAPIMSG_MSGID(skb->data)) == 0) {
-                       printk(KERN_ERR "b1capi: msgid %hu ncci 0x%x not on queue\n",
-                               CAPIMSG_MSGID(skb->data), np->ncci);
-               }
-               skb_queue_tail(&APPL(appl)->recv_queue, skb);
-               (APPL(appl)->signal) (APPL(appl)->applid, APPL(appl)->param);
-       }
-}
-
-
-void avmb1_handle_capimsg(avmb1_card * card, __u16 appl, struct sk_buff *skb)
-{
-       if (card->cardstate != CARD_RUNNING) {
-               printk(KERN_INFO "b1capi: controller %d not active, got: %s",
-                      card->cnr, capi_message2str(skb->data));
-               goto error;
-               return;
-       }
-       skb_queue_tail(&recv_queue, skb);
-       queue_task(&tq_recv_notify, &tq_immediate);
-       mark_bh(IMMEDIATE_BH);
-       return;
-
-      error:
-       kfree_skb(skb);
-}
-
-void avmb1_interrupt(int interrupt, void *devptr, struct pt_regs *regs)
-{
-       avmb1_card *card;
-
-       card = (avmb1_card *) devptr;
-
-       if (!card) {
-               printk(KERN_WARNING "avmb1_interrupt: wrong device\n");
-               return;
-       }
-       if (card->interrupt) {
-               printk(KERN_ERR "avmb1_interrupt: reentering interrupt hander\n");
-               return;
-       }
-
-       card->interrupt = 1;
-
-       B1_handle_interrupt(card);
-
-       card->interrupt = 0;
-}
-
-/* -------- Notifier ------------------------------------------ */
-
-static void notify_up(__u16 contr)
-{
-       struct capi_interface_user *p;
-
-        printk(KERN_NOTICE "b1capi: notify up contr %d\n", contr);
-       for (p = capi_users; p; p = p->next) {
-               if (p->callback)
-                       (*p->callback) (KCI_CONTRUP, contr,
-                               (capi_profile *)
-                                       CARD(contr)->version[VER_PROFILE]);
-       }
-}
-
-static void notify_down(__u16 contr)
-{
-       struct capi_interface_user *p;
-        printk(KERN_NOTICE "b1capi: notify down contr %d\n", contr);
-       for (p = capi_users; p; p = p->next) {
-               if (p->callback)
-                       (*p->callback) (KCI_CONTRDOWN, contr, 0);
-       }
-}
-
-static void notify_handler(void *dummy)
-{
-       __u16 contr;
-
-       for (contr=1; VALID_CARD(contr); contr++)
-                if (test_and_clear_bit(contr, &notify_up_set))
-                        notify_up(contr);
-       for (contr=1; VALID_CARD(contr); contr++)
-                if (test_and_clear_bit(contr, &notify_down_set))
-                        notify_down(contr);
-       MOD_DEC_USE_COUNT;
-}
-
-/* -------- card ready callback ------------------------------- */
-
-
-void avmb1_card_ready(avmb1_card * card)
-{
-        struct capi_profile *profp =
-                       (struct capi_profile *)card->version[VER_PROFILE];
-       char *dversion = card->version[VER_DRIVER];
-       __u16 appl;
-       char *cardname, cname[20];
-       __u32 flag;
-        int nbchan = profp->nbchannel;
-
-       card->cversion.majorversion = 2;
-       card->cversion.minorversion = 0;
-       card->cversion.majormanuversion = (((dversion[0] - '0') & 0xf) << 4);
-       card->cversion.majormanuversion |= ((dversion[2] - '0') & 0xf);
-       card->cversion.minormanuversion = (dversion[3] - '0') << 4;
-       card->cversion.minormanuversion |=
-               (dversion[5] - '0') * 10 + ((dversion[6] - '0') & 0xf);
-       card->cardstate = CARD_RUNNING;
-
-       for (appl = 1; appl <= CAPI_MAXAPPL; appl++) {
-               if (VALID_APPLID(appl) && !APPL(appl)->releasing) {
-                       int nconn, want = APPL(appl)->rparam.level3cnt;
-
-                       if (want > 0) nconn = want;
-                       else nconn = nbchan * -want;
-                       if (nconn == 0) nconn = nbchan;
-
-                       B1_send_register(card->port, appl,
-                               1024 * (nconn+1), nconn,
-                               APPL(appl)->rparam.datablkcnt,
-                               APPL(appl)->rparam.datablklen);
-               }
-       }
-
-        set_bit(CARDNR(card), &notify_up_set);
-       MOD_INC_USE_COUNT;
-        if (schedule_task(&tq_state_notify) == 0)
-               MOD_DEC_USE_COUNT;
-
-        flag = ((__u8 *)(profp->manu))[1];
-        switch (flag) {
-       case 0: cardname = cardtype2str(card->cardtype); break;
-       case 3: cardname = "PCMCIA B"; break;
-       case 4: cardname = "PCMCIA M1"; break;
-       case 5: cardname = "PCMCIA M2"; break;
-       case 6: cardname = "B1 V3.0"; break;
-       case 7: cardname = "B1 PCI"; break;
-       default: cardname = cname; break;
-                 sprintf(cname, "AVM?%u", (unsigned int)flag);
-                 break;
-        }
-        printk(KERN_NOTICE "b1capi: card %d \"%s\" ready.\n",
-               CARDNR(card), cardname);
-        flag = ((__u8 *)(profp->manu))[3];
-        if (flag)
-               printk(KERN_NOTICE "b1capi: card %d Protocol:%s%s%s%s%s%s%s\n",
-                       CARDNR(card),
-                       (flag & 0x01) ? " DSS1" : "",
-                       (flag & 0x02) ? " CT1" : "",
-                       (flag & 0x04) ? " VN3" : "",
-                       (flag & 0x08) ? " NI1" : "",
-                       (flag & 0x10) ? " AUSTEL" : "",
-                       (flag & 0x20) ? " ESS" : "",
-                       (flag & 0x40) ? " 1TR6" : ""
-                       );
-        flag = ((__u8 *)(profp->manu))[5];
-       if (flag)
-               printk(KERN_NOTICE "b1capi: card %d Linetype:%s%s%s%s\n",
-                       CARDNR(card),
-                       (flag & 0x01) ? " point to point" : "",
-                       (flag & 0x02) ? " point to multipoint" : "",
-                       (flag & 0x08) ? " leased line without D-channel" : "",
-                       (flag & 0x04) ? " leased line with D-channel" : ""
-                       );
-}
-
-static void avmb1_card_down(avmb1_card * card, int notify)
-{
-       __u16 appl;
-
-        card->cardstate = CARD_DETECTED;
-
-       for (appl = 1; appl <= CAPI_MAXAPPL; appl++) {
-               avmb1_ncci **pp, **nextpp;
-               for (pp = &APPL(appl)->nccilist; *pp; pp = nextpp) {
-                       if (NCCI2CTRL((*pp)->ncci) == card->cnr) {
-                               avmb1_ncci *np = *pp;
-                               *pp = np->next;
-                               printk(KERN_INFO "b1capi: appl %d ncci 0x%x forced down!\n", appl, np->ncci);
-                               kfree(np);
-                               nextpp = pp;
-                       } else {
-                               nextpp = &(*pp)->next;
-                       }
-               }
-       }
-       set_bit(CARDNR(card), &notify_down_set);
-       MOD_INC_USE_COUNT;
-       if (schedule_task(&tq_state_notify) == 0)
-               MOD_DEC_USE_COUNT;
-       printk(KERN_NOTICE "b1capi: card %d down.\n", CARDNR(card));
-}
-
-/* ------------------------------------------------------------- */
-
-
-int avmb1_registercard(int port, int irq, int cardtype, int allocio)
-{
-       struct avmb1_card *card;
-       int irqval,i;
-
-
-       for (i=0; i < CAPI_MAXCONTR && cards[i].cardstate != CARD_FREE; i++) ;
-   
-       if (i == CAPI_MAXCONTR) {
-               printk(KERN_ERR "b1capi: out of controller slots\n");
-               return -ENFILE;
-       }
-
-       card = &cards[i];
-       memset(card, 0, sizeof(avmb1_card));
-       sprintf(card->name, "avmb1-%d", CARDNR(card));
-
-        if (allocio)
-               request_region(port, AVMB1_PORTLEN, card->name);
-
-       if ((irqval = request_irq(irq, avmb1_interrupt,
-                                SA_SHIRQ, card->name, card)) != 0) {
-               printk(KERN_ERR "b1capi: unable to get IRQ %d (irqval=%d).\n",
-                      irq, irqval);
-               release_region(port, AVMB1_PORTLEN);
-               return -EBUSY;
-       }
-
-       card->cardstate = CARD_DETECTED;
-       ncards++;
-       card->cnr = CARDNR(card);
-       card->port = port;
-       card->irq = irq;
-       card->cardtype = cardtype;
-       return card->cnr;
-}
-
-int avmb1_addcard(int port, int irq, int cardtype)
-{
-       return avmb1_registercard(port, irq, cardtype, 1);
-}
-
-int avmb1_detectcard(int port, int irq, int cardtype)
-{
-       int rc;
-
-       if (!B1_valid_irq(irq, cardtype)) {
-               printk(KERN_WARNING "b1capi: irq %d not valid for %s-card.\n",
-                               irq, cardtype2str(cardtype));
-               return -EINVAL;
-       }
-       if (!B1_valid_port(port, cardtype)) {
-               printk(KERN_WARNING "b1capi: port 0x%x not valid for %s-card.\n",
-                               port, cardtype2str(cardtype));
-               return -EINVAL;
-       }
-       B1_reset(port);
-       if ((rc = B1_detect(port, cardtype)) != 0) {
-               printk(KERN_NOTICE "b1capi: NO %s-card at 0x%x (%d)\n",
-                                         cardtype2str(cardtype), port, rc);
-               return -EIO;
-       }
-       B1_reset(port);
-       switch (cardtype) {
-               default:
-               case AVM_CARDTYPE_M1:
-               case AVM_CARDTYPE_M2:
-               case AVM_CARDTYPE_B1:
-               case AVM_CARDTYPE_B1PCI:
-                       printk(KERN_NOTICE "b1capi: AVM-%s-Controller detected at 0x%x\n", cardtype2str(cardtype), port);
-                       break;
-               case AVM_CARDTYPE_T1:
-                       break;
-       }
-
-       return 0;
-}
-
-int avmb1_probecard(int port, int irq, int cardtype)
-{
-       if (check_region(port, AVMB1_PORTLEN)) {
-               printk(KERN_WARNING
-                      "b1capi: ports 0x%03x-0x%03x in use.\n",
-                      port, port + AVMB1_PORTLEN);
-               return -EBUSY;
-       }
-        return avmb1_detectcard(port, irq, cardtype);
-}
-
-int avmb1_unregistercard(int cnr, int freeio)
-{
-       avmb1_card * card;
-       if (!VALID_CARD(cnr)) 
-               return -ESRCH;
-       card = CARD(cnr);
-
-       if (card->cardstate == CARD_FREE)
-               return -ESRCH;
-       if (card->cardstate == CARD_RUNNING)
-               avmb1_card_down(card, freeio);
-
-       if (card->cardstate != CARD_FREE)
-               if (card->cardtype == AVM_CARDTYPE_T1)
-                       T1_reset(card->port);
-
-       free_irq(card->irq, card);
-       if (freeio)
-               release_region(card->port, AVMB1_PORTLEN);
-       card->cardstate = CARD_FREE;
-       return 0;
-}
-
-int avmb1_resetcard(int cnr)
-{
-       avmb1_card * card;
-
-       if (!VALID_CARD(cnr))
-               return -ESRCH;
-       card = CARD(cnr);
-       if (card->cardstate == CARD_FREE)
-               return -ESRCH;
-
-       if (card->cardstate == CARD_RUNNING)
-               avmb1_card_down(card, 0);
-
-       B1_reset(card->port);
-       B1_reset(card->port);
-
-       card->cardstate = CARD_DETECTED;
-
-       return 0;
-}
-
-/* ------------------------------------------------------------- */
-/* -------- CAPI2.0 Interface ---------------------------------- */
-/* ------------------------------------------------------------- */
-
-static int capi_installed(void)
-{
-       int i;
-       for (i = 0; i < CAPI_MAXCONTR; i++) {
-               if (cards[i].cardstate == CARD_RUNNING)
-                       return 1;
-       }
-       return 0;
-}
-
-static __u16 capi_register(capi_register_params * rparam, __u16 * applidp)
-{
-       int nconn, want = rparam->level3cnt;
-       int i;
-       int appl;
-
-       if (rparam->datablklen < 128)
-               return CAPI_LOGBLKSIZETOSMALL;
-
-       for (appl = 1; appl <= CAPI_MAXAPPL; appl++) {
-               if (APPL_IS_FREE(appl))
-                       break;
-       }
-       if (appl > CAPI_MAXAPPL)
-               return CAPI_TOOMANYAPPLS;
-
-       APPL_MARK_USED(appl);
-       skb_queue_head_init(&APPL(appl)->recv_queue);
-
-       memcpy(&APPL(appl)->rparam, rparam, sizeof(capi_register_params));
-
-       for (i = 0; i < CAPI_MAXCONTR; i++) {
-               struct capi_profile *profp =
-                       (struct capi_profile *)cards[i].version[VER_PROFILE];
-
-               if (cards[i].cardstate != CARD_RUNNING)
-                       continue;
-
-               if (want > 0) nconn = want;
-               else nconn = profp->nbchannel * -want;
-               if (nconn == 0) nconn = profp->nbchannel;
-
-               B1_send_register(cards[i].port, appl,
-                       1024 * (nconn+1), nconn,
-                       APPL(appl)->rparam.datablkcnt,
-                       APPL(appl)->rparam.datablklen);
-       }
-       *applidp = appl;
-       printk(KERN_INFO "b1capi: appl %d up\n", appl);
-
-       return CAPI_NOERROR;
-}
-
-static __u16 capi_release(__u16 applid)
-{
-       struct sk_buff *skb;
-       int i;
-
-       if (!VALID_APPLID(applid) || APPL(applid)->releasing)
-               return CAPI_ILLAPPNR;
-       while ((skb = skb_dequeue(&APPL(applid)->recv_queue)) != 0)
-               kfree_skb(skb);
-       for (i = 0; i < CAPI_MAXCONTR; i++) {
-               if (cards[i].cardstate != CARD_RUNNING) {
-                       continue;
-               }
-               APPL(applid)->releasing++;
-               B1_send_release(cards[i].port, applid);
-       }
-       if (APPL(applid)->releasing <= 0) {
-               APPL(applid)->signal = 0;
-               APPL_MARK_FREE(applid);
-               printk(KERN_INFO "b1capi: appl %d down\n", applid);
-       }
-       return CAPI_NOERROR;
-}
-
-static __u16 capi_put_message(__u16 applid, struct sk_buff *skb)
-{
-       avmb1_ncci *np;
-       int contr;
-       if (ncards == 0)
-               return CAPI_REGNOTINSTALLED;
-       if (!VALID_APPLID(applid))
-               return CAPI_ILLAPPNR;
-       if (skb->len < 12
-           || !capi_cmd_valid(CAPIMSG_COMMAND(skb->data))
-           || !capi_subcmd_valid(CAPIMSG_SUBCOMMAND(skb->data)))
-               return CAPI_ILLCMDORSUBCMDORMSGTOSMALL;
-       contr = CAPIMSG_CONTROLLER(skb->data);
-       if (!VALID_CARD(contr) || CARD(contr)->cardstate != CARD_RUNNING) {
-               contr = 1;
-               if (CARD(contr)->cardstate != CARD_RUNNING) 
-                       return CAPI_REGNOTINSTALLED;
-       }
-       if (CARD(contr)->blocked)
-               return CAPI_SENDQUEUEFULL;
-
-       if (   CAPIMSG_COMMAND(skb->data) == CAPI_DATA_B3
-           && CAPIMSG_SUBCOMMAND(skb->data) == CAPI_REQ
-           && (np = find_ncci(APPL(applid), CAPIMSG_NCCI(skb->data))) != 0
-           && mq_enqueue(np, CAPIMSG_MSGID(skb->data)) == 0)
-               return CAPI_SENDQUEUEFULL;
-
-       B1_send_message(CARD(contr)->port, skb);
-       return CAPI_NOERROR;
-}
-
-static __u16 capi_get_message(__u16 applid, struct sk_buff **msgp)
-{
-       struct sk_buff *skb;
-
-       if (!VALID_APPLID(applid))
-               return CAPI_ILLAPPNR;
-       if ((skb = skb_dequeue(&APPL(applid)->recv_queue)) == 0)
-               return CAPI_RECEIVEQUEUEEMPTY;
-       *msgp = skb;
-       return CAPI_NOERROR;
-}
-
-static __u16 capi_set_signal(__u16 applid,
-                            void (*signal) (__u16 applid, __u32 param),
-                            __u32 param)
-{
-       if (!VALID_APPLID(applid))
-               return CAPI_ILLAPPNR;
-       APPL(applid)->signal = signal;
-       APPL(applid)->param = param;
-       return CAPI_NOERROR;
-}
-
-static __u16 capi_get_manufacturer(__u16 contr, __u8 buf[CAPI_MANUFACTURER_LEN])
-{
-       if (contr == 0) {
-               strncpy(buf, capi_manufakturer, CAPI_MANUFACTURER_LEN);
-               return CAPI_NOERROR;
-       }
-       if (!VALID_CARD(contr) || CARD(contr)->cardstate != CARD_RUNNING) 
-               return 0x2002;
-
-       strncpy(buf, capi_manufakturer, CAPI_MANUFACTURER_LEN);
-       return CAPI_NOERROR;
-}
-
-static __u16 capi_get_version(__u16 contr, struct capi_version *verp)
-{
-       if (contr == 0) {
-               *verp = driver_version;
-               return CAPI_NOERROR;
-       }
-       if (!VALID_CARD(contr) || CARD(contr)->cardstate != CARD_RUNNING) 
-               return 0x2002;
-
-       memcpy((void *) verp, &CARD(contr)->cversion,
-              sizeof(capi_version));
-       return CAPI_NOERROR;
-}
-
-static __u16 capi_get_serial(__u16 contr, __u8 serial[CAPI_SERIAL_LEN])
-{
-       if (contr == 0) {
-               strncpy(serial, driver_serial, 8);
-               return CAPI_NOERROR;
-       }
-       if (!VALID_CARD(contr) || CARD(contr)->cardstate != CARD_RUNNING) 
-               return 0x2002;
-
-       memcpy((void *) serial, CARD(contr)->version[VER_SERIAL],
-              CAPI_SERIAL_LEN);
-       serial[CAPI_SERIAL_LEN - 1] = 0;
-       return CAPI_NOERROR;
-}
-
-static __u16 capi_get_profile(__u16 contr, struct capi_profile *profp)
-{
-       if (contr == 0) {
-               profp->ncontroller = ncards;
-               return CAPI_NOERROR;
-       }
-       if (!VALID_CARD(contr) || CARD(contr)->cardstate != CARD_RUNNING) 
-               return 0x2002;
-
-       memcpy((void *) profp, CARD(contr)->version[VER_PROFILE],
-              sizeof(struct capi_profile));
-       return CAPI_NOERROR;
-}
-
-static int capi_manufacturer(unsigned int cmd, void *data)
-{
-       unsigned long flags;
-       avmb1_loadandconfigdef ldef;
-       avmb1_extcarddef cdef;
-       avmb1_resetdef rdef;
-       avmb1_getdef gdef;
-       avmb1_card *card;
-       int rc;
-
-       switch (cmd) {
-       case AVMB1_ADDCARD:
-       case AVMB1_ADDCARD_WITH_TYPE:
-               if (cmd == AVMB1_ADDCARD) {
-                  if ((rc = copy_from_user((void *) &cdef, data,
-                                           sizeof(avmb1_carddef))))
-                          return rc;
-                  cdef.cardtype = AVM_CARDTYPE_B1;
-               } else {
-                  if ((rc = copy_from_user((void *) &cdef, data,
-                                           sizeof(avmb1_extcarddef))))
-                          return rc;
-               }
-
-               if ((rc = avmb1_probecard(cdef.port, cdef.irq, cdef.cardtype)) != 0)
-                       return rc;
-
-                if (cdef.cardtype == AVM_CARDTYPE_T1) {
-                       int i;
-                       for (i=0; i < CAPI_MAXCONTR; i++) {
-                               if (   cards[i].cardstate != CARD_FREE
-                                   && cards[i].cardtype == AVM_CARDTYPE_T1
-                                   && cards[i].cardnr == cdef.cardnr) {
-                                       printk(KERN_ERR
-                                               "b1capi: T1-HEMA-card-%d already at 0x%x\n",
-                                               cdef.cardnr, cards[i].port);
-                                       return -EBUSY;
-                               }
-                        }
-                       rc = T1_detectandinit(cdef.port,cdef.irq,cdef.cardnr);
-                       if (rc) {
-                               printk(KERN_NOTICE "b1capi: NO T1-HEMA-card-%d at 0x%x (%d)\n",
-                                         cdef.cardnr, cdef.port, rc);
-                               return -EIO;
-                        }
-                       printk(KERN_NOTICE "b1capi: T1-HEMA-card-%d at 0x%x\n",
-                                 cdef.cardnr, cdef.port);
-               }
-
-               rc = avmb1_addcard(cdef.port, cdef.irq, cdef.cardtype);
-               if (rc < 0)
-                       return rc;
-               /* don't want to change interface t
-                  addcard/probecard/registercard */
-                if (cdef.cardtype == AVM_CARDTYPE_T1) {
-                       int i;
-                       for (i=0; i < CAPI_MAXCONTR; i++) {
-                               if (cards[i].cnr == rc) {
-                                       cards[i].cardnr = cdef.cardnr;
-                                       break;
-                               }
-                        }
-               }
-               return rc;
-
-       case AVMB1_LOAD:
-       case AVMB1_LOAD_AND_CONFIG:
-
-               if (cmd == AVMB1_LOAD) {
-                       if ((rc = copy_from_user((void *) &ldef, data,
-                                               sizeof(avmb1_loaddef))))
-                               return rc;
-                       ldef.t4config.len = 0;
-                       ldef.t4config.data = 0;
-               } else {
-                       if ((rc = copy_from_user((void *) &ldef, data,
-                                               sizeof(avmb1_loadandconfigdef))))
-                               return rc;
-               }
-               if (!VALID_CARD(ldef.contr))
-                       return -ESRCH;
-
-               if (ldef.t4file.len <= 0) {
-                       printk(KERN_DEBUG "b1capi: load: invalid parameter: length of t4file is %d ?\n", ldef.t4file.len);
-                       return -EINVAL;
-               }
-
-               card = CARD(ldef.contr);
-               save_flags(flags);
-               cli();
-               if (card->cardstate != CARD_DETECTED) {
-                       restore_flags(flags);
-                       if (loaddebug)
-                               printk(KERN_DEBUG "b1capi: load: contr=%d not in detect state\n", ldef.contr);
-                       return -EBUSY;
-               }
-               card->cardstate = CARD_LOADING;
-               restore_flags(flags);
-
-               if (loaddebug) {
-                       printk(KERN_DEBUG "b1capi: load: reseting contr %d\n",
-                               ldef.contr);
-               }
-
-               B1_reset(card->port);
-
-               if (loaddebug) {
-                       printk(KERN_DEBUG "b1capi: loading contr %d\n",
-                               ldef.contr);
-               }
-
-               if ((rc = B1_load_t4file(card->port, &ldef.t4file))) {
-                       B1_reset(card->port);
-                       printk(KERN_ERR "b1capi: failed to load t4file!!\n");
-                       card->cardstate = CARD_DETECTED;
-                       return rc;
-               }
-
-               B1_disable_irq(card->port);
-
-               if (ldef.t4config.len > 0) { /* load config */
-                       if (loaddebug) {
-                               printk(KERN_DEBUG "b1capi: loading config to contr %d\n",
-                                                       ldef.contr);
-                       }
-                       if ((rc = B1_load_config(card->port, &ldef.t4config))) {
-                               B1_reset(card->port);
-                               printk(KERN_ERR "b1capi: failed to load config!!\n");
-                               card->cardstate = CARD_DETECTED;
-                               return rc;
-                       }
-               }
-
-               if (loaddebug) {
-                       printk(KERN_DEBUG "b1capi: load: ready contr %d: checking\n",
-                               ldef.contr);
-               }
-
-               if (!B1_loaded(card->port)) {
-                       card->cardstate = CARD_DETECTED;
-                       printk(KERN_ERR "b1capi: failed to load t4file.\n");
-                       return -EIO;
-               }
-               /*
-                * enable interrupt
-                */
-
-               card->cardstate = CARD_INITSTATE;
-               save_flags(flags);
-               cli();
-               B1_setinterrupt(card->port, card->irq, card->cardtype);
-               restore_flags(flags);
-
-               if (loaddebug) {
-                       printk(KERN_DEBUG "b1capi: load: irq enabled contr %d\n",
-                               ldef.contr);
-               }
-
-               /*
-                * init card
-                */
-                if (card->cardtype == AVM_CARDTYPE_T1)
-                  B1_send_init(card->port, AVM_NAPPS,
-                                           AVM_NNCCI_PER_CHANNEL*30,
-                                           card->cnr - 1);
-               else
-                  B1_send_init(card->port, AVM_NAPPS,
-                                           AVM_NNCCI_PER_CHANNEL*2,
-                                           card->cnr - 1);
-
-               if (loaddebug) {
-                       printk(KERN_DEBUG "b1capi: load: waiting for init reply contr %d\n",
-                               ldef.contr);
-               }
-
-               while (card->cardstate != CARD_RUNNING) {
-
-                       current->state = TASK_INTERRUPTIBLE;
-                       schedule_timeout(HZ/10);        /* 0.1 sec */
-
-                       if (signal_pending(current))
-                               return -EINTR;
-               }
-               return 0;
-
-       case AVMB1_RESETCARD:
-               if ((rc = copy_from_user((void *) &rdef, data,
-                                        sizeof(avmb1_resetdef))))
-                       return rc;
-
-               return avmb1_resetcard(rdef.contr);
-
-       case AVMB1_GET_CARDINFO:
-               if ((rc = copy_from_user((void *) &gdef, data,
-                                        sizeof(avmb1_getdef))))
-                       return rc;
-
-               if (!VALID_CARD(gdef.contr))
-                       return -ESRCH;
-
-               card = CARD(gdef.contr);
-
-               gdef.cardstate = card->cardstate;
-               gdef.cardtype = card->cardtype;
-
-               if ((rc = copy_to_user(data, (void *) &gdef,
-                                        sizeof(avmb1_getdef))))
-                       return rc;
-
-               return 0;
-       case AVMB1_REMOVECARD:
-               if ((rc = copy_from_user((void *) &rdef, data,
-                                        sizeof(avmb1_resetdef))))
-                       return rc;
-               if (!VALID_CARD(rdef.contr))
-                       return -ESRCH;
-
-               card = CARD(rdef.contr);
-
-               if (card->cardstate != CARD_DETECTED)
-                       return -EBUSY;
-
-               return avmb1_unregistercard(rdef.contr, 1);
-       }
-       return -EINVAL;
-}
-
-struct capi_interface avmb1_interface =
-{
-       capi_installed,
-       capi_register,
-       capi_release,
-       capi_put_message,
-       capi_get_message,
-       capi_set_signal,
-       capi_get_manufacturer,
-       capi_get_version,
-       capi_get_serial,
-       capi_get_profile,
-       capi_manufacturer
-};
-
-/* ------------------------------------------------------------- */
-/* -------- Exported Functions --------------------------------- */
-/* ------------------------------------------------------------- */
-
-struct capi_interface *attach_capi_interface(struct capi_interface_user *userp)
-{
-       struct capi_interface_user *p;
-
-       for (p = capi_users; p; p = p->next) {
-               if (p == userp) {
-                       printk(KERN_ERR "b1capi: double attach from %s\n",
-                              userp->name);
-                       return 0;
-               }
-       }
-       userp->next = capi_users;
-       capi_users = userp;
-       MOD_INC_USE_COUNT;
-       printk(KERN_NOTICE "b1capi: %s attached\n", userp->name);
-
-       return &avmb1_interface;
-}
-
-int detach_capi_interface(struct capi_interface_user *userp)
-{
-       struct capi_interface_user **pp;
-
-       for (pp = &capi_users; *pp; pp = &(*pp)->next) {
-               if (*pp == userp) {
-                       *pp = userp->next;
-                       userp->next = 0;
-                       MOD_DEC_USE_COUNT;
-                       printk(KERN_NOTICE "b1capi: %s detached\n", userp->name);
-                       return 0;
-               }
-       }
-       printk(KERN_ERR "b1capi: double detach from %s\n", userp->name);
-       return -1;
-}
-
-/* ------------------------------------------------------------- */
-/* -------- Init & Cleanup ------------------------------------- */
-/* ------------------------------------------------------------- */
-
-EXPORT_SYMBOL(attach_capi_interface);
-EXPORT_SYMBOL(detach_capi_interface);
-EXPORT_SYMBOL(avmb1_addcard);
-EXPORT_SYMBOL(avmb1_probecard);
-EXPORT_SYMBOL(avmb1_registercard);
-EXPORT_SYMBOL(avmb1_unregistercard);
-EXPORT_SYMBOL(avmb1_resetcard);
-EXPORT_SYMBOL(avmb1_detectcard);
-
-
-/*
- * init / exit functions
- */
-
-#ifdef MODULE
-#define avmb1_init init_module
-#endif
-
-int avmb1_init(void)
-{
-       char *p;
-       char rev[10];
-
-       skb_queue_head_init(&recv_queue);
-       /* init_bh(CAPI_BH, do_capi_bh); */
-
-       tq_state_notify.routine = notify_handler;
-       tq_state_notify.data = 0;
-
-       tq_recv_notify.routine = recv_handler;
-       tq_recv_notify.data = 0;
-
-
-       if ((p = strchr(revision, ':'))) {
-               strcpy(rev, p + 1);
-               p = strchr(rev, '$');
-               *p = 0;
-       } else
-               strcpy(rev, " ??? ");
-
-#ifdef MODULE
-        printk(KERN_NOTICE "AVM-B1-CAPI-driver Rev%s: loaded\n", rev);
-#else
-       printk(KERN_NOTICE "AVM-B1-CAPI-driver Rev%s: started\n", rev);
-#endif
-       return 0;
-}
-
-#ifdef MODULE
-void cleanup_module(void)
-{
-       char rev[10];
-       char *p;
-       int i;
-
-       if ((p = strchr(revision, ':'))) {
-               strcpy(rev, p + 1);
-               p = strchr(rev, '$');
-               *p = 0;
-       } else {
-               strcpy(rev, " ??? ");
-       }
-
-       for (i = 0; i < CAPI_MAXCONTR; i++) {
-               if (cards[i].cardstate != CARD_FREE) {
-                       /*
-                        * disable card
-                        */
-                       B1_disable_irq(cards[i].port);
-                       avmb1_resetcard(i+1);
-                       /*
-                        * free kernel resources
-                        */
-                       avmb1_unregistercard(i+1, 1);
-               }
-       }
-       schedule(); /* execute queued tasks .... */
-       printk(KERN_NOTICE "AVM-B1-CAPI-driver Rev%s: unloaded\n", rev);
-}
-#endif
diff --git a/drivers/isdn/avmb1/b1lli.c b/drivers/isdn/avmb1/b1lli.c
deleted file mode 100644 (file)
index 4d9fd64..0000000
+++ /dev/null
@@ -1,1074 +0,0 @@
-/*
- * $Id: b1lli.c,v 1.10 1999/04/15 19:49:31 calle Exp $
- * 
- * ISDN lowlevel-module for AVM B1-card.
- * 
- * (c) Copyright 1997 by Carsten Paeth (calle@calle.in-berlin.de)
- * 
- * $Log: b1lli.c,v $
- * Revision 1.10  1999/04/15 19:49:31  calle
- * fix fuer die B1-PCI. Jetzt geht z.B. auch IRQ 17 ...
- *
- * Revision 1.9  1999/01/05 18:33:23  he
- * merged remaining 2.2pre{1,2} changes (jiffies and Config)
- *
- * Revision 1.8  1998/10/25 14:39:00  fritz
- * Backported from MIPS (Cobalt).
- *
- * Revision 1.7  1998/03/29 16:06:00  calle
- * changes from 2.0 tree merged.
- *
- * Revision 1.1.2.10  1998/03/20 20:34:41  calle
- * port valid check now only for T1, because of the PCI and PCMCIA cards.
- *
- * Revision 1.1.2.9  1998/03/20 14:38:20  calle
- * capidrv: prepared state machines for suspend/resume/hold
- * capidrv: fix bug in state machine if B1/T1 is out of nccis
- * b1capi: changed some errno returns.
- * b1capi: detect if you try to add same T1 to different io address.
- * b1capi: change number of nccis depending on number of channels.
- * b1lli: cosmetics
- *
- * Revision 1.1.2.8  1998/03/18 17:43:29  calle
- * T1 with fastlink, bugfix for multicontroller support in capidrv.c
- *
- * Revision 1.1.2.7  1998/03/04 17:33:50  calle
- * Changes for T1.
- *
- * Revision 1.1.2.6  1998/02/27 15:40:44  calle
- * T1 running with slow link. bugfix in capi_release.
- *
- * Revision 1.1.2.5  1998/02/13 16:28:28  calle
- * first step for T1
- *
- * Revision 1.6  1998/02/13 07:09:11  calle
- * change for 2.1.86 (removing FREE_READ/FREE_WRITE from [dev]_kfree_skb()
- *
- * Revision 1.5  1998/01/31 11:14:41  calle
- * merged changes to 2.0 tree, prepare 2.1.82 to work.
- *
- * Revision 1.4  1997/12/10 20:00:48  calle
- * get changes from 2.0 version
- *
- * Revision 1.1.2.2  1997/11/26 10:46:55  calle
- * prepared for M1 (Mobile) and T1 (PMX) cards.
- * prepared to set configuration after load to support other D-channel
- * protocols, point-to-point and leased lines.
- *
- * Revision 1.3  1997/10/01 09:21:13  fritz
- * Removed old compatibility stuff for 2.0.X kernels.
- * From now on, this code is for 2.1.X ONLY!
- * Old stuff is still in the separate branch.
- *
- * Revision 1.2  1997/07/13 12:22:42  calle
- * bug fix for more than one controller in connect_req.
- * debugoutput now with contrnr.
- *
- *
- * Revision 1.1  1997/03/04 21:50:28  calle
- * Frirst version in isdn4linux
- *
- * Revision 2.2  1997/02/12 09:31:39  calle
- * new version
- *
- * Revision 1.1  1997/01/31 10:32:20  calle
- * Initial revision
- *
- * 
- */
-/* #define FASTLINK_DEBUG */
-
-#include <linux/kernel.h>
-#include <linux/skbuff.h>
-#include <linux/delay.h>
-#include <linux/mm.h>
-#include <asm/segment.h>
-#include <asm/io.h>
-#include <linux/capi.h>
-#include <linux/b1lli.h>
-
-#include "compat.h"
-#include "capicmd.h"
-#include "capiutil.h"
-
-extern int showcapimsgs;
-
-/*
- * LLI Messages to the ISDN-ControllerISDN Controller 
- */
-
-#define        SEND_POLL               0x72    /*
-                                          * after load <- RECEIVE_POLL 
-                                        */
-#define SEND_INIT              0x11    /*
-                                          * first message <- RECEIVE_INIT
-                                          * int32 NumApplications  int32
-                                          * NumNCCIs int32 BoardNumber 
-                                        */
-#define SEND_REGISTER          0x12    /*
-                                          * register an application int32
-                                          * ApplIDId int32 NumMessages
-                                          * int32 NumB3Connections int32
-                                          * NumB3Blocks int32 B3Size
-                                          * 
-                                          * AnzB3Connection != 0 &&
-                                          * AnzB3Blocks >= 1 && B3Size >= 1 
-                                        */
-#define SEND_RELEASE           0x14    /*
-                                          * deregister an application int32 
-                                          * ApplID 
-                                        */
-#define SEND_MESSAGE           0x15    /*
-                                          * send capi-message int32 length
-                                          * capi-data ... 
-                                        */
-#define SEND_DATA_B3_REQ       0x13    /*
-                                          * send capi-data-message int32
-                                          * MsgLength capi-data ... int32
-                                          * B3Length data .... 
-                                        */
-
-#define SEND_CONFIG            0x21    /*
-                                         */
-
-#define SEND_POLLACK           0x73    /* T1 Watchdog */
-
-/*
- * LLI Messages from the ISDN-ControllerISDN Controller 
- */
-
-#define RECEIVE_POLL           0x32    /*
-                                          * <- after SEND_POLL 
-                                        */
-#define RECEIVE_INIT           0x27    /*
-                                          * <- after SEND_INIT int32 length
-                                          * byte total length b1struct board 
-                                          * driver revision b1struct card
-                                          * type b1struct reserved b1struct
-                                          * serial number b1struct driver
-                                          * capability b1struct d-channel
-                                          * protocol b1struct CAPI-2.0
-                                          * profile b1struct capi version 
-                                        */
-#define RECEIVE_MESSAGE                0x21    /*
-                                          * <- after SEND_MESSAGE int32
-                                          * AppllID int32 Length capi-data
-                                          * .... 
-                                        */
-#define RECEIVE_DATA_B3_IND    0x22    /*
-                                          * received data int32 AppllID
-                                          * int32 Length capi-data ...
-                                          * int32 B3Length data ... 
-                                        */
-#define RECEIVE_START          0x23    /*
-                                          * Handshake 
-                                        */
-#define RECEIVE_STOP           0x24    /*
-                                          * Handshake 
-                                        */
-#define RECEIVE_NEW_NCCI       0x25    /*
-                                          * int32 AppllID int32 NCCI int32
-                                          * WindowSize 
-                                        */
-#define RECEIVE_FREE_NCCI      0x26    /*
-                                          * int32 AppllID int32 NCCI 
-                                        */
-#define RECEIVE_RELEASE                0x26    /*
-                                          * int32 AppllID int32 0xffffffff 
-                                        */
-#define RECEIVE_TASK_READY     0x31    /*
-                                          * int32 tasknr
-                                          * int32 Length Taskname ...
-                                        */
-
-#define WRITE_REGISTER         0x00
-#define READ_REGISTER          0x01
-
-/*
- * port offsets
- */
-
-#define B1_READ                        0x00
-#define B1_WRITE               0x01
-#define B1_INSTAT              0x02
-#define B1_OUTSTAT             0x03
-#define B1_RESET               0x10
-#define B1_ANALYSE             0x04
-
-/* Hema card T1 */
-
-#define T1_FASTLINK            0x00
-#define T1_SLOWLINK            0x08
-
-#define T1_READ                        B1_READ
-#define T1_WRITE               B1_WRITE
-#define T1_INSTAT              B1_INSTAT
-#define T1_OUTSTAT             B1_OUTSTAT
-#define T1_IRQENABLE           0x05
-#define T1_FIFOSTAT            0x06
-#define T1_RESETLINK           0x10
-#define T1_ANALYSE             0x11
-#define T1_IRQMASTER           0x12
-#define T1_IDENT               0x17
-#define T1_RESETBOARD          0x1f
-
-#define        T1F_IREADY              0x01
-#define        T1F_IHALF               0x02
-#define        T1F_IFULL               0x04
-#define        T1F_IEMPTY              0x08
-#define        T1F_IFLAGS              0xF0
-
-#define        T1F_OREADY              0x10
-#define        T1F_OHALF               0x20
-#define        T1F_OEMPTY              0x40
-#define        T1F_OFULL               0x80
-#define        T1F_OFLAGS              0xF0
-
-/* there are HEMA cards with 1k and 4k FIFO out */
-#define FIFO_OUTBSIZE          256
-#define FIFO_INPBSIZE          512
-
-#define HEMA_VERSION_ID                0
-#define HEMA_PAL_ID            0
-
-#define B1_STAT0(cardtype)  ((cardtype) == AVM_CARDTYPE_M1 ? 0x81200000l : 0x80A00000l)
-#define B1_STAT1(cardtype)  (0x80E00000l)
-
-
-static inline unsigned char b1outp(unsigned int base,
-                                  unsigned short offset,
-                                  unsigned char value)
-{
-       outb(value, base + offset);
-       return inb(base + B1_ANALYSE);
-}
-
-static inline void t1outp(unsigned int base,
-                         unsigned short offset,
-                         unsigned char value)
-{
-       outb(value, base + offset);
-}
-
-static inline unsigned char t1inp(unsigned int base,
-                                 unsigned short offset)
-{
-       return inb(base + offset);
-}
-
-static inline int B1_isfastlink(unsigned int base)
-{
-       return (inb(base + T1_IDENT) & ~0x82) == 1;
-}
-static inline unsigned char B1_fifostatus(unsigned int base)
-{
-       return inb(base + T1_FIFOSTAT);
-}
-
-static inline int B1_rx_full(unsigned int base)
-{
-       return inb(base + B1_INSTAT) & 0x1;
-}
-
-static inline unsigned char B1_get_byte(unsigned int base)
-{
-       unsigned long i = jiffies + 1 * HZ;     /* maximum wait time 1 sec */
-       while (!B1_rx_full(base) && time_before(jiffies, i));
-       if (B1_rx_full(base))
-               return inb(base + B1_READ);
-       printk(KERN_CRIT "b1lli(0x%x): rx not full after 1 second\n", base);
-       return 0;
-}
-
-static inline unsigned int B1_get_word(unsigned int base)
-{
-       unsigned int val = 0;
-       val |= B1_get_byte(base);
-       val |= (B1_get_byte(base) << 8);
-       val |= (B1_get_byte(base) << 16);
-       val |= (B1_get_byte(base) << 24);
-       return val;
-}
-
-static inline int B1_tx_empty(unsigned int base)
-{
-       return inb(base + B1_OUTSTAT) & 0x1;
-}
-
-static inline void B1_put_byte(unsigned int base, unsigned char val)
-{
-       while (!B1_tx_empty(base));
-       b1outp(base, B1_WRITE, val);
-}
-
-static inline void B1_put_word(unsigned int base, unsigned int val)
-{
-       B1_put_byte(base, val & 0xff);
-       B1_put_byte(base, (val >> 8) & 0xff);
-       B1_put_byte(base, (val >> 16) & 0xff);
-       B1_put_byte(base, (val >> 24) & 0xff);
-}
-
-static inline unsigned int B1_get_slice(unsigned int base,
-                                       unsigned char *dp)
-{
-       unsigned int len, i;
-#ifdef FASTLINK_DEBUG
-       unsigned wcnt = 0, bcnt = 0;
-#endif
-
-       len = i = B1_get_word(base);
-        if (B1_isfastlink(base)) {
-               int status;
-               while (i > 0) {
-                       status = B1_fifostatus(base) & (T1F_IREADY|T1F_IHALF);
-                       if (i >= FIFO_INPBSIZE) status |= T1F_IFULL;
-
-                       switch (status) {
-                               case T1F_IREADY|T1F_IHALF|T1F_IFULL:
-                                       insb(base+B1_READ, dp, FIFO_INPBSIZE);
-                                       dp += FIFO_INPBSIZE;
-                                       i -= FIFO_INPBSIZE;
-#ifdef FASTLINK_DEBUG
-                                       wcnt += FIFO_INPBSIZE;
-#endif
-                                       break;
-                               case T1F_IREADY|T1F_IHALF: 
-                                       insb(base+B1_READ,dp, i);
-#ifdef FASTLINK_DEBUG
-                                       wcnt += i;
-#endif
-                                       dp += i;
-                                       i = 0;
-                                       if (i == 0)
-                                               break;
-                                       /* fall through */
-                               default:
-                                       *dp++ = B1_get_byte(base);
-                                       i--;
-#ifdef FASTLINK_DEBUG
-                                       bcnt++;
-#endif
-                                       break;
-                       }
-           }
-#ifdef FASTLINK_DEBUG
-           if (wcnt)
-           printk(KERN_DEBUG "b1lli(0x%x): get_slice l=%d w=%d b=%d\n",
-                               base, len, wcnt, bcnt);
-#endif
-       } else {
-               while (i-- > 0)
-                       *dp++ = B1_get_byte(base);
-       }
-       return len;
-}
-
-static inline void B1_put_slice(unsigned int base,
-                               unsigned char *dp, unsigned int len)
-{
-       unsigned i = len;
-       B1_put_word(base, i);
-        if (B1_isfastlink(base)) {
-               int status;
-               while (i > 0) {
-                       status = B1_fifostatus(base) & (T1F_OREADY|T1F_OHALF);
-                       if (i >= FIFO_OUTBSIZE) status |= T1F_OEMPTY;
-                       switch (status) {
-                               case T1F_OREADY|T1F_OHALF|T1F_OEMPTY: 
-                                       outsb(base+B1_WRITE, dp, FIFO_OUTBSIZE);
-                                       dp += FIFO_OUTBSIZE;
-                                       i -= FIFO_OUTBSIZE;
-                                       break;
-                               case T1F_OREADY|T1F_OHALF: 
-                                       outsb(base+B1_WRITE, dp, i);
-                                       dp += i;
-                                       i = 0;
-                                       break;
-                               default:
-                                       B1_put_byte(base, *dp++);
-                                       i--;
-                                       break;
-                       }
-               }
-       } else {
-               while (i-- > 0)
-                       B1_put_byte(base, *dp++);
-       }
-}
-
-static void b1_wr_reg(unsigned int base,
-                      unsigned int reg,
-                     unsigned int value)
-{
-       B1_put_byte(base, WRITE_REGISTER);
-        B1_put_word(base, reg);
-        B1_put_word(base, value);
-}
-
-static inline unsigned int b1_rd_reg(unsigned int base,
-                                     unsigned int reg)
-{
-       B1_put_byte(base, READ_REGISTER);
-        B1_put_word(base, reg);
-        return B1_get_word(base);
-       
-}
-
-static inline void b1_set_test_bit(unsigned int base,
-                                  int cardtype,
-                                  int onoff)
-{
-    b1_wr_reg(base, B1_STAT0(cardtype), onoff ? 0x21 : 0x20);
-}
-
-static inline int b1_get_test_bit(unsigned int base,
-                                  int cardtype)
-{
-    return (b1_rd_reg(base, B1_STAT0(cardtype)) & 0x01) != 0;
-}
-
-static int irq_table[16] =
-{0,
- 0,
- 0,
- 192,                          /* irq 3 */
- 32,                           /* irq 4 */
- 160,                          /* irq 5 */
- 96,                           /* irq 6 */
- 224,                          /* irq 7 */
- 0,
- 64,                           /* irq 9 */
- 80,                           /* irq 10 */
- 208,                          /* irq 11 */
- 48,                           /* irq 12 */
- 0,
- 0,
- 112,                          /* irq 15 */
-};
-
-static int hema_irq_table[16] =
-{0,
- 0,
- 0,
- 0x80,                         /* irq 3 */
- 0,
- 0x90,                         /* irq 5 */
- 0,
- 0xA0,                         /* irq 7 */
- 0,
- 0xB0,                         /* irq 9 */
- 0xC0,                         /* irq 10 */
- 0xD0,                         /* irq 11 */
- 0xE0,                         /* irq 12 */
- 0,
- 0,
- 0xF0,                         /* irq 15 */
-};
-
-
-int B1_valid_irq(unsigned irq, int cardtype)
-{
-       switch (cardtype) {
-          default:
-          case AVM_CARDTYPE_M1:
-          case AVM_CARDTYPE_M2:
-          case AVM_CARDTYPE_B1:
-               return irq_table[irq & 0xf] != 0;
-          case AVM_CARDTYPE_T1:
-               return hema_irq_table[irq & 0xf] != 0;
-          case AVM_CARDTYPE_B1PCI:
-               return 1;
-       }
-}
-
-int B1_valid_port(unsigned port, int cardtype)
-{
-   switch (cardtype) {
-          default:
-          case AVM_CARDTYPE_M1:
-          case AVM_CARDTYPE_M2:
-          case AVM_CARDTYPE_B1:
-#if 0  /* problem with PCMCIA and PCI cards */
-               switch (port) {
-                       case 0x150:
-                       case 0x250:
-                       case 0x300:
-                       case 0x340:
-                               return 1;
-               }
-               return 0;
-#else
-               return 1;
-#endif
-          case AVM_CARDTYPE_B1PCI:
-               return 1;
-          case AVM_CARDTYPE_T1:
-               return ((port & 0x7) == 0) && ((port & 0x30) != 0x30);
-   }
-}
-
-void B1_setinterrupt(unsigned int base,
-                                unsigned irq, int cardtype)
-{
-       switch (cardtype) {
-          case AVM_CARDTYPE_T1:
-              t1outp(base, B1_INSTAT, 0x00);
-              t1outp(base, B1_INSTAT, 0x02);
-             t1outp(base, T1_IRQMASTER, 0x08);
-             break;
-          default:
-          case AVM_CARDTYPE_M1:
-          case AVM_CARDTYPE_M2:
-          case AVM_CARDTYPE_B1:
-             b1outp(base, B1_INSTAT, 0x00);
-             b1outp(base, B1_RESET, irq_table[irq]);
-             b1outp(base, B1_INSTAT, 0x02);
-             break;
-          case AVM_CARDTYPE_B1PCI:
-             b1outp(base, B1_INSTAT, 0x00);
-             b1outp(base, B1_RESET, 0xf0);
-             b1outp(base, B1_INSTAT, 0x02);
-             break;
-        }
-}
-
-unsigned char B1_disable_irq(unsigned int base)
-{
-       return b1outp(base, B1_INSTAT, 0x00);
-}
-
-void T1_disable_irq(unsigned int base)
-{
-      t1outp(base, T1_IRQMASTER, 0x00);
-}
-
-void B1_reset(unsigned int base)
-{
-       b1outp(base, B1_RESET, 0);
-       udelay(55 * 2 * 1000);  /* 2 TIC's */
-
-       b1outp(base, B1_RESET, 1);
-       udelay(55 * 2 * 1000);  /* 2 TIC's */
-
-       b1outp(base, B1_RESET, 0);
-       udelay(55 * 2 * 1000);  /* 2 TIC's */
-}
-
-void T1_reset(unsigned int base)
-{
-        /* reset T1 Controller */
-        B1_reset(base);
-        /* disable irq on HEMA */
-        t1outp(base, B1_INSTAT, 0x00);
-        t1outp(base, B1_OUTSTAT, 0x00);
-        t1outp(base, T1_IRQMASTER, 0x00);
-        /* reset HEMA board configuration */
-       t1outp(base, T1_RESETBOARD, 0xf);
-}
-
-int B1_detect(unsigned int base, int cardtype)
-{
-       int onoff, i;
-
-       if (cardtype == AVM_CARDTYPE_T1)
-          return 0;
-
-       /*
-        * Statusregister 0000 00xx 
-        */
-       if ((inb(base + B1_INSTAT) & 0xfc)
-           || (inb(base + B1_OUTSTAT) & 0xfc))
-               return 1;
-       /*
-        * Statusregister 0000 001x 
-        */
-       b1outp(base, B1_INSTAT, 0x2);   /* enable irq */
-       /* b1outp(base, B1_OUTSTAT, 0x2); */
-       if ((inb(base + B1_INSTAT) & 0xfe) != 0x2
-           /* || (inb(base + B1_OUTSTAT) & 0xfe) != 0x2 */)
-               return 2;
-       /*
-        * Statusregister 0000 000x 
-        */
-       b1outp(base, B1_INSTAT, 0x0);   /* disable irq */
-       b1outp(base, B1_OUTSTAT, 0x0);
-       if ((inb(base + B1_INSTAT) & 0xfe)
-           || (inb(base + B1_OUTSTAT) & 0xfe))
-               return 3;
-        
-       for (onoff = !0, i= 0; i < 10 ; i++) {
-               b1_set_test_bit(base, cardtype, onoff);
-               if (b1_get_test_bit(base, cardtype) != onoff)
-                  return 4;
-               onoff = !onoff;
-       }
-
-       if (cardtype == AVM_CARDTYPE_M1)
-          return 0;
-
-        if ((b1_rd_reg(base, B1_STAT1(cardtype)) & 0x0f) != 0x01)
-          return 5;
-
-       return 0;
-}
-
-int T1_detectandinit(unsigned int base, unsigned irq, int cardnr)
-{
-       unsigned char cregs[8];
-       unsigned char reverse_cardnr;
-       unsigned long flags;
-       unsigned char dummy;
-       int i;
-
-       reverse_cardnr =   ((cardnr & 0x01) << 3) | ((cardnr & 0x02) << 1)
-                        | ((cardnr & 0x04) >> 1) | ((cardnr & 0x08) >> 3);
-       cregs[0] = (HEMA_VERSION_ID << 4) | (reverse_cardnr & 0xf);
-       cregs[1] = 0x00; /* fast & slow link connected to CON1 */
-       cregs[2] = 0x05; /* fast link 20MBit, slow link 20 MBit */
-       cregs[3] = 0;
-       cregs[4] = 0x11; /* zero wait state */
-       cregs[5] = hema_irq_table[irq & 0xf];
-       cregs[6] = 0;
-       cregs[7] = 0;
-
-       save_flags(flags);
-       cli();
-       /* board reset */
-       t1outp(base, T1_RESETBOARD, 0xf);
-       udelay(100 * 1000);
-       dummy = t1inp(base, T1_FASTLINK+T1_OUTSTAT); /* first read */
-
-       /* write config */
-       dummy = (base >> 4) & 0xff;
-       for (i=1;i<=0xf;i++) t1outp(base, i, dummy);
-       t1outp(base, HEMA_PAL_ID & 0xf, dummy);
-       t1outp(base, HEMA_PAL_ID >> 4, cregs[0]);
-       for(i=1;i<7;i++) t1outp(base, 0, cregs[i]);
-       t1outp(base, ((base >> 4)) & 0x3, cregs[7]);
-       restore_flags(flags);
-
-       udelay(100 * 1000);
-       t1outp(base, T1_FASTLINK+T1_RESETLINK, 0);
-       t1outp(base, T1_SLOWLINK+T1_RESETLINK, 0);
-       udelay(10 * 1000);
-       t1outp(base, T1_FASTLINK+T1_RESETLINK, 1);
-       t1outp(base, T1_SLOWLINK+T1_RESETLINK, 1);
-       udelay(100 * 1000);
-       t1outp(base, T1_FASTLINK+T1_RESETLINK, 0);
-       t1outp(base, T1_SLOWLINK+T1_RESETLINK, 0);
-       udelay(10 * 1000);
-       t1outp(base, T1_FASTLINK+T1_ANALYSE, 0);
-       udelay(5 * 1000);
-       t1outp(base, T1_SLOWLINK+T1_ANALYSE, 0);
-
-       if (t1inp(base, T1_FASTLINK+T1_OUTSTAT) != 0x1) /* tx empty */
-               return 1;
-       if (t1inp(base, T1_FASTLINK+T1_INSTAT) != 0x0) /* rx empty */
-               return 2;
-       if (t1inp(base, T1_FASTLINK+T1_IRQENABLE) != 0x0)
-               return 3;
-       if ((t1inp(base, T1_FASTLINK+T1_FIFOSTAT) & 0xf0) != 0x70)
-               return 4;
-       if ((t1inp(base, T1_FASTLINK+T1_IRQMASTER) & 0x0e) != 0)
-               return 5;
-       if ((t1inp(base, T1_FASTLINK+T1_IDENT) & 0x7d) != 1)
-               return 6;
-       if (t1inp(base, T1_SLOWLINK+T1_OUTSTAT) != 0x1) /* tx empty */
-               return 7;
-       if ((t1inp(base, T1_SLOWLINK+T1_IRQMASTER) & 0x0e) != 0)
-               return 8;
-       if ((t1inp(base, T1_SLOWLINK+T1_IDENT) & 0x7d) != 0)
-               return 9;
-        return 0;
-}
-
-extern int loaddebug;
-
-int B1_load_t4file(unsigned int base, avmb1_t4file * t4file)
-{
-       /*
-        * Data is in user space !!!
-        */
-       unsigned char buf[256];
-       unsigned char *dp;
-       int i, left, retval;
-
-
-       dp = t4file->data;
-       left = t4file->len;
-       while (left > sizeof(buf)) {
-               retval = copy_from_user(buf, dp, sizeof(buf));
-               if (retval)
-                       return -EFAULT;
-               if (loaddebug)
-                       printk(KERN_DEBUG "b1capi: loading: %d bytes ..", sizeof(buf));
-               for (i = 0; i < sizeof(buf); i++)
-                       B1_put_byte(base, buf[i]);
-               if (loaddebug)
-                  printk("ok\n");
-               left -= sizeof(buf);
-               dp += sizeof(buf);
-       }
-       if (left) {
-               retval = copy_from_user(buf, dp, left);
-               if (retval)
-                       return -EFAULT;
-               if (loaddebug)
-                       printk(KERN_DEBUG "b1capi: loading: %d bytes ..", left);
-               for (i = 0; i < left; i++)
-                       B1_put_byte(base, buf[i]);
-               if (loaddebug)
-                  printk("ok\n");
-       }
-       return 0;
-}
-
-int B1_load_config(unsigned int base, avmb1_t4file * config)
-{
-       /*
-        * Data is in user space !!!
-        */
-       unsigned char buf[256];
-       unsigned char *dp;
-       int i, j, left, retval;
-
-
-       dp = config->data;
-       left = config->len;
-       if (left) {
-               B1_put_byte(base, SEND_CONFIG);
-               B1_put_word(base, 1);
-               B1_put_byte(base, SEND_CONFIG);
-               B1_put_word(base, left);
-       }
-       while (left > sizeof(buf)) {
-               retval = copy_from_user(buf, dp, sizeof(buf));
-               if (retval)
-                       return -EFAULT;
-               if (loaddebug)
-                       printk(KERN_DEBUG "b1capi: conf load: %d bytes ..", sizeof(buf));
-               for (i = 0; i < sizeof(buf); ) {
-                       B1_put_byte(base, SEND_CONFIG);
-                       for (j=0; j < 4; j++) {
-                               B1_put_byte(base, buf[i++]);
-                       }
-               }
-               if (loaddebug)
-                  printk("ok\n");
-               left -= sizeof(buf);
-               dp += sizeof(buf);
-       }
-       if (left) {
-               retval = copy_from_user(buf, dp, left);
-               if (retval)
-                       return -EFAULT;
-               if (loaddebug)
-                       printk(KERN_DEBUG "b1capi: conf load: %d bytes ..", left);
-               for (i = 0; i < left; ) {
-                       B1_put_byte(base, SEND_CONFIG);
-                       for (j=0; j < 4; j++) {
-                               if (i < left)
-                                       B1_put_byte(base, buf[i++]);
-                               else
-                                       B1_put_byte(base, 0);
-                       }
-               }
-               if (loaddebug)
-                  printk("ok\n");
-       }
-       return 0;
-}
-
-int B1_loaded(unsigned int base)
-{
-       int i;
-       unsigned char ans;
-
-       if (loaddebug)
-               printk(KERN_DEBUG "b1capi: loaded: wait 1 ..\n");
-       for (i = jiffies + 10 * HZ; time_before(jiffies, i);) {
-               if (B1_tx_empty(base))
-                       break;
-       }
-       if (!B1_tx_empty(base)) {
-               printk(KERN_ERR "b1lli(0x%x): B1_loaded: timeout tx\n", base);
-               return 0;
-       }
-       B1_put_byte(base, SEND_POLL);
-       printk(KERN_DEBUG "b1capi: loaded: wait 2 ..\n");
-       for (i = jiffies + 10 * HZ; time_before(jiffies, i);) {
-               if (B1_rx_full(base)) {
-                       if ((ans = B1_get_byte(base)) == RECEIVE_POLL) {
-                               if (loaddebug)
-                                       printk(KERN_DEBUG "b1capi: loaded: ok\n");
-                               return 1;
-                       }
-                       printk(KERN_ERR "b1lli(0x%x): B1_loaded: got 0x%x ???\n",
-                               base, ans);
-                       return 0;
-               }
-       }
-       printk(KERN_ERR "b1lli(0x%x): B1_loaded: timeout rx\n", base);
-       return 0;
-}
-
-/*
- * ------------------------------------------------------------------- 
- */
-static inline void parse_version(avmb1_card * card)
-{
-       int i, j;
-       for (j = 0; j < AVM_MAXVERSION; j++)
-               card->version[j] = "\0\0" + 1;
-       for (i = 0, j = 0;
-            j < AVM_MAXVERSION && i < card->versionlen;
-            j++, i += card->versionbuf[i] + 1)
-               card->version[j] = &card->versionbuf[i + 1];
-}
-/*
- * ------------------------------------------------------------------- 
- */
-
-void B1_send_init(unsigned int port,
-            unsigned int napps, unsigned int nncci, unsigned int cardnr)
-{
-       unsigned long flags;
-
-       save_flags(flags);
-       cli();
-       B1_put_byte(port, SEND_INIT);
-       B1_put_word(port, napps);
-       B1_put_word(port, nncci);
-       B1_put_word(port, cardnr);
-       restore_flags(flags);
-}
-
-void B1_send_register(unsigned int port,
-                     __u16 appid, __u32 nmsg,
-                     __u32 nb3conn, __u32 nb3blocks, __u32 b3bsize)
-{
-       unsigned long flags;
-
-       save_flags(flags);
-       cli();
-       B1_put_byte(port, SEND_REGISTER);
-       B1_put_word(port, appid);
-       B1_put_word(port, nmsg);
-       B1_put_word(port, nb3conn);
-       B1_put_word(port, nb3blocks);
-       B1_put_word(port, b3bsize);
-       restore_flags(flags);
-}
-
-void B1_send_release(unsigned int port,
-                    __u16 appid)
-{
-       unsigned long flags;
-
-       save_flags(flags);
-       cli();
-       B1_put_byte(port, SEND_RELEASE);
-       B1_put_word(port, appid);
-       restore_flags(flags);
-}
-
-void B1_send_message(unsigned int port, struct sk_buff *skb)
-{
-       unsigned long flags;
-       __u16 len = CAPIMSG_LEN(skb->data);
-       __u8 cmd = CAPIMSG_COMMAND(skb->data);
-       __u8 subcmd = CAPIMSG_SUBCOMMAND(skb->data);
-       __u32 contr = CAPIMSG_CONTROL(skb->data);
-
-       if (CAPICMD(cmd, subcmd) == CAPI_DATA_B3_REQ) {
-               __u16 dlen = CAPIMSG_DATALEN(skb->data);
-
-               if (showcapimsgs > 2) {
-                       if (showcapimsgs & 1) {
-                               printk(KERN_DEBUG "b1lli: Put [0x%lx] id#%d %s len=%u\n",
-                                      (unsigned long) contr,
-                                      CAPIMSG_APPID(skb->data),
-                                      capi_cmd2str(cmd, subcmd), len);
-                       } else {
-                               printk(KERN_DEBUG "b1lli: Put [0x%lx] %s\n",
-                                               (unsigned long) contr,
-                                               capi_message2str(skb->data));
-                       }
-
-               }
-               save_flags(flags);
-               cli();
-               B1_put_byte(port, SEND_DATA_B3_REQ);
-               B1_put_slice(port, skb->data, len);
-               B1_put_slice(port, skb->data + len, dlen);
-               restore_flags(flags);
-       } else {
-               if (showcapimsgs) {
-
-                       if (showcapimsgs & 1) {
-                               printk(KERN_DEBUG "b1lli: Put [0x%lx] id#%d %s len=%u\n",
-                                      (unsigned long) contr,
-                                      CAPIMSG_APPID(skb->data),
-                                      capi_cmd2str(cmd, subcmd), len);
-                       } else {
-                               printk(KERN_DEBUG "b1lli: Put [0x%lx] %s\n", (unsigned long)contr, capi_message2str(skb->data));
-                       }
-               }
-               save_flags(flags);
-               cli();
-               B1_put_byte(port, SEND_MESSAGE);
-               B1_put_slice(port, skb->data, len);
-               restore_flags(flags);
-       }
-       dev_kfree_skb(skb);
-}
-
-/*
- * ------------------------------------------------------------------- 
- */
-
-void B1_handle_interrupt(avmb1_card * card)
-{
-       unsigned char b1cmd;
-       struct sk_buff *skb;
-
-       unsigned ApplId;
-       unsigned MsgLen;
-       unsigned DataB3Len;
-       unsigned NCCI;
-       unsigned WindowSize;
-
-t1retry:
-       if (!B1_rx_full(card->port))
-               return;
-
-       b1cmd = B1_get_byte(card->port);
-
-       switch (b1cmd) {
-
-       case RECEIVE_DATA_B3_IND:
-
-               ApplId = (unsigned) B1_get_word(card->port);
-               MsgLen = B1_get_slice(card->port, card->msgbuf);
-               DataB3Len = B1_get_slice(card->port, card->databuf);
-
-               if (showcapimsgs > 2) {
-                       __u8 cmd = CAPIMSG_COMMAND(card->msgbuf);
-                       __u8 subcmd = CAPIMSG_SUBCOMMAND(card->msgbuf);
-                       __u32 contr = CAPIMSG_CONTROL(card->msgbuf);
-                       CAPIMSG_SETDATA(card->msgbuf, card->databuf);
-                       if (showcapimsgs & 1) {
-                               printk(KERN_DEBUG "b1lli: Got [0x%lx] id#%d %s len=%u/%u\n",
-                                      (unsigned long) contr,
-                                      CAPIMSG_APPID(card->msgbuf),
-                                      capi_cmd2str(cmd, subcmd),
-                                      MsgLen, DataB3Len);
-                       } else {
-                               printk(KERN_DEBUG "b1lli: Got [0x%lx] %s\n", (unsigned long)contr, capi_message2str(card->msgbuf));
-                       }
-               }
-               if (!(skb = dev_alloc_skb(DataB3Len + MsgLen))) {
-                       printk(KERN_ERR "b1lli: incoming packet dropped\n");
-               } else {
-                       memcpy(skb_put(skb, MsgLen), card->msgbuf, MsgLen);
-                       memcpy(skb_put(skb, DataB3Len), card->databuf, DataB3Len);
-                       CAPIMSG_SETDATA(skb->data, skb->data + MsgLen);
-                       avmb1_handle_capimsg(card, ApplId, skb);
-               }
-               break;
-
-       case RECEIVE_MESSAGE:
-
-               ApplId = (unsigned) B1_get_word(card->port);
-               MsgLen = B1_get_slice(card->port, card->msgbuf);
-               if (showcapimsgs) {
-                       __u8 cmd = CAPIMSG_COMMAND(card->msgbuf);
-                       __u8 subcmd = CAPIMSG_SUBCOMMAND(card->msgbuf);
-                       __u32 contr = CAPIMSG_CONTROL(card->msgbuf);
-                       if (showcapimsgs & 1) {
-                               printk(KERN_DEBUG "b1lli: Got [0x%lx] id#%d %s len=%u\n",
-                                      (unsigned long) contr,
-                                      CAPIMSG_APPID(card->msgbuf),
-                                      capi_cmd2str(cmd, subcmd),
-                                      MsgLen);
-                       } else {
-                               printk(KERN_DEBUG "b1lli: Got [0x%lx] %s\n",
-                                               (unsigned long) contr,
-                                               capi_message2str(card->msgbuf));
-                       }
-
-               }
-               if (!(skb = dev_alloc_skb(MsgLen))) {
-                       printk(KERN_ERR "b1lli: incoming packet dropped\n");
-               } else {
-                       memcpy(skb_put(skb, MsgLen), card->msgbuf, MsgLen);
-                       avmb1_handle_capimsg(card, ApplId, skb);
-               }
-               break;
-
-       case RECEIVE_NEW_NCCI:
-
-               ApplId = B1_get_word(card->port);
-               NCCI = B1_get_word(card->port);
-               WindowSize = B1_get_word(card->port);
-
-               if (showcapimsgs)
-                       printk(KERN_DEBUG "b1lli(0x%x): NEW_NCCI app %u ncci 0x%x\n", card->port, ApplId, NCCI);
-
-               avmb1_handle_new_ncci(card, ApplId, NCCI, WindowSize);
-
-               break;
-
-       case RECEIVE_FREE_NCCI:
-
-               ApplId = B1_get_word(card->port);
-               NCCI = B1_get_word(card->port);
-
-               if (showcapimsgs)
-                       printk(KERN_DEBUG "b1lli(0x%x): FREE_NCCI app %u ncci 0x%x\n", card->port, ApplId, NCCI);
-
-               avmb1_handle_free_ncci(card, ApplId, NCCI);
-               break;
-
-       case RECEIVE_START:
-                if (card->cardtype == AVM_CARDTYPE_T1) {
-                  B1_put_byte(card->port, SEND_POLLACK);
-                  /* printk(KERN_DEBUG "b1lli: T1 watchdog\n"); */
-                }
-               if (card->blocked)
-                       printk(KERN_DEBUG "b1lli(0x%x): RESTART\n", card->port);
-               card->blocked = 0;
-               break;
-
-       case RECEIVE_STOP:
-               printk(KERN_DEBUG "b1lli(0x%x): STOP\n", card->port);
-               card->blocked = 1;
-               break;
-
-       case RECEIVE_INIT:
-
-               card->versionlen = B1_get_slice(card->port, card->versionbuf);
-               card->cardstate = CARD_ACTIVE;
-               parse_version(card);
-               printk(KERN_INFO "b1lli(0x%x): %s-card (%s) now active\n",
-                      card->port,
-                      card->version[VER_CARDTYPE],
-                      card->version[VER_DRIVER]);
-               avmb1_card_ready(card);
-               break;
-        case RECEIVE_TASK_READY:
-               ApplId = (unsigned) B1_get_word(card->port);
-               MsgLen = B1_get_slice(card->port, card->msgbuf);
-               card->msgbuf[MsgLen] = 0;
-               printk(KERN_INFO "b1lli(0x%x): Task %d \"%s\" ready.\n",
-                               card->port, ApplId, card->msgbuf);
-               break;
-       default:
-               printk(KERN_ERR "b1lli(0x%x): B1_handle_interrupt: 0x%x ???\n",
-                               card->port, b1cmd);
-               break;
-       }
-       if (card->cardtype == AVM_CARDTYPE_T1) 
-               goto t1retry;
-}
index 73846f660d73e45ace07b009c45813c6f53d3f79..a4e7217e309901efaded0858e13573dc1a48325e 100644 (file)
@@ -1,11 +1,17 @@
 /*
- * $Id: capi.c,v 1.44 2000/11/25 17:00:59 kai Exp $
+ * $Id: capi.c,v 1.45 2000/12/02 19:47:29 kai Exp $
  *
  * CAPI 2.0 Interface for Linux
  *
  * Copyright 1996 by Carsten Paeth (calle@calle.in-berlin.de)
  *
  * $Log: capi.c,v $
+ * Revision 1.45  2000/12/02 19:47:29  kai
+ * Change the Makefiles to new style.
+ * There may be problems there that I missed, so this shouldn't go into
+ * an offical kernel any time soon.
+ * However, if I didn't commit it, we wouldn't find the bugs...
+ *
  * Revision 1.44  2000/11/25 17:00:59  kai
  * compatibility cleanup - final part for the time being
  *
 #include <linux/devfs_fs_kernel.h>
 #include "capiutil.h"
 #include "capicmd.h"
-#ifdef CONFIG_ISDN_CAPI_MIDDLEWARE
+#if defined(CONFIG_ISDN_CAPI_CAPIFS) || defined(CONFIG_ISDN_CAPI_CAPIFS_MODULE)
 #include "capifs.h"
-#endif /* CONFIG_ISDN_CAPI_MIDDLEWARE */
+#endif
 #include <linux/slab.h>
 
-static char *revision = "$Revision: 1.44 $";
+static char *revision = "$Revision: 1.45 $";
 
 MODULE_AUTHOR("Carsten Paeth (calle@calle.in-berlin.de)");
 
@@ -518,7 +524,7 @@ static struct capincci *capincci_alloc(struct capidev *cdev, __u32 ncci)
 #ifdef _DEBUG_REFCOUNT
                printk(KERN_DEBUG "set mp->nccip\n");
 #endif
-#ifdef CONFIG_ISDN_CAPIFS
+#if defined(CONFIG_ISDN_CAPI_CAPIFS) || defined(CONFIG_ISDN_CAPI_CAPIFS_MODULE)
                kdev = MKDEV(capi_rawmajor, mp->minor);
                capifs_new_ncci('r', mp->minor, kdev);
                kdev = MKDEV(capi_ttymajor, mp->minor);
@@ -543,7 +549,7 @@ static void capincci_free(struct capidev *cdev, __u32 ncci)
                        *pp = (*pp)->next;
 #ifdef CONFIG_ISDN_CAPI_MIDDLEWARE
                        if ((mp = np->minorp) != 0) {
-#ifdef CONFIG_ISDN_CAPIFS
+#if defined(CONFIG_ISDN_CAPI_CAPIFS) || defined(CONFIG_ISDN_CAPI_CAPIFS_MODULE)
                                capifs_free_ncci('r', mp->minor);
                                capifs_free_ncci(0, mp->minor);
 #endif
index bf6571856f7b752d40e38875a5d644f04f1dc560..6f7bd4fd0609f13e4d9d5b05d823c7e36e42505c 100644 (file)
@@ -1,11 +1,16 @@
 /*
- * $Id: kcapi.c,v 1.21 2000/11/23 20:45:14 kai Exp $
+ * $Id: kcapi.c,v 1.21.6.1 2000/12/10 23:39:19 kai Exp $
  * 
  * Kernel CAPI 2.0 Module
  * 
  * (c) Copyright 1999 by Carsten Paeth (calle@calle.in-berlin.de)
  * 
  * $Log: kcapi.c,v $
+ * Revision 1.21.6.1  2000/12/10 23:39:19  kai
+ * in 2.4 we don't have tq_scheduler anymore.
+ * also add one supported card to hfc_pci.c
+ * (from main branch)
+ *
  * Revision 1.21  2000/11/23 20:45:14  kai
  * fixed module_init/exit stuff
  * Note: compiled-in kernel doesn't work pre 2.2.18 anymore.
@@ -30,7 +35,7 @@
  * Revision 1.15  2000/04/06 15:01:25  calle
  * Bugfix: crash in capidrv.c when reseting a capi controller.
  * - changed code order on remove of controller.
- * - using tq schedule for notifier in kcapi.c.
+ * - using tq_schedule for notifier in kcapi.c.
  * - now using spin_lock_irqsave() and spin_unlock_irqrestore().
  * strange: sometimes even MP hang on unload of isdn.o ...
  *
 #include <linux/b1lli.h>
 #endif
 
-static char *revision = "$Revision: 1.21 $";
+static char *revision = "$Revision: 1.21.6.1 $";
 
 /* ------------------------------------------------------------- */
 
index 109c900d8ac52c2877ce1ba5795e1dafa620c7aa..88d09095a49b4c822c1df3985954db2ab7bf0923 100644 (file)
@@ -1,19 +1,38 @@
-L_OBJS :=
-LX_OBJS :=
-M_OBJS :=
-MX_OBJS :=
-O_OBJS :=
-OX_OBJS :=
-L_TARGET :=
-O_TARGET :=
-
-O_OBJS += isdn_divert.o divert_procfs.o
-O_TARGET := dss1_divert.o
-M_OBJS += dss1_divert.o
-OX_OBJS += divert_init.o
+#
+# Makefile for the dss1_divert ISDN module
+#
+
+# The target object and module list name.
+
+O_TARGET       :=
+
+# Objects that export symbols.
+
+export-objs    :=
+
+# Multipart objects.
+
+list-multi             := dss1_divert.o
+dss1_divert-objs       := isdn_divert.o divert_procfs.o divert_init.o
+
+# Object file lists.
+
+obj-y  :=
+obj-m  :=
+obj-n  :=
+obj-   :=
+
+# Each configuration option enables a list of files.
+
+obj-m  += dss1_divert.o
 
 include $(TOPDIR)/Rules.make
 
+# Link rules for multi-part drivers.
+
+dss1_divert.o: $(dss1_divert-objs)
+       $(LD) -r -o $@ $(dss1_divert-objs)
+
 
 
 
index 63c557492b4c1722ae4d4bbebba9ef3263ee1240..cd9b2e3fb43cf329122819719685b7294c75e045 100644 (file)
@@ -1,52 +1,50 @@
-L_OBJS :=
-M_OBJS :=
-LX_OBJS :=
-MX_OBJS :=
-O_OBJS :=
-OX_OBJS :=
-L_TARGET :=
-O_TARGET :=
-
-ifeq ($(CONFIG_ISDN_DRV_EICON_STANDALONE),y)
-
- ifeq ($(CONFIG_PCI),y)
-   O_OBJS += common.o idi.o bri.o pri.o log.o xlog.o kprintf.o fpga.o fourbri.o
-   O_OBJS += lincfg.o linchr.o linsys.o linio.o
-   O_OBJS += fcheck.o
-   OX_OBJS += Divas_mod.o
- endif
-
-else
-
- OX_OBJS += eicon_mod.o
- O_OBJS := eicon_isa.o eicon_pci.o eicon_idi.o eicon_io.o
- O_OBJS += fcheck.o
- ifeq ($(CONFIG_PCI),y)
-  ifeq ($(CONFIG_ISDN_DRV_EICON_PCI),y)
-   O_OBJS += common.o idi.o bri.o pri.o log.o xlog.o kprintf.o fpga.o fourbri.o
-   O_OBJS += lincfg.o linchr.o linsys.o linio.o
-  endif
- endif
-
-endif
-
-O_TARGET :=
-
-ifeq ($(CONFIG_ISDN_DRV_EICON),y)
-  O_TARGET += eicon.o
-else
-  O_TARGET += eicon.o
-  M_OBJS   = eicon.o
-endif
+# Makefile for the eicon ISDN device driver
 
+# The target object and module list name.
+
+O_TARGET       := eicon_drv.o
+
+# Objects that export symbols.
+
+export-objs    := Divas_mod.o eicon_mod.o
+
+# Multipart objects.
+
+list-multi     := eicon.o divas.o
+eicon-objs     := eicon_mod.o eicon_isa.o eicon_pci.o eicon_idi.o \
+                  eicon_io.o fcheck.o
+divas-objs     := common.o idi.o bri.o pri.o log.o xlog.o kprintf.o fpga.o \
+                  fourbri.o lincfg.o linchr.o linsys.o linio.o fcheck.o \
+                  Divas_mod.o
+
+# Optional parts of multipart objects.
+
+eicon-objs-$(CONFIG_ISDN_DRV_EICON_PCI) += common.o idi.o bri.o pri.o log.o \
+                  xlog.o kprintf.o fpga.o fourbri.o lincfg.o linchr.o \
+                  linsys.o linio.o
+
+eicon-objs     += $(eicon-objs-y)
+
+# Object file lists.
+
+obj-y  :=
+obj-m  :=
+obj-n  :=
+obj-   :=
+
+# Each configuration option enables a list of files.
+
+obj-$(CONFIG_ISDN_DRV_EICON_OLD)       += eicon.o
+obj-$(CONFIG_ISDN_DRV_EICON_DIVAS)     += divas.o
 
 include $(TOPDIR)/Rules.make
 
-MD5FILES += common.c idi.c bri.c pri.c log.c xlog.c kprintf.c fpga.c \
-            fourbri.c fcheck.c
+# Link rules for multi-part drivers.
+
+eicon.o: $(eicon-objs)
+       $(LD) -r -o $@ $(eicon-objs)
 
-FCHECK = $(shell md5sum -c md5sums.asc >> /dev/null;echo $$?)
+divas.o: $(divas-objs)
+       $(LD) -r -o $@ $(divas-objs)
 
-fcheck.o: $(MD5FILES)
-       $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -D FILECHECK=$(FCHECK) -c -o fcheck.o fcheck.c
 
index 071e3b1caa1d5667e5e4d36fab1369bd17cf5468..a7904f0c927bdef7a7b0d7b2b9272cc2adef53b3 100644 (file)
-L_OBJS :=
-M_OBJS :=
-LX_OBJS :=
-MX_OBJS :=
-O_OBJS :=
-OX_OBJS :=
-L_TARGET :=
-O_TARGET :=
-
-O_OBJS := isdnl1.o tei.o isdnl2.o isdnl3.o \
-          lmgr.o q931.o callc.o fsm.o cert.o
-
-# EXTRA_CFLAGS += -S
-
-ifeq ($(CONFIG_HISAX_EURO),y)
-        O_OBJS += l3dss1.o
-endif
-
-ifeq ($(CONFIG_HISAX_NI1),y)
-       O_OBJS += l3ni1.o
-endif
-
-ifeq ($(CONFIG_HISAX_1TR6),y)
-        O_OBJS += l3_1tr6.o
-endif
-
-ISAC_OBJ :=
-HSCX_OBJ :=
-ISAR_OBJ :=
-HFC_OBJ :=
-HFC_2BDS0 :=
-JADE_OBJ :=
-W6692_OBJ :=
-NETJ_OBJ :=
-ICC_OBJ :=
-
-ifeq ($(CONFIG_HISAX_16_0),y)
-        O_OBJS += teles0.o
-        ISAC_OBJ := isac.o
-        HSCX_OBJ := hscx.o
-endif
-
-ifeq ($(CONFIG_HISAX_16_3),y)
-        O_OBJS += teles3.o
-        ISAC_OBJ := isac.o
-        HSCX_OBJ := hscx.o
-endif
-
-ifeq ($(CONFIG_HISAX_TELESPCI),y)
-        O_OBJS += telespci.o
-        ISAC_OBJ := isac.o
-        HSCX_OBJ := hscx.o
-endif
-
-ifeq ($(CONFIG_HISAX_S0BOX),y)
-        O_OBJS += s0box.o
-        ISAC_OBJ := isac.o
-        HSCX_OBJ := hscx.o
-endif
-
-ifeq ($(CONFIG_HISAX_AVM_A1),y)
-        O_OBJS += avm_a1.o
-        ISAC_OBJ := isac.o
-        HSCX_OBJ := hscx.o
-endif
-
-ifeq ($(CONFIG_HISAX_AVM_A1_PCMCIA),y)
-        O_OBJS += avm_a1p.o
-        ISAC_OBJ := isac.o
-        HSCX_OBJ := hscx.o
-endif
-ifeq ($(CONFIG_HISAX_FRITZPCI),y)
-        O_OBJS += avm_pci.o
-        ISAC_OBJ := isac.o
-endif
-
-
-ifeq ($(CONFIG_HISAX_ELSA),y)
-        O_OBJS += elsa.o
-        ISAC_OBJ := isac.o
-        HSCX_OBJ := hscx.o
-endif
-
-ifeq ($(CONFIG_HISAX_IX1MICROR2),y)
-        O_OBJS += ix1_micro.o
-        ISAC_OBJ := isac.o
-        HSCX_OBJ := hscx.o
-endif
-
-ifeq ($(CONFIG_HISAX_DIEHLDIVA),y)
-        O_OBJS += diva.o
-        ISAC_OBJ := isac.o
-        HSCX_OBJ := hscx.o
-endif
-
-ifeq ($(CONFIG_HISAX_ASUSCOM),y)
-        O_OBJS += asuscom.o
-        ISAC_OBJ := isac.o
-        HSCX_OBJ := hscx.o
-endif
-
-ifeq ($(CONFIG_HISAX_TELEINT),y)
-        O_OBJS += teleint.o
-        ISAC_OBJ := isac.o
-        HFC_OBJ := hfc_2bs0.o
-endif
-
-ifeq ($(CONFIG_HISAX_SEDLBAUER),y)
-        O_OBJS += sedlbauer.o
-        ISAC_OBJ := isac.o
-        HSCX_OBJ := hscx.o
-        ISAR_OBJ := isar.o
-endif
-
-ifeq ($(CONFIG_HISAX_SPORTSTER),y)
-        O_OBJS += sportster.o
-        ISAC_OBJ := isac.o
-        HSCX_OBJ := hscx.o
-endif
-
-ifeq ($(CONFIG_HISAX_MIC),y)
-        O_OBJS += mic.o
-        ISAC_OBJ := isac.o
-        HSCX_OBJ := hscx.o
-endif
-
-ifeq ($(CONFIG_HISAX_NETJET),y)
-        O_OBJS += nj_s.o
-        NETJ_OBJ := netjet.o
-        ISAC_OBJ := isac.o
-endif
-
-ifeq ($(CONFIG_HISAX_NETJET_U),y)
-        O_OBJS += nj_u.o
-        NETJ_OBJ := netjet.o
-        ICC_OBJ := icc.o
-endif
-
-ifeq ($(CONFIG_HISAX_HFCS),y)
-        O_OBJS += hfcscard.o
-        HFC_2BDS0 := hfc_2bds0.o
-endif
-
-ifeq ($(CONFIG_HISAX_HFC_PCI),y)
-        HFC_2BDS0 += hfc_pci.o
-endif
-
-ifeq ($(CONFIG_HISAX_HFC_SX),y)
-        HFC_2BDS0 += hfc_sx.o
-endif
-
-ifeq ($(CONFIG_HISAX_NICCY),y)
-        O_OBJS += niccy.o
-        ISAC_OBJ := isac.o
-        HSCX_OBJ := hscx.o
-endif
-
-ifeq ($(CONFIG_HISAX_ISURF),y)
-        O_OBJS += isurf.o
-        ISAC_OBJ := isac.o
-        ISAR_OBJ := isar.o
-endif
-
-ifeq ($(CONFIG_HISAX_HSTSAPHIR),y)
-        O_OBJS += saphir.o
-        ISAC_OBJ := isac.o
-        HSCX_OBJ := hscx.o
-endif
-
-ifeq ($(CONFIG_HISAX_BKM_A4T),y)
-        O_OBJS += bkm_a4t.o
-        ISAC_OBJ := isac.o
-        JADE_OBJ := jade.o
-endif
-ifeq ($(CONFIG_HISAX_SCT_QUADRO),y)
-        O_OBJS += bkm_a8.o
-        ISAC_OBJ := isac.o
-        HSCX_OBJ := hscx.o
-endif
-
-ifeq ($(CONFIG_HISAX_GAZEL),y)
-        O_OBJS += gazel.o
-        ISAC_OBJ := isac.o
-        HSCX_OBJ := hscx.o
-endif
-
-ifeq ($(CONFIG_HISAX_W6692),y)
-       W6692_OBJ := w6692.o
-endif
-
-# ifeq ($(CONFIG_HISAX_TESTEMU),y)
-#       O_OBJS += testemu.o
-# endif
-
-ifeq ($(ISAC_OBJ), isac.o)
-       ISAC_OBJ += arcofi.o
-endif
-
-O_OBJS += $(ISAC_OBJ) $(HSCX_OBJ) $(ISAR_OBJ) $(JADE_OBJ)
-O_OBJS += $(HFC_OBJ) $(HFC_2BDS0) $(W6692_OBJ) $(NETJ_OBJ) $(ICC_OBJ)
-OX_OBJS += config.o
-
-O_TARGET :=
-
-ifeq ($(CONFIG_ISDN_DRV_HISAX),y)
-  O_TARGET += hisax.o
-else
-  ifeq ($(CONFIG_ISDN_DRV_HISAX),m)
-    O_TARGET += hisax.o
-    M_OBJS += hisax.o
-  endif
-endif
-
+# Makefile for the hisax ISDN device driver
+
+# The target object and module list name.
+
+O_TARGET       := hisax_drv.o
+
+# Objects that export symbols.
+
+export-objs    := config.o
+
+# Multipart objects.
+
+list-multi     := hisax.o
+hisax-objs     := config.o isdnl1.o tei.o isdnl2.o isdnl3.o \
+                  lmgr.o q931.o callc.o fsm.o cert.o
+
+# Optional parts of multipart objects.
+
+hisax-objs-$(CONFIG_HISAX_EURO) += l3dss1.o
+hisax-objs-$(CONFIG_HISAX_NI1) += l3ni1.o
+hisax-objs-$(CONFIG_HISAX_1TR6) += l3_1tr6.o
+
+hisax-objs-$(CONFIG_HISAX_16_0) += teles0.o isac.o arcofi.o hscx.o
+hisax-objs-$(CONFIG_HISAX_16_3) += teles3.o isac.o arcofi.o hscx.o
+hisax-objs-$(CONFIG_HISAX_TELESPCI) += telespci.o isac.o arcofi.o hscx.o
+hisax-objs-$(CONFIG_HISAX_S0BOX) += s0box.o isac.o arcofi.o hscx.o
+hisax-objs-$(CONFIG_HISAX_AVM_A1) += avm_a1.o isac.o arcofi.o hscx.o
+hisax-objs-$(CONFIG_HISAX_AVM_A1_PCMCIA) += avm_a1p.o isac.o arcofi.o hscx.o
+hisax-objs-$(CONFIG_HISAX_FRITZPCI) += avm_pci.o isac.o arcofi.o
+hisax-objs-$(CONFIG_HISAX_AVM_A1) += avm_a1.o isac.o arcofi.o hscx.o
+hisax-objs-$(CONFIG_HISAX_ELSA) += elsa.o isac.o arcofi.o hscx.o
+hisax-objs-$(CONFIG_HISAX_IX1MICROR2) += ix1_micro.o isac.o arcofi.o hscx.o
+hisax-objs-$(CONFIG_HISAX_DIEHLDIVA) += diva.o isac.o arcofi.o hscx.o
+hisax-objs-$(CONFIG_HISAX_ASUSCOM) += asuscom.o isac.o arcofi.o hscx.o
+hisax-objs-$(CONFIG_HISAX_TELEINT) += teleint.o isac.o arcofi.o hfc_2bs0.o
+hisax-objs-$(CONFIG_HISAX_SEDLBAUER) += sedlbauer.o isac.o arcofi.o hscx.o isar.o
+hisax-objs-$(CONFIG_HISAX_SPORTSTER) += sportster.o isac.o arcofi.o hfc_2bs0.o
+hisax-objs-$(CONFIG_HISAX_MIC) += mic.o isac.o arcofi.o hfc_2bs0.o
+hisax-objs-$(CONFIG_HISAX_NETJET) += nj_s.o netjet.o isac.o arcofi.o
+hisax-objs-$(CONFIG_HISAX_NETJET_U) += nj_u.o netjet.o icc.o
+hisax-objs-$(CONFIG_HISAX_HFCS) += hfcscard.o hfc_2bds0.o
+hisax-objs-$(CONFIG_HISAX_HFC_PCI) += hfc_pci.o
+hisax-objs-$(CONFIG_HISAX_HFC_SX) += hfc_sx.o
+hisax-objs-$(CONFIG_HISAX_NICCY) += niccy.o isac.o arcofi.o hscx.o
+hisax-objs-$(CONFIG_HISAX_ISURF) += isurf.o isac.o arcofi.o isar.o
+hisax-objs-$(CONFIG_HISAX_HSTSAPHIR) += saphir.o isac.o arcofi.o hscx.o
+hisax-objs-$(CONFIG_HISAX_BKM_A4T) += bkm_a4t.o isac.o arcofi.o jade.o
+hisax-objs-$(CONFIG_HISAX_SCT_QUADRO) += bkm_a8.o isac.o arcofi.o hscx.o
+hisax-objs-$(CONFIG_HISAX_GAZEL) += gazel.o isac.o arcofi.o hscx.o
+hisax-objs-$(CONFIG_HISAX_W6692) += w6692.o
+#hisax-objs-$(CONFIG_HISAX_TESTEMU) += testemu.o
+
+hisax-objs += $(sort $(hisax-objs-y))
+
+# Object file lists.
+
+obj-y  :=
+obj-m  :=
+obj-n  :=
+obj-   :=
+
+# Each configuration option enables a list of files.
+
+obj-$(CONFIG_ISDN_DRV_HISAX)   += hisax.o
 
 include $(TOPDIR)/Rules.make
 
+# Link rules for multi-part drivers.
+
+hisax.o: $(hisax-objs)
+       $(LD) -r -o $@ $(hisax-objs)
+
 MD5FILES += isac.c isdnl1.c isdnl2.c isdnl3.c \
            tei.c callc.c cert.c l3dss1.c l3_1tr6.c \
            elsa.c diva.c sedlbauer.c
index f25e2a159fa15056ffb9e1f2ae118dbecfe1a787..0b60e89b3d9047e6835d21a18545a5bd8e6a39f4 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: config.c,v 2.57.6.3 2000/11/29 17:48:59 kai Exp $
+/* $Id: config.c,v 2.57.6.6 2000/12/10 23:39:19 kai Exp $
  *
  * Author       Karsten Keil (keil@isdn4linux.de)
  *              based on the teles driver from Jan den Ouden
@@ -1180,7 +1180,6 @@ checkcard(int cardnr, char *id, int *busy_flag)
        cs->tx_skb = NULL;
        cs->tx_cnt = 0;
        cs->event = 0;
-       INIT_LIST_HEAD(&cs->tqueue.list);
        cs->tqueue.sync = 0;
        cs->tqueue.data = cs;
 
@@ -1756,6 +1755,7 @@ static struct pci_device_id hisax_pci_tbl[] __initdata = {
        {PCI_VENDOR_ID_CCD,      PCI_DEVICE_ID_CCD_B00B,         PCI_ANY_ID, PCI_ANY_ID},
        {PCI_VENDOR_ID_CCD,      PCI_DEVICE_ID_CCD_B00C,         PCI_ANY_ID, PCI_ANY_ID},
        {PCI_VENDOR_ID_CCD,      PCI_DEVICE_ID_CCD_B100,         PCI_ANY_ID, PCI_ANY_ID},
+       {PCI_VENDOR_ID_ABOCOM,   PCI_DEVICE_ID_ABOCOM_2BD1,      PCI_ANY_ID, PCI_ANY_ID},
        {PCI_VENDOR_ID_ASUSTEK,  PCI_DEVICE_ID_ASUSTEK_0675,     PCI_ANY_ID, PCI_ANY_ID},
        {PCI_VENDOR_ID_BERKOM,   PCI_DEVICE_ID_BERKOM_T_CONCEPT, PCI_ANY_ID, PCI_ANY_ID},
        {PCI_VENDOR_ID_BERKOM,   PCI_DEVICE_ID_BERKOM_A1T,       PCI_ANY_ID, PCI_ANY_ID},
diff --git a/drivers/isdn/hisax/foreign.c b/drivers/isdn/hisax/foreign.c
deleted file mode 100644 (file)
index b8ffa49..0000000
+++ /dev/null
@@ -1,780 +0,0 @@
-/* $Id: foreign.c,v 1.1 1998/11/09 07:48:48 baccala Exp $
- *
- * HiSax ISDN driver - foreign chipset interface
- *
- * Author       Brent Baccala (baccala@FreeSoft.org)
- *
- *
- *
- * $Log: foreign.c,v $
- * Revision 1.1  1998/11/09 07:48:48  baccala
- * Initial DBRI ISDN code.  Sometimes works (brings up the link and you
- * can telnet through it), sometimes doesn't (crashes the machine)
- *
- * Revision 1.2  1998/02/12 23:07:10  keil
- * change for 2.1.86 (removing FREE_READ/FREE_WRITE from [dev]_kfree_skb()
- *
- * Revision 1.1  1998/02/03 23:20:51  keil
- * New files for SPARC isdn support
- *
- * Revision 1.1  1998/01/08 04:17:12  baccala
- * ISDN comes to the Sparc.  Key points:
- *
- *    - Existing ISDN HiSax driver provides all the smarts
- *    - it compiles, runs, talks to an isolated phone switch, connects
- *      to a Cisco, pings go through
- *    - AMD 7930 support only (no DBRI yet)
- *    - no US NI-1 support (may not work on US phone system - untested)
- *    - periodic packet loss, apparently due to lost interrupts
- *    - ISDN sometimes freezes, requiring reboot before it will work again
- *
- * The code is unreliable enough to be consider alpha
- *
- *
- * 
- */
-
-#define __NO_VERSION__
-#include "hisax.h"
-#include "isac.h"
-#include "isdnl1.h"
-#include "foreign.h"
-#include "rawhdlc.h"
-#include <linux/interrupt.h>
-
-static const char *foreign_revision = "$Revision: 1.1 $";
-
-#define RCV_BUFSIZE    1024    /* Size of raw receive buffer in bytes */
-#define RCV_BUFBLKS    4       /* Number of blocks to divide buffer into
-                                * (must divide RCV_BUFSIZE) */
-
-static void Bchan_fill_fifo(struct BCState *, struct sk_buff *);
-
-static void
-Bchan_xmt_bh(struct BCState *bcs)
-{
-       struct sk_buff *skb;
-
-       if (bcs->hw.foreign.tx_skb != NULL) {
-               dev_kfree_skb(bcs->hw.foreign.tx_skb);
-               bcs->hw.foreign.tx_skb = NULL;
-       }
-
-       if ((skb = skb_dequeue(&bcs->squeue))) {
-               Bchan_fill_fifo(bcs, skb);
-       } else {
-               clear_bit(BC_FLG_BUSY, &bcs->Flag);
-               bcs->event |= 1 << B_XMTBUFREADY;
-               queue_task(&bcs->tqueue, &tq_immediate);
-               mark_bh(IMMEDIATE_BH);
-       }
-}
-
-static void
-Bchan_xmit_callback(struct BCState *bcs)
-{
-       queue_task(&bcs->hw.foreign.tq_xmt, &tq_immediate);
-       mark_bh(IMMEDIATE_BH);
-}
-
-/* B channel transmission: two modes (three, if you count L1_MODE_NULL)
- *
- * L1_MODE_HDLC - We need to do HDLC encapsulation before transmiting
- * the packet (i.e. make_raw_hdlc_data).  Since this can be a
- * time-consuming operation, our completion callback just schedules
- * a bottom half to do encapsulation for the next packet.  In between,
- * the link will just idle
- *
- * L1_MODE_TRANS - Data goes through, well, transparent.  No HDLC encap,
- * and we can't just let the link idle, so the "bottom half" actually
- * gets called during the top half (it's our callback routine in this case),
- * but it's a lot faster now since we don't call make_raw_hdlc_data
- */
-
-static void
-Bchan_fill_fifo(struct BCState *bcs, struct sk_buff *skb)
-{
-       struct IsdnCardState *cs = bcs->cs;
-       struct foreign_hw *hw = &bcs->hw.foreign;
-       int len;
-
-       if ((cs->debug & L1_DEB_HSCX) || (cs->debug & L1_DEB_HSCX_FIFO)) {
-               char tmp[2048];
-               char *t = tmp;
-
-               t += sprintf(t, "Bchan_fill_fifo %c cnt %d",
-                            bcs->channel ? 'B' : 'A', skb->len);
-               if (cs->debug & L1_DEB_HSCX_FIFO)
-                       QuickHex(t, skb->data, skb->len);
-               debugl1(cs, tmp);
-       }
-
-       if (hw->doHDLCprocessing) {
-               len = make_raw_hdlc_data(skb->data, skb->len,
-                                        bcs->hw.foreign.tx_buff, RAW_BUFMAX);
-               if (len > 0)
-                       cs->hw.foreign->bxmit(0, bcs->channel,
-                                              bcs->hw.foreign.tx_buff, len,
-                                              (void *) &Bchan_xmit_callback,
-                                              (void *) bcs);
-               dev_kfree_skb(skb);
-       } else {
-               cs->hw.foreign->bxmit(0, bcs->channel,
-                                      skb->data, skb->len,
-                                      (void *) &Bchan_xmit_callback,
-                                      (void *) bcs);
-               bcs->hw.foreign.tx_skb = skb;
-       }
-}
-
-static void
-Bchan_mode(struct BCState *bcs, int mode, int bc)
-{
-       struct IsdnCardState *cs = bcs->cs;
-
-       if (cs->debug & L1_DEB_HSCX) {
-               char tmp[40];
-               sprintf(tmp, "foreign mode %d bchan %d/%d",
-                       mode, bc, bcs->channel);
-               debugl1(cs, tmp);
-       }
-       bcs->mode = mode;
-}
-
-/* Bchan_l2l1 is the entry point for upper layer routines that want to
- * transmit on the B channel.  PH_DATA_REQ is a normal packet that
- * we either start transmitting (if idle) or queue (if busy).
- * PH_PULL_REQ can be called to request a callback message (PH_PULL_CNF)
- * once the link is idle.  After a "pull" callback, the upper layer
- * routines can use PH_PULL_IND to send data.
- */
-
-static void
-Bchan_l2l1(struct PStack *st, int pr, void *arg)
-{
-       struct sk_buff *skb = arg;
-
-       switch (pr) {
-               case (PH_DATA_REQ):
-                       if (test_bit(BC_FLG_BUSY, &st->l1.bcs->Flag)) {
-                               skb_queue_tail(&st->l1.bcs->squeue, skb);
-                       } else {
-                               test_and_set_bit(BC_FLG_BUSY, &st->l1.bcs->Flag);
-                               Bchan_fill_fifo(st->l1.bcs, skb);
-                       }
-                       break;
-               case (PH_PULL_IND):
-                       if (test_bit(BC_FLG_BUSY, &st->l1.bcs->Flag)) {
-                               printk(KERN_WARNING "foreign: this shouldn't happen\n");
-                               break;
-                       }
-                       test_and_set_bit(BC_FLG_BUSY, &st->l1.bcs->Flag);
-                       Bchan_fill_fifo(st->l1.bcs, skb);
-                       break;
-               case (PH_PULL_REQ):
-                       if (!test_bit(BC_FLG_BUSY, &st->l1.bcs->Flag)) {
-                               clear_bit(FLG_L1_PULL_REQ, &st->l1.Flags);
-                               st->l1.l1l2(st, PH_PULL_CNF, NULL);
-                       } else
-                               set_bit(FLG_L1_PULL_REQ, &st->l1.Flags);
-                       break;
-       }
-}
-
-/*
-****************************************************************************
-***************** Receiver callback and bottom half ************************
-****************************************************************************
-*/
-
-/* Bchan_recv_done() is called when a frame has been completely decoded
- * into hw->rv_skb and we're ready to hand it off to the HiSax upper
- * layer.  If a "large" packet is received, stick rv_skb on the
- * receive queue and alloc a new (large) skb to act as buffer for
- * future receives.  If a small packet is received, leave rv_skb
- * alone, alloc a new skb of the correct size, and copy the packet
- * into it.  In any case, flag the channel as B_RCVBUFREADY and
- * queue the upper layer's task.
- */
-
-static void
-Bchan_recv_done(struct BCState *bcs, unsigned int len)
-{
-       struct IsdnCardState *cs = bcs->cs;
-       struct foreign_hw *hw = &bcs->hw.foreign;
-       struct sk_buff *skb;
-
-       if (cs->debug & L1_DEB_HSCX_FIFO) {
-               char tmp[2048];
-               char *t = tmp;
-
-               t += sprintf(t, "Bchan_rcv %c cnt %d (%x)", bcs->channel ? 'B' : 'A', len, hw->rv_skb->tail);
-               QuickHex(t, hw->rv_skb->tail, len);
-               debugl1(cs, tmp);
-       }
-
-       if (len > HSCX_BUFMAX/2) {
-               /* Large packet received */
-
-               if (!(skb = dev_alloc_skb(HSCX_BUFMAX))) {
-                       printk(KERN_WARNING "foreign: receive out of memory\n");
-               } else {
-                       skb_put(hw->rv_skb, len);
-                       skb_queue_tail(&bcs->rqueue, hw->rv_skb);
-                       hw->rv_skb = skb;
-
-                       bcs->event |= 1 << B_RCVBUFREADY;
-                       queue_task(&bcs->tqueue, &tq_immediate);
-                       mark_bh(IMMEDIATE_BH);
-               }
-       } else {
-               /* Small packet received */
-
-               if (!(skb = dev_alloc_skb(len))) {
-                       printk(KERN_WARNING "foreign: receive out of memory\n");
-               } else {
-                       memcpy(skb_put(skb, len), hw->rv_skb->tail, len);
-                       skb_queue_tail(&bcs->rqueue, skb);
-
-                       bcs->event |= 1 << B_RCVBUFREADY;
-                       queue_task(&bcs->tqueue, &tq_immediate);
-                       mark_bh(IMMEDIATE_BH);
-               }
-       }
-}
-
-/* Bchan_recv_callback()'s behavior depends on whether we're doing local
- * HDLC processing.  If so, receive into hw->rv_buff and queue Bchan_rcv_bh
- * to decode the HDLC at leisure.  Otherwise, receive directly into hw->rv_skb
- * and call Bchan_recv_done().  In either case, prepare a new buffer for
- * further receives and hand it to the hardware driver.
- */
-
-static void
-Bchan_recv_callback(struct BCState *bcs, int error, unsigned int len)
-{
-       struct IsdnCardState *cs = bcs->cs;
-       struct foreign_hw *hw = &bcs->hw.foreign;
-
-       if (hw->doHDLCprocessing) {
-
-               hw->rv_buff_in += RCV_BUFSIZE/RCV_BUFBLKS;
-               hw->rv_buff_in %= RCV_BUFSIZE;
-
-               if (hw->rv_buff_in != hw->rv_buff_out) {
-                       cs->hw.foreign->brecv(0, bcs->channel,
-                                             hw->rv_buff + hw->rv_buff_in,
-                                             RCV_BUFSIZE/RCV_BUFBLKS,
-                                             (void *) &Bchan_recv_callback,
-                                             (void *) bcs);
-
-               }
-               queue_task(&hw->tq_rcv, &tq_immediate);
-               mark_bh(IMMEDIATE_BH);
-
-       } else {
-               if (error) {
-                       char tmp[256];
-                       sprintf(tmp, "B channel %c receive error %x",
-                               bcs->channel ? 'B' : 'A', error);
-                       debugl1(cs, tmp);
-               } else {
-                       Bchan_recv_done(bcs, len);
-               }
-               cs->hw.foreign->brecv(0, bcs->channel,
-                                     hw->rv_skb->tail, HSCX_BUFMAX,
-                                     (void *) &Bchan_recv_callback,
-                                     (void *) bcs);
-
-       }
-}
-
-/* Bchan_rcv_bh() is a "shim" bottom half handler stuck in between
- * Bchan_recv_callback() and the HiSax upper layer if we need to
- * do local HDLC processing.
- */
-
-static void
-Bchan_rcv_bh(struct BCState *bcs)
-{
-       struct IsdnCardState *cs = bcs->cs;
-       struct foreign_hw *hw = &bcs->hw.foreign;
-       struct sk_buff *skb;
-       int len;
-
-       if (cs->debug & L1_DEB_HSCX) {
-               char tmp[1024];
-
-               sprintf(tmp, "foreign_Bchan_rcv (%d/%d)",
-                       hw->rv_buff_in, hw->rv_buff_out);
-               debugl1(cs, tmp);
-       }
-
-       do {
-               if (cs->debug & L1_DEB_HSCX) {
-                       char tmp[1024];
-
-                       QuickHex(tmp, hw->rv_buff + hw->rv_buff_out,
-                                RCV_BUFSIZE/RCV_BUFBLKS);
-                       debugl1(cs, tmp);
-               }
-
-               while ((len = read_raw_hdlc_data(hw->hdlc_state,
-                                                hw->rv_buff + hw->rv_buff_out, RCV_BUFSIZE/RCV_BUFBLKS,
-                                                hw->rv_skb->tail, HSCX_BUFMAX))) {
-                       if (len > 0) {
-                               Bchan_recv_done(bcs, len);
-                       } else {
-                               char tmp[256];
-                               sprintf(tmp, "B channel %c receive error",
-                                       bcs->channel ? 'B' : 'A');
-                               debugl1(cs, tmp);
-                       }
-               }
-
-               if (hw->rv_buff_in == hw->rv_buff_out) {
-                       /* Buffer was filled up - need to restart receiver */
-                       cs->hw.foreign->brecv(0, bcs->channel,
-                                              hw->rv_buff + hw->rv_buff_in,
-                                              RCV_BUFSIZE/RCV_BUFBLKS,
-                                              (void *) &Bchan_recv_callback,
-                                              (void *) bcs);
-               }
-
-               hw->rv_buff_out += RCV_BUFSIZE/RCV_BUFBLKS;
-               hw->rv_buff_out %= RCV_BUFSIZE;
-
-       } while (hw->rv_buff_in != hw->rv_buff_out);
-}
-
-static void
-Bchan_close(struct BCState *bcs)
-{
-       struct IsdnCardState *cs = bcs->cs;
-       struct sk_buff *skb;
-
-       Bchan_mode(bcs, 0, 0);
-       cs->hw.foreign->bclose(0, bcs->channel);
-
-       if (test_bit(BC_FLG_INIT, &bcs->Flag)) {
-               while ((skb = skb_dequeue(&bcs->rqueue))) {
-                       dev_kfree_skb(skb);
-               }
-               while ((skb = skb_dequeue(&bcs->squeue))) {
-                       dev_kfree_skb(skb);
-               }
-       }
-       test_and_clear_bit(BC_FLG_INIT, &bcs->Flag);
-}
-
-static int
-Bchan_open(struct BCState *bcs)
-{
-       struct IsdnCardState *cs = bcs->cs;
-       struct foreign_hw *hw = &bcs->hw.foreign;
-
-       if (!test_and_set_bit(BC_FLG_INIT, &bcs->Flag)) {
-               skb_queue_head_init(&bcs->rqueue);
-               skb_queue_head_init(&bcs->squeue);
-       }
-       test_and_clear_bit(BC_FLG_BUSY, &bcs->Flag);
-
-       hw->doHDLCprocessing = 0;
-       if (bcs->mode == L1_MODE_HDLC) {
-               if (cs->hw.foreign->bopen(0, bcs->channel, 1, 0xff) == -1) {
-                       if (cs->hw.foreign->bopen(0, bcs->channel, 0, 0xff) == -1) {
-                               return (-1);
-                       }
-                       hw->doHDLCprocessing = 1;
-               }
-       } else {
-               if (cs->hw.foreign->bopen(0, bcs->channel, 0, 0xff) == -1) {
-                       return (-1);
-               }
-       }
-
-       hw->rv_buff_in = 0;
-       hw->rv_buff_out = 0;
-       hw->tx_skb = NULL;
-       init_hdlc_state(hw->hdlc_state, 0);
-       cs->hw.foreign->brecv(0, bcs->channel,
-                              hw->rv_buff + hw->rv_buff_in,
-                              RCV_BUFSIZE/RCV_BUFBLKS,
-                              (void *) &Bchan_recv_callback, (void *) bcs);
-
-       bcs->event = 0;
-       bcs->tx_cnt = 0;
-       return (0);
-}
-
-static void
-Bchan_init(struct BCState *bcs)
-{
-       if (!(bcs->hw.foreign.tx_buff = kmalloc(RAW_BUFMAX, GFP_ATOMIC))) {
-               printk(KERN_WARNING
-                      "HiSax: No memory for foreign.tx_buff\n");
-               return;
-       }
-       if (!(bcs->hw.foreign.rv_buff = kmalloc(RCV_BUFSIZE, GFP_ATOMIC))) {
-               printk(KERN_WARNING
-                      "HiSax: No memory for foreign.rv_buff\n");
-               return;
-       }
-       if (!(bcs->hw.foreign.rv_skb = dev_alloc_skb(HSCX_BUFMAX))) {
-               printk(KERN_WARNING
-                      "HiSax: No memory for foreign.rv_skb\n");
-               return;
-       }
-       if (!(bcs->hw.foreign.hdlc_state = kmalloc(sizeof(struct hdlc_state),
-                                                  GFP_ATOMIC))) {
-               printk(KERN_WARNING
-                      "HiSax: No memory for foreign.hdlc_state\n");
-               return;
-       }
-
-       bcs->hw.foreign.tq_rcv.sync = 0;
-       bcs->hw.foreign.tq_rcv.routine = (void (*)(void *)) &Bchan_rcv_bh;
-       bcs->hw.foreign.tq_rcv.data = (void *) bcs;
-
-       bcs->hw.foreign.tq_xmt.sync = 0;
-       bcs->hw.foreign.tq_xmt.routine = (void (*)(void *)) &Bchan_xmt_bh;
-       bcs->hw.foreign.tq_xmt.data = (void *) bcs;
-}
-
-static void
-Bchan_manl1(struct PStack *st, int pr,
-         void *arg)
-{
-       switch (pr) {
-               case (PH_ACTIVATE_REQ):
-                       test_and_set_bit(BC_FLG_ACTIV, &st->l1.bcs->Flag);
-                       Bchan_mode(st->l1.bcs, st->l1.mode, st->l1.bc);
-                       st->l1.l1man(st, PH_ACTIVATE_CNF, NULL);
-                       break;
-               case (PH_DEACTIVATE_REQ):
-                       if (!test_bit(BC_FLG_BUSY, &st->l1.bcs->Flag))
-                               Bchan_mode(st->l1.bcs, 0, 0);
-                       test_and_clear_bit(BC_FLG_ACTIV, &st->l1.bcs->Flag);
-                       break;
-       }
-}
-
-int
-setstack_foreign(struct PStack *st, struct BCState *bcs)
-{
-       if (Bchan_open(bcs))
-               return (-1);
-       st->l1.bcs = bcs;
-       st->l2.l2l1 = Bchan_l2l1;
-       st->ma.manl1 = Bchan_manl1;
-       setstack_manager(st);
-       bcs->st = st;
-       return (0);
-}
-
-
-static void
-foreign_drecv_callback(void *arg, int error, unsigned int count)
-{
-       struct IsdnCardState *cs = (struct IsdnCardState *) arg;
-       static struct tq_struct task = {0, 0, (void *) &DChannel_proc_rcv, 0};
-       struct sk_buff *skb;
-
-        /* NOTE: This function is called directly from an interrupt handler */
-
-       if (1) {
-               if (!(skb = alloc_skb(count, GFP_ATOMIC)))
-                       printk(KERN_WARNING "HiSax: D receive out of memory\n");
-               else {
-                       memcpy(skb_put(skb, count), cs->rcvbuf, count);
-                       skb_queue_tail(&cs->rq, skb);
-               }
-
-               task.data = (void *) cs;
-               queue_task(&task, &tq_immediate);
-               mark_bh(IMMEDIATE_BH);
-       }
-
-       if (cs->debug & L1_DEB_ISAC_FIFO) {
-               char tmp[128];
-               char *t = tmp;
-
-               t += sprintf(t, "foreign Drecv cnt %d", count);
-               if (error) t += sprintf(t, " ERR %x", error);
-               QuickHex(t, cs->rcvbuf, count);
-               debugl1(cs, tmp);
-       }
-
-       cs->hw.foreign->drecv(0, cs->rcvbuf, MAX_DFRAME_LEN,
-                     &foreign_drecv_callback, cs);
-}
-
-static void
-foreign_dxmit_callback(void *arg, int error)
-{
-       struct IsdnCardState *cs = (struct IsdnCardState *) arg;
-       static struct tq_struct task = {0, 0, (void *) &DChannel_proc_xmt, 0};
-
-        /* NOTE: This function is called directly from an interrupt handler */
-
-       /* may wish to do retransmission here, if error indicates collision */
-
-       if (cs->debug & L1_DEB_ISAC_FIFO) {
-               char tmp[128];
-               char *t = tmp;
-
-               t += sprintf(t, "foreign Dxmit cnt %d", cs->tx_skb->len);
-               if (error) t += sprintf(t, " ERR %x", error);
-               QuickHex(t, cs->tx_skb->data, cs->tx_skb->len);
-               debugl1(cs, tmp);
-       }
-
-       cs->tx_skb = NULL;
-
-       task.data = (void *) cs;
-       queue_task(&task, &tq_immediate);
-       mark_bh(IMMEDIATE_BH);
-}
-
-static void
-foreign_Dchan_l2l1(struct PStack *st, int pr, void *arg)
-{
-       struct IsdnCardState *cs = (struct IsdnCardState *) st->l1.hardware;
-       struct sk_buff *skb = arg;
-       char str[64];
-
-       switch (pr) {
-               case (PH_DATA_REQ):
-                       if (cs->tx_skb) {
-                               skb_queue_tail(&cs->sq, skb);
-#ifdef L2FRAME_DEBUG           /* psa */
-                               if (cs->debug & L1_DEB_LAPD)
-                                       Logl2Frame(cs, skb, "PH_DATA Queued", 0);
-#endif
-                       } else {
-                               if ((cs->dlogflag) && (!(skb->data[2] & 1))) {
-                                       /* I-FRAME */
-                                       LogFrame(cs, skb->data, skb->len);
-                                       sprintf(str, "Q.931 frame user->network tei %d", st->l2.tei);
-                                       dlogframe(cs, skb->data+4, skb->len-4,
-                                                 str);
-                               }
-                               cs->tx_skb = skb;
-                               cs->tx_cnt = 0;
-#ifdef L2FRAME_DEBUG           /* psa */
-                               if (cs->debug & L1_DEB_LAPD)
-                                       Logl2Frame(cs, skb, "PH_DATA", 0);
-#endif
-                               cs->hw.foreign->dxmit(0, skb->data, skb->len,
-                                                      &foreign_dxmit_callback, cs);
-                       }
-                       break;
-               case (PH_PULL_IND):
-                       if (cs->tx_skb) {
-                               if (cs->debug & L1_DEB_WARN)
-                                       debugl1(cs, " l2l1 tx_skb exist this shouldn't happen");
-                               skb_queue_tail(&cs->sq, skb);
-                               break;
-                       }
-                       if ((cs->dlogflag) && (!(skb->data[2] & 1))) {  /* I-FRAME */
-                               LogFrame(cs, skb->data, skb->len);
-                               sprintf(str, "Q.931 frame user->network tei %d", st->l2.tei);
-                               dlogframe(cs, skb->data + 4, skb->len - 4,
-                                         str);
-                       }
-                       cs->tx_skb = skb;
-                       cs->tx_cnt = 0;
-#ifdef L2FRAME_DEBUG           /* psa */
-                       if (cs->debug & L1_DEB_LAPD)
-                               Logl2Frame(cs, skb, "PH_DATA_PULLED", 0);
-#endif
-                       cs->hw.foreign->dxmit(0, cs->tx_skb->data, cs->tx_skb->len,
-                                              &foreign_dxmit_callback, cs);
-                       break;
-               case (PH_PULL_REQ):
-#ifdef L2FRAME_DEBUG           /* psa */
-                       if (cs->debug & L1_DEB_LAPD)
-                               debugl1(cs, "-> PH_REQUEST_PULL");
-#endif
-                       if (!cs->tx_skb) {
-                               test_and_clear_bit(FLG_L1_PULL_REQ, &st->l1.Flags);
-                               st->l1.l1l2(st, PH_PULL_CNF, NULL);
-                       } else
-                               test_and_set_bit(FLG_L1_PULL_REQ, &st->l1.Flags);
-                       break;
-       }
-}
-
-int
-setDstack_foreign(struct PStack *st, struct IsdnCardState *cs)
-{
-       st->l2.l2l1 = foreign_Dchan_l2l1;
-       if (! cs->rcvbuf) {
-               printk("setDstack_foreign: No cs->rcvbuf!\n");
-       } else {
-               cs->hw.foreign->drecv(0, cs->rcvbuf, MAX_DFRAME_LEN,
-                                      &foreign_drecv_callback, cs);
-       }
-       return (0);
-}
-
-static void
-manl1_msg(struct IsdnCardState *cs, int msg, void *arg) {
-       struct PStack *st;
-
-       st = cs->stlist;
-       while (st) {
-               st->ma.manl1(st, msg, arg);
-               st = st->next;
-       }
-}
-
-void
-foreign_l1cmd(struct IsdnCardState *cs, int msg, void *arg)
-{
-       u_char val;
-       char tmp[32];
-       
-       if (cs->debug & L1_DEB_ISAC) {
-               sprintf(tmp, "foreign_l1cmd msg %x", msg);
-               debugl1(cs, tmp);
-       }
-
-       switch(msg) {
-               case PH_RESET_REQ:
-                       cs->hw.foreign->liu_deactivate(0);
-                       manl1_msg(cs, PH_POWERUP_CNF, NULL);
-                       break;
-               case PH_ENABLE_REQ:
-                       break;
-               case PH_INFO3_REQ:
-                       cs->hw.foreign->liu_activate(0,0);
-                       break;
-               case PH_TESTLOOP_REQ:
-                       break;
-               default:
-                       if (cs->debug & L1_DEB_WARN) {
-                               sprintf(tmp, "foreign_l1cmd unknown %4x", msg);
-                               debugl1(cs, tmp);
-                       }
-                       break;
-       }
-}
-
-static void
-foreign_new_ph(struct IsdnCardState *cs)
-{
-       switch (cs->hw.foreign->get_liu_state(0)) {
-               case 3:
-                       manl1_msg(cs, PH_POWERUP_CNF, NULL);
-                        break;
-
-               case 7:
-                       manl1_msg(cs, PH_I4_P8_IND, NULL);
-                       break;
-
-               case 8:
-                       manl1_msg(cs, PH_RSYNC_IND, NULL);
-                       break;
-       }
-}
-
-/* LIU state change callback */
-
-static void
-foreign_liu_callback(struct IsdnCardState *cs)
-{
-       static struct tq_struct task = {0, 0, (void *) &foreign_new_ph, 0};
-
-       if (!cs)
-               return;
-
-       if (cs->debug & L1_DEB_ISAC) {
-               char tmp[32];
-               sprintf(tmp, "foreign LIU state %d",
-                        cs->hw.foreign->get_liu_state(0));
-               debugl1(cs, tmp);
-       }
-
-       task.data = (void *) cs;
-       queue_task(&task, &tq_immediate);
-       mark_bh(IMMEDIATE_BH);
-}
-
-static void init_foreign(struct IsdnCardState *cs)
-{
-       Bchan_init(&cs->bcs[0]);
-       Bchan_init(&cs->bcs[1]);
-       cs->bcs[0].BC_SetStack = setstack_foreign;
-       cs->bcs[1].BC_SetStack = setstack_foreign;
-       cs->bcs[0].BC_Close = Bchan_close;
-       cs->bcs[1].BC_Close = Bchan_close;
-       Bchan_mode(cs->bcs, 0, 0);
-       Bchan_mode(cs->bcs + 1, 0, 0);
-}
-
-static int
-foreign_card_msg(struct IsdnCardState *cs, int mt, void *arg)
-{
-       switch (mt) {
-               case CARD_RESET:
-                       return(0);
-               case CARD_RELEASE:
-                       return(0);
-               case CARD_SETIRQ:
-                       return(0);
-               case CARD_INIT:
-                       cs->l1cmd = foreign_l1cmd;
-                        cs->setstack_d = setDstack_foreign;
-                       cs->hw.foreign->liu_init(0, &foreign_liu_callback,
-                                                (void *)cs);
-                       init_foreign(cs);
-                       return(0);
-               case CARD_TEST:
-                       return(0);
-       }
-       return(0);
-}
-
-#if CARD_AMD7930
-extern struct foreign_interface amd7930_foreign_interface;
-#endif
-
-#if CARD_DBRI
-extern struct foreign_interface dbri_foreign_interface;
-#endif
-
-int __init 
-setup_foreign(struct IsdnCard *card)
-{
-       struct IsdnCardState *cs = card->cs;
-       char tmp[64];
-
-       strcpy(tmp, foreign_revision);
-       printk(KERN_INFO "HiSax: Foreign chip driver Rev. %s\n",
-               HiSax_getrev(tmp));
-
-#if CARD_AMD7930
-       if (cs->typ == ISDN_CTYPE_AMD7930) {
-                cs->hw.foreign = &amd7930_foreign_interface;
-                cs->irq = cs->hw.foreign->get_irqnum(0);
-                if (cs->irq == 0)
-                        return (0);
-                cs->cardmsg = &foreign_card_msg;
-                return (1);
-        }
-#endif
-
-#if CARD_DBRI
-       if (cs->typ == ISDN_CTYPE_DBRI) {
-                cs->hw.foreign = &dbri_foreign_interface;
-                cs->irq = cs->hw.foreign->get_irqnum(0);
-                if (cs->irq == 0)
-                        return (0);
-                cs->cardmsg = &foreign_card_msg;
-                return (1);
-        }
-#endif
-
-        return(0);
-}
diff --git a/drivers/isdn/hisax/foreign.h b/drivers/isdn/hisax/foreign.h
deleted file mode 100644 (file)
index 50df019..0000000
+++ /dev/null
@@ -1,193 +0,0 @@
-/* $Id: foreign.h,v 1.1 1998/11/09 07:48:57 baccala Exp $
- *
- * HiSax ISDN driver - foreign chipset interface
- *
- * Author       Brent Baccala (baccala@FreeSoft.org)
- *
- *
- *
- * $Log: foreign.h,v $
- * Revision 1.1  1998/11/09 07:48:57  baccala
- * Initial DBRI ISDN code.  Sometimes works (brings up the link and you
- * can telnet through it), sometimes doesn't (crashes the machine)
- *
- */
-
-/*
- *       ISDN operations
- *
- * Many of these routines take an "int dev" argument, which is simply
- * an index into the drivers[] array.  Currently, we only support a
- * single foreign chip, so the value should always be 0.  B channel
- * operations require an "int chan", which should be 0 for channel B1
- * and 1 for channel B2
- *
- * int get_irqnum(int dev)
- *
- *   returns the interrupt number being used by the chip.  ISDN4linux
- *   uses this number to watch the interrupt during initialization and
- *   make sure something is happening.
- *
- * int get_liu_state(int dev)
- *
- *   returns the current state of the ISDN Line Interface Unit (LIU)
- *   as a number between 2 (state F2) and 7 (state F7).  0 may also be
- *   returned if the chip doesn't exist or the LIU hasn't been
- *   activated.  The meanings of the states are defined in I.430, ISDN
- *   BRI Physical Layer Interface.  The most important two states are
- *   F3 (shutdown) and F7 (syncronized).
- *
- * void liu_init(int dev, void (*callback)(void *), void *callback_arg)
- *
- *   initializes the LIU and optionally registers a callback to be
- *   signaled upon a change of LIU state.  The callback will be called
- *   with a single opaque callback_arg.  Once the callback has been
- *   triggered, get_liu_state can be used to determine the LIU
- *   current state.
- *
- * void liu_activate(int dev, int priority)
- *
- *   requests LIU activation at a given D-channel priority.
- *   Successful activatation is achieved upon entering state F7, which
- *   will trigger any callback previously registered with
- *   liu_init.
- *
- * void liu_deactivate(int dev)
- *
- *   deactivates LIU.  Outstanding D and B channel transactions are
- *   terminated rudely and without callback notification.  LIU change
- *   of state callback will be triggered, however.
- *
- * void dxmit(int dev, __u8 *buffer, unsigned int count,
- *            void (*callback)(void *, int), void *callback_arg)
- *
- *   transmits a packet - specified with buffer, count - over the D-channel
- *   interface.  Buffer should begin with the LAPD address field and
- *   end with the information field.  FCS and flag sequences should not
- *   be included, nor is bit-stuffing required - all these functions are
- *   performed by the chip.  The callback function will be called
- *   DURING THE TOP HALF OF AN INTERRUPT HANDLER and will be passed
- *   both the arbitrary callback_arg and an integer error indication:
- *
- *       0 - successful transmission; ready for next packet
- *   non-0 - error value
- *
- *   The callback routine should defer any time-consuming operations
- *   to a bottom-half handler; however, dxmit may be called
- *   from within the callback to request back-to-back transmission of
- *   a second packet (without repeating the priority/collision mechanism)
- *
- *   A comment about the "collision detect" error, which is signalled
- *   whenever the echoed D-channel data didn't match the transmitted
- *   data.  This is part of ISDN's normal multi-drop T-interface
- *   operation, indicating that another device has attempted simultaneous
- *   transmission, but can also result from line noise.  An immediate
- *   requeue via dxmit is suggested, but repeated collision
- *   errors may indicate a more serious problem.
- *
- * void drecv(int dev, __u8 *buffer, unsigned int size,
- *            void (*callback)(void *, int, unsigned int),
- *            void *callback_arg)
- *
- *   register a buffer - buffer, size - into which a D-channel packet
- *   can be received.  The callback function will be called DURING
- *   THE TOP HALF OF AN INTERRUPT HANDLER and will be passed an
- *   arbitrary callback_arg, an integer error indication and the length
- *   of the received packet, which will start with the address field,
- *   end with the information field, and not contain flag or FCS
- *   bytes.  Bit-stuffing will already have been corrected for.
- *   Possible values of second callback argument "error":
- *
- *       0 - successful reception
- *   non-0 - error value
- *
- * int bopen(int dev, int chan, int hdlcmode, u_char xmit_idle_char)
- *
- *   This function should be called before any other operations on a B
- *   channel.  mode is either non-0 to (de)encapsulate using HDLC or 0
- *   for transparent operation. In addition to arranging for interrupt
- *   handling and channel multiplexing, it sets the xmit_idle_char
- *   which is transmitted on the interface when no data buffer is
- *   available.  Suggested values are: 0 for ISDN audio; FF for HDLC
- *   mark idle; 7E for HDLC flag idle.  Returns 0 on a successful
- *   open; -1 on error.
- *
- *   If the chip doesn't support HDLC encapsulation (the Am7930
- *   doesn't), an error will be returned opening L1_MODE_HDLC; the
- *   HiSax driver should retry with L1_MODE_TRANS, then be prepared to
- *   bit-stuff the data before shipping it to the driver.
- *
- * void bclose(int dev, int chan)
- *
- *   Shuts down a B channel when no longer in use.
- *
- * void bxmit(int dev, int chan, __u8 *buffer, unsigned int count,
- *            void (*callback)(void *, int), void *callback_arg)
- *
- *   transmits a data block - specified with buffer, count - over the
- *   B channel interface specified by dev/chan.  In mode L1_MODE_HDLC,
- *   a complete HDLC frames should be relayed with a single bxmit.
- *   The callback function will be called DURING THE TOP HALF OF AN
- *   INTERRUPT HANDLER and will be passed the arbitrary callback_arg
- *   and an integer error indication:
- *
- *       0 - successful transmission; ready for next packet
- *   non-0 - error
- *
- *   The callback routine should defer any time-consuming operations
- *   to a bottom-half handler; however, bxmit may be called
- *   from within the callback to request back-to-back transmission of
- *   another data block
- *
- * void brecv(int dev, int chan, __u8 *buffer, unsigned int size,
- *            void (*callback)(void *, int, unsigned int), void *callback_arg)
- *
- *   receive a raw data block - specified with buffer, size - over the
- *   B channel interface specified by dev/chan.  The callback function
- *   will be called DURING THE TOP HALF OF AN INTERRUPT HANDLER and
- *   will be passed the arbitrary callback_arg, an integer error
- *   indication and the length of the received packet.  In HDLC mode,
- *   the packet will start with the address field, end with the
- *   information field, and will not contain flag or FCS bytes.
- *   Bit-stuffing will already have been corrected for.
- *
- *   Possible values of second callback argument "error":
- *
- *       0 - successful reception
- *   non-0 - error value
- *
- *   The callback routine should defer any time-consuming operations
- *   to a bottom-half handler; however, brecv may be called
- *   from within the callback to register another buffer and ensure
- *   continuous B channel reception without loss of data
- * */
-
-struct foreign_interface {
-    int (*get_irqnum)(int dev);
-    int (*get_liu_state)(int dev);
-    void (*liu_init)(int dev, void (*callback)(void *), void *callback_arg);
-    void (*liu_activate)(int dev, int priority);
-    void (*liu_deactivate)(int dev);
-    void (*dxmit)(int dev, __u8 *buffer, unsigned int count,
-                  void (*callback)(void *, int),
-                  void *callback_arg);
-    void (*drecv)(int dev, __u8 *buffer, unsigned int size,
-                  void (*callback)(void *, int, unsigned int),
-                  void *callback_arg);
-    int (*bopen)(int dev, unsigned int chan,
-                 int hdlcmode, u_char xmit_idle_char);
-    void (*bclose)(int dev, unsigned int chan);
-    void (*bxmit)(int dev, unsigned int chan,
-                  __u8 *buffer, unsigned long count,
-                  void (*callback)(void *, int),
-                  void *callback_arg);
-    void (*brecv)(int dev, unsigned int chan,
-                  __u8 *buffer, unsigned long size,
-                  void (*callback)(void *, int, unsigned int),
-                  void *callback_arg);
-
-    struct foreign_interface *next;
-};
-
-extern struct foreign_interface amd7930_foreign_interface;
-extern struct foreign_interface dbri_foreign_interface;
index c32525e7d2451dbece0b92e31972e6480ee2c6fa..053dd90249567461ea3d744d187dc318107f5042 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: hfc_pci.c,v 1.34.6.2 2000/11/28 12:02:46 kai Exp $
+/* $Id: hfc_pci.c,v 1.34.6.3 2000/12/10 23:39:19 kai Exp $
 
  * hfc_pci.c     low level driver for CCD´s hfc-pci based cards
  *
@@ -35,7 +35,7 @@
 
 extern const char *CardType[];
 
-static const char *hfcpci_revision = "$Revision: 1.34.6.2 $";
+static const char *hfcpci_revision = "$Revision: 1.34.6.3 $";
 
 /* table entry in the PCI devices list */
 typedef struct {
@@ -61,6 +61,7 @@ static const PCI_ENTRY id_list[] =
        {PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_B00B, "Billion", "B00B"},
        {PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_B00C, "Billion", "B00C"},
        {PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_B100, "Seyeon", "B100"},
+       {PCI_VENDOR_ID_ABOCOM, PCI_DEVICE_ID_ABOCOM_2BD1, "Abocom/Magitek", "2BD1"},
        {PCI_VENDOR_ID_ASUSTEK, PCI_DEVICE_ID_ASUSTEK_0675, "Asuscom/Askey", "675"},
        {PCI_VENDOR_ID_BERKOM, PCI_DEVICE_ID_BERKOM_T_CONCEPT, "German telekom", "T-Concept"},
        {PCI_VENDOR_ID_BERKOM, PCI_DEVICE_ID_BERKOM_A1T, "German telekom", "A1T"},
index 22cf911b316efed3c008d9cc44abc80eccf9c504..aafbe05a3e14e041a9d519ff6afd3d39af6e1d92 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: hisax.h,v 2.52 2000/11/25 17:01:00 kai Exp $
+/* $Id: hisax.h,v 2.52.6.1 2000/12/06 16:59:19 kai Exp $
  *
  *   Basic declarations, defines and prototypes
  *
index cda9e422c7349d15d21f2753265a6d6200f015c9..5506b956f8acdf97a2bcb144c0f094bfd46bfa39 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: isdnl1.c,v 2.41 2000/11/24 17:05:37 kai Exp $
+/* $Id: isdnl1.c,v 2.41.6.1 2000/12/10 22:01:04 kai Exp $
  *
  * isdnl1.c     common low level stuff for Siemens Chipsetbased isdn cards
  *              based on the teles driver from Jan den Ouden
@@ -15,7 +15,7 @@
  *
  */
 
-const char *l1_revision = "$Revision: 2.41 $";
+const char *l1_revision = "$Revision: 2.41.6.1 $";
 
 #define __NO_VERSION__
 #include <linux/init.h>
@@ -343,7 +343,6 @@ init_bcstate(struct IsdnCardState *cs,
 
        bcs->cs = cs;
        bcs->channel = bc;
-       INIT_LIST_HEAD(&bcs->tqueue.list);
        bcs->tqueue.sync = 0;
        bcs->tqueue.routine = (void *) (void *) BChannel_bh;
        bcs->tqueue.data = bcs;
index 8f4ccf4215a48c7ed776854b1eab330941e65a51..4440f44e7bd71822f3da795fe661e88c1caad7e7 100644 (file)
@@ -1,4 +1,4 @@
-// $Id: l3ni1.c,v 2.5 2000/11/19 17:02:48 kai Exp $
+// $Id: l3ni1.c,v 2.5.6.1 2000/12/06 16:59:19 kai Exp $
 //
 //-----------------------------------------------------------------------------
 //
@@ -26,7 +26,7 @@
 #include <linux/ctype.h>
 
 extern char *HiSax_getrev(const char *revision);
-const char *ni1_revision = "$Revision: 2.5 $";
+const char *ni1_revision = "$Revision: 2.5.6.1 $";
 
 #define EXT_BEARER_CAPS 1
 
index 9dede4757836e13c660a4d02b0ef88b0921ea5a6..996289aa9db5dce03712821e793fe5a9cb099179 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: netjet.c,v 1.24 2000/11/24 17:05:38 kai Exp $
+/* $Id: netjet.c,v 1.24.6.1 2000/12/06 16:59:20 kai Exp $
  *
  * netjet.c     low level stuff for Traverse Technologie NETJet ISDN cards
  *
@@ -29,7 +29,7 @@
 #define virt_to_bus (u_int)
 #endif
 
-const char *NETjet_revision = "$Revision: 1.24 $";
+const char *NETjet_revision = "$Revision: 1.24.6.1 $";
 
 /* Interface functions */
 
index 5613784b7a15242bbd65955b8b81fa3caa5e4250..92d8bb988503ea09be8d7e1d1a5145e96847ef95 100644 (file)
@@ -1,27 +1,40 @@
-SUB_DIRS     :=
-MOD_SUB_DIRS :=
-ALL_SUB_DIRS :=
-
-L_OBJS :=
-LX_OBJS :=
-M_OBJS :=
-MX_OBJS :=
-O_OBJS :=
-OX_OBJS :=
-L_TARGET :=
-O_TARGET :=
-
-ifeq ($(CONFIG_PROC_FS),y)
-  ifeq ($(CONFIG_HYSDN),y)
-    M_OBJS += hysdn.o
-    O_TARGET += hysdn.o
-    O_OBJS += hysdn_procconf.o hysdn_proclog.o boardergo.o hysdn_boot.o hysdn_sched.o hysdn_net.o
-  ifeq ($(CONFIG_HYSDN_CAPI),y)
-    O_OBJS += hycapi.o
-  endif
-    OX_OBJS += hysdn_init.o 
-  endif
-endif
+# Makefile for the hysdn ISDN device driver
+
+# The target object and module list name.
+
+O_TARGET       := hysdn_drv.o
+
+# Objects that export symbols.
+
+export-objs    :=
+
+# Multipart objects.
+
+list-multi     := hysdn.o
+hysdn-objs     := hysdn_procconf.o hysdn_proclog.o boardergo.o hysdn_boot.o \
+                  hysdn_sched.o hysdn_net.o hysdn_init.o
+
+# Optional parts of multipart objects.
+
+hysdn-objs-$(CONFIG_HYSDN_CAPI) += hycapi.o
+
+hysdn-objs     += $(hysdn-objs-y)
+
+# Object file lists.
+
+obj-y  :=
+obj-m  :=
+obj-n  :=
+obj-   :=
+
+# Each configuration option enables a list of files.
+
+obj-$(CONFIG_HYSDN)    += hysdn.o
 
 include $(TOPDIR)/Rules.make
 
+# Link rules for multi-part drivers.
+
+hysdn.o: $(hysdn-objs)
+       $(LD) -r -o $@ $(hysdn-objs)
+
index 941a4bfabff21654fae6283212a99b697f793de8..92e96ec9b40e4e3234e9155beb972f73249f8635 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: boardergo.c,v 1.5 2000/11/22 17:13:13 kai Exp $
+/* $Id: boardergo.c,v 1.5.6.1 2000/12/10 22:01:04 kai Exp $
 
  * Linux driver for HYSDN cards, specific routines for ergo type boards.
  *
@@ -458,7 +458,6 @@ ergo_inithardware(hysdn_card * card)
        card->writebootseq = ergo_writebootseq;
        card->waitpofready = ergo_waitpofready;
        card->set_errlog_state = ergo_set_errlog_state;
-       INIT_LIST_HEAD(&card->irq_queue.list);
        card->irq_queue.sync = 0;
        card->irq_queue.data = card;    /* init task queue for interrupt */
        card->irq_queue.routine = (void *) (void *) ergo_irq_bh;
index 17c533ee8157c0354c61a0bebf0eb269c0610dcf..9931761c9226ed77d03d7cf3e64f2fd56d7554fc 100644 (file)
@@ -1,8 +1,22 @@
-ifeq ($(CONFIG_ISDN_DRV_ICN),y)
-  O_TARGET := icn_obj.o
-  O_OBJS   := icn.o
-else
-  M_OBJS   := icn.o
-endif
+# Makefile for the act2000 ISDN device driver
+
+# The target object and module list name.
+
+O_TARGET       := icn_drv.o
+
+# Objects that export symbols.
+
+export-objs    :=
+
+# Object file lists.
+
+obj-y  :=
+obj-m  :=
+obj-n  :=
+obj-   :=
+
+# Each configuration option enables a list of files.
+
+obj-$(CONFIG_ISDN_DRV_ICN)     += icn.o
 
 include $(TOPDIR)/Rules.make
index b3b431443ebf7982229e2ee591cd837449160d17..757c59ca9b0eb4307c15e4b1ed184ea295fded67 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: isdn_net.c,v 1.140 2000/11/01 17:54:01 detabc Exp $
+/* $Id: isdn_net.c,v 1.140.6.1 2000/12/10 22:01:04 kai Exp $
 
  * Linux ISDN subsystem, network interfaces and related functions (linklevel).
  *
@@ -181,7 +181,7 @@ static __inline__ void isdn_net_zero_frame_cnt(isdn_net_local *lp)
 int isdn_net_force_dial_lp(isdn_net_local *);
 static int isdn_net_start_xmit(struct sk_buff *, struct net_device *);
 
-char *isdn_net_revision = "$Revision: 1.140 $";
+char *isdn_net_revision = "$Revision: 1.140.6.1 $";
 
  /*
   * Code for raw-networking over ISDN
@@ -2371,7 +2371,7 @@ isdn_net_new(char *name, struct net_device *master)
        netdev->local->netdev = netdev;
        netdev->local->next = netdev->local;
 
-       memset(&netdev->local->tqueue, 0, sizeof(struct tq_struct));
+       netdev->local->tqueue.sync = 0;
        netdev->local->tqueue.routine = isdn_net_softint;
        netdev->local->tqueue.data = netdev->local;
        spin_lock_init(&netdev->local->xmit_lock);
index 588d80760f300fbe6104f2b806c817d2876b2d00..154363b762f23c14f8294d693268ce4243b2686f 100644 (file)
@@ -1,11 +1,25 @@
-L_OBJS :=
-M_OBJS :=
-
-ifeq ($(CONFIG_ISDN_DRV_LOOP),y)
-  L_OBJS += isdnloop.o
-else
-  M_OBJS += isdnloop.o
-endif
+#
+# Makefile for the isdnloop ISDN device driver
+#
+
+# The target object and module list name.
+
+O_TARGET       := isdnloop_drv.o
+
+# Objects that export symbols.
+
+export-objs    :=
+
+# Object file lists.
+
+obj-y  :=
+obj-m  :=
+obj-n  :=
+obj-   :=
+
+# Each configuration option enables a list of files.
+
+obj-$(CONFIG_ISDN_DRV_LOOP)    += isdnloop.o
 
 include $(TOPDIR)/Rules.make
 
index 50a67269ea7498e761df6cfec94623efff04a3b1..de125f2fee66870784cf38faf4c017fcf5f5ae68 100644 (file)
@@ -1,15 +1,32 @@
-L_OBJS :=
-M_OBJS :=
-O_OBJS := module.o edss1.o drv.o layer2.o capi.o callbacks.o 
-
-O_TARGET :=
-ifeq ($(CONFIG_ISDN_DRV_PCBIT),y)
-  O_TARGET += pcbit.o
-else
-  ifeq ($(CONFIG_ISDN_DRV_PCBIT),m)
-    O_TARGET += pcbit.o
-    M_OBJS += pcbit.o
-  endif
-endif
+# Makefile for the pcbit ISDN device driver
+
+# The target object and module list name.
+
+O_TARGET       := pcbit_drv.o
+
+# Objects that export symbols.
+
+export-objs    :=
+
+# Multipart objects.
+
+list-multi     := pcbit.o
+pcbit-objs     := module.o edss1.o drv.o layer2.o capi.o callbacks.o
+
+# Object file lists.
+
+obj-y  :=
+obj-m  :=
+obj-n  :=
+obj-   :=
+
+# Each configuration option enables a list of files.
+
+obj-$(CONFIG_ISDN_DRV_PCBIT)   += pcbit.o
 
 include $(TOPDIR)/Rules.make
+
+# Link rules for multi-part drivers.
+
+pcbit.o: $(pcbit-objs)
+       $(LD) -r -o $@ $(pcbit-objs)
index 4f421e75c4dadeee35e35e1b92678b9f343f8ead..1e13e0c6870ec3093aa5052c043c029a1e087427 100644 (file)
@@ -134,8 +134,6 @@ int pcbit_init_dev(int board, int mem_base, int irq)
        memset(dev->b2, 0, sizeof(struct pcbit_chan));
        dev->b2->id = 1;
 
-
-       INIT_LIST_HEAD(&dev->qdelivery.list);
        dev->qdelivery.sync = 0;
        dev->qdelivery.routine = pcbit_deliver;
        dev->qdelivery.data = dev;
index ff87210b87d19b9ef1f4830ae5bf8297bed93283..075387dea45a3735d09aec5ba31c1df294f86718 100644 (file)
@@ -1,44 +1,33 @@
-#
-#  $Id: Makefile,v 1.1 1997/03/22 02:01:22 fritz Exp $
-#  Copyright (C) 1996  SpellCaster Telecommunications Inc.
-#
-#  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., 675 Mass Ave, Cambridge, MA 02139, USA.
-#
-#  For more information, please contact gpl-info@spellcast.com or write:
-#
-#     SpellCaster Telecommunications Inc.
-#     5621 Finch Avenue East, Unit #3
-#     Scarborough, Ontario  Canada
-#     M1B 2T9
-#     +1 (416) 297-8565
-#     +1 (416) 297-6433 Facsimile
-#
-
-L_OBJS :=
-M_OBJS :=
-O_OBJS := shmem.o init.o debug.o packet.o command.o event.o \
-       ioctl.o interrupt.o message.o timer.o
-
-O_TARGET :=
-ifeq ($(CONFIG_ISDN_DRV_SC),y)
-       O_TARGET += sc.o
-else
-  ifeq ($(CONFIG_ISDN_DRV_SC),m)
-    O_TARGET += sc.o
-    M_OBJS += sc.o
-  endif
-endif
+# Makefile for the sc ISDN device driver
+
+# The target object and module list name.
+
+O_TARGET       := sc_drv
+
+# Objects that export symbols.
+
+export-objs    :=
+
+# Multipart objects.
+
+list-multi     := sc.o
+sc-objs                := shmem.o init.o debug.o packet.o command.o event.o \
+                  ioctl.o interrupt.o message.o timer.o        
+
+# Object file lists.
+
+obj-y  :=
+obj-m  :=
+obj-n  :=
+obj-   :=
+
+# Each configuration option enables a list of files.
+
+obj-$(CONFIG_ISDN_DRV_SC)      += sc.o
 
 include $(TOPDIR)/Rules.make
+
+# Link rules for multi-part drivers.
+
+sc.o: $(sc-objs)
+       $(LD) -r -o $@ $(sc-objs)
index 6edf9ff5e5f941f361b20de6d8c539bdaf541778..c7b5b42091059144aba934a480c0ad2a9ce32e21 100644 (file)
@@ -9,19 +9,9 @@
 # parent makes..
 #
 
-# Subdirs.
-
-SUB_DIRS       :=
-MOD_SUB_DIRS   := $(SUB_DIRS)
-MOD_IN_SUB_DIRS        := $(SUB_DIRS)
-ALL_SUB_DIRS   := $(SUB_DIRS)
-
 # The target object and module list name.
 
 O_TARGET       := macintosh.o
-M_OBJS         :=
-O_OBJS         :=
-MOD_LIST_NAME  := MACINTOSH_MODULES
 
 # Objects that export symbols.
 
@@ -57,18 +47,6 @@ obj-$(CONFIG_ADB_IOP)                += adb-iop.o
 obj-$(CONFIG_ADB_PMU68K)       += via-pmu68k.o
 obj-$(CONFIG_ADB_MACIO)                += macio-adb.o
 
-# Files that are both resident and modular: remove from modular.
-
-obj-m          := $(filter-out $(obj-y), $(obj-m))
-int-m          := $(filter-out $(int-y), $(int-m))
-
-# Translate to Rules.make lists.
-
-O_OBJS         := $(sort $(filter-out $(export-objs), $(obj-y)))
-OX_OBJS                := $(sort $(filter     $(export-objs), $(obj-y)))
-M_OBJS         := $(sort $(filter-out $(export-objs), $(obj-m)))
-MX_OBJS                := $(sort $(filter     $(export-objs), $(obj-m)))
-
 # The global Rules.make.
 
 include $(TOPDIR)/Rules.make
index ab816b8f9d49a63bf40ba3c3af10526ad3e13790..041b186615d1cdc26f2c367c02b15001b49243ce 100644 (file)
@@ -12,8 +12,6 @@ lvm-mod-objs  := lvm.o lvm-snap.o
 # and xor.o must come before md.o, as they each initialise 
 # themselves, and md.o may use the personalities when it 
 # auto-initialised.
-# The use of MIX_OBJS allows link order to be maintained even
-# though some are export-objs and some aren't.
 
 obj-$(CONFIG_MD_LINEAR)                += linear.o
 obj-$(CONFIG_MD_RAID0)         += raid0.o
index 55c50c5e7acfa5790facdea7ba4dcd8a6e9e0352..a06b407346d6b2d3aebea1bcce0b64dc7351a6fa 100644 (file)
@@ -1009,6 +1009,7 @@ static void handle_stripe_write (mddev_t *mddev , raid5_conf_t *conf,
        struct buffer_head *bh;
        int method1 = INT_MAX, method2 = INT_MAX;
 
+#if 0
        /*
         * Attempt to add entries :-)
         */
@@ -1039,6 +1040,7 @@ static void handle_stripe_write (mddev_t *mddev , raid5_conf_t *conf,
                        atomic_dec(&bh->b_count);
                }
        }
+#endif
        PRINTK("handle_stripe() -- begin writing, stripe %lu\n", sh->sector);
        /*
         * Writing, need to update parity buffer.
index 2e14365493f17875bb6a9561f0fc68b2859f6f7b..99517e8123dca5a615c3f84884956105af86ead7 100644 (file)
@@ -9,13 +9,9 @@
 # parent makes..
 #
 
-MEDIAS = $(join $(SUB_DIRS),$(SUB_DIRS:%=/%.o))
-
-SUB_DIRS     := video radio
-MOD_SUB_DIRS := $(SUB_DIRS)
-ALL_SUB_DIRS := $(SUB_DIRS)
+subdir-y     := video radio
 
 O_TARGET     := media.o
-O_OBJS       := $(MEDIAS)
+obj-y        := $(join $(subdir-y),$(subdir-y:%=/%.o))
 
 include $(TOPDIR)/Rules.make
index 03cc959eaf0d40a5721186d3c9dec160940e466f..c7a621228511a2404e86a113fae227b27c5b1a7d 100644 (file)
@@ -9,11 +9,6 @@
 # parent makes..
 #
 
-O_OBJS         :=
-OX_OBJS                :=
-M_OBJS         :=
-MX_OBJS                :=
-
 # Object file lists.
 
 obj-y          :=
@@ -21,10 +16,6 @@ obj-m                :=
 obj-n          :=
 obj-           :=
 
-SUB_DIRS     := 
-MOD_SUB_DIRS := $(SUB_DIRS)
-ALL_SUB_DIRS := $(SUB_DIRS)
-
 O_TARGET := radio.o
 
 # All of the (potential) objects that export symbols.
@@ -47,30 +38,4 @@ obj-$(CONFIG_RADIO_GEMTEK) += radio-gemtek.o
 obj-$(CONFIG_RADIO_TRUST) += radio-trust.o
 obj-$(CONFIG_RADIO_MAESTRO) += radio-maestro.o
 
-# Extract lists of the multi-part drivers.
-# The 'int-*' lists are the intermediate files used to build the multi's.
-
-multi-y         := $(filter $(list-multi), $(obj-y))
-multi-m         := $(filter $(list-multi), $(obj-m))
-int-y           := $(sort $(foreach m, $(multi-y), $($(basename $(m))-objs)))
-int-m           := $(sort $(foreach m, $(multi-m), $($(basename $(m))-objs)))
-
-# Files that are both resident and modular: remove from modular.
-
-obj-m           := $(filter-out $(obj-y), $(obj-m))
-int-m           := $(filter-out $(int-y), $(int-m))
-
-# Take multi-part drivers out of obj-y and put components in.
-
-obj-y           := $(filter-out $(list-multi), $(obj-y)) $(int-y)
-
-# Translate to Rules.make lists.
-
-O_OBJS          := $(filter-out $(export-objs), $(obj-y))
-OX_OBJS         := $(filter     $(export-objs), $(obj-y))
-M_OBJS          := $(sort $(filter-out $(export-objs), $(obj-m)))
-MX_OBJS         := $(sort $(filter     $(export-objs), $(obj-m)))
-MI_OBJS                := $(sort $(filter-out $(export-objs), $(int-m)))
-MIX_OBJS       := $(sort $(filter     $(export-objs), $(int-m)))
-
 include $(TOPDIR)/Rules.make
index 6bd9d7d15a424958fd3ab6385a6b3828a8960d97..182a992667e61cb8c2c2b5b770c9d40fb4a6a591 100644 (file)
@@ -9,11 +9,6 @@
 # parent makes..
 #
 
-O_OBJS         :=
-OX_OBJS                :=
-M_OBJS         :=
-MX_OBJS                :=
-
 # Object file lists.
 
 obj-y          :=
@@ -76,15 +71,6 @@ int-m           := $(filter-out $(int-y), $(int-m))
 
 obj-y           := $(filter-out $(list-multi), $(obj-y)) $(int-y)
 
-# Translate to Rules.make lists.
-
-O_OBJS          := $(filter-out $(export-objs), $(obj-y))
-OX_OBJS         := $(filter     $(export-objs), $(obj-y))
-M_OBJS          := $(sort $(filter-out $(export-objs), $(obj-m)))
-MX_OBJS         := $(sort $(filter     $(export-objs), $(obj-m)))
-MI_OBJS                := $(sort $(filter-out $(export-objs), $(int-m)))
-MIX_OBJS       := $(sort $(filter     $(export-objs), $(int-m)))
-
 include $(TOPDIR)/Rules.make
 
 fastdep:
index 7fdbf65a4f445cef9dd83d1a981bd7018d387e44..005baaab6bb688376884ce2aeba42b531ab1154a 100644 (file)
 #
 # $Id: Makefile,v 1.22 2000/07/14 08:10:52 dwmw2 Exp $
 
-ifndef CONFIG_MTD
-
-# We're being invoked outside a normal kernel build. Fake it
-EXTRA_CFLAGS= -I$(shell pwd)/../include
-
-MIX_OBJS = mtdcore.o doc2000.o doc2001.o cfi_probe.o cfi_cmdset_0001.o \
-       map_ram.o map_rom.o cfi_cmdset_0002.o
-MI_OBJS = doc1000.o docprobe.o slram.o pmc551.o mtdram.o physmap.o \
-       nora.o octagon-5066.o pnc2000.o rpxlite.o vmax301.o mtdchar.o \
-       mtdblock.o ftl.o nftl.o
-
-CFLAGS_nftl.o := -DCONFIG_NFTL_RW
-CFLAGS_mtdram.o := -DCONFIG_MTDRAM_TOTAL_SIZE=4096 -DCONFIG_MTDRAM_ERASE_SIZE=128
-CFLAGS_physmap.o := -DCONFIG_MTD_PHYSMAP_START=0x8000000 -DCONFIG_MTD_PHYSMAP_LEN=0x4000000
-
-else 
-
-O_OBJS          :=
-OX_OBJS         :=
-M_OBJS          :=
-MX_OBJS         :=
-
 # Object file lists.
 
 obj-y           :=
@@ -44,7 +22,7 @@ SUB_DIRS      :=
 ALL_SUB_DIRS   :=
 MOD_SUB_DIRS   :=
 
-export-objs    :=      mtdcore.o mtdpart.o
+export-objs    :=      mtdcore.o mtdpart.o jedec.o
 list-multi     :=
 
 # MTD devices
@@ -80,31 +58,4 @@ obj-$(CONFIG_MTD_BLOCK)              += mtdblock.o
 obj-$(CONFIG_FTL)              += ftl.o
 obj-$(CONFIG_NFTL)             += nftl.o nftlmount.o
 
-# Extract lists of the multi-part drivers.
-# The 'int-*' lists are the intermediate files used to build the multi's.
-
-multi-y         := $(filter $(list-multi), $(obj-y))
-multi-m         := $(filter $(list-multi), $(obj-m))
-int-y           := $(sort $(foreach m, $(multi-y), $($(basename $(m))-objs)))
-int-m           := $(sort $(foreach m, $(multi-m), $($(basename $(m))-objs)))
-
-# Files that are both resident and modular: remove from modular.
-
-obj-m           := $(filter-out $(obj-y), $(obj-m))
-int-m           := $(filter-out $(int-y), $(int-m))
-
-# Take multi-part drivers out of obj-y and put components in.
-
-obj-y           := $(filter-out $(list-multi), $(obj-y)) $(int-y)
-
-# Translate to Rules.make lists.
-
-O_OBJS          := $(filter-out $(export-objs), $(obj-y))
-OX_OBJS         := $(filter     $(export-objs), $(obj-y))
-M_OBJS          := $(sort $(filter-out $(export-objs), $(obj-m)))
-MX_OBJS         := $(sort $(filter     $(export-objs), $(obj-m)))
-
-
-endif
-
 include $(TOPDIR)/Rules.make
index c67a3489abaccbb2cfb668d52976992be3ae624f..37fec2a0ce3fe47fef9ac91babdcc8965f29f6b9 100644 (file)
@@ -41,6 +41,7 @@
 */
 #define DOC_SINGLE_DRIVER
 
+#include <linux/config.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <asm/errno.h>
index 0a33ed1cf0e6ed4dadbf449d6cdb6743e8e8d1ac..d1344468bdb1fd41844c93ef6d355a77a6c4718d 100644 (file)
@@ -6,6 +6,7 @@
  * 02-nov-2000 Nicolas Pitre           Added read-modify-write with cache
  */
 
+#include <linux/config.h>
 #include <linux/types.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
index bccb687c0ae978051a59a5a8121667138c5c5971..9b2b65bfb23fa52400acd8c412f65d1ddf6baf42 100644 (file)
@@ -9,6 +9,7 @@
 
 #include <linux/mtd/compatmac.h>
 
+#include <linux/config.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/mtd/mtd.h>
index d1f05930fd5a9b9aa0c6d7f28fb48ec11fd08f6f..0e625285573e225e034512205f1464a5a1ddbd35 100644 (file)
@@ -20,7 +20,6 @@
  * 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/module.h>
 #include <asm/errno.h>
index 4d42035c3ec5b6609a45af20cb5bd6cabf3ecec2..4df102258028fa3d7b1c18f64318d746df0c4815 100644 (file)
 
 L_TARGET := nubus.a
 
-ifeq ($(CONFIG_MODULES),y)
-O_TARGET := nubus_n_syms.o
-OX_OBJS  := nubus_syms.o
-O_OBJS   := nubus.o
-L_OBJS   := nubus_n_syms.o
-else
-L_OBJS   := nubus.o
-endif
+export-objs := nubus_syms.o
 
-ifdef CONFIG_PROC_FS
-L_OBJS   += proc.o
-endif
+obj-y   := nubus.o
+
+obj-$(CONFIG_MODULES) += nubus_syms.o 
+obj-$(CONFIG_PROC_FS) += proc.o
 
 include $(TOPDIR)/Rules.make
index 8e4b177e324dd83f5d6d7fe9abe2cbe5455bc338..155f8be5625474656b5013f6609863b1e06bd87f 100644 (file)
@@ -19,7 +19,6 @@
  *          Andrea Arcangeli
  */
 
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/sched.h>
index b1fc61f68917433ef41e61dbbabd7634b9fd94a9..3e6f3435222466fbfe68d0fb912dea2d601cdaa3 100644 (file)
@@ -16,6 +16,7 @@ multi-list = pcmcia_core.o yenta_socket.o
 
 yenta_socket-objs := pci_socket.o yenta.o
 pcmcia_core-objs := cistpl.o rsrc_mgr.o bulkmem.o cs.o
+
 ifeq ($(CONFIG_CARDBUS),y)
   pcmcia_core-objs += cardbus.o
 endif
@@ -48,8 +49,8 @@ endif
 
 include $(TOPDIR)/Rules.make
 
-pcmcia_core.o:  $(CORE_OBJS)
-       $(LD) $(LD_RFLAG) -r -o $@ $(CORE_OBJS)
+pcmcia_core.o:  $(pcmcia_core-objs)
+       $(LD) $(LD_RFLAG) -r -o $@ $(pcmcia_core-objs)
 
-yenta_socket.o: $(CARDBUS_OBJS)
-       $(LD) $(LD_RFLAG) -r -o $@ yenta.o pci_socket.o
+yenta_socket.o: $(yenta_socket-objs)
+       $(LD) $(LD_RFLAG) -r -o $@ $(yenta_socket-objs)
index 0ba0d034688736bdbb13173423302107b1deaf57..c6ffb2162fa4a7d91bb48db2ce25e58bb83b4a36 100644 (file)
@@ -13,11 +13,8 @@ O_TARGET := pnp.o
 export-objs := isapnp.o
 multi-objs := isa-pnp.o
 
-ifdef CONFIG_PROC_FS
-PROC_OBJS   += isapnp_proc.o
-endif
-
-isa-pnp-objs := isapnp.o quirks.o $(PROC_OBJS)
+proc-$(CONFIG_PROC_FS) = isapnp_proc.o
+isa-pnp-objs := isapnp.o quirks.o $(proc-y)
 
 obj-$(CONFIG_ISAPNP) += isa-pnp.o
 
index 7be59e06627e794c111bd9d491fadf8087f3e178..26dd66f22c7b6704735aaab13b210fe8846b5adc 100644 (file)
@@ -7,25 +7,15 @@
 #
 # Note 2! The CFLAGS definitions are now in the main makefile...
 
-SUB_DIRS     :=
-MOD_SUB_DIRS := $(SUB_DIRS) char audio
-ALL_SUB_DIRS := $(SUB_DIRS) char audio
-
-O_OBJS   := sbus.o dvma.o
 O_TARGET := sbus_all.o
+obj-y    := sbus.o dvma.o
 
-# Character devices for SBUS-based machines.
-#
-ifeq ($(CONFIG_SBUSCHAR),y)
-SUB_DIRS += char
-O_OBJS += char/sunchar.o
-endif
+subdir-y += char
+subdir-m += char
+obj-$(CONFIG_SBUSCHAR) += char/sunchar.o
 
-# Audio devices for SBUS-based machines.
-#
-ifeq ($(CONFIG_SPARCAUDIO),y)
-SUB_DIRS += audio
-O_OBJS += audio/sparcaudio.o
-endif
+subdir-y += audio
+subdir-m += audio
+obj-$(CONFIG_SPARCAUDIO) += audio/sparcaudio.o
 
 include $(TOPDIR)/Rules.make
index eaac51698880094c93afc03c6771ad41261904ed..8ee84f9b2fb36093caea27306b243a61d88cc969 100644 (file)
@@ -15,9 +15,4 @@ obj-$(CONFIG_SPARCAUDIO_CS4231)               += cs4231.o
 obj-$(CONFIG_SPARCAUDIO_DBRI)          += dbri.o
 obj-$(CONFIG_SPARCAUDIO_DUMMY)         += dmy.o
 
-O_OBJS         := $(filter-out $(export-objs), $(obj-y))
-OX_OBJS                := $(filter     $(export-objs), $(obj-y))
-M_OBJS         := $(sort $(filter-out  $(export-objs), $(obj-m)))
-MX_OBJS                := $(sort $(filter      $(export-objs), $(obj-m)))
-
 include $(TOPDIR)/Rules.make
index 91cc447fb30876d93cfab320c9a2dea57cbc8c23..39753774d4800efd176e075751913e6fa6834b96 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: dmy.c,v 1.5 1999/09/21 14:37:37 davem Exp $
+/* $Id: dmy.c,v 1.6 2000/12/13 05:06:26 davem Exp $
  * drivers/sbus/audio/dummy.c
  *
  * Copyright 1998 Derrick J Brashear (shadow@andrew.cmu.edu)
index ad8b7e140b8ec9f48420ae98e2fa1e7eb6bec76c..b3a736db58e6e6ed9153f045e719fe3a69f42173 100644 (file)
@@ -8,26 +8,18 @@
 #
 
 O_TARGET := sunchar.o
-O_OBJS   := ${O_OBJ} sunkbd.o sunkbdmap.o sunmouse.o sunserial.o zs.o
 
-vfc-objs := vfc_dev.o vfc_i2c.o
+export-objs := su.o
+obj-y := sunkbd.o sunkbdmap.o sunmouse.o sunserial.o zs.o
 
-ifeq ($(CONFIG_PCI),y)
-OX_OBJS        += su.o
-O_OBJS += pcikbd.o
-endif
+vfc-objs := vfc_dev.o vfc_i2c.o
 
-ifeq ($(ARCH),sparc64)
+obj-$(CONFIG_PCI) += su.o pcikbd.o
 
-ifeq ($(CONFIG_PCI),y)
 obj-$(CONFIG_SAB82532)                 += sab82532.o
 obj-$(CONFIG_ENVCTRL)                  += envctrl.o
 obj-$(CONFIG_DISPLAY7SEG)              += display7seg.o
-endif
-
 obj-$(CONFIG_OBP_FLASH)                        += flash.o
-endif
-
 obj-$(CONFIG_SUN_OPENPROMIO)           += openprom.o
 obj-$(CONFIG_SUN_MOSTEK_RTC)           += rtc.o
 obj-$(CONFIG_SUN_BPP)                  += bpp.o
@@ -36,9 +28,6 @@ obj-$(CONFIG_SUN_AURORA)              += aurora.o
 obj-$(CONFIG_TADPOLE_TS102_UCTRL)      += uctrl.o
 obj-$(CONFIG_SUN_JSFLASH)              += jsflash.o
 
-O_OBJS += $(obj-y)
-M_OBJS := $(obj-m)
-
 include $(TOPDIR)/Rules.make
 
 sunkbdmap.o: sunkeymap.c
index eb2c84f925a97818d2652cd60dfa334de5d211fb..71ec104f40e97e7c940e62a58e6a9d303e49a42c 100644 (file)
@@ -20,7 +20,7 @@
  *          Modified by Gerd Knorr <kraxel@cs.tu-berlin.de> to support the
  *          generic cdrom interface
  *
- *       Modified by Jens Axboe <axboe@image.dk> - Uniform sr_packet()
+ *       Modified by Jens Axboe <axboe@suse.de> - Uniform sr_packet()
  *       interface, capabilities probe additions, ioctl cleanups, etc.
  *
  *       Modified by Richard Gooch <rgooch@atnf.csiro.au> to support devfs
@@ -56,9 +56,7 @@
 #include <scsi/scsi_ioctl.h>   /* For the door lock/unlock commands */
 #include "constants.h"
 
-#ifdef MODULE
 MODULE_PARM(xa_test, "i");     /* see sr_ioctl.c */
-#endif
 
 #define MAX_RETRIES    3
 #define SR_TIMEOUT     (30 * HZ)
@@ -200,9 +198,10 @@ static void rw_intr(Scsi_Cmnd * SCpnt)
        int this_count = SCpnt->bufflen >> 9;
        int good_sectors = (result == 0 ? this_count : 0);
        int block_sectors = 0;
+       int device_nr = DEVICE_NR(SCpnt->request.rq_dev);
 
 #ifdef DEBUG
-       printk("sr.c done: %x %x\n", result, SCpnt->request.bh->b_data);
+       printk("sr.c done: %x %p\n", result, SCpnt->request.bh->b_data);
 #endif
        /*
           Handle MEDIUM ERRORs or VOLUME OVERFLOWs that indicate partial success.
@@ -220,7 +219,6 @@ static void rw_intr(Scsi_Cmnd * SCpnt)
                (SCpnt->sense_buffer[4] << 16) |
                (SCpnt->sense_buffer[5] << 8) |
                SCpnt->sense_buffer[6];
-               int device_nr = DEVICE_NR(SCpnt->request.rq_dev);
                if (SCpnt->request.bh != NULL)
                        block_sectors = SCpnt->request.bh->b_size >> 9;
                if (block_sectors < 4)
@@ -241,6 +239,7 @@ static void rw_intr(Scsi_Cmnd * SCpnt)
                    scsi_CDs[device_nr].capacity - error_sector < 4 * 75)
                        sr_sizes[device_nr] = error_sector >> 1;
        }
+
        /*
         * This calls the generic completion function, now that we know
         * how many actual sectors finished, and how many sectors we need
@@ -261,22 +260,95 @@ static request_queue_t *sr_find_queue(kdev_t dev)
        return &scsi_CDs[MINOR(dev)].device->request_queue;
 }
 
+static int sr_scatter_pad(Scsi_Cmnd *SCpnt, int s_size)
+{
+       struct scatterlist *sg, *old_sg = NULL;
+       int i, fsize, bsize, sg_ent;
+       char *front, *back;
+
+       back = front = NULL;
+       sg_ent = SCpnt->use_sg;
+       bsize = 0; /* gcc... */
+
+       /*
+        * need front pad
+        */
+       if ((fsize = SCpnt->request.sector % (s_size >> 9))) {
+               fsize <<= 9;
+               sg_ent++;
+               if ((front = scsi_malloc(fsize)) == NULL)
+                       goto no_mem;
+       }
+       /*
+        * need a back pad too
+        */
+       if ((bsize = s_size - ((SCpnt->request_bufflen + fsize) % s_size))) {
+               sg_ent++;
+               if ((back = scsi_malloc(bsize)) == NULL)
+                       goto no_mem;
+       }
+
+       /*
+        * extend or allocate new scatter-gather table
+        */
+       if (SCpnt->use_sg)
+               old_sg = (struct scatterlist *) SCpnt->request_buffer;
+       else {
+               SCpnt->use_sg = 1;
+               sg_ent++;
+       }
+
+       SCpnt->sglist_len = ((sg_ent * sizeof(struct scatterlist)) + 511) & ~511;
+       if ((sg = scsi_malloc(SCpnt->sglist_len)) == NULL)
+               goto no_mem;
+
+       memset(sg, 0, SCpnt->sglist_len);
+
+       i = 0;
+       if (fsize) {
+               sg[0].address = sg[0].alt_address = front;
+               sg[0].length = fsize;
+               i++;
+       }
+       if (old_sg) {
+               memcpy(sg + i, old_sg, SCpnt->use_sg * sizeof(struct scatterlist));
+               scsi_free(old_sg, ((SCpnt->use_sg * sizeof(struct scatterlist)) + 511) & ~511);
+       } else {
+               sg[i].address = SCpnt->request_buffer;
+               sg[i].length = SCpnt->request_bufflen;
+       }
+
+       SCpnt->request_bufflen += (fsize + bsize);
+       SCpnt->request_buffer = sg;
+       SCpnt->use_sg += i;
+
+       if (bsize) {
+               sg[SCpnt->use_sg].address = back;
+               sg[SCpnt->use_sg].alt_address = back;
+               sg[SCpnt->use_sg].length = bsize;
+               SCpnt->use_sg++;
+       }
+
+       return 0;
+
+no_mem:
+       printk("sr: ran out of mem for scatter pad\n");
+       if (front)
+               scsi_free(front, fsize);
+       if (back)
+               scsi_free(back, bsize);
+
+       return 1;
+}
+
+
 static int sr_init_command(Scsi_Cmnd * SCpnt)
 {
-       int dev, devm, block, this_count;
+       int dev, devm, block, this_count, s_size;
 
        devm = MINOR(SCpnt->request.rq_dev);
        dev = DEVICE_NR(SCpnt->request.rq_dev);
 
-       block = SCpnt->request.sector;
-       this_count = SCpnt->request_bufflen >> 9;
-
-       if (!SCpnt->request.bh) {
-               /*
-                * Umm, yeah, right.   Swapping to a cdrom.  Nice try.
-                */
-               return 0;
-       }
        SCSI_LOG_HLQUEUE(1, printk("Doing sr request, dev = %d, block = %d\n", devm, block));
 
        if (dev >= sr_template.nr_dev ||
@@ -288,46 +360,43 @@ static int sr_init_command(Scsi_Cmnd * SCpnt)
        }
        if (scsi_CDs[dev].device->changed) {
                /*
-                * quietly refuse to do anything to a changed disc until the changed
-                * bit has been reset
+                * quietly refuse to do anything to a changed disc until the
+                * changed bit has been reset
                 */
-               /* printk("SCSI disk has been changed. Prohibiting further I/O.\n"); */
                return 0;
        }
+
+       if ((SCpnt->request.cmd == WRITE) && !scsi_CDs[dev].device->writeable)
+               return 0;
+
        /*
         * we do lazy blocksize switching (when reading XA sectors,
         * see CDROMREADMODE2 ioctl) 
         */
-       if (scsi_CDs[dev].device->sector_size > 2048) {
+       s_size = scsi_CDs[dev].device->sector_size;
+       if (s_size > 2048) {
                if (!in_interrupt())
                        sr_set_blocklength(DEVICE_NR(CURRENT->rq_dev), 2048);
                else
                        printk("sr: can't switch blocksize: in interrupt\n");
        }
 
-       if ((SCpnt->request.cmd == WRITE) && !scsi_CDs[dev].device->writeable)
+       if (s_size != 512 && s_size != 1024 && s_size != 2048) {
+               printk("sr: bad sector size %d\n", s_size);
                return 0;
-
-       if (scsi_CDs[dev].device->sector_size == 1024) {
-               if ((block & 1) || (SCpnt->request.nr_sectors & 1)) {
-                       printk("sr.c:Bad 1K block number requested (%d %ld)",
-                               block, SCpnt->request.nr_sectors);
-                       return 0;
-               } else {
-                       block = block >> 1;
-                       this_count = this_count >> 1;
-               }
        }
-       if (scsi_CDs[dev].device->sector_size == 2048) {
-               if ((block & 3) || (SCpnt->request.nr_sectors & 3)) {
-                       printk("sr.c:Bad 2K block number requested (%d %ld)",
-                               block, SCpnt->request.nr_sectors);
+
+       block = SCpnt->request.sector / (s_size >> 9);
+
+       /*
+        * request doesn't start on hw block boundary, add scatter pads
+        */
+       if ((SCpnt->request.sector % (s_size >> 9)) || (SCpnt->request_bufflen % s_size))
+               if (sr_scatter_pad(SCpnt, s_size))
                        return 0;
-               } else {
-                       block = block >> 2;
-                       this_count = this_count >> 2;
-               }
-       }
+
+       this_count = (SCpnt->request_bufflen >> 9) / (s_size >> 9);
+
        switch (SCpnt->request.cmd) {
        case WRITE:
                SCpnt->cmnd[0] = WRITE_10;
@@ -338,7 +407,8 @@ static int sr_init_command(Scsi_Cmnd * SCpnt)
                SCpnt->sc_data_direction = SCSI_DATA_READ;
                break;
        default:
-               panic("Unknown sr command %d\n", SCpnt->request.cmd);
+               printk("Unknown sr command %d\n", SCpnt->request.cmd);
+               return 0;
        }
 
        SCSI_LOG_HLQUEUE(2, printk("sr%d : %s %d/%ld 512 byte blocks.\n",
@@ -376,6 +446,18 @@ static int sr_init_command(Scsi_Cmnd * SCpnt)
         */
        SCpnt->done = rw_intr;
 
+       {
+               struct scatterlist *sg = SCpnt->request_buffer;
+               int i, size = 0;
+               for (i = 0; i < SCpnt->use_sg; i++)
+                       size += sg[i].length;
+
+               if (size != SCpnt->request_bufflen && SCpnt->use_sg) {
+                       printk("sr: mismatch count %d, bytes %d\n", size, SCpnt->request_bufflen);
+                       SCpnt->request_bufflen = size;
+               }
+       }
+
        /*
         * This indicates that the command is ready from our end to be
         * queued.
@@ -587,7 +669,7 @@ void get_capabilities(int i)
        cmd[2] = 0x2a;
        cmd[4] = 128;
        cmd[3] = cmd[5] = 0;
-       rc = sr_do_ioctl(i, cmd, buffer, 128, 1, SCSI_DATA_READ);
+       rc = sr_do_ioctl(i, cmd, buffer, 128, 1, SCSI_DATA_READ, NULL);
 
        if (-EINVAL == rc) {
                /* failed, drive has'nt this mode page */
@@ -655,53 +737,12 @@ void get_capabilities(int i)
  */
 static int sr_packet(struct cdrom_device_info *cdi, struct cdrom_generic_command *cgc)
 {
-       Scsi_Request *SRpnt;
        Scsi_Device *device = scsi_CDs[MINOR(cdi->dev)].device;
-       unsigned char *buffer = cgc->buffer;
-       int buflen;
-
-       /* get the device */
-       SRpnt = scsi_allocate_request(device);
-       if (SRpnt == NULL)
-               return -ENODEV; /* this just doesn't seem right /axboe */
-
-       /* use buffer for ISA DMA */
-       buflen = (cgc->buflen + 511) & ~511;
-       if (cgc->buffer && SRpnt->sr_host->unchecked_isa_dma &&
-           (virt_to_phys(cgc->buffer) + cgc->buflen - 1 > ISA_DMA_THRESHOLD)) {
-               buffer = scsi_malloc(buflen);
-               if (buffer == NULL) {
-                       printk("sr: SCSI DMA pool exhausted.");
-                       return -ENOMEM;
-               }
-               memcpy(buffer, cgc->buffer, cgc->buflen);
-       }
+
        /* set the LUN */
        cgc->cmd[1] |= device->lun << 5;
 
-       /* do the locking and issue the command */
-       SRpnt->sr_request.rq_dev = cdi->dev;
-       /* scsi_wait_req sets the command length */
-       SRpnt->sr_cmd_len = 0;
-
-       SRpnt->sr_data_direction = cgc->data_direction;
-       scsi_wait_req(SRpnt, (void *) cgc->cmd, (void *) buffer, cgc->buflen,
-                     SR_TIMEOUT, MAX_RETRIES);
-
-       if ((cgc->stat = SRpnt->sr_result))
-               cgc->sense = (struct request_sense *) SRpnt->sr_sense_buffer;
-
-       /* release */
-       SRpnt->sr_request.rq_dev = MKDEV(0, 0);
-       scsi_release_request(SRpnt);
-       SRpnt = NULL;
-
-       /* write DMA buffer back if used */
-       if (buffer && (buffer != cgc->buffer)) {
-               memcpy(cgc->buffer, buffer, cgc->buflen);
-               scsi_free(buffer, buflen);
-       }
-
+       cgc->stat = sr_do_ioctl(MINOR(cdi->dev), cgc->cmd, cgc->buffer, cgc->buflen, cgc->quiet, cgc->data_direction, cgc->sense);
 
        return cgc->stat;
 }
index d3239e6476367340804cf2b3a0856f891a41aaae..19adfe4eb75f79c2d65d0f2fce5e02a01d0cff11 100644 (file)
@@ -36,7 +36,7 @@ typedef struct {
 
 extern Scsi_CD *scsi_CDs;
 
-int sr_do_ioctl(int, unsigned char *, void *, unsigned, int, int);
+int sr_do_ioctl(int, unsigned char *, void *, unsigned, int, int, struct request_sense *);
 
 int sr_lock_door(struct cdrom_device_info *, int);
 int sr_tray_move(struct cdrom_device_info *, int);
index 4448026521ffe4626290207d6369a79651def486..cee7d79ba46f6704e5fe3b9003a493248046c2ec 100644 (file)
@@ -30,11 +30,52 @@ extern void get_sectorsize(int);
 /* In fact, it is very slow if it has to spin up first */
 #define IOCTL_TIMEOUT 30*HZ
 
+/* ATAPI drives don't have a SCMD_PLAYAUDIO_TI command.  When these drives
+   are emulating a SCSI device via the idescsi module, they need to have
+   CDROMPLAYTRKIND commands translated into CDROMPLAYMSF commands for them */
+
+static int sr_fake_playtrkind(struct cdrom_device_info *cdi, struct cdrom_ti *ti)
+{
+       struct cdrom_tocentry trk0_te, trk1_te;
+       struct cdrom_tochdr tochdr;
+       u_char sr_cmd[10];
+       int ntracks, ret;
+
+       if ((ret = sr_audio_ioctl(cdi, CDROMREADTOCHDR, &tochdr)))
+               return ret;
+
+       ntracks = tochdr.cdth_trk1 - tochdr.cdth_trk0 + 1;
+       
+       if (ti->cdti_trk1 == ntracks) 
+               ti->cdti_trk1 = CDROM_LEADOUT;
+       else 
+               ti->cdti_trk1 ++;
+
+       trk0_te.cdte_track = ti->cdti_trk0;
+       trk0_te.cdte_format = CDROM_MSF;
+       trk1_te.cdte_track = ti->cdti_trk1;
+       trk1_te.cdte_format = CDROM_MSF;
+       
+       if ((ret = sr_audio_ioctl(cdi, CDROMREADTOCENTRY, &trk0_te)))
+               return ret;
+       if ((ret = sr_audio_ioctl(cdi, CDROMREADTOCENTRY, &trk1_te)))
+               return ret;
+       
+       sr_cmd[0] = GPCMD_PLAY_AUDIO_MSF;
+       sr_cmd[3] = trk0_te.cdte_addr.msf.minute;
+       sr_cmd[4] = trk0_te.cdte_addr.msf.second;
+       sr_cmd[5] = trk0_te.cdte_addr.msf.frame;
+       sr_cmd[6] = trk1_te.cdte_addr.msf.minute;
+       sr_cmd[7] = trk1_te.cdte_addr.msf.second;
+       sr_cmd[8] = trk1_te.cdte_addr.msf.frame;
+       return sr_do_ioctl(MINOR(cdi->dev), sr_cmd, NULL, 0, 0, SCSI_DATA_NONE, NULL);
+}
+
 /* We do our own retries because we want to know what the specific
    error code is.  Normally the UNIT_ATTENTION code will automatically
    clear after one error */
 
-int sr_do_ioctl(int target, unsigned char *sr_cmd, void *buffer, unsigned buflength, int quiet, int readwrite)
+int sr_do_ioctl(int target, unsigned char *sr_cmd, void *buffer, unsigned buflength, int quiet, int readwrite, struct request_sense *sense)
 {
        Scsi_Request *SRpnt;
        Scsi_Device *SDev;
@@ -132,7 +173,10 @@ int sr_do_ioctl(int target, unsigned char *sr_cmd, void *buffer, unsigned buflen
                        err = -EIO;
                }
        }
-       result = SRpnt->sr_result;
+
+       if (sense)
+               memcpy(sense, SRpnt->sr_sense_buffer, sizeof(*sense));
+
        /* Wake up a process waiting for device */
        scsi_release_request(SRpnt);
        SRpnt = NULL;
@@ -149,7 +193,7 @@ static int test_unit_ready(int minor)
        sr_cmd[0] = GPCMD_TEST_UNIT_READY;
        sr_cmd[1] = ((scsi_CDs[minor].device->lun) << 5);
        sr_cmd[2] = sr_cmd[3] = sr_cmd[4] = sr_cmd[5] = 0;
-       return sr_do_ioctl(minor, sr_cmd, NULL, 0, 1, SCSI_DATA_NONE);
+       return sr_do_ioctl(minor, sr_cmd, NULL, 0, 1, SCSI_DATA_NONE, NULL);
 }
 
 int sr_tray_move(struct cdrom_device_info *cdi, int pos)
@@ -161,7 +205,7 @@ int sr_tray_move(struct cdrom_device_info *cdi, int pos)
        sr_cmd[2] = sr_cmd[3] = sr_cmd[5] = 0;
        sr_cmd[4] = (pos == 0) ? 0x03 /* close */ : 0x02 /* eject */ ;
 
-       return sr_do_ioctl(MINOR(cdi->dev), sr_cmd, NULL, 0, 0, SCSI_DATA_NONE);
+       return sr_do_ioctl(MINOR(cdi->dev), sr_cmd, NULL, 0, 0, SCSI_DATA_NONE, NULL);
 }
 
 int sr_lock_door(struct cdrom_device_info *cdi, int lock)
@@ -238,7 +282,7 @@ int sr_get_mcn(struct cdrom_device_info *cdi, struct cdrom_mcn *mcn)
        sr_cmd[8] = 24;
        sr_cmd[9] = 0;
 
-       result = sr_do_ioctl(MINOR(cdi->dev), sr_cmd, buffer, 24, 0, SCSI_DATA_READ);
+       result = sr_do_ioctl(MINOR(cdi->dev), sr_cmd, buffer, 24, 0, SCSI_DATA_READ, NULL);
 
        memcpy(mcn->medium_catalog_number, buffer + 9, 13);
        mcn->medium_catalog_number[13] = 0;
@@ -267,7 +311,7 @@ int sr_select_speed(struct cdrom_device_info *cdi, int speed)
        sr_cmd[2] = (speed >> 8) & 0xff;        /* MSB for speed (in kbytes/sec) */
        sr_cmd[3] = speed & 0xff;       /* LSB */
 
-       if (sr_do_ioctl(MINOR(cdi->dev), sr_cmd, NULL, 0, 0, SCSI_DATA_NONE))
+       if (sr_do_ioctl(MINOR(cdi->dev), sr_cmd, NULL, 0, 0, SCSI_DATA_NONE, NULL))
                return -EIO;
        return 0;
 }
@@ -296,7 +340,7 @@ int sr_audio_ioctl(struct cdrom_device_info *cdi, unsigned int cmd, void *arg)
                        sr_cmd[2] = sr_cmd[3] = sr_cmd[4] = sr_cmd[5] = 0;
                        sr_cmd[8] = 12;         /* LSB of length */
 
-                       result = sr_do_ioctl(target, sr_cmd, buffer, 12, 1, SCSI_DATA_READ);
+                       result = sr_do_ioctl(target, sr_cmd, buffer, 12, 1, SCSI_DATA_READ, NULL);
 
                        tochdr->cdth_trk0 = buffer[2];
                        tochdr->cdth_trk1 = buffer[3];
@@ -315,7 +359,7 @@ int sr_audio_ioctl(struct cdrom_device_info *cdi, unsigned int cmd, void *arg)
                        sr_cmd[6] = tocentry->cdte_track;
                        sr_cmd[8] = 12;         /* LSB of length */
 
-                       result = sr_do_ioctl(target, sr_cmd, buffer, 12, 0, SCSI_DATA_READ);
+                       result = sr_do_ioctl(target, sr_cmd, buffer, 12, 0, SCSI_DATA_READ, NULL);
 
                        tocentry->cdte_ctrl = buffer[5] & 0xf;
                        tocentry->cdte_adr = buffer[5] >> 4;
@@ -341,7 +385,10 @@ int sr_audio_ioctl(struct cdrom_device_info *cdi, unsigned int cmd, void *arg)
                sr_cmd[7] = ti->cdti_trk1;
                sr_cmd[8] = ti->cdti_ind1;
 
-               result = sr_do_ioctl(target, sr_cmd, NULL, 255, 0, SCSI_DATA_NONE);
+               result = sr_do_ioctl(target, sr_cmd, NULL, 0, 0, SCSI_DATA_NONE, NULL);
+               if (result == -EDRIVE_CANT_DO_THIS)
+                       result = sr_fake_playtrkind(cdi, ti);
+
                break;
        }
 
@@ -402,7 +449,7 @@ int sr_read_cd(int minor, unsigned char *dest, int lba, int format, int blksize)
                cmd[9] = 0x10;
                break;
        }
-       return sr_do_ioctl(minor, cmd, dest, blksize, 0, SCSI_DATA_READ);
+       return sr_do_ioctl(minor, cmd, dest, blksize, 0, SCSI_DATA_READ, NULL);
 }
 
 /*
@@ -440,7 +487,7 @@ int sr_read_sector(int minor, int lba, int blksize, unsigned char *dest)
        cmd[4] = (unsigned char) (lba >> 8) & 0xff;
        cmd[5] = (unsigned char) lba & 0xff;
        cmd[8] = 1;
-       rc = sr_do_ioctl(minor, cmd, dest, blksize, 0, SCSI_DATA_READ);
+       rc = sr_do_ioctl(minor, cmd, dest, blksize, 0, SCSI_DATA_READ, NULL);
 
        return rc;
 }
index a57c25c393de575fd4154f1b3606e8bad3d3de5b..9aec139e43aede7115c9b126c37a7b1744d8b99c 100644 (file)
@@ -132,7 +132,7 @@ int sr_set_blocklength(int minor, int blocklength)
        modesel->density = density;
        modesel->block_length_med = (blocklength >> 8) & 0xff;
        modesel->block_length_lo = blocklength & 0xff;
-       if (0 == (rc = sr_do_ioctl(minor, cmd, buffer, sizeof(*modesel), 0, SCSI_DATA_WRITE))) {
+       if (0 == (rc = sr_do_ioctl(minor, cmd, buffer, sizeof(*modesel), 0, SCSI_DATA_WRITE, NULL))) {
                scsi_CDs[minor].device->sector_size = blocklength;
        }
 #ifdef DEBUG
@@ -176,7 +176,7 @@ int sr_cd_check(struct cdrom_device_info *cdi)
                cmd[1] = (scsi_CDs[minor].device->lun << 5);
                cmd[8] = 12;
                cmd[9] = 0x40;
-               rc = sr_do_ioctl(minor, cmd, buffer, 12, 1, SCSI_DATA_READ);
+               rc = sr_do_ioctl(minor, cmd, buffer, 12, 1, SCSI_DATA_READ, NULL);
                if (rc != 0)
                        break;
                if ((buffer[0] << 8) + buffer[1] < 0x0a) {
@@ -200,7 +200,7 @@ int sr_cd_check(struct cdrom_device_info *cdi)
                        cmd[0] = 0xde;
                        cmd[1] = (scsi_CDs[minor].device->lun << 5) | 0x03;
                        cmd[2] = 0xb0;
-                       rc = sr_do_ioctl(minor, cmd, buffer, 0x16, 1, SCSI_DATA_READ);
+                       rc = sr_do_ioctl(minor, cmd, buffer, 0x16, 1, SCSI_DATA_READ, NULL);
                        if (rc != 0)
                                break;
                        if (buffer[14] != 0 && buffer[14] != 0xb0) {
@@ -224,7 +224,7 @@ int sr_cd_check(struct cdrom_device_info *cdi)
                        memset(cmd, 0, MAX_COMMAND_SIZE);
                        cmd[0] = 0xc7;
                        cmd[1] = (scsi_CDs[minor].device->lun << 5) | 3;
-                       rc = sr_do_ioctl(minor, cmd, buffer, 4, 1, SCSI_DATA_READ);
+                       rc = sr_do_ioctl(minor, cmd, buffer, 4, 1, SCSI_DATA_READ, NULL);
                        if (rc == -EINVAL) {
                                printk(KERN_INFO "sr%d: Hmm, seems the drive "
                                       "doesn't support multisession CD's\n", minor);
@@ -249,7 +249,7 @@ int sr_cd_check(struct cdrom_device_info *cdi)
                cmd[1] = (scsi_CDs[minor].device->lun << 5);
                cmd[8] = 0x04;
                cmd[9] = 0x40;
-               rc = sr_do_ioctl(minor, cmd, buffer, 0x04, 1, SCSI_DATA_READ);
+               rc = sr_do_ioctl(minor, cmd, buffer, 0x04, 1, SCSI_DATA_READ, NULL);
                if (rc != 0) {
                        break;
                }
@@ -263,7 +263,7 @@ int sr_cd_check(struct cdrom_device_info *cdi)
                cmd[6] = rc & 0x7f;     /* number of last session */
                cmd[8] = 0x0c;
                cmd[9] = 0x40;
-               rc = sr_do_ioctl(minor, cmd, buffer, 12, 1, SCSI_DATA_READ);
+               rc = sr_do_ioctl(minor, cmd, buffer, 12, 1, SCSI_DATA_READ, NULL);
                if (rc != 0) {
                        break;
                }
index 9cbdedcc8aabf87868c19ecd7fb380784cba06e4..30cff4ad4c9bb66bd55ce7089ac8a60872f0401f 100644 (file)
@@ -6,10 +6,6 @@
 # unless it's something special (ie not a .c file).
 #
 
-SUB_DIRS     :=
-MOD_SUB_DIRS := $(SUB_DIRS)
-ALL_SUB_DIRS := $(SUB_DIRS)
-
 obj-y   :=
 obj-n   :=
 obj-m   :=
@@ -20,10 +16,6 @@ obj-$(CONFIG_PHONE) += phonedev.o
 obj-$(CONFIG_PHONE_IXJ) += ixj.o
 
 O_TARGET := telephony.o
-O_OBJS   := $(filter-out $(export-objs), $(obj-y))
-OX_OBJS  := $(filter     $(export-objs), $(obj-y))
-M_OBJS   := $(sort $(filter-out $(export-objs), $(obj-m)))
-MX_OBJS  := $(sort $(filter     $(export-objs), $(obj-m)))
 
 include $(TOPDIR)/Rules.make
 
index 5c50b578c7b2a885f11df93b0668f6ff43304f8d..241f7d5f62eb20cf6f0fed707ad53573eb141e36 100644 (file)
@@ -248,7 +248,7 @@ static int bus_reset( Scsi_Cmnd *srb )
         for (i = 0; i < us->pusb_dev->actconfig->bNumInterfaces; i++) {
                struct usb_interface *intf =
                        &us->pusb_dev->actconfig->interface[i];
-               struct usb_device_id *id;
+               const struct usb_device_id *id;
 
                /* if this is an unclaimed interface, skip it */
                if (!intf->driver) {
index ce31133b985e8bb15d8f7c28bf8000de621465c3..6c254c7014da16e93c170e492fe7b7063dc88709 100644 (file)
@@ -93,7 +93,8 @@ static int my_host_number;
 struct us_data *us_list;
 struct semaphore us_list_semaphore;
 
-static void * storage_probe(struct usb_device *dev, unsigned int ifnum);
+static void * storage_probe(struct usb_device *dev, unsigned int ifnum,
+                           const struct usb_device_id *id);
 static void storage_disconnect(struct usb_device *dev, void *ptr);
 struct usb_driver usb_storage_driver = {
        name:           "usb-storage",
@@ -615,7 +616,8 @@ static int usb_stor_allocate_irq(struct us_data *ss)
 }
 
 /* Probe to see if a new device is actually a SCSI device */
-static void * storage_probe(struct usb_device *dev, unsigned int ifnum)
+static void * storage_probe(struct usb_device *dev, unsigned int ifnum,
+                           const struct usb_device_id *id)
 {
        int i;
        char mf[USB_STOR_STRING_LEN];                /* manufacturer */
index 2a48d4d7c0b78db55d8b51dec5b729701e2f5aed..20273eccd06d83032b29ea80f6f89714136fa737 100644 (file)
@@ -104,13 +104,14 @@ if [ "$CONFIG_FB" = "y" ]; then
         if [ "$CONFIG_FB_MATROX" != "n" ]; then
            bool '    Millennium I/II support' CONFIG_FB_MATROX_MILLENIUM
            bool '    Mystique support' CONFIG_FB_MATROX_MYSTIQUE
-           bool '    G100/G200/G400 support' CONFIG_FB_MATROX_G100
+           bool '    G100/G200/G400/G450 support' CONFIG_FB_MATROX_G100
             if [ "$CONFIG_I2C" != "n" ]; then
               dep_tristate '      Matrox I2C support' CONFIG_FB_MATROX_I2C $CONFIG_FB_MATROX $CONFIG_I2C_ALGOBIT
               if [ "$CONFIG_FB_MATROX_G100" = "y" ]; then
                  dep_tristate '      G400 second head support' CONFIG_FB_MATROX_MAVEN $CONFIG_FB_MATROX_I2C
               fi
             fi
+            dep_tristate '      G450 second head support' CONFIG_FB_MATROX_G450 $CONFIG_FB_MATROX_G100
            bool '    Multihead support' CONFIG_FB_MATROX_MULTIHEAD
         fi
         tristate '  ATI Mach64 display support (EXPERIMENTAL)' CONFIG_FB_ATY
index 14c6a44536800555e68e363a39f32888c150ae7b..1ebd0338fa513417484491d32c66f5b2a98deb02 100644 (file)
@@ -3,8 +3,8 @@
 # Rewritten to use lists instead of if-statements.
 
 O_TARGET := video.o
-O_OBJS   :=
-M_OBJS   :=
+
+mod-subdirs    := matrox
 
 # All of the (potential) objects that export symbols.
 # This list comes from 'grep -l EXPORT_SYMBOL *.[hc]'.
@@ -14,8 +14,8 @@ export-objs    := fbmem.o fbcmap.o fbcon.o fbmon.o modedb.o \
                  fbcon-vga.o fbcon-iplan2p2.o fbcon-iplan2p4.o \
                  fbcon-iplan2p8.o fbcon-vga-planes.o fbcon-cfb16.o \
                  fbcon-cfb2.o fbcon-cfb24.o fbcon-cfb32.o fbcon-cfb4.o \
-                 fbcon-cfb8.o fbcon-mac.o fbcon-mfb.o fbcon-vga8-planes.o \
-                 matrox/matroxfb.o cyber2000fb.o fbcon-hga.o
+                 fbcon-cfb8.o fbcon-mac.o fbcon-mfb.o \
+                 cyber2000fb.o fbcon-hga.o
 
 # Each configuration option enables a list of files.
 
index 912414b5c265462062d43f3006770cdfa239df9d..2b7945150cbe59c8c2fdbc021836e4b7cfb9bfae 100644 (file)
@@ -14,6 +14,7 @@ export-objs    :=  matroxfb_base.o matroxfb_accel.o matroxfb_DAC1064.o matroxfb_
 obj-$(CONFIG_FB_MATROX)           += matroxfb_base.o matroxfb_accel.o matroxfb_DAC1064.o matroxfb_Ti3026.o matroxfb_misc.o
 obj-$(CONFIG_FB_MATROX_I2C)       += i2c-matroxfb.o
 obj-$(CONFIG_FB_MATROX_MAVEN)     += matroxfb_maven.o matroxfb_crtc2.o
+obj-$(CONFIG_FB_MATROX_G450)     += matroxfb_g450.o matroxfb_crtc2.o
 
 include $(TOPDIR)/Rules.make
 
index 1c611ebee422144f9d6a6c372665ea73724fbb87..c080de89a8ce33d4e2c83960d1c46208b4d938fe 100644 (file)
@@ -227,15 +227,35 @@ static void DAC1064_calcclock(CPMINFO unsigned int freq, unsigned int fmax, unsi
        DBG("DAC1064_calcclock")
 
        fvco = PLL_calcclock(PMINFO freq, fmax, in, feed, &p);
-       p = (1 << p) - 1;
-       if (fvco <= 100000)
-               ;
-       else if (fvco <= 140000)
-               p |= 0x08;
-       else if (fvco <= 180000)
-               p |= 0x10;
-       else
-               p |= 0x18;
+       
+       if (ACCESS_FBINFO(devflags.g450dac)) {
+               if (fvco <= 300000)             /* 276-324 */
+                       ;
+               else if (fvco <= 400000)        /* 378-438 */
+                       p |= 0x08;
+               else if (fvco <= 550000)        /* 540-567 */
+                       p |= 0x10;
+               else if (fvco <= 690000)        /* 675-695 */
+                       p |= 0x18;
+               else if (fvco <= 800000)        /* 776-803 */
+                       p |= 0x20;
+               else if (fvco <= 891000)        /* 891-891 */
+                       p |= 0x28;
+               else if (fvco <= 940000)        /* 931-945 */
+                       p |= 0x30;
+               else                            /* <959 */
+                       p |= 0x38;
+       } else {
+               p = (1 << p) - 1;
+               if (fvco <= 100000)
+                       ;
+               else if (fvco <= 140000)
+                       p |= 0x08;
+               else if (fvco <= 180000)
+                       p |= 0x10;
+               else
+                       p |= 0x18;
+       }
        *post = p;
 }
 
@@ -340,15 +360,19 @@ void DAC1064_global_init(CPMINFO struct matrox_hw_state* hw) {
        hw->DACreg[POS1064_XMISCCTRL] &= M1064_XMISCCTRL_DAC_WIDTHMASK;
        hw->DACreg[POS1064_XMISCCTRL] |= M1064_XMISCCTRL_LUT_EN;
        hw->DACreg[POS1064_XPIXCLKCTRL] = M1064_XPIXCLKCTRL_PLL_UP | M1064_XPIXCLKCTRL_EN | M1064_XPIXCLKCTRL_SRC_PLL;
-#if defined(CONFIG_FB_MATROX_MAVEN) || defined(CONFIG_FB_MATROX_MAVEN_MODULE)
+       hw->DACreg[POS1064_XOUTPUTCONN] = 0x01; /* output #1 enabled */
        if (ACCESS_FBINFO(output.ph) & MATROXFB_OUTPUT_CONN_SECONDARY) {
-               hw->DACreg[POS1064_XPIXCLKCTRL] = M1064_XPIXCLKCTRL_PLL_UP | M1064_XPIXCLKCTRL_EN | M1064_XPIXCLKCTRL_SRC_EXT;
-               hw->DACreg[POS1064_XMISCCTRL] |= GX00_XMISCCTRL_MFC_MAFC | G400_XMISCCTRL_VDO_MAFC12;
+               if (ACCESS_FBINFO(devflags.g450dac)) {
+                       hw->DACreg[POS1064_XPIXCLKCTRL] = M1064_XPIXCLKCTRL_PLL_UP | M1064_XPIXCLKCTRL_EN | M1064_XPIXCLKCTRL_SRC_PLL2;
+                       hw->DACreg[POS1064_XOUTPUTCONN] = 0x05; /* output #1 enabled; CRTC1 connected to output #2 */
+               } else {
+                       hw->DACreg[POS1064_XPIXCLKCTRL] = M1064_XPIXCLKCTRL_PLL_UP | M1064_XPIXCLKCTRL_EN | M1064_XPIXCLKCTRL_SRC_EXT;
+                       hw->DACreg[POS1064_XMISCCTRL] |= GX00_XMISCCTRL_MFC_MAFC | G400_XMISCCTRL_VDO_MAFC12;
+               }
        } else if (ACCESS_FBINFO(output.sh) & MATROXFB_OUTPUT_CONN_SECONDARY) {
                hw->DACreg[POS1064_XMISCCTRL] |= GX00_XMISCCTRL_MFC_MAFC | G400_XMISCCTRL_VDO_C2_MAFC12;
-       } else 
-#endif 
-       if (ACCESS_FBINFO(output.ph) & MATROXFB_OUTPUT_CONN_DFP)
+               hw->DACreg[POS1064_XOUTPUTCONN] = 0x09; /* output #1 enabled; CRTC2 connected to output #2 */
+       } else if (ACCESS_FBINFO(output.ph) & MATROXFB_OUTPUT_CONN_DFP)
                hw->DACreg[POS1064_XMISCCTRL] |= GX00_XMISCCTRL_MFC_PANELLINK | G400_XMISCCTRL_VDO_MAFC12;
        else
                hw->DACreg[POS1064_XMISCCTRL] |= GX00_XMISCCTRL_MFC_DIS;
@@ -363,6 +387,10 @@ void DAC1064_global_restore(CPMINFO const struct matrox_hw_state* hw) {
        if (ACCESS_FBINFO(devflags.accelerator) == FB_ACCEL_MATROX_MGAG400) {
                outDAC1064(PMINFO 0x20, 0x04);
                outDAC1064(PMINFO 0x1F, 0x00);
+               if (ACCESS_FBINFO(devflags.g450dac)) {
+                       outDAC1064(PMINFO M1064_X8B, 0xCC);     /* only matrox know... */
+                       outDAC1064(PMINFO M1064_XOUTPUTCONN, hw->DACreg[POS1064_XOUTPUTCONN]);
+               }
        }
 }
 
@@ -738,7 +766,11 @@ static int MGAG100_preinit(WPMINFO struct matrox_hw_state* hw){
        DBG("MGAG100_preinit")
 
        /* there are some instabilities if in_div > 19 && vco < 61000 */
-       ACCESS_FBINFO(features.pll.vco_freq_min) = 62000;
+       if (ACCESS_FBINFO(devflags.g450dac)) {
+               ACCESS_FBINFO(features.pll.vco_freq_min) = 130000;      /* my sample: >118 */
+       } else {
+               ACCESS_FBINFO(features.pll.vco_freq_min) = 62000;
+       }
        ACCESS_FBINFO(features.pll.ref_freq)     = 27000;
        ACCESS_FBINFO(features.pll.feed_div_min) = 7;
        ACCESS_FBINFO(features.pll.feed_div_max) = 127;
index 256a11d2c559516f16869077ba2a3752fb55b688..e072657b3b1ef551bd23212f93612637f279ae88 100644 (file)
@@ -63,6 +63,8 @@ void DAC1064_global_restore(CPMINFO const struct matrox_hw_state*);
 #define      M1064_XPIXCLKCTRL_SRC_PCI         0x00
 #define      M1064_XPIXCLKCTRL_SRC_PLL         0x01
 #define      M1064_XPIXCLKCTRL_SRC_EXT         0x02
+#define             M1064_XPIXCLKCTRL_SRC_SYS          0x03    /* G200/G400 */
+#define      M1064_XPIXCLKCTRL_SRC_PLL2                0x03    /* G450 */
 #define      M1064_XPIXCLKCTRL_SRC_MASK                0x03
 #define      M1064_XPIXCLKCTRL_EN              0x00
 #define      M1064_XPIXCLKCTRL_DIS             0x04
@@ -132,6 +134,16 @@ void DAC1064_global_restore(CPMINFO const struct matrox_hw_state*);
 #define M1064_XPIXPLLCP                0x4E
 #define M1064_XPIXPLLSTAT      0x4F
 
+#define M1064_XTVO_IDX         0x87
+#define M1064_XTVO_DATA                0x88
+
+#define M1064_XOUTPUTCONN      0x8A
+#define M1064_X8B              0x8B
+#define M1064_XPIXPLL2STAT     0x8C
+#define M1064_XPIXPLL2P                0x8D
+#define M1064_XPIXPLL2N                0x8E
+#define M1064_XPIXPLL2M                0x8F
+
 enum POS1064 {
        POS1064_XCURADDL=0, POS1064_XCURADDH, POS1064_XCURCTRL,
        POS1064_XCURCOL0RED, POS1064_XCURCOL0GREEN, POS1064_XCURCOL0BLUE,
@@ -141,7 +153,8 @@ enum POS1064 {
        POS1064_XMISCCTRL,
        POS1064_XGENIOCTRL, POS1064_XGENIODATA, POS1064_XZOOMCTRL, POS1064_XSENSETEST,
        POS1064_XCRCBITSEL,
-       POS1064_XCOLKEYMASKL, POS1064_XCOLKEYMASKH, POS1064_XCOLKEYL, POS1064_XCOLKEYH };
+       POS1064_XCOLKEYMASKL, POS1064_XCOLKEYMASKH, POS1064_XCOLKEYL, POS1064_XCOLKEYH,
+       POS1064_XOUTPUTCONN };
 
 
 #endif /* __MATROXFB_DAC1064_H__ */
index 5a089349626679793f4cc4eea123673c600108e9..09089520417c2bac1efa6efab156a0ee700400ca 100644 (file)
@@ -1421,12 +1421,15 @@ static struct video_board vbG400                = {0x2000000, 0x1000000, FB_ACCEL_MATROX_MGAG4
 #define DEVF_CRTC2             0x0800
 #define DEVF_MAVEN_CAPABLE     0x1000
 #define DEVF_PANELLINK_CAPABLE 0x2000
+#define DEVF_G450DAC           0x4000
 
 #define DEVF_GCORE     (DEVF_VIDEO64BIT | DEVF_SWAPS | DEVF_CROSS4MB | DEVF_DDC_8_2)
 #define DEVF_G2CORE    (DEVF_GCORE | DEVF_ANY_VXRES | DEVF_MAVEN_CAPABLE | DEVF_PANELLINK_CAPABLE)
 #define DEVF_G100      (DEVF_GCORE) /* no doc, no vxres... */
 #define DEVF_G200      (DEVF_G2CORE)
 #define DEVF_G400      (DEVF_G2CORE | DEVF_SUPPORT32MB | DEVF_TEXT16B | DEVF_CRTC2)
+/* if you'll find how to drive DFP... */
+#define DEVF_G450      (DEVF_GCORE | DEVF_ANY_VXRES | DEVF_SUPPORT32MB | DEVF_TEXT16B | DEVF_CRTC2 | DEVF_G450DAC)
 
 static struct board {
        unsigned short vendor, device, rev, svid, sid;
@@ -1554,18 +1557,24 @@ static struct board {
                230000,
                &vbG200,
                "unknown G200 (AGP)"},
-       {PCI_VENDOR_ID_MATROX,  PCI_DEVICE_ID_MATROX_G400_AGP,  0xFF,
+       {PCI_VENDOR_ID_MATROX,  PCI_DEVICE_ID_MATROX_G400_AGP,  0x80,
                PCI_SS_VENDOR_ID_MATROX,        PCI_SS_ID_MATROX_MILLENNIUM_G400_MAX_AGP,
                DEVF_G400,
                360000,
                &vbG400,
                "Millennium G400 MAX (AGP)"},
-       {PCI_VENDOR_ID_MATROX,  PCI_DEVICE_ID_MATROX_G400_AGP,  0xFF,
+       {PCI_VENDOR_ID_MATROX,  PCI_DEVICE_ID_MATROX_G400_AGP,  0x80,
                0,                      0,
                DEVF_G400,
                300000,
                &vbG400,
                "unknown G400 (AGP)"},
+       {PCI_VENDOR_ID_MATROX,  PCI_DEVICE_ID_MATROX_G400_AGP,  0xFF,
+               0,                      0,
+               DEVF_G450,
+               500000,         /* ??? vco goes up to 900MHz... */
+               &vbG400,
+               "unknown G450 (AGP)"},
 #endif
        {0,                     0,                              0xFF,
                0,                      0,
@@ -1627,7 +1636,7 @@ static int initMatrox2(WPMINFO struct display* d, struct board* b){
                if (dfp)
                        ACCESS_FBINFO(output.ph) |= MATROXFB_OUTPUT_CONN_DFP;
        }
-
+       ACCESS_FBINFO(devflags.g450dac) = b->flags & DEVF_G450DAC;
        ACCESS_FBINFO(devflags.textstep) = ACCESS_FBINFO(devflags.vgastep) * ACCESS_FBINFO(devflags.textmode);
        ACCESS_FBINFO(devflags.textvram) = 65536 / ACCESS_FBINFO(devflags.textmode);
 
index 125f8be4f511a5f6e6863e72230f07062da9cae9..68a8ab883e4c054f7bb2c0d778f5a031e668a6dc 100644 (file)
@@ -374,7 +374,7 @@ struct mavenregs {
 struct matrox_hw_state {
        u_int32_t       MXoptionReg;
        unsigned char   DACclk[6];
-       unsigned char   DACreg[64];
+       unsigned char   DACreg[80];
        unsigned char   MiscOutReg;
        unsigned char   DACpal[768];
        unsigned char   CRTC[25];
@@ -531,6 +531,7 @@ struct matrox_fb_info {
                unsigned int    ydstorg;        /* offset in bytes from video start to usable memory */
                                                /* 0 except for 6MB Millenium */
                int             memtype;
+               int             g450dac;
                              } devflags;
        struct display_switch   dispsw;
        struct {
index 515eb1e78a6a2ccb0cfaed8652cf48e9fc991cbd..6119dbbb83f6cfa2a789524d181314d45cac7d49 100644 (file)
@@ -104,9 +104,14 @@ static void matroxfb_dh_restore(struct matroxfb_dh_fb_info* m2info,
                tmp |= 0x00000001;      /* enable CRTC2 */
 
                if (ACCESS_FBINFO(output.sh) & MATROXFB_OUTPUT_CONN_SECONDARY) {
-                       tmp |= 0x00000002; /* source from VDOCLK */
-                       tmp |= 0xC0000000; /* enable vvidrst & hvidrst */
-                       /* MGA TVO is our clock source */
+                       if (ACCESS_FBINFO(devflags.g450dac)) {
+                               tmp |= 0x00000006; /* source from secondary pixel PLL */
+                               /* no vidrst */
+                       } else {
+                               tmp |= 0x00000002; /* source from VDOCLK */
+                               tmp |= 0xC0000000; /* enable vvidrst & hvidrst */
+                               /* MGA TVO is our clock source */
+                       }
                } else if (ACCESS_FBINFO(output.sh) & MATROXFB_OUTPUT_CONN_PRIMARY) {
                        tmp |= 0x00000004; /* source from pixclock */
                        /* PIXPLL is our clock source */
diff --git a/drivers/video/matrox/matroxfb_g450.c b/drivers/video/matrox/matroxfb_g450.c
new file mode 100644 (file)
index 0000000..8640289
--- /dev/null
@@ -0,0 +1,201 @@
+#include "matroxfb_g450.h"
+#include "matroxfb_misc.h"
+#include "matroxfb_DAC1064.h"
+#include <linux/matroxfb.h>
+#include <asm/uaccess.h>
+
+static int matroxfb_g450_get_reg(WPMINFO int reg) {
+       int val;
+
+       matroxfb_DAC_lock();
+       val = matroxfb_DAC_in(PMINFO reg);
+       matroxfb_DAC_unlock();
+       return val;
+}
+
+static int matroxfb_g450_set_reg(WPMINFO int reg, int val) {
+       matroxfb_DAC_lock();
+       matroxfb_DAC_out(PMINFO reg, val);
+       matroxfb_DAC_unlock();
+       return 0;
+}
+
+static const struct matrox_pll_features maven_pll = {
+       110000,
+       27000,
+       4, 127,
+       2, 31,
+       3
+};
+
+static void DAC1064_calcclock(unsigned int freq, unsigned int fmax,
+               unsigned int* in, unsigned int* feed, unsigned int* post) {
+       unsigned int fvco;
+       unsigned int p;
+
+       fvco = matroxfb_PLL_calcclock(&maven_pll, freq, fmax, in, feed, &p);
+       /* 0 => 100 ... 275 MHz
+           1 => 243 ... 367 MHz
+           2 => 320 ... 475 MHz
+           3 => 453 ... 556 MHz
+           4 => 540 ... 594 MHz
+           5 => 588 ... 621 MHz
+           6 => 626 ... 637 MHz
+           7 => 631 ... 642 MHz
+
+           As you can see, never choose frequency > 621 MHz, there is unavailable gap...
+           Just to be sure, currently driver uses 110 ... 500 MHz range.
+         */
+       if (fvco <= 260000)
+               ;
+       else if (fvco <= 350000)
+               p |= 0x08;
+       else if (fvco <= 460000)
+               p |= 0x10;
+       else if (fvco <= 550000)
+               p |= 0x18;
+       else if (fvco <= 590000)
+               p |= 0x20;
+       else
+               p |= 0x28;
+       *post = p;
+       return;
+}
+
+static inline int matroxfb_g450_compute_timming(struct matroxfb_g450_info* m2info,
+               struct my_timming* mt,
+               struct mavenregs* m) {
+       unsigned int a, b, c;
+
+       DAC1064_calcclock(mt->pixclock, 500000, &a, &b, &c);
+       m->regs[0x80] = a;
+       m->regs[0x81] = b;
+       m->regs[0x82] = c;
+       printk(KERN_DEBUG "PLL: %02X %02X %02X\n", a, b, c);
+       return 0;
+}
+
+static inline int matroxfb_g450_program_timming(struct matroxfb_g450_info* m2info, const struct mavenregs* m) {
+       MINFO_FROM(m2info->primary_dev);
+
+       matroxfb_g450_set_reg(PMINFO M1064_XPIXPLL2M, m->regs[0x81]);
+       matroxfb_g450_set_reg(PMINFO M1064_XPIXPLL2N, m->regs[0x80]);
+       matroxfb_g450_set_reg(PMINFO M1064_XPIXPLL2P, m->regs[0x82]);
+       return 0;
+}
+
+/******************************************************/
+
+static int matroxfb_g450_compute(void* md, struct my_timming* mt, struct matrox_hw_state* mr) {
+       return matroxfb_g450_compute_timming(md, mt, &mr->maven);
+}
+
+static int matroxfb_g450_program(void* md, const struct matrox_hw_state* mr) {
+       return matroxfb_g450_program_timming(md, &mr->maven);
+}
+
+static int matroxfb_g450_start(void* md) {
+       return 0;
+}
+
+static void matroxfb_g450_incuse(void* md) {
+       MOD_INC_USE_COUNT;
+}
+
+static void matroxfb_g450_decuse(void* md) {
+       MOD_DEC_USE_COUNT;
+}
+
+static int matroxfb_g450_set_mode(void* md, u_int32_t arg) {
+       if (arg == MATROXFB_OUTPUT_MODE_MONITOR) {
+               return 1;
+       }
+       return -EINVAL;
+}
+
+static int matroxfb_g450_get_mode(void* md, u_int32_t* arg) {
+       *arg = MATROXFB_OUTPUT_MODE_MONITOR;
+       return 0;
+}
+
+static struct matrox_altout matroxfb_g450_altout = {
+       matroxfb_g450_compute,
+       matroxfb_g450_program,
+       matroxfb_g450_start,
+       matroxfb_g450_incuse,
+       matroxfb_g450_decuse,
+       matroxfb_g450_set_mode,
+       matroxfb_g450_get_mode
+};
+
+static int matroxfb_g450_connect(struct matroxfb_g450_info* m2info) {
+       MINFO_FROM(m2info->primary_dev);
+
+       down_write(&ACCESS_FBINFO(altout.lock));
+       ACCESS_FBINFO(altout.device) = m2info;
+       ACCESS_FBINFO(altout.output) = &matroxfb_g450_altout;
+       up_write(&ACCESS_FBINFO(altout.lock));
+       ACCESS_FBINFO(output.all) |= MATROXFB_OUTPUT_CONN_SECONDARY;
+       return 0;
+}
+
+static void matroxfb_g450_shutdown(struct matroxfb_g450_info* m2info) {
+       MINFO_FROM(m2info->primary_dev);
+       
+       if (MINFO) {
+               ACCESS_FBINFO(output.all) &= ~MATROXFB_OUTPUT_CONN_SECONDARY;
+               ACCESS_FBINFO(output.ph) &= ~MATROXFB_OUTPUT_CONN_SECONDARY;
+               ACCESS_FBINFO(output.sh) &= ~MATROXFB_OUTPUT_CONN_SECONDARY;
+               down_write(&ACCESS_FBINFO(altout.lock));
+               ACCESS_FBINFO(altout.device) = NULL;
+               ACCESS_FBINFO(altout.output) = NULL;
+               up_write(&ACCESS_FBINFO(altout.lock));
+               m2info->primary_dev = NULL;
+       }
+}
+
+/* we do not have __setup() yet */
+static void* matroxfb_g450_probe(struct matrox_fb_info* minfo) {
+       struct matroxfb_g450_info* m2info;
+
+       /* hardware is not G450 incapable... */
+       if (!ACCESS_FBINFO(devflags.g450dac))
+               return NULL;
+       m2info = (struct matroxfb_g450_info*)kmalloc(sizeof(*m2info), GFP_KERNEL);
+       if (!m2info) {
+               printk(KERN_ERR "matroxfb_g450: Not enough memory for G450 DAC control structs\n");
+               return NULL;
+       }
+       memset(m2info, 0, sizeof(*m2info));
+       m2info->primary_dev = MINFO;
+       if (matroxfb_g450_connect(m2info)) {
+               kfree(m2info);
+               printk(KERN_ERR "matroxfb_g450: G450 DAC failed to initialize\n");
+               return NULL;
+       }
+       return m2info;
+}
+
+static void matroxfb_g450_remove(struct matrox_fb_info* minfo, void* g450) {
+       matroxfb_g450_shutdown(g450);
+       kfree(g450);
+}
+
+static struct matroxfb_driver g450 = {
+               name:   "Matrox G450 output #2",
+               probe:  matroxfb_g450_probe,
+               remove: matroxfb_g450_remove };
+
+static int matroxfb_g450_init(void) {
+       matroxfb_register_driver(&g450);
+       return 0;
+}
+
+static void matroxfb_g450_exit(void) {
+       matroxfb_unregister_driver(&g450);
+}
+
+MODULE_AUTHOR("(c) 2000 Petr Vandrovec <vandrove@vc.cvut.cz>");
+MODULE_DESCRIPTION("Matrox G450 secondary output driver");
+module_init(matroxfb_g450_init);
+module_exit(matroxfb_g450_exit);
diff --git a/drivers/video/matrox/matroxfb_g450.h b/drivers/video/matrox/matroxfb_g450.h
new file mode 100644 (file)
index 0000000..51aefca
--- /dev/null
@@ -0,0 +1,11 @@
+#ifndef __MATROXFB_G450_H__
+#define __MATROXFB_G450_H__
+
+#include <linux/ioctl.h>
+#include "matroxfb_base.h"
+
+struct matroxfb_g450_info {
+       struct matrox_fb_info*  primary_dev;
+};
+
+#endif /* __MATROXFB_MAVEN_H__ */
index f04fab7e350333a4f953db0581f23164b6125be8..695280bc9c51b34f640517505591748ade68c52c 100644 (file)
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -223,8 +223,6 @@ int copy_strings(int argc,char ** argv, struct linux_binprm *bprm)
                                        memset(kaddr+offset+len, 0, PAGE_SIZE-offset-len);
                        }
                        err = copy_from_user(kaddr + offset, str, bytes_to_copy);
-                       flush_dcache_page(page);
-                       flush_page_to_ram(page);
                        kunmap(page);
 
                        if (err)
@@ -281,6 +279,7 @@ void put_dirty_page(struct task_struct * tsk, struct page *page, unsigned long a
                __free_page(page);
                return;
        }
+       flush_dcache_page(page);
        flush_page_to_ram(page);
        set_pte(pte, pte_mkdirty(pte_mkwrite(mk_pte(page, PAGE_COPY))));
 /* no need for flush_tlb */
index fd37469200341ac58cf90c71252d2a05ec4fa029..0cc0ee24221f56e7b6c8950f930f09cedae26930 100644 (file)
@@ -70,7 +70,7 @@ int default_fat_access(struct super_block *sb,int nr,int new_value)
        }
        if (MSDOS_SB(sb)->fat_bits == 32) {
                p_first = p_last = NULL; /* GCC needs that stuff */
-               next = CF_LE_L(((unsigned long *) bh->b_data)[(first &
+               next = CF_LE_L(((__u32 *) bh->b_data)[(first &
                    (SECTOR_SIZE-1)) >> 2]);
                /* Fscking Microsoft marketing department. Their "32" is 28. */
                next &= 0xfffffff;
@@ -79,12 +79,12 @@ int default_fat_access(struct super_block *sb,int nr,int new_value)
 
        } else if (MSDOS_SB(sb)->fat_bits == 16) {
                p_first = p_last = NULL; /* GCC needs that stuff */
-               next = CF_LE_W(((unsigned short *) bh->b_data)[(first &
+               next = CF_LE_W(((__u16 *) bh->b_data)[(first &
                    (SECTOR_SIZE-1)) >> 1]);
                if (next >= 0xfff7) next = -1;
        } else {
-               p_first = &((unsigned char *) bh->b_data)[first & (SECTOR_SIZE-1)];
-               p_last = &((unsigned char *) bh2->b_data)[(first+1) &
+               p_first = &((__u8 *) bh->b_data)[first & (SECTOR_SIZE-1)];
+               p_last = &((__u8 *) bh2->b_data)[(first+1) &
                    (SECTOR_SIZE-1)];
                if (nr & 1) next = ((*p_first >> 4) | (*p_last << 4)) & 0xfff;
                else next = (*p_first+(*p_last << 8)) & 0xfff;
@@ -92,10 +92,10 @@ int default_fat_access(struct super_block *sb,int nr,int new_value)
        }
        if (new_value != -1) {
                if (MSDOS_SB(sb)->fat_bits == 32) {
-                       ((unsigned long *) bh->b_data)[(first & (SECTOR_SIZE-1)) >>
+                       ((__u32 *) bh->b_data)[(first & (SECTOR_SIZE-1)) >>
                            2] = CT_LE_L(new_value);
                } else if (MSDOS_SB(sb)->fat_bits == 16) {
-                       ((unsigned short *) bh->b_data)[(first & (SECTOR_SIZE-1)) >>
+                       ((__u16 *) bh->b_data)[(first & (SECTOR_SIZE-1)) >>
                            1] = CT_LE_W(new_value);
                } else {
                        if (nr & 1) {
diff --git a/include/asm-alpha/mmu.h b/include/asm-alpha/mmu.h
new file mode 100644 (file)
index 0000000..3dc1277
--- /dev/null
@@ -0,0 +1,7 @@
+#ifndef __ALPHA_MMU_H
+#define __ALPHA_MMU_H
+
+/* The alpha MMU context is one "unsigned long" bitmap per CPU */
+typedef unsigned long mm_context_t[NR_CPUS];
+
+#endif
index 219b8bd4ecb4538be85cb248889f4ea68068b790..492d29b7c9d5985f2c067f72cf7c9ee76cbf7b8f 100644 (file)
@@ -11,7 +11,6 @@
 #include <asm/system.h>
 #include <asm/machvec.h>
 
-
 /*
  * Force a context reload. This is needed when we change the page
  * table pointer or when we update the ASN of the current process.
@@ -93,12 +92,7 @@ extern unsigned long last_asn;
 #endif /* CONFIG_SMP */
 
 #define WIDTH_HARDWARE_ASN     8
-#ifdef CONFIG_SMP
-#define WIDTH_THIS_PROCESSOR   5
-#else
-#define WIDTH_THIS_PROCESSOR   0
-#endif
-#define ASN_FIRST_VERSION (1UL << (WIDTH_THIS_PROCESSOR + WIDTH_HARDWARE_ASN))
+#define ASN_FIRST_VERSION (1UL << WIDTH_HARDWARE_ASN)
 #define HARDWARE_ASN_MASK ((1UL << WIDTH_HARDWARE_ASN) - 1)
 
 /*
@@ -137,19 +131,24 @@ __EXTERN_INLINE void
 ev5_switch_mm(struct mm_struct *prev_mm, struct mm_struct *next_mm,
              struct task_struct *next, long cpu)
 {
-       /* Check if our ASN is of an older version, or on a different CPU,
-          and thus invalid.  */
-       /* ??? If we have two threads on different cpus, we'll continually
-          fight over the context.  Find a way to record a per-mm, per-cpu
-          value for the asn.  */
+       /* Check if our ASN is of an older version, and thus invalid. */
+       unsigned long asn;
+       unsigned long mmc;
 
-       unsigned long asn = cpu_last_asn(cpu);
-       unsigned long mmc = next_mm->context;
-       
+#ifdef CONFIG_SMP
+       cpu_data[cpu].asn_lock = 1;
+       barrier();
+#endif
+       asn = cpu_last_asn(cpu);
+       mmc = next_mm->context[cpu];
        if ((mmc ^ asn) & ~HARDWARE_ASN_MASK) {
                mmc = __get_new_mm_context(next_mm, cpu);
-               next_mm->context = mmc;
+               next_mm->context[cpu] = mmc;
        }
+#ifdef CONFIG_SMP
+       else
+               cpu_data[cpu].need_new_asn = 1;
+#endif
 
        /* Always update the PCB ASN.  Another thread may have allocated
           a new mm->context (via flush_tlb_mm) without the ASN serial
@@ -179,6 +178,23 @@ ev4_switch_mm(struct mm_struct *prev_mm, struct mm_struct *next_mm,
 
 extern void __load_new_mm_context(struct mm_struct *);
 
+#ifdef CONFIG_SMP
+#define check_mmu_context()                                    \
+do {                                                           \
+       int cpu = smp_processor_id();                           \
+       cpu_data[cpu].asn_lock = 0;                             \
+       barrier();                                              \
+       if (cpu_data[cpu].need_new_asn) {                       \
+               struct mm_struct * mm = current->active_mm;     \
+               cpu_data[cpu].need_new_asn = 0;                 \
+               if (!mm->context[cpu])                  \
+                       __load_new_mm_context(mm);              \
+       }                                                       \
+} while(0)
+#else
+#define check_mmu_context()  do { } while(0)
+#endif
+
 __EXTERN_INLINE void
 ev5_activate_mm(struct mm_struct *prev_mm, struct mm_struct *next_mm)
 {
@@ -208,7 +224,10 @@ ev4_activate_mm(struct mm_struct *prev_mm, struct mm_struct *next_mm)
 extern inline int
 init_new_context(struct task_struct *tsk, struct mm_struct *mm)
 {
-       mm->context = 0;
+       int i;
+
+       for (i = 0; i < smp_num_cpus; i++)
+               mm->context[cpu_logical_map(i)] = 0;
         tsk->thread.ptbr = ((unsigned long)mm->pgd - IDENT_ADDR) >> PAGE_SHIFT;
        return 0;
 }
index dd09a2eeca2d9288352dc6ebeeebe6d20d018144..7e377bdfd5c31cbb3006b0202f81c526eb626ee8 100644 (file)
@@ -38,29 +38,6 @@ extern void __load_new_mm_context(struct mm_struct *);
 extern void smp_imb(void);
 #endif
 
-/* We need to flush the userspace icache after setting breakpoints in
-   ptrace.  I don't think it's needed in do_swap_page, or do_no_page,
-   but I don't know how to get rid of it either.
-
-   Instead of indiscriminately using imb, take advantage of the fact
-   that icache entries are tagged with the ASN and load a new mm context.  */
-/* ??? Ought to use this in arch/alpha/kernel/signal.c too.  */
-
-#ifndef CONFIG_SMP
-static inline void
-flush_icache_page(struct vm_area_struct *vma, struct page *page)
-{
-       if (vma->vm_flags & VM_EXEC) {
-               struct mm_struct *mm = vma->vm_mm;
-               mm->context = 0;
-               if (current->active_mm == mm)
-                       __load_new_mm_context(mm);
-       }
-}
-#else
-extern void flush_icache_page(struct vm_area_struct *vma, struct page *page);
-#endif
-
 
 /*
  * Use a few helper functions to hide the ugly broken ASN
@@ -83,8 +60,38 @@ ev5_flush_tlb_current(struct mm_struct *mm)
 static inline void
 flush_tlb_other(struct mm_struct *mm)
 {
-       mm->context = 0;
+       long * mmc = &mm->context[smp_processor_id()];
+       /*
+        * Check it's not zero first to avoid cacheline ping pong when
+        * possible.
+        */
+       if (*mmc)
+               *mmc = 0;
+}
+
+/* We need to flush the userspace icache after setting breakpoints in
+   ptrace.  I don't think it's needed in do_swap_page, or do_no_page,
+   but I don't know how to get rid of it either.
+
+   Instead of indiscriminately using imb, take advantage of the fact
+   that icache entries are tagged with the ASN and load a new mm context.  */
+/* ??? Ought to use this in arch/alpha/kernel/signal.c too.  */
+
+#ifndef CONFIG_SMP
+static inline void
+flush_icache_page(struct vm_area_struct *vma, struct page *page)
+{
+       if (vma->vm_flags & VM_EXEC) {
+               struct mm_struct *mm = vma->vm_mm;
+               if (current->active_mm == mm)
+                       __load_new_mm_context(mm);
+               else
+                       mm->context[smp_processor_id()] = 0;
+       }
 }
+#else
+extern void flush_icache_page(struct vm_area_struct *vma, struct page *page);
+#endif
 
 /*
  * Flush just one page in the current TLB set.
@@ -140,7 +147,7 @@ ev5_flush_tlb_current_page(struct mm_struct * mm,
  */
 static inline void flush_tlb(void)
 {
-       flush_tlb_current(current->mm);
+       flush_tlb_current(current->active_mm);
 }
 
 /*
@@ -170,10 +177,10 @@ static inline void flush_tlb_all(void)
  */
 static inline void flush_tlb_mm(struct mm_struct *mm)
 {
-       if (mm != current->mm)
-               flush_tlb_other(mm);
-       else
+       if (mm == current->active_mm)
                flush_tlb_current(mm);
+       else
+               flush_tlb_other(mm);
 }
 
 /*
@@ -189,10 +196,10 @@ static inline void flush_tlb_page(struct vm_area_struct *vma,
 {
        struct mm_struct * mm = vma->vm_mm;
 
-       if (mm != current->mm)
-               flush_tlb_other(mm);
-       else
+       if (mm == current->active_mm)
                flush_tlb_current_page(mm, vma, addr);
+       else
+               flush_tlb_other(mm);
 }
 
 /*
index 81427025c48a14f02d04b6211f7e4f2d3a0d6fab..58813f17fc95b43216e853b7f1c7a571baa0cbc6 100644 (file)
@@ -122,10 +122,6 @@ extern void release_thread(struct task_struct *);
 /* Create a kernel thread without removing it from tasklists.  */
 extern long kernel_thread(int (*fn)(void *), void *arg, unsigned long flags);
 
-#define copy_segments(tsk, mm)         do { } while (0)
-#define release_segments(mm)           do { } while (0)
-#define forget_segments()              do { } while (0)
-
 unsigned long get_wchan(struct task_struct *p);
 
 /* See arch/alpha/kernel/ptrace.c for details.  */
diff --git a/include/asm-alpha/processor.h.lock~ b/include/asm-alpha/processor.h.lock~
new file mode 100644 (file)
index 0000000..444ecde
--- /dev/null
@@ -0,0 +1 @@
+torvalds@penguin
\ No newline at end of file
index 44ec5e8ea1b57e43819fd001c27b2f9940960432..6331af6f230b87c5866bf3424ad54b3ff324b890 100644 (file)
@@ -26,6 +26,8 @@ __hard_smp_processor_id(void)
 struct cpuinfo_alpha {
        unsigned long loops_per_sec;
        unsigned long last_asn;
+       int need_new_asn;
+       int asn_lock;
        unsigned long *pgd_cache;
        unsigned long *pte_cache;
        unsigned long pgtable_cache_sz;
index 6d34c54722118ffc4ac66e74b62f289e581b57f8..3a8c9385dd49b65c37ea90a56aa7ba9bed99d817 100644 (file)
@@ -125,6 +125,7 @@ do {                                                        \
        current = (next);                               \
        pcbb = virt_to_phys(&current->thread);          \
        (last) = alpha_switch_to(pcbb, (prev));         \
+       check_mmu_context();                            \
 } while (0)
 
 extern struct task_struct* alpha_switch_to(unsigned long, struct task_struct*);
diff --git a/include/asm-arm/mmu.h b/include/asm-arm/mmu.h
new file mode 100644 (file)
index 0000000..784ff27
--- /dev/null
@@ -0,0 +1,7 @@
+#ifndef __ARM_MMU_H
+#define __ARM_MMU_H
+
+/* The ARM doesn't have a mmu context */
+typedef struct { } mm_context_t;
+
+#endif
index f84c5d2d3f9c404a1f4f3d21953d18e626e2f9ff..d1311d01479b72dc9074e4942b0af41052e19fff 100644 (file)
@@ -106,11 +106,6 @@ struct task_struct;
 /* Free all resources held by a thread. */
 extern void release_thread(struct task_struct *);
 
-/* Copy and release all segment info associated with a VM */
-#define copy_segments(tsk, mm)         do { } while (0)
-#define release_segments(mm)           do { } while (0)
-#define forget_segments()              do { } while (0)
-
 unsigned long get_wchan(struct task_struct *p);
 
 #define THREAD_SIZE    (8192)
index 667ad58f31a1b789f96b31b34453af6ea3d4371f..bcfa2c65cc40ebfa171c8afcdb118e93fcfb5cd0 100644 (file)
@@ -82,7 +82,7 @@ extern inline void clear_LDT(void)
 extern inline void load_LDT (struct mm_struct *mm)
 {
        int cpu = smp_processor_id();
-       void *segments = mm->segments;
+       void *segments = mm->context.segments;
        int count = LDT_ENTRIES;
 
        if (!segments) {
diff --git a/include/asm-i386/mmu.h b/include/asm-i386/mmu.h
new file mode 100644 (file)
index 0000000..6114bcc
--- /dev/null
@@ -0,0 +1,12 @@
+#ifndef __i386_MMU_H
+#define __i386_MMU_H
+
+/*
+ * The i386 doesn't have a mmu context, but
+ * we put the segment information here.
+ */
+typedef struct { 
+       void *segments;
+} mm_context_t;
+
+#endif
index 0c201e1d26e7e056a3c2faa1d810e9d0fed8e5e2..1b9b19301044cca3836bf3efa34d01e3e5ae0d2d 100644 (file)
@@ -6,11 +6,9 @@
 #include <asm/atomic.h>
 #include <asm/pgalloc.h>
 
-/*
- * possibly do the LDT unload here?
- */
-#define destroy_context(mm)            do { } while(0)
-#define init_new_context(tsk,mm)       0
+/* Segment information */
+extern void destroy_context(struct mm_struct *);
+extern int init_new_context(struct task_struct *, struct mm_struct *);
 
 #ifdef CONFIG_SMP
 
@@ -33,7 +31,7 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, str
                /*
                 * Re-load LDT if necessary
                 */
-               if (prev->segments != next->segments)
+               if (prev->context.segments != next->context.segments)
                        load_LDT(next);
 #ifdef CONFIG_SMP
                cpu_tlbstate[cpu].state = TLBSTATE_OK;
index a03dd00275efb0aec230b07393c6484eac517245..2572459091457e6fc4ed8ae24c046e49ff81fa43 100644 (file)
@@ -427,11 +427,6 @@ extern void release_thread(struct task_struct *);
  */
 extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
 
-/* Copy and release all segment info associated with a VM */
-extern void copy_segments(struct task_struct *p, struct mm_struct * mm);
-extern void release_segments(struct mm_struct * mm);
-extern void forget_segments(void);
-
 /*
  * Return saved PC of a blocked thread.
  */
diff --git a/include/asm-ia64/mmu.h b/include/asm-ia64/mmu.h
new file mode 100644 (file)
index 0000000..ccd36d2
--- /dev/null
@@ -0,0 +1,7 @@
+#ifndef __MMU_H
+#define __MMU_H
+
+/* Default "unsigned long" context */
+typedef unsigned long mm_context_t;
+
+#endif
index 37a8c2ba43436f34d76f249c3ea76e9213fde686..0fb8f37ccd1483cdbd0f07ef296d127980135a84 100644 (file)
@@ -375,11 +375,6 @@ struct task_struct;
  */
 extern int kernel_thread (int (*fn)(void *), void *arg, unsigned long flags);
 
-/* Copy and release all segment info associated with a VM */
-#define copy_segments(tsk, mm)                 do { } while (0)
-#define release_segments(mm)                   do { } while (0)
-#define forget_segments()                      do { } while (0)
-
 /* Get wait channel for task P.  */
 extern unsigned long get_wchan (struct task_struct *p);
 
diff --git a/include/asm-m68k/mmu.h b/include/asm-m68k/mmu.h
new file mode 100644 (file)
index 0000000..ccd36d2
--- /dev/null
@@ -0,0 +1,7 @@
+#ifndef __MMU_H
+#define __MMU_H
+
+/* Default "unsigned long" context */
+typedef unsigned long mm_context_t;
+
+#endif
index 1bba1277f9690543da1d72c1c033d5dc7eeda7ef..43af4d09c46cd89ec60c35244111e9c68457c44d 100644 (file)
@@ -109,10 +109,6 @@ static inline void release_thread(struct task_struct *dead_task)
 
 extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
 
-#define copy_segments(tsk, mm)         do { } while (0)
-#define release_segments(mm)           do { } while (0)
-#define forget_segments()              do { } while (0)
-
 /*
  * Free current thread data structures etc..
  */
diff --git a/include/asm-mips/mmu.h b/include/asm-mips/mmu.h
new file mode 100644 (file)
index 0000000..ccd36d2
--- /dev/null
@@ -0,0 +1,7 @@
+#ifndef __MMU_H
+#define __MMU_H
+
+/* Default "unsigned long" context */
+typedef unsigned long mm_context_t;
+
+#endif
index 7e160259c67101c5c91ee49694dff339443d786b..d38127794433005cf72509a4ef088381ef4f9c9b 100644 (file)
@@ -190,10 +190,6 @@ struct thread_struct {
 
 extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
 
-/* Copy and release all segment info associated with a VM */
-#define copy_segments(p, mm) do { } while(0)
-#define release_segments(mm) do { } while(0)
-
 /*
  * Return saved PC of a blocked thread.
  */
diff --git a/include/asm-mips64/mmu.h b/include/asm-mips64/mmu.h
new file mode 100644 (file)
index 0000000..ccd36d2
--- /dev/null
@@ -0,0 +1,7 @@
+#ifndef __MMU_H
+#define __MMU_H
+
+/* Default "unsigned long" context */
+typedef unsigned long mm_context_t;
+
+#endif
index 8a3cad9f3e731ed5501375f5c8dea4c391fe2e7d..2d9b9df5b95e08f9e2aa588e14bef54ceda76cbe 100644 (file)
@@ -236,10 +236,6 @@ struct thread_struct {
 
 extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
 
-/* Copy and release all segment info associated with a VM */
-#define copy_segments(p, mm) do { } while(0)
-#define release_segments(mm) do { } while(0)
-
 /*
  * Return saved PC of a blocked thread.
  */
index c311f8ae734929a7a50453bea6fa10c9c27b4dee..f078f0df094655ddaf6203d25f5dc8022939e7ef 100644 (file)
@@ -6,6 +6,10 @@
 #define _PARISC_MMU_H_
 
 #ifndef __ASSEMBLY__
+
+/* Default "unsigned long" context */
+typedef unsigned long mm_context_t;
+
 /* Hardware Page Table Entry */
 typedef struct _PTE {
        unsigned long v:1;      /* Entry is valid */
index 406366292f4ab14ac4040f9bd55157d1483cc17a..08a4d900403e53c2d568611049881e89def78705 100644 (file)
@@ -310,10 +310,6 @@ struct task_struct;
 extern void release_thread(struct task_struct *);
 extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
 
-#define copy_segments(tsk, mm) do { } while (0)
-#define release_segments(mm)   do { } while (0)
-#define forget_segments()      do { } while (0)
-
 extern inline unsigned long get_wchan(struct task_struct *p)
 {
        return 0xdeadbeef; /* XXX */
index 2fe5cfe716f16c275466d9fc982dd61569617cdd..3efe39d008664dd2002727354819da7e0dfd89d3 100644 (file)
@@ -6,6 +6,9 @@
 #ifndef _PPC_MMU_H_
 #define _PPC_MMU_H_
 
+/* Default "unsigned long" context */
+typedef unsigned long mm_context_t;
+
 #include <linux/config.h>
 
 #ifndef __ASSEMBLY__
index cfd49807e0c1dec400465923cfc7b00c9356ae1f..5dfc547adeb45b7bb5f399ad16c4fd082d13e488 100644 (file)
@@ -673,10 +673,6 @@ static inline unsigned long thread_saved_pc(struct thread_struct *t)
        return (t->regs) ? t->regs->nip : 0;
 }
 
-#define copy_segments(tsk, mm)         do { } while (0)
-#define release_segments(mm)           do { } while (0)
-#define forget_segments()              do { } while (0)
-
 unsigned long get_wchan(struct task_struct *p);
 
 #define KSTK_EIP(tsk)  ((tsk)->thread.regs->nip)
diff --git a/include/asm-s390/mmu.h b/include/asm-s390/mmu.h
new file mode 100644 (file)
index 0000000..ccd36d2
--- /dev/null
@@ -0,0 +1,7 @@
+#ifndef __MMU_H
+#define __MMU_H
+
+/* Default "unsigned long" context */
+typedef unsigned long mm_context_t;
+
+#endif
index 5cb89c8a3db95d94c11c6486227d6a6115db84da..3e87e4697792d3a1698d07320890841297d6843c 100644 (file)
@@ -124,12 +124,6 @@ struct mm_struct;
 extern void release_thread(struct task_struct *);
 extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
 
-/* Copy and release all segment info associated with a VM */
-#define copy_segments(nr, mm)           do { } while (0)
-#define release_segments(mm)            do { } while (0)
-#define forget_segments()               do { } while (0)
-
-
 /*
  * Return saved PC of a blocked thread. used in kernel/sched
  */
diff --git a/include/asm-sh/mmu.h b/include/asm-sh/mmu.h
new file mode 100644 (file)
index 0000000..ccd36d2
--- /dev/null
@@ -0,0 +1,7 @@
+#ifndef __MMU_H
+#define __MMU_H
+
+/* Default "unsigned long" context */
+typedef unsigned long mm_context_t;
+
+#endif
index 38d8dbe7c9eca14fadd06341f4f74e0017495224..0e25867e648e455061b9a0b1cc3702a190910dc2 100644 (file)
@@ -151,11 +151,6 @@ extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
 #define MCA_bus__is_a_macro /* for versions in ksyms.c */
 
 
-/* Copy and release all segment info associated with a VM */
-#define copy_segments(p, mm)   do { } while(0)
-#define release_segments(mm)   do { } while(0)
-#define forget_segments()      do { } while (0)
-
 /*
  * FPU lazy state save handling.
  */
diff --git a/include/asm-sparc/mmu.h b/include/asm-sparc/mmu.h
new file mode 100644 (file)
index 0000000..ccd36d2
--- /dev/null
@@ -0,0 +1,7 @@
+#ifndef __MMU_H
+#define __MMU_H
+
+/* Default "unsigned long" context */
+typedef unsigned long mm_context_t;
+
+#endif
index 41b96727ad85a016b27556ad5709131492684f17..970e87ff7ec27ff98e80d8318bc8f0e57413cb21 100644 (file)
@@ -153,13 +153,6 @@ extern __inline__ void start_thread(struct pt_regs * regs, unsigned long pc,
 extern pid_t kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
 
 
-#define copy_segments(__tsk, __mm)             \
-       if((__tsk) == current &&                \
-          (__mm) != NULL)                      \
-               flush_user_windows()
-#define release_segments(mm)           do { } while (0)
-#define forget_segments()              do { } while (0)
-
 #define get_wchan(__TSK) \
 ({     extern void scheduling_functions_start_here(void); \
        extern void scheduling_functions_end_here(void); \
diff --git a/include/asm-sparc64/mmu.h b/include/asm-sparc64/mmu.h
new file mode 100644 (file)
index 0000000..ccd36d2
--- /dev/null
@@ -0,0 +1,7 @@
+#ifndef __MMU_H
+#define __MMU_H
+
+/* Default "unsigned long" context */
+typedef unsigned long mm_context_t;
+
+#endif
index 562cf4ba8237cc6b0ddcebf7e0aa91e773a43f27..921290a9f8065a4def59be2a04735ec663ae0782 100644 (file)
@@ -218,10 +218,6 @@ do { \
 
 extern pid_t kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
 
-#define copy_segments(tsk, mm)         do { } while (0)
-#define release_segments(mm)           do { } while (0)
-#define forget_segments()              do { } while (0)
-
 #define get_wchan(__TSK) \
 ({     extern void scheduling_functions_start_here(void); \
        extern void scheduling_functions_end_here(void); \
index 7a045f0339e9ffb3314e7a03c0f943d1fa3b1ca6..c0f2130ceb8740bf7e4c1fbe6873141f7208e863 100644 (file)
@@ -28,6 +28,8 @@
 #include <linux/wait.h>
 #endif /* __KERNEL__ */
 
+u64 acpi_get_rsdp_ptr(void);
+
 /*
  * System sleep states
  */
@@ -64,10 +66,13 @@ typedef int acpi_dstate_t;
 #define ACPI_RSDP1_SIG 0x20445352 /* 'RSD ' */
 #define ACPI_RSDP2_SIG 0x20525450 /* 'PTR ' */
 #define ACPI_RSDT_SIG  0x54445352 /* 'RSDT' */
-#define ACPI_FACP_SIG  0x50434146 /* 'FACP' */
+#define ACPI_FADT_SIG  0x50434146 /* 'FACP' */
 #define ACPI_DSDT_SIG  0x54445344 /* 'DSDT' */
 #define ACPI_FACS_SIG  0x53434146 /* 'FACS' */
 
+#define ACPI_SIG_LEN           4
+#define ACPI_FADT_SIGNATURE    "FACP"
+
 /* PM1_STS/EN flags */
 #define ACPI_TMR    0x0001
 #define ACPI_BM            0x0010
@@ -90,19 +95,20 @@ typedef int acpi_dstate_t;
 #define ACPI_SLP_TYP_SHIFT 10
 
 /* PM_TMR masks */
-#define ACPI_TMR_MASK  0x00ffffff
-#define ACPI_TMR_HZ    3580000 /* 3.58 MHz */
+#define ACPI_TMR_VAL_EXT 0x00000100
+#define ACPI_TMR_MASK   0x00ffffff
+#define ACPI_TMR_HZ     3580000 /* 3.58 MHz */
 
 /* strangess to avoid integer overflow */
-#define ACPI_uS_TO_TMR_TICKS(val) \
+#define ACPI_MICROSEC_TO_TMR_TICKS(val) \
   (((val) * (ACPI_TMR_HZ / 10000)) / 100)
-#define ACPI_TMR_TICKS_TO_uS(ticks) \
+#define ACPI_TMR_TICKS_TO_MICROSEC(ticks) \
   (((ticks) * 100) / (ACPI_TMR_HZ / 10000))
 
 /* PM2_CNT flags */
 #define ACPI_ARB_DIS 0x01
 
-/* FACP flags */
+/* FADT flags */
 #define ACPI_WBINVD      0x00000001
 #define ACPI_WBINVD_FLUSH 0x00000002
 #define ACPI_PROC_C1     0x00000004
@@ -114,9 +120,9 @@ typedef int acpi_dstate_t;
 #define ACPI_TMR_VAL_EXT  0x00000100
 #define ACPI_DCK_CAP     0x00000200
 
-/* FACP BOOT_ARCH flags */
-#define FACP_BOOT_ARCH_LEGACY_DEVICES  0x0001
-#define FACP_BOOT_ARCH_KBD_CONTROLLER  0x0002
+/* FADT BOOT_ARCH flags */
+#define FADT_BOOT_ARCH_LEGACY_DEVICES  0x0001
+#define FADT_BOOT_ARCH_KBD_CONTROLLER  0x0002
 
 /* FACS flags */
 #define ACPI_S4BIOS      0x00000001
@@ -131,77 +137,6 @@ typedef int acpi_dstate_t;
 #define ACPI_MAX_P_LVL3_LAT 1000
 #define ACPI_INFINITE_LAT   (~0UL)
 
-struct acpi_rsdp {
-       __u32 signature[2];
-       __u8 checksum;
-       __u8 oem[6];
-       __u8 reserved;
-       __u32 rsdt;
-} __attribute__ ((packed));
-
-struct acpi_table {
-       __u32 signature;
-       __u32 length;
-       __u8 rev;
-       __u8 checksum;
-       __u8 oem[6];
-       __u8 oem_table[8];
-       __u32 oem_rev;
-       __u32 creator;
-       __u32 creator_rev;
-} __attribute__ ((packed));
-
-struct acpi_facp {
-       struct acpi_table hdr;
-       __u32 facs;
-       __u32 dsdt;
-       __u8 int_model;
-       __u8 reserved;
-       __u16 sci_int;
-       __u32 smi_cmd;
-       __u8 acpi_enable;
-       __u8 acpi_disable;
-       __u8 s4bios_req;
-       __u8 reserved2;
-       __u32 pm1a_evt;
-       __u32 pm1b_evt;
-       __u32 pm1a_cnt;
-       __u32 pm1b_cnt;
-       __u32 pm2_cnt;
-       __u32 pm_tmr;
-       __u32 gpe0;
-       __u32 gpe1;
-       __u8 pm1_evt_len;
-       __u8 pm1_cnt_len;
-       __u8 pm2_cnt_len;
-       __u8 pm_tm_len;
-       __u8 gpe0_len;
-       __u8 gpe1_len;
-       __u8 gpe1_base;
-       __u8 reserved3;
-       __u16 p_lvl2_lat;
-       __u16 p_lvl3_lat;
-       __u16 flush_size;
-       __u16 flush_stride;
-       __u8 duty_offset;
-       __u8 duty_width;
-       __u8 day_alarm;
-       __u8 mon_alarm;
-       __u8 century;
-       __u16 boot_arch;
-       __u8 reserved6;
-       __u32 flags;
-} __attribute__ ((packed));
-
-struct acpi_facs {
-       __u32 signature;
-       __u32 length;
-       __u32 hw_signature;
-       __u32 fw_wake_vector;
-       __u32 global_lock;
-       __u32 flags;
-} __attribute__ ((packed));
-
 /*
  * Sysctl declarations
  */
@@ -213,9 +148,8 @@ enum
 
 enum
 {
-       ACPI_FACP = 1,
+       ACPI_FADT = 1,
        ACPI_DSDT,
-       ACPI_FACS,
        ACPI_PM1_ENABLE,
        ACPI_GPE_ENABLE,
        ACPI_GPE_LEVEL,
@@ -232,71 +166,11 @@ enum
        ACPI_S1_SLP_TYP,
        ACPI_S5_SLP_TYP,
        ACPI_SLEEP,
+       ACPI_FACS,
+       ACPI_XSDT,
+       ACPI_PMTIMER,
 };
 
 #define ACPI_SLP_TYP_DISABLED  (~0UL)
 
-/*
- * PIIX4-specific ACPI info (for systems with PIIX4 but no ACPI tables)
- */
-
-#define ACPI_PIIX4_INT_MODEL   0x00
-#define ACPI_PIIX4_SCI_INT     0x0009
-
-#define ACPI_PIIX4_SMI_CMD     0x00b2
-#define ACPI_PIIX4_ACPI_ENABLE 0xf0
-#define ACPI_PIIX4_ACPI_DISABLE 0xf1
-#define ACPI_PIIX4_S4BIOS_REQ  0xf2
-
-#define ACPI_PIIX4_PM1_EVT     0x0000
-#define ACPI_PIIX4_PM1_CNT     0x0004
-#define          ACPI_PIIX4_S0_MASK    (0x0005 << 10)
-#define          ACPI_PIIX4_S1_MASK    (0x0004 << 10)
-#define          ACPI_PIIX4_S2_MASK    (0x0003 << 10)
-#define          ACPI_PIIX4_S3_MASK    (0x0002 << 10)
-#define          ACPI_PIIX4_S4_MASK    (0x0001 << 10)
-#define          ACPI_PIIX4_S5_MASK    (0x0000 << 10)
-#define ACPI_PIIX4_PM_TMR      0x0008
-#define ACPI_PIIX4_GPE0                0x000c
-#define ACPI_PIIX4_P_BLK       0x0010
-
-#define ACPI_PIIX4_PM1_EVT_LEN 0x04
-#define ACPI_PIIX4_PM1_CNT_LEN 0x02
-#define ACPI_PIIX4_PM_TM_LEN   0x04
-#define ACPI_PIIX4_GPE0_LEN    0x04
-
-#define ACPI_PIIX4_PM2_CNT     0x0022
-#define ACPI_PIIX4_PM2_CNT_LEN 0x01
-
-#define ACPI_PIIX4_PMREGMISC   0x80
-#define          ACPI_PIIX4_PMIOSE     0x01
-
-/*
- * VIA-specific ACPI info (for systems with VT82C586B but no ACPI tables)
- */
-
-#define ACPI_VIA_INT_MODEL     0x00
-
-#define ACPI_VIA_SMI_CMD       0x002f
-#define ACPI_VIA_ACPI_ENABLE   0xa1
-#define ACPI_VIA_ACPI_DISABLE  0xa0
-
-#define ACPI_VIA_PM1_EVT       0x0000
-#define ACPI_VIA_PM1_CNT       0x0004
-#define ACPI_VIA_PM_TMR               0x0008
-#define ACPI_VIA_GPE0         0x0020
-#define ACPI_VIA_P_BLK        0x0010
-
-#define ACPI_VIA_PM1_EVT_LEN   0x04
-#define ACPI_VIA_PM1_CNT_LEN   0x02
-#define ACPI_VIA_PM_TM_LEN     0x04
-#define ACPI_VIA_GPE0_LEN      0x04
-
-#define ACPI_VIA_DUTY_OFFSET   1
-#define ACPI_VIA_DUTY_WIDTH    3
-
-#define ACPI_VIA_DAY_ALARM     0x7d
-#define ACPI_VIA_MON_ALARM     0x7e
-#define ACPI_VIA_CENTURY       0x7f
-
 #endif /* _LINUX_ACPI_H */
index 77808a7a3c0ba5bce04d89493316e15157a3ec20..7d59238dd7a6901f7710a18aa72edbeff40015f5 100644 (file)
@@ -280,7 +280,9 @@ struct cdrom_generic_command
        int                     stat;
        struct request_sense    *sense;
        unsigned char           data_direction;
-       void                    *reserved[3];
+       int                     quiet;
+       int                     timeout;
+       void                    *reserved[1];
 };
 
 
index 7051698000d9319618154fadb72e6aacdcff1a77..f7f8ad01fb28ca942395494f882ca7d7f5e75241 100644 (file)
@@ -5,6 +5,7 @@
 #ifndef __LINUX_MTD_MAP_H__
 #define __LINUX_MTD_MAP_H__
 
+#include <linux/config.h>
 #include <linux/types.h>
 #include <linux/mtd/mtd.h>
 #include <linux/malloc.h>
index 708f4f203091b3217a9a643d0f18570afbd1bfa8..a703b853e56af18fcf4a4adfd46a8158d962b596 100644 (file)
@@ -6,6 +6,7 @@
 
 #ifdef __KERNEL__
 
+#include <linux/config.h>
 #include <linux/version.h>
 #include <linux/types.h>
 #include <linux/mtd/compatmac.h>
index 2f37a4b1949138c8328746a1f0f904551e7dc3d8..833242aa7099ea26db04524a997e042170d9d5c1 100644 (file)
@@ -33,8 +33,8 @@ struct nfs_page {
        unsigned long           wb_timeout;     /* when to read/write/commit */
        unsigned int            wb_offset,      /* Offset of read/write */
                                wb_bytes,       /* Length of request */
-                               wb_count,       /* reference count */
-                               wb_flags;
+                               wb_count;       /* reference count */
+       unsigned long           wb_flags;
        struct nfs_writeverf    wb_verf;        /* Commit cookie */
 };
 
index 6c82d1d77fa06f442a123ef7f4f61e947a20b1f1..d402a70397deecf81ae03dd52015c297b05498b7 100644 (file)
 #define PCI_VENDOR_ID_3WARE            0x13C1
 #define PCI_DEVICE_ID_3WARE_1000       0x1000
 
+#define PCI_VENDOR_ID_ABOCOM           0x13D1
+#define PCI_DEVICE_ID_ABOCOM_2BD1       0x2BD1
+
 #define PCI_VENDOR_ID_CMEDIA           0x13f6
 #define PCI_DEVICE_ID_CMEDIA_CM8338A   0x0100
 #define PCI_DEVICE_ID_CMEDIA_CM8338B   0x0101
index d948de2588565851687651d8753c91addcb5d67b..403a93e900401a9f7489a53b1b0f5d09fb4f001d 100644 (file)
@@ -18,6 +18,7 @@ extern unsigned long event;
 #include <asm/semaphore.h>
 #include <asm/page.h>
 #include <asm/ptrace.h>
+#include <asm/mmu.h>
 
 #include <linux/smp.h>
 #include <linux/tty.h>
@@ -208,7 +209,6 @@ struct mm_struct {
        int map_count;                          /* number of VMAs */
        struct semaphore mmap_sem;
        spinlock_t page_table_lock;
-       unsigned long context;
        unsigned long start_code, end_code, start_data, end_data;
        unsigned long start_brk, brk, start_stack;
        unsigned long arg_start, arg_end, env_start, env_end;
@@ -217,11 +217,9 @@ struct mm_struct {
        unsigned long cpu_vm_mask;
        unsigned long swap_cnt; /* number of pages to swap on next pass */
        unsigned long swap_address;
-       /*
-        * This is an architecture-specific pointer: the portable
-        * part of Linux does not know about any segments.
-        */
-       void * segments;
+
+       /* Architecture-specific MM context */
+       mm_context_t context;
 };
 
 #define INIT_MM(name) \
@@ -235,7 +233,6 @@ struct mm_struct {
        map_count:      1,                              \
        mmap_sem:       __MUTEX_INITIALIZER(name.mmap_sem), \
        page_table_lock: SPIN_LOCK_UNLOCKED,            \
-       segments:       NULL                            \
 }
 
 struct signal_struct {
index 131f2e177f61edd5fb9a26b313e59a55bb5b2e08..435f8278a0147c37da91fca305da6231ce4de179 100644 (file)
@@ -9,7 +9,7 @@
 
 O_TARGET := kernel.o
 
-export-objs = signal.o sys.o kmod.o context.o
+export-objs = signal.o sys.o kmod.o context.o ksyms.o
 
 obj-y     = sched.o dma.o fork.o exec_domain.o panic.o printk.o \
            module.o exit.o itimer.o info.o time.o softirq.o resource.o \
index 6b7138e33332560ead60dd782615db2b5c5f8ab0..1ced12c0ec6966266f4e48ca6307c959b428ebc4 100644 (file)
@@ -425,7 +425,7 @@ NORET_TYPE void do_exit(long code)
        struct task_struct *tsk = current;
 
        if (in_interrupt())
-               printk("Aiee, killing interrupt handler\n");
+               panic("Aiee, killing interrupt handler!");
        if (!tsk->pid)
                panic("Attempted to kill the idle task!");
        if (tsk->pid == 1)
index bf3e36cfb797dca9846c36de27eebb29d024c841..3e2188d066f54f13e316eb7c5a28947b172c02ca 100644 (file)
@@ -133,11 +133,9 @@ static inline int dup_mmap(struct mm_struct * mm)
        mm->mmap_avl = NULL;
        mm->mmap_cache = NULL;
        mm->map_count = 0;
-       mm->context = 0;
        mm->cpu_vm_mask = 0;
        mm->swap_cnt = 0;
        mm->swap_address = 0;
-       mm->segments = NULL;
        pprev = &mm->mmap;
        for (mpnt = current->mm->mmap ; mpnt ; mpnt = mpnt->vm_next) {
                struct file *file;
@@ -320,11 +318,6 @@ static inline int copy_mm(unsigned long clone_flags, struct task_struct * tsk)
        if (retval)
                goto free_pt;
 
-       /*
-        * child gets a private LDT (if there was an LDT in the parent)
-        */
-       copy_segments(tsk, mm);
-
        if (init_new_context(tsk,mm))
                goto free_pt;
 
index 648cc520875de5edd9e41da30d671d35395e7bef..4f0c1eb3b8942542280be0bdbd7905725e9b3d16 100644 (file)
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -885,7 +885,6 @@ void exit_mmap(struct mm_struct * mm)
 {
        struct vm_area_struct * mpnt;
 
-       release_segments(mm);
        spin_lock(&mm->page_table_lock);
        mpnt = mm->mmap;
        mm->mmap = mm->mmap_avl = mm->mmap_cache = NULL;
index d2e2e5de4000b724ccce03c4f3096efe18b0ddb9..2493697031809ab1b7c6139059684f5d43c2870b 100644 (file)
@@ -1,3 +1,5 @@
+include $(TOPDIR)/Rules.make
+
 all:   pdutr.h timertr.h
 
 pdutr.h: pdutr.pre compile.awk                 
@@ -9,5 +11,3 @@ timertr.h: timertr.pre compile.awk
 clean:
        touch pdutr.h timertr.h
        rm pdutr.h timertr.h
-
-
index 6db7acbf068b82c86b69d67cd89aaffb2a0aae53..38c663226da81cc1fdbd928cbc728542c62cb647 100644 (file)
@@ -52,8 +52,4 @@ obj-$(CONFIG_MODULES)         += netsyms.o
 obj-$(CONFIG_SYSCTL)           += sysctl_net.o
 endif
 
-
-# Subdirectories that should be entered when MAKING_MODULES=1, even if set to 'y'.
-both-m         := $(filter $(mod-subdirs), $(subdir-y))
-
 include $(TOPDIR)/Rules.make
index 3e8b8727c6af657c5f2642700d54a7402ae4d378..aec5db879f12ee597d99a9c62ef2350d0a5575e9 100644 (file)
@@ -9,34 +9,16 @@
 
 O_TARGET := netfilter.o
 
-multi-objs := ip6_conntrack.o
-export-objs := ip6_conntrack_standalone.o
-
-ip6_conntrack-obj := ip6_conntrack_standalone.o ip6_conntrack_core.o ip6_conntrack_proto_generic.o ip6_conntrack_proto_tcp.o ip6_conntrack_proto_udp.o ip6_conntrack_proto_icmp.o
+multi-objs :=
+export-objs :=
 
 # Link order matters here.
-obj-$(CONFIG_IP6_NF_CONNTRACK) += ip6_conntrack.o
-obj-$(CONFIG_IP6_NF_FTP) += ip6_conntrack_ftp.o
 obj-$(CONFIG_IP6_NF_IPTABLES) += ip6_tables.o
 obj-$(CONFIG_IP6_NF_MATCH_LIMIT) += ip6t_limit.o
 obj-$(CONFIG_IP6_NF_MATCH_MARK) += ip6t_mark.o
 obj-$(CONFIG_IP6_NF_MATCH_MAC) += ip6t_mac.o
 obj-$(CONFIG_IP6_NF_MATCH_MULTIPORT) += ip6t_multiport.o
-obj-$(CONFIG_IP6_NF_MATCH_OWNER) += ip6t_owner.o
-obj-$(CONFIG_IP6_NF_MATCH_TOS) += ip6t_tos.o
-obj-$(CONFIG_IP6_NF_MATCH_STATE) += ip6t_state.o
-obj-$(CONFIG_IP6_NF_MATCH_UNCLEAN) += ip6t_unclean.o
 obj-$(CONFIG_IP6_NF_FILTER) += ip6table_filter.o
-obj-$(CONFIG_IP6_NF_TARGET_REJECT) += ip6t_REJECT.o
-obj-$(CONFIG_IP6_NF_TARGET_MIRROR) += ip6t_MIRROR.o
-obj-$(CONFIG_IP6_NF_TARGET_TOS) += ip6t_TOS.o
 obj-$(CONFIG_IP6_NF_TARGET_MARK) += ip6t_MARK.o
-obj-$(CONFIG_IP6_NF_TARGET_REDIRECT) += ip6t_REDIRECT.o
-obj-$(CONFIG_IP6_NF_TARGET_LOG) += ip6t_LOG.o
-obj-$(CONFIG_IP6_NF_QUEUE) += ip6_queue.o
-
 
 include $(TOPDIR)/Rules.make
-
-ip6_conntrack.o: $(ip6_conntrack-obj)
-       $(LD) -r -o $@ $(ip6_conntrack-obj)