diff -u --recursive --new-file v2.4.0-test8/linux/CREDITS linux/CREDITS --- v2.4.0-test8/linux/CREDITS Fri Sep 8 13:27:11 2000 +++ linux/CREDITS Mon Sep 11 08:40:37 2000 @@ -1728,7 +1728,7 @@ S: Germany N: Mark W. McClelland -E: mmcclelland@delphi.com +E: mwm@i.am E: mark@alpha.dyndns.org W: http://alpha.dyndns.org/ov511/ D: OV511 driver diff -u --recursive --new-file v2.4.0-test8/linux/Documentation/Configure.help linux/Documentation/Configure.help --- v2.4.0-test8/linux/Documentation/Configure.help Fri Sep 8 13:27:11 2000 +++ linux/Documentation/Configure.help Fri Sep 15 14:34:19 2000 @@ -8276,6 +8276,11 @@ - SK-9844 (dual link 1000Base-SX) - SK-9821 (single link 1000Base-T) - SK-9822 (dual link 1000Base-T) + - SK-9861 (single link Volition connector) + - SK-9862 (dual link Volition connector) + The driver also supports the following adapters from Allied Telesyn: + - AT2970... + The dual link adapters support a link-failover feature. Read Documentation/networking/sk98lin.txt for information about optional driver parameters. diff -u --recursive --new-file v2.4.0-test8/linux/Documentation/networking/8139too.txt linux/Documentation/networking/8139too.txt --- v2.4.0-test8/linux/Documentation/networking/8139too.txt Fri Sep 8 13:27:11 2000 +++ linux/Documentation/networking/8139too.txt Sun Sep 10 13:21:13 2000 @@ -1,6 +1,6 @@ "8139too" Fast Ethernet driver for Linux - Improved support for RTL-8139 Fast Ethernet adapters + Improved support for RTL-8139 10/100 Fast Ethernet adapters Copyright 2000 Jeff Garzik @@ -8,6 +8,7 @@ Architectures supported (all PCI platforms): x86, Alpha AXP, PowerPC, Sparc64 + Kernel versions supported: 2.4.x @@ -188,6 +189,14 @@ Change History -------------- +Version 0.9.9 - September 9, 2000 + +* Fix oops-able bug in Rx ring wrap calculation (David Ford) +* Use PIO instead of MMIO when USE_IO_OPS is defined +* Move Rx error handling out of Rx interrupt handler, resulting in + tighter Rx interrupt processing + + Version 0.9.8 - September 7, 2000 * Propagate request_irq error value (andrew morton) diff -u --recursive --new-file v2.4.0-test8/linux/Documentation/networking/sk98lin.txt linux/Documentation/networking/sk98lin.txt --- v2.4.0-test8/linux/Documentation/networking/sk98lin.txt Wed Aug 9 19:19:49 2000 +++ linux/Documentation/networking/sk98lin.txt Fri Sep 15 14:34:19 2000 @@ -1,9 +1,9 @@ -(C)Copyright 1999 SysKonnect. +(C)Copyright 1999-2000 SysKonnect. =========================================================================== -sk98lin.txt created 11-Nov-1999 +sk98lin.txt created 12-Sept-2000 -Readme File for sk98lin.o v3.04 +Readme File for sk98lin.o v3.05 SK-NET Gigabit Ethernet Adapter SK-98xx Driver for Linux This file contains @@ -372,6 +372,12 @@ (8) HISTORY =========== + +VERSION 3.05 (In-Kernel version) +Problems fixed: +- Failed for multiple adapters in kernel 2.4.0 +New features: +- New versions of several common modules VERSION 3.04 (In-Kernel version) Problems fixed: diff -u --recursive --new-file v2.4.0-test8/linux/Documentation/networking/vortex.txt linux/Documentation/networking/vortex.txt --- v2.4.0-test8/linux/Documentation/networking/vortex.txt Wed Aug 23 18:36:35 2000 +++ linux/Documentation/networking/vortex.txt Fri Sep 15 16:28:25 2000 @@ -166,8 +166,9 @@ Sets the time duration (in milliseconds) after which the kernel decides that the transmitter has become stuck and needs to be reset. - This is mainly for debugging purposes. The default value is 400 (0.4 - seconds). + This is mainly for debugging purposes, although it may be advantageous + to increase this value on LANs which have very high collision rates. + The default value is 400 (0.4 seconds). Additional resources -------------------- diff -u --recursive --new-file v2.4.0-test8/linux/MAINTAINERS linux/MAINTAINERS --- v2.4.0-test8/linux/MAINTAINERS Fri Sep 8 13:27:11 2000 +++ linux/MAINTAINERS Fri Sep 15 16:43:40 2000 @@ -1152,6 +1152,13 @@ L: linux-tulip@cesdis.gsfc.nasa.gov S: Maintained +TUN/TAP driver +P: Maxim Krasnyansky +M: maxk@qualcomm.com, max_mk@yahoo.com +L: vtun@office.satix.net +W: http://vtun.sourceforge.net/tun +S: Maintained + U14-34F SCSI DRIVER P: Dario Ballabio M: dario@milano.europe.dg.com @@ -1228,7 +1235,7 @@ USB OV511 DRIVER P: Mark McClelland -M: mmcclelland@delphi.com +M: mwm@i.am L: linux-usb-users@lists.sourceforge.net L: linux-usb-devel@lists.sourceforge.net W: http://alpha.dyndns.org/ov511/ diff -u --recursive --new-file v2.4.0-test8/linux/Makefile linux/Makefile --- v2.4.0-test8/linux/Makefile Fri Sep 8 13:27:11 2000 +++ linux/Makefile Fri Sep 8 16:37:12 2000 @@ -1,7 +1,7 @@ VERSION = 2 PATCHLEVEL = 4 SUBLEVEL = 0 -EXTRAVERSION = -test8 +EXTRAVERSION = -test9 KERNELRELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION) diff -u --recursive --new-file v2.4.0-test8/linux/arch/alpha/kernel/time.c linux/arch/alpha/kernel/time.c --- v2.4.0-test8/linux/arch/alpha/kernel/time.c Wed Aug 23 18:36:36 2000 +++ linux/arch/alpha/kernel/time.c Mon Sep 11 08:39:47 2000 @@ -135,38 +135,6 @@ write_unlock(&xtime_lock); } -/* - * Converts Gregorian date to seconds since 1970-01-01 00:00:00. - * Assumes input in normal date format, i.e. 1980-12-31 23:59:59 - * => year=1980, mon=12, day=31, hour=23, min=59, sec=59. - * - * [For the Julian calendar (which was used in Russia before 1917, - * Britain & colonies before 1752, anywhere else before 1582, - * and is still in use by some communities) leave out the - * -year/100+year/400 terms, and add 10.] - * - * This algorithm was first published by Gauss (I think). - * - * WARNING: this function will overflow on 2106-02-07 06:28:16 on - * machines were long is 32-bit! (However, as time_t is signed, we - * will already get problems at other places on 2038-01-19 03:14:08) - */ -static inline unsigned long mktime(unsigned int year, unsigned int mon, - unsigned int day, unsigned int hour, - unsigned int min, unsigned int sec) -{ - if (0 >= (int) (mon -= 2)) { /* 1..12 -> 11,12,1..10 */ - mon += 12; /* Puts Feb last since it has leap day */ - year -= 1; - } - return ((( - (unsigned long)(year/4 - year/100 + year/400 + 367*mon/12 + day) + - year*365 - 719499 - )*24 + hour /* now have hours */ - )*60 + min /* now have minutes */ - )*60 + sec; /* finally seconds */ -} - void common_init_rtc(void) { diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/kernel/time.c linux/arch/arm/kernel/time.c --- v2.4.0-test8/linux/arch/arm/kernel/time.c Thu Jul 27 17:37:59 2000 +++ linux/arch/arm/kernel/time.c Mon Sep 11 08:39:47 2000 @@ -64,37 +64,6 @@ */ unsigned long (*gettimeoffset)(void) = dummy_gettimeoffset; -/* Converts Gregorian date to seconds since 1970-01-01 00:00:00. - * Assumes input in normal date format, i.e. 1980-12-31 23:59:59 - * => year=1980, mon=12, day=31, hour=23, min=59, sec=59. - * - * [For the Julian calendar (which was used in Russia before 1917, - * Britain & colonies before 1752, anywhere else before 1582, - * and is still in use by some communities) leave out the - * -year/100+year/400 terms, and add 10.] - * - * This algorithm was first published by Gauss (I think). - * - * WARNING: this function will overflow on 2106-02-07 06:28:16 on - * machines were long is 32-bit! (However, as time_t is signed, we - * will already get problems at other places on 2038-01-19 03:14:08) - */ -unsigned long -mktime(unsigned int year, unsigned int mon, unsigned int day, - unsigned int hour, unsigned int min, unsigned int sec) -{ - if (0 >= (int) (mon -= 2)) { /* 1..12 -> 11,12,1..10 */ - mon += 12; /* Puts Feb last since it has leap day */ - year -= 1; - } - return ((( - (unsigned long)(year/4 - year/100 + year/400 + 367*mon/12 + day) + - year*365 - 719499 - )*24 + hour /* now have hours */ - )*60 + min /* now have minutes */ - )*60 + sec; /* finally seconds */ -} - /* * Handle kernel profile stuff... */ diff -u --recursive --new-file v2.4.0-test8/linux/arch/i386/kernel/time.c linux/arch/i386/kernel/time.c --- v2.4.0-test8/linux/arch/i386/kernel/time.c Mon Jul 10 16:47:19 2000 +++ linux/arch/i386/kernel/time.c Mon Sep 11 08:39:47 2000 @@ -504,37 +504,6 @@ } -/* Converts Gregorian date to seconds since 1970-01-01 00:00:00. - * Assumes input in normal date format, i.e. 1980-12-31 23:59:59 - * => year=1980, mon=12, day=31, hour=23, min=59, sec=59. - * - * [For the Julian calendar (which was used in Russia before 1917, - * Britain & colonies before 1752, anywhere else before 1582, - * and is still in use by some communities) leave out the - * -year/100+year/400 terms, and add 10.] - * - * This algorithm was first published by Gauss (I think). - * - * WARNING: this function will overflow on 2106-02-07 06:28:16 on - * machines were long is 32-bit! (However, as time_t is signed, we - * will already get problems at other places on 2038-01-19 03:14:08) - */ -static inline unsigned long mktime(unsigned int year, unsigned int mon, - unsigned int day, unsigned int hour, - unsigned int min, unsigned int sec) -{ - if (0 >= (int) (mon -= 2)) { /* 1..12 -> 11,12,1..10 */ - mon += 12; /* Puts Feb last since it has leap day */ - year -= 1; - } - return ((( - (unsigned long)(year/4 - year/100 + year/400 + 367*mon/12 + day) + - year*365 - 719499 - )*24 + hour /* now have hours */ - )*60 + min /* now have minutes */ - )*60 + sec; /* finally seconds */ -} - /* not static: needed by APM */ unsigned long get_cmos_time(void) { diff -u --recursive --new-file v2.4.0-test8/linux/arch/ia64/kernel/efi.c linux/arch/ia64/kernel/efi.c --- v2.4.0-test8/linux/arch/ia64/kernel/efi.c Wed Aug 23 18:36:36 2000 +++ linux/arch/ia64/kernel/efi.c Mon Sep 11 08:39:48 2000 @@ -98,37 +98,6 @@ efi_call_phys(__va(runtime->reset_system), status, data_size, __pa(data)); } -/* - * Converts Gregorian date to seconds since 1970-01-01 00:00:00. - * Assumes input in normal date format, i.e. 1980-12-31 23:59:59 - * => year=1980, mon=12, day=31, hour=23, min=59, sec=59. - * - * [For the Julian calendar (which was used in Russia before 1917, - * Britain & colonies before 1752, anywhere else before 1582, - * and is still in use by some communities) leave out the - * -year/100+year/400 terms, and add 10.] - * - * This algorithm was first published by Gauss (I think). - * - * WARNING: this function will overflow on 2106-02-07 06:28:16 on - * machines were long is 32-bit! (However, as time_t is signed, we - * will already get problems at other places on 2038-01-19 03:14:08) - */ -static inline unsigned long -mktime (unsigned int year, unsigned int mon, unsigned int day, unsigned int hour, - unsigned int min, unsigned int sec) -{ - if (0 >= (int) (mon -= 2)) { /* 1..12 -> 11,12,1..10 */ - mon += 12; /* Puts Feb last since it has leap day */ - year -= 1; - } - return ((((unsigned long)(year/4 - year/100 + year/400 + 367*mon/12 + day) - + year*365 - 719499 - )*24 + hour /* now have hours */ - )*60 + min /* now have minutes */ - )*60 + sec; /* finally seconds */ -} - void efi_gettimeofday (struct timeval *tv) { diff -u --recursive --new-file v2.4.0-test8/linux/arch/m68k/kernel/time.c linux/arch/m68k/kernel/time.c --- v2.4.0-test8/linux/arch/m68k/kernel/time.c Tue May 11 09:57:14 1999 +++ linux/arch/m68k/kernel/time.c Mon Sep 11 08:39:48 2000 @@ -102,37 +102,6 @@ #endif /* CONFIG_HEARTBEAT */ } -/* Converts Gregorian date to seconds since 1970-01-01 00:00:00. - * Assumes input in normal date format, i.e. 1980-12-31 23:59:59 - * => year=1980, mon=12, day=31, hour=23, min=59, sec=59. - * - * [For the Julian calendar (which was used in Russia before 1917, - * Britain & colonies before 1752, anywhere else before 1582, - * and is still in use by some communities) leave out the - * -year/100+year/400 terms, and add 10.] - * - * This algorithm was first published by Gauss (I think). - * - * WARNING: this function will overflow on 2106-02-07 06:28:16 on - * machines were long is 32-bit! (However, as time_t is signed, we - * will already get problems at other places on 2038-01-19 03:14:08) - */ -static inline unsigned long mktime(unsigned int year, unsigned int mon, - unsigned int day, unsigned int hour, - unsigned int min, unsigned int sec) -{ - if (0 >= (int) (mon -= 2)) { /* 1..12 -> 11,12,1..10 */ - mon += 12; /* Puts Feb last since it has leap day */ - year -= 1; - } - return ((( - (unsigned long)(year/4 - year/100 + year/400 + 367*mon/12 + day) + - year*365 - 719499 - )*24 + hour /* now have hours */ - )*60 + min /* now have minutes */ - )*60 + sec; /* finally seconds */ -} - void time_init(void) { unsigned int year, mon, day, hour, min, sec; diff -u --recursive --new-file v2.4.0-test8/linux/arch/m68k/mac/misc.c linux/arch/m68k/mac/misc.c --- v2.4.0-test8/linux/arch/m68k/mac/misc.c Wed Feb 16 17:03:51 2000 +++ linux/arch/m68k/mac/misc.c Mon Sep 11 08:39:48 2000 @@ -11,6 +11,7 @@ #include #include #include +#include #include #include @@ -497,37 +498,6 @@ sti(); printk ("Restart failed. Please restart manually.\n"); while(1); -} - -/* Converts Gregorian date to seconds since 1970-01-01 00:00:00. - * Assumes input in normal date format, i.e. 1980-12-31 23:59:59 - * => year=1980, mon=12, day=31, hour=23, min=59, sec=59. - * - * [For the Julian calendar (which was used in Russia before 1917, - * Britain & colonies before 1752, anywhere else before 1582, - * and is still in use by some communities) leave out the - * -year/100+year/400 terms, and add 10.] - * - * This algorithm was first published by Gauss (I think). - * - * WARNING: this function will overflow on 2106-02-07 06:28:16 on - * machines were long is 32-bit! (However, as time_t is signed, we - * will already get problems at other places on 2038-01-19 03:14:08) - */ -static unsigned long mktime(unsigned int year, unsigned int mon, - unsigned int day, unsigned int hour, - unsigned int min, unsigned int sec) -{ - if (0 >= (int) (mon -= 2)) { /* 1..12 -> 11,12,1..10 */ - mon += 12; /* Puts Feb last since it has leap day */ - year -= 1; - } - return ((( - (unsigned long)(year/4 - year/100 + year/400 + 367*mon/12 + day) + - year*365 - 719499 - )*24 + hour /* now have hours */ - )*60 + min /* now have minutes */ - )*60 + sec; /* finally seconds */ } /* diff -u --recursive --new-file v2.4.0-test8/linux/arch/mips/dec/time.c linux/arch/mips/dec/time.c --- v2.4.0-test8/linux/arch/mips/dec/time.c Fri Jul 14 12:12:05 2000 +++ linux/arch/mips/dec/time.c Mon Sep 11 08:39:48 2000 @@ -346,37 +346,6 @@ } } -/* Converts Gregorian date to seconds since 1970-01-01 00:00:00. - * Assumes input in normal date format, i.e. 1980-12-31 23:59:59 - * => year=1980, mon=12, day=31, hour=23, min=59, sec=59. - * - * [For the Julian calendar (which was used in Russia before 1917, - * Britain & colonies before 1752, anywhere else before 1582, - * and is still in use by some communities) leave out the - * -year/100+year/400 terms, and add 10.] - * - * This algorithm was first published by Gauss (I think). - * - * WARNING: this function will overflow on 2106-02-07 06:28:16 on - * machines were long is 32-bit! (However, as time_t is signed, we - * will already get problems at other places on 2038-01-19 03:14:08) - */ -static inline unsigned long mktime(unsigned int year, unsigned int mon, - unsigned int day, unsigned int hour, - unsigned int min, unsigned int sec) -{ - if (0 >= (int) (mon -= 2)) { /* 1..12 -> 11,12,1..10 */ - mon += 12; /* Puts Feb last since it has leap day */ - year -= 1; - } - return ((( - (unsigned long) (year / 4 - year / 100 + year / 400 + 367 * mon / 12 + day) + - year * 365 - 719499 - ) * 24 + hour /* now have hours */ - ) * 60 + min /* now have minutes */ - ) * 60 + sec; /* finally seconds */ -} - char cyclecounter_available; static inline void init_cycle_counter(void) diff -u --recursive --new-file v2.4.0-test8/linux/arch/mips/kernel/time.c linux/arch/mips/kernel/time.c --- v2.4.0-test8/linux/arch/mips/kernel/time.c Fri Jul 14 12:12:05 2000 +++ linux/arch/mips/kernel/time.c Mon Sep 11 08:39:48 2000 @@ -443,37 +443,6 @@ r4k_timer_interrupt (INDY_R4K_TIMER_IRQ, NULL, regs); } -/* Converts Gregorian date to seconds since 1970-01-01 00:00:00. - * Assumes input in normal date format, i.e. 1980-12-31 23:59:59 - * => year=1980, mon=12, day=31, hour=23, min=59, sec=59. - * - * [For the Julian calendar (which was used in Russia before 1917, - * Britain & colonies before 1752, anywhere else before 1582, - * and is still in use by some communities) leave out the - * -year/100+year/400 terms, and add 10.] - * - * This algorithm was first published by Gauss (I think). - * - * WARNING: this function will overflow on 2106-02-07 06:28:16 on - * machines were long is 32-bit! (However, as time_t is signed, we - * will already get problems at other places on 2038-01-19 03:14:08) - */ -static inline unsigned long mktime(unsigned int year, unsigned int mon, - unsigned int day, unsigned int hour, - unsigned int min, unsigned int sec) -{ - if (0 >= (int) (mon -= 2)) { /* 1..12 -> 11,12,1..10 */ - mon += 12; /* Puts Feb last since it has leap day */ - year -= 1; - } - return ((( - (unsigned long)(year/4 - year/100 + year/400 + 367*mon/12 + day) + - year*365 - 719499 - )*24 + hour /* now have hours */ - )*60 + min /* now have minutes */ - )*60 + sec; /* finally seconds */ -} - char cyclecounter_available; static inline void init_cycle_counter(void) diff -u --recursive --new-file v2.4.0-test8/linux/arch/mips/sgi/kernel/indy_timer.c linux/arch/mips/sgi/kernel/indy_timer.c --- v2.4.0-test8/linux/arch/mips/sgi/kernel/indy_timer.c Tue May 23 15:31:33 2000 +++ linux/arch/mips/sgi/kernel/indy_timer.c Mon Sep 11 08:39:48 2000 @@ -151,37 +151,6 @@ return ct1 - ct0; } -/* Converts Gregorian date to seconds since 1970-01-01 00:00:00. - * Assumes input in normal date format, i.e. 1980-12-31 23:59:59 - * => year=1980, mon=12, day=31, hour=23, min=59, sec=59. - * - * [For the Julian calendar (which was used in Russia before 1917, - * Britain & colonies before 1752, anywhere else before 1582, - * and is still in use by some communities) leave out the - * -year/100+year/400 terms, and add 10.] - * - * This algorithm was first published by Gauss (I think). - * - * WARNING: this function will overflow on 2106-02-07 06:28:16 on - * machines were long is 32-bit! (However, as time_t is signed, we - * will already get problems at other places on 2038-01-19 03:14:08) - */ -static inline unsigned long mktime(unsigned int year, unsigned int mon, - unsigned int day, unsigned int hour, - unsigned int min, unsigned int sec) -{ - if (0 >= (int) (mon -= 2)) { /* 1..12 -> 11,12,1..10 */ - mon += 12; /* Puts Feb last since it has leap day */ - year -= 1; - } - return ((( - (unsigned long)(year/4 - year/100 + year/400 + 367*mon/12 + day) + - year*365 - 719499 - )*24 + hour /* now have hours */ - )*60 + min /* now have minutes */ - )*60 + sec; /* finally seconds */ -} - static unsigned long __init get_indy_time(void) { struct indy_clock *clock = (struct indy_clock *)INDY_CLOCK_REGS; diff -u --recursive --new-file v2.4.0-test8/linux/arch/mips64/sgi-ip22/ip22-timer.c linux/arch/mips64/sgi-ip22/ip22-timer.c --- v2.4.0-test8/linux/arch/mips64/sgi-ip22/ip22-timer.c Tue May 23 15:31:33 2000 +++ linux/arch/mips64/sgi-ip22/ip22-timer.c Mon Sep 11 08:39:48 2000 @@ -151,37 +151,6 @@ return ct1 - ct0; } -/* Converts Gregorian date to seconds since 1970-01-01 00:00:00. - * Assumes input in normal date format, i.e. 1980-12-31 23:59:59 - * => year=1980, mon=12, day=31, hour=23, min=59, sec=59. - * - * [For the Julian calendar (which was used in Russia before 1917, - * Britain & colonies before 1752, anywhere else before 1582, - * and is still in use by some communities) leave out the - * -year/100+year/400 terms, and add 10.] - * - * This algorithm was first published by Gauss (I think). - * - * WARNING: this function will overflow on 2106-02-07 06:28:16 on - * machines were long is 32-bit! (However, as time_t is signed, we - * will already get problems at other places on 2038-01-19 03:14:08) - */ -static inline unsigned long mktime(unsigned int year, unsigned int mon, - unsigned int day, unsigned int hour, - unsigned int min, unsigned int sec) -{ - if (0 >= (int) (mon -= 2)) { /* 1..12 -> 11,12,1..10 */ - mon += 12; /* Puts Feb last since it has leap day */ - year -= 1; - } - return ((( - (unsigned long)(year/4 - year/100 + year/400 + 367*mon/12 + day) + - year*365 - 719499 - )*24 + hour /* now have hours */ - )*60 + min /* now have minutes */ - )*60 + sec; /* finally seconds */ -} - static unsigned long __init get_indy_time(void) { struct indy_clock *clock = (struct indy_clock *)INDY_CLOCK_REGS; diff -u --recursive --new-file v2.4.0-test8/linux/arch/mips64/sgi-ip27/ip27-timer.c linux/arch/mips64/sgi-ip27/ip27-timer.c --- v2.4.0-test8/linux/arch/mips64/sgi-ip27/ip27-timer.c Fri Jul 14 12:12:05 2000 +++ linux/arch/mips64/sgi-ip27/ip27-timer.c Mon Sep 11 08:39:48 2000 @@ -219,37 +219,6 @@ #include #include -/* Converts Gregorian date to seconds since 1970-01-01 00:00:00. - * Assumes input in normal date format, i.e. 1980-12-31 23:59:59 - * => year=1980, mon=12, day=31, hour=23, min=59, sec=59. - * - * [For the Julian calendar (which was used in Russia before 1917, - * Britain & colonies before 1752, anywhere else before 1582, - * and is still in use by some communities) leave out the - * -year/100+year/400 terms, and add 10.] - * - * This algorithm was first published by Gauss (I think). - * - * WARNING: this function will overflow on 2106-02-07 06:28:16 on - * machines were long is 32-bit! (However, as time_t is signed, we - * will already get problems at other places on 2038-01-19 03:14:08) - */ -static inline unsigned long mktime(unsigned int year, unsigned int mon, - unsigned int day, unsigned int hour, - unsigned int min, unsigned int sec) -{ - if (0 >= (int) (mon -= 2)) { /* 1..12 -> 11,12,1..10 */ - mon += 12; /* Puts Feb last since it has leap day */ - year -= 1; - } - return ((( - (unsigned long)(year/4 - year/100 + year/400 + 367*mon/12 + day) + - year*365 - 719499 - )*24 + hour /* now have hours */ - )*60 + min /* now have minutes */ - )*60 + sec; /* finally seconds */ -} - #define DEBUG_RTC static unsigned long __init get_m48t35_time(void) diff -u --recursive --new-file v2.4.0-test8/linux/arch/ppc/amiga/time.c linux/arch/ppc/amiga/time.c --- v2.4.0-test8/linux/arch/ppc/amiga/time.c Sat Oct 9 11:47:50 1999 +++ linux/arch/ppc/amiga/time.c Mon Sep 11 08:39:48 2000 @@ -11,10 +11,6 @@ #include -static inline unsigned long mktime(unsigned int year, unsigned int mon, - unsigned int day, unsigned int hour, - unsigned int min, unsigned int sec); - unsigned long m68k_get_rtc_time(void) { unsigned int year, mon, day, hour, min, sec; @@ -36,38 +32,6 @@ return mach_set_clock_mmss (nowtime); return -1; } - -/* Converts Gregorian date to seconds since 1970-01-01 00:00:00. - * Assumes input in normal date format, i.e. 1980-12-31 23:59:59 - * => year=1980, mon=12, day=31, hour=23, min=59, sec=59. - * - * [For the Julian calendar (which was used in Russia before 1917, - * Britain & colonies before 1752, anywhere else before 1582, - * and is still in use by some communities) leave out the - * -year/100+year/400 terms, and add 10.] - * - * This algorithm was first published by Gauss (I think). - * - * WARNING: this function will overflow on 2106-02-07 06:28:16 on - * machines were long is 32-bit! (However, as time_t is signed, we - * will already get problems at other places on 2038-01-19 03:14:08) - */ -static inline unsigned long mktime(unsigned int year, unsigned int mon, - unsigned int day, unsigned int hour, - unsigned int min, unsigned int sec) -{ - if (0 >= (int) (mon -= 2)) { /* 1..12 -> 11,12,1..10 */ - mon += 12; /* Puts Feb last since it has leap day */ - year -= 1; - } - return ((( - (unsigned long)(year/4 - year/100 + year/400 + 367*mon/12 + day) + - year*365 - 719499 - )*24 + hour /* now have hours */ - )*60 + min /* now have minutes */ - )*60 + sec; /* finally seconds */ -} - void apus_heartbeat (void) { diff -u --recursive --new-file v2.4.0-test8/linux/arch/ppc/kernel/chrp_time.c linux/arch/ppc/kernel/chrp_time.c --- v2.4.0-test8/linux/arch/ppc/kernel/chrp_time.c Fri Jul 14 12:12:06 2000 +++ linux/arch/ppc/kernel/chrp_time.c Mon Sep 11 08:39:48 2000 @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include diff -u --recursive --new-file v2.4.0-test8/linux/arch/ppc/kernel/gemini_setup.c linux/arch/ppc/kernel/gemini_setup.c --- v2.4.0-test8/linux/arch/ppc/kernel/gemini_setup.c Fri Jul 14 12:12:06 2000 +++ linux/arch/ppc/kernel/gemini_setup.c Mon Sep 11 08:39:48 2000 @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include diff -u --recursive --new-file v2.4.0-test8/linux/arch/ppc/kernel/ppc_ksyms.c linux/arch/ppc/kernel/ppc_ksyms.c --- v2.4.0-test8/linux/arch/ppc/kernel/ppc_ksyms.c Wed Aug 9 19:19:49 2000 +++ linux/arch/ppc/kernel/ppc_ksyms.c Mon Sep 11 08:39:48 2000 @@ -254,7 +254,6 @@ EXPORT_SYMBOL(pmac_xpram_write); #endif /* CONFIG_NVRAM */ #ifdef CONFIG_PPC_RTC -EXPORT_SYMBOL(mktime); EXPORT_SYMBOL(to_tm); #endif diff -u --recursive --new-file v2.4.0-test8/linux/arch/ppc/kernel/prep_time.c linux/arch/ppc/kernel/prep_time.c --- v2.4.0-test8/linux/arch/ppc/kernel/prep_time.c Fri Jul 14 12:12:06 2000 +++ linux/arch/ppc/kernel/prep_time.c Mon Sep 11 08:39:48 2000 @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include diff -u --recursive --new-file v2.4.0-test8/linux/arch/ppc/kernel/time.c linux/arch/ppc/kernel/time.c --- v2.4.0-test8/linux/arch/ppc/kernel/time.c Fri Jul 14 12:12:06 2000 +++ linux/arch/ppc/kernel/time.c Mon Sep 11 08:39:48 2000 @@ -232,38 +232,6 @@ last_rtc_update = 0; } -/* Converts Gregorian date to seconds since 1970-01-01 00:00:00. - * Assumes input in normal date format, i.e. 1980-12-31 23:59:59 - * => year=1980, mon=12, day=31, hour=23, min=59, sec=59. - * - * [For the Julian calendar (which was used in Russia before 1917, - * Britain & colonies before 1752, anywhere else before 1582, - * and is still in use by some communities) leave out the - * -year/100+year/400 terms, and add 10.] - * - * This algorithm was first published by Gauss (I think). - * - * WARNING: this function will overflow on 2106-02-07 06:28:16 on - * machines were long is 32-bit! (However, as time_t is signed, we - * will already get problems at other places on 2038-01-19 03:14:08) - */ -unsigned long mktime(unsigned int year, unsigned int mon, - unsigned int day, unsigned int hour, - unsigned int min, unsigned int sec) -{ - - if (0 >= (int) (mon -= 2)) { /* 1..12 -> 11,12,1..10 */ - mon += 12; /* Puts Feb last since it has leap day */ - year -= 1; - } - return ((( - (unsigned long)(year/4 - year/100 + year/400 + 367*mon/12 + day) + - year*365 - 719499 - )*24 + hour /* now have hours */ - )*60 + min /* now have minutes */ - )*60 + sec; /* finally seconds */ -} - #define TICK_SIZE tick #define FEBRUARY 2 #define STARTOFTIME 1970 diff -u --recursive --new-file v2.4.0-test8/linux/arch/sh/kernel/time.c linux/arch/sh/kernel/time.c --- v2.4.0-test8/linux/arch/sh/kernel/time.c Wed Aug 9 19:19:49 2000 +++ linux/arch/sh/kernel/time.c Mon Sep 11 08:39:48 2000 @@ -274,37 +274,6 @@ write_unlock(&xtime_lock); } -/* Converts Gregorian date to seconds since 1970-01-01 00:00:00. - * Assumes input in normal date format, i.e. 1980-12-31 23:59:59 - * => year=1980, mon=12, day=31, hour=23, min=59, sec=59. - * - * [For the Julian calendar (which was used in Russia before 1917, - * Britain & colonies before 1752, anywhere else before 1582, - * and is still in use by some communities) leave out the - * -year/100+year/400 terms, and add 10.] - * - * This algorithm was first published by Gauss (I think). - * - * WARNING: this function will overflow on 2106-02-07 06:28:16 on - * machines were long is 32-bit! (However, as time_t is signed, we - * will already get problems at other places on 2038-01-19 03:14:08) - */ -static inline unsigned long mktime(unsigned int year, unsigned int mon, - unsigned int day, unsigned int hour, - unsigned int min, unsigned int sec) -{ - if (0 >= (int) (mon -= 2)) { /* 1..12 -> 11,12,1..10 */ - mon += 12; /* Puts Feb last since it has leap day */ - year -= 1; - } - return ((( - (unsigned long)(year/4 - year/100 + year/400 + 367*mon/12 + day) + - year*365 - 719499 - )*24 + hour /* now have hours */ - )*60 + min /* now have minutes */ - )*60 + sec; /* finally seconds */ -} - static unsigned long get_rtc_time(void) { unsigned int sec, min, hr, wk, day, mon, yr, yr100; diff -u --recursive --new-file v2.4.0-test8/linux/arch/sparc/kernel/time.c linux/arch/sparc/kernel/time.c --- v2.4.0-test8/linux/arch/sparc/kernel/time.c Fri Jun 23 21:55:08 2000 +++ linux/arch/sparc/kernel/time.c Mon Sep 11 08:39:48 2000 @@ -149,37 +149,6 @@ write_unlock(&xtime_lock); } -/* Converts Gregorian date to seconds since 1970-01-01 00:00:00. - * Assumes input in normal date format, i.e. 1980-12-31 23:59:59 - * => year=1980, mon=12, day=31, hour=23, min=59, sec=59. - * - * [For the Julian calendar (which was used in Russia before 1917, - * Britain & colonies before 1752, anywhere else before 1582, - * and is still in use by some communities) leave out the - * -year/100+year/400 terms, and add 10.] - * - * This algorithm was first published by Gauss (I think). - * - * WARNING: this function will overflow on 2106-02-07 06:28:16 on - * machines were long is 32-bit! (However, as time_t is signed, we - * will already get problems at other places on 2038-01-19 03:14:08) - */ -static inline unsigned long mktime(unsigned int year, unsigned int mon, - unsigned int day, unsigned int hour, - unsigned int min, unsigned int sec) -{ - if (0 >= (int) (mon -= 2)) { /* 1..12 -> 11,12,1..10 */ - mon += 12; /* Puts Feb last since it has leap day */ - year -= 1; - } - return ((( - (unsigned long)(year/4 - year/100 + year/400 + 367*mon/12 + day) + - year*365 - 719499 - )*24 + hour /* now have hours */ - )*60 + min /* now have minutes */ - )*60 + sec; /* finally seconds */ -} - /* Kick start a stopped clock (procedure from the Sun NVRAM/hostid FAQ). */ static void __init kick_start_clock(void) { diff -u --recursive --new-file v2.4.0-test8/linux/arch/sparc64/kernel/entry.S linux/arch/sparc64/kernel/entry.S --- v2.4.0-test8/linux/arch/sparc64/kernel/entry.S Fri Sep 8 13:27:11 2000 +++ linux/arch/sparc64/kernel/entry.S Fri Sep 8 17:55:17 2000 @@ -1,4 +1,4 @@ -/* $Id: entry.S,v 1.119 2000/09/06 00:45:01 davem Exp $ +/* $Id: entry.S,v 1.120 2000/09/08 13:58:12 jj Exp $ * arch/sparc64/kernel/entry.S: Sparc64 trap low-level entry points. * * Copyright (C) 1995,1997 David S. Miller (davem@caip.rutgers.edu) @@ -940,8 +940,8 @@ 1: b,pt %xcc, ret_sys_call ldx [%sp + STACK_BIAS + REGWIN_SZ + PT_V9_I0], %o0 -sparc_exit: rdpr %otherwin, %g1 - wrpr %g0, (PSTATE_RMO | PSTATE_PEF | PSTATE_PRIV), %pstate +sparc_exit: wrpr %g0, (PSTATE_RMO | PSTATE_PEF | PSTATE_PRIV), %pstate + rdpr %otherwin, %g1 rdpr %cansave, %g3 add %g3, %g1, %g3 wrpr %g3, 0x0, %cansave diff -u --recursive --new-file v2.4.0-test8/linux/arch/sparc64/kernel/time.c linux/arch/sparc64/kernel/time.c --- v2.4.0-test8/linux/arch/sparc64/kernel/time.c Fri Jul 14 12:12:08 2000 +++ linux/arch/sparc64/kernel/time.c Mon Sep 11 08:39:48 2000 @@ -177,37 +177,6 @@ } #endif -/* Converts Gregorian date to seconds since 1970-01-01 00:00:00. - * Assumes input in normal date format, i.e. 1980-12-31 23:59:59 - * => year=1980, mon=12, day=31, hour=23, min=59, sec=59. - * - * [For the Julian calendar (which was used in Russia before 1917, - * Britain & colonies before 1752, anywhere else before 1582, - * and is still in use by some communities) leave out the - * -year/100+year/400 terms, and add 10.] - * - * This algorithm was first published by Gauss (I think). - * - * WARNING: this function will overflow on 2106-02-07 06:28:16 on - * machines were long is 32-bit! (However, as time_t is signed, we - * will already get problems at other places on 2038-01-19 03:14:08) - */ -static inline unsigned long mktime(unsigned int year, unsigned int mon, - unsigned int day, unsigned int hour, - unsigned int min, unsigned int sec) -{ - if (0 >= (int) (mon -= 2)) { /* 1..12 -> 11,12,1..10 */ - mon += 12; /* Puts Feb last since it has leap day */ - year -= 1; - } - return ((( - (unsigned long)(year/4 - year/100 + year/400 + 367*mon/12 + day) + - year*365 - 719499 - )*24 + hour /* now have hours */ - )*60 + min /* now have minutes */ - )*60 + sec; /* finally seconds */ -} - /* Kick start a stopped clock (procedure from the Sun NVRAM/hostid FAQ). */ static void __init kick_start_clock(void) { diff -u --recursive --new-file v2.4.0-test8/linux/arch/sparc64/lib/rwlock.S linux/arch/sparc64/lib/rwlock.S --- v2.4.0-test8/linux/arch/sparc64/lib/rwlock.S Sun Mar 19 18:35:30 2000 +++ linux/arch/sparc64/lib/rwlock.S Fri Sep 8 17:55:17 2000 @@ -1,4 +1,4 @@ -/* $Id: rwlock.S,v 1.3 2000/03/16 16:44:38 davem Exp $ +/* $Id: rwlock.S,v 1.4 2000/09/09 00:00:34 davem Exp $ * rwlocks.S: These things are too big to do inline. * * Copyright (C) 1999 David S. Miller (davem@redhat.com) @@ -30,54 +30,38 @@ cmp %g5, %g7 be,pt %xcc, 99b membar #StoreLoad | #StoreStore - b,a,pt %xcc, __read_unlock + ba,a,pt %xcc, __read_unlock __read_wait_for_writer: ldsw [%o0], %g5 brlz,pt %g5, __read_wait_for_writer membar #LoadLoad - b,a,pt %xcc, 4b -__write_wait_for_writer: - ldsw [%o0], %g5 - brlz,pt %g5, __write_wait_for_writer + ba,a,pt %xcc, 4b +__write_wait_for_any: + lduw [%o0], %g5 + brnz,pt %g5, __write_wait_for_any membar #LoadLoad - b,a,pt %xcc, 4f - - /* Similarly, 2 cache lines for non-contention write locks. */ + ba,a,pt %xcc, 4f .align 64 .globl __write_unlock __write_unlock: /* %o0 = lock_ptr */ - sethi %hi(0x80000000), %g2 -1: lduw [%o0], %g5 - andn %g5, %g2, %g7 - cas [%o0], %g5, %g7 - cmp %g5, %g7 - be,pt %icc, 99b - membar #StoreLoad | #StoreStore - b,a,pt %xcc, 1b + membar #LoadStore | #StoreStore + retl + stw %g0, [%o0] .globl __write_lock __write_lock: /* %o0 = lock_ptr */ sethi %hi(0x80000000), %g2 -1: ldsw [%o0], %g5 -4: brnz,pn %g5, 5f - or %g5, %g2, %g7 + +1: lduw [%o0], %g5 + brnz,pn %g5, __write_wait_for_any +4: or %g5, %g2, %g7 cas [%o0], %g5, %g7 + cmp %g5, %g7 be,pt %icc, 99b membar #StoreLoad | #StoreStore - - b,a,pt %xcc, 1b -5: brlz %g5, __write_wait_for_writer - or %g5, %g2, %g7 - cas [%o0], %g5, %g7 - cmp %g5, %g7 - bne,pn %icc, 5b -8: ldsw [%o0], %g5 - cmp %g5, %g2 - be,pn %icc, 99b - membar #LoadLoad - b,a,pt %xcc, 99b + ba,a,pt %xcc, 1b rwlock_impl_end: diff -u --recursive --new-file v2.4.0-test8/linux/arch/sparc64/mm/init.c linux/arch/sparc64/mm/init.c --- v2.4.0-test8/linux/arch/sparc64/mm/init.c Fri Sep 8 13:27:11 2000 +++ linux/arch/sparc64/mm/init.c Fri Sep 8 17:55:17 2000 @@ -1,4 +1,4 @@ -/* $Id: init.c,v 1.154 2000/08/09 00:00:15 davem Exp $ +/* $Id: init.c,v 1.155 2000/09/09 00:02:19 davem Exp $ * arch/sparc64/mm/init.c * * Copyright (C) 1996-1999 David S. Miller (davem@caip.rutgers.edu) diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/Makefile linux/drivers/acpi/Makefile --- v2.4.0-test8/linux/drivers/acpi/Makefile Fri Jul 14 12:12:08 2000 +++ linux/drivers/acpi/Makefile Fri Sep 15 18:21:43 2000 @@ -2,7 +2,7 @@ # Makefile for the Linux ACPI interpreter # -SUB_DIRS := +SUB_DIRS := MOD_SUB_DIRS := $(SUB_DIRS) MOD_IN_SUB_DIRS := ALL_SUB_DIRS := $(SUB_DIRS) @@ -11,13 +11,22 @@ O_OBJS := M_OBJS := -ACPI_OBJS := driver.o ec.o cpu.o os.o sys.o tables.o -ACPI_OBJS += $(patsubst %.c,%.o,$(wildcard */*.c)) +export ACPI_CFLAGS +ACPI_CFLAGS := -D_LINUX -EXTRA_CFLAGS += -I./include -D_LINUX +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) + + SUB_DIRS += common dispatcher events hardware\ + interpreter namespace parser resources tables + + ACPI_OBJS := $(patsubst %,%.o,$(SUB_DIRS)) + ACPI_OBJS += $(patsubst %.c,%.o,$(wildcard *.c)) + O_OBJS += $(ACPI_OBJS) endif diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/common/Makefile linux/drivers/acpi/common/Makefile --- v2.4.0-test8/linux/drivers/acpi/common/Makefile Wed Dec 31 16:00:00 1969 +++ linux/drivers/acpi/common/Makefile Fri Sep 15 18:21:43 2000 @@ -0,0 +1,28 @@ +# +# 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)) + +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: + $(RM) *.o diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/common/cmalloc.c linux/drivers/acpi/common/cmalloc.c --- v2.4.0-test8/linux/drivers/acpi/common/cmalloc.c Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/common/cmalloc.c Fri Sep 15 14:30:29 2000 @@ -1,6 +1,7 @@ /****************************************************************************** * * Module Name: cmalloc - local memory allocation routines + * $Revision: 73 $ * *****************************************************************************/ @@ -24,13 +25,13 @@ #include "acpi.h" -#include "parser.h" -#include "interp.h" -#include "namesp.h" -#include "globals.h" +#include "acparser.h" +#include "acinterp.h" +#include "acnamesp.h" +#include "acglobal.h" #define _COMPONENT MISCELLANEOUS - MODULE_NAME ("cmalloc"); + MODULE_NAME ("cmalloc") /***************************************************************************** @@ -52,8 +53,8 @@ _cm_allocate ( u32 size, u32 component, - ACPI_STRING module, - s32 line) + NATIVE_CHAR *module, + u32 line) { void *address = NULL; @@ -98,8 +99,8 @@ _cm_callocate ( u32 size, u32 component, - ACPI_STRING module, - s32 line) + NATIVE_CHAR *module, + u32 line) { void *address = NULL; @@ -146,8 +147,8 @@ _cm_free ( void *address, u32 component, - ACPI_STRING module, - s32 line) + NATIVE_CHAR *module, + u32 line) { if (NULL == address) { diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/common/cmclib.c linux/drivers/acpi/common/cmclib.c --- v2.4.0-test8/linux/drivers/acpi/common/cmclib.c Wed Dec 31 16:00:00 1969 +++ linux/drivers/acpi/common/cmclib.c Fri Sep 15 14:30:29 2000 @@ -0,0 +1,821 @@ +/****************************************************************************** + * + * Module Name: cmclib - Local implementation of C library functions + * $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 "acevents.h" +#include "achware.h" +#include "acnamesp.h" +#include "acinterp.h" +#include "amlcode.h" + +/* + * These implementations of standard C Library routines can optionally be + * used if a C library is not available. In general, they are less efficient + * than an inline or assembly implementation + */ + +#define _COMPONENT MISCELLANEOUS + MODULE_NAME ("cmclib") + + +#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 + +/******************************************************************************* + * + * FUNCTION: strlen + * + * PARAMETERS: String - Null terminated string + * + * RETURN: Length + * + * DESCRIPTION: Returns the length of the input string + * + ******************************************************************************/ + + +NATIVE_UINT +acpi_cm_strlen ( + const NATIVE_CHAR *string) +{ + NATIVE_UINT length = 0; + + + /* Count the string until a null is encountered */ + + while (*string) { + length++; + string++; + } + + return (length); +} + + +/******************************************************************************* + * + * FUNCTION: strcpy + * + * PARAMETERS: Dst_string - Target of the copy + * Src_string - The source string to copy + * + * RETURN: Dst_string + * + * DESCRIPTION: Copy a null terminated string + * + ******************************************************************************/ + +NATIVE_CHAR * +acpi_cm_strcpy ( + NATIVE_CHAR *dst_string, + const NATIVE_CHAR *src_string) +{ + NATIVE_CHAR *string = dst_string; + + + /* Move bytes brute force */ + + while (*src_string) { + *string = *src_string; + + string++; + src_string++; + } + + /* Null terminate */ + + *string = 0; + + return (dst_string); +} + + +/******************************************************************************* + * + * FUNCTION: strncpy + * + * PARAMETERS: Dst_string - Target of the copy + * Src_string - The source string to copy + * Count - Maximum # of bytes to copy + * + * RETURN: Dst_string + * + * DESCRIPTION: Copy a null terminated string, with a maximum length + * + ******************************************************************************/ + +NATIVE_CHAR * +acpi_cm_strncpy ( + NATIVE_CHAR *dst_string, + const NATIVE_CHAR *src_string, + NATIVE_UINT count) +{ + NATIVE_CHAR *string = dst_string; + + + /* Copy the string */ + + for (string = dst_string; + count && (count--, (*string++ = *src_string++)); ) + {;} + + /* Pad with nulls if necessary */ + + while (count--) { + *string = 0; + string++; + } + + /* Return original pointer */ + + return (dst_string); +} + + +/******************************************************************************* + * + * FUNCTION: strcmp + * + * PARAMETERS: String1 - First string + * String2 - Second string + * + * RETURN: Index where strings mismatched, or 0 if strings matched + * + * DESCRIPTION: Compare two null terminated strings + * + ******************************************************************************/ + +u32 +acpi_cm_strcmp ( + const NATIVE_CHAR *string1, + const NATIVE_CHAR *string2) +{ + + + for ( ; (*string1 == *string2); string2++) { + if (!*string1++) { + return (0); + } + } + + + return ((unsigned char) *string1 - (unsigned char) *string2); +} + + +/******************************************************************************* + * + * FUNCTION: strncmp + * + * PARAMETERS: String1 - First string + * String2 - Second string + * Count - Maximum # of bytes to compare + * + * RETURN: Index where strings mismatched, or 0 if strings matched + * + * DESCRIPTION: Compare two null terminated strings, with a maximum length + * + ******************************************************************************/ + +u32 +acpi_cm_strncmp ( + const NATIVE_CHAR *string1, + const NATIVE_CHAR *string2, + NATIVE_UINT count) +{ + + + for ( ; count-- && (*string1 == *string2); string2++) { + if (!*string1++) { + return (0); + } + } + + return ((count == -1) ? 0 : ((unsigned char) *string1 - + (unsigned char) *string2)); +} + + +/******************************************************************************* + * + * FUNCTION: Strcat + * + * PARAMETERS: Dst_string - Target of the copy + * Src_string - The source string to copy + * + * RETURN: Dst_string + * + * DESCRIPTION: Append a null terminated string to a null terminated string + * + ******************************************************************************/ + +NATIVE_CHAR * +acpi_cm_strcat ( + NATIVE_CHAR *dst_string, + const NATIVE_CHAR *src_string) +{ + NATIVE_CHAR *string; + + + /* Find end of the destination string */ + + for (string = dst_string; *string++; ) { ; } + + /* Concatinate the string */ + + for (--string; (*string++ = *src_string++); ) { ; } + + return (dst_string); +} + + +/******************************************************************************* + * + * FUNCTION: strncat + * + * PARAMETERS: Dst_string - Target of the copy + * Src_string - The source string to copy + * Count - Maximum # of bytes to copy + * + * RETURN: Dst_string + * + * DESCRIPTION: Append a null terminated string to a null terminated string, + * with a maximum count. + * + ******************************************************************************/ + +NATIVE_CHAR * +acpi_cm_strncat ( + NATIVE_CHAR *dst_string, + const NATIVE_CHAR *src_string, + NATIVE_UINT count) +{ + NATIVE_CHAR *string; + + + if (count) { + /* Find end of the destination string */ + + for (string = dst_string; *string++; ) { ; } + + /* Concatinate the string */ + + for (--string; (*string++ = *src_string++) && --count; ) { ; } + + /* Null terminate if necessary */ + + if (!count) { + *string = 0; + } + } + + return (dst_string); +} + + +/******************************************************************************* + * + * FUNCTION: memcpy + * + * PARAMETERS: Dest - Target of the copy + * Src - Source buffer to copy + * Count - Number of bytes to copy + * + * RETURN: Dest + * + * DESCRIPTION: Copy arbitrary bytes of memory + * + ******************************************************************************/ + +void * +acpi_cm_memcpy ( + void *dest, + const void *src, + NATIVE_UINT count) +{ + NATIVE_CHAR *new = (NATIVE_CHAR *) dest; + NATIVE_CHAR *old = (NATIVE_CHAR *) src; + + + while (count) { + *new = *old; + new++; + old++; + count--; + } + + return (dest); +} + + +/******************************************************************************* + * + * FUNCTION: memset + * + * PARAMETERS: Dest - Buffer to set + * Value - Value to set each byte of memory + * Count - Number of bytes to set + * + * RETURN: Dest + * + * DESCRIPTION: Initialize a buffer to a known value. + * + ******************************************************************************/ + +void * +acpi_cm_memset ( + void *dest, + u32 value, + NATIVE_UINT count) +{ + NATIVE_CHAR *new = (NATIVE_CHAR *) dest; + + + while (count) { + *new = (char) value; + new++; + count--; + } + + return (dest); +} + + +#define NEGATIVE 1 +#define POSITIVE 0 + + +#define _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. */ + + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0x80 to 0x8F */ + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0x90 to 0x9F */ + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0xA0 to 0xAF */ + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0xB0 to 0xBF */ + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0xC0 to 0xCF */ + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0xD0 to 0xDF */ + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0xE0 to 0xEF */ + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* 0xF0 to 0x100 */ +}; + +#define IS_UPPER(c) (_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)) + + +/******************************************************************************* + * + * FUNCTION: Acpi_cm_to_upper + * + * PARAMETERS: + * + * RETURN: + * + * DESCRIPTION: Convert character to uppercase + * + ******************************************************************************/ + +u32 +acpi_cm_to_upper ( + u32 c) +{ + + return (IS_LOWER(c) ? ((c)-0x20) : (c)); +} + + +/******************************************************************************* + * + * FUNCTION: Acpi_cm_to_lower + * + * PARAMETERS: + * + * RETURN: + * + * DESCRIPTION: Convert character to lowercase + * + ******************************************************************************/ + +u32 +acpi_cm_to_lower ( + u32 c) +{ + + return (IS_UPPER(c) ? ((c)+0x20) : (c)); +} + + +/******************************************************************************* + * + * FUNCTION: strupr + * + * PARAMETERS: Src_string - The source string to convert to + * + * RETURN: Src_string + * + * DESCRIPTION: Convert string to uppercase + * + ******************************************************************************/ + +NATIVE_CHAR * +acpi_cm_strupr ( + NATIVE_CHAR *src_string) +{ + NATIVE_CHAR *string; + + + /* Walk entire string, uppercasing the letters */ + + for (string = src_string; *string; ) { + *string = (char) acpi_cm_to_upper (*string); + string++; + } + + + return (src_string); +} + + +/******************************************************************************* + * + * FUNCTION: strstr + * + * PARAMETERS: String1 - + * String2 + * + * RETURN: + * + * DESCRIPTION: Checks if String2 occurs in String1. This is not really a + * full implementation of strstr, only sufficient for command + * matching + * + ******************************************************************************/ + +NATIVE_CHAR * +acpi_cm_strstr ( + NATIVE_CHAR *string1, + NATIVE_CHAR *string2) +{ + NATIVE_CHAR *string; + + + if (acpi_cm_strlen (string2) > acpi_cm_strlen (string1)) { + return (NULL); + } + + /* Walk entire string, uppercasing the letters */ + + for (string = string1; *string2; ) { + if (*string2 != *string) { + return (NULL); + } + + string2++; + string++; + } + + + return (string1); +} + + +/******************************************************************************* + * + * FUNCTION: strtoul + * + * PARAMETERS: String - Null terminated string + * Terminater - Where a pointer to the terminating byte is returned + * Base - Radix of the string + * + * RETURN: Converted value + * + * DESCRIPTION: Convert a string into an unsigned value. + * + ******************************************************************************/ + +u32 +acpi_cm_strtoul ( + const NATIVE_CHAR *string, + NATIVE_CHAR **terminator, + u32 base) +{ + u32 converted = 0; + u32 index; + u32 sign; + const NATIVE_CHAR *string_start; + u32 return_value = 0; + ACPI_STATUS status = AE_OK; + + + /* + * Save the value of the pointer to the buffer's first + * character, save the current errno value, and then + * skip over any white space in the buffer: + */ + string_start = string; + while (IS_SPACE (*string) || *string == '\t') { + ++string; + } + + /* + * The buffer may contain an optional plus or minus sign. + * If it does, then skip over it but remember what is was: + */ + if (*string == '-') { + sign = NEGATIVE; + ++string; + } + + else if (*string == '+') { + ++string; + sign = POSITIVE; + } + + else { + sign = POSITIVE; + } + + /* + * If the input parameter Base is zero, then we need to + * determine if it is octal, decimal, or hexadecimal: + */ + if (base == 0) { + if (*string == '0') { + if (acpi_cm_to_lower (*(++string)) == 'x') { + base = 16; + ++string; + } + + else { + base = 8; + } + } + + else { + base = 10; + } + } + + else if (base < 2 || base > 36) { + /* + * The specified Base parameter is not in the domain of + * this function: + */ + goto done; + } + + /* + * For octal and hexadecimal bases, skip over the leading + * 0 or 0x, if they are present. + */ + if (base == 8 && *string == '0') { + string++; + } + + if (base == 16 && + *string == '0' && + acpi_cm_to_lower (*(++string)) == 'x') + { + string++; + } + + + /* + * Main loop: convert the string to an unsigned long: + */ + while (*string) { + if (IS_DIGIT (*string)) { + index = *string - '0'; + } + + else { + index = acpi_cm_to_upper (*string); + if (IS_UPPER (index)) { + index = index - 'A' + 10; + } + + else { + goto done; + } + } + + if (index >= base) { + goto done; + } + + /* + * Check to see if value is out of range: + */ + + if (return_value > ((ACPI_UINT32_MAX - (u32) index) / + (u32) base)) + { + status = AE_ERROR; + return_value = 0L; /* reset */ + } + + else { + return_value *= base; + return_value += index; + converted = 1; + } + + ++string; + } + +done: + /* + * If appropriate, update the caller's pointer to the next + * unconverted character in the buffer. + */ + if (terminator) { + if (converted == 0 && return_value == 0L && string != NULL) { + *terminator = (NATIVE_CHAR *) string_start; + } + + else { + *terminator = (NATIVE_CHAR *) string; + } + } + + if (status == AE_ERROR) { + return_value = ACPI_UINT32_MAX; + } + + /* + * If a minus sign was present, then "the conversion is negated": + */ + if (sign == NEGATIVE) { + return_value = (ACPI_UINT32_MAX - return_value) + 1; + } + + return (return_value); +} + +#endif /* ACPI_USE_SYSTEM_CLIBRARY */ + diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/common/cmcopy.c linux/drivers/acpi/common/cmcopy.c --- v2.4.0-test8/linux/drivers/acpi/common/cmcopy.c Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/common/cmcopy.c Fri Sep 15 14:30:29 2000 @@ -1,6 +1,7 @@ /****************************************************************************** * * Module Name: cmcopy - Internal to external object translation utilities + * $Revision: 56 $ * *****************************************************************************/ @@ -24,17 +25,17 @@ #include "acpi.h" -#include "interp.h" -#include "namesp.h" +#include "acinterp.h" +#include "acnamesp.h" #define _COMPONENT MISCELLANEOUS - MODULE_NAME ("cmcopy"); + MODULE_NAME ("cmcopy") typedef struct search_st { - ACPI_OBJECT_INTERNAL *internal_obj; + ACPI_OPERAND_OBJECT *internal_obj; u32 index; ACPI_OBJECT *external_obj; @@ -64,13 +65,13 @@ ACPI_STATUS acpi_cm_build_external_simple_object ( - ACPI_OBJECT_INTERNAL *internal_obj, + ACPI_OPERAND_OBJECT *internal_obj, ACPI_OBJECT *external_obj, u8 *data_space, u32 *buffer_space_used) { u32 length = 0; - char *source_ptr = NULL; + u8 *source_ptr = NULL; /* @@ -103,8 +104,8 @@ length = internal_obj->string.length; external_obj->string.length = internal_obj->string.length; - external_obj->string.pointer = (char *) data_space; - source_ptr = internal_obj->string.pointer; + external_obj->string.pointer = (NATIVE_CHAR *) data_space; + source_ptr = (u8 *) internal_obj->string.pointer; break; @@ -113,7 +114,7 @@ length = internal_obj->buffer.length; external_obj->buffer.length = internal_obj->buffer.length; external_obj->buffer.pointer = data_space; - source_ptr = (char *) internal_obj->buffer.pointer; + source_ptr = (u8 *) internal_obj->buffer.pointer; break; @@ -132,7 +133,7 @@ */ external_obj->type = ACPI_TYPE_ANY; - external_obj->reference.handle = internal_obj->reference.nte; + external_obj->reference.handle = internal_obj->reference.node; break; @@ -142,10 +143,10 @@ internal_obj->processor.proc_id; external_obj->processor.pblk_address = - internal_obj->processor.pblk_address; + internal_obj->processor.address; external_obj->processor.pblk_length = - internal_obj->processor.pblk_length; + internal_obj->processor.length; break; case ACPI_TYPE_POWER: @@ -200,7 +201,7 @@ ACPI_STATUS acpi_cm_build_external_package_object ( - ACPI_OBJECT_INTERNAL *internal_obj, + ACPI_OPERAND_OBJECT *internal_obj, u8 *buffer, u32 *space_used) { @@ -211,7 +212,7 @@ u32 length = 0; u32 this_index; u32 object_space; - ACPI_OBJECT_INTERNAL *this_internal_obj; + ACPI_OPERAND_OBJECT *this_internal_obj; ACPI_OBJECT *this_external_obj; PKG_SEARCH_INFO *level_ptr; @@ -256,7 +257,7 @@ while (1) { this_index = level_ptr->index; this_internal_obj = - (ACPI_OBJECT_INTERNAL *) + (ACPI_OPERAND_OBJECT *) level_ptr->internal_obj->package.elements[this_index]; this_external_obj = (ACPI_OBJECT *) @@ -264,10 +265,11 @@ /* - * Check for 1) Null object -- OK, this can happen if package + * Check for + * 1) Null object -- OK, this can happen if package * element is never initialized - * 2) Not an internal object - can be an NTE instead - * 3) Any internal object other than a package. + * 2) Not an internal object - can be Node instead + * 3) Any internal object other than a package. * * The more complex package case is handled later */ @@ -367,8 +369,6 @@ level_ptr->index = 0; } } - - return (AE_OK); } @@ -388,7 +388,7 @@ ACPI_STATUS acpi_cm_build_external_object ( - ACPI_OBJECT_INTERNAL *internal_obj, + ACPI_OPERAND_OBJECT *internal_obj, ACPI_BUFFER *ret_buffer) { ACPI_STATUS status; @@ -446,7 +446,7 @@ ACPI_STATUS acpi_cm_build_internal_simple_object ( ACPI_OBJECT *external_obj, - ACPI_OBJECT_INTERNAL *internal_obj) + ACPI_OPERAND_OBJECT *internal_obj) { @@ -508,18 +508,17 @@ ACPI_STATUS acpi_cm_build_internal_package_object ( - ACPI_OBJECT_INTERNAL *internal_obj, + ACPI_OPERAND_OBJECT *internal_obj, u8 *buffer, u32 *space_used) { u8 *free_space; ACPI_OBJECT *external_obj; u32 current_depth = 0; - ACPI_STATUS status = AE_OK; u32 length = 0; u32 this_index; u32 object_space = 0; - ACPI_OBJECT_INTERNAL *this_internal_obj; + ACPI_OPERAND_OBJECT *this_internal_obj; ACPI_OBJECT *this_external_obj; PKG_SEARCH_INFO *level_ptr; @@ -562,7 +561,7 @@ while (1) { this_index = level_ptr->index; - this_internal_obj = (ACPI_OBJECT_INTERNAL *) + this_internal_obj = (ACPI_OPERAND_OBJECT *) &level_ptr->internal_obj->package.elements[this_index]; this_external_obj = (ACPI_OBJECT *) @@ -605,17 +604,6 @@ } /* if object is a package */ else { -/* Status = Acpi_cm_build_simple_object(This_internal_obj, - This_external_obj, Free_space, - &Object_space); -*/ - if (status != AE_OK) { - /* - * Failure get out - */ - return (status); - } - free_space += object_space; length += object_space; @@ -651,13 +639,6 @@ } } /* else object is NOT a package */ } /* while (1) */ - - - /* - * We'll never get here, but the compiler whines about - * return value - */ - return (AE_OK); } @@ -677,7 +658,7 @@ ACPI_STATUS acpi_cm_build_internal_object ( ACPI_OBJECT *external_obj, - ACPI_OBJECT_INTERNAL *internal_obj) + ACPI_OPERAND_OBJECT *internal_obj) { ACPI_STATUS status; diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/common/cmdebug.c linux/drivers/acpi/common/cmdebug.c --- v2.4.0-test8/linux/drivers/acpi/common/cmdebug.c Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/common/cmdebug.c Fri Sep 15 14:30:29 2000 @@ -1,7 +1,7 @@ - /****************************************************************************** * * Module Name: cmdebug - Debug print routines + * $Revision: 60 $ * *****************************************************************************/ @@ -27,7 +27,7 @@ #include "acpi.h" #define _COMPONENT MISCELLANEOUS - MODULE_NAME ("cmdebug"); + MODULE_NAME ("cmdebug") /***************************************************************************** @@ -41,16 +41,16 @@ ****************************************************************************/ -s32 +u32 get_debug_level (void) { - return acpi_dbg_level; + return (acpi_dbg_level); } void set_debug_level ( - s32 new_debug_level) + u32 new_debug_level) { acpi_dbg_level = new_debug_level; @@ -75,10 +75,10 @@ void function_trace ( - char *module_name, - s32 line_number, - s32 component_id, - char *function_name) + NATIVE_CHAR *module_name, + u32 line_number, + u32 component_id, + NATIVE_CHAR *function_name) { acpi_gbl_nesting_level++; @@ -109,10 +109,10 @@ void function_trace_ptr ( - char *module_name, - s32 line_number, - s32 component_id, - char *function_name, + NATIVE_CHAR *module_name, + u32 line_number, + u32 component_id, + NATIVE_CHAR *function_name, void *pointer) { @@ -142,11 +142,11 @@ void function_trace_str ( - char *module_name, - s32 line_number, - s32 component_id, - char *function_name, - char *string) + NATIVE_CHAR *module_name, + u32 line_number, + u32 component_id, + NATIVE_CHAR *function_name, + NATIVE_CHAR *string) { acpi_gbl_nesting_level++; @@ -175,16 +175,16 @@ void function_trace_u32 ( - char *module_name, - s32 line_number, - s32 component_id, - char *function_name, + NATIVE_CHAR *module_name, + u32 line_number, + u32 component_id, + NATIVE_CHAR *function_name, u32 integer) { acpi_gbl_nesting_level++; debug_print (module_name, line_number, component_id, TRACE_FUNCTIONS, - " %2.2ld Entered Function: %s, 0x%l_x\n", + " %2.2ld Entered Function: %s, 0x%lX\n", acpi_gbl_nesting_level, function_name, integer); } @@ -207,10 +207,10 @@ void function_exit ( - char *module_name, - s32 line_number, - s32 component_id, - char *function_name) + NATIVE_CHAR *module_name, + u32 line_number, + u32 component_id, + NATIVE_CHAR *function_name) { debug_print (module_name, line_number, component_id, TRACE_FUNCTIONS, @@ -240,30 +240,19 @@ void function_status_exit ( - char *module_name, - s32 line_number, - s32 component_id, - char *function_name, + NATIVE_CHAR *module_name, + u32 line_number, + u32 component_id, + NATIVE_CHAR *function_name, ACPI_STATUS status) { - if (status > ACPI_MAX_STATUS) { - debug_print (module_name, line_number, component_id, - TRACE_FUNCTIONS, - " %2.2ld Exiting Function: %s, [Unknown Status] 0x%X\n", - acpi_gbl_nesting_level, - function_name, - status); - } - - else { - debug_print (module_name, line_number, component_id, - TRACE_FUNCTIONS, - " %2.2ld Exiting Function: %s, %s\n", - acpi_gbl_nesting_level, - function_name, - acpi_cm_format_exception (status)); - } + debug_print (module_name, line_number, component_id, + TRACE_FUNCTIONS, + " %2.2ld Exiting Function: %s, %s\n", + acpi_gbl_nesting_level, + function_name, + acpi_cm_format_exception (status)); acpi_gbl_nesting_level--; } @@ -288,10 +277,10 @@ void function_value_exit ( - char *module_name, - s32 line_number, - s32 component_id, - char *function_name, + NATIVE_CHAR *module_name, + u32 line_number, + u32 component_id, + NATIVE_CHAR *function_name, NATIVE_UINT value) { @@ -322,11 +311,11 @@ void function_ptr_exit ( - char *module_name, - s32 line_number, - s32 component_id, - char *function_name, - char *ptr) + NATIVE_CHAR *module_name, + u32 line_number, + u32 component_id, + NATIVE_CHAR *function_name, + u8 *ptr) { debug_print (module_name, line_number, component_id, TRACE_FUNCTIONS, @@ -357,11 +346,11 @@ void debug_print ( - char *module_name, - s32 line_number, - s32 component_id, - s32 print_level, - char *format, + NATIVE_CHAR *module_name, + u32 line_number, + u32 component_id, + u32 print_level, + NATIVE_CHAR *format, ...) { va_list args; @@ -397,8 +386,8 @@ void debug_print_prefix ( - char *module_name, - s32 line_number) + NATIVE_CHAR *module_name, + u32 line_number) { @@ -421,7 +410,7 @@ void debug_print_raw ( - char *format, + NATIVE_CHAR *format, ...) { va_list args; @@ -451,10 +440,10 @@ void acpi_cm_dump_buffer ( - char *buffer, + u8 *buffer, u32 count, u32 display, - s32 component_id) + u32 component_id) { u32 i = 0; u32 j; @@ -477,7 +466,7 @@ while (i < count) { /* Print current offset */ - acpi_os_printf ("%05_x ", i); + acpi_os_printf ("%05X ", i); /* Print 16 hex chars */ @@ -488,7 +477,7 @@ return; } - /* Make sure that the char doesn't get sign-extended! */ + /* Make sure that the s8 doesn't get sign-extended! */ switch (display) { @@ -496,7 +485,7 @@ default: - acpi_os_printf ("%02_x ", + acpi_os_printf ("%02X ", *((u8 *) &buffer[i + j])); j += 1; break; @@ -506,7 +495,7 @@ MOVE_UNALIGNED16_TO_32 (&temp32, &buffer[i + j]); - acpi_os_printf ("%04_x ", temp32); + acpi_os_printf ("%04X ", temp32); j += 2; break; @@ -515,7 +504,7 @@ MOVE_UNALIGNED32_TO_32 (&temp32, &buffer[i + j]); - acpi_os_printf ("%08_x ", temp32); + acpi_os_printf ("%08X ", temp32); j += 4; break; @@ -524,11 +513,11 @@ MOVE_UNALIGNED32_TO_32 (&temp32, &buffer[i + j]); - acpi_os_printf ("%08_x", temp32); + acpi_os_printf ("%08X", temp32); MOVE_UNALIGNED32_TO_32 (&temp32, &buffer[i + j + 4]); - acpi_os_printf ("%08_x ", temp32); + acpi_os_printf ("%08X ", temp32); j += 8; break; } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/common/cmdelete.c linux/drivers/acpi/common/cmdelete.c --- v2.4.0-test8/linux/drivers/acpi/common/cmdelete.c Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/common/cmdelete.c Fri Sep 15 14:30:29 2000 @@ -1,7 +1,7 @@ - /****************************************************************************** * * Module Name: cmdelete - object deletion and reference count utilities + * $Revision: 53 $ * *****************************************************************************/ @@ -25,13 +25,13 @@ #include "acpi.h" -#include "interp.h" -#include "namesp.h" -#include "tables.h" -#include "parser.h" +#include "acinterp.h" +#include "acnamesp.h" +#include "actables.h" +#include "acparser.h" #define _COMPONENT MISCELLANEOUS - MODULE_NAME ("cmdelete"); + MODULE_NAME ("cmdelete") /****************************************************************************** @@ -49,7 +49,7 @@ void acpi_cm_delete_internal_obj ( - ACPI_OBJECT_INTERNAL *object) + ACPI_OPERAND_OBJECT *object) { void *obj_pointer = NULL; @@ -110,14 +110,7 @@ case ACPI_TYPE_METHOD: - /* Delete parse tree if it exists */ - - if (object->method.parser_op) { - acpi_ps_delete_parse_tree (object->method.parser_op); - object->method.parser_op = NULL; - } - - /* Delete semaphore if it exists */ + /* Delete the method semaphore if it exists */ if (object->method.semaphore) { acpi_os_delete_semaphore (object->method.semaphore); @@ -146,7 +139,7 @@ /* Only delete the object if it was dynamically allocated */ - if (!(object->common.flags & AO_STATIC_ALLOCATION)) { + if (!(object->common.flags & AOPOBJ_STATIC_ALLOCATION)) { acpi_cm_delete_object_desc (object); } @@ -170,9 +163,9 @@ ACPI_STATUS acpi_cm_delete_internal_object_list ( - ACPI_OBJECT_INTERNAL **obj_list) + ACPI_OPERAND_OBJECT **obj_list) { - ACPI_OBJECT_INTERNAL **internal_obj; + ACPI_OPERAND_OBJECT **internal_obj; /* Walk the null-terminated internal list */ @@ -220,8 +213,8 @@ void acpi_cm_update_ref_count ( - ACPI_OBJECT_INTERNAL *object, - s32 action) + ACPI_OPERAND_OBJECT *object, + u32 action) { u16 count; u16 new_count; @@ -308,23 +301,23 @@ * DESCRIPTION: Increment the object reference count * * Object references are incremented when: - * 1) An object is added as a value in an Name Table Entry (NTE) + * 1) An object is attached to a Node (namespace object) * 2) An object is copied (all subobjects must be incremented) * * Object references are decremented when: - * 1) An object is removed from an NTE + * 1) An object is detached from an Node * ******************************************************************************/ ACPI_STATUS acpi_cm_update_object_reference ( - ACPI_OBJECT_INTERNAL *object, + ACPI_OPERAND_OBJECT *object, u16 action) { ACPI_STATUS status; u32 i; - ACPI_OBJECT_INTERNAL *next; - ACPI_OBJECT_INTERNAL *new; + ACPI_OPERAND_OBJECT *next; + ACPI_OPERAND_OBJECT *new; ACPI_GENERIC_STATE *state_list = NULL; ACPI_GENERIC_STATE *state; @@ -381,9 +374,9 @@ /* Must walk list of address handlers */ - next = object->addr_handler.link; + next = object->addr_handler.next; while (next) { - new = next->addr_handler.link; + new = next->addr_handler.next; acpi_cm_update_ref_count (next, action); next = new; @@ -512,7 +505,7 @@ void acpi_cm_add_reference ( - ACPI_OBJECT_INTERNAL *object) + ACPI_OPERAND_OBJECT *object) { @@ -549,7 +542,7 @@ void acpi_cm_remove_reference ( - ACPI_OBJECT_INTERNAL *object) + ACPI_OPERAND_OBJECT *object) { diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/common/cmeval.c linux/drivers/acpi/common/cmeval.c --- v2.4.0-test8/linux/drivers/acpi/common/cmeval.c Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/common/cmeval.c Fri Sep 15 14:30:29 2000 @@ -1,7 +1,7 @@ - /****************************************************************************** * * Module Name: cmeval - Object evaluation + * $Revision: 14 $ * *****************************************************************************/ @@ -25,19 +25,19 @@ #include "acpi.h" -#include "namesp.h" -#include "interp.h" +#include "acnamesp.h" +#include "acinterp.h" #define _COMPONENT MISCELLANEOUS - MODULE_NAME ("cmeval"); + MODULE_NAME ("cmeval") /**************************************************************************** * * FUNCTION: Acpi_cm_evaluate_numeric_object * - * PARAMETERS: Acpi_device - NTE for the device + * PARAMETERS: Device_node - Node for the device * *Address - Where the value is returned * * RETURN: Status @@ -51,17 +51,17 @@ ACPI_STATUS acpi_cm_evaluate_numeric_object ( - char *object_name, - ACPI_NAMED_OBJECT *acpi_device, + NATIVE_CHAR *object_name, + ACPI_NAMESPACE_NODE *device_node, u32 *address) { - ACPI_OBJECT_INTERNAL *obj_desc; + ACPI_OPERAND_OBJECT *obj_desc; ACPI_STATUS status; /* Execute the method */ - status = acpi_ns_evaluate_relative (acpi_device, object_name, NULL, &obj_desc); + status = acpi_ns_evaluate_relative (device_node, object_name, NULL, &obj_desc); if (ACPI_FAILURE (status)) { return (status); @@ -99,7 +99,7 @@ * * FUNCTION: Acpi_cm_execute_HID * - * PARAMETERS: Acpi_device - NTE for the device + * PARAMETERS: Device_node - Node for the device * *Hid - Where the HID is returned * * RETURN: Status @@ -113,16 +113,16 @@ ACPI_STATUS acpi_cm_execute_HID ( - ACPI_NAMED_OBJECT *acpi_device, + ACPI_NAMESPACE_NODE *device_node, DEVICE_ID *hid) { - ACPI_OBJECT_INTERNAL *obj_desc; + ACPI_OPERAND_OBJECT *obj_desc; ACPI_STATUS status; /* Execute the method */ - status = acpi_ns_evaluate_relative (acpi_device, + status = acpi_ns_evaluate_relative (device_node, METHOD_NAME__HID, NULL, &obj_desc); if (ACPI_FAILURE (status)) { @@ -176,7 +176,7 @@ * * FUNCTION: Acpi_cm_execute_UID * - * PARAMETERS: Acpi_device - NTE for the device + * PARAMETERS: Device_node - Node for the device * *Uid - Where the UID is returned * * RETURN: Status @@ -190,16 +190,16 @@ ACPI_STATUS acpi_cm_execute_UID ( - ACPI_NAMED_OBJECT *acpi_device, + ACPI_NAMESPACE_NODE *device_node, DEVICE_ID *uid) { - ACPI_OBJECT_INTERNAL *obj_desc; + ACPI_OPERAND_OBJECT *obj_desc; ACPI_STATUS status; /* Execute the method */ - status = acpi_ns_evaluate_relative (acpi_device, + status = acpi_ns_evaluate_relative (device_node, METHOD_NAME__UID, NULL, &obj_desc); if (ACPI_FAILURE (status)) { @@ -251,7 +251,7 @@ * * FUNCTION: Acpi_cm_execute_STA * - * PARAMETERS: Acpi_device - NTE for the device + * PARAMETERS: Device_node - Node for the device * *Flags - Where the status flags are returned * * RETURN: Status @@ -265,16 +265,16 @@ ACPI_STATUS acpi_cm_execute_STA ( - ACPI_NAMED_OBJECT *acpi_device, + ACPI_NAMESPACE_NODE *device_node, u32 *flags) { - ACPI_OBJECT_INTERNAL *obj_desc; + ACPI_OPERAND_OBJECT *obj_desc; ACPI_STATUS status; /* Execute the method */ - status = acpi_ns_evaluate_relative (acpi_device, + status = acpi_ns_evaluate_relative (device_node, METHOD_NAME__STA, NULL, &obj_desc); if (ACPI_FAILURE (status)) { diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/common/cmglobal.c linux/drivers/acpi/common/cmglobal.c --- v2.4.0-test8/linux/drivers/acpi/common/cmglobal.c Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/common/cmglobal.c Fri Sep 15 14:30:29 2000 @@ -1,7 +1,7 @@ - /****************************************************************************** * * Module Name: cmglobal - Global variables for the ACPI subsystem + * $Revision: 99 $ * *****************************************************************************/ @@ -26,13 +26,13 @@ #define DEFINE_ACPI_GLOBALS #include "acpi.h" -#include "events.h" -#include "namesp.h" -#include "interp.h" +#include "acevents.h" +#include "acnamesp.h" +#include "acinterp.h" #define _COMPONENT MISCELLANEOUS - MODULE_NAME ("cmglobal"); + MODULE_NAME ("cmglobal") /****************************************************************************** @@ -126,31 +126,25 @@ NSP_NEWSCOPE | NSP_LOCAL, /* 13 Thermal */ NSP_NORMAL, /* 14 Buffer_field */ NSP_NORMAL, /* 15 Ddb_handle */ - NSP_NORMAL, /* 16 reserved */ - NSP_NORMAL, /* 17 reserved */ - NSP_NORMAL, /* 18 reserved */ - NSP_NORMAL, /* 19 reserved */ - NSP_NORMAL, /* 20 reserved */ - NSP_NORMAL, /* 21 reserved */ - NSP_NORMAL, /* 22 reserved */ - NSP_NORMAL, /* 23 reserved */ - NSP_NORMAL, /* 24 reserved */ - NSP_NORMAL, /* 25 Def_field */ - NSP_NORMAL, /* 26 Bank_field */ - NSP_NORMAL, /* 27 Index_field */ - NSP_NORMAL, /* 28 Def_field_defn */ - NSP_NORMAL, /* 29 Bank_field_defn */ - NSP_NORMAL, /* 30 Index_field_defn */ - NSP_NORMAL, /* 31 If */ - NSP_NORMAL, /* 32 Else */ - NSP_NORMAL, /* 33 While */ - NSP_NEWSCOPE, /* 34 Scope */ - NSP_LOCAL, /* 35 Def_any */ - NSP_NORMAL, /* 36 Reference */ - NSP_NORMAL, /* 37 Alias */ - NSP_NORMAL, /* 38 Notify */ - NSP_NORMAL, /* 39 Address Handler */ - NSP_NORMAL /* 40 Invalid */ + NSP_NORMAL, /* 16 Debug Object */ + NSP_NORMAL, /* 17 Def_field */ + NSP_NORMAL, /* 18 Bank_field */ + NSP_NORMAL, /* 19 Index_field */ + NSP_NORMAL, /* 20 Reference */ + NSP_NORMAL, /* 21 Alias */ + NSP_NORMAL, /* 22 Notify */ + NSP_NORMAL, /* 23 Address Handler */ + NSP_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_NORMAL /* 34 Invalid */ }; @@ -204,11 +198,11 @@ if ((type < INTERNAL_TYPE_BEGIN) || (type > INTERNAL_TYPE_MAX)) { - return FALSE; + return (FALSE); } } - return TRUE; + return (TRUE); } @@ -224,16 +218,60 @@ * ****************************************************************************/ -char * +NATIVE_CHAR * acpi_cm_format_exception ( ACPI_STATUS status) { + NATIVE_CHAR *exception = "UNKNOWN_STATUS"; + ACPI_STATUS sub_status; + + + sub_status = (status & ~AE_CODE_MASK); + - if (status > ACPI_MAX_STATUS) { - return "UNKNOWN_STATUS"; + switch (status & AE_CODE_MASK) + { + case AE_CODE_ENVIRONMENTAL: + + if (sub_status <= AE_CODE_ENV_MAX) { + exception = acpi_gbl_exception_names_env [sub_status]; + } + break; + + case AE_CODE_PROGRAMMER: + + if (sub_status <= AE_CODE_PGM_MAX) { + exception = acpi_gbl_exception_names_pgm [sub_status -1]; + } + break; + + case AE_CODE_ACPI_TABLES: + + if (sub_status <= AE_CODE_TBL_MAX) { + exception = acpi_gbl_exception_names_tbl [sub_status -1]; + } + break; + + case AE_CODE_AML: + + if (sub_status <= AE_CODE_AML_MAX) { + exception = acpi_gbl_exception_names_aml [sub_status -1]; + } + break; + + case AE_CODE_CONTROL: + + if (sub_status <= AE_CODE_CTRL_MAX) { + exception = acpi_gbl_exception_names_ctrl [sub_status -1]; + } + break; + + default: + break; } - return (acpi_gbl_exception_names [status]); + + return (exception); } @@ -389,6 +427,11 @@ acpi_gbl_parse_cache_requests = 0; acpi_gbl_parse_cache_hits = 0; + acpi_gbl_ext_parse_cache = NULL; + acpi_gbl_ext_parse_cache_depth = 0; + acpi_gbl_ext_parse_cache_requests = 0; + acpi_gbl_ext_parse_cache_hits = 0; + acpi_gbl_object_cache = NULL; acpi_gbl_object_cache_depth = 0; acpi_gbl_object_cache_requests = 0; @@ -402,7 +445,7 @@ /* Interpreter */ acpi_gbl_buf_seq = 0; - acpi_gbl_named_object_err = FALSE; + acpi_gbl_node_err = FALSE; /* Parser */ @@ -418,18 +461,15 @@ /* Namespace */ - acpi_gbl_root_name_table.next_table = NULL; - acpi_gbl_root_name_table.parent_entry = NULL; - acpi_gbl_root_name_table.parent_table = NULL; - - acpi_gbl_root_object = acpi_gbl_root_name_table.entries; - - acpi_gbl_root_object->name = ACPI_ROOT_NAME; - acpi_gbl_root_object->data_type = ACPI_DESC_TYPE_NAMED; - acpi_gbl_root_object->type = ACPI_TYPE_ANY; - acpi_gbl_root_object->this_index = 0; - acpi_gbl_root_object->child_table = NULL; - acpi_gbl_root_object->object = NULL; + acpi_gbl_root_node = NULL; + + acpi_gbl_root_node_struct.name = ACPI_ROOT_NAME; + acpi_gbl_root_node_struct.data_type = ACPI_DESC_TYPE_NAMED; + acpi_gbl_root_node_struct.type = ACPI_TYPE_ANY; + acpi_gbl_root_node_struct.child = NULL; + acpi_gbl_root_node_struct.peer = NULL; + acpi_gbl_root_node_struct.object = NULL; + acpi_gbl_root_node_struct.flags = ANOBJ_END_OF_PEER_LIST; /* Memory allocation metrics - compiled out in non-debug mode. */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/common/cminit.c linux/drivers/acpi/common/cminit.c --- v2.4.0-test8/linux/drivers/acpi/common/cminit.c Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/common/cminit.c Fri Sep 15 14:30:29 2000 @@ -1,7 +1,7 @@ - /****************************************************************************** * * Module Name: cminit - Common ACPI subsystem initialization + * $Revision: 79 $ * *****************************************************************************/ @@ -25,14 +25,14 @@ #include "acpi.h" -#include "hardware.h" -#include "namesp.h" -#include "events.h" -#include "parser.h" -#include "dispatch.h" +#include "achware.h" +#include "acnamesp.h" +#include "acevents.h" +#include "acparser.h" +#include "acdispat.h" #define _COMPONENT MISCELLANEOUS - MODULE_NAME ("cminit"); + MODULE_NAME ("cminit") /******************************************************************************* @@ -52,7 +52,7 @@ void acpi_cm_facp_register_error ( - char *register_name, + NATIVE_CHAR *register_name, u32 value) { @@ -77,7 +77,7 @@ acpi_cm_hardware_initialize (void) { ACPI_STATUS status = AE_OK; - s32 index; + u32 index; /* Are we running on the actual hardware */ @@ -351,8 +351,9 @@ acpi_ps_delete_parse_cache (); /* Debug only - display leftover memory allocation, if any */ - +#ifdef ENABLE_DEBUGGER acpi_cm_dump_current_allocations (ACPI_UINT32_MAX, NULL); +#endif BREAKPOINT3; diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/common/cmobject.c linux/drivers/acpi/common/cmobject.c --- v2.4.0-test8/linux/drivers/acpi/common/cmobject.c Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/common/cmobject.c Fri Sep 15 14:30:29 2000 @@ -1,7 +1,7 @@ - /****************************************************************************** * * Module Name: cmobject - ACPI object create/delete/size/cache routines + * $Revision: 27 $ * *****************************************************************************/ @@ -25,14 +25,14 @@ #include "acpi.h" -#include "interp.h" -#include "namesp.h" -#include "tables.h" +#include "acinterp.h" +#include "acnamesp.h" +#include "actables.h" #include "amlcode.h" #define _COMPONENT MISCELLANEOUS - MODULE_NAME ("cmobject"); + MODULE_NAME ("cmobject") /****************************************************************************** @@ -57,14 +57,14 @@ * ******************************************************************************/ -ACPI_OBJECT_INTERNAL * +ACPI_OPERAND_OBJECT * _cm_create_internal_object ( - char *module_name, - s32 line_number, - s32 component_id, + NATIVE_CHAR *module_name, + u32 line_number, + u32 component_id, OBJECT_TYPE_INTERNAL type) { - ACPI_OBJECT_INTERNAL *object; + ACPI_OPERAND_OBJECT *object; /* Allocate the raw object descriptor */ @@ -79,7 +79,6 @@ /* Save the object type in the object descriptor */ object->common.type = type; - object->common.size = (u8) sizeof (ACPI_OBJECT_INTERNAL); /* Init the reference count */ @@ -88,10 +87,6 @@ /* Any per-type initialization should go here */ - /* Memory allocation metrics - compiled out in non debug mode. */ - - INCREMENT_OBJECT_METRICS (sizeof (ACPI_OBJECT_INTERNAL)); - return (object); } @@ -102,7 +97,7 @@ * * PARAMETERS: Operand - Object to be validated * - * RETURN: Validate a pointer to be an ACPI_OBJECT_INTERNAL + * RETURN: Validate a pointer to be an ACPI_OPERAND_OBJECT * *****************************************************************************/ @@ -114,13 +109,13 @@ /* Check for a null pointer */ if (!object) { - return FALSE; + return (FALSE); } /* Check for a pointer within one of the ACPI tables */ if (acpi_tb_system_table_pointer (object)) { - return FALSE; + return (FALSE); } /* Check the descriptor type field */ @@ -131,13 +126,13 @@ - return FALSE; + return (FALSE); } - /* The object appears to be a valid ACPI_OBJECT_INTERNAL */ + /* The object appears to be a valid ACPI_OPERAND_OBJECT */ - return TRUE; + return (TRUE); } @@ -159,11 +154,11 @@ void * _cm_allocate_object_desc ( - char *module_name, - s32 line_number, - s32 component_id) + NATIVE_CHAR *module_name, + u32 line_number, + u32 component_id) { - ACPI_OBJECT_INTERNAL *object; + ACPI_OPERAND_OBJECT *object; acpi_cm_acquire_mutex (ACPI_MTX_CACHES); @@ -176,8 +171,8 @@ /* There is an object available, use it */ object = acpi_gbl_object_cache; - acpi_gbl_object_cache = object->common.next; - object->common.next = NULL; + acpi_gbl_object_cache = object->cache.next; + object->cache.next = NULL; acpi_gbl_object_cache_hits++; acpi_gbl_object_cache_depth--; @@ -192,9 +187,8 @@ /* Attempt to allocate new descriptor */ - object = _cm_callocate (sizeof (ACPI_OBJECT_INTERNAL), component_id, + object = _cm_callocate (sizeof (ACPI_OPERAND_OBJECT), component_id, module_name, line_number); - if (!object) { /* Allocation failed */ @@ -203,6 +197,10 @@ return (NULL); } + + /* Memory allocation metrics - compiled out in non debug mode. */ + + INCREMENT_OBJECT_METRICS (sizeof (ACPI_OPERAND_OBJECT)); } /* Mark the descriptor type */ @@ -227,19 +225,19 @@ void acpi_cm_delete_object_desc ( - ACPI_OBJECT_INTERNAL *object) + ACPI_OPERAND_OBJECT *object) { - /* Object must be an ACPI_OBJECT_INTERNAL */ + /* Make sure that the object isn't already in the cache */ - if (object->common.data_type != ACPI_DESC_TYPE_INTERNAL) { + if (object->common.data_type == (ACPI_DESC_TYPE_INTERNAL | ACPI_CACHED_OBJECT)) { return; } - /* Make sure that the object isn't already in the cache */ + /* Object must be an ACPI_OPERAND_OBJECT */ - if (object->common.next) { + if (object->common.data_type != ACPI_DESC_TYPE_INTERNAL) { return; } @@ -251,7 +249,7 @@ * Memory allocation metrics. Call the macro here since we only * care about dynamically allocated objects. */ - DECREMENT_OBJECT_METRICS (acpi_gbl_object_cache->common.size); + DECREMENT_OBJECT_METRICS (sizeof (ACPI_OPERAND_OBJECT)); acpi_cm_free (object); return; @@ -261,17 +259,18 @@ /* Clear the entire object. This is important! */ - MEMSET (object, 0, sizeof (ACPI_OBJECT_INTERNAL)); - object->common.data_type = ACPI_DESC_TYPE_INTERNAL; + MEMSET (object, 0, sizeof (ACPI_OPERAND_OBJECT)); + object->common.data_type = ACPI_DESC_TYPE_INTERNAL | ACPI_CACHED_OBJECT; /* Put the object at the head of the global cache list */ - object->common.next = acpi_gbl_object_cache; + object->cache.next = acpi_gbl_object_cache; acpi_gbl_object_cache = object; acpi_gbl_object_cache_depth++; acpi_cm_release_mutex (ACPI_MTX_CACHES); + return; } @@ -292,7 +291,7 @@ acpi_cm_delete_object_cache ( void) { - ACPI_OBJECT_INTERNAL *next; + ACPI_OPERAND_OBJECT *next; /* Traverse the global cache list */ @@ -300,17 +299,18 @@ while (acpi_gbl_object_cache) { /* Delete one cached state object */ - next = acpi_gbl_object_cache->common.next; - acpi_gbl_object_cache->common.next = NULL; + next = acpi_gbl_object_cache->cache.next; + acpi_gbl_object_cache->cache.next = NULL; /* * Memory allocation metrics. Call the macro here since we only * care about dynamically allocated objects. */ - DECREMENT_OBJECT_METRICS (acpi_gbl_object_cache->common.size); + DECREMENT_OBJECT_METRICS (sizeof (ACPI_OPERAND_OBJECT)); acpi_cm_free (acpi_gbl_object_cache); acpi_gbl_object_cache = next; + acpi_gbl_object_cache_depth--; } return; @@ -333,7 +333,7 @@ void acpi_cm_init_static_object ( - ACPI_OBJECT_INTERNAL *obj_desc) + ACPI_OPERAND_OBJECT *obj_desc) { @@ -345,12 +345,12 @@ /* * Clear the entire descriptor */ - MEMSET ((void *) obj_desc, 0, sizeof (ACPI_OBJECT_INTERNAL)); + MEMSET ((void *) obj_desc, 0, sizeof (ACPI_OPERAND_OBJECT)); /* * Initialize the header fields - * 1) This is an ACPI_OBJECT_INTERNAL descriptor + * 1) This is an ACPI_OPERAND_OBJECT descriptor * 2) The size is the full object (worst case) * 3) The flags field indicates static allocation * 4) Reference count starts at one (not really necessary since the @@ -358,8 +358,7 @@ */ obj_desc->common.data_type = ACPI_DESC_TYPE_INTERNAL; - obj_desc->common.size = sizeof (ACPI_OBJECT_INTERNAL); - obj_desc->common.flags = AO_STATIC_ALLOCATION; + obj_desc->common.flags = AOPOBJ_STATIC_ALLOCATION; obj_desc->common.reference_count = 1; return; @@ -385,7 +384,7 @@ ACPI_STATUS acpi_cm_get_simple_object_size ( - ACPI_OBJECT_INTERNAL *internal_obj, + ACPI_OPERAND_OBJECT *internal_obj, u32 *obj_length) { u32 length; @@ -405,7 +404,7 @@ length = sizeof (ACPI_OBJECT); if (VALID_DESCRIPTOR_TYPE (internal_obj, ACPI_DESC_TYPE_NAMED)) { - /* Object is an NTE (reference), just return the length */ + /* Object is a named object (reference), just return the length */ *obj_length = (u32) ROUND_UP_TO_NATIVE_WORD (length); return (status); @@ -495,13 +494,13 @@ ACPI_STATUS acpi_cm_get_package_object_size ( - ACPI_OBJECT_INTERNAL *internal_obj, + ACPI_OPERAND_OBJECT *internal_obj, u32 *obj_length) { - ACPI_OBJECT_INTERNAL *this_internal_obj; - ACPI_OBJECT_INTERNAL *parent_obj[MAX_PACKAGE_DEPTH] = { 0,0,0,0,0 }; - ACPI_OBJECT_INTERNAL *this_parent; + ACPI_OPERAND_OBJECT *this_internal_obj; + ACPI_OPERAND_OBJECT *parent_obj[MAX_PACKAGE_DEPTH] = { 0,0,0,0,0 }; + ACPI_OPERAND_OBJECT *this_parent; u32 this_index; u32 index[MAX_PACKAGE_DEPTH] = { 0,0,0,0,0 }; u32 length = 0; @@ -537,7 +536,7 @@ status = acpi_cm_get_simple_object_size (this_internal_obj, &object_space); - if (status != AE_OK) { + if (ACPI_FAILURE (status)) { return (status); } @@ -603,8 +602,6 @@ } } } - - return (AE_OK); } @@ -624,7 +621,7 @@ ACPI_STATUS acpi_cm_get_object_size( - ACPI_OBJECT_INTERNAL *internal_obj, + ACPI_OPERAND_OBJECT *internal_obj, u32 *obj_length) { ACPI_STATUS status; @@ -642,7 +639,7 @@ acpi_cm_get_simple_object_size (internal_obj, obj_length); } - return status; + return (status); } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/common/cmutils.c linux/drivers/acpi/common/cmutils.c --- v2.4.0-test8/linux/drivers/acpi/common/cmutils.c Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/common/cmutils.c Fri Sep 15 14:30:29 2000 @@ -1,8 +1,9 @@ -/****************************************************************************** +/******************************************************************************* * * Module Name: cmutils - common utility procedures + * $Revision: 18 $ * - *****************************************************************************/ + ******************************************************************************/ /* * Copyright (C) 2000 R. Byron Moore @@ -24,19 +25,19 @@ #include "acpi.h" -#include "events.h" -#include "hardware.h" -#include "namesp.h" -#include "interp.h" +#include "acevents.h" +#include "achware.h" +#include "acnamesp.h" +#include "acinterp.h" #include "amlcode.h" -#include "debugger.h" +#include "acdebug.h" #define _COMPONENT MISCELLANEOUS - MODULE_NAME ("cmutils"); + MODULE_NAME ("cmutils") -/***************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_cm_valid_acpi_name * @@ -49,13 +50,13 @@ * 2) numeric * 3) underscore * - ****************************************************************************/ + ******************************************************************************/ u8 acpi_cm_valid_acpi_name ( u32 name) { - char *name_ptr = (char *) &name; + NATIVE_CHAR *name_ptr = (NATIVE_CHAR *) &name; u32 i; @@ -64,16 +65,16 @@ (name_ptr[i] >= 'A' && name_ptr[i] <= 'Z') || (name_ptr[i] >= '0' && name_ptr[i] <= '9'))) { - return FALSE; + return (FALSE); } } - return TRUE; + return (TRUE); } -/***************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_cm_valid_acpi_character * @@ -83,11 +84,11 @@ * * DESCRIPTION: Check for a printable character * - ****************************************************************************/ + ******************************************************************************/ u8 acpi_cm_valid_acpi_character ( - char character) + NATIVE_CHAR character) { return ((u8) ((character == '_') || @@ -96,7 +97,7 @@ } -/***************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_cm_mutex_initialize * @@ -106,7 +107,7 @@ * * DESCRIPTION: Create the system mutex objects. * - ****************************************************************************/ + ******************************************************************************/ ACPI_STATUS acpi_cm_mutex_initialize ( @@ -130,7 +131,7 @@ } -/***************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_cm_mutex_terminate * @@ -140,7 +141,7 @@ * * DESCRIPTION: Delete all of the system mutex objects. * - ****************************************************************************/ + ******************************************************************************/ void acpi_cm_mutex_terminate ( @@ -160,7 +161,7 @@ } -/***************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_cm_create_mutex * @@ -170,7 +171,7 @@ * * DESCRIPTION: Create a mutex object. * - ****************************************************************************/ + ******************************************************************************/ ACPI_STATUS acpi_cm_create_mutex ( @@ -195,7 +196,7 @@ } -/***************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_cm_delete_mutex * @@ -205,7 +206,7 @@ * * DESCRIPTION: Delete a mutex object. * - ****************************************************************************/ + ******************************************************************************/ ACPI_STATUS acpi_cm_delete_mutex ( @@ -228,7 +229,7 @@ } -/***************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_cm_acquire_mutex * @@ -238,7 +239,7 @@ * * DESCRIPTION: Acquire a mutex object. * - ****************************************************************************/ + ******************************************************************************/ ACPI_STATUS acpi_cm_acquire_mutex ( @@ -252,9 +253,8 @@ } - status = - acpi_os_wait_semaphore (acpi_gbl_acpi_mutex_info[mutex_id].mutex, - 1, WAIT_FOREVER); + status = acpi_os_wait_semaphore (acpi_gbl_acpi_mutex_info[mutex_id].mutex, + 1, WAIT_FOREVER); if (ACPI_SUCCESS (status)) { acpi_gbl_acpi_mutex_info[mutex_id].locked = TRUE; @@ -265,7 +265,7 @@ } -/***************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_cm_release_mutex * @@ -275,7 +275,7 @@ * * DESCRIPTION: Release a mutex object. * - ****************************************************************************/ + ******************************************************************************/ ACPI_STATUS acpi_cm_release_mutex ( @@ -291,14 +291,14 @@ acpi_gbl_acpi_mutex_info[mutex_id].locked = FALSE; /* Mark before unlocking */ - status = - acpi_os_signal_semaphore (acpi_gbl_acpi_mutex_info[mutex_id].mutex, 1); + status = acpi_os_signal_semaphore (acpi_gbl_acpi_mutex_info[mutex_id].mutex, 1); + return (status); } -/****************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_cm_create_update_state_and_push * @@ -314,7 +314,7 @@ ACPI_STATUS acpi_cm_create_update_state_and_push ( - ACPI_OBJECT_INTERNAL *object, + ACPI_OPERAND_OBJECT *object, u16 action, ACPI_GENERIC_STATE **state_list) { @@ -324,21 +324,21 @@ /* Ignore null objects; these are expected */ if (!object) { - return AE_OK; + return (AE_OK); } state = acpi_cm_create_update_state (object, action); if (!state) { - return AE_NO_MEMORY; + return (AE_NO_MEMORY); } acpi_cm_push_generic_state (state_list, state); - return AE_OK; + return (AE_OK); } -/****************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_cm_push_generic_state * @@ -365,7 +365,7 @@ } -/****************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_cm_pop_generic_state * @@ -397,7 +397,7 @@ } -/****************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_cm_create_generic_state * @@ -433,6 +433,7 @@ acpi_gbl_generic_state_cache_depth--; acpi_cm_release_mutex (ACPI_MTX_CACHES); + } else { @@ -446,18 +447,23 @@ /* Initialize */ if (state) { + /* Always zero out the object before init */ + + MEMSET (state, 0, sizeof (ACPI_GENERIC_STATE)); + state->common.data_type = ACPI_DESC_TYPE_STATE; } - return state; + return (state); } -/****************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_cm_create_update_state * - * PARAMETERS: Object - Initial Object to be installed in the state + * PARAMETERS: Object - Initial Object to be installed in the + * state * Action - Update action to be performed * * RETURN: Status @@ -470,7 +476,7 @@ ACPI_GENERIC_STATE * acpi_cm_create_update_state ( - ACPI_OBJECT_INTERNAL *object, + ACPI_OPERAND_OBJECT *object, u16 action) { ACPI_GENERIC_STATE *state; @@ -480,7 +486,7 @@ state = acpi_cm_create_generic_state (); if (!state) { - return NULL; + return (NULL); } /* Init fields specific to the update struct */ @@ -492,7 +498,7 @@ } -/****************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_cm_create_control_state * @@ -516,7 +522,7 @@ state = acpi_cm_create_generic_state (); if (!state) { - return NULL; + return (NULL); } @@ -528,7 +534,7 @@ } -/****************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_cm_delete_generic_state * @@ -575,7 +581,7 @@ } -/****************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_cm_delete_generic_state_cache * @@ -603,13 +609,14 @@ next = acpi_gbl_generic_state_cache->common.next; acpi_cm_free (acpi_gbl_generic_state_cache); acpi_gbl_generic_state_cache = next; + acpi_gbl_generic_state_cache_depth--; } return; } -/***************************************************************************** +/******************************************************************************* * * FUNCTION: _Report_error * @@ -622,14 +629,14 @@ * * DESCRIPTION: Print error message from KD table * - ****************************************************************************/ + ******************************************************************************/ void _report_error ( - char *module_name, - s32 line_number, - s32 component_id, - char *message) + NATIVE_CHAR *module_name, + u32 line_number, + u32 component_id, + NATIVE_CHAR *message) { debug_print (module_name, line_number, component_id, ACPI_ERROR, @@ -638,7 +645,7 @@ } -/***************************************************************************** +/******************************************************************************* * * FUNCTION: _Report_warning * @@ -651,14 +658,14 @@ * * DESCRIPTION: Print warning message from KD table * - ****************************************************************************/ + ******************************************************************************/ void _report_warning ( - char *module_name, - s32 line_number, - s32 component_id, - char *message) + NATIVE_CHAR *module_name, + u32 line_number, + u32 component_id, + NATIVE_CHAR *message) { debug_print (module_name, line_number, component_id, ACPI_WARN, @@ -667,35 +674,7 @@ } -/***************************************************************************** - * - * FUNCTION: _Report_success - * - * PARAMETERS: Module_name - Caller's module name (for error output) - * Line_number - Caller's line number (for error output) - * Component_id - Caller's component ID (for error output) - * Message - Error message to use on failure - * - * RETURN: None - * - * DESCRIPTION: Print warning message from KD table - * - ****************************************************************************/ - -void -_report_success ( - char *module_name, - s32 line_number, - s32 component_id, - char *message) -{ - - debug_print (module_name, line_number, component_id, ACPI_OK, - "*** Success: %s\n", message); -} - - -/***************************************************************************** +/******************************************************************************* * * FUNCTION: _Report_info * @@ -708,14 +687,14 @@ * * DESCRIPTION: Print information message from KD table * - ****************************************************************************/ + ******************************************************************************/ void _report_info ( - char *module_name, - s32 line_number, - s32 component_id, - char *message) + NATIVE_CHAR *module_name, + u32 line_number, + u32 component_id, + NATIVE_CHAR *message) { debug_print (module_name, line_number, component_id, ACPI_INFO, diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/common/cmxface.c linux/drivers/acpi/common/cmxface.c --- v2.4.0-test8/linux/drivers/acpi/common/cmxface.c Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/common/cmxface.c Fri Sep 15 14:30:29 2000 @@ -1,6 +1,7 @@ /****************************************************************************** * * Module Name: cmxface - External interfaces for "global" ACPI functions + * $Revision: 43 $ * *****************************************************************************/ @@ -24,16 +25,16 @@ #include "acpi.h" -#include "events.h" -#include "hardware.h" -#include "namesp.h" -#include "interp.h" +#include "acevents.h" +#include "achware.h" +#include "acnamesp.h" +#include "acinterp.h" #include "amlcode.h" -#include "debugger.h" +#include "acdebug.h" #define _COMPONENT MISCELLANEOUS - MODULE_NAME ("cmxface"); + MODULE_NAME ("cmxface") /******************************************************************************* @@ -77,6 +78,8 @@ /* If configured, initialize the AML debugger */ + DEBUGGER_EXEC (acpi_db_initialize ()); + return (status); } @@ -100,7 +103,9 @@ /* Terminate the AML Debuger if present */ acpi_gbl_db_terminate_threads = TRUE; - acpi_cm_release_mutex (ACPI_MTX_DEBUG_CMD_READY); + + /* TBD: [Investigate] This is no longer needed?*/ +/* Acpi_cm_release_mutex (ACPI_MTX_DEBUG_CMD_READY); */ /* Shutdown and free all resources */ @@ -224,7 +229,7 @@ ACPI_BUFFER *out_buffer) { u32 length; - char *formatted_exception; + NATIVE_CHAR *formatted_exception; /* @@ -237,14 +242,7 @@ } - /* Exception must be within range */ - - if (exception > ACPI_MAX_STATUS) { - return (AE_BAD_PARAMETER); - } - - - /* Convert the exception code */ + /* Convert the exception code (Handles bad exception codes) */ formatted_exception = acpi_cm_format_exception (exception); diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/cpu.c linux/drivers/acpi/cpu.c --- v2.4.0-test8/linux/drivers/acpi/cpu.c Fri Jul 14 12:12:08 2000 +++ linux/drivers/acpi/cpu.c Fri Sep 15 14:30:29 2000 @@ -25,6 +25,9 @@ #include "acpi.h" #include "driver.h" +#define _COMPONENT OS_DEPENDENT + MODULE_NAME ("cpu") + unsigned long acpi_c2_exit_latency = ACPI_INFINITE; unsigned long acpi_c3_exit_latency = ACPI_INFINITE; unsigned long acpi_c2_enter_latency = ACPI_INFINITE; @@ -33,6 +36,7 @@ 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; /* * Clear busmaster activity flag @@ -101,10 +105,14 @@ /* * start from the previous sleep level.. */ - if (sleep_level == 1) + if (sleep_level == 1 + || acpi_max_c_state < 2) goto sleep1; - if (sleep_level == 2) + + if (sleep_level == 2 + || acpi_max_c_state < 3) goto sleep2; + sleep3: sleep_level = 3; if (!acpi_c3_tested) { @@ -193,7 +201,8 @@ acpi_clear_bm_activity(facp); continue; } - if (time > acpi_c3_enter_latency) + if (time > acpi_c3_enter_latency + && acpi_max_c_state >= 3) goto sleep3; } @@ -210,7 +219,8 @@ time = TIME_BEGIN(pm_tmr); safe_halt(); time = TIME_END(pm_tmr, time); - if (time > acpi_c2_enter_latency) + if (time > acpi_c2_enter_latency + && acpi_max_c_state >= 2) goto sleep2; } @@ -260,12 +270,19 @@ return AE_OK; if (lat[2].latency < MAX_CX_STATE_LATENCY) { - printk(KERN_INFO "ACPI: C2 supported\n"); + printk(KERN_INFO "ACPI: C2"); acpi_c2_exit_latency = lat[2].latency; - } - if (lat[3].latency < MAX_CX_STATE_LATENCY) { - printk(KERN_INFO "ACPI: C3 supported\n"); - acpi_c3_exit_latency = lat[3].latency; + acpi_max_c_state = 2; + + if (lat[3].latency < MAX_CX_STATE_LATENCY) { + printk(", C3 supported\n"); + acpi_c3_exit_latency = lat[3].latency; + acpi_max_c_state = 3; + } + else { + printk(" supported\n"); + } + } memset(throttle, 0, sizeof(throttle)); @@ -291,7 +308,7 @@ { acpi_walk_namespace(ACPI_TYPE_PROCESSOR, ACPI_ROOT_OBJECT, - ACPI_INT32_MAX, + ACPI_UINT32_MAX, acpi_find_cpu, NULL, NULL); diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/dispatcher/Makefile linux/drivers/acpi/dispatcher/Makefile --- v2.4.0-test8/linux/drivers/acpi/dispatcher/Makefile Wed Dec 31 16:00:00 1969 +++ linux/drivers/acpi/dispatcher/Makefile Fri Sep 15 18:21:43 2000 @@ -0,0 +1,28 @@ +# +# 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)) + +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: + $(RM) *.o diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/dispatcher/dsfield.c linux/drivers/acpi/dispatcher/dsfield.c --- v2.4.0-test8/linux/drivers/acpi/dispatcher/dsfield.c Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/dispatcher/dsfield.c Fri Sep 15 14:30:29 2000 @@ -1,7 +1,7 @@ - /****************************************************************************** * * Module Name: dsfield - Dispatcher field routines + * $Revision: 29 $ * *****************************************************************************/ @@ -26,13 +26,13 @@ #include "acpi.h" #include "amlcode.h" -#include "dispatch.h" -#include "interp.h" -#include "namesp.h" +#include "acdispat.h" +#include "acinterp.h" +#include "acnamesp.h" #define _COMPONENT DISPATCHER - MODULE_NAME ("dsfield"); + MODULE_NAME ("dsfield") /* @@ -46,28 +46,28 @@ #define FIELD_UPDATE_RULE_MASK 0x60 -/***************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_ds_create_field * * PARAMETERS: Op - Op containing the Field definition and args - * Region - NTE for the containing Operation Region + * Region_node - Object for the containing Operation Region * * RETURN: Status * * DESCRIPTION: Create a new field in the specified operation region * - ****************************************************************************/ + ******************************************************************************/ ACPI_STATUS acpi_ds_create_field ( - ACPI_GENERIC_OP *op, - ACPI_HANDLE region, + ACPI_PARSE_OBJECT *op, + ACPI_NAMESPACE_NODE *region_node, ACPI_WALK_STATE *walk_state) { ACPI_STATUS status = AE_AML_ERROR; - ACPI_GENERIC_OP *arg; - ACPI_NAMED_OBJECT *entry; + ACPI_PARSE_OBJECT *arg; + ACPI_NAMESPACE_NODE *node; u8 field_flags; u8 access_attribute = 0; u32 field_bit_position = 0; @@ -76,6 +76,16 @@ /* First arg is the name of the parent Op_region */ arg = op->value.arg; + if (!region_node) { + status = acpi_ns_lookup (walk_state->scope_info, arg->value.name, + ACPI_TYPE_REGION, IMODE_EXECUTE, + NS_SEARCH_PARENT, walk_state, + ®ion_node); + + if (ACPI_FAILURE (status)) { + return (status); + } + } /* Second arg is the field flags */ @@ -111,32 +121,29 @@ case AML_NAMEDFIELD_OP: status = acpi_ns_lookup (walk_state->scope_info, - (char *) &((ACPI_NAMED_OP *)arg)->name, + (NATIVE_CHAR *) &((ACPI_PARSE2_OBJECT *)arg)->name, INTERNAL_TYPE_DEF_FIELD, IMODE_LOAD_PASS1, NS_NO_UPSEARCH | NS_DONT_OPEN_SCOPE, - NULL, &entry); + NULL, &node); if (ACPI_FAILURE (status)) { return (status); } /* - * Initialize an object for the new NTE that is on + * Initialize an object for the new Node that is on * the object stack */ - status = acpi_aml_prep_def_field_value (entry, region, - field_flags, - access_attribute, - field_bit_position, - arg->value.size); + status = acpi_aml_prep_def_field_value (node, region_node, field_flags, + access_attribute, field_bit_position, arg->value.size); if (ACPI_FAILURE (status)) { return (status); } - /* Keep track of bit position for the *next* field */ + /* Keep track of bit position for *next* field */ field_bit_position += arg->value.size; break; @@ -149,29 +156,29 @@ } -/***************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_ds_create_bank_field * * PARAMETERS: Op - Op containing the Field definition and args - * Region - NTE for the containing Operation Region + * Region_node - Object for the containing Operation Region * * RETURN: Status * * DESCRIPTION: Create a new bank field in the specified operation region * - ****************************************************************************/ + ******************************************************************************/ ACPI_STATUS acpi_ds_create_bank_field ( - ACPI_GENERIC_OP *op, - ACPI_HANDLE region, + ACPI_PARSE_OBJECT *op, + ACPI_NAMESPACE_NODE *region_node, ACPI_WALK_STATE *walk_state) { ACPI_STATUS status = AE_AML_ERROR; - ACPI_GENERIC_OP *arg; - ACPI_NAMED_OBJECT *bank_reg; - ACPI_NAMED_OBJECT *entry; + ACPI_PARSE_OBJECT *arg; + ACPI_NAMESPACE_NODE *register_node; + ACPI_NAMESPACE_NODE *node; u32 bank_value; u8 field_flags; u8 access_attribute = 0; @@ -181,8 +188,18 @@ /* First arg is the name of the parent Op_region */ arg = op->value.arg; + if (!region_node) { + status = acpi_ns_lookup (walk_state->scope_info, arg->value.name, + ACPI_TYPE_REGION, IMODE_EXECUTE, + NS_SEARCH_PARENT, walk_state, + ®ion_node); + + if (ACPI_FAILURE (status)) { + return (status); + } + } - /* Socond arg is the Bank Register */ + /* Second arg is the Bank Register */ arg = arg->next; @@ -190,7 +207,7 @@ INTERNAL_TYPE_BANK_FIELD_DEFN, IMODE_LOAD_PASS1, NS_NO_UPSEARCH | NS_DONT_OPEN_SCOPE, - NULL, &bank_reg); + NULL, ®ister_node); if (ACPI_FAILURE (status)) { return (status); @@ -236,27 +253,24 @@ case AML_NAMEDFIELD_OP: status = acpi_ns_lookup (walk_state->scope_info, - (char *) &((ACPI_NAMED_OP *)arg)->name, + (NATIVE_CHAR *) &((ACPI_PARSE2_OBJECT *)arg)->name, INTERNAL_TYPE_DEF_FIELD, IMODE_LOAD_PASS1, NS_NO_UPSEARCH | NS_DONT_OPEN_SCOPE, - NULL, &entry); + NULL, &node); if (ACPI_FAILURE (status)) { return (status); } /* - * Initialize an object for the new NTE that is on + * Initialize an object for the new Node that is on * the object stack */ - status = acpi_aml_prep_bank_field_value (entry, region, - bank_reg, bank_value, - field_flags, - access_attribute, - field_bit_position, - arg->value.size); + status = acpi_aml_prep_bank_field_value (node, region_node, register_node, + bank_value, field_flags, access_attribute, + field_bit_position, arg->value.size); if (ACPI_FAILURE (status)) { return (status); @@ -276,30 +290,30 @@ } -/***************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_ds_create_index_field * * PARAMETERS: Op - Op containing the Field definition and args - * Region - NTE for the containing Operation Region + * Region_node - Object for the containing Operation Region * * RETURN: Status * * DESCRIPTION: Create a new index field in the specified operation region * - ****************************************************************************/ + ******************************************************************************/ ACPI_STATUS acpi_ds_create_index_field ( - ACPI_GENERIC_OP *op, - ACPI_HANDLE region, + ACPI_PARSE_OBJECT *op, + ACPI_HANDLE region_node, ACPI_WALK_STATE *walk_state) { ACPI_STATUS status; - ACPI_GENERIC_OP *arg; - ACPI_NAMED_OBJECT *entry; - ACPI_NAMED_OBJECT *index_reg; - ACPI_NAMED_OBJECT *data_reg; + ACPI_PARSE_OBJECT *arg; + ACPI_NAMESPACE_NODE *node; + ACPI_NAMESPACE_NODE *index_register_node; + ACPI_NAMESPACE_NODE *data_register_node; u8 field_flags; u8 access_attribute = 0; u32 field_bit_position = 0; @@ -312,7 +326,7 @@ status = acpi_ns_lookup (walk_state->scope_info, arg->value.string, ACPI_TYPE_ANY, IMODE_LOAD_PASS1, NS_NO_UPSEARCH | NS_DONT_OPEN_SCOPE, - NULL, &index_reg); + NULL, &index_register_node); if (ACPI_FAILURE (status)) { return (status); @@ -326,7 +340,7 @@ INTERNAL_TYPE_INDEX_FIELD_DEFN, IMODE_LOAD_PASS1, NS_NO_UPSEARCH | NS_DONT_OPEN_SCOPE, - NULL, &data_reg); + NULL, &data_register_node); if (ACPI_FAILURE (status)) { return (status); @@ -368,26 +382,24 @@ case AML_NAMEDFIELD_OP: status = acpi_ns_lookup (walk_state->scope_info, - (char *) &((ACPI_NAMED_OP *)arg)->name, + (NATIVE_CHAR *) &((ACPI_PARSE2_OBJECT *)arg)->name, INTERNAL_TYPE_INDEX_FIELD, IMODE_LOAD_PASS1, NS_NO_UPSEARCH | NS_DONT_OPEN_SCOPE, - NULL, &entry); + NULL, &node); if (ACPI_FAILURE (status)) { return (status); } /* - * Initialize an object for the new NTE that is on + * Initialize an object for the new Node that is on * the object stack */ - status = acpi_aml_prep_index_field_value (entry, index_reg, - data_reg, field_flags, - access_attribute, - field_bit_position, - arg->value.size); + status = acpi_aml_prep_index_field_value (node, index_register_node, data_register_node, + field_flags, access_attribute, + field_bit_position, arg->value.size); if (ACPI_FAILURE (status)) { return (status); diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/dispatcher/dsmethod.c linux/drivers/acpi/dispatcher/dsmethod.c --- v2.4.0-test8/linux/drivers/acpi/dispatcher/dsmethod.c Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/dispatcher/dsmethod.c Fri Sep 15 14:30:29 2000 @@ -1,7 +1,7 @@ - /****************************************************************************** * * Module Name: dsmethod - Parser/Interpreter interface - control method parsing + * $Revision: 52 $ * *****************************************************************************/ @@ -25,24 +25,24 @@ #include "acpi.h" -#include "parser.h" +#include "acparser.h" #include "amlcode.h" -#include "dispatch.h" -#include "interp.h" -#include "namesp.h" -#include "tables.h" -#include "debugger.h" +#include "acdispat.h" +#include "acinterp.h" +#include "acnamesp.h" +#include "actables.h" +#include "acdebug.h" #define _COMPONENT DISPATCHER - MODULE_NAME ("dsmethod"); + MODULE_NAME ("dsmethod") /******************************************************************************* * * FUNCTION: Acpi_ds_parse_method * - * PARAMETERS: Obj_handle - NTE of the method + * PARAMETERS: Obj_handle - Node of the method * Level - Current nesting level * Context - Points to a method counter * Return_value - Not used @@ -61,9 +61,9 @@ ACPI_HANDLE obj_handle) { ACPI_STATUS status; - ACPI_OBJECT_INTERNAL *obj_desc; - ACPI_GENERIC_OP *op; - ACPI_NAMED_OBJECT *entry; + ACPI_OPERAND_OBJECT *obj_desc; + ACPI_PARSE_OBJECT *op; + ACPI_NAMESPACE_NODE *node; ACPI_OWNER_ID owner_id; @@ -74,10 +74,10 @@ } - /* Extract the method object from the method NTE */ + /* Extract the method object from the method Node */ - entry = (ACPI_NAMED_OBJECT*) obj_handle; - obj_desc = entry->object; + node = (ACPI_NAMESPACE_NODE *) obj_handle; + obj_desc = node->object; if (!obj_desc) { return (AE_NULL_OBJECT); } @@ -87,8 +87,7 @@ if ((obj_desc->method.concurrency != INFINITE_CONCURRENCY) && (!obj_desc->method.semaphore)) { - status = acpi_os_create_semaphore (1, - obj_desc->method.concurrency, + status = acpi_os_create_semaphore (1,obj_desc->method.concurrency, &obj_desc->method.semaphore); if (ACPI_FAILURE (status)) { return (status); @@ -105,17 +104,17 @@ return (AE_NO_MEMORY); } - /* Init new op with the method name and pointer back to the NTE */ + /* Init new op with the method name and pointer back to the Node */ - acpi_ps_set_name (op, entry->name); - op->acpi_named_object = entry; + acpi_ps_set_name (op, node->name); + op->node = node; /* - * Parse the method, creating a parse tree. + * Parse the method, first pass * - * The parse also includes a first pass load of the - * namespace where newly declared named objects are + * The first pass load is + * where newly declared named objects are * added into the namespace. Actual evaluation of * the named objects (what would be called a "second * pass") happens during the actual execution of the @@ -124,7 +123,10 @@ */ status = acpi_ps_parse_aml (op, obj_desc->method.pcode, - obj_desc->method.pcode_length, 0); + obj_desc->method.pcode_length, + ACPI_PARSE_LOAD_PASS1 | ACPI_PARSE_DELETE_TREE, + node, NULL, NULL, + acpi_ds_load1_begin_op, acpi_ds_load1_end_op); if (ACPI_FAILURE (status)) { return (status); @@ -133,11 +135,13 @@ /* Get a new Owner_id for objects created by this method */ owner_id = acpi_cm_allocate_owner_id (OWNER_TYPE_METHOD); + obj_desc->method.owning_id = owner_id; /* Install the parsed tree in the method object */ + /* TBD: [Restructure] Obsolete field? */ + + acpi_ps_delete_parse_tree (op); - obj_desc->method.parser_op = op; - obj_desc->method.owning_id = owner_id; return (status); } @@ -147,7 +151,7 @@ * * FUNCTION: Acpi_ds_begin_method_execution * - * PARAMETERS: Method_entry - NTE of the method + * PARAMETERS: Method_node - Node of the method * Obj_desc - The method object * * RETURN: Status @@ -162,38 +166,31 @@ ACPI_STATUS acpi_ds_begin_method_execution ( - ACPI_NAMED_OBJECT *method_entry, - ACPI_OBJECT_INTERNAL *obj_desc) + ACPI_NAMESPACE_NODE *method_node, + ACPI_OPERAND_OBJECT *obj_desc) { ACPI_STATUS status = AE_OK; - if (!method_entry) { + if (!method_node) { return (AE_NULL_ENTRY); } - obj_desc = acpi_ns_get_attached_object (method_entry); + obj_desc = acpi_ns_get_attached_object (method_node); if (!obj_desc) { return (AE_NULL_OBJECT); } + /* - * Lock the parser while we check for and possibly parse the - * control method + * If there is a concurrency limit on this method, we need to + * obtain a unit from the method semaphore. This releases the + * interpreter if we block */ - acpi_cm_acquire_mutex (ACPI_MTX_PARSER); - - - /* If method is not parsed at this time, we must parse it first */ - - if (!obj_desc->method.parser_op) { - - status = acpi_ds_parse_method (method_entry); - if (ACPI_FAILURE (status)) { - acpi_cm_release_mutex (ACPI_MTX_PARSER); - return (status); - } + if (obj_desc->method.semaphore) { + status = acpi_aml_system_wait_semaphore (obj_desc->method.semaphore, + WAIT_FOREVER); } @@ -204,29 +201,10 @@ * the last thread completes execution of the method */ - ((ACPI_DEFERRED_OP *) obj_desc->method.parser_op)->thread_count++; - - /* - * Parsing is complete, we can unlock the parser. Parse tree - * cannot be deleted at least until this thread completes. - */ - - acpi_cm_release_mutex (ACPI_MTX_PARSER); - - /* - * If there is a concurrency limit on this method, we need to - * obtain a unit from the method semaphore. This releases the - * interpreter if we block - */ - - if (obj_desc->method.semaphore) { - status = acpi_aml_system_wait_semaphore (obj_desc->method.semaphore, - WAIT_FOREVER); - } + obj_desc->method.thread_count++; return (status); - } @@ -247,61 +225,76 @@ acpi_ds_call_control_method ( ACPI_WALK_LIST *walk_list, ACPI_WALK_STATE *this_walk_state, - ACPI_GENERIC_OP *op) + ACPI_PARSE_OBJECT *op) { ACPI_STATUS status; - ACPI_DEFERRED_OP *method; - ACPI_NAMED_OBJECT *method_entry; - ACPI_OBJECT_INTERNAL *obj_desc; + ACPI_NAMESPACE_NODE *method_node; + ACPI_OPERAND_OBJECT *obj_desc; ACPI_WALK_STATE *next_walk_state; + ACPI_PARSE_STATE *parser_state; u32 i; /* - * Prev_op points to the METHOD_CALL Op. - * Get the NTE entry (in the METHOD_CALL->NAME Op) and the - * corresponding METHOD Op + * Get the namespace entry for the control method we are about to call */ - method_entry = (this_walk_state->prev_op->value.arg)->acpi_named_object; - if (!method_entry) { + method_node = this_walk_state->method_call_node; + if (!method_node) { return (AE_NULL_ENTRY); } - obj_desc = acpi_ns_get_attached_object (method_entry); + obj_desc = acpi_ns_get_attached_object (method_node); if (!obj_desc) { return (AE_NULL_OBJECT); } - /* Parse method if necessary, wait on concurrency semaphore */ - status = acpi_ds_begin_method_execution (method_entry, obj_desc); + /* Init for new method, wait on concurrency semaphore */ + + status = acpi_ds_begin_method_execution (method_node, obj_desc); if (ACPI_FAILURE (status)) { return (status); } - /* Save the (current) Op for when this walk is restarted */ - this_walk_state->method_call_op = this_walk_state->prev_op; - this_walk_state->prev_op = op; - method = obj_desc->method.parser_op; + /* Create and initialize a new parser state */ + + parser_state = acpi_ps_create_state (obj_desc->method.pcode, + obj_desc->method.pcode_length); + if (!parser_state) { + return (AE_NO_MEMORY); + } + + acpi_ps_init_scope (parser_state, NULL); + parser_state->start_node = method_node; + /* Create a new state for the preempting walk */ next_walk_state = acpi_ds_create_walk_state (obj_desc->method.owning_id, - (ACPI_GENERIC_OP *) method, - obj_desc, walk_list); + NULL, obj_desc, walk_list); if (!next_walk_state) { + /* TBD: delete parser state */ + return (AE_NO_MEMORY); } + next_walk_state->walk_type = WALK_METHOD; + next_walk_state->method_node = method_node; + next_walk_state->parser_state = parser_state; + next_walk_state->parse_flags = this_walk_state->parse_flags; + next_walk_state->descending_callback = this_walk_state->descending_callback; + next_walk_state->ascending_callback = this_walk_state->ascending_callback; + /* The Next_op of the Next_walk will be the beginning of the method */ + /* TBD: [Restructure] -- obsolete? */ - next_walk_state->next_op = (ACPI_GENERIC_OP *) method; + next_walk_state->next_op = NULL; /* Open a new scope */ - status = acpi_ds_scope_stack_push (method_entry->child_table, + status = acpi_ds_scope_stack_push (method_node, ACPI_TYPE_METHOD, next_walk_state); if (ACPI_FAILURE (status)) { goto cleanup; @@ -316,11 +309,28 @@ */ status = acpi_ds_method_data_init_args (&this_walk_state->operands[0], - this_walk_state->num_operands); + this_walk_state->num_operands, + next_walk_state); if (ACPI_FAILURE (status)) { goto cleanup; } + + /* Create and init a Root Node */ + + op = acpi_ps_alloc_op (AML_SCOPE_OP); + if (!op) { + return (AE_NO_MEMORY); + } + + status = acpi_ps_parse_aml (op, obj_desc->method.pcode, + obj_desc->method.pcode_length, + ACPI_PARSE_LOAD_PASS1 | ACPI_PARSE_DELETE_TREE, + method_node, NULL, NULL, + acpi_ds_load1_begin_op, acpi_ds_load1_end_op); + acpi_ps_delete_parse_tree (op); + + /* * Delete the operands on the previous walkstate operand stack * (they were copied to new objects) @@ -328,6 +338,7 @@ for (i = 0; i < obj_desc->method.param_count; i++) { acpi_cm_remove_reference (this_walk_state->operands [i]); + this_walk_state->operands [i] = NULL; } /* Clear the operand stack */ @@ -364,30 +375,33 @@ ACPI_STATUS acpi_ds_restart_control_method ( ACPI_WALK_STATE *walk_state, - ACPI_OBJECT_INTERNAL *return_desc) + ACPI_OPERAND_OBJECT *return_desc) { ACPI_STATUS status; if (return_desc) { - /* - * Get the return value (if any) from the previous method. - * NULL if no return value - */ + if (walk_state->return_used) { + /* + * Get the return value (if any) from the previous method. + * NULL if no return value + */ + + status = acpi_ds_result_stack_push (return_desc, walk_state); + if (ACPI_FAILURE (status)) { + acpi_cm_remove_reference (return_desc); + return (status); + } + } - status = acpi_ds_result_stack_push (return_desc, walk_state); - if (ACPI_FAILURE (status)) { + else { + /* + * Delete the return value if it will not be used by the + * calling method + */ acpi_cm_remove_reference (return_desc); - return (status); } - /* - * Delete the return value if it will not be used by the - * calling method - */ - - acpi_ds_delete_result_if_not_used (walk_state->method_call_op, - return_desc, walk_state); } @@ -414,9 +428,8 @@ ACPI_WALK_STATE *walk_state) { ACPI_STATUS status; - ACPI_OBJECT_INTERNAL *obj_desc; - ACPI_DEFERRED_OP *op; - ACPI_NAMED_OBJECT *method_entry; + ACPI_OPERAND_OBJECT *obj_desc; + ACPI_NAMESPACE_NODE *method_node; /* The method object should be stored in the walk state */ @@ -438,66 +451,41 @@ acpi_cm_acquire_mutex (ACPI_MTX_PARSER); - /* - * The root of the method parse tree should be stored - * in the method object - */ - - op = obj_desc->method.parser_op; - if (!op) { - goto unlock_and_exit; - } /* Signal completion of the execution of this method if necessary */ if (walk_state->method_desc->method.semaphore) { status = acpi_os_signal_semaphore ( - walk_state->method_desc->method.semaphore, 1); + walk_state->method_desc->method.semaphore, 1); } /* Decrement the thread count on the method parse tree */ - op->thread_count--; - if (!op->thread_count) { + walk_state->method_desc->method.thread_count--; + if (!walk_state->method_desc->method.thread_count) { /* * There are no more threads executing this method. Perform * additional cleanup. * - * The method NTE is stored in the method Op + * The method Node is stored in the walk state */ - method_entry = op->acpi_named_object; - + method_node = walk_state->method_node; /* * Delete any namespace entries created immediately underneath * the method */ acpi_cm_acquire_mutex (ACPI_MTX_NAMESPACE); - if (method_entry->child_table) { - acpi_ns_delete_namespace_subtree (method_entry); + if (method_node->child) { + acpi_ns_delete_namespace_subtree (method_node); } /* * Delete any namespace entries created anywhere else within * the namespace */ - - acpi_ns_delete_namespace_by_owner ( - walk_state->method_desc->method.owning_id); - + acpi_ns_delete_namespace_by_owner (walk_state->method_desc->method.owning_id); acpi_cm_release_mutex (ACPI_MTX_NAMESPACE); - - /* - * Delete the method's parse tree if asked to - */ - if (acpi_gbl_when_to_parse_methods & METHOD_DELETE_AT_COMPLETION) { - acpi_ps_delete_parse_tree ( - walk_state->method_desc->method.parser_op); - - walk_state->method_desc->method.parser_op = NULL; - } } - -unlock_and_exit: acpi_cm_release_mutex (ACPI_MTX_PARSER); return (AE_OK); diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/dispatcher/dsmthdat.c linux/drivers/acpi/dispatcher/dsmthdat.c --- v2.4.0-test8/linux/drivers/acpi/dispatcher/dsmthdat.c Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/dispatcher/dsmthdat.c Fri Sep 15 14:30:29 2000 @@ -1,9 +1,9 @@ - -/****************************************************************************** +/******************************************************************************* * * Module Name: dsmthdat - control method arguments and local variables + * $Revision: 34 $ * - *****************************************************************************/ + ******************************************************************************/ /* * Copyright (C) 2000 R. Byron Moore @@ -25,18 +25,18 @@ #include "acpi.h" -#include "parser.h" -#include "dispatch.h" -#include "interp.h" +#include "acparser.h" +#include "acdispat.h" +#include "acinterp.h" #include "amlcode.h" -#include "namesp.h" +#include "acnamesp.h" #define _COMPONENT DISPATCHER - MODULE_NAME ("dsmthdat"); + MODULE_NAME ("dsmthdat") -/***************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_ds_method_data_init * @@ -49,7 +49,7 @@ * This allows Ref_of and De_ref_of to work properly for these * special data types. * - ****************************************************************************/ + ******************************************************************************/ ACPI_STATUS acpi_ds_method_data_init ( @@ -62,8 +62,8 @@ * Walk_state fields are initialized to zero by the * Acpi_cm_callocate(). * - * An NTE is assigned to each argument and local so - * that Ref_of() can return a pointer to the NTE. + * An Node is assigned to each argument and local so + * that Ref_of() can return a pointer to the Node. */ /* Init the method arguments */ @@ -72,10 +72,9 @@ 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].name |= (i << 24); + walk_state->arguments[i].data_type = ACPI_DESC_TYPE_NAMED; + walk_state->arguments[i].type = INTERNAL_TYPE_METHOD_ARGUMENT; } /* Init the method locals */ @@ -84,18 +83,16 @@ MOVE_UNALIGNED32_TO_32 (&walk_state->local_variables[i].name, NAMEOF_LOCAL_NTE); - walk_state->local_variables[i].name |= (i << 24); + 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 = INTERNAL_TYPE_METHOD_LOCAL_VAR; } - return (AE_OK); } -/***************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_ds_method_data_delete_all * @@ -106,14 +103,14 @@ * DESCRIPTION: Delete method locals and arguments. Arguments are only * deleted if this method was called from another method. * - ****************************************************************************/ + ******************************************************************************/ ACPI_STATUS acpi_ds_method_data_delete_all ( ACPI_WALK_STATE *walk_state) { u32 index; - ACPI_OBJECT_INTERNAL *object; + ACPI_OPERAND_OBJECT *object; /* Delete the locals */ @@ -122,8 +119,11 @@ object = walk_state->local_variables[index].object; if (object) { /* Remove first */ + walk_state->local_variables[index].object = NULL; + /* Was given a ref when stored */ + acpi_cm_remove_reference (object); } } @@ -135,8 +135,11 @@ object = walk_state->arguments[index].object; if (object) { /* Remove first */ + walk_state->arguments[index].object = NULL; + /* Was given a ref when stored */ + acpi_cm_remove_reference (object); } } @@ -145,7 +148,7 @@ } -/***************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_ds_method_data_init_args * @@ -155,12 +158,13 @@ * * DESCRIPTION: Initialize arguments for a method * - ****************************************************************************/ + ******************************************************************************/ ACPI_STATUS acpi_ds_method_data_init_args ( - ACPI_OBJECT_INTERNAL **params, - u32 max_param_count) + ACPI_OPERAND_OBJECT **params, + u32 max_param_count, + ACPI_WALK_STATE *walk_state) { ACPI_STATUS status; u32 mindex; @@ -183,9 +187,8 @@ * Set the current method argument to the * Params[Pindex++] argument object descriptor */ - status = acpi_ds_method_data_set_value (MTH_TYPE_ARG, - mindex, - params[pindex]); + status = acpi_ds_method_data_set_value (MTH_TYPE_ARG, mindex, + params[pindex], walk_state); if (ACPI_FAILURE (status)) { break; } @@ -202,7 +205,7 @@ } -/***************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_ds_method_data_get_entry * @@ -215,18 +218,16 @@ * * DESCRIPTION: Get the address of the stack entry given by Type:Index * - ****************************************************************************/ + ******************************************************************************/ ACPI_STATUS acpi_ds_method_data_get_entry ( u32 type, u32 index, - ACPI_OBJECT_INTERNAL ***entry) + ACPI_WALK_STATE *walk_state, + ACPI_OPERAND_OBJECT ***entry) { - ACPI_WALK_STATE *walk_state; - - walk_state = acpi_ds_get_current_walk_state (acpi_gbl_current_walk_list); /* * Get the requested object. @@ -243,7 +244,7 @@ } *entry = - (ACPI_OBJECT_INTERNAL **) &walk_state->local_variables[index].object; + (ACPI_OPERAND_OBJECT **) &walk_state->local_variables[index].object; break; @@ -254,7 +255,7 @@ } *entry = - (ACPI_OBJECT_INTERNAL **) &walk_state->arguments[index].object; + (ACPI_OPERAND_OBJECT **) &walk_state->arguments[index].object; break; @@ -267,7 +268,7 @@ } -/***************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_ds_method_data_set_entry * @@ -279,21 +280,22 @@ * * DESCRIPTION: Insert an object onto the method stack at entry Type:Index. * - ****************************************************************************/ + ******************************************************************************/ ACPI_STATUS acpi_ds_method_data_set_entry ( u32 type, u32 index, - ACPI_OBJECT_INTERNAL *object) + ACPI_OPERAND_OBJECT *object, + ACPI_WALK_STATE *walk_state) { ACPI_STATUS status; - ACPI_OBJECT_INTERNAL **entry; + ACPI_OPERAND_OBJECT **entry; /* Get a pointer to the stack entry to set */ - status = acpi_ds_method_data_get_entry (type, index, &entry); + status = acpi_ds_method_data_get_entry (type, index, walk_state, &entry); if (ACPI_FAILURE (status)) { return (status); } @@ -310,7 +312,7 @@ } -/***************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_ds_method_data_get_type * @@ -321,21 +323,22 @@ * RETURN: Data type of selected Arg or Local * Used only in Exec_monadic2()/Type_op. * - ****************************************************************************/ + ******************************************************************************/ OBJECT_TYPE_INTERNAL acpi_ds_method_data_get_type ( u32 type, - u32 index) + u32 index, + ACPI_WALK_STATE *walk_state) { ACPI_STATUS status; - ACPI_OBJECT_INTERNAL **entry; - ACPI_OBJECT_INTERNAL *object; + ACPI_OPERAND_OBJECT **entry; + ACPI_OPERAND_OBJECT *object; /* Get a pointer to the requested stack entry */ - status = acpi_ds_method_data_get_entry (type, index, &entry); + status = acpi_ds_method_data_get_entry (type, index, walk_state, &entry); if (ACPI_FAILURE (status)) { return ((ACPI_TYPE_NOT_FOUND)); } @@ -355,7 +358,7 @@ } -/***************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_ds_method_data_get_nte * @@ -363,20 +366,17 @@ * Index - Which local_var or argument whose type * to get * - * RETURN: Get the NTE associated with a local or arg. + * RETURN: Get the Node associated with a local or arg. * - ****************************************************************************/ + ******************************************************************************/ -ACPI_NAMED_OBJECT* +ACPI_NAMESPACE_NODE * acpi_ds_method_data_get_nte ( u32 type, - u32 index) + u32 index, + ACPI_WALK_STATE *walk_state) { - ACPI_NAMED_OBJECT *entry = NULL; - ACPI_WALK_STATE *walk_state; - - - walk_state = acpi_ds_get_current_walk_state (acpi_gbl_current_walk_list); + ACPI_NAMESPACE_NODE *node = NULL; switch (type) @@ -385,20 +385,20 @@ case MTH_TYPE_LOCAL: if (index > MTH_MAX_LOCAL) { - return (entry); + return (node); } - entry = &walk_state->local_variables[index]; + node = &walk_state->local_variables[index]; break; case MTH_TYPE_ARG: if (index > MTH_MAX_ARG) { - return (entry); + return (node); } - entry = &walk_state->arguments[index]; + node = &walk_state->arguments[index]; break; @@ -407,11 +407,11 @@ } - return (entry); + return (node); } -/***************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_ds_method_data_get_value * @@ -426,17 +426,18 @@ * at the current top of the method stack. * Used only in Acpi_aml_resolve_to_value(). * - ****************************************************************************/ + ******************************************************************************/ ACPI_STATUS acpi_ds_method_data_get_value ( u32 type, u32 index, - ACPI_OBJECT_INTERNAL **dest_desc) + ACPI_WALK_STATE *walk_state, + ACPI_OPERAND_OBJECT **dest_desc) { ACPI_STATUS status; - ACPI_OBJECT_INTERNAL **entry; - ACPI_OBJECT_INTERNAL *object; + ACPI_OPERAND_OBJECT **entry; + ACPI_OPERAND_OBJECT *object; /* Validate the object descriptor */ @@ -448,7 +449,7 @@ /* Get a pointer to the requested method stack entry */ - status = acpi_ds_method_data_get_entry (type, index, &entry); + status = acpi_ds_method_data_get_entry (type, index, walk_state, &entry); if (ACPI_FAILURE (status)) { return (status); } @@ -494,7 +495,7 @@ } -/***************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_ds_method_data_delete_value * @@ -506,21 +507,22 @@ * DESCRIPTION: Delete the entry at Type:Index on the method stack. Inserts * a null into the stack slot after the object is deleted. * - ****************************************************************************/ + ******************************************************************************/ ACPI_STATUS acpi_ds_method_data_delete_value ( u32 type, - u32 index) + u32 index, + ACPI_WALK_STATE *walk_state) { ACPI_STATUS status; - ACPI_OBJECT_INTERNAL **entry; - ACPI_OBJECT_INTERNAL *object; + ACPI_OPERAND_OBJECT **entry; + ACPI_OPERAND_OBJECT *object; /* Get a pointer to the requested entry */ - status = acpi_ds_method_data_get_entry (type, index, &entry); + status = acpi_ds_method_data_get_entry (type, index, walk_state, &entry); if (ACPI_FAILURE (status)) { return (status); } @@ -532,7 +534,7 @@ /* * Undefine the Arg or Local by setting its descriptor * pointer to NULL. Locals/Args can contain both - * ACPI_OBJECT_INTERNALS and ACPI_NAMED_OBJECTs + * ACPI_OPERAND_OBJECTS and ACPI_NAMESPACE_NODEs */ *entry = NULL; @@ -554,7 +556,7 @@ } -/***************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_ds_method_data_set_value * @@ -573,16 +575,17 @@ * as the new value for the Arg or Local and the reference count * is incremented. * - ****************************************************************************/ + ******************************************************************************/ ACPI_STATUS acpi_ds_method_data_set_value ( u32 type, u32 index, - ACPI_OBJECT_INTERNAL *src_desc) + ACPI_OPERAND_OBJECT *src_desc, + ACPI_WALK_STATE *walk_state) { ACPI_STATUS status; - ACPI_OBJECT_INTERNAL **entry; + ACPI_OPERAND_OBJECT **entry; /* Parameter validation */ @@ -594,7 +597,7 @@ /* Get a pointer to the requested method stack entry */ - status = acpi_ds_method_data_get_entry (type, index, &entry); + status = acpi_ds_method_data_get_entry (type, index, walk_state, &entry); if (ACPI_FAILURE (status)) { goto cleanup; } @@ -614,7 +617,7 @@ if (*entry) { /* * Check for an indirect store if an argument - * contains an object reference (stored as an NTE). + * contains an object reference (stored as an Node). * We don't allow this automatic dereferencing for * locals, since a store to a local should overwrite * anything there, including an object reference. @@ -632,16 +635,16 @@ if ((type == MTH_TYPE_ARG) && (VALID_DESCRIPTOR_TYPE (*entry, ACPI_DESC_TYPE_NAMED))) { - /* Detach an existing object from the NTE */ + /* Detach an existing object from the Node */ - acpi_ns_detach_object (*entry); + acpi_ns_detach_object ((ACPI_NAMESPACE_NODE *) *entry); /* - * Store this object into the NTE + * Store this object into the Node * (do the indirect store) */ - status = acpi_ns_attach_object (*entry, src_desc, + status = acpi_ns_attach_object ((ACPI_NAMESPACE_NODE *) *entry, src_desc, src_desc->common.type); return (status); } @@ -652,7 +655,7 @@ * before storing the new one */ - acpi_ds_method_data_delete_value (type, index); + acpi_ds_method_data_delete_value (type, index, walk_state); } @@ -663,7 +666,7 @@ * (increments the object reference count by one) */ - status = acpi_ds_method_data_set_entry (type, index, src_desc); + status = acpi_ds_method_data_set_entry (type, index, src_desc, walk_state); if (ACPI_FAILURE (status)) { goto cleanup; } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/dispatcher/dsobject.c linux/drivers/acpi/dispatcher/dsobject.c --- v2.4.0-test8/linux/drivers/acpi/dispatcher/dsobject.c Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/dispatcher/dsobject.c Fri Sep 15 14:30:29 2000 @@ -1,7 +1,7 @@ - /****************************************************************************** * * Module Name: dsobject - Dispatcher object management routines + * $Revision: 43 $ * *****************************************************************************/ @@ -25,21 +25,21 @@ #include "acpi.h" -#include "parser.h" +#include "acparser.h" #include "amlcode.h" -#include "dispatch.h" -#include "interp.h" -#include "namesp.h" +#include "acdispat.h" +#include "acinterp.h" +#include "acnamesp.h" #define _COMPONENT DISPATCHER - MODULE_NAME ("dsobject"); + MODULE_NAME ("dsobject") /******************************************************************************* * * FUNCTION: Acpi_ds_init_one_object * - * PARAMETERS: Obj_handle - NTE of the object + * PARAMETERS: Obj_handle - Node * Level - Current nesting level * Context - Points to a init info struct * Return_value - Not used @@ -64,7 +64,6 @@ { OBJECT_TYPE_INTERNAL type; ACPI_STATUS status; - ACPI_OBJECT_INTERNAL *obj_desc; INIT_WALK_INFO *info = (INIT_WALK_INFO *) context; @@ -73,10 +72,10 @@ * was just loaded */ - if (((ACPI_NAMED_OBJECT*) obj_handle)->owner_id != + if (((ACPI_NAMESPACE_NODE *) obj_handle)->owner_id != info->table_desc->table_id) { - return AE_OK; + return (AE_OK); } @@ -119,12 +118,7 @@ */ if (acpi_gbl_when_to_parse_methods != METHOD_PARSE_AT_INIT) { - acpi_ns_delete_namespace_subtree (obj_handle); - - obj_desc = ((ACPI_NAMED_OBJECT*)obj_handle)->object; - acpi_ps_delete_parse_tree (obj_desc->method.parser_op); - obj_desc->method.parser_op = NULL; } break; @@ -149,15 +143,15 @@ * * RETURN: Status * - * DESCRIPTION: Walk the entire namespace and perform any necessary initialization - * on the objects found therein + * DESCRIPTION: Walk the entire namespace and perform any necessary + * initialization on the objects found therein * ******************************************************************************/ ACPI_STATUS acpi_ds_initialize_objects ( ACPI_TABLE_DESC *table_desc, - ACPI_NAMED_OBJECT *start_entry) + ACPI_NAMESPACE_NODE *start_node) { ACPI_STATUS status; INIT_WALK_INFO info; @@ -170,8 +164,8 @@ /* Walk entire namespace from the supplied root */ - status = acpi_walk_namespace (ACPI_TYPE_ANY, start_entry, - ACPI_INT32_MAX, acpi_ds_init_one_object, + status = acpi_walk_namespace (ACPI_TYPE_ANY, start_node, + ACPI_UINT32_MAX, acpi_ds_init_one_object, &info, NULL); return (AE_OK); @@ -197,28 +191,28 @@ ACPI_STATUS acpi_ds_init_object_from_op ( ACPI_WALK_STATE *walk_state, - ACPI_GENERIC_OP *op, + ACPI_PARSE_OBJECT *op, u16 opcode, - ACPI_OBJECT_INTERNAL *obj_desc) + ACPI_OPERAND_OBJECT **obj_desc) { ACPI_STATUS status; - ACPI_GENERIC_OP *arg; - ACPI_BYTELIST_OP *byte_list; - ACPI_OBJECT_INTERNAL *arg_desc; - ACPI_OP_INFO *op_info; + ACPI_PARSE_OBJECT *arg; + ACPI_PARSE2_OBJECT *byte_list; + ACPI_OPERAND_OBJECT *arg_desc; + ACPI_OPCODE_INFO *op_info; op_info = acpi_ps_get_opcode_info (opcode); - if (!op_info) { + if (ACPI_GET_OP_TYPE (op_info) != ACPI_OP_TYPE_OPCODE) { /* Unknown opcode */ - return AE_TYPE; + return (AE_TYPE); } /* Get and prepare the first argument */ - switch (obj_desc->common.type) + switch ((*obj_desc)->common.type) { case ACPI_TYPE_BUFFER: @@ -230,31 +224,31 @@ /* Resolve the object (could be an arg or local) */ - status = acpi_aml_resolve_to_value (&arg_desc); + status = acpi_aml_resolve_to_value (&arg_desc, walk_state); if (ACPI_FAILURE (status)) { acpi_cm_remove_reference (arg_desc); - return status; + return (status); } /* We are expecting a number */ if (arg_desc->common.type != ACPI_TYPE_NUMBER) { acpi_cm_remove_reference (arg_desc); - return AE_TYPE; + return (AE_TYPE); } /* Get the value, delete the internal object */ - obj_desc->buffer.length = arg_desc->number.value; + (*obj_desc)->buffer.length = arg_desc->number.value; acpi_cm_remove_reference (arg_desc); /* Allocate the buffer */ - obj_desc->buffer.pointer = - acpi_cm_callocate (obj_desc->buffer.length); + (*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); } /* @@ -265,27 +259,42 @@ /* skip first arg */ arg = op->value.arg; - byte_list = (ACPI_BYTELIST_OP *) arg->next; + byte_list = (ACPI_PARSE2_OBJECT *) arg->next; if (byte_list) { if (byte_list->opcode != AML_BYTELIST_OP) { - return AE_TYPE; + return (AE_TYPE); } - MEMCPY (obj_desc->buffer.pointer, byte_list->data, - obj_desc->buffer.length); + MEMCPY ((*obj_desc)->buffer.pointer, byte_list->data, + (*obj_desc)->buffer.length); } break; + case ACPI_TYPE_PACKAGE: + + /* + * When called, an internal package object has already + * been built and is pointed to by *Obj_desc. + * Acpi_ds_build_internal_object build another internal + * package object, so remove reference to the original + * so that it is deleted. Error checking is done + * within the remove reference function. + */ + acpi_cm_remove_reference(*obj_desc); + + status = acpi_ds_build_internal_object (walk_state, op, obj_desc); + break; + case ACPI_TYPE_NUMBER: - obj_desc->number.value = op->value.integer; + (*obj_desc)->number.value = op->value.integer; break; case ACPI_TYPE_STRING: - obj_desc->string.pointer = op->value.string; - obj_desc->string.length = STRLEN (op->value.string); + (*obj_desc)->string.pointer = op->value.string; + (*obj_desc)->string.length = STRLEN (op->value.string); break; @@ -295,33 +304,33 @@ case INTERNAL_TYPE_REFERENCE: - switch (op_info->flags & OP_INFO_TYPE) + switch (ACPI_GET_OP_CLASS (op_info)) { case OPTYPE_LOCAL_VARIABLE: /* Split the opcode into a base opcode + offset */ - obj_desc->reference.op_code = AML_LOCAL_OP; - obj_desc->reference.offset = opcode - AML_LOCAL_OP; + (*obj_desc)->reference.op_code = AML_LOCAL_OP; + (*obj_desc)->reference.offset = opcode - AML_LOCAL_OP; break; case OPTYPE_METHOD_ARGUMENT: /* Split the opcode into a base opcode + offset */ - obj_desc->reference.op_code = AML_ARG_OP; - obj_desc->reference.offset = opcode - AML_ARG_OP; + (*obj_desc)->reference.op_code = AML_ARG_OP; + (*obj_desc)->reference.offset = opcode - AML_ARG_OP; break; default: /* Constants, Literals, etc.. */ if (op->opcode == AML_NAMEPATH_OP) { - /* Nte was saved in Op */ + /* Node was saved in Op */ - obj_desc->reference.nte = op->acpi_named_object; + (*obj_desc)->reference.node = op->node; } - obj_desc->reference.op_code = opcode; + (*obj_desc)->reference.op_code = opcode; break; } @@ -333,7 +342,7 @@ break; } - return AE_OK; + return (AE_OK); } @@ -354,10 +363,10 @@ ACPI_STATUS acpi_ds_build_internal_simple_obj ( ACPI_WALK_STATE *walk_state, - ACPI_GENERIC_OP *op, - ACPI_OBJECT_INTERNAL **obj_desc_ptr) + ACPI_PARSE_OBJECT *op, + ACPI_OPERAND_OBJECT **obj_desc_ptr) { - ACPI_OBJECT_INTERNAL *obj_desc; + ACPI_OPERAND_OBJECT *obj_desc; OBJECT_TYPE_INTERNAL type; ACPI_STATUS status; @@ -369,13 +378,13 @@ * Otherwise, go ahead and look it up now */ - if (!op->acpi_named_object) { + if (!op->node) { status = acpi_ns_lookup (walk_state->scope_info, op->value.string, ACPI_TYPE_ANY, IMODE_EXECUTE, NS_SEARCH_PARENT | NS_DONT_OPEN_SCOPE, NULL, - (ACPI_NAMED_OBJECT**)&(op->acpi_named_object)); + (ACPI_NAMESPACE_NODE **)&(op->node)); if (ACPI_FAILURE (status)) { return (status); @@ -403,7 +412,7 @@ } status = acpi_ds_init_object_from_op (walk_state, op, - op->opcode, obj_desc); + op->opcode, &obj_desc); if (ACPI_FAILURE (status)) { acpi_cm_remove_reference (obj_desc); @@ -433,11 +442,11 @@ ACPI_STATUS acpi_ds_build_internal_package_obj ( ACPI_WALK_STATE *walk_state, - ACPI_GENERIC_OP *op, - ACPI_OBJECT_INTERNAL **obj_desc_ptr) + ACPI_PARSE_OBJECT *op, + ACPI_OPERAND_OBJECT **obj_desc_ptr) { - ACPI_GENERIC_OP *arg; - ACPI_OBJECT_INTERNAL *obj_desc; + ACPI_PARSE_OBJECT *arg; + ACPI_OPERAND_OBJECT *obj_desc; ACPI_STATUS status = AE_OK; @@ -466,7 +475,7 @@ REPORT_ERROR ("Ds_build_internal_package_obj: Package vector allocation failure"); - acpi_cm_free (obj_desc); + acpi_cm_delete_object_desc (obj_desc); return (AE_NO_MEMORY); } @@ -514,8 +523,8 @@ ACPI_STATUS acpi_ds_build_internal_object ( ACPI_WALK_STATE *walk_state, - ACPI_GENERIC_OP *op, - ACPI_OBJECT_INTERNAL **obj_desc_ptr) + ACPI_PARSE_OBJECT *op, + ACPI_OPERAND_OBJECT **obj_desc_ptr) { ACPI_STATUS status; @@ -536,7 +545,7 @@ /***************************************************************************** * - * FUNCTION: Acpi_ds_create_named_object + * FUNCTION: Acpi_ds_create_node * * PARAMETERS: Op - Parser object to be translated * Obj_desc_ptr - Where the ACPI internal object is returned @@ -548,13 +557,13 @@ ****************************************************************************/ ACPI_STATUS -acpi_ds_create_named_object ( +acpi_ds_create_node ( ACPI_WALK_STATE *walk_state, - ACPI_NAMED_OBJECT *entry, - ACPI_GENERIC_OP *op) + ACPI_NAMESPACE_NODE *node, + ACPI_PARSE_OBJECT *op) { ACPI_STATUS status; - ACPI_OBJECT_INTERNAL *obj_desc; + ACPI_OPERAND_OBJECT *obj_desc; if (!op->value.arg) { @@ -575,12 +584,12 @@ /* Re-type the object according to it's argument */ - entry->type = obj_desc->common.type; + node->type = obj_desc->common.type; /* Init obj */ - status = acpi_ns_attach_object ((ACPI_HANDLE) entry, obj_desc, - (u8) entry->type); + status = acpi_ns_attach_object ((ACPI_HANDLE) node, obj_desc, + (u8) node->type); if (ACPI_FAILURE (status)) { goto cleanup; } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/dispatcher/dsopcode.c linux/drivers/acpi/dispatcher/dsopcode.c --- v2.4.0-test8/linux/drivers/acpi/dispatcher/dsopcode.c Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/dispatcher/dsopcode.c Fri Sep 15 14:30:29 2000 @@ -1,8 +1,8 @@ - /****************************************************************************** * - * Module Name: dsopcode - Dispatcher Op Region support - * and handling of "control" opcodes + * Module Name: dsopcode - Dispatcher Op Region support and handling of + * "control" opcodes + * $Revision: 17 $ * *****************************************************************************/ @@ -26,16 +26,16 @@ #include "acpi.h" -#include "parser.h" +#include "acparser.h" #include "amlcode.h" -#include "dispatch.h" -#include "interp.h" -#include "namesp.h" -#include "events.h" -#include "tables.h" +#include "acdispat.h" +#include "acinterp.h" +#include "acnamesp.h" +#include "acevents.h" +#include "actables.h" #define _COMPONENT DISPATCHER - MODULE_NAME ("dsopcode"); + MODULE_NAME ("dsopcode") /***************************************************************************** @@ -53,23 +53,23 @@ ACPI_STATUS acpi_ds_get_region_arguments ( - ACPI_OBJECT_INTERNAL *rgn_desc) + ACPI_OPERAND_OBJECT *rgn_desc) { - ACPI_OBJECT_INTERNAL *method_desc; - ACPI_NAMED_OBJECT *entry; - ACPI_GENERIC_OP *op; - ACPI_GENERIC_OP *region_op; + ACPI_OPERAND_OBJECT *method_desc; + ACPI_NAMESPACE_NODE *node; + ACPI_PARSE_OBJECT *op; + ACPI_PARSE_OBJECT *region_op; ACPI_STATUS status; ACPI_TABLE_DESC *table_desc; - if (rgn_desc->region.region_flags & REGION_AGRUMENT_DATA_VALID) { + if (rgn_desc->region.flags & AOPOBJ_DATA_VALID) { return (AE_OK); } method_desc = rgn_desc->region.method; - entry = rgn_desc->region.nte; + node = rgn_desc->region.node; /* @@ -77,18 +77,18 @@ * Op_region tree */ - op = acpi_ps_alloc_op (AML_REGION_OP); + op = acpi_ps_alloc_op (AML_SCOPE_OP); if (!op) { - return AE_NO_MEMORY; + return (AE_NO_MEMORY); } - /* Save the NTE for use in Acpi_ps_parse_aml */ + /* Save the Node for use in Acpi_ps_parse_aml */ - op->acpi_named_object = acpi_ns_get_parent_entry (entry); + op->node = acpi_ns_get_parent_object (node); /* Get a handle to the parent ACPI table */ - status = acpi_tb_handle_to_object (entry->owner_id, &table_desc); + status = acpi_tb_handle_to_object (node->owner_id, &table_desc); if (ACPI_FAILURE (status)) { return (status); } @@ -96,20 +96,44 @@ /* 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); - if (ACPI_SUCCESS (status)) { - /* Get and init the actual Region_op created above */ - - region_op = op->value.arg; - region_op->acpi_named_object = entry; - - /* Acpi_evaluate the address and length arguments for the Op_region */ - - 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); + method_desc->method.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 Region_op created above */ + +/* Region_op = Op->Value.Arg; + Op->Node = Node;*/ + + + region_op = op->value.arg; + region_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, method_desc->method.pcode, + method_desc->method.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); @@ -134,7 +158,7 @@ acpi_ds_initialize_region ( ACPI_HANDLE obj_handle) { - ACPI_OBJECT_INTERNAL *obj_desc; + ACPI_OPERAND_OBJECT *obj_desc; ACPI_STATUS status; @@ -144,7 +168,7 @@ status = acpi_ev_initialize_region (obj_desc, FALSE); - return status; + return (status); } @@ -164,20 +188,20 @@ ACPI_STATUS acpi_ds_eval_region_operands ( ACPI_WALK_STATE *walk_state, - ACPI_GENERIC_OP *op) + ACPI_PARSE_OBJECT *op) { ACPI_STATUS status; - ACPI_OBJECT_INTERNAL *obj_desc; - ACPI_OBJECT_INTERNAL *region_desc; - ACPI_NAMED_OBJECT *entry; - ACPI_GENERIC_OP *next_op; + ACPI_OPERAND_OBJECT *obj_desc; + ACPI_OPERAND_OBJECT *region_desc; + ACPI_NAMESPACE_NODE *node; + ACPI_PARSE_OBJECT *next_op; /* * This is where we evaluate the address and length fields of the Op_region declaration */ - entry = op->acpi_named_object; + node = op->node; /* Next_op points to the op that holds the Space_iD */ next_op = op->value.arg; @@ -192,7 +216,7 @@ return (status); } - region_desc = acpi_ns_get_attached_object (entry); + region_desc = acpi_ns_get_attached_object (node); if (!region_desc) { return (AE_NOT_EXIST); } @@ -216,7 +240,7 @@ /* Now the address and length are valid for this opregion */ - region_desc->region.region_flags |= REGION_AGRUMENT_DATA_VALID; + region_desc->region.flags |= AOPOBJ_DATA_VALID; return (status); } @@ -239,7 +263,7 @@ ACPI_STATUS acpi_ds_exec_begin_control_op ( ACPI_WALK_STATE *walk_state, - ACPI_GENERIC_OP *op) + ACPI_PARSE_OBJECT *op) { ACPI_STATUS status = AE_OK; ACPI_GENERIC_STATE *control_state; @@ -263,6 +287,14 @@ } acpi_cm_push_generic_state (&walk_state->control_state, control_state); + + /* + * Save a pointer to the predicate for multiple executions + * of a loop + */ + walk_state->control_state->control.aml_predicate_start = + walk_state->parser_state->aml - 1; + /*Acpi_ps_pkg_length_encoding_size (GET8 (Walk_state->Parser_state->Aml));*/ break; @@ -287,7 +319,7 @@ break; } - return status; + return (status); } @@ -309,7 +341,7 @@ ACPI_STATUS acpi_ds_exec_end_control_op ( ACPI_WALK_STATE *walk_state, - ACPI_GENERIC_OP *op) + ACPI_PARSE_OBJECT *op) { ACPI_STATUS status = AE_OK; ACPI_GENERIC_STATE *control_state; @@ -350,16 +382,18 @@ if (walk_state->control_state->common.value) { /* Predicate was true, go back and evaluate it again! */ - status = AE_CTRL_TRUE; + status = AE_CTRL_PENDING; } - else { +/* else {*/ /* Pop this control state and free it */ 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; @@ -367,44 +401,62 @@ case AML_RETURN_OP: - /* One optional operand -- the return value */ - + /* + * One optional operand -- the return value + * It can be either an immediate operand or a result that + * has been bubbled up the tree + */ if (op->value.arg) { + /* Return statement has an immediate operand */ + status = acpi_ds_create_operands (walk_state, op->value.arg); if (ACPI_FAILURE (status)) { - return status; + return (status); } /* - * TBD: [Restructure] Just check for NULL arg - * to signify no return value??? - */ - - /* * If value being returned is a Reference (such as * an arg or local), resolve it now because it may * cease to exist at the end of the method. */ - status = acpi_aml_resolve_to_value (&walk_state->operands [0]); + status = acpi_aml_resolve_to_value (&walk_state->operands [0], walk_state); if (ACPI_FAILURE (status)) { - return status; + return (status); } /* * Get the return value and save as the last result - * value - * This is the only place where Walk_state->Return_desc + * value. This is the only place where Walk_state->Return_desc * is set to anything other than zero! */ walk_state->return_desc = walk_state->operands[0]; } + else if (walk_state->num_results > 0) { + /* + * The return value has come from a previous calculation. + * + * If value being returned is a Reference (such as + * an arg or local), resolve it now because it may + * cease to exist at the end of the method. + */ + + status = acpi_aml_resolve_to_value (&walk_state->results [0], walk_state); + if (ACPI_FAILURE (status)) { + return (status); + } + + walk_state->return_desc = walk_state->results [0]; + } + else { /* No return operand */ - acpi_cm_remove_reference (walk_state->operands [0]); + if (walk_state->num_operands) { + acpi_cm_remove_reference (walk_state->operands [0]); + } walk_state->operands [0] = NULL; walk_state->num_operands = 0; @@ -417,7 +469,7 @@ break; - case AML_NOOP_CODE: + case AML_NOOP_OP: /* Just do nothing! */ break; @@ -459,6 +511,6 @@ } - return status; + return (status); } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/dispatcher/dsutils.c linux/drivers/acpi/dispatcher/dsutils.c --- v2.4.0-test8/linux/drivers/acpi/dispatcher/dsutils.c Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/dispatcher/dsutils.c Fri Sep 15 14:30:29 2000 @@ -1,9 +1,9 @@ - -/****************************************************************************** +/******************************************************************************* * * Module Name: dsutils - Dispatcher utilities + * $Revision: 44 $ * - *****************************************************************************/ + ******************************************************************************/ /* * Copyright (C) 2000 R. Byron Moore @@ -25,20 +25,20 @@ #include "acpi.h" -#include "parser.h" +#include "acparser.h" #include "amlcode.h" -#include "dispatch.h" -#include "interp.h" -#include "namesp.h" -#include "debugger.h" +#include "acdispat.h" +#include "acinterp.h" +#include "acnamesp.h" +#include "acdebug.h" #define _COMPONENT PARSER - MODULE_NAME ("dsutils"); + MODULE_NAME ("dsutils") -/***************************************************************************** +/******************************************************************************* * - * FUNCTION: Acpi_ds_delete_result_if_not_used + * FUNCTION: Acpi_ds_is_result_used * * PARAMETERS: Op * Result_obj @@ -46,52 +46,32 @@ * * RETURN: Status * - * DESCRIPTION: Used after interpretation of an opcode. If there is an internal - * result descriptor, check if the parent opcode will actually use - * this result. If not, delete the result now so that it will - * not become orphaned. + * DESCRIPTION: Check if a result object will be used by the parent * - ****************************************************************************/ + ******************************************************************************/ -void -acpi_ds_delete_result_if_not_used ( - ACPI_GENERIC_OP *op, - ACPI_OBJECT_INTERNAL *result_obj, - ACPI_WALK_STATE *walk_state) +u8 +acpi_ds_is_result_used ( + ACPI_PARSE_OBJECT *op) { - ACPI_OP_INFO *parent_info; - ACPI_OBJECT_INTERNAL *obj_desc; - ACPI_STATUS status; + ACPI_OPCODE_INFO *parent_info; + + /* Must have both an Op and a Result Object */ if (!op) { - return; + return (TRUE); } - if (!result_obj) { - return; - } + /* + * If there is no parent, the result can't possibly be used! + * (An executing method typically has no parent, since each + * method is parsed separately) However, a method that is + * invoked from another method has a parent. + */ if (!op->parent) { - /* - * If there is no parent, the result can't possibly be used! - * (An executing method typically has no parent, since each - * method is parsed separately - */ - - /* - * Must pop the result stack (Obj_desc should be equal - * to Result_obj) - */ - - status = acpi_ds_result_stack_pop (&obj_desc, walk_state); - if (ACPI_FAILURE (status)) { - return; - } - - acpi_cm_remove_reference (result_obj); - - return; + return (FALSE); } @@ -100,15 +80,15 @@ */ parent_info = acpi_ps_get_opcode_info (op->parent->opcode); - if (!parent_info) { - return; + if (ACPI_GET_OP_TYPE (parent_info) != ACPI_OP_TYPE_OPCODE) { + return (FALSE); } /* Never delete the return value associated with a return opcode */ if (op->parent->opcode == AML_RETURN_OP) { - return; + return (TRUE); } @@ -119,26 +99,15 @@ * as an operand later. */ - switch (parent_info->flags & OP_INFO_TYPE) + switch (ACPI_GET_OP_CLASS (parent_info)) { /* - * In these cases, the parent will never use the return object, - * so delete it here and now. + * In these cases, the parent will never use the return object */ case OPTYPE_CONTROL: /* IF, ELSE, WHILE only */ case OPTYPE_NAMED_OBJECT: /* Scope, method, etc. */ - /* - * Must pop the result stack (Obj_desc should be equal - * to Result_obj) - */ - - status = acpi_ds_result_stack_pop (&obj_desc, walk_state); - if (ACPI_FAILURE (status)) { - return; - } - - acpi_cm_remove_reference (result_obj); + return (FALSE); break; /* @@ -149,11 +118,63 @@ break; } + return (TRUE); +} + + +/******************************************************************************* + * + * FUNCTION: Acpi_ds_delete_result_if_not_used + * + * PARAMETERS: Op + * Result_obj + * Walk_state + * + * RETURN: Status + * + * DESCRIPTION: Used after interpretation of an opcode. If there is an internal + * result descriptor, check if the parent opcode will actually use + * this result. If not, delete the result now so that it will + * not become orphaned. + * + ******************************************************************************/ + +void +acpi_ds_delete_result_if_not_used ( + ACPI_PARSE_OBJECT *op, + ACPI_OPERAND_OBJECT *result_obj, + ACPI_WALK_STATE *walk_state) +{ + ACPI_OPERAND_OBJECT *obj_desc; + ACPI_STATUS status; + + + if (!op) { + return; + } + + if (!result_obj) { + return; + } + + + if (!acpi_ds_is_result_used (op)) { + /* + * Must pop the result stack (Obj_desc should be equal + * to Result_obj) + */ + + status = acpi_ds_result_stack_pop (&obj_desc, walk_state); + if (ACPI_SUCCESS (status)) { + acpi_cm_remove_reference (result_obj); + } + } + return; } -/***************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_ds_create_operand * @@ -167,19 +188,19 @@ * looking up a name or entering a new name into the internal * namespace. * - ****************************************************************************/ + ******************************************************************************/ ACPI_STATUS acpi_ds_create_operand ( ACPI_WALK_STATE *walk_state, - ACPI_GENERIC_OP *arg) + ACPI_PARSE_OBJECT *arg) { ACPI_STATUS status = AE_OK; - char *name_string; + NATIVE_CHAR *name_string; u32 name_length; OBJECT_TYPE_INTERNAL data_type; - ACPI_OBJECT_INTERNAL *obj_desc; - ACPI_GENERIC_OP *parent_op; + ACPI_OPERAND_OBJECT *obj_desc; + ACPI_PARSE_OBJECT *parent_op; u16 opcode; u32 flags; OPERATING_MODE interpreter_mode; @@ -214,7 +235,7 @@ */ parent_op = arg->parent; - if ((acpi_ps_is_named_object_op (parent_op->opcode)) && + if ((acpi_ps_is_node_op (parent_op->opcode)) && (parent_op->opcode != AML_METHODCALL_OP) && (parent_op->opcode != AML_NAMEPATH_OP)) { @@ -233,7 +254,7 @@ ACPI_TYPE_ANY, interpreter_mode, NS_SEARCH_PARENT | NS_DONT_OPEN_SCOPE, walk_state, - (ACPI_NAMED_OBJECT**) &obj_desc); + (ACPI_NAMESPACE_NODE **) &obj_desc); /* Free the namestring created above */ @@ -252,7 +273,7 @@ * indicate this to the interpreter, set the * object to the root */ - obj_desc = (ACPI_OBJECT_INTERNAL *) acpi_gbl_root_object; + obj_desc = (ACPI_OPERAND_OBJECT *) acpi_gbl_root_node; status = AE_OK; } @@ -277,6 +298,7 @@ if (ACPI_FAILURE (status)) { return (status); } + DEBUGGER_EXEC (acpi_db_display_argument_object (obj_desc, walk_state)); } @@ -311,6 +333,8 @@ } if (flags & OP_HAS_RETURN_VALUE) { + DEBUGGER_EXEC (acpi_db_display_argument_object (walk_state->operands [walk_state->num_operands - 1], walk_state)); + /* * Use value that was already previously returned * by the evaluation of this argument @@ -338,9 +362,9 @@ /* Initialize the new object */ status = acpi_ds_init_object_from_op (walk_state, arg, - opcode, obj_desc); + opcode, &obj_desc); if (ACPI_FAILURE (status)) { - acpi_cm_free (obj_desc); + acpi_cm_delete_object_desc (obj_desc); return (status); } } @@ -352,13 +376,14 @@ return (status); } + DEBUGGER_EXEC (acpi_db_display_argument_object (obj_desc, walk_state)); } return (AE_OK); } -/***************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_ds_create_operands * @@ -370,15 +395,15 @@ * namespace objects and place those argument object on the object * stack in preparation for evaluation by the interpreter. * - ****************************************************************************/ + ******************************************************************************/ ACPI_STATUS acpi_ds_create_operands ( ACPI_WALK_STATE *walk_state, - ACPI_GENERIC_OP *first_arg) + ACPI_PARSE_OBJECT *first_arg) { ACPI_STATUS status = AE_OK; - ACPI_GENERIC_OP *arg; + ACPI_PARSE_OBJECT *arg; u32 args_pushed = 0; @@ -416,7 +441,7 @@ } -/***************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_ds_resolve_operands * @@ -428,7 +453,7 @@ * arguments to a control method invocation (a call from one * method to another.) * - ****************************************************************************/ + ******************************************************************************/ ACPI_STATUS acpi_ds_resolve_operands ( @@ -449,7 +474,7 @@ */ for (i = 0; i < walk_state->num_operands; i++) { - status = acpi_aml_resolve_to_value (&walk_state->operands[i]); + status = acpi_aml_resolve_to_value (&walk_state->operands[i], walk_state); if (ACPI_FAILURE (status)) { break; } @@ -459,7 +484,7 @@ } -/***************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_ds_map_opcode_to_data_type * @@ -472,7 +497,7 @@ * if any. If the opcode returns a value as part of the * intepreter execution, a flag is returned in Out_flags. * - ****************************************************************************/ + ******************************************************************************/ OBJECT_TYPE_INTERNAL acpi_ds_map_opcode_to_data_type ( @@ -480,18 +505,18 @@ u32 *out_flags) { OBJECT_TYPE_INTERNAL data_type = INTERNAL_TYPE_INVALID; - ACPI_OP_INFO *op_info; + ACPI_OPCODE_INFO *op_info; u32 flags = 0; op_info = acpi_ps_get_opcode_info (opcode); - if (!op_info) { + if (ACPI_GET_OP_TYPE (op_info) != ACPI_OP_TYPE_OPCODE) { /* Unknown opcode */ - return data_type; + return (data_type); } - switch (op_info->flags & OP_INFO_TYPE) + switch (ACPI_GET_OP_CLASS (op_info)) { case OPTYPE_LITERAL: @@ -552,6 +577,7 @@ case OPTYPE_DYADIC2_s: case OPTYPE_INDEX: case OPTYPE_MATCH: + case OPTYPE_RETURN: flags = OP_HAS_RETURN_VALUE; data_type = ACPI_TYPE_ANY; @@ -592,11 +618,11 @@ *out_flags = flags; } - return data_type; + return (data_type); } -/***************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_ds_map_named_opcode_to_data_type * @@ -607,7 +633,7 @@ * DESCRIPTION: Convert a raw Named AML opcode to the associated data type. * Named opcodes are a subsystem of the AML opcodes. * - ****************************************************************************/ + ******************************************************************************/ OBJECT_TYPE_INTERNAL acpi_ds_map_named_opcode_to_data_type ( @@ -688,7 +714,7 @@ } - return data_type; + return (data_type); } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/dispatcher/dswexec.c linux/drivers/acpi/dispatcher/dswexec.c --- v2.4.0-test8/linux/drivers/acpi/dispatcher/dswexec.c Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/dispatcher/dswexec.c Fri Sep 15 14:30:29 2000 @@ -1,7 +1,8 @@ /****************************************************************************** * * Module Name: dswexec - Dispatcher method execution callbacks; - * Dispatch to interpreter. + * dispatch to interpreter. + * $Revision: 42 $ * *****************************************************************************/ @@ -25,16 +26,16 @@ #include "acpi.h" -#include "parser.h" +#include "acparser.h" #include "amlcode.h" -#include "dispatch.h" -#include "interp.h" -#include "namesp.h" -#include "debugger.h" +#include "acdispat.h" +#include "acinterp.h" +#include "acnamesp.h" +#include "acdebug.h" #define _COMPONENT DISPATCHER - MODULE_NAME ("dswexec"); + MODULE_NAME ("dswexec") /***************************************************************************** @@ -55,14 +56,29 @@ ACPI_STATUS acpi_ds_exec_begin_op ( + u16 opcode, + ACPI_PARSE_OBJECT *op, ACPI_WALK_STATE *walk_state, - ACPI_GENERIC_OP *op) + ACPI_PARSE_OBJECT **out_op) { - ACPI_OP_INFO *op_info; + ACPI_OPCODE_INFO *op_info; ACPI_STATUS status = AE_OK; + if (!op) { + status = acpi_ds_load2_begin_op (opcode, NULL, walk_state, out_op); + if (ACPI_FAILURE (status)) { + return (status); + } + + op = *out_op; + } + if (op == walk_state->origin) { + if (out_op) { + *out_op = op; + } + return (AE_OK); } @@ -97,7 +113,7 @@ * Handle the opcode based upon the opcode type */ - switch (op_info->flags & OP_INFO_TYPE) + switch (ACPI_GET_OP_CLASS (op_info)) { case OPTYPE_CONTROL: @@ -107,7 +123,7 @@ case OPTYPE_NAMED_OBJECT: - if (walk_state->origin->opcode == AML_METHOD_OP) { + if (walk_state->walk_type == WALK_METHOD) { /* * Found a named object declaration during method * execution; we must enter this object into the @@ -116,7 +132,7 @@ * of this method. */ - status = acpi_ds_load2_begin_op (walk_state, op); + status = acpi_ds_load2_begin_op (op->opcode, op, walk_state, NULL); } break; @@ -150,17 +166,17 @@ ACPI_STATUS acpi_ds_exec_end_op ( ACPI_WALK_STATE *walk_state, - ACPI_GENERIC_OP *op) + ACPI_PARSE_OBJECT *op) { ACPI_STATUS status = AE_OK; u16 opcode; u8 optype; - ACPI_OBJECT_INTERNAL *obj_desc; - ACPI_GENERIC_OP *next_op; - ACPI_NAMED_OBJECT *entry; - ACPI_GENERIC_OP *first_arg; - ACPI_OBJECT_INTERNAL *result_obj = NULL; - ACPI_OP_INFO *op_info; + ACPI_OPERAND_OBJECT *obj_desc; + ACPI_PARSE_OBJECT *next_op; + ACPI_NAMESPACE_NODE *node; + ACPI_PARSE_OBJECT *first_arg; + ACPI_OPERAND_OBJECT *result_obj = NULL; + ACPI_OPCODE_INFO *op_info; u32 operand_index; @@ -168,11 +184,11 @@ op_info = acpi_ps_get_opcode_info (op->opcode); - if (!op_info) { + if (ACPI_GET_OP_TYPE (op_info) != ACPI_OP_TYPE_OPCODE) { return (AE_NOT_IMPLEMENTED); } - optype = (u8) (op_info->flags & OP_INFO_TYPE); + optype = (u8) ACPI_GET_OP_CLASS (op_info); first_arg = op->value.arg; /* Init the walk state */ @@ -183,6 +199,9 @@ /* Call debugger for single step support (DEBUG build only) */ + DEBUGGER_EXEC (status = acpi_db_single_step (walk_state, op, optype)); + DEBUGGER_EXEC (if (ACPI_FAILURE (status)) {return (status);}); + /* Decode the opcode */ @@ -220,6 +239,7 @@ case OPTYPE_CREATE_FIELD: case OPTYPE_FATAL: + status = acpi_ds_create_operands (walk_state, first_arg); if (ACPI_FAILURE (status)) { goto cleanup; @@ -376,12 +396,12 @@ case OPTYPE_METHOD_CALL: /* - * (AML_METHODCALL) Op->Value->Arg->Acpi_named_object contains - * the method NTE pointer + * (AML_METHODCALL) Op->Value->Arg->Node contains + * the method Node pointer */ /* Next_op points to the op that holds the method name */ next_op = first_arg; - entry = next_op->acpi_named_object; + node = next_op->node; /* Next_op points to first argument op */ next_op = next_op->next; @@ -410,7 +430,7 @@ /* Open new scope on the scope stack */ /* - Status = Acpi_ns_scope_stack_push_entry (Entry); + Status = Acpi_ns_scope_stack_push_entry (Node); if (ACPI_FAILURE (Status)) { break; } @@ -419,7 +439,7 @@ /* Tell the walk loop to preempt this running method and execute the new method */ - status = AE_CTRL_PENDING; + status = AE_CTRL_TRANSFER; /* Return now; we don't want to disturb anything, especially the operand count! */ @@ -431,14 +451,20 @@ case OPTYPE_NAMED_OBJECT: - 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; + } +/* + 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)) { + Status = Acpi_ds_load2_end_op (Walk_state, Op); + if (ACPI_FAILURE (Status)) { break; } } +*/ switch (op->opcode) { @@ -504,7 +530,7 @@ goto cleanup; } - status = acpi_aml_resolve_to_value (&walk_state->operands [0]); + status = acpi_aml_resolve_to_value (&walk_state->operands [0], walk_state); if (ACPI_FAILURE (status)) { goto cleanup; } @@ -537,6 +563,8 @@ /* 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 */ @@ -551,6 +579,8 @@ if (result_obj) { /* Break to debugger to display result */ + + DEBUGGER_EXEC (acpi_db_display_result_object (result_obj, walk_state)); /* * Delete the result op if and only if: diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/dispatcher/dswload.c linux/drivers/acpi/dispatcher/dswload.c --- v2.4.0-test8/linux/drivers/acpi/dispatcher/dswload.c Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/dispatcher/dswload.c Fri Sep 15 14:30:29 2000 @@ -1,7 +1,7 @@ - /****************************************************************************** * * Module Name: dswload - Dispatcher namespace load callbacks + * $Revision: 19 $ * *****************************************************************************/ @@ -25,16 +25,16 @@ #include "acpi.h" -#include "parser.h" +#include "acparser.h" #include "amlcode.h" -#include "dispatch.h" -#include "interp.h" -#include "namesp.h" -#include "events.h" +#include "acdispat.h" +#include "acinterp.h" +#include "acnamesp.h" +#include "acevents.h" #define _COMPONENT DISPATCHER - MODULE_NAME ("dswload"); + MODULE_NAME ("dswload") /***************************************************************************** @@ -53,61 +53,75 @@ ACPI_STATUS acpi_ds_load1_begin_op ( + u16 opcode, + ACPI_PARSE_OBJECT *op, ACPI_WALK_STATE *walk_state, - ACPI_GENERIC_OP *op) + ACPI_PARSE_OBJECT **out_op) { - ACPI_NAMED_OBJECT *new_entry; + ACPI_NAMESPACE_NODE *node; ACPI_STATUS status; OBJECT_TYPE_INTERNAL data_type; + NATIVE_CHAR *path; /* We are only interested in opcodes that have an associated name */ - if (!acpi_ps_is_named_op (op->opcode)) { - return AE_OK; + if (!acpi_ps_is_named_op (opcode)) { + *out_op = op; + return (AE_OK); } /* Check if this object has already been installed in the namespace */ - if (op->acpi_named_object) { - return AE_OK; + if (op && op->node) { + *out_op = op; + return (AE_OK); } + path = acpi_ps_get_next_namestring (walk_state->parser_state); + /* Map the raw opcode into an internal object type */ - data_type = acpi_ds_map_named_opcode_to_data_type (op->opcode); + data_type = acpi_ds_map_named_opcode_to_data_type (opcode); - /* Attempt to type a NAME opcode by examining the argument */ - /* TBD: [Investigate] is this the right place to do this? */ + /* + * 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 + * arguments to the opcode must be created as we go back up the parse tree later. + */ + status = acpi_ns_lookup (walk_state->scope_info, path, + data_type, IMODE_LOAD_PASS1, + NS_NO_UPSEARCH, walk_state, &(node)); - if (op->opcode == AML_NAME_OP) { - if (op->value.arg) { + if (ACPI_FAILURE (status)) { + return (status); + } - data_type = acpi_ds_map_opcode_to_data_type ((op->value.arg)->opcode, - NULL); + if (!op) { + /* Create a new op */ + + op = acpi_ps_alloc_op (opcode); + if (!op) { + return (AE_NO_MEMORY); } } + /* Initialize */ + + ((ACPI_PARSE2_OBJECT *)op)->name = node->name; /* - * 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 - * arguments to the opcode must be created as we go back up the parse tree later. + * Put the Node in the "op" object that the parser uses, so we + * can get it again quickly when this scope is closed */ - status = acpi_ns_lookup (walk_state->scope_info, - (char *) &((ACPI_NAMED_OP *)op)->name, - data_type, IMODE_LOAD_PASS1, - NS_NO_UPSEARCH, walk_state, &(new_entry)); + op->node = node; - if (ACPI_SUCCESS (status)) { - /* - * Put the NTE in the "op" object that the parser uses, so we - * can get it again quickly when this scope is closed - */ - op->acpi_named_object = new_entry; - } + + acpi_ps_append_arg (acpi_ps_get_parent_scope (walk_state->parser_state), op); + + *out_op = op; return (status); } @@ -131,7 +145,7 @@ ACPI_STATUS acpi_ds_load1_end_op ( ACPI_WALK_STATE *walk_state, - ACPI_GENERIC_OP *op) + ACPI_PARSE_OBJECT *op) { OBJECT_TYPE_INTERNAL data_type; @@ -139,20 +153,26 @@ /* We are only interested in opcodes that have an associated name */ if (!acpi_ps_is_named_op (op->opcode)) { - return AE_OK; + return (AE_OK); } - /* TBD: [Investigate] can this be removed? */ - if (op->opcode == AML_SCOPE_OP) { - if (((ACPI_NAMED_OP *)op)->name == -1) { - return AE_OK; + /* Get the type to determine if we should pop the scope */ + + data_type = acpi_ds_map_named_opcode_to_data_type (op->opcode); + + if (op->opcode == AML_NAME_OP) { + /* For Name opcode, check the argument */ + + if (op->value.arg) { + data_type = acpi_ds_map_opcode_to_data_type ( + (op->value.arg)->opcode, NULL); + ((ACPI_NAMESPACE_NODE *)op->node)->type = + (u8) data_type; } } - data_type = acpi_ds_map_named_opcode_to_data_type (op->opcode); - /* Pop the scope stack */ if (acpi_ns_opens_scope (data_type)) { @@ -160,7 +180,7 @@ acpi_ds_scope_stack_pop (walk_state); } - return AE_OK; + return (AE_OK); } @@ -181,60 +201,74 @@ ACPI_STATUS acpi_ds_load2_begin_op ( + u16 opcode, + ACPI_PARSE_OBJECT *op, ACPI_WALK_STATE *walk_state, - ACPI_GENERIC_OP *op) + ACPI_PARSE_OBJECT **out_op) { - ACPI_NAMED_OBJECT *new_entry; + ACPI_NAMESPACE_NODE *node; ACPI_STATUS status; OBJECT_TYPE_INTERNAL data_type; - char *buffer_ptr; + NATIVE_CHAR *buffer_ptr; void *original = NULL; /* We only care about Namespace opcodes here */ - if (!acpi_ps_is_namespace_op (op->opcode) && - op->opcode != AML_NAMEPATH_OP) + if (!acpi_ps_is_namespace_op (opcode) && + opcode != AML_NAMEPATH_OP) { - return AE_OK; + return (AE_OK); } - /* - * Get the name we are going to enter or lookup in the namespace - */ - if (op->opcode == AML_NAMEPATH_OP) { - /* For Namepath op , get the path string */ + /* Temp! same code as in psparse */ + + if (!acpi_ps_is_named_op (opcode)) { + return (AE_OK); + } + + if (op) { + /* + * Get the name we are going to enter or lookup in the namespace + */ + if (opcode == AML_NAMEPATH_OP) { + /* For Namepath op, get the path string */ + + buffer_ptr = op->value.string; + if (!buffer_ptr) { + /* No name, just exit */ + + return (AE_OK); + } + } - buffer_ptr = op->value.string; - if (!buffer_ptr) { - /* No name, just exit */ + else { + /* Get name from the op */ - return AE_OK; + buffer_ptr = (NATIVE_CHAR *) &((ACPI_PARSE2_OBJECT *)op)->name; } } else { - /* Get name from the op */ - - buffer_ptr = (char *) &((ACPI_NAMED_OP *)op)->name; + buffer_ptr = acpi_ps_get_next_namestring (walk_state->parser_state); } /* Map the raw opcode into an internal object type */ - data_type = acpi_ds_map_named_opcode_to_data_type (op->opcode); + data_type = acpi_ds_map_named_opcode_to_data_type (opcode); - if (op->opcode == AML_DEF_FIELD_OP || - op->opcode == AML_BANK_FIELD_OP || - op->opcode == AML_INDEX_FIELD_OP) + if (opcode == AML_DEF_FIELD_OP || + opcode == AML_BANK_FIELD_OP || + opcode == AML_INDEX_FIELD_OP) { - new_entry = NULL; + node = NULL; status = AE_OK; } - else if (op->opcode == AML_NAMEPATH_OP) { + else if (opcode == AML_NAMEPATH_OP) { /* * The Name_path is an object reference to an existing object. Don't enter the * name into the namespace, but look it up for use later @@ -242,16 +276,16 @@ status = acpi_ns_lookup (walk_state->scope_info, buffer_ptr, data_type, IMODE_EXECUTE, NS_SEARCH_PARENT, walk_state, - &(new_entry)); + &(node)); } else { - if (op->acpi_named_object) { - original = op->acpi_named_object; - new_entry = op->acpi_named_object; + if (op && op->node) { + original = op->node; + node = op->node; if (acpi_ns_opens_scope (data_type)) { - status = acpi_ds_scope_stack_push (new_entry->child_table, + status = acpi_ds_scope_stack_push (node, data_type, walk_state); if (ACPI_FAILURE (status)) { @@ -259,7 +293,7 @@ } } - return AE_OK; + return (AE_OK); } /* @@ -270,15 +304,30 @@ status = acpi_ns_lookup (walk_state->scope_info, buffer_ptr, data_type, IMODE_EXECUTE, NS_NO_UPSEARCH, walk_state, - &(new_entry)); + &(node)); } if (ACPI_SUCCESS (status)) { + if (!op) { + /* Create a new op */ + + op = acpi_ps_alloc_op (opcode); + if (!op) { + return (AE_NO_MEMORY); + } + + /* Initialize */ + + ((ACPI_PARSE2_OBJECT *)op)->name = node->name; + *out_op = op; + } + + /* - * Put the NTE in the "op" object that the parser uses, so we + * Put the Node in the "op" object that the parser uses, so we * can get it again quickly when this scope is closed */ - op->acpi_named_object = new_entry; + op->node = node; } @@ -305,22 +354,22 @@ ACPI_STATUS acpi_ds_load2_end_op ( ACPI_WALK_STATE *walk_state, - ACPI_GENERIC_OP *op) + ACPI_PARSE_OBJECT *op) { ACPI_STATUS status = AE_OK; OBJECT_TYPE_INTERNAL data_type; - ACPI_NAMED_OBJECT *entry; - ACPI_GENERIC_OP *arg; - ACPI_NAMED_OBJECT *new_entry; + ACPI_NAMESPACE_NODE *node; + ACPI_PARSE_OBJECT *arg; + ACPI_NAMESPACE_NODE *new_node; if (!acpi_ps_is_namespace_object_op (op->opcode)) { - return AE_OK; + return (AE_OK); } if (op->opcode == AML_SCOPE_OP) { - if (((ACPI_NAMED_OP *)op)->name == -1) { - return AE_OK; + if (((ACPI_PARSE2_OBJECT *)op)->name == -1) { + return (AE_OK); } } @@ -328,17 +377,17 @@ data_type = acpi_ds_map_named_opcode_to_data_type (op->opcode); /* - * Get the NTE/name from the earlier lookup + * Get the Node/name from the earlier lookup * (It was saved in the *op structure) */ - entry = op->acpi_named_object; + node = op->node; /* - * Put the NTE on the object stack (Contains the ACPI Name of + * Put the Node on the object stack (Contains the ACPI Name of * this object) */ - walk_state->operands[0] = (void *) entry; + walk_state->operands[0] = (void *) node; walk_state->num_operands = 1; /* Pop the scope stack */ @@ -409,29 +458,38 @@ INTERNAL_TYPE_DEF_ANY, IMODE_LOAD_PASS1, NS_NO_UPSEARCH | NS_DONT_OPEN_SCOPE, - walk_state, &(new_entry)); + walk_state, &(new_node)); if (ACPI_SUCCESS (status)) { - /* We could put the returned object (NTE) on the object stack for later, but + /* We could put the returned object (Node) on the object stack for later, but * for now, we will put it in the "op" object that the parser uses, so we * can get it again at the end of this scope */ - op->acpi_named_object = new_entry; - } + op->node = new_node; + /* + * If this is NOT a control method, we need to evaluate this opcode now. + */ + + /* 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); + } + */ + } break; case AML_METHODCALL_OP: /* - * Lookup the method name and save the NTE + * Lookup the method name and save the Node */ status = acpi_ns_lookup (walk_state->scope_info, arg->value.string, ACPI_TYPE_ANY, IMODE_LOAD_PASS2, NS_SEARCH_PARENT | NS_DONT_OPEN_SCOPE, - walk_state, &(new_entry)); + walk_state, &(new_node)); if (ACPI_SUCCESS (status)) { @@ -440,11 +498,11 @@ /* TBD: [Restructure] Make sure that what we found is indeed a method! */ /* We didn't search for a method on purpose, to see if the name would resolve! */ - /* We could put the returned object (NTE) on the object stack for later, but + /* We could put the returned object (Node) on the object stack for later, but * for now, we will put it in the "op" object that the parser uses, so we * can get it again at the end of this scope */ - op->acpi_named_object = new_entry; + op->node = new_node; } @@ -455,7 +513,7 @@ /* Nothing to do other than enter object into namespace */ - status = acpi_aml_exec_create_processor (op, (ACPI_HANDLE) entry); + status = acpi_aml_exec_create_processor (op, (ACPI_HANDLE) node); if (ACPI_FAILURE (status)) { goto cleanup; } @@ -467,7 +525,7 @@ /* Nothing to do other than enter object into namespace */ - status = acpi_aml_exec_create_power_resource (op, (ACPI_HANDLE) entry); + status = acpi_aml_exec_create_power_resource (op, (ACPI_HANDLE) node); if (ACPI_FAILURE (status)) { goto cleanup; } @@ -487,7 +545,7 @@ arg = op->value.arg; status = acpi_ds_create_field (op, - (ACPI_HANDLE) arg->acpi_named_object, + arg->node, walk_state); break; @@ -497,7 +555,7 @@ arg = op->value.arg; status = acpi_ds_create_index_field (op, - (ACPI_HANDLE) arg->acpi_named_object, + (ACPI_HANDLE) arg->node, walk_state); break; @@ -506,7 +564,7 @@ arg = op->value.arg; status = acpi_ds_create_bank_field (op, - (ACPI_HANDLE) arg->acpi_named_object, + arg->node, walk_state); break; @@ -516,10 +574,10 @@ */ case AML_METHOD_OP: - if (!entry->object) { - status = acpi_aml_exec_create_method (((ACPI_DEFERRED_OP *) op)->body, - ((ACPI_DEFERRED_OP *) op)->body_length, - arg->value.integer, (ACPI_HANDLE) entry); + if (!node->object) { + status = acpi_aml_exec_create_method (((ACPI_PARSE2_OBJECT *) op)->data, + ((ACPI_PARSE2_OBJECT *) op)->length, + arg->value.integer, (ACPI_HANDLE) node); } break; @@ -549,14 +607,18 @@ case AML_REGION_OP: + if (node->object) { + break; + } + /* * The Op_region is not fully parsed at this time. Only valid argument is the Space_id. * (We must save the address of the AML of the address and length operands) */ - status = acpi_aml_exec_create_region (((ACPI_DEFERRED_OP *) op)->body, - ((ACPI_DEFERRED_OP *) op)->body_length, + status = acpi_aml_exec_create_region (((ACPI_PARSE2_OBJECT *) op)->data, + ((ACPI_PARSE2_OBJECT *) op)->length, arg->value.integer, walk_state); break; @@ -577,7 +639,7 @@ case AML_NAME_OP: - status = acpi_ds_create_named_object (walk_state, entry, op); + status = acpi_ds_create_node (walk_state, node, op); break; @@ -593,7 +655,9 @@ cleanup: - /* Remove the NTE pushed at the very beginning */ + + /* Remove the Node pushed at the very beginning */ + acpi_ds_obj_stack_pop (1, walk_state); return (status); } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/dispatcher/dswscope.c linux/drivers/acpi/dispatcher/dswscope.c --- v2.4.0-test8/linux/drivers/acpi/dispatcher/dswscope.c Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/dispatcher/dswscope.c Fri Sep 15 14:30:29 2000 @@ -1,7 +1,7 @@ - /****************************************************************************** * * Module Name: dswscope - Scope stack manipulation + * $Revision: 38 $ * *****************************************************************************/ @@ -25,12 +25,12 @@ #include "acpi.h" -#include "interp.h" -#include "dispatch.h" +#include "acinterp.h" +#include "acdispat.h" #define _COMPONENT NAMESPACE - MODULE_NAME ("dswscope"); + MODULE_NAME ("dswscope") #define STACK_POP(head) head @@ -69,24 +69,24 @@ * * FUNCTION: Acpi_ds_scope_stack_push * - * PARAMETERS: *New_scope, - Name to be made current - * Type, - Type of frame being pushed + * PARAMETERS: *Node, - Name to be made current + * Type, - Type of frame being pushed * * DESCRIPTION: Push the current scope on the scope stack, and make the - * passed nte current. + * passed Node current. * ***************************************************************************/ ACPI_STATUS acpi_ds_scope_stack_push ( - ACPI_NAME_TABLE *new_scope, + ACPI_NAMESPACE_NODE *node, OBJECT_TYPE_INTERNAL type, ACPI_WALK_STATE *walk_state) { ACPI_GENERIC_STATE *scope_info; - if (!new_scope) { + if (!node) { /* invalid scope */ REPORT_ERROR ("Ds_scope_stack_push: null scope passed"); @@ -109,7 +109,7 @@ /* Init new scope object */ - scope_info->scope.name_table = new_scope; + scope_info->scope.node = node; scope_info->common.value = (u16) type; /* Push new scope object onto stack */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/dispatcher/dswstate.c linux/drivers/acpi/dispatcher/dswstate.c --- v2.4.0-test8/linux/drivers/acpi/dispatcher/dswstate.c Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/dispatcher/dswstate.c Fri Sep 15 14:30:29 2000 @@ -1,6 +1,7 @@ /****************************************************************************** * * Module Name: dswstate - Dispatcher parse tree walk management routines + * $Revision: 31 $ * *****************************************************************************/ @@ -25,13 +26,13 @@ #include "acpi.h" #include "amlcode.h" -#include "parser.h" -#include "dispatch.h" -#include "namesp.h" -#include "interp.h" +#include "acparser.h" +#include "acdispat.h" +#include "acnamesp.h" +#include "acinterp.h" #define _COMPONENT DISPATCHER - MODULE_NAME ("dswstate"); + MODULE_NAME ("dswstate") /******************************************************************************* @@ -55,7 +56,7 @@ walk_state->num_results = 0; walk_state->current_result = 0; - return AE_OK; + return (AE_OK); } @@ -80,13 +81,13 @@ if (walk_state->num_results >= OBJ_NUM_OPERANDS) { - return AE_STACK_OVERFLOW; + return (AE_STACK_OVERFLOW); } walk_state->results [walk_state->num_results] = object; walk_state->num_results++; - return AE_OK; + return (AE_OK); } @@ -106,7 +107,7 @@ ACPI_STATUS acpi_ds_result_stack_pop ( - ACPI_OBJECT_INTERNAL **object, + ACPI_OPERAND_OBJECT **object, ACPI_WALK_STATE *walk_state) { @@ -114,7 +115,7 @@ /* Check for stack underflow */ if (walk_state->num_results == 0) { - return AE_AML_NO_OPERAND; + return (AE_AML_NO_OPERAND); } @@ -125,13 +126,13 @@ /* Check for a valid result object */ if (!walk_state->results [walk_state->num_results]) { - return AE_AML_NO_OPERAND; + return (AE_AML_NO_OPERAND); } *object = walk_state->results [walk_state->num_results]; walk_state->results [walk_state->num_results] = NULL; - return AE_OK; + return (AE_OK); } @@ -191,7 +192,7 @@ /* Check for stack overflow */ if (walk_state->num_operands >= OBJ_NUM_OPERANDS) { - return AE_STACK_OVERFLOW; + return (AE_STACK_OVERFLOW); } /* Put the object onto the stack */ @@ -199,7 +200,7 @@ walk_state->operands [walk_state->num_operands] = object; walk_state->num_operands++; - return AE_OK; + return (AE_OK); } @@ -219,7 +220,7 @@ ACPI_STATUS acpi_ds_obj_stack_pop_object ( - ACPI_OBJECT_INTERNAL **object, + ACPI_OPERAND_OBJECT **object, ACPI_WALK_STATE *walk_state) { @@ -227,7 +228,7 @@ /* Check for stack underflow */ if (walk_state->num_operands == 0) { - return AE_AML_NO_OPERAND; + return (AE_AML_NO_OPERAND); } @@ -238,7 +239,7 @@ /* Check for a valid operand */ if (!walk_state->operands [walk_state->num_operands]) { - return AE_AML_NO_OPERAND; + return (AE_AML_NO_OPERAND); } /* Get operand and set stack entry to null */ @@ -246,7 +247,7 @@ *object = walk_state->operands [walk_state->num_operands]; walk_state->operands [walk_state->num_operands] = NULL; - return AE_OK; + return (AE_OK); } @@ -276,7 +277,7 @@ /* Check for stack underflow */ if (walk_state->num_operands == 0) { - return AE_STACK_UNDERFLOW; + return (AE_STACK_UNDERFLOW); } /* Just set the stack entry to null */ @@ -285,7 +286,7 @@ walk_state->operands [walk_state->num_operands] = NULL; } - return AE_OK; + return (AE_OK); } @@ -309,14 +310,14 @@ ACPI_WALK_STATE *walk_state) { u32 i; - ACPI_OBJECT_INTERNAL *obj_desc; + ACPI_OPERAND_OBJECT *obj_desc; for (i = 0; i < pop_count; i++) { /* Check for stack underflow */ if (walk_state->num_operands == 0) { - return AE_STACK_UNDERFLOW; + return (AE_STACK_UNDERFLOW); } /* Pop the stack and delete an object if present in this stack entry */ @@ -329,7 +330,7 @@ } } - return AE_OK; + return (AE_OK); } @@ -393,10 +394,10 @@ { if (!walk_list) { - return NULL; + return (NULL); } - return walk_list->walk_state; + return (walk_list->walk_state); } @@ -483,8 +484,8 @@ ACPI_WALK_STATE * acpi_ds_create_walk_state ( ACPI_OWNER_ID owner_id, - ACPI_GENERIC_OP *origin, - ACPI_OBJECT_INTERNAL *mth_desc, + ACPI_PARSE_OBJECT *origin, + ACPI_OPERAND_OBJECT *mth_desc, ACPI_WALK_LIST *walk_list) { ACPI_WALK_STATE *walk_state; @@ -511,6 +512,7 @@ /* The cache is empty, create a new object */ /* Avoid deadlock with Acpi_cm_callocate */ + acpi_cm_release_mutex (ACPI_MTX_CACHES); walk_state = acpi_cm_callocate (sizeof (ACPI_WALK_STATE)); @@ -640,6 +642,7 @@ next = acpi_gbl_walk_state_cache->next; acpi_cm_free (acpi_gbl_walk_state_cache); acpi_gbl_walk_state_cache = next; + acpi_gbl_walk_state_cache_depth--; } return; diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/driver.c linux/drivers/acpi/driver.c --- v2.4.0-test8/linux/drivers/acpi/driver.c Fri Jul 14 12:12:08 2000 +++ linux/drivers/acpi/driver.c Fri Sep 15 14:30:30 2000 @@ -32,6 +32,9 @@ #include "acpi.h" #include "driver.h" +#define _COMPONENT OS_DEPENDENT + MODULE_NAME ("driver") + struct acpi_run_entry { void (*callback)(void*); diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/ec.c linux/drivers/acpi/ec.c --- v2.4.0-test8/linux/drivers/acpi/ec.c Fri Jul 14 12:12:08 2000 +++ linux/drivers/acpi/ec.c Fri Sep 15 14:30:30 2000 @@ -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 @@ -28,28 +28,28 @@ #include "acpi.h" #include "driver.h" -enum -{ - ACPI_EC_HID = 0x090cd041, -}; +#define _COMPONENT OS_DEPENDENT + MODULE_NAME ("ec") + +#define ACPI_EC_HID "PNP0A09" enum { - ACPI_EC_SMI = 0x40, - ACPI_EC_SCI = 0x20, - ACPI_EC_BURST = 0x10, - ACPI_EC_CMD = 0x08, - ACPI_EC_IBF = 0x02, - ACPI_EC_OBF = 0x01 + ACPI_EC_SMI = 0x40, + ACPI_EC_SCI = 0x20, + ACPI_EC_BURST = 0x10, + ACPI_EC_CMD = 0x08, + ACPI_EC_IBF = 0x02, + ACPI_EC_OBF = 0x01 }; enum { - ACPI_EC_READ = 0x80, - ACPI_EC_WRITE = 0x81, - ACPI_EC_BURST_ENABLE = 0x82, - ACPI_EC_BURST_DISABLE = 0x83, - ACPI_EC_QUERY = 0x84, + ACPI_EC_READ = 0x80, + ACPI_EC_WRITE = 0x81, + ACPI_EC_BURST_ENABLE = 0x82, + ACPI_EC_BURST_DISABLE = 0x83, + ACPI_EC_QUERY = 0x84, }; @@ -74,9 +74,9 @@ static void acpi_ec_wait_control(void) { - udelay(1); - while(inb(acpi_ec_status) & ACPI_EC_IBF) - udelay(10); + udelay(1); + while(inb(acpi_ec_status) & ACPI_EC_IBF) + udelay(10); } /* @@ -88,12 +88,12 @@ if (!acpi_ec_data || !acpi_ec_status) 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); + 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); return 0; } @@ -107,33 +107,32 @@ if (!acpi_ec_data || !acpi_ec_status) 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); + 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); return 0; } /* - * Get processor information + * Get Embedded Controller information */ static ACPI_STATUS acpi_find_ec(ACPI_HANDLE handle, u32 level, void *ctx, void **value) { - ACPI_BUFFER buf; + ACPI_DEVICE_INFO dev_info; ACPI_OBJECT obj; + ACPI_BUFFER buf; RESOURCE *res; int gpe; - buf.length = sizeof(obj); - buf.pointer = &obj; - if (!ACPI_SUCCESS(acpi_evaluate_object(handle, "_HID", NULL, &buf)) - || obj.type != ACPI_TYPE_NUMBER - || obj.number.value != ACPI_EC_HID) + 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; buf.length = 0; @@ -160,20 +159,23 @@ buf.length = sizeof(obj); buf.pointer = &obj; if (!ACPI_SUCCESS(acpi_evaluate_object(handle, "_GPE", NULL, &buf)) - || obj.type != ACPI_TYPE_NUMBER) + || 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); + acpi_ec_data, acpi_ec_status, gpe); if (!ACPI_SUCCESS(acpi_install_gpe_handler( gpe, (ACPI_EVENT_LEVEL_TRIGGERED | ACPI_EVENT_EDGE_TRIGGERED), acpi_ec_gpe, - NULL))) + NULL))) { + + DEBUG_PRINT(ACPI_ERROR, ("Could not install GPE handler for EC.\n")); return AE_OK; + } return AE_OK; } @@ -182,10 +184,10 @@ acpi_ec_init(void) { acpi_walk_namespace(ACPI_TYPE_DEVICE, - ACPI_ROOT_OBJECT, - ACPI_INT32_MAX, - acpi_find_ec, - NULL, - NULL); + ACPI_ROOT_OBJECT, + ACPI_UINT32_MAX, + acpi_find_ec, + NULL, + NULL); return 0; } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/events/Makefile linux/drivers/acpi/events/Makefile --- v2.4.0-test8/linux/drivers/acpi/events/Makefile Wed Dec 31 16:00:00 1969 +++ linux/drivers/acpi/events/Makefile Fri Sep 15 18:21:43 2000 @@ -0,0 +1,28 @@ +# +# 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)) + +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: + $(RM) *.o diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/events/evevent.c linux/drivers/acpi/events/evevent.c --- v2.4.0-test8/linux/drivers/acpi/events/evevent.c Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/events/evevent.c Fri Sep 15 14:30:30 2000 @@ -2,6 +2,7 @@ * * Module Name: evevent - Fixed and General Purpose Acpi_event * handling and dispatch + * $Revision: 13 $ * *****************************************************************************/ @@ -24,13 +25,13 @@ */ #include "acpi.h" -#include "hardware.h" -#include "events.h" -#include "namesp.h" -#include "common.h" +#include "achware.h" +#include "acevents.h" +#include "acnamesp.h" +#include "accommon.h" #define _COMPONENT EVENT_HANDLING - MODULE_NAME ("evevent"); + MODULE_NAME ("evevent") /****************************************************************************** @@ -68,7 +69,7 @@ acpi_hw_register_access (ACPI_WRITE, ACPI_MTX_LOCK, ACPI_EVENT_RTC + TMR_EN, 0); - return AE_OK; + return (AE_OK); } @@ -140,7 +141,7 @@ int_status |= acpi_ev_fixed_event_dispatch (ACPI_EVENT_SLEEP_BUTTON); } - return int_status; + return (int_status); } @@ -163,7 +164,7 @@ { /* Clear the status bit */ - acpi_hw_register_access (ACPI_WRITE, ACPI_MTX_DO_NOT_LOCK, (s32)TMR_STS + + acpi_hw_register_access (ACPI_WRITE, ACPI_MTX_DO_NOT_LOCK, TMR_STS + event, 1); /* @@ -175,13 +176,13 @@ TMR_EN + event, 0); REPORT_ERROR("No installed handler for fixed event."); - return INTERRUPT_NOT_HANDLED; + return (INTERRUPT_NOT_HANDLED); } /* Invoke the handler */ - return (acpi_gbl_fixed_event_handlers[event].handler)( - acpi_gbl_fixed_event_handlers[event].context); + return ((acpi_gbl_fixed_event_handlers[event].handler)( + acpi_gbl_fixed_event_handlers[event].context)); } @@ -216,6 +217,11 @@ gpe1_register_count = (u16) DIV_2 (acpi_gbl_FACP->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"); + return (AE_OK); + } + /* * Allocate the Gpe information block */ @@ -341,17 +347,17 @@ void **return_value) { u32 gpe_number; - char name[ACPI_NAME_SIZE + 1]; + NATIVE_CHAR name[ACPI_NAME_SIZE + 1]; u8 type; /* Extract the name from the object and convert to a string */ - MOVE_UNALIGNED32_TO_32 (name, &((ACPI_NAMED_OBJECT*) obj_handle)->name); + MOVE_UNALIGNED32_TO_32 (name, &((ACPI_NAMESPACE_NODE *) obj_handle)->name); name[ACPI_NAME_SIZE] = 0; /* - * Edge/Level determination is based on the 2nd char of the method name + * Edge/Level determination is based on the 2nd s8 of the method name */ if (name[1] == 'L') { type = ACPI_EVENT_LEVEL_TRIGGERED; @@ -362,7 +368,7 @@ else { /* Unknown method type, just ignore it! */ - return AE_OK; + return (AE_OK); } /* Convert the last two characters of the name to the Gpe Number */ @@ -371,7 +377,7 @@ if (gpe_number == ACPI_UINT32_MAX) { /* Conversion failed; invalid method, just ignore it */ - return AE_OK; + return (AE_OK); } /* Ensure that we have a valid GPE number */ @@ -379,7 +385,7 @@ if (acpi_gbl_gpe_valid[gpe_number] == ACPI_GPE_INVALID) { /* Not valid, all we can do here is ignore it */ - return AE_OK; + return (AE_OK); } /* @@ -397,7 +403,7 @@ acpi_hw_enable_gpe (gpe_number); - return AE_OK; + return (AE_OK); } @@ -431,7 +437,7 @@ /* Traverse the namespace under \_GPE to find all methods there */ status = acpi_walk_namespace (ACPI_TYPE_METHOD, acpi_gbl_gpe_obj_handle, - ACPI_INT32_MAX, acpi_ev_save_method_info, + ACPI_UINT32_MAX, acpi_ev_save_method_info, NULL, NULL); return (status); @@ -523,7 +529,7 @@ } } - return int_status; + return (int_status); } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/events/evmisc.c linux/drivers/acpi/events/evmisc.c --- v2.4.0-test8/linux/drivers/acpi/events/evmisc.c Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/events/evmisc.c Fri Sep 15 14:30:30 2000 @@ -2,6 +2,7 @@ * * Module Name: evmisc - ACPI device notification handler dispatch * and ACPI Global Lock support + * $Revision: 13 $ * *****************************************************************************/ @@ -24,13 +25,13 @@ */ #include "acpi.h" -#include "events.h" -#include "namesp.h" -#include "interp.h" -#include "hardware.h" +#include "acevents.h" +#include "acnamesp.h" +#include "acinterp.h" +#include "achware.h" #define _COMPONENT EVENT_HANDLING - MODULE_NAME ("evmisc"); + MODULE_NAME ("evmisc") /************************************************************************** @@ -51,8 +52,8 @@ ACPI_HANDLE device, u32 notify_value) { - ACPI_OBJECT_INTERNAL *obj_desc; - ACPI_OBJECT_INTERNAL *handler_obj; + ACPI_OPERAND_OBJECT *obj_desc; + ACPI_OPERAND_OBJECT *handler_obj; NOTIFY_HANDLER handler; @@ -108,7 +109,7 @@ /* - * Get the notify object which must be attached to the device NTE + * Get the notify object which must be attached to the device Node */ obj_desc = acpi_ns_get_attached_object ((ACPI_HANDLE) device); @@ -211,7 +212,7 @@ context); } - return INTERRUPT_HANDLED; + return (INTERRUPT_HANDLED); } @@ -349,7 +350,7 @@ */ if (pending) { acpi_hw_register_access (ACPI_WRITE, ACPI_MTX_LOCK, - (s32)PM1_CONTROL | GBL_RLS, 1); + PM1_CONTROL | GBL_RLS, 1); } } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/events/evregion.c linux/drivers/acpi/events/evregion.c --- v2.4.0-test8/linux/drivers/acpi/events/evregion.c Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/events/evregion.c Fri Sep 15 14:30:30 2000 @@ -1,6 +1,7 @@ /****************************************************************************** * * Module Name: evregion - ACPI Address_space / Op_region handler dispatch + * $Revision: 76 $ * *****************************************************************************/ @@ -24,13 +25,13 @@ #include "acpi.h" -#include "events.h" -#include "namesp.h" -#include "interp.h" +#include "acevents.h" +#include "acnamesp.h" +#include "acinterp.h" #include "amlcode.h" #define _COMPONENT EVENT_HANDLING - MODULE_NAME ("evregion"); + MODULE_NAME ("evregion") #define PCI_ROOT_HID_STRING "PNP0A03" @@ -56,23 +57,23 @@ void *context, void **return_value) { - ACPI_NAMED_OBJECT *entry; - ACPI_OBJECT_INTERNAL *obj_desc; + ACPI_NAMESPACE_NODE *node; + ACPI_OPERAND_OBJECT *obj_desc; ACPI_STATUS status; - entry = (ACPI_NAMED_OBJECT*) obj_handle; - obj_desc = ((ACPI_NAMED_OBJECT*)obj_handle)->object; + node = (ACPI_NAMESPACE_NODE *) obj_handle; + obj_desc = ((ACPI_NAMESPACE_NODE *) obj_handle)->object; /* * We are looking for all valid _HID objects. */ - if (STRNCMP ((char *)&entry->name, METHOD_NAME__HID, ACPI_NAME_SIZE) || + if (STRNCMP ((NATIVE_CHAR *) &node->name, METHOD_NAME__HID, ACPI_NAME_SIZE) || (!obj_desc)) { - return AE_OK; + return (AE_OK); } @@ -87,7 +88,7 @@ case ACPI_TYPE_NUMBER: if (obj_desc->number.value != PCI_ROOT_HID_VALUE) { - return AE_OK; + return (AE_OK); } break; @@ -97,14 +98,14 @@ if (STRNCMP (obj_desc->string.pointer, PCI_ROOT_HID_STRING, sizeof (PCI_ROOT_HID_STRING))) { - return AE_OK; + return (AE_OK); } break; default: - return AE_OK; + return (AE_OK); } @@ -114,11 +115,11 @@ * handler for this PCI device. */ - status = acpi_install_address_space_handler (acpi_ns_get_parent_entry (entry), + status = acpi_install_address_space_handler (acpi_ns_get_parent_object (node), ADDRESS_SPACE_PCI_CONFIG, ACPI_DEFAULT_HANDLER, NULL, NULL); - return AE_OK; + return (AE_OK); } @@ -142,7 +143,90 @@ 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; + 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); } @@ -172,28 +256,20 @@ * associated with the address space. For these we use the root. */ - status = acpi_install_address_space_handler (acpi_gbl_root_object, + status = acpi_install_address_space_handler (acpi_gbl_root_node, ADDRESS_SPACE_SYSTEM_MEMORY, ACPI_DEFAULT_HANDLER, NULL, NULL); if (ACPI_FAILURE (status)) { return (status); } - status = acpi_install_address_space_handler (acpi_gbl_root_object, + status = acpi_install_address_space_handler (acpi_gbl_root_node, ADDRESS_SPACE_SYSTEM_IO, ACPI_DEFAULT_HANDLER, NULL, NULL); if (ACPI_FAILURE (status)) { return (status); } - /* - * 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 (); - return (AE_OK); } @@ -216,12 +292,12 @@ ACPI_STATUS acpi_ev_execute_reg_method ( - ACPI_OBJECT_INTERNAL *region_obj, + ACPI_OPERAND_OBJECT *region_obj, u32 function) { - ACPI_OBJECT_INTERNAL *params[3]; - ACPI_OBJECT_INTERNAL space_iD_obj; - ACPI_OBJECT_INTERNAL function_obj; + ACPI_OPERAND_OBJECT *params[3]; + ACPI_OPERAND_OBJECT space_iD_obj; + ACPI_OPERAND_OBJECT function_obj; ACPI_STATUS status; @@ -286,7 +362,7 @@ ACPI_STATUS acpi_ev_address_space_dispatch ( - ACPI_OBJECT_INTERNAL *region_obj, + ACPI_OPERAND_OBJECT *region_obj, u32 function, u32 address, u32 bit_width, @@ -295,8 +371,8 @@ ACPI_STATUS status; ADDRESS_SPACE_HANDLER handler; ADDRESS_SPACE_SETUP region_setup; - ACPI_OBJECT_INTERNAL *handler_desc; - void *region_context; + ACPI_OPERAND_OBJECT *handler_desc; + void *region_context = NULL; /* @@ -312,7 +388,7 @@ * It may be the case that the region has never been initialized * Some types of regions require special init code */ - if (!(region_obj->region.region_flags & REGION_INITIALIZED)) { + if (!(region_obj->region.flags & AOPOBJ_INITIALIZED)) { /* * This region has not been initialized yet, do it */ @@ -346,9 +422,10 @@ } /* - * Save the returned context for use in all accesses to the region + * Save the returned context for use in all accesses to + * this particular region. */ - handler_desc->addr_handler.context = region_context; + region_obj->region.region_context = region_context; } /* @@ -369,7 +446,8 @@ * Invoke the handler. */ status = handler (function, address, bit_width, value, - handler_desc->addr_handler.context); + handler_desc->addr_handler.context, + region_obj->region.region_context); if (!(handler_desc->addr_handler.flags & ADDR_HANDLER_DEFAULT_INSTALLED)) { @@ -398,13 +476,13 @@ void acpi_ev_disassociate_region_from_handler( - ACPI_OBJECT_INTERNAL *region_obj) + ACPI_OPERAND_OBJECT *region_obj) { - ACPI_OBJECT_INTERNAL *handler_obj; - ACPI_OBJECT_INTERNAL *obj_desc; - ACPI_OBJECT_INTERNAL **last_obj_ptr; + ACPI_OPERAND_OBJECT *handler_obj; + ACPI_OPERAND_OBJECT *obj_desc; + ACPI_OPERAND_OBJECT **last_obj_ptr; ADDRESS_SPACE_SETUP region_setup; - void *region_context; + void *region_context = region_obj->region.region_context; ACPI_STATUS status; @@ -436,7 +514,8 @@ /* * This is it, remove it from the handler's list */ - *last_obj_ptr = obj_desc->region.link; + *last_obj_ptr = obj_desc->region.next; + obj_desc->region.next = NULL; /* Must clear field */ /* * Now stop region accesses by executing the _REG method @@ -452,12 +531,6 @@ ®ion_context); /* - * Save the returned context (It is the original context - * passed into Install) - */ - handler_obj->addr_handler.context = region_context; - - /* * Init routine may fail, Just ignore errors */ @@ -482,8 +555,8 @@ /* * Move through the linked list of handlers */ - last_obj_ptr = &obj_desc->region.link; - obj_desc = obj_desc->region.link; + last_obj_ptr = &obj_desc->region.next; + obj_desc = obj_desc->region.next; } /* @@ -508,9 +581,10 @@ ******************************************************************************/ ACPI_STATUS -acpi_ev_associate_region_and_handler( - ACPI_OBJECT_INTERNAL *handler_obj, - ACPI_OBJECT_INTERNAL *region_obj) +acpi_ev_associate_region_and_handler ( + ACPI_OPERAND_OBJECT *handler_obj, + ACPI_OPERAND_OBJECT *region_obj, + u8 acpi_ns_is_locked) { ACPI_STATUS status; @@ -522,7 +596,7 @@ * Link this region to the front of the handler's list */ - region_obj->region.link = handler_obj->addr_handler.region_list; + region_obj->region.next = handler_obj->addr_handler.region_list; handler_obj->addr_handler.region_list = region_obj; /* @@ -539,9 +613,15 @@ /* * Last thing, tell all users that this region is usable */ - acpi_cm_release_mutex (ACPI_MTX_NAMESPACE); + if (acpi_ns_is_locked) { + acpi_cm_release_mutex (ACPI_MTX_NAMESPACE); + } + status = acpi_ev_execute_reg_method (region_obj, 1); - acpi_cm_acquire_mutex (ACPI_MTX_NAMESPACE); + + if (acpi_ns_is_locked) { + acpi_cm_acquire_mutex (ACPI_MTX_NAMESPACE); + } return (status); } @@ -551,7 +631,7 @@ * * FUNCTION: Acpi_ev_addr_handler_helper * - * PARAMETERS: Handle - Entry to be dumped + * PARAMETERS: Handle - Node to be dumped * Level - Nesting level of the handle * Context - Passed into Acpi_ns_walk_namespace * @@ -573,14 +653,14 @@ void *context, void **return_value) { - ACPI_OBJECT_INTERNAL *handler_obj; - ACPI_OBJECT_INTERNAL *tmp_obj; - ACPI_OBJECT_INTERNAL *obj_desc; - ACPI_NAMED_OBJECT *obj_entry; + ACPI_OPERAND_OBJECT *handler_obj; + ACPI_OPERAND_OBJECT *tmp_obj; + ACPI_OPERAND_OBJECT *obj_desc; + ACPI_NAMESPACE_NODE *node; ACPI_STATUS status; - handler_obj = (ACPI_OBJECT_INTERNAL *) context; + handler_obj = (ACPI_OPERAND_OBJECT *) context; /* Parameter validation */ @@ -590,8 +670,8 @@ /* Convert and validate the device handle */ - obj_entry = acpi_ns_convert_handle_to_entry (obj_handle); - if (!obj_entry) { + node = acpi_ns_convert_handle_to_entry (obj_handle); + if (!node) { return (AE_BAD_PARAMETER); } @@ -600,16 +680,16 @@ * that can have address handlers */ - if ((obj_entry->type != ACPI_TYPE_DEVICE) && - (obj_entry->type != ACPI_TYPE_REGION) && - (obj_entry != acpi_gbl_root_object)) + if ((node->type != ACPI_TYPE_DEVICE) && + (node->type != ACPI_TYPE_REGION) && + (node != acpi_gbl_root_node)) { return (AE_OK); } /* Check for an existing internal object */ - obj_desc = acpi_ns_get_attached_object ((ACPI_HANDLE) obj_entry); + obj_desc = acpi_ns_get_attached_object ((ACPI_HANDLE) node); if (!obj_desc) { /* * The object DNE, we don't care about it @@ -647,7 +727,7 @@ /* * Move through the linked list of handlers */ - tmp_obj = tmp_obj->addr_handler.link; + tmp_obj = tmp_obj->addr_handler.next; } /* @@ -682,7 +762,7 @@ /* * Then connect the region to the new handler */ - status = acpi_ev_associate_region_and_handler (handler_obj, obj_desc); + status = acpi_ev_associate_region_and_handler (handler_obj, obj_desc, FALSE); return (status); } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/events/evrgnini.c linux/drivers/acpi/events/evrgnini.c --- v2.4.0-test8/linux/drivers/acpi/events/evrgnini.c Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/events/evrgnini.c Fri Sep 15 14:30:30 2000 @@ -1,6 +1,7 @@ /****************************************************************************** * * Module Name: evrgnini- ACPI Address_space / Op_region init + * $Revision: 22 $ * *****************************************************************************/ @@ -24,13 +25,13 @@ #include "acpi.h" -#include "events.h" -#include "namesp.h" -#include "interp.h" +#include "acevents.h" +#include "acnamesp.h" +#include "acinterp.h" #include "amlcode.h" #define _COMPONENT EVENT_HANDLING - MODULE_NAME ("evrgnini"); + MODULE_NAME ("evrgnini") /***************************************************************************** @@ -40,8 +41,8 @@ * PARAMETERS: Region_obj - region we are interested in * Function - start or stop * Handler_context - Address space handler context - * Returned context - context to be used with each call to the - * handler for this region + * Region_context - Region specific context + * * RETURN: Status * * DESCRIPTION: Do any prep work for region handling, a nop for now @@ -53,21 +54,17 @@ ACPI_HANDLE handle, u32 function, void *handler_context, - void **return_context) + void **region_context) { - MEM_HANDLER_CONTEXT *mem_context; - ACPI_OBJECT_INTERNAL *region_obj = (ACPI_OBJECT_INTERNAL *) handle; + ACPI_OPERAND_OBJECT *region_obj = (ACPI_OPERAND_OBJECT *) handle; if (function == ACPI_REGION_DEACTIVATE) { - region_obj->region.region_flags &= ~(REGION_INITIALIZED); - - *return_context = NULL; - if (handler_context) { - mem_context = handler_context; - *return_context = mem_context->handler_context; + region_obj->region.flags &= ~(AOPOBJ_INITIALIZED); - acpi_cm_free (mem_context); + if (*region_context) { + acpi_cm_free (*region_context); + *region_context = NULL; } return (AE_OK); } @@ -75,17 +72,15 @@ /* Activate. Create a new context */ - mem_context = acpi_cm_callocate (sizeof (MEM_HANDLER_CONTEXT)); - if (!mem_context) { + *region_context = acpi_cm_callocate (sizeof (MEM_HANDLER_CONTEXT)); + if (!(*region_context)) { return (AE_NO_MEMORY); } /* Init. (Mapping fields are all set to zeros above) */ - mem_context->handler_context = handler_context; - region_obj->region.region_flags |= REGION_INITIALIZED; + region_obj->region.flags |= AOPOBJ_INITIALIZED; - *return_context = mem_context; return (AE_OK); } @@ -97,8 +92,8 @@ * PARAMETERS: Region_obj - region we are interested in * Function - start or stop * Handler_context - Address space handler context - * Returned context - context to be used with each call to the - * handler for this region + * Region_context - Region specific context + * * RETURN: Status * * DESCRIPTION: Do any prep work for region handling @@ -110,21 +105,18 @@ ACPI_HANDLE handle, u32 function, void *handler_context, - void **return_context) + void **region_context) { - ACPI_OBJECT_INTERNAL *region_obj = (ACPI_OBJECT_INTERNAL *) handle; - + ACPI_OPERAND_OBJECT *region_obj = (ACPI_OPERAND_OBJECT *) handle; if (function == ACPI_REGION_DEACTIVATE) { - region_obj->region.region_flags &= ~(REGION_INITIALIZED); - *return_context = handler_context; - return (AE_OK); + *region_context = NULL; + region_obj->region.flags &= ~(AOPOBJ_INITIALIZED); + } + else { + *region_context = handler_context; + region_obj->region.flags |= AOPOBJ_INITIALIZED; } - - /* Activate the region */ - - region_obj->region.region_flags |= REGION_INITIALIZED; - *return_context = handler_context; return (AE_OK); } @@ -137,8 +129,8 @@ * PARAMETERS: Region_obj - region we are interested in * Function - start or stop * Handler_context - Address space handler context - * Returned context - context to be used with each call to the - * handler for this region + * Region_context - Region specific context + * * RETURN: Status * * DESCRIPTION: Do any prep work for region handling @@ -152,14 +144,14 @@ ACPI_HANDLE handle, u32 function, void *handler_context, - void **return_context) + void **region_context) { ACPI_STATUS status = AE_OK; u32 temp; - PCI_HANDLER_CONTEXT *pci_context; - ACPI_OBJECT_INTERNAL *handler_obj; - ACPI_NAMED_OBJECT *search_scope; - ACPI_OBJECT_INTERNAL *region_obj = (ACPI_OBJECT_INTERNAL *) handle; + 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; handler_obj = region_obj->region.addr_handler; @@ -173,14 +165,11 @@ } if (function == ACPI_REGION_DEACTIVATE) { - region_obj->region.region_flags &= ~(REGION_INITIALIZED); - - *return_context = NULL; - if (handler_context) { - pci_context = handler_context; - *return_context = pci_context->handler_context; + region_obj->region.flags &= ~(AOPOBJ_INITIALIZED); + if (pci_context) { acpi_cm_free (pci_context); + *region_context = NULL; } return (status); @@ -189,7 +178,7 @@ /* Create a new context */ - pci_context = acpi_cm_allocate (sizeof(PCI_HANDLER_CONTEXT)); + pci_context = acpi_cm_callocate (sizeof(PCI_HANDLER_CONTEXT)); if (!pci_context) { return (AE_NO_MEMORY); } @@ -203,16 +192,16 @@ * First get device and function numbers from the _ADR object * in the parent's scope. */ - ACPI_ASSERT(region_obj->region.nte); + ACPI_ASSERT(region_obj->region.node); - search_scope = acpi_ns_get_parent_entry (region_obj->region.nte); + 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, search_scope, &temp); + status = acpi_cm_evaluate_numeric_object (METHOD_NAME__ADR, node, &temp); /* * The default is zero, since the allocation above zeroed the data, just * do nothing on failures. @@ -232,9 +221,9 @@ * This is the device the handler has been registered to handle. */ - search_scope = handler_obj->addr_handler.nte; + node = handler_obj->addr_handler.node; - status = acpi_cm_evaluate_numeric_object (METHOD_NAME__SEG, search_scope, &temp); + status = acpi_cm_evaluate_numeric_object (METHOD_NAME__SEG, node, &temp); if (ACPI_SUCCESS (status)) { /* * Got it.. @@ -242,7 +231,7 @@ pci_context->seg = temp; } - status = acpi_cm_evaluate_numeric_object (METHOD_NAME__BBN, search_scope, &temp); + status = acpi_cm_evaluate_numeric_object (METHOD_NAME__BBN, node, &temp); if (ACPI_SUCCESS (status)) { /* * Got it.. @@ -250,11 +239,12 @@ pci_context->bus = temp; } + *region_context = pci_context; + acpi_cm_acquire_mutex (ACPI_MTX_NAMESPACE); - *return_context = pci_context; + region_obj->region.flags |= AOPOBJ_INITIALIZED; - region_obj->region.region_flags |= REGION_INITIALIZED; return (AE_OK); } @@ -266,8 +256,8 @@ * PARAMETERS: Region_obj - region we are interested in * Function - start or stop * Handler_context - Address space handler context - * Returned context - context to be used with each call to the - * handler for this region + * Region_context - Region specific context + * * RETURN: Status * * DESCRIPTION: Do any prep work for region handling @@ -279,18 +269,18 @@ ACPI_HANDLE handle, u32 function, void *handler_context, - void **return_context) + void **region_context) { - ACPI_OBJECT_INTERNAL *region_obj = (ACPI_OBJECT_INTERNAL *) handle; + ACPI_OPERAND_OBJECT *region_obj = (ACPI_OPERAND_OBJECT *) handle; if (function == ACPI_REGION_DEACTIVATE) { - region_obj->region.region_flags &= ~(REGION_INITIALIZED); - *return_context = NULL; + *region_context = NULL; + region_obj->region.flags &= ~(AOPOBJ_INITIALIZED); } else { - region_obj->region.region_flags |= REGION_INITIALIZED; - *return_context = handler_context; + *region_context = handler_context; + region_obj->region.flags |= AOPOBJ_INITIALIZED; } return (AE_OK); @@ -320,15 +310,15 @@ ACPI_STATUS acpi_ev_initialize_region ( - ACPI_OBJECT_INTERNAL *region_obj, + ACPI_OPERAND_OBJECT *region_obj, u8 acpi_ns_locked) { - ACPI_OBJECT_INTERNAL *handler_obj; - ACPI_OBJECT_INTERNAL *obj_desc; + ACPI_OPERAND_OBJECT *handler_obj; + ACPI_OPERAND_OBJECT *obj_desc; u32 space_id; - ACPI_NAMED_OBJECT *entry; /* Namespace Object */ + ACPI_NAMESPACE_NODE *node; ACPI_STATUS status; - ACPI_NAMED_OBJECT *reg_entry; + ACPI_NAMESPACE_NODE *method_node; ACPI_NAME *reg_name_ptr = (ACPI_NAME *) METHOD_NAME__REG; @@ -336,44 +326,44 @@ return (AE_BAD_PARAMETER); } - ACPI_ASSERT(region_obj->region.nte); + ACPI_ASSERT(region_obj->region.node); - entry = acpi_ns_get_parent_entry (region_obj->region.nte); + node = acpi_ns_get_parent_object (region_obj->region.node); space_id = region_obj->region.space_id; region_obj->region.addr_handler = NULL; region_obj->region.REGmethod = NULL; - region_obj->region.region_flags = INITIAL_REGION_FLAGS; + region_obj->region.flags &= ~(AOPOBJ_INITIALIZED); /* * Find any "_REG" associated with this region definition */ - status = acpi_ns_search_one_scope (*reg_name_ptr, entry->child_table, - ACPI_TYPE_METHOD, ®_entry, NULL); - if (status == AE_OK) { + status = acpi_ns_search_node (*reg_name_ptr, node, + ACPI_TYPE_METHOD, &method_node); + if (ACPI_SUCCESS (status)) { /* * The _REG method is optional and there can be only one per region * definition. This will be executed when the handler is attached * or removed */ - region_obj->region.REGmethod = reg_entry; + region_obj->region.REGmethod = method_node; } /* - * The following loop depends upon the root nte having no parent - * ie: Acpi_gbl_Root_object->Parent_entry being set to NULL + * The following loop depends upon the root Node having no parent + * ie: Acpi_gbl_Root_node->Parent_entry being set to NULL */ - while (entry) { + while (node) { /* * Check to see if a handler exists */ handler_obj = NULL; - obj_desc = acpi_ns_get_attached_object ((ACPI_HANDLE) entry); + obj_desc = acpi_ns_get_attached_object ((ACPI_HANDLE) node); if (obj_desc) { /* * can only be a handler if the object exists */ - switch (entry->type) + switch (node->type) { case ACPI_TYPE_DEVICE: @@ -400,11 +390,11 @@ /* * Found it! Now update the region and the handler */ - acpi_ev_associate_region_and_handler(handler_obj, region_obj); + acpi_ev_associate_region_and_handler (handler_obj, region_obj, acpi_ns_locked); return (AE_OK); } - handler_obj = handler_obj->addr_handler.link; + handler_obj = handler_obj->addr_handler.next; } /* while handlerobj */ } @@ -413,9 +403,9 @@ * This one does not have the handler we need * Pop up one level */ - entry = acpi_ns_get_parent_entry (entry); + node = acpi_ns_get_parent_object (node); - } /* while Entry != ROOT */ + } /* while Node != ROOT */ /* * If we get here, there is no handler for this region diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/events/evsci.c linux/drivers/acpi/events/evsci.c --- v2.4.0-test8/linux/drivers/acpi/events/evsci.c Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/events/evsci.c Fri Sep 15 14:30:30 2000 @@ -1,9 +1,10 @@ -/****************************************************************************** +/******************************************************************************* * * Module Name: evsci - System Control Interrupt configuration and * legacy to ACPI mode state transition functions + * $Revision: 59 $ * - *****************************************************************************/ + ******************************************************************************/ /* * Copyright (C) 2000 R. Byron Moore @@ -24,27 +25,26 @@ */ #include "acpi.h" -#include "namesp.h" -#include "hardware.h" -#include "events.h" +#include "acnamesp.h" +#include "achware.h" +#include "acevents.h" #define _COMPONENT EVENT_HANDLING - MODULE_NAME ("evsci"); + MODULE_NAME ("evsci") /* - * Elements correspond to counts for - * TMR, NOT_USED, GBL, PWR_BTN, SLP_BTN, RTC, - * and GENERAL respectively. These counts - * are modified by the ACPI interrupt handler... - * Note that GENERAL should probably be split out - * into one element for each bit in the GPE - * registers + * Elements correspond to counts for TMR, NOT_USED, GBL, PWR_BTN, SLP_BTN, RTC, + * and GENERAL respectively. These counts are modified by the ACPI interrupt + * handler. + * + * TBD: [Investigate] Note that GENERAL should probably be split out into + * one element for each bit in the GPE registers */ -/****************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_ev_sci_handler * @@ -61,16 +61,16 @@ u32 acpi_ev_sci_handler (void *context) { - u32 interrupt_handled = INTERRUPT_NOT_HANDLED; + u32 interrupt_handled = INTERRUPT_NOT_HANDLED; + /* - * ACPI Enabled? - * ------------- * 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, (s32)SCI_EN)) { - REPORT_ERROR ("Received and SCI but ACPI is not enabled."); + if (!acpi_hw_register_access (ACPI_READ, ACPI_MTX_DO_NOT_LOCK, SCI_EN)) { + /* ACPI is not enabled; this interrupt cannot be for us */ + return (INTERRUPT_NOT_HANDLED); } @@ -107,12 +107,12 @@ u32 acpi_ev_install_sci_handler (void) { - u32 except = AE_OK; + u32 except = AE_OK; + - except = acpi_os_install_interrupt_handler ( - (u32) acpi_gbl_FACP->sci_int, - acpi_ev_sci_handler, - NULL); + except = acpi_os_install_interrupt_handler ((u32) acpi_gbl_FACP->sci_int, + acpi_ev_sci_handler, + NULL); return (except); } @@ -163,24 +163,21 @@ #endif - acpi_os_remove_interrupt_handler ( - (u32) acpi_gbl_FACP->sci_int, - acpi_ev_sci_handler); + acpi_os_remove_interrupt_handler ((u32) acpi_gbl_FACP->sci_int, + acpi_ev_sci_handler); return (AE_OK); } -/****************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_ev_sci_count * - * PARAMETERS: char * Event_name name (fully qualified name from namespace - * or one of the fixed event names defined above) - * of the event to check if it's generated an SCI. + * PARAMETERS: Event Event that generated an SCI. * - * RETURN: Number of SCI's for requested event since last time i_sci_occured() - * was called for this event. + * RETURN: Number of SCI's for requested event since last time + * Sci_occured() was called for this event. * * DESCRIPTION: Checks to see if SCI has been generated from requested source * since the last time this function was called. @@ -188,7 +185,7 @@ ******************************************************************************/ -/****************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_ev_restore_acpi_state * @@ -203,7 +200,7 @@ void acpi_ev_restore_acpi_state (void) { - s32 index; + u32 index; /* Restore the state of the chipset enable bits. */ @@ -283,6 +280,7 @@ void acpi_ev_terminate (void) { + /* * Free global tables, etc. diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/events/evxface.c linux/drivers/acpi/events/evxface.c --- v2.4.0-test8/linux/drivers/acpi/events/evxface.c Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/events/evxface.c Fri Sep 15 14:30:30 2000 @@ -1,6 +1,7 @@ /****************************************************************************** * * Module Name: evxface - External interfaces for ACPI events + * $Revision: 88 $ * *****************************************************************************/ @@ -24,14 +25,14 @@ #include "acpi.h" -#include "hardware.h" -#include "namesp.h" -#include "events.h" +#include "achware.h" +#include "acnamesp.h" +#include "acevents.h" #include "amlcode.h" -#include "interp.h" +#include "acinterp.h" #define _COMPONENT EVENT_HANDLING - MODULE_NAME ("evxface"); + MODULE_NAME ("evxface") /****************************************************************************** @@ -172,9 +173,9 @@ NOTIFY_HANDLER handler, void *context) { - ACPI_OBJECT_INTERNAL *obj_desc; - ACPI_OBJECT_INTERNAL *notify_obj; - ACPI_NAMED_OBJECT *obj_entry; + ACPI_OPERAND_OBJECT *obj_desc; + ACPI_OPERAND_OBJECT *notify_obj; + ACPI_NAMESPACE_NODE *device_node; ACPI_STATUS status = AE_OK; @@ -190,8 +191,8 @@ acpi_cm_acquire_mutex (ACPI_MTX_NAMESPACE); - obj_entry = acpi_ns_convert_handle_to_entry (device); - if (!obj_entry) { + device_node = acpi_ns_convert_handle_to_entry (device); + if (!device_node) { status = AE_BAD_PARAMETER; goto unlock_and_exit; } @@ -217,13 +218,13 @@ } if (handler_type == ACPI_SYSTEM_NOTIFY) { - acpi_gbl_sys_notify.nte = obj_entry; + acpi_gbl_sys_notify.node = device_node; acpi_gbl_sys_notify.handler = handler; acpi_gbl_sys_notify.context = context; } else { - acpi_gbl_drv_notify.nte = obj_entry; + acpi_gbl_drv_notify.node = device_node; acpi_gbl_drv_notify.handler = handler; acpi_gbl_drv_notify.context = context; } @@ -239,10 +240,10 @@ * These are the ONLY objects that can receive ACPI notifications */ - if ((obj_entry->type != ACPI_TYPE_DEVICE) && - (obj_entry->type != ACPI_TYPE_PROCESSOR) && - (obj_entry->type != ACPI_TYPE_POWER) && - (obj_entry->type != ACPI_TYPE_THERMAL)) + if ((device_node->type != ACPI_TYPE_DEVICE) && + (device_node->type != ACPI_TYPE_PROCESSOR) && + (device_node->type != ACPI_TYPE_POWER) && + (device_node->type != ACPI_TYPE_THERMAL)) { status = AE_BAD_PARAMETER; goto unlock_and_exit; @@ -250,7 +251,7 @@ /* Check for an existing internal object */ - obj_desc = acpi_ns_get_attached_object ((ACPI_HANDLE) obj_entry); + obj_desc = acpi_ns_get_attached_object ((ACPI_HANDLE) device_node); if (obj_desc) { /* * The object exists. @@ -270,15 +271,15 @@ else { /* Create a new object */ - obj_desc = acpi_cm_create_internal_object (obj_entry->type); + obj_desc = acpi_cm_create_internal_object (device_node->type); if (!obj_desc) { status = AE_NO_MEMORY; goto unlock_and_exit; } - /* Attach new object to the NTE */ + /* Attach new object to the Node */ - status = acpi_ns_attach_object (device, obj_desc, (u8) obj_entry->type); + status = acpi_ns_attach_object (device, obj_desc, (u8) device_node->type); if (ACPI_FAILURE (status)) { goto unlock_and_exit; @@ -296,7 +297,7 @@ goto unlock_and_exit; } - notify_obj->notify_handler.nte = obj_entry; + notify_obj->notify_handler.node = device_node; notify_obj->notify_handler.handler = handler; notify_obj->notify_handler.context = context; @@ -337,9 +338,9 @@ u32 handler_type, NOTIFY_HANDLER handler) { - ACPI_OBJECT_INTERNAL *notify_obj; - ACPI_OBJECT_INTERNAL *obj_desc; - ACPI_NAMED_OBJECT *obj_entry; + ACPI_OPERAND_OBJECT *notify_obj; + ACPI_OPERAND_OBJECT *obj_desc; + ACPI_NAMESPACE_NODE *device_node; ACPI_STATUS status = AE_OK; @@ -355,8 +356,8 @@ /* Convert and validate the device handle */ - obj_entry = acpi_ns_convert_handle_to_entry (device); - if (!obj_entry) { + device_node = acpi_ns_convert_handle_to_entry (device); + if (!device_node) { status = AE_BAD_PARAMETER; goto unlock_and_exit; } @@ -365,10 +366,10 @@ * These are the ONLY objects that can receive ACPI notifications */ - if ((obj_entry->type != ACPI_TYPE_DEVICE) && - (obj_entry->type != ACPI_TYPE_PROCESSOR) && - (obj_entry->type != ACPI_TYPE_POWER) && - (obj_entry->type != ACPI_TYPE_THERMAL)) + if ((device_node->type != ACPI_TYPE_DEVICE) && + (device_node->type != ACPI_TYPE_PROCESSOR) && + (device_node->type != ACPI_TYPE_POWER) && + (device_node->type != ACPI_TYPE_THERMAL)) { status = AE_BAD_PARAMETER; goto unlock_and_exit; @@ -376,7 +377,7 @@ /* Check for an existing internal object */ - obj_desc = acpi_ns_get_attached_object ((ACPI_HANDLE) obj_entry); + obj_desc = acpi_ns_get_attached_object ((ACPI_HANDLE) device_node); if (!obj_desc) { status = AE_NOT_EXIST; goto unlock_and_exit; @@ -573,7 +574,7 @@ acpi_aml_exit_interpreter (); *out_handle = 0; - return status; + return (status); } @@ -598,7 +599,7 @@ /* TBD: [Restructure] Validate handle */ acpi_ev_release_global_lock (); - return AE_OK; + return (AE_OK); } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/events/evxfevnt.c linux/drivers/acpi/events/evxfevnt.c --- v2.4.0-test8/linux/drivers/acpi/events/evxfevnt.c Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/events/evxfevnt.c Fri Sep 15 14:30:30 2000 @@ -1,6 +1,7 @@ /****************************************************************************** * * Module Name: evxfevnt - External Interfaces, ACPI event disable/enable + * $Revision: 19 $ * *****************************************************************************/ @@ -24,16 +25,24 @@ #include "acpi.h" -#include "hardware.h" -#include "namesp.h" -#include "events.h" +#include "achware.h" +#include "acnamesp.h" +#include "acevents.h" #include "amlcode.h" -#include "interp.h" +#include "acinterp.h" #define _COMPONENT EVENT_HANDLING - MODULE_NAME ("evxfevnt"); + MODULE_NAME ("evxfevnt") +ACPI_STATUS +acpi_ev_find_pci_root_buses ( + void); + +ACPI_STATUS +acpi_ev_init_devices ( + void); + /************************************************************************** * * FUNCTION: Acpi_enable @@ -60,12 +69,27 @@ 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(); /* @@ -74,24 +98,28 @@ * before handers are installed. */ - if (ACPI_FAILURE (acpi_ev_fixed_event_initialize ())) { - return (AE_ERROR); + status = acpi_ev_fixed_event_initialize (); + if (ACPI_FAILURE (status)) { + return (status); } - if (ACPI_FAILURE (acpi_ev_gpe_initialize())) { - return (AE_ERROR); + status = acpi_ev_gpe_initialize (); + if (ACPI_FAILURE (status)) { + return (status); } /* Install the SCI handler */ - if (ACPI_FAILURE (acpi_ev_install_sci_handler ())) { - return (AE_ERROR); + status = acpi_ev_install_sci_handler (); + if (ACPI_FAILURE (status)) { + return (status); } /* Transition to ACPI mode */ - if (AE_OK != acpi_hw_set_mode (SYS_MODE_ACPI)) { - return (AE_ERROR); + status = acpi_hw_set_mode (SYS_MODE_ACPI); + if (ACPI_FAILURE (status)) { + return (status); } /* Install handlers for control method GPE handlers (_Lxx, _Exx) */ @@ -100,6 +128,26 @@ 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); } @@ -120,12 +168,14 @@ ACPI_STATUS acpi_disable (void) { + ACPI_STATUS status; /* Restore original mode */ - if (AE_OK != acpi_hw_set_mode (acpi_gbl_original_mode)) { - return (AE_ERROR); + status = acpi_hw_set_mode (acpi_gbl_original_mode); + if (ACPI_FAILURE (status)) { + return (status); } /* Unload the SCI interrupt handler */ @@ -133,7 +183,7 @@ acpi_ev_remove_sci_handler (); acpi_ev_restore_acpi_state (); - return (AE_OK); + return (status); } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/events/evxfregn.c linux/drivers/acpi/events/evxfregn.c --- v2.4.0-test8/linux/drivers/acpi/events/evxfregn.c Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/events/evxfregn.c Fri Sep 15 14:30:30 2000 @@ -2,6 +2,7 @@ * * Module Name: evxfregn - External Interfaces, ACPI Operation Regions and * Address Spaces. + * $Revision: 20 $ * *****************************************************************************/ @@ -25,14 +26,14 @@ #include "acpi.h" -#include "hardware.h" -#include "namesp.h" -#include "events.h" +#include "achware.h" +#include "acnamesp.h" +#include "acevents.h" #include "amlcode.h" -#include "interp.h" +#include "acinterp.h" #define _COMPONENT EVENT_HANDLING - MODULE_NAME ("evxfregn"); + MODULE_NAME ("evxfregn") /****************************************************************************** @@ -59,9 +60,9 @@ ADDRESS_SPACE_SETUP setup, void *context) { - ACPI_OBJECT_INTERNAL *obj_desc; - ACPI_OBJECT_INTERNAL *handler_obj; - ACPI_NAMED_OBJECT *obj_entry; + ACPI_OPERAND_OBJECT *obj_desc; + ACPI_OPERAND_OBJECT *handler_obj; + ACPI_NAMESPACE_NODE *node; ACPI_STATUS status = AE_OK; OBJECT_TYPE_INTERNAL type; u16 flags = 0; @@ -80,8 +81,8 @@ /* Convert and validate the device handle */ - obj_entry = acpi_ns_convert_handle_to_entry (device); - if (!obj_entry) { + node = acpi_ns_convert_handle_to_entry (device); + if (!node) { status = AE_BAD_PARAMETER; goto unlock_and_exit; } @@ -92,10 +93,10 @@ * get placed. */ - if ((obj_entry->type != ACPI_TYPE_DEVICE) && - (obj_entry->type != ACPI_TYPE_PROCESSOR) && - (obj_entry->type != ACPI_TYPE_THERMAL) && - (obj_entry != acpi_gbl_root_object)) + if ((node->type != ACPI_TYPE_DEVICE) && + (node->type != ACPI_TYPE_PROCESSOR) && + (node->type != ACPI_TYPE_THERMAL) && + (node != acpi_gbl_root_node)) { status = AE_BAD_PARAMETER; goto unlock_and_exit; @@ -139,7 +140,7 @@ * Check for an existing internal object */ - obj_desc = acpi_ns_get_attached_object ((ACPI_HANDLE) obj_entry); + obj_desc = acpi_ns_get_attached_object ((ACPI_HANDLE) node); if (obj_desc) { /* * The object exists. @@ -162,19 +163,19 @@ /* * Move through the linked list of handlers */ - handler_obj = handler_obj->addr_handler.link; + handler_obj = handler_obj->addr_handler.next; } } else { /* Obj_desc does not exist, create one */ - if (obj_entry->type == ACPI_TYPE_ANY) { + if (node->type == ACPI_TYPE_ANY) { type = ACPI_TYPE_DEVICE; } else { - type = obj_entry->type; + type = node->type; } obj_desc = acpi_cm_create_internal_object (type); @@ -187,19 +188,13 @@ obj_desc->common.type = (u8) type; - /* Attach the new object to the NTE */ + /* Attach the new object to the Node */ status = acpi_ns_attach_object (device, obj_desc, (u8) type); if (ACPI_FAILURE (status)) { acpi_cm_remove_reference (obj_desc); goto unlock_and_exit; } - - /* TBD: [Investigate] Will this always be of type DEVICE? */ - - if (type == ACPI_TYPE_DEVICE) { - obj_desc->device.handle = device; - } } /* @@ -215,11 +210,11 @@ goto unlock_and_exit; } - handler_obj->addr_handler.space_id = (u16) space_id; + handler_obj->addr_handler.space_id = (u8) space_id; handler_obj->addr_handler.hflags = flags; - handler_obj->addr_handler.link = obj_desc->device.addr_handler; + handler_obj->addr_handler.next = obj_desc->device.addr_handler; handler_obj->addr_handler.region_list = NULL; - handler_obj->addr_handler.nte = obj_entry; + handler_obj->addr_handler.node = node; handler_obj->addr_handler.handler = handler; handler_obj->addr_handler.context = context; handler_obj->addr_handler.setup = setup; @@ -237,7 +232,7 @@ * of the branch */ status = acpi_ns_walk_namespace (ACPI_TYPE_ANY, device, - ACPI_INT32_MAX, NS_WALK_NO_UNLOCK, + ACPI_UINT32_MAX, NS_WALK_UNLOCK, acpi_ev_addr_handler_helper, handler_obj, NULL); @@ -276,11 +271,11 @@ ACPI_ADDRESS_SPACE_TYPE space_id, ADDRESS_SPACE_HANDLER handler) { - ACPI_OBJECT_INTERNAL *obj_desc; - ACPI_OBJECT_INTERNAL *handler_obj; - ACPI_OBJECT_INTERNAL *region_obj; - ACPI_OBJECT_INTERNAL **last_obj_ptr; - ACPI_NAMED_OBJECT *obj_entry; + ACPI_OPERAND_OBJECT *obj_desc; + ACPI_OPERAND_OBJECT *handler_obj; + ACPI_OPERAND_OBJECT *region_obj; + ACPI_OPERAND_OBJECT **last_obj_ptr; + ACPI_NAMESPACE_NODE *node; ACPI_STATUS status = AE_OK; @@ -297,8 +292,8 @@ /* Convert and validate the device handle */ - obj_entry = acpi_ns_convert_handle_to_entry (device); - if (!obj_entry) { + node = acpi_ns_convert_handle_to_entry (device); + if (!node) { status = AE_BAD_PARAMETER; goto unlock_and_exit; } @@ -306,7 +301,7 @@ /* Make sure the internal object exists */ - obj_desc = acpi_ns_get_attached_object ((ACPI_HANDLE) obj_entry); + obj_desc = acpi_ns_get_attached_object ((ACPI_HANDLE) node); if (!obj_desc) { /* * The object DNE. @@ -356,7 +351,7 @@ /* * Remove this Handler object from the list */ - *last_obj_ptr = handler_obj->addr_handler.link; + *last_obj_ptr = handler_obj->addr_handler.next; /* * Now we can delete the handler object @@ -370,8 +365,8 @@ /* * Move through the linked list of handlers */ - last_obj_ptr = &handler_obj->addr_handler.link; - handler_obj = handler_obj->addr_handler.link; + last_obj_ptr = &handler_obj->addr_handler.next; + handler_obj = handler_obj->addr_handler.next; } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/hardware/Makefile linux/drivers/acpi/hardware/Makefile --- v2.4.0-test8/linux/drivers/acpi/hardware/Makefile Wed Dec 31 16:00:00 1969 +++ linux/drivers/acpi/hardware/Makefile Fri Sep 15 18:21:43 2000 @@ -0,0 +1,28 @@ +# +# 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)) + +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: + $(RM) *.o diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/hardware/hwacpi.c linux/drivers/acpi/hardware/hwacpi.c --- v2.4.0-test8/linux/drivers/acpi/hardware/hwacpi.c Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/hardware/hwacpi.c Fri Sep 15 14:30:30 2000 @@ -1,7 +1,7 @@ - /****************************************************************************** * * Module Name: hwacpi - ACPI hardware functions - mode and timer + * $Revision: 22 $ * *****************************************************************************/ @@ -25,11 +25,11 @@ #include "acpi.h" -#include "hardware.h" +#include "achware.h" #define _COMPONENT HARDWARE - MODULE_NAME ("hwacpi"); + MODULE_NAME ("hwacpi") /****************************************************************************** @@ -95,7 +95,7 @@ { - if (acpi_hw_register_access (ACPI_READ, ACPI_MTX_LOCK, (s32)SCI_EN)) { + if (acpi_hw_register_access (ACPI_READ, ACPI_MTX_LOCK, SCI_EN)) { return (SYS_MODE_ACPI); } else { diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/hardware/hwcpu32.c linux/drivers/acpi/hardware/hwcpu32.c --- v2.4.0-test8/linux/drivers/acpi/hardware/hwcpu32.c Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/hardware/hwcpu32.c Fri Sep 15 14:30:30 2000 @@ -1,6 +1,7 @@ /****************************************************************************** * * Name: hwcpu32.c - CPU support for IA32 (Throttling, Cx_states) + * $Revision: 33 $ * *****************************************************************************/ @@ -23,11 +24,11 @@ */ #include "acpi.h" -#include "namesp.h" -#include "hardware.h" +#include "acnamesp.h" +#include "achware.h" #define _COMPONENT HARDWARE - MODULE_NAME ("Hwcpu32"); + MODULE_NAME ("Hwcpu32") #define BIT_4 0x10 /* TBD: [investigate] is this correct? */ @@ -82,7 +83,7 @@ *pm_timer_ticks = timer; } - return AE_OK; + return (AE_OK); } @@ -108,7 +109,7 @@ if (!pblk_address || !pm_timer_ticks) { - return AE_BAD_PARAMETER; + return (AE_BAD_PARAMETER); } /* @@ -146,7 +147,7 @@ */ enable (); - return AE_OK; + return (AE_OK); } @@ -175,7 +176,7 @@ if (!pblk_address || !pm_timer_ticks) { - return AE_BAD_PARAMETER; + return (AE_BAD_PARAMETER); } /* @@ -186,14 +187,14 @@ * eventually cause a demotion to C2 */ if (1 == (bus_master_status = - acpi_hw_register_access (ACPI_READ, ACPI_MTX_LOCK, (s32)BM_STS))) + acpi_hw_register_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, (s32)BM_STS, 1); + acpi_hw_register_access (ACPI_WRITE, ACPI_MTX_LOCK, BM_STS, 1); *pm_timer_ticks = 0; - return AE_OK; + return (AE_OK); } /* @@ -253,7 +254,7 @@ */ enable(); - return AE_OK; + return (AE_OK); } @@ -277,7 +278,7 @@ { if (!acpi_hw_cx_handlers[acpi_hw_active_cx_state]) { - return AE_SUPPORT; + return (AE_SUPPORT); } return (acpi_hw_cx_handlers[acpi_hw_active_cx_state] (pblk_address, pm_timer_ticks)); @@ -305,11 +306,11 @@ * ---------------- */ if ((cx_state < 1) || (cx_state > 3)) { - return AE_BAD_PARAMETER; + return (AE_BAD_PARAMETER); } if (!acpi_hw_cx_handlers[cx_state]) { - return AE_SUPPORT; + return (AE_SUPPORT); } /* @@ -318,7 +319,7 @@ * We only care when moving from one state to another... */ if (acpi_hw_active_cx_state == cx_state) { - return AE_OK; + return (AE_OK); } /* @@ -331,7 +332,7 @@ switch (cx_state) { case 3: - acpi_hw_register_access (ACPI_WRITE, ACPI_MTX_LOCK, (s32)BM_RLD, 1); + acpi_hw_register_access (ACPI_WRITE, ACPI_MTX_LOCK, BM_RLD, 1); break; } @@ -345,7 +346,7 @@ switch (acpi_hw_active_cx_state) { case 3: - acpi_hw_register_access (ACPI_WRITE, ACPI_MTX_LOCK, (s32)BM_RLD, 0); + acpi_hw_register_access (ACPI_WRITE, ACPI_MTX_LOCK, BM_RLD, 0); break; } @@ -355,7 +356,7 @@ */ acpi_hw_active_cx_state = cx_state; - return AE_OK; + return (AE_OK); } @@ -526,7 +527,7 @@ result = result * x; } - return result; + return (result); } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/hardware/hwgpe.c linux/drivers/acpi/hardware/hwgpe.c --- v2.4.0-test8/linux/drivers/acpi/hardware/hwgpe.c Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/hardware/hwgpe.c Fri Sep 15 14:30:30 2000 @@ -1,6 +1,7 @@ /****************************************************************************** * * Module Name: hwgpe - Low level GPE enable/disable/clear functions + * $Revision: 22 $ * *****************************************************************************/ @@ -23,12 +24,12 @@ */ #include "acpi.h" -#include "hardware.h" -#include "namesp.h" -#include "events.h" +#include "achware.h" +#include "acnamesp.h" +#include "acevents.h" #define _COMPONENT HARDWARE - MODULE_NAME ("hwgpe"); + MODULE_NAME ("hwgpe") u8 decode_to8bit [8] = {1,2,4,8,16,32,64,128}; diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/hardware/hwregs.c linux/drivers/acpi/hardware/hwregs.c --- v2.4.0-test8/linux/drivers/acpi/hardware/hwregs.c Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/hardware/hwregs.c Fri Sep 15 14:30:30 2000 @@ -1,10 +1,11 @@ -/****************************************************************************** +/******************************************************************************* * * Module Name: hwregs - Read/write access functions for the various ACPI * control and status registers. + * $Revision: 67 $ * - *****************************************************************************/ + ******************************************************************************/ /* * Copyright (C) 2000 R. Byron Moore @@ -26,20 +27,20 @@ #include "acpi.h" -#include "hardware.h" -#include "namesp.h" +#include "achware.h" +#include "acnamesp.h" #define _COMPONENT HARDWARE - MODULE_NAME ("hwregs"); + MODULE_NAME ("hwregs") /* This matches the #defines in actypes.h. */ -ACPI_STRING sleep_state_table[] = {"\\_S0_","\\_S1_","\\_S2_","\\_S3_", +NATIVE_CHAR *sleep_state_table[] = {"\\_S0_","\\_S1_","\\_S2_","\\_S3_", "\\_S4_","\\_S4_b","\\_S5_"}; -/****************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_hw_get_bit_shift * @@ -52,11 +53,11 @@ * ******************************************************************************/ -s32 +u32 acpi_hw_get_bit_shift ( u32 mask) { - s32 shift; + u32 shift; for (shift = 0; ((mask >> shift) & 1) == 0; shift++) { ; } @@ -65,7 +66,7 @@ } -/****************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_hw_clear_acpi_status * @@ -116,7 +117,7 @@ } -/**************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_hw_obtain_sleep_type_register_data * @@ -129,8 +130,7 @@ * DESCRIPTION: Acpi_hw_obtain_sleep_type_register_data() obtains the SLP_TYP and * SLP_TYPb values for the sleep state requested. * - - ***************************************************************************/ + ******************************************************************************/ ACPI_STATUS acpi_hw_obtain_sleep_type_register_data ( @@ -139,7 +139,7 @@ u8 *slp_typ_b) { ACPI_STATUS status = AE_OK; - ACPI_OBJECT_INTERNAL *obj_desc; + ACPI_OPERAND_OBJECT *obj_desc; /* @@ -157,45 +157,64 @@ */ status = acpi_ns_evaluate_by_name (sleep_state_table[sleep_state], NULL, &obj_desc); - if (AE_OK == status) { - if (obj_desc) { - /* - * We got something, now ensure it is correct. The object must - * be a package and must have at least 2 numeric values as the - * two elements - */ + if (ACPI_FAILURE (status)) { + return (status); + } - if ((obj_desc->common.type != ACPI_TYPE_PACKAGE) || - ((obj_desc->package.elements[0])->common.type != - ACPI_TYPE_NUMBER) || - ((obj_desc->package.elements[1])->common.type != - ACPI_TYPE_NUMBER)) - { - /* Invalid _Sx_ package type or value */ + if (!obj_desc) { + REPORT_ERROR ("Missing Sleep State object"); + return (AE_NOT_EXIST); + } - REPORT_ERROR ("Object type returned from interpreter differs from expected value"); - status = AE_ERROR; - } - else { - /* - * Valid _Sx_ package size, type, and value - */ - *slp_typ_a = - (u8) (obj_desc->package.elements[0])->number.value; + /* + * We got something, now ensure it is correct. The object must + * be a package and must have at least 2 numeric values as the + * two elements + */ - *slp_typ_b = - (u8) (obj_desc->package.elements[1])->number.value; - } + if (obj_desc->common.type != ACPI_TYPE_PACKAGE) { + /* Must be a package */ - acpi_cm_remove_reference (obj_desc); - } + REPORT_ERROR ("Sleep State object is not of type Package"); + status = AE_ERROR; + } + + else if (obj_desc->package.count < 2) { + /* Must have at least two elements */ + + REPORT_ERROR ("Sleep State package does not have at least two elements"); + status = AE_ERROR; + } + + else if (((obj_desc->package.elements[0])->common.type != + ACPI_TYPE_NUMBER) || + ((obj_desc->package.elements[1])->common.type != + ACPI_TYPE_NUMBER)) + { + /* Must have two */ + + REPORT_ERROR ("Sleep State package elements are not both of type Number"); + status = AE_ERROR; } + else { + /* + * Valid _Sx_ package size, type, and value + */ + *slp_typ_a = (u8) (obj_desc->package.elements[0])->number.value; + + *slp_typ_b = (u8) (obj_desc->package.elements[1])->number.value; + } + + + + acpi_cm_remove_reference (obj_desc); + return (status); } -/****************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_hw_register_access * @@ -229,7 +248,7 @@ va_list marker; va_start (marker, register_id); - value = va_arg (marker, s32); + value = va_arg (marker, u32); va_end (marker); } @@ -407,7 +426,7 @@ register_value = (u32) acpi_os_in16 (acpi_gbl_FACP->pm1a_cnt_blk); } - if (acpi_gbl_FACP->pm1b_cnt_blk && register_id != (s32) SLP_TYPE_A) { + 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); } @@ -469,7 +488,7 @@ } } - if (acpi_gbl_FACP->pm1b_cnt_blk && register_id != (s32) SLP_TYPE_A) { + 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); } } @@ -551,13 +570,17 @@ mask = (((u32) register_id) & BIT_IN_REGISTER_MASK); mask = 1 << (mask-1); - /* 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 */ - - /* 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 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 + */ + + /* + * 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 + */ if (mask > LOW_BYTE) { /* Shift the value 1 byte to the right and add 1 to the register */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/hardware/hwxface.c linux/drivers/acpi/hardware/hwxface.c --- v2.4.0-test8/linux/drivers/acpi/hardware/hwxface.c Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/hardware/hwxface.c Fri Sep 15 14:30:30 2000 @@ -2,6 +2,7 @@ /****************************************************************************** * * Name: hwxface.c - Hardware access external interfaces + * $Revision: 31 $ * *****************************************************************************/ @@ -24,11 +25,11 @@ */ #include "acpi.h" -#include "namesp.h" -#include "hardware.h" +#include "acnamesp.h" +#include "achware.h" #define _COMPONENT HARDWARE - MODULE_NAME ("hwxface"); + MODULE_NAME ("hwxface") /****************************************************************************** @@ -68,10 +69,9 @@ NATIVE_UINT num_throttle_states; NATIVE_UINT buffer_space_needed; NATIVE_UINT i; - u8 duty_offset; - u8 duty_width; - ACPI_NAMED_OBJECT *cpu_entry; - ACPI_OBJECT_INTERNAL *cpu_obj; + u8 duty_width = 0; + ACPI_NAMESPACE_NODE *cpu_node; + ACPI_OPERAND_OBJECT *cpu_obj; ACPI_CPU_THROTTLING_STATE *state_ptr; @@ -86,8 +86,8 @@ * Convert and validate the device handle */ - cpu_entry = acpi_ns_convert_handle_to_entry (processor_handle); - if (!cpu_entry) { + cpu_node = acpi_ns_convert_handle_to_entry (processor_handle); + if (!cpu_node) { return (AE_BAD_PARAMETER); } @@ -95,23 +95,27 @@ * Check for an existing internal object */ - cpu_obj = acpi_ns_get_attached_object ((ACPI_HANDLE) cpu_entry); + cpu_obj = acpi_ns_get_attached_object ((ACPI_HANDLE) cpu_node); if (!cpu_obj) { return (AE_NOT_FOUND); } - duty_offset = acpi_gbl_FACP->duty_offset; +#ifndef _IA64 + /* + * No Duty fields in IA64 tables + */ duty_width = acpi_gbl_FACP->duty_width; +#endif /* * P0 must always have a P_BLK all others may be null - * in either case, we can't thottle a processor that has no P_BLK + * in either case, we can't throttle a processor that has no P_BLK * * Also if no Duty width, one state and it is 100% * */ - if (!cpu_obj->processor.pblk_length || !duty_width || - (0xFFFF < cpu_obj->processor.pblk_address)) + if (!cpu_obj->processor.length || !duty_width || + (0xFFFF < cpu_obj->processor.address)) { /* * Acpi_even though we can't throttle, we still have one state (100%) @@ -169,30 +173,35 @@ ACPI_HANDLE processor_handle, u32 *throttle_state) { - ACPI_NAMED_OBJECT *cpu_entry; - ACPI_OBJECT_INTERNAL *cpu_obj; + ACPI_NAMESPACE_NODE *cpu_node; + ACPI_OPERAND_OBJECT *cpu_obj; u32 num_throttle_states; u32 duty_cycle; - u8 duty_offset; - u8 duty_width; + u8 duty_offset = 0; + u8 duty_width = 0; /* Convert and validate the device handle */ - cpu_entry = acpi_ns_convert_handle_to_entry (processor_handle); - if (!cpu_entry || !throttle_state) { + cpu_node = acpi_ns_convert_handle_to_entry (processor_handle); + if (!cpu_node || !throttle_state) { return (AE_BAD_PARAMETER); } /* Check for an existing internal object */ - cpu_obj = acpi_ns_get_attached_object ((ACPI_HANDLE) cpu_entry); + cpu_obj = acpi_ns_get_attached_object ((ACPI_HANDLE) cpu_node); if (!cpu_obj) { 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 /* * Must have a valid P_BLK P0 must have a P_BLK all others may be null @@ -201,8 +210,8 @@ * * also, if Duty_width is zero there are no additional states */ - if (!cpu_obj->processor.pblk_length || !duty_width || - (0xFFFF < cpu_obj->processor.pblk_address)) + if (!cpu_obj->processor.length || !duty_width || + (0xFFFF < cpu_obj->processor.address)) { *throttle_state = 0; return(AE_OK); @@ -214,7 +223,7 @@ * Get the current duty cycle value. */ duty_cycle = acpi_hw_get_duty_cycle (duty_offset, - cpu_obj->processor.pblk_address, + cpu_obj->processor.address, num_throttle_states); /* @@ -251,8 +260,8 @@ ACPI_HANDLE processor_handle, u32 throttle_state) { - ACPI_NAMED_OBJECT *cpu_entry; - ACPI_OBJECT_INTERNAL *cpu_obj; + ACPI_NAMESPACE_NODE *cpu_node; + ACPI_OPERAND_OBJECT *cpu_obj; u32 num_throttle_states = 0; u8 duty_offset = 0; u8 duty_width = 0; @@ -261,20 +270,25 @@ /* Convert and validate the device handle */ - cpu_entry = acpi_ns_convert_handle_to_entry (processor_handle); - if (!cpu_entry) { + cpu_node = acpi_ns_convert_handle_to_entry (processor_handle); + if (!cpu_node) { return (AE_BAD_PARAMETER); } /* Check for an existing internal object */ - cpu_obj = acpi_ns_get_attached_object ((ACPI_HANDLE) cpu_entry); + cpu_obj = acpi_ns_get_attached_object ((ACPI_HANDLE) cpu_node); if (!cpu_obj) { 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 /* * Must have a valid P_BLK P0 must have a P_BLK all others may be null @@ -283,8 +297,8 @@ * * also, if Duty_width is zero there are no additional states */ - if (!cpu_obj->processor.pblk_length || !duty_width || - (0xFFFF < cpu_obj->processor.pblk_address)) + if (!cpu_obj->processor.length || !duty_width || + (0xFFFF < cpu_obj->processor.address)) { /* * If caller wants to set the state to the only state we handle @@ -312,19 +326,19 @@ /* * Turn off throttling (don't muck with the h/w while throttling). */ - acpi_hw_disable_throttling (cpu_obj->processor.pblk_address); + acpi_hw_disable_throttling (cpu_obj->processor.address); /* * Program the throttling state. */ acpi_hw_program_duty_cycle (duty_offset, duty_cycle, - cpu_obj->processor.pblk_address, num_throttle_states); + cpu_obj->processor.address, num_throttle_states); /* * Only enable throttling for non-zero states (0 - 100%) */ if (throttle_state) { - acpi_hw_enable_throttling (cpu_obj->processor.pblk_address); + acpi_hw_enable_throttling (cpu_obj->processor.address); } return(AE_OK); @@ -438,9 +452,9 @@ ACPI_HANDLE processor_handle, u32 *pm_timer_ticks) { - ACPI_NAMED_OBJECT *cpu_entry = NULL; - ACPI_OBJECT_INTERNAL *cpu_obj = NULL; - ACPI_IO_ADDRESS pblk_address = 0; + ACPI_NAMESPACE_NODE *cpu_node = NULL; + ACPI_OPERAND_OBJECT *cpu_obj = NULL; + ACPI_IO_ADDRESS address = 0; /* @@ -449,31 +463,31 @@ /* Convert and validate the device handle */ - cpu_entry = acpi_ns_convert_handle_to_entry (processor_handle); - if (!cpu_entry) { - return AE_BAD_PARAMETER; + cpu_node = acpi_ns_convert_handle_to_entry (processor_handle); + if (!cpu_node) { + return (AE_BAD_PARAMETER); } /* Check for an existing internal object */ - cpu_obj = acpi_ns_get_attached_object ((ACPI_HANDLE) cpu_entry); + cpu_obj = acpi_ns_get_attached_object ((ACPI_HANDLE) cpu_node); if (!cpu_obj) { - return AE_NOT_FOUND; + return (AE_NOT_FOUND); } /* Get the processor register block (P_BLK) address */ - pblk_address = cpu_obj->processor.pblk_address; - if (!cpu_obj->processor.pblk_length) { + address = cpu_obj->processor.address; + if (!cpu_obj->processor.length) { /* Ensure a NULL addresss (note that P_BLK isn't required for C1) */ - pblk_address = 0; + address = 0; } /* * Enter the currently active Cx sleep state. */ - return acpi_hw_enter_cx (pblk_address, pm_timer_ticks); + return (acpi_hw_enter_cx (address, pm_timer_ticks)); } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/include/accommon.h linux/drivers/acpi/include/accommon.h --- v2.4.0-test8/linux/drivers/acpi/include/accommon.h Wed Dec 31 16:00:00 1969 +++ linux/drivers/acpi/include/accommon.h Fri Sep 15 14:30:30 2000 @@ -0,0 +1,661 @@ +/****************************************************************************** + * + * Name: accommon.h -- prototypes for the common (subsystem-wide) procedures + * $Revision: 74 $ + * + *****************************************************************************/ + +/* + * 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 _ACCOMMON_H +#define _ACCOMMON_H + + +#define REF_INCREMENT (u16) 0 +#define REF_DECREMENT (u16) 1 +#define REF_FORCE_DELETE (u16) 2 + +/* Acpi_cm_dump_buffer */ + +#define DB_BYTE_DISPLAY 1 +#define DB_WORD_DISPLAY 2 +#define DB_DWORD_DISPLAY 4 +#define DB_QWORD_DISPLAY 8 + + +/* Global initialization interfaces */ + +void +acpi_cm_init_globals ( + ACPI_INIT_DATA *init_data); + +void +acpi_cm_terminate ( + void); + + +/* + * Acpi_cm_init - miscellaneous initialization and shutdown + */ + +ACPI_STATUS +acpi_cm_hardware_initialize ( + void); + +ACPI_STATUS +acpi_cm_subsystem_shutdown ( + void); + +/* + * Acpi_cm_global - Global data structures and procedures + */ + +NATIVE_CHAR * +acpi_cm_get_mutex_name ( + u32 mutex_id); + +NATIVE_CHAR * +acpi_cm_get_type_name ( + u32 type); + +u8 +acpi_cm_valid_object_type ( + u32 type); + +ACPI_OWNER_ID +acpi_cm_allocate_owner_id ( + u32 id_type); + + +/* + * Acpi_cm_clib - Local implementations of C library functions + */ + +NATIVE_UINT +acpi_cm_strlen ( + const NATIVE_CHAR *string); + +NATIVE_CHAR * +acpi_cm_strcpy ( + NATIVE_CHAR *dst_string, + const NATIVE_CHAR *src_string); + +NATIVE_CHAR * +acpi_cm_strncpy ( + NATIVE_CHAR *dst_string, + const NATIVE_CHAR *src_string, + NATIVE_UINT count); + +u32 +acpi_cm_strncmp ( + const NATIVE_CHAR *string1, + const NATIVE_CHAR *string2, + NATIVE_UINT count); + +u32 +acpi_cm_strcmp ( + const NATIVE_CHAR *string1, + const NATIVE_CHAR *string2); + +NATIVE_CHAR * +acpi_cm_strcat ( + NATIVE_CHAR *dst_string, + const NATIVE_CHAR *src_string); + +NATIVE_CHAR * +acpi_cm_strncat ( + NATIVE_CHAR *dst_string, + const NATIVE_CHAR *src_string, + NATIVE_UINT count); + +u32 +acpi_cm_strtoul ( + const NATIVE_CHAR *string, + NATIVE_CHAR **terminator, + u32 base); + +NATIVE_CHAR * +acpi_cm_strstr ( + NATIVE_CHAR *string1, + NATIVE_CHAR *string2); + +NATIVE_CHAR * +acpi_cm_strupr ( + NATIVE_CHAR *src_string); + +void * +acpi_cm_memcpy ( + void *dest, + const void *src, + NATIVE_UINT count); + +void * +acpi_cm_memset ( + void *dest, + u32 value, + NATIVE_UINT count); + +u32 +acpi_cm_to_upper ( + u32 c); + +u32 +acpi_cm_to_lower ( + u32 c); + + +/* + * Acpi_cm_copy - Object construction and conversion interfaces + */ + +ACPI_STATUS +acpi_cm_build_simple_object( + ACPI_OPERAND_OBJECT *obj, + ACPI_OBJECT *user_obj, + u8 *data_space, + u32 *buffer_space_used); + +ACPI_STATUS +acpi_cm_build_package_object ( + ACPI_OPERAND_OBJECT *obj, + u8 *buffer, + u32 *space_used); + +ACPI_STATUS +acpi_cm_build_external_object ( + ACPI_OPERAND_OBJECT *obj, + ACPI_BUFFER *ret_buffer); + +ACPI_STATUS +acpi_cm_build_internal_simple_object( + ACPI_OBJECT *user_obj, + ACPI_OPERAND_OBJECT *obj); + +ACPI_STATUS +acpi_cm_build_internal_object ( + ACPI_OBJECT *obj, + ACPI_OPERAND_OBJECT *internal_obj); + +ACPI_STATUS +acpi_cm_copy_internal_simple_object ( + ACPI_OPERAND_OBJECT *source_obj, + ACPI_OPERAND_OBJECT *dest_obj); + +ACPI_STATUS +acpi_cm_build_copy_internal_package_object ( + ACPI_OPERAND_OBJECT *source_obj, + ACPI_OPERAND_OBJECT *dest_obj); + + +/* + * Acpi_cm_create - Object creation + */ + +ACPI_STATUS +acpi_cm_update_object_reference ( + ACPI_OPERAND_OBJECT *object, + u16 action); + +ACPI_OPERAND_OBJECT * +_cm_create_internal_object ( + NATIVE_CHAR *module_name, + u32 line_number, + u32 component_id, + OBJECT_TYPE_INTERNAL type); + + +/* + * Acpi_cm_debug - Debug interfaces + */ + +u32 +get_debug_level ( + void); + +void +set_debug_level ( + u32 level); + +void +function_trace ( + NATIVE_CHAR *module_name, + u32 line_number, + u32 component_id, + NATIVE_CHAR *function_name); + +void +function_trace_ptr ( + NATIVE_CHAR *module_name, + u32 line_number, + u32 component_id, + NATIVE_CHAR *function_name, + void *pointer); + +void +function_trace_u32 ( + NATIVE_CHAR *module_name, + u32 line_number, + u32 component_id, + NATIVE_CHAR *function_name, + u32 integer); + +void +function_trace_str ( + NATIVE_CHAR *module_name, + u32 line_number, + u32 component_id, + NATIVE_CHAR *function_name, + NATIVE_CHAR *string); + +void +function_exit ( + NATIVE_CHAR *module_name, + u32 line_number, + u32 component_id, + NATIVE_CHAR *function_name); + +void +function_status_exit ( + NATIVE_CHAR *module_name, + u32 line_number, + u32 component_id, + NATIVE_CHAR *function_name, + ACPI_STATUS status); + +void +function_value_exit ( + NATIVE_CHAR *module_name, + u32 line_number, + u32 component_id, + NATIVE_CHAR *function_name, + NATIVE_UINT value); + +void +function_ptr_exit ( + NATIVE_CHAR *module_name, + u32 line_number, + u32 component_id, + NATIVE_CHAR *function_name, + u8 *ptr); + +void +debug_print_prefix ( + NATIVE_CHAR *module_name, + u32 line_number); + +void +debug_print ( + NATIVE_CHAR *module_name, + u32 line_number, + u32 component_id, + u32 print_level, + NATIVE_CHAR *format, ...); + +void +debug_print_raw ( + NATIVE_CHAR *format, ...); + +void +_report_info ( + NATIVE_CHAR *module_name, + u32 line_number, + u32 component_id, + NATIVE_CHAR *message); + +void +_report_error ( + NATIVE_CHAR *module_name, + u32 line_number, + u32 component_id, + NATIVE_CHAR *message); + +void +_report_warning ( + NATIVE_CHAR *module_name, + u32 line_number, + u32 component_id, + NATIVE_CHAR *message); + +void +acpi_cm_dump_buffer ( + u8 *buffer, + u32 count, + u32 display, + u32 component_id); + + +/* + * Acpi_cm_delete - Object deletion + */ + +void +acpi_cm_delete_internal_obj ( + ACPI_OPERAND_OBJECT *object); + +void +acpi_cm_delete_internal_package_object ( + ACPI_OPERAND_OBJECT *object); + +void +acpi_cm_delete_internal_simple_object ( + ACPI_OPERAND_OBJECT *object); + +ACPI_STATUS +acpi_cm_delete_internal_object_list ( + ACPI_OPERAND_OBJECT **obj_list); + + +/* + * Acpi_cm_eval - object evaluation + */ + +/* Method name strings */ + +#define METHOD_NAME__HID "_HID" +#define METHOD_NAME__UID "_UID" +#define METHOD_NAME__ADR "_ADR" +#define METHOD_NAME__STA "_STA" +#define METHOD_NAME__REG "_REG" +#define METHOD_NAME__SEG "_SEG" +#define METHOD_NAME__BBN "_BBN" + + +ACPI_STATUS +acpi_cm_evaluate_numeric_object ( + NATIVE_CHAR *method_name, + ACPI_NAMESPACE_NODE *device_node, + u32 *address); + +ACPI_STATUS +acpi_cm_execute_HID ( + ACPI_NAMESPACE_NODE *device_node, + DEVICE_ID *hid); + +ACPI_STATUS +acpi_cm_execute_STA ( + ACPI_NAMESPACE_NODE *device_node, + u32 *status_flags); + +ACPI_STATUS +acpi_cm_execute_UID ( + ACPI_NAMESPACE_NODE *device_node, + DEVICE_ID *uid); + + +/* + * Acpi_cm_error - exception interfaces + */ + +NATIVE_CHAR * +acpi_cm_format_exception ( + ACPI_STATUS status); + + +/* + * Acpi_cm_mutex - mutual exclusion interfaces + */ + +ACPI_STATUS +acpi_cm_mutex_initialize ( + void); + +void +acpi_cm_mutex_terminate ( + void); + +ACPI_STATUS +acpi_cm_create_mutex ( + ACPI_MUTEX_HANDLE mutex_id); + +ACPI_STATUS +acpi_cm_delete_mutex ( + ACPI_MUTEX_HANDLE mutex_id); + +ACPI_STATUS +acpi_cm_acquire_mutex ( + ACPI_MUTEX_HANDLE mutex_id); + +ACPI_STATUS +acpi_cm_release_mutex ( + ACPI_MUTEX_HANDLE mutex_id); + + +/* + * Acpi_cm_object - internal object create/delete/cache routines + */ + +void * +_cm_allocate_object_desc ( + NATIVE_CHAR *module_name, + u32 line_number, + u32 component_id); + +#define acpi_cm_create_internal_object(t) _cm_create_internal_object(_THIS_MODULE,__LINE__,_COMPONENT,t) +#define acpi_cm_allocate_object_desc() _cm_allocate_object_desc(_THIS_MODULE,__LINE__,_COMPONENT) + +void +acpi_cm_delete_object_desc ( + ACPI_OPERAND_OBJECT *object); + +u8 +acpi_cm_valid_internal_object ( + void *object); + + +/* + * Acpi_cm_ref_cnt - Object reference count management + */ + +void +acpi_cm_add_reference ( + ACPI_OPERAND_OBJECT *object); + +void +acpi_cm_remove_reference ( + ACPI_OPERAND_OBJECT *object); + +/* + * Acpi_cm_size - Object size routines + */ + +ACPI_STATUS +acpi_cm_get_simple_object_size ( + ACPI_OPERAND_OBJECT *obj, + u32 *obj_length); + +ACPI_STATUS +acpi_cm_get_package_object_size ( + ACPI_OPERAND_OBJECT *obj, + u32 *obj_length); + +ACPI_STATUS +acpi_cm_get_object_size( + ACPI_OPERAND_OBJECT *obj, + u32 *obj_length); + + +/* + * Acpi_cm_state - Generic state creation/cache routines + */ + +void +acpi_cm_push_generic_state ( + ACPI_GENERIC_STATE **list_head, + ACPI_GENERIC_STATE *state); + +ACPI_GENERIC_STATE * +acpi_cm_pop_generic_state ( + ACPI_GENERIC_STATE **list_head); + + +ACPI_GENERIC_STATE * +acpi_cm_create_generic_state ( + void); + +ACPI_GENERIC_STATE * +acpi_cm_create_update_state ( + ACPI_OPERAND_OBJECT *object, + u16 action); + +ACPI_STATUS +acpi_cm_create_update_state_and_push ( + ACPI_OPERAND_OBJECT *object, + u16 action, + ACPI_GENERIC_STATE **state_list); + +ACPI_GENERIC_STATE * +acpi_cm_create_control_state ( + void); + +void +acpi_cm_delete_generic_state ( + ACPI_GENERIC_STATE *state); + +void +acpi_cm_delete_generic_state_cache ( + void); + +void +acpi_cm_delete_object_cache ( + void); + +/* + * Acpi_cmutils + */ + +u8 +acpi_cm_valid_acpi_name ( + u32 name); + +u8 +acpi_cm_valid_acpi_character ( + NATIVE_CHAR character); + + +/* + * Memory allocation functions and related macros. + * Macros that expand to include filename and line number + */ + +void * +_cm_allocate ( + u32 size, + u32 component, + NATIVE_CHAR *module, + u32 line); + +void * +_cm_callocate ( + u32 size, + u32 component, + NATIVE_CHAR *module, + u32 line); + +void +_cm_free ( + void *address, + u32 component, + NATIVE_CHAR *module, + u32 line); + +void +acpi_cm_init_static_object ( + ACPI_OPERAND_OBJECT *obj_desc); + +#define acpi_cm_allocate(a) _cm_allocate(a,_COMPONENT,_THIS_MODULE,__LINE__) +#define acpi_cm_callocate(a) _cm_callocate(a, _COMPONENT,_THIS_MODULE,__LINE__) +#define acpi_cm_free(a) _cm_free(a,_COMPONENT,_THIS_MODULE,__LINE__) + +#ifndef ACPI_DEBUG + +#define acpi_cm_add_element_to_alloc_list(a,b,c,d,e,f) +#define acpi_cm_delete_element_from_alloc_list(a,b,c,d) +#define acpi_cm_dump_current_allocations(a,b) +#define acpi_cm_dump_allocation_info() + +#define DECREMENT_OBJECT_METRICS(a) +#define INCREMENT_OBJECT_METRICS(a) +#define INITIALIZE_ALLOCATION_METRICS() +#define DECREMENT_NAME_TABLE_METRICS(a) +#define INCREMENT_NAME_TABLE_METRICS(a) + +#else + +#define INITIALIZE_ALLOCATION_METRICS() \ + acpi_gbl_current_object_count = 0; \ + acpi_gbl_current_object_size = 0; \ + acpi_gbl_running_object_count = 0; \ + acpi_gbl_running_object_size = 0; \ + acpi_gbl_max_concurrent_object_count = 0; \ + acpi_gbl_max_concurrent_object_size = 0; \ + acpi_gbl_current_alloc_size = 0; \ + acpi_gbl_current_alloc_count = 0; \ + acpi_gbl_running_alloc_size = 0; \ + acpi_gbl_running_alloc_count = 0; \ + acpi_gbl_max_concurrent_alloc_size = 0; \ + acpi_gbl_max_concurrent_alloc_count = 0; \ + acpi_gbl_current_node_count = 0; \ + acpi_gbl_current_node_size = 0; \ + acpi_gbl_max_concurrent_node_count = 0 + + +#define DECREMENT_OBJECT_METRICS(a) \ + acpi_gbl_current_object_count--; \ + acpi_gbl_current_object_size -= a + +#define INCREMENT_OBJECT_METRICS(a) \ + acpi_gbl_current_object_count++; \ + acpi_gbl_running_object_count++; \ + if (acpi_gbl_max_concurrent_object_count < acpi_gbl_current_object_count) \ + { \ + acpi_gbl_max_concurrent_object_count = acpi_gbl_current_object_count; \ + } \ + acpi_gbl_running_object_size += a; \ + acpi_gbl_current_object_size += a; \ + if (acpi_gbl_max_concurrent_object_size < acpi_gbl_current_object_size) \ + { \ + acpi_gbl_max_concurrent_object_size = acpi_gbl_current_object_size; \ + } + +#define DECREMENT_NAME_TABLE_METRICS(a) \ + acpi_gbl_current_node_count--; \ + acpi_gbl_current_node_size -= (a) + +#define INCREMENT_NAME_TABLE_METRICS(a) \ + acpi_gbl_current_node_count++; \ + acpi_gbl_current_node_size+= (a); \ + if (acpi_gbl_max_concurrent_node_count < acpi_gbl_current_node_count) \ + { \ + acpi_gbl_max_concurrent_node_count = acpi_gbl_current_node_count; \ + } \ + + +void +acpi_cm_dump_allocation_info ( + void); + +void +acpi_cm_dump_current_allocations ( + u32 component, + NATIVE_CHAR *module); + +#endif + + +#endif /* _ACCOMMON_H */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/include/acconfig.h linux/drivers/acpi/include/acconfig.h --- v2.4.0-test8/linux/drivers/acpi/include/acconfig.h Wed Dec 31 16:00:00 1969 +++ linux/drivers/acpi/include/acconfig.h Fri Sep 15 14:30:30 2000 @@ -0,0 +1,186 @@ +/****************************************************************************** + * + * Name: acconfig.h - Global configuration constants + * $Revision: 42 $ + * + *****************************************************************************/ + +/* + * 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 _ACCONFIG_H +#define _ACCONFIG_H + + +/****************************************************************************** + * + * Compile-time options + * + *****************************************************************************/ + +/* + * ACPI_DEBUG - This switch enables all the debug facilities of the ACPI + * subsystem. This includes the DEBUG_PRINT output statements + * When disabled, all DEBUG_PRINT statements are compiled out. + * + * ACPI_APPLICATION - Use this switch if the subsystem is going to be run + * at the application level. + * + */ + + +/****************************************************************************** + * + * Subsystem Constants + * + *****************************************************************************/ + + +/* Version string */ + +#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_STATE_CACHE_DEPTH 64 /* State objects for stacks */ +#define MAX_PARSE_CACHE_DEPTH 96 /* Parse tree objects */ +#define MAX_EXTPARSE_CACHE_DEPTH 64 /* Parse tree objects */ +#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 */ + +#define MAX_STRING_LENGTH 512 +#define PATHNAME_MAX 256 /* A full namespace pathname */ + + +/* Maximum count for a semaphore object */ + +#define MAX_SEMAPHORE_COUNT 256 + + +/* Max reference count (for debug only) */ + +#define MAX_REFERENCE_COUNT 0x200 + + +/* Size of cached memory mapping for system memory operation region */ + +#define SYSMEM_REGION_WINDOW_SIZE 4096 + + +/* + * Debugger threading model + * Use single threaded if the entire subsystem is contained in an application + * Use multiple threaded when the the subsystem is running in the kernel. + * + * By default the model is single threaded if ACPI_APPLICATION is set, + * multi-threaded if ACPI_APPLICATION is not set. + */ + +#define DEBUGGER_SINGLE_THREADED 0 +#define DEBUGGER_MULTI_THREADED 1 + +#ifdef ACPI_APPLICATION +#define DEBUGGER_THREADING DEBUGGER_SINGLE_THREADED + +#else +#define DEBUGGER_THREADING DEBUGGER_MULTI_THREADED +#endif + + +/****************************************************************************** + * + * ACPI Specification constants (Do not change unless the specification changes) + * + *****************************************************************************/ + +/* + * Method info (in WALK_STATE), containing local variables and argumetns + */ + +#define MTH_NUM_LOCALS 8 +#define MTH_MAX_LOCAL 7 + +#define MTH_NUM_ARGS 7 +#define MTH_MAX_ARG 6 + +/* + * Operand Stack (in WALK_STATE), Must be large enough to contain MTH_MAX_ARG + */ + +#define OBJ_NUM_OPERANDS 8 +#define OBJ_MAX_OPERAND 7 + +/* 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_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_SIZE 0x400 +#define HI_RSDP_WINDOW_SIZE 0x20000 +#define RSDP_SCAN_STEP 16 + + +/* Maximum nesting of package objects */ + +#define MAX_PACKAGE_DEPTH 16 + + +#endif /* _ACCONFIG_H */ + diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/include/acdebug.h linux/drivers/acpi/include/acdebug.h --- v2.4.0-test8/linux/drivers/acpi/include/acdebug.h Wed Dec 31 16:00:00 1969 +++ linux/drivers/acpi/include/acdebug.h Fri Sep 15 14:30:30 2000 @@ -0,0 +1,396 @@ +/****************************************************************************** + * + * Name: acdebug.h - ACPI/AML debugger + * $Revision: 35 $ + * + *****************************************************************************/ + +/* + * 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 __ACDEBUG_H__ +#define __ACDEBUG_H__ + + +#define DB_MAX_ARGS 8 /* Must be max method args + 1 */ + +#define DB_COMMAND_PROMPT '-' +#define DB_EXECUTE_PROMPT '%' + + +extern int optind; +extern NATIVE_CHAR *optarg; +extern u8 *aml_ptr; +extern u32 acpi_aml_length; + +extern u8 opt_tables; +extern u8 opt_disasm; +extern u8 opt_stats; +extern u8 opt_parse_jit; +extern u8 opt_verbose; + + +extern NATIVE_CHAR *args[DB_MAX_ARGS]; +extern NATIVE_CHAR line_buf[80]; +extern NATIVE_CHAR scope_buf[40]; +extern NATIVE_CHAR debug_filename[40]; +extern u8 output_to_file; +extern NATIVE_CHAR *buffer; +extern NATIVE_CHAR *filename; +extern NATIVE_CHAR *INDENT_STRING; +extern u8 acpi_gbl_db_output_flags; +extern u32 acpi_gbl_db_debug_level; +extern u32 acpi_gbl_db_console_debug_level; + +extern u32 num_names; +extern u32 num_methods; +extern u32 num_regions; +extern u32 num_packages; +extern u32 num_aliases; +extern u32 num_devices; +extern u32 num_field_defs; +extern u32 num_thermal_zones; +extern u32 num_nodes; +extern u32 num_grammar_elements; +extern u32 num_method_elements ; +extern u32 num_mutexes; +extern u32 num_power_resources; +extern u32 num_bank_fields ; +extern u32 num_index_fields; +extern u32 num_events; + +extern u32 size_of_parse_tree; +extern u32 size_of_method_trees; +extern u32 size_of_nTes; +extern u32 size_of_acpi_objects; + + +#define BUFFER_SIZE 4196 + +#define DB_REDIRECTABLE_OUTPUT 0x01 +#define DB_CONSOLE_OUTPUT 0x02 +#define DB_DUPLICATE_OUTPUT 0x03 + + +typedef struct command_info +{ + NATIVE_CHAR *name; /* Command Name */ + u8 min_args; /* Minimum arguments required */ + +} COMMAND_INFO; + + +typedef struct argument_info +{ + NATIVE_CHAR *name; /* Argument Name */ + +} ARGUMENT_INFO; + + +#define PARAM_LIST(pl) pl + +#define DBTEST_OUTPUT_LEVEL(lvl) if (opt_verbose) + +#define VERBOSE_PRINT(fp) DBTEST_OUTPUT_LEVEL(lvl) {\ + acpi_os_printf PARAM_LIST(fp);} + +#define EX_NO_SINGLE_STEP 1 +#define EX_SINGLE_STEP 2 + + +/* Prototypes */ + + +/* + * dbapi - external debugger interfaces + */ + +int +acpi_db_initialize ( + void); + +ACPI_STATUS +acpi_db_single_step ( + ACPI_WALK_STATE *walk_state, + ACPI_PARSE_OBJECT *op, + u8 op_type); + + +/* + * dbcmds - debug commands and output routines + */ + + +void +acpi_db_display_table_info ( + NATIVE_CHAR *table_arg); + +void +acpi_db_unload_acpi_table ( + NATIVE_CHAR *table_arg, + NATIVE_CHAR *instance_arg); + +void +acpi_db_set_method_breakpoint ( + NATIVE_CHAR *location, + ACPI_WALK_STATE *walk_state, + ACPI_PARSE_OBJECT *op); + +void +acpi_db_set_method_call_breakpoint ( + ACPI_PARSE_OBJECT *op); + +void +acpi_db_disassemble_aml ( + NATIVE_CHAR *statements, + ACPI_PARSE_OBJECT *op); + +void +acpi_db_dump_namespace ( + NATIVE_CHAR *start_arg, + NATIVE_CHAR *depth_arg); + +void +acpi_db_dump_namespace_by_owner ( + NATIVE_CHAR *owner_arg, + NATIVE_CHAR *depth_arg); + +void +acpi_db_send_notify ( + NATIVE_CHAR *name, + u32 value); + +void +acpi_db_set_method_data ( + NATIVE_CHAR *type_arg, + NATIVE_CHAR *index_arg, + NATIVE_CHAR *value_arg); + +ACPI_STATUS +acpi_db_display_objects ( + NATIVE_CHAR *obj_type_arg, + NATIVE_CHAR *display_count_arg); + +ACPI_STATUS +acpi_db_find_name_in_namespace ( + NATIVE_CHAR *name_arg); + +void +acpi_db_set_scope ( + NATIVE_CHAR *name); + +void +acpi_db_find_references ( + NATIVE_CHAR *object_arg); + + +/* + * dbdisasm - AML disassembler + */ + +void +acpi_db_display_op ( + ACPI_PARSE_OBJECT *origin, + u32 num_opcodes); + +void +acpi_db_display_namestring ( + NATIVE_CHAR *name); + +void +acpi_db_display_path ( + ACPI_PARSE_OBJECT *op); + +void +acpi_db_display_opcode ( + ACPI_PARSE_OBJECT *op); + + +/* + * dbdisply - debug display commands + */ + + +void +acpi_db_display_method_info ( + ACPI_PARSE_OBJECT *op); + +void +acpi_db_decode_and_display_object ( + NATIVE_CHAR *target, + NATIVE_CHAR *output_type); + +void +acpi_db_display_result_object ( + ACPI_OPERAND_OBJECT *obj_desc, + ACPI_WALK_STATE *walk_state); + +ACPI_STATUS +acpi_db_display_all_methods ( + NATIVE_CHAR *display_count_arg); + +void +acpi_db_display_internal_object ( + ACPI_OPERAND_OBJECT *obj_desc, + ACPI_WALK_STATE *walk_state); + +void +acpi_db_display_arguments ( + void); + +void +acpi_db_display_locals ( + void); + +void +acpi_db_display_results ( + void); + +void +acpi_db_display_calling_tree ( + void); + +void +acpi_db_display_argument_object ( + ACPI_OPERAND_OBJECT *obj_desc, + ACPI_WALK_STATE *walk_state); + + +/* + * dbexec - debugger control method execution + */ + +void +acpi_db_execute ( + NATIVE_CHAR *name, + NATIVE_CHAR **args, + u32 flags); + +void +acpi_db_create_execution_threads ( + NATIVE_CHAR *num_threads_arg, + NATIVE_CHAR *num_loops_arg, + NATIVE_CHAR *method_name_arg); + + +/* + * dbfileio - Debugger file I/O commands + */ + +OBJECT_TYPE_INTERNAL +acpi_db_match_argument ( + NATIVE_CHAR *user_argument, + ARGUMENT_INFO *arguments); + + +void +acpi_db_close_debug_file ( + void); + +void +acpi_db_open_debug_file ( + NATIVE_CHAR *name); + +ACPI_STATUS +acpi_db_load_acpi_table ( + NATIVE_CHAR *filename); + + +/* + * dbhistry - debugger HISTORY command + */ + +void +acpi_db_add_to_history ( + NATIVE_CHAR *command_line); + +void +acpi_db_display_history (void); + +NATIVE_CHAR * +acpi_db_get_from_history ( + NATIVE_CHAR *command_num_arg); + + +/* + * dbinput - user front-end to the AML debugger + */ + +ACPI_STATUS +acpi_db_command_dispatch ( + NATIVE_CHAR *input_buffer, + ACPI_WALK_STATE *walk_state, + ACPI_PARSE_OBJECT *op); + +void +acpi_db_execute_thread ( + void *context); + +ACPI_STATUS +acpi_db_user_commands ( + NATIVE_CHAR prompt, + ACPI_PARSE_OBJECT *op); + + +/* + * dbstats - Generation and display of ACPI table statistics + */ + +void +acpi_db_generate_statistics ( + ACPI_PARSE_OBJECT *root, + u8 is_method); + + +ACPI_STATUS +acpi_db_display_statistics ( + NATIVE_CHAR *type_arg); + + +/* + * dbutils - AML debugger utilities + */ + +void +acpi_db_set_output_destination ( + u32 where); + +void +acpi_db_dump_buffer ( + u32 address); + +void +acpi_db_dump_object ( + ACPI_OBJECT *obj_desc, + u32 level); + +void +acpi_db_prep_namestring ( + NATIVE_CHAR *name); + + +ACPI_STATUS +acpi_db_second_pass_parse ( + ACPI_PARSE_OBJECT *root); + +ACPI_NAMESPACE_NODE * +acpi_db_local_ns_lookup ( + NATIVE_CHAR *name); + + +#endif /* __ACDEBUG_H__ */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/include/acdispat.h linux/drivers/acpi/include/acdispat.h --- v2.4.0-test8/linux/drivers/acpi/include/acdispat.h Wed Dec 31 16:00:00 1969 +++ linux/drivers/acpi/include/acdispat.h Fri Sep 15 14:30:30 2000 @@ -0,0 +1,401 @@ +/****************************************************************************** + * + * Name: acdispat.h - dispatcher (parser to interpreter interface) + * $Revision: 29 $ + * + *****************************************************************************/ + +/* + * 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 _ACDISPAT_H_ +#define _ACDISPAT_H_ + + +#define NAMEOF_LOCAL_NTE "__L0" +#define NAMEOF_ARG_NTE "__A0" + + +/* For Acpi_ds_method_data_set_value */ + +#define MTH_TYPE_LOCAL 0 +#define MTH_TYPE_ARG 1 + + +/* Common interfaces */ + +ACPI_STATUS +acpi_ds_obj_stack_push ( + void *object, + ACPI_WALK_STATE *walk_state); + +ACPI_STATUS +acpi_ds_obj_stack_pop ( + u32 pop_count, + ACPI_WALK_STATE *walk_state); + +void * +acpi_ds_obj_stack_get_value ( + u32 index, + ACPI_WALK_STATE *walk_state); + +ACPI_STATUS +acpi_ds_obj_stack_pop_object ( + ACPI_OPERAND_OBJECT **object, + ACPI_WALK_STATE *walk_state); + + +/* dsregion - Op region support */ + +ACPI_STATUS +acpi_ds_get_region_arguments ( + ACPI_OPERAND_OBJECT *rgn_desc); + + +/* dsctrl - Parser/Interpreter interface, control stack routines */ + + +ACPI_STATUS +acpi_ds_exec_begin_control_op ( + ACPI_WALK_STATE *walk_state, + ACPI_PARSE_OBJECT *op); + +ACPI_STATUS +acpi_ds_exec_end_control_op ( + ACPI_WALK_STATE *walk_state, + ACPI_PARSE_OBJECT *op); + + +/* dsexec - Parser/Interpreter interface, method execution callbacks */ + +ACPI_STATUS +acpi_ds_exec_begin_op ( + u16 opcode, + ACPI_PARSE_OBJECT *op, + ACPI_WALK_STATE *walk_state, + ACPI_PARSE_OBJECT **out_op); + +ACPI_STATUS +acpi_ds_exec_end_op ( + ACPI_WALK_STATE *state, + ACPI_PARSE_OBJECT *op); + + +/* dsfield - Parser/Interpreter interface for AML fields */ + + +ACPI_STATUS +acpi_ds_create_field ( + ACPI_PARSE_OBJECT *op, + ACPI_NAMESPACE_NODE *region_node, + ACPI_WALK_STATE *walk_state); + +ACPI_STATUS +acpi_ds_create_bank_field ( + ACPI_PARSE_OBJECT *op, + ACPI_NAMESPACE_NODE *region_node, + ACPI_WALK_STATE *walk_state); + +ACPI_STATUS +acpi_ds_create_index_field ( + ACPI_PARSE_OBJECT *op, + ACPI_HANDLE region_node, + ACPI_WALK_STATE *walk_state); + + +/* dsload - Parser/Interpreter interface, namespace load callbacks */ + +ACPI_STATUS +acpi_ds_load1_begin_op ( + u16 opcode, + ACPI_PARSE_OBJECT *op, + ACPI_WALK_STATE *walk_state, + ACPI_PARSE_OBJECT **out_op); + +ACPI_STATUS +acpi_ds_load1_end_op ( + ACPI_WALK_STATE *walk_state, + ACPI_PARSE_OBJECT *op); + +ACPI_STATUS +acpi_ds_load2_begin_op ( + u16 opcode, + ACPI_PARSE_OBJECT *op, + ACPI_WALK_STATE *walk_state, + ACPI_PARSE_OBJECT **out_op); + +ACPI_STATUS +acpi_ds_load2_end_op ( + ACPI_WALK_STATE *state, + ACPI_PARSE_OBJECT *op); + + +/* dsmthdat - method data (locals/args) */ + + +ACPI_STATUS +acpi_ds_method_data_get_entry ( + u32 type, + u32 index, + ACPI_WALK_STATE *walk_state, + ACPI_OPERAND_OBJECT ***node); + +ACPI_STATUS +acpi_ds_method_data_delete_all ( + ACPI_WALK_STATE *walk_state); + +u8 +acpi_ds_is_method_value ( + ACPI_OPERAND_OBJECT *obj_desc); + +OBJECT_TYPE_INTERNAL +acpi_ds_method_data_get_type ( + u32 type, + u32 index, + ACPI_WALK_STATE *walk_state); + +ACPI_STATUS +acpi_ds_method_data_get_value ( + u32 type, + u32 index, + ACPI_WALK_STATE *walk_state, + ACPI_OPERAND_OBJECT **dest_desc); + +ACPI_STATUS +acpi_ds_method_data_set_value ( + u32 type, + u32 index, + ACPI_OPERAND_OBJECT *src_desc, + ACPI_WALK_STATE *walk_state); + +ACPI_STATUS +acpi_ds_method_data_delete_value ( + u32 type, + u32 index, + ACPI_WALK_STATE *walk_state); + +ACPI_STATUS +acpi_ds_method_data_init_args ( + ACPI_OPERAND_OBJECT **params, + u32 max_param_count, + ACPI_WALK_STATE *walk_state); + +ACPI_NAMESPACE_NODE * +acpi_ds_method_data_get_nte ( + u32 type, + u32 index, + ACPI_WALK_STATE *walk_state); + +ACPI_STATUS +acpi_ds_method_data_init ( + ACPI_WALK_STATE *walk_state); + +ACPI_STATUS +acpi_ds_method_data_set_entry ( + u32 type, + u32 index, + ACPI_OPERAND_OBJECT *object, + ACPI_WALK_STATE *walk_state); + + +/* dsmethod - Parser/Interpreter interface - control method parsing */ + +ACPI_STATUS +acpi_ds_parse_method ( + ACPI_HANDLE obj_handle); + +ACPI_STATUS +acpi_ds_call_control_method ( + ACPI_WALK_LIST *walk_list, + ACPI_WALK_STATE *walk_state, + ACPI_PARSE_OBJECT *op); + +ACPI_STATUS +acpi_ds_restart_control_method ( + ACPI_WALK_STATE *walk_state, + ACPI_OPERAND_OBJECT *return_desc); + +ACPI_STATUS +acpi_ds_terminate_control_method ( + ACPI_WALK_STATE *walk_state); + +ACPI_STATUS +acpi_ds_begin_method_execution ( + ACPI_NAMESPACE_NODE *method_node, + ACPI_OPERAND_OBJECT *obj_desc); + + +/* dsobj - Parser/Interpreter interface - object initialization and conversion */ + +ACPI_STATUS +acpi_ds_init_one_object ( + ACPI_HANDLE obj_handle, + u32 level, + void *context, + void **return_value); + +ACPI_STATUS +acpi_ds_initialize_objects ( + ACPI_TABLE_DESC *table_desc, + ACPI_NAMESPACE_NODE *start_node); + +ACPI_STATUS +acpi_ds_build_internal_package_obj ( + ACPI_WALK_STATE *walk_state, + ACPI_PARSE_OBJECT *op, + ACPI_OPERAND_OBJECT **obj_desc); + +ACPI_STATUS +acpi_ds_build_internal_object ( + ACPI_WALK_STATE *walk_state, + ACPI_PARSE_OBJECT *op, + ACPI_OPERAND_OBJECT **obj_desc_ptr); + +ACPI_STATUS +acpi_ds_init_object_from_op ( + ACPI_WALK_STATE *walk_state, + ACPI_PARSE_OBJECT *op, + u16 opcode, + ACPI_OPERAND_OBJECT **obj_desc); + +ACPI_STATUS +acpi_ds_create_node ( + ACPI_WALK_STATE *walk_state, + ACPI_NAMESPACE_NODE *node, + ACPI_PARSE_OBJECT *op); + + +/* dsregn - Parser/Interpreter interface - Op Region parsing */ + +ACPI_STATUS +acpi_ds_eval_region_operands ( + ACPI_WALK_STATE *walk_state, + ACPI_PARSE_OBJECT *op); + +ACPI_STATUS +acpi_ds_initialize_region ( + ACPI_HANDLE obj_handle); + + +/* dsutils - Parser/Interpreter interface utility routines */ + +u8 +acpi_ds_is_result_used ( + ACPI_PARSE_OBJECT *op); + +void +acpi_ds_delete_result_if_not_used ( + ACPI_PARSE_OBJECT *op, + ACPI_OPERAND_OBJECT *result_obj, + ACPI_WALK_STATE *walk_state); + +ACPI_STATUS +acpi_ds_create_operand ( + ACPI_WALK_STATE *walk_state, + ACPI_PARSE_OBJECT *arg); + +ACPI_STATUS +acpi_ds_create_operands ( + ACPI_WALK_STATE *walk_state, + ACPI_PARSE_OBJECT *first_arg); + +ACPI_STATUS +acpi_ds_resolve_operands ( + ACPI_WALK_STATE *walk_state); + +OBJECT_TYPE_INTERNAL +acpi_ds_map_opcode_to_data_type ( + u16 opcode, + u32 *out_flags); + +OBJECT_TYPE_INTERNAL +acpi_ds_map_named_opcode_to_data_type ( + u16 opcode); + + +/* + * dswscope - Scope Stack manipulation + */ + +ACPI_STATUS +acpi_ds_scope_stack_push ( + ACPI_NAMESPACE_NODE *node, + OBJECT_TYPE_INTERNAL type, + ACPI_WALK_STATE *walk_state); + + +ACPI_STATUS +acpi_ds_scope_stack_pop ( + ACPI_WALK_STATE *walk_state); + +void +acpi_ds_scope_stack_clear ( + ACPI_WALK_STATE *walk_state); + + +/* Acpi_dswstate - parser WALK_STATE management routines */ + +ACPI_WALK_STATE * +acpi_ds_create_walk_state ( + ACPI_OWNER_ID owner_id, + ACPI_PARSE_OBJECT *origin, + ACPI_OPERAND_OBJECT *mth_desc, + ACPI_WALK_LIST *walk_list); + +ACPI_STATUS +acpi_ds_obj_stack_delete_all ( + ACPI_WALK_STATE *walk_state); + +ACPI_STATUS +acpi_ds_obj_stack_pop_and_delete ( + u32 pop_count, + ACPI_WALK_STATE *walk_state); + +void +acpi_ds_delete_walk_state ( + ACPI_WALK_STATE *walk_state); + +ACPI_WALK_STATE * +acpi_ds_pop_walk_state ( + ACPI_WALK_LIST *walk_list); + +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 +acpi_ds_result_stack_clear ( + ACPI_WALK_STATE *walk_state); + +ACPI_WALK_STATE * +acpi_ds_get_current_walk_state ( + ACPI_WALK_LIST *walk_list); + +void +acpi_ds_delete_walk_state_cache ( + void); + + +#endif /* _ACDISPAT_H_ */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/include/acenv.h linux/drivers/acpi/include/acenv.h --- v2.4.0-test8/linux/drivers/acpi/include/acenv.h Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/include/acenv.h Fri Sep 15 14:30:30 2000 @@ -1,7 +1,7 @@ - /****************************************************************************** * * Name: acenv.h - Generation environment specific items + * $Revision: 53 $ * *****************************************************************************/ @@ -71,14 +71,12 @@ #ifdef _LINUX +#include #include #include #include #include - -/* Single threaded */ - -#define ACPI_APPLICATION +#include /* Use native Linux string library */ @@ -88,13 +86,27 @@ #define strtoul simple_strtoul +/* Linux clib doesn't to strupr, but we do. */ +char * +strupr(char *str); + +#else + +#ifdef _AED_EFI + +#include +#include +#include + #else + /* All other environments */ #define ACPI_USE_STANDARD_HEADERS #endif +#endif /****************************************************************************** @@ -117,6 +129,7 @@ #include #include #include +#include #endif /* ACPI_USE_STANDARD_HEADERS */ @@ -124,20 +137,20 @@ * We will be linking to the standard Clib functions */ -#define STRSTR(s1,s2) strstr((char *) (s1), (char *) (s2)) -#define STRUPR(s) strupr((char *) (s)) -#define STRLEN(s) strlen((char *) (s)) -#define STRCPY(d,s) strcpy((char *) (d), (char *) (s)) -#define STRNCPY(d,s,n) strncpy((char *) (d), (char *) (s), (n)) -#define STRNCMP(d,s,n) strncmp((char *) (d), (char *) (s), (n)) -#define STRCMP(d,s) strcmp((char *) (d), (char *) (s)) -#define STRCAT(d,s) strcat((char *) (d), (char *) (s)) -#define STRNCAT(d,s,n) strncat((char *) (d), (char *) (s), (n)) -#define STRTOUL(d,s,n) strtoul((char *) (d), (char **) (s), (n)) -#define MEMCPY(d,s,n) memcpy(d, s, (size_t) n) -#define MEMSET(d,s,n) memset(d, s, (size_t) n) -#define TOUPPER toupper -#define TOLOWER tolower +#define STRSTR(s1,s2) strstr((s1), (s2)) +#define STRUPR(s) strupr((s)) +#define STRLEN(s) strlen((s)) +#define STRCPY(d,s) strcpy((d), (s)) +#define STRNCPY(d,s,n) strncpy((d), (s), (n)) +#define STRNCMP(d,s,n) strncmp((d), (s), (n)) +#define STRCMP(d,s) strcmp((d), (s)) +#define STRCAT(d,s) strcat((d), (s)) +#define STRNCAT(d,s,n) strncat((d), (s), (n)) +#define STRTOUL(d,s,n) strtoul((d), (s), (n)) +#define MEMCPY(d,s,n) memcpy((d), (s), (n)) +#define MEMSET(d,s,n) memset((d), (s), (n)) +#define TOUPPER toupper +#define TOLOWER tolower /****************************************************************************** @@ -165,37 +178,35 @@ * Storage alignment properties */ -#define _AUPBND (sizeof(int) - 1) -#define _ADNBND (sizeof(int) - 1) +#define _AUPBND (sizeof(int) - 1) +#define _ADNBND (sizeof(int) - 1) /* * Variable argument list macro definitions */ -#define _bnd(X, bnd) (((sizeof(X)) + (bnd)) & (~(bnd))) -#define va_arg(ap, T) (*(T *)(((ap) += ((_bnd(T, _AUPBND))) \ - - (_bnd(T, _ADNBND))))) -#define va_end(ap) (void)0 -#define va_start(ap, A) (void) ((ap) = (((char *)&(A)) \ - + (_bnd(A, _AUPBND)))) +#define _bnd(X, bnd) (((sizeof(X)) + (bnd)) & (~(bnd))) +#define va_arg(ap, T) (*(T *)(((ap)+=((_bnd(T, _AUPBND)))-(_bnd(T,_ADNBND))))) +#define va_end(ap) (void)0 +#define va_start(ap, A) (void)((ap)=(((char*)&(A))+(_bnd(A,_AUPBND)))) #endif /* va_arg */ -#define STRSTR(s1,s2) acpi_cm_strstr ((char *) (s1), (char *) (s2)) -#define STRUPR(s) acpi_cm_strupr ((char *) (s)) -#define STRLEN(s) acpi_cm_strlen ((char *) (s)) -#define STRCPY(d,s) acpi_cm_strcpy ((char *) (d), (char *) (s)) -#define STRNCPY(d,s,n) acpi_cm_strncpy ((char *) (d), (char *) (s), (n)) -#define STRNCMP(d,s,n) acpi_cm_strncmp ((char *) (d), (char *) (s), (n)) -#define STRCMP(d,s) acpi_cm_strcmp ((char *) (d), (char *) (s)) -#define STRCAT(d,s) acpi_cm_strcat ((char *) (d), (char *) (s)) -#define STRNCAT(d,s,n) acpi_cm_strncat ((char *) (d), (char *) (s), (n)) -#define STRTOUL(d,s,n) acpi_cm_strtoul ((char *) (d), (char **) (s), (n)) -#define MEMCPY(d,s,n) acpi_cm_memcpy ((void *) (d), (const void *) (s), (n)) -#define MEMSET(d,v,n) acpi_cm_memset ((void *) (d), (v), (n)) -#define TOUPPER acpi_cm_to_upper -#define TOLOWER acpi_cm_to_lower +#define STRSTR(s1,s2) acpi_cm_strstr ((s1), (s2)) +#define STRUPR(s) acpi_cm_strupr ((s)) +#define STRLEN(s) acpi_cm_strlen ((s)) +#define STRCPY(d,s) acpi_cm_strcpy ((d), (s)) +#define STRNCPY(d,s,n) acpi_cm_strncpy ((d), (s), (n)) +#define STRNCMP(d,s,n) acpi_cm_strncmp ((d), (s), (n)) +#define STRCMP(d,s) acpi_cm_strcmp ((d), (s)) +#define STRCAT(d,s) acpi_cm_strcat ((d), (s)) +#define STRNCAT(d,s,n) acpi_cm_strncat ((d), (s), (n)) +#define STRTOUL(d,s,n) acpi_cm_strtoul ((d), (s),(n)) +#define MEMCPY(d,s,n) acpi_cm_memcpy ((d), (s), (n)) +#define MEMSET(d,v,n) acpi_cm_memset ((d), (v), (n)) +#define TOUPPER acpi_cm_to_upper +#define TOLOWER acpi_cm_to_lower #endif /* ACPI_USE_SYSTEM_CLIBRARY */ @@ -217,27 +228,90 @@ #ifdef __GNUC__ + #ifdef __ia64__ -#define _IA64 -#endif + +/* Single threaded */ +#define ACPI_APPLICATION #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 */ +#include + +/* 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 + * %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 is the non-output registers altered by the operation + * The final asm parameter are the operation altered non-output registers. */ #define ACPI_ACQUIRE_GLOBAL_LOCK(GLptr, Acq) \ do { \ @@ -267,12 +341,12 @@ } while(0) /*! [End] no source code translation !*/ +#endif /* IA 32 */ #endif /* __GNUC__ */ -#ifndef ACPI_ASM_MACROS - /* Unrecognized compiler, use defaults */ +#ifndef ACPI_ASM_MACROS #define ACPI_ASM_MACROS #define causeinterrupt(level) @@ -280,7 +354,6 @@ #define disable() #define enable() #define halt() - #define ACPI_ACQUIRE_GLOBAL_LOCK(Glptr, acq) #define ACPI_RELEASE_GLOBAL_LOCK(Glptr, acq) diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/include/acevents.h linux/drivers/acpi/include/acevents.h --- v2.4.0-test8/linux/drivers/acpi/include/acevents.h Wed Dec 31 16:00:00 1969 +++ linux/drivers/acpi/include/acevents.h Fri Sep 15 14:30:30 2000 @@ -0,0 +1,210 @@ +/****************************************************************************** + * + * Name: acevents.h - Event subcomponent prototypes and defines + * $Revision: 56 $ + * + *****************************************************************************/ + +/* + * 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 __ACEVENTS_H__ +#define __ACEVENTS_H__ + + +/* + * Acpi_evfixed - Fixed event handling + */ + +ACPI_STATUS +acpi_ev_fixed_event_initialize ( + void); + +u32 +acpi_ev_fixed_event_detect ( + void); + +u32 +acpi_ev_fixed_event_dispatch ( + u32 acpi_event); + + +/* + * Acpi_evglock - Global Lock support + */ + +ACPI_STATUS +acpi_ev_acquire_global_lock( + void); + +void +acpi_ev_release_global_lock( + void); + +ACPI_STATUS +acpi_ev_init_global_lock_handler ( + void); + + +/* + * Acpi_evgpe - GPE handling and dispatch + */ + +ACPI_STATUS +acpi_ev_gpe_initialize ( + void); + +ACPI_STATUS +acpi_ev_init_gpe_control_methods ( + void); + +u32 +acpi_ev_gpe_dispatch ( + u32 gpe_number); + +u32 +acpi_ev_gpe_detect ( + void); + + +/* + * Acpi_evnotify - Device Notify handling and dispatch + */ + +void +acpi_ev_notify_dispatch ( + ACPI_HANDLE device, + u32 notify_value); + + +/* + * Acpi_evregion - Address Space handling + */ + +ACPI_STATUS +acpi_ev_install_default_address_space_handlers ( + void); + +ACPI_STATUS +acpi_ev_address_space_dispatch ( + ACPI_OPERAND_OBJECT *region_obj, + u32 function, + u32 address, + u32 bit_width, + u32 *value); + + +ACPI_STATUS +acpi_ev_addr_handler_helper ( + ACPI_HANDLE obj_handle, + u32 level, + void *context, + void **return_value); + +void +acpi_ev_disassociate_region_from_handler( + ACPI_OPERAND_OBJECT *region_obj); + + +ACPI_STATUS +acpi_ev_associate_region_and_handler ( + ACPI_OPERAND_OBJECT *handler_obj, + ACPI_OPERAND_OBJECT *region_obj, + u8 acpi_ns_is_locked); + + +/* + * Acpi_evregini - Region initialization and setup + */ + +ACPI_STATUS +acpi_ev_system_memory_region_setup ( + ACPI_HANDLE handle, + u32 function, + void *handler_context, + void **region_context); + +ACPI_STATUS +acpi_ev_io_space_region_setup ( + ACPI_HANDLE handle, + u32 function, + void *handler_context, + void **region_context); + +ACPI_STATUS +acpi_ev_pci_config_region_setup ( + ACPI_HANDLE handle, + u32 function, + void *handler_context, + void **region_context); + +ACPI_STATUS +acpi_ev_default_region_setup ( + ACPI_HANDLE handle, + u32 function, + void *handler_context, + void **region_context); + +ACPI_STATUS +acpi_ev_initialize_region ( + ACPI_OPERAND_OBJECT *region_obj, + u8 acpi_ns_locked); + + +/* + * Evsci - SCI (System Control Interrupt) handling/dispatch + */ + +u32 +acpi_ev_install_sci_handler ( + void); + +ACPI_STATUS +acpi_ev_remove_sci_handler ( + void); + +u32 +acpi_ev_initialize_sCI ( + u32 program_sCI); + +void +acpi_ev_restore_acpi_state ( + void); + +void +acpi_ev_terminate ( + void); + + +/* Debug support */ + +#ifdef ACPI_DEBUG + +u32 +acpi_ev_sci_count ( + u32 acpi_event); + +#define DEBUG_INCREMENT_EVENT_COUNT(a) acpi_gbl_event_count[a]++; + +#else + +#define DEBUG_INCREMENT_EVENT_COUNT(a) +#endif + + +#endif /* __ACEVENTS_H__ */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/include/acexcep.h linux/drivers/acpi/include/acexcep.h --- v2.4.0-test8/linux/drivers/acpi/include/acexcep.h Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/include/acexcep.h Fri Sep 15 14:30:30 2000 @@ -1,7 +1,7 @@ - /****************************************************************************** * * Name: acexcep.h - Exception codes returned by the ACPI subsystem + * $Revision: 35 $ * *****************************************************************************/ @@ -31,65 +31,105 @@ * Exceptions returned by external ACPI interfaces */ +#define AE_CODE_ENVIRONMENTAL 0x0000 +#define AE_CODE_PROGRAMMER 0x1000 +#define AE_CODE_ACPI_TABLES 0x2000 +#define AE_CODE_AML 0x3000 +#define AE_CODE_CONTROL 0x4000 +#define AE_CODE_MASK 0xF000 + + #define ACPI_SUCCESS(a) (!(a)) #define ACPI_FAILURE(a) (a) + #define AE_OK (ACPI_STATUS) 0x0000 -#define AE_CTRL_RETURN_VALUE (ACPI_STATUS) 0x0001 -#define AE_CTRL_PENDING (ACPI_STATUS) 0x0002 -#define AE_CTRL_TERMINATE (ACPI_STATUS) 0x0003 -#define AE_CTRL_TRUE (ACPI_STATUS) 0x0004 -#define AE_CTRL_FALSE (ACPI_STATUS) 0x0005 -#define AE_CTRL_DEPTH (ACPI_STATUS) 0x0006 -#define AE_CTRL_RESERVED (ACPI_STATUS) 0x0007 -#define AE_AML_ERROR (ACPI_STATUS) 0x0008 -#define AE_AML_PARSE (ACPI_STATUS) 0x0009 -#define AE_AML_BAD_OPCODE (ACPI_STATUS) 0x000A -#define AE_AML_NO_OPERAND (ACPI_STATUS) 0x000B -#define AE_AML_OPERAND_TYPE (ACPI_STATUS) 0x000C -#define AE_AML_OPERAND_VALUE (ACPI_STATUS) 0x000D -#define AE_AML_UNINITIALIZED_LOCAL (ACPI_STATUS) 0x000E -#define AE_AML_UNINITIALIZED_ARG (ACPI_STATUS) 0x000F -#define AE_AML_UNINITIALIZED_ELEMENT (ACPI_STATUS) 0x0010 -#define AE_AML_NUMERIC_OVERFLOW (ACPI_STATUS) 0x0011 -#define AE_AML_REGION_LIMIT (ACPI_STATUS) 0x0012 -#define AE_AML_BUFFER_LIMIT (ACPI_STATUS) 0x0013 -#define AE_AML_PACKAGE_LIMIT (ACPI_STATUS) 0x0014 -#define AE_AML_DIVIDE_BY_ZERO (ACPI_STATUS) 0x0015 -#define AE_AML_BAD_NAME (ACPI_STATUS) 0x0016 -#define AE_AML_NAME_NOT_FOUND (ACPI_STATUS) 0x0017 -#define AE_AML_INTERNAL (ACPI_STATUS) 0x0018 -#define AE_AML_RESERVED (ACPI_STATUS) 0x0019 -#define AE_ERROR (ACPI_STATUS) 0x001A -#define AE_NO_ACPI_TABLES (ACPI_STATUS) 0x001B -#define AE_NO_NAMESPACE (ACPI_STATUS) 0x001C -#define AE_NO_MEMORY (ACPI_STATUS) 0x001D -#define AE_BAD_SIGNATURE (ACPI_STATUS) 0x001E -#define AE_BAD_HEADER (ACPI_STATUS) 0x001F -#define AE_BAD_CHECKSUM (ACPI_STATUS) 0x0020 -#define AE_BAD_PARAMETER (ACPI_STATUS) 0x0021 -#define AE_BAD_CHARACTER (ACPI_STATUS) 0x0022 -#define AE_BAD_PATHNAME (ACPI_STATUS) 0x0023 -#define AE_BAD_DATA (ACPI_STATUS) 0x0024 -#define AE_BAD_ADDRESS (ACPI_STATUS) 0x0025 -#define AE_NOT_FOUND (ACPI_STATUS) 0x0026 -#define AE_NOT_EXIST (ACPI_STATUS) 0x0027 -#define AE_EXIST (ACPI_STATUS) 0x0028 -#define AE_TYPE (ACPI_STATUS) 0x0029 -#define AE_NULL_OBJECT (ACPI_STATUS) 0x002A -#define AE_NULL_ENTRY (ACPI_STATUS) 0x002B -#define AE_BUFFER_OVERFLOW (ACPI_STATUS) 0x002C -#define AE_STACK_OVERFLOW (ACPI_STATUS) 0x002D -#define AE_STACK_UNDERFLOW (ACPI_STATUS) 0x002E -#define AE_NOT_IMPLEMENTED (ACPI_STATUS) 0x002F -#define AE_VERSION_MISMATCH (ACPI_STATUS) 0x0030 -#define AE_SUPPORT (ACPI_STATUS) 0x0031 -#define AE_SHARE (ACPI_STATUS) 0x0032 -#define AE_LIMIT (ACPI_STATUS) 0x0033 -#define AE_TIME (ACPI_STATUS) 0x0034 -#define AE_UNKNOWN_STATUS (ACPI_STATUS) 0x0035 -#define ACPI_MAX_STATUS (ACPI_STATUS) 0x0035 -#define ACPI_NUM_STATUS (ACPI_STATUS) 0x0036 + +/* + * Environmental exceptions + */ +#define AE_ERROR (ACPI_STATUS) (0x0001 | AE_CODE_ENVIRONMENTAL) +#define AE_NO_ACPI_TABLES (ACPI_STATUS) (0x0002 | AE_CODE_ENVIRONMENTAL) +#define AE_NO_NAMESPACE (ACPI_STATUS) (0x0003 | AE_CODE_ENVIRONMENTAL) +#define AE_NO_MEMORY (ACPI_STATUS) (0x0004 | AE_CODE_ENVIRONMENTAL) +#define AE_NOT_FOUND (ACPI_STATUS) (0x0005 | AE_CODE_ENVIRONMENTAL) +#define AE_NOT_EXIST (ACPI_STATUS) (0x0006 | AE_CODE_ENVIRONMENTAL) +#define AE_EXIST (ACPI_STATUS) (0x0007 | AE_CODE_ENVIRONMENTAL) +#define AE_TYPE (ACPI_STATUS) (0x0008 | AE_CODE_ENVIRONMENTAL) +#define AE_NULL_OBJECT (ACPI_STATUS) (0x0009 | AE_CODE_ENVIRONMENTAL) +#define AE_NULL_ENTRY (ACPI_STATUS) (0x000A | AE_CODE_ENVIRONMENTAL) +#define AE_BUFFER_OVERFLOW (ACPI_STATUS) (0x000B | AE_CODE_ENVIRONMENTAL) +#define AE_STACK_OVERFLOW (ACPI_STATUS) (0x000C | AE_CODE_ENVIRONMENTAL) +#define AE_STACK_UNDERFLOW (ACPI_STATUS) (0x000D | AE_CODE_ENVIRONMENTAL) +#define AE_NOT_IMPLEMENTED (ACPI_STATUS) (0x000E | AE_CODE_ENVIRONMENTAL) +#define AE_VERSION_MISMATCH (ACPI_STATUS) (0x000F | AE_CODE_ENVIRONMENTAL) +#define AE_SUPPORT (ACPI_STATUS) (0x0010 | AE_CODE_ENVIRONMENTAL) +#define AE_SHARE (ACPI_STATUS) (0x0011 | AE_CODE_ENVIRONMENTAL) +#define AE_LIMIT (ACPI_STATUS) (0x0012 | AE_CODE_ENVIRONMENTAL) +#define AE_TIME (ACPI_STATUS) (0x0013 | AE_CODE_ENVIRONMENTAL) +#define AE_UNKNOWN_STATUS (ACPI_STATUS) (0x0014 | AE_CODE_ENVIRONMENTAL) + +#define AE_CODE_ENV_MAX 0x0014 + +/* + * Programmer exceptions + */ +#define AE_BAD_PARAMETER (ACPI_STATUS) (0x0001 | AE_CODE_PROGRAMMER) +#define AE_BAD_CHARACTER (ACPI_STATUS) (0x0002 | AE_CODE_PROGRAMMER) +#define AE_BAD_PATHNAME (ACPI_STATUS) (0x0003 | AE_CODE_PROGRAMMER) +#define AE_BAD_DATA (ACPI_STATUS) (0x0004 | AE_CODE_PROGRAMMER) +#define AE_BAD_ADDRESS (ACPI_STATUS) (0x0005 | AE_CODE_PROGRAMMER) + +#define AE_CODE_PGM_MAX 0x0005 + + +/* + * Acpi table exceptions + */ +#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_CODE_TBL_MAX 0x0003 + + +/* + * AML exceptions. These are caused by problems with + * the actual AML byte stream + */ +#define AE_AML_ERROR (ACPI_STATUS) (0x0001 | AE_CODE_AML) +#define AE_AML_PARSE (ACPI_STATUS) (0x0002 | AE_CODE_AML) +#define AE_AML_BAD_OPCODE (ACPI_STATUS) (0x0003 | AE_CODE_AML) +#define AE_AML_NO_OPERAND (ACPI_STATUS) (0x0004 | AE_CODE_AML) +#define AE_AML_OPERAND_TYPE (ACPI_STATUS) (0x0005 | AE_CODE_AML) +#define AE_AML_OPERAND_VALUE (ACPI_STATUS) (0x0006 | AE_CODE_AML) +#define AE_AML_UNINITIALIZED_LOCAL (ACPI_STATUS) (0x0007 | AE_CODE_AML) +#define AE_AML_UNINITIALIZED_ARG (ACPI_STATUS) (0x0008 | AE_CODE_AML) +#define AE_AML_UNINITIALIZED_ELEMENT (ACPI_STATUS) (0x0009 | AE_CODE_AML) +#define AE_AML_NUMERIC_OVERFLOW (ACPI_STATUS) (0x000A | AE_CODE_AML) +#define AE_AML_REGION_LIMIT (ACPI_STATUS) (0x000B | AE_CODE_AML) +#define AE_AML_BUFFER_LIMIT (ACPI_STATUS) (0x000C | AE_CODE_AML) +#define AE_AML_PACKAGE_LIMIT (ACPI_STATUS) (0x000D | AE_CODE_AML) +#define AE_AML_DIVIDE_BY_ZERO (ACPI_STATUS) (0x000E | AE_CODE_AML) +#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_CODE_AML_MAX 0x0011 + +/* + * Internal exceptions used for control + */ +#define AE_CTRL_RETURN_VALUE (ACPI_STATUS) (0x0001 | AE_CODE_CONTROL) +#define AE_CTRL_PENDING (ACPI_STATUS) (0x0002 | AE_CODE_CONTROL) +#define AE_CTRL_TERMINATE (ACPI_STATUS) (0x0003 | AE_CODE_CONTROL) +#define AE_CTRL_TRUE (ACPI_STATUS) (0x0004 | AE_CODE_CONTROL) +#define AE_CTRL_FALSE (ACPI_STATUS) (0x0005 | AE_CODE_CONTROL) +#define AE_CTRL_DEPTH (ACPI_STATUS) (0x0006 | AE_CODE_CONTROL) +#define AE_CTRL_END (ACPI_STATUS) (0x0007 | AE_CODE_CONTROL) +#define AE_CTRL_TRANSFER (ACPI_STATUS) (0x0008 | AE_CODE_CONTROL) + +#define AE_CODE_CTRL_MAX 0x0008 #ifdef DEFINE_ACPI_GLOBALS @@ -98,46 +138,13 @@ * String versions of the exception codes above * These strings must match the corresponding defines exactly */ -static char *acpi_gbl_exception_names[] = +static NATIVE_CHAR *acpi_gbl_exception_names_env[] = { "AE_OK", - "AE_CTRL_RETURN_VALUE", - "AE_CTRL_PENDING", - "AE_CTRL_TERMINATE", - "AE_CTRL_TRUE", - "AE_CTRL_FALSE", - "AE_CTRL_DEPTH", - "AE_CTRL_RESERVED", - "AE_AML_ERROR", - "AE_AML_PARSE", - "AE_AML_BAD_OPCODE", - "AE_AML_NO_OPERAND", - "AE_AML_OPERAND_TYPE", - "AE_AML_OPERAND_VALUE", - "AE_AML_UNINITIALIZED_LOCAL", - "AE_AML_UNINITIALIZED_ARG", - "AE_AML_UNINITIALIZED_ELEMENT", - "AE_AML_NUMERIC_OVERFLOW", - "AE_AML_REGION_LIMIT", - "AE_AML_BUFFER_LIMIT", - "AE_AML_PACKAGE_LIMIT", - "AE_AML_DIVIDE_BY_ZERO", - "AE_AML_BAD_NAME", - "AE_AML_NAME_NOT_FOUND", - "AE_AML_INTERNAL", - "AE_AML_RESERVED", "AE_ERROR", "AE_NO_ACPI_TABLES", "AE_NO_NAMESPACE", "AE_NO_MEMORY", - "AE_BAD_SIGNATURE", - "AE_BAD_HEADER", - "AE_BAD_CHECKSUM", - "AE_BAD_PARAMETER", - "AE_BAD_CHARACTER", - "AE_BAD_PATHNAME", - "AE_BAD_DATA", - "AE_BAD_ADDRESS", "AE_NOT_FOUND", "AE_NOT_EXIST", "AE_EXIST", @@ -153,8 +160,58 @@ "AE_SHARE", "AE_LIMIT", "AE_TIME", - "AE_UNKNOWN_STATUS" + "AE_UNKNOWN_STATUS", +}; + +static NATIVE_CHAR *acpi_gbl_exception_names_pgm[] = +{ + "AE_BAD_PARAMETER", + "AE_BAD_CHARACTER", + "AE_BAD_PATHNAME", + "AE_BAD_DATA", + "AE_BAD_ADDRESS", +}; + +static NATIVE_CHAR *acpi_gbl_exception_names_tbl[] = +{ + "AE_BAD_SIGNATURE", + "AE_BAD_HEADER", + "AE_BAD_CHECKSUM", +}; + +static NATIVE_CHAR *acpi_gbl_exception_names_aml[] = +{ + "AE_AML_ERROR", + "AE_AML_PARSE", + "AE_AML_BAD_OPCODE", + "AE_AML_NO_OPERAND", + "AE_AML_OPERAND_TYPE", + "AE_AML_OPERAND_VALUE", + "AE_AML_UNINITIALIZED_LOCAL", + "AE_AML_UNINITIALIZED_ARG", + "AE_AML_UNINITIALIZED_ELEMENT", + "AE_AML_NUMERIC_OVERFLOW", + "AE_AML_REGION_LIMIT", + "AE_AML_BUFFER_LIMIT", + "AE_AML_PACKAGE_LIMIT", + "AE_AML_DIVIDE_BY_ZERO", + "AE_AML_BAD_NAME", + "AE_AML_NAME_NOT_FOUND", + "AE_AML_INTERNAL", +}; + +static NATIVE_CHAR *acpi_gbl_exception_names_ctrl[] = +{ + "AE_CTRL_RETURN_VALUE", + "AE_CTRL_PENDING", + "AE_CTRL_TERMINATE", + "AE_CTRL_TRUE", + "AE_CTRL_FALSE", + "AE_CTRL_DEPTH", + "AE_CTRL_END", + "AE_CTRL_TRANSFER", }; + #endif /* DEFINE_ACPI_GLOBALS */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/include/acglobal.h linux/drivers/acpi/include/acglobal.h --- v2.4.0-test8/linux/drivers/acpi/include/acglobal.h Wed Dec 31 16:00:00 1969 +++ linux/drivers/acpi/include/acglobal.h Fri Sep 15 14:30:30 2000 @@ -0,0 +1,320 @@ +/****************************************************************************** + * + * Name: acglobal.h - Declarations for global variables + * $Revision: 84 $ + * + *****************************************************************************/ + +/* + * 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 __ACGLOBAL_H__ +#define __ACGLOBAL_H__ + + +/* + * Ensure that the globals are actually defined only once. + * + * The use of these defines allows a single list of globals (here) in order + * to simplify maintenance of the code. + */ +#ifdef DEFINE_ACPI_GLOBALS +#define ACPI_EXTERN +#else +#define ACPI_EXTERN extern +#endif + + +extern NATIVE_CHAR *msg_acpi_error_break; + +/***************************************************************************** + * + * Debug support + * + ****************************************************************************/ + +/* Runtime configuration of debug print levels */ + +extern u32 acpi_dbg_level; +extern u32 acpi_dbg_layer; + + +/* Procedure nesting level for debug output */ + +extern u32 acpi_gbl_nesting_level; + + +/***************************************************************************** + * + * ACPI Table globals + * + ****************************************************************************/ + +/* + * Table pointers. + * Although these pointers are somewhat redundant with the global Acpi_table, + * they are convenient because they are typed pointers. + * + * These tables are single-table only; meaning that there can be at most one + * 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; +/* + * Since there may be multiple SSDTs and PSDTS, a single pointer is not + * sufficient; Therefore, there isn't one! + */ + + +/* + * ACPI Table info arrays + */ +extern ACPI_TABLE_DESC acpi_gbl_acpi_tables[NUM_ACPI_TABLES]; +extern ACPI_TABLE_SUPPORT acpi_gbl_acpi_table_data[NUM_ACPI_TABLES]; + +/* + * Predefined mutex objects. This array contains the + * actual OS mutex handles, indexed by the local ACPI_MUTEX_HANDLEs. + * (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; + + +/***************************************************************************** + * + * Miscellaneous globals + * + ****************************************************************************/ + + +ACPI_EXTERN u8 *acpi_gbl_gpe0enable_register_save; +ACPI_EXTERN u8 *acpi_gbl_gpe1_enable_register_save; +ACPI_EXTERN ACPI_WALK_STATE *acpi_gbl_breakpoint_walk; +ACPI_EXTERN ACPI_GENERIC_STATE *acpi_gbl_generic_state_cache; +ACPI_EXTERN ACPI_PARSE_OBJECT *acpi_gbl_parse_cache; +ACPI_EXTERN ACPI_PARSE2_OBJECT *acpi_gbl_ext_parse_cache; +ACPI_EXTERN ACPI_OPERAND_OBJECT *acpi_gbl_object_cache; +ACPI_EXTERN ACPI_WALK_STATE *acpi_gbl_walk_state_cache; +ACPI_EXTERN ACPI_HANDLE acpi_gbl_global_lock_semaphore; + + +ACPI_EXTERN u32 acpi_gbl_global_lock_thread_count; +ACPI_EXTERN u32 acpi_gbl_restore_acpi_chipset; +ACPI_EXTERN u32 acpi_gbl_original_mode; +ACPI_EXTERN u32 acpi_gbl_edge_level_save; +ACPI_EXTERN u32 acpi_gbl_irq_enable_save; +ACPI_EXTERN u32 acpi_gbl_rsdp_original_location; + +ACPI_EXTERN u32 acpi_gbl_state_cache_requests; +ACPI_EXTERN u32 acpi_gbl_state_cache_hits; +ACPI_EXTERN u32 acpi_gbl_parse_cache_requests; +ACPI_EXTERN u32 acpi_gbl_parse_cache_hits; +ACPI_EXTERN u32 acpi_gbl_ext_parse_cache_requests; +ACPI_EXTERN u32 acpi_gbl_ext_parse_cache_hits; +ACPI_EXTERN u32 acpi_gbl_object_cache_requests; +ACPI_EXTERN u32 acpi_gbl_object_cache_hits; +ACPI_EXTERN u32 acpi_gbl_walk_state_cache_requests; +ACPI_EXTERN u32 acpi_gbl_walk_state_cache_hits; +ACPI_EXTERN u32 acpi_gbl_ns_lookup_count; +ACPI_EXTERN u32 acpi_gbl_ps_find_count; + + +ACPI_EXTERN u16 acpi_gbl_generic_state_cache_depth; +ACPI_EXTERN u16 acpi_gbl_parse_cache_depth; +ACPI_EXTERN u16 acpi_gbl_ext_parse_cache_depth; +ACPI_EXTERN u16 acpi_gbl_object_cache_depth; +ACPI_EXTERN u16 acpi_gbl_walk_state_cache_depth; +ACPI_EXTERN u16 acpi_gbl_pm1_enable_register_save; +ACPI_EXTERN u16 acpi_gbl_next_table_owner_id; +ACPI_EXTERN u16 acpi_gbl_next_method_owner_id; + +ACPI_EXTERN u8 acpi_gbl_debugger_configuration; +ACPI_EXTERN u8 acpi_gbl_global_lock_acquired; +ACPI_EXTERN u8 acpi_gbl_global_lock_set; /* TBD: [Restructure] OBSOLETE?? */ +ACPI_EXTERN u8 acpi_gbl_step_to_next_call; +ACPI_EXTERN u8 acpi_gbl_acpi_hardware_present; + + +ACPI_EXTERN ACPI_OBJECT_NOTIFY_HANDLER acpi_gbl_drv_notify; +ACPI_EXTERN ACPI_OBJECT_NOTIFY_HANDLER acpi_gbl_sys_notify; + + +extern u8 acpi_gbl_shutdown; +extern u32 acpi_gbl_system_flags; +extern u32 acpi_gbl_startup_flags; + + +/***************************************************************************** + * + * Namespace globals + * + ****************************************************************************/ + +#define NUM_NS_TYPES INTERNAL_TYPE_INVALID+1 +#define NUM_PREDEFINED_NAMES 9 + + +ACPI_EXTERN ACPI_NAMESPACE_NODE acpi_gbl_root_node_struct; +ACPI_EXTERN ACPI_NAMESPACE_NODE *acpi_gbl_root_node; + +extern u8 acpi_gbl_ns_properties[NUM_NS_TYPES]; +extern PREDEFINED_NAMES acpi_gbl_pre_defined_names [NUM_PREDEFINED_NAMES]; + + +/* Used to detect memory leaks (DEBUG ONLY) */ + +#ifdef ACPI_DEBUG +ACPI_EXTERN ALLOCATION_INFO *acpi_gbl_head_alloc_ptr; +ACPI_EXTERN ALLOCATION_INFO *acpi_gbl_tail_alloc_ptr; +#endif + + +/***************************************************************************** + * + * Interpreter globals + * + ****************************************************************************/ + + +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 + */ +ACPI_EXTERN ACPI_HANDLE acpi_gbl_last_method; + +/* + * Table of Address Space handlers + */ + +ACPI_EXTERN ACPI_ADDRESS_SPACE_INFO acpi_gbl_address_spaces[ACPI_NUM_ADDRESS_SPACES]; + + +/* Control method single step flag */ + +ACPI_EXTERN u8 acpi_gbl_cm_single_step; + + +/***************************************************************************** + * + * Parser globals + * + ****************************************************************************/ + +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 + * + ****************************************************************************/ + +extern ACPI_C_STATE_HANDLER acpi_hw_cx_handlers[MAX_CX_STATES]; +extern u32 acpi_hw_active_cx_state; + + +/***************************************************************************** + * + * Event globals + * + ****************************************************************************/ + +ACPI_EXTERN ACPI_FIXED_EVENT_INFO acpi_gbl_fixed_event_handlers[NUM_FIXED_EVENTS]; + +ACPI_EXTERN ACPI_HANDLE acpi_gbl_gpe_obj_handle; +ACPI_EXTERN u32 acpi_gbl_gpe_register_count; +ACPI_EXTERN ACPI_GPE_REGISTERS *acpi_gbl_gpe_registers; +ACPI_EXTERN ACPI_GPE_LEVEL_INFO *acpi_gbl_gpe_info; + +/* + * Gpe validation and translation table + * Indexed by the GPE number, returns GPE_INVALID if the GPE is not supported. + * Otherwise, returns a valid index into the global GPE table. + * + * This table is needed because the GPE numbers supported by block 1 do not + * have to be contiguous with the GPE numbers supported by block 0. + */ +ACPI_EXTERN u8 acpi_gbl_gpe_valid [NUM_GPE]; + +/* Acpi_event counter for debug only */ + +#ifdef ACPI_DEBUG +ACPI_EXTERN u32 acpi_gbl_event_count[NUM_FIXED_EVENTS]; +#endif + + +/***************************************************************************** + * + * Debugger globals + * + ****************************************************************************/ + +ACPI_EXTERN u8 acpi_gbl_method_executing; +ACPI_EXTERN u8 acpi_gbl_db_terminate_threads; + + +/* Memory allocation metrics - Debug Only! */ + +#ifdef ACPI_DEBUG + +ACPI_EXTERN u32 acpi_gbl_current_alloc_size; +ACPI_EXTERN u32 acpi_gbl_current_alloc_count; +ACPI_EXTERN u32 acpi_gbl_running_alloc_size; +ACPI_EXTERN u32 acpi_gbl_running_alloc_count; +ACPI_EXTERN u32 acpi_gbl_max_concurrent_alloc_size; +ACPI_EXTERN u32 acpi_gbl_max_concurrent_alloc_count; +ACPI_EXTERN u32 acpi_gbl_current_object_count; +ACPI_EXTERN u32 acpi_gbl_current_object_size; +ACPI_EXTERN u32 acpi_gbl_max_concurrent_object_count; +ACPI_EXTERN u32 acpi_gbl_max_concurrent_object_size; +ACPI_EXTERN u32 acpi_gbl_running_object_count; +ACPI_EXTERN u32 acpi_gbl_running_object_size; +ACPI_EXTERN u32 acpi_gbl_current_node_count; +ACPI_EXTERN u32 acpi_gbl_current_node_size; +ACPI_EXTERN u32 acpi_gbl_max_concurrent_node_count; + +#endif + + +#endif /* __ACGLOBAL_H__ */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/include/achware.h linux/drivers/acpi/include/achware.h --- v2.4.0-test8/linux/drivers/acpi/include/achware.h Wed Dec 31 16:00:00 1969 +++ linux/drivers/acpi/include/achware.h Fri Sep 15 14:30:30 2000 @@ -0,0 +1,169 @@ +/****************************************************************************** + * + * Name: achware.h -- hardware specific interfaces + * $Revision: 41 $ + * + *****************************************************************************/ + +/* + * 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 __ACHWARE_H__ +#define __ACHWARE_H__ + + +/* Prototypes */ + + +ACPI_STATUS +acpi_hw_initialize( + void); + +ACPI_STATUS +acpi_hw_shutdown( + void); + +ACPI_STATUS +acpi_hw_initialize_system_info( + void); + +ACPI_STATUS +acpi_hw_set_mode ( + u32 mode); + +u32 +acpi_hw_get_mode ( + void); + +u32 +acpi_hw_get_mode_capabilities ( + void); + +/* Register I/O Prototypes */ + +u32 +acpi_hw_register_access ( + NATIVE_UINT read_write, + u8 use_lock, + u32 register_id, ... /* DWORD Value */); + +void +acpi_hw_clear_acpi_status ( + void); + + +/* GPE support */ + +void +acpi_hw_enable_gpe ( + u32 gpe_index); + +void +acpi_hw_disable_gpe ( + u32 gpe_index); + +void +acpi_hw_clear_gpe ( + u32 gpe_index); + +void +acpi_hw_get_gpe_status ( + u32 gpe_number, + ACPI_EVENT_STATUS *event_status); + +/* Sleep Prototypes */ + +ACPI_STATUS +acpi_hw_obtain_sleep_type_register_data ( + u8 sleep_state, + u8 *slp_typ_a, + u8 *slp_typ_b); + + +/* Cx State Prototypes */ + +ACPI_STATUS +acpi_hw_enter_c1( + ACPI_IO_ADDRESS pblk_address, + u32 *pm_timer_ticks); + +ACPI_STATUS +acpi_hw_enter_c2( + ACPI_IO_ADDRESS pblk_address, + u32 *pm_timer_ticks); + +ACPI_STATUS +acpi_hw_enter_c3( + ACPI_IO_ADDRESS pblk_address, + u32 *pm_timer_ticks); + +ACPI_STATUS +acpi_hw_enter_cx ( + ACPI_IO_ADDRESS pblk_address, + u32 *pm_timer_ticks); + +ACPI_STATUS +acpi_hw_set_cx ( + u32 cx_state); + +ACPI_STATUS +acpi_hw_get_cx_info ( + u32 cx_states[]); + + +/* Throttling Prototypes */ + +void +acpi_hw_enable_throttling ( + ACPI_IO_ADDRESS pblk_address); + +void +acpi_hw_disable_throttling ( + ACPI_IO_ADDRESS pblk_address); + +u32 +acpi_hw_get_duty_cycle ( + u8 duty_offset, + ACPI_IO_ADDRESS pblk_address, + u32 num_throttle_states); + +void +acpi_hw_program_duty_cycle ( + u8 duty_offset, + u32 duty_cycle, + ACPI_IO_ADDRESS pblk_address, + u32 num_throttle_states); + +NATIVE_UINT +acpi_hw_local_pow ( + NATIVE_UINT x, + NATIVE_UINT y); + + +/* ACPI Timer prototypes */ + +u32 +acpi_hw_pmt_ticks ( + void); + +u32 +acpi_hw_pmt_resolution ( + void); + + +#endif /* __ACHWARE_H__ */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/include/acinterp.h linux/drivers/acpi/include/acinterp.h --- v2.4.0-test8/linux/drivers/acpi/include/acinterp.h Wed Dec 31 16:00:00 1969 +++ linux/drivers/acpi/include/acinterp.h Fri Sep 15 14:30:30 2000 @@ -0,0 +1,526 @@ +/****************************************************************************** + * + * Name: acinterp.h - Interpreter subcomponent prototypes and defines + * $Revision: 79 $ + * + *****************************************************************************/ + +/* + * 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 __ACINTERP_H__ +#define __ACINTERP_H__ + + +#define WALK_OPERANDS &(walk_state->operands [walk_state->num_operands -1]) + + +/* Interpreter constants */ + +#define AML_END_OF_BLOCK -1 +#define PUSH_PKG_LENGTH 1 +#define DO_NOT_PUSH_PKG_LENGTH 0 + + +#define STACK_TOP 0 +#define STACK_BOTTOM (u32) -1 + +/* Constants for global "When_to_parse_methods" */ + +#define METHOD_PARSE_AT_INIT 0x0 +#define METHOD_PARSE_JUST_IN_TIME 0x1 +#define METHOD_DELETE_AT_COMPLETION 0x2 + + +ACPI_STATUS +acpi_aml_resolve_operands ( + u16 opcode, + ACPI_OPERAND_OBJECT **stack_ptr, + ACPI_WALK_STATE *walk_state); + + +/* + * amxface - External interpreter interfaces + */ + +ACPI_STATUS +acpi_aml_load_table ( + ACPI_TABLE_TYPE table_id); + +ACPI_STATUS +acpi_aml_execute_method ( + ACPI_NAMESPACE_NODE *method_node, + ACPI_OPERAND_OBJECT **params, + ACPI_OPERAND_OBJECT **return_obj_desc); + + +/* + * amfield - ACPI AML (p-code) execution - field manipulation + */ + + +ACPI_STATUS +acpi_aml_read_field ( + ACPI_OPERAND_OBJECT *obj_desc, + void *buffer, + u32 buffer_length, + u32 byte_length, + u32 datum_length, + u32 bit_granularity, + u32 byte_granularity); + +ACPI_STATUS +acpi_aml_write_field ( + ACPI_OPERAND_OBJECT *obj_desc, + void *buffer, + u32 buffer_length, + u32 byte_length, + u32 datum_length, + u32 bit_granularity, + u32 byte_granularity); + +ACPI_STATUS +acpi_aml_setup_field ( + ACPI_OPERAND_OBJECT *obj_desc, + ACPI_OPERAND_OBJECT *rgn_desc, + u32 field_bit_width); + +ACPI_STATUS +acpi_aml_read_field_data ( + ACPI_OPERAND_OBJECT *obj_desc, + u32 field_byte_offset, + u32 field_bit_width, + u32 *value); + +ACPI_STATUS +acpi_aml_access_named_field ( + u32 mode, + ACPI_HANDLE named_field, + void *buffer, + u32 length); + +/* + * ammisc - ACPI AML (p-code) execution - specific opcodes + */ + +ACPI_STATUS +acpi_aml_exec_create_field ( + u16 opcode, + ACPI_WALK_STATE *walk_state); + +ACPI_STATUS +acpi_aml_exec_reconfiguration ( + u16 opcode, + ACPI_WALK_STATE *walk_state); + +ACPI_STATUS +acpi_aml_exec_fatal ( + ACPI_WALK_STATE *walk_state); + +ACPI_STATUS +acpi_aml_exec_index ( + ACPI_WALK_STATE *walk_state, + ACPI_OPERAND_OBJECT **return_desc); + +ACPI_STATUS +acpi_aml_exec_match ( + ACPI_WALK_STATE *walk_state, + ACPI_OPERAND_OBJECT **return_desc); + +ACPI_STATUS +acpi_aml_exec_create_mutex ( + ACPI_WALK_STATE *walk_state); + +ACPI_STATUS +acpi_aml_exec_create_processor ( + ACPI_PARSE_OBJECT *op, + ACPI_HANDLE processor_nTE); + +ACPI_STATUS +acpi_aml_exec_create_power_resource ( + ACPI_PARSE_OBJECT *op, + ACPI_HANDLE processor_nTE); + +ACPI_STATUS +acpi_aml_exec_create_region ( + u8 *aml_ptr, + u32 acpi_aml_length, + u32 region_space, + ACPI_WALK_STATE *walk_state); + +ACPI_STATUS +acpi_aml_exec_create_event ( + ACPI_WALK_STATE *walk_state); + +ACPI_STATUS +acpi_aml_exec_create_alias ( + ACPI_WALK_STATE *walk_state); + +ACPI_STATUS +acpi_aml_exec_create_method ( + u8 *aml_ptr, + u32 acpi_aml_length, + u32 method_flags, + ACPI_HANDLE method); + + +/* + * amprep - ACPI AML (p-code) execution - prep utilities + */ + +ACPI_STATUS +acpi_aml_prep_def_field_value ( + ACPI_NAMESPACE_NODE *node, + ACPI_HANDLE region, + u8 field_flags, + u8 field_attribute, + u32 field_position, + u32 field_length); + +ACPI_STATUS +acpi_aml_prep_bank_field_value ( + ACPI_NAMESPACE_NODE *node, + ACPI_HANDLE region, + ACPI_HANDLE bank_reg, + u32 bank_val, + u8 field_flags, + u8 field_attribute, + u32 field_position, + u32 field_length); + +ACPI_STATUS +acpi_aml_prep_index_field_value ( + ACPI_NAMESPACE_NODE *node, + ACPI_HANDLE index_reg, + ACPI_HANDLE data_reg, + u8 field_flags, + u8 field_attribute, + u32 field_position, + u32 field_length); + + +/* + * amsystem - Interface to OS services + */ + +u16 +acpi_aml_system_thread_id ( + void); + +ACPI_STATUS +acpi_aml_system_do_notify_op ( + ACPI_OPERAND_OBJECT *value, + ACPI_OPERAND_OBJECT *obj_desc); + +void +acpi_aml_system_do_suspend( + u32 time); + +void +acpi_aml_system_do_stall ( + u32 time); + +ACPI_STATUS +acpi_aml_system_acquire_mutex( + ACPI_OPERAND_OBJECT *time, + ACPI_OPERAND_OBJECT *obj_desc); + +ACPI_STATUS +acpi_aml_system_release_mutex( + ACPI_OPERAND_OBJECT *obj_desc); + +ACPI_STATUS +acpi_aml_system_signal_event( + ACPI_OPERAND_OBJECT *obj_desc); + +ACPI_STATUS +acpi_aml_system_wait_event( + ACPI_OPERAND_OBJECT *time, + ACPI_OPERAND_OBJECT *obj_desc); + +ACPI_STATUS +acpi_aml_system_reset_event( + ACPI_OPERAND_OBJECT *obj_desc); + +ACPI_STATUS +acpi_aml_system_wait_semaphore ( + ACPI_HANDLE semaphore, + u32 timeout); + + +/* + * ammonadic - ACPI AML (p-code) execution, monadic operators + */ + +ACPI_STATUS +acpi_aml_exec_monadic1 ( + u16 opcode, + ACPI_WALK_STATE *walk_state); + +ACPI_STATUS +acpi_aml_exec_monadic2 ( + u16 opcode, + ACPI_WALK_STATE *walk_state, + ACPI_OPERAND_OBJECT **return_desc); + +ACPI_STATUS +acpi_aml_exec_monadic2_r ( + u16 opcode, + ACPI_WALK_STATE *walk_state, + ACPI_OPERAND_OBJECT **return_desc); + + +/* + * amdyadic - ACPI AML (p-code) execution, dyadic operators + */ + +ACPI_STATUS +acpi_aml_exec_dyadic1 ( + u16 opcode, + ACPI_WALK_STATE *walk_state); + +ACPI_STATUS +acpi_aml_exec_dyadic2 ( + u16 opcode, + ACPI_WALK_STATE *walk_state, + ACPI_OPERAND_OBJECT **return_desc); + +ACPI_STATUS +acpi_aml_exec_dyadic2_r ( + u16 opcode, + ACPI_WALK_STATE *walk_state, + ACPI_OPERAND_OBJECT **return_desc); + +ACPI_STATUS +acpi_aml_exec_dyadic2_s ( + u16 opcode, + ACPI_WALK_STATE *walk_state, + ACPI_OPERAND_OBJECT **return_desc); + + +/* + * amresolv - Object resolution and get value functions + */ + +ACPI_STATUS +acpi_aml_resolve_to_value ( + ACPI_OPERAND_OBJECT **stack_ptr, + ACPI_WALK_STATE *walk_state); + +ACPI_STATUS +acpi_aml_resolve_node_to_value ( + ACPI_NAMESPACE_NODE **stack_ptr); + +ACPI_STATUS +acpi_aml_resolve_object_to_value ( + ACPI_OPERAND_OBJECT **stack_ptr, + ACPI_WALK_STATE *walk_state); + +ACPI_STATUS +acpi_aml_get_field_unit_value ( + ACPI_OPERAND_OBJECT *field_desc, + ACPI_OPERAND_OBJECT *result_desc); + + +/* + * amdump - Scanner debug output routines + */ + +void +acpi_aml_show_hex_value ( + u32 byte_count, + u8 *aml_ptr, + u32 lead_space); + + +ACPI_STATUS +acpi_aml_dump_operand ( + ACPI_OPERAND_OBJECT *entry_desc); + +void +acpi_aml_dump_operands ( + ACPI_OPERAND_OBJECT **operands, + OPERATING_MODE interpreter_mode, + NATIVE_CHAR *ident, + u32 num_levels, + NATIVE_CHAR *note, + NATIVE_CHAR *module_name, + u32 line_number); + +void +acpi_aml_dump_object_descriptor ( + ACPI_OPERAND_OBJECT *object, + u32 flags); + + +void +acpi_aml_dump_node ( + ACPI_NAMESPACE_NODE *node, + u32 flags); + + +/* + * amnames - interpreter/scanner name load/execute + */ + +NATIVE_CHAR * +acpi_aml_allocate_name_string ( + u32 prefix_count, + u32 num_name_segs); + +u32 +acpi_aml_good_char ( + u32 character); + +ACPI_STATUS +acpi_aml_exec_name_segment ( + u8 **in_aml_address, + NATIVE_CHAR *name_string); + +ACPI_STATUS +acpi_aml_get_name_string ( + OBJECT_TYPE_INTERNAL data_type, + u8 *in_aml_address, + NATIVE_CHAR **out_name_string, + u32 *out_name_length); + +ACPI_STATUS +acpi_aml_do_name ( + ACPI_OBJECT_TYPE data_type, + OPERATING_MODE load_exec_mode); + + +/* + * amstore - Object store support + */ + +ACPI_STATUS +acpi_aml_exec_store ( + ACPI_OPERAND_OBJECT *val_desc, + ACPI_OPERAND_OBJECT *dest_desc, + ACPI_WALK_STATE *walk_state); + +ACPI_STATUS +acpi_aml_store_object_to_object ( + ACPI_OPERAND_OBJECT *val_desc, + ACPI_OPERAND_OBJECT *dest_desc, + ACPI_WALK_STATE *walk_state); + +ACPI_STATUS +acpi_aml_store_object_to_node ( + ACPI_OPERAND_OBJECT *val_desc, + ACPI_NAMESPACE_NODE *node, + ACPI_WALK_STATE *walk_state); + + +/* + * amutils - interpreter/scanner utilities + */ + +void +acpi_aml_enter_interpreter ( + void); + +void +acpi_aml_exit_interpreter ( + void); + +u8 +acpi_aml_validate_object_type ( + ACPI_OBJECT_TYPE type); + +u8 +acpi_aml_acquire_global_lock ( + u32 rule); + +ACPI_STATUS +acpi_aml_release_global_lock ( + u8 locked); + +u32 +acpi_aml_buf_seq ( + void); + +u32 +acpi_aml_digits_needed ( + u32 value, + u32 base); + +ACPI_STATUS +acpi_aml_eisa_id_to_string ( + u32 numeric_id, + NATIVE_CHAR *out_string); + +ACPI_STATUS +acpi_aml_build_copy_internal_package_object ( + ACPI_OPERAND_OBJECT *source_obj, + ACPI_OPERAND_OBJECT *dest_obj, + ACPI_WALK_STATE *walk_state); + + +/* + * amregion - default Op_region handlers + */ + +ACPI_STATUS +acpi_aml_system_memory_space_handler ( + u32 function, + u32 address, + u32 bit_width, + u32 *value, + void *handler_context, + void *region_context); + +ACPI_STATUS +acpi_aml_system_io_space_handler ( + u32 function, + u32 address, + u32 bit_width, + u32 *value, + void *handler_context, + void *region_context); + +ACPI_STATUS +acpi_aml_pci_config_space_handler ( + u32 function, + u32 address, + u32 bit_width, + u32 *value, + void *handler_context, + void *region_context); + +ACPI_STATUS +acpi_aml_embedded_controller_space_handler ( + u32 function, + u32 address, + u32 bit_width, + u32 *value, + void *handler_context, + void *region_context); + +ACPI_STATUS +acpi_aml_sm_bus_space_handler ( + u32 function, + u32 address, + u32 bit_width, + u32 *value, + void *handler_context, + void *region_context); + + +#endif /* __INTERP_H__ */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/include/aclocal.h linux/drivers/acpi/include/aclocal.h --- v2.4.0-test8/linux/drivers/acpi/include/aclocal.h Wed Dec 31 16:00:00 1969 +++ linux/drivers/acpi/include/aclocal.h Fri Sep 15 14:30:30 2000 @@ -0,0 +1,851 @@ +/****************************************************************************** + * + * Name: aclocal.h - Internal data types used across the ACPI subsystem + * $Revision: 77 $ + * + *****************************************************************************/ + +/* + * 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 __ACLOCAL_H__ +#define __ACLOCAL_H__ + + +#define WAIT_FOREVER ((u32) -1) + +typedef void* ACPI_MUTEX; +typedef u32 ACPI_MUTEX_HANDLE; + + +/* Object descriptor types */ + +#define ACPI_CACHED_OBJECT 0x11 /* ORed in when object is cached */ +#define ACPI_DESC_TYPE_STATE 0x22 +#define ACPI_DESC_TYPE_WALK 0x44 +#define ACPI_DESC_TYPE_PARSER 0x66 +#define ACPI_DESC_TYPE_INTERNAL 0x88 +#define ACPI_DESC_TYPE_NAMED 0xAA + + +/***************************************************************************** + * + * Mutex typedefs and structs + * + ****************************************************************************/ + + +/* + * Predefined handles for the mutex objects used within the subsystem + * All mutex objects are automatically created by Acpi_cm_mutex_initialize. + * NOTE: any changes here must be reflected in the Acpi_gbl_Mutex_names table also! + */ + +#define ACPI_MTX_HARDWARE 0 +#define ACPI_MTX_MEMORY 1 +#define ACPI_MTX_CACHES 2 +#define ACPI_MTX_TABLES 3 +#define ACPI_MTX_PARSER 4 +#define ACPI_MTX_DISPATCHER 5 +#define ACPI_MTX_INTERPRETER 6 +#define ACPI_MTX_EXECUTE 7 +#define ACPI_MTX_NAMESPACE 8 +#define ACPI_MTX_EVENTS 9 +#define ACPI_MTX_OP_REGIONS 10 +#define ACPI_MTX_DEBUG_CMD_READY 11 +#define ACPI_MTX_DEBUG_CMD_COMPLETE 12 + +#define MAX_MTX 12 +#define NUM_MTX MAX_MTX+1 + + +#ifdef ACPI_DEBUG +#ifdef DEFINE_ACPI_GLOBALS + +/* Names for the mutexes used in the subsystem */ + +static NATIVE_CHAR *acpi_gbl_mutex_names[] = +{ + "ACPI_MTX_Hardware", + "ACPI_MTX_Memory", + "ACPI_MTX_Caches", + "ACPI_MTX_Tables", + "ACPI_MTX_Parser", + "ACPI_MTX_Dispatcher", + "ACPI_MTX_Interpreter", + "ACPI_MTX_Execute", + "ACPI_MTX_Namespace", + "ACPI_MTX_Events", + "ACPI_MTX_Op_regions", + "ACPI_MTX_Debug_cmd_ready", + "ACPI_MTX_Debug_cmd_complete" +}; + +#endif +#endif + + +/* Table for the global mutexes */ + +typedef struct acpi_mutex_info +{ + ACPI_MUTEX mutex; + u32 use_count; + u8 locked; + +} ACPI_MUTEX_INFO; + + +/* Lock flag parameter for various interfaces */ + +#define ACPI_MTX_DO_NOT_LOCK 0 +#define ACPI_MTX_LOCK 1 + + +typedef u16 ACPI_OWNER_ID; +#define OWNER_TYPE_TABLE 0x0 +#define OWNER_TYPE_METHOD 0x1 +#define FIRST_METHOD_ID 0x0000 +#define FIRST_TABLE_ID 0x8000 + +/* TBD: [Restructure] get rid of the need for this! */ + +#define TABLE_ID_DSDT (ACPI_OWNER_ID) 0xD1D1 + +/***************************************************************************** + * + * Namespace typedefs and structs + * + ****************************************************************************/ + + +/* Operational modes of the AML interpreter/scanner */ + +typedef enum +{ + IMODE_LOAD_PASS1 = 0x01, + IMODE_LOAD_PASS2 = 0x02, + IMODE_EXECUTE = 0x0E + +} OPERATING_MODE; + + +/* + * The Node describes a named object that appears in the AML + * An Acpi_node is used to store Nodes. + * + * Data_type is used to differentiate between internal descriptors, and MUST + * be the first byte in this structure. + */ + +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; + + + void *object; /* Pointer to attached ACPI object (optional) */ + struct acpi_node *child; /* first child */ + struct acpi_node *peer; /* Next peer*/ + u16 reference_count; /* Current count of references and children */ + u8 flags; + +} ACPI_NAMESPACE_NODE; + + +#define ENTRY_NOT_FOUND NULL + + +/* Node flags */ + +#define ANOBJ_AML_ATTACHMENT 0x1 +#define ANOBJ_END_OF_PEER_LIST 0x2 + + +/* + * ACPI Table Descriptor. One per ACPI table + */ +typedef struct acpi_table_desc +{ + struct acpi_table_desc *prev; + struct acpi_table_desc *next; + struct acpi_table_desc *installed_desc; + ACPI_TABLE_HEADER *pointer; + void *base_pointer; + u8 *aml_pointer; + u32 aml_length; + u32 length; + u32 count; + ACPI_OWNER_ID table_id; + u8 type; + u8 allocation; + u8 loaded_into_namespace; + +} ACPI_TABLE_DESC; + + +typedef struct +{ + NATIVE_CHAR *search_for; + ACPI_HANDLE *list; + u32 *count; + +} FIND_CONTEXT; + + +typedef struct +{ + ACPI_NAMESPACE_NODE *node; +} NS_SEARCH_DATA; + + +/* + * Predefined Namespace items + */ +#define ACPI_MAX_ADDRESS_SPACE 255 +#define ACPI_NUM_ADDRESS_SPACES 256 + + +typedef struct +{ + NATIVE_CHAR *name; + ACPI_OBJECT_TYPE type; + NATIVE_CHAR *val; + +} PREDEFINED_NAMES; + + +/***************************************************************************** + * + * Event typedefs and structs + * + ****************************************************************************/ + + +/* Status bits. */ + +#define ACPI_STATUS_PMTIMER 0x0001 +#define ACPI_STATUS_GLOBAL 0x0020 +#define ACPI_STATUS_POWER_BUTTON 0x0100 +#define ACPI_STATUS_SLEEP_BUTTON 0x0200 +#define ACPI_STATUS_RTC_ALARM 0x0400 + +/* Enable bits. */ + +#define ACPI_ENABLE_PMTIMER 0x0001 +#define ACPI_ENABLE_GLOBAL 0x0020 +#define ACPI_ENABLE_POWER_BUTTON 0x0100 +#define ACPI_ENABLE_SLEEP_BUTTON 0x0200 +#define ACPI_ENABLE_RTC_ALARM 0x0400 + + +/* + * Entry in the Address_space (AKA Operation Region) table + */ + +typedef struct +{ + ADDRESS_SPACE_HANDLER handler; + void *context; + +} ACPI_ADDRESS_SPACE_INFO; + + +/* Values and addresses of the GPE registers (both banks) */ + +typedef struct +{ + u8 status; /* Current value of status reg */ + u8 enable; /* Current value of enable reg */ + u16 status_addr; /* Address of status reg */ + u16 enable_addr; /* Address of enable reg */ + u8 gpe_base; /* Base GPE number */ + +} ACPI_GPE_REGISTERS; + + +#define ACPI_GPE_LEVEL_TRIGGERED 1 +#define ACPI_GPE_EDGE_TRIGGERED 2 + + +/* Information about each particular GPE level */ + +typedef struct +{ + u8 type; /* Level or Edge */ + + ACPI_HANDLE method_handle; /* Method handle for direct (fast) execution */ + GPE_HANDLER handler; /* Address of handler, if any */ + void *context; /* Context to be passed to handler */ + +} ACPI_GPE_LEVEL_INFO; + + +/* Information about each particular fixed event */ + +typedef struct +{ + FIXED_EVENT_HANDLER handler; /* Address of handler. */ + void *context; /* Context to be passed to handler */ + +} ACPI_FIXED_EVENT_INFO; + + +/* Information used during field processing */ + +typedef struct +{ + u8 skip_field; + u8 field_flag; + u32 pkg_length; + +} ACPI_FIELD_INFO; + + +/***************************************************************************** + * + * Generic "state" object for stacks + * + ****************************************************************************/ + + +#define CONTROL_NORMAL 0xC0 +#define CONTROL_CONDITIONAL_EXECUTING 0xC1 +#define CONTROL_PREDICATE_EXECUTING 0xC2 +#define CONTROL_PREDICATE_FALSE 0xC3 +#define CONTROL_PREDICATE_TRUE 0xC4 + + +/* Forward declaration */ +struct acpi_walk_state; +struct acpi_parse_obj ; + + +#define ACPI_STATE_COMMON /* Two 32-bit fields and a pointer */\ + u8 data_type; /* To differentiate various internal objs */\ + u8 flags; \ + u16 value; \ + u16 state; \ + u16 acpi_eval; \ + void *next; \ + +typedef struct acpi_common_state +{ + ACPI_STATE_COMMON +} ACPI_COMMON_STATE; + + +/* + * Update state - used to traverse complex objects such as packages + */ +typedef struct acpi_update_state +{ + ACPI_STATE_COMMON + union acpi_operand_obj *object; + +} ACPI_UPDATE_STATE; + +/* + * Control state - one per if/else and while constructs. + * Allows nesting of these constructs + */ +typedef struct acpi_control_state +{ + ACPI_STATE_COMMON + struct acpi_parse_obj *predicate_op; + u8 *aml_predicate_start; /* Start of if/while predicate */ + +} ACPI_CONTROL_STATE; + + +/* + * Scope state - current scope during namespace lookups + */ + +typedef struct acpi_scope_state +{ + ACPI_STATE_COMMON + ACPI_NAMESPACE_NODE *node; + +} ACPI_SCOPE_STATE; + + +typedef struct acpi_pscope_state +{ + ACPI_STATE_COMMON + struct acpi_parse_obj *op; /* current op being parsed */ + u8 *arg_end; /* current argument end */ + u8 *pkg_end; /* current package end */ + u32 arg_list; /* next argument to parse */ + u32 arg_count; /* Number of fixed arguments */ + +} ACPI_PSCOPE_STATE; + + +typedef union acpi_gen_state +{ + ACPI_COMMON_STATE common; + ACPI_CONTROL_STATE control; + ACPI_UPDATE_STATE update; + ACPI_SCOPE_STATE scope; + ACPI_PSCOPE_STATE parse_scope; + +} ACPI_GENERIC_STATE; + + +typedef +ACPI_STATUS (*ACPI_PARSE_DOWNWARDS) ( + u16 opcode, + struct acpi_parse_obj *op, + struct acpi_walk_state *walk_state, + struct acpi_parse_obj **out_op); + +typedef +ACPI_STATUS (*ACPI_PARSE_UPWARDS) ( + struct acpi_walk_state *walk_state, + struct acpi_parse_obj *op); + + +/***************************************************************************** + * + * Parser typedefs and structs + * + ****************************************************************************/ + + +#define ACPI_OP_CLASS_MASK 0x1F +#define ACPI_OP_ARGS_MASK 0x20 +#define ACPI_OP_TYPE_MASK 0xC0 + +#define ACPI_OP_TYPE_OPCODE 0x00 +#define ACPI_OP_TYPE_ASCII 0x40 +#define ACPI_OP_TYPE_PREFIX 0x80 +#define ACPI_OP_TYPE_UNKNOWN 0xC0 + +#define ACPI_GET_OP_CLASS(a) ((a)->flags & ACPI_OP_CLASS_MASK) +#define ACPI_GET_OP_ARGS(a) ((a)->flags & ACPI_OP_ARGS_MASK) +#define ACPI_GET_OP_TYPE(a) ((a)->flags & ACPI_OP_TYPE_MASK) + + +/* + * AML opcode, name, and argument layout + */ +typedef struct acpi_opcode_info +{ + u8 flags; /* Opcode type, Has_args flag */ + u32 parse_args; /* Grammar/Parse time arguments */ + u32 runtime_args; /* Interpret time arguments */ + + DEBUG_ONLY_MEMBERS ( + NATIVE_CHAR *name) /* op name (debug only) */ + +} ACPI_OPCODE_INFO; + + +typedef union acpi_parse_val +{ + u32 integer; /* integer constant */ + u32 size; /* bytelist or field size */ + NATIVE_CHAR *string; /* NULL terminated string */ + u8 *buffer; /* buffer or string */ + NATIVE_CHAR *name; /* NULL terminated string */ + struct acpi_parse_obj *arg; /* arguments and contained ops */ + +} ACPI_PARSE_VALUE; + + +#define ACPI_PARSE_COMMON \ + u8 data_type; /* To differentiate various internal objs */\ + u8 flags; /* Type of Op */\ + u16 opcode; /* AML opcode */\ + u32 aml_offset; /* offset of declaration in AML */\ + struct acpi_parse_obj *parent; /* parent op */\ + struct acpi_parse_obj *next; /* next op */\ + 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_PARSE_VALUE value; /* Value or args associated with the opcode */\ + + +/* + * generic operation (eg. If, While, Store) + */ +typedef struct acpi_parse_obj +{ + ACPI_PARSE_COMMON +} ACPI_PARSE_OBJECT; + + +/* + * Extended Op for named ops (Scope, Method, etc.), deferred ops (Methods and Op_regions), + * and bytelists. + */ +typedef struct acpi_parse2_obj +{ + ACPI_PARSE_COMMON + u8 *data; /* AML body or bytelist data */ + u32 length; /* AML length */ + u32 name; /* 4-byte name or zero if no name */ + +} ACPI_PARSE2_OBJECT; + + +/* + * Parse state - one state per parser invocation and each control + * method. + */ + +typedef struct acpi_parse_state +{ + u8 *aml_start; /* first AML byte */ + u8 *aml; /* next AML byte */ + u8 *aml_end; /* (last + 1) AML byte */ + u8 *pkg_start; /* current package begin */ + u8 *pkg_end; /* current package end */ + ACPI_PARSE_OBJECT *start_op; /* root of parse tree */ + struct acpi_node *start_node; + ACPI_GENERIC_STATE *scope; /* current scope */ + struct acpi_parse_state *next; + +} ACPI_PARSE_STATE; + + +/***************************************************************************** + * + * Tree walking typedefs and structs + * + ****************************************************************************/ + + +/* + * Walk state - current state of a parse tree walk. Used for both a leisurely stroll through + * the tree (for whatever reason), and for control method execution. + */ + +#define NEXT_OP_DOWNWARD 1 +#define NEXT_OP_UPWARD 2 + +#define WALK_METHOD 1 +#define WALK_NON_METHOD 0 + +typedef struct acpi_walk_state +{ + u8 data_type; /* To differentiate various internal objs */\ + ACPI_OWNER_ID owner_id; /* Owner of objects created during the walk */ + u8 last_predicate; /* Result of last predicate */ + u8 next_op_info; /* Info about Next_op */ + u8 num_operands; /* Stack pointer for Operands[] array */ + u8 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 */ + +/* 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 *control_state; /* List of control states (nested IFs) */ + ACPI_GENERIC_STATE *scope_info; /* Stack of nested scopes */ + ACPI_PARSE_STATE *parser_state; /* Current state of parser */ + u8 *aml_last_while; + ACPI_PARSE_DOWNWARDS descending_callback; + ACPI_PARSE_UPWARDS ascending_callback; + + union acpi_operand_obj *return_desc; /* Return object, if any */ + union acpi_operand_obj *method_desc; /* Method descriptor if running a method */ + struct acpi_node *method_node; /* Method Node if running a method */ + ACPI_PARSE_OBJECT *method_call_op; /* Method_call Op if running a method */ + struct acpi_node *method_call_node; /* Called method Node*/ + union acpi_operand_obj *operands[OBJ_NUM_OPERANDS]; /* Operands passed to the interpreter */ + 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; + u8 walk_type; + u8 return_used; + u32 prev_arg_types; + + /* Debug support */ + + u32 method_breakpoint; + + +} ACPI_WALK_STATE; + + +/* + * Walk list - head of a tree of walk states. Multiple walk states are created when there + * are nested control methods executing. + */ +typedef struct acpi_walk_list +{ + + ACPI_WALK_STATE *walk_state; + +} ACPI_WALK_LIST; + + +/* Info used by Acpi_ps_init_objects */ + +typedef struct init_walk_info +{ + u32 method_count; + u32 op_region_count; + ACPI_TABLE_DESC *table_desc; + +} INIT_WALK_INFO; + + +/* TBD: [Restructure] Merge with struct above */ + +typedef struct acpi_walk_info +{ + u32 debug_level; + u32 owner_id; + +} ACPI_WALK_INFO; + + +/***************************************************************************** + * + * Hardware and PNP + * + ****************************************************************************/ + + +/* Sleep states */ + +#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 + +/* + * The #define's and enum below establish an abstract way of identifying what + * register block and register is to be accessed. Do not change any of the + * 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 + +enum +{ + /* PM1 status register ids */ + + TMR_STS = (PM1_EVT | 0x01), + BM_STS, + GBL_STS, + PWRBTN_STS, + SLPBTN_STS, + RTC_STS, + WAK_STS, + + /* PM1 enable register ids */ + + 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 */ + + SCI_EN = (PM1_CONTROL | 0x01), + BM_RLD, + GBL_RLS, + SLP_TYPE_A, + SLP_TYPE_B, + SLP_EN, + + /* PM2 control register ids */ + + ARB_DIS = (PM2_CONTROL | 0x01), + + /* PM Timer register ids */ + + TMR_VAL = (PM_TIMER | 0x01), + + GPE0_STS = (GPE0_STS_BLOCK | 0x01), + GPE0_EN = (GPE0_EN_BLOCK | 0x01), + + GPE1_STS = (GPE1_STS_BLOCK | 0x01), + GPE1_EN = (GPE0_EN_BLOCK | 0x01), + + /* Last register value is one less than LAST_REG */ + + LAST_REG +}; + + +#define TMR_STS_MASK 0x0001 +#define BM_STS_MASK 0x0010 +#define GBL_STS_MASK 0x0020 +#define PWRBTN_STS_MASK 0x0100 +#define SLPBTN_STS_MASK 0x0200 +#define RTC_STS_MASK 0x0400 +#define WAK_STS_MASK 0x8000 + +#define ALL_FIXED_STS_BITS (TMR_STS_MASK | BM_STS_MASK | GBL_STS_MASK | PWRBTN_STS_MASK | \ + SLPBTN_STS_MASK | RTC_STS_MASK | WAK_STS_MASK) + +#define TMR_EN_MASK 0x0001 +#define GBL_EN_MASK 0x0020 +#define PWRBTN_EN_MASK 0x0100 +#define SLPBTN_EN_MASK 0x0200 +#define RTC_EN_MASK 0x0400 + +#define SCI_EN_MASK 0x0001 +#define BM_RLD_MASK 0x0002 +#define GBL_RLS_MASK 0x0004 +#define SLP_TYPE_X_MASK 0x1C00 +#define SLP_EN_MASK 0x2000 + +#define ARB_DIS_MASK 0x0001 + +#define GPE0_STS_MASK +#define GPE0_EN_MASK + +#define GPE1_STS_MASK +#define GPE1_EN_MASK + + +#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 */ + +/* Pnp and ACPI data */ + +#define VERSION_NO 0x01 +#define LOGICAL_DEVICE_ID 0x02 +#define COMPATIBLE_DEVICE_ID 0x03 +#define IRQ_FORMAT 0x04 +#define DMA_FORMAT 0x05 +#define START_DEPENDENT_TAG 0x06 +#define END_DEPENDENT_TAG 0x07 +#define IO_PORT_DESCRIPTOR 0x08 +#define FIXED_LOCATION_IO_DESCRIPTOR 0x09 +#define RESERVED_TYPE0 0x0A +#define RESERVED_TYPE1 0x0B +#define RESERVED_TYPE2 0x0C +#define RESERVED_TYPE3 0x0D +#define SMALL_VENDOR_DEFINED 0x0E +#define END_TAG 0x0F + +/* Pnp and ACPI data */ + +#define MEMORY_RANGE_24 0x81 +#define ISA_MEMORY_RANGE 0x81 +#define LARGE_VENDOR_DEFINED 0x84 +#define EISA_MEMORY_RANGE 0x85 +#define MEMORY_RANGE_32 0x85 +#define FIXED_EISA_MEMORY_RANGE 0x86 +#define FIXED_MEMORY_RANGE_32 0x86 + +/* ACPI only data */ + +#define DWORD_ADDRESS_SPACE 0x87 +#define WORD_ADDRESS_SPACE 0x88 +#define EXTENDED_IRQ 0x89 + +/* MUST HAVES */ + + +typedef enum +{ + DWORD_DEVICE_ID, + STRING_PTR_DEVICE_ID, + STRING_DEVICE_ID + +} DEVICE_ID_TYPE; + +typedef struct +{ + DEVICE_ID_TYPE type; + union + { + u32 number; + NATIVE_CHAR *string_ptr; + NATIVE_CHAR buffer[9]; + } data; + +} DEVICE_ID; + + +/***************************************************************************** + * + * Debug + * + ****************************************************************************/ + + +/* Entry for a memory allocation (debug only) */ + +#ifdef ACPI_DEBUG + +#define MEM_MALLOC 0 +#define MEM_CALLOC 1 +#define MAX_MODULE_NAME 16 + +typedef struct allocation_info +{ + struct allocation_info *previous; + struct allocation_info *next; + void *address; + u32 size; + u32 component; + u32 line; + NATIVE_CHAR module[MAX_MODULE_NAME]; + u8 alloc_type; + +} ALLOCATION_INFO; + +#endif + +#endif /* __ACLOCAL_H__ */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/include/acmacros.h linux/drivers/acpi/include/acmacros.h --- v2.4.0-test8/linux/drivers/acpi/include/acmacros.h Wed Dec 31 16:00:00 1969 +++ linux/drivers/acpi/include/acmacros.h Fri Sep 15 14:30:30 2000 @@ -0,0 +1,435 @@ +/****************************************************************************** + * + * Name: acmacros.h - C macros for the entire subsystem. + * $Revision: 48 $ + * + *****************************************************************************/ + +/* + * 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 __ACMACROS_H__ +#define __ACMACROS_H__ + +/* + * Data manipulation macros + */ + +#ifndef LOWORD +#define LOWORD(l) ((u16)(NATIVE_UINT)(l)) +#endif + +#ifndef HIWORD +#define HIWORD(l) ((u16)((((NATIVE_UINT)(l)) >> 16) & 0xFFFF)) +#endif + +#ifndef LOBYTE +#define LOBYTE(l) ((u8)(u16)(l)) +#endif + +#ifndef HIBYTE +#define HIBYTE(l) ((u8)((((u16)(l)) >> 8) & 0xFF)) +#endif + +#define BIT0(x) ((((x) & 0x01) > 0) ? 1 : 0) +#define BIT1(x) ((((x) & 0x02) > 0) ? 1 : 0) +#define BIT2(x) ((((x) & 0x04) > 0) ? 1 : 0) + +#define BIT3(x) ((((x) & 0x08) > 0) ? 1 : 0) +#define BIT4(x) ((((x) & 0x10) > 0) ? 1 : 0) +#define BIT5(x) ((((x) & 0x20) > 0) ? 1 : 0) +#define BIT6(x) ((((x) & 0x40) > 0) ? 1 : 0) +#define BIT7(x) ((((x) & 0x80) > 0) ? 1 : 0) + +#define LOW_BASE(w) ((u16) ((w) & 0x0000FFFF)) +#define MID_BASE(b) ((u8) (((b) & 0x00FF0000) >> 16)) +#define HI_BASE(b) ((u8) (((b) & 0xFF000000) >> 24)) +#define LOW_LIMIT(w) ((u16) ((w) & 0x0000FFFF)) +#define HI_LIMIT(b) ((u8) (((b) & 0x00FF0000) >> 16)) + + + /* + * Extract a byte of data using a pointer. Any more than a byte and we + * get into potential aligment issues -- see the STORE macros below + */ +#define GET8(addr) (*(u8*)(addr)) + + +/* + * Macros for moving data around to/from buffers that are possibly unaligned. + * If the hardware supports the transfer of unaligned data, just do the store. + * Otherwise, we have to move one byte at a time. + */ + +#ifdef _HW_ALIGNMENT_SUPPORT + +/* The hardware supports unaligned transfers, just do the move */ + +#define MOVE_UNALIGNED16_TO_16(d,s) *(u16*)(d) = *(u16*)(s) +#define MOVE_UNALIGNED32_TO_32(d,s) *(u32*)(d) = *(u32*)(s) +#define MOVE_UNALIGNED16_TO_32(d,s) *(u32*)(d) = *(u16*)(s) + +#else +/* + * The hardware does not support unaligned transfers. We must move the + * data one byte at a time. These macros work whether the source or + * the destination (or both) is/are unaligned. + */ + +#define MOVE_UNALIGNED16_TO_16(d,s) {((u8 *)(d))[0] = ((u8 *)(s))[0];\ + ((u8 *)(d))[1] = ((u8 *)(s))[1];} + +#define MOVE_UNALIGNED32_TO_32(d,s) {((u8 *)(d))[0] = ((u8 *)(s))[0];\ + ((u8 *)(d))[1] = ((u8 *)(s))[1];\ + ((u8 *)(d))[2] = ((u8 *)(s))[2];\ + ((u8 *)(d))[3] = ((u8 *)(s))[3];} + +#define MOVE_UNALIGNED16_TO_32(d,s) {(*(u32*)(d)) = 0; MOVE_UNALIGNED16_TO_16(d,s);} + +#endif + + +/* + * Fast power-of-two math macros for non-optimized compilers + */ + +#define _DIV(value,power_of2) ((u32) ((value) >> (power_of2))) +#define _MUL(value,power_of2) ((u32) ((value) << (power_of2))) +#define _MOD(value,divisor) ((u32) ((value) & ((divisor) -1))) + +#define DIV_2(a) _DIV(a,1) +#define MUL_2(a) _MUL(a,1) +#define MOD_2(a) _MOD(a,2) + +#define DIV_4(a) _DIV(a,2) +#define MUL_4(a) _MUL(a,2) +#define MOD_4(a) _MOD(a,4) + +#define DIV_8(a) _DIV(a,3) +#define MUL_8(a) _MUL(a,3) +#define MOD_8(a) _MOD(a,8) + +#define DIV_16(a) _DIV(a,4) +#define MUL_16(a) _MUL(a,4) +#define MOD_16(a) _MOD(a,16) + + +/* + * Rounding macros (Power of two boundaries only) + */ + +#define ROUND_DOWN(value,boundary) ((value) & (~((boundary)-1))) +#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_NATIVE_WORD(a) ROUND_DOWN(a,ALIGNED_ADDRESS_BOUNDARY) + +#define ROUND_UP_TO_32_bITS(a) ROUND_UP(a,4) +#define ROUND_UP_TO_NATIVE_WORD(a) ROUND_UP(a,ALIGNED_ADDRESS_BOUNDARY) + + +#ifdef DEBUG_ASSERT +#undef DEBUG_ASSERT +#endif + + +/* + * 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 + * appear. This macro is used to distinguish them. + * + * The Data_type field is the first field in both structures. + */ + +#define VALID_DESCRIPTOR_TYPE(d,t) (((ACPI_NAMESPACE_NODE *)d)->data_type == t) + + +/* Macro to test the object type */ + +#define IS_THIS_OBJECT_TYPE(d,t) (((ACPI_OPERAND_OBJECT *)d)->common.type == (u8)t) + +/* Macro to check the table flags for SINGLE or MULTIPLE tables are allowed */ + +#define IS_SINGLE_TABLE(x) (((x) & 0x01) == ACPI_TABLE_SINGLE ? 1 : 0) + +/* + * Macro to check if a pointer is within an ACPI table. + * Parameter (a) is the pointer to check. Parameter (b) must be defined + * as a pointer to an ACPI_TABLE_HEADER. (b+1) then points past the header, + * and ((u8 *)b+b->Length) points one byte past the end of the table. + */ + +#ifndef _IA16 +#define IS_IN_ACPI_TABLE(a,b) (((u8 *)(a) >= (u8 *)(b + 1)) &&\ + ((u8 *)(a) < ((u8 *)b + b->length))) + +#else +#define IS_IN_ACPI_TABLE(a,b) (_segment)(a) == (_segment)(b) &&\ + (((u8 *)(a) >= (u8 *)(b + 1)) &&\ + ((u8 *)(a) < ((u8 *)b + b->length))) +#endif + +/* + * Macros for the master AML opcode table + */ + +#ifdef ACPI_DEBUG +#define OP_INFO_ENTRY(flags,name,Pargs,Iargs) {flags,Pargs,Iargs,name} +#else +#define OP_INFO_ENTRY(flags,name,Pargs,Iargs) {flags,Pargs,Iargs} +#endif + +#define ARG_TYPE_WIDTH 5 +#define ARG_1(x) ((u32)(x)) +#define ARG_2(x) ((u32)(x) << (1 * ARG_TYPE_WIDTH)) +#define ARG_3(x) ((u32)(x) << (2 * ARG_TYPE_WIDTH)) +#define ARG_4(x) ((u32)(x) << (3 * ARG_TYPE_WIDTH)) +#define ARG_5(x) ((u32)(x) << (4 * ARG_TYPE_WIDTH)) +#define ARG_6(x) ((u32)(x) << (5 * ARG_TYPE_WIDTH)) + +#define ARGI_LIST1(a) (ARG_1(a)) +#define ARGI_LIST2(a,b) (ARG_1(b)|ARG_2(a)) +#define ARGI_LIST3(a,b,c) (ARG_1(c)|ARG_2(b)|ARG_3(a)) +#define ARGI_LIST4(a,b,c,d) (ARG_1(d)|ARG_2(c)|ARG_3(b)|ARG_4(a)) +#define ARGI_LIST5(a,b,c,d,e) (ARG_1(e)|ARG_2(d)|ARG_3(c)|ARG_4(b)|ARG_5(a)) +#define ARGI_LIST6(a,b,c,d,e,f) (ARG_1(f)|ARG_2(e)|ARG_3(d)|ARG_4(c)|ARG_5(b)|ARG_6(a)) + +#define ARGP_LIST1(a) (ARG_1(a)) +#define ARGP_LIST2(a,b) (ARG_1(a)|ARG_2(b)) +#define ARGP_LIST3(a,b,c) (ARG_1(a)|ARG_2(b)|ARG_3(c)) +#define ARGP_LIST4(a,b,c,d) (ARG_1(a)|ARG_2(b)|ARG_3(c)|ARG_4(d)) +#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) + + +/* + * Reporting macros that are never compiled out + */ + +/* + * Error reporting. These versions add callers module and line#. Since + * _THIS_MODULE gets compiled out when ACPI_DEBUG isn't defined, only + * use it in debug mode. + */ + +#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) + +#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) + +#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) + +/* Buffer dump macros */ + +#define DUMP_BUFFER(a,b) acpi_cm_dump_buffer((u8 *)a,b,DB_BYTE_DISPLAY,_COMPONENT) + +/* + * Debug macros that are conditionally compiled + */ + +#ifdef ACPI_DEBUG + +#define MODULE_NAME(name) static char *_THIS_MODULE = name; + +/* + * Function entry tracing. + * The first parameter should be the procedure name as a quoted string. This is declared + * as a local string ("_Proc_name) so that it can be also used by the function exit macros below. + */ + +#define FUNCTION_TRACE(a) char * _proc_name = a;\ + function_trace(_THIS_MODULE,__LINE__,_COMPONENT,a) +#define FUNCTION_TRACE_PTR(a,b) char * _proc_name = a;\ + function_trace_ptr(_THIS_MODULE,__LINE__,_COMPONENT,a,(void *)b) +#define FUNCTION_TRACE_U32(a,b) char * _proc_name = a;\ + function_trace_u32(_THIS_MODULE,__LINE__,_COMPONENT,a,(u32)b) +#define FUNCTION_TRACE_STR(a,b) char * _proc_name = a;\ + function_trace_str(_THIS_MODULE,__LINE__,_COMPONENT,a,(NATIVE_CHAR *)b) +/* + * Function exit tracing. + * WARNING: These macros include a return statement. This is usually considered + * bad form, but having a separate exit macro is very ugly and difficult to maintain. + * One of the FUNCTION_TRACE macros above must be used in conjunction with these macros + * so that "_Proc_name" is defined. + */ +#define return_VOID {function_exit(_THIS_MODULE,__LINE__,_COMPONENT,_proc_name);return;} +#define return_ACPI_STATUS(s) {function_status_exit(_THIS_MODULE,__LINE__,_COMPONENT,_proc_name,s);return(s);} +#define return_VALUE(s) {function_value_exit(_THIS_MODULE,__LINE__,_COMPONENT,_proc_name,(NATIVE_UINT)s);return(s);} +#define return_PTR(s) {function_ptr_exit(_THIS_MODULE,__LINE__,_COMPONENT,_proc_name,(u8 *)s);return(s);} + + +/* Conditional execution */ + +#define DEBUG_EXEC(a) a; +#define NORMAL_EXEC(a) + +#define DEBUG_DEFINE(a) a; +#define DEBUG_ONLY_MEMBERS(a) a; + + +/* Stack and buffer dumping */ + +#define DUMP_STACK_ENTRY(a) acpi_aml_dump_operand(a) +#define DUMP_OPERANDS(a,b,c,d,e) acpi_aml_dump_operands(a,b,c,d,e,_THIS_MODULE,__LINE__) + + +#define DUMP_ENTRY(a,b) acpi_ns_dump_entry (a,b) +#define DUMP_TABLES(a,b) acpi_ns_dump_tables(a,b) +#define DUMP_PATHNAME(a,b,c,d) acpi_ns_dump_pathname(a,b,c,d) +#define DUMP_RESOURCE_LIST(a) acpi_rs_dump_resource_list(a) +#define BREAK_MSG(a) acpi_os_breakpoint (a) + +/* + * Generate INT3 on ACPI_ERROR (Debug only!) + */ + +#define ERROR_BREAK +#ifdef ERROR_BREAK +#define BREAK_ON_ERROR(lvl) if ((lvl)&ACPI_ERROR) acpi_os_breakpoint("Fatal error encountered\n") +#else +#define BREAK_ON_ERROR(lvl) +#endif + +/* + * Master debug print macros + * Print iff: + * 1) Debug print for the current component is enabled + * 2) Debug error level or trace level for the print statement is enabled + * + */ + +#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_prefix (_THIS_MODULE,__LINE__);\ + debug_print_raw PARAM_LIST(fp);\ + BREAK_ON_ERROR(lvl);} + +#define DEBUG_PRINT_RAW(lvl,fp) TEST_DEBUG_SWITCH(lvl) {\ + debug_print_raw PARAM_LIST(fp);} + + +/* Assert macros */ + +#define ACPI_ASSERT(exp) if(!(exp)) \ + acpi_os_dbg_assert(#exp, __FILE__, __LINE__, "Failed Assertion") + +#define DEBUG_ASSERT(msg, exp) if(!(exp)) \ + acpi_os_dbg_assert(#exp, __FILE__, __LINE__, msg) + + +#else +/* + * This is the non-debug case -- make everything go away, + * leaving no executable debug code! + */ + +#define MODULE_NAME(name) +#define _THIS_MODULE "" + +#define DEBUG_EXEC(a) +#define NORMAL_EXEC(a) a; + +#define DEBUG_DEFINE(a) +#define DEBUG_ONLY_MEMBERS(a) +#define FUNCTION_TRACE(a) +#define FUNCTION_TRACE_PTR(a,b) +#define FUNCTION_TRACE_U32(a,b) +#define FUNCTION_TRACE_STR(a,b) +#define FUNCTION_EXIT +#define FUNCTION_STATUS_EXIT(s) +#define FUNCTION_VALUE_EXIT(s) +#define DUMP_STACK_ENTRY(a) +#define DUMP_OPERANDS(a,b,c,d,e) +#define DUMP_ENTRY(a,b) +#define DUMP_TABLES(a,b) +#define DUMP_PATHNAME(a,b,c,d) +#define DUMP_RESOURCE_LIST(a) +#define DEBUG_PRINT(l,f) +#define DEBUG_PRINT_RAW(l,f) +#define BREAK_MSG(a) + +#define return_VOID return +#define return_ACPI_STATUS(s) return(s) +#define return_VALUE(s) return(s) +#define return_PTR(s) return(s) + +#define ACPI_ASSERT(exp) +#define DEBUG_ASSERT(msg, exp) + +#endif + +/* + * Some code only gets executed when the debugger is built in. + * Note that this is entirely independent of whether the + * DEBUG_PRINT stuff (set by ACPI_DEBUG) is on, or not. + */ +#ifdef ENABLE_DEBUGGER +#define DEBUGGER_EXEC(a) a; +#else +#define DEBUGGER_EXEC(a) +#endif + + +/* + * For 16-bit code, we want to shrink some things even though + * we are using ACPI_DEBUG to get the debug output + */ +#ifdef _IA16 +#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} +#endif + + +#ifdef ACPI_DEBUG + +/* + * 1) Set name to blanks + * 2) Copy the object name + */ + +#define ADD_OBJECT_NAME(a,b) MEMSET (a->common.name, ' ', sizeof (a->common.name));\ + STRNCPY (a->common.name, acpi_gbl_ns_type_names[b], sizeof (a->common.name)) + +#else + +#define ADD_OBJECT_NAME(a,b) + +#endif + +#endif /* ACMACROS_H */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/include/acnamesp.h linux/drivers/acpi/include/acnamesp.h --- v2.4.0-test8/linux/drivers/acpi/include/acnamesp.h Wed Dec 31 16:00:00 1969 +++ linux/drivers/acpi/include/acnamesp.h Fri Sep 15 14:30:30 2000 @@ -0,0 +1,393 @@ +/****************************************************************************** + * + * Name: acnamesp.h - Namespace subcomponent prototypes and defines + * $Revision: 94 $ + * + *****************************************************************************/ + +/* + * 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 __ACNAMESP_H__ +#define __ACNAMESP_H__ + + +/* To search the entire name space, pass this as Search_base */ + +#define NS_ALL ((ACPI_HANDLE)0) + +/* + * Elements of Acpi_ns_properties are bit significant + * and should be one-to-one with values of ACPI_OBJECT_TYPE + */ +#define NSP_NORMAL 0 +#define NSP_NEWSCOPE 1 /* a definition of this type opens a name scope */ +#define NSP_LOCAL 2 /* suppress search of enclosing scopes */ + + +/* Definitions of the predefined namespace names */ + +#define ACPI_UNKNOWN_NAME (u32) 0x3F3F3F3F /* Unknown name is "????" */ +#define ACPI_ROOT_NAME (u32) 0x2F202020 /* Root name is "/ " */ +#define ACPI_SYS_BUS_NAME (u32) 0x5F53425F /* Sys bus name is "_SB_" */ + +#define NS_ROOT_PATH "/" +#define NS_SYSTEM_BUS "_SB_" + + +/* Flags for Acpi_ns_lookup, Acpi_ns_search_and_enter */ + +#define NS_NO_UPSEARCH 0 +#define NS_SEARCH_PARENT 0x01 +#define NS_DONT_OPEN_SCOPE 0x02 +#define NS_NO_PEER_SEARCH 0x04 + +#define NS_WALK_UNLOCK TRUE +#define NS_WALK_NO_UNLOCK FALSE + + +ACPI_STATUS +acpi_ns_walk_namespace ( + OBJECT_TYPE_INTERNAL type, + ACPI_HANDLE start_object, + u32 max_depth, + u8 unlock_before_callback, + WALK_CALLBACK user_function, + void *context, + void **return_value); + + +ACPI_NAMESPACE_NODE * +acpi_ns_get_next_object ( + OBJECT_TYPE_INTERNAL type, + ACPI_NAMESPACE_NODE *parent, + ACPI_NAMESPACE_NODE *child); + + +ACPI_STATUS +acpi_ns_delete_namespace_by_owner ( + u16 table_id); + + +/* Namespace loading - nsload */ + +ACPI_STATUS +acpi_ns_parse_table ( + ACPI_TABLE_DESC *table_desc, + ACPI_NAMESPACE_NODE *scope); + +ACPI_STATUS +acpi_ns_load_table ( + ACPI_TABLE_DESC *table_desc, + ACPI_NAMESPACE_NODE *node); + +ACPI_STATUS +acpi_ns_load_table_by_type ( + ACPI_TABLE_TYPE table_type); + + +/* + * Top-level namespace access - nsaccess + */ + + +ACPI_STATUS +acpi_ns_root_initialize ( + void); + +ACPI_STATUS +acpi_ns_lookup ( + ACPI_GENERIC_STATE *scope_info, + NATIVE_CHAR *name, + OBJECT_TYPE_INTERNAL type, + OPERATING_MODE interpreter_mode, + u32 flags, + ACPI_WALK_STATE *walk_state, + ACPI_NAMESPACE_NODE **ret_node); + + +/* + * Named object allocation/deallocation - nsalloc + */ + + +ACPI_NAMESPACE_NODE * +acpi_ns_create_node ( + u32 acpi_name); + +void +acpi_ns_delete_node ( + ACPI_NAMESPACE_NODE *node); + +ACPI_STATUS +acpi_ns_delete_namespace_subtree ( + ACPI_NAMESPACE_NODE *parent_handle); + +void +acpi_ns_detach_object ( + ACPI_NAMESPACE_NODE *node); + +void +acpi_ns_delete_children ( + ACPI_NAMESPACE_NODE *parent); + + +/* + * Namespace modification - nsmodify + */ + +ACPI_STATUS +acpi_ns_unload_namespace ( + ACPI_HANDLE handle); + +ACPI_STATUS +acpi_ns_delete_subtree ( + ACPI_HANDLE start_handle); + + +/* + * Namespace dump/print utilities - nsdump + */ + +void +acpi_ns_dump_tables ( + ACPI_HANDLE search_base, + u32 max_depth); + +void +acpi_ns_dump_entry ( + ACPI_HANDLE handle, + u32 debug_level); + +ACPI_STATUS +acpi_ns_dump_pathname ( + ACPI_HANDLE handle, + NATIVE_CHAR *msg, + u32 level, + u32 component); + +void +acpi_ns_dump_root_devices ( + void); + +void +acpi_ns_dump_objects ( + OBJECT_TYPE_INTERNAL type, + u32 max_depth, + u32 ownder_id, + ACPI_HANDLE start_handle); + + +/* + * Namespace evaluation functions - nseval + */ + +ACPI_STATUS +acpi_ns_evaluate_by_handle ( + ACPI_NAMESPACE_NODE *prefix_node, + ACPI_OPERAND_OBJECT **params, + ACPI_OPERAND_OBJECT **return_object); + +ACPI_STATUS +acpi_ns_evaluate_by_name ( + NATIVE_CHAR *pathname, + ACPI_OPERAND_OBJECT **params, + ACPI_OPERAND_OBJECT **return_object); + +ACPI_STATUS +acpi_ns_evaluate_relative ( + ACPI_NAMESPACE_NODE *prefix_node, + NATIVE_CHAR *pathname, + ACPI_OPERAND_OBJECT **params, + ACPI_OPERAND_OBJECT **return_object); + +ACPI_STATUS +acpi_ns_execute_control_method ( + ACPI_NAMESPACE_NODE *method_node, + ACPI_OPERAND_OBJECT **params, + ACPI_OPERAND_OBJECT **return_obj_desc); + +ACPI_STATUS +acpi_ns_get_object_value ( + ACPI_NAMESPACE_NODE *object_node, + ACPI_OPERAND_OBJECT **return_obj_desc); + + +/* + * Parent/Child/Peer utility functions - nsfamily + */ + +ACPI_NAME +acpi_ns_find_parent_name ( + ACPI_NAMESPACE_NODE *node_to_search); + +u8 +acpi_ns_exist_downstream_sibling ( + ACPI_NAMESPACE_NODE *this_node); + + +/* + * Scope manipulation - nsscope + */ + +u32 +acpi_ns_opens_scope ( + OBJECT_TYPE_INTERNAL type); + +NATIVE_CHAR * +acpi_ns_get_table_pathname ( + ACPI_NAMESPACE_NODE *node); + +NATIVE_CHAR * +acpi_ns_name_of_current_scope ( + ACPI_WALK_STATE *walk_state); + +ACPI_STATUS +acpi_ns_handle_to_pathname ( + ACPI_HANDLE obj_handle, + u32 *buf_size, + NATIVE_CHAR *user_buffer); + +u8 +acpi_ns_pattern_match ( + ACPI_NAMESPACE_NODE *obj_node, + NATIVE_CHAR *search_for); + +ACPI_STATUS +acpi_ns_name_compare ( + ACPI_HANDLE obj_handle, + u32 level, + void *context, + void **return_value); + +ACPI_STATUS +acpi_ns_get_node ( + NATIVE_CHAR *pathname, + ACPI_NAMESPACE_NODE *in_prefix_node, + ACPI_NAMESPACE_NODE **out_node); + +/* + * Object management for NTEs - nsobject + */ + +ACPI_STATUS +acpi_ns_attach_object ( + ACPI_NAMESPACE_NODE *node, + ACPI_OPERAND_OBJECT *object, + OBJECT_TYPE_INTERNAL type); + + +void * +acpi_ns_compare_value ( + ACPI_HANDLE obj_handle, + u32 level, + void *obj_desc); + + +/* + * Namespace searching and entry - nssearch + */ + +ACPI_STATUS +acpi_ns_search_and_enter ( + u32 entry_name, + ACPI_WALK_STATE *walk_state, + ACPI_NAMESPACE_NODE *node, + OPERATING_MODE interpreter_mode, + OBJECT_TYPE_INTERNAL type, + u32 flags, + ACPI_NAMESPACE_NODE **ret_node); + +ACPI_STATUS +acpi_ns_search_node ( + u32 entry_name, + ACPI_NAMESPACE_NODE *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, + ACPI_NAMESPACE_NODE *parent_node, /* Parent */ + ACPI_NAMESPACE_NODE *node, /* New Child*/ + OBJECT_TYPE_INTERNAL type); + + +/* + * Utility functions - nsutils + */ + +u8 +acpi_ns_valid_root_prefix ( + NATIVE_CHAR prefix); + +u8 +acpi_ns_valid_path_separator ( + NATIVE_CHAR sep); + +OBJECT_TYPE_INTERNAL +acpi_ns_get_type ( + ACPI_HANDLE obj_handle); + +void * +acpi_ns_get_attached_object ( + ACPI_HANDLE obj_handle); + +u32 +acpi_ns_local ( + OBJECT_TYPE_INTERNAL type); + +ACPI_STATUS +acpi_ns_internalize_name ( + NATIVE_CHAR *dotted_name, + NATIVE_CHAR **converted_name); + +ACPI_STATUS +acpi_ns_externalize_name ( + u32 internal_name_length, + NATIVE_CHAR *internal_name, + u32 *converted_name_length, + NATIVE_CHAR **converted_name); + +ACPI_NAMESPACE_NODE * +acpi_ns_convert_handle_to_entry ( + ACPI_HANDLE handle); + +ACPI_HANDLE +acpi_ns_convert_entry_to_handle( + ACPI_NAMESPACE_NODE *node); + +void +acpi_ns_terminate ( + void); + +ACPI_NAMESPACE_NODE * +acpi_ns_get_parent_object ( + ACPI_NAMESPACE_NODE *node); + + +ACPI_NAMESPACE_NODE * +acpi_ns_get_next_valid_object ( + ACPI_NAMESPACE_NODE *node); + + +#endif /* __ACNAMESP_H__ */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/include/acobject.h linux/drivers/acpi/include/acobject.h --- v2.4.0-test8/linux/drivers/acpi/include/acobject.h Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/include/acobject.h Fri Sep 15 14:30:30 2000 @@ -1,7 +1,8 @@ /****************************************************************************** * - * Name: acobject.h - Definition of ACPI_OBJECT_INTERNAL (Internal object only) + * Name: acobject.h - Definition of ACPI_OPERAND_OBJECT (Internal object only) + * $Revision: 71 $ * *****************************************************************************/ @@ -26,17 +27,14 @@ #ifndef _ACOBJECT_H #define _ACOBJECT_H -#include "actypes.h" -#include "macros.h" -#include "internal.h" /* - * The ACPI_OBJECT_INTERNAL is used to pass AML operands from the dispatcher + * The ACPI_OPERAND_OBJECT is used to pass AML operands from the dispatcher * to the interpreter, and to keep track of the various handlers such as * address space handlers and notify handlers. The object is a constant * size in order to allow them to be cached and reused. * - * All variants of the ACPI_OBJECT_INTERNAL are defined with the same + * All variants of the ACPI_OPERAND_OBJECT are defined with the same * sequence of field types, with fields that are not used in a particular * variant being named "Reserved". This is not strictly necessary, but * may in some circumstances simplify understanding if these structures @@ -60,32 +58,31 @@ */ -#define ACPI_OBJECT_COMMON_HEADER /* Two 32-bit fields */\ - u8 data_type; /* To differentiate various internal objs */\ - u8 type; /* ACPI_OBJECT_TYPE */\ - u8 size; /* Size of entire descriptor */\ - u8 flags;\ - u16 reference_count; /* For object deletion management */\ - u16 acpi_cm_fill2;\ - union acpi_obj_internal *next; \ +#define ACPI_OBJECT_COMMON_HEADER /* Two 32-bit fields, one pointer, 8-bit flag */\ + u8 data_type; /* To differentiate various internal objs */\ + u8 type; /* ACPI_OBJECT_TYPE */\ + u16 reference_count; /* For object deletion management */\ + u8 flags; \ /* Defines for flag byte above */ -#define AO_STATIC_ALLOCATION 0x1 +#define AOPOBJ_STATIC_ALLOCATION 0x1 +#define AOPOBJ_DATA_VALID 0x2 +#define AOPOBJ_INITIALIZED 0x4 /* * Common bitfield for the field objects */ #define ACPI_COMMON_FIELD_INFO /* Three 32-bit values */\ - u32 offset; /* Byte offset within containing object */\ - u16 length; /* # of bits in buffer */ \ - u8 granularity;\ - u8 bit_offset; /* Bit offset within min read/write data unit */\ - u8 access; /* Access_type */\ - u8 lock_rule;\ - u8 update_rule;\ - u8 access_attribute; + u8 granularity;\ + u16 length; \ + u32 offset; /* Byte offset within containing object */\ + u8 bit_offset; /* Bit offset within min read/write data unit */\ + u8 access; /* Access_type */\ + u8 lock_rule;\ + u8 update_rule;\ + u8 access_attribute; /****************************************************************************** @@ -98,25 +95,23 @@ typedef struct /* COMMON */ { ACPI_OBJECT_COMMON_HEADER - UCHAR first_non_common_byte; } ACPI_OBJECT_COMMON; +typedef struct /* CACHE_LIST */ +{ + ACPI_OBJECT_COMMON_HEADER + union acpi_operand_obj *next; /* Link for object cache and internal lists*/ + +} ACPI_OBJECT_CACHE_LIST; + + typedef struct /* NUMBER - has value */ { ACPI_OBJECT_COMMON_HEADER - u32 value; - u32 reserved2; - u32 reserved3; - u32 reserved4; - - void *reserved_p1; - void *reserved_p2; - void *reserved_p3; - void *reserved_p4; - void *reserved_p5; + u32 value; } ACPI_OBJECT_NUMBER; @@ -125,16 +120,8 @@ { ACPI_OBJECT_COMMON_HEADER - u32 length; /* # of bytes in string, excluding trailing null */ - u32 reserved2; - u32 reserved3; - u32 reserved4; - - char *pointer; /* String value in AML stream or in allocated space */ - void *reserved_p2; - void *reserved_p3; - void *reserved_p4; - void *reserved_p5; + u32 length; + NATIVE_CHAR *pointer; /* String value in AML stream or in allocated space */ } ACPI_OBJECT_STRING; @@ -143,16 +130,10 @@ { ACPI_OBJECT_COMMON_HEADER - u32 length; /* # of bytes in buffer */ - u32 sequence; /* Sequential count of buffers created */ - u32 reserved3; - u32 reserved4; - - u8 *pointer; /* points to the buffer in allocated space */ - void *reserved_p2; - void *reserved_p3; - void *reserved_p4; - void *reserved_p5; + u32 length; + u32 sequence; /* Sequential count of buffers created */ + + u8 *pointer; /* points to the buffer in allocated space */ } ACPI_OBJECT_BUFFER; @@ -161,16 +142,10 @@ { ACPI_OBJECT_COMMON_HEADER - u32 count; /* # of elements in package */ - u32 reserved2; - u32 reserved3; - u32 reserved4; - - union acpi_obj_internal **elements; /* Array of pointers to Acpi_objects */ - union acpi_obj_internal **next_element; /* used only while initializing */ - void *reserved_p3; - void *reserved_p4; - void *reserved_p5; + u32 count; /* # of elements in package */ + + union acpi_operand_obj **elements; /* Array of pointers to Acpi_objects */ + union acpi_operand_obj **next_element; /* used only while initializing */ } ACPI_OBJECT_PACKAGE; @@ -180,13 +155,9 @@ ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_FIELD_INFO - u32 sequence; /* Container's sequence number */ + u32 sequence; /* Container's sequence number */ - union acpi_obj_internal *container; /* Containing object (Buffer) */ - void *reserved_p2; - void *reserved_p3; - void *reserved_p4; - void *reserved_p5; + union acpi_operand_obj *container; /* Containing object (Buffer) */ } ACPI_OBJECT_FIELD_UNIT; @@ -195,16 +166,9 @@ { ACPI_OBJECT_COMMON_HEADER - u32 reserved1; - u32 reserved2; - u32 reserved3; - u32 reserved4; - - ACPI_HANDLE handle; - union acpi_obj_internal *sys_handler; /* Handler for system notifies */ - union acpi_obj_internal *drv_handler; /* Handler for driver notifies */ - union acpi_obj_internal *addr_handler; /* Handler for Address space */ - void *reserved_p5; + union acpi_operand_obj *sys_handler; /* Handler for system notifies */ + union acpi_operand_obj *drv_handler; /* Handler for driver notifies */ + union acpi_operand_obj *addr_handler; /* Handler for Address space */ } ACPI_OBJECT_DEVICE; @@ -213,18 +177,7 @@ { ACPI_OBJECT_COMMON_HEADER - u16 lock_count; - u16 thread_id; - u16 signal_count; - u16 fill1; - u32 reserved3; - u32 reserved4; - - void *semaphore; - void *reserved_p2; - void *reserved_p3; - void *reserved_p4; - void *reserved_p5; + void *semaphore; } ACPI_OBJECT_EVENT; @@ -234,21 +187,17 @@ typedef struct /* METHOD */ { ACPI_OBJECT_COMMON_HEADER + u8 method_flags; + u8 param_count; + + u32 pcode_length; - u8 method_flags; - u8 param_count; - u8 concurrency; - u8 fill1; - u32 pcode_length; - u32 table_length; - ACPI_OWNER_ID owning_id; - u16 reserved4; - - u8 *pcode; - u8 *acpi_table; - void *parser_op; - void *semaphore; - void *reserved_p5; + void *semaphore; + u8 *pcode; + + u8 concurrency; + u8 thread_count; + ACPI_OWNER_ID owning_id; } ACPI_OBJECT_METHOD; @@ -256,45 +205,31 @@ typedef struct /* MUTEX */ { ACPI_OBJECT_COMMON_HEADER + u16 sync_level; - u16 lock_count; - u16 thread_id; - u16 sync_level; - u16 fill1; - u32 reserved3; - u32 reserved4; - - void *semaphore; - void *reserved_p2; - void *reserved_p3; - void *reserved_p4; - void *reserved_p5; + void *semaphore; } ACPI_OBJECT_MUTEX; -/* Flags for Region */ - -#define INITIAL_REGION_FLAGS 0x0000 /* value set when the region is created */ -#define REGION_AGRUMENT_DATA_VALID 0x0001 /* Addr/Len are set */ -#define REGION_INITIALIZED 0x0002 /* region init handler has been called */ - /* this includes _REG method, if any */ typedef struct /* REGION */ { ACPI_OBJECT_COMMON_HEADER - u16 space_id; - u16 region_flags; /* bits defined above */ - u32 address; - u32 length; - u32 reserved4; /* Region Specific data (PCI _ADR) */ - - union acpi_obj_internal *method; /* Associated control method */ - union acpi_obj_internal *addr_handler; /* Handler for system notifies */ - union acpi_obj_internal *link; /* Link in list of regions */ - /* list is owned by Addr_handler */ - ACPI_NAMED_OBJECT *REGmethod; /* _REG method for this region (if any) */ - ACPI_NAMED_OBJECT *nte; /* containing object */ + 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 */ + + + 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; } ACPI_OBJECT_REGION; @@ -303,16 +238,11 @@ { ACPI_OBJECT_COMMON_HEADER - u32 system_level; - u32 resource_order; - u32 reserved3; - u32 reserved4; - - ACPI_HANDLE handle; - union acpi_obj_internal *sys_handler; /* Handler for system notifies */ - union acpi_obj_internal *drv_handler; /* Handler for driver notifies */ - void *reserved_p4; - void *reserved_p5; + u32 system_level; + u32 resource_order; + + union acpi_operand_obj *sys_handler; /* Handler for system notifies */ + union acpi_operand_obj *drv_handler; /* Handler for driver notifies */ } ACPI_OBJECT_POWER_RESOURCE; @@ -321,17 +251,13 @@ { ACPI_OBJECT_COMMON_HEADER - u32 proc_id; - ACPI_IO_ADDRESS pblk_address; - u16 fill1; - u32 pblk_length; - u32 reserved4; - - ACPI_HANDLE handle; - union acpi_obj_internal *sys_handler; /* Handler for system notifies */ - union acpi_obj_internal *drv_handler; /* Handler for driver notifies */ - union acpi_obj_internal *addr_handler; /* Handler for Address space */ - void *reserved_p5; + u32 proc_id; + u32 length; + ACPI_IO_ADDRESS address; + + union acpi_operand_obj *sys_handler; /* Handler for system notifies */ + union acpi_operand_obj *drv_handler; /* Handler for driver notifies */ + union acpi_operand_obj *addr_handler; /* Handler for Address space */ } ACPI_OBJECT_PROCESSOR; @@ -340,16 +266,9 @@ { ACPI_OBJECT_COMMON_HEADER - u32 reserved1; - u32 reserved2; - u32 reserved3; - u32 reserved4; - - ACPI_HANDLE handle; - union acpi_obj_internal *sys_handler; /* Handler for system notifies */ - union acpi_obj_internal *drv_handler; /* Handler for driver notifies */ - union acpi_obj_internal *addr_handler; /* Handler for Address space */ - void *reserved_p5; + union acpi_operand_obj *sys_handler; /* Handler for system notifies */ + union acpi_operand_obj *drv_handler; /* Handler for driver notifies */ + union acpi_operand_obj *addr_handler; /* Handler for Address space */ } ACPI_OBJECT_THERMAL_ZONE; @@ -358,18 +277,14 @@ * Internal types */ + typedef struct /* FIELD */ { ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_FIELD_INFO - u32 reserved4; - union acpi_obj_internal *container; /* Containing object */ - void *reserved_p2; - void *reserved_p3; - void *reserved_p4; - void *reserved_p5; + union acpi_operand_obj *container; /* Containing object */ } ACPI_OBJECT_FIELD; @@ -379,13 +294,10 @@ ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_FIELD_INFO - u32 value; /* Value to store into Bank_select */ + u32 value; /* Value to store into Bank_select */ - ACPI_HANDLE bank_select; /* Bank select register */ - union acpi_obj_internal *container; /* Containing object */ - void *reserved_p3; - void *reserved_p4; - void *reserved_p5; + ACPI_HANDLE bank_select; /* Bank select register */ + union acpi_operand_obj *container; /* Containing object */ } ACPI_OBJECT_BANK_FIELD; @@ -399,13 +311,10 @@ ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_FIELD_INFO - u32 value; /* Value to store into Index register */ + u32 value; /* Value to store into Index register */ - ACPI_HANDLE index; /* Index register */ - ACPI_HANDLE data; /* Data register */ - void *reserved_p3; - void *reserved_p4; - void *reserved_p5; + ACPI_HANDLE index; /* Index register */ + ACPI_HANDLE data; /* Data register */ } ACPI_OBJECT_INDEX_FIELD; @@ -414,16 +323,9 @@ { ACPI_OBJECT_COMMON_HEADER - u32 reserved1; - u32 reserved2; - u32 reserved3; - u32 reserved4; - - ACPI_NAMED_OBJECT *nte; /* Parent device */ - NOTIFY_HANDLER handler; - void *context; - void *reserved_p4; - void *reserved_p5; + ACPI_NAMESPACE_NODE *node; /* Parent device */ + NOTIFY_HANDLER handler; + void *context; } ACPI_OBJECT_NOTIFY_HANDLER; @@ -432,19 +334,20 @@ #define ADDR_HANDLER_DEFAULT_INSTALLED 0x1 + typedef struct /* ADDRESS HANDLER */ { ACPI_OBJECT_COMMON_HEADER - u16 space_id; - u16 hflags; - ADDRESS_SPACE_HANDLER handler; - - ACPI_NAMED_OBJECT *nte; /* Parent device */ - void *context; - ADDRESS_SPACE_SETUP setup; - union acpi_obj_internal *link; /* Link to next handler on device */ - union acpi_obj_internal *region_list; /* regions using this handler */ + u8 space_id; + u16 hflags; + ADDRESS_SPACE_HANDLER handler; + + ACPI_NAMESPACE_NODE *node; /* Parent device */ + void *context; + ADDRESS_SPACE_SETUP setup; + union acpi_operand_obj *region_list; /* regions using this handler */ + union acpi_operand_obj *next; } ACPI_OBJECT_ADDR_HANDLER; @@ -458,31 +361,27 @@ { ACPI_OBJECT_COMMON_HEADER - u16 op_code; - u8 fill1; - u8 target_type; /* Used for Index_op */ - u32 offset; /* Used for Arg_op, Local_op, and Index_op */ - u32 reserved3; - u32 reserved4; - - void *object; /* Name_op=>HANDLE to obj, Index_op=>ACPI_OBJECT_INTERNAL */ - ACPI_NAMED_OBJECT *nte; - union acpi_obj_internal **where; - void *reserved_p4; - void *reserved_p5; + u8 target_type; /* Used for Index_op */ + u16 op_code; + u32 offset; /* Used for Arg_op, Local_op, and Index_op */ + + void *object; /* Name_op=>HANDLE to obj, Index_op=>ACPI_OPERAND_OBJECT */ + ACPI_NAMESPACE_NODE *node; + union acpi_operand_obj **where; } ACPI_OBJECT_REFERENCE; /****************************************************************************** * - * ACPI_OBJECT_INTERNAL Descriptor - a giant union of all of the above + * ACPI_OPERAND_OBJECT Descriptor - a giant union of all of the above * *****************************************************************************/ -typedef union acpi_obj_internal +typedef union acpi_operand_obj { ACPI_OBJECT_COMMON common; + ACPI_OBJECT_CACHE_LIST cache; ACPI_OBJECT_NUMBER number; ACPI_OBJECT_STRING string; ACPI_OBJECT_BUFFER buffer; @@ -503,6 +402,6 @@ ACPI_OBJECT_NOTIFY_HANDLER notify_handler; ACPI_OBJECT_ADDR_HANDLER addr_handler; -} ACPI_OBJECT_INTERNAL; +} ACPI_OPERAND_OBJECT; #endif /* _ACOBJECT_H */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/include/acoutput.h linux/drivers/acpi/include/acoutput.h --- v2.4.0-test8/linux/drivers/acpi/include/acoutput.h Wed Dec 31 16:00:00 1969 +++ linux/drivers/acpi/include/acoutput.h Fri Sep 15 14:30:30 2000 @@ -0,0 +1,124 @@ +/****************************************************************************** + * + * Name: acoutput.h -- debug output + * $Revision: 63 $ + * + *****************************************************************************/ + +/* + * 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 __ACOUTPUT_H__ +#define __ACOUTPUT_H__ + +/* + * Debug levels and component IDs. These are used to control the + * granularity of the output of the DEBUG_PRINT macro -- on a per- + * component basis and a per-exception-type basis. + */ + +/* Component IDs -- used in the global "Debug_layer" */ + +#define GLOBAL 0x00000001 +#define COMMON 0x00000002 +#define PARSER 0x00000004 +#define DISPATCHER 0x00000008 +#define INTERPRETER 0x00000010 +#define NAMESPACE 0x00000020 +#define RESOURCE_MANAGER 0x00000040 +#define TABLE_MANAGER 0x00000080 +#define EVENT_HANDLING 0x00000100 +#define HARDWARE 0x00000200 +#define MISCELLANEOUS 0x00000400 +#define OS_DEPENDENT 0x00000800 + +#define BUS_MANAGER 0x00001000 + +#define PROCESSOR_CONTROL 0x00002000 +#define SYSTEM_CONTROL 0x00004000 +#define THERMAL_CONTROL 0x00008000 +#define POWER_CONTROL 0x00010000 + +#define EMBEDDED_CONTROLLER 0x00020000 +#define BATTERY 0x00040000 + +#define DEBUGGER 0x00100000 +#define ALL_COMPONENTS 0x001FFFFF + + +/* Exception level -- used in the global "Debug_level" */ + +#define ACPI_OK 0x00000001 +#define ACPI_INFO 0x00000002 +#define ACPI_WARN 0x00000004 +#define ACPI_ERROR 0x00000008 +#define ACPI_FATAL 0x00000010 +#define ACPI_DEBUG_OBJECT 0x00000020 +#define ACPI_ALL 0x0000003F + + +/* Trace level -- also used in the global "Debug_level" */ + +#define TRACE_PARSE 0x00000100 +#define TRACE_DISPATCH 0x00000200 +#define TRACE_LOAD 0x00000400 +#define TRACE_EXEC 0x00000800 +#define TRACE_NAMES 0x00001000 +#define TRACE_OPREGION 0x00002000 +#define TRACE_BFIELD 0x00004000 +#define TRACE_TRASH 0x00008000 +#define TRACE_TABLES 0x00010000 +#define TRACE_FUNCTIONS 0x00020000 +#define TRACE_VALUES 0x00040000 +#define TRACE_OBJECTS 0x00080000 +#define TRACE_ALLOCATIONS 0x00100000 +#define TRACE_RESOURCES 0x00200000 +#define TRACE_IO 0x00400000 +#define TRACE_INTERRUPTS 0x00800000 +#define TRACE_USER_REQUESTS 0x01000000 +#define TRACE_PACKAGE 0x02000000 +#define TRACE_MUTEX 0x04000000 + +#define TRACE_ALL 0x0FFFFF00 + + +/* Exceptionally verbose output -- also used in the global "Debug_level" */ + +#define VERBOSE_AML_DISASSEMBLE 0x10000000 +#define VERBOSE_INFO 0x20000000 +#define VERBOSE_TABLES 0x40000000 +#define VERBOSE_EVENTS 0x80000000 + +#define VERBOSE_ALL 0x70000000 + + +/* Defaults for Debug_level, debug and normal */ + +#define DEBUG_DEFAULT (ACPI_OK | ACPI_WARN | ACPI_ERROR | ACPI_DEBUG_OBJECT | TRACE_TABLES | TRACE_IO) +#define NORMAL_DEFAULT (ACPI_OK | ACPI_WARN | ACPI_ERROR | ACPI_DEBUG_OBJECT) +#define DEBUG_ALL (VERBOSE_AML_DISASSEMBLE | TRACE_ALL | ACPI_ALL) + +/* Misc defines */ + +#define HEX 0x01 +#define ASCII 0x02 +#define FULL_ADDRESS 0x04 +#define CHARS_PER_LINE 16 /* used in Dump_buf function */ + + +#endif /* __ACOUTPUT_H__ */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/include/acparser.h linux/drivers/acpi/include/acparser.h --- v2.4.0-test8/linux/drivers/acpi/include/acparser.h Wed Dec 31 16:00:00 1969 +++ linux/drivers/acpi/include/acparser.h Fri Sep 15 14:30:30 2000 @@ -0,0 +1,345 @@ +/****************************************************************************** + * + * Module Name: acparser.h - AML Parser subcomponent prototypes and defines + * $Revision: 46 $ + * + *****************************************************************************/ + +/* + * 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 __ACPARSER_H__ +#define __ACPARSER_H__ + + +#define OP_HAS_RETURN_VALUE 1 + +/* variable # arguments */ + +#define ACPI_VAR_ARGS ACPI_UINT32_MAX + +/* maximum virtual address */ + +#define ACPI_MAX_AML ((u8 *)(~0UL)) + + +#define ACPI_PARSE_DELETE_TREE 0x0001 +#define ACPI_PARSE_NO_TREE_DELETE 0x0000 +#define ACPI_PARSE_TREE_MASK 0x0001 + +#define ACPI_PARSE_LOAD_PASS1 0x0010 +#define ACPI_PARSE_LOAD_PASS2 0x0020 +#define ACPI_PARSE_EXECUTE 0x0030 +#define ACPI_PARSE_MODE_MASK 0x0030 + +/* psapi - Parser external interfaces */ + +ACPI_STATUS +acpi_psx_load_table ( + u8 *pcode_addr, + u32 pcode_length); + +ACPI_STATUS +acpi_psx_execute ( + ACPI_NAMESPACE_NODE *method_node, + ACPI_OPERAND_OBJECT **params, + ACPI_OPERAND_OBJECT **return_obj_desc); + + +u8 +acpi_ps_is_namespace_object_op ( + u16 opcode); +u8 +acpi_ps_is_namespace_op ( + u16 opcode); + + +/****************************************************************************** + * + * Parser interfaces + * + *****************************************************************************/ + + +/* psargs - Parse AML opcode arguments */ + +u8 * +acpi_ps_get_next_package_end ( + ACPI_PARSE_STATE *parser_state); + +u32 +acpi_ps_get_next_package_length ( + ACPI_PARSE_STATE *parser_state); + +NATIVE_CHAR * +acpi_ps_get_next_namestring ( + ACPI_PARSE_STATE *parser_state); + +void +acpi_ps_get_next_simple_arg ( + ACPI_PARSE_STATE *parser_state, + u32 arg_type, /* type of argument */ + ACPI_PARSE_OBJECT *arg); /* (OUT) argument data */ + +void +acpi_ps_get_next_namepath ( + ACPI_PARSE_STATE *parser_state, + ACPI_PARSE_OBJECT *arg, + u32 *arg_count, + u8 method_call); + +ACPI_PARSE_OBJECT * +acpi_ps_get_next_field ( + ACPI_PARSE_STATE *parser_state); + +ACPI_PARSE_OBJECT * +acpi_ps_get_next_arg ( + ACPI_PARSE_STATE *parser_state, + u32 arg_type, + u32 *arg_count); + + +/* psopcode - AML Opcode information */ + +ACPI_OPCODE_INFO * +acpi_ps_get_opcode_info ( + u16 opcode); + +NATIVE_CHAR * +acpi_ps_get_opcode_name ( + u16 opcode); + + +/* psparse - top level parsing routines */ + +ACPI_STATUS +acpi_ps_find_object ( + u16 opcode, + ACPI_PARSE_OBJECT *op, + ACPI_WALK_STATE *walk_state, + ACPI_PARSE_OBJECT **out_op); + +void +acpi_ps_delete_parse_tree ( + ACPI_PARSE_OBJECT *root); + +ACPI_STATUS +acpi_ps_parse_loop ( + ACPI_WALK_STATE *walk_state); + +ACPI_STATUS +acpi_ps_parse_aml ( + ACPI_PARSE_OBJECT *start_scope, + u8 *aml, + u32 aml_size, + u32 parse_flags, + ACPI_NAMESPACE_NODE *method_node, + ACPI_OPERAND_OBJECT **params, + ACPI_OPERAND_OBJECT **caller_return_desc, + ACPI_PARSE_DOWNWARDS descending_callback, + ACPI_PARSE_UPWARDS ascending_callback); + +ACPI_STATUS +acpi_ps_parse_table ( + u8 *aml, + u32 aml_size, + ACPI_PARSE_DOWNWARDS descending_callback, + ACPI_PARSE_UPWARDS ascending_callback, + ACPI_PARSE_OBJECT **root_object); + +u16 +acpi_ps_peek_opcode ( + ACPI_PARSE_STATE *state); + + +/* psscope - Scope stack management routines */ + + +ACPI_STATUS +acpi_ps_init_scope ( + ACPI_PARSE_STATE *parser_state, + ACPI_PARSE_OBJECT *root); + +ACPI_PARSE_OBJECT * +acpi_ps_get_parent_scope ( + ACPI_PARSE_STATE *state); + +u8 +acpi_ps_has_completed_scope ( + ACPI_PARSE_STATE *parser_state); + +void +acpi_ps_pop_scope ( + ACPI_PARSE_STATE *parser_state, + ACPI_PARSE_OBJECT **op, + u32 *arg_list); + +ACPI_STATUS +acpi_ps_push_scope ( + ACPI_PARSE_STATE *parser_state, + ACPI_PARSE_OBJECT *op, + u32 remaining_args, + u32 arg_count); + +void +acpi_ps_cleanup_scope ( + ACPI_PARSE_STATE *state); + + +/* pstree - parse tree manipulation routines */ + +void +acpi_ps_append_arg( + ACPI_PARSE_OBJECT *op, + ACPI_PARSE_OBJECT *arg); + +ACPI_PARSE_OBJECT* +acpi_ps_find ( + ACPI_PARSE_OBJECT *scope, + NATIVE_CHAR *path, + u16 opcode, + u32 create); + +ACPI_PARSE_OBJECT * +acpi_ps_get_arg( + ACPI_PARSE_OBJECT *op, + u32 argn); + +ACPI_PARSE_OBJECT * +acpi_ps_get_child ( + ACPI_PARSE_OBJECT *op); + +ACPI_PARSE_OBJECT * +acpi_ps_get_depth_next ( + ACPI_PARSE_OBJECT *origin, + ACPI_PARSE_OBJECT *op); + + +/* pswalk - parse tree walk routines */ + +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); + +ACPI_STATUS +acpi_ps_get_next_walk_op ( + ACPI_WALK_STATE *walk_state, + ACPI_PARSE_OBJECT *op, + ACPI_PARSE_UPWARDS ascending_callback); + + +/* psutils - parser utilities */ + + +ACPI_PARSE_STATE * +acpi_ps_create_state ( + u8 *aml, + u32 aml_size); + +void +acpi_ps_init_op ( + ACPI_PARSE_OBJECT *op, + u16 opcode); + +ACPI_PARSE_OBJECT * +acpi_ps_alloc_op ( + u16 opcode); + +void +acpi_ps_free_op ( + ACPI_PARSE_OBJECT *op); + +void +acpi_ps_delete_parse_cache ( + void); + +u8 +acpi_ps_is_leading_char ( + u32 c); + +u8 +acpi_ps_is_prefix_char ( + u32 c); + +u8 +acpi_ps_is_named_op ( + u16 opcode); + +u8 +acpi_ps_is_node_op ( + u16 opcode); + +u8 +acpi_ps_is_deferred_op ( + u16 opcode); + +u8 +acpi_ps_is_bytelist_op( + u16 opcode); + +u8 +acpi_ps_is_field_op( + u16 opcode); + +u8 +acpi_ps_is_create_field_op ( + u16 opcode); + +ACPI_PARSE2_OBJECT* +acpi_ps_to_extended_op( + ACPI_PARSE_OBJECT *op); + +u32 +acpi_ps_get_name( + ACPI_PARSE_OBJECT *op); + +void +acpi_ps_set_name( + ACPI_PARSE_OBJECT *op, + u32 name); + + +/* psdump - display parser tree */ + +u32 +acpi_ps_sprint_path ( + NATIVE_CHAR *buffer_start, + u32 buffer_size, + ACPI_PARSE_OBJECT *op); + +u32 +acpi_ps_sprint_op ( + NATIVE_CHAR *buffer_start, + u32 buffer_size, + ACPI_PARSE_OBJECT *op); + +void +acpi_ps_show ( + ACPI_PARSE_OBJECT *op); + + +#endif /* __ACPARSER_H__ */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/include/acpi.h linux/drivers/acpi/include/acpi.h --- v2.4.0-test8/linux/drivers/acpi/include/acpi.h Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/include/acpi.h Fri Sep 15 14:30:30 2000 @@ -1,7 +1,7 @@ - /****************************************************************************** * * Name: acpi.h - Master include file, Publics and external data. + * $Revision: 48 $ * *****************************************************************************/ @@ -31,20 +31,20 @@ * We put them here because we don't want to duplicate them * in the rest of the source code again and again. */ -#include "config.h" /* Configuration constants */ +#include "acconfig.h" /* Configuration constants */ #include "acenv.h" /* Target environment specific items */ #include "actypes.h" /* Fundamental data types */ #include "acexcep.h" /* Local exception codes */ -#include "macros.h" /* C macros */ -#include "actables.h" /* Acpi table definitions */ -#include "internal.h" /* Internal data types */ -#include "output.h" /* Error output and Debug macros */ +#include "acmacros.h" /* C macros */ +#include "actbl.h" /* Acpi table definitions */ +#include "aclocal.h" /* Internal data types */ +#include "acoutput.h" /* Error output and Debug macros */ #include "acpiosxf.h" /* Interfaces to the Acpi-to-OS layer*/ #include "acpixf.h" /* Acpi core external interfaces */ #include "acobject.h" /* Acpi internal object */ -#include "globals.h" /* All global variables */ -#include "hardware.h" /* Hardware defines and interfaces */ -#include "common.h" /* Common (global) interfaces */ +#include "acglobal.h" /* All global variables */ +#include "achware.h" /* Hardware defines and interfaces */ +#include "accommon.h" /* Common (global) interfaces */ #endif /* __ACPI_H__ */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/include/acpiosxf.h linux/drivers/acpi/include/acpiosxf.h --- v2.4.0-test8/linux/drivers/acpi/include/acpiosxf.h Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/include/acpiosxf.h Fri Sep 15 14:30:30 2000 @@ -244,7 +244,7 @@ ACPI_STATUS acpi_os_breakpoint ( - char *message); + NATIVE_CHAR *message); u8 acpi_os_readable ( @@ -264,12 +264,12 @@ s32 acpi_os_printf ( - const char *format, + const NATIVE_CHAR *format, ...); s32 acpi_os_vprintf ( - const char *format, + const NATIVE_CHAR *format, va_list args); /* @@ -278,7 +278,7 @@ u32 acpi_os_get_line ( - char *buffer); + NATIVE_CHAR *buffer); /* @@ -290,7 +290,7 @@ void *failed_assertion, void *file_name, u32 line_number, - char *message); + NATIVE_CHAR *message); #endif /* __ACPIOSD_H__ */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/include/acpixf.h linux/drivers/acpi/include/acpixf.h --- v2.4.0-test8/linux/drivers/acpi/include/acpixf.h Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/include/acpixf.h Fri Sep 15 14:30:30 2000 @@ -28,7 +28,7 @@ #define __ACXFACE_H__ #include "actypes.h" -#include "actables.h" +#include "actbl.h" /* * Global interfaces diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/include/acresrc.h linux/drivers/acpi/include/acresrc.h --- v2.4.0-test8/linux/drivers/acpi/include/acresrc.h Wed Dec 31 16:00:00 1969 +++ linux/drivers/acpi/include/acresrc.h Fri Sep 15 14:30:30 2000 @@ -0,0 +1,304 @@ +/****************************************************************************** + * + * Name: acresrc.h - Resource Manager function prototypes + * $Revision: 20 $ + * + *****************************************************************************/ + +/* + * 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 __ACRESRC_H__ +#define __ACRESRC_H__ + + +/* + * Function prototypes called from Acpi* APIs + */ + +ACPI_STATUS +acpi_rs_get_prt_method_data ( + ACPI_HANDLE handle, + ACPI_BUFFER *ret_buffer); + + +ACPI_STATUS +acpi_rs_get_crs_method_data ( + ACPI_HANDLE handle, + ACPI_BUFFER *ret_buffer); + +ACPI_STATUS +acpi_rs_get_prs_method_data ( + ACPI_HANDLE handle, + ACPI_BUFFER *ret_buffer); + +ACPI_STATUS +acpi_rs_set_srs_method_data ( + ACPI_HANDLE handle, + ACPI_BUFFER *ret_buffer); + +ACPI_STATUS +acpi_rs_create_resource_list ( + ACPI_OPERAND_OBJECT *byte_stream_buffer, + u8 *output_buffer, + u32 *output_buffer_length); + +ACPI_STATUS +acpi_rs_create_byte_stream ( + RESOURCE *linked_list_buffer, + u8 *output_buffer, + u32 *output_buffer_length); + +ACPI_STATUS +acpi_rs_create_pci_routing_table ( + ACPI_OPERAND_OBJECT *method_return_object, + u8 *output_buffer, + u32 *output_buffer_length); + + +/* + *Function prototypes called from Acpi_rs_create*APIs + */ + +void +acpi_rs_dump_resource_list ( + RESOURCE *resource); + +void +acpi_rs_dump_irq_list ( + u8 *route_table); + +ACPI_STATUS +acpi_rs_get_byte_stream_start ( + u8 *byte_stream_buffer, + u8 **byte_stream_start, + u32 *size); + +ACPI_STATUS +acpi_rs_calculate_list_length ( + u8 *byte_stream_buffer, + u32 byte_stream_buffer_length, + u32 *size_needed); + +ACPI_STATUS +acpi_rs_calculate_byte_stream_length ( + RESOURCE *linked_list_buffer, + u32 *size_needed); + +ACPI_STATUS +acpi_rs_calculate_pci_routing_table_length ( + ACPI_OPERAND_OBJECT *package_object, + u32 *buffer_size_needed); + +ACPI_STATUS +acpi_rs_byte_stream_to_list ( + u8 *byte_stream_buffer, + u32 byte_stream_buffer_length, + u8 **output_buffer); + +ACPI_STATUS +acpi_rs_list_to_byte_stream ( + RESOURCE *linked_list, + u32 byte_stream_size_needed, + u8 **output_buffer); + +ACPI_STATUS +acpi_rs_io_resource ( + u8 *byte_stream_buffer, + u32 *bytes_consumed, + u8 **output_buffer, + u32 *structure_size); + +ACPI_STATUS +acpi_rs_fixed_io_resource ( + u8 *byte_stream_buffer, + u32 *bytes_consumed, + u8 **output_buffer, + u32 *structure_size); + +ACPI_STATUS +acpi_rs_io_stream ( + RESOURCE *linked_list, + u8 **output_buffer, + u32 *bytes_consumed); + +ACPI_STATUS +acpi_rs_fixed_io_stream ( + RESOURCE *linked_list, + u8 **output_buffer, + u32 *bytes_consumed); + +ACPI_STATUS +acpi_rs_irq_resource ( + u8 *byte_stream_buffer, + u32 *bytes_consumed, + u8 **output_buffer, + u32 *structure_size); + +ACPI_STATUS +acpi_rs_irq_stream ( + RESOURCE *linked_list, + u8 **output_buffer, + u32 *bytes_consumed); + +ACPI_STATUS +acpi_rs_dma_resource ( + u8 *byte_stream_buffer, + u32 *bytes_consumed, + u8 **output_buffer, + u32 *structure_size); + +ACPI_STATUS +acpi_rs_dma_stream ( + RESOURCE *linked_list, + u8 **output_buffer, + u32 *bytes_consumed); + +ACPI_STATUS +acpi_rs_address16_resource ( + u8 *byte_stream_buffer, + u32 *bytes_consumed, + u8 **output_buffer, + u32 *structure_size); + +ACPI_STATUS +acpi_rs_address16_stream ( + RESOURCE *linked_list, + u8 **output_buffer, + u32 *bytes_consumed); + +ACPI_STATUS +acpi_rs_address32_resource ( + u8 *byte_stream_buffer, + u32 *bytes_consumed, + u8 **output_buffer, + u32 *structure_size); + +ACPI_STATUS +acpi_rs_address32_stream ( + RESOURCE *linked_list, + u8 **output_buffer, + u32 *bytes_consumed); + +ACPI_STATUS +acpi_rs_start_dependent_functions_resource ( + u8 *byte_stream_buffer, + u32 *bytes_consumed, + u8 **output_buffer, + u32 *structure_size); + +ACPI_STATUS +acpi_rs_end_dependent_functions_resource ( + u8 *byte_stream_buffer, + u32 *bytes_consumed, + u8 **output_buffer, + u32 *structure_size); + +ACPI_STATUS +acpi_rs_start_dependent_functions_stream ( + RESOURCE *linked_list, + u8 **output_buffer, + u32 *bytes_consumed); + +ACPI_STATUS +acpi_rs_end_dependent_functions_stream ( + RESOURCE *linked_list, + u8 **output_buffer, + u32 *bytes_consumed); + +ACPI_STATUS +acpi_rs_memory24_resource ( + u8 *byte_stream_buffer, + u32 *bytes_consumed, + u8 **output_buffer, + u32 *structure_size); + +ACPI_STATUS +acpi_rs_memory24_stream ( + RESOURCE *linked_list, + u8 **output_buffer, + u32 *bytes_consumed); + +ACPI_STATUS +acpi_rs_memory32_range_resource ( + u8 *byte_stream_buffer, + u32 *bytes_consumed, + u8 **output_buffer, + u32 *structure_size +); + +ACPI_STATUS +acpi_rs_fixed_memory32_resource ( + u8 *byte_stream_buffer, + u32 *bytes_consumed, + u8 **output_buffer, + u32 *structure_size); + +ACPI_STATUS +acpi_rs_memory32_range_stream ( + RESOURCE *linked_list, + u8 **output_buffer, + u32 *bytes_consumed); + +ACPI_STATUS +acpi_rs_fixed_memory32_stream ( + RESOURCE *linked_list, + u8 **output_buffer, + u32 *bytes_consumed); + +ACPI_STATUS +acpi_rs_extended_irq_resource ( + u8 *byte_stream_buffer, + u32 *bytes_consumed, + u8 **output_buffer, + u32 *structure_size); + +ACPI_STATUS +acpi_rs_extended_irq_stream ( + RESOURCE *linked_list, + u8 **output_buffer, + u32 *bytes_consumed); + +ACPI_STATUS +acpi_rs_end_tag_resource ( + u8 *byte_stream_buffer, + u32 *bytes_consumed, + u8 **output_buffer, + u32 *structure_size); + +ACPI_STATUS +acpi_rs_end_tag_stream ( + RESOURCE *linked_list, + u8 **output_buffer, + u32 *bytes_consumed); + +ACPI_STATUS +acpi_rs_vendor_resource ( + u8 *byte_stream_buffer, + u32 *bytes_consumed, + u8 **output_buffer, + u32 *structure_size); + +ACPI_STATUS +acpi_rs_vendor_stream ( + RESOURCE *linked_list, + u8 **output_buffer, + u32 *bytes_consumed); + + +#endif /* __ACRESRC_H__ */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/include/actables.h linux/drivers/acpi/include/actables.h --- v2.4.0-test8/linux/drivers/acpi/include/actables.h Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/include/actables.h Fri Sep 15 14:30:30 2000 @@ -1,7 +1,7 @@ - /****************************************************************************** * - * Name: actables.h - Table data structures defined in ACPI specification + * Name: actables.h - ACPI table management + * $Revision: 20 $ * *****************************************************************************/ @@ -27,162 +27,139 @@ #define __ACTABLES_H__ -/* - * 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 GL_OWNED 0x02 /* Ownership of global lock is bit 1 */ +/* Used in Acpi_tb_map_acpi_table for size parameter if table header is to be used */ -/* values of Mapic.Model */ +#define SIZE_IN_HEADER 0 -#define DUAL_PIC 0 -#define MULTIPLE_APIC 1 -/* values of Type in APIC_HEADER */ - -#define APIC_PROC 0 -#define APIC_IO 1 +ACPI_STATUS +acpi_tb_handle_to_object ( + u16 table_id, + ACPI_TABLE_DESC **table_desc); /* - * Architecture-independent tables - * The architecture dependent tables are in separate files + * Acpi_tbfac - FACP, FACS utilities */ -typedef struct /* Root System Descriptor Pointer */ -{ - char signature [8]; /* contains "RSD PTR " */ - u8 checksum; /* to make sum of struct == 0 */ - char oem_id [6]; /* OEM identification */ - u8 reserved; /* reserved - must be zero */ - u32 rsdt_physical_address; /* physical address of RSDT */ - -} ROOT_SYSTEM_DESCRIPTOR_POINTER; +ACPI_STATUS +acpi_tb_get_table_facs ( + ACPI_TABLE_HEADER *buffer_ptr, + ACPI_TABLE_DESC *table_info); -typedef struct /* ACPI common table header */ -{ - char signature [4]; /* identifies type of table */ - u32 length; /* length of table, in bytes, - * including header */ - u8 revision; /* specification minor version # */ - u8 checksum; /* to make sum of entire table == 0 */ - char oem_id [6]; /* OEM identification */ - char oem_table_id [8]; /* OEM table identification */ - u32 oem_revision; /* OEM revision number */ - char asl_compiler_id [4]; /* ASL compiler vendor ID */ - u32 asl_compiler_revision; /* ASL compiler revision number */ +/* + * Acpi_tbget - Table "get" routines + */ -} ACPI_TABLE_HEADER; +ACPI_STATUS +acpi_tb_get_table_ptr ( + ACPI_TABLE_TYPE table_type, + u32 instance, + ACPI_TABLE_HEADER **table_ptr_loc); +ACPI_STATUS +acpi_tb_get_table ( + void *physical_address, + ACPI_TABLE_HEADER *buffer_ptr, + ACPI_TABLE_DESC *table_info); -typedef struct /* APIC Table */ -{ - ACPI_TABLE_HEADER header; /* table header */ - u32 local_apic_address; /* Physical address for accessing local APICs */ - u32 PCATcompat : 1; /* a one indicates system also has dual 8259s */ - u32 reserved1 : 31; -} APIC_TABLE; +/* + * Acpi_tbgetall - Get all firmware ACPI tables + */ +ACPI_STATUS +acpi_tb_get_all_tables ( + u32 number_of_tables, + ACPI_TABLE_HEADER *buffer_ptr); -typedef struct /* APIC Header */ -{ - u8 type; /* APIC type. Either APIC_PROC or APIC_IO */ - u8 length; /* Length of APIC structure */ -} APIC_HEADER; +/* + * Acpi_tbinstall - Table installation + */ +ACPI_STATUS +acpi_tb_install_table ( + ACPI_TABLE_HEADER *table_ptr, + ACPI_TABLE_DESC *table_info); -typedef struct /* Processor APIC */ -{ - APIC_HEADER header; - u8 processor_apic_id; /* ACPI processor id */ - u8 local_apic_id; /* processor's local APIC id */ - u32 processor_enabled: 1; /* Processor is usable if set */ - u32 reserved1 : 32; +ACPI_STATUS +acpi_tb_recognize_table ( + ACPI_TABLE_HEADER *table_ptr, + ACPI_TABLE_DESC *table_info); -} PROCESSOR_APIC; +ACPI_STATUS +acpi_tb_init_table_descriptor ( + ACPI_TABLE_TYPE table_type, + ACPI_TABLE_DESC *table_info); -typedef struct /* IO APIC */ -{ - APIC_HEADER header; - u8 io_apic_id; /* I/O APIC ID */ - u8 reserved; /* reserved - must be zero */ - u32 io_apic_address; /* APIC's physical address */ - u32 vector; /* interrupt vector index where INTI - * lines start */ -} IO_APIC; +/* + * Acpi_tbremove - Table removal and deletion + */ +void +acpi_tb_delete_acpi_tables ( + void); -/* -** IA64 TODO: Add SAPIC Tables -*/ +void +acpi_tb_delete_acpi_table ( + ACPI_TABLE_TYPE type); -/* -** IA64 TODO: Modify Smart Battery Description to comply with ACPI IA64 -** extensions. -*/ -typedef struct /* Smart Battery Description Table */ -{ - ACPI_TABLE_HEADER header; - u32 warning_level; - u32 low_level; - u32 critical_level; +ACPI_TABLE_DESC * +acpi_tb_delete_single_table ( + ACPI_TABLE_DESC *table_desc); -} SMART_BATTERY_DESCRIPTION_TABLE; +void +acpi_tb_free_acpi_tables_of_type ( + ACPI_TABLE_DESC *table_info); /* - * ACPI Table information. We save the table address, length, - * and type of memory allocation (mapped or allocated) for each - * table for 1) when we exit, and 2) if a new table is installed + * Acpi_tbrsd - RSDP, RSDT utilities */ -#define ACPI_MEM_NOT_ALLOCATED 0 -#define ACPI_MEM_ALLOCATED 1 -#define ACPI_MEM_MAPPED 2 - -#define ACPI_TABLE_SINGLE 0 -#define ACPI_TABLE_MULTIPLE 1 - - -/* Data about each known table type */ +ACPI_STATUS +acpi_tb_get_table_rsdt ( + u32 *number_of_tables); -typedef struct _acpi_table_support -{ - char *name; - char *signature; - u8 sig_length; - u8 flags; - u16 status; - void **global_ptr; +u8 * +acpi_tb_scan_memory_for_rsdp ( + u8 *start_address, + u32 length); -} ACPI_TABLE_SUPPORT; +ACPI_STATUS +acpi_tb_find_rsdp ( + ACPI_TABLE_DESC *table_info); /* - * Get the architecture-specific tables + * Acpi_tbutils - common table utilities */ -#ifdef IA64 -#include "actbl64.h" -#else -#include "actbl32.h" -#endif +u8 +acpi_tb_system_table_pointer ( + void *where); + +ACPI_STATUS +acpi_tb_map_acpi_table ( + void *physical_address, + u32 *size, + void **logical_address); + +ACPI_STATUS +acpi_tb_verify_table_checksum ( + ACPI_TABLE_HEADER *table_header); + +u8 +acpi_tb_checksum ( + void *buffer, + u32 length); + +ACPI_STATUS +acpi_tb_validate_table_header ( + ACPI_TABLE_HEADER *table_header); #endif /* __ACTABLES_H__ */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/include/actbl.h linux/drivers/acpi/include/actbl.h --- v2.4.0-test8/linux/drivers/acpi/include/actbl.h Wed Dec 31 16:00:00 1969 +++ linux/drivers/acpi/include/actbl.h Fri Sep 15 14:30:30 2000 @@ -0,0 +1,190 @@ +/****************************************************************************** + * + * Name: actbl.h - Table data structures defined in ACPI specification + * $Revision: 34 $ + * + *****************************************************************************/ + +/* + * 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 __ACTBL_H__ +#define __ACTBL_H__ + + +/* + * 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 GL_OWNED 0x02 /* Ownership of global lock is bit 1 */ + +/* values of Mapic.Model */ + +#define DUAL_PIC 0 +#define MULTIPLE_APIC 1 + +/* values of Type in APIC_HEADER */ + +#define APIC_PROC 0 +#define APIC_IO 1 + + +/* + * Architecture-independent tables + * The architecture dependent tables are in separate files + */ + +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 */ + +} ROOT_SYSTEM_DESCRIPTOR_POINTER; + + +typedef struct /* ACPI common table header */ +{ + NATIVE_CHAR signature [4]; /* identifies type of table */ + u32 length; /* length of table, in bytes, + * including header */ + u8 revision; /* specification minor version # */ + u8 checksum; /* to make sum of entire table == 0 */ + NATIVE_CHAR oem_id [6]; /* OEM identification */ + NATIVE_CHAR oem_table_id [8]; /* OEM table identification */ + u32 oem_revision; /* OEM revision number */ + NATIVE_CHAR asl_compiler_id [4]; /* ASL compiler vendor ID */ + u32 asl_compiler_revision; /* ASL compiler revision number */ + +} ACPI_TABLE_HEADER; + + +typedef struct /* APIC Table */ +{ + ACPI_TABLE_HEADER header; /* table header */ + u32 local_apic_address; /* Physical address for accessing local APICs */ + u32 PCATcompat : 1; /* a one indicates system also has dual 8259s */ + u32 reserved1 : 31; + +} APIC_TABLE; + + +typedef struct /* APIC Header */ +{ + u8 type; /* APIC type. Either APIC_PROC or APIC_IO */ + u8 length; /* Length of APIC structure */ + +} APIC_HEADER; + + +typedef struct /* Processor APIC */ +{ + APIC_HEADER header; + u8 processor_apic_id; /* ACPI processor id */ + u8 local_apic_id; /* processor's local APIC id */ + u32 processor_enabled: 1; /* Processor is usable if set */ + u32 reserved1 : 32; + +} PROCESSOR_APIC; + + +typedef struct /* IO APIC */ +{ + APIC_HEADER header; + u8 io_apic_id; /* I/O APIC ID */ + u8 reserved; /* reserved - must be zero */ + u32 io_apic_address; /* APIC's physical address */ + u32 vector; /* interrupt vector index where INTI + * lines start */ +} IO_APIC; + + +/* +** IA64 TODO: Add SAPIC Tables +*/ + +/* +** IA64 TODO: Modify Smart Battery Description to comply with ACPI IA64 +** extensions. +*/ +typedef struct /* Smart Battery Description Table */ +{ + ACPI_TABLE_HEADER header; + u32 warning_level; + u32 low_level; + u32 critical_level; + +} SMART_BATTERY_DESCRIPTION_TABLE; + + +/* + * ACPI Table information. We save the table address, length, + * and type of memory allocation (mapped or allocated) for each + * table for 1) when we exit, and 2) if a new table is installed + */ + +#define ACPI_MEM_NOT_ALLOCATED 0 +#define ACPI_MEM_ALLOCATED 1 +#define ACPI_MEM_MAPPED 2 + +/* Definitions for the Flags bitfield member of ACPI_TABLE_SUPPORT */ + +#define ACPI_TABLE_SINGLE 0 +#define ACPI_TABLE_MULTIPLE 1 + + +/* Data about each known table type */ + +typedef struct _acpi_table_support +{ + NATIVE_CHAR *name; + NATIVE_CHAR *signature; + u8 sig_length; + u8 flags; + u16 status; + void **global_ptr; + +} ACPI_TABLE_SUPPORT; + + +/* + * Get the architecture-specific tables + */ + +#ifdef IA64 +#include "actbl64.h" +#else +#include "actbl32.h" +#endif + + +#endif /* __ACTBL_H__ */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/include/actbl32.h linux/drivers/acpi/include/actbl32.h --- v2.4.0-test8/linux/drivers/acpi/include/actbl32.h Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/include/actbl32.h Fri Sep 15 14:30:30 2000 @@ -1,6 +1,7 @@ /****************************************************************************** * * Name: actbl32.h - ACPI tables specific to IA32 + * $Revision: 11 $ * *****************************************************************************/ @@ -40,7 +41,7 @@ typedef struct { - char signature[4]; /* signature "FACS" */ + 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 */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/include/actbl64.h linux/drivers/acpi/include/actbl64.h --- v2.4.0-test8/linux/drivers/acpi/include/actbl64.h Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/include/actbl64.h Fri Sep 15 14:30:30 2000 @@ -1,7 +1,7 @@ - /****************************************************************************** * * Name: actbl64.h - ACPI tables specific to IA64 + * $Revision: 12 $ * *****************************************************************************/ @@ -45,7 +45,7 @@ typedef struct { - char signature[4]; /* signature "FACS" */ + NATIVE_CHAR signature[4]; /* signature "FACS" */ u32 length; /* length of structure, in bytes */ u32 hardware_signature; /* hardware configuration signature */ u32 reserved4; /* must be 0 */ @@ -65,7 +65,7 @@ ACPI_TABLE_HEADER header; /* table header */ u32 reserved_pad; /* IA64 alignment, must be 0 */ ACPI_TBLPTR firmware_ctrl; /* Physical address of FACS */ - ACPI_TBLPTR acpi_dsdt; /* Physical address of DSDT */ + 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 */ @@ -90,8 +90,8 @@ 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 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 */ @@ -99,11 +99,11 @@ 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 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 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 */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/include/actypes.h linux/drivers/acpi/include/actypes.h --- v2.4.0-test8/linux/drivers/acpi/include/actypes.h Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/include/actypes.h Fri Sep 15 14:30:30 2000 @@ -1,7 +1,7 @@ - /****************************************************************************** * * Name: actypes.h - Common data types for the entire ACPI subsystem + * $Revision: 131 $ * *****************************************************************************/ @@ -23,15 +23,18 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef _ACTYPES_H -#define _ACTYPES_H +#ifndef __ACTYPES_H__ +#define __ACTYPES_H__ /*! [Begin] no source code translation (keep the typedefs) */ /* * Data types - Fixed across all compilation models * - * BOOLEAN Logical Boolean. 1 byte value containing a 0 for FALSE or a 1 for TRUE. Other values are undefined. + * BOOLEAN Logical Boolean. + * 1 byte value containing a 0 for FALSE or a 1 for TRUE. + * Other values are undefined. + * * INT8 8-bit (1 byte) signed value * UINT8 8-bit (1 byte) unsigned value * INT16 16-bit (2 byte) signed value @@ -45,14 +48,17 @@ * UCHAR Character. 1 byte unsigned value. */ +#ifdef __ia64__ +#define _IA64 +#endif + #ifdef _IA64 /* * 64-bit type definitions */ -typedef signed char INT8; typedef unsigned char UINT8; +typedef unsigned char BOOLEAN; typedef unsigned char UCHAR; -typedef short INT16; typedef unsigned short UINT16; typedef int INT32; typedef unsigned int UINT32; @@ -74,10 +80,9 @@ /* * 16-bit type definitions */ -typedef signed char INT8; typedef unsigned char UINT8; +typedef unsigned char BOOLEAN; typedef unsigned char UCHAR; -typedef int INT16; typedef unsigned int UINT16; typedef long INT32; typedef unsigned long UINT32; @@ -96,10 +101,9 @@ /* * 32-bit type definitions (default) */ -typedef signed char INT8; typedef unsigned char UINT8; +typedef unsigned char BOOLEAN; typedef unsigned char UCHAR; -typedef short INT16; typedef unsigned short UINT16; typedef int INT32; typedef unsigned int UINT32; @@ -113,19 +117,15 @@ #define ALIGNED_ADDRESS_BOUNDARY 0x00000004 #define _HW_ALIGNMENT_SUPPORT - #endif - - /* * Miscellaneous common types */ -typedef UINT8 BOOLEAN; typedef UINT32 UINT32_BIT; -typedef NATIVE_INT ACPI_PTRDIFF; -typedef NATIVE_UINT ACPI_SIZE; +typedef NATIVE_UINT ACPI_PTRDIFF; +typedef char NATIVE_CHAR; /* @@ -133,7 +133,6 @@ */ #define ACPI_UCHAR_MAX (UCHAR) 0xFF -#define ACPI_INT32_MAX (INT32) 0x7FFFFFFF #define ACPI_UINT32_MAX (UINT32) 0xFFFFFFFF @@ -141,14 +140,11 @@ /* * Types used only in translated source */ -typedef INT8 s8; -typedef INT16 s16; typedef INT32 s32; typedef UINT8 u8; typedef UINT16 u16; typedef UINT32 u32; #endif - /*! [End] no source code translation !*/ @@ -176,9 +172,9 @@ */ typedef u32 ACPI_STATUS; /* All ACPI Exceptions */ -typedef u32 ACPI_NAME; /* 4-char ACPI name */ +typedef u32 ACPI_NAME; /* 4-s8 ACPI name */ typedef char* ACPI_STRING; /* Null terminated ASCII string */ -typedef void* ACPI_HANDLE; /* Actually a ptr to an NTE */ +typedef void* ACPI_HANDLE; /* Actually a ptr to an Node */ /* @@ -223,10 +219,12 @@ /* * Types associated with names. The first group of - * values correspond to the definition of the ACPI Object_type operator (See the ACPI Spec). - * Therefore, only add to the first group if the spec changes! + * values correspond to the definition of the ACPI + * Object_type operator (See the ACPI Spec). Therefore, + * only add to the first group if the spec changes! * - * Types must be kept in sync with the Acpi_ns_properties and Acpi_ns_type_names arrays + * Types must be kept in sync with the Acpi_ns_properties + * and Acpi_ns_type_names arrays */ typedef u32 ACPI_OBJECT_TYPE; @@ -238,14 +236,14 @@ #define ACPI_TYPE_BUFFER 3 /* 0x03 */ #define ACPI_TYPE_PACKAGE 4 /* 0x04 Byte_const, multiple Data_term/Constant/Super_name */ #define ACPI_TYPE_FIELD_UNIT 5 /* 0x05 */ -#define ACPI_TYPE_DEVICE 6 /* 0x06 Name, multiple Named_object */ +#define ACPI_TYPE_DEVICE 6 /* 0x06 Name, multiple Node */ #define ACPI_TYPE_EVENT 7 /* 0x07 */ #define ACPI_TYPE_METHOD 8 /* 0x08 Name, Byte_const, multiple Code */ #define ACPI_TYPE_MUTEX 9 /* 0x09 */ #define ACPI_TYPE_REGION 10 /* 0x0A */ -#define ACPI_TYPE_POWER 11 /* 0x0B Name,Byte_const,Word_const,multi Named_object */ +#define ACPI_TYPE_POWER 11 /* 0x0B Name,Byte_const,Word_const,multi Node */ #define ACPI_TYPE_PROCESSOR 12 /* 0x0C Name,Byte_const,DWord_const,Byte_const,multi Nm_o */ -#define ACPI_TYPE_THERMAL 13 /* 0x0D Name, multiple Named_object */ +#define ACPI_TYPE_THERMAL 13 /* 0x0D Name, multiple Node */ #define ACPI_TYPE_BUFFER_FIELD 14 /* 0x0E */ #define ACPI_TYPE_DDB_HANDLE 15 /* 0x0F */ #define ACPI_TYPE_DEBUG_OBJECT 16 /* 0x10 */ @@ -254,32 +252,39 @@ /* * This section contains object types that do not relate to the ACPI Object_type operator. - * They are used for various internal purposes only. A numerical gap is provided in - * case additional "official" Object_types are added in the future. Also, values exceeding - * the largest official ACPI Object_type must not overlap with defined AML opcodes. - */ -#define INTERNAL_TYPE_BEGIN 25 -#define INTERNAL_TYPE_DEF_FIELD 25 /* 0x19 */ -#define INTERNAL_TYPE_BANK_FIELD 26 /* 0x1A */ -#define INTERNAL_TYPE_INDEX_FIELD 27 /* 0x1B */ -#define INTERNAL_TYPE_DEF_FIELD_DEFN 28 /* 0x1C Name, Byte_const, multiple Field_element */ -#define INTERNAL_TYPE_BANK_FIELD_DEFN 29 /* 0x1D 2 Name,DWord_const,Byte_const,multi Field_element */ -#define INTERNAL_TYPE_INDEX_FIELD_DEFN 30 /* 0x1E 2 Name, Byte_const, multiple Field_element */ -#define INTERNAL_TYPE_IF 31 /* 0x1F Op_code, multiple Code */ -#define INTERNAL_TYPE_ELSE 32 /* 0x20 multiple Code */ -#define INTERNAL_TYPE_WHILE 33 /* 0x21 Op_code, multiple Code */ -#define INTERNAL_TYPE_SCOPE 34 /* 0x22 Name, multiple Named_object */ -#define INTERNAL_TYPE_DEF_ANY 35 /* 0x23 type is Any, suppress search of enclosing scopes */ -#define INTERNAL_TYPE_REFERENCE 36 /* 0x24 Arg#, Local#, Name, Debug; used only in descriptors */ -#define INTERNAL_TYPE_ALIAS 37 /* 0x25 */ -#define INTERNAL_TYPE_NOTIFY 38 /* 0x26 */ -#define INTERNAL_TYPE_ADDRESS_HANDLER 39 /* 0x27 */ -#define INTERNAL_TYPE_METHOD_ARGUMENT 40 /* 0x28 */ -#define INTERNAL_TYPE_METHOD_LOCAL_VAR 41 /* 0x29 */ + * They are used for various internal purposes only. If new predefined ACPI_TYPEs are + * added (via the ACPI specification), these internal types must move upwards. + * Also, values exceeding the largest official ACPI Object_type must not overlap with + * defined AML opcodes. + */ +#define INTERNAL_TYPE_BEGIN 17 + +#define INTERNAL_TYPE_DEF_FIELD 17 /* 0x11 */ +#define INTERNAL_TYPE_BANK_FIELD 18 /* 0x12 */ +#define INTERNAL_TYPE_INDEX_FIELD 19 /* 0x13 */ +#define INTERNAL_TYPE_REFERENCE 20 /* 0x14 Arg#, Local#, Name, Debug; used only in descriptors */ +#define INTERNAL_TYPE_ALIAS 21 /* 0x15 */ +#define INTERNAL_TYPE_NOTIFY 22 /* 0x16 */ +#define INTERNAL_TYPE_ADDRESS_HANDLER 23 /* 0x17 */ + +#define INTERNAL_TYPE_NODE_MAX 23 + +/* 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_MAX 41 +#define INTERNAL_TYPE_MAX 33 -#define INTERNAL_TYPE_INVALID 42 +#define INTERNAL_TYPE_INVALID 34 #define ACPI_TYPE_NOT_FOUND 0xFF /* @@ -375,7 +380,7 @@ { ACPI_OBJECT_TYPE type; u32 length; /* # of bytes in string, excluding trailing null */ - char *pointer; /* points to the string value */ + NATIVE_CHAR *pointer; /* points to the string value */ } string; struct @@ -551,7 +556,8 @@ u32 address, u32 bit_width, u32 *value, - void *context); + void *handler_context, + void *region_context); #define ACPI_DEFAULT_HANDLER ((ADDRESS_SPACE_HANDLER) NULL) @@ -561,7 +567,7 @@ ACPI_HANDLE region_handle, u32 function, void *handler_context, - void **return_context); + void **region_context); #define ACPI_REGION_ACTIVATE 0 #define ACPI_REGION_DEACTIVATE 1 @@ -589,13 +595,11 @@ #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 */\ + 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 /* ????? */ typedef struct @@ -611,8 +615,8 @@ /* * TBD: [Restructure]: a HID or a _UID can return either a number or a string */ - char hardware_id [9]; /* _HID value if any */ - char unique_id[9]; /* _UID value if any */ + NATIVE_CHAR hardware_id [9]; /* _HID value if any */ + NATIVE_CHAR unique_id[9]; /* _UID value if any */ u32 address; /* _ADR value if any */ u32 current_status; /* _STA value */ } ACPI_DEVICE_INFO; @@ -622,7 +626,6 @@ typedef struct { - void *handler_context; u32 seg; u32 bus; u32 dev_func; @@ -631,11 +634,9 @@ typedef struct { - void *handler_context; - char *mapped_physical_address; - char *mapped_logical_address; + u8 *mapped_physical_address; + u8 *mapped_logical_address; u32 mapped_length; - } MEM_HANDLER_CONTEXT; @@ -858,7 +859,7 @@ u32 address_length; u32 resource_source_index; u32 resource_source_string_length; - u8 resource_source[1]; + NATIVE_CHAR resource_source[1]; } ADDRESS16_RESOURCE; @@ -877,7 +878,7 @@ u32 address_length; u32 resource_source_index; u32 resource_source_string_length; - u8 resource_source[1]; + NATIVE_CHAR resource_source[1]; } ADDRESS32_RESOURCE; @@ -891,7 +892,7 @@ u32 interrupts[1]; u32 resource_source_index; u32 resource_source_string_length; - u8 resource_source[1]; + NATIVE_CHAR resource_source[1]; } EXTENDED_IRQ_RESOURCE; @@ -951,7 +952,7 @@ u32 address; u32 pin; u32 source_index; - u8 source[1]; + NATIVE_CHAR source[1]; } PRT_ENTRY; @@ -967,4 +968,4 @@ * END: Definitions for PCI Routing tables */ -#endif /* ACTYPES_H */ +#endif /* __ACTYPES_H__ */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/include/amlcode.h linux/drivers/acpi/include/amlcode.h --- v2.4.0-test8/linux/drivers/acpi/include/amlcode.h Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/include/amlcode.h Fri Sep 15 14:30:30 2000 @@ -1,9 +1,9 @@ - /****************************************************************************** * * 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 $ * *****************************************************************************/ @@ -108,7 +108,7 @@ #define AML_IF_OP (u16) 0xa0 #define AML_ELSE_OP (u16) 0xa1 #define AML_WHILE_OP (u16) 0xa2 -#define AML_NOOP_CODE (u16) 0xa3 +#define AML_NOOP_OP (u16) 0xa3 #define AML_RETURN_OP (u16) 0xa4 #define AML_BREAK_OP (u16) 0xa5 #define AML_BREAK_POINT_OP (u16) 0xcc @@ -133,9 +133,9 @@ #define AML_WAIT_OP (u16) 0x5b25 #define AML_RESET_OP (u16) 0x5b26 #define AML_RELEASE_OP (u16) 0x5b27 -#define AML_FROM_BCDOP (u16) 0x5b28 -#define AML_TO_BCDOP (u16) 0x5b29 -#define AML_UN_LOAD_OP (u16) 0x5b2a +#define AML_FROM_BCD_OP (u16) 0x5b28 +#define AML_TO_BCD_OP (u16) 0x5b29 +#define AML_UNLOAD_OP (u16) 0x5b2a #define AML_REVISION_OP (u16) 0x5b30 #define AML_DEBUG_OP (u16) 0x5b31 #define AML_FATAL_OP (u16) 0x5b32 @@ -156,7 +156,11 @@ #define AML_LNOTEQUAL_OP (u16) 0x9293 -/* Internal opcodes */ +/* + * Internal opcodes + * Use only "Unknown" AML opcodes, don't attempt to use + * any valid ACPI ASCII values (A-Z, 0-9, '-') + */ #define AML_NAMEPATH_OP (u16) 0x002d #define AML_NAMEDFIELD_OP (u16) 0x0030 @@ -165,29 +169,7 @@ #define AML_BYTELIST_OP (u16) 0x0033 #define AML_STATICSTRING_OP (u16) 0x0034 #define AML_METHODCALL_OP (u16) 0x0035 - - -/* - * argument types - */ - -/* -#define AML_ASCIICHARLIST_ARG 'A' -#define AML_BYTEDATA_ARG 'b' -#define AML_BYTELIST_ARG 'B' -#define AML_DWORDDATA_ARG 'd' -#define AML_DATAOBJECT_ARG 'o' -#define AML_DATAOBJECTLIST_ARG 'O' -#define AML_FIELDLIST_ARG 'F' -#define AML_NAMESTRING_ARG 'n' -#define AML_OBJECTLIST_ARG 'P' -#define AML_PKGLENGTH_ARG 'p' -#define AML_SUPERNAME_ARG 's' -#define AML_TARGET_ARG 'l' -#define AML_TERMARG_ARG 't' -#define AML_TERMLIST_ARG 'T' -#define AML_WORDDATA_ARG 'w' -*/ +#define AML_RETURN_VALUE_OP (u16) 0x0036 #define ARG_NONE 0x0 @@ -229,7 +211,7 @@ #define ARGI_STRING 0x06 #define ARGI_BUFFER 0x07 #define ARGI_PACKAGE 0x08 -#define ARGI_DATAOBJECT 0x09 /* Buffer, string, package or NTE reference - Used only by Size_of operator*/ +#define ARGI_DATAOBJECT 0x09 /* Buffer, string, package or reference to a Node - Used only by Size_of operator*/ #define ARGI_COMPLEXOBJ 0x0A /* Buffer or package */ #define ARGI_MUTEX 0x0B #define ARGI_EVENT 0x0C @@ -291,8 +273,9 @@ #define OPTYPE_CONTROL 18 #define OPTYPE_RECONFIGURATION 19 #define OPTYPE_NAMED_OBJECT 20 +#define OPTYPE_RETURN 21 -#define OPTYPE_BOGUS 21 +#define OPTYPE_BOGUS 22 /* Comparison operation codes for Match_op operator */ @@ -375,13 +358,11 @@ extern u8 acpi_gbl_aml [NUM_OPCODES]; extern u16 acpi_gbl_pfx [NUM_OPCODES]; -extern char *acpi_gbl_short_ops [NUM_OPCODES]; -extern char *acpi_gbl_long_ops [NUM_OPCODES]; -extern char *acpi_gbl_region_types [NUM_REGION_TYPES]; -extern char *acpi_gbl_match_ops [NUM_MATCH_OPS]; -extern char *acpi_gbl_access_types [NUM_ACCESS_TYPES]; -extern char *acpi_gbl_update_rules [NUM_UPDATE_RULES]; -extern char *acpi_gbl_FEnames [NUM_FIELD_NAMES]; +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]; /* @@ -392,7 +373,7 @@ /* Data used in keeping track of fields */ -char *acpi_gbl_FEnames[NUM_FIELD_NAMES] = +NATIVE_CHAR *acpi_gbl_FEnames[NUM_FIELD_NAMES] = { "skip", "?access?" @@ -401,7 +382,7 @@ /* Region type decoding */ -char *acpi_gbl_region_types[NUM_REGION_TYPES] = +NATIVE_CHAR *acpi_gbl_region_types[NUM_REGION_TYPES] = { "System_memory", "System_iO", @@ -411,7 +392,7 @@ }; -char *acpi_gbl_match_ops[NUM_MATCH_OPS] = +NATIVE_CHAR *acpi_gbl_match_ops[NUM_MATCH_OPS] = { "Error", "MTR", @@ -425,7 +406,7 @@ /* Access type decoding */ -char *acpi_gbl_access_types[NUM_ACCESS_TYPES] = +NATIVE_CHAR *acpi_gbl_access_types[NUM_ACCESS_TYPES] = { "Any_acc", "Byte_acc", @@ -439,7 +420,7 @@ /* Update rule decoding */ -char *acpi_gbl_update_rules[NUM_UPDATE_RULES] = +NATIVE_CHAR *acpi_gbl_update_rules[NUM_UPDATE_RULES] = { "Preserve", "Write_as_ones", diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/include/common.h linux/drivers/acpi/include/common.h --- v2.4.0-test8/linux/drivers/acpi/include/common.h Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/include/common.h Wed Dec 31 16:00:00 1969 @@ -1,650 +0,0 @@ - -/****************************************************************************** - * - * Name: common.h -- prototypes for the common (subsystem-wide) procedures - * - *****************************************************************************/ - -/* - * 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 _COMMON_H -#define _COMMON_H - - -#define REF_INCREMENT (u16) 0 -#define REF_DECREMENT (u16) 1 -#define REF_FORCE_DELETE (u16) 2 - -/* Acpi_cm_dump_buffer */ - -#define DB_BYTE_DISPLAY 1 -#define DB_WORD_DISPLAY 2 -#define DB_DWORD_DISPLAY 4 -#define DB_QWORD_DISPLAY 8 - - -/* Global initialization interfaces */ - -void -acpi_cm_init_globals ( - ACPI_INIT_DATA *init_data); - -void -acpi_cm_terminate ( - void); - - -/* - * Acpi_cm_init - miscellaneous initialization and shutdown - */ - -ACPI_STATUS -acpi_cm_hardware_initialize ( - void); - -ACPI_STATUS -acpi_cm_subsystem_shutdown ( - void); - -/* - * Acpi_cm_global - Global data structures and procedures - */ - -char * -acpi_cm_get_mutex_name ( - u32 mutex_id); - -char * -acpi_cm_get_type_name ( - u32 type); - -u8 -acpi_cm_valid_object_type ( - u32 type); - -ACPI_OWNER_ID -acpi_cm_allocate_owner_id ( - u32 id_type); - - -/* - * Acpi_cm_clib - Local implementations of C library functions - */ - -ACPI_SIZE -acpi_cm_strlen ( - const char *string); - -char * -acpi_cm_strcpy ( - char *dst_string, - const char *src_string); - -char * -acpi_cm_strncpy ( - char *dst_string, - const char *src_string, - ACPI_SIZE count); - -u32 -acpi_cm_strncmp ( - const char *string1, - const char *string2, - ACPI_SIZE count); - -u32 -acpi_cm_strcmp ( - const char *string1, - const char *string2); - -char * -acpi_cm_strcat ( - char *dst_string, - const char *src_string); - -char * -acpi_cm_strncat ( - char *dst_string, - const char *src_string, - ACPI_SIZE count); - -u32 -acpi_cm_strtoul ( - const char *string, - char **terminator, - s32 base); - -char * -acpi_cm_strstr ( - char *string1, - char *string2); - -char * -acpi_cm_strupr ( - char *src_string); - -void * -acpi_cm_memcpy ( - void *dest, - const void *src, - ACPI_SIZE count); - -void * -acpi_cm_memset ( - void *dest, - s32 value, - ACPI_SIZE count); - -s32 -acpi_cm_to_upper ( - s32 c); - -s32 -acpi_cm_to_lower ( - s32 c); - - -/* - * Acpi_cm_copy - Object construction and conversion interfaces - */ - -ACPI_STATUS -acpi_cm_build_simple_object( - ACPI_OBJECT_INTERNAL *obj, - ACPI_OBJECT *user_obj, - char *data_space, - u32 *buffer_space_used); - -ACPI_STATUS -acpi_cm_build_package_object ( - ACPI_OBJECT_INTERNAL *obj, - char *buffer, - u32 *space_used); - -ACPI_STATUS -acpi_cm_build_external_object ( - ACPI_OBJECT_INTERNAL *obj, - ACPI_BUFFER *ret_buffer); - -ACPI_STATUS -acpi_cm_build_internal_simple_object( - ACPI_OBJECT *user_obj, - ACPI_OBJECT_INTERNAL *obj); - -ACPI_STATUS -acpi_cm_build_internal_object ( - ACPI_OBJECT *obj, - ACPI_OBJECT_INTERNAL *internal_obj); - -ACPI_STATUS -acpi_cm_copy_internal_simple_object ( - ACPI_OBJECT_INTERNAL *source_obj, - ACPI_OBJECT_INTERNAL *dest_obj); - -ACPI_STATUS -acpi_cm_build_copy_internal_package_object ( - ACPI_OBJECT_INTERNAL *source_obj, - ACPI_OBJECT_INTERNAL *dest_obj); - - -/* - * Acpi_cm_create - Object creation - */ - -ACPI_STATUS -acpi_cm_update_object_reference ( - ACPI_OBJECT_INTERNAL *object, - u16 action); - -ACPI_OBJECT_INTERNAL * -_cm_create_internal_object ( - char *module_name, - s32 line_number, - s32 component_id, - OBJECT_TYPE_INTERNAL type); - - -/* - * Acpi_cm_debug - Debug interfaces - */ - -s32 -get_debug_level ( - void); - -void -set_debug_level ( - s32 level); - -void -function_trace ( - ACPI_STRING module_name, - s32 line_number, - s32 component_id, - ACPI_STRING function_name); - -void -function_trace_ptr ( - ACPI_STRING module_name, - s32 line_number, - s32 component_id, - ACPI_STRING function_name, - void *pointer); - -void -function_trace_u32 ( - ACPI_STRING module_name, - s32 line_number, - s32 component_id, - ACPI_STRING function_name, - u32 integer); - -void -function_trace_str ( - ACPI_STRING module_name, - s32 line_number, - s32 component_id, - ACPI_STRING function_name, - char *string); - -void -function_exit ( - ACPI_STRING module_name, - s32 line_number, - s32 component_id, - ACPI_STRING function_name); - -void -function_status_exit ( - ACPI_STRING module_name, - s32 line_number, - s32 component_id, - ACPI_STRING function_name, - ACPI_STATUS status); - -void -function_value_exit ( - ACPI_STRING module_name, - s32 line_number, - s32 component_id, - ACPI_STRING function_name, - NATIVE_UINT value); - -void -function_ptr_exit ( - ACPI_STRING module_name, - s32 line_number, - s32 component_id, - ACPI_STRING function_name, - char *ptr); - -void -debug_print_prefix ( - ACPI_STRING module_name, - s32 line_number); - -void -debug_print ( - ACPI_STRING module_name, - s32 line_number, - s32 component_id, - s32 print_level, - char *format, ...); - -void -debug_print_raw ( - char *format, ...); - -void -_report_info ( - ACPI_STRING module_name, - s32 line_number, - s32 component_id, - ACPI_STRING message); - -void -_report_error ( - ACPI_STRING module_name, - s32 line_number, - s32 component_id, - ACPI_STRING message); - -void -_report_warning ( - ACPI_STRING module_name, - s32 line_number, - s32 component_id, - ACPI_STRING message); - -void -_report_success ( - ACPI_STRING module_name, - s32 line_number, - s32 component_id, - ACPI_STRING message); - -void -acpi_cm_dump_buffer ( - char *buffer, - u32 count, - u32 display, - s32 component_id); - - -/* - * Acpi_cm_delete - Object deletion - */ - -void -acpi_cm_delete_internal_obj ( - ACPI_OBJECT_INTERNAL *object); - -void -acpi_cm_delete_internal_package_object ( - ACPI_OBJECT_INTERNAL *object); - -void -acpi_cm_delete_internal_simple_object ( - ACPI_OBJECT_INTERNAL *object); - -ACPI_STATUS -acpi_cm_delete_internal_object_list ( - ACPI_OBJECT_INTERNAL **obj_list); - - -/* - * Acpi_cm_eval - object evaluation - */ - -/* Method name strings */ - -#define METHOD_NAME__HID "_HID" -#define METHOD_NAME__UID "_UID" -#define METHOD_NAME__ADR "_ADR" -#define METHOD_NAME__STA "_STA" -#define METHOD_NAME__REG "_REG" -#define METHOD_NAME__SEG "_SEG" -#define METHOD_NAME__BBN "_BBN" - - -ACPI_STATUS -acpi_cm_evaluate_numeric_object ( - char *method_name, - ACPI_NAMED_OBJECT *acpi_device, - u32 *address); - -ACPI_STATUS -acpi_cm_execute_HID ( - ACPI_NAMED_OBJECT *acpi_device, - DEVICE_ID *hid); - -ACPI_STATUS -acpi_cm_execute_STA ( - ACPI_NAMED_OBJECT *acpi_device, - u32 *status_flags); - -ACPI_STATUS -acpi_cm_execute_UID ( - ACPI_NAMED_OBJECT *acpi_device, - DEVICE_ID *uid); - - -/* - * Acpi_cm_error - exception interfaces - */ - -char * -acpi_cm_format_exception ( - ACPI_STATUS status); - - -/* - * Acpi_cm_mutex - mutual exclusion interfaces - */ - -ACPI_STATUS -acpi_cm_mutex_initialize ( - void); - -void -acpi_cm_mutex_terminate ( - void); - -ACPI_STATUS -acpi_cm_create_mutex ( - ACPI_MUTEX_HANDLE mutex_id); - -ACPI_STATUS -acpi_cm_delete_mutex ( - ACPI_MUTEX_HANDLE mutex_id); - -ACPI_STATUS -acpi_cm_acquire_mutex ( - ACPI_MUTEX_HANDLE mutex_id); - -ACPI_STATUS -acpi_cm_release_mutex ( - ACPI_MUTEX_HANDLE mutex_id); - - -/* - * Acpi_cm_object - internal object create/delete/cache routines - */ - -#define acpi_cm_create_internal_object(t) _cm_create_internal_object(_THIS_MODULE,__LINE__,_COMPONENT,t) -#define acpi_cm_allocate_object_desc() _cm_allocate_object_desc(_THIS_MODULE,__LINE__,_COMPONENT) - -void * -_cm_allocate_object_desc ( - char *module_name, - s32 line_number, - s32 component_id); - -void -acpi_cm_delete_object_desc ( - ACPI_OBJECT_INTERNAL *object); - -u8 -acpi_cm_valid_internal_object ( - void *object); - - -/* - * Acpi_cm_ref_cnt - Object reference count management - */ - -void -acpi_cm_add_reference ( - ACPI_OBJECT_INTERNAL *object); - -void -acpi_cm_remove_reference ( - ACPI_OBJECT_INTERNAL *object); - -/* - * Acpi_cm_size - Object size routines - */ - -ACPI_STATUS -acpi_cm_get_simple_object_size ( - ACPI_OBJECT_INTERNAL *obj, - u32 *obj_length); - -ACPI_STATUS -acpi_cm_get_package_object_size ( - ACPI_OBJECT_INTERNAL *obj, - u32 *obj_length); - -ACPI_STATUS -acpi_cm_get_object_size( - ACPI_OBJECT_INTERNAL *obj, - u32 *obj_length); - - -/* - * Acpi_cm_state - Generic state creation/cache routines - */ - -void -acpi_cm_push_generic_state ( - ACPI_GENERIC_STATE **list_head, - ACPI_GENERIC_STATE *state); - -ACPI_GENERIC_STATE * -acpi_cm_pop_generic_state ( - ACPI_GENERIC_STATE **list_head); - - -ACPI_GENERIC_STATE * -acpi_cm_create_generic_state ( - void); - -ACPI_GENERIC_STATE * -acpi_cm_create_update_state ( - ACPI_OBJECT_INTERNAL *object, - u16 action); - -ACPI_STATUS -acpi_cm_create_update_state_and_push ( - ACPI_OBJECT_INTERNAL *object, - u16 action, - ACPI_GENERIC_STATE **state_list); - -ACPI_GENERIC_STATE * -acpi_cm_create_control_state ( - void); - -void -acpi_cm_delete_generic_state ( - ACPI_GENERIC_STATE *state); - -void -acpi_cm_delete_generic_state_cache ( - void); - -void -acpi_cm_delete_object_cache ( - void); - -/* - * Acpi_cmutils - */ - -u8 -acpi_cm_valid_acpi_name ( - u32 name); - -u8 -acpi_cm_valid_acpi_character ( - char character); - - -/* - * Memory allocation functions and related macros. - * Macros that expand to include filename and line number - */ - -void * -_cm_allocate ( - u32 size, - u32 component, - ACPI_STRING module, - s32 line); - -void * -_cm_callocate ( - u32 size, - u32 component, - ACPI_STRING module, - s32 line); - -void -_cm_free ( - void *address, - u32 component, - ACPI_STRING module, - s32 line); - -void -acpi_cm_init_static_object ( - ACPI_OBJECT_INTERNAL *obj_desc); - -#define acpi_cm_allocate(a) _cm_allocate(a,_COMPONENT,_THIS_MODULE,__LINE__) -#define acpi_cm_callocate(a) _cm_callocate(a, _COMPONENT,_THIS_MODULE,__LINE__) -#define acpi_cm_free(a) _cm_free(a,_COMPONENT,_THIS_MODULE,__LINE__) - -#ifndef ACPI_DEBUG - -#define acpi_cm_add_element_to_alloc_list(a,b,c,d,e,f) -#define acpi_cm_delete_element_from_alloc_list(a,b,c,d) -#define acpi_cm_dump_current_allocations(a,b) -#define acpi_cm_dump_allocation_info() - -#define DECREMENT_OBJECT_METRICS(a) -#define INCREMENT_OBJECT_METRICS(a) -#define INITIALIZE_ALLOCATION_METRICS() - -#else - -#define INITIALIZE_ALLOCATION_METRICS() \ - acpi_gbl_current_object_count = 0; \ - acpi_gbl_current_object_size = 0; \ - acpi_gbl_running_object_count = 0; \ - acpi_gbl_running_object_size = 0; \ - acpi_gbl_max_concurrent_object_count = 0; \ - acpi_gbl_max_concurrent_object_size = 0; \ - acpi_gbl_current_alloc_size = 0; \ - acpi_gbl_current_alloc_count = 0; \ - acpi_gbl_running_alloc_size = 0; \ - acpi_gbl_running_alloc_count = 0; \ - acpi_gbl_max_concurrent_alloc_size = 0; \ - acpi_gbl_max_concurrent_alloc_count = 0 - -#define DECREMENT_OBJECT_METRICS(a) \ - acpi_gbl_current_object_count--; \ - acpi_gbl_current_object_size -= a - -#define INCREMENT_OBJECT_METRICS(a) \ - acpi_gbl_current_object_count++; \ - acpi_gbl_running_object_count++; \ - if (acpi_gbl_max_concurrent_object_count < acpi_gbl_current_object_count) \ - { \ - acpi_gbl_max_concurrent_object_count = acpi_gbl_current_object_count; \ - } \ - acpi_gbl_running_object_size += a; \ - acpi_gbl_current_object_size += a; \ - if (acpi_gbl_max_concurrent_object_size < acpi_gbl_current_object_size) \ - { \ - acpi_gbl_max_concurrent_object_size = acpi_gbl_current_object_size; \ - } - - -void -acpi_cm_dump_allocation_info ( - void); - -void -acpi_cm_dump_current_allocations ( - u32 component, - ACPI_STRING module); - -#endif - - -#endif /* _COMMON_H */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/include/config.h linux/drivers/acpi/include/config.h --- v2.4.0-test8/linux/drivers/acpi/include/config.h Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/include/config.h Wed Dec 31 16:00:00 1969 @@ -1,185 +0,0 @@ - -/****************************************************************************** - * - * Name: config.h - Global configuration constants - * - *****************************************************************************/ - -/* - * 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 _CONFIG_H -#define _CONFIG_H - - -/****************************************************************************** - * - * Compile-time options - * - *****************************************************************************/ - -/* - * ACPI_DEBUG - This switch enables all the debug facilities of the ACPI - * subsystem. This includes the DEBUG_PRINT output statements - * When disabled, all DEBUG_PRINT statements are compiled out. - * - * ACPI_APPLICATION - Use this switch if the subsystem is going to be run - * at the application level. - * - */ - - -/****************************************************************************** - * - * Subsystem Constants - * - *****************************************************************************/ - - -/* Version string */ - -#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_STATE_CACHE_DEPTH 24 /* State objects for stacks */ -#define MAX_PARSE_CACHE_DEPTH 512 /* Parse tree objects */ -#define MAX_OBJECT_CACHE_DEPTH 32 /* 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 16 - -/* String size constants */ - -#define MAX_STRING_LENGTH 512 -#define PATHNAME_MAX 256 /* A full namespace pathname */ - - -/* Maximum count for a semaphore object */ - -#define MAX_SEMAPHORE_COUNT 256 - - -/* Max reference count (for debug only) */ - -#define MAX_REFERENCE_COUNT 0x200 - - -/* Size of cached memory mapping for system memory operation region */ - -#define SYSMEM_REGION_WINDOW_SIZE 4096 - - -/* - * Debugger threading model - * Use single threaded if the entire subsystem is contained in an application - * Use multiple threaded when the the subsystem is running in the kernel. - * - * By default the model is single threaded if ACPI_APPLICATION is set, - * multi-threaded if ACPI_APPLICATION is not set. - */ - -#define DEBUGGER_SINGLE_THREADED 0 -#define DEBUGGER_MULTI_THREADED 1 - -#ifdef ACPI_APPLICATION -#define DEBUGGER_THREADING DEBUGGER_SINGLE_THREADED - -#else -#define DEBUGGER_THREADING DEBUGGER_MULTI_THREADED -#endif - - -/****************************************************************************** - * - * ACPI Specification constants (Do not change unless the specification changes) - * - *****************************************************************************/ - -/* - * Method info (in WALK_STATE), containing local variables and argumetns - */ - -#define MTH_NUM_LOCALS 8 -#define MTH_MAX_LOCAL 7 - -#define MTH_NUM_ARGS 7 -#define MTH_MAX_ARG 6 - -/* - * Operand Stack (in WALK_STATE), Must be large enough to contain MTH_MAX_ARG - */ - -#define OBJ_NUM_OPERANDS 8 -#define OBJ_MAX_OPERAND 7 - -/* Names within the namespace are 4 bytes long */ - -#define ACPI_NAME_SIZE 4 -#define PATH_SEGMENT_LENGTH 5 /* 4 chars for name + 1 char 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_SIZE 0x400 -#define HI_RSDP_WINDOW_SIZE 0x20000 -#define RSDP_SCAN_STEP 16 - - -/* Maximum nesting of package objects */ - -#define MAX_PACKAGE_DEPTH 16 - - -#endif /* _CONFIG_H */ - diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/include/debugger.h linux/drivers/acpi/include/debugger.h --- v2.4.0-test8/linux/drivers/acpi/include/debugger.h Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/include/debugger.h Wed Dec 31 16:00:00 1969 @@ -1,394 +0,0 @@ - -/****************************************************************************** - * - * Name: debugger.h - ACPI/AML debugger - * - *****************************************************************************/ - -/* - * 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 __DEBUGGER_H__ -#define __DEBUGGER_H__ - - -#define DB_MAX_ARGS 8 /* Must be max method args + 1 */ - -#define DB_COMMAND_PROMPT '-' -#define DB_EXECUTE_PROMPT '%' - - -extern int optind; -extern char *optarg; -extern u8 *aml_ptr; -extern u32 acpi_aml_length; - -extern u8 opt_tables; -extern u8 opt_disasm; -extern u8 opt_stats; -extern u8 opt_parse_jit; -extern u8 opt_verbose; - - -extern char *args[DB_MAX_ARGS]; -extern char line_buf[80]; -extern char scope_buf[40]; -extern char debug_filename[40]; -extern u8 output_to_file; -extern char *buffer; -extern char *filename; -extern char *INDENT_STRING; -extern u32 acpi_gbl_method_breakpoint; -extern u8 acpi_gbl_db_output_flags; -extern u32 acpi_gbl_db_debug_level; -extern u32 acpi_gbl_db_console_debug_level; - -extern u32 num_names; -extern u32 num_methods; -extern u32 num_regions; -extern u32 num_packages; -extern u32 num_aliases; -extern u32 num_devices; -extern u32 num_field_defs; -extern u32 num_thermal_zones; -extern u32 num_named_objects; -extern u32 num_grammar_elements; -extern u32 num_method_elements ; -extern u32 num_mutexes; -extern u32 num_power_resources; -extern u32 num_bank_fields ; -extern u32 num_index_fields; -extern u32 num_events; - -extern u32 size_of_parse_tree; -extern u32 size_of_method_trees; -extern u32 size_of_nTes; -extern u32 size_of_acpi_objects; - - -#define BUFFER_SIZE 4196 - -#define DB_REDIRECTABLE_OUTPUT 0x01 -#define DB_CONSOLE_OUTPUT 0x02 -#define DB_DUPLICATE_OUTPUT 0x03 - - -typedef struct command_info -{ - char *name; /* Command Name */ - char min_args; /* Minimum arguments required */ - -} COMMAND_INFO; - - -typedef struct argument_info -{ - char *name; /* Argument Name */ - -} ARGUMENT_INFO; - - -#define PARAM_LIST(pl) pl - -#define DBTEST_OUTPUT_LEVEL(lvl) if (opt_verbose) - -#define VERBOSE_PRINT(fp) DBTEST_OUTPUT_LEVEL(lvl) {\ - acpi_os_printf PARAM_LIST(fp);} - -#define EX_NO_SINGLE_STEP 1 -#define EX_SINGLE_STEP 2 - - -/* Prototypes */ - - -/* - * dbapi - external debugger interfaces - */ - -int -acpi_db_initialize ( - void); - -ACPI_STATUS -acpi_db_single_step ( - ACPI_WALK_STATE *walk_state, - ACPI_GENERIC_OP *op, - u8 op_type); - - -/* - * dbcmds - debug commands and output routines - */ - - -void -acpi_db_display_table_info ( - char *table_arg); - -void -acpi_db_unload_acpi_table ( - char *table_arg, - char *instance_arg); - -void -acpi_db_set_method_breakpoint ( - char *location, - ACPI_WALK_STATE *walk_state, - ACPI_GENERIC_OP *op); - -void -acpi_db_set_method_call_breakpoint ( - ACPI_GENERIC_OP *op); - -void -acpi_db_disassemble_aml ( - char *statements, - ACPI_GENERIC_OP *op); - -void -acpi_db_dump_namespace ( - char *start_arg, - char *depth_arg); - -void -acpi_db_dump_namespace_by_owner ( - char *owner_arg, - char *depth_arg); - -void -acpi_db_send_notify ( - char *name, - u32 value); - -void -acpi_db_set_method_data ( - char *type_arg, - char *index_arg, - char *value_arg); - -ACPI_STATUS -acpi_db_display_objects ( - char *obj_type_arg, - char *display_count_arg); - -ACPI_STATUS -acpi_db_find_name_in_namespace ( - char *name_arg); - -void -acpi_db_set_scope ( - char *name); - -void -acpi_db_find_references ( - char *object_arg); - - -/* - * dbdisasm - AML disassembler - */ - -void -acpi_db_display_op ( - ACPI_GENERIC_OP *origin, - u32 num_opcodes); - -void -acpi_db_display_namestring ( - char *name); - -void -acpi_db_display_path ( - ACPI_GENERIC_OP *op); - -void -acpi_db_display_opcode ( - ACPI_GENERIC_OP *op); - - -/* - * dbdisply - debug display commands - */ - - -void -acpi_db_display_method_info ( - ACPI_GENERIC_OP *op); - -void -acpi_db_decode_and_display_object ( - char *target, - char *output_type); - -void -acpi_db_display_result_object ( - ACPI_OBJECT_INTERNAL *ret_desc); - -ACPI_STATUS -acpi_db_display_all_methods ( - char *display_count_arg); - -void -acpi_db_display_internal_object ( - ACPI_OBJECT_INTERNAL *obj_desc); - -void -acpi_db_display_arguments ( - void); - -void -acpi_db_display_locals ( - void); - -void -acpi_db_display_results ( - void); - -void -acpi_db_display_calling_tree ( - void); - -void -acpi_db_display_argument_object ( - ACPI_OBJECT_INTERNAL *obj_desc); - - -/* - * dbexec - debugger control method execution - */ - -void -acpi_db_execute ( - char *name, - char **args, - u32 flags); - -void -acpi_db_create_execution_threads ( - char *num_threads_arg, - char *num_loops_arg, - char *method_name_arg); - - -/* - * dbfileio - Debugger file I/O commands - */ - -OBJECT_TYPE_INTERNAL -acpi_db_match_argument ( - char *user_argument, - ARGUMENT_INFO *arguments); - - -void -acpi_db_close_debug_file ( - void); - -void -acpi_db_open_debug_file ( - char *name); - -ACPI_STATUS -acpi_db_load_acpi_table ( - char *filename); - - -/* - * dbhistry - debugger HISTORY command - */ - -void -acpi_db_add_to_history ( - char *command_line); - -void -acpi_db_display_history (void); - -char * -acpi_db_get_from_history ( - char *command_num_arg); - - -/* - * dbinput - user front-end to the AML debugger - */ - -ACPI_STATUS -acpi_db_command_dispatch ( - char *input_buffer, - ACPI_WALK_STATE *walk_state, - ACPI_GENERIC_OP *op); - -void -acpi_db_execute_thread ( - void *context); - -ACPI_STATUS -acpi_db_user_commands ( - char prompt, - ACPI_GENERIC_OP *op); - - -/* - * dbstats - Generation and display of ACPI table statistics - */ - -void -acpi_db_generate_statistics ( - ACPI_GENERIC_OP *root, - u8 is_method); - - -ACPI_STATUS -acpi_db_display_statistics ( - char *type_arg); - - -/* - * dbutils - AML debugger utilities - */ - -void -acpi_db_set_output_destination ( - s32 where); - -void -acpi_db_dump_buffer ( - u32 address); - -void -acpi_db_dump_object ( - ACPI_OBJECT *obj_desc, - u32 level); - -void -acpi_db_prep_namestring ( - char *name); - - -ACPI_STATUS -acpi_db_second_pass_parse ( - ACPI_GENERIC_OP *root); - -ACPI_NAMED_OBJECT* -acpi_db_local_ns_lookup ( - char *name); - - -#endif /* __DEBUGGER_H__ */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/include/dispatch.h linux/drivers/acpi/include/dispatch.h --- v2.4.0-test8/linux/drivers/acpi/include/dispatch.h Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/include/dispatch.h Wed Dec 31 16:00:00 1969 @@ -1,383 +0,0 @@ -/****************************************************************************** - * - * Module Name: dispatch.h - * - *****************************************************************************/ - -/* - * 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 _DISPATCH_H_ -#define _DISPATCH_H_ - - -#define NAMEOF_LOCAL_NTE "__L0" -#define NAMEOF_ARG_NTE "__A0" - - -/* For Acpi_ds_method_data_set_value */ - -#define MTH_TYPE_LOCAL 0 -#define MTH_TYPE_ARG 1 - - -/* Common interfaces */ - -ACPI_STATUS -acpi_ds_obj_stack_push ( - void *object, - ACPI_WALK_STATE *walk_state); - -ACPI_STATUS -acpi_ds_obj_stack_pop ( - u32 pop_count, - ACPI_WALK_STATE *walk_state); - -void * -acpi_ds_obj_stack_get_value ( - u32 index, - ACPI_WALK_STATE *walk_state); - -ACPI_STATUS -acpi_ds_obj_stack_pop_object ( - ACPI_OBJECT_INTERNAL **object, - ACPI_WALK_STATE *walk_state); - - -/* dsregion - Op region support */ - -ACPI_STATUS -acpi_ds_get_region_arguments ( - ACPI_OBJECT_INTERNAL *rgn_desc); - - -/* dsctrl - Parser/Interpreter interface, control stack routines */ - -/* -ACPI_CTRL_STATE * -Acpi_ds_create_control_state (void); - -void -Acpi_ds_push_control_state ( - ACPI_CTRL_STATE *Control_state, - ACPI_WALK_STATE *Walk_state); - -ACPI_CTRL_STATE * -Acpi_ds_pop_control_state ( - ACPI_WALK_STATE *Walk_state); -*/ - -ACPI_STATUS -acpi_ds_exec_begin_control_op ( - ACPI_WALK_STATE *walk_state, - ACPI_GENERIC_OP *op); - -ACPI_STATUS -acpi_ds_exec_end_control_op ( - ACPI_WALK_STATE *walk_state, - ACPI_GENERIC_OP *op); - - -/* dsexec - Parser/Interpreter interface, method execution callbacks */ - -ACPI_STATUS -acpi_ds_exec_begin_op ( - ACPI_WALK_STATE *state, - ACPI_GENERIC_OP *op); - -ACPI_STATUS -acpi_ds_exec_end_op ( - ACPI_WALK_STATE *state, - ACPI_GENERIC_OP *op); - - -/* dsfield - Parser/Interpreter interface for AML fields */ - - -ACPI_STATUS -acpi_ds_create_field ( - ACPI_GENERIC_OP *op, - ACPI_HANDLE region, - ACPI_WALK_STATE *walk_state); - -ACPI_STATUS -acpi_ds_create_bank_field ( - ACPI_GENERIC_OP *op, - ACPI_HANDLE region, - ACPI_WALK_STATE *walk_state); - -ACPI_STATUS -acpi_ds_create_index_field ( - ACPI_GENERIC_OP *op, - ACPI_HANDLE region, - ACPI_WALK_STATE *walk_state); - - -/* dsload - Parser/Interpreter interface, namespace load callbacks */ - -ACPI_STATUS -acpi_ds_load1_begin_op ( - ACPI_WALK_STATE *walk_state, - ACPI_GENERIC_OP *op); - -ACPI_STATUS -acpi_ds_load1_end_op ( - ACPI_WALK_STATE *walk_state, - ACPI_GENERIC_OP *op); - -ACPI_STATUS -acpi_ds_load2_begin_op ( - ACPI_WALK_STATE *state, - ACPI_GENERIC_OP *op); - -ACPI_STATUS -acpi_ds_load2_end_op ( - ACPI_WALK_STATE *state, - ACPI_GENERIC_OP *op); - - -/* dsmthdat - method data (locals/args) */ - - -ACPI_STATUS -acpi_ds_method_data_delete_all ( - ACPI_WALK_STATE *walk_state); - -u8 -acpi_ds_is_method_value ( - ACPI_OBJECT_INTERNAL *obj_desc); - -OBJECT_TYPE_INTERNAL -acpi_ds_method_data_get_type ( - u32 type, - u32 index); - -ACPI_STATUS -acpi_ds_method_data_get_value ( - u32 type, - u32 index, - ACPI_OBJECT_INTERNAL **obj_desc); - -ACPI_STATUS -acpi_ds_method_data_set_value ( - u32 type, - u32 index, - ACPI_OBJECT_INTERNAL *obj_desc); - -ACPI_STATUS -acpi_ds_method_data_delete_value ( - u32 type, - u32 index); - -ACPI_STATUS -acpi_ds_method_data_init_args ( - ACPI_OBJECT_INTERNAL **params, - u32 param_count); - -ACPI_NAMED_OBJECT* -acpi_ds_method_data_get_nte ( - u32 type, - u32 index); - -ACPI_STATUS -acpi_ds_method_data_init ( - ACPI_WALK_STATE *walk_state); - - -/* dsmethod - Parser/Interpreter interface - control method parsing */ - -ACPI_STATUS -acpi_ds_parse_method ( - ACPI_HANDLE obj_handle); - -ACPI_STATUS -acpi_ds_call_control_method ( - ACPI_WALK_LIST *walk_list, - ACPI_WALK_STATE *walk_state, - ACPI_GENERIC_OP *op); - -ACPI_STATUS -acpi_ds_restart_control_method ( - ACPI_WALK_STATE *walk_state, - ACPI_OBJECT_INTERNAL *return_desc); - -ACPI_STATUS -acpi_ds_terminate_control_method ( - ACPI_WALK_STATE *walk_state); - -ACPI_STATUS -acpi_ds_begin_method_execution ( - ACPI_NAMED_OBJECT *method_entry, - ACPI_OBJECT_INTERNAL *obj_desc); - - -/* dsobj - Parser/Interpreter interface - object initialization and conversion */ - -ACPI_STATUS -acpi_ds_init_one_object ( - ACPI_HANDLE obj_handle, - u32 level, - void *context, - void **return_value); - -ACPI_STATUS -acpi_ds_initialize_objects ( - ACPI_TABLE_DESC *table_desc, - ACPI_NAMED_OBJECT *start_entry); - -ACPI_STATUS -acpi_ds_build_internal_package_obj ( - ACPI_WALK_STATE *walk_state, - ACPI_GENERIC_OP *op, - ACPI_OBJECT_INTERNAL **obj_desc); - -ACPI_STATUS -acpi_ds_build_internal_object ( - ACPI_WALK_STATE *walk_state, - ACPI_GENERIC_OP *op, - ACPI_OBJECT_INTERNAL **obj_desc_ptr); - -ACPI_STATUS -acpi_ds_init_object_from_op ( - ACPI_WALK_STATE *walk_state, - ACPI_GENERIC_OP *op, - u16 opcode, - ACPI_OBJECT_INTERNAL *obj_desc); - -ACPI_STATUS -acpi_ds_create_named_object ( - ACPI_WALK_STATE *walk_state, - ACPI_NAMED_OBJECT *entry, - ACPI_GENERIC_OP *op); - - -/* dsregn - Parser/Interpreter interface - Op Region parsing */ - -ACPI_STATUS -acpi_ds_eval_region_operands ( - ACPI_WALK_STATE *walk_state, - ACPI_GENERIC_OP *op); - -ACPI_STATUS -acpi_ds_initialize_region ( - ACPI_HANDLE obj_handle); - - -/* dsutils - Parser/Interpreter interface utility routines */ - -void -acpi_ds_delete_result_if_not_used ( - ACPI_GENERIC_OP *op, - ACPI_OBJECT_INTERNAL *result_obj, - ACPI_WALK_STATE *walk_state); - -ACPI_STATUS -acpi_ds_create_operand ( - ACPI_WALK_STATE *walk_state, - ACPI_GENERIC_OP *arg); - -ACPI_STATUS -acpi_ds_create_operands ( - ACPI_WALK_STATE *walk_state, - ACPI_GENERIC_OP *first_arg); - -ACPI_STATUS -acpi_ds_resolve_operands ( - ACPI_WALK_STATE *walk_state); - -OBJECT_TYPE_INTERNAL -acpi_ds_map_opcode_to_data_type ( - u16 opcode, - u32 *out_flags); - -OBJECT_TYPE_INTERNAL -acpi_ds_map_named_opcode_to_data_type ( - u16 opcode); - - -/* - * dswscope - Scope Stack manipulation - */ - -ACPI_STATUS -acpi_ds_scope_stack_push ( - ACPI_NAME_TABLE *new_scope, - OBJECT_TYPE_INTERNAL type, - ACPI_WALK_STATE *walk_state); - - -ACPI_STATUS -acpi_ds_scope_stack_pop ( - ACPI_WALK_STATE *walk_state); - -void -acpi_ds_scope_stack_clear ( - ACPI_WALK_STATE *walk_state); - - -/* Acpi_dswstate - parser WALK_STATE management routines */ - -ACPI_WALK_STATE * -acpi_ds_create_walk_state ( - ACPI_OWNER_ID owner_id, - ACPI_GENERIC_OP *origin, - ACPI_OBJECT_INTERNAL *mth_desc, - ACPI_WALK_LIST *walk_list); - -ACPI_STATUS -acpi_ds_obj_stack_delete_all ( - ACPI_WALK_STATE *walk_state); - -ACPI_STATUS -acpi_ds_obj_stack_pop_and_delete ( - u32 pop_count, - ACPI_WALK_STATE *walk_state); - -void -acpi_ds_delete_walk_state ( - ACPI_WALK_STATE *walk_state); - -ACPI_WALK_STATE * -acpi_ds_pop_walk_state ( - ACPI_WALK_LIST *walk_list); - -ACPI_STATUS -acpi_ds_result_stack_pop ( - ACPI_OBJECT_INTERNAL **object, - ACPI_WALK_STATE *walk_state); - -ACPI_STATUS -acpi_ds_result_stack_push ( - void *object, - ACPI_WALK_STATE *walk_state); - -ACPI_STATUS -acpi_ds_result_stack_clear ( - ACPI_WALK_STATE *walk_state); - -ACPI_WALK_STATE * -acpi_ds_get_current_walk_state ( - ACPI_WALK_LIST *walk_list); - -void -acpi_ds_delete_walk_state_cache ( - void); - - -#endif /* _DISPATCH_H_ */ \ No newline at end of file diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/include/events.h linux/drivers/acpi/include/events.h --- v2.4.0-test8/linux/drivers/acpi/include/events.h Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/include/events.h Wed Dec 31 16:00:00 1969 @@ -1,209 +0,0 @@ - -/****************************************************************************** - * - * Name: events.h - Acpi_event subcomponent prototypes and defines - * - *****************************************************************************/ - -/* - * 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 __EVENTS_H__ -#define __EVENTS_H__ - - -/* - * Acpi_evfixed - Fixed event handling - */ - -ACPI_STATUS -acpi_ev_fixed_event_initialize ( - void); - -u32 -acpi_ev_fixed_event_detect ( - void); - -u32 -acpi_ev_fixed_event_dispatch ( - u32 acpi_event); - - -/* - * Acpi_evglock - Global Lock support - */ - -ACPI_STATUS -acpi_ev_acquire_global_lock( - void); - -void -acpi_ev_release_global_lock( - void); - -ACPI_STATUS -acpi_ev_init_global_lock_handler ( - void); - - -/* - * Acpi_evgpe - GPE handling and dispatch - */ - -ACPI_STATUS -acpi_ev_gpe_initialize ( - void); - -ACPI_STATUS -acpi_ev_init_gpe_control_methods ( - void); - -u32 -acpi_ev_gpe_dispatch ( - u32 gpe_number); - -u32 -acpi_ev_gpe_detect ( - void); - - -/* - * Acpi_evnotify - Device Notify handling and dispatch - */ - -void -acpi_ev_notify_dispatch ( - ACPI_HANDLE device, - u32 notify_value); - - -/* - * Acpi_evregion - Address Space handling - */ - -ACPI_STATUS -acpi_ev_install_default_address_space_handlers ( - void); - -ACPI_STATUS -acpi_ev_address_space_dispatch ( - ACPI_OBJECT_INTERNAL *region_obj, - u32 function, - u32 address, - u32 bit_width, - u32 *value); - - -ACPI_STATUS -acpi_ev_addr_handler_helper ( - ACPI_HANDLE obj_handle, - u32 level, - void *context, - void **return_value); - -void -acpi_ev_disassociate_region_from_handler( - ACPI_OBJECT_INTERNAL *region_obj); - - -ACPI_STATUS -acpi_ev_associate_region_and_handler( - ACPI_OBJECT_INTERNAL *handler_obj, - ACPI_OBJECT_INTERNAL *region_obj); - - -/* - * Acpi_evregini - Region initialization and setup - */ - -ACPI_STATUS -acpi_ev_system_memory_region_setup ( - ACPI_HANDLE handle, - u32 function, - void *handler_context, - void **return_context); - -ACPI_STATUS -acpi_ev_io_space_region_setup ( - ACPI_HANDLE handle, - u32 function, - void *handler_context, - void **return_context); - -ACPI_STATUS -acpi_ev_pci_config_region_setup ( - ACPI_HANDLE handle, - u32 function, - void *handler_context, - void **return_context); - -ACPI_STATUS -acpi_ev_default_region_setup ( - ACPI_HANDLE handle, - u32 function, - void *handler_context, - void **return_context); - -ACPI_STATUS -acpi_ev_initialize_region ( - ACPI_OBJECT_INTERNAL *region_obj, - u8 acpi_ns_locked); - - -/* - * Acpi_evsci - SCI (System Control Interrupt) handling/dispatch - */ - -u32 -acpi_ev_install_sci_handler ( - void); - -ACPI_STATUS -acpi_ev_remove_sci_handler ( - void); - -s32 -acpi_ev_initialize_sCI ( - s32 program_sCI); - -void -acpi_ev_restore_acpi_state ( - void); - -void -acpi_ev_terminate ( - void); - - -/* Debug support */ - -#ifdef ACPI_DEBUG - -s32 -acpi_ev_sci_count ( - u32 acpi_event); - -#define DEBUG_INCREMENT_EVENT_COUNT(a) acpi_gbl_event_count[a]++; - -#else - -#define DEBUG_INCREMENT_EVENT_COUNT(a) -#endif - - -#endif /* __EVENTS_H__ */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/include/globals.h linux/drivers/acpi/include/globals.h --- v2.4.0-test8/linux/drivers/acpi/include/globals.h Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/include/globals.h Wed Dec 31 16:00:00 1969 @@ -1,311 +0,0 @@ - -/****************************************************************************** - * - * Name: globals.h - Declarations for global variables - * - *****************************************************************************/ - -/* - * 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 __GLOBALS_H__ -#define __GLOBALS_H__ - - -/* - * Ensure that the globals are actually defined only once - */ -#ifdef DEFINE_ACPI_GLOBALS -#define ACPI_EXTERN -#else -#define ACPI_EXTERN extern -#endif - - -extern char *msg_acpi_error_break; - -/***************************************************************************** - * - * Debug support - * - ****************************************************************************/ - -/* Runtime configuration of debug print levels */ - -extern u32 acpi_dbg_level; -extern u32 acpi_dbg_layer; - - -/* Procedure nesting level for debug output */ - -extern u32 acpi_gbl_nesting_level; - - -/***************************************************************************** - * - * ACPI Table globals - * - ****************************************************************************/ - -/* - * Table pointers. - * Although these pointers are somewhat redundant with the global Acpi_table, - * they are convenient because they are typed pointers. - * - * These tables are single-table only; meaning that there can be at most one - * 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; -/* - * Since there may be multiple SSDTs and PSDTS, a single pointer is not - * sufficient; Therefore, there isn't one! - */ - - -/* - * ACPI Table info arrays - */ -extern ACPI_TABLE_DESC acpi_gbl_acpi_tables[NUM_ACPI_TABLES]; -extern ACPI_TABLE_SUPPORT acpi_gbl_acpi_table_data[NUM_ACPI_TABLES]; - -/* - * Predefined mutex objects. This array contains the - * actual OS mutex handles, indexed by the local ACPI_MUTEX_HANDLEs. - * (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; - - -/***************************************************************************** - * - * Miscellaneous globals - * - ****************************************************************************/ - - -ACPI_EXTERN u8 *acpi_gbl_gpe0enable_register_save; -ACPI_EXTERN u8 *acpi_gbl_gpe1_enable_register_save; -ACPI_EXTERN ACPI_WALK_STATE *acpi_gbl_breakpoint_walk; -ACPI_EXTERN ACPI_GENERIC_STATE *acpi_gbl_generic_state_cache; -ACPI_EXTERN ACPI_GENERIC_OP *acpi_gbl_parse_cache; -ACPI_EXTERN ACPI_OBJECT_INTERNAL *acpi_gbl_object_cache; -ACPI_EXTERN ACPI_WALK_STATE *acpi_gbl_walk_state_cache; -ACPI_EXTERN ACPI_HANDLE acpi_gbl_global_lock_semaphore; - - -ACPI_EXTERN u32 acpi_gbl_global_lock_thread_count; -ACPI_EXTERN u32 acpi_gbl_restore_acpi_chipset; -ACPI_EXTERN u32 acpi_gbl_original_mode; -ACPI_EXTERN u32 acpi_gbl_edge_level_save; -ACPI_EXTERN u32 acpi_gbl_irq_enable_save; -ACPI_EXTERN u32 acpi_gbl_rsdp_original_location; - -ACPI_EXTERN u32 acpi_gbl_state_cache_requests; -ACPI_EXTERN u32 acpi_gbl_state_cache_hits; -ACPI_EXTERN u32 acpi_gbl_parse_cache_requests; -ACPI_EXTERN u32 acpi_gbl_parse_cache_hits; -ACPI_EXTERN u32 acpi_gbl_object_cache_requests; -ACPI_EXTERN u32 acpi_gbl_object_cache_hits; -ACPI_EXTERN u32 acpi_gbl_walk_state_cache_requests; -ACPI_EXTERN u32 acpi_gbl_walk_state_cache_hits; -ACPI_EXTERN u32 acpi_gbl_ns_lookup_count; -ACPI_EXTERN u32 acpi_gbl_ps_find_count; - - -ACPI_EXTERN u16 acpi_gbl_generic_state_cache_depth; -ACPI_EXTERN u16 acpi_gbl_parse_cache_depth; -ACPI_EXTERN u16 acpi_gbl_object_cache_depth; -ACPI_EXTERN u16 acpi_gbl_walk_state_cache_depth; -ACPI_EXTERN u16 acpi_gbl_pm1_enable_register_save; -ACPI_EXTERN u16 acpi_gbl_next_table_owner_id; -ACPI_EXTERN u16 acpi_gbl_next_method_owner_id; - -ACPI_EXTERN u8 acpi_gbl_debugger_configuration; -ACPI_EXTERN u8 acpi_gbl_global_lock_acquired; -ACPI_EXTERN u8 acpi_gbl_global_lock_set; /* TBD: [Restructure] OBSOLETE?? */ -ACPI_EXTERN u8 acpi_gbl_step_to_next_call; -ACPI_EXTERN u8 acpi_gbl_acpi_hardware_present; - - -ACPI_EXTERN ACPI_OBJECT_NOTIFY_HANDLER acpi_gbl_drv_notify; -ACPI_EXTERN ACPI_OBJECT_NOTIFY_HANDLER acpi_gbl_sys_notify; - - -extern u8 acpi_gbl_shutdown; -extern u32 acpi_gbl_system_flags; -extern u32 acpi_gbl_startup_flags; - - -/***************************************************************************** - * - * Namespace globals - * - ****************************************************************************/ - -#define NUM_NS_TYPES INTERNAL_TYPE_INVALID+1 -#define NUM_PREDEFINED_NAMES 9 - - -ACPI_EXTERN ACPI_NAME_TABLE acpi_gbl_root_name_table; -ACPI_EXTERN ACPI_NAMED_OBJECT *acpi_gbl_root_object; - -extern u8 acpi_gbl_ns_properties[NUM_NS_TYPES]; -extern PREDEFINED_NAMES acpi_gbl_pre_defined_names [NUM_PREDEFINED_NAMES]; - - -/* Used to detect memory leaks (DEBUG ONLY) */ - -#ifdef ACPI_DEBUG -ACPI_EXTERN ALLOCATION_INFO *acpi_gbl_head_alloc_ptr; -ACPI_EXTERN ALLOCATION_INFO *acpi_gbl_tail_alloc_ptr; -#endif - - -/***************************************************************************** - * - * Interpreter globals - * - ****************************************************************************/ - - -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 s32 acpi_gbl_named_object_err; /* Indicate if inc_error should be called */ - -/* - * Handle to the last method found - used during pass1 of load - */ -ACPI_EXTERN ACPI_HANDLE acpi_gbl_last_method; - -/* - * Table of Address Space handlers - */ - -ACPI_EXTERN ACPI_ADDRESS_SPACE_INFO acpi_gbl_address_spaces[ACPI_NUM_ADDRESS_SPACES]; - - -/* Control method single step flag */ - -ACPI_EXTERN u8 acpi_gbl_cm_single_step; - - -/***************************************************************************** - * - * Parser globals - * - ****************************************************************************/ - -ACPI_EXTERN ACPI_GENERIC_OP *acpi_gbl_parsed_namespace_root; - -extern ACPI_OP_INFO acpi_gbl_aml_op_info[]; -extern u8 acpi_gbl_aml_op_info_index[256]; -extern char *acpi_gbl_parser_id; - - -/***************************************************************************** - * - * Hardware globals - * - ****************************************************************************/ - -extern ACPI_C_STATE_HANDLER acpi_hw_cx_handlers[MAX_CX_STATES]; -extern u32 acpi_hw_active_cx_state; - - -/***************************************************************************** - * - * Event globals - * - ****************************************************************************/ - -ACPI_EXTERN ACPI_FIXED_EVENT_INFO acpi_gbl_fixed_event_handlers[NUM_FIXED_EVENTS]; - -ACPI_EXTERN ACPI_HANDLE acpi_gbl_gpe_obj_handle; -ACPI_EXTERN u32 acpi_gbl_gpe_register_count; -ACPI_EXTERN ACPI_GPE_REGISTERS *acpi_gbl_gpe_registers; -ACPI_EXTERN ACPI_GPE_LEVEL_INFO *acpi_gbl_gpe_info; - -/* - * Gpe validation and translation table - * Indexed by the GPE number, returns GPE_INVALID if the GPE is not supported. - * Otherwise, returns a valid index into the global GPE table. - * - * This table is needed because the GPE numbers supported by block 1 do not - * have to be contiguous with the GPE numbers supported by block 0. - */ -ACPI_EXTERN u8 acpi_gbl_gpe_valid [NUM_GPE]; - -/* Acpi_event counter for debug only */ - -#ifdef ACPI_DEBUG -ACPI_EXTERN u32 acpi_gbl_event_count[NUM_FIXED_EVENTS]; -#endif - - -/***************************************************************************** - * - * Debugger globals - * - ****************************************************************************/ - -ACPI_EXTERN u8 acpi_gbl_method_executing; -ACPI_EXTERN u8 acpi_gbl_db_terminate_threads; - - -/* Memory allocation metrics - Debug Only! */ - -#ifdef ACPI_DEBUG - -ACPI_EXTERN u32 acpi_gbl_current_alloc_size; -ACPI_EXTERN u32 acpi_gbl_current_alloc_count; -ACPI_EXTERN u32 acpi_gbl_running_alloc_size; -ACPI_EXTERN u32 acpi_gbl_running_alloc_count; -ACPI_EXTERN u32 acpi_gbl_max_concurrent_alloc_size; -ACPI_EXTERN u32 acpi_gbl_max_concurrent_alloc_count; -ACPI_EXTERN u32 acpi_gbl_current_object_count; -ACPI_EXTERN u32 acpi_gbl_current_object_size; -ACPI_EXTERN u32 acpi_gbl_max_concurrent_object_count; -ACPI_EXTERN u32 acpi_gbl_max_concurrent_object_size; -ACPI_EXTERN u32 acpi_gbl_running_object_count; -ACPI_EXTERN u32 acpi_gbl_running_object_size; - -#endif - - -#endif /* __GLOBALS_H__ */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/include/hardware.h linux/drivers/acpi/include/hardware.h --- v2.4.0-test8/linux/drivers/acpi/include/hardware.h Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/include/hardware.h Wed Dec 31 16:00:00 1969 @@ -1,169 +0,0 @@ - -/****************************************************************************** - * - * Name: hardware.h -- hardware specific interfaces - * - *****************************************************************************/ - -/* - * 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 __HARDWARE_H__ -#define __HARDWARE_H__ - - -/* Prototypes */ - - -ACPI_STATUS -acpi_hw_initialize( - void); - -ACPI_STATUS -acpi_hw_shutdown( - void); - -ACPI_STATUS -acpi_hw_initialize_system_info( - void); - -ACPI_STATUS -acpi_hw_set_mode ( - u32 mode); - -u32 -acpi_hw_get_mode ( - void); - -u32 -acpi_hw_get_mode_capabilities ( - void); - -/* Register I/O Prototypes */ - -u32 -acpi_hw_register_access ( - NATIVE_UINT read_write, - u8 use_lock, - u32 register_id, ... /* DWORD Value */); - -void -acpi_hw_clear_acpi_status ( - void); - - -/* GPE support */ - -void -acpi_hw_enable_gpe ( - u32 gpe_index); - -void -acpi_hw_disable_gpe ( - u32 gpe_index); - -void -acpi_hw_clear_gpe ( - u32 gpe_index); - -void -acpi_hw_get_gpe_status ( - u32 gpe_number, - ACPI_EVENT_STATUS *event_status); - -/* Sleep Prototypes */ - -ACPI_STATUS -acpi_hw_obtain_sleep_type_register_data ( - u8 sleep_state, - u8 *slp_typ_a, - u8 *slp_typ_b); - - -/* Cx State Prototypes */ - -ACPI_STATUS -acpi_hw_enter_c1( - ACPI_IO_ADDRESS pblk_address, - u32 *pm_timer_ticks); - -ACPI_STATUS -acpi_hw_enter_c2( - ACPI_IO_ADDRESS pblk_address, - u32 *pm_timer_ticks); - -ACPI_STATUS -acpi_hw_enter_c3( - ACPI_IO_ADDRESS pblk_address, - u32 *pm_timer_ticks); - -ACPI_STATUS -acpi_hw_enter_cx ( - ACPI_IO_ADDRESS pblk_address, - u32 *pm_timer_ticks); - -ACPI_STATUS -acpi_hw_set_cx ( - u32 cx_state); - -ACPI_STATUS -acpi_hw_get_cx_info ( - u32 cx_states[]); - - -/* Throttling Prototypes */ - -void -acpi_hw_enable_throttling ( - ACPI_IO_ADDRESS pblk_address); - -void -acpi_hw_disable_throttling ( - ACPI_IO_ADDRESS pblk_address); - -u32 -acpi_hw_get_duty_cycle ( - u8 duty_offset, - ACPI_IO_ADDRESS pblk_address, - u32 num_throttle_states); - -void -acpi_hw_program_duty_cycle ( - u8 duty_offset, - u32 duty_cycle, - ACPI_IO_ADDRESS pblk_address, - u32 num_throttle_states); - -NATIVE_UINT -acpi_hw_local_pow ( - NATIVE_UINT x, - NATIVE_UINT y); - - -/* ACPI Timer prototypes */ - -u32 -acpi_hw_pmt_ticks ( - void); - -u32 -acpi_hw_pmt_resolution ( - void); - - -#endif /* __HARDWARE_H__ */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/include/internal.h linux/drivers/acpi/include/internal.h --- v2.4.0-test8/linux/drivers/acpi/include/internal.h Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/include/internal.h Wed Dec 31 16:00:00 1969 @@ -1,850 +0,0 @@ - -/****************************************************************************** - * - * Name: internal.h - Internal data types used across the ACPI subsystem - * - *****************************************************************************/ - -/* - * 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 _ACPI_INTERNAL_H -#define _ACPI_INTERNAL_H - -#include "config.h" - - -#define WAIT_FOREVER ((u32) -1) - -typedef void* ACPI_MUTEX; -typedef u32 ACPI_MUTEX_HANDLE; - - -/* Object descriptor types */ - -#define ACPI_DESC_TYPE_INTERNAL 0xAA -#define ACPI_DESC_TYPE_PARSER 0xBB -#define ACPI_DESC_TYPE_STATE 0xCC -#define ACPI_DESC_TYPE_WALK 0xDD -#define ACPI_DESC_TYPE_NAMED 0xEE - - -/***************************************************************************** - * - * Mutex typedefs and structs - * - ****************************************************************************/ - - -/* - * Predefined handles for the mutex objects used within the subsystem - * All mutex objects are automatically created by Acpi_cm_mutex_initialize. - * NOTE: any changes here must be reflected in the Acpi_gbl_Mutex_names table also! - */ - -#define ACPI_MTX_HARDWARE 0 -#define ACPI_MTX_MEMORY 1 -#define ACPI_MTX_CACHES 2 -#define ACPI_MTX_TABLES 3 -#define ACPI_MTX_PARSER 4 -#define ACPI_MTX_DISPATCHER 5 -#define ACPI_MTX_INTERPRETER 6 -#define ACPI_MTX_EXECUTE 7 -#define ACPI_MTX_NAMESPACE 8 -#define ACPI_MTX_EVENTS 9 -#define ACPI_MTX_OP_REGIONS 10 -#define ACPI_MTX_DEBUG_CMD_READY 11 -#define ACPI_MTX_DEBUG_CMD_COMPLETE 12 - -#define MAX_MTX 12 -#define NUM_MTX MAX_MTX+1 - - -#ifdef ACPI_DEBUG -#ifdef DEFINE_ACPI_GLOBALS - -/* Names for the mutexes used in the subsystem */ - -static char *acpi_gbl_mutex_names[] = -{ - "ACPI_MTX_Hardware", - "ACPI_MTX_Memory", - "ACPI_MTX_Caches", - "ACPI_MTX_Tables", - "ACPI_MTX_Parser", - "ACPI_MTX_Dispatcher", - "ACPI_MTX_Interpreter", - "ACPI_MTX_Execute", - "ACPI_MTX_Namespace", - "ACPI_MTX_Events", - "ACPI_MTX_Op_regions", - "ACPI_MTX_Debug_cmd_ready", - "ACPI_MTX_Debug_cmd_complete" -}; - -#endif -#endif - - -/* Table for the global mutexes */ - -typedef struct acpi_mutex_info -{ - ACPI_MUTEX mutex; - u32 use_count; - u8 locked; - -} ACPI_MUTEX_INFO; - - -/* Lock flag parameter for various interfaces */ - -#define ACPI_MTX_DO_NOT_LOCK 0 -#define ACPI_MTX_LOCK 1 - - -typedef u16 ACPI_OWNER_ID; -#define OWNER_TYPE_TABLE 0x0 -#define OWNER_TYPE_METHOD 0x1 -#define FIRST_METHOD_ID 0x0000 -#define FIRST_TABLE_ID 0x8000 - -/* TBD: [Restructure] get rid of the need for this! */ - -#define TABLE_ID_DSDT (ACPI_OWNER_ID) 0xD1D1 - -/***************************************************************************** - * - * Namespace typedefs and structs - * - ****************************************************************************/ - - -/* Operational modes of the AML interpreter/scanner */ - -typedef enum -{ - IMODE_LOAD_PASS1 = 0x01, - IMODE_LOAD_PASS2 = 0x02, - IMODE_EXECUTE = 0x0E - -} OPERATING_MODE; - - -/* - * The Acpi_named_object describes a named object that appears in the AML - * An Acpi_name_table is used to store Acpi_named_objects. - * - * Data_type is used to differentiate between internal descriptors, and MUST - * be the first byte in this structure. - */ - -typedef struct acpi_named_object -{ - u8 data_type; - u8 type; /* Type associated with this name */ - u8 this_index; /* Entry number */ - u8 flags; - u32 name; /* ACPI Name, always 4 chars per ACPI spec */ - - - void *object; /* Pointer to attached ACPI object (optional) */ - struct acpi_name_table *child_table; /* Scope owned by this name (optional) */ - ACPI_OWNER_ID owner_id; /* ID of owner - either an ACPI table or a method */ - u16 reference_count; /* Current count of references and children */ - -#ifdef _IA64 - u32 fill1; /* 64-bit alignment */ -#endif - -} ACPI_NAMED_OBJECT; - - -typedef struct acpi_name_table -{ - struct acpi_name_table *next_table; - struct acpi_name_table *parent_table; - ACPI_NAMED_OBJECT *parent_entry; - ACPI_NAMED_OBJECT entries[1]; - -} ACPI_NAME_TABLE; - - -#define ENTRY_NOT_FOUND NULL - - -/* NTE flags */ - -#define NTE_AML_ATTACHMENT 0x1 - - -/* - * ACPI Table Descriptor. One per ACPI table - */ -typedef struct acpi_table_desc -{ - struct acpi_table_desc *prev; - struct acpi_table_desc *next; - struct acpi_table_desc *installed_desc; - ACPI_TABLE_HEADER *pointer; - void *base_pointer; - u8 *aml_pointer; - u32 aml_length; - u32 length; - u32 count; - ACPI_OWNER_ID table_id; - u8 type; - u8 allocation; - u8 loaded_into_namespace; - -} ACPI_TABLE_DESC; - - -typedef struct -{ - char *search_for; - ACPI_HANDLE *list; - s32 *count; - -} FIND_CONTEXT; - - -typedef struct -{ - ACPI_NAME_TABLE *name_table; - u32 position; - u8 table_full; - -} NS_SEARCH_DATA; - - -/* - * Predefined Namespace items - */ -#define ACPI_MAX_ADDRESS_SPACE 255 -#define ACPI_NUM_ADDRESS_SPACES 256 - - -typedef struct -{ - char *name; - ACPI_OBJECT_TYPE type; - char *val; - -} PREDEFINED_NAMES; - - -/***************************************************************************** - * - * Event typedefs and structs - * - ****************************************************************************/ - - -/* Status bits. */ - -#define ACPI_STATUS_PMTIMER 0x0001 -#define ACPI_STATUS_GLOBAL 0x0020 -#define ACPI_STATUS_POWER_BUTTON 0x0100 -#define ACPI_STATUS_SLEEP_BUTTON 0x0200 -#define ACPI_STATUS_RTC_ALARM 0x0400 - -/* Enable bits. */ - -#define ACPI_ENABLE_PMTIMER 0x0001 -#define ACPI_ENABLE_GLOBAL 0x0020 -#define ACPI_ENABLE_POWER_BUTTON 0x0100 -#define ACPI_ENABLE_SLEEP_BUTTON 0x0200 -#define ACPI_ENABLE_RTC_ALARM 0x0400 - - -/* - * Entry in the Address_space (AKA Operation Region) table - */ - -typedef struct -{ - ADDRESS_SPACE_HANDLER handler; - void *context; - -} ACPI_ADDRESS_SPACE_INFO; - - -/* Values and addresses of the GPE registers (both banks) */ - -typedef struct -{ - u8 status; /* Current value of status reg */ - u8 enable; /* Current value of enable reg */ - u16 status_addr; /* Address of status reg */ - u16 enable_addr; /* Address of enable reg */ - u8 gpe_base; /* Base GPE number */ - -} ACPI_GPE_REGISTERS; - - -#define ACPI_GPE_LEVEL_TRIGGERED 1 -#define ACPI_GPE_EDGE_TRIGGERED 2 - - -/* Information about each particular GPE level */ - -typedef struct -{ - u8 type; /* Level or Edge */ - - ACPI_HANDLE method_handle; /* Method handle for direct (fast) execution */ - GPE_HANDLER handler; /* Address of handler, if any */ - void *context; /* Context to be passed to handler */ - -} ACPI_GPE_LEVEL_INFO; - - -/* Information about each particular fixed event */ - -typedef struct -{ - FIXED_EVENT_HANDLER handler; /* Address of handler. */ - void *context; /* Context to be passed to handler */ - -} ACPI_FIXED_EVENT_INFO; - - -/* Information used during field processing */ - -typedef struct -{ - u8 skip_field; - u8 field_flag; - u32 pkg_length; - -} ACPI_FIELD_INFO; - - -/***************************************************************************** - * - * Parser typedefs and structs - * - ****************************************************************************/ - - -#define OP_INFO_TYPE 0x1F -#define OP_INFO_HAS_ARGS 0x20 -#define OP_INFO_CHILD_LOCATION 0xC0 - -/* - * AML opcode, name, and argument layout - */ -typedef struct acpi_op_info -{ - u16 opcode; /* AML opcode */ - u8 flags; /* Opcode type, Has_args flag */ - u32 parse_args; /* Grammar/Parse time arguments */ - u32 runtime_args; /* Interpret time arguments */ - - DEBUG_ONLY_MEMBERS ( - char *name) /* op name (debug only) */ - -} ACPI_OP_INFO; - - -typedef union acpi_op_value -{ - u32 integer; /* integer constant */ - u32 size; /* bytelist or field size */ - char *string; /* NULL terminated string */ - u8 *buffer; /* buffer or string */ - char *name; /* NULL terminated string */ - struct acpi_generic_op *arg; /* arguments and contained ops */ - ACPI_NAMED_OBJECT *entry; /* entry in interpreter namespace tbl */ - -} ACPI_OP_VALUE; - - -#define ACPI_COMMON_OP \ - u8 data_type; /* To differentiate various internal objs */\ - u8 flags; /* Type of Op */\ - u16 opcode; /* AML opcode */\ - u32 aml_offset; /* offset of declaration in AML */\ - struct acpi_generic_op *parent; /* parent op */\ - struct acpi_generic_op *next; /* next op */\ - DEBUG_ONLY_MEMBERS (\ - char op_name[16]) /* op name (debug only) */\ - /* NON-DEBUG members below: */\ - void *acpi_named_object;/* for use by interpreter */\ - ACPI_OP_VALUE value; /* Value or args associated with the opcode */\ - - -/* - * generic operation (eg. If, While, Store) - */ -typedef struct acpi_generic_op -{ - ACPI_COMMON_OP -} ACPI_GENERIC_OP; - - -/* - * operation with a name (eg. Scope, Method, Name, Named_field, ...) - */ -typedef struct acpi_named_op -{ - ACPI_COMMON_OP - u32 name; /* 4-byte name or zero if no name */ - -} ACPI_NAMED_OP; - - -/* - * special operation for methods and regions (parsing must be deferred - * until a first pass parse is completed) - */ -typedef struct acpi_deferred_op -{ - ACPI_COMMON_OP - u32 name; /* 4-byte name or 0 if none */ - u32 body_length; /* AML body size */ - u8 *body; /* AML body */ - u16 thread_count; /* Count of threads currently executing a method */ - -} ACPI_DEFERRED_OP; - - -/* - * special operation for bytelists (Byte_list only) - */ -typedef struct acpi_bytelist_op -{ - ACPI_COMMON_OP - u8 *data; /* bytelist data */ - -} ACPI_BYTELIST_OP; - - -/* - * Parse state - one state per parser invocation and each control - * method. - */ - -typedef struct acpi_parse_state -{ - u8 *aml_start; /* first AML byte */ - u8 *aml; /* next AML byte */ - u8 *aml_end; /* (last + 1) AML byte */ - u8 *pkg_end; /* current package end */ - ACPI_GENERIC_OP *start_op; /* root of parse tree */ - struct acpi_parse_scope *scope; /* current scope */ - struct acpi_parse_scope *scope_avail; /* unused (extra) scope structs */ - struct acpi_parse_state *next; - -} ACPI_PARSE_STATE; - - -/* - * Parse scope - one per ACPI scope - */ - -typedef struct acpi_parse_scope -{ - ACPI_GENERIC_OP *op; /* current op being parsed */ - u8 *arg_end; /* current argument end */ - u8 *pkg_end; /* current package end */ - struct acpi_parse_scope *parent; /* parent scope */ - u32 arg_list; /* next argument to parse */ - u32 arg_count; /* Number of fixed arguments */ - -} ACPI_PARSE_SCOPE; - - -/***************************************************************************** - * - * Generic "state" object for stacks - * - ****************************************************************************/ - - -#define CONTROL_NORMAL 0xC0 -#define CONTROL_CONDITIONAL_EXECUTING 0xC1 -#define CONTROL_PREDICATE_EXECUTING 0xC2 -#define CONTROL_PREDICATE_FALSE 0xC3 -#define CONTROL_PREDICATE_TRUE 0xC4 - - -#define ACPI_STATE_COMMON /* Two 32-bit fields and a pointer */\ - u8 data_type; /* To differentiate various internal objs */\ - u8 flags; \ - u16 value; \ - u16 state; \ - u16 acpi_eval; \ - void *next; \ - -typedef struct acpi_common_state -{ - ACPI_STATE_COMMON -} ACPI_COMMON_STATE; - - -/* - * Update state - used to traverse complex objects such as packages - */ -typedef struct acpi_update_state -{ - ACPI_STATE_COMMON - union acpi_obj_internal *object; - -} ACPI_UPDATE_STATE; - -/* - * Control state - one per if/else and while constructs. - * Allows nesting of these constructs - */ -typedef struct acpi_control_state -{ - ACPI_STATE_COMMON - ACPI_GENERIC_OP *predicate_op; /* Start of if/while predicate */ - -} ACPI_CONTROL_STATE; - - -/* - * Scope state - current scope during namespace lookups - */ - -typedef struct acpi_scope_state -{ - ACPI_STATE_COMMON - ACPI_NAME_TABLE *name_table; - -} ACPI_SCOPE_STATE; - - -typedef union acpi_gen_state -{ - ACPI_COMMON_STATE common; - ACPI_CONTROL_STATE control; - ACPI_UPDATE_STATE update; - ACPI_SCOPE_STATE scope; - -} ACPI_GENERIC_STATE; - - -/***************************************************************************** - * - * Tree walking typedefs and structs - * - ****************************************************************************/ - - -/* - * Walk state - current state of a parse tree walk. Used for both a leisurely stroll through - * the tree (for whatever reason), and for control method execution. - */ - -#define NEXT_OP_DOWNWARD 1 -#define NEXT_OP_UPWARD 2 - -typedef struct acpi_walk_state -{ - u8 data_type; /* To differentiate various internal objs */\ - ACPI_OWNER_ID owner_id; /* Owner of objects created during the walk */ - u8 last_predicate; /* Result of last predicate */ - u8 next_op_info; /* Info about Next_op */ - u8 num_operands; /* Stack pointer for Operands[] array */ - u8 num_results; /* Stack pointer for Results[] array */ - u8 current_result; /* */ - - struct acpi_walk_state *next; /* Next Walk_state in list */ - ACPI_GENERIC_OP *origin; /* Start of walk */ - ACPI_GENERIC_OP *prev_op; /* Last op that was processed */ - ACPI_GENERIC_OP *next_op; /* next op to be processed */ - ACPI_GENERIC_STATE *control_state; /* List of control states (nested IFs) */ - ACPI_GENERIC_STATE *scope_info; /* Stack of nested scopes */ - union acpi_obj_internal *return_desc; /* Return object, if any */ - union acpi_obj_internal *method_desc; /* Method descriptor if running a method */ - ACPI_GENERIC_OP *method_call_op; /* Method_call Op if running a method */ - union acpi_obj_internal *operands[OBJ_NUM_OPERANDS]; /* Operands passed to the interpreter */ - union acpi_obj_internal *results[OBJ_NUM_OPERANDS]; /* Accumulated results */ - struct acpi_named_object arguments[MTH_NUM_ARGS]; /* Control method arguments */ - struct acpi_named_object local_variables[MTH_NUM_LOCALS]; /* Control method locals */ - - -} ACPI_WALK_STATE; - - -/* - * Walk list - head of a tree of walk states. Multiple walk states are created when there - * are nested control methods executing. - */ -typedef struct acpi_walk_list -{ - - ACPI_WALK_STATE *walk_state; - -} ACPI_WALK_LIST; - - -typedef -ACPI_STATUS (*INTERPRETER_CALLBACK) ( - ACPI_WALK_STATE *state, - ACPI_GENERIC_OP *op); - - -/* Info used by Acpi_ps_init_objects */ - -typedef struct init_walk_info -{ - u32 method_count; - u32 op_region_count; - ACPI_TABLE_DESC *table_desc; - -} INIT_WALK_INFO; - - -/* TBD: [Restructure] Merge with struct above */ - -typedef struct acpi_walk_info -{ - u32 debug_level; - u32 owner_id; - -} ACPI_WALK_INFO; - - -/***************************************************************************** - * - * Hardware and PNP - * - ****************************************************************************/ - - -/* Sleep states */ - -#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 - -/* - * The #define's and enum below establish an abstract way of identifying what - * register block and register is to be accessed. Do not change any of the - * 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 - -enum -{ - /* PM1 status register ids */ - - TMR_STS = (PM1_EVT | 0x01), - BM_STS, - GBL_STS, - PWRBTN_STS, - SLPBTN_STS, - RTC_STS, - WAK_STS, - - /* PM1 enable register ids */ - - 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 */ - - SCI_EN = (PM1_CONTROL | 0x01), - BM_RLD, - GBL_RLS, - SLP_TYPE_A, - SLP_TYPE_B, - SLP_EN, - - /* PM2 control register ids */ - - ARB_DIS = (PM2_CONTROL | 0x01), - - /* PM Timer register ids */ - - TMR_VAL = (PM_TIMER | 0x01), - - GPE0_STS = (GPE0_STS_BLOCK | 0x01), - GPE0_EN = (GPE0_EN_BLOCK | 0x01), - - GPE1_STS = (GPE1_STS_BLOCK | 0x01), - GPE1_EN = (GPE0_EN_BLOCK | 0x01), - - /* Last register value is one less than LAST_REG */ - - LAST_REG -}; - - -#define TMR_STS_MASK 0x0001 -#define BM_STS_MASK 0x0010 -#define GBL_STS_MASK 0x0020 -#define PWRBTN_STS_MASK 0x0100 -#define SLPBTN_STS_MASK 0x0200 -#define RTC_STS_MASK 0x0400 -#define WAK_STS_MASK 0x8000 - -#define ALL_FIXED_STS_BITS (TMR_STS_MASK | BM_STS_MASK | GBL_STS_MASK | PWRBTN_STS_MASK | \ - SLPBTN_STS_MASK | RTC_STS_MASK | WAK_STS_MASK) - -#define TMR_EN_MASK 0x0001 -#define GBL_EN_MASK 0x0020 -#define PWRBTN_EN_MASK 0x0100 -#define SLPBTN_EN_MASK 0x0200 -#define RTC_EN_MASK 0x0400 - -#define SCI_EN_MASK 0x0001 -#define BM_RLD_MASK 0x0002 -#define GBL_RLS_MASK 0x0004 -#define SLP_TYPE_X_MASK 0x1C00 -#define SLP_EN_MASK 0x2000 - -#define ARB_DIS_MASK 0x0001 - -#define GPE0_STS_MASK -#define GPE0_EN_MASK - -#define GPE1_STS_MASK -#define GPE1_EN_MASK - - -#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 */ - -/* Pnp and ACPI data */ - -#define VERSION_NO 0x01 -#define LOGICAL_DEVICE_ID 0x02 -#define COMPATIBLE_DEVICE_ID 0x03 -#define IRQ_FORMAT 0x04 -#define DMA_FORMAT 0x05 -#define START_DEPENDENT_TAG 0x06 -#define END_DEPENDENT_TAG 0x07 -#define IO_PORT_DESCRIPTOR 0x08 -#define FIXED_LOCATION_IO_DESCRIPTOR 0x09 -#define RESERVED_TYPE0 0x0A -#define RESERVED_TYPE1 0x0B -#define RESERVED_TYPE2 0x0C -#define RESERVED_TYPE3 0x0D -#define SMALL_VENDOR_DEFINED 0x0E -#define END_TAG 0x0F - -/* Pnp and ACPI data */ - -#define MEMORY_RANGE_24 0x81 -#define ISA_MEMORY_RANGE 0x81 -#define LARGE_VENDOR_DEFINED 0x84 -#define EISA_MEMORY_RANGE 0x85 -#define MEMORY_RANGE_32 0x85 -#define FIXED_EISA_MEMORY_RANGE 0x86 -#define FIXED_MEMORY_RANGE_32 0x86 - -/* ACPI only data */ - -#define DWORD_ADDRESS_SPACE 0x87 -#define WORD_ADDRESS_SPACE 0x88 -#define EXTENDED_IRQ 0x89 - -/* MUST HAVES */ - - -typedef enum -{ - DWORD_DEVICE_ID, - STRING_PTR_DEVICE_ID, - STRING_DEVICE_ID - -} DEVICE_ID_TYPE; - -typedef struct -{ - DEVICE_ID_TYPE type; - union - { - u32 number; - char *string_ptr; - char buffer[9]; - } data; - -} DEVICE_ID; - - -/***************************************************************************** - * - * Debug - * - ****************************************************************************/ - - -/* Entry for a memory allocation (debug only) */ - -#ifdef ACPI_DEBUG - -#define MEM_MALLOC 0 -#define MEM_CALLOC 1 -#define MAX_MODULE_NAME 16 - -typedef struct allocation_info -{ - struct allocation_info *previous; - struct allocation_info *next; - void *address; - u32 size; - u32 component; - u32 line; - char module[MAX_MODULE_NAME]; - u8 alloc_type; - -} ALLOCATION_INFO; - -#endif - -#endif diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/include/interp.h linux/drivers/acpi/include/interp.h --- v2.4.0-test8/linux/drivers/acpi/include/interp.h Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/include/interp.h Wed Dec 31 16:00:00 1969 @@ -1,660 +0,0 @@ - -/****************************************************************************** - * - * Name: interp.h - Interpreter subcomponent prototypes and defines - * - *****************************************************************************/ - -/* - * 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 __INTERP_H__ -#define __INTERP_H__ - - -#include "actypes.h" -#include "acobject.h" - - -#define WALK_OPERANDS &(walk_state->operands [walk_state->num_operands -1]) - - -/* Interpreter constants */ - -#define AML_END_OF_BLOCK -1 -#define PUSH_PKG_LENGTH 1 -#define DO_NOT_PUSH_PKG_LENGTH 0 - - -#define STACK_TOP 0 -#define STACK_BOTTOM (u32) -1 - -/* Constants for global "When_to_parse_methods" */ - -#define METHOD_PARSE_AT_INIT 0x0 -#define METHOD_PARSE_JUST_IN_TIME 0x1 -#define METHOD_DELETE_AT_COMPLETION 0x2 - - -ACPI_STATUS -acpi_aml_resolve_operands ( - u16 opcode, - ACPI_OBJECT_INTERNAL **stack_ptr); - - -/* - * amxface - External interpreter interfaces - */ - -ACPI_STATUS -acpi_aml_load_table ( - ACPI_TABLE_TYPE table_id); - -ACPI_STATUS -acpi_aml_execute_method ( - ACPI_NAMED_OBJECT *method_entry, - ACPI_OBJECT_INTERNAL **params, - ACPI_OBJECT_INTERNAL **return_obj_desc); - - -/* - * amcopy - Interpreter object copy support - */ - -ACPI_STATUS -acpi_aml_build_copy_internal_package_object ( - ACPI_OBJECT_INTERNAL *source_obj, - ACPI_OBJECT_INTERNAL *dest_obj); - - -/* - * amfield - ACPI AML (p-code) execution - field manipulation - */ - - -ACPI_STATUS -acpi_aml_read_field ( - ACPI_OBJECT_INTERNAL *obj_desc, - void *buffer, - u32 buffer_length, - u32 byte_length, - u32 datum_length, - u32 bit_granularity, - u32 byte_granularity); - -ACPI_STATUS -acpi_aml_write_field ( - ACPI_OBJECT_INTERNAL *obj_desc, - void *buffer, - u32 buffer_length, - u32 byte_length, - u32 datum_length, - u32 bit_granularity, - u32 byte_granularity); - -ACPI_STATUS -acpi_aml_setup_field ( - ACPI_OBJECT_INTERNAL *obj_desc, - ACPI_OBJECT_INTERNAL *rgn_desc, - s32 field_bit_width); - -ACPI_STATUS -acpi_aml_read_field_data ( - ACPI_OBJECT_INTERNAL *obj_desc, - u32 field_byte_offset, - u32 field_bit_width, - u32 *value); - -ACPI_STATUS -acpi_aml_access_named_field ( - s32 mode, - ACPI_HANDLE named_field, - void *buffer, - u32 length); - -ACPI_STATUS -acpi_aml_set_named_field_value ( - ACPI_HANDLE named_field, - void *buffer, - u32 length); - -ACPI_STATUS -acpi_aml_get_named_field_value ( - ACPI_HANDLE named_field, - void *buffer, - u32 length); - - -/* - * ammisc - ACPI AML (p-code) execution - specific opcodes - */ - -ACPI_STATUS -acpi_aml_exec_create_field ( - u16 opcode, - ACPI_WALK_STATE *walk_state); - -ACPI_STATUS -acpi_aml_exec_reconfiguration ( - u16 opcode, - ACPI_WALK_STATE *walk_state); - -ACPI_STATUS -acpi_aml_exec_fatal ( - ACPI_WALK_STATE *walk_state); - -ACPI_STATUS -acpi_aml_exec_index ( - ACPI_WALK_STATE *walk_state, - ACPI_OBJECT_INTERNAL **return_desc); - -ACPI_STATUS -acpi_aml_exec_match ( - ACPI_WALK_STATE *walk_state, - ACPI_OBJECT_INTERNAL **return_desc); - -ACPI_STATUS -acpi_aml_exec_create_mutex ( - ACPI_WALK_STATE *walk_state); - -ACPI_STATUS -acpi_aml_exec_create_processor ( - ACPI_GENERIC_OP *op, - ACPI_HANDLE processor_nTE); - -ACPI_STATUS -acpi_aml_exec_create_power_resource ( - ACPI_GENERIC_OP *op, - ACPI_HANDLE processor_nTE); - -ACPI_STATUS -acpi_aml_exec_create_region ( - u8 *aml_ptr, - u32 acpi_aml_length, - u32 region_space, - ACPI_WALK_STATE *walk_state); - -ACPI_STATUS -acpi_aml_exec_create_event ( - ACPI_WALK_STATE *walk_state); - -ACPI_STATUS -acpi_aml_exec_create_alias ( - ACPI_WALK_STATE *walk_state); - -ACPI_STATUS -acpi_aml_exec_create_method ( - u8 *aml_ptr, - u32 acpi_aml_length, - u32 method_flags, - ACPI_HANDLE method); - - -/* - * amprep - ACPI AML (p-code) execution - prep utilities - */ - -ACPI_STATUS -acpi_aml_prep_def_field_value ( - ACPI_NAMED_OBJECT *this_entry, - ACPI_HANDLE region, - u8 field_flags, - u8 field_attribute, - u32 field_position, - u32 field_length); - -ACPI_STATUS -acpi_aml_prep_bank_field_value ( - ACPI_NAMED_OBJECT *this_entry, - ACPI_HANDLE region, - ACPI_HANDLE bank_reg, - u32 bank_val, - u8 field_flags, - u8 field_attribute, - u32 field_position, - u32 field_length); - -ACPI_STATUS -acpi_aml_prep_index_field_value ( - ACPI_NAMED_OBJECT *this_entry, - ACPI_HANDLE index_reg, - ACPI_HANDLE data_reg, - u8 field_flags, - u8 field_attribute, - u32 field_position, - u32 field_length); - -ACPI_STATUS -acpi_aml_prep_operands ( - char *types, - ACPI_OBJECT_INTERNAL **stack_ptr); - - -/* - * iepstack - package stack utilities - */ - -/* -u32 -Acpi_aml_pkg_stack_level ( - void); - -void -Acpi_aml_clear_pkg_stack ( - void); - -ACPI_STATUS -Acpi_aml_pkg_push_length ( - u32 Length, - OPERATING_MODE Load_exec_mode); - -ACPI_STATUS -Acpi_aml_pkg_push_exec_length ( - u32 Length); - -ACPI_STATUS -Acpi_aml_pkg_push_exec ( - u8 *Code, - u32 Len); - -ACPI_STATUS -Acpi_aml_pkg_pop_length ( - s32 No_err_under, - OPERATING_MODE Load_exec_mode); - -ACPI_STATUS -Acpi_aml_pkg_pop_exec_length ( - void); - -ACPI_STATUS -Acpi_aml_pkg_pop_exec ( - void); - -*/ - -/* - * amsystem - Interface to OS services - */ - -u16 -acpi_aml_system_thread_id ( - void); - -ACPI_STATUS -acpi_aml_system_do_notify_op ( - ACPI_OBJECT_INTERNAL *value, - ACPI_OBJECT_INTERNAL *obj_desc); - -void -acpi_aml_system_do_suspend( - u32 time); - -void -acpi_aml_system_do_stall ( - u32 time); - -ACPI_STATUS -acpi_aml_system_acquire_mutex( - ACPI_OBJECT_INTERNAL *time, - ACPI_OBJECT_INTERNAL *obj_desc); - -ACPI_STATUS -acpi_aml_system_release_mutex( - ACPI_OBJECT_INTERNAL *obj_desc); - -ACPI_STATUS -acpi_aml_system_signal_event( - ACPI_OBJECT_INTERNAL *obj_desc); - -ACPI_STATUS -acpi_aml_system_wait_event( - ACPI_OBJECT_INTERNAL *time, - ACPI_OBJECT_INTERNAL *obj_desc); - -ACPI_STATUS -acpi_aml_system_reset_event( - ACPI_OBJECT_INTERNAL *obj_desc); - -ACPI_STATUS -acpi_aml_system_wait_semaphore ( - ACPI_HANDLE semaphore, - u32 timeout); - - -/* - * ammonadic - ACPI AML (p-code) execution, monadic operators - */ - -ACPI_STATUS -acpi_aml_exec_monadic1 ( - u16 opcode, - ACPI_WALK_STATE *walk_state); - -ACPI_STATUS -acpi_aml_exec_monadic2 ( - u16 opcode, - ACPI_WALK_STATE *walk_state, - ACPI_OBJECT_INTERNAL **return_desc); - -ACPI_STATUS -acpi_aml_exec_monadic2_r ( - u16 opcode, - ACPI_WALK_STATE *walk_state, - ACPI_OBJECT_INTERNAL **return_desc); - - -/* - * amdyadic - ACPI AML (p-code) execution, dyadic operators - */ - -ACPI_STATUS -acpi_aml_exec_dyadic1 ( - u16 opcode, - ACPI_WALK_STATE *walk_state); - -ACPI_STATUS -acpi_aml_exec_dyadic2 ( - u16 opcode, - ACPI_WALK_STATE *walk_state, - ACPI_OBJECT_INTERNAL **return_desc); - -ACPI_STATUS -acpi_aml_exec_dyadic2_r ( - u16 opcode, - ACPI_WALK_STATE *walk_state, - ACPI_OBJECT_INTERNAL **return_desc); - -ACPI_STATUS -acpi_aml_exec_dyadic2_s ( - u16 opcode, - ACPI_WALK_STATE *walk_state, - ACPI_OBJECT_INTERNAL **return_desc); - - -/* - * amresolv - Object resolution and get value functions - */ - -ACPI_STATUS -acpi_aml_resolve_to_value ( - ACPI_OBJECT_INTERNAL **stack_ptr); - -ACPI_STATUS -acpi_aml_resolve_entry_to_value ( - ACPI_NAMED_OBJECT **stack_ptr); - -ACPI_STATUS -acpi_aml_resolve_object_to_value ( - ACPI_OBJECT_INTERNAL **stack_ptr); - -ACPI_STATUS -acpi_aml_get_field_unit_value ( - ACPI_OBJECT_INTERNAL *field_desc, - ACPI_OBJECT_INTERNAL *result_desc); - - -/* - * amcode - Scanner AML code manipulation routines - */ - -s32 -acpi_aml_avail ( - ACPI_SIZE n); - -s32 -acpi_aml_peek ( - void); - -s32 -acpi_aml_get_pcode_byte ( - u8 *pcode); - -u16 -acpi_aml_peek_op ( - void); - -u8 * -acpi_aml_consume_bytes ( - ACPI_SIZE bytes); - -ACPI_SIZE -acpi_aml_consume_stream_bytes ( - ACPI_SIZE bytes_to_get, - u8 *aml_buffer); - -void -acpi_aml_consume_package ( - OPERATING_MODE load_exec_mode); - -void -acpi_aml_set_pcode_input ( - u8 *base, - u32 length); - -ACPI_STATUS -acpi_aml_set_method ( - void *object); - -ACPI_STATUS -acpi_aml_prep_exec ( - u8 *pcode, - u32 pcode_length); - -ACPI_HANDLE -acpi_aml_get_pcode_handle ( - void); - -void -acpi_aml_get_current_location ( - ACPI_OBJECT_INTERNAL *method_desc); - -void -acpi_aml_set_current_location ( - ACPI_OBJECT_INTERNAL *method_desc); - - -/* - * amdump - Scanner debug output routines - */ - -void -acpi_aml_show_hex_value ( - s32 byte_count, - u8 *aml_ptr, - s32 lead_space); - -void -acpi_aml_dump_buffer ( - ACPI_SIZE length); - - -ACPI_STATUS -acpi_aml_dump_operand ( - ACPI_OBJECT_INTERNAL *entry_desc); - -void -acpi_aml_dump_operands ( - ACPI_OBJECT_INTERNAL **operands, - OPERATING_MODE interpreter_mode, - char *ident, - s32 num_levels, - char *note, - char *module_name, - s32 line_number); - -void -acpi_aml_dump_object_descriptor ( - ACPI_OBJECT_INTERNAL *object, - u32 flags); - - -void -acpi_aml_dump_acpi_named_object ( - ACPI_NAMED_OBJECT *entry, - u32 flags); - - -/* - * amnames - interpreter/scanner name load/execute - */ - -char * -acpi_aml_allocate_name_string ( - u32 prefix_count, - u32 num_name_segs); - -s32 -acpi_aml_good_char ( - s32 character); - -ACPI_STATUS -acpi_aml_exec_name_segment ( - u8 **in_aml_address, - char *name_string); - -ACPI_STATUS -acpi_aml_get_name_string ( - OBJECT_TYPE_INTERNAL data_type, - u8 *in_aml_address, - char **out_name_string, - u32 *out_name_length); - -u32 -acpi_aml_decode_package_length ( - u32 last_pkg_len); - - -ACPI_STATUS -acpi_aml_do_name ( - ACPI_OBJECT_TYPE data_type, - OPERATING_MODE load_exec_mode); - - -/* - * amstore - Object store support - */ - -ACPI_STATUS -acpi_aml_exec_store ( - ACPI_OBJECT_INTERNAL *op1, - ACPI_OBJECT_INTERNAL *res); - -ACPI_STATUS -acpi_aml_store_object_to_object ( - ACPI_OBJECT_INTERNAL *val_desc, - ACPI_OBJECT_INTERNAL *dest_desc); - -ACPI_STATUS -acpi_aml_store_object_to_nte ( - ACPI_OBJECT_INTERNAL *val_desc, - ACPI_NAMED_OBJECT *entry); - - -/* - * amutils - interpreter/scanner utilities - */ - -void -acpi_aml_enter_interpreter ( - void); - -void -acpi_aml_exit_interpreter ( - void); - -u8 -acpi_aml_validate_object_type ( - ACPI_OBJECT_TYPE type); - -u8 -acpi_aml_acquire_global_lock ( - u32 rule); - -ACPI_STATUS -acpi_aml_release_global_lock ( - u8 locked); - -void -acpi_aml_append_operand_diag( - char *name, - s32 line, - u16 op_code, - ACPI_OBJECT_INTERNAL **operands, - s32 Noperands); - -u32 -acpi_aml_buf_seq ( - void); - -s32 -acpi_aml_digits_needed ( - s32 value, - s32 base); - -ACPI_STATUS -acpi_aml_eisa_id_to_string ( - u32 numeric_id, - char *out_string); - - -/* - * amregion - default Op_region handlers - */ - -ACPI_STATUS -acpi_aml_system_memory_space_handler ( - u32 function, - u32 address, - u32 bit_width, - u32 *value, - void *context); - -ACPI_STATUS -acpi_aml_system_io_space_handler ( - u32 function, - u32 address, - u32 bit_width, - u32 *value, - void *context); - -ACPI_STATUS -acpi_aml_pci_config_space_handler ( - u32 function, - u32 address, - u32 bit_width, - u32 *value, - void *context); - -ACPI_STATUS -acpi_aml_embedded_controller_space_handler ( - u32 function, - u32 address, - u32 bit_width, - u32 *value, - void *context); - -ACPI_STATUS -acpi_aml_sm_bus_space_handler ( - u32 function, - u32 address, - u32 bit_width, - u32 *value, - void *context); - - -#endif /* __INTERP_H__ */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/include/macros.h linux/drivers/acpi/include/macros.h --- v2.4.0-test8/linux/drivers/acpi/include/macros.h Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/include/macros.h Wed Dec 31 16:00:00 1969 @@ -1,423 +0,0 @@ - -/****************************************************************************** - * - * Name: macros.h - C macros for the entire subsystem. - * - *****************************************************************************/ - -/* - * 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 __MACROS_H__ -#define __MACROS_H__ - -/* - * Data manipulation macros - */ - -#ifndef LOWORD -#define LOWORD(l) ((u16)(NATIVE_UINT)(l)) -#endif - -#ifndef HIWORD -#define HIWORD(l) ((u16)((((NATIVE_UINT)(l)) >> 16) & 0xFFFF)) -#endif - -#ifndef LOBYTE -#define LOBYTE(l) ((u8)(u16)(l)) -#endif - -#ifndef HIBYTE -#define HIBYTE(l) ((u8)((((u16)(l)) >> 8) & 0xFF)) -#endif - -#define BIT0(x) ((((x) & 0x01) > 0) ? 1 : 0) -#define BIT1(x) ((((x) & 0x02) > 0) ? 1 : 0) -#define BIT2(x) ((((x) & 0x04) > 0) ? 1 : 0) - -#define BIT3(x) ((((x) & 0x08) > 0) ? 1 : 0) -#define BIT4(x) ((((x) & 0x10) > 0) ? 1 : 0) -#define BIT5(x) ((((x) & 0x20) > 0) ? 1 : 0) -#define BIT6(x) ((((x) & 0x40) > 0) ? 1 : 0) -#define BIT7(x) ((((x) & 0x80) > 0) ? 1 : 0) - -#define LOW_BASE(w) ((u16) ((w) & 0x0000FFFF)) -#define MID_BASE(b) ((u8) (((b) & 0x00FF0000) >> 16)) -#define HI_BASE(b) ((u8) (((b) & 0xFF000000) >> 24)) -#define LOW_LIMIT(w) ((u16) ((w) & 0x0000FFFF)) -#define HI_LIMIT(b) ((u8) (((b) & 0x00FF0000) >> 16)) - - - /* - * Extract a byte of data using a pointer. Any more than a byte and we - * get into potential aligment issues -- see the STORE macros below - */ -#define GET8(addr) (*(u8*)(addr)) - - -/* - * Macros for moving data around to/from buffers that are possibly unaligned. - * If the hardware supports the transfer of unaligned data, just do the store. - * Otherwise, we have to move one byte at a time. - */ - -#ifdef _HW_ALIGNMENT_SUPPORT - -/* The hardware supports unaligned transfers, just do the move */ - -#define MOVE_UNALIGNED16_TO_16(d,s) *(u16*)(d) = *(u16*)(s) -#define MOVE_UNALIGNED32_TO_32(d,s) *(u32*)(d) = *(u32*)(s) -#define MOVE_UNALIGNED16_TO_32(d,s) *(u32*)(d) = *(u16*)(s) - -#else -/* - * The hardware does not support unaligned transfers. We must move the - * data one byte at a time. These macros work whether the source or - * the destination (or both) is/are unaligned. - */ - -#define MOVE_UNALIGNED16_TO_16(d,s) {((char *)(d))[0] = ((char *)(s))[0];\ - ((char *)(d))[1] = ((char *)(s))[1];} - -#define MOVE_UNALIGNED32_TO_32(d,s) {((char *)(d))[0] = ((char *)(s))[0];\ - ((char *)(d))[1] = ((char *)(s))[1];\ - ((char *)(d))[2] = ((char *)(s))[2];\ - ((char *)(d))[3] = ((char *)(s))[3];} - -#define MOVE_UNALIGNED16_TO_32(d,s) {(*(u32*)(d)) = 0; MOVE_UNALIGNED16_TO_16(d,s);} - -#endif - - -/* - * Fast power-of-two math macros for non-optimized compilers - */ - -#define _DIV(value,power_of2) ((value) >> (power_of2)) -#define _MUL(value,power_of2) ((value) << (power_of2)) -#define _MOD(value,divisor) ((value) & ((divisor) -1)) - -#define DIV_2(a) _DIV(a,1) -#define MUL_2(a) _MUL(a,1) -#define MOD_2(a) _MOD(a,2) - -#define DIV_4(a) _DIV(a,2) -#define MUL_4(a) _MUL(a,2) -#define MOD_4(a) _MOD(a,4) - -#define DIV_8(a) _DIV(a,3) -#define MUL_8(a) _MUL(a,3) -#define MOD_8(a) _MOD(a,8) - -#define DIV_16(a) _DIV(a,4) -#define MUL_16(a) _MUL(a,4) -#define MOD_16(a) _MOD(a,16) - - -/* - * Rounding macros (Power of two boundaries only) - */ - -#define ROUND_DOWN(value,boundary) ((value) & (~((boundary)-1))) -#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_NATIVE_WORD(a) ROUND_DOWN(a,ALIGNED_ADDRESS_BOUNDARY) - -#define ROUND_UP_TO_32_bITS(a) ROUND_UP(a,4) -#define ROUND_UP_TO_NATIVE_WORD(a) ROUND_UP(a,ALIGNED_ADDRESS_BOUNDARY) - - -#ifdef DEBUG_ASSERT -#undef DEBUG_ASSERT -#endif - - -/* - * An ACPI_HANDLE (which is actually an ACPI_NAMED_OBJECT*) can appear in some contexts, - * such as on ap_obj_stack, where a pointer to an ACPI_OBJECT_INTERNAL can also - * appear. This macro is used to distinguish them. - * - * The Data_type field is the first field in both structures. - */ - -#define VALID_DESCRIPTOR_TYPE(d,t) (((ACPI_NAMED_OBJECT*)d)->data_type == t) - - -/* Macro to test the object type */ - -#define IS_THIS_OBJECT_TYPE(d,t) (((ACPI_OBJECT_INTERNAL *)d)->common.type == (u8)t) - - -/* - * Macro to check if a pointer is within an ACPI table. - * Parameter (a) is the pointer to check. Parameter (b) must be defined - * as a pointer to an ACPI_TABLE_HEADER. (b+1) then points past the header, - * and ((u8 *)b+b->Length) points one byte past the end of the table. - */ - -#ifndef _IA16 -#define IS_IN_ACPI_TABLE(a,b) (((u8 *)(a) >= (u8 *)(b + 1)) &&\ - ((u8 *)(a) < ((u8 *)b + b->length))) - -#else -#define IS_IN_ACPI_TABLE(a,b) (_segment)(a) == (_segment)(b) &&\ - (((u8 *)(a) >= (u8 *)(b + 1)) &&\ - ((u8 *)(a) < ((u8 *)b + b->length))) -#endif - -/* - * Macros for the master AML opcode table - */ - -#ifdef ACPI_DEBUG -#define OP_INFO_ENTRY(opcode,flags,name,Pargs,Iargs) {opcode,flags,Pargs,Iargs,name} -#else -#define OP_INFO_ENTRY(opcode,flags,name,Pargs,Iargs) {opcode,flags,Pargs,Iargs} -#endif - -#define ARG_TYPE_WIDTH 5 -#define ARG_1(x) ((u32)(x)) -#define ARG_2(x) ((u32)(x) << (1 * ARG_TYPE_WIDTH)) -#define ARG_3(x) ((u32)(x) << (2 * ARG_TYPE_WIDTH)) -#define ARG_4(x) ((u32)(x) << (3 * ARG_TYPE_WIDTH)) -#define ARG_5(x) ((u32)(x) << (4 * ARG_TYPE_WIDTH)) -#define ARG_6(x) ((u32)(x) << (5 * ARG_TYPE_WIDTH)) - -#define ARGI_LIST1(a) (ARG_1(a)) -#define ARGI_LIST2(a,b) (ARG_1(b)|ARG_2(a)) -#define ARGI_LIST3(a,b,c) (ARG_1(c)|ARG_2(b)|ARG_3(a)) -#define ARGI_LIST4(a,b,c,d) (ARG_1(d)|ARG_2(c)|ARG_3(b)|ARG_4(a)) -#define ARGI_LIST5(a,b,c,d,e) (ARG_1(e)|ARG_2(d)|ARG_3(c)|ARG_4(b)|ARG_5(a)) -#define ARGI_LIST6(a,b,c,d,e,f) (ARG_1(f)|ARG_2(e)|ARG_3(d)|ARG_4(c)|ARG_5(b)|ARG_6(a)) - -#define ARGP_LIST1(a) (ARG_1(a)) -#define ARGP_LIST2(a,b) (ARG_1(a)|ARG_2(b)) -#define ARGP_LIST3(a,b,c) (ARG_1(a)|ARG_2(b)|ARG_3(c)) -#define ARGP_LIST4(a,b,c,d) (ARG_1(a)|ARG_2(b)|ARG_3(c)|ARG_4(d)) -#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) - - -/* - * Reporting macros that are never compiled out - */ - -/* - * Error reporting. These versions add callers module and line#. Since - * _THIS_MODULE gets compiled out when ACPI_DEBUG isn't defined, only - * use it in debug mode. - */ - -#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_SUCCESS(a) _report_success(_THIS_MODULE,__LINE__,_COMPONENT,a) - -#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_SUCCESS(a) _report_success("",__LINE__,_COMPONENT,a) - -#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) - -/* Buffer dump macros */ - -#define DUMP_BUFFER(a,b) acpi_cm_dump_buffer((char *)a,b,DB_BYTE_DISPLAY,_COMPONENT) - -/* - * Debug macros that are conditionally compiled - */ - -#ifdef ACPI_DEBUG - -#define MODULE_NAME(name) static char *_THIS_MODULE = name - -/* - * Function entry tracing. - * The first parameter should be the procedure name as a quoted string. This is declared - * as a local string ("_Proc_name) so that it can be also used by the function exit macros below. - */ - -#define FUNCTION_TRACE(a) char * _proc_name = a;\ - function_trace(_THIS_MODULE,__LINE__,_COMPONENT,a) -#define FUNCTION_TRACE_PTR(a,b) char * _proc_name = a;\ - function_trace_ptr(_THIS_MODULE,__LINE__,_COMPONENT,a,(void *)b) -#define FUNCTION_TRACE_U32(a,b) char * _proc_name = a;\ - function_trace_u32(_THIS_MODULE,__LINE__,_COMPONENT,a,(u32)b) -#define FUNCTION_TRACE_STR(a,b) char * _proc_name = a;\ - function_trace_str(_THIS_MODULE,__LINE__,_COMPONENT,a,(char *)b) -/* - * Function exit tracing. - * WARNING: These macros include a return statement. This is usually considered - * bad form, but having a separate exit macro is very ugly and difficult to maintain. - * One of the FUNCTION_TRACE macros above must be used in conjunction with these macros - * so that "_Proc_name" is defined. - */ -#define return_VOID {function_exit(_THIS_MODULE,__LINE__,_COMPONENT,_proc_name);return;} -#define return_ACPI_STATUS(s) {function_status_exit(_THIS_MODULE,__LINE__,_COMPONENT,_proc_name,s);return(s);} -#define return_VALUE(s) {function_value_exit(_THIS_MODULE,__LINE__,_COMPONENT,_proc_name,(NATIVE_UINT)s);return(s);} -#define return_PTR(s) {function_ptr_exit(_THIS_MODULE,__LINE__,_COMPONENT,_proc_name,(char *)s);return(s);} - - -/* Conditional execution */ - -#define DEBUG_EXEC(a) a; -#define NORMAL_EXEC(a) - -#define DEBUG_DEFINE(a) a; -#define DEBUG_ONLY_MEMBERS(a) a; - - -/* Stack and buffer dumping */ - -#define DUMP_STACK_ENTRY(a) acpi_aml_dump_operand(a) -#define DUMP_OPERANDS(a,b,c,d,e) acpi_aml_dump_operands(a,b,c,d,e,_THIS_MODULE,__LINE__) - - -#define DUMP_ENTRY(a,b) acpi_ns_dump_entry (a,b) -#define DUMP_TABLES(a,b) acpi_ns_dump_tables(a,b) -#define DUMP_PATHNAME(a,b,c,d) acpi_ns_dump_pathname(a,b,c,d) -#define BREAK_MSG(a) acpi_os_breakpoint (a) - -/* - * Generate INT3 on ACPI_ERROR (Debug only!) - */ - -#define ERROR_BREAK -#ifdef ERROR_BREAK -#define BREAK_ON_ERROR(lvl) if ((lvl)&ACPI_ERROR) acpi_os_breakpoint("Fatal error encountered\n") -#else -#define BREAK_ON_ERROR(lvl) -#endif - -/* - * Master debug print macros - * Print iff: - * 1) Debug print for the current component is enabled - * 2) Debug error level or trace level for the print statement is enabled - * - */ - -#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_prefix (_THIS_MODULE,__LINE__);\ - debug_print_raw PARAM_LIST(fp);\ - BREAK_ON_ERROR(lvl);} - -#define DEBUG_PRINT_RAW(lvl,fp) TEST_DEBUG_SWITCH(lvl) {\ - debug_print_raw PARAM_LIST(fp);} - - -/* Assert macros */ - -#define ACPI_ASSERT(exp) if(!(exp)) \ - acpi_os_dbg_assert(#exp, __FILE__, __LINE__, "Failed Assertion") - -#define DEBUG_ASSERT(msg, exp) if(!(exp)) \ - acpi_os_dbg_assert(#exp, __FILE__, __LINE__, msg) - - -#else -/* - * This is the non-debug case -- make everything go away, - * leaving no executable debug code! - */ - -#define MODULE_NAME(name) -#define _THIS_MODULE "" - -#define DEBUG_EXEC(a) -#define NORMAL_EXEC(a) a; - -#define DEBUG_DEFINE(a) -#define DEBUG_ONLY_MEMBERS(a) -#define FUNCTION_TRACE(a) -#define FUNCTION_TRACE_PTR(a,b) -#define FUNCTION_TRACE_U32(a,b) -#define FUNCTION_TRACE_STR(a,b) -#define FUNCTION_EXIT -#define FUNCTION_STATUS_EXIT(s) -#define FUNCTION_VALUE_EXIT(s) -#define DUMP_STACK_ENTRY(a) -#define DUMP_OPERANDS(a,b,c,d,e) -#define DUMP_ENTRY(a,b) -#define DUMP_TABLES(a,b) -#define DUMP_PATHNAME(a,b,c,d) -#define DEBUG_PRINT(l,f) -#define DEBUG_PRINT_RAW(l,f) -#define BREAK_MSG(a) - -#define return_VOID return -#define return_ACPI_STATUS(s) return(s) -#define return_VALUE(s) return(s) -#define return_PTR(s) return(s) - -#define ACPI_ASSERT(exp) -#define DEBUG_ASSERT(msg, exp) - -#endif - - -/* - * For 16-bit code, we want to shrink some things even though - * we are using ACPI_DEBUG to get the debug output - */ -#ifdef _IA16 -#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} -#endif - - -#ifndef ACPI_DEBUG - -#define ADD_OBJECT_NAME(a,b) - -#else - - -/* - * 1) Set name to blanks - * 2) Copy the object name - */ - -#define ADD_OBJECT_NAME(a,b) MEMSET (a->common.name, ' ', sizeof (a->common.name));\ - STRNCPY (a->common.name, acpi_gbl_ns_type_names[b], sizeof (a->common.name)) - -#endif - - -#endif /* MACROS_H */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/include/namesp.h linux/drivers/acpi/include/namesp.h --- v2.4.0-test8/linux/drivers/acpi/include/namesp.h Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/include/namesp.h Wed Dec 31 16:00:00 1969 @@ -1,424 +0,0 @@ - -/****************************************************************************** - * - * Name: namesp.h - Namespace subcomponent prototypes and defines - * - *****************************************************************************/ - -/* - * 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 __NAMESPACE_H__ -#define __NAMESPACE_H__ - -#include "actables.h" - - -/* To search the entire name space, pass this as Search_base */ - -#define NS_ALL ((ACPI_HANDLE)0) - -/* - * Elements of Acpi_ns_properties are bit significant - * and should be one-to-one with values of ACPI_OBJECT_TYPE - */ -#define NSP_NORMAL 0 -#define NSP_NEWSCOPE 1 /* a definition of this type opens a name scope */ -#define NSP_LOCAL 2 /* suppress search of enclosing scopes */ - - -/* Definitions of the predefined namespace names */ - -#define ACPI_UNKNOWN_NAME (u32) 0x3F3F3F3F /* Unknown name is "????" */ -#define ACPI_ROOT_NAME (u32) 0x2F202020 /* Root name is "/ " */ -#define ACPI_SYS_BUS_NAME (u32) 0x5F53425F /* Sys bus name is "_SB_" */ - -#define NS_ROOT_PATH "/" -#define NS_SYSTEM_BUS "_SB_" - - -/* Flags for Acpi_ns_lookup, Acpi_ns_search_and_enter */ - -#define NS_NO_UPSEARCH 0 -#define NS_SEARCH_PARENT 0x01 -#define NS_DONT_OPEN_SCOPE 0x02 -#define NS_NO_PEER_SEARCH 0x04 - -#define NS_WALK_UNLOCK TRUE -#define NS_WALK_NO_UNLOCK FALSE - - -ACPI_STATUS -acpi_ns_walk_namespace ( - OBJECT_TYPE_INTERNAL type, - ACPI_HANDLE start_object, - u32 max_depth, - u8 unlock_before_callback, - WALK_CALLBACK user_function, - void *context, - void **return_value); - - -ACPI_NAMED_OBJECT* -acpi_ns_get_next_object ( - OBJECT_TYPE_INTERNAL type, - ACPI_NAMED_OBJECT *parent, - ACPI_NAMED_OBJECT *child); - - -ACPI_STATUS -acpi_ns_delete_namespace_by_owner ( - u16 table_id); - -void -acpi_ns_free_table_entry ( - ACPI_NAMED_OBJECT *entry); - - -/* Namespace loading - nsload */ - -ACPI_STATUS -acpi_ns_parse_table ( - ACPI_TABLE_DESC *table_desc, - ACPI_NAME_TABLE *scope); - -ACPI_STATUS -acpi_ns_load_table ( - ACPI_TABLE_DESC *table_desc, - ACPI_NAMED_OBJECT *entry); - -ACPI_STATUS -acpi_ns_load_table_by_type ( - ACPI_TABLE_TYPE table_type); - - -/* - * Top-level namespace access - nsaccess - */ - - -ACPI_STATUS -acpi_ns_root_initialize ( - void); - -ACPI_STATUS -acpi_ns_lookup ( - ACPI_GENERIC_STATE *scope_info, - char *name, - OBJECT_TYPE_INTERNAL type, - OPERATING_MODE interpreter_mode, - u32 flags, - ACPI_WALK_STATE *walk_state, - ACPI_NAMED_OBJECT **ret_entry); - - -/* - * Table allocation/deallocation - nsalloc - */ - -ACPI_NAME_TABLE * -acpi_ns_allocate_name_table ( - u32 num_entries); - -ACPI_STATUS -acpi_ns_delete_namespace_subtree ( - ACPI_NAMED_OBJECT *parent_handle); - -void -acpi_ns_detach_object ( - ACPI_HANDLE object); - -void -acpi_ns_delete_name_table ( - ACPI_NAME_TABLE *name_table); - - -/* - * Namespace modification - nsmodify - */ - -ACPI_STATUS -acpi_ns_unload_namespace ( - ACPI_HANDLE handle); - -ACPI_STATUS -acpi_ns_delete_subtree ( - ACPI_HANDLE start_handle); - - -/* - * Namespace dump/print utilities - nsdump - */ - -void -acpi_ns_dump_tables ( - ACPI_HANDLE search_base, - s32 max_depth); - -void -acpi_ns_dump_entry ( - ACPI_HANDLE handle, - u32 debug_level); - -ACPI_STATUS -acpi_ns_dump_pathname ( - ACPI_HANDLE handle, - char *msg, - u32 level, - u32 component); - -void -acpi_ns_dump_root_devices ( - void); - -void -acpi_ns_dump_objects ( - OBJECT_TYPE_INTERNAL type, - u32 max_depth, - u32 ownder_id, - ACPI_HANDLE start_handle); - - -/* - * Namespace evaluation functions - nseval - */ - -ACPI_STATUS -acpi_ns_evaluate_by_handle ( - ACPI_NAMED_OBJECT *object_nte, - ACPI_OBJECT_INTERNAL **params, - ACPI_OBJECT_INTERNAL **return_object); - -ACPI_STATUS -acpi_ns_evaluate_by_name ( - char *pathname, - ACPI_OBJECT_INTERNAL **params, - ACPI_OBJECT_INTERNAL **return_object); - -ACPI_STATUS -acpi_ns_evaluate_relative ( - ACPI_NAMED_OBJECT *object_nte, - char *pathname, - ACPI_OBJECT_INTERNAL **params, - ACPI_OBJECT_INTERNAL **return_object); - -ACPI_STATUS -acpi_ns_execute_control_method ( - ACPI_NAMED_OBJECT *method_entry, - ACPI_OBJECT_INTERNAL **params, - ACPI_OBJECT_INTERNAL **return_obj_desc); - -ACPI_STATUS -acpi_ns_get_object_value ( - ACPI_NAMED_OBJECT *object_entry, - ACPI_OBJECT_INTERNAL **return_obj_desc); - - -/* - * Parent/Child/Peer utility functions - nsfamily - */ - -ACPI_NAME -acpi_ns_find_parent_name ( - ACPI_NAMED_OBJECT *entry_to_search); - -u8 -acpi_ns_exist_downstream_sibling ( - ACPI_NAMED_OBJECT *this_entry); - - -/* - * Scope manipulation - nsscope - */ - -s32 -acpi_ns_opens_scope ( - OBJECT_TYPE_INTERNAL type); - -char * -acpi_ns_name_of_scope ( - ACPI_NAME_TABLE *scope); - -char * -acpi_ns_name_of_current_scope ( - ACPI_WALK_STATE *walk_state); - -ACPI_STATUS -acpi_ns_handle_to_pathname ( - ACPI_HANDLE obj_handle, - u32 *buf_size, - char *user_buffer); - -u8 -acpi_ns_pattern_match ( - ACPI_NAMED_OBJECT *obj_entry, - char *search_for); - -ACPI_STATUS -acpi_ns_name_compare ( - ACPI_HANDLE obj_handle, - u32 level, - void *context, - void **return_value); - -void -acpi_ns_low_find_names ( - ACPI_NAMED_OBJECT *this_entry, - char *search_for, - s32 *count, - ACPI_HANDLE list[], - s32 max_depth); - -ACPI_HANDLE * -acpi_ns_find_names ( - char *search_for, - ACPI_HANDLE search_base, - s32 max_depth); - -ACPI_STATUS -acpi_ns_get_named_object ( - char *pathname, - ACPI_NAME_TABLE *in_scope, - ACPI_NAMED_OBJECT **out_nte); - -/* - * Object management for NTEs - nsobject - */ - -ACPI_STATUS -acpi_ns_attach_method ( - ACPI_HANDLE obj_handle, - u8 *pcode_addr, - u32 pcode_length); - -ACPI_STATUS -acpi_ns_attach_object ( - ACPI_HANDLE obj_handle, - ACPI_HANDLE value, - OBJECT_TYPE_INTERNAL type); - - -void * -acpi_ns_compare_value ( - ACPI_HANDLE obj_handle, - u32 level, - void *obj_desc); - -ACPI_HANDLE -acpi_ns_find_attached_object ( - ACPI_OBJECT_INTERNAL *obj_desc, - ACPI_HANDLE search_base, - s32 max_depth); - - -/* - * Namespace searching and entry - nssearch - */ - -ACPI_STATUS -acpi_ns_search_and_enter ( - u32 entry_name, - ACPI_WALK_STATE *walk_state, - ACPI_NAME_TABLE *name_table, - OPERATING_MODE interpreter_mode, - OBJECT_TYPE_INTERNAL type, - u32 flags, - ACPI_NAMED_OBJECT **ret_entry); - -void -acpi_ns_initialize_table ( - ACPI_NAME_TABLE *new_table, - ACPI_NAME_TABLE *parent_scope, - ACPI_NAMED_OBJECT *parent_entry); - -ACPI_STATUS -acpi_ns_search_one_scope ( - u32 entry_name, - ACPI_NAME_TABLE *name_table, - OBJECT_TYPE_INTERNAL type, - ACPI_NAMED_OBJECT **ret_entry, - NS_SEARCH_DATA *ret_info); - - -/* - * Utility functions - nsutils - */ - -u8 -acpi_ns_valid_root_prefix ( - char prefix); - -u8 -acpi_ns_valid_path_separator ( - char sep); - -OBJECT_TYPE_INTERNAL -acpi_ns_get_type ( - ACPI_HANDLE obj_handle); - -void * -acpi_ns_get_attached_object ( - ACPI_HANDLE obj_handle); - -s32 -acpi_ns_local ( - OBJECT_TYPE_INTERNAL type); - -ACPI_STATUS -acpi_ns_internalize_name ( - char *dotted_name, - char **converted_name); - -ACPI_STATUS -acpi_ns_externalize_name ( - u32 internal_name_length, - char *internal_name, - u32 *converted_name_length, - char **converted_name); - -s32 -is_ns_object ( - ACPI_OBJECT_INTERNAL *p_oD); - -s32 -acpi_ns_mark_nS( - void); - -ACPI_NAMED_OBJECT* -acpi_ns_convert_handle_to_entry ( - ACPI_HANDLE handle); - -ACPI_HANDLE -acpi_ns_convert_entry_to_handle( - ACPI_NAMED_OBJECT*nte); - -void -acpi_ns_terminate ( - void); - -ACPI_NAMED_OBJECT * -acpi_ns_get_parent_entry ( - ACPI_NAMED_OBJECT *this_entry); - - -ACPI_NAMED_OBJECT * -acpi_ns_get_next_valid_entry ( - ACPI_NAMED_OBJECT *this_entry); - - -#endif /* __NAMESPACE_H__ */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/include/output.h linux/drivers/acpi/include/output.h --- v2.4.0-test8/linux/drivers/acpi/include/output.h Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/include/output.h Wed Dec 31 16:00:00 1969 @@ -1,124 +0,0 @@ - -/****************************************************************************** - * - * Name: output.h -- debug output - * - *****************************************************************************/ - -/* - * 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 _OUTPUT_H -#define _OUTPUT_H - -/* - * Debug levels and component IDs. These are used to control the - * granularity of the output of the DEBUG_PRINT macro -- on a per- - * component basis and a per-exception-type basis. - */ - -/* Component IDs -- used in the global "Debug_layer" */ - -#define GLOBAL 0x00000001 -#define COMMON 0x00000002 -#define PARSER 0x00000004 -#define DISPATCHER 0x00000008 -#define INTERPRETER 0x00000010 -#define NAMESPACE 0x00000020 -#define RESOURCE_MANAGER 0x00000040 -#define TABLE_MANAGER 0x00000080 -#define EVENT_HANDLING 0x00000100 -#define HARDWARE 0x00000200 -#define MISCELLANEOUS 0x00000400 -#define OS_DEPENDENT 0x00000800 - -#define BUS_MANAGER 0x00001000 - -#define PROCESSOR_CONTROL 0x00002000 -#define SYSTEM_CONTROL 0x00004000 -#define THERMAL_CONTROL 0x00008000 -#define POWER_CONTROL 0x00010000 - -#define EMBEDDED_CONTROLLER 0x00020000 -#define BATTERY 0x00040000 - -#define DEBUGGER 0x00100000 -#define ALL_COMPONENTS 0x001FFFFF - - -/* Exception level -- used in the global "Debug_level" */ - -#define ACPI_OK 0x00000001 -#define ACPI_INFO 0x00000002 -#define ACPI_WARN 0x00000004 -#define ACPI_ERROR 0x00000008 -#define ACPI_FATAL 0x00000010 -#define ACPI_DEBUG_OBJECT 0x00000020 -#define ACPI_ALL 0x0000003F - - -/* Trace level -- also used in the global "Debug_level" */ - -#define TRACE_PARSE 0x00000100 -#define TRACE_DISPATCH 0x00000200 -#define TRACE_LOAD 0x00000400 -#define TRACE_EXEC 0x00000800 -#define TRACE_NAMES 0x00001000 -#define TRACE_OPREGION 0x00002000 -#define TRACE_BFIELD 0x00004000 -#define TRACE_TRASH 0x00008000 -#define TRACE_TABLES 0x00010000 -#define TRACE_FUNCTIONS 0x00020000 -#define TRACE_VALUES 0x00040000 -#define TRACE_OBJECTS 0x00080000 -#define TRACE_ALLOCATIONS 0x00100000 -#define TRACE_RESOURCES 0x00200000 -#define TRACE_IO 0x00400000 -#define TRACE_INTERRUPTS 0x00800000 -#define TRACE_USER_REQUESTS 0x01000000 -#define TRACE_PACKAGE 0x02000000 -#define TRACE_MUTEX 0x04000000 - -#define TRACE_ALL 0x0FFFFF00 - - -/* Exceptionally verbose output -- also used in the global "Debug_level" */ - -#define VERBOSE_AML_DISASSEMBLE 0x10000000 -#define VERBOSE_INFO 0x20000000 -#define VERBOSE_TABLES 0x40000000 -#define VERBOSE_EVENTS 0x80000000 - -#define VERBOSE_ALL 0x70000000 - - -/* Defaults for Debug_level, debug and normal */ - -#define DEBUG_DEFAULT (ACPI_OK | ACPI_WARN | ACPI_ERROR | ACPI_DEBUG_OBJECT | TRACE_TABLES | TRACE_IO) -#define NORMAL_DEFAULT (ACPI_OK | ACPI_WARN | ACPI_ERROR | ACPI_DEBUG_OBJECT) -#define DEBUG_ALL (VERBOSE_AML_DISASSEMBLE | TRACE_ALL | ACPI_ALL) - -/* Misc defines */ - -#define HEX 0x01 -#define ASCII 0x02 -#define FULL_ADDRESS 0x04 -#define CHARS_PER_LINE 16 /* used in Dump_buf function */ - - -#endif /* _OUTPUT_H */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/include/parser.h linux/drivers/acpi/include/parser.h --- v2.4.0-test8/linux/drivers/acpi/include/parser.h Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/include/parser.h Wed Dec 31 16:00:00 1969 @@ -1,327 +0,0 @@ -/****************************************************************************** - * - * Module Name: parser.h - AML Parser subcomponent prototypes and defines - * - *****************************************************************************/ - -/* - * 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 _PARSER_H_ -#define _PARSER_H_ - - -#define OP_HAS_RETURN_VALUE 1 - -/* variable # arguments */ - -#define ACPI_VAR_ARGS ACPI_UINT32_MAX - -/* maximum virtual address */ - -#define ACPI_MAX_AML ((u8 *)(~0UL)) - - -#define PARSE_DELETE_TREE 1 - - -/* psapi - Parser external interfaces */ - -ACPI_STATUS -acpi_psx_load_table ( - u8 *pcode_addr, - s32 pcode_length); - -ACPI_STATUS -acpi_psx_execute ( - ACPI_NAMED_OBJECT *method_entry, - ACPI_OBJECT_INTERNAL **params, - ACPI_OBJECT_INTERNAL **return_obj_desc); - - -u8 -acpi_ps_is_namespace_object_op ( - u16 opcode); -u8 -acpi_ps_is_namespace_op ( - u16 opcode); - - -/****************************************************************************** - * - * Parser interfaces - * - *****************************************************************************/ - - -/* psargs - Parse AML opcode arguments */ - -u8 * -acpi_ps_get_next_package_end ( - ACPI_PARSE_STATE *parser_state); - -char * -acpi_ps_get_next_namestring ( - ACPI_PARSE_STATE *parser_state); - -void -acpi_ps_get_next_simple_arg ( - ACPI_PARSE_STATE *parser_state, - s32 arg_type, /* type of argument */ - ACPI_GENERIC_OP *arg); /* (OUT) argument data */ - -void -acpi_ps_get_next_namepath ( - ACPI_PARSE_STATE *parser_state, - ACPI_GENERIC_OP *arg, - u32 *arg_count, - u8 method_call); - -ACPI_GENERIC_OP * -acpi_ps_get_next_field ( - ACPI_PARSE_STATE *parser_state); - -ACPI_GENERIC_OP * -acpi_ps_get_next_arg ( - ACPI_PARSE_STATE *parser_state, - s32 arg_type, - u32 *arg_count); - - -/* psopcode - AML Opcode information */ - -ACPI_OP_INFO * -acpi_ps_get_opcode_info ( - u16 opcode); - -char * -acpi_ps_get_opcode_name ( - u16 opcode); - - -/* psparse - top level parsing routines */ - -void -acpi_ps_delete_parse_tree ( - ACPI_GENERIC_OP *root); - -ACPI_STATUS -acpi_ps_parse_loop ( - ACPI_PARSE_STATE *parser_state, - ACPI_WALK_STATE *walk_state, - u32 parse_flags); - - -ACPI_STATUS -acpi_ps_parse_aml ( - ACPI_GENERIC_OP *start_scope, - u8 *aml, - u32 acpi_aml_size, - u32 parse_flags); - -ACPI_STATUS -acpi_ps_parse_table ( - u8 *aml, - s32 aml_size, - INTERPRETER_CALLBACK descending_callback, - INTERPRETER_CALLBACK ascending_callback, - ACPI_GENERIC_OP **root_object); - -u16 -acpi_ps_peek_opcode ( - ACPI_PARSE_STATE *state); - - -/* psscope - Scope stack management routines */ - - -ACPI_STATUS -acpi_ps_init_scope ( - ACPI_PARSE_STATE *parser_state, - ACPI_GENERIC_OP *root); - -ACPI_GENERIC_OP * -acpi_ps_get_parent_scope ( - ACPI_PARSE_STATE *state); - -u8 -acpi_ps_has_completed_scope ( - ACPI_PARSE_STATE *parser_state); - -void -acpi_ps_pop_scope ( - ACPI_PARSE_STATE *parser_state, - ACPI_GENERIC_OP **op, - u32 *arg_list); - -ACPI_STATUS -acpi_ps_push_scope ( - ACPI_PARSE_STATE *parser_state, - ACPI_GENERIC_OP *op, - u32 remaining_args, - u32 arg_count); - -void -acpi_ps_cleanup_scope ( - ACPI_PARSE_STATE *state); - - -/* pstree - parse tree manipulation routines */ - -void -acpi_ps_append_arg( - ACPI_GENERIC_OP *op, - ACPI_GENERIC_OP *arg); - -ACPI_GENERIC_OP* -acpi_ps_find ( - ACPI_GENERIC_OP *scope, - char *path, - u16 opcode, - u32 create); - -ACPI_GENERIC_OP * -acpi_ps_get_arg( - ACPI_GENERIC_OP *op, - u32 argn); - -ACPI_GENERIC_OP * -acpi_ps_get_child ( - ACPI_GENERIC_OP *op); - -ACPI_GENERIC_OP * -acpi_ps_get_depth_next ( - ACPI_GENERIC_OP *origin, - ACPI_GENERIC_OP *op); - - -/* pswalk - parse tree walk routines */ - -ACPI_STATUS -acpi_ps_walk_parsed_aml ( - ACPI_GENERIC_OP *start_op, - ACPI_GENERIC_OP *end_op, - ACPI_OBJECT_INTERNAL *mth_desc, - ACPI_NAME_TABLE *start_scope, - ACPI_OBJECT_INTERNAL **params, - ACPI_OBJECT_INTERNAL **caller_return_desc, - ACPI_OWNER_ID owner_id, - INTERPRETER_CALLBACK descending_callback, - INTERPRETER_CALLBACK ascending_callback); - -ACPI_STATUS -acpi_ps_get_next_walk_op ( - ACPI_WALK_STATE *walk_state, - ACPI_GENERIC_OP *op, - INTERPRETER_CALLBACK ascending_callback); - - -/* psutils - parser utilities */ - -void -acpi_ps_init_op ( - ACPI_GENERIC_OP *op, - u16 opcode); - -ACPI_GENERIC_OP * -acpi_ps_alloc_op ( - u16 opcode); - -void -acpi_ps_free_op ( - ACPI_GENERIC_OP *op); - -void -acpi_ps_delete_parse_cache ( - void); - -u8 -acpi_ps_is_leading_char ( - s32 c); - -u8 -acpi_ps_is_prefix_char ( - s32 c); - -u8 -acpi_ps_is_named_op ( - u16 opcode); - -u8 -acpi_ps_is_named_object_op ( - u16 opcode); - -u8 -acpi_ps_is_deferred_op ( - u16 opcode); - -u8 -acpi_ps_is_bytelist_op( - u16 opcode); - -u8 -acpi_ps_is_field_op( - u16 opcode); - -u8 -acpi_ps_is_create_field_op ( - u16 opcode); - -ACPI_NAMED_OP* -acpi_ps_to_named_op( - ACPI_GENERIC_OP *op); - -ACPI_DEFERRED_OP * -acpi_ps_to_deferred_op ( - ACPI_GENERIC_OP *op); - -ACPI_BYTELIST_OP* -acpi_ps_to_bytelist_op( - ACPI_GENERIC_OP *op); - -u32 -acpi_ps_get_name( - ACPI_GENERIC_OP *op); - -void -acpi_ps_set_name( - ACPI_GENERIC_OP *op, - u32 name); - - -/* psdump - display parser tree */ - -s32 -acpi_ps_sprint_path ( - char *buffer_start, - u32 buffer_size, - ACPI_GENERIC_OP *op); - -s32 -acpi_ps_sprint_op ( - char *buffer_start, - u32 buffer_size, - ACPI_GENERIC_OP *op); - -void -acpi_ps_show ( - ACPI_GENERIC_OP *op); - - -#endif /* _PARSER_H_ */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/include/resource.h linux/drivers/acpi/include/resource.h --- v2.4.0-test8/linux/drivers/acpi/include/resource.h Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/include/resource.h Wed Dec 31 16:00:00 1969 @@ -1,300 +0,0 @@ -/****************************************************************************** - * - * Name: resource.h - Resource Manager function prototypes - * - *****************************************************************************/ - -/* - * 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 __RESOURCE_H__ -#define __RESOURCE_H__ - -#include "actypes.h" -#include "acobject.h" - -/* - * Function prototypes called from Acpi* APIs - */ - -ACPI_STATUS -acpi_rs_get_prt_method_data ( - ACPI_HANDLE handle, - ACPI_BUFFER *ret_buffer); - - -ACPI_STATUS -acpi_rs_get_crs_method_data ( - ACPI_HANDLE handle, - ACPI_BUFFER *ret_buffer); - -ACPI_STATUS -acpi_rs_get_prs_method_data ( - ACPI_HANDLE handle, - ACPI_BUFFER *ret_buffer); - -ACPI_STATUS -acpi_rs_set_srs_method_data ( - ACPI_HANDLE handle, - ACPI_BUFFER *ret_buffer); - -ACPI_STATUS -acpi_rs_create_resource_list ( - ACPI_OBJECT_INTERNAL *byte_stream_buffer, - u8 *output_buffer, - u32 *output_buffer_length); - -ACPI_STATUS -acpi_rs_create_byte_stream ( - RESOURCE *linked_list_buffer, - u8 *output_buffer, - u32 *output_buffer_length); - -ACPI_STATUS -acpi_rs_create_pci_routing_table ( - ACPI_OBJECT_INTERNAL *method_return_object, - u8 *output_buffer, - u32 *output_buffer_length); - - -/* - *Function prototypes called from Acpi_rs_create*APIs - */ - -void -acpi_rs_dump_resource_list ( - RESOURCE *resource); - -void -acpi_rs_dump_irq_list ( - u8 *route_table); - -ACPI_STATUS -acpi_rs_get_byte_stream_start ( - u8 *byte_stream_buffer, - u8 **byte_stream_start, - u32 *size); - -ACPI_STATUS -acpi_rs_calculate_list_length ( - u8 *byte_stream_buffer, - u32 byte_stream_buffer_length, - u32 *size_needed); - -ACPI_STATUS -acpi_rs_calculate_byte_stream_length ( - RESOURCE *linked_list_buffer, - u32 *size_needed); - -ACPI_STATUS -acpi_rs_byte_stream_to_list ( - u8 *byte_stream_buffer, - u32 byte_stream_buffer_length, - u8 **output_buffer); - -ACPI_STATUS -acpi_rs_list_to_byte_stream ( - RESOURCE *linked_list, - u32 byte_stream_size_needed, - u8 **output_buffer); - -ACPI_STATUS -acpi_rs_io_resource ( - u8 *byte_stream_buffer, - u32 *bytes_consumed, - u8 **output_buffer, - u32 *structure_size); - -ACPI_STATUS -acpi_rs_fixed_io_resource ( - u8 *byte_stream_buffer, - u32 *bytes_consumed, - u8 **output_buffer, - u32 *structure_size); - -ACPI_STATUS -acpi_rs_io_stream ( - RESOURCE *linked_list, - u8 **output_buffer, - u32 *bytes_consumed); - -ACPI_STATUS -acpi_rs_fixed_io_stream ( - RESOURCE *linked_list, - u8 **output_buffer, - u32 *bytes_consumed); - -ACPI_STATUS -acpi_rs_irq_resource ( - u8 *byte_stream_buffer, - u32 *bytes_consumed, - u8 **output_buffer, - u32 *structure_size); - -ACPI_STATUS -acpi_rs_irq_stream ( - RESOURCE *linked_list, - u8 **output_buffer, - u32 *bytes_consumed); - -ACPI_STATUS -acpi_rs_dma_resource ( - u8 *byte_stream_buffer, - u32 *bytes_consumed, - u8 **output_buffer, - u32 *structure_size); - -ACPI_STATUS -acpi_rs_dma_stream ( - RESOURCE *linked_list, - u8 **output_buffer, - u32 *bytes_consumed); - -ACPI_STATUS -acpi_rs_address16_resource ( - u8 *byte_stream_buffer, - u32 *bytes_consumed, - u8 **output_buffer, - u32 *structure_size); - -ACPI_STATUS -acpi_rs_address16_stream ( - RESOURCE *linked_list, - u8 **output_buffer, - u32 *bytes_consumed); - -ACPI_STATUS -acpi_rs_address32_resource ( - u8 *byte_stream_buffer, - u32 *bytes_consumed, - u8 **output_buffer, - u32 *structure_size); - -ACPI_STATUS -acpi_rs_address32_stream ( - RESOURCE *linked_list, - u8 **output_buffer, - u32 *bytes_consumed); - -ACPI_STATUS -acpi_rs_start_dependent_functions_resource ( - u8 *byte_stream_buffer, - u32 *bytes_consumed, - u8 **output_buffer, - u32 *structure_size); - -ACPI_STATUS -acpi_rs_end_dependent_functions_resource ( - u8 *byte_stream_buffer, - u32 *bytes_consumed, - u8 **output_buffer, - u32 *structure_size); - -ACPI_STATUS -acpi_rs_start_dependent_functions_stream ( - RESOURCE *linked_list, - u8 **output_buffer, - u32 *bytes_consumed); - -ACPI_STATUS -acpi_rs_end_dependent_functions_stream ( - RESOURCE *linked_list, - u8 **output_buffer, - u32 *bytes_consumed); - -ACPI_STATUS -acpi_rs_memory24_resource ( - u8 *byte_stream_buffer, - u32 *bytes_consumed, - u8 **output_buffer, - u32 *structure_size); - -ACPI_STATUS -acpi_rs_memory24_stream ( - RESOURCE *linked_list, - u8 **output_buffer, - u32 *bytes_consumed); - -ACPI_STATUS -acpi_rs_memory32_range_resource ( - u8 *byte_stream_buffer, - u32 *bytes_consumed, - u8 **output_buffer, - u32 *structure_size -); - -ACPI_STATUS -acpi_rs_fixed_memory32_resource ( - u8 *byte_stream_buffer, - u32 *bytes_consumed, - u8 **output_buffer, - u32 *structure_size); - -ACPI_STATUS -acpi_rs_memory32_range_stream ( - RESOURCE *linked_list, - u8 **output_buffer, - u32 *bytes_consumed); - -ACPI_STATUS -acpi_rs_fixed_memory32_stream ( - RESOURCE *linked_list, - u8 **output_buffer, - u32 *bytes_consumed); - -ACPI_STATUS -acpi_rs_extended_irq_resource ( - u8 *byte_stream_buffer, - u32 *bytes_consumed, - u8 **output_buffer, - u32 *structure_size); - -ACPI_STATUS -acpi_rs_extended_irq_stream ( - RESOURCE *linked_list, - u8 **output_buffer, - u32 *bytes_consumed); - -ACPI_STATUS -acpi_rs_end_tag_resource ( - u8 *byte_stream_buffer, - u32 *bytes_consumed, - u8 **output_buffer, - u32 *structure_size); - -ACPI_STATUS -acpi_rs_end_tag_stream ( - RESOURCE *linked_list, - u8 **output_buffer, - u32 *bytes_consumed); - -ACPI_STATUS -acpi_rs_vendor_resource ( - u8 *byte_stream_buffer, - u32 *bytes_consumed, - u8 **output_buffer, - u32 *structure_size); - -ACPI_STATUS -acpi_rs_vendor_stream ( - RESOURCE *linked_list, - u8 **output_buffer, - u32 *bytes_consumed); - - -#endif /*__RESOURCE_H__ */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/include/tables.h linux/drivers/acpi/include/tables.h --- v2.4.0-test8/linux/drivers/acpi/include/tables.h Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/include/tables.h Wed Dec 31 16:00:00 1969 @@ -1,168 +0,0 @@ - -/****************************************************************************** - * - * Name: tables.h - ACPI table management - * - *****************************************************************************/ - -/* - * 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 __TABLES_H__ -#define __TABLES_H__ - -#include "actypes.h" -#include "actables.h" - - -/* Used in Acpi_tb_map_acpi_table for size parameter if table header is to be used */ - -#define SIZE_IN_HEADER 0 - - -ACPI_STATUS -acpi_tb_handle_to_object ( - u16 table_id, - ACPI_TABLE_DESC **table_desc); - - -/* - * Acpi_tbfac - FACP, FACS utilities - */ - -ACPI_STATUS -acpi_tb_get_table_facs ( - char *buffer_ptr, - ACPI_TABLE_DESC *table_info); - - -/* - * Acpi_tbget - Table "get" routines - */ - -ACPI_STATUS -acpi_tb_get_table_ptr ( - ACPI_TABLE_TYPE table_type, - u32 instance, - ACPI_TABLE_HEADER **table_ptr_loc); - -ACPI_STATUS -acpi_tb_get_table ( - void *physical_address, - char *buffer_ptr, - ACPI_TABLE_DESC *table_info); - - -/* - * Acpi_tbgetall - Get all firmware ACPI tables - */ - -ACPI_STATUS -acpi_tb_get_all_tables ( - u32 number_of_tables, - char *buffer_ptr); - - -/* - * Acpi_tbinstall - Table installation - */ - -ACPI_STATUS -acpi_tb_install_table ( - char *table_ptr, - ACPI_TABLE_DESC *table_info); - -ACPI_STATUS -acpi_tb_recognize_table ( - char *table_ptr, - ACPI_TABLE_DESC *table_info); - -ACPI_STATUS -acpi_tb_init_table_descriptor ( - ACPI_TABLE_TYPE table_type, - ACPI_TABLE_DESC *table_info); - - -/* - * Acpi_tbremove - Table removal and deletion - */ - -void -acpi_tb_delete_acpi_tables ( - void); - -void -acpi_tb_delete_acpi_table ( - ACPI_TABLE_TYPE type); - -ACPI_TABLE_DESC * -acpi_tb_delete_single_table ( - ACPI_TABLE_DESC *table_desc); - -void -acpi_tb_free_acpi_tables_of_type ( - ACPI_TABLE_DESC *table_info); - - -/* - * Acpi_tbrsd - RSDP, RSDT utilities - */ - -ACPI_STATUS -acpi_tb_get_table_rsdt ( - u32 *number_of_tables); - -char * -acpi_tb_scan_memory_for_rsdp ( - char *start_address, - u32 length); - -ACPI_STATUS -acpi_tb_find_rsdp ( - ACPI_TABLE_DESC *table_info); - - -/* - * Acpi_tbutils - common table utilities - */ - -u8 -acpi_tb_system_table_pointer ( - void *where); - -ACPI_STATUS -acpi_tb_map_acpi_table ( - void *physical_address, - u32 *size, - void **logical_address); - -ACPI_STATUS -acpi_tb_verify_table_checksum ( - ACPI_TABLE_HEADER *table_header); - -u8 -acpi_tb_checksum ( - void *buffer, - u32 length); - -ACPI_STATUS -acpi_tb_validate_table_header ( - ACPI_TABLE_HEADER *table_header); - - -#endif /* __TABLES_H__ */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/interpreter/Makefile linux/drivers/acpi/interpreter/Makefile --- v2.4.0-test8/linux/drivers/acpi/interpreter/Makefile Wed Dec 31 16:00:00 1969 +++ linux/drivers/acpi/interpreter/Makefile Fri Sep 15 18:21:44 2000 @@ -0,0 +1,28 @@ +# +# 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)) + +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: + $(RM) *.o diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/interpreter/amconfig.c linux/drivers/acpi/interpreter/amconfig.c --- v2.4.0-test8/linux/drivers/acpi/interpreter/amconfig.c Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/interpreter/amconfig.c Fri Sep 15 14:30:30 2000 @@ -1,7 +1,7 @@ - /****************************************************************************** * * Module Name: amconfig - Namespace reconfiguration (Load/Unload opcodes) + * $Revision: 23 $ * *****************************************************************************/ @@ -25,17 +25,17 @@ #include "acpi.h" -#include "parser.h" -#include "interp.h" +#include "acparser.h" +#include "acinterp.h" #include "amlcode.h" -#include "namesp.h" -#include "events.h" -#include "tables.h" -#include "dispatch.h" +#include "acnamesp.h" +#include "acevents.h" +#include "actables.h" +#include "acdispat.h" #define _COMPONENT INTERPRETER - MODULE_NAME ("amconfig"); + MODULE_NAME ("amconfig") /***************************************************************************** @@ -53,13 +53,13 @@ ACPI_STATUS acpi_aml_exec_load_table ( - ACPI_OBJECT_INTERNAL *rgn_desc, + ACPI_OPERAND_OBJECT *rgn_desc, ACPI_HANDLE *ddb_handle) { ACPI_STATUS status; - ACPI_OBJECT_INTERNAL *table_desc = NULL; - char *table_ptr; - char *table_data_ptr; + ACPI_OPERAND_OBJECT *table_desc = NULL; + u8 *table_ptr; + u8 *table_data_ptr; ACPI_TABLE_HEADER table_header; ACPI_TABLE_DESC table_info; u32 i; @@ -73,7 +73,7 @@ table_header.length = 0; for (i = 0; i < sizeof (ACPI_TABLE_HEADER); i++) { status = acpi_ev_address_space_dispatch (rgn_desc, ADDRESS_SPACE_READ, - i, 8, (u32 *) ((char *) &table_header + i)); + i, 8, (u32 *) ((u8 *) &table_header + i)); if (ACPI_FAILURE (status)) { return (status); } @@ -184,16 +184,19 @@ ACPI_HANDLE ddb_handle) { ACPI_STATUS status = AE_NOT_IMPLEMENTED; - ACPI_OBJECT_INTERNAL *table_desc = (ACPI_OBJECT_INTERNAL *) ddb_handle; + ACPI_OPERAND_OBJECT *table_desc = (ACPI_OPERAND_OBJECT *) ddb_handle; ACPI_TABLE_DESC *table_info; /* Validate the handle */ - /* TBD: [Errors] Wasn't this done earlier? */ + /* Although the handle is partially validated in Acpi_aml_exec_reconfiguration(), + * when it calls Acpi_aml_resolve_operands(), the handle is more completely + * validated here. + */ if ((!ddb_handle) || (!VALID_DESCRIPTOR_TYPE (ddb_handle, ACPI_DESC_TYPE_INTERNAL)) || - (((ACPI_OBJECT_INTERNAL *)ddb_handle)->common.type != + (((ACPI_OPERAND_OBJECT *)ddb_handle)->common.type != INTERNAL_TYPE_REFERENCE)) { return (AE_BAD_PARAMETER); @@ -205,7 +208,7 @@ table_info = (ACPI_TABLE_DESC *) table_desc->reference.object; /* - * Delete the entire namespace under this table NTE + * Delete the entire namespace under this table Node * (Offset contains the Table_id) */ @@ -245,16 +248,16 @@ ACPI_WALK_STATE *walk_state) { ACPI_STATUS status; - ACPI_OBJECT_INTERNAL *region_desc = NULL; + ACPI_OPERAND_OBJECT *region_desc = NULL; ACPI_HANDLE *ddb_handle; /* Resolve the operands */ - status = acpi_aml_resolve_operands (opcode, WALK_OPERANDS); + status = acpi_aml_resolve_operands (opcode, WALK_OPERANDS, walk_state); /* Get the table handle, common for both opcodes */ - status |= acpi_ds_obj_stack_pop_object ((ACPI_OBJECT_INTERNAL **) &ddb_handle, + status |= acpi_ds_obj_stack_pop_object ((ACPI_OPERAND_OBJECT **) &ddb_handle, walk_state); switch (opcode) @@ -265,22 +268,19 @@ /* Get the region or field descriptor */ status |= acpi_ds_obj_stack_pop_object (®ion_desc, walk_state); - if (status != AE_OK) { - acpi_aml_append_operand_diag (_THIS_MODULE, __LINE__, opcode, - WALK_OPERANDS, 2); - goto cleanup2; + if (ACPI_FAILURE (status)) { + acpi_cm_remove_reference (region_desc); + return (status); } status = acpi_aml_exec_load_table (region_desc, ddb_handle); break; - case AML_UN_LOAD_OP: + case AML_UNLOAD_OP: - if (status != AE_OK) { - acpi_aml_append_operand_diag (_THIS_MODULE, __LINE__, opcode, - WALK_OPERANDS, 1); - goto cleanup1; + if (ACPI_FAILURE (status)) { + return (status); } status = acpi_aml_exec_unload_table (ddb_handle); @@ -294,10 +294,6 @@ } -cleanup2: - acpi_cm_remove_reference (region_desc); - -cleanup1: return (status); } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/interpreter/amcreate.c linux/drivers/acpi/interpreter/amcreate.c --- v2.4.0-test8/linux/drivers/acpi/interpreter/amcreate.c Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/interpreter/amcreate.c Fri Sep 15 14:30:30 2000 @@ -1,7 +1,7 @@ - /****************************************************************************** * * Module Name: amcreate - Named object creation + * $Revision: 44 $ * *****************************************************************************/ @@ -25,19 +25,19 @@ #include "acpi.h" -#include "parser.h" -#include "interp.h" +#include "acparser.h" +#include "acinterp.h" #include "amlcode.h" -#include "namesp.h" -#include "events.h" -#include "dispatch.h" +#include "acnamesp.h" +#include "acevents.h" +#include "acdispat.h" #define _COMPONENT INTERPRETER - MODULE_NAME ("amcreate"); + MODULE_NAME ("amcreate") -/***************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_aml_exec_create_field * @@ -64,19 +64,19 @@ * Num_bits := Term_arg=>Integer * Source_buff := Term_arg=>Buffer * - ****************************************************************************/ + ******************************************************************************/ ACPI_STATUS acpi_aml_exec_create_field ( u16 opcode, ACPI_WALK_STATE *walk_state) { - ACPI_OBJECT_INTERNAL *res_desc = NULL; - ACPI_OBJECT_INTERNAL *cnt_desc = NULL; - ACPI_OBJECT_INTERNAL *off_desc = NULL; - ACPI_OBJECT_INTERNAL *src_desc = NULL; - ACPI_OBJECT_INTERNAL *field_desc; - ACPI_OBJECT_INTERNAL *obj_desc; + 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; @@ -88,7 +88,7 @@ /* Resolve the operands */ - status = acpi_aml_resolve_operands (opcode, WALK_OPERANDS); + status = acpi_aml_resolve_operands (opcode, WALK_OPERANDS, walk_state); /* Get the operands */ @@ -101,11 +101,9 @@ status |= acpi_ds_obj_stack_pop_object (&off_desc, walk_state); status |= acpi_ds_obj_stack_pop_object (&src_desc, walk_state); - if (status != AE_OK) { + if (ACPI_FAILURE (status)) { /* Invalid parameters on object stack */ - acpi_aml_append_operand_diag (_THIS_MODULE, __LINE__, opcode, - WALK_OPERANDS, 3); goto cleanup; } @@ -288,16 +286,17 @@ if (obj_desc) { /* * There is an existing object here; delete it and zero out the - * NTE + * object field within the Node */ acpi_cm_remove_reference (obj_desc); - acpi_ns_attach_object (res_desc, NULL, ACPI_TYPE_ANY); + acpi_ns_attach_object ((ACPI_NAMESPACE_NODE *) res_desc, NULL, + ACPI_TYPE_ANY); } /* Set the type to ANY (or the store below will fail) */ - ((ACPI_NAMED_OBJECT*) res_desc)->type = ACPI_TYPE_ANY; + ((ACPI_NAMESPACE_NODE *) res_desc)->type = ACPI_TYPE_ANY; break; @@ -310,7 +309,7 @@ /* Store constructed field descriptor in result location */ - status = acpi_aml_exec_store (field_desc, res_desc); + status = acpi_aml_exec_store (field_desc, res_desc, walk_state); /* * If the field descriptor was not physically stored (or if a failure @@ -358,39 +357,41 @@ acpi_aml_exec_create_alias ( ACPI_WALK_STATE *walk_state) { - ACPI_NAMED_OBJECT *src_entry; - ACPI_NAMED_OBJECT *alias_entry; + ACPI_NAMESPACE_NODE *source_node; + ACPI_NAMESPACE_NODE *alias_node; ACPI_STATUS status; /* Get the source/alias operands (both NTEs) */ - status = acpi_ds_obj_stack_pop_object ((ACPI_OBJECT_INTERNAL **) &src_entry, + status = acpi_ds_obj_stack_pop_object ((ACPI_OPERAND_OBJECT **) &source_node, walk_state); if (ACPI_FAILURE (status)) { return (status); } - /* Don't pop it, it gets popped later */ + /* + * Don't pop it, it gets removed in the calling routine + */ - alias_entry = acpi_ds_obj_stack_get_value (0, walk_state); + alias_node = acpi_ds_obj_stack_get_value (0, walk_state); /* Add an additional reference to the object */ - acpi_cm_add_reference (src_entry->object); + acpi_cm_add_reference (source_node->object); /* - * Attach the original source NTE to the new Alias NTE. + * Attach the original source Node to the new Alias Node. */ - status = acpi_ns_attach_object (alias_entry, src_entry->object, - src_entry->type); + status = acpi_ns_attach_object (alias_node, source_node->object, + source_node->type); /* * The new alias assumes the type of the source, but it points * to the same object. The reference count of the object has two * additional references to prevent deletion out from under either the - * source or the alias NTE + * source or the alias Node */ /* Since both operands are NTEs, we don't need to delete them */ @@ -416,7 +417,7 @@ ACPI_WALK_STATE *walk_state) { ACPI_STATUS status; - ACPI_OBJECT_INTERNAL *obj_desc; + ACPI_OPERAND_OBJECT *obj_desc; BREAKPOINT3; @@ -438,7 +439,7 @@ goto cleanup; } - /* Attach object to the NTE */ + /* Attach object to the Node */ status = acpi_ns_attach_object (acpi_ds_obj_stack_get_value (0, walk_state), obj_desc, (u8) ACPI_TYPE_EVENT); @@ -473,8 +474,8 @@ ACPI_WALK_STATE *walk_state) { ACPI_STATUS status = AE_OK; - ACPI_OBJECT_INTERNAL *sync_desc; - ACPI_OBJECT_INTERNAL *obj_desc; + ACPI_OPERAND_OBJECT *sync_desc; + ACPI_OPERAND_OBJECT *obj_desc; /* Get the operand */ @@ -546,22 +547,27 @@ ACPI_WALK_STATE *walk_state) { ACPI_STATUS status; - ACPI_OBJECT_INTERNAL *obj_desc_region; - ACPI_HANDLE *entry; + ACPI_OPERAND_OBJECT *obj_desc_region; + ACPI_NAMESPACE_NODE *node; if (region_space >= NUM_REGION_TYPES) { - /* TBD: [Errors] should this return an error, or should we just keep - * going? */ + /* 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"); } - /* Get the NTE from the object stack */ - - entry = acpi_ds_obj_stack_get_value (0, walk_state); + /* Get the Node from the object stack */ + node = (ACPI_NAMESPACE_NODE *) acpi_ds_obj_stack_get_value (0, walk_state); /* Create the region descriptor */ @@ -583,10 +589,9 @@ /* Init the region from the operands */ - obj_desc_region->region.space_id = (u16) region_space; + obj_desc_region->region.space_id = (u8) region_space; obj_desc_region->region.address = 0; obj_desc_region->region.length = 0; - obj_desc_region->region.region_flags = 0; /* * Remember location in AML stream of address & length @@ -596,19 +601,38 @@ obj_desc_region->region.method->method.pcode_length = aml_length; - /* Install the new region object in the parent NTE */ + /* Install the new region object in the parent Node */ - obj_desc_region->region.nte = (ACPI_NAMED_OBJECT*) entry; + obj_desc_region->region.node = node; - status = acpi_ns_attach_object (entry, obj_desc_region, + status = acpi_ns_attach_object (node, obj_desc_region, (u8) ACPI_TYPE_REGION); + if (ACPI_FAILURE (status)) { goto cleanup; } + /* + * If we have a valid region, initialize it + * Namespace is NOT locked at this point. + */ + + status = acpi_ev_initialize_region (obj_desc_region, FALSE); + + if (ACPI_FAILURE (status)) { + /* + * If AE_NOT_EXIST is returned, it is not fatal + * because many regions get created before a handler + * is installed for said region. + */ + if (AE_NOT_EXIST == status) { + status = AE_OK; + } + } + cleanup: - if (status != AE_OK) { + if (ACPI_FAILURE (status)) { /* Delete region object and method subobject */ if (obj_desc_region) { @@ -619,22 +643,6 @@ } } - - /* - * If we have a valid region, initialize it - */ - if (obj_desc_region) { - /* - * TBD: [Errors] Is there anything we can or could do when this - * fails? - * We need to do something useful with a failure. - */ - /* Namespace IS locked */ - - (void *) acpi_ev_initialize_region (obj_desc_region, TRUE); - - } - return (status); } @@ -645,7 +653,7 @@ * * PARAMETERS: Op - Op containing the Processor definition and * args - * Processor_nTE - NTE for the containing NTE + * Processor_nTE - Node for the containing Node * * RETURN: Status * @@ -655,12 +663,12 @@ ACPI_STATUS acpi_aml_exec_create_processor ( - ACPI_GENERIC_OP *op, + ACPI_PARSE_OBJECT *op, ACPI_HANDLE processor_nTE) { ACPI_STATUS status; - ACPI_GENERIC_OP *arg; - ACPI_OBJECT_INTERNAL *obj_desc; + ACPI_PARSE_OBJECT *arg; + ACPI_OPERAND_OBJECT *obj_desc; obj_desc = acpi_cm_create_internal_object (ACPI_TYPE_PROCESSOR); @@ -669,7 +677,7 @@ return (status); } - /* Install the new processor object in the parent NTE */ + /* Install the new processor object in the parent Node */ status = acpi_ns_attach_object (processor_nTE, obj_desc, (u8) ACPI_TYPE_PROCESSOR); @@ -700,7 +708,7 @@ /* Second arg is the PBlock Address */ - obj_desc->processor.pblk_address = (ACPI_IO_ADDRESS) arg->value.integer; + obj_desc->processor.address = (ACPI_IO_ADDRESS) arg->value.integer; /* Move to next arg and check existence */ @@ -712,7 +720,7 @@ /* Third arg is the PBlock Length */ - obj_desc->processor.pblk_length = (u8) arg->value.integer; + obj_desc->processor.length = (u8) arg->value.integer; return (AE_OK); } @@ -724,7 +732,7 @@ * * PARAMETERS: Op - Op containing the Power_resource definition * and args - * Power_res_nTE - NTE for the containing NTE + * Power_res_nTE - Node for the containing Node * * RETURN: Status * @@ -734,12 +742,12 @@ ACPI_STATUS acpi_aml_exec_create_power_resource ( - ACPI_GENERIC_OP *op, + ACPI_PARSE_OBJECT *op, ACPI_HANDLE power_res_nTE) { ACPI_STATUS status; - ACPI_GENERIC_OP *arg; - ACPI_OBJECT_INTERNAL *obj_desc; + ACPI_PARSE_OBJECT *arg; + ACPI_OPERAND_OBJECT *obj_desc; obj_desc = acpi_cm_create_internal_object (ACPI_TYPE_POWER); @@ -748,7 +756,7 @@ return (status); } - /* Install the new power resource object in the parent NTE */ + /* Install the new power resource object in the parent Node */ status = acpi_ns_attach_object (power_res_nTE, obj_desc, (u8) ACPI_TYPE_POWER); @@ -789,11 +797,14 @@ * * FUNCTION: Acpi_aml_exec_create_method * - * PARAMETERS: Interpreter_mode - Current running mode (load1/Load2/Exec) + * PARAMETERS: Aml_ptr - First byte of the method's AML + * Aml_length - AML byte count for this method + * Method_flags - AML method flag byte + * Method - Method Node * * RETURN: Status * - * DESCRIPTION: Create a new mutex object + * DESCRIPTION: Create a new method object * ****************************************************************************/ @@ -804,7 +815,7 @@ u32 method_flags, ACPI_HANDLE method) { - ACPI_OBJECT_INTERNAL *obj_desc; + ACPI_OPERAND_OBJECT *obj_desc; ACPI_STATUS status; @@ -830,9 +841,8 @@ METHOD_FLAGS_ARG_COUNT); /* - * Get the concurrency count - * If required, a semaphore will be created for this method when it is - * parsed. + * Get the concurrency count. If required, a semaphore will be + * created for this method when it is parsed. * * TBD: [Future] for APCI 2.0, there will be a Sync_level value, not * just a flag @@ -842,27 +852,16 @@ if (method_flags & METHOD_FLAGS_SERIALIZED) { obj_desc->method.concurrency = 1; } + else { obj_desc->method.concurrency = INFINITE_CONCURRENCY; } - /* Mark the Method as not parsed yet */ - - obj_desc->method.parser_op = NULL; - - /* - * Another +1 gets added when Acpi_psx_execute is called, - * no need for: Obj_desc->Method.Pcode++; - */ - - obj_desc->method.acpi_table = NULL; /* TBD: [Restructure] was (u8 *) Pcode_addr; */ - obj_desc->method.table_length = 0; /* TBD: [Restructure] needed? (u32) (Walk_state->aml_end - Pcode_addr); */ - - /* Attach the new object to the method NTE */ + /* Attach the new object to the method Node */ status = acpi_ns_attach_object (method, obj_desc, (u8) ACPI_TYPE_METHOD); if (ACPI_FAILURE (status)) { - acpi_cm_free (obj_desc); + acpi_cm_delete_object_desc (obj_desc); } return (status); diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/interpreter/amdump.c linux/drivers/acpi/interpreter/amdump.c --- v2.4.0-test8/linux/drivers/acpi/interpreter/amdump.c Wed Dec 31 16:00:00 1969 +++ linux/drivers/acpi/interpreter/amdump.c Fri Sep 15 14:30:30 2000 @@ -0,0 +1,41 @@ +/****************************************************************************** + * + * 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 + */ + + diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/interpreter/amdyadic.c linux/drivers/acpi/interpreter/amdyadic.c --- v2.4.0-test8/linux/drivers/acpi/interpreter/amdyadic.c Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/interpreter/amdyadic.c Fri Sep 15 14:30:30 2000 @@ -1,7 +1,7 @@ - /****************************************************************************** * * Module Name: amdyadic - ACPI AML (p-code) execution for dyadic operators + * $Revision: 63 $ * *****************************************************************************/ @@ -25,16 +25,16 @@ #include "acpi.h" -#include "parser.h" -#include "namesp.h" -#include "interp.h" -#include "events.h" +#include "acparser.h" +#include "acnamesp.h" +#include "acinterp.h" +#include "acevents.h" #include "amlcode.h" -#include "dispatch.h" +#include "acdispat.h" #define _COMPONENT INTERPRETER - MODULE_NAME ("amdyadic"); + MODULE_NAME ("amdyadic") /***************************************************************************** @@ -57,15 +57,15 @@ u16 opcode, ACPI_WALK_STATE *walk_state) { - ACPI_OBJECT_INTERNAL *obj_desc = NULL; - ACPI_OBJECT_INTERNAL *val_desc = NULL; - ACPI_NAMED_OBJECT *entry; + ACPI_OPERAND_OBJECT *obj_desc = NULL; + ACPI_OPERAND_OBJECT *val_desc = NULL; + ACPI_NAMESPACE_NODE *node; ACPI_STATUS status = AE_OK; /* Resolve all operands */ - status = acpi_aml_resolve_operands (opcode, WALK_OPERANDS); + status = acpi_aml_resolve_operands (opcode, WALK_OPERANDS, walk_state); /* Get the operands */ status |= acpi_ds_obj_stack_pop_object (&val_desc, walk_state); @@ -73,8 +73,6 @@ if (ACPI_FAILURE (status)) { /* Invalid parameters on object stack */ - acpi_aml_append_operand_diag (_THIS_MODULE, __LINE__, opcode, - WALK_OPERANDS, 2); goto cleanup; } @@ -88,15 +86,15 @@ case AML_NOTIFY_OP: - /* The Obj_desc is actually an NTE */ + /* The Obj_desc is actually an Node */ - entry = (ACPI_NAMED_OBJECT*) obj_desc; + node = (ACPI_NAMESPACE_NODE *) obj_desc; obj_desc = NULL; /* Object must be a device or thermal zone */ - if (entry && val_desc) { - switch (entry->type) + if (node && val_desc) { + switch (node->type) { case ACPI_TYPE_DEVICE: case ACPI_TYPE_THERMAL: @@ -108,7 +106,7 @@ /* Dispatch the notify to the appropriate handler */ - acpi_ev_notify_dispatch (entry, val_desc->number.value); + acpi_ev_notify_dispatch (node, val_desc->number.value); break; default: @@ -118,6 +116,8 @@ break; default: + + REPORT_ERROR ("Acpi_aml_exec_dyadic1: Unknown dyadic opcode"); status = AE_AML_BAD_OPCODE; } @@ -153,23 +153,23 @@ acpi_aml_exec_dyadic2_r ( u16 opcode, ACPI_WALK_STATE *walk_state, - ACPI_OBJECT_INTERNAL **return_desc) + ACPI_OPERAND_OBJECT **return_desc) { - ACPI_OBJECT_INTERNAL *obj_desc = NULL; - ACPI_OBJECT_INTERNAL *obj_desc2 = NULL; - ACPI_OBJECT_INTERNAL *res_desc = NULL; - ACPI_OBJECT_INTERNAL *res_desc2 = NULL; - ACPI_OBJECT_INTERNAL *ret_desc = NULL; - ACPI_OBJECT_INTERNAL *ret_desc2 = NULL; + ACPI_OPERAND_OBJECT *obj_desc = NULL; + ACPI_OPERAND_OBJECT *obj_desc2 = NULL; + ACPI_OPERAND_OBJECT *res_desc = NULL; + ACPI_OPERAND_OBJECT *res_desc2 = NULL; + ACPI_OPERAND_OBJECT *ret_desc = NULL; + ACPI_OPERAND_OBJECT *ret_desc2 = NULL; ACPI_STATUS status = AE_OK; u32 remainder; - s32 num_operands = 3; - char *new_buf; + u32 num_operands = 3; + NATIVE_CHAR *new_buf; /* Resolve all operands */ - status = acpi_aml_resolve_operands (opcode, WALK_OPERANDS); + status = acpi_aml_resolve_operands (opcode, WALK_OPERANDS, walk_state); /* Get all operands */ if (AML_DIVIDE_OP == opcode) { @@ -180,10 +180,7 @@ status |= acpi_ds_obj_stack_pop_object (&res_desc, walk_state); status |= acpi_ds_obj_stack_pop_object (&obj_desc2, walk_state); status |= acpi_ds_obj_stack_pop_object (&obj_desc, walk_state); - if (status != AE_OK) { - acpi_aml_append_operand_diag (_THIS_MODULE, __LINE__, opcode, - &(walk_state->operands [walk_state->num_operands -1]), - num_operands); + if (ACPI_FAILURE (status)) { goto cleanup; } @@ -368,9 +365,9 @@ goto cleanup; } - STRCPY (new_buf, (char *) obj_desc->string.pointer); + STRCPY (new_buf, obj_desc->string.pointer); STRCPY (new_buf + obj_desc->string.length, - (char *) obj_desc2->string.pointer); + obj_desc2->string.pointer); /* Point the return object to the new string */ @@ -391,16 +388,8 @@ new_buf = acpi_cm_allocate (obj_desc->buffer.length + obj_desc2->buffer.length); if (!new_buf) { - /* Only bail out if the buffer is small */ - - /* TBD: [Investigate] what is the point of this code? */ - - if (obj_desc->buffer.length + obj_desc2->buffer.length < 1024) { - REPORT_ERROR - ("Aml_exec_dyadic2_r/Concat_op: Buffer allocation failure"); - return (AE_NO_MEMORY); - } - + REPORT_ERROR + ("Aml_exec_dyadic2_r/Concat_op: Buffer allocation failure"); status = AE_NO_MEMORY; goto cleanup; } @@ -423,6 +412,7 @@ default: + REPORT_ERROR ("Acpi_aml_exec_dyadic2_r: Unknown dyadic opcode"); status = AE_AML_BAD_OPCODE; goto cleanup; } @@ -434,12 +424,13 @@ * descriptor (Res_desc). */ - if ((status = acpi_aml_exec_store (ret_desc, res_desc)) != AE_OK) { + status = acpi_aml_exec_store (ret_desc, res_desc, walk_state); + if (ACPI_FAILURE (status)) { goto cleanup; } if (AML_DIVIDE_OP == opcode) { - status = acpi_aml_exec_store (ret_desc2, res_desc2); + status = acpi_aml_exec_store (ret_desc2, res_desc2, walk_state); /* * Since the remainder is not returned, remove a reference to @@ -499,26 +490,24 @@ acpi_aml_exec_dyadic2_s ( u16 opcode, ACPI_WALK_STATE *walk_state, - ACPI_OBJECT_INTERNAL **return_desc) + ACPI_OPERAND_OBJECT **return_desc) { - ACPI_OBJECT_INTERNAL *obj_desc; - ACPI_OBJECT_INTERNAL *time_desc; - ACPI_OBJECT_INTERNAL *ret_desc = NULL; + ACPI_OPERAND_OBJECT *obj_desc; + ACPI_OPERAND_OBJECT *time_desc; + ACPI_OPERAND_OBJECT *ret_desc = NULL; ACPI_STATUS status; /* Resolve all operands */ - status = acpi_aml_resolve_operands (opcode, WALK_OPERANDS); + status = acpi_aml_resolve_operands (opcode, WALK_OPERANDS, walk_state); /* Get all operands */ status |= acpi_ds_obj_stack_pop_object (&time_desc, walk_state); status |= acpi_ds_obj_stack_pop_object (&obj_desc, walk_state); - if (status != AE_OK) { + if (ACPI_FAILURE (status)) { /* Invalid parameters on object stack */ - acpi_aml_append_operand_diag (_THIS_MODULE, __LINE__, opcode, - WALK_OPERANDS, 2); goto cleanup; } @@ -559,6 +548,7 @@ default: + REPORT_ERROR ("Acpi_aml_exec_dyadic2_s: Unknown dyadic synchronization opcode"); status = AE_AML_BAD_OPCODE; goto cleanup; } @@ -619,27 +609,25 @@ acpi_aml_exec_dyadic2 ( u16 opcode, ACPI_WALK_STATE *walk_state, - ACPI_OBJECT_INTERNAL **return_desc) + ACPI_OPERAND_OBJECT **return_desc) { - ACPI_OBJECT_INTERNAL *obj_desc; - ACPI_OBJECT_INTERNAL *obj_desc2; - ACPI_OBJECT_INTERNAL *ret_desc = NULL; + ACPI_OPERAND_OBJECT *obj_desc; + ACPI_OPERAND_OBJECT *obj_desc2; + ACPI_OPERAND_OBJECT *ret_desc = NULL; ACPI_STATUS status; u8 lboolean; /* Resolve all operands */ - status = acpi_aml_resolve_operands (opcode, WALK_OPERANDS); + status = acpi_aml_resolve_operands (opcode, WALK_OPERANDS, walk_state); /* Get all operands */ status |= acpi_ds_obj_stack_pop_object (&obj_desc2, walk_state); status |= acpi_ds_obj_stack_pop_object (&obj_desc, walk_state); - if (status != AE_OK) { + if (ACPI_FAILURE (status)) { /* Invalid parameters on object stack */ - acpi_aml_append_operand_diag (_THIS_MODULE, __LINE__, opcode, - WALK_OPERANDS, 2); goto cleanup; } @@ -707,6 +695,7 @@ default: + REPORT_ERROR ("Acpi_aml_exec_dyadic2: Unknown dyadic opcode"); status = AE_AML_BAD_OPCODE; goto cleanup; break; diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/interpreter/amfield.c linux/drivers/acpi/interpreter/amfield.c --- v2.4.0-test8/linux/drivers/acpi/interpreter/amfield.c Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/interpreter/amfield.c Fri Sep 15 14:30:30 2000 @@ -1,6 +1,7 @@ /****************************************************************************** * * Module Name: amfield - ACPI AML (p-code) execution - field manipulation + * $Revision: 70 $ * *****************************************************************************/ @@ -24,16 +25,16 @@ #include "acpi.h" -#include "dispatch.h" -#include "interp.h" +#include "acdispat.h" +#include "acinterp.h" #include "amlcode.h" -#include "namesp.h" -#include "hardware.h" -#include "events.h" +#include "acnamesp.h" +#include "achware.h" +#include "acevents.h" #define _COMPONENT INTERPRETER - MODULE_NAME ("amfield"); + MODULE_NAME ("amfield") /******************************************************************************* @@ -67,12 +68,12 @@ ACPI_STATUS acpi_aml_setup_field ( - ACPI_OBJECT_INTERNAL *obj_desc, - ACPI_OBJECT_INTERNAL *rgn_desc, - s32 field_bit_width) + ACPI_OPERAND_OBJECT *obj_desc, + ACPI_OPERAND_OBJECT *rgn_desc, + u32 field_bit_width) { ACPI_STATUS status = AE_OK; - s32 field_byte_width; + u32 field_byte_width; /* Parameter validation */ @@ -87,6 +88,8 @@ /* + * TBD: [Future] Acpi 2.0 supports Qword fields + * * Init and validate Field width * Possible values are 1, 2, 4 */ @@ -105,7 +108,7 @@ * If the address and length have not been previously evaluated, * evaluate them and save the results. */ - if (!(rgn_desc->region.region_flags & REGION_AGRUMENT_DATA_VALID)) { + if (!(rgn_desc->region.flags & AOPOBJ_DATA_VALID)) { status = acpi_ds_get_region_arguments (rgn_desc); if (ACPI_FAILURE (status)) { @@ -113,12 +116,6 @@ } } - - /* - * If (offset rounded up to next multiple of field width) - * exceeds region length, indicate an error. - */ - if (rgn_desc->region.length < (obj_desc->field.offset & ~((u32) field_byte_width - 1)) + field_byte_width) @@ -152,12 +149,12 @@ ACPI_STATUS acpi_aml_access_named_field ( - s32 mode, + u32 mode, ACPI_HANDLE named_field, void *buffer, u32 buffer_length) { - ACPI_OBJECT_INTERNAL *obj_desc = NULL; + ACPI_OPERAND_OBJECT *obj_desc = NULL; ACPI_STATUS status = AE_OK; u8 locked = FALSE; u32 bit_granularity = 0; @@ -167,6 +164,11 @@ u32 byte_field_length; + /* Basic data checking */ + if ((!named_field) || (ACPI_READ == mode && !buffer)) { + return (AE_AML_INTERNAL); + } + /* Get the attached field object */ obj_desc = acpi_ns_get_attached_object (named_field); @@ -256,72 +258,6 @@ acpi_aml_release_global_lock (locked); - return (status); -} - - -/******************************************************************************* - * - * FUNCTION: Acpi_aml_set_named_field_value - * - * PARAMETERS: Named_field - Handle for field to be set - * Buffer - Bytes to be stored - * Buffer_length - Number of bytes to be stored - * - * RETURN: Status - * - * DESCRIPTION: Store the given value into the field - * - ******************************************************************************/ - -ACPI_STATUS -acpi_aml_set_named_field_value ( - ACPI_HANDLE named_field, - void *buffer, - u32 buffer_length) -{ - ACPI_STATUS status; - - - if (!named_field) { - return (AE_AML_INTERNAL); - } - - status = acpi_aml_access_named_field (ACPI_WRITE, named_field, buffer, - buffer_length); - return (status); -} - - -/******************************************************************************* - * - * FUNCTION: Acpi_aml_get_named_field_value - * - * PARAMETERS: Named_field - Handle for field to be read - * *Buffer - Where to store value read from field - * Buffer_length - Max length to read - * - * RETURN: Status - * - * DESCRIPTION: Retrieve the value of the given field - * - ******************************************************************************/ - -ACPI_STATUS -acpi_aml_get_named_field_value ( - ACPI_HANDLE named_field, - void *buffer, - u32 buffer_length) -{ - ACPI_STATUS status; - - - if ((!named_field) || (!buffer)) { - return (AE_AML_INTERNAL); - } - - status = acpi_aml_access_named_field (ACPI_READ, named_field, buffer, - buffer_length); return (status); } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/interpreter/amfldio.c linux/drivers/acpi/interpreter/amfldio.c --- v2.4.0-test8/linux/drivers/acpi/interpreter/amfldio.c Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/interpreter/amfldio.c Fri Sep 15 14:30:30 2000 @@ -1,6 +1,7 @@ /****************************************************************************** * * Module Name: amfldio - Aml Field I/O + * $Revision: 26 $ * *****************************************************************************/ @@ -24,15 +25,15 @@ #include "acpi.h" -#include "interp.h" +#include "acinterp.h" #include "amlcode.h" -#include "namesp.h" -#include "hardware.h" -#include "events.h" +#include "acnamesp.h" +#include "achware.h" +#include "acevents.h" #define _COMPONENT INTERPRETER - MODULE_NAME ("amfldio"); + MODULE_NAME ("amfldio") /******************************************************************************* @@ -51,16 +52,16 @@ ACPI_STATUS acpi_aml_read_field_data ( - ACPI_OBJECT_INTERNAL *obj_desc, + ACPI_OPERAND_OBJECT *obj_desc, u32 field_byte_offset, u32 field_bit_width, u32 *value) { ACPI_STATUS status; - ACPI_OBJECT_INTERNAL *rgn_desc = NULL; + ACPI_OPERAND_OBJECT *rgn_desc = NULL; u32 address; u32 local_value = 0; - s32 field_byte_width; + u32 field_byte_width; /* Obj_desc is validated by callers */ @@ -72,7 +73,7 @@ field_byte_width = DIV_8 (field_bit_width); status = acpi_aml_setup_field (obj_desc, rgn_desc, field_bit_width); - if (AE_OK != status) { + if (ACPI_FAILURE (status)) { return (status); } @@ -84,17 +85,17 @@ /* - * Round offset down to next multiple of - * field width, add region base address and offset within the field + * Set offset to next multiple of field width, + * add region base address and offset within the field */ - address = rgn_desc->region.address + - (obj_desc->field.offset & ~((u32) field_byte_width - 1)) + + (obj_desc->field.offset * field_byte_width) + field_byte_offset; + /* Invoke the appropriate Address_space/Op_region handler */ status = acpi_ev_address_space_dispatch (rgn_desc, ADDRESS_SPACE_READ, @@ -122,7 +123,7 @@ ACPI_STATUS acpi_aml_read_field ( - ACPI_OBJECT_INTERNAL *obj_desc, + ACPI_OPERAND_OBJECT *obj_desc, void *buffer, u32 buffer_length, u32 byte_length, @@ -236,6 +237,7 @@ * field datum */ + if (obj_desc->field.bit_offset != 0) { merged_datum = (previous_raw_datum >> obj_desc->field.bit_offset) | @@ -247,10 +249,27 @@ } /* + * Prepare the merged datum for storing into the caller's + * buffer. It is possible to have a 32-bit buffer + * (Byte_granularity == 4), but a Obj_desc->Field.Length + * of 8 or 16, meaning that the upper bytes of merged data + * are undesired. This section fixes that. + */ + switch (obj_desc->field.length) + { + case 8: + merged_datum &= 0x000000FF; + break; + + case 16: + merged_datum &= 0x0000FFFF; + break; + } + + /* * Now store the datum in the caller's buffer, according to * the data type */ - switch (byte_granularity) { case 1: @@ -266,7 +285,6 @@ break; } - /* * Save the most recent datum since it contains bits of * the *next* field datum @@ -302,15 +320,15 @@ ACPI_STATUS acpi_aml_write_field_data ( - ACPI_OBJECT_INTERNAL *obj_desc, + ACPI_OPERAND_OBJECT *obj_desc, u32 field_byte_offset, u32 field_bit_width, u32 value) { ACPI_STATUS status = AE_OK; - ACPI_OBJECT_INTERNAL *rgn_desc = NULL; + ACPI_OPERAND_OBJECT *rgn_desc = NULL; u32 address; - s32 field_byte_width; + u32 field_byte_width; /* Obj_desc is validated by callers */ @@ -321,21 +339,21 @@ field_byte_width = DIV_8 (field_bit_width); status = acpi_aml_setup_field (obj_desc, rgn_desc, field_bit_width); - if (AE_OK != status) { + if (ACPI_FAILURE (status)) { return (status); } /* - * Round offset down to next multiple of - * field width, add region base address and offset within the field + * Set offset to next multiple of field width, + * add region base address and offset within the field */ - address = rgn_desc->region.address + - (obj_desc->field.offset & ~((u32) field_byte_width - 1)) + + (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, @@ -363,7 +381,7 @@ ACPI_STATUS acpi_aml_write_field_data_with_update_rule ( - ACPI_OBJECT_INTERNAL *obj_desc, + ACPI_OPERAND_OBJECT *obj_desc, u32 mask, u32 field_value, u32 this_field_byte_offset, @@ -426,7 +444,7 @@ bit_granularity, merged_value); } - return status; + return (status); } @@ -446,7 +464,7 @@ ACPI_STATUS acpi_aml_write_field ( - ACPI_OBJECT_INTERNAL *obj_desc, + ACPI_OPERAND_OBJECT *obj_desc, void *buffer, u32 buffer_length, u32 byte_length, @@ -638,7 +656,8 @@ field_value = (previous_raw_datum >> (bit_granularity - obj_desc->field.bit_offset)) & mask; - status = acpi_aml_write_field_data_with_update_rule (obj_desc, mask, field_value, this_field_byte_offset + 1, + status = acpi_aml_write_field_data_with_update_rule (obj_desc, mask, field_value, + this_field_byte_offset + byte_granularity, bit_granularity); if (ACPI_FAILURE (status)) { goto cleanup; diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/interpreter/ammisc.c linux/drivers/acpi/interpreter/ammisc.c --- v2.4.0-test8/linux/drivers/acpi/interpreter/ammisc.c Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/interpreter/ammisc.c Fri Sep 15 14:30:30 2000 @@ -2,6 +2,7 @@ /****************************************************************************** * * Module Name: ammisc - ACPI AML (p-code) execution - specific opcodes + * $Revision: 67 $ * *****************************************************************************/ @@ -25,14 +26,14 @@ #include "acpi.h" -#include "parser.h" -#include "interp.h" +#include "acparser.h" +#include "acinterp.h" #include "amlcode.h" -#include "dispatch.h" +#include "acdispat.h" #define _COMPONENT INTERPRETER - MODULE_NAME ("ammisc"); + MODULE_NAME ("ammisc") /******************************************************************************* @@ -58,25 +59,23 @@ acpi_aml_exec_fatal ( ACPI_WALK_STATE *walk_state) { - ACPI_OBJECT_INTERNAL *type_desc; - ACPI_OBJECT_INTERNAL *code_desc; - ACPI_OBJECT_INTERNAL *arg_desc; + ACPI_OPERAND_OBJECT *type_desc; + ACPI_OPERAND_OBJECT *code_desc; + ACPI_OPERAND_OBJECT *arg_desc; ACPI_STATUS status; /* Resolve operands */ - status = acpi_aml_resolve_operands (AML_FATAL_OP, WALK_OPERANDS); + status = acpi_aml_resolve_operands (AML_FATAL_OP, WALK_OPERANDS, walk_state); /* Get operands */ status |= acpi_ds_obj_stack_pop_object (&arg_desc, walk_state); status |= acpi_ds_obj_stack_pop_object (&code_desc, walk_state); status |= acpi_ds_obj_stack_pop_object (&type_desc, walk_state); - if (status != AE_OK) { - /* invalid parameters on object stack */ + if (ACPI_FAILURE (status)) { + /* Invalid parameters on object stack */ - acpi_aml_append_operand_diag (_THIS_MODULE, __LINE__, - (u16) AML_FATAL_OP, WALK_OPERANDS, 3); goto cleanup; } @@ -130,30 +129,28 @@ ACPI_STATUS acpi_aml_exec_index ( ACPI_WALK_STATE *walk_state, - ACPI_OBJECT_INTERNAL **return_desc) + ACPI_OPERAND_OBJECT **return_desc) { - ACPI_OBJECT_INTERNAL *obj_desc; - ACPI_OBJECT_INTERNAL *idx_desc; - ACPI_OBJECT_INTERNAL *res_desc; - ACPI_OBJECT_INTERNAL *ret_desc = NULL; - ACPI_OBJECT_INTERNAL *tmp_desc; + ACPI_OPERAND_OBJECT *obj_desc; + ACPI_OPERAND_OBJECT *idx_desc; + ACPI_OPERAND_OBJECT *res_desc; + ACPI_OPERAND_OBJECT *ret_desc = NULL; + ACPI_OPERAND_OBJECT *tmp_desc; ACPI_STATUS status; /* Resolve operands */ /* First operand can be either a package or a buffer */ - status = acpi_aml_resolve_operands (AML_INDEX_OP, WALK_OPERANDS); + status = acpi_aml_resolve_operands (AML_INDEX_OP, WALK_OPERANDS, walk_state); /* Get all operands */ status |= acpi_ds_obj_stack_pop_object (&res_desc, walk_state); status |= acpi_ds_obj_stack_pop_object (&idx_desc, walk_state); status |= acpi_ds_obj_stack_pop_object (&obj_desc, walk_state); - if (status != AE_OK) { + if (ACPI_FAILURE (status)) { /* Invalid parameters on object stack */ - acpi_aml_append_operand_diag (_THIS_MODULE, __LINE__, - (u16) AML_INDEX_OP, WALK_OPERANDS, 3); goto cleanup; } @@ -202,7 +199,7 @@ ret_desc->reference.target_type = tmp_desc->common.type; ret_desc->reference.object = tmp_desc; - status = acpi_aml_exec_store (ret_desc, res_desc); + status = acpi_aml_exec_store (ret_desc, res_desc, walk_state); ret_desc->reference.object = NULL; } @@ -228,7 +225,7 @@ ret_desc->reference.object = obj_desc; ret_desc->reference.offset = idx_desc->number.value; - status = acpi_aml_exec_store (ret_desc, res_desc); + status = acpi_aml_exec_store (ret_desc, res_desc, walk_state); } @@ -282,15 +279,15 @@ ACPI_STATUS acpi_aml_exec_match ( ACPI_WALK_STATE *walk_state, - ACPI_OBJECT_INTERNAL **return_desc) + ACPI_OPERAND_OBJECT **return_desc) { - ACPI_OBJECT_INTERNAL *pkg_desc; - ACPI_OBJECT_INTERNAL *op1_desc; - ACPI_OBJECT_INTERNAL *V1_desc; - ACPI_OBJECT_INTERNAL *op2_desc; - ACPI_OBJECT_INTERNAL *V2_desc; - ACPI_OBJECT_INTERNAL *start_desc; - ACPI_OBJECT_INTERNAL *ret_desc = NULL; + ACPI_OPERAND_OBJECT *pkg_desc; + ACPI_OPERAND_OBJECT *op1_desc; + ACPI_OPERAND_OBJECT *V1_desc; + ACPI_OPERAND_OBJECT *op2_desc; + ACPI_OPERAND_OBJECT *V2_desc; + ACPI_OPERAND_OBJECT *start_desc; + ACPI_OPERAND_OBJECT *ret_desc = NULL; ACPI_STATUS status; u32 index; u32 match_value = (u32) -1; @@ -298,7 +295,7 @@ /* Resolve all operands */ - status = acpi_aml_resolve_operands (AML_MATCH_OP, WALK_OPERANDS); + status = acpi_aml_resolve_operands (AML_MATCH_OP, WALK_OPERANDS, walk_state); /* Get all operands */ status |= acpi_ds_obj_stack_pop_object (&start_desc, walk_state); @@ -308,11 +305,9 @@ status |= acpi_ds_obj_stack_pop_object (&op1_desc, walk_state); status |= acpi_ds_obj_stack_pop_object (&pkg_desc, walk_state); - if (status != AE_OK) { + if (ACPI_FAILURE (status)) { /* Invalid parameters on object stack */ - acpi_aml_append_operand_diag (_THIS_MODULE, __LINE__, - (u16) AML_MATCH_OP, WALK_OPERANDS, 6); goto cleanup; } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/interpreter/ammonad.c linux/drivers/acpi/interpreter/ammonad.c --- v2.4.0-test8/linux/drivers/acpi/interpreter/ammonad.c Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/interpreter/ammonad.c Fri Sep 15 14:30:30 2000 @@ -2,6 +2,7 @@ /****************************************************************************** * * Module Name: ammonad - ACPI AML (p-code) execution for monadic operators + * $Revision: 79 $ * *****************************************************************************/ @@ -25,15 +26,15 @@ #include "acpi.h" -#include "parser.h" -#include "dispatch.h" -#include "interp.h" +#include "acparser.h" +#include "acdispat.h" +#include "acinterp.h" #include "amlcode.h" -#include "namesp.h" +#include "acnamesp.h" #define _COMPONENT INTERPRETER - MODULE_NAME ("ammonad"); + MODULE_NAME ("ammonad") /******************************************************************************* @@ -52,8 +53,9 @@ ACPI_STATUS acpi_aml_get_object_reference ( - ACPI_OBJECT_INTERNAL *obj_desc, - ACPI_OBJECT_INTERNAL **ret_desc) + ACPI_OPERAND_OBJECT *obj_desc, + ACPI_OPERAND_OBJECT **ret_desc, + ACPI_WALK_STATE *walk_state) { ACPI_STATUS status = AE_OK; @@ -74,14 +76,14 @@ case AML_LOCAL_OP: *ret_desc = (void *) acpi_ds_method_data_get_nte (MTH_TYPE_LOCAL, - (obj_desc->reference.offset)); + (obj_desc->reference.offset), walk_state); break; case AML_ARG_OP: *ret_desc = (void *) acpi_ds_method_data_get_nte (MTH_TYPE_ARG, - (obj_desc->reference.offset)); + (obj_desc->reference.offset), walk_state); break; @@ -95,7 +97,7 @@ } else if (VALID_DESCRIPTOR_TYPE (obj_desc, ACPI_DESC_TYPE_NAMED)) { - /* Must be a named object; Just return the NTE */ + /* Must be a named object; Just return the Node */ *ret_desc = obj_desc; } @@ -130,19 +132,17 @@ u16 opcode, ACPI_WALK_STATE *walk_state) { - ACPI_OBJECT_INTERNAL *obj_desc; + ACPI_OPERAND_OBJECT *obj_desc; ACPI_STATUS status; /* Resolve all operands */ - status = acpi_aml_resolve_operands (opcode, WALK_OPERANDS); + status = acpi_aml_resolve_operands (opcode, WALK_OPERANDS, walk_state); /* Get all operands */ status |= acpi_ds_obj_stack_pop_object (&obj_desc, walk_state); - if (status != AE_OK) { - acpi_aml_append_operand_diag (_THIS_MODULE, __LINE__, - opcode, WALK_OPERANDS, 1); + if (ACPI_FAILURE (status)) { goto cleanup; } @@ -196,6 +196,7 @@ default: + REPORT_ERROR ("Acpi_aml_exec_monadic1: Unknown monadic opcode"); status = AE_AML_BAD_OPCODE; break; @@ -229,30 +230,28 @@ acpi_aml_exec_monadic2_r ( u16 opcode, ACPI_WALK_STATE *walk_state, - ACPI_OBJECT_INTERNAL **return_desc) + ACPI_OPERAND_OBJECT **return_desc) { - ACPI_OBJECT_INTERNAL *obj_desc; - ACPI_OBJECT_INTERNAL *res_desc; - ACPI_OBJECT_INTERNAL *ret_desc = NULL; - ACPI_OBJECT_INTERNAL *ret_desc2 = NULL; + ACPI_OPERAND_OBJECT *obj_desc; + ACPI_OPERAND_OBJECT *res_desc; + ACPI_OPERAND_OBJECT *ret_desc = NULL; + ACPI_OPERAND_OBJECT *ret_desc2 = NULL; u32 res_val; ACPI_STATUS status; - s32 d0; - s32 d1; - s32 d2; - s32 d3; + u32 d0; + u32 d1; + u32 d2; + u32 d3; /* Resolve all operands */ - status = acpi_aml_resolve_operands (opcode, WALK_OPERANDS); + status = acpi_aml_resolve_operands (opcode, WALK_OPERANDS, walk_state); /* Get all operands */ status |= acpi_ds_obj_stack_pop_object (&res_desc, walk_state); status |= acpi_ds_obj_stack_pop_object (&obj_desc, walk_state); - if (status != AE_OK) { - acpi_aml_append_operand_diag (_THIS_MODULE, __LINE__, - opcode, WALK_OPERANDS, 2); + if (ACPI_FAILURE (status)) { goto cleanup; } @@ -264,8 +263,8 @@ case AML_BIT_NOT_OP: case AML_FIND_SET_LEFT_BIT_OP: case AML_FIND_SET_RIGHT_BIT_OP: - case AML_FROM_BCDOP: - case AML_TO_BCDOP: + case AML_FROM_BCD_OP: + case AML_TO_BCD_OP: case AML_COND_REF_OF_OP: ret_desc = acpi_cm_create_internal_object (ACPI_TYPE_NUMBER); @@ -293,7 +292,13 @@ case AML_FIND_SET_LEFT_BIT_OP: ret_desc->number.value = obj_desc->number.value; - for (res_val = 0; ret_desc->number.value && res_val < 33; ++res_val) { + + /* + * Acpi x1.94 spec, Chapter 16 describes Integer as a 32-bit + * little endian unsigned value, so this boundry condition + * is valid. + */ + for (res_val = 0; ret_desc->number.value && res_val < 32; ++res_val) { ret_desc->number.value >>= 1; } @@ -306,22 +311,29 @@ case AML_FIND_SET_RIGHT_BIT_OP: ret_desc->number.value = obj_desc->number.value; - for (res_val = 0; ret_desc->number.value && res_val < 33; ++res_val) { + + /* + * Acpi x1.94 spec, Chapter 16 describes Integer as a 32-bit + * little endian unsigned value, so this boundry condition + * is valid. + */ + for (res_val = 0; ret_desc->number.value && res_val < 32; ++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; break; /* Def_from_bDC := From_bCDOp BCDValue Result */ - case AML_FROM_BCDOP: + case AML_FROM_BCD_OP: - d0 = (s32) (obj_desc->number.value & 15); - d1 = (s32) (obj_desc->number.value >> 4 & 15); - d2 = (s32) (obj_desc->number.value >> 8 & 15); - d3 = (s32) (obj_desc->number.value >> 12 & 15); + d0 = (u32) (obj_desc->number.value & 15); + d1 = (u32) (obj_desc->number.value >> 4 & 15); + d2 = (u32) (obj_desc->number.value >> 8 & 15); + d3 = (u32) (obj_desc->number.value >> 12 & 15); if (d0 > 9 || d1 > 9 || d2 > 9 || d3 > 9) { status = AE_AML_NUMERIC_OVERFLOW; @@ -334,7 +346,7 @@ /* Def_to_bDC := To_bCDOp Operand Result */ - case AML_TO_BCDOP: + case AML_TO_BCD_OP: if (obj_desc->number.value > 9999) { @@ -361,7 +373,7 @@ * (There are really two return values) */ - if ((ACPI_NAMED_OBJECT*) obj_desc == acpi_gbl_root_object) { + if ((ACPI_NAMESPACE_NODE *) obj_desc == acpi_gbl_root_node) { /* * This means that the object does not exist in the namespace, * return FALSE @@ -380,12 +392,12 @@ /* Get the object reference and store it */ - status = acpi_aml_get_object_reference (obj_desc, &ret_desc2); + status = acpi_aml_get_object_reference (obj_desc, &ret_desc2, walk_state); if (ACPI_FAILURE (status)) { goto cleanup; } - status = acpi_aml_exec_store (ret_desc2, res_desc); + status = acpi_aml_exec_store (ret_desc2, res_desc, walk_state); /* The object exists in the namespace, return TRUE */ @@ -406,7 +418,7 @@ * since the object itself may have been stored. */ - status = acpi_aml_exec_store (obj_desc, res_desc); + status = acpi_aml_exec_store (obj_desc, res_desc, walk_state); if (ACPI_FAILURE (status)) { /* On failure, just delete the Obj_desc */ @@ -454,12 +466,13 @@ default: + REPORT_ERROR ("Acpi_aml_exec_monadic2_r: Unknown monadic opcode"); status = AE_AML_BAD_OPCODE; goto cleanup; } - status = acpi_aml_exec_store (ret_desc, res_desc); + status = acpi_aml_exec_store (ret_desc, res_desc, walk_state); cleanup: @@ -502,25 +515,32 @@ acpi_aml_exec_monadic2 ( u16 opcode, ACPI_WALK_STATE *walk_state, - ACPI_OBJECT_INTERNAL **return_desc) + ACPI_OPERAND_OBJECT **return_desc) { - ACPI_OBJECT_INTERNAL *obj_desc; - ACPI_OBJECT_INTERNAL *tmp_desc; - ACPI_OBJECT_INTERNAL *ret_desc = NULL; + ACPI_OPERAND_OBJECT *obj_desc; + ACPI_OPERAND_OBJECT *tmp_desc; + ACPI_OPERAND_OBJECT *ret_desc = NULL; + ACPI_STATUS resolve_status; ACPI_STATUS status; u32 type; u32 value; - /* Resolve all operands */ + /* Attempt to resolve the operands */ - status = acpi_aml_resolve_operands (opcode, WALK_OPERANDS); - /* Get all operands */ + resolve_status = acpi_aml_resolve_operands (opcode, WALK_OPERANDS, walk_state); + /* Always get all operands */ - status |= acpi_ds_obj_stack_pop_object (&obj_desc, walk_state); - if (status != AE_OK) { - acpi_aml_append_operand_diag (_THIS_MODULE, __LINE__, - opcode, WALK_OPERANDS, 1); + status = acpi_ds_obj_stack_pop_object (&obj_desc, walk_state); + + + /* Now we can check the status codes */ + + if (ACPI_FAILURE (resolve_status)) { + goto cleanup; + } + + if (ACPI_FAILURE (status)) { goto cleanup; } @@ -553,7 +573,7 @@ /* * Since we are expecting an Reference on the top of the stack, it - * can be either an NTE or an internal object. + * can be either an Node or an internal object. * * TBD: [Future] This may be the prototype code for all cases where * an Reference is expected!! 10/99 @@ -586,10 +606,8 @@ * (This deletes the original Ret_desc) */ - status = acpi_aml_resolve_operands (AML_LNOT_OP, &ret_desc); - if (status != AE_OK) { - acpi_aml_append_operand_diag (_THIS_MODULE, __LINE__, - opcode, WALK_OPERANDS, 1); + status = acpi_aml_resolve_operands (AML_LNOT_OP, &ret_desc, walk_state); + if (ACPI_FAILURE (status)) { goto cleanup; } @@ -604,7 +622,7 @@ /* Store the result back in the original descriptor */ - status = acpi_aml_exec_store (ret_desc, obj_desc); + status = acpi_aml_exec_store (ret_desc, obj_desc, walk_state); /* Objdesc was just deleted (because it is an Reference) */ @@ -662,19 +680,20 @@ case AML_LOCAL_OP: type = acpi_ds_method_data_get_type (MTH_TYPE_LOCAL, - (obj_desc->reference.offset)); + (obj_desc->reference.offset), walk_state); break; case AML_ARG_OP: type = acpi_ds_method_data_get_type (MTH_TYPE_ARG, - (obj_desc->reference.offset)); + (obj_desc->reference.offset), walk_state); break; default: + REPORT_ERROR ("Acpi_aml_exec_monadic2/Type_op:internal error: Unknown Reference subtype"); status = AE_AML_INTERNAL; goto cleanup; } @@ -682,8 +701,7 @@ else { /* - * Since we passed Acpi_aml_resolve_operands("l") and it's not a - * Reference, it must be a direct name pointer. + * It's not a Reference, so it must be a direct name pointer. */ type = acpi_ns_get_type ((ACPI_HANDLE) obj_desc); } @@ -764,7 +782,7 @@ case AML_REF_OF_OP: - status = acpi_aml_get_object_reference (obj_desc, &ret_desc); + status = acpi_aml_get_object_reference (obj_desc, &ret_desc, walk_state); if (ACPI_FAILURE (status)) { goto cleanup; } @@ -789,7 +807,7 @@ case AML_LOCAL_OP: acpi_ds_method_data_get_value (MTH_TYPE_LOCAL, - (obj_desc->reference.offset), &tmp_desc); + (obj_desc->reference.offset), walk_state, &tmp_desc); /* * Delete our reference to the input object and @@ -803,7 +821,7 @@ case AML_ARG_OP: acpi_ds_method_data_get_value (MTH_TYPE_ARG, - (obj_desc->reference.offset), &tmp_desc); + (obj_desc->reference.offset), walk_state, &tmp_desc); /* * Delete our reference to the input object and @@ -824,9 +842,9 @@ /* Obj_desc may have changed from the code above */ if (VALID_DESCRIPTOR_TYPE (obj_desc, ACPI_DESC_TYPE_NAMED)) { - /* Get the actual object from the NTE (This is the dereference) */ + /* Get the actual object from the Node (This is the dereference) */ - ret_desc = ((ACPI_NAMED_OBJECT*) obj_desc)->object; + ret_desc = ((ACPI_NAMESPACE_NODE *) obj_desc)->object; /* Returning a pointer to the object, add another reference! */ @@ -928,6 +946,7 @@ default: + REPORT_ERROR ("Acpi_aml_exec_monadic2: Internal error, unknown monadic opcode"); status = AE_AML_BAD_OPCODE; goto cleanup; } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/interpreter/amnames.c linux/drivers/acpi/interpreter/amnames.c --- v2.4.0-test8/linux/drivers/acpi/interpreter/amnames.c Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/interpreter/amnames.c Fri Sep 15 14:30:30 2000 @@ -2,6 +2,7 @@ /****************************************************************************** * * Module Name: amnames - interpreter/scanner name load/execute + * $Revision: 70 $ * *****************************************************************************/ @@ -25,12 +26,12 @@ #include "acpi.h" -#include "interp.h" +#include "acinterp.h" #include "amlcode.h" -#include "namesp.h" +#include "acnamesp.h" #define _COMPONENT INTERPRETER - MODULE_NAME ("amnames"); + MODULE_NAME ("amnames") /* AML Package Length encodings */ @@ -57,13 +58,13 @@ * ******************************************************************************/ -char * +NATIVE_CHAR * acpi_aml_allocate_name_string ( u32 prefix_count, u32 num_name_segs) { - char *temp_ptr; - char *name_string; + NATIVE_CHAR *temp_ptr; + NATIVE_CHAR *name_string; u32 size_needed; @@ -87,7 +88,7 @@ * This buffer must be deleted by the caller! */ - name_string = acpi_cm_allocate ((ACPI_SIZE) size_needed); + name_string = acpi_cm_allocate (size_needed); if (!name_string) { REPORT_ERROR ("Aml_allocate_name_string: name allocation failure"); return (NULL); @@ -133,52 +134,6 @@ return (name_string); } - -/******************************************************************************* - * - * FUNCTION: Acpi_aml_decode_package_length - * - * PARAMETERS: Last_pkg_len - latest value decoded by Do_pkg_length() for - * most recently examined package or field - * - * RETURN: Number of bytes contained in package length encoding - * - * DESCRIPTION: Decodes the Package Length. Upper 2 bits are are used to - * tell if type 1, 2, 3, or 4. - * 0x3F = Max 1 byte encoding, - * 0xFFF = Max 2 byte encoding, - * 0xFFFFF = Max 3 Byte encoding, - * 0xFFFFFFFFF = Max 4 Byte encoding. - * - ******************************************************************************/ - -u32 -acpi_aml_decode_package_length ( - u32 last_pkg_len) -{ - u32 num_bytes = 0; - - - if (last_pkg_len < ACPI_AML_PACKAGE_TYPE1) { - num_bytes = 1; - } - - else if (last_pkg_len < ACPI_AML_PACKAGE_TYPE2) { - num_bytes = 2; - } - - else if (last_pkg_len < ACPI_AML_PACKAGE_TYPE3) { - num_bytes = 3; - } - - else if (last_pkg_len < ACPI_AML_PACKAGE_TYPE4) { - num_bytes = 4; - } - - return (num_bytes); -} - - /******************************************************************************* * * FUNCTION: Acpi_aml_exec_name_segment @@ -194,12 +149,12 @@ ACPI_STATUS acpi_aml_exec_name_segment ( u8 **in_aml_address, - char *name_string) + NATIVE_CHAR *name_string) { u8 *aml_address = *in_aml_address; ACPI_STATUS status = AE_OK; - s32 index; - char char_buf[5]; + u32 index; + NATIVE_CHAR char_buf[5]; /* @@ -271,15 +226,16 @@ acpi_aml_get_name_string ( OBJECT_TYPE_INTERNAL data_type, u8 *in_aml_address, - char **out_name_string, + NATIVE_CHAR **out_name_string, u32 *out_name_length) { ACPI_STATUS status = AE_OK; u8 *aml_address = in_aml_address; - char *name_string = NULL; - s32 num_segments; - s32 prefix_count = 0; + NATIVE_CHAR *name_string = NULL; + u32 num_segments; + u32 prefix_count = 0; u8 prefix = 0; + u8 has_prefix = FALSE; if (INTERNAL_TYPE_DEF_FIELD == data_type || @@ -313,7 +269,8 @@ * Remember that we have a Root_prefix -- * see comment in Acpi_aml_allocate_name_string() */ - prefix_count = -1; + prefix_count = (u32) -1; + has_prefix = TRUE; break; @@ -327,7 +284,7 @@ ++prefix_count; } while (*aml_address == AML_PARENT_PREFIX); - + has_prefix = TRUE; break; @@ -351,9 +308,8 @@ break; } - /* Ensure Prefix_count != 0 to remember processing a prefix */ - - prefix_count += 2; + /* Indicate that we processed a prefix */ + has_prefix = TRUE; status = acpi_aml_exec_name_segment (&aml_address, name_string); if (ACPI_SUCCESS (status)) { @@ -375,9 +331,8 @@ break; } - /* Ensure Prefix_count != 0 to remember processing a prefix */ - - prefix_count += 2; + /* Indicate that we processed a prefix */ + has_prefix = TRUE; while (num_segments && (status = acpi_aml_exec_name_segment (&aml_address, name_string)) == AE_OK) @@ -422,7 +377,7 @@ } - if (AE_CTRL_PENDING == status && prefix_count != 0) { + 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"); diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/interpreter/amprep.c linux/drivers/acpi/interpreter/amprep.c --- v2.4.0-test8/linux/drivers/acpi/interpreter/amprep.c Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/interpreter/amprep.c Fri Sep 15 14:30:30 2000 @@ -2,6 +2,7 @@ /****************************************************************************** * * Module Name: amprep - ACPI AML (p-code) execution - field prep utilities + * $Revision: 67 $ * *****************************************************************************/ @@ -25,14 +26,14 @@ #include "acpi.h" -#include "interp.h" +#include "acinterp.h" #include "amlcode.h" -#include "namesp.h" -#include "parser.h" +#include "acnamesp.h" +#include "acparser.h" #define _COMPONENT INTERPRETER - MODULE_NAME ("amprep"); + MODULE_NAME ("amprep") /******************************************************************************* @@ -55,25 +56,25 @@ switch (access) { case ACCESS_ANY_ACC: - return 8; + return (8); break; case ACCESS_BYTE_ACC: - return 8; + return (8); break; case ACCESS_WORD_ACC: - return 16; + return (16); break; case ACCESS_DWORD_ACC: - return 32; + return (32); break; default: /* Invalid field access type */ - return 0; + return (0); } } @@ -98,7 +99,7 @@ ACPI_STATUS acpi_aml_prep_common_field_object ( - ACPI_OBJECT_INTERNAL *obj_desc, + ACPI_OPERAND_OBJECT *obj_desc, u8 field_flags, u8 field_attribute, u32 field_position, @@ -150,7 +151,7 @@ * * FUNCTION: Acpi_aml_prep_def_field_value * - * PARAMETERS: This_entry - Owning NTE + * PARAMETERS: Node - Owning Node * Region - Region in which field is being defined * Field_flags - Access, Lock_rule, or Update_rule. * The format of a Field_flag is described @@ -160,22 +161,22 @@ * * RETURN: Status * - * DESCRIPTION: Construct an ACPI_OBJECT_INTERNAL of type Def_field and - * connect it to the parent NTE. + * DESCRIPTION: Construct an ACPI_OPERAND_OBJECT of type Def_field and + * connect it to the parent Node. * ******************************************************************************/ ACPI_STATUS acpi_aml_prep_def_field_value ( - ACPI_NAMED_OBJECT *this_entry, + ACPI_NAMESPACE_NODE *node, ACPI_HANDLE region, u8 field_flags, u8 field_attribute, u32 field_position, u32 field_length) { - ACPI_OBJECT_INTERNAL *obj_desc; - s32 type; + ACPI_OPERAND_OBJECT *obj_desc; + u32 type; ACPI_STATUS status; @@ -220,11 +221,11 @@ /* Debug info */ /* - * Store the constructed descriptor (Obj_desc) into the nte whose - * handle is on TOS, preserving the current type of that nte. + * Store the constructed descriptor (Obj_desc) into the Named_obj whose + * handle is on TOS, preserving the current type of that Named_obj. */ - status = acpi_ns_attach_object ((ACPI_HANDLE) this_entry, obj_desc, - (u8) acpi_ns_get_type ((ACPI_HANDLE) this_entry)); + status = acpi_ns_attach_object ((ACPI_HANDLE) node, obj_desc, + (u8) acpi_ns_get_type ((ACPI_HANDLE) node)); return (status); } @@ -234,7 +235,7 @@ * * FUNCTION: Acpi_aml_prep_bank_field_value * - * PARAMETERS: This_entry - Owning NTE + * PARAMETERS: Node - Owning Node * Region - Region in which field is being defined * Bank_reg - Bank selection register * Bank_val - Value to store in selection register @@ -244,14 +245,14 @@ * * RETURN: Status * - * DESCRIPTION: Construct an ACPI_OBJECT_INTERNAL of type Bank_field and - * connect it to the parent NTE. + * DESCRIPTION: Construct an ACPI_OPERAND_OBJECT of type Bank_field and + * connect it to the parent Node. * ******************************************************************************/ ACPI_STATUS acpi_aml_prep_bank_field_value ( - ACPI_NAMED_OBJECT *this_entry, + ACPI_NAMESPACE_NODE *node, ACPI_HANDLE region, ACPI_HANDLE bank_reg, u32 bank_val, @@ -260,8 +261,8 @@ u32 field_position, u32 field_length) { - ACPI_OBJECT_INTERNAL *obj_desc; - s32 type; + ACPI_OPERAND_OBJECT *obj_desc; + u32 type; ACPI_STATUS status; @@ -308,11 +309,11 @@ /* Debug info */ /* - * Store the constructed descriptor (Obj_desc) into the nte whose - * handle is on TOS, preserving the current type of that nte. + * Store the constructed descriptor (Obj_desc) into the Named_obj whose + * handle is on TOS, preserving the current type of that Named_obj. */ - status = acpi_ns_attach_object ((ACPI_HANDLE) this_entry, obj_desc, - (u8) acpi_ns_get_type ((ACPI_HANDLE) this_entry)); + status = acpi_ns_attach_object ((ACPI_HANDLE) node, obj_desc, + (u8) acpi_ns_get_type ((ACPI_HANDLE) node)); return (status); } @@ -322,7 +323,7 @@ * * FUNCTION: Acpi_aml_prep_index_field_value * - * PARAMETERS: This_entry - Owning NTE + * PARAMETERS: Node - Owning Node * Index_reg - Index register * Data_reg - Data register * Field_flags - Access, Lock_rule, or Update_rule @@ -331,14 +332,14 @@ * * RETURN: Status * - * DESCRIPTION: Construct an ACPI_OBJECT_INTERNAL of type Index_field and - * connect it to the parent NTE. + * DESCRIPTION: Construct an ACPI_OPERAND_OBJECT of type Index_field and + * connect it to the parent Node. * ******************************************************************************/ ACPI_STATUS acpi_aml_prep_index_field_value ( - ACPI_NAMED_OBJECT *this_entry, + ACPI_NAMESPACE_NODE *node, ACPI_HANDLE index_reg, ACPI_HANDLE data_reg, u8 field_flags, @@ -346,7 +347,7 @@ u32 field_position, u32 field_length) { - ACPI_OBJECT_INTERNAL *obj_desc; + ACPI_OPERAND_OBJECT *obj_desc; ACPI_STATUS status; @@ -381,11 +382,11 @@ /* Debug info */ /* - * Store the constructed descriptor (Obj_desc) into the nte whose - * handle is on TOS, preserving the current type of that nte. + * Store the constructed descriptor (Obj_desc) into the Named_obj whose + * handle is on TOS, preserving the current type of that Named_obj. */ - status = acpi_ns_attach_object ((ACPI_HANDLE) this_entry, obj_desc, - (u8) acpi_ns_get_type ((ACPI_HANDLE) this_entry)); + status = acpi_ns_attach_object ((ACPI_HANDLE) node, obj_desc, + (u8) acpi_ns_get_type ((ACPI_HANDLE) node)); return (status); } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/interpreter/amregion.c linux/drivers/acpi/interpreter/amregion.c --- v2.4.0-test8/linux/drivers/acpi/interpreter/amregion.c Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/interpreter/amregion.c Fri Sep 15 14:30:30 2000 @@ -1,6 +1,8 @@ + /****************************************************************************** * * Module Name: amregion - ACPI default Op_region (address space) handlers + * $Revision: 35 $ * *****************************************************************************/ @@ -24,15 +26,15 @@ #include "acpi.h" -#include "interp.h" +#include "acinterp.h" #include "amlcode.h" -#include "namesp.h" -#include "hardware.h" -#include "events.h" +#include "acnamesp.h" +#include "achware.h" +#include "acevents.h" #define _COMPONENT INTERPRETER - MODULE_NAME ("amregion"); + MODULE_NAME ("amregion") /******************************************************************************* @@ -43,7 +45,9 @@ * Address - Where in the space to read or write * Bit_width - Field width in bits (8, 16, or 32) * Value - Pointer to in or out value - * Context - Context pointer + * Handler_context - Pointer to Handler's context + * Region_context - Pointer to context specific to the + * accessed region * * RETURN: Status * @@ -57,11 +61,12 @@ u32 address, /* TBD: [Future] Should this be A POINTER for 64-bit support? */ u32 bit_width, u32 *value, - void *context) + void *handler_context, + void *region_context) { ACPI_STATUS status = AE_OK; void *logical_addr_ptr = NULL; - MEM_HANDLER_CONTEXT *mem_info = context; + MEM_HANDLER_CONTEXT *mem_info = region_context; u32 length; @@ -93,8 +98,8 @@ * 2) Address beyond the current mapping? */ - if (((char *) address < mem_info->mapped_physical_address) || - (((char *) address + length) > + if (((u8 *) address < mem_info->mapped_physical_address) || + (((u8 *) address + length) > (mem_info->mapped_physical_address + mem_info->mapped_length))) { /* @@ -119,7 +124,7 @@ return (status); } - mem_info->mapped_physical_address = (char *) address; + mem_info->mapped_physical_address = (u8 *) address; mem_info->mapped_length = SYSMEM_REGION_WINDOW_SIZE; } @@ -130,7 +135,7 @@ */ logical_addr_ptr = mem_info->mapped_logical_address + - ((char *) address - mem_info->mapped_physical_address); + ((u8 *) address - mem_info->mapped_physical_address); /* Perform the memory read or write */ @@ -194,7 +199,9 @@ * Address - Where in the space to read or write * Bit_width - Field width in bits (8, 16, or 32) * Value - Pointer to in or out value - * Context - Context pointer + * Handler_context - Pointer to Handler's context + * Region_context - Pointer to context specific to the + * accessed region * * RETURN: Status * @@ -208,7 +215,8 @@ u32 address, u32 bit_width, u32 *value, - void *context) + void *handler_context, + void *region_context) { ACPI_STATUS status = AE_OK; @@ -283,7 +291,9 @@ * Address - Where in the space to read or write * Bit_width - Field width in bits (8, 16, or 32) * Value - Pointer to in or out value - * Context - Context pointer + * Handler_context - Pointer to Handler's context + * Region_context - Pointer to context specific to the + * accessed region * * RETURN: Status * @@ -297,7 +307,8 @@ u32 address, u32 bit_width, u32 *value, - void *context) + void *handler_context, + void *region_context) { ACPI_STATUS status = AE_OK; u32 pci_bus; @@ -321,7 +332,7 @@ * */ - PCIcontext = (PCI_HANDLER_CONTEXT *) context; + PCIcontext = (PCI_HANDLER_CONTEXT *) region_context; pci_bus = LOWORD(PCIcontext->seg) << 16; pci_bus |= LOWORD(PCIcontext->bus); @@ -365,7 +376,6 @@ case ADDRESS_SPACE_WRITE: - switch (bit_width) { diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/interpreter/amresnte.c linux/drivers/acpi/interpreter/amresnte.c --- v2.4.0-test8/linux/drivers/acpi/interpreter/amresnte.c Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/interpreter/amresnte.c Fri Sep 15 14:30:30 2000 @@ -2,6 +2,7 @@ /****************************************************************************** * * Module Name: amresnte - AML Interpreter object resolution + * $Revision: 21 $ * *****************************************************************************/ @@ -26,32 +27,33 @@ #include "acpi.h" #include "amlcode.h" -#include "parser.h" -#include "dispatch.h" -#include "interp.h" -#include "namesp.h" -#include "tables.h" -#include "events.h" +#include "acparser.h" +#include "acdispat.h" +#include "acinterp.h" +#include "acnamesp.h" +#include "actables.h" +#include "acevents.h" #define _COMPONENT INTERPRETER - MODULE_NAME ("amresnte"); + MODULE_NAME ("amresnte") /******************************************************************************* * - * FUNCTION: Acpi_aml_resolve_entry_to_value + * FUNCTION: Acpi_aml_resolve_node_to_value * * PARAMETERS: Stack_ptr - Pointer to a location on a stack that contains - * a ptr to an NTE + * a pointer to an Node * * RETURN: Status * - * DESCRIPTION: Resolve a ACPI_NAMED_OBJECT(nte, A.K.A. a "direct name pointer") + * DESCRIPTION: Resolve a ACPI_NAMESPACE_NODE (Node, + * A.K.A. a "direct name pointer") * - * Note: for some of the data types, the pointer attached to the NTE can be - * either a pointer to an actual internal object or a pointer into the AML - * stream itself. These types are currently: + * Note: for some of the data types, the pointer attached to the Node + * can be either a pointer to an actual internal object or a pointer into the + * AML stream itself. These types are currently: * * ACPI_TYPE_NUMBER * ACPI_TYPE_STRING @@ -62,13 +64,13 @@ ******************************************************************************/ ACPI_STATUS -acpi_aml_resolve_entry_to_value ( - ACPI_NAMED_OBJECT **stack_ptr) +acpi_aml_resolve_node_to_value ( + ACPI_NAMESPACE_NODE **stack_ptr) { ACPI_STATUS status = AE_OK; - ACPI_OBJECT_INTERNAL *val_desc = NULL; - ACPI_OBJECT_INTERNAL *obj_desc = NULL; - ACPI_NAMED_OBJECT *stack_entry; + ACPI_OPERAND_OBJECT *val_desc = NULL; + ACPI_OPERAND_OBJECT *obj_desc = NULL; + ACPI_NAMESPACE_NODE *node; u8 *aml_pointer = NULL; OBJECT_TYPE_INTERNAL entry_type; u8 locked; @@ -78,20 +80,20 @@ OBJECT_TYPE_INTERNAL object_type; - stack_entry = *stack_ptr; + node = *stack_ptr; /* * The stack pointer is a "Direct name ptr", and points to a - * a ACPI_NAMED_OBJECT(nte). Get the pointer that is attached to - * the nte. + * a ACPI_NAMESPACE_NODE (Node). Get the pointer that is attached to + * the Node. */ - val_desc = acpi_ns_get_attached_object ((ACPI_HANDLE) stack_entry); - entry_type = acpi_ns_get_type ((ACPI_HANDLE) stack_entry); + val_desc = acpi_ns_get_attached_object ((ACPI_HANDLE) node); + entry_type = acpi_ns_get_type ((ACPI_HANDLE) node); /* - * The Val_desc attached to the NTE can be either: + * The Val_desc attached to the Node can be either: * 1) An internal ACPI object * 2) A pointer into the AML stream (into one of the ACPI system tables) */ @@ -105,7 +107,25 @@ /* - * Action is based on the type of the NTE, which indicates the type + * Several Entry_types do not require further processing, so + * we will return immediately + */ + /* Devices rarely have an attached object, return the Node + * and Method locals and arguments have a pseudo-Node + */ + if (entry_type == ACPI_TYPE_DEVICE || + entry_type == INTERNAL_TYPE_METHOD_ARGUMENT || + entry_type == INTERNAL_TYPE_METHOD_LOCAL_VAR) + { + return (AE_OK); + } + + if (!val_desc) { + return (AE_AML_NO_OPERAND); + } + + /* + * Action is based on the type of the Node, which indicates the type * of the attached object or pointer */ switch (entry_type) @@ -113,15 +133,6 @@ case ACPI_TYPE_PACKAGE: - /* - * Val_desc should point to either an ACPI_OBJECT_INTERNAL of - * type Package, or an initialization in the AML stream. - */ - if (!val_desc) { - return (AE_AML_NO_OPERAND); - } - - if (attached_aml_pointer) { /* * This means that the package initialization is not parsed @@ -132,7 +143,7 @@ /* Val_desc is an internal object in all cases by the time we get here */ - if (!val_desc || (ACPI_TYPE_PACKAGE != val_desc->common.type)) { + if (ACPI_TYPE_PACKAGE != val_desc->common.type) { return (AE_AML_OPERAND_TYPE); } @@ -145,10 +156,6 @@ case ACPI_TYPE_BUFFER: - if (!val_desc) { - return (AE_AML_NO_OPERAND); - } - if (attached_aml_pointer) { /* * This means that the buffer initialization is not parsed @@ -159,7 +166,7 @@ /* Val_desc is an internal object in all cases by the time we get here */ - if (!val_desc || (ACPI_TYPE_BUFFER != val_desc->common.type)) { + if (ACPI_TYPE_BUFFER != val_desc->common.type) { return (AE_AML_OPERAND_TYPE); } @@ -183,8 +190,8 @@ /* Init the internal object */ - obj_desc->string.pointer = (char *) aml_pointer; - obj_desc->string.length = STRLEN (aml_pointer); + obj_desc->string.pointer = (NATIVE_CHAR *) aml_pointer; + obj_desc->string.length = STRLEN (obj_desc->string.pointer); } else { @@ -203,11 +210,6 @@ case ACPI_TYPE_NUMBER: - if (!val_desc) { - return (AE_AML_NO_OPERAND); - } - - /* * An ACPI_TYPE_NUMBER can be either an object or an AML pointer */ @@ -279,7 +281,7 @@ else { /* - * The NTE has an attached internal object, make sure that it's a + * The Node has an attached internal object, make sure that it's a * number */ @@ -337,18 +339,21 @@ obj_desc->buffer.length = val_desc->field.length; - status = acpi_aml_get_named_field_value ((ACPI_HANDLE) stack_entry, - 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 (AE_OK != status) { + if (ACPI_FAILURE (status)) { return (status); } } else { - status = acpi_aml_get_named_field_value ((ACPI_HANDLE) stack_entry, + status = acpi_aml_access_named_field (ACPI_READ, + (ACPI_HANDLE) node, &temp_val, sizeof (temp_val)); - if (AE_OK != status) { + if (ACPI_FAILURE (status)) { return (status); } @@ -361,10 +366,6 @@ case INTERNAL_TYPE_BANK_FIELD: - if (!val_desc) { - return (AE_AML_NO_OPERAND); - } - if (attached_aml_pointer) { return (AE_AML_OPERAND_TYPE); } @@ -376,30 +377,30 @@ /* Get the global lock if needed */ - obj_desc = (ACPI_OBJECT_INTERNAL *) *stack_ptr; + obj_desc = (ACPI_OPERAND_OBJECT *) *stack_ptr; locked = acpi_aml_acquire_global_lock (obj_desc->field_unit.lock_rule); - { - /* Set Index value to select proper Data register */ - /* perform the update */ + /* Set Index value to select proper Data register */ + /* perform the update */ + + status = acpi_aml_access_named_field (ACPI_WRITE, + val_desc->bank_field.bank_select, + &val_desc->bank_field.value, + sizeof (val_desc->bank_field.value)); - status = acpi_aml_set_named_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); - if (AE_OK != status) { + if (ACPI_FAILURE (status)) { return (status); } /* Read Data value */ - status = acpi_aml_get_named_field_value ( + status = acpi_aml_access_named_field (ACPI_READ, (ACPI_HANDLE) val_desc->bank_field.container, &temp_val, sizeof (temp_val)); - if (AE_OK != status) { + if (ACPI_FAILURE (status)) { return (status); } @@ -414,10 +415,6 @@ case INTERNAL_TYPE_INDEX_FIELD: - if (!val_desc) { - return (AE_AML_NO_OPERAND); - } - if (attached_aml_pointer) { return (AE_AML_OPERAND_TYPE); } @@ -430,25 +427,27 @@ /* Set Index value to select proper Data register */ /* Get the global lock if needed */ - obj_desc = (ACPI_OBJECT_INTERNAL *) *stack_ptr; + obj_desc = (ACPI_OPERAND_OBJECT *) *stack_ptr; locked = acpi_aml_acquire_global_lock (obj_desc->field_unit.lock_rule); - { - /* Perform the update */ - status = acpi_aml_set_named_field_value (val_desc->index_field.index, - &val_desc->index_field.value, - sizeof (val_desc->index_field.value)); - } + /* Perform the update */ + status = acpi_aml_access_named_field (ACPI_WRITE, + val_desc->index_field.index, + &val_desc->index_field.value, + sizeof (val_desc->index_field.value)); + acpi_aml_release_global_lock (locked); - if (AE_OK != status) { + if (ACPI_FAILURE (status)) { return (status); } /* Read Data value */ - status = acpi_aml_get_named_field_value (val_desc->index_field.data, &temp_val, sizeof (temp_val)); - if (AE_OK != status) { + status = acpi_aml_access_named_field (ACPI_READ, + val_desc->index_field.data, + &temp_val, sizeof (temp_val)); + if (ACPI_FAILURE (status)) { return (status); } @@ -463,10 +462,6 @@ case ACPI_TYPE_FIELD_UNIT: - if (!val_desc) { - return (AE_AML_NO_OPERAND); - } - if (attached_aml_pointer) { return (AE_AML_OPERAND_TYPE); } @@ -481,7 +476,8 @@ return (AE_NO_MEMORY); } - if ((status = acpi_aml_get_field_unit_value (val_desc, obj_desc)) != AE_OK) { + status = acpi_aml_get_field_unit_value (val_desc, obj_desc); + if (ACPI_FAILURE (status)) { acpi_cm_remove_reference (obj_desc); return (status); } @@ -490,7 +486,7 @@ /* - * For these objects, just return the object attached to the NTE + * For these objects, just return the object attached to the Node */ case ACPI_TYPE_MUTEX: @@ -502,32 +498,11 @@ case ACPI_TYPE_REGION: - /* There must be an object attached to this NTE */ - - if (!val_desc) { - return (AE_AML_INTERNAL); - } - /* Return an additional reference to the object */ obj_desc = val_desc; acpi_cm_add_reference (obj_desc); break; - - - /* Devices rarely have an attached object, return the NTE */ - - case ACPI_TYPE_DEVICE: - - - /* Method locals and arguments have a pseudo-NTE, just return it */ - - case INTERNAL_TYPE_METHOD_ARGUMENT: - case INTERNAL_TYPE_METHOD_LOCAL_VAR: - - return (AE_OK); - break; - /* TYPE_Any is untyped, and thus there is no object associated with it */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/interpreter/amresolv.c linux/drivers/acpi/interpreter/amresolv.c --- v2.4.0-test8/linux/drivers/acpi/interpreter/amresolv.c Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/interpreter/amresolv.c Fri Sep 15 14:30:30 2000 @@ -2,6 +2,7 @@ /****************************************************************************** * * Module Name: amresolv - AML Interpreter object resolution + * $Revision: 74 $ * *****************************************************************************/ @@ -26,16 +27,16 @@ #include "acpi.h" #include "amlcode.h" -#include "parser.h" -#include "dispatch.h" -#include "interp.h" -#include "namesp.h" -#include "tables.h" -#include "events.h" +#include "acparser.h" +#include "acdispat.h" +#include "acinterp.h" +#include "acnamesp.h" +#include "actables.h" +#include "acevents.h" #define _COMPONENT INTERPRETER - MODULE_NAME ("amresolv"); + MODULE_NAME ("amresolv") /******************************************************************************* @@ -55,8 +56,8 @@ ACPI_STATUS acpi_aml_get_field_unit_value ( - ACPI_OBJECT_INTERNAL *field_desc, - ACPI_OBJECT_INTERNAL *result_desc) + ACPI_OPERAND_OBJECT *field_desc, + ACPI_OPERAND_OBJECT *result_desc) { ACPI_STATUS status = AE_OK; u32 mask; @@ -143,7 +144,7 @@ * FUNCTION: Acpi_aml_resolve_to_value * * PARAMETERS: **Stack_ptr - Points to entry on Obj_stack, which can - * be either an (ACPI_OBJECT_INTERNAL *) + * be either an (ACPI_OPERAND_OBJECT *) * or an ACPI_HANDLE. * * RETURN: Status @@ -154,7 +155,8 @@ ACPI_STATUS acpi_aml_resolve_to_value ( - ACPI_OBJECT_INTERNAL **stack_ptr) + ACPI_OPERAND_OBJECT **stack_ptr, + ACPI_WALK_STATE *walk_state) { ACPI_STATUS status = AE_OK; @@ -166,13 +168,13 @@ /* * The entity pointed to by the Stack_ptr can be either - * 1) A valid ACPI_OBJECT_INTERNAL, or - * 2) A ACPI_NAMED_OBJECT(nte) + * 1) A valid ACPI_OPERAND_OBJECT, or + * 2) A ACPI_NAMESPACE_NODE (Named_obj) */ if (VALID_DESCRIPTOR_TYPE (*stack_ptr, ACPI_DESC_TYPE_INTERNAL)) { - status = acpi_aml_resolve_object_to_value (stack_ptr); + status = acpi_aml_resolve_object_to_value (stack_ptr, walk_state); if (ACPI_FAILURE (status)) { return (status); } @@ -184,7 +186,7 @@ */ if (VALID_DESCRIPTOR_TYPE (*stack_ptr, ACPI_DESC_TYPE_NAMED)) { - status = acpi_aml_resolve_entry_to_value ((ACPI_NAMED_OBJECT**) stack_ptr); + status = acpi_aml_resolve_node_to_value ((ACPI_NAMESPACE_NODE **) stack_ptr); } @@ -208,19 +210,20 @@ ACPI_STATUS acpi_aml_resolve_object_to_value ( - ACPI_OBJECT_INTERNAL **stack_ptr) + ACPI_OPERAND_OBJECT **stack_ptr, + ACPI_WALK_STATE *walk_state) { - ACPI_OBJECT_INTERNAL *stack_desc; + ACPI_OPERAND_OBJECT *stack_desc; ACPI_STATUS status = AE_OK; ACPI_HANDLE temp_handle = NULL; - ACPI_OBJECT_INTERNAL *obj_desc = NULL; + ACPI_OPERAND_OBJECT *obj_desc = NULL; u32 index = 0; u16 opcode; stack_desc = *stack_ptr; - /* This is an ACPI_OBJECT_INTERNAL */ + /* This is an ACPI_OPERAND_OBJECT */ switch (stack_desc->common.type) { @@ -236,7 +239,7 @@ /* * Convert indirect name ptr to a direct name ptr. - * Then, Acpi_aml_resolve_entry_to_value can be used to get the value + * Then, Acpi_aml_resolve_node_to_value can be used to get the value */ temp_handle = stack_desc->reference.object; @@ -256,24 +259,26 @@ index = stack_desc->reference.offset; - /* Delete the Reference Object */ - - acpi_cm_remove_reference (stack_desc); - /* * Get the local from the method's state info - * Note: this increments the object reference count + * Note: this increments the local's object reference count */ status = acpi_ds_method_data_get_value (MTH_TYPE_LOCAL, index, - stack_ptr); + walk_state, &obj_desc); if (ACPI_FAILURE (status)) { return (status); } - stack_desc = *stack_ptr; + /* + * Now we can delete the original Reference Object and + * replace it with the resolve value + */ + + acpi_cm_remove_reference (stack_desc); + *stack_ptr = obj_desc; - if (ACPI_TYPE_NUMBER == stack_desc->common.type) { + if (ACPI_TYPE_NUMBER == obj_desc->common.type) { /* Value is a Number */ } @@ -285,9 +290,6 @@ index = stack_desc->reference.offset; - /* Delete the Reference Object*/ - - acpi_cm_remove_reference (stack_desc); /* * Get the argument from the method's state info @@ -295,14 +297,20 @@ */ status = acpi_ds_method_data_get_value (MTH_TYPE_ARG, index, - stack_ptr); + walk_state, &obj_desc); if (ACPI_FAILURE (status)) { return (status); } - stack_desc = *stack_ptr; + /* + * Now we can delete the original Reference Object and + * replace it with the resolve value + */ + + acpi_cm_remove_reference (stack_desc); + *stack_ptr = obj_desc; - if (ACPI_TYPE_NUMBER == stack_desc->common.type) { + if (ACPI_TYPE_NUMBER == obj_desc->common.type) { /* Value is a Number */ } @@ -392,7 +400,7 @@ } /* switch (Opcode) */ - if (AE_OK != status) { + if (ACPI_FAILURE (status)) { return (status); } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/interpreter/amresop.c linux/drivers/acpi/interpreter/amresop.c --- v2.4.0-test8/linux/drivers/acpi/interpreter/amresop.c Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/interpreter/amresop.c Fri Sep 15 14:30:30 2000 @@ -2,6 +2,7 @@ /****************************************************************************** * * Module Name: amresop - AML Interpreter operand/object resolution + * $Revision: 15 $ * *****************************************************************************/ @@ -26,16 +27,16 @@ #include "acpi.h" #include "amlcode.h" -#include "parser.h" -#include "dispatch.h" -#include "interp.h" -#include "namesp.h" -#include "tables.h" -#include "events.h" +#include "acparser.h" +#include "acdispat.h" +#include "acinterp.h" +#include "acnamesp.h" +#include "actables.h" +#include "acevents.h" #define _COMPONENT INTERPRETER - MODULE_NAME ("amresop"); + MODULE_NAME ("amresop") /******************************************************************************* @@ -60,19 +61,20 @@ ACPI_STATUS acpi_aml_resolve_operands ( u16 opcode, - ACPI_OBJECT_INTERNAL **stack_ptr) + ACPI_OPERAND_OBJECT **stack_ptr, + ACPI_WALK_STATE *walk_state) { - ACPI_OBJECT_INTERNAL *obj_desc; + ACPI_OPERAND_OBJECT *obj_desc; ACPI_STATUS status = AE_OK; u8 object_type; ACPI_HANDLE temp_handle; u32 arg_types; - ACPI_OP_INFO *op_info; + ACPI_OPCODE_INFO *op_info; u32 this_arg_type; op_info = acpi_ps_get_opcode_info (opcode); - if (!op_info) { + if (ACPI_GET_OP_TYPE (op_info) != ACPI_OP_TYPE_OPCODE) { return (AE_AML_BAD_OPCODE); } @@ -105,9 +107,9 @@ /* Decode the descriptor type */ if (VALID_DESCRIPTOR_TYPE (obj_desc, ACPI_DESC_TYPE_NAMED)) { - /* NTE */ + /* Node */ - object_type = ((ACPI_NAMED_OBJECT*) obj_desc)->type; + object_type = ((ACPI_NAMESPACE_NODE *) obj_desc)->type; } else if (VALID_DESCRIPTOR_TYPE (obj_desc, ACPI_DESC_TYPE_INTERNAL)) { @@ -128,7 +130,7 @@ */ op_info = acpi_ps_get_opcode_info (opcode); - if (!op_info) { + if (ACPI_GET_OP_TYPE (op_info) != ACPI_OP_TYPE_OPCODE) { return (AE_AML_BAD_OPCODE); } @@ -205,7 +207,8 @@ /* Need an operand of type ACPI_TYPE_NUMBER */ - if ((status = acpi_aml_resolve_to_value (stack_ptr)) != AE_OK) { + status = acpi_aml_resolve_to_value (stack_ptr, walk_state); + if (ACPI_FAILURE (status)) { goto cleanup; } @@ -220,7 +223,8 @@ /* Need an operand of type ACPI_TYPE_STRING or ACPI_TYPE_BUFFER */ - if ((status = acpi_aml_resolve_to_value (stack_ptr)) != AE_OK) { + status = acpi_aml_resolve_to_value (stack_ptr, walk_state); + if (ACPI_FAILURE (status)) { goto cleanup; } @@ -237,7 +241,8 @@ /* Need an operand of type ACPI_TYPE_BUFFER */ - if ((status = acpi_aml_resolve_to_value(stack_ptr)) != AE_OK) { + status = acpi_aml_resolve_to_value (stack_ptr, walk_state); + if (ACPI_FAILURE (status)) { goto cleanup; } @@ -252,7 +257,8 @@ /* Need an operand of type ACPI_TYPE_MUTEX */ - if ((status = acpi_aml_resolve_to_value(stack_ptr)) != AE_OK) { + status = acpi_aml_resolve_to_value (stack_ptr, walk_state); + if (ACPI_FAILURE (status)) { goto cleanup; } @@ -267,7 +273,8 @@ /* Need an operand of type ACPI_TYPE_EVENT */ - if ((status = acpi_aml_resolve_to_value(stack_ptr)) != AE_OK) { + status = acpi_aml_resolve_to_value (stack_ptr, walk_state); + if (ACPI_FAILURE (status)) { goto cleanup; } @@ -282,7 +289,8 @@ /* Need an operand of type ACPI_TYPE_REGION */ - if ((status = acpi_aml_resolve_to_value(stack_ptr)) != AE_OK) { + status = acpi_aml_resolve_to_value (stack_ptr, walk_state); + if (ACPI_FAILURE (status)) { goto cleanup; } @@ -308,7 +316,8 @@ /* Need an operand of type ACPI_TYPE_PACKAGE */ - if ((status = acpi_aml_resolve_to_value (stack_ptr)) != AE_OK) { + status = acpi_aml_resolve_to_value (stack_ptr, walk_state); + if (ACPI_FAILURE (status)) { goto cleanup; } @@ -337,7 +346,8 @@ /* All others must be resolved */ - if ((status = acpi_aml_resolve_to_value (stack_ptr)) != AE_OK) { + status = acpi_aml_resolve_to_value (stack_ptr, walk_state); + if (ACPI_FAILURE (status)) { goto cleanup; } @@ -352,15 +362,16 @@ * * The ACPI specification allows Size_of to return the size of * a Buffer, String or Package. However, the MS ACPI.SYS AML - * Interpreter also allows an NTE reference to return without + * Interpreter also allows an Node reference to return without * error with a size of 4. */ - if ((status = acpi_aml_resolve_to_value (stack_ptr)) != AE_OK) { + status = acpi_aml_resolve_to_value (stack_ptr, walk_state); + if (ACPI_FAILURE (status)) { goto cleanup; } - /* Need a buffer, string, package or NTE reference */ + /* Need a buffer, string, package or Node reference */ if (((*stack_ptr)->common.type != ACPI_TYPE_BUFFER) && ((*stack_ptr)->common.type != ACPI_TYPE_STRING) && @@ -372,10 +383,10 @@ } /* - * If this is a reference, only allow a reference to an NTE. + * If this is a reference, only allow a reference to an Node. */ if ((*stack_ptr)->common.type == INTERNAL_TYPE_REFERENCE) { - if (!(*stack_ptr)->reference.nte) { + if (!(*stack_ptr)->reference.node) { status = AE_AML_OPERAND_TYPE; goto cleanup; } @@ -386,7 +397,8 @@ case ARGI_COMPLEXOBJ: - if ((status = acpi_aml_resolve_to_value (stack_ptr)) != AE_OK) { + status = acpi_aml_resolve_to_value (stack_ptr, walk_state); + if (ACPI_FAILURE (status)) { goto cleanup; } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/interpreter/amstore.c linux/drivers/acpi/interpreter/amstore.c --- v2.4.0-test8/linux/drivers/acpi/interpreter/amstore.c Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/interpreter/amstore.c Fri Sep 15 14:30:30 2000 @@ -2,6 +2,7 @@ /****************************************************************************** * * Module Name: amstore - AML Interpreter object store support + * $Revision: 116 $ * *****************************************************************************/ @@ -25,16 +26,16 @@ #include "acpi.h" -#include "parser.h" -#include "dispatch.h" -#include "interp.h" +#include "acparser.h" +#include "acdispat.h" +#include "acinterp.h" #include "amlcode.h" -#include "namesp.h" -#include "tables.h" +#include "acnamesp.h" +#include "actables.h" #define _COMPONENT INTERPRETER - MODULE_NAME ("amstore"); + MODULE_NAME ("amstore") /******************************************************************************* @@ -43,7 +44,7 @@ * * PARAMETERS: *Val_desc - Value to be stored * *Dest_desc - Where to store it 0 Must be (ACPI_HANDLE) - * or an ACPI_OBJECT_INTERNAL of type + * or an ACPI_OPERAND_OBJECT of type * Reference; if the latter the descriptor * will be either reused or deleted. * @@ -58,13 +59,14 @@ ACPI_STATUS acpi_aml_exec_store ( - ACPI_OBJECT_INTERNAL *val_desc, - ACPI_OBJECT_INTERNAL *dest_desc) + ACPI_OPERAND_OBJECT *val_desc, + ACPI_OPERAND_OBJECT *dest_desc, + ACPI_WALK_STATE *walk_state) { ACPI_STATUS status = AE_OK; - ACPI_OBJECT_INTERNAL *delete_dest_desc = NULL; - ACPI_OBJECT_INTERNAL *tmp_desc; - ACPI_NAMED_OBJECT *entry = NULL; + ACPI_OPERAND_OBJECT *delete_dest_desc = NULL; + ACPI_OPERAND_OBJECT *tmp_desc; + ACPI_NAMESPACE_NODE *node = NULL; u8 value = 0; u32 length; u32 i; @@ -81,7 +83,7 @@ if (VALID_DESCRIPTOR_TYPE (dest_desc, ACPI_DESC_TYPE_NAMED)) { /* Dest is an ACPI_HANDLE, create a new object */ - entry = (ACPI_NAMED_OBJECT*) dest_desc; + node = (ACPI_NAMESPACE_NODE *) dest_desc; dest_desc = acpi_cm_create_internal_object (INTERNAL_TYPE_REFERENCE); if (!dest_desc) { /* Allocation failure */ @@ -92,7 +94,7 @@ /* Build a new Reference wrapper around the handle */ dest_desc->reference.op_code = AML_NAME_OP; - dest_desc->reference.object = entry; + dest_desc->reference.object = node; } @@ -115,7 +117,8 @@ * Storing into a Name */ delete_dest_desc = dest_desc; - status = acpi_aml_store_object_to_nte (val_desc, dest_desc->reference.object); + status = acpi_aml_store_object_to_node (val_desc, dest_desc->reference.object, + walk_state); break; /* Case Name_op */ @@ -182,7 +185,7 @@ */ if (ACPI_TYPE_PACKAGE == tmp_desc->common.type) { status = acpi_aml_build_copy_internal_package_object ( - val_desc, tmp_desc); + val_desc, tmp_desc, walk_state); if (ACPI_FAILURE (status)) { acpi_cm_remove_reference (tmp_desc); tmp_desc = NULL; @@ -206,7 +209,8 @@ * convert the contents of the source (Val_desc) and copy into * the destination (Tmp_desc) */ - status = acpi_aml_store_object_to_object(val_desc, tmp_desc); + status = acpi_aml_store_object_to_object (val_desc, tmp_desc, + walk_state); if (ACPI_FAILURE (status)) { /* * An error occurrered when copying the internal object @@ -299,7 +303,7 @@ /* * If we had an error, break out of this case statement. */ - if(AE_OK != status) { + if (ACPI_FAILURE (status)) { break; } @@ -315,7 +319,7 @@ case AML_ONES_OP: /* - * Storing to a constant is a no-op -- see spec sec 15.2.3.3.1. + * Storing to a constant is a no-op -- see ACPI Specification * Delete the result descriptor. */ @@ -326,7 +330,7 @@ case AML_LOCAL_OP: status = acpi_ds_method_data_set_value (MTH_TYPE_LOCAL, - (dest_desc->reference.offset), val_desc); + (dest_desc->reference.offset), val_desc, walk_state); delete_dest_desc = dest_desc; break; @@ -334,7 +338,7 @@ case AML_ARG_OP: status = acpi_ds_method_data_set_value (MTH_TYPE_ARG, - (dest_desc->reference.offset), val_desc); + (dest_desc->reference.offset), val_desc, walk_state); delete_dest_desc = dest_desc; break; @@ -343,7 +347,7 @@ /* * Storing to the Debug object causes the value stored to be - * displayed and otherwise has no effect -- see sec. 15.2.3.3.3. + * displayed and otherwise has no effect -- see ACPI Specification */ delete_dest_desc = dest_desc; diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/interpreter/amstoren.c linux/drivers/acpi/interpreter/amstoren.c --- v2.4.0-test8/linux/drivers/acpi/interpreter/amstoren.c Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/interpreter/amstoren.c Fri Sep 15 14:30:30 2000 @@ -1,7 +1,9 @@ /****************************************************************************** * - * Module Name: amstoren - AML Interpreter object store support, store to NTE + * Module Name: amstoren - AML Interpreter object store support, + * Store to Node (namespace object) + * $Revision: 21 $ * *****************************************************************************/ @@ -25,24 +27,24 @@ #include "acpi.h" -#include "parser.h" -#include "dispatch.h" -#include "interp.h" +#include "acparser.h" +#include "acdispat.h" +#include "acinterp.h" #include "amlcode.h" -#include "namesp.h" -#include "tables.h" +#include "acnamesp.h" +#include "actables.h" #define _COMPONENT INTERPRETER - MODULE_NAME ("amstoren"); + MODULE_NAME ("amstoren") /******************************************************************************* * - * FUNCTION: Acpi_aml_store_object_to_nte + * FUNCTION: Acpi_aml_store_object_to_node * * PARAMETERS: *Val_desc - Value to be stored - * *Entry - Named object to recieve the value + * *Node - Named object to recieve the value * * RETURN: Status * @@ -65,9 +67,10 @@ ******************************************************************************/ ACPI_STATUS -acpi_aml_store_object_to_nte ( - ACPI_OBJECT_INTERNAL *val_desc, - ACPI_NAMED_OBJECT *entry) +acpi_aml_store_object_to_node ( + ACPI_OPERAND_OBJECT *val_desc, + ACPI_NAMESPACE_NODE *node, + ACPI_WALK_STATE *walk_state) { ACPI_STATUS status = AE_OK; u8 *buffer = NULL; @@ -76,16 +79,16 @@ u32 new_value; u8 locked = FALSE; u8 *location=NULL; - ACPI_OBJECT_INTERNAL *dest_desc; + ACPI_OPERAND_OBJECT *dest_desc; OBJECT_TYPE_INTERNAL destination_type = ACPI_TYPE_ANY; /* * Assuming the parameters are valid!!! */ - ACPI_ASSERT((entry) && (val_desc)); + ACPI_ASSERT((node) && (val_desc)); - destination_type = acpi_ns_get_type (entry); + destination_type = acpi_ns_get_type (node); /* * First ensure we have a value that can be stored in the target @@ -120,8 +123,8 @@ /* * Initially not a number, convert */ - status = acpi_aml_resolve_to_value (&val_desc); - if ((status == AE_OK) && + status = acpi_aml_resolve_to_value (&val_desc, walk_state); + if (ACPI_SUCCESS (status) && (val_desc->common.type != ACPI_TYPE_NUMBER)) { /* @@ -151,8 +154,8 @@ /* * Initially not a valid type, convert */ - status = acpi_aml_resolve_to_value (&val_desc); - if ((status == AE_OK) && + status = acpi_aml_resolve_to_value (&val_desc, walk_state); + if (ACPI_SUCCESS (status) && (val_desc->common.type != ACPI_TYPE_NUMBER) && (val_desc->common.type != ACPI_TYPE_BUFFER) && (val_desc->common.type != ACPI_TYPE_STRING)) @@ -184,7 +187,7 @@ * Val_desc reference count is incremented by Attach_object. */ - status = acpi_ns_attach_object (entry, val_desc, val_desc->common.type); + status = acpi_ns_attach_object (node, val_desc, val_desc->common.type); goto clean_up_and_bail_out; break; @@ -192,24 +195,24 @@ /* Exit now if failure above */ - if (status != AE_OK) { + if (ACPI_FAILURE (status)) { goto clean_up_and_bail_out; } /* - * Get descriptor for object attached to NTE + * Get descriptor for object attached to Node */ - dest_desc = acpi_ns_get_attached_object (entry); + dest_desc = acpi_ns_get_attached_object (node); if (!dest_desc) { /* - * There is no existing object attached to this NTE + * There is no existing object attached to this Node */ status = AE_AML_INTERNAL; goto clean_up_and_bail_out; } /* - * Make sure the destination Object is the same as the NTE + * Make sure the destination Object is the same as the Node */ if (dest_desc->common.type != (u8) destination_type) { status = AE_AML_INTERNAL; @@ -237,15 +240,17 @@ * Perform the update (Set Bank Select) */ - status = acpi_aml_set_named_field_value (dest_desc->bank_field.bank_select, - &dest_desc->bank_field.value, - sizeof (dest_desc->bank_field.value)); - if (status == AE_OK) { + status = acpi_aml_access_named_field (ACPI_WRITE, + dest_desc->bank_field.bank_select, + &dest_desc->bank_field.value, + sizeof (dest_desc->bank_field.value)); + if (ACPI_SUCCESS (status)) { /* Set bank select successful, set data value */ - status = acpi_aml_set_named_field_value (dest_desc->bank_field.bank_select, - &val_desc->bank_field.value, - sizeof (val_desc->bank_field.value)); + status = acpi_aml_access_named_field (ACPI_WRITE, + dest_desc->bank_field.bank_select, + &val_desc->bank_field.value, + sizeof (val_desc->bank_field.value)); } break; @@ -280,7 +285,9 @@ break; } - status = acpi_aml_set_named_field_value (entry, buffer, length); + status = acpi_aml_access_named_field (ACPI_WRITE, + node, buffer, length); + break; /* Global Lock released below */ @@ -405,16 +412,18 @@ * perform the update (Set index) */ - status = acpi_aml_set_named_field_value (dest_desc->index_field.index, - &dest_desc->index_field.value, - sizeof (dest_desc->index_field.value)); + status = acpi_aml_access_named_field (ACPI_WRITE, + dest_desc->index_field.index, + &dest_desc->index_field.value, + sizeof (dest_desc->index_field.value)); - if (AE_OK == status) { + if (ACPI_SUCCESS (status)) { /* set index successful, next set Data value */ - status = acpi_aml_set_named_field_value (dest_desc->index_field.data, - &val_desc->number.value, - sizeof (val_desc->number.value)); + status = acpi_aml_access_named_field (ACPI_WRITE, + dest_desc->index_field.data, + &val_desc->number.value, + sizeof (val_desc->number.value)); } break; diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/interpreter/amstorob.c linux/drivers/acpi/interpreter/amstorob.c --- v2.4.0-test8/linux/drivers/acpi/interpreter/amstorob.c Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/interpreter/amstorob.c Fri Sep 15 14:30:30 2000 @@ -2,6 +2,7 @@ /****************************************************************************** * * Module Name: amstorob - AML Interpreter object store support, store to object + * $Revision: 16 $ * *****************************************************************************/ @@ -25,16 +26,16 @@ #include "acpi.h" -#include "parser.h" -#include "dispatch.h" -#include "interp.h" +#include "acparser.h" +#include "acdispat.h" +#include "acinterp.h" #include "amlcode.h" -#include "namesp.h" -#include "tables.h" +#include "acnamesp.h" +#include "actables.h" #define _COMPONENT INTERPRETER - MODULE_NAME ("amstorob"); + MODULE_NAME ("amstorob") /******************************************************************************* @@ -65,8 +66,9 @@ ACPI_STATUS acpi_aml_store_object_to_object ( - ACPI_OBJECT_INTERNAL *val_desc, - ACPI_OBJECT_INTERNAL *dest_desc) + ACPI_OPERAND_OBJECT *val_desc, + ACPI_OPERAND_OBJECT *dest_desc, + ACPI_WALK_STATE *walk_state) { ACPI_STATUS status = AE_OK; u8 *buffer = NULL; @@ -99,8 +101,8 @@ /* * Initially not a number, convert */ - status = acpi_aml_resolve_to_value (&val_desc); - if ((status == AE_OK) && + status = acpi_aml_resolve_to_value (&val_desc, walk_state); + if (ACPI_SUCCESS (status) && (val_desc->common.type != ACPI_TYPE_NUMBER)) { /* @@ -129,8 +131,8 @@ /* * Initially not a valid type, convert */ - status = acpi_aml_resolve_to_value (&val_desc); - if ((status == AE_OK) && + status = acpi_aml_resolve_to_value (&val_desc, walk_state); + if (ACPI_SUCCESS (status) && (val_desc->common.type != ACPI_TYPE_NUMBER) && (val_desc->common.type != ACPI_TYPE_BUFFER) && (val_desc->common.type != ACPI_TYPE_STRING)) @@ -155,7 +157,7 @@ /* Exit now if failure above */ - if (status != AE_OK) { + if (ACPI_FAILURE (status)) { goto clean_up_and_bail_out; } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/interpreter/amsystem.c linux/drivers/acpi/interpreter/amsystem.c --- v2.4.0-test8/linux/drivers/acpi/interpreter/amsystem.c Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/interpreter/amsystem.c Fri Sep 15 14:30:30 2000 @@ -2,6 +2,7 @@ /****************************************************************************** * * Module Name: amsystem - Interface to OS services + * $Revision: 51 $ * *****************************************************************************/ @@ -25,13 +26,13 @@ #include "acpi.h" -#include "interp.h" -#include "namesp.h" -#include "hardware.h" -#include "events.h" +#include "acinterp.h" +#include "acnamesp.h" +#include "achware.h" +#include "acevents.h" #define _COMPONENT INTERPRETER - MODULE_NAME ("amsystem"); + MODULE_NAME ("amsystem") /******************************************************************************* @@ -181,8 +182,8 @@ ACPI_STATUS acpi_aml_system_acquire_mutex ( - ACPI_OBJECT_INTERNAL *time_desc, - ACPI_OBJECT_INTERNAL *obj_desc) + ACPI_OPERAND_OBJECT *time_desc, + ACPI_OPERAND_OBJECT *obj_desc) { ACPI_STATUS status = AE_OK; @@ -223,7 +224,7 @@ ACPI_STATUS acpi_aml_system_release_mutex ( - ACPI_OBJECT_INTERNAL *obj_desc) + ACPI_OPERAND_OBJECT *obj_desc) { ACPI_STATUS status = AE_OK; @@ -260,7 +261,7 @@ ACPI_STATUS acpi_aml_system_signal_event ( - ACPI_OBJECT_INTERNAL *obj_desc) + ACPI_OPERAND_OBJECT *obj_desc) { ACPI_STATUS status = AE_OK; @@ -290,8 +291,8 @@ ACPI_STATUS acpi_aml_system_wait_event ( - ACPI_OBJECT_INTERNAL *time_desc, - ACPI_OBJECT_INTERNAL *obj_desc) + ACPI_OPERAND_OBJECT *time_desc, + ACPI_OPERAND_OBJECT *obj_desc) { ACPI_STATUS status = AE_OK; @@ -321,7 +322,7 @@ ACPI_STATUS acpi_aml_system_reset_event ( - ACPI_OBJECT_INTERNAL *obj_desc) + ACPI_OPERAND_OBJECT *obj_desc) { ACPI_STATUS status = AE_OK; void *temp_semaphore; diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/interpreter/amutils.c linux/drivers/acpi/interpreter/amutils.c --- v2.4.0-test8/linux/drivers/acpi/interpreter/amutils.c Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/interpreter/amutils.c Fri Sep 15 14:30:30 2000 @@ -2,6 +2,7 @@ /****************************************************************************** * * Module Name: amutils - interpreter/scanner utilities + * $Revision: 53 $ * *****************************************************************************/ @@ -25,21 +26,21 @@ #include "acpi.h" -#include "parser.h" -#include "interp.h" +#include "acparser.h" +#include "acinterp.h" #include "amlcode.h" -#include "namesp.h" -#include "events.h" +#include "acnamesp.h" +#include "acevents.h" #define _COMPONENT INTERPRETER - MODULE_NAME ("amutils"); + MODULE_NAME ("amutils") typedef struct internal_search_st { - ACPI_OBJECT_INTERNAL *dest_obj; + ACPI_OPERAND_OBJECT *dest_obj; u32 index; - ACPI_OBJECT_INTERNAL *source_obj; + ACPI_OPERAND_OBJECT *source_obj; } INTERNAL_PKG_SEARCH_INFO; @@ -49,7 +50,7 @@ INTERNAL_PKG_SEARCH_INFO copy_level[MAX_PACKAGE_DEPTH]; -static char hex[] = +static NATIVE_CHAR hex[] = {'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'}; @@ -121,41 +122,10 @@ if ((type > ACPI_TYPE_MAX && type < INTERNAL_TYPE_BEGIN) || (type > INTERNAL_TYPE_MAX)) { - return FALSE; + return (FALSE); } - return TRUE; -} - - -/******************************************************************************* - * - * FUNCTION: Acpi_aml_append_operand_diag - * - * PARAMETERS: *File_name - Name of source file - * Line_num - Line Number in file - * Op_code - Op_code being executed - * Num_operands - Number of operands Prep_stack tried to check - * - * DESCRIPTION: Print diagnostic information about operands. - * This function is intended to be called after Prep_stack - * has returned S_ERROR. - * - ******************************************************************************/ - -void -acpi_aml_append_operand_diag ( - char *file_name, - s32 line_num, - u16 op_code, - ACPI_OBJECT_INTERNAL **operands, - s32 num_operands) -{ - - /* - * This function outputs debug information only - */ - + return (TRUE); } @@ -178,7 +148,7 @@ acpi_aml_buf_seq (void) { - return ++acpi_gbl_buf_seq; + return (++acpi_gbl_buf_seq); } @@ -270,12 +240,12 @@ * ******************************************************************************/ -s32 +u32 acpi_aml_digits_needed ( - s32 val, - s32 base) + u32 val, + u32 base) { - s32 num_digits = 0; + u32 num_digits = 0; if (base < 1) { @@ -309,13 +279,13 @@ union { u32 value; - char bytes[4]; + u8 bytes[4]; } out; union { u32 value; - char bytes[4]; + u8 bytes[4]; } in; @@ -326,7 +296,7 @@ out.bytes[2] = in.bytes[1]; out.bytes[3] = in.bytes[0]; - return out.value; + return (out.value); } @@ -344,7 +314,7 @@ ACPI_STATUS acpi_aml_eisa_id_to_string ( u32 numeric_id, - char *out_string) + NATIVE_CHAR *out_string) { u32 id; @@ -361,7 +331,7 @@ out_string[6] = hex[id & 0xf]; out_string[7] = 0; - return AE_OK; + return (AE_OK); } @@ -381,16 +351,17 @@ ACPI_STATUS acpi_aml_build_copy_internal_package_object ( - ACPI_OBJECT_INTERNAL *source_obj, - ACPI_OBJECT_INTERNAL *dest_obj) + ACPI_OPERAND_OBJECT *source_obj, + ACPI_OPERAND_OBJECT *dest_obj, + ACPI_WALK_STATE *walk_state) { u32 current_depth = 0; ACPI_STATUS status = AE_OK; u32 length = 0; u32 this_index; u32 object_space = 0; - ACPI_OBJECT_INTERNAL *this_dest_obj; - ACPI_OBJECT_INTERNAL *this_source_obj; + ACPI_OPERAND_OBJECT *this_dest_obj; + ACPI_OPERAND_OBJECT *this_source_obj; INTERNAL_PKG_SEARCH_INFO *level_ptr; @@ -429,8 +400,8 @@ while (1) { this_index = level_ptr->index; - this_dest_obj = (ACPI_OBJECT_INTERNAL *) level_ptr->dest_obj->package.elements[this_index]; - this_source_obj = (ACPI_OBJECT_INTERNAL *) 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)) { /* @@ -458,7 +429,7 @@ * update the buffer length counter */ object_space = this_dest_obj->package.count * - sizeof (ACPI_OBJECT_INTERNAL); + sizeof (ACPI_OPERAND_OBJECT); length += object_space; current_depth++; level_ptr = ©_level[current_depth]; @@ -474,9 +445,9 @@ this_source_obj->common.type); level_ptr->dest_obj->package.elements[this_index] = this_dest_obj; - status = acpi_aml_store_object_to_object(this_source_obj, this_dest_obj); + status = acpi_aml_store_object_to_object(this_source_obj, this_dest_obj, walk_state); - if (status != AE_OK) { + if (ACPI_FAILURE (status)) { /* * Failure get out */ @@ -511,12 +482,6 @@ } } /* else object is NOT a package */ } /* while (1) */ - - - /* - * We'll never get here, but the compiler whines about return value - */ - return (AE_OK); } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/interpreter/amxface.c linux/drivers/acpi/interpreter/amxface.c --- v2.4.0-test8/linux/drivers/acpi/interpreter/amxface.c Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/interpreter/amxface.c Fri Sep 15 14:30:30 2000 @@ -1,7 +1,8 @@ /****************************************************************************** * - * Module Name: ixface - External interpreter interfaces + * Module Name: amxface - External interpreter interfaces + * $Revision: 22 $ * *****************************************************************************/ @@ -25,11 +26,11 @@ #include "acpi.h" -#include "interp.h" +#include "acinterp.h" #define _COMPONENT INTERPRETER - MODULE_NAME ("amxface"); + MODULE_NAME ("amxface") /* @@ -48,8 +49,8 @@ #define DEFINE_AML_GLOBALS #include "amlcode.h" -#include "parser.h" -#include "namesp.h" +#include "acparser.h" +#include "acnamesp.h" /******************************************************************************* @@ -70,9 +71,9 @@ ACPI_STATUS acpi_aml_execute_method ( - ACPI_NAMED_OBJECT *method_entry, - ACPI_OBJECT_INTERNAL **params, - ACPI_OBJECT_INTERNAL **return_obj_desc) + ACPI_NAMESPACE_NODE *method_node, + ACPI_OPERAND_OBJECT **params, + ACPI_OPERAND_OBJECT **return_obj_desc) { ACPI_STATUS status; @@ -84,7 +85,7 @@ acpi_aml_enter_interpreter (); - status = acpi_psx_execute (method_entry, params, return_obj_desc); + status = acpi_psx_execute (method_node, params, return_obj_desc); acpi_aml_exit_interpreter (); diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/namespace/Makefile linux/drivers/acpi/namespace/Makefile --- v2.4.0-test8/linux/drivers/acpi/namespace/Makefile Wed Dec 31 16:00:00 1969 +++ linux/drivers/acpi/namespace/Makefile Fri Sep 15 18:21:44 2000 @@ -0,0 +1,28 @@ +# +# 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)) + +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: + $(RM) *.o diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/namespace/nsaccess.c linux/drivers/acpi/namespace/nsaccess.c --- v2.4.0-test8/linux/drivers/acpi/namespace/nsaccess.c Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/namespace/nsaccess.c Fri Sep 15 14:30:30 2000 @@ -1,9 +1,9 @@ - -/****************************************************************************** +/******************************************************************************* * * Module Name: nsaccess - Top-level functions for accessing ACPI namespace + * $Revision: 108 $ * - *****************************************************************************/ + ******************************************************************************/ /* * Copyright (C) 2000 R. Byron Moore @@ -26,59 +26,16 @@ #include "acpi.h" #include "amlcode.h" -#include "interp.h" -#include "namesp.h" -#include "dispatch.h" +#include "acinterp.h" +#include "acnamesp.h" +#include "acdispat.h" #define _COMPONENT NAMESPACE - MODULE_NAME ("nsaccess"); + MODULE_NAME ("nsaccess") -/**************************************************************************** - * - * FUNCTION: Acpi_ns_root_create_scope - * - * PARAMETERS: Entry - NTE for which a scope will be created - * - * RETURN: Status - * - * DESCRIPTION: Create a scope table for the given name table entry - * - * MUTEX: Expects namespace to be locked - * - ***************************************************************************/ - -ACPI_STATUS -acpi_ns_root_create_scope ( - ACPI_NAMED_OBJECT *entry) -{ - - /* Allocate a scope table */ - - if (entry->child_table) { - return (AE_EXIST); - } - - entry->child_table = acpi_ns_allocate_name_table (NS_TABLE_SIZE); - if (!entry->child_table) { - /* root name table allocation failure */ - - REPORT_ERROR ("Root name table allocation failure"); - return (AE_NO_MEMORY); - } - - /* - * Init the scope first entry -- since it is the exemplar of - * the scope (Some fields are duplicated to new entries!) - */ - acpi_ns_initialize_table (entry->child_table, NULL, entry); - return (AE_OK); - -} - - -/**************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_ns_root_initialize * @@ -86,40 +43,41 @@ * * RETURN: Status * - * DESCRIPTION: Allocate and initialize the root name table + * DESCRIPTION: Allocate and initialize the default root named objects * * MUTEX: Locks namespace for entire execution * - ***************************************************************************/ + ******************************************************************************/ ACPI_STATUS acpi_ns_root_initialize (void) { ACPI_STATUS status = AE_OK; PREDEFINED_NAMES *init_val = NULL; - ACPI_NAMED_OBJECT *new_entry; - ACPI_OBJECT_INTERNAL *obj_desc; + ACPI_NAMESPACE_NODE *new_node; + ACPI_OPERAND_OBJECT *obj_desc; acpi_cm_acquire_mutex (ACPI_MTX_NAMESPACE); /* - * Root is initially NULL, so a non-NULL value indicates + * The global root ptr is initially NULL, so a non-NULL value indicates * that Acpi_ns_root_initialize() has already been called; just return. */ - if (acpi_gbl_root_object->child_table) { + if (acpi_gbl_root_node) { status = AE_OK; goto unlock_and_exit; } - /* Create the root scope */ + /* + * Tell the rest of the subsystem that the root is initialized + * (This is OK because the namespace is locked) + */ + + acpi_gbl_root_node = &acpi_gbl_root_node_struct; - status = acpi_ns_root_create_scope (acpi_gbl_root_object); - if (ACPI_FAILURE (status)) { - goto unlock_and_exit; - } /* Enter the pre-defined names in the name table */ @@ -127,25 +85,25 @@ status = acpi_ns_lookup (NULL, init_val->name, (OBJECT_TYPE_INTERNAL) init_val->type, IMODE_LOAD_PASS2, NS_NO_UPSEARCH, - NULL, &new_entry); + NULL, &new_node); + + if (ACPI_FAILURE (status) || + (!new_node)) /* - * if name entered successfully - * && its entry in Pre_defined_names[] specifies an - * initial value + * Name entered successfully. + * If entry in Pre_defined_names[] specifies an + * initial value, create the initial value. */ - if ((status == AE_OK) && - new_entry && init_val->val) - { + if (init_val->val) { /* * Entry requests an initial value, allocate a * descriptor for it. */ - obj_desc = - acpi_cm_create_internal_object ( - (OBJECT_TYPE_INTERNAL) init_val->type); + obj_desc = acpi_cm_create_internal_object ( + (OBJECT_TYPE_INTERNAL) init_val->type); if (!obj_desc) { status = AE_NO_MEMORY; @@ -164,23 +122,22 @@ case ACPI_TYPE_NUMBER: obj_desc->number.value = - (u32) STRTOUL (init_val->val, NULL, 10); + (u32) STRTOUL (init_val->val, NULL, 10); break; case ACPI_TYPE_STRING: obj_desc->string.length = - (u16) STRLEN (init_val->val); + (u16) STRLEN (init_val->val); /* * Allocate a buffer for the string. All * String.Pointers must be allocated buffers! * (makes deletion simpler) */ - obj_desc->string.pointer = - acpi_cm_allocate ((ACPI_SIZE) - (obj_desc->string.length + 1)); + obj_desc->string.pointer = acpi_cm_allocate ( + (obj_desc->string.length + 1)); if (!obj_desc->string.pointer) { REPORT_ERROR ("Initial value string" @@ -191,24 +148,22 @@ goto unlock_and_exit; } - STRCPY ((char *) obj_desc->string.pointer, - init_val->val); + STRCPY (obj_desc->string.pointer, init_val->val); break; case ACPI_TYPE_MUTEX: obj_desc->mutex.sync_level = - (u16) STRTOUL (init_val->val, NULL, 10); + (u16) STRTOUL (init_val->val, NULL, 10); if (STRCMP (init_val->name, "_GL_") == 0) { /* * Create a counting semaphore for the * global lock */ - status = - acpi_os_create_semaphore (ACPI_NO_UNIT_LIMIT, - 1, &obj_desc->mutex.semaphore); + status = acpi_os_create_semaphore (ACPI_NO_UNIT_LIMIT, + 1, &obj_desc->mutex.semaphore); if (ACPI_FAILURE (status)) { goto unlock_and_exit; @@ -218,8 +173,7 @@ * global lock, save it */ - acpi_gbl_global_lock_semaphore = - obj_desc->mutex.semaphore; + acpi_gbl_global_lock_semaphore = obj_desc->mutex.semaphore; } else { @@ -232,11 +186,6 @@ goto unlock_and_exit; } } - - /* TBD: [Restructure] These fields may be obsolete */ - - obj_desc->mutex.lock_count = 0; - obj_desc->mutex.thread_id = 0; break; @@ -247,9 +196,9 @@ continue; } - /* Store pointer to value descriptor in nte */ + /* Store pointer to value descriptor in the Node */ - acpi_ns_attach_object (new_entry, obj_desc, + acpi_ns_attach_object (new_node, obj_desc, obj_desc->common.type); } } @@ -261,16 +210,19 @@ } -/**************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_ns_lookup * - * PARAMETERS: Prefix_scope - Search scope if name is not fully qualified + * PARAMETERS: Prefix_node - Search scope if name is not fully qualified * Pathname - Search pathname, in internal format * (as represented in the AML stream) * Type - Type associated with name * Interpreter_mode - IMODE_LOAD_PASS2 => add name if not found - * Ret_entry - Where the new entry (NTE) is placed + * Flags - Flags describing the search restrictions + * Walk_state - Current state of the walk + * Return_node - Where the Node is placed (if found + * or created successfully) * * RETURN: Status * @@ -279,55 +231,42 @@ * * MUTEX: Assumes namespace is locked. * - ***************************************************************************/ + ******************************************************************************/ ACPI_STATUS acpi_ns_lookup ( ACPI_GENERIC_STATE *scope_info, - char *pathname, + NATIVE_CHAR *pathname, OBJECT_TYPE_INTERNAL type, OPERATING_MODE interpreter_mode, u32 flags, ACPI_WALK_STATE *walk_state, - ACPI_NAMED_OBJECT **ret_entry) + ACPI_NAMESPACE_NODE **return_node) { ACPI_STATUS status; - ACPI_NAME_TABLE *prefix_scope; - ACPI_NAME_TABLE *table_to_search = NULL; - ACPI_NAME_TABLE *scope_to_push = NULL; - ACPI_NAMED_OBJECT *this_entry = NULL; + ACPI_NAMESPACE_NODE *prefix_node; + ACPI_NAMESPACE_NODE *current_node = NULL; + ACPI_NAMESPACE_NODE *scope_to_push = NULL; + ACPI_NAMESPACE_NODE *this_node = NULL; u32 num_segments; ACPI_NAME simple_name; u8 null_name_path = FALSE; OBJECT_TYPE_INTERNAL type_to_check_for; OBJECT_TYPE_INTERNAL this_search_type; - if (!ret_entry) { + if (!return_node) { return (AE_BAD_PARAMETER); } acpi_gbl_ns_lookup_count++; - *ret_entry = ENTRY_NOT_FOUND; - if (!acpi_gbl_root_object->child_table) { - /* - * If the name space has not been initialized: - * - In Pass1 of Load mode, we need to initialize it - * before trying to define a name. - * - In Exec mode, there are no names to be found. - */ + *return_node = ENTRY_NOT_FOUND; - if (IMODE_LOAD_PASS1 == interpreter_mode) { - if ((status = acpi_ns_root_initialize ()) != AE_OK) { - return (status); - } - } - else { - return (AE_NOT_FOUND); - } - } + if (!acpi_gbl_root_node) { + return (AE_NO_NAMESPACE); + } /* * Get the prefix scope. @@ -335,12 +274,12 @@ */ if ((!scope_info) || - (!scope_info->scope.name_table)) + (!scope_info->scope.node)) { - prefix_scope = acpi_gbl_root_object->child_table; + prefix_node = acpi_gbl_root_node; } else { - prefix_scope = scope_info->scope.name_table; + prefix_node = scope_info->scope.node; } @@ -369,6 +308,8 @@ } + /* TBD: [Restructure] - Move the pathname stuff into a new procedure */ + /* Examine the name pointer */ if (!pathname) { @@ -376,7 +317,7 @@ null_name_path = TRUE; num_segments = 0; - this_entry = acpi_gbl_root_object; + this_node = acpi_gbl_root_node; } @@ -403,14 +344,16 @@ if (*pathname == AML_ROOT_PREFIX) { /* Pathname is fully qualified, look in root name table */ - table_to_search = acpi_gbl_root_object->child_table; + current_node = acpi_gbl_root_node; + /* point to segment part */ + pathname++; /* Direct reference to root, "\" */ if (!(*pathname)) { - this_entry = acpi_gbl_root_object; + this_node = acpi_gbl_root_node; goto check_for_new_scope_and_exit; } } @@ -418,7 +361,7 @@ else { /* Pathname is relative to current scope, start there */ - table_to_search = prefix_scope; + current_node = prefix_node; /* * Handle up-prefix (carat). More than one prefix @@ -426,23 +369,22 @@ */ while (*pathname == AML_PARENT_PREFIX) { - /* Point to segment part or next Parent_prefix */ pathname++; /* Backup to the parent's scope */ - table_to_search = table_to_search->parent_table; - if (!table_to_search) { + this_node = acpi_ns_get_parent_object (current_node); + if (!this_node) { /* Current scope has no parent scope */ - REPORT_ERROR ("Ns_lookup: Too many parent" - "prefixes or scope has no parent"); - + REPORT_ERROR ("Too many parent prefixes (^) - reached root"); return (AE_NOT_FOUND); } + + current_node = this_node; } } @@ -454,14 +396,18 @@ if (*pathname == AML_DUAL_NAME_PREFIX) { num_segments = 2; + /* point to first segment */ + pathname++; } else if (*pathname == AML_MULTI_NAME_PREFIX_OP) { - num_segments = (s32)* (u8 *) ++pathname; + num_segments = (u32)* (u8 *) ++pathname; + /* point to first segment */ + pathname++; } @@ -484,32 +430,32 @@ */ - while (num_segments-- && table_to_search) { + while (num_segments-- && current_node) { /* - * Search for the current segment in the table where - * it should be. - * Type is significant only at the last (topmost) level. + * Search for the current name segment under the current + * named object. The Type is significant only at the last (topmost) + * level. (We don't care about the types along the path, only + * the type of the final target object.) */ this_search_type = ACPI_TYPE_ANY; if (!num_segments) { this_search_type = type; } + /* Pluck and ACPI name from the front of the pathname */ + MOVE_UNALIGNED32_TO_32 (&simple_name, pathname); + + /* Try to find the ACPI name */ + status = acpi_ns_search_and_enter (simple_name, walk_state, - table_to_search, interpreter_mode, + current_node, interpreter_mode, this_search_type, flags, - &this_entry); + &this_node); - if (status != AE_OK) { + if (ACPI_FAILURE (status)) { if (status == AE_NOT_FOUND) { - /* Name not in ACPI namespace */ - - if (IMODE_LOAD_PASS1 == interpreter_mode || - IMODE_LOAD_PASS2 == interpreter_mode) - { - REPORT_ERROR ("Name table overflow"); - } + /* Name not found in ACPI namespace */ } @@ -518,92 +464,54 @@ /* - * If 1) last segment (Num_segments == 0) + * 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 entry is known (not TYPE_ANY) - * 7) and entry does not match request + * 6) and type of object is known (not TYPE_ANY) + * 7) 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_DEF_ANY) && - (type_to_check_for != INTERNAL_TYPE_SCOPE) && - (type_to_check_for != INTERNAL_TYPE_INDEX_FIELD_DEFN) && - (this_entry->type != ACPI_TYPE_ANY) && - (this_entry->type != type_to_check_for)) + if ((num_segments == 0) && + (type_to_check_for != ACPI_TYPE_ANY) && + (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)) { - /* Complain about type mismatch */ + /* Complain about a type mismatch */ REPORT_WARNING ("Type mismatch"); } /* - * If last segment and not looking for a specific type, but type of - * found entry is known, use that type to see if it opens a scope. + * If this is the last name segment and we are not looking for a + * specific type, but the type of found object is known, use that type + * to see if it opens a scope. */ if ((0 == num_segments) && (ACPI_TYPE_ANY == type)) { - type = this_entry->type; + type = this_node->type; } if ((num_segments || acpi_ns_opens_scope (type)) && - (this_entry->child_table == NULL)) + (this_node->child == NULL)) { /* * More segments or the type implies enclosed scope, * and the next scope has not been allocated. */ - if ((IMODE_LOAD_PASS1 == interpreter_mode) || - (IMODE_LOAD_PASS2 == interpreter_mode)) - { - /* - * First or second pass load mode - * ==> locate the next scope - */ - - this_entry->child_table = - acpi_ns_allocate_name_table (NS_TABLE_SIZE); - - if (!this_entry->child_table) { - return (AE_NO_MEMORY); - } - } - - /* Now complain if there is no next scope */ - - if (this_entry->child_table == NULL) { - if (IMODE_LOAD_PASS1 == interpreter_mode || - IMODE_LOAD_PASS2 == interpreter_mode) - { - REPORT_ERROR ("Name Table allocation failure"); - return (AE_NOT_FOUND); - } - - return (AE_NOT_FOUND); - } - - - /* Scope table initialization */ - - if (IMODE_LOAD_PASS1 == interpreter_mode || - IMODE_LOAD_PASS2 == interpreter_mode) - { - /* Initialize the new table */ - - acpi_ns_initialize_table (this_entry->child_table, - table_to_search, - this_entry); - } } - table_to_search = this_entry->child_table; + current_node = this_node; + /* point to next name segment */ + pathname += ACPI_NAME_SIZE; } @@ -629,7 +537,7 @@ scope_to_push = NULL; } else { - scope_to_push = this_entry->child_table; + scope_to_push = this_node; } status = acpi_ds_scope_stack_push (scope_to_push, type, @@ -641,7 +549,7 @@ } } - *ret_entry = this_entry; + *return_node = this_node; return (AE_OK); } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/namespace/nsalloc.c linux/drivers/acpi/namespace/nsalloc.c --- v2.4.0-test8/linux/drivers/acpi/namespace/nsalloc.c Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/namespace/nsalloc.c Fri Sep 15 14:30:30 2000 @@ -1,9 +1,9 @@ - -/****************************************************************************** +/******************************************************************************* * * Module Name: nsalloc - Namespace allocation and deletion utilities + * $Revision: 41 $ * - *****************************************************************************/ + ******************************************************************************/ /* * Copyright (C) 2000 R. Byron Moore @@ -25,46 +25,303 @@ #include "acpi.h" -#include "namesp.h" -#include "interp.h" +#include "acnamesp.h" +#include "acinterp.h" #define _COMPONENT NAMESPACE - MODULE_NAME ("nsalloc"); + MODULE_NAME ("nsalloc") + + +/******************************************************************************* + * + * FUNCTION: Acpi_ns_create_node + * + * PARAMETERS: + * + * RETURN: None + * + * DESCRIPTION: + * + ******************************************************************************/ + +ACPI_NAMESPACE_NODE * +acpi_ns_create_node ( + u32 acpi_name) +{ + ACPI_NAMESPACE_NODE *node; + + + node = acpi_cm_callocate (sizeof (ACPI_NAMESPACE_NODE)); + if (!node) { + return (NULL); + } + + INCREMENT_NAME_TABLE_METRICS (sizeof (ACPI_NAMESPACE_NODE)); + + node->data_type = ACPI_DESC_TYPE_NAMED; + node->name = acpi_name; + node->reference_count = 1; + + return (node); +} + + +/******************************************************************************* + * + * FUNCTION: Acpi_ns_delete_node + * + * PARAMETERS: + * + * RETURN: None + * + * DESCRIPTION: + * + ******************************************************************************/ + +void +acpi_ns_delete_node ( + ACPI_NAMESPACE_NODE *node) +{ + ACPI_NAMESPACE_NODE *parent_node; + ACPI_NAMESPACE_NODE *prev_node; + ACPI_NAMESPACE_NODE *next_node; + + + parent_node = acpi_ns_get_parent_object (node); + + prev_node = NULL; + next_node = parent_node->child; + + while (next_node != node) { + prev_node = next_node; + next_node = prev_node->peer; + } + + if (prev_node) { + prev_node->peer = next_node->peer; + if (next_node->flags & ANOBJ_END_OF_PEER_LIST) { + prev_node->flags |= ANOBJ_END_OF_PEER_LIST; + } + } + else { + parent_node->child = next_node->peer; + } + + + DECREMENT_NAME_TABLE_METRICS (sizeof (ACPI_NAMESPACE_NODE)); + + /* + * Detach an object if there is one + */ + + if (node->object) { + acpi_ns_detach_object (node); + } + + acpi_cm_free (node); + + + return; +} + + +/******************************************************************************* + * + * FUNCTION: Acpi_ns_install_node + * + * PARAMETERS: Walk_state - Current state of the walk + * Parent_node - The parent of the new Node + * Node - The new Node to install + * Type - ACPI object type of the new Node + * + * RETURN: None + * + * DESCRIPTION: Initialize a new entry within a namespace table. + * + ******************************************************************************/ + +void +acpi_ns_install_node ( + ACPI_WALK_STATE *walk_state, + ACPI_NAMESPACE_NODE *parent_node, /* Parent */ + ACPI_NAMESPACE_NODE *node, /* New Child*/ + OBJECT_TYPE_INTERNAL type) +{ + u16 owner_id = TABLE_ID_DSDT; + ACPI_NAMESPACE_NODE *child_node; + + + /* + * Get the owner ID from the Walk state + * The owner ID is used to track table deletion and + * deletion of objects created by methods + */ + if (walk_state) { + owner_id = walk_state->owner_id; + } + + + /* link the new entry into the parent and existing children */ + + /* TBD: Could be first, last, or alphabetic */ + + child_node = parent_node->child; + if (!child_node) { + parent_node->child = node; + } + + else { + while (!(child_node->flags & ANOBJ_END_OF_PEER_LIST)) { + child_node = child_node->peer; + } + + child_node->peer = node; + + /* Clear end-of-list flag */ + + child_node->flags &= ~ANOBJ_END_OF_PEER_LIST; + } + + /* Init the new entry */ + + node->owner_id = owner_id; + node->flags |= ANOBJ_END_OF_PEER_LIST; + node->peer = parent_node; + + + /* + * If adding a name with unknown type, or having to + * add the region in order to define fields in it, we + * have a forward reference. + */ + + if ((ACPI_TYPE_ANY == type) || + (INTERNAL_TYPE_DEF_FIELD_DEFN == type) || + (INTERNAL_TYPE_BANK_FIELD_DEFN == type)) + { + /* + * We don't want to abort here, however! + * We will fill in the actual type when the + * real definition is found later. + */ + + } + + /* + * The Def_field_defn and Bank_field_defn cases are actually + * looking up the Region in which the field will be defined + */ + + if ((INTERNAL_TYPE_DEF_FIELD_DEFN == type) || + (INTERNAL_TYPE_BANK_FIELD_DEFN == type)) + { + type = ACPI_TYPE_REGION; + } + + /* + * Scope, Def_any, and Index_field_defn are bogus "types" which do + * not actually have anything to do with the type of the name + * being looked up. Save any other value of Type as the type of + * the entry. + */ + + if ((type != INTERNAL_TYPE_SCOPE) && + (type != INTERNAL_TYPE_DEF_ANY) && + (type != INTERNAL_TYPE_INDEX_FIELD_DEFN)) + { + node->type = (u8) type; + } + + /* + * Increment the reference count(s) of all parents up to + * the root! + */ + + while ((node = acpi_ns_get_parent_object (node)) != NULL) { + node->reference_count++; + } + + return; +} -/**************************************************************************** +/******************************************************************************* * - * FUNCTION: Acpi_ns_allocate_name_table + * FUNCTION: Acpi_ns_delete_children * - * PARAMETERS: Nte_count - Count of NTEs to allocate + * PARAMETERS: Parent_node - Delete this objects children * - * RETURN: The address of the first nte in the array, or NULL + * RETURN: None. * - * DESCRIPTION: Allocate an array of nte, including prepended link space - * Array is set to all zeros via Acpi_os_callcate(). + * DESCRIPTION: Delete all children of the parent object. Deletes a + * "scope". * - ***************************************************************************/ + ******************************************************************************/ -ACPI_NAME_TABLE * -acpi_ns_allocate_name_table ( - u32 num_entries) +void +acpi_ns_delete_children ( + ACPI_NAMESPACE_NODE *parent_node) { - ACPI_NAME_TABLE *name_table = NULL; - ACPI_SIZE alloc_size; + ACPI_NAMESPACE_NODE *child_node; + ACPI_NAMESPACE_NODE *next_node; + u8 flags; + + + if (!parent_node) { + return; + } + + /* If no children, all done! */ + + child_node = parent_node->child; + if (!child_node) { + return; + } + + /* + * Deallocate all children at this level + */ + do + { + /* Get the things we need */ + + next_node = child_node->peer; + flags = child_node->flags; + + /* Grandchildren should have all been deleted already */ + + /* Now we can free this child object */ - alloc_size = sizeof (ACPI_NAME_TABLE) + ((num_entries - 1) * - sizeof (ACPI_NAMED_OBJECT)); + DECREMENT_NAME_TABLE_METRICS (sizeof (ACPI_NAMESPACE_NODE)); - name_table = acpi_cm_callocate (alloc_size); + /* + * Detach an object if there is one + */ + + if (child_node->object) { + acpi_ns_detach_object (child_node); + } + + acpi_cm_free (child_node); + + /* And move on to the next child in the list */ + + child_node = next_node; + } while (!(flags & ANOBJ_END_OF_PEER_LIST)); - return (name_table); + + /* Clear the parent's child pointer */ + + parent_node->child = NULL; + + return; } -/**************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_ns_delete_namespace_subtree * @@ -72,22 +329,27 @@ * * RETURN: None. * - * DESCRIPTION: Delete a subtree of the namespace. This includes all objects stored - * within the subtree. Scope tables are deleted also + * DESCRIPTION: Delete a subtree of the namespace. This includes all objects + * stored within the subtree. Scope tables are deleted also * - ***************************************************************************/ + ******************************************************************************/ ACPI_STATUS acpi_ns_delete_namespace_subtree ( - ACPI_NAMED_OBJECT *parent_entry) + ACPI_NAMESPACE_NODE *parent_node) { - ACPI_NAMED_OBJECT *child_entry; + ACPI_NAMESPACE_NODE *child_node; + ACPI_OPERAND_OBJECT *obj_desc; u32 level; - ACPI_OBJECT_INTERNAL *obj_desc; - child_entry = 0; - level = 1; + if (!parent_node) { + return (AE_OK); + } + + + child_node = 0; + level = 1; /* * Traverse the tree of objects until we bubble back up @@ -100,53 +362,32 @@ * Null returned if not found */ - child_entry = acpi_ns_get_next_object (ACPI_TYPE_ANY, - parent_entry, - child_entry); - - if (child_entry) { + child_node = acpi_ns_get_next_object (ACPI_TYPE_ANY, parent_node, + child_node); + if (child_node) { /* * Found an object - delete the object within * the Value field */ - obj_desc = acpi_ns_get_attached_object (child_entry); + obj_desc = acpi_ns_get_attached_object (child_node); if (obj_desc) { - acpi_ns_detach_object (child_entry); + acpi_ns_detach_object (child_node); acpi_cm_remove_reference (obj_desc); } - /* - * Clear the NTE in case this scope is reused - * (e.g., a control method scope) - */ - - child_entry->type = ACPI_TYPE_ANY; - child_entry->name = 0; - /* Check if this object has any children */ - if (acpi_ns_get_next_object (ACPI_TYPE_ANY, child_entry, 0)) { + if (acpi_ns_get_next_object (ACPI_TYPE_ANY, child_node, 0)) { /* * There is at least one child of this object, * visit the object */ level++; - parent_entry = child_entry; - child_entry = 0; - } - - else { - /* - * There may be a name table even if there are - * no children - */ - - acpi_ns_delete_name_table (child_entry->child_table); - child_entry->child_table = NULL; - + parent_node = child_node; + child_node = 0; } } @@ -158,26 +399,18 @@ level--; /* - * Delete the scope (Name Table) associated with - * the parent object + * Now delete all of the children of this parent + * all at the same time. */ - /* Don't delete the top level scope, this allows - * the dynamic deletion of objects created underneath - * control methods! - */ - - if (level != 0) { - acpi_ns_delete_name_table (parent_entry->child_table); - parent_entry->child_table = NULL; - } + acpi_ns_delete_children (parent_node); /* New "last child" is this parent object */ - child_entry = parent_entry; + child_node = parent_node; /* Now we can move up the tree to the grandparent */ - parent_entry = acpi_ns_get_parent_entry (parent_entry); + parent_node = acpi_ns_get_parent_object (parent_node); } } @@ -186,70 +419,55 @@ } -/**************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_ns_remove_reference * - * PARAMETERS: Entry - NTE whose reference count is to be decremented + * PARAMETERS: Node - Named object whose reference count is to be + * decremented * * RETURN: None. * - * DESCRIPTION: Remove an NTE reference. Decrements the reference count of - * all parent NTEs up to the root. Any NTE along the way that - * reaches zero references is freed. + * DESCRIPTION: Remove a Node reference. Decrements the reference count + * of all parent Nodes up to the root. Any object along + * the way that reaches zero references is freed. * - ***************************************************************************/ + ******************************************************************************/ void acpi_ns_remove_reference ( - ACPI_NAMED_OBJECT *entry) + ACPI_NAMESPACE_NODE *node) { - ACPI_NAMED_OBJECT *this_entry; - - - /* There may be a name table even if there are no children */ - - acpi_ns_delete_name_table (entry->child_table); - entry->child_table = NULL; + ACPI_NAMESPACE_NODE *next_node; /* - * Decrement the reference count(s) of all parents up to the root, - * And delete anything with zero remaining references. + * Decrement the reference count(s) of this object and all + * objects up to the root, Delete anything with zero remaining references. */ - this_entry = entry; - while (this_entry) { - /* Decrement the reference */ + next_node = node; + while (next_node) { + /* Decrement the reference count on this object*/ - this_entry->reference_count--; + next_node->reference_count--; - /* Delete entry if no more references */ - - if (!this_entry->reference_count) { - /* Delete the scope if present */ - - if (this_entry->child_table) { - acpi_ns_delete_name_table (this_entry->child_table); - this_entry->child_table = NULL; - } - - /* - * Mark the entry free - * (This doesn't deallocate anything) - */ + /* Delete the object if no more references */ - acpi_ns_free_table_entry (this_entry); + if (!next_node->reference_count) { + /* Delete all children and delete the object */ + acpi_ns_delete_children (next_node); + acpi_ns_delete_node (next_node); } /* Move up to parent */ - this_entry = acpi_ns_get_parent_entry (this_entry); + next_node = acpi_ns_get_parent_object (next_node); } } -/**************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_ns_delete_namespace_by_owner * @@ -261,21 +479,21 @@ * specific ID. Used to delete entire ACPI tables. All * reference counts are updated. * - ***************************************************************************/ + ******************************************************************************/ ACPI_STATUS acpi_ns_delete_namespace_by_owner ( u16 owner_id) { - ACPI_NAMED_OBJECT *child_entry; + ACPI_NAMESPACE_NODE *child_node; u32 level; - ACPI_OBJECT_INTERNAL *obj_desc; - ACPI_NAMED_OBJECT *parent_entry; + ACPI_OPERAND_OBJECT *obj_desc; + ACPI_NAMESPACE_NODE *parent_node; - parent_entry = acpi_gbl_root_object; - child_entry = 0; - level = 1; + parent_node = acpi_gbl_root_node; + child_node = 0; + level = 1; /* * Traverse the tree of objects until we bubble back up @@ -288,124 +506,65 @@ * Null returned if not found */ - child_entry = acpi_ns_get_next_object (ACPI_TYPE_ANY, - parent_entry, - child_entry); + child_node = acpi_ns_get_next_object (ACPI_TYPE_ANY, parent_node, + child_node); - if (child_entry) { - if (child_entry->owner_id == owner_id) { + if (child_node) { + if (child_node->owner_id == owner_id) { /* * Found an object - delete the object within * the Value field */ - obj_desc = acpi_ns_get_attached_object (child_entry); + obj_desc = acpi_ns_get_attached_object (child_node); if (obj_desc) { - acpi_ns_detach_object (child_entry); + acpi_ns_detach_object (child_node); acpi_cm_remove_reference (obj_desc); } } /* Check if this object has any children */ - if (acpi_ns_get_next_object (ACPI_TYPE_ANY, child_entry, 0)) { + if (acpi_ns_get_next_object (ACPI_TYPE_ANY, child_node, 0)) { /* * There is at least one child of this object, * visit the object */ level++; - parent_entry = child_entry; - child_entry = 0; + parent_node = child_node; + child_node = 0; } - else if (child_entry->owner_id == owner_id) { - acpi_ns_remove_reference (child_entry); + else if (child_node->owner_id == owner_id) { + acpi_ns_remove_reference (child_node); } } else { /* - * No more children in this object. - * We will move up to the grandparent. + * No more children in this object. Move up to grandparent. */ level--; - /* - * Delete the scope (Name Table) associated with - * the parent object - */ - /* Don't delete the top level scope, this allows - * the dynamic deletion of objects created underneath - * control methods! - */ - - if (level != 0) { - if (parent_entry->owner_id == owner_id) { - acpi_ns_remove_reference (parent_entry); + if (parent_node->owner_id == owner_id) { + acpi_ns_remove_reference (parent_node); } } - /* New "last child" is this parent object */ - child_entry = parent_entry; + child_node = parent_node; /* Now we can move up the tree to the grandparent */ - parent_entry = acpi_ns_get_parent_entry (parent_entry); + parent_node = acpi_ns_get_parent_object (parent_node); } } return (AE_OK); -} - - -/**************************************************************************** - * - * FUNCTION: Acpi_ns_delete_name_table - * - * PARAMETERS: Scope - A handle to the scope to be deleted - * - * RETURN: None. - * - * DESCRIPTION: Delete a namespace Name Table with zero or - * more appendages. The table and all appendages are deleted. - * - ***************************************************************************/ - -void -acpi_ns_delete_name_table ( - ACPI_NAME_TABLE *name_table) -{ - ACPI_NAME_TABLE *this_table; - ACPI_NAME_TABLE *next_table; - - - if (!name_table) { - return; - } - - this_table = name_table; - - - /* - * Deallocate the name table and all appendages - */ - do - { - next_table = this_table->next_table; - - /* Now we can free the table */ - - acpi_cm_free (this_table); - this_table = next_table; - - } while (this_table); - - return; } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/namespace/nsdump.c linux/drivers/acpi/namespace/nsdump.c --- v2.4.0-test8/linux/drivers/acpi/namespace/nsdump.c Wed Dec 31 16:00:00 1969 +++ linux/drivers/acpi/namespace/nsdump.c Fri Sep 15 14:30:30 2000 @@ -0,0 +1,36 @@ +/****************************************************************************** + * + * 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") + + diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/namespace/nseval.c linux/drivers/acpi/namespace/nseval.c --- v2.4.0-test8/linux/drivers/acpi/namespace/nseval.c Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/namespace/nseval.c Fri Sep 15 14:30:30 2000 @@ -1,10 +1,10 @@ - -/****************************************************************************** +/******************************************************************************* * * Module Name: nseval - Object evaluation interfaces -- includes control * method lookup and execution. + * $Revision: 76 $ * - *****************************************************************************/ + ******************************************************************************/ /* * Copyright (C) 2000 R. Byron Moore @@ -27,20 +27,20 @@ #include "acpi.h" #include "amlcode.h" -#include "parser.h" -#include "interp.h" -#include "namesp.h" +#include "acparser.h" +#include "acinterp.h" +#include "acnamesp.h" #define _COMPONENT NAMESPACE - MODULE_NAME ("nseval"); + MODULE_NAME ("nseval") -/**************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_ns_evaluate_relative * - * PARAMETERS: Rel_obj_entry - NTE of the relative containing object + * PARAMETERS: Handle - The relative containing object * *Pathname - Name of method to execute, If NULL, the * handle is the object to execute * **Params - List of parameters to pass to the method, @@ -56,19 +56,19 @@ * * MUTEX: Locks Namespace * - ****************************************************************************/ + ******************************************************************************/ ACPI_STATUS acpi_ns_evaluate_relative ( - ACPI_NAMED_OBJECT *handle, - char *pathname, - ACPI_OBJECT_INTERNAL **params, - ACPI_OBJECT_INTERNAL **return_object) + ACPI_NAMESPACE_NODE *handle, + NATIVE_CHAR *pathname, + ACPI_OPERAND_OBJECT **params, + ACPI_OPERAND_OBJECT **return_object) { - ACPI_NAMED_OBJECT *rel_obj_entry; + ACPI_NAMESPACE_NODE *prefix_node; ACPI_STATUS status; - ACPI_NAMED_OBJECT *obj_entry = NULL; - char *internal_path = NULL; + ACPI_NAMESPACE_NODE *node = NULL; + NATIVE_CHAR *internal_path = NULL; ACPI_GENERIC_STATE scope_info; @@ -86,12 +86,12 @@ return (status); } - /* Get the prefix handle and NTE */ + /* Get the prefix handle and Node */ acpi_cm_acquire_mutex (ACPI_MTX_NAMESPACE); - rel_obj_entry = acpi_ns_convert_handle_to_entry (handle); - if (!rel_obj_entry) { + prefix_node = acpi_ns_convert_handle_to_entry (handle); + if (!prefix_node) { acpi_cm_release_mutex (ACPI_MTX_NAMESPACE); status = AE_BAD_PARAMETER; goto cleanup; @@ -99,15 +99,14 @@ /* Lookup the name in the namespace */ - scope_info.scope.name_table = rel_obj_entry->child_table; + scope_info.scope.node = prefix_node->child; status = acpi_ns_lookup (&scope_info, internal_path, ACPI_TYPE_ANY, - IMODE_EXECUTE, - NS_NO_UPSEARCH, NULL, - &obj_entry); + IMODE_EXECUTE, NS_NO_UPSEARCH, NULL, + &node); acpi_cm_release_mutex (ACPI_MTX_NAMESPACE); - if (status != AE_OK) { + if (ACPI_FAILURE (status)) { goto cleanup; } @@ -116,7 +115,7 @@ * to evaluate it. */ - status = acpi_ns_evaluate_by_handle (obj_entry, params, return_object); + status = acpi_ns_evaluate_by_handle (node, params, return_object); cleanup: @@ -128,7 +127,7 @@ } -/**************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_ns_evaluate_by_name * @@ -146,26 +145,24 @@ * * MUTEX: Locks Namespace * - ****************************************************************************/ + ******************************************************************************/ ACPI_STATUS acpi_ns_evaluate_by_name ( - char *pathname, - ACPI_OBJECT_INTERNAL **params, - ACPI_OBJECT_INTERNAL **return_object) + NATIVE_CHAR *pathname, + ACPI_OPERAND_OBJECT **params, + ACPI_OPERAND_OBJECT **return_object) { ACPI_STATUS status; - ACPI_NAMED_OBJECT *obj_entry = NULL; - char *internal_path = NULL; + ACPI_NAMESPACE_NODE *node = NULL; + NATIVE_CHAR *internal_path = NULL; /* Build an internal name string for the method */ - if (pathname[0] != '\\' || pathname[1] != '/') { - status = acpi_ns_internalize_name (pathname, &internal_path); - if (ACPI_FAILURE (status)) { - return (status); - } + status = acpi_ns_internalize_name (pathname, &internal_path); + if (ACPI_FAILURE (status)) { + return (status); } acpi_cm_acquire_mutex (ACPI_MTX_NAMESPACE); @@ -173,13 +170,12 @@ /* Lookup the name in the namespace */ status = acpi_ns_lookup (NULL, internal_path, ACPI_TYPE_ANY, - IMODE_EXECUTE, - NS_NO_UPSEARCH, NULL, - &obj_entry); + IMODE_EXECUTE, NS_NO_UPSEARCH, NULL, + &node); acpi_cm_release_mutex (ACPI_MTX_NAMESPACE); - if (status != AE_OK) { + if (ACPI_FAILURE (status)) { goto cleanup; } @@ -188,7 +184,7 @@ * to evaluate it. */ - status = acpi_ns_evaluate_by_handle (obj_entry, params, return_object); + status = acpi_ns_evaluate_by_handle (node, params, return_object); cleanup: @@ -203,16 +199,16 @@ } -/**************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_ns_evaluate_by_handle * - * PARAMETERS: Obj_entry - NTE of method to execute - * *Return_object - Where to put method's return value (if - * any). If NULL, no value is returned. + * PARAMETERS: Handle - Method Node to execute * **Params - List of parameters to pass to the method, * terminated by NULL. Params itself may be * NULL if no parameters are being passed. + * *Return_object - Where to put method's return value (if + * any). If NULL, no value is returned. * * RETURN: Status * @@ -220,22 +216,22 @@ * * MUTEX: Locks Namespace * - ****************************************************************************/ + ******************************************************************************/ ACPI_STATUS acpi_ns_evaluate_by_handle ( - ACPI_NAMED_OBJECT *handle, - ACPI_OBJECT_INTERNAL **params, - ACPI_OBJECT_INTERNAL **return_object) + ACPI_NAMESPACE_NODE *handle, + ACPI_OPERAND_OBJECT **params, + ACPI_OPERAND_OBJECT **return_object) { - ACPI_NAMED_OBJECT *obj_entry; + ACPI_NAMESPACE_NODE *node; ACPI_STATUS status; - ACPI_OBJECT_INTERNAL *local_return_object; + ACPI_OPERAND_OBJECT *local_return_object; /* Check if namespace has been initialized */ - if (!acpi_gbl_root_object->child_table) { + if (!acpi_gbl_root_node) { return (AE_NO_NAMESPACE); } @@ -251,12 +247,12 @@ *return_object = NULL; } - /* Get the prefix handle and NTE */ + /* Get the prefix handle and Node */ acpi_cm_acquire_mutex (ACPI_MTX_NAMESPACE); - obj_entry = acpi_ns_convert_handle_to_entry (handle); - if (!obj_entry) { + node = acpi_ns_convert_handle_to_entry (handle); + if (!node) { status = AE_BAD_PARAMETER; goto unlock_and_exit; } @@ -271,14 +267,11 @@ * In both cases, the namespace is unlocked by the * Acpi_ns* procedure */ - - if (acpi_ns_get_type (obj_entry) == ACPI_TYPE_METHOD) { + if (acpi_ns_get_type (node) == ACPI_TYPE_METHOD) { /* * Case 1) We have an actual control method to execute */ - - status = acpi_ns_execute_control_method (obj_entry, - params, + status = acpi_ns_execute_control_method (node, params, &local_return_object); } @@ -287,9 +280,7 @@ * Case 2) Object is NOT a method, just return its * current value */ - - status = acpi_ns_get_object_value (obj_entry, - &local_return_object); + status = acpi_ns_get_object_value (node, &local_return_object); } @@ -297,7 +288,6 @@ * Check if there is a return value on the stack that must * be dealt with */ - if (status == AE_CTRL_RETURN_VALUE) { /* * If the Method returned a value and the caller @@ -305,13 +295,11 @@ * the returned value to the object descriptor provided * by the caller. */ - if (return_object) { /* * Valid return object, copy the pointer to * the returned object */ - *return_object = local_return_object; } @@ -327,7 +315,6 @@ * Namespace was unlocked by the handling Acpi_ns* function, * so we just return */ - return (status); @@ -338,14 +325,16 @@ } -/**************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_ns_execute_control_method * - * PARAMETERS: Method_entry - The Nte of the object/method + * PARAMETERS: Method_node - The object/method * **Params - List of parameters to pass to the method, * terminated by NULL. Params itself may be * NULL if no parameters are being passed. + * **Return_obj_desc - List of result objects to be returned + * from the method. * * RETURN: Status * @@ -353,36 +342,31 @@ * * MUTEX: Assumes namespace is locked * - ****************************************************************************/ + ******************************************************************************/ ACPI_STATUS acpi_ns_execute_control_method ( - ACPI_NAMED_OBJECT *method_entry, - ACPI_OBJECT_INTERNAL **params, - ACPI_OBJECT_INTERNAL **return_obj_desc) + ACPI_NAMESPACE_NODE *method_node, + ACPI_OPERAND_OBJECT **params, + ACPI_OPERAND_OBJECT **return_obj_desc) { ACPI_STATUS status; - ACPI_OBJECT_INTERNAL *obj_desc; + ACPI_OPERAND_OBJECT *obj_desc; /* Verify that there is a method associated with this object */ - obj_desc = acpi_ns_get_attached_object ((ACPI_HANDLE) method_entry); + obj_desc = acpi_ns_get_attached_object ((ACPI_HANDLE) method_node); if (!obj_desc) { return (AE_ERROR); } - /* - * Valid method, Set the current scope to that of the Method, - * and execute it. - */ - /* * Unlock the namespace before execution. This allows namespace access * via the external Acpi* interfaces while a method is being executed. * However, any namespace deletion must acquire both the namespace and - * interpter locks to ensure that no thread is using the portion of the + * interpreter locks to ensure that no thread is using the portion of the * namespace that is being deleted. */ @@ -391,17 +375,17 @@ /* * Excecute the method via the interpreter */ - status = acpi_aml_execute_method (method_entry, params, return_obj_desc); + status = acpi_aml_execute_method (method_node, params, return_obj_desc); return (status); } -/**************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_ns_get_object_value * - * PARAMETERS: Object_entry - The Nte of the object + * PARAMETERS: Node - The object * * RETURN: Status * @@ -409,30 +393,29 @@ * * MUTEX: Assumes namespace is locked * - ****************************************************************************/ + ******************************************************************************/ ACPI_STATUS acpi_ns_get_object_value ( - ACPI_NAMED_OBJECT *object_entry, - ACPI_OBJECT_INTERNAL **return_obj_desc) + ACPI_NAMESPACE_NODE *node, + ACPI_OPERAND_OBJECT **return_obj_desc) { ACPI_STATUS status = AE_OK; - ACPI_OBJECT_INTERNAL *obj_desc; - ACPI_OBJECT_INTERNAL *val_desc; + ACPI_OPERAND_OBJECT *obj_desc; + ACPI_OPERAND_OBJECT *val_desc; /* * We take the value from certain objects directly */ - if ((object_entry->type == ACPI_TYPE_PROCESSOR) || - (object_entry->type == ACPI_TYPE_POWER)) + if ((node->type == ACPI_TYPE_PROCESSOR) || + (node->type == ACPI_TYPE_POWER)) { - /* * Create a Reference object to contain the object */ - obj_desc = acpi_cm_create_internal_object (object_entry->type); + obj_desc = acpi_cm_create_internal_object (node->type); if (!obj_desc) { status = AE_NO_MEMORY; goto unlock_and_exit; @@ -442,7 +425,7 @@ * Get the attached object */ - val_desc = acpi_ns_get_attached_object (object_entry); + val_desc = acpi_ns_get_attached_object (node); if (!val_desc) { status = AE_NULL_OBJECT; goto unlock_and_exit; @@ -452,10 +435,25 @@ * Just copy from the original to the return object */ - MEMCPY (&obj_desc->common.first_non_common_byte, - &val_desc->common.first_non_common_byte, - (sizeof(ACPI_OBJECT_COMMON) - - sizeof(obj_desc->common.first_non_common_byte))); + 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; + } } @@ -475,15 +473,19 @@ /* Construct a descriptor pointing to the name */ obj_desc->reference.op_code = (u8) AML_NAME_OP; - obj_desc->reference.object = (void *) object_entry; + obj_desc->reference.object = (void *) node; /* * Use Acpi_aml_resolve_to_value() to get the associated value. * The call to Acpi_aml_resolve_to_value causes * Obj_desc (allocated above) to always be deleted. + * + * 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 */ - status = acpi_aml_resolve_to_value (&obj_desc); + status = acpi_aml_resolve_to_value (&obj_desc, NULL); } /* @@ -491,7 +493,7 @@ * placed in Obj_desc. */ - if (status == AE_OK) { + if (ACPI_SUCCESS (status)) { status = AE_CTRL_RETURN_VALUE; *return_obj_desc = obj_desc; diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/namespace/nsload.c linux/drivers/acpi/namespace/nsload.c --- v2.4.0-test8/linux/drivers/acpi/namespace/nsload.c Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/namespace/nsload.c Fri Sep 15 14:30:30 2000 @@ -1,7 +1,7 @@ - /****************************************************************************** * * Module Name: nsload - namespace loading/expanding/contracting procedures + * $Revision: 28 $ * *****************************************************************************/ @@ -25,16 +25,16 @@ #include "acpi.h" -#include "interp.h" -#include "namesp.h" +#include "acinterp.h" +#include "acnamesp.h" #include "amlcode.h" -#include "parser.h" -#include "dispatch.h" -#include "debugger.h" +#include "acparser.h" +#include "acdispat.h" +#include "acdebug.h" #define _COMPONENT NAMESPACE - MODULE_NAME ("nsload"); + MODULE_NAME ("nsload") /******************************************************************************* @@ -42,7 +42,7 @@ * FUNCTION: Acpi_ns_parse_table * * PARAMETERS: Table_desc - An ACPI table descriptor for table to parse - * Scope - Where to enter the table into the namespace + * Start_node - Where to enter the table into the namespace * * RETURN: Status * @@ -53,50 +53,85 @@ ACPI_STATUS acpi_ns_parse_table ( ACPI_TABLE_DESC *table_desc, - ACPI_NAME_TABLE *scope) + ACPI_NAMESPACE_NODE *start_node) { ACPI_STATUS status; - /* Create the root object */ + /* + * AML Parse, pass 1 + * + * In this pass, we load most of the namespace. Control methods + * are not parsed until later. A parse tree is not created. Instead, + * each Parser Op subtree is deleted when it is finished. This saves + * a great deal of memory, and allows a small cache of parse objects + * to service the entire parse. The second pass of the parse then + * 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); } - /* Initialize the root object */ + ((ACPI_PARSE2_OBJECT *) acpi_gbl_parsed_namespace_root)->name = ACPI_ROOT_NAME; - ((ACPI_NAMED_OP *) 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, 0); + 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); if (ACPI_FAILURE (status)) { return (status); } - -#ifndef PARSER_ONLY - status = acpi_ps_walk_parsed_aml (acpi_ps_get_child (acpi_gbl_parsed_namespace_root), - acpi_gbl_parsed_namespace_root, NULL, - scope, NULL, NULL, - table_desc->table_id, - acpi_ds_load2_begin_op, - acpi_ds_load2_end_op); + acpi_ps_delete_parse_tree (acpi_gbl_parsed_namespace_root); /* - * Now that the internal namespace has been constructed, we can delete the - * parsed namespace, since it is no longer needed + * AML Parse, pass 2 + * + * In this pass, we resolve forward references and other things + * that could not be completed during the first pass. + * Another complete parse of the AML is performed, but the + * overhead of this is compensated for by the fact that the + * 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); + + if (ACPI_FAILURE (status)) { + return (status); + } + acpi_ps_delete_parse_tree (acpi_gbl_parsed_namespace_root); acpi_gbl_parsed_namespace_root = NULL; -#endif return (status); @@ -120,7 +155,7 @@ ACPI_STATUS acpi_ns_load_table ( ACPI_TABLE_DESC *table_desc, - ACPI_NAMED_OBJECT *entry) + ACPI_NAMESPACE_NODE *node) { ACPI_STATUS status; @@ -146,7 +181,7 @@ */ acpi_cm_acquire_mutex (ACPI_MTX_NAMESPACE); - status = acpi_ns_parse_table (table_desc, entry->child_table); + status = acpi_ns_parse_table (table_desc, node->child); acpi_cm_release_mutex (ACPI_MTX_NAMESPACE); if (ACPI_FAILURE (status)) { @@ -160,7 +195,7 @@ * parse trees. */ - status = acpi_ds_initialize_objects (table_desc, entry); + status = acpi_ds_initialize_objects (table_desc, node); return (status); } @@ -222,7 +257,7 @@ /* Now load the single DSDT */ - status = acpi_ns_load_table (table_desc, acpi_gbl_root_object); + status = acpi_ns_load_table (table_desc, acpi_gbl_root_node); if (ACPI_SUCCESS (status)) { table_desc->loaded_into_namespace = TRUE; } @@ -247,7 +282,7 @@ if (!table_desc->loaded_into_namespace) { status = acpi_ns_load_table (table_desc, - acpi_gbl_root_object); + acpi_gbl_root_node); if (ACPI_FAILURE (status)) { break; } @@ -276,7 +311,7 @@ if (!table_desc->loaded_into_namespace) { status = acpi_ns_load_table (table_desc, - acpi_gbl_root_object); + acpi_gbl_root_node); if (ACPI_FAILURE (status)) { break; } @@ -306,52 +341,6 @@ /****************************************************************************** * - * FUNCTION: Acpi_ns_free_table_entry - * - * PARAMETERS: Entry - The entry to be deleted - * - * RETURNS None - * - * DESCRIPTION: Free an entry in a namespace table. Delete any objects contained - * in the entry, unlink the entry, then mark it unused. - * - ******************************************************************************/ - -void -acpi_ns_free_table_entry ( - ACPI_NAMED_OBJECT *entry) -{ - - if (!entry) { - return; - } - - /* - * Need to delete - * 1) The scope, if any - * 2) An attached object, if any - */ - - if (entry->child_table) { - acpi_cm_free (entry->child_table); - entry->child_table = NULL; - } - - if (entry->object) { - acpi_ns_detach_object (entry->object); - entry->object = NULL; - } - - /* Mark the entry unallocated */ - - entry->name = 0; - - return; -} - - -/****************************************************************************** - * * FUNCTION: Acpi_ns_delete_subtree * * PARAMETERS: Start_handle - Handle in namespace where search begins @@ -394,15 +383,6 @@ child_handle, &next_child_handle); - /* - * Regardless of the success or failure of the - * previous operation, we are done with the previous - * object (if there was one), and any children it - * may have had. So we can now safely delete it (and - * its scope, if any) - */ - - acpi_ns_free_table_entry (child_handle); child_handle = next_child_handle; @@ -432,6 +412,11 @@ * the object's parent */ level--; + + /* Delete all children now */ + + acpi_ns_delete_children (child_handle); + child_handle = parent_handle; acpi_get_parent (parent_handle, &parent_handle); } @@ -439,7 +424,7 @@ /* Now delete the starting object, and we are done */ - acpi_ns_free_table_entry ((ACPI_NAMED_OBJECT*) child_handle); + acpi_ns_delete_node (child_handle); return (AE_OK); @@ -469,7 +454,7 @@ /* Parameter validation */ - if (!acpi_gbl_root_object->child_table) { + if (!acpi_gbl_root_node) { return (AE_NO_NAMESPACE); } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/namespace/nsnames.c linux/drivers/acpi/namespace/nsnames.c --- v2.4.0-test8/linux/drivers/acpi/namespace/nsnames.c Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/namespace/nsnames.c Fri Sep 15 14:30:30 2000 @@ -1,9 +1,9 @@ - -/****************************************************************************** +/******************************************************************************* * * Module Name: nsnames - Name manipulation and search + * $Revision: 48 $ * - *****************************************************************************/ + ******************************************************************************/ /* * Copyright (C) 2000 R. Byron Moore @@ -26,42 +26,40 @@ #include "acpi.h" #include "amlcode.h" -#include "interp.h" -#include "namesp.h" +#include "acinterp.h" +#include "acnamesp.h" #define _COMPONENT NAMESPACE - MODULE_NAME ("nsnames"); + MODULE_NAME ("nsnames") -/**************************************************************************** +/******************************************************************************* * - * FUNCTION: Acpi_ns_name_of_scope + * FUNCTION: Acpi_ns_get_table_pathname * - * PARAMETERS: Scope - Scope whose name is needed + * PARAMETERS: Node - Scope whose name is needed * * RETURN: Pointer to storage containing the fully qualified name of * the scope, in Label format (all segments strung together * with no separators) * - * DESCRIPTION: Used via Acpi_ns_name_of_current_scope() and Acpi_ns_last_fQN() - * for label generation in the interpreter, and for debug - * printing in Acpi_ns_search_table(). - * - ***************************************************************************/ - -char * -acpi_ns_name_of_scope ( - ACPI_NAME_TABLE *scope) + * DESCRIPTION: Used for debug printing in Acpi_ns_search_table(). + * + ******************************************************************************/ + +NATIVE_CHAR * +acpi_ns_get_table_pathname ( + ACPI_NAMESPACE_NODE *node) { - char *name_buffer; - ACPI_SIZE size; + NATIVE_CHAR *name_buffer; + u32 size; ACPI_NAME name; - ACPI_NAMED_OBJECT *entry_to_search; - ACPI_NAMED_OBJECT *parent_entry; + ACPI_NAMESPACE_NODE *child_node; + ACPI_NAMESPACE_NODE *parent_node; - if (!acpi_gbl_root_object->child_table || !scope) { + if (!acpi_gbl_root_node || !node) { /* * If the name space has not been initialized, * this function should not have been called. @@ -69,26 +67,26 @@ return (NULL); } - entry_to_search = scope->entries; + child_node = node->child; - /* Calculate required buffer size based on depth below root NT */ + /* Calculate required buffer size based on depth below root */ size = 1; - parent_entry = entry_to_search; - while (parent_entry) { - parent_entry = acpi_ns_get_parent_entry (parent_entry); - if (parent_entry) { + parent_node = child_node; + while (parent_node) { + parent_node = acpi_ns_get_parent_object (parent_node); + if (parent_node) { size += ACPI_NAME_SIZE; } } - /* Allocate the buffer */ + /* Allocate a buffer to be returned to caller */ name_buffer = acpi_cm_callocate (size + 1); if (!name_buffer) { - REPORT_ERROR ("Ns_name_of_scope: allocation failure"); + REPORT_ERROR ("Ns_get_table_pathname: allocation failure"); return (NULL); } @@ -97,15 +95,15 @@ name_buffer[size] = '\0'; while ((size > ACPI_NAME_SIZE) && - acpi_ns_get_parent_entry (entry_to_search)) + acpi_ns_get_parent_object (child_node)) { size -= ACPI_NAME_SIZE; - name = acpi_ns_find_parent_name (entry_to_search); + name = acpi_ns_find_parent_name (child_node); /* Put the name into the buffer */ MOVE_UNALIGNED32_TO_32 ((name_buffer + size), &name); - entry_to_search = acpi_ns_get_parent_entry (entry_to_search); + child_node = acpi_ns_get_parent_object (child_node); } name_buffer[--size] = AML_ROOT_PREFIX; @@ -115,69 +113,39 @@ } -/**************************************************************************** - * - * FUNCTION: Acpi_ns_name_of_current_scope - * - * PARAMETERS: none - * - * RETURN: pointer to storage containing the name of the current scope - * - ***************************************************************************/ - -char * -acpi_ns_name_of_current_scope ( - ACPI_WALK_STATE *walk_state) -{ - char *scope_name; - - - if (walk_state && walk_state->scope_info) { - scope_name = - acpi_ns_name_of_scope (walk_state->scope_info->scope.name_table); - - return (scope_name); - } - - REPORT_ERROR ("Current scope pointer is invalid"); - - return (NULL); -} - - -/**************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_ns_handle_to_pathname * - * PARAMETERS: Target_handle - Handle of nte whose name is to be found + * PARAMETERS: Target_handle - Handle of named object whose name is + * to be found * Buf_size - Size of the buffer provided * User_buffer - Where the pathname is returned * - * RETURN: Status, Buffer is filled with pathname if status == AE_OK + * RETURN: Status, Buffer is filled with pathname if status is AE_OK * * DESCRIPTION: Build and return a full namespace pathname * * MUTEX: Locks Namespace * - ***************************************************************************/ + ******************************************************************************/ ACPI_STATUS acpi_ns_handle_to_pathname ( ACPI_HANDLE target_handle, u32 *buf_size, - char *user_buffer) + NATIVE_CHAR *user_buffer) { ACPI_STATUS status = AE_OK; - ACPI_NAMED_OBJECT *entry_to_search = NULL; - ACPI_NAMED_OBJECT *temp = NULL; - ACPI_SIZE path_length = 0; - ACPI_SIZE size; + ACPI_NAMESPACE_NODE *node; + ACPI_NAMESPACE_NODE *next_node; + u32 path_length; + u32 size; u32 user_buf_size; ACPI_NAME name; - u8 namespace_was_locked; - if (!acpi_gbl_root_object->child_table || !target_handle) { + if (!acpi_gbl_root_node || !target_handle) { /* * If the name space has not been initialized, * this function should not have been called. @@ -186,13 +154,8 @@ return (AE_NO_NAMESPACE); } - namespace_was_locked = acpi_gbl_acpi_mutex_info[ACPI_MTX_NAMESPACE].locked; - if (!namespace_was_locked) { - acpi_cm_acquire_mutex (ACPI_MTX_NAMESPACE); - } - - entry_to_search = acpi_ns_convert_handle_to_entry (target_handle); - if (!entry_to_search) { + node = acpi_ns_convert_handle_to_entry (target_handle); + if (!node) { return (AE_BAD_PARAMETER); } @@ -200,9 +163,9 @@ * Compute length of pathname as 5 * number of name segments. * Go back up the parent tree to the root */ - for (size = 0, temp = entry_to_search; - acpi_ns_get_parent_entry (temp); - temp = acpi_ns_get_parent_entry (temp)) + for (size = 0, next_node = node; + acpi_ns_get_parent_object (next_node); + next_node = acpi_ns_get_parent_object (next_node)) { size += PATH_SEGMENT_LENGTH; } @@ -217,7 +180,7 @@ if (path_length > user_buf_size) { status = AE_BUFFER_OVERFLOW; - goto unlock_and_exit; + goto exit; } /* Store null terminator */ @@ -228,19 +191,19 @@ /* Put the original ACPI name at the end of the path */ MOVE_UNALIGNED32_TO_32 ((user_buffer + size), - &entry_to_search->name); + &node->name); user_buffer[--size] = PATH_SEPARATOR; /* Build name backwards, putting "." between segments */ - while ((size > ACPI_NAME_SIZE) && entry_to_search) { + while ((size > ACPI_NAME_SIZE) && node) { size -= ACPI_NAME_SIZE; - name = acpi_ns_find_parent_name (entry_to_search); + name = acpi_ns_find_parent_name (node); MOVE_UNALIGNED32_TO_32 ((user_buffer + size), &name); user_buffer[--size] = PATH_SEPARATOR; - entry_to_search = acpi_ns_get_parent_entry (entry_to_search); + node = acpi_ns_get_parent_object (node); } /* @@ -250,254 +213,8 @@ user_buffer[size] = '\\'; - -unlock_and_exit: - - if (!namespace_was_locked) { - acpi_cm_release_mutex (ACPI_MTX_NAMESPACE); - } - +exit: return (status); -} - - -/**************************************************************************** - * - * FUNCTION: Acpi_ns_pattern_match - * - * PARAMETERS: Obj_entry - A namespace entry - * Search_for - Wildcard pattern string - * - * DESCRIPTION: Matches a namespace name against a wildcard pattern. Only - * a very simple pattern - 4 chars, either a valid char or a "?" - * to match any. - * - ***************************************************************************/ - -u8 -acpi_ns_pattern_match ( - ACPI_NAMED_OBJECT *obj_entry, - char *search_for) -{ - s32 i; - - - for (i = 0; i < ACPI_NAME_SIZE; i++) { - if (search_for[i] != '?' && - search_for[i] != ((char *) &obj_entry->name)[i]) - { - /* No match */ - - return FALSE; - } - } - - /* name matches pattern */ - - return TRUE; -} - - -/**************************************************************************** - * - * FUNCTION: Acpi_ns_name_compare - * - * PARAMETERS: Obj_handle - A namespace entry - * Level - Current nesting level - * Context - A FIND_CONTEXT structure - * - * DESCRIPTION: A User_function called by Acpi_ns_walk_namespace(). It performs - * a pattern match for Acpi_ns_low_find_names(), and updates the list - * and count as required. - * - ***************************************************************************/ - -ACPI_STATUS -acpi_ns_name_compare ( - ACPI_HANDLE obj_handle, - u32 level, - void *context, - void **return_value) -{ - FIND_CONTEXT *find = context; - - - /* Match, yes or no? */ - - if (acpi_ns_pattern_match ((ACPI_NAMED_OBJECT*) obj_handle, - find->search_for)) - { - /* Name matches pattern */ - - if (find->list) { - find->list[*(find->count)] = obj_handle; - } - - ++*(find->count); - } - - /* Don't terminate the walk */ - return AE_OK; -} - - -/**************************************************************************** - * - * FUNCTION: Acpi_ns_low_find_names - * - * PARAMETERS: *This_entry - Table to be searched - * *Search_for - Pattern to be found. - * 4 bytes, ? matches any character. - * *Count - Output count of matches found. - * Outermost caller should preset to 0 - * List[] - Output array of handles. If - * null, only the count is obtained. - * Max_depth - Maximum depth of search. Use - * INT_MAX for an effectively - * unlimited depth. - * - * DESCRIPTION: Low-level find name. - * Traverse the name space finding names which match a search - * pattern, and return an array of handles in List[]. - * - ***************************************************************************/ - -void -acpi_ns_low_find_names ( - ACPI_NAMED_OBJECT *this_entry, - char *search_for, - s32 *count, - ACPI_HANDLE list[], - s32 max_depth) -{ - FIND_CONTEXT find; - - - if (0 == max_depth || !this_entry || !search_for || !count) { - /* - * Zero requested depth, nothing to search, - * nothing to search for, or count pointer bad - */ - - return; - } - - /* Init the context structure used by compare routine */ - - find.list = list; - find.count = count; - find.search_for = search_for; - - /* Walk the namespace and find all matches */ - - acpi_ns_walk_namespace (ACPI_TYPE_ANY, (ACPI_HANDLE) this_entry, - max_depth, NS_WALK_NO_UNLOCK, - acpi_ns_name_compare, &find, NULL); - - if (list) { - /* null-terminate the output array */ - - list[*count] = (ACPI_HANDLE) 0; - } - - return; -} - - -/**************************************************************************** - * - * FUNCTION: Acpi_ns_find_names - - * - * PARAMETERS: *Search_for - pattern to be found. - * 4 bytes, ? matches any character. - * If NULL, "????" will be used. - * Start_handle - Root of subtree to be searched, or - * NS_ALL to search the entire namespace - * Max_depth - Maximum depth of search. Use INT_MAX - * for an effectively unlimited depth. - * - * DESCRIPTION: Traverse the name space finding names which match a search - * pattern, and return an array of handles. The end of the - * array is marked by the value (ACPI_HANDLE)0. A return value - * of (ACPI_HANDLE *)0 indicates that no matching names were - * found or that space for the list could not be allocated. - * if Start_handle is NS_ALL (null) search from the root, - * else it is a handle whose children are to be searched. - * - ***************************************************************************/ - -ACPI_HANDLE * -acpi_ns_find_names ( - char *search_for, - ACPI_HANDLE start_handle, - s32 max_depth) -{ - ACPI_HANDLE *list = NULL; - s32 count; - - - if (!acpi_gbl_root_object->child_table) { - /* - * If the name space has not been initialized, - * there surely are no matching names. - */ - return (NULL); - } - - if (NS_ALL == start_handle) { - /* base is root */ - - start_handle = acpi_gbl_root_object; - } - - else if (((ACPI_NAMED_OBJECT *) start_handle)->child_table) { - /* base has children to search */ - - start_handle = - ((ACPI_NAMED_OBJECT *) start_handle)->child_table->entries; - } - - else { - /* - * If base is not the root and has no children, - * there is nothing to search. - */ - return (NULL); - } - - if (!search_for) { - /* Search name not specified */ - - search_for = "????"; - } - - - /* Pass 1. Get required buffer size, don't try to build list */ - - count = 0; - acpi_ns_low_find_names (start_handle, search_for, &count, - NULL, max_depth); - - if (0 == count) { - return (NULL); - } - - /* Allow for trailing null */ - count++; - - list = acpi_cm_callocate (count * sizeof(ACPI_HANDLE)); - if (!list) { - REPORT_ERROR ("Ns_find_names: allocation failure"); - return (NULL); - } - - /* Pass 2. Fill buffer */ - - count = 0; - acpi_ns_low_find_names (start_handle, search_for, &count, list, max_depth); - - return (list); } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/namespace/nsobject.c linux/drivers/acpi/namespace/nsobject.c --- v2.4.0-test8/linux/drivers/acpi/namespace/nsobject.c Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/namespace/nsobject.c Fri Sep 15 14:30:30 2000 @@ -1,10 +1,10 @@ - -/****************************************************************************** +/******************************************************************************* * * Module Name: nsobject - Utilities for objects attached to namespace - * table entries + * table entries + * $Revision: 44 $ * - *****************************************************************************/ + ******************************************************************************/ /* * Copyright (C) 2000 R. Byron Moore @@ -27,20 +27,20 @@ #include "acpi.h" #include "amlcode.h" -#include "namesp.h" -#include "interp.h" -#include "tables.h" +#include "acnamesp.h" +#include "acinterp.h" +#include "actables.h" #define _COMPONENT NAMESPACE - MODULE_NAME ("nsobject"); + MODULE_NAME ("nsobject") -/**************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_ns_attach_object * - * PARAMETERS: Handle - Handle of nte + * PARAMETERS: Node - Parent Node * Object - Object to be attached * Type - Type of object, or ACPI_TYPE_ANY if not * known @@ -51,17 +51,16 @@ * * MUTEX: Assumes namespace is locked * - ***************************************************************************/ + ******************************************************************************/ ACPI_STATUS acpi_ns_attach_object ( - ACPI_HANDLE handle, - ACPI_HANDLE object, + ACPI_NAMESPACE_NODE *node, + ACPI_OPERAND_OBJECT *object, OBJECT_TYPE_INTERNAL type) { - ACPI_NAMED_OBJECT *this_entry = (ACPI_NAMED_OBJECT*) handle; - ACPI_OBJECT_INTERNAL *obj_desc; - ACPI_OBJECT_INTERNAL *previous_obj_desc; + ACPI_OPERAND_OBJECT *obj_desc; + ACPI_OPERAND_OBJECT *previous_obj_desc; OBJECT_TYPE_INTERNAL obj_type = ACPI_TYPE_ANY; u8 flags; u16 opcode; @@ -71,17 +70,17 @@ * Parameter validation */ - if (!acpi_gbl_root_object->child_table) { + if (!acpi_gbl_root_node) { /* Name space not initialized */ REPORT_ERROR ("Ns_attach_object: Name space not initialized"); return (AE_NO_NAMESPACE); } - if (!handle) { + if (!node) { /* Invalid handle */ - REPORT_ERROR ("Ns_attach_object: Null name handle"); + REPORT_ERROR ("Ns_attach_object: Null Named_obj handle"); return (AE_BAD_PARAMETER); } @@ -93,7 +92,7 @@ return (AE_BAD_PARAMETER); } - if (!VALID_DESCRIPTOR_TYPE (handle, ACPI_DESC_TYPE_NAMED)) { + if (!VALID_DESCRIPTOR_TYPE (node, ACPI_DESC_TYPE_NAMED)) { /* Not a name handle */ REPORT_ERROR ("Ns_attach_object: Invalid handle"); @@ -102,15 +101,15 @@ /* Check if this object is already attached */ - if (this_entry->object == object) { + if (node->object == object) { return (AE_OK); } - /* Get the current flags field of the NTE */ + /* Get the current flags field of the Node */ - flags = this_entry->flags; - flags &= ~NTE_AML_ATTACHMENT; + flags = node->flags; + flags &= ~ANOBJ_AML_ATTACHMENT; /* If null object, we will just install it */ @@ -121,27 +120,27 @@ } /* - * If the object is an NTE with an attached object, + * If the object is an Node with an attached object, * we will use that (attached) object */ else if (VALID_DESCRIPTOR_TYPE (object, ACPI_DESC_TYPE_NAMED) && - ((ACPI_NAMED_OBJECT*) object)->object) + ((ACPI_NAMESPACE_NODE *) object)->object) { /* * Value passed is a name handle and that name has a * non-null value. Use that name's value and type. */ - obj_desc = ((ACPI_NAMED_OBJECT*) object)->object; - obj_type = ((ACPI_NAMED_OBJECT*) object)->type; + obj_desc = ((ACPI_NAMESPACE_NODE *) object)->object; + obj_type = ((ACPI_NAMESPACE_NODE *) object)->type; /* * Copy appropriate flags */ - if (((ACPI_NAMED_OBJECT*) object)->flags & NTE_AML_ATTACHMENT) { - flags |= NTE_AML_ATTACHMENT; + if (((ACPI_NAMESPACE_NODE *) object)->flags & ANOBJ_AML_ATTACHMENT) { + flags |= ANOBJ_AML_ATTACHMENT; } } @@ -152,7 +151,7 @@ */ else { - obj_desc = (ACPI_OBJECT_INTERNAL *) object; + obj_desc = (ACPI_OPERAND_OBJECT *) object; /* If a valid type (non-ANY) was given, just use it */ @@ -173,10 +172,10 @@ else if (acpi_tb_system_table_pointer (object)) { /* * Object points into the AML stream. - * Set a flag bit in the NTE to indicate this + * Set a flag bit in the Node to indicate this */ - flags |= NTE_AML_ATTACHMENT; + flags |= ANOBJ_AML_ATTACHMENT; /* * The next byte (perhaps the next two bytes) @@ -263,13 +262,13 @@ /* Save the existing object (if any) for deletion later */ - previous_obj_desc = this_entry->object; + previous_obj_desc = node->object; /* Install the object and set the type, flags */ - this_entry->object = obj_desc; - this_entry->type = (u8) obj_type; - this_entry->flags = flags; + node->object = obj_desc; + node->type = (u8) obj_type; + node->flags |= flags; /* @@ -277,86 +276,12 @@ */ if (previous_obj_desc) { - /* One for the attach to the NTE */ - acpi_cm_remove_reference (previous_obj_desc); - /* Now delete */ - acpi_cm_remove_reference (previous_obj_desc); - } + /* One for the attach to the Node */ - return (AE_OK); -} - - -/**************************************************************************** - * - * FUNCTION: Acpi_ns_attach_method - * - * PARAMETERS: Handle - Handle of nte to be set - * Offset - Value to be set - * Length - Length associated with value - * - * DESCRIPTION: Record the given offset and p-code length of the method - * whose handle is passed - * - * MUTEX: Assumes namespace is locked - * - ***************************************************************************/ - -ACPI_STATUS -acpi_ns_attach_method ( - ACPI_HANDLE handle, - u8 *pcode_addr, - u32 pcode_length) -{ - ACPI_OBJECT_INTERNAL *obj_desc; - ACPI_OBJECT_INTERNAL *previous_obj_desc; - ACPI_NAMED_OBJECT *this_entry = (ACPI_NAMED_OBJECT*) handle; - - - /* Parameter validation */ - - if (!acpi_gbl_root_object->child_table) { - /* Name space uninitialized */ - - REPORT_ERROR ("Ns_attach_method: name space uninitialized"); - return (AE_NO_NAMESPACE); - } - - if (!handle) { - /* Null name handle */ - - REPORT_ERROR ("Ns_attach_method: null name handle"); - return (AE_BAD_PARAMETER); - } - - - /* Allocate a method descriptor */ - - obj_desc = acpi_cm_create_internal_object (ACPI_TYPE_METHOD); - if (!obj_desc) { - /* Method allocation failure */ - - REPORT_ERROR ("Ns_attach_method: allocation failure"); - return (AE_NO_MEMORY); - } - - /* Init the method info */ - - obj_desc->method.pcode = pcode_addr; - obj_desc->method.pcode_length = pcode_length; - - /* Update reference count and install */ - - acpi_cm_add_reference (obj_desc); - - previous_obj_desc = this_entry->object; - this_entry->object = obj_desc; + acpi_cm_remove_reference (previous_obj_desc); + /* Now delete */ - /* - * Delete an existing object. Don't try to re-use in case it is shared - */ - if (previous_obj_desc) { acpi_cm_remove_reference (previous_obj_desc); } @@ -364,11 +289,11 @@ } -/**************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_ns_detach_object * - * PARAMETERS: Object - An object whose Value will be deleted + * PARAMETERS: Node - An object whose Value will be deleted * * RETURN: None. * @@ -376,24 +301,23 @@ * Value is an allocated object, it is freed. Otherwise, the * field is simply cleared. * - ***************************************************************************/ + ******************************************************************************/ void acpi_ns_detach_object ( - ACPI_HANDLE object) + ACPI_NAMESPACE_NODE *node) { - ACPI_NAMED_OBJECT *entry = object; - ACPI_OBJECT_INTERNAL *obj_desc; + ACPI_OPERAND_OBJECT *obj_desc; - obj_desc = entry->object; + obj_desc = node->object; if (!obj_desc) { return; } /* Clear the entry in all cases */ - entry->object = NULL; + node->object = NULL; /* Found a valid value */ @@ -412,16 +336,16 @@ } -/**************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_ns_get_attached_object * - * PARAMETERS: Handle - Handle of nte to be examined + * PARAMETERS: Handle - Parent Node to be examined * - * RETURN: Current value of the object field from nte whose handle is - * passed + * RETURN: Current value of the object field from the Node whose + * handle is passed * - ***************************************************************************/ + ******************************************************************************/ void * acpi_ns_get_attached_object ( @@ -435,122 +359,7 @@ return (NULL); } - return (((ACPI_NAMED_OBJECT*) handle)->object); -} - - -/**************************************************************************** - * - * FUNCTION: Acpi_ns_compare_object - * - * PARAMETERS: Obj_handle - A namespace entry - * Level - Current nesting level - * Obj_desc - The value to be compared - * - * DESCRIPTION: A User_function called by Acpi_ns_walk_namespace(). It performs - * a comparison for Acpi_ns_find_attached_object(). The comparison is against - * the value in the value field of the Obj_handle (an NTE). - * If a match is found, the handle is returned, which aborts - * Acpi_ns_walk_namespace. - * - ***************************************************************************/ - -ACPI_STATUS -acpi_ns_compare_object ( - ACPI_HANDLE obj_handle, - u32 level, - void *obj_desc, - void **return_value) -{ - - if (((ACPI_NAMED_OBJECT*) obj_handle)->object == obj_desc) { - if (return_value) { - *return_value = obj_handle; - } - - /* Stop the walk */ - return AE_CTRL_TERMINATE; - } - - /* Not found, continue the walk */ - return AE_OK; -} - - -/**************************************************************************** - * - * FUNCTION: Acpi_ns_find_attached_object - * - * PARAMETERS: *Obj_desc - Value to be found in ptr_val field. - * Start_handle - Root of subtree to be searched, or - * NS_ALL to search the entire namespace - * Max_depth - Maximum depth of search. Use INT_MAX - * for an effectively unlimited depth. - * - * DESCRIPTION: Traverse the name space until finding a name whose Value field - * matches the Obj_desc parameter, and return a handle to that - * name, or (ACPI_HANDLE)0 if none exists. - * if Start_handle is NS_ALL (null) search from the root, - * else it is a handle whose children are to be searched. - * - ***************************************************************************/ - -ACPI_HANDLE -acpi_ns_find_attached_object ( - ACPI_OBJECT_INTERNAL *obj_desc, - ACPI_HANDLE start_handle, - s32 max_depth) -{ - ACPI_HANDLE ret_object; - ACPI_STATUS status; - - - /* Parameter validation */ - - if (!obj_desc) { - return (NULL); - } - - if (0 == max_depth) { - return (NULL); - } - - if (!acpi_gbl_root_object->child_table) { - /* - * If the name space has not been initialized, - * there surely are no matching values. - */ - return (NULL); - } - - if (NS_ALL == start_handle) { - start_handle = acpi_gbl_root_object; - } - - else { - /* - * If base is not the root and has no children, - * there is nothing to search. - */ - return (NULL); - } - - - /* - * Walk namespace until a match is found. - * Either the matching object is returned, or NULL in case - * of no match. - */ - status = acpi_ns_walk_namespace (ACPI_TYPE_ANY, start_handle, - max_depth, NS_WALK_NO_UNLOCK, - acpi_ns_compare_object, - obj_desc, &ret_object); - - if (ACPI_FAILURE (status)) { - ret_object = NULL; - } - - return (ret_object); + return (((ACPI_NAMESPACE_NODE *) handle)->object); } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/namespace/nssearch.c linux/drivers/acpi/namespace/nssearch.c --- v2.4.0-test8/linux/drivers/acpi/namespace/nssearch.c Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/namespace/nssearch.c Fri Sep 15 14:30:30 2000 @@ -1,9 +1,9 @@ - -/****************************************************************************** +/******************************************************************************* * * Module Name: nssearch - Namespace search + * $Revision: 57 $ * - *****************************************************************************/ + ******************************************************************************/ /* * Copyright (C) 2000 R. Byron Moore @@ -26,192 +26,132 @@ #include "acpi.h" #include "amlcode.h" -#include "interp.h" -#include "namesp.h" +#include "acinterp.h" +#include "acnamesp.h" #define _COMPONENT NAMESPACE - MODULE_NAME ("nssearch"); + MODULE_NAME ("nssearch") -/**************************************************************************** +/******************************************************************************* * - * FUNCTION: Acpi_ns_search_one_scope + * FUNCTION: Acpi_ns_search_node * - * PARAMETERS: *Entry_name - Ascii ACPI name to search for - * *Name_table - Starting table where search will begin + * PARAMETERS: *Target_name - Ascii ACPI name to search for + * *Node - Starting table where search will begin * Type - Object type to match - * **Ret_entry - Where the matched NTE is returned - * *Ret_info - Where info about the search is returned + * **Return_node - Where the matched Named obj is returned * - * RETURN: Status and return information via NS_SEARCH_DATA + * RETURN: Status * * DESCRIPTION: Search a single namespace table. Performs a simple search, * does not add entries or search parents. * - ***************************************************************************/ + * + * Named object lists are built (and subsequently dumped) in the + * order in which the names are encountered during the namespace load; + * + * All namespace searching is linear in this implementation, but + * could be easily modified to support any improved search + * algorithm. However, the linear search was chosen for simplicity + * and because the trees are small and the other interpreter + * execution overhead is relatively high. + * + ******************************************************************************/ ACPI_STATUS -acpi_ns_search_one_scope ( - u32 entry_name, - ACPI_NAME_TABLE *name_table, +acpi_ns_search_node ( + u32 target_name, + ACPI_NAMESPACE_NODE *node, OBJECT_TYPE_INTERNAL type, - ACPI_NAMED_OBJECT **ret_entry, - NS_SEARCH_DATA *ret_info) + ACPI_NAMESPACE_NODE **return_node) { - u32 position; - ACPI_NAME_TABLE *this_table; - ACPI_NAME_TABLE *previous_table = name_table; - ACPI_NAMED_OBJECT *entries; - u8 table_full = TRUE; - ACPI_NAME_TABLE *table_with_empty_slots = NULL; - u32 empty_slot_position = 0; + ACPI_NAMESPACE_NODE *next_node; - /* - * Name tables are built (and subsequently dumped) in the - * order in which the names are encountered during the namespace load; - * - * All namespace searching will be linear; If a table overflows an - * additional segment will be allocated and added (chained). - * - * Start linear search at top of table - */ - position = 0; - this_table = name_table; - entries = this_table->entries; - - - /* Init return data */ - - if (ret_info) { - ret_info->name_table = this_table; - } - /* - * Search entire name table, including all linked appendages + * Search for name in this table, which is to say that we must search + * for the name among the children of this object */ - while (this_table) { - /* - * Search for name in table, starting at Position. Stop - * searching upon examining all entries in the table. - * - */ + next_node = node->child; + while (next_node) { + /* Check for match against the name */ - entries = this_table->entries; - while (position < NS_TABLE_SIZE) { - /* Check for a valid entry */ - - if (!entries[position].name) { - if (table_full) { - /* - * There is room in the table for more - * entries, if necessary - */ - - table_full = FALSE; - table_with_empty_slots = this_table; - empty_slot_position = position; - } - } - - /* Search for name in table */ + if (next_node->name == target_name) { + /* + * Found matching entry. Capture type if + * appropriate before returning the entry. + */ - else if (entries[position].name == entry_name) { - /* - * Found matching entry. Capture type if - * appropriate before returning the entry. - */ - - /* - * The Def_field_defn and Bank_field_defn cases - * are actually looking up the Region in which - * the field will be defined - */ - - if ((INTERNAL_TYPE_DEF_FIELD_DEFN == type) || - (INTERNAL_TYPE_BANK_FIELD_DEFN == type)) - { - type = ACPI_TYPE_REGION; - } - - /* - * Scope, Def_any, and Index_field_defn are bogus - * "types" which do not actually have anything - * to do with the type of the name being looked - * up. For any other value of Type, if the type - * stored in the entry is Any (i.e. unknown), - * save the actual type. - */ - - if (type != INTERNAL_TYPE_SCOPE && - type != INTERNAL_TYPE_DEF_ANY && - type != INTERNAL_TYPE_INDEX_FIELD_DEFN && - entries[position].type == ACPI_TYPE_ANY) - { - entries[position].type = (u8) type; - } + /* + * The Def_field_defn and Bank_field_defn cases + * are actually looking up the Region in which + * the field will be defined + */ - *ret_entry = &entries[position]; - return (AE_OK); + if ((INTERNAL_TYPE_DEF_FIELD_DEFN == type) || + (INTERNAL_TYPE_BANK_FIELD_DEFN == type)) + { + type = ACPI_TYPE_REGION; } + /* + * Scope, Def_any, and Index_field_defn are bogus + * "types" which do not actually have anything + * to do with the type of the name being looked + * up. For any other value of Type, if the type + * stored in the entry is Any (i.e. unknown), + * save the actual type. + */ - /* Didn't match name, move on to the next entry */ + if (type != INTERNAL_TYPE_SCOPE && + type != INTERNAL_TYPE_DEF_ANY && + type != INTERNAL_TYPE_INDEX_FIELD_DEFN && + next_node->type == ACPI_TYPE_ANY) + { + next_node->type = (u8) type; + } - position++; + *return_node = next_node; + return (AE_OK); } /* - * Just examined last slot in this table, move on - * to next appendate. - * All appendages, even to the root NT, contain - * NS_TABLE_SIZE entries. + * The last entry in the list points back to the parent, + * so a flag is used to indicate the end-of-list */ + if (next_node->flags & ANOBJ_END_OF_PEER_LIST) { + /* Searched entire list, we are done */ + + break; + } - previous_table = this_table; - this_table = this_table->next_table; + /* Didn't match name, move on to the next peer object */ - position = 0; + next_node = next_node->peer; } /* Searched entire table, not found */ - if (ret_info) { - /* - * Save info on if/where a slot is available - * (name was not found) - */ - - ret_info->table_full = table_full; - if (table_full) { - ret_info->name_table = previous_table; - } - - else { - ret_info->position = empty_slot_position; - ret_info->name_table = table_with_empty_slots; - } - } - return (AE_NOT_FOUND); } -/**************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_ns_search_parent_tree * - * PARAMETERS: *Entry_name - Ascii ACPI name to search for - * *Name_table - Starting table where search will begin + * PARAMETERS: *Target_name - Ascii ACPI name to search for + * *Node - Starting table where search will begin * Type - Object type to match - * **Ret_entry - Where the matched NTE is returned + * **Return_node - Where the matched Named Obj is returned * * RETURN: Status * @@ -227,274 +167,79 @@ * indicates that the name is not found" (From ACPI Specification, * section 5.3) * - ***************************************************************************/ - + ******************************************************************************/ ACPI_STATUS acpi_ns_search_parent_tree ( - u32 entry_name, - ACPI_NAME_TABLE *name_table, + u32 target_name, + ACPI_NAMESPACE_NODE *node, OBJECT_TYPE_INTERNAL type, - ACPI_NAMED_OBJECT **ret_entry) + ACPI_NAMESPACE_NODE **return_node) { ACPI_STATUS status; - ACPI_NAMED_OBJECT *parent_entry; - ACPI_NAMED_OBJECT *entries; + ACPI_NAMESPACE_NODE *parent_node; - entries = name_table->entries; + parent_node = acpi_ns_get_parent_object (node); /* - * If no parent or type is "local", we won't be searching the - * parent tree. + * If there is no parent (at the root) or type is "local", we won't be + * searching the parent tree. */ - - if (!acpi_ns_local (type) && - name_table->parent_entry) + if ((acpi_ns_local (type)) || + (!parent_node)) { - parent_entry = name_table->parent_entry; - /* - * Search parents until found or we have backed up to - * the root - */ - - while (parent_entry) { - /* Search parent scope */ - /* TBD: [Investigate] Why ACPI_TYPE_ANY? */ - - status = acpi_ns_search_one_scope (entry_name, - parent_entry->child_table, - ACPI_TYPE_ANY, - ret_entry, NULL); - if (status == AE_OK) { - return (status); - } - - /* - * Not found here, go up another level - * (until we reach the root) - */ - - parent_entry = acpi_ns_get_parent_entry (parent_entry); - } - - /* Not found in parent tree */ - } - - - return (AE_NOT_FOUND); -} - - -/**************************************************************************** - * - * FUNCTION: Acpi_ns_create_and_link_new_table - * - * PARAMETERS: *Name_table - The table that is to be "extended" by - * the creation of an appendage table. - * - * RETURN: Status - * - * DESCRIPTION: Allocate a new namespace table, initialize it, and link it - * into the parent table. - * - * NOTE: We are in the first or second pass load mode, want to - * add a new table entry, and the current table is full. - * - ***************************************************************************/ - -ACPI_STATUS -acpi_ns_create_and_link_new_table ( - ACPI_NAME_TABLE *name_table) -{ - ACPI_NAME_TABLE *new_table; - ACPI_NAMED_OBJECT *parent_entry; - ACPI_STATUS status = AE_OK; - - - /* Sanity check on the data structure */ - - if (name_table->next_table) { - /* We should never get here (an appendage already allocated) */ - - return (AE_AML_INTERNAL); - } - - - /* - * We can use the parent entries from the current table - * Since the parent information remains the same. - */ - parent_entry = name_table->parent_entry; - - - /* Allocate and chain an appendage to the filled table */ - - new_table = acpi_ns_allocate_name_table (NS_TABLE_SIZE); - if (!new_table) { - REPORT_ERROR ("Name Table appendage allocation failure"); - return (AE_NO_MEMORY); - } - /* - * Allocation successful. Init the new table. - */ - name_table->next_table = new_table; - acpi_ns_initialize_table (new_table, parent_entry->child_table, - parent_entry); - - return (status); -} - - -/**************************************************************************** - * - * FUNCTION: Acpi_ns_initialize_table - * - * PARAMETERS: New_table - The new table to be initialized - * Parent_table - The parent (owner) scope - * Parent_entry - The NTE for the parent - * - * RETURN: None - * - * DESCRIPTION: Initialize a new namespace table. Simple, but called - * from several places -- code should be kept in one place. - * - ***************************************************************************/ - -void -acpi_ns_initialize_table ( - ACPI_NAME_TABLE *new_table, - ACPI_NAME_TABLE *parent_table, - ACPI_NAMED_OBJECT *parent_entry) -{ - u8 i; - - - new_table->parent_entry = parent_entry; - new_table->parent_table = parent_table; - - - /* Init each named object entry in the table */ - - for (i = 0; i < NS_TABLE_SIZE; i++) { - new_table->entries[i].this_index = i; - new_table->entries[i].data_type = ACPI_DESC_TYPE_NAMED; + return (AE_NOT_FOUND); } -} - - -/**************************************************************************** - * - * FUNCTION: Acpi_ns_initialize_entry - * - * PARAMETERS: Name_table - The containing table for the new NTE - * Position - Position (index) of the new NTE in the table - * Entry_name - ACPI name of the new entry - * Type - ACPI object type of the new entry - * Previous_entry - Link back to the previous entry (can span - * multiple tables) - * - * RETURN: None - * - * DESCRIPTION: Initialize a new entry within a namespace table. - * - ***************************************************************************/ - -void -acpi_ns_initialize_entry ( - ACPI_WALK_STATE *walk_state, - ACPI_NAME_TABLE *name_table, - u32 position, - u32 entry_name, - OBJECT_TYPE_INTERNAL type) -{ - ACPI_NAMED_OBJECT *new_entry; - u16 owner_id = TABLE_ID_DSDT; - ACPI_NAMED_OBJECT *entries; + /* Search the parent tree */ /* - * Get the owner ID from the Walk state - * The owner ID is used to track table deletion and - * deletion of objects created by methods + * Search parents until found the target or we have backed up to + * the root */ - if (walk_state) { - owner_id = walk_state->owner_id; - } - - /* The new entry is given by two parameters */ - - entries = name_table->entries; - new_entry = &entries[position]; - - /* Init the new entry */ - new_entry->data_type = ACPI_DESC_TYPE_NAMED; - new_entry->name = entry_name; - new_entry->owner_id = owner_id; - new_entry->reference_count = 1; + while (parent_node) { + /* Search parent scope */ + /* TBD: [Investigate] Why ACPI_TYPE_ANY? */ + status = acpi_ns_search_node (target_name, parent_node, + ACPI_TYPE_ANY, return_node); - /* - * If adding a name with unknown type, or having to - * add the region in order to define fields in it, we - * have a forward reference. - */ + if (ACPI_SUCCESS (status)) { + return (status); + } - if ((ACPI_TYPE_ANY == type) || - (INTERNAL_TYPE_DEF_FIELD_DEFN == type) || - (INTERNAL_TYPE_BANK_FIELD_DEFN == type)) - { /* - * We don't want to abort here, however! - * We will fill in the actual type when the - * real definition is found later. + * Not found here, go up another level + * (until we reach the root) */ + parent_node = acpi_ns_get_parent_object (parent_node); } - /* - * The Def_field_defn and Bank_field_defn cases are actually - * looking up the Region in which the field will be defined - */ - - if ((INTERNAL_TYPE_DEF_FIELD_DEFN == type) || - (INTERNAL_TYPE_BANK_FIELD_DEFN == type)) - { - type = ACPI_TYPE_REGION; - } - /* - * Scope, Def_any, and Index_field_defn are bogus "types" which do - * not actually have anything to do with the type of the name - * being looked up. Save any other value of Type as the type of - * the entry. - */ + /* Not found in parent tree */ - if ((type != INTERNAL_TYPE_SCOPE) && - (type != INTERNAL_TYPE_DEF_ANY) && - (type != INTERNAL_TYPE_INDEX_FIELD_DEFN)) - { - new_entry->type = (u8) type; - } - - return; + return (AE_NOT_FOUND); } -/**************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_ns_search_and_enter * - * PARAMETERS: Entry_name - Ascii ACPI name to search for (4 chars) - * *Name_table - Starting table where search will begin - * Interpreter_mode - Add names only in MODE_Load_pass_x. Otherwise, - * search only. + * PARAMETERS: Target_name - Ascii ACPI name to search for (4 chars) + * Walk_state - Current state of the walk + * *Node - Starting table where search will begin + * Interpreter_mode - Add names only in MODE_Load_pass_x. + * Otherwise,search only. * Type - Object type to match - * **Ret_entry - Where the matched NTE is returned + * Flags - Flags describing the search restrictions + * **Return_node - Where the Node is returned * * RETURN: Status * @@ -506,51 +251,48 @@ * In IMODE_EXECUTE, search only. * In other modes, search and add if not found. * - ***************************************************************************/ + ******************************************************************************/ ACPI_STATUS acpi_ns_search_and_enter ( - u32 entry_name, + u32 target_name, ACPI_WALK_STATE *walk_state, - ACPI_NAME_TABLE *name_table, + ACPI_NAMESPACE_NODE *node, OPERATING_MODE interpreter_mode, OBJECT_TYPE_INTERNAL type, u32 flags, - ACPI_NAMED_OBJECT **ret_entry) + ACPI_NAMESPACE_NODE **return_node) { - u32 position; /* position in table */ ACPI_STATUS status; - NS_SEARCH_DATA search_info; - ACPI_NAMED_OBJECT *entry; - ACPI_NAMED_OBJECT *entries; + ACPI_NAMESPACE_NODE *new_node; /* Parameter validation */ - if (!name_table || !entry_name || !ret_entry) { - REPORT_ERROR ("Ns_search_and_enter: bad parameter"); + if (!node || !target_name || !return_node) { + REPORT_ERROR ("Ns_search_and_enter: bad (null)parameter"); return (AE_BAD_PARAMETER); } /* Name must consist of printable characters */ - if (!acpi_cm_valid_acpi_name (entry_name)) { + if (!acpi_cm_valid_acpi_name (target_name)) { + REPORT_ERROR ("Ns_search_and_enter: Bad character in ACPI Name"); return (AE_BAD_CHARACTER); } /* Try to find the name in the table specified by the caller */ - *ret_entry = ENTRY_NOT_FOUND; - status = acpi_ns_search_one_scope (entry_name, name_table, - type, ret_entry, &search_info); + *return_node = ENTRY_NOT_FOUND; + status = acpi_ns_search_node (target_name, node, + type, return_node); if (status != AE_NOT_FOUND) { /* * Either found it or there was an error * -- finished either way */ - return (status); } @@ -573,10 +315,9 @@ * to ACPI specification */ - status = acpi_ns_search_parent_tree (entry_name, name_table, - type, ret_entry); - - if (status == AE_OK) { + status = acpi_ns_search_parent_tree (target_name, node, + type, return_node); + if (ACPI_SUCCESS (status)) { return (status); } } @@ -585,61 +326,22 @@ /* * In execute mode, just search, never add names. Exit now. */ - if (interpreter_mode == IMODE_EXECUTE) { return (AE_NOT_FOUND); } - /* - * Extract the pertinent info from the search result struct. - * Name_table and position might now point to an appendage - */ - name_table = search_info.name_table; - position = search_info.position; + /* Create the new named object */ - - /* - * This block handles the case where the existing table is full. - * we must allocate a new table before we can initialize a new entry - */ - - if (search_info.table_full) { - status = acpi_ns_create_and_link_new_table (name_table); - if (status != AE_OK) { - return (status); - } - - /* Point to the first slot in the new table */ - - name_table = name_table->next_table; - position = 0; + new_node = acpi_ns_create_node (target_name); + if (!new_node) { + return (AE_NO_MEMORY); } + /* Install the new object into the parent's list of children */ - /* - * There is room in the table (or we have just allocated a new one.) - * Initialize the new entry - */ - - acpi_ns_initialize_entry (walk_state, name_table, position, - entry_name, type); - - - entries = name_table->entries; - *ret_entry = &entries[position]; - entry = &entries[position]; - - /* - * Increment the reference count(s) of all parents up to - * the root! - */ - - while (acpi_ns_get_parent_entry (entry)) { - entry = acpi_ns_get_parent_entry (entry); - entry->reference_count++; - } - + acpi_ns_install_node (walk_state, node, new_node, type); + *return_node = new_node; return (AE_OK); } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/namespace/nsutils.c linux/drivers/acpi/namespace/nsutils.c --- v2.4.0-test8/linux/drivers/acpi/namespace/nsutils.c Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/namespace/nsutils.c Fri Sep 15 14:30:30 2000 @@ -1,8 +1,8 @@ - /****************************************************************************** * * Module Name: nsutils - Utilities for accessing ACPI namespace, accessing - * parents and siblings and Scope manipulation + * parents and siblings and Scope manipulation + * $Revision: 69 $ * *****************************************************************************/ @@ -26,13 +26,13 @@ #include "acpi.h" -#include "namesp.h" -#include "interp.h" +#include "acnamesp.h" +#include "acinterp.h" #include "amlcode.h" -#include "tables.h" +#include "actables.h" #define _COMPONENT NAMESPACE - MODULE_NAME ("nsutils"); + MODULE_NAME ("nsutils") /**************************************************************************** @@ -49,7 +49,7 @@ u8 acpi_ns_valid_root_prefix ( - char prefix) + NATIVE_CHAR prefix) { return ((u8) (prefix == '\\')); @@ -70,7 +70,7 @@ u8 acpi_ns_valid_path_separator ( - char sep) + NATIVE_CHAR sep) { return ((u8) (sep == '.')); @@ -81,9 +81,9 @@ * * FUNCTION: Acpi_ns_get_type * - * PARAMETERS: Handle - Handle of nte to be examined + * PARAMETERS: Handle - Parent Node to be examined * - * RETURN: Type field from nte whose handle is passed + * RETURN: Type field from Node whose handle is passed * ***************************************************************************/ @@ -93,13 +93,11 @@ { if (!handle) { - /* Handle invalid */ - REPORT_WARNING ("Ns_get_type: Null handle"); return (ACPI_TYPE_ANY); } - return (((ACPI_NAMED_OBJECT*) handle)->type); + return (((ACPI_NAMESPACE_NODE *) handle)->type); } @@ -114,19 +112,19 @@ * ***************************************************************************/ -s32 +u32 acpi_ns_local ( OBJECT_TYPE_INTERNAL type) { if (!acpi_cm_valid_object_type (type)) { - /* type code out of range */ + /* Type code out of range */ REPORT_WARNING ("Ns_local: Invalid Object Type"); return (NSP_NORMAL); } - return ((s32) acpi_gbl_ns_properties[type] & NSP_LOCAL); + return ((u32) acpi_gbl_ns_properties[type] & NSP_LOCAL); } @@ -147,12 +145,12 @@ ACPI_STATUS acpi_ns_internalize_name ( - char *external_name, - char **converted_name) + NATIVE_CHAR *external_name, + NATIVE_CHAR **converted_name) { - char *result = NULL; - char *internal_name; - ACPI_SIZE num_segments; + NATIVE_CHAR *result = NULL; + NATIVE_CHAR *internal_name; + u32 num_segments; u8 fully_qualified = FALSE; u32 i; @@ -235,7 +233,7 @@ } else { - /* Convert char to uppercase and save it */ + /* Convert s8 to uppercase and save it */ result[i] = (char) TOUPPER (*external_name); external_name++; @@ -273,166 +271,17 @@ /**************************************************************************** * - * 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 < 0 || - !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]) - { - - /* 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 * - * PARAMETERS: Handle - Handle to be converted to an NTE + * PARAMETERS: Handle - Handle to be converted to an Node * * RETURN: A Name table entry pointer * - * DESCRIPTION: Convert a namespace handle to a real NTE + * DESCRIPTION: Convert a namespace handle to a real Node * ****************************************************************************/ -ACPI_NAMED_OBJECT* +ACPI_NAMESPACE_NODE * acpi_ns_convert_handle_to_entry ( ACPI_HANDLE handle) { @@ -444,21 +293,21 @@ */ if (!handle) { - return NULL; + return (NULL); } if (handle == ACPI_ROOT_OBJECT) { - return acpi_gbl_root_object; + return (acpi_gbl_root_node); } /* We can at least attempt to verify the handle */ if (!VALID_DESCRIPTOR_TYPE (handle, ACPI_DESC_TYPE_NAMED)) { - return NULL; + return (NULL); } - return (ACPI_NAMED_OBJECT*) handle; + return ((ACPI_NAMESPACE_NODE *) handle); } @@ -466,16 +315,17 @@ * * FUNCTION: Acpi_ns_convert_entry_to_handle * - * PARAMETERS: Nte - NTE to be converted to a Handle + * PARAMETERS: Node - Node to be converted to a Handle * * RETURN: An USER ACPI_HANDLE * - * DESCRIPTION: Convert a real NTE to a namespace handle + * DESCRIPTION: Convert a real Node to a namespace handle * ****************************************************************************/ ACPI_HANDLE -acpi_ns_convert_entry_to_handle(ACPI_NAMED_OBJECT*nte) +acpi_ns_convert_entry_to_handle ( + ACPI_NAMESPACE_NODE *node) { @@ -485,21 +335,21 @@ * and keep all pointers within this subsystem! */ - return (ACPI_HANDLE) nte; + return ((ACPI_HANDLE) node); /* --------------------------------------------------- - if (!Nte) { - return NULL; + if (!Node) { + return (NULL); } - if (Nte == Acpi_gbl_Root_object) { - return ACPI_ROOT_OBJECT; + if (Node == Acpi_gbl_Root_node) { + return (ACPI_ROOT_OBJECT); } - return (ACPI_HANDLE) Nte; + return ((ACPI_HANDLE) Node); ------------------------------------------------------*/ } @@ -519,11 +369,11 @@ void acpi_ns_terminate (void) { - ACPI_OBJECT_INTERNAL *obj_desc; - ACPI_NAMED_OBJECT *entry; + ACPI_OPERAND_OBJECT *obj_desc; + ACPI_NAMESPACE_NODE *this_node; - entry = acpi_gbl_root_object; + this_node = acpi_gbl_root_node; /* * 1) Free the entire namespace -- all objects, tables, and stacks @@ -533,22 +383,19 @@ * (additional table descriptors) */ - acpi_ns_delete_namespace_subtree (entry); + acpi_ns_delete_namespace_subtree (this_node); /* Detach any object(s) attached to the root */ - obj_desc = acpi_ns_get_attached_object (entry); + obj_desc = acpi_ns_get_attached_object (this_node); if (obj_desc) { - acpi_ns_detach_object (entry); + acpi_ns_detach_object (this_node); acpi_cm_remove_reference (obj_desc); } - acpi_ns_delete_name_table (entry->child_table); - entry->child_table = NULL; + acpi_ns_delete_children (this_node); - REPORT_SUCCESS ("Entire namespace and objects deleted"); - /* * 2) Now we can delete the ACPI tables */ @@ -570,7 +417,7 @@ * ***************************************************************************/ -s32 +u32 acpi_ns_opens_scope ( OBJECT_TYPE_INTERNAL type) { @@ -582,47 +429,46 @@ return (NSP_NORMAL); } - return (((s32) acpi_gbl_ns_properties[type]) & NSP_NEWSCOPE); + return (((u32) acpi_gbl_ns_properties[type]) & NSP_NEWSCOPE); } /**************************************************************************** * - * FUNCTION: Acpi_ns_get_named_object + * FUNCTION: Acpi_ns_get_node * * PARAMETERS: *Pathname - Name to be found, in external (ASL) format. The * \ (backslash) and ^ (carat) prefixes, and the * . (period) to separate segments are supported. - * In_scope - Root of subtree to be searched, or NS_ALL for the + * Start_node - Root of subtree to be searched, or NS_ALL for the * root of the name space. If Name is fully - * qualified (first char is '\'), the passed value + * qualified (first s8 is '\'), the passed value * of Scope will not be accessed. - * Out_nte - Where the Nte is returned + * Return_node - Where the Node is returned * * DESCRIPTION: Look up a name relative to a given scope and return the - * corresponding NTE. NOTE: Scope can be null. + * corresponding Node. NOTE: Scope can be null. * * MUTEX: Locks namespace * ***************************************************************************/ ACPI_STATUS -acpi_ns_get_named_object ( - char *pathname, - ACPI_NAME_TABLE *in_scope, - ACPI_NAMED_OBJECT **out_nte) +acpi_ns_get_node ( + NATIVE_CHAR *pathname, + ACPI_NAMESPACE_NODE *start_node, + ACPI_NAMESPACE_NODE **return_node) { ACPI_GENERIC_STATE scope_info; ACPI_STATUS status; - ACPI_NAMED_OBJECT *obj_entry = NULL; - char *internal_path = NULL; + NATIVE_CHAR *internal_path = NULL; - scope_info.scope.name_table = in_scope; + scope_info.scope.node = start_node; /* Ensure that the namespace has been initialized */ - if (!acpi_gbl_root_object->child_table) { + if (!acpi_gbl_root_node) { return (AE_NO_NAMESPACE); } @@ -643,13 +489,13 @@ /* NS_ALL means start from the root */ - if (NS_ALL == scope_info.scope.name_table) { - scope_info.scope.name_table = acpi_gbl_root_object->child_table; + if (NS_ALL == scope_info.scope.node) { + scope_info.scope.node = acpi_gbl_root_node; } else { - scope_info.scope.name_table = in_scope; - if (!scope_info.scope.name_table) { + scope_info.scope.node = start_node; + if (!scope_info.scope.node) { status = AE_BAD_PARAMETER; goto unlock_and_exit; } @@ -660,12 +506,8 @@ status = acpi_ns_lookup (&scope_info, internal_path, ACPI_TYPE_ANY, IMODE_EXECUTE, NS_NO_UPSEARCH | NS_DONT_OPEN_SCOPE, - NULL, &obj_entry); - + NULL, return_node); - /* Return what was wanted - the NTE that matches the name */ - - *out_nte = obj_entry; unlock_and_exit: @@ -684,11 +526,11 @@ * * FUNCTION: Acpi_ns_find_parent_name * - * PARAMETERS: *Child_entry - nte whose name is to be found + * PARAMETERS: *Child_node - Named Obj whose name is to be found * * RETURN: The ACPI name * - * DESCRIPTION: Search for the given nte in its parent scope and return the + * DESCRIPTION: Search for the given obj in its parent scope and return the * name segment, or "????" if the parent name can't be found * (which "should not happen"). * @@ -696,18 +538,18 @@ ACPI_NAME acpi_ns_find_parent_name ( - ACPI_NAMED_OBJECT *child_entry) + ACPI_NAMESPACE_NODE *child_node) { - ACPI_NAMED_OBJECT *parent_entry; + ACPI_NAMESPACE_NODE *parent_node; - if (child_entry) { - /* Valid entry. Get the parent Nte */ + if (child_node) { + /* Valid entry. Get the parent Node */ - parent_entry = acpi_ns_get_parent_entry (child_entry); - if (parent_entry) { - if (parent_entry->name) { - return (parent_entry->name); + parent_node = acpi_ns_get_parent_object (child_node); + if (parent_node) { + if (parent_node->name) { + return (parent_node->name); } } @@ -717,92 +559,12 @@ return (ACPI_UNKNOWN_NAME); } -/**************************************************************************** - * - * FUNCTION: Acpi_ns_exist_downstream_sibling - * - * PARAMETERS: *This_entry - pointer to first nte to examine - * - * RETURN: TRUE if sibling is found, FALSE otherwise - * - * DESCRIPTION: Searches remainder of scope being processed to determine - * whether there is a downstream sibling to the current - * object. This function is used to determine what type of - * line drawing character to use when displaying namespace - * trees. - * - ***************************************************************************/ - -u8 -acpi_ns_exist_downstream_sibling ( - ACPI_NAMED_OBJECT *this_entry) -{ - - if (!this_entry) { - return FALSE; - } - - if (this_entry->name) { - return TRUE; - } - - -/* TBD: what did this really do? - if (This_entry->Next_entry) { - return TRUE; - } -*/ - return FALSE; -} - - -/**************************************************************************** - * - * FUNCTION: Acpi_ns_get_owner_table - * - * PARAMETERS: - * - * RETURN: - * - * DESCRIPTION: - * - ***************************************************************************/ - - -ACPI_NAME_TABLE * -acpi_ns_get_owner_table ( - ACPI_NAMED_OBJECT *this_entry) -{ - - /* - * Given an entry in the Name_table->Entries field of a name table, - * we can create a pointer to the beginning of the table as follows: - * - * 1) Starting with the the pointer to the entry, - * 2) Subtract the entry index * size of each entry to get a - * pointer to Entries[0] - * 3) Subtract the size of NAME_TABLE structure to get a pointer - * to the start. - * - * This saves having to put a pointer in every entry that points - * back to the beginning of the table and/or a pointer back to - * the parent. - */ - - return (ACPI_NAME_TABLE *) ((char *) this_entry - - (this_entry->this_index * - sizeof (ACPI_NAMED_OBJECT)) - - (sizeof (ACPI_NAME_TABLE) - - sizeof (ACPI_NAMED_OBJECT))); - -} - /**************************************************************************** * - * FUNCTION: Acpi_ns_get_parent_entry + * FUNCTION: Acpi_ns_get_parent_object * - * PARAMETERS: This_entry - Current table entry + * PARAMETERS: Node - Current table entry * * RETURN: Parent entry of the given entry * @@ -811,76 +573,58 @@ ***************************************************************************/ -ACPI_NAMED_OBJECT * -acpi_ns_get_parent_entry ( - ACPI_NAMED_OBJECT *this_entry) +ACPI_NAMESPACE_NODE * +acpi_ns_get_parent_object ( + ACPI_NAMESPACE_NODE *node) { - ACPI_NAME_TABLE *name_table; - name_table = acpi_ns_get_owner_table (this_entry); - /* - * Now that we have a pointer to the name table, we can just pluck - * the parent + * Walk to the end of this peer list. + * The last entry is marked with a flag and the peer + * pointer is really a pointer back to the parent. + * This saves putting a parent back pointer in each and + * every named object! */ - return (name_table->parent_entry); + while (!(node->flags & ANOBJ_END_OF_PEER_LIST)) { + node = node->peer; + } + + + return (node->peer); } /**************************************************************************** * - * FUNCTION: Acpi_ns_get_next_valid_entry + * FUNCTION: Acpi_ns_get_next_valid_object * - * PARAMETERS: This_entry - Current table entry + * PARAMETERS: Node - Current table entry * * RETURN: Next valid object in the table. NULL if no more valid * objects * * DESCRIPTION: Find the next valid object within a name table. + * Useful for implementing NULL-end-of-list loops. * ***************************************************************************/ -ACPI_NAMED_OBJECT * -acpi_ns_get_next_valid_entry ( - ACPI_NAMED_OBJECT *this_entry) +ACPI_NAMESPACE_NODE * +acpi_ns_get_next_valid_object ( + ACPI_NAMESPACE_NODE *node) { - ACPI_NAME_TABLE *name_table; - u32 index; - - - index = this_entry->this_index + 1; - name_table = acpi_ns_get_owner_table (this_entry); - - - while (name_table) { - if (index >= NS_TABLE_SIZE) { - /* We are at the end of this table */ - name_table = name_table->next_table; - index = 0; - continue; - } - - - /* Is this a valid (occupied) slot? */ - - if (name_table->entries[index].name) { - /* Found a valid entry, all done */ + /* If we are at the end of this peer list, return NULL */ - return (&name_table->entries[index]); - } - - /* Go to the next slot */ - - index++; + if (node->flags & ANOBJ_END_OF_PEER_LIST) { + return NULL; } - /* No more valid entries in this name table */ + /* Otherwise just return the next peer */ - return NULL; + return (node->peer); } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/namespace/nswalk.c linux/drivers/acpi/namespace/nswalk.c --- v2.4.0-test8/linux/drivers/acpi/namespace/nswalk.c Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/namespace/nswalk.c Fri Sep 15 14:30:30 2000 @@ -1,7 +1,7 @@ - /****************************************************************************** * * Module Name: nswalk - Functions for walking the APCI namespace + * $Revision: 17 $ * *****************************************************************************/ @@ -25,90 +25,85 @@ #include "acpi.h" -#include "interp.h" -#include "namesp.h" +#include "acinterp.h" +#include "acnamesp.h" #define _COMPONENT NAMESPACE - MODULE_NAME ("nswalk"); + MODULE_NAME ("nswalk") /**************************************************************************** * * FUNCTION: Acpi_get_next_object * - * PARAMETERS: Type - Type of object to be searched for - * Parent - Parent object whose children we are getting - * Last_child - Previous child that was found. - * The NEXT child will be returned - * Ret_handle - Where handle to the next object is placed - * - * RETURN: Status - * - * DESCRIPTION: Return the next peer object within the namespace. If Handle is - * valid, Scope is ignored. Otherwise, the first object within - * Scope is returned. + * PARAMETERS: Type - Type of object to be searched for + * Parent - Parent object whose children we are + * getting + * Last_child - Previous child that was found. + * The NEXT child will be returned + * + * RETURN: ACPI_NAMESPACE_NODE - Pointer to the NEXT child or NULL if + * none is found. + * + * DESCRIPTION: Return the next peer object within the namespace. If Handle + * is valid, Scope is ignored. Otherwise, the first object + * within Scope is returned. * - ******************************************************************************/ + ****************************************************************************/ -ACPI_NAMED_OBJECT* +ACPI_NAMESPACE_NODE * acpi_ns_get_next_object ( OBJECT_TYPE_INTERNAL type, - ACPI_NAMED_OBJECT *parent, - ACPI_NAMED_OBJECT *child) + ACPI_NAMESPACE_NODE *parent_node, + ACPI_NAMESPACE_NODE *child_node) { - ACPI_NAMED_OBJECT *this_entry = NULL; + ACPI_NAMESPACE_NODE *next_node = NULL; - if (!child) { + if (!child_node) { /* It's really the parent's _scope_ that we want */ - if (parent->child_table) { - this_entry = parent->child_table->entries; + if (parent_node->child) { + next_node = parent_node->child; } } else { /* Start search at the NEXT object */ - this_entry = acpi_ns_get_next_valid_entry (child); + next_node = acpi_ns_get_next_valid_object (child_node); } /* If any type is OK, we are done */ if (type == ACPI_TYPE_ANY) { - /* Make sure this is valid entry first */ - - if ((!this_entry) || - (!this_entry->name)) - { - return NULL; - } + /* Next_node is NULL if we are at the end-of-list */ - return (this_entry); + return (next_node); } /* Must search for the object -- but within this scope only */ - while (this_entry) { + while (next_node) { /* If type matches, we are done */ - if (this_entry->type == type) { - return (this_entry); + if (next_node->type == type) { + return (next_node); } /* Otherwise, move on to the next object */ - this_entry = acpi_ns_get_next_valid_entry (this_entry); + next_node = acpi_ns_get_next_valid_object (next_node); } /* Not found */ - return NULL; + return (NULL); } @@ -117,7 +112,7 @@ * FUNCTION: Acpi_ns_walk_namespace * * PARAMETERS: Type - ACPI_OBJECT_TYPE to search for - * Start_object - Handle in namespace where search begins + * Start_node - Handle in namespace where search begins * Max_depth - Depth to which search is to reach * Unlock_before_callback- Whether to unlock the NS before invoking * the callback routine @@ -145,7 +140,7 @@ ACPI_STATUS acpi_ns_walk_namespace ( OBJECT_TYPE_INTERNAL type, - ACPI_HANDLE start_object, + ACPI_HANDLE start_node, u32 max_depth, u8 unlock_before_callback, WALK_CALLBACK user_function, @@ -153,25 +148,25 @@ void **return_value) { ACPI_STATUS status; - ACPI_NAMED_OBJECT *child_entry; - ACPI_NAMED_OBJECT *parent_entry; + ACPI_NAMESPACE_NODE *child_node; + ACPI_NAMESPACE_NODE *parent_node; OBJECT_TYPE_INTERNAL child_type; u32 level; - /* Special case for the namespace root object */ + /* Special case for the namespace Root Node */ - if (start_object == ACPI_ROOT_OBJECT) { - start_object = acpi_gbl_root_object; + if (start_node == ACPI_ROOT_OBJECT) { + start_node = acpi_gbl_root_node; } /* Null child means "get first object" */ - parent_entry = start_object; - child_entry = 0; - child_type = ACPI_TYPE_ANY; - level = 1; + parent_node = start_node; + child_node = 0; + child_type = ACPI_TYPE_ANY; + level = 1; /* * Traverse the tree of objects until we bubble back up to where we @@ -186,18 +181,18 @@ */ status = AE_OK; - child_entry = acpi_ns_get_next_object (ACPI_TYPE_ANY, - parent_entry, - child_entry); + child_node = acpi_ns_get_next_object (ACPI_TYPE_ANY, + parent_node, + child_node); - if (child_entry) { + if (child_node) { /* * Found an object, Get the type if we are not * searching for ANY */ if (type != ACPI_TYPE_ANY) { - child_type = child_entry->type; + child_type = child_node->type; } if (child_type == type) { @@ -210,7 +205,7 @@ acpi_cm_release_mutex (ACPI_MTX_NAMESPACE); } - status = user_function (child_entry, level, + status = user_function (child_node, level, context, return_value); if (unlock_before_callback) { @@ -247,15 +242,15 @@ if ((level < max_depth) && (status != AE_CTRL_DEPTH)) { if (acpi_ns_get_next_object (ACPI_TYPE_ANY, - child_entry, 0)) + child_node, 0)) { /* * There is at least one child of this * object, visit the object */ level++; - parent_entry = child_entry; - child_entry = 0; + parent_node = child_node; + child_node = 0; } } } @@ -267,8 +262,8 @@ * the object's parent. */ level--; - child_entry = parent_entry; - parent_entry = acpi_ns_get_parent_entry (parent_entry); + child_node = parent_node; + parent_node = acpi_ns_get_parent_object (parent_node); } } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/namespace/nsxfname.c linux/drivers/acpi/namespace/nsxfname.c --- v2.4.0-test8/linux/drivers/acpi/namespace/nsxfname.c Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/namespace/nsxfname.c Fri Sep 15 14:30:30 2000 @@ -2,6 +2,7 @@ * * Module Name: nsxfname - Public interfaces to the ACPI subsystem * ACPI Namespace oriented interfaces + * $Revision: 64 $ * *****************************************************************************/ @@ -25,16 +26,16 @@ #include "acpi.h" -#include "interp.h" -#include "namesp.h" +#include "acinterp.h" +#include "acnamesp.h" #include "amlcode.h" -#include "parser.h" -#include "dispatch.h" -#include "events.h" +#include "acparser.h" +#include "acdispat.h" +#include "acevents.h" #define _COMPONENT NAMESPACE - MODULE_NAME ("nsxfname"); + MODULE_NAME ("nsxfname") /****************************************************************************** @@ -64,21 +65,6 @@ } - /* Init the hardware */ - - /* - * TBD: [Restructure] Should this should be moved elsewhere, - * like Acpi_enable! ?? - */ - - /* we need to be able to call this interface repeatedly! */ - /* Does H/W require init before loading the namespace? */ - - status = acpi_cm_hardware_initialize (); - if (ACPI_FAILURE (status)) { - return (status); - } - /* * Load the namespace. The DSDT is required, * but the SSDT and PSDT tables are optional. @@ -131,24 +117,24 @@ ACPI_HANDLE *ret_handle) { ACPI_STATUS status; - ACPI_NAMED_OBJECT *this_entry; - ACPI_NAME_TABLE *scope = NULL; + ACPI_NAMESPACE_NODE *node; + ACPI_NAMESPACE_NODE *prefix_node = NULL; if (!ret_handle || !pathname) { - return AE_BAD_PARAMETER; + return (AE_BAD_PARAMETER); } if (parent) { acpi_cm_acquire_mutex (ACPI_MTX_NAMESPACE); - this_entry = acpi_ns_convert_handle_to_entry (parent); - if (!this_entry) { + node = acpi_ns_convert_handle_to_entry (parent); + if (!node) { acpi_cm_release_mutex (ACPI_MTX_NAMESPACE); - return AE_BAD_PARAMETER; + return (AE_BAD_PARAMETER); } - scope = this_entry->child_table; + prefix_node = node->child; acpi_cm_release_mutex (ACPI_MTX_NAMESPACE); } @@ -156,17 +142,20 @@ /* 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_object); - return AE_OK; + *ret_handle = acpi_ns_convert_entry_to_handle (acpi_gbl_root_node); + return (AE_OK); } /* - * Find the Nte and convert to the user format + * Find the Node and convert to the user format */ - this_entry = NULL; - status = acpi_ns_get_named_object (pathname, scope, &this_entry); + node = NULL; + status = acpi_ns_get_node (pathname, prefix_node, &node); - *ret_handle = acpi_ns_convert_entry_to_handle (this_entry); + *ret_handle = NULL; + if(ACPI_SUCCESS(status)) { + *ret_handle = acpi_ns_convert_entry_to_handle (node); + } return (status); } @@ -195,13 +184,13 @@ ACPI_BUFFER *ret_path_ptr) { ACPI_STATUS status; - ACPI_NAMED_OBJECT *obj_entry; + ACPI_NAMESPACE_NODE *node; /* Buffer pointer must be valid always */ if (!ret_path_ptr || (name_type > ACPI_NAME_TYPE_MAX)) { - return AE_BAD_PARAMETER; + return (AE_BAD_PARAMETER); } /* Allow length to be zero and ignore the pointer */ @@ -209,7 +198,7 @@ if ((ret_path_ptr->length) && (!ret_path_ptr->pointer)) { - return AE_BAD_PARAMETER; + return (AE_BAD_PARAMETER); } if (name_type == ACPI_FULL_PATHNAME) { @@ -217,17 +206,17 @@ status = acpi_ns_handle_to_pathname (handle, &ret_path_ptr->length, ret_path_ptr->pointer); - return status; + return (status); } /* * Wants the single segment ACPI name. - * Validate handle and convert to an NTE + * Validate handle and convert to an Node */ acpi_cm_acquire_mutex (ACPI_MTX_NAMESPACE); - obj_entry = acpi_ns_convert_handle_to_entry (handle); - if (!obj_entry) { + node = acpi_ns_convert_handle_to_entry (handle); + if (!node) { status = AE_BAD_PARAMETER; goto unlock_and_exit; } @@ -240,18 +229,18 @@ goto unlock_and_exit; } - /* Just copy the ACPI name from the NTE and zero terminate it */ + /* Just copy the ACPI name from the Node and zero terminate it */ - STRNCPY (ret_path_ptr->pointer, (char *) &obj_entry->name, + STRNCPY (ret_path_ptr->pointer, (NATIVE_CHAR *) &node->name, ACPI_NAME_SIZE); - ((char *) ret_path_ptr->pointer) [ACPI_NAME_SIZE] = 0; + ((NATIVE_CHAR *) ret_path_ptr->pointer) [ACPI_NAME_SIZE] = 0; status = AE_OK; unlock_and_exit: acpi_cm_release_mutex (ACPI_MTX_NAMESPACE); - return status; + return (status); } @@ -279,27 +268,27 @@ ACPI_STATUS status; u32 device_status = 0; u32 address = 0; - ACPI_NAMED_OBJECT *device_entry; + ACPI_NAMESPACE_NODE *device_node; /* Parameter validation */ if (!device || !info) { - return AE_BAD_PARAMETER; + return (AE_BAD_PARAMETER); } acpi_cm_acquire_mutex (ACPI_MTX_NAMESPACE); - device_entry = acpi_ns_convert_handle_to_entry (device); - if (!device_entry) { + device_node = acpi_ns_convert_handle_to_entry (device); + if (!device_node) { acpi_cm_release_mutex (ACPI_MTX_NAMESPACE); - return AE_BAD_PARAMETER; + return (AE_BAD_PARAMETER); } - info->type = device_entry->type; - info->name = device_entry->name; - info->parent = - acpi_ns_convert_entry_to_handle (acpi_ns_get_parent_entry (device_entry)); + 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)); acpi_cm_release_mutex (ACPI_MTX_NAMESPACE); @@ -307,17 +296,17 @@ * If not a device, we are all done. */ if (info->type != ACPI_TYPE_DEVICE) { - return AE_OK; + return (AE_OK); } /* Get extra info for ACPI devices */ - info->valid = 0; + info->valid = 0; /* Execute the _HID method and save the result */ - status = acpi_cm_execute_HID (device_entry, &hid); + status = acpi_cm_execute_HID (device_node, &hid); if (ACPI_SUCCESS (status)) { if (hid.type == STRING_PTR_DEVICE_ID) { STRCPY (info->hardware_id, hid.data.string_ptr); @@ -331,7 +320,7 @@ /* Execute the _UID method and save the result */ - status = acpi_cm_execute_UID (device_entry, &uid); + status = acpi_cm_execute_UID (device_node, &uid); if (ACPI_SUCCESS (status)) { if (hid.type == STRING_PTR_DEVICE_ID) { STRCPY (info->unique_id, uid.data.string_ptr); @@ -348,7 +337,7 @@ * _STA is not always present */ - status = acpi_cm_execute_STA (device_entry, &device_status); + status = acpi_cm_execute_STA (device_node, &device_status); if (ACPI_SUCCESS (status)) { info->current_status = device_status; info->valid |= ACPI_VALID_STA; @@ -360,13 +349,13 @@ */ status = acpi_cm_evaluate_numeric_object (METHOD_NAME__ADR, - device_entry, &address); + device_node, &address); if (ACPI_SUCCESS (status)) { info->address = address; info->valid |= ACPI_VALID_ADR; } - return AE_OK; + return (AE_OK); } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/namespace/nsxfobj.c linux/drivers/acpi/namespace/nsxfobj.c --- v2.4.0-test8/linux/drivers/acpi/namespace/nsxfobj.c Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/namespace/nsxfobj.c Fri Sep 15 14:30:30 2000 @@ -1,10 +1,10 @@ - -/****************************************************************************** +/******************************************************************************* * * Module Name: nsxfobj - Public interfaces to the ACPI subsystem * ACPI Object oriented interfaces + * $Revision: 65 $ * - *****************************************************************************/ + ******************************************************************************/ /* * Copyright (C) 2000 R. Byron Moore @@ -26,15 +26,15 @@ #include "acpi.h" -#include "interp.h" -#include "namesp.h" +#include "acinterp.h" +#include "acnamesp.h" #define _COMPONENT NAMESPACE - MODULE_NAME ("nsxfobj"); + MODULE_NAME ("nsxfobj") -/**************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_evaluate_object * @@ -54,7 +54,7 @@ * parameters if necessary. One of "Handle" or "Pathname" must * be valid (non-null) * - ****************************************************************************/ + ******************************************************************************/ ACPI_STATUS acpi_evaluate_object ( @@ -64,9 +64,9 @@ ACPI_BUFFER *return_buffer) { ACPI_STATUS status; - ACPI_OBJECT_INTERNAL **param_ptr = NULL; - ACPI_OBJECT_INTERNAL *return_obj = NULL; - ACPI_OBJECT_INTERNAL *object_ptr = NULL; + ACPI_OPERAND_OBJECT **param_ptr = NULL; + ACPI_OPERAND_OBJECT *return_obj = NULL; + ACPI_OPERAND_OBJECT *object_ptr = NULL; u32 buffer_space_needed; u32 user_buffer_length; u32 count; @@ -85,12 +85,11 @@ /* * Allocate a new parameter block for the internal objects * Add 1 to count to allow for null terminated internal list - * TBD: [Restructure] merge into single allocation! */ count = param_objects->count; param_length = (count + 1) * sizeof (void *); - object_length = count * sizeof (ACPI_OBJECT_INTERNAL); + object_length = count * sizeof (ACPI_OPERAND_OBJECT); param_ptr = acpi_cm_callocate (param_length + /* Parameter List part */ object_length); /* Actual objects */ @@ -98,7 +97,7 @@ return (AE_NO_MEMORY); } - object_ptr = (ACPI_OBJECT_INTERNAL *) ((u8 *) param_ptr + + object_ptr = (ACPI_OPERAND_OBJECT *) ((u8 *) param_ptr + param_length); /* @@ -169,18 +168,15 @@ * The null pathname case means the handle is for * the actual object to be evaluated */ - status = acpi_ns_evaluate_by_handle (handle, - param_ptr, - &return_obj); + status = acpi_ns_evaluate_by_handle (handle, param_ptr, &return_obj); } else { /* * Both a Handle and a relative Pathname */ - status = acpi_ns_evaluate_relative (handle, pathname, - param_ptr, - &return_obj); + status = acpi_ns_evaluate_relative (handle, pathname, param_ptr, + &return_obj); } } @@ -195,11 +191,9 @@ return_buffer->length = 0; if (return_obj) { - if (VALID_DESCRIPTOR_TYPE (return_obj, - ACPI_DESC_TYPE_NAMED)) - { + if (VALID_DESCRIPTOR_TYPE (return_obj, ACPI_DESC_TYPE_NAMED)) { /* - * If we got an NTE as a return object, + * If we got an Node as a return object, * this means the object we are evaluating * has nothing interesting to return (such * as a mutex, etc.) We return an error @@ -210,7 +204,7 @@ * types at a later date if necessary. */ status = AE_TYPE; - return_obj = NULL; /* No need to delete an NTE */ + return_obj = NULL; /* No need to delete an Node */ } if (ACPI_SUCCESS (status)) { @@ -241,9 +235,8 @@ /* * We have enough space for the object, build it */ - status = - acpi_cm_build_external_object (return_obj, - return_buffer); + status = acpi_cm_build_external_object (return_obj, + return_buffer); return_buffer->length = buffer_space_needed; } } @@ -276,7 +269,7 @@ } -/**************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_get_next_object * @@ -302,15 +295,15 @@ ACPI_HANDLE *ret_handle) { ACPI_STATUS status = AE_OK; - ACPI_NAMED_OBJECT *entry; - ACPI_NAMED_OBJECT *parent_entry = NULL; - ACPI_NAMED_OBJECT *child_entry = NULL; + ACPI_NAMESPACE_NODE *node; + ACPI_NAMESPACE_NODE *parent_node = NULL; + ACPI_NAMESPACE_NODE *child_node = NULL; /* Parameter validation */ if (type > ACPI_TYPE_MAX) { - return AE_BAD_PARAMETER; + return (AE_BAD_PARAMETER); } acpi_cm_acquire_mutex (ACPI_MTX_NAMESPACE); @@ -320,8 +313,8 @@ if (!child) { /* Start search at the beginning of the specified scope */ - parent_entry = acpi_ns_convert_handle_to_entry (parent); - if (!parent_entry) { + parent_node = acpi_ns_convert_handle_to_entry (parent); + if (!parent_node) { status = AE_BAD_PARAMETER; goto unlock_and_exit; } @@ -332,8 +325,8 @@ else { /* Convert and validate the handle */ - child_entry = acpi_ns_convert_handle_to_entry (child); - if (!child_entry) { + child_node = acpi_ns_convert_handle_to_entry (child); + if (!child_node) { status = AE_BAD_PARAMETER; goto unlock_and_exit; } @@ -342,26 +335,26 @@ /* Internal function does the real work */ - entry = acpi_ns_get_next_object ((OBJECT_TYPE_INTERNAL) type, - parent_entry, child_entry); - if (!entry) { + node = acpi_ns_get_next_object ((OBJECT_TYPE_INTERNAL) type, + parent_node, child_node); + if (!node) { status = AE_NOT_FOUND; goto unlock_and_exit; } if (ret_handle) { - *ret_handle = acpi_ns_convert_entry_to_handle (entry); + *ret_handle = acpi_ns_convert_entry_to_handle (node); } unlock_and_exit: acpi_cm_release_mutex (ACPI_MTX_NAMESPACE); - return status; + return (status); } -/**************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_get_type * @@ -379,44 +372,43 @@ ACPI_HANDLE handle, ACPI_OBJECT_TYPE *ret_type) { - ACPI_NAMED_OBJECT *object; + ACPI_NAMESPACE_NODE *node; /* Parameter Validation */ if (!ret_type) { - return AE_BAD_PARAMETER; + return (AE_BAD_PARAMETER); } /* - * Special case for the predefined Root Object + * Special case for the predefined Root Node * (return type ANY) */ - if (handle == ACPI_ROOT_OBJECT) { *ret_type = ACPI_TYPE_ANY; - return AE_OK; + return (AE_OK); } acpi_cm_acquire_mutex (ACPI_MTX_NAMESPACE); /* Convert and validate the handle */ - object = acpi_ns_convert_handle_to_entry (handle); - if (!object) { + node = acpi_ns_convert_handle_to_entry (handle); + if (!node) { acpi_cm_release_mutex (ACPI_MTX_NAMESPACE); - return AE_BAD_PARAMETER; + return (AE_BAD_PARAMETER); } - *ret_type = object->type; + *ret_type = node->type; acpi_cm_release_mutex (ACPI_MTX_NAMESPACE); - return AE_OK; + return (AE_OK); } -/**************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_get_parent * @@ -435,7 +427,7 @@ ACPI_HANDLE handle, ACPI_HANDLE *ret_handle) { - ACPI_NAMED_OBJECT *object; + ACPI_NAMESPACE_NODE *node; ACPI_STATUS status = AE_OK; @@ -443,13 +435,13 @@ if (!ret_handle) { - return AE_BAD_PARAMETER; + return (AE_BAD_PARAMETER); } - /* Special case for the predefined Root Object (no parent) */ + /* Special case for the predefined Root Node (no parent) */ if (handle == ACPI_ROOT_OBJECT) { - return AE_NULL_ENTRY; + return (AE_NULL_ENTRY); } @@ -457,8 +449,8 @@ /* Convert and validate the handle */ - object = acpi_ns_convert_handle_to_entry (handle); - if (!object) { + node = acpi_ns_convert_handle_to_entry (handle); + if (!node) { status = AE_BAD_PARAMETER; goto unlock_and_exit; } @@ -467,11 +459,11 @@ /* Get the parent entry */ *ret_handle = - acpi_ns_convert_entry_to_handle (acpi_ns_get_parent_entry (object)); + acpi_ns_convert_entry_to_handle (acpi_ns_get_parent_object (node)); /* Return exeption if parent is null */ - if (!acpi_ns_get_parent_entry (object)) { + if (!acpi_ns_get_parent_object (node)) { status = AE_NULL_ENTRY; } @@ -479,11 +471,11 @@ unlock_and_exit: acpi_cm_release_mutex (ACPI_MTX_NAMESPACE); - return AE_OK; + return (status); } -/****************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_walk_namespace * diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/os.c linux/drivers/acpi/os.c --- v2.4.0-test8/linux/drivers/acpi/os.c Fri Jul 14 12:12:08 2000 +++ linux/drivers/acpi/os.c Fri Sep 15 14:30:30 2000 @@ -29,6 +29,9 @@ #include "acpi.h" #include "driver.h" +#define _COMPONENT OS_DEPENDENT + MODULE_NAME ("os") + static int acpi_irq_irq = 0; static OSD_HANDLER acpi_irq_handler = NULL; static void *acpi_irq_context = NULL; @@ -61,7 +64,7 @@ } s32 -acpi_os_printf(const char *fmt,...) +acpi_os_printf(const NATIVE_CHAR *fmt,...) { s32 size; va_list args; @@ -72,11 +75,11 @@ } s32 -acpi_os_vprintf(const char *fmt, va_list args) +acpi_os_vprintf(const NATIVE_CHAR *fmt, va_list args) { static char buffer[512]; int size = vsprintf(buffer, fmt, args); - printk(KERN_DEBUG "ACPI: %s", buffer); + printk("%s", buffer); return size; } @@ -137,7 +140,7 @@ acpi_irq_context = context; if (request_irq(irq, acpi_irq, - SA_INTERRUPT | SA_SHIRQ, + SA_SHIRQ, "acpi", acpi_irq)) { printk(KERN_ERR "ACPI: SCI (IRQ%d) allocation failed\n", irq); @@ -338,7 +341,7 @@ } ACPI_STATUS -acpi_os_breakpoint(char *msg) +acpi_os_breakpoint(NATIVE_CHAR *msg) { acpi_os_printf("breakpoint: %s", msg); return AE_OK; @@ -351,13 +354,13 @@ } void -acpi_os_dbg_assert(void *failure, void *file, u32 line, char *msg) +acpi_os_dbg_assert(void *failure, void *file, u32 line, NATIVE_CHAR *msg) { acpi_os_printf("assert: %s", msg); } u32 -acpi_os_get_line(char *buffer) +acpi_os_get_line(NATIVE_CHAR *buffer) { return 0; } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/parser/Makefile linux/drivers/acpi/parser/Makefile --- v2.4.0-test8/linux/drivers/acpi/parser/Makefile Wed Dec 31 16:00:00 1969 +++ linux/drivers/acpi/parser/Makefile Fri Sep 15 18:21:44 2000 @@ -0,0 +1,28 @@ +# +# 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)) + +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: + $(RM) *.o diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/parser/psargs.c linux/drivers/acpi/parser/psargs.c --- v2.4.0-test8/linux/drivers/acpi/parser/psargs.c Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/parser/psargs.c Fri Sep 15 14:30:30 2000 @@ -1,6 +1,7 @@ /****************************************************************************** * * Module Name: psargs - Parse AML opcode arguments + * $Revision: 35 $ * *****************************************************************************/ @@ -24,12 +25,26 @@ #include "acpi.h" -#include "parser.h" +#include "acparser.h" #include "amlcode.h" -#include "namesp.h" +#include "acnamesp.h" #define _COMPONENT PARSER - MODULE_NAME ("psargs"); + 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); +} /******************************************************************************* @@ -46,14 +61,63 @@ ******************************************************************************/ 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) { - s32 encoded_length; - s32 length = 0; + u32 encoded_length; + u32 length = 0; - encoded_length = (s32) GET8 (parser_state->aml); + encoded_length = (u32) GET8 (parser_state->aml); parser_state->aml++; @@ -137,13 +201,13 @@ * ******************************************************************************/ -char * +NATIVE_CHAR * acpi_ps_get_next_namestring ( ACPI_PARSE_STATE *parser_state) { - char *start = (char *) parser_state->aml; - char *end = (char *) parser_state->aml; - s32 length; + u8 *start = parser_state->aml; + u8 *end = parser_state->aml; + u32 length; /* Handle multiple prefix characters */ @@ -181,7 +245,7 @@ /* multiple name segments */ - length = (s32) GET8 (end + 1) * 4; + length = (u32) GET8 (end + 1) * 4; end += 2 + length; break; @@ -197,7 +261,7 @@ parser_state->aml = (u8*) end; - return (start); + return ((NATIVE_CHAR *) start); } @@ -228,14 +292,14 @@ void acpi_ps_get_next_namepath ( ACPI_PARSE_STATE *parser_state, - ACPI_GENERIC_OP *arg, + ACPI_PARSE_OBJECT *arg, u32 *arg_count, u8 method_call) { - char *path; - ACPI_GENERIC_OP *name; - ACPI_GENERIC_OP *op; - ACPI_GENERIC_OP *count; + NATIVE_CHAR *path; + ACPI_PARSE_OBJECT *name_op; + ACPI_PARSE_OBJECT *op; + ACPI_PARSE_OBJECT *count; path = acpi_ps_get_next_namestring (parser_state); @@ -270,18 +334,18 @@ count = acpi_ps_get_arg (op, 0); if (count && count->opcode == AML_BYTE_OP) { - name = acpi_ps_alloc_op (AML_NAMEPATH_OP); - if (name) { + name_op = acpi_ps_alloc_op (AML_NAMEPATH_OP); + if (name_op) { /* Change arg into a METHOD CALL and attach the name */ acpi_ps_init_op (arg, AML_METHODCALL_OP); - name->value.name = path; + name_op->value.name = path; - /* Point METHODCALL/NAME to the METHOD NTE */ + /* Point METHODCALL/NAME to the METHOD Node */ - name->acpi_named_object = op; - acpi_ps_append_arg (arg, name); + name_op->node = (ACPI_NAMESPACE_NODE *) op; + acpi_ps_append_arg (arg, name_op); *arg_count = count->value.integer & METHOD_FLAGS_ARG_COUNT; @@ -320,15 +384,15 @@ void acpi_ps_get_next_namepath ( ACPI_PARSE_STATE *parser_state, - ACPI_GENERIC_OP *arg, + ACPI_PARSE_OBJECT *arg, u32 *arg_count, u8 method_call) { - char *path; - ACPI_GENERIC_OP *name; + NATIVE_CHAR *path; + ACPI_PARSE_OBJECT *name_op; ACPI_STATUS status; - ACPI_NAMED_OBJECT *method = NULL; - ACPI_NAMED_OBJECT *entry; + ACPI_NAMESPACE_NODE *method_node = NULL; + ACPI_NAMESPACE_NODE *node; ACPI_GENERIC_STATE scope_info; @@ -346,10 +410,10 @@ /* * Lookup the name in the internal namespace */ - scope_info.scope.name_table = NULL; - entry = parser_state->start_op->acpi_named_object; - if (entry) { - scope_info.scope.name_table = entry->child_table; + scope_info.scope.node = NULL; + node = parser_state->start_node; + if (node) { + scope_info.scope.node = node; } /* @@ -361,24 +425,24 @@ status = acpi_ns_lookup (&scope_info, path, ACPI_TYPE_ANY, IMODE_EXECUTE, NS_SEARCH_PARENT | NS_DONT_OPEN_SCOPE, NULL, - &entry); + &node); if (ACPI_SUCCESS (status)) { - if (entry->type == ACPI_TYPE_METHOD) { - method = entry; - name = acpi_ps_alloc_op (AML_NAMEPATH_OP); - if (name) { + if (node->type == ACPI_TYPE_METHOD) { + method_node = node; + name_op = acpi_ps_alloc_op (AML_NAMEPATH_OP); + if (name_op) { /* Change arg into a METHOD CALL and attach name to it */ acpi_ps_init_op (arg, AML_METHODCALL_OP); - name->value.name = path; + name_op->value.name = path; - /* Point METHODCALL/NAME to the METHOD NTE */ + /* Point METHODCALL/NAME to the METHOD Node */ - name->acpi_named_object = method; - acpi_ps_append_arg (arg, name); + name_op->node = method_node; + acpi_ps_append_arg (arg, name_op); - *arg_count = ((ACPI_OBJECT_INTERNAL *) method->object)->method.param_count; + *arg_count = ((ACPI_OPERAND_OBJECT *) method_node->object)->method.param_count; } return; @@ -424,8 +488,8 @@ void acpi_ps_get_next_simple_arg ( ACPI_PARSE_STATE *parser_state, - s32 arg_type, - ACPI_GENERIC_OP *arg) + u32 arg_type, + ACPI_PARSE_OBJECT *arg) { @@ -498,13 +562,13 @@ * ******************************************************************************/ -ACPI_GENERIC_OP * +ACPI_PARSE_OBJECT * acpi_ps_get_next_field ( ACPI_PARSE_STATE *parser_state) { ACPI_PTRDIFF aml_offset = parser_state->aml - parser_state->aml_start; - ACPI_GENERIC_OP *field; + ACPI_PARSE_OBJECT *field; u16 opcode; u32 name; @@ -598,16 +662,16 @@ * ******************************************************************************/ -ACPI_GENERIC_OP * +ACPI_PARSE_OBJECT * acpi_ps_get_next_arg ( ACPI_PARSE_STATE *parser_state, - s32 arg_type, + u32 arg_type, u32 *arg_count) { - ACPI_GENERIC_OP *arg = NULL; - ACPI_GENERIC_OP *prev = NULL; - ACPI_GENERIC_OP *field; - s32 subop; + ACPI_PARSE_OBJECT *arg = NULL; + ACPI_PARSE_OBJECT *prev = NULL; + ACPI_PARSE_OBJECT *field; + u32 subop; switch (arg_type) @@ -675,7 +739,7 @@ /* fill in bytelist data */ arg->value.size = (parser_state->pkg_end - parser_state->aml); - acpi_ps_to_bytelist_op (arg)->data = parser_state->aml; + ((ACPI_PARSE2_OBJECT *) arg)->data = parser_state->aml; } /* skip to End of byte data */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/parser/psfind.c linux/drivers/acpi/parser/psfind.c --- v2.4.0-test8/linux/drivers/acpi/parser/psfind.c Wed Dec 31 16:00:00 1969 +++ linux/drivers/acpi/parser/psfind.c Fri Sep 15 14:30:30 2000 @@ -0,0 +1,319 @@ + +/****************************************************************************** + * + * 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); +} + + diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/parser/psopcode.c linux/drivers/acpi/parser/psopcode.c --- v2.4.0-test8/linux/drivers/acpi/parser/psopcode.c Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/parser/psopcode.c Fri Sep 15 14:30:30 2000 @@ -1,6 +1,7 @@ /****************************************************************************** * * Module Name: psopcode - Parser opcode information table + * $Revision: 20 $ * *****************************************************************************/ @@ -24,12 +25,32 @@ #include "acpi.h" -#include "parser.h" +#include "acparser.h" #include "amlcode.h" #define _COMPONENT PARSER - MODULE_NAME ("psopcode"); + 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 + * internal opcodes, since they are used to differentiate + * name strings from AML opcodes + */ +#define _ASC 0x6C +#define _NAM 0x6C +#define _PFX 0x6D +#define _UNKNOWN_OPCODE 0x02 /* An example unknown opcode */ + +#define MAX_EXTENDED_OPCODE 0x87 +#define NUM_EXTENDED_OPCODE MAX_EXTENDED_OPCODE + 1 +#define MAX_INTERNAL_OPCODE +#define NUM_INTERNAL_OPCODE MAX_INTERNAL_OPCODE + 1 /******************************************************************************* @@ -41,27 +62,41 @@ * 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 + * DESCRIPTION: Find AML opcode description based on the opcode. + * NOTE: This procedure must ALWAYS return a valid pointer! * ******************************************************************************/ -ACPI_OP_INFO * +ACPI_OPCODE_INFO * acpi_ps_get_opcode_info ( u16 opcode) { - ACPI_OP_INFO *op; - s32 hash; + 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]; - /* compute hash/index into the Acpi_aml_op_index table */ - switch (opcode >> 8) + /* + * Detect normal 8-bit opcode or extended 16-bit opcode + */ + + switch (upper_opcode) { case 0: - /* Simple (8-bit) opcode */ + /* Simple (8-bit) opcode: 0-255, can't index beyond table */ - hash = opcode; + op_info = &acpi_gbl_aml_op_info [acpi_gbl_aml_short_op_info_index [lower_opcode]]; break; @@ -69,38 +104,29 @@ /* Extended (16-bit, prefix+opcode) opcode */ - hash = (opcode + AML_EXTOP_HASH_OFFSET) & 0xff; + 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? */ - hash = (opcode + AML_LNOT_HASH_OFFSET) & 0xff; break; default: - return NULL; + break; } /* Get the Op info pointer for this opcode */ - op = &acpi_gbl_aml_op_info [(s32) acpi_gbl_aml_op_info_index [hash]]; - - - /* If the returned opcode matches, we have a valid opcode */ - - if (op->opcode == opcode) { - return op; - } - - /* Otherwise, the opcode is an ASCII char or other non-opcode value */ - - return NULL; + return (op_info); } @@ -117,21 +143,19 @@ * ******************************************************************************/ -char * +NATIVE_CHAR * acpi_ps_get_opcode_name ( u16 opcode) { - ACPI_OP_INFO *op; + ACPI_OPCODE_INFO *op; op = acpi_ps_get_opcode_info (opcode); - if (!op) { - return "*ERROR*"; - } + /* Always guaranteed to return a valid pointer */ DEBUG_ONLY_MEMBERS (return op->name); - return "AE_NOT_CONFIGURED"; + return ("AE_NOT_CONFIGURED"); } @@ -153,7 +177,7 @@ * 6-7 (2 bits) = Reserved */ #define AML_NO_ARGS 0 -#define AML_HAS_ARGS OP_INFO_HAS_ARGS +#define AML_HAS_ARGS ACPI_OP_ARGS_MASK /* * All AML opcodes and the parse-time arguments for each. Used by the AML parser Each list is compressed @@ -225,7 +249,7 @@ #define ARGP_IF_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_TERMARG, ARGP_TERMLIST) #define ARGP_ELSE_OP ARGP_LIST2 (ARGP_PKGLENGTH, ARGP_TERMLIST) #define ARGP_WHILE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_TERMARG, ARGP_TERMLIST) -#define ARGP_NOOP_CODE ARG_NONE +#define ARGP_NOOP_OP ARG_NONE #define ARGP_RETURN_OP ARGP_LIST1 (ARGP_TERMARG) #define ARGP_BREAK_OP ARG_NONE #define ARGP_BREAK_POINT_OP ARG_NONE @@ -242,9 +266,9 @@ #define ARGP_WAIT_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_TERMARG) #define ARGP_RESET_OP ARGP_LIST1 (ARGP_SUPERNAME) #define ARGP_RELEASE_OP ARGP_LIST1 (ARGP_SUPERNAME) -#define ARGP_FROM_BCDOP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET) -#define ARGP_TO_BCDOP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET) -#define ARGP_UN_LOAD_OP ARGP_LIST1 (ARGP_SUPERNAME) +#define ARGP_FROM_BCD_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET) +#define ARGP_TO_BCD_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET) +#define ARGP_UNLOAD_OP ARGP_LIST1 (ARGP_SUPERNAME) #define ARGP_REVISION_OP ARG_NONE #define ARGP_DEBUG_OP ARG_NONE #define ARGP_FATAL_OP ARGP_LIST3 (ARGP_BYTEDATA, ARGP_DWORDDATA, ARGP_TERMARG) @@ -340,7 +364,7 @@ #define ARGI_IF_OP ARGI_INVALID_OPCODE #define ARGI_ELSE_OP ARGI_INVALID_OPCODE #define ARGI_WHILE_OP ARGI_INVALID_OPCODE -#define ARGI_NOOP_CODE ARG_NONE +#define ARGI_NOOP_OP ARG_NONE #define ARGI_RETURN_OP ARGI_INVALID_OPCODE #define ARGI_BREAK_OP ARG_NONE #define ARGI_BREAK_POINT_OP ARG_NONE @@ -357,9 +381,9 @@ #define ARGI_WAIT_OP ARGI_LIST2 (ARGI_EVENT, ARGI_NUMBER) #define ARGI_RESET_OP ARGI_LIST1 (ARGI_EVENT) #define ARGI_RELEASE_OP ARGI_LIST1 (ARGI_MUTEX) -#define ARGI_FROM_BCDOP ARGI_LIST2 (ARGI_NUMBER, ARGI_TARGETREF) -#define ARGI_TO_BCDOP ARGI_LIST2 (ARGI_NUMBER, ARGI_TARGETREF) -#define ARGI_UN_LOAD_OP ARGI_LIST1 (ARGI_DDBHANDLE) +#define ARGI_FROM_BCD_OP ARGI_LIST2 (ARGI_NUMBER, ARGI_TARGETREF) +#define ARGI_TO_BCD_OP ARGI_LIST2 (ARGI_NUMBER, ARGI_TARGETREF) +#define ARGI_UNLOAD_OP ARGI_LIST1 (ARGI_DDBHANDLE) #define ARGI_REVISION_OP ARG_NONE #define ARGI_DEBUG_OP ARG_NONE #define ARGI_FATAL_OP ARGI_LIST3 (ARGI_NUMBER, ARGI_NUMBER, ARGI_NUMBER) @@ -388,157 +412,156 @@ */ -ACPI_OP_INFO acpi_gbl_aml_op_info[] = +ACPI_OPCODE_INFO acpi_gbl_aml_op_info[] = { -/* Opcode Opcode Type Has Arguments? Child Name Parser Args Interpreter Args */ +/* Index Opcode Type Class Has Arguments? Name Parser Args Interpreter Args */ -/* 00 */ OP_INFO_ENTRY (AML_ZERO_OP, OPTYPE_CONSTANT| AML_NO_ARGS| 0, "Zero_op", ARGP_ZERO_OP, ARGI_ZERO_OP), -/* 01 */ OP_INFO_ENTRY (AML_ONE_OP, OPTYPE_CONSTANT| AML_NO_ARGS| 0, "One_op", ARGP_ONE_OP, ARGI_ONE_OP), -/* 02 */ OP_INFO_ENTRY (AML_ALIAS_OP, OPTYPE_NAMED_OBJECT| AML_HAS_ARGS| 0, "Alias", ARGP_ALIAS_OP, ARGI_ALIAS_OP), -/* 03 */ OP_INFO_ENTRY (AML_NAME_OP, OPTYPE_NAMED_OBJECT| AML_HAS_ARGS| 0, "Name", ARGP_NAME_OP, ARGI_NAME_OP), -/* 04 */ OP_INFO_ENTRY (AML_BYTE_OP, OPTYPE_LITERAL| AML_NO_ARGS| 0, "Byte_const", ARGP_BYTE_OP, ARGI_BYTE_OP), -/* 05 */ OP_INFO_ENTRY (AML_WORD_OP, OPTYPE_LITERAL| AML_NO_ARGS| 0, "Word_const", ARGP_WORD_OP, ARGI_WORD_OP), -/* 06 */ OP_INFO_ENTRY (AML_DWORD_OP, OPTYPE_LITERAL| AML_NO_ARGS| 0, "Dword_const", ARGP_DWORD_OP, ARGI_DWORD_OP), -/* 07 */ OP_INFO_ENTRY (AML_STRING_OP, OPTYPE_LITERAL| AML_NO_ARGS| 0, "String", ARGP_STRING_OP, ARGI_STRING_OP), -/* 08 */ OP_INFO_ENTRY (AML_SCOPE_OP, OPTYPE_NAMED_OBJECT| AML_HAS_ARGS| 0, "Scope", ARGP_SCOPE_OP, ARGI_SCOPE_OP), -/* 09 */ OP_INFO_ENTRY (AML_BUFFER_OP, OPTYPE_DATA_TERM| AML_HAS_ARGS| 0, "Buffer", ARGP_BUFFER_OP, ARGI_BUFFER_OP), -/* 0A */ OP_INFO_ENTRY (AML_PACKAGE_OP, OPTYPE_DATA_TERM| AML_HAS_ARGS| 0, "Package", ARGP_PACKAGE_OP, ARGI_PACKAGE_OP), -/* 0B */ OP_INFO_ENTRY (AML_METHOD_OP, OPTYPE_NAMED_OBJECT| AML_HAS_ARGS| 0, "Method", ARGP_METHOD_OP, ARGI_METHOD_OP), -/* 0C */ OP_INFO_ENTRY (AML_LOCAL0, OPTYPE_LOCAL_VARIABLE| AML_NO_ARGS| 0, "Local0", ARGP_LOCAL0, ARGI_LOCAL0), -/* 0D */ OP_INFO_ENTRY (AML_LOCAL1, OPTYPE_LOCAL_VARIABLE| AML_NO_ARGS| 0, "Local1", ARGP_LOCAL1, ARGI_LOCAL1), -/* 0E */ OP_INFO_ENTRY (AML_LOCAL2, OPTYPE_LOCAL_VARIABLE| AML_NO_ARGS| 0, "Local2", ARGP_LOCAL2, ARGI_LOCAL2), -/* 0F */ OP_INFO_ENTRY (AML_LOCAL3, OPTYPE_LOCAL_VARIABLE| AML_NO_ARGS| 0, "Local3", ARGP_LOCAL3, ARGI_LOCAL3), -/* 10 */ OP_INFO_ENTRY (AML_LOCAL4, OPTYPE_LOCAL_VARIABLE| AML_NO_ARGS| 0, "Local4", ARGP_LOCAL4, ARGI_LOCAL4), -/* 11 */ OP_INFO_ENTRY (AML_LOCAL5, OPTYPE_LOCAL_VARIABLE| AML_NO_ARGS| 0, "Local5", ARGP_LOCAL5, ARGI_LOCAL5), -/* 12 */ OP_INFO_ENTRY (AML_LOCAL6, OPTYPE_LOCAL_VARIABLE| AML_NO_ARGS| 0, "Local6", ARGP_LOCAL6, ARGI_LOCAL6), -/* 13 */ OP_INFO_ENTRY (AML_LOCAL7, OPTYPE_LOCAL_VARIABLE| AML_NO_ARGS| 0, "Local7", ARGP_LOCAL7, ARGI_LOCAL7), -/* 14 */ OP_INFO_ENTRY (AML_ARG0, OPTYPE_METHOD_ARGUMENT| AML_NO_ARGS| 0, "Arg0", ARGP_ARG0, ARGI_ARG0), -/* 15 */ OP_INFO_ENTRY (AML_ARG1, OPTYPE_METHOD_ARGUMENT| AML_NO_ARGS| 0, "Arg1", ARGP_ARG1, ARGI_ARG1), -/* 16 */ OP_INFO_ENTRY (AML_ARG2, OPTYPE_METHOD_ARGUMENT| AML_NO_ARGS| 0, "Arg2", ARGP_ARG2, ARGI_ARG2), -/* 17 */ OP_INFO_ENTRY (AML_ARG3, OPTYPE_METHOD_ARGUMENT| AML_NO_ARGS| 0, "Arg3", ARGP_ARG3, ARGI_ARG3), -/* 18 */ OP_INFO_ENTRY (AML_ARG4, OPTYPE_METHOD_ARGUMENT| AML_NO_ARGS| 0, "Arg4", ARGP_ARG4, ARGI_ARG4), -/* 19 */ OP_INFO_ENTRY (AML_ARG5, OPTYPE_METHOD_ARGUMENT| AML_NO_ARGS| 0, "Arg5", ARGP_ARG5, ARGI_ARG5), -/* 1_a */ OP_INFO_ENTRY (AML_ARG6, OPTYPE_METHOD_ARGUMENT| AML_NO_ARGS| 0, "Arg6", ARGP_ARG6, ARGI_ARG6), -/* 1_b */ OP_INFO_ENTRY (AML_STORE_OP, OPTYPE_MONADIC2_r| AML_HAS_ARGS| 0, "Store", ARGP_STORE_OP, ARGI_STORE_OP), -/* 1_c */ OP_INFO_ENTRY (AML_REF_OF_OP, OPTYPE_MONADIC2| AML_HAS_ARGS| 0, "Ref_of", ARGP_REF_OF_OP, ARGI_REF_OF_OP), -/* 1_d */ OP_INFO_ENTRY (AML_ADD_OP, OPTYPE_DYADIC2_r| AML_HAS_ARGS| 0, "Add", ARGP_ADD_OP, ARGI_ADD_OP), -/* 1_e */ OP_INFO_ENTRY (AML_CONCAT_OP, OPTYPE_DYADIC2_r| AML_HAS_ARGS| 0, "Concat", ARGP_CONCAT_OP, ARGI_CONCAT_OP), -/* 1_f */ OP_INFO_ENTRY (AML_SUBTRACT_OP, OPTYPE_DYADIC2_r| AML_HAS_ARGS| 0, "Subtract", ARGP_SUBTRACT_OP, ARGI_SUBTRACT_OP), -/* 20 */ OP_INFO_ENTRY (AML_INCREMENT_OP, OPTYPE_MONADIC2| AML_HAS_ARGS| 0, "Increment", ARGP_INCREMENT_OP, ARGI_INCREMENT_OP), -/* 21 */ OP_INFO_ENTRY (AML_DECREMENT_OP, OPTYPE_MONADIC2| AML_HAS_ARGS| 0, "Decrement", ARGP_DECREMENT_OP, ARGI_DECREMENT_OP), -/* 22 */ OP_INFO_ENTRY (AML_MULTIPLY_OP, OPTYPE_DYADIC2_r| AML_HAS_ARGS| 0, "Multiply", ARGP_MULTIPLY_OP, ARGI_MULTIPLY_OP), -/* 23 */ OP_INFO_ENTRY (AML_DIVIDE_OP, OPTYPE_DYADIC2_r| AML_HAS_ARGS| 0, "Divide", ARGP_DIVIDE_OP, ARGI_DIVIDE_OP), -/* 24 */ OP_INFO_ENTRY (AML_SHIFT_LEFT_OP, OPTYPE_DYADIC2_r| AML_HAS_ARGS| 0, "Shift_left", ARGP_SHIFT_LEFT_OP, ARGI_SHIFT_LEFT_OP), -/* 25 */ OP_INFO_ENTRY (AML_SHIFT_RIGHT_OP, OPTYPE_DYADIC2_r| AML_HAS_ARGS| 0, "Shift_right", ARGP_SHIFT_RIGHT_OP, ARGI_SHIFT_RIGHT_OP), -/* 26 */ OP_INFO_ENTRY (AML_BIT_AND_OP, OPTYPE_DYADIC2_r| AML_HAS_ARGS| 0, "And", ARGP_BIT_AND_OP, ARGI_BIT_AND_OP), -/* 27 */ OP_INFO_ENTRY (AML_BIT_NAND_OP, OPTYPE_DYADIC2_r| AML_HAS_ARGS| 0, "NAnd", ARGP_BIT_NAND_OP, ARGI_BIT_NAND_OP), -/* 28 */ OP_INFO_ENTRY (AML_BIT_OR_OP, OPTYPE_DYADIC2_r| AML_HAS_ARGS| 0, "Or", ARGP_BIT_OR_OP, ARGI_BIT_OR_OP), -/* 29 */ OP_INFO_ENTRY (AML_BIT_NOR_OP, OPTYPE_DYADIC2_r| AML_HAS_ARGS| 0, "NOr", ARGP_BIT_NOR_OP, ARGI_BIT_NOR_OP), -/* 2_a */ OP_INFO_ENTRY (AML_BIT_XOR_OP, OPTYPE_DYADIC2_r| AML_HAS_ARGS| 0, "XOr", ARGP_BIT_XOR_OP, ARGI_BIT_XOR_OP), -/* 2_b */ OP_INFO_ENTRY (AML_BIT_NOT_OP, OPTYPE_MONADIC2_r| AML_HAS_ARGS| 0, "Not", ARGP_BIT_NOT_OP, ARGI_BIT_NOT_OP), -/* 2_c */ OP_INFO_ENTRY (AML_FIND_SET_LEFT_BIT_OP, OPTYPE_MONADIC2_r| AML_HAS_ARGS| 0, "Find_set_left_bit", ARGP_FIND_SET_LEFT_BIT_OP, ARGI_FIND_SET_LEFT_BIT_OP), -/* 2_d */ OP_INFO_ENTRY (AML_FIND_SET_RIGHT_BIT_OP, OPTYPE_MONADIC2_r| AML_HAS_ARGS| 0, "Find_set_right_bit", ARGP_FIND_SET_RIGHT_BIT_OP, ARGI_FIND_SET_RIGHT_BIT_OP), -/* 2_e */ OP_INFO_ENTRY (AML_DEREF_OF_OP, OPTYPE_MONADIC2| AML_HAS_ARGS| 0, "Deref_of", ARGP_DEREF_OF_OP, ARGI_DEREF_OF_OP), -/* 2_f */ OP_INFO_ENTRY (AML_NOTIFY_OP, OPTYPE_DYADIC1| AML_HAS_ARGS| 0, "Notify", ARGP_NOTIFY_OP, ARGI_NOTIFY_OP), -/* 30 */ OP_INFO_ENTRY (AML_SIZE_OF_OP, OPTYPE_MONADIC2| AML_HAS_ARGS| 0, "Size_of", ARGP_SIZE_OF_OP, ARGI_SIZE_OF_OP), -/* 31 */ OP_INFO_ENTRY (AML_INDEX_OP, OPTYPE_INDEX| AML_HAS_ARGS| 0, "Index", ARGP_INDEX_OP, ARGI_INDEX_OP), -/* 32 */ OP_INFO_ENTRY (AML_MATCH_OP, OPTYPE_MATCH| AML_HAS_ARGS| 0, "Match", ARGP_MATCH_OP, ARGI_MATCH_OP), -/* 33 */ OP_INFO_ENTRY (AML_DWORD_FIELD_OP, OPTYPE_CREATE_FIELD| AML_HAS_ARGS| 0, "Create_dWord_field", ARGP_DWORD_FIELD_OP, ARGI_DWORD_FIELD_OP), -/* 34 */ OP_INFO_ENTRY (AML_WORD_FIELD_OP, OPTYPE_CREATE_FIELD| AML_HAS_ARGS| 0, "Create_word_field", ARGP_WORD_FIELD_OP, ARGI_WORD_FIELD_OP), -/* 35 */ OP_INFO_ENTRY (AML_BYTE_FIELD_OP, OPTYPE_CREATE_FIELD| AML_HAS_ARGS| 0, "Create_byte_field", ARGP_BYTE_FIELD_OP, ARGI_BYTE_FIELD_OP), -/* 36 */ OP_INFO_ENTRY (AML_BIT_FIELD_OP, OPTYPE_CREATE_FIELD| AML_HAS_ARGS| 0, "Create_bit_field", ARGP_BIT_FIELD_OP, ARGI_BIT_FIELD_OP), -/* 37 */ OP_INFO_ENTRY (AML_TYPE_OP, OPTYPE_MONADIC2| AML_HAS_ARGS| 0, "Object_type", ARGP_TYPE_OP, ARGI_TYPE_OP), -/* 38 */ OP_INFO_ENTRY (AML_LAND_OP, OPTYPE_DYADIC2| AML_HAS_ARGS| 0, "LAnd", ARGP_LAND_OP, ARGI_LAND_OP), -/* 39 */ OP_INFO_ENTRY (AML_LOR_OP, OPTYPE_DYADIC2| AML_HAS_ARGS| 0, "LOr", ARGP_LOR_OP, ARGI_LOR_OP), -/* 3_a */ OP_INFO_ENTRY (AML_LNOT_OP, OPTYPE_MONADIC2| AML_HAS_ARGS| 0, "LNot", ARGP_LNOT_OP, ARGI_LNOT_OP), -/* 3_b */ OP_INFO_ENTRY (AML_LEQUAL_OP, OPTYPE_DYADIC2| AML_HAS_ARGS| 0, "LEqual", ARGP_LEQUAL_OP, ARGI_LEQUAL_OP), -/* 3_c */ OP_INFO_ENTRY (AML_LGREATER_OP, OPTYPE_DYADIC2| AML_HAS_ARGS| 0, "LGreater", ARGP_LGREATER_OP, ARGI_LGREATER_OP), -/* 3_d */ OP_INFO_ENTRY (AML_LLESS_OP, OPTYPE_DYADIC2| AML_HAS_ARGS| 0, "LLess", ARGP_LLESS_OP, ARGI_LLESS_OP), -/* 3_e */ OP_INFO_ENTRY (AML_IF_OP, OPTYPE_CONTROL| AML_HAS_ARGS| 0, "If", ARGP_IF_OP, ARGI_IF_OP), -/* 3_f */ OP_INFO_ENTRY (AML_ELSE_OP, OPTYPE_CONTROL| AML_HAS_ARGS| 0, "Else", ARGP_ELSE_OP, ARGI_ELSE_OP), -/* 40 */ OP_INFO_ENTRY (AML_WHILE_OP, OPTYPE_CONTROL| AML_HAS_ARGS| 0, "While", ARGP_WHILE_OP, ARGI_WHILE_OP), -/* 41 */ OP_INFO_ENTRY (AML_NOOP_CODE, OPTYPE_CONTROL| AML_NO_ARGS| 0, "Noop", ARGP_NOOP_CODE, ARGI_NOOP_CODE), -/* 42 */ OP_INFO_ENTRY (AML_RETURN_OP, OPTYPE_CONTROL| AML_HAS_ARGS| 0, "Return", ARGP_RETURN_OP, ARGI_RETURN_OP), -/* 43 */ OP_INFO_ENTRY (AML_BREAK_OP, OPTYPE_CONTROL| AML_NO_ARGS| 0, "Break", ARGP_BREAK_OP, ARGI_BREAK_OP), -/* 44 */ OP_INFO_ENTRY (AML_BREAK_POINT_OP, OPTYPE_CONTROL| AML_NO_ARGS| 0, "Break_point", ARGP_BREAK_POINT_OP, ARGI_BREAK_POINT_OP), -/* 45 */ OP_INFO_ENTRY (AML_ONES_OP, OPTYPE_CONSTANT| AML_NO_ARGS| 0, "Ones_op", ARGP_ONES_OP, ARGI_ONES_OP), +/* 00 */ /* AML_ZERO_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CONSTANT| AML_NO_ARGS, "Zero_op", ARGP_ZERO_OP, ARGI_ZERO_OP), +/* 01 */ /* AML_ONE_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CONSTANT| AML_NO_ARGS, "One_op", ARGP_ONE_OP, ARGI_ONE_OP), +/* 02 */ /* AML_ALIAS_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT| AML_HAS_ARGS, "Alias", ARGP_ALIAS_OP, ARGI_ALIAS_OP), +/* 03 */ /* AML_NAME_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT| AML_HAS_ARGS, "Name", ARGP_NAME_OP, ARGI_NAME_OP), +/* 04 */ /* AML_BYTE_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_LITERAL| AML_NO_ARGS, "Byte_const", ARGP_BYTE_OP, ARGI_BYTE_OP), +/* 05 */ /* AML_WORD_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_LITERAL| AML_NO_ARGS, "Word_const", ARGP_WORD_OP, ARGI_WORD_OP), +/* 06 */ /* AML_DWORD_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_LITERAL| AML_NO_ARGS, "Dword_const", ARGP_DWORD_OP, ARGI_DWORD_OP), +/* 07 */ /* AML_STRING_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_LITERAL| AML_NO_ARGS, "String", ARGP_STRING_OP, ARGI_STRING_OP), +/* 08 */ /* AML_SCOPE_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT| AML_HAS_ARGS, "Scope", ARGP_SCOPE_OP, ARGI_SCOPE_OP), +/* 09 */ /* AML_BUFFER_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DATA_TERM| AML_HAS_ARGS, "Buffer", ARGP_BUFFER_OP, ARGI_BUFFER_OP), +/* 0A */ /* AML_PACKAGE_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DATA_TERM| AML_HAS_ARGS, "Package", ARGP_PACKAGE_OP, ARGI_PACKAGE_OP), +/* 0B */ /* AML_METHOD_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT| AML_HAS_ARGS, "Method", ARGP_METHOD_OP, ARGI_METHOD_OP), +/* 0C */ /* AML_LOCAL0 */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_LOCAL_VARIABLE| AML_NO_ARGS, "Local0", ARGP_LOCAL0, ARGI_LOCAL0), +/* 0D */ /* AML_LOCAL1 */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_LOCAL_VARIABLE| AML_NO_ARGS, "Local1", ARGP_LOCAL1, ARGI_LOCAL1), +/* 0E */ /* AML_LOCAL2 */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_LOCAL_VARIABLE| AML_NO_ARGS, "Local2", ARGP_LOCAL2, ARGI_LOCAL2), +/* 0F */ /* AML_LOCAL3 */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_LOCAL_VARIABLE| AML_NO_ARGS, "Local3", ARGP_LOCAL3, ARGI_LOCAL3), +/* 10 */ /* AML_LOCAL4 */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_LOCAL_VARIABLE| AML_NO_ARGS, "Local4", ARGP_LOCAL4, ARGI_LOCAL4), +/* 11 */ /* AML_LOCAL5 */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_LOCAL_VARIABLE| AML_NO_ARGS, "Local5", ARGP_LOCAL5, ARGI_LOCAL5), +/* 12 */ /* AML_LOCAL6 */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_LOCAL_VARIABLE| AML_NO_ARGS, "Local6", ARGP_LOCAL6, ARGI_LOCAL6), +/* 13 */ /* AML_LOCAL7 */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_LOCAL_VARIABLE| AML_NO_ARGS, "Local7", ARGP_LOCAL7, ARGI_LOCAL7), +/* 14 */ /* AML_ARG0 */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_METHOD_ARGUMENT| AML_NO_ARGS, "Arg0", ARGP_ARG0, ARGI_ARG0), +/* 15 */ /* AML_ARG1 */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_METHOD_ARGUMENT| AML_NO_ARGS, "Arg1", ARGP_ARG1, ARGI_ARG1), +/* 16 */ /* AML_ARG2 */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_METHOD_ARGUMENT| AML_NO_ARGS, "Arg2", ARGP_ARG2, ARGI_ARG2), +/* 17 */ /* AML_ARG3 */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_METHOD_ARGUMENT| AML_NO_ARGS, "Arg3", ARGP_ARG3, ARGI_ARG3), +/* 18 */ /* AML_ARG4 */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_METHOD_ARGUMENT| AML_NO_ARGS, "Arg4", ARGP_ARG4, ARGI_ARG4), +/* 19 */ /* AML_ARG5 */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_METHOD_ARGUMENT| AML_NO_ARGS, "Arg5", ARGP_ARG5, ARGI_ARG5), +/* 1_a */ /* AML_ARG6 */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_METHOD_ARGUMENT| AML_NO_ARGS, "Arg6", ARGP_ARG6, ARGI_ARG6), +/* 1_b */ /* AML_STORE_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2_r| AML_HAS_ARGS, "Store", ARGP_STORE_OP, ARGI_STORE_OP), +/* 1_c */ /* AML_REF_OF_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2| AML_HAS_ARGS, "Ref_of", ARGP_REF_OF_OP, ARGI_REF_OF_OP), +/* 1_d */ /* AML_ADD_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_r| AML_HAS_ARGS, "Add", ARGP_ADD_OP, ARGI_ADD_OP), +/* 1_e */ /* AML_CONCAT_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_r| AML_HAS_ARGS, "Concat", ARGP_CONCAT_OP, ARGI_CONCAT_OP), +/* 1_f */ /* AML_SUBTRACT_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_r| AML_HAS_ARGS, "Subtract", ARGP_SUBTRACT_OP, ARGI_SUBTRACT_OP), +/* 20 */ /* AML_INCREMENT_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2| AML_HAS_ARGS, "Increment", ARGP_INCREMENT_OP, ARGI_INCREMENT_OP), +/* 21 */ /* AML_DECREMENT_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2| AML_HAS_ARGS, "Decrement", ARGP_DECREMENT_OP, ARGI_DECREMENT_OP), +/* 22 */ /* AML_MULTIPLY_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_r| AML_HAS_ARGS, "Multiply", ARGP_MULTIPLY_OP, ARGI_MULTIPLY_OP), +/* 23 */ /* AML_DIVIDE_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_r| AML_HAS_ARGS, "Divide", ARGP_DIVIDE_OP, ARGI_DIVIDE_OP), +/* 24 */ /* AML_SHIFT_LEFT_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_r| AML_HAS_ARGS, "Shift_left", ARGP_SHIFT_LEFT_OP, ARGI_SHIFT_LEFT_OP), +/* 25 */ /* AML_SHIFT_RIGHT_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_r| AML_HAS_ARGS, "Shift_right", ARGP_SHIFT_RIGHT_OP, ARGI_SHIFT_RIGHT_OP), +/* 26 */ /* AML_BIT_AND_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_r| AML_HAS_ARGS, "And", ARGP_BIT_AND_OP, ARGI_BIT_AND_OP), +/* 27 */ /* AML_BIT_NAND_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_r| AML_HAS_ARGS, "NAnd", ARGP_BIT_NAND_OP, ARGI_BIT_NAND_OP), +/* 28 */ /* AML_BIT_OR_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_r| AML_HAS_ARGS, "Or", ARGP_BIT_OR_OP, ARGI_BIT_OR_OP), +/* 29 */ /* AML_BIT_NOR_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_r| AML_HAS_ARGS, "NOr", ARGP_BIT_NOR_OP, ARGI_BIT_NOR_OP), +/* 2_a */ /* AML_BIT_XOR_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_r| AML_HAS_ARGS, "XOr", ARGP_BIT_XOR_OP, ARGI_BIT_XOR_OP), +/* 2_b */ /* AML_BIT_NOT_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2_r| AML_HAS_ARGS, "Not", ARGP_BIT_NOT_OP, ARGI_BIT_NOT_OP), +/* 2_c */ /* AML_FIND_SET_LEFT_BIT_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2_r| AML_HAS_ARGS, "Find_set_left_bit", ARGP_FIND_SET_LEFT_BIT_OP, ARGI_FIND_SET_LEFT_BIT_OP), +/* 2_d */ /* AML_FIND_SET_RIGHT_BIT_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2_r| AML_HAS_ARGS, "Find_set_right_bit", ARGP_FIND_SET_RIGHT_BIT_OP, ARGI_FIND_SET_RIGHT_BIT_OP), +/* 2_e */ /* AML_DEREF_OF_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2| AML_HAS_ARGS, "Deref_of", ARGP_DEREF_OF_OP, ARGI_DEREF_OF_OP), +/* 2_f */ /* AML_NOTIFY_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC1| AML_HAS_ARGS, "Notify", ARGP_NOTIFY_OP, ARGI_NOTIFY_OP), +/* 30 */ /* AML_SIZE_OF_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2| AML_HAS_ARGS, "Size_of", ARGP_SIZE_OF_OP, ARGI_SIZE_OF_OP), +/* 31 */ /* AML_INDEX_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_INDEX| AML_HAS_ARGS, "Index", ARGP_INDEX_OP, ARGI_INDEX_OP), +/* 32 */ /* AML_MATCH_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MATCH| AML_HAS_ARGS, "Match", ARGP_MATCH_OP, ARGI_MATCH_OP), +/* 33 */ /* AML_DWORD_FIELD_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CREATE_FIELD| AML_HAS_ARGS, "Create_dWord_field", ARGP_DWORD_FIELD_OP, ARGI_DWORD_FIELD_OP), +/* 34 */ /* AML_WORD_FIELD_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CREATE_FIELD| AML_HAS_ARGS, "Create_word_field", ARGP_WORD_FIELD_OP, ARGI_WORD_FIELD_OP), +/* 35 */ /* AML_BYTE_FIELD_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CREATE_FIELD| AML_HAS_ARGS, "Create_byte_field", ARGP_BYTE_FIELD_OP, ARGI_BYTE_FIELD_OP), +/* 36 */ /* AML_BIT_FIELD_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CREATE_FIELD| AML_HAS_ARGS, "Create_bit_field", ARGP_BIT_FIELD_OP, ARGI_BIT_FIELD_OP), +/* 37 */ /* AML_TYPE_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2| AML_HAS_ARGS, "Object_type", ARGP_TYPE_OP, ARGI_TYPE_OP), +/* 38 */ /* AML_LAND_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2| AML_HAS_ARGS, "LAnd", ARGP_LAND_OP, ARGI_LAND_OP), +/* 39 */ /* AML_LOR_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2| AML_HAS_ARGS, "LOr", ARGP_LOR_OP, ARGI_LOR_OP), +/* 3_a */ /* AML_LNOT_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2| AML_HAS_ARGS, "LNot", ARGP_LNOT_OP, ARGI_LNOT_OP), +/* 3_b */ /* AML_LEQUAL_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2| AML_HAS_ARGS, "LEqual", ARGP_LEQUAL_OP, ARGI_LEQUAL_OP), +/* 3_c */ /* AML_LGREATER_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2| AML_HAS_ARGS, "LGreater", ARGP_LGREATER_OP, ARGI_LGREATER_OP), +/* 3_d */ /* AML_LLESS_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2| AML_HAS_ARGS, "LLess", ARGP_LLESS_OP, ARGI_LLESS_OP), +/* 3_e */ /* AML_IF_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CONTROL| AML_HAS_ARGS, "If", ARGP_IF_OP, ARGI_IF_OP), +/* 3_f */ /* AML_ELSE_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CONTROL| AML_HAS_ARGS, "Else", ARGP_ELSE_OP, ARGI_ELSE_OP), +/* 40 */ /* AML_WHILE_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CONTROL| AML_HAS_ARGS, "While", ARGP_WHILE_OP, ARGI_WHILE_OP), +/* 41 */ /* AML_NOOP_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CONTROL| AML_NO_ARGS, "Noop", ARGP_NOOP_OP, ARGI_NOOP_OP), +/* 42 */ /* AML_RETURN_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CONTROL| AML_HAS_ARGS, "Return", ARGP_RETURN_OP, ARGI_RETURN_OP), +/* 43 */ /* AML_BREAK_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CONTROL| AML_NO_ARGS, "Break", ARGP_BREAK_OP, ARGI_BREAK_OP), +/* 44 */ /* AML_BREAK_POINT_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CONTROL| AML_NO_ARGS, "Break_point", ARGP_BREAK_POINT_OP, ARGI_BREAK_POINT_OP), +/* 45 */ /* AML_ONES_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CONSTANT| AML_NO_ARGS, "Ones_op", ARGP_ONES_OP, ARGI_ONES_OP), /* Prefixed opcodes (Two-byte opcodes with a prefix op) */ -/* 46 */ OP_INFO_ENTRY (AML_MUTEX_OP, OPTYPE_NAMED_OBJECT| AML_HAS_ARGS| 0, "Mutex", ARGP_MUTEX_OP, ARGI_MUTEX_OP), -/* 47 */ OP_INFO_ENTRY (AML_EVENT_OP, OPTYPE_NAMED_OBJECT| AML_NO_ARGS| 0, "Event", ARGP_EVENT_OP, ARGI_EVENT_OP), -/* 48 */ OP_INFO_ENTRY (AML_COND_REF_OF_OP, OPTYPE_MONADIC2_r| AML_HAS_ARGS| 0, "Cond_ref_of", ARGP_COND_REF_OF_OP, ARGI_COND_REF_OF_OP), -/* 49 */ OP_INFO_ENTRY (AML_CREATE_FIELD_OP, OPTYPE_CREATE_FIELD| AML_HAS_ARGS| 0, "Create_field", ARGP_CREATE_FIELD_OP, ARGI_CREATE_FIELD_OP), -/* 4_a */ OP_INFO_ENTRY (AML_LOAD_OP, OPTYPE_RECONFIGURATION| AML_HAS_ARGS| 0, "Load", ARGP_LOAD_OP, ARGI_LOAD_OP), -/* 4_b */ OP_INFO_ENTRY (AML_STALL_OP, OPTYPE_MONADIC1| AML_HAS_ARGS| 0, "Stall", ARGP_STALL_OP, ARGI_STALL_OP), -/* 4_c */ OP_INFO_ENTRY (AML_SLEEP_OP, OPTYPE_MONADIC1| AML_HAS_ARGS| 0, "Sleep", ARGP_SLEEP_OP, ARGI_SLEEP_OP), -/* 4_d */ OP_INFO_ENTRY (AML_ACQUIRE_OP, OPTYPE_DYADIC2_s| AML_HAS_ARGS| 0, "Acquire", ARGP_ACQUIRE_OP, ARGI_ACQUIRE_OP), -/* 4_e */ OP_INFO_ENTRY (AML_SIGNAL_OP, OPTYPE_MONADIC1| AML_HAS_ARGS| 0, "Signal", ARGP_SIGNAL_OP, ARGI_SIGNAL_OP), -/* 4_f */ OP_INFO_ENTRY (AML_WAIT_OP, OPTYPE_DYADIC2_s| AML_HAS_ARGS| 0, "Wait", ARGP_WAIT_OP, ARGI_WAIT_OP), -/* 50 */ OP_INFO_ENTRY (AML_RESET_OP, OPTYPE_MONADIC1| AML_HAS_ARGS| 0, "Reset", ARGP_RESET_OP, ARGI_RESET_OP), -/* 51 */ OP_INFO_ENTRY (AML_RELEASE_OP, OPTYPE_MONADIC1| AML_HAS_ARGS| 0, "Release", ARGP_RELEASE_OP, ARGI_RELEASE_OP), -/* 52 */ OP_INFO_ENTRY (AML_FROM_BCDOP, OPTYPE_MONADIC2_r| AML_HAS_ARGS| 0, "From_bCD", ARGP_FROM_BCDOP, ARGI_FROM_BCDOP), -/* 53 */ OP_INFO_ENTRY (AML_TO_BCDOP, OPTYPE_MONADIC2_r| AML_HAS_ARGS| 0, "To_bCD", ARGP_TO_BCDOP, ARGI_TO_BCDOP), -/* 54 */ OP_INFO_ENTRY (AML_UN_LOAD_OP, OPTYPE_RECONFIGURATION| AML_HAS_ARGS| 0, "Unload", ARGP_UN_LOAD_OP, ARGI_UN_LOAD_OP), -/* 55 */ OP_INFO_ENTRY (AML_REVISION_OP, OPTYPE_CONSTANT| AML_NO_ARGS| 0, "Revision", ARGP_REVISION_OP, ARGI_REVISION_OP), -/* 56 */ OP_INFO_ENTRY (AML_DEBUG_OP, OPTYPE_CONSTANT| AML_NO_ARGS| 0, "Debug", ARGP_DEBUG_OP, ARGI_DEBUG_OP), -/* 57 */ OP_INFO_ENTRY (AML_FATAL_OP, OPTYPE_FATAL| AML_HAS_ARGS| 0, "Fatal", ARGP_FATAL_OP, ARGI_FATAL_OP), -/* 58 */ OP_INFO_ENTRY (AML_REGION_OP, OPTYPE_NAMED_OBJECT| AML_HAS_ARGS| 0, "Op_region", ARGP_REGION_OP, ARGI_REGION_OP), -/* 59 */ OP_INFO_ENTRY (AML_DEF_FIELD_OP, OPTYPE_NAMED_OBJECT| AML_HAS_ARGS| 0, "Field", ARGP_DEF_FIELD_OP, ARGI_DEF_FIELD_OP), -/* 5_a */ OP_INFO_ENTRY (AML_DEVICE_OP, OPTYPE_NAMED_OBJECT| AML_HAS_ARGS| 0, "Device", ARGP_DEVICE_OP, ARGI_DEVICE_OP), -/* 5_b */ OP_INFO_ENTRY (AML_PROCESSOR_OP, OPTYPE_NAMED_OBJECT| AML_HAS_ARGS| 0, "Processor", ARGP_PROCESSOR_OP, ARGI_PROCESSOR_OP), -/* 5_c */ OP_INFO_ENTRY (AML_POWER_RES_OP, OPTYPE_NAMED_OBJECT| AML_HAS_ARGS| 0, "Power_res", ARGP_POWER_RES_OP, ARGI_POWER_RES_OP), -/* 5_d */ OP_INFO_ENTRY (AML_THERMAL_ZONE_OP, OPTYPE_NAMED_OBJECT| AML_HAS_ARGS| 0, "Thermal_zone", ARGP_THERMAL_ZONE_OP, ARGI_THERMAL_ZONE_OP), -/* 5_e */ OP_INFO_ENTRY (AML_INDEX_FIELD_OP, OPTYPE_NAMED_OBJECT| AML_HAS_ARGS| 0, "Index_field", ARGP_INDEX_FIELD_OP, ARGI_INDEX_FIELD_OP), -/* 5_f */ OP_INFO_ENTRY (AML_BANK_FIELD_OP, OPTYPE_NAMED_OBJECT| AML_HAS_ARGS| 0, "Bank_field", ARGP_BANK_FIELD_OP, ARGI_BANK_FIELD_OP), +/* 46 */ /* AML_MUTEX_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT| AML_HAS_ARGS, "Mutex", ARGP_MUTEX_OP, ARGI_MUTEX_OP), +/* 47 */ /* AML_EVENT_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT| AML_NO_ARGS, "Event", ARGP_EVENT_OP, ARGI_EVENT_OP), +/* 48 */ /* AML_COND_REF_OF_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2_r| AML_HAS_ARGS, "Cond_ref_of", ARGP_COND_REF_OF_OP, ARGI_COND_REF_OF_OP), +/* 49 */ /* AML_CREATE_FIELD_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CREATE_FIELD| AML_HAS_ARGS, "Create_field", ARGP_CREATE_FIELD_OP, ARGI_CREATE_FIELD_OP), +/* 4_a */ /* AML_LOAD_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_RECONFIGURATION| AML_HAS_ARGS, "Load", ARGP_LOAD_OP, ARGI_LOAD_OP), +/* 4_b */ /* AML_STALL_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC1| AML_HAS_ARGS, "Stall", ARGP_STALL_OP, ARGI_STALL_OP), +/* 4_c */ /* AML_SLEEP_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC1| AML_HAS_ARGS, "Sleep", ARGP_SLEEP_OP, ARGI_SLEEP_OP), +/* 4_d */ /* AML_ACQUIRE_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_s| AML_HAS_ARGS, "Acquire", ARGP_ACQUIRE_OP, ARGI_ACQUIRE_OP), +/* 4_e */ /* AML_SIGNAL_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC1| AML_HAS_ARGS, "Signal", ARGP_SIGNAL_OP, ARGI_SIGNAL_OP), +/* 4_f */ /* AML_WAIT_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_s| AML_HAS_ARGS, "Wait", ARGP_WAIT_OP, ARGI_WAIT_OP), +/* 50 */ /* AML_RESET_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC1| AML_HAS_ARGS, "Reset", ARGP_RESET_OP, ARGI_RESET_OP), +/* 51 */ /* AML_RELEASE_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC1| AML_HAS_ARGS, "Release", ARGP_RELEASE_OP, ARGI_RELEASE_OP), +/* 52 */ /* AML_FROM_BCD_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2_r| AML_HAS_ARGS, "From_bCD", ARGP_FROM_BCD_OP, ARGI_FROM_BCD_OP), +/* 53 */ /* AML_TO_BCD_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2_r| AML_HAS_ARGS, "To_bCD", ARGP_TO_BCD_OP, ARGI_TO_BCD_OP), +/* 54 */ /* AML_UNLOAD_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_RECONFIGURATION| AML_HAS_ARGS, "Unload", ARGP_UNLOAD_OP, ARGI_UNLOAD_OP), +/* 55 */ /* AML_REVISION_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CONSTANT| AML_NO_ARGS, "Revision", ARGP_REVISION_OP, ARGI_REVISION_OP), +/* 56 */ /* AML_DEBUG_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CONSTANT| AML_NO_ARGS, "Debug", ARGP_DEBUG_OP, ARGI_DEBUG_OP), +/* 57 */ /* AML_FATAL_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_FATAL| AML_HAS_ARGS, "Fatal", ARGP_FATAL_OP, ARGI_FATAL_OP), +/* 58 */ /* AML_REGION_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT| AML_HAS_ARGS, "Op_region", ARGP_REGION_OP, ARGI_REGION_OP), +/* 59 */ /* AML_DEF_FIELD_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT| AML_HAS_ARGS, "Field", ARGP_DEF_FIELD_OP, ARGI_DEF_FIELD_OP), +/* 5_a */ /* AML_DEVICE_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT| AML_HAS_ARGS, "Device", ARGP_DEVICE_OP, ARGI_DEVICE_OP), +/* 5_b */ /* AML_PROCESSOR_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT| AML_HAS_ARGS, "Processor", ARGP_PROCESSOR_OP, ARGI_PROCESSOR_OP), +/* 5_c */ /* AML_POWER_RES_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT| AML_HAS_ARGS, "Power_res", ARGP_POWER_RES_OP, ARGI_POWER_RES_OP), +/* 5_d */ /* AML_THERMAL_ZONE_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT| AML_HAS_ARGS, "Thermal_zone", ARGP_THERMAL_ZONE_OP, ARGI_THERMAL_ZONE_OP), +/* 5_e */ /* AML_INDEX_FIELD_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT| AML_HAS_ARGS, "Index_field", ARGP_INDEX_FIELD_OP, ARGI_INDEX_FIELD_OP), +/* 5_f */ /* AML_BANK_FIELD_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT| AML_HAS_ARGS, "Bank_field", ARGP_BANK_FIELD_OP, ARGI_BANK_FIELD_OP), /* Internal opcodes that map to invalid AML opcodes */ -/* 60 */ OP_INFO_ENTRY (AML_LNOTEQUAL_OP, OPTYPE_BOGUS| AML_HAS_ARGS| 0, "LNot_equal", ARGP_LNOTEQUAL_OP, ARGI_LNOTEQUAL_OP), -/* 61 */ OP_INFO_ENTRY (AML_LLESSEQUAL_OP, OPTYPE_BOGUS| AML_HAS_ARGS| 0, "LLess_equal", ARGP_LLESSEQUAL_OP, ARGI_LLESSEQUAL_OP), -/* 62 */ OP_INFO_ENTRY (AML_LGREATEREQUAL_OP, OPTYPE_BOGUS| AML_HAS_ARGS| 0, "LGreater_equal", ARGP_LGREATEREQUAL_OP, ARGI_LGREATEREQUAL_OP), -/* 63 */ OP_INFO_ENTRY (AML_NAMEPATH_OP, OPTYPE_LITERAL| AML_NO_ARGS| 0, "Name_path", ARGP_NAMEPATH_OP, ARGI_NAMEPATH_OP), -/* 64 */ OP_INFO_ENTRY (AML_METHODCALL_OP, OPTYPE_METHOD_CALL| AML_HAS_ARGS| 0, "Method_call", ARGP_METHODCALL_OP, ARGI_METHODCALL_OP), -/* 65 */ OP_INFO_ENTRY (AML_BYTELIST_OP, OPTYPE_LITERAL| AML_NO_ARGS| 0, "Byte_list", ARGP_BYTELIST_OP, ARGI_BYTELIST_OP), -/* 66 */ OP_INFO_ENTRY (AML_RESERVEDFIELD_OP, OPTYPE_BOGUS| AML_NO_ARGS| 0, "Reserved_field", ARGP_RESERVEDFIELD_OP, ARGI_RESERVEDFIELD_OP), -/* 67 */ OP_INFO_ENTRY (AML_NAMEDFIELD_OP, OPTYPE_BOGUS| AML_NO_ARGS| 0, "Named_field", ARGP_NAMEDFIELD_OP, ARGI_NAMEDFIELD_OP), -/* 68 */ OP_INFO_ENTRY (AML_ACCESSFIELD_OP, OPTYPE_BOGUS| AML_NO_ARGS| 0, "Access_field", ARGP_ACCESSFIELD_OP, ARGI_ACCESSFIELD_OP), -/* 69 */ OP_INFO_ENTRY (AML_STATICSTRING_OP, OPTYPE_BOGUS| AML_NO_ARGS| 0, "Static_string", ARGP_STATICSTRING_OP, ARGI_STATICSTRING_OP), -/* 6_a */ OP_INFO_ENTRY (0, OPTYPE_BOGUS| AML_HAS_ARGS| 0, "UNKNOWN_OP!", ARG_NONE, ARG_NONE), - OP_INFO_ENTRY (0, 0| AML_HAS_ARGS| 0, NULL, ARG_NONE, ARG_NONE) +/* 60 */ /* AML_LNOTEQUAL_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_BOGUS| AML_HAS_ARGS, "LNot_equal", ARGP_LNOTEQUAL_OP, ARGI_LNOTEQUAL_OP), +/* 61 */ /* AML_LLESSEQUAL_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_BOGUS| AML_HAS_ARGS, "LLess_equal", ARGP_LLESSEQUAL_OP, ARGI_LLESSEQUAL_OP), +/* 62 */ /* AML_LGREATEREQUAL_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_BOGUS| AML_HAS_ARGS, "LGreater_equal", ARGP_LGREATEREQUAL_OP, ARGI_LGREATEREQUAL_OP), +/* 63 */ /* AML_NAMEPATH_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_LITERAL| AML_NO_ARGS, "Name_path", ARGP_NAMEPATH_OP, ARGI_NAMEPATH_OP), +/* 64 */ /* AML_METHODCALL_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_METHOD_CALL| AML_HAS_ARGS, "Method_call", ARGP_METHODCALL_OP, ARGI_METHODCALL_OP), +/* 65 */ /* AML_BYTELIST_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_LITERAL| AML_NO_ARGS, "Byte_list", ARGP_BYTELIST_OP, ARGI_BYTELIST_OP), +/* 66 */ /* AML_RESERVEDFIELD_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_BOGUS| AML_NO_ARGS, "Reserved_field", ARGP_RESERVEDFIELD_OP, ARGI_RESERVEDFIELD_OP), +/* 67 */ /* AML_NAMEDFIELD_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_BOGUS| AML_NO_ARGS, "Named_field", ARGP_NAMEDFIELD_OP, ARGI_NAMEDFIELD_OP), +/* 68 */ /* AML_ACCESSFIELD_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_BOGUS| AML_NO_ARGS, "Access_field", ARGP_ACCESSFIELD_OP, ARGI_ACCESSFIELD_OP), +/* 69 */ /* AML_STATICSTRING_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_BOGUS| AML_NO_ARGS, "Static_string", ARGP_STATICSTRING_OP, ARGI_STATICSTRING_OP), +/* 6_a */ /* AML_RETURN_VALUE_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_RETURN| AML_HAS_ARGS, "[Return Value]", ARG_NONE, ARG_NONE), +/* 6_b */ /* UNKNOWN OPCODES */ OP_INFO_ENTRY (ACPI_OP_TYPE_UNKNOWN | OPTYPE_BOGUS| AML_HAS_ARGS, "UNKNOWN_OP!", ARG_NONE, ARG_NONE), +/* 6_c */ /* ASCII CHARACTERS */ OP_INFO_ENTRY (ACPI_OP_TYPE_ASCII | OPTYPE_BOGUS| AML_HAS_ARGS, "ASCII_ONLY!", ARG_NONE, ARG_NONE), +/* 6_d */ /* PREFIX CHARACTERS */ OP_INFO_ENTRY (ACPI_OP_TYPE_PREFIX | OPTYPE_BOGUS| AML_HAS_ARGS, "PREFIX_ONLY!", ARG_NONE, ARG_NONE), }; -#define _UNK 0x6A -#define _UNKNOWN_OPCODE 0x02 /* An example unknown opcode */ - /* * This table is directly indexed by the opcodes, and returns an * index into the table above */ -u8 acpi_gbl_aml_op_info_index[256] = +u8 acpi_gbl_aml_short_op_info_index[256] = { /* 0 1 2 3 4 5 6 7 */ /* 0x00 */ 0x00, 0x01, _UNK, _UNK, _UNK, _UNK, 0x02, _UNK, /* 0x08 */ 0x03, _UNK, 0x04, 0x05, 0x06, 0x07, _UNK, _UNK, -/* 0x10 */ 0x08, 0x09, 0x0a, _UNK, 0x0b, _UNK, _UNK, 0x46, -/* 0x18 */ 0x47, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, +/* 0x10 */ 0x08, 0x09, 0x0a, _UNK, 0x0b, _UNK, _UNK, _UNK, +/* 0x18 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, /* 0x20 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, -/* 0x28 */ 0x48, 0x49, _UNK, _UNK, _UNK, 0x63, _UNK, _UNK, -/* 0x30 */ 0x67, 0x66, 0x68, 0x65, 0x69, 0x64, 0x4a, 0x4b, -/* 0x38 */ 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, -/* 0x40 */ 0x54, _UNK, _UNK, _UNK, _UNK, _UNK, 0x55, 0x56, -/* 0x48 */ 0x57, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, -/* 0x50 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, -/* 0x58 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, +/* 0x28 */ _UNK, _UNK, _UNK, _UNK, _UNK, 0x63, _PFX, _PFX, +/* 0x30 */ 0x67, 0x66, 0x68, 0x65, 0x69, 0x64, 0x6A, _UNK, +/* 0x38 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, +/* 0x40 */ _UNK, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, +/* 0x48 */ _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, +/* 0x50 */ _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, +/* 0x58 */ _ASC, _ASC, _ASC, _UNK, _PFX, _UNK, _PFX, _ASC, /* 0x60 */ 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, /* 0x68 */ 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, _UNK, /* 0x70 */ 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, /* 0x78 */ 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, /* 0x80 */ 0x2b, 0x2c, 0x2d, 0x2e, _UNK, _UNK, 0x2f, 0x30, /* 0x88 */ 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, _UNK, -/* 0x90 */ 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x58, 0x59, -/* 0x98 */ 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, _UNK, _UNK, +/* 0x90 */ 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, _UNK, _UNK, +/* 0x98 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, /* 0xA0 */ 0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43, 0x60, 0x61, /* 0xA8 */ 0x62, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, /* 0xB0 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, @@ -552,3 +575,32 @@ /* 0xF0 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, /* 0xF8 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, 0x45, }; + + +u8 acpi_gbl_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, +/* 0x08 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, +/* 0x10 */ _UNK, _UNK, 0x48, 0x49, _UNK, _UNK, _UNK, _UNK, +/* 0x18 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, +/* 0x20 */ 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51, +/* 0x28 */ 0x52, 0x53, 0x54, _UNK, _UNK, _UNK, _UNK, _UNK, +/* 0x30 */ 0x55, 0x56, 0x57, _UNK, _UNK, _UNK, _UNK, _UNK, +/* 0x38 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, +/* 0x40 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, +/* 0x48 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, +/* 0x50 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, +/* 0x58 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, +/* 0x60 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, +/* 0x68 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, +/* 0x70 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, +/* 0x78 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, +/* 0x80 */ 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, +}; + + +/* 0 1 2 3 4 5 6 7 */ +/* 0x00 */ + + diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/parser/psparse.c linux/drivers/acpi/parser/psparse.c --- v2.4.0-test8/linux/drivers/acpi/parser/psparse.c Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/parser/psparse.c Fri Sep 15 14:30:30 2000 @@ -1,6 +1,7 @@ /****************************************************************************** * * Module Name: psparse - Parser top level AML parse routines + * $Revision: 51 $ * *****************************************************************************/ @@ -33,14 +34,14 @@ */ #include "acpi.h" -#include "parser.h" -#include "dispatch.h" +#include "acparser.h" +#include "acdispat.h" #include "amlcode.h" -#include "namesp.h" -#include "debugger.h" +#include "acnamesp.h" +#include "acdebug.h" #define _COMPONENT PARSER - MODULE_NAME ("psparse"); + MODULE_NAME ("psparse") u32 acpi_gbl_depth = 0; @@ -65,11 +66,11 @@ ACPI_STATUS acpi_ps_delete_completed_op ( ACPI_WALK_STATE *state, - ACPI_GENERIC_OP *op) + ACPI_PARSE_OBJECT *op) { acpi_ps_free_op (op); - return AE_OK; + return (AE_OK); } @@ -78,7 +79,7 @@ * * FUNCTION: Acpi_ps_delete_parse_tree * - * PARAMETERS: Root - Root of tree (or subtree) to delete + * PARAMETERS: Subtree_root - Root of tree (or subtree) to delete * * RETURN: None * @@ -88,33 +89,54 @@ void acpi_ps_delete_parse_tree ( - ACPI_GENERIC_OP *root) + ACPI_PARSE_OBJECT *subtree_root) { - ACPI_GENERIC_OP *op; - ACPI_WALK_STATE walk_state; + ACPI_WALK_STATE *walk_state; + ACPI_WALK_LIST walk_list; - walk_state.origin = root; - op = root; + if (!subtree_root) { + return; + } - /* TBD: [Restructure] hack for root case */ + /* Create and initialize a new walk list */ - if (op == acpi_gbl_parsed_namespace_root) { - op = acpi_ps_get_child (op); + walk_list.walk_state = NULL; + walk_state = acpi_ds_create_walk_state (TABLE_ID_DSDT, NULL, NULL, &walk_list); + if (!walk_state) { + return; } - /* Save root until last, so that we know when the tree has been walked */ + walk_state->parser_state = NULL; + walk_state->parse_flags = 0; + walk_state->descending_callback = NULL; + walk_state->ascending_callback = NULL; + - walk_state.next_op = op; - walk_state.next_op_info = NEXT_OP_DOWNWARD; + walk_state->origin = subtree_root; + walk_state->next_op = subtree_root; - while (walk_state.next_op) { - acpi_ps_get_next_walk_op (&walk_state, walk_state.next_op, + + /* 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 @@ -135,12 +157,12 @@ /* Extended (2-byte) opcode if > 255 */ if (opcode > 0x00FF) { - return 2; + return (2); } /* Otherwise, just a single byte opcode */ - return 1; + return (1); } @@ -194,7 +216,7 @@ /* don't convert bare name to a namepath */ - return opcode; + return (opcode); } @@ -214,7 +236,7 @@ ACPI_PARSE_STATE * acpi_ps_create_state ( u8 *aml, - s32 aml_size) + u32 aml_size) { ACPI_PARSE_STATE *parser_state; @@ -257,88 +279,270 @@ ACPI_STATUS acpi_ps_find_object ( u16 opcode, - ACPI_PARSE_STATE *parser_state, + ACPI_PARSE_OBJECT *op, ACPI_WALK_STATE *walk_state, - ACPI_GENERIC_OP **op) + ACPI_PARSE_OBJECT **out_op) { - char *path; + NATIVE_CHAR *path; + /* We are only interested in opcodes that have an associated name */ + + if (!acpi_ps_is_named_op (opcode)) { + *out_op = op; + return (AE_OK); + } + /* Find the name in the parse tree */ - path = acpi_ps_get_next_namestring (parser_state); + path = acpi_ps_get_next_namestring (walk_state->parser_state); - *op = acpi_ps_find (acpi_ps_get_parent_scope (parser_state), + *out_op = acpi_ps_find (acpi_ps_get_parent_scope (walk_state->parser_state), path, opcode, 1); - if (!(*op)) { - return AE_NOT_FOUND; + if (!(*out_op)) { + return (AE_NOT_FOUND); } - return AE_OK; + return (AE_OK); } + +#endif + + +/******************************************************************************* + * + * FUNCTION: Acpi_ps_complete_this_op + * + * PARAMETERS: Walk_state - Current State + * Op - Op to complete + * + * RETURN: TRUE if Op and subtree was deleted + * + * DESCRIPTION: Perform any cleanup at the completion of an Op. + * + ******************************************************************************/ + +u8 +acpi_ps_complete_this_op ( + ACPI_WALK_STATE *walk_state, + ACPI_PARSE_OBJECT *op) +{ +#ifndef PARSER_ONLY + ACPI_PARSE_OBJECT *prev; + ACPI_PARSE_OBJECT *next; + ACPI_OPCODE_INFO *op_info; + ACPI_OPCODE_INFO *parent_info; + u32 opcode_class; + ACPI_PARSE_OBJECT *replacement_op = NULL; + + + op_info = acpi_ps_get_opcode_info (op->opcode); + opcode_class = ACPI_GET_OP_CLASS (op_info); + + + /* 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_LOCAL_VARIABLE) && + (opcode_class != OPTYPE_METHOD_ARGUMENT) && + (opcode_class != OPTYPE_DATA_TERM) && + (op->opcode != AML_NAMEPATH_OP)) + { + /* Make sure that we only delete this subtree */ + + if (op->parent) { + /* + * Check if we need to replace the operator and its subtree + * with a return value op + */ + + parent_info = acpi_ps_get_opcode_info (op->parent->opcode); + + switch (ACPI_GET_OP_CLASS (parent_info)) + { + case OPTYPE_CONTROL: /* IF, ELSE, WHILE only */ + case OPTYPE_NAMED_OBJECT: /* Scope, method, etc. */ + break; + + default: + replacement_op = acpi_ps_alloc_op (AML_RETURN_VALUE_OP); + if (!replacement_op) { + return (FALSE); + } + } + + /* We must unlink this op from the parent tree */ + + prev = op->parent->value.arg; + if (prev == op) { + /* This op is the first in the list */ + + if (replacement_op) { + replacement_op->parent = op->parent; + replacement_op->value.arg = NULL; + op->parent->value.arg = replacement_op; + replacement_op->next = op->next; + } + else { + op->parent->value.arg = op->next; + } + } + + /* Search the parent list */ + + else while (prev) { + /* Traverse all siblings in the parent's argument list */ + + next = prev->next; + if (next == op) { + if (replacement_op) { + replacement_op->parent = op->parent; + replacement_op->value.arg = NULL; + prev->next = replacement_op; + replacement_op->next = op->next; + next = NULL; + } + else { + prev->next = op->next; + next = NULL; + } + } + + prev = next; + } + + } + + /* Now we can actually delete the subtree rooted at op */ + + acpi_ps_delete_parse_tree (op); + + return (TRUE); + } + + return (FALSE); + #else + return (FALSE); +#endif +} + + +/******************************************************************************* + * + * FUNCTION: Acpi_ps_next_parse_state + * + * PARAMETERS: Parser_state - Current parser state object + * + * RETURN: + * + * DESCRIPTION: + * + ******************************************************************************/ + ACPI_STATUS -acpi_ps_find_object ( - u16 opcode, - ACPI_PARSE_STATE *parser_state, +acpi_ps_next_parse_state ( ACPI_WALK_STATE *walk_state, - ACPI_GENERIC_OP **out_op) + ACPI_PARSE_OBJECT *op, + ACPI_STATUS callback_status) { - char *path; - ACPI_GENERIC_OP *op; - OBJECT_TYPE_INTERNAL data_type; - ACPI_STATUS status; - ACPI_NAMED_OBJECT *entry = NULL; + ACPI_PARSE_STATE *parser_state = walk_state->parser_state; + ACPI_STATUS status = AE_CTRL_PENDING; - /* - * The full parse tree has already been deleted -- therefore, we are parsing - * a control method. We can lookup the name in the namespace instead of - * the parse tree! - */ + switch (callback_status) + { + case AE_CTRL_TERMINATE: + /* + * A control method was terminated via a RETURN statement. + * The walk of this method is complete. + */ - path = acpi_ps_get_next_namestring (parser_state); + parser_state->aml = parser_state->aml_end; + status = AE_CTRL_TERMINATE; + break; - /* Map the raw opcode into an internal object type */ - data_type = acpi_ds_map_named_opcode_to_data_type (opcode); + case AE_CTRL_PENDING: - /* - * Enter the object into the namespace - * LOAD_PASS1 means Create if not found - */ + /* + * 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. + */ +/* Walk_state->Control_state->Common.State = + CONTROL_PREDICATE_EXECUTING;*/ - status = acpi_ns_lookup (walk_state->scope_info, path, data_type, - IMODE_LOAD_PASS1, - NS_NO_UPSEARCH, walk_state, &entry); - if (ACPI_FAILURE (status)) { - return (status); - } + /* TBD: How to handle a break within a while. */ + /* This code attempts it */ - /* Create a new op */ + parser_state->aml = walk_state->aml_last_while; + break; - op = acpi_ps_alloc_op (opcode); - if (!op) { - return (AE_NO_MEMORY); - } - /* Initialize */ + case AE_CTRL_TRUE: + /* + * 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 + */ + parser_state->aml = (parser_state->aml + + acpi_ps_get_next_package_length (parser_state)) -1; + break; + - ((ACPI_NAMED_OP *)op)->name = entry->name; - op->acpi_named_object = entry; + 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. + */ - acpi_ps_append_arg (acpi_ps_get_parent_scope (parser_state), op); + parser_state->aml = parser_state->scope->parse_scope.pkg_end; - *out_op = op; + /* In the case of a BREAK, just force a predicate (if any) to FALSE */ + walk_state->control_state->common.value = FALSE; + status = AE_CTRL_END; + break; - return (AE_OK); + + case AE_CTRL_TRANSFER: + + /* + * A method call (invocation) -- transfer control + */ + status = AE_CTRL_TRANSFER; + walk_state->prev_op = op; + walk_state->method_call_op = op; + walk_state->method_call_node = (op->value.arg)->node; + + /* Will return value (if any) be used by the caller? */ + + walk_state->return_used = acpi_ds_is_result_used (op); + break; + + + default: + status = callback_status; + if ((callback_status & AE_CODE_MASK) == AE_CODE_CONTROL) { + status = AE_OK; + } + break; + } + + + return (status); } -#endif /******************************************************************************* @@ -356,26 +560,27 @@ ACPI_STATUS acpi_ps_parse_loop ( - ACPI_PARSE_STATE *parser_state, - ACPI_WALK_STATE *walk_state, - u32 parse_flags) + ACPI_WALK_STATE *walk_state) { ACPI_STATUS status = AE_OK; - ACPI_GENERIC_OP *op = NULL; /* current op */ - ACPI_OP_INFO *op_info; - ACPI_GENERIC_OP *arg = NULL; - ACPI_DEFERRED_OP *deferred_op; + ACPI_PARSE_OBJECT *op = NULL; /* current op */ + ACPI_OPCODE_INFO *op_info; + ACPI_PARSE_OBJECT *arg = NULL; + ACPI_PARSE2_OBJECT *deferred_op; u32 arg_count; /* push for fixed or var args */ u32 arg_types = 0; ACPI_PTRDIFF aml_offset; u16 opcode; - ACPI_GENERIC_OP pre_op; + ACPI_PARSE_OBJECT pre_op; + ACPI_PARSE_STATE *parser_state; -#ifndef PARSER_ONLY - OBJECT_TYPE_INTERNAL data_type; -#endif + parser_state = walk_state->parser_state; + if (walk_state->prev_op) { + op = walk_state->prev_op; + arg_types = walk_state->prev_arg_types; + } /* * Iterative parsing loop, while there is more aml to process: @@ -384,9 +589,8 @@ if (!op) { /* Get the next opcode from the AML stream */ - aml_offset = parser_state->aml - parser_state->aml_start; - opcode = acpi_ps_peek_opcode (parser_state); - op_info = acpi_ps_get_opcode_info (opcode); + aml_offset = parser_state->aml - parser_state->aml_start; + opcode = acpi_ps_peek_opcode (parser_state); /* * First cut to determine what we have found: @@ -395,16 +599,19 @@ * 3) An unknown/invalid opcode */ - if (op_info) { + op_info = acpi_ps_get_opcode_info (opcode); + switch (ACPI_GET_OP_TYPE (op_info)) + { + case ACPI_OP_TYPE_OPCODE: + /* Found opcode info, this is a normal opcode */ parser_state->aml += acpi_ps_get_opcode_size (opcode); arg_types = op_info->parse_args; - } + break; - else if (acpi_ps_is_prefix_char (opcode) || - acpi_ps_is_leading_char (opcode)) - { + case ACPI_OP_TYPE_ASCII: + case ACPI_OP_TYPE_PREFIX: /* * Starts with a valid prefix or ASCII char, this is a name * string. Convert the bare name string to a namepath. @@ -412,9 +619,10 @@ opcode = AML_NAMEPATH_OP; arg_types = ARGP_NAMESTRING; - } + break; + + case ACPI_OP_TYPE_UNKNOWN: - else { /* The opcode is unrecognized. Just skip unknown opcodes */ parser_state->aml += acpi_ps_get_opcode_size (opcode); @@ -441,9 +649,24 @@ INCREMENT_ARG_LIST (arg_types); - status = acpi_ps_find_object (opcode, parser_state, walk_state, &op); - if (ACPI_FAILURE (status)) { - return (AE_NOT_FOUND); + if (walk_state->descending_callback != NULL) { + /* + * Find the object. This will either insert the object into + * the namespace or simply look it up + */ + status = walk_state->descending_callback (opcode, NULL, walk_state, &op); + if (op == NULL) { + continue; + } + status = acpi_ps_next_parse_state (walk_state, op, status); + if (status == AE_CTRL_PENDING) { + status = AE_OK; + goto close_this_op; + } + + if (ACPI_FAILURE (status)) { + goto close_this_op; + } } acpi_ps_append_arg (op, pre_op.value.arg); @@ -451,7 +674,7 @@ if (op->opcode == AML_REGION_OP) { - deferred_op = acpi_ps_to_deferred_op (op); + deferred_op = acpi_ps_to_extended_op (op); if (deferred_op) { /* * Skip parsing of control method or opregion body, @@ -464,13 +687,15 @@ * Body_length is unknown until we parse the body */ - deferred_op->body = parser_state->aml - 6; - deferred_op->body_length = 0; + deferred_op->data = parser_state->aml - 6; + deferred_op->length = 0; } } } else { + + /* Not a named opcode, just allocate Op and append to parent */ op = acpi_ps_alloc_op (opcode); @@ -479,6 +704,23 @@ } acpi_ps_append_arg (acpi_ps_get_parent_scope (parser_state), op); + + if ((walk_state->descending_callback != NULL)) { + /* + * Find the object. This will either insert the object into + * the namespace or simply look it up + */ + status = walk_state->descending_callback (opcode, op, walk_state, &op); + status = acpi_ps_next_parse_state (walk_state, op, status); + if (status == AE_CTRL_PENDING) { + status = AE_OK; + goto close_this_op; + } + + if (ACPI_FAILURE (status)) { + goto close_this_op; + } + } } op->aml_offset = aml_offset; @@ -532,7 +774,7 @@ /* For a method, save the length and address of the body */ if (op->opcode == AML_METHOD_OP) { - deferred_op = acpi_ps_to_deferred_op (op); + deferred_op = acpi_ps_to_extended_op (op); if (deferred_op) { /* * Skip parsing of control method or opregion body, @@ -540,8 +782,8 @@ * to parse them correctly. */ - deferred_op->body = parser_state->aml; - deferred_op->body_length = parser_state->pkg_end - + deferred_op->data = parser_state->aml; + deferred_op->length = parser_state->pkg_end - parser_state->aml; /* @@ -549,8 +791,8 @@ * parsing because the opregion is not a standalone * package (We don't know where the end is). */ - parser_state->aml = parser_state->pkg_end; - arg_count = 0; + parser_state->aml = parser_state->pkg_end; + arg_count = 0; } } @@ -567,7 +809,7 @@ } if (op->opcode == AML_REGION_OP) { - deferred_op = acpi_ps_to_deferred_op (op); + deferred_op = acpi_ps_to_extended_op (op); if (deferred_op) { /* * Skip parsing of control method or opregion body, @@ -578,46 +820,75 @@ * know the length. */ - deferred_op->body_length = parser_state->aml - - deferred_op->body; + deferred_op->length = parser_state->aml - + deferred_op->data; } } + } -#ifndef PARSER_ONLY - data_type = acpi_ds_map_named_opcode_to_data_type (op->opcode); + /* This op complete, notify the dispatcher */ - if (op->opcode == AML_NAME_OP) { - if (op->value.arg) { - data_type = acpi_ds_map_opcode_to_data_type ( - (op->value.arg)->opcode, NULL); - ((ACPI_NAMED_OBJECT*)op->acpi_named_object)->type = - (u8) data_type; - } + if (walk_state->ascending_callback != NULL) { + status = walk_state->ascending_callback (walk_state, op); + status = acpi_ps_next_parse_state (walk_state, op, status); + if (status == AE_CTRL_PENDING) { + status = AE_OK; + goto close_this_op; } + } - /* Pop the scope stack */ - if (acpi_ns_opens_scope (data_type)) { +close_this_op: - acpi_ds_scope_stack_pop (walk_state); - } -#endif + parser_state->scope->parse_scope.arg_count--; + + /* Close this Op (may result in parse subtree deletion) */ + + if (acpi_ps_complete_this_op (walk_state, op)) { + op = NULL; + } + + + if (status == AE_CTRL_END) { + acpi_ps_pop_scope (parser_state, &op, &arg_types); + 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; } + else if (ACPI_FAILURE (status)) { + if (op == NULL) { + acpi_ps_pop_scope (parser_state, &op, &arg_types); + } + walk_state->prev_op = op; + walk_state->prev_arg_types = arg_types; - parser_state->scope->arg_count--; + /* + * TEMP: + */ + if (status == AE_CTRL_TERMINATE) { + status = AE_OK; - /* Delete op if asked to */ + /* Clean up */ + do + { + if (op) { + acpi_ps_complete_this_op (walk_state, op); + } -#ifndef PARSER_ONLY - if (parse_flags & PARSE_DELETE_TREE) { - acpi_ps_delete_parse_tree (op); + acpi_ps_pop_scope (parser_state, &op, &arg_types); + } while (op); + } + return (status); } -#endif + /* This scope complete? */ + if (acpi_ps_has_completed_scope (parser_state)) { acpi_ps_pop_scope (parser_state, &op, &arg_types); } @@ -625,6 +896,7 @@ else { op = NULL; } + } else { @@ -637,6 +909,54 @@ } /* while Parser_state->Aml */ + /* + * Complete the last Op (if not completed), and clear the scope stack. + * It is easily possible to end an AML "package" with an unbounded number + * of open scopes (such as when several AML blocks are closed with + * sequential closing braces). We want to terminate each one cleanly. + */ + + do + { + if (op) { + if (walk_state->ascending_callback != NULL) { + status = walk_state->ascending_callback (walk_state, op); + status = acpi_ps_next_parse_state (walk_state, op, status); + if (status == AE_CTRL_PENDING) { + status = AE_OK; + goto close_this_op; + } + + 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); + } + + else if (ACPI_FAILURE (status)) { + acpi_ps_complete_this_op (walk_state, op); + return (status); + } + } + + acpi_ps_complete_this_op (walk_state, op); + } + + acpi_ps_pop_scope (parser_state, &op, &arg_types); + + } while (op); + return (status); } @@ -658,19 +978,28 @@ ACPI_STATUS acpi_ps_parse_aml ( - ACPI_GENERIC_OP *start_scope, + ACPI_PARSE_OBJECT *start_scope, u8 *aml, u32 aml_size, - u32 parse_flags) + u32 parse_flags, + ACPI_NAMESPACE_NODE *method_node, + ACPI_OPERAND_OBJECT **params, + ACPI_OPERAND_OBJECT **caller_return_desc, + ACPI_PARSE_DOWNWARDS descending_callback, + ACPI_PARSE_UPWARDS ascending_callback) { ACPI_STATUS status; ACPI_PARSE_STATE *parser_state; ACPI_WALK_STATE *walk_state; ACPI_WALK_LIST walk_list; - ACPI_NAMED_OBJECT *entry = NULL; + ACPI_NAMESPACE_NODE *node = NULL; + ACPI_WALK_LIST *prev_walk_list = acpi_gbl_current_walk_list; + ACPI_OPERAND_OBJECT *return_desc; + ACPI_OPERAND_OBJECT *mth_desc = NULL; + ACPI_NAMESPACE_NODE *start_node; - /* Initialize parser state and scope */ + /* Create and initialize a new parser state */ parser_state = acpi_ps_create_state (aml, aml_size); if (!parser_state) { @@ -679,36 +1008,166 @@ acpi_ps_init_scope (parser_state, start_scope); + if (method_node) { + mth_desc = acpi_ns_get_attached_object (method_node); + } - /* Initialize a new walk list */ + /* 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); + walk_state = acpi_ds_create_walk_state (TABLE_ID_DSDT, parser_state->start_op, mth_desc, &walk_list); if (!walk_state) { status = AE_NO_MEMORY; goto cleanup; } + walk_state->method_node = method_node; + walk_state->parser_state = parser_state; + walk_state->parse_flags = parse_flags; + walk_state->descending_callback = descending_callback; + walk_state->ascending_callback = ascending_callback; + + /* TBD: [Restructure] TEMP until we pass Walk_state to the interpreter + */ + acpi_gbl_current_walk_list = &walk_list; + - /* Setup the current scope */ + if (method_node) { + start_node = method_node; + parser_state->start_node = method_node; + walk_state->walk_type = WALK_METHOD; - entry = parser_state->start_op->acpi_named_object; - if (entry) { - /* Push start scope on scope stack and make it current */ + 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); + } - status = acpi_ds_scope_stack_push (entry->child_table, entry->type, - walk_state); - if (ACPI_FAILURE (status)) { - goto cleanup; } + /* Init arguments if this is a control method */ + /* TBD: [Restructure] add walkstate as a param */ + acpi_ds_method_data_init_args (params, MTH_NUM_ARGS, walk_state); } + else { + /* Setup the current scope */ - /* Create the parse tree */ + node = parser_state->start_op->node; + if (node) { + /* Push start scope on scope stack and make it current */ + + status = acpi_ds_scope_stack_push (node, node->type, + walk_state); + if (ACPI_FAILURE (status)) { + goto cleanup; + } + + } + } - status = acpi_ps_parse_loop (parser_state, walk_state, parse_flags); + + status = AE_OK; + + /* + * Execute the walk loop as long as there is a valid Walk State. This + * handles nested control method invocations without recursion. + */ + + while (walk_state) { + if (ACPI_SUCCESS (status)) { + status = acpi_ps_parse_loop (walk_state); + } + + if (status == AE_CTRL_TRANSFER) { + /* + * A method call was detected. + * Transfer control to the called control method + */ + + status = acpi_ds_call_control_method (&walk_list, walk_state, NULL); + + /* + * 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); + continue; + } + + else if (status == AE_CTRL_TERMINATE) { + status = AE_OK; + } + + /* We are done with this walk, move on to the parent if any */ + + + 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 + */ + + if ((walk_state->parse_flags & ACPI_PARSE_MODE_MASK) == ACPI_PARSE_EXECUTE) { + acpi_ds_terminate_control_method (walk_state); + } + + /* Delete this walk state and all linked control states */ + + acpi_ps_cleanup_scope (walk_state->parser_state); + acpi_cm_free (walk_state->parser_state); + acpi_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); + } + + /* + * 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); + } + } + + + /* Normal exit */ + + acpi_gbl_current_walk_list = prev_walk_list; + return (status); cleanup: @@ -719,6 +1178,7 @@ acpi_ps_cleanup_scope (parser_state); acpi_cm_free (parser_state); + acpi_gbl_current_walk_list = prev_walk_list; return (status); } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/parser/psscope.c linux/drivers/acpi/parser/psscope.c --- v2.4.0-test8/linux/drivers/acpi/parser/psscope.c Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/parser/psscope.c Fri Sep 15 14:30:30 2000 @@ -1,6 +1,7 @@ /****************************************************************************** * * Module Name: psscope - Parser scope stack management routines + * $Revision: 18 $ * *****************************************************************************/ @@ -24,10 +25,10 @@ #include "acpi.h" -#include "parser.h" +#include "acparser.h" #define _COMPONENT PARSER - MODULE_NAME ("psscope"); + MODULE_NAME ("psscope") /******************************************************************************* @@ -42,11 +43,11 @@ * ******************************************************************************/ -ACPI_GENERIC_OP * +ACPI_PARSE_OBJECT * acpi_ps_get_parent_scope ( ACPI_PARSE_STATE *parser_state) { - return parser_state->scope->op; + return (parser_state->scope->parse_scope.op); } @@ -68,8 +69,8 @@ acpi_ps_has_completed_scope ( ACPI_PARSE_STATE *parser_state) { - return (u8) ((parser_state->aml >= parser_state->scope->arg_end || - !parser_state->scope->arg_count)); + return ((u8) ((parser_state->aml >= parser_state->scope->parse_scope.arg_end || + !parser_state->scope->parse_scope.arg_count))); } @@ -78,7 +79,7 @@ * FUNCTION: Acpi_ps_init_scope * * PARAMETERS: Parser_state - Current parser state object - * Root - the root object of this new scope + * Root - the Root Node of this new scope * * RETURN: Status * @@ -89,24 +90,25 @@ ACPI_STATUS acpi_ps_init_scope ( ACPI_PARSE_STATE *parser_state, - ACPI_GENERIC_OP *root) + ACPI_PARSE_OBJECT *root_op) { - ACPI_PARSE_SCOPE *scope; + ACPI_GENERIC_STATE *scope; - scope = acpi_cm_callocate (sizeof (ACPI_PARSE_SCOPE)); + scope = acpi_cm_create_generic_state (); if (!scope) { - return AE_NO_MEMORY; + return (AE_NO_MEMORY); } - scope->op = root; - scope->arg_count = ACPI_VAR_ARGS; - scope->arg_end = parser_state->aml_end; - scope->pkg_end = parser_state->aml_end; - parser_state->scope = scope; - parser_state->start_op = root; + scope->parse_scope.op = root_op; + scope->parse_scope.arg_count = ACPI_VAR_ARGS; + scope->parse_scope.arg_end = parser_state->aml_end; + scope->parse_scope.pkg_end = parser_state->aml_end; - return AE_OK; + parser_state->scope = scope; + parser_state->start_op = root_op; + + return (AE_OK); } @@ -128,49 +130,39 @@ ACPI_STATUS acpi_ps_push_scope ( ACPI_PARSE_STATE *parser_state, - ACPI_GENERIC_OP *op, + ACPI_PARSE_OBJECT *op, u32 remaining_args, u32 arg_count) { - ACPI_PARSE_SCOPE *scope = parser_state->scope_avail; - + ACPI_GENERIC_STATE *scope; - if (scope) { - /* grabbed scope from available list */ - parser_state->scope_avail = scope->parent; + scope = acpi_cm_create_generic_state (); + if (!scope) { + return (AE_NO_MEMORY); } - else { - /* allocate scope from the heap */ - scope = (ACPI_PARSE_SCOPE*) acpi_cm_allocate (sizeof (ACPI_PARSE_SCOPE)); - if (!scope) { - return (AE_NO_MEMORY); - } - } + scope->parse_scope.op = op; + scope->parse_scope.arg_list = remaining_args; + scope->parse_scope.arg_count = arg_count; + scope->parse_scope.pkg_end = parser_state->pkg_end; - /* Always zero out the scope before init */ + /* Push onto scope stack */ - MEMSET (scope, 0, sizeof (*scope)); + acpi_cm_push_generic_state (&parser_state->scope, scope); - scope->op = op; - scope->arg_list = remaining_args; - scope->arg_count = arg_count; - scope->pkg_end = parser_state->pkg_end; - scope->parent = parser_state->scope; - parser_state->scope = scope; if (arg_count == ACPI_VAR_ARGS) { /* multiple arguments */ - scope->arg_end = parser_state->pkg_end; + scope->parse_scope.arg_end = parser_state->pkg_end; } else { /* single argument */ - scope->arg_end = ACPI_MAX_AML; + scope->parse_scope.arg_end = ACPI_MAX_AML; } return (AE_OK); @@ -195,24 +187,28 @@ void acpi_ps_pop_scope ( ACPI_PARSE_STATE *parser_state, - ACPI_GENERIC_OP **op, + ACPI_PARSE_OBJECT **op, u32 *arg_list) { - ACPI_PARSE_SCOPE *scope = parser_state->scope; + ACPI_GENERIC_STATE *scope = parser_state->scope; + + + /* + * Only pop the scope if there is in fact a next scope + */ + if (scope->common.next) { + scope = acpi_cm_pop_generic_state (&parser_state->scope); - if (scope->parent) { /* return to parsing previous op */ - *op = scope->op; - *arg_list = scope->arg_list; - parser_state->pkg_end = scope->pkg_end; - parser_state->scope = scope->parent; + *op = scope->parse_scope.op; + *arg_list = scope->parse_scope.arg_list; + parser_state->pkg_end = scope->parse_scope.pkg_end; - /* add scope to available list */ + /* All done with this scope state structure */ - scope->parent = parser_state->scope_avail; - parser_state->scope_avail = scope; + acpi_cm_delete_generic_state (scope); } else { @@ -222,6 +218,7 @@ *arg_list = 0; } + return; } @@ -243,27 +240,19 @@ acpi_ps_cleanup_scope ( ACPI_PARSE_STATE *parser_state) { - ACPI_PARSE_SCOPE *scope; + ACPI_GENERIC_STATE *scope; if (!parser_state) { return; } - /* destroy available list */ - - while (parser_state->scope_avail) { - scope = parser_state->scope_avail; - parser_state->scope_avail = scope->parent; - acpi_cm_free (scope); - } - /* destroy scope stack */ + /* Delete anything on the scope stack */ while (parser_state->scope) { - scope = parser_state->scope; - parser_state->scope = scope->parent; - acpi_cm_free (scope); + scope = acpi_cm_pop_generic_state (&parser_state->scope); + acpi_cm_delete_generic_state (scope); } return; diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/parser/pstree.c linux/drivers/acpi/parser/pstree.c --- v2.4.0-test8/linux/drivers/acpi/parser/pstree.c Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/parser/pstree.c Fri Sep 15 14:30:30 2000 @@ -1,6 +1,7 @@ /****************************************************************************** * * Module Name: pstree - Parser op tree manipulation/traversal/search + * $Revision: 23 $ * *****************************************************************************/ @@ -24,11 +25,11 @@ #include "acpi.h" -#include "parser.h" +#include "acparser.h" #include "amlcode.h" #define _COMPONENT PARSER - MODULE_NAME ("pstree"); + MODULE_NAME ("pstree") /******************************************************************************* @@ -44,30 +45,30 @@ * ******************************************************************************/ -ACPI_GENERIC_OP * +ACPI_PARSE_OBJECT * acpi_ps_get_arg ( - ACPI_GENERIC_OP *op, + ACPI_PARSE_OBJECT *op, u32 argn) { - ACPI_GENERIC_OP *arg = NULL; - ACPI_OP_INFO *op_info; + ACPI_PARSE_OBJECT *arg = NULL; + ACPI_OPCODE_INFO *op_info; /* Get the info structure for this opcode */ op_info = acpi_ps_get_opcode_info (op->opcode); - if (!op_info) { - /* Invalid opcode */ + if (ACPI_GET_OP_TYPE (op_info) != ACPI_OP_TYPE_OPCODE) { + /* Invalid opcode or ASCII character */ - return NULL; + return (NULL); } /* Check if this opcode requires argument sub-objects */ - if (!(op_info->flags & OP_INFO_HAS_ARGS)) { + if (!(ACPI_GET_OP_ARGS (op_info))) { /* Has no linked argument objects */ - return NULL; + return (NULL); } /* Get the requested argument object */ @@ -78,7 +79,7 @@ arg = arg->next; } - return arg; + return (arg); } @@ -97,11 +98,11 @@ void acpi_ps_append_arg ( - ACPI_GENERIC_OP *op, - ACPI_GENERIC_OP *arg) + ACPI_PARSE_OBJECT *op, + ACPI_PARSE_OBJECT *arg) { - ACPI_GENERIC_OP *prev_arg; - ACPI_OP_INFO *op_info; + ACPI_PARSE_OBJECT *prev_arg; + ACPI_OPCODE_INFO *op_info; if (!op) { @@ -111,7 +112,7 @@ /* Get the info structure for this opcode */ op_info = acpi_ps_get_opcode_info (op->opcode); - if (!op_info) { + if (ACPI_GET_OP_TYPE (op_info) != ACPI_OP_TYPE_OPCODE) { /* Invalid opcode */ return; @@ -119,7 +120,7 @@ /* Check if this opcode requires argument sub-objects */ - if (!(op_info->flags & OP_INFO_HAS_ARGS)) { + if (!(ACPI_GET_OP_ARGS (op_info))) { /* Has no linked argument objects */ return; @@ -166,11 +167,11 @@ * ******************************************************************************/ -ACPI_GENERIC_OP * +ACPI_PARSE_OBJECT * acpi_ps_get_child ( - ACPI_GENERIC_OP *op) + ACPI_PARSE_OBJECT *op) { - ACPI_GENERIC_OP *child = NULL; + ACPI_PARSE_OBJECT *child = NULL; switch (op->opcode) @@ -211,7 +212,7 @@ } - return child; + return (child); } @@ -229,32 +230,32 @@ * ******************************************************************************/ -ACPI_GENERIC_OP * +ACPI_PARSE_OBJECT * acpi_ps_get_depth_next ( - ACPI_GENERIC_OP *origin, - ACPI_GENERIC_OP *op) + ACPI_PARSE_OBJECT *origin, + ACPI_PARSE_OBJECT *op) { - ACPI_GENERIC_OP *next = NULL; - ACPI_GENERIC_OP *parent; - ACPI_GENERIC_OP *arg; + ACPI_PARSE_OBJECT *next = NULL; + ACPI_PARSE_OBJECT *parent; + ACPI_PARSE_OBJECT *arg; if (!op) { - return NULL; + return (NULL); } /* look for an argument or child */ next = acpi_ps_get_arg (op, 0); if (next) { - return next; + return (next); } /* look for a sibling */ next = op->next; if (next) { - return next; + return (next); } /* look for a sibling of parent */ @@ -270,19 +271,19 @@ if (arg == origin) { /* reached parent of origin, end search */ - return NULL; + return (NULL); } if (parent->next) { /* found sibling of parent */ - return parent->next; + return (parent->next); } op = parent; parent = parent->parent; } - return next; + return (next); } @@ -300,10 +301,10 @@ * ******************************************************************************/ -ACPI_GENERIC_OP * +ACPI_PARSE_OBJECT * acpi_ps_fetch_prefix ( - ACPI_GENERIC_OP *scope, - char **path, + ACPI_PARSE_OBJECT *scope, + NATIVE_CHAR **path, u32 io) { u32 prefix = io ? GET8 (*path):**path; @@ -338,7 +339,7 @@ scope = acpi_ps_get_child (scope); } - return scope; + return (scope); } @@ -349,7 +350,7 @@ * PARAMETERS: Path - A string containing the name segment * io - Direction flag * - * RETURN: The 4-char ASCII ACPI Name as a u32 + * RETURN: The 4-s8 ASCII ACPI Name as a u32 * * DESCRIPTION: Fetch ACPI name segment (dot-delimited) * @@ -357,13 +358,13 @@ u32 acpi_ps_fetch_name ( - char **path, + NATIVE_CHAR **path, u32 io) { u32 name = 0; - char *nm; + NATIVE_CHAR *nm; u32 i; - char ch; + NATIVE_CHAR ch; if (io) { @@ -378,7 +379,7 @@ *path += 1; } - nm = (char*) &name; + nm = (NATIVE_CHAR *) &name; for (i = 0; i < 4; i++) { ch = **path; if (ch && ch != '.') { @@ -393,7 +394,7 @@ } } - return name; + return (name); } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/parser/psutils.c linux/drivers/acpi/parser/psutils.c --- v2.4.0-test8/linux/drivers/acpi/parser/psutils.c Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/parser/psutils.c Fri Sep 15 14:30:30 2000 @@ -1,6 +1,7 @@ /****************************************************************************** * * Module Name: psutils - Parser miscellaneous utilities (Parser only) + * $Revision: 29 $ * *****************************************************************************/ @@ -24,17 +25,18 @@ #include "acpi.h" -#include "parser.h" +#include "acparser.h" #include "amlcode.h" #define _COMPONENT PARSER - MODULE_NAME ("psutils"); + MODULE_NAME ("psutils") -#define PARSEOP_GENERIC 1 -#define PARSEOP_NAMED 2 -#define PARSEOP_DEFERRED 3 -#define PARSEOP_BYTELIST 4 +#define PARSEOP_GENERIC 0x01 +#define PARSEOP_NAMED 0x02 +#define PARSEOP_DEFERRED 0x03 +#define PARSEOP_BYTELIST 0x04 +#define PARSEOP_IN_CACHE 0x80 /******************************************************************************* @@ -53,21 +55,19 @@ void acpi_ps_init_op ( - ACPI_GENERIC_OP *op, + ACPI_PARSE_OBJECT *op, u16 opcode) { - ACPI_OP_INFO *aml_op; + ACPI_OPCODE_INFO *aml_op; op->data_type = ACPI_DESC_TYPE_PARSER; op->opcode = opcode; - aml_op = acpi_ps_get_opcode_info (opcode); - if (aml_op) { - DEBUG_ONLY_MEMBERS (STRNCPY (op->op_name, aml_op->name, - sizeof (op->op_name))); - } + + DEBUG_ONLY_MEMBERS (STRNCPY (op->op_name, aml_op->name, + sizeof (op->op_name))); } @@ -85,11 +85,11 @@ * ******************************************************************************/ -ACPI_GENERIC_OP* +ACPI_PARSE_OBJECT* acpi_ps_alloc_op ( u16 opcode) { - ACPI_GENERIC_OP *op = NULL; + ACPI_PARSE_OBJECT *op = NULL; u32 size; u8 flags; @@ -97,24 +97,27 @@ /* Allocate the minimum required size object */ if (acpi_ps_is_deferred_op (opcode)) { - size = sizeof (ACPI_DEFERRED_OP); + size = sizeof (ACPI_PARSE2_OBJECT); flags = PARSEOP_DEFERRED; } else if (acpi_ps_is_named_op (opcode)) { - size = sizeof (ACPI_NAMED_OP); + size = sizeof (ACPI_PARSE2_OBJECT); flags = PARSEOP_NAMED; } else if (acpi_ps_is_bytelist_op (opcode)) { - size = sizeof (ACPI_BYTELIST_OP); + size = sizeof (ACPI_PARSE2_OBJECT); flags = PARSEOP_BYTELIST; } else { - size = sizeof (ACPI_GENERIC_OP); + size = sizeof (ACPI_PARSE_OBJECT); flags = PARSEOP_GENERIC; + } + + if (size == sizeof (ACPI_PARSE_OBJECT)) { /* * The generic op is by far the most common (16 to 1), and therefore * the op cache is implemented with this type. @@ -133,13 +136,44 @@ op = acpi_gbl_parse_cache; acpi_gbl_parse_cache = op->next; + + /* Clear the previously used Op */ + + MEMSET (op, 0, sizeof (ACPI_PARSE_OBJECT)); + + } + acpi_cm_release_mutex (ACPI_MTX_CACHES); + } + + else { + /* + * The generic op is by far the most common (16 to 1), and therefore + * the op cache is implemented with this type. + * + * Check if there is an Op already available in the cache + */ + + acpi_cm_acquire_mutex (ACPI_MTX_CACHES); + acpi_gbl_ext_parse_cache_requests++; + if (acpi_gbl_ext_parse_cache) { + /* Extract an op from the front of the cache list */ + + acpi_gbl_ext_parse_cache_depth--; + acpi_gbl_ext_parse_cache_hits++; + + op = (ACPI_PARSE_OBJECT *) acpi_gbl_ext_parse_cache; + acpi_gbl_ext_parse_cache = (ACPI_PARSE2_OBJECT *) op->next; + + /* Clear the previously used Op */ - MEMSET (op, 0, sizeof (ACPI_GENERIC_OP)); + MEMSET (op, 0, sizeof (ACPI_PARSE2_OBJECT)); + } acpi_cm_release_mutex (ACPI_MTX_CACHES); } + /* Allocate a new Op if necessary */ if (!op) { @@ -152,7 +186,7 @@ op->flags = flags; } - return op; + return (op); } @@ -171,16 +205,22 @@ void acpi_ps_free_op ( - ACPI_GENERIC_OP *op) + ACPI_PARSE_OBJECT *op) { + if (op->flags == PARSEOP_GENERIC) { /* Is the cache full? */ if (acpi_gbl_parse_cache_depth < MAX_PARSE_CACHE_DEPTH) { /* Put a GENERIC_OP back into the cache */ + /* Clear the previously used Op */ + + MEMSET (op, 0, sizeof (ACPI_PARSE_OBJECT)); + op->flags = PARSEOP_IN_CACHE; + acpi_cm_acquire_mutex (ACPI_MTX_CACHES); acpi_gbl_parse_cache_depth++; @@ -192,6 +232,29 @@ } } + else { + /* Is the cache full? */ + + if (acpi_gbl_ext_parse_cache_depth < MAX_EXTPARSE_CACHE_DEPTH) { + /* Put a GENERIC_OP back into the cache */ + + /* Clear the previously used Op */ + + MEMSET (op, 0, sizeof (ACPI_PARSE2_OBJECT)); + op->flags = PARSEOP_IN_CACHE; + + acpi_cm_acquire_mutex (ACPI_MTX_CACHES); + acpi_gbl_ext_parse_cache_depth++; + + op->next = (ACPI_PARSE_OBJECT *) acpi_gbl_ext_parse_cache; + acpi_gbl_ext_parse_cache = (ACPI_PARSE2_OBJECT *) op; + + acpi_cm_release_mutex (ACPI_MTX_CACHES); + return; + } + } + + /* * Not a GENERIC OP, or the cache is full, just free the Op */ @@ -216,7 +279,7 @@ acpi_ps_delete_parse_cache ( void) { - ACPI_GENERIC_OP *next; + ACPI_PARSE_OBJECT *next; /* Traverse the global cache list */ @@ -227,6 +290,18 @@ next = acpi_gbl_parse_cache->next; acpi_cm_free (acpi_gbl_parse_cache); acpi_gbl_parse_cache = next; + acpi_gbl_parse_cache_depth--; + } + + /* Traverse the global cache list */ + + while (acpi_gbl_ext_parse_cache) { + /* Delete one cached state object */ + + next = acpi_gbl_ext_parse_cache->next; + acpi_cm_free (acpi_gbl_ext_parse_cache); + acpi_gbl_ext_parse_cache = (ACPI_PARSE2_OBJECT *) next; + acpi_gbl_ext_parse_cache_depth--; } return; @@ -253,7 +328,7 @@ u8 acpi_ps_is_leading_char ( - s32 c) + u32 c) { return ((u8) (c == '_' || (c >= 'A' && c <= 'Z'))); } @@ -264,7 +339,7 @@ */ u8 acpi_ps_is_prefix_char ( - s32 c) + u32 c) { return ((u8) (c == '\\' || c == '^')); } @@ -329,7 +404,7 @@ * TBD: [Restructure] Need a better way than this brute force approach! */ u8 -acpi_ps_is_named_object_op ( +acpi_ps_is_node_op ( u16 opcode) { return ((u8) @@ -433,38 +508,16 @@ /* - * Cast an acpi_op to an acpi_deferred_op if possible - */ -ACPI_DEFERRED_OP * -acpi_ps_to_deferred_op ( - ACPI_GENERIC_OP *op) -{ - return (acpi_ps_is_deferred_op (op->opcode) - ? ( (ACPI_DEFERRED_OP *) op) : NULL); -} - - -/* - * Cast an acpi_op to an acpi_named_op if possible + * Cast an acpi_op to an acpi_extended_op if possible */ -ACPI_NAMED_OP* -acpi_ps_to_named_op ( - ACPI_GENERIC_OP *op) -{ - return (acpi_ps_is_named_op (op->opcode) - ? ( (ACPI_NAMED_OP *) op) : NULL); -} - -/* - * Cast an acpi_op to an acpi_bytelist_op if possible - */ -ACPI_BYTELIST_OP* -acpi_ps_to_bytelist_op ( - ACPI_GENERIC_OP *op) +/* TBD: This is very inefficient, fix */ +ACPI_PARSE2_OBJECT * +acpi_ps_to_extended_op ( + ACPI_PARSE_OBJECT *op) { - return (acpi_ps_is_bytelist_op (op->opcode) - ? ( (ACPI_BYTELIST_OP*) op) : NULL); + return ((acpi_ps_is_deferred_op (op->opcode) || acpi_ps_is_named_op (op->opcode) || acpi_ps_is_bytelist_op (op->opcode)) + ? ( (ACPI_PARSE2_OBJECT *) op) : NULL); } @@ -473,9 +526,9 @@ */ u32 acpi_ps_get_name ( - ACPI_GENERIC_OP *op) + ACPI_PARSE_OBJECT *op) { - ACPI_NAMED_OP *named = acpi_ps_to_named_op (op); + ACPI_PARSE2_OBJECT *named = acpi_ps_to_extended_op (op); return (named ? named->name : 0); } @@ -486,10 +539,10 @@ */ void acpi_ps_set_name ( - ACPI_GENERIC_OP *op, + ACPI_PARSE_OBJECT *op, u32 name) { - ACPI_NAMED_OP *named = acpi_ps_to_named_op (op); + ACPI_PARSE2_OBJECT *named = acpi_ps_to_extended_op (op); if (named) { named->name = name; diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/parser/pswalk.c linux/drivers/acpi/parser/pswalk.c --- v2.4.0-test8/linux/drivers/acpi/parser/pswalk.c Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/parser/pswalk.c Fri Sep 15 14:30:30 2000 @@ -1,6 +1,7 @@ /****************************************************************************** * * Module Name: pswalk - Parser routines to walk parsed op tree(s) + * $Revision: 45 $ * *****************************************************************************/ @@ -25,13 +26,13 @@ #include "acpi.h" #include "amlcode.h" -#include "parser.h" -#include "dispatch.h" -#include "namesp.h" -#include "interp.h" +#include "acparser.h" +#include "acdispat.h" +#include "acnamesp.h" +#include "acinterp.h" #define _COMPONENT PARSER - MODULE_NAME ("pswalk"); + MODULE_NAME ("pswalk") /******************************************************************************* @@ -53,12 +54,12 @@ ACPI_STATUS acpi_ps_get_next_walk_op ( ACPI_WALK_STATE *walk_state, - ACPI_GENERIC_OP *op, - INTERPRETER_CALLBACK ascending_callback) + ACPI_PARSE_OBJECT *op, + ACPI_PARSE_UPWARDS ascending_callback) { - ACPI_GENERIC_OP *next; - ACPI_GENERIC_OP *parent; - ACPI_GENERIC_OP *grand_parent; + ACPI_PARSE_OBJECT *next; + ACPI_PARSE_OBJECT *parent; + ACPI_PARSE_OBJECT *grand_parent; ACPI_STATUS status; @@ -146,6 +147,18 @@ 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. */ @@ -166,7 +179,7 @@ * No sibling, but check status. * Abort on error from callback routine */ - if (status != AE_OK) { + if (ACPI_FAILURE (status)) { /* Next op will be the parent */ walk_state->prev_op = op; @@ -302,7 +315,7 @@ * No sibling, check for an error from closing the parent * (Also, AE_PENDING if a method call was encountered) */ - if (status != AE_OK) { + if (ACPI_FAILURE (status)) { walk_state->prev_op = parent; walk_state->next_op = grand_parent; walk_state->next_op_info = NEXT_OP_UPWARD; @@ -347,13 +360,13 @@ ACPI_STATUS acpi_ps_walk_loop ( ACPI_WALK_LIST *walk_list, - ACPI_GENERIC_OP *start_op, - INTERPRETER_CALLBACK descending_callback, - INTERPRETER_CALLBACK ascending_callback) + ACPI_PARSE_OBJECT *start_op, + ACPI_PARSE_DOWNWARDS descending_callback, + ACPI_PARSE_UPWARDS ascending_callback) { ACPI_STATUS status = AE_OK; ACPI_WALK_STATE *walk_state; - ACPI_GENERIC_OP *op = start_op; + ACPI_PARSE_OBJECT *op = start_op; walk_state = acpi_ds_get_current_walk_state (walk_list); @@ -363,7 +376,7 @@ while (op) { if (walk_state->next_op_info != NEXT_OP_UPWARD) { - status = descending_callback (walk_state, op); + status = descending_callback (op->opcode, op, walk_state, NULL); } /* @@ -437,19 +450,19 @@ ACPI_STATUS acpi_ps_walk_parsed_aml ( - ACPI_GENERIC_OP *start_op, - ACPI_GENERIC_OP *end_op, - ACPI_OBJECT_INTERNAL *mth_desc, - ACPI_NAME_TABLE *start_scope, - ACPI_OBJECT_INTERNAL **params, - ACPI_OBJECT_INTERNAL **caller_return_desc, + 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, - INTERPRETER_CALLBACK descending_callback, - INTERPRETER_CALLBACK ascending_callback) + ACPI_PARSE_DOWNWARDS descending_callback, + ACPI_PARSE_UPWARDS ascending_callback) { - ACPI_GENERIC_OP *op; + ACPI_PARSE_OBJECT *op; ACPI_WALK_STATE *walk_state; - ACPI_OBJECT_INTERNAL *return_desc; + ACPI_OPERAND_OBJECT *return_desc; ACPI_STATUS status; ACPI_WALK_LIST walk_list; ACPI_WALK_LIST *prev_walk_list; @@ -458,7 +471,7 @@ /* Parameter Validation */ if (!start_op || !end_op) { - return AE_BAD_PARAMETER; + return (AE_BAD_PARAMETER); } /* Initialize a new walk list */ @@ -475,10 +488,10 @@ prev_walk_list = acpi_gbl_current_walk_list; acpi_gbl_current_walk_list = &walk_list; - if (start_scope) { + if (start_node) { /* Push start scope on scope stack and make it current */ - status = acpi_ds_scope_stack_push (start_scope, ACPI_TYPE_METHOD, walk_state); + status = acpi_ds_scope_stack_push (start_node, ACPI_TYPE_METHOD, walk_state); if (ACPI_FAILURE (status)) { return (status); } @@ -489,7 +502,7 @@ /* Init arguments if this is a control method */ /* TBD: [Restructure] add walkstate as a param */ - acpi_ds_method_data_init_args (params, MTH_NUM_ARGS); + acpi_ds_method_data_init_args (params, MTH_NUM_ARGS, walk_state); } op = start_op; @@ -502,7 +515,7 @@ */ while (walk_state) { - if (status == AE_OK) { + if (ACPI_SUCCESS (status)) { status = acpi_ps_walk_loop (&walk_list, op, descending_callback, ascending_callback); } @@ -526,9 +539,7 @@ * there's lots of cleanup to do */ - if (walk_state->method_desc && - walk_state->method_desc->method.parser_op) - { + if (walk_state->method_desc) { acpi_ds_terminate_control_method (walk_state); } @@ -540,7 +551,7 @@ walk_state = acpi_ds_get_current_walk_state (&walk_list); if (walk_state && - status == AE_OK) + ACPI_SUCCESS (status)) { /* There is another walk state, restart it */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/parser/psxface.c linux/drivers/acpi/parser/psxface.c --- v2.4.0-test8/linux/drivers/acpi/parser/psxface.c Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/parser/psxface.c Fri Sep 15 14:30:30 2000 @@ -1,7 +1,7 @@ - /****************************************************************************** * * Module Name: psxface - Parser external interfaces + * $Revision: 36 $ * *****************************************************************************/ @@ -25,18 +25,15 @@ #include "acpi.h" -#include "parser.h" -#include "dispatch.h" -#include "interp.h" +#include "acparser.h" +#include "acdispat.h" +#include "acinterp.h" #include "amlcode.h" -#include "namesp.h" +#include "acnamesp.h" #define _COMPONENT PARSER - MODULE_NAME ("psxface"); - - -char *acpi_gbl_parser_id = "Non-recursive AML Parser"; + MODULE_NAME ("psxface") /***************************************************************************** @@ -57,29 +54,30 @@ ACPI_STATUS acpi_psx_execute ( - ACPI_NAMED_OBJECT *method_entry, - ACPI_OBJECT_INTERNAL **params, - ACPI_OBJECT_INTERNAL **return_obj_desc) + ACPI_NAMESPACE_NODE *method_node, + ACPI_OPERAND_OBJECT **params, + ACPI_OPERAND_OBJECT **return_obj_desc) { ACPI_STATUS status; - ACPI_OBJECT_INTERNAL *obj_desc; + ACPI_OPERAND_OBJECT *obj_desc; u32 i; + ACPI_PARSE_OBJECT *op; - /* Validate the NTE and get the attached object */ + /* Validate the Node and get the attached object */ - if (!method_entry) { + if (!method_node) { return (AE_NULL_ENTRY); } - obj_desc = acpi_ns_get_attached_object (method_entry); + obj_desc = acpi_ns_get_attached_object (method_node); if (!obj_desc) { return (AE_NULL_OBJECT); } - /* Parse method if necessary, wait on concurrency semaphore */ + /* Init for new method, wait on concurrency semaphore */ - status = acpi_ds_begin_method_execution (method_entry, obj_desc); + status = acpi_ds_begin_method_execution (method_node, obj_desc); if (ACPI_FAILURE (status)) { return (status); } @@ -96,15 +94,40 @@ } /* - * Method is parsed and ready to execute - * The walk of the parse tree is where we actually execute the method + * Perform the first pass parse of the method to enter any + * named objects that it creates into the namespace */ - status = acpi_ps_walk_parsed_aml (obj_desc->method.parser_op, - obj_desc->method.parser_op, obj_desc, - method_entry->child_table, params, return_obj_desc, - obj_desc->method.owning_id, acpi_ds_exec_begin_op, - acpi_ds_exec_end_op); + /* Create and init a Root Node */ + + op = acpi_ps_alloc_op (AML_SCOPE_OP); + if (!op) { + return (AE_NO_MEMORY); + } + + status = acpi_ps_parse_aml (op, obj_desc->method.pcode, + obj_desc->method.pcode_length, + ACPI_PARSE_LOAD_PASS1 | ACPI_PARSE_DELETE_TREE, + method_node, params, return_obj_desc, + acpi_ds_load1_begin_op, acpi_ds_load1_end_op); + acpi_ps_delete_parse_tree (op); + + /* Create and init a Root Node */ + + op = acpi_ps_alloc_op (AML_SCOPE_OP); + if (!op) { + return (AE_NO_MEMORY); + } + + /* + * The walk of the parse tree is where we actually execute the method + */ + status = acpi_ps_parse_aml (op, obj_desc->method.pcode, + obj_desc->method.pcode_length, + ACPI_PARSE_EXECUTE | ACPI_PARSE_DELETE_TREE, + method_node, params, return_obj_desc, + acpi_ds_exec_begin_op, acpi_ds_exec_end_op); + acpi_ps_delete_parse_tree (op); if (params) { /* Take away the extra reference that we gave the parameters above */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/resources/Makefile linux/drivers/acpi/resources/Makefile --- v2.4.0-test8/linux/drivers/acpi/resources/Makefile Wed Dec 31 16:00:00 1969 +++ linux/drivers/acpi/resources/Makefile Fri Sep 15 18:21:44 2000 @@ -0,0 +1,28 @@ +# +# 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)) + +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: + $(RM) *.o diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/resources/rsaddr.c linux/drivers/acpi/resources/rsaddr.c --- v2.4.0-test8/linux/drivers/acpi/resources/rsaddr.c Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/resources/rsaddr.c Fri Sep 15 14:30:30 2000 @@ -4,6 +4,7 @@ * Acpi_rs_address16_stream * Acpi_rs_address32_resource * Acpi_rs_address32_stream + * $Revision: 9 $ * *****************************************************************************/ @@ -29,7 +30,7 @@ #include "acpi.h" #define _COMPONENT RESOURCE_MANAGER - MODULE_NAME ("rsaddr"); + MODULE_NAME ("rsaddr") /*************************************************************************** @@ -63,8 +64,8 @@ { u8 *buffer = byte_stream_buffer; RESOURCE *output_struct = (RESOURCE *) * output_buffer; - u16 temp16 = 0; - u8 temp8 = 0; + u16 temp16; + u8 temp8; u32 index; u32 struct_size = sizeof(ADDRESS16_RESOURCE) + RESOURCE_LENGTH_NO_DATA; @@ -75,7 +76,7 @@ */ buffer += 1; - temp16 = *(u16 *)buffer; + MOVE_UNALIGNED16_TO_16 (&temp16, buffer); *bytes_consumed = temp16 + 3; @@ -91,7 +92,7 @@ /* Values 0-2 are valid */ if (temp8 > 2) { - return (AE_ERROR); + return (AE_AML_ERROR); } output_struct->data.address16.resource_type = temp8 & 0x03; @@ -235,6 +236,7 @@ */ temp8 = (u8) (index + 1); struct_size += ROUND_UP_TO_32_bITS (temp8); + output_struct->length = struct_size; } else { output_struct->data.address16.resource_source_index = 0x00; @@ -243,11 +245,6 @@ } /* - * Set the Length parameter - */ - output_struct->length = struct_size; - - /* * Return the final size of the structure */ *structure_size = struct_size; @@ -281,8 +278,8 @@ { u8 *buffer = *output_buffer; u8 *length_field; - u8 temp8 = 0; - u8 *temp_pointer = NULL; + u8 temp8; + NATIVE_CHAR *temp_pointer = NULL; u32 actual_bytes; @@ -389,7 +386,7 @@ *buffer = temp8; buffer += 1; - temp_pointer = buffer; + temp_pointer = (NATIVE_CHAR *) buffer; /* * Copy the string @@ -450,15 +447,21 @@ u8 **output_buffer, u32 *structure_size) { - u8 *buffer = byte_stream_buffer; - RESOURCE *output_struct = (RESOURCE *) * output_buffer; - u16 temp16 = 0; - u8 temp8 = 0; - u32 struct_size = sizeof (ADDRESS32_RESOURCE) + - RESOURCE_LENGTH_NO_DATA; + u8 *buffer; + RESOURCE *output_struct; + u16 temp16; + u8 temp8; + u32 struct_size; u32 index; + buffer = byte_stream_buffer; + + output_struct = (RESOURCE *) *output_buffer; + + struct_size = sizeof (ADDRESS32_RESOURCE) + + RESOURCE_LENGTH_NO_DATA; + /* * Point past the Descriptor to get the number of bytes consumed */ @@ -477,7 +480,7 @@ /* Values 0-2 are valid */ if(temp8 > 2) { - return (AE_ERROR); + return (AE_AML_ERROR); } output_struct->data.address32.resource_type = temp8 & 0x03; @@ -661,11 +664,13 @@ u8 **output_buffer, u32 *bytes_consumed) { - u8 *buffer = *output_buffer; + u8 *buffer; u16 *length_field; - u8 temp8 = 0; - u8 *temp_pointer = NULL; + u8 temp8; + NATIVE_CHAR *temp_pointer; + + buffer = *output_buffer; /* * The descriptor field is static @@ -779,7 +784,7 @@ buffer += 1; - temp_pointer = buffer; + temp_pointer = (NATIVE_CHAR *) buffer; /* * Copy the string diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/resources/rscalc.c linux/drivers/acpi/resources/rscalc.c --- v2.4.0-test8/linux/drivers/acpi/resources/rscalc.c Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/resources/rscalc.c Fri Sep 15 14:30:30 2000 @@ -2,6 +2,7 @@ * * Module Name: rscalc - Acpi_rs_calculate_byte_stream_length * Acpi_rs_calculate_list_length + * $Revision: 9 $ * *****************************************************************************/ @@ -27,7 +28,7 @@ #include "acpi.h" #define _COMPONENT RESOURCE_MANAGER - MODULE_NAME ("rscalc"); + MODULE_NAME ("rscalc") /*************************************************************************** @@ -51,9 +52,8 @@ RESOURCE *linked_list, u32 *size_needed) { - ACPI_STATUS status = AE_OK; u32 byte_stream_size_needed = 0; - u32 size_of_this_bit; + u32 segment_size; EXTENDED_IRQ_RESOURCE *ex_irq = NULL; u8 done = FALSE; @@ -64,7 +64,7 @@ * Init the variable that will hold the size to add to the * total. */ - size_of_this_bit = 0; + segment_size = 0; switch (linked_list->id) { @@ -76,7 +76,7 @@ * For an IRQ Resource, Byte 3, although optional, will * always be created - it holds IRQ information. */ - size_of_this_bit = 4; + segment_size = 4; break; case dma: @@ -86,7 +86,7 @@ /* * For this resource the size is static */ - size_of_this_bit = 3; + segment_size = 3; break; case start_dependent_functions: @@ -97,7 +97,7 @@ * For a Start_dependent_functions Resource, Byte 1, * although optional, will always be created. */ - size_of_this_bit = 2; + segment_size = 2; break; case end_dependent_functions: @@ -107,7 +107,7 @@ /* * For this resource the size is static */ - size_of_this_bit = 1; + segment_size = 1; break; case io: @@ -117,7 +117,7 @@ /* * For this resource the size is static */ - size_of_this_bit = 8; + segment_size = 8; break; case fixed_io: @@ -127,7 +127,7 @@ /* * For this resource the size is static */ - size_of_this_bit = 4; + segment_size = 4; break; case vendor_specific: @@ -141,12 +141,12 @@ * Resource data type. */ if(linked_list->data.vendor_specific.length > 7) { - size_of_this_bit = 3; + segment_size = 3; } else { - size_of_this_bit = 1; + segment_size = 1; } - size_of_this_bit += + segment_size += linked_list->data.vendor_specific.length; break; @@ -157,7 +157,7 @@ /* * For this resource the size is static */ - size_of_this_bit = 2; + segment_size = 2; done = TRUE; break; @@ -168,7 +168,7 @@ /* * For this resource the size is static */ - size_of_this_bit = 12; + segment_size = 12; break; case memory32: @@ -178,7 +178,7 @@ /* * For this resource the size is static */ - size_of_this_bit = 20; + segment_size = 20; break; case fixed_memory32: @@ -188,7 +188,7 @@ /* * For this resource the size is static */ - size_of_this_bit = 12; + segment_size = 12; break; case address16: @@ -201,10 +201,10 @@ * the Index + the length of the null terminated * string Resource Source + 1 for the null. */ - size_of_this_bit = 16; + segment_size = 16; if(NULL != linked_list->data.address16.resource_source) { - size_of_this_bit += (1 + + segment_size += (1 + linked_list->data.address16.resource_source_string_length); } break; @@ -219,10 +219,10 @@ * length of the null terminated string Resource Source + * 1 for the null. */ - size_of_this_bit = 26; + segment_size = 26; if(NULL != linked_list->data.address16.resource_source) { - size_of_this_bit += (1 + + segment_size += (1 + linked_list->data.address16.resource_source_string_length); } break; @@ -239,14 +239,14 @@ * Index + the length of the null terminated string * Resource Source + 1 for the null. */ - size_of_this_bit = 9; + segment_size = 9; - size_of_this_bit += + segment_size += (linked_list->data.extended_irq.number_of_interrupts - 1) * 4; if(NULL != ex_irq->resource_source) { - size_of_this_bit += (1 + + segment_size += (1 + linked_list->data.extended_irq.resource_source_string_length); } break; @@ -256,7 +256,7 @@ * If we get here, everything is out of sync, * so exit with an error */ - return (AE_ERROR); + return (AE_AML_ERROR); break; } /* switch (Linked_list->Id) */ @@ -264,7 +264,7 @@ /* * Update the total */ - byte_stream_size_needed += size_of_this_bit; + byte_stream_size_needed += segment_size; /* * Point to the next object @@ -278,7 +278,7 @@ */ *size_needed = byte_stream_size_needed; - return (status); + return (AE_OK); } /* Acpi_rs_calculate_byte_stream_length */ @@ -309,16 +309,16 @@ { u32 buffer_size = 0; u32 bytes_parsed = 0; - u8 resource_type = 0; - u32 structure_size = 0; - u32 bytes_consumed = 0; - u8 *buffer; u8 number_of_interrupts = 0; + u8 number_of_channels = 0; + u8 resource_type; + u32 structure_size; + u32 bytes_consumed; + u8 *buffer; u8 temp8; u16 temp16; u8 index; - u8 number_of_channels = 0; - u8 additional_bytes = 0; + u8 additional_bytes; while (bytes_parsed < byte_stream_buffer_length) { @@ -532,7 +532,7 @@ * If we get here, everything is out of sync, * so exit with an error */ - return (AE_ERROR); + return (AE_AML_ERROR); break; } } @@ -723,7 +723,7 @@ * If we get here, everything is out of sync, * so exit with an error */ - return (AE_ERROR); + return (AE_AML_ERROR); break; } /* switch */ @@ -752,3 +752,116 @@ } /* Acpi_rs_calculate_list_length */ +/*************************************************************************** + * FUNCTION: Acpi_rs_calculate_pci_routing_table_length + * + * PARAMETERS: + * Package_object - Pointer to the package object + * Buffer_size_needed - u32 pointer of the size buffer + * needed to properly return the + * parsed data + * + * RETURN: Status AE_OK + * + * DESCRIPTION: Given a package representing a PCI routing table, this + * 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; + + number_of_elements = package_object->package.count; + + /* + * Calculate the size of the return buffer. + * The base size is the number of elements * the sizes of the + * structures. Additional space for the strings is added below. + * The minus one is to subtract the size of the u8 Source[1] + * member because it is added below. + * + * NOTE: The Number_of_elements is incremented by one to add an end + * table structure that is essentially a structure of zeros. + */ + temp_size_needed = (number_of_elements + 1) * + (sizeof (PCI_ROUTING_TABLE) - 1); + + /* + * But each PRT_ENTRY structure has a pointer to a string and + * the size of that string must be found. + */ + 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 + */ + package_element = *top_object_list; + + /* + * The Sub_object_list will now point to an array of the + * four IRQ elements: Address, Pin, Source and Source_index + */ + sub_object_list = package_element->package.elements; + + /* + * Scan the Irq_table_elements for the Source Name String + */ + name_found = FALSE; + + for (table_index = 0; table_index < 4 && !name_found; table_index++) { + if (ACPI_TYPE_STRING == (*sub_object_list)->common.type) { + name_found = TRUE; + } + + else { + /* + * Look at the next element + */ + sub_object_list++; + } + } + + /* + * Was a String type found? + */ + if (TRUE == name_found) { + /* + * The length String.Length field includes the + * terminating NULL + */ + temp_size_needed += (*sub_object_list)->string.length; + temp_size_needed = ROUND_UP_TO_32_bITS (temp_size_needed); + } + + else { + /* + * If no name was found, then this is a NULL, which is + * translated as a u32 zero. + */ + temp_size_needed += sizeof(u32); + } + + /* + * Point to the next ACPI_OPERAND_OBJECT + */ + top_object_list++; + } + + *buffer_size_needed = temp_size_needed; + + return (AE_OK); +} \ No newline at end of file diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/resources/rscreate.c linux/drivers/acpi/resources/rscreate.c --- v2.4.0-test8/linux/drivers/acpi/resources/rscreate.c Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/resources/rscreate.c Fri Sep 15 14:30:30 2000 @@ -3,6 +3,7 @@ * Module Name: rscreate - Acpi_rs_create_resource_list * Acpi_rs_create_pci_routing_table * Acpi_rs_create_byte_stream + * $Revision: 16 $ * *****************************************************************************/ @@ -26,13 +27,14 @@ #include "acpi.h" -#include "resource.h" +#include "acresrc.h" #define _COMPONENT RESOURCE_MANAGER - MODULE_NAME ("rscreate"); + MODULE_NAME ("rscreate") -/*************************************************************************** +/******************************************************************************* + * * FUNCTION: Acpi_rs_create_resource_list * * PARAMETERS: @@ -40,53 +42,40 @@ * Output_buffer - Pointer to the user's buffer * Output_buffer_length - Pointer to the size of Output_buffer * - * RETURN: Status AE_OK if okay, else a valid ACPI_STATUS code - * If Output_buffer is not large enough, Output_buffer_length - * indicates how large Output_buffer should be, else it - * indicates how may u8 elements of Output_buffer are - * valid. + * RETURN: Status - AE_OK if okay, else a valid ACPI_STATUS code + * If Output_buffer is not large enough, Output_buffer_length + * indicates how large Output_buffer should be, else it + * indicates how may u8 elements of Output_buffer are valid. * * DESCRIPTION: Takes the byte stream returned from a _CRS, _PRS control method - * execution and parses the stream to create a linked list - * of device resources. + * execution and parses the stream to create a linked list + * of device resources. * - ***************************************************************************/ + ******************************************************************************/ ACPI_STATUS acpi_rs_create_resource_list ( - ACPI_OBJECT_INTERNAL *byte_stream_buffer, + ACPI_OPERAND_OBJECT *byte_stream_buffer, u8 *output_buffer, u32 *output_buffer_length) { - ACPI_STATUS status = AE_UNKNOWN_STATUS; + ACPI_STATUS status; u8 *byte_stream_start = NULL; u32 list_size_needed = 0; u32 byte_stream_buffer_length = 0; /* - * Validate parameters: - * - * 1. If Byte_stream_buffer is NULL after we know that - * Byte_steam_length is not zero, or - * 2. If Output_buffer is NULL and Output_buffer_length - * is not zero - * - * Return an error + * Params already validated, so we don't re-validate here */ - if (!byte_stream_buffer || - (!output_buffer && 0 != *output_buffer_length)) - { - return (AE_BAD_PARAMETER); - } byte_stream_buffer_length = byte_stream_buffer->buffer.length; byte_stream_start = byte_stream_buffer->buffer.pointer; /* * Pass the Byte_stream_buffer into a module that can calculate - * the buffer size needed for the linked list + * the buffer size needed for the linked list */ status = acpi_rs_calculate_list_length (byte_stream_start, byte_stream_buffer_length, @@ -95,13 +84,13 @@ /* * Exit with the error passed back */ - if (AE_OK != status) { + if (ACPI_FAILURE (status)) { return (status); } /* * If the linked list will fit into the available buffer - * call to fill in the list + * call to fill in the list */ if (list_size_needed <= *output_buffer_length) { @@ -117,7 +106,7 @@ /* * Exit with the error passed back */ - if (AE_OK != status) { + if (ACPI_FAILURE (status)) { return (status); } @@ -134,138 +123,53 @@ } -/*************************************************************************** +/******************************************************************************* + * * FUNCTION: Acpi_rs_create_pci_routing_table * * PARAMETERS: - * Package_object - Pointer to an ACPI_OBJECT_INTERNAL + * Package_object - Pointer to an ACPI_OPERAND_OBJECT * package * Output_buffer - Pointer to the user's buffer * Output_buffer_length - Size of Output_buffer * * RETURN: Status AE_OK if okay, else a valid ACPI_STATUS code. * If the Output_buffer is too small, the error will be - * AE_BUFFER_OVERFLOW and Output_buffer_length will point - * to the size buffer needed. + * AE_BUFFER_OVERFLOW and Output_buffer_length will point + * to the size buffer needed. * - * DESCRIPTION: Takes the ACPI_OBJECT_INTERNAL package and creates a - * linked list of PCI interrupt descriptions + * DESCRIPTION: Takes the ACPI_OPERAND_OBJECT package and creates a + * linked list of PCI interrupt descriptions * - ***************************************************************************/ + ******************************************************************************/ ACPI_STATUS acpi_rs_create_pci_routing_table ( - ACPI_OBJECT_INTERNAL *package_object, + ACPI_OPERAND_OBJECT *package_object, u8 *output_buffer, u32 *output_buffer_length) { u8 *buffer = output_buffer; - ACPI_OBJECT_INTERNAL **top_object_list = NULL; - ACPI_OBJECT_INTERNAL **sub_object_list = NULL; - ACPI_OBJECT_INTERNAL *package_element = NULL; + ACPI_OPERAND_OBJECT **top_object_list = NULL; + ACPI_OPERAND_OBJECT **sub_object_list = NULL; + ACPI_OPERAND_OBJECT *package_element = NULL; u32 buffer_size_needed = 0; u32 number_of_elements = 0; u32 index = 0; - u8 table_index = 0; - u8 name_found = FALSE; PCI_ROUTING_TABLE *user_prt = NULL; + ACPI_STATUS status; /* - * Validate parameters: - * - * 1. If Method_return_object is NULL, or - * 2. If Output_buffer is NULL and Output_buffer_length is not zero - * - * Return an error + * Params already validated, so we don't re-validate here */ - if (!package_object || - (!output_buffer && 0 != *output_buffer_length)) - { - return (AE_BAD_PARAMETER); - } - /* - * Calculate the buffer size needed for the routing table. - */ - number_of_elements = package_object->package.count; - - /* - * Properly calculate the size of the return buffer. - * The base size is the number of elements * the sizes of the - * structures. Additional space for the strings is added below. - * The minus one is to subtract the size of the u8 Source[1] - * member because it is added below. - * NOTE: The Number_of_elements is incremented by one to add an end - * table structure that is essentially a structure of zeros. - */ - buffer_size_needed = (number_of_elements + 1) * - (sizeof (PCI_ROUTING_TABLE) - 1); - - /* - * But each PRT_ENTRY structure has a pointer to a string and - * the size of that string must be found. - */ - top_object_list = package_object->package.elements; - - for (index = 0; index < number_of_elements; index++) { - /* - * Dereference the sub-package - */ - package_element = *top_object_list; - - /* - * The Sub_object_list will now point to an array of the - * four IRQ elements: Address, Pin, Source and Source_index - */ - sub_object_list = package_element->package.elements; - - /* - * Scan the Irq_table_elements for the Source Name String - */ - name_found = FALSE; - - for (table_index = 0; table_index < 4 && !name_found; table_index++) { - if (ACPI_TYPE_STRING == (*sub_object_list)->common.type) { - name_found = TRUE; - } - - else { - /* - * Look at the next element - */ - sub_object_list++; - } - } - - /* - * Was a String type found? - */ - if (TRUE == name_found) { - /* - * The length String.Length field includes the - * terminating NULL - */ - buffer_size_needed += ((*sub_object_list)->string.length); - } - - else { - /* - * If no name was found, then this is a NULL, which is - * translated as a u32 zero. - */ - buffer_size_needed += sizeof(u32); - } - - /* - * Point to the next ACPI_OBJECT_INTERNAL - */ - top_object_list++; - } + status = acpi_rs_calculate_pci_routing_table_length(package_object, + &buffer_size_needed); /* * If the data will fit into the available buffer - * call to fill in the list + * call to fill in the list */ if (buffer_size_needed <= *output_buffer_length) { /* @@ -275,34 +179,32 @@ /* * Loop through the ACPI_INTERNAL_OBJECTS - Each object should - * contain a u32 Address, a u8 Pin, a Name and a u8 - * Source_index. + * contain a u32 Address, a u8 Pin, a Name and a u8 + * Source_index. */ top_object_list = package_object->package.elements; number_of_elements = package_object->package.count; - user_prt = (PCI_ROUTING_TABLE *)buffer; + user_prt = (PCI_ROUTING_TABLE *) buffer; for (index = 0; index < number_of_elements; index++) { /* * Point User_prt past this current structure * * NOTE: On the first iteration, User_prt->Length will - * be zero because we zero'ed out the return buffer - * earlier + * be zero because we cleared the return buffer earlier */ buffer += user_prt->length; - - user_prt = (PCI_ROUTING_TABLE *)buffer; + user_prt = (PCI_ROUTING_TABLE *) buffer; /* * Fill in the Length field with the information we - * have at this point. - * The minus one is to subtract the size of the - * u8 Source[1] member because it is added below. + * have at this point. + * The minus one is to subtract the size of the + * u8 Source[1] member because it is added below. */ - user_prt->length = (sizeof(PCI_ROUTING_TABLE) - 1); + user_prt->length = (sizeof (PCI_ROUTING_TABLE) - 1); /* * Dereference the sub-package @@ -311,8 +213,8 @@ /* * The Sub_object_list will now point to an array of - * the four IRQ elements: Address, Pin, Source and - * Source_index + * the four IRQ elements: Address, Pin, Source and + * Source_index */ sub_object_list = package_element->package.elements; @@ -348,27 +250,29 @@ sub_object_list++; if (ACPI_TYPE_STRING == (*sub_object_list)->common.type) { - STRCPY(user_prt->data.source, + STRCPY (user_prt->data.source, (*sub_object_list)->string.pointer); /* * 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 { /* * If this is a number, then the Source Name - * is NULL, since the entire buffer was zeroed - * out, we can leave this alone. + * is NULL, since the entire buffer was zeroed + * out, we can leave this alone. */ if (ACPI_TYPE_NUMBER == (*sub_object_list)->common.type) { /* * Add to the Length field the length of - * the u32 NULL + * the u32 NULL */ - user_prt->length += sizeof(u32); + user_prt->length += sizeof (u32); } else { @@ -391,7 +295,7 @@ } /* - * Point to the next ACPI_OBJECT_INTERNAL + * Point to the next ACPI_OPERAND_OBJECT */ top_object_list++; } @@ -414,7 +318,8 @@ } -/*************************************************************************** +/******************************************************************************* + * * FUNCTION: Acpi_rs_create_byte_stream * * PARAMETERS: @@ -431,7 +336,7 @@ * creates a bytestream to be used as input for the * _SRS control method. * - ***************************************************************************/ + ******************************************************************************/ ACPI_STATUS acpi_rs_create_byte_stream ( @@ -439,27 +344,15 @@ u8 *output_buffer, u32 *output_buffer_length) { - ACPI_STATUS status = AE_UNKNOWN_STATUS; + ACPI_STATUS status; u32 byte_stream_size_needed = 0; /* - * Validate parameters: + * Params already validated, so we don't re-validate here * - * 1. If Linked_list_buffer is NULL, or - * 2. If Output_buffer is NULL and Output_buffer_length is not zero - * - * Return an error - */ - if (!linked_list_buffer || - (!output_buffer && 0 != *output_buffer_length)) - { - return (AE_BAD_PARAMETER); - } - - /* * Pass the Linked_list_buffer into a module that can calculate - * the buffer size needed for the byte stream. + * the buffer size needed for the byte stream. */ status = acpi_rs_calculate_byte_stream_length (linked_list_buffer, &byte_stream_size_needed); @@ -467,13 +360,13 @@ /* * Exit with the error passed back */ - if (AE_OK != status) { + if (ACPI_FAILURE (status)) { return (status); } /* * If the linked list will fit into the available buffer - * call to fill in the list + * call to fill in the list */ if (byte_stream_size_needed <= *output_buffer_length) { @@ -489,7 +382,7 @@ /* * Exit with the error passed back */ - if (AE_OK != status) { + if (ACPI_FAILURE (status)) { return (status); } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/resources/rsdump.c linux/drivers/acpi/resources/rsdump.c --- v2.4.0-test8/linux/drivers/acpi/resources/rsdump.c Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/resources/rsdump.c Fri Sep 15 14:30:30 2000 @@ -1,6 +1,7 @@ /****************************************************************************** * * Module Name: rsdump - Functions do dump out the resource structures. + * $Revision: 10 $ * *****************************************************************************/ @@ -26,7 +27,7 @@ #include "acpi.h" #define _COMPONENT RESOURCE_MANAGER - MODULE_NAME ("rsdump"); + MODULE_NAME ("rsdump") /****************************************************************************** @@ -120,7 +121,7 @@ break; } - acpi_os_printf ("\t\t%s_bus Master\n", + acpi_os_printf ("\t\t%sBus Master\n", BUS_MASTER == dma_data->bus_master ? "" : "Not a "); @@ -802,7 +803,7 @@ acpi_rs_dump_resource_list ( RESOURCE *resource) { - s8 count = 0; + u8 count = 0; u8 done = FALSE; @@ -902,7 +903,7 @@ u8 *route_table) { u8 *buffer = route_table; - s8 count = 0; + u8 count = 0; u8 done = FALSE; PCI_ROUTING_TABLE *prt_element; diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/resources/rsio.c linux/drivers/acpi/resources/rsio.c --- v2.4.0-test8/linux/drivers/acpi/resources/rsio.c Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/resources/rsio.c Fri Sep 15 14:30:30 2000 @@ -6,6 +6,7 @@ * Acpi_rs_fixed_io_stream * Acpi_rs_dma_resource * Acpi_rs_dma_stream + * $Revision: 7 $ * *****************************************************************************/ @@ -31,7 +32,7 @@ #include "acpi.h" #define _COMPONENT RESOURCE_MANAGER - MODULE_NAME ("rsio"); + MODULE_NAME ("rsio") /*************************************************************************** @@ -90,7 +91,7 @@ * Check Min_base Address */ buffer += 1; - temp16 = *(u16 *)buffer; + MOVE_UNALIGNED16_TO_16 (&temp16, buffer); output_struct->data.io.min_base_address = temp16; @@ -98,7 +99,7 @@ * Check Max_base Address */ buffer += 2; - temp16 = *(u16 *)buffer; + MOVE_UNALIGNED16_TO_16 (&temp16, buffer); output_struct->data.io.max_base_address = temp16; @@ -255,7 +256,7 @@ */ temp16 = (u16) linked_list->data.io.min_base_address; - *(u16 *)buffer = temp16; + MOVE_UNALIGNED16_TO_16 (&temp16, buffer); buffer += 2; @@ -264,7 +265,7 @@ */ temp16 = (u16) linked_list->data.io.max_base_address; - *(u16 *)buffer = temp16; + MOVE_UNALIGNED16_TO_16 (&temp16, buffer); buffer += 2; @@ -336,7 +337,7 @@ */ temp16 = (u16) linked_list->data.fixed_io.base_address; - *(u16 *)buffer = temp16; + MOVE_UNALIGNED16_TO_16 (&temp16, buffer); buffer += 2; diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/resources/rsirq.c linux/drivers/acpi/resources/rsirq.c --- v2.4.0-test8/linux/drivers/acpi/resources/rsirq.c Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/resources/rsirq.c Fri Sep 15 14:30:30 2000 @@ -4,6 +4,7 @@ * Acpi_rs_irq_stream * Acpi_rs_extended_irq_resource * Acpi_rs_extended_irq_stream + * $Revision: 8 $ * *****************************************************************************/ @@ -29,7 +30,7 @@ #include "acpi.h" #define _COMPONENT RESOURCE_MANAGER - MODULE_NAME ("rsirq"); + MODULE_NAME ("rsirq") /*************************************************************************** @@ -85,7 +86,7 @@ * Point to the 16-bits of Bytes 1 and 2 */ buffer += 1; - temp16 = *(u16 *)buffer; + MOVE_UNALIGNED16_TO_16 (&temp16, buffer); output_struct->data.irq.number_of_interrupts = 0; @@ -226,7 +227,7 @@ temp16 |= 0x1 << temp8; } - *(u16 *)buffer = temp16; + MOVE_UNALIGNED16_TO_16 (&temp16, buffer); buffer += 2; @@ -306,7 +307,7 @@ * Point past the Descriptor to get the number of bytes consumed */ buffer += 1; - temp16 = *(u16 *)buffer; + MOVE_UNALIGNED16_TO_16 (&temp16, buffer); *bytes_consumed = temp16 + 3; output_struct->id = extended_irq; @@ -476,7 +477,7 @@ u16 *length_field; u8 temp8 = 0; u8 index; - u8 *temp_pointer = NULL; + NATIVE_CHAR *temp_pointer = NULL; /* @@ -533,11 +534,10 @@ * Resource Source Index and Resource Source are optional */ if (0 != linked_list->data.extended_irq.resource_source_string_length) { - temp8 = (u8) linked_list->data.extended_irq.resource_source_index; - - *buffer = temp8; + *buffer = (u8) linked_list->data.extended_irq.resource_source_index; buffer += 1; - temp_pointer = buffer; + + temp_pointer = (NATIVE_CHAR *) buffer; /* * Copy the string diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/resources/rslist.c linux/drivers/acpi/resources/rslist.c --- v2.4.0-test8/linux/drivers/acpi/resources/rslist.c Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/resources/rslist.c Fri Sep 15 14:30:30 2000 @@ -2,6 +2,7 @@ * * Module Name: rslist - Acpi_rs_byte_stream_to_list * Acpi_list_to_byte_stream + * $Revision: 6 $ * *****************************************************************************/ @@ -25,10 +26,10 @@ #include "acpi.h" -#include "resource.h" +#include "acresrc.h" #define _COMPONENT RESOURCE_MANAGER - MODULE_NAME ("rslist"); + MODULE_NAME ("rslist") /*************************************************************************** @@ -53,7 +54,7 @@ u32 byte_stream_buffer_length, u8 **output_buffer) { - ACPI_STATUS status = AE_UNKNOWN_STATUS; + ACPI_STATUS status; u32 bytes_parsed = 0; u8 resource_type = 0; u32 bytes_consumed = 0; @@ -167,7 +168,7 @@ * If we get here, everything is out of sync, * so exit with an error */ - return (AE_ERROR); + return (AE_AML_ERROR); break; } } @@ -275,11 +276,11 @@ * If we get here, everything is out of sync, * so exit with an error */ - return (AE_ERROR); + return (AE_AML_ERROR); break; } /* switch */ - } /* if(Resource_type & 0x80) */ + } /* end else */ /* * Update the return value and counter @@ -296,14 +297,15 @@ */ *buffer += structure_size; - } /* while (Bytes_parsed < Byte_stream_buffer_length && - FALSE == End_tag_processed) */ + } /* end while */ /* * Check the reason for exiting the while loop */ - if (byte_stream_buffer_length != bytes_parsed || TRUE != end_tag_processed) { - return (AE_ERROR); + if (!(byte_stream_buffer_length == bytes_parsed) || + (TRUE != end_tag_processed)) + { + return (AE_AML_ERROR); } return (AE_OK); @@ -338,7 +340,7 @@ u32 byte_stream_size_needed, u8 **output_buffer) { - ACPI_STATUS status = AE_UNKNOWN_STATUS; + ACPI_STATUS status; u8 *buffer = *output_buffer; u32 bytes_consumed = 0; u8 done = FALSE; diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/resources/rsmemory.c linux/drivers/acpi/resources/rsmemory.c --- v2.4.0-test8/linux/drivers/acpi/resources/rsmemory.c Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/resources/rsmemory.c Fri Sep 15 14:30:30 2000 @@ -6,6 +6,7 @@ * Acpi_rs_fixed_memory32_resource * Acpi_rs_memory32_range_stream * Acpi_rs_fixed_memory32_stream + * $Revision: 7 $ * *****************************************************************************/ @@ -31,7 +32,7 @@ #include "acpi.h" #define _COMPONENT RESOURCE_MANAGER - MODULE_NAME ("rsmemory"); + MODULE_NAME ("rsmemory") /*************************************************************************** @@ -76,7 +77,7 @@ */ buffer += 1; - temp16 = *(u16 *)buffer; + MOVE_UNALIGNED16_TO_16 (&temp16, buffer); buffer += 2; @@ -96,7 +97,7 @@ /* * Get Min_base_address (Bytes 4-5) */ - temp16 = *(u16 *)buffer; + MOVE_UNALIGNED16_TO_16 (&temp16, buffer); buffer += 2; @@ -105,7 +106,7 @@ /* * Get Max_base_address (Bytes 6-7) */ - temp16 = *(u16 *)buffer; + MOVE_UNALIGNED16_TO_16 (&temp16, buffer); buffer += 2; @@ -114,7 +115,7 @@ /* * Get Alignment (Bytes 8-9) */ - temp16 = *(u16 *)buffer; + MOVE_UNALIGNED16_TO_16 (&temp16, buffer); buffer += 2; @@ -123,7 +124,7 @@ /* * Get Range_length (Bytes 10-11) */ - temp16 = *(u16 *)buffer; + MOVE_UNALIGNED16_TO_16 (&temp16, buffer); output_struct->data.memory24.range_length = temp16; diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/resources/rsmisc.c linux/drivers/acpi/resources/rsmisc.c --- v2.4.0-test8/linux/drivers/acpi/resources/rsmisc.c Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/resources/rsmisc.c Fri Sep 15 14:30:30 2000 @@ -8,6 +8,7 @@ * Acpi_rs_end_dependent_functions_resource * Acpi_rs_start_dependent_functions_stream * Acpi_rs_end_dependent_functions_stream + * $Revision: 7 $ * *****************************************************************************/ @@ -33,7 +34,7 @@ #include "acpi.h" #define _COMPONENT RESOURCE_MANAGER - MODULE_NAME ("rsmisc"); + MODULE_NAME ("rsmisc") /*************************************************************************** @@ -199,7 +200,7 @@ /* Dereference */ - temp16 = *(u16 *)buffer; + MOVE_UNALIGNED16_TO_16 (&temp16, buffer); /* Calculate bytes consumed */ @@ -304,7 +305,7 @@ temp16 = (u16) linked_list->data.vendor_specific.length; - *(u16 *)buffer = temp16; + MOVE_UNALIGNED16_TO_16 (&temp16, buffer); buffer += 2; } @@ -404,7 +405,7 @@ temp8 & 0x03; if (3 == output_struct->data.start_dependent_functions.compatibility_priority) { - return (AE_ERROR); + return (AE_AML_ERROR); } /* @@ -414,7 +415,7 @@ (temp8 >> 2) & 0x03; if (3 == output_struct->data.start_dependent_functions.performance_robustness) { - return (AE_ERROR); + return (AE_AML_ERROR); } } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/resources/rsutils.c linux/drivers/acpi/resources/rsutils.c --- v2.4.0-test8/linux/drivers/acpi/resources/rsutils.c Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/resources/rsutils.c Fri Sep 15 14:30:30 2000 @@ -1,6 +1,7 @@ /****************************************************************************** * * Module Name: rsutils - Utilities for the resource manager + * $Revision: 10 $ * *****************************************************************************/ @@ -24,19 +25,19 @@ #include "acpi.h" -#include "namesp.h" -#include "resource.h" +#include "acnamesp.h" +#include "acresrc.h" #define _COMPONENT RESOURCE_MANAGER - MODULE_NAME ("rsutils"); + MODULE_NAME ("rsutils") /****************************************************************************** * * FUNCTION: Acpi_rs_get_prt_method_data * - * PARAMETERS: Device_handle - a handle to the containing object + * PARAMETERS: Handle - a handle to the containing object * Ret_buffer - a pointer to a buffer structure for the * results * @@ -55,28 +56,20 @@ ACPI_HANDLE handle, ACPI_BUFFER *ret_buffer) { - ACPI_OBJECT_INTERNAL *ret_obj; + ACPI_OPERAND_OBJECT *ret_obj; ACPI_STATUS status; - u32 buffer_space_needed = ret_buffer->length; + u32 buffer_space_needed; - /* - * Must have a valid handle and buffer, So we have to have a handle - * a return buffer structure and if there is a non-zero buffer length - * we also need a valid pointer in the buffer - */ - if ((!handle) || - (!ret_buffer) || - ((!ret_buffer->pointer) && (ret_buffer->length))) - { - return (AE_BAD_PARAMETER); - } + /* already validated params, so we won't repeat here */ + + buffer_space_needed = ret_buffer->length; /* * Execute the method, no parameters */ status = acpi_ns_evaluate_relative (handle, "_PRT", NULL, &ret_obj); - if (status != AE_OK) { + if (ACPI_FAILURE (status)) { return (status); } @@ -128,7 +121,7 @@ * * FUNCTION: Acpi_rs_get_crs_method_data * - * PARAMETERS: Device_handle - a handle to the containing object + * PARAMETERS: Handle - a handle to the containing object * Ret_buffer - a pointer to a buffer structure for the * results * @@ -147,28 +140,18 @@ ACPI_HANDLE handle, ACPI_BUFFER *ret_buffer) { - ACPI_OBJECT_INTERNAL *ret_obj; + ACPI_OPERAND_OBJECT *ret_obj; ACPI_STATUS status; u32 buffer_space_needed = ret_buffer->length; - /* - * Must have a valid handle and buffer, So we have to have a handle - * a return buffer structure and if there is a non-zero buffer length - * we also need a valid pointer in the buffer - */ - if ((!handle) || - (!ret_buffer) || - ((!ret_buffer->pointer) && (ret_buffer->length))) - { - return (AE_BAD_PARAMETER); - } + /* already validated params, so we won't repeat here */ /* * Execute the method, no parameters */ status = acpi_ns_evaluate_relative (handle, "_CRS", NULL, &ret_obj); - if (status != AE_OK) { + if (ACPI_FAILURE (status)) { return (status); } @@ -198,9 +181,7 @@ ret_buffer->pointer, &buffer_space_needed); - if (AE_OK == status) { - acpi_rs_dump_resource_list((RESOURCE *)ret_buffer->pointer); - } + /* * Tell the user how much of the buffer we have used or is needed @@ -223,7 +204,7 @@ * * FUNCTION: Acpi_rs_get_prs_method_data * - * PARAMETERS: Device_handle - a handle to the containing object + * PARAMETERS: Handle - a handle to the containing object * Ret_buffer - a pointer to a buffer structure for the * results * @@ -242,28 +223,18 @@ ACPI_HANDLE handle, ACPI_BUFFER *ret_buffer) { - ACPI_OBJECT_INTERNAL *ret_obj; + ACPI_OPERAND_OBJECT *ret_obj; ACPI_STATUS status; u32 buffer_space_needed = ret_buffer->length; - /* - * Must have a valid handle and buffer, So we have to have a handle - * a return buffer structure and if there is a non-zero buffer length - * we also need a valid pointer in the buffer - */ - if ((!handle) || - (!ret_buffer) || - ((!ret_buffer->pointer) && (ret_buffer->length))) - { - return (AE_BAD_PARAMETER); - } + /* already validated params, so we won't repeat here */ /* * Execute the method, no parameters */ status = acpi_ns_evaluate_relative (handle, "_PRS", NULL, &ret_obj); - if (status != AE_OK) { + if (ACPI_FAILURE (status)) { return (status); } @@ -314,9 +285,7 @@ * * FUNCTION: Acpi_rs_set_srs_method_data * - * PARAMETERS: Device_handle - a handle to the containing object - * *Method_name - Name of method to execute, If NULL, the - * handle is the object to execute + * PARAMETERS: Handle - a handle to the containing object * In_buffer - a pointer to a buffer structure of the * parameter * @@ -335,22 +304,13 @@ ACPI_HANDLE handle, ACPI_BUFFER *in_buffer) { - ACPI_OBJECT_INTERNAL *params[2]; - ACPI_OBJECT_INTERNAL param_obj; + ACPI_OPERAND_OBJECT *params[2]; + ACPI_OPERAND_OBJECT param_obj; ACPI_STATUS status; u8 *byte_stream = NULL; u32 buffer_size_needed = 0; - /* - * Must have a valid handle and buffer - */ - if ((!handle) || - (!in_buffer) || - (!in_buffer->pointer) || - (!in_buffer->length)) - { - return (AE_BAD_PARAMETER); - } + /* already validated params, so we won't repeat here */ /* * The In_buffer parameter will point to a linked list of @@ -390,12 +350,8 @@ byte_stream, &buffer_size_needed); - if(AE_OK != status) { - /* - * Failed the call - */ - acpi_cm_free (byte_stream); - return (status); + if (ACPI_FAILURE (status)) { + goto cleanup; } /* @@ -424,6 +380,9 @@ /* * Clean up and return the status from Acpi_ns_evaluate_relative */ + +cleanup: + acpi_cm_free (byte_stream); return (status); } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/resources/rsxface.c linux/drivers/acpi/resources/rsxface.c --- v2.4.0-test8/linux/drivers/acpi/resources/rsxface.c Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/resources/rsxface.c Fri Sep 15 14:30:30 2000 @@ -1,6 +1,7 @@ /****************************************************************************** * * Module Name: rsxface - Public interfaces to the ACPI subsystem + * $Revision: 7 $ * *****************************************************************************/ @@ -24,12 +25,12 @@ #include "acpi.h" -#include "interp.h" -#include "namesp.h" -#include "resource.h" +#include "acinterp.h" +#include "acnamesp.h" +#include "acresrc.h" #define _COMPONENT RESOURCE_MANAGER - MODULE_NAME ("rsxface"); + MODULE_NAME ("rsxface") /****************************************************************************** @@ -37,19 +38,18 @@ * FUNCTION: Acpi_get_irq_routing_table * * PARAMETERS: Device_handle - a handle to the Bus device we are querying - * Out_buffer - a pointer to a buffer to receive the + * Ret_buffer - a pointer to a buffer to receive the * current resources for the device - * Buffer_length - the number of bytes available in the buffer * * RETURN: Status - the status of the call * * DESCRIPTION: This function is called to get the IRQ routing table for a * specific bus. The caller must first acquire a handle for the * desired bus. The routine table is placed in the buffer pointed - * to by the Out_buffer variable parameter. + * to by the Ret_buffer variable parameter. * * If the function fails an appropriate status will be returned - * and the value of Out_buffer is undefined. + * and the value of Ret_buffer is undefined. * * This function attempts to execute the _PRT method contained in * the object indicated by the passed Device_handle. @@ -64,6 +64,19 @@ ACPI_STATUS status; + /* + * Must have a valid handle and buffer, So we have to have a handle + * and a return buffer structure, and if there is a non-zero buffer length + * we also need a valid pointer in the buffer. If it's a zero buffer length, + * we'll be returning the needed buffer size, so keep going. + */ + if ((!device_handle) || + (!ret_buffer) || + ((!ret_buffer->pointer) && (ret_buffer->length))) + { + return (AE_BAD_PARAMETER); + } + status = acpi_rs_get_prt_method_data (device_handle, ret_buffer); return (status); @@ -76,19 +89,18 @@ * * PARAMETERS: Device_handle - a handle to the device object for the * device we are querying - * Out_buffer - a pointer to a buffer to receive the + * Ret_buffer - a pointer to a buffer to receive the * current resources for the device - * Buffer_length - the number of bytes available in the buffer * * RETURN: Status - the status of the call * * DESCRIPTION: This function is called to get the current resources for a * specific device. The caller must first acquire a handle for * the desired device. The resource data is placed in the buffer - * pointed to by the Out_buffer variable parameter. + * pointed to by the Ret_buffer variable parameter. * * If the function fails an appropriate status will be returned - * and the value of Out_buffer is undefined. + * and the value of Ret_buffer is undefined. * * This function attempts to execute the _CRS method contained in * the object indicated by the passed Device_handle. @@ -103,6 +115,19 @@ ACPI_STATUS status; + /* + * Must have a valid handle and buffer, So we have to have a handle + * and a return buffer structure, and if there is a non-zero buffer length + * we also need a valid pointer in the buffer. If it's a zero buffer length, + * we'll be returning the needed buffer size, so keep going. + */ + if ((!device_handle) || + (!ret_buffer) || + ((ret_buffer->length) && (!ret_buffer->pointer))) + { + return (AE_BAD_PARAMETER); + } + status = acpi_rs_get_crs_method_data (device_handle, ret_buffer); return (status); @@ -115,19 +140,18 @@ * * PARAMETERS: Device_handle - a handle to the device object for the * device we are querying - * Out_buffer - a pointer to a buffer to receive the + * Ret_buffer - a pointer to a buffer to receive the * resources for the device - * Buffer_length - the number of bytes available in the buffer - * + * * RETURN: Status - the status of the call * * DESCRIPTION: This function is called to get a list of the possible resources * for a specific device. The caller must first acquire a handle * for the desired device. The resource data is placed in the - * buffer pointed to by the Out_buffer variable. + * buffer pointed to by the Ret_buffer variable. * * If the function fails an appropriate status will be returned - * and the value of Out_buffer is undefined. + * and the value of Ret_buffer is undefined. * ******************************************************************************/ @@ -139,6 +163,19 @@ ACPI_STATUS status; + /* + * Must have a valid handle and buffer, So we have to have a handle + * and a return buffer structure, and if there is a non-zero buffer length + * we also need a valid pointer in the buffer. If it's a zero buffer length, + * we'll be returning the needed buffer size, so keep going. + */ + if ((!device_handle) || + (!ret_buffer) || + ((ret_buffer->length) && (!ret_buffer->pointer))) + { + return (AE_BAD_PARAMETER); + } + status = acpi_rs_get_prs_method_data (device_handle, ret_buffer); return (status); @@ -151,7 +188,7 @@ * * PARAMETERS: Device_handle - a handle to the device object for the * device we are changing the resources of - * Out_buffer - a pointer to a buffer containing the + * In_buffer - a pointer to a buffer containing the * resources to be set for the device * * RETURN: Status - the status of the call @@ -170,6 +207,17 @@ { ACPI_STATUS status; + + /* + * Must have a valid handle and buffer + */ + if ((!device_handle) || + (!in_buffer) || + (!in_buffer->pointer) || + (!in_buffer->length)) + { + return (AE_BAD_PARAMETER); + } status = acpi_rs_set_srs_method_data (device_handle, in_buffer); diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/sys.c linux/drivers/acpi/sys.c --- v2.4.0-test8/linux/drivers/acpi/sys.c Fri Jul 14 12:12:08 2000 +++ linux/drivers/acpi/sys.c Fri Sep 15 14:30:30 2000 @@ -24,6 +24,9 @@ #include "acpi.h" #include "driver.h" +#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) diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/table.c linux/drivers/acpi/table.c --- v2.4.0-test8/linux/drivers/acpi/table.c Wed Dec 31 16:00:00 1969 +++ linux/drivers/acpi/table.c Fri Sep 15 14:30:30 2000 @@ -0,0 +1,306 @@ +/* + * tables.c - ACPI tables, chipset, and errata handling + * + * Copyright (C) 2000 Andrew Henroid + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include +#include +#include +#include +#include +#include "acpi.h" +#include "driver.h" + +#define _COMPONENT OS_DEPENDENT + MODULE_NAME ("tables") + +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; +} + +/* + * Init VIA ACPI device and create a fake FACP + */ +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_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"); + return -ENODEV; + } + + if (acpi_facp.p_lvl2_lat + && acpi_facp.p_lvl2_lat <= ACPI_MAX_P_LVL2_LAT) { + acpi_c2_exit_latency + = ACPI_uS_TO_TMR_TICKS(acpi_facp.p_lvl2_lat); + acpi_c2_enter_latency + = ACPI_uS_TO_TMR_TICKS(ACPI_TMR_HZ / 1000); + } + if (acpi_facp.p_lvl3_lat + && acpi_facp.p_lvl3_lat <= ACPI_MAX_P_LVL3_LAT) { + acpi_c3_exit_latency + = ACPI_uS_TO_TMR_TICKS(acpi_facp.p_lvl3_lat); + acpi_c3_enter_latency + = ACPI_uS_TO_TMR_TICKS(acpi_facp.p_lvl3_lat * 5); + } + + return 0; +} + +/* + * Find and load ACPI tables + */ +int +acpi_load_tables(void) +{ + if (ACPI_SUCCESS(acpi_load_firmware_tables())) + { + printk(KERN_INFO "ACPI: support found\n"); + } + else if (acpi_find_chipset()) { + acpi_terminate(); + return -1; + } + + if (acpi_fetch_facp()) { + acpi_terminate(); + return -1; + } + + if (!ACPI_SUCCESS(acpi_load_namespace())) { + printk(KERN_ERR "ACPI: namespace load failed\n"); + acpi_terminate(); + return -1; + } + + return 0; +} diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/tables/Makefile linux/drivers/acpi/tables/Makefile --- v2.4.0-test8/linux/drivers/acpi/tables/Makefile Wed Dec 31 16:00:00 1969 +++ linux/drivers/acpi/tables/Makefile Fri Sep 15 18:21:44 2000 @@ -0,0 +1,28 @@ +# +# 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)) + +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: + $(RM) *.o diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/tables/tbget.c linux/drivers/acpi/tables/tbget.c --- v2.4.0-test8/linux/drivers/acpi/tables/tbget.c Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/tables/tbget.c Fri Sep 15 14:30:30 2000 @@ -1,7 +1,7 @@ - /****************************************************************************** * * Module Name: tbget - ACPI Table get* routines + * $Revision: 22 $ * *****************************************************************************/ @@ -25,12 +25,12 @@ #include "acpi.h" -#include "hardware.h" -#include "tables.h" +#include "achware.h" +#include "actables.h" #define _COMPONENT TABLE_MANAGER - MODULE_NAME ("tbget"); + MODULE_NAME ("tbget") /******************************************************************************* @@ -90,10 +90,15 @@ return (AE_NOT_EXIST); } - /* Walk the list to get the table */ - + /* Walk the list to get the desired table + * Since the if (Instance == 1) check above checked for the + * first table, setting Table_desc equal to the .Next member + * is actually pointing to the second table. Therefore, we + * need to walk from the 2nd table until we reach the Instance + * that the user is looking for and return its table pointer. + */ table_desc = acpi_gbl_acpi_tables[table_type].next; - for (i = 1; i < acpi_gbl_acpi_tables[table_type].count; i++) { + for (i = 2; i < instance; i++) { table_desc = table_desc->next; } @@ -110,8 +115,8 @@ * FUNCTION: Acpi_tb_get_table * * PARAMETERS: Physical_address - Physical address of table to retrieve - * *Buffer_ptr - If == NULL, read data from buffer - * rather than searching memory + * *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 @@ -123,7 +128,7 @@ ACPI_STATUS acpi_tb_get_table ( void *physical_address, - char *buffer_ptr, + ACPI_TABLE_HEADER *buffer_ptr, ACPI_TABLE_DESC *table_info) { ACPI_TABLE_HEADER *table_header = NULL; @@ -143,7 +148,7 @@ * Getting data from a buffer, not BIOS tables */ - table_header = (ACPI_TABLE_HEADER *) buffer_ptr; + table_header = buffer_ptr; status = acpi_tb_validate_table_header (table_header); if (ACPI_FAILURE (status)) { /* Table failed verification, map all errors to BAD_DATA */ @@ -160,7 +165,7 @@ /* Copy the entire table (including header) to the local buffer */ - size = (ACPI_SIZE) table_header->length; + size = table_header->length; MEMCPY (full_table, buffer_ptr, size); /* Save allocation type */ @@ -216,7 +221,7 @@ ACPI_STATUS acpi_tb_get_all_tables ( u32 number_of_tables, - char *table_ptr) + ACPI_TABLE_HEADER *table_ptr) { ACPI_STATUS status = AE_OK; u32 index; diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/tables/tbinstal.c linux/drivers/acpi/tables/tbinstal.c --- v2.4.0-test8/linux/drivers/acpi/tables/tbinstal.c Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/tables/tbinstal.c Fri Sep 15 14:30:30 2000 @@ -1,7 +1,7 @@ - /****************************************************************************** * * Module Name: tbinstal - ACPI table installation and removal + * $Revision: 29 $ * *****************************************************************************/ @@ -25,12 +25,12 @@ #include "acpi.h" -#include "hardware.h" -#include "tables.h" +#include "achware.h" +#include "actables.h" #define _COMPONENT TABLE_MANAGER - MODULE_NAME ("tbinstal"); + MODULE_NAME ("tbinstal") /******************************************************************************* @@ -50,11 +50,9 @@ ACPI_STATUS acpi_tb_install_table ( - char *table_ptr, + ACPI_TABLE_HEADER *table_ptr, ACPI_TABLE_DESC *table_info) { - ACPI_TABLE_TYPE table_type; - ACPI_TABLE_HEADER *table_header; ACPI_STATUS status; @@ -68,11 +66,6 @@ return (status); } - /* Table type is returned by Recognize_table */ - - table_type = table_info->type; - table_header = table_info->pointer; - /* Lock tables while installing */ acpi_cm_acquire_mutex (ACPI_MTX_TABLES); @@ -80,12 +73,9 @@ /* Install the table into the global data structure */ status = acpi_tb_init_table_descriptor (table_info->type, table_info); - if (ACPI_FAILURE (status)) { - return (status); - } acpi_cm_release_mutex (ACPI_MTX_TABLES); - return (AE_OK); + return (status); } @@ -112,7 +102,7 @@ ACPI_STATUS acpi_tb_recognize_table ( - char *table_ptr, + ACPI_TABLE_HEADER *table_ptr, ACPI_TABLE_DESC *table_info) { ACPI_TABLE_HEADER *table_header; @@ -215,9 +205,10 @@ * the table are allowed. This includes SSDT and PSDTs. */ - if (acpi_gbl_acpi_table_data[table_type].flags == ACPI_TABLE_SINGLE) { + if (IS_SINGLE_TABLE (acpi_gbl_acpi_table_data[table_type].flags)) { /* - * Only one table allowed, just update the list head + * Only one table allowed, and a table has alread been installed + * at this location, so return an error. */ if (list_head->pointer) { @@ -249,7 +240,7 @@ /* Update new entry */ table_desc->prev = list_head->prev; - table_desc->next = (ACPI_TABLE_DESC *) list_head; + table_desc->next = list_head; /* Update list head */ @@ -308,7 +299,7 @@ void acpi_tb_delete_acpi_tables (void) { - u32 i; + ACPI_TABLE_TYPE type; /* @@ -316,8 +307,8 @@ * Memory can either be mapped or allocated */ - for (i = 0; i < ACPI_TABLE_MAX; i++) { - acpi_tb_delete_acpi_table (i); + for (type = 0; type < ACPI_TABLE_MAX; type++) { + acpi_tb_delete_acpi_table (type); } } @@ -402,6 +393,46 @@ /******************************************************************************* * + * FUNCTION: Acpi_tb_free_acpi_tables_of_type + * + * PARAMETERS: Table_info - A table info struct + * + * RETURN: None. + * + * DESCRIPTION: Free the memory associated with an internal ACPI table + * Table mutex should be locked. + * + ******************************************************************************/ + +void +acpi_tb_free_acpi_tables_of_type ( + ACPI_TABLE_DESC *list_head) +{ + ACPI_TABLE_DESC *table_desc; + u32 count; + u32 i; + + + /* Get the head of the list */ + + table_desc = list_head; + count = list_head->count; + + /* + * Walk the entire list, deleting both the allocated tables + * and the table descriptors + */ + + for (i = 0; i < count; i++) { + table_desc = acpi_tb_delete_single_table (table_desc); + } + + return; +} + + +/******************************************************************************* + * * FUNCTION: Acpi_tb_delete_single_table * * PARAMETERS: Table_info - A table info struct @@ -488,46 +519,6 @@ return (next_desc); -} - - -/******************************************************************************* - * - * FUNCTION: Acpi_tb_free_acpi_tables_of_type - * - * PARAMETERS: Table_info - A table info struct - * - * RETURN: None. - * - * DESCRIPTION: Free the memory associated with an internal ACPI table - * Table mutex should be locked. - * - ******************************************************************************/ - -void -acpi_tb_free_acpi_tables_of_type ( - ACPI_TABLE_DESC *list_head) -{ - ACPI_TABLE_DESC *table_desc; - u32 count; - u32 i; - - - /* Get the head of the list */ - - table_desc = list_head; - count = list_head->count; - - /* - * Walk the entire list, deleting both the allocated tables - * and the table descriptors - */ - - for (i = 0; i < count; i++) { - table_desc = acpi_tb_delete_single_table (table_desc); - } - - return; } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/tables/tbtable.c linux/drivers/acpi/tables/tbtable.c --- v2.4.0-test8/linux/drivers/acpi/tables/tbtable.c Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/tables/tbtable.c Fri Sep 15 14:30:30 2000 @@ -1,7 +1,7 @@ - /****************************************************************************** * * Module Name: tbtable - ACPI tables: FACP, FACS, and RSDP utilities + * $Revision: 24 $ * *****************************************************************************/ @@ -25,12 +25,12 @@ #include "acpi.h" -#include "hardware.h" -#include "tables.h" +#include "achware.h" +#include "actables.h" #define _COMPONENT TABLE_MANAGER - MODULE_NAME ("tbtable"); + MODULE_NAME ("tbtable") /******************************************************************************* @@ -38,7 +38,6 @@ * FUNCTION: Acpi_tb_get_table_rsdt * * PARAMETERS: Number_of_tables - Where the table count is placed - * Table_ptr - Input buffer pointer, optional * * RETURN: Status * @@ -85,15 +84,15 @@ 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); - if (ACPI_FAILURE (status)) { - return (status); - } /* Save the table pointers and allocation info */ @@ -109,10 +108,15 @@ status = acpi_tb_verify_table_checksum ((ACPI_TABLE_HEADER *) acpi_gbl_RSDT); - /* Determine the number of tables pointed to by the 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 = (s32) DIV_4 (acpi_gbl_RSDT->header.length - - sizeof (ACPI_TABLE_HEADER)); + *number_of_tables = ((acpi_gbl_RSDT->header.length - + sizeof (ACPI_TABLE_HEADER)) / sizeof (void *)); return (status); @@ -132,13 +136,13 @@ * ******************************************************************************/ -char * +u8 * acpi_tb_scan_memory_for_rsdp ( - char *start_address, + u8 *start_address, u32 length) { u32 offset; - char *mem_rover; + u8 *mem_rover; /* Search from given start addr for the requested length */ @@ -150,19 +154,19 @@ /* The signature and checksum must both be correct */ - if (STRNCMP (mem_rover, RSDP_SIG, sizeof (RSDP_SIG)-1) == 0 && + 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; + return (mem_rover); } } /* Searched entire block, no RSDP was found */ - return NULL; + return (NULL); } @@ -189,8 +193,8 @@ acpi_tb_find_rsdp ( ACPI_TABLE_DESC *table_info) { - char *table_ptr; - char *mem_rover; + u8 *table_ptr; + u8 *mem_rover; ACPI_STATUS status = AE_OK; if (acpi_gbl_acpi_init_data.RSDP_physical_address) { @@ -214,9 +218,9 @@ * The signature and checksum must both be correct */ - if (STRNCMP (table_ptr, RSDP_SIG, sizeof (RSDP_SIG)-1) != 0) { + 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); } @@ -226,7 +230,7 @@ sizeof (ROOT_SYSTEM_DESCRIPTOR_POINTER)) != 0) { /* Nope, BAD Checksum */ - + acpi_os_unmap_memory (table_ptr, sizeof (ROOT_SYSTEM_DESCRIPTOR_POINTER)); return (AE_BAD_CHECKSUM); } @@ -309,12 +313,12 @@ } -/******************************************************************************* +/****************************************************************************** * * FUNCTION: Acpi_tb_get_table_facs * - * PARAMETERS: *Buffer_ptr - If == NULL, read data from buffer - * rather than searching memory + * 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 @@ -324,11 +328,11 @@ * correctly initialized. The value of FACP->Firmware_ctrl * into a far pointer which is returned. * - ******************************************************************************/ + *****************************************************************************/ ACPI_STATUS acpi_tb_get_table_facs ( - char *buffer_ptr, + ACPI_TABLE_HEADER *buffer_ptr, ACPI_TABLE_DESC *table_info) { void *table_ptr = NULL; diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/tables/tbutils.c linux/drivers/acpi/tables/tbutils.c --- v2.4.0-test8/linux/drivers/acpi/tables/tbutils.c Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/tables/tbutils.c Fri Sep 15 14:30:30 2000 @@ -1,7 +1,7 @@ - /****************************************************************************** * * Module Name: tbutils - Table manipulation utilities + * $Revision: 26 $ * *****************************************************************************/ @@ -25,23 +25,24 @@ #include "acpi.h" -#include "tables.h" -#include "interp.h" +#include "actables.h" +#include "acinterp.h" #define _COMPONENT TABLE_MANAGER - MODULE_NAME ("tbutils"); + MODULE_NAME ("tbutils") /******************************************************************************* * - * FUNCTION: Acpi_tb_system_table_pointer + * FUNCTION: Acpi_tb_handle_to_object * - * PARAMETERS: *Where - Pointer to be examined + * PARAMETERS: Table_id - Id for which the function is searching + * Table_desc - Pointer to return the matching table + * descriptor. * - * RETURN: TRUE if Where is within the AML stream (in one of the ACPI - * system tables such as the DSDT or an SSDT.) - * FALSE otherwise + * RETURN: Search the tables to find one with a matching Table_id and + * return a pointer to that table descriptor. * ******************************************************************************/ @@ -60,7 +61,7 @@ { if (list_head->table_id == table_id) { *table_desc = list_head; - return AE_OK; + return (AE_OK); } list_head = list_head->next; @@ -69,7 +70,7 @@ } - return AE_BAD_PARAMETER; + return (AE_BAD_PARAMETER); } @@ -177,7 +178,7 @@ /* Verify that this is a valid address */ if (!acpi_os_readable (table_header, sizeof (ACPI_TABLE_HEADER))) { - return AE_BAD_ADDRESS; + return (AE_BAD_ADDRESS); } @@ -186,7 +187,7 @@ MOVE_UNALIGNED32_TO_32 (&signature, &table_header->signature); if (!acpi_cm_valid_acpi_name (signature)) { REPORT_WARNING ("Invalid table signature found"); - return AE_BAD_SIGNATURE; + return (AE_BAD_SIGNATURE); } @@ -194,10 +195,10 @@ if (table_header->length < sizeof (ACPI_TABLE_HEADER)) { REPORT_WARNING ("Invalid table header length found"); - return AE_BAD_HEADER; + return (AE_BAD_HEADER); } - return AE_OK; + return (AE_OK); } @@ -236,7 +237,7 @@ status = acpi_os_map_memory (physical_address, sizeof (ACPI_TABLE_HEADER), (void **) &table); if (ACPI_FAILURE (status)) { - return status; + return (status); } /* Extract the full table length before we delete the mapping */ @@ -257,7 +258,7 @@ /* Exit if header invalid */ if (ACPI_FAILURE (status)) { - return status; + return (status); } } @@ -266,13 +267,13 @@ status = acpi_os_map_memory (physical_address, table_size, (void **) &table); if (ACPI_FAILURE (status)) { - return status; + return (status); } *size = table_size; *logical_address = table; - return status; + return (status); } @@ -346,7 +347,7 @@ } } - return sum; + return (sum); } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/tables/tbxface.c linux/drivers/acpi/tables/tbxface.c --- v2.4.0-test8/linux/drivers/acpi/tables/tbxface.c Mon Jul 10 16:47:21 2000 +++ linux/drivers/acpi/tables/tbxface.c Fri Sep 15 14:30:30 2000 @@ -1,8 +1,8 @@ - /****************************************************************************** * * Module Name: tbxface - Public interfaces to the ACPI subsystem * ACPI table oriented interfaces + * $Revision: 24 $ * *****************************************************************************/ @@ -26,13 +26,13 @@ #include "acpi.h" -#include "namesp.h" -#include "interp.h" -#include "tables.h" +#include "acnamesp.h" +#include "acinterp.h" +#include "actables.h" #define _COMPONENT TABLE_MANAGER - MODULE_NAME ("tbxface"); + MODULE_NAME ("tbxface") /******************************************************************************* @@ -57,7 +57,7 @@ /* Get the RSDT first */ status = acpi_tb_get_table_rsdt (&number_of_tables); - if (status != AE_OK) { + if (ACPI_FAILURE (status)) { goto error_exit; } @@ -65,7 +65,7 @@ /* Now get the rest of the tables */ status = acpi_tb_get_all_tables (number_of_tables, NULL); - if (status != AE_OK) { + if (ACPI_FAILURE (status)) { goto error_exit; } @@ -105,12 +105,12 @@ if (!table_ptr) { - return AE_BAD_PARAMETER; + return (AE_BAD_PARAMETER); } /* Copy the table to a local buffer */ - status = acpi_tb_get_table (NULL, ((char *) table_ptr), &table_info); + status = acpi_tb_get_table (NULL, table_ptr, &table_info); if (ACPI_FAILURE (status)) { return (status); } @@ -157,7 +157,12 @@ list_head = &acpi_gbl_acpi_tables[table_type]; do { - /* Delete the entire namespace under this table NTE */ + /* + * Delete all namespace entries owned by this table. Note that these + * entries can appear anywhere in the namespace by virtue of the AML + * "Scope" operator. Thus, we need to track ownership by an ID, not + * simply a position within the hierarchy + */ acpi_ns_delete_namespace_by_owner (list_head->table_id); @@ -205,8 +210,6 @@ ACPI_STATUS status; - status = AE_OK; - if ((instance == 0) || (table_type == ACPI_TABLE_RSDP) || (!out_table_header)) @@ -217,7 +220,7 @@ /* Check the table type and instance */ if ((table_type > ACPI_TABLE_MAX) || - (acpi_gbl_acpi_table_data[table_type].flags == ACPI_TABLE_SINGLE && + (IS_SINGLE_TABLE (acpi_gbl_acpi_table_data[table_type].flags) && instance > 1)) { return (AE_BAD_PARAMETER); @@ -227,7 +230,7 @@ /* Get a pointer to the entire table */ status = acpi_tb_get_table_ptr (table_type, instance, &tbl_ptr); - if (status != AE_OK) { + if (ACPI_FAILURE (status)) { return (status); } @@ -285,8 +288,6 @@ u32 ret_buf_len; - status = AE_OK; - /* * Must have a buffer */ @@ -301,7 +302,7 @@ /* Check the table type and instance */ if ((table_type > ACPI_TABLE_MAX) || - (acpi_gbl_acpi_table_data[table_type].flags == ACPI_TABLE_SINGLE && + (IS_SINGLE_TABLE (acpi_gbl_acpi_table_data[table_type].flags) && instance > 1)) { return (AE_BAD_PARAMETER); @@ -311,12 +312,13 @@ /* Get a pointer to the entire table */ status = acpi_tb_get_table_ptr (table_type, instance, &tbl_ptr); - if (status != AE_OK) { + if (ACPI_FAILURE (status)) { return (status); } /* - * The function will return a NULL pointer if the table is not loaded + * Acpi_tb_get_table_ptr will return a NULL pointer if the + * table is not loaded. */ if (tbl_ptr == NULL) { return (AE_NOT_EXIST); diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/tables.c linux/drivers/acpi/tables.c --- v2.4.0-test8/linux/drivers/acpi/tables.c Fri Jul 14 12:12:08 2000 +++ linux/drivers/acpi/tables.c Wed Dec 31 16:00:00 1969 @@ -1,303 +0,0 @@ -/* - * tables.c - ACPI tables, chipset, and errata handling - * - * Copyright (C) 2000 Andrew Henroid - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include -#include -#include -#include -#include -#include "acpi.h" -#include "driver.h" - -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; -} - -/* - * Init VIA ACPI device and create a fake FACP - */ -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_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"); - return -ENODEV; - } - - if (acpi_facp.p_lvl2_lat - && acpi_facp.p_lvl2_lat <= ACPI_MAX_P_LVL2_LAT) { - acpi_c2_exit_latency - = ACPI_uS_TO_TMR_TICKS(acpi_facp.p_lvl2_lat); - acpi_c2_enter_latency - = ACPI_uS_TO_TMR_TICKS(ACPI_TMR_HZ / 1000); - } - if (acpi_facp.p_lvl3_lat - && acpi_facp.p_lvl3_lat <= ACPI_MAX_P_LVL3_LAT) { - acpi_c3_exit_latency - = ACPI_uS_TO_TMR_TICKS(acpi_facp.p_lvl3_lat); - acpi_c3_enter_latency - = ACPI_uS_TO_TMR_TICKS(acpi_facp.p_lvl3_lat * 5); - } - - return 0; -} - -/* - * Find and load ACPI tables - */ -int -acpi_load_tables(void) -{ - if (ACPI_SUCCESS(acpi_load_firmware_tables())) - { - printk(KERN_INFO "ACPI: support found\n"); - } - else if (acpi_find_chipset()) { - acpi_terminate(); - return -1; - } - - if (acpi_fetch_facp()) { - acpi_terminate(); - return -1; - } - - if (!ACPI_SUCCESS(acpi_load_namespace())) { - printk(KERN_ERR "ACPI: namespace load failed\n"); - acpi_terminate(); - return -1; - } - - return 0; -} diff -u --recursive --new-file v2.4.0-test8/linux/drivers/char/drm/drmP.h linux/drivers/char/drm/drmP.h --- v2.4.0-test8/linux/drivers/char/drm/drmP.h Fri Sep 8 13:27:11 2000 +++ linux/drivers/char/drm/drmP.h Fri Sep 15 18:24:17 2000 @@ -33,6 +33,12 @@ #define _DRM_P_H_ #ifdef __KERNEL__ +#ifdef __alpha__ +/* add include of current.h so that "current" is defined + * before static inline funcs in wait.h. Doing this so we + * can build the DRM (part of PI DRI). 4/21/2000 S + B */ +#include +#endif /* __alpha__ */ #include #include #include @@ -47,6 +53,9 @@ #include #include /* For (un)lock_kernel */ #include +#ifdef __alpha__ +#include /* For pte_wrprotect */ +#endif #include #include #include @@ -147,6 +156,71 @@ #ifndef __HAVE_ARCH_CMPXCHG /* Include this here so that driver can be used with older kernels. */ +#if defined(__alpha__) +static __inline__ unsigned long +__cmpxchg_u32(volatile int *m, int old, int new) +{ + unsigned long prev, cmp; + + __asm__ __volatile__( + "1: ldl_l %0,%2\n" + " cmpeq %0,%3,%1\n" + " beq %1,2f\n" + " mov %4,%1\n" + " stl_c %1,%2\n" + " beq %1,3f\n" + "2: mb\n" + ".subsection 2\n" + "3: br 1b\n" + ".previous" + : "=&r"(prev), "=&r"(cmp), "=m"(*m) + : "r"((long) old), "r"(new), "m"(*m)); + + return prev; +} + +static __inline__ unsigned long +__cmpxchg_u64(volatile long *m, unsigned long old, unsigned long new) +{ + unsigned long prev, cmp; + + __asm__ __volatile__( + "1: ldq_l %0,%2\n" + " cmpeq %0,%3,%1\n" + " beq %1,2f\n" + " mov %4,%1\n" + " stq_c %1,%2\n" + " beq %1,3f\n" + "2: mb\n" + ".subsection 2\n" + "3: br 1b\n" + ".previous" + : "=&r"(prev), "=&r"(cmp), "=m"(*m) + : "r"((long) old), "r"(new), "m"(*m)); + + return prev; +} + +static __inline__ unsigned long +__cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size) +{ + switch (size) { + case 4: + return __cmpxchg_u32(ptr, old, new); + case 8: + return __cmpxchg_u64(ptr, old, new); + } + return old; +} +#define cmpxchg(ptr,o,n) \ + ({ \ + __typeof__(*(ptr)) _o_ = (o); \ + __typeof__(*(ptr)) _n_ = (n); \ + (__typeof__(*(ptr))) __cmpxchg((ptr), (unsigned long)_o_, \ + (unsigned long)_n_, sizeof(*(ptr))); \ + }) + +#elif __i386__ static inline unsigned long __cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size) { @@ -177,6 +251,7 @@ #define cmpxchg(ptr,o,n) \ ((__typeof__(*(ptr)))__cmpxchg((ptr),(unsigned long)(o), \ (unsigned long)(n),sizeof(*(ptr)))) +#endif /* i386 & alpha */ #endif /* Macros to make printk easier */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/char/drm/gamma_drv.c linux/drivers/char/drm/gamma_drv.c --- v2.4.0-test8/linux/drivers/char/drm/gamma_drv.c Fri Sep 8 13:27:11 2000 +++ linux/drivers/char/drm/gamma_drv.c Fri Sep 15 14:24:55 2000 @@ -11,11 +11,11 @@ * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: - * + * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL @@ -23,7 +23,7 @@ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. - * + * * Authors: * Rickard E. (Rik) Faith * @@ -42,7 +42,7 @@ #define GAMMA_NAME "gamma" #define GAMMA_DESC "3dlabs GMX 2000" -#define GAMMA_DATE "20000719" +#define GAMMA_DATE "20000910" #define GAMMA_MAJOR 1 #define GAMMA_MINOR 0 #define GAMMA_PATCHLEVEL 0 @@ -87,7 +87,7 @@ [DRM_IOCTL_NR(DRM_IOCTL_INFO_BUFS)] = { drm_infobufs, 1, 0 }, [DRM_IOCTL_NR(DRM_IOCTL_MAP_BUFS)] = { drm_mapbufs, 1, 0 }, [DRM_IOCTL_NR(DRM_IOCTL_FREE_BUFS)] = { drm_freebufs, 1, 0 }, - + [DRM_IOCTL_NR(DRM_IOCTL_ADD_CTX)] = { drm_addctx, 1, 1 }, [DRM_IOCTL_NR(DRM_IOCTL_RM_CTX)] = { drm_rmctx, 1, 1 }, [DRM_IOCTL_NR(DRM_IOCTL_MOD_CTX)] = { drm_modctx, 1, 1 }, @@ -120,7 +120,7 @@ * passed via the boot-loader (e.g., LILO). It calls the insmod option * routine, drm_parse_options. */ - + static int __init gamma_options(char *str) { @@ -134,7 +134,7 @@ static int gamma_setup(drm_device_t *dev) { int i; - + atomic_set(&dev->ioctl_count, 0); atomic_set(&dev->vma_count, 0); dev->buf_use = 0; @@ -179,22 +179,22 @@ #endif dev->ctx_start = 0; dev->lck_start = 0; - + dev->buf_rp = dev->buf; dev->buf_wp = dev->buf; dev->buf_end = dev->buf + DRM_BSZ; dev->buf_async = NULL; init_waitqueue_head(&dev->buf_readers); init_waitqueue_head(&dev->buf_writers); - + DRM_DEBUG("\n"); - + /* The kernel's context could be created here, but is now created in drm_dma_enqueue. This is more resource-efficient for hardware that does not do DMA, but may mean that drm_select_queue fails between the time the interrupt is initialized and the time the queues are initialized. */ - + return 0; } @@ -209,15 +209,15 @@ DRM_DEBUG("\n"); if (dev->irq) gamma_irq_uninstall(dev); - + down(&dev->struct_sem); del_timer(&dev->timer); - + if (dev->devname) { drm_free(dev->devname, strlen(dev->devname)+1, DRM_MEM_DRIVER); dev->devname = NULL; } - + if (dev->unique) { drm_free(dev->unique, strlen(dev->unique)+1, DRM_MEM_DRIVER); dev->unique = NULL; @@ -231,7 +231,7 @@ } dev->magiclist[i].head = dev->magiclist[i].tail = NULL; } - + /* Clear vma list (only built for debugging) */ if (dev->vmalist) { for (vma = dev->vmalist; vma; vma = vma_next) { @@ -240,7 +240,7 @@ } dev->vmalist = NULL; } - + /* Clear map area and mtrr information */ if (dev->maplist) { for (i = 0; i < dev->map_count; i++) { @@ -278,7 +278,7 @@ dev->maplist = NULL; dev->map_count = 0; } - + if (dev->queuelist) { for (i = 0; i < dev->queue_count; i++) { drm_waitlist_destroy(&dev->queuelist[i]->waitlist); @@ -304,7 +304,7 @@ wake_up_interruptible(&dev->lock.lock_queue); } up(&dev->struct_sem); - + return 0; } @@ -349,7 +349,7 @@ memset((void *)dev, 0, sizeof(*dev)); dev->count_lock = SPIN_LOCK_UNLOCKED; sema_init(&dev->struct_sem, 1); - + #ifdef MODULE drm_parse_options(gamma); #endif @@ -374,7 +374,7 @@ GAMMA_DATE, gamma_misc.minor, devices); - + return 0; } @@ -385,7 +385,7 @@ drm_device_t *dev = &gamma_device; DRM_DEBUG("\n"); - + drm_proc_cleanup(); if (misc_deregister(&gamma_misc)) { DRM_ERROR("Cannot unload module\n"); @@ -438,7 +438,7 @@ { drm_device_t *dev = &gamma_device; int retcode = 0; - + DRM_DEBUG("open_count = %d\n", dev->open_count); if (!(retcode = drm_open_helper(inode, filp, dev))) { #if LINUX_VERSION_CODE < 0x020333 @@ -505,7 +505,7 @@ atomic_inc(&dev->ioctl_count); atomic_inc(&dev->total_ioctl); ++priv->ioctl_count; - + DRM_DEBUG("pid = %d, cmd = 0x%02x, nr = 0x%02x, dev 0x%x, auth = %d\n", current->pid, cmd, nr, dev->device, priv->authenticated); @@ -525,7 +525,7 @@ retcode = (func)(inode, filp, cmd, arg); } } - + atomic_dec(&dev->ioctl_count); return retcode; } @@ -540,7 +540,7 @@ if (copy_from_user(&lock, (drm_lock_t *)arg, sizeof(lock))) return -EFAULT; - + if (lock.context == DRM_KERNEL_CONTEXT) { DRM_ERROR("Process %d using kernel context %d\n", current->pid, lock.context); @@ -565,7 +565,7 @@ atomic_inc(&dev->histo.lhld[drm_histogram_slot(get_cycles() - dev->lck_start)]); #endif - + unblock_all_signals(); return 0; } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/char/drm/i810_drv.c linux/drivers/char/drm/i810_drv.c --- v2.4.0-test8/linux/drivers/char/drm/i810_drv.c Fri Sep 8 13:27:11 2000 +++ linux/drivers/char/drm/i810_drv.c Fri Sep 15 14:24:55 2000 @@ -1,6 +1,6 @@ /* i810_drv.c -- I810 driver -*- linux-c -*- * Created: Mon Dec 13 01:56:22 1999 by jhartmann@precisioninsight.com - * + * * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. * All Rights Reserved. @@ -11,11 +11,11 @@ * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: - * + * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL @@ -35,7 +35,7 @@ #define I810_NAME "i810" #define I810_DESC "Intel I810" -#define I810_DATE "20000719" +#define I810_DATE "20000910" #define I810_MAJOR 1 #define I810_MINOR 1 #define I810_PATCHLEVEL 0 @@ -143,7 +143,7 @@ static int i810_setup(drm_device_t *dev) { int i; - + atomic_set(&dev->ioctl_count, 0); atomic_set(&dev->vma_count, 0); dev->buf_use = 0; @@ -188,22 +188,22 @@ #endif dev->ctx_start = 0; dev->lck_start = 0; - + dev->buf_rp = dev->buf; dev->buf_wp = dev->buf; dev->buf_end = dev->buf + DRM_BSZ; dev->buf_async = NULL; init_waitqueue_head(&dev->buf_readers); init_waitqueue_head(&dev->buf_writers); - + DRM_DEBUG("\n"); - + /* The kernel's context could be created here, but is now created in drm_dma_enqueue. This is more resource-efficient for hardware that does not do DMA, but may mean that drm_select_queue fails between the time the interrupt is initialized and the time the queues are initialized. */ - + return 0; } @@ -218,15 +218,15 @@ DRM_DEBUG("\n"); if (dev->irq) i810_irq_uninstall(dev); - + down(&dev->struct_sem); del_timer(&dev->timer); - + if (dev->devname) { drm_free(dev->devname, strlen(dev->devname)+1, DRM_MEM_DRIVER); dev->devname = NULL; } - + if (dev->unique) { drm_free(dev->unique, strlen(dev->unique)+1, DRM_MEM_DRIVER); dev->unique = NULL; @@ -244,7 +244,7 @@ if (dev->agp) { drm_agp_mem_t *entry; drm_agp_mem_t *nexte; - + /* Remove AGP resources, but leave dev->agp intact until r128_cleanup is called. */ for (entry = dev->agp->memory; entry; entry = nexte) { @@ -254,10 +254,10 @@ drm_free(entry, sizeof(*entry), DRM_MEM_AGPLISTS); } dev->agp->memory = NULL; - + if (dev->agp->acquired && drm_agp.release) (*drm_agp.release)(); - + dev->agp->acquired = 0; dev->agp->enabled = 0; } @@ -269,7 +269,7 @@ } dev->vmalist = NULL; } - + /* Clear map area and mtrr information */ if (dev->maplist) { for (i = 0; i < dev->map_count; i++) { @@ -305,7 +305,7 @@ dev->maplist = NULL; dev->map_count = 0; } - + if (dev->queuelist) { for (i = 0; i < dev->queue_count; i++) { drm_waitlist_destroy(&dev->queuelist[i]->waitlist); @@ -331,7 +331,7 @@ wake_up_interruptible(&dev->lock.lock_queue); } up(&dev->struct_sem); - + return 0; } @@ -348,7 +348,7 @@ memset((void *)dev, 0, sizeof(*dev)); dev->count_lock = SPIN_LOCK_UNLOCKED; sema_init(&dev->struct_sem, 1); - + #ifdef MODULE drm_parse_options(i810); #endif @@ -402,7 +402,7 @@ drm_device_t *dev = &i810_device; DRM_DEBUG("\n"); - + drm_proc_cleanup(); if (misc_deregister(&i810_misc)) { DRM_ERROR("Cannot unload module\n"); @@ -461,7 +461,7 @@ { drm_device_t *dev = &i810_device; int retcode = 0; - + DRM_DEBUG("open_count = %d\n", dev->open_count); if (!(retcode = drm_open_helper(inode, filp, dev))) { #if LINUX_VERSION_CODE < 0x020333 @@ -498,7 +498,7 @@ drm_lock_free(dev, &dev->lock.hw_lock->lock, _DRM_LOCKING_CONTEXT(dev->lock.hw_lock->lock)); - + /* FIXME: may require heavy-handed reset of hardware at this point, possibly processed via a callback to the X @@ -519,7 +519,7 @@ dev->lock.lock_time = jiffies; atomic_inc(&dev->total_locks); break; /* Got lock */ - } + } /* Contention */ atomic_inc(&dev->total_sleeps); current->state = TASK_INTERRUPTIBLE; @@ -545,7 +545,7 @@ if (priv->next) priv->next->prev = priv->prev; else dev->file_last = priv->prev; up(&dev->struct_sem); - + drm_free(priv, sizeof(*priv), DRM_MEM_FILES); #if LINUX_VERSION_CODE < 0x020333 MOD_DEC_USE_COUNT; /* Needed before Linux 2.3.51 */ @@ -585,7 +585,7 @@ atomic_inc(&dev->ioctl_count); atomic_inc(&dev->total_ioctl); ++priv->ioctl_count; - + DRM_DEBUG("pid = %d, cmd = 0x%02x, nr = 0x%02x, dev 0x%x, auth = %d\n", current->pid, cmd, nr, dev->device, priv->authenticated); @@ -605,7 +605,7 @@ retcode = (func)(inode, filp, cmd, arg); } } - + atomic_dec(&dev->ioctl_count); return retcode; } @@ -619,7 +619,7 @@ if (copy_from_user(&lock, (drm_lock_t *)arg, sizeof(lock))) return -EFAULT; - + if (lock.context == DRM_KERNEL_CONTEXT) { DRM_ERROR("Process %d using kernel context %d\n", current->pid, lock.context); @@ -643,7 +643,7 @@ atomic_inc(&dev->histo.lhld[drm_histogram_slot(get_cycles() - dev->lck_start)]); #endif - + unblock_all_signals(); return 0; } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/char/drm/mga_dma.c linux/drivers/char/drm/mga_dma.c --- v2.4.0-test8/linux/drivers/char/drm/mga_dma.c Fri Sep 8 13:27:11 2000 +++ linux/drivers/char/drm/mga_dma.c Fri Sep 15 14:24:55 2000 @@ -11,11 +11,11 @@ * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: - * + * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL @@ -51,7 +51,7 @@ static unsigned long mga_alloc_page(drm_device_t *dev) { unsigned long address; - + DRM_DEBUG("%s\n", __FUNCTION__); address = __get_free_page(GFP_KERNEL); if(address == 0UL) { @@ -59,7 +59,7 @@ } atomic_inc(&virt_to_page(address)->count); set_bit(PG_locked, &virt_to_page(address)->flags); - + return address; } @@ -82,23 +82,6 @@ return; } -#ifdef __i386__ -void mga_flush_write_combine(void) -{ - int xchangeDummy; - DRM_DEBUG("%s\n", __FUNCTION__); - - __asm__ volatile(" push %%eax ; xchg %%eax, %0 ; pop %%eax" : : "m" (xchangeDummy)); - __asm__ volatile(" push %%eax ; push %%ebx ; push %%ecx ; push %%edx ;" - " movl $0,%%eax ; cpuid ; pop %%edx ; pop %%ecx ; pop %%ebx ;" - " pop %%eax" : /* no outputs */ : /* no inputs */ ); -} -#else -void mga_flush_write_combine(void) -{ -} -#endif - /* These are two age tags that will never be sent to * the hardware */ #define MGA_BUF_USED 0xffffffff @@ -119,7 +102,7 @@ if(dev_priv->head == NULL) return -ENOMEM; memset(dev_priv->head, 0, sizeof(drm_mga_freelist_t)); dev_priv->head->age = MGA_BUF_USED; - + for (i = 0; i < dma->buf_count; i++) { buf = dma->buflist[ i ]; buf_priv = buf->dev_private; @@ -139,7 +122,7 @@ buf_priv->dispatched = 0; dev_priv->head->next = item; } - + return 0; } @@ -157,7 +140,7 @@ item = item->next; drm_free(prev, sizeof(drm_mga_freelist_t), DRM_MEM_DRIVER); } - + dev_priv->head = dev_priv->tail = NULL; } @@ -173,15 +156,15 @@ DRM_DEBUG("%s\n", __FUNCTION__); end = jiffies + (HZ*3); while(1) { - if(!test_and_set_bit(MGA_IN_DISPATCH, + if(!test_and_set_bit(MGA_IN_DISPATCH, &dev_priv->dispatch_status)) { break; } if((signed)(end - jiffies) <= 0) { - DRM_ERROR("irqs: %d wanted %d\n", - atomic_read(&dev->total_irq), + DRM_ERROR("irqs: %d wanted %d\n", + atomic_read(&dev->total_irq), atomic_read(&dma->total_lost)); - DRM_ERROR("lockup\n"); + DRM_ERROR("lockup\n"); goto out_nolock; } for (i = 0 ; i < 2000 ; i++) mga_delay(); @@ -190,13 +173,13 @@ DRM_DEBUG("quiescent status : %x\n", MGA_READ(MGAREG_STATUS)); while((MGA_READ(MGAREG_STATUS) & 0x00030001) != 0x00020000) { if((signed)(end - jiffies) <= 0) { - DRM_ERROR("irqs: %d wanted %d\n", - atomic_read(&dev->total_irq), + DRM_ERROR("irqs: %d wanted %d\n", + atomic_read(&dev->total_irq), atomic_read(&dma->total_lost)); - DRM_ERROR("lockup\n"); + DRM_ERROR("lockup\n"); goto out_status; } - for (i = 0 ; i < 2000 ; i++) mga_delay(); + for (i = 0 ; i < 2000 ; i++) mga_delay(); } sarea_priv->dirty |= MGA_DMA_FLUSH; @@ -220,13 +203,13 @@ } /* Least recently used : - * These operations are not atomic b/c they are protected by the + * These operations are not atomic b/c they are protected by the * hardware lock */ drm_buf_t *mga_freelist_get(drm_device_t *dev) { DECLARE_WAITQUEUE(entry, current); - drm_mga_private_t *dev_priv = + drm_mga_private_t *dev_priv = (drm_mga_private_t *) dev->dev_private; drm_mga_freelist_t *prev; drm_mga_freelist_t *next; @@ -234,17 +217,17 @@ DRM_DEBUG("%s : tail->age : %d last_prim_age : %d\n", __FUNCTION__, dev_priv->tail->age, dev_priv->last_prim_age); - + if(failed >= 1000 && dev_priv->tail->age >= dev_priv->last_prim_age) { - DRM_DEBUG("I'm waiting on the freelist!!! %d\n", + DRM_DEBUG("I'm waiting on the freelist!!! %d\n", dev_priv->last_prim_age); set_bit(MGA_IN_GETBUF, &dev_priv->dispatch_status); current->state = TASK_INTERRUPTIBLE; add_wait_queue(&dev_priv->buf_queue, &entry); for (;;) { mga_dma_schedule(dev, 0); - if(!test_bit(MGA_IN_GETBUF, - &dev_priv->dispatch_status)) + if(!test_bit(MGA_IN_GETBUF, + &dev_priv->dispatch_status)) break; atomic_inc(&dev->total_sleeps); schedule(); @@ -257,7 +240,7 @@ current->state = TASK_RUNNING; remove_wait_queue(&dev_priv->buf_queue, &entry); } - + if(dev_priv->tail->age < dev_priv->last_prim_age) { prev = dev_priv->tail->prev; next = dev_priv->tail; @@ -276,7 +259,7 @@ int mga_freelist_put(drm_device_t *dev, drm_buf_t *buf) { - drm_mga_private_t *dev_priv = + drm_mga_private_t *dev_priv = (drm_mga_private_t *) dev->dev_private; drm_mga_buf_priv_t *buf_priv = buf->dev_private; drm_mga_freelist_t *prev; @@ -307,7 +290,7 @@ next->prev = head; next->next = prev; } - + return 0; } @@ -319,41 +302,41 @@ int offset = init->reserved_map_agpstart; DRM_DEBUG("%s\n", __FUNCTION__); - dev_priv->primary_size = ((init->primary_size + PAGE_SIZE - 1) / + dev_priv->primary_size = ((init->primary_size + PAGE_SIZE - 1) / PAGE_SIZE) * PAGE_SIZE; size_of_buf = dev_priv->primary_size / MGA_NUM_PRIM_BUFS; dev_priv->warp_ucode_size = init->warp_ucode_size; - dev_priv->prim_bufs = drm_alloc(sizeof(drm_mga_prim_buf_t *) * - (MGA_NUM_PRIM_BUFS + 1), + dev_priv->prim_bufs = drm_alloc(sizeof(drm_mga_prim_buf_t *) * + (MGA_NUM_PRIM_BUFS + 1), DRM_MEM_DRIVER); if(dev_priv->prim_bufs == NULL) { DRM_ERROR("Unable to allocate memory for prim_buf\n"); return -ENOMEM; } - memset(dev_priv->prim_bufs, + memset(dev_priv->prim_bufs, 0, sizeof(drm_mga_prim_buf_t *) * (MGA_NUM_PRIM_BUFS + 1)); - + temp = init->warp_ucode_size + dev_priv->primary_size; temp = ((temp + PAGE_SIZE - 1) / PAGE_SIZE) * PAGE_SIZE; - - dev_priv->ioremap = drm_ioremap(dev->agp->base + offset, + + dev_priv->ioremap = drm_ioremap(dev->agp->base + offset, temp); if(dev_priv->ioremap == NULL) { DRM_DEBUG("Ioremap failed\n"); return -ENOMEM; } init_waitqueue_head(&dev_priv->wait_queue); - + for(i = 0; i < MGA_NUM_PRIM_BUFS; i++) { - prim_buffer = drm_alloc(sizeof(drm_mga_prim_buf_t), + prim_buffer = drm_alloc(sizeof(drm_mga_prim_buf_t), DRM_MEM_DRIVER); if(prim_buffer == NULL) return -ENOMEM; memset(prim_buffer, 0, sizeof(drm_mga_prim_buf_t)); prim_buffer->phys_head = offset + dev->agp->base; - prim_buffer->current_dma_ptr = - prim_buffer->head = - (u32 *) (dev_priv->ioremap + - offset - + prim_buffer->current_dma_ptr = + prim_buffer->head = + (u32 *) (dev_priv->ioremap + + offset - init->reserved_map_agpstart); prim_buffer->num_dwords = 0; prim_buffer->max_dwords = size_of_buf / sizeof(u32); @@ -365,11 +348,11 @@ dev_priv->prim_bufs[i] = prim_buffer; } dev_priv->current_prim_idx = 0; - dev_priv->next_prim = - dev_priv->last_prim = + dev_priv->next_prim = + dev_priv->last_prim = dev_priv->current_prim = dev_priv->prim_bufs[0]; - dev_priv->next_prim_age = 2; + dev_priv->next_prim_age = 2; dev_priv->last_prim_age = 1; set_bit(MGA_BUF_IN_USE, &dev_priv->current_prim->buffer_status); return 0; @@ -388,11 +371,11 @@ DRM_DEBUG("%s\n", __FUNCTION__); dev_priv->last_prim = prim; - + /* We never check for overflow, b/c there is always room */ PRIMPTR(prim); if(num_dwords <= 0) { - DRM_DEBUG("num_dwords == 0 when dispatched\n"); + DRM_ERROR("num_dwords == 0 when dispatched\n"); goto out_prim_wait; } PRIMOUTREG( MGAREG_DMAPAD, 0); @@ -403,17 +386,17 @@ end = jiffies + (HZ*3); if(sarea_priv->dirty & MGA_DMA_FLUSH) { - DRM_DEBUG("Dma top flush\n"); + DRM_DEBUG("Dma top flush\n"); while((MGA_READ(MGAREG_STATUS) & 0x00030001) != 0x00020000) { if((signed)(end - jiffies) <= 0) { - DRM_ERROR("irqs: %d wanted %d\n", - atomic_read(&dev->total_irq), + DRM_ERROR("irqs: %d wanted %d\n", + atomic_read(&dev->total_irq), atomic_read(&dma->total_lost)); DRM_ERROR("lockup in fire primary " "(Dma Top Flush)\n"); goto out_prim_wait; } - + for (i = 0 ; i < 4096 ; i++) mga_delay(); } sarea_priv->dirty &= ~(MGA_DMA_FLUSH); @@ -421,14 +404,14 @@ DRM_DEBUG("Status wait\n"); while((MGA_READ(MGAREG_STATUS) & 0x00020001) != 0x00020000) { if((signed)(end - jiffies) <= 0) { - DRM_ERROR("irqs: %d wanted %d\n", - atomic_read(&dev->total_irq), + DRM_ERROR("irqs: %d wanted %d\n", + atomic_read(&dev->total_irq), atomic_read(&dma->total_lost)); DRM_ERROR("lockup in fire primary " "(Status Wait)\n"); goto out_prim_wait; } - + for (i = 0 ; i < 4096 ; i++) mga_delay(); } } @@ -439,9 +422,9 @@ MGA_WRITE(MGAREG_PRIMEND, (phys_head + num_dwords * 4) | use_agp); prim->num_dwords = 0; sarea_priv->last_enqueue = prim->prim_age; - + next_idx = prim->idx + 1; - if(next_idx >= MGA_NUM_PRIM_BUFS) + if(next_idx >= MGA_NUM_PRIM_BUFS) next_idx = 0; dev_priv->next_prim = dev_priv->prim_bufs[next_idx]; @@ -464,28 +447,28 @@ drm_device_dma_t *dma = dev->dma; int next_prim_idx; int ret = 0; - + /* This needs to reset the primary buffer if available, * we should collect stats on how many times it bites * it's tail */ DRM_DEBUG("%s\n", __FUNCTION__); - + next_prim_idx = dev_priv->current_prim_idx + 1; if(next_prim_idx >= MGA_NUM_PRIM_BUFS) next_prim_idx = 0; prim_buffer = dev_priv->prim_bufs[next_prim_idx]; set_bit(MGA_IN_WAIT, &dev_priv->dispatch_status); - + /* In use is cleared in interrupt handler */ - + if(test_and_set_bit(MGA_BUF_IN_USE, &prim_buffer->buffer_status)) { add_wait_queue(&dev_priv->wait_queue, &entry); current->state = TASK_INTERRUPTIBLE; for (;;) { mga_dma_schedule(dev, 0); - if(!test_and_set_bit(MGA_BUF_IN_USE, - &prim_buffer->buffer_status)) + if(!test_and_set_bit(MGA_BUF_IN_USE, + &prim_buffer->buffer_status)) break; atomic_inc(&dev->total_sleeps); atomic_inc(&dma->total_missed_sched); @@ -547,9 +530,9 @@ atomic_inc(&dma->total_prio); return 1; } - + if(atomic_read(&dev_priv->pending_bufs) <= MGA_NUM_PRIM_BUFS - 1) { - if(test_bit(MGA_BUF_SWAP_PENDING, + if(test_bit(MGA_BUF_SWAP_PENDING, &dev_priv->next_prim->buffer_status)) { atomic_inc(&dma->total_dmas); return 1; @@ -585,16 +568,16 @@ retval = -EBUSY; goto sch_out_wakeup; } - + DRM_DEBUG("%s\n", __FUNCTION__); - if(test_bit(MGA_IN_FLUSH, &dev_priv->dispatch_status) || + if(test_bit(MGA_IN_FLUSH, &dev_priv->dispatch_status) || test_bit(MGA_IN_WAIT, &dev_priv->dispatch_status) || test_bit(MGA_IN_GETBUF, &dev_priv->dispatch_status)) { locked = 1; } - - if (!locked && + + if (!locked && !drm_lock_take(&dev->lock.hw_lock->lock, DRM_KERNEL_CONTEXT)) { atomic_inc(&dma->total_missed_lock); clear_bit(0, &dev->dma_flag); @@ -608,7 +591,7 @@ /* Fire dma buffer */ if(mga_decide_to_fire(dev)) { DRM_DEBUG("idx :%d\n", dev_priv->next_prim->idx); - clear_bit(MGA_BUF_FORCE_FIRE, + clear_bit(MGA_BUF_FORCE_FIRE, &dev_priv->next_prim->buffer_status); if(dev_priv->current_prim == dev_priv->next_prim) { /* Schedule overflow for a later time */ @@ -622,7 +605,7 @@ } else { DRM_DEBUG("I can't get the dispatch lock\n"); } - + if (!locked) { if (drm_lock_free(dev, &dev->lock.hw_lock->lock, DRM_KERNEL_CONTEXT)) { @@ -644,8 +627,8 @@ DRM_DEBUG("Waking up buf queue\n"); wake_up_interruptible(&dev_priv->buf_queue); } else if (test_bit(MGA_IN_GETBUF, &dev_priv->dispatch_status)) { - DRM_DEBUG("Not waking buf_queue on %d %d\n", - atomic_read(&dev->total_irq), + DRM_DEBUG("Not waking buf_queue on %d %d\n", + atomic_read(&dev->total_irq), dev_priv->last_prim_age); } @@ -666,7 +649,7 @@ last_prim_buffer = dev_priv->last_prim; last_prim_buffer->num_dwords = 0; last_prim_buffer->sec_used = 0; - dev_priv->sarea_priv->last_dispatch = + dev_priv->sarea_priv->last_dispatch = dev_priv->last_prim_age = last_prim_buffer->prim_age; clear_bit(MGA_BUF_IN_USE, &last_prim_buffer->buffer_status); wake_up_interruptible(&dev_priv->wait_queue); @@ -688,12 +671,12 @@ DRM_DEBUG("%s\n", __FUNCTION__); if(dev->dev_private) { - drm_mga_private_t *dev_priv = + drm_mga_private_t *dev_priv = (drm_mga_private_t *) dev->dev_private; - + if(dev_priv->ioremap) { - int temp = (dev_priv->warp_ucode_size + - dev_priv->primary_size + + int temp = (dev_priv->warp_ucode_size + + dev_priv->primary_size + PAGE_SIZE - 1) / PAGE_SIZE * PAGE_SIZE; drm_ioremapfree((void *) dev_priv->ioremap, temp); @@ -714,7 +697,7 @@ } } drm_free(dev_priv->prim_bufs, sizeof(void *) * - (MGA_NUM_PRIM_BUFS + 1), + (MGA_NUM_PRIM_BUFS + 1), DRM_MEM_DRIVER); } if(dev_priv->head != NULL) { @@ -722,7 +705,7 @@ } - drm_free(dev->dev_private, sizeof(drm_mga_private_t), + drm_free(dev->dev_private, sizeof(drm_mga_private_t), DRM_MEM_DRIVER); dev->dev_private = NULL; } @@ -749,12 +732,12 @@ DRM_DEBUG("reserved_map or buffer_map are invalid\n"); return -EINVAL; } - + dev_priv->reserved_map_idx = init->reserved_map_idx; dev_priv->buffer_map_idx = init->buffer_map_idx; sarea_map = dev->maplist[0]; - dev_priv->sarea_priv = (drm_mga_sarea_t *) - ((u8 *)sarea_map->handle + + dev_priv->sarea_priv = (drm_mga_sarea_t *) + ((u8 *)sarea_map->handle + init->sarea_priv_offset); /* Scale primary size to the next page */ @@ -772,20 +755,21 @@ init_waitqueue_head(&dev_priv->flush_queue); init_waitqueue_head(&dev_priv->buf_queue); dev_priv->WarpPipe = 0xff000000; + dev_priv->vertexsize = 0; DRM_DEBUG("chipset: %d ucode_size: %d backOffset: %x depthOffset: %x\n", - dev_priv->chipset, dev_priv->warp_ucode_size, + dev_priv->chipset, dev_priv->warp_ucode_size, dev_priv->backOffset, dev_priv->depthOffset); DRM_DEBUG("cpp: %d sgram: %d stride: %d maccess: %x\n", - dev_priv->cpp, dev_priv->sgram, dev_priv->stride, + dev_priv->cpp, dev_priv->sgram, dev_priv->stride, dev_priv->mAccess); - - memcpy(&dev_priv->WarpIndex, &init->WarpIndex, + + memcpy(&dev_priv->WarpIndex, &init->WarpIndex, sizeof(drm_mga_warp_index_t) * MGA_MAX_WARP_PIPES); - for (i = 0 ; i < MGA_MAX_WARP_PIPES ; i++) + for (i = 0 ; i < MGA_MAX_WARP_PIPES ; i++) DRM_DEBUG("warp pipe %d: installed: %d phys: %lx size: %x\n", - i, + i, dev_priv->WarpIndex[i].installed, dev_priv->WarpIndex[i].phys_addr, dev_priv->WarpIndex[i].size); @@ -802,7 +786,7 @@ return -ENOMEM; } - dev_priv->status_page = + dev_priv->status_page = ioremap_nocache(virt_to_bus((void *)dev_priv->real_status_page), PAGE_SIZE); @@ -813,15 +797,15 @@ } /* Write status page when secend or softrap occurs */ - MGA_WRITE(MGAREG_PRIMPTR, + MGA_WRITE(MGAREG_PRIMPTR, virt_to_bus((void *)dev_priv->real_status_page) | 0x00000003); - + /* Private is now filled in, initialize the hardware */ { PRIMLOCALS; PRIMGETPTR( dev_priv ); - + PRIMOUTREG(MGAREG_DMAPAD, 0); PRIMOUTREG(MGAREG_DMAPAD, 0); PRIMOUTREG(MGAREG_DWGSYNC, 0x0100); @@ -829,13 +813,13 @@ /* Poll for the first buffer to insure that * the status register will be correct */ - + mga_flush_write_combine(); MGA_WRITE(MGAREG_PRIMADDRESS, phys_head | TT_GENERAL); - MGA_WRITE(MGAREG_PRIMEND, ((phys_head + num_dwords * 4) | + MGA_WRITE(MGAREG_PRIMEND, ((phys_head + num_dwords * 4) | PDEA_pagpxfer_enable)); - + while(MGA_READ(MGAREG_DWGSYNC) != 0x0100) ; } @@ -853,12 +837,12 @@ drm_file_t *priv = filp->private_data; drm_device_t *dev = priv->dev; drm_mga_init_t init; - + DRM_DEBUG("%s\n", __FUNCTION__); if (copy_from_user(&init, (drm_mga_init_t *)arg, sizeof(init))) return -EFAULT; - + switch(init.func) { case MGA_INIT_DMA: return mga_dma_initialize(dev, &init); @@ -874,7 +858,7 @@ int retcode; if (!irq) return -EINVAL; - + down(&dev->struct_sem); if (dev->irq) { up(&dev->struct_sem); @@ -882,7 +866,7 @@ } dev->irq = irq; up(&dev->struct_sem); - + DRM_DEBUG("install irq handler %d\n", irq); dev->context_flag = 0; @@ -923,7 +907,7 @@ irq = dev->irq; dev->irq = 0; up(&dev->struct_sem); - + if (!irq) return -EINVAL; DRM_DEBUG("remove irq handler %d\n", irq); MGA_WRITE(MGAREG_ICLEAR, 0x00000001); @@ -938,7 +922,7 @@ drm_file_t *priv = filp->private_data; drm_device_t *dev = priv->dev; drm_control_t ctl; - + if (copy_from_user(&ctl, (drm_control_t *)arg, sizeof(ctl))) return -EFAULT; @@ -965,21 +949,21 @@ if(dev_priv == NULL) { return 0; } - + if(dev_priv->next_prim->num_dwords != 0) { current->state = TASK_INTERRUPTIBLE; add_wait_queue(&dev_priv->flush_queue, &entry); set_bit(MGA_IN_FLUSH, &dev_priv->dispatch_status); mga_dma_schedule(dev, 0); for (;;) { - if (!test_bit(MGA_IN_FLUSH, - &dev_priv->dispatch_status)) + if (!test_bit(MGA_IN_FLUSH, + &dev_priv->dispatch_status)) break; atomic_inc(&dev->total_sleeps); schedule(); if (signal_pending(current)) { ret = -EINTR; /* Can't restart */ - clear_bit(MGA_IN_FLUSH, + clear_bit(MGA_IN_FLUSH, &dev_priv->dispatch_status); break; } @@ -1007,11 +991,11 @@ drm_buf_t *buf = dma->buflist[ i ]; drm_mga_buf_priv_t *buf_priv = buf->dev_private; - /* Only buffers that need to get reclaimed ever - * get set to free + /* Only buffers that need to get reclaimed ever + * get set to free */ if (buf->pid == pid && buf_priv) { - if(buf_priv->my_freelist->age == MGA_BUF_USED) + if(buf_priv->my_freelist->age == MGA_BUF_USED) buf_priv->my_freelist->age = MGA_BUF_FREE; } } @@ -1035,7 +1019,7 @@ current->pid, lock.context); return -EINVAL; } - + DRM_DEBUG("%d (pid %d) requests lock (0x%08x), flags = 0x%08x\n", lock.context, current->pid, dev->lock.hw_lock->lock, lock.flags); @@ -1043,7 +1027,7 @@ if (lock.context < 0) { return -EINVAL; } - + /* Only one queue: */ @@ -1062,7 +1046,7 @@ atomic_inc(&dev->total_locks); break; /* Got lock */ } - + /* Contention */ atomic_inc(&dev->total_sleeps); current->state = TASK_INTERRUPTIBLE; @@ -1075,7 +1059,7 @@ current->state = TASK_RUNNING; remove_wait_queue(&dev->lock.lock_queue, &entry); } - + if (!ret) { sigemptyset(&dev->sigmask); sigaddset(&dev->sigmask, SIGSTOP); @@ -1092,12 +1076,12 @@ mga_dma_quiescent(dev); } } - + DRM_DEBUG("%d %s\n", lock.context, ret ? "interrupted" : "has lock"); return ret; } - -int mga_flush_ioctl(struct inode *inode, struct file *filp, + +int mga_flush_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg) { drm_file_t *priv = filp->private_data; diff -u --recursive --new-file v2.4.0-test8/linux/drivers/char/drm/mga_drm.h linux/drivers/char/drm/mga_drm.h --- v2.4.0-test8/linux/drivers/char/drm/mga_drm.h Thu Jul 27 17:38:00 2000 +++ linux/drivers/char/drm/mga_drm.h Fri Sep 15 14:24:55 2000 @@ -73,17 +73,19 @@ /* 3d state excluding texture units: */ -#define MGA_CTXREG_DSTORG 0 /* validated */ -#define MGA_CTXREG_MACCESS 1 -#define MGA_CTXREG_PLNWT 2 -#define MGA_CTXREG_DWGCTL 3 -#define MGA_CTXREG_ALPHACTRL 4 -#define MGA_CTXREG_FOGCOLOR 5 -#define MGA_CTXREG_WFLAG 6 -#define MGA_CTXREG_TDUAL0 7 -#define MGA_CTXREG_TDUAL1 8 -#define MGA_CTXREG_FCOL 9 -#define MGA_CTX_SETUP_SIZE 10 +#define MGA_CTXREG_DSTORG 0 /* validated */ +#define MGA_CTXREG_MACCESS 1 +#define MGA_CTXREG_PLNWT 2 +#define MGA_CTXREG_DWGCTL 3 +#define MGA_CTXREG_ALPHACTRL 4 +#define MGA_CTXREG_FOGCOLOR 5 +#define MGA_CTXREG_WFLAG 6 +#define MGA_CTXREG_TDUAL0 7 +#define MGA_CTXREG_TDUAL1 8 +#define MGA_CTXREG_FCOL 9 +#define MGA_CTXREG_STENCIL 10 +#define MGA_CTXREG_STENCILCTL 11 +#define MGA_CTX_SETUP_SIZE 12 /* 2d state */ @@ -233,6 +235,7 @@ /* Mechanism to validate card state. */ int ctxOwner; + int vertexsize; } drm_mga_sarea_t; /* Device specific ioctls: @@ -241,6 +244,8 @@ unsigned int clear_color; unsigned int clear_depth; unsigned int flags; + unsigned int clear_depth_mask; + unsigned int clear_color_mask; } drm_mga_clear_t; typedef struct _drm_mga_swap { diff -u --recursive --new-file v2.4.0-test8/linux/drivers/char/drm/mga_drv.c linux/drivers/char/drm/mga_drv.c --- v2.4.0-test8/linux/drivers/char/drm/mga_drv.c Fri Sep 8 13:27:11 2000 +++ linux/drivers/char/drm/mga_drv.c Fri Sep 15 14:24:55 2000 @@ -1,6 +1,6 @@ /* mga_drv.c -- Matrox g200/g400 driver -*- linux-c -*- * Created: Mon Dec 13 01:56:22 1999 by jhartmann@precisioninsight.com - * + * * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. * All Rights Reserved. @@ -11,11 +11,11 @@ * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: - * + * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL @@ -35,9 +35,9 @@ #include "mga_drv.h" #define MGA_NAME "mga" -#define MGA_DESC "Matrox g200/g400" -#define MGA_DATE "20000719" -#define MGA_MAJOR 1 +#define MGA_DESC "Matrox G200/G400" +#define MGA_DATE "20000910" +#define MGA_MAJOR 2 #define MGA_MINOR 0 #define MGA_PATCHLEVEL 0 @@ -123,7 +123,7 @@ #endif MODULE_AUTHOR("VA Linux Systems, Inc."); -MODULE_DESCRIPTION("Matrox g200/g400"); +MODULE_DESCRIPTION("Matrox G200/G400"); MODULE_PARM(mga, "s"); #ifndef MODULE @@ -144,7 +144,7 @@ static int mga_setup(drm_device_t *dev) { int i; - + atomic_set(&dev->ioctl_count, 0); atomic_set(&dev->vma_count, 0); dev->buf_use = 0; @@ -187,22 +187,22 @@ dev->ctx_start = 0; dev->lck_start = 0; - + dev->buf_rp = dev->buf; dev->buf_wp = dev->buf; dev->buf_end = dev->buf + DRM_BSZ; dev->buf_async = NULL; init_waitqueue_head(&dev->buf_readers); init_waitqueue_head(&dev->buf_writers); - + DRM_DEBUG("\n"); - + /* The kernel's context could be created here, but is now created in drm_dma_enqueue. This is more resource-efficient for hardware that does not do DMA, but may mean that drm_select_queue fails between the time the interrupt is initialized and the time the queues are initialized. */ - + return 0; } @@ -217,15 +217,15 @@ DRM_DEBUG("\n"); if (dev->irq) mga_irq_uninstall(dev); - + down(&dev->struct_sem); del_timer(&dev->timer); - + if (dev->devname) { drm_free(dev->devname, strlen(dev->devname)+1, DRM_MEM_DRIVER); dev->devname = NULL; } - + if (dev->unique) { drm_free(dev->unique, strlen(dev->unique)+1, DRM_MEM_DRIVER); dev->unique = NULL; @@ -243,7 +243,7 @@ if (dev->agp) { drm_agp_mem_t *entry; drm_agp_mem_t *nexte; - + /* Remove AGP resources, but leave dev->agp intact until cleanup is called. */ for (entry = dev->agp->memory; entry; entry = nexte) { @@ -253,10 +253,10 @@ drm_free(entry, sizeof(*entry), DRM_MEM_AGPLISTS); } dev->agp->memory = NULL; - + if (dev->agp->acquired && drm_agp.release) (*drm_agp.release)(); - + dev->agp->acquired = 0; dev->agp->enabled = 0; } @@ -268,7 +268,7 @@ } dev->vmalist = NULL; } - + /* Clear map area and mtrr information */ if (dev->maplist) { for (i = 0; i < dev->map_count; i++) { @@ -304,7 +304,7 @@ dev->maplist = NULL; dev->map_count = 0; } - + if (dev->queuelist) { for (i = 0; i < dev->queue_count; i++) { drm_waitlist_destroy(&dev->queuelist[i]->waitlist); @@ -330,7 +330,7 @@ wake_up_interruptible(&dev->lock.lock_queue); } up(&dev->struct_sem); - + return 0; } @@ -347,7 +347,7 @@ memset((void *)dev, 0, sizeof(*dev)); dev->count_lock = SPIN_LOCK_UNLOCKED; sema_init(&dev->struct_sem, 1); - + #ifdef MODULE drm_parse_options(mga); #endif @@ -407,7 +407,7 @@ drm_device_t *dev = &mga_device; DRM_DEBUG("\n"); - + drm_proc_cleanup(); if (misc_deregister(&mga_misc)) { DRM_ERROR("Cannot unload module\n"); @@ -419,7 +419,7 @@ #ifdef CONFIG_MTRR if(dev->agp && dev->agp->agp_mtrr) { int retval; - retval = mtrr_del(dev->agp->agp_mtrr, + retval = mtrr_del(dev->agp->agp_mtrr, dev->agp->agp_info.aper_base, dev->agp->agp_info.aper_size * 1024*1024); DRM_DEBUG("mtrr_del = %d\n", retval); @@ -477,7 +477,7 @@ { drm_device_t *dev = &mga_device; int retcode = 0; - + DRM_DEBUG("open_count = %d\n", dev->open_count); if (!(retcode = drm_open_helper(inode, filp, dev))) { #if LINUX_VERSION_CODE < 0x020333 @@ -514,7 +514,7 @@ drm_lock_free(dev, &dev->lock.hw_lock->lock, _DRM_LOCKING_CONTEXT(dev->lock.hw_lock->lock)); - + /* FIXME: may require heavy-handed reset of hardware at this point, possibly processed via a callback to the X @@ -535,7 +535,7 @@ dev->lock.lock_time = jiffies; atomic_inc(&dev->total_locks); break; /* Got lock */ - } + } /* Contention */ atomic_inc(&dev->total_sleeps); current->state = TASK_INTERRUPTIBLE; @@ -561,7 +561,7 @@ if (priv->next) priv->next->prev = priv->prev; else dev->file_last = priv->prev; up(&dev->struct_sem); - + drm_free(priv, sizeof(*priv), DRM_MEM_FILES); #if LINUX_VERSION_CODE < 0x020333 MOD_DEC_USE_COUNT; /* Needed before Linux 2.3.51 */ @@ -602,7 +602,7 @@ atomic_inc(&dev->ioctl_count); atomic_inc(&dev->total_ioctl); ++priv->ioctl_count; - + DRM_DEBUG("pid = %d, cmd = 0x%02x, nr = 0x%02x, dev 0x%x, auth = %d\n", current->pid, cmd, nr, dev->device, priv->authenticated); @@ -622,7 +622,7 @@ retcode = (func)(inode, filp, cmd, arg); } } - + atomic_dec(&dev->ioctl_count); return retcode; } @@ -636,7 +636,7 @@ if (copy_from_user(&lock, (drm_lock_t *)arg, sizeof(lock))) return -EFAULT; - + if (lock.context == DRM_KERNEL_CONTEXT) { DRM_ERROR("Process %d using kernel context %d\n", current->pid, lock.context); diff -u --recursive --new-file v2.4.0-test8/linux/drivers/char/drm/mga_drv.h linux/drivers/char/drm/mga_drv.h --- v2.4.0-test8/linux/drivers/char/drm/mga_drv.h Fri Sep 8 13:27:11 2000 +++ linux/drivers/char/drm/mga_drv.h Fri Sep 15 14:24:55 2000 @@ -11,11 +11,11 @@ * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: - * + * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL @@ -82,6 +82,7 @@ int use_agp; drm_mga_warp_index_t WarpIndex[MGA_MAX_G400_PIPES]; unsigned int WarpPipe; + unsigned int vertexsize; atomic_t pending_bufs; void *status_page; unsigned long real_status_page; @@ -97,7 +98,7 @@ wait_queue_head_t wait_queue; /* Processes waiting until interrupt */ wait_queue_head_t buf_queue; /* Processes waiting for a free buf */ /* Some validated register values: - */ + */ u32 mAccess; } drm_mga_private_t; @@ -128,7 +129,6 @@ extern int mga_dma_cleanup(drm_device_t *dev); extern int mga_flush_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); -extern void mga_flush_write_combine(void); extern unsigned int mga_create_sync_tag(drm_device_t *dev); extern drm_buf_t *mga_freelist_get(drm_device_t *dev); extern int mga_freelist_put(drm_device_t *dev, drm_buf_t *buf); @@ -137,9 +137,9 @@ /* mga_bufs.c */ -extern int mga_addbufs(struct inode *inode, struct file *filp, +extern int mga_addbufs(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); -extern int mga_infobufs(struct inode *inode, struct file *filp, +extern int mga_infobufs(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); extern int mga_markbufs(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); @@ -179,6 +179,7 @@ extern int mga_context_switch(drm_device_t *dev, int old, int new); extern int mga_context_switch_complete(drm_device_t *dev, int new); +#define mga_flush_write_combine() mb() typedef enum { TT_GENERAL, @@ -201,7 +202,7 @@ #define ISREG0(r) (r >= DWGREG0 && r <= DWGREG0_END) #define ADRINDEX0(r) (u8)((r - DWGREG0) >> 2) #define ADRINDEX1(r) (u8)(((r - DWGREG1) >> 2) | 0x80) -#define ADRINDEX(r) (ISREG0(r) ? ADRINDEX0(r) : ADRINDEX1(r)) +#define ADRINDEX(r) (ISREG0(r) ? ADRINDEX0(r) : ADRINDEX1(r)) #define MGA_VERBOSE 0 #define MGA_NUM_PRIM_BUFS 8 @@ -212,13 +213,12 @@ #define PRIM_OVERFLOW(dev, dev_priv, length) do { \ drm_mga_prim_buf_t *tmp_buf = \ dev_priv->prim_bufs[dev_priv->current_prim_idx]; \ - if( test_bit(MGA_BUF_NEEDS_OVERFLOW, \ - &tmp_buf->buffer_status)) { \ + if( test_bit(MGA_BUF_NEEDS_OVERFLOW, &tmp_buf->buffer_status)) { \ mga_advance_primary(dev); \ mga_dma_schedule(dev, 1); \ tmp_buf = dev_priv->prim_bufs[dev_priv->current_prim_idx]; \ } else if( tmp_buf->max_dwords - tmp_buf->num_dwords < length || \ - tmp_buf->sec_used > MGA_DMA_BUF_NR/2) { \ + tmp_buf->sec_used > MGA_DMA_BUF_NR/2) { \ set_bit(MGA_BUF_FORCE_FIRE, &tmp_buf->buffer_status); \ mga_advance_primary(dev); \ mga_dma_schedule(dev, 1); \ @@ -295,7 +295,7 @@ num_dwords + 1 + outcount, ADRINDEX(reg), val); \ if( ++outcount == 4) { \ outcount = 0; \ - dma_ptr[0] = *(u32 *)tempIndex; \ + dma_ptr[0] = *(unsigned long *)tempIndex; \ dma_ptr+=5; \ num_dwords += 5; \ } \ @@ -396,8 +396,8 @@ #define DC_atype_zi 0x30 #define DC_atype_blk 0x40 #define DC_atype_i 0x70 -#define DC_linear_xy 0x0 -#define DC_linear_linear 0x80 +#define DC_linear_xy 0x0 +#define DC_linear_linear 0x80 #define DC_zmode_nozcmp 0x0 #define DC_zmode_ze 0x200 #define DC_zmode_zne 0x300 @@ -405,16 +405,16 @@ #define DC_zmode_zlte 0x500 #define DC_zmode_zgt 0x600 #define DC_zmode_zgte 0x700 -#define DC_solid_disable 0x0 -#define DC_solid_enable 0x800 -#define DC_arzero_disable 0x0 -#define DC_arzero_enable 0x1000 -#define DC_sgnzero_disable 0x0 -#define DC_sgnzero_enable 0x2000 -#define DC_shftzero_disable 0x0 -#define DC_shftzero_enable 0x4000 -#define DC_bop_SHIFT 16 -#define DC_trans_SHIFT 20 +#define DC_solid_disable 0x0 +#define DC_solid_enable 0x800 +#define DC_arzero_disable 0x0 +#define DC_arzero_enable 0x1000 +#define DC_sgnzero_disable 0x0 +#define DC_sgnzero_enable 0x2000 +#define DC_shftzero_disable 0x0 +#define DC_shftzero_enable 0x4000 +#define DC_bop_SHIFT 16 +#define DC_trans_SHIFT 20 #define DC_bltmod_bmonolef 0x0 #define DC_bltmod_bmonowf 0x8000000 #define DC_bltmod_bplan 0x2000000 @@ -423,21 +423,21 @@ #define DC_bltmod_bu32rgb 0xe000000 #define DC_bltmod_bu24bgr 0x16000000 #define DC_bltmod_bu24rgb 0x1e000000 -#define DC_pattern_disable 0x0 -#define DC_pattern_enable 0x20000000 -#define DC_transc_disable 0x0 -#define DC_transc_enable 0x40000000 -#define DC_clipdis_disable 0x0 -#define DC_clipdis_enable 0x80000000 +#define DC_pattern_disable 0x0 +#define DC_pattern_enable 0x20000000 +#define DC_transc_disable 0x0 +#define DC_transc_enable 0x40000000 +#define DC_clipdis_disable 0x0 +#define DC_clipdis_enable 0x80000000 -#define SETADD_mode_vertlist 0x0 +#define SETADD_mode_vertlist 0x0 #define MGA_CLEAR_CMD (DC_opcod_trap | DC_arzero_enable | \ DC_sgnzero_enable | DC_shftzero_enable | \ (0xC << DC_bop_SHIFT) | DC_clipdis_enable | \ DC_solid_enable | DC_transc_enable) - + #define MGA_COPY_CMD (DC_opcod_bitblt | DC_atype_rpl | DC_linear_xy | \ DC_solid_disable | DC_arzero_disable | \ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/char/drm/mga_state.c linux/drivers/char/drm/mga_state.c --- v2.4.0-test8/linux/drivers/char/drm/mga_state.c Fri Sep 8 13:27:11 2000 +++ linux/drivers/char/drm/mga_state.c Fri Sep 15 14:24:55 2000 @@ -11,11 +11,11 @@ * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: - * + * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL @@ -38,13 +38,13 @@ * change these values */ -#define MGAEMITCLIP_SIZE 10 -#define MGAEMITCTX_SIZE 15 -#define MGAG200EMITTEX_SIZE 20 -#define MGAG400EMITTEX0_SIZE 30 -#define MGAG400EMITTEX1_SIZE 25 -#define MGAG400EMITPIPE_SIZE 50 -#define MGAG200EMITPIPE_SIZE 15 +#define MGAEMITCLIP_SIZE 10 +#define MGAEMITCTX_SIZE 20 +#define MGAG200EMITTEX_SIZE 20 +#define MGAG400EMITTEX0_SIZE 30 +#define MGAG400EMITTEX1_SIZE 25 +#define MGAG400EMITPIPE_SIZE 55 +#define MGAG200EMITPIPE_SIZE 15 #define MAX_STATE_SIZE ((MGAEMITCLIP_SIZE * MGA_NR_SAREA_CLIPRECTS) + \ MGAEMITCTX_SIZE + MGAG400EMITTEX0_SIZE + \ @@ -89,7 +89,7 @@ PRIMLOCALS; DRM_DEBUG("%s\n", __FUNCTION__); - /* This takes a max of 15 dwords */ + /* This takes a max of 20 dwords */ PRIMGETPTR(dev_priv); PRIMOUTREG(MGAREG_DSTORG, regs[MGA_CTXREG_DSTORG]); @@ -107,6 +107,11 @@ PRIMOUTREG(MGAREG_TDUALSTAGE0, regs[MGA_CTXREG_TDUAL0]); PRIMOUTREG(MGAREG_TDUALSTAGE1, regs[MGA_CTXREG_TDUAL1]); PRIMOUTREG(MGAREG_FCOL, regs[MGA_CTXREG_FCOL]); + + PRIMOUTREG(MGAREG_STENCIL, regs[MGA_CTXREG_STENCIL]); + PRIMOUTREG(MGAREG_STENCILCTL, regs[MGA_CTXREG_STENCILCTL]); + PRIMOUTREG(MGAREG_DMAPAD, 0); + PRIMOUTREG(MGAREG_DMAPAD, 0); } else { PRIMOUTREG(MGAREG_FCOL, regs[MGA_CTXREG_FCOL]); PRIMOUTREG(MGAREG_DMAPAD, 0); @@ -151,11 +156,13 @@ PRIMADVANCE(dev_priv); } +#define TMC_dualtex_enable 0x80 + static void mgaG400EmitTex0(drm_mga_private_t * dev_priv) { drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; unsigned int *regs = sarea_priv->TexState[0]; - int multitex = sarea_priv->WarpPipe & MGA_T2; + int multitex = regs[MGA_TEXREG_CTL2] & TMC_dualtex_enable; PRIMLOCALS; DRM_DEBUG("%s\n", __FUNCTION__); @@ -183,7 +190,7 @@ PRIMOUTREG(0x2d00 + 61 * 4, 0); PRIMOUTREG(MGAREG_DMAPAD, 0); - if (!multitex) { + if (!multitex || 1) { PRIMOUTREG(0x2d00 + 52 * 4, 0x40); PRIMOUTREG(0x2d00 + 60 * 4, 0x40); PRIMOUTREG(MGAREG_DMAPAD, 0); @@ -200,10 +207,10 @@ #define TMC_map1_enable 0x80000000 -static void mgaG400EmitTex1(drm_mga_private_t * dev_priv) +static void mgaG400EmitTex1(drm_mga_private_t * dev_priv, int source ) { drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; - unsigned int *regs = sarea_priv->TexState[1]; + unsigned int *regs = sarea_priv->TexState[source]; PRIMLOCALS; DRM_DEBUG("%s\n", __FUNCTION__); @@ -245,6 +252,8 @@ drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; unsigned int pipe = sarea_priv->WarpPipe; float fParam = 12800.0f; + int multitex = (sarea_priv->TexState[0][MGA_TEXREG_CTL2] & + TMC_dualtex_enable); PRIMLOCALS; DRM_DEBUG("%s\n", __FUNCTION__); @@ -252,14 +261,36 @@ /* This takes 50 dwords */ - /* Establish vertex size. + /* Establish vertex size. */ PRIMOUTREG(MGAREG_WIADDR2, WIA_wmode_suspend); PRIMOUTREG(MGAREG_DMAPAD, 0); PRIMOUTREG(MGAREG_DMAPAD, 0); PRIMOUTREG(MGAREG_DMAPAD, 0); - if (pipe & MGA_T2) { + if (sarea_priv->vertexsize == 10) { + PRIMOUTREG(MGAREG_YDST, 0); + PRIMOUTREG(MGAREG_FXLEFT, 0); + PRIMOUTREG(MGAREG_FXRIGHT, 1); + PRIMOUTREG(MGAREG_DWGCTL, MGA_FLUSH_CMD); + + PRIMOUTREG(MGAREG_LEN + MGAREG_MGA_EXEC, 1); + PRIMOUTREG(MGAREG_DMAPAD, 0); + PRIMOUTREG(MGAREG_DWGSYNC, 0x7000); + PRIMOUTREG(MGAREG_DMAPAD, 0); + + if (multitex) { + PRIMOUTREG(MGAREG_TEXCTL2, 0 | 0x00008000); + PRIMOUTREG(MGAREG_LEN + MGAREG_MGA_EXEC, 0); + PRIMOUTREG(MGAREG_TEXCTL2, 0x80 | 0x00008000); + PRIMOUTREG(MGAREG_LEN + MGAREG_MGA_EXEC, 0); + } else { + PRIMOUTREG(MGAREG_TEXCTL2, 0 | 0x00008000); + PRIMOUTREG(MGAREG_LEN + MGAREG_MGA_EXEC, 0); + PRIMOUTREG(MGAREG_TEXCTL2, 0 | 0x00008000); + PRIMOUTREG(MGAREG_LEN + MGAREG_MGA_EXEC, 0); + } + PRIMOUTREG(MGAREG_WVRTXSZ, 0x00001e09); PRIMOUTREG(MGAREG_DMAPAD, 0); PRIMOUTREG(MGAREG_DMAPAD, 0); @@ -270,23 +301,21 @@ PRIMOUTREG(MGAREG_WACCEPTSEQ, 0); PRIMOUTREG(MGAREG_WACCEPTSEQ, 0x1e000000); } else { - if (dev_priv->WarpPipe & MGA_T2) { - /* Flush the WARP pipe */ - PRIMOUTREG(MGAREG_YDST, 0); - PRIMOUTREG(MGAREG_FXLEFT, 0); - PRIMOUTREG(MGAREG_FXRIGHT, 1); - PRIMOUTREG(MGAREG_DWGCTL, MGA_FLUSH_CMD); + /* Flush the WARP pipe */ + PRIMOUTREG(MGAREG_YDST, 0); + PRIMOUTREG(MGAREG_FXLEFT, 0); + PRIMOUTREG(MGAREG_FXRIGHT, 1); + PRIMOUTREG(MGAREG_DWGCTL, MGA_FLUSH_CMD); - PRIMOUTREG(MGAREG_LEN + MGAREG_MGA_EXEC, 1); - PRIMOUTREG(MGAREG_DMAPAD, 0); - PRIMOUTREG(MGAREG_DWGSYNC, 0x7000); - PRIMOUTREG(MGAREG_DMAPAD, 0); + PRIMOUTREG(MGAREG_LEN + MGAREG_MGA_EXEC, 1); + PRIMOUTREG(MGAREG_DMAPAD, 0); + PRIMOUTREG(MGAREG_DWGSYNC, 0x7000); + PRIMOUTREG(MGAREG_DMAPAD, 0); - PRIMOUTREG(MGAREG_TEXCTL2, 0 | 0x00008000); - PRIMOUTREG(MGAREG_LEN + MGAREG_MGA_EXEC, 0); - PRIMOUTREG(MGAREG_TEXCTL2, 0x80 | 0x00008000); - PRIMOUTREG(MGAREG_LEN + MGAREG_MGA_EXEC, 0); - } + PRIMOUTREG(MGAREG_TEXCTL2, 0 | 0x00008000); + PRIMOUTREG(MGAREG_LEN + MGAREG_MGA_EXEC, 0); + PRIMOUTREG(MGAREG_TEXCTL2, 0 | 0x00008000); + PRIMOUTREG(MGAREG_LEN + MGAREG_MGA_EXEC, 0); PRIMOUTREG(MGAREG_WVRTXSZ, 0x00001807); PRIMOUTREG(MGAREG_DMAPAD, 0); @@ -314,13 +343,16 @@ PRIMOUTREG(0x2d00 + 52 * 4, 0x40); /* Tex stage 1 : w */ PRIMOUTREG(0x2d00 + 60 * 4, 0x40); /* Tex stage 1 : h */ - /* Dma pading required due to hw bug */ - PRIMOUTREG(MGAREG_DMAPAD, 0xffffffff); - PRIMOUTREG(MGAREG_DMAPAD, 0xffffffff); - PRIMOUTREG(MGAREG_DMAPAD, 0xffffffff); - PRIMOUTREG(MGAREG_WIADDR2, - (u32) (dev_priv->WarpIndex[pipe]. - phys_addr | WIA_wmode_start | WIA_wagp_agp)); + if (dev_priv->WarpPipe != pipe || 1) { + /* Dma pading required due to hw bug */ + PRIMOUTREG(MGAREG_DMAPAD, 0xffffffff); + PRIMOUTREG(MGAREG_DMAPAD, 0xffffffff); + PRIMOUTREG(MGAREG_DMAPAD, 0xffffffff); + PRIMOUTREG(MGAREG_WIADDR2, + (u32) (dev_priv->WarpIndex[pipe].phys_addr | + WIA_wmode_start | WIA_wagp_agp)); + } + PRIMADVANCE(dev_priv); } @@ -363,11 +395,20 @@ DRM_DEBUG("%s\n", __FUNCTION__); if (dev_priv->chipset == MGA_CARD_TYPE_G400) { - int multitex = sarea_priv->WarpPipe & MGA_T2; + int multitex = (sarea_priv->TexState[0][MGA_TEXREG_CTL2] & + TMC_dualtex_enable); - if (sarea_priv->WarpPipe != dev_priv->WarpPipe) { + dirty = ~0; + + if (dirty & MGA_UPLOAD_PIPE +/* && (sarea_priv->WarpPipe != dev_priv->WarpPipe || */ +/* sarea_priv->vertexsize != dev_priv->vertexsize) */ + ) + { mgaG400EmitPipe(dev_priv); dev_priv->WarpPipe = sarea_priv->WarpPipe; + dev_priv->vertexsize = sarea_priv->vertexsize; + sarea_priv->dirty &= ~MGA_UPLOAD_PIPE; } if (dirty & MGA_UPLOAD_CTX) { @@ -380,8 +421,11 @@ sarea_priv->dirty &= ~MGA_UPLOAD_TEX0; } - if ((dirty & MGA_UPLOAD_TEX1) && multitex) { - mgaG400EmitTex1(dev_priv); + if (dirty & MGA_UPLOAD_TEX1) { + if (multitex) + mgaG400EmitTex1(dev_priv, 1); + else + mgaG400EmitTex1(dev_priv, 0); sarea_priv->dirty &= ~MGA_UPLOAD_TEX1; } } else { @@ -552,12 +596,15 @@ if (buf->used) { /* WARNING: if you change any of the state functions verify - * these numbers (Overestimating this doesn't hurt). + * these numbers (Overestimating this doesn't hurt). */ buf_priv->dispatched = 1; PRIM_OVERFLOW(dev, dev_priv, (MAX_STATE_SIZE + (5 * MGA_NR_SAREA_CLIPRECTS))); mgaEmitState(dev_priv); + +/* length = dev_priv->vertexsize * 3 * 4; */ + do { if (i < sarea_priv->nbox) { DRM_DEBUG("idx %d Emit box %d/%d:" @@ -614,7 +661,7 @@ if (start != end) { /* WARNING: if you change any of the state functions verify - * these numbers (Overestimating this doesn't hurt). + * these numbers (Overestimating this doesn't hurt). */ buf_priv->dispatched = 1; PRIM_OVERFLOW(dev, dev_priv, @@ -644,6 +691,7 @@ SETADD_mode_vertlist)); PRIMOUTREG(MGAREG_SETUPEND, ((address + end) | use_agp)); +/* ((address + start + 12) | use_agp)); */ PRIMADVANCE(dev_priv); } while (++i < sarea_priv->nbox); } @@ -658,7 +706,9 @@ static void mga_dma_dispatch_clear(drm_device_t * dev, int flags, unsigned int clear_color, - unsigned int clear_zval) + unsigned int clear_zval, + unsigned int clear_colormask, + unsigned int clear_depthmask) { drm_mga_private_t *dev_priv = dev->dev_private; drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; @@ -687,7 +737,7 @@ if (flags & MGA_FRONT) { DRM_DEBUG("clear front\n"); PRIMOUTREG(MGAREG_DMAPAD, 0); - PRIMOUTREG(MGAREG_DMAPAD, 0); + PRIMOUTREG(MGAREG_PLNWT, clear_colormask); PRIMOUTREG(MGAREG_YDSTLEN, (pbox[i].y1 << 16) | height); PRIMOUTREG(MGAREG_FXBNDRY, @@ -702,7 +752,7 @@ if (flags & MGA_BACK) { DRM_DEBUG("clear back\n"); PRIMOUTREG(MGAREG_DMAPAD, 0); - PRIMOUTREG(MGAREG_DMAPAD, 0); + PRIMOUTREG(MGAREG_PLNWT, clear_colormask); PRIMOUTREG(MGAREG_YDSTLEN, (pbox[i].y1 << 16) | height); PRIMOUTREG(MGAREG_FXBNDRY, @@ -717,7 +767,7 @@ if (flags & MGA_DEPTH) { DRM_DEBUG("clear depth\n"); PRIMOUTREG(MGAREG_DMAPAD, 0); - PRIMOUTREG(MGAREG_DMAPAD, 0); + PRIMOUTREG(MGAREG_PLNWT, clear_depthmask); PRIMOUTREG(MGAREG_YDSTLEN, (pbox[i].y1 << 16) | height); PRIMOUTREG(MGAREG_FXBNDRY, @@ -818,7 +868,10 @@ */ dev_priv->sarea_priv->dirty |= MGA_UPLOAD_CTX; mga_dma_dispatch_clear(dev, clear.flags, - clear.clear_color, clear.clear_depth); + clear.clear_color, + clear.clear_depth, + clear.clear_color_mask, + clear.clear_depth_mask); PRIMUPDATE(dev_priv); mga_flush_write_combine(); mga_dma_schedule(dev, 1); @@ -1012,8 +1065,9 @@ break; buf->pid = current->pid; if (copy_to_user(&d->request_indices[i], - &buf->idx, sizeof(buf->idx)) || - copy_to_user(&d->request_sizes[i], + &buf->idx, sizeof(buf->idx))) + return -EFAULT; + if (copy_to_user(&d->request_sizes[i], &buf->total, sizeof(buf->total))) return -EFAULT; ++d->granted_count; diff -u --recursive --new-file v2.4.0-test8/linux/drivers/char/drm/picker.c linux/drivers/char/drm/picker.c --- v2.4.0-test8/linux/drivers/char/drm/picker.c Wed Dec 31 16:00:00 1969 +++ linux/drivers/char/drm/picker.c Fri Sep 15 14:24:55 2000 @@ -0,0 +1,29 @@ +#include +#include + +#ifndef CONFIG_SMP +#define CONFIG_SMP 0 +#endif + +#ifndef CONFIG_MODVERSIONS +#define CONFIG_MODVERSIONS 0 +#endif + +#ifndef CONFIG_AGP_MODULE +#define CONFIG_AGP_MODULE 0 +#endif + +#ifndef CONFIG_AGP +#define CONFIG_AGP 0 +#endif + +#ifndef CONFIG_FB_SIS +#define CONFIG_FB_SIS 0 +#endif + +SMP = CONFIG_SMP +MODVERSIONS = CONFIG_MODVERSIONS +AGP = CONFIG_AGP +AGP_MODULE = CONFIG_AGP_MODULE +RELEASE = UTS_RELEASE +SIS = CONFIG_FB_SIS diff -u --recursive --new-file v2.4.0-test8/linux/drivers/char/drm/r128_dma.c linux/drivers/char/drm/r128_dma.c --- v2.4.0-test8/linux/drivers/char/drm/r128_dma.c Fri Sep 8 13:27:11 2000 +++ linux/drivers/char/drm/r128_dma.c Fri Sep 15 14:24:55 2000 @@ -68,30 +68,8 @@ return R128_READ(R128_CLOCK_CNTL_DATA); } -#ifdef __i386__ -static void r128_flush_write_combine(void) -{ - int xchangeDummy; +#define r128_flush_write_combine() mb() - __asm__ volatile("push %%eax ;" - "xchg %%eax, %0 ;" - "pop %%eax" : : "m" (xchangeDummy)); - __asm__ volatile("push %%eax ;" - "push %%ebx ;" - "push %%ecx ;" - "push %%edx ;" - "movl $0,%%eax ;" - "cpuid ;" - "pop %%edx ;" - "pop %%ecx ;" - "pop %%ebx ;" - "pop %%eax" : /* no outputs */ : /* no inputs */ ); -} -#else -static void r128_flush_write_combine(void) -{ -} -#endif static void r128_status(drm_device_t *dev) { diff -u --recursive --new-file v2.4.0-test8/linux/drivers/char/drm/r128_drv.c linux/drivers/char/drm/r128_drv.c --- v2.4.0-test8/linux/drivers/char/drm/r128_drv.c Fri Sep 8 13:27:11 2000 +++ linux/drivers/char/drm/r128_drv.c Fri Sep 15 14:24:55 2000 @@ -35,7 +35,7 @@ #define R128_NAME "r128" #define R128_DESC "ATI Rage 128" -#define R128_DATE "20000719" +#define R128_DATE "20000910" #define R128_MAJOR 1 #define R128_MINOR 0 #define R128_PATCHLEVEL 0 @@ -467,7 +467,7 @@ } spin_unlock(&dev->count_lock); } - + return retcode; } @@ -501,7 +501,7 @@ } spin_unlock(&dev->count_lock); } - + unlock_kernel(); return retcode; } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/char/drm/tdfx_drv.c linux/drivers/char/drm/tdfx_drv.c --- v2.4.0-test8/linux/drivers/char/drm/tdfx_drv.c Fri Sep 8 13:27:11 2000 +++ linux/drivers/char/drm/tdfx_drv.c Fri Sep 15 14:24:55 2000 @@ -11,11 +11,11 @@ * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: - * + * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL @@ -23,7 +23,7 @@ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. - * + * * Authors: * Rickard E. (Rik) Faith * Daryll Strauss @@ -36,7 +36,7 @@ #define TDFX_NAME "tdfx" #define TDFX_DESC "3dfx Banshee/Voodoo3+" -#define TDFX_DATE "20000719" +#define TDFX_DATE "20000910" #define TDFX_MAJOR 1 #define TDFX_MINOR 0 #define TDFX_PATCHLEVEL 0 @@ -76,7 +76,7 @@ [DRM_IOCTL_NR(DRM_IOCTL_UNBLOCK)] = { drm_unblock, 1, 1 }, [DRM_IOCTL_NR(DRM_IOCTL_AUTH_MAGIC)] = { drm_authmagic, 1, 1 }, [DRM_IOCTL_NR(DRM_IOCTL_ADD_MAP)] = { drm_addmap, 1, 1 }, - + [DRM_IOCTL_NR(DRM_IOCTL_ADD_CTX)] = { tdfx_addctx, 1, 1 }, [DRM_IOCTL_NR(DRM_IOCTL_RM_CTX)] = { tdfx_rmctx, 1, 1 }, [DRM_IOCTL_NR(DRM_IOCTL_MOD_CTX)] = { tdfx_modctx, 1, 1 }, @@ -128,7 +128,7 @@ static int tdfx_setup(drm_device_t *dev) { int i; - + atomic_set(&dev->ioctl_count, 0); atomic_set(&dev->vma_count, 0); dev->buf_use = 0; @@ -170,7 +170,7 @@ dev->ctx_start = 0; dev->lck_start = 0; - + dev->buf_rp = dev->buf; dev->buf_wp = dev->buf; dev->buf_end = dev->buf + DRM_BSZ; @@ -179,15 +179,15 @@ init_waitqueue_head(&dev->buf_writers); tdfx_res_ctx.handle=-1; - + DRM_DEBUG("\n"); - + /* The kernel's context could be created here, but is now created in drm_dma_enqueue. This is more resource-efficient for hardware that does not do DMA, but may mean that drm_select_queue fails between the time the interrupt is initialized and the time the queues are initialized. */ - + return 0; } @@ -203,12 +203,12 @@ down(&dev->struct_sem); del_timer(&dev->timer); - + if (dev->devname) { drm_free(dev->devname, strlen(dev->devname)+1, DRM_MEM_DRIVER); dev->devname = NULL; } - + if (dev->unique) { drm_free(dev->unique, strlen(dev->unique)+1, DRM_MEM_DRIVER); dev->unique = NULL; @@ -227,7 +227,7 @@ if (dev->agp) { drm_agp_mem_t *temp; drm_agp_mem_t *temp_next; - + temp = dev->agp->memory; while(temp != NULL) { temp_next = temp->next; @@ -246,7 +246,7 @@ } dev->vmalist = NULL; } - + /* Clear map area and mtrr information */ if (dev->maplist) { for (i = 0; i < dev->map_count; i++) { @@ -284,14 +284,14 @@ dev->maplist = NULL; dev->map_count = 0; } - + if (dev->lock.hw_lock) { dev->lock.hw_lock = NULL; /* SHM removed */ dev->lock.pid = 0; wake_up_interruptible(&dev->lock.lock_queue); } up(&dev->struct_sem); - + return 0; } @@ -308,7 +308,7 @@ memset((void *)dev, 0, sizeof(*dev)); dev->count_lock = SPIN_LOCK_UNLOCKED; sema_init(&dev->struct_sem, 1); - + #ifdef MODULE drm_parse_options(tdfx); #endif @@ -340,7 +340,7 @@ TDFX_PATCHLEVEL, TDFX_DATE, tdfx_misc.minor); - + return 0; } @@ -351,7 +351,7 @@ drm_device_t *dev = &tdfx_device; DRM_DEBUG("\n"); - + drm_proc_cleanup(); if (misc_deregister(&tdfx_misc)) { DRM_ERROR("Cannot unload module\n"); @@ -412,7 +412,7 @@ { drm_device_t *dev = &tdfx_device; int retcode = 0; - + DRM_DEBUG("open_count = %d\n", dev->open_count); if (!(retcode = drm_open_helper(inode, filp, dev))) { #if LINUX_VERSION_CODE < 0x020333 @@ -480,7 +480,7 @@ atomic_inc(&dev->ioctl_count); atomic_inc(&dev->total_ioctl); ++priv->ioctl_count; - + DRM_DEBUG("pid = %d, cmd = 0x%02x, nr = 0x%02x, dev 0x%x, auth = %d\n", current->pid, cmd, nr, dev->device, priv->authenticated); @@ -500,7 +500,7 @@ retcode = (func)(inode, filp, cmd, arg); } } - + atomic_dec(&dev->ioctl_count); return retcode; } @@ -538,7 +538,7 @@ if (lock.context < 0 || lock.context >= dev->queue_count) return -EINVAL; #endif - + if (!ret) { #if 0 if (_DRM_LOCKING_CONTEXT(dev->lock.hw_lock->lock) @@ -550,7 +550,7 @@ /* Can't take lock if we just had it and there is contention. */ DRM_DEBUG("%d (pid %d) delayed j=%d dev=%d jiffies=%d\n", - lock.context, current->pid, j, + lock.context, current->pid, j, dev->lock.lock_time, jiffies); current->state = TASK_INTERRUPTIBLE; current->policy |= SCHED_YIELD; @@ -573,7 +573,7 @@ atomic_inc(&dev->total_locks); break; /* Got lock */ } - + /* Contention */ atomic_inc(&dev->total_sleeps); current->state = TASK_INTERRUPTIBLE; @@ -648,7 +648,7 @@ #if DRM_DMA_HISTOGRAM atomic_inc(&dev->histo.lacq[drm_histogram_slot(get_cycles() - start)]); #endif - + return ret; } @@ -662,7 +662,7 @@ if (copy_from_user(&lock, (drm_lock_t *)arg, sizeof(lock))) return -EFAULT; - + if (lock.context == DRM_KERNEL_CONTEXT) { DRM_ERROR("Process %d using kernel context %d\n", current->pid, lock.context); @@ -690,7 +690,7 @@ current->priority = DEF_PRIORITY; } #endif - + unblock_all_signals(); return 0; } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/char/mem.c linux/drivers/char/mem.c --- v2.4.0-test8/linux/drivers/char/mem.c Fri Jun 23 21:55:08 2000 +++ linux/drivers/char/mem.c Mon Sep 11 08:41:07 2000 @@ -258,25 +258,27 @@ count -= read; } - kbuf = (char *)__get_free_page(GFP_KERNEL); - if (!kbuf) - return -ENOMEM; - while (count > 0) { - int len = count; + if (count > 0) { + kbuf = (char *)__get_free_page(GFP_KERNEL); + if (!kbuf) + return -ENOMEM; + while (count > 0) { + int len = count; - if (len > PAGE_SIZE) - len = PAGE_SIZE; - len = vread(kbuf, (char *)p, len); - if (len && copy_to_user(buf, kbuf, len)) { - free_page((unsigned long)kbuf); - return -EFAULT; + if (len > PAGE_SIZE) + len = PAGE_SIZE; + len = vread(kbuf, (char *)p, len); + if (len && copy_to_user(buf, kbuf, len)) { + free_page((unsigned long)kbuf); + return -EFAULT; + } + count -= len; + buf += len; + virtr += len; + p += len; } - count -= len; - buf += len; - virtr += len; - p += len; + free_page((unsigned long)kbuf); } - free_page((unsigned long)kbuf); *ppos = p; return virtr + read; } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/char/nvram.c linux/drivers/char/nvram.c --- v2.4.0-test8/linux/drivers/char/nvram.c Fri Sep 8 13:27:11 2000 +++ linux/drivers/char/nvram.c Mon Sep 11 08:41:07 2000 @@ -109,7 +109,7 @@ extern spinlock_t rtc_lock; -static int nvram_open_cnt = 0; /* #times opened */ +static int nvram_open_cnt; /* #times opened */ static int nvram_open_mode; /* special open modes */ #define NVRAM_WRITE 1 /* opened for writing (exclusive) */ #define NVRAM_EXCL 2 /* opened with O_EXCL */ @@ -415,14 +415,29 @@ static int __init nvram_init(void) { + int ret; + /* First test whether the driver should init at all */ if (!CHECK_DRIVER_INIT()) return( -ENXIO ); - printk(KERN_INFO "Non-volatile memory driver v%s\n", NVRAM_VERSION ); - misc_register( &nvram_dev ); - create_proc_read_entry("driver/nvram",0,0,nvram_read_proc,NULL); - return( 0 ); + ret = misc_register( &nvram_dev ); + if (ret) { + printk(KERN_ERR "nvram: can't misc_register on minor=%d\n", NVRAM_MINOR); + goto out; + } + if (!create_proc_read_entry("driver/nvram",0,0,nvram_read_proc,NULL)) { + printk(KERN_ERR "nvram: can't create /proc/driver/nvram\n"); + ret = -ENOMEM; + goto outmisc; + } + ret = 0; + printk(KERN_INFO "Non-volatile memory driver v" NVRAM_VERSION "\n"); +out: + return( ret ); +outmisc: + misc_deregister( &nvram_dev ); + goto out; } static void __exit nvram_cleanup_module (void) diff -u --recursive --new-file v2.4.0-test8/linux/drivers/char/wdt.c linux/drivers/char/wdt.c --- v2.4.0-test8/linux/drivers/char/wdt.c Thu Jul 27 17:38:00 2000 +++ linux/drivers/char/wdt.c Mon Sep 11 08:41:07 2000 @@ -26,6 +26,7 @@ * Alan Cox : Cleaned up copy/user stuff * Tim Hockin : Added insmod parameters, comment cleanup * Parameterized timeout + * Tigran Aivazian : Restructured wdt_init() to handle failures */ #include @@ -49,7 +50,7 @@ #include #include -static int wdt_is_open=0; +static int wdt_is_open; /* * You must set these - there is no sane way to probe for this board. @@ -495,18 +496,53 @@ int __init wdt_init(void) { - printk(KERN_INFO "WDT500/501-P driver 0.07 at %X (Interrupt %d)\n", io,irq); - if(request_irq(irq, wdt_interrupt, SA_INTERRUPT, "wdt501p", &wdt_miscdev)) - { - printk(KERN_ERR "IRQ %d is not free.\n", irq); - return -EIO; + int ret; + + ret = misc_register(&wdt_miscdev); + if (ret) { + printk(KERN_ERR "wdt: can't misc_register on minor=%d\n", WATCHDOG_MINOR); + goto out; } - misc_register(&wdt_miscdev); -#ifdef CONFIG_WDT_501 - misc_register(&temp_miscdev); -#endif - request_region(io, 8, "wdt501p"); - register_reboot_notifier(&wdt_notifier); - return 0; + ret = request_irq(irq, wdt_interrupt, SA_INTERRUPT, "wdt501p", NULL); + if(ret) { + printk(KERN_ERR "wdt: IRQ %d is not free.\n", irq); + goto outmisc; + } + if (!request_region(io, 8, "wdt501p")) { + printk(KERN_ERR "wdt: IO %X is not free.\n", io); + ret = -EBUSY; + goto outirq; + } + ret = register_reboot_notifier(&wdt_notifier); + if(ret) { + printk(KERN_ERR "wdt: can't register reboot notifier (err=%d)\n", ret); + goto outreg; + } + +#ifdef CONFIG_WDT_501 + ret = misc_register(&temp_miscdev); + if (ret) { + printk(KERN_ERR "wdt: can't misc_register (temp) on minor=%d\n", TEMP_MINOR); + goto outrbt; + } +#endif + + ret = 0; + printk(KERN_INFO "WDT500/501-P driver 0.07 at %X (Interrupt %d)\n", io, irq); +out: + return ret; + +#ifdef CONFIG_WDT_501 +outrbt: + unregister_reboot_notifier(&wdt_notifier); +#endif + +outreg: + release_region(io,8); +outirq: + free_irq(irq, NULL); +outmisc: + misc_deregister(&wdt_miscdev); + goto out; } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/char/wdt_pci.c linux/drivers/char/wdt_pci.c --- v2.4.0-test8/linux/drivers/char/wdt_pci.c Fri Jul 14 12:12:09 2000 +++ linux/drivers/char/wdt_pci.c Mon Sep 11 08:41:07 2000 @@ -29,6 +29,7 @@ * JP Nollmann : Added support for PCI wdt501p * Alan Cox : Split ISA and PCI cards into two drivers * Jeff Garzik : PCI cleanups + * Tigran Aivazian : Restructured wdtpci_init_one() to handle failures */ #include @@ -70,7 +71,7 @@ #define PCI_DEVICE_ID_WDG_CSM 0x22c0 #endif -static int wdt_is_open=0; +static int wdt_is_open; /* * You must set these - there is no sane way to probe for this board. @@ -499,6 +500,7 @@ const struct pci_device_id *ent) { static int dev_count = 0; + int ret = -EIO; dev_count++; if (dev_count > 1) { @@ -513,33 +515,53 @@ "(Interrupt %d)\n", io, irq); if (pci_enable_device (dev)) - goto err_out; + goto out; if (request_region (io, 16, "wdt-pci") == NULL) { printk (KERN_ERR PFX "I/O %d is not free.\n", io); - goto err_out; + goto out; } if (request_irq (irq, wdtpci_interrupt, SA_INTERRUPT | SA_SHIRQ, "wdt-pci", &wdtpci_miscdev)) { printk (KERN_ERR PFX "IRQ %d is not free.\n", irq); - goto err_out_free_res; + goto out_reg; } - misc_register (&wdtpci_miscdev); + ret = misc_register (&wdtpci_miscdev); + if (ret) { + printk (KERN_ERR PFX "can't misc_register on minor=%d\n", WATCHDOG_MINOR); + goto out_irq; + } + ret = register_reboot_notifier (&wdtpci_notifier); + if (ret) { + printk (KERN_ERR PFX "can't misc_register on minor=%d\n", WATCHDOG_MINOR); + goto out_misc; + } #ifdef CONFIG_WDT_501 - misc_register (&temp_miscdev); + ret = misc_register (&temp_miscdev); + if (ret) { + printk (KERN_ERR PFX "can't misc_register (temp) on minor=%d\n", TEMP_MINOR); + goto out_rbt; + } #endif - register_reboot_notifier (&wdtpci_notifier); + ret = 0; +out: + return ret; - return 0; - -err_out_free_res: +#ifdef CONFIG_WDT_501 +out_rbt: + unregister_reboot_notifier(&wdtpci_notifier); +#endif +out_misc: + misc_deregister(&wdtpci_miscdev); +out_irq: + free_irq(irq, &wdtpci_miscdev); +out_reg: release_region (io, 16); -err_out: - return -EIO; + goto out; } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/ide/ide.c linux/drivers/ide/ide.c --- v2.4.0-test8/linux/drivers/ide/ide.c Fri Sep 8 13:27:12 2000 +++ linux/drivers/ide/ide.c Mon Sep 11 08:42:57 2000 @@ -1082,7 +1082,7 @@ { byte *args = rq->buffer; if (args && rq->cmd == IDE_DRIVE_TASK) { - + byte sel; #ifdef DEBUG printk("%s: DRIVE_TASK_CMD data=x%02x cmd=0x%02x fr=0x%02x ns=0x%02x sc=0x%02x lcyl=0x%02x hcyl=0x%02x sel=0x%02x\n", drive->name, args[0], args[1], args[2], args[3], args[4], args[5], args[6]); @@ -1091,7 +1091,10 @@ OUT_BYTE(args[3], IDE_SECTOR_REG); OUT_BYTE(args[4], IDE_LCYL_REG); OUT_BYTE(args[5], IDE_HCYL_REG); - OUT_BYTE(args[6], IDE_SELECT_REG); + sel = (args[6] & ~0x10); + if (drive->select.b.unit) + sel |= 0x10; + OUT_BYTE(sel, IDE_SELECT_REG); ide_cmd(drive, args[0], args[2], &drive_cmd_intr); return ide_started; } else if (args) { diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/3c59x.c linux/drivers/net/3c59x.c --- v2.4.0-test8/linux/drivers/net/3c59x.c Wed Aug 23 18:36:37 2000 +++ linux/drivers/net/3c59x.c Fri Sep 15 16:28:25 2000 @@ -98,6 +98,18 @@ - Added INVERT_LED_PWR, used it. - Backed out the extra_reset stuff + LK1.1.9 2 Sep 2000 andrewm + - Backed out the tx_reset_resume flags. It was a no-op. + - In vortex_error, don't reset the Tx on txReclaim errors + - In vortex_error, don't reset the Tx on maxCollisions errors. + Hence backed out all the DownListPtr logic here. + - In vortex_error, give Tornado cards a partial TxReset on + maxCollisions (David Hinds). Defined MAX_COLLISION_RESET for this. + - Redid some driver flags and device names based on pcmcia_cs-3.1.20. + - Fixed a bug where, if vp->tx_full is set when the interface + is downed, it remains set when the interface is upped. Bad + things happen. + - See http://www.uow.edu.au/~andrewm/linux/#3c59x-2.3 for more details. - Also see Documentation/networking/vortex.txt */ @@ -183,7 +195,7 @@ #include static char version[] __devinitdata = -"3c59x.c:LK1.1.8 13 Aug 2000 Donald Becker and others. http://www.scyld.com/network/vortex.html " "$Revision: 1.102.2.25 $\n"; +"3c59x.c:LK1.1.9 2 Sep 2000 Donald Becker and others. http://www.scyld.com/network/vortex.html " "$Revision: 1.102.2.38 $\n"; MODULE_AUTHOR("Donald Becker "); MODULE_DESCRIPTION("3Com 3c59x/3c90x/3c575 series Vortex/Boomerang/Cyclone driver"); @@ -303,7 +315,7 @@ enum { IS_VORTEX=1, IS_BOOMERANG=2, IS_CYCLONE=4, IS_TORNADO=8, EEPROM_8BIT=0x10, /* AKPM: Uses 0x230 as the base bitmaps for EEPROM reads */ HAS_PWR_CTRL=0x20, HAS_MII=0x40, HAS_NWAY=0x80, HAS_CB_FNS=0x100, - INVERT_MII_PWR=0x200, INVERT_LED_PWR=0x400 }; + INVERT_MII_PWR=0x200, INVERT_LED_PWR=0x400, MAX_COLLISION_RESET=0x800 }; enum vortex_chips { @@ -415,14 +427,14 @@ {"3CCFE575BT Cyclone CardBus", PCI_USES_IO|PCI_USES_MASTER, IS_CYCLONE|HAS_NWAY|HAS_CB_FNS|EEPROM_8BIT|INVERT_LED_PWR, 128, }, - {"3CCFE575CT Cyclone CardBus", - PCI_USES_IO|PCI_USES_MASTER, IS_CYCLONE|HAS_NWAY|HAS_CB_FNS|EEPROM_8BIT|INVERT_MII_PWR, 128, }, + {"3CCFE575CT Tornado CardBus", + PCI_USES_IO|PCI_USES_MASTER, IS_TORNADO|HAS_NWAY|HAS_CB_FNS|EEPROM_8BIT|INVERT_MII_PWR|MAX_COLLISION_RESET, 128, }, {"3CCFE656 Cyclone CardBus", PCI_USES_IO|PCI_USES_MASTER, IS_CYCLONE|HAS_NWAY|HAS_CB_FNS|EEPROM_8BIT|INVERT_MII_PWR|INVERT_LED_PWR, 128, }, {"3CCFEM656B Cyclone+Winmodem CardBus", PCI_USES_IO|PCI_USES_MASTER, IS_CYCLONE|HAS_NWAY|HAS_CB_FNS|EEPROM_8BIT|INVERT_MII_PWR|INVERT_LED_PWR, 128, }, - {"3CCFE656C Tornado+Winmodem CardBus", /* From pcmcia-cs-3.1.5 */ - PCI_USES_IO|PCI_USES_MASTER, IS_CYCLONE|HAS_NWAY|HAS_CB_FNS|EEPROM_8BIT|INVERT_MII_PWR, 128, }, + {"3CXFEM656C Tornado+Winmodem CardBus", /* From pcmcia-cs-3.1.5 */ + PCI_USES_IO|PCI_USES_MASTER, IS_TORNADO|HAS_NWAY|HAS_CB_FNS|EEPROM_8BIT|INVERT_MII_PWR|MAX_COLLISION_RESET, 128, }, {"3c450 HomePNA Tornado", /* AKPM: from Don's 0.99Q */ PCI_USES_IO|PCI_USES_MASTER, IS_TORNADO|HAS_NWAY, 128, }, @@ -652,7 +664,6 @@ open:1, must_free_region:1; /* Flag: if zero, Cardbus owns the I/O region */ int drv_flags; - int tx_reset_resume; /* Flag to retart timer after vortex_error handling */ u16 status_enable; u16 intr_enable; u16 available_media; /* From Wn3_Options. */ @@ -1369,6 +1380,7 @@ vortex_up(dev); vp->open = 1; + vp->tx_full = 0; return 0; out_free_irq: @@ -1570,7 +1582,7 @@ { struct vortex_private *vp = (struct vortex_private *)dev->priv; long ioaddr = dev->base_addr; - int do_tx_reset = 0; + int do_tx_reset = 0, reset_mask = 0; unsigned char tx_status = 0; if (vortex_debug > 2) { @@ -1589,10 +1601,14 @@ if (tx_status & 0x14) vp->stats.tx_fifo_errors++; if (tx_status & 0x38) vp->stats.tx_aborted_errors++; outb(0, ioaddr + TxStatus); - if (tx_status & 0x3a) /* TxReset after 16 collisions, despite what the manual says */ - do_tx_reset = 1; /* Also reset on reclaim errors */ - else /* Merely re-enable the transmitter. */ + if (tx_status & 0x30) { /* txJabber or txUnderrun */ + do_tx_reset = 1; + } else if ((tx_status & 0x08) && (vp->drv_flags & MAX_COLLISION_RESET)) { /* maxCollisions */ + do_tx_reset = 1; + reset_mask = 0x0108; /* Reset interface logic, but not download logic */ + } else { /* Merely re-enable the transmitter. */ outw(TxEnable, ioaddr + EL3_CMD); + } } if (status & RxEarly) { /* Rx early is unused. */ @@ -1644,40 +1660,11 @@ } } - /* - * Black magic. If we're resetting the transmitter, remember the current downlist - * pointer and restore it afterwards. We can't usr cur_tx because that could - * lag the actual hardware index. - */ if (do_tx_reset) { - if (vp->full_bus_master_tx) { - unsigned long old_down_list_ptr; - - wait_for_completion(dev, DownStall); - old_down_list_ptr = inl(ioaddr + DownListPtr); - wait_for_completion(dev, TxReset); - outw(TxEnable, ioaddr + EL3_CMD); - - /* Restart DMA if necessary */ - outl(old_down_list_ptr, ioaddr + DownListPtr); - if (vortex_debug > 2) - printk(KERN_DEBUG "reset DMA to 0x%08x\n", inl(ioaddr + DownListPtr)); - outw(DownUnstall, ioaddr + EL3_CMD); - - /* - * Here we make a single attempt to prevent a timeout by - * restarting the timer if we think that the ISR has a good - * chance of unjamming things. - */ - if (vp->tx_reset_resume == 0 && vp->tx_full) { - vp->tx_reset_resume = 1; - dev->trans_start = jiffies; - } - } else { - wait_for_completion(dev, TxReset); - outw(TxEnable, ioaddr + EL3_CMD); + wait_for_completion(dev, TxReset|reset_mask); + outw(TxEnable, ioaddr + EL3_CMD); + if (!vp->full_bus_master_tx) netif_wake_queue(dev); - } } } @@ -1785,7 +1772,6 @@ /* netif_start_queue (dev); */ /* AKPM: redundant? */ } outw(DownUnstall, ioaddr + EL3_CMD); - vp->tx_reset_resume = 0; spin_unlock_irqrestore(&vp->lock, flags); dev->trans_start = jiffies; return 0; diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/8139too.c linux/drivers/net/8139too.c --- v2.4.0-test8/linux/drivers/net/8139too.c Fri Sep 8 13:27:12 2000 +++ linux/drivers/net/8139too.c Sun Sep 10 13:21:13 2000 @@ -3,6 +3,7 @@ 8139too.c: A RealTek RTL-8139 Fast Ethernet driver for Linux. Copyright 2000 Jeff Garzik + Originally: Written 1997-1999 by Donald Becker. This software may be used and distributed according to the terms @@ -25,6 +26,14 @@ posted MMIO write bugginess Gerard Sharp - bug fix + + David Ford - Rx ring wrap fix + + Dan DeMaggio - swapped RTL8139 cards with me, and allowed me + to find and fix a crucial bug on older chipsets. + + Donald Becker/Chris Butterworth/Marcus Westergren - + Noticed various Rx packet size-related buglets. Submitting bug reports: @@ -96,8 +105,9 @@ #include #include +#undef USE_IO_OPS /* define to 1 to enable PIO instead of MMIO */ -#define RTL8139_VERSION "0.9.8" +#define RTL8139_VERSION "0.9.9" #define RTL8139_MODULE_NAME "8139too" #define RTL8139_DRIVER_NAME RTL8139_MODULE_NAME " Fast Ethernet driver " RTL8139_VERSION #define PFX RTL8139_MODULE_NAME ": " @@ -497,6 +507,32 @@ static void rtl8139_hw_start (struct net_device *dev); +#ifdef USE_IO_OPS + +#define RTL_R8(reg) inb (((unsigned long)ioaddr) + (reg)) +#define RTL_R16(reg) inw (((unsigned long)ioaddr) + (reg)) +#define RTL_R32(reg) inl (((unsigned long)ioaddr) + (reg)) +#define RTL_W8(reg, val8) outb ((val8), ((unsigned long)ioaddr) + (reg)) +#define RTL_W16(reg, val16) outw ((val16), ((unsigned long)ioaddr) + (reg)) +#define RTL_W32(reg, val32) outl ((val32), ((unsigned long)ioaddr) + (reg)) +#define RTL_W8_F RTL_W8 +#define RTL_W16_F RTL_W16 +#define RTL_W32_F RTL_W32 +#undef readb +#undef readw +#undef readl +#undef writeb +#undef writew +#undef writel +#define readb(addr) inb((unsigned long)(addr)) +#define readw(addr) inw((unsigned long)(addr)) +#define readl(addr) inl((unsigned long)(addr)) +#define writeb(val,addr) outb((val),(unsigned long)(addr)) +#define writew(val,addr) outw((val),(unsigned long)(addr)) +#define writel(val,addr) outl((val),(unsigned long)(addr)) + +#else + /* write MMIO register, with flush */ /* Flush avoids rtl8139 bug w/ posted MMIO writes */ #define RTL_W8_F(reg, val8) do { writeb ((val8), ioaddr + (reg)); readb (ioaddr + (reg)); } while (0) @@ -525,6 +561,8 @@ #define RTL_R16(reg) readw (ioaddr + (reg)) #define RTL_R32(reg) readl (ioaddr + (reg)) +#endif /* USE_IO_OPS */ + static const u16 rtl8139_intr_mask = PCIErr | PCSTimeout | RxUnderrun | RxOverflow | RxFIFOOver | @@ -625,6 +663,9 @@ pci_set_master (pdev); +#ifdef USE_IO_OPS + ioaddr = (void *) pio_start; +#else /* ioremap MMIO region */ ioaddr = ioremap (mmio_start, mmio_len); if (ioaddr == NULL) { @@ -632,6 +673,7 @@ rc = -EIO; goto err_out_free_mmio; } +#endif /* USE_IO_OPS */ /* Soft reset the chip. */ RTL_W8 (ChipCmd, (RTL_R8 (ChipCmd) & ChipCmdClear) | CmdReset); @@ -653,11 +695,13 @@ RTL_W8 (Config1, 0); } +#ifndef USE_IO_OPS /* sanity checks -- ensure PIO and MMIO registers agree */ assert (inb (pio_start+Config0) == readb (ioaddr+Config0)); assert (inb (pio_start+Config1) == readb (ioaddr+Config1)); assert (inb (pio_start+TxConfig) == readb (ioaddr+TxConfig)); assert (inb (pio_start+RxConfig) == readb (ioaddr+RxConfig)); +#endif /* !USE_IO_OPS */ /* make sure chip thinks PIO and MMIO are enabled */ tmp8 = RTL_R8 (Config1); @@ -699,7 +743,9 @@ err_out_iounmap: assert (ioaddr > 0); +#ifndef USE_IO_OPS iounmap (ioaddr); +#endif /* !USE_IO_OPS */ err_out_free_mmio: release_mem_region (mmio_start, mmio_len); err_out_free_pio: @@ -766,7 +812,7 @@ dev->watchdog_timeo = TX_TIMEOUT; dev->irq = pdev->irq; - dev->base_addr = pci_resource_start (pdev, 1); + dev->base_addr = (unsigned long) ioaddr; /* dev->priv/tp zeroed and aligned in init_etherdev */ tp = dev->priv; @@ -843,7 +889,10 @@ unregister_netdev (dev); +#ifndef USE_IO_OPS iounmap (np->mmio_addr); +#endif /* !USE_IO_OPS */ + release_region (pci_resource_start (pdev, 0), pci_resource_len (pdev, 0)); release_mem_region (pci_resource_start (pdev, 1), @@ -1557,11 +1606,60 @@ } +/* TODO: clean this up! Rx reset need not be this intensive */ +static void rtl8139_rx_err (u32 rx_status, struct net_device *dev, + struct rtl8139_private *tp, void *ioaddr) +{ + u8 tmp8; + int tmp_work = 1000; + + DPRINTK ("%s: Ethernet frame had errors, status %8.8x.\n", + dev->name, rx_status); + if (rx_status & RxTooLong) { + DPRINTK ("%s: Oversized Ethernet frame, status %4.4x!\n", + dev->name, rx_status); + /* A.C.: The chip hangs here. */ + } + tp->stats.rx_errors++; + if (rx_status & (RxBadSymbol | RxBadAlign)) + tp->stats.rx_frame_errors++; + if (rx_status & (RxRunt | RxTooLong)) + tp->stats.rx_length_errors++; + if (rx_status & RxCRCErr) + tp->stats.rx_crc_errors++; + /* Reset the receiver, based on RealTek recommendation. (Bug?) */ + tp->cur_rx = 0; + + /* disable receive */ + tmp8 = RTL_R8 (ChipCmd) & ChipCmdClear; + RTL_W8_F (ChipCmd, tmp8 | CmdTxEnb); + + /* A.C.: Reset the multicast list. */ + rtl8139_set_rx_mode (dev); + + /* XXX potentially temporary hack to + * restart hung receiver */ + while (--tmp_work > 0) { + tmp8 = RTL_R8 (ChipCmd); + if ((tmp8 & CmdRxEnb) && (tmp8 & CmdTxEnb)) + break; + RTL_W8_F (ChipCmd, + (tmp8 & ChipCmdClear) | CmdRxEnb | CmdTxEnb); + } + + /* G.S.: Re-enable receiver */ + /* XXX temporary hack to work around receiver hang */ + rtl8139_set_rx_mode (dev); + + if (tmp_work <= 0) + printk (KERN_WARNING PFX "tx/rx enable wait too long\n"); +} + + /* The data sheet doesn't describe the Rx ring at all, so I'm guessing at the field alignments and semantics. */ static void rtl8139_rx_interrupt (struct net_device *dev, - struct rtl8139_private *tp, - void *ioaddr) + struct rtl8139_private *tp, void *ioaddr) { unsigned char *rx_ring; u16 cur_rx; @@ -1569,31 +1667,33 @@ assert (dev != NULL); assert (tp != NULL); assert (ioaddr != NULL); - + rx_ring = tp->rx_ring; cur_rx = tp->cur_rx; DPRINTK ("%s: In rtl8139_rx(), current %4.4x BufAddr %4.4x," - " free to %4.4x, Cmd %2.2x.\n", dev->name, cur_rx, - RTL_R16 (RxBufAddr), - RTL_R16 (RxBufPtr), - RTL_R8 (ChipCmd)); + " free to %4.4x, Cmd %2.2x.\n", dev->name, cur_rx, + RTL_R16 (RxBufAddr), + RTL_R16 (RxBufPtr), RTL_R8 (ChipCmd)); while ((RTL_R8 (ChipCmd) & RxBufEmpty) == 0) { int ring_offset = cur_rx % RX_BUF_LEN; u32 rx_status = le32_to_cpu (*(u32 *) (rx_ring + ring_offset)); int rx_size = rx_status >> 16; + struct sk_buff *skb; + int pkt_size = rx_size - 4; DPRINTK ("%s: rtl8139_rx() status %4.4x, size %4.4x," - " cur %4.4x.\n", dev->name, rx_status, - rx_size, cur_rx); + " cur %4.4x.\n", dev->name, rx_status, + rx_size, cur_rx); #if RTL8139_DEBUG > 2 { - int i; - DPRINTK ("%s: Frame contents ", dev->name); - for (i = 0; i < 70; i++) - printk (" %2.2x", rx_ring[ring_offset + i]); - printk (".\n"); + int i; + DPRINTK ("%s: Frame contents ", dev->name); + for (i = 0; i < 70; i++) + printk (" %2.2x", + rx_ring[ring_offset + i]); + printk (".\n"); } #endif @@ -1609,82 +1709,45 @@ if (rx_size == 0xfff0) break; + /* if Rx err received, Rx process gets reset, so + * we abort any further Rx processing + */ if (rx_status & - (RxBadSymbol | RxRunt | RxTooLong | RxCRCErr | - RxBadAlign)) { - u8 tmp8; - int tmp_work = 1000; - - DPRINTK ("%s: Ethernet frame had errors," - " status %8.8x.\n", dev->name, - rx_status); - if (rx_status & RxTooLong) { - DPRINTK ("%s: Oversized Ethernet frame, status %4.4x!\n", - dev->name, rx_status); - /* A.C.: The chip hangs here. */ - } - tp->stats.rx_errors++; - if (rx_status & (RxBadSymbol | RxBadAlign)) - tp->stats.rx_frame_errors++; - if (rx_status & (RxRunt | RxTooLong)) - tp->stats.rx_length_errors++; - if (rx_status & RxCRCErr) - tp->stats.rx_crc_errors++; - /* Reset the receiver, based on RealTek recommendation. (Bug?) */ - tp->cur_rx = 0; - - /* disable receive */ - tmp8 = RTL_R8 (ChipCmd) & ChipCmdClear; - RTL_W8_F (ChipCmd, tmp8 | CmdTxEnb); - - /* A.C.: Reset the multicast list. */ - rtl8139_set_rx_mode (dev); - - /* XXX potentially temporary hack to - * restart hung receiver */ - while (--tmp_work > 0) { - tmp8 = RTL_R8 (ChipCmd); - if ((tmp8 & CmdRxEnb) && (tmp8 & CmdTxEnb)) - break; - RTL_W8_F (ChipCmd, (tmp8 & ChipCmdClear) | CmdRxEnb | CmdTxEnb); - } + (RxBadSymbol | RxRunt | RxTooLong | RxCRCErr | RxBadAlign)) { + rtl8139_rx_err (rx_status, dev, tp, ioaddr); + return; + } - /* G.S.: Re-enable receiver */ - /* XXX temporary hack to work around receiver hang */ - rtl8139_set_rx_mode (dev); + /* Malloc up new buffer, compatible with net-2e. */ + /* Omit the four octet CRC from the length. */ - if (tmp_work <= 0) - printk (KERN_WARNING PFX "tx/rx enable wait too long\n"); - } else { - /* Malloc up new buffer, compatible with net-2e. */ - /* Omit the four octet CRC from the length. */ - struct sk_buff *skb; - int pkt_size = rx_size - 4; - - skb = dev_alloc_skb (pkt_size + 2); - if (skb == NULL) { - printk (KERN_WARNING - "%s: Memory squeeze, dropping packet.\n", - dev->name); - /* We should check that some rx space is free. - If not, free one and mark stats->rx_dropped++. */ - tp->stats.rx_dropped++; - break; - } - skb->dev = dev; - skb_reserve (skb, 2); /* 16 byte align the IP fields. */ + /* TODO: consider allocating skb's outside of + * interrupt context, both to speed interrupt processing, + * and also to reduce the chances of having to + * drop packets here under memory pressure. + */ - if (ring_offset + rx_size + 4 > RX_BUF_LEN) { - int semi_count = - RX_BUF_LEN - ring_offset - 4; - /* This could presumably use two calls to copy_and_sum()? */ - memcpy (skb_put (skb, semi_count), - &rx_ring[ring_offset + 4], - semi_count); - memcpy (skb_put (skb, pkt_size - semi_count), - rx_ring, pkt_size - semi_count); -#ifdef RTL8139_DEBUG - { + skb = dev_alloc_skb (pkt_size + 2); + if (skb == NULL) { + printk (KERN_WARNING + "%s: Memory squeeze, dropping packet.\n", + dev->name); + tp->stats.rx_dropped++; + break; + } + skb->dev = dev; + skb_reserve (skb, 2); /* 16 byte align the IP fields. */ + + if (ring_offset + rx_size > RX_BUF_LEN) { + int semi_count = RX_BUF_LEN - ring_offset - 4; + + /* This could presumably use two calls to copy_and_sum()? */ + memcpy (skb_put (skb, semi_count), + &rx_ring[ring_offset + 4], semi_count); + memcpy (skb_put (skb, pkt_size - semi_count), + rx_ring, pkt_size - semi_count); +#if RTL8139_DEBUG > 4 + { int i; printk (KERN_DEBUG "%s: Frame wrap @%d", dev->name, semi_count); @@ -1692,29 +1755,29 @@ printk (" %2.2x", rx_ring[i]); printk ("\n"); memset (rx_ring, 0xcc, 16); - } -#endif /* RTL8139_DEBUG */ - - } else { - eth_copy_and_sum (skb, - &rx_ring[ring_offset + 4], - pkt_size, 0); - skb_put (skb, pkt_size); } - skb->protocol = eth_type_trans (skb, dev); - netif_rx (skb); - tp->stats.rx_bytes += pkt_size; - tp->stats.rx_packets++; +#endif /* RTL8139_DEBUG */ + + } else { + eth_copy_and_sum (skb, + &rx_ring[ring_offset + 4], + pkt_size, 0); + skb_put (skb, pkt_size); } + skb->protocol = eth_type_trans (skb, dev); + netif_rx (skb); + tp->stats.rx_bytes += pkt_size; + tp->stats.rx_packets++; cur_rx = (cur_rx + rx_size + 4 + 3) & ~3; RTL_W16_F (RxBufPtr, cur_rx - 16); } + DPRINTK ("%s: Done rtl8139_rx(), current %4.4x BufAddr %4.4x," - " free to %4.4x, Cmd %2.2x.\n", dev->name, cur_rx, - RTL_R16 (RxBufAddr), - RTL_R16 (RxBufPtr), - RTL_R8 (ChipCmd)); + " free to %4.4x, Cmd %2.2x.\n", dev->name, cur_rx, + RTL_R16 (RxBufAddr), + RTL_R16 (RxBufPtr), RTL_R8 (ChipCmd)); + tp->cur_rx = cur_rx; } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/acenic.c linux/drivers/net/acenic.c --- v2.4.0-test8/linux/drivers/net/acenic.c Wed Aug 9 19:19:50 2000 +++ linux/drivers/net/acenic.c Mon Sep 11 08:37:25 2000 @@ -712,7 +712,7 @@ return status; } - +#ifdef MODULE #if (LINUX_VERSION_CODE < 0x02032a) int init_module(void) { @@ -728,7 +728,7 @@ module_init(ace_module_init); module_exit(ace_module_cleanup); #endif - +#endif static void ace_free_descriptors(struct net_device *dev) { diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/epic100.c linux/drivers/net/epic100.c --- v2.4.0-test8/linux/drivers/net/epic100.c Fri Sep 8 13:27:12 2000 +++ linux/drivers/net/epic100.c Sun Sep 10 13:21:13 2000 @@ -33,9 +33,9 @@ LK1.1.4 (jgarzik): * Merge becker test version 1.09 (5/29/2000) - LK1.1.5 (jgarzik): - * Fix locking - * Limit 83c175 probe to ethernet-class PCI devices + LK1.1.5: + * Fix locking (jgarzik) + * Limit 83c175 probe to ethernet-class PCI devices (rgooch) */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/hamradio/pi2.c linux/drivers/net/hamradio/pi2.c --- v2.4.0-test8/linux/drivers/net/hamradio/pi2.c Fri Jun 23 21:55:09 2000 +++ linux/drivers/net/hamradio/pi2.c Fri Sep 8 17:56:49 2000 @@ -1182,7 +1182,7 @@ } -int __init pi_init(void) +int __init pi2_init(void) { int *port; int ioaddr = 0; @@ -1658,7 +1658,7 @@ int init_module(void) { - return pi_init(); + return pi2_init(); } void cleanup_module(void) diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/hamradio/pt.c linux/drivers/net/hamradio/pt.c --- v2.4.0-test8/linux/drivers/net/hamradio/pt.c Fri Jun 23 21:55:09 2000 +++ linux/drivers/net/hamradio/pt.c Fri Sep 8 17:56:49 2000 @@ -474,7 +474,7 @@ } /* chipset_init() */ -int __init pt_init(void) +int __init ptwin_init(void) { int *port; int ioaddr = 0; @@ -531,7 +531,7 @@ pt0b.irq = pt0a.irq; /* IRQ is shared */ return 0; -} /* pt_init() */ +} /* ptwin_init() */ /* * Probe for PT card. Also initialises the timers @@ -1758,7 +1758,7 @@ int init_module(void) { - return pt_init(); + return ptwin_init(); } void cleanup_module(void) diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/sk98lin/h/lm80.h linux/drivers/net/sk98lin/h/lm80.h --- v2.4.0-test8/linux/drivers/net/sk98lin/h/lm80.h Tue Nov 23 22:42:20 1999 +++ linux/drivers/net/sk98lin/h/lm80.h Fri Sep 15 14:34:19 2000 @@ -2,8 +2,8 @@ * * Name: lm80.h * Project: GEnesis, PCI Gigabit Ethernet Adapter - * Version: $Revision: 1.2 $ - * Date: $Date: 1999/03/12 13:26:51 $ + * Version: $Revision: 1.3 $ + * Date: $Date: 1999/11/22 13:41:19 $ * Purpose: Contains all defines for the LM80 Chip * (National Semiconductor). * @@ -27,6 +27,9 @@ * * History: * $Log: lm80.h,v $ + * Revision 1.3 1999/11/22 13:41:19 cgoos + * Changed license header to GPL. + * * Revision 1.2 1999/03/12 13:26:51 malthoff * remove __STDC__. * diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/sk98lin/h/skaddr.h linux/drivers/net/sk98lin/h/skaddr.h --- v2.4.0-test8/linux/drivers/net/sk98lin/h/skaddr.h Tue Nov 23 22:42:20 1999 +++ linux/drivers/net/sk98lin/h/skaddr.h Fri Sep 15 14:34:19 2000 @@ -2,15 +2,15 @@ * * Name: skaddr.h * Project: GEnesis, PCI Gigabit Ethernet Adapter - * Version: $Revision: 1.19 $ - * Date: $Date: 1999/05/28 10:56:07 $ - * Purpose: Header file for Address Management (MC, UC, Prom) + * Version: $Revision: 1.23 $ + * Date: $Date: 2000/08/10 11:27:50 $ + * Purpose: Header file for Address Management (MC, UC, Prom). * ******************************************************************************/ /****************************************************************************** * - * (C)Copyright 1998,1999 SysKonnect, + * (C)Copyright 1998-2000 SysKonnect, * a business unit of Schneider & Koch & Co. Datensysteme GmbH. * * This program is free software; you can redistribute it and/or modify @@ -27,6 +27,21 @@ * History: * * $Log: skaddr.h,v $ + * Revision 1.23 2000/08/10 11:27:50 rassmann + * Editorial changes. + * Preserving 32-bit alignment in structs for the adapter context. + * + * Revision 1.22 2000/08/07 11:10:40 rassmann + * Editorial changes. + * + * Revision 1.21 2000/05/04 09:39:59 rassmann + * Editorial changes. + * Corrected multicast address hashing. + * + * Revision 1.20 1999/11/22 13:46:14 cgoos + * Changed license header to GPL. + * Allowing overwrite for SK_ADDR_EQUAL. + * * Revision 1.19 1999/05/28 10:56:07 rassmann * Editorial changes. * @@ -115,32 +130,33 @@ #define __INC_SKADDR_H #ifdef __cplusplus -xxxx /* not supported yet - force error */ +#error C++ is not yet supported. extern "C" { #endif /* cplusplus */ /* defines ********************************************************************/ -#define SK_MAC_ADDR_LEN 6 /* Length of MAC address. */ -#define SK_MAX_ADDRS 14 /* #Addrs for exact match. */ +#define SK_MAC_ADDR_LEN 6 /* Length of MAC address. */ +#define SK_MAX_ADDRS 14 /* #Addrs for exact match. */ /* ----- Common return values ----- */ -#define SK_ADDR_SUCCESS 0 /* Function returned successfully. */ -#define SK_ADDR_ILLEGAL_PORT 100 /* Port number too high. */ -#define SK_ADDR_TOO_EARLY 101 /* Function called too early. */ +#define SK_ADDR_SUCCESS 0 /* Function returned successfully. */ +#define SK_ADDR_ILLEGAL_PORT 100 /* Port number too high. */ +#define SK_ADDR_TOO_EARLY 101 /* Function called too early. */ /* ----- Clear/Add flag bits ----- */ -#define SK_ADDR_PERMANENT 1 /* RLMT Address */ +#define SK_ADDR_PERMANENT 1 /* RLMT Address */ /* ----- Additional Clear flag bits ----- */ -#define SK_MC_SW_ONLY 2 /* Do not update HW when clearing. */ +#define SK_MC_SW_ONLY 2 /* Do not update HW when clearing. */ /* ----- Override flag bits ----- */ -#define SK_ADDR_VIRTUAL_ADDRESS 0 +#define SK_ADDR_LOGICAL_ADDRESS 0 +#define SK_ADDR_VIRTUAL_ADDRESS (SK_ADDR_LOGICAL_ADDRESS) /* old */ #define SK_ADDR_PHYSICAL_ADDRESS 1 /* ----- Override return values ----- */ @@ -151,7 +167,7 @@ /* ----- Partitioning of excact match table ----- */ -#define SK_ADDR_EXACT_MATCHES 16 /* #Exact match entries. */ +#define SK_ADDR_EXACT_MATCHES 16 /* #Exact match entries. */ #define SK_ADDR_FIRST_MATCH_RLMT 1 #define SK_ADDR_LAST_MATCH_RLMT 2 @@ -160,21 +176,21 @@ /* ----- SkAddrMcAdd/SkAddrMcUpdate return values ----- */ -#define SK_MC_FILTERING_EXACT 0 /* Exact filtering. */ -#define SK_MC_FILTERING_INEXACT 1 /* Inexact filtering. */ +#define SK_MC_FILTERING_EXACT 0 /* Exact filtering. */ +#define SK_MC_FILTERING_INEXACT 1 /* Inexact filtering. */ /* ----- Additional SkAddrMcAdd return values ----- */ -#define SK_MC_ILLEGAL_ADDRESS 2 /* Illegal address. */ -#define SK_MC_ILLEGAL_PORT 3 /* Illegal port (not the active one). */ -#define SK_MC_RLMT_OVERFLOW 4 /* Too many RLMT mc addresses. */ +#define SK_MC_ILLEGAL_ADDRESS 2 /* Illegal address. */ +#define SK_MC_ILLEGAL_PORT 3 /* Illegal port (not the active one). */ +#define SK_MC_RLMT_OVERFLOW 4 /* Too many RLMT mc addresses. */ /* Promiscuous mode bits ----- */ -#define SK_PROM_MODE_NONE 0 /* Normal receive. */ -#define SK_PROM_MODE_LLC 1 /* Receive all LLC frames. */ -#define SK_PROM_MODE_ALL_MC 2 /* Receive all multicast frames. */ -/* #define SK_PROM_MODE_NON_LLC 4 */ /* Receive all non-LLC frames. */ +#define SK_PROM_MODE_NONE 0 /* Normal receive. */ +#define SK_PROM_MODE_LLC 1 /* Receive all LLC frames. */ +#define SK_PROM_MODE_ALL_MC 2 /* Receive all multicast frames. */ +/* #define SK_PROM_MODE_NON_LLC 4 */ /* Receive all non-LLC frames. */ /* Macros */ @@ -192,7 +208,7 @@ *(SK_U32 *)&(((SK_U8 *)(A1))[2]) == *(SK_U32 *)&(((SK_U8 *)(A2))[2]) && \ *(SK_U32 *)&(((SK_U8 *)(A1))[0]) == *(SK_U32 *)&(((SK_U8 *)(A2))[0])) #endif /* SK_ADDR_DWORD_COMPARE */ -#endif /* SK_ADDR_EQUAL */ +#endif /* SK_ADDR_EQUAL */ /* typedefs *******************************************************************/ @@ -203,27 +219,28 @@ /* SK_FILTER is used to ensure alignment of the filter. */ typedef union s_InexactFilter { SK_U8 Bytes[8]; - SK_U64 Val; /* Dummy entry for alignment only. */ + SK_U64 Val; /* Dummy entry for alignment only. */ } SK_FILTER64; typedef struct s_AddrPort { /* ----- Public part (read-only) ----- */ - SK_MAC_ADDR PermanentMacAddress; /* Physical MAC Address. */ - SK_MAC_ADDR CurrentMacAddress; /* Physical MAC Address. */ - int PromMode; /* Promiscuous Mode. */ + SK_MAC_ADDR CurrentMacAddress; /* Current physical MAC Address. */ + SK_MAC_ADDR PermanentMacAddress; /* Permanent physical MAC Address. */ + int PromMode; /* Promiscuous Mode. */ /* ----- Private part ----- */ + SK_MAC_ADDR PreviousMacAddress; /* Prev. phys. MAC Address. */ SK_BOOL CurrentMacAddressSet; /* CurrentMacAddress is set. */ - SK_MAC_ADDR PreviousMacAddress; /* Prev. phys. MAC Address. */ + SK_U8 Align01; SK_U32 FirstExactMatchRlmt; SK_U32 NextExactMatchRlmt; SK_U32 FirstExactMatchDrv; SK_U32 NextExactMatchDrv; SK_MAC_ADDR Exact[SK_ADDR_EXACT_MATCHES]; - SK_FILTER64 InexactFilter; /* For 64-bit hash register. */ + SK_FILTER64 InexactFilter; /* For 64-bit hash register. */ } SK_ADDR_PORT; typedef struct s_Addr { @@ -232,22 +249,21 @@ SK_ADDR_PORT Port[SK_MAX_MACS]; SK_MAC_ADDR PermanentMacAddress; /* Logical MAC Address. */ - SK_MAC_ADDR CurrentMacAddress; /* Logical MAC Address. */ + SK_MAC_ADDR CurrentMacAddress; /* Logical MAC Address. */ /* ----- Private part ----- */ -#if 0 - SK_BOOL Initialized; /* Flag: Addr module is initialized. */ -#endif /* 0 */ + SK_U32 ActivePort; /* View of module ADDR. */ SK_BOOL CurrentMacAddressSet; /* CurrentMacAddress is set. */ - SK_U32 ActivePort; /* Vie of module ADDR. */ + SK_U8 Align01; + SK_U16 Align02; } SK_ADDR; /* function prototypes ********************************************************/ #ifndef SK_KR_PROTO -/* Functions provided by SkRlmt */ +/* Functions provided by SkAddr */ /* ANSI/C++ compliant function prototypes */ @@ -297,7 +313,7 @@ /* Non-ANSI/C++ compliant function prototypes */ -xxxx /* not supported yet - force error */ +#error KR-style prototypes are not yet provided. #endif /* defined(SK_KR_PROTO)) */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/sk98lin/h/skcsum.h linux/drivers/net/sk98lin/h/skcsum.h --- v2.4.0-test8/linux/drivers/net/sk98lin/h/skcsum.h Tue Nov 23 22:42:20 1999 +++ linux/drivers/net/sk98lin/h/skcsum.h Fri Sep 15 14:34:19 2000 @@ -1,9 +1,9 @@ /****************************************************************************** * * Name: skcsum.h - * Project: GEnesis, PCI Gigabit Ethernet Adapter - * Version: $Revision: 1.2 $ - * Date: $Date: 1998/09/04 12:16:34 $ + * Project: GEnesis - SysKonnect SK-NET Gigabit Ethernet (SK-98xx) + * Version: $Revision: 1.7 $ + * Date: $Date: 2000/06/29 13:17:05 $ * Purpose: Store/verify Internet checksum in send/receive packets. * ******************************************************************************/ @@ -27,6 +27,25 @@ * History: * * $Log: skcsum.h,v $ + * Revision 1.7 2000/06/29 13:17:05 rassmann + * Corrected reception of a packet with UDP checksum == 0 (which means there + * is no UDP checksum). + * + * Revision 1.6 2000/02/28 12:33:44 cgoos + * Changed C++ style comments to C style. + * + * Revision 1.5 2000/02/21 12:10:05 cgoos + * Fixed license comment. + * + * Revision 1.4 2000/02/21 11:08:37 cgoos + * Merged changes back into common source. + * + * Revision 1.1 1999/07/26 14:47:49 mkarl + * changed from common source to windows specific source + * added return SKCS_STATUS_IP_CSUM_ERROR_UDP and + * SKCS_STATUS_IP_CSUM_ERROR_TCP to pass the NidsTester + * changes for Tx csum offload + * * Revision 1.2 1998/09/04 12:16:34 mhaveman * Checked in for Stephan to allow compilation. * -Added definition SK_CSUM_EVENT_CLEAR_PROTO_STATS to clear statistic @@ -98,24 +117,32 @@ * * SKCS_STATUS_UNKNOWN_IP_VERSION - Not an IP v4 frame. * SKCS_STATUS_IP_CSUM_ERROR - IP checksum error. + * SKCS_STATUS_IP_CSUM_ERROR_TCP - IP checksum error in TCP frame. + * SKCS_STATUS_IP_CSUM_ERROR_UDP - IP checksum error in UDP frame * SKCS_STATUS_IP_FRAGMENT - IP fragment (IP checksum ok). * SKCS_STATUS_IP_CSUM_OK - IP checksum ok (not a TCP or UDP frame). * SKCS_STATUS_TCP_CSUM_ERROR - TCP checksum error (IP checksum ok). * SKCS_STATUS_UDP_CSUM_ERROR - UDP checksum error (IP checksum ok). * SKCS_STATUS_TCP_CSUM_OK - IP and TCP checksum ok. * SKCS_STATUS_UDP_CSUM_OK - IP and UDP checksum ok. + * SKCS_STATUS_IP_CSUM_OK_NO_UDP - IP checksum OK and no UDP checksum. */ #ifndef SKCS_OVERWRITE_STATUS /* User overwrite? */ #define SKCS_STATUS int /* Define status type. */ #define SKCS_STATUS_UNKNOWN_IP_VERSION 1 -#define SKCS_STATUS_IP_CSUM_ERROR 2 -#define SKCS_STATUS_IP_FRAGMENT 3 -#define SKCS_STATUS_IP_CSUM_OK 4 -#define SKCS_STATUS_TCP_CSUM_ERROR 5 -#define SKCS_STATUS_UDP_CSUM_ERROR 6 -#define SKCS_STATUS_TCP_CSUM_OK 7 -#define SKCS_STATUS_UDP_CSUM_OK 8 +#define SKCS_STATUS_IP_CSUM_ERROR 2 +#define SKCS_STATUS_IP_FRAGMENT 3 +#define SKCS_STATUS_IP_CSUM_OK 4 +#define SKCS_STATUS_TCP_CSUM_ERROR 5 +#define SKCS_STATUS_UDP_CSUM_ERROR 6 +#define SKCS_STATUS_TCP_CSUM_OK 7 +#define SKCS_STATUS_UDP_CSUM_OK 8 +/* needed for Microsoft */ +#define SKCS_STATUS_IP_CSUM_ERROR_UDP 9 +#define SKCS_STATUS_IP_CSUM_ERROR_TCP 10 +/* UDP checksum may be omitted */ +#define SKCS_STATUS_IP_CSUM_OK_NO_UDP 11 #endif /* !SKCS_OVERWRITE_STATUS */ /* Clear protocol statistics event. */ @@ -158,7 +185,7 @@ SK_U64 RxUnableCts; /* Unable to verify receive checksum. */ SK_U64 RxErrCts; /* Receive checksum error. */ SK_U64 TxOkCts; /* Transmit checksum ok. */ - SK_U64 TxUnableCts; /* Unable to verify transmit checksum. */ + SK_U64 TxUnableCts; /* Unable to calculate checksum in hw. */ } SKCS_PROTO_STATS; /* @@ -167,6 +194,9 @@ typedef struct s_Csum { /* Enabled receive SK_PROTO_XXX bit flags. */ unsigned ReceiveFlags; +#ifdef TX_CSUM + unsigned TransmitFlags; +#endif /* TX_CSUM */ /* The protocol statistics structure; one per supported protocol. */ SKCS_PROTO_STATS ProtoStats[SKCS_NUM_PROTOCOLS]; diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/sk98lin/h/skdebug.h linux/drivers/net/sk98lin/h/skdebug.h --- v2.4.0-test8/linux/drivers/net/sk98lin/h/skdebug.h Tue Nov 23 22:42:20 1999 +++ linux/drivers/net/sk98lin/h/skdebug.h Fri Sep 15 14:34:19 2000 @@ -2,8 +2,8 @@ * * Name: skdebug.h * Project: GEnesis, PCI Gigabit Ethernet Adapter - * Version: $Revision: 1.9 $ - * Date: $Date: 1999/09/14 14:02:43 $ + * Version: $Revision: 1.10 $ + * Date: $Date: 1999/11/22 13:47:40 $ * Purpose: SK specific DEBUG support * ******************************************************************************/ @@ -26,6 +26,9 @@ * * History: * $Log: skdebug.h,v $ + * Revision 1.10 1999/11/22 13:47:40 cgoos + * Changed license header to GPL. + * * Revision 1.9 1999/09/14 14:02:43 rwahl * Added SK_DBGMOD_PECP. * diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/sk98lin/h/skdrv1st.h linux/drivers/net/sk98lin/h/skdrv1st.h --- v2.4.0-test8/linux/drivers/net/sk98lin/h/skdrv1st.h Tue Nov 23 22:42:20 1999 +++ linux/drivers/net/sk98lin/h/skdrv1st.h Fri Sep 15 14:34:19 2000 @@ -2,8 +2,8 @@ * * Name: skdrv1st.h * Project: GEnesis, PCI Gigabit Ethernet Adapter - * Version: $Revision: 1.6 $ - * Date: $Date: 1999/07/27 08:03:33 $ + * Version: $Revision: 1.8 $ + * Date: $Date: 2000/02/21 12:19:18 $ * Purpose: First header file for driver and all other modules * ******************************************************************************/ @@ -27,6 +27,15 @@ * History: * * $Log: skdrv1st.h,v $ + * Revision 1.8 2000/02/21 12:19:18 cgoos + * Added default for SK_DEBUG_CHKMOD/_CHKCAT + * + * Revision 1.7 1999/11/22 13:50:00 cgoos + * Changed license header to GPL. + * Added overwrite for several functions. + * Removed linux 2.0.x definitions. + * Removed PCI vendor ID definition (now in kernel). + * * Revision 1.6 1999/07/27 08:03:33 cgoos * Changed SK_IN/OUT macros to readX/writeX instead of memory * accesses (necessary for ALPHA). @@ -175,6 +184,12 @@ #ifdef DEBUG #define SK_DBG_PRINTF printk +#ifndef SK_DEBUG_CHKMOD +#define SK_DEBUG_CHKMOD 0 +#endif +#ifndef SK_DEBUG_CHKCAT +#define SK_DEBUG_CHKCAT 0 +#endif /* those come from the makefile */ #define SK_DBG_CHKMOD(pAC) (SK_DEBUG_CHKMOD) #define SK_DBG_CHKCAT(pAC) (SK_DEBUG_CHKCAT) diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/sk98lin/h/skerror.h linux/drivers/net/sk98lin/h/skerror.h --- v2.4.0-test8/linux/drivers/net/sk98lin/h/skerror.h Tue Nov 23 22:42:20 1999 +++ linux/drivers/net/sk98lin/h/skerror.h Fri Sep 15 14:34:19 2000 @@ -2,8 +2,8 @@ * * Name: skerror.h * Project: GEnesis, PCI Gigabit Ethernet Adapter - * Version: $Revision: 1.3 $ - * Date: $Date: 1999/09/14 14:04:42 $ + * Version: $Revision: 1.4 $ + * Date: $Date: 1999/11/22 13:51:59 $ * Purpose: SK specific Error log support * ******************************************************************************/ @@ -26,6 +26,9 @@ * * History: * $Log: skerror.h,v $ + * Revision 1.4 1999/11/22 13:51:59 cgoos + * Changed license header to GPL. + * * Revision 1.3 1999/09/14 14:04:42 rwahl * Added error base SK_ERRBASE_PECP. * Changed error base for driver. diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/sk98lin/h/skgedrv.h linux/drivers/net/sk98lin/h/skgedrv.h --- v2.4.0-test8/linux/drivers/net/sk98lin/h/skgedrv.h Tue Nov 23 22:42:20 1999 +++ linux/drivers/net/sk98lin/h/skgedrv.h Fri Sep 15 14:34:19 2000 @@ -2,8 +2,8 @@ * * Name: skgedrv.h * Project: GEnesis, PCI Gigabit Ethernet Adapter - * Version: $Revision: 1.3 $ - * Date: $Date: 1998/12/01 13:31:39 $ + * Version: $Revision: 1.4 $ + * Date: $Date: 1999/11/22 13:52:46 $ * Purpose: Interface with the driver * ******************************************************************************/ @@ -27,6 +27,9 @@ * History: * * $Log: skgedrv.h,v $ + * Revision 1.4 1999/11/22 13:52:46 cgoos + * Changed license header to GPL. + * * Revision 1.3 1998/12/01 13:31:39 cgoos * SWITCH INTERN Event added. * diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/sk98lin/h/skgehw.h linux/drivers/net/sk98lin/h/skgehw.h --- v2.4.0-test8/linux/drivers/net/sk98lin/h/skgehw.h Tue Nov 23 22:42:20 1999 +++ linux/drivers/net/sk98lin/h/skgehw.h Fri Sep 15 14:34:19 2000 @@ -2,8 +2,8 @@ * * Name: skgehw.h * Project: GEnesis, PCI Gigabit Ethernet Adapter - * Version: $Revision: 1.33 $ - * Date: $Date: 1999/08/27 11:17:10 $ + * Version: $Revision: 1.35 $ + * Date: $Date: 2000/05/19 10:17:13 $ * Purpose: Defines and Macros for the Gigabit Ethernet Adapter Product * Family * @@ -27,6 +27,12 @@ * * History: * $Log: skgehw.h,v $ + * Revision 1.35 2000/05/19 10:17:13 cgoos + * Added inactivity check in PHY_READ (in DEBUG mode only). + * + * Revision 1.34 1999/11/22 13:53:40 cgoos + * Changed license header to GPL. + * * Revision 1.33 1999/08/27 11:17:10 malthoff * It's more savely to put bracket around marco parameters. * Brackets added for PHY_READ and PHY_WRITE. @@ -1627,19 +1633,44 @@ * written. * * usage: PHY_READ(IoC, pPort, MAC_1, PHY_CTRL, Value); + * Warning: a PHY_READ on an uninitialized PHY (PHY still in reset) never + * comes back. This is checked in DEBUG mode. */ +#ifndef DEBUG +#define PHY_READ(IoC, pPort, Mac, PhyReg, pVal) { \ + SK_U16 Mmu; \ + \ + XM_OUT16((IoC),(Mac), XM_PHY_ADDR, (PhyReg)|(pPort)->PhyAddr); \ + XM_IN16((IoC), (Mac), XM_PHY_DATA, (pVal)); \ + if ((pPort)->PhyType != SK_PHY_XMAC) { \ + do { \ + XM_IN16((IoC), (Mac), XM_MMU_CMD, &Mmu); \ + } while ((Mmu & XM_MMU_PHY_RDY) == 0); \ + XM_IN16((IoC), (Mac), XM_PHY_DATA, (pVal)); \ + } \ +} +#else #define PHY_READ(IoC, pPort, Mac, PhyReg, pVal) { \ SK_U16 Mmu; \ + int __i = 0; \ \ XM_OUT16((IoC),(Mac), XM_PHY_ADDR, (PhyReg)|(pPort)->PhyAddr); \ XM_IN16((IoC), (Mac), XM_PHY_DATA, (pVal)); \ if ((pPort)->PhyType != SK_PHY_XMAC) { \ do { \ XM_IN16((IoC), (Mac), XM_MMU_CMD, &Mmu); \ + __i++; \ + if (__i > 10000) { \ + SK_DBG_PRINTF("*****************************\n"); \ + SK_DBG_PRINTF("PHY_READ on uninitialized PHY\n"); \ + SK_DBG_PRINTF("*****************************\n"); \ + break; \ + } \ } while ((Mmu & XM_MMU_PHY_RDY) == 0); \ XM_IN16((IoC), (Mac), XM_PHY_DATA, (pVal)); \ } \ } +#endif #define PHY_WRITE(IoC, pPort, Mac, PhyReg, Val) { \ SK_U16 Mmu; \ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/sk98lin/h/skgehwt.h linux/drivers/net/sk98lin/h/skgehwt.h --- v2.4.0-test8/linux/drivers/net/sk98lin/h/skgehwt.h Tue Nov 23 22:42:20 1999 +++ linux/drivers/net/sk98lin/h/skgehwt.h Fri Sep 15 14:34:19 2000 @@ -2,8 +2,8 @@ * * Name: skhwt.h * Project: GEnesis, PCI Gigabit Ethernet Adapter - * Version: $Revision: 1.4 $ - * Date: $Date: 1998/08/19 09:50:58 $ + * Version: $Revision: 1.5 $ + * Date: $Date: 1999/11/22 13:54:24 $ * Purpose: Defines for the hardware timer functions * ******************************************************************************/ @@ -27,6 +27,9 @@ * History: * * $Log: skgehwt.h,v $ + * Revision 1.5 1999/11/22 13:54:24 cgoos + * Changed license header to GPL. + * * Revision 1.4 1998/08/19 09:50:58 gklug * fix: remove struct keyword from c-code (see CCC) add typedefs * diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/sk98lin/h/skgei2c.h linux/drivers/net/sk98lin/h/skgei2c.h --- v2.4.0-test8/linux/drivers/net/sk98lin/h/skgei2c.h Tue Nov 23 22:42:20 1999 +++ linux/drivers/net/sk98lin/h/skgei2c.h Fri Sep 15 14:34:19 2000 @@ -2,8 +2,8 @@ * * Name: skgei2c.h * Project: GEnesis, PCI Gigabit Ethernet Adapter - * Version: $Revision: 1.16 $ - * Date: $Date: 1999/11/12 08:24:10 $ + * Version: $Revision: 1.17 $ + * Date: $Date: 1999/11/22 13:55:25 $ * Purpose: Special genesis defines for I2C * (taken from Monalisa (taken from Concentrator)) * @@ -28,6 +28,9 @@ * History: * * $Log: skgei2c.h,v $ + * Revision 1.17 1999/11/22 13:55:25 cgoos + * Changed license header to GPL. + * * Revision 1.16 1999/11/12 08:24:10 malthoff * Change voltage warning and error limits * (warning +-5%, error +-10%). diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/sk98lin/h/skgeinit.h linux/drivers/net/sk98lin/h/skgeinit.h --- v2.4.0-test8/linux/drivers/net/sk98lin/h/skgeinit.h Tue Nov 23 22:42:20 1999 +++ linux/drivers/net/sk98lin/h/skgeinit.h Fri Sep 15 14:34:19 2000 @@ -2,15 +2,15 @@ * * Name: skgeinit.h * Project: GEnesis, PCI Gigabit Ethernet Adapter - * Version: $Revision: 1.44 $ - * Date: $Date: 1999/10/26 07:34:15 $ + * Version: $Revision: 1.46 $ + * Date: $Date: 2000/08/10 11:28:00 $ * Purpose: Structures and prototypes for the GE Init Module * ******************************************************************************/ /****************************************************************************** * - * (C)Copyright 1998,1999 SysKonnect, + * (C)Copyright 1998-2000 SysKonnect, * a business unit of Schneider & Koch & Co. Datensysteme GmbH. * * This program is free software; you can redistribute it and/or modify @@ -27,6 +27,13 @@ * History: * * $Log: skgeinit.h,v $ + * Revision 1.46 2000/08/10 11:28:00 rassmann + * Editorial changes. + * Preserving 32-bit alignment in structs for the adapter context. + * + * Revision 1.45 1999/11/22 13:56:19 cgoos + * Changed license header to GPL. + * * Revision 1.44 1999/10/26 07:34:15 malthoff * The define SK_LNK_ON has been lost in v1.41. * @@ -443,61 +450,63 @@ SK_TIMER PWaTimer; /* Workaround Timer */ #endif SK_U64 PPrevShorts; /* Previous short Counter checking */ - SK_U64 PPrevRx; /* Previous RxOk Counter checking */ - SK_U64 PPrevFcs; /* Previous FCS Error Counter checking */ - SK_U64 PRxLim; /* Previous RxOk Counter checking */ - int PLinkResCt; /* Link Restart Counter */ - int PAutoNegTimeOut;/* AutoNegotiation timeout current value */ - int PRxQSize; /* Port Rx Queue Size in kB */ - int PXSQSize; /* Port Synchronous Transmit Queue Size in kB */ - int PXAQSize; /* Port Asynchronous Transmit Queue Size in kB*/ + SK_U64 PPrevRx; /* Previous RxOk Counter checking */ + SK_U64 PPrevFcs; /* Previous FCS Error Counter checking */ + SK_U64 PRxLim; /* Previous RxOk Counter checking */ + int PLinkResCt; /* Link Restart Counter */ + int PAutoNegTimeOut;/* AutoNegotiation timeout current value */ + int PRxQSize; /* Port Rx Queue Size in kB */ + int PXSQSize; /* Port Synchronous Transmit Queue Size in kB */ + int PXAQSize; /* Port Asynchronous Transmit Queue Size in kB*/ SK_U32 PRxQRamStart; /* Receive Queue RAM Buffer Start Address */ - SK_U32 PRxQRamEnd; /* Receive Queue RAM Buffer End Address */ + SK_U32 PRxQRamEnd; /* Receive Queue RAM Buffer End Address */ SK_U32 PXsQRamStart; /* Sync Tx Queue RAM Buffer Start Address */ - SK_U32 PXsQRamEnd; /* Sync Tx Queue RAM Buffer End Address */ + SK_U32 PXsQRamEnd; /* Sync Tx Queue RAM Buffer End Address */ SK_U32 PXaQRamStart; /* Async Tx Queue RAM Buffer Start Address */ - SK_U32 PXaQRamEnd; /* Async Tx Queue RAM Buffer End Address */ - int PRxQOff; /* Rx Queue Address Offset */ - int PXsQOff; /* Synchronous Tx Queue Address Offset */ - int PXaQOff; /* Asynchronous Tx Queue Address Offset */ - SK_U16 PRxCmd; /* Port Receive Command Configuration Value */ - SK_U16 PIsave; /* Saved Interrupt status word */ - SK_U16 PSsave; /* Saved PHY status word */ - SK_BOOL PHWLinkUp; /* The hardware Link is up (wireing) */ - SK_BOOL PState; /* Is port initialized ? */ + SK_U32 PXaQRamEnd; /* Async Tx Queue RAM Buffer End Address */ + int PRxQOff; /* Rx Queue Address Offset */ + int PXsQOff; /* Synchronous Tx Queue Address Offset */ + int PXaQOff; /* Asynchronous Tx Queue Address Offset */ + SK_U16 PRxCmd; /* Port Receive Command Configuration Value */ + SK_U16 PIsave; /* Saved Interrupt status word */ + SK_U16 PSsave; /* Saved PHY status word */ + SK_BOOL PHWLinkUp; /* The hardware Link is up (wireing) */ + SK_BOOL PState; /* Is port initialized ? */ SK_BOOL PLinkBroken; /* Is Link broken ? */ - SK_BOOL PCheckPar; /* Do we check for parity errors ? */ - SK_U8 PLinkCap; /* Link Capabilities */ + SK_BOOL PCheckPar; /* Do we check for parity errors ? */ + SK_U8 PLinkCap; /* Link Capabilities */ SK_U8 PLinkModeConf; /* Link Mode configured */ - SK_U8 PLinkMode; /* Link Mode currently used */ - SK_U8 PLinkModeStatus; /* Link Mode Status */ + SK_U8 PLinkMode; /* Link Mode currently used */ + SK_U8 PLinkModeStatus;/* Link Mode Status */ SK_U8 PFlowCtrlCap; /* Flow Control Capabilities */ SK_U8 PFlowCtrlMode; /* Flow Control Mode */ - SK_U8 PFlowCtrlStatus; /* Flow Control Status */ - SK_U8 PMSCap; /* Master/Slave Capabilities */ - SK_U8 PMSMode; /* Master/Slave Mode */ - SK_U8 PMSStatus; /* Master/Slave Status */ + SK_U8 PFlowCtrlStatus;/* Flow Control Status */ + SK_U8 PMSCap; /* Master/Slave Capabilities */ + SK_U8 PMSMode; /* Master/Slave Mode */ + SK_U8 PMSStatus; /* Master/Slave Status */ SK_U8 PAutoNegFail; /* Autonegotiation fail flag */ SK_U8 PLipaAutoNeg; /* Autonegotiation possible with Link Partner */ + SK_U16 PhyAddr; /* MDIO/MDC PHY address */ int PhyType; /* PHY used on this port */ - SK_U16 PhyAddr; /* MDIO/MDC PHY address */ } SK_GEPORT; /* * Gigabit Ethernet Initalization Struct - * (has to be included in the adapter context + * (has to be included in the adapter context) */ typedef struct s_GeInit { - int GIMacsFound; /* Number of MACs found on this adapter */ - int GIPciHwRev; /* PCI HW Revision Number */ - SK_U32 GIRamOffs; /* RAM Address Offset for addr calculation */ - int GIRamSize; /* The RAM size of the adapter in kB */ - int GIHstClkFact; /* Host Clock Factor (62.5 / HstClk * 100) */ - int GIPortUsage; /* driver port usage: SK_RED_LINK/SK_MUL_LINK */ - SK_U32 GIPollTimerVal; /* Descriptor Poll Timer Init Val in clk ticks*/ - int GILevel; /* Initialization Level Completed */ - SK_BOOL GIAnyPortAct; /* Is True if one or more port is initialized */ - SK_GEPORT GP[SK_MAX_MACS]; /* Port Dependent Information */ + int GIMacsFound; /* Number of MACs found on this adapter */ + int GIPciHwRev; /* PCI HW Revision Number */ + SK_U32 GIRamOffs; /* RAM Address Offset for addr calculation */ + int GIRamSize; /* The RAM size of the adapter in kB */ + int GIHstClkFact; /* Host Clock Factor (62.5 / HstClk * 100) */ + int GIPortUsage; /* driver port usage: SK_RED_LINK/SK_MUL_LINK */ + SK_U32 GIPollTimerVal; /* Descriptor Poll Timer Init Val in clk ticks*/ + int GILevel; /* Initialization Level Completed */ + SK_GEPORT GP[SK_MAX_MACS];/* Port Dependent Information */ + SK_BOOL GIAnyPortAct; /* Is True if one or more port is initialized */ + SK_U8 Align01; + SK_U16 Align02; } SK_GEINIT; /* diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/sk98lin/h/skgepnm2.h linux/drivers/net/sk98lin/h/skgepnm2.h --- v2.4.0-test8/linux/drivers/net/sk98lin/h/skgepnm2.h Tue Nov 23 22:42:20 1999 +++ linux/drivers/net/sk98lin/h/skgepnm2.h Fri Sep 15 14:34:19 2000 @@ -2,8 +2,8 @@ * * Name: skgepnm2.h * Project: GEnesis, PCI Gigabit Ethernet Adapter - * Version: $Revision: 1.24 $ - * Date: $Date: 1999/04/13 15:11:11 $ + * Version: $Revision: 1.28 $ + * Date: $Date: 2000/08/03 15:12:48 $ * Purpose: Defines for Private Network Management Interface * ****************************************************************************/ @@ -27,6 +27,20 @@ * History: * * $Log: skgepnm2.h,v $ + * Revision 1.28 2000/08/03 15:12:48 rwahl + * - Additional comment for MAC statistic data structure. + * + * Revision 1.27 2000/08/01 16:10:18 rwahl + * - Added mac statistic data structure for StatRxLongFrame counter. + * + * Revision 1.26 2000/03/31 13:51:34 rwahl + * Added SK_UPTR cast to offset calculation for PNMI struct fields; + * missing cast caused compiler warnings by Win64 compiler. + * + * Revision 1.25 1999/11/22 13:57:41 cgoos + * Changed license header to GPL. + * Allowing overwrite for SK_PNMI_STORE/_READ defines. + * * Revision 1.24 1999/04/13 15:11:11 mhaveman * Changed copyright. * @@ -203,6 +217,8 @@ /* * MAC statistic data structures + * Only for the first 64 counters: the number relates to the bit in the + * XMAC overflow status register */ #define SK_PNMI_HTX 0 #define SK_PNMI_HTX_OCTET 1 @@ -274,6 +290,8 @@ #define SK_PNMI_HTX_SYNC 64 #define SK_PNMI_HTX_SYNC_OCTET 65 +#define SK_PNMI_HRX_LONGFRAMES 66 + #define SK_PNMI_MAX_IDX (SK_PNMI_CNT_NO) /* @@ -288,25 +306,25 @@ /* * SK_PNMI_STRUCT_DATA copy offset evaluation macros */ -#define SK_PNMI_OFF(e) ((SK_U32)&(((SK_PNMI_STRUCT_DATA *)0)->e)) -#define SK_PNMI_MAI_OFF(e) ((SK_U32)&(((SK_PNMI_STRUCT_DATA *)0)->e)) -#define SK_PNMI_VPD_OFF(e) ((SK_U32)&(((SK_PNMI_VPD *)0)->e)) -#define SK_PNMI_SEN_OFF(e) ((SK_U32)&(((SK_PNMI_SENSOR *)0)->e)) -#define SK_PNMI_CHK_OFF(e) ((SK_U32)&(((SK_PNMI_CHECKSUM *)0)->e)) -#define SK_PNMI_STA_OFF(e) ((SK_U32)&(((SK_PNMI_STAT *)0)->e)) -#define SK_PNMI_CNF_OFF(e) ((SK_U32)&(((SK_PNMI_CONF *)0)->e)) -#define SK_PNMI_RLM_OFF(e) ((SK_U32)&(((SK_PNMI_RLMT *)0)->e)) -#define SK_PNMI_MON_OFF(e) ((SK_U32)&(((SK_PNMI_RLMT_MONITOR *)0)->e)) -#define SK_PNMI_TRP_OFF(e) ((SK_U32)&(((SK_PNMI_TRAP *)0)->e)) +#define SK_PNMI_OFF(e) ((SK_U32)(SK_UPTR)&(((SK_PNMI_STRUCT_DATA *)0)->e)) +#define SK_PNMI_MAI_OFF(e) ((SK_U32)(SK_UPTR)&(((SK_PNMI_STRUCT_DATA *)0)->e)) +#define SK_PNMI_VPD_OFF(e) ((SK_U32)(SK_UPTR)&(((SK_PNMI_VPD *)0)->e)) +#define SK_PNMI_SEN_OFF(e) ((SK_U32)(SK_UPTR)&(((SK_PNMI_SENSOR *)0)->e)) +#define SK_PNMI_CHK_OFF(e) ((SK_U32)(SK_UPTR)&(((SK_PNMI_CHECKSUM *)0)->e)) +#define SK_PNMI_STA_OFF(e) ((SK_U32)(SK_UPTR)&(((SK_PNMI_STAT *)0)->e)) +#define SK_PNMI_CNF_OFF(e) ((SK_U32)(SK_UPTR)&(((SK_PNMI_CONF *)0)->e)) +#define SK_PNMI_RLM_OFF(e) ((SK_U32)(SK_UPTR)&(((SK_PNMI_RLMT *)0)->e)) +#define SK_PNMI_MON_OFF(e) ((SK_U32)(SK_UPTR)&(((SK_PNMI_RLMT_MONITOR *)0)->e)) +#define SK_PNMI_TRP_OFF(e) ((SK_U32)(SK_UPTR)&(((SK_PNMI_TRAP *)0)->e)) #define SK_PNMI_SET_STAT(b,s,o) {SK_U32 Val32; char *pVal; \ Val32 = (s); \ - pVal = (char *)(b) + ((SK_U32) \ + pVal = (char *)(b) + ((SK_U32)(SK_UPTR) \ &(((SK_PNMI_STRUCT_DATA *)0)-> \ ReturnStatus.ErrorStatus)); \ SK_PNMI_STORE_U32(pVal, Val32); \ Val32 = (o); \ - pVal = (char *)(b) + ((SK_U32) \ + pVal = (char *)(b) + ((SK_U32)(SK_UPTR) \ &(((SK_PNMI_STRUCT_DATA *)0)-> \ ReturnStatus.ErrorOffset)); \ SK_PNMI_STORE_U32(pVal, Val32);} diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/sk98lin/h/skgepnmi.h linux/drivers/net/sk98lin/h/skgepnmi.h --- v2.4.0-test8/linux/drivers/net/sk98lin/h/skgepnmi.h Tue Nov 23 22:42:20 1999 +++ linux/drivers/net/sk98lin/h/skgepnmi.h Fri Sep 15 14:34:19 2000 @@ -2,8 +2,8 @@ * * Name: skgepnmi.h * Project: GEnesis, PCI Gigabit Ethernet Adapter - * Version: $Revision: 1.37 $ - * Date: $Date: 1999/09/14 14:25:32 $ + * Version: $Revision: 1.44 $ + * Date: $Date: 2000/09/07 07:35:27 $ * Purpose: Defines for Private Network Management Interface * ****************************************************************************/ @@ -27,6 +27,34 @@ * History: * * $Log: skgepnmi.h,v $ + * Revision 1.44 2000/09/07 07:35:27 rwahl + * - removed NDIS counter specific data type. + * - fixed spelling for OID_SKGE_RLMT_PORT_PREFERRED. + * + * Revision 1.43 2000/08/04 11:41:08 rwahl + * - Fixed compiler warning (port is always >= 0) for macros + * SK_PNMI_CNT_RX_LONGFRAMES & SK_PNMI_CNT_SYNC_OCTETS + * + * Revision 1.42 2000/08/03 15:14:07 rwahl + * - Corrected error in driver macros addressing a physical port. + * + * Revision 1.41 2000/08/01 16:22:29 rwahl + * - Changed MDB version to 3.1. + * - Added definitions for StatRxLongFrames counter. + * - Added macro to be used by driver to count long frames received. + * - Added directive to control width (default = 32bit) of NDIS statistic + * counters (SK_NDIS_64BIT_CTR). + * + * Revision 1.40 2000/03/31 13:51:34 rwahl + * Added SK_UPTR cast to offset calculation for PNMI struct fields; + * missing cast caused compiler warnings by Win64 compiler. + * + * Revision 1.39 1999/12/06 10:09:47 rwahl + * Added new error log message. + * + * Revision 1.38 1999/11/22 13:57:55 cgoos + * Changed license header to GPL. + * * Revision 1.37 1999/09/14 14:25:32 rwahl * Set MDB version for 1000Base-T (sensors, Master/Slave) changes. * @@ -164,7 +192,7 @@ /* * Management Database Version */ -#define SK_PNMI_MDB_VERSION 0x00030000 /* 3.0 */ +#define SK_PNMI_MDB_VERSION 0x00030001 /* 3.1 */ /* @@ -383,6 +411,7 @@ #define OID_SKGE_STAT_RX_511 0xFF020154 #define OID_SKGE_STAT_RX_1023 0xFF020155 #define OID_SKGE_STAT_RX_MAX 0xFF020156 +#define OID_SKGE_STAT_RX_LONGFRAMES 0xFF020157 #define OID_SKGE_PHYS_CUR_ADDR 0xFF010120 #define OID_SKGE_PHYS_FAC_ADDR 0xFF010121 @@ -405,7 +434,7 @@ #define OID_SKGE_RLMT_MODE 0xFF010140 #define OID_SKGE_RLMT_PORT_NUMBER 0xFF010141 #define OID_SKGE_RLMT_PORT_ACTIVE 0xFF010142 -#define OID_SKGE_RLMT_PORT_PREFERED 0xFF010143 +#define OID_SKGE_RLMT_PORT_PREFERRED 0xFF010143 #define OID_SKGE_RLMT_CHANGE_CTS 0xFF020160 #define OID_SKGE_RLMT_CHANGE_TIME 0xFF020161 #define OID_SKGE_RLMT_CHANGE_ESTIM 0xFF020162 @@ -559,6 +588,8 @@ #define SK_PNMI_ERR050MSG "MacUpdate: Cannot update statistic counter" #define SK_PNMI_ERR051 (SK_ERRBASE_PNMI + 51) #define SK_PNMI_ERR051MSG "SkPnmiEvent: Port switch suspicious" +#define SK_PNMI_ERR052 (SK_ERRBASE_PNMI + 52) +#define SK_PNMI_ERR052MSG "MacPrivateConf: SK_HWEV_SET_ROLE returned not 0" /* * Management counter macros called by the driver @@ -592,9 +623,16 @@ #define SK_PNMI_CNT_SYNC_OCTETS(pAC,p,v) \ { \ - if (((p) >= 0) && ((p) < SK_MAX_MACS)) { \ - ((pAC)->Pnmi.StatSyncCts[p])++; \ - (pAC)->Pnmi.StatSyncOctetsCts[p] += (SK_U64)(v); \ + if ((p) < SK_MAX_MACS) { \ + ((pAC)->Pnmi.Port[p].StatSyncCts)++; \ + (pAC)->Pnmi.Port[p].StatSyncOctetsCts += (SK_U64)(v); \ + } \ + } + +#define SK_PNMI_CNT_RX_LONGFRAMES(pAC,p) \ + { \ + if ((p) < SK_MAX_MACS) { \ + ((pAC)->Pnmi.Port[p].StatRxLongFrameCts)++; \ } \ } @@ -687,6 +725,7 @@ SK_U64 StatRxBroadcastOkCts; SK_U64 StatRxMulticastOkCts; SK_U64 StatRxUnicastOkCts; + SK_U64 StatRxLongFramesCts; SK_U64 StatRxPauseMacCtrlCts; SK_U64 StatRxMacCtrlCts; SK_U64 StatRxPauseMacCtrlErrorCts; @@ -809,8 +848,9 @@ } SK_PNMI_STRUCT_DATA; #define SK_PNMI_STRUCT_SIZE (sizeof(SK_PNMI_STRUCT_DATA)) -#define SK_PNMI_MIN_STRUCT_SIZE ((unsigned int)&(((SK_PNMI_STRUCT_DATA *)0)->\ - VpdFreeBytes)) /* +#define SK_PNMI_MIN_STRUCT_SIZE ((unsigned int)(SK_UPTR)\ + &(((SK_PNMI_STRUCT_DATA *)0)->VpdFreeBytes)) + /* * ReturnStatus field * must be located * before VpdFreeBytes @@ -822,7 +862,7 @@ #define SK_PNMI_MAX_PROTOS 3 #define SK_PNMI_SCNT_NOT 64 -#define SK_PNMI_CNT_NO 66 +#define SK_PNMI_CNT_NO 67 /* * Estimate data structure @@ -843,6 +883,7 @@ SK_U64 CounterOffset[SK_PNMI_CNT_NO]; SK_U64 StatSyncCts; SK_U64 StatSyncOctetsCts; + SK_U64 StatRxLongFrameCts; SK_BOOL ActiveFlag; } SK_PNMI_PORT; diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/sk98lin/h/skgesirq.h linux/drivers/net/sk98lin/h/skgesirq.h --- v2.4.0-test8/linux/drivers/net/sk98lin/h/skgesirq.h Tue Nov 23 22:42:20 1999 +++ linux/drivers/net/sk98lin/h/skgesirq.h Fri Sep 15 14:34:19 2000 @@ -2,8 +2,8 @@ * * Name: skgesirq.h * Project: GEnesis, PCI Gigabit Ethernet Adapter - * Version: $Revision: 1.18 $ - * Date: $Date: 1999/05/19 07:32:59 $ + * Version: $Revision: 1.20 $ + * Date: $Date: 1999/12/06 10:00:44 $ * Purpose: SK specific Gigabit Ethernet special IRQ functions * ******************************************************************************/ @@ -26,6 +26,12 @@ * * History: * $Log: skgesirq.h,v $ + * Revision 1.20 1999/12/06 10:00:44 cgoos + * Added SET event for role. + * + * Revision 1.19 1999/11/22 13:58:26 cgoos + * Changed license header to GPL. + * * Revision 1.18 1999/05/19 07:32:59 cgoos * Changes for 1000Base-T. * @@ -99,6 +105,7 @@ #define SK_HWEV_UPDATE_STAT 5 /* Update Statistics by PNMI */ #define SK_HWEV_SET_LMODE 6 /* Set Link Mode by PNMI */ #define SK_HWEV_SET_FLOWMODE 7 /* Set Flow Control Mode by PNMI */ +#define SK_HWEV_SET_ROLE 8 /* Set Master/Slave (Role) by PNMI */ #define SK_WA_ACT_TIME (5000000L) /* 5 sec */ #define SK_WA_INA_TIME (100000L) /* 100 msec */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/sk98lin/h/ski2c.h linux/drivers/net/sk98lin/h/ski2c.h --- v2.4.0-test8/linux/drivers/net/sk98lin/h/ski2c.h Tue Nov 23 22:42:20 1999 +++ linux/drivers/net/sk98lin/h/ski2c.h Fri Sep 15 14:34:19 2000 @@ -2,8 +2,8 @@ * * Name: ski2c.h * Project: GEnesis, PCI Gigabit Ethernet Adapter - * Version: $Revision: 1.27 $ - * Date: $Date: 1999/05/20 09:23:10 $ + * Version: $Revision: 1.29 $ + * Date: $Date: 2000/08/03 14:28:17 $ * Purpose: Defines to access Voltage and Temperature Sensor * (taken from Monalisa (taken from Concentrator)) * @@ -28,6 +28,13 @@ * History: * * $Log: ski2c.h,v $ + * Revision 1.29 2000/08/03 14:28:17 rassmann + * - Added function to wait for I2C being ready before resetting the board. + * - Replaced one duplicate "out of range" message with correct one. + * + * Revision 1.28 1999/11/22 13:55:46 cgoos + * Changed license header to GPL. + * * Revision 1.27 1999/05/20 09:23:10 cgoos * Changes for 1000Base-T (Fan sensors). * @@ -254,9 +261,9 @@ extern int SkI2cReadSensor(SK_AC *pAC, SK_IOC IoC, SK_SENSOR *pSen); #ifndef SK_DIAG -extern int SkI2cEvent(SK_AC *pAC, SK_IOC IoC, SK_U32 Event, - SK_EVPARA Para); +extern int SkI2cEvent(SK_AC *pAC, SK_IOC IoC, SK_U32 Event, SK_EVPARA Para); extern int SkI2cInit(SK_AC *pAC, SK_IOC IoC, int Level); +extern void SkI2cWaitIrq(SK_AC *pAC, SK_IOC IoC); extern void SkI2cIsr(SK_AC *pAC, SK_IOC IoC); #endif diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/sk98lin/h/skqueue.h linux/drivers/net/sk98lin/h/skqueue.h --- v2.4.0-test8/linux/drivers/net/sk98lin/h/skqueue.h Tue Nov 23 22:42:20 1999 +++ linux/drivers/net/sk98lin/h/skqueue.h Fri Sep 15 14:34:19 2000 @@ -2,8 +2,8 @@ * * Name: skqueue.h * Project: GEnesis, PCI Gigabit Ethernet Adapter - * Version: $Revision: 1.12 $ - * Date: $Date: 1998/09/08 08:48:01 $ + * Version: $Revision: 1.13 $ + * Date: $Date: 1999/11/22 13:59:05 $ * Purpose: Defines for the Event queue * ******************************************************************************/ @@ -27,6 +27,9 @@ * History: * * $Log: skqueue.h,v $ + * Revision 1.13 1999/11/22 13:59:05 cgoos + * Changed license header to GPL. + * * Revision 1.12 1998/09/08 08:48:01 gklug * add: init level handling * diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/sk98lin/h/skrlmt.h linux/drivers/net/sk98lin/h/skrlmt.h --- v2.4.0-test8/linux/drivers/net/sk98lin/h/skrlmt.h Tue Nov 23 22:42:20 1999 +++ linux/drivers/net/sk98lin/h/skrlmt.h Fri Sep 15 14:34:19 2000 @@ -2,8 +2,8 @@ * * Name: skrlmt.h * Project: GEnesis, PCI Gigabit Ethernet Adapter - * Version: $Revision: 1.26 $ - * Date: $Date: 1999/10/04 14:01:19 $ + * Version: $Revision: 1.27 $ + * Date: $Date: 1999/11/22 13:59:56 $ * Purpose: Header file for Redundant Link ManagemenT. * ******************************************************************************/ @@ -27,6 +27,9 @@ * History: * * $Log: skrlmt.h,v $ + * Revision 1.27 1999/11/22 13:59:56 cgoos + * Changed license header to GPL. + * * Revision 1.26 1999/10/04 14:01:19 rassmann * Corrected reaction to reception of BPDU frames. * Added parameter descriptions to "For Readme" section skrlmt.txt. diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/sk98lin/h/sktimer.h linux/drivers/net/sk98lin/h/sktimer.h --- v2.4.0-test8/linux/drivers/net/sk98lin/h/sktimer.h Tue Nov 23 22:42:20 1999 +++ linux/drivers/net/sk98lin/h/sktimer.h Fri Sep 15 14:34:19 2000 @@ -2,8 +2,8 @@ * * Name: sktimer.h * Project: GEnesis, PCI Gigabit Ethernet Adapter - * Version: $Revision: 1.8 $ - * Date: $Date: 1998/09/08 08:48:02 $ + * Version: $Revision: 1.9 $ + * Date: $Date: 1999/11/22 14:00:29 $ * Purpose: Defines for the timer functions * ******************************************************************************/ @@ -27,6 +27,9 @@ * History: * * $Log: sktimer.h,v $ + * Revision 1.9 1999/11/22 14:00:29 cgoos + * Changed license header to GPL. + * * Revision 1.8 1998/09/08 08:48:02 gklug * add: init level handling * diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/sk98lin/h/sktypes.h linux/drivers/net/sk98lin/h/sktypes.h --- v2.4.0-test8/linux/drivers/net/sk98lin/h/sktypes.h Tue Nov 23 22:42:20 1999 +++ linux/drivers/net/sk98lin/h/sktypes.h Fri Sep 15 14:34:19 2000 @@ -2,8 +2,8 @@ * * Name: sktypes.h * Project: GEnesis, PCI Gigabit Ethernet Adapter - * Version: $Revision: 1.1 $ - * Date: $Date: 1999/02/16 07:41:40 $ + * Version: $Revision: 1.2 $ + * Date: $Date: 1999/11/22 14:01:58 $ * Purpose: Define data types for Linux * ******************************************************************************/ @@ -27,6 +27,10 @@ * History: * * $Log: sktypes.h,v $ + * Revision 1.2 1999/11/22 14:01:58 cgoos + * Changed license header to GPL. + * Now using Linux' fixed size types instead of standard types. + * * Revision 1.1 1999/02/16 07:41:40 cgoos * First version. * diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/sk98lin/h/skvpd.h linux/drivers/net/sk98lin/h/skvpd.h --- v2.4.0-test8/linux/drivers/net/sk98lin/h/skvpd.h Tue Nov 23 22:42:20 1999 +++ linux/drivers/net/sk98lin/h/skvpd.h Fri Sep 15 14:34:19 2000 @@ -2,15 +2,15 @@ * * Name: skvpd.h * Project: GEnesis, PCI Gigabit Ethernet Adapter - * Version: $Revision: 1.8 $ - * Date: $Date: 1999/03/11 14:26:40 $ + * Version: $Revision: 1.10 $ + * Date: $Date: 2000/08/10 11:29:07 $ * Purpose: Defines and Macros for VPD handling * ******************************************************************************/ /****************************************************************************** * - * (C)Copyright 1998,1999 SysKonnect, + * (C)Copyright 1998-2000 SysKonnect, * a business unit of Schneider & Koch & Co. Datensysteme GmbH. * * This program is free software; you can redistribute it and/or modify @@ -27,6 +27,15 @@ * History: * * $Log: skvpd.h,v $ + * Revision 1.10 2000/08/10 11:29:07 rassmann + * Editorial changes. + * Preserving 32-bit alignment in structs for the adapter context. + * Removed unused function VpdWriteDword() (#if 0). + * Made VpdReadKeyword() available for SKDIAG only. + * + * Revision 1.9 1999/11/22 14:02:27 cgoos + * Changed license header to GPL. + * * Revision 1.8 1999/03/11 14:26:40 malthoff * Replace __STDC__ with SK_KR_PROTO. * @@ -112,40 +121,42 @@ /* VPD status */ /* bit 7..1 reserved */ -#define VPD_VALID (1<<0) /* VPD data buffer, vpd_free_ro, */ - /* and vpd_free_rw valid */ +#define VPD_VALID (1<<0) /* VPD data buffer, vpd_free_ro, */ + /* and vpd_free_rw valid */ /* * VPD structs */ typedef struct s_vpd_status { - unsigned short vpd_status ; /* VPD status, description see above */ - int vpd_free_ro ; /* unused bytes in read only area */ - int vpd_free_rw ; /* bytes available in read/write area */ + unsigned short Align01; /* Alignment */ + unsigned short vpd_status; /* VPD status, description see above */ + int vpd_free_ro; /* unused bytes in read only area */ + int vpd_free_rw; /* bytes available in read/write area */ } SK_VPD_STATUS; typedef struct s_vpd { - SK_VPD_STATUS v ; /* VPD status structure */ - char vpd_buf[VPD_SIZE] ; /* VPD buffer */ + SK_VPD_STATUS v; /* VPD status structure */ + char vpd_buf[VPD_SIZE]; /* VPD buffer */ } SK_VPD; typedef struct s_vpd_para { - unsigned int p_len ; /* parameter length */ - char *p_val ; /* points to the value */ + unsigned int p_len; /* parameter length */ + char *p_val; /* points to the value */ } SK_VPD_PARA; /* * structure of Large Resource Type Identifiers */ -/* was removed, because of alignment problems */ + +/* was removed because of alignment problems */ /* * sturcture of VPD keywords */ typedef struct s_vpd_key { - char p_key[2] ; /* 2 bytes ID string */ - unsigned char p_len ; /* 1 byte length */ - char p_val ; /* start of the value string */ + char p_key[2]; /* 2 bytes ID string */ + unsigned char p_len; /* 1 byte length */ + char p_val; /* start of the value string */ } SK_VPD_KEY; @@ -169,39 +180,39 @@ #define VPD_IN32(pAC,IoC,Addr,pVal) SK_IN32(IoC,PCI_C(Addr),pVal) #endif /* VPD_DO_IO */ #else /* SKDIAG */ -#define VPD_OUT8(pAC,Ioc,Addr,Val) { \ +#define VPD_OUT8(pAC,Ioc,Addr,Val) { \ if ((pAC)->DgT.DgUseCfgCycle) \ - SkPciWriteCfgByte(pAC,Addr,Val) ; \ - else \ + SkPciWriteCfgByte(pAC,Addr,Val); \ + else \ SK_OUT8(pAC,PCI_C(Addr),Val); \ } -#define VPD_OUT16(pAC,Ioc,Addr,Val) { \ +#define VPD_OUT16(pAC,Ioc,Addr,Val) { \ if ((pAC)->DgT.DgUseCfgCycle) \ - SkPciWriteCfgWord(pAC,Addr,Val) ; \ + SkPciWriteCfgWord(pAC,Addr,Val); \ else \ SK_OUT16(pAC,PCI_C(Addr),Val); \ } -#define VPD_OUT32(pAC,Ioc,Addr,Val) { \ +#define VPD_OUT32(pAC,Ioc,Addr,Val) { \ if ((pAC)->DgT.DgUseCfgCycle) \ - SkPciWriteCfgDWord(pAC,Addr,Val) ; \ + SkPciWriteCfgDWord(pAC,Addr,Val); \ else \ SK_OUT32(pAC,PCI_C(Addr),Val); \ } -#define VPD_IN8(pAC,Ioc,Addr,pVal) { \ +#define VPD_IN8(pAC,Ioc,Addr,pVal) { \ if ((pAC)->DgT.DgUseCfgCycle) \ - SkPciReadCfgByte(pAC,Addr,pVal) ; \ + SkPciReadCfgByte(pAC,Addr,pVal); \ else \ SK_IN8(pAC,PCI_C(Addr),pVal); \ } -#define VPD_IN16(pAC,Ioc,Addr,pVal) { \ +#define VPD_IN16(pAC,Ioc,Addr,pVal) { \ if ((pAC)->DgT.DgUseCfgCycle) \ - SkPciReadCfgWord(pAC,Addr,pVal) ; \ + SkPciReadCfgWord(pAC,Addr,pVal); \ else \ SK_IN16(pAC,PCI_C(Addr),pVal); \ } -#define VPD_IN32(pAC,Ioc,Addr,pVal) { \ +#define VPD_IN32(pAC,Ioc,Addr,pVal) { \ if ((pAC)->DgT.DgUseCfgCycle) \ - SkPciReadCfgDWord(pAC,Addr,pVal) ; \ + SkPciReadCfgDWord(pAC,Addr,pVal); \ else \ SK_IN32(pAC,PCI_C(Addr),pVal); \ } @@ -210,50 +221,52 @@ /* function prototypes ********************************************************/ #ifndef SK_KR_PROTO +#ifdef SKDIAG extern SK_U32 VpdReadDWord( SK_AC *pAC, SK_IOC IoC, - int addr) ; + int addr); +#endif /* SKDIAG */ extern int VpdSetupPara( SK_AC *pAC, char *key, char *buf, - int len, - int type, - int op) ; + int len, + int type, + int op); extern SK_VPD_STATUS *VpdStat( SK_AC *pAC, - SK_IOC IoC) ; + SK_IOC IoC); extern int VpdKeys( SK_AC *pAC, SK_IOC IoC, char *buf, - int *len, - int *elements) ; + int *len, + int *elements); extern int VpdRead( SK_AC *pAC, SK_IOC IoC, char *key, char *buf, - int *len) ; + int *len); extern SK_BOOL VpdMayWrite( - char *key) ; + char *key); extern int VpdWrite( SK_AC *pAC, SK_IOC IoC, char *key, - char *buf) ; + char *buf); extern int VpdDelete( SK_AC *pAC, SK_IOC IoC, - char *key) ; + char *key); extern int VpdUpdate( SK_AC *pAC, @@ -262,34 +275,34 @@ extern void VpdErrLog( SK_AC *pAC, SK_IOC IoC, - char *msg) ; + char *msg); #ifdef SKDIAG extern int VpdReadBlock( SK_AC *pAC, SK_IOC IoC, char *buf, - int addr, - int len) ; + int addr, + int len); extern int VpdWriteBlock( SK_AC *pAC, SK_IOC IoC, char *buf, - int addr, - int len) ; + int addr, + int len); #endif /* SKDIAG */ #else /* SK_KR_PROTO */ -extern SK_U32 VpdReadDWord() ; -extern int VpdSetupPara() ; -extern SK_VPD_STATUS *VpdStat() ; -extern int VpdKeys() ; -extern int VpdRead() ; -extern SK_BOOL VpdMayWrite() ; -extern int VpdWrite() ; -extern int VpdDelete() ; -extern int VpdUpdate() ; -extern void VpdErrLog() ; +extern SK_U32 VpdReadDWord(); +extern int VpdSetupPara(); +extern SK_VPD_STATUS *VpdStat(); +extern int VpdKeys(); +extern int VpdRead(); +extern SK_BOOL VpdMayWrite(); +extern int VpdWrite(); +extern int VpdDelete(); +extern int VpdUpdate(); +extern void VpdErrLog(); #endif /* SK_KR_PROTO */ #endif /* __INC_SKVPD_H_ */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/sk98lin/h/xmac_ii.h linux/drivers/net/sk98lin/h/xmac_ii.h --- v2.4.0-test8/linux/drivers/net/sk98lin/h/xmac_ii.h Tue Nov 23 22:42:20 1999 +++ linux/drivers/net/sk98lin/h/xmac_ii.h Fri Sep 15 14:34:19 2000 @@ -2,8 +2,8 @@ * * Name: xmac_ii.h * Project: GEnesis, PCI Gigabit Ethernet Adapter - * Version: $Revision: 1.25 $ - * Date: $Date: 1999/08/12 19:19:38 $ + * Version: $Revision: 1.27 $ + * Date: $Date: 2000/05/17 11:00:46 $ * Purpose: Defines and Macros for XaQti's Gigabit Ethernet Controller * ******************************************************************************/ @@ -27,6 +27,12 @@ * History: * * $Log: xmac_ii.h,v $ + * Revision 1.27 2000/05/17 11:00:46 malthoff + * Add bit for enable/disable power management in BCOM chip. + * + * Revision 1.26 1999/11/22 14:03:00 cgoos + * Changed license header to GPL. + * * Revision 1.25 1999/08/12 19:19:38 malthoff * Add PHY_B_AC_TX_TST bit according to BCOM A1 errata sheet. * @@ -930,7 +936,9 @@ #define PHY_B_AC_TX_TST (1<<10) /* Bit 10: tx test bit, always 1 */ /* Bit 9.. 8: reserved */ #define PHY_B_AC_DIS_PRF (1<<7) /* Bit 7: dis part resp filter */ - /* Bit 6.. 4: reserved */ + /* Bit 6: reserved */ +#define PHY_B_AC_DIS_PM (1<<5) /* Bit 5: dis power management */ + /* Bit 4: reserved */ #define PHY_B_AC_DIAG (1<<3) /* Bit 3: Diagnostic Mode */ /* Bit 2.. 0: reserved */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/sk98lin/skaddr.c linux/drivers/net/sk98lin/skaddr.c --- v2.4.0-test8/linux/drivers/net/sk98lin/skaddr.c Tue Nov 23 22:42:20 1999 +++ linux/drivers/net/sk98lin/skaddr.c Fri Sep 15 14:34:19 2000 @@ -2,19 +2,17 @@ * * Name: skaddr.c * Project: GEnesis, PCI Gigabit Ethernet Adapter - * Version: $Revision: 1.33 $ - * Date: $Date: 1999/05/28 10:56:06 $ - * Purpose: Manage Addresses (Multicast and Unicast) and Promiscuous Mode + * Version: $Revision: 1.36 $ + * Date: $Date: 2000/08/07 11:10:39 $ + * Purpose: Manage Addresses (Multicast and Unicast) and Promiscuous Mode. * ******************************************************************************/ /****************************************************************************** * - * (C)Copyright 1998,1999 SysKonnect, + * (C)Copyright 1998-2000 SysKonnect, * a business unit of Schneider & Koch & Co. Datensysteme GmbH. * - * See the file "skge.c" for further information. - * * 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 @@ -29,6 +27,16 @@ * History: * * $Log: skaddr.c,v $ + * Revision 1.36 2000/08/07 11:10:39 rassmann + * Editorial changes. + * + * Revision 1.35 2000/05/04 09:38:41 rassmann + * Editorial changes. + * Corrected multicast address hashing. + * + * Revision 1.34 1999/11/22 13:23:44 cgoos + * Changed license header to GPL. + * * Revision 1.33 1999/05/28 10:56:06 rassmann * Editorial changes. * @@ -164,13 +172,13 @@ #ifndef lint static const char SysKonnectFileId[] = - "@(#) $Id: skaddr.c,v 1.33 1999/05/28 10:56:06 rassmann Exp $ (C) SysKonnect."; + "@(#) $Id: skaddr.c,v 1.36 2000/08/07 11:10:39 rassmann Exp $ (C) SysKonnect."; #endif /* !defined(lint) */ #define __SKADDR_C #ifdef __cplusplus -xxxx /* not supported yet - force error */ +#error C++ is not yet supported. extern "C" { #endif /* cplusplus */ @@ -179,19 +187,9 @@ /* defines ********************************************************************/ -#define SK_ADDR_CHEAT YES /* Cheat. */ - -/* - * G32: - * POLY equ 04C11DB6h ; CRC polynominal term - * bit-reversed: 6DB88320 - */ #define CRC32_POLY 0xEDB88320UL /* CRC32-Poly - XMAC: Little Endian */ -#if 0 -#define CRC32_POLY 0x6DB88320UL /* CRC32-Poly - XMAC: Little Endian */ -#endif /* 0 */ -#define HASH_BITS 6 /* #bits in hash */ +#define HASH_BITS 6 /* #bits in hash */ #define SK_MC_BIT 0x01 /* Error numbers and messages. */ @@ -219,13 +217,6 @@ /* functions ******************************************************************/ -#if 0 -void SkAddrDummy(void) -{ - SkAddrInit(NULL, NULL, 0); -} /* SkAddrDummy */ -#endif /* 0 */ - /****************************************************************************** * * SkAddrInit - initialize data, set state to init @@ -236,7 +227,7 @@ * ============ * * This routine clears the multicast tables and resets promiscuous mode. - * Some entries are reserved for the "logical board address", the + * Some entries are reserved for the "logical MAC address", the * SK-RLMT multicast address, and the BPDU multicast address. * * @@ -263,12 +254,12 @@ int SkAddrInit( SK_AC *pAC, /* the adapter context */ SK_IOC IoC, /* I/O context */ -int Level) /* initialization level */ +int Level) /* initialization level */ { - int j; - SK_U32 i; - SK_U8 *InAddr; - SK_U16 *OutAddr; + int j; + SK_U32 i; + SK_U8 *InAddr; + SK_U16 *OutAddr; SK_ADDR_PORT *pAPort; switch (Level) { @@ -279,20 +270,15 @@ pAPort = &pAC->Addr.Port[i]; pAPort->PromMode = SK_PROM_MODE_NONE; - pAPort->FirstExactMatchRlmt = - SK_ADDR_FIRST_MATCH_RLMT; - pAPort->FirstExactMatchDrv = - SK_ADDR_FIRST_MATCH_DRV; - pAPort->NextExactMatchRlmt = - SK_ADDR_FIRST_MATCH_RLMT; - pAPort->NextExactMatchDrv = - SK_ADDR_FIRST_MATCH_DRV; + pAPort->FirstExactMatchRlmt = SK_ADDR_FIRST_MATCH_RLMT; + pAPort->FirstExactMatchDrv = SK_ADDR_FIRST_MATCH_DRV; + pAPort->NextExactMatchRlmt = SK_ADDR_FIRST_MATCH_RLMT; + pAPort->NextExactMatchDrv = SK_ADDR_FIRST_MATCH_DRV; #if 0 - /* Not here ... */ + /* Don't do this here ... */ /* Reset Promiscuous mode. */ - (void)SkAddrPromiscuousChange( pAC, IoC, @@ -325,8 +311,7 @@ } #endif /* DEBUG */ - /* Read permanent virtual address from Control Register File. */ - + /* Read permanent logical MAC address from Control Register File. */ for (j = 0; j < SK_MAC_ADDR_LEN; j++) { InAddr = (SK_U8 *)&pAC->Addr.PermanentMacAddress.a[j]; SK_IN8(IoC, B2_MAC_1 + j, InAddr); @@ -334,17 +319,15 @@ if (!pAC->Addr.CurrentMacAddressSet) { /* - * Set the current virtual MAC address + * Set the current logical MAC address * to the permanent one. */ - pAC->Addr.CurrentMacAddress = pAC->Addr.PermanentMacAddress; pAC->Addr.CurrentMacAddressSet = SK_TRUE; } - /* Set the current virtual MAC address. */ - + /* Set the current logical MAC address. */ pAC->Addr.Port[pAC->Addr.ActivePort].Exact[0] = pAC->Addr.CurrentMacAddress; @@ -354,27 +337,27 @@ SK_DBGMOD_ADDR, SK_DBGCAT_INIT, ("Permanent MAC Address: %02X %02X %02X %02X %02X %02X\n", - pAC->Addr.PermanentMacAddress.a[0], - pAC->Addr.PermanentMacAddress.a[1], - pAC->Addr.PermanentMacAddress.a[2], - pAC->Addr.PermanentMacAddress.a[3], - pAC->Addr.PermanentMacAddress.a[4], - pAC->Addr.PermanentMacAddress.a[5])) + pAC->Addr.PermanentMacAddress.a[0], + pAC->Addr.PermanentMacAddress.a[1], + pAC->Addr.PermanentMacAddress.a[2], + pAC->Addr.PermanentMacAddress.a[3], + pAC->Addr.PermanentMacAddress.a[4], + pAC->Addr.PermanentMacAddress.a[5])) SK_DBG_MSG( pAC, SK_DBGMOD_ADDR, SK_DBGCAT_INIT, - ("Virtual MAC Address: %02X %02X %02X %02X %02X %02X\n", - pAC->Addr.CurrentMacAddress.a[0], - pAC->Addr.CurrentMacAddress.a[1], - pAC->Addr.CurrentMacAddress.a[2], - pAC->Addr.CurrentMacAddress.a[3], - pAC->Addr.CurrentMacAddress.a[4], - pAC->Addr.CurrentMacAddress.a[5])) + ("Logical MAC Address: %02X %02X %02X %02X %02X %02X\n", + pAC->Addr.CurrentMacAddress.a[0], + pAC->Addr.CurrentMacAddress.a[1], + pAC->Addr.CurrentMacAddress.a[2], + pAC->Addr.CurrentMacAddress.a[3], + pAC->Addr.CurrentMacAddress.a[4], + pAC->Addr.CurrentMacAddress.a[5])) #endif /* DEBUG */ #if 0 - /* Not here ... */ + /* Don't do this here ... */ (void)SkAddrMcUpdate(pAC, IoC, pAC->Addr.ActivePort); #endif /* 0 */ @@ -386,10 +369,8 @@ * Read permanent port addresses from * Control Register File. */ - for (j = 0; j < SK_MAC_ADDR_LEN; j++) { - InAddr = (SK_U8 *) - &pAPort->PermanentMacAddress.a[j]; + InAddr = (SK_U8 *)&pAPort->PermanentMacAddress.a[j]; SK_IN8(IoC, B2_MAC_2 + 8 * i + j, InAddr); } @@ -399,16 +380,12 @@ * MAC address of this port to its permanent * MAC address. */ - - pAPort->CurrentMacAddress = - pAPort->PermanentMacAddress; - pAPort->PreviousMacAddress = - pAPort->PermanentMacAddress; + pAPort->CurrentMacAddress = pAPort->PermanentMacAddress; + pAPort->PreviousMacAddress = pAPort->PermanentMacAddress; pAPort->CurrentMacAddressSet = SK_TRUE; } /* Set port's current MAC addresses. */ - OutAddr = (SK_U16 *)&pAPort->CurrentMacAddress.a[0]; XM_OUTADDR(IoC, i, XM_SA, OutAddr); @@ -484,7 +461,7 @@ SK_AC *pAC, /* adapter context */ SK_IOC IoC, /* I/O context */ SK_U32 PortIdx, /* Index of affected port */ -int Flags) /* permanent/non-perm, sw-only */ +int Flags) /* permanent/non-perm, sw-only */ { int i; @@ -495,9 +472,7 @@ if (Flags & SK_ADDR_PERMANENT) { /* Clear RLMT multicast addresses. */ - - pAC->Addr.Port[PortIdx].NextExactMatchRlmt = - SK_ADDR_FIRST_MATCH_RLMT; + pAC->Addr.Port[PortIdx].NextExactMatchRlmt = SK_ADDR_FIRST_MATCH_RLMT; } else { /* not permanent => DRV */ @@ -509,8 +484,7 @@ /* Clear DRV multicast addresses. */ - pAC->Addr.Port[PortIdx].NextExactMatchDrv = - SK_ADDR_FIRST_MATCH_DRV; + pAC->Addr.Port[PortIdx].NextExactMatchDrv = SK_ADDR_FIRST_MATCH_DRV; } if (!(Flags & SK_MC_SW_ONLY)) { @@ -521,7 +495,7 @@ } /* SkAddrMcClear */ #ifndef SK_ADDR_CHEAT -// RA;:;: + /****************************************************************************** * * SkCrc32McHash - hash multicast address @@ -548,15 +522,13 @@ Crc = 0xFFFFFFFFUL; for (Idx = 0; Idx < SK_MAC_ADDR_LEN; Idx++) { - Data = *pMc++; + Data = *pMc++; for (Bit = 0; Bit < 8; Bit++, Data >>= 1) { - Crc = (Crc >> 1) ^ - (((Crc ^ Data) & 1) ? CRC32_POLY : 0); + Crc = (Crc >> 1) ^ (((Crc ^ Data) & 1) ? CRC32_POLY : 0); } } return (Crc & ((1 << HASH_BITS) - 1)); - } /* SkCrc32McHash */ #endif /* not SK_ADDR_CHEAT */ @@ -593,7 +565,7 @@ SK_IOC IoC, /* I/O context */ SK_U32 PortIdx, /* Port Index */ SK_MAC_ADDR *pMc, /* multicast address to be added */ -int Flags) /* permanent/non-permanent */ +int Flags) /* permanent/non-permanent */ { int i; SK_U8 Inexact; @@ -628,11 +600,9 @@ } /* Not PERMANENT => DRV */ - if (PortIdx != pAC->Addr.ActivePort) { /* Only RLMT is allowed to do this. */ - return (SK_MC_ILLEGAL_PORT); } @@ -647,41 +617,31 @@ if (pAC->Addr.Port[PortIdx].NextExactMatchDrv <= SK_ADDR_LAST_MATCH_DRV) { /* Set exact match entry. */ - pAC->Addr.Port[PortIdx].Exact[ pAC->Addr.Port[PortIdx].NextExactMatchDrv++] = *pMc; /* Clear InexactFilter. */ - for (i = 0; i < 8; i++) { - pAC->Addr.Port[PortIdx - ].InexactFilter.Bytes[i] = 0; + pAC->Addr.Port[PortIdx].InexactFilter.Bytes[i] = 0; } } else { if (!(pMc->a[0] & SK_MC_BIT)) { - /* * Hashing only possible with * multicast addresses. */ - return (SK_MC_ILLEGAL_ADDRESS); } #ifndef SK_ADDR_CHEAT /* Compute hash value of address. */ -RA;:;: untested - HashBit = SkCrc32McHash(&pMc->a[0]); + HashBit = 63 - SkCrc32McHash(&pMc->a[0]); /* Add bit to InexactFilter. */ - pAC->Addr.Port[PortIdx].InexactFilter.Bytes[HashBit / 8] |= 1 << (HashBit % 8); - #else /* SK_ADDR_CHEAT */ - /* Set all bits in InexactFilter. */ - for (i = 0; i < 8; i++) { pAC->Addr.Port[PortIdx].InexactFilter.Bytes[i] = 0xFF; } @@ -727,10 +687,10 @@ SK_IOC IoC, /* I/O context */ SK_U32 PortIdx) /* Port Index */ { - SK_U32 i; - SK_U8 Inexact; - SK_U16 *OutAddr; - SK_U16 LoMode; /* Lower 16 bits of XMAC Mode Reg. */ + SK_U32 i; + SK_U8 Inexact; + SK_U16 *OutAddr; + SK_U16 LoMode; /* Lower 16 bits of XMAC Mode Reg. */ SK_ADDR_PORT *pAPort; if (PortIdx >= (SK_U32)pAC->GIni.GIMacsFound) { @@ -753,18 +713,16 @@ ("Next0 on Port %d: %d\n", PortIdx, Next0[PortIdx])) #endif /* DEBUG */ - for (i = 0; /* Also program the virtual address. */ + for (i = 0; /* Also program the logical MAC address. */ i < pAPort->NextExactMatchRlmt; i++) { /* Set exact match address i on HW. */ - OutAddr = (SK_U16 *)&pAPort->Exact[i].a[0]; XM_OUTADDR(IoC, PortIdx, XM_EXM(i), OutAddr); } /* Clear other permanent exact match addresses on HW. */ - if (pAPort->NextExactMatchRlmt <= SK_ADDR_LAST_MATCH_RLMT) { SkXmClrExactAddr( pAC, @@ -774,17 +732,12 @@ SK_ADDR_LAST_MATCH_RLMT); } - for (i = pAPort->FirstExactMatchDrv; - i < pAPort->NextExactMatchDrv; - i++) { - + for (i = pAPort->FirstExactMatchDrv; i < pAPort->NextExactMatchDrv; i++) { OutAddr = (SK_U16 *)&pAPort->Exact[i].a[0]; XM_OUTADDR(IoC, PortIdx, XM_EXM(i), OutAddr); - } /* Clear other non-permanent exact match addresses on HW. */ - if (pAPort->NextExactMatchDrv <= SK_ADDR_LAST_MATCH_DRV) { SkXmClrExactAddr( pAC, @@ -794,67 +747,51 @@ SK_ADDR_LAST_MATCH_DRV); } - for (Inexact = 0xFF, i = 0; i < 8; i++) { - Inexact &= pAPort->InexactFilter.Bytes[i]; + for (Inexact = 0, i = 0; i < 8; i++) { + Inexact |= pAPort->InexactFilter.Bytes[i]; } - if (pAPort->PromMode & SK_PROM_MODE_ALL_MC) { + if (pAPort->PromMode & SK_PROM_MODE_ALL_MC) { /* Set all bits in 64-bit hash register. */ - XM_OUTHASH(IoC, PortIdx, XM_HSM, &OnesHash); /* Set bit 15 in mode register. */ - XM_IN16(IoC, PortIdx, XM_MODE, &LoMode); LoMode |= XM_MD_ENA_HSH; XM_OUT16(IoC, PortIdx, XM_MODE, LoMode); } - else if (Inexact != 0xFF) { - - /* Clear bit 15 in mode register. */ + else if (Inexact != 0) { + /* Set 64-bit hash register to InexactFilter. */ + XM_OUTHASH(IoC, PortIdx, XM_HSM, &pAPort->InexactFilter.Bytes[0]); + /* Set bit 15 in mode register. */ XM_IN16(IoC, PortIdx, XM_MODE, &LoMode); - LoMode &= ~XM_MD_ENA_HSH; + LoMode |= XM_MD_ENA_HSH; XM_OUT16(IoC, PortIdx, XM_MODE, LoMode); } else { - /* Set 64-bit hash register to InexactFilter. */ - - XM_OUTHASH( - IoC, - PortIdx, - XM_HSM, - &pAPort->InexactFilter.Bytes[0]); - - /* Set bit 15 in mode register. */ - + /* Clear bit 15 in mode register. */ XM_IN16(IoC, PortIdx, XM_MODE, &LoMode); - LoMode |= XM_MD_ENA_HSH; + LoMode &= ~XM_MD_ENA_HSH; XM_OUT16(IoC, PortIdx, XM_MODE, LoMode); } if (pAPort->PromMode != SK_PROM_MODE_NONE) { - (void)SkAddrPromiscuousChange( - pAC, - IoC, - PortIdx, - pAPort->PromMode); + (void)SkAddrPromiscuousChange(pAC, IoC, PortIdx, pAPort->PromMode); } /* Set port's current MAC address. */ - OutAddr = (SK_U16 *)&pAPort->CurrentMacAddress.a[0]; XM_OUTADDR(IoC, PortIdx, XM_SA, OutAddr); #ifdef DEBUG - for (i = 0; /* Also program the virtual address. */ + for (i = 0; /* Also program the logical MAC address. */ i < pAPort->NextExactMatchRlmt; i++) { SK_U8 InAddr8[6]; SK_U16 *InAddr; /* Get exact match address i from port PortIdx. */ - InAddr = (SK_U16 *)&InAddr8[0]; XM_INADDR(IoC, PortIdx, XM_EXM(i), InAddr); SK_DBG_MSG( @@ -880,10 +817,6 @@ #endif /* DEBUG */ /* Determine return value. */ - - for (Inexact = 0, i = 0; i < 8; i++) { - Inexact |= pAPort->InexactFilter.Bytes[i]; - } if (Inexact == 0 && pAPort->PromMode == 0) { return (SK_MC_FILTERING_EXACT); } @@ -915,7 +848,7 @@ SK_IOC IoC, /* I/O context */ SK_U32 PortIdx, /* Port Index */ SK_MAC_ADDR *pNewAddr, /* new MAC address */ -int Flags) /* logical/physical address */ +int Flags) /* logical/physical MAC address */ { SK_U32 i; SK_U16 *OutAddr; @@ -957,7 +890,7 @@ return (SK_ADDR_TOO_EARLY); } - if (Flags & SK_ADDR_PHYSICAL_ADDRESS) { /* Physical address. */ + if (Flags & SK_ADDR_PHYSICAL_ADDRESS) { /* Physical MAC address. */ if (SK_ADDR_EQUAL(pNewAddr->a, pAC->Addr.CurrentMacAddress.a)) { return (SK_ADDR_DUPLICATE_ADDRESS); } @@ -984,16 +917,14 @@ pAC->Addr.Port[PortIdx].CurrentMacAddress = *pNewAddr; /* Change port's address. */ - OutAddr = (SK_U16 *)pNewAddr; XM_OUTADDR(IoC, PortIdx, XM_SA, OutAddr); /* Report address change to RLMT. */ - Para.Para32[0] = PortIdx; SkEventQueue(pAC, SKGE_RLMT, SK_RLMT_PORT_ADDR, Para); } - else { /* Logical Address. */ + else { /* Logical MAC address. */ if (SK_ADDR_EQUAL(pNewAddr->a, pAC->Addr.CurrentMacAddress.a)) { return (SK_ADDR_SUCCESS); } @@ -1019,27 +950,26 @@ SK_DBGMOD_ADDR, SK_DBGCAT_CTRL, ("Permanent MAC Address: %02X %02X %02X %02X %02X %02X\n", - pAC->Addr.PermanentMacAddress.a[0], - pAC->Addr.PermanentMacAddress.a[1], - pAC->Addr.PermanentMacAddress.a[2], - pAC->Addr.PermanentMacAddress.a[3], - pAC->Addr.PermanentMacAddress.a[4], - pAC->Addr.PermanentMacAddress.a[5])) + pAC->Addr.PermanentMacAddress.a[0], + pAC->Addr.PermanentMacAddress.a[1], + pAC->Addr.PermanentMacAddress.a[2], + pAC->Addr.PermanentMacAddress.a[3], + pAC->Addr.PermanentMacAddress.a[4], + pAC->Addr.PermanentMacAddress.a[5])) SK_DBG_MSG( pAC, SK_DBGMOD_ADDR, SK_DBGCAT_CTRL, - ("New Virtual MAC Address: %02X %02X %02X %02X %02X %02X\n", - pAC->Addr.CurrentMacAddress.a[0], - pAC->Addr.CurrentMacAddress.a[1], - pAC->Addr.CurrentMacAddress.a[2], - pAC->Addr.CurrentMacAddress.a[3], - pAC->Addr.CurrentMacAddress.a[4], - pAC->Addr.CurrentMacAddress.a[5])) + ("New logical MAC Address: %02X %02X %02X %02X %02X %02X\n", + pAC->Addr.CurrentMacAddress.a[0], + pAC->Addr.CurrentMacAddress.a[1], + pAC->Addr.CurrentMacAddress.a[2], + pAC->Addr.CurrentMacAddress.a[3], + pAC->Addr.CurrentMacAddress.a[4], + pAC->Addr.CurrentMacAddress.a[5])) #endif /* DEBUG */ /* Write address to first exact match entry of active port. */ - (void)SkAddrMcUpdate(pAC, IoC, PortIdx); } @@ -1066,25 +996,24 @@ * SK_ADDR_ILLEGAL_PORT */ int SkAddrPromiscuousChange( -SK_AC *pAC, /* adapter context */ -SK_IOC IoC, /* I/O context */ -SK_U32 PortIdx, /* port whose promiscuous mode changes */ -int NewPromMode) /* new promiscuous mode */ +SK_AC *pAC, /* adapter context */ +SK_IOC IoC, /* I/O context */ +SK_U32 PortIdx, /* port whose promiscuous mode changes */ +int NewPromMode) /* new promiscuous mode */ { - int i; + int i; SK_BOOL InexactModeBit; SK_U8 Inexact; SK_U8 HwInexact; SK_FILTER64 HwInexactFilter; SK_U16 LoMode; /* Lower 16 bits of XMAC Mode Register. */ - int CurPromMode = SK_PROM_MODE_NONE; + int CurPromMode = SK_PROM_MODE_NONE; if (PortIdx >= (SK_U32)pAC->GIni.GIMacsFound) { return (SK_ADDR_ILLEGAL_PORT); } /* Read CurPromMode from Hardware. */ - XM_IN16(IoC, PortIdx, XM_MODE, &LoMode); if (LoMode & XM_MD_ENA_PROM) { @@ -1095,18 +1024,15 @@ Inexact &= pAC->Addr.Port[PortIdx].InexactFilter.Bytes[i]; } if (Inexact == 0xFF) { - CurPromMode |= (pAC->Addr.Port[PortIdx].PromMode & - SK_PROM_MODE_ALL_MC); + CurPromMode |= (pAC->Addr.Port[PortIdx].PromMode & SK_PROM_MODE_ALL_MC); } else { /* Read InexactModeBit (bit 15 in mode register). */ - XM_IN16(IoC, PortIdx, XM_MODE, &LoMode); - - InexactModeBit = (LoMode & XM_MD_ENA_HSH) != 0; + + InexactModeBit = (LoMode & XM_MD_ENA_HSH) != 0; /* Read 64-bit hash register from HW. */ - XM_INHASH(IoC, PortIdx, XM_HSM, &HwInexactFilter.Bytes[0]); for (HwInexact = 0xFF, i = 0; i < 8; i++) { @@ -1126,43 +1052,34 @@ if ((NewPromMode & SK_PROM_MODE_ALL_MC) && !(CurPromMode & SK_PROM_MODE_ALL_MC)) { /* All MC. */ - /* Set all bits in 64-bit hash register. */ - XM_OUTHASH(IoC, PortIdx, XM_HSM, &OnesHash); /* Set bit 15 in mode register. */ - XM_IN16(IoC, PortIdx, XM_MODE, &LoMode); LoMode |= XM_MD_ENA_HSH; XM_OUT16(IoC, PortIdx, XM_MODE, LoMode); } else if ((CurPromMode & SK_PROM_MODE_ALL_MC) && !(NewPromMode & SK_PROM_MODE_ALL_MC)) { /* Norm MC. */ - for (Inexact = 0, i = 0; i < 8; i++) { - Inexact |= - pAC->Addr.Port[PortIdx].InexactFilter.Bytes[i]; + Inexact |= pAC->Addr.Port[PortIdx].InexactFilter.Bytes[i]; } if (Inexact == 0) { /* Clear bit 15 in mode register. */ - XM_IN16(IoC, PortIdx, XM_MODE, &LoMode); LoMode &= ~XM_MD_ENA_HSH; XM_OUT16(IoC, PortIdx, XM_MODE, LoMode); } else { /* Set 64-bit hash register to InexactFilter. */ - XM_OUTHASH( IoC, PortIdx, XM_HSM, - &pAC->Addr.Port[PortIdx - ].InexactFilter.Bytes[0]); + &pAC->Addr.Port[PortIdx].InexactFilter.Bytes[0]); /* Set bit 15 in mode register. */ - XM_IN16(IoC, PortIdx, XM_MODE, &LoMode); LoMode |= XM_MD_ENA_HSH; XM_OUT16(IoC, PortIdx, XM_MODE, LoMode); @@ -1171,29 +1088,27 @@ if ((NewPromMode & SK_PROM_MODE_LLC) && !(CurPromMode & SK_PROM_MODE_LLC)) { /* Prom. LLC */ - /* Set promiscuous bit in mode register. */ - XM_IN16(IoC, PortIdx, XM_MODE, &LoMode); + #if 0 /* Receive MAC frames. */ - LoMode |= XM_MD_RX_MCTRL; #endif /* 0 */ + LoMode |= XM_MD_ENA_PROM; XM_OUT16(IoC, PortIdx, XM_MODE, LoMode); } else if ((CurPromMode & SK_PROM_MODE_LLC) && !(NewPromMode & SK_PROM_MODE_LLC)) { /* Norm. LLC. */ - /* Clear promiscuous bit in mode register. */ - XM_IN16(IoC, PortIdx, XM_MODE, &LoMode); + #if 0 /* Don't receive MAC frames. */ - LoMode &= ~XM_MD_RX_MCTRL; #endif /* 0 */ + LoMode &= ~XM_MD_ENA_PROM; XM_OUT16(IoC, PortIdx, XM_MODE, LoMode); } @@ -1218,12 +1133,12 @@ * SK_ADDR_ILLEGAL_PORT */ int SkAddrSwap( -SK_AC *pAC, /* adapter context */ -SK_IOC IoC, /* I/O context */ +SK_AC *pAC, /* adapter context */ +SK_IOC IoC, /* I/O context */ SK_U32 FromPortIdx, /* Port1 Index */ -SK_U32 ToPortIdx) /* Port2 Index */ +SK_U32 ToPortIdx) /* Port2 Index */ { - int i; + int i; SK_U8 Byte; SK_MAC_ADDR MacAddr; SK_U32 DWord; @@ -1263,8 +1178,7 @@ } i = pAC->Addr.Port[FromPortIdx].PromMode; - pAC->Addr.Port[FromPortIdx].PromMode = - pAC->Addr.Port[ToPortIdx].PromMode; + pAC->Addr.Port[FromPortIdx].PromMode = pAC->Addr.Port[ToPortIdx].PromMode; pAC->Addr.Port[ToPortIdx].PromMode = i; DWord = pAC->Addr.Port[FromPortIdx].FirstExactMatchRlmt; @@ -1287,7 +1201,7 @@ pAC->Addr.Port[ToPortIdx].NextExactMatchDrv; pAC->Addr.Port[ToPortIdx].NextExactMatchDrv = DWord; - pAC->Addr.ActivePort = ToPortIdx; + pAC->Addr.ActivePort = ToPortIdx; (void)SkAddrMcUpdate(pAC, IoC, FromPortIdx); (void)SkAddrMcUpdate(pAC, IoC, ToPortIdx); @@ -1298,3 +1212,4 @@ #ifdef __cplusplus } #endif /* __cplusplus */ + diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/sk98lin/skcsum.c linux/drivers/net/sk98lin/skcsum.c --- v2.4.0-test8/linux/drivers/net/sk98lin/skcsum.c Tue Nov 23 22:42:20 1999 +++ linux/drivers/net/sk98lin/skcsum.c Fri Sep 15 14:34:19 2000 @@ -2,19 +2,17 @@ * * Name: skcsum.c * Project: GEnesis, PCI Gigabit Ethernet Adapter - * Version: $Revision: 1.3 $ - * Date: $Date: 1999/05/10 08:39:33 $ + * Version: $Revision: 1.7 $ + * Date: $Date: 2000/06/29 13:17:05 $ * Purpose: Store/verify Internet checksum in send/receive packets. * ******************************************************************************/ /****************************************************************************** * - * (C)Copyright 1998,1999 SysKonnect, + * (C)Copyright 1998-2000 SysKonnect, * a business unit of Schneider & Koch & Co. Datensysteme GmbH. * - * See the file "skge.c" for further information. - * * 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 @@ -29,6 +27,23 @@ * History: * * $Log: skcsum.c,v $ + * Revision 1.7 2000/06/29 13:17:05 rassmann + * Corrected reception of a packet with UDP checksum == 0 (which means there + * is no UDP checksum). + * + * Revision 1.6 2000/02/21 12:35:10 cgoos + * Fixed license header comment. + * + * Revision 1.5 2000/02/21 11:05:19 cgoos + * Merged changes back to common source. + * Fixed rx path for BIG ENDIAN architecture. + * + * Revision 1.1 1999/07/26 15:28:12 mkarl + * added return SKCS_STATUS_IP_CSUM_ERROR_UDP and + * SKCS_STATUS_IP_CSUM_ERROR_TCP to pass the NidsTester + * changed from common source to windows specific source + * therefore restarting with v1.0 + * * Revision 1.3 1999/05/10 08:39:33 mkarl * prevent overflows in SKCS_HTON16 * fixed a bug in pseudo header checksum calculation @@ -48,7 +63,7 @@ #ifndef lint static const char SysKonnectFileId[] = "@(#)" - "$Id: skcsum.c,v 1.3 1999/05/10 08:39:33 mkarl Exp $" + "$Id: skcsum.c,v 1.7 2000/06/29 13:17:05 rassmann Exp $" " (C) SysKonnect."; #endif /* !lint */ @@ -94,13 +109,13 @@ /* defines ********************************************************************/ /* The size of an Ethernet MAC header. */ -#define SKCS_ETHERNET_MAC_HEADER_SIZE (6+6+2) +#define SKCS_ETHERNET_MAC_HEADER_SIZE (6+6+2) /* The size of the used topology's MAC header. */ #define SKCS_MAC_HEADER_SIZE SKCS_ETHERNET_MAC_HEADER_SIZE /* The size of the IP header without any option fields. */ -#define SKCS_IP_HEADER_SIZE 20 +#define SKCS_IP_HEADER_SIZE 20 /* * Field offsets within the IP header. @@ -110,23 +125,31 @@ #define SKCS_OFS_IP_HEADER_VERSION_AND_LENGTH 0 /* "Total Length". */ -#define SKCS_OFS_IP_TOTAL_LENGTH 2 +#define SKCS_OFS_IP_TOTAL_LENGTH 2 /* "Flags" "Fragment Offset". */ #define SKCS_OFS_IP_FLAGS_AND_FRAGMENT_OFFSET 6 /* "Next Level Protocol" identifier. */ -#define SKCS_OFS_IP_NEXT_LEVEL_PROTOCOL 9 +#define SKCS_OFS_IP_NEXT_LEVEL_PROTOCOL 9 /* Source IP address. */ -#define SKCS_OFS_IP_SOURCE_ADDRESS 12 +#define SKCS_OFS_IP_SOURCE_ADDRESS 12 /* Destination IP address. */ -#define SKCS_OFS_IP_DESTINATION_ADDRESS 16 +#define SKCS_OFS_IP_DESTINATION_ADDRESS 16 + + +/* + * Field offsets within the UDP header. + */ + +/* UDP checksum. */ +#define SKCS_OFS_UDP_CHECKSUM 6 /* IP "Next Level Protocol" identifiers (see RFC 790). */ -#define SKCS_PROTO_ID_TCP 6 /* Transport Control Protocol */ -#define SKCS_PROTO_ID_UDP 17 /* User Datagram Protocol */ +#define SKCS_PROTO_ID_TCP 6 /* Transport Control Protocol */ +#define SKCS_PROTO_ID_UDP 17 /* User Datagram Protocol */ /* IP "Don't Fragment" bit. */ #define SKCS_IP_DONT_FRAGMENT SKCS_HTON16(0x4000) @@ -224,8 +247,8 @@ * of the TCP or UDP pseudo header is returned here. */ void SkCsGetSendInfo( -SK_AC *pAc, /* Adapter context struct. */ -void *pIpHeader, /* IP header. */ +SK_AC *pAc, /* Adapter context struct. */ +void *pIpHeader, /* IP header. */ SKCS_PACKET_INFO *pPacketInfo) /* Packet information struct. */ { /* Internet Header Version found in IP header. */ @@ -397,7 +420,8 @@ SKCS_OC_ADD(pPacketInfo->PseudoHeaderChecksum, PseudoHeaderChecksum, 0); NextLevelProtoStats->TxOkCts++; /* Success. */ -} +} /* SkCsGetSendInfo */ + /****************************************************************************** * @@ -415,7 +439,8 @@ * pAc - Pointer to adapter context struct. * * pIpHeader - Pointer to IP header. Must be at least the length in bytes - * of the received IP header including any option fields. + * of the received IP header including any option fields. For UDP packets, + * 8 additional bytes are needed to access the UDP checksum. * * Note: The actual length of the IP header is stored in the lower four * bits of the first octet of the IP header as the number of 4-byte words, @@ -431,18 +456,20 @@ * Returns: * SKCS_STATUS_UNKNOWN_IP_VERSION - Not an IP v4 frame. * SKCS_STATUS_IP_CSUM_ERROR - IP checksum error. + * SKCS_STATUS_IP_CSUM_ERROR_TCP - IP checksum error in TCP frame. + * SKCS_STATUS_IP_CSUM_ERROR_UDP - IP checksum error in UDP frame * SKCS_STATUS_IP_FRAGMENT - IP fragment (IP checksum ok). * SKCS_STATUS_IP_CSUM_OK - IP checksum ok (not a TCP or UDP frame). * SKCS_STATUS_TCP_CSUM_ERROR - TCP checksum error (IP checksum ok). * SKCS_STATUS_UDP_CSUM_ERROR - UDP checksum error (IP checksum ok). * SKCS_STATUS_TCP_CSUM_OK - IP and TCP checksum ok. * SKCS_STATUS_UDP_CSUM_OK - IP and UDP checksum ok. + * SKCS_STATUS_IP_CSUM_OK_NO_UDP - IP checksum OK and no UDP checksum. * - * Note: The SKCS_STATUS_XXX values returned here are *not* defined by - * the CSUM module but must be defined in some header file by the module - * using CSUM. In this way, the calling module can assign return values - * for its own needs, e.g. by assigning bit flags to the individual - * protocols. + * Note: If SKCS_OVERWRITE_STATUS is defined, the SKCS_STATUS_XXX values + * returned here can be defined in some header file by the module using CSUM. + * In this way, the calling module can assign return values for its own needs, + * e.g. by assigning bit flags to the individual protocols. */ SKCS_STATUS SkCsGetReceiveInfo( SK_AC *pAc, /* Adapter context struct. */ @@ -544,30 +571,36 @@ /* Adjust the IP header and IP data checksums. */ - SKCS_OC_ADD(IpHeaderChecksum, - IpHeaderChecksum, IpOptionsChecksum); + SKCS_OC_ADD(IpHeaderChecksum, IpHeaderChecksum, IpOptionsChecksum); - SKCS_OC_SUB(IpDataChecksum, - IpDataChecksum, IpOptionsChecksum); + SKCS_OC_SUB(IpDataChecksum, IpDataChecksum, IpOptionsChecksum); } - /* Check if the IP header checksum is ok. */ /* - * NOTE: We must check the IP header checksum even if the caller does - * not want us to do so because we cannot do any further processing of - * the packet without a valid IP checksum. + * Check if the IP header checksum is ok. + * + * NOTE: We must check the IP header checksum even if the caller just wants + * us to check upper-layer checksums, because we cannot do any further + * processing of the packet without a valid IP checksum. */ + + /* Get the next level protocol identifier. */ + + NextLevelProtocol = *(SK_U8 *) + SKCS_IDX(pIpHeader, SKCS_OFS_IP_NEXT_LEVEL_PROTOCOL); if (IpHeaderChecksum != 0xFFFF) { pAc->Csum.ProtoStats[SKCS_PROTO_STATS_IP].RxErrCts++; + /* the NDIS tester wants to know the upper level protocol too */ + if (NextLevelProtocol == SKCS_PROTO_ID_TCP) { + return(SKCS_STATUS_IP_CSUM_ERROR_TCP); + } + else if (NextLevelProtocol == SKCS_PROTO_ID_UDP) { + return(SKCS_STATUS_IP_CSUM_ERROR_UDP); + } return (SKCS_STATUS_IP_CSUM_ERROR); } - /* Get the next level protocol identifier. */ - - NextLevelProtocol = - *(SK_U8 *) SKCS_IDX(pIpHeader, SKCS_OFS_IP_NEXT_LEVEL_PROTOCOL); - /* * Check if this is a TCP or UDP frame and if we should calculate the * TCP/UDP pseudo header checksum. @@ -579,14 +612,12 @@ if ((pAc->Csum.ReceiveFlags & SKCS_PROTO_TCP) != 0 && NextLevelProtocol == SKCS_PROTO_ID_TCP) { /* TCP/IP frame. */ - NextLevelProtoStats = - &pAc->Csum.ProtoStats[SKCS_PROTO_STATS_TCP]; + NextLevelProtoStats = &pAc->Csum.ProtoStats[SKCS_PROTO_STATS_TCP]; } else if ((pAc->Csum.ReceiveFlags & SKCS_PROTO_UDP) != 0 && NextLevelProtocol == SKCS_PROTO_ID_UDP) { /* UDP/IP frame. */ - NextLevelProtoStats = - &pAc->Csum.ProtoStats[SKCS_PROTO_STATS_UDP]; + NextLevelProtoStats = &pAc->Csum.ProtoStats[SKCS_PROTO_STATS_UDP]; } else { /* @@ -615,6 +646,24 @@ } /* + * 08-May-2000 ra + * + * From RFC 768 (UDP) + * If the computed checksum is zero, it is transmitted as all ones (the + * equivalent in one's complement arithmetic). An all zero transmitted + * checksum value means that the transmitter generated no checksum (for + * debugging or for higher level protocols that don't care). + */ + + if (NextLevelProtocol == SKCS_PROTO_ID_UDP && + *(SK_U16*)SKCS_IDX(pIpHeader, IpHeaderLength + 6) == 0x0000) { + + NextLevelProtoStats->RxOkCts++; + + return (SKCS_STATUS_IP_CSUM_OK_NO_UDP); + } + + /* * Calculate the TCP/UDP checksum. */ @@ -639,7 +688,7 @@ SKCS_OFS_IP_DESTINATION_ADDRESS + 0) + (unsigned long) *(SK_U16 *) SKCS_IDX(pIpHeader, SKCS_OFS_IP_DESTINATION_ADDRESS + 2) + - (unsigned long) (NextLevelProtocol << 8) + + (unsigned long) SKCS_HTON16(NextLevelProtocol) + (unsigned long) SKCS_HTON16(IpDataLength) + /* Add the TCP/UDP header checksum. */ @@ -672,7 +721,8 @@ return (NextLevelProtocol == SKCS_PROTO_ID_TCP ? SKCS_STATUS_TCP_CSUM_ERROR : SKCS_STATUS_UDP_CSUM_ERROR); -} +} /* SkCsGetReceiveInfo */ + /****************************************************************************** * @@ -702,7 +752,7 @@ * Returns the two hardware checksum start offsets. */ void SkCsSetReceiveFlags( -SK_AC *pAc, /* Adapter context struct. */ +SK_AC *pAc, /* Adapter context struct. */ unsigned ReceiveFlags, /* New receive flags. */ unsigned *pChecksum1Offset, /* Offset for hardware checksum 1. */ unsigned *pChecksum2Offset) /* Offset for hardware checksum 2. */ @@ -719,9 +769,10 @@ * if there are any IP header options in the actual packet. */ *pChecksum2Offset = SKCS_MAC_HEADER_SIZE + SKCS_IP_HEADER_SIZE; -} +} /* SkCsSetReceiveFlags */ #ifndef SkCsCalculateChecksum + /****************************************************************************** * * SkCsCalculateChecksum - calculate checksum for specified data @@ -783,7 +834,8 @@ /* Note: All bits beyond the 16-bit limit are now zero. */ return ((unsigned) Checksum); -} +} /* SkCsCalculateChecksum */ + #endif /* SkCsCalculateChecksum */ /****************************************************************************** @@ -833,7 +885,7 @@ memset(&pAc->Csum.ProtoStats[0], 0, sizeof(pAc->Csum.ProtoStats)); } - else { /* Clear for individual protocol. */ + else { /* Clear for individual protocol. */ memset(&pAc->Csum.ProtoStats[ProtoIndex], 0, sizeof(pAc->Csum.ProtoStats[ProtoIndex])); } @@ -842,6 +894,6 @@ break; } return (0); /* Success. */ -} +} /* SkCsEvent */ #endif /* SK_USE_CSUM */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/sk98lin/skge.c linux/drivers/net/sk98lin/skge.c --- v2.4.0-test8/linux/drivers/net/sk98lin/skge.c Wed Aug 9 19:19:50 2000 +++ linux/drivers/net/sk98lin/skge.c Fri Sep 15 14:34:19 2000 @@ -2,8 +2,8 @@ * * Name: skge.c * Project: GEnesis, PCI Gigabit Ethernet Adapter - * Version: $Revision: 1.27 $ - * Date: $Date: 1999/11/25 09:06:28 $ + * Version: $Revision: 1.29 $ + * Date: $Date: 2000/02/21 13:31:56 $ * Purpose: The main driver source module * ******************************************************************************/ @@ -46,6 +46,25 @@ * History: * * $Log: skge.c,v $ + * Kernel 2.4.x specific: + * Revision 1.xx 2000/09/12 13:31:56 cgoos + * Fixed missign "dev=NULL in skge_probe. + * Added counting for jumbo frames (corrects error statistic). + * Removed VLAN tag check (enables VLAN support). + * + * Kernel 2.2.x specific: + * Revision 1.29 2000/02/21 13:31:56 cgoos + * Fixed "unused" warning for UltraSPARC change. + * + * Partially kernel 2.2.x specific: + * Revision 1.28 2000/02/21 10:32:36 cgoos + * Added fixes for UltraSPARC. + * Now printing RlmtMode and PrefPort setting at startup. + * Changed XmitFrame return value. + * Fixed rx checksum calculation for BIG ENDIAN systems. + * Fixed rx jumbo frames counted as ierrors. + * + * * Revision 1.27 1999/11/25 09:06:28 cgoos * Changed base_addr to unsigned long. * @@ -225,7 +244,7 @@ static const char SysKonnectFileId[] = "@(#)" __FILE__ " (C) SysKonnect."; static const char SysKonnectBuildNumber[] = - "@(#)SK-BUILD: 3.02 (19991111) PL: 01"; + "@(#)SK-BUILD: 3.05 (20000907) PL: 01"; #include #include @@ -235,10 +254,10 @@ /* defines ******************************************************************/ -#define BOOT_STRING "sk98lin: Network Device Driver v3.02\n" \ - "Copyright (C) 1999 SysKonnect" +#define BOOT_STRING "sk98lin: Network Device Driver v3.05\n" \ + "Copyright (C) 1999-2000 SysKonnect" -#define VER_STRING "3.02" +#define VER_STRING "3.05" /* for debuging on x86 only */ @@ -373,6 +392,8 @@ PCI_DEVICE_ID_SYSKONNECT_GE, pdev)) != NULL) { if (pci_enable_device(pdev)) continue; + + dev = NULL; dev = init_etherdev(dev, sizeof(SK_AC)); if (dev == NULL) { @@ -785,6 +806,14 @@ ProductStr(pAC); printk("%s: %s\n", dev->name, pAC->DeviceStr); + /* Print configuration settings */ + printk(" PrefPort:%c RlmtMode:%s\n", + 'A' + pAC->Rlmt.PrefPort, + (pAC->RlmtMode==0) ? "ChkLink" : + ((pAC->RlmtMode==1) ? "ChkLink" : + ((pAC->RlmtMode==3) ? "ChkOth" : + ((pAC->RlmtMode==7) ? "ChkSeg" : "Error")))); + SkGeYellowLED(pAC, pAC->IoBase, 1); /* @@ -1936,6 +1965,10 @@ } /* frame > SK_COPY_TRESHOLD */ FrameStat = pRxd->FrameStat; + if ((FrameStat & XMR_FS_LNG_ERR) != 0) { + /* jumbo frame, count to correct statistic */ + SK_PNMI_CNT_RX_LONGFRAMES(pAC, pRxPort->PortIndex); + } pRxd = pRxd->pNextRxd; pRxPort->pRxdRingHead = pRxd; pRxPort->RxdRingFree ++; @@ -1947,9 +1980,9 @@ pRxPort->RxdRingFree)); if ((Control & RX_CTRL_STAT_VALID) == RX_CTRL_STAT_VALID && - (FrameStat & - (XMR_FS_ANY_ERR | XMR_FS_1L_VLAN | XMR_FS_2L_VLAN)) - == 0) { + (FrameStat & XMR_FS_ANY_ERR) == 0) { + // was the following, changed to allow VLAN support + // (XMR_FS_ANY_ERR | XMR_FS_1L_VLAN | XMR_FS_2L_VLAN) SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_RX_PROGRESS,("V")); ForRlmt = SK_RLMT_RX_PROTOCOL; diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/sk98lin/skgehwt.c linux/drivers/net/sk98lin/skgehwt.c --- v2.4.0-test8/linux/drivers/net/sk98lin/skgehwt.c Tue Nov 23 22:42:20 1999 +++ linux/drivers/net/sk98lin/skgehwt.c Fri Sep 15 14:34:19 2000 @@ -2,8 +2,8 @@ * * Name: skgehwt.c * Project: GEnesis, PCI Gigabit Ethernet Adapter - * Version: $Revision: 1.12 $ - * Date: $Date: 1998/10/15 15:11:34 $ + * Version: $Revision: 1.13 $ + * Date: $Date: 1999/11/22 13:31:12 $ * Purpose: Hardware Timer. * ******************************************************************************/ @@ -13,8 +13,6 @@ * (C)Copyright 1998,1999 SysKonnect, * a business unit of Schneider & Koch & Co. Datensysteme GmbH. * - * See the file "skge.c" for further information. - * * 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 @@ -29,6 +27,9 @@ * History: * * $Log: skgehwt.c,v $ + * Revision 1.13 1999/11/22 13:31:12 cgoos + * Changed license header to GPL. + * * Revision 1.12 1998/10/15 15:11:34 gklug * fix: ID_sccs to SysKonnectFileId * @@ -76,7 +77,7 @@ Event queue and dispatcher */ static const char SysKonnectFileId[] = - "$Header: /usr56/projects/ge/schedule/skgehwt.c,v 1.12 1998/10/15 15:11:34 gklug Exp $" ; + "$Header: /usr56/projects/ge/schedule/skgehwt.c,v 1.13 1999/11/22 13:31:12 cgoos Exp $" ; #include "h/skdrv1st.h" /* Driver Specific Definitions */ #include "h/skdrv2nd.h" /* Adapter Control- and Driver specific Def. */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/sk98lin/skgeinit.c linux/drivers/net/sk98lin/skgeinit.c --- v2.4.0-test8/linux/drivers/net/sk98lin/skgeinit.c Tue Nov 23 22:42:20 1999 +++ linux/drivers/net/sk98lin/skgeinit.c Fri Sep 15 14:34:19 2000 @@ -2,19 +2,17 @@ * * Name: skgeinit.c * Project: GEnesis, PCI Gigabit Ethernet Adapter - * Version: $Revision: 1.54 $ - * Date: $Date: 1999/10/26 07:32:54 $ + * Version: $Revision: 1.57 $ + * Date: $Date: 2000/08/03 14:55:28 $ * Purpose: Contains functions to initialize the GE HW * ******************************************************************************/ /****************************************************************************** * - * (C)Copyright 1998,1999 SysKonnect, + * (C)Copyright 1998-2000 SysKonnect, * a business unit of Schneider & Koch & Co. Datensysteme GmbH. * - * See the file "skge.c" for further information. - * * 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 @@ -29,6 +27,16 @@ * History: * * $Log: skgeinit.c,v $ + * Revision 1.57 2000/08/03 14:55:28 rassmann + * Waiting for I2C to be ready before de-initializing adapter + * (prevents sensors from hanging up). + * + * Revision 1.56 2000/07/27 12:16:48 gklug + * fix: Stop Port check of the STOP bit does now take 2/18 sec as wanted + * + * Revision 1.55 1999/11/22 13:32:26 cgoos + * Changed license header to GPL. + * * Revision 1.54 1999/10/26 07:32:54 malthoff * Initialize PHWLinkUp with SK_FALSE. Required for Diagnostics. * @@ -199,7 +207,7 @@ * DoInitRamQueue(), and SkGeCfgSync(). * Add coding for SkGeInitMacArb(), SkGeInitPktArb(), * SkGeInitMacFifo(), SkGeInitRamBufs(), - * SkGeInitRamIface(), and SkGeInitBmu(). + * SkGeInitRamIface(), and SkGeInitBmu(). * * Revision 1.11 1998/09/29 08:26:29 malthoff * bug fix: SkGeInit0() 'i' should be increment. @@ -275,7 +283,7 @@ /* local variables ************************************************************/ static const char SysKonnectFileId[] = - "@(#)$Id: skgeinit.c,v 1.54 1999/10/26 07:32:54 malthoff Exp $ (C) SK "; + "@(#)$Id: skgeinit.c,v 1.57 2000/08/03 14:55:28 rassmann Exp $ (C) SK "; struct s_QOffTab { int RxQOff; /* Receive Queue Address Offset */ @@ -283,7 +291,7 @@ int XaQOff; /* Async Tx Queue Address Offset */ }; static struct s_QOffTab QOffTab[] = { - { Q_R1, Q_XS1, Q_XA1 }, { Q_R2, Q_XS2, Q_XA2 } + {Q_R1, Q_XS1, Q_XA1}, {Q_R2, Q_XS2, Q_XA2} }; @@ -303,7 +311,7 @@ void SkGePollRxD( SK_AC *pAC, /* adapter context */ SK_IOC IoC, /* IO context */ -int Port, /* Port Index (MAC_1 + n) */ +int Port, /* Port Index (MAC_1 + n) */ SK_BOOL PollRxD) /* SK_TRUE (enable pol.), SK_FALSE (disable pol.) */ { SK_GEPORT *pPrt; @@ -311,12 +319,13 @@ pPrt = &pAC->GIni.GP[Port]; if (PollRxD) { - SK_OUT32(IoC, Q_ADDR(pPrt->PRxQOff,Q_CSR), CSR_ENA_POL); + SK_OUT32(IoC, Q_ADDR(pPrt->PRxQOff, Q_CSR), CSR_ENA_POL); } else { - SK_OUT32(IoC, Q_ADDR(pPrt->PRxQOff,Q_CSR), CSR_DIS_POL); + SK_OUT32(IoC, Q_ADDR(pPrt->PRxQOff, Q_CSR), CSR_DIS_POL); } -} +} /* SkGePollRxD */ + /****************************************************************************** * @@ -334,7 +343,7 @@ void SkGePollTxD( SK_AC *pAC, /* adapter context */ SK_IOC IoC, /* IO context */ -int Port, /* Port Index (MAC_1 + n) */ +int Port, /* Port Index (MAC_1 + n) */ SK_BOOL PollTxD) /* SK_TRUE (enable pol.), SK_FALSE (disable pol.) */ { SK_GEPORT *pPrt; @@ -350,12 +359,12 @@ } if (pPrt->PXSQSize != 0) { - SK_OUT32(IoC, Q_ADDR(pPrt->PXsQOff,Q_CSR), DWord); + SK_OUT32(IoC, Q_ADDR(pPrt->PXsQOff, Q_CSR), DWord); } if (pPrt->PXAQSize != 0) { - SK_OUT32(IoC, Q_ADDR(pPrt->PXaQOff,Q_CSR), DWord); + SK_OUT32(IoC, Q_ADDR(pPrt->PXaQOff, Q_CSR), DWord); } -} +} /* SkGePollTxD */ /****************************************************************************** @@ -374,17 +383,18 @@ void SkGeYellowLED( SK_AC *pAC, /* adapter context */ SK_IOC IoC, /* IO context */ -int State) /* yellow LED state, 0 = OFF, 0 != ON */ +int State) /* yellow LED state, 0 = OFF, 0 != ON */ { if (State == 0) { /* Switch yellow LED OFF */ - SK_OUT8(IoC, B0_LED, LED_STAT_OFF) ; + SK_OUT8(IoC, B0_LED, LED_STAT_OFF); } else { /* Switch yellow LED ON */ - SK_OUT8(IoC, B0_LED, LED_STAT_ON) ; + SK_OUT8(IoC, B0_LED, LED_STAT_ON); } -} +} /* SkGeYellowLED */ + /****************************************************************************** * @@ -398,7 +408,7 @@ * 'Led' must contain the address offset of the LEDs INI register. * * Usage: - * SkGeXmitLED(pAC, IoC, MR_ADDR(Port,TX_LED_INI), SK_LED_ENA); + * SkGeXmitLED(pAC, IoC, MR_ADDR(Port, TX_LED_INI), SK_LED_ENA); * * Returns: * nothing @@ -406,31 +416,31 @@ void SkGeXmitLED( SK_AC *pAC, /* adapter context */ SK_IOC IoC, /* IO context */ -int Led, /* offset to the LED Init Value register */ -int Mode) /* Mode may be SK_LED_DIS, SK_LED_ENA, SK_LED_TST */ +int Led, /* offset to the LED Init Value register */ +int Mode) /* Mode may be SK_LED_DIS, SK_LED_ENA, SK_LED_TST */ { SK_U32 LedIni; switch (Mode) { case SK_LED_ENA: LedIni = SK_XMIT_DUR * (SK_U32)pAC->GIni.GIHstClkFact / 100; - SK_OUT32(IoC, Led+XMIT_LED_INI, LedIni); - SK_OUT8(IoC, Led+XMIT_LED_CTRL, LED_START); - break ; + SK_OUT32(IoC, Led + XMIT_LED_INI, LedIni); + SK_OUT8(IoC, Led + XMIT_LED_CTRL, LED_START); + break; case SK_LED_TST: - SK_OUT8(IoC, Led+XMIT_LED_TST, LED_T_ON); - SK_OUT32(IoC, Led+XMIT_LED_CNT, 100); - SK_OUT8(IoC, Led+XMIT_LED_CTRL, LED_START); - break ; + SK_OUT8(IoC, Led + XMIT_LED_TST, LED_T_ON); + SK_OUT32(IoC, Led + XMIT_LED_CNT, 100); + SK_OUT8(IoC, Led + XMIT_LED_CTRL, LED_START); + break; case SK_LED_DIS: default: /* * Do NOT stop the LED Timer here. The LED might be * in on state. But it needs to go off. */ - SK_OUT32(IoC, Led+XMIT_LED_CNT, 0); - SK_OUT8(IoC, Led+XMIT_LED_TST, LED_T_OFF); - break ; + SK_OUT32(IoC, Led + XMIT_LED_CNT, 0); + SK_OUT8(IoC, Led + XMIT_LED_TST, LED_T_OFF); + break; } /* @@ -440,7 +450,8 @@ * (Broadcom: It may be that PHY_B_PEC_EN_LTR has to be set.) * (In this case it has to be added here. But we will see. XXX) */ -} +} /* SkGeXmitLED */ + /****************************************************************************** * @@ -461,12 +472,12 @@ * 1: configuration error */ static int DoCalcAddr( -SK_AC *pAC, /* adapter context */ -SK_GEPORT *pPrt, /* port index */ -int QuSize, /* size of the queue to configure in kB */ -SK_U32 *StartVal, /* start value for address calculation */ -SK_U32 *QuStartAddr, /* start addr to calculate */ -SK_U32 *QuEndAddr) /* end address to calculate */ +SK_AC *pAC, /* adapter context */ +SK_GEPORT *pPrt, /* port index */ +int QuSize, /* size of the queue to configure in kB */ +SK_U32 *StartVal, /* start value for address calculation */ +SK_U32 *QuStartAddr, /* start addr to calculate */ +SK_U32 *QuEndAddr) /* end address to calculate */ { SK_U32 EndVal; SK_U32 NextStart; @@ -494,7 +505,7 @@ *StartVal = NextStart; return (Rtv); -} +} /* DoCalcAddr */ /****************************************************************************** @@ -521,8 +532,8 @@ * 1: Queue Size Configuration invalid */ static int SkGeCheckQSize( -SK_AC *pAC, /* adapter context */ -int Port) /* port index */ +SK_AC *pAC, /* adapter context */ +int Port) /* port index */ { SK_GEPORT *pPrt; int UsedMem; @@ -540,9 +551,7 @@ (pPrt->PXSQSize & QZ_UNITS) || (pPrt->PXAQSize & QZ_UNITS)) { - SK_ERR_LOG(pAC, SK_ERRCL_SW, - SKERR_HWI_E012, - SKERR_HWI_E012MSG); + SK_ERR_LOG(pAC, SK_ERRCL_SW, SKERR_HWI_E012, SKERR_HWI_E012MSG); Rtv = 1; goto CheckQSizeEnd; } @@ -550,9 +559,7 @@ UsedMem += pPrt->PRxQSize + pPrt->PXSQSize + pPrt->PXAQSize; if (i == Port && pPrt->PRxQSize < SK_MIN_RXQ_SIZE) { - SK_ERR_LOG(pAC, SK_ERRCL_SW, - SKERR_HWI_E011, - SKERR_HWI_E011MSG); + SK_ERR_LOG(pAC, SK_ERRCL_SW, SKERR_HWI_E011, SKERR_HWI_E011MSG); Rtv = 1; goto CheckQSizeEnd; } @@ -584,17 +591,15 @@ Rtv |= Rtv2; if (Rtv) { - SK_ERR_LOG(pAC, SK_ERRCL_SW, - SKERR_HWI_E013, - SKERR_HWI_E013MSG); + SK_ERR_LOG(pAC, SK_ERRCL_SW, SKERR_HWI_E013, SKERR_HWI_E013MSG); break; } } - CheckQSizeEnd: return (Rtv); -} +} /* SkGeCheckQSize */ + /****************************************************************************** * @@ -633,7 +638,8 @@ * There is not start or enable buttom to push, therefore * the MAC arbiter is configured and enabled now. */ -} +} /* SkGeInitMacArb */ + /****************************************************************************** * @@ -666,10 +672,11 @@ SK_OUT16(IoC, B3_PA_CTRL, PA_ENA_TO_TX1); } else { - SK_OUT16(IoC, B3_PA_CTRL,(PA_ENA_TO_TX1|PA_ENA_TO_TX2)); + SK_OUT16(IoC, B3_PA_CTRL,(PA_ENA_TO_TX1 | PA_ENA_TO_TX2)); } } -} +} /* SkGeInitPktArb */ + /****************************************************************************** * @@ -684,7 +691,7 @@ static void SkGeInitMacFifo( SK_AC *pAC, /* adapter context */ SK_IOC IoC, /* IO context */ -int Port) /* Port Index (MAC_1 + n) */ +int Port) /* Port Index (MAC_1 + n) */ { /* * For each FIFO: @@ -707,7 +714,8 @@ if (pAC->GIni.GIPortUsage == SK_JUMBO_LINK) { SK_OUT16(IoC, MR_ADDR(Port, RX_MFF_CTRL1), MFF_ENA_FLUSH); } -} +} /* SkGeInitMacFifo */ + /****************************************************************************** * @@ -731,7 +739,7 @@ void SkGeLoadLnkSyncCnt( SK_AC *pAC, /* adapter context */ SK_IOC IoC, /* IO context */ -int Port, /* Port Index (MAC_1 + n) */ +int Port, /* Port Index (MAC_1 + n) */ SK_U32 CntVal) /* Counter value */ { SK_U32 OrgIMsk; @@ -740,7 +748,7 @@ SK_BOOL IrqPend; /* stop counter */ - SK_OUT8(IoC, MR_ADDR(Port,LNK_SYNC_CTRL), LED_STOP); + SK_OUT8(IoC, MR_ADDR(Port, LNK_SYNC_CTRL), LED_STOP); /* * ASIC problem: @@ -770,17 +778,18 @@ } /* load counter */ - SK_OUT32(IoC, MR_ADDR(Port,LNK_SYNC_INI), CntVal); + SK_OUT32(IoC, MR_ADDR(Port, LNK_SYNC_INI), CntVal); /* start counter */ - SK_OUT8(IoC, MR_ADDR(Port,LNK_SYNC_CTRL), LED_START); + SK_OUT8(IoC, MR_ADDR(Port, LNK_SYNC_CTRL), LED_START); if (!IrqPend) { /* clear the unexpected IRQ, and restore the interrupt mask */ - SK_OUT8(IoC, MR_ADDR(Port,LNK_SYNC_CTRL), LED_CLR_IRQ); + SK_OUT8(IoC, MR_ADDR(Port, LNK_SYNC_CTRL), LED_CLR_IRQ); SK_OUT32(IoC, B0_IMSK, OrgIMsk); } -} +} /* SkGeLoadLnkSyncCnt*/ + /****************************************************************************** * @@ -813,10 +822,10 @@ int SkGeCfgSync( SK_AC *pAC, /* adapter context */ SK_IOC IoC, /* IO context */ -int Port, /* Port Index (MAC_1 + n) */ +int Port, /* Port Index (MAC_1 + n) */ SK_U32 IntTime, /* Interval Timer Value in units of 8ns */ SK_U32 LimCount, /* Number of bytes to transfer during IntTime */ -int SyncMode) /* Sync Mode: TXA_ENA_ALLOC | TXA_DIS_ALLOC | 0 */ +int SyncMode) /* Sync Mode: TXA_ENA_ALLOC | TXA_DIS_ALLOC | 0 */ { int Rtv; @@ -836,8 +845,7 @@ IntTime = (IntTime / 2) * pAC->GIni.GIHstClkFact / 100; LimCount = LimCount / 8; if (IntTime > TXA_MAX_VAL || LimCount > TXA_MAX_VAL) { - SK_ERR_LOG(pAC, SK_ERRCL_SW, SKERR_HWI_E010, - SKERR_HWI_E010MSG); + SK_ERR_LOG(pAC, SK_ERRCL_SW, SKERR_HWI_E010, SKERR_HWI_E010MSG); Rtv = 1; goto CfgSyncEnd; } @@ -852,14 +860,14 @@ * - start 'Rate Control' and disable 'Force Sync' * if Interval Timer or Limit Counter not zero. */ - SK_OUT8(IoC, MR_ADDR(Port,TXA_CTRL), + SK_OUT8(IoC, MR_ADDR(Port, TXA_CTRL), TXA_ENA_FSYNC | TXA_DIS_ALLOC | TXA_STOP_RC); - SK_OUT32(IoC, MR_ADDR(Port,TXA_ITI_INI), IntTime); - SK_OUT32(IoC, MR_ADDR(Port,TXA_LIM_INI), LimCount); - SK_OUT8(IoC, MR_ADDR(Port,TXA_CTRL), + SK_OUT32(IoC, MR_ADDR(Port, TXA_ITI_INI), IntTime); + SK_OUT32(IoC, MR_ADDR(Port, TXA_LIM_INI), LimCount); + SK_OUT8(IoC, MR_ADDR(Port, TXA_CTRL), (SyncMode & (TXA_ENA_ALLOC|TXA_DIS_ALLOC))); if (IntTime != 0 || LimCount != 0) { - SK_OUT8(IoC, MR_ADDR(Port,TXA_CTRL), + SK_OUT8(IoC, MR_ADDR(Port, TXA_CTRL), TXA_DIS_FSYNC|TXA_START_RC); } } @@ -870,7 +878,8 @@ CfgSyncEnd: return (Rtv); -} +} /* SkGeCfgSync */ + /****************************************************************************** * @@ -884,12 +893,12 @@ * nothing */ static void DoInitRamQueue( -SK_AC *pAC, /* adapter context */ -SK_IOC IoC, /* IO context */ -int QuIoOffs, /* Queue IO Address Offset */ +SK_AC *pAC, /* adapter context */ +SK_IOC IoC, /* IO context */ +int QuIoOffs, /* Queue IO Address Offset */ SK_U32 QuStartAddr, /* Queue Start Address */ -SK_U32 QuEndAddr, /* Queue End Address */ -int QuType) /* Queue Type (SK_RX_SRAM_Q|SK_RX_BRAM_Q|SK_TX_RAM_Q) */ +SK_U32 QuEndAddr, /* Queue End Address */ +int QuType) /* Queue Type (SK_RX_SRAM_Q|SK_RX_BRAM_Q|SK_TX_RAM_Q) */ { SK_U32 RxUpThresVal; SK_U32 RxLoThresVal; @@ -904,13 +913,13 @@ QuEndAddr = QuEndAddr / 8; /* release local reset */ - SK_OUT8(IoC, RB_ADDR(QuIoOffs,RB_CTRL), RB_RST_CLR); + SK_OUT8(IoC, RB_ADDR(QuIoOffs, RB_CTRL), RB_RST_CLR); /* configure addresses */ - SK_OUT32(IoC, RB_ADDR(QuIoOffs,RB_START), QuStartAddr); - SK_OUT32(IoC, RB_ADDR(QuIoOffs,RB_END), QuEndAddr); - SK_OUT32(IoC, RB_ADDR(QuIoOffs,RB_WP), QuStartAddr); - SK_OUT32(IoC, RB_ADDR(QuIoOffs,RB_RP), QuStartAddr); + SK_OUT32(IoC, RB_ADDR(QuIoOffs, RB_START), QuStartAddr); + SK_OUT32(IoC, RB_ADDR(QuIoOffs, RB_END), QuEndAddr); + SK_OUT32(IoC, RB_ADDR(QuIoOffs, RB_WP), QuStartAddr); + SK_OUT32(IoC, RB_ADDR(QuIoOffs, RB_RP), QuStartAddr); switch (QuType) { case SK_RX_SRAM_Q: @@ -921,10 +930,9 @@ case SK_RX_BRAM_Q: /* write threshold for Rx Queue */ - SK_OUT32(IoC, RB_ADDR(QuIoOffs,RB_RX_UTPP), - RxUpThresVal); - SK_OUT32(IoC, RB_ADDR(QuIoOffs,RB_RX_LTPP), - RxLoThresVal); + SK_OUT32(IoC, RB_ADDR(QuIoOffs, RB_RX_UTPP), RxUpThresVal); + SK_OUT32(IoC, RB_ADDR(QuIoOffs,RB_RX_LTPP), RxLoThresVal); + /* the high priority threshold not used */ break; case SK_TX_RAM_Q: @@ -939,20 +947,20 @@ * enable Store & Forward Mode for the * Tx Side */ - SK_OUT8(IoC, RB_ADDR(QuIoOffs,RB_CTRL), - RB_ENA_STFWD); + SK_OUT8(IoC, RB_ADDR(QuIoOffs, RB_CTRL), RB_ENA_STFWD); } break; } /* set queue operational */ - SK_OUT8(IoC, RB_ADDR(QuIoOffs,RB_CTRL), RB_ENA_OP_MD); + SK_OUT8(IoC, RB_ADDR(QuIoOffs, RB_CTRL), RB_ENA_OP_MD); } else { /* ensure the queue is still disabled */ - SK_OUT8(IoC, RB_ADDR(QuIoOffs,RB_CTRL), RB_RST_SET); + SK_OUT8(IoC, RB_ADDR(QuIoOffs, RB_CTRL), RB_RST_SET); } -} +} /* DoInitRamQueue*/ + /****************************************************************************** * @@ -967,7 +975,7 @@ static void SkGeInitRamBufs( SK_AC *pAC, /* adapter context */ SK_IOC IoC, /* IO context */ -int Port) /* Port Index (MAC_1 + n) */ +int Port) /* Port Index (MAC_1 + n) */ { SK_GEPORT *pPrt; int RxQType; @@ -987,7 +995,8 @@ pPrt->PXsQRamEnd, SK_TX_RAM_Q); DoInitRamQueue(pAC, IoC, pPrt->PXaQOff, pPrt->PXaQRamStart, pPrt->PXaQRamEnd, SK_TX_RAM_Q); -} +} /* SkGeInitRamBufs */ + /****************************************************************************** * @@ -1022,7 +1031,8 @@ SK_OUT8(IoC, B3_RI_RTO_R2, SK_RI_TO_53); SK_OUT8(IoC, B3_RI_RTO_XA2, SK_RI_TO_53); SK_OUT8(IoC, B3_RI_RTO_XS2, SK_RI_TO_53); -} +} /* SkGeInitRamIface */ + /****************************************************************************** * @@ -1037,33 +1047,34 @@ static void SkGeInitBmu( SK_AC *pAC, /* adapter context */ SK_IOC IoC, /* IO context */ -int Port) /* Port Index (MAC_1 + n) */ +int Port) /* Port Index (MAC_1 + n) */ { SK_GEPORT *pPrt; pPrt = &pAC->GIni.GP[Port]; /* Rx Queue: Release all local resets and set the watermark */ - SK_OUT32(IoC, Q_ADDR(pPrt->PRxQOff,Q_CSR), CSR_CLR_RESET); - SK_OUT32(IoC, Q_ADDR(pPrt->PRxQOff,Q_F), SK_BMU_RX_WM); + SK_OUT32(IoC, Q_ADDR(pPrt->PRxQOff, Q_CSR), CSR_CLR_RESET); + SK_OUT32(IoC, Q_ADDR(pPrt->PRxQOff, Q_F), SK_BMU_RX_WM); /* * Tx Queue: Release all local resets if the queue is used! * set watermark */ if (pPrt->PXSQSize != 0) { - SK_OUT32(IoC, Q_ADDR(pPrt->PXsQOff,Q_CSR), CSR_CLR_RESET); - SK_OUT32(IoC, Q_ADDR(pPrt->PXsQOff,Q_F), SK_BMU_TX_WM); + SK_OUT32(IoC, Q_ADDR(pPrt->PXsQOff, Q_CSR), CSR_CLR_RESET); + SK_OUT32(IoC, Q_ADDR(pPrt->PXsQOff, Q_F), SK_BMU_TX_WM); } if (pPrt->PXAQSize != 0) { - SK_OUT32(IoC, Q_ADDR(pPrt->PXaQOff,Q_CSR), CSR_CLR_RESET); - SK_OUT32(IoC, Q_ADDR(pPrt->PXaQOff,Q_F), SK_BMU_TX_WM); + SK_OUT32(IoC, Q_ADDR(pPrt->PXaQOff, Q_CSR), CSR_CLR_RESET); + SK_OUT32(IoC, Q_ADDR(pPrt->PXaQOff, Q_F), SK_BMU_TX_WM); } /* * Do NOT enable the descriptor poll timers here, because * the descriptor addresses are not specified yet. */ -} +} /* SkGeInitBmu */ + /****************************************************************************** * @@ -1081,17 +1092,18 @@ static SK_U32 TestStopBit( SK_AC *pAC, /* Adapter Context */ SK_IOC IoC, /* IO Context */ -int QuIoOffs) /* Queue IO Address Offset */ +int QuIoOffs) /* Queue IO Address Offset */ { SK_U32 QuCsr; /* CSR contents */ - SK_IN32(IoC, Q_ADDR(QuIoOffs,Q_CSR), &QuCsr); + SK_IN32(IoC, Q_ADDR(QuIoOffs, Q_CSR), &QuCsr); if ((QuCsr & (CSR_STOP|CSR_SV_IDLE)) == 0) { - SK_OUT32(IoC, Q_ADDR(QuIoOffs,Q_CSR), CSR_STOP); - SK_IN32(IoC, Q_ADDR(QuIoOffs,Q_CSR), &QuCsr); + SK_OUT32(IoC, Q_ADDR(QuIoOffs, Q_CSR), CSR_STOP); + SK_IN32(IoC, Q_ADDR(QuIoOffs, Q_CSR), &QuCsr); } return (QuCsr); -} +} /* TestStopBit*/ + /****************************************************************************** * @@ -1173,10 +1185,10 @@ */ void SkGeStopPort( SK_AC *pAC, /* adapter context */ -SK_IOC IoC, /* IO context */ -int Port, /* port to stop (MAC_1 + n) */ -int Dir, /* Direction to Stop (SK_STOP_RX, SK_STOP_TX, SK_STOP_ALL) */ -int RstMode)/* Reset Mode (SK_SOFT_RST, SK_HARD_RST) */ +SK_IOC IoC, /* I/O context */ +int Port, /* port to stop (MAC_1 + n) */ +int Dir, /* Direction to Stop (SK_STOP_RX, SK_STOP_TX, SK_STOP_ALL) */ +int RstMode)/* Reset Mode (SK_SOFT_RST, SK_HARD_RST) */ { #ifndef SK_DIAG SK_EVPARA Para; @@ -1196,8 +1208,7 @@ if (Dir & SK_STOP_TX) { /* disable the XMACs receiver and transmitter */ XM_IN16(IoC, Port, XM_MMU_CMD, &Word); - XM_OUT16(IoC, Port, XM_MMU_CMD, - Word & ~(XM_MMU_ENA_RX | XM_MMU_ENA_TX)); + XM_OUT16(IoC, Port, XM_MMU_CMD, Word & ~(XM_MMU_ENA_RX | XM_MMU_ENA_TX)); /* dummy read to ensure writing */ XM_IN16(IoC, Port, XM_MMU_CMD, &Word); @@ -1207,8 +1218,8 @@ * If the BMU is in the reset state CSR_STOP will terminate * immediately. */ - SK_OUT32(IoC, Q_ADDR(pPrt->PXsQOff,Q_CSR), CSR_STOP); - SK_OUT32(IoC, Q_ADDR(pPrt->PXaQOff,Q_CSR), CSR_STOP); + SK_OUT32(IoC, Q_ADDR(pPrt->PXsQOff, Q_CSR), CSR_STOP); + SK_OUT32(IoC, Q_ADDR(pPrt->PXaQOff, Q_CSR), CSR_STOP); ToutStart = SkOsGetTime(pAC); ToutCnt = 0; @@ -1231,17 +1242,16 @@ * transmit FIFO ! */ XM_IN32(IoC, Port, XM_MODE, &DWord); - DWord |= XM_MD_FTF ; + DWord |= XM_MD_FTF; XM_OUT32(IoC, Port, XM_MODE, DWord); XsCsr = TestStopBit(pAC, IoC, pPrt->PXsQOff); XaCsr = TestStopBit(pAC, IoC, pPrt->PXaQOff); - if (ToutStart + (SK_TICKS_PER_SEC / 18) < - SkOsGetTime(pAC)) { - + if (ToutStart + (SK_TICKS_PER_SEC / 18) >= SkOsGetTime(pAC)) { /* * Timeout of 1/18 second reached. + * This needs to be checked at 1/18 sec only. */ ToutCnt++; switch (ToutCnt) { @@ -1253,35 +1263,36 @@ */ ToutStart = SkOsGetTime(pAC); if (XsCsr & CSR_STOP) { - SK_OUT32(IoC, - Q_ADDR(pPrt->PXsQOff, - Q_CSR), CSR_START); + SK_OUT32(IoC, Q_ADDR(pPrt->PXsQOff, Q_CSR), CSR_START); } if (XaCsr & CSR_STOP) { - SK_OUT32(IoC, - Q_ADDR(pPrt->PXaQOff, - Q_CSR), CSR_START); + SK_OUT32(IoC, Q_ADDR(pPrt->PXaQOff, Q_CSR), CSR_START); } break; case 2: - default: /* Fatal Error, Loop aborted */ + default: + /* Might be a problem when the driver event handler + * calls StopPort again. + * XXX. + */ + /* Fatal Error, Loop aborted */ /* Create an Error Log Entry */ - SK_ERR_LOG(pAC, SK_ERRCL_HW, + SK_ERR_LOG( + pAC, + SK_ERRCL_HW, SKERR_HWI_E018, SKERR_HWI_E018MSG); #ifndef SK_DIAG Para.Para64 = Port; - SkEventQueue(pAC, SKGE_DRV, - SK_DRV_PORT_FAIL, Para); + SkEventQueue(pAC, SKGE_DRV, SK_DRV_PORT_FAIL, Para); #endif /* !SK_DIAG */ return; } } /* - * because of the ASIC problem report entry from 21.08.98 - * it is required to wait until CSR_STOP is reset and - * CSR_SV_IDLE is set. + * Because of the ASIC problem report entry from 21.08.1998 it is + * required to wait until CSR_STOP is reset and CSR_SV_IDLE is set. */ } while ((XsCsr & (CSR_STOP|CSR_SV_IDLE)) != CSR_SV_IDLE || (XaCsr & (CSR_STOP|CSR_SV_IDLE)) != CSR_SV_IDLE); @@ -1298,10 +1309,10 @@ * Stop Interval Timer and Limit Counter of Tx Arbiter, * also disable Force Sync bit and Enable Alloc bit. */ - SK_OUT8(IoC, MR_ADDR(Port,TXA_CTRL), + SK_OUT8(IoC, MR_ADDR(Port, TXA_CTRL), TXA_DIS_FSYNC | TXA_DIS_ALLOC | TXA_STOP_RC); - SK_OUT32(IoC, MR_ADDR(Port,TXA_ITI_INI), 0x00000000L); - SK_OUT32(IoC, MR_ADDR(Port,TXA_LIM_INI), 0x00000000L); + SK_OUT32(IoC, MR_ADDR(Port, TXA_ITI_INI), 0x00000000L); + SK_OUT32(IoC, MR_ADDR(Port, TXA_LIM_INI), 0x00000000L); /* * perform a local reset of the port's tx path @@ -1311,16 +1322,16 @@ * - reset the RAM Butter sync tx queue * - reset the MAC Tx FIFO */ - SK_OUT32(IoC, Q_ADDR(pPrt->PXaQOff,Q_CSR), CSR_SET_RESET); - SK_OUT32(IoC, Q_ADDR(pPrt->PXsQOff,Q_CSR), CSR_SET_RESET); - SK_OUT8(IoC, RB_ADDR(pPrt->PXaQOff,RB_CTRL), RB_RST_SET); - SK_OUT8(IoC, RB_ADDR(pPrt->PXsQOff,RB_CTRL), RB_RST_SET); + SK_OUT32(IoC, Q_ADDR(pPrt->PXaQOff, Q_CSR), CSR_SET_RESET); + SK_OUT32(IoC, Q_ADDR(pPrt->PXsQOff, Q_CSR), CSR_SET_RESET); + SK_OUT8(IoC, RB_ADDR(pPrt->PXaQOff, RB_CTRL), RB_RST_SET); + SK_OUT8(IoC, RB_ADDR(pPrt->PXsQOff, RB_CTRL), RB_RST_SET); /* Note: MFF_RST_SET does NOT reset the XMAC! */ SK_OUT8(IoC, MR_ADDR(Port, TX_MFF_CTRL2), MFF_RST_SET); /* switch Link and Tx LED off, stop the LED counters */ /* Link LED is switched off by the RLMT and the Diag itself */ - SkGeXmitLED(pAC, IoC, MR_ADDR(Port,TX_LED_INI), SK_LED_DIS); + SkGeXmitLED(pAC, IoC, MR_ADDR(Port, TX_LED_INI), SK_LED_DIS); } if (Dir & SK_STOP_RX) { @@ -1331,7 +1342,7 @@ * stop the transfer of received packets. */ /* stop the port's receive queue */ - SK_OUT32(IoC, Q_ADDR(pPrt->PRxQOff,Q_CSR), CSR_STOP); + SK_OUT32(IoC, Q_ADDR(pPrt->PRxQOff, Q_CSR), CSR_STOP); i = 100; do { /* @@ -1368,12 +1379,12 @@ * - reset the RAM Buffer receive queue * - reset the MAC Rx FIFO */ - SK_OUT32(IoC, Q_ADDR(pPrt->PRxQOff,Q_CSR), CSR_SET_RESET); - SK_OUT8(IoC, RB_ADDR(pPrt->PRxQOff,RB_CTRL), RB_RST_SET); + SK_OUT32(IoC, Q_ADDR(pPrt->PRxQOff, Q_CSR), CSR_SET_RESET); + SK_OUT8(IoC, RB_ADDR(pPrt->PRxQOff, RB_CTRL), RB_RST_SET); SK_OUT8(IoC, MR_ADDR(Port, RX_MFF_CTRL2), MFF_RST_SET); /* switch Rx LED off, stop the LED counter */ - SkGeXmitLED(pAC, IoC, MR_ADDR(Port,RX_LED_INI), SK_LED_DIS); + SkGeXmitLED(pAC, IoC, MR_ADDR(Port, RX_LED_INI), SK_LED_DIS); } @@ -1391,7 +1402,8 @@ if (AllPortsDis) { pAC->GIni.GIAnyPortAct = SK_FALSE; } -} +} /* SkGeStopPort */ + /****************************************************************************** * @@ -1444,7 +1456,88 @@ pAC->GIni.GIPortUsage = SK_RED_LINK; pAC->GIni.GIAnyPortAct = SK_FALSE; -} +} /* SkGeInit0*/ + +#ifdef SK_PCI_RESET + +/****************************************************************************** + * + * SkGePciReset() - Reset PCI interface + * + * Description: + * o Read PCI configuration. + * o Change power state to 3. + * o Change power state to 0. + * o Restore PCI configuration. + * + * Returns: + * 0: Success. + * 1: Power state could not be changed to 3. + */ +static int SkGePciReset( +SK_AC *pAC, /* adapter context */ +SK_IOC IoC) /* IO context */ +{ + int i; + SK_U16 PmCtlSts; + SK_U32 Bp1; + SK_U32 Bp2; + SK_U16 PciCmd; + SK_U8 Cls; + SK_U8 Lat; + SK_U8 ConfigSpace[PCI_CFG_SIZE]; + + /* + * Note: Switching to D3 state is like a software reset. + * Switching from D3 to D0 is a hardware reset. + * We have to save and restore the configuration space. + */ + for (i = 0; i < PCI_CFG_SIZE; i++) { + SkPciReadCfgDWord(pAC, i*4, &ConfigSpace[i]); + } + + /* We know the RAM Interface Arbiter is enabled. */ + SkPciWriteCfgWord(pAC, PCI_PM_CTL_STS, PCI_PM_STATE_D3); + SkPciReadCfgWord(pAC, PCI_PM_CTL_STS, &PmCtlSts); + if ((PmCtlSts & PCI_PM_STATE) != PCI_PM_STATE_D3) { + return (1); + } + + /* + * Return to D0 state. + */ + SkPciWriteCfgWord(pAC, PCI_PM_CTL_STS, PCI_PM_STATE_D0); + + /* Check for D0 state. */ + SkPciReadCfgWord(pAC, PCI_PM_CTL_STS, &PmCtlSts); + if ((PmCtlSts & PCI_PM_STATE) != PCI_PM_STATE_D0) { + return (1); + } + + /* + * Check PCI Config Registers. + */ + SkPciReadCfgWord(pAC, PCI_COMMAND, &PciCmd); + SkPciReadCfgByte(pAC, PCI_CACHE_LSZ, &Cls); + SkPciReadCfgDWord(pAC, PCI_BASE_1ST, &Bp1); + SkPciReadCfgDWord(pAC, PCI_BASE_2ND, &Bp2); + SkPciReadCfgByte(pAC, PCI_LAT_TIM, &lat); + if (PciCmd != 0 || Cls != 0 || (Bp1 & 0xfffffff0L) != 0 || Bp2 != 1 || + Lat != 0 ) { + return (0); + } + + /* + * Restore Config Space. + */ + for (i = 0; i < PCI_CFG_SIZE; i++) { + SkPciWriteCfgDWord(pAC, i*4, ConfigSpace[i]); + } + + return (0); +} /* SkGePciReset */ + +#endif /* SK_PCI_RESET */ /****************************************************************************** * @@ -1477,6 +1570,10 @@ RetVal = 0; +#ifdef SK_PCI_RESET + (void)SkGePciReset(pAC, IoC); +#endif /* SK_PCI_RESET */ + /* Do the reset */ SK_OUT8(IoC, B0_CTST, CS_RST_SET); @@ -1486,7 +1583,7 @@ /* Reset all error bits in the PCI STATUS register */ /* * Note: Cfg cycles cannot be used, because they are not - * available on some platforms after 'boot time'. + * available on some platforms after 'boot time'. */ SK_OUT8(IoC, B2_TST_CTRL1, TST_CFG_WRITE_ON); SK_IN16(IoC, PCI_C(PCI_STATUS), &Word); @@ -1547,12 +1644,13 @@ break; } } - SK_DBG_MSG(pAC,SK_DBGMOD_HWM,SK_DBGCAT_INIT, + SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_INIT, ("PHY type: %d PHY addr: %x\n", pAC->GIni.GP[i].PhyType, - pAC->GIni.GP[i].PhyAddr)) ; + pAC->GIni.GP[i].PhyAddr)); return (RetVal); -} +} /* SkGeInit1*/ + /****************************************************************************** * @@ -1588,8 +1686,7 @@ pAC->GIni.GIPollTimerVal = SK_DPOLL_MAX; /* Create an Error Log Entry */ - SK_ERR_LOG(pAC, SK_ERRCL_SW, SKERR_HWI_E017, - SKERR_HWI_E017MSG); + SK_ERR_LOG(pAC, SK_ERRCL_SW, SKERR_HWI_E017, SKERR_HWI_E017MSG); } SK_OUT32(IoC, B28_DPT_INI, pAC->GIni.GIPollTimerVal); SK_OUT8(IoC, B28_DPT_CTRL, DPT_START); @@ -1607,9 +1704,9 @@ SkGeInitPktArb(pAC, IoC); /* enable the Tx Arbiters */ - SK_OUT8(IoC, MR_ADDR(MAC_1,TXA_CTRL), TXA_ENA_ARB); + SK_OUT8(IoC, MR_ADDR(MAC_1, TXA_CTRL), TXA_ENA_ARB); if (pAC->GIni.GIMacsFound > 1) { - SK_OUT8(IoC, MR_ADDR(MAC_2,TXA_CTRL), TXA_ENA_ARB); + SK_OUT8(IoC, MR_ADDR(MAC_2, TXA_CTRL), TXA_ENA_ARB); } /* enable the RAM Interface Arbiter */ @@ -1621,7 +1718,7 @@ pPrt->PRxCmd |= XM_RX_BIG_PK_OK; } } -} +} /* SkGeInit2 */ /****************************************************************************** * @@ -1660,24 +1757,24 @@ int SkGeInit( SK_AC *pAC, /* adapter context */ SK_IOC IoC, /* IO context */ -int Level) /* initialization level */ +int Level) /* initialization level */ { int RetVal; /* return value */ SK_U32 DWord; RetVal = 0; - SK_DBG_MSG(pAC,SK_DBGMOD_HWM,SK_DBGCAT_INIT, - ("SkGeInit(Level %d)\n",Level)) ; + SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_INIT, + ("SkGeInit(Level %d)\n", Level)); switch (Level) { case SK_INIT_DATA: /* Initialization Level 0 */ - SkGeInit0(pAC,IoC) ; + SkGeInit0(pAC, IoC); pAC->GIni.GILevel = SK_INIT_DATA; break; case SK_INIT_IO: /* Initialization Level 1 */ - RetVal = SkGeInit1(pAC,IoC) ; + RetVal = SkGeInit1(pAC, IoC); /* Check if the adapter seems to be accessable */ SK_OUT32(IoC, B2_IRQM_INI, 0x11335577L); @@ -1701,13 +1798,12 @@ /* Initialization Level 2 */ if (pAC->GIni.GILevel != SK_INIT_IO) { #ifndef SK_DIAG - SK_ERR_LOG(pAC, SK_ERRCL_SW, SKERR_HWI_E002, - SKERR_HWI_E002MSG); + SK_ERR_LOG(pAC, SK_ERRCL_SW, SKERR_HWI_E002, SKERR_HWI_E002MSG); #endif RetVal = 4; break; } - SkGeInit2(pAC,IoC) ; + SkGeInit2(pAC, IoC); /* Level 2 successfully passed */ pAC->GIni.GILevel = SK_INIT_RUN; @@ -1715,12 +1811,13 @@ default: /* Create an Error Log Entry */ SK_ERR_LOG(pAC, SK_ERRCL_SW, SKERR_HWI_E003, SKERR_HWI_E003MSG); - RetVal = 3 ; + RetVal = 3; break; } return (RetVal); -} +} /* SkGeInit*/ + /****************************************************************************** * @@ -1740,6 +1837,9 @@ int i; SK_U16 Word; + /* Ensure I2C is ready. */ + SkI2cWaitIrq(pAC, IoC); + /* Stop all current transfer activity */ for (i = 0; i < pAC->GIni.GIMacsFound; i++) { if (pAC->GIni.GP[i].PState != SK_PRT_STOP && @@ -1761,7 +1861,8 @@ /* Do the reset, all LEDs are switched off now */ SK_OUT8(IoC, B0_CTST, CS_RST_SET); -} +} /* SkGeDeInit*/ + /****************************************************************************** * @@ -1795,13 +1896,13 @@ int SkGeInitPort( SK_AC *pAC, /* adapter context */ SK_IOC IoC, /* IO context */ -int Port) /* Port to configure */ +int Port) /* Port to configure */ { SK_GEPORT *pPrt; pPrt = &pAC->GIni.GP[Port]; - if (SkGeCheckQSize(pAC,Port) != 0) { + if (SkGeCheckQSize(pAC, Port) != 0) { SK_ERR_LOG(pAC, SK_ERRCL_SW, SKERR_HWI_E004, SKERR_HWI_E004MSG); return (1); } @@ -1817,8 +1918,8 @@ * If 1000BT Phy needs LED initialization than swap * LED and XMAC initialization order */ - SkGeXmitLED(pAC, IoC, MR_ADDR(Port,TX_LED_INI), SK_LED_ENA); - SkGeXmitLED(pAC, IoC, MR_ADDR(Port,RX_LED_INI), SK_LED_ENA); + SkGeXmitLED(pAC, IoC, MR_ADDR(Port, TX_LED_INI), SK_LED_ENA); + SkGeXmitLED(pAC, IoC, MR_ADDR(Port, RX_LED_INI), SK_LED_ENA); /* The Link LED is initialized by RLMT or Diagnostics itself */ /* Do NOT initialize the Link Sync Counter */ @@ -1844,4 +1945,4 @@ pAC->GIni.GIAnyPortAct = SK_TRUE; return (0); -} +} /* SkGeInitPort */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/sk98lin/skgepnmi.c linux/drivers/net/sk98lin/skgepnmi.c --- v2.4.0-test8/linux/drivers/net/sk98lin/skgepnmi.c Tue Nov 23 22:42:21 1999 +++ linux/drivers/net/sk98lin/skgepnmi.c Fri Sep 15 14:34:19 2000 @@ -2,8 +2,8 @@ * * Name: skgepnmi.c * Project: GEnesis, PCI Gigabit Ethernet Adapter - * Version: $Revision: 1.69 $ - * Date: $Date: 1999/10/18 11:42:15 $ + * Version: $Revision: 1.78 $ + * Date: $Date: 2000/09/12 10:44:58 $ * Purpose: Private Network Management Interface * ****************************************************************************/ @@ -13,8 +13,6 @@ * (C)Copyright 1998,1999 SysKonnect, * a business unit of Schneider & Koch & Co. Datensysteme GmbH. * - * See the file "skge.c" for further information. - * * 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 @@ -29,6 +27,43 @@ * History: * * $Log: skgepnmi.c,v $ + * Revision 1.78 2000/09/12 10:44:58 cgoos + * Fixed SK_PNMI_STORE_U32 calls with typecasted argument. + * + * Revision 1.77 2000/09/07 08:10:19 rwahl + * - Modified algorithm for 64bit NDIS statistic counters; + * returns 64bit or 32bit value depending on passed buffer + * size. Indicate capability for 64bit NDIS counter, if passed + * buffer size is zero. OID_GEN_XMIT_ERROR, OID_GEN_RCV_ERROR, + * and OID_GEN_RCV_NO_BUFFER handled as 64bit counter, too. + * - corrected OID_SKGE_RLMT_PORT_PREFERRED. + * + * Revision 1.76 2000/08/03 15:23:39 rwahl + * - Correction for FrameTooLong counter has to be moved to OID handling + * routines (instead of statistic counter routine). + * - Fix in XMAC Reset Event handling: Only offset counter for hardware + * statistic registers are updated. + * + * Revision 1.75 2000/08/01 16:46:05 rwahl + * - Added StatRxLongFrames counter and correction of FrameTooLong counter. + * - Added directive to control width (default = 32bit) of NDIS statistic + * counters (SK_NDIS_64BIT_CTR). + * + * Revision 1.74 2000/07/04 11:41:53 rwahl + * - Added volition connector type. + * + * Revision 1.73 2000/03/15 16:33:10 rwahl + * Fixed bug 10510; wrong reset of virtual port statistic counters. + * + * Revision 1.72 1999/12/06 16:15:53 rwahl + * Fixed problem of instance range for current and factory MAC address. + * + * Revision 1.71 1999/12/06 10:14:20 rwahl + * Fixed bug 10476; set operation for PHY_OPERATION_MODE. + * + * Revision 1.70 1999/11/22 13:33:34 cgoos + * Changed license header to GPL. + * * Revision 1.69 1999/10/18 11:42:15 rwahl * Added typecasts for checking event dependent param (debug only). * @@ -297,7 +332,8 @@ static const char SysKonnectFileId[] = - "@(#) $Id: skgepnmi.c,v 1.69 1999/10/18 11:42:15 rwahl Exp $ (C) SysKonnect."; + "@(#) $Id: skgepnmi.c,v 1.78 2000/09/12 10:44:58 cgoos Exp $" + " (C) SysKonnect."; #include "h/skdrv1st.h" #include "h/sktypes.h" @@ -982,6 +1018,11 @@ sizeof(SK_PNMI_STAT), SK_PNMI_OFF(Stat) + SK_PNMI_STA_OFF(StatRxUnicastOkCts), SK_PNMI_RO, MacPrivateStat, SK_PNMI_HRX_UNICAST}, + {OID_SKGE_STAT_RX_LONGFRAMES, + SK_PNMI_MAC_ENTRIES, + sizeof(SK_PNMI_STAT), + SK_PNMI_OFF(Stat) + SK_PNMI_STA_OFF(StatRxLongFramesCts), + SK_PNMI_RO, MacPrivateStat, SK_PNMI_HRX_LONGFRAMES}, {OID_SKGE_STAT_RX_PFLOWC, SK_PNMI_MAC_ENTRIES, sizeof(SK_PNMI_STAT), @@ -1197,7 +1238,7 @@ 0, SK_PNMI_MAI_OFF(RlmtPortActive), SK_PNMI_RO, Rlmt, 0}, - {OID_SKGE_RLMT_PORT_PREFERED, + {OID_SKGE_RLMT_PORT_PREFERRED, 1, 0, SK_PNMI_MAI_OFF(RlmtPortPreferred), @@ -1353,7 +1394,8 @@ /* 62 */ {TRUE, XM_RXF_1023B}, /* 63 */ {TRUE, XM_RXF_MAX_SZ}, /* 64 */ {FALSE, 0}, - /* 65 */ {FALSE, 0} + /* 65 */ {FALSE, 0}, + /* 66 */ {TRUE, 0} }; @@ -1520,6 +1562,10 @@ pAC->Pnmi.Connector = 5; break; + case 'V': + pAC->Pnmi.Connector = 6; + break; + default: pAC->Pnmi.Connector = 1; break; @@ -2074,8 +2120,13 @@ case SK_PNMI_HRX_OCTETLOW: case SK_PNMI_HRX_IRLENGTH: case SK_PNMI_HRX_RESERVED22: + + /* + * the following counters aren't be handled (id > 63) + */ case SK_PNMI_HTX_SYNC: case SK_PNMI_HTX_SYNC_OCTET: + case SK_PNMI_HRX_LONGFRAMES: break; default: @@ -2270,7 +2321,7 @@ */ pAC->Pnmi.MacUpdatedFlag ++; - for (CounterIndex = 0; CounterIndex < SK_PNMI_MAX_IDX; + for (CounterIndex = 0; CounterIndex < SK_PNMI_SCNT_NOT; CounterIndex ++) { if (!StatAddress[CounterIndex].GetOffset) { @@ -2985,9 +3036,9 @@ SK_U32 Instance, /* Instance (1..n) that is to be queried or -1 */ unsigned int TableIndex) /* Index to the Id table */ { - int Ret; - SK_U32 StatVal; - + int Ret; + SK_U64 StatVal; + SK_BOOL Is64BitReq = SK_FALSE; /* * Only the active Mac is returned @@ -3022,11 +3073,28 @@ break; default: - if (*pLen < 4) { +#ifndef SK_NDIS_64BIT_CTR + if (*pLen < sizeof(SK_U32)) { + *pLen = sizeof(SK_U32); + return (SK_PNMI_ERR_TOO_SHORT); + } - *pLen = 4; +#else /* SK_NDIS_64BIT_CTR */ + + /* + * for compatibility, at least 32bit are required for oid + */ + if (*pLen < sizeof(SK_U32)) { + /* + * but indicate handling for 64bit values, + * if insufficient space is provided + */ + *pLen = sizeof(SK_U64); return (SK_PNMI_ERR_TOO_SHORT); } + + Is64BitReq = (*pLen < sizeof(SK_U64)) ? SK_FALSE : SK_TRUE; +#endif /* SK_NDIS_64BIT_CTR */ break; } @@ -3059,10 +3127,21 @@ break; default: - StatVal = (SK_U32)GetStatVal(pAC, IoC, 0, - IdTable[TableIndex].Param); - SK_PNMI_STORE_U32(pBuf, StatVal); - *pLen = sizeof(SK_U32); + StatVal = GetStatVal(pAC, IoC, 0, IdTable[TableIndex].Param); + + /* + * by default 32bit values are evaluated + */ + if (!Is64BitReq) { + SK_U32 StatVal32; + StatVal32 = (SK_U32)StatVal; + SK_PNMI_STORE_U32(pBuf, StatVal32); + *pLen = sizeof(SK_U32); + } + else { + SK_PNMI_STORE_U64(pBuf, StatVal); + *pLen = sizeof(SK_U64); + } break; } @@ -3177,6 +3256,20 @@ case OID_SKGE_STAT_RX_UTIL: return (SK_PNMI_ERR_GENERAL); */ + /* + * Frames longer than IEEE 802.3 frame max size are counted + * by XMAC in frame_too_long counter even reception of long + * frames was enabled and the frame was correct. + * So correct the value by subtracting RxLongFrame counter. + */ + case OID_SKGE_STAT_RX_TOO_LONG: + StatVal = GetStatVal(pAC, IoC, LogPortIndex, + IdTable[TableIndex].Param) - + GetStatVal(pAC, IoC, LogPortIndex, + SK_PNMI_HRX_LONGFRAMES); + SK_PNMI_STORE_U64(pBuf + Offset, StatVal); + break; + default: StatVal = GetStatVal(pAC, IoC, LogPortIndex, IdTable[TableIndex].Param); @@ -3245,7 +3338,7 @@ if ((Instance != (SK_U32)(-1))) { - if ((Instance < 1) || (Instance > SKCS_NUM_PROTOCOLS)) { + if ((Instance < 1) || (Instance > LogPortMax)) { *pLen = 0; return (SK_PNMI_ERR_UNKNOWN_INST); @@ -4289,6 +4382,7 @@ SK_U64 Val64; SK_U64 Val64RxHwErrs = 0; SK_U64 Val64TxHwErrs = 0; + SK_BOOL Is64BitReq = SK_FALSE; char Buf[256]; @@ -4315,13 +4409,37 @@ */ switch (Id) { + case OID_GEN_XMIT_ERROR: + case OID_GEN_RCV_ERROR: + case OID_GEN_RCV_NO_BUFFER: +#ifndef SK_NDIS_64BIT_CTR + if (*pLen < sizeof(SK_U32)) { + *pLen = sizeof(SK_U32); + return (SK_PNMI_ERR_TOO_SHORT); + } + +#else /* SK_NDIS_64BIT_CTR */ + + /* + * for compatibility, at least 32bit are required for oid + */ + if (*pLen < sizeof(SK_U32)) { + /* + * but indicate handling for 64bit values, + * if insufficient space is provided + */ + *pLen = sizeof(SK_U64); + return (SK_PNMI_ERR_TOO_SHORT); + } + + Is64BitReq = (*pLen < sizeof(SK_U64)) ? SK_FALSE : SK_TRUE; +#endif /* SK_NDIS_64BIT_CTR */ + break; + case OID_SKGE_PORT_NUMBER: case OID_SKGE_DEVICE_TYPE: case OID_SKGE_RESULT: case OID_SKGE_RLMT_MONITOR_NUMBER: - case OID_GEN_XMIT_ERROR: - case OID_GEN_RCV_ERROR: - case OID_GEN_RCV_NO_BUFFER: case OID_GEN_TRANSMIT_QUEUE_LENGTH: case OID_SKGE_TRAP_NUMBER: case OID_SKGE_MDB_VERSION: @@ -4420,7 +4538,8 @@ GetStatVal(pAC, IoC, 0, SK_PNMI_HRX_SYMBOL) + GetStatVal(pAC, IoC, 0, SK_PNMI_HRX_SHORTS) + GetStatVal(pAC, IoC, 0, SK_PNMI_HRX_RUNT) + - GetStatVal(pAC, IoC, 0, SK_PNMI_HRX_TOO_LONG)+ + GetStatVal(pAC, IoC, 0, SK_PNMI_HRX_TOO_LONG)- + GetStatVal(pAC, IoC, 0, SK_PNMI_HRX_LONGFRAMES)+ GetStatVal(pAC, IoC, 0, SK_PNMI_HRX_FCS) + GetStatVal(pAC, IoC, 0, SK_PNMI_HRX_CEXT); break; @@ -4748,21 +4867,57 @@ break; case OID_GEN_RCV_ERROR: - Val32 = (SK_U32)(Val64RxHwErrs + pAC->Pnmi.RxNoBufCts); - SK_PNMI_STORE_U32(pBuf, Val32); - *pLen = sizeof(SK_U32); + Val64 = Val64RxHwErrs + pAC->Pnmi.RxNoBufCts; + + /* + * by default 32bit values are evaluated + */ + if (!Is64BitReq) { + SK_U32 Val32; + Val32 = (SK_U32)Val64; + SK_PNMI_STORE_U32(pBuf, Val32); + *pLen = sizeof(SK_U32); + } + else { + SK_PNMI_STORE_U64(pBuf, Val64); + *pLen = sizeof(SK_U64); + } break; case OID_GEN_XMIT_ERROR: - Val32 = (SK_U32)(Val64TxHwErrs + pAC->Pnmi.TxNoBufCts); - SK_PNMI_STORE_U32(pBuf, Val32); - *pLen = sizeof(SK_U32); + Val64 = Val64TxHwErrs + pAC->Pnmi.TxNoBufCts; + + /* + * by default 32bit values are evaluated + */ + if (!Is64BitReq) { + SK_U32 Val32; + Val32 = (SK_U32)Val64; + SK_PNMI_STORE_U32(pBuf, Val32); + *pLen = sizeof(SK_U32); + } + else { + SK_PNMI_STORE_U64(pBuf, Val64); + *pLen = sizeof(SK_U64); + } break; case OID_GEN_RCV_NO_BUFFER: - Val32 = (SK_U32)pAC->Pnmi.RxNoBufCts; - SK_PNMI_STORE_U32(pBuf, Val32); - *pLen = sizeof(SK_U32); + Val64 = pAC->Pnmi.RxNoBufCts; + + /* + * by default 32bit values are evaluated + */ + if (!Is64BitReq) { + SK_U32 Val32; + Val32 = (SK_U32)Val64; + SK_PNMI_STORE_U32(pBuf, Val32); + *pLen = sizeof(SK_U32); + } + else { + SK_PNMI_STORE_U64(pBuf, Val64); + *pLen = sizeof(SK_U64); + } break; case OID_GEN_TRANSMIT_QUEUE_LENGTH: @@ -4853,7 +5008,7 @@ case OID_SKGE_RLMT_MODE: case OID_SKGE_RLMT_PORT_ACTIVE: - case OID_SKGE_RLMT_PORT_PREFERED: + case OID_SKGE_RLMT_PORT_PREFERRED: if (*pLen < sizeof(SK_U8)) { *pLen = sizeof(SK_U8); @@ -4941,7 +5096,7 @@ *pLen = sizeof(char); break; - case OID_SKGE_RLMT_PORT_PREFERED: + case OID_SKGE_RLMT_PORT_PREFERRED: *pBuf = (char)SK_PNMI_PORT_PHYS2LOG( pAC->Rlmt.MacPreferred); *pLen = sizeof(char); @@ -5021,7 +5176,7 @@ } break; - case OID_SKGE_RLMT_PORT_PREFERED: + case OID_SKGE_RLMT_PORT_PREFERRED: /* Check if the buffer length is plausible */ if (*pLen < sizeof(char)) { @@ -5622,6 +5777,7 @@ case OID_SKGE_LINK_MODE: case OID_SKGE_FLOWCTRL_MODE: + case OID_SKGE_PHY_OPERATION_MODE: if (*pLen < Limit - LogPortIndex) { *pLen = Limit - LogPortIndex; @@ -5798,6 +5954,82 @@ Offset += sizeof(char); break; + case OID_SKGE_PHY_OPERATION_MODE : + /* Check the value range */ + Val8 = *(pBuf + Offset); + if (Val8 == 0) { + /* mode of this port remains unchanged */ + Offset += sizeof(char); + break; + } + if (Val8 < SK_MS_MODE_AUTO || + Val8 > SK_MS_MODE_SLAVE) { + + *pLen = 0; + return (SK_PNMI_ERR_BAD_VALUE); + } + + /* The preset ends here */ + if (Action == SK_PNMI_PRESET) { + + return (SK_PNMI_ERR_OK); + } + + if (LogPortIndex == 0) { + + /* + * The virtual port consists of all currently + * active ports. Find them and send an event + * with new master/slave (role) mode to SIRQ. + */ + for (PhysPortIndex = 0; + PhysPortIndex < PhysPortMax; + PhysPortIndex ++) { + + if (!pAC->Pnmi.Port[PhysPortIndex]. + ActiveFlag) { + + continue; + } + + EventParam.Para32[0] = PhysPortIndex; + EventParam.Para32[1] = (SK_U32)Val8; + if (SkGeSirqEvent(pAC, IoC, + SK_HWEV_SET_ROLE, + EventParam) > 0) { + + SK_ERR_LOG(pAC, SK_ERRCL_SW, + SK_PNMI_ERR052, + SK_PNMI_ERR052MSG); + + *pLen = 0; + return (SK_PNMI_ERR_GENERAL); + } + } + } + else { + /* + * Send an event with the new master/slave + * (role) mode to the SIRQ module. + */ + EventParam.Para32[0] = SK_PNMI_PORT_LOG2PHYS( + pAC, LogPortIndex); + EventParam.Para32[1] = (SK_U32)Val8; + if (SkGeSirqEvent(pAC, IoC, + SK_HWEV_SET_ROLE, EventParam) > 0) { + + SK_ERR_LOG(pAC, SK_ERRCL_SW, + SK_PNMI_ERR052, + SK_PNMI_ERR052MSG); + + *pLen = 0; + return (SK_PNMI_ERR_GENERAL); + } + } + + Offset += sizeof(char); + break; + default: SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR045, SK_PNMI_ERR045MSG); @@ -6670,6 +6902,12 @@ 32); break; + case SK_PNMI_HRX_LONGFRAMES: + LowVal = (SK_U32)pAC->Pnmi.Port[PhysPortIndex].StatRxLongFrameCts; + HighVal = (SK_U32) + (pAC->Pnmi.Port[PhysPortIndex].StatRxLongFrameCts >> 32); + break; + case SK_PNMI_HRX_FCS: /* * Broadcom filters fcs errors and counts it in @@ -6765,11 +7003,16 @@ SK_MEMSET((char *)&pAC->Pnmi.Port[PhysPortIndex]. StatSyncOctetsCts, 0, sizeof(pAC->Pnmi.Port[ PhysPortIndex].StatSyncOctetsCts)); + SK_MEMSET((char *)&pAC->Pnmi.Port[PhysPortIndex]. + StatRxLongFrameCts, 0, sizeof(pAC->Pnmi.Port[ + PhysPortIndex].StatRxLongFrameCts)); } /* * Clear local statistics */ + SK_MEMSET((char *)&pAC->Pnmi.VirtualCounterOffset, 0, + sizeof(pAC->Pnmi.VirtualCounterOffset)); pAC->Pnmi.RlmtChangeCts = 0; pAC->Pnmi.RlmtChangeTime = 0; SK_MEMSET((char *)&pAC->Pnmi.RlmtChangeEstimate.EstValue[0], 0, diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/sk98lin/skgesirq.c linux/drivers/net/sk98lin/skgesirq.c --- v2.4.0-test8/linux/drivers/net/sk98lin/skgesirq.c Tue Nov 23 22:42:21 1999 +++ linux/drivers/net/sk98lin/skgesirq.c Fri Sep 15 14:34:19 2000 @@ -2,8 +2,8 @@ * * Name: skgesirq.c * Project: GEnesis, PCI Gigabit Ethernet Adapter - * Version: $Revision: 1.46 $ - * Date: $Date: 1999/09/16 10:30:07 $ + * Version: $Revision: 1.55 $ + * Date: $Date: 2000/06/19 08:36:25 $ * Purpose: Special IRQ module * ******************************************************************************/ @@ -13,8 +13,6 @@ * (C)Copyright 1998,1999 SysKonnect, * a business unit of Schneider & Koch & Co. Datensysteme GmbH. * - * See the file "skge.c" for further information. - * * 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 @@ -29,6 +27,34 @@ * History: * * $Log: skgesirq.c,v $ + * Revision 1.55 2000/06/19 08:36:25 cgoos + * Changed comment. + * + * Revision 1.54 2000/05/22 08:45:57 malthoff + * Fix: #10523 is valid for all BCom PHYs. + * + * Revision 1.53 2000/05/19 10:20:30 cgoos + * Removed Solaris debug output code. + * + * Revision 1.52 2000/05/19 10:19:37 cgoos + * Added PHY state check in HWLinkDown. + * Move PHY interrupt code to IS_EXT_REG case in SkGeSirqIsr. + * + * Revision 1.51 2000/05/18 05:56:20 cgoos + * Fixed typo. + * + * Revision 1.50 2000/05/17 12:49:49 malthoff + * Fixes BCom link bugs (#10523). + * + * Revision 1.49 1999/12/17 11:02:50 gklug + * fix: read PHY_STAT of Broadcom chip more often to assure good status + * + * Revision 1.48 1999/12/06 10:01:17 cgoos + * Added SET function for Role. + * + * Revision 1.47 1999/11/22 13:34:24 cgoos + * Changed license header to GPL. + * * Revision 1.46 1999/09/16 10:30:07 cgoos * Removed debugging output statement from Linux. * @@ -215,7 +241,7 @@ */ static const char SysKonnectFileId[] = - "$Id: skgesirq.c,v 1.46 1999/09/16 10:30:07 cgoos Exp $" ; + "$Id: skgesirq.c,v 1.55 2000/06/19 08:36:25 cgoos Exp $" ; #include "h/skdrv1st.h" /* Driver Specific Definitions */ #include "h/skgepnmi.h" /* PNMI Definitions */ @@ -385,6 +411,15 @@ /* disable all PHY interrupts */ switch (pAC->GIni.GP[Port].PhyType) { case SK_PHY_BCOM: + /* make sure that PHY is initialized */ + if (pAC->GIni.GP[Port].PState) { + /* Workaround BCOM Errata (#10523) all BCom */ + /* Disable Power Management if link is down */ + PHY_READ(IoC, pPrt, Port, PHY_BCOM_AUX_CTRL, + &Word); + PHY_WRITE(IoC, pPrt, Port, PHY_BCOM_AUX_CTRL, + Word | PHY_B_AC_DIS_PM); + } PHY_WRITE(IoC, pPrt, Port, PHY_BCOM_INT_MASK, 0xffff); break; @@ -766,12 +801,11 @@ } /* - * I2C Ready interrupt + * external reg interrupt */ - if (Istatus & IS_I2C_READY) { + if (Istatus & IS_EXT_REG) { SK_U16 PhyInt; SK_U16 PhyIMsk; - SK_BOOL IsPhyInt = SK_FALSE; int i; /* test IRQs from PHY */ for (i=0; iGIni.GIMacsFound; i++) { @@ -794,7 +828,6 @@ SkPhyIsrBcom(pAC, IoC, i, (SK_U16) (PhyInt & (~PhyIMsk))); - IsPhyInt = SK_TRUE; } } else { @@ -814,7 +847,6 @@ i, PhyInt, PhyIMsk)); SkPhyIsrLone(pAC, IoC, i, (SK_U16) (PhyInt & PhyIMsk)); - IsPhyInt = SK_TRUE; } break; case SK_PHY_NAT: @@ -822,9 +854,13 @@ break; } } - if (!IsPhyInt) { - SkI2cIsr(pAC, IoC); - } + } + + /* + * I2C Ready interrupt + */ + if (Istatus & IS_I2C_READY) { + SkI2cIsr(pAC, IoC); } if (Istatus & IS_LNK_SYNC_M1) { @@ -1328,8 +1364,23 @@ SK_U16 PhyStat; /* Phy Status Register */ int Done; SK_U16 ResAb; + SK_U16 SWord; pPrt = &pAC->GIni.GP[Port]; + + /* Check for No HCD Link events (#10523) */ + PHY_READ(IoC, pPrt, Port, PHY_BCOM_INT_STAT, &Isrc); + if ((Isrc & PHY_B_IS_NO_HDCL) == PHY_B_IS_NO_HDCL) { + + /* Workaround BCOM Errata */ + /* enable and disable Loopback mode if NO HCD occurs */ + PHY_READ(IoC, pPrt, Port, PHY_BCOM_CTRL, &SWord); + PHY_WRITE(IoC, pPrt, Port, PHY_BCOM_CTRL, SWord | PHY_CT_LOOP); + PHY_WRITE(IoC, pPrt, Port, PHY_BCOM_CTRL, SWord & ~PHY_CT_LOOP); + SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL, + ("No HCD Link event, Port %d\n", Port)); + } + PHY_READ(IoC, pPrt, Port, PHY_BCOM_STAT, &PhyStat); if (pPrt->PHWLinkUp) { @@ -1338,7 +1389,7 @@ pPrt->PIsave = 0; - /* Now wait for each ports link */ + /* Now wait for each port's link */ if (pPrt->PLinkMode == SK_LMODE_HALF || pPrt->PLinkMode == SK_LMODE_FULL) { AutoNeg = SK_FALSE; @@ -1355,13 +1406,43 @@ PHY_READ(IoC, pPrt, Port, PHY_BCOM_STAT, &PhyStat); SkXmAutoNegLipaBcom(pAC, IoC, Port, PhyStat); - if ((PhyStat & PHY_ST_LSYNC) == 0){ - return(SK_HW_PS_NONE) ; + + SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL, + ("AutoNeg:%d, PhyStat: %Xh.\n", AutoNeg, PhyStat)); + + PHY_READ(IoC, pPrt, Port, PHY_BCOM_1000T_STAT, &ResAb); + + if ((PhyStat & PHY_ST_LSYNC) == 0) { + if (ResAb & (PHY_B_1000S_MSF)) { + /* Error */ + SK_DBG_MSG(pAC,SK_DBGMOD_HWM,SK_DBGCAT_CTRL, + ("Master/Slave Fault port %d\n", Port)); + pPrt->PAutoNegFail = SK_TRUE; + pPrt->PMSStatus = SK_MS_STAT_FAULT; + return (SK_AND_OTHER); + } + return (SK_HW_PS_NONE); + } + + if (ResAb & (PHY_B_1000S_MSF)) { + /* Error */ + SK_DBG_MSG(pAC,SK_DBGMOD_HWM,SK_DBGCAT_CTRL, + ("Master/Slave Fault port %d\n", Port)); + pPrt->PAutoNegFail = SK_TRUE; + pPrt->PMSStatus = SK_MS_STAT_FAULT; + return (SK_AND_OTHER); + } else if (ResAb & PHY_B_1000S_MSR) { + pPrt->PMSStatus = SK_MS_STAT_MASTER; + } else { + pPrt->PMSStatus = SK_MS_STAT_SLAVE; } + + SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL, + ("AutoNeg:%d, PhyStat: %Xh.\n", AutoNeg, PhyStat)); if (AutoNeg) { if (PhyStat & PHY_ST_AN_OVER) { - SkHWLinkUp(pAC, IoC, Port) ; + SkHWLinkUp(pAC, IoC, Port); Done = SkXmAutoNegDone(pAC,IoC,Port); if (Done != SK_AND_OK) { /* Get PHY parameters, for debuging only */ @@ -1400,6 +1481,8 @@ Port)); } #endif + +#if 0 PHY_READ(IoC, pPrt, Port, PHY_BCOM_1000T_STAT, &ResAb); if (ResAb & (PHY_B_1000S_MSF)) { /* Error */ @@ -1413,6 +1496,7 @@ } else { pPrt->PMSStatus = SK_MS_STAT_SLAVE ; } +#endif /* 0 */ /* @@ -1753,6 +1837,18 @@ if (pAC->GIni.GP[Port].PFlowCtrlMode != Val8) { /* Set New Flow Control mode */ pAC->GIni.GP[Port].PFlowCtrlMode = Val8; + + /* Restart Port */ + SkEventQueue(pAC, SKGE_HWAC, SK_HWEV_PORT_STOP, Para); + SkEventQueue(pAC, SKGE_HWAC, SK_HWEV_PORT_START, Para); + } + break; + + case SK_HWEV_SET_ROLE: + Val8 = (SK_U8) Para.Para32[1]; + if (pAC->GIni.GP[Port].PMSMode != Val8) { + /* Set New link mode */ + pAC->GIni.GP[Port].PMSMode = Val8; /* Restart Port */ SkEventQueue(pAC, SKGE_HWAC, SK_HWEV_PORT_STOP, Para); diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/sk98lin/ski2c.c linux/drivers/net/sk98lin/ski2c.c --- v2.4.0-test8/linux/drivers/net/sk98lin/ski2c.c Tue Nov 23 22:42:21 1999 +++ linux/drivers/net/sk98lin/ski2c.c Fri Sep 15 14:34:19 2000 @@ -2,8 +2,8 @@ * * Name: ski2c.c * Project: GEnesis, PCI Gigabit Ethernet Adapter - * Version: $Revision: 1.41 $ - * Date: $Date: 1999/09/14 14:11:30 $ + * Version: $Revision: 1.44 $ + * Date: $Date: 2000/08/07 15:49:03 $ * Purpose: Funktions to access Voltage and Temperature Sensor * (taken from Monalisa (taken from Concentrator)) * @@ -11,11 +11,9 @@ /****************************************************************************** * - * (C)Copyright 1998,1999 SysKonnect, + * (C)Copyright 1998-2000 SysKonnect, * a business unit of Schneider & Koch & Co. Datensysteme GmbH. * - * See the file "skge.c" for further information. - * * 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 @@ -30,6 +28,16 @@ * History: * * $Log: ski2c.c,v $ + * Revision 1.44 2000/08/07 15:49:03 gklug + * fix: SK_INFAST only in NetWare driver + * + * Revision 1.43 2000/08/03 14:28:17 rassmann + * - Added function to wait for I2C being ready before resetting the board. + * - Replaced one duplicate "out of range" message with correct one. + * + * Revision 1.42 1999/11/22 13:35:12 cgoos + * Changed license header to GPL. + * * Revision 1.41 1999/09/14 14:11:30 malthoff * The 1000BT Dual Link adapter has got only one Fan. * The second Fan has been removed. @@ -172,10 +180,10 @@ /* - i2C Protocol + I2C Protocol */ static const char SysKonnectFileId[] = - "$Id: ski2c.c,v 1.41 1999/09/14 14:11:30 malthoff Exp $" ; + "$Id: ski2c.c,v 1.44 2000/08/07 15:49:03 gklug Exp $"; #include "h/skdrv1st.h" /* Driver Specific Definitions */ #include "h/lm80.h" @@ -193,9 +201,9 @@ This file covers functions that allow to read write and do some bulk requests a specified I2C address. - The Genesis has 2 I2C busses. One for the EEPROM which holds + The Genesis has 2 I2C buses. One for the EEPROM which holds the VPD Data and one for temperature and voltage sensor. - The following picture shows the I2C busses, I2C devices and + The following picture shows the I2C buses, I2C devices and there control registers. Note: The VPD functions are in skvpd.c @@ -292,13 +300,13 @@ * serial data line simultaneously (ASIC: last bit of a byte = '1', I2C client * send an 'ACK'). See also Concentrator Bugreport No. 10192. */ -#define I2C_DATA_HIGH(IoC) SK_I2C_SET_BIT(IoC,I2C_DATA) -#define I2C_DATA_LOW(IoC) SK_I2C_CLR_BIT(IoC,I2C_DATA) -#define I2C_DATA_OUT(IoC) SK_I2C_SET_BIT(IoC,I2C_DATA_DIR) -#define I2C_DATA_IN(IoC) SK_I2C_CLR_BIT(IoC,I2C_DATA_DIR|I2C_DATA) -#define I2C_CLK_HIGH(IoC) SK_I2C_SET_BIT(IoC,I2C_CLK) -#define I2C_CLK_LOW(IoC) SK_I2C_CLR_BIT(IoC,I2C_CLK|I2C_DATA_DIR) -#define I2C_START_COND(IoC) SK_I2C_CLR_BIT(IoC,I2C_CLK) +#define I2C_DATA_HIGH(IoC) SK_I2C_SET_BIT(IoC, I2C_DATA) +#define I2C_DATA_LOW(IoC) SK_I2C_CLR_BIT(IoC, I2C_DATA) +#define I2C_DATA_OUT(IoC) SK_I2C_SET_BIT(IoC, I2C_DATA_DIR) +#define I2C_DATA_IN(IoC) SK_I2C_CLR_BIT(IoC, I2C_DATA_DIR|I2C_DATA) +#define I2C_CLK_HIGH(IoC) SK_I2C_SET_BIT(IoC, I2C_CLK) +#define I2C_CLK_LOW(IoC) SK_I2C_CLR_BIT(IoC, I2C_CLK|I2C_DATA_DIR) +#define I2C_START_COND(IoC) SK_I2C_CLR_BIT(IoC, I2C_CLK) #define NS2CLKT(x) ((x*125L)/10000) @@ -308,25 +316,24 @@ * sending one bit */ void SkI2cSndBit( -SK_IOC IoC, /* IoContext */ +SK_IOC IoC, /* I/O Context */ SK_U8 Bit) /* Bit to send */ { - I2C_DATA_OUT(IoC) ; + I2C_DATA_OUT(IoC); if (Bit) { I2C_DATA_HIGH(IoC); } else { I2C_DATA_LOW(IoC); } - SkDgWaitTime(IoC,NS2BCLK(T_DATA_IN_SETUP)); + SkDgWaitTime(IoC, NS2BCLK(T_DATA_IN_SETUP)); I2C_CLK_HIGH(IoC); - SkDgWaitTime(IoC,NS2BCLK(T_CLK_HIGH)); + SkDgWaitTime(IoC, NS2BCLK(T_CLK_HIGH)); I2C_CLK_LOW(IoC); -} - +} /* SkI2cSndBit*/ /* - * Signal a start to the i2C Bus. + * Signal a start to the I2C Bus. * * A start is signaled when data goes to low in a high clock cycle. * @@ -334,66 +341,70 @@ * * Status: not tested */ -void SkI2cStart(SK_IOC IoC) /* I/O Context */ +void SkI2cStart( +SK_IOC IoC) /* I/O Context */ { /* Init data and Clock to output lines */ /* Set Data high */ - I2C_DATA_OUT(IoC) ; - I2C_DATA_HIGH(IoC) ; + I2C_DATA_OUT(IoC); + I2C_DATA_HIGH(IoC); /* Set Clock high */ - I2C_CLK_HIGH(IoC) ; + I2C_CLK_HIGH(IoC); - SkDgWaitTime(IoC,NS2BCLK(T_START_SETUP)) ; + SkDgWaitTime(IoC, NS2BCLK(T_START_SETUP)); /* Set Data Low */ - I2C_DATA_LOW(IoC) ; + I2C_DATA_LOW(IoC); - SkDgWaitTime(IoC,NS2BCLK(T_START_HOLD)) ; + SkDgWaitTime(IoC, NS2BCLK(T_START_HOLD)); /* Clock low without Data to Input */ - I2C_START_COND(IoC) ; + I2C_START_COND(IoC); - SkDgWaitTime(IoC,NS2BCLK(T_CLK_LOW)) ; -} + SkDgWaitTime(IoC, NS2BCLK(T_CLK_LOW)); +} /* SkI2cStart */ -void SkI2cStop(SK_IOC IoC) /* I/O Context */ +void SkI2cStop( +SK_IOC IoC) /* I/O Context */ { /* Init data and Clock to output lines */ /* Set Data low */ - I2C_DATA_OUT(IoC) ; - I2C_DATA_LOW(IoC) ; + I2C_DATA_OUT(IoC); + I2C_DATA_LOW(IoC); - SkDgWaitTime(IoC,NS2BCLK(T_CLK_2_DATA_OUT)) ; + SkDgWaitTime(IoC, NS2BCLK(T_CLK_2_DATA_OUT)); /* Set Clock high */ - I2C_CLK_HIGH(IoC) ; + I2C_CLK_HIGH(IoC); - SkDgWaitTime(IoC,NS2BCLK(T_STOP_SETUP)) ; + SkDgWaitTime(IoC, NS2BCLK(T_STOP_SETUP)); /* * Set Data High: Do it by setting the Data Line to Input. * Because of a pull up resistor the Data Line * floods to high. */ - I2C_DATA_IN(IoC) ; + I2C_DATA_IN(IoC); /* * When I2C activity is stopped * o DATA should be set to input and * o CLOCK should be set to high! */ - SkDgWaitTime(IoC,NS2BCLK(T_BUS_IDLE)) ; -} + SkDgWaitTime(IoC, NS2BCLK(T_BUS_IDLE)); +} /* SkI2cStop */ + /* - * Receive just one bit via the i2C bus. + * Receive just one bit via the I2C bus. * * Note: Clock must be set to LOW before calling this function. * * Returns The received bit. */ -int SkI2cRcvBit(SK_IOC IoC) /* I/O Context */ +int SkI2cRcvBit( +SK_IOC IoC) /* I/O Context */ { int Bit; SK_U8 I2cSwCtrl; @@ -401,13 +412,13 @@ /* Init data as input line */ I2C_DATA_IN(IoC); - SkDgWaitTime(IoC,NS2BCLK(T_CLK_2_DATA_OUT)) ; + SkDgWaitTime(IoC, NS2BCLK(T_CLK_2_DATA_OUT)); I2C_CLK_HIGH(IoC); - SkDgWaitTime(IoC,NS2BCLK(T_CLK_HIGH)) ; + SkDgWaitTime(IoC, NS2BCLK(T_CLK_HIGH)); - SK_I2C_GET_SW(IoC,&I2cSwCtrl) ; + SK_I2C_GET_SW(IoC, &I2cSwCtrl); if (I2cSwCtrl & I2C_DATA) { Bit = 1; } else { @@ -415,10 +426,11 @@ } I2C_CLK_LOW(IoC); - SkDgWaitTime(IoC,NS2BCLK(T_CLK_LOW-T_CLK_2_DATA_OUT)) ; + SkDgWaitTime(IoC, NS2BCLK(T_CLK_LOW-T_CLK_2_DATA_OUT)); return(Bit); -} +} /* SkI2cRcvBit */ + /* * Receive an ACK. @@ -426,58 +438,64 @@ * returns 0 If acknoledged * 1 in case of an error */ -int SkI2cRcvAck(SK_IOC IoC) /* I/O Context */ +int SkI2cRcvAck( +SK_IOC IoC) /* I/O Context */ { /* * Received bit must be zero. */ - return (SkI2cRcvBit(IoC) != 0) ; -} + return (SkI2cRcvBit(IoC) != 0); +} /* SkI2cRcvAck */ + /* * Send an NACK. */ -void SkI2cSndNAck(SK_IOC IoC) /* I/O Context */ +void SkI2cSndNAck( +SK_IOC IoC) /* I/O Context */ { /* * Received bit must be zero. */ - SkI2cSndBit(IoC,1) ; -} + SkI2cSndBit(IoC, 1); +} /* SkI2cSndNAck */ + /* * Send an ACK. */ -void SkI2cSndAck(SK_IOC IoC) /* I/O Context */ +void SkI2cSndAck( +SK_IOC IoC) /* I/O Context */ { /* * Received bit must be zero. * */ - SkI2cSndBit(IoC,0) ; -} + SkI2cSndBit(IoC, 0); +} /* SkI2cSndAck */ + /* - * Send one byte to the i2C device and wait for ACK. + * Send one byte to the I2C device and wait for ACK. * * Return acknoleged status. */ int SkI2cSndByte( SK_IOC IoC, /* I/O Context */ -int Byte) /* byte to send */ +int Byte) /* byte to send */ { int i; for (i=0; i<8; i++) { if (Byte & (1<<(7-i))) { - SkI2cSndBit(IoC,1) ; + SkI2cSndBit(IoC, 1); } else { - SkI2cSndBit(IoC,0) ; + SkI2cSndBit(IoC, 0); } } - return(SkI2cRcvAck(IoC)) ; -} + return(SkI2cRcvAck(IoC)); +} /* SkI2cSndByte */ /* @@ -487,24 +505,24 @@ */ int SkI2cRcvByte( SK_IOC IoC, /* I/O Context */ -int Last) /* Last Byte Flag */ +int Last) /* Last Byte Flag */ { int i; int Byte = 0; for (i=0; i<8; i++) { - Byte <<= 1 ; - Byte |= SkI2cRcvBit(IoC) ; + Byte <<= 1; + Byte |= SkI2cRcvBit(IoC); } if (Last) { - SkI2cSndNAck(IoC) ; + SkI2cSndNAck(IoC); } else { - SkI2cSndAck(IoC) ; + SkI2cSndAck(IoC); } - return(Byte) ; -} + return(Byte); +} /* SkI2cRcvByte */ /* @@ -514,68 +532,106 @@ */ int SkI2cSndDev( SK_IOC IoC, /* I/O Context */ -int Addr, /* Device Address */ -int Rw) /* Read / Write Flag */ +int Addr, /* Device Address */ +int Rw) /* Read / Write Flag */ { - SkI2cStart(IoC) ; - Rw = ~Rw ; - Rw &= I2C_WRITE ; - return(SkI2cSndByte(IoC, (Addr<<1) | Rw)) ; -} + SkI2cStart(IoC); + Rw = ~Rw; + Rw &= I2C_WRITE; + return(SkI2cSndByte(IoC, (Addr<<1) | Rw)); +} /* SkI2cSndDev */ #endif /* SK_DIAG */ /*----------------- I2C CTRL Register Functions ----------*/ /* - * waits for a completetion of a I2C transfer + * waits for a completion of an I2C transfer * * returns 0: success, transfer completes - * 1: error, transfer does not complete, I2C transfer - * killed, wait loop terminated. + * 1: error, transfer does not complete, I2C transfer + * killed, wait loop terminated. */ int SkI2cWait( SK_AC *pAC, /* Adapter Context */ -SK_IOC IoC, /* IoContext */ -int Event) /* complete event to wait for (I2C_READ or I2C_WRITE) */ +SK_IOC IoC, /* I/O Context */ +int Event) /* complete event to wait for (I2C_READ or I2C_WRITE) */ +{ + SK_U64 StartTime; + SK_U32 I2cCtrl; + + StartTime = SkOsGetTime(pAC); + do { + if (SkOsGetTime(pAC) - StartTime > SK_TICKS_PER_SEC / 8) { + SK_I2C_STOP(IoC); +#ifndef SK_DIAG + SK_ERR_LOG(pAC, SK_ERRCL_SW, SKERR_I2C_E002, SKERR_I2C_E002MSG); +#endif /* !SK_DIAG */ + return(1); + } + SK_I2C_GET_CTL(IoC, &I2cCtrl); + } while ((I2cCtrl & I2C_FLAG) == (SK_U32)Event << 31); + + return(0); +} /* SkI2cWait */ + + +/* + * waits for a completion of an I2C transfer + * + * Returns + * Nothing + */ +void SkI2cWaitIrq( +SK_AC *pAC, /* Adapter Context */ +SK_IOC IoC) /* I/O Context */ { - SK_U64 StartTime ; - SK_U32 I2cCtrl ; + SK_SENSOR *pSen; + SK_U64 StartTime; + SK_U32 IrqSrc; - StartTime = SkOsGetTime(pAC) ; + pSen = &pAC->I2c.SenTable[pAC->I2c.CurrSens]; + + if (pSen->SenState == SK_SEN_IDLE) { + return; + } + + StartTime = SkOsGetTime(pAC); do { - if (SkOsGetTime(pAC) - StartTime > SK_TICKS_PER_SEC/16) { - SK_I2C_STOP(IoC) ; + if (SkOsGetTime(pAC) - StartTime > SK_TICKS_PER_SEC / 8) { + SK_I2C_STOP(IoC); #ifndef SK_DIAG - SK_ERR_LOG(pAC, SK_ERRCL_SW, SKERR_I2C_E002, - SKERR_I2C_E002MSG) ; + SK_ERR_LOG(pAC, SK_ERRCL_SW, SKERR_I2C_E002, SKERR_I2C_E002MSG); #endif /* !SK_DIAG */ - return(1) ; + return; } - SK_I2C_GET_CTL(IoC,&I2cCtrl) ; - } while((I2cCtrl & I2C_FLAG) == (SK_U32)Event << 31) ; + SK_IN32(pAC, B0_ISRC, &IrqSrc); + } while ((IrqSrc & IS_I2C_READY) == 0); - return(0) ; -} + return; +} /* SkI2cWaitIrq */ #ifdef SK_DIAG + /* * writes a single byte or 4 bytes into the I2C device * * returns 0: success - * 1: error + * 1: error */ int SkI2cWrite( -SK_AC *pAC, /* Adapter Context */ +SK_AC *pAC, /* Adapter Context */ +SK_IOC IoC, /* I/O Context */ SK_U32 I2cData, /* I2C Data to write */ -int I2cDev, /* I2C Device Address */ -int I2cReg, /* I2C Device Register Address */ -int I2cBurst) /* I2C Burst Flag ( 0 || I2C_BURST ) */ -{ - SK_OUT32(pAC,B2_I2C_DATA,I2cData) ; - SK_I2C_CTL(pAC,I2C_WRITE,I2cDev,I2cReg,I2cBurst); - return(SkI2cWait(pAC,pAC,I2C_WRITE)) ; -} +int I2cDev, /* I2C Device Address */ +int I2cReg, /* I2C Device Register Address */ +int I2cBurst) /* I2C Burst Flag ( 0 || I2C_BURST ) */ +{ + SK_OUT32(IoC, B2_I2C_DATA, I2cData); + SK_I2C_CTL(IoC, I2C_WRITE, I2cDev, I2cReg, I2cBurst); + return(SkI2cWait(pAC, IoC, I2C_WRITE)); +} /* SkI2cWrite*/ + /* * reads a single byte or 4 bytes from the I2C device @@ -583,39 +639,42 @@ * returns the word read */ SK_U32 SkI2cRead( -SK_AC *pAC, /* Adapter Context */ -int I2cDev, /* I2C Device Address */ -int I2cReg, /* I2C Device Register Address */ -int I2cBurst) /* I2C Burst Flag ( 0 || I2C_BURST ) */ -{ - SK_U32 Data ; - - SK_OUT32(pAC,B2_I2C_DATA,0) ; - SK_I2C_CTL(pAC,I2C_READ,I2cDev,I2cReg,I2cBurst); - if (SkI2cWait(pAC,pAC,I2C_READ)) { - w_print("I2c Transfer Timeout!\n"); - } - SK_IN32(pAC,B2_I2C_DATA,&Data) ; - return(Data) ; -} +SK_AC *pAC, /* Adapter Context */ +SK_IOC IoC, /* I/O Context */ +int I2cDev, /* I2C Device Address */ +int I2cReg, /* I2C Device Register Address */ +int I2cBurst) /* I2C Burst Flag ( 0 || I2C_BURST ) */ +{ + SK_U32 Data; + + SK_OUT32(IoC, B2_I2C_DATA, 0); + SK_I2C_CTL(IoC, I2C_READ, I2cDev, I2cReg, I2cBurst); + if (SkI2cWait(pAC, IoC, I2C_READ)) { + w_print("I2C Transfer Timeout!\n"); + } + SK_IN32(IoC, B2_I2C_DATA, &Data); + return(Data); +} /* SkI2cRead */ + #endif /* SK_DIAG */ + /* - * read a sensors value + * read a sensor's value * - * This function read a sensors value from the I2c sensor chip. The sensor + * This function read a sensors value from the I2C sensor chip. The sensor * is defined by its index into the sensors database in the struct pAC points * to. * Returns 1 if the read is completed - * 0 if the read must be continued (I2c Bus still allocated) + * 0 if the read must be continued (I2C Bus still allocated) */ int SkI2cReadSensor( SK_AC *pAC, /* Adapter Context */ -SK_IOC IoC, /* IoContext */ +SK_IOC IoC, /* I/O Context */ SK_SENSOR *pSen) /* Sensor to be read */ { - return((*pSen->SenRead)(pAC,IoC,pSen)) ; -} + return((*pSen->SenRead)(pAC, IoC, pSen)); +} /* SkI2cReadSensor*/ /* * Do the Init state 0 initialization @@ -639,7 +698,7 @@ for (i=0; i < SK_MAX_SENSORS; i ++) { switch (i) { case 0: - pAC->I2c.SenTable[i].SenDesc = "Temperature" ; + pAC->I2c.SenTable[i].SenDesc = "Temperature"; pAC->I2c.SenTable[i].SenType = SK_SEN_TEMP; pAC->I2c.SenTable[i].SenThreErrHigh = SK_SEN_ERRHIGH0; pAC->I2c.SenTable[i].SenThreErrLow = SK_SEN_ERRLOW0; @@ -733,10 +792,11 @@ pAC->I2c.SenTable[i].SenDev = LM80_ADDR; } - /* Now we are INIT dataed */ + /* Now we are "INIT data"ed */ pAC->I2c.InitLevel = SK_INIT_DATA; return(0); -} +} /* SkI2cInit0*/ + /* * Do the init state 1 initialization @@ -760,7 +820,7 @@ */ static int SkI2cInit1( SK_AC *pAC, /* Adapter Context */ -SK_IOC IoC) /* IoContext needed in level 1 */ +SK_IOC IoC) /* I/O Context */ { if (pAC->I2c.InitLevel != SK_INIT_DATA) { /* ReInit not needed in I2C module */ @@ -769,27 +829,27 @@ SK_OUT32(IoC, B2_I2C_DATA, 0); SK_I2C_CTL(IoC, I2C_WRITE, LM80_ADDR, LM80_CFG, 0); - (void)SkI2cWait(pAC, IoC, I2C_WRITE) ; + (void)SkI2cWait(pAC, IoC, I2C_WRITE); SK_OUT32(IoC, B2_I2C_DATA, 0xff); SK_I2C_CTL(IoC, I2C_WRITE, LM80_ADDR, LM80_IMSK_1, 0); - (void)SkI2cWait(pAC, IoC, I2C_WRITE) ; + (void)SkI2cWait(pAC, IoC, I2C_WRITE); SK_OUT32(IoC, B2_I2C_DATA, 0xff); SK_I2C_CTL(IoC, I2C_WRITE, LM80_ADDR, LM80_IMSK_2, 0); - (void)SkI2cWait(pAC, IoC, I2C_WRITE) ; + (void)SkI2cWait(pAC, IoC, I2C_WRITE); SK_OUT32(IoC, B2_I2C_DATA, 0x0); SK_I2C_CTL(IoC, I2C_WRITE, LM80_ADDR, LM80_FAN_CTRL, 0); - (void)SkI2cWait(pAC, IoC, I2C_WRITE) ; + (void)SkI2cWait(pAC, IoC, I2C_WRITE); SK_OUT32(IoC, B2_I2C_DATA, 0); SK_I2C_CTL(IoC, I2C_WRITE, LM80_ADDR, LM80_TEMP_CTRL, 0); - (void)SkI2cWait(pAC, IoC, I2C_WRITE) ; + (void)SkI2cWait(pAC, IoC, I2C_WRITE); SK_OUT32(IoC, B2_I2C_DATA, LM80_CFG_START); SK_I2C_CTL(IoC, I2C_WRITE, LM80_ADDR, LM80_CFG, 0); - (void)SkI2cWait(pAC, IoC, I2C_WRITE) ; + (void)SkI2cWait(pAC, IoC, I2C_WRITE); /* * MaxSens has to be initialized here, because PhyType is not @@ -820,14 +880,15 @@ /* Now we are IO initialized */ pAC->I2c.InitLevel = SK_INIT_IO; return(0); -} +} /* SkI2cInit1 */ + /* * Init level 2: Start first sensors read */ static int SkI2cInit2( SK_AC *pAC, /* Adapter Context */ -SK_IOC IoC) /* IoContext needed in level 1 */ +SK_IOC IoC) /* I/O Context */ { int ReadComplete; SK_SENSOR *pSen; @@ -839,18 +900,18 @@ } pSen = &pAC->I2c.SenTable[pAC->I2c.CurrSens]; - ReadComplete = SkI2cReadSensor(pAC,IoC,pSen); + ReadComplete = SkI2cReadSensor(pAC, IoC, pSen); if (ReadComplete) { - SK_ERR_LOG(pAC, SK_ERRCL_INIT, SKERR_I2C_E008, - SKERR_I2C_E008MSG); + SK_ERR_LOG(pAC, SK_ERRCL_INIT, SKERR_I2C_E008, SKERR_I2C_E008MSG); } /* Now we are correctly initialized */ pAC->I2c.InitLevel = SK_INIT_RUN; return(0); -} +} /* SkI2cInit2*/ + /* * Initialize I2C devices @@ -871,27 +932,29 @@ */ int SkI2cInit( SK_AC *pAC, /* Adapter Context */ -SK_IOC IoC, /* IoContext needed in level 1 */ -int Level) /* Init Level */ +SK_IOC IoC, /* I/O Context needed in levels 1 and 2 */ +int Level) /* Init Level */ { switch (Level) { case SK_INIT_DATA: - return(SkI2cInit0(pAC)) ; + return(SkI2cInit0(pAC)); case SK_INIT_IO: - return(SkI2cInit1(pAC, IoC)) ; + return(SkI2cInit1(pAC, IoC)); case SK_INIT_RUN: - return(SkI2cInit2(pAC, IoC)) ; + return(SkI2cInit2(pAC, IoC)); default: break; } - return(0) ; -} + return(0); +} /* SkI2cInit */ + #ifndef SK_DIAG + /* - * Interrupt service function for the I2c Interface + * Interrupt service function for the I2C Interface * * Clears the Interrupt source * @@ -900,23 +963,24 @@ * Starts the timer if necessary. */ void SkI2cIsr( -SK_AC *pAC, /* Adapters context */ -SK_IOC IoC) /* Io Context */ +SK_AC *pAC, /* Adapter Context */ +SK_IOC IoC) /* I/O Context */ { SK_EVPARA Para; /* Clear the interrupt source */ - SK_OUT32(IoC, B2_I2C_IRQ, I2C_CLR_IRQ) ; + SK_OUT32(IoC, B2_I2C_IRQ, I2C_CLR_IRQ); Para.Para64 = 0; SkEventQueue(pAC, SKGE_I2C, SK_I2CEV_IRQ, Para); -} +} /* SkI2cIsr */ + /* * Check this sensors Value against the threshold and send events. */ static void SkI2cCheckSensor( -SK_AC *pAC, /* Adapters context */ +SK_AC *pAC, /* Adapter Context */ SK_SENSOR *pSen) { SK_EVPARA ParaLocal; @@ -929,12 +993,12 @@ /* Check Dummy Reads first */ if (pAC->I2c.DummyReads > 0) { - pAC->I2c.DummyReads -- ; + pAC->I2c.DummyReads --; return; } /* Get the current time */ - CurrTime = SkOsGetTime(pAC) ; + CurrTime = SkOsGetTime(pAC); /* Set para to the most usefull setting: * The current sensor. @@ -943,17 +1007,17 @@ /* Check the Value against the thresholds */ /* First: Error Thresholds */ - TooHigh = (pSen->SenValue > pSen->SenThreErrHigh) ; - TooLow = (pSen->SenValue < pSen->SenThreErrLow) ; + TooHigh = (pSen->SenValue > pSen->SenThreErrHigh); + TooLow = (pSen->SenValue < pSen->SenThreErrLow); - IsError = SK_FALSE ; + IsError = SK_FALSE; if (TooHigh || TooLow) { - /* Error condition is satiesfied */ + /* Error condition is satisfied */ DoTrapSend = SK_TRUE; DoErrLog = SK_TRUE; /* Now error condition is satisfied */ - IsError = SK_TRUE ; + IsError = SK_TRUE; if (pSen->SenErrFlag == SK_SEN_ERR_ERR) { /* This state is the former one */ @@ -981,7 +1045,7 @@ /* We came from a different state */ /* -> Set Begin Time Stamp */ pSen->SenBegErrTS = CurrTime; - pSen->SenErrFlag = SK_SEN_ERR_ERR ; + pSen->SenErrFlag = SK_SEN_ERR_ERR; } if (DoTrapSend) { @@ -993,7 +1057,7 @@ SkEventQueue(pAC, SKGE_PNMI, (TooHigh ? SK_PNMI_EVT_SEN_ERR_UPP : SK_PNMI_EVT_SEN_ERR_LOW), - ParaLocal) ; + ParaLocal); } if (DoErrLog) { @@ -1016,12 +1080,12 @@ /* Check the Value against the thresholds */ /* 2nd: Warning thresholds */ - TooHigh = (pSen->SenValue > pSen->SenThreWarnHigh) ; - TooLow = (pSen->SenValue < pSen->SenThreWarnLow) ; + TooHigh = (pSen->SenValue > pSen->SenThreWarnHigh); + TooLow = (pSen->SenValue < pSen->SenThreWarnLow); if (!IsError && (TooHigh || TooLow)) { - /* Error condition is satiesfied */ + /* Error condition is satisfied */ DoTrapSend = SK_TRUE; DoErrLog = SK_TRUE; @@ -1051,7 +1115,7 @@ /* We came from a different state */ /* -> Set Begin Time Stamp */ pSen->SenBegWarnTS = CurrTime; - pSen->SenErrFlag = SK_SEN_ERR_WARN ; + pSen->SenErrFlag = SK_SEN_ERR_WARN; } if (DoTrapSend) { @@ -1063,7 +1127,7 @@ SkEventQueue(pAC, SKGE_PNMI, (TooHigh ? SK_PNMI_EVT_SEN_WAR_UPP : SK_PNMI_EVT_SEN_WAR_LOW), - ParaLocal) ; + ParaLocal); } if (DoErrLog) { @@ -1074,8 +1138,8 @@ SK_ERR_LOG(pAC, SK_ERRCL_HW, SKERR_I2C_E009, SKERR_I2C_E009MSG); } else if (pSen->SenType == SK_SEN_VOLT) { - SK_ERR_LOG(pAC, SK_ERRCL_HW, SKERR_I2C_E009, - SKERR_I2C_E009MSG); + SK_ERR_LOG(pAC, SK_ERRCL_HW, SKERR_I2C_E010, + SKERR_I2C_E010MSG); } else { SK_ERR_LOG(pAC, SK_ERRCL_HW, SKERR_I2C_E014, @@ -1087,7 +1151,7 @@ /* Check for NO error at all */ if (!IsError && !TooHigh && !TooLow) { /* Set o.k. Status if no error and no warning condition */ - pSen->SenErrFlag = SK_SEN_ERR_OK ; + pSen->SenErrFlag = SK_SEN_ERR_OK; } /* End of check against the thresholds */ @@ -1115,17 +1179,18 @@ if (!pSen->SenInit) { SK_ERR_LOG(pAC, SK_ERRCL_HW, SKERR_I2C_E013, SKERR_I2C_E013MSG); } -} +} /* SkI2cCheckSensor*/ + /* * The only Event to be served is the timeout event * */ int SkI2cEvent( -SK_AC *pAC, /* Adapters context */ -SK_IOC IoC, /* Io Context */ -SK_U32 Event, /* Module specific Event */ -SK_EVPARA Para) /* Event specific Parameter */ +SK_AC *pAC, /* Adapter Context */ +SK_IOC IoC, /* I/O Context */ +SK_U32 Event, /* Module specific Event */ +SK_EVPARA Para) /* Event specific Parameter */ { int ReadComplete; SK_SENSOR *pSen; @@ -1141,7 +1206,7 @@ if (ReadComplete) { /* Check sensor against defined thresholds */ - SkI2cCheckSensor (pAC, pSen) ; + SkI2cCheckSensor (pAC, pSen); /* Increment Current and set appropriate Timeout */ Time = SK_I2C_TIM_SHORT; @@ -1155,7 +1220,7 @@ /* Start Timer */ ParaLocal.Para64 = (SK_U64) 0; SkTimerStart(pAC, IoC, &pAC->I2c.SenTimer, Time, - SKGE_I2C, SK_I2CEV_TIM, ParaLocal) ; + SKGE_I2C, SK_I2CEV_TIM, ParaLocal); } break; case SK_I2CEV_CLEAR: @@ -1176,6 +1241,6 @@ } return(0); -} -#endif /* !SK_DIAG */ -/* End of File */ +} /* SkI2cEvent*/ + +#endif /* !SK_DIAG */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/sk98lin/sklm80.c linux/drivers/net/sk98lin/sklm80.c --- v2.4.0-test8/linux/drivers/net/sk98lin/sklm80.c Tue Nov 23 22:42:21 1999 +++ linux/drivers/net/sk98lin/sklm80.c Fri Sep 15 14:34:19 2000 @@ -2,8 +2,8 @@ * * Name: sklm80.c * Project: GEnesis, PCI Gigabit Ethernet Adapter - * Version: $Revision: 1.16 $ - * Date: $Date: 1999/05/27 14:05:47 $ + * Version: $Revision: 1.17 $ + * Date: $Date: 1999/11/22 13:35:51 $ * Purpose: Funktions to access Voltage and Temperature Sensor (LM80) * ******************************************************************************/ @@ -13,8 +13,6 @@ * (C)Copyright 1998,1999 SysKonnect, * a business unit of Schneider & Koch & Co. Datensysteme GmbH. * - * See the file "skge.c" for further information. - * * 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 @@ -29,6 +27,9 @@ * History: * * $Log: sklm80.c,v $ + * Revision 1.17 1999/11/22 13:35:51 cgoos + * Changed license header to GPL. + * * Revision 1.16 1999/05/27 14:05:47 malthoff * Fans: Set SenVal to 0 if the fan value is 0 or 0xff. Both values * are outside the limits (0: div zero error, 0xff: value not in @@ -92,7 +93,7 @@ LM80 functions */ static const char SysKonnectFileId[] = - "$Id: sklm80.c,v 1.16 1999/05/27 14:05:47 malthoff Exp $" ; + "$Id: sklm80.c,v 1.17 1999/11/22 13:35:51 cgoos Exp $" ; #include "h/skdrv1st.h" /* Driver Specific Definitions */ #include "h/lm80.h" diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/sk98lin/skqueue.c linux/drivers/net/sk98lin/skqueue.c --- v2.4.0-test8/linux/drivers/net/sk98lin/skqueue.c Tue Nov 23 22:42:21 1999 +++ linux/drivers/net/sk98lin/skqueue.c Fri Sep 15 14:34:19 2000 @@ -2,8 +2,8 @@ * * Name: skqueue.c * Project: GEnesis, PCI Gigabit Ethernet Adapter - * Version: $Revision: 1.14 $ - * Date: $Date: 1998/10/15 15:11:35 $ + * Version: $Revision: 1.15 $ + * Date: $Date: 1999/11/22 13:36:29 $ * Purpose: Management of an event queue. * ******************************************************************************/ @@ -13,8 +13,6 @@ * (C)Copyright 1998,1999 SysKonnect, * a business unit of Schneider & Koch & Co. Datensysteme GmbH. * - * See the file "skge.c" for further information. - * * 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 @@ -29,6 +27,9 @@ * History: * * $Log: skqueue.c,v $ + * Revision 1.15 1999/11/22 13:36:29 cgoos + * Changed license header to GPL. + * * Revision 1.14 1998/10/15 15:11:35 gklug * fix: ID_sccs to SysKonnectFileId * @@ -81,7 +82,7 @@ Event queue and dispatcher */ static const char SysKonnectFileId[] = - "$Header: /usr56/projects/ge/schedule/skqueue.c,v 1.14 1998/10/15 15:11:35 gklug Exp $" ; + "$Header: /usr56/projects/ge/schedule/skqueue.c,v 1.15 1999/11/22 13:36:29 cgoos Exp $" ; #include "h/skdrv1st.h" /* Driver Specific Definitions */ #include "h/skqueue.h" /* Queue Definitions */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/sk98lin/skrlmt.c linux/drivers/net/sk98lin/skrlmt.c --- v2.4.0-test8/linux/drivers/net/sk98lin/skrlmt.c Tue Nov 23 22:42:21 1999 +++ linux/drivers/net/sk98lin/skrlmt.c Fri Sep 15 14:34:19 2000 @@ -2,8 +2,8 @@ * * Name: skrlmt.c * Project: GEnesis, PCI Gigabit Ethernet Adapter - * Version: $Revision: 1.48 $ - * Date: $Date: 1999/10/04 14:01:17 $ + * Version: $Revision: 1.49 $ + * Date: $Date: 1999/11/22 13:38:02 $ * Purpose: Manage links on SK-NET Adapters, esp. redundant ones. * ******************************************************************************/ @@ -13,8 +13,6 @@ * (C)Copyright 1998,1999 SysKonnect, * a business unit of Schneider & Koch & Co. Datensysteme GmbH. * - * See the file "skge.c" for further information. - * * 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 @@ -29,6 +27,10 @@ * History: * * $Log: skrlmt.c,v $ + * Revision 1.49 1999/11/22 13:38:02 cgoos + * Changed license header to GPL. + * Added initialization to some variables to avoid compiler warnings. + * * Revision 1.48 1999/10/04 14:01:17 rassmann * Corrected reaction to reception of BPDU frames. * Added parameter descriptions to "For Readme" section skrlmt.txt. @@ -216,7 +218,7 @@ #ifndef lint static const char SysKonnectFileId[] = - "@(#) $Id: skrlmt.c,v 1.48 1999/10/04 14:01:17 rassmann Exp $ (C) SysKonnect."; + "@(#) $Id: skrlmt.c,v 1.49 1999/11/22 13:38:02 cgoos Exp $ (C) SysKonnect."; #endif /* !defined(lint) */ #define __SKRLMT_C diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/sk98lin/sktimer.c linux/drivers/net/sk98lin/sktimer.c --- v2.4.0-test8/linux/drivers/net/sk98lin/sktimer.c Tue Nov 23 22:42:21 1999 +++ linux/drivers/net/sk98lin/sktimer.c Fri Sep 15 14:34:19 2000 @@ -2,8 +2,8 @@ * * Name: sktimer.c * Project: GEnesis, PCI Gigabit Ethernet Adapter - * Version: $Revision: 1.11 $ - * Date: $Date: 1998/12/17 13:24:13 $ + * Version: $Revision: 1.12 $ + * Date: $Date: 1999/11/22 13:38:51 $ * Purpose: High level timer functions. * ******************************************************************************/ @@ -13,8 +13,6 @@ * (C)Copyright 1998,1999 SysKonnect, * a business unit of Schneider & Koch & Co. Datensysteme GmbH. * - * See the file "skge.c" for further information. - * * 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 @@ -29,6 +27,9 @@ * History: * * $Log: sktimer.c,v $ + * Revision 1.12 1999/11/22 13:38:51 cgoos + * Changed license header to GPL. + * * Revision 1.11 1998/12/17 13:24:13 gklug * fix: restart problem: do NOT destroy timer queue if init 1 is done * @@ -75,7 +76,7 @@ Event queue and dispatcher */ static const char SysKonnectFileId[] = - "$Header: /usr56/projects/ge/schedule/sktimer.c,v 1.11 1998/12/17 13:24:13 gklug Exp $" ; + "$Header: /usr56/projects/ge/schedule/sktimer.c,v 1.12 1999/11/22 13:38:51 cgoos Exp $" ; #include "h/skdrv1st.h" /* Driver Specific Definitions */ #include "h/skdrv2nd.h" /* Adapter Control- and Driver specific Def. */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/sk98lin/skvpd.c linux/drivers/net/sk98lin/skvpd.c --- v2.4.0-test8/linux/drivers/net/sk98lin/skvpd.c Mon Jul 10 16:47:23 2000 +++ linux/drivers/net/sk98lin/skvpd.c Fri Sep 15 14:34:19 2000 @@ -2,19 +2,17 @@ * * Name: skvpd.c * Project: GEnesis, PCI Gigabit Ethernet Adapter - * Version: $Revision: 1.24 $ - * Date: $Date: 1999/03/11 14:25:49 $ + * Version: $Revision: 1.27 $ + * Date: $Date: 2000/08/10 11:29:06 $ * Purpose: Shared software to read and write VPD data * ******************************************************************************/ /****************************************************************************** * - * (C)Copyright 1998,1999 SysKonnect, + * (C)Copyright 1998-2000 SysKonnect, * a business unit of Schneider & Koch & Co. Datensysteme GmbH. * - * See the file "skge.c" for further information. - * * 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 @@ -29,6 +27,18 @@ * History: * * $Log: skvpd.c,v $ + * Revision 1.27 2000/08/10 11:29:06 rassmann + * Editorial changes. + * Preserving 32-bit alignment in structs for the adapter context. + * Removed unused function VpdWriteDword() (#if 0). + * Made VpdReadKeyword() available for SKDIAG only. + * + * Revision 1.26 2000/06/13 08:00:01 mkarl + * additional cast to avoid compile problems in 64 bit environment + * + * Revision 1.25 1999/11/22 13:39:32 cgoos + * Changed license header to GPL. + * * Revision 1.24 1999/03/11 14:25:49 malthoff * Replace __STDC__ with SK_KR_PROTO. * @@ -62,7 +72,7 @@ * * Revision 1.14 1998/10/28 07:20:38 gklug * chg: Interface functions to use IoC as parameter as well - * fix: VpdRead/WriteDWord now return SK_U32 + * fix: VpdRead/WriteDWord now returns SK_U32 * chg: VPD_IN/OUT names conform to SK_IN/OUT * add: usage of VPD_IN/OUT8 macros * add: VpdRead/Write Stream functions to r/w a stream of data @@ -120,7 +130,7 @@ Please refer skvpd.txt for infomation how to include this module */ static const char SysKonnectFileId[] = - "@(#)$Id: skvpd.c,v 1.24 1999/03/11 14:25:49 malthoff Exp $ (C) SK" ; + "@(#)$Id: skvpd.c,v 1.27 2000/08/10 11:29:06 rassmann Exp $ (C) SK"; #include "h/skdrv1st.h" #include "h/sktypes.h" @@ -134,9 +144,9 @@ static SK_VPD_PARA *vpd_find_para( SK_AC *pAC, char *key, - SK_VPD_PARA *p) ; + SK_VPD_PARA *p); #else /* SK_KR_PROTO */ -static SK_VPD_PARA *vpd_find_para() ; +static SK_VPD_PARA *vpd_find_para(); #endif /* SK_KR_PROTO */ /* @@ -151,28 +161,29 @@ SK_IOC IoC, /* IO Context */ int event) /* event to wait for (VPD_READ / VPD_write) completion*/ { - SK_U64 start_time ; - SK_U16 state ; + SK_U64 start_time; + SK_U16 state; SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_CTRL, - ("vpd wait for %s\n",event?"Write":"Read")) ; - start_time = SkOsGetTime(pAC) ; + ("vpd wait for %s\n",event?"Write":"Read")); + start_time = SkOsGetTime(pAC); do { if (SkOsGetTime(pAC) - start_time > SK_TICKS_PER_SEC/16) { - VPD_STOP(pAC,IoC) ; + VPD_STOP(pAC,IoC); SK_DBG_MSG(pAC,SK_DBGMOD_VPD, SK_DBGCAT_FATAL|SK_DBGCAT_ERR, - ("ERROR:vpd wait timeout\n")) ; - return(1) ; + ("ERROR:vpd wait timeout\n")); + return(1); } - VPD_IN16(pAC,IoC,PCI_VPD_ADR_REG,&state) ; + VPD_IN16(pAC,IoC,PCI_VPD_ADR_REG,&state); SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_CTRL, - ("state = %x, event %x\n",state,event)) ; - } while((int)(state & PCI_VPD_FLAG) == event) ; + ("state = %x, event %x\n",state,event)); + } while((int)(state & PCI_VPD_FLAG) == event); - return(0) ; + return(0); } +#ifdef SKDIAG /* * Read the dword at address 'addr' from the VPD EEPROM. @@ -189,27 +200,31 @@ SK_IOC IoC, /* IO Context */ int addr) /* VPD address */ { - SK_U32 Rtv ; + SK_U32 Rtv; /* start VPD read */ SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_CTRL, - ("vpd read dword at 0x%x\n",addr)) ; - addr &= ~VPD_WRITE ; /* ensure the R/W bit is set to read */ + ("vpd read dword at 0x%x\n",addr)); + addr &= ~VPD_WRITE; /* ensure the R/W bit is set to read */ - VPD_OUT16(pAC,IoC,PCI_VPD_ADR_REG, (SK_U16) addr) ; + VPD_OUT16(pAC,IoC,PCI_VPD_ADR_REG, (SK_U16) addr); /* ignore return code here */ - (void)VpdWait(pAC,IoC,VPD_READ) ; + (void)VpdWait(pAC,IoC,VPD_READ); /* Don't swap here, it's a data stream of bytes */ - Rtv = 0 ; + Rtv = 0; - VPD_IN32(pAC,IoC,PCI_VPD_DAT_REG,&Rtv) ; + VPD_IN32(pAC,IoC,PCI_VPD_DAT_REG,&Rtv); SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_CTRL, - ("vpd read dword data = 0x%x\n",Rtv)) ; - return (Rtv) ; + ("vpd read dword data = 0x%x\n",Rtv)); + return (Rtv); } +#endif // SKDIAG + +#if 0 + /* Write the dword 'data' at address 'addr' into the VPD EEPROM, and verify that the data is written. @@ -229,11 +244,10 @@ Returns 0: success - 1: error, I2C transfer does not terminate - 2: error, data verify error + 1: error, I2C transfer does not terminate + 2: error, data verify error */ -#if 0 /* unused */ static int VpdWriteDWord( SK_AC *pAC, /* pAC pointer */ SK_IOC IoC, /* IO Context */ @@ -243,29 +257,30 @@ /* start VPD write */ /* Don't swap here, it's a data stream of bytes */ SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_CTRL, - ("vpd write dword at addr 0x%x, data = 0x%x\n",addr,data)) ; - VPD_OUT32(pAC,IoC,PCI_VPD_DAT_REG, (SK_U32)data) ; + ("vpd write dword at addr 0x%x, data = 0x%x\n",addr,data)); + VPD_OUT32(pAC,IoC,PCI_VPD_DAT_REG, (SK_U32)data); /* But do it here */ - addr |= VPD_WRITE ; + addr |= VPD_WRITE; - VPD_OUT16(pAC,IoC,PCI_VPD_ADR_REG, (SK_U16)(addr | VPD_WRITE)) ; + VPD_OUT16(pAC,IoC,PCI_VPD_ADR_REG, (SK_U16)(addr | VPD_WRITE)); /* this may take up to 10,6 ms */ if (VpdWait(pAC,IoC,VPD_WRITE)) { SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_ERR, - ("Write Timed Out\n")) ; - return(1) ; - } ; + ("Write Timed Out\n")); + return(1); + }; /* verify data */ if (VpdReadDWord(pAC,IoC,addr) != data) { SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_ERR|SK_DBGCAT_FATAL, - ("Data Verify Error\n")) ; - return(2) ; + ("Data Verify Error\n")); + return(2); } - return(0) ; -} -#endif /* unused */ + return(0); +} /* VpdWriteDWord */ + +#endif /* 0 */ /* * Read one Stream of 'len' bytes of VPD data, starting at 'addr' from @@ -280,12 +295,12 @@ int Addr, /* VPD start address */ int Len) /* number of bytes to read / to write */ { - int i ; - int j ; - SK_U16 AdrReg ; - int Rtv ; + int i; + int j; + SK_U16 AdrReg; + int Rtv; SK_U8 * pComp; /* Compare pointer */ - SK_U8 Data ; /* Input Data for Compare */ + SK_U8 Data; /* Input Data for Compare */ /* Init Compare Pointer */ pComp = (SK_U8 *) buf; @@ -297,56 +312,56 @@ * So it is initialized even if only a few bytes * are written. */ - AdrReg = (SK_U16) Addr ; - AdrReg &= ~VPD_WRITE ; /* READ operation */ + AdrReg = (SK_U16) Addr; + AdrReg &= ~VPD_WRITE; /* READ operation */ - VPD_OUT16(pAC,IoC,PCI_VPD_ADR_REG, AdrReg) ; + VPD_OUT16(pAC,IoC,PCI_VPD_ADR_REG, AdrReg); /* ignore return code here */ - Rtv = VpdWait(pAC,IoC,VPD_READ) ; + Rtv = VpdWait(pAC,IoC,VPD_READ); if (Rtv != 0) { - return(i) ; + return(i); } } /* Write current Byte */ VPD_OUT8(pAC,IoC,PCI_VPD_DAT_REG+(i%sizeof(SK_U32)), - *(SK_U8*)buf) ; + *(SK_U8*)buf); if (((i%sizeof(SK_U32)) == 3) || (i == (Len - 1))) { /* New Address needs to be written to VPD_ADDR reg */ - AdrReg = (SK_U16) Addr ; + AdrReg = (SK_U16) Addr; Addr += sizeof(SK_U32); - AdrReg |= VPD_WRITE ; /* WRITE operation */ + AdrReg |= VPD_WRITE; /* WRITE operation */ - VPD_OUT16(pAC,IoC,PCI_VPD_ADR_REG, AdrReg) ; + VPD_OUT16(pAC,IoC,PCI_VPD_ADR_REG, AdrReg); /* Wait for termination */ - Rtv = VpdWait(pAC,IoC,VPD_WRITE) ; + Rtv = VpdWait(pAC,IoC,VPD_WRITE); if (Rtv != 0) { SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_ERR, - ("Write Timed Out\n")) ; - return(i - (i%sizeof(SK_U32))) ; + ("Write Timed Out\n")); + return(i - (i%sizeof(SK_U32))); } /* * Now re-read to verify */ - AdrReg &= ~VPD_WRITE ; /* READ operation */ + AdrReg &= ~VPD_WRITE; /* READ operation */ - VPD_OUT16(pAC,IoC,PCI_VPD_ADR_REG, AdrReg) ; + VPD_OUT16(pAC,IoC,PCI_VPD_ADR_REG, AdrReg); /* Wait for termination */ - Rtv = VpdWait(pAC,IoC,VPD_READ) ; + Rtv = VpdWait(pAC,IoC,VPD_READ); if (Rtv != 0) { SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_ERR, - ("Verify Timed Out\n")) ; - return(i - (i%sizeof(SK_U32))) ; + ("Verify Timed Out\n")); + return(i - (i%sizeof(SK_U32))); } for (j = 0; j <= (int) (i%sizeof(SK_U32)); j ++, pComp ++ ) { - VPD_IN8(pAC,IoC,PCI_VPD_DAT_REG+j, &Data) ; + VPD_IN8(pAC,IoC,PCI_VPD_DAT_REG+j, &Data); if (Data != *pComp) { /* Verify Error */ SK_DBG_MSG(pAC,SK_DBGMOD_VPD, @@ -376,31 +391,31 @@ int Addr, /* VPD start address */ int Len) /* number of bytes to read / to write */ { - int i ; - SK_U16 AdrReg ; - int Rtv ; + int i; + SK_U16 AdrReg; + int Rtv; for (i=0; i < Len; i ++, buf++) { if ((i%sizeof(SK_U32)) == 0) { /* New Address needs to be written to VPD_ADDR reg */ - AdrReg = (SK_U16) Addr ; + AdrReg = (SK_U16) Addr; Addr += sizeof(SK_U32); - AdrReg &= ~VPD_WRITE ; /* READ operation */ + AdrReg &= ~VPD_WRITE; /* READ operation */ - VPD_OUT16(pAC,IoC,PCI_VPD_ADR_REG, AdrReg) ; + VPD_OUT16(pAC,IoC,PCI_VPD_ADR_REG, AdrReg); /* ignore return code here */ - Rtv = VpdWait(pAC,IoC,VPD_READ) ; + Rtv = VpdWait(pAC,IoC,VPD_READ); if (Rtv != 0) { - return(i) ; + return(i); } } VPD_IN8(pAC,IoC,PCI_VPD_DAT_REG+(i%sizeof(SK_U32)), - (SK_U8 *)buf) ; + (SK_U8 *)buf); } - return(Len) ; + return(Len); } /* @@ -417,29 +432,29 @@ int len, /* number of bytes to read / to write */ int dir) /* transfer direction may be VPD_READ or VPD_WRITE */ { - int Rtv ; /* Return value */ - int vpd_rom_size ; - SK_U32 our_reg2 ; + int Rtv; /* Return value */ + int vpd_rom_size; + SK_U32 our_reg2; SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_CTRL, ("vpd %s block, addr = 0x%x, len = %d\n", - dir?"write":"read",addr,len)) ; + dir?"write":"read",addr,len)); if (len == 0) - return (0) ; + return (0); - VPD_IN32(pAC,IoC,PCI_OUR_REG_2,&our_reg2) ; + VPD_IN32(pAC,IoC,PCI_OUR_REG_2,&our_reg2); vpd_rom_size = 256 << ((our_reg2 & PCI_VPD_ROM_SZ) >> 14); if (addr > vpd_rom_size - 4) { SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_ERR|SK_DBGCAT_FATAL, ("Address error: 0x%x, exp. < 0x%x\n", - addr, vpd_rom_size - 4)) ; - return (0) ; + addr, vpd_rom_size - 4)); + return (0); } if (addr + len > vpd_rom_size) { - len = vpd_rom_size - addr ; + len = vpd_rom_size - addr; SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_ERR, - ("Warning: len was cut to %d\n",len)) ; + ("Warning: len was cut to %d\n",len)); } if (dir == VPD_READ) { @@ -448,7 +463,7 @@ Rtv = VpdWriteStream(pAC, IoC, buf, addr, len); } - return (Rtv) ; + return (Rtv); } #ifdef SKDIAG @@ -465,7 +480,7 @@ int addr, /* start reading at the VPD address */ int len) /* number of bytes to read */ { - return (VpdTransferBlock(pAC, IoC, buf, addr, len, VPD_READ)) ; + return (VpdTransferBlock(pAC, IoC, buf, addr, len, VPD_READ)); } /* @@ -480,7 +495,7 @@ int addr, /* start writing at the VPD address */ int len) /* number of bytes to write */ { - return (VpdTransferBlock(pAC, IoC, buf, addr, len, VPD_WRITE)) ; + return (VpdTransferBlock(pAC, IoC, buf, addr, len, VPD_WRITE)); } #endif /* SKDIAG */ @@ -497,64 +512,64 @@ SK_AC *pAC, /* Adapters context */ SK_IOC IoC) /* IO Context */ { - SK_VPD_PARA *r, rp ; /* RW or RV */ - int i ; - unsigned char x ; + SK_VPD_PARA *r, rp; /* RW or RV */ + int i; + unsigned char x; - SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_INIT,("VpdInit .. ")) ; + SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_INIT,("VpdInit .. ")); /* read the VPD data into the VPD buffer */ if (VpdTransferBlock(pAC,IoC,pAC->vpd.vpd_buf,0,VPD_SIZE,VPD_READ) != VPD_SIZE) { SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_ERR, - ("Block Read Error\n")) ; - return(1) ; + ("Block Read Error\n")); + return(1); } /* find the end tag of the RO area */ if (!(r = vpd_find_para(pAC,VPD_RV,&rp))) { SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_ERR | SK_DBGCAT_FATAL, - ("Encoding Error: RV Tag not found\n")) ; - return (1) ; + ("Encoding Error: RV Tag not found\n")); + return (1); } if (r->p_val + r->p_len > pAC->vpd.vpd_buf + VPD_SIZE/2) { SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_ERR | SK_DBGCAT_FATAL, - ("Encoding Error: Invalid VPD struct size\n")) ; - return (1) ; + ("Encoding Error: Invalid VPD struct size\n")); + return (1); } - pAC->vpd.v.vpd_free_ro = r->p_len - 1 ; + pAC->vpd.v.vpd_free_ro = r->p_len - 1; /* test the checksum */ for (i = 0, x = 0; (unsigned)i<=(unsigned)VPD_SIZE/2 - r->p_len; i++) { - x += pAC->vpd.vpd_buf[i] ; + x += pAC->vpd.vpd_buf[i]; } if (x != 0) { /* checksum error */ SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_ERR | SK_DBGCAT_FATAL, - ("VPD Checksum Error\n")) ; - return (1) ; + ("VPD Checksum Error\n")); + return (1); } /* find and check the end tag of the RW area */ if (!(r = vpd_find_para(pAC,VPD_RW,&rp))) { SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_ERR | SK_DBGCAT_FATAL, - ("Encoding Error: RV Tag not found\n")) ; - return (1) ; + ("Encoding Error: RV Tag not found\n")); + return (1); } if (r->p_val < pAC->vpd.vpd_buf + VPD_SIZE/2) { SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_ERR | SK_DBGCAT_FATAL, - ("Encoding Error: Invalid VPD struct size\n")) ; - return (1) ; + ("Encoding Error: Invalid VPD struct size\n")); + return (1); } - pAC->vpd.v.vpd_free_rw = r->p_len ; + pAC->vpd.v.vpd_free_rw = r->p_len; /* everything seems to be ok */ - pAC->vpd.v.vpd_status |= VPD_VALID ; + pAC->vpd.v.vpd_status |= VPD_VALID; SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_INIT, ("done. Free RO = %d, Free RW = %d\n", - pAC->vpd.v.vpd_free_ro, pAC->vpd.v.vpd_free_rw)) ; + pAC->vpd.v.vpd_free_ro, pAC->vpd.v.vpd_free_rw)); - return(0) ; + return(0); } /* @@ -570,62 +585,62 @@ SK_VPD_PARA *p) /* parameter description struct */ { char *v ; /* points to vpd buffer */ - int max ; /* Maximum Number of Iterations */ + int max; /* Maximum Number of Iterations */ - v = pAC->vpd.vpd_buf ; - max = 128 ; + v = pAC->vpd.vpd_buf; + max = 128; SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_CTRL, - ("vpd find para %s .. ",key)) ; + ("vpd find para %s .. ",key)); /* check mandatory resource type ID string (Product Name) */ if (*v != (char) RES_ID) { SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_ERR | SK_DBGCAT_FATAL, - ("Error: 0x%x missing\n",RES_ID)) ; - return (0) ; + ("Error: 0x%x missing\n",RES_ID)); + return (0); } if (strcmp(key,VPD_NAME) == 0) { - p->p_len = VPD_GET_RES_LEN(v) ; - p->p_val = VPD_GET_VAL(v) ; + p->p_len = VPD_GET_RES_LEN(v); + p->p_val = VPD_GET_VAL(v); SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_CTRL, - ("found, len = %d\n",p->p_len)) ; - return(p) ; + ("found, len = %d\n",p->p_len)); + return(p); } - v += 3 + VPD_GET_RES_LEN(v) + 3 ; - for ( ; ; ) { + v += 3 + VPD_GET_RES_LEN(v) + 3; + for (;; ) { if (SK_MEMCMP(key,v,2) == 0) { - p->p_len = VPD_GET_VPD_LEN(v) ; - p->p_val = VPD_GET_VAL(v) ; + p->p_len = VPD_GET_VPD_LEN(v); + p->p_val = VPD_GET_VAL(v); SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_CTRL, - ("found, len = %d\n",p->p_len)) ; - return (p) ; + ("found, len = %d\n",p->p_len)); + return (p); } /* exit when reaching the "RW" Tag or the maximum of itera. */ - max-- ; + max--; if (SK_MEMCMP(VPD_RW,v,2) == 0 || max == 0) { - break ; + break; } if (SK_MEMCMP(VPD_RV,v,2) == 0) { - v += 3 + VPD_GET_VPD_LEN(v) + 3 ; /* skip VPD-W */ + v += 3 + VPD_GET_VPD_LEN(v) + 3; /* skip VPD-W */ } else { - v += 3 + VPD_GET_VPD_LEN(v) ; + v += 3 + VPD_GET_VPD_LEN(v); } SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_CTRL, - ("scanning '%c%c' len = %d\n",v[0],v[1],v[2])) ; + ("scanning '%c%c' len = %d\n",v[0],v[1],v[2])); } #ifdef DEBUG - SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_CTRL,("not found\n")) ; + SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_CTRL,("not found\n")); if (max == 0) { SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_ERR | SK_DBGCAT_FATAL, - ("Key/Len Encoding error\n")) ; + ("Key/Len Encoding error\n")); } #endif - return (0) ; + return (0); } /* @@ -639,24 +654,24 @@ char *end, /* end of memory block to move */ int n) /* number of bytes the memory block has to be moved */ { - char *p ; - int i ; /* number of byte copied */ + char *p; + int i; /* number of byte copied */ if (n == 0) - return ; + return; - i = end - start + 1 ; + i = (int) (end - start + 1); if (n < 0) { - p = start + n ; + p = start + n; while (i != 0) { - *p++ = *start++ ; - i-- ; + *p++ = *start++; + i--; } } else { - p = end + n ; + p = end + n; while (i != 0) { - *p-- = *end-- ; - i-- ; + *p-- = *end--; + i--; } } } @@ -672,13 +687,13 @@ int len, /* length of the value string */ char *ip) /* inseration point */ { - SK_VPD_KEY *p ; + SK_VPD_KEY *p; - p = (SK_VPD_KEY *) ip ; - p->p_key[0] = key[0] ; - p->p_key[1] = key[1] ; - p->p_len = (unsigned char) len ; - SK_MEMCPY(&p->p_val,buf,len) ; + p = (SK_VPD_KEY *) ip; + p->p_key[0] = key[0]; + p->p_key[1] = key[1]; + p->p_len = (unsigned char) len; + SK_MEMCPY(&p->p_val,buf,len); } /* @@ -692,46 +707,46 @@ SK_AC *pAC, /* common data base */ char *etp) /* end pointer input position */ { - SK_VPD_KEY *p ; - unsigned char x ; - int i ; + SK_VPD_KEY *p; + unsigned char x; + int i; SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_CTRL, - ("vpd modify endtag at 0x%x = '%c%c'\n",etp,etp[0],etp[1])) ; + ("vpd modify endtag at 0x%x = '%c%c'\n",etp,etp[0],etp[1])); - p = (SK_VPD_KEY *) etp ; + p = (SK_VPD_KEY *) etp; if (p->p_key[0] != 'R' || (p->p_key[1] != 'V' && p->p_key[1] != 'W')) { /* something wrong here, encoding error */ SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_ERR | SK_DBGCAT_FATAL, - ("Encoding Error: invalid end tag\n")) ; - return(1) ; + ("Encoding Error: invalid end tag\n")); + return(1); } if (etp > pAC->vpd.vpd_buf + VPD_SIZE/2) { /* create "RW" tag */ - p->p_len = (unsigned char)(pAC->vpd.vpd_buf+VPD_SIZE-etp-3-1) ; - pAC->vpd.v.vpd_free_rw = (int) p->p_len ; - i = pAC->vpd.v.vpd_free_rw ; - etp += 3 ; + p->p_len = (unsigned char)(pAC->vpd.vpd_buf+VPD_SIZE-etp-3-1); + pAC->vpd.v.vpd_free_rw = (int) p->p_len; + i = pAC->vpd.v.vpd_free_rw; + etp += 3; } else { /* create "RV" tag */ - p->p_len = (unsigned char)(pAC->vpd.vpd_buf+VPD_SIZE/2-etp-3) ; - pAC->vpd.v.vpd_free_ro = (int) p->p_len - 1 ; + p->p_len = (unsigned char)(pAC->vpd.vpd_buf+VPD_SIZE/2-etp-3); + pAC->vpd.v.vpd_free_ro = (int) p->p_len - 1; /* setup checksum */ for (i = 0, x = 0; i < VPD_SIZE/2 - p->p_len; i++) { - x += pAC->vpd.vpd_buf[i] ; + x += pAC->vpd.vpd_buf[i]; } - p->p_val = (char) 0 - x ; - i = pAC->vpd.v.vpd_free_ro ; - etp += 4 ; + p->p_val = (char) 0 - x; + i = pAC->vpd.v.vpd_free_ro; + etp += 4; } while (i) { - *etp++ = 0x00 ; - i-- ; + *etp++ = 0x00; + i--; } - return (0) ; + return (0); } /* @@ -756,76 +771,76 @@ int type, /* VPD_RO_KEY or VPD_RW_KEY */ int op) /* operation to do: ADD_KEY or OWR_KEY */ { - SK_VPD_PARA vp ; - char *etp ; /* end tag position */ - int free ; /* remaining space in selected area */ - char *ip ; /* input position inside the VPD buffer */ - int rtv ; /* return code */ - int head ; /* additional haeder bytes to move */ - int found ; /* additinoal bytes if the keyword was found */ + SK_VPD_PARA vp; + char *etp; /* end tag position */ + int free; /* remaining space in selected area */ + char *ip; /* input position inside the VPD buffer */ + int rtv; /* return code */ + int head; /* additional haeder bytes to move */ + int found; /* additinoal bytes if the keyword was found */ SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_CTRL, - ("vpd setup para key = %s, val = %s\n",key,buf)) ; + ("vpd setup para key = %s, val = %s\n",key,buf)); - rtv = 0 ; - ip = 0 ; + rtv = 0; + ip = 0; if (type == VPD_RW_KEY) { /* end tag is "RW" */ - free = pAC->vpd.v.vpd_free_rw ; - etp = pAC->vpd.vpd_buf + (VPD_SIZE - free - 1 - 3) ; + free = pAC->vpd.v.vpd_free_rw; + etp = pAC->vpd.vpd_buf + (VPD_SIZE - free - 1 - 3); } else { /* end tag is "RV" */ - free = pAC->vpd.v.vpd_free_ro ; - etp = pAC->vpd.vpd_buf + (VPD_SIZE/2 - free - 4) ; + free = pAC->vpd.v.vpd_free_ro; + etp = pAC->vpd.vpd_buf + (VPD_SIZE/2 - free - 4); } SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_CTRL, ("Free RO = %d, Free RW = %d\n", - pAC->vpd.v.vpd_free_ro, pAC->vpd.v.vpd_free_rw)) ; + pAC->vpd.v.vpd_free_ro, pAC->vpd.v.vpd_free_rw)); - head = 0 ; - found = 0 ; + head = 0; + found = 0; if (op == OWR_KEY) { if (vpd_find_para(pAC,key,&vp)) { - found = 3 ; - ip = vp.p_val - 3 ; - free += vp.p_len + 3 ; + found = 3; + ip = vp.p_val - 3; + free += vp.p_len + 3; SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_CTRL, - ("Overwrite Key\n")) ; + ("Overwrite Key\n")); } else { - op = ADD_KEY ; + op = ADD_KEY; SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_CTRL, - ("Add Key\n")) ; + ("Add Key\n")); } } if (op == ADD_KEY) { - ip = etp ; - vp.p_len = 0 ; - head = 3 ; + ip = etp; + vp.p_len = 0; + head = 3; } if (len + 3 > free) { if (free < 7) { SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_ERR, ("VPD Buffer Overflow, keyword not written\n")); - return (4) ; + return (4); } /* cut it again */ - len = free - 3 ; - rtv = 2 ; + len = free - 3; + rtv = 2; SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_ERR, - ("VPD Buffer Full, Keyword was cut\n")) ; + ("VPD Buffer Full, Keyword was cut\n")); } - vpd_move_para(ip + vp.p_len + found, etp+2, len-vp.p_len+head) ; - vpd_insert_key(key, buf, len, ip) ; + vpd_move_para(ip + vp.p_len + found, etp+2, len-vp.p_len+head); + vpd_insert_key(key, buf, len, ip); if (vpd_mod_endtag(pAC, etp + len - vp.p_len + head)) { - pAC->vpd.v.vpd_status &= ~VPD_VALID ; + pAC->vpd.v.vpd_status &= ~VPD_VALID; SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_ERR, - ("VPD Encoding Error\n")) ; - return(6) ; + ("VPD Encoding Error\n")); + return(6); } - return (rtv) ; + return (rtv); } @@ -833,7 +848,7 @@ * Read the contents of the VPD EEPROM and copy it to the * VPD buffer if not already done. * - * return: A pointer to the vpd_status structure. The structure contain + * return: A pointer to the vpd_status structure. The structure contains * this fields. */ SK_VPD_STATUS *VpdStat( @@ -841,9 +856,9 @@ SK_IOC IoC) /* IO Context */ { if (!(pAC->vpd.v.vpd_status & VPD_VALID)) { - (void)VpdInit(pAC,IoC) ; + (void)VpdInit(pAC,IoC); } - return(&pAC->vpd.v) ; + return(&pAC->vpd.v); } @@ -876,67 +891,67 @@ int *len, /* buffer length */ int *elements) /* number of keywords returned */ { - char *v ; - int n ; + char *v; + int n; - SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_RX,("list vpd keys .. ")) ; - *elements = 0 ; + SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_RX,("list vpd keys .. ")); + *elements = 0; if (!(pAC->vpd.v.vpd_status & VPD_VALID)) { if (VpdInit(pAC,IoC) != 0 ) { - *len = 0 ; + *len = 0; SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_ERR, - ("VPD Init Error, terminated\n")) ; - return(6) ; + ("VPD Init Error, terminated\n")); + return(6); } } if ((signed)strlen(VPD_NAME) + 1 <= *len) { - v = pAC->vpd.vpd_buf ; - strcpy(buf,VPD_NAME) ; - n = strlen(VPD_NAME) + 1 ; - buf += n ; - *elements = 1 ; + v = pAC->vpd.vpd_buf; + strcpy(buf,VPD_NAME); + n = strlen(VPD_NAME) + 1; + buf += n; + *elements = 1; SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_RX, - ("'%c%c' ",v[0],v[1])) ; + ("'%c%c' ",v[0],v[1])); } else { - *len = 0 ; + *len = 0; SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_ERR, - ("buffer overflow\n")) ; - return(2) ; + ("buffer overflow\n")); + return(2); } - v += 3 + VPD_GET_RES_LEN(v) + 3 ; - for ( ; ; ) { + v += 3 + VPD_GET_RES_LEN(v) + 3; + for (;; ) { /* exit when reaching the "RW" Tag */ if (SK_MEMCMP(VPD_RW,v,2) == 0) { - break ; + break; } if (SK_MEMCMP(VPD_RV,v,2) == 0) { - v += 3 + VPD_GET_VPD_LEN(v) + 3 ; /* skip VPD-W */ - continue ; + v += 3 + VPD_GET_VPD_LEN(v) + 3; /* skip VPD-W */ + continue; } if (n+3 <= *len) { - SK_MEMCPY(buf,v,2) ; - buf += 2 ; - *buf++ = '\0' ; - n += 3 ; - v += 3 + VPD_GET_VPD_LEN(v) ; - *elements += 1 ; + SK_MEMCPY(buf,v,2); + buf += 2; + *buf++ = '\0'; + n += 3; + v += 3 + VPD_GET_VPD_LEN(v); + *elements += 1; SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_RX, - ("'%c%c' ",v[0],v[1])) ; + ("'%c%c' ",v[0],v[1])); } else { - *len = n ; + *len = n; SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_ERR, - ("buffer overflow\n")) ; - return (2) ; + ("buffer overflow\n")); + return (2); } } - SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_RX,("\n")) ; - *len = n ; - return(0) ; + SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_RX,("\n")); + *len = n; + return(0); } @@ -960,34 +975,34 @@ char *buf, /* buffer where to copy the keyword value */ int *len) /* buffer length */ { - SK_VPD_PARA *p, vp ; + SK_VPD_PARA *p, vp; - SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_RX,("vpd read %s .. ",key)) ; + SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_RX,("vpd read %s .. ",key)); if (!(pAC->vpd.v.vpd_status & VPD_VALID)) { if (VpdInit(pAC,IoC) != 0 ) { - *len = 0 ; + *len = 0; SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_ERR, - ("vpd init error\n")) ; - return(6) ; + ("vpd init error\n")); + return(6); } } if ((p = vpd_find_para(pAC,key,&vp))) { if (p->p_len > (*(unsigned *)len)-1) { - p->p_len = *len - 1 ; + p->p_len = *len - 1; } - SK_MEMCPY(buf,p->p_val,p->p_len) ; - buf[p->p_len] = '\0' ; - *len = p->p_len ; + SK_MEMCPY(buf,p->p_val,p->p_len); + buf[p->p_len] = '\0'; + *len = p->p_len; SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_RX, ("%c%c%c%c.., len = %d\n", - buf[0],buf[1],buf[2],buf[3],*len)) ; + buf[0],buf[1],buf[2],buf[3],*len)); } else { - *len = 0 ; - SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_ERR,("not found\n")) ; - return (1) ; + *len = 0; + SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_ERR,("not found\n")); + return (1); } - return (0) ; + return (0); } @@ -1005,9 +1020,9 @@ key[1] < '0' || key[1] > 'Z' || (key[1] > '9' && key[1] < 'A') || strlen(key) != 2) { - return (SK_FALSE) ; + return (SK_FALSE); } - return (SK_TRUE) ; + return (SK_TRUE); } /* @@ -1029,46 +1044,46 @@ char *key, /* keyword to write (allowed values "Yx", "Vx") */ char *buf) /* buffer where the keyword value can be read from */ { - int len ; /* lenght of the keyword to write */ - int rtv ; /* return code */ - int rtv2 ; + int len; /* lenght of the keyword to write */ + int rtv; /* return code */ + int rtv2; SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_TX, - ("vpd write %s = %s\n",key,buf)) ; + ("vpd write %s = %s\n",key,buf)); if ((*key != 'Y' && *key != 'V') || key[1] < '0' || key[1] > 'Z' || (key[1] > '9' && key[1] < 'A') || strlen(key) != 2) { SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_ERR, - ("illegal key tag, keyword not written\n")) ; - return (5) ; + ("illegal key tag, keyword not written\n")); + return (5); } if (!(pAC->vpd.v.vpd_status & VPD_VALID)) { if (VpdInit(pAC,IoC) != 0 ) { SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_ERR, - ("vpd init error\n")) ; - return(6) ; + ("vpd init error\n")); + return(6); } } - rtv = 0 ; - len = strlen(buf) ; + rtv = 0; + len = strlen(buf); if (len > VPD_MAX_LEN) { /* cut it */ - len = VPD_MAX_LEN ; - rtv = 2 ; + len = VPD_MAX_LEN; + rtv = 2; SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_ERR, - ("keyword to long, cut after %d bytes\n",VPD_MAX_LEN)) ; + ("keyword to long, cut after %d bytes\n",VPD_MAX_LEN)); } if ((rtv2 = VpdSetupPara(pAC,key,buf,len,VPD_RW_KEY,OWR_KEY)) != 0) { SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_ERR, - ("vpd write error\n")) ; - return(rtv2) ; + ("vpd write error\n")); + return(rtv2); } - return (rtv) ; + return (rtv); } /* @@ -1088,15 +1103,15 @@ SK_IOC IoC, /* IO Context */ char *key) /* keyword to read (e.g. "MN") */ { - SK_VPD_PARA *p, vp ; - char *etp ; + SK_VPD_PARA *p, vp; + char *etp; - SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_TX,("vpd delete key %s\n",key)) ; + SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_TX,("vpd delete key %s\n",key)); if (!(pAC->vpd.v.vpd_status & VPD_VALID)) { if (VpdInit(pAC,IoC) != 0 ) { SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_ERR, - ("vpd init error\n")) ; - return(6) ; + ("vpd init error\n")); + return(6); } } @@ -1104,27 +1119,27 @@ if (p->p_val < pAC->vpd.vpd_buf + VPD_SIZE/2) { /* try to delete read only keyword */ SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_ERR, - ("cannot delete RO keyword\n")) ; - return (5) ; + ("cannot delete RO keyword\n")); + return (5); } - etp = pAC->vpd.vpd_buf + (VPD_SIZE-pAC->vpd.v.vpd_free_rw-1-3) ; + etp = pAC->vpd.vpd_buf + (VPD_SIZE-pAC->vpd.v.vpd_free_rw-1-3); vpd_move_para(vp.p_val+vp.p_len, etp+2, - - ((int)(vp.p_len + 3))) ; + - ((int)(vp.p_len + 3))); if (vpd_mod_endtag(pAC, etp - vp.p_len - 3)) { - pAC->vpd.v.vpd_status &= ~VPD_VALID ; + pAC->vpd.v.vpd_status &= ~VPD_VALID; SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_ERR, - ("vpd encoding error\n")) ; - return(6) ; + ("vpd encoding error\n")); + return(6); } } else { SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_ERR, - ("keyword not found\n")) ; - return (1) ; + ("keyword not found\n")); + return (1); } - return (0) ; + return (0); } /* @@ -1138,18 +1153,18 @@ SK_AC *pAC, /* Adapters context */ SK_IOC IoC) /* IO Context */ { - SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_TX,("vpd update .. ")) ; + SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_TX,("vpd update .. ")); if (pAC->vpd.v.vpd_status & VPD_VALID) { if (VpdTransferBlock(pAC,IoC,pAC->vpd.vpd_buf + VPD_SIZE/2, VPD_SIZE/2, VPD_SIZE/2, VPD_WRITE) != VPD_SIZE/2) { SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_ERR, - ("transfer timed out\n")) ; - return(3) ; + ("transfer timed out\n")); + return(3); } } - SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_TX,("done\n")) ; - return (0) ; + SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_TX,("done\n")); + return (0); } @@ -1169,32 +1184,32 @@ SK_IOC IoC, /* IO Context */ char *msg) /* error log message */ { - SK_VPD_PARA *v, vf ; /* VF */ - int len ; + SK_VPD_PARA *v, vf; /* VF */ + int len; SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_TX, - ("vpd error log msg %s\n",msg)) ; + ("vpd error log msg %s\n",msg)); if (!(pAC->vpd.v.vpd_status & VPD_VALID)) { if (VpdInit(pAC,IoC) != 0 ) { SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_ERR, - ("vpd init error\n")) ; - return ; + ("vpd init error\n")); + return; } } - len = strlen(msg) ; + len = strlen(msg); if (len > VPD_MAX_LEN) { /* cut it */ - len = VPD_MAX_LEN ; + len = VPD_MAX_LEN; } if ((v = vpd_find_para(pAC,VPD_VF,&vf))) { - SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_TX,("overwrite VL\n")) ; - (void)VpdSetupPara(pAC,VPD_VL,msg,len,VPD_RW_KEY,OWR_KEY) ; + SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_TX,("overwrite VL\n")); + (void)VpdSetupPara(pAC,VPD_VL,msg,len,VPD_RW_KEY,OWR_KEY); } else { - SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_TX,("write VF\n")) ; - (void)VpdSetupPara(pAC,VPD_VF,msg,len,VPD_RW_KEY,ADD_KEY) ; + SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_TX,("write VF\n")); + (void)VpdSetupPara(pAC,VPD_VF,msg,len,VPD_RW_KEY,ADD_KEY); } - (void)VpdUpdate(pAC,IoC) ; + (void)VpdUpdate(pAC,IoC); } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/sk98lin/skxmac2.c linux/drivers/net/sk98lin/skxmac2.c --- v2.4.0-test8/linux/drivers/net/sk98lin/skxmac2.c Tue Nov 23 22:42:21 1999 +++ linux/drivers/net/sk98lin/skxmac2.c Fri Sep 15 14:34:19 2000 @@ -2,8 +2,8 @@ * * Name: skxmac2.c * Project: GEnesis, PCI Gigabit Ethernet Adapter - * Version: $Revision: 1.49 $ - * Date: $Date: 1999/11/22 08:12:13 $ + * Version: $Revision: 1.53 $ + * Date: $Date: 2000/07/27 12:22:11 $ * Purpose: Contains functions to initialize the XMAC II * ******************************************************************************/ @@ -13,8 +13,6 @@ * (C)Copyright 1998,1999 SysKonnect, * a business unit of Schneider & Koch & Co. Datensysteme GmbH. * - * See the file "skge.c" for further information. - * * 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 @@ -29,6 +27,18 @@ * History: * * $Log: skxmac2.c,v $ + * Revision 1.53 2000/07/27 12:22:11 gklug + * fix: possible endless loop in XmHardRst. + * + * Revision 1.52 2000/05/22 08:48:31 malthoff + * Fix: #10523 errata valid for all BCOM PHYs. + * + * Revision 1.51 2000/05/17 12:52:18 malthoff + * Fixes BCom link errata (#10523). + * + * Revision 1.50 1999/11/22 13:40:14 cgoos + * Changed license header to GPL. + * * Revision 1.49 1999/11/22 08:12:13 malthoff * Add workaround for power consumption feature of Bcom C0 chip. * @@ -224,7 +234,7 @@ /* local variables ************************************************************/ static const char SysKonnectFileId[] = - "@(#)$Id: skxmac2.c,v 1.49 1999/11/22 08:12:13 malthoff Exp $ (C) SK "; + "@(#)$Id: skxmac2.c,v 1.53 2000/07/27 12:22:11 gklug Exp $ (C) SK "; /* BCOM PHY magic pattern list */ typedef struct s_PhyHack { @@ -558,6 +568,10 @@ * register (Timing requirements: Broadcom: 400ns, Level One: * none, National: 80ns). * + * ATTENTION: + * It is absolutely neccessary to reset the SW_RST Bit first + * before calling this function. + * * Returns: * nothing */ @@ -568,6 +582,7 @@ { SK_U16 Word; int i; + int TOut; SK_U32 Reg; for (i=0; i<4; i++) { @@ -575,12 +590,25 @@ /* bit contains buttoms to press */ SK_OUT16(IoC, MR_ADDR(Port, TX_MFF_CTRL1), (SK_U16) MFF_CLR_MAC_RST); - SK_OUT16(IoC, MR_ADDR(Port, TX_MFF_CTRL1), - (SK_U16) MFF_SET_MAC_RST); + + TOut = 0; do { + TOut ++; + if (TOut > 10000) { + /* + * Adapter seems to be in RESET state. + * Registers cannot be written. + */ + return; + } + + SK_OUT16(IoC, MR_ADDR(Port, TX_MFF_CTRL1), + (SK_U16) MFF_SET_MAC_RST); SK_IN16(IoC,MR_ADDR(Port,TX_MFF_CTRL1), &Word); } while ((Word & MFF_SET_MAC_RST) == 0); } + + /* For external PHYs there must be special handling */ if (pAC->GIni.GP[Port].PhyType != SK_PHY_XMAC) { /* reset external PHY */ @@ -696,6 +724,11 @@ i++; } } + /* Workaround BCOM Errata (#10523) for all BCom PHYs*/ + /* Disable Power Management after reset */ + PHY_READ(IoC, pPrt, Port, PHY_BCOM_AUX_CTRL, &SWord); + PHY_WRITE(IoC, pPrt, Port, PHY_BCOM_AUX_CTRL, + SWord | PHY_B_AC_DIS_PM); /* * PHY LED initialization is performed in @@ -1845,6 +1878,7 @@ SK_GEPORT *pPrt; SK_U16 Reg ; /* 16bit register value */ SK_U16 IntMask; /* XMac interrupt mask */ + SK_U16 SWord; pPrt = &pAC->GIni.GP[Port]; @@ -1892,6 +1926,11 @@ } switch (pPrt->PhyType) { case SK_PHY_BCOM: + /* Workaround BCOM Errata (#10523) for all BCom Phys */ + /* Enable Power Management after link up */ + PHY_READ(IoC, pPrt, Port, PHY_BCOM_AUX_CTRL, &SWord); + PHY_WRITE(IoC, pPrt, Port, PHY_BCOM_AUX_CTRL, + SWord & ~PHY_B_AC_DIS_PM); PHY_WRITE(IoC, pPrt, Port, PHY_BCOM_INT_MASK, PHY_B_DEF_MSK); break; diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/skfp/skfddi.c linux/drivers/net/skfp/skfddi.c --- v2.4.0-test8/linux/drivers/net/skfp/skfddi.c Fri Jul 14 12:12:11 2000 +++ linux/drivers/net/skfp/skfddi.c Fri Sep 15 14:34:36 2000 @@ -1654,7 +1654,8 @@ virt = mac_drv_get_space(smc, size); - size = (u_int) ((0 - (unsigned long) virt) & 15UL); + size = (u_int) (16 - (((unsigned long) virt) & 15UL)); + size = size % 16; PRINTK("Allocate %u bytes alignment gap ", size); PRINTK("for descriptor memory.\n"); diff -u --recursive --new-file v2.4.0-test8/linux/drivers/pci/pci.ids linux/drivers/pci/pci.ids --- v2.4.0-test8/linux/drivers/pci/pci.ids Wed Aug 23 18:36:38 2000 +++ linux/drivers/pci/pci.ids Fri Sep 15 16:28:25 2000 @@ -1471,9 +1471,9 @@ 6055 3c556 Laptop Hurricane 5057 3c575 [Megahertz] 10/100 LAN CardBus 10b7 5a57 3C575 Megahertz 10/100 LAN Cardbus PC Card - 5157 3c575 [Megahertz] 10/100 LAN CardBus + 5157 3CCFE575BT Cyclone CardBus 10b7 5b57 3C575 Megahertz 10/100 LAN Cardbus PC Card - 5257 3CCFE575CT Cyclone CardBus + 5257 3CCFE575CT Tornado CardBus 5900 3c590 10BaseT [Vortex] 5920 3c592 EISA 10mbps Demon/Vortex 5950 3c595 100BaseTX [Vortex] @@ -1483,8 +1483,8 @@ 5b57 3c595 [Megahertz] 10/100 LAN CardBus 10b7 5b57 3C575 Megahertz 10/100 LAN Cardbus PC Card 6560 3CCFE656 Cyclone CardBus - 6562 3CCFEM656 [id 6562] Cyclone CardBus - 6564 3CCFEM656 [id 6564] Cyclone CardBus + 6562 3CCFEM656B Cyclone CardBus + 6564 3CXFEM656C Tornado CardBus 7646 3cSOHO100-TX Hurricane 8811 Token ring 9000 3c900 10BaseT [Boomerang] diff -u --recursive --new-file v2.4.0-test8/linux/drivers/pcmcia/cardbus.c linux/drivers/pcmcia/cardbus.c --- v2.4.0-test8/linux/drivers/pcmcia/cardbus.c Fri Sep 8 13:27:12 2000 +++ linux/drivers/pcmcia/cardbus.c Fri Sep 15 16:31:09 2000 @@ -58,11 +58,6 @@ #include #include -#ifndef PCMCIA_DEBUG -#define PCMCIA_DEBUG 1 -#endif -static int pc_debug = PCMCIA_DEBUG; - #define IN_CARD_SERVICES #include #include @@ -72,6 +67,11 @@ #include #include "cs_internal.h" #include "rsrc_mgr.h" + +#ifndef PCMCIA_DEBUG +#define PCMCIA_DEBUG 1 +#endif +static int pc_debug = PCMCIA_DEBUG; /*====================================================================*/ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/pcmcia/cs.c linux/drivers/pcmcia/cs.c --- v2.4.0-test8/linux/drivers/pcmcia/cs.c Fri Sep 8 13:27:12 2000 +++ linux/drivers/pcmcia/cs.c Fri Sep 15 16:31:09 2000 @@ -103,13 +103,13 @@ #define INT_MODULE_PARM(n, v) static int n = v; MODULE_PARM(n, "i") -INT_MODULE_PARM(setup_delay, HZ/20); /* ticks */ -INT_MODULE_PARM(resume_delay, HZ/5); /* ticks */ -INT_MODULE_PARM(shutdown_delay, HZ/40); /* ticks */ -INT_MODULE_PARM(vcc_settle, 400); /* msecs */ +INT_MODULE_PARM(setup_delay, 10); /* centiseconds */ +INT_MODULE_PARM(resume_delay, 20); /* centiseconds */ +INT_MODULE_PARM(shutdown_delay, 3); /* centiseconds */ +INT_MODULE_PARM(vcc_settle, 40); /* centiseconds */ INT_MODULE_PARM(reset_time, 10); /* usecs */ -INT_MODULE_PARM(unreset_delay, 100); /* msecs */ -INT_MODULE_PARM(unreset_check, 100); /* msecs */ +INT_MODULE_PARM(unreset_delay, 10); /* centiseconds */ +INT_MODULE_PARM(unreset_check, 10); /* centiseconds */ INT_MODULE_PARM(unreset_limit, 30); /* unreset_check's */ /* Access speed for attribute memory windows */ @@ -446,10 +446,13 @@ static int send_event(socket_info_t *s, event_t event, int priority); -static void msleep(unsigned int msec) +/* + * Sleep for n_cs centiseconds (1 cs = 1/100th of a second) + */ +static void cs_sleep(unsigned int n_cs) { current->state = TASK_INTERRUPTIBLE; - schedule_timeout( (msec * HZ + 999) / 1000); + schedule_timeout( (n_cs * HZ + 99) / 100); } static void shutdown_socket(socket_info_t *s) @@ -504,7 +507,7 @@ if (!(val & SS_PENDING)) break; if (--setup_timeout) { - msleep(100); + cs_sleep(10); continue; } printk(KERN_NOTICE "cs: socket %p voltage interrogation" @@ -516,7 +519,7 @@ if (val & SS_DETECT) { DEBUG(1, "cs: setup_socket(%p): applying power\n", s); s->state |= SOCKET_PRESENT; - s->socket.flags = 0; + s->socket.flags &= SS_DEBOUNCED; if (val & SS_3VCARD) s->socket.Vcc = s->socket.Vpp = 33; else if (!(val & SS_XVCARD)) @@ -533,7 +536,7 @@ #endif } set_socket(s, &s->socket); - msleep(vcc_settle); + cs_sleep(vcc_settle); reset_socket(s); ret = 1; } else { @@ -561,7 +564,7 @@ udelay((long)reset_time); s->socket.flags &= ~SS_RESET; set_socket(s, &s->socket); - msleep(unreset_delay); + cs_sleep(unreset_delay/10); unreset_socket(s); } /* reset_socket */ @@ -580,11 +583,11 @@ break; DEBUG(2, "cs: socket %d not ready yet\n", s->sock); if (--setup_timeout) { - msleep(unreset_check); + cs_sleep(unreset_check); continue; } printk(KERN_NOTICE "cs: socket %p timed out during" - " reset\n", s); + " reset. Try increasing setup_delay.\n", s); s->state &= ~EVENT_MASK; return; } @@ -656,7 +659,7 @@ DEBUG(0, "cs: flushing pending setup\n"); s->state &= ~EVENT_MASK; } - msleep(shutdown_delay); + cs_sleep(shutdown_delay); s->state &= ~SOCKET_PRESENT; shutdown_socket(s); } @@ -679,11 +682,13 @@ } s->state |= SOCKET_SETUP_PENDING; if (s->state & SOCKET_SUSPEND) - msleep(resume_delay); + cs_sleep(resume_delay); else - msleep(setup_delay); + cs_sleep(setup_delay); + s->socket.flags |= SS_DEBOUNCED; if (setup_socket(s) == 0) s->state &= ~SOCKET_SETUP_PENDING; + s->socket.flags &= ~SS_DEBOUNCED; } } if (events & SS_BATDEAD) diff -u --recursive --new-file v2.4.0-test8/linux/drivers/pcmcia/yenta.c linux/drivers/pcmcia/yenta.c --- v2.4.0-test8/linux/drivers/pcmcia/yenta.c Fri Sep 8 13:27:12 2000 +++ linux/drivers/pcmcia/yenta.c Fri Sep 15 16:31:09 2000 @@ -233,6 +233,11 @@ { u16 bridge; + if (state->flags & SS_DEBOUNCED) { + /* The insertion debounce period has ended. Clear any pending insertion events */ + socket->events &= ~SS_DETECT; + state->flags &= ~SS_DEBOUNCED; /* SS_DEBOUNCED is oneshot */ + } yenta_set_power(socket, state); socket->io_irq = state->io_irq; bridge = config_readw(socket, CB_BRIDGE_CONTROL) & ~(CB_BRIDGE_CRST | CB_BRIDGE_INTR); diff -u --recursive --new-file v2.4.0-test8/linux/drivers/scsi/BusLogic.c linux/drivers/scsi/BusLogic.c --- v2.4.0-test8/linux/drivers/scsi/BusLogic.c Mon Jul 10 16:47:24 2000 +++ linux/drivers/scsi/BusLogic.c Mon Sep 11 08:41:07 2000 @@ -61,7 +61,7 @@ */ static int - BusLogic_DriverOptionsCount = 0; + BusLogic_DriverOptionsCount; /* @@ -79,7 +79,7 @@ */ #ifdef MODULE -static char *BusLogic = NULL; +static char *BusLogic; MODULE_PARM(BusLogic, "s"); #endif @@ -90,7 +90,7 @@ */ static BusLogic_ProbeOptions_T - BusLogic_ProbeOptions = { 0 }; + BusLogic_ProbeOptions; /* @@ -99,7 +99,7 @@ */ static BusLogic_GlobalOptions_T - BusLogic_GlobalOptions = { 0 }; + BusLogic_GlobalOptions; /* @@ -108,8 +108,8 @@ */ static BusLogic_HostAdapter_T - *BusLogic_FirstRegisteredHostAdapter = NULL, - *BusLogic_LastRegisteredHostAdapter = NULL; + *BusLogic_FirstRegisteredHostAdapter, + *BusLogic_LastRegisteredHostAdapter; /* @@ -117,7 +117,7 @@ */ static int - BusLogic_ProbeInfoCount = 0; + BusLogic_ProbeInfoCount; /* @@ -128,7 +128,7 @@ */ static BusLogic_ProbeInfo_T - *BusLogic_ProbeInfoList = NULL; + *BusLogic_ProbeInfoList; /* diff -u --recursive --new-file v2.4.0-test8/linux/drivers/scsi/sd.c linux/drivers/scsi/sd.c --- v2.4.0-test8/linux/drivers/scsi/sd.c Fri Sep 8 13:27:12 2000 +++ linux/drivers/scsi/sd.c Sun Sep 10 13:32:54 2000 @@ -1335,12 +1335,13 @@ return; } -int init_sd(void) +static int init_sd(void) { sd_template.module = THIS_MODULE; return scsi_register_module(MODULE_SCSI_DEV, &sd_template); } -void exit_sd(void) + +static void exit_sd(void) { struct gendisk **prev_sdgd_link; struct gendisk *sdgd; diff -u --recursive --new-file v2.4.0-test8/linux/drivers/scsi/sr.c linux/drivers/scsi/sr.c --- v2.4.0-test8/linux/drivers/scsi/sr.c Fri Sep 8 13:27:12 2000 +++ linux/drivers/scsi/sr.c Sun Sep 10 13:21:13 2000 @@ -849,13 +849,13 @@ return; } -int init_sr(void) +static int __init init_sr(void) { sr_template.module = THIS_MODULE; return scsi_register_module(MODULE_SCSI_DEV, &sr_template); } -void exit_sr(void) +static void __exit exit_sr(void) { scsi_unregister_module(MODULE_SCSI_DEV, &sr_template); devfs_unregister_blkdev(MAJOR_NR, "sr"); diff -u --recursive --new-file v2.4.0-test8/linux/drivers/sound/cs46xx.c linux/drivers/sound/cs46xx.c --- v2.4.0-test8/linux/drivers/sound/cs46xx.c Fri Sep 8 13:27:12 2000 +++ linux/drivers/sound/cs46xx.c Fri Sep 15 14:25:58 2000 @@ -2485,7 +2485,7 @@ void (*active)(struct cs_card *, int); }; -static struct cs_card_type __init cards[]={ +static struct cs_card_type __initdata cards[]={ {0x1489, 0x7001, "Genius Soundmaker 128 value", amp_none, NULL}, {0x5053, 0x3357, "Voyetra", amp_voyetra, NULL}, /* MI6020/21 use the same chipset as the Thinkpads, maybe needed */ @@ -2494,7 +2494,7 @@ {PCI_VENDOR_ID_IBM, 0x0132, "Thinkpad 570", amp_none, clkrun_hack}, {PCI_VENDOR_ID_IBM, 0x0153, "Thinkpad 600X/A20/T20", amp_none, clkrun_hack}, {PCI_VENDOR_ID_IBM, 0x1010, "Thinkpad 600E (unsupported)", NULL, NULL}, - {0, 0, NULL, NULL} + {0, 0, NULL, NULL, NULL} }; static int __init cs_install(struct pci_dev *pci_dev) diff -u --recursive --new-file v2.4.0-test8/linux/drivers/usb/storage/Makefile linux/drivers/usb/storage/Makefile --- v2.4.0-test8/linux/drivers/usb/storage/Makefile Fri Sep 8 13:27:12 2000 +++ linux/drivers/usb/storage/Makefile Fri Sep 8 16:39:12 2000 @@ -21,7 +21,7 @@ usb-storage-obj-$(CONFIG_USB_STORAGE_DPCM) += dpcm.o usb-storage-objs := scsiglue.o protocol.o transport.o usb.o \ - $(usb-storage-obj-y) + initializers.o $(usb-storage-obj-y) # Extract lists of the multi-part drivers. # The 'int-*' lists are the intermediate files used to build the multi's. diff -u --recursive --new-file v2.4.0-test8/linux/drivers/usb/storage/debug.c linux/drivers/usb/storage/debug.c --- v2.4.0-test8/linux/drivers/usb/storage/debug.c Fri Sep 8 13:27:12 2000 +++ linux/drivers/usb/storage/debug.c Fri Sep 8 16:39:12 2000 @@ -1,7 +1,7 @@ /* Driver for USB Mass Storage compliant devices * Debugging Functions Source Code File * - * $Id: debug.c,v 1.3 2000/08/25 00:13:51 mdharm Exp $ + * $Id: debug.c,v 1.4 2000/09/04 02:12:47 groovyjava Exp $ * * Current development and maintenance by: * (c) 1999, 2000 Matthew Dharm (mdharm-usb@one-eyed-alien.net) @@ -206,5 +206,162 @@ sg[i].address[14], sg[i].address[15]); } +} + +void usb_stor_show_sense( + unsigned char key, + unsigned char asc, + unsigned char ascq) { + + char *keys[] = { + "No Sense", + "Recovered Error", + "Not Ready", + "Medium Error", + "Hardware Error", + "Illegal Request", + "Unit Attention", + "Data Protect", + "Blank Check", + "Vendor Specific", + "Copy Aborted", + "Aborted Command", + "(Obsolete)", + "Volume Overflow", + "Miscompare" + }; + + unsigned short qual = asc; + + char *what = 0; + char *keystr = 0; + + qual <<= 8; + qual |= ascq; + + if (key>0x0E) + keystr = "(Unknown Key)"; + else + keystr = keys[key]; + + switch (qual) { + + case 0x0000: what="no additional sense information"; break; + case 0x0001: what="filemark detected"; break; + case 0x0002: what="end of partition/medium detected"; break; + case 0x0003: what="setmark detected"; break; + case 0x0004: what="beginning of partition/medium detected"; break; + case 0x0005: what="end of data detected"; break; + case 0x0006: what="I/O process terminated"; break; + case 0x0011: what="audio play operation in progress"; break; + case 0x0012: what="audio play operation paused"; break; + case 0x0013: what="audio play operation stopped due to error"; break; + case 0x0014: what="audio play operation successfully completed"; break; + case 0x0015: what="no current audio status to return"; break; + case 0x0016: what="operation in progress"; break; + case 0x0017: what="cleaning requested"; break; + case 0x0100: what="no index/sector signal"; break; + case 0x0200: what="no seek complete"; break; + case 0x0300: what="peripheral device write fault"; break; + case 0x0301: what="no write current"; break; + case 0x0302: what="excessive write errors"; break; + case 0x0400: what="LUN not ready, cause not reportable"; break; + case 0x0401: what="LUN in process of becoming ready"; break; + case 0x0402: what="LUN not ready, initializing cmd. required"; break; + case 0x0403: what="LUN not ready, manual intervention required"; break; + case 0x0404: what="LUN not ready, format in progress"; break; + case 0x0405: what="LUN not ready, rebuild in progress"; break; + case 0x0406: what="LUN not ready, recalculation in progress"; break; + case 0x0407: what="LUN not ready, operation in progress"; break; + case 0x0408: what="LUN not ready, long write in progress"; break; + case 0x0500: what="LUN doesn't respond to selection"; break; + case 0x0A00: what="error log overflow"; break; + case 0x0C04: what="compression check miscompare error"; break; + case 0x0C05: what="data expansion occurred during compression"; break; + case 0x0C06: what="block not compressible"; break; + case 0x1102: what="error too long to correct"; break; + case 0x1106: what="CIRC unrecovered error"; break; + case 0x1107: what="data resynchronization error"; break; + case 0x110D: what="decompression CRC error"; break; + case 0x110E: what="can't decompress using declared algorithm"; break; + case 0x110F: what="error reading UPC/EAN number"; break; + case 0x1110: what="error reading ISRC number"; break; + case 0x1200: what="address mark not found for ID field"; break; + case 0x1300: what="address mark not found for data field"; break; + case 0x1403: what="end of data not found"; break; + case 0x1404: what="block sequence error"; break; + case 0x1600: what="data sync mark error"; break; + case 0x1601: what="data sync error: data rewritten"; break; + case 0x1602: what="data sync error: recommend rewrite"; break; + case 0x1603: what="data sync error: data auto-reallocated"; break; + case 0x1604: what="data sync error: recommend reassignment"; break; + case 0x1900: what="defect list error"; break; + case 0x1901: what="defect list not available"; break; + case 0x1902: what="defect list error in primary list"; break; + case 0x1903: what="defect list error in grown list"; break; + case 0x1C00: what="defect list not found"; break; + case 0x2400: what="invalid field in CDB"; break; + case 0x2703: what="associated write protect"; break; + case 0x2903: what="bus device reset function occurred"; break; + case 0x2904: what="device internal reset"; break; + case 0x2B00: what="copy can't execute since host can't disconnect"; + break; + case 0x2C00: what="command sequence error"; break; + case 0x2C03: what="current program area is not empty"; break; + case 0x2C04: what="current program area is empty"; break; + case 0x2F00: what="commands cleared by another initiator"; break; + case 0x3001: what="can't read medium: unknown format"; break; + case 0x3002: what="can't read medium: incompatible format"; break; + case 0x3003: what="cleaning cartridge installed"; break; + case 0x3004: what="can't write medium: unknown format"; break; + case 0x3005: what="can't write medium: incompatible format"; break; + case 0x3006: what="can't format medium: incompatible medium"; break; + case 0x3007: what="cleaning failure"; break; + case 0x3008: what="can't write: application code mismatch"; break; + case 0x3009: what="current session not fixated for append"; break; + case 0x3201: what="defect list update failure"; break; + case 0x3400: what="enclosure failure"; break; + case 0x3500: what="enclosure services failure"; break; + case 0x3502: what="enclosure services unavailable"; break; + case 0x3503: what="enclosure services transfer failure"; break; + case 0x3504: what="enclosure services transfer refused"; break; + case 0x3B0F: what="end of medium reached"; break; + case 0x3F02: what="changed operating definition"; break; + case 0x4100: what="data path failure (should use 40 NN)"; break; + case 0x4A00: what="command phase error"; break; + case 0x4B00: what="data phase error"; break; + case 0x5100: what="erase failure"; break; + case 0x5200: what="cartridge fault"; break; + case 0x6300: what="end of user area encountered on this track"; break; + case 0x6600: what="automatic document feeder cover up"; break; + case 0x6601: what="automatic document feeder lift up"; break; + case 0x6602: what="document jam in auto doc feeder"; break; + case 0x6603: what="document miss feed auto in doc feeder"; break; + case 0x6700: what="configuration failure"; break; + case 0x6701: what="configuration of incapable LUN's failed"; break; + case 0x6702: what="add logical unit failed"; break; + case 0x6706: what="attachment of logical unit failed"; break; + case 0x6707: what="creation of logical unit failed"; break; + case 0x6900: what="data loss on logical unit"; break; + case 0x6E00: what="command to logical unit failed"; break; + case 0x7100: what="decompression exception long algorithm ID"; break; + case 0x7204: what="empty or partially written reserved track"; break; + case 0x7300: what="CD control error"; break; + + default: + if (asc==0x40) { + US_DEBUGP("%s: diagnostic failure on component" + " %02X\n", keystr, ascq); + return; + } + if (asc==0x70) { + US_DEBUGP("%s: decompression exception short" + " algorithm ID of %02X\n", keystr, ascq); + return; + } + what = "(unknown ASC/ASCQ)"; + } + + US_DEBUGP("%s: %s\n", keystr, what); } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/usb/storage/debug.h linux/drivers/usb/storage/debug.h --- v2.4.0-test8/linux/drivers/usb/storage/debug.h Fri Sep 8 13:27:12 2000 +++ linux/drivers/usb/storage/debug.h Fri Sep 8 16:39:12 2000 @@ -1,7 +1,7 @@ /* Driver for USB Mass Storage compliant devices * Debugging Functions Header File * - * $Id: debug.h,v 1.4 2000/08/25 00:13:51 mdharm Exp $ + * $Id: debug.h,v 1.5 2000/09/04 02:12:47 groovyjava Exp $ * * Current development and maintenance by: * (c) 1999, 2000 Matthew Dharm (mdharm-usb@one-eyed-alien.net) @@ -55,6 +55,8 @@ #ifdef CONFIG_USB_STORAGE_DEBUG void usb_stor_show_command(Scsi_Cmnd *srb); void usb_stor_print_Scsi_Cmnd( Scsi_Cmnd* cmd ); +void usb_stor_show_sense( unsigned char key, + unsigned char asc, unsigned char ascq ); #define US_DEBUGP(x...) printk( KERN_DEBUG USB_STORAGE ## x ) #define US_DEBUGPX(x...) printk( ## x ) #define US_DEBUG(x) x diff -u --recursive --new-file v2.4.0-test8/linux/drivers/usb/storage/freecom.c linux/drivers/usb/storage/freecom.c --- v2.4.0-test8/linux/drivers/usb/storage/freecom.c Fri Sep 8 13:27:12 2000 +++ linux/drivers/usb/storage/freecom.c Fri Sep 8 16:39:12 2000 @@ -1,6 +1,6 @@ /* Driver for Freecom USB/IDE adaptor * - * $Id: freecom.c,v 1.7 2000/08/25 00:13:51 mdharm Exp $ + * $Id: freecom.c,v 1.8 2000/08/29 14:49:15 dlbrown Exp $ * * Freecom v0.1: * @@ -28,11 +28,13 @@ * (http://www.freecom.de/) */ +#include #include "transport.h" #include "protocol.h" #include "usb.h" #include "debug.h" #include "freecom.h" +#include "linux/hdreg.h" static void pdump (void *, int); @@ -56,6 +58,18 @@ __u8 Pad[58]; }; +struct freecom_ide_out { + __u8 Type; /* Type + IDE register. */ + __u8 Pad; + __u16 Value; /* Value to write. */ + __u8 Pad2[60]; +}; + +struct freecom_ide_in { + __u8 Type; /* Type | IDE register. */ + __u8 Pad[63]; +}; + struct freecom_status { __u8 Status; __u8 Reason; @@ -63,17 +77,123 @@ __u8 Pad[60]; }; +/* Freecom stuffs the interrupt status in the INDEX_STAT bit of the ide + * register. */ +#define FCM_INT_STATUS INDEX_STAT + /* These are the packet types. The low bit indicates that this command * should wait for an interrupt. */ #define FCM_PACKET_ATAPI 0x21 /* Receive data from the IDE interface. The ATAPI packet has already * waited, so the data should be immediately available. */ -#define FCM_PACKET_INPUT 0x90 +#define FCM_PACKET_INPUT 0x81 + +/* Write a value to an ide register. Or the ide register to write after + * munging the addres a bit. */ +#define FCM_PACKET_IDE_WRITE 0x40 +#define FCM_PACKET_IDE_READ 0xC0 /* All packets (except for status) are 64 bytes long. */ #define FCM_PACKET_LENGTH 64 +/* Write a value to an ide register. */ +static int +freecom_ide_write (struct us_data *us, int reg, int value) +{ + freecom_udata_t extra = (freecom_udata_t) us->extra; + struct freecom_ide_out *ideout = + (struct freecom_ide_out *) extra->buffer; + int opipe; + int result, partial; + + printk (KERN_DEBUG "IDE out 0x%02x <- 0x%02x\n", reg, value); + + /* Get handles for both transports. */ + opipe = usb_sndbulkpipe (us->pusb_dev, us->ep_out); + + if (reg < 0 || reg > 8) + return USB_STOR_TRANSPORT_ERROR; + if (reg < 8) + reg |= 0x20; + else + reg = 0x0e; + + ideout->Type = FCM_PACKET_IDE_WRITE | reg; + ideout->Pad = 0; + ideout->Value = cpu_to_le16 (value); + memset (ideout->Pad2, 0, sizeof (ideout->Pad2)); + + result = usb_stor_bulk_msg (us, ideout, opipe, + FCM_PACKET_LENGTH, &partial); + if (result != 0) { + if (result == -ENOENT) + return US_BULK_TRANSFER_ABORTED; + else + return USB_STOR_TRANSPORT_ERROR; + } + + return USB_STOR_TRANSPORT_GOOD; +} + +/* Read a value from an ide register. */ +static int +freecom_ide_read (struct us_data *us, int reg, int *value) +{ + freecom_udata_t extra = (freecom_udata_t) us->extra; + struct freecom_ide_in *idein = + (struct freecom_ide_in *) extra->buffer; + __u8 *buffer = extra->buffer; + int ipipe, opipe; + int result, partial; + int desired_length; + + /* Get handles for both transports. */ + opipe = usb_sndbulkpipe (us->pusb_dev, us->ep_out); + ipipe = usb_rcvbulkpipe (us->pusb_dev, us->ep_in); + + if (reg < 0 || reg > 8) + return USB_STOR_TRANSPORT_ERROR; + if (reg < 8) + reg |= 0x10; + else + reg = 0x0e; + + idein->Type = FCM_PACKET_IDE_READ | reg; + memset (idein->Pad, 0, sizeof (idein->Pad)); + + result = usb_stor_bulk_msg (us, idein, opipe, + FCM_PACKET_LENGTH, &partial); + if (result != 0) { + if (result == -ENOENT) + return US_BULK_TRANSFER_ABORTED; + else + return USB_STOR_TRANSPORT_ERROR; + } + + desired_length = 1; + if (reg == 0x10) + desired_length = 2; + + result = usb_stor_bulk_msg (us, buffer, ipipe, + desired_length, &partial); + if (result != 0) { + if (result == -ENOENT) + return US_BULK_TRANSFER_ABORTED; + else + return USB_STOR_TRANSPORT_ERROR; + } + + if (desired_length == 1) + *value = buffer[0]; + else + *value = le16_to_cpu (*(__u16 *) buffer); + + printk (KERN_DEBUG "IDE in 0x%02x -> 0x%02x\n", reg, *value); + + return USB_STOR_TRANSPORT_GOOD; +} + static int freecom_readdata (Scsi_Cmnd *srb, struct us_data *us, int ipipe, int opipe, int count) @@ -83,6 +203,7 @@ (struct freecom_xfer_wrap *) extra->buffer; int result, partial; int offset; + int this_read; __u8 *buffer = extra->buffer; fxfr->Type = FCM_PACKET_INPUT | 0x00; @@ -118,6 +239,14 @@ offset = 0; while (offset < count) { +#if 0 + this_read = count - offset; + if (this_read > 64) + this_read = 64; +#else + this_read = 64; +#endif + printk (KERN_DEBUG "Start of read\n"); /* Use the given buffer directly, but only if there * is space for an entire packet. */ @@ -125,7 +254,7 @@ if (offset + 64 <= srb->request_bufflen) { result = usb_stor_bulk_msg ( us, srb->request_buffer+offset, - ipipe, 64, &partial); + ipipe, this_read, &partial); printk (KERN_DEBUG "Read111 = %d, %d\n", result, partial); pdump (srb->request_buffer+offset, @@ -133,7 +262,7 @@ } else { result = usb_stor_bulk_msg ( us, buffer, - ipipe, 64, &partial); + ipipe, this_read, &partial); printk (KERN_DEBUG "Read112 = %d, %d\n", result, partial); memcpy (srb->request_buffer+offset, @@ -156,7 +285,7 @@ return USB_STOR_TRANSPORT_ERROR; } - offset += 64; + offset += this_read; } } @@ -178,17 +307,6 @@ int length; freecom_udata_t extra; - /* Allocate a buffer for us. The upper usb transport code will - * free this for us when cleaning up. */ - if (us->extra == NULL) { - us->extra = kmalloc (sizeof (struct freecom_udata), - GFP_KERNEL); - if (us->extra == NULL) { - printk (KERN_WARNING USB_STORAGE "Out of memory\n"); - return USB_STOR_TRANSPORT_ERROR; - } - } - extra = (freecom_udata_t) us->extra; fcb = (struct freecom_cb_wrap *) extra->buffer; @@ -250,7 +368,7 @@ if (partial != 4 || result != 0) { return USB_STOR_TRANSPORT_ERROR; } - if ((fst->Reason & 1) != 0) { + if ((fst->Status & 1) != 0) { printk (KERN_DEBUG "operation failed\n"); return USB_STOR_TRANSPORT_FAILED; } @@ -274,9 +392,34 @@ switch (us->srb->sc_data_direction) { case SCSI_DATA_READ: + /* Make sure that the status indicates that the device + * wants data as well. */ + if ((fst->Status & DRQ_STAT) == 0 || (fst->Reason & 3) != 2) { + printk (KERN_DEBUG "SCSI wants data, drive doesn't have any\n"); + return USB_STOR_TRANSPORT_FAILED; + } result = freecom_readdata (srb, us, ipipe, opipe, length); if (result != USB_STOR_TRANSPORT_GOOD) return result; + + printk (KERN_DEBUG "FCM: Waiting for status\n"); + result = usb_stor_bulk_msg (us, fst, ipipe, + FCM_PACKET_LENGTH, &partial); + if (result == -ENOENT) { + US_DEBUGP ("freecom_transport: transfer aborted\n"); + return US_BULK_TRANSFER_ABORTED; + } + if (partial != 4 || result != 0) + return USB_STOR_TRANSPORT_ERROR; + if ((fst->Status & ERR_STAT) != 0) { + printk (KERN_DEBUG "operation failed\n"); + return USB_STOR_TRANSPORT_FAILED; + } + if ((fst->Reason & 3) != 3) { + printk (KERN_DEBUG "Drive seems still hungry\n"); + return USB_STOR_TRANSPORT_FAILED; + } + printk (KERN_DEBUG "Transfer happy\n"); break; default: @@ -310,6 +453,63 @@ srb->sc_data_direction); return USB_STOR_TRANSPORT_ERROR; +} + +int +freecom_init (struct us_data *us) +{ + int result, value; + int counter; + + /* Allocate a buffer for us. The upper usb transport code will + * free this for us when cleaning up. */ + if (us->extra == NULL) { + us->extra = kmalloc (sizeof (struct freecom_udata), + GFP_KERNEL); + if (us->extra == NULL) { + printk (KERN_WARNING USB_STORAGE "Out of memory\n"); + return USB_STOR_TRANSPORT_ERROR; + } + } + + result = freecom_ide_write (us, 0x06, 0xA0); + if (result != USB_STOR_TRANSPORT_GOOD) + return result; + result = freecom_ide_write (us, 0x01, 0x00); + if (result != USB_STOR_TRANSPORT_GOOD) + return result; + + counter = 50; + do { + result = freecom_ide_read (us, 0x07, &value); + if (result != USB_STOR_TRANSPORT_GOOD) + return result; + if (counter-- < 0) { + printk (KERN_WARNING USB_STORAGE "Timeout in freecom"); + return USB_STOR_TRANSPORT_ERROR; + } + } while ((value & 0x80) != 0); + + result = freecom_ide_write (us, 0x07, 0x08); + if (result != USB_STOR_TRANSPORT_GOOD) + return result; + + counter = 50; + do { + result = freecom_ide_read (us, 0x07, &value); + if (result != USB_STOR_TRANSPORT_GOOD) + return result; + if (counter-- < 0) { + printk (KERN_WARNING USB_STORAGE "Timeout in freecom"); + return USB_STOR_TRANSPORT_ERROR; + } + } while ((value & 0x80) != 0); + + result = freecom_ide_write (us, 0x08, 0x08); + if (result != USB_STOR_TRANSPORT_GOOD) + return result; + + return USB_STOR_TRANSPORT_GOOD; } int usb_stor_freecom_reset(struct us_data *us) diff -u --recursive --new-file v2.4.0-test8/linux/drivers/usb/storage/freecom.h linux/drivers/usb/storage/freecom.h --- v2.4.0-test8/linux/drivers/usb/storage/freecom.h Fri Sep 8 13:27:12 2000 +++ linux/drivers/usb/storage/freecom.h Fri Sep 8 16:39:12 2000 @@ -1,6 +1,6 @@ /* Driver for Freecom USB/IDE adaptor * - * $Id: freecom.h,v 1.3 2000/08/25 00:13:51 mdharm Exp $ + * $Id: freecom.h,v 1.4 2000/08/29 14:49:15 dlbrown Exp $ * * Freecom v0.1: * @@ -31,5 +31,6 @@ extern int freecom_transport(Scsi_Cmnd *srb, struct us_data *us); extern int usb_stor_freecom_reset(struct us_data *us); +extern int freecom_init (struct us_data *us); #endif diff -u --recursive --new-file v2.4.0-test8/linux/drivers/usb/storage/initializers.c linux/drivers/usb/storage/initializers.c --- v2.4.0-test8/linux/drivers/usb/storage/initializers.c Wed Dec 31 16:00:00 1969 +++ linux/drivers/usb/storage/initializers.c Fri Sep 8 16:39:12 2000 @@ -0,0 +1,60 @@ +/* Special Initializers for certain USB Mass Storage devices + * + * $Id: initializers.c,v 1.2 2000/09/06 22:35:57 mdharm Exp $ + * + * Current development and maintenance by: + * (c) 1999, 2000 Matthew Dharm (mdharm-usb@one-eyed-alien.net) + * + * This driver is based on the 'USB Mass Storage Class' document. This + * describes in detail the protocol used to communicate with such + * devices. Clearly, the designers had SCSI and ATAPI commands in + * mind when they created this document. The commands are all very + * similar to commands in the SCSI-II and ATAPI specifications. + * + * It is important to note that in a number of cases this class + * exhibits class-specific exemptions from the USB specification. + * Notably the usage of NAK, STALL and ACK differs from the norm, in + * that they are used to communicate wait, failed and OK on commands. + * + * Also, for certain devices, the interrupt endpoint is used to convey + * status of a command. + * + * Please see http://www.one-eyed-alien.net/~mdharm/linux-usb for more + * information about this driver. + * + * 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, 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. + */ + +#include "initializers.h" +#include "debug.h" + +/* This places the Shuttle/SCM USB<->SCSI bridge devices in multi-target + * mode */ +int usb_stor_euscsi_init(struct us_data *us) +{ + unsigned char data = 0x1; + int result; + + US_DEBUGP("Attempting to init eUSCSI bridge...\n"); + result = usb_control_msg(us->pusb_dev, usb_sndctrlpipe(us->pusb_dev, 0), + 0x0C, USB_RECIP_INTERFACE | USB_TYPE_VENDOR, + 0x01, 0x0, &data, 0x1, 5*HZ); + US_DEBUGP("-- result is %d\n", result); + US_DEBUGP("-- data afterwards is %d\n", data); + + return 0; +} + + diff -u --recursive --new-file v2.4.0-test8/linux/drivers/usb/storage/initializers.h linux/drivers/usb/storage/initializers.h --- v2.4.0-test8/linux/drivers/usb/storage/initializers.h Wed Dec 31 16:00:00 1969 +++ linux/drivers/usb/storage/initializers.h Fri Sep 8 16:39:12 2000 @@ -0,0 +1,44 @@ +/* Header file for Special Initializers for certain USB Mass Storage devices + * + * $Id: initializers.h,v 1.1 2000/08/29 23:07:02 mdharm Exp $ + * + * Current development and maintenance by: + * (c) 1999, 2000 Matthew Dharm (mdharm-usb@one-eyed-alien.net) + * + * This driver is based on the 'USB Mass Storage Class' document. This + * describes in detail the protocol used to communicate with such + * devices. Clearly, the designers had SCSI and ATAPI commands in + * mind when they created this document. The commands are all very + * similar to commands in the SCSI-II and ATAPI specifications. + * + * It is important to note that in a number of cases this class + * exhibits class-specific exemptions from the USB specification. + * Notably the usage of NAK, STALL and ACK differs from the norm, in + * that they are used to communicate wait, failed and OK on commands. + * + * Also, for certain devices, the interrupt endpoint is used to convey + * status of a command. + * + * Please see http://www.one-eyed-alien.net/~mdharm/linux-usb for more + * information about this driver. + * + * 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, 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. + */ + +#include "usb.h" + +/* This places the Shuttle/SCM USB<->SCSI bridge devices in multi-target + * mode */ +int usb_stor_euscsi_init(struct us_data *us); diff -u --recursive --new-file v2.4.0-test8/linux/drivers/usb/storage/protocol.c linux/drivers/usb/storage/protocol.c --- v2.4.0-test8/linux/drivers/usb/storage/protocol.c Fri Sep 8 13:27:12 2000 +++ linux/drivers/usb/storage/protocol.c Fri Sep 8 16:39:12 2000 @@ -1,6 +1,6 @@ /* Driver for USB Mass Storage compliant devices * - * $Id: protocol.c,v 1.5 2000/08/25 00:13:51 mdharm Exp $ + * $Id: protocol.c,v 1.6 2000/09/01 22:03:55 mdharm Exp $ * * Current development and maintenance by: * (c) 1999, 2000 Matthew Dharm (mdharm-usb@one-eyed-alien.net) @@ -170,7 +170,7 @@ usb_stor_invoke_transport(srb, us); /* Fix the MODE_SENSE data if we translated the command */ - if ((old_cmnd == MODE_SENSE) && (srb->result == GOOD)) + if ((old_cmnd == MODE_SENSE) && (status_byte(srb->result) == GOOD)) usb_stor_scsiSense10to6(srb); /* fix the INQUIRY data if necessary */ @@ -265,7 +265,7 @@ usb_stor_invoke_transport(srb, us); /* Fix the MODE_SENSE data if we translated the command */ - if ((old_cmnd == MODE_SENSE) && (srb->result == GOOD)) + if ((old_cmnd == MODE_SENSE) && (status_byte(srb->result) == GOOD)) usb_stor_scsiSense10to6(srb); /* Fix the data for an INQUIRY, if necessary */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/usb/storage/scsiglue.c linux/drivers/usb/storage/scsiglue.c --- v2.4.0-test8/linux/drivers/usb/storage/scsiglue.c Fri Sep 8 13:27:12 2000 +++ linux/drivers/usb/storage/scsiglue.c Fri Sep 8 16:39:12 2000 @@ -1,7 +1,7 @@ /* Driver for USB Mass Storage compliant devices * SCSI layer glue code * - * $Id: scsiglue.c,v 1.9 2000/08/25 00:13:51 mdharm Exp $ + * $Id: scsiglue.c,v 1.10 2000/08/30 01:22:42 mdharm Exp $ * * Current development and maintenance by: * (c) 1999, 2000 Matthew Dharm (mdharm-usb@one-eyed-alien.net) @@ -189,12 +189,6 @@ return SUCCESS; } - /* This is a sanity check that we should never hit */ - if (in_interrupt()) { - printk(KERN_ERR "usb-storage: command_abort() called from an interrupt!!! BAD!!! BAD!! BAD!!\n"); - return FAILED; - } - /* if we have an urb pending, let's wake the control thread up */ if (us->current_urb->status == -EINPROGRESS) { /* cancel the URB */ @@ -213,18 +207,63 @@ return FAILED; } -/* FIXME: this doesn't do anything right now */ +/* This invokes the transport reset mechanism to reset the state of the + * device */ +static int device_reset( Scsi_Cmnd *srb ) +{ + struct us_data *us = (struct us_data *)srb->host->hostdata[0]; + + US_DEBUGP("device_reset() called\n" ); + return us->transport_reset(us); +} + +/* This resets the device port, and simulates the device + * disconnect/reconnect for all drivers which have claimed other + * interfaces. */ static int bus_reset( Scsi_Cmnd *srb ) { - // struct us_data *us = (struct us_data *)srb->host->hostdata[0]; + struct us_data *us = (struct us_data *)srb->host->hostdata[0]; + int result; + int i; - printk(KERN_CRIT "usb-storage: bus_reset() requested but not implemented\n" ); - US_DEBUGP("Bus reset requested\n"); - // us->transport_reset(us); - return FAILED; + /* we use the usb_reset_device() function to handle this for us */ + US_DEBUGP("bus_reset() called\n"); + result = usb_reset_device(us->pusb_dev) ? FAILED : SUCCESS; + + /* did the reset work? */ + if (result < 0) + return FAILED; + + /* FIXME: This needs to lock out driver probing while it's working + * or we can have race conditions */ + for (i = 0; i < us->pusb_dev->actconfig->bNumInterfaces; i++) { + struct usb_interface *intf = + &us->pusb_dev->actconfig->interface[i]; + + US_DEBUGP("Examinging driver %s...", intf->driver->name); + /* skip interfaces which we've claimed */ + if (intf->driver && !strncmp(intf->driver->name, + "usb-storage", 12)) { + US_DEBUGPX("skipping.\n"); + continue; + } + + /* simulate a disconnect and reconnect for all interfaces */ + if (intf->driver) { + US_DEBUGPX("simulating disconnect/reconnect.\n"); + down(&intf->driver->serialize); + intf->driver->disconnect(us->pusb_dev, + intf->private_data); + intf->driver->probe(us->pusb_dev, i); + up(&intf->driver->serialize); + } + } + + US_DEBUGP("bus_reset() complete\n"); + return SUCCESS; } -/* FIXME: This doesn't actually reset anything */ +/* FIXME: This doesn't do anything right now */ static int host_reset( Scsi_Cmnd *srb ) { printk(KERN_CRIT "usb-storage: host_reset() requested but not implemented\n" ); @@ -313,7 +352,7 @@ queuecommand: queuecommand, eh_abort_handler: command_abort, - eh_device_reset_handler:bus_reset, + eh_device_reset_handler:device_reset, eh_bus_reset_handler: bus_reset, eh_host_reset_handler: host_reset, diff -u --recursive --new-file v2.4.0-test8/linux/drivers/usb/storage/shuttle_usbat.c linux/drivers/usb/storage/shuttle_usbat.c --- v2.4.0-test8/linux/drivers/usb/storage/shuttle_usbat.c Fri Sep 8 13:27:12 2000 +++ linux/drivers/usb/storage/shuttle_usbat.c Fri Sep 8 16:39:12 2000 @@ -1,6 +1,6 @@ /* Driver for SCM Microsystems USB-ATAPI cable * - * $Id: shuttle_usbat.c,v 1.4 2000/08/25 00:13:51 mdharm Exp $ + * $Id: shuttle_usbat.c,v 1.7 2000/09/04 02:08:42 groovyjava Exp $ * * SCM driver v0.2: * @@ -68,6 +68,8 @@ #define LSB_of(s) ((s)&0xFF) #define MSB_of(s) ((s)>>8) +int transferred = 0; + /* * Send a control message and wait for the response. * @@ -192,7 +194,7 @@ if (result == -EPIPE) { US_DEBUGP("usbat_raw_bulk():" " output pipe stalled\n"); - return USB_STOR_TRANSPORT_FAILED; + return US_BULK_TRANSFER_SHORT; } /* the catch-all case */ @@ -225,13 +227,13 @@ int result = USB_STOR_TRANSPORT_GOOD; int transferred = 0; - unsigned char execute[8] = { - 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - }; + // unsigned char execute[8] = { + // 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + // }; int i; struct scatterlist *sg; - char string[64]; - int pipe; + // char string[64]; + // int pipe; /* if (command_len != 0) { @@ -262,10 +264,10 @@ if (command_len != 0) direction = (command[0]&0x80) ? SCSI_DATA_READ : SCSI_DATA_WRITE; - +/* if (direction == SCSI_DATA_WRITE) { - /* Debug-print the first 48 bytes of the write transfer */ + // Debug-print the first 48 bytes of the write transfer if (!use_sg) { string[0] = 0; @@ -281,7 +283,7 @@ US_DEBUGP("%s\n", string); } } - +*/ US_DEBUGP("SCM data %s transfer %d sg buffers %d\n", ( direction==SCSI_DATA_READ ? "in" : "out"), @@ -311,9 +313,9 @@ unsigned char *content) { int result; - unsigned char command[8] = { - 0xC0, access, reg, 0x00, 0x00, 0x00, 0x00, 0x00 - }; + // unsigned char command[8] = { + // 0xC0, access, reg, 0x00, 0x00, 0x00, 0x00, 0x00 + // }; result = usbat_send_control(us, usb_rcvctrlpipe(us->pusb_dev,0), @@ -335,9 +337,9 @@ unsigned char content) { int result; - unsigned char command[8] = { - 0x40, access|0x01, reg, content, 0x00, 0x00, 0x00, 0x00 - }; + // unsigned char command[8] = { + // 0x40, access|0x01, reg, content, 0x00, 0x00, 0x00, 0x00 + // }; result = usbat_send_control(us, usb_sndctrlpipe(us->pusb_dev,0), @@ -427,11 +429,14 @@ unsigned char status; /* Synchronizing cache on a CDR could take a heck of a long time, - but probably not more than 15 minutes or so */ + but probably not more than 10 minutes or so */ + + for (i=0; i<1800; i++) { - for (i=0; i<500; i++) { result = usbat_read(us, USBAT_ATA, 0x17, &status); - US_DEBUGP("SCM: Write ATA data status is %02X\n", status); + + // US_DEBUGP("SCM: Write ATA data status is %02X\n", status); + if (result!=USB_STOR_TRANSPORT_GOOD) return result; if (status&0x01) // check condition @@ -440,19 +445,21 @@ return USB_STOR_TRANSPORT_FAILED; if ((status&0x80)!=0x80) // not busy break; - if (i<5) - wait_ms(100); - else if (i<20) - wait_ms(500); - else if (i<49) - wait_ms(1000); - else if (i<499) - wait_ms(2000); + + if (i<500) + wait_ms(10); // 5 seconds + else if (i<700) + wait_ms(50); // 10 seconds + else if (i<1200) + wait_ms(100); // 50 seconds + else if (i<1800) + wait_ms(1000); // 10 minutes } - if (i==500) + if (i==1800) return USB_STOR_TRANSPORT_FAILED; + US_DEBUGP("Waited not busy for %d steps\n", i); return USB_STOR_TRANSPORT_GOOD; } @@ -493,15 +500,16 @@ return usbat_wait_not_busy(us); } -int usbat_write_block_test(struct us_data *us, +int usbat_rw_block_test(struct us_data *us, unsigned char access, unsigned char *registers, unsigned char *data_out, unsigned short num_registers, unsigned char data_reg, unsigned char status_reg, - unsigned char qualifier, unsigned char timeout, + unsigned char qualifier, + int direction, unsigned char *content, unsigned short len, int use_sg) { @@ -509,91 +517,129 @@ int result; // Not really sure the 0x07, 0x17, 0xfc, 0xe7 is necessary here, - // but that's what came out of the trace. + // but that's what came out of the trace every single time. unsigned char command[16] = { 0x40, access|0x07, 0x07, 0x17, 0xfc, 0xe7, LSB_of(num_registers*2), MSB_of(num_registers*2), - 0x40, access|0x05, data_reg, status_reg, - qualifier, timeout, LSB_of(len), MSB_of(len) + (direction==SCSI_DATA_WRITE ? 0x40 : 0xC0), + access|(direction==SCSI_DATA_WRITE ? 0x05 : 0x04), + data_reg, status_reg, + timeout, qualifier, LSB_of(len), MSB_of(len) }; + int i; unsigned char data[num_registers*2]; - int transferred; - struct scatterlist *sg; - char string[64]; + unsigned char status; for (i=0; ipusb_dev,0), - 0x80, - 0x40, - 0, - 0, - command, - 16); - - if (result != USB_STOR_TRANSPORT_GOOD) - return result; + for (i=0; i<20; i++) { - result = usbat_bulk_transport(us, - NULL, 0, SCSI_DATA_WRITE, data, num_registers*2, 0); - - // result = usbat_bulk_transport(us, - // command, 16, 0, data, num_registers*2, 0); + /* + * The first time we send the full command, which consists + * of downloading the SCSI command followed by downloading + * the data via a write-and-test. Any other time we only + * send the command to download the data -- the SCSI command + * is still 'active' in some sense in the device. + * + * We're only going to try sending the data 10 times. After + * that, we just return a failure. + */ + + result = usbat_send_control(us, + usb_sndctrlpipe(us->pusb_dev,0), + 0x80, + 0x40, + 0, + 0, + (i==0 ? command : command+8), + (i==0 ? 16 : 8)); - if (result!=USB_STOR_TRANSPORT_GOOD) - return result; + if (result != USB_STOR_TRANSPORT_GOOD) + return result; - // transferred = 0; + if (i==0) { - US_DEBUGP("Transfer out %d bytes, sg buffers %d\n", - len, use_sg); + result = usbat_bulk_transport(us, + NULL, 0, SCSI_DATA_WRITE, + data, num_registers*2, 0); - result = usbat_bulk_transport(us, - NULL, 0, SCSI_DATA_WRITE, content, len, use_sg); + if (result!=USB_STOR_TRANSPORT_GOOD) + return result; -/* - if (!use_sg) { + } - // Debug-print the first 48 bytes of the transfer - string[0] = 0; - for (i=0; ipusb_dev, + usb_sndbulkpipe(us->pusb_dev, + us->ep_out)); + /* + * Read status: is the device angry, or just busy? + */ + + result = usbat_read(us, USBAT_ATA, + direction==SCSI_DATA_WRITE ? 0x17 : 0x0E, + &status); + + if (result!=USB_STOR_TRANSPORT_GOOD) + return result; + if (status&0x01) // check condition + return USB_STOR_TRANSPORT_FAILED; + if (status&0x20) // device fault + return USB_STOR_TRANSPORT_FAILED; - result = usbat_raw_bulk(us, SCSI_DATA_WRITE, content, len); + US_DEBUGP("Redoing %s\n", + direction==SCSI_DATA_WRITE ? "write" : "read"); - } else { + } else if (result != US_BULK_TRANSFER_GOOD) + return result; + else + return usbat_wait_not_busy(us); - sg = (struct scatterlist *)content; - for (i=0; i sg[i].length ? - sg[i].length : len-transferred); - if (result!=US_BULK_TRANSFER_GOOD) - break; - transferred += sg[i].length; - } } -*/ - if (result!=USB_STOR_TRANSPORT_GOOD) - return result; - return usbat_wait_not_busy(us); + US_DEBUGP("Bummer! %s bulk data 10 times failed.\n", + direction==SCSI_DATA_WRITE ? "Writing" : "Reading"); + + return USB_STOR_TRANSPORT_FAILED; } int usbat_multiple_write(struct us_data *us, @@ -642,9 +688,9 @@ int usbat_read_user_io(struct us_data *us, unsigned char *data_flags) { - unsigned char command[8] = { - 0xC0, 0x82, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - }; + // unsigned char command[8] = { + // 0xC0, 0x82, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + // }; int result; result = usbat_send_control(us, @@ -665,9 +711,9 @@ unsigned char enable_flags, unsigned char data_flags) { - unsigned char command[8] = { - 0x40, 0x82, enable_flags, data_flags, 0x00, 0x00, 0x00, 0x00 - }; + // unsigned char command[8] = { + // 0x40, 0x82, enable_flags, data_flags, 0x00, 0x00, 0x00, 0x00 + // }; int result; result = usbat_send_control(us, @@ -882,18 +928,18 @@ h = return length/2048 in cmnd[7-8]. */ - static char *lengths = + // static char *lengths = /* 0123456789ABCDEF 0123456789ABCDEF */ - "0XXL0XXXXXXXXXXX" "XXLXXXXXXXX0XX0X" /* 00-1F */ - "XXXXX8XXhXH0XXX0" "XXXXX0XXXXXXXXXX" /* 20-3F */ - "XXHHL0X0XXH0XX0X" "XHH00HXX0TH0H0XX" /* 40-5F */ - "XXXXXXXXXXXXXXXX" "XXXXXXXXXXXXXXXX" /* 60-7F */ - "XXXXXXXXXXXXXXXX" "XXXXXXXXXXXXXXXX" /* 80-9F */ - "X0XXX0XXDXDXXXXX" "XXXXXXXXX000XHBX" /* A0-BF */ - "XXXXXXXXXXXXXXXX" "XXXXXXXXXXXXXXXX" /* C0-DF */ - "XDXXXXXXXXXXXXXX" "XXW00HXXXXXXXXXX"; /* E0-FF */ + // "0XXL0XXXXXXXXXXX" "XXLXXXXXXXX0XX0X" /* 00-1F */ + // "XXXXX8XXhXH0XXX0" "XXXXX0XXXXXXXXXX" /* 20-3F */ + // "XXHHL0X0XXH0XX0X" "XHH00HXX0TH0H0XX" /* 40-5F */ + // "XXXXXXXXXXXXXXXX" "XXXXXXXXXXXXXXXX" /* 60-7F */ + // "XXXXXXXXXXXXXXXX" "XXXXXXXXXXXXXXXX" /* 80-9F */ + // "X0XXX0XXDXDXXXXX" "XXXXXXXXX000XHBX" /* A0-BF */ + // "XXXXXXXXXXXXXXXX" "XXXXXXXXXXXXXXXX" /* C0-DF */ + // "XDXXXXXXXXXXXXXX" "XXW00HXXXXXXXXXX"; /* E0-FF */ /* if (us->flags & US_FL_NEED_INIT) { US_DEBUGP("8200e: initializing\n"); @@ -986,16 +1032,36 @@ data[5] = 0xB0; // (device sel) = slave data[6] = 0xA0; // (command) = ATA PACKET COMMAND + for (i=7; i<19; i++) { + registers[i] = 0x10; + data[i] = (i-7 >= srb->cmd_len) ? 0 : srb->cmnd[i-7]; + } + + if (srb->cmnd[0] == TEST_UNIT_READY) + transferred = 0; + if (srb->sc_data_direction == SCSI_DATA_WRITE) { - for (i=7; i<19; i++) { - registers[i] = 0x10; - data[i] = (i-7 >= srb->cmd_len) ? 0 : srb->cmnd[i-7]; + result = usbat_rw_block_test(us, USBAT_ATA, + registers, data, 19, + 0x10, 0x17, 0xFD, 0x30, + SCSI_DATA_WRITE, + srb->request_buffer, + len, srb->use_sg); + + if (result == USB_STOR_TRANSPORT_GOOD) { + transferred += len; + US_DEBUGP("Wrote %08X bytes\n", transferred); } - result = usbat_write_block_test(us, USBAT_ATA, + return result; + + } else if (srb->cmnd[0] == READ_10) { + + result = usbat_rw_block_test(us, USBAT_ATA, registers, data, 19, 0x10, 0x17, 0xFD, 0x30, + SCSI_DATA_READ, srb->request_buffer, len, srb->use_sg); diff -u --recursive --new-file v2.4.0-test8/linux/drivers/usb/storage/transport.c linux/drivers/usb/storage/transport.c --- v2.4.0-test8/linux/drivers/usb/storage/transport.c Fri Sep 8 13:27:12 2000 +++ linux/drivers/usb/storage/transport.c Fri Sep 8 16:39:12 2000 @@ -1,6 +1,6 @@ /* Driver for USB Mass Storage compliant devices * - * $Id: transport.c,v 1.18 2000/08/25 00:13:51 mdharm Exp $ + * $Id: transport.c,v 1.23 2000/09/08 21:20:06 mdharm Exp $ * * Current development and maintenance by: * (c) 1999, 2000 Matthew Dharm (mdharm-usb@one-eyed-alien.net) @@ -680,7 +680,7 @@ need_auto_sense = 1; } if (result == USB_STOR_TRANSPORT_ERROR) { - /* FIXME: we need to invoke a transport reset here */ + us->transport_reset(us); US_DEBUGP("-- transport indicates transport failure\n"); need_auto_sense = 0; srb->result = DID_ERROR << 16; @@ -742,7 +742,7 @@ /* issue the auto-sense command */ temp_result = us->transport(us->srb, us); if (temp_result != USB_STOR_TRANSPORT_GOOD) { - /* FIXME: we need to invoke a transport reset here */ + us->transport_reset(us); US_DEBUGP("-- auto-sense failure\n"); srb->result = DID_ERROR << 16; return; @@ -754,9 +754,15 @@ srb->sense_buffer[2] & 0xf, srb->sense_buffer[12], srb->sense_buffer[13]); +#ifdef CONFIG_USB_STORAGE_DEBUG + usb_stor_show_sense( + srb->sense_buffer[2] & 0xf, + srb->sense_buffer[12], + srb->sense_buffer[13]); +#endif /* set the result so the higher layers expect this data */ - srb->result = CHECK_CONDITION; + srb->result = CHECK_CONDITION << 1; /* we're done here, let's clean up */ srb->request_buffer = old_request_buffer; @@ -767,15 +773,15 @@ /* If things are really okay, then let's show that */ if ((srb->sense_buffer[2] & 0xf) == 0x0) - srb->result = GOOD; + srb->result = GOOD << 1; } else /* if (need_auto_sense) */ - srb->result = GOOD; + srb->result = GOOD << 1; /* Regardless of auto-sense, if we _know_ we have an error * condition, show that in the result code */ if (result == USB_STOR_TRANSPORT_FAILED) - srb->result = CHECK_CONDITION; + srb->result = CHECK_CONDITION << 1; /* If we think we're good, then make sure the sense data shows it. * This is necessary because the auto-sense for some devices always @@ -822,6 +828,9 @@ { int result; + /* Set up for status notification */ + us->ip_wanted = 1; + /* COMMAND STAGE */ /* let's send the command via the control pipe */ result = usb_stor_control_msg(us, usb_sndctrlpipe(us->pusb_dev,0), @@ -832,6 +841,9 @@ /* check the return code for the command */ US_DEBUGP("Call to usb_stor_control_msg() returned %d\n", result); if (result < 0) { + /* Reset flag for status notification */ + us->ip_wanted = 0; + /* if the command was aborted, indicate that */ if (result == -ENOENT) return USB_STOR_TRANSPORT_ABORTED; @@ -850,9 +862,6 @@ return USB_STOR_TRANSPORT_ERROR; } - /* Set up for status notification */ - us->ip_wanted = 1; - /* DATA STAGE */ /* transfer the data payload for this command, if one exists*/ if (us_transfer_length(srb)) { @@ -1167,6 +1176,9 @@ USB_TYPE_CLASS | USB_RECIP_INTERFACE, 0, us->ifnum, cmd, sizeof(cmd), HZ*5); + if (result < 0) + US_DEBUGP("CB[I] soft reset failed %d\n", result); + /* long wait for reset */ schedule_timeout(HZ*6); @@ -1177,7 +1189,8 @@ usb_rcvbulkpipe(us->pusb_dev, us->ep_out)); US_DEBUGP("CB_reset done\n"); - return 0; + /* return a result code based on the result of the control message */ + return result < 0 ? FAILED : SUCCESS; } /* This issues a Bulk-only Reset to the device in question, including @@ -1196,15 +1209,16 @@ 0, us->ifnum, NULL, 0, HZ*5); if (result < 0) - US_DEBUGP("Bulk hard reset failed %d\n", result); + US_DEBUGP("Bulk soft reset failed %d\n", result); + + /* long wait for reset */ + schedule_timeout(HZ*6); clear_halt(us->pusb_dev, usb_rcvbulkpipe(us->pusb_dev, us->ep_in)); clear_halt(us->pusb_dev, usb_sndbulkpipe(us->pusb_dev, us->ep_out)); - /* long wait for reset */ - schedule_timeout(HZ*6); - - return result; + /* return a result code based on the result of the control message */ + return result < 0 ? FAILED : SUCCESS; } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/usb/storage/transport.h linux/drivers/usb/storage/transport.h --- v2.4.0-test8/linux/drivers/usb/storage/transport.h Fri Sep 8 13:27:12 2000 +++ linux/drivers/usb/storage/transport.h Fri Sep 8 16:39:12 2000 @@ -1,7 +1,7 @@ /* Driver for USB Mass Storage compliant devices * Transport Functions Header File * - * $Id: transport.h,v 1.11 2000/08/25 00:13:51 mdharm Exp $ + * $Id: transport.h,v 1.12 2000/09/08 21:20:06 mdharm Exp $ * * Current development and maintenance by: * (c) 1999, 2000 Matthew Dharm (mdharm-usb@one-eyed-alien.net) @@ -41,8 +41,8 @@ #ifndef _TRANSPORT_H_ #define _TRANSPORT_H_ -#include #include +#include #include "usb.h" #include "scsi.h" diff -u --recursive --new-file v2.4.0-test8/linux/drivers/usb/storage/usb.c linux/drivers/usb/storage/usb.c --- v2.4.0-test8/linux/drivers/usb/storage/usb.c Fri Sep 8 13:27:12 2000 +++ linux/drivers/usb/storage/usb.c Fri Sep 8 16:39:12 2000 @@ -1,6 +1,6 @@ /* Driver for USB Mass Storage compliant devices * - * $Id: usb.c,v 1.33 2000/08/25 00:13:51 mdharm Exp $ + * $Id: usb.c,v 1.39 2000/09/08 21:20:06 mdharm Exp $ * * Current development and maintenance by: * (c) 1999, 2000 Matthew Dharm (mdharm-usb@one-eyed-alien.net) @@ -43,12 +43,12 @@ * 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include #include "usb.h" #include "scsiglue.h" #include "transport.h" #include "protocol.h" #include "debug.h" +#include "initializers.h" #ifdef CONFIG_USB_STORAGE_HP8200e #include "shuttle_usbat.h" #endif @@ -62,6 +62,7 @@ #include "freecom.h" #endif +#include #include #include #include @@ -206,7 +207,7 @@ */ if (us->srb->sc_data_direction == SCSI_DATA_UNKNOWN) { US_DEBUGP("UNKNOWN data direction\n"); - us->srb->result = DID_ERROR; + us->srb->result = DID_ERROR << 16; set_current_state(TASK_INTERRUPTIBLE); us->srb->scsi_done(us->srb); us->srb = NULL; @@ -242,7 +243,7 @@ /* handle those devices which can't do a START_STOP */ if ((us->srb->cmnd[0] == START_STOP) && (us->flags & US_FL_START_STOP)) { - us->srb->result = GOOD; + us->srb->result = GOOD << 1; set_current_state(TASK_INTERRUPTIBLE); us->srb->scsi_done(us->srb); @@ -264,12 +265,12 @@ memcpy(us->srb->request_buffer, usb_stor_sense_notready, sizeof(usb_stor_sense_notready)); - us->srb->result = GOOD; + us->srb->result = GOOD << 1; } else { memcpy(us->srb->sense_buffer, usb_stor_sense_notready, sizeof(usb_stor_sense_notready)); - us->srb->result = CHECK_CONDITION; + us->srb->result = CHECK_CONDITION << 1; } } else { /* !us->pusb_dev */ /* we've got a command, let's do it! */ @@ -328,20 +329,6 @@ * restriction. However, if the flag is not present, then you * are free to use as many characters as you like. */ - -int euscsi_init(struct us_data *us) -{ - unsigned char bar = 0x1; - int result; - - US_DEBUGP("Attempting to init eUSCSI bridge...\n"); - result = usb_control_msg(us->pusb_dev, usb_sndctrlpipe(us->pusb_dev, 0), - 0x0C, USB_RECIP_INTERFACE | USB_TYPE_VENDOR, - 0x01, 0x0, &bar, 0x1, 5*HZ); - US_DEBUGP("-- result is %d\n", result); - US_DEBUGP("-- bar afterwards is %d\n", bar); -} - static struct us_unusual_dev us_unusual_dev_list[] = { { 0x03f0, 0x0107, 0x0200, 0x0200, @@ -367,7 +354,7 @@ { 0x04e6, 0x0002, 0x0100, 0x0100, "Shuttle", "eUSCSI Bridge", - US_SC_SCSI, US_PR_BULK, euscsi_init, + US_SC_SCSI, US_PR_BULK, usb_stor_euscsi_init, US_FL_SCM_MULT_TARG }, #ifdef CONFIG_USB_STORAGE_SDDR09 @@ -392,28 +379,34 @@ US_SC_SCSI, US_PR_CB, NULL, US_FL_SINGLE_LUN}, + { 0x04e6, 0x0007, 0x0100, 0x0200, + "Sony", + "Hifd", + US_SC_SCSI, US_PR_CB, NULL, + US_FL_SINGLE_LUN}, + { 0x04e6, 0x0009, 0x0200, 0x0200, "Shuttle", - "ATA/ATAPI Bridge", + "eUSB ATA/ATAPI Adapter", US_SC_8020, US_PR_CB, NULL, US_FL_SINGLE_LUN}, - { 0x04e6, 0x000A, 0x0200, 0x0200, + { 0x04e6, 0x000a, 0x0200, 0x0200, "Shuttle", - "Compact Flash Reader", + "eUSB CompactFlash Adapter", US_SC_8020, US_PR_CB, NULL, US_FL_SINGLE_LUN}, { 0x04e6, 0x000B, 0x0100, 0x0100, "Shuttle", "eUSCSI Bridge", - US_SC_SCSI, US_PR_BULK, euscsi_init, + US_SC_SCSI, US_PR_BULK, usb_stor_euscsi_init, US_FL_SCM_MULT_TARG }, { 0x04e6, 0x000C, 0x0100, 0x0100, "Shuttle", "eUSCSI Bridge", - US_SC_SCSI, US_PR_BULK, euscsi_init, + US_SC_SCSI, US_PR_BULK, usb_stor_euscsi_init, US_FL_SCM_MULT_TARG }, { 0x04e6, 0x0101, 0x0200, 0x0200, @@ -424,7 +417,7 @@ { 0x054c, 0x0010, 0x0210, 0x0210, "Sony", - "DSC-S30/S70", + "DSC-S30/S70/505V", US_SC_SCSI, US_PR_CB, NULL, US_FL_SINGLE_LUN | US_FL_START_STOP | US_FL_MODE_XLATE }, @@ -454,10 +447,24 @@ { 0x05ab, 0x0031, 0x0100, 0x0100, "In-System", - "USB/IDE Bridge", + "USB/IDE Bridge (ATAPI ONLY!)", US_SC_8070, US_PR_BULK, NULL, 0 }, + { 0x0644, 0x0000, 0x0100, 0x0100, + "TEAC", + "Floppy Drive", + US_SC_UFI, US_PR_CB, NULL, + 0 }, + +#ifdef CONFIG_USB_STORAGE_SDDR09 + { 0x066b, 0x0105, 0x0100, 0x0100, + "Olympus", + "Camedia MAUSB-2", + US_SC_SCSI, US_PR_EUSB_SDDR09, NULL, + US_FL_SINGLE_LUN | US_FL_START_STOP }, +#endif + { 0x0693, 0x0005, 0x0100, 0x0100, "Hagiwara", "Flashgate", @@ -493,20 +500,20 @@ { 0x07af, 0x0004, 0x0100, 0x0100, "Microtech", "USB-SCSI-DB25", - US_SC_SCSI, US_PR_BULK, euscsi_init, + US_SC_SCSI, US_PR_BULK, usb_stor_euscsi_init, US_FL_SCM_MULT_TARG }, #ifdef CONFIG_USB_STORAGE_FREECOM { 0x07ab, 0xfc01, 0x0921, 0x0921, "Freecom", "USB-IDE", - US_SC_8070, US_PR_FREECOM, NULL, US_FL_SINGLE_LUN }, + US_SC_8070, US_PR_FREECOM, freecom_init, US_FL_SINGLE_LUN }, #endif { 0x07af, 0x0005, 0x0100, 0x0100, "Microtech", "USB-SCSI-HD50", - US_SC_SCSI, US_PR_BULK, euscsi_init, + US_SC_SCSI, US_PR_BULK, usb_stor_euscsi_init, US_FL_SCM_MULT_TARG }, #ifdef CONFIG_USB_STORAGE_DPCM @@ -613,7 +620,9 @@ unsigned int flags; struct us_unusual_dev *unusual_dev; struct us_data *ss = NULL; +#ifdef CONFIG_USB_STORAGE_SDDR09 int result; +#endif /* these are temporary copies -- we test on these, then put them * in the us-data structure diff -u --recursive --new-file v2.4.0-test8/linux/drivers/usb/usb-ohci.c linux/drivers/usb/usb-ohci.c --- v2.4.0-test8/linux/drivers/usb/usb-ohci.c Fri Sep 8 13:27:12 2000 +++ linux/drivers/usb/usb-ohci.c Fri Sep 8 16:36:10 2000 @@ -2,6 +2,7 @@ * URB OHCI HCD (Host Controller Driver) for USB. * * (C) Copyright 1999 Roman Weissgaerber + * (C) Copyright 2000 David Brownell * * [ Initialisation is based on Linus' ] * [ uhci code and gregs ohci fragments ] @@ -11,6 +12,10 @@ * * History: * + * 2000/08/29 use bandwidth claiming hooks (thanks Randy!), fix some + * urb unlink probs, indentation fixes + * 2000/08/11 various oops fixes mostly affecting iso and cleanup from + * device unplugs. * 2000/06/28 use PCI hotplug framework, for better power management * and for Cardbus support (David Brownell) * 2000/earlier: fixes for NEC/Lucent chips; suspend/resume handling @@ -83,15 +88,29 @@ * URB support functions *-------------------------------------------------------------------------*/ -/* free the private part of an URB */ +/* free HCD-private data associated with this URB */ static void urb_rm_priv (urb_t * urb) { urb_priv_t * urb_priv = urb->hcpriv; int i; - if (!urb_priv) return; - + /* Release int/iso bandwidth for Interrupt or Isoc. transfers */ + if (urb->bandwidth) { + switch (usb_pipetype(urb->pipe)) { + case PIPE_INTERRUPT: + usb_release_bandwidth (urb->dev, urb, 0); + break; + case PIPE_ISOCHRONOUS: + usb_release_bandwidth (urb->dev, urb, 1); + break; + default: + break; + } + } + + if (!urb_priv) + return; for (i = 0; i < urb_priv->length; i++) { if (urb_priv->td [i]) { OHCI_FREE (urb_priv->td [i]); @@ -416,6 +435,7 @@ unsigned int pipe = urb->pipe; int i, size = 0; unsigned long flags; + int bustime = 0; if (!urb->dev || !urb->dev->bus) return -EINVAL; @@ -457,6 +477,10 @@ break; case PIPE_ISOCHRONOUS: /* number of packets from URB */ size = urb->number_of_packets; + if (size <= 0) { + usb_dec_dev_use (urb->dev); + return -EINVAL; + } for (i = 0; i < urb->number_of_packets; i++) { urb->iso_frame_desc[i].actual_length = 0; urb->iso_frame_desc[i].status = -EXDEV; @@ -468,11 +492,10 @@ break; case PIPE_INTERRUPT: /* one TD */ size = 1; - break; } - /* allocate the private part or the URB */ + /* allocate the private part of the URB */ urb_priv = kmalloc (sizeof (urb_priv_t) + size * sizeof (td_t *), in_interrupt() ? GFP_ATOMIC : GFP_KERNEL); if (!urb_priv) { @@ -487,13 +510,13 @@ urb_priv->td_cnt = 0; urb_priv->state = 0; urb_priv->ed = ed; - + /* allocate the TDs */ for (i = 0; i < size; i++) { OHCI_ALLOC (urb_priv->td[i], sizeof (td_t)); if (!urb_priv->td[i]) { - usb_dec_dev_use (urb->dev); urb_rm_priv (urb); + usb_dec_dev_use (urb->dev); return -ENOMEM; } } @@ -505,11 +528,30 @@ return -EINVAL; } - /* for ISOC transfers calculate start frame index */ - if (urb->transfer_flags & USB_ISO_ASAP) { - urb->start_frame = ((ed->state == ED_OPER)? (ed->last_iso + 1): - (le16_to_cpu (ohci->hcca.frame_no) + 10)) & 0xffff; - } + /* allocate and claim bandwidth if needed; ISO + * needs start frame index if it was't provided. + */ + switch (usb_pipetype (pipe)) { + case PIPE_ISOCHRONOUS: + if (urb->transfer_flags & USB_ISO_ASAP) { + urb->start_frame = ((ed->state == ED_OPER) + ? (ed->last_iso + 1) + : (le16_to_cpu (ohci->hcca.frame_no) + 10)) & 0xffff; + } + /* FALLTHROUGH */ + case PIPE_INTERRUPT: + if (urb->bandwidth == 0) { + bustime = usb_check_bandwidth (urb->dev, urb); + } + if (bustime < 0) { + urb_rm_priv (urb); + usb_dec_dev_use (urb->dev); + spin_unlock_irqrestore (&usb_ed_lock, flags); + return bustime; + } + usb_claim_bandwidth (urb->dev, urb, bustime, usb_pipeisoc (urb->pipe)); + } + urb->status = USB_ST_URB_PENDING; urb->actual_length = 0; @@ -573,6 +615,10 @@ urb_priv->state = URB_DEL; spin_lock_irqsave (&usb_ed_lock, flags); + + if (urb_priv->ed->state == ED_OPER) + ep_unlink(ohci, urb_priv->ed); + ep_rm_ed (urb->dev, urb_priv->ed); urb_priv->ed->state |= ED_URB_DEL; spin_unlock_irqrestore (&usb_ed_lock, flags); @@ -595,8 +641,8 @@ urb->status = -EINPROGRESS; } } else { - usb_dec_dev_use (urb->dev); urb_rm_priv (urb); + usb_dec_dev_use (urb->dev); if (urb->complete && (urb->transfer_flags & USB_ASYNC_UNLINK)) { urb->complete (urb); urb->status = 0; @@ -873,8 +919,9 @@ int inter; int interval; __u32 * ed_p; - - + + ed->hwINFO |= cpu_to_le32 (OHCI_ED_SKIP); + switch (ed->type) { case CTRL: if (ed->ed_prev == NULL) { @@ -969,16 +1016,17 @@ td_t * td; ed_t * ed_ret; volatile ed_t * ed; + unsigned long flags; - spin_lock (&usb_ed_lock); + spin_lock_irqsave (&usb_ed_lock, flags); ed = ed_ret = &(usb_to_ohci (usb_dev)->ed[(usb_pipeendpoint (pipe) << 1) | (usb_pipecontrol (pipe)? 0: usb_pipeout (pipe))]); if ((ed->state & ED_DEL) || (ed->state & ED_URB_DEL)) { /* pending delete request */ - spin_unlock (&usb_ed_lock); + spin_unlock_irqrestore (&usb_ed_lock, flags); return NULL; } @@ -987,7 +1035,7 @@ OHCI_ALLOC (td, sizeof (*td)); /* dummy td; end of td list for ed */ if (!td) { /* out of memory */ - spin_unlock (&usb_ed_lock); + spin_unlock_irqrestore (&usb_ed_lock, flags); return NULL; } ed->hwTailP = cpu_to_le32 (virt_to_bus (td)); @@ -1011,7 +1059,7 @@ ed->int_load = load; } - spin_unlock(&usb_ed_lock); + spin_unlock_irqrestore (&usb_ed_lock, flags); return ed_ret; } @@ -1029,28 +1077,29 @@ if ((ed->state & ED_DEL) || (ed->state & ED_URB_DEL)) return; - ed->hwINFO |= cpu_to_le32 (OHCI_ED_SKIP); + ed->hwINFO |= cpu_to_le32 (OHCI_ED_SKIP); if (!ohci->disabled) { - /* enable SOF interrupt */ - writel (OHCI_INTR_SF, &ohci->regs->intrstatus); - writel (OHCI_INTR_SF, &ohci->regs->intrenable); + switch (ed->type) { + case CTRL: /* stop CTRL list */ + writel (ohci->hc_control &= ~OHCI_CTRL_CLE, + &ohci->regs->control); + break; + case BULK: /* stop BULK list */ + writel (ohci->hc_control &= ~OHCI_CTRL_BLE, + &ohci->regs->control); + break; + } } frame = le16_to_cpu (ohci->hcca.frame_no) & 0x1; ed->ed_rm_list = ohci->ed_rm_list[frame]; ohci->ed_rm_list[frame] = ed; - if (ohci->disabled) - return; - - switch (ed->type) { - case CTRL: /* stop CTRL list */ - writel (ohci->hc_control &= ~OHCI_CTRL_CLE, &ohci->regs->control); - break; - case BULK: /* stop BULK list */ - writel (ohci->hc_control &= ~OHCI_CTRL_BLE, &ohci->regs->control); - break; + if (!ohci->disabled) { + /* enable SOF interrupt */ + writel (OHCI_INTR_SF, &ohci->regs->intrstatus); + writel (OHCI_INTR_SF, &ohci->regs->intrenable); } } @@ -1072,25 +1121,30 @@ td_pt = urb_priv->td [index]; /* fill the old dummy TD */ - td = urb_priv->td [index] = (td_t *) bus_to_virt (le32_to_cpup (&urb_priv->ed->hwTailP) & 0xfffffff0); + td = urb_priv->td [index] = (td_t *) + bus_to_virt (le32_to_cpup (&urb_priv->ed->hwTailP) & 0xfffffff0); td->ed = urb_priv->ed; + td->next_dl_td = NULL; td->index = index; td->urb = urb; td->hwINFO = cpu_to_le32 (info); if ((td->ed->type & 3) == PIPE_ISOCHRONOUS) { - td->hwCBP = cpu_to_le32 (((!data || !len)? - 0 : virt_to_bus (data)) & 0xFFFFF000); + td->hwCBP = cpu_to_le32 (((!data || !len) + ? 0 + : virt_to_bus (data)) & 0xFFFFF000); td->ed->last_iso = info & 0xffff; } else { - td->hwCBP = cpu_to_le32 (((!data || !len)? 0 : virt_to_bus (data))); + td->hwCBP = cpu_to_le32 (((!data || !len) + ? 0 + : virt_to_bus (data))); } - td->hwBE = cpu_to_le32 ((!data || !len )? 0: virt_to_bus (data + len - 1)); + td->hwBE = cpu_to_le32 ((!data || !len ) + ? 0 + : virt_to_bus (data + len - 1)); td->hwNextTD = cpu_to_le32 (virt_to_bus (td_pt)); td->hwPSW [0] = cpu_to_le16 ((virt_to_bus (data) & 0x0FFF) | 0xE000); td_pt->hwNextTD = 0; td->ed->hwTailP = td->hwNextTD; - - td->next_dl_td = NULL; //td_pt; } /*-------------------------------------------------------------------------*/ @@ -1375,12 +1429,19 @@ /* error code of transfer */ cc = TD_CC_GET (tdINFO); - if( cc == TD_CC_STALL) usb_endpoint_halt(urb->dev, usb_pipeendpoint(urb->pipe), usb_pipeout(urb->pipe)); + if (cc == TD_CC_STALL) + usb_endpoint_halt(urb->dev, + usb_pipeendpoint(urb->pipe), + usb_pipeout(urb->pipe)); - if (!(urb->transfer_flags & USB_DISABLE_SPD) && (cc == TD_DATAUNDERRUN)) - cc = TD_CC_NOERROR; + if (!(urb->transfer_flags & USB_DISABLE_SPD) + && (cc == TD_DATAUNDERRUN)) + cc = TD_CC_NOERROR; + if (++(urb_priv->td_cnt) == urb_priv->length) { - if (urb_priv->state != URB_DEL && !(ed->state & ED_DEL) && ed->state != ED_NEW) { + if (urb_priv->state != URB_DEL + && !(ed->state & ED_DEL) + && ed->state != ED_NEW) { urb->status = cc_to_error[cc]; sohci_return_urb (urb); } else { @@ -1393,13 +1454,13 @@ edHeadP = le32_to_cpup (&ed->hwHeadP) & 0xfffffff0; edTailP = le32_to_cpup (&ed->hwTailP); - if((edHeadP == edTailP) && (ed->state == ED_OPER)) - ep_unlink (ohci, ed); /* unlink eds if they are not busy */ - - } - spin_unlock_irqrestore (&usb_ed_lock, flags); + /* unlink eds if they are not busy */ + if ((edHeadP == edTailP) && (ed->state == ED_OPER)) + ep_unlink (ohci, ed); + } + spin_unlock_irqrestore (&usb_ed_lock, flags); - td_list = td_list_next; + td_list = td_list_next; } } @@ -2402,5 +2463,5 @@ -MODULE_AUTHOR ("Roman Weissgaerber "); +MODULE_AUTHOR ("Roman Weissgaerber , David Brownell"); MODULE_DESCRIPTION ("USB OHCI Host Controller Driver"); diff -u --recursive --new-file v2.4.0-test8/linux/drivers/usb/usb-ohci.h linux/drivers/usb/usb-ohci.h --- v2.4.0-test8/linux/drivers/usb/usb-ohci.h Wed Aug 23 18:36:38 2000 +++ linux/drivers/usb/usb-ohci.h Fri Sep 8 16:36:10 2000 @@ -1,10 +1,10 @@ - /* +/* * URB OHCI HCD (Host Controller Driver) for USB. * - *(C) Copyright 1999 Roman Weissgaerber + * (C) Copyright 1999 Roman Weissgaerber + * (C) Copyright 2000 David Brownell * * usb-ohci.h - * */ @@ -40,7 +40,7 @@ #define ED_UNLINK 0x01 #define ED_OPER 0x02 #define ED_DEL 0x04 -#define ED_URB_DEL 0x08 +#define ED_URB_DEL 0x08 /* usb_ohci_ed */ typedef struct ed { @@ -372,8 +372,8 @@ struct list_head ohci_hcd_list; /* list of all ohci_hcd */ struct ohci * next; // chain of uhci device contexts - struct list_head urb_list; // list of all pending urbs - spinlock_t urb_list_lock; // lock to keep consistency + // struct list_head urb_list; // list of all pending urbs + // spinlock_t urb_list_lock; // lock to keep consistency int ohci_int_load[32]; /* load of the 32 Interrupt Chains (for load balancing)*/ ed_t * ed_rm_list[2]; /* lists of all endpoints to be removed */ @@ -418,7 +418,7 @@ static int rh_unlink_urb(urb_t * urb); static int rh_init_int_timer(urb_t * urb); -#ifdef DEBUG +#ifdef OHCI_VERBOSE_DEBUG #define OHCI_FREE(x) kfree(x); printk("OHCI FREE: %d: %4x\n", -- __ohci_free_cnt, (unsigned int) x) #define OHCI_ALLOC(x,size) (x) = kmalloc(size, in_interrupt() ? GFP_ATOMIC : GFP_KERNEL); printk("OHCI ALLO: %d: %4x\n", ++ __ohci_free_cnt,(unsigned int) x) static int __ohci_free_cnt = 0; diff -u --recursive --new-file v2.4.0-test8/linux/fs/block_dev.c linux/fs/block_dev.c --- v2.4.0-test8/linux/fs/block_dev.c Fri Sep 8 13:27:12 2000 +++ linux/fs/block_dev.c Mon Sep 11 08:41:07 2000 @@ -30,17 +30,17 @@ ssize_t block, blocks; loff_t offset; ssize_t chars; - ssize_t written = 0; + ssize_t written; struct buffer_head * bhlist[NBUF]; size_t size; - kdev_t dev; + kdev_t dev = inode->i_rdev; struct buffer_head * bh, *bufferlist[NBUF]; register char * p; - write_error = buffercount = 0; - dev = inode->i_rdev; - if ( is_read_only( inode->i_rdev )) + if (is_read_only(dev)) return -EPERM; + + written = write_error = buffercount = 0; blocksize = BLOCK_SIZE; if (blksize_size[MAJOR(dev)] && blksize_size[MAJOR(dev)][MINOR(dev)]) blocksize = blksize_size[MAJOR(dev)][MINOR(dev)]; diff -u --recursive --new-file v2.4.0-test8/linux/fs/buffer.c linux/fs/buffer.c --- v2.4.0-test8/linux/fs/buffer.c Fri Sep 8 13:27:12 2000 +++ linux/fs/buffer.c Fri Sep 15 16:51:21 2000 @@ -35,6 +35,7 @@ #include #include #include +#include #include #include #include @@ -704,9 +705,9 @@ static void refill_freelist(int size) { if (!grow_buffers(size)) { - wakeup_bdflush(1); - current->policy |= SCHED_YIELD; - schedule(); + //wakeup_bdflush(1); + balance_dirty(NODEV); + wakeup_kswapd(1); } } @@ -856,23 +857,35 @@ /* -1 -> no need to flush 0 -> async flush 1 -> sync flush (wait for I/O completation) */ -static int balance_dirty_state(kdev_t dev) +int balance_dirty_state(kdev_t dev) { unsigned long dirty, tot, hard_dirty_limit, soft_dirty_limit; dirty = size_buffers_type[BUF_DIRTY] >> PAGE_SHIFT; tot = nr_free_buffer_pages(); - tot -= size_buffers_type[BUF_PROTECTED] >> PAGE_SHIFT; +// tot -= size_buffers_type[BUF_PROTECTED] >> PAGE_SHIFT; dirty *= 200; soft_dirty_limit = tot * bdf_prm.b_un.nfract; hard_dirty_limit = soft_dirty_limit * 2; - if (dirty > soft_dirty_limit) { + /* First, check for the "real" dirty limit. */ + if (dirty > soft_dirty_limit || inactive_shortage()) { if (dirty > hard_dirty_limit) return 1; return 0; } + + /* + * Then, make sure the number of inactive pages won't overwhelm + * page replacement ... this should avoid stalls. + */ + if (nr_inactive_dirty_pages > + nr_free_pages() + nr_inactive_clean_pages()) { + if (free_shortage() > freepages.min) + return 1; + return 0; + } return -1; } @@ -1380,6 +1393,19 @@ } /* + * NOTE! All mapped/uptodate combinations are valid: + * + * Mapped Uptodate Meaning + * + * No No "unknown" - must do get_block() + * No Yes "hole" - zero-filled + * Yes No "allocated" - allocated on disk, not read in + * Yes Yes "valid" - allocated and up-to-date in memory. + * + * "Dirty" is valid only with the last case (mapped+uptodate). + */ + +/* * block_write_full_page() is SMP-safe - currently it's still * being called with the kernel lock held, but the code is ready. */ @@ -1758,17 +1784,24 @@ pos += blocksize; } + err = 0; + if (!buffer_mapped(bh)) { + /* Hole? Nothing to do */ + if (buffer_uptodate(bh)) + goto unlock; + get_block(inode, iblock, bh, 0); + /* Still unmapped? Nothing to do */ + if (!buffer_mapped(bh)) + goto unlock; + } + + /* Ok, it's mapped. Make sure it's up-to-date */ if (!buffer_uptodate(bh)) { - err = 0; - if (!buffer_mapped(bh)) { - get_block(inode, iblock, bh, 0); - if (!buffer_mapped(bh)) - goto unlock; - } err = -EIO; bh->b_end_io = end_buffer_io_sync; ll_rw_block(READ, 1, &bh); wait_on_buffer(bh); + /* Uhhuh. Read error. Complain and punt. */ if (!buffer_uptodate(bh)) goto unlock; } @@ -2152,6 +2185,7 @@ page = alloc_page(GFP_BUFFER); if (!page) goto out; + LockPage(page); bh = create_buffers(page, size, 0); if (!bh) goto no_buffer_head; @@ -2184,6 +2218,7 @@ page->buffers = bh; page->flags &= ~(1 << PG_referenced); lru_cache_add(page); + UnlockPage(page); atomic_inc(&buffermem_pages); return 1; @@ -2609,6 +2644,9 @@ CHECK_EMERGENCY_SYNC flushed = flush_dirty_buffers(0); + if (nr_inactive_dirty_pages > nr_free_pages() + + nr_inactive_clean_pages()) + flushed += page_launder(GFP_KSWAPD, 0); /* If wakeup_bdflush will wakeup us after our bdflush_done wakeup, then @@ -2619,14 +2657,16 @@ (as we would be sleeping) and so it would deadlock in SMP. */ __set_current_state(TASK_INTERRUPTIBLE); - wake_up(&bdflush_done); + wake_up_all(&bdflush_done); /* * If there are still a lot of dirty buffers around, * skip the sleep and flush some more. Otherwise, we * go to sleep waiting a wakeup. */ - if (!flushed || balance_dirty_state(NODEV) < 0) + if (!flushed || balance_dirty_state(NODEV) < 0) { + run_task_queue(&tq_disk); schedule(); + } /* Remember to mark us as running otherwise the next schedule will block. */ __set_current_state(TASK_RUNNING); diff -u --recursive --new-file v2.4.0-test8/linux/fs/inode.c linux/fs/inode.c --- v2.4.0-test8/linux/fs/inode.c Wed Aug 23 18:36:38 2000 +++ linux/fs/inode.c Mon Sep 11 08:41:07 2000 @@ -71,7 +71,7 @@ int nr_inodes; int nr_unused; int dummy[5]; -} inodes_stat = {0, 0,}; +} inodes_stat; static kmem_cache_t * inode_cachep; diff -u --recursive --new-file v2.4.0-test8/linux/fs/ncpfs/file.c linux/fs/ncpfs/file.c --- v2.4.0-test8/linux/fs/ncpfs/file.c Mon Jul 10 16:47:26 2000 +++ linux/fs/ncpfs/file.c Fri Sep 15 14:26:23 2000 @@ -256,7 +256,7 @@ } if (ncp_write_kernel(NCP_SERVER(inode), NCP_FINFO(inode)->file_handle, - pos, to_write, buf, &written_this_time) != 0) { + pos, to_write, bouncebuffer, &written_this_time) != 0) { errno = -EIO; break; } diff -u --recursive --new-file v2.4.0-test8/linux/fs/nfs/dir.c linux/fs/nfs/dir.c --- v2.4.0-test8/linux/fs/nfs/dir.c Fri Sep 8 13:27:13 2000 +++ linux/fs/nfs/dir.c Mon Sep 11 08:38:25 2000 @@ -809,14 +809,9 @@ dentry->d_parent->d_name.name, dentry->d_name.name, atomic_read(&dentry->d_count)); - /* - * Note that a silly-renamed file can be deleted once it's - * no longer in use -- it's just an ordinary file now. - */ - if (atomic_read(&dentry->d_count) == 1) { - dentry->d_flags &= ~DCACHE_NFSFS_RENAMED; + if (atomic_read(&dentry->d_count) == 1) goto out; /* No need to silly rename. */ - } + #ifdef NFS_PARANOIA if (!dentry->d_inode) @@ -900,12 +895,21 @@ #endif goto out; } + + /* If the dentry was sillyrenamed, we simply call d_delete() */ + if (dentry->d_flags & DCACHE_NFSFS_RENAMED) { + error = 0; + goto out_delete; + } + nfs_zap_caches(dir_i); if (inode) NFS_CACHEINV(inode); error = NFS_PROTO(dir_i)->remove(dir, &dentry->d_name); if (error < 0) goto out; + + out_delete: /* * Free the inode */ diff -u --recursive --new-file v2.4.0-test8/linux/fs/nfs/nfs3proc.c linux/fs/nfs/nfs3proc.c --- v2.4.0-test8/linux/fs/nfs/nfs3proc.c Fri Sep 8 13:27:13 2000 +++ linux/fs/nfs/nfs3proc.c Mon Sep 11 08:38:25 2000 @@ -279,6 +279,7 @@ arg->fh = NFS_FH(dir); arg->name = name->name; arg->len = name->len; + res->valid = 0; msg->rpc_proc = NFS3PROC_REMOVE; msg->rpc_argp = arg; msg->rpc_resp = res; @@ -288,10 +289,13 @@ static void nfs3_proc_unlink_done(struct dentry *dir, struct rpc_message *msg) { - struct nfs_fattr *dir_attr = (struct nfs_fattr*)msg->rpc_resp; + struct nfs_fattr *dir_attr; - nfs_refresh_inode(dir->d_inode, dir_attr); - kfree(msg->rpc_argp); + if (msg->rpc_argp) { + dir_attr = (struct nfs_fattr*)msg->rpc_resp; + nfs_refresh_inode(dir->d_inode, dir_attr); + kfree(msg->rpc_argp); + } } static int diff -u --recursive --new-file v2.4.0-test8/linux/fs/nfs/proc.c linux/fs/nfs/proc.c --- v2.4.0-test8/linux/fs/nfs/proc.c Fri Sep 8 13:27:13 2000 +++ linux/fs/nfs/proc.c Mon Sep 11 08:38:25 2000 @@ -251,8 +251,10 @@ static void nfs_proc_unlink_done(struct dentry *dir, struct rpc_message *msg) { - NFS_CACHEINV(dir->d_inode); - kfree(msg->rpc_argp); + if (msg->rpc_argp) { + NFS_CACHEINV(dir->d_inode); + kfree(msg->rpc_argp); + } } static int diff -u --recursive --new-file v2.4.0-test8/linux/fs/nfs/unlink.c linux/fs/nfs/unlink.c --- v2.4.0-test8/linux/fs/nfs/unlink.c Fri Sep 8 13:27:13 2000 +++ linux/fs/nfs/unlink.c Mon Sep 11 08:38:25 2000 @@ -121,8 +121,11 @@ { struct nfs_unlinkdata *data = (struct nfs_unlinkdata *)task->tk_calldata; struct dentry *dir = data->dir; - struct inode *dir_i = dir->d_inode; + struct inode *dir_i; + if (!dir) + return; + dir_i = dir->d_inode; nfs_zap_caches(dir_i); NFS_PROTO(dir_i)->unlink_done(dir, &task->tk_msg); rpcauth_releasecred(task->tk_auth, data->cred); @@ -206,6 +209,7 @@ return; data->count++; nfs_copy_dname(dentry, data); + dentry->d_flags &= ~DCACHE_NFSFS_RENAMED; if (data->task.tk_rpcwait == &nfs_delete_queue) rpc_wake_up_task(&data->task); nfs_put_unlinkdata(data); diff -u --recursive --new-file v2.4.0-test8/linux/fs/proc/proc_misc.c linux/fs/proc/proc_misc.c --- v2.4.0-test8/linux/fs/proc/proc_misc.c Fri Sep 8 13:27:13 2000 +++ linux/fs/proc/proc_misc.c Fri Sep 15 18:23:15 2000 @@ -156,22 +156,30 @@ * have been updated. */ len += sprintf(page+len, - "MemTotal: %8lu kB\n" - "MemFree: %8lu kB\n" - "MemShared: %8lu kB\n" - "Buffers: %8lu kB\n" - "Cached: %8u kB\n" - "HighTotal: %8lu kB\n" - "HighFree: %8lu kB\n" - "LowTotal: %8lu kB\n" - "LowFree: %8lu kB\n" - "SwapTotal: %8lu kB\n" - "SwapFree: %8lu kB\n", + "MemTotal: %8lu kB\n" + "MemFree: %8lu kB\n" + "MemShared: %8lu kB\n" + "Buffers: %8lu kB\n" + "Cached: %8u kB\n" + "Active: %8u kB\n" + "Inact_dirty: %8u kB\n" + "Inact_clean: %8u kB\n" + "Inact_target: %8lu kB\n" + "HighTotal: %8lu kB\n" + "HighFree: %8lu kB\n" + "LowTotal: %8lu kB\n" + "LowFree: %8lu kB\n" + "SwapTotal: %8lu kB\n" + "SwapFree: %8lu kB\n", K(i.totalram), K(i.freeram), K(i.sharedram), K(i.bufferram), K(atomic_read(&page_cache_size)), + K(nr_active_pages), + K(nr_inactive_dirty_pages), + K(nr_inactive_clean_pages()), + K(inactive_target), K(i.totalhigh), K(i.freehigh), K(i.totalram-i.totalhigh), diff -u --recursive --new-file v2.4.0-test8/linux/fs/proc/procfs_syms.c linux/fs/proc/procfs_syms.c --- v2.4.0-test8/linux/fs/proc/procfs_syms.c Thu May 11 15:30:08 2000 +++ linux/fs/proc/procfs_syms.c Mon Sep 11 08:41:07 2000 @@ -28,7 +28,9 @@ if (!err) { proc_mnt = kern_mount(&proc_fs_type); err = PTR_ERR(proc_mnt); - if (!IS_ERR(proc_mnt)) + if (IS_ERR(proc_mnt)) + unregister_filesystem(&proc_fs_type); + else err = 0; } return err; diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-ppc/time.h linux/include/asm-ppc/time.h --- v2.4.0-test8/linux/include/asm-ppc/time.h Fri Jul 14 12:12:15 2000 +++ linux/include/asm-ppc/time.h Mon Sep 11 08:39:48 2000 @@ -15,8 +15,6 @@ extern unsigned decrementer_count; extern unsigned count_period_num; extern unsigned count_period_den; -extern unsigned long mktime(unsigned int, unsigned int, unsigned int, - unsigned int, unsigned int, unsigned int); extern void to_tm(int tim, struct rtc_time * tm); extern time_t last_rtc_update; diff -u --recursive --new-file v2.4.0-test8/linux/include/linux/mm.h linux/include/linux/mm.h --- v2.4.0-test8/linux/include/linux/mm.h Fri Sep 8 13:27:13 2000 +++ linux/include/linux/mm.h Fri Sep 15 18:24:15 2000 @@ -15,7 +15,9 @@ extern unsigned long num_physpages; extern void * high_memory; extern int page_cluster; -extern struct list_head lru_cache; +/* The inactive_clean lists are per zone. */ +extern struct list_head active_list; +extern struct list_head inactive_dirty_list; #include #include @@ -149,6 +151,7 @@ atomic_t count; unsigned long flags; /* atomic flags, some possibly updated asynchronously */ struct list_head lru; + unsigned long age; wait_queue_head_t wait; struct page **pprev_hash; struct buffer_head * buffers; @@ -169,12 +172,12 @@ #define PG_uptodate 3 #define PG_dirty 4 #define PG_decr_after 5 -#define PG_unused_01 6 -#define PG__unused_02 7 +#define PG_active 6 +#define PG_inactive_dirty 7 #define PG_slab 8 #define PG_swap_cache 9 #define PG_skip 10 -#define PG_unused_03 11 +#define PG_inactive_clean 11 #define PG_highmem 12 /* bits 21-30 unused */ #define PG_reserved 31 @@ -199,6 +202,7 @@ #define ClearPageError(page) clear_bit(PG_error, &(page)->flags) #define PageReferenced(page) test_bit(PG_referenced, &(page)->flags) #define SetPageReferenced(page) set_bit(PG_referenced, &(page)->flags) +#define ClearPageReferenced(page) clear_bit(PG_referenced, &(page)->flags) #define PageTestandClearReferenced(page) test_and_clear_bit(PG_referenced, &(page)->flags) #define PageDecrAfter(page) test_bit(PG_decr_after, &(page)->flags) #define SetPageDecrAfter(page) set_bit(PG_decr_after, &(page)->flags) @@ -216,6 +220,18 @@ #define PageClearSwapCache(page) clear_bit(PG_swap_cache, &(page)->flags) #define PageTestandClearSwapCache(page) test_and_clear_bit(PG_swap_cache, &(page)->flags) + +#define PageActive(page) test_bit(PG_active, &(page)->flags) +#define SetPageActive(page) set_bit(PG_active, &(page)->flags) +#define ClearPageActive(page) clear_bit(PG_active, &(page)->flags) + +#define PageInactiveDirty(page) test_bit(PG_inactive_dirty, &(page)->flags) +#define SetPageInactiveDirty(page) set_bit(PG_inactive_dirty, &(page)->flags) +#define ClearPageInactiveDirty(page) clear_bit(PG_inactive_dirty, &(page)->flags) + +#define PageInactiveClean(page) test_bit(PG_inactive_clean, &(page)->flags) +#define SetPageInactiveClean(page) set_bit(PG_inactive_clean, &(page)->flags) +#define ClearPageInactiveClean(page) clear_bit(PG_inactive_clean, &(page)->flags) #ifdef CONFIG_HIGHMEM #define PageHighMem(page) test_bit(PG_highmem, &(page)->flags) diff -u --recursive --new-file v2.4.0-test8/linux/include/linux/mmzone.h linux/include/linux/mmzone.h --- v2.4.0-test8/linux/include/linux/mmzone.h Fri Sep 8 13:27:13 2000 +++ linux/include/linux/mmzone.h Fri Sep 15 18:24:13 2000 @@ -28,13 +28,14 @@ spinlock_t lock; unsigned long offset; unsigned long free_pages; - char low_on_memory; - char zone_wake_kswapd; + unsigned long inactive_clean_pages; + unsigned long inactive_dirty_pages; unsigned long pages_min, pages_low, pages_high; /* * free areas of different sizes */ + struct list_head inactive_clean_list; free_area_t free_area[MAX_ORDER]; /* diff -u --recursive --new-file v2.4.0-test8/linux/include/linux/swap.h linux/include/linux/swap.h --- v2.4.0-test8/linux/include/linux/swap.h Thu May 11 15:30:08 2000 +++ linux/include/linux/swap.h Fri Sep 15 18:24:13 2000 @@ -65,13 +65,17 @@ extern int nr_swap_pages; FASTCALL(unsigned int nr_free_pages(void)); +FASTCALL(unsigned int nr_inactive_clean_pages(void)); FASTCALL(unsigned int nr_free_buffer_pages(void)); FASTCALL(unsigned int nr_free_highpages(void)); -extern int nr_lru_pages; +extern int nr_active_pages; +extern int nr_inactive_dirty_pages; extern atomic_t nr_async_pages; extern struct address_space swapper_space; extern atomic_t page_cache_size; extern atomic_t buffermem_pages; +extern spinlock_t pagecache_lock; +extern void __remove_inode_page(struct page *); /* Incomplete types for prototype declarations: */ struct task_struct; @@ -83,9 +87,29 @@ extern int shm_swap(int, int); /* linux/mm/swap.c */ +extern int memory_pressure; +extern void age_page_up(struct page *); +extern void age_page_up_nolock(struct page *); +extern void age_page_down(struct page *); +extern void age_page_down_nolock(struct page *); +extern void deactivate_page(struct page *); +extern void deactivate_page_nolock(struct page *); +extern void activate_page(struct page *); +extern void activate_page_nolock(struct page *); +extern void lru_cache_add(struct page *); +extern void __lru_cache_del(struct page *); +extern void lru_cache_del(struct page *); +extern void recalculate_vm_stats(void); extern void swap_setup(void); /* linux/mm/vmscan.c */ +extern struct page * reclaim_page(zone_t *); +extern wait_queue_head_t kswapd_wait; +extern wait_queue_head_t kreclaimd_wait; +extern int page_launder(int, int); +extern int free_shortage(void); +extern int inactive_shortage(void); +extern void wakeup_kswapd(int); extern int try_to_free_pages(unsigned int gfp_mask); /* linux/mm/page_io.c */ @@ -161,30 +185,102 @@ extern spinlock_t pagemap_lru_lock; /* - * Helper macros for lru_pages handling. + * Page aging defines. + * Since we do exponential decay of the page age, we + * can chose a fairly large maximum. */ -#define lru_cache_add(page) \ -do { \ - spin_lock(&pagemap_lru_lock); \ - list_add(&(page)->lru, &lru_cache); \ - nr_lru_pages++; \ - spin_unlock(&pagemap_lru_lock); \ -} while (0) - -#define __lru_cache_del(page) \ -do { \ - list_del(&(page)->lru); \ - nr_lru_pages--; \ -} while (0) - -#define lru_cache_del(page) \ -do { \ - if (!PageLocked(page)) \ - BUG(); \ - spin_lock(&pagemap_lru_lock); \ - __lru_cache_del(page); \ - spin_unlock(&pagemap_lru_lock); \ -} while (0) +#define PAGE_AGE_START 2 +#define PAGE_AGE_ADV 3 +#define PAGE_AGE_MAX 64 + +/* + * List add/del helper macros. These must be called + * with the pagemap_lru_lock held! + */ +#define DEBUG_ADD_PAGE \ + if (PageActive(page) || PageInactiveDirty(page) || \ + PageInactiveClean(page)) BUG(); + +#define ZERO_PAGE_BUG \ + if (page_count(page) == 0) BUG(); + +#define add_page_to_active_list(page) { \ + DEBUG_ADD_PAGE \ + ZERO_PAGE_BUG \ + SetPageActive(page); \ + list_add(&(page)->lru, &active_list); \ + nr_active_pages++; \ +} + +#define add_page_to_inactive_dirty_list(page) { \ + DEBUG_ADD_PAGE \ + ZERO_PAGE_BUG \ + SetPageInactiveDirty(page); \ + list_add(&(page)->lru, &inactive_dirty_list); \ + nr_inactive_dirty_pages++; \ + page->zone->inactive_dirty_pages++; \ +} + +#define add_page_to_inactive_clean_list(page) { \ + DEBUG_ADD_PAGE \ + ZERO_PAGE_BUG \ + SetPageInactiveClean(page); \ + list_add(&(page)->lru, &page->zone->inactive_clean_list); \ + page->zone->inactive_clean_pages++; \ +} + +#define del_page_from_active_list(page) { \ + list_del(&(page)->lru); \ + ClearPageActive(page); \ + nr_active_pages--; \ + DEBUG_ADD_PAGE \ + ZERO_PAGE_BUG \ +} + +#define del_page_from_inactive_dirty_list(page) { \ + list_del(&(page)->lru); \ + ClearPageInactiveDirty(page); \ + nr_inactive_dirty_pages--; \ + page->zone->inactive_dirty_pages--; \ + DEBUG_ADD_PAGE \ + ZERO_PAGE_BUG \ +} + +#define del_page_from_inactive_clean_list(page) { \ + list_del(&(page)->lru); \ + ClearPageInactiveClean(page); \ + page->zone->inactive_clean_pages--; \ + DEBUG_ADD_PAGE \ + ZERO_PAGE_BUG \ +} + +/* + * In mm/swap.c::recalculate_vm_stats(), we substract + * inactive_target from memory_pressure every second. + * This means that memory_pressure is smoothed over + * 64 (1 << INACTIVE_SHIFT) seconds. + */ +#define INACTIVE_SHIFT 6 +#define inactive_min(a,b) ((a) < (b) ? (a) : (b)) +#define inactive_target inactive_min((memory_pressure >> INACTIVE_SHIFT), \ + (num_physpages / 4)) + +/* + * Ugly ugly ugly HACK to make sure the inactive lists + * don't fill up with unfreeable ramdisk pages. We really + * want to fix the ramdisk driver to mark its pages as + * unfreeable instead of using dirty buffer magic, but the + * next code-change time is when 2.5 is forked... + */ +#ifndef _LINUX_KDEV_T_H +#include +#endif +#ifndef _LINUX_MAJOR_H +#include +#endif + +#define page_ramdisk(page) \ + (page->buffers && (MAJOR(page->buffers->b_dev) == RAMDISK_MAJOR)) extern spinlock_t swaplock; diff -u --recursive --new-file v2.4.0-test8/linux/include/linux/time.h linux/include/linux/time.h --- v2.4.0-test8/linux/include/linux/time.h Wed Jul 28 10:30:10 1999 +++ linux/include/linux/time.h Fri Sep 15 18:24:13 2000 @@ -45,7 +45,42 @@ value->tv_nsec = (jiffies % HZ) * (1000000000L / HZ); value->tv_sec = jiffies / HZ; } - + + +/* Converts Gregorian date to seconds since 1970-01-01 00:00:00. + * Assumes input in normal date format, i.e. 1980-12-31 23:59:59 + * => year=1980, mon=12, day=31, hour=23, min=59, sec=59. + * + * [For the Julian calendar (which was used in Russia before 1917, + * Britain & colonies before 1752, anywhere else before 1582, + * and is still in use by some communities) leave out the + * -year/100+year/400 terms, and add 10.] + * + * This algorithm was first published by Gauss (I think). + * + * WARNING: this function will overflow on 2106-02-07 06:28:16 on + * machines were long is 32-bit! (However, as time_t is signed, we + * will already get problems at other places on 2038-01-19 03:14:08) + */ +static inline unsigned long +mktime (unsigned int year, unsigned int mon, + unsigned int day, unsigned int hour, + unsigned int min, unsigned int sec) +{ + if (0 >= (int) (mon -= 2)) { /* 1..12 -> 11,12,1..10 */ + mon += 12; /* Puts Feb last since it has leap day */ + year -= 1; + } + + return ((( + (unsigned long) (year/4 - year/100 + year/400 + 367*mon/12 + day) + + year*365 - 719499 + )*24 + hour /* now have hours */ + )*60 + min /* now have minutes */ + )*60 + sec; /* finally seconds */ +} + + struct timeval { time_t tv_sec; /* seconds */ suseconds_t tv_usec; /* microseconds */ diff -u --recursive --new-file v2.4.0-test8/linux/include/pcmcia/ss.h linux/include/pcmcia/ss.h --- v2.4.0-test8/linux/include/pcmcia/ss.h Fri Sep 8 13:27:13 2000 +++ linux/include/pcmcia/ss.h Fri Sep 15 16:31:09 2000 @@ -82,6 +82,7 @@ #define SS_DMA_MODE 0x0080 #define SS_SPKR_ENA 0x0100 #define SS_OUTPUT_ENA 0x0200 +#define SS_DEBOUNCED 0x0400 /* Tell driver that the debounce delay has ended */ /* Flags for I/O port and memory windows */ #define MAP_ACTIVE 0x01 diff -u --recursive --new-file v2.4.0-test8/linux/ipc/shm.c linux/ipc/shm.c --- v2.4.0-test8/linux/ipc/shm.c Fri Sep 8 13:27:13 2000 +++ linux/ipc/shm.c Fri Sep 15 16:51:21 2000 @@ -1522,7 +1522,7 @@ } /* - * Goes through counter = (shm_rss / (prio + 1)) present shm pages. + * Goes through counter = (shm_rss >> prio) present shm pages. */ static unsigned long swap_id; /* currently being swapped */ static unsigned long swap_idx; /* next to swap */ @@ -1537,7 +1537,7 @@ struct page * page_map; zshm_swap(prio, gfp_mask); - counter = shm_rss / (prio + 1); + counter = shm_rss >> prio; if (!counter) return 0; if (shm_swap_preop(&swap_entry)) @@ -1863,7 +1863,7 @@ int counter; struct page * page_map; - counter = zshm_rss / (prio + 1); + counter = zshm_rss >> prio; if (!counter) return; next: diff -u --recursive --new-file v2.4.0-test8/linux/kernel/signal.c linux/kernel/signal.c --- v2.4.0-test8/linux/kernel/signal.c Fri Sep 8 13:27:13 2000 +++ linux/kernel/signal.c Mon Sep 11 08:41:08 2000 @@ -41,7 +41,7 @@ __alignof__(struct sigqueue), SIG_SLAB_DEBUG, NULL, NULL); if (!sigqueue_cachep) - panic("signals_init(): cannot create sigueue SLAB cache"); + panic("signals_init(): cannot create sigqueue SLAB cache"); } diff -u --recursive --new-file v2.4.0-test8/linux/kernel/sys.c linux/kernel/sys.c --- v2.4.0-test8/linux/kernel/sys.c Wed Aug 9 19:19:51 2000 +++ linux/kernel/sys.c Mon Sep 11 08:48:53 2000 @@ -123,18 +123,15 @@ int ret=NOTIFY_DONE; struct notifier_block *nb = *n; - read_lock(¬ifier_lock); while(nb) { ret=nb->notifier_call(nb,val,v); if(ret&NOTIFY_STOP_MASK) { - read_unlock(¬ifier_lock); return ret; } nb=nb->next; } - read_unlock(¬ifier_lock); return ret; } diff -u --recursive --new-file v2.4.0-test8/linux/kernel/sysctl.c linux/kernel/sysctl.c --- v2.4.0-test8/linux/kernel/sysctl.c Wed Aug 9 19:19:51 2000 +++ linux/kernel/sysctl.c Fri Sep 15 16:51:21 2000 @@ -235,7 +235,7 @@ static ctl_table vm_table[] = { {VM_FREEPG, "freepages", - &freepages, sizeof(freepages_t), 0644, NULL, &proc_dointvec}, + &freepages, sizeof(freepages_t), 0444, NULL, &proc_dointvec}, {VM_BDFLUSH, "bdflush", &bdf_prm, 9*sizeof(int), 0644, NULL, &proc_dointvec_minmax, &sysctl_intvec, NULL, &bdflush_min, &bdflush_max}, diff -u --recursive --new-file v2.4.0-test8/linux/mm/filemap.c linux/mm/filemap.c --- v2.4.0-test8/linux/mm/filemap.c Fri Sep 8 13:27:13 2000 +++ linux/mm/filemap.c Fri Sep 15 16:51:21 2000 @@ -46,7 +46,7 @@ struct page **page_hash_table; struct list_head lru_cache; -static spinlock_t pagecache_lock = SPIN_LOCK_UNLOCKED; +spinlock_t pagecache_lock = SPIN_LOCK_UNLOCKED; /* * NOTE: to avoid deadlocking you must never acquire the pagecache_lock with * the pagemap_lru_lock held. @@ -92,7 +92,7 @@ * sure the page is locked and that nobody else uses it - or that usage * is safe. */ -static inline void __remove_inode_page(struct page *page) +void __remove_inode_page(struct page *page) { remove_page_from_inode_queue(page); remove_page_from_hash_queue(page); @@ -235,141 +235,6 @@ spin_unlock(&pagecache_lock); } -/* - * nr_dirty represents the number of dirty pages that we will write async - * before doing sync writes. We can only do sync writes if we can - * wait for IO (__GFP_IO set). - */ -int shrink_mmap(int priority, int gfp_mask) -{ - int ret = 0, count, nr_dirty; - struct list_head * page_lru; - struct page * page = NULL; - - count = nr_lru_pages / (priority + 1); - nr_dirty = priority; - - /* we need pagemap_lru_lock for list_del() ... subtle code below */ - spin_lock(&pagemap_lru_lock); - while (count > 0 && (page_lru = lru_cache.prev) != &lru_cache) { - page = list_entry(page_lru, struct page, lru); - list_del(page_lru); - - if (PageTestandClearReferenced(page)) - goto dispose_continue; - - count--; - /* - * Avoid unscalable SMP locking for pages we can - * immediate tell are untouchable.. - */ - if (!page->buffers && page_count(page) > 1) - goto dispose_continue; - - if (TryLockPage(page)) - goto dispose_continue; - - /* Release the pagemap_lru lock even if the page is not yet - queued in any lru queue since we have just locked down - the page so nobody else may SMP race with us running - a lru_cache_del() (lru_cache_del() always run with the - page locked down ;). */ - spin_unlock(&pagemap_lru_lock); - - /* avoid freeing the page while it's locked */ - page_cache_get(page); - - /* - * Is it a buffer page? Try to clean it up regardless - * of zone - it's old. - */ - if (page->buffers) { - int wait; - /* - * 0 - free it if can do so without IO - * 1 - start write-out of dirty buffers - * 2 - wait for locked buffers - */ - wait = (gfp_mask & __GFP_IO) ? (nr_dirty-- < 0) ? 2 : 1 : 0; - if (!try_to_free_buffers(page, wait)) - goto unlock_continue; - /* page was locked, inode can't go away under us */ - if (!page->mapping) { - atomic_dec(&buffermem_pages); - goto made_buffer_progress; - } - } - - /* Take the pagecache_lock spinlock held to avoid - other tasks to notice the page while we are looking at its - page count. If it's a pagecache-page we'll free it - in one atomic transaction after checking its page count. */ - spin_lock(&pagecache_lock); - - /* - * We can't free pages unless there's just one user - * (count == 2 because we added one ourselves above). - */ - if (page_count(page) != 2) - goto cache_unlock_continue; - - /* - * Is it a page swap page? If so, we want to - * drop it if it is no longer used, even if it - * were to be marked referenced.. - */ - if (PageSwapCache(page)) { - spin_unlock(&pagecache_lock); - __delete_from_swap_cache(page); - goto made_inode_progress; - } - - /* - * Page is from a zone we don't care about. - * Don't drop page cache entries in vain. - */ - if (page->zone->free_pages > page->zone->pages_high) - goto cache_unlock_continue; - - /* is it a page-cache page? */ - if (page->mapping) { - if (!PageDirty(page) && !pgcache_under_min()) { - __remove_inode_page(page); - spin_unlock(&pagecache_lock); - goto made_inode_progress; - } - goto cache_unlock_continue; - } - - printk(KERN_ERR "shrink_mmap: unknown LRU page!\n"); - -cache_unlock_continue: - spin_unlock(&pagecache_lock); -unlock_continue: - spin_lock(&pagemap_lru_lock); - UnlockPage(page); - page_cache_release(page); -dispose_continue: - list_add(page_lru, &lru_cache); - } - goto out; - -made_inode_progress: - page_cache_release(page); -made_buffer_progress: - UnlockPage(page); - page_cache_release(page); - ret = 1; - spin_lock(&pagemap_lru_lock); - /* nr_lru_pages needs the spinlock */ - nr_lru_pages--; - -out: - spin_unlock(&pagemap_lru_lock); - - return ret; -} - static inline struct page * __find_page_nolock(struct address_space *mapping, unsigned long offset, struct page *page) { goto inside; @@ -384,7 +249,14 @@ if (page->index == offset) break; } - SetPageReferenced(page); + /* + * Touching the page may move it to the active list. + * If we end up with too few inactive pages, we wake + * up kswapd. + */ + age_page_up(page); + if (inactive_shortage() > (inactive_target * 3) / 4) + wakeup_kswapd(0); not_found: return page; } @@ -616,6 +488,7 @@ set_task_state(tsk, TASK_UNINTERRUPTIBLE); if (!PageLocked(page)) break; + run_task_queue(&tq_disk); schedule(); } while (PageLocked(page)); tsk->state = TASK_RUNNING; @@ -739,6 +612,53 @@ #endif /* + * We combine this with read-ahead to deactivate pages when we + * think there's sequential IO going on. Note that this is + * harmless since we don't actually evict the pages from memory + * but just move them to the inactive list. + * + * TODO: + * - make the readahead code smarter + * - move readahead to the VMA level so we can do the same + * trick with mmap() + * + * Rik van Riel, 2000 + */ +static void drop_behind(struct file * file, unsigned long index) +{ + struct inode *inode = file->f_dentry->d_inode; + struct address_space *mapping = inode->i_mapping; + struct page **hash; + struct page *page; + unsigned long start; + + /* Nothing to drop-behind if we're on the first page. */ + if (!index) + return; + + if (index > file->f_rawin) + start = index - file->f_rawin; + else + start = 0; + + /* + * Go backwards from index-1 and drop all pages in the + * readahead window. Since the readahead window may have + * been increased since the last time we were called, we + * stop when the page isn't there. + */ + spin_lock(&pagecache_lock); + while (--index >= start) { + hash = page_hash(mapping, index); + page = __find_page_nolock(mapping, index, *hash); + if (!page) + break; + deactivate_page(page); + } + spin_unlock(&pagecache_lock); +} + +/* * Read-ahead profiling information * -------------------------------- * Every PROFILE_MAXREADCOUNT, the following information is written @@ -961,6 +881,12 @@ if (filp->f_ramax > max_readahead) filp->f_ramax = max_readahead; + /* + * Move the pages that have already been passed + * to the inactive list. + */ + drop_behind(filp, index); + #ifdef PROFILE_READAHEAD profile_readahead((reada_ok == 2), filp); #endif @@ -2527,6 +2453,7 @@ unlock: /* Mark it unlocked again and drop the page.. */ UnlockPage(page); + deactivate_page(page); page_cache_release(page); if (status < 0) diff -u --recursive --new-file v2.4.0-test8/linux/mm/memory.c linux/mm/memory.c --- v2.4.0-test8/linux/mm/memory.c Fri Sep 8 13:27:13 2000 +++ linux/mm/memory.c Fri Sep 15 16:51:21 2000 @@ -67,7 +67,7 @@ copy_user_highpage(to, from, address); } -mem_map_t * mem_map = NULL; +mem_map_t * mem_map; /* * Note: this doesn't free the actual pages themselves. That @@ -1040,7 +1040,8 @@ num = valid_swaphandles(entry, &offset); for (i = 0; i < num; offset++, i++) { /* Don't block on I/O for read-ahead */ - if (atomic_read(&nr_async_pages) >= pager_daemon.swap_cluster) { + if (atomic_read(&nr_async_pages) >= pager_daemon.swap_cluster + * (1 << page_cluster)) { while (i++ < num) swap_free(SWP_ENTRY(SWP_TYPE(entry), offset++)); break; @@ -1239,7 +1240,7 @@ pgd = pgd_offset(mm, address); pmd = pmd_alloc(pgd, address); - + if (pmd) { pte_t * pte = pte_alloc(pmd, address); if (pte) diff -u --recursive --new-file v2.4.0-test8/linux/mm/page_alloc.c linux/mm/page_alloc.c --- v2.4.0-test8/linux/mm/page_alloc.c Fri Sep 8 13:27:13 2000 +++ linux/mm/page_alloc.c Fri Sep 15 16:51:21 2000 @@ -25,7 +25,8 @@ #endif int nr_swap_pages; -int nr_lru_pages; +int nr_active_pages; +int nr_inactive_dirty_pages; pg_data_t *pgdat_list; static char *zone_names[MAX_NR_ZONES] = { "DMA", "Normal", "HighMem" }; @@ -33,6 +34,8 @@ static int zone_balance_min[MAX_NR_ZONES] = { 10 , 10, 10, }; static int zone_balance_max[MAX_NR_ZONES] = { 255 , 255, 255, }; +struct list_head active_list; +struct list_head inactive_dirty_list; /* * Free_page() adds the page to the free lists. This is optimized for * fast normal cases (no error jumps taken normally). @@ -96,7 +99,16 @@ BUG(); if (PageDirty(page)) BUG(); + if (PageActive(page)) + BUG(); + if (PageInactiveDirty(page)) + BUG(); + if (PageInactiveClean(page)) + BUG(); + page->flags &= ~(1<age = PAGE_AGE_START; + zone = page->zone; mask = (~0UL) << order; @@ -142,10 +154,13 @@ spin_unlock_irqrestore(&zone->lock, flags); - if (zone->free_pages > zone->pages_high) { - zone->zone_wake_kswapd = 0; - zone->low_on_memory = 0; - } + /* + * We don't want to protect this variable from race conditions + * since it's nothing important, but we do want to make sure + * it never gets negative. + */ + if (memory_pressure > NR_CPUS) + memory_pressure--; } #define MARK_USED(index, order, area) \ @@ -203,6 +218,7 @@ set_page_count(page, 1); if (BAD_RANGE(zone,page)) BUG(); + DEBUG_ADD_PAGE return page; } curr_order++; @@ -213,13 +229,77 @@ return NULL; } +#define PAGES_MIN 0 +#define PAGES_LOW 1 +#define PAGES_HIGH 2 + +/* + * This function does the dirty work for __alloc_pages + * and is separated out to keep the code size smaller. + * (suggested by Davem at 1:30 AM, typed by Rik at 6 AM) + */ +static struct page * __alloc_pages_limit(zonelist_t *zonelist, + unsigned long order, int limit, int direct_reclaim) +{ + zone_t **zone = zonelist->zones; + + for (;;) { + zone_t *z = *(zone++); + unsigned long water_mark; + + if (!z) + break; + if (!z->size) + BUG(); + + /* + * We allocate if the number of free + inactive_clean + * pages is above the watermark. + */ + switch (limit) { + default: + case 0: + water_mark = z->pages_min; + break; + case 1: + water_mark = z->pages_low; + break; + case 2: + water_mark = z->pages_high; + } + + if (z->free_pages + z->inactive_clean_pages > water_mark) { + struct page *page = NULL; + /* If possible, reclaim a page directly. */ + if (direct_reclaim && z->free_pages < z->pages_min + 8) + page = reclaim_page(z); + /* If that fails, fall back to rmqueue. */ + if (!page) + page = rmqueue(z, order); + if (page) + return page; + } + } + + /* Found nothing. */ + return NULL; +} + + /* * This is the 'heart' of the zoned buddy allocator: */ struct page * __alloc_pages(zonelist_t *zonelist, unsigned long order) { zone_t **zone; - extern wait_queue_head_t kswapd_wait; + int direct_reclaim = 0; + unsigned int gfp_mask = zonelist->gfp_mask; + struct page * page = NULL; + + /* + * Allocations put pressure on the VM subsystem. + */ + memory_pressure++; /* * (If anyone calls gfp from interrupts nonatomically then it @@ -229,6 +309,27 @@ * in a higher zone fails. */ + /* + * Can we take pages directly from the inactive_clean + * list? + */ + if (order == 0 && (gfp_mask & __GFP_WAIT) && + !(current->flags & PF_MEMALLOC)) + direct_reclaim = 1; + + /* + * Are we low on inactive pages? + */ + if (inactive_shortage() > inactive_target / 2 && free_shortage()) + wakeup_kswapd(0); + +try_again: + /* + * First, see if we have any zones with lots of free memory. + * + * We allocate free memory first because it doesn't contain + * any data ... DUH! + */ zone = zonelist->zones; for (;;) { zone_t *z = *(zone++); @@ -237,82 +338,143 @@ if (!z->size) BUG(); - /* Are we supposed to free memory? Don't make it worse.. */ - if (!z->zone_wake_kswapd) { - struct page *page = rmqueue(z, order); - if (z->free_pages < z->pages_low) { - z->zone_wake_kswapd = 1; - if (waitqueue_active(&kswapd_wait)) - wake_up_interruptible(&kswapd_wait); - } + if (z->free_pages > z->pages_low) { + page = rmqueue(z, order); if (page) return page; + } else if (z->free_pages < z->pages_min && + waitqueue_active(&kreclaimd_wait)) { + wake_up_interruptible(&kreclaimd_wait); } } - /* Three possibilities to get here - * - Previous alloc_pages resulted in last zone set to have - * zone_wake_kswapd and start it. kswapd has not been able - * to release enough pages so that one zone does not have - * zone_wake_kswapd set. - * - Different sets of zones (zonelist) - * previous did not have all zones with zone_wake_kswapd but - * this one has... should kswapd be woken up? it will run once. - * - SMP race, kswapd went to sleep slightly after it as running - * in 'if (waitqueue_active(...))' above. - * + anyway the test is very cheap to do... + /* + * Try to allocate a page from a zone with a HIGH + * amount of free + inactive_clean pages. + * + * If there is a lot of activity, inactive_target + * will be high and we'll have a good chance of + * finding a page using the HIGH limit. */ - if (waitqueue_active(&kswapd_wait)) - wake_up_interruptible(&kswapd_wait); + page = __alloc_pages_limit(zonelist, order, PAGES_HIGH, direct_reclaim); + if (page) + return page; /* - * Ok, we don't have any zones that don't need some - * balancing.. See if we have any that aren't critical.. + * Then try to allocate a page from a zone with more + * than zone->pages_low free + inactive_clean pages. + * + * When the working set is very large and VM activity + * is low, we're most likely to have our allocation + * succeed here. */ - zone = zonelist->zones; - for (;;) { - zone_t *z = *(zone++); - if (!z) - break; - if (!z->low_on_memory) { - struct page *page = rmqueue(z, order); - if (z->free_pages < z->pages_min) - z->low_on_memory = 1; - if (page) - return page; - } - } + page = __alloc_pages_limit(zonelist, order, PAGES_LOW, direct_reclaim); + if (page) + return page; + + /* + * OK, none of the zones on our zonelist has lots + * of pages free. + * + * We wake up kswapd, in the hope that kswapd will + * resolve this situation before memory gets tight. + */ + wakeup_kswapd(0); /* - * Uhhuh. All the zones have been critical, which means that - * we'd better do some synchronous swap-out. kswapd has not - * been able to cope.. + * After waking up kswapd, we try to allocate a page + * from any zone which isn't critical yet. + * + * Kswapd should, in most situations, bring the situation + * back to normal in no time. + */ + page = __alloc_pages_limit(zonelist, order, PAGES_MIN, direct_reclaim); + if (page) + return page; + + /* + * Damn, we didn't succeed. + * + * This can be due to 2 reasons: + * - we're doing a higher-order allocation + * --> move pages to the free list until we succeed + * - we're /really/ tight on memory + * --> wait on the kswapd waitqueue until memory is freed */ if (!(current->flags & PF_MEMALLOC)) { - int gfp_mask = zonelist->gfp_mask; - if (!try_to_free_pages(gfp_mask)) { - if (!(gfp_mask & __GFP_HIGH)) - goto fail; + /* + * Are we dealing with a higher order allocation? + * + * Move pages from the inactive_clean to the free list + * in the hope of creating a large, physically contiguous + * piece of free memory. + */ + if (order > 0 && (gfp_mask & __GFP_WAIT)) { + zone = zonelist->zones; + /* First, clean some dirty pages. */ + page_launder(gfp_mask, 1); + for (;;) { + zone_t *z = *(zone++); + if (!z) + break; + if (!z->size) + continue; + while (z->inactive_clean_pages) { + struct page * page; + /* Move one page to the free list. */ + page = reclaim_page(z); + if (!page) + break; + __free_page(page); + /* Try if the allocation succeeds. */ + page = rmqueue(z, order); + if (page) + return page; + } + } + } + /* + * When we arrive here, we are really tight on memory. + * + * We wake up kswapd and sleep until kswapd wakes us + * up again. After that we loop back to the start. + * + * We have to do this because something else might eat + * the memory kswapd frees for us (interrupts, other + * processes, etc). + */ + if (gfp_mask & __GFP_WAIT) { + wakeup_kswapd(1); + goto try_again; } } /* * Final phase: allocate anything we can! + * + * This is basically reserved for PF_MEMALLOC and + * GFP_ATOMIC allocations... */ zone = zonelist->zones; for (;;) { - struct page *page; - zone_t *z = *(zone++); + struct page * page = NULL; if (!z) break; - page = rmqueue(z, order); + if (!z->size) + BUG(); + + if (direct_reclaim) + page = reclaim_page(z); + if (!page) + page = rmqueue(z, order); if (page) return page; } -fail: /* No luck.. */ + if (!order) + show_free_areas(); return NULL; } @@ -377,18 +539,39 @@ } /* - * Amount of free RAM allocatable as buffer memory: + * Total amount of inactive_clean (allocatable) RAM: */ -unsigned int nr_free_buffer_pages (void) +unsigned int nr_inactive_clean_pages (void) { unsigned int sum; zone_t *zone; int i; - sum = nr_lru_pages / 3; + sum = 0; for (i = 0; i < NUMNODES; i++) - for (zone = NODE_DATA(i)->node_zones; zone <= NODE_DATA(i)->node_zones+ZONE_NORMAL; zone++) - sum += zone->free_pages; + for (zone = NODE_DATA(i)->node_zones; zone < NODE_DATA(i)->node_zones + MAX_NR_ZONES; zone++) + sum += zone->inactive_clean_pages; + return sum; +} + +/* + * Amount of free RAM allocatable as buffer memory: + */ +unsigned int nr_free_buffer_pages (void) +{ + unsigned int sum; + + sum = nr_free_pages(); + sum += nr_inactive_clean_pages(); + sum += nr_inactive_dirty_pages; + /* + * We don't want dirty page writebehind to put too + * much pressure on the working set, but we want it + * to be possible to have some dirty pages in the + * working set without upsetting the writebehind logic. + */ + sum += nr_active_pages >> 4; + return sum; } @@ -418,9 +601,11 @@ nr_free_pages() << (PAGE_SHIFT-10), nr_free_highpages() << (PAGE_SHIFT-10)); - printk("( Free: %d, lru_cache: %d (%d %d %d) )\n", + printk("( Active: %d, inactive_dirty: %d, inactive_clean: %d, free: %d (%d %d %d) )\n", + nr_active_pages, + nr_inactive_dirty_pages, + nr_inactive_clean_pages(), nr_free_pages(), - nr_lru_pages, freepages.min, freepages.low, freepages.high); @@ -430,17 +615,6 @@ zone_t *zone = NODE_DATA(nid)->node_zones + type; unsigned long nr, total, flags; - printk(" %c%d%d %s: ", - (zone->free_pages > zone->pages_low - ? (zone->free_pages > zone->pages_high - ? ' ' - : 'H') - : (zone->free_pages > zone->pages_min - ? 'M' - : 'L')), - zone->zone_wake_kswapd, zone->low_on_memory, - zone->name); - total = 0; if (zone->size) { spin_lock_irqsave(&zone->lock, flags); @@ -570,7 +744,8 @@ freepages.min += i; freepages.low += i * 2; freepages.high += i * 3; - memlist_init(&lru_cache); + memlist_init(&active_list); + memlist_init(&inactive_dirty_list); /* * Some architectures (with lots of mem and discontinous memory @@ -618,6 +793,9 @@ zone->lock = SPIN_LOCK_UNLOCKED; zone->zone_pgdat = pgdat; zone->free_pages = 0; + zone->inactive_clean_pages = 0; + zone->inactive_dirty_pages = 0; + memlist_init(&zone->inactive_clean_list); if (!size) continue; @@ -631,8 +809,6 @@ zone->pages_min = mask; zone->pages_low = mask*2; zone->pages_high = mask*3; - zone->low_on_memory = 0; - zone->zone_wake_kswapd = 0; zone->zone_mem_map = mem_map + offset; zone->zone_start_mapnr = offset; zone->zone_start_paddr = zone_start_paddr; diff -u --recursive --new-file v2.4.0-test8/linux/mm/page_io.c linux/mm/page_io.c --- v2.4.0-test8/linux/mm/page_io.c Wed Aug 9 19:19:51 2000 +++ linux/mm/page_io.c Fri Sep 15 16:51:21 2000 @@ -43,7 +43,8 @@ struct inode *swapf = 0; /* Don't allow too many pending pages in flight.. */ - if (atomic_read(&nr_async_pages) > pager_daemon.swap_cluster) + if ((rw == WRITE) && atomic_read(&nr_async_pages) > + pager_daemon.swap_cluster * (1 << page_cluster)) wait = 1; if (rw == READ) { diff -u --recursive --new-file v2.4.0-test8/linux/mm/swap.c linux/mm/swap.c --- v2.4.0-test8/linux/mm/swap.c Tue Dec 7 09:32:52 1999 +++ linux/mm/swap.c Fri Sep 15 16:51:21 2000 @@ -40,7 +40,18 @@ }; /* How many pages do we try to swap or page in/out together? */ -int page_cluster = 4; /* Default value modified in swap_setup() */ +int page_cluster; + +/* + * This variable contains the amount of page steals the system + * is doing, averaged over a minute. We use this to determine how + * many inactive pages we should have. + * + * In reclaim_page and __alloc_pages: memory_pressure++ + * In __free_pages_ok: memory_pressure-- + * In recalculate_vm_stats the value is decayed (once a second) + */ +int memory_pressure; /* We track the number of pages currently being asynchronously swapped out, so that we don't try to swap TOO many pages out at once */ @@ -61,13 +72,240 @@ pager_daemon_t pager_daemon = { 512, /* base number for calculating the number of tries */ SWAP_CLUSTER_MAX, /* minimum number of tries */ - SWAP_CLUSTER_MAX, /* do swap I/O in clusters of this size */ + 8, /* do swap I/O in clusters of this size */ }; +/** + * age_page_{up,down} - page aging helper functions + * @page - the page we want to age + * @nolock - are we already holding the pagelist_lru_lock? + * + * If the page is on one of the lists (active, inactive_dirty or + * inactive_clean), we will grab the pagelist_lru_lock as needed. + * If you're already holding the lock, call this function with the + * nolock argument non-zero. + */ +void age_page_up_nolock(struct page * page) +{ + /* + * We're dealing with an inactive page, move the page + * to the active list. + */ + if (!page->age) + activate_page_nolock(page); + + /* The actual page aging bit */ + page->age += PAGE_AGE_ADV; + if (page->age > PAGE_AGE_MAX) + page->age = PAGE_AGE_MAX; +} + +void age_page_down_nolock(struct page * page) +{ + /* The actual page aging bit */ + page->age /= 2; + + /* + * The page is now an old page. Move to the inactive + * list (if possible ... see below). + */ + if (!page->age) + deactivate_page_nolock(page); +} + +void age_page_up(struct page * page) +{ + /* + * We're dealing with an inactive page, move the page + * to the active list. + */ + if (!page->age) + activate_page(page); + + /* The actual page aging bit */ + page->age += PAGE_AGE_ADV; + if (page->age > PAGE_AGE_MAX) + page->age = PAGE_AGE_MAX; +} + +void age_page_down(struct page * page) +{ + /* The actual page aging bit */ + page->age /= 2; + + /* + * The page is now an old page. Move to the inactive + * list (if possible ... see below). + */ + if (!page->age) + deactivate_page(page); +} + + +/** + * (de)activate_page - move pages from/to active and inactive lists + * @page: the page we want to move + * @nolock - are we already holding the pagemap_lru_lock? + * + * Deactivate_page will move an active page to the right + * inactive list, while activate_page will move a page back + * from one of the inactive lists to the active list. If + * called on a page which is not on any of the lists, the + * page is left alone. + */ +void deactivate_page_nolock(struct page * page) +{ + page->age = 0; + + /* + * Don't touch it if it's not on the active list. + * (some pages aren't on any list at all) + */ + if (PageActive(page) && (page_count(page) == 1 || page->buffers) && + !page_ramdisk(page)) { + + /* + * We can move the page to the inactive_dirty list + * if we know there is backing store available. + */ + if (page->buffers) { + del_page_from_active_list(page); + add_page_to_inactive_dirty_list(page); + /* + * If the page is clean and immediately reusable, + * we can move it to the inactive_clean list. + */ + } else if (page->mapping && !PageDirty(page) && + !PageLocked(page)) { + del_page_from_active_list(page); + add_page_to_inactive_clean_list(page); + } + /* + * ELSE: no backing store available, leave it on + * the active list. + */ + } +} + +void deactivate_page(struct page * page) +{ + spin_lock(&pagemap_lru_lock); + deactivate_page_nolock(page); + spin_unlock(&pagemap_lru_lock); +} + /* - * Perform any setup for the swap system + * Move an inactive page to the active list. + */ +void activate_page_nolock(struct page * page) +{ + if (PageInactiveDirty(page)) { + del_page_from_inactive_dirty_list(page); + add_page_to_active_list(page); + } else if (PageInactiveClean(page)) { + del_page_from_inactive_clean_list(page); + add_page_to_active_list(page); + } else { + /* + * The page was not on any list, so we take care + * not to do anything. + */ + } +} + +void activate_page(struct page * page) +{ + spin_lock(&pagemap_lru_lock); + activate_page_nolock(page); + spin_unlock(&pagemap_lru_lock); +} + +/** + * lru_cache_add: add a page to the page lists + * @page: the page to add + */ +void lru_cache_add(struct page * page) +{ + spin_lock(&pagemap_lru_lock); + if (!PageLocked(page)) + BUG(); + /* + * Heisenbug Compensator(tm) + * This bug shouldn't trigger, but for unknown reasons it + * sometimes does. If there are no signs of list corruption, + * we ignore the problem. Else we BUG()... + */ + if (PageActive(page) || PageInactiveDirty(page) || + PageInactiveClean(page)) { + struct list_head * page_lru = &page->lru; + if (page_lru->next->prev != page_lru) { + printk("VM: lru_cache_add, bit or list corruption..\n"); + BUG(); + } + printk("VM: lru_cache_add, page already in list!\n"); + goto page_already_on_list; + } + add_page_to_active_list(page); + /* This should be relatively rare */ + if (!page->age) + deactivate_page_nolock(page); +page_already_on_list: + spin_unlock(&pagemap_lru_lock); +} + +/** + * __lru_cache_del: remove a page from the page lists + * @page: the page to add + * + * This function is for when the caller already holds + * the pagemap_lru_lock. */ +void __lru_cache_del(struct page * page) +{ + if (PageActive(page)) { + del_page_from_active_list(page); + } else if (PageInactiveDirty(page)) { + del_page_from_inactive_dirty_list(page); + } else if (PageInactiveClean(page)) { + del_page_from_inactive_clean_list(page); + } else { + printk("VM: __lru_cache_del, found unknown page ?!\n"); + } + DEBUG_ADD_PAGE +} +/** + * lru_cache_del: remove a page from the page lists + * @page: the page to remove + */ +void lru_cache_del(struct page * page) +{ + if (!PageLocked(page)) + BUG(); + spin_lock(&pagemap_lru_lock); + __lru_cache_del(page); + spin_unlock(&pagemap_lru_lock); +} + +/** + * recalculate_vm_stats - recalculate VM statistics + * + * This function should be called once a second to recalculate + * some useful statistics the VM subsystem uses to determine + * its behaviour. + */ +void recalculate_vm_stats(void) +{ + /* + * Substract one second worth of memory_pressure from + * memory_pressure. + */ + memory_pressure -= (memory_pressure >> INACTIVE_SHIFT); +} + +/* + * Perform any setup for the swap system + */ void __init swap_setup(void) { /* Use a smaller cluster for memory <16MB or <32MB */ diff -u --recursive --new-file v2.4.0-test8/linux/mm/swap_state.c linux/mm/swap_state.c --- v2.4.0-test8/linux/mm/swap_state.c Wed Aug 9 19:19:51 2000 +++ linux/mm/swap_state.c Fri Sep 15 16:51:21 2000 @@ -73,7 +73,7 @@ PAGE_BUG(page); PageClearSwapCache(page); - remove_inode_page(page); + __remove_inode_page(page); } /* @@ -105,7 +105,9 @@ if (block_flushpage(page, 0)) lru_cache_del(page); + spin_lock(&pagecache_lock); __delete_from_swap_cache(page); + spin_unlock(&pagecache_lock); page_cache_release(page); } diff -u --recursive --new-file v2.4.0-test8/linux/mm/vmscan.c linux/mm/vmscan.c --- v2.4.0-test8/linux/mm/vmscan.c Fri Sep 8 13:27:13 2000 +++ linux/mm/vmscan.c Fri Sep 15 16:51:21 2000 @@ -9,6 +9,7 @@ * to bring the system back to freepages.high: 2.4.97, Rik van Riel. * Version: $Id: vmscan.c,v 1.5 1998/02/23 22:14:28 sct Exp $ * Zone aware kswapd started 02/00, Kanoj Sarcar (kanoj@sgi.com). + * Multiqueue VM started 5.8.00, Rik van Riel. */ #include @@ -40,6 +41,7 @@ swp_entry_t entry; struct page * page; int (*swapout)(struct page *, struct file *); + int onlist; pte = *page_table; if (!pte_present(pte)) @@ -51,16 +53,36 @@ if (mm->swap_cnt) mm->swap_cnt--; + onlist = PageActive(page); /* Don't look at this pte if it's been accessed recently. */ if (pte_young(pte)) { - /* - * Transfer the "accessed" bit from the page - * tables to the global page map. - */ set_pte(page_table, pte_mkold(pte)); - SetPageReferenced(page); + if (onlist) { + /* + * Transfer the "accessed" bit from the page + * tables to the global page map. Page aging + * will be done by refill_inactive_scan(). + */ + SetPageReferenced(page); + } else { + /* + * The page is not on the active list, so + * we have to do the page aging ourselves. + */ + age_page_up(page); + } goto out_failed; } + if (!onlist) + age_page_down(page); + + /* + * If the page is in active use by us, or if the page + * is in active use by others, don't unmap it or + * (worse) start unneeded IO. + */ + if (page->age > 0) + goto out_failed; if (TryLockPage(page)) goto out_failed; @@ -82,6 +104,7 @@ vma->vm_mm->rss--; flush_tlb_page(vma, address); page_cache_release(page); + deactivate_page(page); goto out_failed; } @@ -116,7 +139,9 @@ * Don't do any of the expensive stuff if * we're not really interested in this zone. */ - if (page->zone->free_pages > page->zone->pages_high) + if (page->zone->free_pages + page->zone->inactive_clean_pages + + page->zone->inactive_dirty_pages + > page->zone->pages_high + inactive_target) goto out_unlock; /* @@ -152,6 +177,7 @@ if (file) fput(file); if (!error) goto out_free_success; + deactivate_page(page); page_cache_release(page); return error; } @@ -182,6 +208,7 @@ /* OK, do a physical asynchronous write to swap. */ rw_swap_page(WRITE, page, 0); + deactivate_page(page); out_free_success: page_cache_release(page); @@ -323,17 +350,22 @@ int result = swap_out_vma(mm, vma, address, gfp_mask); if (result) return result; + if (!mm->swap_cnt) + goto out_unlock; vma = vma->vm_next; if (!vma) break; address = vma->vm_start; } } + /* Reset to 0 when we reach the end of address space */ + mm->swap_address = 0; + mm->swap_cnt = 0; + +out_unlock: vmlist_access_unlock(mm); /* We didn't find anything for the process */ - mm->swap_cnt = 0; - mm->swap_address = 0; return 0; } @@ -342,6 +374,9 @@ * N.B. This function returns only 0 or 1. Return values != 1 from * the lower level routines result in continued processing. */ +#define SWAP_SHIFT 5 +#define SWAP_MIN 8 + static int swap_out(unsigned int priority, int gfp_mask) { struct task_struct * p; @@ -363,7 +398,7 @@ * Think of swap_cnt as a "shadow rss" - it tells us which process * we want to page out (always try largest first). */ - counter = (nr_threads << 2) >> (priority >> 2); + counter = (nr_threads << SWAP_SHIFT) >> priority; if (counter < 1) counter = 1; @@ -382,8 +417,11 @@ if (mm->rss <= 0) continue; /* Refresh swap_cnt? */ - if (assign == 1) - mm->swap_cnt = mm->rss; + if (assign == 1) { + mm->swap_cnt = (mm->rss >> SWAP_SHIFT); + if (mm->swap_cnt < SWAP_MIN) + mm->swap_cnt = SWAP_MIN; + } if (mm->swap_cnt > max_cnt) { max_cnt = mm->swap_cnt; best = mm; @@ -418,50 +456,385 @@ return __ret; } -/* - * Check if there is any memory pressure (free_pages < pages_low) + +/** + * reclaim_page - reclaims one page from the inactive_clean list + * @zone: reclaim a page from this zone + * + * The pages on the inactive_clean can be instantly reclaimed. + * The tests look impressive, but most of the time we'll grab + * the first page of the list and exit successfully. */ -static inline int memory_pressure(void) +struct page * reclaim_page(zone_t * zone) { - pg_data_t *pgdat = pgdat_list; + struct page * page = NULL; + struct list_head * page_lru; + int maxscan; - do { - int i; - for(i = 0; i < MAX_NR_ZONES; i++) { - zone_t *zone = pgdat->node_zones+ i; - if (zone->size && - zone->free_pages < zone->pages_low) - return 1; + /* + * We only need the pagemap_lru_lock if we don't reclaim the page, + * but we have to grab the pagecache_lock before the pagemap_lru_lock + * to avoid deadlocks and most of the time we'll succeed anyway. + */ + spin_lock(&pagecache_lock); + spin_lock(&pagemap_lru_lock); + maxscan = zone->inactive_clean_pages; + while ((page_lru = zone->inactive_clean_list.prev) != + &zone->inactive_clean_list && maxscan--) { + page = list_entry(page_lru, struct page, lru); + + /* Wrong page on list?! (list corruption, should not happen) */ + if (!PageInactiveClean(page)) { + printk("VM: reclaim_page, wrong page on list.\n"); + list_del(page_lru); + page->zone->inactive_clean_pages--; + continue; } - pgdat = pgdat->node_next; - } while (pgdat); - return 0; + /* Page is or was in use? Move it to the active list. */ + if (PageTestandClearReferenced(page) || page->age > 0 || + (!page->buffers && page_count(page) > 1)) { + del_page_from_inactive_clean_list(page); + add_page_to_active_list(page); + continue; + } + + /* The page is dirty, or locked, move to inactive_diry list. */ + if (page->buffers || TryLockPage(page)) { + del_page_from_inactive_clean_list(page); + add_page_to_inactive_dirty_list(page); + continue; + } + + /* OK, remove the page from the caches. */ + if (PageSwapCache(page)) { + __delete_from_swap_cache(page); + goto found_page; + } + + if (page->mapping) { + __remove_inode_page(page); + goto found_page; + } + + /* We should never ever get here. */ + printk(KERN_ERR "VM: reclaim_page, found unknown page\n"); + list_del(page_lru); + zone->inactive_clean_pages--; + UnlockPage(page); + } + /* Reset page pointer, maybe we encountered an unfreeable page. */ + page = NULL; + goto out; + +found_page: + del_page_from_inactive_clean_list(page); + UnlockPage(page); + if (page_count(page) != 1) + printk("VM: reclaim_page, found page with count %d!\n", + page_count(page)); +out: + spin_unlock(&pagemap_lru_lock); + spin_unlock(&pagecache_lock); + memory_pressure++; + return page; +} + +/** + * page_launder - clean dirty inactive pages, move to inactive_clean list + * @gfp_mask: what operations we are allowed to do + * @sync: should we wait synchronously for the cleaning of pages + * + * When this function is called, we are most likely low on free + + * inactive_clean pages. Since we want to refill those pages as + * soon as possible, we'll make two loops over the inactive list, + * one to move the already cleaned pages to the inactive_clean lists + * and one to (often asynchronously) clean the dirty inactive pages. + * + * In situations where kswapd cannot keep up, user processes will + * end up calling this function. Since the user process needs to + * have a page before it can continue with its allocation, we'll + * do synchronous page flushing in that case. + * + * This code is heavily inspired by the FreeBSD source code. Thanks + * go out to Matthew Dillon. + */ +#define MAX_SYNC_LAUNDER (1 << page_cluster) +#define MAX_LAUNDER (MAX_SYNC_LAUNDER * 4) +int page_launder(int gfp_mask, int sync) +{ + int synclaunder, launder_loop, maxscan, cleaned_pages, maxlaunder; + struct list_head * page_lru; + struct page * page; + + launder_loop = 0; + synclaunder = 0; + maxlaunder = 0; + cleaned_pages = 0; + +dirty_page_rescan: + spin_lock(&pagemap_lru_lock); + maxscan = nr_inactive_dirty_pages; + while ((page_lru = inactive_dirty_list.prev) != &inactive_dirty_list && + maxscan-- > 0) { + page = list_entry(page_lru, struct page, lru); + + /* Wrong page on list?! (list corruption, should not happen) */ + if (!PageInactiveDirty(page)) { + printk("VM: page_launder, wrong page on list.\n"); + list_del(page_lru); + nr_inactive_dirty_pages--; + page->zone->inactive_dirty_pages--; + continue; + } + + /* Page is or was in use? Move it to the active list. */ + if (PageTestandClearReferenced(page) || page->age > 0 || + (!page->buffers && page_count(page) > 1) || + page_ramdisk(page)) { + del_page_from_inactive_dirty_list(page); + add_page_to_active_list(page); + continue; + } + + /* + * The page is locked. IO in progress? + * Move it to the back of the list. + */ + if (TryLockPage(page)) { + list_del(page_lru); + list_add(page_lru, &inactive_dirty_list); + continue; + } + + /* + * If the page has buffers, try to free the buffer mappings + * associated with this page. If we succeed we either free + * the page (in case it was a buffercache only page) or we + * move the page to the inactive_clean list. + * + * On the first round, we should free all previously cleaned + * buffer pages + */ + if (page->buffers) { + int wait, clearedbuf; + int freed_page = 0; + /* + * Since we might be doing disk IO, we have to + * drop the spinlock and take an extra reference + * on the page so it doesn't go away from under us. + */ + del_page_from_inactive_dirty_list(page); + page_cache_get(page); + spin_unlock(&pagemap_lru_lock); + + /* Will we do (asynchronous) IO? */ + if (launder_loop && synclaunder-- > 0) + wait = 2; /* Synchrounous IO */ + else if (launder_loop && maxlaunder-- > 0) + wait = 1; /* Async IO */ + else + wait = 0; /* No IO */ + + /* Try to free the page buffers. */ + clearedbuf = try_to_free_buffers(page, wait); + + /* + * Re-take the spinlock. Note that we cannot + * unlock the page yet since we're still + * accessing the page_struct here... + */ + spin_lock(&pagemap_lru_lock); + + /* The buffers were not freed. */ + if (!clearedbuf) { + add_page_to_inactive_dirty_list(page); + + /* The page was only in the buffer cache. */ + } else if (!page->mapping) { + atomic_dec(&buffermem_pages); + freed_page = 1; + cleaned_pages++; + + /* The page has more users besides the cache and us. */ + } else if (page_count(page) > 2) { + add_page_to_active_list(page); + + /* OK, we "created" a freeable page. */ + } else /* page->mapping && page_count(page) == 2 */ { + add_page_to_inactive_clean_list(page); + cleaned_pages++; + } + + /* + * Unlock the page and drop the extra reference. + * We can only do it here because we ar accessing + * the page struct above. + */ + UnlockPage(page); + page_cache_release(page); + + /* + * If we're freeing buffer cache pages, stop when + * we've got enough free memory. + */ + if (freed_page && !free_shortage()) + break; + continue; + } else { + /* + * Somebody else freed the bufferheads for us? + * This really shouldn't happen, but we check + * for it anyway. + */ + printk("VM: page_launder, found pre-cleaned page ?!\n"); + UnlockPage(page); + if (page->mapping && !PageDirty(page)) { + del_page_from_inactive_dirty_list(page); + add_page_to_inactive_clean_list(page); + cleaned_pages++; + } + } + } + spin_unlock(&pagemap_lru_lock); + + /* + * If we don't have enough free pages, we loop back once + * to queue the dirty pages for writeout. When we were called + * by a user process (that /needs/ a free page) and we didn't + * free anything yet, we wait synchronously on the writeout of + * MAX_SYNC_LAUNDER pages. + * + * We also wake up bdflush, since bdflush should, under most + * loads, flush out the dirty pages before we have to wait on + * IO. + */ + if (!launder_loop && free_shortage()) { + launder_loop = 1; + if (sync && !cleaned_pages) + synclaunder = MAX_SYNC_LAUNDER; + /* We only do a few "out of order" flushes. */ + maxlaunder = MAX_LAUNDER; + /* Kflushd takes care of the rest. */ + wakeup_bdflush(0); + current->policy |= SCHED_YIELD; + schedule(); + goto dirty_page_rescan; + } + + /* Return the number of pages moved to the inactive_clean list. */ + return cleaned_pages; +} + +/** + * refill_inactive_scan - scan the active list and find pages to deactivate + * @priority: the priority at which to scan + * @oneshot: exit after deactivating one page + * + * This function will scan a portion of the active list to find + * unused pages, those pages will then be moved to the inactive list. + */ +int refill_inactive_scan(unsigned int priority, int oneshot) +{ + struct list_head * page_lru; + struct page * page; + int maxscan; + int ret = 0; + + /* Take the lock while messing with the list... */ + spin_lock(&pagemap_lru_lock); + maxscan = nr_active_pages >> priority; + while (maxscan-- > 0 && (page_lru = active_list.prev) != &active_list) { + page = list_entry(page_lru, struct page, lru); + + /* Wrong page on list?! (list corruption, should not happen) */ + if (!PageActive(page)) { + printk("VM: refill_inactive, wrong page on list.\n"); + list_del(page_lru); + nr_active_pages--; + continue; + } + + /* Do aging on the pages. */ + if (PageTestandClearReferenced(page)) { + age_page_up_nolock(page); + goto must_be_active; + } else { + age_page_down_nolock(page); + } + /* + * If the page is still on the active list, move it + * to the other end of the list. Otherwise it was + * deactivated by age_page_down and we exit successfully. + */ + if (PageActive(page)) { +must_be_active: + list_del(page_lru); + list_add(page_lru, &active_list); + } else { + ret = 1; + if (oneshot) + break; + } + } + spin_unlock(&pagemap_lru_lock); + + return ret; } /* - * Check if all zones have recently had memory_pressure (zone_wake_kswapd) + * Check if there are zones with a severe shortage of free pages, + * or if all zones have a minor shortage. */ -static inline int keep_kswapd_awake(void) +int free_shortage(void) { - int all_recent = 1; pg_data_t *pgdat = pgdat_list; + int sum = 0; + int freeable = nr_free_pages() + nr_inactive_clean_pages(); + + /* Are we low on truly free pages? */ + if (nr_free_pages() < freepages.min) + return freepages.high - nr_free_pages(); + + /* Are we low on free pages over-all? */ + if (freeable < freepages.high) + return freepages.high - freeable; + /* If not, are we very low on any particular zone? */ do { int i; for(i = 0; i < MAX_NR_ZONES; i++) { zone_t *zone = pgdat->node_zones+ i; - if (zone->size) { - if (zone->free_pages < zone->pages_min) - return 1; - if (!zone->zone_wake_kswapd) - all_recent = 0; + if (zone->size && (zone->inactive_clean_pages + + zone->free_pages < zone->pages_min)) { + sum += zone->pages_min; + sum -= zone->free_pages; + sum -= zone->inactive_clean_pages; } } pgdat = pgdat->node_next; } while (pgdat); - return all_recent; + return sum; +} + +/* + * How many inactive pages are we short? + */ +int inactive_shortage(void) +{ + int shortage = 0; + + shortage += freepages.high; + shortage += inactive_target; + shortage -= nr_free_pages(); + shortage -= nr_inactive_clean_pages(); + shortage -= nr_inactive_dirty_pages; + + if (shortage > 0) + return shortage; + + return 0; } /* @@ -472,41 +845,39 @@ * We want to try to free "count" pages, and we want to * cluster them so that we get good swap-out behaviour. * - * Don't try _too_ hard, though. We don't want to have bad - * latency. - * - * Note: only called by kswapd and try_to_free_pages - * both can WAIT at top level. + * OTOH, if we're a user process (and not kswapd), we + * really care about latency. In that case we don't try + * to free too many pages. */ -#define FREE_COUNT 8 -#define SWAP_COUNT 16 -static int do_try_to_free_pages(unsigned int gfp_mask) -{ - int priority; - int count = FREE_COUNT; - int swap_count; +static int refill_inactive(unsigned int gfp_mask, int user) +{ + int priority, count, start_count, made_progress; + + count = inactive_shortage() + free_shortage(); + if (user) + count = (1 << page_cluster); + start_count = count; /* Always trim SLAB caches when memory gets low. */ kmem_cache_reap(gfp_mask); - priority = 64; + priority = 6; do { + made_progress = 0; + + if (!inactive_shortage() && !free_shortage()) + goto done; + if (current->need_resched) { schedule(); - /* time has passed - pressure too? */ - if (!memory_pressure()) - goto done; } - while (shrink_mmap(priority, gfp_mask)) { + while (refill_inactive_scan(priority, 1)) { + made_progress = 1; if (!--count) goto done; } - /* check if mission completed */ - if (!keep_kswapd_awake()) - goto done; - /* Try to get rid of some shared memory pages.. */ if (gfp_mask & __GFP_IO) { /* @@ -525,10 +896,9 @@ * if (count <= 0) * goto done; */ - if (!keep_kswapd_awake()) - goto done; while (shm_swap(priority, gfp_mask)) { + made_progress = 1; if (!--count) goto done; } @@ -536,32 +906,70 @@ /* * Then, try to page stuff out.. - * - * This will not actually free any pages (they get - * put in the swap cache), so we must not count this - * as a "count" success. */ - swap_count = SWAP_COUNT; - while (swap_out(priority, gfp_mask)) - if (--swap_count < 0) - break; + while (swap_out(priority, gfp_mask)) { + made_progress = 1; + if (!--count) + goto done; + } - } while (--priority >= 0); + /* + * Only switch to a lower "priority" if we + * didn't make any useful progress in the + * last loop. + */ + if (!made_progress) + priority--; + } while (priority >= 0); /* Always end on a shrink_mmap.., may sleep... */ - while (shrink_mmap(0, gfp_mask)) { + while (refill_inactive_scan(0, 1)) { if (!--count) goto done; } - /* Return 1 if any page is freed, or - * there are no more memory pressure */ - return (count < FREE_COUNT || !keep_kswapd_awake()); - + done: - return 1; + return (count < start_count); +} + +static int do_try_to_free_pages(unsigned int gfp_mask, int user) +{ + int ret = 0; + + /* + * First, reclaim unused slab cache memory. + */ + kmem_cache_reap(gfp_mask); + + /* + * If we're low on free pages, move pages from the + * inactive_dirty list to the inactive_clean list. + * + * Usually bdflush will have pre-cleaned the pages + * before we get around to moving them to the other + * list, so this is a relatively cheap operation. + */ + if (free_shortage()) + ret += page_launder(gfp_mask, user); + + /* + * If needed, we move pages from the active list + * to the inactive list. We also "eat" pages from + * the inode and dentry cache whenever we do this. + */ + if (free_shortage() || inactive_shortage()) { + ret += shrink_dcache_memory(6, gfp_mask); + ret += shrink_icache_memory(6, gfp_mask); + + ret += refill_inactive(gfp_mask, user); + } + + return ret; } DECLARE_WAIT_QUEUE_HEAD(kswapd_wait); +DECLARE_WAIT_QUEUE_HEAD(kswapd_done); +struct task_struct *kswapd_task; /* * The background pageout daemon, started as a kernel thread @@ -584,6 +992,7 @@ tsk->pgrp = 1; strcpy(tsk->comm, "kswapd"); sigfillset(&tsk->blocked); + kswapd_task = tsk; /* * Tell the memory management that we're a "memory allocator", @@ -599,15 +1008,91 @@ */ tsk->flags |= PF_MEMALLOC; + /* + * Kswapd main loop. + */ for (;;) { - if (!keep_kswapd_awake()) { - interruptible_sleep_on(&kswapd_wait); + static int recalc = 0; + + /* If needed, try to free some memory. */ + if (inactive_shortage() || free_shortage()) { + int wait = 0; + /* Do we need to do some synchronous flushing? */ + if (waitqueue_active(&kswapd_done)) + wait = 1; + if (!do_try_to_free_pages(GFP_KSWAPD, wait)) { + /* + * if (out_of_memory()) { + * try again a few times; + * oom_kill(); + * } + */ + } } - do_try_to_free_pages(GFP_KSWAPD); + /* + * Do some (very minimal) background scanning. This + * will scan all pages on the active list once + * every minute. This clears old referenced bits + * and moves unused pages to the inactive list. + */ + refill_inactive_scan(6, 0); + + /* Once a second, recalculate some VM stats. */ + if (time_after(jiffies, recalc + HZ)) { + recalc = jiffies; + recalculate_vm_stats(); + } + + /* + * Wake up everybody waiting for free memory + * and unplug the disk queue. + */ + wake_up_all(&kswapd_done); + run_task_queue(&tq_disk); + + /* + * If we've either completely gotten rid of the + * free page shortage or the inactive page shortage + * is getting low, then stop eating CPU time. + * + * We go to sleep for one second, but if it's needed + * we'll be woken up earlier... + */ + if (!free_shortage() || + inactive_shortage() <= inactive_target / 3) + interruptible_sleep_on_timeout(&kswapd_wait, HZ); } } +void wakeup_kswapd(int block) +{ + DECLARE_WAITQUEUE(wait, current); + + if (current == kswapd_task) + return; + + if (!block) { + wake_up(&kswapd_wait); + return; + } + + /* + * Kswapd could wake us up before we get a chance + * to sleep, so we have to be very careful here to + * prevent SMP races... + */ + __set_current_state(TASK_UNINTERRUPTIBLE); + add_wait_queue(&kswapd_done, &wait); + + if (waitqueue_active(&kswapd_wait)) + wake_up(&kswapd_wait); + schedule(); + + remove_wait_queue(&kswapd_done, &wait); + __set_current_state(TASK_RUNNING); +} + /* * Called by non-kswapd processes when they want more * memory. @@ -625,28 +1110,71 @@ */ int try_to_free_pages(unsigned int gfp_mask) { - int retval = 1; - if (gfp_mask & __GFP_WAIT) { - current->state = TASK_RUNNING; - current->flags |= PF_MEMALLOC; - retval = do_try_to_free_pages(gfp_mask); - current->flags &= ~PF_MEMALLOC; + balance_dirty(NODEV); + wakeup_kswapd(1); } - /* someone needed memory that kswapd had not provided - * make sure kswapd runs, should not happen often */ - if (waitqueue_active(&kswapd_wait)) - wake_up_interruptible(&kswapd_wait); + return 1; +} - return retval; +DECLARE_WAIT_QUEUE_HEAD(kreclaimd_wait); +/* + * Kreclaimd will move pages from the inactive_clean list to the + * free list, in order to keep atomic allocations possible under + * all circumstances. Even when kswapd is blocked on IO. + */ +int kreclaimd(void *unused) +{ + struct task_struct *tsk = current; + pg_data_t *pgdat; + + tsk->session = 1; + tsk->pgrp = 1; + strcpy(tsk->comm, "kreclaimd"); + sigfillset(&tsk->blocked); + current->flags |= PF_MEMALLOC; + + while (1) { + + /* + * We sleep until someone wakes us up from + * page_alloc.c::__alloc_pages(). + */ + interruptible_sleep_on(&kreclaimd_wait); + + /* + * Move some pages from the inactive_clean lists to + * the free lists, if it is needed. + */ + pgdat = pgdat_list; + do { + int i; + for(i = 0; i < MAX_NR_ZONES; i++) { + zone_t *zone = pgdat->node_zones + i; + if (!zone->size) + continue; + + while (zone->free_pages < zone->pages_low) { + struct page * page; + page = reclaim_page(zone); + if (!page) + break; + __free_page(page); + } + } + pgdat = pgdat->node_next; + } while (pgdat); + } } + static int __init kswapd_init(void) { - printk("Starting kswapd v1.7\n"); + printk("Starting kswapd v1.8\n"); swap_setup(); kernel_thread(kswapd, NULL, CLONE_FS | CLONE_FILES | CLONE_SIGNAL); + kernel_thread(kreclaimd, NULL, CLONE_FS | CLONE_FILES | CLONE_SIGNAL); return 0; } diff -u --recursive --new-file v2.4.0-test8/linux/net/core/sock.c linux/net/core/sock.c --- v2.4.0-test8/linux/net/core/sock.c Wed Aug 23 18:36:39 2000 +++ linux/net/core/sock.c Mon Sep 11 08:41:08 2000 @@ -609,7 +609,9 @@ { sk_cachep = kmem_cache_create("sock", sizeof(struct sock), 0, SLAB_HWCACHE_ALIGN, 0, 0); - + if (!sk_cachep) + printk(KERN_CRIT "sk_init: Cannot create sock SLAB cache!"); + if (num_physpages <= 4096) { sysctl_wmem_max = 32767; sysctl_rmem_max = 32767;