diff --git a/[refs] b/[refs] index 002ef8398dd9..4f6573cca75c 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: c080a3e69dfb58ae9b8c7e70a1e33f4f4e493ea7 +refs/heads/master: 42adb53cb36d19862a02d3087e2e3d9dab39e5fa diff --git a/trunk/Documentation/kernel-parameters.txt b/trunk/Documentation/kernel-parameters.txt index a853e8607865..b3a6187e5305 100644 --- a/trunk/Documentation/kernel-parameters.txt +++ b/trunk/Documentation/kernel-parameters.txt @@ -147,9 +147,6 @@ running once the system is up. acpi_irq_isa= [HW,ACPI] If irq_balance, mark listed IRQs used by ISA Format: ,... - acpi_os_name= [HW,ACPI] Tell ACPI BIOS the name of the OS - Format: To spoof as Windows 98: ="Microsoft Windows" - acpi_osi= [HW,ACPI] empty param disables _OSI acpi_serialize [HW,ACPI] force serialization of AML methods diff --git a/trunk/Documentation/memory-barriers.txt b/trunk/Documentation/memory-barriers.txt index 4710845dbac4..c61d8b876fdb 100644 --- a/trunk/Documentation/memory-barriers.txt +++ b/trunk/Documentation/memory-barriers.txt @@ -19,7 +19,6 @@ Contents: - Control dependencies. - SMP barrier pairing. - Examples of memory barrier sequences. - - Read memory barriers vs load speculation. (*) Explicit kernel barriers. @@ -249,7 +248,7 @@ And there are a number of things that _must_ or _must_not_ be assumed: we may get either of: STORE *A = X; Y = LOAD *A; - STORE *A = Y = X; + STORE *A = Y; ========================= @@ -345,12 +344,9 @@ Memory barriers come in four basic varieties: (4) General memory barriers. - A general memory barrier gives a guarantee that all the LOAD and STORE - operations specified before the barrier will appear to happen before all - the LOAD and STORE operations specified after the barrier with respect to - the other components of the system. - - A general memory barrier is a partial ordering over both loads and stores. + A general memory barrier is a combination of both a read memory barrier + and a write memory barrier. It is a partial ordering over both loads and + stores. General memory barriers imply both read and write memory barriers, and so can substitute for either. @@ -550,9 +546,9 @@ write barrier, though, again, a general barrier is viable: =============== =============== a = 1; - b = 2; x = b; + b = 2; x = a; - y = a; + y = b; Or: @@ -567,18 +563,6 @@ Or: Basically, the read barrier always has to be there, even though it can be of the "weaker" type. -[!] Note that the stores before the write barrier would normally be expected to -match the loads after the read barrier or data dependency barrier, and vice -versa: - - CPU 1 CPU 2 - =============== =============== - a = 1; }---- --->{ v = c - b = 2; } \ / { w = d - \ - c = 3; } / \ { x = a; - d = 4; }---- --->{ y = b; - EXAMPLES OF MEMORY BARRIER SEQUENCES ------------------------------------ @@ -616,8 +600,8 @@ STORE B, STORE C } all occuring before the unordered set of { STORE D, STORE E | | +------+ +-------+ : : | - | Sequence in which stores are committed to the - | memory system by CPU 1 + | Sequence in which stores committed to memory system + | by CPU 1 V @@ -699,12 +683,14 @@ then the following will occur: | : : | | | : : | CPU 2 | | +-------+ | | - | | X->9 |------>| | - | +-------+ | | - Makes sure all effects ---> \ ddddddddddddddddd | | - prior to the store of C \ +-------+ | | - are perceptible to ----->| B->2 |------>| | - subsequent loads +-------+ | | + \ | X->9 |------>| | + \ +-------+ | | + ----->| B->2 | | | + +-------+ | | + Makes sure all effects ---> ddddddddddddddddd | | + prior to the store of C +-------+ | | + are perceptible to | B->2 |------>| | + successive loads +-------+ | | : : +-------+ @@ -713,239 +699,73 @@ following sequence of events: CPU 1 CPU 2 ======================= ======================= - { A = 0, B = 9 } STORE A=1 - STORE B=2 - LOAD B - LOAD A - -Without intervention, CPU 2 may then choose to perceive the events on CPU 1 in -some effectively random order, despite the write barrier issued by CPU 1: - - +-------+ : : : : - | | +------+ +-------+ - | |------>| A=1 |------ --->| A->0 | - | | +------+ \ +-------+ - | CPU 1 | wwwwwwwwwwwwwwww \ --->| B->9 | - | | +------+ | +-------+ - | |------>| B=2 |--- | : : - | | +------+ \ | : : +-------+ - +-------+ : : \ | +-------+ | | - ---------->| B->2 |------>| | - | +-------+ | CPU 2 | - | | A->0 |------>| | - | +-------+ | | - | : : +-------+ - \ : : - \ +-------+ - ---->| A->1 | - +-------+ - : : - - -If, however, a read barrier were to be placed between the load of E and the -load of A on CPU 2: - - CPU 1 CPU 2 - ======================= ======================= - { A = 0, B = 9 } - STORE A=1 + STORE C=3 - STORE B=2 - LOAD B - + STORE D=4 + STORE E=5 LOAD A - -then the partial ordering imposed by CPU 1 will be perceived correctly by CPU -2: - - +-------+ : : : : - | | +------+ +-------+ - | |------>| A=1 |------ --->| A->0 | - | | +------+ \ +-------+ - | CPU 1 | wwwwwwwwwwwwwwww \ --->| B->9 | - | | +------+ | +-------+ - | |------>| B=2 |--- | : : - | | +------+ \ | : : +-------+ - +-------+ : : \ | +-------+ | | - ---------->| B->2 |------>| | - | +-------+ | CPU 2 | - | : : | | - | : : | | - At this point the read ----> \ rrrrrrrrrrrrrrrrr | | - barrier causes all effects \ +-------+ | | - prior to the storage of B ---->| A->1 |------>| | - to be perceptible to CPU 2 +-------+ | | - : : +-------+ - - -To illustrate this more completely, consider what could happen if the code -contained a load of A either side of the read barrier: - - CPU 1 CPU 2 - ======================= ======================= - { A = 0, B = 9 } - STORE A=1 - - STORE B=2 LOAD B - LOAD A [first load of A] - - LOAD A [second load of A] - -Even though the two loads of A both occur after the load of B, they may both -come up with different values: - - +-------+ : : : : - | | +------+ +-------+ - | |------>| A=1 |------ --->| A->0 | - | | +------+ \ +-------+ - | CPU 1 | wwwwwwwwwwwwwwww \ --->| B->9 | - | | +------+ | +-------+ - | |------>| B=2 |--- | : : - | | +------+ \ | : : +-------+ - +-------+ : : \ | +-------+ | | - ---------->| B->2 |------>| | - | +-------+ | CPU 2 | - | : : | | - | : : | | - | +-------+ | | - | | A->0 |------>| 1st | - | +-------+ | | - At this point the read ----> \ rrrrrrrrrrrrrrrrr | | - barrier causes all effects \ +-------+ | | - prior to the storage of B ---->| A->1 |------>| 2nd | - to be perceptible to CPU 2 +-------+ | | - : : +-------+ - - -But it may be that the update to A from CPU 1 becomes perceptible to CPU 2 -before the read barrier completes anyway: - - +-------+ : : : : - | | +------+ +-------+ - | |------>| A=1 |------ --->| A->0 | - | | +------+ \ +-------+ - | CPU 1 | wwwwwwwwwwwwwwww \ --->| B->9 | - | | +------+ | +-------+ - | |------>| B=2 |--- | : : - | | +------+ \ | : : +-------+ - +-------+ : : \ | +-------+ | | - ---------->| B->2 |------>| | - | +-------+ | CPU 2 | - | : : | | - \ : : | | - \ +-------+ | | - ---->| A->1 |------>| 1st | - +-------+ | | - rrrrrrrrrrrrrrrrr | | - +-------+ | | - | A->1 |------>| 2nd | - +-------+ | | - : : +-------+ - - -The guarantee is that the second load will always come up with A == 1 if the -load of B came up with B == 2. No such guarantee exists for the first load of -A; that may come up with either A == 0 or A == 1. - - -READ MEMORY BARRIERS VS LOAD SPECULATION ----------------------------------------- - -Many CPUs speculate with loads: that is they see that they will need to load an -item from memory, and they find a time where they're not using the bus for any -other loads, and so do the load in advance - even though they haven't actually -got to that point in the instruction execution flow yet. This permits the -actual load instruction to potentially complete immediately because the CPU -already has the value to hand. - -It may turn out that the CPU didn't actually need the value - perhaps because a -branch circumvented the load - in which case it can discard the value or just -cache it for later use. - -Consider: - - CPU 1 CPU 2 - ======================= ======================= - LOAD B - DIVIDE } Divide instructions generally - DIVIDE } take a long time to perform - LOAD A - -Which might appear as this: - - : : +-------+ - +-------+ | | - --->| B->2 |------>| | - +-------+ | CPU 2 | - : :DIVIDE | | - +-------+ | | - The CPU being busy doing a ---> --->| A->0 |~~~~ | | - division speculates on the +-------+ ~ | | - LOAD of A : : ~ | | - : :DIVIDE | | - : : ~ | | - Once the divisions are complete --> : : ~-->| | - the CPU can then perform the : : | | - LOAD with immediate effect : : +-------+ - - -Placing a read barrier or a data dependency barrier just before the second -load: - - CPU 1 CPU 2 - ======================= ======================= - LOAD B - DIVIDE - DIVIDE - - LOAD A - -will force any value speculatively obtained to be reconsidered to an extent -dependent on the type of barrier used. If there was no change made to the -speculated memory location, then the speculated value will just be used: - - : : +-------+ - +-------+ | | - --->| B->2 |------>| | - +-------+ | CPU 2 | - : :DIVIDE | | - +-------+ | | - The CPU being busy doing a ---> --->| A->0 |~~~~ | | - division speculates on the +-------+ ~ | | - LOAD of A : : ~ | | - : :DIVIDE | | - : : ~ | | - : : ~ | | - rrrrrrrrrrrrrrrr~ | | - : : ~ | | - : : ~-->| | - : : | | - : : +-------+ + LOAD C + LOAD D + LOAD E +Without intervention, CPU 2 may then choose to perceive the events on CPU 1 in +some effectively random order, despite the write barrier issued by CPU 1: -but if there was an update or an invalidation from another CPU pending, then -the speculation will be cancelled and the value reloaded: + +-------+ : : + | | +------+ + | |------>| C=3 | } + | | : +------+ } + | | : | A=1 | } + | | : +------+ } + | CPU 1 | : | B=2 | }--- + | | +------+ } \ + | | wwwwwwwwwwwww} \ + | | +------+ } \ : : +-------+ + | | : | E=5 | } \ +-------+ | | + | | : +------+ } \ { | C->3 |------>| | + | |------>| D=4 | } \ { +-------+ : | | + | | +------+ \ { | E->5 | : | | + +-------+ : : \ { +-------+ : | | + Transfer -->{ | A->1 | : | CPU 2 | + from CPU 1 { +-------+ : | | + to CPU 2 { | D->4 | : | | + { +-------+ : | | + { | B->2 |------>| | + +-------+ | | + : : +-------+ + + +If, however, a read barrier were to be placed between the load of C and the +load of D on CPU 2, then the partial ordering imposed by CPU 1 will be +perceived correctly by CPU 2. - : : +-------+ - +-------+ | | - --->| B->2 |------>| | - +-------+ | CPU 2 | - : :DIVIDE | | - +-------+ | | - The CPU being busy doing a ---> --->| A->0 |~~~~ | | - division speculates on the +-------+ ~ | | - LOAD of A : : ~ | | - : :DIVIDE | | - : : ~ | | - : : ~ | | - rrrrrrrrrrrrrrrrr | | - +-------+ | | - The speculation is discarded ---> --->| A->1 |------>| | - and an updated value is +-------+ | | - retrieved : : +-------+ + +-------+ : : + | | +------+ + | |------>| C=3 | } + | | : +------+ } + | | : | A=1 | }--- + | | : +------+ } \ + | CPU 1 | : | B=2 | } \ + | | +------+ \ + | | wwwwwwwwwwwwwwww \ + | | +------+ \ : : +-------+ + | | : | E=5 | } \ +-------+ | | + | | : +------+ }--- \ { | C->3 |------>| | + | |------>| D=4 | } \ \ { +-------+ : | | + | | +------+ \ -->{ | B->2 | : | | + +-------+ : : \ { +-------+ : | | + \ { | A->1 | : | CPU 2 | + \ +-------+ | | + At this point the read ----> \ rrrrrrrrrrrrrrrrr | | + barrier causes all effects \ +-------+ | | + prior to the storage of C \ { | E->5 | : | | + to be perceptible to CPU 2 -->{ +-------+ : | | + { | D->4 |------>| | + +-------+ | | + : : +-------+ ======================== @@ -1081,7 +901,7 @@ IMPLICIT KERNEL MEMORY BARRIERS =============================== Some of the other functions in the linux kernel imply memory barriers, amongst -which are locking and scheduling functions. +which are locking, scheduling and memory allocation functions. This specification is a _minimum_ guarantee; any particular architecture may provide more substantial guarantees, but these may not be relied upon outside @@ -1146,20 +966,6 @@ equivalent to a full barrier, but a LOCK followed by an UNLOCK is not. barriers is that the effects instructions outside of a critical section may seep into the inside of the critical section. -A LOCK followed by an UNLOCK may not be assumed to be full memory barrier -because it is possible for an access preceding the LOCK to happen after the -LOCK, and an access following the UNLOCK to happen before the UNLOCK, and the -two accesses can themselves then cross: - - *A = a; - LOCK - UNLOCK - *B = b; - -may occur as: - - LOCK, STORE *B, STORE *A, UNLOCK - Locks and semaphores may not provide any guarantee of ordering on UP compiled systems, and so cannot be counted on in such a situation to actually achieve anything at all - especially with respect to I/O accesses - unless combined @@ -1210,6 +1016,8 @@ Other functions that imply barriers: (*) schedule() and similar imply full memory barriers. + (*) Memory allocation and release functions imply full memory barriers. + ================================= INTER-CPU LOCKING BARRIER EFFECTS diff --git a/trunk/Documentation/serial/driver b/trunk/Documentation/serial/driver index 88ad615dd338..df82116a9f26 100644 --- a/trunk/Documentation/serial/driver +++ b/trunk/Documentation/serial/driver @@ -214,13 +214,12 @@ hardware. The interaction of the iflag bits is as follows (parity error given as an example): Parity error INPCK IGNPAR - n/a 0 n/a character received, marked as + None n/a n/a character received + Yes n/a 0 character discarded + Yes 0 1 character received, marked as TTY_NORMAL - None 1 n/a character received, marked as - TTY_NORMAL - Yes 1 0 character received, marked as + Yes 1 1 character received, marked as TTY_PARITY - Yes 1 1 character discarded Other flags may be used (eg, xon/xoff characters) if your hardware supports hardware "soft" flow control. diff --git a/trunk/MAINTAINERS b/trunk/MAINTAINERS index c3c5842402df..74d71cafb17c 100644 --- a/trunk/MAINTAINERS +++ b/trunk/MAINTAINERS @@ -568,18 +568,6 @@ L: linuxppc-dev@ozlabs.org W: http://www.penguinppc.org/ppc64/ S: Supported -BROADCOM BNX2 GIGABIT ETHERNET DRIVER -P: Michael Chan -M: mchan@broadcom.com -L: netdev@vger.kernel.org -S: Supported - -BROADCOM TG3 GIGABIT ETHERNET DRIVER -P: Michael Chan -M: mchan@broadcom.com -L: netdev@vger.kernel.org -S: Supported - BTTV VIDEO4LINUX DRIVER P: Mauro Carvalho Chehab M: mchehab@infradead.org @@ -1889,11 +1877,6 @@ L: linux-kernel@vger.kernel.org W: http://www.atnf.csiro.au/~rgooch/linux/kernel-patches.html S: Maintained -MULTIMEDIA CARD SUBSYSTEM -P: Russell King -M: rmk+mmc@arm.linux.org.uk -S: Maintained - MULTISOUND SOUND DRIVER P: Andrew Veliath M: andrewtv@usa.net diff --git a/trunk/Makefile b/trunk/Makefile index a3a7baad8555..435d209f42d8 100644 --- a/trunk/Makefile +++ b/trunk/Makefile @@ -1,8 +1,8 @@ VERSION = 2 PATCHLEVEL = 6 SUBLEVEL = 17 -EXTRAVERSION =-rc6 -NAME=Crazed Snow-Weasel +EXTRAVERSION =-rc5 +NAME=Lordi Rules # *DOCUMENTATION* # To see a list of typical targets execute "make help" diff --git a/trunk/arch/alpha/Kconfig b/trunk/arch/alpha/Kconfig index 213c7850d5fb..8290b69da202 100644 --- a/trunk/arch/alpha/Kconfig +++ b/trunk/arch/alpha/Kconfig @@ -453,7 +453,7 @@ config ALPHA_IRONGATE config GENERIC_HWEIGHT bool - default y if !ALPHA_EV67 + default y if !ALPHA_EV6 && !ALPHA_EV67 config ALPHA_AVANTI bool diff --git a/trunk/arch/alpha/kernel/alpha_ksyms.c b/trunk/arch/alpha/kernel/alpha_ksyms.c index 2b245ad731ee..c645c5e14786 100644 --- a/trunk/arch/alpha/kernel/alpha_ksyms.c +++ b/trunk/arch/alpha/kernel/alpha_ksyms.c @@ -182,6 +182,7 @@ EXPORT_SYMBOL(smp_num_cpus); EXPORT_SYMBOL(smp_call_function); EXPORT_SYMBOL(smp_call_function_on_cpu); EXPORT_SYMBOL(_atomic_dec_and_lock); +EXPORT_SYMBOL(cpu_present_mask); #endif /* CONFIG_SMP */ /* diff --git a/trunk/arch/alpha/kernel/process.c b/trunk/arch/alpha/kernel/process.c index c760a831fd1a..9924fd07743a 100644 --- a/trunk/arch/alpha/kernel/process.c +++ b/trunk/arch/alpha/kernel/process.c @@ -94,7 +94,7 @@ common_shutdown_1(void *generic_ptr) if (cpuid != boot_cpuid) { flags |= 0x00040000UL; /* "remain halted" */ *pflags = flags; - cpu_clear(cpuid, cpu_present_map); + clear_bit(cpuid, &cpu_present_mask); halt(); } #endif @@ -120,8 +120,8 @@ common_shutdown_1(void *generic_ptr) #ifdef CONFIG_SMP /* Wait for the secondaries to halt. */ - cpu_clear(boot_cpuid, cpu_present_map); - while (cpus_weight(cpu_present_map)) + cpu_clear(boot_cpuid, cpu_possible_map); + while (cpus_weight(cpu_possible_map)) barrier(); #endif diff --git a/trunk/arch/alpha/kernel/smp.c b/trunk/arch/alpha/kernel/smp.c index 4dc273e537fd..185255416e85 100644 --- a/trunk/arch/alpha/kernel/smp.c +++ b/trunk/arch/alpha/kernel/smp.c @@ -68,6 +68,7 @@ enum ipi_message_type { static int smp_secondary_alive __initdata = 0; /* Which cpus ids came online. */ +cpumask_t cpu_present_mask; cpumask_t cpu_online_map; EXPORT_SYMBOL(cpu_online_map); @@ -438,7 +439,7 @@ setup_smp(void) if ((cpu->flags & 0x1cc) == 0x1cc) { smp_num_probed++; /* Assume here that "whami" == index */ - cpu_set(i, cpu_present_map); + cpu_set(i, cpu_present_mask); cpu->pal_revision = boot_cpu_palrev; } @@ -449,10 +450,11 @@ setup_smp(void) } } else { smp_num_probed = 1; + cpu_set(boot_cpuid, cpu_present_mask); } - printk(KERN_INFO "SMP: %d CPUs probed -- cpu_present_map = %lx\n", - smp_num_probed, cpu_present_map.bits[0]); + printk(KERN_INFO "SMP: %d CPUs probed -- cpu_present_mask = %lx\n", + smp_num_probed, cpu_possible_map.bits[0]); } /* @@ -471,7 +473,7 @@ smp_prepare_cpus(unsigned int max_cpus) /* Nothing to do on a UP box, or when told not to. */ if (smp_num_probed == 1 || max_cpus == 0) { - cpu_present_map = cpumask_of_cpu(boot_cpuid); + cpu_present_mask = cpumask_of_cpu(boot_cpuid); printk(KERN_INFO "SMP mode deactivated.\n"); return; } @@ -484,6 +486,10 @@ smp_prepare_cpus(unsigned int max_cpus) void __devinit smp_prepare_boot_cpu(void) { + /* + * Mark the boot cpu (current cpu) as online + */ + cpu_set(smp_processor_id(), cpu_online_map); } int __devinit diff --git a/trunk/arch/alpha/kernel/sys_titan.c b/trunk/arch/alpha/kernel/sys_titan.c index 2551fb49ae09..5f84417eeb7b 100644 --- a/trunk/arch/alpha/kernel/sys_titan.c +++ b/trunk/arch/alpha/kernel/sys_titan.c @@ -66,7 +66,7 @@ titan_update_irq_hw(unsigned long mask) register int bcpu = boot_cpuid; #ifdef CONFIG_SMP - cpumask_t cpm = cpu_present_map; + cpumask_t cpm = cpu_present_mask; volatile unsigned long *dim0, *dim1, *dim2, *dim3; unsigned long mask0, mask1, mask2, mask3, dummy; diff --git a/trunk/arch/arm/Kconfig.debug b/trunk/arch/arm/Kconfig.debug index d22f38b957db..5d3acff8c596 100644 --- a/trunk/arch/arm/Kconfig.debug +++ b/trunk/arch/arm/Kconfig.debug @@ -101,7 +101,7 @@ config DEBUG_S3C2410_UART help Choice for UART for kernel low-level using S3C2410 UARTS, should be between zero and two. The port must have been - initialised by the boot-loader before use. + initalised by the boot-loader before use. The uncompressor code port configuration is now handled by CONFIG_S3C2410_LOWLEVEL_UART_PORT. diff --git a/trunk/arch/arm/mach-ep93xx/ts72xx.c b/trunk/arch/arm/mach-ep93xx/ts72xx.c index e24566b88a78..9be01b0c3f48 100644 --- a/trunk/arch/arm/mach-ep93xx/ts72xx.c +++ b/trunk/arch/arm/mach-ep93xx/ts72xx.c @@ -111,21 +111,21 @@ static void __init ts72xx_map_io(void) } } -static unsigned char ts72xx_rtc_readbyte(unsigned long addr) +static unsigned char ts72xx_rtc_readb(unsigned long addr) { __raw_writeb(addr, TS72XX_RTC_INDEX_VIRT_BASE); return __raw_readb(TS72XX_RTC_DATA_VIRT_BASE); } -static void ts72xx_rtc_writebyte(unsigned char value, unsigned long addr) +static void ts72xx_rtc_writeb(unsigned char value, unsigned long addr) { __raw_writeb(addr, TS72XX_RTC_INDEX_VIRT_BASE); __raw_writeb(value, TS72XX_RTC_DATA_VIRT_BASE); } static struct m48t86_ops ts72xx_rtc_ops = { - .readbyte = ts72xx_rtc_readbyte, - .writebyte = ts72xx_rtc_writebyte, + .readb = ts72xx_rtc_readb, + .writeb = ts72xx_rtc_writeb, }; static struct platform_device ts72xx_rtc_device = { diff --git a/trunk/arch/arm/mach-imx/irq.c b/trunk/arch/arm/mach-imx/irq.c index a5de5f1da9f2..eeb8a6d4a399 100644 --- a/trunk/arch/arm/mach-imx/irq.c +++ b/trunk/arch/arm/mach-imx/irq.c @@ -127,7 +127,7 @@ static void imx_gpio_ack_irq(unsigned int irq) { DEBUG_IRQ("%s: irq %d\n", __FUNCTION__, irq); - ISR(IRQ_TO_REG(irq)) = 1 << ((irq - IRQ_GPIOA(0)) % 32); + ISR(IRQ_TO_REG(irq)) |= 1 << ((irq - IRQ_GPIOA(0)) % 32); } static void diff --git a/trunk/arch/arm/mach-integrator/integrator_cp.c b/trunk/arch/arm/mach-integrator/integrator_cp.c index 9f55f5ae1044..a0724f2b24ce 100644 --- a/trunk/arch/arm/mach-integrator/integrator_cp.c +++ b/trunk/arch/arm/mach-integrator/integrator_cp.c @@ -232,6 +232,8 @@ static void __init intcp_init_irq(void) for (i = IRQ_PIC_START; i <= IRQ_PIC_END; i++) { if (i == 11) i = 22; + if (i == IRQ_CP_CPPLDINT) + i++; if (i == 29) break; set_irq_chip(i, &pic_chip); @@ -257,7 +259,8 @@ static void __init intcp_init_irq(void) set_irq_flags(i, IRQF_VALID | IRQF_PROBE); } - set_irq_chained_handler(IRQ_CP_CPPLDINT, sic_handle_irq); + set_irq_handler(IRQ_CP_CPPLDINT, sic_handle_irq); + pic_unmask_irq(IRQ_CP_CPPLDINT); } /* diff --git a/trunk/arch/arm/mach-ixp23xx/core.c b/trunk/arch/arm/mach-ixp23xx/core.c index affd1d5d7440..092ee12ced42 100644 --- a/trunk/arch/arm/mach-ixp23xx/core.c +++ b/trunk/arch/arm/mach-ixp23xx/core.c @@ -178,12 +178,8 @@ static int ixp23xx_irq_set_type(unsigned int irq, unsigned int type) static void ixp23xx_irq_mask(unsigned int irq) { - volatile unsigned long *intr_reg; + volatile unsigned long *intr_reg = IXP23XX_INTR_EN1 + (irq / 32); - if (irq >= 56) - irq += 8; - - intr_reg = IXP23XX_INTR_EN1 + (irq / 32); *intr_reg &= ~(1 << (irq % 32)); } @@ -203,25 +199,17 @@ static void ixp23xx_irq_ack(unsigned int irq) */ static void ixp23xx_irq_level_unmask(unsigned int irq) { - volatile unsigned long *intr_reg; + volatile unsigned long *intr_reg = IXP23XX_INTR_EN1 + (irq / 32); ixp23xx_irq_ack(irq); - if (irq >= 56) - irq += 8; - - intr_reg = IXP23XX_INTR_EN1 + (irq / 32); *intr_reg |= (1 << (irq % 32)); } static void ixp23xx_irq_edge_unmask(unsigned int irq) { - volatile unsigned long *intr_reg; - - if (irq >= 56) - irq += 8; + volatile unsigned long *intr_reg = IXP23XX_INTR_EN1 + (irq / 32); - intr_reg = IXP23XX_INTR_EN1 + (irq / 32); *intr_reg |= (1 << (irq % 32)); } diff --git a/trunk/arch/arm/mach-ixp4xx/Kconfig b/trunk/arch/arm/mach-ixp4xx/Kconfig index 3b23f43cb160..2a39f9e481ad 100644 --- a/trunk/arch/arm/mach-ixp4xx/Kconfig +++ b/trunk/arch/arm/mach-ixp4xx/Kconfig @@ -141,7 +141,7 @@ config IXP4XX_INDIRECT_PCI 2) If > 64MB of memory space is required, the IXP4xx can be configured to use indirect registers to access PCI This allows for up to 128MB (0x48000000 to 0x4fffffff) of memory on the bus. - The disadvantage of this is that every PCI access requires + The disadvantadge of this is that every PCI access requires three local register accesses plus a spinlock, but in some cases the performance hit is acceptable. In addition, you cannot mmap() PCI devices in this case due to the indirect nature diff --git a/trunk/arch/arm/mach-pxa/mainstone.c b/trunk/arch/arm/mach-pxa/mainstone.c index b307f11951df..02e188d98e7d 100644 --- a/trunk/arch/arm/mach-pxa/mainstone.c +++ b/trunk/arch/arm/mach-pxa/mainstone.c @@ -493,7 +493,6 @@ static void __init mainstone_map_io(void) MACHINE_START(MAINSTONE, "Intel HCDDBBVA0 Development Platform (aka Mainstone)") /* Maintainer: MontaVista Software Inc. */ .phys_io = 0x40000000, - .boot_params = 0xa0000100, /* BLOB boot parameter setting */ .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, .map_io = mainstone_map_io, .init_irq = mainstone_init_irq, diff --git a/trunk/arch/arm/mach-pxa/spitz.c b/trunk/arch/arm/mach-pxa/spitz.c index 44bcb8097c7a..19b372df544a 100644 --- a/trunk/arch/arm/mach-pxa/spitz.c +++ b/trunk/arch/arm/mach-pxa/spitz.c @@ -371,7 +371,6 @@ static int spitz_ohci_init(struct device *dev) static struct pxaohci_platform_data spitz_ohci_platform_data = { .port_mode = PMM_NPS_MODE, .init = spitz_ohci_init, - .power_budget = 150, }; diff --git a/trunk/arch/arm/mach-s3c2410/Kconfig b/trunk/arch/arm/mach-s3c2410/Kconfig index 970f98dadffc..ce7d81000695 100644 --- a/trunk/arch/arm/mach-s3c2410/Kconfig +++ b/trunk/arch/arm/mach-s3c2410/Kconfig @@ -170,7 +170,7 @@ config S3C2410_PM_DEBUG depends on ARCH_S3C2410 && PM help Say Y here if you want verbose debugging from the PM Suspend and - Resume code. See + Resume code. See `Documentation/arm/Samsing-S3C24XX/Suspend.txt` for more information. config S3C2410_PM_CHECK diff --git a/trunk/arch/arm/mach-sa1100/neponset.c b/trunk/arch/arm/mach-sa1100/neponset.c index af6d2775cf82..9e02bc3712a0 100644 --- a/trunk/arch/arm/mach-sa1100/neponset.c +++ b/trunk/arch/arm/mach-sa1100/neponset.c @@ -59,14 +59,6 @@ neponset_irq_handler(unsigned int irq, struct irqdesc *desc, struct pt_regs *reg if (irr & (IRR_ETHERNET | IRR_USAR)) { desc->chip->mask(irq); - /* - * Ack the interrupt now to prevent re-entering - * this neponset handler. Again, this is safe - * since we'll check the IRR register prior to - * leaving. - */ - desc->chip->ack(irq); - if (irr & IRR_ETHERNET) { d = irq_desc + IRQ_NEPONSET_SMC9196; desc_handle_irq(IRQ_NEPONSET_SMC9196, d, regs); diff --git a/trunk/arch/arm/mach-versatile/core.c b/trunk/arch/arm/mach-versatile/core.c index cebd48a3dae4..799697d32dec 100644 --- a/trunk/arch/arm/mach-versatile/core.c +++ b/trunk/arch/arm/mach-versatile/core.c @@ -112,9 +112,10 @@ void __init versatile_init_irq(void) { unsigned int i; - vic_init(VA_VIC_BASE, IRQ_VIC_START, ~0); + vic_init(VA_VIC_BASE, IRQ_VIC_START, ~(1 << 31)); - set_irq_chained_handler(IRQ_VICSOURCE31, sic_handle_irq); + set_irq_handler(IRQ_VICSOURCE31, sic_handle_irq); + enable_irq(IRQ_VICSOURCE31); /* Do second interrupt controller */ writel(~0, VA_SIC_BASE + SIC_IRQ_ENABLE_CLEAR); diff --git a/trunk/arch/i386/kernel/acpi/boot.c b/trunk/arch/i386/kernel/acpi/boot.c index 5ccbf58ec94f..40e5aba3ad3d 100644 --- a/trunk/arch/i386/kernel/acpi/boot.c +++ b/trunk/arch/i386/kernel/acpi/boot.c @@ -215,7 +215,7 @@ static int __init acpi_parse_madt(unsigned long phys_addr, unsigned long size) { struct acpi_table_madt *madt = NULL; - if (!phys_addr || !size || !cpu_has_apic) + if (!phys_addr || !size) return -EINVAL; madt = (struct acpi_table_madt *)__acpi_map_table(phys_addr, size); @@ -621,9 +621,9 @@ extern u32 pmtmr_ioport; static int __init acpi_parse_fadt(unsigned long phys, unsigned long size) { - struct fadt_descriptor *fadt = NULL; + struct fadt_descriptor_rev2 *fadt = NULL; - fadt = (struct fadt_descriptor *)__acpi_map_table(phys, size); + fadt = (struct fadt_descriptor_rev2 *)__acpi_map_table(phys, size); if (!fadt) { printk(KERN_WARNING PREFIX "Unable to map FADT\n"); return 0; @@ -754,7 +754,7 @@ static int __init acpi_parse_madt_ioapic_entries(void) return -ENODEV; } - if (!cpu_has_apic) + if (!cpu_has_apic) return -ENODEV; /* diff --git a/trunk/arch/i386/kernel/acpi/earlyquirk.c b/trunk/arch/i386/kernel/acpi/earlyquirk.c index 1649a175a206..2e3b643a4dc4 100644 --- a/trunk/arch/i386/kernel/acpi/earlyquirk.c +++ b/trunk/arch/i386/kernel/acpi/earlyquirk.c @@ -5,34 +5,17 @@ #include #include #include -#include - #include #include #include -#ifdef CONFIG_ACPI - -static int nvidia_hpet_detected __initdata; - -static int __init nvidia_hpet_check(unsigned long phys, unsigned long size) -{ - nvidia_hpet_detected = 1; - return 0; -} -#endif - static int __init check_bridge(int vendor, int device) { #ifdef CONFIG_ACPI - /* According to Nvidia all timer overrides are bogus unless HPET - is enabled. */ + /* According to Nvidia all timer overrides are bogus. Just ignore + them all. */ if (vendor == PCI_VENDOR_ID_NVIDIA) { - nvidia_hpet_detected = 0; - acpi_table_parse(ACPI_HPET, nvidia_hpet_check); - if (nvidia_hpet_detected == 0) { - acpi_skip_timer_override = 1; - } + acpi_skip_timer_override = 1; } #endif if (vendor == PCI_VENDOR_ID_ATI && timer_over_8254 == 1) { diff --git a/trunk/arch/i386/kernel/setup.c b/trunk/arch/i386/kernel/setup.c index dd6b0e3386ce..846e1639ef7c 100644 --- a/trunk/arch/i386/kernel/setup.c +++ b/trunk/arch/i386/kernel/setup.c @@ -1547,18 +1547,15 @@ void __init setup_arch(char **cmdline_p) if (efi_enabled) efi_map_memmap(); -#ifdef CONFIG_ACPI - /* - * Parse the ACPI tables for possible boot-time SMP configuration. - */ - acpi_boot_table_init(); -#endif - #ifdef CONFIG_X86_IO_APIC check_acpi_pci(); /* Checks more than just ACPI actually */ #endif #ifdef CONFIG_ACPI + /* + * Parse the ACPI tables for possible boot-time SMP configuration. + */ + acpi_boot_table_init(); acpi_boot_init(); #if defined(CONFIG_SMP) && defined(CONFIG_X86_PC) diff --git a/trunk/arch/ia64/Kconfig b/trunk/arch/ia64/Kconfig index f0252eda12a8..0f3076a820c3 100644 --- a/trunk/arch/ia64/Kconfig +++ b/trunk/arch/ia64/Kconfig @@ -77,7 +77,6 @@ choice config IA64_GENERIC bool "generic" select ACPI - select PCI select NUMA select ACPI_NUMA help diff --git a/trunk/arch/ia64/hp/common/sba_iommu.c b/trunk/arch/ia64/hp/common/sba_iommu.c index dd4a2f792632..bdccd0b1eb60 100644 --- a/trunk/arch/ia64/hp/common/sba_iommu.c +++ b/trunk/arch/ia64/hp/common/sba_iommu.c @@ -1999,7 +1999,7 @@ acpi_sba_ioc_add(struct acpi_device *device) if (!iovp_shift) iovp_shift = min(PAGE_SHIFT, 16); } - kfree(dev_info); + ACPI_MEM_FREE(dev_info); /* * default anything not caught above or specified on cmdline to 4k diff --git a/trunk/arch/ia64/kernel/acpi.c b/trunk/arch/ia64/kernel/acpi.c index f97cc6c7f13a..58c93a30348c 100644 --- a/trunk/arch/ia64/kernel/acpi.c +++ b/trunk/arch/ia64/kernel/acpi.c @@ -68,6 +68,8 @@ EXPORT_SYMBOL(pm_power_off); unsigned char acpi_kbd_controller_present = 1; unsigned char acpi_legacy_devices; +static unsigned int __initdata acpi_madt_rev; + unsigned int acpi_cpei_override; unsigned int acpi_cpei_phys_cpuid; @@ -241,8 +243,6 @@ acpi_parse_iosapic(acpi_table_entry_header * header, const unsigned long end) return iosapic_init(iosapic->address, iosapic->global_irq_base); } -static unsigned int __initdata acpi_madt_rev; - static int __init acpi_parse_plat_int_src(acpi_table_entry_header * header, const unsigned long end) diff --git a/trunk/arch/ia64/mm/init.c b/trunk/arch/ia64/mm/init.c index 11f08001f8c2..cafa8776a53d 100644 --- a/trunk/arch/ia64/mm/init.c +++ b/trunk/arch/ia64/mm/init.c @@ -671,11 +671,9 @@ int add_memory(u64 start, u64 size) return ret; } -EXPORT_SYMBOL_GPL(add_memory); int remove_memory(u64 start, u64 size) { return -EINVAL; } -EXPORT_SYMBOL_GPL(remove_memory); #endif diff --git a/trunk/arch/mips/au1000/common/prom.c b/trunk/arch/mips/au1000/common/prom.c index ae7d8c57bf3f..9c171afd9a53 100644 --- a/trunk/arch/mips/au1000/common/prom.c +++ b/trunk/arch/mips/au1000/common/prom.c @@ -1,9 +1,10 @@ /* * * BRIEF MODULE DESCRIPTION - * PROM library initialisation code, assuming YAMON is the boot loader. + * PROM library initialisation code, assuming a version of + * pmon is the boot code. * - * Copyright 2000, 2001, 2006 MontaVista Software Inc. + * Copyright 2000,2001 MontaVista Software Inc. * Author: MontaVista Software, Inc. * ppopov@mvista.com or source@mvista.com * @@ -48,9 +49,9 @@ extern char **prom_argv, **prom_envp; typedef struct { - char *name; - char *val; -} t_env_var; + char *name; +/* char *val; */ +}t_env_var; char * prom_getcmdline(void) @@ -84,16 +85,21 @@ char *prom_getenv(char *envname) { /* * Return a pointer to the given environment variable. + * Environment variables are stored in the form of "memsize=64". */ t_env_var *env = (t_env_var *)prom_envp; + int i; + + i = strlen(envname); - while (env->name) { - if (strcmp(envname, env->name) == 0) - return env->val; + while(env->name) { + if(strncmp(envname, env->name, i) == 0) { + return(env->name + strlen(envname) + 1); + } env++; } - return NULL; + return(NULL); } inline unsigned char str2hexnum(unsigned char c) diff --git a/trunk/arch/mips/au1000/common/sleeper.S b/trunk/arch/mips/au1000/common/sleeper.S index 683d9da84b66..44dac3b0df3b 100644 --- a/trunk/arch/mips/au1000/common/sleeper.S +++ b/trunk/arch/mips/au1000/common/sleeper.S @@ -112,11 +112,6 @@ sdsleep: mtc0 k0, CP0_PAGEMASK lw k0, 0x14(sp) mtc0 k0, CP0_CONFIG - - /* We need to catch the ealry Alchemy SOCs with - * the write-only Config[OD] bit and set it back to one... - */ - jal au1x00_fixup_config_od lw $1, PT_R1(sp) lw $2, PT_R2(sp) lw $3, PT_R3(sp) diff --git a/trunk/arch/mips/ddb5xxx/ddb5476/dbg_io.c b/trunk/arch/mips/ddb5xxx/ddb5476/dbg_io.c index f2296a999953..85e9e5013679 100644 --- a/trunk/arch/mips/ddb5xxx/ddb5476/dbg_io.c +++ b/trunk/arch/mips/ddb5xxx/ddb5476/dbg_io.c @@ -86,7 +86,7 @@ void debugInit(uint32 baud, uint8 data, uint8 parity, uint8 stop) /* disable interrupts */ UART16550_WRITE(OFS_INTR_ENABLE, 0); - /* set up baud rate */ + /* set up buad rate */ { uint32 divisor; diff --git a/trunk/arch/mips/ddb5xxx/ddb5477/kgdb_io.c b/trunk/arch/mips/ddb5xxx/ddb5477/kgdb_io.c index 385bbdb10170..1d18d590495b 100644 --- a/trunk/arch/mips/ddb5xxx/ddb5477/kgdb_io.c +++ b/trunk/arch/mips/ddb5xxx/ddb5477/kgdb_io.c @@ -86,7 +86,7 @@ void debugInit(uint32 baud, uint8 data, uint8 parity, uint8 stop) /* disable interrupts */ UART16550_WRITE(OFS_INTR_ENABLE, 0); - /* set up baud rate */ + /* set up buad rate */ { uint32 divisor; diff --git a/trunk/arch/mips/gt64120/ev64120/serialGT.c b/trunk/arch/mips/gt64120/ev64120/serialGT.c index 8f0d835491ff..16e34a546e54 100644 --- a/trunk/arch/mips/gt64120/ev64120/serialGT.c +++ b/trunk/arch/mips/gt64120/ev64120/serialGT.c @@ -149,7 +149,7 @@ void serial_set(int channel, unsigned long baud) #else /* * Note: Set baud rate, hardcoded here for rate of 115200 - * since became unsure of above "baud rate" algorithm (??). + * since became unsure of above "buad rate" algorithm (??). */ outreg(channel, LCR, 0x83); outreg(channel, DLM, 0x00); // See note above diff --git a/trunk/arch/mips/gt64120/momenco_ocelot/dbg_io.c b/trunk/arch/mips/gt64120/momenco_ocelot/dbg_io.c index f0a6a38fcf4d..8720bccfdea2 100644 --- a/trunk/arch/mips/gt64120/momenco_ocelot/dbg_io.c +++ b/trunk/arch/mips/gt64120/momenco_ocelot/dbg_io.c @@ -73,7 +73,7 @@ void debugInit(uint32 baud, uint8 data, uint8 parity, uint8 stop) /* disable interrupts */ UART16550_WRITE(OFS_INTR_ENABLE, 0); - /* set up baud rate */ + /* set up buad rate */ { uint32 divisor; diff --git a/trunk/arch/mips/ite-boards/generic/dbg_io.c b/trunk/arch/mips/ite-boards/generic/dbg_io.c index 6a7ccaf93502..c4f8530fd07e 100644 --- a/trunk/arch/mips/ite-boards/generic/dbg_io.c +++ b/trunk/arch/mips/ite-boards/generic/dbg_io.c @@ -72,7 +72,7 @@ void debugInit(uint32 baud, uint8 data, uint8 parity, uint8 stop) /* disable interrupts */ UART16550_WRITE(OFS_INTR_ENABLE, 0); - /* set up baud rate */ + /* set up buad rate */ { uint32 divisor; diff --git a/trunk/arch/mips/kernel/cpu-bugs64.c b/trunk/arch/mips/kernel/cpu-bugs64.c index d268827c62bd..47a087b6c11b 100644 --- a/trunk/arch/mips/kernel/cpu-bugs64.c +++ b/trunk/arch/mips/kernel/cpu-bugs64.c @@ -206,7 +206,7 @@ static inline void check_daddi(void) "daddi %0, %1, %3\n\t" ".set pop" : "=r" (v), "=&r" (tmp) - : "I" (0xffffffffffffdb9aUL), "I" (0x1234)); + : "I" (0xffffffffffffdb9a), "I" (0x1234)); set_except_vector(12, handler); local_irq_restore(flags); @@ -224,7 +224,7 @@ static inline void check_daddi(void) "dsrl %1, %1, 1\n\t" "daddi %0, %1, %3" : "=r" (v), "=&r" (tmp) - : "I" (0xffffffffffffdb9aUL), "I" (0x1234)); + : "I" (0xffffffffffffdb9a), "I" (0x1234)); set_except_vector(12, handler); local_irq_restore(flags); @@ -280,7 +280,7 @@ static inline void check_daddiu(void) "daddu %1, %2\n\t" ".set pop" : "=&r" (v), "=&r" (w), "=&r" (tmp) - : "I" (0xffffffffffffdb9aUL), "I" (0x1234)); + : "I" (0xffffffffffffdb9a), "I" (0x1234)); if (v == w) { printk("no.\n"); @@ -296,7 +296,7 @@ static inline void check_daddiu(void) "addiu %1, $0, %4\n\t" "daddu %1, %2" : "=&r" (v), "=&r" (w), "=&r" (tmp) - : "I" (0xffffffffffffdb9aUL), "I" (0x1234)); + : "I" (0xffffffffffffdb9a), "I" (0x1234)); if (v == w) { printk("yes.\n"); diff --git a/trunk/arch/mips/kernel/cpu-probe.c b/trunk/arch/mips/kernel/cpu-probe.c index 8c2c359a05f4..bef3e2dc7c52 100644 --- a/trunk/arch/mips/kernel/cpu-probe.c +++ b/trunk/arch/mips/kernel/cpu-probe.c @@ -655,7 +655,7 @@ static inline void cpu_probe_sibyte(struct cpuinfo_mips *c) case PRID_IMP_SB1: c->cputype = CPU_SB1; /* FPU in pass1 is known to have issues. */ - if ((c->processor_id & 0xff) < 0x02) + if ((c->processor_id & 0xff) < 0x20) c->options &= ~(MIPS_CPU_FPU | MIPS_CPU_32FPR); break; case PRID_IMP_SB1A: diff --git a/trunk/arch/mips/kernel/module.c b/trunk/arch/mips/kernel/module.c index d7bf0215bc1d..e54a7f442f8a 100644 --- a/trunk/arch/mips/kernel/module.c +++ b/trunk/arch/mips/kernel/module.c @@ -288,9 +288,6 @@ int apply_relocate(Elf_Shdr *sechdrs, const char *strtab, sym = (Elf_Sym *)sechdrs[symindex].sh_addr + ELF_MIPS_R_SYM(rel[i]); if (!sym->st_value) { - /* Ignore unresolved weak symbol */ - if (ELF_ST_BIND(sym->st_info) == STB_WEAK) - continue; printk(KERN_WARNING "%s: Unknown symbol %s\n", me->name, strtab + sym->st_name); return -ENOENT; @@ -328,9 +325,6 @@ int apply_relocate_add(Elf_Shdr *sechdrs, const char *strtab, sym = (Elf_Sym *)sechdrs[symindex].sh_addr + ELF_MIPS_R_SYM(rel[i]); if (!sym->st_value) { - /* Ignore unresolved weak symbol */ - if (ELF_ST_BIND(sym->st_info) == STB_WEAK) - continue; printk(KERN_WARNING "%s: Unknown symbol %s\n", me->name, strtab + sym->st_name); return -ENOENT; diff --git a/trunk/arch/mips/kernel/scall64-o32.S b/trunk/arch/mips/kernel/scall64-o32.S index 8efb23a84131..b53a9207f530 100644 --- a/trunk/arch/mips/kernel/scall64-o32.S +++ b/trunk/arch/mips/kernel/scall64-o32.S @@ -209,7 +209,7 @@ sys_call_table: PTR sys_fork PTR sys_read PTR sys_write - PTR compat_sys_open /* 4005 */ + PTR sys_open /* 4005 */ PTR sys_close PTR sys_waitpid PTR sys_creat diff --git a/trunk/arch/mips/kernel/setup.c b/trunk/arch/mips/kernel/setup.c index 397a70e651b5..bcf1b10e518f 100644 --- a/trunk/arch/mips/kernel/setup.c +++ b/trunk/arch/mips/kernel/setup.c @@ -246,7 +246,7 @@ static inline int parse_rd_cmdline(unsigned long* rd_start, unsigned long* rd_en #ifdef CONFIG_64BIT /* HACK: Guess if the sign extension was forgotten */ if (start > 0x0000000080000000 && start < 0x00000000ffffffff) - start |= 0xffffffff00000000UL; + start |= 0xffffffff00000000; #endif end = start + size; @@ -355,6 +355,8 @@ static inline void bootmem_init(void) } #endif + memory_present(0, first_usable_pfn, max_low_pfn); + /* Initialize the boot-time allocator with low memory only. */ bootmap_size = init_bootmem(first_usable_pfn, max_low_pfn); @@ -408,7 +410,6 @@ static inline void bootmem_init(void) /* Register lowmem ranges */ free_bootmem(PFN_PHYS(curr_pfn), PFN_PHYS(size)); - memory_present(0, curr_pfn, curr_pfn + size - 1); } /* Reserve the bootmap memory. */ @@ -418,20 +419,17 @@ static inline void bootmem_init(void) #ifdef CONFIG_BLK_DEV_INITRD initrd_below_start_ok = 1; if (initrd_start) { - unsigned long initrd_size = ((unsigned char *)initrd_end) - - ((unsigned char *)initrd_start); - const int width = sizeof(long) * 2; - + unsigned long initrd_size = ((unsigned char *)initrd_end) - ((unsigned char *)initrd_start); printk("Initial ramdisk at: 0x%p (%lu bytes)\n", (void *)initrd_start, initrd_size); if (CPHYSADDR(initrd_end) > PFN_PHYS(max_low_pfn)) { printk("initrd extends beyond end of memory " "(0x%0*Lx > 0x%0*Lx)\ndisabling initrd\n", - width, - (unsigned long long) CPHYSADDR(initrd_end), - width, - (unsigned long long) PFN_PHYS(max_low_pfn)); + sizeof(long) * 2, + (unsigned long long)CPHYSADDR(initrd_end), + sizeof(long) * 2, + (unsigned long long)PFN_PHYS(max_low_pfn)); initrd_start = initrd_end = 0; initrd_reserve_bootmem = 0; } diff --git a/trunk/arch/mips/kernel/smp.c b/trunk/arch/mips/kernel/smp.c index 298f82fe8440..d42f358754ad 100644 --- a/trunk/arch/mips/kernel/smp.c +++ b/trunk/arch/mips/kernel/smp.c @@ -247,9 +247,6 @@ void __init smp_prepare_cpus(unsigned int max_cpus) current_thread_info()->cpu = 0; smp_tune_scheduling(); plat_prepare_cpus(max_cpus); -#ifndef CONFIG_HOTPLUG_CPU - cpu_present_map = cpu_possible_map; -#endif } /* preload SMP state for boot cpu */ @@ -445,7 +442,7 @@ static int __init topology_init(void) int cpu; int ret; - for_each_present_cpu(cpu) { + for_each_cpu(cpu) { ret = register_cpu(&per_cpu(cpu_devices, cpu), cpu, NULL); if (ret) printk(KERN_WARNING "topology_init: register_cpu %d " diff --git a/trunk/arch/mips/kernel/syscall.c b/trunk/arch/mips/kernel/syscall.c index 5e8a18a8e2bd..8f4fdd94dbd0 100644 --- a/trunk/arch/mips/kernel/syscall.c +++ b/trunk/arch/mips/kernel/syscall.c @@ -276,7 +276,8 @@ void sys_set_thread_area(unsigned long addr) asmlinkage int _sys_sysmips(int cmd, long arg1, int arg2, int arg3) { - int tmp; + int tmp, len; + char __user *name; switch(cmd) { case MIPS_ATOMIC_SET: diff --git a/trunk/arch/mips/kernel/traps.c b/trunk/arch/mips/kernel/traps.c index a7564b08eb4d..35cb08da3820 100644 --- a/trunk/arch/mips/kernel/traps.c +++ b/trunk/arch/mips/kernel/traps.c @@ -819,30 +819,15 @@ asmlinkage void do_watch(struct pt_regs *regs) asmlinkage void do_mcheck(struct pt_regs *regs) { - const int field = 2 * sizeof(unsigned long); - int multi_match = regs->cp0_status & ST0_TS; - show_regs(regs); - - if (multi_match) { - printk("Index : %0x\n", read_c0_index()); - printk("Pagemask: %0x\n", read_c0_pagemask()); - printk("EntryHi : %0*lx\n", field, read_c0_entryhi()); - printk("EntryLo0: %0*lx\n", field, read_c0_entrylo0()); - printk("EntryLo1: %0*lx\n", field, read_c0_entrylo1()); - printk("\n"); - dump_tlb_all(); - } - - show_code((unsigned int *) regs->cp0_epc); - + dump_tlb_all(); /* * Some chips may have other causes of machine check (e.g. SB1 * graduation timer) */ panic("Caught Machine Check exception - %scaused by multiple " "matching entries in the TLB.", - (multi_match) ? "" : "not "); + (regs->cp0_status & ST0_TS) ? "" : "not "); } asmlinkage void do_mt(struct pt_regs *regs) diff --git a/trunk/arch/mips/math-emu/dp_fint.c b/trunk/arch/mips/math-emu/dp_fint.c index 39a71de16f47..a1962eb460f8 100644 --- a/trunk/arch/mips/math-emu/dp_fint.c +++ b/trunk/arch/mips/math-emu/dp_fint.c @@ -29,9 +29,7 @@ ieee754dp ieee754dp_fint(int x) { - u64 xm; - int xe; - int xs; + COMPXDP; CLEARCX; diff --git a/trunk/arch/mips/math-emu/dp_flong.c b/trunk/arch/mips/math-emu/dp_flong.c index f08f223e488a..eae90a866aa1 100644 --- a/trunk/arch/mips/math-emu/dp_flong.c +++ b/trunk/arch/mips/math-emu/dp_flong.c @@ -29,9 +29,7 @@ ieee754dp ieee754dp_flong(s64 x) { - u64 xm; - int xe; - int xs; + COMPXDP; CLEARCX; diff --git a/trunk/arch/mips/math-emu/sp_fint.c b/trunk/arch/mips/math-emu/sp_fint.c index e88e125e01c2..7aac13afb09a 100644 --- a/trunk/arch/mips/math-emu/sp_fint.c +++ b/trunk/arch/mips/math-emu/sp_fint.c @@ -29,9 +29,7 @@ ieee754sp ieee754sp_fint(int x) { - unsigned xm; - int xe; - int xs; + COMPXSP; CLEARCX; diff --git a/trunk/arch/mips/math-emu/sp_flong.c b/trunk/arch/mips/math-emu/sp_flong.c index 26d6919a269a..3d6c1d11c178 100644 --- a/trunk/arch/mips/math-emu/sp_flong.c +++ b/trunk/arch/mips/math-emu/sp_flong.c @@ -29,9 +29,7 @@ ieee754sp ieee754sp_flong(s64 x) { - u64 xm; /* <--- need 64-bit mantissa temp */ - int xe; - int xs; + COMPXDP; /* <--- need 64-bit mantissa temp */ CLEARCX; diff --git a/trunk/arch/mips/mm/c-r4k.c b/trunk/arch/mips/mm/c-r4k.c index 4a43924cd4fc..6b3541769602 100644 --- a/trunk/arch/mips/mm/c-r4k.c +++ b/trunk/arch/mips/mm/c-r4k.c @@ -1161,31 +1161,6 @@ static void __init setup_scache(void) c->options |= MIPS_CPU_SUBSET_CACHES; } -void au1x00_fixup_config_od(void) -{ - /* - * c0_config.od (bit 19) was write only (and read as 0) - * on the early revisions of Alchemy SOCs. It disables the bus - * transaction overlapping and needs to be set to fix various errata. - */ - switch (read_c0_prid()) { - case 0x00030100: /* Au1000 DA */ - case 0x00030201: /* Au1000 HA */ - case 0x00030202: /* Au1000 HB */ - case 0x01030200: /* Au1500 AB */ - /* - * Au1100 errata actually keeps silence about this bit, so we set it - * just in case for those revisions that require it to be set according - * to arch/mips/au1000/common/cputable.c - */ - case 0x02030200: /* Au1100 AB */ - case 0x02030201: /* Au1100 BA */ - case 0x02030202: /* Au1100 BC */ - set_c0_config(1 << 19); - break; - } -} - static inline void coherency_setup(void) { change_c0_config(CONF_CM_CMASK, CONF_CM_DEFAULT); @@ -1206,15 +1181,6 @@ static inline void coherency_setup(void) case CPU_R4400MC: clear_c0_config(CONF_CU); break; - /* - * We need to catch the ealry Alchemy SOCs with - * the write-only co_config.od bit and set it back to one... - */ - case CPU_AU1000: /* rev. DA, HA, HB */ - case CPU_AU1100: /* rev. AB, BA, BC ?? */ - case CPU_AU1500: /* rev. AB */ - au1x00_fixup_config_od(); - break; } } diff --git a/trunk/arch/mips/mm/init.c b/trunk/arch/mips/mm/init.c index 33f6e1cdfd5b..c22308b93ff0 100644 --- a/trunk/arch/mips/mm/init.c +++ b/trunk/arch/mips/mm/init.c @@ -227,7 +227,7 @@ void __init mem_init(void) for (tmp = 0; tmp < max_low_pfn; tmp++) if (page_is_ram(tmp)) { ram++; - if (PageReserved(pfn_to_page(tmp))) + if (PageReserved(mem_map+tmp)) reservedpages++; } diff --git a/trunk/arch/mips/momentum/jaguar_atx/dbg_io.c b/trunk/arch/mips/momentum/jaguar_atx/dbg_io.c index d7dea0a136aa..542eac82b63c 100644 --- a/trunk/arch/mips/momentum/jaguar_atx/dbg_io.c +++ b/trunk/arch/mips/momentum/jaguar_atx/dbg_io.c @@ -73,7 +73,7 @@ void debugInit(uint32 baud, uint8 data, uint8 parity, uint8 stop) /* disable interrupts */ UART16550_WRITE(OFS_INTR_ENABLE, 0); - /* set up baud rate */ + /* set up buad rate */ { uint32 divisor; diff --git a/trunk/arch/mips/momentum/ocelot_c/dbg_io.c b/trunk/arch/mips/momentum/ocelot_c/dbg_io.c index f0a6a38fcf4d..8720bccfdea2 100644 --- a/trunk/arch/mips/momentum/ocelot_c/dbg_io.c +++ b/trunk/arch/mips/momentum/ocelot_c/dbg_io.c @@ -73,7 +73,7 @@ void debugInit(uint32 baud, uint8 data, uint8 parity, uint8 stop) /* disable interrupts */ UART16550_WRITE(OFS_INTR_ENABLE, 0); - /* set up baud rate */ + /* set up buad rate */ { uint32 divisor; diff --git a/trunk/arch/mips/momentum/ocelot_g/dbg_io.c b/trunk/arch/mips/momentum/ocelot_g/dbg_io.c index f0a6a38fcf4d..8720bccfdea2 100644 --- a/trunk/arch/mips/momentum/ocelot_g/dbg_io.c +++ b/trunk/arch/mips/momentum/ocelot_g/dbg_io.c @@ -73,7 +73,7 @@ void debugInit(uint32 baud, uint8 data, uint8 parity, uint8 stop) /* disable interrupts */ UART16550_WRITE(OFS_INTR_ENABLE, 0); - /* set up baud rate */ + /* set up buad rate */ { uint32 divisor; diff --git a/trunk/arch/mips/oprofile/common.c b/trunk/arch/mips/oprofile/common.c index c31e4cff64e0..91b799d2cd88 100644 --- a/trunk/arch/mips/oprofile/common.c +++ b/trunk/arch/mips/oprofile/common.c @@ -14,8 +14,8 @@ #include "op_impl.h" -extern struct op_mips_model op_model_mipsxx_ops __attribute__((weak)); -extern struct op_mips_model op_model_rm9000_ops __attribute__((weak)); +extern struct op_mips_model op_model_mipsxx __attribute__((weak)); +extern struct op_mips_model op_model_rm9000 __attribute__((weak)); static struct op_mips_model *model; @@ -83,11 +83,11 @@ int __init oprofile_arch_init(struct oprofile_operations *ops) case CPU_74K: case CPU_SB1: case CPU_SB1A: - lmodel = &op_model_mipsxx_ops; + lmodel = &op_model_mipsxx; break; case CPU_RM9000: - lmodel = &op_model_rm9000_ops; + lmodel = &op_model_rm9000; break; }; diff --git a/trunk/arch/mips/oprofile/op_model_mipsxx.c b/trunk/arch/mips/oprofile/op_model_mipsxx.c index f26a00e13204..e7ce92391303 100644 --- a/trunk/arch/mips/oprofile/op_model_mipsxx.c +++ b/trunk/arch/mips/oprofile/op_model_mipsxx.c @@ -23,7 +23,7 @@ #define M_COUNTER_OVERFLOW (1UL << 31) -struct op_mips_model op_model_mipsxx_ops; +struct op_mips_model op_model_mipsxx; static struct mipsxx_register_config { unsigned int control[4]; @@ -34,7 +34,7 @@ static struct mipsxx_register_config { static void mipsxx_reg_setup(struct op_counter_config *ctr) { - unsigned int counters = op_model_mipsxx_ops.num_counters; + unsigned int counters = op_model_mipsxx.num_counters; int i; /* Compute the performance counter control word. */ @@ -62,7 +62,7 @@ static void mipsxx_reg_setup(struct op_counter_config *ctr) static void mipsxx_cpu_setup (void *args) { - unsigned int counters = op_model_mipsxx_ops.num_counters; + unsigned int counters = op_model_mipsxx.num_counters; switch (counters) { case 4: @@ -83,7 +83,7 @@ static void mipsxx_cpu_setup (void *args) /* Start all counters on current CPU */ static void mipsxx_cpu_start(void *args) { - unsigned int counters = op_model_mipsxx_ops.num_counters; + unsigned int counters = op_model_mipsxx.num_counters; switch (counters) { case 4: @@ -100,7 +100,7 @@ static void mipsxx_cpu_start(void *args) /* Stop all counters on current CPU */ static void mipsxx_cpu_stop(void *args) { - unsigned int counters = op_model_mipsxx_ops.num_counters; + unsigned int counters = op_model_mipsxx.num_counters; switch (counters) { case 4: @@ -116,7 +116,7 @@ static void mipsxx_cpu_stop(void *args) static int mipsxx_perfcount_handler(struct pt_regs *regs) { - unsigned int counters = op_model_mipsxx_ops.num_counters; + unsigned int counters = op_model_mipsxx.num_counters; unsigned int control; unsigned int counter; int handled = 0; @@ -187,37 +187,37 @@ static int __init mipsxx_init(void) reset_counters(counters); - op_model_mipsxx_ops.num_counters = counters; + op_model_mipsxx.num_counters = counters; switch (current_cpu_data.cputype) { case CPU_20KC: - op_model_mipsxx_ops.cpu_type = "mips/20K"; + op_model_mipsxx.cpu_type = "mips/20K"; break; case CPU_24K: - op_model_mipsxx_ops.cpu_type = "mips/24K"; + op_model_mipsxx.cpu_type = "mips/24K"; break; case CPU_25KF: - op_model_mipsxx_ops.cpu_type = "mips/25K"; + op_model_mipsxx.cpu_type = "mips/25K"; break; #ifndef CONFIG_SMP case CPU_34K: - op_model_mipsxx_ops.cpu_type = "mips/34K"; + op_model_mipsxx.cpu_type = "mips/34K"; break; case CPU_74K: - op_model_mipsxx_ops.cpu_type = "mips/74K"; + op_model_mipsxx.cpu_type = "mips/74K"; break; #endif case CPU_5KC: - op_model_mipsxx_ops.cpu_type = "mips/5K"; + op_model_mipsxx.cpu_type = "mips/5K"; break; case CPU_SB1: case CPU_SB1A: - op_model_mipsxx_ops.cpu_type = "mips/sb1"; + op_model_mipsxx.cpu_type = "mips/sb1"; break; default: @@ -233,12 +233,12 @@ static int __init mipsxx_init(void) static void mipsxx_exit(void) { - reset_counters(op_model_mipsxx_ops.num_counters); + reset_counters(op_model_mipsxx.num_counters); perf_irq = null_perf_irq; } -struct op_mips_model op_model_mipsxx_ops = { +struct op_mips_model op_model_mipsxx = { .reg_setup = mipsxx_reg_setup, .cpu_setup = mipsxx_cpu_setup, .init = mipsxx_init, diff --git a/trunk/arch/mips/oprofile/op_model_rm9000.c b/trunk/arch/mips/oprofile/op_model_rm9000.c index b7063fefa65b..9b75e41c78ef 100644 --- a/trunk/arch/mips/oprofile/op_model_rm9000.c +++ b/trunk/arch/mips/oprofile/op_model_rm9000.c @@ -126,7 +126,7 @@ static void rm9000_exit(void) free_irq(rm9000_perfcount_irq, NULL); } -struct op_mips_model op_model_rm9000_ops = { +struct op_mips_model op_model_rm9000 = { .reg_setup = rm9000_reg_setup, .cpu_setup = rm9000_cpu_setup, .init = rm9000_init, diff --git a/trunk/arch/mips/sgi-ip32/ip32-irq.c b/trunk/arch/mips/sgi-ip32/ip32-irq.c index 8ba08047d164..de01c9815bdd 100644 --- a/trunk/arch/mips/sgi-ip32/ip32-irq.c +++ b/trunk/arch/mips/sgi-ip32/ip32-irq.c @@ -31,12 +31,12 @@ /* issue a PIO read to make sure no PIO writes are pending */ static void inline flush_crime_bus(void) { - crime->control; + volatile unsigned long junk = crime->control; } static void inline flush_mace_bus(void) { - mace->perif.ctrl.misc; + volatile unsigned long junk = mace->perif.ctrl.misc; } #undef DEBUG_IRQ diff --git a/trunk/arch/powerpc/kernel/prom_init.c b/trunk/arch/powerpc/kernel/prom_init.c index f70bd090dacd..41e9ab40cd54 100644 --- a/trunk/arch/powerpc/kernel/prom_init.c +++ b/trunk/arch/powerpc/kernel/prom_init.c @@ -822,7 +822,6 @@ static void __init prom_send_capabilities(void) /* try calling the ibm,client-architecture-support method */ if (call_prom_ret("call-method", 3, 2, &ret, ADDR("ibm,client-architecture-support"), - root, ADDR(ibm_architecture_vec)) == 0) { /* the call exists... */ if (ret) @@ -1623,15 +1622,6 @@ static int __init prom_find_machine_type(void) if (strstr(p, RELOC("Power Macintosh")) || strstr(p, RELOC("MacRISC"))) return PLATFORM_POWERMAC; -#ifdef CONFIG_PPC64 - /* We must make sure we don't detect the IBM Cell - * blades as pSeries due to some firmware issues, - * so we do it here. - */ - if (strstr(p, RELOC("IBM,CBEA")) || - strstr(p, RELOC("IBM,CPBW-1.0"))) - return PLATFORM_GENERIC; -#endif /* CONFIG_PPC64 */ i += sl + 1; } } diff --git a/trunk/arch/powerpc/kernel/signal_32.c b/trunk/arch/powerpc/kernel/signal_32.c index 8fdeca2d4597..01e3c08cb550 100644 --- a/trunk/arch/powerpc/kernel/signal_32.c +++ b/trunk/arch/powerpc/kernel/signal_32.c @@ -803,13 +803,10 @@ static int do_setcontext(struct ucontext __user *ucp, struct pt_regs *regs, int if (__get_user(cmcp, &ucp->uc_regs)) return -EFAULT; mcp = (struct mcontext __user *)(u64)cmcp; - /* no need to check access_ok(mcp), since mcp < 4GB */ } #else if (__get_user(mcp, &ucp->uc_regs)) return -EFAULT; - if (!access_ok(VERIFY_READ, mcp, sizeof(*mcp))) - return -EFAULT; #endif restore_sigmask(&set); if (restore_user_regs(regs, mcp, sig)) @@ -911,14 +908,13 @@ int sys_debug_setcontext(struct ucontext __user *ctx, { struct sig_dbg_op op; int i; - unsigned char tmp; unsigned long new_msr = regs->msr; #if defined(CONFIG_4xx) || defined(CONFIG_BOOKE) unsigned long new_dbcr0 = current->thread.dbcr0; #endif for (i=0; ithread.dbcr0 = new_dbcr0; #endif - if (!access_ok(VERIFY_READ, ctx, sizeof(*ctx)) - || __get_user(tmp, (u8 __user *) ctx) - || __get_user(tmp, (u8 __user *) (ctx + 1) - 1)) - return -EFAULT; - /* * If we get a fault copying the context into the kernel's * image of the user's registers, we can't just return -EFAULT diff --git a/trunk/arch/powerpc/kernel/signal_64.c b/trunk/arch/powerpc/kernel/signal_64.c index c2db642f4cdd..27f65b95184d 100644 --- a/trunk/arch/powerpc/kernel/signal_64.c +++ b/trunk/arch/powerpc/kernel/signal_64.c @@ -182,8 +182,6 @@ static long restore_sigcontext(struct pt_regs *regs, sigset_t *set, int sig, err |= __get_user(msr, &sc->gp_regs[PT_MSR]); if (err) return err; - if (v_regs && !access_ok(VERIFY_READ, v_regs, 34 * sizeof(vector128))) - return -EFAULT; /* Copy 33 vec registers (vr0..31 and vscr) from the stack */ if (v_regs != 0 && (msr & MSR_VEC) != 0) err |= __copy_from_user(current->thread.vr, v_regs, diff --git a/trunk/arch/powerpc/platforms/cell/setup.c b/trunk/arch/powerpc/platforms/cell/setup.c index fd3e5609e3e0..6574b22b3cf3 100644 --- a/trunk/arch/powerpc/platforms/cell/setup.c +++ b/trunk/arch/powerpc/platforms/cell/setup.c @@ -125,13 +125,14 @@ static void __init cell_init_early(void) static int __init cell_probe(void) { + /* XXX This is temporary, the Cell maintainer will come up with + * more appropriate detection logic + */ unsigned long root = of_get_flat_dt_root(); + if (!of_flat_dt_is_compatible(root, "IBM,CPBW-1.0")) + return 0; - if (of_flat_dt_is_compatible(root, "IBM,CBEA") || - of_flat_dt_is_compatible(root, "IBM,CPBW-1.0")) - return 1; - - return 0; + return 1; } /* diff --git a/trunk/arch/powerpc/platforms/powermac/pfunc_core.c b/trunk/arch/powerpc/platforms/powermac/pfunc_core.c index f08173b0f065..4baa75b1d36f 100644 --- a/trunk/arch/powerpc/platforms/powermac/pfunc_core.c +++ b/trunk/arch/powerpc/platforms/powermac/pfunc_core.c @@ -11,7 +11,6 @@ #include #include #include -#include #include #include @@ -547,7 +546,6 @@ struct pmf_device { static LIST_HEAD(pmf_devices); static spinlock_t pmf_lock = SPIN_LOCK_UNLOCKED; -static DEFINE_MUTEX(pmf_irq_mutex); static void pmf_release_device(struct kref *kref) { @@ -866,17 +864,15 @@ int pmf_register_irq_client(struct device_node *target, spin_lock_irqsave(&pmf_lock, flags); func = __pmf_find_function(target, name, PMF_FLAGS_INT_GEN); - if (func) - func = pmf_get_function(func); - spin_unlock_irqrestore(&pmf_lock, flags); - if (func == NULL) + if (func == NULL) { + spin_unlock_irqrestore(&pmf_lock, flags); return -ENODEV; - mutex_lock(&pmf_irq_mutex); + } if (list_empty(&func->irq_clients)) func->dev->handlers->irq_enable(func); list_add(&client->link, &func->irq_clients); client->func = func; - mutex_unlock(&pmf_irq_mutex); + spin_unlock_irqrestore(&pmf_lock, flags); return 0; } @@ -885,16 +881,16 @@ EXPORT_SYMBOL_GPL(pmf_register_irq_client); void pmf_unregister_irq_client(struct pmf_irq_client *client) { struct pmf_function *func = client->func; + unsigned long flags; BUG_ON(func == NULL); - mutex_lock(&pmf_irq_mutex); + spin_lock_irqsave(&pmf_lock, flags); client->func = NULL; list_del(&client->link); if (list_empty(&func->irq_clients)) func->dev->handlers->irq_disable(func); - mutex_unlock(&pmf_irq_mutex); - pmf_put_function(func); + spin_unlock_irqrestore(&pmf_lock, flags); } EXPORT_SYMBOL_GPL(pmf_unregister_irq_client); diff --git a/trunk/arch/powerpc/platforms/pseries/setup.c b/trunk/arch/powerpc/platforms/pseries/setup.c index 3ba87835757e..5f79f01c44f2 100644 --- a/trunk/arch/powerpc/platforms/pseries/setup.c +++ b/trunk/arch/powerpc/platforms/pseries/setup.c @@ -389,7 +389,6 @@ static int __init pSeries_probe_hypertas(unsigned long node, static int __init pSeries_probe(void) { - unsigned long root = of_get_flat_dt_root(); char *dtype = of_get_flat_dt_prop(of_get_flat_dt_root(), "device_type", NULL); if (dtype == NULL) @@ -397,13 +396,6 @@ static int __init pSeries_probe(void) if (strcmp(dtype, "chrp")) return 0; - /* Cell blades firmware claims to be chrp while it's not. Until this - * is fixed, we need to avoid those here. - */ - if (of_flat_dt_is_compatible(root, "IBM,CPBW-1.0") || - of_flat_dt_is_compatible(root, "IBM,CBEA")) - return 0; - DBG("pSeries detected, looking for LPAR capability...\n"); /* Now try to figure out if we are running on LPAR */ diff --git a/trunk/arch/sparc/kernel/smp.c b/trunk/arch/sparc/kernel/smp.c index 40b42c88e6a7..a93f5da6855d 100644 --- a/trunk/arch/sparc/kernel/smp.c +++ b/trunk/arch/sparc/kernel/smp.c @@ -69,17 +69,6 @@ void __init smp_store_cpu_info(int id) "clock-frequency", 0); cpu_data(id).prom_node = cpu_node; cpu_data(id).mid = cpu_get_hwmid(cpu_node); - - /* this is required to tune the scheduler correctly */ - /* is it possible to have CPUs with different cache sizes? */ - if (id == boot_cpu_id) { - int cache_line,cache_nlines; - cache_line = 0x20; - cache_line = prom_getintdefault(cpu_node, "ecache-line-size", cache_line); - cache_nlines = 0x8000; - cache_nlines = prom_getintdefault(cpu_node, "ecache-nlines", cache_nlines); - max_cache_size = cache_line * cache_nlines; - } if (cpu_data(id).mid < 0) panic("No MID found for CPU%d at node 0x%08d", id, cpu_node); } diff --git a/trunk/arch/sparc64/kernel/head.S b/trunk/arch/sparc64/kernel/head.S index 31c5892f5acc..3eadac5e171e 100644 --- a/trunk/arch/sparc64/kernel/head.S +++ b/trunk/arch/sparc64/kernel/head.S @@ -10,7 +10,6 @@ #include #include #include -#include #include #include #include @@ -494,35 +493,6 @@ tlb_fixup_done: call prom_init mov %l7, %o0 ! OpenPROM cif handler - /* Initialize current_thread_info()->cpu as early as possible. - * In order to do that accurately we have to patch up the get_cpuid() - * assembler sequences. And that, in turn, requires that we know - * if we are on a Starfire box or not. While we're here, patch up - * the sun4v sequences as well. - */ - call check_if_starfire - nop - call per_cpu_patch - nop - call sun4v_patch - nop - -#ifdef CONFIG_SMP - call hard_smp_processor_id - nop - cmp %o0, NR_CPUS - blu,pt %xcc, 1f - nop - call boot_cpu_id_too_large - nop - /* Not reached... */ - -1: -#else - mov 0, %o0 -#endif - stb %o0, [%g6 + TI_CPU] - /* Off we go.... */ call start_kernel nop diff --git a/trunk/arch/sparc64/kernel/pci_sun4v.c b/trunk/arch/sparc64/kernel/pci_sun4v.c index 0c0895202970..2b7a1f316a93 100644 --- a/trunk/arch/sparc64/kernel/pci_sun4v.c +++ b/trunk/arch/sparc64/kernel/pci_sun4v.c @@ -599,128 +599,18 @@ struct pci_iommu_ops pci_sun4v_iommu_ops = { /* SUN4V PCI configuration space accessors. */ -struct pdev_entry { - struct pdev_entry *next; - u32 devhandle; - unsigned int bus; - unsigned int device; - unsigned int func; -}; - -#define PDEV_HTAB_SIZE 16 -#define PDEV_HTAB_MASK (PDEV_HTAB_SIZE - 1) -static struct pdev_entry *pdev_htab[PDEV_HTAB_SIZE]; - -static inline unsigned int pdev_hashfn(u32 devhandle, unsigned int bus, unsigned int device, unsigned int func) -{ - unsigned int val; - - val = (devhandle ^ (devhandle >> 4)); - val ^= bus; - val ^= device; - val ^= func; - - return val & PDEV_HTAB_MASK; -} - -static int pdev_htab_add(u32 devhandle, unsigned int bus, unsigned int device, unsigned int func) -{ - struct pdev_entry *p = kmalloc(sizeof(*p), GFP_KERNEL); - struct pdev_entry **slot; - - if (!p) - return -ENOMEM; - - slot = &pdev_htab[pdev_hashfn(devhandle, bus, device, func)]; - p->next = *slot; - *slot = p; - - p->devhandle = devhandle; - p->bus = bus; - p->device = device; - p->func = func; - - return 0; -} - -/* Recursively descend into the OBP device tree, rooted at toplevel_node, - * looking for a PCI device matching bus and devfn. - */ -static int obp_find(struct linux_prom_pci_registers *pregs, int toplevel_node, unsigned int bus, unsigned int devfn) -{ - toplevel_node = prom_getchild(toplevel_node); - - while (toplevel_node != 0) { - int ret = obp_find(pregs, toplevel_node, bus, devfn); - - if (ret != 0) - return ret; - - ret = prom_getproperty(toplevel_node, "reg", (char *) pregs, - sizeof(*pregs) * PROMREG_MAX); - if (ret == 0 || ret == -1) - goto next_sibling; - - if (((pregs[0].phys_hi >> 16) & 0xff) == bus && - ((pregs[0].phys_hi >> 8) & 0xff) == devfn) - break; - - next_sibling: - toplevel_node = prom_getsibling(toplevel_node); - } - - return toplevel_node; -} - -static int pdev_htab_populate(struct pci_pbm_info *pbm) -{ - struct linux_prom_pci_registers pr[PROMREG_MAX]; - u32 devhandle = pbm->devhandle; - unsigned int bus; - - for (bus = pbm->pci_first_busno; bus <= pbm->pci_last_busno; bus++) { - unsigned int devfn; - - for (devfn = 0; devfn < 256; devfn++) { - unsigned int device = PCI_SLOT(devfn); - unsigned int func = PCI_FUNC(devfn); - - if (obp_find(pr, pbm->prom_node, bus, devfn)) { - int err = pdev_htab_add(devhandle, bus, - device, func); - if (err) - return err; - } - } - } - - return 0; -} - -static struct pdev_entry *pdev_find(u32 devhandle, unsigned int bus, unsigned int device, unsigned int func) +static inline int pci_sun4v_out_of_range(struct pci_pbm_info *pbm, unsigned int bus, unsigned int device, unsigned int func) { - struct pdev_entry *p; - - p = pdev_htab[pdev_hashfn(devhandle, bus, device, func)]; - while (p) { - if (p->devhandle == devhandle && - p->bus == bus && - p->device == device && - p->func == func) - break; - - p = p->next; + if (bus == pbm->pci_first_busno) { + if (device == 0 && func == 0) + return 0; + return 1; } - return p; -} - -static inline int pci_sun4v_out_of_range(struct pci_pbm_info *pbm, unsigned int bus, unsigned int device, unsigned int func) -{ if (bus < pbm->pci_first_busno || bus > pbm->pci_last_busno) return 1; - return pdev_find(pbm->devhandle, bus, device, func) == NULL; + return 0; } static int pci_sun4v_read_pci_cfg(struct pci_bus *bus_dev, unsigned int devfn, @@ -1173,8 +1063,6 @@ static void pci_sun4v_pbm_init(struct pci_controller_info *p, int prom_node, u32 pci_sun4v_get_bus_range(pbm); pci_sun4v_iommu_init(pbm); - - pdev_htab_populate(pbm); } void sun4v_pci_init(int node, char *model_name) diff --git a/trunk/arch/sparc64/kernel/setup.c b/trunk/arch/sparc64/kernel/setup.c index 9cf1c88cd774..005167f82419 100644 --- a/trunk/arch/sparc64/kernel/setup.c +++ b/trunk/arch/sparc64/kernel/setup.c @@ -220,7 +220,7 @@ char reboot_command[COMMAND_LINE_SIZE]; static struct pt_regs fake_swapper_regs = { { 0, }, 0, 0, 0, 0 }; -void __init per_cpu_patch(void) +static void __init per_cpu_patch(void) { struct cpuid_patch_entry *p; unsigned long ver; @@ -280,7 +280,7 @@ void __init per_cpu_patch(void) } } -void __init sun4v_patch(void) +static void __init sun4v_patch(void) { struct sun4v_1insn_patch_entry *p1; struct sun4v_2insn_patch_entry *p2; @@ -315,15 +315,6 @@ void __init sun4v_patch(void) } } -#ifdef CONFIG_SMP -void __init boot_cpu_id_too_large(int cpu) -{ - prom_printf("Serious problem, boot cpu id (%d) >= NR_CPUS (%d)\n", - cpu, NR_CPUS); - prom_halt(); -} -#endif - void __init setup_arch(char **cmdline_p) { /* Initialize PROM console and command line. */ @@ -341,6 +332,16 @@ void __init setup_arch(char **cmdline_p) conswitchp = &prom_con; #endif + /* Work out if we are starfire early on */ + check_if_starfire(); + + /* Now we know enough to patch the get_cpuid sequences + * used by trap code. + */ + per_cpu_patch(); + + sun4v_patch(); + boot_flags_init(*cmdline_p); idprom_init(); diff --git a/trunk/arch/sparc64/kernel/smp.c b/trunk/arch/sparc64/kernel/smp.c index f03d52d0b88d..90eaca3ec9a6 100644 --- a/trunk/arch/sparc64/kernel/smp.c +++ b/trunk/arch/sparc64/kernel/smp.c @@ -1264,6 +1264,7 @@ void __init smp_tick_init(void) boot_cpu_id = hard_smp_processor_id(); current_tick_offset = timer_tick_offset; + cpu_set(boot_cpu_id, cpu_online_map); prof_counter(boot_cpu_id) = prof_multiplier(boot_cpu_id) = 1; } @@ -1287,40 +1288,6 @@ int setup_profiling_timer(unsigned int multiplier) return 0; } -static void __init smp_tune_scheduling(void) -{ - int instance, node; - unsigned int def, smallest = ~0U; - - def = ((tlb_type == hypervisor) ? - (3 * 1024 * 1024) : - (4 * 1024 * 1024)); - - instance = 0; - while (!cpu_find_by_instance(instance, &node, NULL)) { - unsigned int val; - - val = prom_getintdefault(node, "ecache-size", def); - if (val < smallest) - smallest = val; - - instance++; - } - - /* Any value less than 256K is nonsense. */ - if (smallest < (256U * 1024U)) - smallest = 256 * 1024; - - max_cache_size = smallest; - - if (smallest < 1U * 1024U * 1024U) - printk(KERN_INFO "Using max_cache_size of %uKB\n", - smallest / 1024U); - else - printk(KERN_INFO "Using max_cache_size of %uMB\n", - smallest / 1024U / 1024U); -} - /* Constrain the number of cpus to max_cpus. */ void __init smp_prepare_cpus(unsigned int max_cpus) { @@ -1356,7 +1323,6 @@ void __init smp_prepare_cpus(unsigned int max_cpus) } smp_store_cpu_info(boot_cpu_id); - smp_tune_scheduling(); } /* Set this up early so that things like the scheduler can init @@ -1379,6 +1345,18 @@ void __init smp_setup_cpu_possible_map(void) void __devinit smp_prepare_boot_cpu(void) { + int cpu = hard_smp_processor_id(); + + if (cpu >= NR_CPUS) { + prom_printf("Serious problem, boot cpu id >= NR_CPUS\n"); + prom_halt(); + } + + current_thread_info()->cpu = cpu; + __local_per_cpu_offset = __per_cpu_offset(cpu); + + cpu_set(smp_processor_id(), cpu_online_map); + cpu_set(smp_processor_id(), phys_cpu_present_map); } int __devinit __cpu_up(unsigned int cpu) @@ -1455,7 +1433,4 @@ void __init setup_per_cpu_areas(void) for (i = 0; i < NR_CPUS; i++, ptr += size) memcpy(ptr, __per_cpu_start, __per_cpu_end - __per_cpu_start); - - /* Setup %g5 for the boot cpu. */ - __local_per_cpu_offset = __per_cpu_offset(smp_processor_id()); } diff --git a/trunk/arch/sparc64/kernel/sparc64_ksyms.c b/trunk/arch/sparc64/kernel/sparc64_ksyms.c index 38e569f786dd..62d8a99271ea 100644 --- a/trunk/arch/sparc64/kernel/sparc64_ksyms.c +++ b/trunk/arch/sparc64/kernel/sparc64_ksyms.c @@ -297,6 +297,7 @@ EXPORT_SYMBOL(svr4_getcontext); EXPORT_SYMBOL(svr4_setcontext); EXPORT_SYMBOL(compat_sys_ioctl); EXPORT_SYMBOL(sparc32_open); +EXPORT_SYMBOL(sys_close); #endif /* Special internal versions of library functions. */ diff --git a/trunk/arch/sparc64/kernel/traps.c b/trunk/arch/sparc64/kernel/traps.c index 563db528e031..2793a5d82380 100644 --- a/trunk/arch/sparc64/kernel/traps.c +++ b/trunk/arch/sparc64/kernel/traps.c @@ -1797,9 +1797,7 @@ static const char *sun4v_err_type_to_str(u32 type) }; } -extern void __show_regs(struct pt_regs * regs); - -static void sun4v_log_error(struct pt_regs *regs, struct sun4v_error_entry *ent, int cpu, const char *pfx, atomic_t *ocnt) +static void sun4v_log_error(struct sun4v_error_entry *ent, int cpu, const char *pfx, atomic_t *ocnt) { int cnt; @@ -1832,8 +1830,6 @@ static void sun4v_log_error(struct pt_regs *regs, struct sun4v_error_entry *ent, pfx, ent->err_raddr, ent->err_size, ent->err_cpu); - __show_regs(regs); - if ((cnt = atomic_read(ocnt)) != 0) { atomic_set(ocnt, 0); wmb(); @@ -1866,7 +1862,7 @@ void sun4v_resum_error(struct pt_regs *regs, unsigned long offset) put_cpu(); - sun4v_log_error(regs, &local_copy, cpu, + sun4v_log_error(&local_copy, cpu, KERN_ERR "RESUMABLE ERROR", &sun4v_resum_oflow_cnt); } @@ -1914,7 +1910,7 @@ void sun4v_nonresum_error(struct pt_regs *regs, unsigned long offset) } #endif - sun4v_log_error(regs, &local_copy, cpu, + sun4v_log_error(&local_copy, cpu, KERN_EMERG "NON-RESUMABLE ERROR", &sun4v_nonresum_oflow_cnt); @@ -2204,6 +2200,7 @@ static inline struct reg_window *kernel_stack_up(struct reg_window *rw) void die_if_kernel(char *str, struct pt_regs *regs) { static int die_counter; + extern void __show_regs(struct pt_regs * regs); extern void smp_report_regs(void); int count = 0; diff --git a/trunk/arch/sparc64/lib/checksum.S b/trunk/arch/sparc64/lib/checksum.S index 1d230f693dc4..ba9cd3ccc2b2 100644 --- a/trunk/arch/sparc64/lib/checksum.S +++ b/trunk/arch/sparc64/lib/checksum.S @@ -165,9 +165,8 @@ csum_partial_end_cruft: sll %g1, 8, %g1 or %o5, %g1, %o4 -1: addcc %o2, %o4, %o2 - addc %g0, %o2, %o2 +1: add %o2, %o4, %o2 csum_partial_finish: retl - srl %o2, 0, %o0 + mov %o2, %o0 diff --git a/trunk/arch/sparc64/lib/csum_copy.S b/trunk/arch/sparc64/lib/csum_copy.S index e566c770a0f6..71af48839064 100644 --- a/trunk/arch/sparc64/lib/csum_copy.S +++ b/trunk/arch/sparc64/lib/csum_copy.S @@ -221,12 +221,11 @@ FUNC_NAME: /* %o0=src, %o1=dst, %o2=len, %o3=sum */ sll %g1, 8, %g1 or %o5, %g1, %o4 -1: addcc %o3, %o4, %o3 - addc %g0, %o3, %o3 +1: add %o3, %o4, %o3 70: retl - srl %o3, 0, %o0 + mov %o3, %o0 95: mov 0, GLOBAL_SPARE brlez,pn %o2, 4f diff --git a/trunk/arch/um/Makefile-i386 b/trunk/arch/um/Makefile-i386 index b65ca115ef77..7a0e04e34bf9 100644 --- a/trunk/arch/um/Makefile-i386 +++ b/trunk/arch/um/Makefile-i386 @@ -33,9 +33,5 @@ include $(srctree)/arch/i386/Makefile.cpu # prevent gcc from keeping the stack 16 byte aligned. Taken from i386. cflags-y += $(call cc-option,-mpreferred-stack-boundary=2) -# Prevent sprintf in nfsd from being converted to strcpy and resulting in -# an unresolved reference. -cflags-y += -ffreestanding - CFLAGS += $(cflags-y) USER_CFLAGS += $(cflags-y) diff --git a/trunk/arch/um/include/kern_util.h b/trunk/arch/um/include/kern_util.h index 310980b32173..efa3d33c0be6 100644 --- a/trunk/arch/um/include/kern_util.h +++ b/trunk/arch/um/include/kern_util.h @@ -120,11 +120,20 @@ extern int is_syscall(unsigned long addr); extern void free_irq(unsigned int, void *); extern int cpu(void); -extern void time_init_kern(void); - /* Are we disallowed to sleep? Used to choose between GFP_KERNEL and GFP_ATOMIC. */ extern int __cant_sleep(void); extern void segv_handler(int sig, union uml_pt_regs *regs); extern void sigio_handler(int sig, union uml_pt_regs *regs); #endif + +/* + * Overrides for Emacs so that we follow Linus's tabbing style. + * Emacs will notice this stuff at the end of the file and automatically + * adjust the settings for this buffer only. This must remain at the end + * of the file. + * --------------------------------------------------------------------------- + * Local variables: + * c-file-style: "linux" + * End: + */ diff --git a/trunk/arch/um/kernel/time_kern.c b/trunk/arch/um/kernel/time_kern.c index 86f51d04c98d..528cf623f8b4 100644 --- a/trunk/arch/um/kernel/time_kern.c +++ b/trunk/arch/um/kernel/time_kern.c @@ -84,16 +84,6 @@ void timer_irq(union uml_pt_regs *regs) } } - -void time_init_kern(void) -{ - unsigned long long nsecs; - - nsecs = os_nsecs(); - set_normalized_timespec(&wall_to_monotonic, -nsecs / BILLION, - -nsecs % BILLION); -} - void do_boot_timer_handler(struct sigcontext * sc) { struct pt_regs regs; diff --git a/trunk/arch/um/os-Linux/main.c b/trunk/arch/um/os-Linux/main.c index 90912aaca7aa..3a0ac38e978b 100644 --- a/trunk/arch/um/os-Linux/main.c +++ b/trunk/arch/um/os-Linux/main.c @@ -59,7 +59,7 @@ static __init void do_uml_initcalls(void) initcall_t *call; call = &__uml_initcall_start; - while (call < &__uml_initcall_end){ + while (call < &__uml_initcall_end){; (*call)(); call++; } diff --git a/trunk/arch/um/os-Linux/time.c b/trunk/arch/um/os-Linux/time.c index 280c4fb9b585..6f7626775acb 100644 --- a/trunk/arch/um/os-Linux/time.c +++ b/trunk/arch/um/os-Linux/time.c @@ -81,12 +81,20 @@ void uml_idle_timer(void) set_interval(ITIMER_REAL); } +extern void ktime_get_ts(struct timespec *ts); +#define do_posix_clock_monotonic_gettime(ts) ktime_get_ts(ts) + void time_init(void) { + struct timespec now; + if(signal(SIGVTALRM, boot_timer_handler) == SIG_ERR) panic("Couldn't set SIGVTALRM handler"); set_interval(ITIMER_VIRTUAL); - time_init_kern(); + + do_posix_clock_monotonic_gettime(&now); + wall_to_monotonic.tv_sec = -now.tv_sec; + wall_to_monotonic.tv_nsec = -now.tv_nsec; } unsigned long long os_nsecs(void) diff --git a/trunk/arch/um/sys-i386/syscalls.c b/trunk/arch/um/sys-i386/syscalls.c index 710d5fb807e1..749dd1bfe60f 100644 --- a/trunk/arch/um/sys-i386/syscalls.c +++ b/trunk/arch/um/sys-i386/syscalls.c @@ -99,12 +99,11 @@ long sys_ipc (uint call, int first, int second, switch (call) { case SEMOP: - return sys_semtimedop(first, (struct sembuf __user *) ptr, - second, NULL); + return sys_semtimedop(first, (struct sembuf *) ptr, second, + NULL); case SEMTIMEDOP: - return sys_semtimedop(first, (struct sembuf __user *) ptr, - second, - (const struct timespec __user *) fifth); + return sys_semtimedop(first, (struct sembuf *) ptr, second, + (const struct timespec *) fifth); case SEMGET: return sys_semget (first, second, third); case SEMCTL: { diff --git a/trunk/arch/um/sys-x86_64/signal.c b/trunk/arch/um/sys-x86_64/signal.c index 9edf114faf79..a4c46a8af008 100644 --- a/trunk/arch/um/sys-x86_64/signal.c +++ b/trunk/arch/um/sys-x86_64/signal.c @@ -21,7 +21,7 @@ #include "skas.h" static int copy_sc_from_user_skas(struct pt_regs *regs, - struct sigcontext __user *from) + struct sigcontext *from) { int err = 0; @@ -54,8 +54,7 @@ static int copy_sc_from_user_skas(struct pt_regs *regs, return(err); } -int copy_sc_to_user_skas(struct sigcontext __user *to, - struct _fpstate __user *to_fp, +int copy_sc_to_user_skas(struct sigcontext *to, struct _fpstate *to_fp, struct pt_regs *regs, unsigned long mask, unsigned long sp) { @@ -107,11 +106,10 @@ int copy_sc_to_user_skas(struct sigcontext __user *to, #endif #ifdef CONFIG_MODE_TT -int copy_sc_from_user_tt(struct sigcontext *to, struct sigcontext __user *from, +int copy_sc_from_user_tt(struct sigcontext *to, struct sigcontext *from, int fpsize) { - struct _fpstate *to_fp; - struct _fpstate __user *from_fp; + struct _fpstate *to_fp, *from_fp; unsigned long sigs; int err; @@ -126,14 +124,13 @@ int copy_sc_from_user_tt(struct sigcontext *to, struct sigcontext __user *from, return(err); } -int copy_sc_to_user_tt(struct sigcontext __user *to, struct _fpstate __user *fp, +int copy_sc_to_user_tt(struct sigcontext *to, struct _fpstate *fp, struct sigcontext *from, int fpsize, unsigned long sp) { - struct _fpstate __user *to_fp; - struct _fpstate *from_fp; + struct _fpstate *to_fp, *from_fp; int err; - to_fp = (fp ? fp : (struct _fpstate __user *) (to + 1)); + to_fp = (fp ? fp : (struct _fpstate *) (to + 1)); from_fp = from->fpstate; err = copy_to_user(to, from, sizeof(*to)); /* The SP in the sigcontext is the updated one for the signal @@ -161,8 +158,7 @@ static int copy_sc_from_user(struct pt_regs *to, void __user *from) return(ret); } -static int copy_sc_to_user(struct sigcontext __user *to, - struct _fpstate __user *fp, +static int copy_sc_to_user(struct sigcontext *to, struct _fpstate *fp, struct pt_regs *from, unsigned long mask, unsigned long sp) { @@ -173,7 +169,7 @@ static int copy_sc_to_user(struct sigcontext __user *to, struct rt_sigframe { - char __user *pretcode; + char *pretcode; struct ucontext uc; struct siginfo info; }; @@ -192,7 +188,7 @@ int setup_signal_stack_si(unsigned long stack_top, int sig, frame = (struct rt_sigframe __user *) round_down(stack_top - sizeof(struct rt_sigframe), 16) - 8; - frame = (struct rt_sigframe __user *) ((unsigned long) frame - 128); + frame = (struct rt_sigframe *) ((unsigned long) frame - 128); if (!access_ok(VERIFY_WRITE, fp, sizeof(struct _fpstate))) goto out; diff --git a/trunk/arch/um/sys-x86_64/syscalls.c b/trunk/arch/um/sys-x86_64/syscalls.c index 6fce9f45dfdc..6acee5c4ada6 100644 --- a/trunk/arch/um/sys-x86_64/syscalls.c +++ b/trunk/arch/um/sys-x86_64/syscalls.c @@ -45,7 +45,7 @@ static long arch_prctl_tt(int code, unsigned long addr) case ARCH_GET_GS: ret = arch_prctl(code, (unsigned long) &tmp); if(!ret) - ret = put_user(tmp, (long __user *)addr); + ret = put_user(tmp, &addr); break; default: ret = -EINVAL; diff --git a/trunk/arch/x86_64/Kconfig b/trunk/arch/x86_64/Kconfig index 6527a368fb9c..408d44a59756 100644 --- a/trunk/arch/x86_64/Kconfig +++ b/trunk/arch/x86_64/Kconfig @@ -299,7 +299,6 @@ config X86_64_ACPI_NUMA bool "ACPI NUMA detection" depends on NUMA select ACPI - select PCI select ACPI_NUMA default y help diff --git a/trunk/arch/x86_64/kernel/acpi/Makefile b/trunk/arch/x86_64/kernel/acpi/Makefile index 080b9963f1bc..4fe97071f297 100644 --- a/trunk/arch/x86_64/kernel/acpi/Makefile +++ b/trunk/arch/x86_64/kernel/acpi/Makefile @@ -4,6 +4,5 @@ obj-$(CONFIG_ACPI_SLEEP) += sleep.o wakeup.o ifneq ($(CONFIG_ACPI_PROCESSOR),) obj-y += processor.o -processor-y := ../../../i386/kernel/acpi/processor.o ../../../i386/kernel/acpi/cstate.o endif diff --git a/trunk/arch/x86_64/kernel/acpi/processor.c b/trunk/arch/x86_64/kernel/acpi/processor.c new file mode 100644 index 000000000000..3bdc2baa5bb1 --- /dev/null +++ b/trunk/arch/x86_64/kernel/acpi/processor.c @@ -0,0 +1,72 @@ +/* + * arch/x86_64/kernel/acpi/processor.c + * + * Copyright (C) 2005 Intel Corporation + * Venkatesh Pallipadi + * - Added _PDC for platforms with Intel CPUs + */ + +#include +#include +#include +#include + +#include +#include + +static void init_intel_pdc(struct acpi_processor *pr, struct cpuinfo_x86 *c) +{ + struct acpi_object_list *obj_list; + union acpi_object *obj; + u32 *buf; + + /* allocate and initialize pdc. It will be used later. */ + obj_list = kmalloc(sizeof(struct acpi_object_list), GFP_KERNEL); + if (!obj_list) { + printk(KERN_ERR "Memory allocation error\n"); + return; + } + + obj = kmalloc(sizeof(union acpi_object), GFP_KERNEL); + if (!obj) { + printk(KERN_ERR "Memory allocation error\n"); + kfree(obj_list); + return; + } + + buf = kmalloc(12, GFP_KERNEL); + if (!buf) { + printk(KERN_ERR "Memory allocation error\n"); + kfree(obj); + kfree(obj_list); + return; + } + + buf[0] = ACPI_PDC_REVISION_ID; + buf[1] = 1; + buf[2] = ACPI_PDC_EST_CAPABILITY_SMP; + + obj->type = ACPI_TYPE_BUFFER; + obj->buffer.length = 12; + obj->buffer.pointer = (u8 *) buf; + obj_list->count = 1; + obj_list->pointer = obj; + pr->pdc = obj_list; + + return; +} + +/* Initialize _PDC data based on the CPU vendor */ +void arch_acpi_processor_init_pdc(struct acpi_processor *pr) +{ + unsigned int cpu = pr->id; + struct cpuinfo_x86 *c = cpu_data + cpu; + + pr->pdc = NULL; + if (c->x86_vendor == X86_VENDOR_INTEL && cpu_has(c, X86_FEATURE_EST)) + init_intel_pdc(pr, c); + + return; +} + +EXPORT_SYMBOL(arch_acpi_processor_init_pdc); diff --git a/trunk/arch/x86_64/kernel/io_apic.c b/trunk/arch/x86_64/kernel/io_apic.c index 9cc7031b7151..0de3ea938830 100644 --- a/trunk/arch/x86_64/kernel/io_apic.c +++ b/trunk/arch/x86_64/kernel/io_apic.c @@ -271,18 +271,6 @@ __setup("enable_8254_timer", setup_enable_8254_timer); #include #include - -#ifdef CONFIG_ACPI - -static int nvidia_hpet_detected __initdata; - -static int __init nvidia_hpet_check(unsigned long phys, unsigned long size) -{ - nvidia_hpet_detected = 1; - return 0; -} -#endif - /* Temporary Hack. Nvidia and VIA boards currently only work with IO-APIC off. Check for an Nvidia or VIA PCI bridge and turn it off. Use pci direct infrastructure because this runs before the PCI subsystem. @@ -329,19 +317,11 @@ void __init check_ioapic(void) return; case PCI_VENDOR_ID_NVIDIA: #ifdef CONFIG_ACPI - /* - * All timer overrides on Nvidia are - * wrong unless HPET is enabled. - */ - nvidia_hpet_detected = 0; - acpi_table_parse(ACPI_HPET, - nvidia_hpet_check); - if (nvidia_hpet_detected == 0) { - acpi_skip_timer_override = 1; - printk(KERN_INFO "Nvidia board " - "detected. Ignoring ACPI " - "timer override.\n"); - } + /* All timer overrides on Nvidia + seem to be wrong. Skip them. */ + acpi_skip_timer_override = 1; + printk(KERN_INFO + "Nvidia board detected. Ignoring ACPI timer override.\n"); #endif /* RED-PEN skip them on mptables too? */ return; diff --git a/trunk/block/as-iosched.c b/trunk/block/as-iosched.c index a7caf35ca0c2..e25a5d79ab27 100644 --- a/trunk/block/as-iosched.c +++ b/trunk/block/as-iosched.c @@ -1648,17 +1648,17 @@ static void as_exit_queue(elevator_t *e) * initialize elevator private data (as_data), and alloc a arq for * each request on the free lists */ -static void *as_init_queue(request_queue_t *q, elevator_t *e) +static int as_init_queue(request_queue_t *q, elevator_t *e) { struct as_data *ad; int i; if (!arq_pool) - return NULL; + return -ENOMEM; ad = kmalloc_node(sizeof(*ad), GFP_KERNEL, q->node); if (!ad) - return NULL; + return -ENOMEM; memset(ad, 0, sizeof(*ad)); ad->q = q; /* Identify what queue the data belongs to */ @@ -1667,7 +1667,7 @@ static void *as_init_queue(request_queue_t *q, elevator_t *e) GFP_KERNEL, q->node); if (!ad->hash) { kfree(ad); - return NULL; + return -ENOMEM; } ad->arq_pool = mempool_create_node(BLKDEV_MIN_RQ, mempool_alloc_slab, @@ -1675,7 +1675,7 @@ static void *as_init_queue(request_queue_t *q, elevator_t *e) if (!ad->arq_pool) { kfree(ad->hash); kfree(ad); - return NULL; + return -ENOMEM; } /* anticipatory scheduling helpers */ @@ -1696,13 +1696,14 @@ static void *as_init_queue(request_queue_t *q, elevator_t *e) ad->antic_expire = default_antic_expire; ad->batch_expire[REQ_SYNC] = default_read_batch_expire; ad->batch_expire[REQ_ASYNC] = default_write_batch_expire; + e->elevator_data = ad; ad->current_batch_expires = jiffies + ad->batch_expire[REQ_SYNC]; ad->write_batch_count = ad->batch_expire[REQ_ASYNC] / 10; if (ad->write_batch_count < 2) ad->write_batch_count = 2; - return ad; + return 0; } /* diff --git a/trunk/block/cfq-iosched.c b/trunk/block/cfq-iosched.c index 052b17487625..11ce6aaf1bd0 100644 --- a/trunk/block/cfq-iosched.c +++ b/trunk/block/cfq-iosched.c @@ -133,7 +133,6 @@ struct cfq_data { mempool_t *crq_pool; int rq_in_driver; - int hw_tag; /* * schedule slice state info @@ -501,13 +500,10 @@ static void cfq_resort_rr_list(struct cfq_queue *cfqq, int preempted) /* * if queue was preempted, just add to front to be fair. busy_rr - * isn't sorted, but insert at the back for fairness. + * isn't sorted. */ if (preempted || list == &cfqd->busy_rr) { - if (preempted) - list = list->prev; - - list_add_tail(&cfqq->cfq_list, list); + list_add(&cfqq->cfq_list, list); return; } @@ -668,15 +664,6 @@ static void cfq_activate_request(request_queue_t *q, struct request *rq) struct cfq_data *cfqd = q->elevator->elevator_data; cfqd->rq_in_driver++; - - /* - * If the depth is larger 1, it really could be queueing. But lets - * make the mark a little higher - idling could still be good for - * low queueing, and a low queueing number could also just indicate - * a SCSI mid layer like behaviour where limit+1 is often seen. - */ - if (!cfqd->hw_tag && cfqd->rq_in_driver > 4) - cfqd->hw_tag = 1; } static void cfq_deactivate_request(request_queue_t *q, struct request *rq) @@ -891,13 +878,6 @@ static struct cfq_queue *cfq_set_active_queue(struct cfq_data *cfqd) if (!list_empty(&cfqd->cur_rr) || cfq_get_next_prio_level(cfqd) != -1) cfqq = list_entry_cfqq(cfqd->cur_rr.next); - /* - * If no new queues are available, check if the busy list has some - * before falling back to idle io. - */ - if (!cfqq && !list_empty(&cfqd->busy_rr)) - cfqq = list_entry_cfqq(cfqd->busy_rr.next); - /* * if we have idle queues and no rt or be queues had pending * requests, either allow immediate service if the grace period @@ -1323,12 +1303,17 @@ cfq_alloc_io_context(struct cfq_data *cfqd, gfp_t gfp_mask) struct cfq_io_context *cic = kmem_cache_alloc(cfq_ioc_pool, gfp_mask); if (cic) { - memset(cic, 0, sizeof(*cic)); - RB_CLEAR_COLOR(&cic->rb_node); + RB_CLEAR(&cic->rb_node); + cic->key = NULL; + cic->cfqq[ASYNC] = NULL; + cic->cfqq[SYNC] = NULL; cic->last_end_request = jiffies; - INIT_LIST_HEAD(&cic->queue_list); + cic->ttime_total = 0; + cic->ttime_samples = 0; + cic->ttime_mean = 0; cic->dtor = cfq_free_io_context; cic->exit = cfq_exit_io_context; + INIT_LIST_HEAD(&cic->queue_list); atomic_inc(&ioc_count); } @@ -1473,8 +1458,7 @@ cfq_get_queue(struct cfq_data *cfqd, unsigned int key, struct task_struct *tsk, * set ->slice_left to allow preemption for a new process */ cfqq->slice_left = 2 * cfqd->cfq_slice_idle; - if (!cfqd->hw_tag) - cfq_mark_cfqq_idle_window(cfqq); + cfq_mark_cfqq_idle_window(cfqq); cfq_mark_cfqq_prio_changed(cfqq); cfq_init_prio_data(cfqq); } @@ -1665,7 +1649,7 @@ cfq_update_idle_window(struct cfq_data *cfqd, struct cfq_queue *cfqq, { int enable_idle = cfq_cfqq_idle_window(cfqq); - if (!cic->ioc->task || !cfqd->cfq_slice_idle || cfqd->hw_tag) + if (!cic->ioc->task || !cfqd->cfq_slice_idle) enable_idle = 0; else if (sample_valid(cic->ttime_samples)) { if (cic->ttime_mean > cfqd->cfq_slice_idle) @@ -1756,24 +1740,14 @@ cfq_crq_enqueued(struct cfq_data *cfqd, struct cfq_queue *cfqq, cfqq->next_crq = cfq_choose_req(cfqd, cfqq->next_crq, crq); - cic = crq->io_context; - /* * we never wait for an async request and we don't allow preemption * of an async request. so just return early */ - if (!cfq_crq_is_sync(crq)) { - /* - * sync process issued an async request, if it's waiting - * then expire it and kick rq handling. - */ - if (cic == cfqd->active_cic && - del_timer(&cfqd->idle_slice_timer)) { - cfq_slice_expired(cfqd, 0); - cfq_start_queueing(cfqd, cfqq); - } + if (!cfq_crq_is_sync(crq)) return; - } + + cic = crq->io_context; cfq_update_io_thinktime(cfqd, cic); cfq_update_io_seektime(cfqd, cic, crq); @@ -2191,9 +2165,10 @@ static void cfq_idle_class_timer(unsigned long data) * race with a non-idle queue, reset timer */ end = cfqd->last_end_request + CFQ_IDLE_GRACE; - if (!time_after_eq(jiffies, end)) - mod_timer(&cfqd->idle_class_timer, end); - else + if (!time_after_eq(jiffies, end)) { + cfqd->idle_class_timer.expires = end; + add_timer(&cfqd->idle_class_timer); + } else cfq_schedule_dispatch(cfqd); spin_unlock_irqrestore(cfqd->queue->queue_lock, flags); @@ -2246,14 +2221,14 @@ static void cfq_exit_queue(elevator_t *e) kfree(cfqd); } -static void *cfq_init_queue(request_queue_t *q, elevator_t *e) +static int cfq_init_queue(request_queue_t *q, elevator_t *e) { struct cfq_data *cfqd; int i; cfqd = kmalloc(sizeof(*cfqd), GFP_KERNEL); if (!cfqd) - return NULL; + return -ENOMEM; memset(cfqd, 0, sizeof(*cfqd)); @@ -2283,6 +2258,8 @@ static void *cfq_init_queue(request_queue_t *q, elevator_t *e) for (i = 0; i < CFQ_QHASH_ENTRIES; i++) INIT_HLIST_HEAD(&cfqd->cfq_hash[i]); + e->elevator_data = cfqd; + cfqd->queue = q; cfqd->max_queued = q->nr_requests / 4; @@ -2309,14 +2286,14 @@ static void *cfq_init_queue(request_queue_t *q, elevator_t *e) cfqd->cfq_slice_async_rq = cfq_slice_async_rq; cfqd->cfq_slice_idle = cfq_slice_idle; - return cfqd; + return 0; out_crqpool: kfree(cfqd->cfq_hash); out_cfqhash: kfree(cfqd->crq_hash); out_crqhash: kfree(cfqd); - return NULL; + return -ENOMEM; } static void cfq_slab_kill(void) diff --git a/trunk/block/deadline-iosched.c b/trunk/block/deadline-iosched.c index 3bd0415a9828..399fa1e60e1f 100644 --- a/trunk/block/deadline-iosched.c +++ b/trunk/block/deadline-iosched.c @@ -613,24 +613,24 @@ static void deadline_exit_queue(elevator_t *e) * initialize elevator private data (deadline_data), and alloc a drq for * each request on the free lists */ -static void *deadline_init_queue(request_queue_t *q, elevator_t *e) +static int deadline_init_queue(request_queue_t *q, elevator_t *e) { struct deadline_data *dd; int i; if (!drq_pool) - return NULL; + return -ENOMEM; dd = kmalloc_node(sizeof(*dd), GFP_KERNEL, q->node); if (!dd) - return NULL; + return -ENOMEM; memset(dd, 0, sizeof(*dd)); dd->hash = kmalloc_node(sizeof(struct list_head)*DL_HASH_ENTRIES, GFP_KERNEL, q->node); if (!dd->hash) { kfree(dd); - return NULL; + return -ENOMEM; } dd->drq_pool = mempool_create_node(BLKDEV_MIN_RQ, mempool_alloc_slab, @@ -638,7 +638,7 @@ static void *deadline_init_queue(request_queue_t *q, elevator_t *e) if (!dd->drq_pool) { kfree(dd->hash); kfree(dd); - return NULL; + return -ENOMEM; } for (i = 0; i < DL_HASH_ENTRIES; i++) @@ -653,7 +653,8 @@ static void *deadline_init_queue(request_queue_t *q, elevator_t *e) dd->writes_starved = writes_starved; dd->front_merges = 1; dd->fifo_batch = fifo_batch; - return dd; + e->elevator_data = dd; + return 0; } static void deadline_put_request(request_queue_t *q, struct request *rq) diff --git a/trunk/block/elevator.c b/trunk/block/elevator.c index a0afdd317cef..8768a367fdde 100644 --- a/trunk/block/elevator.c +++ b/trunk/block/elevator.c @@ -121,16 +121,16 @@ static struct elevator_type *elevator_get(const char *name) return e; } -static void *elevator_init_queue(request_queue_t *q, struct elevator_queue *eq) +static int elevator_attach(request_queue_t *q, struct elevator_queue *eq) { - return eq->ops->elevator_init_fn(q, eq); -} + int ret = 0; -static void elevator_attach(request_queue_t *q, struct elevator_queue *eq, - void *data) -{ q->elevator = eq; - eq->elevator_data = data; + + if (eq->ops->elevator_init_fn) + ret = eq->ops->elevator_init_fn(q, eq); + + return ret; } static char chosen_elevator[16]; @@ -181,7 +181,6 @@ int elevator_init(request_queue_t *q, char *name) struct elevator_type *e = NULL; struct elevator_queue *eq; int ret = 0; - void *data; INIT_LIST_HEAD(&q->queue_head); q->last_merge = NULL; @@ -203,13 +202,10 @@ int elevator_init(request_queue_t *q, char *name) if (!eq) return -ENOMEM; - data = elevator_init_queue(q, eq); - if (!data) { + ret = elevator_attach(q, eq); + if (ret) kobject_put(&eq->kobj); - return -ENOMEM; - } - elevator_attach(q, eq, data); return ret; } @@ -726,16 +722,13 @@ int elv_register_queue(struct request_queue *q) return error; } -static void __elv_unregister_queue(elevator_t *e) -{ - kobject_uevent(&e->kobj, KOBJ_REMOVE); - kobject_del(&e->kobj); -} - void elv_unregister_queue(struct request_queue *q) { - if (q) - __elv_unregister_queue(q->elevator); + if (q) { + elevator_t *e = q->elevator; + kobject_uevent(&e->kobj, KOBJ_REMOVE); + kobject_del(&e->kobj); + } } int elv_register(struct elevator_type *e) @@ -787,7 +780,6 @@ EXPORT_SYMBOL_GPL(elv_unregister); static int elevator_switch(request_queue_t *q, struct elevator_type *new_e) { elevator_t *old_elevator, *e; - void *data; /* * Allocate new elevator @@ -796,12 +788,6 @@ static int elevator_switch(request_queue_t *q, struct elevator_type *new_e) if (!e) return 0; - data = elevator_init_queue(q, e); - if (!data) { - kobject_put(&e->kobj); - return 0; - } - /* * Turn on BYPASS and drain all requests w/ elevator private data */ @@ -820,19 +806,19 @@ static int elevator_switch(request_queue_t *q, struct elevator_type *new_e) elv_drain_elevator(q); } + spin_unlock_irq(q->queue_lock); + /* - * Remember old elevator. + * unregister old elevator data */ + elv_unregister_queue(q); old_elevator = q->elevator; /* * attach and start new elevator */ - elevator_attach(q, e, data); - - spin_unlock_irq(q->queue_lock); - - __elv_unregister_queue(old_elevator); + if (elevator_attach(q, e)) + goto fail; if (elv_register_queue(q)) goto fail_register; @@ -851,6 +837,7 @@ static int elevator_switch(request_queue_t *q, struct elevator_type *new_e) */ elevator_exit(e); e = NULL; +fail: q->elevator = old_elevator; elv_register_queue(q); clear_bit(QUEUE_FLAG_ELVSWITCH, &q->queue_flags); diff --git a/trunk/block/noop-iosched.c b/trunk/block/noop-iosched.c index 56a7c620574f..f370e4a7fe6d 100644 --- a/trunk/block/noop-iosched.c +++ b/trunk/block/noop-iosched.c @@ -65,15 +65,16 @@ noop_latter_request(request_queue_t *q, struct request *rq) return list_entry(rq->queuelist.next, struct request, queuelist); } -static void *noop_init_queue(request_queue_t *q, elevator_t *e) +static int noop_init_queue(request_queue_t *q, elevator_t *e) { struct noop_data *nd; nd = kmalloc(sizeof(*nd), GFP_KERNEL); if (!nd) - return NULL; + return -ENOMEM; INIT_LIST_HEAD(&nd->queue); - return nd; + e->elevator_data = nd; + return 0; } static void noop_exit_queue(elevator_t *e) diff --git a/trunk/drivers/acpi/Kconfig b/trunk/drivers/acpi/Kconfig index 2b2fbec14540..c24652d31bf9 100644 --- a/trunk/drivers/acpi/Kconfig +++ b/trunk/drivers/acpi/Kconfig @@ -10,8 +10,9 @@ menu "ACPI (Advanced Configuration and Power Interface) Support" config ACPI bool "ACPI Support" depends on IA64 || X86 - depends on PCI select PM + select PCI + default y ---help--- Advanced Configuration and Power Interface (ACPI) support for diff --git a/trunk/drivers/acpi/acpi_memhotplug.c b/trunk/drivers/acpi/acpi_memhotplug.c index e0a95ba72371..d882bf87fa96 100644 --- a/trunk/drivers/acpi/acpi_memhotplug.c +++ b/trunk/drivers/acpi/acpi_memhotplug.c @@ -74,7 +74,7 @@ struct acpi_memory_device { unsigned short caching; /* memory cache attribute */ unsigned short write_protect; /* memory read/write attribute */ u64 start_addr; /* Memory Range start physical addr */ - u64 length; /* Memory Range length */ + u64 end_addr; /* Memory Range end physical addr */ }; static int @@ -97,11 +97,12 @@ acpi_memory_get_device_resources(struct acpi_memory_device *mem_device) if (ACPI_SUCCESS(status)) { if (address64.resource_type == ACPI_MEMORY_RANGE) { /* Populate the structure */ - mem_device->caching = address64.info.mem.caching; + mem_device->caching = + address64.info.mem.caching; mem_device->write_protect = address64.info.mem.write_protect; mem_device->start_addr = address64.minimum; - mem_device->length = address64.address_length; + mem_device->end_addr = address64.maximum; } } @@ -198,7 +199,8 @@ static int acpi_memory_enable_device(struct acpi_memory_device *mem_device) * Tell the VM there is more memory here... * Note: Assume that this function returns zero on success */ - result = add_memory(mem_device->start_addr, mem_device->length); + result = add_memory(mem_device->start_addr, + (mem_device->end_addr - mem_device->start_addr) + 1); if (result) { ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "\nadd_memory failed\n")); mem_device->state = MEMORY_INVALID_STATE; @@ -247,7 +249,7 @@ static int acpi_memory_disable_device(struct acpi_memory_device *mem_device) { int result; u64 start = mem_device->start_addr; - u64 len = mem_device->length; + u64 len = mem_device->end_addr - start + 1; ACPI_FUNCTION_TRACE("acpi_memory_disable_device"); diff --git a/trunk/drivers/acpi/asus_acpi.c b/trunk/drivers/acpi/asus_acpi.c index 839f423d738d..f4c87750dbf2 100644 --- a/trunk/drivers/acpi/asus_acpi.c +++ b/trunk/drivers/acpi/asus_acpi.c @@ -817,7 +817,7 @@ typedef int (proc_writefunc) (struct file * file, const char __user * buffer, unsigned long count, void *data); static int -asus_proc_add(char *name, proc_writefunc * writefunc, +__init asus_proc_add(char *name, proc_writefunc * writefunc, proc_readfunc * readfunc, mode_t mode, struct acpi_device *device) { @@ -836,7 +836,7 @@ asus_proc_add(char *name, proc_writefunc * writefunc, return 0; } -static int asus_hotk_add_fs(struct acpi_device *device) +static int __init asus_hotk_add_fs(struct acpi_device *device) { struct proc_dir_entry *proc; mode_t mode; @@ -954,7 +954,7 @@ static void asus_hotk_notify(acpi_handle handle, u32 event, void *data) * This function is used to initialize the hotk with right values. In this * method, we can make all the detection we want, and modify the hotk struct */ -static int asus_hotk_get_info(void) +static int __init asus_hotk_get_info(void) { struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; struct acpi_buffer dsdt = { ACPI_ALLOCATE_BUFFER, NULL }; @@ -970,7 +970,7 @@ static int asus_hotk_get_info(void) * HID), this bit will be moved. A global variable asus_info contains * the DSDT header. */ - status = acpi_get_table(ACPI_TABLE_ID_DSDT, 1, &dsdt); + status = acpi_get_table(ACPI_TABLE_DSDT, 1, &dsdt); if (ACPI_FAILURE(status)) printk(KERN_WARNING " Couldn't get the DSDT table header\n"); else @@ -1101,7 +1101,7 @@ static int asus_hotk_get_info(void) return AE_OK; } -static int asus_hotk_check(void) +static int __init asus_hotk_check(void) { int result = 0; @@ -1119,9 +1119,7 @@ static int asus_hotk_check(void) return result; } -static int asus_hotk_found; - -static int asus_hotk_add(struct acpi_device *device) +static int __init asus_hotk_add(struct acpi_device *device) { acpi_status status = AE_OK; int result; @@ -1182,8 +1180,6 @@ static int asus_hotk_add(struct acpi_device *device) } } - asus_hotk_found = 1; - end: if (result) { kfree(hotk); @@ -1230,22 +1226,10 @@ static int __init asus_acpi_init(void) asus_proc_dir->owner = THIS_MODULE; result = acpi_bus_register_driver(&asus_hotk_driver); - if (result < 0) { - remove_proc_entry(PROC_ASUS, acpi_root_dir); - return -ENODEV; - } - - /* - * This is a bit of a kludge. We only want this module loaded - * for ASUS systems, but there's currently no way to probe the - * ACPI namespace for ASUS HIDs. So we just return failure if - * we didn't find one, which will cause the module to be - * unloaded. - */ - if (!asus_hotk_found) { + if (result < 1) { acpi_bus_unregister_driver(&asus_hotk_driver); remove_proc_entry(PROC_ASUS, acpi_root_dir); - return result; + return -ENODEV; } return 0; diff --git a/trunk/drivers/acpi/bus.c b/trunk/drivers/acpi/bus.c index b77f03d51f0b..606f8733a776 100644 --- a/trunk/drivers/acpi/bus.c +++ b/trunk/drivers/acpi/bus.c @@ -43,7 +43,7 @@ ACPI_MODULE_NAME("acpi_bus") extern void __init acpi_pic_sci_set_trigger(unsigned int irq, u16 trigger); #endif -struct fadt_descriptor acpi_fadt; +FADT_DESCRIPTOR acpi_fadt; EXPORT_SYMBOL(acpi_fadt); struct acpi_device *acpi_root; @@ -596,8 +596,6 @@ void __init acpi_early_init(void) if (acpi_disabled) return_VOID; - printk(KERN_INFO PREFIX "Core revision %08x\n", ACPI_CA_VERSION); - /* enable workarounds, unless strict ACPI spec. compliance */ if (!acpi_strict) acpi_gbl_enable_interpreter_slack = TRUE; @@ -619,7 +617,7 @@ void __init acpi_early_init(void) /* * Get a separate copy of the FADT for use by other drivers. */ - status = acpi_get_table(ACPI_TABLE_ID_FADT, 1, &buffer); + status = acpi_get_table(ACPI_TABLE_FADT, 1, &buffer); if (ACPI_FAILURE(status)) { printk(KERN_ERR PREFIX "Unable to get the FADT\n"); goto error0; @@ -745,6 +743,8 @@ static int __init acpi_init(void) ACPI_FUNCTION_TRACE("acpi_init"); + printk(KERN_INFO PREFIX "Subsystem revision %08x\n", ACPI_CA_VERSION); + if (acpi_disabled) { printk(KERN_INFO PREFIX "Interpreter disabled.\n"); return_VALUE(-ENODEV); diff --git a/trunk/drivers/acpi/dispatcher/dsfield.c b/trunk/drivers/acpi/dispatcher/dsfield.c index a6d77efb41a0..76bc0463f6de 100644 --- a/trunk/drivers/acpi/dispatcher/dsfield.c +++ b/trunk/drivers/acpi/dispatcher/dsfield.c @@ -87,7 +87,7 @@ acpi_ds_create_buffer_field(union acpi_parse_object *op, union acpi_operand_object *second_desc = NULL; u32 flags; - ACPI_FUNCTION_TRACE(ds_create_buffer_field); + ACPI_FUNCTION_TRACE("ds_create_buffer_field"); /* Get the name_string argument */ @@ -210,7 +210,7 @@ acpi_ds_get_field_names(struct acpi_create_field_info *info, acpi_status status; acpi_integer position; - ACPI_FUNCTION_TRACE_PTR(ds_get_field_names, info); + ACPI_FUNCTION_TRACE_PTR("ds_get_field_names", info); /* First field starts at bit zero */ @@ -342,7 +342,7 @@ acpi_ds_create_field(union acpi_parse_object *op, union acpi_parse_object *arg; struct acpi_create_field_info info; - ACPI_FUNCTION_TRACE_PTR(ds_create_field, op); + ACPI_FUNCTION_TRACE_PTR("ds_create_field", op); /* First arg is the name of the parent op_region (must already exist) */ @@ -399,7 +399,7 @@ acpi_ds_init_field_objects(union acpi_parse_object *op, struct acpi_namespace_node *node; u8 type = 0; - ACPI_FUNCTION_TRACE_PTR(ds_init_field_objects, op); + ACPI_FUNCTION_TRACE_PTR("ds_init_field_objects", op); switch (walk_state->opcode) { case AML_FIELD_OP: @@ -425,7 +425,6 @@ acpi_ds_init_field_objects(union acpi_parse_object *op, * Walk the list of entries in the field_list */ while (arg) { - /* Ignore OFFSET and ACCESSAS terms here */ if (arg->common.aml_opcode == AML_INT_NAMEDFIELD_OP) { @@ -482,7 +481,7 @@ acpi_ds_create_bank_field(union acpi_parse_object *op, union acpi_parse_object *arg; struct acpi_create_field_info info; - ACPI_FUNCTION_TRACE_PTR(ds_create_bank_field, op); + ACPI_FUNCTION_TRACE_PTR("ds_create_bank_field", op); /* First arg is the name of the parent op_region (must already exist) */ @@ -555,7 +554,7 @@ acpi_ds_create_index_field(union acpi_parse_object *op, union acpi_parse_object *arg; struct acpi_create_field_info info; - ACPI_FUNCTION_TRACE_PTR(ds_create_index_field, op); + ACPI_FUNCTION_TRACE_PTR("ds_create_index_field", op); /* First arg is the name of the Index register (must already exist) */ diff --git a/trunk/drivers/acpi/dispatcher/dsinit.c b/trunk/drivers/acpi/dispatcher/dsinit.c index bbdf990e9f65..e65a07ad2422 100644 --- a/trunk/drivers/acpi/dispatcher/dsinit.c +++ b/trunk/drivers/acpi/dispatcher/dsinit.c @@ -184,7 +184,7 @@ acpi_ds_init_one_object(acpi_handle obj_handle, * * RETURN: Status * - * DESCRIPTION: Walk the namespace starting at "StartNode" and perform any + * DESCRIPTION: Walk the namespace starting at "start_node" and perform any * necessary initialization on the objects found therein * ******************************************************************************/ @@ -196,7 +196,7 @@ acpi_ds_initialize_objects(struct acpi_table_desc * table_desc, acpi_status status; struct acpi_init_walk_info info; - ACPI_FUNCTION_TRACE(ds_initialize_objects); + ACPI_FUNCTION_TRACE("ds_initialize_objects"); ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "**** Starting initialization of namespace objects ****\n")); @@ -213,7 +213,7 @@ acpi_ds_initialize_objects(struct acpi_table_desc * table_desc, status = acpi_walk_namespace(ACPI_TYPE_ANY, start_node, ACPI_UINT32_MAX, acpi_ds_init_one_object, &info, NULL); if (ACPI_FAILURE(status)) { - ACPI_EXCEPTION((AE_INFO, status, "During WalkNamespace")); + ACPI_EXCEPTION((AE_INFO, status, "During walk_namespace")); } ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, diff --git a/trunk/drivers/acpi/dispatcher/dsmethod.c b/trunk/drivers/acpi/dispatcher/dsmethod.c index bc9aca4e7401..c475546535b6 100644 --- a/trunk/drivers/acpi/dispatcher/dsmethod.c +++ b/trunk/drivers/acpi/dispatcher/dsmethod.c @@ -81,7 +81,6 @@ acpi_ds_method_error(acpi_status status, struct acpi_walk_state *walk_state) /* Invoke the global exception handler */ if (acpi_gbl_exception_handler) { - /* Exit the interpreter, allow handler to execute methods */ acpi_ex_exit_interpreter(); @@ -101,7 +100,6 @@ acpi_ds_method_error(acpi_status status, struct acpi_walk_state *walk_state) } #ifdef ACPI_DISASSEMBLER if (ACPI_FAILURE(status)) { - /* Display method locals/args if disassembler is present */ acpi_dm_dump_method_info(status, walk_state, walk_state->op); @@ -134,7 +132,7 @@ acpi_ds_begin_method_execution(struct acpi_namespace_node * method_node, { acpi_status status = AE_OK; - ACPI_FUNCTION_TRACE_PTR(ds_begin_method_execution, method_node); + ACPI_FUNCTION_TRACE_PTR("ds_begin_method_execution", method_node); if (!method_node) { return_ACPI_STATUS(AE_NULL_ENTRY); @@ -170,14 +168,11 @@ acpi_ds_begin_method_execution(struct acpi_namespace_node * method_node, /* * Get a unit from the method semaphore. This releases the - * interpreter if we block (then reacquires it) + * interpreter if we block */ status = acpi_ex_system_wait_semaphore(obj_desc->method.semaphore, ACPI_WAIT_FOREVER); - if (ACPI_FAILURE(status)) { - return_ACPI_STATUS(status); - } } /* @@ -188,7 +183,7 @@ acpi_ds_begin_method_execution(struct acpi_namespace_node * method_node, if (!obj_desc->method.owner_id) { status = acpi_ut_allocate_owner_id(&obj_desc->method.owner_id); if (ACPI_FAILURE(status)) { - goto cleanup; + return_ACPI_STATUS(status); } } @@ -198,14 +193,6 @@ acpi_ds_begin_method_execution(struct acpi_namespace_node * method_node, */ obj_desc->method.thread_count++; return_ACPI_STATUS(status); - - cleanup: - /* On error, must signal the method semaphore if present */ - - if (obj_desc->method.semaphore) { - (void)acpi_os_signal_semaphore(obj_desc->method.semaphore, 1); - } - return_ACPI_STATUS(status); } /******************************************************************************* @@ -231,10 +218,10 @@ acpi_ds_call_control_method(struct acpi_thread_state *thread, struct acpi_namespace_node *method_node; struct acpi_walk_state *next_walk_state = NULL; union acpi_operand_object *obj_desc; - struct acpi_evaluate_info *info; + struct acpi_parameter_info info; u32 i; - ACPI_FUNCTION_TRACE_PTR(ds_call_control_method, this_walk_state); + ACPI_FUNCTION_TRACE_PTR("ds_call_control_method", this_walk_state); ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Execute method %p, currentstate=%p\n", @@ -253,31 +240,25 @@ acpi_ds_call_control_method(struct acpi_thread_state *thread, return_ACPI_STATUS(AE_NULL_OBJECT); } - /* Init for new method, possibly wait on concurrency semaphore */ + /* Init for new method, wait on concurrency semaphore */ status = acpi_ds_begin_method_execution(method_node, obj_desc, this_walk_state->method_node); if (ACPI_FAILURE(status)) { - return_ACPI_STATUS(status); + goto cleanup; } - /* - * 1) Parse the method. All "normal" methods are parsed for each execution. - * Internal methods (_OSI, etc.) do not require parsing. - */ if (!(obj_desc->method.method_flags & AML_METHOD_INTERNAL_ONLY)) { - - /* Create a new walk state for the parse */ + /* 1) Parse: Create a new walk state for the preempting walk */ next_walk_state = acpi_ds_create_walk_state(obj_desc->method.owner_id, op, obj_desc, NULL); if (!next_walk_state) { - status = AE_NO_MEMORY; - goto cleanup; + return_ACPI_STATUS(AE_NO_MEMORY); } - /* Create and init a parse tree root */ + /* Create and init a Root Node */ op = acpi_ps_create_scope_op(); if (!op) { @@ -290,20 +271,17 @@ acpi_ds_call_control_method(struct acpi_thread_state *thread, obj_desc->method.aml_length, NULL, 1); if (ACPI_FAILURE(status)) { - acpi_ps_delete_parse_tree(op); + acpi_ds_delete_walk_state(next_walk_state); goto cleanup; } - /* Begin AML parse (deletes next_walk_state) */ + /* Begin AML parse */ status = acpi_ps_parse_aml(next_walk_state); acpi_ps_delete_parse_tree(op); - if (ACPI_FAILURE(status)) { - goto cleanup; - } } - /* 2) Begin method execution. Create a new walk state */ + /* 2) Execute: Create a new state for the preempting walk */ next_walk_state = acpi_ds_create_walk_state(obj_desc->method.owner_id, NULL, obj_desc, thread); @@ -311,7 +289,6 @@ acpi_ds_call_control_method(struct acpi_thread_state *thread, status = AE_NO_MEMORY; goto cleanup; } - /* * The resolved arguments were put on the previous walk state's operand * stack. Operands on the previous walk state stack always @@ -319,24 +296,12 @@ acpi_ds_call_control_method(struct acpi_thread_state *thread, */ this_walk_state->operands[this_walk_state->num_operands] = NULL; - /* - * Allocate and initialize the evaluation information block - * TBD: this is somewhat inefficient, should change interface to - * ds_init_aml_walk. For now, keeps this struct off the CPU stack - */ - info = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_evaluate_info)); - if (!info) { - return_ACPI_STATUS(AE_NO_MEMORY); - } - - info->parameters = &this_walk_state->operands[0]; - info->parameter_type = ACPI_PARAM_ARGS; + info.parameters = &this_walk_state->operands[0]; + info.parameter_type = ACPI_PARAM_ARGS; status = acpi_ds_init_aml_walk(next_walk_state, NULL, method_node, obj_desc->method.aml_start, - obj_desc->method.aml_length, info, 3); - - ACPI_FREE(info); + obj_desc->method.aml_length, &info, 3); if (ACPI_FAILURE(status)) { goto cleanup; } @@ -358,8 +323,6 @@ acpi_ds_call_control_method(struct acpi_thread_state *thread, "Starting nested execution, newstate=%p\n", next_walk_state)); - /* Invoke an internal method if necessary */ - if (obj_desc->method.method_flags & AML_METHOD_INTERNAL_ONLY) { status = obj_desc->method.implementation(next_walk_state); } @@ -367,14 +330,16 @@ acpi_ds_call_control_method(struct acpi_thread_state *thread, return_ACPI_STATUS(status); cleanup: + /* Decrement the thread count on the method parse tree */ - /* On error, we must terminate the method properly */ - - acpi_ds_terminate_control_method(obj_desc, next_walk_state); - if (next_walk_state) { - acpi_ds_delete_walk_state(next_walk_state); + if (next_walk_state && (next_walk_state->method_desc)) { + next_walk_state->method_desc->method.thread_count--; } + /* On error, we must delete the new walk state */ + + acpi_ds_terminate_control_method(next_walk_state); + acpi_ds_delete_walk_state(next_walk_state); return_ACPI_STATUS(status); } @@ -397,33 +362,25 @@ acpi_ds_restart_control_method(struct acpi_walk_state *walk_state, union acpi_operand_object *return_desc) { acpi_status status; - int same_as_implicit_return; - ACPI_FUNCTION_TRACE_PTR(ds_restart_control_method, walk_state); + ACPI_FUNCTION_TRACE_PTR("ds_restart_control_method", walk_state); ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, - "****Restart [%4.4s] Op %p ReturnValueFromCallee %p\n", + "****Restart [%4.4s] Op %p return_value_from_callee %p\n", (char *)&walk_state->method_node->name, walk_state->method_call_op, return_desc)); ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, - " ReturnFromThisMethodUsed?=%X ResStack %p Walk %p\n", + " return_from_this_method_used?=%X res_stack %p Walk %p\n", walk_state->return_used, walk_state->results, walk_state)); /* Did the called method return a value? */ if (return_desc) { - - /* Is the implicit return object the same as the return desc? */ - - same_as_implicit_return = - (walk_state->implicit_return_obj == return_desc); - /* Are we actually going to use the return value? */ if (walk_state->return_used) { - /* Save the return value from the previous method */ status = acpi_ds_result_push(return_desc, walk_state); @@ -440,23 +397,18 @@ acpi_ds_restart_control_method(struct acpi_walk_state *walk_state, } /* - * The following code is the optional support for the so-called - * "implicit return". Some AML code assumes that the last value of the - * method is "implicitly" returned to the caller, in the absence of an - * explicit return value. - * - * Just save the last result of the method as the return value. - * + * The following code is the + * optional support for a so-called "implicit return". Some AML code + * assumes that the last value of the method is "implicitly" returned + * to the caller. Just save the last result as the return value. * NOTE: this is optional because the ASL language does not actually * support this behavior. */ else if (!acpi_ds_do_implicit_return - (return_desc, walk_state, FALSE) - || same_as_implicit_return) { + (return_desc, walk_state, FALSE)) { /* * Delete the return value if it will not be used by the - * calling method or remove one reference if the explicit return - * is the same as the implicit return value. + * calling method */ acpi_ut_remove_reference(return_desc); } @@ -469,8 +421,7 @@ acpi_ds_restart_control_method(struct acpi_walk_state *walk_state, * * FUNCTION: acpi_ds_terminate_control_method * - * PARAMETERS: method_desc - Method object - * walk_state - State associated with the method + * PARAMETERS: walk_state - State of the method * * RETURN: None * @@ -480,100 +431,95 @@ acpi_ds_restart_control_method(struct acpi_walk_state *walk_state, * ******************************************************************************/ -void -acpi_ds_terminate_control_method(union acpi_operand_object *method_desc, - struct acpi_walk_state *walk_state) +void acpi_ds_terminate_control_method(struct acpi_walk_state *walk_state) { + union acpi_operand_object *obj_desc; struct acpi_namespace_node *method_node; acpi_status status; - ACPI_FUNCTION_TRACE_PTR(ds_terminate_control_method, walk_state); - - /* method_desc is required, walk_state is optional */ + ACPI_FUNCTION_TRACE_PTR("ds_terminate_control_method", walk_state); - if (!method_desc) { + if (!walk_state) { return_VOID; } - if (walk_state) { - - /* Delete all arguments and locals */ + /* The current method object was saved in the walk state */ - acpi_ds_method_data_delete_all(walk_state); + obj_desc = walk_state->method_desc; + if (!obj_desc) { + return_VOID; } + /* Delete all arguments and locals */ + + acpi_ds_method_data_delete_all(walk_state); + /* * Lock the parser while we terminate this method. * If this is the last thread executing the method, * we have additional cleanup to perform */ - status = acpi_ut_acquire_mutex(ACPI_MTX_CONTROL_METHOD); + status = acpi_ut_acquire_mutex(ACPI_MTX_PARSER); if (ACPI_FAILURE(status)) { return_VOID; } /* Signal completion of the execution of this method if necessary */ - if (method_desc->method.semaphore) { + if (walk_state->method_desc->method.semaphore) { status = - acpi_os_signal_semaphore(method_desc->method.semaphore, 1); + acpi_os_signal_semaphore(walk_state->method_desc->method. + semaphore, 1); if (ACPI_FAILURE(status)) { + ACPI_ERROR((AE_INFO, + "Could not signal method semaphore")); - /* Ignore error and continue */ - - ACPI_EXCEPTION((AE_INFO, status, - "Could not signal method semaphore")); + /* Ignore error and continue cleanup */ } } - if (walk_state) { - /* - * Delete any objects created by this method during execution. - * The method Node is stored in the walk state - */ - method_node = walk_state->method_node; - - /* Lock namespace for possible update */ - - status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE(status)) { - goto exit; - } + /* + * There are no more threads executing this method. Perform + * additional cleanup. + * + * The method Node is stored in the walk state + */ + method_node = walk_state->method_node; - /* - * Delete any namespace entries created immediately underneath - * the method - */ - if (method_node && method_node->child) { - acpi_ns_delete_namespace_subtree(method_node); - } + /* Lock namespace for possible update */ - /* - * Delete any namespace entries created anywhere else within - * the namespace by the execution of this method - */ - acpi_ns_delete_namespace_by_owner(method_desc->method.owner_id); - status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); + status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE(status)) { + goto exit; } - /* Decrement the thread count on the method */ - - if (method_desc->method.thread_count) { - method_desc->method.thread_count--; - } else { - ACPI_ERROR((AE_INFO, "Invalid zero thread count in method")); + /* + * Delete any namespace entries created immediately underneath + * the method + */ + if (method_node->child) { + acpi_ns_delete_namespace_subtree(method_node); } + /* + * Delete any namespace entries created anywhere else within + * the namespace by the execution of this method + */ + acpi_ns_delete_namespace_by_owner(walk_state->method_desc->method. + owner_id); + status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); + /* Are there any other threads currently executing this method? */ - if (method_desc->method.thread_count) { + if (walk_state->method_desc->method.thread_count) { /* * Additional threads. Do not release the owner_id in this case, * we immediately reuse it for the next thread executing this method */ ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "*** Completed execution of one thread, %d threads remaining\n", - method_desc->method.thread_count)); + walk_state->method_desc->method. + thread_count)); } else { /* This is the only executing thread for this method */ @@ -587,20 +533,22 @@ acpi_ds_terminate_control_method(union acpi_operand_object *method_desc, * This code is here because we must wait until the last thread exits * before creating the synchronization semaphore. */ - if ((method_desc->method.concurrency == 1) && - (!method_desc->method.semaphore)) { + if ((walk_state->method_desc->method.concurrency == 1) && + (!walk_state->method_desc->method.semaphore)) { status = acpi_os_create_semaphore(1, 1, - &method_desc->method. + &walk_state-> + method_desc->method. semaphore); } /* No more threads, we can free the owner_id */ - acpi_ut_release_owner_id(&method_desc->method.owner_id); + acpi_ut_release_owner_id(&walk_state->method_desc->method. + owner_id); } exit: - (void)acpi_ut_release_mutex(ACPI_MTX_CONTROL_METHOD); + (void)acpi_ut_release_mutex(ACPI_MTX_PARSER); return_VOID; } @@ -633,7 +581,7 @@ acpi_status acpi_ds_parse_method(struct acpi_namespace_node *node) union acpi_parse_object *op; struct acpi_walk_state *walk_state; - ACPI_FUNCTION_TRACE_PTR(ds_parse_method, node); + ACPI_FUNCTION_TRACE_PTR("ds_parse_method", node); /* Parameter Validation */ @@ -642,7 +590,7 @@ acpi_status acpi_ds_parse_method(struct acpi_namespace_node *node) } ACPI_DEBUG_PRINT((ACPI_DB_PARSE, - "**** Parsing [%4.4s] **** NamedObj=%p\n", + "**** Parsing [%4.4s] **** named_obj=%p\n", acpi_ut_get_node_name(node), node)); /* Extract the method object from the method Node */ @@ -721,7 +669,7 @@ acpi_status acpi_ds_parse_method(struct acpi_namespace_node *node) } ACPI_DEBUG_PRINT((ACPI_DB_PARSE, - "**** [%4.4s] Parsed **** NamedObj=%p Op=%p\n", + "**** [%4.4s] Parsed **** named_obj=%p Op=%p\n", acpi_ut_get_node_name(node), node, op)); /* diff --git a/trunk/drivers/acpi/dispatcher/dsmthdat.c b/trunk/drivers/acpi/dispatcher/dsmthdat.c index 459160ff9058..c025674f938b 100644 --- a/trunk/drivers/acpi/dispatcher/dsmthdat.c +++ b/trunk/drivers/acpi/dispatcher/dsmthdat.c @@ -81,7 +81,7 @@ acpi_ds_method_data_get_type(u16 opcode, * special data types. * * NOTES: walk_state fields are initialized to zero by the - * ACPI_ALLOCATE_ZEROED(). + * ACPI_MEM_CALLOCATE(). * * A pseudo-Namespace Node is assigned to each argument and local * so that ref_of() can return a pointer to the Node. @@ -92,7 +92,7 @@ void acpi_ds_method_data_init(struct acpi_walk_state *walk_state) { u32 i; - ACPI_FUNCTION_TRACE(ds_method_data_init); + ACPI_FUNCTION_TRACE("ds_method_data_init"); /* Init the method arguments */ @@ -100,10 +100,10 @@ void acpi_ds_method_data_init(struct acpi_walk_state *walk_state) ACPI_MOVE_32_TO_32(&walk_state->arguments[i].name, NAMEOF_ARG_NTE); walk_state->arguments[i].name.integer |= (i << 24); - walk_state->arguments[i].descriptor_type = ACPI_DESC_TYPE_NAMED; + walk_state->arguments[i].descriptor = ACPI_DESC_TYPE_NAMED; walk_state->arguments[i].type = ACPI_TYPE_ANY; - walk_state->arguments[i].flags = - ANOBJ_END_OF_PEER_LIST | ANOBJ_METHOD_ARG; + walk_state->arguments[i].flags = ANOBJ_END_OF_PEER_LIST | + ANOBJ_METHOD_ARG; } /* Init the method locals */ @@ -113,11 +113,11 @@ void acpi_ds_method_data_init(struct acpi_walk_state *walk_state) NAMEOF_LOCAL_NTE); walk_state->local_variables[i].name.integer |= (i << 24); - walk_state->local_variables[i].descriptor_type = + walk_state->local_variables[i].descriptor = ACPI_DESC_TYPE_NAMED; walk_state->local_variables[i].type = ACPI_TYPE_ANY; - walk_state->local_variables[i].flags = - ANOBJ_END_OF_PEER_LIST | ANOBJ_METHOD_LOCAL; + walk_state->local_variables[i].flags = ANOBJ_END_OF_PEER_LIST | + ANOBJ_METHOD_LOCAL; } return_VOID; @@ -140,7 +140,7 @@ void acpi_ds_method_data_delete_all(struct acpi_walk_state *walk_state) { u32 index; - ACPI_FUNCTION_TRACE(ds_method_data_delete_all); + ACPI_FUNCTION_TRACE("ds_method_data_delete_all"); /* Detach the locals */ @@ -199,7 +199,7 @@ acpi_ds_method_data_init_args(union acpi_operand_object **params, acpi_status status; u32 index = 0; - ACPI_FUNCTION_TRACE_PTR(ds_method_data_init_args, params); + ACPI_FUNCTION_TRACE_PTR("ds_method_data_init_args", params); if (!params) { ACPI_DEBUG_PRINT((ACPI_DB_EXEC, @@ -251,7 +251,7 @@ acpi_ds_method_data_get_node(u16 opcode, struct acpi_walk_state *walk_state, struct acpi_namespace_node **node) { - ACPI_FUNCTION_TRACE(ds_method_data_get_node); + ACPI_FUNCTION_TRACE("ds_method_data_get_node"); /* * Method Locals and Arguments are supported @@ -318,10 +318,10 @@ acpi_ds_method_data_set_value(u16 opcode, acpi_status status; struct acpi_namespace_node *node; - ACPI_FUNCTION_TRACE(ds_method_data_set_value); + ACPI_FUNCTION_TRACE("ds_method_data_set_value"); ACPI_DEBUG_PRINT((ACPI_DB_EXEC, - "NewObj %p Opcode %X, Refs=%d [%s]\n", object, + "new_obj %p Opcode %X, Refs=%d [%s]\n", object, opcode, object->common.reference_count, acpi_ut_get_type_name(object->common.type))); @@ -336,7 +336,7 @@ acpi_ds_method_data_set_value(u16 opcode, * Increment ref count so object can't be deleted while installed. * NOTE: We do not copy the object in order to preserve the call by * reference semantics of ACPI Control Method invocation. - * (See ACPI Specification 2.0_c) + * (See ACPI specification 2.0_c) */ acpi_ut_add_reference(object); @@ -351,7 +351,7 @@ acpi_ds_method_data_set_value(u16 opcode, * FUNCTION: acpi_ds_method_data_get_value * * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP - * Index - Which local_var or argument to get + * Index - which local_var or argument to get * walk_state - Current walk state object * dest_desc - Where Arg or Local value is returned * @@ -372,7 +372,7 @@ acpi_ds_method_data_get_value(u16 opcode, struct acpi_namespace_node *node; union acpi_operand_object *object; - ACPI_FUNCTION_TRACE(ds_method_data_get_value); + ACPI_FUNCTION_TRACE("ds_method_data_get_value"); /* Validate the object descriptor */ @@ -459,7 +459,7 @@ acpi_ds_method_data_get_value(u16 opcode, * FUNCTION: acpi_ds_method_data_delete_value * * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP - * Index - Which local_var or argument to delete + * Index - which local_var or argument to delete * walk_state - Current walk state object * * RETURN: None @@ -477,7 +477,7 @@ acpi_ds_method_data_delete_value(u16 opcode, struct acpi_namespace_node *node; union acpi_operand_object *object; - ACPI_FUNCTION_TRACE(ds_method_data_delete_value); + ACPI_FUNCTION_TRACE("ds_method_data_delete_value"); /* Get the namespace node for the arg/local */ @@ -538,7 +538,7 @@ acpi_ds_store_object_to_local(u16 opcode, union acpi_operand_object *current_obj_desc; union acpi_operand_object *new_obj_desc; - ACPI_FUNCTION_TRACE(ds_store_object_to_local); + ACPI_FUNCTION_TRACE("ds_store_object_to_local"); ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Opcode=%X Index=%d Obj=%p\n", opcode, index, obj_desc)); @@ -614,7 +614,7 @@ acpi_ds_store_object_to_local(u16 opcode, && (current_obj_desc->reference.opcode == AML_REF_OF_OP)) { ACPI_DEBUG_PRINT((ACPI_DB_EXEC, - "Arg (%p) is an ObjRef(Node), storing in node %p\n", + "Arg (%p) is an obj_ref(Node), storing in node %p\n", new_obj_desc, current_obj_desc)); @@ -688,7 +688,7 @@ acpi_ds_method_data_get_type(u16 opcode, struct acpi_namespace_node *node; union acpi_operand_object *object; - ACPI_FUNCTION_TRACE(ds_method_data_get_type); + ACPI_FUNCTION_TRACE("ds_method_data_get_type"); /* Get the namespace node for the arg/local */ @@ -701,7 +701,6 @@ acpi_ds_method_data_get_type(u16 opcode, object = acpi_ns_get_attached_object(node); if (!object) { - /* Uninitialized local/arg, return TYPE_ANY */ return_VALUE(ACPI_TYPE_ANY); diff --git a/trunk/drivers/acpi/dispatcher/dsobject.c b/trunk/drivers/acpi/dispatcher/dsobject.c index 72190abb1d59..8b21f0f9e517 100644 --- a/trunk/drivers/acpi/dispatcher/dsobject.c +++ b/trunk/drivers/acpi/dispatcher/dsobject.c @@ -81,7 +81,7 @@ acpi_ds_build_internal_object(struct acpi_walk_state *walk_state, union acpi_operand_object *obj_desc; acpi_status status; - ACPI_FUNCTION_TRACE(ds_build_internal_object); + ACPI_FUNCTION_TRACE("ds_build_internal_object"); *obj_desc_ptr = NULL; if (op->common.aml_opcode == AML_INT_NAMEPATH_OP) { @@ -103,7 +103,6 @@ acpi_ds_build_internal_object(struct acpi_walk_state *walk_state, common. node))); if (ACPI_FAILURE(status)) { - /* Check if we are resolving a named reference within a package */ if ((status == AE_NOT_FOUND) @@ -187,7 +186,7 @@ acpi_ds_build_internal_buffer_obj(struct acpi_walk_state *walk_state, union acpi_parse_object *byte_list; u32 byte_list_length = 0; - ACPI_FUNCTION_TRACE(ds_build_internal_buffer_obj); + ACPI_FUNCTION_TRACE("ds_build_internal_buffer_obj"); /* * If we are evaluating a Named buffer object "Name (xxxx, Buffer)". @@ -196,7 +195,6 @@ acpi_ds_build_internal_buffer_obj(struct acpi_walk_state *walk_state, */ obj_desc = *obj_desc_ptr; if (!obj_desc) { - /* Create a new buffer object */ obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_BUFFER); @@ -245,7 +243,7 @@ acpi_ds_build_internal_buffer_obj(struct acpi_walk_state *walk_state, "Buffer defined with zero length in AML, creating\n")); } else { obj_desc->buffer.pointer = - ACPI_ALLOCATE_ZEROED(obj_desc->buffer.length); + ACPI_MEM_CALLOCATE(obj_desc->buffer.length); if (!obj_desc->buffer.pointer) { acpi_ut_delete_object_desc(obj_desc); return_ACPI_STATUS(AE_NO_MEMORY); @@ -293,7 +291,7 @@ acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state, acpi_status status = AE_OK; acpi_native_uint i; - ACPI_FUNCTION_TRACE(ds_build_internal_package_obj); + ACPI_FUNCTION_TRACE("ds_build_internal_package_obj"); /* Find the parent of a possibly nested package */ @@ -341,10 +339,9 @@ acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state, * individual objects). Add an extra pointer slot so * that the list is always null terminated. */ - obj_desc->package.elements = ACPI_ALLOCATE_ZEROED(((acpi_size) - obj_desc->package. - count + - 1) * sizeof(void *)); + obj_desc->package.elements = ACPI_MEM_CALLOCATE(((acpi_size) obj_desc-> + package.count + + 1) * sizeof(void *)); if (!obj_desc->package.elements) { acpi_ut_delete_object_desc(obj_desc); @@ -358,7 +355,6 @@ acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state, arg = arg->common.next; for (i = 0; arg; i++) { if (arg->common.aml_opcode == AML_INT_RETURN_VALUE_OP) { - /* Object (package or buffer) is already built */ obj_desc->package.elements[i] = @@ -400,7 +396,7 @@ acpi_ds_create_node(struct acpi_walk_state *walk_state, acpi_status status; union acpi_operand_object *obj_desc; - ACPI_FUNCTION_TRACE_PTR(ds_create_node, op); + ACPI_FUNCTION_TRACE_PTR("ds_create_node", op); /* * Because of the execution pass through the non-control-method @@ -412,7 +408,6 @@ acpi_ds_create_node(struct acpi_walk_state *walk_state, } if (!op->common.value.arg) { - /* No arguments, there is nothing to do */ return_ACPI_STATUS(AE_OK); @@ -469,12 +464,11 @@ acpi_ds_init_object_from_op(struct acpi_walk_state *walk_state, union acpi_operand_object *obj_desc; acpi_status status = AE_OK; - ACPI_FUNCTION_TRACE(ds_init_object_from_op); + ACPI_FUNCTION_TRACE("ds_init_object_from_op"); obj_desc = *ret_obj_desc; op_info = acpi_ps_get_opcode_info(opcode); if (op_info->class == AML_CLASS_UNKNOWN) { - /* Unknown opcode */ return_ACPI_STATUS(AE_TYPE); @@ -632,7 +626,6 @@ acpi_ds_init_object_from_op(struct acpi_walk_state *walk_state, default: /* Other literals, etc.. */ if (op->common.aml_opcode == AML_INT_NAMEPATH_OP) { - /* Node was saved in Op */ obj_desc->reference.node = op->common.node; diff --git a/trunk/drivers/acpi/dispatcher/dsopcode.c b/trunk/drivers/acpi/dispatcher/dsopcode.c index 5b974a8fe614..6229c10674e1 100644 --- a/trunk/drivers/acpi/dispatcher/dsopcode.c +++ b/trunk/drivers/acpi/dispatcher/dsopcode.c @@ -91,7 +91,7 @@ acpi_ds_execute_arguments(struct acpi_namespace_node *node, union acpi_parse_object *op; struct acpi_walk_state *walk_state; - ACPI_FUNCTION_TRACE(ds_execute_arguments); + ACPI_FUNCTION_TRACE("ds_execute_arguments"); /* * Allocate a new parser op to be the root of the parsed tree @@ -193,7 +193,7 @@ acpi_ds_get_buffer_field_arguments(union acpi_operand_object *obj_desc) struct acpi_namespace_node *node; acpi_status status; - ACPI_FUNCTION_TRACE_PTR(ds_get_buffer_field_arguments, obj_desc); + ACPI_FUNCTION_TRACE_PTR("ds_get_buffer_field_arguments", obj_desc); if (obj_desc->common.flags & AOPOBJ_DATA_VALID) { return_ACPI_STATUS(AE_OK); @@ -206,7 +206,7 @@ acpi_ds_get_buffer_field_arguments(union acpi_operand_object *obj_desc) ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname (ACPI_TYPE_BUFFER_FIELD, node, NULL)); - ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "[%4.4s] BufferField Arg Init\n", + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "[%4.4s] buffer_field Arg Init\n", acpi_ut_get_node_name(node))); /* Execute the AML code for the term_arg arguments */ @@ -235,7 +235,7 @@ acpi_status acpi_ds_get_buffer_arguments(union acpi_operand_object *obj_desc) struct acpi_namespace_node *node; acpi_status status; - ACPI_FUNCTION_TRACE_PTR(ds_get_buffer_arguments, obj_desc); + ACPI_FUNCTION_TRACE_PTR("ds_get_buffer_arguments", obj_desc); if (obj_desc->common.flags & AOPOBJ_DATA_VALID) { return_ACPI_STATUS(AE_OK); @@ -279,7 +279,7 @@ acpi_status acpi_ds_get_package_arguments(union acpi_operand_object *obj_desc) struct acpi_namespace_node *node; acpi_status status; - ACPI_FUNCTION_TRACE_PTR(ds_get_package_arguments, obj_desc); + ACPI_FUNCTION_TRACE_PTR("ds_get_package_arguments", obj_desc); if (obj_desc->common.flags & AOPOBJ_DATA_VALID) { return_ACPI_STATUS(AE_OK); @@ -324,7 +324,7 @@ acpi_status acpi_ds_get_region_arguments(union acpi_operand_object *obj_desc) acpi_status status; union acpi_operand_object *extra_desc; - ACPI_FUNCTION_TRACE_PTR(ds_get_region_arguments, obj_desc); + ACPI_FUNCTION_TRACE_PTR("ds_get_region_arguments", obj_desc); if (obj_desc->region.flags & AOPOBJ_DATA_VALID) { return_ACPI_STATUS(AE_OK); @@ -342,7 +342,8 @@ acpi_status acpi_ds_get_region_arguments(union acpi_operand_object *obj_desc) ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname (ACPI_TYPE_REGION, node, NULL)); - ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "[%4.4s] OpRegion Arg Init at AML %p\n", + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, + "[%4.4s] op_region Arg Init at AML %p\n", acpi_ut_get_node_name(node), extra_desc->extra.aml_start)); @@ -351,28 +352,6 @@ acpi_status acpi_ds_get_region_arguments(union acpi_operand_object *obj_desc) status = acpi_ds_execute_arguments(node, acpi_ns_get_parent_node(node), extra_desc->extra.aml_length, extra_desc->extra.aml_start); - if (ACPI_FAILURE(status)) { - return_ACPI_STATUS(status); - } - - /* Validate the region address/length via the host OS */ - - status = acpi_os_validate_address(obj_desc->region.space_id, - obj_desc->region.address, - (acpi_size) obj_desc->region.length); - if (ACPI_FAILURE(status)) { - /* - * Invalid address/length. We will emit an error message and mark - * the region as invalid, so that it will cause an additional error if - * it is ever used. Then return AE_OK. - */ - ACPI_EXCEPTION((AE_INFO, status, - "During address validation of OpRegion [%4.4s]", - node->name.ascii)); - obj_desc->common.flags |= AOPOBJ_INVALID; - status = AE_OK; - } - return_ACPI_STATUS(status); } @@ -432,7 +411,7 @@ acpi_ds_init_buffer_field(u16 aml_opcode, u8 field_flags; acpi_status status; - ACPI_FUNCTION_TRACE_PTR(ds_init_buffer_field, obj_desc); + ACPI_FUNCTION_TRACE_PTR("ds_init_buffer_field", obj_desc); /* Host object must be a Buffer */ @@ -478,7 +457,7 @@ acpi_ds_init_buffer_field(u16 aml_opcode, if (bit_count == 0) { ACPI_ERROR((AE_INFO, - "Attempt to CreateField of length zero")); + "Attempt to create_field of length zero")); status = AE_AML_OPERAND_VALUE; goto cleanup; } @@ -616,7 +595,7 @@ acpi_ds_eval_buffer_field_operands(struct acpi_walk_state *walk_state, struct acpi_namespace_node *node; union acpi_parse_object *next_op; - ACPI_FUNCTION_TRACE_PTR(ds_eval_buffer_field_operands, op); + ACPI_FUNCTION_TRACE_PTR("ds_eval_buffer_field_operands", op); /* * This is where we evaluate the address and length fields of the @@ -648,7 +627,7 @@ acpi_ds_eval_buffer_field_operands(struct acpi_walk_state *walk_state, ACPI_DUMP_OPERANDS(ACPI_WALK_OPERANDS, ACPI_IMODE_EXECUTE, acpi_ps_get_opcode_name(op->common.aml_opcode), walk_state->num_operands, - "after AcpiExResolveOperands"); + "after acpi_ex_resolve_operands"); if (ACPI_FAILURE(status)) { ACPI_ERROR((AE_INFO, "(%s) bad operand(s) (%X)", @@ -661,7 +640,6 @@ acpi_ds_eval_buffer_field_operands(struct acpi_walk_state *walk_state, /* Initialize the Buffer Field */ if (op->common.aml_opcode == AML_CREATE_FIELD_OP) { - /* NOTE: Slightly different operands for this opcode */ status = @@ -707,7 +685,7 @@ acpi_ds_eval_region_operands(struct acpi_walk_state *walk_state, struct acpi_namespace_node *node; union acpi_parse_object *next_op; - ACPI_FUNCTION_TRACE_PTR(ds_eval_region_operands, op); + ACPI_FUNCTION_TRACE_PTR("ds_eval_region_operands", op); /* * This is where we evaluate the address and length fields of the @@ -740,7 +718,7 @@ acpi_ds_eval_region_operands(struct acpi_walk_state *walk_state, ACPI_DUMP_OPERANDS(ACPI_WALK_OPERANDS, ACPI_IMODE_EXECUTE, acpi_ps_get_opcode_name(op->common.aml_opcode), - 1, "after AcpiExResolveOperands"); + 1, "after acpi_ex_resolve_operands"); obj_desc = acpi_ns_get_attached_object(node); if (!obj_desc) { @@ -766,7 +744,7 @@ acpi_ds_eval_region_operands(struct acpi_walk_state *walk_state, operand_desc->integer.value; acpi_ut_remove_reference(operand_desc); - ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "RgnObj %p Addr %8.8X%8.8X Len %X\n", + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "rgn_obj %p Addr %8.8X%8.8X Len %X\n", obj_desc, ACPI_FORMAT_UINT64(obj_desc->region.address), obj_desc->region.length)); @@ -802,7 +780,7 @@ acpi_ds_eval_data_object_operands(struct acpi_walk_state *walk_state, union acpi_operand_object *arg_desc; u32 length; - ACPI_FUNCTION_TRACE(ds_eval_data_object_operands); + ACPI_FUNCTION_TRACE("ds_eval_data_object_operands"); /* The first operand (for all of these data objects) is the length */ @@ -896,7 +874,7 @@ acpi_ds_exec_begin_control_op(struct acpi_walk_state *walk_state, acpi_status status = AE_OK; union acpi_generic_state *control_state; - ACPI_FUNCTION_NAME(ds_exec_begin_control_op); + ACPI_FUNCTION_NAME("ds_exec_begin_control_op"); ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Op=%p Opcode=%2.2X State=%p\n", op, op->common.aml_opcode, walk_state)); @@ -974,7 +952,7 @@ acpi_ds_exec_end_control_op(struct acpi_walk_state * walk_state, acpi_status status = AE_OK; union acpi_generic_state *control_state; - ACPI_FUNCTION_NAME(ds_exec_end_control_op); + ACPI_FUNCTION_NAME("ds_exec_end_control_op"); switch (op->common.aml_opcode) { case AML_IF_OP: @@ -1006,7 +984,6 @@ acpi_ds_exec_end_control_op(struct acpi_walk_state * walk_state, ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "[WHILE_OP] Op=%p\n", op)); if (walk_state->control_state->common.value) { - /* Predicate was true, go back and evaluate it again! */ status = AE_CTRL_PENDING; @@ -1037,7 +1014,6 @@ acpi_ds_exec_end_control_op(struct acpi_walk_state * walk_state, * has been bubbled up the tree */ if (op->common.value.arg) { - /* Since we have a real Return(), delete any implicit return */ acpi_ds_clear_implicit_return(walk_state); @@ -1071,7 +1047,6 @@ acpi_ds_exec_end_control_op(struct acpi_walk_state * walk_state, walk_state->return_desc = walk_state->operands[0]; } else if ((walk_state->results) && (walk_state->results->results.num_results > 0)) { - /* Since we have a real Return(), delete any implicit return */ acpi_ds_clear_implicit_return(walk_state); @@ -1120,7 +1095,7 @@ acpi_ds_exec_end_control_op(struct acpi_walk_state * walk_state, } ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, - "Completed RETURN_OP State=%p, RetVal=%p\n", + "Completed RETURN_OP State=%p, ret_val=%p\n", walk_state, walk_state->return_desc)); /* End the control method execution right now */ diff --git a/trunk/drivers/acpi/dispatcher/dsutils.c b/trunk/drivers/acpi/dispatcher/dsutils.c index 05230baf5de8..53356a591ac1 100644 --- a/trunk/drivers/acpi/dispatcher/dsutils.c +++ b/trunk/drivers/acpi/dispatcher/dsutils.c @@ -68,7 +68,7 @@ ACPI_MODULE_NAME("dsutils") ******************************************************************************/ void acpi_ds_clear_implicit_return(struct acpi_walk_state *walk_state) { - ACPI_FUNCTION_NAME(ds_clear_implicit_return); + ACPI_FUNCTION_NAME("ds_clear_implicit_return"); /* * Slack must be enabled for this feature @@ -115,7 +115,7 @@ u8 acpi_ds_do_implicit_return(union acpi_operand_object *return_desc, struct acpi_walk_state *walk_state, u8 add_reference) { - ACPI_FUNCTION_NAME(ds_do_implicit_return); + ACPI_FUNCTION_NAME("ds_do_implicit_return"); /* * Slack must be enabled for this feature, and we must @@ -171,7 +171,7 @@ acpi_ds_is_result_used(union acpi_parse_object * op, { const struct acpi_opcode_info *parent_info; - ACPI_FUNCTION_TRACE_PTR(ds_is_result_used, op); + ACPI_FUNCTION_TRACE_PTR("ds_is_result_used", op); /* Must have both an Op and a Result Object */ @@ -202,7 +202,6 @@ acpi_ds_is_result_used(union acpi_parse_object * op, */ if ((!op->common.parent) || (op->common.parent->common.aml_opcode == AML_SCOPE_OP)) { - /* No parent, the return value cannot possibly be used */ ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, @@ -341,7 +340,7 @@ acpi_ds_delete_result_if_not_used(union acpi_parse_object *op, union acpi_operand_object *obj_desc; acpi_status status; - ACPI_FUNCTION_TRACE_PTR(ds_delete_result_if_not_used, result_obj); + ACPI_FUNCTION_TRACE_PTR("ds_delete_result_if_not_used", result_obj); if (!op) { ACPI_ERROR((AE_INFO, "Null Op")); @@ -353,7 +352,6 @@ acpi_ds_delete_result_if_not_used(union acpi_parse_object *op, } if (!acpi_ds_is_result_used(op, walk_state)) { - /* Must pop the result stack (obj_desc should be equal to result_obj) */ status = acpi_ds_result_pop(&obj_desc, walk_state); @@ -384,7 +382,7 @@ acpi_status acpi_ds_resolve_operands(struct acpi_walk_state *walk_state) u32 i; acpi_status status = AE_OK; - ACPI_FUNCTION_TRACE_PTR(ds_resolve_operands, walk_state); + ACPI_FUNCTION_TRACE_PTR("ds_resolve_operands", walk_state); /* * Attempt to resolve each of the valid operands @@ -419,7 +417,7 @@ void acpi_ds_clear_operands(struct acpi_walk_state *walk_state) { u32 i; - ACPI_FUNCTION_TRACE_PTR(ds_clear_operands, walk_state); + ACPI_FUNCTION_TRACE_PTR("ds_clear_operands", walk_state); /* Remove a reference on each operand on the stack */ @@ -467,7 +465,7 @@ acpi_ds_create_operand(struct acpi_walk_state *walk_state, acpi_interpreter_mode interpreter_mode; const struct acpi_opcode_info *op_info; - ACPI_FUNCTION_TRACE_PTR(ds_create_operand, arg); + ACPI_FUNCTION_TRACE_PTR("ds_create_operand", arg); /* A valid name must be looked up in the namespace */ @@ -500,9 +498,7 @@ acpi_ds_create_operand(struct acpi_walk_state *walk_state, */ if ((walk_state->deferred_node) && (walk_state->deferred_node->type == ACPI_TYPE_BUFFER_FIELD) - && (arg_index == - (u32) ((walk_state->opcode == - AML_CREATE_FIELD_OP) ? 3 : 2))) { + && (arg_index != 0)) { obj_desc = ACPI_CAST_PTR(union acpi_operand_object, walk_state->deferred_node); @@ -525,7 +521,6 @@ acpi_ds_create_operand(struct acpi_walk_state *walk_state, && (parent_op->common.aml_opcode != AML_REGION_OP) && (parent_op->common.aml_opcode != AML_INT_NAMEPATH_OP)) { - /* Enter name into namespace if not found */ interpreter_mode = ACPI_IMODE_LOAD_PASS2; @@ -577,7 +572,7 @@ acpi_ds_create_operand(struct acpi_walk_state *walk_state, /* Free the namestring created above */ - ACPI_FREE(name_string); + ACPI_MEM_FREE(name_string); /* Check status from the lookup */ @@ -701,7 +696,7 @@ acpi_ds_create_operands(struct acpi_walk_state *walk_state, union acpi_parse_object *arg; u32 arg_count = 0; - ACPI_FUNCTION_TRACE_PTR(ds_create_operands, first_arg); + ACPI_FUNCTION_TRACE_PTR("ds_create_operands", first_arg); /* For all arguments in the list... */ diff --git a/trunk/drivers/acpi/dispatcher/dswexec.c b/trunk/drivers/acpi/dispatcher/dswexec.c index 3acbd9145d72..f1af655ff113 100644 --- a/trunk/drivers/acpi/dispatcher/dswexec.c +++ b/trunk/drivers/acpi/dispatcher/dswexec.c @@ -49,6 +49,7 @@ #include #include #include +#include #define _COMPONENT ACPI_DISPATCHER ACPI_MODULE_NAME("dswexec") @@ -92,7 +93,7 @@ acpi_ds_get_predicate_value(struct acpi_walk_state *walk_state, union acpi_operand_object *obj_desc; union acpi_operand_object *local_obj_desc = NULL; - ACPI_FUNCTION_TRACE_PTR(ds_get_predicate_value, walk_state); + ACPI_FUNCTION_TRACE_PTR("ds_get_predicate_value", walk_state); walk_state->control_state->common.state = 0; @@ -122,7 +123,7 @@ acpi_ds_get_predicate_value(struct acpi_walk_state *walk_state, if (!obj_desc) { ACPI_ERROR((AE_INFO, - "No predicate ObjDesc=%p State=%p", + "No predicate obj_desc=%p State=%p", obj_desc, walk_state)); return_ACPI_STATUS(AE_AML_NO_OPERAND); @@ -139,7 +140,7 @@ acpi_ds_get_predicate_value(struct acpi_walk_state *walk_state, if (ACPI_GET_OBJECT_TYPE(local_obj_desc) != ACPI_TYPE_INTEGER) { ACPI_ERROR((AE_INFO, - "Bad predicate (not an integer) ObjDesc=%p State=%p Type=%X", + "Bad predicate (not an integer) obj_desc=%p State=%p Type=%X", obj_desc, walk_state, ACPI_GET_OBJECT_TYPE(obj_desc))); @@ -213,7 +214,7 @@ acpi_ds_exec_begin_op(struct acpi_walk_state *walk_state, acpi_status status = AE_OK; u32 opcode_class; - ACPI_FUNCTION_TRACE_PTR(ds_exec_begin_op, walk_state); + ACPI_FUNCTION_TRACE_PTR("ds_exec_begin_op", walk_state); op = walk_state->op; if (!op) { @@ -295,7 +296,7 @@ acpi_ds_exec_begin_op(struct acpi_walk_state *walk_state, case AML_CLASS_NAMED_OBJECT: - if (walk_state->walk_type & ACPI_WALK_METHOD) { + if (walk_state->walk_type == ACPI_WALK_METHOD) { /* * Found a named object declaration during method execution; * we must enter this object into the namespace. The created @@ -353,7 +354,7 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) union acpi_parse_object *next_op; union acpi_parse_object *first_arg; - ACPI_FUNCTION_TRACE_PTR(ds_exec_end_op, walk_state); + ACPI_FUNCTION_TRACE_PTR("ds_exec_end_op", walk_state); op = walk_state->op; op_type = walk_state->op_info->type; @@ -408,7 +409,6 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) * being the object_type and size_of operators. */ if (!(walk_state->op_info->flags & AML_NO_OPERAND_RESOLVE)) { - /* Resolve all operands */ status = acpi_ex_resolve_operands(walk_state->opcode, @@ -423,7 +423,7 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) acpi_ps_get_opcode_name (walk_state->opcode), walk_state->num_operands, - "after ExResolveOperands"); + "after ex_resolve_operands"); } } @@ -437,7 +437,7 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) acpi_gbl_op_type_dispatch[op_type] (walk_state); } else { /* - * Treat constructs of the form "Store(LocalX,LocalX)" as noops when the + * Treat constructs of the form "Store(local_x,local_x)" as noops when the * Local is uninitialized. */ if ((status == AE_AML_UNINITIALIZED_LOCAL) && @@ -548,7 +548,6 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) */ status = acpi_ds_resolve_operands(walk_state); if (ACPI_FAILURE(status)) { - /* On error, clear all resolved operands */ acpi_ds_clear_operands(walk_state); @@ -570,7 +569,7 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) case AML_TYPE_CREATE_FIELD: ACPI_DEBUG_PRINT((ACPI_DB_EXEC, - "Executing CreateField Buffer/Index Op=%p\n", + "Executing create_field Buffer/Index Op=%p\n", op)); status = acpi_ds_load2_end_op(walk_state); @@ -585,7 +584,7 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) case AML_TYPE_CREATE_OBJECT: ACPI_DEBUG_PRINT((ACPI_DB_EXEC, - "Executing CreateObject (Buffer/Package) Op=%p\n", + "Executing create_object (Buffer/Package) Op=%p\n", op)); switch (op->common.parent->common.aml_opcode) { @@ -658,7 +657,7 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) if (op->common.aml_opcode == AML_REGION_OP) { ACPI_DEBUG_PRINT((ACPI_DB_EXEC, - "Executing OpRegion Address/Length Op=%p\n", + "Executing op_region Address/Length Op=%p\n", op)); status = @@ -723,7 +722,6 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) cleanup: if (walk_state->result_obj) { - /* Break to debugger to display result */ ACPI_DEBUGGER_EXEC(acpi_db_display_result_object diff --git a/trunk/drivers/acpi/dispatcher/dswload.c b/trunk/drivers/acpi/dispatcher/dswload.c index 35074399c617..d3d24da31c81 100644 --- a/trunk/drivers/acpi/dispatcher/dswload.c +++ b/trunk/drivers/acpi/dispatcher/dswload.c @@ -127,7 +127,7 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state, char *path; u32 flags; - ACPI_FUNCTION_TRACE(ds_load1_begin_op); + ACPI_FUNCTION_TRACE("ds_load1_begin_op"); op = walk_state->op; ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op, @@ -178,12 +178,12 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state, * Target of Scope() not found. Generate an External for it, and * insert the name into the namespace. */ - acpi_dm_add_to_external_list(path, ACPI_TYPE_DEVICE, 0); + acpi_dm_add_to_external_list(path); status = acpi_ns_lookup(walk_state->scope_info, path, object_type, ACPI_IMODE_LOAD_PASS1, ACPI_NS_SEARCH_PARENT, walk_state, - &node); + &(node)); } #endif if (ACPI_FAILURE(status)) { @@ -261,7 +261,6 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state, */ if (walk_state->deferred_node) { - /* This name is already in the namespace, get the node */ node = walk_state->deferred_node; @@ -301,41 +300,10 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state, status = acpi_ns_lookup(walk_state->scope_info, path, object_type, ACPI_IMODE_LOAD_PASS1, flags, walk_state, - &node); + &(node)); if (ACPI_FAILURE(status)) { - if (status == AE_ALREADY_EXISTS) { - - /* The name already exists in this scope */ - - if (node->flags & ANOBJ_IS_EXTERNAL) { - /* - * Allow one create on an object or segment that was - * previously declared External - */ - node->flags &= ~ANOBJ_IS_EXTERNAL; - node->type = (u8) object_type; - - /* Just retyped a node, probably will need to open a scope */ - - if (acpi_ns_opens_scope(object_type)) { - status = - acpi_ds_scope_stack_push - (node, object_type, - walk_state); - if (ACPI_FAILURE(status)) { - return_ACPI_STATUS - (status); - } - } - status = AE_OK; - } - } - - if (ACPI_FAILURE(status)) { - - ACPI_ERROR_NAMESPACE(path, status); - return_ACPI_STATUS(status); - } + ACPI_ERROR_NAMESPACE(path, status); + return_ACPI_STATUS(status); } break; } @@ -343,7 +311,6 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state, /* Common exit */ if (!op) { - /* Create a new op */ op = acpi_ps_alloc_op(walk_state->opcode); @@ -392,7 +359,7 @@ acpi_status acpi_ds_load1_end_op(struct acpi_walk_state *walk_state) acpi_object_type object_type; acpi_status status = AE_OK; - ACPI_FUNCTION_TRACE(ds_load1_end_op); + ACPI_FUNCTION_TRACE("ds_load1_end_op"); op = walk_state->op; ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op, @@ -446,7 +413,6 @@ acpi_status acpi_ds_load1_end_op(struct acpi_walk_state *walk_state) #endif if (op->common.aml_opcode == AML_NAME_OP) { - /* For Name opcode, get the object type from the argument */ if (op->common.value.arg) { @@ -479,7 +445,7 @@ acpi_status acpi_ds_load1_end_op(struct acpi_walk_state *walk_state) * arguments.) */ ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, - "LOADING-Method: State=%p Op=%p NamedObj=%p\n", + "LOADING-Method: State=%p Op=%p named_obj=%p\n", walk_state, op, op->named.node)); if (!acpi_ns_get_attached_object(op->named.node)) { @@ -545,7 +511,7 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state, acpi_object_type object_type; char *buffer_ptr; - ACPI_FUNCTION_TRACE(ds_load2_begin_op); + ACPI_FUNCTION_TRACE("ds_load2_begin_op"); op = walk_state->op; ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op, @@ -555,7 +521,6 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state, if ((walk_state->control_state) && (walk_state->control_state->common.state == ACPI_CONTROL_CONDITIONAL_EXECUTING)) { - /* We are executing a while loop outside of a method */ status = acpi_ds_exec_begin_op(walk_state, out_op); @@ -589,12 +554,10 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state, /* Get the name we are going to enter or lookup in the namespace */ if (walk_state->opcode == AML_INT_NAMEPATH_OP) { - /* For Namepath op, get the path string */ buffer_ptr = op->common.value.string; if (!buffer_ptr) { - /* No name, just exit */ return_ACPI_STATUS(AE_OK); @@ -717,7 +680,6 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state, /* All other opcodes */ if (op && op->common.node) { - /* This op/node was previously entered into the namespace */ node = op->common.node; @@ -743,7 +705,6 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state, * Note: Name may already exist if we are executing a deferred opcode. */ if (walk_state->deferred_node) { - /* This name is already in the namespace, get the node */ node = walk_state->deferred_node; @@ -766,7 +727,6 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state, } if (!op) { - /* Create a new op */ op = acpi_ps_alloc_op(walk_state->opcode); @@ -816,7 +776,7 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state) u32 i; #endif - ACPI_FUNCTION_TRACE(ds_load2_end_op); + ACPI_FUNCTION_TRACE("ds_load2_end_op"); op = walk_state->op; ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Opcode [%s] Op %p State %p\n", @@ -910,7 +870,7 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state) */ ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, - "Create-Load [%s] State=%p Op=%p NamedObj=%p\n", + "Create-Load [%s] State=%p Op=%p named_obj=%p\n", acpi_ps_get_opcode_name(op->common.aml_opcode), walk_state, op, node)); @@ -1085,7 +1045,7 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state) * arguments.) */ ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, - "LOADING-Method: State=%p Op=%p NamedObj=%p\n", + "LOADING-Method: State=%p Op=%p named_obj=%p\n", walk_state, op, op->named.node)); if (!acpi_ns_get_attached_object(op->named.node)) { @@ -1130,7 +1090,7 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state) case AML_CLASS_METHOD_CALL: ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, - "RESOLVING-MethodCall: State=%p Op=%p NamedObj=%p\n", + "RESOLVING-method_call: State=%p Op=%p named_obj=%p\n", walk_state, op, node)); /* @@ -1144,6 +1104,7 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state) ACPI_NS_DONT_OPEN_SCOPE, walk_state, &(new_node)); if (ACPI_SUCCESS(status)) { + /* * Make sure that what we found is indeed a method * We didn't search for a method on purpose, to see if the name diff --git a/trunk/drivers/acpi/dispatcher/dswscope.c b/trunk/drivers/acpi/dispatcher/dswscope.c index c9228972f5f6..ada21ef4a174 100644 --- a/trunk/drivers/acpi/dispatcher/dswscope.c +++ b/trunk/drivers/acpi/dispatcher/dswscope.c @@ -63,10 +63,9 @@ void acpi_ds_scope_stack_clear(struct acpi_walk_state *walk_state) { union acpi_generic_state *scope_info; - ACPI_FUNCTION_NAME(ds_scope_stack_clear); + ACPI_FUNCTION_NAME("ds_scope_stack_clear"); while (walk_state->scope_info) { - /* Pop a scope off the stack */ scope_info = walk_state->scope_info; @@ -103,10 +102,9 @@ acpi_ds_scope_stack_push(struct acpi_namespace_node *node, union acpi_generic_state *scope_info; union acpi_generic_state *old_scope_info; - ACPI_FUNCTION_TRACE(ds_scope_stack_push); + ACPI_FUNCTION_TRACE("ds_scope_stack_push"); if (!node) { - /* Invalid scope */ ACPI_ERROR((AE_INFO, "Null scope parameter")); @@ -128,7 +126,7 @@ acpi_ds_scope_stack_push(struct acpi_namespace_node *node, /* Init new scope object */ - scope_info->common.descriptor_type = ACPI_DESC_TYPE_STATE_WSCOPE; + scope_info->common.data_type = ACPI_DESC_TYPE_STATE_WSCOPE; scope_info->scope.node = node; scope_info->common.value = (u16) type; @@ -178,7 +176,7 @@ acpi_status acpi_ds_scope_stack_pop(struct acpi_walk_state *walk_state) union acpi_generic_state *scope_info; union acpi_generic_state *new_scope_info; - ACPI_FUNCTION_TRACE(ds_scope_stack_pop); + ACPI_FUNCTION_TRACE("ds_scope_stack_pop"); /* * Pop scope info object off the stack. diff --git a/trunk/drivers/acpi/dispatcher/dswstate.c b/trunk/drivers/acpi/dispatcher/dswstate.c index 7817e5522679..fa78cb74ee36 100644 --- a/trunk/drivers/acpi/dispatcher/dswstate.c +++ b/trunk/drivers/acpi/dispatcher/dswstate.c @@ -66,6 +66,7 @@ void *acpi_ds_obj_stack_get_value(u32 index, #endif #ifdef ACPI_FUTURE_USAGE + /******************************************************************************* * * FUNCTION: acpi_ds_result_remove @@ -87,7 +88,7 @@ acpi_ds_result_remove(union acpi_operand_object **object, { union acpi_generic_state *state; - ACPI_FUNCTION_NAME(ds_result_remove); + ACPI_FUNCTION_NAME("ds_result_remove"); state = walk_state->results; if (!state) { @@ -127,6 +128,7 @@ acpi_ds_result_remove(union acpi_operand_object **object, return (AE_OK); } + #endif /* ACPI_FUTURE_USAGE */ /******************************************************************************* @@ -150,7 +152,7 @@ acpi_ds_result_pop(union acpi_operand_object ** object, acpi_native_uint index; union acpi_generic_state *state; - ACPI_FUNCTION_NAME(ds_result_pop); + ACPI_FUNCTION_NAME("ds_result_pop"); state = walk_state->results; if (!state) { @@ -168,7 +170,6 @@ acpi_ds_result_pop(union acpi_operand_object ** object, state->results.num_results--; for (index = ACPI_OBJ_NUM_OPERANDS; index; index--) { - /* Check for a valid result object */ if (state->results.obj_desc[index - 1]) { @@ -212,7 +213,7 @@ acpi_ds_result_pop_from_bottom(union acpi_operand_object ** object, acpi_native_uint index; union acpi_generic_state *state; - ACPI_FUNCTION_NAME(ds_result_pop_from_bottom); + ACPI_FUNCTION_NAME("ds_result_pop_from_bottom"); state = walk_state->results; if (!state) { @@ -277,7 +278,7 @@ acpi_ds_result_push(union acpi_operand_object * object, { union acpi_generic_state *state; - ACPI_FUNCTION_NAME(ds_result_push); + ACPI_FUNCTION_NAME("ds_result_push"); state = walk_state->results; if (!state) { @@ -330,14 +331,14 @@ acpi_status acpi_ds_result_stack_push(struct acpi_walk_state * walk_state) { union acpi_generic_state *state; - ACPI_FUNCTION_NAME(ds_result_stack_push); + ACPI_FUNCTION_NAME("ds_result_stack_push"); state = acpi_ut_create_generic_state(); if (!state) { return (AE_NO_MEMORY); } - state->common.descriptor_type = ACPI_DESC_TYPE_STATE_RESULT; + state->common.data_type = ACPI_DESC_TYPE_STATE_RESULT; acpi_ut_push_generic_state(&walk_state->results, state); ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Results=%p State=%p\n", @@ -362,7 +363,7 @@ acpi_status acpi_ds_result_stack_pop(struct acpi_walk_state * walk_state) { union acpi_generic_state *state; - ACPI_FUNCTION_NAME(ds_result_stack_pop); + ACPI_FUNCTION_NAME("ds_result_stack_pop"); /* Check for stack underflow */ @@ -375,7 +376,7 @@ acpi_status acpi_ds_result_stack_pop(struct acpi_walk_state * walk_state) state = acpi_ut_pop_generic_state(&walk_state->results); ACPI_DEBUG_PRINT((ACPI_DB_EXEC, - "Result=%p RemainingResults=%X State=%p\n", + "Result=%p remaining_results=%X State=%p\n", state, state->results.num_results, walk_state)); acpi_ut_delete_generic_state(state); @@ -399,7 +400,7 @@ acpi_status acpi_ds_result_stack_pop(struct acpi_walk_state * walk_state) acpi_status acpi_ds_obj_stack_push(void *object, struct acpi_walk_state * walk_state) { - ACPI_FUNCTION_NAME(ds_obj_stack_push); + ACPI_FUNCTION_NAME("ds_obj_stack_push"); /* Check for stack overflow */ @@ -444,10 +445,9 @@ acpi_ds_obj_stack_pop(u32 pop_count, struct acpi_walk_state * walk_state) { u32 i; - ACPI_FUNCTION_NAME(ds_obj_stack_pop); + ACPI_FUNCTION_NAME("ds_obj_stack_pop"); for (i = 0; i < pop_count; i++) { - /* Check for stack underflow */ if (walk_state->num_operands == 0) { @@ -491,10 +491,9 @@ acpi_ds_obj_stack_pop_and_delete(u32 pop_count, u32 i; union acpi_operand_object *obj_desc; - ACPI_FUNCTION_NAME(ds_obj_stack_pop_and_delete); + ACPI_FUNCTION_NAME("ds_obj_stack_pop_and_delete"); for (i = 0; i < pop_count; i++) { - /* Check for stack underflow */ if (walk_state->num_operands == 0) { @@ -539,13 +538,13 @@ acpi_ds_obj_stack_pop_and_delete(u32 pop_count, struct acpi_walk_state *acpi_ds_get_current_walk_state(struct acpi_thread_state *thread) { - ACPI_FUNCTION_NAME(ds_get_current_walk_state); + ACPI_FUNCTION_NAME("ds_get_current_walk_state"); if (!thread) { return (NULL); } - ACPI_DEBUG_PRINT((ACPI_DB_PARSE, "Current WalkState %p\n", + ACPI_DEBUG_PRINT((ACPI_DB_PARSE, "Current walk_state %p\n", thread->walk_state_list)); return (thread->walk_state_list); @@ -568,7 +567,7 @@ void acpi_ds_push_walk_state(struct acpi_walk_state *walk_state, struct acpi_thread_state *thread) { - ACPI_FUNCTION_TRACE(ds_push_walk_state); + ACPI_FUNCTION_TRACE("ds_push_walk_state"); walk_state->next = thread->walk_state_list; thread->walk_state_list = walk_state; @@ -594,12 +593,11 @@ struct acpi_walk_state *acpi_ds_pop_walk_state(struct acpi_thread_state *thread) { struct acpi_walk_state *walk_state; - ACPI_FUNCTION_TRACE(ds_pop_walk_state); + ACPI_FUNCTION_TRACE("ds_pop_walk_state"); walk_state = thread->walk_state_list; if (walk_state) { - /* Next walk state becomes the current walk state */ thread->walk_state_list = walk_state->next; @@ -620,7 +618,7 @@ struct acpi_walk_state *acpi_ds_pop_walk_state(struct acpi_thread_state *thread) * * PARAMETERS: owner_id - ID for object creation * Origin - Starting point for this walk - * method_desc - Method object + * mth_desc - Method object * Thread - Current thread state * * RETURN: Pointer to the new walk state. @@ -634,24 +632,24 @@ struct acpi_walk_state *acpi_ds_create_walk_state(acpi_owner_id owner_id, union acpi_parse_object *origin, union acpi_operand_object - *method_desc, + *mth_desc, struct acpi_thread_state *thread) { struct acpi_walk_state *walk_state; acpi_status status; - ACPI_FUNCTION_TRACE(ds_create_walk_state); + ACPI_FUNCTION_TRACE("ds_create_walk_state"); - walk_state = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_walk_state)); + walk_state = ACPI_MEM_CALLOCATE(sizeof(struct acpi_walk_state)); if (!walk_state) { return_PTR(NULL); } - walk_state->descriptor_type = ACPI_DESC_TYPE_WALK; - walk_state->method_desc = method_desc; + walk_state->data_type = ACPI_DESC_TYPE_WALK; walk_state->owner_id = owner_id; walk_state->origin = origin; + walk_state->method_desc = mth_desc; walk_state->thread = thread; walk_state->parser_state.start_op = origin; @@ -666,7 +664,7 @@ struct acpi_walk_state *acpi_ds_create_walk_state(acpi_owner_id owner_id, status = acpi_ds_result_stack_push(walk_state); if (ACPI_FAILURE(status)) { - ACPI_FREE(walk_state); + ACPI_MEM_FREE(walk_state); return_PTR(NULL); } @@ -703,13 +701,13 @@ acpi_ds_init_aml_walk(struct acpi_walk_state *walk_state, struct acpi_namespace_node *method_node, u8 * aml_start, u32 aml_length, - struct acpi_evaluate_info *info, u8 pass_number) + struct acpi_parameter_info *info, u8 pass_number) { acpi_status status; struct acpi_parse_state *parser_state = &walk_state->parser_state; union acpi_parse_object *extra_op; - ACPI_FUNCTION_TRACE(ds_init_aml_walk); + ACPI_FUNCTION_TRACE("ds_init_aml_walk"); walk_state->parser_state.aml = walk_state->parser_state.aml_start = aml_start; @@ -780,7 +778,6 @@ acpi_ds_init_aml_walk(struct acpi_walk_state *walk_state, } if (parser_state->start_node) { - /* Push start scope on scope stack and make it current */ status = @@ -813,24 +810,21 @@ void acpi_ds_delete_walk_state(struct acpi_walk_state *walk_state) { union acpi_generic_state *state; - ACPI_FUNCTION_TRACE_PTR(ds_delete_walk_state, walk_state); + ACPI_FUNCTION_TRACE_PTR("ds_delete_walk_state", walk_state); if (!walk_state) { return; } - if (walk_state->descriptor_type != ACPI_DESC_TYPE_WALK) { + if (walk_state->data_type != ACPI_DESC_TYPE_WALK) { ACPI_ERROR((AE_INFO, "%p is not a valid walk state", walk_state)); return; } - /* There should not be any open scopes */ - if (walk_state->parser_state.scope) { ACPI_ERROR((AE_INFO, "%p walk still has a scope list", walk_state)); - acpi_ps_cleanup_scope(&walk_state->parser_state); } /* Always must free any linked control states */ @@ -860,7 +854,7 @@ void acpi_ds_delete_walk_state(struct acpi_walk_state *walk_state) acpi_ut_delete_generic_state(state); } - ACPI_FREE(walk_state); + ACPI_MEM_FREE(walk_state); return_VOID; } @@ -885,7 +879,7 @@ acpi_ds_result_insert(void *object, { union acpi_generic_state *state; - ACPI_FUNCTION_NAME(ds_result_insert); + ACPI_FUNCTION_NAME("ds_result_insert"); state = walk_state->results; if (!state) { @@ -943,7 +937,7 @@ acpi_status acpi_ds_obj_stack_delete_all(struct acpi_walk_state * walk_state) { u32 i; - ACPI_FUNCTION_TRACE_PTR(ds_obj_stack_delete_all, walk_state); + ACPI_FUNCTION_TRACE_PTR("ds_obj_stack_delete_all", walk_state); /* The stack size is configurable, but fixed */ @@ -975,7 +969,7 @@ acpi_status acpi_ds_obj_stack_pop_object(union acpi_operand_object **object, struct acpi_walk_state *walk_state) { - ACPI_FUNCTION_NAME(ds_obj_stack_pop_object); + ACPI_FUNCTION_NAME("ds_obj_stack_pop_object"); /* Check for stack underflow */ @@ -1031,7 +1025,7 @@ acpi_ds_obj_stack_pop_object(union acpi_operand_object **object, void *acpi_ds_obj_stack_get_value(u32 index, struct acpi_walk_state *walk_state) { - ACPI_FUNCTION_TRACE_PTR(ds_obj_stack_get_value, walk_state); + ACPI_FUNCTION_TRACE_PTR("ds_obj_stack_get_value", walk_state); /* Can't do it if the stack is empty */ diff --git a/trunk/drivers/acpi/ec.c b/trunk/drivers/acpi/ec.c index c036e2a69f33..eee0864ba300 100644 --- a/trunk/drivers/acpi/ec.c +++ b/trunk/drivers/acpi/ec.c @@ -763,7 +763,8 @@ static u32 acpi_ec_gpe_poll_handler(void *data) acpi_disable_gpe(NULL, ec->common.gpe_bit, ACPI_ISR); - status = acpi_os_execute(OSL_EC_POLL_HANDLER, acpi_ec_gpe_query, ec); + status = acpi_os_queue_for_execution(OSD_PRIORITY_GPE, + acpi_ec_gpe_query, ec); if (status == AE_OK) return ACPI_INTERRUPT_HANDLED; @@ -798,7 +799,7 @@ static u32 acpi_ec_gpe_intr_handler(void *data) if (value & ACPI_EC_FLAG_SCI) { atomic_add(1, &ec->intr.pending_gpe); - status = acpi_os_execute(OSL_EC_BURST_HANDLER, + status = acpi_os_queue_for_execution(OSD_PRIORITY_GPE, acpi_ec_gpe_query, ec); return status == AE_OK ? ACPI_INTERRUPT_HANDLED : ACPI_INTERRUPT_NOT_HANDLED; @@ -990,6 +991,7 @@ static int acpi_ec_poll_add(struct acpi_device *device) int result = 0; acpi_status status = AE_OK; union acpi_ec *ec = NULL; + unsigned long uid; ACPI_FUNCTION_TRACE("acpi_ec_add"); @@ -1012,9 +1014,10 @@ static int acpi_ec_poll_add(struct acpi_device *device) acpi_evaluate_integer(ec->common.handle, "_GLK", NULL, &ec->common.global_lock); - /* XXX we don't test uids, because on some boxes ecdt uid = 0, see: - http://bugzilla.kernel.org/show_bug.cgi?id=6111 */ - if (ec_ecdt) { + /* If our UID matches the UID for the ECDT-enumerated EC, + we now have the *real* EC info, so kill the makeshift one. */ + acpi_evaluate_integer(ec->common.handle, "_UID", NULL, &uid); + if (ec_ecdt && ec_ecdt->common.uid == uid) { acpi_remove_address_space_handler(ACPI_ROOT_OBJECT, ACPI_ADR_SPACE_EC, &acpi_ec_space_handler); @@ -1059,6 +1062,7 @@ static int acpi_ec_intr_add(struct acpi_device *device) int result = 0; acpi_status status = AE_OK; union acpi_ec *ec = NULL; + unsigned long uid; ACPI_FUNCTION_TRACE("acpi_ec_add"); @@ -1084,9 +1088,10 @@ static int acpi_ec_intr_add(struct acpi_device *device) acpi_evaluate_integer(ec->common.handle, "_GLK", NULL, &ec->common.global_lock); - /* XXX we don't test uids, because on some boxes ecdt uid = 0, see: - http://bugzilla.kernel.org/show_bug.cgi?id=6111 */ - if (ec_ecdt) { + /* If our UID matches the UID for the ECDT-enumerated EC, + we now have the *real* EC info, so kill the makeshift one. */ + acpi_evaluate_integer(ec->common.handle, "_UID", NULL, &uid); + if (ec_ecdt && ec_ecdt->common.uid == uid) { acpi_remove_address_space_handler(ACPI_ROOT_OBJECT, ACPI_ADR_SPACE_EC, &acpi_ec_space_handler); diff --git a/trunk/drivers/acpi/events/evevent.c b/trunk/drivers/acpi/events/evevent.c index 919037d6acff..c9ac05c4685f 100644 --- a/trunk/drivers/acpi/events/evevent.c +++ b/trunk/drivers/acpi/events/evevent.c @@ -68,7 +68,7 @@ acpi_status acpi_ev_initialize_events(void) { acpi_status status; - ACPI_FUNCTION_TRACE(ev_initialize_events); + ACPI_FUNCTION_TRACE("ev_initialize_events"); /* Make sure we have ACPI tables */ @@ -118,7 +118,7 @@ acpi_status acpi_ev_install_fadt_gpes(void) { acpi_status status; - ACPI_FUNCTION_TRACE(ev_install_fadt_gpes); + ACPI_FUNCTION_TRACE("ev_install_fadt_gpes"); /* Namespace must be locked */ @@ -157,7 +157,7 @@ acpi_status acpi_ev_install_xrupt_handlers(void) { acpi_status status; - ACPI_FUNCTION_TRACE(ev_install_xrupt_handlers); + ACPI_FUNCTION_TRACE("ev_install_xrupt_handlers"); /* Install the SCI handler */ @@ -241,7 +241,7 @@ u32 acpi_ev_fixed_event_detect(void) u32 fixed_enable; acpi_native_uint i; - ACPI_FUNCTION_NAME(ev_fixed_event_detect); + ACPI_FUNCTION_NAME("ev_fixed_event_detect"); /* * Read the fixed feature status and enable registers, as all the cases @@ -260,14 +260,12 @@ u32 acpi_ev_fixed_event_detect(void) * Check for all possible Fixed Events and dispatch those that are active */ for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++) { - /* Both the status and enable bits must be on for this event */ if ((fixed_status & acpi_gbl_fixed_event_info[i]. status_bit_mask) && (fixed_enable & acpi_gbl_fixed_event_info[i]. enable_bit_mask)) { - /* Found an active (signalled) event */ int_status |= acpi_ev_fixed_event_dispatch((u32) i); diff --git a/trunk/drivers/acpi/events/evgpe.c b/trunk/drivers/acpi/events/evgpe.c index f01d339407f8..f64f977dd3d5 100644 --- a/trunk/drivers/acpi/events/evgpe.c +++ b/trunk/drivers/acpi/events/evgpe.c @@ -69,7 +69,7 @@ acpi_ev_set_gpe_type(struct acpi_gpe_event_info *gpe_event_info, u8 type) { acpi_status status; - ACPI_FUNCTION_TRACE(ev_set_gpe_type); + ACPI_FUNCTION_TRACE("ev_set_gpe_type"); /* Validate type and update register enable masks */ @@ -115,7 +115,7 @@ acpi_ev_update_gpe_enable_masks(struct acpi_gpe_event_info *gpe_event_info, struct acpi_gpe_register_info *gpe_register_info; u8 register_bit; - ACPI_FUNCTION_TRACE(ev_update_gpe_enable_masks); + ACPI_FUNCTION_TRACE("ev_update_gpe_enable_masks"); gpe_register_info = gpe_event_info->register_info; if (!gpe_register_info) { @@ -178,7 +178,7 @@ acpi_ev_enable_gpe(struct acpi_gpe_event_info *gpe_event_info, { acpi_status status; - ACPI_FUNCTION_TRACE(ev_enable_gpe); + ACPI_FUNCTION_TRACE("ev_enable_gpe"); /* Make sure HW enable masks are updated */ @@ -207,7 +207,6 @@ acpi_ev_enable_gpe(struct acpi_gpe_event_info *gpe_event_info, ACPI_SET_BIT(gpe_event_info->flags, ACPI_GPE_RUN_ENABLED); if (write_to_hardware) { - /* Clear the GPE (of stale events), then enable it */ status = acpi_hw_clear_gpe(gpe_event_info); @@ -244,7 +243,7 @@ acpi_status acpi_ev_disable_gpe(struct acpi_gpe_event_info *gpe_event_info) { acpi_status status; - ACPI_FUNCTION_TRACE(ev_disable_gpe); + ACPI_FUNCTION_TRACE("ev_disable_gpe"); if (!(gpe_event_info->flags & ACPI_GPE_ENABLE_MASK)) { return_ACPI_STATUS(AE_OK); @@ -314,7 +313,6 @@ struct acpi_gpe_event_info *acpi_ev_get_gpe_event_info(acpi_handle gpe_device, /* A NULL gpe_block means use the FADT-defined GPE block(s) */ if (!gpe_device) { - /* Examine GPE Block 0 and 1 (These blocks are permanent) */ for (i = 0; i < ACPI_MAX_GPE_BLOCKS; i++) { @@ -382,11 +380,10 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list) u32 status_reg; u32 enable_reg; acpi_cpu_flags flags; - acpi_cpu_flags hw_flags; acpi_native_uint i; acpi_native_uint j; - ACPI_FUNCTION_NAME(ev_gpe_detect); + ACPI_FUNCTION_NAME("ev_gpe_detect"); /* Check for the case where there are no GPEs */ @@ -394,12 +391,9 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list) return (int_status); } - /* We need to hold the GPE lock now, hardware lock in the loop */ - - flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock); - /* Examine all GPE blocks attached to this interrupt level */ + flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock); gpe_block = gpe_xrupt_list->gpe_block_list_head; while (gpe_block) { /* @@ -408,13 +402,10 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list) * Find all currently active GP events. */ for (i = 0; i < gpe_block->register_count; i++) { - /* Get the next status/enable pair */ gpe_register_info = &gpe_block->register_info[i]; - hw_flags = acpi_os_acquire_lock(acpi_gbl_hardware_lock); - /* Read the Status Register */ status = @@ -423,8 +414,6 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list) &gpe_register_info-> status_address); if (ACPI_FAILURE(status)) { - acpi_os_release_lock(acpi_gbl_hardware_lock, - hw_flags); goto unlock_and_exit; } @@ -435,8 +424,6 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list) &enable_reg, &gpe_register_info-> enable_address); - acpi_os_release_lock(acpi_gbl_hardware_lock, hw_flags); - if (ACPI_FAILURE(status)) { goto unlock_and_exit; } @@ -450,7 +437,6 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list) enabled_status_byte = (u8) (status_reg & enable_reg); if (!enabled_status_byte) { - /* No active GPEs in this register, move on */ continue; @@ -459,7 +445,6 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list) /* Now look at the individual GPEs in this byte register */ for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++) { - /* Examine one GPE bit */ if (enabled_status_byte & @@ -498,9 +483,9 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list) * * RETURN: None * - * DESCRIPTION: Perform the actual execution of a GPE control method. This - * function is called from an invocation of acpi_os_execute and - * therefore does NOT execute at interrupt level - so that + * DESCRIPTION: Perform the actual execution of a GPE control method. This + * function is called from an invocation of acpi_os_queue_for_execution + * (and therefore does NOT execute at interrupt level) so that * the control method itself is not executed in the context of * an interrupt handler. * @@ -509,11 +494,12 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list) static void ACPI_SYSTEM_XFACE acpi_ev_asynch_execute_gpe_method(void *context) { struct acpi_gpe_event_info *gpe_event_info = (void *)context; + u32 gpe_number = 0; acpi_status status; struct acpi_gpe_event_info local_gpe_event_info; - struct acpi_evaluate_info *info; + struct acpi_parameter_info info; - ACPI_FUNCTION_TRACE(ev_asynch_execute_gpe_method); + ACPI_FUNCTION_TRACE("ev_asynch_execute_gpe_method"); status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS); if (ACPI_FAILURE(status)) { @@ -549,35 +535,22 @@ static void ACPI_SYSTEM_XFACE acpi_ev_asynch_execute_gpe_method(void *context) */ if ((local_gpe_event_info.flags & ACPI_GPE_DISPATCH_MASK) == ACPI_GPE_DISPATCH_METHOD) { + /* + * Invoke the GPE Method (_Lxx, _Exx) i.e., evaluate the _Lxx/_Exx + * control method that corresponds to this GPE + */ + info.node = local_gpe_event_info.dispatch.method_node; + info.parameters = + ACPI_CAST_PTR(union acpi_operand_object *, gpe_event_info); + info.parameter_type = ACPI_PARAM_GPE; - /* Allocate the evaluation information block */ - - info = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_evaluate_info)); - if (!info) { - status = AE_NO_MEMORY; - } else { - /* - * Invoke the GPE Method (_Lxx, _Exx) i.e., evaluate the _Lxx/_Exx - * control method that corresponds to this GPE - */ - info->prefix_node = - local_gpe_event_info.dispatch.method_node; - info->parameters = - ACPI_CAST_PTR(union acpi_operand_object *, - gpe_event_info); - info->parameter_type = ACPI_PARAM_GPE; - info->flags = ACPI_IGNORE_RETURN_VALUE; - - status = acpi_ns_evaluate(info); - ACPI_FREE(info); - } - + status = acpi_ns_evaluate_by_handle(&info); if (ACPI_FAILURE(status)) { ACPI_EXCEPTION((AE_INFO, status, - "While evaluating GPE method [%4.4s]", + "While evaluating method [%4.4s] for GPE[%2X]", acpi_ut_get_node_name (local_gpe_event_info.dispatch. - method_node))); + method_node), gpe_number)); } } @@ -620,7 +593,7 @@ acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number) { acpi_status status; - ACPI_FUNCTION_TRACE(ev_gpe_dispatch); + ACPI_FUNCTION_TRACE("ev_gpe_dispatch"); /* * If edge-triggered, clear the GPE status bit now. Note that @@ -696,9 +669,9 @@ acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number) * Execute the method associated with the GPE * NOTE: Level-triggered GPEs are cleared after the method completes. */ - status = acpi_os_execute(OSL_GPE_HANDLER, - acpi_ev_asynch_execute_gpe_method, - gpe_event_info); + status = acpi_os_queue_for_execution(OSD_PRIORITY_GPE, + acpi_ev_asynch_execute_gpe_method, + gpe_event_info); if (ACPI_FAILURE(status)) { ACPI_EXCEPTION((AE_INFO, status, "Unable to queue handler for GPE[%2X] - event disabled", @@ -743,7 +716,7 @@ acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number) * * DESCRIPTION: Determine if a a GPE is "wake-only". * - * Called from Notify() code in interpreter when a "DeviceWake" + * Called from Notify() code in interpreter when a "device_wake" * Notify comes in. * ******************************************************************************/ @@ -753,7 +726,7 @@ acpi_ev_check_for_wake_only_gpe(struct acpi_gpe_event_info *gpe_event_info) { acpi_status status; - ACPI_FUNCTION_TRACE(ev_check_for_wake_only_gpe); + ACPI_FUNCTION_TRACE("ev_check_for_wake_only_gpe"); if ((gpe_event_info) && /* Only >0 for _Lxx/_Exx */ ((gpe_event_info->flags & ACPI_GPE_SYSTEM_MASK) == ACPI_GPE_SYSTEM_RUNNING)) { /* System state at GPE time */ diff --git a/trunk/drivers/acpi/events/evgpeblk.c b/trunk/drivers/acpi/events/evgpeblk.c index 95ddeb48bc0f..0fd00b5ad650 100644 --- a/trunk/drivers/acpi/events/evgpeblk.c +++ b/trunk/drivers/acpi/events/evgpeblk.c @@ -131,14 +131,14 @@ u8 acpi_ev_valid_gpe_event(struct acpi_gpe_event_info *gpe_event_info) * ******************************************************************************/ -acpi_status acpi_ev_walk_gpe_list(acpi_gpe_callback gpe_walk_callback) +acpi_status acpi_ev_walk_gpe_list(ACPI_GPE_CALLBACK gpe_walk_callback) { struct acpi_gpe_block_info *gpe_block; struct acpi_gpe_xrupt_info *gpe_xrupt_info; acpi_status status = AE_OK; acpi_cpu_flags flags; - ACPI_FUNCTION_TRACE(ev_walk_gpe_list); + ACPI_FUNCTION_TRACE("ev_walk_gpe_list"); flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock); @@ -146,12 +146,10 @@ acpi_status acpi_ev_walk_gpe_list(acpi_gpe_callback gpe_walk_callback) gpe_xrupt_info = acpi_gbl_gpe_xrupt_list_head; while (gpe_xrupt_info) { - /* Walk all Gpe Blocks attached to this interrupt level */ gpe_block = gpe_xrupt_info->gpe_block_list_head; while (gpe_block) { - /* One callback per GPE block */ status = gpe_walk_callback(gpe_xrupt_info, gpe_block); @@ -192,12 +190,11 @@ acpi_ev_delete_gpe_handlers(struct acpi_gpe_xrupt_info *gpe_xrupt_info, acpi_native_uint i; acpi_native_uint j; - ACPI_FUNCTION_TRACE(ev_delete_gpe_handlers); + ACPI_FUNCTION_TRACE("ev_delete_gpe_handlers"); /* Examine each GPE Register within the block */ for (i = 0; i < gpe_block->register_count; i++) { - /* Now look at the individual GPEs in this byte register */ for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++) { @@ -207,7 +204,7 @@ acpi_ev_delete_gpe_handlers(struct acpi_gpe_xrupt_info *gpe_xrupt_info, if ((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) == ACPI_GPE_DISPATCH_HANDLER) { - ACPI_FREE(gpe_event_info->dispatch.handler); + ACPI_MEM_FREE(gpe_event_info->dispatch.handler); gpe_event_info->dispatch.handler = NULL; gpe_event_info->flags &= ~ACPI_GPE_DISPATCH_MASK; @@ -251,7 +248,7 @@ acpi_ev_save_method_info(acpi_handle obj_handle, u8 type; acpi_status status; - ACPI_FUNCTION_TRACE(ev_save_method_info); + ACPI_FUNCTION_TRACE("ev_save_method_info"); /* * _Lxx and _Exx GPE method support @@ -282,9 +279,9 @@ acpi_ev_save_method_info(acpi_handle obj_handle, default: /* Unknown method type, just ignore it! */ - ACPI_DEBUG_PRINT((ACPI_DB_LOAD, - "Ignoring unknown GPE method type: %s (name not of form _Lxx or _Exx)", - name)); + ACPI_ERROR((AE_INFO, + "Unknown GPE method type: %s (name not of form _Lxx or _Exx)", + name)); return_ACPI_STATUS(AE_OK); } @@ -292,12 +289,11 @@ acpi_ev_save_method_info(acpi_handle obj_handle, gpe_number = ACPI_STRTOUL(&name[2], NULL, 16); if (gpe_number == ACPI_UINT32_MAX) { - /* Conversion failed; invalid method, just ignore it */ - ACPI_DEBUG_PRINT((ACPI_DB_LOAD, - "Could not extract GPE number from name: %s (name is not of form _Lxx or _Exx)", - name)); + ACPI_ERROR((AE_INFO, + "Could not extract GPE number from name: %s (name is not of form _Lxx or _Exx)", + name)); return_ACPI_STATUS(AE_OK); } @@ -368,14 +364,13 @@ acpi_ev_match_prw_and_gpe(acpi_handle obj_handle, u32 gpe_number; acpi_status status; - ACPI_FUNCTION_TRACE(ev_match_prw_and_gpe); + ACPI_FUNCTION_TRACE("ev_match_prw_and_gpe"); /* Check for a _PRW method under this device */ status = acpi_ut_evaluate_object(obj_handle, METHOD_NAME__PRW, ACPI_BTYPE_PACKAGE, &pkg_desc); if (ACPI_FAILURE(status)) { - /* Ignore all errors from _PRW, we don't want to abort the subsystem */ return_ACPI_STATUS(AE_OK); @@ -399,7 +394,6 @@ acpi_ev_match_prw_and_gpe(acpi_handle obj_handle, obj_desc = pkg_desc->package.elements[0]; if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) { - /* Use FADT-defined GPE device (from definition of _PRW) */ target_gpe_device = acpi_gbl_fadt_gpe_device; @@ -408,7 +402,6 @@ acpi_ev_match_prw_and_gpe(acpi_handle obj_handle, gpe_number = (u32) obj_desc->integer.value; } else if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_PACKAGE) { - /* Package contains a GPE reference and GPE number within a GPE block */ if ((obj_desc->package.count < 2) || @@ -489,7 +482,7 @@ static struct acpi_gpe_xrupt_info *acpi_ev_get_gpe_xrupt_block(u32 acpi_status status; acpi_cpu_flags flags; - ACPI_FUNCTION_TRACE(ev_get_gpe_xrupt_block); + ACPI_FUNCTION_TRACE("ev_get_gpe_xrupt_block"); /* No need for lock since we are not changing any list elements here */ @@ -504,7 +497,7 @@ static struct acpi_gpe_xrupt_info *acpi_ev_get_gpe_xrupt_block(u32 /* Not found, must allocate a new xrupt descriptor */ - gpe_xrupt = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_gpe_xrupt_info)); + gpe_xrupt = ACPI_MEM_CALLOCATE(sizeof(struct acpi_gpe_xrupt_info)); if (!gpe_xrupt) { return_PTR(NULL); } @@ -563,7 +556,7 @@ acpi_ev_delete_gpe_xrupt(struct acpi_gpe_xrupt_info *gpe_xrupt) acpi_status status; acpi_cpu_flags flags; - ACPI_FUNCTION_TRACE(ev_delete_gpe_xrupt); + ACPI_FUNCTION_TRACE("ev_delete_gpe_xrupt"); /* We never want to remove the SCI interrupt handler */ @@ -595,7 +588,7 @@ acpi_ev_delete_gpe_xrupt(struct acpi_gpe_xrupt_info *gpe_xrupt) /* Free the block */ - ACPI_FREE(gpe_xrupt); + ACPI_MEM_FREE(gpe_xrupt); return_ACPI_STATUS(AE_OK); } @@ -621,7 +614,7 @@ acpi_ev_install_gpe_block(struct acpi_gpe_block_info *gpe_block, acpi_status status; acpi_cpu_flags flags; - ACPI_FUNCTION_TRACE(ev_install_gpe_block); + ACPI_FUNCTION_TRACE("ev_install_gpe_block"); status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS); if (ACPI_FAILURE(status)) { @@ -674,7 +667,7 @@ acpi_status acpi_ev_delete_gpe_block(struct acpi_gpe_block_info *gpe_block) acpi_status status; acpi_cpu_flags flags; - ACPI_FUNCTION_TRACE(ev_install_gpe_block); + ACPI_FUNCTION_TRACE("ev_install_gpe_block"); status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS); if (ACPI_FAILURE(status)) { @@ -686,7 +679,6 @@ acpi_status acpi_ev_delete_gpe_block(struct acpi_gpe_block_info *gpe_block) status = acpi_hw_disable_gpe_block(gpe_block->xrupt_block, gpe_block); if (!gpe_block->previous && !gpe_block->next) { - /* This is the last gpe_block on this interrupt */ status = acpi_ev_delete_gpe_xrupt(gpe_block->xrupt_block); @@ -712,9 +704,9 @@ acpi_status acpi_ev_delete_gpe_block(struct acpi_gpe_block_info *gpe_block) /* Free the gpe_block */ - ACPI_FREE(gpe_block->register_info); - ACPI_FREE(gpe_block->event_info); - ACPI_FREE(gpe_block); + ACPI_MEM_FREE(gpe_block->register_info); + ACPI_MEM_FREE(gpe_block->event_info); + ACPI_MEM_FREE(gpe_block); unlock_and_exit: status = acpi_ut_release_mutex(ACPI_MTX_EVENTS); @@ -744,17 +736,17 @@ acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block) acpi_native_uint j; acpi_status status; - ACPI_FUNCTION_TRACE(ev_create_gpe_info_blocks); + ACPI_FUNCTION_TRACE("ev_create_gpe_info_blocks"); /* Allocate the GPE register information block */ - gpe_register_info = ACPI_ALLOCATE_ZEROED((acpi_size) gpe_block-> - register_count * - sizeof(struct - acpi_gpe_register_info)); + gpe_register_info = ACPI_MEM_CALLOCATE((acpi_size) gpe_block-> + register_count * + sizeof(struct + acpi_gpe_register_info)); if (!gpe_register_info) { ACPI_ERROR((AE_INFO, - "Could not allocate the GpeRegisterInfo table")); + "Could not allocate the gpe_register_info table")); return_ACPI_STATUS(AE_NO_MEMORY); } @@ -762,14 +754,13 @@ acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block) * Allocate the GPE event_info block. There are eight distinct GPEs * per register. Initialization to zeros is sufficient. */ - gpe_event_info = ACPI_ALLOCATE_ZEROED(((acpi_size) gpe_block-> - register_count * - ACPI_GPE_REGISTER_WIDTH) * - sizeof(struct - acpi_gpe_event_info)); + gpe_event_info = ACPI_MEM_CALLOCATE(((acpi_size) gpe_block-> + register_count * + ACPI_GPE_REGISTER_WIDTH) * + sizeof(struct acpi_gpe_event_info)); if (!gpe_event_info) { ACPI_ERROR((AE_INFO, - "Could not allocate the GpeEventInfo table")); + "Could not allocate the gpe_event_info table")); status = AE_NO_MEMORY; goto error_exit; } @@ -789,7 +780,6 @@ acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block) this_event = gpe_event_info; for (i = 0; i < gpe_block->register_count; i++) { - /* Init the register_info for this GPE register (8 GPEs) */ this_register->base_gpe_number = @@ -849,10 +839,10 @@ acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block) error_exit: if (gpe_register_info) { - ACPI_FREE(gpe_register_info); + ACPI_MEM_FREE(gpe_register_info); } if (gpe_event_info) { - ACPI_FREE(gpe_event_info); + ACPI_MEM_FREE(gpe_event_info); } return_ACPI_STATUS(status); @@ -888,7 +878,7 @@ acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device, acpi_status status; struct acpi_gpe_block_info *gpe_block; - ACPI_FUNCTION_TRACE(ev_create_gpe_block); + ACPI_FUNCTION_TRACE("ev_create_gpe_block"); if (!register_count) { return_ACPI_STATUS(AE_OK); @@ -896,7 +886,7 @@ acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device, /* Allocate a new GPE block */ - gpe_block = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_gpe_block_info)); + gpe_block = ACPI_MEM_CALLOCATE(sizeof(struct acpi_gpe_block_info)); if (!gpe_block) { return_ACPI_STATUS(AE_NO_MEMORY); } @@ -916,7 +906,7 @@ acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device, */ status = acpi_ev_create_gpe_info_blocks(gpe_block); if (ACPI_FAILURE(status)) { - ACPI_FREE(gpe_block); + ACPI_MEM_FREE(gpe_block); return_ACPI_STATUS(status); } @@ -924,7 +914,7 @@ acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device, status = acpi_ev_install_gpe_block(gpe_block, interrupt_number); if (ACPI_FAILURE(status)) { - ACPI_FREE(gpe_block); + ACPI_MEM_FREE(gpe_block); return_ACPI_STATUS(status); } @@ -981,7 +971,7 @@ acpi_ev_initialize_gpe_block(struct acpi_namespace_node *gpe_device, acpi_native_uint i; acpi_native_uint j; - ACPI_FUNCTION_TRACE(ev_initialize_gpe_block); + ACPI_FUNCTION_TRACE("ev_initialize_gpe_block"); /* Ignore a null GPE block (e.g., if no GPE block 1 exists) */ @@ -1023,7 +1013,6 @@ acpi_ev_initialize_gpe_block(struct acpi_namespace_node *gpe_device, for (i = 0; i < gpe_block->register_count; i++) { for (j = 0; j < 8; j++) { - /* Get the info block for this particular GPE */ gpe_event_info = @@ -1051,7 +1040,7 @@ acpi_ev_initialize_gpe_block(struct acpi_namespace_node *gpe_device, status = acpi_hw_enable_runtime_gpe_block(NULL, gpe_block); if (ACPI_FAILURE(status)) { - ACPI_ERROR((AE_INFO, "Could not enable GPEs in GpeBlock %p", + ACPI_ERROR((AE_INFO, "Could not enable GPEs in gpe_block %p", gpe_block)); } @@ -1077,7 +1066,7 @@ acpi_status acpi_ev_gpe_initialize(void) u32 gpe_number_max = 0; acpi_status status; - ACPI_FUNCTION_TRACE(ev_gpe_initialize); + ACPI_FUNCTION_TRACE("ev_gpe_initialize"); status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); if (ACPI_FAILURE(status)) { @@ -1110,7 +1099,6 @@ acpi_status acpi_ev_gpe_initialize(void) * particular block is not supported. */ if (acpi_gbl_FADT->gpe0_blk_len && acpi_gbl_FADT->xgpe0_blk.address) { - /* GPE block 0 exists (has both length and address > 0) */ register_count0 = (u16) (acpi_gbl_FADT->gpe0_blk_len / 2); @@ -1133,7 +1121,6 @@ acpi_status acpi_ev_gpe_initialize(void) } if (acpi_gbl_FADT->gpe1_blk_len && acpi_gbl_FADT->xgpe1_blk.address) { - /* GPE block 1 exists (has both length and address > 0) */ register_count1 = (u16) (acpi_gbl_FADT->gpe1_blk_len / 2); @@ -1181,7 +1168,6 @@ acpi_status acpi_ev_gpe_initialize(void) /* Exit if there are no GPE registers */ if ((register_count0 + register_count1) == 0) { - /* GPEs are not required by ACPI, this is OK */ ACPI_DEBUG_PRINT((ACPI_DB_INIT, diff --git a/trunk/drivers/acpi/events/evmisc.c b/trunk/drivers/acpi/events/evmisc.c index 6eef4efddcf6..0909ba69577e 100644 --- a/trunk/drivers/acpi/events/evmisc.c +++ b/trunk/drivers/acpi/events/evmisc.c @@ -49,13 +49,12 @@ #define _COMPONENT ACPI_EVENTS ACPI_MODULE_NAME("evmisc") -/* Names for Notify() values, used for debug output */ #ifdef ACPI_DEBUG_OUTPUT static const char *acpi_notify_value_names[] = { "Bus Check", "Device Check", "Device Wake", - "Eject Request", + "Eject request", "Device Check Light", "Frequency Mismatch", "Bus Mode Mismatch", @@ -125,7 +124,7 @@ acpi_ev_queue_notify_request(struct acpi_namespace_node * node, union acpi_generic_state *notify_info; acpi_status status = AE_OK; - ACPI_FUNCTION_NAME(ev_queue_notify_request); + ACPI_FUNCTION_NAME("ev_queue_notify_request"); /* * For value 3 (Ejection Request), some device method may need to be run. @@ -151,7 +150,6 @@ acpi_ev_queue_notify_request(struct acpi_namespace_node * node, obj_desc = acpi_ns_get_attached_object(node); if (obj_desc) { - /* We have the notify object, Get the right handler */ switch (node->type) { @@ -186,15 +184,14 @@ acpi_ev_queue_notify_request(struct acpi_namespace_node * node, return (AE_NO_MEMORY); } - notify_info->common.descriptor_type = - ACPI_DESC_TYPE_STATE_NOTIFY; + notify_info->common.data_type = ACPI_DESC_TYPE_STATE_NOTIFY; notify_info->notify.node = node; notify_info->notify.value = (u16) notify_value; notify_info->notify.handler_obj = handler_obj; - status = - acpi_os_execute(OSL_NOTIFY_HANDLER, acpi_ev_notify_dispatch, - notify_info); + status = acpi_os_queue_for_execution(OSD_PRIORITY_HIGH, + acpi_ev_notify_dispatch, + notify_info); if (ACPI_FAILURE(status)) { acpi_ut_delete_generic_state(notify_info); } @@ -243,7 +240,6 @@ static void ACPI_SYSTEM_XFACE acpi_ev_notify_dispatch(void *context) * to the device. */ if (notify_info->notify.value <= ACPI_MAX_SYS_NOTIFY) { - /* Global system notification handler */ if (acpi_gbl_system_notify.handler) { @@ -301,7 +297,6 @@ static void ACPI_SYSTEM_XFACE acpi_ev_global_lock_thread(void *context) /* Signal threads that are waiting for the lock */ if (acpi_gbl_global_lock_thread_count) { - /* Send sufficient units to the semaphore */ status = @@ -340,16 +335,15 @@ static u32 acpi_ev_global_lock_handler(void *context) */ ACPI_ACQUIRE_GLOBAL_LOCK(acpi_gbl_common_fACS.global_lock, acquired); if (acquired) { - /* Got the lock, now wake all threads waiting for it */ acpi_gbl_global_lock_acquired = TRUE; /* Run the Global Lock thread which will signal all waiting threads */ - status = - acpi_os_execute(OSL_GLOBAL_LOCK_HANDLER, - acpi_ev_global_lock_thread, context); + status = acpi_os_queue_for_execution(OSD_PRIORITY_HIGH, + acpi_ev_global_lock_thread, + context); if (ACPI_FAILURE(status)) { ACPI_EXCEPTION((AE_INFO, status, "Could not queue Global Lock thread")); @@ -377,7 +371,7 @@ acpi_status acpi_ev_init_global_lock_handler(void) { acpi_status status; - ACPI_FUNCTION_TRACE(ev_init_global_lock_handler); + ACPI_FUNCTION_TRACE("ev_init_global_lock_handler"); acpi_gbl_global_lock_present = TRUE; status = acpi_install_fixed_event_handler(ACPI_EVENT_GLOBAL, @@ -419,7 +413,7 @@ acpi_status acpi_ev_acquire_global_lock(u16 timeout) acpi_status status = AE_OK; u8 acquired = FALSE; - ACPI_FUNCTION_TRACE(ev_acquire_global_lock); + ACPI_FUNCTION_TRACE("ev_acquire_global_lock"); #ifndef ACPI_APPLICATION /* Make sure that we actually have a global lock */ @@ -445,7 +439,6 @@ acpi_status acpi_ev_acquire_global_lock(u16 timeout) ACPI_ACQUIRE_GLOBAL_LOCK(acpi_gbl_common_fACS.global_lock, acquired); if (acquired) { - /* We got the lock */ ACPI_DEBUG_PRINT((ACPI_DB_EXEC, @@ -465,9 +458,8 @@ acpi_status acpi_ev_acquire_global_lock(u16 timeout) * Acquire the global lock semaphore first. * Since this wait will block, we must release the interpreter */ - status = - acpi_ex_system_wait_semaphore(acpi_gbl_global_lock_semaphore, - timeout); + status = acpi_ex_system_wait_semaphore(acpi_gbl_global_lock_semaphore, + timeout); return_ACPI_STATUS(status); } @@ -488,7 +480,7 @@ acpi_status acpi_ev_release_global_lock(void) u8 pending = FALSE; acpi_status status = AE_OK; - ACPI_FUNCTION_TRACE(ev_release_global_lock); + ACPI_FUNCTION_TRACE("ev_release_global_lock"); if (!acpi_gbl_global_lock_thread_count) { ACPI_WARNING((AE_INFO, @@ -500,7 +492,6 @@ acpi_status acpi_ev_release_global_lock(void) acpi_gbl_global_lock_thread_count--; if (acpi_gbl_global_lock_thread_count) { - /* There are still some threads holding the lock, cannot release */ return_ACPI_STATUS(AE_OK); @@ -542,7 +533,7 @@ void acpi_ev_terminate(void) acpi_native_uint i; acpi_status status; - ACPI_FUNCTION_TRACE(ev_terminate); + ACPI_FUNCTION_TRACE("ev_terminate"); if (acpi_gbl_events_initialized) { /* @@ -582,7 +573,7 @@ void acpi_ev_terminate(void) if (acpi_gbl_original_mode == ACPI_SYS_MODE_LEGACY) { status = acpi_disable(); if (ACPI_FAILURE(status)) { - ACPI_WARNING((AE_INFO, "AcpiDisable failed")); + ACPI_WARNING((AE_INFO, "acpi_disable failed")); } } return_VOID; diff --git a/trunk/drivers/acpi/events/evregion.c b/trunk/drivers/acpi/events/evregion.c index 094a17e4c86d..6da58e776413 100644 --- a/trunk/drivers/acpi/events/evregion.c +++ b/trunk/drivers/acpi/events/evregion.c @@ -83,7 +83,7 @@ acpi_status acpi_ev_install_region_handlers(void) acpi_status status; acpi_native_uint i; - ACPI_FUNCTION_TRACE(ev_install_region_handlers); + ACPI_FUNCTION_TRACE("ev_install_region_handlers"); status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); if (ACPI_FAILURE(status)) { @@ -153,7 +153,7 @@ acpi_status acpi_ev_initialize_op_regions(void) acpi_status status; acpi_native_uint i; - ACPI_FUNCTION_TRACE(ev_initialize_op_regions); + ACPI_FUNCTION_TRACE("ev_initialize_op_regions"); status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); if (ACPI_FAILURE(status)) { @@ -164,7 +164,6 @@ acpi_status acpi_ev_initialize_op_regions(void) * Run the _REG methods for op_regions in each default address space */ for (i = 0; i < ACPI_NUM_DEFAULT_SPACES; i++) { - /* TBD: Make sure handler is the DEFAULT handler, otherwise * _REG will have already been run. */ @@ -193,12 +192,12 @@ acpi_status acpi_ev_initialize_op_regions(void) acpi_status acpi_ev_execute_reg_method(union acpi_operand_object *region_obj, u32 function) { - struct acpi_evaluate_info *info; - union acpi_operand_object *args[3]; + struct acpi_parameter_info info; + union acpi_operand_object *params[3]; union acpi_operand_object *region_obj2; acpi_status status; - ACPI_FUNCTION_TRACE(ev_execute_reg_method); + ACPI_FUNCTION_TRACE("ev_execute_reg_method"); region_obj2 = acpi_ns_get_secondary_object(region_obj); if (!region_obj2) { @@ -209,60 +208,48 @@ acpi_ev_execute_reg_method(union acpi_operand_object *region_obj, u32 function) return_ACPI_STATUS(AE_OK); } - /* Allocate and initialize the evaluation information block */ - - info = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_evaluate_info)); - if (!info) { - return_ACPI_STATUS(AE_NO_MEMORY); - } - - info->prefix_node = region_obj2->extra.method_REG; - info->pathname = NULL; - info->parameters = args; - info->parameter_type = ACPI_PARAM_ARGS; - info->flags = ACPI_IGNORE_RETURN_VALUE; - /* * The _REG method has two arguments: * - * Arg0 - Integer: - * Operation region space ID Same value as region_obj->Region.space_id - * - * Arg1 - Integer: - * connection status 1 for connecting the handler, 0 for disconnecting - * the handler (Passed as a parameter) + * Arg0, Integer: Operation region space ID + * Same value as region_obj->Region.space_id + * Arg1, Integer: connection status + * 1 for connecting the handler, + * 0 for disconnecting the handler + * Passed as a parameter */ - args[0] = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); - if (!args[0]) { - status = AE_NO_MEMORY; - goto cleanup1; + params[0] = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); + if (!params[0]) { + return_ACPI_STATUS(AE_NO_MEMORY); } - args[1] = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); - if (!args[1]) { + params[1] = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); + if (!params[1]) { status = AE_NO_MEMORY; - goto cleanup2; + goto cleanup; } /* Setup the parameter objects */ - args[0]->integer.value = region_obj->region.space_id; - args[1]->integer.value = function; - args[2] = NULL; + params[0]->integer.value = region_obj->region.space_id; + params[1]->integer.value = function; + params[2] = NULL; + + info.node = region_obj2->extra.method_REG; + info.parameters = params; + info.parameter_type = ACPI_PARAM_ARGS; /* Execute the method, no return value */ ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname - (ACPI_TYPE_METHOD, info->prefix_node, NULL)); + (ACPI_TYPE_METHOD, info.node, NULL)); + status = acpi_ns_evaluate_by_handle(&info); - status = acpi_ns_evaluate(info); - acpi_ut_remove_reference(args[1]); + acpi_ut_remove_reference(params[1]); - cleanup2: - acpi_ut_remove_reference(args[0]); + cleanup: + acpi_ut_remove_reference(params[0]); - cleanup1: - ACPI_FREE(info); return_ACPI_STATUS(status); } @@ -274,8 +261,7 @@ acpi_ev_execute_reg_method(union acpi_operand_object *region_obj, u32 function) * Function - Read or Write operation * Address - Where in the space to read or write * bit_width - Field width in bits (8, 16, 32, or 64) - * Value - Pointer to in or out value, must be - * full 64-bit acpi_integer + * Value - Pointer to in or out value * * RETURN: Status * @@ -288,7 +274,7 @@ acpi_status acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, u32 function, acpi_physical_address address, - u32 bit_width, acpi_integer * value) + u32 bit_width, void *value) { acpi_status status; acpi_status status2; @@ -298,7 +284,7 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, union acpi_operand_object *region_obj2; void *region_context = NULL; - ACPI_FUNCTION_TRACE(ev_address_space_dispatch); + ACPI_FUNCTION_TRACE("ev_address_space_dispatch"); region_obj2 = acpi_ns_get_secondary_object(region_obj); if (!region_obj2) { @@ -329,7 +315,6 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, */ region_setup = handler_desc->address_space.setup; if (!region_setup) { - /* No initialization routine, exit with error */ ACPI_ERROR((AE_INFO, @@ -376,10 +361,9 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, region_obj->region.flags |= AOPOBJ_SETUP_COMPLETE; if (region_obj2->extra.region_context) { - /* The handler for this region was already installed */ - ACPI_FREE(region_context); + ACPI_MEM_FREE(region_context); } else { /* * Save the returned context for use in all accesses to @@ -402,8 +386,9 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, acpi_ut_get_region_name(region_obj->region. space_id))); - if (!(handler_desc->address_space.handler_flags & - ACPI_ADDR_HANDLER_DEFAULT_INSTALLED)) { + if (! + (handler_desc->address_space. + hflags & ACPI_ADDR_HANDLER_DEFAULT_INSTALLED)) { /* * For handlers other than the default (supplied) handlers, we must * exit the interpreter because the handler *might* block -- we don't @@ -424,8 +409,9 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, space_id))); } - if (!(handler_desc->address_space.handler_flags & - ACPI_ADDR_HANDLER_DEFAULT_INSTALLED)) { + if (! + (handler_desc->address_space. + hflags & ACPI_ADDR_HANDLER_DEFAULT_INSTALLED)) { /* * We just returned from a non-default handler, we must re-enter the * interpreter @@ -465,7 +451,7 @@ acpi_ev_detach_region(union acpi_operand_object *region_obj, union acpi_operand_object *region_obj2; acpi_status status; - ACPI_FUNCTION_TRACE(ev_detach_region); + ACPI_FUNCTION_TRACE("ev_detach_region"); region_obj2 = acpi_ns_get_secondary_object(region_obj); if (!region_obj2) { @@ -477,7 +463,6 @@ acpi_ev_detach_region(union acpi_operand_object *region_obj, handler_obj = region_obj->region.handler; if (!handler_obj) { - /* This region has no handler, all done */ return_VOID; @@ -489,7 +474,6 @@ acpi_ev_detach_region(union acpi_operand_object *region_obj, last_obj_ptr = &handler_obj->address_space.region_list; while (obj_desc) { - /* Is this the correct Region? */ if (obj_desc == region_obj) { @@ -599,7 +583,7 @@ acpi_ev_attach_region(union acpi_operand_object *handler_obj, u8 acpi_ns_is_locked) { - ACPI_FUNCTION_TRACE(ev_attach_region); + ACPI_FUNCTION_TRACE("ev_attach_region"); ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, "Adding Region [%4.4s] %p to address handler %p [%s]\n", @@ -652,7 +636,7 @@ acpi_ev_install_handler(acpi_handle obj_handle, struct acpi_namespace_node *node; acpi_status status; - ACPI_FUNCTION_NAME(ev_install_handler); + ACPI_FUNCTION_NAME("ev_install_handler"); handler_obj = (union acpi_operand_object *)context; @@ -682,7 +666,6 @@ acpi_ev_install_handler(acpi_handle obj_handle, obj_desc = acpi_ns_get_attached_object(node); if (!obj_desc) { - /* No object, just exit */ return (AE_OK); @@ -691,12 +674,10 @@ acpi_ev_install_handler(acpi_handle obj_handle, /* Devices are handled different than regions */ if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_DEVICE) { - /* Check if this Device already has a handler for this address space */ next_handler_obj = obj_desc->device.handler; while (next_handler_obj) { - /* Found a handler, is it for the same address space? */ if (next_handler_obj->address_space.space_id == @@ -783,9 +764,9 @@ acpi_ev_install_space_handler(struct acpi_namespace_node * node, union acpi_operand_object *handler_obj; acpi_status status; acpi_object_type type; - u8 flags = 0; + u16 flags = 0; - ACPI_FUNCTION_TRACE(ev_install_space_handler); + ACPI_FUNCTION_TRACE("ev_install_space_handler"); /* * This registration is valid for only the types below @@ -858,7 +839,6 @@ acpi_ev_install_space_handler(struct acpi_namespace_node * node, /* Walk the handler list for this device */ while (handler_obj) { - /* Same space_id indicates a handler already installed */ if (handler_obj->address_space.space_id == space_id) { @@ -941,7 +921,7 @@ acpi_ev_install_space_handler(struct acpi_namespace_node * node, /* Init handler obj */ handler_obj->address_space.space_id = (u8) space_id; - handler_obj->address_space.handler_flags = flags; + handler_obj->address_space.hflags = flags; handler_obj->address_space.region_list = NULL; handler_obj->address_space.node = node; handler_obj->address_space.handler = handler; @@ -999,7 +979,7 @@ acpi_ev_execute_reg_methods(struct acpi_namespace_node *node, { acpi_status status; - ACPI_FUNCTION_TRACE(ev_execute_reg_methods); + ACPI_FUNCTION_TRACE("ev_execute_reg_methods"); /* * Run all _REG methods for all Operation Regions for this @@ -1021,7 +1001,7 @@ acpi_ev_execute_reg_methods(struct acpi_namespace_node *node, * * PARAMETERS: walk_namespace callback * - * DESCRIPTION: Run _REG method for region objects of the requested space_iD + * DESCRIPTION: Run _REg method for region objects of the requested space_iD * ******************************************************************************/ @@ -1055,7 +1035,6 @@ acpi_ev_reg_run(acpi_handle obj_handle, obj_desc = acpi_ns_get_attached_object(node); if (!obj_desc) { - /* No object, just exit */ return (AE_OK); diff --git a/trunk/drivers/acpi/events/evrgnini.c b/trunk/drivers/acpi/events/evrgnini.c index 5b3c7a85eb9a..baed8c1a1b9f 100644 --- a/trunk/drivers/acpi/events/evrgnini.c +++ b/trunk/drivers/acpi/events/evrgnini.c @@ -71,22 +71,11 @@ acpi_ev_system_memory_region_setup(acpi_handle handle, (union acpi_operand_object *)handle; struct acpi_mem_space_context *local_region_context; - ACPI_FUNCTION_TRACE(ev_system_memory_region_setup); + ACPI_FUNCTION_TRACE("ev_system_memory_region_setup"); if (function == ACPI_REGION_DEACTIVATE) { if (*region_context) { - local_region_context = - (struct acpi_mem_space_context *)*region_context; - - /* Delete a cached mapping if present */ - - if (local_region_context->mapped_length) { - acpi_os_unmap_memory(local_region_context-> - mapped_logical_address, - local_region_context-> - mapped_length); - } - ACPI_FREE(local_region_context); + ACPI_MEM_FREE(*region_context); *region_context = NULL; } return_ACPI_STATUS(AE_OK); @@ -95,7 +84,7 @@ acpi_ev_system_memory_region_setup(acpi_handle handle, /* Create a new context */ local_region_context = - ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_mem_space_context)); + ACPI_MEM_CALLOCATE(sizeof(struct acpi_mem_space_context)); if (!(local_region_context)) { return_ACPI_STATUS(AE_NO_MEMORY); } @@ -129,7 +118,7 @@ acpi_ev_io_space_region_setup(acpi_handle handle, u32 function, void *handler_context, void **region_context) { - ACPI_FUNCTION_TRACE(ev_io_space_region_setup); + ACPI_FUNCTION_TRACE("ev_io_space_region_setup"); if (function == ACPI_REGION_DEACTIVATE) { *region_context = NULL; @@ -172,7 +161,7 @@ acpi_ev_pci_config_region_setup(acpi_handle handle, (union acpi_operand_object *)handle; struct acpi_device_id object_hID; - ACPI_FUNCTION_TRACE(ev_pci_config_region_setup); + ACPI_FUNCTION_TRACE("ev_pci_config_region_setup"); handler_obj = region_obj->region.handler; if (!handler_obj) { @@ -189,7 +178,7 @@ acpi_ev_pci_config_region_setup(acpi_handle handle, *region_context = NULL; if (function == ACPI_REGION_DEACTIVATE) { if (pci_id) { - ACPI_FREE(pci_id); + ACPI_MEM_FREE(pci_id); } return_ACPI_STATUS(status); } @@ -210,7 +199,6 @@ acpi_ev_pci_config_region_setup(acpi_handle handle, * handlers with that device. */ if (handler_obj->address_space.node == acpi_gbl_root_node) { - /* Start search from the parent object */ pci_root_node = parent_node; @@ -232,7 +220,6 @@ acpi_ev_pci_config_region_setup(acpi_handle handle, PCI_EXPRESS_ROOT_HID_STRING, sizeof(PCI_EXPRESS_ROOT_HID_STRING))))) { - /* Install a handler for this PCI root bridge */ status = @@ -248,7 +235,7 @@ acpi_ev_pci_config_region_setup(acpi_handle handle, } else { ACPI_EXCEPTION((AE_INFO, status, - "Could not install PciConfig handler for Root Bridge %4.4s", + "Could not install pci_config handler for Root Bridge %4.4s", acpi_ut_get_node_name (pci_root_node))); } @@ -275,7 +262,7 @@ acpi_ev_pci_config_region_setup(acpi_handle handle, /* Region is still not initialized. Create a new context */ - pci_id = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_pci_id)); + pci_id = ACPI_MEM_CALLOCATE(sizeof(struct acpi_pci_id)); if (!pci_id) { return_ACPI_STATUS(AE_NO_MEMORY); } @@ -350,7 +337,7 @@ acpi_ev_pci_bar_region_setup(acpi_handle handle, u32 function, void *handler_context, void **region_context) { - ACPI_FUNCTION_TRACE(ev_pci_bar_region_setup); + ACPI_FUNCTION_TRACE("ev_pci_bar_region_setup"); return_ACPI_STATUS(AE_OK); } @@ -377,7 +364,7 @@ acpi_ev_cmos_region_setup(acpi_handle handle, u32 function, void *handler_context, void **region_context) { - ACPI_FUNCTION_TRACE(ev_cmos_region_setup); + ACPI_FUNCTION_TRACE("ev_cmos_region_setup"); return_ACPI_STATUS(AE_OK); } @@ -402,7 +389,7 @@ acpi_ev_default_region_setup(acpi_handle handle, u32 function, void *handler_context, void **region_context) { - ACPI_FUNCTION_TRACE(ev_default_region_setup); + ACPI_FUNCTION_TRACE("ev_default_region_setup"); if (function == ACPI_REGION_DEACTIVATE) { *region_context = NULL; @@ -448,7 +435,7 @@ acpi_ev_initialize_region(union acpi_operand_object *region_obj, acpi_name *reg_name_ptr = (acpi_name *) METHOD_NAME__REG; union acpi_operand_object *region_obj2; - ACPI_FUNCTION_TRACE_U32(ev_initialize_region, acpi_ns_locked); + ACPI_FUNCTION_TRACE_U32("ev_initialize_region", acpi_ns_locked); if (!region_obj) { return_ACPI_STATUS(AE_BAD_PARAMETER); @@ -475,9 +462,8 @@ acpi_ev_initialize_region(union acpi_operand_object *region_obj, /* Find any "_REG" method associated with this region definition */ - status = - acpi_ns_search_one_scope(*reg_name_ptr, node, ACPI_TYPE_METHOD, - &method_node); + 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 @@ -492,13 +478,11 @@ acpi_ev_initialize_region(union acpi_operand_object *region_obj, * ie: acpi_gbl_root_node->parent_entry being set to NULL */ while (node) { - /* Check to see if a handler exists */ handler_obj = NULL; obj_desc = acpi_ns_get_attached_object(node); if (obj_desc) { - /* Can only be a handler if the object exists */ switch (node->type) { @@ -523,12 +507,10 @@ acpi_ev_initialize_region(union acpi_operand_object *region_obj, } while (handler_obj) { - /* Is this handler of the correct type? */ if (handler_obj->address_space.space_id == space_id) { - /* Found correct handler */ ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, @@ -589,7 +571,7 @@ acpi_ev_initialize_region(union acpi_operand_object *region_obj, /* If we get here, there is no handler for this region */ ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, - "No handler for RegionType %s(%X) (RegionObj %p)\n", + "No handler for region_type %s(%X) (region_obj %p)\n", acpi_ut_get_region_name(space_id), space_id, region_obj)); diff --git a/trunk/drivers/acpi/events/evsci.c b/trunk/drivers/acpi/events/evsci.c index 8106215ad554..9a622169008a 100644 --- a/trunk/drivers/acpi/events/evsci.c +++ b/trunk/drivers/acpi/events/evsci.c @@ -69,7 +69,7 @@ static u32 ACPI_SYSTEM_XFACE acpi_ev_sci_xrupt_handler(void *context) struct acpi_gpe_xrupt_info *gpe_xrupt_list = context; u32 interrupt_handled = ACPI_INTERRUPT_NOT_HANDLED; - ACPI_FUNCTION_TRACE(ev_sci_xrupt_handler); + ACPI_FUNCTION_TRACE("ev_sci_xrupt_handler"); /* * We are guaranteed by the ACPI CA initialization/shutdown code that @@ -108,7 +108,7 @@ u32 ACPI_SYSTEM_XFACE acpi_ev_gpe_xrupt_handler(void *context) struct acpi_gpe_xrupt_info *gpe_xrupt_list = context; u32 interrupt_handled = ACPI_INTERRUPT_NOT_HANDLED; - ACPI_FUNCTION_TRACE(ev_gpe_xrupt_handler); + ACPI_FUNCTION_TRACE("ev_gpe_xrupt_handler"); /* * We are guaranteed by the ACPI CA initialization/shutdown code that @@ -140,7 +140,7 @@ u32 acpi_ev_install_sci_handler(void) { u32 status = AE_OK; - ACPI_FUNCTION_TRACE(ev_install_sci_handler); + ACPI_FUNCTION_TRACE("ev_install_sci_handler"); status = acpi_os_install_interrupt_handler((u32) acpi_gbl_FADT->sci_int, acpi_ev_sci_xrupt_handler, @@ -171,7 +171,7 @@ acpi_status acpi_ev_remove_sci_handler(void) { acpi_status status; - ACPI_FUNCTION_TRACE(ev_remove_sci_handler); + ACPI_FUNCTION_TRACE("ev_remove_sci_handler"); /* Just let the OS remove the handler and disable the level */ diff --git a/trunk/drivers/acpi/events/evxface.c b/trunk/drivers/acpi/events/evxface.c index 76c34a66e0e0..b38b39dde543 100644 --- a/trunk/drivers/acpi/events/evxface.c +++ b/trunk/drivers/acpi/events/evxface.c @@ -41,6 +41,8 @@ * POSSIBILITY OF SUCH DAMAGES. */ +#include + #include #include #include @@ -66,7 +68,7 @@ acpi_status acpi_install_exception_handler(acpi_exception_handler handler) { acpi_status status; - ACPI_FUNCTION_TRACE(acpi_install_exception_handler); + ACPI_FUNCTION_TRACE("acpi_install_exception_handler"); status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS); if (ACPI_FAILURE(status)) { @@ -88,8 +90,6 @@ acpi_status acpi_install_exception_handler(acpi_exception_handler handler) (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS); return_ACPI_STATUS(status); } - -ACPI_EXPORT_SYMBOL(acpi_install_exception_handler) #endif /* ACPI_FUTURE_USAGE */ /******************************************************************************* @@ -107,13 +107,14 @@ ACPI_EXPORT_SYMBOL(acpi_install_exception_handler) * event. * ******************************************************************************/ + acpi_status acpi_install_fixed_event_handler(u32 event, acpi_event_handler handler, void *context) { acpi_status status; - ACPI_FUNCTION_TRACE(acpi_install_fixed_event_handler); + ACPI_FUNCTION_TRACE("acpi_install_fixed_event_handler"); /* Parameter validation */ @@ -160,7 +161,7 @@ acpi_install_fixed_event_handler(u32 event, return_ACPI_STATUS(status); } -ACPI_EXPORT_SYMBOL(acpi_install_fixed_event_handler) +EXPORT_SYMBOL(acpi_install_fixed_event_handler); /******************************************************************************* * @@ -174,12 +175,13 @@ ACPI_EXPORT_SYMBOL(acpi_install_fixed_event_handler) * DESCRIPTION: Disables the event and unregisters the event handler. * ******************************************************************************/ + acpi_status acpi_remove_fixed_event_handler(u32 event, acpi_event_handler handler) { acpi_status status = AE_OK; - ACPI_FUNCTION_TRACE(acpi_remove_fixed_event_handler); + ACPI_FUNCTION_TRACE("acpi_remove_fixed_event_handler"); /* Parameter validation */ @@ -214,7 +216,7 @@ acpi_remove_fixed_event_handler(u32 event, acpi_event_handler handler) return_ACPI_STATUS(status); } -ACPI_EXPORT_SYMBOL(acpi_remove_fixed_event_handler) +EXPORT_SYMBOL(acpi_remove_fixed_event_handler); /******************************************************************************* * @@ -233,6 +235,7 @@ ACPI_EXPORT_SYMBOL(acpi_remove_fixed_event_handler) * DESCRIPTION: Install a handler for notifies on an ACPI device * ******************************************************************************/ + acpi_status acpi_install_notify_handler(acpi_handle device, u32 handler_type, @@ -243,7 +246,7 @@ acpi_install_notify_handler(acpi_handle device, struct acpi_namespace_node *node; acpi_status status; - ACPI_FUNCTION_TRACE(acpi_install_notify_handler); + ACPI_FUNCTION_TRACE("acpi_install_notify_handler"); /* Parameter validation */ @@ -272,7 +275,6 @@ acpi_install_notify_handler(acpi_handle device, * only one global handler can be regsitered (per notify type). */ if (device == ACPI_ROOT_OBJECT) { - /* Make sure the handler is not already installed */ if (((handler_type & ACPI_SYSTEM_NOTIFY) && @@ -315,7 +317,6 @@ acpi_install_notify_handler(acpi_handle device, obj_desc = acpi_ns_get_attached_object(node); if (obj_desc) { - /* Object exists - make sure there's no handler */ if (((handler_type & ACPI_SYSTEM_NOTIFY) && @@ -369,7 +370,6 @@ acpi_install_notify_handler(acpi_handle device, } if (handler_type == ACPI_ALL_NOTIFY) { - /* Extra ref if installed in both */ acpi_ut_add_reference(notify_obj); @@ -381,7 +381,7 @@ acpi_install_notify_handler(acpi_handle device, return_ACPI_STATUS(status); } -ACPI_EXPORT_SYMBOL(acpi_install_notify_handler) +EXPORT_SYMBOL(acpi_install_notify_handler); /******************************************************************************* * @@ -399,6 +399,7 @@ ACPI_EXPORT_SYMBOL(acpi_install_notify_handler) * DESCRIPTION: Remove a handler for notifies on an ACPI device * ******************************************************************************/ + acpi_status acpi_remove_notify_handler(acpi_handle device, u32 handler_type, acpi_notify_handler handler) @@ -408,7 +409,7 @@ acpi_remove_notify_handler(acpi_handle device, struct acpi_namespace_node *node; acpi_status status; - ACPI_FUNCTION_TRACE(acpi_remove_notify_handler); + ACPI_FUNCTION_TRACE("acpi_remove_notify_handler"); /* Parameter validation */ @@ -534,7 +535,7 @@ acpi_remove_notify_handler(acpi_handle device, return_ACPI_STATUS(status); } -ACPI_EXPORT_SYMBOL(acpi_remove_notify_handler) +EXPORT_SYMBOL(acpi_remove_notify_handler); /******************************************************************************* * @@ -553,6 +554,7 @@ ACPI_EXPORT_SYMBOL(acpi_remove_notify_handler) * DESCRIPTION: Install a handler for a General Purpose Event. * ******************************************************************************/ + acpi_status acpi_install_gpe_handler(acpi_handle gpe_device, u32 gpe_number, @@ -563,7 +565,7 @@ acpi_install_gpe_handler(acpi_handle gpe_device, acpi_status status; acpi_cpu_flags flags; - ACPI_FUNCTION_TRACE(acpi_install_gpe_handler); + ACPI_FUNCTION_TRACE("acpi_install_gpe_handler"); /* Parameter validation */ @@ -594,7 +596,7 @@ acpi_install_gpe_handler(acpi_handle gpe_device, /* Allocate and init handler object */ - handler = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_handler_info)); + handler = ACPI_MEM_CALLOCATE(sizeof(struct acpi_handler_info)); if (!handler) { status = AE_NO_MEMORY; goto unlock_and_exit; @@ -628,7 +630,7 @@ acpi_install_gpe_handler(acpi_handle gpe_device, return_ACPI_STATUS(status); } -ACPI_EXPORT_SYMBOL(acpi_install_gpe_handler) +EXPORT_SYMBOL(acpi_install_gpe_handler); /******************************************************************************* * @@ -644,6 +646,7 @@ ACPI_EXPORT_SYMBOL(acpi_install_gpe_handler) * DESCRIPTION: Remove a handler for a General Purpose acpi_event. * ******************************************************************************/ + acpi_status acpi_remove_gpe_handler(acpi_handle gpe_device, u32 gpe_number, acpi_event_handler address) @@ -653,7 +656,7 @@ acpi_remove_gpe_handler(acpi_handle gpe_device, acpi_status status; acpi_cpu_flags flags; - ACPI_FUNCTION_TRACE(acpi_remove_gpe_handler); + ACPI_FUNCTION_TRACE("acpi_remove_gpe_handler"); /* Parameter validation */ @@ -721,14 +724,14 @@ acpi_remove_gpe_handler(acpi_handle gpe_device, /* Now we can free the handler object */ - ACPI_FREE(handler); + ACPI_MEM_FREE(handler); unlock_and_exit: (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS); return_ACPI_STATUS(status); } -ACPI_EXPORT_SYMBOL(acpi_remove_gpe_handler) +EXPORT_SYMBOL(acpi_remove_gpe_handler); /******************************************************************************* * @@ -743,6 +746,7 @@ ACPI_EXPORT_SYMBOL(acpi_remove_gpe_handler) * DESCRIPTION: Acquire the ACPI Global Lock * ******************************************************************************/ + acpi_status acpi_acquire_global_lock(u16 timeout, u32 * handle) { acpi_status status; @@ -767,7 +771,7 @@ acpi_status acpi_acquire_global_lock(u16 timeout, u32 * handle) return (status); } -ACPI_EXPORT_SYMBOL(acpi_acquire_global_lock) +EXPORT_SYMBOL(acpi_acquire_global_lock); /******************************************************************************* * @@ -780,6 +784,7 @@ ACPI_EXPORT_SYMBOL(acpi_acquire_global_lock) * DESCRIPTION: Release the ACPI Global Lock. The handle must be valid. * ******************************************************************************/ + acpi_status acpi_release_global_lock(u32 handle) { acpi_status status; @@ -792,4 +797,4 @@ acpi_status acpi_release_global_lock(u32 handle) return (status); } -ACPI_EXPORT_SYMBOL(acpi_release_global_lock) +EXPORT_SYMBOL(acpi_release_global_lock); diff --git a/trunk/drivers/acpi/events/evxfevnt.c b/trunk/drivers/acpi/events/evxfevnt.c index 7ebc2efac936..ec9ce8429f15 100644 --- a/trunk/drivers/acpi/events/evxfevnt.c +++ b/trunk/drivers/acpi/events/evxfevnt.c @@ -41,6 +41,8 @@ * POSSIBILITY OF SUCH DAMAGES. */ +#include + #include #include #include @@ -63,7 +65,7 @@ acpi_status acpi_enable(void) { acpi_status status = AE_OK; - ACPI_FUNCTION_TRACE(acpi_enable); + ACPI_FUNCTION_TRACE("acpi_enable"); /* Make sure we have the FADT */ @@ -92,8 +94,6 @@ acpi_status acpi_enable(void) return_ACPI_STATUS(status); } -ACPI_EXPORT_SYMBOL(acpi_enable) - /******************************************************************************* * * FUNCTION: acpi_disable @@ -105,11 +105,12 @@ ACPI_EXPORT_SYMBOL(acpi_enable) * DESCRIPTION: Transfers the system into LEGACY (non-ACPI) mode. * ******************************************************************************/ + acpi_status acpi_disable(void) { acpi_status status = AE_OK; - ACPI_FUNCTION_TRACE(acpi_disable); + ACPI_FUNCTION_TRACE("acpi_disable"); if (!acpi_gbl_FADT) { ACPI_WARNING((AE_INFO, "No FADT information present!")); @@ -136,8 +137,6 @@ acpi_status acpi_disable(void) return_ACPI_STATUS(status); } -ACPI_EXPORT_SYMBOL(acpi_disable) - /******************************************************************************* * * FUNCTION: acpi_enable_event @@ -150,12 +149,13 @@ ACPI_EXPORT_SYMBOL(acpi_disable) * DESCRIPTION: Enable an ACPI event (fixed) * ******************************************************************************/ + acpi_status acpi_enable_event(u32 event, u32 flags) { acpi_status status = AE_OK; u32 value; - ACPI_FUNCTION_TRACE(acpi_enable_event); + ACPI_FUNCTION_TRACE("acpi_enable_event"); /* Decode the Fixed Event */ @@ -193,7 +193,7 @@ acpi_status acpi_enable_event(u32 event, u32 flags) return_ACPI_STATUS(status); } -ACPI_EXPORT_SYMBOL(acpi_enable_event) +EXPORT_SYMBOL(acpi_enable_event); /******************************************************************************* * @@ -208,12 +208,13 @@ ACPI_EXPORT_SYMBOL(acpi_enable_event) * DESCRIPTION: Set the type of an individual GPE * ******************************************************************************/ + acpi_status acpi_set_gpe_type(acpi_handle gpe_device, u32 gpe_number, u8 type) { acpi_status status = AE_OK; struct acpi_gpe_event_info *gpe_event_info; - ACPI_FUNCTION_TRACE(acpi_set_gpe_type); + ACPI_FUNCTION_TRACE("acpi_set_gpe_type"); /* Ensure that we have a valid GPE number */ @@ -235,7 +236,7 @@ acpi_status acpi_set_gpe_type(acpi_handle gpe_device, u32 gpe_number, u8 type) return_ACPI_STATUS(status); } -ACPI_EXPORT_SYMBOL(acpi_set_gpe_type) +EXPORT_SYMBOL(acpi_set_gpe_type); /******************************************************************************* * @@ -251,12 +252,13 @@ ACPI_EXPORT_SYMBOL(acpi_set_gpe_type) * DESCRIPTION: Enable an ACPI event (general purpose) * ******************************************************************************/ + acpi_status acpi_enable_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags) { acpi_status status = AE_OK; struct acpi_gpe_event_info *gpe_event_info; - ACPI_FUNCTION_TRACE(acpi_enable_gpe); + ACPI_FUNCTION_TRACE("acpi_enable_gpe"); /* Use semaphore lock if not executing at interrupt level */ @@ -286,7 +288,7 @@ acpi_status acpi_enable_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags) return_ACPI_STATUS(status); } -ACPI_EXPORT_SYMBOL(acpi_enable_gpe) +EXPORT_SYMBOL(acpi_enable_gpe); /******************************************************************************* * @@ -302,12 +304,13 @@ ACPI_EXPORT_SYMBOL(acpi_enable_gpe) * DESCRIPTION: Disable an ACPI event (general purpose) * ******************************************************************************/ + acpi_status acpi_disable_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags) { acpi_status status = AE_OK; struct acpi_gpe_event_info *gpe_event_info; - ACPI_FUNCTION_TRACE(acpi_disable_gpe); + ACPI_FUNCTION_TRACE("acpi_disable_gpe"); /* Use semaphore lock if not executing at interrupt level */ @@ -335,8 +338,6 @@ acpi_status acpi_disable_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags) return_ACPI_STATUS(status); } -ACPI_EXPORT_SYMBOL(acpi_disable_gpe) - /******************************************************************************* * * FUNCTION: acpi_disable_event @@ -349,12 +350,13 @@ ACPI_EXPORT_SYMBOL(acpi_disable_gpe) * DESCRIPTION: Disable an ACPI event (fixed) * ******************************************************************************/ + acpi_status acpi_disable_event(u32 event, u32 flags) { acpi_status status = AE_OK; u32 value; - ACPI_FUNCTION_TRACE(acpi_disable_event); + ACPI_FUNCTION_TRACE("acpi_disable_event"); /* Decode the Fixed Event */ @@ -390,7 +392,7 @@ acpi_status acpi_disable_event(u32 event, u32 flags) return_ACPI_STATUS(status); } -ACPI_EXPORT_SYMBOL(acpi_disable_event) +EXPORT_SYMBOL(acpi_disable_event); /******************************************************************************* * @@ -403,11 +405,12 @@ ACPI_EXPORT_SYMBOL(acpi_disable_event) * DESCRIPTION: Clear an ACPI event (fixed) * ******************************************************************************/ + acpi_status acpi_clear_event(u32 event) { acpi_status status = AE_OK; - ACPI_FUNCTION_TRACE(acpi_clear_event); + ACPI_FUNCTION_TRACE("acpi_clear_event"); /* Decode the Fixed Event */ @@ -426,7 +429,7 @@ acpi_status acpi_clear_event(u32 event) return_ACPI_STATUS(status); } -ACPI_EXPORT_SYMBOL(acpi_clear_event) +EXPORT_SYMBOL(acpi_clear_event); /******************************************************************************* * @@ -441,12 +444,13 @@ ACPI_EXPORT_SYMBOL(acpi_clear_event) * DESCRIPTION: Clear an ACPI event (general purpose) * ******************************************************************************/ + acpi_status acpi_clear_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags) { acpi_status status = AE_OK; struct acpi_gpe_event_info *gpe_event_info; - ACPI_FUNCTION_TRACE(acpi_clear_gpe); + ACPI_FUNCTION_TRACE("acpi_clear_gpe"); /* Use semaphore lock if not executing at interrupt level */ @@ -474,8 +478,6 @@ acpi_status acpi_clear_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags) return_ACPI_STATUS(status); } -ACPI_EXPORT_SYMBOL(acpi_clear_gpe) - #ifdef ACPI_FUTURE_USAGE /******************************************************************************* * @@ -490,11 +492,12 @@ ACPI_EXPORT_SYMBOL(acpi_clear_gpe) * DESCRIPTION: Obtains and returns the current status of the event * ******************************************************************************/ + acpi_status acpi_get_event_status(u32 event, acpi_event_status * event_status) { acpi_status status = AE_OK; - ACPI_FUNCTION_TRACE(acpi_get_event_status); + ACPI_FUNCTION_TRACE("acpi_get_event_status"); if (!event_status) { return_ACPI_STATUS(AE_BAD_PARAMETER); @@ -515,8 +518,6 @@ acpi_status acpi_get_event_status(u32 event, acpi_event_status * event_status) return_ACPI_STATUS(status); } -ACPI_EXPORT_SYMBOL(acpi_get_event_status) - /******************************************************************************* * * FUNCTION: acpi_get_gpe_status @@ -532,6 +533,7 @@ ACPI_EXPORT_SYMBOL(acpi_get_event_status) * DESCRIPTION: Get status of an event (general purpose) * ******************************************************************************/ + acpi_status acpi_get_gpe_status(acpi_handle gpe_device, u32 gpe_number, u32 flags, acpi_event_status * event_status) @@ -539,7 +541,7 @@ acpi_get_gpe_status(acpi_handle gpe_device, acpi_status status = AE_OK; struct acpi_gpe_event_info *gpe_event_info; - ACPI_FUNCTION_TRACE(acpi_get_gpe_status); + ACPI_FUNCTION_TRACE("acpi_get_gpe_status"); /* Use semaphore lock if not executing at interrupt level */ @@ -568,8 +570,6 @@ acpi_get_gpe_status(acpi_handle gpe_device, } return_ACPI_STATUS(status); } - -ACPI_EXPORT_SYMBOL(acpi_get_gpe_status) #endif /* ACPI_FUTURE_USAGE */ /******************************************************************************* @@ -586,6 +586,7 @@ ACPI_EXPORT_SYMBOL(acpi_get_gpe_status) * DESCRIPTION: Create and Install a block of GPE registers * ******************************************************************************/ + acpi_status acpi_install_gpe_block(acpi_handle gpe_device, struct acpi_generic_address *gpe_block_address, @@ -596,7 +597,7 @@ acpi_install_gpe_block(acpi_handle gpe_device, struct acpi_namespace_node *node; struct acpi_gpe_block_info *gpe_block; - ACPI_FUNCTION_TRACE(acpi_install_gpe_block); + ACPI_FUNCTION_TRACE("acpi_install_gpe_block"); if ((!gpe_device) || (!gpe_block_address) || (!register_count)) { return_ACPI_STATUS(AE_BAD_PARAMETER); @@ -635,7 +636,6 @@ acpi_install_gpe_block(acpi_handle gpe_device, obj_desc = acpi_ns_get_attached_object(node); if (!obj_desc) { - /* No object, create a new one */ obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_DEVICE); @@ -665,7 +665,7 @@ acpi_install_gpe_block(acpi_handle gpe_device, return_ACPI_STATUS(status); } -ACPI_EXPORT_SYMBOL(acpi_install_gpe_block) +EXPORT_SYMBOL(acpi_install_gpe_block); /******************************************************************************* * @@ -678,13 +678,14 @@ ACPI_EXPORT_SYMBOL(acpi_install_gpe_block) * DESCRIPTION: Remove a previously installed block of GPE registers * ******************************************************************************/ + acpi_status acpi_remove_gpe_block(acpi_handle gpe_device) { union acpi_operand_object *obj_desc; acpi_status status; struct acpi_namespace_node *node; - ACPI_FUNCTION_TRACE(acpi_remove_gpe_block); + ACPI_FUNCTION_TRACE("acpi_remove_gpe_block"); if (!gpe_device) { return_ACPI_STATUS(AE_BAD_PARAMETER); @@ -720,4 +721,4 @@ acpi_status acpi_remove_gpe_block(acpi_handle gpe_device) return_ACPI_STATUS(status); } -ACPI_EXPORT_SYMBOL(acpi_remove_gpe_block) +EXPORT_SYMBOL(acpi_remove_gpe_block); diff --git a/trunk/drivers/acpi/events/evxfregn.c b/trunk/drivers/acpi/events/evxfregn.c index e8b86a0baad0..abf5caca9ae5 100644 --- a/trunk/drivers/acpi/events/evxfregn.c +++ b/trunk/drivers/acpi/events/evxfregn.c @@ -42,6 +42,8 @@ * POSSIBILITY OF SUCH DAMAGES. */ +#include + #include #include #include @@ -73,7 +75,7 @@ acpi_install_address_space_handler(acpi_handle device, struct acpi_namespace_node *node; acpi_status status; - ACPI_FUNCTION_TRACE(acpi_install_address_space_handler); + ACPI_FUNCTION_TRACE("acpi_install_address_space_handler"); /* Parameter validation */ @@ -112,7 +114,7 @@ acpi_install_address_space_handler(acpi_handle device, return_ACPI_STATUS(status); } -ACPI_EXPORT_SYMBOL(acpi_install_address_space_handler) +EXPORT_SYMBOL(acpi_install_address_space_handler); /******************************************************************************* * @@ -127,6 +129,7 @@ ACPI_EXPORT_SYMBOL(acpi_install_address_space_handler) * DESCRIPTION: Remove a previously installed handler. * ******************************************************************************/ + acpi_status acpi_remove_address_space_handler(acpi_handle device, acpi_adr_space_type space_id, @@ -139,7 +142,7 @@ acpi_remove_address_space_handler(acpi_handle device, struct acpi_namespace_node *node; acpi_status status; - ACPI_FUNCTION_TRACE(acpi_remove_address_space_handler); + ACPI_FUNCTION_TRACE("acpi_remove_address_space_handler"); /* Parameter validation */ @@ -173,11 +176,9 @@ acpi_remove_address_space_handler(acpi_handle device, handler_obj = obj_desc->device.handler; last_obj_ptr = &obj_desc->device.handler; while (handler_obj) { - /* We have a handler, see if user requested this one */ if (handler_obj->address_space.space_id == space_id) { - /* Matched space_id, first dereference this in the Regions */ ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, @@ -228,7 +229,7 @@ acpi_remove_address_space_handler(acpi_handle device, /* The handler does not exist */ ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, - "Unable to remove address handler %p for %s(%X), DevNode %p, obj %p\n", + "Unable to remove address handler %p for %s(%X), dev_node %p, obj %p\n", handler, acpi_ut_get_region_name(space_id), space_id, node, obj_desc)); @@ -239,4 +240,4 @@ acpi_remove_address_space_handler(acpi_handle device, return_ACPI_STATUS(status); } -ACPI_EXPORT_SYMBOL(acpi_remove_address_space_handler) +EXPORT_SYMBOL(acpi_remove_address_space_handler); diff --git a/trunk/drivers/acpi/executer/exconfig.c b/trunk/drivers/acpi/executer/exconfig.c index 823352435e08..a29782fe3ecf 100644 --- a/trunk/drivers/acpi/executer/exconfig.c +++ b/trunk/drivers/acpi/executer/exconfig.c @@ -82,7 +82,7 @@ acpi_ex_add_table(struct acpi_table_header *table, struct acpi_table_desc table_info; union acpi_operand_object *obj_desc; - ACPI_FUNCTION_TRACE(ex_add_table); + ACPI_FUNCTION_TRACE("ex_add_table"); /* Create an object to be the table handle */ @@ -100,7 +100,7 @@ acpi_ex_add_table(struct acpi_table_header *table, ACPI_MEMSET(&table_info, 0, sizeof(struct acpi_table_desc)); - table_info.type = ACPI_TABLE_ID_SSDT; + table_info.type = ACPI_TABLE_SSDT; table_info.pointer = table; table_info.length = (acpi_size) table->length; table_info.allocation = ACPI_MEM_ALLOCATED; @@ -110,7 +110,6 @@ acpi_ex_add_table(struct acpi_table_header *table, if (ACPI_FAILURE(status)) { if (status == AE_ALREADY_EXISTS) { - /* Table already exists, just return the handle */ return_ACPI_STATUS(AE_OK); @@ -122,7 +121,6 @@ acpi_ex_add_table(struct acpi_table_header *table, status = acpi_ns_load_table(table_info.installed_desc, parent_node); if (ACPI_FAILURE(status)) { - /* Uninstall table on error */ (void)acpi_tb_uninstall_table(table_info.installed_desc); @@ -162,7 +160,7 @@ acpi_ex_load_table_op(struct acpi_walk_state *walk_state, struct acpi_namespace_node *parameter_node = NULL; union acpi_operand_object *ddb_handle; - ACPI_FUNCTION_TRACE(ex_load_table_op); + ACPI_FUNCTION_TRACE("ex_load_table_op"); #if 0 /* @@ -171,7 +169,6 @@ acpi_ex_load_table_op(struct acpi_walk_state *walk_state, */ status = acpi_tb_match_signature(operand[0]->string.pointer, NULL); if (status == AE_OK) { - /* Signature matched -- don't allow override */ return_ACPI_STATUS(AE_ALREADY_EXISTS); @@ -214,8 +211,9 @@ acpi_ex_load_table_op(struct acpi_walk_state *walk_state, * location within the namespace where the table will be loaded. */ status = - acpi_ns_get_node(start_node, operand[3]->string.pointer, - ACPI_NS_SEARCH_PARENT, &parent_node); + acpi_ns_get_node_by_path(operand[3]->string.pointer, + start_node, ACPI_NS_SEARCH_PARENT, + &parent_node); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); } @@ -236,8 +234,9 @@ acpi_ex_load_table_op(struct acpi_walk_state *walk_state, /* Find the node referenced by the parameter_path_string */ status = - acpi_ns_get_node(start_node, operand[4]->string.pointer, - ACPI_NS_SEARCH_PARENT, ¶meter_node); + acpi_ns_get_node_by_path(operand[4]->string.pointer, + start_node, ACPI_NS_SEARCH_PARENT, + ¶meter_node); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); } @@ -253,7 +252,6 @@ acpi_ex_load_table_op(struct acpi_walk_state *walk_state, /* Parameter Data (optional) */ if (parameter_node) { - /* Store the parameter data into the optional parameter object */ status = acpi_ex_store(operand[5], @@ -296,10 +294,9 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc, struct acpi_table_header *table_ptr = NULL; acpi_physical_address address; struct acpi_table_header table_header; - acpi_integer temp; u32 i; - ACPI_FUNCTION_TRACE(ex_load_op); + ACPI_FUNCTION_TRACE("ex_load_op"); /* Object can be either an op_region or a Field */ @@ -325,7 +322,7 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc, address = obj_desc->region.address; - /* Get part of the table header to get the table length */ + /* Get the table length from the table header */ table_header.length = 0; for (i = 0; i < 8; i++) { @@ -333,14 +330,11 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc, acpi_ev_address_space_dispatch(obj_desc, ACPI_READ, (acpi_physical_address) (i + address), 8, - &temp); + ((u8 *) & + table_header) + i); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); } - - /* Get the one valid byte of the returned 64-bit value */ - - ACPI_CAST_PTR(u8, &table_header)[i] = (u8) temp; } /* Sanity check the table length */ @@ -351,7 +345,7 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc, /* Allocate a buffer for the entire table */ - table_ptr = ACPI_ALLOCATE(table_header.length); + table_ptr = ACPI_MEM_ALLOCATE(table_header.length); if (!table_ptr) { return_ACPI_STATUS(AE_NO_MEMORY); } @@ -363,14 +357,11 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc, acpi_ev_address_space_dispatch(obj_desc, ACPI_READ, (acpi_physical_address) (i + address), 8, - &temp); + ((u8 *) table_ptr + + i)); if (ACPI_FAILURE(status)) { goto cleanup; } - - /* Get the one valid byte of the returned 64-bit value */ - - ACPI_CAST_PTR(u8, table_ptr)[i] = (u8) temp; } break; @@ -416,8 +407,12 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc, /* The table must be either an SSDT or a PSDT */ - if ((!ACPI_COMPARE_NAME(table_ptr->signature, PSDT_SIG)) && - (!ACPI_COMPARE_NAME(table_ptr->signature, SSDT_SIG))) { + if ((!ACPI_STRNCMP(table_ptr->signature, + acpi_gbl_table_data[ACPI_TABLE_PSDT].signature, + acpi_gbl_table_data[ACPI_TABLE_PSDT].sig_length)) && + (!ACPI_STRNCMP(table_ptr->signature, + acpi_gbl_table_data[ACPI_TABLE_SSDT].signature, + acpi_gbl_table_data[ACPI_TABLE_SSDT].sig_length))) { ACPI_ERROR((AE_INFO, "Table has invalid signature [%4.4s], must be SSDT or PSDT", table_ptr->signature)); @@ -429,7 +424,6 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc, status = acpi_ex_add_table(table_ptr, acpi_gbl_root_node, &ddb_handle); if (ACPI_FAILURE(status)) { - /* On error, table_ptr was deallocated above */ return_ACPI_STATUS(status); @@ -448,7 +442,7 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc, cleanup: if (ACPI_FAILURE(status)) { - ACPI_FREE(table_ptr); + ACPI_MEM_FREE(table_ptr); } return_ACPI_STATUS(status); } @@ -471,7 +465,7 @@ acpi_status acpi_ex_unload_table(union acpi_operand_object *ddb_handle) union acpi_operand_object *table_desc = ddb_handle; struct acpi_table_desc *table_info; - ACPI_FUNCTION_TRACE(ex_unload_table); + ACPI_FUNCTION_TRACE("ex_unload_table"); /* * Validate the handle diff --git a/trunk/drivers/acpi/executer/exconvrt.c b/trunk/drivers/acpi/executer/exconvrt.c index b732e399b1ef..e6d52e12d77a 100644 --- a/trunk/drivers/acpi/executer/exconvrt.c +++ b/trunk/drivers/acpi/executer/exconvrt.c @@ -79,7 +79,7 @@ acpi_ex_convert_to_integer(union acpi_operand_object *obj_desc, u32 count; acpi_status status; - ACPI_FUNCTION_TRACE_PTR(ex_convert_to_integer, obj_desc); + ACPI_FUNCTION_TRACE_PTR("ex_convert_to_integer", obj_desc); switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { case ACPI_TYPE_INTEGER: @@ -199,7 +199,7 @@ acpi_ex_convert_to_buffer(union acpi_operand_object *obj_desc, union acpi_operand_object *return_desc; u8 *new_buf; - ACPI_FUNCTION_TRACE_PTR(ex_convert_to_buffer, obj_desc); + ACPI_FUNCTION_TRACE_PTR("ex_convert_to_buffer", obj_desc); switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { case ACPI_TYPE_BUFFER: @@ -319,7 +319,6 @@ acpi_ex_convert_to_ascii(acpi_integer integer, remainder = 0; for (i = decimal_length; i > 0; i--) { - /* Divide by nth factor of 10 */ digit = integer; @@ -347,7 +346,6 @@ acpi_ex_convert_to_ascii(acpi_integer integer, hex_length = (acpi_native_uint) ACPI_MUL_2(data_width); for (i = 0, j = (hex_length - 1); i < hex_length; i++, j--) { - /* Get one hex digit, most significant digits first */ string[k] = @@ -402,7 +400,7 @@ acpi_ex_convert_to_string(union acpi_operand_object * obj_desc, u16 base = 16; u8 separator = ','; - ACPI_FUNCTION_TRACE_PTR(ex_convert_to_string, obj_desc); + ACPI_FUNCTION_TRACE_PTR("ex_convert_to_string", obj_desc); switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { case ACPI_TYPE_STRING: @@ -569,7 +567,7 @@ acpi_ex_convert_to_target_type(acpi_object_type destination_type, { acpi_status status = AE_OK; - ACPI_FUNCTION_TRACE(ex_convert_to_target_type); + ACPI_FUNCTION_TRACE("ex_convert_to_target_type"); /* Default behavior */ @@ -659,7 +657,7 @@ acpi_ex_convert_to_target_type(acpi_object_type destination_type, default: ACPI_ERROR((AE_INFO, - "Unknown Target type ID 0x%X AmlOpcode %X DestType %s", + "Unknown Target type ID 0x%X aml_opcode %X dest_type %s", GET_CURRENT_ARG_TYPE(walk_state->op_info-> runtime_args), walk_state->opcode, diff --git a/trunk/drivers/acpi/executer/excreate.c b/trunk/drivers/acpi/executer/excreate.c index 106dc7219df7..680575402835 100644 --- a/trunk/drivers/acpi/executer/excreate.c +++ b/trunk/drivers/acpi/executer/excreate.c @@ -69,7 +69,7 @@ acpi_status acpi_ex_create_alias(struct acpi_walk_state *walk_state) struct acpi_namespace_node *alias_node; acpi_status status = AE_OK; - ACPI_FUNCTION_TRACE(ex_create_alias); + ACPI_FUNCTION_TRACE("ex_create_alias"); /* Get the source/alias operands (both namespace nodes) */ @@ -164,7 +164,7 @@ acpi_status acpi_ex_create_event(struct acpi_walk_state *walk_state) acpi_status status; union acpi_operand_object *obj_desc; - ACPI_FUNCTION_TRACE(ex_create_event); + ACPI_FUNCTION_TRACE("ex_create_event"); obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_EVENT); if (!obj_desc) { @@ -216,7 +216,7 @@ acpi_status acpi_ex_create_mutex(struct acpi_walk_state *walk_state) acpi_status status = AE_OK; union acpi_operand_object *obj_desc; - ACPI_FUNCTION_TRACE_PTR(ex_create_mutex, ACPI_WALK_OPERANDS); + ACPI_FUNCTION_TRACE_PTR("ex_create_mutex", ACPI_WALK_OPERANDS); /* Create the new mutex object */ @@ -243,9 +243,8 @@ acpi_status acpi_ex_create_mutex(struct acpi_walk_state *walk_state) obj_desc->mutex.node = (struct acpi_namespace_node *)walk_state->operands[0]; - status = - acpi_ns_attach_object(obj_desc->mutex.node, obj_desc, - ACPI_TYPE_MUTEX); + status = acpi_ns_attach_object(obj_desc->mutex.node, + obj_desc, ACPI_TYPE_MUTEX); cleanup: /* @@ -281,7 +280,7 @@ acpi_ex_create_region(u8 * aml_start, struct acpi_namespace_node *node; union acpi_operand_object *region_obj2; - ACPI_FUNCTION_TRACE(ex_create_region); + ACPI_FUNCTION_TRACE("ex_create_region"); /* Get the Namespace Node */ @@ -301,7 +300,7 @@ acpi_ex_create_region(u8 * aml_start, */ if ((region_space >= ACPI_NUM_PREDEFINED_REGIONS) && (region_space < ACPI_USER_REGION_BEGIN)) { - ACPI_ERROR((AE_INFO, "Invalid AddressSpace type %X", + ACPI_ERROR((AE_INFO, "Invalid address_space type %X", region_space)); return_ACPI_STATUS(AE_AML_INVALID_SPACE_ID); } @@ -365,7 +364,7 @@ acpi_status acpi_ex_create_table_region(struct acpi_walk_state *walk_state) struct acpi_table_header *table; union acpi_operand_object *region_obj2; - ACPI_FUNCTION_TRACE(ex_create_table_region); + ACPI_FUNCTION_TRACE("ex_create_table_region"); /* Get the Node from the object stack */ @@ -453,7 +452,7 @@ acpi_status acpi_ex_create_processor(struct acpi_walk_state *walk_state) union acpi_operand_object *obj_desc; acpi_status status; - ACPI_FUNCTION_TRACE_PTR(ex_create_processor, walk_state); + ACPI_FUNCTION_TRACE_PTR("ex_create_processor", walk_state); /* Create the processor object */ @@ -465,9 +464,9 @@ acpi_status acpi_ex_create_processor(struct acpi_walk_state *walk_state) /* Initialize the processor object from the operands */ obj_desc->processor.proc_id = (u8) operand[1]->integer.value; - obj_desc->processor.length = (u8) operand[3]->integer.value; obj_desc->processor.address = (acpi_io_address) operand[2]->integer.value; + obj_desc->processor.length = (u8) operand[3]->integer.value; /* Install the processor object in the parent Node */ @@ -500,7 +499,7 @@ acpi_status acpi_ex_create_power_resource(struct acpi_walk_state *walk_state) acpi_status status; union acpi_operand_object *obj_desc; - ACPI_FUNCTION_TRACE_PTR(ex_create_power_resource, walk_state); + ACPI_FUNCTION_TRACE_PTR("ex_create_power_resource", walk_state); /* Create the power resource object */ @@ -550,7 +549,7 @@ acpi_ex_create_method(u8 * aml_start, acpi_status status; u8 method_flags; - ACPI_FUNCTION_TRACE_PTR(ex_create_method, walk_state); + ACPI_FUNCTION_TRACE_PTR("ex_create_method", walk_state); /* Create a new method object */ diff --git a/trunk/drivers/acpi/executer/exdump.c b/trunk/drivers/acpi/executer/exdump.c index 7b9718e976bf..a7cca8d4f855 100644 --- a/trunk/drivers/acpi/executer/exdump.c +++ b/trunk/drivers/acpi/executer/exdump.c @@ -61,10 +61,6 @@ static void acpi_ex_out_pointer(char *title, void *value); static void acpi_ex_out_address(char *title, acpi_physical_address value); -static void -acpi_ex_dump_object(union acpi_operand_object *obj_desc, - struct acpi_exdump_info *info); - static void acpi_ex_dump_reference_obj(union acpi_operand_object *obj_desc); static void @@ -123,7 +119,7 @@ static struct acpi_exdump_info acpi_ex_dump_event[2] = { static struct acpi_exdump_info acpi_ex_dump_method[8] = { {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_method), NULL}, - {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(method.param_count), "ParamCount"}, + {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(method.param_count), "param_count"}, {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(method.concurrency), "Concurrency"}, {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(method.semaphore), "Semaphore"}, {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(method.owner_id), "Owner Id"}, @@ -267,10 +263,12 @@ static struct acpi_exdump_info acpi_ex_dump_field_common[7] = { {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(common_field.node), "Parent Node"} }; -static struct acpi_exdump_info acpi_ex_dump_node[5] = { +static struct acpi_exdump_info acpi_ex_dump_node[6] = { {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_node), NULL}, {ACPI_EXD_UINT8, ACPI_EXD_NSOFFSET(flags), "Flags"}, {ACPI_EXD_UINT8, ACPI_EXD_NSOFFSET(owner_id), "Owner Id"}, + {ACPI_EXD_UINT16, ACPI_EXD_NSOFFSET(reference_count), + "Reference Count"}, {ACPI_EXD_POINTER, ACPI_EXD_NSOFFSET(child), "Child List"}, {ACPI_EXD_POINTER, ACPI_EXD_NSOFFSET(peer), "Next Peer"} }; @@ -332,7 +330,7 @@ acpi_ex_dump_object(union acpi_operand_object *obj_desc, if (!info) { acpi_os_printf - ("ExDumpObject: Display not implemented for object type %s\n", + ("ex_dump_object: Display not implemented for object type %s\n", acpi_ut_get_object_type_name(obj_desc)); return; } @@ -456,7 +454,7 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth) u32 length; u32 index; - ACPI_FUNCTION_NAME(ex_dump_operand) + ACPI_FUNCTION_NAME("ex_dump_operand") if (! ((ACPI_LV_EXEC & acpi_dbg_level) @@ -465,7 +463,6 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth) } if (!obj_desc) { - /* This could be a null element of a package */ ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Null Object Descriptor\n")); @@ -525,7 +522,7 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth) case AML_REF_OF_OP: - acpi_os_printf("Reference: (RefOf) %p\n", + acpi_os_printf("Reference: (ref_of) %p\n", obj_desc->reference.object); break; @@ -535,7 +532,6 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth) obj_desc->reference.offset); if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) { - /* Value is an Integer */ acpi_os_printf(" value is [%8.8X%8.8x]", @@ -614,7 +610,7 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth) case ACPI_TYPE_PACKAGE: - acpi_os_printf("Package [Len %X] ElementArray %p\n", + acpi_os_printf("Package [Len %X] element_array %p\n", obj_desc->package.count, obj_desc->package.elements); @@ -666,13 +662,13 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth) case ACPI_TYPE_LOCAL_BANK_FIELD: - acpi_os_printf("BankField\n"); + acpi_os_printf("bank_field\n"); break; case ACPI_TYPE_LOCAL_REGION_FIELD: acpi_os_printf - ("RegionField: Bits=%X AccWidth=%X Lock=%X Update=%X at byte=%X bit=%X of below:\n", + ("region_field: Bits=%X acc_width=%X Lock=%X Update=%X at byte=%X bit=%X of below:\n", obj_desc->field.bit_length, obj_desc->field.access_byte_width, obj_desc->field.field_flags & AML_FIELD_LOCK_RULE_MASK, @@ -685,12 +681,12 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth) case ACPI_TYPE_LOCAL_INDEX_FIELD: - acpi_os_printf("IndexField\n"); + acpi_os_printf("index_field\n"); break; case ACPI_TYPE_BUFFER_FIELD: - acpi_os_printf("BufferField: %X bits at byte %X bit %X of\n", + acpi_os_printf("buffer_field: %X bits at byte %X bit %X of\n", obj_desc->buffer_field.bit_length, obj_desc->buffer_field.base_byte_offset, obj_desc->buffer_field.start_field_bit_offset); @@ -781,7 +777,7 @@ acpi_ex_dump_operands(union acpi_operand_object **operands, { acpi_native_uint i; - ACPI_FUNCTION_NAME(ex_dump_operands); + ACPI_FUNCTION_NAME("ex_dump_operands"); if (!ident) { ident = "?"; @@ -905,7 +901,7 @@ static void acpi_ex_dump_reference_obj(union acpi_operand_object *obj_desc) acpi_os_printf("Could not convert name to pathname\n"); } else { acpi_os_printf("%s\n", (char *)ret_buf.pointer); - ACPI_FREE(ret_buf.pointer); + ACPI_MEM_FREE(ret_buf.pointer); } } else if (obj_desc->reference.object) { acpi_os_printf("\nReferenced Object: %p\n", @@ -1021,7 +1017,7 @@ acpi_ex_dump_package_obj(union acpi_operand_object *obj_desc, void acpi_ex_dump_object_descriptor(union acpi_operand_object *obj_desc, u32 flags) { - ACPI_FUNCTION_TRACE(ex_dump_object_descriptor); + ACPI_FUNCTION_TRACE("ex_dump_object_descriptor"); if (!obj_desc) { return_VOID; @@ -1050,7 +1046,7 @@ acpi_ex_dump_object_descriptor(union acpi_operand_object *obj_desc, u32 flags) if (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) != ACPI_DESC_TYPE_OPERAND) { acpi_os_printf - ("ExDumpObjectDescriptor: %p is not an ACPI operand object: [%s]\n", + ("ex_dump_object_descriptor: %p is not an ACPI operand object: [%s]\n", obj_desc, acpi_ut_get_descriptor_name(obj_desc)); return_VOID; } diff --git a/trunk/drivers/acpi/executer/exfield.c b/trunk/drivers/acpi/executer/exfield.c index 9ea9c3a67ca9..e259201ce9a0 100644 --- a/trunk/drivers/acpi/executer/exfield.c +++ b/trunk/drivers/acpi/executer/exfield.c @@ -73,7 +73,7 @@ acpi_ex_read_data_from_field(struct acpi_walk_state *walk_state, void *buffer; u8 locked; - ACPI_FUNCTION_TRACE_PTR(ex_read_data_from_field, obj_desc); + ACPI_FUNCTION_TRACE_PTR("ex_read_data_from_field", obj_desc); /* Parameter validation */ @@ -142,7 +142,6 @@ acpi_ex_read_data_from_field(struct acpi_walk_state *walk_state, length = (acpi_size) ACPI_ROUND_BITS_UP_TO_BYTES(obj_desc->field.bit_length); if (length > acpi_gbl_integer_byte_width) { - /* Field is too large for an Integer, create a Buffer instead */ buffer_desc = acpi_ut_create_buffer_object(length); @@ -164,11 +163,11 @@ acpi_ex_read_data_from_field(struct acpi_walk_state *walk_state, } ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, - "FieldRead [TO]: Obj %p, Type %X, Buf %p, ByteLen %X\n", + "field_read [TO]: Obj %p, Type %X, Buf %p, byte_len %X\n", obj_desc, ACPI_GET_OBJECT_TYPE(obj_desc), buffer, (u32) length)); ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, - "FieldRead [FROM]: BitLen %X, BitOff %X, ByteOff %X\n", + "field_read [FROM]: bit_len %X, bit_off %X, byte_off %X\n", obj_desc->common_field.bit_length, obj_desc->common_field.start_field_bit_offset, obj_desc->common_field.base_byte_offset)); @@ -220,7 +219,7 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc, u8 locked; union acpi_operand_object *buffer_desc; - ACPI_FUNCTION_TRACE_PTR(ex_write_data_to_field, obj_desc); + ACPI_FUNCTION_TRACE_PTR("ex_write_data_to_field", obj_desc); /* Parameter validation */ @@ -330,10 +329,9 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc, ACPI_ROUND_BITS_UP_TO_BYTES(obj_desc->common_field.bit_length); if (length < required_length) { - /* We need to create a new buffer */ - new_buffer = ACPI_ALLOCATE_ZEROED(required_length); + new_buffer = ACPI_MEM_CALLOCATE(required_length); if (!new_buffer) { return_ACPI_STATUS(AE_NO_MEMORY); } @@ -349,14 +347,14 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc, } ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, - "FieldWrite [FROM]: Obj %p (%s:%X), Buf %p, ByteLen %X\n", + "field_write [FROM]: Obj %p (%s:%X), Buf %p, byte_len %X\n", source_desc, acpi_ut_get_type_name(ACPI_GET_OBJECT_TYPE (source_desc)), ACPI_GET_OBJECT_TYPE(source_desc), buffer, length)); ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, - "FieldWrite [TO]: Obj %p (%s:%X), BitLen %X, BitOff %X, ByteOff %X\n", + "field_write [TO]: Obj %p (%s:%X), bit_len %X, bit_off %X, byte_off %X\n", obj_desc, acpi_ut_get_type_name(ACPI_GET_OBJECT_TYPE(obj_desc)), ACPI_GET_OBJECT_TYPE(obj_desc), @@ -377,7 +375,7 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc, /* Free temporary buffer if we used one */ if (new_buffer) { - ACPI_FREE(new_buffer); + ACPI_MEM_FREE(new_buffer); } return_ACPI_STATUS(status); diff --git a/trunk/drivers/acpi/executer/exfldio.c b/trunk/drivers/acpi/executer/exfldio.c index 051053f7cccb..bd1af35f7fcf 100644 --- a/trunk/drivers/acpi/executer/exfldio.c +++ b/trunk/drivers/acpi/executer/exfldio.c @@ -87,7 +87,7 @@ acpi_ex_setup_region(union acpi_operand_object *obj_desc, acpi_status status = AE_OK; union acpi_operand_object *rgn_desc; - ACPI_FUNCTION_TRACE_U32(ex_setup_region, field_datum_byte_offset); + ACPI_FUNCTION_TRACE_U32("ex_setup_region", field_datum_byte_offset); rgn_desc = obj_desc->common_field.region_obj; @@ -112,18 +112,7 @@ acpi_ex_setup_region(union acpi_operand_object *obj_desc, } } - /* Exit if Address/Length have been disallowed by the host OS */ - - if (rgn_desc->common.flags & AOPOBJ_INVALID) { - return_ACPI_STATUS(AE_AML_ILLEGAL_ADDRESS); - } - - /* - * Exit now for SMBus address space, it has a non-linear address space - * and the request cannot be directly validated - */ if (rgn_desc->region.space_id == ACPI_ADR_SPACE_SMBUS) { - /* SMBus has a non-linear address space */ return_ACPI_STATUS(AE_OK); @@ -145,10 +134,10 @@ acpi_ex_setup_region(union acpi_operand_object *obj_desc, * length of one field datum (access width) must fit within the region. * (Region length is specified in bytes) */ - if (rgn_desc->region.length < - (obj_desc->common_field.base_byte_offset + - field_datum_byte_offset + - obj_desc->common_field.access_byte_width)) { + if (rgn_desc->region.length < (obj_desc->common_field.base_byte_offset + + field_datum_byte_offset + + obj_desc->common_field. + access_byte_width)) { if (acpi_gbl_enable_interpreter_slack) { /* * Slack mode only: We will go ahead and allow access to this @@ -228,7 +217,7 @@ acpi_ex_access_region(union acpi_operand_object *obj_desc, union acpi_operand_object *rgn_desc; acpi_physical_address address; - ACPI_FUNCTION_TRACE(ex_access_region); + ACPI_FUNCTION_TRACE("ex_access_region"); /* * Ensure that the region operands are fully evaluated and verify @@ -257,7 +246,7 @@ acpi_ex_access_region(union acpi_operand_object *obj_desc, } ACPI_DEBUG_PRINT_RAW((ACPI_DB_BFIELD, - " Region [%s:%X], Width %X, ByteBase %X, Offset %X at %8.8X%8.8X\n", + " Region [%s:%X], Width %X, byte_base %X, Offset %X at %8.8X%8.8X\n", acpi_ut_get_region_name(rgn_desc->region. space_id), rgn_desc->region.space_id, @@ -363,7 +352,7 @@ acpi_ex_field_datum_io(union acpi_operand_object *obj_desc, acpi_status status; acpi_integer local_value; - ACPI_FUNCTION_TRACE_U32(ex_field_datum_io, field_datum_byte_offset); + ACPI_FUNCTION_TRACE_U32("ex_field_datum_io", field_datum_byte_offset); if (read_write == ACPI_READ) { if (!value) { @@ -498,11 +487,10 @@ acpi_ex_field_datum_io(union acpi_operand_object *obj_desc, } ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, - "I/O to Data Register: ValuePtr %p\n", + "I/O to Data Register: value_ptr %p\n", value)); if (read_write == ACPI_READ) { - /* Read the datum from the data_register */ status = @@ -571,7 +559,7 @@ acpi_ex_write_with_update_rule(union acpi_operand_object *obj_desc, acpi_integer merged_value; acpi_integer current_value; - ACPI_FUNCTION_TRACE_U32(ex_write_with_update_rule, mask); + ACPI_FUNCTION_TRACE_U32("ex_write_with_update_rule", mask); /* Start with the new bits */ @@ -580,7 +568,6 @@ acpi_ex_write_with_update_rule(union acpi_operand_object *obj_desc, /* If the mask is all ones, we don't need to worry about the update rule */ if (mask != ACPI_INTEGER_MAX) { - /* Decode the update rule */ switch (obj_desc->common_field. @@ -627,7 +614,7 @@ acpi_ex_write_with_update_rule(union acpi_operand_object *obj_desc, default: ACPI_ERROR((AE_INFO, - "Unknown UpdateRule value: %X", + "Unknown update_rule value: %X", (obj_desc->common_field. field_flags & AML_FIELD_UPDATE_RULE_MASK))); @@ -636,7 +623,7 @@ acpi_ex_write_with_update_rule(union acpi_operand_object *obj_desc, } ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, - "Mask %8.8X%8.8X, DatumOffset %X, Width %X, Value %8.8X%8.8X, MergedValue %8.8X%8.8X\n", + "Mask %8.8X%8.8X, datum_offset %X, Width %X, Value %8.8X%8.8X, merged_value %8.8X%8.8X\n", ACPI_FORMAT_UINT64(mask), field_datum_byte_offset, obj_desc->common_field.access_byte_width, @@ -679,7 +666,7 @@ acpi_ex_extract_from_field(union acpi_operand_object *obj_desc, u32 field_datum_count; u32 i; - ACPI_FUNCTION_TRACE(ex_extract_from_field); + ACPI_FUNCTION_TRACE("ex_extract_from_field"); /* Validate target buffer and clear it */ @@ -717,7 +704,6 @@ acpi_ex_extract_from_field(union acpi_operand_object *obj_desc, /* Read the rest of the field */ for (i = 1; i < field_datum_count; i++) { - /* Get next input datum from the field */ field_offset += obj_desc->common_field.access_byte_width; @@ -785,7 +771,6 @@ acpi_ex_insert_into_field(union acpi_operand_object *obj_desc, { acpi_status status; acpi_integer mask; - acpi_integer width_mask; acpi_integer merged_datum; acpi_integer raw_datum = 0; u32 field_offset = 0; @@ -795,7 +780,7 @@ acpi_ex_insert_into_field(union acpi_operand_object *obj_desc, u32 field_datum_count; u32 i; - ACPI_FUNCTION_TRACE(ex_insert_into_field); + ACPI_FUNCTION_TRACE("ex_insert_into_field"); /* Validate input buffer */ @@ -810,20 +795,15 @@ acpi_ex_insert_into_field(union acpi_operand_object *obj_desc, /* Compute the number of datums (access width data items) */ - width_mask = - ACPI_MASK_BITS_ABOVE(obj_desc->common_field.access_bit_width); mask = - width_mask & ACPI_MASK_BITS_BELOW(obj_desc->common_field. - start_field_bit_offset); - - datum_count = ACPI_ROUND_UP_TO(obj_desc->common_field.bit_length, - obj_desc->common_field.access_bit_width); - - field_datum_count = ACPI_ROUND_UP_TO(obj_desc->common_field.bit_length + - obj_desc->common_field. - start_field_bit_offset, - obj_desc->common_field. - access_bit_width); + ACPI_MASK_BITS_BELOW(obj_desc->common_field.start_field_bit_offset); + datum_count = + ACPI_ROUND_UP_TO(obj_desc->common_field.bit_length, + obj_desc->common_field.access_bit_width); + field_datum_count = + ACPI_ROUND_UP_TO(obj_desc->common_field.bit_length + + obj_desc->common_field.start_field_bit_offset, + obj_desc->common_field.access_bit_width); /* Get initial Datum from the input buffer */ @@ -837,7 +817,6 @@ acpi_ex_insert_into_field(union acpi_operand_object *obj_desc, /* Write the entire field */ for (i = 1; i < field_datum_count; i++) { - /* Write merged datum to the target field */ merged_datum &= mask; @@ -854,7 +833,7 @@ acpi_ex_insert_into_field(union acpi_operand_object *obj_desc, merged_datum = raw_datum >> (obj_desc->common_field.access_bit_width - obj_desc->common_field.start_field_bit_offset); - mask = width_mask; + mask = ACPI_INTEGER_MAX; if (i == datum_count) { break; diff --git a/trunk/drivers/acpi/executer/exmisc.c b/trunk/drivers/acpi/executer/exmisc.c index bd98aab017cf..48c18d29222a 100644 --- a/trunk/drivers/acpi/executer/exmisc.c +++ b/trunk/drivers/acpi/executer/exmisc.c @@ -72,7 +72,7 @@ acpi_ex_get_object_reference(union acpi_operand_object *obj_desc, union acpi_operand_object *reference_obj; union acpi_operand_object *referenced_obj; - ACPI_FUNCTION_TRACE_PTR(ex_get_object_reference, obj_desc); + ACPI_FUNCTION_TRACE_PTR("ex_get_object_reference", obj_desc); *return_desc = NULL; @@ -168,7 +168,7 @@ acpi_ex_concat_template(union acpi_operand_object *operand0, acpi_size length1; acpi_size new_length; - ACPI_FUNCTION_TRACE(ex_concat_template); + ACPI_FUNCTION_TRACE("ex_concat_template"); /* * Find the end_tag descriptor in each resource template. @@ -250,7 +250,7 @@ acpi_ex_do_concatenate(union acpi_operand_object *operand0, char *new_buf; acpi_status status; - ACPI_FUNCTION_TRACE(ex_do_concatenate); + ACPI_FUNCTION_TRACE("ex_do_concatenate"); /* * Convert the second operand if necessary. The first operand @@ -445,24 +445,10 @@ acpi_ex_do_math_op(u16 opcode, acpi_integer integer0, acpi_integer integer1) case AML_SHIFT_LEFT_OP: /* shift_left (Operand, shift_count, Result) */ - /* - * We need to check if the shiftcount is larger than the integer bit - * width since the behavior of this is not well-defined in the C language. - */ - if (integer1 >= acpi_gbl_integer_bit_width) { - return (0); - } return (integer0 << integer1); case AML_SHIFT_RIGHT_OP: /* shift_right (Operand, shift_count, Result) */ - /* - * We need to check if the shiftcount is larger than the integer bit - * width since the behavior of this is not well-defined in the C language. - */ - if (integer1 >= acpi_gbl_integer_bit_width) { - return (0); - } return (integer0 >> integer1); case AML_SUBTRACT_OP: /* Subtract (Integer0, Integer1, Result) */ @@ -503,7 +489,7 @@ acpi_ex_do_logical_numeric_op(u16 opcode, acpi_status status = AE_OK; u8 local_result = FALSE; - ACPI_FUNCTION_TRACE(ex_do_logical_numeric_op); + ACPI_FUNCTION_TRACE("ex_do_logical_numeric_op"); switch (opcode) { case AML_LAND_OP: /* LAnd (Integer0, Integer1) */ @@ -571,7 +557,7 @@ acpi_ex_do_logical_op(u16 opcode, u8 local_result = FALSE; int compare; - ACPI_FUNCTION_TRACE(ex_do_logical_op); + ACPI_FUNCTION_TRACE("ex_do_logical_op"); /* * Convert the second operand if necessary. The first operand @@ -663,7 +649,6 @@ acpi_ex_do_logical_op(u16 opcode, /* Length and all bytes must be equal */ if ((length0 == length1) && (compare == 0)) { - /* Length and all bytes match ==> TRUE */ local_result = TRUE; diff --git a/trunk/drivers/acpi/executer/exmutex.c b/trunk/drivers/acpi/executer/exmutex.c index 93098d68cadf..f843b22e20b9 100644 --- a/trunk/drivers/acpi/executer/exmutex.c +++ b/trunk/drivers/acpi/executer/exmutex.c @@ -61,7 +61,7 @@ acpi_ex_link_mutex(union acpi_operand_object *obj_desc, * * RETURN: None * - * DESCRIPTION: Remove a mutex from the "AcquiredMutex" list + * DESCRIPTION: Remove a mutex from the "acquired_mutex" list * ******************************************************************************/ @@ -95,7 +95,7 @@ void acpi_ex_unlink_mutex(union acpi_operand_object *obj_desc) * * RETURN: None * - * DESCRIPTION: Add a mutex to the "AcquiredMutex" list for this walk + * DESCRIPTION: Add a mutex to the "acquired_mutex" list for this walk * ******************************************************************************/ @@ -144,7 +144,7 @@ acpi_ex_acquire_mutex(union acpi_operand_object *time_desc, { acpi_status status; - ACPI_FUNCTION_TRACE_PTR(ex_acquire_mutex, obj_desc); + ACPI_FUNCTION_TRACE_PTR("ex_acquire_mutex", obj_desc); if (!obj_desc) { return_ACPI_STATUS(AE_BAD_PARAMETER); @@ -165,7 +165,7 @@ acpi_ex_acquire_mutex(union acpi_operand_object *time_desc, */ if (walk_state->thread->current_sync_level > obj_desc->mutex.sync_level) { ACPI_ERROR((AE_INFO, - "Cannot acquire Mutex [%4.4s], incorrect SyncLevel", + "Cannot acquire Mutex [%4.4s], incorrect sync_level", acpi_ut_get_node_name(obj_desc->mutex.node))); return_ACPI_STATUS(AE_AML_MUTEX_ORDER); } @@ -173,7 +173,6 @@ acpi_ex_acquire_mutex(union acpi_operand_object *time_desc, /* Support for multiple acquires by the owning thread */ if (obj_desc->mutex.owner_thread) { - /* Special case for Global Lock, allow all threads */ if ((obj_desc->mutex.owner_thread->thread_id == @@ -193,7 +192,6 @@ acpi_ex_acquire_mutex(union acpi_operand_object *time_desc, status = acpi_ex_system_acquire_mutex(time_desc, obj_desc); if (ACPI_FAILURE(status)) { - /* Includes failure from a timeout on time_desc */ return_ACPI_STATUS(status); @@ -234,7 +232,7 @@ acpi_ex_release_mutex(union acpi_operand_object *obj_desc, { acpi_status status; - ACPI_FUNCTION_TRACE(ex_release_mutex); + ACPI_FUNCTION_TRACE("ex_release_mutex"); if (!obj_desc) { return_ACPI_STATUS(AE_BAD_PARAMETER); @@ -279,7 +277,7 @@ acpi_ex_release_mutex(union acpi_operand_object *obj_desc, */ if (obj_desc->mutex.sync_level > walk_state->thread->current_sync_level) { ACPI_ERROR((AE_INFO, - "Cannot release Mutex [%4.4s], incorrect SyncLevel", + "Cannot release Mutex [%4.4s], incorrect sync_level", acpi_ut_get_node_name(obj_desc->mutex.node))); return_ACPI_STATUS(AE_AML_MUTEX_ORDER); } @@ -288,7 +286,6 @@ acpi_ex_release_mutex(union acpi_operand_object *obj_desc, obj_desc->mutex.acquisition_depth--; if (obj_desc->mutex.acquisition_depth != 0) { - /* Just decrement the depth and return */ return_ACPI_STATUS(AE_OK); diff --git a/trunk/drivers/acpi/executer/exnames.c b/trunk/drivers/acpi/executer/exnames.c index d3d70364626c..054fe5e1a314 100644 --- a/trunk/drivers/acpi/executer/exnames.c +++ b/trunk/drivers/acpi/executer/exnames.c @@ -77,7 +77,7 @@ static char *acpi_ex_allocate_name_string(u32 prefix_count, u32 num_name_segs) char *name_string; u32 size_needed; - ACPI_FUNCTION_TRACE(ex_allocate_name_string); + ACPI_FUNCTION_TRACE("ex_allocate_name_string"); /* * Allow room for all \ and ^ prefixes, all segments and a multi_name_prefix. @@ -85,7 +85,6 @@ static char *acpi_ex_allocate_name_string(u32 prefix_count, u32 num_name_segs) * This may actually be somewhat longer than needed. */ if (prefix_count == ACPI_UINT32_MAX) { - /* Special case for root */ size_needed = 1 + (ACPI_NAME_SIZE * num_name_segs) + 2 + 1; @@ -98,7 +97,7 @@ static char *acpi_ex_allocate_name_string(u32 prefix_count, u32 num_name_segs) * Allocate a buffer for the name. * This buffer must be deleted by the caller! */ - name_string = ACPI_ALLOCATE(size_needed); + name_string = ACPI_MEM_ALLOCATE(size_needed); if (!name_string) { ACPI_ERROR((AE_INFO, "Could not allocate size %d", size_needed)); @@ -120,13 +119,11 @@ static char *acpi_ex_allocate_name_string(u32 prefix_count, u32 num_name_segs) /* Set up Dual or Multi prefixes if needed */ if (num_name_segs > 2) { - /* Set up multi prefixes */ *temp_ptr++ = AML_MULTI_NAME_PREFIX_OP; *temp_ptr++ = (char)num_name_segs; } else if (2 == num_name_segs) { - /* Set up dual prefixes */ *temp_ptr++ = AML_DUAL_NAME_PREFIX; @@ -162,7 +159,7 @@ static acpi_status acpi_ex_name_segment(u8 ** in_aml_address, char *name_string) u32 index; char char_buf[5]; - ACPI_FUNCTION_TRACE(ex_name_segment); + ACPI_FUNCTION_TRACE("ex_name_segment"); /* * If first character is a digit, then we know that we aren't looking at a @@ -179,7 +176,7 @@ static acpi_status acpi_ex_name_segment(u8 ** in_aml_address, char *name_string) for (index = 0; (index < ACPI_NAME_SIZE) - && (acpi_ut_valid_acpi_char(*aml_address, 0)); index++) { + && (acpi_ut_valid_acpi_character(*aml_address)); index++) { char_buf[index] = *aml_address++; ACPI_DEBUG_PRINT((ACPI_DB_LOAD, "%c\n", char_buf[index])); } @@ -187,7 +184,6 @@ static acpi_status acpi_ex_name_segment(u8 ** in_aml_address, char *name_string) /* Valid name segment */ if (index == 4) { - /* Found 4 valid characters */ char_buf[4] = '\0'; @@ -253,12 +249,11 @@ acpi_ex_get_name_string(acpi_object_type data_type, u32 prefix_count = 0; u8 has_prefix = FALSE; - ACPI_FUNCTION_TRACE_PTR(ex_get_name_string, aml_address); + ACPI_FUNCTION_TRACE_PTR("ex_get_name_string", aml_address); if (ACPI_TYPE_LOCAL_REGION_FIELD == data_type || ACPI_TYPE_LOCAL_BANK_FIELD == data_type || ACPI_TYPE_LOCAL_INDEX_FIELD == data_type) { - /* Disallow prefixes for types associated with field_unit names */ name_string = acpi_ex_allocate_name_string(0, 1); @@ -277,7 +272,7 @@ acpi_ex_get_name_string(acpi_object_type data_type, case AML_ROOT_PREFIX: ACPI_DEBUG_PRINT((ACPI_DB_LOAD, - "RootPrefix(\\) at %p\n", + "root_prefix(\\) at %p\n", aml_address)); /* @@ -295,7 +290,7 @@ acpi_ex_get_name_string(acpi_object_type data_type, do { ACPI_DEBUG_PRINT((ACPI_DB_LOAD, - "ParentPrefix (^) at %p\n", + "parent_prefix (^) at %p\n", aml_address)); aml_address++; @@ -319,7 +314,7 @@ acpi_ex_get_name_string(acpi_object_type data_type, case AML_DUAL_NAME_PREFIX: ACPI_DEBUG_PRINT((ACPI_DB_LOAD, - "DualNamePrefix at %p\n", + "dual_name_prefix at %p\n", aml_address)); aml_address++; @@ -346,7 +341,7 @@ acpi_ex_get_name_string(acpi_object_type data_type, case AML_MULTI_NAME_PREFIX_OP: ACPI_DEBUG_PRINT((ACPI_DB_LOAD, - "MultiNamePrefix at %p\n", + "multi_name_prefix at %p\n", aml_address)); /* Fetch count of segments remaining in name path */ @@ -382,7 +377,7 @@ acpi_ex_get_name_string(acpi_object_type data_type, if (prefix_count == ACPI_UINT32_MAX) { ACPI_DEBUG_PRINT((ACPI_DB_EXEC, - "NameSeg is \"\\\" followed by NULL\n")); + "name_seg is \"\\\" followed by NULL\n")); } /* Consume the NULL byte */ @@ -415,7 +410,6 @@ acpi_ex_get_name_string(acpi_object_type data_type, } if (AE_CTRL_PENDING == status && has_prefix) { - /* Ran out of segments after processing a prefix */ ACPI_ERROR((AE_INFO, "Malformed Name at %p", name_string)); @@ -424,7 +418,7 @@ acpi_ex_get_name_string(acpi_object_type data_type, if (ACPI_FAILURE(status)) { if (name_string) { - ACPI_FREE(name_string); + ACPI_MEM_FREE(name_string); } return_ACPI_STATUS(status); } diff --git a/trunk/drivers/acpi/executer/exoparg1.c b/trunk/drivers/acpi/executer/exoparg1.c index 6374d8be88e0..23d0823bcd5e 100644 --- a/trunk/drivers/acpi/executer/exoparg1.c +++ b/trunk/drivers/acpi/executer/exoparg1.c @@ -89,7 +89,7 @@ acpi_status acpi_ex_opcode_0A_0T_1R(struct acpi_walk_state *walk_state) acpi_status status = AE_OK; union acpi_operand_object *return_desc = NULL; - ACPI_FUNCTION_TRACE_STR(ex_opcode_0A_0T_1R, + ACPI_FUNCTION_TRACE_STR("ex_opcode_0A_0T_1R", acpi_ps_get_opcode_name(walk_state->opcode)); /* Examine the AML opcode */ @@ -150,7 +150,7 @@ acpi_status acpi_ex_opcode_1A_0T_0R(struct acpi_walk_state *walk_state) union acpi_operand_object **operand = &walk_state->operands[0]; acpi_status status = AE_OK; - ACPI_FUNCTION_TRACE_STR(ex_opcode_1A_0T_0R, + ACPI_FUNCTION_TRACE_STR("ex_opcode_1A_0T_0R", acpi_ps_get_opcode_name(walk_state->opcode)); /* Examine the AML opcode */ @@ -216,7 +216,7 @@ acpi_status acpi_ex_opcode_1A_1T_0R(struct acpi_walk_state *walk_state) acpi_status status = AE_OK; union acpi_operand_object **operand = &walk_state->operands[0]; - ACPI_FUNCTION_TRACE_STR(ex_opcode_1A_1T_0R, + ACPI_FUNCTION_TRACE_STR("ex_opcode_1A_1T_0R", acpi_ps_get_opcode_name(walk_state->opcode)); /* Examine the AML opcode */ @@ -264,7 +264,7 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state) acpi_integer power_of_ten; acpi_integer digit; - ACPI_FUNCTION_TRACE_STR(ex_opcode_1A_1T_1R, + ACPI_FUNCTION_TRACE_STR("ex_opcode_1A_1T_1R", acpi_ps_get_opcode_name(walk_state->opcode)); /* Examine the AML opcode */ @@ -322,9 +322,8 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state) /* Since the bit position is one-based, subtract from 33 (65) */ - return_desc->integer.value = - temp32 == - 0 ? 0 : (ACPI_INTEGER_BIT_SIZE + 1) - temp32; + return_desc->integer.value = temp32 == 0 ? 0 : + (ACPI_INTEGER_BIT_SIZE + 1) - temp32; break; case AML_FROM_BCD_OP: /* from_bcd (BCDValue, Result) */ @@ -343,7 +342,6 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state) for (i = 0; (i < acpi_gbl_integer_nybble_width) && (digit > 0); i++) { - /* Get the least significant 4-bit BCD digit */ temp32 = ((u32) digit) & 0xF; @@ -489,7 +487,6 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state) status = acpi_ex_convert_to_string(operand[0], &return_desc, ACPI_EXPLICIT_CONVERT_DECIMAL); if (return_desc == operand[0]) { - /* No conversion performed, add ref to handle return value */ acpi_ut_add_reference(return_desc); } @@ -500,7 +497,6 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state) status = acpi_ex_convert_to_string(operand[0], &return_desc, ACPI_EXPLICIT_CONVERT_HEX); if (return_desc == operand[0]) { - /* No conversion performed, add ref to handle return value */ acpi_ut_add_reference(return_desc); } @@ -510,7 +506,6 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state) status = acpi_ex_convert_to_buffer(operand[0], &return_desc); if (return_desc == operand[0]) { - /* No conversion performed, add ref to handle return value */ acpi_ut_add_reference(return_desc); } @@ -521,7 +516,6 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state) status = acpi_ex_convert_to_integer(operand[0], &return_desc, ACPI_ANY_BASE); if (return_desc == operand[0]) { - /* No conversion performed, add ref to handle return value */ acpi_ut_add_reference(return_desc); } @@ -547,7 +541,6 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state) } if (ACPI_SUCCESS(status)) { - /* Store the return value computed above into the target object */ status = acpi_ex_store(return_desc, operand[1], walk_state); @@ -555,18 +548,16 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state) cleanup: + if (!walk_state->result_obj) { + walk_state->result_obj = return_desc; + } + /* Delete return object on error */ if (ACPI_FAILURE(status)) { acpi_ut_remove_reference(return_desc); } - /* Save return object on success */ - - else if (!walk_state->result_obj) { - walk_state->result_obj = return_desc; - } - return_ACPI_STATUS(status); } @@ -591,7 +582,7 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) u32 type; acpi_integer value; - ACPI_FUNCTION_TRACE_STR(ex_opcode_1A_0T_1R, + ACPI_FUNCTION_TRACE_STR("ex_opcode_1A_0T_1R", acpi_ps_get_opcode_name(walk_state->opcode)); /* Examine the AML opcode */ @@ -634,7 +625,6 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) temp_desc = operand[0]; if (ACPI_GET_DESCRIPTOR_TYPE(temp_desc) == ACPI_DESC_TYPE_OPERAND) { - /* Internal reference object - prevent deletion */ acpi_ut_add_reference(temp_desc); @@ -699,7 +689,6 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) if (ACPI_FAILURE(status)) { goto cleanup; } - /* Allocate a descriptor to hold the type. */ return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); @@ -788,25 +777,8 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) /* Check for a method local or argument, or standalone String */ - if (ACPI_GET_DESCRIPTOR_TYPE(operand[0]) == + if (ACPI_GET_DESCRIPTOR_TYPE(operand[0]) != ACPI_DESC_TYPE_NAMED) { - temp_desc = - acpi_ns_get_attached_object((struct - acpi_namespace_node *) - operand[0]); - if (temp_desc - && - ((ACPI_GET_OBJECT_TYPE(temp_desc) == - ACPI_TYPE_STRING) - || (ACPI_GET_OBJECT_TYPE(temp_desc) == - ACPI_TYPE_LOCAL_REFERENCE))) { - operand[0] = temp_desc; - acpi_ut_add_reference(temp_desc); - } else { - status = AE_AML_OPERAND_TYPE; - goto cleanup; - } - } else { switch (ACPI_GET_OBJECT_TYPE(operand[0])) { case ACPI_TYPE_LOCAL_REFERENCE: /* @@ -855,35 +827,26 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) break; case ACPI_TYPE_STRING: - break; - default: - status = AE_AML_OPERAND_TYPE; - goto cleanup; - } - } - - if (ACPI_GET_DESCRIPTOR_TYPE(operand[0]) != - ACPI_DESC_TYPE_NAMED) { - if (ACPI_GET_OBJECT_TYPE(operand[0]) == - ACPI_TYPE_STRING) { /* * This is a deref_of (String). The string is a reference * to a named ACPI object. * * 1) Find the owning Node - * 2) Dereference the node to an actual object. Could be a + * 2) Dereference the node to an actual object. Could be a * Field, so we need to resolve the node to a value. */ status = - acpi_ns_get_node(walk_state->scope_info-> - scope.node, - operand[0]->string.pointer, - ACPI_NS_SEARCH_PARENT, - ACPI_CAST_INDIRECT_PTR - (struct - acpi_namespace_node, - &return_desc)); + acpi_ns_get_node_by_path(operand[0]->string. + pointer, + walk_state-> + scope_info->scope. + node, + ACPI_NS_SEARCH_PARENT, + ACPI_CAST_INDIRECT_PTR + (struct + acpi_namespace_node, + &return_desc)); if (ACPI_FAILURE(status)) { goto cleanup; } @@ -894,6 +857,11 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) (struct acpi_namespace_node, &return_desc), walk_state); goto cleanup; + + default: + + status = AE_AML_OPERAND_TYPE; + goto cleanup; } } @@ -969,12 +937,13 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) acpi_ut_add_reference (return_desc); } + break; default: ACPI_ERROR((AE_INFO, - "Unknown Index TargetType %X in obj %p", + "Unknown Index target_type %X in obj %p", operand[0]->reference. target_type, operand[0])); status = AE_AML_OPERAND_TYPE; @@ -988,6 +957,7 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) if (ACPI_GET_DESCRIPTOR_TYPE(return_desc) == ACPI_DESC_TYPE_NAMED) { + return_desc = acpi_ns_get_attached_object((struct acpi_namespace_node @@ -1002,7 +972,7 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) default: ACPI_ERROR((AE_INFO, - "Unknown opcode in reference(%p) - %X", + "Unknown opcode in ref(%p) - %X", operand[0], operand[0]->reference.opcode)); @@ -1028,11 +998,6 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) acpi_ut_remove_reference(return_desc); } - /* Save return object on success */ - - else { - walk_state->result_obj = return_desc; - } - + walk_state->result_obj = return_desc; return_ACPI_STATUS(status); } diff --git a/trunk/drivers/acpi/executer/exoparg2.c b/trunk/drivers/acpi/executer/exoparg2.c index 7d2cbc113160..e263a5ddd405 100644 --- a/trunk/drivers/acpi/executer/exoparg2.c +++ b/trunk/drivers/acpi/executer/exoparg2.c @@ -92,7 +92,7 @@ acpi_status acpi_ex_opcode_2A_0T_0R(struct acpi_walk_state *walk_state) u32 value; acpi_status status = AE_OK; - ACPI_FUNCTION_TRACE_STR(ex_opcode_2A_0T_0R, + ACPI_FUNCTION_TRACE_STR("ex_opcode_2A_0T_0R", acpi_ps_get_opcode_name(walk_state->opcode)); /* Examine the opcode */ @@ -121,7 +121,7 @@ acpi_status acpi_ex_opcode_2A_0T_0R(struct acpi_walk_state *walk_state) #ifdef ACPI_GPE_NOTIFY_CHECK /* * GPE method wake/notify check. Here, we want to ensure that we - * don't receive any "DeviceWake" Notifies from a GPE _Lxx or _Exx + * don't receive any "device_wake" Notifies from a GPE _Lxx or _Exx * GPE method during system runtime. If we do, the GPE is marked * as "wake-only" and disabled. * @@ -138,7 +138,6 @@ acpi_status acpi_ex_opcode_2A_0T_0R(struct acpi_walk_state *walk_state) acpi_ev_check_for_wake_only_gpe(walk_state-> gpe_event_info); if (ACPI_FAILURE(status)) { - /* AE_WAKE_ONLY_GPE only error, means ignore this notify */ return_ACPI_STATUS(AE_OK) @@ -186,7 +185,7 @@ acpi_status acpi_ex_opcode_2A_2T_1R(struct acpi_walk_state *walk_state) union acpi_operand_object *return_desc2 = NULL; acpi_status status; - ACPI_FUNCTION_TRACE_STR(ex_opcode_2A_2T_1R, + ACPI_FUNCTION_TRACE_STR("ex_opcode_2A_2T_1R", acpi_ps_get_opcode_name(walk_state->opcode)); /* Execute the opcode */ @@ -253,7 +252,6 @@ acpi_status acpi_ex_opcode_2A_2T_1R(struct acpi_walk_state *walk_state) acpi_ut_remove_reference(return_desc2); if (ACPI_FAILURE(status)) { - /* Delete the return object */ acpi_ut_remove_reference(return_desc1); @@ -283,13 +281,12 @@ acpi_status acpi_ex_opcode_2A_1T_1R(struct acpi_walk_state *walk_state) acpi_status status = AE_OK; acpi_size length; - ACPI_FUNCTION_TRACE_STR(ex_opcode_2A_1T_1R, + ACPI_FUNCTION_TRACE_STR("ex_opcode_2A_1T_1R", acpi_ps_get_opcode_name(walk_state->opcode)); /* Execute the opcode */ if (walk_state->op_info->flags & AML_MATH) { - /* All simple math opcodes (add, etc.) */ return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); @@ -386,70 +383,54 @@ acpi_status acpi_ex_opcode_2A_1T_1R(struct acpi_walk_state *walk_state) goto cleanup; } - /* Initialize the Index reference object */ - index = operand[1]->integer.value; - return_desc->reference.offset = (u32) index; - return_desc->reference.opcode = AML_INDEX_OP; - /* - * At this point, the Source operand is a String, Buffer, or Package. - * Verify that the index is within range. - */ - switch (ACPI_GET_OBJECT_TYPE(operand[0])) { - case ACPI_TYPE_STRING: + /* At this point, the Source operand is a Package, Buffer, or String */ - if (index >= operand[0]->string.length) { - status = AE_AML_STRING_LIMIT; - } - - return_desc->reference.target_type = - ACPI_TYPE_BUFFER_FIELD; - break; - - case ACPI_TYPE_BUFFER: - - if (index >= operand[0]->buffer.length) { - status = AE_AML_BUFFER_LIMIT; - } - - return_desc->reference.target_type = - ACPI_TYPE_BUFFER_FIELD; - break; - - case ACPI_TYPE_PACKAGE: + if (ACPI_GET_OBJECT_TYPE(operand[0]) == ACPI_TYPE_PACKAGE) { + /* Object to be indexed is a Package */ if (index >= operand[0]->package.count) { + ACPI_ERROR((AE_INFO, + "Index value (%X%8.8X) beyond package end (%X)", + ACPI_FORMAT_UINT64(index), + operand[0]->package.count)); status = AE_AML_PACKAGE_LIMIT; + goto cleanup; } return_desc->reference.target_type = ACPI_TYPE_PACKAGE; + return_desc->reference.object = operand[0]; return_desc->reference.where = &operand[0]->package.elements[index]; - break; - - default: - - status = AE_AML_INTERNAL; - goto cleanup; - } + } else { + /* Object to be indexed is a Buffer/String */ - /* Failure means that the Index was beyond the end of the object */ + if (index >= operand[0]->buffer.length) { + ACPI_ERROR((AE_INFO, + "Index value (%X%8.8X) beyond end of buffer (%X)", + ACPI_FORMAT_UINT64(index), + operand[0]->buffer.length)); + status = AE_AML_BUFFER_LIMIT; + goto cleanup; + } - if (ACPI_FAILURE(status)) { - ACPI_EXCEPTION((AE_INFO, status, - "Index (%X%8.8X) is beyond end of object", - ACPI_FORMAT_UINT64(index))); - goto cleanup; + return_desc->reference.target_type = + ACPI_TYPE_BUFFER_FIELD; + return_desc->reference.object = operand[0]; } /* - * Save the target object and add a reference to it for the life - * of the index + * Add a reference to the target package/buffer/string for the life + * of the index. */ - return_desc->reference.object = operand[0]; acpi_ut_add_reference(operand[0]); + /* Complete the Index reference object */ + + return_desc->reference.opcode = AML_INDEX_OP; + return_desc->reference.offset = (u32) index; + /* Store the reference to the Target */ status = acpi_ex_store(return_desc, operand[2], walk_state); @@ -514,7 +495,7 @@ acpi_status acpi_ex_opcode_2A_0T_1R(struct acpi_walk_state *walk_state) acpi_status status = AE_OK; u8 logical_result = FALSE; - ACPI_FUNCTION_TRACE_STR(ex_opcode_2A_0T_1R, + ACPI_FUNCTION_TRACE_STR("ex_opcode_2A_0T_1R", acpi_ps_get_opcode_name(walk_state->opcode)); /* Create the internal return object */ @@ -528,7 +509,6 @@ acpi_status acpi_ex_opcode_2A_0T_1R(struct acpi_walk_state *walk_state) /* Execute the Opcode */ if (walk_state->op_info->flags & AML_LOGICAL_NUMERIC) { - /* logical_op (Operand0, Operand1) */ status = acpi_ex_do_logical_numeric_op(walk_state->opcode, @@ -538,7 +518,6 @@ acpi_status acpi_ex_opcode_2A_0T_1R(struct acpi_walk_state *walk_state) value, &logical_result); goto store_logical_result; } else if (walk_state->op_info->flags & AML_LOGICAL) { - /* logical_op (Operand0, Operand1) */ status = acpi_ex_do_logical_op(walk_state->opcode, operand[0], diff --git a/trunk/drivers/acpi/executer/exoparg3.c b/trunk/drivers/acpi/executer/exoparg3.c index e2d945dfd509..6a3a883cb8a3 100644 --- a/trunk/drivers/acpi/executer/exoparg3.c +++ b/trunk/drivers/acpi/executer/exoparg3.c @@ -88,19 +88,20 @@ acpi_status acpi_ex_opcode_3A_0T_0R(struct acpi_walk_state *walk_state) struct acpi_signal_fatal_info *fatal; acpi_status status = AE_OK; - ACPI_FUNCTION_TRACE_STR(ex_opcode_3A_0T_0R, + ACPI_FUNCTION_TRACE_STR("ex_opcode_3A_0T_0R", acpi_ps_get_opcode_name(walk_state->opcode)); switch (walk_state->opcode) { case AML_FATAL_OP: /* Fatal (fatal_type fatal_code fatal_arg) */ ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "FatalOp: Type %X Code %X Arg %X <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n", + "fatal_op: Type %X Code %X Arg %X <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n", (u32) operand[0]->integer.value, (u32) operand[1]->integer.value, (u32) operand[2]->integer.value)); - fatal = ACPI_ALLOCATE(sizeof(struct acpi_signal_fatal_info)); + fatal = + ACPI_MEM_ALLOCATE(sizeof(struct acpi_signal_fatal_info)); if (fatal) { fatal->type = (u32) operand[0]->integer.value; fatal->code = (u32) operand[1]->integer.value; @@ -113,7 +114,7 @@ acpi_status acpi_ex_opcode_3A_0T_0R(struct acpi_walk_state *walk_state) /* Might return while OS is shutting down, just continue */ - ACPI_FREE(fatal); + ACPI_MEM_FREE(fatal); break; default: @@ -150,7 +151,7 @@ acpi_status acpi_ex_opcode_3A_1T_1R(struct acpi_walk_state *walk_state) acpi_integer index; acpi_size length; - ACPI_FUNCTION_TRACE_STR(ex_opcode_3A_1T_1R, + ACPI_FUNCTION_TRACE_STR("ex_opcode_3A_1T_1R", acpi_ps_get_opcode_name(walk_state->opcode)); switch (walk_state->opcode) { @@ -195,7 +196,7 @@ acpi_status acpi_ex_opcode_3A_1T_1R(struct acpi_walk_state *walk_state) /* Always allocate a new buffer for the String */ - buffer = ACPI_ALLOCATE_ZEROED((acpi_size) length + 1); + buffer = ACPI_MEM_CALLOCATE((acpi_size) length + 1); if (!buffer) { status = AE_NO_MEMORY; goto cleanup; @@ -207,10 +208,9 @@ acpi_status acpi_ex_opcode_3A_1T_1R(struct acpi_walk_state *walk_state) /* If the requested length is zero, don't allocate a buffer */ if (length > 0) { - /* Allocate a new buffer for the Buffer */ - buffer = ACPI_ALLOCATE_ZEROED(length); + buffer = ACPI_MEM_CALLOCATE(length); if (!buffer) { status = AE_NO_MEMORY; goto cleanup; @@ -225,7 +225,6 @@ acpi_status acpi_ex_opcode_3A_1T_1R(struct acpi_walk_state *walk_state) } if (buffer) { - /* We have a buffer, copy the portion requested */ ACPI_MEMCPY(buffer, operand[0]->string.pointer + index, diff --git a/trunk/drivers/acpi/executer/exoparg6.c b/trunk/drivers/acpi/executer/exoparg6.c index f0c0ba6eb408..e043d924444f 100644 --- a/trunk/drivers/acpi/executer/exoparg6.c +++ b/trunk/drivers/acpi/executer/exoparg6.c @@ -220,7 +220,7 @@ acpi_status acpi_ex_opcode_6A_0T_1R(struct acpi_walk_state * walk_state) acpi_integer index; union acpi_operand_object *this_element; - ACPI_FUNCTION_TRACE_STR(ex_opcode_6A_0T_1R, + ACPI_FUNCTION_TRACE_STR("ex_opcode_6A_0T_1R", acpi_ps_get_opcode_name(walk_state->opcode)); switch (walk_state->opcode) { @@ -276,7 +276,6 @@ acpi_status acpi_ex_opcode_6A_0T_1R(struct acpi_walk_state * walk_state) * match was found. */ for (; index < operand[0]->package.count; index++) { - /* Get the current package element */ this_element = operand[0]->package.elements[index]; diff --git a/trunk/drivers/acpi/executer/exprep.c b/trunk/drivers/acpi/executer/exprep.c index 44d064f427b9..7719ae5d4f16 100644 --- a/trunk/drivers/acpi/executer/exprep.c +++ b/trunk/drivers/acpi/executer/exprep.c @@ -97,7 +97,7 @@ acpi_ex_generate_access(u32 field_bit_offset, u32 minimum_accesses = 0xFFFFFFFF; u32 accesses; - ACPI_FUNCTION_TRACE(ex_generate_access); + ACPI_FUNCTION_TRACE("ex_generate_access"); /* Round Field start offset and length to "minimal" byte boundaries */ @@ -146,7 +146,7 @@ acpi_ex_generate_access(u32 field_bit_offset, accesses = field_end_offset - field_start_offset; ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, - "AccessWidth %d end is within region\n", + "access_width %d end is within region\n", access_byte_width)); ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, @@ -173,7 +173,7 @@ acpi_ex_generate_access(u32 field_bit_offset, } } else { ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, - "AccessWidth %d end is NOT within region\n", + "access_width %d end is NOT within region\n", access_byte_width)); if (access_byte_width == 1) { ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, @@ -228,7 +228,7 @@ acpi_ex_decode_field_access(union acpi_operand_object *obj_desc, u32 byte_alignment; u32 bit_length; - ACPI_FUNCTION_TRACE(ex_decode_field_access); + ACPI_FUNCTION_TRACE("ex_decode_field_access"); access = (field_flags & AML_FIELD_ACCESS_TYPE_MASK); @@ -322,7 +322,7 @@ acpi_ex_prep_common_field_object(union acpi_operand_object *obj_desc, u32 byte_alignment; u32 nearest_byte_address; - ACPI_FUNCTION_TRACE(ex_prep_common_field_object); + ACPI_FUNCTION_TRACE("ex_prep_common_field_object"); /* * Note: the structure being initialized is the @@ -415,13 +415,13 @@ acpi_status acpi_ex_prep_field_value(struct acpi_create_field_info *info) u32 type; acpi_status status; - ACPI_FUNCTION_TRACE(ex_prep_field_value); + ACPI_FUNCTION_TRACE("ex_prep_field_value"); /* Parameter validation */ if (info->field_type != ACPI_TYPE_LOCAL_INDEX_FIELD) { if (!info->region_node) { - ACPI_ERROR((AE_INFO, "Null RegionNode")); + ACPI_ERROR((AE_INFO, "Null region_node")); return_ACPI_STATUS(AE_AML_NO_OPERAND); } @@ -467,7 +467,7 @@ acpi_status acpi_ex_prep_field_value(struct acpi_create_field_info *info) acpi_ut_add_reference(obj_desc->field.region_obj); ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, - "RegionField: BitOff %X, Off %X, Gran %X, Region %p\n", + "region_field: bit_off %X, Off %X, Gran %X, Region %p\n", obj_desc->field.start_field_bit_offset, obj_desc->field.base_byte_offset, obj_desc->field.access_byte_width, @@ -488,7 +488,7 @@ acpi_status acpi_ex_prep_field_value(struct acpi_create_field_info *info) acpi_ut_add_reference(obj_desc->bank_field.bank_obj); ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, - "Bank Field: BitOff %X, Off %X, Gran %X, Region %p, BankReg %p\n", + "Bank Field: bit_off %X, Off %X, Gran %X, Region %p, bank_reg %p\n", obj_desc->bank_field.start_field_bit_offset, obj_desc->bank_field.base_byte_offset, obj_desc->field.access_byte_width, @@ -519,29 +519,16 @@ acpi_status acpi_ex_prep_field_value(struct acpi_create_field_info *info) acpi_ut_add_reference(obj_desc->index_field.index_obj); /* - * April 2006: Changed to match MS behavior - * * The value written to the Index register is the byte offset of the - * target field in units of the granularity of the index_field - * - * Previously, the value was calculated as an index in terms of the - * width of the Data register, as below: - * - * obj_desc->index_field.Value = (u32) - * (Info->field_bit_position / ACPI_MUL_8 ( - * obj_desc->Field.access_byte_width)); - * - * February 2006: Tried value as a byte offset: - * obj_desc->index_field.Value = (u32) - * ACPI_DIV_8 (Info->field_bit_position); + * target field + * Note: may change code to: ACPI_DIV_8 (Info->field_bit_position) */ - obj_desc->index_field.value = - (u32) ACPI_ROUND_DOWN(ACPI_DIV_8(info->field_bit_position), - obj_desc->index_field. - access_byte_width); + obj_desc->index_field.value = (u32) + (info->field_bit_position / + ACPI_MUL_8(obj_desc->field.access_byte_width)); ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, - "IndexField: BitOff %X, Off %X, Value %X, Gran %X, Index %p, Data %p\n", + "index_field: bit_off %X, Off %X, Value %X, Gran %X, Index %p, Data %p\n", obj_desc->index_field.start_field_bit_offset, obj_desc->index_field.base_byte_offset, obj_desc->index_field.value, @@ -563,7 +550,7 @@ acpi_status acpi_ex_prep_field_value(struct acpi_create_field_info *info) acpi_ns_get_type(info->field_node)); ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, - "Set NamedObj %p [%4.4s], ObjDesc %p\n", + "Set named_obj %p [%4.4s], obj_desc %p\n", info->field_node, acpi_ut_get_node_name(info->field_node), obj_desc)); diff --git a/trunk/drivers/acpi/executer/exregion.c b/trunk/drivers/acpi/executer/exregion.c index 3cc97ba48b36..6a4cfdff606d 100644 --- a/trunk/drivers/acpi/executer/exregion.c +++ b/trunk/drivers/acpi/executer/exregion.c @@ -81,7 +81,7 @@ acpi_ex_system_memory_space_handler(u32 function, u32 remainder; #endif - ACPI_FUNCTION_TRACE(ex_system_memory_space_handler); + ACPI_FUNCTION_TRACE("ex_system_memory_space_handler"); /* Validate and translate the bit width */ @@ -103,7 +103,7 @@ acpi_ex_system_memory_space_handler(u32 function, break; default: - ACPI_ERROR((AE_INFO, "Invalid SystemMemory width %d", + ACPI_ERROR((AE_INFO, "Invalid system_memory width %d", bit_width)); return_ACPI_STATUS(AE_AML_OPERAND_VALUE); } @@ -135,7 +135,6 @@ acpi_ex_system_memory_space_handler(u32 function, * Delete the existing mapping and create a new one. */ if (mem_info->mapped_length) { - /* Valid mapping, delete it */ acpi_os_unmap_memory(mem_info->mapped_logical_address, @@ -182,8 +181,8 @@ acpi_ex_system_memory_space_handler(u32 function, (acpi_integer) mem_info->mapped_physical_address); ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "System-Memory (width %d) R/W %d Address=%8.8X%8.8X\n", - bit_width, function, ACPI_FORMAT_UINT64(address))); + "system_memory %d (%d width) Address=%8.8X%8.8X\n", + function, bit_width, ACPI_FORMAT_UINT64(address))); /* * Perform the memory read or write @@ -284,11 +283,11 @@ acpi_ex_system_io_space_handler(u32 function, acpi_status status = AE_OK; u32 value32; - ACPI_FUNCTION_TRACE(ex_system_io_space_handler); + ACPI_FUNCTION_TRACE("ex_system_io_space_handler"); ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "System-IO (width %d) R/W %d Address=%8.8X%8.8X\n", - bit_width, function, ACPI_FORMAT_UINT64(address))); + "system_iO %d (%d width) Address=%8.8X%8.8X\n", + function, bit_width, ACPI_FORMAT_UINT64(address))); /* Decode the function parameter */ @@ -343,7 +342,7 @@ acpi_ex_pci_config_space_handler(u32 function, struct acpi_pci_id *pci_id; u16 pci_register; - ACPI_FUNCTION_TRACE(ex_pci_config_space_handler); + ACPI_FUNCTION_TRACE("ex_pci_config_space_handler"); /* * The arguments to acpi_os(Read|Write)pci_configuration are: @@ -361,7 +360,7 @@ acpi_ex_pci_config_space_handler(u32 function, pci_register = (u16) (u32) address; ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "Pci-Config %d (%d) Seg(%04x) Bus(%04x) Dev(%04x) Func(%04x) Reg(%04x)\n", + "pci_config %d (%d) Seg(%04x) Bus(%04x) Dev(%04x) Func(%04x) Reg(%04x)\n", function, bit_width, pci_id->segment, pci_id->bus, pci_id->device, pci_id->function, pci_register)); @@ -415,7 +414,7 @@ acpi_ex_cmos_space_handler(u32 function, { acpi_status status = AE_OK; - ACPI_FUNCTION_TRACE(ex_cmos_space_handler); + ACPI_FUNCTION_TRACE("ex_cmos_space_handler"); return_ACPI_STATUS(status); } @@ -447,7 +446,7 @@ acpi_ex_pci_bar_space_handler(u32 function, { acpi_status status = AE_OK; - ACPI_FUNCTION_TRACE(ex_pci_bar_space_handler); + ACPI_FUNCTION_TRACE("ex_pci_bar_space_handler"); return_ACPI_STATUS(status); } @@ -477,16 +476,23 @@ acpi_ex_data_table_space_handler(u32 function, acpi_integer * value, void *handler_context, void *region_context) { - ACPI_FUNCTION_TRACE(ex_data_table_space_handler); + acpi_status status = AE_OK; + u32 byte_width = ACPI_DIV_8(bit_width); + u32 i; + char *logical_addr_ptr; + + ACPI_FUNCTION_TRACE("ex_data_table_space_handler"); + + logical_addr_ptr = ACPI_PHYSADDR_TO_PTR(address); /* Perform the memory read or write */ switch (function) { case ACPI_READ: - ACPI_MEMCPY(ACPI_CAST_PTR(char, value), - ACPI_PHYSADDR_TO_PTR(address), - ACPI_DIV_8(bit_width)); + for (i = 0; i < byte_width; i++) { + ((char *)value)[i] = logical_addr_ptr[i]; + } break; case ACPI_WRITE: @@ -495,5 +501,5 @@ acpi_ex_data_table_space_handler(u32 function, return_ACPI_STATUS(AE_SUPPORT); } - return_ACPI_STATUS(AE_OK); + return_ACPI_STATUS(status); } diff --git a/trunk/drivers/acpi/executer/exresnte.c b/trunk/drivers/acpi/executer/exresnte.c index 3089b05a1368..01b26c80d22b 100644 --- a/trunk/drivers/acpi/executer/exresnte.c +++ b/trunk/drivers/acpi/executer/exresnte.c @@ -87,7 +87,7 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr, struct acpi_namespace_node *node; acpi_object_type entry_type; - ACPI_FUNCTION_TRACE(ex_resolve_node_to_value); + ACPI_FUNCTION_TRACE("ex_resolve_node_to_value"); /* * The stack pointer points to a struct acpi_namespace_node (Node). Get the @@ -97,13 +97,12 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr, source_desc = acpi_ns_get_attached_object(node); entry_type = acpi_ns_get_type((acpi_handle) node); - ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Entry=%p SourceDesc=%p [%s]\n", + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Entry=%p source_desc=%p [%s]\n", node, source_desc, acpi_ut_get_type_name(entry_type))); if ((entry_type == ACPI_TYPE_LOCAL_ALIAS) || (entry_type == ACPI_TYPE_LOCAL_METHOD_ALIAS)) { - /* There is always exactly one level of indirection */ node = ACPI_CAST_PTR(struct acpi_namespace_node, node->object); @@ -114,11 +113,10 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr, /* * Several object types require no further processing: - * 1) Device/Thermal objects don't have a "real" subobject, return the Node + * 1) Devices rarely have an attached object, return the Node * 2) Method locals and arguments have a pseudo-Node */ - if ((entry_type == ACPI_TYPE_DEVICE) || - (entry_type == ACPI_TYPE_THERMAL) || + if (entry_type == ACPI_TYPE_DEVICE || (node->flags & (ANOBJ_METHOD_ARG | ANOBJ_METHOD_LOCAL))) { return_ACPI_STATUS(AE_OK); } @@ -143,7 +141,6 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr, status = acpi_ds_get_package_arguments(source_desc); if (ACPI_SUCCESS(status)) { - /* Return an additional reference to the object */ obj_desc = source_desc; @@ -161,7 +158,6 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr, status = acpi_ds_get_buffer_arguments(source_desc); if (ACPI_SUCCESS(status)) { - /* Return an additional reference to the object */ obj_desc = source_desc; @@ -203,7 +199,7 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr, case ACPI_TYPE_LOCAL_INDEX_FIELD: ACPI_DEBUG_PRINT((ACPI_DB_EXEC, - "FieldRead Node=%p SourceDesc=%p Type=%X\n", + "field_read Node=%p source_desc=%p Type=%X\n", node, source_desc, entry_type)); status = @@ -217,6 +213,7 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr, case ACPI_TYPE_METHOD: case ACPI_TYPE_POWER: case ACPI_TYPE_PROCESSOR: + case ACPI_TYPE_THERMAL: case ACPI_TYPE_EVENT: case ACPI_TYPE_REGION: @@ -243,8 +240,6 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr, /* This is a ddb_handle */ /* Return an additional reference to the object */ - case AML_REF_OF_OP: - obj_desc = source_desc; acpi_ut_add_reference(obj_desc); break; diff --git a/trunk/drivers/acpi/executer/exresolv.c b/trunk/drivers/acpi/executer/exresolv.c index 6499de878017..1deed492fe88 100644 --- a/trunk/drivers/acpi/executer/exresolv.c +++ b/trunk/drivers/acpi/executer/exresolv.c @@ -78,7 +78,7 @@ acpi_ex_resolve_to_value(union acpi_operand_object **stack_ptr, { acpi_status status; - ACPI_FUNCTION_TRACE_PTR(ex_resolve_to_value, stack_ptr); + ACPI_FUNCTION_TRACE_PTR("ex_resolve_to_value", stack_ptr); if (!stack_ptr || !*stack_ptr) { ACPI_ERROR((AE_INFO, "Internal - null pointer")); @@ -144,7 +144,7 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr, union acpi_operand_object *obj_desc; u16 opcode; - ACPI_FUNCTION_TRACE(ex_resolve_object_to_value); + ACPI_FUNCTION_TRACE("ex_resolve_object_to_value"); stack_desc = *stack_ptr; @@ -190,7 +190,7 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr, } ACPI_DEBUG_PRINT((ACPI_DB_EXEC, - "[Arg/Local %X] ValueObj is %p\n", + "[Arg/Local %X] value_obj is %p\n", stack_desc->reference.offset, obj_desc)); @@ -239,7 +239,7 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr, /* Invalid reference object */ ACPI_ERROR((AE_INFO, - "Unknown TargetType %X in Index/Reference obj %p", + "Unknown target_type %X in Index/Reference obj %p", stack_desc->reference.target_type, stack_desc)); status = AE_AML_INTERNAL; @@ -257,24 +257,10 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr, case AML_INT_NAMEPATH_OP: /* Reference to a named object */ - /* Dereference the name */ - - if ((stack_desc->reference.node->type == - ACPI_TYPE_DEVICE) - || (stack_desc->reference.node->type == - ACPI_TYPE_THERMAL)) { - - /* These node types do not have 'real' subobjects */ - - *stack_ptr = (void *)stack_desc->reference.node; - } else { - /* Get the object pointed to by the namespace node */ - - *stack_ptr = - (stack_desc->reference.node)->object; - acpi_ut_add_reference(*stack_ptr); - } + /* Get the object pointed to by the namespace node */ + *stack_ptr = (stack_desc->reference.node)->object; + acpi_ut_add_reference(*stack_ptr); acpi_ut_remove_reference(stack_desc); break; @@ -307,7 +293,7 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr, case ACPI_TYPE_LOCAL_INDEX_FIELD: ACPI_DEBUG_PRINT((ACPI_DB_EXEC, - "FieldRead SourceDesc=%p Type=%X\n", + "field_read source_desc=%p Type=%X\n", stack_desc, ACPI_GET_OBJECT_TYPE(stack_desc))); @@ -351,7 +337,7 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state, acpi_object_type type; acpi_status status; - ACPI_FUNCTION_TRACE(acpi_ex_resolve_multiple); + ACPI_FUNCTION_TRACE("acpi_ex_resolve_multiple"); /* Operand can be either a namespace node or an operand descriptor */ @@ -396,16 +382,10 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state, while (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_LOCAL_REFERENCE) { switch (obj_desc->reference.opcode) { case AML_REF_OF_OP: - case AML_INT_NAMEPATH_OP: /* Dereference the reference pointer */ - if (obj_desc->reference.opcode == AML_REF_OF_OP) { - node = obj_desc->reference.object; - } else { /* AML_INT_NAMEPATH_OP */ - - node = obj_desc->reference.node; - } + node = obj_desc->reference.object; /* All "References" point to a NS node */ @@ -421,7 +401,6 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state, obj_desc = acpi_ns_get_attached_object(node); if (!obj_desc) { - /* No object, use the NS node type */ type = acpi_ns_get_type(node); @@ -453,7 +432,6 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state, */ obj_desc = *(obj_desc->reference.where); if (!obj_desc) { - /* NULL package elements are allowed */ type = 0; /* Uninitialized */ @@ -461,6 +439,39 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state, } break; + case AML_INT_NAMEPATH_OP: + + /* Dereference the reference pointer */ + + node = obj_desc->reference.node; + + /* All "References" point to a NS node */ + + if (ACPI_GET_DESCRIPTOR_TYPE(node) != + ACPI_DESC_TYPE_NAMED) { + ACPI_ERROR((AE_INFO, "Not a NS node %p [%s]", + node, + acpi_ut_get_descriptor_name(node))); + return_ACPI_STATUS(AE_AML_INTERNAL); + } + + /* Get the attached object */ + + obj_desc = acpi_ns_get_attached_object(node); + if (!obj_desc) { + /* No object, use the NS node type */ + + type = acpi_ns_get_type(node); + goto exit; + } + + /* Check for circular references */ + + if (obj_desc == operand) { + return_ACPI_STATUS(AE_AML_CIRCULAR_REFERENCE); + } + break; + case AML_LOCAL_OP: case AML_ARG_OP: @@ -502,7 +513,7 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state, case AML_DEBUG_OP: - /* The Debug Object is of type "DebugObject" */ + /* The Debug Object is of type "debug_object" */ type = ACPI_TYPE_DEBUG_OBJECT; goto exit; diff --git a/trunk/drivers/acpi/executer/exresop.c b/trunk/drivers/acpi/executer/exresop.c index 4c93d0972333..a1c000f5a415 100644 --- a/trunk/drivers/acpi/executer/exresop.c +++ b/trunk/drivers/acpi/executer/exresop.c @@ -77,7 +77,6 @@ acpi_ex_check_object_type(acpi_object_type type_needed, ACPI_FUNCTION_ENTRY(); if (type_needed == ACPI_TYPE_ANY) { - /* All types OK, so we don't perform any typechecks */ return (AE_OK); @@ -144,7 +143,7 @@ acpi_ex_resolve_operands(u16 opcode, acpi_object_type type_needed; u16 target_op = 0; - ACPI_FUNCTION_TRACE_U32(ex_resolve_operands, opcode); + ACPI_FUNCTION_TRACE_U32("ex_resolve_operands", opcode); op_info = acpi_ps_get_opcode_info(opcode); if (op_info->class == AML_CLASS_UNKNOWN) { @@ -159,7 +158,7 @@ acpi_ex_resolve_operands(u16 opcode, } ACPI_DEBUG_PRINT((ACPI_DB_EXEC, - "Opcode %X [%s] RequiredOperandTypes=%8.8X\n", + "Opcode %X [%s] required_operand_types=%8.8X\n", opcode, op_info->name, arg_types)); /* @@ -225,7 +224,6 @@ acpi_ex_resolve_operands(u16 opcode, } if (object_type == (u8) ACPI_TYPE_LOCAL_REFERENCE) { - /* Decode the Reference */ op_info = acpi_ps_get_opcode_info(opcode); @@ -249,7 +247,7 @@ acpi_ex_resolve_operands(u16 opcode, ACPI_DEBUG_ONLY_MEMBERS(ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "Operand is a Reference, RefOpcode [%s]\n", + "Operand is a Reference, ref_opcode [%s]\n", (acpi_ps_get_opcode_info (obj_desc-> reference. @@ -334,7 +332,6 @@ acpi_ex_resolve_operands(u16 opcode, } if (obj_desc->reference.opcode == AML_NAME_OP) { - /* Convert a named reference to the actual named object */ temp_node = obj_desc->reference.object; @@ -626,7 +623,7 @@ acpi_ex_resolve_operands(u16 opcode, default: ACPI_ERROR((AE_INFO, - "Needed [Region/RegionField], found [%s] %p", + "Needed [Region/region_field], found [%s] %p", acpi_ut_get_object_type_name (obj_desc), obj_desc)); @@ -665,7 +662,6 @@ acpi_ex_resolve_operands(u16 opcode, } if (target_op == AML_DEBUG_OP) { - /* Allow store of any object to the Debug object */ break; diff --git a/trunk/drivers/acpi/executer/exstore.c b/trunk/drivers/acpi/executer/exstore.c index 0456405ba019..3f020c0e2b95 100644 --- a/trunk/drivers/acpi/executer/exstore.c +++ b/trunk/drivers/acpi/executer/exstore.c @@ -82,7 +82,7 @@ acpi_ex_do_debug_object(union acpi_operand_object *source_desc, { u32 i; - ACPI_FUNCTION_TRACE_PTR(ex_do_debug_object, source_desc); + ACPI_FUNCTION_TRACE_PTR("ex_do_debug_object", source_desc); ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "[ACPI Debug] %*s", level, " ")); @@ -245,7 +245,7 @@ acpi_ex_store(union acpi_operand_object *source_desc, acpi_status status = AE_OK; union acpi_operand_object *ref_desc = dest_desc; - ACPI_FUNCTION_TRACE_PTR(ex_store, dest_desc); + ACPI_FUNCTION_TRACE_PTR("ex_store", dest_desc); /* Validate parameters */ @@ -297,7 +297,7 @@ acpi_ex_store(union acpi_operand_object *source_desc, ACPI_DUMP_STACK_ENTRY(source_desc); ACPI_DUMP_STACK_ENTRY(dest_desc); - ACPI_DUMP_OPERANDS(&dest_desc, ACPI_IMODE_EXECUTE, "ExStore", + ACPI_DUMP_OPERANDS(&dest_desc, ACPI_IMODE_EXECUTE, "ex_store", 2, "Target is not a Reference or Constant object"); @@ -396,7 +396,7 @@ acpi_ex_store_object_to_index(union acpi_operand_object *source_desc, u8 value = 0; u32 i; - ACPI_FUNCTION_TRACE(ex_store_object_to_index); + ACPI_FUNCTION_TRACE("ex_store_object_to_index"); /* * Destination must be a reference pointer, and @@ -423,7 +423,6 @@ acpi_ex_store_object_to_index(union acpi_operand_object *source_desc, } if (obj_desc) { - /* Decrement reference count by the ref count of the parent package */ for (i = 0; i < ((union acpi_operand_object *) @@ -503,7 +502,8 @@ acpi_ex_store_object_to_index(union acpi_operand_object *source_desc, break; default: - ACPI_ERROR((AE_INFO, "Target is not a Package or BufferField")); + ACPI_ERROR((AE_INFO, + "Target is not a Package or buffer_field")); status = AE_AML_OPERAND_TYPE; break; } @@ -548,7 +548,7 @@ acpi_ex_store_object_to_node(union acpi_operand_object *source_desc, union acpi_operand_object *new_desc; acpi_object_type target_type; - ACPI_FUNCTION_TRACE_PTR(ex_store_object_to_node, source_desc); + ACPI_FUNCTION_TRACE_PTR("ex_store_object_to_node", source_desc); /* Get current type of the node, and object attached to Node */ @@ -572,7 +572,6 @@ acpi_ex_store_object_to_node(union acpi_operand_object *source_desc, /* If no implicit conversion, drop into the default case below */ if ((!implicit_conversion) || (walk_state->opcode == AML_COPY_OP)) { - /* Force execution of default (no implicit conversion) */ target_type = ACPI_TYPE_ANY; diff --git a/trunk/drivers/acpi/executer/exstoren.c b/trunk/drivers/acpi/executer/exstoren.c index 591aaf0e18b3..42967baf760d 100644 --- a/trunk/drivers/acpi/executer/exstoren.c +++ b/trunk/drivers/acpi/executer/exstoren.c @@ -72,7 +72,7 @@ acpi_ex_resolve_object(union acpi_operand_object **source_desc_ptr, union acpi_operand_object *source_desc = *source_desc_ptr; acpi_status status = AE_OK; - ACPI_FUNCTION_TRACE(ex_resolve_object); + ACPI_FUNCTION_TRACE("ex_resolve_object"); /* Ensure we have a Target that can be stored to */ @@ -97,7 +97,6 @@ acpi_ex_resolve_object(union acpi_operand_object **source_desc_ptr, */ if (ACPI_GET_OBJECT_TYPE(source_desc) == ACPI_TYPE_LOCAL_REFERENCE) { - /* Resolve a reference object first */ status = @@ -122,7 +121,6 @@ acpi_ex_resolve_object(union acpi_operand_object **source_desc_ptr, !((ACPI_GET_OBJECT_TYPE(source_desc) == ACPI_TYPE_LOCAL_REFERENCE) && (source_desc->reference.opcode == AML_LOAD_OP))) { - /* Conversion successful but still not a valid type */ ACPI_ERROR((AE_INFO, @@ -201,7 +199,7 @@ acpi_ex_store_object_to_object(union acpi_operand_object *source_desc, union acpi_operand_object *actual_src_desc; acpi_status status = AE_OK; - ACPI_FUNCTION_TRACE_PTR(ex_store_object_to_object, source_desc); + ACPI_FUNCTION_TRACE_PTR("ex_store_object_to_object", source_desc); actual_src_desc = source_desc; if (!dest_desc) { @@ -291,7 +289,6 @@ acpi_ex_store_object_to_object(union acpi_operand_object *source_desc, } if (actual_src_desc != source_desc) { - /* Delete the intermediate (temporary) source object */ acpi_ut_remove_reference(actual_src_desc); diff --git a/trunk/drivers/acpi/executer/exstorob.c b/trunk/drivers/acpi/executer/exstorob.c index 99ebe5adfcda..6ab707087750 100644 --- a/trunk/drivers/acpi/executer/exstorob.c +++ b/trunk/drivers/acpi/executer/exstorob.c @@ -67,7 +67,7 @@ acpi_ex_store_buffer_to_buffer(union acpi_operand_object *source_desc, u32 length; u8 *buffer; - ACPI_FUNCTION_TRACE_PTR(ex_store_buffer_to_buffer, source_desc); + ACPI_FUNCTION_TRACE_PTR("ex_store_buffer_to_buffer", source_desc); /* We know that source_desc is a buffer by now */ @@ -80,7 +80,7 @@ acpi_ex_store_buffer_to_buffer(union acpi_operand_object *source_desc, */ if ((target_desc->buffer.length == 0) || (target_desc->common.flags & AOPOBJ_STATIC_POINTER)) { - target_desc->buffer.pointer = ACPI_ALLOCATE(length); + target_desc->buffer.pointer = ACPI_MEM_ALLOCATE(length); if (!target_desc->buffer.pointer) { return_ACPI_STATUS(AE_NO_MEMORY); } @@ -91,7 +91,6 @@ acpi_ex_store_buffer_to_buffer(union acpi_operand_object *source_desc, /* Copy source buffer to target buffer */ if (length <= target_desc->buffer.length) { - /* Clear existing buffer and copy in the new one */ ACPI_MEMSET(target_desc->buffer.pointer, 0, @@ -103,7 +102,7 @@ acpi_ex_store_buffer_to_buffer(union acpi_operand_object *source_desc, * NOTE: ACPI versions up to 3.0 specified that the buffer must be * truncated if the string is smaller than the buffer. However, "other" * implementations of ACPI never did this and thus became the defacto - * standard. ACPI 3.0_a changes this behavior such that the buffer + * standard. ACPi 3.0_a changes this behavior such that the buffer * is no longer truncated. */ @@ -114,7 +113,6 @@ acpi_ex_store_buffer_to_buffer(union acpi_operand_object *source_desc, * copy must not truncate the original buffer. */ if (original_src_type == ACPI_TYPE_STRING) { - /* Set the new length of the target */ target_desc->buffer.length = length; @@ -158,7 +156,7 @@ acpi_ex_store_string_to_string(union acpi_operand_object *source_desc, u32 length; u8 *buffer; - ACPI_FUNCTION_TRACE_PTR(ex_store_string_to_string, source_desc); + ACPI_FUNCTION_TRACE_PTR("ex_store_string_to_string", source_desc); /* We know that source_desc is a string by now */ @@ -185,14 +183,13 @@ acpi_ex_store_string_to_string(union acpi_operand_object *source_desc, */ if (target_desc->string.pointer && (!(target_desc->common.flags & AOPOBJ_STATIC_POINTER))) { - /* Only free if not a pointer into the DSDT */ - ACPI_FREE(target_desc->string.pointer); + ACPI_MEM_FREE(target_desc->string.pointer); } - target_desc->string.pointer = ACPI_ALLOCATE_ZEROED((acpi_size) - length + 1); + target_desc->string.pointer = ACPI_MEM_CALLOCATE((acpi_size) + length + 1); if (!target_desc->string.pointer) { return_ACPI_STATUS(AE_NO_MEMORY); } diff --git a/trunk/drivers/acpi/executer/exsystem.c b/trunk/drivers/acpi/executer/exsystem.c index 52beee3674a0..ea9144f42e1f 100644 --- a/trunk/drivers/acpi/executer/exsystem.c +++ b/trunk/drivers/acpi/executer/exsystem.c @@ -68,7 +68,7 @@ acpi_status acpi_ex_system_wait_semaphore(acpi_handle semaphore, u16 timeout) acpi_status status; acpi_status status2; - ACPI_FUNCTION_TRACE(ex_system_wait_semaphore); + ACPI_FUNCTION_TRACE("ex_system_wait_semaphore"); status = acpi_os_wait_semaphore(semaphore, 1, 0); if (ACPI_SUCCESS(status)) { @@ -76,7 +76,6 @@ acpi_status acpi_ex_system_wait_semaphore(acpi_handle semaphore, u16 timeout) } if (status == AE_TIME) { - /* We must wait, so unlock the interpreter */ acpi_ex_exit_interpreter(); @@ -91,7 +90,6 @@ acpi_status acpi_ex_system_wait_semaphore(acpi_handle semaphore, u16 timeout) status2 = acpi_ex_enter_interpreter(); if (ACPI_FAILURE(status2)) { - /* Report fatal error, could not acquire interpreter */ return_ACPI_STATUS(status2); @@ -193,7 +191,7 @@ acpi_ex_system_acquire_mutex(union acpi_operand_object * time_desc, { acpi_status status = AE_OK; - ACPI_FUNCTION_TRACE_PTR(ex_system_acquire_mutex, obj_desc); + ACPI_FUNCTION_TRACE_PTR("ex_system_acquire_mutex", obj_desc); if (!obj_desc) { return_ACPI_STATUS(AE_BAD_PARAMETER); @@ -231,7 +229,7 @@ acpi_status acpi_ex_system_release_mutex(union acpi_operand_object *obj_desc) { acpi_status status = AE_OK; - ACPI_FUNCTION_TRACE(ex_system_release_mutex); + ACPI_FUNCTION_TRACE("ex_system_release_mutex"); if (!obj_desc) { return_ACPI_STATUS(AE_BAD_PARAMETER); @@ -265,7 +263,7 @@ acpi_status acpi_ex_system_signal_event(union acpi_operand_object *obj_desc) { acpi_status status = AE_OK; - ACPI_FUNCTION_TRACE(ex_system_signal_event); + ACPI_FUNCTION_TRACE("ex_system_signal_event"); if (obj_desc) { status = acpi_os_signal_semaphore(obj_desc->event.semaphore, 1); @@ -295,7 +293,7 @@ acpi_ex_system_wait_event(union acpi_operand_object *time_desc, { acpi_status status = AE_OK; - ACPI_FUNCTION_TRACE(ex_system_wait_event); + ACPI_FUNCTION_TRACE("ex_system_wait_event"); if (obj_desc) { status = diff --git a/trunk/drivers/acpi/executer/exutils.c b/trunk/drivers/acpi/executer/exutils.c index 982c8b65876f..f73a61aeb7ec 100644 --- a/trunk/drivers/acpi/executer/exutils.c +++ b/trunk/drivers/acpi/executer/exutils.c @@ -87,9 +87,9 @@ acpi_status acpi_ex_enter_interpreter(void) { acpi_status status; - ACPI_FUNCTION_TRACE(ex_enter_interpreter); + ACPI_FUNCTION_TRACE("ex_enter_interpreter"); - status = acpi_ut_acquire_mutex(ACPI_MTX_INTERPRETER); + status = acpi_ut_acquire_mutex(ACPI_MTX_EXECUTE); if (ACPI_FAILURE(status)) { ACPI_ERROR((AE_INFO, "Could not acquire interpreter mutex")); } @@ -123,9 +123,9 @@ void acpi_ex_exit_interpreter(void) { acpi_status status; - ACPI_FUNCTION_TRACE(ex_exit_interpreter); + ACPI_FUNCTION_TRACE("ex_exit_interpreter"); - status = acpi_ut_release_mutex(ACPI_MTX_INTERPRETER); + status = acpi_ut_release_mutex(ACPI_MTX_EXECUTE); if (ACPI_FAILURE(status)) { ACPI_ERROR((AE_INFO, "Could not release interpreter mutex")); } @@ -189,12 +189,11 @@ u8 acpi_ex_acquire_global_lock(u32 field_flags) u8 locked = FALSE; acpi_status status; - ACPI_FUNCTION_TRACE(ex_acquire_global_lock); + ACPI_FUNCTION_TRACE("ex_acquire_global_lock"); /* Only attempt lock if the always_lock bit is set */ if (field_flags & AML_FIELD_LOCK_RULE_MASK) { - /* We should attempt to get the lock, wait forever */ status = acpi_ev_acquire_global_lock(ACPI_WAIT_FOREVER); @@ -226,17 +225,15 @@ void acpi_ex_release_global_lock(u8 locked_by_me) { acpi_status status; - ACPI_FUNCTION_TRACE(ex_release_global_lock); + ACPI_FUNCTION_TRACE("ex_release_global_lock"); /* Only attempt unlock if the caller locked it */ if (locked_by_me) { - /* OK, now release the lock */ status = acpi_ev_release_global_lock(); if (ACPI_FAILURE(status)) { - /* Report the error, but there isn't much else we can do */ ACPI_EXCEPTION((AE_INFO, status, @@ -266,7 +263,7 @@ static u32 acpi_ex_digits_needed(acpi_integer value, u32 base) u32 num_digits; acpi_integer current_value; - ACPI_FUNCTION_TRACE(ex_digits_needed); + ACPI_FUNCTION_TRACE("ex_digits_needed"); /* acpi_integer is unsigned, so we don't worry about a '-' prefix */ diff --git a/trunk/drivers/acpi/hardware/hwacpi.c b/trunk/drivers/acpi/hardware/hwacpi.c index de50fab2a910..ea2f13271ff1 100644 --- a/trunk/drivers/acpi/hardware/hwacpi.c +++ b/trunk/drivers/acpi/hardware/hwacpi.c @@ -63,7 +63,7 @@ acpi_status acpi_hw_initialize(void) { acpi_status status; - ACPI_FUNCTION_TRACE(hw_initialize); + ACPI_FUNCTION_TRACE("hw_initialize"); /* We must have the ACPI tables by the time we get here */ @@ -100,7 +100,7 @@ acpi_status acpi_hw_set_mode(u32 mode) acpi_status status; u32 retry; - ACPI_FUNCTION_TRACE(hw_set_mode); + ACPI_FUNCTION_TRACE("hw_set_mode"); /* * ACPI 2.0 clarified that if SMI_CMD in FADT is zero, @@ -198,7 +198,7 @@ u32 acpi_hw_get_mode(void) acpi_status status; u32 value; - ACPI_FUNCTION_TRACE(hw_get_mode); + ACPI_FUNCTION_TRACE("hw_get_mode"); /* * ACPI 2.0 clarified that if SMI_CMD in FADT is zero, diff --git a/trunk/drivers/acpi/hardware/hwgpe.c b/trunk/drivers/acpi/hardware/hwgpe.c index 608a3a60ee11..d84942d22dd5 100644 --- a/trunk/drivers/acpi/hardware/hwgpe.c +++ b/trunk/drivers/acpi/hardware/hwgpe.c @@ -214,7 +214,6 @@ acpi_hw_disable_gpe_block(struct acpi_gpe_xrupt_info * gpe_xrupt_info, /* Examine each GPE Register within the block */ for (i = 0; i < gpe_block->register_count; i++) { - /* Disable all GPEs in this register */ status = acpi_hw_low_level_write(8, 0x00, @@ -251,7 +250,6 @@ acpi_hw_clear_gpe_block(struct acpi_gpe_xrupt_info * gpe_xrupt_info, /* Examine each GPE Register within the block */ for (i = 0; i < gpe_block->register_count; i++) { - /* Clear status on all GPEs in this register */ status = acpi_hw_low_level_write(8, 0xFF, @@ -370,7 +368,7 @@ acpi_status acpi_hw_disable_all_gpes(void) { acpi_status status; - ACPI_FUNCTION_TRACE(hw_disable_all_gpes); + ACPI_FUNCTION_TRACE("hw_disable_all_gpes"); status = acpi_ev_walk_gpe_list(acpi_hw_disable_gpe_block); status = acpi_ev_walk_gpe_list(acpi_hw_clear_gpe_block); @@ -393,7 +391,7 @@ acpi_status acpi_hw_enable_all_runtime_gpes(void) { acpi_status status; - ACPI_FUNCTION_TRACE(hw_enable_all_runtime_gpes); + ACPI_FUNCTION_TRACE("hw_enable_all_runtime_gpes"); status = acpi_ev_walk_gpe_list(acpi_hw_enable_runtime_gpe_block); return_ACPI_STATUS(status); @@ -415,7 +413,7 @@ acpi_status acpi_hw_enable_all_wakeup_gpes(void) { acpi_status status; - ACPI_FUNCTION_TRACE(hw_enable_all_wakeup_gpes); + ACPI_FUNCTION_TRACE("hw_enable_all_wakeup_gpes"); status = acpi_ev_walk_gpe_list(acpi_hw_enable_wakeup_gpe_block); return_ACPI_STATUS(status); diff --git a/trunk/drivers/acpi/hardware/hwregs.c b/trunk/drivers/acpi/hardware/hwregs.c index ae142de19507..e1fe75498415 100644 --- a/trunk/drivers/acpi/hardware/hwregs.c +++ b/trunk/drivers/acpi/hardware/hwregs.c @@ -43,6 +43,8 @@ * POSSIBILITY OF SUCH DAMAGES. */ +#include + #include #include #include @@ -61,21 +63,23 @@ ACPI_MODULE_NAME("hwregs") * DESCRIPTION: Clears all fixed and general purpose status bits * THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED * - * NOTE: TBD: Flags parameter is obsolete, to be removed - * ******************************************************************************/ acpi_status acpi_hw_clear_acpi_status(u32 flags) { acpi_status status; - acpi_cpu_flags lock_flags = 0; - ACPI_FUNCTION_TRACE(hw_clear_acpi_status); + ACPI_FUNCTION_TRACE("hw_clear_acpi_status"); ACPI_DEBUG_PRINT((ACPI_DB_IO, "About to write %04X to %04X\n", ACPI_BITMASK_ALL_FIXED_STATUS, (u16) acpi_gbl_FADT->xpm1a_evt_blk.address)); - lock_flags = acpi_os_acquire_lock(acpi_gbl_hardware_lock); + if (flags & ACPI_MTX_LOCK) { + status = acpi_ut_acquire_mutex(ACPI_MTX_HARDWARE); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); + } + } status = acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_STATUS, @@ -100,7 +104,9 @@ acpi_status acpi_hw_clear_acpi_status(u32 flags) status = acpi_ev_walk_gpe_list(acpi_hw_clear_gpe_block); unlock_and_exit: - acpi_os_release_lock(acpi_gbl_hardware_lock, lock_flags); + if (flags & ACPI_MTX_LOCK) { + (void)acpi_ut_release_mutex(ACPI_MTX_HARDWARE); + } return_ACPI_STATUS(status); } @@ -123,9 +129,10 @@ acpi_status acpi_get_sleep_type_data(u8 sleep_state, u8 * sleep_type_a, u8 * sleep_type_b) { acpi_status status = AE_OK; - struct acpi_evaluate_info *info; + struct acpi_parameter_info info; + char *sleep_state_name; - ACPI_FUNCTION_TRACE(acpi_get_sleep_type_data); + ACPI_FUNCTION_TRACE("acpi_get_sleep_type_data"); /* Validate parameters */ @@ -133,39 +140,34 @@ acpi_get_sleep_type_data(u8 sleep_state, u8 * sleep_type_a, u8 * sleep_type_b) return_ACPI_STATUS(AE_BAD_PARAMETER); } - /* Allocate the evaluation information block */ - - info = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_evaluate_info)); - if (!info) { - return_ACPI_STATUS(AE_NO_MEMORY); - } + /* Evaluate the namespace object containing the values for this state */ - info->pathname = + info.parameters = NULL; + info.return_object = NULL; + sleep_state_name = ACPI_CAST_PTR(char, acpi_gbl_sleep_state_names[sleep_state]); - /* Evaluate the namespace object containing the values for this state */ - - status = acpi_ns_evaluate(info); + status = acpi_ns_evaluate_by_name(sleep_state_name, &info); if (ACPI_FAILURE(status)) { ACPI_DEBUG_PRINT((ACPI_DB_EXEC, - "%s while evaluating SleepState [%s]\n", + "%s while evaluating sleep_state [%s]\n", acpi_format_exception(status), - info->pathname)); + sleep_state_name)); - goto cleanup; + return_ACPI_STATUS(status); } /* Must have a return object */ - if (!info->return_object) { + if (!info.return_object) { ACPI_ERROR((AE_INFO, "No Sleep State object returned from [%s]", - info->pathname)); + sleep_state_name)); status = AE_NOT_EXIST; } /* It must be of type Package */ - else if (ACPI_GET_OBJECT_TYPE(info->return_object) != ACPI_TYPE_PACKAGE) { + else if (ACPI_GET_OBJECT_TYPE(info.return_object) != ACPI_TYPE_PACKAGE) { ACPI_ERROR((AE_INFO, "Sleep State return object is not a Package")); status = AE_AML_OPERAND_TYPE; @@ -178,7 +180,7 @@ acpi_get_sleep_type_data(u8 sleep_state, u8 * sleep_type_a, u8 * sleep_type_b) * by BIOS vendors seems to be to have 2 or more elements, at least * one per sleep type (A/B). */ - else if (info->return_object->package.count < 2) { + else if (info.return_object->package.count < 2) { ACPI_ERROR((AE_INFO, "Sleep State return package does not have at least two elements")); status = AE_AML_NO_OPERAND; @@ -186,42 +188,39 @@ acpi_get_sleep_type_data(u8 sleep_state, u8 * sleep_type_a, u8 * sleep_type_b) /* The first two elements must both be of type Integer */ - else if ((ACPI_GET_OBJECT_TYPE(info->return_object->package.elements[0]) + else if ((ACPI_GET_OBJECT_TYPE(info.return_object->package.elements[0]) != ACPI_TYPE_INTEGER) || - (ACPI_GET_OBJECT_TYPE(info->return_object->package.elements[1]) + (ACPI_GET_OBJECT_TYPE(info.return_object->package.elements[1]) != ACPI_TYPE_INTEGER)) { ACPI_ERROR((AE_INFO, "Sleep State return package elements are not both Integers (%s, %s)", - acpi_ut_get_object_type_name(info->return_object-> + acpi_ut_get_object_type_name(info.return_object-> package.elements[0]), - acpi_ut_get_object_type_name(info->return_object-> + acpi_ut_get_object_type_name(info.return_object-> package.elements[1]))); status = AE_AML_OPERAND_TYPE; } else { /* Valid _Sx_ package size, type, and value */ *sleep_type_a = (u8) - (info->return_object->package.elements[0])->integer.value; + (info.return_object->package.elements[0])->integer.value; *sleep_type_b = (u8) - (info->return_object->package.elements[1])->integer.value; + (info.return_object->package.elements[1])->integer.value; } if (ACPI_FAILURE(status)) { ACPI_EXCEPTION((AE_INFO, status, - "While evaluating SleepState [%s], bad Sleep object %p type %s", - info->pathname, info->return_object, - acpi_ut_get_object_type_name(info-> + "While evaluating sleep_state [%s], bad Sleep object %p type %s", + sleep_state_name, info.return_object, + acpi_ut_get_object_type_name(info. return_object))); } - acpi_ut_remove_reference(info->return_object); - - cleanup: - ACPI_FREE(info); + acpi_ut_remove_reference(info.return_object); return_ACPI_STATUS(status); } -ACPI_EXPORT_SYMBOL(acpi_get_sleep_type_data) +EXPORT_SYMBOL(acpi_get_sleep_type_data); /******************************************************************************* * @@ -234,12 +233,13 @@ ACPI_EXPORT_SYMBOL(acpi_get_sleep_type_data) * DESCRIPTION: Map register_id into a register bitmask. * ******************************************************************************/ + struct acpi_bit_register_info *acpi_hw_get_bit_register_info(u32 register_id) { ACPI_FUNCTION_ENTRY(); if (register_id > ACPI_BITREG_MAX) { - ACPI_ERROR((AE_INFO, "Invalid BitRegister ID: %X", + ACPI_ERROR((AE_INFO, "Invalid bit_register ID: %X", register_id)); return (NULL); } @@ -260,8 +260,6 @@ struct acpi_bit_register_info *acpi_hw_get_bit_register_info(u32 register_id) * * DESCRIPTION: ACPI bit_register read function. * - * NOTE: TBD: Flags parameter is obsolete, to be removed - * ******************************************************************************/ acpi_status acpi_get_register(u32 register_id, u32 * return_value, u32 flags) @@ -270,7 +268,7 @@ acpi_status acpi_get_register(u32 register_id, u32 * return_value, u32 flags) struct acpi_bit_register_info *bit_reg_info; acpi_status status; - ACPI_FUNCTION_TRACE(acpi_get_register); + ACPI_FUNCTION_TRACE("acpi_get_register"); /* Get the info structure corresponding to the requested ACPI Register */ @@ -279,14 +277,24 @@ acpi_status acpi_get_register(u32 register_id, u32 * return_value, u32 flags) return_ACPI_STATUS(AE_BAD_PARAMETER); } + if (flags & ACPI_MTX_LOCK) { + status = acpi_ut_acquire_mutex(ACPI_MTX_HARDWARE); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); + } + } + /* Read from the register */ - status = acpi_hw_register_read(ACPI_MTX_LOCK, + status = acpi_hw_register_read(ACPI_MTX_DO_NOT_LOCK, bit_reg_info->parent_register, ®ister_value); - if (ACPI_SUCCESS(status)) { + if (flags & ACPI_MTX_LOCK) { + (void)acpi_ut_release_mutex(ACPI_MTX_HARDWARE); + } + if (ACPI_SUCCESS(status)) { /* Normalize the value that was read */ register_value = @@ -303,7 +311,7 @@ acpi_status acpi_get_register(u32 register_id, u32 * return_value, u32 flags) return_ACPI_STATUS(status); } -ACPI_EXPORT_SYMBOL(acpi_get_register) +EXPORT_SYMBOL(acpi_get_register); /******************************************************************************* * @@ -318,28 +326,31 @@ ACPI_EXPORT_SYMBOL(acpi_get_register) * * DESCRIPTION: ACPI Bit Register write function. * - * NOTE: TBD: Flags parameter is obsolete, to be removed - * ******************************************************************************/ + acpi_status acpi_set_register(u32 register_id, u32 value, u32 flags) { u32 register_value = 0; struct acpi_bit_register_info *bit_reg_info; acpi_status status; - acpi_cpu_flags lock_flags; - ACPI_FUNCTION_TRACE_U32(acpi_set_register, register_id); + ACPI_FUNCTION_TRACE_U32("acpi_set_register", register_id); /* Get the info structure corresponding to the requested ACPI Register */ bit_reg_info = acpi_hw_get_bit_register_info(register_id); if (!bit_reg_info) { - ACPI_ERROR((AE_INFO, "Bad ACPI HW RegisterId: %X", + ACPI_ERROR((AE_INFO, "Bad ACPI HW register_id: %X", register_id)); return_ACPI_STATUS(AE_BAD_PARAMETER); } - lock_flags = acpi_os_acquire_lock(acpi_gbl_hardware_lock); + if (flags & ACPI_MTX_LOCK) { + status = acpi_ut_acquire_mutex(ACPI_MTX_HARDWARE); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); + } + } /* Always do a register read first so we can insert the new bits */ @@ -447,7 +458,9 @@ acpi_status acpi_set_register(u32 register_id, u32 value, u32 flags) unlock_and_exit: - acpi_os_release_lock(acpi_gbl_hardware_lock, lock_flags); + if (flags & ACPI_MTX_LOCK) { + (void)acpi_ut_release_mutex(ACPI_MTX_HARDWARE); + } /* Normalize the value that was read */ @@ -461,7 +474,7 @@ acpi_status acpi_set_register(u32 register_id, u32 value, u32 flags) return_ACPI_STATUS(status); } -ACPI_EXPORT_SYMBOL(acpi_set_register) +EXPORT_SYMBOL(acpi_set_register); /****************************************************************************** * @@ -477,18 +490,21 @@ ACPI_EXPORT_SYMBOL(acpi_set_register) * given offset. * ******************************************************************************/ + acpi_status acpi_hw_register_read(u8 use_lock, u32 register_id, u32 * return_value) { u32 value1 = 0; u32 value2 = 0; acpi_status status; - acpi_cpu_flags lock_flags = 0; - ACPI_FUNCTION_TRACE(hw_register_read); + ACPI_FUNCTION_TRACE("hw_register_read"); if (ACPI_MTX_LOCK == use_lock) { - lock_flags = acpi_os_acquire_lock(acpi_gbl_hardware_lock); + status = acpi_ut_acquire_mutex(ACPI_MTX_HARDWARE); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); + } } switch (register_id) { @@ -566,7 +582,7 @@ acpi_hw_register_read(u8 use_lock, u32 register_id, u32 * return_value) unlock_and_exit: if (ACPI_MTX_LOCK == use_lock) { - acpi_os_release_lock(acpi_gbl_hardware_lock, lock_flags); + (void)acpi_ut_release_mutex(ACPI_MTX_HARDWARE); } if (ACPI_SUCCESS(status)) { @@ -594,12 +610,14 @@ acpi_hw_register_read(u8 use_lock, u32 register_id, u32 * return_value) acpi_status acpi_hw_register_write(u8 use_lock, u32 register_id, u32 value) { acpi_status status; - acpi_cpu_flags lock_flags = 0; - ACPI_FUNCTION_TRACE(hw_register_write); + ACPI_FUNCTION_TRACE("hw_register_write"); if (ACPI_MTX_LOCK == use_lock) { - lock_flags = acpi_os_acquire_lock(acpi_gbl_hardware_lock); + status = acpi_ut_acquire_mutex(ACPI_MTX_HARDWARE); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); + } } switch (register_id) { @@ -689,7 +707,7 @@ acpi_status acpi_hw_register_write(u8 use_lock, u32 register_id, u32 value) unlock_and_exit: if (ACPI_MTX_LOCK == use_lock) { - acpi_os_release_lock(acpi_gbl_hardware_lock, lock_flags); + (void)acpi_ut_release_mutex(ACPI_MTX_HARDWARE); } return_ACPI_STATUS(status); @@ -715,7 +733,7 @@ acpi_hw_low_level_read(u32 width, u32 * value, struct acpi_generic_address *reg) u64 address; acpi_status status; - ACPI_FUNCTION_NAME(hw_low_level_read); + ACPI_FUNCTION_NAME("hw_low_level_read"); /* * Must have a valid pointer to a GAS structure, and @@ -787,7 +805,7 @@ acpi_hw_low_level_write(u32 width, u32 value, struct acpi_generic_address * reg) u64 address; acpi_status status; - ACPI_FUNCTION_NAME(hw_low_level_write); + ACPI_FUNCTION_NAME("hw_low_level_write"); /* * Must have a valid pointer to a GAS structure, and diff --git a/trunk/drivers/acpi/hardware/hwsleep.c b/trunk/drivers/acpi/hardware/hwsleep.c index 8bb43cae60c2..89269272fd62 100644 --- a/trunk/drivers/acpi/hardware/hwsleep.c +++ b/trunk/drivers/acpi/hardware/hwsleep.c @@ -42,6 +42,7 @@ * POSSIBILITY OF SUCH DAMAGES. */ +#include #include #define _COMPONENT ACPI_HARDWARE @@ -63,7 +64,7 @@ acpi_status acpi_set_firmware_waking_vector(acpi_physical_address physical_address) { - ACPI_FUNCTION_TRACE(acpi_set_firmware_waking_vector); + ACPI_FUNCTION_TRACE("acpi_set_firmware_waking_vector"); /* Set the vector */ @@ -78,8 +79,6 @@ acpi_set_firmware_waking_vector(acpi_physical_address physical_address) return_ACPI_STATUS(AE_OK); } -ACPI_EXPORT_SYMBOL(acpi_set_firmware_waking_vector) - /******************************************************************************* * * FUNCTION: acpi_get_firmware_waking_vector @@ -93,12 +92,13 @@ ACPI_EXPORT_SYMBOL(acpi_set_firmware_waking_vector) * DESCRIPTION: Access function for the firmware_waking_vector field in FACS * ******************************************************************************/ + #ifdef ACPI_FUTURE_USAGE acpi_status acpi_get_firmware_waking_vector(acpi_physical_address * physical_address) { - ACPI_FUNCTION_TRACE(acpi_get_firmware_waking_vector); + ACPI_FUNCTION_TRACE("acpi_get_firmware_waking_vector"); if (!physical_address) { return_ACPI_STATUS(AE_BAD_PARAMETER); @@ -118,8 +118,6 @@ acpi_get_firmware_waking_vector(acpi_physical_address * physical_address) return_ACPI_STATUS(AE_OK); } - -ACPI_EXPORT_SYMBOL(acpi_get_firmware_waking_vector) #endif /******************************************************************************* @@ -136,13 +134,14 @@ ACPI_EXPORT_SYMBOL(acpi_get_firmware_waking_vector) * various OS-specific tasks between the two steps. * ******************************************************************************/ + acpi_status acpi_enter_sleep_state_prep(u8 sleep_state) { acpi_status status; struct acpi_object_list arg_list; union acpi_object arg; - ACPI_FUNCTION_TRACE(acpi_enter_sleep_state_prep); + ACPI_FUNCTION_TRACE("acpi_enter_sleep_state_prep"); /* * _PSW methods could be run here to enable wake-on keyboard, LAN, etc. @@ -207,8 +206,6 @@ acpi_status acpi_enter_sleep_state_prep(u8 sleep_state) return_ACPI_STATUS(AE_OK); } -ACPI_EXPORT_SYMBOL(acpi_enter_sleep_state_prep) - /******************************************************************************* * * FUNCTION: acpi_enter_sleep_state @@ -221,6 +218,7 @@ ACPI_EXPORT_SYMBOL(acpi_enter_sleep_state_prep) * THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED * ******************************************************************************/ + acpi_status asmlinkage acpi_enter_sleep_state(u8 sleep_state) { u32 PM1Acontrol; @@ -230,7 +228,7 @@ acpi_status asmlinkage acpi_enter_sleep_state(u8 sleep_state) u32 in_value; acpi_status status; - ACPI_FUNCTION_TRACE(acpi_enter_sleep_state); + ACPI_FUNCTION_TRACE("acpi_enter_sleep_state"); if ((acpi_gbl_sleep_type_a > ACPI_SLEEP_TYPE_MAX) || (acpi_gbl_sleep_type_b > ACPI_SLEEP_TYPE_MAX)) { @@ -380,7 +378,7 @@ acpi_status asmlinkage acpi_enter_sleep_state(u8 sleep_state) return_ACPI_STATUS(AE_OK); } -ACPI_EXPORT_SYMBOL(acpi_enter_sleep_state) +EXPORT_SYMBOL(acpi_enter_sleep_state); /******************************************************************************* * @@ -394,12 +392,13 @@ ACPI_EXPORT_SYMBOL(acpi_enter_sleep_state) * THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED * ******************************************************************************/ + acpi_status asmlinkage acpi_enter_sleep_state_s4bios(void) { u32 in_value; acpi_status status; - ACPI_FUNCTION_TRACE(acpi_enter_sleep_state_s4bios); + ACPI_FUNCTION_TRACE("acpi_enter_sleep_state_s4bios"); status = acpi_set_register(ACPI_BITREG_WAKE_STATUS, 1, ACPI_MTX_DO_NOT_LOCK); @@ -444,7 +443,7 @@ acpi_status asmlinkage acpi_enter_sleep_state_s4bios(void) return_ACPI_STATUS(AE_OK); } -ACPI_EXPORT_SYMBOL(acpi_enter_sleep_state_s4bios) +EXPORT_SYMBOL(acpi_enter_sleep_state_s4bios); /******************************************************************************* * @@ -458,6 +457,7 @@ ACPI_EXPORT_SYMBOL(acpi_enter_sleep_state_s4bios) * Called with interrupts ENABLED. * ******************************************************************************/ + acpi_status acpi_leave_sleep_state(u8 sleep_state) { struct acpi_object_list arg_list; @@ -468,7 +468,7 @@ acpi_status acpi_leave_sleep_state(u8 sleep_state) u32 PM1Acontrol; u32 PM1Bcontrol; - ACPI_FUNCTION_TRACE(acpi_leave_sleep_state); + ACPI_FUNCTION_TRACE("acpi_leave_sleep_state"); /* * Set SLP_TYPE and SLP_EN to state S0. @@ -490,7 +490,6 @@ acpi_status acpi_leave_sleep_state(u8 sleep_state) ACPI_REGISTER_PM1_CONTROL, &PM1Acontrol); if (ACPI_SUCCESS(status)) { - /* Clear SLP_EN and SLP_TYP fields */ PM1Acontrol &= ~(sleep_type_reg_info->access_bit_mask | @@ -584,5 +583,3 @@ acpi_status acpi_leave_sleep_state(u8 sleep_state) return_ACPI_STATUS(status); } - -ACPI_EXPORT_SYMBOL(acpi_leave_sleep_state) diff --git a/trunk/drivers/acpi/hardware/hwtimer.c b/trunk/drivers/acpi/hardware/hwtimer.c index c4ec47c939fd..fc10b7cb456f 100644 --- a/trunk/drivers/acpi/hardware/hwtimer.c +++ b/trunk/drivers/acpi/hardware/hwtimer.c @@ -42,6 +42,7 @@ * POSSIBILITY OF SUCH DAMAGES. */ +#include #include #define _COMPONENT ACPI_HARDWARE @@ -60,13 +61,13 @@ ACPI_MODULE_NAME("hwtimer") ******************************************************************************/ acpi_status acpi_get_timer_resolution(u32 * resolution) { - ACPI_FUNCTION_TRACE(acpi_get_timer_resolution); + ACPI_FUNCTION_TRACE("acpi_get_timer_resolution"); if (!resolution) { return_ACPI_STATUS(AE_BAD_PARAMETER); } - if (acpi_gbl_FADT->tmr_val_ext == 0) { + if (0 == acpi_gbl_FADT->tmr_val_ext) { *resolution = 24; } else { *resolution = 32; @@ -75,8 +76,6 @@ acpi_status acpi_get_timer_resolution(u32 * resolution) return_ACPI_STATUS(AE_OK); } -ACPI_EXPORT_SYMBOL(acpi_get_timer_resolution) - /****************************************************************************** * * FUNCTION: acpi_get_timer @@ -88,11 +87,12 @@ ACPI_EXPORT_SYMBOL(acpi_get_timer_resolution) * DESCRIPTION: Obtains current value of ACPI PM Timer (in ticks). * ******************************************************************************/ + acpi_status acpi_get_timer(u32 * ticks) { acpi_status status; - ACPI_FUNCTION_TRACE(acpi_get_timer); + ACPI_FUNCTION_TRACE("acpi_get_timer"); if (!ticks) { return_ACPI_STATUS(AE_BAD_PARAMETER); @@ -103,7 +103,7 @@ acpi_status acpi_get_timer(u32 * ticks) return_ACPI_STATUS(status); } -ACPI_EXPORT_SYMBOL(acpi_get_timer) +EXPORT_SYMBOL(acpi_get_timer); /****************************************************************************** * @@ -133,6 +133,7 @@ ACPI_EXPORT_SYMBOL(acpi_get_timer) * 2**32 Ticks / 3,600,000 Ticks/Sec = 1193 sec or 19.88 minutes * ******************************************************************************/ + acpi_status acpi_get_timer_duration(u32 start_ticks, u32 end_ticks, u32 * time_elapsed) { @@ -140,7 +141,7 @@ acpi_get_timer_duration(u32 start_ticks, u32 end_ticks, u32 * time_elapsed) u32 delta_ticks; acpi_integer quotient; - ACPI_FUNCTION_TRACE(acpi_get_timer_duration); + ACPI_FUNCTION_TRACE("acpi_get_timer_duration"); if (!time_elapsed) { return_ACPI_STATUS(AE_BAD_PARAMETER); @@ -153,8 +154,7 @@ acpi_get_timer_duration(u32 start_ticks, u32 end_ticks, u32 * time_elapsed) if (start_ticks < end_ticks) { delta_ticks = end_ticks - start_ticks; } else if (start_ticks > end_ticks) { - if (acpi_gbl_FADT->tmr_val_ext == 0) { - + if (0 == acpi_gbl_FADT->tmr_val_ext) { /* 24-bit Timer */ delta_ticks = @@ -183,4 +183,4 @@ acpi_get_timer_duration(u32 start_ticks, u32 end_ticks, u32 * time_elapsed) return_ACPI_STATUS(status); } -ACPI_EXPORT_SYMBOL(acpi_get_timer_duration) +EXPORT_SYMBOL(acpi_get_timer_duration); diff --git a/trunk/drivers/acpi/hotkey.c b/trunk/drivers/acpi/hotkey.c index c25b2b92edcf..2e2e4051dfa7 100644 --- a/trunk/drivers/acpi/hotkey.c +++ b/trunk/drivers/acpi/hotkey.c @@ -723,8 +723,6 @@ get_parms(char *config_record, goto do_fail; count = tmp1 - tmp; *action_handle = (char *)kmalloc(count + 1, GFP_KERNEL); - if (!*action_handle) - goto do_fail; strncpy(*action_handle, tmp, count); *(*action_handle + count) = 0; diff --git a/trunk/drivers/acpi/ibm_acpi.c b/trunk/drivers/acpi/ibm_acpi.c index 262b1f41335a..15fc12482ba0 100644 --- a/trunk/drivers/acpi/ibm_acpi.c +++ b/trunk/drivers/acpi/ibm_acpi.c @@ -567,6 +567,69 @@ static int bluetooth_write(char *buf) return 0; } +static int wan_supported; + +static int wan_init(void) +{ + wan_supported = hkey_handle && + acpi_evalf(hkey_handle, NULL, "GWAN", "qv"); + + return 0; +} + +static int wan_status(void) +{ + int status; + + if (!wan_supported || + !acpi_evalf(hkey_handle, &status, "GWAN", "d")) + status = 0; + + return status; +} + +static int wan_read(char *p) +{ + int len = 0; + int status = wan_status(); + + if (!wan_supported) + len += sprintf(p + len, "status:\t\tnot supported\n"); + else if (!(status & 1)) + len += sprintf(p + len, "status:\t\tnot installed\n"); + else { + len += sprintf(p + len, "status:\t\t%s\n", enabled(status, 1)); + len += sprintf(p + len, "commands:\tenable, disable\n"); + } + + return len; +} + +static int wan_write(char *buf) +{ + int status = wan_status(); + char *cmd; + int do_cmd = 0; + + if (!wan_supported) + return -ENODEV; + + while ((cmd = next_cmd(&buf))) { + if (strlencmp(cmd, "enable") == 0) { + status |= 2; + } else if (strlencmp(cmd, "disable") == 0) { + status &= ~2; + } else + return -EINVAL; + do_cmd = 1; + } + + if (do_cmd && !acpi_evalf(hkey_handle, NULL, "SWAN", "vd", status)) + return -EIO; + + return 0; +} + static int video_supported; static int video_orig_autosw; @@ -1562,6 +1625,13 @@ static struct ibm_struct ibms[] = { .read = bluetooth_read, .write = bluetooth_write, }, + { + .name = "wan", + .init = wan_init, + .read = wan_read, + .write = wan_write, + .experimental = 1, + }, { .name = "video", .init = video_init, diff --git a/trunk/drivers/acpi/motherboard.c b/trunk/drivers/acpi/motherboard.c index d51d68f5dd8d..468244147ec1 100644 --- a/trunk/drivers/acpi/motherboard.c +++ b/trunk/drivers/acpi/motherboard.c @@ -37,7 +37,7 @@ ACPI_MODULE_NAME("acpi_motherboard") #define ACPI_MB_HID2 "PNP0C02" /** * Doesn't care about legacy IO ports, only IO ports beyond 0x1000 are reserved - * Doesn't care about the failure of 'request_region', since other may reserve + * Doesn't care about the failure of 'request_region', since other may reserve * the io ports as well */ #define IS_RESERVED_ADDR(base, len) \ @@ -46,7 +46,7 @@ ACPI_MODULE_NAME("acpi_motherboard") /* * Clearing the flag (IORESOURCE_BUSY) allows drivers to use * the io ports if they really know they can use it, while - * still preventing hotplug PCI devices from using it. + * still preventing hotplug PCI devices from using it. */ static acpi_status acpi_reserve_io_ranges(struct acpi_resource *res, void *data) { @@ -123,54 +123,49 @@ static struct acpi_driver acpi_motherboard_driver2 = { }, }; -static void __init acpi_request_region (struct acpi_generic_address *addr, - unsigned int length, char *desc) -{ - if (!addr->address || !length) - return; - - if (addr->address_space_id == ACPI_ADR_SPACE_SYSTEM_IO) - request_region(addr->address, length, desc); - else if (addr->address_space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) - request_mem_region(addr->address, length, desc); -} - static void __init acpi_reserve_resources(void) { - acpi_request_region(&acpi_gbl_FADT->xpm1a_evt_blk, - acpi_gbl_FADT->pm1_evt_len, "ACPI PM1a_EVT_BLK"); + if (acpi_gbl_FADT->xpm1a_evt_blk.address && acpi_gbl_FADT->pm1_evt_len) + request_region(acpi_gbl_FADT->xpm1a_evt_blk.address, + acpi_gbl_FADT->pm1_evt_len, "PM1a_EVT_BLK"); - acpi_request_region(&acpi_gbl_FADT->xpm1b_evt_blk, - acpi_gbl_FADT->pm1_evt_len, "ACPI PM1b_EVT_BLK"); + if (acpi_gbl_FADT->xpm1b_evt_blk.address && acpi_gbl_FADT->pm1_evt_len) + request_region(acpi_gbl_FADT->xpm1b_evt_blk.address, + acpi_gbl_FADT->pm1_evt_len, "PM1b_EVT_BLK"); - acpi_request_region(&acpi_gbl_FADT->xpm1a_cnt_blk, - acpi_gbl_FADT->pm1_cnt_len, "ACPI PM1a_CNT_BLK"); + if (acpi_gbl_FADT->xpm1a_cnt_blk.address && acpi_gbl_FADT->pm1_cnt_len) + request_region(acpi_gbl_FADT->xpm1a_cnt_blk.address, + acpi_gbl_FADT->pm1_cnt_len, "PM1a_CNT_BLK"); - acpi_request_region(&acpi_gbl_FADT->xpm1b_cnt_blk, - acpi_gbl_FADT->pm1_cnt_len, "ACPI PM1b_CNT_BLK"); + if (acpi_gbl_FADT->xpm1b_cnt_blk.address && acpi_gbl_FADT->pm1_cnt_len) + request_region(acpi_gbl_FADT->xpm1b_cnt_blk.address, + acpi_gbl_FADT->pm1_cnt_len, "PM1b_CNT_BLK"); - if (acpi_gbl_FADT->pm_tm_len == 4) - acpi_request_region(&acpi_gbl_FADT->xpm_tmr_blk, 4, "ACPI PM_TMR"); + if (acpi_gbl_FADT->xpm_tmr_blk.address && acpi_gbl_FADT->pm_tm_len == 4) + request_region(acpi_gbl_FADT->xpm_tmr_blk.address, 4, "PM_TMR"); - acpi_request_region(&acpi_gbl_FADT->xpm2_cnt_blk, - acpi_gbl_FADT->pm2_cnt_len, "ACPI PM2_CNT_BLK"); + if (acpi_gbl_FADT->xpm2_cnt_blk.address && acpi_gbl_FADT->pm2_cnt_len) + request_region(acpi_gbl_FADT->xpm2_cnt_blk.address, + acpi_gbl_FADT->pm2_cnt_len, "PM2_CNT_BLK"); /* Length of GPE blocks must be a non-negative multiple of 2 */ - if (!(acpi_gbl_FADT->gpe0_blk_len & 0x1)) - acpi_request_region(&acpi_gbl_FADT->xgpe0_blk, - acpi_gbl_FADT->gpe0_blk_len, "ACPI GPE0_BLK"); + if (acpi_gbl_FADT->xgpe0_blk.address && acpi_gbl_FADT->gpe0_blk_len && + !(acpi_gbl_FADT->gpe0_blk_len & 0x1)) + request_region(acpi_gbl_FADT->xgpe0_blk.address, + acpi_gbl_FADT->gpe0_blk_len, "GPE0_BLK"); - if (!(acpi_gbl_FADT->gpe1_blk_len & 0x1)) - acpi_request_region(&acpi_gbl_FADT->xgpe1_blk, - acpi_gbl_FADT->gpe1_blk_len, "ACPI GPE1_BLK"); + if (acpi_gbl_FADT->xgpe1_blk.address && acpi_gbl_FADT->gpe1_blk_len && + !(acpi_gbl_FADT->gpe1_blk_len & 0x1)) + request_region(acpi_gbl_FADT->xgpe1_blk.address, + acpi_gbl_FADT->gpe1_blk_len, "GPE1_BLK"); } static int __init acpi_motherboard_init(void) { acpi_bus_register_driver(&acpi_motherboard_driver1); acpi_bus_register_driver(&acpi_motherboard_driver2); - /* + /* * Guarantee motherboard IO reservation first * This module must run after scan.c */ diff --git a/trunk/drivers/acpi/namespace/nsaccess.c b/trunk/drivers/acpi/namespace/nsaccess.c index 48fadade52e2..1149bc18fb35 100644 --- a/trunk/drivers/acpi/namespace/nsaccess.c +++ b/trunk/drivers/acpi/namespace/nsaccess.c @@ -70,7 +70,7 @@ acpi_status acpi_ns_root_initialize(void) union acpi_operand_object *obj_desc; acpi_string val = NULL; - ACPI_FUNCTION_TRACE(ns_root_initialize); + ACPI_FUNCTION_TRACE("ns_root_initialize"); status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); if (ACPI_FAILURE(status)) { @@ -98,7 +98,6 @@ acpi_status acpi_ns_root_initialize(void) "Entering predefined entries into namespace\n")); for (init_val = acpi_gbl_pre_defined_names; init_val->name; init_val++) { - /* _OSI is optional for now, will be permanent later */ if (!ACPI_STRCMP(init_val->name, "_OSI") @@ -157,7 +156,7 @@ acpi_status acpi_ns_root_initialize(void) #if defined (ACPI_ASL_COMPILER) - /* Save the parameter count for the i_aSL compiler */ + /* save the parameter count for the i_aSL compiler */ new_node->value = obj_desc->method.param_count; #else @@ -259,8 +258,10 @@ acpi_status acpi_ns_root_initialize(void) /* Save a handle to "_GPE", it is always present */ if (ACPI_SUCCESS(status)) { - status = acpi_ns_get_node(NULL, "\\_GPE", ACPI_NS_NO_UPSEARCH, - &acpi_gbl_fadt_gpe_device); + status = + acpi_ns_get_node_by_path("\\_GPE", NULL, + ACPI_NS_NO_UPSEARCH, + &acpi_gbl_fadt_gpe_device); } return_ACPI_STATUS(status); @@ -309,17 +310,17 @@ acpi_ns_lookup(union acpi_generic_state *scope_info, acpi_object_type type_to_check_for; acpi_object_type this_search_type; u32 search_parent_flag = ACPI_NS_SEARCH_PARENT; - u32 local_flags; + u32 local_flags = flags & ~(ACPI_NS_ERROR_IF_FOUND | + ACPI_NS_SEARCH_PARENT); - ACPI_FUNCTION_TRACE(ns_lookup); + ACPI_FUNCTION_TRACE("ns_lookup"); if (!return_node) { return_ACPI_STATUS(AE_BAD_PARAMETER); } - local_flags = flags & ~(ACPI_NS_ERROR_IF_FOUND | ACPI_NS_SEARCH_PARENT); - *return_node = ACPI_ENTRY_NOT_FOUND; acpi_gbl_ns_lookup_count++; + *return_node = ACPI_ENTRY_NOT_FOUND; if (!acpi_gbl_root_node) { return_ACPI_STATUS(AE_NO_NAMESPACE); @@ -345,17 +346,14 @@ acpi_ns_lookup(union acpi_generic_state *scope_info, return_ACPI_STATUS(AE_AML_INTERNAL); } - if (!(flags & ACPI_NS_PREFIX_IS_SCOPE)) { - /* - * This node might not be a actual "scope" node (such as a - * Device/Method, etc.) It could be a Package or other object node. - * Backup up the tree to find the containing scope node. - */ - while (!acpi_ns_opens_scope(prefix_node->type) && - prefix_node->type != ACPI_TYPE_ANY) { - prefix_node = - acpi_ns_get_parent_node(prefix_node); - } + /* + * This node might not be a actual "scope" node (such as a + * Device/Method, etc.) It could be a Package or other object node. + * Backup up the tree to find the containing scope node. + */ + while (!acpi_ns_opens_scope(prefix_node->type) && + prefix_node->type != ACPI_TYPE_ANY) { + prefix_node = acpi_ns_get_parent_node(prefix_node); } } @@ -367,7 +365,6 @@ acpi_ns_lookup(union acpi_generic_state *scope_info, * Begin examination of the actual pathname */ if (!pathname) { - /* A Null name_path is allowed and refers to the root */ num_segments = 0; @@ -392,7 +389,6 @@ acpi_ns_lookup(union acpi_generic_state *scope_info, * to the current scope). */ if (*path == (u8) AML_ROOT_PREFIX) { - /* Pathname is fully qualified, start from the root */ this_node = acpi_gbl_root_node; @@ -420,7 +416,6 @@ acpi_ns_lookup(union acpi_generic_state *scope_info, this_node = prefix_node; num_carats = 0; while (*path == (u8) AML_PARENT_PREFIX) { - /* Name is fully qualified, no search rules apply */ search_parent_flag = ACPI_NS_NO_UPSEARCH; @@ -435,7 +430,6 @@ acpi_ns_lookup(union acpi_generic_state *scope_info, num_carats++; this_node = acpi_ns_get_parent_node(this_node); if (!this_node) { - /* Current scope has no parent scope */ ACPI_ERROR((AE_INFO, @@ -575,7 +569,6 @@ acpi_ns_lookup(union acpi_generic_state *scope_info, &this_node); if (ACPI_FAILURE(status)) { if (status == AE_NOT_FOUND) { - /* Name not found in ACPI namespace */ ACPI_DEBUG_PRINT((ACPI_DB_NAMES, @@ -609,11 +602,10 @@ acpi_ns_lookup(union acpi_generic_state *scope_info, (type_to_check_for != ACPI_TYPE_LOCAL_SCOPE) && (this_node->type != ACPI_TYPE_ANY) && (this_node->type != type_to_check_for)) { - /* Complain about a type mismatch */ ACPI_WARNING((AE_INFO, - "NsLookup: Type mismatch on %4.4s (%s), searching for (%s)", + "ns_lookup: Type mismatch on %4.4s (%s), searching for (%s)", ACPI_CAST_PTR(char, &simple_name), acpi_ut_get_type_name(this_node->type), acpi_ut_get_type_name diff --git a/trunk/drivers/acpi/namespace/nsalloc.c b/trunk/drivers/acpi/namespace/nsalloc.c index dc3f0739a46b..9b871f38b61b 100644 --- a/trunk/drivers/acpi/namespace/nsalloc.c +++ b/trunk/drivers/acpi/namespace/nsalloc.c @@ -47,6 +47,9 @@ #define _COMPONENT ACPI_NAMESPACE ACPI_MODULE_NAME("nsalloc") +/* Local prototypes */ +static void acpi_ns_remove_reference(struct acpi_namespace_node *node); + /******************************************************************************* * * FUNCTION: acpi_ns_create_node @@ -58,13 +61,14 @@ ACPI_MODULE_NAME("nsalloc") * DESCRIPTION: Create a namespace node * ******************************************************************************/ + struct acpi_namespace_node *acpi_ns_create_node(u32 name) { struct acpi_namespace_node *node; - ACPI_FUNCTION_TRACE(ns_create_node); + ACPI_FUNCTION_TRACE("ns_create_node"); - node = acpi_os_acquire_object(acpi_gbl_namespace_cache); + node = ACPI_MEM_CALLOCATE(sizeof(struct acpi_namespace_node)); if (!node) { return_PTR(NULL); } @@ -72,7 +76,9 @@ struct acpi_namespace_node *acpi_ns_create_node(u32 name) ACPI_MEM_TRACKING(acpi_gbl_ns_node_list->total_allocated++); node->name.integer = name; + node->reference_count = 1; ACPI_SET_DESCRIPTOR_TYPE(node, ACPI_DESC_TYPE_NAMED); + return_PTR(node); } @@ -94,7 +100,7 @@ void acpi_ns_delete_node(struct acpi_namespace_node *node) struct acpi_namespace_node *prev_node; struct acpi_namespace_node *next_node; - ACPI_FUNCTION_TRACE_PTR(ns_delete_node, node); + ACPI_FUNCTION_TRACE_PTR("ns_delete_node", node); parent_node = acpi_ns_get_parent_node(node); @@ -109,7 +115,6 @@ void acpi_ns_delete_node(struct acpi_namespace_node *node) } if (prev_node) { - /* Node is not first child, unlink it */ prev_node->peer = next_node->peer; @@ -120,7 +125,6 @@ void acpi_ns_delete_node(struct acpi_namespace_node *node) /* Node is first child (has no previous peer) */ if (next_node->flags & ANOBJ_END_OF_PEER_LIST) { - /* No peers at all */ parent_node->child = NULL; @@ -133,10 +137,10 @@ void acpi_ns_delete_node(struct acpi_namespace_node *node) ACPI_MEM_TRACKING(acpi_gbl_ns_node_list->total_freed++); /* - * Detach an object if there is one, then delete the node + * Detach an object if there is one then delete the node */ acpi_ns_detach_object(node); - (void)acpi_os_release_object(acpi_gbl_namespace_cache, node); + ACPI_MEM_FREE(node); return_VOID; } @@ -167,7 +171,7 @@ void acpi_ns_install_node(struct acpi_walk_state *walk_state, struct acpi_namesp acpi_owner_id owner_id = 0; struct acpi_namespace_node *child_node; - ACPI_FUNCTION_TRACE(ns_install_node); + ACPI_FUNCTION_TRACE("ns_install_node"); /* * Get the owner ID from the Walk state @@ -212,6 +216,14 @@ void acpi_ns_install_node(struct acpi_walk_state *walk_state, struct acpi_namesp acpi_ut_get_type_name(parent_node->type), parent_node)); + /* + * Increment the reference count(s) of all parents up to + * the root! + */ + while ((node = acpi_ns_get_parent_node(node)) != NULL) { + node->reference_count++; + } + return_VOID; } @@ -232,9 +244,10 @@ void acpi_ns_delete_children(struct acpi_namespace_node *parent_node) { struct acpi_namespace_node *child_node; struct acpi_namespace_node *next_node; + struct acpi_namespace_node *node; u8 flags; - ACPI_FUNCTION_TRACE_PTR(ns_delete_children, parent_node); + ACPI_FUNCTION_TRACE_PTR("ns_delete_children", parent_node); if (!parent_node) { return_VOID; @@ -251,7 +264,6 @@ void acpi_ns_delete_children(struct acpi_namespace_node *parent_node) * Deallocate all children at this level */ do { - /* Get the things we need */ next_node = child_node->peer; @@ -277,10 +289,26 @@ void acpi_ns_delete_children(struct acpi_namespace_node *parent_node) */ acpi_ns_detach_object(child_node); + /* + * Decrement the reference count(s) of all parents up to + * the root! (counts were incremented when the node was created) + */ + node = child_node; + while ((node = acpi_ns_get_parent_node(node)) != NULL) { + node->reference_count--; + } + + /* There should be only one reference remaining on this node */ + + if (child_node->reference_count != 1) { + ACPI_WARNING((AE_INFO, + "Existing references (%d) on node being deleted (%p)", + child_node->reference_count, child_node)); + } + /* Now we can delete the node */ - (void)acpi_os_release_object(acpi_gbl_namespace_cache, - child_node); + ACPI_MEM_FREE(child_node); /* And move on to the next child in the list */ @@ -313,7 +341,7 @@ void acpi_ns_delete_namespace_subtree(struct acpi_namespace_node *parent_node) struct acpi_namespace_node *child_node = NULL; u32 level = 1; - ACPI_FUNCTION_TRACE(ns_delete_namespace_subtree); + ACPI_FUNCTION_TRACE("ns_delete_namespace_subtree"); if (!parent_node) { return_VOID; @@ -324,14 +352,11 @@ void acpi_ns_delete_namespace_subtree(struct acpi_namespace_node *parent_node) * to where we started. */ while (level > 0) { - /* Get the next node in this scope (NULL if none) */ - child_node = - acpi_ns_get_next_node(ACPI_TYPE_ANY, parent_node, - child_node); + child_node = acpi_ns_get_next_node(ACPI_TYPE_ANY, parent_node, + child_node); if (child_node) { - /* Found a child node - detach any attached object */ acpi_ns_detach_object(child_node); @@ -374,6 +399,55 @@ void acpi_ns_delete_namespace_subtree(struct acpi_namespace_node *parent_node) return_VOID; } +/******************************************************************************* + * + * FUNCTION: acpi_ns_remove_reference + * + * PARAMETERS: Node - Named node whose reference count is to be + * decremented + * + * RETURN: None. + * + * DESCRIPTION: Remove a Node reference. Decrements the reference count + * of all parent Nodes up to the root. Any node along + * the way that reaches zero references is freed. + * + ******************************************************************************/ + +static void acpi_ns_remove_reference(struct acpi_namespace_node *node) +{ + struct acpi_namespace_node *parent_node; + struct acpi_namespace_node *this_node; + + ACPI_FUNCTION_ENTRY(); + + /* + * Decrement the reference count(s) of this node and all + * nodes up to the root, Delete anything with zero remaining references. + */ + this_node = node; + while (this_node) { + /* Prepare to move up to parent */ + + parent_node = acpi_ns_get_parent_node(this_node); + + /* Decrement the reference count on this node */ + + this_node->reference_count--; + + /* Delete the node if no more references */ + + if (!this_node->reference_count) { + /* Delete all children and delete the node */ + + acpi_ns_delete_children(this_node); + acpi_ns_delete_node(this_node); + } + + this_node = parent_node; + } +} + /******************************************************************************* * * FUNCTION: acpi_ns_delete_namespace_by_owner @@ -395,15 +469,15 @@ void acpi_ns_delete_namespace_by_owner(acpi_owner_id owner_id) u32 level; struct acpi_namespace_node *parent_node; - ACPI_FUNCTION_TRACE_U32(ns_delete_namespace_by_owner, owner_id); + ACPI_FUNCTION_TRACE_U32("ns_delete_namespace_by_owner", owner_id); if (owner_id == 0) { return_VOID; } - deletion_node = NULL; parent_node = acpi_gbl_root_node; child_node = NULL; + deletion_node = NULL; level = 1; /* @@ -420,14 +494,12 @@ void acpi_ns_delete_namespace_by_owner(acpi_owner_id owner_id) child_node); if (deletion_node) { - acpi_ns_delete_children(deletion_node); - acpi_ns_delete_node(deletion_node); + acpi_ns_remove_reference(deletion_node); deletion_node = NULL; } if (child_node) { if (child_node->owner_id == owner_id) { - /* Found a matching child node - detach any attached object */ acpi_ns_detach_object(child_node); diff --git a/trunk/drivers/acpi/namespace/nsdump.c b/trunk/drivers/acpi/namespace/nsdump.c index d72df66aa965..a2807317a84b 100644 --- a/trunk/drivers/acpi/namespace/nsdump.c +++ b/trunk/drivers/acpi/namespace/nsdump.c @@ -75,7 +75,7 @@ void acpi_ns_print_pathname(u32 num_segments, char *pathname) { acpi_native_uint i; - ACPI_FUNCTION_NAME(ns_print_pathname); + ACPI_FUNCTION_NAME("ns_print_pathname"); if (!(acpi_dbg_level & ACPI_LV_NAMES) || !(acpi_dbg_layer & ACPI_NAMESPACE)) { @@ -123,7 +123,7 @@ void acpi_ns_dump_pathname(acpi_handle handle, char *msg, u32 level, u32 component) { - ACPI_FUNCTION_TRACE(ns_dump_pathname); + ACPI_FUNCTION_TRACE("ns_dump_pathname"); /* Do this only if the requested debug level and component are enabled */ @@ -167,7 +167,7 @@ acpi_ns_dump_one_object(acpi_handle obj_handle, u32 dbg_level; u32 i; - ACPI_FUNCTION_NAME(ns_dump_one_object); + ACPI_FUNCTION_NAME("ns_dump_one_object"); /* Is output enabled? */ @@ -191,7 +191,6 @@ acpi_ns_dump_one_object(acpi_handle obj_handle, } if (!(info->display_type & ACPI_DISPLAY_SHORT)) { - /* Indent the object according to the level */ acpi_os_printf("%2d%*s", (u32) level - 1, (int)level * 2, " "); @@ -204,9 +203,6 @@ acpi_ns_dump_one_object(acpi_handle obj_handle, } if (!acpi_ut_valid_acpi_name(this_node->name.integer)) { - this_node->name.integer = - acpi_ut_repair_name(this_node->name.integer); - ACPI_WARNING((AE_INFO, "Invalid ACPI Name %08X", this_node->name.integer)); } @@ -230,7 +226,6 @@ acpi_ns_dump_one_object(acpi_handle obj_handle, case ACPI_DISPLAY_SUMMARY: if (!obj_desc) { - /* No attached object, we are done */ acpi_os_printf("\n"); @@ -424,7 +419,6 @@ acpi_ns_dump_one_object(acpi_handle obj_handle, acpi_os_printf("O:%p", obj_desc); if (!obj_desc) { - /* No attached object, we are done */ acpi_os_printf("\n"); @@ -675,7 +669,7 @@ void acpi_ns_dump_tables(acpi_handle search_base, u32 max_depth) { acpi_handle search_handle = search_base; - ACPI_FUNCTION_TRACE(ns_dump_tables); + ACPI_FUNCTION_TRACE("ns_dump_tables"); if (!acpi_gbl_root_node) { /* @@ -688,7 +682,6 @@ void acpi_ns_dump_tables(acpi_handle search_base, u32 max_depth) } if (ACPI_NS_ALL == search_base) { - /* Entire namespace */ search_handle = acpi_gbl_root_node; diff --git a/trunk/drivers/acpi/namespace/nsdumpdv.c b/trunk/drivers/acpi/namespace/nsdumpdv.c index c6bf5d30fca3..aff899a935e3 100644 --- a/trunk/drivers/acpi/namespace/nsdumpdv.c +++ b/trunk/drivers/acpi/namespace/nsdumpdv.c @@ -74,7 +74,7 @@ acpi_ns_dump_one_device(acpi_handle obj_handle, acpi_status status; u32 i; - ACPI_FUNCTION_NAME(ns_dump_one_device); + ACPI_FUNCTION_NAME("ns_dump_one_device"); status = acpi_ns_dump_one_object(obj_handle, level, context, return_value); @@ -92,7 +92,7 @@ acpi_ns_dump_one_device(acpi_handle obj_handle, info->hardware_id.value, ACPI_FORMAT_UINT64(info->address), info->current_status)); - ACPI_FREE(info); + ACPI_MEM_FREE(info); } return (status); @@ -115,7 +115,7 @@ void acpi_ns_dump_root_devices(void) acpi_handle sys_bus_handle; acpi_status status; - ACPI_FUNCTION_NAME(ns_dump_root_devices); + ACPI_FUNCTION_NAME("ns_dump_root_devices"); /* Only dump the table if tracing is enabled */ diff --git a/trunk/drivers/acpi/namespace/nseval.c b/trunk/drivers/acpi/namespace/nseval.c index 4b0a4a8c9843..19d7b94d40c3 100644 --- a/trunk/drivers/acpi/namespace/nseval.c +++ b/trunk/drivers/acpi/namespace/nseval.c @@ -1,6 +1,7 @@ /******************************************************************************* * - * Module Name: nseval - Object evaluation, includes control method execution + * Module Name: nseval - Object evaluation interfaces -- includes control + * method lookup and execution. * ******************************************************************************/ @@ -49,14 +50,196 @@ #define _COMPONENT ACPI_NAMESPACE ACPI_MODULE_NAME("nseval") +/* Local prototypes */ +static acpi_status +acpi_ns_execute_control_method(struct acpi_parameter_info *info); + +static acpi_status acpi_ns_get_object_value(struct acpi_parameter_info *info); + +/******************************************************************************* + * + * FUNCTION: acpi_ns_evaluate_relative + * + * PARAMETERS: Pathname - Name of method to execute, If NULL, the + * handle is the object to execute + * Info - Method info block, contains: + * return_object - Where to put method's return value (if + * any). If NULL, no value is returned. + * Params - List of parameters to pass to the method, + * terminated by NULL. Params itself may be + * NULL if no parameters are being passed. + * + * RETURN: Status + * + * DESCRIPTION: Evaluate the object or find and execute the requested method + * + * MUTEX: Locks Namespace + * + ******************************************************************************/ + +acpi_status +acpi_ns_evaluate_relative(char *pathname, struct acpi_parameter_info *info) +{ + acpi_status status; + struct acpi_namespace_node *node = NULL; + union acpi_generic_state *scope_info; + char *internal_path = NULL; + + ACPI_FUNCTION_TRACE("ns_evaluate_relative"); + + /* + * Must have a valid object handle + */ + if (!info || !info->node) { + return_ACPI_STATUS(AE_BAD_PARAMETER); + } + + /* Build an internal name string for the method */ + + status = acpi_ns_internalize_name(pathname, &internal_path); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); + } + + scope_info = acpi_ut_create_generic_state(); + if (!scope_info) { + goto cleanup1; + } + + /* Get the prefix handle and Node */ + + status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE(status)) { + goto cleanup; + } + + info->node = acpi_ns_map_handle_to_node(info->node); + if (!info->node) { + (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); + status = AE_BAD_PARAMETER; + goto cleanup; + } + + /* Lookup the name in the namespace */ + + scope_info->scope.node = info->node; + status = acpi_ns_lookup(scope_info, internal_path, ACPI_TYPE_ANY, + ACPI_IMODE_EXECUTE, ACPI_NS_NO_UPSEARCH, NULL, + &node); + + (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); + + if (ACPI_FAILURE(status)) { + ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "Object [%s] not found [%s]\n", + pathname, acpi_format_exception(status))); + goto cleanup; + } + + /* + * Now that we have a handle to the object, we can attempt to evaluate it. + */ + ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "%s [%p] Value %p\n", + pathname, node, acpi_ns_get_attached_object(node))); + + info->node = node; + status = acpi_ns_evaluate_by_handle(info); + + ACPI_DEBUG_PRINT((ACPI_DB_NAMES, + "*** Completed eval of object %s ***\n", pathname)); + + cleanup: + acpi_ut_delete_generic_state(scope_info); + + cleanup1: + ACPI_MEM_FREE(internal_path); + return_ACPI_STATUS(status); +} + /******************************************************************************* * - * FUNCTION: acpi_ns_evaluate + * FUNCTION: acpi_ns_evaluate_by_name * - * PARAMETERS: Info - Evaluation info block, contains: - * prefix_node - Prefix or Method/Object Node to execute - * Pathname - Name of method to execute, If NULL, the - * Node is the object to execute + * PARAMETERS: Pathname - Fully qualified pathname to the object + * Info - Method info block, contains: + * return_object - Where to put method's return value (if + * any). If NULL, no value is returned. + * Params - List of parameters to pass to the method, + * terminated by NULL. Params itself may be + * NULL if no parameters are being passed. + * + * RETURN: Status + * + * DESCRIPTION: Evaluate the object or rind and execute the requested method + * passing the given parameters + * + * MUTEX: Locks Namespace + * + ******************************************************************************/ + +acpi_status +acpi_ns_evaluate_by_name(char *pathname, struct acpi_parameter_info *info) +{ + acpi_status status; + char *internal_path = NULL; + + ACPI_FUNCTION_TRACE("ns_evaluate_by_name"); + + /* Build an internal name string for the method */ + + status = acpi_ns_internalize_name(pathname, &internal_path); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); + } + + status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE(status)) { + goto cleanup; + } + + /* Lookup the name in the namespace */ + + status = acpi_ns_lookup(NULL, internal_path, ACPI_TYPE_ANY, + ACPI_IMODE_EXECUTE, ACPI_NS_NO_UPSEARCH, NULL, + &info->node); + + (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); + + if (ACPI_FAILURE(status)) { + ACPI_DEBUG_PRINT((ACPI_DB_NAMES, + "Object at [%s] was not found, status=%.4X\n", + pathname, status)); + goto cleanup; + } + + /* + * Now that we have a handle to the object, we can attempt to evaluate it. + */ + ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "%s [%p] Value %p\n", + pathname, info->node, + acpi_ns_get_attached_object(info->node))); + + status = acpi_ns_evaluate_by_handle(info); + + ACPI_DEBUG_PRINT((ACPI_DB_NAMES, + "*** Completed eval of object %s ***\n", pathname)); + + cleanup: + + /* Cleanup */ + + if (internal_path) { + ACPI_MEM_FREE(internal_path); + } + + return_ACPI_STATUS(status); +} + +/******************************************************************************* + * + * FUNCTION: acpi_ns_evaluate_by_handle + * + * PARAMETERS: Info - Method info block, contains: + * Node - Method/Object Node to execute * Parameters - List of parameters to pass to the method, * terminated by NULL. Params itself may be * NULL if no parameters are being passed. @@ -65,21 +248,29 @@ ACPI_MODULE_NAME("nseval") * parameter_type - Type of Parameter list * return_object - Where to put method's return value (if * any). If NULL, no value is returned. - * Flags - ACPI_IGNORE_RETURN_VALUE to delete return * * RETURN: Status * - * DESCRIPTION: Execute a control method or return the current value of an - * ACPI namespace object. + * DESCRIPTION: Evaluate object or execute the requested method passing the + * given parameters * - * MUTEX: Locks interpreter + * MUTEX: Locks Namespace * ******************************************************************************/ -acpi_status acpi_ns_evaluate(struct acpi_evaluate_info *info) + +acpi_status acpi_ns_evaluate_by_handle(struct acpi_parameter_info *info) { acpi_status status; - ACPI_FUNCTION_TRACE(ns_evaluate); + ACPI_FUNCTION_TRACE("ns_evaluate_by_handle"); + + /* Check if namespace has been initialized */ + + if (!acpi_gbl_root_node) { + return_ACPI_STATUS(AE_NO_NAMESPACE); + } + + /* Parameter Validation */ if (!info) { return_ACPI_STATUS(AE_BAD_PARAMETER); @@ -89,120 +280,202 @@ acpi_status acpi_ns_evaluate(struct acpi_evaluate_info *info) info->return_object = NULL; - /* - * Get the actual namespace node for the target object. Handles these cases: - * - * 1) Null node, Pathname (absolute path) - * 2) Node, Pathname (path relative to Node) - * 3) Node, Null Pathname - */ - status = acpi_ns_get_node(info->prefix_node, info->pathname, - ACPI_NS_NO_UPSEARCH, &info->resolved_node); + /* Get the prefix handle and Node */ + + status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); } + info->node = acpi_ns_map_handle_to_node(info->node); + if (!info->node) { + (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); + return_ACPI_STATUS(AE_BAD_PARAMETER); + } + /* * For a method alias, we must grab the actual method node so that proper * scoping context will be established before execution. */ - if (acpi_ns_get_type(info->resolved_node) == - ACPI_TYPE_LOCAL_METHOD_ALIAS) { - info->resolved_node = + if (acpi_ns_get_type(info->node) == ACPI_TYPE_LOCAL_METHOD_ALIAS) { + info->node = ACPI_CAST_PTR(struct acpi_namespace_node, - info->resolved_node->object); + info->node->object); } - ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "%s [%p] Value %p\n", info->pathname, - info->resolved_node, - acpi_ns_get_attached_object(info->resolved_node))); - /* * Two major cases here: - * - * 1) The object is a control method -- execute it + * 1) The object is an actual control method -- execute it. * 2) The object is not a method -- just return it's current value + * + * In both cases, the namespace is unlocked by the acpi_ns* procedure */ - if (acpi_ns_get_type(info->resolved_node) == ACPI_TYPE_METHOD) { + if (acpi_ns_get_type(info->node) == ACPI_TYPE_METHOD) { + /* + * Case 1) We have an actual control method to execute + */ + status = acpi_ns_execute_control_method(info); + } else { /* - * 1) Object is a control method - execute it + * Case 2) Object is NOT a method, just return its current value */ + status = acpi_ns_get_object_value(info); + } + + /* + * Check if there is a return value on the stack that must be dealt with + */ + if (status == AE_CTRL_RETURN_VALUE) { + /* Map AE_CTRL_RETURN_VALUE to AE_OK, we are done with it */ - /* Verify that there is a method object associated with this node */ + status = AE_OK; + } - info->obj_desc = - acpi_ns_get_attached_object(info->resolved_node); - if (!info->obj_desc) { - ACPI_ERROR((AE_INFO, - "Control method has no attached sub-object")); - return_ACPI_STATUS(AE_NULL_OBJECT); - } + /* + * Namespace was unlocked by the handling acpi_ns* function, so we + * just return + */ + return_ACPI_STATUS(status); +} + +/******************************************************************************* + * + * FUNCTION: acpi_ns_execute_control_method + * + * PARAMETERS: Info - Method info block, contains: + * Node - Method Node to execute + * obj_desc - Method object + * Parameters - 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. + * parameter_type - Type of Parameter list + * return_object - Where to put method's return value (if + * any). If NULL, no value is returned. + * + * RETURN: Status + * + * DESCRIPTION: Execute the requested method passing the given parameters + * + * MUTEX: Assumes namespace is locked + * + ******************************************************************************/ - ACPI_DUMP_PATHNAME(info->resolved_node, "Execute Method:", - ACPI_LV_INFO, _COMPONENT); +static acpi_status +acpi_ns_execute_control_method(struct acpi_parameter_info *info) +{ + acpi_status status; - ACPI_DEBUG_PRINT((ACPI_DB_EXEC, - "Method at AML address %p Length %X\n", - info->obj_desc->method.aml_start + 1, - info->obj_desc->method.aml_length - 1)); + ACPI_FUNCTION_TRACE("ns_execute_control_method"); - /* - * Any namespace deletion must acquire both the namespace and - * interpreter locks to ensure that no thread is using the portion of - * the namespace that is being deleted. - * - * Execute the method via the interpreter. The interpreter is locked - * here before calling into the AML parser - */ - status = acpi_ex_enter_interpreter(); - if (ACPI_FAILURE(status)) { - return_ACPI_STATUS(status); - } + /* Verify that there is a method associated with this object */ - status = acpi_ps_execute_method(info); - acpi_ex_exit_interpreter(); - } else { - /* - * 2) Object is not a method, return its current value - */ + info->obj_desc = acpi_ns_get_attached_object(info->node); + if (!info->obj_desc) { + ACPI_ERROR((AE_INFO, "No attached method object")); - /* - * Objects require additional resolution steps (e.g., the Node may be - * a field that must be read, etc.) -- we can't just grab the object - * out of the node. - * - * Use resolve_node_to_value() to get the associated value. - * - * NOTE: we can get away with passing in NULL for a walk state because - * resolved_node is guaranteed to not be a reference to either a method - * local or a method argument (because this interface is never called - * from a running method.) - * - * Even though we do not directly invoke the interpreter for object - * resolution, we must lock it because we could access an opregion. - * The opregion access code assumes that the interpreter is locked. - */ - status = acpi_ex_enter_interpreter(); - if (ACPI_FAILURE(status)) { - return_ACPI_STATUS(status); - } + (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); + return_ACPI_STATUS(AE_NULL_OBJECT); + } - /* Function has a strange interface */ + ACPI_DUMP_PATHNAME(info->node, "Execute Method:", + ACPI_LV_INFO, _COMPONENT); - status = - acpi_ex_resolve_node_to_value(&info->resolved_node, NULL); - acpi_ex_exit_interpreter(); + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Method at AML address %p Length %X\n", + info->obj_desc->method.aml_start + 1, + info->obj_desc->method.aml_length - 1)); + /* + * 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 + * interpreter locks to ensure that no thread is using the portion of the + * namespace that is being deleted. + */ + status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); + } + + /* + * Execute the method via the interpreter. The interpreter is locked + * here before calling into the AML parser + */ + status = acpi_ex_enter_interpreter(); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); + } + + status = acpi_ps_execute_method(info); + acpi_ex_exit_interpreter(); + + return_ACPI_STATUS(status); +} + +/******************************************************************************* + * + * FUNCTION: acpi_ns_get_object_value + * + * PARAMETERS: Info - Method info block, contains: + * Node - Object's NS node + * return_object - Where to put object value (if + * any). If NULL, no value is returned. + * + * RETURN: Status + * + * DESCRIPTION: Return the current value of the object + * + * MUTEX: Assumes namespace is locked, leaves namespace unlocked + * + ******************************************************************************/ + +static acpi_status acpi_ns_get_object_value(struct acpi_parameter_info *info) +{ + acpi_status status = AE_OK; + struct acpi_namespace_node *resolved_node = info->node; + + ACPI_FUNCTION_TRACE("ns_get_object_value"); + + /* + * Objects require additional resolution steps (e.g., the Node may be a + * field that must be read, etc.) -- we can't just grab the object out of + * the node. + */ + + /* + * Use resolve_node_to_value() to get the associated value. This call always + * deletes obj_desc (allocated above). + * + * NOTE: we can get away with passing in NULL for a walk state because + * obj_desc is guaranteed to not be a reference to either a method local or + * a method argument (because this interface can only be called from the + * acpi_evaluate external interface, never called from a running method.) + * + * Even though we do not directly invoke the interpreter for this, we must + * enter it because we could access an opregion. The opregion access code + * assumes that the interpreter is locked. + * + * We must release the namespace lock before entering the intepreter. + */ + status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); + } + + status = acpi_ex_enter_interpreter(); + if (ACPI_SUCCESS(status)) { + status = acpi_ex_resolve_node_to_value(&resolved_node, NULL); /* * If acpi_ex_resolve_node_to_value() succeeded, the return value was placed * in resolved_node. */ + acpi_ex_exit_interpreter(); + if (ACPI_SUCCESS(status)) { status = AE_CTRL_RETURN_VALUE; - info->return_object = - ACPI_CAST_PTR(union acpi_operand_object, - info->resolved_node); - + info->return_object = ACPI_CAST_PTR + (union acpi_operand_object, resolved_node); ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "Returning object %p [%s]\n", info->return_object, @@ -211,30 +484,7 @@ acpi_status acpi_ns_evaluate(struct acpi_evaluate_info *info) } } - /* - * Check if there is a return value that must be dealt with - */ - if (status == AE_CTRL_RETURN_VALUE) { - - /* If caller does not want the return value, delete it */ + /* Namespace is unlocked */ - if (info->flags & ACPI_IGNORE_RETURN_VALUE) { - acpi_ut_remove_reference(info->return_object); - info->return_object = NULL; - } - - /* Map AE_CTRL_RETURN_VALUE to AE_OK, we are done with it */ - - status = AE_OK; - } - - ACPI_DEBUG_PRINT((ACPI_DB_NAMES, - "*** Completed evaluation of object %s ***\n", - info->pathname)); - - /* - * Namespace was unlocked by the handling acpi_ns* function, so we - * just return - */ return_ACPI_STATUS(status); } diff --git a/trunk/drivers/acpi/namespace/nsinit.c b/trunk/drivers/acpi/namespace/nsinit.c index aec8488c0019..9f929e479fd8 100644 --- a/trunk/drivers/acpi/namespace/nsinit.c +++ b/trunk/drivers/acpi/namespace/nsinit.c @@ -58,10 +58,6 @@ static acpi_status acpi_ns_init_one_device(acpi_handle obj_handle, u32 nesting_level, void *context, void **return_value); -static acpi_status -acpi_ns_find_ini_methods(acpi_handle obj_handle, - u32 nesting_level, void *context, void **return_value); - /******************************************************************************* * * FUNCTION: acpi_ns_initialize_objects @@ -80,7 +76,7 @@ acpi_status acpi_ns_initialize_objects(void) acpi_status status; struct acpi_init_walk_info info; - ACPI_FUNCTION_TRACE(ns_initialize_objects); + ACPI_FUNCTION_TRACE("ns_initialize_objects"); ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "**** Starting initialization of namespace objects ****\n")); @@ -97,7 +93,7 @@ acpi_status acpi_ns_initialize_objects(void) ACPI_UINT32_MAX, acpi_ns_init_one_object, &info, NULL); if (ACPI_FAILURE(status)) { - ACPI_EXCEPTION((AE_INFO, status, "During WalkNamespace")); + ACPI_EXCEPTION((AE_INFO, status, "During walk_namespace")); } ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, @@ -137,7 +133,7 @@ acpi_status acpi_ns_initialize_devices(void) acpi_status status; struct acpi_device_walk_info info; - ACPI_FUNCTION_TRACE(ns_initialize_devices); + ACPI_FUNCTION_TRACE("ns_initialize_devices"); /* Init counters */ @@ -146,46 +142,30 @@ acpi_status acpi_ns_initialize_devices(void) info.num_INI = 0; ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, - "Initializing Device/Processor/Thermal objects by executing _INI methods:")); - - /* Tree analysis: find all subtrees that contain _INI methods */ + "Executing all Device _STA and_INI methods:")); - status = acpi_ns_walk_namespace(ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, - ACPI_UINT32_MAX, FALSE, - acpi_ns_find_ini_methods, &info, NULL); + status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); if (ACPI_FAILURE(status)) { - goto error_exit; + return_ACPI_STATUS(status); } - /* Allocate the evaluation information block */ - - info.evaluate_info = - ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_evaluate_info)); - if (!info.evaluate_info) { - status = AE_NO_MEMORY; - goto error_exit; - } - - /* Walk namespace to execute all _INIs on present devices */ + /* Walk namespace for all objects */ status = acpi_ns_walk_namespace(ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, - ACPI_UINT32_MAX, FALSE, + ACPI_UINT32_MAX, TRUE, acpi_ns_init_one_device, &info, NULL); - ACPI_FREE(info.evaluate_info); + (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE(status)) { - goto error_exit; + ACPI_EXCEPTION((AE_INFO, status, "During walk_namespace")); } ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, - "\nExecuted %hd _INI methods requiring %hd _STA executions (examined %hd objects)\n", - info.num_INI, info.num_STA, info.device_count)); + "\n%hd Devices found - executed %hd _STA, %hd _INI methods\n", + info.device_count, info.num_STA, info.num_INI)); return_ACPI_STATUS(status); - - error_exit: - ACPI_EXCEPTION((AE_INFO, status, "During device initialization")); - return_ACPI_STATUS(status); } /******************************************************************************* @@ -220,7 +200,7 @@ acpi_ns_init_one_object(acpi_handle obj_handle, (struct acpi_namespace_node *)obj_handle; union acpi_operand_object *obj_desc; - ACPI_FUNCTION_NAME(ns_init_one_object); + ACPI_FUNCTION_NAME("ns_init_one_object"); info->object_count++; @@ -329,72 +309,6 @@ acpi_ns_init_one_object(acpi_handle obj_handle, return (AE_OK); } -/******************************************************************************* - * - * FUNCTION: acpi_ns_find_ini_methods - * - * PARAMETERS: acpi_walk_callback - * - * RETURN: acpi_status - * - * DESCRIPTION: Called during namespace walk. Finds objects named _INI under - * device/processor/thermal objects, and marks the entire subtree - * with a SUBTREE_HAS_INI flag. This flag is used during the - * subsequent device initialization walk to avoid entire subtrees - * that do not contain an _INI. - * - ******************************************************************************/ - -static acpi_status -acpi_ns_find_ini_methods(acpi_handle obj_handle, - u32 nesting_level, void *context, void **return_value) -{ - struct acpi_device_walk_info *info = - ACPI_CAST_PTR(struct acpi_device_walk_info, context); - struct acpi_namespace_node *node; - struct acpi_namespace_node *parent_node; - - /* Keep count of device/processor/thermal objects */ - - node = ACPI_CAST_PTR(struct acpi_namespace_node, obj_handle); - if ((node->type == ACPI_TYPE_DEVICE) || - (node->type == ACPI_TYPE_PROCESSOR) || - (node->type == ACPI_TYPE_THERMAL)) { - info->device_count++; - return (AE_OK); - } - - /* We are only looking for methods named _INI */ - - if (!ACPI_COMPARE_NAME(node->name.ascii, METHOD_NAME__INI)) { - return (AE_OK); - } - - /* - * The only _INI methods that we care about are those that are - * present under Device, Processor, and Thermal objects. - */ - parent_node = acpi_ns_get_parent_node(node); - switch (parent_node->type) { - case ACPI_TYPE_DEVICE: - case ACPI_TYPE_PROCESSOR: - case ACPI_TYPE_THERMAL: - - /* Mark parent and bubble up the INI present flag to the root */ - - while (parent_node) { - parent_node->flags |= ANOBJ_SUBTREE_HAS_INI; - parent_node = acpi_ns_get_parent_node(parent_node); - } - break; - - default: - break; - } - - return (AE_OK); -} - /******************************************************************************* * * FUNCTION: acpi_ns_init_one_device @@ -413,165 +327,119 @@ static acpi_status acpi_ns_init_one_device(acpi_handle obj_handle, u32 nesting_level, void *context, void **return_value) { - struct acpi_device_walk_info *walk_info = - ACPI_CAST_PTR(struct acpi_device_walk_info, context); - struct acpi_evaluate_info *info = walk_info->evaluate_info; + struct acpi_device_walk_info *info = + (struct acpi_device_walk_info *)context; + struct acpi_parameter_info pinfo; u32 flags; acpi_status status; + struct acpi_namespace_node *ini_node; struct acpi_namespace_node *device_node; - ACPI_FUNCTION_TRACE(ns_init_one_device); + ACPI_FUNCTION_TRACE("ns_init_one_device"); - /* We are interested in Devices, Processors and thermal_zones only */ + device_node = acpi_ns_map_handle_to_node(obj_handle); + if (!device_node) { + return_ACPI_STATUS(AE_BAD_PARAMETER); + } - device_node = ACPI_CAST_PTR(struct acpi_namespace_node, obj_handle); + /* + * We will run _STA/_INI on Devices, Processors and thermal_zones only + */ if ((device_node->type != ACPI_TYPE_DEVICE) && (device_node->type != ACPI_TYPE_PROCESSOR) && (device_node->type != ACPI_TYPE_THERMAL)) { return_ACPI_STATUS(AE_OK); } + if ((acpi_dbg_level <= ACPI_LV_ALL_EXCEPTIONS) && + (!(acpi_dbg_level & ACPI_LV_INFO))) { + ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, ".")); + } + + info->device_count++; + /* - * Because of an earlier namespace analysis, all subtrees that contain an - * _INI method are tagged. - * - * If this device subtree does not contain any _INI methods, we - * can exit now and stop traversing this entire subtree. + * Check if the _INI method exists for this device - + * if _INI does not exist, there is no need to run _STA + * No _INI means device requires no initialization */ - if (!(device_node->flags & ANOBJ_SUBTREE_HAS_INI)) { - return_ACPI_STATUS(AE_CTRL_DEPTH); + status = acpi_ns_search_node(*ACPI_CAST_PTR(u32, METHOD_NAME__INI), + device_node, ACPI_TYPE_METHOD, &ini_node); + if (ACPI_FAILURE(status)) { + /* No _INI method found - move on to next device */ + + return_ACPI_STATUS(AE_OK); } /* - * Run _STA to determine if this device is present and functioning. We - * must know this information for two important reasons (from ACPI spec): - * - * 1) We can only run _INI if the device is present. - * 2) We must abort the device tree walk on this subtree if the device is - * not present and is not functional (we will not examine the children) - * - * The _STA method is not required to be present under the device, we - * assume the device is present if _STA does not exist. + * Run _STA to determine if we can run _INI on the device - + * the device must be present before _INI can be run. + * However, _STA is not required - assume device present if no _STA */ - ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname - (ACPI_TYPE_METHOD, device_node, METHOD_NAME__STA)); + ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname(ACPI_TYPE_METHOD, + device_node, + METHOD_NAME__STA)); - status = acpi_ut_execute_STA(device_node, &flags); - if (ACPI_FAILURE(status)) { + pinfo.node = device_node; + pinfo.parameters = NULL; + pinfo.parameter_type = ACPI_PARAM_ARGS; + status = acpi_ut_execute_STA(pinfo.node, &flags); + if (ACPI_FAILURE(status)) { /* Ignore error and move on to next device */ return_ACPI_STATUS(AE_OK); } - /* - * Flags == -1 means that _STA was not found. In this case, we assume that - * the device is both present and functional. - * - * From the ACPI spec, description of _STA: - * - * "If a device object (including the processor object) does not have an - * _STA object, then OSPM assumes that all of the above bits are set (in - * other words, the device is present, ..., and functioning)" - */ if (flags != ACPI_UINT32_MAX) { - walk_info->num_STA++; + info->num_STA++; } - /* - * Examine the PRESENT and FUNCTIONING status bits - * - * Note: ACPI spec does not seem to specify behavior for the present but - * not functioning case, so we assume functioning if present. - */ if (!(flags & ACPI_STA_DEVICE_PRESENT)) { + /* Don't look at children of a not present device */ - /* Device is not present, we must examine the Functioning bit */ - - if (flags & ACPI_STA_DEVICE_FUNCTIONING) { - /* - * Device is not present but is "functioning". In this case, - * we will not run _INI, but we continue to examine the children - * of this device. - * - * From the ACPI spec, description of _STA: (Note - no mention - * of whether to run _INI or not on the device in question) - * - * "_STA may return bit 0 clear (not present) with bit 3 set - * (device is functional). This case is used to indicate a valid - * device for which no device driver should be loaded (for example, - * a bridge device.) Children of this device may be present and - * valid. OSPM should continue enumeration below a device whose - * _STA returns this bit combination" - */ - return_ACPI_STATUS(AE_OK); - } else { - /* - * Device is not present and is not functioning. We must abort the - * walk of this subtree immediately -- don't look at the children - * of such a device. - * - * From the ACPI spec, description of _INI: - * - * "If the _STA method indicates that the device is not present, - * OSPM will not run the _INI and will not examine the children - * of the device for _INI methods" - */ - return_ACPI_STATUS(AE_CTRL_DEPTH); - } + return_ACPI_STATUS(AE_CTRL_DEPTH); } /* - * The device is present or is assumed present if no _STA exists. - * Run the _INI if it exists (not required to exist) - * - * Note: We know there is an _INI within this subtree, but it may not be - * under this particular device, it may be lower in the branch. + * The device is present and _INI exists. Run the _INI method. + * (We already have the _INI node from above) */ - ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname - (ACPI_TYPE_METHOD, device_node, METHOD_NAME__INI)); - - info->prefix_node = device_node; - info->pathname = METHOD_NAME__INI; - info->parameters = NULL; - info->parameter_type = ACPI_PARAM_ARGS; - info->flags = ACPI_IGNORE_RETURN_VALUE; - - status = acpi_ns_evaluate(info); - if (ACPI_SUCCESS(status)) { - walk_info->num_INI++; - - if ((acpi_dbg_level <= ACPI_LV_ALL_EXCEPTIONS) && - (!(acpi_dbg_level & ACPI_LV_INFO))) { - ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, ".")); - } - } -#ifdef ACPI_DEBUG_OUTPUT - else if (status != AE_NOT_FOUND) { + ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname(ACPI_TYPE_METHOD, + pinfo.node, + METHOD_NAME__INI)); + pinfo.node = ini_node; + status = acpi_ns_evaluate_by_handle(&pinfo); + if (ACPI_FAILURE(status)) { /* Ignore error and move on to next device */ - char *scope_name = - acpi_ns_get_external_pathname(info->resolved_node); +#ifdef ACPI_DEBUG_OUTPUT + char *scope_name = acpi_ns_get_external_pathname(ini_node); + + ACPI_WARNING((AE_INFO, "%s._INI failed: %s", + scope_name, acpi_format_exception(status))); - ACPI_EXCEPTION((AE_INFO, status, "during %s._INI execution", - scope_name)); - ACPI_FREE(scope_name); - } + ACPI_MEM_FREE(scope_name); #endif + } else { + /* Delete any return object (especially if implicit_return is enabled) */ - /* Ignore errors from above */ + if (pinfo.return_object) { + acpi_ut_remove_reference(pinfo.return_object); + } - status = AE_OK; + /* Count of successful INIs */ + + info->num_INI++; + } - /* - * The _INI method has been run if present; call the Global Initialization - * Handler for this device. - */ if (acpi_gbl_init_handler) { + /* External initialization handler is present, call it */ + status = - acpi_gbl_init_handler(device_node, ACPI_INIT_DEVICE_INI); + acpi_gbl_init_handler(pinfo.node, ACPI_INIT_DEVICE_INI); } - return_ACPI_STATUS(status); + return_ACPI_STATUS(AE_OK); } diff --git a/trunk/drivers/acpi/namespace/nsload.c b/trunk/drivers/acpi/namespace/nsload.c index fe75d888e183..4e0b0524c188 100644 --- a/trunk/drivers/acpi/namespace/nsload.c +++ b/trunk/drivers/acpi/namespace/nsload.c @@ -77,14 +77,13 @@ acpi_ns_load_table(struct acpi_table_desc *table_desc, { acpi_status status; - ACPI_FUNCTION_TRACE(ns_load_table); + ACPI_FUNCTION_TRACE("ns_load_table"); /* Check if table contains valid AML (must be DSDT, PSDT, SSDT, etc.) */ if (! (acpi_gbl_table_data[table_desc->type]. flags & ACPI_TABLE_EXECUTABLE)) { - /* Just ignore this table */ return_ACPI_STATUS(AE_OK); @@ -169,7 +168,7 @@ static acpi_status acpi_ns_load_table_by_type(acpi_table_type table_type) acpi_status status; struct acpi_table_desc *table_desc; - ACPI_FUNCTION_TRACE(ns_load_table_by_type); + ACPI_FUNCTION_TRACE("ns_load_table_by_type"); status = acpi_ut_acquire_mutex(ACPI_MTX_TABLES); if (ACPI_FAILURE(status)) { @@ -181,11 +180,11 @@ static acpi_status acpi_ns_load_table_by_type(acpi_table_type table_type) * DSDT (one), SSDT/PSDT (multiple) */ switch (table_type) { - case ACPI_TABLE_ID_DSDT: + case ACPI_TABLE_DSDT: ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Namespace load: DSDT\n")); - table_desc = acpi_gbl_table_lists[ACPI_TABLE_ID_DSDT].next; + table_desc = acpi_gbl_table_lists[ACPI_TABLE_DSDT].next; /* If table already loaded into namespace, just return */ @@ -201,8 +200,8 @@ static acpi_status acpi_ns_load_table_by_type(acpi_table_type table_type) } break; - case ACPI_TABLE_ID_SSDT: - case ACPI_TABLE_ID_PSDT: + case ACPI_TABLE_SSDT: + case ACPI_TABLE_PSDT: ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Namespace load: %d SSDT or PSDTs\n", @@ -259,7 +258,7 @@ acpi_status acpi_ns_load_namespace(void) { acpi_status status; - ACPI_FUNCTION_TRACE(acpi_load_name_space); + ACPI_FUNCTION_TRACE("acpi_load_name_space"); /* There must be at least a DSDT installed */ @@ -272,15 +271,15 @@ acpi_status acpi_ns_load_namespace(void) * Load the namespace. The DSDT is required, * but the SSDT and PSDT tables are optional. */ - status = acpi_ns_load_table_by_type(ACPI_TABLE_ID_DSDT); + status = acpi_ns_load_table_by_type(ACPI_TABLE_DSDT); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); } /* Ignore exceptions from these */ - (void)acpi_ns_load_table_by_type(ACPI_TABLE_ID_SSDT); - (void)acpi_ns_load_table_by_type(ACPI_TABLE_ID_PSDT); + (void)acpi_ns_load_table_by_type(ACPI_TABLE_SSDT); + (void)acpi_ns_load_table_by_type(ACPI_TABLE_PSDT); ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, "ACPI Namespace successfully loaded at root %p\n", @@ -315,7 +314,7 @@ static acpi_status acpi_ns_delete_subtree(acpi_handle start_handle) acpi_handle dummy; u32 level; - ACPI_FUNCTION_TRACE(ns_delete_subtree); + ACPI_FUNCTION_TRACE("ns_delete_subtree"); parent_handle = start_handle; child_handle = NULL; @@ -326,7 +325,6 @@ static acpi_status acpi_ns_delete_subtree(acpi_handle start_handle) * to where we started. */ while (level > 0) { - /* Attempt to get the next object in this scope */ status = acpi_get_next_object(ACPI_TYPE_ANY, parent_handle, @@ -337,7 +335,6 @@ static acpi_status acpi_ns_delete_subtree(acpi_handle start_handle) /* Did we get a new object? */ if (ACPI_SUCCESS(status)) { - /* Check if this object has any children */ if (ACPI_SUCCESS @@ -395,7 +392,7 @@ acpi_status acpi_ns_unload_namespace(acpi_handle handle) { acpi_status status; - ACPI_FUNCTION_TRACE(ns_unload_name_space); + ACPI_FUNCTION_TRACE("ns_unload_name_space"); /* Parameter validation */ diff --git a/trunk/drivers/acpi/namespace/nsnames.c b/trunk/drivers/acpi/namespace/nsnames.c index 97b8332c9746..639f653b4b6b 100644 --- a/trunk/drivers/acpi/namespace/nsnames.c +++ b/trunk/drivers/acpi/namespace/nsnames.c @@ -48,6 +48,11 @@ #define _COMPONENT ACPI_NAMESPACE ACPI_MODULE_NAME("nsnames") +/* Local prototypes */ +static void +acpi_ns_build_external_path(struct acpi_namespace_node *node, + acpi_size size, char *name_buffer); + /******************************************************************************* * * FUNCTION: acpi_ns_build_external_path @@ -62,7 +67,8 @@ ACPI_MODULE_NAME("nsnames") * DESCRIPTION: Generate a full pathaname * ******************************************************************************/ -void + +static void acpi_ns_build_external_path(struct acpi_namespace_node *node, acpi_size size, char *name_buffer) { @@ -132,7 +138,7 @@ char *acpi_ns_get_external_pathname(struct acpi_namespace_node *node) char *name_buffer; acpi_size size; - ACPI_FUNCTION_TRACE_PTR(ns_get_external_pathname, node); + ACPI_FUNCTION_TRACE_PTR("ns_get_external_pathname", node); /* Calculate required buffer size based on depth below root */ @@ -140,7 +146,7 @@ char *acpi_ns_get_external_pathname(struct acpi_namespace_node *node) /* Allocate a buffer to be returned to caller */ - name_buffer = ACPI_ALLOCATE_ZEROED(size); + name_buffer = ACPI_MEM_CALLOCATE(size); if (!name_buffer) { ACPI_ERROR((AE_INFO, "Allocation failure")); return_PTR(NULL); @@ -213,7 +219,7 @@ acpi_ns_handle_to_pathname(acpi_handle target_handle, struct acpi_namespace_node *node; acpi_size required_size; - ACPI_FUNCTION_TRACE_PTR(ns_handle_to_pathname, target_handle); + ACPI_FUNCTION_TRACE_PTR("ns_handle_to_pathname", target_handle); node = acpi_ns_map_handle_to_node(target_handle); if (!node) { diff --git a/trunk/drivers/acpi/namespace/nsobject.c b/trunk/drivers/acpi/namespace/nsobject.c index aabe8794b908..10ae6292bca4 100644 --- a/trunk/drivers/acpi/namespace/nsobject.c +++ b/trunk/drivers/acpi/namespace/nsobject.c @@ -76,21 +76,19 @@ acpi_ns_attach_object(struct acpi_namespace_node *node, union acpi_operand_object *last_obj_desc; acpi_object_type object_type = ACPI_TYPE_ANY; - ACPI_FUNCTION_TRACE(ns_attach_object); + ACPI_FUNCTION_TRACE("ns_attach_object"); /* * Parameter validation */ if (!node) { - /* Invalid handle */ - ACPI_ERROR((AE_INFO, "Null NamedObj handle")); + ACPI_ERROR((AE_INFO, "Null named_obj handle")); return_ACPI_STATUS(AE_BAD_PARAMETER); } if (!object && (ACPI_TYPE_ANY != type)) { - /* Null object */ ACPI_ERROR((AE_INFO, @@ -99,7 +97,6 @@ acpi_ns_attach_object(struct acpi_namespace_node *node, } if (ACPI_GET_DESCRIPTOR_TYPE(node) != ACPI_DESC_TYPE_NAMED) { - /* Not a name handle */ ACPI_ERROR((AE_INFO, "Invalid handle %p [%s]", @@ -111,7 +108,7 @@ acpi_ns_attach_object(struct acpi_namespace_node *node, if (node->object == object) { ACPI_DEBUG_PRINT((ACPI_DB_EXEC, - "Obj %p already installed in NameObj %p\n", + "Obj %p already installed in name_obj %p\n", object, node)); return_ACPI_STATUS(AE_OK); @@ -204,7 +201,7 @@ void acpi_ns_detach_object(struct acpi_namespace_node *node) { union acpi_operand_object *obj_desc; - ACPI_FUNCTION_TRACE(ns_detach_object); + ACPI_FUNCTION_TRACE("ns_detach_object"); obj_desc = node->object; @@ -255,7 +252,7 @@ union acpi_operand_object *acpi_ns_get_attached_object(struct acpi_namespace_node *node) { - ACPI_FUNCTION_TRACE_PTR(ns_get_attached_object, node); + ACPI_FUNCTION_TRACE_PTR("ns_get_attached_object", node); if (!node) { ACPI_WARNING((AE_INFO, "Null Node ptr")); @@ -290,7 +287,7 @@ union acpi_operand_object *acpi_ns_get_secondary_object(union acpi_operand_object *obj_desc) { - ACPI_FUNCTION_TRACE_PTR(ns_get_secondary_object, obj_desc); + ACPI_FUNCTION_TRACE_PTR("ns_get_secondary_object", obj_desc); if ((!obj_desc) || (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_LOCAL_DATA) || diff --git a/trunk/drivers/acpi/namespace/nsparse.c b/trunk/drivers/acpi/namespace/nsparse.c index 155505a4ef69..232be4303653 100644 --- a/trunk/drivers/acpi/namespace/nsparse.c +++ b/trunk/drivers/acpi/namespace/nsparse.c @@ -62,13 +62,13 @@ ACPI_MODULE_NAME("nsparse") * ******************************************************************************/ acpi_status -acpi_ns_one_complete_parse(u8 pass_number, struct acpi_table_desc *table_desc) +acpi_ns_one_complete_parse(u8 pass_number, struct acpi_table_desc * table_desc) { union acpi_parse_object *parse_root; acpi_status status; struct acpi_walk_state *walk_state; - ACPI_FUNCTION_TRACE(ns_one_complete_parse); + ACPI_FUNCTION_TRACE("ns_one_complete_parse"); /* Create and init a Root Node */ @@ -124,7 +124,7 @@ acpi_ns_parse_table(struct acpi_table_desc *table_desc, { acpi_status status; - ACPI_FUNCTION_TRACE(ns_parse_table); + ACPI_FUNCTION_TRACE("ns_parse_table"); /* * AML Parse, pass 1 diff --git a/trunk/drivers/acpi/namespace/nssearch.c b/trunk/drivers/acpi/namespace/nssearch.c index 500e2bbcfaf7..d64b78952f24 100644 --- a/trunk/drivers/acpi/namespace/nssearch.c +++ b/trunk/drivers/acpi/namespace/nssearch.c @@ -56,16 +56,16 @@ acpi_ns_search_parent_tree(u32 target_name, /******************************************************************************* * - * FUNCTION: acpi_ns_search_one_scope + * FUNCTION: acpi_ns_search_node * * PARAMETERS: target_name - Ascii ACPI name to search for - * parent_node - Starting node where search will begin + * Node - Starting node where search will begin * Type - Object type to match * return_node - Where the matched Named obj is returned * * RETURN: Status * - * DESCRIPTION: Search a single level of the namespace. Performs a + * DESCRIPTION: Search a single level of the namespace. Performs a * simple search of the specified level, and does not add * entries or search parents. * @@ -75,40 +75,35 @@ acpi_ns_search_parent_tree(u32 target_name, * * 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 + * algorithm. However, the linear search was chosen for simplicity * and because the trees are small and the other interpreter * execution overhead is relatively high. * - * Note: CPU execution analysis has shown that the AML interpreter spends - * a very small percentage of its time searching the namespace. Therefore, - * the linear search seems to be sufficient, as there would seem to be - * little value in improving the search. - * ******************************************************************************/ acpi_status -acpi_ns_search_one_scope(u32 target_name, - struct acpi_namespace_node *parent_node, - acpi_object_type type, - struct acpi_namespace_node **return_node) +acpi_ns_search_node(u32 target_name, + struct acpi_namespace_node *node, + acpi_object_type type, + struct acpi_namespace_node **return_node) { - struct acpi_namespace_node *node; + struct acpi_namespace_node *next_node; - ACPI_FUNCTION_TRACE(ns_search_one_scope); + ACPI_FUNCTION_TRACE("ns_search_node"); #ifdef ACPI_DEBUG_OUTPUT if (ACPI_LV_NAMES & acpi_dbg_level) { char *scope_name; - scope_name = acpi_ns_get_external_pathname(parent_node); + scope_name = acpi_ns_get_external_pathname(node); if (scope_name) { ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "Searching %s (%p) For [%4.4s] (%s)\n", - scope_name, parent_node, - ACPI_CAST_PTR(char, &target_name), + scope_name, node, ACPI_CAST_PTR(char, + &target_name), acpi_ut_get_type_name(type))); - ACPI_FREE(scope_name); + ACPI_MEM_FREE(scope_name); } } #endif @@ -117,33 +112,32 @@ acpi_ns_search_one_scope(u32 target_name, * Search for name at this namespace level, which is to say that we * must search for the name among the children of this object */ - node = parent_node->child; - while (node) { - + next_node = node->child; + while (next_node) { /* Check for match against the name */ - if (node->name.integer == target_name) { - + if (next_node->name.integer == target_name) { /* Resolve a control method alias if any */ - if (acpi_ns_get_type(node) == + if (acpi_ns_get_type(next_node) == ACPI_TYPE_LOCAL_METHOD_ALIAS) { - node = + next_node = ACPI_CAST_PTR(struct acpi_namespace_node, - node->object); + next_node->object); } - /* Found matching entry */ - + /* + * Found matching entry. + */ ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "Name [%4.4s] (%s) %p found in scope [%4.4s] %p\n", ACPI_CAST_PTR(char, &target_name), - acpi_ut_get_type_name(node->type), - node, - acpi_ut_get_node_name(parent_node), - parent_node)); + acpi_ut_get_type_name(next_node-> + type), + next_node, + acpi_ut_get_node_name(node), node)); - *return_node = node; + *return_node = next_node; return_ACPI_STATUS(AE_OK); } @@ -151,8 +145,7 @@ acpi_ns_search_one_scope(u32 target_name, * The last entry in the list points back to the parent, * so a flag is used to indicate the end-of-list */ - if (node->flags & ANOBJ_END_OF_PEER_LIST) { - + if (next_node->flags & ANOBJ_END_OF_PEER_LIST) { /* Searched entire list, we are done */ break; @@ -160,7 +153,7 @@ acpi_ns_search_one_scope(u32 target_name, /* Didn't match name, move on to the next peer object */ - node = node->peer; + next_node = next_node->peer; } /* Searched entire namespace level, not found */ @@ -169,8 +162,7 @@ acpi_ns_search_one_scope(u32 target_name, "Name [%4.4s] (%s) not found in search in scope [%4.4s] %p first child %p\n", ACPI_CAST_PTR(char, &target_name), acpi_ut_get_type_name(type), - acpi_ut_get_node_name(parent_node), parent_node, - parent_node->child)); + acpi_ut_get_node_name(node), node, node->child)); return_ACPI_STATUS(AE_NOT_FOUND); } @@ -187,14 +179,14 @@ acpi_ns_search_one_scope(u32 target_name, * RETURN: Status * * DESCRIPTION: Called when a name has not been found in the current namespace - * level. Before adding it or giving up, ACPI scope rules require + * level. Before adding it or giving up, ACPI scope rules require * searching enclosing scopes in cases identified by acpi_ns_local(). * * "A name is located by finding the matching name in the current * name space, and then in the parent name space. If the parent * name space does not contain the name, the search continues * recursively until either the name is found or the name space - * does not have a parent (the root of the name space). This + * does not have a parent (the root of the name space). This * indicates that the name is not found" (From ACPI Specification, * section 5.3) * @@ -209,7 +201,7 @@ acpi_ns_search_parent_tree(u32 target_name, acpi_status status; struct acpi_namespace_node *parent_node; - ACPI_FUNCTION_TRACE(ns_search_parent_tree); + ACPI_FUNCTION_TRACE("ns_search_parent_tree"); parent_node = acpi_ns_get_parent_node(node); @@ -243,19 +235,20 @@ acpi_ns_search_parent_tree(u32 target_name, */ while (parent_node) { /* - * Search parent scope. Use TYPE_ANY because we don't care about the + * Search parent scope. Use TYPE_ANY because we don't care about the * object type at this point, we only care about the existence of - * the actual name we are searching for. Typechecking comes later. + * the actual name we are searching for. Typechecking comes later. */ - status = - acpi_ns_search_one_scope(target_name, parent_node, + status = acpi_ns_search_node(target_name, parent_node, ACPI_TYPE_ANY, return_node); if (ACPI_SUCCESS(status)) { return_ACPI_STATUS(status); } - /* Not found here, go up another level (until we reach the root) */ - + /* + * Not found here, go up another level + * (until we reach the root) + */ parent_node = acpi_ns_get_parent_node(parent_node); } @@ -280,7 +273,7 @@ acpi_ns_search_parent_tree(u32 target_name, * RETURN: Status * * DESCRIPTION: Search for a name segment in a single namespace level, - * optionally adding it if it is not found. If the passed + * optionally adding it if it is not found. If the passed * Type is not Any and the type previously stored in the * entry was Any (i.e. unknown), update the stored type. * @@ -300,46 +293,29 @@ acpi_ns_search_and_enter(u32 target_name, acpi_status status; struct acpi_namespace_node *new_node; - ACPI_FUNCTION_TRACE(ns_search_and_enter); + ACPI_FUNCTION_TRACE("ns_search_and_enter"); /* Parameter validation */ if (!node || !target_name || !return_node) { ACPI_ERROR((AE_INFO, - "Null parameter: Node %p Name %X ReturnNode %p", + "Null param: Node %p Name %X return_node %p", node, target_name, return_node)); return_ACPI_STATUS(AE_BAD_PARAMETER); } - /* - * Name must consist of valid ACPI characters. We will repair the name if - * necessary because we don't want to abort because of this, but we want - * all namespace names to be printable. A warning message is appropriate. - * - * This issue came up because there are in fact machines that exhibit - * this problem, and we want to be able to enable ACPI support for them, - * even though there are a few bad names. - */ + /* Name must consist of printable characters */ + if (!acpi_ut_valid_acpi_name(target_name)) { - target_name = acpi_ut_repair_name(target_name); - - /* Report warning only if in strict mode or debug mode */ - - if (!acpi_gbl_enable_interpreter_slack) { - ACPI_WARNING((AE_INFO, - "Found bad character(s) in name, repaired: [%4.4s]\n", - ACPI_CAST_PTR(char, &target_name))); - } else { - ACPI_DEBUG_PRINT((ACPI_DB_WARN, - "Found bad character(s) in name, repaired: [%4.4s]\n", - ACPI_CAST_PTR(char, &target_name))); - } + ACPI_ERROR((AE_INFO, "Bad character in ACPI Name: %X", + target_name)); + return_ACPI_STATUS(AE_BAD_CHARACTER); } /* Try to find the name in the namespace level specified by the caller */ *return_node = ACPI_ENTRY_NOT_FOUND; - status = acpi_ns_search_one_scope(target_name, node, type, return_node); + status = acpi_ns_search_node(target_name, node, type, return_node); if (status != AE_NOT_FOUND) { /* * If we found it AND the request specifies that a find is an error, @@ -349,16 +325,18 @@ acpi_ns_search_and_enter(u32 target_name, status = AE_ALREADY_EXISTS; } - /* Either found it or there was an error: finished either way */ - + /* + * Either found it or there was an error + * -- finished either way + */ return_ACPI_STATUS(status); } /* - * The name was not found. If we are NOT performing the first pass + * The name was not found. If we are NOT performing the first pass * (name entry) of loading the namespace, search the parent tree (all the * way to the root if necessary.) We don't want to perform the parent - * search when the namespace is actually being loaded. We want to perform + * search when the namespace is actually being loaded. We want to perform * the search when namespace references are being resolved (load pass 2) * and during the execution phase. */ @@ -376,8 +354,9 @@ acpi_ns_search_and_enter(u32 target_name, } } - /* In execute mode, just search, never add names. Exit now */ - + /* + * In execute mode, just search, never add names. Exit now. + */ if (interpreter_mode == ACPI_IMODE_EXECUTE) { ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "%4.4s Not found in %p [Not adding]\n", @@ -392,18 +371,11 @@ acpi_ns_search_and_enter(u32 target_name, if (!new_node) { return_ACPI_STATUS(AE_NO_MEMORY); } -#ifdef ACPI_ASL_COMPILER - /* - * Node is an object defined by an External() statement - */ - if (flags & ACPI_NS_EXTERNAL) { - new_node->flags |= ANOBJ_IS_EXTERNAL; - } -#endif /* Install the new object into the parent's list of children */ acpi_ns_install_node(walk_state, node, new_node, type); *return_node = new_node; + return_ACPI_STATUS(AE_OK); } diff --git a/trunk/drivers/acpi/namespace/nsutils.c b/trunk/drivers/acpi/namespace/nsutils.c index aa4e799d9a8c..3e7cad549a38 100644 --- a/trunk/drivers/acpi/namespace/nsutils.c +++ b/trunk/drivers/acpi/namespace/nsutils.c @@ -78,17 +78,15 @@ acpi_ns_report_error(char *module_name, char *internal_name, acpi_status lookup_status) { acpi_status status; - u32 bad_name; char *name = NULL; - acpi_os_printf("ACPI Error (%s-%04d): ", module_name, line_number); + acpi_ut_report_error(module_name, line_number); if (lookup_status == AE_BAD_CHARACTER) { - /* There is a non-ascii character in the name */ - ACPI_MOVE_32_TO_32(&bad_name, internal_name); - acpi_os_printf("[0x%4.4X] (NON-ASCII)", bad_name); + acpi_os_printf("[0x%4.4X] (NON-ASCII)", + *(ACPI_CAST_PTR(u32, internal_name))); } else { /* Convert path to external format */ @@ -104,7 +102,7 @@ acpi_ns_report_error(char *module_name, } if (name) { - ACPI_FREE(name); + ACPI_MEM_FREE(name); } } @@ -139,12 +137,11 @@ acpi_ns_report_method_error(char *module_name, acpi_status status; struct acpi_namespace_node *node = prefix_node; - acpi_os_printf("ACPI Error (%s-%04d): ", module_name, line_number); + acpi_ut_report_error(module_name, line_number); if (path) { - status = - acpi_ns_get_node(prefix_node, path, ACPI_NS_NO_UPSEARCH, - &node); + status = acpi_ns_get_node_by_path(path, prefix_node, + ACPI_NS_NO_UPSEARCH, &node); if (ACPI_FAILURE(status)) { acpi_os_printf("[Could not get node by pathname]"); } @@ -188,7 +185,7 @@ acpi_ns_print_node_pathname(struct acpi_namespace_node *node, char *message) } acpi_os_printf("[%s] (Node %p)", (char *)buffer.pointer, node); - ACPI_FREE(buffer.pointer); + ACPI_MEM_FREE(buffer.pointer); } } @@ -242,7 +239,7 @@ static u8 acpi_ns_valid_path_separator(char sep) acpi_object_type acpi_ns_get_type(struct acpi_namespace_node * node) { - ACPI_FUNCTION_TRACE(ns_get_type); + ACPI_FUNCTION_TRACE("ns_get_type"); if (!node) { ACPI_WARNING((AE_INFO, "Null Node parameter")); @@ -267,10 +264,9 @@ acpi_object_type acpi_ns_get_type(struct acpi_namespace_node * node) u32 acpi_ns_local(acpi_object_type type) { - ACPI_FUNCTION_TRACE(ns_local); + ACPI_FUNCTION_TRACE("ns_local"); if (!acpi_ut_valid_object_type(type)) { - /* Type code out of range */ ACPI_WARNING((AE_INFO, "Invalid Object Type %X", type)); @@ -367,7 +363,7 @@ acpi_status acpi_ns_build_internal_name(struct acpi_namestring_info *info) char *result = NULL; acpi_native_uint i; - ACPI_FUNCTION_TRACE(ns_build_internal_name); + ACPI_FUNCTION_TRACE("ns_build_internal_name"); /* Setup the correct prefixes, counts, and pointers */ @@ -415,7 +411,6 @@ acpi_status acpi_ns_build_internal_name(struct acpi_namestring_info *info) for (i = 0; i < ACPI_NAME_SIZE; i++) { if (acpi_ns_valid_path_separator(*external_name) || (*external_name == 0)) { - /* Pad the segment with underscore(s) if segment is short */ result[i] = '_'; @@ -478,7 +473,7 @@ acpi_status acpi_ns_internalize_name(char *external_name, char **converted_name) struct acpi_namestring_info info; acpi_status status; - ACPI_FUNCTION_TRACE(ns_internalize_name); + ACPI_FUNCTION_TRACE("ns_internalize_name"); if ((!external_name) || (*external_name == 0) || (!converted_name)) { return_ACPI_STATUS(AE_BAD_PARAMETER); @@ -491,7 +486,7 @@ acpi_status acpi_ns_internalize_name(char *external_name, char **converted_name) /* We need a segment to store the internal name */ - internal_name = ACPI_ALLOCATE_ZEROED(info.length); + internal_name = ACPI_MEM_CALLOCATE(info.length); if (!internal_name) { return_ACPI_STATUS(AE_NO_MEMORY); } @@ -501,7 +496,7 @@ acpi_status acpi_ns_internalize_name(char *external_name, char **converted_name) info.internal_name = internal_name; status = acpi_ns_build_internal_name(&info); if (ACPI_FAILURE(status)) { - ACPI_FREE(internal_name); + ACPI_MEM_FREE(internal_name); return_ACPI_STATUS(status); } @@ -538,7 +533,7 @@ acpi_ns_externalize_name(u32 internal_name_length, acpi_native_uint i = 0; acpi_native_uint j = 0; - ACPI_FUNCTION_TRACE(ns_externalize_name); + ACPI_FUNCTION_TRACE("ns_externalize_name"); if (!internal_name_length || !internal_name || !converted_name) { return_ACPI_STATUS(AE_BAD_PARAMETER); @@ -633,7 +628,7 @@ acpi_ns_externalize_name(u32 internal_name_length, /* * Build converted_name */ - *converted_name = ACPI_ALLOCATE_ZEROED(required_length); + *converted_name = ACPI_MEM_CALLOCATE(required_length); if (!(*converted_name)) { return_ACPI_STATUS(AE_NO_MEMORY); } @@ -686,9 +681,13 @@ struct acpi_namespace_node *acpi_ns_map_handle_to_node(acpi_handle handle) ACPI_FUNCTION_ENTRY(); /* - * Simple implementation + * Simple implementation. */ - if ((!handle) || (handle == ACPI_ROOT_OBJECT)) { + if (!handle) { + return (NULL); + } + + if (handle == ACPI_ROOT_OBJECT) { return (acpi_gbl_root_node); } @@ -698,7 +697,7 @@ struct acpi_namespace_node *acpi_ns_map_handle_to_node(acpi_handle handle) return (NULL); } - return (ACPI_CAST_PTR(struct acpi_namespace_node, handle)); + return ((struct acpi_namespace_node *)handle); } /******************************************************************************* @@ -753,7 +752,7 @@ void acpi_ns_terminate(void) { union acpi_operand_object *obj_desc; - ACPI_FUNCTION_TRACE(ns_terminate); + ACPI_FUNCTION_TRACE("ns_terminate"); /* * 1) Free the entire namespace -- all nodes and objects @@ -793,10 +792,9 @@ void acpi_ns_terminate(void) u32 acpi_ns_opens_scope(acpi_object_type type) { - ACPI_FUNCTION_TRACE_STR(ns_opens_scope, acpi_ut_get_type_name(type)); + ACPI_FUNCTION_TRACE_STR("ns_opens_scope", acpi_ut_get_type_name(type)); if (!acpi_ut_valid_object_type(type)) { - /* type code out of range */ ACPI_WARNING((AE_INFO, "Invalid Object Type %X", type)); @@ -808,12 +806,12 @@ u32 acpi_ns_opens_scope(acpi_object_type type) /******************************************************************************* * - * FUNCTION: acpi_ns_get_node + * FUNCTION: acpi_ns_get_node_by_path * * PARAMETERS: *Pathname - Name to be found, in external (ASL) format. The * \ (backslash) and ^ (carat) prefixes, and the * . (period) to separate segments are supported. - * prefix_node - 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 s8 is '\'), the passed value * of Scope will not be accessed. @@ -829,29 +827,23 @@ u32 acpi_ns_opens_scope(acpi_object_type type) ******************************************************************************/ acpi_status -acpi_ns_get_node(struct acpi_namespace_node *prefix_node, - char *pathname, - u32 flags, struct acpi_namespace_node **return_node) +acpi_ns_get_node_by_path(char *pathname, + struct acpi_namespace_node *start_node, + u32 flags, struct acpi_namespace_node **return_node) { union acpi_generic_state scope_info; acpi_status status; - char *internal_path; - - ACPI_FUNCTION_TRACE_PTR(ns_get_node, pathname); + char *internal_path = NULL; - if (!pathname) { - *return_node = prefix_node; - if (!prefix_node) { - *return_node = acpi_gbl_root_node; - } - return_ACPI_STATUS(AE_OK); - } + ACPI_FUNCTION_TRACE_PTR("ns_get_node_by_path", pathname); - /* Convert path to internal representation */ + if (pathname) { + /* Convert path to internal representation */ - status = acpi_ns_internalize_name(pathname, &internal_path); - if (ACPI_FAILURE(status)) { - return_ACPI_STATUS(status); + status = acpi_ns_internalize_name(pathname, &internal_path); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); + } } /* Must lock namespace during lookup */ @@ -863,23 +855,26 @@ acpi_ns_get_node(struct acpi_namespace_node *prefix_node, /* Setup lookup scope (search starting point) */ - scope_info.scope.node = prefix_node; + scope_info.scope.node = start_node; /* Lookup the name in the namespace */ - status = acpi_ns_lookup(&scope_info, internal_path, ACPI_TYPE_ANY, - ACPI_IMODE_EXECUTE, - (flags | ACPI_NS_DONT_OPEN_SCOPE), NULL, - return_node); + status = acpi_ns_lookup(&scope_info, internal_path, + ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, + (flags | ACPI_NS_DONT_OPEN_SCOPE), + NULL, return_node); if (ACPI_FAILURE(status)) { ACPI_DEBUG_PRINT((ACPI_DB_INFO, "%s, %s\n", - pathname, acpi_format_exception(status))); + internal_path, + acpi_format_exception(status))); } (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); cleanup: - ACPI_FREE(internal_path); + if (internal_path) { + ACPI_MEM_FREE(internal_path); + } return_ACPI_STATUS(status); } @@ -965,10 +960,9 @@ acpi_name acpi_ns_find_parent_name(struct acpi_namespace_node * child_node) { struct acpi_namespace_node *parent_node; - ACPI_FUNCTION_TRACE(ns_find_parent_name); + ACPI_FUNCTION_TRACE("ns_find_parent_name"); if (child_node) { - /* Valid entry. Get the parent Node */ parent_node = acpi_ns_get_parent_node(child_node); diff --git a/trunk/drivers/acpi/namespace/nswalk.c b/trunk/drivers/acpi/namespace/nswalk.c index c8f6bef16ed0..fcab1e784b81 100644 --- a/trunk/drivers/acpi/namespace/nswalk.c +++ b/trunk/drivers/acpi/namespace/nswalk.c @@ -76,7 +76,6 @@ struct acpi_namespace_node *acpi_ns_get_next_node(acpi_object_type type, ACPI_FUNCTION_ENTRY(); if (!child_node) { - /* It's really the parent's _scope_ that we want */ if (parent_node->child) { @@ -93,7 +92,6 @@ struct acpi_namespace_node *acpi_ns_get_next_node(acpi_object_type type, /* If any type is OK, we are done */ if (type == ACPI_TYPE_ANY) { - /* next_node is NULL if we are at the end-of-list */ return (next_node); @@ -102,7 +100,6 @@ struct acpi_namespace_node *acpi_ns_get_next_node(acpi_object_type type, /* Must search for the node -- but within this scope only */ while (next_node) { - /* If type matches, we are done */ if (next_node->type == type) { @@ -164,7 +161,7 @@ acpi_ns_walk_namespace(acpi_object_type type, acpi_object_type child_type; u32 level; - ACPI_FUNCTION_TRACE(ns_walk_namespace); + ACPI_FUNCTION_TRACE("ns_walk_namespace"); /* Special case for the namespace Root Node */ @@ -185,7 +182,6 @@ acpi_ns_walk_namespace(acpi_object_type type, * bubbled up to (and passed) the original parent handle (start_entry) */ while (level > 0) { - /* Get the next node in this scope. Null if not found */ status = AE_OK; diff --git a/trunk/drivers/acpi/namespace/nsxfeval.c b/trunk/drivers/acpi/namespace/nsxfeval.c index 6d9bd45af30a..a95f636dc35d 100644 --- a/trunk/drivers/acpi/namespace/nsxfeval.c +++ b/trunk/drivers/acpi/namespace/nsxfeval.c @@ -42,6 +42,8 @@ * POSSIBILITY OF SUCH DAMAGES. */ +#include + #include #include #include @@ -49,7 +51,6 @@ #define _COMPONENT ACPI_NAMESPACE ACPI_MODULE_NAME("nsxfeval") -#ifdef ACPI_FUTURE_USAGE /******************************************************************************* * * FUNCTION: acpi_evaluate_object_typed @@ -70,17 +71,18 @@ ACPI_MODULE_NAME("nsxfeval") * be valid (non-null) * ******************************************************************************/ +#ifdef ACPI_FUTURE_USAGE acpi_status acpi_evaluate_object_typed(acpi_handle handle, acpi_string pathname, - struct acpi_object_list * external_params, - struct acpi_buffer * return_buffer, + struct acpi_object_list *external_params, + struct acpi_buffer *return_buffer, acpi_object_type return_type) { acpi_status status; u8 must_free = FALSE; - ACPI_FUNCTION_TRACE(acpi_evaluate_object_typed); + ACPI_FUNCTION_TRACE("acpi_evaluate_object_typed"); /* Return buffer must be valid */ @@ -108,7 +110,6 @@ acpi_evaluate_object_typed(acpi_handle handle, } if (return_buffer->length == 0) { - /* Error because caller specifically asked for a return value */ ACPI_ERROR((AE_INFO, "No return value")); @@ -130,7 +131,6 @@ acpi_evaluate_object_typed(acpi_handle handle, acpi_ut_get_type_name(return_type))); if (must_free) { - /* Caller used ACPI_ALLOCATE_BUFFER, free the return buffer */ acpi_os_free(return_buffer->pointer); @@ -140,8 +140,6 @@ acpi_evaluate_object_typed(acpi_handle handle, return_buffer->length = 0; return_ACPI_STATUS(AE_TYPE); } - -ACPI_EXPORT_SYMBOL(acpi_evaluate_object_typed) #endif /* ACPI_FUTURE_USAGE */ /******************************************************************************* @@ -163,6 +161,7 @@ ACPI_EXPORT_SYMBOL(acpi_evaluate_object_typed) * be valid (non-null) * ******************************************************************************/ + acpi_status acpi_evaluate_object(acpi_handle handle, acpi_string pathname, @@ -171,61 +170,51 @@ acpi_evaluate_object(acpi_handle handle, { acpi_status status; acpi_status status2; - struct acpi_evaluate_info *info; + struct acpi_parameter_info info; acpi_size buffer_space_needed; u32 i; - ACPI_FUNCTION_TRACE(acpi_evaluate_object); + ACPI_FUNCTION_TRACE("acpi_evaluate_object"); - /* Allocate and initialize the evaluation information block */ - - info = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_evaluate_info)); - if (!info) { - return_ACPI_STATUS(AE_NO_MEMORY); - } - - info->pathname = pathname; - info->parameter_type = ACPI_PARAM_ARGS; - - /* Convert and validate the device handle */ - - info->prefix_node = acpi_ns_map_handle_to_node(handle); - if (!info->prefix_node) { - status = AE_BAD_PARAMETER; - goto cleanup; - } + info.node = handle; + info.parameters = NULL; + info.return_object = NULL; + info.parameter_type = ACPI_PARAM_ARGS; /* - * If there are parameters to be passed to a control method, the external - * objects must all be converted to internal objects + * If there are parameters to be passed to the object + * (which must be a control method), the external objects + * must be converted to internal objects */ if (external_params && external_params->count) { /* * Allocate a new parameter block for the internal objects * Add 1 to count to allow for null terminated internal list */ - info->parameters = ACPI_ALLOCATE_ZEROED(((acpi_size) - external_params-> - count + - 1) * sizeof(void *)); - if (!info->parameters) { - status = AE_NO_MEMORY; - goto cleanup; + info.parameters = ACPI_MEM_CALLOCATE(((acpi_size) + external_params->count + + 1) * sizeof(void *)); + if (!info.parameters) { + return_ACPI_STATUS(AE_NO_MEMORY); } - /* Convert each external object in the list to an internal object */ - + /* + * Convert each external object in the list to an + * internal object + */ for (i = 0; i < external_params->count; i++) { status = acpi_ut_copy_eobject_to_iobject(&external_params-> pointer[i], - &info-> + &info. parameters[i]); if (ACPI_FAILURE(status)) { - goto cleanup; + acpi_ut_delete_internal_object_list(info. + parameters); + return_ACPI_STATUS(status); } } - info->parameters[external_params->count] = NULL; + info.parameters[external_params->count] = NULL; } /* @@ -235,31 +224,43 @@ acpi_evaluate_object(acpi_handle handle, * 3) Valid handle */ if ((pathname) && (acpi_ns_valid_root_prefix(pathname[0]))) { - - /* The path is fully qualified, just evaluate by name */ - - info->prefix_node = NULL; - status = acpi_ns_evaluate(info); + /* + * The path is fully qualified, just evaluate by name + */ + status = acpi_ns_evaluate_by_name(pathname, &info); } else if (!handle) { /* - * A handle is optional iff a fully qualified pathname is specified. - * Since we've already handled fully qualified names above, this is - * an error + * A handle is optional iff a fully qualified pathname + * is specified. Since we've already handled fully + * qualified names above, this is an error */ if (!pathname) { - ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "Both Handle and Pathname are NULL")); + ACPI_ERROR((AE_INFO, + "Both Handle and Pathname are NULL")); } else { - ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "Null Handle with relative pathname [%s]", - pathname)); + ACPI_ERROR((AE_INFO, + "Handle is NULL and Pathname is relative")); } status = AE_BAD_PARAMETER; } else { - /* We have a namespace a node and a possible relative path */ - - status = acpi_ns_evaluate(info); + /* + * We get here if we have a handle -- and if we have a + * pathname it is relative. The handle will be validated + * in the lower procedures + */ + if (!pathname) { + /* + * The null pathname case means the handle is for + * the actual object to be evaluated + */ + status = acpi_ns_evaluate_by_handle(&info); + } else { + /* + * Both a Handle and a relative Pathname + */ + status = acpi_ns_evaluate_relative(pathname, &info); + } } /* @@ -267,10 +268,10 @@ acpi_evaluate_object(acpi_handle handle, * copy the return value to an external object. */ if (return_buffer) { - if (!info->return_object) { + if (!info.return_object) { return_buffer->length = 0; } else { - if (ACPI_GET_DESCRIPTOR_TYPE(info->return_object) == + if (ACPI_GET_DESCRIPTOR_TYPE(info.return_object) == ACPI_DESC_TYPE_NAMED) { /* * If we received a NS Node as a return object, this means that @@ -281,19 +282,19 @@ acpi_evaluate_object(acpi_handle handle, * support for various types at a later date if necessary. */ status = AE_TYPE; - info->return_object = NULL; /* No need to delete a NS Node */ + info.return_object = NULL; /* No need to delete a NS Node */ return_buffer->length = 0; } if (ACPI_SUCCESS(status)) { - - /* Get the size of the returned object */ - + /* + * Find out how large a buffer is needed + * to contain the returned object + */ status = - acpi_ut_get_object_size(info->return_object, + acpi_ut_get_object_size(info.return_object, &buffer_space_needed); if (ACPI_SUCCESS(status)) { - /* Validate/Allocate/Clear caller buffer */ status = @@ -302,8 +303,7 @@ acpi_evaluate_object(acpi_handle handle, buffer_space_needed); if (ACPI_FAILURE(status)) { /* - * Caller's buffer is too small or a new one can't - * be allocated + * Caller's buffer is too small or a new one can't be allocated */ ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Needed buffer size %X, %s\n", @@ -312,11 +312,12 @@ acpi_evaluate_object(acpi_handle handle, acpi_format_exception (status))); } else { - /* We have enough space for the object, build it */ - + /* + * We have enough space for the object, build it + */ status = acpi_ut_copy_iobject_to_eobject - (info->return_object, + (info.return_object, return_buffer); } } @@ -324,37 +325,35 @@ acpi_evaluate_object(acpi_handle handle, } } - if (info->return_object) { + if (info.return_object) { /* - * Delete the internal return object. NOTE: Interpreter must be - * locked to avoid race condition. + * Delete the internal return object. NOTE: Interpreter + * must be locked to avoid race condition. */ status2 = acpi_ex_enter_interpreter(); if (ACPI_SUCCESS(status2)) { - - /* Remove one reference on the return object (should delete it) */ - - acpi_ut_remove_reference(info->return_object); + /* + * Delete the internal return object. (Or at least + * decrement the reference count by one) + */ + acpi_ut_remove_reference(info.return_object); acpi_ex_exit_interpreter(); } } - cleanup: - - /* Free the input parameter list (if we created one) */ - - if (info->parameters) { - + /* + * Free the input parameter list (if we created one), + */ + if (info.parameters) { /* Free the allocated parameter block */ - acpi_ut_delete_internal_object_list(info->parameters); + acpi_ut_delete_internal_object_list(info.parameters); } - ACPI_FREE(info); return_ACPI_STATUS(status); } -ACPI_EXPORT_SYMBOL(acpi_evaluate_object) +EXPORT_SYMBOL(acpi_evaluate_object); /******************************************************************************* * @@ -385,6 +384,7 @@ ACPI_EXPORT_SYMBOL(acpi_evaluate_object) * function, etc. * ******************************************************************************/ + acpi_status acpi_walk_namespace(acpi_object_type type, acpi_handle start_object, @@ -394,7 +394,7 @@ acpi_walk_namespace(acpi_object_type type, { acpi_status status; - ACPI_FUNCTION_TRACE(acpi_walk_namespace); + ACPI_FUNCTION_TRACE("acpi_walk_namespace"); /* Parameter validation */ @@ -421,7 +421,7 @@ acpi_walk_namespace(acpi_object_type type, return_ACPI_STATUS(status); } -ACPI_EXPORT_SYMBOL(acpi_walk_namespace) +EXPORT_SYMBOL(acpi_walk_namespace); /******************************************************************************* * @@ -436,6 +436,7 @@ ACPI_EXPORT_SYMBOL(acpi_walk_namespace) * on that. * ******************************************************************************/ + static acpi_status acpi_ns_get_device_callback(acpi_handle obj_handle, u32 nesting_level, @@ -472,7 +473,6 @@ acpi_ns_get_device_callback(acpi_handle obj_handle, } if (!(flags & ACPI_STA_DEVICE_PRESENT)) { - /* Don't examine children of the device if not present */ return (AE_CTRL_DEPTH); @@ -489,7 +489,6 @@ acpi_ns_get_device_callback(acpi_handle obj_handle, } if (ACPI_STRNCMP(hid.value, info->hid, sizeof(hid.value)) != 0) { - /* Get the list of Compatible IDs */ status = acpi_ut_execute_CID(node, &cid); @@ -506,11 +505,11 @@ acpi_ns_get_device_callback(acpi_handle obj_handle, sizeof(struct acpi_compatible_id)) != 0) { - ACPI_FREE(cid); + ACPI_MEM_FREE(cid); return (AE_OK); } } - ACPI_FREE(cid); + ACPI_MEM_FREE(cid); } } @@ -552,7 +551,7 @@ acpi_get_devices(char *HID, acpi_status status; struct acpi_get_devices_info info; - ACPI_FUNCTION_TRACE(acpi_get_devices); + ACPI_FUNCTION_TRACE("acpi_get_devices"); /* Parameter validation */ @@ -564,9 +563,9 @@ acpi_get_devices(char *HID, * We're going to call their callback from OUR callback, so we need * to know what it is, and their context parameter. */ - info.hid = HID; info.context = context; info.user_function = user_function; + info.hid = HID; /* * Lock the namespace around the walk. @@ -579,8 +578,9 @@ acpi_get_devices(char *HID, return_ACPI_STATUS(status); } - status = acpi_ns_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, - ACPI_UINT32_MAX, ACPI_NS_WALK_UNLOCK, + status = acpi_ns_walk_namespace(ACPI_TYPE_DEVICE, + ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, + ACPI_NS_WALK_UNLOCK, acpi_ns_get_device_callback, &info, return_value); @@ -588,7 +588,7 @@ acpi_get_devices(char *HID, return_ACPI_STATUS(status); } -ACPI_EXPORT_SYMBOL(acpi_get_devices) +EXPORT_SYMBOL(acpi_get_devices); /******************************************************************************* * @@ -603,6 +603,7 @@ ACPI_EXPORT_SYMBOL(acpi_get_devices) * DESCRIPTION: Attach arbitrary data and handler to a namespace node. * ******************************************************************************/ + acpi_status acpi_attach_data(acpi_handle obj_handle, acpi_object_handler handler, void *data) @@ -636,8 +637,6 @@ acpi_attach_data(acpi_handle obj_handle, return (status); } -ACPI_EXPORT_SYMBOL(acpi_attach_data) - /******************************************************************************* * * FUNCTION: acpi_detach_data @@ -650,6 +649,7 @@ ACPI_EXPORT_SYMBOL(acpi_attach_data) * DESCRIPTION: Remove data that was previously attached to a node. * ******************************************************************************/ + acpi_status acpi_detach_data(acpi_handle obj_handle, acpi_object_handler handler) { @@ -682,8 +682,6 @@ acpi_detach_data(acpi_handle obj_handle, acpi_object_handler handler) return (status); } -ACPI_EXPORT_SYMBOL(acpi_detach_data) - /******************************************************************************* * * FUNCTION: acpi_get_data @@ -697,6 +695,7 @@ ACPI_EXPORT_SYMBOL(acpi_detach_data) * DESCRIPTION: Retrieve data that was previously attached to a namespace node. * ******************************************************************************/ + acpi_status acpi_get_data(acpi_handle obj_handle, acpi_object_handler handler, void **data) { @@ -728,5 +727,3 @@ acpi_get_data(acpi_handle obj_handle, acpi_object_handler handler, void **data) (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); return (status); } - -ACPI_EXPORT_SYMBOL(acpi_get_data) diff --git a/trunk/drivers/acpi/namespace/nsxfname.c b/trunk/drivers/acpi/namespace/nsxfname.c index 978213a6c19f..8cd8675a47c0 100644 --- a/trunk/drivers/acpi/namespace/nsxfname.c +++ b/trunk/drivers/acpi/namespace/nsxfname.c @@ -42,6 +42,8 @@ * POSSIBILITY OF SUCH DAMAGES. */ +#include + #include #include @@ -112,8 +114,9 @@ acpi_get_handle(acpi_handle parent, /* * Find the Node and convert to a handle */ - status = acpi_ns_get_node(prefix_node, pathname, ACPI_NS_NO_UPSEARCH, - &node); + status = + acpi_ns_get_node_by_path(pathname, prefix_node, ACPI_NS_NO_UPSEARCH, + &node); *ret_handle = NULL; if (ACPI_SUCCESS(status)) { @@ -123,7 +126,7 @@ acpi_get_handle(acpi_handle parent, return (status); } -ACPI_EXPORT_SYMBOL(acpi_get_handle) +EXPORT_SYMBOL(acpi_get_handle); /****************************************************************************** * @@ -140,6 +143,7 @@ ACPI_EXPORT_SYMBOL(acpi_get_handle) * complementary functions. * ******************************************************************************/ + acpi_status acpi_get_name(acpi_handle handle, u32 name_type, struct acpi_buffer * buffer) { @@ -158,7 +162,6 @@ acpi_get_name(acpi_handle handle, u32 name_type, struct acpi_buffer * buffer) } if (name_type == ACPI_FULL_PATHNAME) { - /* Get the full pathname (From the namespace root) */ status = acpi_ns_handle_to_pathname(handle, buffer); @@ -200,7 +203,7 @@ acpi_get_name(acpi_handle handle, u32 name_type, struct acpi_buffer * buffer) return (status); } -ACPI_EXPORT_SYMBOL(acpi_get_name) +EXPORT_SYMBOL(acpi_get_name); /****************************************************************************** * @@ -216,6 +219,7 @@ ACPI_EXPORT_SYMBOL(acpi_get_name) * control methods (Such as in the case of a device.) * ******************************************************************************/ + acpi_status acpi_get_object_info(acpi_handle handle, struct acpi_buffer * buffer) { @@ -237,7 +241,7 @@ acpi_get_object_info(acpi_handle handle, struct acpi_buffer * buffer) return (status); } - info = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_device_info)); + info = ACPI_MEM_CALLOCATE(sizeof(struct acpi_device_info)); if (!info) { return (AE_NO_MEMORY); } @@ -341,11 +345,11 @@ acpi_get_object_info(acpi_handle handle, struct acpi_buffer * buffer) } cleanup: - ACPI_FREE(info); + ACPI_MEM_FREE(info); if (cid_list) { - ACPI_FREE(cid_list); + ACPI_MEM_FREE(cid_list); } return (status); } -ACPI_EXPORT_SYMBOL(acpi_get_object_info) +EXPORT_SYMBOL(acpi_get_object_info); diff --git a/trunk/drivers/acpi/namespace/nsxfobj.c b/trunk/drivers/acpi/namespace/nsxfobj.c index a163e1d3708d..a0332595677a 100644 --- a/trunk/drivers/acpi/namespace/nsxfobj.c +++ b/trunk/drivers/acpi/namespace/nsxfobj.c @@ -42,6 +42,8 @@ * POSSIBILITY OF SUCH DAMAGES. */ +#include + #include #include @@ -99,7 +101,7 @@ acpi_status acpi_get_type(acpi_handle handle, acpi_object_type * ret_type) return (status); } -ACPI_EXPORT_SYMBOL(acpi_get_type) +EXPORT_SYMBOL(acpi_get_type); /******************************************************************************* * @@ -114,6 +116,7 @@ ACPI_EXPORT_SYMBOL(acpi_get_type) * Handle. * ******************************************************************************/ + acpi_status acpi_get_parent(acpi_handle handle, acpi_handle * ret_handle) { struct acpi_namespace_node *node; @@ -159,7 +162,7 @@ acpi_status acpi_get_parent(acpi_handle handle, acpi_handle * ret_handle) return (status); } -ACPI_EXPORT_SYMBOL(acpi_get_parent) +EXPORT_SYMBOL(acpi_get_parent); /******************************************************************************* * @@ -178,6 +181,7 @@ ACPI_EXPORT_SYMBOL(acpi_get_parent) * Scope is returned. * ******************************************************************************/ + acpi_status acpi_get_next_object(acpi_object_type type, acpi_handle parent, @@ -202,7 +206,6 @@ acpi_get_next_object(acpi_object_type type, /* If null handle, use the parent */ if (!child) { - /* Start search at the beginning of the specified scope */ parent_node = acpi_ns_map_handle_to_node(parent); @@ -239,4 +242,4 @@ acpi_get_next_object(acpi_object_type type, return (status); } -ACPI_EXPORT_SYMBOL(acpi_get_next_object) +EXPORT_SYMBOL(acpi_get_next_object); diff --git a/trunk/drivers/acpi/osl.c b/trunk/drivers/acpi/osl.c index 1bb558adee66..13b5fd5854a8 100644 --- a/trunk/drivers/acpi/osl.c +++ b/trunk/drivers/acpi/osl.c @@ -37,7 +37,6 @@ #include #include #include -#include #include #include #include @@ -601,41 +600,23 @@ static void acpi_os_execute_deferred(void *context) return_VOID; } -static int acpi_os_execute_thread(void *context) -{ - struct acpi_os_dpc *dpc = (struct acpi_os_dpc *)context; - if (dpc) { - dpc->function(dpc->context); - kfree(dpc); - } - do_exit(0); -} - -/******************************************************************************* - * - * FUNCTION: acpi_os_execute - * - * PARAMETERS: Type - Type of the callback - * Function - Function to be executed - * Context - Function parameters - * - * RETURN: Status - * - * DESCRIPTION: Depending on type, either queues function for deferred execution or - * immediately executes function on a separate thread. - * - ******************************************************************************/ - -acpi_status acpi_os_execute(acpi_execute_type type, +acpi_status +acpi_os_queue_for_execution(u32 priority, acpi_osd_exec_callback function, void *context) { acpi_status status = AE_OK; struct acpi_os_dpc *dpc; struct work_struct *task; - struct task_struct *p; + + ACPI_FUNCTION_TRACE("os_queue_for_execution"); + + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, + "Scheduling function [%p(%p)] for deferred execution.\n", + function, context)); if (!function) - return AE_BAD_PARAMETER; + return_ACPI_STATUS(AE_BAD_PARAMETER); + /* * Allocate/initialize DPC structure. Note that this memory will be * freed by the callee. The kernel handles the tq_struct list in a @@ -646,37 +627,30 @@ acpi_status acpi_os_execute(acpi_execute_type type, * We can save time and code by allocating the DPC and tq_structs * from the same memory. */ - if (type == OSL_NOTIFY_HANDLER) { - dpc = kmalloc(sizeof(struct acpi_os_dpc), GFP_KERNEL); - } else { - dpc = kmalloc(sizeof(struct acpi_os_dpc) + - sizeof(struct work_struct), GFP_ATOMIC); - } + + dpc = + kmalloc(sizeof(struct acpi_os_dpc) + sizeof(struct work_struct), + GFP_ATOMIC); if (!dpc) - return AE_NO_MEMORY; + return_ACPI_STATUS(AE_NO_MEMORY); + dpc->function = function; dpc->context = context; - if (type == OSL_NOTIFY_HANDLER) { - p = kthread_create(acpi_os_execute_thread, dpc, "kacpid_notify"); - if (!IS_ERR(p)) { - wake_up_process(p); - } else { - status = AE_NO_MEMORY; - kfree(dpc); - } - } else { - task = (void *)(dpc + 1); - INIT_WORK(task, acpi_os_execute_deferred, (void *)dpc); - if (!queue_work(kacpid_wq, task)) { - status = AE_ERROR; - kfree(dpc); - } + task = (void *)(dpc + 1); + INIT_WORK(task, acpi_os_execute_deferred, (void *)dpc); + + if (!queue_work(kacpid_wq, task)) { + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Call to queue_work() failed.\n")); + kfree(dpc); + status = AE_ERROR; } - return status; + + return_ACPI_STATUS(status); } -EXPORT_SYMBOL(acpi_os_execute); +EXPORT_SYMBOL(acpi_os_queue_for_execution); void acpi_os_wait_events_complete(void *context) { @@ -795,6 +769,9 @@ acpi_status acpi_os_wait_semaphore(acpi_handle handle, u32 units, u16 timeout) ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Waiting for semaphore[%p|%d|%d]\n", handle, units, timeout)); + if (in_atomic()) + timeout = 0; + switch (timeout) { /* * No Wait: @@ -919,6 +896,14 @@ u8 acpi_os_writable(void *ptr, acpi_size len) } #endif +u32 acpi_os_get_thread_id(void) +{ + if (!in_atomic()) + return current->pid; + + return 0; +} + acpi_status acpi_os_signal(u32 function, void *info) { switch (function) { @@ -1065,12 +1050,12 @@ void acpi_os_release_lock(acpi_handle handle, acpi_cpu_flags flags) * * FUNCTION: acpi_os_create_cache * - * PARAMETERS: name - Ascii name for the cache - * size - Size of each cached object - * depth - Maximum depth of the cache (in objects) - * cache - Where the new cache object is returned + * PARAMETERS: CacheName - Ascii name for the cache + * ObjectSize - Size of each cached object + * MaxDepth - Maximum depth of the cache (in objects) + * ReturnCache - Where the new cache object is returned * - * RETURN: status + * RETURN: Status * * DESCRIPTION: Create a cache object * @@ -1080,10 +1065,7 @@ acpi_status acpi_os_create_cache(char *name, u16 size, u16 depth, acpi_cache_t ** cache) { *cache = kmem_cache_create(name, size, 0, 0, NULL, NULL); - if (cache == NULL) - return AE_ERROR; - else - return AE_OK; + return AE_OK; } /******************************************************************************* @@ -1152,63 +1134,16 @@ acpi_status acpi_os_release_object(acpi_cache_t * cache, void *object) * * RETURN: Status * - * DESCRIPTION: Return a zero-filled object. + * DESCRIPTION: Get an object from the specified cache. If cache is empty, + * the object is allocated. * ******************************************************************************/ void *acpi_os_acquire_object(acpi_cache_t * cache) { - void *object = kmem_cache_zalloc(cache, GFP_KERNEL); + void *object = kmem_cache_alloc(cache, GFP_KERNEL); WARN_ON(!object); return object; } -/****************************************************************************** - * - * FUNCTION: acpi_os_validate_interface - * - * PARAMETERS: interface - Requested interface to be validated - * - * RETURN: AE_OK if interface is supported, AE_SUPPORT otherwise - * - * DESCRIPTION: Match an interface string to the interfaces supported by the - * host. Strings originate from an AML call to the _OSI method. - * - *****************************************************************************/ - -acpi_status -acpi_os_validate_interface (char *interface) -{ - - return AE_SUPPORT; -} - - -/****************************************************************************** - * - * FUNCTION: acpi_os_validate_address - * - * PARAMETERS: space_id - ACPI space ID - * address - Physical address - * length - Address length - * - * RETURN: AE_OK if address/length is valid for the space_id. Otherwise, - * should return AE_AML_ILLEGAL_ADDRESS. - * - * DESCRIPTION: Validate a system address via the host OS. Used to validate - * the addresses accessed by AML operation regions. - * - *****************************************************************************/ - -acpi_status -acpi_os_validate_address ( - u8 space_id, - acpi_physical_address address, - acpi_size length) -{ - - return AE_OK; -} - - #endif diff --git a/trunk/drivers/acpi/parser/psargs.c b/trunk/drivers/acpi/parser/psargs.c index bf88e076c3e9..de573be52718 100644 --- a/trunk/drivers/acpi/parser/psargs.c +++ b/trunk/drivers/acpi/parser/psargs.c @@ -79,7 +79,7 @@ acpi_ps_get_next_package_length(struct acpi_parse_state *parser_state) acpi_native_uint byte_count; u8 byte_zero_mask = 0x3F; /* Default [0:5] */ - ACPI_FUNCTION_TRACE(ps_get_next_package_length); + ACPI_FUNCTION_TRACE("ps_get_next_package_length"); /* * Byte 0 bits [6:7] contain the number of additional bytes @@ -128,7 +128,7 @@ u8 *acpi_ps_get_next_package_end(struct acpi_parse_state *parser_state) u8 *start = parser_state->aml; u32 package_length; - ACPI_FUNCTION_TRACE(ps_get_next_package_end); + ACPI_FUNCTION_TRACE("ps_get_next_package_end"); /* Function below updates parser_state->Aml */ @@ -157,7 +157,7 @@ char *acpi_ps_get_next_namestring(struct acpi_parse_state *parser_state) u8 *start = parser_state->aml; u8 *end = parser_state->aml; - ACPI_FUNCTION_TRACE(ps_get_next_namestring); + ACPI_FUNCTION_TRACE("ps_get_next_namestring"); /* Point past any namestring prefix characters (backslash or carat) */ @@ -237,7 +237,7 @@ acpi_ps_get_next_namepath(struct acpi_walk_state *walk_state, struct acpi_namespace_node *node; union acpi_generic_state scope_info; - ACPI_FUNCTION_TRACE(ps_get_next_namepath); + ACPI_FUNCTION_TRACE("ps_get_next_namepath"); path = acpi_ps_get_next_namestring(parser_state); acpi_ps_init_op(arg, AML_INT_NAMEPATH_OP); @@ -275,7 +275,6 @@ acpi_ps_get_next_namepath(struct acpi_walk_state *walk_state, */ if (ACPI_SUCCESS(status) && possible_method_call && (node->type == ACPI_TYPE_METHOD)) { - /* This name is actually a control method invocation */ method_desc = acpi_ns_get_attached_object(node); @@ -320,7 +319,6 @@ acpi_ps_get_next_namepath(struct acpi_walk_state *walk_state, * some not_found cases are allowed */ if (status == AE_NOT_FOUND) { - /* 1) not_found is ok during load pass 1/2 (allow forward references) */ if ((walk_state->parse_flags & ACPI_PARSE_MODE_MASK) != @@ -356,7 +354,6 @@ acpi_ps_get_next_namepath(struct acpi_walk_state *walk_state, if ((walk_state->parse_flags & ACPI_PARSE_MODE_MASK) == ACPI_PARSE_EXECUTE) { - /* Report a control method execution error */ status = acpi_ds_method_error(status, walk_state); @@ -391,7 +388,7 @@ acpi_ps_get_next_simple_arg(struct acpi_parse_state *parser_state, u16 opcode; u8 *aml = parser_state->aml; - ACPI_FUNCTION_TRACE_U32(ps_get_next_simple_arg, arg_type); + ACPI_FUNCTION_TRACE_U32("ps_get_next_simple_arg", arg_type); switch (arg_type) { case ARGP_BYTEDATA: @@ -456,7 +453,7 @@ acpi_ps_get_next_simple_arg(struct acpi_parse_state *parser_state, default: - ACPI_ERROR((AE_INFO, "Invalid ArgType %X", arg_type)); + ACPI_ERROR((AE_INFO, "Invalid arg_type %X", arg_type)); return_VOID; } @@ -487,7 +484,7 @@ static union acpi_parse_object *acpi_ps_get_next_field(struct acpi_parse_state u16 opcode; u32 name; - ACPI_FUNCTION_TRACE(ps_get_next_field); + ACPI_FUNCTION_TRACE("ps_get_next_field"); /* Determine field type */ @@ -593,7 +590,7 @@ acpi_ps_get_next_arg(struct acpi_walk_state *walk_state, u32 subop; acpi_status status = AE_OK; - ACPI_FUNCTION_TRACE_PTR(ps_get_next_arg, parser_state); + ACPI_FUNCTION_TRACE_PTR("ps_get_next_arg", parser_state); switch (arg_type) { case ARGP_BYTEDATA: @@ -623,7 +620,6 @@ acpi_ps_get_next_arg(struct acpi_walk_state *walk_state, case ARGP_FIELDLIST: if (parser_state->aml < parser_state->pkg_end) { - /* Non-empty list */ while (parser_state->aml < parser_state->pkg_end) { @@ -649,7 +645,6 @@ acpi_ps_get_next_arg(struct acpi_walk_state *walk_state, case ARGP_BYTELIST: if (parser_state->aml < parser_state->pkg_end) { - /* Non-empty list */ arg = acpi_ps_alloc_op(AML_INT_BYTELIST_OP); @@ -678,7 +673,6 @@ acpi_ps_get_next_arg(struct acpi_walk_state *walk_state, if (subop == 0 || acpi_ps_is_leading_char(subop) || acpi_ps_is_prefix_char(subop)) { - /* null_name or name_string */ arg = acpi_ps_alloc_op(AML_INT_NAMEPATH_OP); @@ -709,7 +703,6 @@ acpi_ps_get_next_arg(struct acpi_walk_state *walk_state, case ARGP_OBJLIST: if (parser_state->aml < parser_state->pkg_end) { - /* Non-empty list of variable arguments, nothing returned */ walk_state->arg_count = ACPI_VAR_ARGS; @@ -718,7 +711,7 @@ acpi_ps_get_next_arg(struct acpi_walk_state *walk_state, default: - ACPI_ERROR((AE_INFO, "Invalid ArgType: %X", arg_type)); + ACPI_ERROR((AE_INFO, "Invalid arg_type: %X", arg_type)); status = AE_AML_OPERAND_TYPE; break; } diff --git a/trunk/drivers/acpi/parser/psloop.c b/trunk/drivers/acpi/parser/psloop.c index e1541db3753a..00b072e15d19 100644 --- a/trunk/drivers/acpi/parser/psloop.c +++ b/trunk/drivers/acpi/parser/psloop.c @@ -83,7 +83,7 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state) struct acpi_parse_state *parser_state; u8 *aml_op_start = NULL; - ACPI_FUNCTION_TRACE_PTR(ps_parse_loop, walk_state); + ACPI_FUNCTION_TRACE_PTR("ps_parse_loop", walk_state); if (walk_state->descending_callback == NULL) { return_ACPI_STATUS(AE_BAD_PARAMETER); @@ -95,7 +95,6 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state) #if (!defined (ACPI_NO_METHOD_EXECUTION) && !defined (ACPI_CONSTANT_EVAL_ONLY)) if (walk_state->walk_type & ACPI_WALK_METHOD_RESTART) { - /* We are restarting a preempted control method */ if (acpi_ps_has_completed_scope(parser_state)) { @@ -129,7 +128,7 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state) } ACPI_EXCEPTION((AE_INFO, status, - "GetPredicate Failed")); + "get_predicate Failed")); return_ACPI_STATUS(status); } @@ -144,7 +143,6 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state) ACPI_DEBUG_PRINT((ACPI_DB_PARSE, "Popped scope, Op=%p\n", op)); } else if (walk_state->prev_op) { - /* We were in the middle of an op */ op = walk_state->prev_op; @@ -158,7 +156,6 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state) while ((parser_state->aml < parser_state->aml_end) || (op)) { aml_op_start = parser_state->aml; if (!op) { - /* Get the next opcode from the AML stream */ walk_state->aml_offset = @@ -216,7 +213,6 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state) /* Create Op structure and append to parent's argument list */ if (walk_state->op_info->flags & AML_NAMED) { - /* Allocate a new pre_op if necessary */ if (!pre_op) { @@ -375,7 +371,7 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state) if (walk_state->op_info) { ACPI_DEBUG_PRINT((ACPI_DB_PARSE, - "Opcode %4.4X [%s] Op %p Aml %p AmlOffset %5.5X\n", + "Opcode %4.4X [%s] Op %p Aml %p aml_offset %5.5X\n", (u32) op->common.aml_opcode, walk_state->op_info->name, op, parser_state->aml, @@ -392,7 +388,6 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state) /* Are there any arguments that must be processed? */ if (walk_state->arg_types) { - /* Get arguments */ switch (op->common.aml_opcode) { @@ -747,19 +742,7 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state) if (ACPI_FAILURE(status2)) { return_ACPI_STATUS(status2); } - - status2 = - acpi_ds_result_stack_pop - (walk_state); - if (ACPI_FAILURE(status2)) { - return_ACPI_STATUS(status2); - } - - acpi_ut_delete_generic_state - (acpi_ut_pop_generic_state - (&walk_state->control_state)); } - acpi_ps_pop_scope(parser_state, &op, &walk_state->arg_types, &walk_state->arg_count); @@ -779,7 +762,6 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state) return_ACPI_STATUS(status2); } } - acpi_ps_pop_scope(parser_state, &op, &walk_state->arg_types, &walk_state->arg_count); @@ -871,7 +853,6 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state) } else if (ACPI_FAILURE(status)) { - /* First error is most important */ (void) diff --git a/trunk/drivers/acpi/parser/psopcode.c b/trunk/drivers/acpi/parser/psopcode.c index 4bd25e32769f..11d6351ab8b2 100644 --- a/trunk/drivers/acpi/parser/psopcode.c +++ b/trunk/drivers/acpi/parser/psopcode.c @@ -725,13 +725,12 @@ static const u8 acpi_gbl_long_op_index[NUM_EXTENDED_OPCODE] = { const struct acpi_opcode_info *acpi_ps_get_opcode_info(u16 opcode) { - ACPI_FUNCTION_NAME(ps_get_opcode_info); + ACPI_FUNCTION_NAME("ps_get_opcode_info"); /* * Detect normal 8-bit opcode or extended 16-bit opcode */ if (!(opcode & 0xFF00)) { - /* Simple (8-bit) opcode: 0-255, can't index beyond table */ return (&acpi_gbl_aml_op_info @@ -740,7 +739,6 @@ const struct acpi_opcode_info *acpi_ps_get_opcode_info(u16 opcode) if (((opcode & 0xFF00) == AML_EXTENDED_OPCODE) && (((u8) opcode) <= MAX_EXTENDED_OPCODE)) { - /* Valid extended (16-bit) opcode */ return (&acpi_gbl_aml_op_info @@ -781,7 +779,7 @@ char *acpi_ps_get_opcode_name(u16 opcode) return (op->name); #else - return ("OpcodeName unavailable"); + return ("AE_NOT_CONFIGURED"); #endif } diff --git a/trunk/drivers/acpi/parser/psparse.c b/trunk/drivers/acpi/parser/psparse.c index 7ee2f2e77525..a9f3229f4106 100644 --- a/trunk/drivers/acpi/parser/psparse.c +++ b/trunk/drivers/acpi/parser/psparse.c @@ -106,7 +106,6 @@ u16 acpi_ps_peek_opcode(struct acpi_parse_state * parser_state) opcode = (u16) ACPI_GET8(aml); if (opcode == AML_EXTENDED_OP_PREFIX) { - /* Extended opcode, get the second opcode byte */ aml++; @@ -138,7 +137,7 @@ acpi_ps_complete_this_op(struct acpi_walk_state * walk_state, const struct acpi_opcode_info *parent_info; union acpi_parse_object *replacement_op = NULL; - ACPI_FUNCTION_TRACE_PTR(ps_complete_this_op, op); + ACPI_FUNCTION_TRACE_PTR("ps_complete_this_op", op); /* Check for null Op, can happen if AML code is corrupt */ @@ -159,7 +158,6 @@ acpi_ps_complete_this_op(struct acpi_walk_state * walk_state, if (op->common.parent) { prev = op->common.parent->common.value.arg; if (!prev) { - /* Nothing more to do */ goto cleanup; @@ -247,7 +245,6 @@ acpi_ps_complete_this_op(struct acpi_walk_state * walk_state, /* We must unlink this op from the parent tree */ if (prev == op) { - /* This op is the first in the list */ if (replacement_op) { @@ -268,7 +265,6 @@ acpi_ps_complete_this_op(struct acpi_walk_state * walk_state, else while (prev) { - /* Traverse all siblings in the parent's argument list */ next = prev->common.next; @@ -333,7 +329,7 @@ acpi_ps_next_parse_state(struct acpi_walk_state *walk_state, struct acpi_parse_state *parser_state = &walk_state->parser_state; acpi_status status = AE_CTRL_PENDING; - ACPI_FUNCTION_TRACE_PTR(ps_next_parse_state, op); + ACPI_FUNCTION_TRACE_PTR("ps_next_parse_state", op); switch (callback_status) { case AE_CTRL_TERMINATE: @@ -453,10 +449,10 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state) struct acpi_thread_state *prev_walk_list = acpi_gbl_current_walk_list; struct acpi_walk_state *previous_walk_state; - ACPI_FUNCTION_TRACE(ps_parse_aml); + ACPI_FUNCTION_TRACE("ps_parse_aml"); ACPI_DEBUG_PRINT((ACPI_DB_PARSE, - "Entered with WalkState=%p Aml=%p size=%X\n", + "Entered with walk_state=%p Aml=%p size=%X\n", walk_state, walk_state->parser_state.aml, walk_state->parser_state.aml_size)); @@ -464,7 +460,6 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state) thread = acpi_ut_create_thread_state(); if (!thread) { - acpi_ds_delete_walk_state(walk_state); return_ACPI_STATUS(AE_NO_MEMORY); } @@ -515,7 +510,6 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state) } else if (status == AE_CTRL_TERMINATE) { status = AE_OK; } else if ((status != AE_OK) && (walk_state->method_desc)) { - /* Either the method parse or actual execution failed */ ACPI_ERROR_METHOD("Method parse/execution failed", @@ -556,9 +550,20 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state) */ if (((walk_state->parse_flags & ACPI_PARSE_MODE_MASK) == ACPI_PARSE_EXECUTE) || (ACPI_FAILURE(status))) { - acpi_ds_terminate_control_method(walk_state-> - method_desc, - walk_state); + if (walk_state->method_desc) { + /* Decrement the thread count on the method parse tree */ + + if (walk_state->method_desc->method. + thread_count) { + walk_state->method_desc->method. + thread_count--; + } else { + ACPI_ERROR((AE_INFO, + "Invalid zero thread count in method")); + } + } + + acpi_ds_terminate_control_method(walk_state); } /* Delete this walk state and all linked control states */ @@ -567,7 +572,7 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state) previous_walk_state = walk_state; ACPI_DEBUG_PRINT((ACPI_DB_PARSE, - "ReturnValue=%p, ImplicitValue=%p State=%p\n", + "return_value=%p, implicit_value=%p State=%p\n", walk_state->return_desc, walk_state->implicit_return_obj, walk_state)); @@ -628,14 +633,12 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state) } } else { if (previous_walk_state->return_desc) { - /* Caller doesn't want it, must delete it */ acpi_ut_remove_reference(previous_walk_state-> return_desc); } if (previous_walk_state->implicit_return_obj) { - /* Caller doesn't want it, must delete it */ acpi_ut_remove_reference(previous_walk_state-> diff --git a/trunk/drivers/acpi/parser/psscope.c b/trunk/drivers/acpi/parser/psscope.c index a3e0314de24d..bc6047caccd9 100644 --- a/trunk/drivers/acpi/parser/psscope.c +++ b/trunk/drivers/acpi/parser/psscope.c @@ -106,14 +106,14 @@ acpi_ps_init_scope(struct acpi_parse_state * parser_state, { union acpi_generic_state *scope; - ACPI_FUNCTION_TRACE_PTR(ps_init_scope, root_op); + ACPI_FUNCTION_TRACE_PTR("ps_init_scope", root_op); scope = acpi_ut_create_generic_state(); if (!scope) { return_ACPI_STATUS(AE_NO_MEMORY); } - scope->common.descriptor_type = ACPI_DESC_TYPE_STATE_RPSCOPE; + scope->common.data_type = ACPI_DESC_TYPE_STATE_RPSCOPE; scope->parse_scope.op = root_op; scope->parse_scope.arg_count = ACPI_VAR_ARGS; scope->parse_scope.arg_end = parser_state->aml_end; @@ -147,14 +147,14 @@ acpi_ps_push_scope(struct acpi_parse_state *parser_state, { union acpi_generic_state *scope; - ACPI_FUNCTION_TRACE_PTR(ps_push_scope, op); + ACPI_FUNCTION_TRACE_PTR("ps_push_scope", op); scope = acpi_ut_create_generic_state(); if (!scope) { return_ACPI_STATUS(AE_NO_MEMORY); } - scope->common.descriptor_type = ACPI_DESC_TYPE_STATE_PSCOPE; + scope->common.data_type = ACPI_DESC_TYPE_STATE_PSCOPE; scope->parse_scope.op = op; scope->parse_scope.arg_list = remaining_args; scope->parse_scope.arg_count = arg_count; @@ -165,7 +165,6 @@ acpi_ps_push_scope(struct acpi_parse_state *parser_state, acpi_ut_push_generic_state(&parser_state->scope, scope); if (arg_count == ACPI_VAR_ARGS) { - /* Multiple arguments */ scope->parse_scope.arg_end = parser_state->pkg_end; @@ -200,14 +199,14 @@ acpi_ps_pop_scope(struct acpi_parse_state *parser_state, { union acpi_generic_state *scope = parser_state->scope; - ACPI_FUNCTION_TRACE(ps_pop_scope); + ACPI_FUNCTION_TRACE("ps_pop_scope"); /* Only pop the scope if there is in fact a next scope */ if (scope->common.next) { scope = acpi_ut_pop_generic_state(&parser_state->scope); - /* Return to parsing previous op */ + /* return to parsing previous op */ *op = scope->parse_scope.op; *arg_list = scope->parse_scope.arg_list; @@ -218,7 +217,7 @@ acpi_ps_pop_scope(struct acpi_parse_state *parser_state, acpi_ut_delete_generic_state(scope); } else { - /* Empty parse stack, prepare to fetch next opcode */ + /* empty parse stack, prepare to fetch next opcode */ *op = NULL; *arg_list = 0; @@ -247,7 +246,7 @@ void acpi_ps_cleanup_scope(struct acpi_parse_state *parser_state) { union acpi_generic_state *scope; - ACPI_FUNCTION_TRACE_PTR(ps_cleanup_scope, parser_state); + ACPI_FUNCTION_TRACE_PTR("ps_cleanup_scope", parser_state); if (!parser_state) { return_VOID; diff --git a/trunk/drivers/acpi/parser/pstree.c b/trunk/drivers/acpi/parser/pstree.c index 0015717ef096..dd6f16726fc4 100644 --- a/trunk/drivers/acpi/parser/pstree.c +++ b/trunk/drivers/acpi/parser/pstree.c @@ -77,7 +77,6 @@ union acpi_parse_object *acpi_ps_get_arg(union acpi_parse_object *op, u32 argn) op_info = acpi_ps_get_opcode_info(op->common.aml_opcode); if (op_info->class == AML_CLASS_UNKNOWN) { - /* Invalid opcode or ASCII character */ return (NULL); @@ -86,7 +85,6 @@ union acpi_parse_object *acpi_ps_get_arg(union acpi_parse_object *op, u32 argn) /* Check if this opcode requires argument sub-objects */ if (!(op_info->flags & AML_HAS_ARGS)) { - /* Has no linked argument objects */ return (NULL); @@ -132,7 +130,6 @@ acpi_ps_append_arg(union acpi_parse_object *op, union acpi_parse_object *arg) op_info = acpi_ps_get_opcode_info(op->common.aml_opcode); if (op_info->class == AML_CLASS_UNKNOWN) { - /* Invalid opcode */ ACPI_ERROR((AE_INFO, "Invalid AML Opcode: 0x%2.2X", @@ -143,7 +140,6 @@ acpi_ps_append_arg(union acpi_parse_object *op, union acpi_parse_object *arg) /* Check if this opcode requires argument sub-objects */ if (!(op_info->flags & AML_HAS_ARGS)) { - /* Has no linked argument objects */ return; @@ -152,7 +148,6 @@ acpi_ps_append_arg(union acpi_parse_object *op, union acpi_parse_object *arg) /* Append the argument to the linked argument list */ if (op->common.value.arg) { - /* Append to existing argument list */ prev_arg = op->common.value.arg; @@ -227,14 +222,12 @@ union acpi_parse_object *acpi_ps_get_depth_next(union acpi_parse_object *origin, } if (arg == origin) { - /* Reached parent of origin, end search */ return (NULL); } if (parent->common.next) { - /* Found sibling of parent */ return (parent->common.next); @@ -306,4 +299,5 @@ union acpi_parse_object *acpi_ps_get_child(union acpi_parse_object *op) return (child); } #endif + #endif /* ACPI_FUTURE_USAGE */ diff --git a/trunk/drivers/acpi/parser/psutils.c b/trunk/drivers/acpi/parser/psutils.c index 182474ae8ce9..3e07cb9cb748 100644 --- a/trunk/drivers/acpi/parser/psutils.c +++ b/trunk/drivers/acpi/parser/psutils.c @@ -89,7 +89,7 @@ void acpi_ps_init_op(union acpi_parse_object *op, u16 opcode) { ACPI_FUNCTION_ENTRY(); - op->common.descriptor_type = ACPI_DESC_TYPE_PARSER; + op->common.data_type = ACPI_DESC_TYPE_PARSER; op->common.aml_opcode = opcode; ACPI_DISASM_ONLY_MEMBERS(ACPI_STRNCPY(op->common.aml_op_name, @@ -135,7 +135,6 @@ union acpi_parse_object *acpi_ps_alloc_op(u16 opcode) /* Allocate the minimum required size object */ if (flags == ACPI_PARSEOP_GENERIC) { - /* The generic op (default) is by far the most common (16 to 1) */ op = acpi_os_acquire_object(acpi_gbl_ps_node_cache); @@ -172,7 +171,7 @@ union acpi_parse_object *acpi_ps_alloc_op(u16 opcode) void acpi_ps_free_op(union acpi_parse_object *op) { - ACPI_FUNCTION_NAME(ps_free_op); + ACPI_FUNCTION_NAME("ps_free_op"); if (op->common.aml_opcode == AML_INT_RETURN_VALUE_OP) { ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, "Free retval op: %p\n", diff --git a/trunk/drivers/acpi/parser/pswalk.c b/trunk/drivers/acpi/parser/pswalk.c index a84a547a0f1b..06f05bfd7612 100644 --- a/trunk/drivers/acpi/parser/pswalk.c +++ b/trunk/drivers/acpi/parser/pswalk.c @@ -64,21 +64,18 @@ void acpi_ps_delete_parse_tree(union acpi_parse_object *subtree_root) union acpi_parse_object *next = NULL; union acpi_parse_object *parent = NULL; - ACPI_FUNCTION_TRACE_PTR(ps_delete_parse_tree, subtree_root); + ACPI_FUNCTION_TRACE_PTR("ps_delete_parse_tree", subtree_root); /* Visit all nodes in the subtree */ while (op) { - /* Check if we are not ascending */ if (op != parent) { - /* Look for an argument or child of the current op */ next = acpi_ps_get_arg(op, 0); if (next) { - /* Still going downward in tree (Op is not completed yet) */ op = next; diff --git a/trunk/drivers/acpi/parser/psxface.c b/trunk/drivers/acpi/parser/psxface.c index 5d996c1140af..2dd48cbb7c02 100644 --- a/trunk/drivers/acpi/parser/psxface.c +++ b/trunk/drivers/acpi/parser/psxface.c @@ -50,14 +50,14 @@ ACPI_MODULE_NAME("psxface") /* Local Prototypes */ -static void acpi_ps_start_trace(struct acpi_evaluate_info *info); +static void acpi_ps_start_trace(struct acpi_parameter_info *info); -static void acpi_ps_stop_trace(struct acpi_evaluate_info *info); +static void acpi_ps_stop_trace(struct acpi_parameter_info *info); -static acpi_status acpi_ps_execute_pass(struct acpi_evaluate_info *info); +static acpi_status acpi_ps_execute_pass(struct acpi_parameter_info *info); static void -acpi_ps_update_parameter_list(struct acpi_evaluate_info *info, u16 action); +acpi_ps_update_parameter_list(struct acpi_parameter_info *info, u16 action); /******************************************************************************* * @@ -113,7 +113,7 @@ acpi_debug_trace(char *name, u32 debug_level, u32 debug_layer, u32 flags) * ******************************************************************************/ -static void acpi_ps_start_trace(struct acpi_evaluate_info *info) +static void acpi_ps_start_trace(struct acpi_parameter_info *info) { acpi_status status; @@ -125,7 +125,7 @@ static void acpi_ps_start_trace(struct acpi_evaluate_info *info) } if ((!acpi_gbl_trace_method_name) || - (acpi_gbl_trace_method_name != info->resolved_node->name.integer)) { + (acpi_gbl_trace_method_name != info->node->name.integer)) { goto exit; } @@ -158,7 +158,7 @@ static void acpi_ps_start_trace(struct acpi_evaluate_info *info) * ******************************************************************************/ -static void acpi_ps_stop_trace(struct acpi_evaluate_info *info) +static void acpi_ps_stop_trace(struct acpi_parameter_info *info) { acpi_status status; @@ -170,7 +170,7 @@ static void acpi_ps_stop_trace(struct acpi_evaluate_info *info) } if ((!acpi_gbl_trace_method_name) || - (acpi_gbl_trace_method_name != info->resolved_node->name.integer)) { + (acpi_gbl_trace_method_name != info->node->name.integer)) { goto exit; } @@ -212,23 +212,22 @@ static void acpi_ps_stop_trace(struct acpi_evaluate_info *info) * ******************************************************************************/ -acpi_status acpi_ps_execute_method(struct acpi_evaluate_info *info) +acpi_status acpi_ps_execute_method(struct acpi_parameter_info *info) { acpi_status status; - ACPI_FUNCTION_TRACE(ps_execute_method); + ACPI_FUNCTION_TRACE("ps_execute_method"); /* Validate the Info and method Node */ - if (!info || !info->resolved_node) { + if (!info || !info->node) { return_ACPI_STATUS(AE_NULL_ENTRY); } /* Init for new method, wait on concurrency semaphore */ status = - acpi_ds_begin_method_execution(info->resolved_node, info->obj_desc, - NULL); + acpi_ds_begin_method_execution(info->node, info->obj_desc, NULL); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); } @@ -249,7 +248,7 @@ acpi_status acpi_ps_execute_method(struct acpi_evaluate_info *info) */ ACPI_DEBUG_PRINT((ACPI_DB_PARSE, "**** Begin Method Parse **** Entry=%p obj=%p\n", - info->resolved_node, info->obj_desc)); + info->node, info->obj_desc)); info->pass_number = 1; status = acpi_ps_execute_pass(info); @@ -262,7 +261,7 @@ acpi_status acpi_ps_execute_method(struct acpi_evaluate_info *info) */ ACPI_DEBUG_PRINT((ACPI_DB_PARSE, "**** Begin Method Execution **** Entry=%p obj=%p\n", - info->resolved_node, info->obj_desc)); + info->node, info->obj_desc)); info->pass_number = 3; status = acpi_ps_execute_pass(info); @@ -287,7 +286,8 @@ acpi_status acpi_ps_execute_method(struct acpi_evaluate_info *info) * a control exception code */ if (info->return_object) { - ACPI_DEBUG_PRINT((ACPI_DB_PARSE, "Method returned ObjDesc=%p\n", + ACPI_DEBUG_PRINT((ACPI_DB_PARSE, + "Method returned obj_desc=%p\n", info->return_object)); ACPI_DUMP_STACK_ENTRY(info->return_object); @@ -301,7 +301,7 @@ acpi_status acpi_ps_execute_method(struct acpi_evaluate_info *info) * * FUNCTION: acpi_ps_update_parameter_list * - * PARAMETERS: Info - See struct acpi_evaluate_info + * PARAMETERS: Info - See struct acpi_parameter_info * (Used: parameter_type and Parameters) * Action - Add or Remove reference * @@ -312,16 +312,14 @@ acpi_status acpi_ps_execute_method(struct acpi_evaluate_info *info) ******************************************************************************/ static void -acpi_ps_update_parameter_list(struct acpi_evaluate_info *info, u16 action) +acpi_ps_update_parameter_list(struct acpi_parameter_info *info, u16 action) { acpi_native_uint i; if ((info->parameter_type == ACPI_PARAM_ARGS) && (info->parameters)) { - /* Update reference count for each parameter */ for (i = 0; info->parameters[i]; i++) { - /* Ignore errors, just do them all */ (void)acpi_ut_update_object_reference(info-> @@ -335,7 +333,7 @@ acpi_ps_update_parameter_list(struct acpi_evaluate_info *info, u16 action) * * FUNCTION: acpi_ps_execute_pass * - * PARAMETERS: Info - See struct acpi_evaluate_info + * PARAMETERS: Info - See struct acpi_parameter_info * (Used: pass_number, Node, and obj_desc) * * RETURN: Status @@ -344,13 +342,13 @@ acpi_ps_update_parameter_list(struct acpi_evaluate_info *info, u16 action) * ******************************************************************************/ -static acpi_status acpi_ps_execute_pass(struct acpi_evaluate_info *info) +static acpi_status acpi_ps_execute_pass(struct acpi_parameter_info *info) { acpi_status status; union acpi_parse_object *op; struct acpi_walk_state *walk_state; - ACPI_FUNCTION_TRACE(ps_execute_pass); + ACPI_FUNCTION_TRACE("ps_execute_pass"); /* Create and init a Root Node */ @@ -369,7 +367,7 @@ static acpi_status acpi_ps_execute_pass(struct acpi_evaluate_info *info) goto cleanup; } - status = acpi_ds_init_aml_walk(walk_state, op, info->resolved_node, + status = acpi_ds_init_aml_walk(walk_state, op, info->node, info->obj_desc->method.aml_start, info->obj_desc->method.aml_length, info->pass_number == 1 ? NULL : info, diff --git a/trunk/drivers/acpi/pci_link.c b/trunk/drivers/acpi/pci_link.c index b55ad1add1b0..07bc6dfe662b 100644 --- a/trunk/drivers/acpi/pci_link.c +++ b/trunk/drivers/acpi/pci_link.c @@ -38,7 +38,6 @@ #include #include #include -#include #include #include @@ -92,7 +91,7 @@ static struct { int count; struct list_head entries; } acpi_link; -DEFINE_MUTEX(acpi_link_lock); +DECLARE_MUTEX(acpi_link_lock); /* -------------------------------------------------------------------------- PCI Link Device Management @@ -642,19 +641,19 @@ acpi_pci_link_allocate_irq(acpi_handle handle, return_VALUE(-1); } - mutex_lock(&acpi_link_lock); + down(&acpi_link_lock); if (acpi_pci_link_allocate(link)) { - mutex_unlock(&acpi_link_lock); + up(&acpi_link_lock); return_VALUE(-1); } if (!link->irq.active) { - mutex_unlock(&acpi_link_lock); + up(&acpi_link_lock); ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Link active IRQ is 0!\n")); return_VALUE(-1); } link->refcnt++; - mutex_unlock(&acpi_link_lock); + up(&acpi_link_lock); if (triggering) *triggering = link->irq.triggering; @@ -692,9 +691,9 @@ int acpi_pci_link_free_irq(acpi_handle handle) return_VALUE(-1); } - mutex_lock(&acpi_link_lock); + down(&acpi_link_lock); if (!link->irq.initialized) { - mutex_unlock(&acpi_link_lock); + up(&acpi_link_lock); ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Link isn't initialized\n")); return_VALUE(-1); } @@ -717,7 +716,7 @@ int acpi_pci_link_free_irq(acpi_handle handle) if (link->refcnt == 0) { acpi_ut_evaluate_object(link->handle, "_DIS", 0, NULL); } - mutex_unlock(&acpi_link_lock); + up(&acpi_link_lock); return_VALUE(link->irq.active); } @@ -748,7 +747,7 @@ static int acpi_pci_link_add(struct acpi_device *device) strcpy(acpi_device_class(device), ACPI_PCI_LINK_CLASS); acpi_driver_data(device) = link; - mutex_lock(&acpi_link_lock); + down(&acpi_link_lock); result = acpi_pci_link_get_possible(link); if (result) goto end; @@ -783,7 +782,7 @@ static int acpi_pci_link_add(struct acpi_device *device) end: /* disable all links -- to be activated on use */ acpi_ut_evaluate_object(link->handle, "_DIS", 0, NULL); - mutex_unlock(&acpi_link_lock); + up(&acpi_link_lock); if (result) kfree(link); @@ -838,9 +837,9 @@ static int acpi_pci_link_remove(struct acpi_device *device, int type) link = (struct acpi_pci_link *)acpi_driver_data(device); - mutex_lock(&acpi_link_lock); + down(&acpi_link_lock); list_del(&link->node); - mutex_unlock(&acpi_link_lock); + up(&acpi_link_lock); kfree(link); diff --git a/trunk/drivers/acpi/processor_core.c b/trunk/drivers/acpi/processor_core.c index a1b46fb41c80..713b763884a9 100644 --- a/trunk/drivers/acpi/processor_core.c +++ b/trunk/drivers/acpi/processor_core.c @@ -388,7 +388,7 @@ static int acpi_processor_remove_fs(struct acpi_device *device) /* Use the acpiid in MADT to map cpus in case of SMP */ #ifndef CONFIG_SMP -#define convert_acpiid_to_cpu(acpi_id) (-1) +#define convert_acpiid_to_cpu(acpi_id) (0xff) #else #ifdef CONFIG_IA64 @@ -401,7 +401,7 @@ static int acpi_processor_remove_fs(struct acpi_device *device) #define ARCH_BAD_APICID (0xff) #endif -static int convert_acpiid_to_cpu(u8 acpi_id) +static u8 convert_acpiid_to_cpu(u8 acpi_id) { u16 apic_id; int i; @@ -427,7 +427,7 @@ static int acpi_processor_get_info(struct acpi_processor *pr) acpi_status status = 0; union acpi_object object = { 0 }; struct acpi_buffer buffer = { sizeof(union acpi_object), &object }; - int cpu_index; + u8 cpu_index; static int cpu0_initialized; ACPI_FUNCTION_TRACE("acpi_processor_get_info"); @@ -473,7 +473,7 @@ static int acpi_processor_get_info(struct acpi_processor *pr) cpu_index = convert_acpiid_to_cpu(pr->acpi_id); /* Handle UP system running SMP kernel, with no LAPIC in MADT */ - if (!cpu0_initialized && (cpu_index == -1) && + if (!cpu0_initialized && (cpu_index == 0xff) && (num_online_cpus() == 1)) { cpu_index = 0; } @@ -487,7 +487,7 @@ static int acpi_processor_get_info(struct acpi_processor *pr) * less than the max # of CPUs. They should be ignored _iff * they are physically not present. */ - if (cpu_index == -1) { + if (cpu_index >= NR_CPUS) { if (ACPI_FAILURE (acpi_processor_hotadd_init(pr->handle, &pr->id))) { ACPI_DEBUG_PRINT((ACPI_DB_ERROR, @@ -558,8 +558,8 @@ static int acpi_processor_start(struct acpi_device *device) */ if (processor_device_array[pr->id] != NULL && processor_device_array[pr->id] != (void *)device) { - printk(KERN_WARNING "BIOS reported wrong ACPI id" - "for the processor\n"); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "BIOS reporting wrong ACPI id" + "for the processor\n")); return_VALUE(-ENODEV); } processor_device_array[pr->id] = (void *)device; diff --git a/trunk/drivers/acpi/processor_idle.c b/trunk/drivers/acpi/processor_idle.c index 3b97a5eae9e8..80fa43471f48 100644 --- a/trunk/drivers/acpi/processor_idle.c +++ b/trunk/drivers/acpi/processor_idle.c @@ -54,10 +54,10 @@ ACPI_MODULE_NAME("acpi_processor") #define US_TO_PM_TIMER_TICKS(t) ((t * (PM_TIMER_FREQUENCY/1000)) / 1000) #define C2_OVERHEAD 4 /* 1us (3.579 ticks per us) */ #define C3_OVERHEAD 4 /* 1us (3.579 ticks per us) */ -static void (*pm_idle_save) (void) __read_mostly; +static void (*pm_idle_save) (void); module_param(max_cstate, uint, 0644); -static unsigned int nocst __read_mostly; +static unsigned int nocst = 0; module_param(nocst, uint, 0000); /* @@ -67,7 +67,7 @@ module_param(nocst, uint, 0000); * 100 HZ: 0x0000000F: 4 jiffies = 40ms * reduce history for more aggressive entry into C3 */ -static unsigned int bm_history __read_mostly = +static unsigned int bm_history = (HZ >= 800 ? 0xFFFFFFFF : ((1U << (HZ / 25)) - 1)); module_param(bm_history, uint, 0644); /* -------------------------------------------------------------------------- @@ -1081,7 +1081,7 @@ int acpi_processor_power_init(struct acpi_processor *pr, struct acpi_device *device) { acpi_status status = 0; - static int first_run; + static int first_run = 0; struct proc_dir_entry *entry = NULL; unsigned int i; diff --git a/trunk/drivers/acpi/processor_perflib.c b/trunk/drivers/acpi/processor_perflib.c index 44a7b168e0ec..abbdb37a7f5f 100644 --- a/trunk/drivers/acpi/processor_perflib.c +++ b/trunk/drivers/acpi/processor_perflib.c @@ -34,7 +34,6 @@ #ifdef CONFIG_X86_ACPI_CPUFREQ_PROC_INTF #include #include -#include #include #endif @@ -49,7 +48,7 @@ #define _COMPONENT ACPI_PROCESSOR_COMPONENT ACPI_MODULE_NAME("acpi_processor") -static DEFINE_MUTEX(performance_mutex); +static DECLARE_MUTEX(performance_sem); /* * _PPC support is implemented as a CPUfreq policy notifier: @@ -73,7 +72,7 @@ static int acpi_processor_ppc_notifier(struct notifier_block *nb, struct acpi_processor *pr; unsigned int ppc = 0; - mutex_lock(&performance_mutex); + down(&performance_sem); if (event != CPUFREQ_INCOMPATIBLE) goto out; @@ -94,7 +93,7 @@ static int acpi_processor_ppc_notifier(struct notifier_block *nb, core_frequency * 1000); out: - mutex_unlock(&performance_mutex); + up(&performance_sem); return 0; } @@ -565,32 +564,30 @@ acpi_processor_register_performance(struct acpi_processor_performance if (!(acpi_processor_ppc_status & PPC_REGISTERED)) return_VALUE(-EINVAL); - mutex_lock(&performance_mutex); + down(&performance_sem); pr = processors[cpu]; if (!pr) { - mutex_unlock(&performance_mutex); + up(&performance_sem); return_VALUE(-ENODEV); } if (pr->performance) { - mutex_unlock(&performance_mutex); + up(&performance_sem); return_VALUE(-EBUSY); } - WARN_ON(!performance); - pr->performance = performance; if (acpi_processor_get_performance_info(pr)) { pr->performance = NULL; - mutex_unlock(&performance_mutex); + up(&performance_sem); return_VALUE(-EIO); } acpi_cpufreq_add_file(pr); - mutex_unlock(&performance_mutex); + up(&performance_sem); return_VALUE(0); } @@ -604,21 +601,20 @@ acpi_processor_unregister_performance(struct acpi_processor_performance ACPI_FUNCTION_TRACE("acpi_processor_unregister_performance"); - mutex_lock(&performance_mutex); + down(&performance_sem); pr = processors[cpu]; if (!pr) { - mutex_unlock(&performance_mutex); + up(&performance_sem); return_VOID; } - if (pr->performance) - kfree(pr->performance->states); + kfree(pr->performance->states); pr->performance = NULL; acpi_cpufreq_remove_file(pr); - mutex_unlock(&performance_mutex); + up(&performance_sem); return_VOID; } diff --git a/trunk/drivers/acpi/resources/rscalc.c b/trunk/drivers/acpi/resources/rscalc.c index cf87b0230026..4038dbfa63a0 100644 --- a/trunk/drivers/acpi/resources/rscalc.c +++ b/trunk/drivers/acpi/resources/rscalc.c @@ -78,7 +78,6 @@ static u8 acpi_rs_count_set_bits(u16 bit_field) ACPI_FUNCTION_ENTRY(); for (bits_set = 0; bit_field; bits_set++) { - /* Zero the least significant bit that is set */ bit_field &= (bit_field - 1); @@ -155,18 +154,15 @@ acpi_rs_stream_option_length(u32 resource_length, * length, minus one byte for the resource_source_index itself. */ if (resource_length > minimum_aml_resource_length) { - /* Compute the length of the optional string */ string_length = resource_length - minimum_aml_resource_length - 1; } - /* - * Round the length up to a multiple of the native word in order to - * guarantee that the entire resource descriptor is native word aligned - */ - return ((u32) ACPI_ROUND_UP_TO_NATIVE_WORD(string_length)); + /* Round up length to 32 bits for internal structure alignment */ + + return (ACPI_ROUND_UP_to_32_bITS(string_length)); } /******************************************************************************* @@ -190,12 +186,11 @@ acpi_rs_get_aml_length(struct acpi_resource * resource, acpi_size * size_needed) acpi_size aml_size_needed = 0; acpi_rs_length total_size; - ACPI_FUNCTION_TRACE(rs_get_aml_length); + ACPI_FUNCTION_TRACE("rs_get_aml_length"); /* Traverse entire list of internal resource descriptors */ while (resource) { - /* Validate the descriptor type */ if (resource->type > ACPI_RESOURCE_TYPE_MAX) { @@ -219,7 +214,6 @@ acpi_rs_get_aml_length(struct acpi_resource * resource, acpi_size * size_needed) * is a Large Resource data type. */ if (resource->data.vendor.byte_length > 7) { - /* Base size of a Large resource descriptor */ total_size = @@ -338,22 +332,20 @@ acpi_rs_get_list_length(u8 * aml_buffer, acpi_status status; u8 *end_aml; u8 *buffer; - u32 buffer_size; + u32 buffer_size = 0; u16 temp16; u16 resource_length; u32 extra_struct_bytes; u8 resource_index; u8 minimum_aml_resource_length; - ACPI_FUNCTION_TRACE(rs_get_list_length); + ACPI_FUNCTION_TRACE("rs_get_list_length"); - *size_needed = 0; end_aml = aml_buffer + aml_buffer_length; /* Walk the list of AML resource descriptors */ while (aml_buffer < end_aml) { - /* Validate the Resource Type and Resource Length */ status = acpi_ut_validate_resource(aml_buffer, &resource_index); @@ -394,28 +386,35 @@ acpi_rs_get_list_length(u8 * aml_buffer, break; case ACPI_RESOURCE_NAME_VENDOR_SMALL: - case ACPI_RESOURCE_NAME_VENDOR_LARGE: /* * Vendor Resource: - * Get the number of vendor data bytes + * Ensure a 32-bit boundary for the structure */ - extra_struct_bytes = resource_length; + extra_struct_bytes = + ACPI_ROUND_UP_to_32_bITS(resource_length); break; case ACPI_RESOURCE_NAME_END_TAG: /* - * End Tag: - * This is the normal exit, add size of end_tag + * End Tag: This is the normal exit, add size of end_tag */ - *size_needed += ACPI_RS_SIZE_MIN; + *size_needed = buffer_size + ACPI_RS_SIZE_MIN; return_ACPI_STATUS(AE_OK); + case ACPI_RESOURCE_NAME_VENDOR_LARGE: + /* + * Vendor Resource: + * Add vendor data and ensure a 32-bit boundary for the structure + */ + extra_struct_bytes = + ACPI_ROUND_UP_to_32_bITS(resource_length); + break; + case ACPI_RESOURCE_NAME_ADDRESS32: case ACPI_RESOURCE_NAME_ADDRESS16: - case ACPI_RESOURCE_NAME_ADDRESS64: /* - * Address Resource: - * Add the size of the optional resource_source + * 32-Bit or 16-bit Address Resource: + * Add the size of any optional data (resource_source) */ extra_struct_bytes = acpi_rs_stream_option_length(resource_length, @@ -424,46 +423,50 @@ acpi_rs_get_list_length(u8 * aml_buffer, case ACPI_RESOURCE_NAME_EXTENDED_IRQ: /* - * Extended IRQ Resource: - * Using the interrupt_table_length, add 4 bytes for each additional - * interrupt. Note: at least one interrupt is required and is - * included in the minimum descriptor size (reason for the -1) + * Extended IRQ: + * Point past the interrupt_vector_flags to get the + * interrupt_table_length. */ - extra_struct_bytes = (buffer[1] - 1) * sizeof(u32); - - /* Add the size of the optional resource_source */ + buffer++; - extra_struct_bytes += + extra_struct_bytes = + /* + * Add 4 bytes for each additional interrupt. Note: at + * least one interrupt is required and is included in + * the minimum descriptor size + */ + ((*buffer - 1) * sizeof(u32)) + + /* Add the size of any optional data (resource_source) */ acpi_rs_stream_option_length(resource_length - extra_struct_bytes, minimum_aml_resource_length); break; + case ACPI_RESOURCE_NAME_ADDRESS64: + /* + * 64-Bit Address Resource: + * Add the size of any optional data (resource_source) + * Ensure a 64-bit boundary for the structure + */ + extra_struct_bytes = + ACPI_ROUND_UP_to_64_bITS + (acpi_rs_stream_option_length + (resource_length, minimum_aml_resource_length)); + break; + default: break; } - /* - * Update the required buffer size for the internal descriptor structs - * - * Important: Round the size up for the appropriate alignment. This - * is a requirement on IA64. - */ - buffer_size = acpi_gbl_resource_struct_sizes[resource_index] + - extra_struct_bytes; - buffer_size = (u32) ACPI_ROUND_UP_TO_NATIVE_WORD(buffer_size); + /* Update the required buffer size for the internal descriptor structs */ - *size_needed += buffer_size; - - ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES, - "Type %.2X, AmlLength %.2X InternalLength %.2X\n", - acpi_ut_get_resource_type(aml_buffer), - acpi_ut_get_descriptor_length(aml_buffer), - buffer_size)); + temp16 = (u16) (acpi_gbl_resource_struct_sizes[resource_index] + + extra_struct_bytes); + buffer_size += (u32) ACPI_ROUND_UP_TO_NATIVE_WORD(temp16); /* - * Point to the next resource within the AML stream using the length - * contained in the resource descriptor header + * Point to the next resource within the stream + * using the size of the header plus the length contained in the header */ aml_buffer += acpi_ut_get_descriptor_length(aml_buffer); } @@ -503,7 +506,7 @@ acpi_rs_get_pci_routing_table_length(union acpi_operand_object *package_object, u8 name_found; u32 table_index; - ACPI_FUNCTION_TRACE(rs_get_pci_routing_table_length); + ACPI_FUNCTION_TRACE("rs_get_pci_routing_table_length"); number_of_elements = package_object->package.count; @@ -520,7 +523,6 @@ acpi_rs_get_pci_routing_table_length(union acpi_operand_object *package_object, top_object_list = package_object->package.elements; for (index = 0; index < number_of_elements; index++) { - /* Dereference the sub-package */ package_element = *top_object_list; @@ -579,7 +581,7 @@ acpi_rs_get_pci_routing_table_length(union acpi_operand_object *package_object, /* Round up the size since each element must be aligned */ - temp_size_needed = ACPI_ROUND_UP_TO_64BIT(temp_size_needed); + temp_size_needed = ACPI_ROUND_UP_to_64_bITS(temp_size_needed); /* Point to the next union acpi_operand_object */ @@ -587,7 +589,7 @@ acpi_rs_get_pci_routing_table_length(union acpi_operand_object *package_object, } /* - * Add an extra element to the end of the list, essentially a + * Adding an extra element to the end of the list, essentially a * NULL terminator */ *buffer_size_needed = diff --git a/trunk/drivers/acpi/resources/rscreate.c b/trunk/drivers/acpi/resources/rscreate.c index 008058acdd39..8c128dea3252 100644 --- a/trunk/drivers/acpi/resources/rscreate.c +++ b/trunk/drivers/acpi/resources/rscreate.c @@ -75,11 +75,10 @@ acpi_rs_create_resource_list(union acpi_operand_object *aml_buffer, u8 *aml_start; acpi_size list_size_needed = 0; u32 aml_buffer_length; - void *resource; - ACPI_FUNCTION_TRACE(rs_create_resource_list); + ACPI_FUNCTION_TRACE("rs_create_resource_list"); - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "AmlBuffer = %p\n", aml_buffer)); + ACPI_DEBUG_PRINT((ACPI_DB_INFO, "aml_buffer = %p\n", aml_buffer)); /* Params already validated, so we don't re-validate here */ @@ -93,7 +92,7 @@ acpi_rs_create_resource_list(union acpi_operand_object *aml_buffer, status = acpi_rs_get_list_length(aml_start, aml_buffer_length, &list_size_needed); - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Status=%X ListSizeNeeded=%X\n", + ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Status=%X list_size_needed=%X\n", status, (u32) list_size_needed)); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); @@ -108,15 +107,13 @@ acpi_rs_create_resource_list(union acpi_operand_object *aml_buffer, /* Do the conversion */ - resource = output_buffer->pointer; - status = acpi_ut_walk_aml_resources(aml_start, aml_buffer_length, - acpi_rs_convert_aml_to_resources, - &resource); + status = acpi_rs_convert_aml_to_resources(aml_start, aml_buffer_length, + output_buffer->pointer); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); } - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "OutputBuffer %p Length %X\n", + ACPI_DEBUG_PRINT((ACPI_DB_INFO, "output_buffer %p Length %X\n", output_buffer->pointer, (u32) output_buffer->length)); return_ACPI_STATUS(AE_OK); } @@ -158,7 +155,7 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, acpi_status status; struct acpi_buffer path_buffer; - ACPI_FUNCTION_TRACE(rs_create_pci_routing_table); + ACPI_FUNCTION_TRACE("rs_create_pci_routing_table"); /* Params already validated, so we don't re-validate here */ @@ -170,7 +167,7 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, return_ACPI_STATUS(status); } - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "BufferSizeNeeded = %X\n", + ACPI_DEBUG_PRINT((ACPI_DB_INFO, "buffer_size_needed = %X\n", (u32) buffer_size_needed)); /* Validate/Allocate/Clear caller buffer */ @@ -335,7 +332,7 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, /* Now align the current length */ user_prt->length = - (u32) ACPI_ROUND_UP_TO_64BIT(user_prt->length); + (u32) ACPI_ROUND_UP_to_64_bITS(user_prt->length); /* 4) Fourth subobject: Dereference the PRT.source_index */ @@ -344,7 +341,7 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, user_prt->source_index = (u32) obj_desc->integer.value; } else { ACPI_ERROR((AE_INFO, - "(PRT[%X].SourceIndex) Need Integer, found %s", + "(PRT[%X].source_index) Need Integer, found %s", index, acpi_ut_get_object_type_name(obj_desc))); return_ACPI_STATUS(AE_BAD_DATA); @@ -355,7 +352,7 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, top_object_list++; } - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "OutputBuffer %p Length %X\n", + ACPI_DEBUG_PRINT((ACPI_DB_INFO, "output_buffer %p Length %X\n", output_buffer->pointer, (u32) output_buffer->length)); return_ACPI_STATUS(AE_OK); } @@ -385,9 +382,9 @@ acpi_rs_create_aml_resources(struct acpi_resource *linked_list_buffer, acpi_status status; acpi_size aml_size_needed = 0; - ACPI_FUNCTION_TRACE(rs_create_aml_resources); + ACPI_FUNCTION_TRACE("rs_create_aml_resources"); - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "LinkedListBuffer = %p\n", + ACPI_DEBUG_PRINT((ACPI_DB_INFO, "linked_list_buffer = %p\n", linked_list_buffer)); /* @@ -398,7 +395,7 @@ acpi_rs_create_aml_resources(struct acpi_resource *linked_list_buffer, */ status = acpi_rs_get_aml_length(linked_list_buffer, &aml_size_needed); - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "AmlSizeNeeded=%X, %s\n", + ACPI_DEBUG_PRINT((ACPI_DB_INFO, "aml_size_needed=%X, %s\n", (u32) aml_size_needed, acpi_format_exception(status))); if (ACPI_FAILURE(status)) { @@ -422,7 +419,7 @@ acpi_rs_create_aml_resources(struct acpi_resource *linked_list_buffer, return_ACPI_STATUS(status); } - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "OutputBuffer %p Length %X\n", + ACPI_DEBUG_PRINT((ACPI_DB_INFO, "output_buffer %p Length %X\n", output_buffer->pointer, (u32) output_buffer->length)); return_ACPI_STATUS(AE_OK); } diff --git a/trunk/drivers/acpi/resources/rsdump.c b/trunk/drivers/acpi/resources/rsdump.c index 9c99a723a860..e7de061cf883 100644 --- a/trunk/drivers/acpi/resources/rsdump.c +++ b/trunk/drivers/acpi/resources/rsdump.c @@ -91,11 +91,11 @@ acpi_rs_dump_descriptor(void *resource, struct acpi_rsdump_info *table); struct acpi_rsdump_info acpi_rs_dump_irq[6] = { {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_irq), "IRQ", NULL}, {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(irq.triggering), "Triggering", - acpi_gbl_he_decode}, + acpi_gbl_HEdecode}, {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(irq.polarity), "Polarity", - acpi_gbl_ll_decode}, + acpi_gbl_LLdecode}, {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(irq.sharable), "Sharing", - acpi_gbl_shr_decode}, + acpi_gbl_SHRdecode}, {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(irq.interrupt_count), "Interrupt Count", NULL}, {ACPI_RSD_SHORTLIST, ACPI_RSD_OFFSET(irq.interrupts[0]), @@ -105,11 +105,11 @@ struct acpi_rsdump_info acpi_rs_dump_irq[6] = { struct acpi_rsdump_info acpi_rs_dump_dma[6] = { {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_dma), "DMA", NULL}, {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(dma.type), "Speed", - acpi_gbl_typ_decode}, + acpi_gbl_TYPdecode}, {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(dma.bus_master), "Mastering", - acpi_gbl_bm_decode}, + acpi_gbl_BMdecode}, {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(dma.transfer), "Transfer Type", - acpi_gbl_siz_decode}, + acpi_gbl_SIZdecode}, {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(dma.channel_count), "Channel Count", NULL}, {ACPI_RSD_SHORTLIST, ACPI_RSD_OFFSET(dma.channels[0]), "Channel List", @@ -158,7 +158,7 @@ struct acpi_rsdump_info acpi_rs_dump_vendor[3] = { }; struct acpi_rsdump_info acpi_rs_dump_end_tag[1] = { - {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_end_tag), "EndTag", + {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_end_tag), "end_tag", NULL} }; @@ -166,7 +166,7 @@ struct acpi_rsdump_info acpi_rs_dump_memory24[6] = { {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_memory24), "24-Bit Memory Range", NULL}, {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(memory24.write_protect), - "Write Protect", acpi_gbl_rw_decode}, + "Write Protect", acpi_gbl_RWdecode}, {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(memory24.minimum), "Address Minimum", NULL}, {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(memory24.maximum), "Address Maximum", @@ -181,7 +181,7 @@ struct acpi_rsdump_info acpi_rs_dump_memory32[6] = { {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_memory32), "32-Bit Memory Range", NULL}, {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(memory32.write_protect), - "Write Protect", acpi_gbl_rw_decode}, + "Write Protect", acpi_gbl_RWdecode}, {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(memory32.minimum), "Address Minimum", NULL}, {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(memory32.maximum), "Address Maximum", @@ -196,7 +196,7 @@ struct acpi_rsdump_info acpi_rs_dump_fixed_memory32[4] = { {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_fixed_memory32), "32-Bit Fixed Memory Range", NULL}, {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(fixed_memory32.write_protect), - "Write Protect", acpi_gbl_rw_decode}, + "Write Protect", acpi_gbl_RWdecode}, {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(fixed_memory32.address), "Address", NULL}, {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(fixed_memory32.address_length), @@ -278,11 +278,11 @@ struct acpi_rsdump_info acpi_rs_dump_ext_irq[8] = { {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(extended_irq.producer_consumer), "Type", acpi_gbl_consume_decode}, {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(extended_irq.triggering), - "Triggering", acpi_gbl_he_decode}, + "Triggering", acpi_gbl_HEdecode}, {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(extended_irq.polarity), "Polarity", - acpi_gbl_ll_decode}, + acpi_gbl_LLdecode}, {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(extended_irq.sharable), "Sharing", - acpi_gbl_shr_decode}, + acpi_gbl_SHRdecode}, {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET(extended_irq.resource_source), NULL, NULL}, {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(extended_irq.interrupt_count), @@ -314,7 +314,7 @@ static struct acpi_rsdump_info acpi_rs_dump_general_flags[5] = { {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.producer_consumer), "Consumer/Producer", acpi_gbl_consume_decode}, {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.decode), "Address Decode", - acpi_gbl_dec_decode}, + acpi_gbl_DECdecode}, {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.min_address_fixed), "Min Relocatability", acpi_gbl_min_decode}, {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.max_address_fixed), @@ -325,24 +325,24 @@ static struct acpi_rsdump_info acpi_rs_dump_memory_flags[5] = { {ACPI_RSD_LITERAL, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_memory_flags), "Resource Type", (void *)"Memory Range"}, {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.info.mem.write_protect), - "Write Protect", acpi_gbl_rw_decode}, + "Write Protect", acpi_gbl_RWdecode}, {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(address.info.mem.caching), - "Caching", acpi_gbl_mem_decode}, + "Caching", acpi_gbl_MEMdecode}, {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(address.info.mem.range_type), - "Range Type", acpi_gbl_mtp_decode}, + "Range Type", acpi_gbl_MTPdecode}, {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.info.mem.translation), - "Translation", acpi_gbl_ttp_decode} + "Translation", acpi_gbl_TTPdecode} }; static struct acpi_rsdump_info acpi_rs_dump_io_flags[4] = { {ACPI_RSD_LITERAL, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_io_flags), "Resource Type", (void *)"I/O Range"}, {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(address.info.io.range_type), - "Range Type", acpi_gbl_rng_decode}, + "Range Type", acpi_gbl_RNGdecode}, {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.info.io.translation), - "Translation", acpi_gbl_ttp_decode}, + "Translation", acpi_gbl_TTPdecode}, {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.info.io.translation_type), - "Translation Type", acpi_gbl_trs_decode} + "Translation Type", acpi_gbl_TRSdecode} }; /* diff --git a/trunk/drivers/acpi/resources/rsinfo.c b/trunk/drivers/acpi/resources/rsinfo.c index 9e7ae2f8a1d3..d9ae64b77bd9 100644 --- a/trunk/drivers/acpi/resources/rsinfo.c +++ b/trunk/drivers/acpi/resources/rsinfo.c @@ -141,7 +141,6 @@ struct acpi_rsdump_info *acpi_gbl_dump_resource_dispatch[] = { acpi_rs_dump_generic_reg, /* ACPI_RESOURCE_TYPE_GENERIC_REGISTER */ }; #endif - #endif /* ACPI_FUTURE_USAGE */ /* * Base sizes for external AML resource descriptors, indexed by internal type. diff --git a/trunk/drivers/acpi/resources/rslist.c b/trunk/drivers/acpi/resources/rslist.c index 29423ce030ca..1434e786477e 100644 --- a/trunk/drivers/acpi/resources/rslist.c +++ b/trunk/drivers/acpi/resources/rslist.c @@ -51,62 +51,76 @@ ACPI_MODULE_NAME("rslist") * * FUNCTION: acpi_rs_convert_aml_to_resources * - * PARAMETERS: acpi_walk_aml_callback - * resource_ptr - Pointer to the buffer that will - * contain the output structures + * PARAMETERS: Aml - Pointer to the resource byte stream + * aml_length - Length of Aml + * output_buffer - Pointer to the buffer that will + * contain the output structures * * RETURN: Status * - * DESCRIPTION: Convert an AML resource to an internal representation of the - * resource that is aligned and easier to access. + * DESCRIPTION: Takes the resource byte stream and parses it, creating a + * linked list of resources in the caller's output buffer * ******************************************************************************/ acpi_status -acpi_rs_convert_aml_to_resources(u8 * aml, - u32 length, - u32 offset, u8 resource_index, void **context) +acpi_rs_convert_aml_to_resources(u8 * aml, u32 aml_length, u8 * output_buffer) { - struct acpi_resource **resource_ptr = - ACPI_CAST_INDIRECT_PTR(struct acpi_resource, context); - struct acpi_resource *resource; + struct acpi_resource *resource = (void *)output_buffer; acpi_status status; + u8 resource_index; + u8 *end_aml; - ACPI_FUNCTION_TRACE(rs_convert_aml_to_resources); + ACPI_FUNCTION_TRACE("rs_convert_aml_to_resources"); - /* - * Check that the input buffer and all subsequent pointers into it - * are aligned on a native word boundary. Most important on IA64 - */ - resource = *resource_ptr; - if (ACPI_IS_MISALIGNED(resource)) { - ACPI_WARNING((AE_INFO, - "Misaligned resource pointer %p", resource)); - } + end_aml = aml + aml_length; - /* Convert the AML byte stream resource to a local resource struct */ - - status = - acpi_rs_convert_aml_to_resource(resource, - ACPI_CAST_PTR(union aml_resource, - aml), - acpi_gbl_get_resource_dispatch - [resource_index]); - if (ACPI_FAILURE(status)) { - ACPI_EXCEPTION((AE_INFO, status, - "Could not convert AML resource (Type %X)", - *aml)); - return_ACPI_STATUS(status); - } + /* Loop until end-of-buffer or an end_tag is found */ + + while (aml < end_aml) { + /* Validate the Resource Type and Resource Length */ + + status = acpi_ut_validate_resource(aml, &resource_index); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); + } + + /* Convert the AML byte stream resource to a local resource struct */ - ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES, - "Type %.2X, AmlLength %.2X InternalLength %.2X\n", - acpi_ut_get_resource_type(aml), length, - resource->length)); + status = + acpi_rs_convert_aml_to_resource(resource, + ACPI_CAST_PTR(union + aml_resource, + aml), + acpi_gbl_get_resource_dispatch + [resource_index]); + if (ACPI_FAILURE(status)) { + ACPI_EXCEPTION((AE_INFO, status, + "Could not convert AML resource (Type %X)", + *aml)); + return_ACPI_STATUS(status); + } - /* Point to the next structure in the output buffer */ + /* Normal exit on completion of an end_tag resource descriptor */ - *resource_ptr = ACPI_ADD_PTR(void, resource, resource->length); - return_ACPI_STATUS(AE_OK); + if (acpi_ut_get_resource_type(aml) == + ACPI_RESOURCE_NAME_END_TAG) { + return_ACPI_STATUS(AE_OK); + } + + /* Point to the next input AML resource */ + + aml += acpi_ut_get_descriptor_length(aml); + + /* Point to the next structure in the output buffer */ + + resource = + ACPI_ADD_PTR(struct acpi_resource, resource, + resource->length); + } + + /* Did not find an end_tag resource descriptor */ + + return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG); } /******************************************************************************* @@ -136,12 +150,11 @@ acpi_rs_convert_resources_to_aml(struct acpi_resource *resource, u8 *end_aml = output_buffer + aml_size_needed; acpi_status status; - ACPI_FUNCTION_TRACE(rs_convert_resources_to_aml); + ACPI_FUNCTION_TRACE("rs_convert_resources_to_aml"); /* Walk the resource descriptor list, convert each descriptor */ while (aml < end_aml) { - /* Validate the (internal) Resource Type */ if (resource->type > ACPI_RESOURCE_TYPE_MAX) { @@ -178,7 +191,6 @@ acpi_rs_convert_resources_to_aml(struct acpi_resource *resource, /* Check for end-of-list, normal exit */ if (resource->type == ACPI_RESOURCE_TYPE_END_TAG) { - /* An End Tag indicates the end of the input Resource Template */ return_ACPI_STATUS(AE_OK); diff --git a/trunk/drivers/acpi/resources/rsmisc.c b/trunk/drivers/acpi/resources/rsmisc.c index faf6e106b785..ed866cf1c6d2 100644 --- a/trunk/drivers/acpi/resources/rsmisc.c +++ b/trunk/drivers/acpi/resources/rsmisc.c @@ -81,10 +81,9 @@ acpi_rs_convert_aml_to_resource(struct acpi_resource *resource, u16 item_count = 0; u16 temp16 = 0; - ACPI_FUNCTION_TRACE(rs_convert_aml_to_resource); + ACPI_FUNCTION_TRACE("rs_get_resource"); if (((acpi_native_uint) resource) & 0x3) { - /* Each internal resource struct is expected to be 32-bit aligned */ ACPI_WARNING((AE_INFO, @@ -296,11 +295,9 @@ acpi_rs_convert_aml_to_resource(struct acpi_resource *resource, exit: if (!flags_mode) { + /* Round the resource struct length up to the next 32-bit boundary */ - /* Round the resource struct length up to the next boundary (32 or 64) */ - - resource->length = - (u32) ACPI_ROUND_UP_TO_NATIVE_WORD(resource->length); + resource->length = ACPI_ROUND_UP_to_32_bITS(resource->length); } return_ACPI_STATUS(AE_OK); } @@ -332,7 +329,7 @@ acpi_rs_convert_resource_to_aml(struct acpi_resource *resource, u16 temp16 = 0; u16 item_count = 0; - ACPI_FUNCTION_TRACE(rs_convert_resource_to_aml); + ACPI_FUNCTION_TRACE("rs_convert_resource_to_aml"); /* * First table entry must be ACPI_RSC_INITxxx and must contain the @@ -538,7 +535,6 @@ if (((aml->irq.flags & 0x09) == 0x00) || ((aml->irq.flags & 0x09) == 0x09)) { resource->data.extended_irq.interrupt_count = temp8; if (temp8 < 1) { - /* Must have at least one IRQ */ return_ACPI_STATUS(AE_AML_BAD_RESOURCE_LENGTH); diff --git a/trunk/drivers/acpi/resources/rsutils.c b/trunk/drivers/acpi/resources/rsutils.c index a9cbee8e8b44..25b5aedd6612 100644 --- a/trunk/drivers/acpi/resources/rsutils.c +++ b/trunk/drivers/acpi/resources/rsutils.c @@ -205,7 +205,6 @@ acpi_rs_set_resource_length(acpi_rsdesc_size total_length, /* Length is stored differently for large and small descriptors */ if (aml->small_header.descriptor_type & ACPI_RESOURCE_NAME_LARGE) { - /* Large descriptor -- bytes 1-2 contain the 16-bit length */ ACPI_MOVE_16_TO_16(&aml->large_header.resource_length, @@ -299,8 +298,7 @@ static u16 acpi_rs_strcpy(char *destination, char *source) * string_ptr - (optional) where to store the actual * resource_source string * - * RETURN: Length of the string plus NULL terminator, rounded up to native - * word boundary + * RETURN: Length of the string plus NULL terminator, rounded up to 32 bit * * DESCRIPTION: Copy the optional resource_source data from a raw AML descriptor * to an internal resource descriptor @@ -330,7 +328,6 @@ acpi_rs_get_resource_source(acpi_rs_length resource_length, * we add 1 to the minimum length. */ if (total_length > (acpi_rsdesc_size) (minimum_length + 1)) { - /* Get the resource_source_index */ resource_source->index = aml_resource_source[0]; @@ -347,26 +344,23 @@ acpi_rs_get_resource_source(acpi_rs_length resource_length, } /* - * In order for the Resource length to be a multiple of the native - * word, calculate the length of the string (+1 for NULL terminator) - * and expand to the next word multiple. + * In order for the struct_size to fall on a 32-bit boundary, calculate + * the length of the string (+1 for the NULL terminator) and expand the + * struct_size to the next 32-bit boundary. * * Zero the entire area of the buffer. */ total_length = - (u32) - ACPI_STRLEN(ACPI_CAST_PTR(char, &aml_resource_source[1])) + - 1; - total_length = (u32) ACPI_ROUND_UP_TO_NATIVE_WORD(total_length); - + ACPI_ROUND_UP_to_32_bITS(ACPI_STRLEN + ((char *)&aml_resource_source[1]) + + 1); ACPI_MEMSET(resource_source->string_ptr, 0, total_length); /* Copy the resource_source string to the destination */ resource_source->string_length = acpi_rs_strcpy(resource_source->string_ptr, - ACPI_CAST_PTR(char, - &aml_resource_source[1])); + (char *)&aml_resource_source[1]); return ((acpi_rs_length) total_length); } @@ -411,7 +405,6 @@ acpi_rs_set_resource_source(union aml_resource * aml, /* Non-zero string length indicates presence of a resource_source */ if (resource_source->string_length) { - /* Point to the end of the AML descriptor */ aml_resource_source = ACPI_ADD_PTR(u8, aml, minimum_length); @@ -422,7 +415,7 @@ acpi_rs_set_resource_source(union aml_resource * aml, /* Copy the resource_source string */ - ACPI_STRCPY(ACPI_CAST_PTR(char, &aml_resource_source[1]), + ACPI_STRCPY((char *)&aml_resource_source[1], resource_source->string_ptr); /* @@ -442,9 +435,9 @@ acpi_rs_set_resource_source(union aml_resource * aml, * * FUNCTION: acpi_rs_get_prt_method_data * - * PARAMETERS: Node - Device node - * ret_buffer - Pointer to a buffer structure for the - * results + * PARAMETERS: Handle - a handle to the containing object + * ret_buffer - a pointer to a buffer structure for the + * results * * RETURN: Status * @@ -457,19 +450,18 @@ acpi_rs_set_resource_source(union aml_resource * aml, ******************************************************************************/ acpi_status -acpi_rs_get_prt_method_data(struct acpi_namespace_node * node, - struct acpi_buffer * ret_buffer) +acpi_rs_get_prt_method_data(acpi_handle handle, struct acpi_buffer * ret_buffer) { union acpi_operand_object *obj_desc; acpi_status status; - ACPI_FUNCTION_TRACE(rs_get_prt_method_data); + ACPI_FUNCTION_TRACE("rs_get_prt_method_data"); /* Parameters guaranteed valid by caller */ /* Execute the method, no parameters */ - status = acpi_ut_evaluate_object(node, METHOD_NAME__PRT, + status = acpi_ut_evaluate_object(handle, METHOD_NAME__PRT, ACPI_BTYPE_PACKAGE, &obj_desc); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); @@ -491,9 +483,9 @@ acpi_rs_get_prt_method_data(struct acpi_namespace_node * node, * * FUNCTION: acpi_rs_get_crs_method_data * - * PARAMETERS: Node - Device node - * ret_buffer - Pointer to a buffer structure for the - * results + * PARAMETERS: Handle - a handle to the containing object + * ret_buffer - a pointer to a buffer structure for the + * results * * RETURN: Status * @@ -506,19 +498,18 @@ acpi_rs_get_prt_method_data(struct acpi_namespace_node * node, ******************************************************************************/ acpi_status -acpi_rs_get_crs_method_data(struct acpi_namespace_node *node, - struct acpi_buffer *ret_buffer) +acpi_rs_get_crs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer) { union acpi_operand_object *obj_desc; acpi_status status; - ACPI_FUNCTION_TRACE(rs_get_crs_method_data); + ACPI_FUNCTION_TRACE("rs_get_crs_method_data"); /* Parameters guaranteed valid by caller */ /* Execute the method, no parameters */ - status = acpi_ut_evaluate_object(node, METHOD_NAME__CRS, + status = acpi_ut_evaluate_object(handle, METHOD_NAME__CRS, ACPI_BTYPE_BUFFER, &obj_desc); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); @@ -531,7 +522,7 @@ acpi_rs_get_crs_method_data(struct acpi_namespace_node *node, */ status = acpi_rs_create_resource_list(obj_desc, ret_buffer); - /* On exit, we must delete the object returned by evaluate_object */ + /* on exit, we must delete the object returned by evaluate_object */ acpi_ut_remove_reference(obj_desc); return_ACPI_STATUS(status); @@ -541,9 +532,9 @@ acpi_rs_get_crs_method_data(struct acpi_namespace_node *node, * * FUNCTION: acpi_rs_get_prs_method_data * - * PARAMETERS: Node - Device node - * ret_buffer - Pointer to a buffer structure for the - * results + * PARAMETERS: Handle - a handle to the containing object + * ret_buffer - a pointer to a buffer structure for the + * results * * RETURN: Status * @@ -557,19 +548,18 @@ acpi_rs_get_crs_method_data(struct acpi_namespace_node *node, #ifdef ACPI_FUTURE_USAGE acpi_status -acpi_rs_get_prs_method_data(struct acpi_namespace_node *node, - struct acpi_buffer *ret_buffer) +acpi_rs_get_prs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer) { union acpi_operand_object *obj_desc; acpi_status status; - ACPI_FUNCTION_TRACE(rs_get_prs_method_data); + ACPI_FUNCTION_TRACE("rs_get_prs_method_data"); /* Parameters guaranteed valid by caller */ /* Execute the method, no parameters */ - status = acpi_ut_evaluate_object(node, METHOD_NAME__PRS, + status = acpi_ut_evaluate_object(handle, METHOD_NAME__PRS, ACPI_BTYPE_BUFFER, &obj_desc); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); @@ -582,7 +572,7 @@ acpi_rs_get_prs_method_data(struct acpi_namespace_node *node, */ status = acpi_rs_create_resource_list(obj_desc, ret_buffer); - /* On exit, we must delete the object returned by evaluate_object */ + /* on exit, we must delete the object returned by evaluate_object */ acpi_ut_remove_reference(obj_desc); return_ACPI_STATUS(status); @@ -593,10 +583,10 @@ acpi_rs_get_prs_method_data(struct acpi_namespace_node *node, * * FUNCTION: acpi_rs_get_method_data * - * PARAMETERS: Handle - Handle to the containing object + * PARAMETERS: Handle - a handle to the containing object * Path - Path to method, relative to Handle - * ret_buffer - Pointer to a buffer structure for the - * results + * ret_buffer - a pointer to a buffer structure for the + * results * * RETURN: Status * @@ -615,7 +605,7 @@ acpi_rs_get_method_data(acpi_handle handle, union acpi_operand_object *obj_desc; acpi_status status; - ACPI_FUNCTION_TRACE(rs_get_method_data); + ACPI_FUNCTION_TRACE("rs_get_method_data"); /* Parameters guaranteed valid by caller */ @@ -644,9 +634,9 @@ acpi_rs_get_method_data(acpi_handle handle, * * FUNCTION: acpi_rs_set_srs_method_data * - * PARAMETERS: Node - Device node - * in_buffer - Pointer to a buffer structure of the - * parameter + * PARAMETERS: Handle - a handle to the containing object + * in_buffer - a pointer to a buffer structure of the + * parameter * * RETURN: Status * @@ -656,37 +646,23 @@ acpi_rs_get_method_data(acpi_handle handle, * If the function fails an appropriate status will be returned * and the contents of the callers buffer is undefined. * - * Note: Parameters guaranteed valid by caller - * ******************************************************************************/ acpi_status -acpi_rs_set_srs_method_data(struct acpi_namespace_node *node, - struct acpi_buffer *in_buffer) +acpi_rs_set_srs_method_data(acpi_handle handle, struct acpi_buffer *in_buffer) { - struct acpi_evaluate_info *info; - union acpi_operand_object *args[2]; + struct acpi_parameter_info info; + union acpi_operand_object *params[2]; acpi_status status; struct acpi_buffer buffer; - ACPI_FUNCTION_TRACE(rs_set_srs_method_data); - - /* Allocate and initialize the evaluation information block */ - - info = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_evaluate_info)); - if (!info) { - return_ACPI_STATUS(AE_NO_MEMORY); - } + ACPI_FUNCTION_TRACE("rs_set_srs_method_data"); - info->prefix_node = node; - info->pathname = METHOD_NAME__SRS; - info->parameters = args; - info->parameter_type = ACPI_PARAM_ARGS; - info->flags = ACPI_IGNORE_RETURN_VALUE; + /* Parameters guaranteed valid by caller */ /* * The in_buffer parameter will point to a linked list of - * resource parameters. It needs to be formatted into a + * resource parameters. It needs to be formatted into a * byte stream to be sent in as an input parameter to _SRS * * Convert the linked list into a byte stream @@ -694,36 +670,41 @@ acpi_rs_set_srs_method_data(struct acpi_namespace_node *node, buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER; status = acpi_rs_create_aml_resources(in_buffer->pointer, &buffer); if (ACPI_FAILURE(status)) { - goto cleanup; + return_ACPI_STATUS(status); } - /* Create and initialize the method parameter object */ + /* Init the param object */ - args[0] = acpi_ut_create_internal_object(ACPI_TYPE_BUFFER); - if (!args[0]) { - /* - * Must free the buffer allocated above (otherwise it is freed - * later) - */ - ACPI_FREE(buffer.pointer); - status = AE_NO_MEMORY; - goto cleanup; + params[0] = acpi_ut_create_internal_object(ACPI_TYPE_BUFFER); + if (!params[0]) { + acpi_os_free(buffer.pointer); + return_ACPI_STATUS(AE_NO_MEMORY); } - args[0]->buffer.length = (u32) buffer.length; - args[0]->buffer.pointer = buffer.pointer; - args[0]->common.flags = AOPOBJ_DATA_VALID; - args[1] = NULL; + /* Set up the parameter object */ + + params[0]->buffer.length = (u32) buffer.length; + params[0]->buffer.pointer = buffer.pointer; + params[0]->common.flags = AOPOBJ_DATA_VALID; + params[1] = NULL; + + info.node = handle; + info.parameters = params; + info.parameter_type = ACPI_PARAM_ARGS; - /* Execute the method, no return value is expected */ + /* Execute the method, no return value */ - status = acpi_ns_evaluate(info); + status = acpi_ns_evaluate_relative(METHOD_NAME__SRS, &info); + if (ACPI_SUCCESS(status)) { + /* Delete any return object (especially if implicit_return is enabled) */ - /* Clean up and return the status from acpi_ns_evaluate */ + if (info.return_object) { + acpi_ut_remove_reference(info.return_object); + } + } - acpi_ut_remove_reference(args[0]); + /* Clean up and return the status from acpi_ns_evaluate_relative */ - cleanup: - ACPI_FREE(info); + acpi_ut_remove_reference(params[0]); return_ACPI_STATUS(status); } diff --git a/trunk/drivers/acpi/resources/rsxface.c b/trunk/drivers/acpi/resources/rsxface.c index 1999e2ab7daa..88b67077aeeb 100644 --- a/trunk/drivers/acpi/resources/rsxface.c +++ b/trunk/drivers/acpi/resources/rsxface.c @@ -41,9 +41,10 @@ * POSSIBILITY OF SUCH DAMAGES. */ +#include + #include #include -#include #define _COMPONENT ACPI_RESOURCES ACPI_MODULE_NAME("rsxface") @@ -67,262 +68,312 @@ ACPI_MODULE_NAME("rsxface") static acpi_status acpi_rs_match_vendor_resource(struct acpi_resource *resource, void *context); -static acpi_status -acpi_rs_validate_parameters(acpi_handle device_handle, - struct acpi_buffer *buffer, - struct acpi_namespace_node **return_node); - /******************************************************************************* * - * FUNCTION: acpi_rs_validate_parameters + * FUNCTION: acpi_get_irq_routing_table * - * PARAMETERS: device_handle - Handle to a device - * Buffer - Pointer to a data buffer - * return_node - Pointer to where the device node is returned + * PARAMETERS: device_handle - a handle to the Bus device we are querying + * ret_buffer - a pointer to a buffer to receive the + * current resources for the device * * RETURN: Status * - * DESCRIPTION: Common parameter validation for resource interfaces + * 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 ret_buffer variable parameter. + * + * If the function fails an appropriate status will be returned + * 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. * ******************************************************************************/ -static acpi_status -acpi_rs_validate_parameters(acpi_handle device_handle, - struct acpi_buffer *buffer, - struct acpi_namespace_node **return_node) +acpi_status +acpi_get_irq_routing_table(acpi_handle device_handle, + struct acpi_buffer *ret_buffer) { acpi_status status; - struct acpi_namespace_node *node; - ACPI_FUNCTION_TRACE(rs_validate_parameters); + ACPI_FUNCTION_TRACE("acpi_get_irq_routing_table "); /* - * Must have a valid handle to an ACPI device + * 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) { return_ACPI_STATUS(AE_BAD_PARAMETER); } - node = acpi_ns_map_handle_to_node(device_handle); - if (!node) { - return_ACPI_STATUS(AE_BAD_PARAMETER); - } - - if (node->type != ACPI_TYPE_DEVICE) { - return_ACPI_STATUS(AE_TYPE); - } - - /* - * Validate the user buffer object - * - * 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 (later), so keep going. - */ - status = acpi_ut_validate_buffer(buffer); + status = acpi_ut_validate_buffer(ret_buffer); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); } - *return_node = node; - return_ACPI_STATUS(AE_OK); + status = acpi_rs_get_prt_method_data(device_handle, ret_buffer); + return_ACPI_STATUS(status); } /******************************************************************************* * - * FUNCTION: acpi_get_irq_routing_table + * FUNCTION: acpi_get_current_resources * - * PARAMETERS: device_handle - Handle to the Bus device we are querying - * ret_buffer - Pointer to a buffer to receive the + * PARAMETERS: device_handle - a handle to the device object for the + * device we are querying + * ret_buffer - a pointer to a buffer to receive the * current resources for the device * * RETURN: Status * - * DESCRIPTION: This function is called to get the IRQ routing table for a - * specific bus. The caller must first acquire a handle for the - * desired bus. The routine table is placed in the buffer pointed - * to by the ret_buffer variable parameter. + * 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 ret_buffer variable parameter. * * If the function fails an appropriate status will be returned * and the value of ret_buffer is undefined. * - * This function attempts to execute the _PRT method contained in + * This function attempts to execute the _CRS method contained in * the object indicated by the passed device_handle. * ******************************************************************************/ acpi_status -acpi_get_irq_routing_table(acpi_handle device_handle, +acpi_get_current_resources(acpi_handle device_handle, struct acpi_buffer *ret_buffer) { acpi_status status; - struct acpi_namespace_node *node; - ACPI_FUNCTION_TRACE(acpi_get_irq_routing_table); + ACPI_FUNCTION_TRACE("acpi_get_current_resources"); - /* Validate parameters then dispatch to internal routine */ + /* + * 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) { + return_ACPI_STATUS(AE_BAD_PARAMETER); + } - status = acpi_rs_validate_parameters(device_handle, ret_buffer, &node); + status = acpi_ut_validate_buffer(ret_buffer); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); } - status = acpi_rs_get_prt_method_data(node, ret_buffer); + status = acpi_rs_get_crs_method_data(device_handle, ret_buffer); return_ACPI_STATUS(status); } -ACPI_EXPORT_SYMBOL(acpi_get_irq_routing_table) +EXPORT_SYMBOL(acpi_get_current_resources); /******************************************************************************* * - * FUNCTION: acpi_get_current_resources + * FUNCTION: acpi_get_possible_resources * - * PARAMETERS: device_handle - Handle to the device object for the + * PARAMETERS: device_handle - a handle to the device object for the * device we are querying - * ret_buffer - Pointer to a buffer to receive the - * current resources for the device + * ret_buffer - a pointer to a buffer to receive the + * resources for the device * * RETURN: Status * - * 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 ret_buffer variable parameter. + * 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 ret_buffer variable. * * If the function fails an appropriate status will be returned * 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. - * ******************************************************************************/ + +#ifdef ACPI_FUTURE_USAGE acpi_status -acpi_get_current_resources(acpi_handle device_handle, - struct acpi_buffer *ret_buffer) +acpi_get_possible_resources(acpi_handle device_handle, + struct acpi_buffer *ret_buffer) { acpi_status status; - struct acpi_namespace_node *node; - ACPI_FUNCTION_TRACE(acpi_get_current_resources); + ACPI_FUNCTION_TRACE("acpi_get_possible_resources"); - /* Validate parameters then dispatch to internal routine */ + /* + * 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) { + return_ACPI_STATUS(AE_BAD_PARAMETER); + } - status = acpi_rs_validate_parameters(device_handle, ret_buffer, &node); + status = acpi_ut_validate_buffer(ret_buffer); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); } - status = acpi_rs_get_crs_method_data(node, ret_buffer); + status = acpi_rs_get_prs_method_data(device_handle, ret_buffer); return_ACPI_STATUS(status); } -ACPI_EXPORT_SYMBOL(acpi_get_current_resources) +EXPORT_SYMBOL(acpi_get_possible_resources); +#endif /* ACPI_FUTURE_USAGE */ -#ifdef ACPI_FUTURE_USAGE /******************************************************************************* * - * FUNCTION: acpi_get_possible_resources + * FUNCTION: acpi_walk_resources * * PARAMETERS: device_handle - Handle to the device object for the * device we are querying - * ret_buffer - Pointer to a buffer to receive the - * resources for the device + * Name - Method name of the resources we want + * (METHOD_NAME__CRS or METHOD_NAME__PRS) + * user_function - Called for each resource + * Context - Passed to user_function * * RETURN: Status * - * DESCRIPTION: This function is called to get a list of the possible resources - * for a specific device. The caller must first acquire a handle - * for the desired device. The resource data is placed in the - * buffer pointed to by the ret_buffer variable. - * - * If the function fails an appropriate status will be returned - * and the value of ret_buffer is undefined. + * DESCRIPTION: Retrieves the current or possible resource list for the + * specified device. The user_function is called once for + * each resource in the list. * ******************************************************************************/ + acpi_status -acpi_get_possible_resources(acpi_handle device_handle, - struct acpi_buffer *ret_buffer) +acpi_walk_resources(acpi_handle device_handle, + char *name, + ACPI_WALK_RESOURCE_CALLBACK user_function, void *context) { acpi_status status; - struct acpi_namespace_node *node; + struct acpi_buffer buffer; + struct acpi_resource *resource; + struct acpi_resource *resource_end; + + ACPI_FUNCTION_TRACE("acpi_walk_resources"); + + /* Parameter validation */ - ACPI_FUNCTION_TRACE(acpi_get_possible_resources); + if (!device_handle || !user_function || !name || + (ACPI_STRNCMP(name, METHOD_NAME__CRS, sizeof(METHOD_NAME__CRS)) && + ACPI_STRNCMP(name, METHOD_NAME__PRS, sizeof(METHOD_NAME__PRS)))) { + return_ACPI_STATUS(AE_BAD_PARAMETER); + } - /* Validate parameters then dispatch to internal routine */ + /* Get the _CRS or _PRS resource list */ - status = acpi_rs_validate_parameters(device_handle, ret_buffer, &node); + buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER; + status = acpi_rs_get_method_data(device_handle, name, &buffer); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); } - status = acpi_rs_get_prs_method_data(node, ret_buffer); + /* Buffer now contains the resource list */ + + resource = ACPI_CAST_PTR(struct acpi_resource, buffer.pointer); + resource_end = + ACPI_ADD_PTR(struct acpi_resource, buffer.pointer, buffer.length); + + /* Walk the resource list until the end_tag is found (or buffer end) */ + + while (resource < resource_end) { + /* Sanity check the resource */ + + if (resource->type > ACPI_RESOURCE_TYPE_MAX) { + status = AE_AML_INVALID_RESOURCE_TYPE; + break; + } + + /* Invoke the user function, abort on any error returned */ + + status = user_function(resource, context); + if (ACPI_FAILURE(status)) { + if (status == AE_CTRL_TERMINATE) { + /* This is an OK termination by the user function */ + + status = AE_OK; + } + break; + } + + /* end_tag indicates end-of-list */ + + if (resource->type == ACPI_RESOURCE_TYPE_END_TAG) { + break; + } + + /* Get the next resource descriptor */ + + resource = + ACPI_ADD_PTR(struct acpi_resource, resource, + resource->length); + } + + ACPI_MEM_FREE(buffer.pointer); return_ACPI_STATUS(status); } -ACPI_EXPORT_SYMBOL(acpi_get_possible_resources) -#endif /* ACPI_FUTURE_USAGE */ +EXPORT_SYMBOL(acpi_walk_resources); /******************************************************************************* * * FUNCTION: acpi_set_current_resources * - * PARAMETERS: device_handle - Handle to the device object for the - * device we are setting resources - * in_buffer - Pointer to a buffer containing the + * PARAMETERS: device_handle - a handle to the device object for the + * device we are changing the resources of + * in_buffer - a pointer to a buffer containing the * resources to be set for the device * * RETURN: Status * * DESCRIPTION: This function is called to set the current resources for a - * specific device. The caller must first acquire a handle for - * the desired device. The resource data is passed to the routine + * specific device. The caller must first acquire a handle for + * the desired device. The resource data is passed to the routine * the buffer pointed to by the in_buffer variable. * ******************************************************************************/ + acpi_status acpi_set_current_resources(acpi_handle device_handle, struct acpi_buffer *in_buffer) { acpi_status status; - struct acpi_namespace_node *node; - ACPI_FUNCTION_TRACE(acpi_set_current_resources); + ACPI_FUNCTION_TRACE("acpi_set_current_resources"); - /* Validate the buffer, don't allow zero length */ + /* Must have a valid handle and buffer */ - if ((!in_buffer) || (!in_buffer->pointer) || (!in_buffer->length)) { + if ((!device_handle) || + (!in_buffer) || (!in_buffer->pointer) || (!in_buffer->length)) { return_ACPI_STATUS(AE_BAD_PARAMETER); } - /* Validate parameters then dispatch to internal routine */ - - status = acpi_rs_validate_parameters(device_handle, in_buffer, &node); - if (ACPI_FAILURE(status)) { - return_ACPI_STATUS(status); - } - - status = acpi_rs_set_srs_method_data(node, in_buffer); + status = acpi_rs_set_srs_method_data(device_handle, in_buffer); return_ACPI_STATUS(status); } -ACPI_EXPORT_SYMBOL(acpi_set_current_resources) +EXPORT_SYMBOL(acpi_set_current_resources); /****************************************************************************** * * FUNCTION: acpi_resource_to_address64 * - * PARAMETERS: Resource - Pointer to a resource - * Out - Pointer to the users's return buffer - * (a struct acpi_resource_address64) + * PARAMETERS: Resource - Pointer to a resource + * Out - Pointer to the users's return + * buffer (a struct + * struct acpi_resource_address64) * * RETURN: Status * * DESCRIPTION: If the resource is an address16, address32, or address64, - * copy it to the address64 return buffer. This saves the + * copy it to the address64 return buffer. This saves the * caller from having to duplicate code for different-sized * addresses. * ******************************************************************************/ + acpi_status acpi_resource_to_address64(struct acpi_resource *resource, struct acpi_resource_address64 *out) @@ -364,18 +415,18 @@ acpi_resource_to_address64(struct acpi_resource *resource, return (AE_OK); } -ACPI_EXPORT_SYMBOL(acpi_resource_to_address64) +EXPORT_SYMBOL(acpi_resource_to_address64); /******************************************************************************* * * FUNCTION: acpi_get_vendor_resource * - * PARAMETERS: device_handle - Handle for the parent device object - * Name - Method name for the parent resource - * (METHOD_NAME__CRS or METHOD_NAME__PRS) - * Uuid - Pointer to the UUID to be matched. - * includes both subtype and 16-byte UUID - * ret_buffer - Where the vendor resource is returned + * PARAMETERS: device_handle - Handle for the parent device object + * Name - Method name for the parent resource + * (METHOD_NAME__CRS or METHOD_NAME__PRS) + * Uuid - Pointer to the UUID to be matched. + * includes both subtype and 16-byte UUID + * ret_buffer - Where the vendor resource is returned * * RETURN: Status * @@ -384,6 +435,7 @@ ACPI_EXPORT_SYMBOL(acpi_resource_to_address64) * UUID subtype. Returns a struct acpi_resource of type Vendor. * ******************************************************************************/ + acpi_status acpi_get_vendor_resource(acpi_handle device_handle, char *name, @@ -415,19 +467,18 @@ acpi_get_vendor_resource(acpi_handle device_handle, return (info.status); } -ACPI_EXPORT_SYMBOL(acpi_get_vendor_resource) - /******************************************************************************* * * FUNCTION: acpi_rs_match_vendor_resource * - * PARAMETERS: acpi_walk_resource_callback + * PARAMETERS: ACPI_WALK_RESOURCE_CALLBACK * * RETURN: Status * * DESCRIPTION: Match a vendor resource via the ACPI 3.0 UUID * ******************************************************************************/ + static acpi_status acpi_rs_match_vendor_resource(struct acpi_resource *resource, void *context) { @@ -475,101 +526,3 @@ acpi_rs_match_vendor_resource(struct acpi_resource *resource, void *context) info->status = AE_OK; return (AE_CTRL_TERMINATE); } - -ACPI_EXPORT_SYMBOL(acpi_rs_match_vendor_resource) - -/******************************************************************************* - * - * FUNCTION: acpi_walk_resources - * - * PARAMETERS: device_handle - Handle to the device object for the - * device we are querying - * Name - Method name of the resources we want - * (METHOD_NAME__CRS or METHOD_NAME__PRS) - * user_function - Called for each resource - * Context - Passed to user_function - * - * RETURN: Status - * - * DESCRIPTION: Retrieves the current or possible resource list for the - * specified device. The user_function is called once for - * each resource in the list. - * - ******************************************************************************/ - -acpi_status -acpi_walk_resources(acpi_handle device_handle, - char *name, - acpi_walk_resource_callback user_function, void *context) -{ - acpi_status status; - struct acpi_buffer buffer; - struct acpi_resource *resource; - struct acpi_resource *resource_end; - - ACPI_FUNCTION_TRACE(acpi_walk_resources); - - /* Parameter validation */ - - if (!device_handle || !user_function || !name || - (!ACPI_COMPARE_NAME(name, METHOD_NAME__CRS) && - !ACPI_COMPARE_NAME(name, METHOD_NAME__PRS))) { - return_ACPI_STATUS(AE_BAD_PARAMETER); - } - - /* Get the _CRS or _PRS resource list */ - - buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER; - status = acpi_rs_get_method_data(device_handle, name, &buffer); - if (ACPI_FAILURE(status)) { - return_ACPI_STATUS(status); - } - - /* Buffer now contains the resource list */ - - resource = ACPI_CAST_PTR(struct acpi_resource, buffer.pointer); - resource_end = - ACPI_ADD_PTR(struct acpi_resource, buffer.pointer, buffer.length); - - /* Walk the resource list until the end_tag is found (or buffer end) */ - - while (resource < resource_end) { - - /* Sanity check the resource */ - - if (resource->type > ACPI_RESOURCE_TYPE_MAX) { - status = AE_AML_INVALID_RESOURCE_TYPE; - break; - } - - /* Invoke the user function, abort on any error returned */ - - status = user_function(resource, context); - if (ACPI_FAILURE(status)) { - if (status == AE_CTRL_TERMINATE) { - - /* This is an OK termination by the user function */ - - status = AE_OK; - } - break; - } - - /* end_tag indicates end-of-list */ - - if (resource->type == ACPI_RESOURCE_TYPE_END_TAG) { - break; - } - - /* Get the next resource descriptor */ - - resource = - ACPI_ADD_PTR(struct acpi_resource, resource, - resource->length); - } - - ACPI_FREE(buffer.pointer); - return_ACPI_STATUS(status); -} - -ACPI_EXPORT_SYMBOL(acpi_walk_resources) diff --git a/trunk/drivers/acpi/scan.c b/trunk/drivers/acpi/scan.c index fe3693de7ba3..a0ab828b2cc5 100644 --- a/trunk/drivers/acpi/scan.c +++ b/trunk/drivers/acpi/scan.c @@ -142,7 +142,7 @@ static void acpi_device_register(struct acpi_device *device, create_sysfs_device_files(device); } -static void acpi_device_unregister(struct acpi_device *device, int type) +static int acpi_device_unregister(struct acpi_device *device, int type) { spin_lock(&acpi_device_lock); if (device->parent) { @@ -158,6 +158,7 @@ static void acpi_device_unregister(struct acpi_device *device, int type) acpi_detach_data(device->handle, acpi_bus_data_handler); remove_sysfs_device_files(device); kobject_unregister(&device->kobj); + return 0; } void acpi_bus_data_handler(acpi_handle handle, u32 function, void *context) @@ -233,9 +234,12 @@ static int acpi_bus_get_power_flags(struct acpi_device *device) int acpi_match_ids(struct acpi_device *device, char *ids) { + int error = 0; + struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; + if (device->flags.hardware_id) if (strstr(ids, device->pnp.hardware_id)) - return 0; + goto Done; if (device->flags.compatible_ids) { struct acpi_compatible_id_list *cid_list = device->pnp.cid_list; @@ -244,10 +248,15 @@ int acpi_match_ids(struct acpi_device *device, char *ids) /* compare multiple _CID entries against driver ids */ for (i = 0; i < cid_list->count; i++) { if (strstr(ids, cid_list->id[i].value)) - return 0; + goto Done; } } - return -ENOENT; + error = -ENOENT; + + Done: + if (buffer.pointer) + acpi_os_free(buffer.pointer); + return error; } static acpi_status @@ -432,7 +441,10 @@ acpi_eject_store(struct acpi_device *device, const char *buf, size_t count) islockable = device->flags.lockable; handle = device->handle; - result = acpi_bus_trim(device, 1); + if (type == ACPI_TYPE_PROCESSOR) + result = acpi_bus_trim(device, 0); + else + result = acpi_bus_trim(device, 1); if (!result) result = acpi_eject_operation(handle, islockable); @@ -459,6 +471,7 @@ static int acpi_bus_get_perf_flags(struct acpi_device *device) -------------------------------------------------------------------------- */ static LIST_HEAD(acpi_bus_drivers); +static DECLARE_MUTEX(acpi_bus_drivers_lock); /** * acpi_bus_match - match device IDs to driver's supported IDs @@ -535,9 +548,10 @@ static int acpi_start_single_object(struct acpi_device *device) return_VALUE(result); } -static void acpi_driver_attach(struct acpi_driver *drv) +static int acpi_driver_attach(struct acpi_driver *drv) { struct list_head *node, *next; + int count = 0; ACPI_FUNCTION_TRACE("acpi_driver_attach"); @@ -554,6 +568,7 @@ static void acpi_driver_attach(struct acpi_driver *drv) if (!acpi_bus_driver_init(dev, drv)) { acpi_start_single_object(dev); atomic_inc(&drv->references); + count++; ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found driver [%s] for device [%s]\n", drv->name, dev->pnp.bus_id)); @@ -562,9 +577,10 @@ static void acpi_driver_attach(struct acpi_driver *drv) spin_lock(&acpi_device_lock); } spin_unlock(&acpi_device_lock); + return_VALUE(count); } -static void acpi_driver_detach(struct acpi_driver *drv) +static int acpi_driver_detach(struct acpi_driver *drv) { struct list_head *node, *next; @@ -586,6 +602,7 @@ static void acpi_driver_detach(struct acpi_driver *drv) } } spin_unlock(&acpi_device_lock); + return_VALUE(0); } /** @@ -593,22 +610,28 @@ static void acpi_driver_detach(struct acpi_driver *drv) * @driver: driver being registered * * Registers a driver with the ACPI bus. Searches the namespace for all - * devices that match the driver's criteria and binds. Returns zero for - * success or a negative error status for failure. + * devices that match the driver's criteria and binds. Returns the + * number of devices that were claimed by the driver, or a negative + * error status for failure. */ int acpi_bus_register_driver(struct acpi_driver *driver) { + int count; + ACPI_FUNCTION_TRACE("acpi_bus_register_driver"); if (acpi_disabled) return_VALUE(-ENODEV); + if (!driver) + return_VALUE(-EINVAL); + spin_lock(&acpi_device_lock); list_add_tail(&driver->node, &acpi_bus_drivers); spin_unlock(&acpi_device_lock); - acpi_driver_attach(driver); + count = acpi_driver_attach(driver); - return_VALUE(0); + return_VALUE(count); } EXPORT_SYMBOL(acpi_bus_register_driver); @@ -620,16 +643,23 @@ EXPORT_SYMBOL(acpi_bus_register_driver); * Unregisters a driver with the ACPI bus. Searches the namespace for all * devices that match the driver's criteria and unbinds. */ -void acpi_bus_unregister_driver(struct acpi_driver *driver) +int acpi_bus_unregister_driver(struct acpi_driver *driver) { - acpi_driver_detach(driver); + int error = 0; - if (!atomic_read(&driver->references)) { - spin_lock(&acpi_device_lock); - list_del_init(&driver->node); - spin_unlock(&acpi_device_lock); - } - return; + ACPI_FUNCTION_TRACE("acpi_bus_unregister_driver"); + + if (driver) { + acpi_driver_detach(driver); + + if (!atomic_read(&driver->references)) { + spin_lock(&acpi_device_lock); + list_del_init(&driver->node); + spin_unlock(&acpi_device_lock); + } + } else + error = -EINVAL; + return_VALUE(error); } EXPORT_SYMBOL(acpi_bus_unregister_driver); diff --git a/trunk/drivers/acpi/sleep/wakeup.c b/trunk/drivers/acpi/sleep/wakeup.c index af1dbabaf0b1..85df0ceda2a9 100644 --- a/trunk/drivers/acpi/sleep/wakeup.c +++ b/trunk/drivers/acpi/sleep/wakeup.c @@ -155,6 +155,7 @@ static int __init acpi_wakeup_device_init(void) if (acpi_disabled) return 0; + printk("ACPI wakeup devices: \n"); spin_lock(&acpi_device_lock); list_for_each_safe(node, next, &acpi_wakeup_device_list) { @@ -173,8 +174,10 @@ static int __init acpi_wakeup_device_init(void) dev->wakeup.state.enabled = 1; spin_lock(&acpi_device_lock); } + printk("%4s ", dev->pnp.bus_id); } spin_unlock(&acpi_device_lock); + printk("\n"); return 0; } diff --git a/trunk/drivers/acpi/system.c b/trunk/drivers/acpi/system.c index a934ac42178d..e4308c7a6743 100644 --- a/trunk/drivers/acpi/system.c +++ b/trunk/drivers/acpi/system.c @@ -39,7 +39,7 @@ ACPI_MODULE_NAME("acpi_system") #define ACPI_SYSTEM_FILE_EVENT "event" #define ACPI_SYSTEM_FILE_DSDT "dsdt" #define ACPI_SYSTEM_FILE_FADT "fadt" -extern struct fadt_descriptor acpi_fadt; +extern FADT_DESCRIPTOR acpi_fadt; /* -------------------------------------------------------------------------- FS Interface (/proc) @@ -82,7 +82,7 @@ acpi_system_read_dsdt(struct file *file, ACPI_FUNCTION_TRACE("acpi_system_read_dsdt"); - status = acpi_get_table(ACPI_TABLE_ID_DSDT, 1, &dsdt); + status = acpi_get_table(ACPI_TABLE_DSDT, 1, &dsdt); if (ACPI_FAILURE(status)) return_VALUE(-ENODEV); @@ -110,7 +110,7 @@ acpi_system_read_fadt(struct file *file, ACPI_FUNCTION_TRACE("acpi_system_read_fadt"); - status = acpi_get_table(ACPI_TABLE_ID_FADT, 1, &fadt); + status = acpi_get_table(ACPI_TABLE_FADT, 1, &fadt); if (ACPI_FAILURE(status)) return_VALUE(-ENODEV); diff --git a/trunk/drivers/acpi/tables.c b/trunk/drivers/acpi/tables.c index ed5e8816d83d..7f37c7cc5ef1 100644 --- a/trunk/drivers/acpi/tables.c +++ b/trunk/drivers/acpi/tables.c @@ -282,8 +282,8 @@ acpi_get_table_header_early(enum acpi_table_id id, /* Map the DSDT header via the pointer in the FADT */ if (id == ACPI_DSDT) { - struct fadt_descriptor *fadt = - (struct fadt_descriptor *)*header; + struct fadt_descriptor_rev2 *fadt = + (struct fadt_descriptor_rev2 *)*header; if (fadt->revision == 3 && fadt->Xdsdt) { *header = (void *)__acpi_map_table(fadt->Xdsdt, diff --git a/trunk/drivers/acpi/tables/tbconvrt.c b/trunk/drivers/acpi/tables/tbconvrt.c index d697fcb35d52..03b37d2223bc 100644 --- a/trunk/drivers/acpi/tables/tbconvrt.c +++ b/trunk/drivers/acpi/tables/tbconvrt.c @@ -41,6 +41,8 @@ * POSSIBILITY OF SUCH DAMAGES. */ +#include + #include #include @@ -54,15 +56,15 @@ acpi_tb_init_generic_address(struct acpi_generic_address *new_gas_struct, acpi_physical_address address); static void -acpi_tb_convert_fadt1(struct fadt_descriptor *local_fadt, +acpi_tb_convert_fadt1(struct fadt_descriptor_rev2 *local_fadt, struct fadt_descriptor_rev1 *original_fadt); static void -acpi_tb_convert_fadt2(struct fadt_descriptor *local_fadt, - struct fadt_descriptor *original_fadt); +acpi_tb_convert_fadt2(struct fadt_descriptor_rev2 *local_fadt, + struct fadt_descriptor_rev2 *original_fadt); u8 acpi_fadt_is_v1; -ACPI_EXPORT_SYMBOL(acpi_fadt_is_v1) +EXPORT_SYMBOL(acpi_fadt_is_v1); /******************************************************************************* * @@ -120,7 +122,7 @@ acpi_status acpi_tb_convert_to_xsdt(struct acpi_table_desc *table_info) { acpi_size table_size; u32 i; - struct xsdt_descriptor *new_table; + XSDT_DESCRIPTOR *new_table; ACPI_FUNCTION_ENTRY(); @@ -131,7 +133,7 @@ acpi_status acpi_tb_convert_to_xsdt(struct acpi_table_desc *table_info) /* Allocate an XSDT */ - new_table = ACPI_ALLOCATE_ZEROED(table_size); + new_table = ACPI_MEM_CALLOCATE(table_size); if (!new_table) { return (AE_NO_MEMORY); } @@ -145,18 +147,17 @@ acpi_status acpi_tb_convert_to_xsdt(struct acpi_table_desc *table_info) /* Copy the table pointers */ for (i = 0; i < acpi_gbl_rsdt_table_count; i++) { - /* RSDT pointers are 32 bits, XSDT pointers are 64 bits */ if (acpi_gbl_root_table_type == ACPI_TABLE_TYPE_RSDT) { ACPI_STORE_ADDRESS(new_table->table_offset_entry[i], (ACPI_CAST_PTR - (struct rsdt_descriptor, + (struct rsdt_descriptor_rev1, table_info->pointer))-> table_offset_entry[i]); } else { new_table->table_offset_entry[i] = - (ACPI_CAST_PTR(struct xsdt_descriptor, + (ACPI_CAST_PTR(XSDT_DESCRIPTOR, table_info->pointer))-> table_offset_entry[i]; } @@ -218,7 +219,7 @@ acpi_tb_init_generic_address(struct acpi_generic_address *new_gas_struct, ******************************************************************************/ static void -acpi_tb_convert_fadt1(struct fadt_descriptor *local_fadt, +acpi_tb_convert_fadt1(struct fadt_descriptor_rev2 *local_fadt, struct fadt_descriptor_rev1 *original_fadt) { @@ -364,13 +365,14 @@ acpi_tb_convert_fadt1(struct fadt_descriptor *local_fadt, ******************************************************************************/ static void -acpi_tb_convert_fadt2(struct fadt_descriptor *local_fadt, - struct fadt_descriptor *original_fadt) +acpi_tb_convert_fadt2(struct fadt_descriptor_rev2 *local_fadt, + struct fadt_descriptor_rev2 *original_fadt) { /* We have an ACPI 2.0 FADT but we must copy it to our local buffer */ - ACPI_MEMCPY(local_fadt, original_fadt, sizeof(struct fadt_descriptor)); + ACPI_MEMCPY(local_fadt, original_fadt, + sizeof(struct fadt_descriptor_rev2)); /* * "X" fields are optional extensions to the original V1.0 fields, so @@ -489,10 +491,10 @@ acpi_tb_convert_fadt2(struct fadt_descriptor *local_fadt, acpi_status acpi_tb_convert_table_fadt(void) { - struct fadt_descriptor *local_fadt; + struct fadt_descriptor_rev2 *local_fadt; struct acpi_table_desc *table_desc; - ACPI_FUNCTION_TRACE(tb_convert_table_fadt); + ACPI_FUNCTION_TRACE("tb_convert_table_fadt"); /* * acpi_gbl_FADT is valid. Validate the FADT length. The table must be @@ -506,14 +508,13 @@ acpi_status acpi_tb_convert_table_fadt(void) /* Allocate buffer for the ACPI 2.0(+) FADT */ - local_fadt = ACPI_ALLOCATE_ZEROED(sizeof(struct fadt_descriptor)); + local_fadt = ACPI_MEM_CALLOCATE(sizeof(struct fadt_descriptor_rev2)); if (!local_fadt) { return_ACPI_STATUS(AE_NO_MEMORY); } if (acpi_gbl_FADT->revision >= FADT2_REVISION_ID) { - if (acpi_gbl_FADT->length < sizeof(struct fadt_descriptor)) { - + if (acpi_gbl_FADT->length < sizeof(struct fadt_descriptor_rev2)) { /* Length is too short to be a V2.0 table */ ACPI_WARNING((AE_INFO, @@ -537,11 +538,11 @@ acpi_status acpi_tb_convert_table_fadt(void) /* Global FADT pointer will point to the new common V2.0 FADT */ acpi_gbl_FADT = local_fadt; - acpi_gbl_FADT->length = sizeof(struct fadt_descriptor); + acpi_gbl_FADT->length = sizeof(FADT_DESCRIPTOR); /* Free the original table */ - table_desc = acpi_gbl_table_lists[ACPI_TABLE_ID_FADT].next; + table_desc = acpi_gbl_table_lists[ACPI_TABLE_FADT].next; acpi_tb_delete_single_table(table_desc); /* Install the new table */ @@ -549,7 +550,7 @@ acpi_status acpi_tb_convert_table_fadt(void) table_desc->pointer = ACPI_CAST_PTR(struct acpi_table_header, acpi_gbl_FADT); table_desc->allocation = ACPI_MEM_ALLOCATED; - table_desc->length = sizeof(struct fadt_descriptor); + table_desc->length = sizeof(struct fadt_descriptor_rev2); /* Dump the entire FADT */ @@ -579,7 +580,7 @@ acpi_status acpi_tb_convert_table_fadt(void) acpi_status acpi_tb_build_common_facs(struct acpi_table_desc *table_info) { - ACPI_FUNCTION_TRACE(tb_build_common_facs); + ACPI_FUNCTION_TRACE("tb_build_common_facs"); /* Absolute minimum length is 24, but the ACPI spec says 64 */ @@ -602,7 +603,6 @@ acpi_status acpi_tb_build_common_facs(struct acpi_table_desc *table_info) if ((acpi_gbl_RSDP->revision < 2) || (acpi_gbl_FACS->length < 32) || (!(acpi_gbl_FACS->xfirmware_waking_vector))) { - /* ACPI 1.0 FACS or short table or optional X_ field is zero */ acpi_gbl_common_fACS.firmware_waking_vector = ACPI_CAST_PTR(u64, diff --git a/trunk/drivers/acpi/tables/tbget.c b/trunk/drivers/acpi/tables/tbget.c index 99eacceff563..09b4ee6dfd60 100644 --- a/trunk/drivers/acpi/tables/tbget.c +++ b/trunk/drivers/acpi/tables/tbget.c @@ -78,7 +78,7 @@ acpi_tb_get_table(struct acpi_pointer *address, acpi_status status; struct acpi_table_header header; - ACPI_FUNCTION_TRACE(tb_get_table); + ACPI_FUNCTION_TRACE("tb_get_table"); /* Get the header in order to get signature and table size */ @@ -124,7 +124,7 @@ acpi_tb_get_table_header(struct acpi_pointer *address, acpi_status status = AE_OK; struct acpi_table_header *header = NULL; - ACPI_FUNCTION_TRACE(tb_get_table_header); + ACPI_FUNCTION_TRACE("tb_get_table_header"); /* * Flags contains the current processor mode (Virtual or Physical @@ -148,10 +148,6 @@ acpi_tb_get_table_header(struct acpi_pointer *address, sizeof(struct acpi_table_header), (void *)&header); if (ACPI_FAILURE(status)) { - ACPI_ERROR((AE_INFO, - "Could not map memory at %8.8X%8.8X for table header", - ACPI_FORMAT_UINT64(address->pointer. - physical))); return_ACPI_STATUS(status); } @@ -202,7 +198,7 @@ acpi_tb_get_table_body(struct acpi_pointer *address, { acpi_status status; - ACPI_FUNCTION_TRACE(tb_get_table_body); + ACPI_FUNCTION_TRACE("tb_get_table_body"); if (!table_info || !address) { return_ACPI_STATUS(AE_BAD_PARAMETER); @@ -212,7 +208,6 @@ acpi_tb_get_table_body(struct acpi_pointer *address, status = acpi_tb_table_override(header, table_info); if (ACPI_SUCCESS(status)) { - /* Table was overridden by the host OS */ return_ACPI_STATUS(status); @@ -246,7 +241,7 @@ acpi_tb_table_override(struct acpi_table_header *header, acpi_status status; struct acpi_pointer address; - ACPI_FUNCTION_TRACE(tb_table_override); + ACPI_FUNCTION_TRACE("tb_table_override"); /* * The OSL will examine the header and decide whether to override this @@ -255,7 +250,6 @@ acpi_tb_table_override(struct acpi_table_header *header, */ status = acpi_os_table_override(header, &new_table); if (ACPI_FAILURE(status)) { - /* Some severe error from the OSL, but we basically ignore it */ ACPI_EXCEPTION((AE_INFO, status, @@ -264,7 +258,6 @@ acpi_tb_table_override(struct acpi_table_header *header, } if (!new_table) { - /* No table override */ return_ACPI_STATUS(AE_NO_ACPI_TABLES); @@ -318,7 +311,7 @@ acpi_tb_get_this_table(struct acpi_pointer *address, u8 allocation; acpi_status status = AE_OK; - ACPI_FUNCTION_TRACE(tb_get_this_table); + ACPI_FUNCTION_TRACE("tb_get_this_table"); /* * Flags contains the current processor mode (Virtual or Physical @@ -330,7 +323,7 @@ acpi_tb_get_this_table(struct acpi_pointer *address, /* Pointer matches processor mode, copy the table to a new buffer */ - full_table = ACPI_ALLOCATE(header->length); + full_table = ACPI_MEM_ALLOCATE(header->length); if (!full_table) { ACPI_ERROR((AE_INFO, "Could not allocate table memory for [%4.4s] length %X", @@ -383,12 +376,11 @@ acpi_tb_get_this_table(struct acpi_pointer *address, * Validate checksum for _most_ tables, * even the ones whose signature we don't recognize */ - if (table_info->type != ACPI_TABLE_ID_FACS) { + if (table_info->type != ACPI_TABLE_FACS) { status = acpi_tb_verify_table_checksum(full_table); #if (!ACPI_CHECKSUM_ABORT) if (ACPI_FAILURE(status)) { - /* Ignore the error if configuration says so */ status = AE_OK; @@ -417,7 +409,7 @@ acpi_tb_get_this_table(struct acpi_pointer *address, * * PARAMETERS: table_type - one of the defined table types * Instance - Which table of this type - * return_table - pointer to location to place the pointer for + * table_ptr_loc - pointer to location to place the pointer for * return * * RETURN: Status @@ -428,34 +420,57 @@ acpi_tb_get_this_table(struct acpi_pointer *address, acpi_status acpi_tb_get_table_ptr(acpi_table_type table_type, - u32 instance, struct acpi_table_header **return_table) + u32 instance, struct acpi_table_header **table_ptr_loc) { struct acpi_table_desc *table_desc; u32 i; - ACPI_FUNCTION_TRACE(tb_get_table_ptr); + ACPI_FUNCTION_TRACE("tb_get_table_ptr"); + + if (!acpi_gbl_DSDT) { + return_ACPI_STATUS(AE_NO_ACPI_TABLES); + } - if (table_type > ACPI_TABLE_ID_MAX) { + if (table_type > ACPI_TABLE_MAX) { return_ACPI_STATUS(AE_BAD_PARAMETER); } - /* Check for instance out of range of the current table count */ + /* + * For all table types (Single/Multiple), the first + * instance is always in the list head. + */ + if (instance == 1) { + /* Get the first */ + + *table_ptr_loc = NULL; + if (acpi_gbl_table_lists[table_type].next) { + *table_ptr_loc = + acpi_gbl_table_lists[table_type].next->pointer; + } + return_ACPI_STATUS(AE_OK); + } + + /* Check for instance out of range */ if (instance > acpi_gbl_table_lists[table_type].count) { return_ACPI_STATUS(AE_NOT_EXIST); } - /* - * Walk the list to get the desired table - * Note: Instance is one-based + /* 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_table_lists[table_type].next; - for (i = 1; i < instance; i++) { + for (i = 2; i < instance; i++) { table_desc = table_desc->next; } /* We are now pointing to the requested table's descriptor */ - *return_table = table_desc->pointer; + *table_ptr_loc = table_desc->pointer; + return_ACPI_STATUS(AE_OK); } diff --git a/trunk/drivers/acpi/tables/tbgetall.c b/trunk/drivers/acpi/tables/tbgetall.c index ad982112e4c6..134e5dce0bc1 100644 --- a/trunk/drivers/acpi/tables/tbgetall.c +++ b/trunk/drivers/acpi/tables/tbgetall.c @@ -77,7 +77,7 @@ acpi_tb_get_primary_table(struct acpi_pointer *address, acpi_status status; struct acpi_table_header header; - ACPI_FUNCTION_TRACE(tb_get_primary_table); + ACPI_FUNCTION_TRACE("tb_get_primary_table"); /* Ignore a NULL address in the RSDT */ @@ -140,7 +140,7 @@ acpi_tb_get_secondary_table(struct acpi_pointer *address, acpi_status status; struct acpi_table_header header; - ACPI_FUNCTION_TRACE_STR(tb_get_secondary_table, signature); + ACPI_FUNCTION_TRACE_STR("tb_get_secondary_table", signature); /* Get the header in order to match the signature */ @@ -151,7 +151,7 @@ acpi_tb_get_secondary_table(struct acpi_pointer *address, /* Signature must match request */ - if (!ACPI_COMPARE_NAME(header.signature, signature)) { + if (ACPI_STRNCMP(header.signature, signature, ACPI_NAME_SIZE)) { ACPI_ERROR((AE_INFO, "Incorrect table signature - wanted [%s] found [%4.4s]", signature, header.signature)); @@ -207,7 +207,7 @@ acpi_status acpi_tb_get_required_tables(void) struct acpi_table_desc table_info; struct acpi_pointer address; - ACPI_FUNCTION_TRACE(tb_get_required_tables); + ACPI_FUNCTION_TRACE("tb_get_required_tables"); ACPI_DEBUG_PRINT((ACPI_DB_INFO, "%d ACPI tables in RSDT\n", acpi_gbl_rsdt_table_count)); @@ -223,7 +223,6 @@ acpi_status acpi_tb_get_required_tables(void) * any SSDTs. */ for (i = 0; i < acpi_gbl_rsdt_table_count; i++) { - /* Get the table address from the common internal XSDT */ address.pointer.value = acpi_gbl_XSDT->table_offset_entry[i]; @@ -306,6 +305,6 @@ acpi_status acpi_tb_get_required_tables(void) /* Always delete the RSDP mapping, we are done with it */ - acpi_tb_delete_tables_by_type(ACPI_TABLE_ID_RSDP); + acpi_tb_delete_tables_by_type(ACPI_TABLE_RSDP); return_ACPI_STATUS(status); } diff --git a/trunk/drivers/acpi/tables/tbinstal.c b/trunk/drivers/acpi/tables/tbinstal.c index 7ca2df75bb11..7ffd0fddb4e5 100644 --- a/trunk/drivers/acpi/tables/tbinstal.c +++ b/trunk/drivers/acpi/tables/tbinstal.c @@ -73,18 +73,17 @@ acpi_tb_match_signature(char *signature, { acpi_native_uint i; - ACPI_FUNCTION_TRACE(tb_match_signature); + ACPI_FUNCTION_TRACE("tb_match_signature"); /* Search for a signature match among the known table types */ - for (i = 0; i < (ACPI_TABLE_ID_MAX + 1); i++) { + for (i = 0; i < NUM_ACPI_TABLE_TYPES; i++) { if (!(acpi_gbl_table_data[i].flags & search_type)) { continue; } if (!ACPI_STRNCMP(signature, acpi_gbl_table_data[i].signature, acpi_gbl_table_data[i].sig_length)) { - /* Found a signature match, return index if requested */ if (table_info) { @@ -123,7 +122,7 @@ acpi_status acpi_tb_install_table(struct acpi_table_desc *table_info) { acpi_status status; - ACPI_FUNCTION_TRACE(tb_install_table); + ACPI_FUNCTION_TRACE("tb_install_table"); /* Lock tables while installing */ @@ -188,7 +187,7 @@ acpi_tb_recognize_table(struct acpi_table_desc *table_info, u8 search_type) struct acpi_table_header *table_header; acpi_status status; - ACPI_FUNCTION_TRACE(tb_recognize_table); + ACPI_FUNCTION_TRACE("tb_recognize_table"); /* Ensure that we have a valid table pointer */ @@ -219,6 +218,7 @@ acpi_tb_recognize_table(struct acpi_table_desc *table_info, u8 search_type) /* Return the table type and length via the info struct */ table_info->length = (acpi_size) table_header->length; + return_ACPI_STATUS(status); } @@ -243,11 +243,11 @@ acpi_tb_init_table_descriptor(acpi_table_type table_type, struct acpi_table_desc *table_desc; acpi_status status; - ACPI_FUNCTION_TRACE_U32(tb_init_table_descriptor, table_type); + ACPI_FUNCTION_TRACE_U32("tb_init_table_descriptor", table_type); /* Allocate a descriptor for this table */ - table_desc = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_table_desc)); + table_desc = ACPI_MEM_CALLOCATE(sizeof(struct acpi_table_desc)); if (!table_desc) { return_ACPI_STATUS(AE_NO_MEMORY); } @@ -274,7 +274,7 @@ acpi_tb_init_table_descriptor(acpi_table_type table_type, * at this location, so return an error. */ if (list_head->next) { - ACPI_FREE(table_desc); + ACPI_MEM_FREE(table_desc); return_ACPI_STATUS(AE_ALREADY_EXISTS); } @@ -312,14 +312,15 @@ acpi_tb_init_table_descriptor(acpi_table_type table_type, /* Finish initialization of the table descriptor */ - table_desc->loaded_into_namespace = FALSE; table_desc->type = (u8) table_type; table_desc->pointer = table_info->pointer; table_desc->length = table_info->length; table_desc->allocation = table_info->allocation; table_desc->aml_start = (u8 *) (table_desc->pointer + 1), - table_desc->aml_length = (u32) - (table_desc->length - (u32) sizeof(struct acpi_table_header)); + table_desc->aml_length = (u32) (table_desc->length - + (u32) sizeof(struct + acpi_table_header)); + table_desc->loaded_into_namespace = FALSE; /* * Set the appropriate global pointer (if there is one) to point to the @@ -334,6 +335,7 @@ acpi_tb_init_table_descriptor(acpi_table_type table_type, table_info->owner_id = table_desc->owner_id; table_info->installed_desc = table_desc; + return_ACPI_STATUS(AE_OK); } @@ -357,7 +359,7 @@ void acpi_tb_delete_all_tables(void) * Free memory allocated for ACPI tables * Memory can either be mapped or allocated */ - for (type = 0; type < (ACPI_TABLE_ID_MAX + 1); type++) { + for (type = 0; type < NUM_ACPI_TABLE_TYPES; type++) { acpi_tb_delete_tables_by_type(type); } } @@ -381,9 +383,9 @@ void acpi_tb_delete_tables_by_type(acpi_table_type type) u32 count; u32 i; - ACPI_FUNCTION_TRACE_U32(tb_delete_tables_by_type, type); + ACPI_FUNCTION_TRACE_U32("tb_delete_tables_by_type", type); - if (type > ACPI_TABLE_ID_MAX) { + if (type > ACPI_TABLE_MAX) { return_VOID; } @@ -394,28 +396,28 @@ void acpi_tb_delete_tables_by_type(acpi_table_type type) /* Clear the appropriate "typed" global table pointer */ switch (type) { - case ACPI_TABLE_ID_RSDP: + case ACPI_TABLE_RSDP: acpi_gbl_RSDP = NULL; break; - case ACPI_TABLE_ID_DSDT: + case ACPI_TABLE_DSDT: acpi_gbl_DSDT = NULL; break; - case ACPI_TABLE_ID_FADT: + case ACPI_TABLE_FADT: acpi_gbl_FADT = NULL; break; - case ACPI_TABLE_ID_FACS: + case ACPI_TABLE_FACS: acpi_gbl_FACS = NULL; break; - case ACPI_TABLE_ID_XSDT: + case ACPI_TABLE_XSDT: acpi_gbl_XSDT = NULL; break; - case ACPI_TABLE_ID_SSDT: - case ACPI_TABLE_ID_PSDT: + case ACPI_TABLE_SSDT: + case ACPI_TABLE_PSDT: default: break; } @@ -469,7 +471,7 @@ void acpi_tb_delete_single_table(struct acpi_table_desc *table_desc) case ACPI_MEM_ALLOCATED: - ACPI_FREE(table_desc->pointer); + ACPI_MEM_FREE(table_desc->pointer); break; case ACPI_MEM_MAPPED: @@ -501,7 +503,7 @@ struct acpi_table_desc *acpi_tb_uninstall_table(struct acpi_table_desc { struct acpi_table_desc *next_desc; - ACPI_FUNCTION_TRACE_PTR(tb_uninstall_table, table_desc); + ACPI_FUNCTION_TRACE_PTR("tb_uninstall_table", table_desc); if (!table_desc) { return_PTR(NULL); @@ -528,7 +530,7 @@ struct acpi_table_desc *acpi_tb_uninstall_table(struct acpi_table_desc /* Free the table descriptor */ next_desc = table_desc->next; - ACPI_FREE(table_desc); + ACPI_MEM_FREE(table_desc); /* Return pointer to the next descriptor */ diff --git a/trunk/drivers/acpi/tables/tbrsdt.c b/trunk/drivers/acpi/tables/tbrsdt.c index abcb08c2592a..4d308220225d 100644 --- a/trunk/drivers/acpi/tables/tbrsdt.c +++ b/trunk/drivers/acpi/tables/tbrsdt.c @@ -64,7 +64,7 @@ acpi_status acpi_tb_verify_rsdp(struct acpi_pointer *address) acpi_status status; struct rsdp_descriptor *rsdp; - ACPI_FUNCTION_TRACE(tb_verify_rsdp); + ACPI_FUNCTION_TRACE("tb_verify_rsdp"); switch (address->pointer_type) { case ACPI_LOGICAL_POINTER: @@ -78,7 +78,7 @@ acpi_status acpi_tb_verify_rsdp(struct acpi_pointer *address) */ status = acpi_os_map_memory(address->pointer.physical, sizeof(struct rsdp_descriptor), - ACPI_CAST_PTR(void, &rsdp)); + (void *)&rsdp); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); } @@ -95,20 +95,15 @@ acpi_status acpi_tb_verify_rsdp(struct acpi_pointer *address) goto cleanup; } - /* RSDP is ok. Init the table info */ + /* The RSDP supplied is OK */ table_info.pointer = ACPI_CAST_PTR(struct acpi_table_header, rsdp); table_info.length = sizeof(struct rsdp_descriptor); - - if (address->pointer_type == ACPI_PHYSICAL_POINTER) { - table_info.allocation = ACPI_MEM_MAPPED; - } else { - table_info.allocation = ACPI_MEM_NOT_ALLOCATED; - } + table_info.allocation = ACPI_MEM_MAPPED; /* Save the table pointers and allocation info */ - status = acpi_tb_init_table_descriptor(ACPI_TABLE_ID_RSDP, &table_info); + status = acpi_tb_init_table_descriptor(ACPI_TABLE_RSDP, &table_info); if (ACPI_FAILURE(status)) { goto cleanup; } @@ -179,20 +174,22 @@ void acpi_tb_get_rsdt_address(struct acpi_pointer *out_address) acpi_status acpi_tb_validate_rsdt(struct acpi_table_header *table_ptr) { - char *signature; + int no_match; ACPI_FUNCTION_ENTRY(); - /* Search for appropriate signature, RSDT or XSDT */ - + /* + * Search for appropriate signature, RSDT or XSDT + */ if (acpi_gbl_root_table_type == ACPI_TABLE_TYPE_RSDT) { - signature = RSDT_SIG; + no_match = ACPI_STRNCMP((char *)table_ptr, RSDT_SIG, + sizeof(RSDT_SIG) - 1); } else { - signature = XSDT_SIG; + no_match = ACPI_STRNCMP((char *)table_ptr, XSDT_SIG, + sizeof(XSDT_SIG) - 1); } - if (!ACPI_COMPARE_NAME(table_ptr->signature, signature)) { - + if (no_match) { /* Invalid RSDT or XSDT signature */ ACPI_ERROR((AE_INFO, @@ -201,8 +198,10 @@ acpi_status acpi_tb_validate_rsdt(struct acpi_table_header *table_ptr) ACPI_DUMP_BUFFER(acpi_gbl_RSDP, 20); ACPI_ERROR((AE_INFO, - "RSDT/XSDT signature at %X is invalid", - acpi_gbl_RSDP->rsdt_physical_address)); + "RSDT/XSDT signature at %X (%p) is invalid", + acpi_gbl_RSDP->rsdt_physical_address, + (void *)(acpi_native_uint) acpi_gbl_RSDP-> + rsdt_physical_address)); if (acpi_gbl_root_table_type == ACPI_TABLE_TYPE_RSDT) { ACPI_ERROR((AE_INFO, "Looking for RSDT")); @@ -235,13 +234,13 @@ acpi_status acpi_tb_get_table_rsdt(void) acpi_status status; struct acpi_pointer address; - ACPI_FUNCTION_TRACE(tb_get_table_rsdt); + ACPI_FUNCTION_TRACE("tb_get_table_rsdt"); /* Get the RSDT/XSDT via the RSDP */ acpi_tb_get_rsdt_address(&address); - table_info.type = ACPI_TABLE_ID_XSDT; + table_info.type = ACPI_TABLE_XSDT; status = acpi_tb_get_table(&address, &table_info); if (ACPI_FAILURE(status)) { ACPI_EXCEPTION((AE_INFO, status, @@ -275,13 +274,12 @@ acpi_status acpi_tb_get_table_rsdt(void) /* Save the table pointers and allocation info */ - status = acpi_tb_init_table_descriptor(ACPI_TABLE_ID_XSDT, &table_info); + status = acpi_tb_init_table_descriptor(ACPI_TABLE_XSDT, &table_info); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); } - acpi_gbl_XSDT = - ACPI_CAST_PTR(struct xsdt_descriptor, table_info.pointer); + acpi_gbl_XSDT = ACPI_CAST_PTR(XSDT_DESCRIPTOR, table_info.pointer); ACPI_DEBUG_PRINT((ACPI_DB_INFO, "XSDT located at %p\n", acpi_gbl_XSDT)); return_ACPI_STATUS(status); diff --git a/trunk/drivers/acpi/tables/tbutils.c b/trunk/drivers/acpi/tables/tbutils.c index 209a401801e3..bc571592f087 100644 --- a/trunk/drivers/acpi/tables/tbutils.c +++ b/trunk/drivers/acpi/tables/tbutils.c @@ -71,7 +71,7 @@ acpi_status acpi_tb_is_table_installed(struct acpi_table_desc *new_table_desc) { struct acpi_table_desc *table_desc; - ACPI_FUNCTION_TRACE(tb_is_table_installed); + ACPI_FUNCTION_TRACE("tb_is_table_installed"); /* Get the list descriptor and first table descriptor */ @@ -96,11 +96,10 @@ acpi_status acpi_tb_is_table_installed(struct acpi_table_desc *new_table_desc) (!ACPI_MEMCMP (table_desc->pointer, new_table_desc->pointer, new_table_desc->pointer->length))) { - /* Match: this table is already installed */ ACPI_DEBUG_PRINT((ACPI_DB_TABLES, - "Table [%4.4s] already installed: Rev %X OemTableId [%8.8s]\n", + "Table [%4.4s] already installed: Rev %X oem_table_id [%8.8s]\n", new_table_desc->pointer->signature, new_table_desc->pointer->revision, new_table_desc->pointer-> @@ -160,8 +159,12 @@ acpi_tb_validate_table_header(struct acpi_table_header *table_header) ACPI_MOVE_32_TO_32(&signature, table_header->signature); if (!acpi_ut_valid_acpi_name(signature)) { - ACPI_ERROR((AE_INFO, "Invalid table signature 0x%8.8X", - signature)); + ACPI_ERROR((AE_INFO, + "Table signature at %p [%p] has invalid characters", + table_header, &signature)); + + ACPI_WARNING((AE_INFO, "Invalid table signature found: [%4.4s]", + ACPI_CAST_PTR(char, &signature))); ACPI_DUMP_BUFFER(table_header, sizeof(struct acpi_table_header)); @@ -172,9 +175,12 @@ acpi_tb_validate_table_header(struct acpi_table_header *table_header) if (table_header->length < sizeof(struct acpi_table_header)) { ACPI_ERROR((AE_INFO, - "Invalid length 0x%X in table with signature %4.4s", - (u32) table_header->length, - ACPI_CAST_PTR(char, &signature))); + "Invalid length in table header %p name %4.4s", + table_header, (char *)&signature)); + + ACPI_WARNING((AE_INFO, + "Invalid table header length (0x%X) found", + (u32) table_header->length)); ACPI_DUMP_BUFFER(table_header, sizeof(struct acpi_table_header)); @@ -186,119 +192,72 @@ acpi_tb_validate_table_header(struct acpi_table_header *table_header) /******************************************************************************* * - * FUNCTION: acpi_tb_sum_table - * - * PARAMETERS: Buffer - Buffer to sum - * Length - Size of the buffer - * - * RETURN: 8 bit sum of buffer - * - * DESCRIPTION: Computes an 8 bit sum of the buffer(length) and returns it. - * - ******************************************************************************/ - -u8 acpi_tb_sum_table(void *buffer, u32 length) -{ - acpi_native_uint i; - u8 sum = 0; - - if (!buffer || !length) { - return (0); - } - - for (i = 0; i < length; i++) { - sum = (u8) (sum + ((u8 *) buffer)[i]); - } - return (sum); -} - -/******************************************************************************* - * - * FUNCTION: acpi_tb_generate_checksum + * FUNCTION: acpi_tb_verify_table_checksum * - * PARAMETERS: Table - Pointer to a valid ACPI table (with a - * standard ACPI header) + * PARAMETERS: *table_header - ACPI table to verify * - * RETURN: 8 bit checksum of buffer + * RETURN: 8 bit checksum of table * - * DESCRIPTION: Computes an 8 bit checksum of the table. + * DESCRIPTION: Does an 8 bit checksum of table and returns status. A correct + * table should have a checksum of 0. * ******************************************************************************/ -u8 acpi_tb_generate_checksum(struct acpi_table_header * table) +acpi_status +acpi_tb_verify_table_checksum(struct acpi_table_header * table_header) { u8 checksum; + acpi_status status = AE_OK; - /* Sum the entire table as-is */ - - checksum = acpi_tb_sum_table(table, table->length); + ACPI_FUNCTION_TRACE("tb_verify_table_checksum"); - /* Subtract off the existing checksum value in the table */ + /* Compute the checksum on the table */ - checksum = (u8) (checksum - table->checksum); + checksum = + acpi_tb_generate_checksum(table_header, table_header->length); - /* Compute the final checksum */ + /* Return the appropriate exception */ - checksum = (u8) (0 - checksum); - return (checksum); -} + if (checksum) { + ACPI_WARNING((AE_INFO, + "Invalid checksum in table [%4.4s] (%02X, sum %02X is not zero)", + table_header->signature, + (u32) table_header->checksum, (u32) checksum)); -/******************************************************************************* - * - * FUNCTION: acpi_tb_set_checksum - * - * PARAMETERS: Table - Pointer to a valid ACPI table (with a - * standard ACPI header) - * - * RETURN: None. Sets the table checksum field - * - * DESCRIPTION: Computes an 8 bit checksum of the table and inserts the - * checksum into the table header. - * - ******************************************************************************/ - -void acpi_tb_set_checksum(struct acpi_table_header *table) -{ - - table->checksum = acpi_tb_generate_checksum(table); + status = AE_BAD_CHECKSUM; + } + return_ACPI_STATUS(status); } /******************************************************************************* * - * FUNCTION: acpi_tb_verify_table_checksum + * FUNCTION: acpi_tb_generate_checksum * - * PARAMETERS: *table_header - ACPI table to verify + * PARAMETERS: Buffer - Buffer to checksum + * Length - Size of the buffer * - * RETURN: 8 bit checksum of table + * RETURN: 8 bit checksum of buffer * - * DESCRIPTION: Generates an 8 bit checksum of table and returns and compares - * it to the existing checksum value. + * DESCRIPTION: Computes an 8 bit checksum of the buffer(length) and returns it. * ******************************************************************************/ -acpi_status -acpi_tb_verify_table_checksum(struct acpi_table_header *table_header) +u8 acpi_tb_generate_checksum(void *buffer, u32 length) { - u8 checksum; - - ACPI_FUNCTION_TRACE(tb_verify_table_checksum); - - /* Compute the checksum on the table */ + u8 *end_buffer; + u8 *rover; + u8 sum = 0; - checksum = acpi_tb_generate_checksum(table_header); + if (buffer && length) { + /* Buffer and Length are valid */ - /* Checksum ok? */ + end_buffer = ACPI_ADD_PTR(u8, buffer, length); - if (checksum == table_header->checksum) { - return_ACPI_STATUS(AE_OK); + for (rover = buffer; rover < end_buffer; rover++) { + sum = (u8) (sum + *rover); + } } - - ACPI_WARNING((AE_INFO, - "Incorrect checksum in table [%4.4s] - is %2.2X, should be %2.2X", - table_header->signature, table_header->checksum, - checksum)); - - return_ACPI_STATUS(AE_BAD_CHECKSUM); + return (sum); } #ifdef ACPI_OBSOLETE_FUNCTIONS @@ -317,12 +276,12 @@ acpi_tb_verify_table_checksum(struct acpi_table_header *table_header) acpi_status acpi_tb_handle_to_object(u16 table_id, - struct acpi_table_desc **return_table_desc) + struct acpi_table_desc ** return_table_desc) { u32 i; struct acpi_table_desc *table_desc; - ACPI_FUNCTION_NAME(tb_handle_to_object); + ACPI_FUNCTION_NAME("tb_handle_to_object"); for (i = 0; i < ACPI_TABLE_MAX; i++) { table_desc = acpi_gbl_table_lists[i].next; @@ -336,7 +295,7 @@ acpi_tb_handle_to_object(u16 table_id, } } - ACPI_ERROR((AE_INFO, "TableId=%X does not exist", table_id)); + ACPI_ERROR((AE_INFO, "table_id=%X does not exist", table_id)); return (AE_BAD_PARAMETER); } #endif diff --git a/trunk/drivers/acpi/tables/tbxface.c b/trunk/drivers/acpi/tables/tbxface.c index 4e91f2984815..9fe53c9d5b9a 100644 --- a/trunk/drivers/acpi/tables/tbxface.c +++ b/trunk/drivers/acpi/tables/tbxface.c @@ -42,6 +42,8 @@ * POSSIBILITY OF SUCH DAMAGES. */ +#include + #include #include #include @@ -66,7 +68,7 @@ acpi_status acpi_load_tables(void) struct acpi_pointer rsdp_address; acpi_status status; - ACPI_FUNCTION_TRACE(acpi_load_tables); + ACPI_FUNCTION_TRACE("acpi_load_tables"); /* Get the RSDP */ @@ -121,8 +123,6 @@ acpi_status acpi_load_tables(void) return_ACPI_STATUS(status); } -ACPI_EXPORT_SYMBOL(acpi_load_tables) - #ifdef ACPI_FUTURE_USAGE /******************************************************************************* * @@ -139,13 +139,14 @@ ACPI_EXPORT_SYMBOL(acpi_load_tables) * is determined that the table is invalid, the call will fail. * ******************************************************************************/ + acpi_status acpi_load_table(struct acpi_table_header *table_ptr) { acpi_status status; struct acpi_table_desc table_info; struct acpi_pointer address; - ACPI_FUNCTION_TRACE(acpi_load_table); + ACPI_FUNCTION_TRACE("acpi_load_table"); if (!table_ptr) { return_ACPI_STATUS(AE_BAD_PARAMETER); @@ -173,7 +174,6 @@ acpi_status acpi_load_table(struct acpi_table_header *table_ptr) status = acpi_tb_install_table(&table_info); if (ACPI_FAILURE(status)) { if (status == AE_ALREADY_EXISTS) { - /* Table already exists, no error */ status = AE_OK; @@ -188,12 +188,12 @@ acpi_status acpi_load_table(struct acpi_table_header *table_ptr) /* Convert the table to common format if necessary */ switch (table_info.type) { - case ACPI_TABLE_ID_FADT: + case ACPI_TABLE_FADT: status = acpi_tb_convert_table_fadt(); break; - case ACPI_TABLE_ID_FACS: + case ACPI_TABLE_FACS: status = acpi_tb_build_common_facs(&table_info); break; @@ -208,7 +208,6 @@ acpi_status acpi_load_table(struct acpi_table_header *table_ptr) } if (ACPI_FAILURE(status)) { - /* Uninstall table and free the buffer */ (void)acpi_tb_uninstall_table(table_info.installed_desc); @@ -217,8 +216,6 @@ acpi_status acpi_load_table(struct acpi_table_header *table_ptr) return_ACPI_STATUS(status); } -ACPI_EXPORT_SYMBOL(acpi_load_table) - /******************************************************************************* * * FUNCTION: acpi_unload_table @@ -230,15 +227,16 @@ ACPI_EXPORT_SYMBOL(acpi_load_table) * DESCRIPTION: This routine is used to force the unload of a table * ******************************************************************************/ + acpi_status acpi_unload_table(acpi_table_type table_type) { struct acpi_table_desc *table_desc; - ACPI_FUNCTION_TRACE(acpi_unload_table); + ACPI_FUNCTION_TRACE("acpi_unload_table"); /* Parameter validation */ - if (table_type > ACPI_TABLE_ID_MAX) { + if (table_type > ACPI_TABLE_MAX) { return_ACPI_STATUS(AE_BAD_PARAMETER); } @@ -263,8 +261,6 @@ acpi_status acpi_unload_table(acpi_table_type table_type) return_ACPI_STATUS(AE_OK); } -ACPI_EXPORT_SYMBOL(acpi_unload_table) - /******************************************************************************* * * FUNCTION: acpi_get_table_header @@ -285,6 +281,7 @@ ACPI_EXPORT_SYMBOL(acpi_unload_table) * have a standard header and is fixed length. * ******************************************************************************/ + acpi_status acpi_get_table_header(acpi_table_type table_type, u32 instance, struct acpi_table_header *out_table_header) @@ -292,16 +289,16 @@ acpi_get_table_header(acpi_table_type table_type, struct acpi_table_header *tbl_ptr; acpi_status status; - ACPI_FUNCTION_TRACE(acpi_get_table_header); + ACPI_FUNCTION_TRACE("acpi_get_table_header"); if ((instance == 0) || - (table_type == ACPI_TABLE_ID_RSDP) || (!out_table_header)) { + (table_type == ACPI_TABLE_RSDP) || (!out_table_header)) { return_ACPI_STATUS(AE_BAD_PARAMETER); } /* Check the table type and instance */ - if ((table_type > ACPI_TABLE_ID_MAX) || + if ((table_type > ACPI_TABLE_MAX) || (ACPI_IS_SINGLE_TABLE(acpi_gbl_table_data[table_type].flags) && instance > 1)) { return_ACPI_STATUS(AE_BAD_PARAMETER); @@ -328,7 +325,6 @@ acpi_get_table_header(acpi_table_type table_type, return_ACPI_STATUS(status); } -ACPI_EXPORT_SYMBOL(acpi_get_table_header) #endif /* ACPI_FUTURE_USAGE */ /******************************************************************************* @@ -353,6 +349,7 @@ ACPI_EXPORT_SYMBOL(acpi_get_table_header) * a complete table including the header. * ******************************************************************************/ + acpi_status acpi_get_table(acpi_table_type table_type, u32 instance, struct acpi_buffer *ret_buffer) @@ -361,7 +358,7 @@ acpi_get_table(acpi_table_type table_type, acpi_status status; acpi_size table_length; - ACPI_FUNCTION_TRACE(acpi_get_table); + ACPI_FUNCTION_TRACE("acpi_get_table"); /* Parameter validation */ @@ -376,7 +373,7 @@ acpi_get_table(acpi_table_type table_type, /* Check the table type and instance */ - if ((table_type > ACPI_TABLE_ID_MAX) || + if ((table_type > ACPI_TABLE_MAX) || (ACPI_IS_SINGLE_TABLE(acpi_gbl_table_data[table_type].flags) && instance > 1)) { return_ACPI_STATUS(AE_BAD_PARAMETER); @@ -399,8 +396,7 @@ acpi_get_table(acpi_table_type table_type, /* Get the table length */ - if (table_type == ACPI_TABLE_ID_RSDP) { - + if (table_type == ACPI_TABLE_RSDP) { /* RSD PTR is the only "table" without a header */ table_length = sizeof(struct rsdp_descriptor); @@ -421,4 +417,4 @@ acpi_get_table(acpi_table_type table_type, return_ACPI_STATUS(AE_OK); } -ACPI_EXPORT_SYMBOL(acpi_get_table) +EXPORT_SYMBOL(acpi_get_table); diff --git a/trunk/drivers/acpi/tables/tbxfroot.c b/trunk/drivers/acpi/tables/tbxfroot.c index da2648bbdbc0..a62db6af83c9 100644 --- a/trunk/drivers/acpi/tables/tbxfroot.c +++ b/trunk/drivers/acpi/tables/tbxfroot.c @@ -41,6 +41,8 @@ * POSSIBILITY OF SUCH DAMAGES. */ +#include + #include #include @@ -73,7 +75,6 @@ acpi_status acpi_tb_validate_rsdp(struct rsdp_descriptor *rsdp) * The signature and checksum must both be correct */ if (ACPI_STRNCMP((char *)rsdp, RSDP_SIG, sizeof(RSDP_SIG) - 1) != 0) { - /* Nope, BAD Signature */ return (AE_BAD_SIGNATURE); @@ -81,14 +82,15 @@ acpi_status acpi_tb_validate_rsdp(struct rsdp_descriptor *rsdp) /* Check the standard checksum */ - if (acpi_tb_sum_table(rsdp, ACPI_RSDP_CHECKSUM_LENGTH) != 0) { + if (acpi_tb_generate_checksum(rsdp, ACPI_RSDP_CHECKSUM_LENGTH) != 0) { return (AE_BAD_CHECKSUM); } /* Check extended checksum if table version >= 2 */ if ((rsdp->revision >= 2) && - (acpi_tb_sum_table(rsdp, ACPI_RSDP_XCHECKSUM_LENGTH) != 0)) { + (acpi_tb_generate_checksum(rsdp, ACPI_RSDP_XCHECKSUM_LENGTH) != + 0)) { return (AE_BAD_CHECKSUM); } @@ -119,7 +121,7 @@ acpi_tb_find_table(char *signature, acpi_status status; struct acpi_table_header *table; - ACPI_FUNCTION_TRACE(tb_find_table); + ACPI_FUNCTION_TRACE("tb_find_table"); /* Validate string lengths */ @@ -129,7 +131,7 @@ acpi_tb_find_table(char *signature, return_ACPI_STATUS(AE_AML_STRING_LIMIT); } - if (ACPI_COMPARE_NAME(signature, DSDT_SIG)) { + if (!ACPI_STRNCMP(signature, DSDT_SIG, ACPI_NAME_SIZE)) { /* * The DSDT pointer is contained in the FADT, not the RSDT. * This code should suffice, because the only code that would perform @@ -154,12 +156,10 @@ acpi_tb_find_table(char *signature, /* Check oem_id and oem_table_id */ - if ((oem_id[0] && - ACPI_STRNCMP(oem_id, table->oem_id, - sizeof(table->oem_id))) || - (oem_table_id[0] && - ACPI_STRNCMP(oem_table_id, table->oem_table_id, - sizeof(table->oem_table_id)))) { + if ((oem_id[0] && ACPI_STRNCMP(oem_id, table->oem_id, + sizeof(table->oem_id))) || + (oem_table_id[0] && ACPI_STRNCMP(oem_table_id, table->oem_table_id, + sizeof(table->oem_table_id)))) { return_ACPI_STATUS(AE_AML_NAME_NOT_FOUND); } @@ -203,7 +203,7 @@ acpi_get_firmware_table(acpi_string signature, u32 i; u32 j; - ACPI_FUNCTION_TRACE(acpi_get_firmware_table); + ACPI_FUNCTION_TRACE("acpi_get_firmware_table"); /* * Ensure that at least the table manager is initialized. We don't @@ -217,7 +217,6 @@ acpi_get_firmware_table(acpi_string signature, /* Ensure that we have a RSDP */ if (!acpi_gbl_RSDP) { - /* Get the RSDP */ status = acpi_os_get_root_pointer(flags, &address); @@ -262,7 +261,7 @@ acpi_get_firmware_table(acpi_string signature, /* Get and validate the RSDT */ - rsdt_info = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_table_desc)); + rsdt_info = ACPI_MEM_CALLOCATE(sizeof(struct acpi_table_desc)); if (!rsdt_info) { return_ACPI_STATUS(AE_NO_MEMORY); } @@ -279,13 +278,13 @@ acpi_get_firmware_table(acpi_string signature, /* Allocate a scratch table header and table descriptor */ - header = ACPI_ALLOCATE(sizeof(struct acpi_table_header)); + header = ACPI_MEM_ALLOCATE(sizeof(struct acpi_table_header)); if (!header) { status = AE_NO_MEMORY; goto cleanup; } - table_info = ACPI_ALLOCATE(sizeof(struct acpi_table_desc)); + table_info = ACPI_MEM_ALLOCATE(sizeof(struct acpi_table_desc)); if (!table_info) { status = AE_NO_MEMORY; goto cleanup; @@ -309,12 +308,12 @@ acpi_get_firmware_table(acpi_string signature, if (acpi_gbl_root_table_type == ACPI_TABLE_TYPE_RSDT) { address.pointer.value = (ACPI_CAST_PTR - (struct rsdt_descriptor, + (RSDT_DESCRIPTOR, rsdt_info->pointer))->table_offset_entry[i]; } else { address.pointer.value = (ACPI_CAST_PTR - (struct xsdt_descriptor, + (XSDT_DESCRIPTOR, rsdt_info->pointer))->table_offset_entry[i]; } @@ -327,13 +326,11 @@ acpi_get_firmware_table(acpi_string signature, /* Compare table signatures and table instance */ - if (ACPI_COMPARE_NAME(header->signature, signature)) { - + if (!ACPI_STRNCMP(header->signature, signature, ACPI_NAME_SIZE)) { /* An instance of the table was found */ j++; if (j >= instance) { - /* Found the correct instance, get the entire table */ status = @@ -358,21 +355,23 @@ acpi_get_firmware_table(acpi_string signature, acpi_os_unmap_memory(rsdt_info->pointer, (acpi_size) rsdt_info->pointer->length); } - ACPI_FREE(rsdt_info); + ACPI_MEM_FREE(rsdt_info); if (header) { - ACPI_FREE(header); + ACPI_MEM_FREE(header); } if (table_info) { - ACPI_FREE(table_info); + ACPI_MEM_FREE(table_info); } return_ACPI_STATUS(status); } -ACPI_EXPORT_SYMBOL(acpi_get_firmware_table) +EXPORT_SYMBOL(acpi_get_firmware_table); /* TBD: Move to a new file */ + #if ACPI_MACHINE_WIDTH != 16 + /******************************************************************************* * * FUNCTION: acpi_find_root_pointer @@ -385,12 +384,13 @@ ACPI_EXPORT_SYMBOL(acpi_get_firmware_table) * DESCRIPTION: Find the RSDP * ******************************************************************************/ + acpi_status acpi_find_root_pointer(u32 flags, struct acpi_pointer *rsdp_address) { struct acpi_table_desc table_info; acpi_status status; - ACPI_FUNCTION_TRACE(acpi_find_root_pointer); + ACPI_FUNCTION_TRACE("acpi_find_root_pointer"); /* Get the RSDP */ @@ -407,8 +407,6 @@ acpi_status acpi_find_root_pointer(u32 flags, struct acpi_pointer *rsdp_address) return_ACPI_STATUS(AE_OK); } -ACPI_EXPORT_SYMBOL(acpi_find_root_pointer) - /******************************************************************************* * * FUNCTION: acpi_tb_scan_memory_for_rsdp @@ -421,13 +419,14 @@ ACPI_EXPORT_SYMBOL(acpi_find_root_pointer) * DESCRIPTION: Search a block of memory for the RSDP signature * ******************************************************************************/ + static u8 *acpi_tb_scan_memory_for_rsdp(u8 * start_address, u32 length) { acpi_status status; u8 *mem_rover; u8 *end_address; - ACPI_FUNCTION_TRACE(tb_scan_memory_for_rsdp); + ACPI_FUNCTION_TRACE("tb_scan_memory_for_rsdp"); end_address = start_address + length; @@ -435,14 +434,12 @@ static u8 *acpi_tb_scan_memory_for_rsdp(u8 * start_address, u32 length) for (mem_rover = start_address; mem_rover < end_address; mem_rover += ACPI_RSDP_SCAN_STEP) { - /* The RSDP signature and checksum must both be correct */ status = acpi_tb_validate_rsdp(ACPI_CAST_PTR (struct rsdp_descriptor, mem_rover)); if (ACPI_SUCCESS(status)) { - /* Sig and checksum valid, we have found a real RSDP */ ACPI_DEBUG_PRINT((ACPI_DB_INFO, @@ -472,10 +469,10 @@ static u8 *acpi_tb_scan_memory_for_rsdp(u8 * start_address, u32 length) * * RETURN: Status, RSDP physical address * - * DESCRIPTION: Search lower 1_mbyte of memory for the root system descriptor + * DESCRIPTION: search lower 1_mbyte of memory for the root system descriptor * pointer structure. If it is found, set *RSDP to point to it. * - * NOTE1: The RSDP must be either in the first 1_k of the Extended + * NOTE1: The RSDp must be either in the first 1_k of the Extended * BIOS Data Area or between E0000 and FFFFF (From ACPI Spec.) * Only a 32-bit physical address is necessary. * @@ -492,13 +489,12 @@ acpi_tb_find_rsdp(struct acpi_table_desc *table_info, u32 flags) u32 physical_address; acpi_status status; - ACPI_FUNCTION_TRACE(tb_find_rsdp); + ACPI_FUNCTION_TRACE("tb_find_rsdp"); /* * Scan supports either logical addressing or physical addressing */ if ((flags & ACPI_MEMORY_MODE) == ACPI_LOGICAL_ADDRESSING) { - /* 1a) Get the location of the Extended BIOS Data Area (EBDA) */ status = acpi_os_map_memory((acpi_physical_address) @@ -525,7 +521,7 @@ acpi_tb_find_rsdp(struct acpi_table_desc *table_info, u32 flags) if (physical_address > 0x400) { /* - * 1b) Search EBDA paragraphs (EBDA is required to be a + * 1b) Search EBDA paragraphs (EBDa is required to be a * minimum of 1_k length) */ status = acpi_os_map_memory((acpi_physical_address) @@ -546,11 +542,10 @@ acpi_tb_find_rsdp(struct acpi_table_desc *table_info, u32 flags) acpi_os_unmap_memory(table_ptr, ACPI_EBDA_WINDOW_SIZE); if (mem_rover) { - /* Return the physical address */ physical_address += - (u32) ACPI_PTR_DIFF(mem_rover, table_ptr); + ACPI_PTR_DIFF(mem_rover, table_ptr); table_info->physical_address = (acpi_physical_address) physical_address; @@ -581,12 +576,11 @@ acpi_tb_find_rsdp(struct acpi_table_desc *table_info, u32 flags) acpi_os_unmap_memory(table_ptr, ACPI_HI_RSDP_WINDOW_SIZE); if (mem_rover) { - /* Return the physical address */ - physical_address = (u32) - (ACPI_HI_RSDP_WINDOW_BASE + - ACPI_PTR_DIFF(mem_rover, table_ptr)); + physical_address = + ACPI_HI_RSDP_WINDOW_BASE + ACPI_PTR_DIFF(mem_rover, + table_ptr); table_info->physical_address = (acpi_physical_address) physical_address; @@ -607,7 +601,7 @@ acpi_tb_find_rsdp(struct acpi_table_desc *table_info, u32 flags) if (physical_address > 0x400) { /* - * 1b) Search EBDA paragraphs (EBDA is required to be a minimum of + * 1b) Search EBDA paragraphs (EBDa is required to be a minimum of * 1_k length) */ mem_rover = @@ -615,7 +609,6 @@ acpi_tb_find_rsdp(struct acpi_table_desc *table_info, u32 flags) (physical_address), ACPI_EBDA_WINDOW_SIZE); if (mem_rover) { - /* Return the physical address */ table_info->physical_address = @@ -631,7 +624,6 @@ acpi_tb_find_rsdp(struct acpi_table_desc *table_info, u32 flags) (ACPI_HI_RSDP_WINDOW_BASE), ACPI_HI_RSDP_WINDOW_SIZE); if (mem_rover) { - /* Found it, return the physical address */ table_info->physical_address = diff --git a/trunk/drivers/acpi/thermal.c b/trunk/drivers/acpi/thermal.c index f003763de7bb..19f3ea48475e 100644 --- a/trunk/drivers/acpi/thermal.c +++ b/trunk/drivers/acpi/thermal.c @@ -684,7 +684,8 @@ static void acpi_thermal_run(unsigned long data) { struct acpi_thermal *tz = (struct acpi_thermal *)data; if (!tz->zombie) - acpi_os_execute(OSL_GPE_HANDLER, acpi_thermal_check, (void *)data); + acpi_os_queue_for_execution(OSD_PRIORITY_GPE, + acpi_thermal_check, (void *)data); } static void acpi_thermal_check(void *data) @@ -941,10 +942,8 @@ acpi_thermal_write_trip_points(struct file *file, memset(limit_string, 0, ACPI_THERMAL_MAX_LIMIT_STR_LEN); active = kmalloc(ACPI_THERMAL_MAX_ACTIVE * sizeof(int), GFP_KERNEL); - if (!active) { - kfree(limit_string); + if (!active) return_VALUE(-ENOMEM); - } if (!tz || (count > ACPI_THERMAL_MAX_LIMIT_STR_LEN - 1)) { ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid argument\n")); @@ -1343,7 +1342,7 @@ static int acpi_thermal_add(struct acpi_device *device) result = acpi_thermal_add_fs(device); if (result) - goto end; + return_VALUE(result); init_timer(&tz->timer); diff --git a/trunk/drivers/acpi/utilities/utalloc.c b/trunk/drivers/acpi/utilities/utalloc.c index 7940fc1bd69e..03b0044974c2 100644 --- a/trunk/drivers/acpi/utilities/utalloc.c +++ b/trunk/drivers/acpi/utilities/utalloc.c @@ -46,6 +46,24 @@ #define _COMPONENT ACPI_UTILITIES ACPI_MODULE_NAME("utalloc") +/* Local prototypes */ +#ifdef ACPI_DBG_TRACK_ALLOCATIONS +static struct acpi_debug_mem_block *acpi_ut_find_allocation(void *allocation); + +static acpi_status +acpi_ut_track_allocation(struct acpi_debug_mem_block *address, + acpi_size size, + u8 alloc_type, u32 component, char *module, u32 line); + +static acpi_status +acpi_ut_remove_allocation(struct acpi_debug_mem_block *address, + u32 component, char *module, u32 line); + +static acpi_status +acpi_ut_create_list(char *list_name, + u16 object_size, struct acpi_memory_list **return_cache); +#endif + /******************************************************************************* * * FUNCTION: acpi_ut_create_caches @@ -57,23 +75,33 @@ ACPI_MODULE_NAME("utalloc") * DESCRIPTION: Create all local caches * ******************************************************************************/ + acpi_status acpi_ut_create_caches(void) { acpi_status status; - /* Object Caches, for frequently used objects */ +#ifdef ACPI_DBG_TRACK_ALLOCATIONS + + /* Memory allocation lists */ + + status = acpi_ut_create_list("Acpi-Global", 0, &acpi_gbl_global_list); + if (ACPI_FAILURE(status)) { + return (status); + } status = - acpi_os_create_cache("Acpi-Namespace", - sizeof(struct acpi_namespace_node), - ACPI_MAX_NAMESPACE_CACHE_DEPTH, - &acpi_gbl_namespace_cache); + acpi_ut_create_list("Acpi-Namespace", + sizeof(struct acpi_namespace_node), + &acpi_gbl_ns_node_list); if (ACPI_FAILURE(status)) { return (status); } +#endif + + /* Object Caches, for frequently used objects */ status = - acpi_os_create_cache("Acpi-State", sizeof(union acpi_generic_state), + acpi_os_create_cache("acpi_state", sizeof(union acpi_generic_state), ACPI_MAX_STATE_CACHE_DEPTH, &acpi_gbl_state_cache); if (ACPI_FAILURE(status)) { @@ -81,7 +109,7 @@ acpi_status acpi_ut_create_caches(void) } status = - acpi_os_create_cache("Acpi-Parse", + acpi_os_create_cache("acpi_parse", sizeof(struct acpi_parse_obj_common), ACPI_MAX_PARSE_CACHE_DEPTH, &acpi_gbl_ps_node_cache); @@ -90,7 +118,7 @@ acpi_status acpi_ut_create_caches(void) } status = - acpi_os_create_cache("Acpi-ParseExt", + acpi_os_create_cache("acpi_parse_ext", sizeof(struct acpi_parse_obj_named), ACPI_MAX_EXTPARSE_CACHE_DEPTH, &acpi_gbl_ps_node_ext_cache); @@ -99,7 +127,7 @@ acpi_status acpi_ut_create_caches(void) } status = - acpi_os_create_cache("Acpi-Operand", + acpi_os_create_cache("acpi_operand", sizeof(union acpi_operand_object), ACPI_MAX_OBJECT_CACHE_DEPTH, &acpi_gbl_operand_cache); @@ -107,24 +135,6 @@ acpi_status acpi_ut_create_caches(void) return (status); } -#ifdef ACPI_DBG_TRACK_ALLOCATIONS - - /* Memory allocation lists */ - - status = acpi_ut_create_list("Acpi-Global", 0, &acpi_gbl_global_list); - if (ACPI_FAILURE(status)) { - return (status); - } - - status = - acpi_ut_create_list("Acpi-Namespace", - sizeof(struct acpi_namespace_node), - &acpi_gbl_ns_node_list); - if (ACPI_FAILURE(status)) { - return (status); - } -#endif - return (AE_OK); } @@ -143,9 +153,6 @@ acpi_status acpi_ut_create_caches(void) acpi_status acpi_ut_delete_caches(void) { - (void)acpi_os_delete_cache(acpi_gbl_namespace_cache); - acpi_gbl_namespace_cache = NULL; - (void)acpi_os_delete_cache(acpi_gbl_state_cache); acpi_gbl_state_cache = NULL; @@ -158,21 +165,6 @@ acpi_status acpi_ut_delete_caches(void) (void)acpi_os_delete_cache(acpi_gbl_ps_node_ext_cache); acpi_gbl_ps_node_ext_cache = NULL; -#ifdef ACPI_DBG_TRACK_ALLOCATIONS - - /* Debug only - display leftover memory allocation, if any */ - - acpi_ut_dump_allocations(ACPI_UINT32_MAX, NULL); - - /* Free memory lists */ - - acpi_os_free(acpi_gbl_global_list); - acpi_gbl_global_list = NULL; - - acpi_os_free(acpi_gbl_ns_node_list); - acpi_gbl_ns_node_list = NULL; -#endif - return (AE_OK); } @@ -260,7 +252,7 @@ acpi_ut_initialize_buffer(struct acpi_buffer * buffer, /* Allocate a new buffer with local interface to allow tracking */ - buffer->pointer = ACPI_ALLOCATE_ZEROED(required_length); + buffer->pointer = ACPI_MEM_CALLOCATE(required_length); if (!buffer->pointer) { return (AE_NO_MEMORY); } @@ -296,7 +288,7 @@ acpi_ut_initialize_buffer(struct acpi_buffer * buffer, * * RETURN: Address of the allocated memory on success, NULL on failure. * - * DESCRIPTION: Subsystem equivalent of malloc. + * DESCRIPTION: The subsystem's equivalent of malloc. * ******************************************************************************/ @@ -304,23 +296,23 @@ void *acpi_ut_allocate(acpi_size size, u32 component, char *module, u32 line) { void *allocation; - ACPI_FUNCTION_TRACE_U32(ut_allocate, size); + ACPI_FUNCTION_TRACE_U32("ut_allocate", size); /* Check for an inadvertent size of zero bytes */ if (!size) { - ACPI_WARNING((module, line, - "Attempt to allocate zero bytes, allocating 1 byte")); + ACPI_ERROR((module, line, + "ut_allocate: Attempt to allocate zero bytes, allocating 1 byte")); size = 1; } allocation = acpi_os_allocate(size); if (!allocation) { - /* Report allocation error */ - ACPI_WARNING((module, line, - "Could not allocate size %X", (u32) size)); + ACPI_ERROR((module, line, + "ut_allocate: Could not allocate size %X", + (u32) size)); return_PTR(NULL); } @@ -330,7 +322,7 @@ void *acpi_ut_allocate(acpi_size size, u32 component, char *module, u32 line) /******************************************************************************* * - * FUNCTION: acpi_ut_allocate_zeroed + * FUNCTION: acpi_ut_callocate * * PARAMETERS: Size - Size of the allocation * Component - Component type of caller @@ -339,24 +331,542 @@ void *acpi_ut_allocate(acpi_size size, u32 component, char *module, u32 line) * * RETURN: Address of the allocated memory on success, NULL on failure. * - * DESCRIPTION: Subsystem equivalent of calloc. Allocate and zero memory. + * DESCRIPTION: Subsystem equivalent of calloc. * ******************************************************************************/ -void *acpi_ut_allocate_zeroed(acpi_size size, - u32 component, char *module, u32 line) +void *acpi_ut_callocate(acpi_size size, u32 component, char *module, u32 line) { void *allocation; + ACPI_FUNCTION_TRACE_U32("ut_callocate", size); + + /* Check for an inadvertent size of zero bytes */ + + if (!size) { + ACPI_ERROR((module, line, + "Attempt to allocate zero bytes, allocating 1 byte")); + size = 1; + } + + allocation = acpi_os_allocate(size); + if (!allocation) { + /* Report allocation error */ + + ACPI_ERROR((module, line, + "Could not allocate size %X", (u32) size)); + return_PTR(NULL); + } + + /* Clear the memory block */ + + ACPI_MEMSET(allocation, 0, size); + return_PTR(allocation); +} + +#ifdef ACPI_DBG_TRACK_ALLOCATIONS +/* + * These procedures are used for tracking memory leaks in the subsystem, and + * they get compiled out when the ACPI_DBG_TRACK_ALLOCATIONS is not set. + * + * Each memory allocation is tracked via a doubly linked list. Each + * element contains the caller's component, module name, function name, and + * line number. acpi_ut_allocate and acpi_ut_callocate call + * acpi_ut_track_allocation to add an element to the list; deletion + * occurs in the body of acpi_ut_free. + */ + +/******************************************************************************* + * + * FUNCTION: acpi_ut_create_list + * + * PARAMETERS: cache_name - Ascii name for the cache + * object_size - Size of each cached object + * return_cache - Where the new cache object is returned + * + * RETURN: Status + * + * DESCRIPTION: Create a local memory list for tracking purposed + * + ******************************************************************************/ + +static acpi_status +acpi_ut_create_list(char *list_name, + u16 object_size, struct acpi_memory_list **return_cache) +{ + struct acpi_memory_list *cache; + + cache = acpi_os_allocate(sizeof(struct acpi_memory_list)); + if (!cache) { + return (AE_NO_MEMORY); + } + + ACPI_MEMSET(cache, 0, sizeof(struct acpi_memory_list)); + + cache->list_name = list_name; + cache->object_size = object_size; + + *return_cache = cache; + return (AE_OK); +} + +/******************************************************************************* + * + * FUNCTION: acpi_ut_allocate_and_track + * + * PARAMETERS: Size - Size of the allocation + * Component - Component type of caller + * Module - Source file name of caller + * Line - Line number of caller + * + * RETURN: Address of the allocated memory on success, NULL on failure. + * + * DESCRIPTION: The subsystem's equivalent of malloc. + * + ******************************************************************************/ + +void *acpi_ut_allocate_and_track(acpi_size size, + u32 component, char *module, u32 line) +{ + struct acpi_debug_mem_block *allocation; + acpi_status status; + + allocation = + acpi_ut_allocate(size + sizeof(struct acpi_debug_mem_header), + component, module, line); + if (!allocation) { + return (NULL); + } + + status = acpi_ut_track_allocation(allocation, size, + ACPI_MEM_MALLOC, component, module, + line); + if (ACPI_FAILURE(status)) { + acpi_os_free(allocation); + return (NULL); + } + + acpi_gbl_global_list->total_allocated++; + acpi_gbl_global_list->current_total_size += (u32) size; + + return ((void *)&allocation->user_space); +} + +/******************************************************************************* + * + * FUNCTION: acpi_ut_callocate_and_track + * + * PARAMETERS: Size - Size of the allocation + * Component - Component type of caller + * Module - Source file name of caller + * Line - Line number of caller + * + * RETURN: Address of the allocated memory on success, NULL on failure. + * + * DESCRIPTION: Subsystem equivalent of calloc. + * + ******************************************************************************/ + +void *acpi_ut_callocate_and_track(acpi_size size, + u32 component, char *module, u32 line) +{ + struct acpi_debug_mem_block *allocation; + acpi_status status; + + allocation = + acpi_ut_callocate(size + sizeof(struct acpi_debug_mem_header), + component, module, line); + if (!allocation) { + /* Report allocation error */ + + ACPI_ERROR((module, line, + "Could not allocate size %X", (u32) size)); + return (NULL); + } + + status = acpi_ut_track_allocation(allocation, size, + ACPI_MEM_CALLOC, component, module, + line); + if (ACPI_FAILURE(status)) { + acpi_os_free(allocation); + return (NULL); + } + + acpi_gbl_global_list->total_allocated++; + acpi_gbl_global_list->current_total_size += (u32) size; + + return ((void *)&allocation->user_space); +} + +/******************************************************************************* + * + * FUNCTION: acpi_ut_free_and_track + * + * PARAMETERS: Allocation - Address of the memory to deallocate + * Component - Component type of caller + * Module - Source file name of caller + * Line - Line number of caller + * + * RETURN: None + * + * DESCRIPTION: Frees the memory at Allocation + * + ******************************************************************************/ + +void +acpi_ut_free_and_track(void *allocation, u32 component, char *module, u32 line) +{ + struct acpi_debug_mem_block *debug_block; + acpi_status status; + + ACPI_FUNCTION_TRACE_PTR("ut_free", allocation); + + if (NULL == allocation) { + ACPI_ERROR((module, line, "Attempt to delete a NULL address")); + + return_VOID; + } + + debug_block = ACPI_CAST_PTR(struct acpi_debug_mem_block, + (((char *)allocation) - + sizeof(struct acpi_debug_mem_header))); + + acpi_gbl_global_list->total_freed++; + acpi_gbl_global_list->current_total_size -= debug_block->size; + + status = acpi_ut_remove_allocation(debug_block, + component, module, line); + if (ACPI_FAILURE(status)) { + ACPI_EXCEPTION((AE_INFO, status, "Could not free memory")); + } + + acpi_os_free(debug_block); + ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, "%p freed\n", allocation)); + return_VOID; +} + +/******************************************************************************* + * + * FUNCTION: acpi_ut_find_allocation + * + * PARAMETERS: Allocation - Address of allocated memory + * + * RETURN: A list element if found; NULL otherwise. + * + * DESCRIPTION: Searches for an element in the global allocation tracking list. + * + ******************************************************************************/ + +static struct acpi_debug_mem_block *acpi_ut_find_allocation(void *allocation) +{ + struct acpi_debug_mem_block *element; + ACPI_FUNCTION_ENTRY(); - allocation = acpi_ut_allocate(size, component, module, line); - if (allocation) { + element = acpi_gbl_global_list->list_head; + + /* Search for the address. */ + + while (element) { + if (element == allocation) { + return (element); + } + + element = element->next; + } + + return (NULL); +} + +/******************************************************************************* + * + * FUNCTION: acpi_ut_track_allocation + * + * PARAMETERS: Allocation - Address of allocated memory + * Size - Size of the allocation + * alloc_type - MEM_MALLOC or MEM_CALLOC + * Component - Component type of caller + * Module - Source file name of caller + * Line - Line number of caller + * + * RETURN: None. + * + * DESCRIPTION: Inserts an element into the global allocation tracking list. + * + ******************************************************************************/ + +static acpi_status +acpi_ut_track_allocation(struct acpi_debug_mem_block *allocation, + acpi_size size, + u8 alloc_type, u32 component, char *module, u32 line) +{ + struct acpi_memory_list *mem_list; + struct acpi_debug_mem_block *element; + acpi_status status = AE_OK; + + ACPI_FUNCTION_TRACE_PTR("ut_track_allocation", allocation); + + mem_list = acpi_gbl_global_list; + status = acpi_ut_acquire_mutex(ACPI_MTX_MEMORY); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); + } + + /* + * Search list for this address to make sure it is not already on the list. + * This will catch several kinds of problems. + */ + element = acpi_ut_find_allocation(allocation); + if (element) { + ACPI_ERROR((AE_INFO, + "ut_track_allocation: Allocation already present in list! (%p)", + allocation)); + + ACPI_ERROR((AE_INFO, "Element %p Address %p", + element, allocation)); + + goto unlock_and_exit; + } + + /* Fill in the instance data. */ + + allocation->size = (u32) size; + allocation->alloc_type = alloc_type; + allocation->component = component; + allocation->line = line; + + ACPI_STRNCPY(allocation->module, module, ACPI_MAX_MODULE_NAME); + allocation->module[ACPI_MAX_MODULE_NAME - 1] = 0; + + /* Insert at list head */ + + if (mem_list->list_head) { + ((struct acpi_debug_mem_block *)(mem_list->list_head))-> + previous = allocation; + } + + allocation->next = mem_list->list_head; + allocation->previous = NULL; + + mem_list->list_head = allocation; + + unlock_and_exit: + status = acpi_ut_release_mutex(ACPI_MTX_MEMORY); + return_ACPI_STATUS(status); +} + +/******************************************************************************* + * + * FUNCTION: acpi_ut_remove_allocation + * + * PARAMETERS: Allocation - Address of allocated memory + * Component - Component type of caller + * Module - Source file name of caller + * Line - Line number of caller + * + * RETURN: + * + * DESCRIPTION: Deletes an element from the global allocation tracking list. + * + ******************************************************************************/ + +static acpi_status +acpi_ut_remove_allocation(struct acpi_debug_mem_block *allocation, + u32 component, char *module, u32 line) +{ + struct acpi_memory_list *mem_list; + acpi_status status; + + ACPI_FUNCTION_TRACE("ut_remove_allocation"); + + mem_list = acpi_gbl_global_list; + if (NULL == mem_list->list_head) { + /* No allocations! */ + + ACPI_ERROR((module, line, + "Empty allocation list, nothing to free!")); + + return_ACPI_STATUS(AE_OK); + } + + status = acpi_ut_acquire_mutex(ACPI_MTX_MEMORY); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); + } + + /* Unlink */ + + if (allocation->previous) { + (allocation->previous)->next = allocation->next; + } else { + mem_list->list_head = allocation->next; + } + + if (allocation->next) { + (allocation->next)->previous = allocation->previous; + } + + /* Mark the segment as deleted */ + + ACPI_MEMSET(&allocation->user_space, 0xEA, allocation->size); + + ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, "Freeing size 0%X\n", + allocation->size)); - /* Clear the memory block */ + status = acpi_ut_release_mutex(ACPI_MTX_MEMORY); + return_ACPI_STATUS(status); +} + +/******************************************************************************* + * + * FUNCTION: acpi_ut_dump_allocation_info + * + * PARAMETERS: + * + * RETURN: None + * + * DESCRIPTION: Print some info about the outstanding allocations. + * + ******************************************************************************/ - ACPI_MEMSET(allocation, 0, size); +#ifdef ACPI_FUTURE_USAGE +void acpi_ut_dump_allocation_info(void) +{ +/* + struct acpi_memory_list *mem_list; +*/ + + ACPI_FUNCTION_TRACE("ut_dump_allocation_info"); + +/* + ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES, + ("%30s: %4d (%3d Kb)\n", "Current allocations", + mem_list->current_count, + ROUND_UP_TO_1K (mem_list->current_size))); + + ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES, + ("%30s: %4d (%3d Kb)\n", "Max concurrent allocations", + mem_list->max_concurrent_count, + ROUND_UP_TO_1K (mem_list->max_concurrent_size))); + + ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES, + ("%30s: %4d (%3d Kb)\n", "Total (all) internal objects", + running_object_count, + ROUND_UP_TO_1K (running_object_size))); + + ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES, + ("%30s: %4d (%3d Kb)\n", "Total (all) allocations", + running_alloc_count, + ROUND_UP_TO_1K (running_alloc_size))); + + ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES, + ("%30s: %4d (%3d Kb)\n", "Current Nodes", + acpi_gbl_current_node_count, + ROUND_UP_TO_1K (acpi_gbl_current_node_size))); + + ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES, + ("%30s: %4d (%3d Kb)\n", "Max Nodes", + acpi_gbl_max_concurrent_node_count, + ROUND_UP_TO_1K ((acpi_gbl_max_concurrent_node_count * + sizeof (struct acpi_namespace_node))))); +*/ + return_VOID; +} +#endif /* ACPI_FUTURE_USAGE */ + +/******************************************************************************* + * + * FUNCTION: acpi_ut_dump_allocations + * + * PARAMETERS: Component - Component(s) to dump info for. + * Module - Module to dump info for. NULL means all. + * + * RETURN: None + * + * DESCRIPTION: Print a list of all outstanding allocations. + * + ******************************************************************************/ + +void acpi_ut_dump_allocations(u32 component, char *module) +{ + struct acpi_debug_mem_block *element; + union acpi_descriptor *descriptor; + u32 num_outstanding = 0; + + ACPI_FUNCTION_TRACE("ut_dump_allocations"); + + /* + * Walk the allocation list. + */ + if (ACPI_FAILURE(acpi_ut_acquire_mutex(ACPI_MTX_MEMORY))) { + return; } - return (allocation); + element = acpi_gbl_global_list->list_head; + while (element) { + if ((element->component & component) && + ((module == NULL) + || (0 == ACPI_STRCMP(module, element->module)))) { + /* Ignore allocated objects that are in a cache */ + + descriptor = + ACPI_CAST_PTR(union acpi_descriptor, + &element->user_space); + if (descriptor->descriptor_id != ACPI_DESC_TYPE_CACHED) { + acpi_os_printf("%p Len %04X %9.9s-%d [%s] ", + descriptor, element->size, + element->module, element->line, + acpi_ut_get_descriptor_name + (descriptor)); + + /* Most of the elements will be Operand objects. */ + + switch (ACPI_GET_DESCRIPTOR_TYPE(descriptor)) { + case ACPI_DESC_TYPE_OPERAND: + acpi_os_printf("%12.12s R%hd", + acpi_ut_get_type_name + (descriptor->object. + common.type), + descriptor->object. + common.reference_count); + break; + + case ACPI_DESC_TYPE_PARSER: + acpi_os_printf("aml_opcode %04hX", + descriptor->op.asl. + aml_opcode); + break; + + case ACPI_DESC_TYPE_NAMED: + acpi_os_printf("%4.4s", + acpi_ut_get_node_name + (&descriptor->node)); + break; + + default: + break; + } + + acpi_os_printf("\n"); + num_outstanding++; + } + } + element = element->next; + } + + (void)acpi_ut_release_mutex(ACPI_MTX_MEMORY); + + /* Print summary */ + + if (!num_outstanding) { + ACPI_INFO((AE_INFO, "No outstanding allocations")); + } else { + ACPI_ERROR((AE_INFO, + "%d(%X) Outstanding allocations", + num_outstanding, num_outstanding)); + } + + return_VOID; } + +#endif /* #ifdef ACPI_DBG_TRACK_ALLOCATIONS */ diff --git a/trunk/drivers/acpi/utilities/utcache.c b/trunk/drivers/acpi/utilities/utcache.c index 56270a30718a..2177cb1ef2c4 100644 --- a/trunk/drivers/acpi/utilities/utcache.c +++ b/trunk/drivers/acpi/utilities/utcache.c @@ -118,14 +118,13 @@ acpi_status acpi_os_purge_cache(struct acpi_memory_list * cache) /* Walk the list of objects in this cache */ while (cache->list_head) { - /* Delete and unlink one cached state object */ next = *(ACPI_CAST_INDIRECT_PTR(char, &(((char *)cache-> list_head)[cache-> link_offset]))); - ACPI_FREE(cache->list_head); + ACPI_MEM_FREE(cache->list_head); cache->list_head = next; cache->current_depth--; @@ -194,7 +193,7 @@ acpi_os_release_object(struct acpi_memory_list * cache, void *object) /* If cache is full, just free this object */ if (cache->current_depth >= cache->max_depth) { - ACPI_FREE(object); + ACPI_MEM_FREE(object); ACPI_MEM_TRACKING(cache->total_freed++); } @@ -244,7 +243,7 @@ void *acpi_os_acquire_object(struct acpi_memory_list *cache) acpi_status status; void *object; - ACPI_FUNCTION_NAME(os_acquire_object); + ACPI_FUNCTION_NAME("os_acquire_object"); if (!cache) { return (NULL); @@ -260,7 +259,6 @@ void *acpi_os_acquire_object(struct acpi_memory_list *cache) /* Check the cache first */ if (cache->list_head) { - /* There is an object available, use it */ object = cache->list_head; @@ -272,9 +270,9 @@ void *acpi_os_acquire_object(struct acpi_memory_list *cache) cache->current_depth--; ACPI_MEM_TRACKING(cache->hits++); - ACPI_DEBUG_PRINT((ACPI_DB_EXEC, - "Object %p from %s cache\n", object, - cache->list_name)); + ACPI_MEM_TRACKING(ACPI_DEBUG_PRINT((ACPI_DB_EXEC, + "Object %p from %s cache\n", + object, cache->list_name))); status = acpi_ut_release_mutex(ACPI_MTX_CACHES); if (ACPI_FAILURE(status)) { @@ -289,14 +287,14 @@ void *acpi_os_acquire_object(struct acpi_memory_list *cache) ACPI_MEM_TRACKING(cache->total_allocated++); - /* Avoid deadlock with ACPI_ALLOCATE_ZEROED */ + /* Avoid deadlock with ACPI_MEM_CALLOCATE */ status = acpi_ut_release_mutex(ACPI_MTX_CACHES); if (ACPI_FAILURE(status)) { return (NULL); } - object = ACPI_ALLOCATE_ZEROED(cache->object_size); + object = ACPI_MEM_CALLOCATE(cache->object_size); if (!object) { return (NULL); } diff --git a/trunk/drivers/acpi/utilities/utcopy.c b/trunk/drivers/acpi/utilities/utcopy.c index 5e1a80d1bc36..df2d32096b72 100644 --- a/trunk/drivers/acpi/utilities/utcopy.c +++ b/trunk/drivers/acpi/utilities/utcopy.c @@ -109,7 +109,7 @@ acpi_ut_copy_isimple_to_esimple(union acpi_operand_object *internal_object, { acpi_status status = AE_OK; - ACPI_FUNCTION_TRACE(ut_copy_isimple_to_esimple); + ACPI_FUNCTION_TRACE("ut_copy_isimple_to_esimple"); *buffer_space_used = 0; @@ -325,7 +325,7 @@ acpi_ut_copy_ipackage_to_epackage(union acpi_operand_object *internal_object, acpi_status status; struct acpi_pkg_info info; - ACPI_FUNCTION_TRACE(ut_copy_ipackage_to_epackage); + ACPI_FUNCTION_TRACE("ut_copy_ipackage_to_epackage"); /* * First package at head of the buffer @@ -383,7 +383,7 @@ acpi_ut_copy_iobject_to_eobject(union acpi_operand_object *internal_object, { acpi_status status; - ACPI_FUNCTION_TRACE(ut_copy_iobject_to_eobject); + ACPI_FUNCTION_TRACE("ut_copy_iobject_to_eobject"); if (ACPI_GET_OBJECT_TYPE(internal_object) == ACPI_TYPE_PACKAGE) { /* @@ -442,7 +442,7 @@ acpi_ut_copy_esimple_to_isimple(union acpi_object *external_object, { union acpi_operand_object *internal_object; - ACPI_FUNCTION_TRACE(ut_copy_esimple_to_isimple); + ACPI_FUNCTION_TRACE("ut_copy_esimple_to_isimple"); /* * Simple types supported are: String, Buffer, Integer @@ -472,8 +472,8 @@ acpi_ut_copy_esimple_to_isimple(union acpi_object *external_object, case ACPI_TYPE_STRING: internal_object->string.pointer = - ACPI_ALLOCATE_ZEROED((acpi_size) external_object->string. - length + 1); + ACPI_MEM_CALLOCATE((acpi_size) external_object->string. + length + 1); if (!internal_object->string.pointer) { goto error_exit; } @@ -488,7 +488,7 @@ acpi_ut_copy_esimple_to_isimple(union acpi_object *external_object, case ACPI_TYPE_BUFFER: internal_object->buffer.pointer = - ACPI_ALLOCATE_ZEROED(external_object->buffer.length); + ACPI_MEM_CALLOCATE(external_object->buffer.length); if (!internal_object->buffer.pointer) { goto error_exit; } @@ -552,7 +552,7 @@ acpi_ut_copy_epackage_to_ipackage(union acpi_operand_object *internal_object, union acpi_operand_object *this_internal_obj; union acpi_object *this_external_obj; - ACPI_FUNCTION_TRACE(ut_copy_epackage_to_ipackage); + ACPI_FUNCTION_TRACE("ut_copy_epackage_to_ipackage"); /* * First package at head of the buffer @@ -600,7 +600,7 @@ acpi_ut_copy_eobject_to_iobject(union acpi_object *external_object, { acpi_status status; - ACPI_FUNCTION_TRACE(ut_copy_eobject_to_iobject); + ACPI_FUNCTION_TRACE("ut_copy_eobject_to_iobject"); if (external_object->type == ACPI_TYPE_PACKAGE) { /* @@ -676,7 +676,7 @@ acpi_ut_copy_simple_object(union acpi_operand_object *source_desc, if ((source_desc->buffer.pointer) && (source_desc->buffer.length)) { dest_desc->buffer.pointer = - ACPI_ALLOCATE(source_desc->buffer.length); + ACPI_MEM_ALLOCATE(source_desc->buffer.length); if (!dest_desc->buffer.pointer) { return (AE_NO_MEMORY); } @@ -697,8 +697,8 @@ acpi_ut_copy_simple_object(union acpi_operand_object *source_desc, */ if (source_desc->string.pointer) { dest_desc->string.pointer = - ACPI_ALLOCATE((acpi_size) source_desc->string. - length + 1); + ACPI_MEM_ALLOCATE((acpi_size) source_desc->string. + length + 1); if (!dest_desc->string.pointer) { return (AE_NO_MEMORY); } @@ -805,7 +805,9 @@ acpi_ut_copy_ielement_to_ielement(u8 object_type, /* * Create the object array */ - target_object->package.elements = ACPI_ALLOCATE_ZEROED(((acpi_size) source_object->package.count + 1) * sizeof(void *)); + target_object->package.elements = + ACPI_MEM_CALLOCATE(((acpi_size) source_object->package. + count + 1) * sizeof(void *)); if (!target_object->package.elements) { status = AE_NO_MEMORY; goto error_exit; @@ -854,7 +856,7 @@ acpi_ut_copy_ipackage_to_ipackage(union acpi_operand_object *source_obj, { acpi_status status = AE_OK; - ACPI_FUNCTION_TRACE(ut_copy_ipackage_to_ipackage); + ACPI_FUNCTION_TRACE("ut_copy_ipackage_to_ipackage"); dest_obj->common.type = ACPI_GET_OBJECT_TYPE(source_obj); dest_obj->common.flags = source_obj->common.flags; @@ -863,10 +865,10 @@ acpi_ut_copy_ipackage_to_ipackage(union acpi_operand_object *source_obj, /* * Create the object array and walk the source package tree */ - dest_obj->package.elements = ACPI_ALLOCATE_ZEROED(((acpi_size) - source_obj->package. - count + - 1) * sizeof(void *)); + dest_obj->package.elements = ACPI_MEM_CALLOCATE(((acpi_size) + source_obj->package. + count + + 1) * sizeof(void *)); if (!dest_obj->package.elements) { ACPI_ERROR((AE_INFO, "Package allocation failure")); return_ACPI_STATUS(AE_NO_MEMORY); @@ -880,7 +882,6 @@ acpi_ut_copy_ipackage_to_ipackage(union acpi_operand_object *source_obj, acpi_ut_copy_ielement_to_ielement, walk_state); if (ACPI_FAILURE(status)) { - /* On failure, delete the destination package object */ acpi_ut_remove_reference(dest_obj); @@ -910,7 +911,7 @@ acpi_ut_copy_iobject_to_iobject(union acpi_operand_object *source_desc, { acpi_status status = AE_OK; - ACPI_FUNCTION_TRACE(ut_copy_iobject_to_iobject); + ACPI_FUNCTION_TRACE("ut_copy_iobject_to_iobject"); /* Create the top level object */ diff --git a/trunk/drivers/acpi/utilities/utdebug.c b/trunk/drivers/acpi/utilities/utdebug.c index 5ec1cfcc611d..35f3d581e034 100644 --- a/trunk/drivers/acpi/utilities/utdebug.c +++ b/trunk/drivers/acpi/utilities/utdebug.c @@ -41,6 +41,8 @@ * POSSIBILITY OF SUCH DAMAGES. */ +#include + #include #define _COMPONENT ACPI_UTILITIES @@ -121,14 +123,12 @@ static const char *acpi_ut_trim_function_name(const char *function_name) /* All Function names are longer than 4 chars, check is safe */ if (*(ACPI_CAST_PTR(u32, function_name)) == ACPI_PREFIX_MIXED) { - /* This is the case where the original source has not been modified */ return (function_name + 4); } if (*(ACPI_CAST_PTR(u32, function_name)) == ACPI_PREFIX_LOWER) { - /* This is the case where the source has been 'linuxized' */ return (function_name + 5); @@ -162,7 +162,7 @@ acpi_ut_debug_print(u32 requested_debug_level, const char *function_name, char *module_name, u32 component_id, char *format, ...) { - acpi_thread_id thread_id; + u32 thread_id; va_list args; /* @@ -177,6 +177,7 @@ acpi_ut_debug_print(u32 requested_debug_level, * Thread tracking and context switch notification */ thread_id = acpi_os_get_thread_id(); + if (thread_id != acpi_gbl_prev_thread_id) { if (ACPI_LV_THREADS & acpi_dbg_level) { acpi_os_printf @@ -205,7 +206,7 @@ acpi_ut_debug_print(u32 requested_debug_level, acpi_os_vprintf(format, args); } -ACPI_EXPORT_SYMBOL(acpi_ut_debug_print) +EXPORT_SYMBOL(acpi_ut_debug_print); /******************************************************************************* * @@ -225,6 +226,7 @@ ACPI_EXPORT_SYMBOL(acpi_ut_debug_print) * debug_print so that the same macros can be used. * ******************************************************************************/ + void ACPI_INTERNAL_VAR_XFACE acpi_ut_debug_print_raw(u32 requested_debug_level, u32 line_number, @@ -242,7 +244,7 @@ acpi_ut_debug_print_raw(u32 requested_debug_level, acpi_os_vprintf(format, args); } -ACPI_EXPORT_SYMBOL(acpi_ut_debug_print_raw) +EXPORT_SYMBOL(acpi_ut_debug_print_raw); /******************************************************************************* * @@ -259,6 +261,7 @@ ACPI_EXPORT_SYMBOL(acpi_ut_debug_print_raw) * set in debug_level * ******************************************************************************/ + void acpi_ut_trace(u32 line_number, const char *function_name, char *module_name, u32 component_id) @@ -272,7 +275,7 @@ acpi_ut_trace(u32 line_number, component_id, "%s\n", acpi_gbl_fn_entry_str); } -ACPI_EXPORT_SYMBOL(acpi_ut_trace) +EXPORT_SYMBOL(acpi_ut_trace); /******************************************************************************* * @@ -290,6 +293,7 @@ ACPI_EXPORT_SYMBOL(acpi_ut_trace) * set in debug_level * ******************************************************************************/ + void acpi_ut_trace_ptr(u32 line_number, const char *function_name, @@ -396,7 +400,7 @@ acpi_ut_exit(u32 line_number, acpi_gbl_nesting_level--; } -ACPI_EXPORT_SYMBOL(acpi_ut_exit) +EXPORT_SYMBOL(acpi_ut_exit); /******************************************************************************* * @@ -414,6 +418,7 @@ ACPI_EXPORT_SYMBOL(acpi_ut_exit) * set in debug_level. Prints exit status also. * ******************************************************************************/ + void acpi_ut_status_exit(u32 line_number, const char *function_name, @@ -437,7 +442,7 @@ acpi_ut_status_exit(u32 line_number, acpi_gbl_nesting_level--; } -ACPI_EXPORT_SYMBOL(acpi_ut_status_exit) +EXPORT_SYMBOL(acpi_ut_status_exit); /******************************************************************************* * @@ -455,6 +460,7 @@ ACPI_EXPORT_SYMBOL(acpi_ut_status_exit) * set in debug_level. Prints exit value also. * ******************************************************************************/ + void acpi_ut_value_exit(u32 line_number, const char *function_name, @@ -469,7 +475,7 @@ acpi_ut_value_exit(u32 line_number, acpi_gbl_nesting_level--; } -ACPI_EXPORT_SYMBOL(acpi_ut_value_exit) +EXPORT_SYMBOL(acpi_ut_value_exit); /******************************************************************************* * @@ -487,6 +493,7 @@ ACPI_EXPORT_SYMBOL(acpi_ut_value_exit) * set in debug_level. Prints exit value also. * ******************************************************************************/ + void acpi_ut_ptr_exit(u32 line_number, const char *function_name, @@ -517,13 +524,20 @@ acpi_ut_ptr_exit(u32 line_number, * ******************************************************************************/ -void acpi_ut_dump_buffer2(u8 * buffer, u32 count, u32 display) +void acpi_ut_dump_buffer(u8 * buffer, u32 count, u32 display, u32 component_id) { acpi_native_uint i = 0; acpi_native_uint j; u32 temp32; u8 buf_char; + /* Only dump the buffer if tracing is enabled */ + + if (!((ACPI_LV_TABLES & acpi_dbg_level) && + (component_id & acpi_dbg_layer))) { + return; + } + if ((count < 4) || (count & 0x01)) { display = DB_BYTE_DISPLAY; } @@ -531,7 +545,6 @@ void acpi_ut_dump_buffer2(u8 * buffer, u32 count, u32 display) /* Nasty little dump buffer routine! */ while (i < count) { - /* Print current offset */ acpi_os_printf("%6.4X: ", (u32) i); @@ -540,7 +553,6 @@ void acpi_ut_dump_buffer2(u8 * buffer, u32 count, u32 display) for (j = 0; j < 16;) { if (i + j >= count) { - /* Dump fill spaces */ acpi_os_printf("%*s", ((display * 2) + 1), " "); @@ -549,7 +561,6 @@ void acpi_ut_dump_buffer2(u8 * buffer, u32 count, u32 display) } switch (display) { - case DB_BYTE_DISPLAY: default: /* Default is BYTE display */ acpi_os_printf("%02X ", buffer[i + j]); @@ -607,31 +618,3 @@ void acpi_ut_dump_buffer2(u8 * buffer, u32 count, u32 display) return; } - -/******************************************************************************* - * - * FUNCTION: acpi_ut_dump_buffer - * - * PARAMETERS: Buffer - Buffer to dump - * Count - Amount to dump, in bytes - * Display - BYTE, WORD, DWORD, or QWORD display - * component_iD - Caller's component ID - * - * RETURN: None - * - * DESCRIPTION: Generic dump buffer in both hex and ascii. - * - ******************************************************************************/ - -void acpi_ut_dump_buffer(u8 * buffer, u32 count, u32 display, u32 component_id) -{ - - /* Only dump the buffer if tracing is enabled */ - - if (!((ACPI_LV_TABLES & acpi_dbg_level) && - (component_id & acpi_dbg_layer))) { - return; - } - - acpi_ut_dump_buffer2(buffer, count, display); -} diff --git a/trunk/drivers/acpi/utilities/utdelete.c b/trunk/drivers/acpi/utilities/utdelete.c index 67b9f325c6fa..1db9695b0029 100644 --- a/trunk/drivers/acpi/utilities/utdelete.c +++ b/trunk/drivers/acpi/utilities/utdelete.c @@ -76,7 +76,7 @@ static void acpi_ut_delete_internal_obj(union acpi_operand_object *object) union acpi_operand_object *second_desc; union acpi_operand_object *next_desc; - ACPI_FUNCTION_TRACE_PTR(ut_delete_internal_obj, object); + ACPI_FUNCTION_TRACE_PTR("ut_delete_internal_obj", object); if (!object) { return_VOID; @@ -96,7 +96,6 @@ static void acpi_ut_delete_internal_obj(union acpi_operand_object *object) /* Free the actual string buffer */ if (!(object->common.flags & AOPOBJ_STATIC_POINTER)) { - /* But only if it is NOT a pointer into an ACPI table */ obj_pointer = object->string.pointer; @@ -112,7 +111,6 @@ static void acpi_ut_delete_internal_obj(union acpi_operand_object *object) /* Free the actual buffer */ if (!(object->common.flags & AOPOBJ_STATIC_POINTER)) { - /* But only if it is NOT a pointer into an ACPI table */ obj_pointer = object->buffer.pointer; @@ -200,22 +198,11 @@ static void acpi_ut_delete_internal_obj(union acpi_operand_object *object) */ handler_desc = object->region.handler; if (handler_desc) { - if (handler_desc->address_space.handler_flags & + if (handler_desc->address_space. + hflags & ACPI_ADDR_HANDLER_DEFAULT_INSTALLED) { - - /* Deactivate region and free region context */ - - if (handler_desc->address_space.setup) { - (void)handler_desc-> - address_space.setup(object, - ACPI_REGION_DEACTIVATE, - handler_desc-> - address_space. - context, - &second_desc-> - extra. - region_context); - } + obj_pointer = + second_desc->extra.region_context; } acpi_ut_remove_reference(handler_desc); @@ -247,7 +234,7 @@ static void acpi_ut_delete_internal_obj(union acpi_operand_object *object) if (obj_pointer) { ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, "Deleting Object Subptr %p\n", obj_pointer)); - ACPI_FREE(obj_pointer); + ACPI_MEM_FREE(obj_pointer); } /* Now the object can be safely deleted */ @@ -276,7 +263,7 @@ void acpi_ut_delete_internal_object_list(union acpi_operand_object **obj_list) { union acpi_operand_object **internal_obj; - ACPI_FUNCTION_TRACE(ut_delete_internal_object_list); + ACPI_FUNCTION_TRACE("ut_delete_internal_object_list"); /* Walk the null-terminated internal list */ @@ -286,7 +273,7 @@ void acpi_ut_delete_internal_object_list(union acpi_operand_object **obj_list) /* Free the combined parameter pointer list and object array */ - ACPI_FREE(obj_list); + ACPI_MEM_FREE(obj_list); return_VOID; } @@ -309,7 +296,7 @@ acpi_ut_update_ref_count(union acpi_operand_object *object, u32 action) u16 count; u16 new_count; - ACPI_FUNCTION_NAME(ut_update_ref_count); + ACPI_FUNCTION_NAME("ut_update_ref_count"); if (!object) { return; @@ -319,9 +306,11 @@ acpi_ut_update_ref_count(union acpi_operand_object *object, u32 action) new_count = count; /* - * Perform the reference count action (increment, decrement, force delete) + * Perform the reference count action + * (increment, decrement, or force delete) */ switch (action) { + case REF_INCREMENT: new_count++; @@ -358,6 +347,7 @@ acpi_ut_update_ref_count(union acpi_operand_object *object, u32 action) if (new_count == 0) { acpi_ut_delete_internal_obj(object); } + break; case REF_FORCE_DELETE: @@ -382,10 +372,13 @@ acpi_ut_update_ref_count(union acpi_operand_object *object, u32 action) * (A deleted object will have a huge reference count) */ if (count > ACPI_MAX_REFERENCE_COUNT) { + ACPI_WARNING((AE_INFO, - "Large Reference Count (%X) in object %p", count, - object)); + "Large Reference Count (%X) in object %p", + count, object)); } + + return; } /******************************************************************************* @@ -411,7 +404,7 @@ acpi_ut_update_ref_count(union acpi_operand_object *object, u32 action) ******************************************************************************/ acpi_status -acpi_ut_update_object_reference(union acpi_operand_object *object, u16 action) +acpi_ut_update_object_reference(union acpi_operand_object * object, u16 action) { acpi_status status = AE_OK; union acpi_generic_state *state_list = NULL; @@ -419,10 +412,9 @@ acpi_ut_update_object_reference(union acpi_operand_object *object, u16 action) union acpi_generic_state *state; acpi_native_uint i; - ACPI_FUNCTION_TRACE_PTR(ut_update_object_reference, object); + ACPI_FUNCTION_TRACE_PTR("ut_update_object_reference", object); while (object) { - /* Make sure that this isn't a namespace handle */ if (ACPI_GET_DESCRIPTOR_TYPE(object) == ACPI_DESC_TYPE_NAMED) { @@ -515,11 +507,11 @@ acpi_ut_update_object_reference(union acpi_operand_object *object, u16 action) case ACPI_TYPE_REGION: default: - break; /* No subobjects for all other types */ + break; /* No subobjects */ } /* - * Now we can update the count in the main object. This can only + * Now we can update the count in the main object. This can only * happen after we update the sub-objects in case this causes the * main object to be deleted. */ @@ -564,7 +556,7 @@ acpi_ut_update_object_reference(union acpi_operand_object *object, u16 action) void acpi_ut_add_reference(union acpi_operand_object *object) { - ACPI_FUNCTION_TRACE_PTR(ut_add_reference, object); + ACPI_FUNCTION_TRACE_PTR("ut_add_reference", object); /* Ensure that we have a valid object */ @@ -597,11 +589,11 @@ void acpi_ut_add_reference(union acpi_operand_object *object) void acpi_ut_remove_reference(union acpi_operand_object *object) { - ACPI_FUNCTION_TRACE_PTR(ut_remove_reference, object); + ACPI_FUNCTION_TRACE_PTR("ut_remove_reference", object); /* - * Allow a NULL pointer to be passed in, just ignore it. This saves - * each caller from having to check. Also, ignore NS nodes. + * Allow a NULL pointer to be passed in, just ignore it. This saves + * each caller from having to check. Also, ignore NS nodes. * */ if (!object || @@ -621,7 +613,7 @@ void acpi_ut_remove_reference(union acpi_operand_object *object) /* * Decrement the reference count, and only actually delete the object - * if the reference count becomes 0. (Must also decrement the ref count + * if the reference count becomes 0. (Must also decrement the ref count * of all subobjects!) */ (void)acpi_ut_update_object_reference(object, REF_DECREMENT); diff --git a/trunk/drivers/acpi/utilities/uteval.c b/trunk/drivers/acpi/utilities/uteval.c index d6d7121583c0..106cc97cb4af 100644 --- a/trunk/drivers/acpi/utilities/uteval.c +++ b/trunk/drivers/acpi/utilities/uteval.c @@ -56,34 +56,6 @@ static acpi_status acpi_ut_translate_one_cid(union acpi_operand_object *obj_desc, struct acpi_compatible_id *one_cid); -/* - * Strings supported by the _OSI predefined (internal) method. - */ -static const char *acpi_interfaces_supported[] = { - /* Operating System Vendor Strings */ - - "Linux", - "Windows 2000", - "Windows 2001", - "Windows 2001 SP0", - "Windows 2001 SP1", - "Windows 2001 SP2", - "Windows 2001 SP3", - "Windows 2001 SP4", - "Windows 2001.1", - "Windows 2001.1 SP1", /* Added 03/2006 */ - "Windows 2006", /* Added 03/2006 */ - - /* Feature Group Strings */ - - "Extended Address Space Descriptor" - /* - * All "optional" feature group strings (features that are implemented - * by the host) should be implemented in the host version of - * acpi_os_validate_interface and should not be added here. - */ -}; - /******************************************************************************* * * FUNCTION: acpi_ut_osi_implementation @@ -92,18 +64,18 @@ static const char *acpi_interfaces_supported[] = { * * RETURN: Status * - * DESCRIPTION: Implementation of the _OSI predefined control method + * DESCRIPTION: Implementation of _OSI predefined control method + * Supported = _OSI (String) * ******************************************************************************/ acpi_status acpi_ut_osi_implementation(struct acpi_walk_state *walk_state) { - acpi_status status; union acpi_operand_object *string_desc; union acpi_operand_object *return_desc; acpi_native_uint i; - ACPI_FUNCTION_TRACE(ut_osi_implementation); + ACPI_FUNCTION_TRACE("ut_osi_implementation"); /* Validate the string input argument */ @@ -112,47 +84,28 @@ acpi_status acpi_ut_osi_implementation(struct acpi_walk_state *walk_state) return_ACPI_STATUS(AE_TYPE); } - /* Create a return object */ + /* Create a return object (Default value = 0) */ return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); if (!return_desc) { return_ACPI_STATUS(AE_NO_MEMORY); } - /* Default return value is SUPPORTED */ - - return_desc->integer.value = ACPI_UINT32_MAX; - walk_state->return_desc = return_desc; - - /* Compare input string to static table of supported interfaces */ + /* Compare input string to table of supported strings */ - for (i = 0; i < ACPI_ARRAY_LENGTH(acpi_interfaces_supported); i++) { - if (!ACPI_STRCMP - (string_desc->string.pointer, - acpi_interfaces_supported[i])) { + for (i = 0; i < ACPI_NUM_OSI_STRINGS; i++) { + if (!ACPI_STRCMP(string_desc->string.pointer, + ACPI_CAST_PTR(char, + acpi_gbl_valid_osi_strings[i]))) + { + /* This string is supported */ - /* The interface is supported */ - - return_ACPI_STATUS(AE_CTRL_TERMINATE); + return_desc->integer.value = 0xFFFFFFFF; + break; } } - /* - * Did not match the string in the static table, call the host OSL to - * check for a match with one of the optional strings (such as - * "Module Device", "3.0 Thermal Model", etc.) - */ - status = acpi_os_validate_interface(string_desc->string.pointer); - if (ACPI_SUCCESS(status)) { - - /* The interface is supported */ - - return_ACPI_STATUS(AE_CTRL_TERMINATE); - } - - /* The interface is not supported */ - - return_desc->integer.value = 0; + walk_state->return_desc = return_desc; return_ACPI_STATUS(AE_CTRL_TERMINATE); } @@ -181,26 +134,19 @@ acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node, u32 expected_return_btypes, union acpi_operand_object **return_desc) { - struct acpi_evaluate_info *info; + struct acpi_parameter_info info; acpi_status status; u32 return_btype; - ACPI_FUNCTION_TRACE(ut_evaluate_object); + ACPI_FUNCTION_TRACE("ut_evaluate_object"); - /* Allocate the evaluation information block */ - - info = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_evaluate_info)); - if (!info) { - return_ACPI_STATUS(AE_NO_MEMORY); - } - - info->prefix_node = prefix_node; - info->pathname = path; - info->parameter_type = ACPI_PARAM_ARGS; + info.node = prefix_node; + info.parameters = NULL; + info.parameter_type = ACPI_PARAM_ARGS; /* Evaluate the object/method */ - status = acpi_ns_evaluate(info); + status = acpi_ns_evaluate_relative(path, &info); if (ACPI_FAILURE(status)) { if (status == AE_NOT_FOUND) { ACPI_DEBUG_PRINT((ACPI_DB_EXEC, @@ -212,25 +158,25 @@ acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node, prefix_node, path, status); } - goto cleanup; + return_ACPI_STATUS(status); } /* Did we get a return object? */ - if (!info->return_object) { + if (!info.return_object) { if (expected_return_btypes) { ACPI_ERROR_METHOD("No object was returned from", prefix_node, path, AE_NOT_EXIST); - status = AE_NOT_EXIST; + return_ACPI_STATUS(AE_NOT_EXIST); } - goto cleanup; + return_ACPI_STATUS(AE_OK); } /* Map the return object type to the bitmapped type */ - switch (ACPI_GET_OBJECT_TYPE(info->return_object)) { + switch (ACPI_GET_OBJECT_TYPE(info.return_object)) { case ACPI_TYPE_INTEGER: return_btype = ACPI_BTYPE_INTEGER; break; @@ -258,8 +204,8 @@ acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node, * happen frequently if the "implicit return" feature is enabled. * Just delete the return object and return AE_OK. */ - acpi_ut_remove_reference(info->return_object); - goto cleanup; + acpi_ut_remove_reference(info.return_object); + return_ACPI_STATUS(AE_OK); } /* Is the return object one of the expected types? */ @@ -271,23 +217,19 @@ acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node, ACPI_ERROR((AE_INFO, "Type returned from %s was incorrect: %s, expected Btypes: %X", path, - acpi_ut_get_object_type_name(info->return_object), + acpi_ut_get_object_type_name(info.return_object), expected_return_btypes)); /* On error exit, we must delete the return object */ - acpi_ut_remove_reference(info->return_object); - status = AE_TYPE; - goto cleanup; + acpi_ut_remove_reference(info.return_object); + return_ACPI_STATUS(AE_TYPE); } /* Object type is OK, return it */ - *return_desc = info->return_object; - - cleanup: - ACPI_FREE(info); - return_ACPI_STATUS(status); + *return_desc = info.return_object; + return_ACPI_STATUS(AE_OK); } /******************************************************************************* @@ -315,7 +257,7 @@ acpi_ut_evaluate_numeric_object(char *object_name, union acpi_operand_object *obj_desc; acpi_status status; - ACPI_FUNCTION_TRACE(ut_evaluate_numeric_object); + ACPI_FUNCTION_TRACE("ut_evaluate_numeric_object"); status = acpi_ut_evaluate_object(device_node, object_name, ACPI_BTYPE_INTEGER, &obj_desc); @@ -391,7 +333,7 @@ acpi_ut_execute_HID(struct acpi_namespace_node *device_node, union acpi_operand_object *obj_desc; acpi_status status; - ACPI_FUNCTION_TRACE(ut_execute_HID); + ACPI_FUNCTION_TRACE("ut_execute_HID"); status = acpi_ut_evaluate_object(device_node, METHOD_NAME__HID, ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING, @@ -401,7 +343,6 @@ acpi_ut_execute_HID(struct acpi_namespace_node *device_node, } if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) { - /* Convert the Numeric HID to string */ acpi_ex_eisa_id_to_string((u32) obj_desc->integer.value, @@ -495,7 +436,7 @@ acpi_ut_execute_CID(struct acpi_namespace_node * device_node, struct acpi_compatible_id_list *cid_list; acpi_native_uint i; - ACPI_FUNCTION_TRACE(ut_execute_CID); + ACPI_FUNCTION_TRACE("ut_execute_CID"); /* Evaluate the _CID method for this device */ @@ -518,7 +459,7 @@ acpi_ut_execute_CID(struct acpi_namespace_node * device_node, size = (((count - 1) * sizeof(struct acpi_compatible_id)) + sizeof(struct acpi_compatible_id_list)); - cid_list = ACPI_ALLOCATE_ZEROED((acpi_size) size); + cid_list = ACPI_MEM_CALLOCATE((acpi_size) size); if (!cid_list) { return_ACPI_STATUS(AE_NO_MEMORY); } @@ -538,7 +479,6 @@ acpi_ut_execute_CID(struct acpi_namespace_node * device_node, /* The _CID object can be either a single CID or a package (list) of CIDs */ if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_PACKAGE) { - /* Translate each package element */ for (i = 0; i < count; i++) { @@ -559,7 +499,7 @@ acpi_ut_execute_CID(struct acpi_namespace_node * device_node, /* Cleanup on error */ if (ACPI_FAILURE(status)) { - ACPI_FREE(cid_list); + ACPI_MEM_FREE(cid_list); } else { *return_cid_list = cid_list; } @@ -593,7 +533,7 @@ acpi_ut_execute_UID(struct acpi_namespace_node *device_node, union acpi_operand_object *obj_desc; acpi_status status; - ACPI_FUNCTION_TRACE(ut_execute_UID); + ACPI_FUNCTION_TRACE("ut_execute_UID"); status = acpi_ut_evaluate_object(device_node, METHOD_NAME__UID, ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING, @@ -603,7 +543,6 @@ acpi_ut_execute_UID(struct acpi_namespace_node *device_node, } if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) { - /* Convert the Numeric UID to string */ acpi_ex_unsigned_integer_to_string(obj_desc->integer.value, @@ -643,7 +582,7 @@ acpi_ut_execute_STA(struct acpi_namespace_node *device_node, u32 * flags) union acpi_operand_object *obj_desc; acpi_status status; - ACPI_FUNCTION_TRACE(ut_execute_STA); + ACPI_FUNCTION_TRACE("ut_execute_STA"); status = acpi_ut_evaluate_object(device_node, METHOD_NAME__STA, ACPI_BTYPE_INTEGER, &obj_desc); @@ -693,7 +632,7 @@ acpi_ut_execute_sxds(struct acpi_namespace_node *device_node, u8 * highest) acpi_status status; u32 i; - ACPI_FUNCTION_TRACE(ut_execute_sxds); + ACPI_FUNCTION_TRACE("ut_execute_Sxds"); for (i = 0; i < 4; i++) { highest[i] = 0xFF; diff --git a/trunk/drivers/acpi/utilities/utglobal.c b/trunk/drivers/acpi/utilities/utglobal.c index e5999c65c0b8..ffd13383a325 100644 --- a/trunk/drivers/acpi/utilities/utglobal.c +++ b/trunk/drivers/acpi/utilities/utglobal.c @@ -43,6 +43,7 @@ #define DEFINE_ACPI_GLOBALS +#include #include #include @@ -118,7 +119,6 @@ const char *acpi_format_exception(acpi_status status) } if (!exception) { - /* Exception code was not recognized */ ACPI_ERROR((AE_INFO, @@ -143,10 +143,12 @@ const char *acpi_format_exception(acpi_status status) /* Debug switch - level and trace mask */ u32 acpi_dbg_level = ACPI_DEBUG_DEFAULT; +EXPORT_SYMBOL(acpi_dbg_level); /* Debug switch - layer (component) mask */ u32 acpi_dbg_layer = ACPI_COMPONENT_DEFAULT | ACPI_ALL_DRIVERS; +EXPORT_SYMBOL(acpi_dbg_layer); u32 acpi_gbl_nesting_level = 0; /* Debugger globals */ @@ -181,6 +183,28 @@ const char *acpi_gbl_highest_dstate_names[4] = { "_S4D" }; +/* + * Strings supported by the _OSI predefined (internal) method. + * When adding strings, be sure to update ACPI_NUM_OSI_STRINGS. + */ +const char *acpi_gbl_valid_osi_strings[ACPI_NUM_OSI_STRINGS] = { + /* Operating System Vendor Strings */ + + "Linux", + "Windows 2000", + "Windows 2001", + "Windows 2001.1", + "Windows 2001 SP0", + "Windows 2001 SP1", + "Windows 2001 SP2", + "Windows 2001 SP3", + "Windows 2001 SP4", + + /* Feature Group Strings */ + + "Extended Address Space Descriptor" +}; + /******************************************************************************* * * Namespace globals @@ -293,9 +317,9 @@ char acpi_ut_hex_to_ascii_char(acpi_integer integer, u32 position) * ******************************************************************************/ -struct acpi_table_list acpi_gbl_table_lists[ACPI_TABLE_ID_MAX + 1]; +struct acpi_table_list acpi_gbl_table_lists[NUM_ACPI_TABLE_TYPES]; -struct acpi_table_support acpi_gbl_table_data[ACPI_TABLE_ID_MAX + 1] = { +struct acpi_table_support acpi_gbl_table_data[NUM_ACPI_TABLE_TYPES] = { /*********** Name, Signature, Global typed pointer Signature size, Type How many allowed?, Contains valid AML? */ /* RSDP 0 */ {RSDP_NAME, RSDP_SIG, NULL, sizeof(RSDP_SIG) - 1, @@ -443,6 +467,7 @@ struct acpi_fixed_event_info acpi_gbl_fixed_event_info[ACPI_NUM_FIXED_EVENTS] = /* Region type decoding */ const char *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS] = { +/*! [Begin] no source code translation (keep these ASL Keywords as-is) */ "SystemMemory", "SystemIO", "PCI_Config", @@ -451,15 +476,16 @@ const char *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS] = { "CMOS", "PCIBARTarget", "DataTable" +/*! [End] no source code translation !*/ }; char *acpi_ut_get_region_name(u8 space_id) { if (space_id >= ACPI_USER_REGION_BEGIN) { - return ("UserDefinedRegion"); + return ("user_defined_region"); } else if (space_id >= ACPI_NUM_PREDEFINED_REGIONS) { - return ("InvalidSpaceId"); + return ("invalid_space_id"); } return (ACPI_CAST_PTR(char, acpi_gbl_region_types[space_id])); @@ -480,18 +506,20 @@ char *acpi_ut_get_region_name(u8 space_id) /* Event type decoding */ static const char *acpi_gbl_event_types[ACPI_NUM_FIXED_EVENTS] = { +/*! [Begin] no source code translation (keep these strings as-is) */ "PM_Timer", "GlobalLock", "PowerButton", "SleepButton", "RealTimeClock", +/*! [End] no source code translation !*/ }; char *acpi_ut_get_event_name(u32 event_id) { if (event_id > ACPI_EVENT_MAX) { - return ("InvalidEventID"); + return ("invalid_event_iD"); } return (ACPI_CAST_PTR(char, acpi_gbl_event_types[event_id])); @@ -522,6 +550,7 @@ static const char acpi_gbl_bad_type[] = "UNDEFINED"; /* Printable names of the ACPI object types */ static const char *acpi_gbl_ns_type_names[] = { +/*! [Begin] no source code translation (keep these strings as-is) */ /* 00 */ "Untyped", /* 01 */ "Integer", /* 02 */ "String", @@ -553,6 +582,7 @@ static const char *acpi_gbl_ns_type_names[] = { /* 28 */ "Extra", /* 29 */ "Data", /* 30 */ "Invalid" +/*! [End] no source code translation !*/ }; char *acpi_ut_get_type_name(acpi_object_type type) @@ -605,14 +635,14 @@ char *acpi_ut_get_node_name(void *object) /* Descriptor must be a namespace node */ - if (ACPI_GET_DESCRIPTOR_TYPE(node) != ACPI_DESC_TYPE_NAMED) { + if (node->descriptor != ACPI_DESC_TYPE_NAMED) { return ("####"); } /* Name must be a valid ACPI name */ if (!acpi_ut_valid_acpi_name(node->name.integer)) { - node->name.integer = acpi_ut_repair_name(node->name.integer); + return ("????"); } /* Return the name */ @@ -635,6 +665,7 @@ char *acpi_ut_get_node_name(void *object) /* Printable names of object descriptor types */ static const char *acpi_gbl_desc_type_names[] = { +/*! [Begin] no source code translation (keep these ASL Keywords as-is) */ /* 00 */ "Invalid", /* 01 */ "Cached", /* 02 */ "State-Generic", @@ -651,6 +682,7 @@ static const char *acpi_gbl_desc_type_names[] = { /* 13 */ "Parser", /* 14 */ "Operand", /* 15 */ "Node" +/*! [End] no source code translation !*/ }; char *acpi_ut_get_descriptor_name(void *object) @@ -691,7 +723,7 @@ char *acpi_ut_get_descriptor_name(void *object) char *acpi_ut_get_mutex_name(u32 mutex_id) { - if (mutex_id > ACPI_MAX_MUTEX) { + if (mutex_id > MAX_MUTEX) { return ("Invalid Mutex ID"); } @@ -715,7 +747,6 @@ u8 acpi_ut_valid_object_type(acpi_object_type type) { if (type > ACPI_TYPE_LOCAL_MAX) { - /* Note: Assumes all TYPEs are contiguous (external/local) */ return (FALSE); @@ -742,7 +773,7 @@ void acpi_ut_init_globals(void) acpi_status status; u32 i; - ACPI_FUNCTION_TRACE(ut_init_globals); + ACPI_FUNCTION_TRACE("ut_init_globals"); /* Create all memory caches */ @@ -753,14 +784,14 @@ void acpi_ut_init_globals(void) /* ACPI table structure */ - for (i = 0; i < (ACPI_TABLE_ID_MAX + 1); i++) { + for (i = 0; i < NUM_ACPI_TABLE_TYPES; i++) { acpi_gbl_table_lists[i].next = NULL; acpi_gbl_table_lists[i].count = 0; } /* Mutex locked flags */ - for (i = 0; i < ACPI_NUM_MUTEX; i++) { + for (i = 0; i < NUM_MUTEX; i++) { acpi_gbl_mutex_info[i].mutex = NULL; acpi_gbl_mutex_info[i].thread_id = ACPI_MUTEX_NOT_ACQUIRED; acpi_gbl_mutex_info[i].use_count = 0; @@ -825,7 +856,7 @@ void acpi_ut_init_globals(void) acpi_gbl_root_node = NULL; acpi_gbl_root_node_struct.name.integer = ACPI_ROOT_NAME; - acpi_gbl_root_node_struct.descriptor_type = ACPI_DESC_TYPE_NAMED; + acpi_gbl_root_node_struct.descriptor = ACPI_DESC_TYPE_NAMED; acpi_gbl_root_node_struct.type = ACPI_TYPE_DEVICE; acpi_gbl_root_node_struct.child = NULL; acpi_gbl_root_node_struct.peer = NULL; @@ -838,6 +869,3 @@ void acpi_ut_init_globals(void) return_VOID; } - -ACPI_EXPORT_SYMBOL(acpi_dbg_level) -ACPI_EXPORT_SYMBOL(acpi_dbg_layer) diff --git a/trunk/drivers/acpi/utilities/utinit.c b/trunk/drivers/acpi/utilities/utinit.c index ff76055eb7d6..ba771b4f39bc 100644 --- a/trunk/drivers/acpi/utilities/utinit.c +++ b/trunk/drivers/acpi/utilities/utinit.c @@ -50,7 +50,7 @@ ACPI_MODULE_NAME("utinit") /* Local prototypes */ static void -acpi_ut_fadt_register_error(char *register_name, u32 value, u8 offset); +acpi_ut_fadt_register_error(char *register_name, u32 value, acpi_size offset); static void acpi_ut_terminate(void); @@ -69,12 +69,12 @@ static void acpi_ut_terminate(void); ******************************************************************************/ static void -acpi_ut_fadt_register_error(char *register_name, u32 value, u8 offset) +acpi_ut_fadt_register_error(char *register_name, u32 value, acpi_size offset) { ACPI_WARNING((AE_INFO, "Invalid FADT value %s=%X at offset %X FADT=%p", - register_name, value, offset, acpi_gbl_FADT)); + register_name, value, (u32) offset, acpi_gbl_FADT)); } /****************************************************************************** @@ -176,7 +176,7 @@ static void acpi_ut_terminate(void) struct acpi_gpe_xrupt_info *gpe_xrupt_info; struct acpi_gpe_xrupt_info *next_gpe_xrupt_info; - ACPI_FUNCTION_TRACE(ut_terminate); + ACPI_FUNCTION_TRACE("ut_terminate"); /* Free global tables, etc. */ /* Free global GPE blocks and related info structures */ @@ -186,14 +186,14 @@ static void acpi_ut_terminate(void) gpe_block = gpe_xrupt_info->gpe_block_list_head; while (gpe_block) { next_gpe_block = gpe_block->next; - ACPI_FREE(gpe_block->event_info); - ACPI_FREE(gpe_block->register_info); - ACPI_FREE(gpe_block); + ACPI_MEM_FREE(gpe_block->event_info); + ACPI_MEM_FREE(gpe_block->register_info); + ACPI_MEM_FREE(gpe_block); gpe_block = next_gpe_block; } next_gpe_xrupt_info = gpe_xrupt_info->next; - ACPI_FREE(gpe_xrupt_info); + ACPI_MEM_FREE(gpe_xrupt_info); gpe_xrupt_info = next_gpe_xrupt_info; } @@ -216,7 +216,7 @@ static void acpi_ut_terminate(void) void acpi_ut_subsystem_shutdown(void) { - ACPI_FUNCTION_TRACE(ut_subsystem_shutdown); + ACPI_FUNCTION_TRACE("ut_subsystem_shutdown"); /* Just exit if subsystem is already shutdown */ @@ -228,7 +228,6 @@ void acpi_ut_subsystem_shutdown(void) /* Subsystem appears active, go ahead and shut it down */ acpi_gbl_shutdown = TRUE; - acpi_gbl_startup_flags = 0; ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Shutting down ACPI Subsystem\n")); /* Close the acpi_event Handling */ @@ -246,5 +245,12 @@ void acpi_ut_subsystem_shutdown(void) /* Purge the local caches */ (void)acpi_ut_delete_caches(); + + /* Debug only - display leftover memory allocation, if any */ + +#ifdef ACPI_DBG_TRACK_ALLOCATIONS + acpi_ut_dump_allocations(ACPI_UINT32_MAX, NULL); +#endif + return_VOID; } diff --git a/trunk/drivers/acpi/utilities/utmath.c b/trunk/drivers/acpi/utilities/utmath.c index 19d74bedce27..4a3360484e72 100644 --- a/trunk/drivers/acpi/utilities/utmath.c +++ b/trunk/drivers/acpi/utilities/utmath.c @@ -77,7 +77,7 @@ acpi_ut_short_divide(acpi_integer dividend, union uint64_overlay quotient; u32 remainder32; - ACPI_FUNCTION_TRACE(ut_short_divide); + ACPI_FUNCTION_TRACE("ut_short_divide"); /* Always check for a zero divisor */ @@ -139,7 +139,7 @@ acpi_ut_divide(acpi_integer in_dividend, union uint64_overlay partial2; union uint64_overlay partial3; - ACPI_FUNCTION_TRACE(ut_divide); + ACPI_FUNCTION_TRACE("ut_divide"); /* Always check for a zero divisor */ @@ -261,7 +261,7 @@ acpi_ut_short_divide(acpi_integer in_dividend, acpi_integer * out_quotient, u32 * out_remainder) { - ACPI_FUNCTION_TRACE(ut_short_divide); + ACPI_FUNCTION_TRACE("ut_short_divide"); /* Always check for a zero divisor */ @@ -287,7 +287,7 @@ acpi_ut_divide(acpi_integer in_dividend, acpi_integer in_divisor, acpi_integer * out_quotient, acpi_integer * out_remainder) { - ACPI_FUNCTION_TRACE(ut_divide); + ACPI_FUNCTION_TRACE("ut_divide"); /* Always check for a zero divisor */ diff --git a/trunk/drivers/acpi/utilities/utmisc.c b/trunk/drivers/acpi/utilities/utmisc.c index 5c75d35ad1cd..7364f5f8c9cd 100644 --- a/trunk/drivers/acpi/utilities/utmisc.c +++ b/trunk/drivers/acpi/utilities/utmisc.c @@ -47,33 +47,6 @@ #define _COMPONENT ACPI_UTILITIES ACPI_MODULE_NAME("utmisc") -/******************************************************************************* - * - * FUNCTION: acpi_ut_is_aml_table - * - * PARAMETERS: Table - An ACPI table - * - * RETURN: TRUE if table contains executable AML; FALSE otherwise - * - * DESCRIPTION: Check ACPI Signature for a table that contains AML code. - * Currently, these are DSDT,SSDT,PSDT. All other table types are - * data tables that do not contain AML code. - * - ******************************************************************************/ -u8 acpi_ut_is_aml_table(struct acpi_table_header *table) -{ - - /* Ignore tables that contain AML */ - - if (ACPI_COMPARE_NAME(table->signature, DSDT_SIG) || - ACPI_COMPARE_NAME(table->signature, PSDT_SIG) || - ACPI_COMPARE_NAME(table->signature, SSDT_SIG)) { - return (TRUE); - } - - return (FALSE); -} - /******************************************************************************* * * FUNCTION: acpi_ut_allocate_owner_id @@ -87,7 +60,6 @@ u8 acpi_ut_is_aml_table(struct acpi_table_header *table) * when the method exits or the table is unloaded. * ******************************************************************************/ - acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id) { acpi_native_uint i; @@ -95,7 +67,7 @@ acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id) acpi_native_uint k; acpi_status status; - ACPI_FUNCTION_TRACE(ut_allocate_owner_id); + ACPI_FUNCTION_TRACE("ut_allocate_owner_id"); /* Guard against multiple allocations of ID to the same location */ @@ -125,7 +97,6 @@ acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id) for (k = acpi_gbl_next_owner_id_offset; k < 32; k++) { if (acpi_gbl_owner_id_mask[j] == ACPI_UINT32_MAX) { - /* There are no free IDs in this mask */ break; @@ -152,7 +123,7 @@ acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id) (acpi_owner_id) ((k + 1) + ACPI_MUL_32(j)); ACPI_DEBUG_PRINT((ACPI_DB_VALUES, - "Allocated OwnerId: %2.2X\n", + "Allocated owner_id: %2.2X\n", (unsigned int)*owner_id)); goto exit; } @@ -173,7 +144,7 @@ acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id) */ status = AE_OWNER_ID_LIMIT; ACPI_ERROR((AE_INFO, - "Could not allocate new OwnerId (255 max), AE_OWNER_ID_LIMIT")); + "Could not allocate new owner_id (255 max), AE_OWNER_ID_LIMIT")); exit: (void)acpi_ut_release_mutex(ACPI_MTX_CACHES); @@ -201,7 +172,7 @@ void acpi_ut_release_owner_id(acpi_owner_id * owner_id_ptr) acpi_native_uint index; u32 bit; - ACPI_FUNCTION_TRACE_U32(ut_release_owner_id, owner_id); + ACPI_FUNCTION_TRACE_U32("ut_release_owner_id", owner_id); /* Always clear the input owner_id (zero is an invalid ID) */ @@ -210,7 +181,7 @@ void acpi_ut_release_owner_id(acpi_owner_id * owner_id_ptr) /* Zero is not a valid owner_iD */ if (owner_id == 0) { - ACPI_ERROR((AE_INFO, "Invalid OwnerId: %2.2X", owner_id)); + ACPI_ERROR((AE_INFO, "Invalid owner_id: %2.2X", owner_id)); return_VOID; } @@ -236,7 +207,7 @@ void acpi_ut_release_owner_id(acpi_owner_id * owner_id_ptr) acpi_gbl_owner_id_mask[index] ^= bit; } else { ACPI_ERROR((AE_INFO, - "Release of non-allocated OwnerId: %2.2X", + "Release of non-allocated owner_id: %2.2X", owner_id + 1)); } @@ -302,7 +273,6 @@ void acpi_ut_print_string(char *string, u8 max_length) acpi_os_printf("\""); for (i = 0; string[i] && (i < max_length); i++) { - /* Escape sequences */ switch (string[i]) { @@ -491,45 +461,10 @@ acpi_ut_display_init_pathname(u8 type, } acpi_os_printf("\n"); - ACPI_FREE(buffer.pointer); + ACPI_MEM_FREE(buffer.pointer); } #endif -/******************************************************************************* - * - * FUNCTION: acpi_ut_valid_acpi_char - * - * PARAMETERS: Char - The character to be examined - * - * RETURN: TRUE if the character is valid, FALSE otherwise - * - * DESCRIPTION: Check for a valid ACPI character. Must be one of: - * 1) Upper case alpha - * 2) numeric - * 3) underscore - * - * We allow a '!' as the last character because of the ASF! table - * - ******************************************************************************/ - -u8 acpi_ut_valid_acpi_char(char character, acpi_native_uint position) -{ - - if (!((character >= 'A' && character <= 'Z') || - (character >= '0' && character <= '9') || (character == '_'))) { - - /* Allow a '!' in the last position */ - - if (character == '!' && position == 3) { - return (TRUE); - } - - return (FALSE); - } - - return (TRUE); -} - /******************************************************************************* * * FUNCTION: acpi_ut_valid_acpi_name @@ -547,13 +482,19 @@ u8 acpi_ut_valid_acpi_char(char character, acpi_native_uint position) u8 acpi_ut_valid_acpi_name(u32 name) { + char *name_ptr = (char *)&name; + char character; acpi_native_uint i; ACPI_FUNCTION_ENTRY(); for (i = 0; i < ACPI_NAME_SIZE; i++) { - if (!acpi_ut_valid_acpi_char - ((ACPI_CAST_PTR(char, &name))[i], i)) { + character = *name_ptr; + name_ptr++; + + if (!((character == '_') || + (character >= 'A' && character <= 'Z') || + (character >= '0' && character <= '9'))) { return (FALSE); } } @@ -563,37 +504,24 @@ u8 acpi_ut_valid_acpi_name(u32 name) /******************************************************************************* * - * FUNCTION: acpi_ut_repair_name + * FUNCTION: acpi_ut_valid_acpi_character * - * PARAMETERS: Name - The ACPI name to be repaired + * PARAMETERS: Character - The character to be examined * - * RETURN: Repaired version of the name + * RETURN: 1 if Character may appear in a name, else 0 * - * DESCRIPTION: Repair an ACPI name: Change invalid characters to '*' and - * return the new name. + * DESCRIPTION: Check for a printable character * ******************************************************************************/ -acpi_name acpi_ut_repair_name(acpi_name name) +u8 acpi_ut_valid_acpi_character(char character) { - char *name_ptr = ACPI_CAST_PTR(char, &name); - char new_name[ACPI_NAME_SIZE]; - acpi_native_uint i; - - for (i = 0; i < ACPI_NAME_SIZE; i++) { - new_name[i] = name_ptr[i]; - /* - * Replace a bad character with something printable, yet technically - * still invalid. This prevents any collisions with existing "good" - * names in the namespace. - */ - if (!acpi_ut_valid_acpi_char(name_ptr[i], i)) { - new_name[i] = '*'; - } - } + ACPI_FUNCTION_ENTRY(); - return (*ACPI_CAST_PTR(u32, new_name)); + return ((u8) ((character == '_') || + (character >= 'A' && character <= 'Z') || + (character >= '0' && character <= '9'))); } /******************************************************************************* @@ -601,8 +529,7 @@ acpi_name acpi_ut_repair_name(acpi_name name) * FUNCTION: acpi_ut_strtoul64 * * PARAMETERS: String - Null terminated string - * Base - Radix of the string: 16 or ACPI_ANY_BASE; - * ACPI_ANY_BASE means 'in behalf of to_integer' + * Base - Radix of the string: 10, 16, or ACPI_ANY_BASE * ret_integer - Where the converted integer is returned * * RETURN: Status and Converted value @@ -618,17 +545,16 @@ acpi_ut_strtoul64(char *string, u32 base, acpi_integer * ret_integer) u32 this_digit = 0; acpi_integer return_value = 0; acpi_integer quotient; - acpi_integer dividend; - u32 to_integer_op = (base == ACPI_ANY_BASE); - u32 mode32 = (acpi_gbl_integer_byte_width == 4); - u8 valid_digits = 0; - u8 sign_of0x = 0; - u8 term = 0; - ACPI_FUNCTION_TRACE(ut_stroul64); + ACPI_FUNCTION_TRACE("ut_stroul64"); + + if ((!string) || !(*string)) { + goto error_exit; + } switch (base) { case ACPI_ANY_BASE: + case 10: case 16: break; @@ -637,110 +563,76 @@ acpi_ut_strtoul64(char *string, u32 base, acpi_integer * ret_integer) return_ACPI_STATUS(AE_BAD_PARAMETER); } - if (!string) { - goto error_exit; - } - /* Skip over any white space in the buffer */ - while ((*string) && (ACPI_IS_SPACE(*string) || *string == '\t')) { + while (ACPI_IS_SPACE(*string) || *string == '\t') { string++; } - if (to_integer_op) { - /* - * Base equal to ACPI_ANY_BASE means 'to_integer operation case'. - * We need to determine if it is decimal or hexadecimal. - */ + /* + * If the input parameter Base is zero, then we need to + * determine if it is decimal or hexadecimal: + */ + if (base == 0) { if ((*string == '0') && (ACPI_TOLOWER(*(string + 1)) == 'x')) { - sign_of0x = 1; base = 16; - - /* Skip over the leading '0x' */ string += 2; } else { base = 10; } } - /* Any string left? Check that '0x' is not followed by white space. */ - - if (!(*string) || ACPI_IS_SPACE(*string) || *string == '\t') { - if (to_integer_op) { - goto error_exit; - } else { - goto all_done; - } + /* + * For hexadecimal base, skip over the leading + * 0 or 0x, if they are present. + */ + if ((base == 16) && + (*string == '0') && (ACPI_TOLOWER(*(string + 1)) == 'x')) { + string += 2; } - dividend = (mode32) ? ACPI_UINT32_MAX : ACPI_UINT64_MAX; + /* Any string left? */ - /* At least one character in the string here */ + if (!(*string)) { + goto error_exit; + } /* Main loop: convert the string to a 64-bit integer */ while (*string) { if (ACPI_IS_DIGIT(*string)) { - /* Convert ASCII 0-9 to Decimal value */ this_digit = ((u8) * string) - '0'; - } else if (base == 10) { + } else { + if (base == 10) { + /* Digit is out of range */ - /* Digit is out of range; possible in to_integer case only */ + goto error_exit; + } - term = 1; - } else { this_digit = (u8) ACPI_TOUPPER(*string); if (ACPI_IS_XDIGIT((char)this_digit)) { - /* Convert ASCII Hex char to value */ this_digit = this_digit - 'A' + 10; } else { - term = 1; - } - } - - if (term) { - if (to_integer_op) { - goto error_exit; - } else { + /* + * We allow non-hex chars, just stop now, same as end-of-string. + * See ACPI spec, string-to-integer conversion. + */ break; } - } else if ((valid_digits == 0) && (this_digit == 0) - && !sign_of0x) { - - /* Skip zeros */ - string++; - continue; - } - - valid_digits++; - - if (sign_of0x - && ((valid_digits > 16) - || ((valid_digits > 8) && mode32))) { - /* - * This is to_integer operation case. - * No any restrictions for string-to-integer conversion, - * see ACPI spec. - */ - goto error_exit; } /* Divide the digit into the correct position */ (void) - acpi_ut_short_divide((dividend - (acpi_integer) this_digit), - base, "ient, NULL); - + acpi_ut_short_divide((ACPI_INTEGER_MAX - + (acpi_integer) this_digit), base, + "ient, NULL); if (return_value > quotient) { - if (to_integer_op) { - goto error_exit; - } else { - break; - } + goto error_exit; } return_value *= base; @@ -750,8 +642,6 @@ acpi_ut_strtoul64(char *string, u32 base, acpi_integer * ret_integer) /* All done, normal exit */ - all_done: - *ret_integer = return_value; return_ACPI_STATUS(AE_OK); @@ -829,7 +719,7 @@ acpi_ut_walk_package_tree(union acpi_operand_object * source_object, u32 this_index; union acpi_operand_object *this_source_obj; - ACPI_FUNCTION_TRACE(ut_walk_package_tree); + ACPI_FUNCTION_TRACE("ut_walk_package_tree"); state = acpi_ut_create_pkg_state(source_object, target_object, 0); if (!state) { @@ -837,7 +727,6 @@ acpi_ut_walk_package_tree(union acpi_operand_object * source_object, } while (state) { - /* Get one element of the package */ this_index = state->pkg.index; @@ -923,6 +812,31 @@ acpi_ut_walk_package_tree(union acpi_operand_object * source_object, return_ACPI_STATUS(AE_AML_INTERNAL); } +/******************************************************************************* + * + * FUNCTION: acpi_ut_generate_checksum + * + * PARAMETERS: Buffer - Buffer to be scanned + * Length - number of bytes to examine + * + * RETURN: The generated checksum + * + * DESCRIPTION: Generate a checksum on a raw buffer + * + ******************************************************************************/ + +u8 acpi_ut_generate_checksum(u8 * buffer, u32 length) +{ + u32 i; + signed char sum = 0; + + for (i = 0; i < length; i++) { + sum = (signed char)(sum + buffer[i]); + } + + return ((u8) (0 - sum)); +} + /******************************************************************************* * * FUNCTION: acpi_ut_error, acpi_ut_warning, acpi_ut_info @@ -986,3 +900,36 @@ acpi_ut_info(char *module_name, u32 line_number, char *format, ...) acpi_os_vprintf(format, args); acpi_os_printf(" [%X]\n", ACPI_CA_VERSION); } + +/******************************************************************************* + * + * FUNCTION: acpi_ut_report_error, Warning, Info + * + * PARAMETERS: module_name - Caller's module name (for error output) + * line_number - Caller's line number (for error output) + * + * RETURN: None + * + * DESCRIPTION: Print error message + * + * Note: Legacy only, should be removed when no longer used by drivers. + * + ******************************************************************************/ + +void acpi_ut_report_error(char *module_name, u32 line_number) +{ + + acpi_os_printf("ACPI Error (%s-%04d): ", module_name, line_number); +} + +void acpi_ut_report_warning(char *module_name, u32 line_number) +{ + + acpi_os_printf("ACPI Warning (%s-%04d): ", module_name, line_number); +} + +void acpi_ut_report_info(char *module_name, u32 line_number) +{ + + acpi_os_printf("ACPI (%s-%04d): ", module_name, line_number); +} diff --git a/trunk/drivers/acpi/utilities/utmutex.c b/trunk/drivers/acpi/utilities/utmutex.c index 25eb34369afa..45a7244df924 100644 --- a/trunk/drivers/acpi/utilities/utmutex.c +++ b/trunk/drivers/acpi/utilities/utmutex.c @@ -68,26 +68,19 @@ acpi_status acpi_ut_mutex_initialize(void) u32 i; acpi_status status; - ACPI_FUNCTION_TRACE(ut_mutex_initialize); + ACPI_FUNCTION_TRACE("ut_mutex_initialize"); /* * Create each of the predefined mutex objects */ - for (i = 0; i < ACPI_NUM_MUTEX; i++) { + for (i = 0; i < NUM_MUTEX; i++) { status = acpi_ut_create_mutex(i); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); } } - /* Create the spinlocks for use at interrupt level */ - status = acpi_os_create_lock(&acpi_gbl_gpe_lock); - if (ACPI_FAILURE(status)) { - return_ACPI_STATUS(status); - } - - status = acpi_os_create_lock(&acpi_gbl_hardware_lock); return_ACPI_STATUS(status); } @@ -107,19 +100,16 @@ void acpi_ut_mutex_terminate(void) { u32 i; - ACPI_FUNCTION_TRACE(ut_mutex_terminate); + ACPI_FUNCTION_TRACE("ut_mutex_terminate"); /* * Delete each predefined mutex object */ - for (i = 0; i < ACPI_NUM_MUTEX; i++) { + for (i = 0; i < NUM_MUTEX; i++) { (void)acpi_ut_delete_mutex(i); } - /* Delete the spinlocks */ - acpi_os_delete_lock(acpi_gbl_gpe_lock); - acpi_os_delete_lock(acpi_gbl_hardware_lock); return_VOID; } @@ -139,9 +129,9 @@ static acpi_status acpi_ut_create_mutex(acpi_mutex_handle mutex_id) { acpi_status status = AE_OK; - ACPI_FUNCTION_TRACE_U32(ut_create_mutex, mutex_id); + ACPI_FUNCTION_TRACE_U32("ut_create_mutex", mutex_id); - if (mutex_id > ACPI_MAX_MUTEX) { + if (mutex_id > MAX_MUTEX) { return_ACPI_STATUS(AE_BAD_PARAMETER); } @@ -173,9 +163,9 @@ static acpi_status acpi_ut_delete_mutex(acpi_mutex_handle mutex_id) { acpi_status status; - ACPI_FUNCTION_TRACE_U32(ut_delete_mutex, mutex_id); + ACPI_FUNCTION_TRACE_U32("ut_delete_mutex", mutex_id); - if (mutex_id > ACPI_MAX_MUTEX) { + if (mutex_id > MAX_MUTEX) { return_ACPI_STATUS(AE_BAD_PARAMETER); } @@ -202,11 +192,11 @@ static acpi_status acpi_ut_delete_mutex(acpi_mutex_handle mutex_id) acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id) { acpi_status status; - acpi_thread_id this_thread_id; + u32 this_thread_id; - ACPI_FUNCTION_NAME(ut_acquire_mutex); + ACPI_FUNCTION_NAME("ut_acquire_mutex"); - if (mutex_id > ACPI_MAX_MUTEX) { + if (mutex_id > MAX_MUTEX) { return (AE_BAD_PARAMETER); } @@ -223,7 +213,7 @@ acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id) * the mutex ordering rule. This indicates a coding error somewhere in * the ACPI subsystem code. */ - for (i = mutex_id; i < ACPI_MAX_MUTEX; i++) { + for (i = mutex_id; i < MAX_MUTEX; i++) { if (acpi_gbl_mutex_info[i].thread_id == this_thread_id) { if (i == mutex_id) { ACPI_ERROR((AE_INFO, @@ -285,16 +275,16 @@ acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id) acpi_status acpi_ut_release_mutex(acpi_mutex_handle mutex_id) { acpi_status status; - acpi_thread_id this_thread_id; + u32 this_thread_id; - ACPI_FUNCTION_NAME(ut_release_mutex); + ACPI_FUNCTION_NAME("ut_release_mutex"); this_thread_id = acpi_os_get_thread_id(); ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Thread %X releasing Mutex [%s]\n", this_thread_id, acpi_ut_get_mutex_name(mutex_id))); - if (mutex_id > ACPI_MAX_MUTEX) { + if (mutex_id > MAX_MUTEX) { return (AE_BAD_PARAMETER); } @@ -319,7 +309,7 @@ acpi_status acpi_ut_release_mutex(acpi_mutex_handle mutex_id) * ordering rule. This indicates a coding error somewhere in * the ACPI subsystem code. */ - for (i = mutex_id; i < ACPI_MAX_MUTEX; i++) { + for (i = mutex_id; i < MAX_MUTEX; i++) { if (acpi_gbl_mutex_info[i].thread_id == this_thread_id) { if (i == mutex_id) { continue; diff --git a/trunk/drivers/acpi/utilities/utobject.c b/trunk/drivers/acpi/utilities/utobject.c index ba7d8ac702df..7ee2d1d98071 100644 --- a/trunk/drivers/acpi/utilities/utobject.c +++ b/trunk/drivers/acpi/utilities/utobject.c @@ -92,7 +92,7 @@ union acpi_operand_object *acpi_ut_create_internal_object_dbg(char *module_name, union acpi_operand_object *object; union acpi_operand_object *second_object; - ACPI_FUNCTION_TRACE_STR(ut_create_internal_object_dbg, + ACPI_FUNCTION_TRACE_STR("ut_create_internal_object_dbg", acpi_ut_get_type_name(type)); /* Allocate the raw object descriptor */ @@ -161,7 +161,7 @@ union acpi_operand_object *acpi_ut_create_buffer_object(acpi_size buffer_size) union acpi_operand_object *buffer_desc; u8 *buffer = NULL; - ACPI_FUNCTION_TRACE_U32(ut_create_buffer_object, buffer_size); + ACPI_FUNCTION_TRACE_U32("ut_create_buffer_object", buffer_size); /* Create a new Buffer object */ @@ -173,10 +173,9 @@ union acpi_operand_object *acpi_ut_create_buffer_object(acpi_size buffer_size) /* Create an actual buffer only if size > 0 */ if (buffer_size > 0) { - /* Allocate the actual buffer */ - buffer = ACPI_ALLOCATE_ZEROED(buffer_size); + buffer = ACPI_MEM_CALLOCATE(buffer_size); if (!buffer) { ACPI_ERROR((AE_INFO, "Could not allocate size %X", (u32) buffer_size)); @@ -215,7 +214,7 @@ union acpi_operand_object *acpi_ut_create_string_object(acpi_size string_size) union acpi_operand_object *string_desc; char *string; - ACPI_FUNCTION_TRACE_U32(ut_create_string_object, string_size); + ACPI_FUNCTION_TRACE_U32("ut_create_string_object", string_size); /* Create a new String object */ @@ -228,7 +227,7 @@ union acpi_operand_object *acpi_ut_create_string_object(acpi_size string_size) * Allocate the actual string buffer -- (Size + 1) for NULL terminator. * NOTE: Zero-length strings are NULL terminated */ - string = ACPI_ALLOCATE_ZEROED(string_size + 1); + string = ACPI_MEM_CALLOCATE(string_size + 1); if (!string) { ACPI_ERROR((AE_INFO, "Could not allocate size %X", (u32) string_size)); @@ -261,7 +260,7 @@ union acpi_operand_object *acpi_ut_create_string_object(acpi_size string_size) u8 acpi_ut_valid_internal_object(void *object) { - ACPI_FUNCTION_NAME(ut_valid_internal_object); + ACPI_FUNCTION_NAME("ut_valid_internal_object"); /* Check for a null pointer */ @@ -309,7 +308,7 @@ void *acpi_ut_allocate_object_desc_dbg(char *module_name, { union acpi_operand_object *object; - ACPI_FUNCTION_TRACE(ut_allocate_object_desc_dbg); + ACPI_FUNCTION_TRACE("ut_allocate_object_desc_dbg"); object = acpi_os_acquire_object(acpi_gbl_operand_cache); if (!object) { @@ -320,7 +319,6 @@ void *acpi_ut_allocate_object_desc_dbg(char *module_name, } /* Mark the descriptor type */ - memset(object, 0, sizeof(union acpi_operand_object)); ACPI_SET_DESCRIPTOR_TYPE(object, ACPI_DESC_TYPE_OPERAND); @@ -344,7 +342,7 @@ void *acpi_ut_allocate_object_desc_dbg(char *module_name, void acpi_ut_delete_object_desc(union acpi_operand_object *object) { - ACPI_FUNCTION_TRACE_PTR(ut_delete_object_desc, object); + ACPI_FUNCTION_TRACE_PTR("ut_delete_object_desc", object); /* Object must be an union acpi_operand_object */ @@ -383,7 +381,7 @@ acpi_ut_get_simple_object_size(union acpi_operand_object *internal_object, acpi_size length; acpi_status status = AE_OK; - ACPI_FUNCTION_TRACE_PTR(ut_get_simple_object_size, internal_object); + ACPI_FUNCTION_TRACE_PTR("ut_get_simple_object_size", internal_object); /* * Handle a null object (Could be a uninitialized package @@ -399,7 +397,6 @@ acpi_ut_get_simple_object_size(union acpi_operand_object *internal_object, length = sizeof(union acpi_object); if (ACPI_GET_DESCRIPTOR_TYPE(internal_object) == ACPI_DESC_TYPE_NAMED) { - /* Object is a named object (reference), just return the length */ *obj_length = ACPI_ROUND_UP_TO_NATIVE_WORD(length); @@ -562,7 +559,7 @@ acpi_ut_get_package_object_size(union acpi_operand_object *internal_object, acpi_status status; struct acpi_pkg_info info; - ACPI_FUNCTION_TRACE_PTR(ut_get_package_object_size, internal_object); + ACPI_FUNCTION_TRACE_PTR("ut_get_package_object_size", internal_object); info.length = 0; info.object_space = 0; diff --git a/trunk/drivers/acpi/utilities/utresrc.c b/trunk/drivers/acpi/utilities/utresrc.c index 5a2de92831d3..16461317113f 100644 --- a/trunk/drivers/acpi/utilities/utresrc.c +++ b/trunk/drivers/acpi/utilities/utresrc.c @@ -45,113 +45,113 @@ #include #define _COMPONENT ACPI_UTILITIES -ACPI_MODULE_NAME("utresrc") +ACPI_MODULE_NAME("utmisc") #if defined(ACPI_DISASSEMBLER) || defined (ACPI_DEBUGGER) /* * Strings used to decode resource descriptors. * Used by both the disasssembler and the debugger resource dump routines */ -const char *acpi_gbl_bm_decode[] = { - "NotBusMaster", - "BusMaster" +const char *acpi_gbl_BMdecode[2] = { + "not_bus_master", + "bus_master" }; -const char *acpi_gbl_config_decode[] = { +const char *acpi_gbl_config_decode[4] = { "0 - Good Configuration", "1 - Acceptable Configuration", "2 - Suboptimal Configuration", "3 - ***Invalid Configuration***", }; -const char *acpi_gbl_consume_decode[] = { - "ResourceProducer", - "ResourceConsumer" +const char *acpi_gbl_consume_decode[2] = { + "resource_producer", + "resource_consumer" }; -const char *acpi_gbl_dec_decode[] = { - "PosDecode", - "SubDecode" +const char *acpi_gbl_DECdecode[2] = { + "pos_decode", + "sub_decode" }; -const char *acpi_gbl_he_decode[] = { +const char *acpi_gbl_HEdecode[2] = { "Level", "Edge" }; -const char *acpi_gbl_io_decode[] = { +const char *acpi_gbl_io_decode[2] = { "Decode10", "Decode16" }; -const char *acpi_gbl_ll_decode[] = { - "ActiveHigh", - "ActiveLow" +const char *acpi_gbl_LLdecode[2] = { + "active_high", + "active_low" }; -const char *acpi_gbl_max_decode[] = { - "MaxNotFixed", - "MaxFixed" +const char *acpi_gbl_max_decode[2] = { + "max_not_fixed", + "max_fixed" }; -const char *acpi_gbl_mem_decode[] = { - "NonCacheable", +const char *acpi_gbl_MEMdecode[4] = { + "non_cacheable", "Cacheable", - "WriteCombining", + "write_combining", "Prefetchable" }; -const char *acpi_gbl_min_decode[] = { - "MinNotFixed", - "MinFixed" +const char *acpi_gbl_min_decode[2] = { + "min_not_fixed", + "min_fixed" }; -const char *acpi_gbl_mtp_decode[] = { - "AddressRangeMemory", - "AddressRangeReserved", - "AddressRangeACPI", - "AddressRangeNVS" +const char *acpi_gbl_MTPdecode[4] = { + "address_range_memory", + "address_range_reserved", + "address_range_aCPI", + "address_range_nVS" }; -const char *acpi_gbl_rng_decode[] = { - "InvalidRanges", - "NonISAOnlyRanges", - "ISAOnlyRanges", - "EntireRange" +const char *acpi_gbl_RNGdecode[4] = { + "invalid_ranges", + "non_iSAonly_ranges", + "ISAonly_ranges", + "entire_range" }; -const char *acpi_gbl_rw_decode[] = { - "ReadOnly", - "ReadWrite" +const char *acpi_gbl_RWdecode[2] = { + "read_only", + "read_write" }; -const char *acpi_gbl_shr_decode[] = { +const char *acpi_gbl_SHRdecode[2] = { "Exclusive", "Shared" }; -const char *acpi_gbl_siz_decode[] = { +const char *acpi_gbl_SIZdecode[4] = { "Transfer8", "Transfer8_16", "Transfer16", - "InvalidSize" + "invalid_size" }; -const char *acpi_gbl_trs_decode[] = { - "DenseTranslation", - "SparseTranslation" +const char *acpi_gbl_TRSdecode[2] = { + "dense_translation", + "sparse_translation" }; -const char *acpi_gbl_ttp_decode[] = { - "TypeStatic", - "TypeTranslation" +const char *acpi_gbl_TTPdecode[2] = { + "type_static", + "type_translation" }; -const char *acpi_gbl_typ_decode[] = { +const char *acpi_gbl_TYPdecode[4] = { "Compatibility", - "TypeA", - "TypeB", - "TypeF" + "type_a", + "type_b", + "type_f" }; #endif @@ -238,104 +238,6 @@ static const u8 acpi_gbl_resource_types[] = { ACPI_FIXED_LENGTH }; -/******************************************************************************* - * - * FUNCTION: acpi_ut_walk_aml_resources - * - * PARAMETERS: Aml - Pointer to the raw AML resource template - * aml_length - Length of the entire template - * user_function - Called once for each descriptor found. If - * NULL, a pointer to the end_tag is returned - * Context - Passed to user_function - * - * RETURN: Status - * - * DESCRIPTION: Walk a raw AML resource list(buffer). User function called - * once for each resource found. - * - ******************************************************************************/ - -acpi_status -acpi_ut_walk_aml_resources(u8 * aml, - acpi_size aml_length, - acpi_walk_aml_callback user_function, void **context) -{ - acpi_status status; - u8 *end_aml; - u8 resource_index; - u32 length; - u32 offset = 0; - - ACPI_FUNCTION_TRACE(ut_walk_aml_resources); - - /* The absolute minimum resource template is one end_tag descriptor */ - - if (aml_length < sizeof(struct aml_resource_end_tag)) { - return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG); - } - - /* Point to the end of the resource template buffer */ - - end_aml = aml + aml_length; - - /* Walk the byte list, abort on any invalid descriptor type or length */ - - while (aml < end_aml) { - - /* Validate the Resource Type and Resource Length */ - - status = acpi_ut_validate_resource(aml, &resource_index); - if (ACPI_FAILURE(status)) { - return_ACPI_STATUS(status); - } - - /* Get the length of this descriptor */ - - length = acpi_ut_get_descriptor_length(aml); - - /* Invoke the user function */ - - if (user_function) { - status = - user_function(aml, length, offset, resource_index, - context); - if (ACPI_FAILURE(status)) { - return (status); - } - } - - /* An end_tag descriptor terminates this resource template */ - - if (acpi_ut_get_resource_type(aml) == - ACPI_RESOURCE_NAME_END_TAG) { - /* - * There must be at least one more byte in the buffer for - * the 2nd byte of the end_tag - */ - if ((aml + 1) >= end_aml) { - return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG); - } - - /* Return the pointer to the end_tag if requested */ - - if (!user_function) { - *context = aml; - } - - /* Normal exit */ - - return_ACPI_STATUS(AE_OK); - } - - aml += length; - offset += length; - } - - /* Did not find an end_tag descriptor */ - - return (AE_AML_NO_RESOURCE_END_TAG); -} - /******************************************************************************* * * FUNCTION: acpi_ut_validate_resource @@ -371,7 +273,6 @@ acpi_status acpi_ut_validate_resource(void *aml, u8 * return_index) * Examine the large/small bit in the resource header */ if (resource_type & ACPI_RESOURCE_NAME_LARGE) { - /* Verify the large resource type (name) against the max */ if (resource_type > ACPI_RESOURCE_NAME_LARGE_MAX) { @@ -475,7 +376,6 @@ u8 acpi_ut_get_resource_type(void *aml) * Examine the large/small bit in the resource header */ if (ACPI_GET8(aml) & ACPI_RESOURCE_NAME_LARGE) { - /* Large Resource Type -- bits 6:0 contain the name */ return (ACPI_GET8(aml)); @@ -511,7 +411,6 @@ u16 acpi_ut_get_resource_length(void *aml) * Examine the large/small bit in the resource header */ if (ACPI_GET8(aml) & ACPI_RESOURCE_NAME_LARGE) { - /* Large Resource type -- bytes 1-2 contain the 16-bit length */ ACPI_MOVE_16_TO_16(&resource_length, ACPI_ADD_PTR(u8, aml, 1)); @@ -596,21 +495,60 @@ acpi_ut_get_resource_end_tag(union acpi_operand_object * obj_desc, u8 ** end_tag) { acpi_status status; + u8 *aml; + u8 *end_aml; + + ACPI_FUNCTION_TRACE("ut_get_resource_end_tag"); - ACPI_FUNCTION_TRACE(ut_get_resource_end_tag); + /* Get start and end pointers */ + + aml = obj_desc->buffer.pointer; + end_aml = aml + obj_desc->buffer.length; /* Allow a buffer length of zero */ if (!obj_desc->buffer.length) { - *end_tag = obj_desc->buffer.pointer; + *end_tag = aml; return_ACPI_STATUS(AE_OK); } - /* Validate the template and get a pointer to the end_tag */ + /* Walk the resource template, one descriptor per iteration */ + + while (aml < end_aml) { + /* Validate the Resource Type and Resource Length */ + + status = acpi_ut_validate_resource(aml, NULL); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); + } + + /* end_tag resource indicates the end of the resource template */ + + if (acpi_ut_get_resource_type(aml) == + ACPI_RESOURCE_NAME_END_TAG) { + /* + * There must be at least one more byte in the buffer for + * the 2nd byte of the end_tag + */ + if ((aml + 1) >= end_aml) { + return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG); + } + + /* Return the pointer to the end_tag */ + + *end_tag = aml; + return_ACPI_STATUS(AE_OK); + } + + /* + * Point to the next resource descriptor in the AML buffer. The + * descriptor length is guaranteed to be non-zero by resource + * validation above. + */ + aml += acpi_ut_get_descriptor_length(aml); + } - status = acpi_ut_walk_aml_resources(obj_desc->buffer.pointer, - obj_desc->buffer.length, NULL, - (void **)end_tag); + /* Did not find an end_tag resource descriptor */ - return_ACPI_STATUS(status); + return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG); } diff --git a/trunk/drivers/acpi/utilities/utstate.c b/trunk/drivers/acpi/utilities/utstate.c index 0f5c5bb5deff..4b134a722907 100644 --- a/trunk/drivers/acpi/utilities/utstate.c +++ b/trunk/drivers/acpi/utilities/utstate.c @@ -96,7 +96,7 @@ void acpi_ut_push_generic_state(union acpi_generic_state **list_head, union acpi_generic_state *state) { - ACPI_FUNCTION_TRACE(ut_push_generic_state); + ACPI_FUNCTION_TRACE("ut_push_generic_state"); /* Push the state object onto the front of the list (stack) */ @@ -123,13 +123,12 @@ union acpi_generic_state *acpi_ut_pop_generic_state(union acpi_generic_state { union acpi_generic_state *state; - ACPI_FUNCTION_TRACE(ut_pop_generic_state); + ACPI_FUNCTION_TRACE("ut_pop_generic_state"); /* Remove the state object at the head of the list (stack) */ state = *list_head; if (state) { - /* Update the list head */ *list_head = state->common.next; @@ -159,10 +158,9 @@ union acpi_generic_state *acpi_ut_create_generic_state(void) state = acpi_os_acquire_object(acpi_gbl_state_cache); if (state) { - /* Initialize */ memset(state, 0, sizeof(union acpi_generic_state)); - state->common.descriptor_type = ACPI_DESC_TYPE_STATE; + state->common.data_type = ACPI_DESC_TYPE_STATE; } return (state); @@ -185,7 +183,7 @@ struct acpi_thread_state *acpi_ut_create_thread_state(void) { union acpi_generic_state *state; - ACPI_FUNCTION_TRACE(ut_create_thread_state); + ACPI_FUNCTION_TRACE("ut_create_thread_state"); /* Create the generic state object */ @@ -196,7 +194,7 @@ struct acpi_thread_state *acpi_ut_create_thread_state(void) /* Init fields specific to the update struct */ - state->common.descriptor_type = ACPI_DESC_TYPE_STATE_THREAD; + state->common.data_type = ACPI_DESC_TYPE_STATE_THREAD; state->thread.thread_id = acpi_os_get_thread_id(); return_PTR((struct acpi_thread_state *)state); @@ -222,7 +220,7 @@ union acpi_generic_state *acpi_ut_create_update_state(union acpi_operand_object { union acpi_generic_state *state; - ACPI_FUNCTION_TRACE_PTR(ut_create_update_state, object); + ACPI_FUNCTION_TRACE_PTR("ut_create_update_state", object); /* Create the generic state object */ @@ -233,7 +231,7 @@ union acpi_generic_state *acpi_ut_create_update_state(union acpi_operand_object /* Init fields specific to the update struct */ - state->common.descriptor_type = ACPI_DESC_TYPE_STATE_UPDATE; + state->common.data_type = ACPI_DESC_TYPE_STATE_UPDATE; state->update.object = object; state->update.value = action; @@ -259,7 +257,7 @@ union acpi_generic_state *acpi_ut_create_pkg_state(void *internal_object, { union acpi_generic_state *state; - ACPI_FUNCTION_TRACE_PTR(ut_create_pkg_state, internal_object); + ACPI_FUNCTION_TRACE_PTR("ut_create_pkg_state", internal_object); /* Create the generic state object */ @@ -270,7 +268,7 @@ union acpi_generic_state *acpi_ut_create_pkg_state(void *internal_object, /* Init fields specific to the update struct */ - state->common.descriptor_type = ACPI_DESC_TYPE_STATE_PACKAGE; + state->common.data_type = ACPI_DESC_TYPE_STATE_PACKAGE; state->pkg.source_object = (union acpi_operand_object *)internal_object; state->pkg.dest_object = external_object; state->pkg.index = index; @@ -296,7 +294,7 @@ union acpi_generic_state *acpi_ut_create_control_state(void) { union acpi_generic_state *state; - ACPI_FUNCTION_TRACE(ut_create_control_state); + ACPI_FUNCTION_TRACE("ut_create_control_state"); /* Create the generic state object */ @@ -307,7 +305,7 @@ union acpi_generic_state *acpi_ut_create_control_state(void) /* Init fields specific to the control struct */ - state->common.descriptor_type = ACPI_DESC_TYPE_STATE_CONTROL; + state->common.data_type = ACPI_DESC_TYPE_STATE_CONTROL; state->common.state = ACPI_CONTROL_CONDITIONAL_EXECUTING; return_PTR(state); @@ -321,19 +319,15 @@ union acpi_generic_state *acpi_ut_create_control_state(void) * * RETURN: None * - * DESCRIPTION: Release a state object to the state cache. NULL state objects - * are ignored. + * DESCRIPTION: Put a state object back into the global state cache. The object + * is not actually freed at this time. * ******************************************************************************/ void acpi_ut_delete_generic_state(union acpi_generic_state *state) { - ACPI_FUNCTION_TRACE(ut_delete_generic_state); - - /* Ignore null state */ + ACPI_FUNCTION_TRACE("ut_delete_generic_state"); - if (state) { - (void)acpi_os_release_object(acpi_gbl_state_cache, state); - } + (void)acpi_os_release_object(acpi_gbl_state_cache, state); return_VOID; } diff --git a/trunk/drivers/acpi/utilities/utxface.c b/trunk/drivers/acpi/utilities/utxface.c index 3538f69c82a1..308a960871be 100644 --- a/trunk/drivers/acpi/utilities/utxface.c +++ b/trunk/drivers/acpi/utilities/utxface.c @@ -41,6 +41,8 @@ * POSSIBILITY OF SUCH DAMAGES. */ +#include + #include #include #include @@ -65,7 +67,7 @@ acpi_status acpi_initialize_subsystem(void) { acpi_status status; - ACPI_FUNCTION_TRACE(acpi_initialize_subsystem); + ACPI_FUNCTION_TRACE("acpi_initialize_subsystem"); ACPI_DEBUG_EXEC(acpi_ut_init_stack_ptr_trace()); @@ -107,8 +109,6 @@ acpi_status acpi_initialize_subsystem(void) return_ACPI_STATUS(status); } -ACPI_EXPORT_SYMBOL(acpi_initialize_subsystem) - /******************************************************************************* * * FUNCTION: acpi_enable_subsystem @@ -121,11 +121,12 @@ ACPI_EXPORT_SYMBOL(acpi_initialize_subsystem) * Puts system into ACPI mode if it isn't already. * ******************************************************************************/ + acpi_status acpi_enable_subsystem(u32 flags) { acpi_status status = AE_OK; - ACPI_FUNCTION_TRACE(acpi_enable_subsystem); + ACPI_FUNCTION_TRACE("acpi_enable_subsystem"); /* * We must initialize the hardware before we can enable ACPI. @@ -151,7 +152,7 @@ acpi_status acpi_enable_subsystem(u32 flags) status = acpi_enable(); if (ACPI_FAILURE(status)) { - ACPI_WARNING((AE_INFO, "AcpiEnable failed")); + ACPI_WARNING((AE_INFO, "acpi_enable failed")); return_ACPI_STATUS(status); } } @@ -228,8 +229,6 @@ acpi_status acpi_enable_subsystem(u32 flags) return_ACPI_STATUS(status); } -ACPI_EXPORT_SYMBOL(acpi_enable_subsystem) - /******************************************************************************* * * FUNCTION: acpi_initialize_objects @@ -242,11 +241,12 @@ ACPI_EXPORT_SYMBOL(acpi_enable_subsystem) * objects and executing AML code for Regions, buffers, etc. * ******************************************************************************/ + acpi_status acpi_initialize_objects(u32 flags) { acpi_status status = AE_OK; - ACPI_FUNCTION_TRACE(acpi_initialize_objects); + ACPI_FUNCTION_TRACE("acpi_initialize_objects"); /* * Run all _REG methods @@ -257,7 +257,7 @@ acpi_status acpi_initialize_objects(u32 flags) */ if (!(flags & ACPI_NO_ADDRESS_SPACE_INIT)) { ACPI_DEBUG_PRINT((ACPI_DB_EXEC, - "[Init] Executing _REG OpRegion methods\n")); + "[Init] Executing _REG op_region methods\n")); status = acpi_ev_initialize_op_regions(); if (ACPI_FAILURE(status)) { @@ -305,8 +305,6 @@ acpi_status acpi_initialize_objects(u32 flags) return_ACPI_STATUS(status); } -ACPI_EXPORT_SYMBOL(acpi_initialize_objects) - /******************************************************************************* * * FUNCTION: acpi_terminate @@ -318,11 +316,12 @@ ACPI_EXPORT_SYMBOL(acpi_initialize_objects) * DESCRIPTION: Shutdown the ACPI subsystem. Release all resources. * ******************************************************************************/ + acpi_status acpi_terminate(void) { acpi_status status; - ACPI_FUNCTION_TRACE(acpi_terminate); + ACPI_FUNCTION_TRACE("acpi_terminate"); /* Terminate the AML Debugger if present */ @@ -349,8 +348,6 @@ acpi_status acpi_terminate(void) return_ACPI_STATUS(status); } -ACPI_EXPORT_SYMBOL(acpi_terminate) - #ifdef ACPI_FUTURE_USAGE /******************************************************************************* * @@ -365,6 +362,7 @@ ACPI_EXPORT_SYMBOL(acpi_terminate) * initialized successfully. * ******************************************************************************/ + acpi_status acpi_subsystem_status(void) { @@ -375,8 +373,6 @@ acpi_status acpi_subsystem_status(void) } } -ACPI_EXPORT_SYMBOL(acpi_subsystem_status) - /******************************************************************************* * * FUNCTION: acpi_get_system_info @@ -394,13 +390,14 @@ ACPI_EXPORT_SYMBOL(acpi_subsystem_status) * and the value of out_buffer is undefined. * ******************************************************************************/ + acpi_status acpi_get_system_info(struct acpi_buffer * out_buffer) { struct acpi_system_info *info_ptr; acpi_status status; u32 i; - ACPI_FUNCTION_TRACE(acpi_get_system_info); + ACPI_FUNCTION_TRACE("acpi_get_system_info"); /* Parameter validation */ @@ -451,15 +448,15 @@ acpi_status acpi_get_system_info(struct acpi_buffer * out_buffer) /* Current status of the ACPI tables, per table type */ - info_ptr->num_table_types = ACPI_TABLE_ID_MAX + 1; - for (i = 0; i < (ACPI_TABLE_ID_MAX + 1); i++) { + info_ptr->num_table_types = NUM_ACPI_TABLE_TYPES; + for (i = 0; i < NUM_ACPI_TABLE_TYPES; i++) { info_ptr->table_info[i].count = acpi_gbl_table_lists[i].count; } return_ACPI_STATUS(AE_OK); } -ACPI_EXPORT_SYMBOL(acpi_get_system_info) +EXPORT_SYMBOL(acpi_get_system_info); /***************************************************************************** * @@ -475,6 +472,7 @@ ACPI_EXPORT_SYMBOL(acpi_get_system_info) * TBD: When a second function is added, must save the Function also. * ****************************************************************************/ + acpi_status acpi_install_initialization_handler(acpi_init_handler handler, u32 function) { @@ -491,7 +489,6 @@ acpi_install_initialization_handler(acpi_init_handler handler, u32 function) return AE_OK; } -ACPI_EXPORT_SYMBOL(acpi_install_initialization_handler) #endif /* ACPI_FUTURE_USAGE */ /***************************************************************************** @@ -505,9 +502,10 @@ ACPI_EXPORT_SYMBOL(acpi_install_initialization_handler) * DESCRIPTION: Empty all caches (delete the cached objects) * ****************************************************************************/ + acpi_status acpi_purge_cached_objects(void) { - ACPI_FUNCTION_TRACE(acpi_purge_cached_objects); + ACPI_FUNCTION_TRACE("acpi_purge_cached_objects"); (void)acpi_os_purge_cache(acpi_gbl_state_cache); (void)acpi_os_purge_cache(acpi_gbl_operand_cache); @@ -515,5 +513,3 @@ acpi_status acpi_purge_cached_objects(void) (void)acpi_os_purge_cache(acpi_gbl_ps_node_ext_cache); return_ACPI_STATUS(AE_OK); } - -ACPI_EXPORT_SYMBOL(acpi_purge_cached_objects) diff --git a/trunk/drivers/acpi/utils.c b/trunk/drivers/acpi/utils.c index 6b516852ac12..6458c47f7ac2 100644 --- a/trunk/drivers/acpi/utils.c +++ b/trunk/drivers/acpi/utils.c @@ -273,13 +273,11 @@ acpi_evaluate_integer(acpi_handle handle, status = acpi_evaluate_object(handle, pathname, arguments, &buffer); if (ACPI_FAILURE(status)) { acpi_util_eval_error(handle, pathname, status); - kfree(element); return_ACPI_STATUS(status); } if (element->type != ACPI_TYPE_INTEGER) { acpi_util_eval_error(handle, pathname, AE_BAD_DATA); - kfree(element); return_ACPI_STATUS(AE_BAD_DATA); } diff --git a/trunk/drivers/acpi/video.c b/trunk/drivers/acpi/video.c index 86531ab4ee55..bd4887518373 100644 --- a/trunk/drivers/acpi/video.c +++ b/trunk/drivers/acpi/video.c @@ -323,7 +323,7 @@ acpi_video_device_lcd_query_levels(struct acpi_video_device *device, if (!ACPI_SUCCESS(status)) return_VALUE(status); obj = (union acpi_object *)buffer.pointer; - if (!obj || (obj->type != ACPI_TYPE_PACKAGE)) { + if (!obj && (obj->type != ACPI_TYPE_PACKAGE)) { ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid _BCL data\n")); status = -EFAULT; goto err; @@ -1294,7 +1294,7 @@ acpi_video_bus_get_one_device(struct acpi_device *device, struct acpi_video_bus *video) { unsigned long device_id; - int status; + int status, result; struct acpi_video_device *data; ACPI_FUNCTION_TRACE("acpi_video_bus_get_one_device"); @@ -1346,11 +1346,8 @@ acpi_video_bus_get_one_device(struct acpi_device *device, if (ACPI_FAILURE(status)) { ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error installing notify handler\n")); - if(data->brightness) - kfree(data->brightness->levels); - kfree(data->brightness); - kfree(data); - return -ENODEV; + result = -ENODEV; + goto end; } down(&video->sem); @@ -1362,6 +1359,7 @@ acpi_video_bus_get_one_device(struct acpi_device *device, return_VALUE(0); } + end: return_VALUE(-ENOENT); } @@ -1645,9 +1643,8 @@ static int acpi_video_bus_put_devices(struct acpi_video_bus *video) printk(KERN_WARNING PREFIX "hhuuhhuu bug in acpi video driver.\n"); - if (data->brightness); - kfree(data->brightness->levels); kfree(data->brightness); + kfree(data); } @@ -1788,10 +1785,6 @@ static int acpi_video_bus_add(struct acpi_device *device) if (ACPI_FAILURE(status)) { ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error installing notify handler\n")); - acpi_video_bus_stop_devices(video); - acpi_video_bus_put_devices(video); - kfree(video->attached_array); - acpi_video_bus_remove_fs(device); result = -ENODEV; goto end; } @@ -1803,8 +1796,10 @@ static int acpi_video_bus_add(struct acpi_device *device) video->flags.post ? "yes" : "no"); end: - if (result) + if (result) { + acpi_video_bus_remove_fs(device); kfree(video); + } return_VALUE(result); } diff --git a/trunk/drivers/char/Makefile b/trunk/drivers/char/Makefile index fb919bfb2824..f5b01c6d498e 100644 --- a/trunk/drivers/char/Makefile +++ b/trunk/drivers/char/Makefile @@ -41,9 +41,9 @@ obj-$(CONFIG_N_HDLC) += n_hdlc.o obj-$(CONFIG_AMIGA_BUILTIN_SERIAL) += amiserial.o obj-$(CONFIG_SX) += sx.o generic_serial.o obj-$(CONFIG_RIO) += rio/ generic_serial.o +obj-$(CONFIG_HVC_DRIVER) += hvc_console.o obj-$(CONFIG_HVC_CONSOLE) += hvc_vio.o hvsi.o obj-$(CONFIG_HVC_RTAS) += hvc_rtas.o -obj-$(CONFIG_HVC_DRIVER) += hvc_console.o obj-$(CONFIG_RAW_DRIVER) += raw.o obj-$(CONFIG_SGI_SNSC) += snsc.o snsc_event.o obj-$(CONFIG_MMTIMER) += mmtimer.o diff --git a/trunk/drivers/char/agp/hp-agp.c b/trunk/drivers/char/agp/hp-agp.c index 907fb66ec4a9..8c4c6ef748ec 100644 --- a/trunk/drivers/char/agp/hp-agp.c +++ b/trunk/drivers/char/agp/hp-agp.c @@ -497,7 +497,7 @@ zx1_gart_probe (acpi_handle obj, u32 depth, void *context, void **ret) info = buffer.pointer; info->hardware_id.value[sizeof(info->hardware_id)-1] = '\0'; match = (strcmp(info->hardware_id.value, "HWP0001") == 0); - kfree(info); + ACPI_MEM_FREE(info); if (match) { status = hp_acpi_csr_space(handle, &sba_hpa, &length); if (ACPI_SUCCESS(status)) diff --git a/trunk/drivers/char/hpet.c b/trunk/drivers/char/hpet.c index 07473cd84121..ef140ebde117 100644 --- a/trunk/drivers/char/hpet.c +++ b/trunk/drivers/char/hpet.c @@ -925,8 +925,11 @@ static acpi_status hpet_resources(struct acpi_resource *res, void *data) status = acpi_resource_to_address64(res, &addr); if (ACPI_SUCCESS(status)) { + unsigned long size; + + size = addr.maximum - addr.minimum + 1; hdp->hd_phys_address = addr.minimum; - hdp->hd_address = ioremap(addr.minimum, addr.address_length); + hdp->hd_address = ioremap(addr.minimum, size); if (hpet_is_known(hdp)) { printk(KERN_DEBUG "%s: 0x%lx is busy\n", diff --git a/trunk/drivers/char/n_tty.c b/trunk/drivers/char/n_tty.c index b9371d5bf790..ede365d05387 100644 --- a/trunk/drivers/char/n_tty.c +++ b/trunk/drivers/char/n_tty.c @@ -1384,10 +1384,8 @@ static ssize_t read_chan(struct tty_struct *tty, struct file *file, * longer than TTY_THRESHOLD_UNTHROTTLE in canonical mode, * we won't get any more characters. */ - if (n_tty_chars_in_buffer(tty) <= TTY_THRESHOLD_UNTHROTTLE) { - n_tty_set_room(tty); + if (n_tty_chars_in_buffer(tty) <= TTY_THRESHOLD_UNTHROTTLE) check_unthrottle(tty); - } if (b - buf >= minimum) break; diff --git a/trunk/drivers/char/pcmcia/cm4000_cs.c b/trunk/drivers/char/pcmcia/cm4000_cs.c index eab5394da666..128b2632512d 100644 --- a/trunk/drivers/char/pcmcia/cm4000_cs.c +++ b/trunk/drivers/char/pcmcia/cm4000_cs.c @@ -149,7 +149,7 @@ struct cm4000_dev { #define ZERO_DEV(dev) \ memset(&dev->atr_csum,0, \ sizeof(struct cm4000_dev) - \ - /*link*/ sizeof(struct pcmcia_device *) - \ + /*link*/ sizeof(struct pcmcia_device) - \ /*node*/ sizeof(dev_node_t) - \ /*atr*/ MAX_ATR*sizeof(char) - \ /*rbuf*/ 512*sizeof(char) - \ diff --git a/trunk/drivers/char/sonypi.c b/trunk/drivers/char/sonypi.c index 43dfd8689dce..a90f5d97df35 100644 --- a/trunk/drivers/char/sonypi.c +++ b/trunk/drivers/char/sonypi.c @@ -512,7 +512,7 @@ static struct sonypi_device { #ifdef CONFIG_ACPI static struct acpi_device *sonypi_acpi_device; -static int acpi_driver_registered; +static int acpi_enabled; #endif static int sonypi_ec_write(u8 addr, u8 value) @@ -869,7 +869,7 @@ static irqreturn_t sonypi_irq(int irq, void *dev_id, struct pt_regs *regs) sonypi_report_input_event(event); #ifdef CONFIG_ACPI - if (sonypi_acpi_device) + if (acpi_enabled) acpi_bus_generate_event(sonypi_acpi_device, 1, event); #endif @@ -1551,8 +1551,8 @@ static int __init sonypi_init(void) goto err_free_device; #ifdef CONFIG_ACPI - if (acpi_bus_register_driver(&sonypi_acpi_driver) >= 0) - acpi_driver_registered = 1; + if (acpi_bus_register_driver(&sonypi_acpi_driver) > 0) + acpi_enabled = 1; #endif return 0; @@ -1567,7 +1567,7 @@ static int __init sonypi_init(void) static void __exit sonypi_exit(void) { #ifdef CONFIG_ACPI - if (acpi_driver_registered) + if (acpi_enabled) acpi_bus_unregister_driver(&sonypi_acpi_driver); #endif platform_device_unregister(sonypi_platform_device); diff --git a/trunk/drivers/ieee1394/sbp2.c b/trunk/drivers/ieee1394/sbp2.c index 5413dc43b9f1..8a23fb54c693 100644 --- a/trunk/drivers/ieee1394/sbp2.c +++ b/trunk/drivers/ieee1394/sbp2.c @@ -845,7 +845,7 @@ static struct scsi_id_instance_data *sbp2_alloc_device(struct unit_directory *ud &sbp2_highlevel, ud->ne->host, &sbp2_ops, sizeof(struct sbp2_status_block), sizeof(quadlet_t), 0x010000000000ULL, CSR1212_ALL_SPACE_END); - if (scsi_id->status_fifo_addr == ~0ULL) { + if (!scsi_id->status_fifo_addr) { SBP2_ERR("failed to allocate status FIFO address range"); goto failed_alloc; } diff --git a/trunk/drivers/infiniband/ulp/ipoib/ipoib_ib.c b/trunk/drivers/infiniband/ulp/ipoib/ipoib_ib.c index 8406839b91cf..a54da42849ae 100644 --- a/trunk/drivers/infiniband/ulp/ipoib/ipoib_ib.c +++ b/trunk/drivers/infiniband/ulp/ipoib/ipoib_ib.c @@ -275,7 +275,6 @@ static void ipoib_ib_handle_wc(struct net_device *dev, spin_lock_irqsave(&priv->tx_lock, flags); ++priv->tx_tail; if (netif_queue_stopped(dev) && - test_bit(IPOIB_FLAG_ADMIN_UP, &priv->flags) && priv->tx_head - priv->tx_tail <= ipoib_sendq_size >> 1) netif_wake_queue(dev); spin_unlock_irqrestore(&priv->tx_lock, flags); diff --git a/trunk/drivers/message/fusion/mptbase.c b/trunk/drivers/message/fusion/mptbase.c index a30084076ac8..9080853fe283 100644 --- a/trunk/drivers/message/fusion/mptbase.c +++ b/trunk/drivers/message/fusion/mptbase.c @@ -1605,21 +1605,6 @@ mpt_resume(struct pci_dev *pdev) } #endif -static int -mpt_signal_reset(int index, MPT_ADAPTER *ioc, int reset_phase) -{ - if ((MptDriverClass[index] == MPTSPI_DRIVER && - ioc->bus_type != SPI) || - (MptDriverClass[index] == MPTFC_DRIVER && - ioc->bus_type != FC) || - (MptDriverClass[index] == MPTSAS_DRIVER && - ioc->bus_type != SAS)) - /* make sure we only call the relevant reset handler - * for the bus */ - return 0; - return (MptResetHandlers[index])(ioc, reset_phase); -} - /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ /* * mpt_do_ioc_recovery - Initialize or recover MPT adapter. @@ -1900,14 +1885,14 @@ mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u32 reason, int sleepFlag) if ((ret == 0) && MptResetHandlers[ii]) { dprintk((MYIOC_s_INFO_FMT "Calling IOC post_reset handler #%d\n", ioc->name, ii)); - rc += mpt_signal_reset(ii, ioc, MPT_IOC_POST_RESET); + rc += (*(MptResetHandlers[ii]))(ioc, MPT_IOC_POST_RESET); handlers++; } if (alt_ioc_ready && MptResetHandlers[ii]) { drsprintk((MYIOC_s_INFO_FMT "Calling alt-%s post_reset handler #%d\n", ioc->name, ioc->alt_ioc->name, ii)); - rc += mpt_signal_reset(ii, ioc->alt_ioc, MPT_IOC_POST_RESET); + rc += (*(MptResetHandlers[ii]))(ioc->alt_ioc, MPT_IOC_POST_RESET); handlers++; } } @@ -3282,11 +3267,11 @@ mpt_diag_reset(MPT_ADAPTER *ioc, int ignore, int sleepFlag) if (MptResetHandlers[ii]) { dprintk((MYIOC_s_INFO_FMT "Calling IOC pre_reset handler #%d\n", ioc->name, ii)); - r += mpt_signal_reset(ii, ioc, MPT_IOC_PRE_RESET); + r += (*(MptResetHandlers[ii]))(ioc, MPT_IOC_PRE_RESET); if (ioc->alt_ioc) { dprintk((MYIOC_s_INFO_FMT "Calling alt-%s pre_reset handler #%d\n", ioc->name, ioc->alt_ioc->name, ii)); - r += mpt_signal_reset(ii, ioc->alt_ioc, MPT_IOC_PRE_RESET); + r += (*(MptResetHandlers[ii]))(ioc->alt_ioc, MPT_IOC_PRE_RESET); } } } @@ -5721,11 +5706,11 @@ mpt_HardResetHandler(MPT_ADAPTER *ioc, int sleepFlag) if (MptResetHandlers[ii]) { dtmprintk((MYIOC_s_INFO_FMT "Calling IOC reset_setup handler #%d\n", ioc->name, ii)); - r += mpt_signal_reset(ii, ioc, MPT_IOC_SETUP_RESET); + r += (*(MptResetHandlers[ii]))(ioc, MPT_IOC_SETUP_RESET); if (ioc->alt_ioc) { dtmprintk((MYIOC_s_INFO_FMT "Calling alt-%s setup reset handler #%d\n", ioc->name, ioc->alt_ioc->name, ii)); - r += mpt_signal_reset(ii, ioc->alt_ioc, MPT_IOC_SETUP_RESET); + r += (*(MptResetHandlers[ii]))(ioc->alt_ioc, MPT_IOC_SETUP_RESET); } } } diff --git a/trunk/drivers/message/fusion/mptspi.c b/trunk/drivers/message/fusion/mptspi.c index 3201de053943..f2a4d382ea19 100644 --- a/trunk/drivers/message/fusion/mptspi.c +++ b/trunk/drivers/message/fusion/mptspi.c @@ -831,7 +831,6 @@ mptspi_ioc_reset(MPT_ADAPTER *ioc, int reset_phase) return rc; } -#ifdef CONFIG_PM /* * spi module resume handler */ @@ -847,7 +846,6 @@ mptspi_resume(struct pci_dev *pdev) return rc; } -#endif /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ diff --git a/trunk/drivers/message/i2o/exec-osm.c b/trunk/drivers/message/i2o/exec-osm.c index 7bd4d85d0b42..5ea133c59afb 100644 --- a/trunk/drivers/message/i2o/exec-osm.c +++ b/trunk/drivers/message/i2o/exec-osm.c @@ -55,7 +55,6 @@ struct i2o_exec_wait { u32 m; /* message id */ struct i2o_message *msg; /* pointer to the reply message */ struct list_head list; /* node in global wait list */ - spinlock_t lock; /* lock before modifying */ }; /* Work struct needed to handle LCT NOTIFY replies */ @@ -88,7 +87,6 @@ static struct i2o_exec_wait *i2o_exec_wait_alloc(void) return NULL; INIT_LIST_HEAD(&wait->list); - spin_lock_init(&wait->lock); return wait; }; @@ -127,7 +125,6 @@ int i2o_msg_post_wait_mem(struct i2o_controller *c, struct i2o_message *msg, DECLARE_WAIT_QUEUE_HEAD(wq); struct i2o_exec_wait *wait; static u32 tcntxt = 0x80000000; - long flags; int rc = 0; wait = i2o_exec_wait_alloc(); @@ -149,28 +146,33 @@ int i2o_msg_post_wait_mem(struct i2o_controller *c, struct i2o_message *msg, wait->tcntxt = tcntxt++; msg->u.s.tcntxt = cpu_to_le32(wait->tcntxt); - wait->wq = &wq; - /* - * we add elements to the head, because if a entry in the list will - * never be removed, we have to iterate over it every time - */ - list_add(&wait->list, &i2o_exec_wait_list); - /* * Post the message to the controller. At some point later it will * return. If we time out before it returns then complete will be zero. */ i2o_msg_post(c, msg); - wait_event_interruptible_timeout(wq, wait->complete, timeout * HZ); + if (!wait->complete) { + wait->wq = &wq; + /* + * we add elements add the head, because if a entry in the list + * will never be removed, we have to iterate over it every time + */ + list_add(&wait->list, &i2o_exec_wait_list); + + wait_event_interruptible_timeout(wq, wait->complete, + timeout * HZ); - spin_lock_irqsave(&wait->lock, flags); + wait->wq = NULL; + } - wait->wq = NULL; + barrier(); - if (wait->complete) + if (wait->complete) { rc = le32_to_cpu(wait->msg->body[0]) >> 24; - else { + i2o_flush_reply(c, wait->m); + i2o_exec_wait_free(wait); + } else { /* * We cannot remove it now. This is important. When it does * terminate (which it must do if the controller has not @@ -184,13 +186,6 @@ int i2o_msg_post_wait_mem(struct i2o_controller *c, struct i2o_message *msg, rc = -ETIMEDOUT; } - spin_unlock_irqrestore(&wait->lock, flags); - - if (rc != -ETIMEDOUT) { - i2o_flush_reply(c, wait->m); - i2o_exec_wait_free(wait); - } - return rc; }; @@ -218,6 +213,7 @@ static int i2o_msg_post_wait_complete(struct i2o_controller *c, u32 m, { struct i2o_exec_wait *wait, *tmp; unsigned long flags; + static spinlock_t lock = SPIN_LOCK_UNLOCKED; int rc = 1; /* @@ -227,24 +223,23 @@ static int i2o_msg_post_wait_complete(struct i2o_controller *c, u32 m, * already expired. Not much we can do about that except log it for * debug purposes, increase timeout, and recompile. */ + spin_lock_irqsave(&lock, flags); list_for_each_entry_safe(wait, tmp, &i2o_exec_wait_list, list) { if (wait->tcntxt == context) { - spin_lock_irqsave(&wait->lock, flags); - list_del(&wait->list); + spin_unlock_irqrestore(&lock, flags); + wait->m = m; wait->msg = msg; wait->complete = 1; - if (wait->wq) - rc = 0; - else - rc = -1; + barrier(); - spin_unlock_irqrestore(&wait->lock, flags); - - if (rc) { + if (wait->wq) { + wake_up_interruptible(wait->wq); + rc = 0; + } else { struct device *dev; dev = &c->pdev->dev; @@ -253,13 +248,15 @@ static int i2o_msg_post_wait_complete(struct i2o_controller *c, u32 m, c->name); i2o_dma_free(dev, &wait->dma); i2o_exec_wait_free(wait); - } else - wake_up_interruptible(wait->wq); + rc = -1; + } return rc; } } + spin_unlock_irqrestore(&lock, flags); + osm_warn("%s: Bogus reply in POST WAIT (tr-context: %08x)!\n", c->name, context); @@ -325,9 +322,14 @@ static DEVICE_ATTR(product_id, S_IRUGO, i2o_exec_show_product_id, NULL); static int i2o_exec_probe(struct device *dev) { struct i2o_device *i2o_dev = to_i2o_device(dev); + struct i2o_controller *c = i2o_dev->iop; i2o_event_register(i2o_dev, &i2o_exec_driver, 0, 0xffffffff); + c->exec = i2o_dev; + + i2o_exec_lct_notify(c, c->lct->change_ind + 1); + device_create_file(dev, &dev_attr_vendor_id); device_create_file(dev, &dev_attr_product_id); @@ -521,8 +523,6 @@ static int i2o_exec_lct_notify(struct i2o_controller *c, u32 change_ind) struct device *dev; struct i2o_message *msg; - down(&c->lct_lock); - dev = &c->pdev->dev; if (i2o_dma_realloc @@ -545,8 +545,6 @@ static int i2o_exec_lct_notify(struct i2o_controller *c, u32 change_ind) i2o_msg_post(c, msg); - up(&c->lct_lock); - return 0; }; diff --git a/trunk/drivers/message/i2o/iop.c b/trunk/drivers/message/i2o/iop.c index febbdd4e0605..492167446936 100644 --- a/trunk/drivers/message/i2o/iop.c +++ b/trunk/drivers/message/i2o/iop.c @@ -804,6 +804,8 @@ void i2o_iop_remove(struct i2o_controller *c) /* Ask the IOP to switch to RESET state */ i2o_iop_reset(c); + + put_device(&c->device); } /** @@ -1057,7 +1059,7 @@ struct i2o_controller *i2o_iop_alloc(void) snprintf(poolname, sizeof(poolname), "i2o_%s_msg_inpool", c->name); if (i2o_pool_alloc - (&c->in_msg, poolname, I2O_INBOUND_MSG_FRAME_SIZE * 4 + sizeof(u32), + (&c->in_msg, poolname, I2O_INBOUND_MSG_FRAME_SIZE * 4, I2O_MSG_INPOOL_MIN)) { kfree(c); return ERR_PTR(-ENOMEM); diff --git a/trunk/drivers/mmc/Kconfig b/trunk/drivers/mmc/Kconfig index 45bcf098e762..003b077c2324 100644 --- a/trunk/drivers/mmc/Kconfig +++ b/trunk/drivers/mmc/Kconfig @@ -84,7 +84,7 @@ config MMC_WBSD config MMC_AU1X tristate "Alchemy AU1XX0 MMC Card Interface support" - depends on MMC && SOC_AU1200 + depends on SOC_AU1X00 && MMC help This selects the AMD Alchemy(R) Multimedia card interface. If you have a Alchemy platform with a MMC slot, say Y or M here. diff --git a/trunk/drivers/net/e1000/e1000_ethtool.c b/trunk/drivers/net/e1000/e1000_ethtool.c index d1c705b412c2..ecccca35c6f4 100644 --- a/trunk/drivers/net/e1000/e1000_ethtool.c +++ b/trunk/drivers/net/e1000/e1000_ethtool.c @@ -870,16 +870,13 @@ e1000_intr_test(struct e1000_adapter *adapter, uint64_t *data) *data = 0; /* Hook up test interrupt handler just for this test */ - if (!request_irq(irq, &e1000_test_intr, SA_PROBEIRQ, netdev->name, - netdev)) { + if (!request_irq(irq, &e1000_test_intr, 0, netdev->name, netdev)) { shared_int = FALSE; } else if (request_irq(irq, &e1000_test_intr, SA_SHIRQ, netdev->name, netdev)){ *data = 1; return -1; } - DPRINTK(PROBE,INFO, "testing %s interrupt\n", - (shared_int ? "shared" : "unshared")); /* Disable all the interrupts */ E1000_WRITE_REG(&adapter->hw, IMC, 0xFFFFFFFF); diff --git a/trunk/drivers/net/e1000/e1000_main.c b/trunk/drivers/net/e1000/e1000_main.c index 97e71a4fe8eb..ed15fcaedaf9 100644 --- a/trunk/drivers/net/e1000/e1000_main.c +++ b/trunk/drivers/net/e1000/e1000_main.c @@ -3519,7 +3519,7 @@ e1000_clean_rx_irq(struct e1000_adapter *adapter, buffer_info = &rx_ring->buffer_info[i]; while (rx_desc->status & E1000_RXD_STAT_DD) { - struct sk_buff *skb; + struct sk_buff *skb, *next_skb; u8 status; #ifdef CONFIG_E1000_NAPI if (*work_done >= work_to_do) @@ -3537,6 +3537,8 @@ e1000_clean_rx_irq(struct e1000_adapter *adapter, prefetch(next_rxd); next_buffer = &rx_ring->buffer_info[i]; + next_skb = next_buffer->skb; + prefetch(next_skb->data - NET_IP_ALIGN); cleaned = TRUE; cleaned_count++; @@ -3666,7 +3668,7 @@ e1000_clean_rx_irq_ps(struct e1000_adapter *adapter, struct e1000_buffer *buffer_info, *next_buffer; struct e1000_ps_page *ps_page; struct e1000_ps_page_dma *ps_page_dma; - struct sk_buff *skb; + struct sk_buff *skb, *next_skb; unsigned int i, j; uint32_t length, staterr; int cleaned_count = 0; @@ -3695,6 +3697,8 @@ e1000_clean_rx_irq_ps(struct e1000_adapter *adapter, prefetch(next_rxd); next_buffer = &rx_ring->buffer_info[i]; + next_skb = next_buffer->skb; + prefetch(next_skb->data - NET_IP_ALIGN); cleaned = TRUE; cleaned_count++; diff --git a/trunk/drivers/net/forcedeth.c b/trunk/drivers/net/forcedeth.c index feb5b223cd60..705e1229d89d 100644 --- a/trunk/drivers/net/forcedeth.c +++ b/trunk/drivers/net/forcedeth.c @@ -2615,18 +2615,6 @@ static int nv_nway_reset(struct net_device *dev) return ret; } -#ifdef NETIF_F_TSO -static int nv_set_tso(struct net_device *dev, u32 value) -{ - struct fe_priv *np = netdev_priv(dev); - - if ((np->driver_data & DEV_HAS_CHECKSUM)) - return ethtool_op_set_tso(dev, value); - else - return value ? -EOPNOTSUPP : 0; -} -#endif - static struct ethtool_ops ops = { .get_drvinfo = nv_get_drvinfo, .get_link = ethtool_op_get_link, @@ -2638,10 +2626,6 @@ static struct ethtool_ops ops = { .get_regs = nv_get_regs, .nway_reset = nv_nway_reset, .get_perm_addr = ethtool_op_get_perm_addr, -#ifdef NETIF_F_TSO - .get_tso = ethtool_op_get_tso, - .set_tso = nv_set_tso -#endif }; static void nv_vlan_rx_register(struct net_device *dev, struct vlan_group *grp) diff --git a/trunk/drivers/net/netconsole.c b/trunk/drivers/net/netconsole.c index bf58db29e2ed..66e74f740261 100644 --- a/trunk/drivers/net/netconsole.c +++ b/trunk/drivers/net/netconsole.c @@ -107,7 +107,7 @@ static int init_netconsole(void) if(!configured) { printk("netconsole: not configured, aborting\n"); - return 0; + return -EINVAL; } if(netpoll_setup(&np)) diff --git a/trunk/drivers/net/pcmcia/nmclan_cs.c b/trunk/drivers/net/pcmcia/nmclan_cs.c index a8f6bfc96fd2..4260c2128f47 100644 --- a/trunk/drivers/net/pcmcia/nmclan_cs.c +++ b/trunk/drivers/net/pcmcia/nmclan_cs.c @@ -1204,7 +1204,7 @@ static int mace_rx(struct net_device *dev, unsigned char RxCnt) dev->last_rx = jiffies; lp->linux_stats.rx_packets++; - lp->linux_stats.rx_bytes += pkt_len; + lp->linux_stats.rx_bytes += skb->len; outb(0xFF, ioaddr + AM2150_RCV_NEXT); /* skip to next frame */ continue; } else { diff --git a/trunk/drivers/net/pppoe.c b/trunk/drivers/net/pppoe.c index 0d101a18026a..475dc930380f 100644 --- a/trunk/drivers/net/pppoe.c +++ b/trunk/drivers/net/pppoe.c @@ -861,9 +861,6 @@ static int __pppoe_xmit(struct sock *sk, struct sk_buff *skb) * give dev_queue_xmit something it can free. */ skb2 = skb_clone(skb, GFP_ATOMIC); - - if (skb2 == NULL) - goto abort; } ph = (struct pppoe_hdr *) skb_push(skb2, sizeof(struct pppoe_hdr)); diff --git a/trunk/drivers/net/sky2.c b/trunk/drivers/net/sky2.c index 97fe95666f3b..959109609d85 100644 --- a/trunk/drivers/net/sky2.c +++ b/trunk/drivers/net/sky2.c @@ -187,11 +187,12 @@ static u16 gm_phy_read(struct sky2_hw *hw, unsigned port, u16 reg) return v; } -static void sky2_set_power_state(struct sky2_hw *hw, pci_power_t state) +static int sky2_set_power_state(struct sky2_hw *hw, pci_power_t state) { u16 power_control; u32 reg1; int vaux; + int ret = 0; pr_debug("sky2_set_power_state %d\n", state); sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON); @@ -274,10 +275,12 @@ static void sky2_set_power_state(struct sky2_hw *hw, pci_power_t state) break; default: printk(KERN_ERR PFX "Unknown power state %d\n", state); + ret = -1; } sky2_pci_write16(hw, hw->pm_cap + PCI_PM_CTRL, power_control); sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_OFF); + return ret; } static void sky2_phy_reset(struct sky2_hw *hw, unsigned port) @@ -2161,13 +2164,6 @@ static void sky2_descriptor_error(struct sky2_hw *hw, unsigned port, /* If idle then force a fake soft NAPI poll once a second * to work around cases where sharing an edge triggered interrupt. */ -static inline void sky2_idle_start(struct sky2_hw *hw) -{ - if (idle_timeout > 0) - mod_timer(&hw->idle_timer, - jiffies + msecs_to_jiffies(idle_timeout)); -} - static void sky2_idle(unsigned long arg) { struct sky2_hw *hw = (struct sky2_hw *) arg; @@ -2187,9 +2183,6 @@ static int sky2_poll(struct net_device *dev0, int *budget) int work_done = 0; u32 status = sky2_read32(hw, B0_Y2_SP_EISR); - if (!~status) - goto out; - if (status & Y2_IS_HW_ERR) sky2_hw_intr(hw); @@ -2226,7 +2219,7 @@ static int sky2_poll(struct net_device *dev0, int *budget) if (sky2_more_work(hw)) return 1; -out: + netif_rx_complete(dev0); sky2_read32(hw, B0_Y2_SP_LISR); @@ -3357,7 +3350,9 @@ static int __devinit sky2_probe(struct pci_dev *pdev, sky2_write32(hw, B0_IMSK, Y2_IS_BASE); setup_timer(&hw->idle_timer, sky2_idle, (unsigned long) hw); - sky2_idle_start(hw); + if (idle_timeout > 0) + mod_timer(&hw->idle_timer, + jiffies + msecs_to_jiffies(idle_timeout)); pci_set_drvdata(pdev, hw); @@ -3430,14 +3425,8 @@ static int sky2_suspend(struct pci_dev *pdev, pm_message_t state) { struct sky2_hw *hw = pci_get_drvdata(pdev); int i; - pci_power_t pstate = pci_choose_state(pdev, state); - - if (!(pstate == PCI_D3hot || pstate == PCI_D3cold)) - return -EINVAL; - - del_timer_sync(&hw->idle_timer); - for (i = 0; i < hw->ports; i++) { + for (i = 0; i < 2; i++) { struct net_device *dev = hw->dev[i]; if (dev) { @@ -3449,10 +3438,7 @@ static int sky2_suspend(struct pci_dev *pdev, pm_message_t state) } } - sky2_write32(hw, B0_IMSK, 0); - pci_save_state(pdev); - sky2_set_power_state(hw, pstate); - return 0; + return sky2_set_power_state(hw, pci_choose_state(pdev, state)); } static int sky2_resume(struct pci_dev *pdev) @@ -3462,15 +3448,15 @@ static int sky2_resume(struct pci_dev *pdev) pci_restore_state(pdev); pci_enable_wake(pdev, PCI_D0, 0); - sky2_set_power_state(hw, PCI_D0); + err = sky2_set_power_state(hw, PCI_D0); + if (err) + goto out; err = sky2_reset(hw); if (err) goto out; - sky2_write32(hw, B0_IMSK, Y2_IS_BASE); - - for (i = 0; i < hw->ports; i++) { + for (i = 0; i < 2; i++) { struct net_device *dev = hw->dev[i]; if (dev && netif_running(dev)) { netif_device_attach(dev); @@ -3479,12 +3465,10 @@ static int sky2_resume(struct pci_dev *pdev) printk(KERN_ERR PFX "%s: could not up: %d\n", dev->name, err); dev_close(dev); - goto out; + break; } } } - - sky2_idle_start(hw); out: return err; } diff --git a/trunk/drivers/net/tg3.c b/trunk/drivers/net/tg3.c index 862c226dbbe2..49ad60b72657 100644 --- a/trunk/drivers/net/tg3.c +++ b/trunk/drivers/net/tg3.c @@ -69,8 +69,8 @@ #define DRV_MODULE_NAME "tg3" #define PFX DRV_MODULE_NAME ": " -#define DRV_MODULE_VERSION "3.59" -#define DRV_MODULE_RELDATE "June 8, 2006" +#define DRV_MODULE_VERSION "3.58" +#define DRV_MODULE_RELDATE "May 22, 2006" #define TG3_DEF_MAC_MODE 0 #define TG3_DEF_RX_MODE 0 @@ -4485,8 +4485,9 @@ static void tg3_disable_nvram_access(struct tg3 *tp) /* tp->lock is held. */ static void tg3_write_sig_pre_reset(struct tg3 *tp, int kind) { - tg3_write_mem(tp, NIC_SRAM_FIRMWARE_MBOX, - NIC_SRAM_FIRMWARE_MBOX_MAGIC1); + if (!(tp->tg3_flags2 & TG3_FLG2_SUN_570X)) + tg3_write_mem(tp, NIC_SRAM_FIRMWARE_MBOX, + NIC_SRAM_FIRMWARE_MBOX_MAGIC1); if (tp->tg3_flags2 & TG3_FLG2_ASF_NEW_HANDSHAKE) { switch (kind) { @@ -4567,12 +4568,13 @@ static int tg3_chip_reset(struct tg3 *tp) void (*write_op)(struct tg3 *, u32, u32); int i; - tg3_nvram_lock(tp); - - /* No matching tg3_nvram_unlock() after this because - * chip reset below will undo the nvram lock. - */ - tp->nvram_lock_cnt = 0; + if (!(tp->tg3_flags2 & TG3_FLG2_SUN_570X)) { + tg3_nvram_lock(tp); + /* No matching tg3_nvram_unlock() after this because + * chip reset below will undo the nvram lock. + */ + tp->nvram_lock_cnt = 0; + } if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5752 || GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5755 || @@ -4725,25 +4727,20 @@ static int tg3_chip_reset(struct tg3 *tp) tw32_f(MAC_MODE, 0); udelay(40); - /* Wait for firmware initialization to complete. */ - for (i = 0; i < 100000; i++) { - tg3_read_mem(tp, NIC_SRAM_FIRMWARE_MBOX, &val); - if (val == ~NIC_SRAM_FIRMWARE_MBOX_MAGIC1) - break; - udelay(10); - } - - /* Chip might not be fitted with firmare. Some Sun onboard - * parts are configured like that. So don't signal the timeout - * of the above loop as an error, but do report the lack of - * running firmware once. - */ - if (i >= 100000 && - !(tp->tg3_flags2 & TG3_FLG2_NO_FWARE_REPORTED)) { - tp->tg3_flags2 |= TG3_FLG2_NO_FWARE_REPORTED; - - printk(KERN_INFO PFX "%s: No firmware running.\n", - tp->dev->name); + if (!(tp->tg3_flags2 & TG3_FLG2_SUN_570X)) { + /* Wait for firmware initialization to complete. */ + for (i = 0; i < 100000; i++) { + tg3_read_mem(tp, NIC_SRAM_FIRMWARE_MBOX, &val); + if (val == ~NIC_SRAM_FIRMWARE_MBOX_MAGIC1) + break; + udelay(10); + } + if (i >= 100000) { + printk(KERN_ERR PFX "tg3_reset_hw timed out for %s, " + "firmware will not restart magic=%08x\n", + tp->dev->name, val); + return -ENODEV; + } } if ((tp->tg3_flags2 & TG3_FLG2_PCI_EXPRESS) && @@ -9078,6 +9075,9 @@ static void __devinit tg3_nvram_init(struct tg3 *tp) { int j; + if (tp->tg3_flags2 & TG3_FLG2_SUN_570X) + return; + tw32_f(GRC_EEPROM_ADDR, (EEPROM_ADDR_FSM_RESET | (EEPROM_DEFAULT_CLOCK_PERIOD << @@ -9210,6 +9210,11 @@ static int tg3_nvram_read(struct tg3 *tp, u32 offset, u32 *val) { int ret; + if (tp->tg3_flags2 & TG3_FLG2_SUN_570X) { + printk(KERN_ERR PFX "Attempt to do nvram_read on Sun 570X\n"); + return -EINVAL; + } + if (!(tp->tg3_flags & TG3_FLAG_NVRAM)) return tg3_nvram_read_using_eeprom(tp, offset, val); @@ -9442,6 +9447,11 @@ static int tg3_nvram_write_block(struct tg3 *tp, u32 offset, u32 len, u8 *buf) { int ret; + if (tp->tg3_flags2 & TG3_FLG2_SUN_570X) { + printk(KERN_ERR PFX "Attempt to do nvram_write on Sun 570X\n"); + return -EINVAL; + } + if (tp->tg3_flags & TG3_FLAG_EEPROM_WRITE_PROT) { tw32_f(GRC_LOCAL_CTRL, tp->grc_local_ctrl & ~GRC_LCLCTRL_GPIO_OUTPUT1); @@ -9568,19 +9578,15 @@ static void __devinit tg3_get_eeprom_hw_cfg(struct tg3 *tp) pci_write_config_dword(tp->pdev, TG3PCI_MISC_HOST_CTRL, tp->misc_host_ctrl); - /* The memory arbiter has to be enabled in order for SRAM accesses - * to succeed. Normally on powerup the tg3 chip firmware will make - * sure it is enabled, but other entities such as system netboot - * code might disable it. - */ - val = tr32(MEMARB_MODE); - tw32(MEMARB_MODE, val | MEMARB_MODE_ENABLE); - tp->phy_id = PHY_ID_INVALID; tp->led_ctrl = LED_CTRL_MODE_PHY_1; - /* Assume an onboard device by default. */ - tp->tg3_flags |= TG3_FLAG_EEPROM_WRITE_PROT; + /* Do not even try poking around in here on Sun parts. */ + if (tp->tg3_flags2 & TG3_FLG2_SUN_570X) { + /* All SUN chips are built-in LOMs. */ + tp->tg3_flags |= TG3_FLAG_EEPROM_WRITE_PROT; + return; + } tg3_read_mem(tp, NIC_SRAM_DATA_SIG, &val); if (val == NIC_SRAM_DATA_SIG_MAGIC) { @@ -9680,8 +9686,6 @@ static void __devinit tg3_get_eeprom_hw_cfg(struct tg3 *tp) if (nic_cfg & NIC_SRAM_DATA_CFG_EEPROM_WP) tp->tg3_flags |= TG3_FLAG_EEPROM_WRITE_PROT; - else - tp->tg3_flags &= ~TG3_FLAG_EEPROM_WRITE_PROT; if (nic_cfg & NIC_SRAM_DATA_CFG_ASF_ENABLE) { tp->tg3_flags |= TG3_FLAG_ENABLE_ASF; @@ -9830,8 +9834,16 @@ static void __devinit tg3_read_partno(struct tg3 *tp) int i; u32 magic; + if (tp->tg3_flags2 & TG3_FLG2_SUN_570X) { + /* Sun decided not to put the necessary bits in the + * NVRAM of their onboard tg3 parts :( + */ + strcpy(tp->board_part_number, "Sun 570X"); + return; + } + if (tg3_nvram_read_swab(tp, 0x0, &magic)) - goto out_not_found; + return; if (magic == TG3_EEPROM_MAGIC) { for (i = 0; i < 256; i += 4) { @@ -9862,9 +9874,6 @@ static void __devinit tg3_read_partno(struct tg3 *tp) break; msleep(1); } - if (!(tmp16 & 0x8000)) - goto out_not_found; - pci_read_config_dword(tp->pdev, vpd_cap + PCI_VPD_DATA, &tmp); tmp = cpu_to_le32(tmp); @@ -9956,6 +9965,37 @@ static void __devinit tg3_read_fw_ver(struct tg3 *tp) } } +#ifdef CONFIG_SPARC64 +static int __devinit tg3_is_sun_570X(struct tg3 *tp) +{ + struct pci_dev *pdev = tp->pdev; + struct pcidev_cookie *pcp = pdev->sysdata; + + if (pcp != NULL) { + int node = pcp->prom_node; + u32 venid; + int err; + + err = prom_getproperty(node, "subsystem-vendor-id", + (char *) &venid, sizeof(venid)); + if (err == 0 || err == -1) + return 0; + if (venid == PCI_VENDOR_ID_SUN) + return 1; + + /* TG3 chips onboard the SunBlade-2500 don't have the + * subsystem-vendor-id set to PCI_VENDOR_ID_SUN but they + * are distinguishable from non-Sun variants by being + * named "network" by the firmware. Non-Sun cards will + * show up as being named "ethernet". + */ + if (!strcmp(pcp->prom_name, "network")) + return 1; + } + return 0; +} +#endif + static int __devinit tg3_get_invariants(struct tg3 *tp) { static struct pci_device_id write_reorder_chipsets[] = { @@ -9972,6 +10012,11 @@ static int __devinit tg3_get_invariants(struct tg3 *tp) u16 pci_cmd; int err; +#ifdef CONFIG_SPARC64 + if (tg3_is_sun_570X(tp)) + tp->tg3_flags2 |= TG3_FLG2_SUN_570X; +#endif + /* Force memory write invalidate off. If we leave it on, * then on 5700_BX chips we have to enable a workaround. * The workaround is to set the TG3PCI_DMA_RW_CTRL boundary @@ -10267,7 +10312,8 @@ static int __devinit tg3_get_invariants(struct tg3 *tp) if (tp->write32 == tg3_write_indirect_reg32 || ((tp->tg3_flags & TG3_FLAG_PCIX_MODE) && (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5700 || - GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5701))) + GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5701)) || + (tp->tg3_flags2 & TG3_FLG2_SUN_570X)) tp->tg3_flags |= TG3_FLAG_SRAM_USE_CONFIG; /* Get eeprom hw config before calling tg3_set_power_state(). @@ -10548,7 +10594,8 @@ static int __devinit tg3_get_device_address(struct tg3 *tp) #endif mac_offset = 0x7c; - if ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704) || + if ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704 && + !(tp->tg3_flags & TG3_FLG2_SUN_570X)) || (tp->tg3_flags2 & TG3_FLG2_5780_CLASS)) { if (tr32(TG3PCI_DUAL_MAC_CTRL) & DUAL_MAC_CTRL_ID) mac_offset = 0xcc; @@ -10575,7 +10622,8 @@ static int __devinit tg3_get_device_address(struct tg3 *tp) } if (!addr_ok) { /* Next, try NVRAM. */ - if (!tg3_nvram_read(tp, mac_offset + 0, &hi) && + if (!(tp->tg3_flags & TG3_FLG2_SUN_570X) && + !tg3_nvram_read(tp, mac_offset + 0, &hi) && !tg3_nvram_read(tp, mac_offset + 4, &lo)) { dev->dev_addr[0] = ((hi >> 16) & 0xff); dev->dev_addr[1] = ((hi >> 24) & 0xff); diff --git a/trunk/drivers/net/tg3.h b/trunk/drivers/net/tg3.h index ff0faab94bd5..0e29b885d449 100644 --- a/trunk/drivers/net/tg3.h +++ b/trunk/drivers/net/tg3.h @@ -2184,7 +2184,7 @@ struct tg3 { #define TG3_FLAG_INIT_COMPLETE 0x80000000 u32 tg3_flags2; #define TG3_FLG2_RESTART_TIMER 0x00000001 -/* 0x00000002 available */ +#define TG3_FLG2_SUN_570X 0x00000002 #define TG3_FLG2_NO_ETH_WIRE_SPEED 0x00000004 #define TG3_FLG2_IS_5788 0x00000008 #define TG3_FLG2_MAX_RXPEND_64 0x00000010 @@ -2216,7 +2216,6 @@ struct tg3 { #define TG3_FLG2_HW_TSO (TG3_FLG2_HW_TSO_1 | TG3_FLG2_HW_TSO_2) #define TG3_FLG2_1SHOT_MSI 0x10000000 #define TG3_FLG2_PHY_JITTER_BUG 0x20000000 -#define TG3_FLG2_NO_FWARE_REPORTED 0x40000000 u32 split_mode_max_reqs; #define SPLIT_MODE_5704_MAX_REQ 3 diff --git a/trunk/drivers/net/wireless/bcm43xx/bcm43xx_dma.c b/trunk/drivers/net/wireless/bcm43xx/bcm43xx_dma.c index d0318e525ba7..bbecba02e697 100644 --- a/trunk/drivers/net/wireless/bcm43xx/bcm43xx_dma.c +++ b/trunk/drivers/net/wireless/bcm43xx/bcm43xx_dma.c @@ -624,28 +624,25 @@ int bcm43xx_dma_init(struct bcm43xx_private *bcm) static u16 generate_cookie(struct bcm43xx_dmaring *ring, int slot) { - u16 cookie = 0xF000; + u16 cookie = 0x0000; /* Use the upper 4 bits of the cookie as * DMA controller ID and store the slot number - * in the lower 12 bits. - * Note that the cookie must never be 0, as this - * is a special value used in RX path. + * in the lower 12 bits */ switch (ring->mmio_base) { default: assert(0); case BCM43xx_MMIO_DMA1_BASE: - cookie = 0xA000; break; case BCM43xx_MMIO_DMA2_BASE: - cookie = 0xB000; + cookie = 0x1000; break; case BCM43xx_MMIO_DMA3_BASE: - cookie = 0xC000; + cookie = 0x2000; break; case BCM43xx_MMIO_DMA4_BASE: - cookie = 0xD000; + cookie = 0x3000; break; } assert(((u16)slot & 0xF000) == 0x0000); @@ -663,16 +660,16 @@ struct bcm43xx_dmaring * parse_cookie(struct bcm43xx_private *bcm, struct bcm43xx_dmaring *ring = NULL; switch (cookie & 0xF000) { - case 0xA000: + case 0x0000: ring = dma->tx_ring0; break; - case 0xB000: + case 0x1000: ring = dma->tx_ring1; break; - case 0xC000: + case 0x2000: ring = dma->tx_ring2; break; - case 0xD000: + case 0x3000: ring = dma->tx_ring3; break; default: @@ -842,18 +839,8 @@ static void dma_rx(struct bcm43xx_dmaring *ring, /* We received an xmit status. */ struct bcm43xx_hwxmitstatus *hw = (struct bcm43xx_hwxmitstatus *)skb->data; struct bcm43xx_xmitstatus stat; - int i = 0; stat.cookie = le16_to_cpu(hw->cookie); - while (stat.cookie == 0) { - if (unlikely(++i >= 10000)) { - assert(0); - break; - } - udelay(2); - barrier(); - stat.cookie = le16_to_cpu(hw->cookie); - } stat.flags = hw->flags; stat.cnt1 = hw->cnt1; stat.cnt2 = hw->cnt2; diff --git a/trunk/drivers/pci/pci-driver.c b/trunk/drivers/pci/pci-driver.c index 10e1a905c144..1456759936c5 100644 --- a/trunk/drivers/pci/pci-driver.c +++ b/trunk/drivers/pci/pci-driver.c @@ -285,9 +285,9 @@ static int pci_device_suspend(struct device * dev, pm_message_t state) * Default resume method for devices that have no driver provided resume, * or not even a driver at all. */ -static int pci_default_resume(struct pci_dev *pci_dev) +static void pci_default_resume(struct pci_dev *pci_dev) { - int retval = 0; + int retval; /* restore the PCI config space */ pci_restore_state(pci_dev); @@ -297,21 +297,18 @@ static int pci_default_resume(struct pci_dev *pci_dev) /* if the device was busmaster before the suspend, make it busmaster again */ if (pci_dev->is_busmaster) pci_set_master(pci_dev); - - return retval; } static int pci_device_resume(struct device * dev) { - int error; struct pci_dev * pci_dev = to_pci_dev(dev); struct pci_driver * drv = pci_dev->driver; if (drv && drv->resume) - error = drv->resume(pci_dev); + drv->resume(pci_dev); else - error = pci_default_resume(pci_dev); - return error; + pci_default_resume(pci_dev); + return 0; } static void pci_device_shutdown(struct device *dev) diff --git a/trunk/drivers/pci/pci.c b/trunk/drivers/pci/pci.c index 12286275b1c8..2329f941a0dc 100644 --- a/trunk/drivers/pci/pci.c +++ b/trunk/drivers/pci/pci.c @@ -461,23 +461,9 @@ int pci_restore_state(struct pci_dev *dev) { int i; - int val; - /* - * The Base Address register should be programmed before the command - * register(s) - */ - for (i = 15; i >= 0; i--) { - pci_read_config_dword(dev, i * 4, &val); - if (val != dev->saved_config_space[i]) { - printk(KERN_DEBUG "PM: Writing back config space on " - "device %s at offset %x (was %x, writing %x)\n", - pci_name(dev), i, - val, (int)dev->saved_config_space[i]); - pci_write_config_dword(dev,i * 4, - dev->saved_config_space[i]); - } - } + for (i = 0; i < 16; i++) + pci_write_config_dword(dev,i * 4, dev->saved_config_space[i]); pci_restore_msi_state(dev); pci_restore_msix_state(dev); return 0; diff --git a/trunk/drivers/pcmcia/ds.c b/trunk/drivers/pcmcia/ds.c index 74b3124e8247..48d3b3d30c21 100644 --- a/trunk/drivers/pcmcia/ds.c +++ b/trunk/drivers/pcmcia/ds.c @@ -1143,12 +1143,6 @@ static int ds_event(struct pcmcia_socket *skt, event_t event, int priority) { struct pcmcia_socket *s = pcmcia_get_socket(skt); - if (!s) { - printk(KERN_ERR "PCMCIA obtaining reference to socket %p " \ - "failed, event 0x%x lost!\n", skt, event); - return -ENODEV; - } - ds_dbg(1, "ds_event(0x%06x, %d, 0x%p)\n", event, priority, skt); diff --git a/trunk/drivers/pnp/pnpacpi/rsparser.c b/trunk/drivers/pnp/pnpacpi/rsparser.c index 3a4a644c2686..407b4eaddcbf 100644 --- a/trunk/drivers/pnp/pnpacpi/rsparser.c +++ b/trunk/drivers/pnp/pnpacpi/rsparser.c @@ -36,13 +36,13 @@ static int irq_flags(int triggering, int polarity) { int flag; if (triggering == ACPI_LEVEL_SENSITIVE) { - if (polarity == ACPI_ACTIVE_LOW) + if(polarity == ACPI_ACTIVE_LOW) flag = IORESOURCE_IRQ_LOWLEVEL; else flag = IORESOURCE_IRQ_HIGHLEVEL; } else { - if (polarity == ACPI_ACTIVE_LOW) + if(polarity == ACPI_ACTIVE_LOW) flag = IORESOURCE_IRQ_LOWEDGE; else flag = IORESOURCE_IRQ_HIGHEDGE; @@ -57,7 +57,7 @@ static void decode_irq_flags(int flag, int *triggering, int *polarity) *triggering = ACPI_LEVEL_SENSITIVE; *polarity = ACPI_ACTIVE_LOW; break; - case IORESOURCE_IRQ_HIGHLEVEL: + case IORESOURCE_IRQ_HIGHLEVEL: *triggering = ACPI_LEVEL_SENSITIVE; *polarity = ACPI_ACTIVE_HIGH; break; @@ -73,7 +73,7 @@ static void decode_irq_flags(int flag, int *triggering, int *polarity) } static void -pnpacpi_parse_allocated_irqresource(struct pnp_resource_table *res, u32 gsi, +pnpacpi_parse_allocated_irqresource(struct pnp_resource_table * res, u32 gsi, int triggering, int polarity) { int i = 0; @@ -101,7 +101,7 @@ pnpacpi_parse_allocated_irqresource(struct pnp_resource_table *res, u32 gsi, } static void -pnpacpi_parse_allocated_dmaresource(struct pnp_resource_table *res, u32 dma) +pnpacpi_parse_allocated_dmaresource(struct pnp_resource_table * res, u32 dma) { int i = 0; while (i < PNP_MAX_DMA && @@ -119,8 +119,8 @@ pnpacpi_parse_allocated_dmaresource(struct pnp_resource_table *res, u32 dma) } static void -pnpacpi_parse_allocated_ioresource(struct pnp_resource_table *res, - u64 io, u64 len) +pnpacpi_parse_allocated_ioresource(struct pnp_resource_table * res, + u32 io, u32 len) { int i = 0; while (!(res->port_resource[i].flags & IORESOURCE_UNSET) && @@ -138,7 +138,7 @@ pnpacpi_parse_allocated_ioresource(struct pnp_resource_table *res, } static void -pnpacpi_parse_allocated_memresource(struct pnp_resource_table *res, +pnpacpi_parse_allocated_memresource(struct pnp_resource_table * res, u64 mem, u64 len) { int i = 0; @@ -156,32 +156,11 @@ pnpacpi_parse_allocated_memresource(struct pnp_resource_table *res, } } -static void -pnpacpi_parse_allocated_address_space(struct pnp_resource_table *res_table, - struct acpi_resource *res) -{ - struct acpi_resource_address64 addr, *p = &addr; - acpi_status status; - - status = acpi_resource_to_address64(res, p); - if (!ACPI_SUCCESS(status)) { - pnp_warn("PnPACPI: failed to convert resource type %d", - res->type); - return; - } - - if (p->resource_type == ACPI_MEMORY_RANGE) - pnpacpi_parse_allocated_memresource(res_table, - p->minimum, p->address_length); - else if (p->resource_type == ACPI_IO_RANGE) - pnpacpi_parse_allocated_ioresource(res_table, - p->minimum, p->address_length); -} static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res, void *data) { - struct pnp_resource_table *res_table = (struct pnp_resource_table *)data; + struct pnp_resource_table * res_table = (struct pnp_resource_table *)data; int i; switch (res->type) { @@ -242,9 +221,19 @@ static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res, res->data.fixed_memory32.address_length); break; case ACPI_RESOURCE_TYPE_ADDRESS16: + pnpacpi_parse_allocated_memresource(res_table, + res->data.address16.minimum, + res->data.address16.address_length); + break; case ACPI_RESOURCE_TYPE_ADDRESS32: + pnpacpi_parse_allocated_memresource(res_table, + res->data.address32.minimum, + res->data.address32.address_length); + break; case ACPI_RESOURCE_TYPE_ADDRESS64: - pnpacpi_parse_allocated_address_space(res_table, res); + pnpacpi_parse_allocated_memresource(res_table, + res->data.address64.minimum, + res->data.address64.address_length); break; case ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64: @@ -266,11 +255,11 @@ static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res, pnp_warn("PnPACPI: unknown resource type %d", res->type); return AE_ERROR; } - + return AE_OK; } -acpi_status pnpacpi_parse_allocated_resource(acpi_handle handle, struct pnp_resource_table *res) +acpi_status pnpacpi_parse_allocated_resource(acpi_handle handle, struct pnp_resource_table * res) { /* Blank the resource table values */ pnp_init_resource_table(res); @@ -328,17 +317,17 @@ static void pnpacpi_parse_dma_option(struct pnp_option *option, struct acpi_reso pnp_err("Invalid DMA transfer type"); } - pnp_register_dma_resource(option, dma); + pnp_register_dma_resource(option,dma); return; } - + static void pnpacpi_parse_irq_option(struct pnp_option *option, struct acpi_resource_irq *p) { int i; - struct pnp_irq *irq; - + struct pnp_irq * irq; + if (p->interrupt_count == 0) return; irq = kcalloc(1, sizeof(struct pnp_irq), GFP_KERNEL); @@ -358,7 +347,7 @@ static void pnpacpi_parse_ext_irq_option(struct pnp_option *option, struct acpi_resource_extended_irq *p) { int i; - struct pnp_irq *irq; + struct pnp_irq * irq; if (p->interrupt_count == 0) return; @@ -379,7 +368,7 @@ static void pnpacpi_parse_port_option(struct pnp_option *option, struct acpi_resource_io *io) { - struct pnp_port *port; + struct pnp_port * port; if (io->address_length == 0) return; @@ -392,7 +381,7 @@ pnpacpi_parse_port_option(struct pnp_option *option, port->size = io->address_length; port->flags = ACPI_DECODE_16 == io->io_decode ? PNP_PORT_FLAG_16BITADDR : 0; - pnp_register_port_resource(option, port); + pnp_register_port_resource(option,port); return; } @@ -400,7 +389,7 @@ static void pnpacpi_parse_fixed_port_option(struct pnp_option *option, struct acpi_resource_fixed_io *io) { - struct pnp_port *port; + struct pnp_port * port; if (io->address_length == 0) return; @@ -411,7 +400,7 @@ pnpacpi_parse_fixed_port_option(struct pnp_option *option, port->size = io->address_length; port->align = 0; port->flags = PNP_PORT_FLAG_FIXED; - pnp_register_port_resource(option, port); + pnp_register_port_resource(option,port); return; } @@ -419,7 +408,7 @@ static void pnpacpi_parse_mem24_option(struct pnp_option *option, struct acpi_resource_memory24 *p) { - struct pnp_mem *mem; + struct pnp_mem * mem; if (p->address_length == 0) return; @@ -434,7 +423,7 @@ pnpacpi_parse_mem24_option(struct pnp_option *option, mem->flags = (ACPI_READ_WRITE_MEMORY == p->write_protect) ? IORESOURCE_MEM_WRITEABLE : 0; - pnp_register_mem_resource(option, mem); + pnp_register_mem_resource(option,mem); return; } @@ -442,7 +431,7 @@ static void pnpacpi_parse_mem32_option(struct pnp_option *option, struct acpi_resource_memory32 *p) { - struct pnp_mem *mem; + struct pnp_mem * mem; if (p->address_length == 0) return; @@ -457,7 +446,7 @@ pnpacpi_parse_mem32_option(struct pnp_option *option, mem->flags = (ACPI_READ_WRITE_MEMORY == p->write_protect) ? IORESOURCE_MEM_WRITEABLE : 0; - pnp_register_mem_resource(option, mem); + pnp_register_mem_resource(option,mem); return; } @@ -465,7 +454,7 @@ static void pnpacpi_parse_fixed_mem32_option(struct pnp_option *option, struct acpi_resource_fixed_memory32 *p) { - struct pnp_mem *mem; + struct pnp_mem * mem; if (p->address_length == 0) return; @@ -479,7 +468,7 @@ pnpacpi_parse_fixed_mem32_option(struct pnp_option *option, mem->flags = (ACPI_READ_WRITE_MEMORY == p->write_protect) ? IORESOURCE_MEM_WRITEABLE : 0; - pnp_register_mem_resource(option, mem); + pnp_register_mem_resource(option,mem); return; } @@ -488,8 +477,8 @@ pnpacpi_parse_address_option(struct pnp_option *option, struct acpi_resource *r) { struct acpi_resource_address64 addr, *p = &addr; acpi_status status; - struct pnp_mem *mem; - struct pnp_port *port; + struct pnp_mem * mem; + struct pnp_port * port; status = acpi_resource_to_address64(r, p); if (!ACPI_SUCCESS(status)) { @@ -509,7 +498,7 @@ pnpacpi_parse_address_option(struct pnp_option *option, struct acpi_resource *r) mem->align = 0; mem->flags = (p->info.mem.write_protect == ACPI_READ_WRITE_MEMORY) ? IORESOURCE_MEM_WRITEABLE : 0; - pnp_register_mem_resource(option, mem); + pnp_register_mem_resource(option,mem); } else if (p->resource_type == ACPI_IO_RANGE) { port = kcalloc(1, sizeof(struct pnp_port), GFP_KERNEL); if (!port) @@ -518,7 +507,7 @@ pnpacpi_parse_address_option(struct pnp_option *option, struct acpi_resource *r) port->size = p->address_length; port->align = 0; port->flags = PNP_PORT_FLAG_FIXED; - pnp_register_port_resource(option, port); + pnp_register_port_resource(option,port); } } @@ -542,7 +531,7 @@ static acpi_status pnpacpi_option_resource(struct acpi_resource *res, break; case ACPI_RESOURCE_TYPE_DMA: - pnpacpi_parse_dma_option(option, &res->data.dma); + pnpacpi_parse_dma_option(option, &res->data.dma); break; case ACPI_RESOURCE_TYPE_START_DEPENDENT: @@ -550,7 +539,7 @@ static acpi_status pnpacpi_option_resource(struct acpi_resource *res, case ACPI_GOOD_CONFIGURATION: priority = PNP_RES_PRIORITY_PREFERRED; break; - + case ACPI_ACCEPTABLE_CONFIGURATION: priority = PNP_RES_PRIORITY_ACCEPTABLE; break; @@ -566,7 +555,7 @@ static acpi_status pnpacpi_option_resource(struct acpi_resource *res, option = pnp_register_dependent_option(dev, priority); if (!option) return AE_ERROR; - parse_data->option = option; + parse_data->option = option; break; case ACPI_RESOURCE_TYPE_END_DEPENDENT: @@ -626,7 +615,7 @@ static acpi_status pnpacpi_option_resource(struct acpi_resource *res, pnp_warn("PnPACPI: unknown resource type %d", res->type); return AE_ERROR; } - + return AE_OK; } @@ -647,8 +636,13 @@ acpi_status pnpacpi_parse_resource_option_data(acpi_handle handle, return status; } -static int pnpacpi_supported_resource(struct acpi_resource *res) +/* + * Set resource + */ +static acpi_status pnpacpi_count_resources(struct acpi_resource *res, + void *data) { + int *res_cnt = (int *)data; switch (res->type) { case ACPI_RESOURCE_TYPE_IRQ: case ACPI_RESOURCE_TYPE_DMA: @@ -661,32 +655,43 @@ static int pnpacpi_supported_resource(struct acpi_resource *res) case ACPI_RESOURCE_TYPE_ADDRESS32: case ACPI_RESOURCE_TYPE_ADDRESS64: case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: - return 1; + (*res_cnt) ++; + case ACPI_RESOURCE_TYPE_START_DEPENDENT: + case ACPI_RESOURCE_TYPE_END_DEPENDENT: + case ACPI_RESOURCE_TYPE_VENDOR: + case ACPI_RESOURCE_TYPE_END_TAG: + case ACPI_RESOURCE_TYPE_GENERIC_REGISTER: + default: + return AE_OK; } - return 0; -} - -/* - * Set resource - */ -static acpi_status pnpacpi_count_resources(struct acpi_resource *res, - void *data) -{ - int *res_cnt = (int *)data; - - if (pnpacpi_supported_resource(res)) - (*res_cnt)++; return AE_OK; } -static acpi_status pnpacpi_type_resources(struct acpi_resource *res, void *data) +static acpi_status pnpacpi_type_resources(struct acpi_resource *res, + void *data) { - struct acpi_resource **resource = (struct acpi_resource **)data; - - if (pnpacpi_supported_resource(res)) { + struct acpi_resource **resource = (struct acpi_resource **)data; + switch (res->type) { + case ACPI_RESOURCE_TYPE_IRQ: + case ACPI_RESOURCE_TYPE_DMA: + case ACPI_RESOURCE_TYPE_IO: + case ACPI_RESOURCE_TYPE_FIXED_IO: + case ACPI_RESOURCE_TYPE_MEMORY24: + case ACPI_RESOURCE_TYPE_MEMORY32: + case ACPI_RESOURCE_TYPE_FIXED_MEMORY32: + case ACPI_RESOURCE_TYPE_ADDRESS16: + case ACPI_RESOURCE_TYPE_ADDRESS32: + case ACPI_RESOURCE_TYPE_ADDRESS64: + case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: (*resource)->type = res->type; - (*resource)->length = sizeof(struct acpi_resource); (*resource)++; + case ACPI_RESOURCE_TYPE_START_DEPENDENT: + case ACPI_RESOURCE_TYPE_END_DEPENDENT: + case ACPI_RESOURCE_TYPE_VENDOR: + case ACPI_RESOURCE_TYPE_END_TAG: + case ACPI_RESOURCE_TYPE_GENERIC_REGISTER: + default: + return AE_OK; } return AE_OK; @@ -730,8 +735,11 @@ static void pnpacpi_encode_irq(struct acpi_resource *resource, struct resource *p) { int triggering, polarity; - - decode_irq_flags(p->flags & IORESOURCE_BITS, &triggering, &polarity); + + decode_irq_flags(p->flags & IORESOURCE_BITS, &triggering, + &polarity); + resource->type = ACPI_RESOURCE_TYPE_IRQ; + resource->length = sizeof(struct acpi_resource); resource->data.irq.triggering = triggering; resource->data.irq.polarity = polarity; if (triggering == ACPI_EDGE_SENSITIVE) @@ -746,8 +754,11 @@ static void pnpacpi_encode_ext_irq(struct acpi_resource *resource, struct resource *p) { int triggering, polarity; - - decode_irq_flags(p->flags & IORESOURCE_BITS, &triggering, &polarity); + + decode_irq_flags(p->flags & IORESOURCE_BITS, &triggering, + &polarity); + resource->type = ACPI_RESOURCE_TYPE_EXTENDED_IRQ; + resource->length = sizeof(struct acpi_resource); resource->data.extended_irq.producer_consumer = ACPI_CONSUMER; resource->data.extended_irq.triggering = triggering; resource->data.extended_irq.polarity = polarity; @@ -762,6 +773,8 @@ static void pnpacpi_encode_ext_irq(struct acpi_resource *resource, static void pnpacpi_encode_dma(struct acpi_resource *resource, struct resource *p) { + resource->type = ACPI_RESOURCE_TYPE_DMA; + resource->length = sizeof(struct acpi_resource); /* Note: pnp_assign_dma will copy pnp_dma->flags into p->flags */ if (p->flags & IORESOURCE_DMA_COMPATIBLE) resource->data.dma.type = ACPI_COMPATIBILITY; @@ -785,6 +798,8 @@ static void pnpacpi_encode_dma(struct acpi_resource *resource, static void pnpacpi_encode_io(struct acpi_resource *resource, struct resource *p) { + resource->type = ACPI_RESOURCE_TYPE_IO; + resource->length = sizeof(struct acpi_resource); /* Note: pnp_assign_port will copy pnp_port->flags into p->flags */ resource->data.io.io_decode = (p->flags & PNP_PORT_FLAG_16BITADDR)? ACPI_DECODE_16 : ACPI_DECODE_10; @@ -797,6 +812,8 @@ static void pnpacpi_encode_io(struct acpi_resource *resource, static void pnpacpi_encode_fixed_io(struct acpi_resource *resource, struct resource *p) { + resource->type = ACPI_RESOURCE_TYPE_FIXED_IO; + resource->length = sizeof(struct acpi_resource); resource->data.fixed_io.address = p->start; resource->data.fixed_io.address_length = p->end - p->start + 1; } @@ -804,6 +821,8 @@ static void pnpacpi_encode_fixed_io(struct acpi_resource *resource, static void pnpacpi_encode_mem24(struct acpi_resource *resource, struct resource *p) { + resource->type = ACPI_RESOURCE_TYPE_MEMORY24; + resource->length = sizeof(struct acpi_resource); /* Note: pnp_assign_mem will copy pnp_mem->flags into p->flags */ resource->data.memory24.write_protect = (p->flags & IORESOURCE_MEM_WRITEABLE) ? @@ -817,6 +836,8 @@ static void pnpacpi_encode_mem24(struct acpi_resource *resource, static void pnpacpi_encode_mem32(struct acpi_resource *resource, struct resource *p) { + resource->type = ACPI_RESOURCE_TYPE_MEMORY32; + resource->length = sizeof(struct acpi_resource); resource->data.memory32.write_protect = (p->flags & IORESOURCE_MEM_WRITEABLE) ? ACPI_READ_WRITE_MEMORY : ACPI_READ_ONLY_MEMORY; @@ -829,6 +850,8 @@ static void pnpacpi_encode_mem32(struct acpi_resource *resource, static void pnpacpi_encode_fixed_mem32(struct acpi_resource *resource, struct resource *p) { + resource->type = ACPI_RESOURCE_TYPE_FIXED_MEMORY32; + resource->length = sizeof(struct acpi_resource); resource->data.fixed_memory32.write_protect = (p->flags & IORESOURCE_MEM_WRITEABLE) ? ACPI_READ_WRITE_MEMORY : ACPI_READ_ONLY_MEMORY; @@ -859,37 +882,37 @@ int pnpacpi_encode_resources(struct pnp_resource_table *res_table, pnp_dbg("Encode dma"); pnpacpi_encode_dma(resource, &res_table->dma_resource[dma]); - dma++; + dma ++; break; case ACPI_RESOURCE_TYPE_IO: pnp_dbg("Encode io"); pnpacpi_encode_io(resource, &res_table->port_resource[port]); - port++; + port ++; break; case ACPI_RESOURCE_TYPE_FIXED_IO: pnp_dbg("Encode fixed io"); pnpacpi_encode_fixed_io(resource, &res_table->port_resource[port]); - port++; + port ++; break; case ACPI_RESOURCE_TYPE_MEMORY24: pnp_dbg("Encode mem24"); pnpacpi_encode_mem24(resource, &res_table->mem_resource[mem]); - mem++; + mem ++; break; case ACPI_RESOURCE_TYPE_MEMORY32: pnp_dbg("Encode mem32"); pnpacpi_encode_mem32(resource, &res_table->mem_resource[mem]); - mem++; + mem ++; break; case ACPI_RESOURCE_TYPE_FIXED_MEMORY32: pnp_dbg("Encode fixed mem32"); pnpacpi_encode_fixed_mem32(resource, &res_table->mem_resource[mem]); - mem++; + mem ++; break; case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: pnp_dbg("Encode ext irq"); @@ -910,8 +933,8 @@ int pnpacpi_encode_resources(struct pnp_resource_table *res_table, pnp_warn("unknown resource type %d", resource->type); return -EINVAL; } - resource++; - i++; + resource ++; + i ++; } return 0; } diff --git a/trunk/drivers/rtc/rtc-m48t86.c b/trunk/drivers/rtc/rtc-m48t86.c index 8c0d1a6739ad..f6e7ee04f3dc 100644 --- a/trunk/drivers/rtc/rtc-m48t86.c +++ b/trunk/drivers/rtc/rtc-m48t86.c @@ -48,33 +48,33 @@ static int m48t86_rtc_read_time(struct device *dev, struct rtc_time *tm) struct platform_device *pdev = to_platform_device(dev); struct m48t86_ops *ops = pdev->dev.platform_data; - reg = ops->readbyte(M48T86_REG_B); + reg = ops->readb(M48T86_REG_B); if (reg & M48T86_REG_B_DM) { /* data (binary) mode */ - tm->tm_sec = ops->readbyte(M48T86_REG_SEC); - tm->tm_min = ops->readbyte(M48T86_REG_MIN); - tm->tm_hour = ops->readbyte(M48T86_REG_HOUR) & 0x3F; - tm->tm_mday = ops->readbyte(M48T86_REG_DOM); + tm->tm_sec = ops->readb(M48T86_REG_SEC); + tm->tm_min = ops->readb(M48T86_REG_MIN); + tm->tm_hour = ops->readb(M48T86_REG_HOUR) & 0x3F; + tm->tm_mday = ops->readb(M48T86_REG_DOM); /* tm_mon is 0-11 */ - tm->tm_mon = ops->readbyte(M48T86_REG_MONTH) - 1; - tm->tm_year = ops->readbyte(M48T86_REG_YEAR) + 100; - tm->tm_wday = ops->readbyte(M48T86_REG_DOW); + tm->tm_mon = ops->readb(M48T86_REG_MONTH) - 1; + tm->tm_year = ops->readb(M48T86_REG_YEAR) + 100; + tm->tm_wday = ops->readb(M48T86_REG_DOW); } else { /* bcd mode */ - tm->tm_sec = BCD2BIN(ops->readbyte(M48T86_REG_SEC)); - tm->tm_min = BCD2BIN(ops->readbyte(M48T86_REG_MIN)); - tm->tm_hour = BCD2BIN(ops->readbyte(M48T86_REG_HOUR) & 0x3F); - tm->tm_mday = BCD2BIN(ops->readbyte(M48T86_REG_DOM)); + tm->tm_sec = BCD2BIN(ops->readb(M48T86_REG_SEC)); + tm->tm_min = BCD2BIN(ops->readb(M48T86_REG_MIN)); + tm->tm_hour = BCD2BIN(ops->readb(M48T86_REG_HOUR) & 0x3F); + tm->tm_mday = BCD2BIN(ops->readb(M48T86_REG_DOM)); /* tm_mon is 0-11 */ - tm->tm_mon = BCD2BIN(ops->readbyte(M48T86_REG_MONTH)) - 1; - tm->tm_year = BCD2BIN(ops->readbyte(M48T86_REG_YEAR)) + 100; - tm->tm_wday = BCD2BIN(ops->readbyte(M48T86_REG_DOW)); + tm->tm_mon = BCD2BIN(ops->readb(M48T86_REG_MONTH)) - 1; + tm->tm_year = BCD2BIN(ops->readb(M48T86_REG_YEAR)) + 100; + tm->tm_wday = BCD2BIN(ops->readb(M48T86_REG_DOW)); } /* correct the hour if the clock is in 12h mode */ if (!(reg & M48T86_REG_B_H24)) - if (ops->readbyte(M48T86_REG_HOUR) & 0x80) + if (ops->readb(M48T86_REG_HOUR) & 0x80) tm->tm_hour += 12; return 0; @@ -86,35 +86,35 @@ static int m48t86_rtc_set_time(struct device *dev, struct rtc_time *tm) struct platform_device *pdev = to_platform_device(dev); struct m48t86_ops *ops = pdev->dev.platform_data; - reg = ops->readbyte(M48T86_REG_B); + reg = ops->readb(M48T86_REG_B); /* update flag and 24h mode */ reg |= M48T86_REG_B_SET | M48T86_REG_B_H24; - ops->writebyte(reg, M48T86_REG_B); + ops->writeb(reg, M48T86_REG_B); if (reg & M48T86_REG_B_DM) { /* data (binary) mode */ - ops->writebyte(tm->tm_sec, M48T86_REG_SEC); - ops->writebyte(tm->tm_min, M48T86_REG_MIN); - ops->writebyte(tm->tm_hour, M48T86_REG_HOUR); - ops->writebyte(tm->tm_mday, M48T86_REG_DOM); - ops->writebyte(tm->tm_mon + 1, M48T86_REG_MONTH); - ops->writebyte(tm->tm_year % 100, M48T86_REG_YEAR); - ops->writebyte(tm->tm_wday, M48T86_REG_DOW); + ops->writeb(tm->tm_sec, M48T86_REG_SEC); + ops->writeb(tm->tm_min, M48T86_REG_MIN); + ops->writeb(tm->tm_hour, M48T86_REG_HOUR); + ops->writeb(tm->tm_mday, M48T86_REG_DOM); + ops->writeb(tm->tm_mon + 1, M48T86_REG_MONTH); + ops->writeb(tm->tm_year % 100, M48T86_REG_YEAR); + ops->writeb(tm->tm_wday, M48T86_REG_DOW); } else { /* bcd mode */ - ops->writebyte(BIN2BCD(tm->tm_sec), M48T86_REG_SEC); - ops->writebyte(BIN2BCD(tm->tm_min), M48T86_REG_MIN); - ops->writebyte(BIN2BCD(tm->tm_hour), M48T86_REG_HOUR); - ops->writebyte(BIN2BCD(tm->tm_mday), M48T86_REG_DOM); - ops->writebyte(BIN2BCD(tm->tm_mon + 1), M48T86_REG_MONTH); - ops->writebyte(BIN2BCD(tm->tm_year % 100), M48T86_REG_YEAR); - ops->writebyte(BIN2BCD(tm->tm_wday), M48T86_REG_DOW); + ops->writeb(BIN2BCD(tm->tm_sec), M48T86_REG_SEC); + ops->writeb(BIN2BCD(tm->tm_min), M48T86_REG_MIN); + ops->writeb(BIN2BCD(tm->tm_hour), M48T86_REG_HOUR); + ops->writeb(BIN2BCD(tm->tm_mday), M48T86_REG_DOM); + ops->writeb(BIN2BCD(tm->tm_mon + 1), M48T86_REG_MONTH); + ops->writeb(BIN2BCD(tm->tm_year % 100), M48T86_REG_YEAR); + ops->writeb(BIN2BCD(tm->tm_wday), M48T86_REG_DOW); } /* update ended */ reg &= ~M48T86_REG_B_SET; - ops->writebyte(reg, M48T86_REG_B); + ops->writeb(reg, M48T86_REG_B); return 0; } @@ -125,12 +125,12 @@ static int m48t86_rtc_proc(struct device *dev, struct seq_file *seq) struct platform_device *pdev = to_platform_device(dev); struct m48t86_ops *ops = pdev->dev.platform_data; - reg = ops->readbyte(M48T86_REG_B); + reg = ops->readb(M48T86_REG_B); seq_printf(seq, "mode\t\t: %s\n", (reg & M48T86_REG_B_DM) ? "binary" : "bcd"); - reg = ops->readbyte(M48T86_REG_D); + reg = ops->readb(M48T86_REG_D); seq_printf(seq, "battery\t\t: %s\n", (reg & M48T86_REG_D_VRT) ? "ok" : "exhausted"); @@ -157,7 +157,7 @@ static int __devinit m48t86_rtc_probe(struct platform_device *dev) platform_set_drvdata(dev, rtc); /* read battery status */ - reg = ops->readbyte(M48T86_REG_D); + reg = ops->readb(M48T86_REG_D); dev_info(&dev->dev, "battery %s\n", (reg & M48T86_REG_D_VRT) ? "ok" : "exhausted"); diff --git a/trunk/drivers/s390/cio/css.h b/trunk/drivers/s390/cio/css.h index e210f89a2449..74a257b23383 100644 --- a/trunk/drivers/s390/cio/css.h +++ b/trunk/drivers/s390/cio/css.h @@ -45,11 +45,11 @@ struct pgid { union { __u8 fc; /* SPID function code */ struct path_state ps; /* SNID path state */ - } __attribute__ ((packed)) inf; + } inf; union { __u32 cpu_addr : 16; /* CPU address */ struct extended_cssid ext_cssid; - } __attribute__ ((packed)) pgid_high; + } pgid_high; __u32 cpu_id : 24; /* CPU identification */ __u32 cpu_model : 16; /* CPU model */ __u32 tod_high; /* high word TOD clock */ diff --git a/trunk/drivers/s390/cio/device_fsm.c b/trunk/drivers/s390/cio/device_fsm.c index 49ec562d7f60..180b3bf8b90d 100644 --- a/trunk/drivers/s390/cio/device_fsm.c +++ b/trunk/drivers/s390/cio/device_fsm.c @@ -749,7 +749,7 @@ ccw_device_irq(struct ccw_device *cdev, enum dev_event dev_event) /* Unit check but no sense data. Need basic sense. */ if (ccw_device_do_sense(cdev, irb) != 0) goto call_handler_unsol; - memcpy(&cdev->private->irb, irb, sizeof(struct irb)); + memcpy(irb, &cdev->private->irb, sizeof(struct irb)); cdev->private->state = DEV_STATE_W4SENSE; cdev->private->intparm = 0; return; diff --git a/trunk/drivers/scsi/ppa.c b/trunk/drivers/scsi/ppa.c index 108910f512e4..fee843fab1c7 100644 --- a/trunk/drivers/scsi/ppa.c +++ b/trunk/drivers/scsi/ppa.c @@ -982,12 +982,6 @@ static int device_check(ppa_struct *dev) return -ENODEV; } -static int ppa_adjust_queue(struct scsi_device *device) -{ - blk_queue_bounce_limit(device->request_queue, BLK_BOUNCE_HIGH); - return 0; -} - static struct scsi_host_template ppa_template = { .module = THIS_MODULE, .proc_name = "ppa", @@ -1003,7 +997,6 @@ static struct scsi_host_template ppa_template = { .cmd_per_lun = 1, .use_clustering = ENABLE_CLUSTERING, .can_queue = 1, - .slave_alloc = ppa_adjust_queue, }; /*************************************************************************** diff --git a/trunk/drivers/scsi/sata_mv.c b/trunk/drivers/scsi/sata_mv.c index f16f92a6ec0f..9b8bca1ac1f0 100644 --- a/trunk/drivers/scsi/sata_mv.c +++ b/trunk/drivers/scsi/sata_mv.c @@ -2035,7 +2035,6 @@ static void mv_phy_reset(struct ata_port *ap) static void mv_eng_timeout(struct ata_port *ap) { struct ata_queued_cmd *qc; - unsigned long flags; printk(KERN_ERR "ata%u: Entering mv_eng_timeout\n",ap->id); DPRINTK("All regs @ start of eng_timeout\n"); @@ -2047,10 +2046,8 @@ static void mv_eng_timeout(struct ata_port *ap) ap->host_set->mmio_base, ap, qc, qc->scsicmd, &qc->scsicmd->cmnd); - spin_lock_irqsave(&ap->host_set->lock, flags); mv_err_intr(ap, 0); mv_stop_and_reset(ap); - spin_unlock_irqrestore(&ap->host_set->lock, flags); WARN_ON(!(qc->flags & ATA_QCFLAG_ACTIVE)); if (qc->flags & ATA_QCFLAG_ACTIVE) { diff --git a/trunk/drivers/scsi/sata_sil24.c b/trunk/drivers/scsi/sata_sil24.c index cb9082fd7e2f..f7264fd611c2 100644 --- a/trunk/drivers/scsi/sata_sil24.c +++ b/trunk/drivers/scsi/sata_sil24.c @@ -454,7 +454,7 @@ static int sil24_softreset(struct ata_port *ap, int verbose, */ msleep(10); - prb->ctrl = cpu_to_le16(PRB_CTRL_SRST); + prb->ctrl = PRB_CTRL_SRST; prb->fis[1] = 0; /* no PM yet */ writel((u32)paddr, port + PORT_CMD_ACTIVATE); @@ -551,9 +551,9 @@ static void sil24_qc_prep(struct ata_queued_cmd *qc) if (qc->tf.protocol != ATA_PROT_ATAPI_NODATA) { if (qc->tf.flags & ATA_TFLAG_WRITE) - prb->ctrl = cpu_to_le16(PRB_CTRL_PACKET_WRITE); + prb->ctrl = PRB_CTRL_PACKET_WRITE; else - prb->ctrl = cpu_to_le16(PRB_CTRL_PACKET_READ); + prb->ctrl = PRB_CTRL_PACKET_READ; } else prb->ctrl = 0; diff --git a/trunk/drivers/scsi/scsi_devinfo.c b/trunk/drivers/scsi/scsi_devinfo.c index 62f8cb7b3d2b..941c1e15c899 100644 --- a/trunk/drivers/scsi/scsi_devinfo.c +++ b/trunk/drivers/scsi/scsi_devinfo.c @@ -165,7 +165,6 @@ static struct { {"HP", "HSV100", NULL, BLIST_REPORTLUN2 | BLIST_NOSTARTONADD}, {"HP", "C1557A", NULL, BLIST_FORCELUN}, {"HP", "C3323-300", "4269", BLIST_NOTQ}, - {"HP", "C5713A", NULL, BLIST_NOREPORTLUN}, {"IBM", "AuSaV1S2", NULL, BLIST_FORCELUN}, {"IBM", "ProFibre 4000R", "*", BLIST_SPARSELUN | BLIST_LARGELUN}, {"IBM", "2105", NULL, BLIST_RETRY_HWERROR}, diff --git a/trunk/drivers/scsi/scsi_lib.c b/trunk/drivers/scsi/scsi_lib.c index faee4757c03a..764a8b375ead 100644 --- a/trunk/drivers/scsi/scsi_lib.c +++ b/trunk/drivers/scsi/scsi_lib.c @@ -367,7 +367,7 @@ static int scsi_req_map_sg(struct request *rq, struct scatterlist *sgl, int nsegs, unsigned bufflen, gfp_t gfp) { struct request_queue *q = rq->q; - int nr_pages = (bufflen + sgl[0].offset + PAGE_SIZE - 1) >> PAGE_SHIFT; + int nr_pages = (bufflen + PAGE_SIZE - 1) >> PAGE_SHIFT; unsigned int data_len = 0, len, bytes, off; struct page *page; struct bio *bio = NULL; diff --git a/trunk/drivers/scsi/scsi_transport_sas.c b/trunk/drivers/scsi/scsi_transport_sas.c index f3b16066387c..8b6d65e21bae 100644 --- a/trunk/drivers/scsi/scsi_transport_sas.c +++ b/trunk/drivers/scsi/scsi_transport_sas.c @@ -955,8 +955,7 @@ static int sas_user_scan(struct Scsi_Host *shost, uint channel, list_for_each_entry(rphy, &sas_host->rphy_list, list) { struct sas_phy *parent = dev_to_phy(rphy->dev.parent); - if (rphy->identify.device_type != SAS_END_DEVICE || - rphy->scsi_target_id == -1) + if (rphy->scsi_target_id == -1) continue; if ((channel == SCAN_WILD_CARD || channel == parent->port_identifier) && @@ -978,6 +977,7 @@ static int sas_user_scan(struct Scsi_Host *shost, uint channel, #define SETUP_TEMPLATE(attrb, field, perm, test) \ i->private_##attrb[count] = class_device_attr_##field; \ i->private_##attrb[count].attr.mode = perm; \ + i->private_##attrb[count].store = NULL; \ i->attrb[count] = &i->private_##attrb[count]; \ if (test) \ count++ diff --git a/trunk/drivers/usb/host/ohci-pxa27x.c b/trunk/drivers/usb/host/ohci-pxa27x.c index fafe7c1265b3..acde8868da21 100644 --- a/trunk/drivers/usb/host/ohci-pxa27x.c +++ b/trunk/drivers/usb/host/ohci-pxa27x.c @@ -185,9 +185,6 @@ int usb_hcd_pxa27x_probe (const struct hc_driver *driver, struct platform_device /* Select Power Management Mode */ pxa27x_ohci_select_pmm(inf->port_mode); - if (inf->power_budget) - hcd->power_budget = inf->power_budget; - ohci_hcd_init(hcd_to_ohci(hcd)); retval = usb_add_hcd(hcd, pdev->resource[1].start, SA_INTERRUPT); diff --git a/trunk/drivers/video/console/fbcon.c b/trunk/drivers/video/console/fbcon.c index 47ba1a79adcd..953eb8c171d6 100644 --- a/trunk/drivers/video/console/fbcon.c +++ b/trunk/drivers/video/console/fbcon.c @@ -1745,7 +1745,7 @@ static int fbcon_scroll(struct vc_data *vc, int t, int b, int dir, fbcon_redraw_move(vc, p, 0, t, count); ypan_up_redraw(vc, t, count); if (vc->vc_rows - b > 0) - fbcon_redraw_move(vc, p, b, + fbcon_redraw_move(vc, p, b - count, vc->vc_rows - b, b); } else fbcon_redraw_move(vc, p, t + count, b - t - count, t); diff --git a/trunk/fs/debugfs/inode.c b/trunk/fs/debugfs/inode.c index b55b4ea9a676..85d166cdcae4 100644 --- a/trunk/fs/debugfs/inode.c +++ b/trunk/fs/debugfs/inode.c @@ -67,13 +67,12 @@ static struct inode *debugfs_get_inode(struct super_block *sb, int mode, dev_t d static int debugfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t dev) { - struct inode *inode; + struct inode *inode = debugfs_get_inode(dir->i_sb, mode, dev); int error = -EPERM; if (dentry->d_inode) return -EEXIST; - inode = debugfs_get_inode(dir->i_sb, mode, dev); if (inode) { d_instantiate(dentry, inode); dget(dentry); diff --git a/trunk/fs/locks.c b/trunk/fs/locks.c index ab61a8b54829..6f99c0a6f836 100644 --- a/trunk/fs/locks.c +++ b/trunk/fs/locks.c @@ -755,7 +755,6 @@ static int flock_lock_file(struct file *filp, struct file_lock *request) if (request->fl_type == F_UNLCK) goto out; - error = -ENOMEM; new_fl = locks_alloc_lock(); if (new_fl == NULL) goto out; @@ -782,7 +781,6 @@ static int flock_lock_file(struct file *filp, struct file_lock *request) locks_copy_lock(new_fl, request); locks_insert_lock(&inode->i_flock, new_fl); new_fl = NULL; - error = 0; out: unlock_kernel(); diff --git a/trunk/fs/namei.c b/trunk/fs/namei.c index d6e2ee251736..96723ae83c89 100644 --- a/trunk/fs/namei.c +++ b/trunk/fs/namei.c @@ -1080,8 +1080,8 @@ static int fastcall do_path_lookup(int dfd, const char *name, nd->flags = flags; nd->depth = 0; + read_lock(¤t->fs->lock); if (*name=='/') { - read_lock(¤t->fs->lock); if (current->fs->altroot && !(nd->flags & LOOKUP_NOALT)) { nd->mnt = mntget(current->fs->altrootmnt); nd->dentry = dget(current->fs->altroot); @@ -1092,35 +1092,33 @@ static int fastcall do_path_lookup(int dfd, const char *name, } nd->mnt = mntget(current->fs->rootmnt); nd->dentry = dget(current->fs->root); - read_unlock(¤t->fs->lock); } else if (dfd == AT_FDCWD) { - read_lock(¤t->fs->lock); nd->mnt = mntget(current->fs->pwdmnt); nd->dentry = dget(current->fs->pwd); - read_unlock(¤t->fs->lock); } else { struct dentry *dentry; file = fget_light(dfd, &fput_needed); retval = -EBADF; if (!file) - goto out_fail; + goto unlock_fail; dentry = file->f_dentry; retval = -ENOTDIR; if (!S_ISDIR(dentry->d_inode->i_mode)) - goto fput_fail; + goto fput_unlock_fail; retval = file_permission(file, MAY_EXEC); if (retval) - goto fput_fail; + goto fput_unlock_fail; nd->mnt = mntget(file->f_vfsmnt); nd->dentry = dget(dentry); fput_light(file, fput_needed); } + read_unlock(¤t->fs->lock); current->total_link_count = 0; retval = link_path_walk(name, nd); out: @@ -1129,12 +1127,13 @@ static int fastcall do_path_lookup(int dfd, const char *name, nd->dentry->d_inode)) audit_inode(name, nd->dentry->d_inode, flags); } -out_fail: return retval; -fput_fail: +fput_unlock_fail: fput_light(file, fput_needed); - goto out_fail; +unlock_fail: + read_unlock(¤t->fs->lock); + return retval; } int fastcall path_lookup(const char *name, unsigned int flags, diff --git a/trunk/include/acpi/acconfig.h b/trunk/include/acpi/acconfig.h index b9beceb33141..e27dc8f29972 100644 --- a/trunk/include/acpi/acconfig.h +++ b/trunk/include/acpi/acconfig.h @@ -63,7 +63,7 @@ /* Current ACPICA subsystem version in YYYYMMDD format */ -#define ACPI_CA_VERSION 0x20060608 +#define ACPI_CA_VERSION 0x20060127 /* * OS name, used for the _OS object. The _OS object is essentially obsolete, @@ -81,7 +81,6 @@ #define ACPI_MAX_PARSE_CACHE_DEPTH 96 /* Parse tree objects */ #define ACPI_MAX_EXTPARSE_CACHE_DEPTH 96 /* Parse tree objects */ #define ACPI_MAX_OBJECT_CACHE_DEPTH 96 /* Interpreter operand objects */ -#define ACPI_MAX_NAMESPACE_CACHE_DEPTH 96 /* Namespace objects */ /* * Should the subsystem abort the loading of an ACPI table if the @@ -103,9 +102,9 @@ #define ACPI_MAX_SEMAPHORE_COUNT 256 -/* Maximum object reference count (detects object deletion issues) */ +/* Max reference count (for debug only) */ -#define ACPI_MAX_REFERENCE_COUNT 0x800 +#define ACPI_MAX_REFERENCE_COUNT 0x400 /* Size of cached memory mapping for system memory operation region */ @@ -172,7 +171,12 @@ /* Array sizes. Used for range checking also */ -#define ACPI_MAX_MATCH_OPCODE 5 +#define ACPI_NUM_ACCESS_TYPES 6 +#define ACPI_NUM_UPDATE_RULES 3 +#define ACPI_NUM_LOCK_RULES 2 +#define ACPI_NUM_MATCH_OPS 6 +#define ACPI_NUM_OPCODES 256 +#define ACPI_NUM_FIELD_NAMES 2 /* RSDP checksums */ @@ -183,6 +187,10 @@ #define ACPI_SMBUS_BUFFER_SIZE 34 +/* Number of strings associated with the _OSI reserved method */ + +#define ACPI_NUM_OSI_STRINGS 10 + /****************************************************************************** * * ACPI AML Debugger diff --git a/trunk/include/acpi/acdisasm.h b/trunk/include/acpi/acdisasm.h index 9a7d6921f534..11a8fe39cb04 100644 --- a/trunk/include/acpi/acdisasm.h +++ b/trunk/include/acpi/acdisasm.h @@ -50,72 +50,26 @@ #define BLOCK_PAREN 1 #define BLOCK_BRACE 2 #define BLOCK_COMMA_LIST 4 -#define ACPI_DEFAULT_RESNAME *(u32 *) "__RD" struct acpi_external_list { char *path; - char *internal_path; struct acpi_external_list *next; - u32 value; - u16 length; - u8 type; }; extern struct acpi_external_list *acpi_gbl_external_list; -typedef const struct acpi_dmtable_info { - u8 opcode; - u8 offset; - char *name; - -} acpi_dmtable_info; - -/* - * Values for Opcode above. - * Note: 0-7 must not change, used as a flag shift value - */ -#define ACPI_DMT_FLAG0 0 -#define ACPI_DMT_FLAG1 1 -#define ACPI_DMT_FLAG2 2 -#define ACPI_DMT_FLAG3 3 -#define ACPI_DMT_FLAG4 4 -#define ACPI_DMT_FLAG5 5 -#define ACPI_DMT_FLAG6 6 -#define ACPI_DMT_FLAG7 7 -#define ACPI_DMT_FLAGS0 8 -#define ACPI_DMT_FLAGS2 9 -#define ACPI_DMT_UINT8 10 -#define ACPI_DMT_UINT16 11 -#define ACPI_DMT_UINT24 12 -#define ACPI_DMT_UINT32 13 -#define ACPI_DMT_UINT56 14 -#define ACPI_DMT_UINT64 15 -#define ACPI_DMT_STRING 16 -#define ACPI_DMT_NAME4 17 -#define ACPI_DMT_NAME6 18 -#define ACPI_DMT_NAME8 19 -#define ACPI_DMT_CHKSUM 20 -#define ACPI_DMT_SPACEID 21 -#define ACPI_DMT_GAS 22 -#define ACPI_DMT_MADT 23 -#define ACPI_DMT_SRAT 24 -#define ACPI_DMT_EXIT 25 - -typedef -void (*ACPI_TABLE_HANDLER) (struct acpi_table_header * table); +/* Strings used for decoding flags to ASL keywords */ -struct acpi_dmtable_data { - char *signature; - struct acpi_dmtable_info *table_info; - ACPI_TABLE_HANDLER table_handler; -}; +extern const char *acpi_gbl_word_decode[4]; +extern const char *acpi_gbl_irq_decode[2]; +extern const char *acpi_gbl_lock_rule[ACPI_NUM_LOCK_RULES]; +extern const char *acpi_gbl_access_types[ACPI_NUM_ACCESS_TYPES]; +extern const char *acpi_gbl_update_rules[ACPI_NUM_UPDATE_RULES]; +extern const char *acpi_gbl_match_ops[ACPI_NUM_MATCH_OPS]; struct acpi_op_walk_info { u32 level; - u32 last_level; - u32 count; u32 bit_offset; - u32 flags; struct acpi_walk_state *walk_state; }; @@ -123,100 +77,6 @@ typedef acpi_status(*asl_walk_callback) (union acpi_parse_object * op, u32 level, void *context); -struct acpi_resource_tag { - u32 bit_index; - char *tag; -}; - -/* Strings used for decoding flags to ASL keywords */ - -extern const char *acpi_gbl_word_decode[]; -extern const char *acpi_gbl_irq_decode[]; -extern const char *acpi_gbl_lock_rule[]; -extern const char *acpi_gbl_access_types[]; -extern const char *acpi_gbl_update_rules[]; -extern const char *acpi_gbl_match_ops[]; - -extern struct acpi_dmtable_info acpi_dm_table_info_asf0[]; -extern struct acpi_dmtable_info acpi_dm_table_info_asf1[]; -extern struct acpi_dmtable_info acpi_dm_table_info_asf2[]; -extern struct acpi_dmtable_info acpi_dm_table_info_asf3[]; -extern struct acpi_dmtable_info acpi_dm_table_info_asf4[]; -extern struct acpi_dmtable_info acpi_dm_table_info_asf_hdr[]; -extern struct acpi_dmtable_info acpi_dm_table_info_boot[]; -extern struct acpi_dmtable_info acpi_dm_table_info_cpep[]; -extern struct acpi_dmtable_info acpi_dm_table_info_cpep0[]; -extern struct acpi_dmtable_info acpi_dm_table_info_dbgp[]; -extern struct acpi_dmtable_info acpi_dm_table_info_ecdt[]; -extern struct acpi_dmtable_info acpi_dm_table_info_facs[]; -extern struct acpi_dmtable_info acpi_dm_table_info_fadt1[]; -extern struct acpi_dmtable_info acpi_dm_table_info_fadt2[]; -extern struct acpi_dmtable_info acpi_dm_table_info_gas[]; -extern struct acpi_dmtable_info acpi_dm_table_info_header[]; -extern struct acpi_dmtable_info acpi_dm_table_info_hpet[]; -extern struct acpi_dmtable_info acpi_dm_table_info_madt[]; -extern struct acpi_dmtable_info acpi_dm_table_info_madt0[]; -extern struct acpi_dmtable_info acpi_dm_table_info_madt1[]; -extern struct acpi_dmtable_info acpi_dm_table_info_madt2[]; -extern struct acpi_dmtable_info acpi_dm_table_info_madt3[]; -extern struct acpi_dmtable_info acpi_dm_table_info_madt4[]; -extern struct acpi_dmtable_info acpi_dm_table_info_madt5[]; -extern struct acpi_dmtable_info acpi_dm_table_info_madt6[]; -extern struct acpi_dmtable_info acpi_dm_table_info_madt7[]; -extern struct acpi_dmtable_info acpi_dm_table_info_madt8[]; -extern struct acpi_dmtable_info acpi_dm_table_info_madt_hdr[]; -extern struct acpi_dmtable_info acpi_dm_table_info_mcfg[]; -extern struct acpi_dmtable_info acpi_dm_table_info_mcfg0[]; -extern struct acpi_dmtable_info acpi_dm_table_info_rsdp1[]; -extern struct acpi_dmtable_info acpi_dm_table_info_rsdp2[]; -extern struct acpi_dmtable_info acpi_dm_table_info_sbst[]; -extern struct acpi_dmtable_info acpi_dm_table_info_slit[]; -extern struct acpi_dmtable_info acpi_dm_table_info_spcr[]; -extern struct acpi_dmtable_info acpi_dm_table_info_spmi[]; -extern struct acpi_dmtable_info acpi_dm_table_info_srat[]; -extern struct acpi_dmtable_info acpi_dm_table_info_srat0[]; -extern struct acpi_dmtable_info acpi_dm_table_info_srat1[]; -extern struct acpi_dmtable_info acpi_dm_table_info_tcpa[]; -extern struct acpi_dmtable_info acpi_dm_table_info_wdrt[]; - -/* - * dmtable - */ -void acpi_dm_dump_data_table(struct acpi_table_header *table); - -void -acpi_dm_dump_table(u32 table_length, - u32 table_offset, - void *table, - u32 sub_table_length, struct acpi_dmtable_info *info); - -void acpi_dm_line_header(u32 offset, u32 byte_length, char *name); - -void acpi_dm_line_header2(u32 offset, u32 byte_length, char *name, u32 value); - -/* - * dmtbdump - */ -void acpi_dm_dump_asf(struct acpi_table_header *table); - -void acpi_dm_dump_cpep(struct acpi_table_header *table); - -void acpi_dm_dump_fadt(struct acpi_table_header *table); - -void acpi_dm_dump_srat(struct acpi_table_header *table); - -void acpi_dm_dump_mcfg(struct acpi_table_header *table); - -void acpi_dm_dump_madt(struct acpi_table_header *table); - -u32 acpi_dm_dump_rsdp(struct acpi_table_header *table); - -void acpi_dm_dump_rsdt(struct acpi_table_header *table); - -void acpi_dm_dump_slit(struct acpi_table_header *table); - -void acpi_dm_dump_xsdt(struct acpi_table_header *table); - /* * dmwalk */ @@ -224,11 +84,6 @@ void acpi_dm_disassemble(struct acpi_walk_state *walk_state, union acpi_parse_object *origin, u32 num_opcodes); -void -acpi_dm_walk_parse_tree(union acpi_parse_object *op, - asl_walk_callback descending_callback, - asl_walk_callback ascending_callback, void *context); - /* * dmopcode */ @@ -311,7 +166,6 @@ void acpi_dm_dump_integer64(u64 value, char *name); void acpi_dm_resource_template(struct acpi_op_walk_info *info, - union acpi_parse_object *op, u8 * byte_data, u32 byte_count); u8 acpi_dm_is_resource_template(union acpi_parse_object *op); @@ -322,8 +176,6 @@ void acpi_dm_bit_list(u16 mask); void acpi_dm_decode_attribute(u8 attribute); -void acpi_dm_descriptor_name(void); - /* * dmresrcl */ @@ -396,15 +248,6 @@ acpi_dm_vendor_small_descriptor(union aml_resource *resource, /* * dmutils */ -void acpi_dm_add_to_external_list(char *path, u8 type, u32 value); - -/* - * dmrestag - */ -void acpi_dm_find_resources(union acpi_parse_object *root); - -void -acpi_dm_check_resource_reference(union acpi_parse_object *op, - struct acpi_walk_state *walk_state); +void acpi_dm_add_to_external_list(char *path); #endif /* __ACDISASM_H__ */ diff --git a/trunk/include/acpi/acdispat.h b/trunk/include/acpi/acdispat.h index 288f84903af7..c41a926ff317 100644 --- a/trunk/include/acpi/acdispat.h +++ b/trunk/include/acpi/acdispat.h @@ -194,9 +194,7 @@ acpi_status acpi_ds_restart_control_method(struct acpi_walk_state *walk_state, union acpi_operand_object *return_desc); -void -acpi_ds_terminate_control_method(union acpi_operand_object *method_desc, - struct acpi_walk_state *walk_state); +void acpi_ds_terminate_control_method(struct acpi_walk_state *walk_state); acpi_status acpi_ds_begin_method_execution(struct acpi_namespace_node *method_node, @@ -304,7 +302,7 @@ acpi_ds_init_aml_walk(struct acpi_walk_state *walk_state, struct acpi_namespace_node *method_node, u8 * aml_start, u32 aml_length, - struct acpi_evaluate_info *info, u8 pass_number); + struct acpi_parameter_info *info, u8 pass_number); acpi_status acpi_ds_obj_stack_pop_and_delete(u32 pop_count, diff --git a/trunk/include/acpi/acevents.h b/trunk/include/acpi/acevents.h index 234142828e1a..f2717be4fe0d 100644 --- a/trunk/include/acpi/acevents.h +++ b/trunk/include/acpi/acevents.h @@ -93,7 +93,7 @@ struct acpi_gpe_event_info *acpi_ev_get_gpe_event_info(acpi_handle gpe_device, */ u8 acpi_ev_valid_gpe_event(struct acpi_gpe_event_info *gpe_event_info); -acpi_status acpi_ev_walk_gpe_list(acpi_gpe_callback gpe_walk_callback); +acpi_status acpi_ev_walk_gpe_list(ACPI_GPE_CALLBACK gpe_walk_callback); acpi_status acpi_ev_delete_gpe_handlers(struct acpi_gpe_xrupt_info *gpe_xrupt_info, @@ -138,7 +138,7 @@ acpi_status acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, u32 function, acpi_physical_address address, - u32 bit_width, acpi_integer * value); + u32 bit_width, void *value); acpi_status acpi_ev_attach_region(union acpi_operand_object *handler_obj, diff --git a/trunk/include/acpi/acexcep.h b/trunk/include/acpi/acexcep.h index 797ca1ea5214..dc768aa580e4 100644 --- a/trunk/include/acpi/acexcep.h +++ b/trunk/include/acpi/acexcep.h @@ -160,9 +160,8 @@ #define AE_AML_BAD_RESOURCE_VALUE (acpi_status) (0x001F | AE_CODE_AML) #define AE_AML_CIRCULAR_REFERENCE (acpi_status) (0x0020 | AE_CODE_AML) #define AE_AML_BAD_RESOURCE_LENGTH (acpi_status) (0x0021 | AE_CODE_AML) -#define AE_AML_ILLEGAL_ADDRESS (acpi_status) (0x0022 | AE_CODE_AML) -#define AE_CODE_AML_MAX 0x0022 +#define AE_CODE_AML_MAX 0x0021 /* * Internal exceptions used for control @@ -276,8 +275,7 @@ char const *acpi_gbl_exception_names_aml[] = { "AE_AML_NO_RESOURCE_END_TAG", "AE_AML_BAD_RESOURCE_VALUE", "AE_AML_CIRCULAR_REFERENCE", - "AE_AML_BAD_RESOURCE_LENGTH", - "AE_AML_ILLEGAL_ADDRESS" + "AE_AML_BAD_RESOURCE_LENGTH" }; char const *acpi_gbl_exception_names_ctrl[] = { diff --git a/trunk/include/acpi/acglobal.h b/trunk/include/acpi/acglobal.h index 14531d48f6b6..734cc77bf2c7 100644 --- a/trunk/include/acpi/acglobal.h +++ b/trunk/include/acpi/acglobal.h @@ -107,7 +107,6 @@ ACPI_EXTERN u32 acpi_gbl_trace_flags; * 3) Allow access to uninitialized locals/args (auto-init to integer 0) * 4) Allow ANY object type to be a source operand for the Store() operator * 5) Allow unresolved references (invalid target name) in package objects - * 6) Enable warning messages for behavior that is not ACPI spec compliant */ ACPI_EXTERN u8 ACPI_INIT_GLOBAL(acpi_gbl_enable_interpreter_slack, FALSE); @@ -115,7 +114,7 @@ ACPI_EXTERN u8 ACPI_INIT_GLOBAL(acpi_gbl_enable_interpreter_slack, FALSE); * Automatically serialize ALL control methods? Default is FALSE, meaning * to use the Serialized/not_serialized method flags on a per method basis. * Only change this if the ASL code is poorly written and cannot handle - * reentrancy even though methods are marked "NotSerialized". + * reentrancy even though methods are marked "not_serialized". */ ACPI_EXTERN u8 ACPI_INIT_GLOBAL(acpi_gbl_all_methods_serialized, FALSE); @@ -150,10 +149,10 @@ ACPI_EXTERN u8 ACPI_INIT_GLOBAL(acpi_gbl_leave_wake_gpes_disabled, TRUE); ACPI_EXTERN u32 acpi_gbl_table_flags; ACPI_EXTERN u32 acpi_gbl_rsdt_table_count; ACPI_EXTERN struct rsdp_descriptor *acpi_gbl_RSDP; -ACPI_EXTERN struct xsdt_descriptor *acpi_gbl_XSDT; -ACPI_EXTERN struct fadt_descriptor *acpi_gbl_FADT; +ACPI_EXTERN XSDT_DESCRIPTOR *acpi_gbl_XSDT; +ACPI_EXTERN FADT_DESCRIPTOR *acpi_gbl_FADT; ACPI_EXTERN struct acpi_table_header *acpi_gbl_DSDT; -ACPI_EXTERN struct facs_descriptor *acpi_gbl_FACS; +ACPI_EXTERN FACS_DESCRIPTOR *acpi_gbl_FACS; ACPI_EXTERN struct acpi_common_facs acpi_gbl_common_fACS; /* * Since there may be multiple SSDTs and PSDTs, a single pointer is not @@ -178,15 +177,15 @@ ACPI_EXTERN u8 acpi_gbl_integer_nybble_width; /* * ACPI Table info arrays */ -extern struct acpi_table_list acpi_gbl_table_lists[ACPI_TABLE_ID_MAX + 1]; -extern struct acpi_table_support acpi_gbl_table_data[ACPI_TABLE_ID_MAX + 1]; +extern struct acpi_table_list acpi_gbl_table_lists[NUM_ACPI_TABLE_TYPES]; +extern struct acpi_table_support acpi_gbl_table_data[NUM_ACPI_TABLE_TYPES]; /* * 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 struct acpi_mutex_info acpi_gbl_mutex_info[ACPI_NUM_MUTEX]; +ACPI_EXTERN struct acpi_mutex_info acpi_gbl_mutex_info[NUM_MUTEX]; /***************************************************************************** * @@ -204,7 +203,6 @@ ACPI_EXTERN struct acpi_memory_list *acpi_gbl_ns_node_list; /* Object caches */ -ACPI_EXTERN acpi_cache_t *acpi_gbl_namespace_cache; ACPI_EXTERN acpi_cache_t *acpi_gbl_state_cache; ACPI_EXTERN acpi_cache_t *acpi_gbl_ps_node_cache; ACPI_EXTERN acpi_cache_t *acpi_gbl_ps_node_ext_cache; @@ -246,6 +244,7 @@ extern const char *acpi_gbl_sleep_state_names[ACPI_S_STATE_COUNT]; extern const char *acpi_gbl_highest_dstate_names[4]; extern const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES]; extern const char *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS]; +extern const char *acpi_gbl_valid_osi_strings[ACPI_NUM_OSI_STRINGS]; /***************************************************************************** * @@ -290,6 +289,14 @@ ACPI_EXTERN struct acpi_thread_state *acpi_gbl_current_walk_list; ACPI_EXTERN u8 acpi_gbl_cm_single_step; +/***************************************************************************** + * + * Parser globals + * + ****************************************************************************/ + +ACPI_EXTERN union acpi_parse_object *acpi_gbl_parsed_namespace_root; + /***************************************************************************** * * Hardware globals @@ -314,11 +321,7 @@ ACPI_EXTERN struct acpi_fixed_event_handler ACPI_EXTERN struct acpi_gpe_xrupt_info *acpi_gbl_gpe_xrupt_list_head; ACPI_EXTERN struct acpi_gpe_block_info *acpi_gbl_gpe_fadt_blocks[ACPI_MAX_GPE_BLOCKS]; - -/* Spinlocks */ - ACPI_EXTERN acpi_handle acpi_gbl_gpe_lock; -ACPI_EXTERN acpi_handle acpi_gbl_hardware_lock; /***************************************************************************** * diff --git a/trunk/include/acpi/aclocal.h b/trunk/include/acpi/aclocal.h index 1eeca7adca95..8361820d2970 100644 --- a/trunk/include/acpi/aclocal.h +++ b/trunk/include/acpi/aclocal.h @@ -44,10 +44,7 @@ #ifndef __ACLOCAL_H__ #define __ACLOCAL_H__ -/* acpisrc:struct_defs -- for acpisrc conversion */ - #define ACPI_WAIT_FOREVER 0xFFFF /* u16, as per ACPI spec */ -#define ACPI_INFINITE_CONCURRENCY 0xFF typedef void *acpi_mutex; typedef u32 acpi_mutex_handle; @@ -72,55 +69,52 @@ union acpi_parse_object; * Predefined handles for the mutex objects used within the subsystem * All mutex objects are automatically created by acpi_ut_mutex_initialize. * - * The acquire/release ordering protocol is implied via this list. Mutexes + * The acquire/release ordering protocol is implied via this list. Mutexes * with a lower value must be acquired before mutexes with a higher value. * - * NOTE: any changes here must be reflected in the acpi_gbl_mutex_names - * table below also! + * NOTE: any changes here must be reflected in the acpi_gbl_mutex_names table also! */ -#define ACPI_MTX_INTERPRETER 0 /* AML Interpreter, main lock */ -#define ACPI_MTX_CONTROL_METHOD 1 /* Control method termination [TBD: may no longer be necessary] */ -#define ACPI_MTX_TABLES 2 /* Data for ACPI tables */ -#define ACPI_MTX_NAMESPACE 3 /* ACPI Namespace */ -#define ACPI_MTX_EVENTS 4 /* Data for ACPI events */ -#define ACPI_MTX_CACHES 5 /* Internal caches, general purposes */ -#define ACPI_MTX_MEMORY 6 /* Debug memory tracking lists */ -#define ACPI_MTX_DEBUG_CMD_COMPLETE 7 /* AML debugger */ -#define ACPI_MTX_DEBUG_CMD_READY 8 /* AML debugger */ - -#define ACPI_MAX_MUTEX 8 -#define ACPI_NUM_MUTEX ACPI_MAX_MUTEX+1 +#define ACPI_MTX_EXECUTE 0 +#define ACPI_MTX_INTERPRETER 1 +#define ACPI_MTX_PARSER 2 +#define ACPI_MTX_DISPATCHER 3 +#define ACPI_MTX_TABLES 4 +#define ACPI_MTX_OP_REGIONS 5 +#define ACPI_MTX_NAMESPACE 6 +#define ACPI_MTX_EVENTS 7 +#define ACPI_MTX_HARDWARE 8 +#define ACPI_MTX_CACHES 9 +#define ACPI_MTX_MEMORY 10 +#define ACPI_MTX_DEBUG_CMD_COMPLETE 11 +#define ACPI_MTX_DEBUG_CMD_READY 12 + +#define MAX_MUTEX 12 +#define NUM_MUTEX MAX_MUTEX+1 #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) #ifdef DEFINE_ACPI_GLOBALS -/* Debug names for the mutexes above */ +/* Names for the mutexes used in the subsystem */ -static char *acpi_gbl_mutex_names[ACPI_NUM_MUTEX] = { +static char *acpi_gbl_mutex_names[] = { + "ACPI_MTX_Execute", "ACPI_MTX_Interpreter", - "ACPI_MTX_Method", + "ACPI_MTX_Parser", + "ACPI_MTX_Dispatcher", "ACPI_MTX_Tables", + "ACPI_MTX_op_regions", "ACPI_MTX_Namespace", "ACPI_MTX_Events", + "ACPI_MTX_Hardware", "ACPI_MTX_Caches", "ACPI_MTX_Memory", - "ACPI_MTX_DebugCmdComplete", - "ACPI_MTX_DebugCmdReady" + "ACPI_MTX_debug_cmd_complete", + "ACPI_MTX_debug_cmd_ready", }; #endif #endif -/* - * Predefined handles for spinlocks used within the subsystem. - * These spinlocks are created by acpi_ut_mutex_initialize - */ -#define ACPI_LOCK_GPES 0 -#define ACPI_LOCK_HARDWARE 1 - -#define ACPI_MAX_LOCK 1 -#define ACPI_NUM_LOCK ACPI_MAX_LOCK+1 - /* Owner IDs are used to track namespace nodes for selective deletion */ typedef u8 acpi_owner_id; @@ -135,7 +129,7 @@ typedef u8 acpi_owner_id; struct acpi_mutex_info { acpi_mutex mutex; u32 use_count; - acpi_thread_id thread_id; + u32 thread_id; }; /* Lock flag parameter for various interfaces */ @@ -150,8 +144,6 @@ struct acpi_mutex_info { #define ACPI_FIELD_DWORD_GRANULARITY 4 #define ACPI_FIELD_QWORD_GRANULARITY 8 -#define ACPI_ENTRY_NOT_FOUND NULL - /***************************************************************************** * * Namespace typedefs and structs @@ -166,55 +158,49 @@ typedef enum { ACPI_IMODE_EXECUTE = 0x0E } acpi_interpreter_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. + */ union acpi_name_union { u32 integer; char ascii[4]; }; -/* - * The Namespace Node describes a named object that appears in the AML. - * descriptor_type is used to differentiate between internal descriptors. - * - * The node is optimized for both 32-bit and 64-bit platforms: - * 20 bytes for the 32-bit case, 32 bytes for the 64-bit case. - * - * Note: The descriptor_type and Type fields must appear in the identical - * position in both the struct acpi_namespace_node and union acpi_operand_object - * structures. - */ struct acpi_namespace_node { - union acpi_operand_object *object; /* Interpreter object */ - u8 descriptor_type; /* Differentiate object descriptor types */ - u8 type; /* ACPI Type associated with this name */ - u8 flags; /* Miscellaneous flags */ - acpi_owner_id owner_id; /* Node creator */ + u8 descriptor; /* Used to differentiate object descriptor types */ + u8 type; /* Type associated with this name */ + u16 reference_count; /* Current count of references and children */ union acpi_name_union name; /* ACPI Name, always 4 chars per ACPI spec */ + union acpi_operand_object *object; /* Pointer to attached ACPI object (optional) */ struct acpi_namespace_node *child; /* First child */ - struct acpi_namespace_node *peer; /* Peer. Parent if ANOBJ_END_OF_PEER_LIST set */ + struct acpi_namespace_node *peer; /* Next peer */ + u8 owner_id; /* Who created this node */ + u8 flags; - /* - * The following fields are used by the ASL compiler and disassembler only - */ -#ifdef ACPI_LARGE_NAMESPACE_NODE - union acpi_parse_object *op; + /* Fields used by the ASL compiler only */ + +#ifdef ACPI_ASL_COMPILER u32 value; - u32 length; + union acpi_parse_object *op; #endif }; -/* Namespace Node flags */ +#define ACPI_ENTRY_NOT_FOUND NULL -#define ANOBJ_END_OF_PEER_LIST 0x01 /* End-of-list, Peer field points to parent */ -#define ANOBJ_DATA_WIDTH_32 0x02 /* Parent table uses 32-bit math */ -#define ANOBJ_METHOD_ARG 0x04 /* Node is a method argument */ -#define ANOBJ_METHOD_LOCAL 0x08 /* Node is a method local */ -#define ANOBJ_SUBTREE_HAS_INI 0x10 /* Used to optimize device initialization */ +/* Node flags */ -#define ANOBJ_IS_EXTERNAL 0x08 /* i_aSL only: This object created via External() */ -#define ANOBJ_METHOD_NO_RETVAL 0x10 /* i_aSL only: Method has no return value */ -#define ANOBJ_METHOD_SOME_NO_RETVAL 0x20 /* i_aSL only: Method has at least one return value */ -#define ANOBJ_IS_BIT_OFFSET 0x40 /* i_aSL only: Reference is a bit offset */ -#define ANOBJ_IS_REFERENCED 0x80 /* i_aSL only: Object was referenced */ +#define ANOBJ_RESERVED 0x01 +#define ANOBJ_END_OF_PEER_LIST 0x02 +#define ANOBJ_DATA_WIDTH_32 0x04 /* Parent table is 64-bits */ +#define ANOBJ_METHOD_ARG 0x08 +#define ANOBJ_METHOD_LOCAL 0x10 +#define ANOBJ_METHOD_NO_RETVAL 0x20 +#define ANOBJ_METHOD_SOME_NO_RETVAL 0x40 +#define ANOBJ_IS_BIT_OFFSET 0x80 /* * ACPI Table Descriptor. One per ACPI table @@ -226,8 +212,8 @@ struct acpi_table_desc { struct acpi_table_header *pointer; u8 *aml_start; u64 physical_address; - acpi_size length; u32 aml_length; + acpi_size length; acpi_owner_id owner_id; u8 type; u8 allocation; @@ -290,9 +276,6 @@ struct acpi_create_field_info { u8 field_type; }; -typedef -acpi_status(*ACPI_INTERNAL_METHOD) (struct acpi_walk_state * walk_state); - /* * Bitmapped ACPI types. Used internally only */ @@ -394,7 +377,7 @@ struct acpi_gpe_walk_info { struct acpi_gpe_block_info *gpe_block; }; -typedef acpi_status(*acpi_gpe_callback) (struct acpi_gpe_xrupt_info * +typedef acpi_status(*ACPI_GPE_CALLBACK) (struct acpi_gpe_xrupt_info * gpe_xrupt_info, struct acpi_gpe_block_info * gpe_block); @@ -433,14 +416,13 @@ struct acpi_field_info { #define ACPI_CONTROL_PREDICATE_FALSE 0xC3 #define ACPI_CONTROL_PREDICATE_TRUE 0xC4 -#define ACPI_STATE_COMMON \ - void *next; \ - u8 descriptor_type; /* To differentiate various internal objs */\ - u8 flags; \ - u16 value; \ - u16 state; - - /* There are 2 bytes available here until the next natural alignment boundary */ +#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 reserved; \ + void *next; struct acpi_common_state { ACPI_STATE_COMMON}; @@ -456,12 +438,12 @@ struct acpi_update_state { * Pkg state - used to traverse nested package structures */ struct acpi_pkg_state { - ACPI_STATE_COMMON u16 index; - union acpi_operand_object *source_object; + ACPI_STATE_COMMON union acpi_operand_object *source_object; union acpi_operand_object *dest_object; struct acpi_walk_state *walk_state; void *this_target_obj; u32 num_packages; + u16 index; }; /* @@ -469,10 +451,10 @@ struct acpi_pkg_state { * Allows nesting of these constructs */ struct acpi_control_state { - ACPI_STATE_COMMON u16 opcode; - union acpi_parse_object *predicate_op; + ACPI_STATE_COMMON union acpi_parse_object *predicate_op; u8 *aml_predicate_start; /* Start of if/while predicate */ u8 *package_end; /* End of if/while block */ + u16 opcode; }; /* @@ -483,11 +465,11 @@ struct acpi_scope_state { }; struct acpi_pscope_state { - ACPI_STATE_COMMON u32 arg_count; /* Number of fixed arguments */ - union acpi_parse_object *op; /* Current op being parsed */ + ACPI_STATE_COMMON union acpi_parse_object *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 */ }; /* @@ -495,10 +477,10 @@ struct acpi_pscope_state { * states are created when there are nested control methods executing. */ struct acpi_thread_state { - ACPI_STATE_COMMON u8 current_sync_level; /* Mutex Sync (nested acquire) level */ - struct acpi_walk_state *walk_state_list; /* Head of list of walk_states for this thread */ + ACPI_STATE_COMMON struct acpi_walk_state *walk_state_list; /* Head of list of walk_states for this thread */ union acpi_operand_object *acquired_mutex_list; /* List of all currently acquired mutexes */ - acpi_thread_id thread_id; /* Running thread ID */ + u32 thread_id; /* Running thread ID */ + u8 current_sync_level; /* Mutex Sync (nested acquire) level */ }; /* @@ -506,9 +488,10 @@ struct acpi_thread_state { * AML arguments */ struct acpi_result_values { - ACPI_STATE_COMMON u8 num_results; + ACPI_STATE_COMMON + union acpi_operand_object *obj_desc[ACPI_OBJ_NUM_OPERANDS]; + u8 num_results; u8 last_insert; - union acpi_operand_object *obj_desc[ACPI_OBJ_NUM_OPERANDS]; }; typedef @@ -563,7 +546,7 @@ struct acpi_opcode_info { #endif u32 parse_args; /* Grammar/Parse time arguments */ u32 runtime_args; /* Interpret time arguments */ - u16 flags; /* Misc flags */ + u32 flags; /* Misc flags */ u8 object_type; /* Corresponding internal object type */ u8 class; /* Opcode class */ u8 type; /* Opcode type */ @@ -580,31 +563,29 @@ union acpi_parse_value { }; #define ACPI_PARSE_COMMON \ - union acpi_parse_object *parent; /* Parent op */\ - u8 descriptor_type; /* To differentiate various internal objs */\ - u8 flags; /* Type of Op */\ - u16 aml_opcode; /* AML opcode */\ - u32 aml_offset; /* Offset of declaration in AML */\ - union acpi_parse_object *next; /* Next op */\ - struct acpi_namespace_node *node; /* For use by interpreter */\ - union acpi_parse_value value; /* Value or args associated with the opcode */\ + u8 data_type; /* To differentiate various internal objs */\ + u8 flags; /* Type of Op */\ + u16 aml_opcode; /* AML opcode */\ + u32 aml_offset; /* Offset of declaration in AML */\ + union acpi_parse_object *parent; /* Parent op */\ + union acpi_parse_object *next; /* Next op */\ ACPI_DISASM_ONLY_MEMBERS (\ - u8 disasm_flags; /* Used during AML disassembly */\ - u8 disasm_opcode; /* Subtype used for disassembly */\ - char aml_op_name[16]) /* Op name (debug only) */ - -#define ACPI_DASM_BUFFER 0x00 -#define ACPI_DASM_RESOURCE 0x01 -#define ACPI_DASM_STRING 0x02 -#define ACPI_DASM_UNICODE 0x03 -#define ACPI_DASM_EISAID 0x04 -#define ACPI_DASM_MATCHOP 0x05 -#define ACPI_DASM_LNOT_PREFIX 0x06 -#define ACPI_DASM_LNOT_SUFFIX 0x07 -#define ACPI_DASM_IGNORE 0x08 + u8 disasm_flags; /* Used during AML disassembly */\ + u8 disasm_opcode; /* Subtype used for disassembly */\ + char aml_op_name[16]) /* Op name (debug only) */\ + /* NON-DEBUG members below: */\ + struct acpi_namespace_node *node; /* For use by interpreter */\ + union acpi_parse_value value; /* Value or args associated with the opcode */ + +#define ACPI_DASM_BUFFER 0x00 +#define ACPI_DASM_RESOURCE 0x01 +#define ACPI_DASM_STRING 0x02 +#define ACPI_DASM_UNICODE 0x03 +#define ACPI_DASM_EISAID 0x04 +#define ACPI_DASM_MATCHOP 0x05 /* - * Generic operation (for example: If, While, Store) + * generic operation (for example: If, While, Store) */ struct acpi_parse_obj_common { ACPI_PARSE_COMMON}; @@ -620,7 +601,7 @@ struct acpi_parse_obj_named { u32 name; /* 4-byte name or zero if no name */ }; -/* This version is used by the i_aSL compiler only */ +/* The parse node is the fundamental element of the parse tree */ #define ACPI_MAX_PARSEOP_NAME 20 @@ -662,6 +643,7 @@ union acpi_parse_object { * method. */ struct acpi_parse_state { + u32 aml_size; u8 *aml_start; /* First AML byte */ u8 *aml; /* Next AML byte */ u8 *aml_end; /* (last + 1) AML byte */ @@ -671,23 +653,22 @@ struct acpi_parse_state { struct acpi_namespace_node *start_node; union acpi_generic_state *scope; /* Current scope */ union acpi_parse_object *start_scope; - u32 aml_size; }; /* Parse object flags */ -#define ACPI_PARSEOP_GENERIC 0x01 -#define ACPI_PARSEOP_NAMED 0x02 -#define ACPI_PARSEOP_DEFERRED 0x04 -#define ACPI_PARSEOP_BYTELIST 0x08 -#define ACPI_PARSEOP_IN_CACHE 0x80 +#define ACPI_PARSEOP_GENERIC 0x01 +#define ACPI_PARSEOP_NAMED 0x02 +#define ACPI_PARSEOP_DEFERRED 0x04 +#define ACPI_PARSEOP_BYTELIST 0x08 +#define ACPI_PARSEOP_IN_CACHE 0x80 /* Parse object disasm_flags */ -#define ACPI_PARSEOP_IGNORE 0x01 -#define ACPI_PARSEOP_PARAMLIST 0x02 -#define ACPI_PARSEOP_EMPTY_TERMLIST 0x04 -#define ACPI_PARSEOP_SPECIAL 0x10 +#define ACPI_PARSEOP_IGNORE 0x01 +#define ACPI_PARSEOP_PARAMLIST 0x02 +#define ACPI_PARSEOP_EMPTY_TERMLIST 0x04 +#define ACPI_PARSEOP_SPECIAL 0x10 /***************************************************************************** * @@ -695,8 +676,8 @@ struct acpi_parse_state { * ****************************************************************************/ -#define PCI_ROOT_HID_STRING "PNP0A03" -#define PCI_EXPRESS_ROOT_HID_STRING "PNP0A08" +#define PCI_ROOT_HID_STRING "PNP0A03" +#define PCI_EXPRESS_ROOT_HID_STRING "PNP0A08" struct acpi_bit_register_info { u8 parent_register; @@ -729,14 +710,13 @@ struct acpi_bit_register_info { #define ACPI_BITMASK_PCIEXP_WAKE_STATUS 0x4000 /* ACPI 3.0 */ #define ACPI_BITMASK_WAKE_STATUS 0x8000 -#define ACPI_BITMASK_ALL_FIXED_STATUS (\ - ACPI_BITMASK_TIMER_STATUS | \ - ACPI_BITMASK_BUS_MASTER_STATUS | \ - ACPI_BITMASK_GLOBAL_LOCK_STATUS | \ - ACPI_BITMASK_POWER_BUTTON_STATUS | \ - ACPI_BITMASK_SLEEP_BUTTON_STATUS | \ - ACPI_BITMASK_RT_CLOCK_STATUS | \ - ACPI_BITMASK_WAKE_STATUS) +#define ACPI_BITMASK_ALL_FIXED_STATUS (ACPI_BITMASK_TIMER_STATUS | \ + ACPI_BITMASK_BUS_MASTER_STATUS | \ + ACPI_BITMASK_GLOBAL_LOCK_STATUS | \ + ACPI_BITMASK_POWER_BUTTON_STATUS | \ + ACPI_BITMASK_SLEEP_BUTTON_STATUS | \ + ACPI_BITMASK_RT_CLOCK_STATUS | \ + ACPI_BITMASK_WAKE_STATUS) #define ACPI_BITMASK_TIMER_ENABLE 0x0001 #define ACPI_BITMASK_GLOBAL_LOCK_ENABLE 0x0020 @@ -840,7 +820,7 @@ struct acpi_bit_register_info { * ****************************************************************************/ -#define ACPI_ASCII_ZERO 0x30 +#define ACPI_ASCII_ZERO 0x30 /***************************************************************************** * @@ -862,9 +842,9 @@ struct acpi_integrity_info { u32 objects; }; -#define ACPI_DB_REDIRECTABLE_OUTPUT 0x01 -#define ACPI_DB_CONSOLE_OUTPUT 0x02 -#define ACPI_DB_DUPLICATE_OUTPUT 0x03 +#define ACPI_DB_REDIRECTABLE_OUTPUT 0x01 +#define ACPI_DB_CONSOLE_OUTPUT 0x02 +#define ACPI_DB_DUPLICATE_OUTPUT 0x03 /***************************************************************************** * @@ -874,18 +854,18 @@ struct acpi_integrity_info { /* Entry for a memory allocation (debug only) */ -#define ACPI_MEM_MALLOC 0 -#define ACPI_MEM_CALLOC 1 -#define ACPI_MAX_MODULE_NAME 16 +#define ACPI_MEM_MALLOC 0 +#define ACPI_MEM_CALLOC 1 +#define ACPI_MAX_MODULE_NAME 16 #define ACPI_COMMON_DEBUG_MEM_HEADER \ - struct acpi_debug_mem_block *previous; \ - struct acpi_debug_mem_block *next; \ - u32 size; \ - u32 component; \ - u32 line; \ - char module[ACPI_MAX_MODULE_NAME]; \ - u8 alloc_type; + struct acpi_debug_mem_block *previous; \ + struct acpi_debug_mem_block *next; \ + u32 size; \ + u32 component; \ + u32 line; \ + char module[ACPI_MAX_MODULE_NAME]; \ + u8 alloc_type; struct acpi_debug_mem_header { ACPI_COMMON_DEBUG_MEM_HEADER}; diff --git a/trunk/include/acpi/acmacros.h b/trunk/include/acpi/acmacros.h index 38f9aa4bef00..f2be2a881730 100644 --- a/trunk/include/acpi/acmacros.h +++ b/trunk/include/acpi/acmacros.h @@ -56,10 +56,6 @@ #define ACPI_CLEAR_BIT(target,bit) ((target) &= ~(bit)) #define ACPI_MIN(a,b) (((a)<(b))?(a):(b)) -/* Size calculation */ - -#define ACPI_ARRAY_LENGTH(x) (sizeof(x) / sizeof((x)[0])) - #if ACPI_MACHINE_WIDTH == 16 /* @@ -103,7 +99,7 @@ * printf() format helpers */ -/* Split 64-bit integer into two 32-bit values. Use with %8.8_x%8.8_x */ +/* Split 64-bit integer into two 32-bit values. Use with %8.8X%8.8X */ #define ACPI_FORMAT_UINT64(i) ACPI_HIDWORD(i),ACPI_LODWORD(i) @@ -134,6 +130,7 @@ #define ACPI_TO_POINTER(i) ACPI_ADD_PTR (void,(void *) NULL,(acpi_native_uint) i) #define ACPI_TO_INTEGER(p) ACPI_PTR_DIFF (p,(void *) NULL) #define ACPI_OFFSET(d,f) (acpi_size) ACPI_PTR_DIFF (&(((d *)0)->f),(void *) NULL) +#define ACPI_FADT_OFFSET(f) ACPI_OFFSET (FADT_DESCRIPTOR, f) #if ACPI_MACHINE_WIDTH == 16 #define ACPI_STORE_POINTER(d,s) ACPI_MOVE_32_TO_32(d,s) @@ -144,12 +141,6 @@ #define ACPI_PTR_TO_PHYSADDR(i) ACPI_TO_INTEGER(i) #endif -#ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED -#define ACPI_COMPARE_NAME(a,b) (*ACPI_CAST_PTR (u32,(a)) == *ACPI_CAST_PTR (u32,(b))) -#else -#define ACPI_COMPARE_NAME(a,b) (!ACPI_STRNCMP (ACPI_CAST_PTR (char,(a)), ACPI_CAST_PTR (char,(b)), ACPI_NAME_SIZE)) -#endif - /* * 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. @@ -350,33 +341,29 @@ /* * Rounding macros (Power of two boundaries only) */ -#define ACPI_ROUND_DOWN(value,boundary) (((acpi_native_uint)(value)) & \ +#define ACPI_ROUND_DOWN(value,boundary) (((acpi_native_uint)(value)) & \ (~(((acpi_native_uint) boundary)-1))) -#define ACPI_ROUND_UP(value,boundary) ((((acpi_native_uint)(value)) + \ +#define ACPI_ROUND_UP(value,boundary) ((((acpi_native_uint)(value)) + \ (((acpi_native_uint) boundary)-1)) & \ (~(((acpi_native_uint) boundary)-1))) -/* Note: sizeof(acpi_native_uint) evaluates to either 2, 4, or 8 */ - -#define ACPI_ROUND_DOWN_TO_32BIT(a) ACPI_ROUND_DOWN(a,4) -#define ACPI_ROUND_DOWN_TO_64BIT(a) ACPI_ROUND_DOWN(a,8) -#define ACPI_ROUND_DOWN_TO_NATIVE_WORD(a) ACPI_ROUND_DOWN(a,sizeof(acpi_native_uint)) +#define ACPI_ROUND_DOWN_TO_32_BITS(a) ACPI_ROUND_DOWN(a,4) +#define ACPI_ROUND_DOWN_TO_64_BITS(a) ACPI_ROUND_DOWN(a,8) +#define ACPI_ROUND_DOWN_TO_NATIVE_WORD(a) ACPI_ROUND_DOWN(a,ALIGNED_ADDRESS_BOUNDARY) -#define ACPI_ROUND_UP_TO_32BIT(a) ACPI_ROUND_UP(a,4) -#define ACPI_ROUND_UP_TO_64BIT(a) ACPI_ROUND_UP(a,8) -#define ACPI_ROUND_UP_TO_NATIVE_WORD(a) ACPI_ROUND_UP(a,sizeof(acpi_native_uint)) +#define ACPI_ROUND_UP_to_32_bITS(a) ACPI_ROUND_UP(a,4) +#define ACPI_ROUND_UP_to_64_bITS(a) ACPI_ROUND_UP(a,8) +#define ACPI_ROUND_UP_TO_NATIVE_WORD(a) ACPI_ROUND_UP(a,ALIGNED_ADDRESS_BOUNDARY) -#define ACPI_ROUND_BITS_UP_TO_BYTES(a) ACPI_DIV_8((a) + 7) -#define ACPI_ROUND_BITS_DOWN_TO_BYTES(a) ACPI_DIV_8((a)) +#define ACPI_ROUND_BITS_UP_TO_BYTES(a) ACPI_DIV_8((a) + 7) +#define ACPI_ROUND_BITS_DOWN_TO_BYTES(a) ACPI_DIV_8((a)) -#define ACPI_ROUND_UP_TO_1K(a) (((a) + 1023) >> 10) +#define ACPI_ROUND_UP_TO_1K(a) (((a) + 1023) >> 10) /* Generic (non-power-of-two) rounding */ -#define ACPI_ROUND_UP_TO(value,boundary) (((value) + ((boundary)-1)) / (boundary)) - -#define ACPI_IS_MISALIGNED(value) (((acpi_native_uint)value) & (sizeof(acpi_native_uint)-1)) +#define ACPI_ROUND_UP_TO(value,boundary) (((value) + ((boundary)-1)) / (boundary)) /* * Bitmask creation @@ -384,10 +371,10 @@ * MASK_BITS_ABOVE creates a mask starting AT the position and above * MASK_BITS_BELOW creates a mask starting one bit BELOW the position */ -#define ACPI_MASK_BITS_ABOVE(position) (~((ACPI_INTEGER_MAX) << ((u32) (position)))) -#define ACPI_MASK_BITS_BELOW(position) ((ACPI_INTEGER_MAX) << ((u32) (position))) +#define ACPI_MASK_BITS_ABOVE(position) (~((ACPI_INTEGER_MAX) << ((u32) (position)))) +#define ACPI_MASK_BITS_BELOW(position) ((ACPI_INTEGER_MAX) << ((u32) (position))) -#define ACPI_IS_OCTAL_DIGIT(d) (((char)(d) >= '0') && ((char)(d) <= '7')) +#define ACPI_IS_OCTAL_DIGIT(d) (((char)(d) >= '0') && ((char)(d) <= '7')) /* Bitfields within ACPI registers */ @@ -409,8 +396,8 @@ * * The "Descriptor" field is the first field in both structures. */ -#define ACPI_GET_DESCRIPTOR_TYPE(d) (((union acpi_descriptor *)(void *)(d))->common.descriptor_type) -#define ACPI_SET_DESCRIPTOR_TYPE(d,t) (((union acpi_descriptor *)(void *)(d))->common.descriptor_type = t) +#define ACPI_GET_DESCRIPTOR_TYPE(d) (((union acpi_descriptor *)(void *)(d))->descriptor_id) +#define ACPI_SET_DESCRIPTOR_TYPE(d,t) (((union acpi_descriptor *)(void *)(d))->descriptor_id = t) /* Macro to test the object type */ @@ -499,6 +486,7 @@ #define ACPI_ERROR(plist) #define ACPI_ERROR_NAMESPACE(s,e) #define ACPI_ERROR_METHOD(s,n,p,e) + #endif /* @@ -526,12 +514,12 @@ #define ACPI_GET_FUNCTION_NAME _acpi_function_name /* * The Name parameter should be the procedure name as a quoted string. - * This is declared as a local string ("MyFunctionName") so that it can + * This is declared as a local string ("my_function_name") so that it can * be also used by the function exit macros below. * Note: (const char) is used to be compatible with the debug interfaces * and macros such as __FUNCTION__. */ -#define ACPI_FUNCTION_NAME(name) const char *_acpi_function_name = #name; +#define ACPI_FUNCTION_NAME(name) const char *_acpi_function_name = name; #else /* Compiler supports __FUNCTION__ (or equivalent) -- Ignore this macro */ @@ -540,13 +528,13 @@ #endif #define ACPI_FUNCTION_TRACE(a) ACPI_FUNCTION_NAME(a) \ - acpi_ut_trace(ACPI_DEBUG_PARAMETERS) + acpi_ut_trace(ACPI_DEBUG_PARAMETERS) #define ACPI_FUNCTION_TRACE_PTR(a,b) ACPI_FUNCTION_NAME(a) \ - acpi_ut_trace_ptr(ACPI_DEBUG_PARAMETERS,(void *)b) + acpi_ut_trace_ptr(ACPI_DEBUG_PARAMETERS,(void *)b) #define ACPI_FUNCTION_TRACE_U32(a,b) ACPI_FUNCTION_NAME(a) \ - acpi_ut_trace_u32(ACPI_DEBUG_PARAMETERS,(u32)b) + acpi_ut_trace_u32(ACPI_DEBUG_PARAMETERS,(u32)b) #define ACPI_FUNCTION_TRACE_STR(a,b) ACPI_FUNCTION_NAME(a) \ - acpi_ut_trace_str(ACPI_DEBUG_PARAMETERS,(char *)b) + acpi_ut_trace_str(ACPI_DEBUG_PARAMETERS,(char *)b) #define ACPI_FUNCTION_ENTRY() acpi_ut_track_stack_ptr() @@ -555,7 +543,7 @@ * 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 "_AcpiFunctionName" is defined. + * so that "_acpi_function_name" is defined. * * Note: the DO_WHILE0 macro is used to prevent some compilers from complaining * about these constructs. @@ -666,7 +654,6 @@ #define ACPI_DUMP_STACK_ENTRY(a) #define ACPI_DUMP_OPERANDS(a,b,c,d,e) #define ACPI_DUMP_ENTRY(a,b) -#define ACPI_DUMP_TABLES(a,b) #define ACPI_DUMP_PATHNAME(a,b,c,d) #define ACPI_DUMP_RESOURCE_LIST(a) #define ACPI_DUMP_BUFFER(a,b) @@ -722,19 +709,19 @@ /* Memory allocation */ -#define ACPI_ALLOCATE(a) acpi_ut_allocate((acpi_size)(a),_COMPONENT,_acpi_module_name,__LINE__) -#define ACPI_ALLOCATE_ZEROED(a) acpi_ut_allocate_zeroed((acpi_size)(a), _COMPONENT,_acpi_module_name,__LINE__) -#define ACPI_FREE(a) acpi_os_free(a) +#define ACPI_MEM_ALLOCATE(a) acpi_ut_allocate((acpi_size)(a),_COMPONENT,_acpi_module_name,__LINE__) +#define ACPI_MEM_CALLOCATE(a) acpi_ut_callocate((acpi_size)(a), _COMPONENT,_acpi_module_name,__LINE__) +#define ACPI_MEM_FREE(a) acpi_os_free(a) #define ACPI_MEM_TRACKING(a) #else /* Memory allocation */ -#define ACPI_ALLOCATE(a) acpi_ut_allocate_and_track((acpi_size)(a),_COMPONENT,_acpi_module_name,__LINE__) -#define ACPI_ALLOCATE_ZEROED(a) acpi_ut_allocate_zeroed_and_track((acpi_size)(a), _COMPONENT,_acpi_module_name,__LINE__) -#define ACPI_FREE(a) acpi_ut_free_and_track(a,_COMPONENT,_acpi_module_name,__LINE__) -#define ACPI_MEM_TRACKING(a) a +#define ACPI_MEM_ALLOCATE(a) acpi_ut_allocate_and_track((acpi_size)(a),_COMPONENT,_acpi_module_name,__LINE__) +#define ACPI_MEM_CALLOCATE(a) acpi_ut_callocate_and_track((acpi_size)(a), _COMPONENT,_acpi_module_name,__LINE__) +#define ACPI_MEM_FREE(a) acpi_ut_free_and_track(a,_COMPONENT,_acpi_module_name,__LINE__) +#define ACPI_MEM_TRACKING(a) a #endif /* ACPI_DBG_TRACK_ALLOCATIONS */ diff --git a/trunk/include/acpi/acnamesp.h b/trunk/include/acpi/acnamesp.h index 83b52f9f899a..b667a804fc8a 100644 --- a/trunk/include/acpi/acnamesp.h +++ b/trunk/include/acpi/acnamesp.h @@ -63,8 +63,6 @@ #define ACPI_NS_DONT_OPEN_SCOPE 0x02 #define ACPI_NS_NO_PEER_SEARCH 0x04 #define ACPI_NS_ERROR_IF_FOUND 0x08 -#define ACPI_NS_PREFIX_IS_SCOPE 0x10 -#define ACPI_NS_EXTERNAL 0x20 #define ACPI_NS_WALK_UNLOCK TRUE #define ACPI_NS_WALK_NO_UNLOCK FALSE @@ -173,17 +171,19 @@ acpi_ns_dump_objects(acpi_object_type type, /* * nseval - Namespace evaluation functions */ -acpi_status acpi_ns_evaluate(struct acpi_evaluate_info *info); +acpi_status acpi_ns_evaluate_by_handle(struct acpi_parameter_info *info); + +acpi_status +acpi_ns_evaluate_by_name(char *pathname, struct acpi_parameter_info *info); + +acpi_status +acpi_ns_evaluate_relative(char *pathname, struct acpi_parameter_info *info); /* * nsnames - Name and Scope manipulation */ u32 acpi_ns_opens_scope(acpi_object_type type); -void -acpi_ns_build_external_path(struct acpi_namespace_node *node, - acpi_size size, char *name_buffer); - char *acpi_ns_get_external_pathname(struct acpi_namespace_node *node); char *acpi_ns_name_of_current_scope(struct acpi_walk_state *walk_state); @@ -196,9 +196,9 @@ u8 acpi_ns_pattern_match(struct acpi_namespace_node *obj_node, char *search_for); acpi_status -acpi_ns_get_node(struct acpi_namespace_node *prefix_node, - char *external_pathname, - u32 flags, struct acpi_namespace_node **out_node); +acpi_ns_get_node_by_path(char *external_pathname, + struct acpi_namespace_node *in_prefix_node, + u32 flags, struct acpi_namespace_node **out_node); acpi_size acpi_ns_get_pathname_length(struct acpi_namespace_node *node); @@ -241,10 +241,10 @@ acpi_ns_search_and_enter(u32 entry_name, u32 flags, struct acpi_namespace_node **ret_node); acpi_status -acpi_ns_search_one_scope(u32 entry_name, - struct acpi_namespace_node *node, - acpi_object_type type, - struct acpi_namespace_node **ret_node); +acpi_ns_search_node(u32 entry_name, + struct acpi_namespace_node *node, + acpi_object_type type, + struct acpi_namespace_node **ret_node); void acpi_ns_install_node(struct acpi_walk_state *walk_state, diff --git a/trunk/include/acpi/acobject.h b/trunk/include/acpi/acobject.h index 1747d94084d8..d130cfed8d55 100644 --- a/trunk/include/acpi/acobject.h +++ b/trunk/include/acpi/acobject.h @@ -1,7 +1,7 @@ /****************************************************************************** * - * Name: acobject.h - Definition of union acpi_operand_object (Internal object only) + * Name: acobject.h - Definition of union acpi_operand_object (Internal object only) * *****************************************************************************/ @@ -45,12 +45,10 @@ #ifndef _ACOBJECT_H #define _ACOBJECT_H -/* acpisrc:struct_defs -- for acpisrc conversion */ - /* - * The union acpi_operand_object is used to pass AML operands from the dispatcher + * The union 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 + * address space handlers and notify handlers. The object is a constant * size in order to allow it to be cached and reused. */ @@ -63,25 +61,17 @@ /* * Common area for all objects. * - * descriptor_type is used to differentiate between internal descriptors, and - * must be in the same place across all descriptors - * - * Note: The descriptor_type and Type fields must appear in the identical - * position in both the struct acpi_namespace_node and union acpi_operand_object - * structures. + * data_type is used to differentiate between internal descriptors, and MUST + * be the first byte in this structure. */ -#define ACPI_OBJECT_COMMON_HEADER \ - union acpi_operand_object *next_object; /* Objects linked to parent NS node */\ - u8 descriptor_type; /* To differentiate various internal objs */\ - u8 type; /* acpi_object_type */\ - u16 reference_count; /* For object deletion management */\ - u8 flags; - /* - * Note: There are 3 bytes available here before the - * next natural alignment boundary (for both 32/64 cases) - */ - -/* Values for Flag byte above */ +#define ACPI_OBJECT_COMMON_HEADER /* SIZE/ALIGNMENT: 32 bits, one ptr plus trailing 8-bit flag */\ + u8 descriptor; /* To differentiate various internal objs */\ + u8 type; /* acpi_object_type */\ + u16 reference_count; /* For object deletion management */\ + union acpi_operand_object *next_object; /* Objects linked to parent NS node */\ + u8 flags; + +/* Values for flag byte above */ #define AOPOBJ_AML_CONSTANT 0x01 #define AOPOBJ_STATIC_POINTER 0x02 @@ -89,7 +79,36 @@ #define AOPOBJ_OBJECT_INITIALIZED 0x08 #define AOPOBJ_SETUP_COMPLETE 0x10 #define AOPOBJ_SINGLE_DATUM 0x20 -#define AOPOBJ_INVALID 0x40 /* Used if host OS won't allow an op_region address */ + +/* + * Common bitfield for the field objects + * "Field Datum" -- a datum from the actual field object + * "Buffer Datum" -- a datum from a user buffer, read from or to be written to the field + */ +#define ACPI_COMMON_FIELD_INFO /* SIZE/ALIGNMENT: 24 bits + three 32-bit values */\ + u8 field_flags; /* Access, update, and lock bits */\ + u8 attribute; /* From access_as keyword */\ + u8 access_byte_width; /* Read/Write size in bytes */\ + u32 bit_length; /* Length of field in bits */\ + u32 base_byte_offset; /* Byte offset within containing object */\ + u8 start_field_bit_offset;/* Bit offset within first field datum (0-63) */\ + u8 access_bit_width; /* Read/Write size in bits (8-64) */\ + u32 value; /* Value to store into the Bank or Index register */\ + struct acpi_namespace_node *node; /* Link back to parent node */ + +/* + * Fields common to both Strings and Buffers + */ +#define ACPI_COMMON_BUFFER_INFO \ + u32 length; + +/* + * Common fields for objects that support ASL notifications + */ +#define ACPI_COMMON_NOTIFY_INFO \ + union acpi_operand_object *system_notify; /* Handler for system notifies */\ + union acpi_operand_object *device_notify; /* Handler for driver notifies */\ + union acpi_operand_object *handler; /* Handler for Address space */ /****************************************************************************** * @@ -106,31 +125,25 @@ struct acpi_object_integer { /* * Note: The String and Buffer object must be identical through the Pointer - * and length elements. There is code that depends on this. - * - * Fields common to both Strings and Buffers + * element. There is code that depends on this. */ -#define ACPI_COMMON_BUFFER_INFO(_type) \ - _type *pointer; \ - u32 length; - struct acpi_object_string { /* Null terminated, ASCII characters only */ - ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_BUFFER_INFO(char) /* String in AML stream or allocated string */ + ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_BUFFER_INFO char *pointer; /* String in AML stream or allocated string */ }; struct acpi_object_buffer { - ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_BUFFER_INFO(u8) /* Buffer in AML stream or allocated buffer */ - u32 aml_length; - u8 *aml_start; + ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_BUFFER_INFO u8 * pointer; /* Buffer in AML stream or allocated buffer */ struct acpi_namespace_node *node; /* Link back to parent node */ + u8 *aml_start; + u32 aml_length; }; struct acpi_object_package { - ACPI_OBJECT_COMMON_HEADER struct acpi_namespace_node *node; /* Link back to parent node */ - union acpi_operand_object **elements; /* Array of pointers to acpi_objects */ - u8 *aml_start; + ACPI_OBJECT_COMMON_HEADER u32 count; /* # of elements in package */ u32 aml_length; - u32 count; /* # of elements in package */ + u8 *aml_start; + struct acpi_namespace_node *node; /* Link back to parent node */ + union acpi_operand_object **elements; /* Array of pointers to acpi_objects */ }; /****************************************************************************** @@ -143,6 +156,23 @@ struct acpi_object_event { ACPI_OBJECT_COMMON_HEADER void *semaphore; }; +#define ACPI_INFINITE_CONCURRENCY 0xFF + +typedef +acpi_status(*ACPI_INTERNAL_METHOD) (struct acpi_walk_state * walk_state); + +struct acpi_object_method { + ACPI_OBJECT_COMMON_HEADER u8 method_flags; + u8 param_count; + u32 aml_length; + void *semaphore; + u8 *aml_start; + ACPI_INTERNAL_METHOD implementation; + u8 concurrency; + u8 thread_count; + acpi_owner_id owner_id; +}; + struct acpi_object_mutex { ACPI_OBJECT_COMMON_HEADER u8 sync_level; /* 0-15, specified in Mutex() call */ u16 acquisition_depth; /* Allow multiple Acquires, same thread */ @@ -156,23 +186,11 @@ struct acpi_object_mutex { struct acpi_object_region { ACPI_OBJECT_COMMON_HEADER u8 space_id; - struct acpi_namespace_node *node; /* Containing namespace node */ union acpi_operand_object *handler; /* Handler for region access */ + struct acpi_namespace_node *node; /* Containing namespace node */ union acpi_operand_object *next; - acpi_physical_address address; u32 length; -}; - -struct acpi_object_method { - ACPI_OBJECT_COMMON_HEADER u8 method_flags; - u8 param_count; - u8 concurrency; - void *semaphore; - u8 *aml_start; - ACPI_INTERNAL_METHOD implementation; - u32 aml_length; - u8 thread_count; - acpi_owner_id owner_id; + acpi_physical_address address; }; /****************************************************************************** @@ -181,14 +199,6 @@ struct acpi_object_method { * *****************************************************************************/ -/* - * Common fields for objects that support ASL notifications - */ -#define ACPI_COMMON_NOTIFY_INFO \ - union acpi_operand_object *system_notify; /* Handler for system notifies */\ - union acpi_operand_object *device_notify; /* Handler for driver notifies */\ - union acpi_operand_object *handler; /* Handler for Address space */ - struct acpi_object_notify_common { /* COMMON NOTIFY for POWER, PROCESSOR, DEVICE, and THERMAL */ ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_NOTIFY_INFO}; @@ -203,9 +213,9 @@ struct acpi_object_power_resource { }; struct acpi_object_processor { - ACPI_OBJECT_COMMON_HEADER u8 proc_id; - u8 length; - ACPI_COMMON_NOTIFY_INFO acpi_io_address address; + ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_NOTIFY_INFO u32 proc_id; + u32 length; + acpi_io_address address; }; struct acpi_object_thermal_zone { @@ -217,24 +227,9 @@ ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_NOTIFY_INFO}; * *****************************************************************************/ -/* - * Common bitfield for the field objects - * "Field Datum" -- a datum from the actual field object - * "Buffer Datum" -- a datum from a user buffer, read from or to be written to the field - */ -#define ACPI_COMMON_FIELD_INFO \ - u8 field_flags; /* Access, update, and lock bits */\ - u8 attribute; /* From access_as keyword */\ - u8 access_byte_width; /* Read/Write size in bytes */\ - struct acpi_namespace_node *node; /* Link back to parent node */\ - u32 bit_length; /* Length of field in bits */\ - u32 base_byte_offset; /* Byte offset within containing object */\ - u32 value; /* Value to store into the Bank or Index register */\ - u8 start_field_bit_offset;/* Bit offset within first field datum (0-63) */\ - u8 access_bit_width; /* Read/Write size in bits (8-64) */ - struct acpi_object_field_common { /* COMMON FIELD (for BUFFER, REGION, BANK, and INDEX fields) */ - ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_FIELD_INFO union acpi_operand_object *region_obj; /* Parent Operation Region object (REGION/BANK fields only) */ + ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_FIELD_INFO union acpi_operand_object *region_obj; /* Containing Operation Region object */ + /* (REGION/BANK fields only) */ }; struct acpi_object_region_field { @@ -249,7 +244,7 @@ struct acpi_object_bank_field { struct acpi_object_index_field { ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_FIELD_INFO /* - * No "RegionObj" pointer needed since the Index and Data registers + * No "region_obj" pointer needed since the Index and Data registers * are each field definitions unto themselves. */ union acpi_operand_object *index_obj; /* Index register */ @@ -274,9 +269,13 @@ struct acpi_object_notify_handler { void *context; }; +/* Flags for address handler */ + +#define ACPI_ADDR_HANDLER_DEFAULT_INSTALLED 0x1 + struct acpi_object_addr_handler { ACPI_OBJECT_COMMON_HEADER u8 space_id; - u8 handler_flags; + u16 hflags; acpi_adr_space_handler handler; struct acpi_namespace_node *node; /* Parent device */ void *context; @@ -285,10 +284,6 @@ struct acpi_object_addr_handler { union acpi_operand_object *next; }; -/* Flags for address handler (handler_flags) */ - -#define ACPI_ADDR_HANDLER_DEFAULT_INSTALLED 0x01 - /****************************************************************************** * * Special internal objects @@ -302,10 +297,10 @@ struct acpi_object_addr_handler { struct acpi_object_reference { ACPI_OBJECT_COMMON_HEADER u8 target_type; /* Used for index_op */ u16 opcode; - void *object; /* name_op=>HANDLE to obj, index_op=>union acpi_operand_object */ + u32 offset; /* Used for arg_op, local_op, and index_op */ + void *object; /* name_op=>HANDLE to obj, index_op=>union acpi_operand_object */ struct acpi_namespace_node *node; union acpi_operand_object **where; - u32 offset; /* Used for arg_op, local_op, and index_op */ }; /* @@ -316,10 +311,12 @@ struct acpi_object_reference { * Currently: Region and field_unit types */ struct acpi_object_extra { - ACPI_OBJECT_COMMON_HEADER struct acpi_namespace_node *method_REG; /* _REG method for this region (if any) */ - void *region_context; /* Region-specific data */ - u8 *aml_start; + ACPI_OBJECT_COMMON_HEADER u8 byte_fill1; + u16 word_fill1; u32 aml_length; + u8 *aml_start; + struct acpi_namespace_node *method_REG; /* _REG method for this region (if any) */ + void *region_context; /* Region-specific data */ }; /* Additional data that can be attached to namespace nodes */ @@ -394,13 +391,8 @@ union acpi_operand_object { #define ACPI_DESC_TYPE_NAMED 0x0F #define ACPI_DESC_TYPE_MAX 0x0F -struct acpi_common_descriptor { - void *common_pointer; - u8 descriptor_type; /* To differentiate various internal objs */ -}; - union acpi_descriptor { - struct acpi_common_descriptor common; + u8 descriptor_id; /* To differentiate various internal objs */ union acpi_operand_object object; struct acpi_namespace_node node; union acpi_parse_object op; diff --git a/trunk/include/acpi/acopcode.h b/trunk/include/acpi/acopcode.h index 7659a46bc432..e6d78bd9e90a 100644 --- a/trunk/include/acpi/acopcode.h +++ b/trunk/include/acpi/acopcode.h @@ -94,7 +94,7 @@ #define ARGP_CONCAT_RES_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) #define ARGP_COND_REF_OF_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_SUPERNAME) #define ARGP_CONTINUE_OP ARG_NONE -#define ARGP_COPY_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_SIMPLENAME) +#define ARGP_COPY_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_SIMPLENAME) #define ARGP_CREATE_BIT_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME) #define ARGP_CREATE_BYTE_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME) #define ARGP_CREATE_DWORD_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME) diff --git a/trunk/include/acpi/acoutput.h b/trunk/include/acpi/acoutput.h index 8d5039d0b430..7785d481dc3e 100644 --- a/trunk/include/acpi/acoutput.h +++ b/trunk/include/acpi/acoutput.h @@ -50,7 +50,7 @@ * component basis and a per-exception-type basis. */ -/* Component IDs are used in the global "DebugLayer" */ +/* Component IDs are used in the global "debug_layer" */ #define ACPI_UTILITIES 0x00000001 #define ACPI_HARDWARE 0x00000002 @@ -121,7 +121,7 @@ #define ACPI_LV_INTERRUPTS 0x08000000 #define ACPI_LV_VERBOSITY3 0x0F000000 | ACPI_LV_VERBOSITY2 -/* Exceptionally verbose output -- also used in the global "DebugLevel" */ +/* Exceptionally verbose output -- also used in the global "debug_level" */ #define ACPI_LV_AML_DISASSEMBLE 0x10000000 #define ACPI_LV_VERBOSE_INFO 0x20000000 @@ -135,7 +135,7 @@ */ #define ACPI_DEBUG_LEVEL(dl) (u32) dl,ACPI_DEBUG_PARAMETERS -/* Exception level -- used in the global "DebugLevel" */ +/* Exception level -- used in the global "debug_level" */ #define ACPI_DB_INIT ACPI_DEBUG_LEVEL (ACPI_LV_INIT) #define ACPI_DB_DEBUG_OBJECT ACPI_DEBUG_LEVEL (ACPI_LV_DEBUG_OBJECT) @@ -144,13 +144,13 @@ /* * These two levels are essentially obsolete, all instances in the - * ACPICA core code have been replaced by ACPI_ERROR and ACPI_WARNING + * ACPICA core code have been replaced by REPORT_ERROR and REPORT_WARNING * (Kept here because some drivers may still use them) */ #define ACPI_DB_ERROR ACPI_DEBUG_LEVEL (ACPI_LV_ERROR) #define ACPI_DB_WARN ACPI_DEBUG_LEVEL (ACPI_LV_WARN) -/* Trace level -- also used in the global "DebugLevel" */ +/* Trace level -- also used in the global "debug_level" */ #define ACPI_DB_INIT_NAMES ACPI_DEBUG_LEVEL (ACPI_LV_INIT_NAMES) #define ACPI_DB_THREADS ACPI_DEBUG_LEVEL (ACPI_LV_THREADS) diff --git a/trunk/include/acpi/acparser.h b/trunk/include/acpi/acparser.h index 9d49d3c41cd9..5a1ff484af33 100644 --- a/trunk/include/acpi/acparser.h +++ b/trunk/include/acpi/acparser.h @@ -46,7 +46,7 @@ #define OP_HAS_RETURN_VALUE 1 -/* Variable number of arguments. This field must be 32 bits */ +/* variable # arguments */ #define ACPI_VAR_ARGS ACPI_UINT32_MAX @@ -71,7 +71,7 @@ /* * psxface - Parser external interfaces */ -acpi_status acpi_ps_execute_method(struct acpi_evaluate_info *info); +acpi_status acpi_ps_execute_method(struct acpi_parameter_info *info); /* * psargs - Parse AML opcode arguments diff --git a/trunk/include/acpi/acpi_bus.h b/trunk/include/acpi/acpi_bus.h index 8c7590fdd822..6dca3d542080 100644 --- a/trunk/include/acpi/acpi_bus.h +++ b/trunk/include/acpi/acpi_bus.h @@ -59,7 +59,7 @@ acpi_evaluate_reference(acpi_handle handle, #define ACPI_BUS_FILE_ROOT "acpi" extern struct proc_dir_entry *acpi_root_dir; -extern struct fadt_descriptor acpi_fadt; +extern FADT_DESCRIPTOR acpi_fadt; enum acpi_bus_removal_type { ACPI_BUS_REMOVAL_NORMAL = 0, @@ -327,7 +327,7 @@ int acpi_bus_set_power(acpi_handle handle, int state); int acpi_bus_generate_event(struct acpi_device *device, u8 type, int data); int acpi_bus_receive_event(struct acpi_bus_event *event); int acpi_bus_register_driver(struct acpi_driver *driver); -void acpi_bus_unregister_driver(struct acpi_driver *driver); +int acpi_bus_unregister_driver(struct acpi_driver *driver); int acpi_bus_add(struct acpi_device **child, struct acpi_device *parent, acpi_handle handle, int type); int acpi_bus_trim(struct acpi_device *start, int rmdevice); diff --git a/trunk/include/acpi/acpiosxf.h b/trunk/include/acpi/acpiosxf.h index 8f473c83b7c4..970e9a6372c3 100644 --- a/trunk/include/acpi/acpiosxf.h +++ b/trunk/include/acpi/acpiosxf.h @@ -50,16 +50,12 @@ #include "platform/acenv.h" #include "actypes.h" -/* Types for acpi_os_execute */ +/* Priorities for acpi_os_queue_for_execution */ -typedef enum { - OSL_GLOBAL_LOCK_HANDLER, - OSL_NOTIFY_HANDLER, - OSL_GPE_HANDLER, - OSL_DEBUGGER_THREAD, - OSL_EC_POLL_HANDLER, - OSL_EC_BURST_HANDLER -} acpi_execute_type; +#define OSD_PRIORITY_GPE 1 +#define OSD_PRIORITY_HIGH 2 +#define OSD_PRIORITY_MED 3 +#define OSD_PRIORITY_LO 4 #define ACPI_NO_UNIT_LIMIT ((u32) -1) #define ACPI_MUTEX_SEM 1 @@ -165,11 +161,13 @@ acpi_os_remove_interrupt_handler(u32 gsi, acpi_osd_handler service_routine); /* * Threads and Scheduling */ -acpi_thread_id acpi_os_get_thread_id(void); +u32 acpi_os_get_thread_id(void); acpi_status -acpi_os_execute(acpi_execute_type type, - acpi_osd_exec_callback function, void *context); +acpi_os_queue_for_execution(u32 priority, + acpi_osd_exec_callback function, void *context); + +void acpi_os_wait_events_complete(void *context); void acpi_os_wait_events_complete(void *context); @@ -216,12 +214,6 @@ acpi_os_derive_pci_id(acpi_handle rhandle, /* * Miscellaneous */ -acpi_status acpi_os_validate_interface(char *interface); - -acpi_status -acpi_os_validate_address(u8 space_id, - acpi_physical_address address, acpi_size length); - u8 acpi_os_readable(void *pointer, acpi_size length); #ifdef ACPI_FUTURE_USAGE @@ -263,4 +255,11 @@ char *acpi_os_get_next_filename(void *dir_handle); void acpi_os_close_directory(void *dir_handle); +/* + * Debug + */ +void +acpi_os_dbg_assert(void *failed_assertion, + void *file_name, u32 line_number, char *message); + #endif /* __ACPIOSXF_H__ */ diff --git a/trunk/include/acpi/acpixf.h b/trunk/include/acpi/acpixf.h index 049e9aa1b867..66cf2ecef57a 100644 --- a/trunk/include/acpi/acpixf.h +++ b/trunk/include/acpi/acpixf.h @@ -268,7 +268,7 @@ acpi_status acpi_remove_gpe_block(acpi_handle gpe_device); * Resource interfaces */ typedef -acpi_status(*acpi_walk_resource_callback) (struct acpi_resource * resource, +acpi_status(*ACPI_WALK_RESOURCE_CALLBACK) (struct acpi_resource * resource, void *context); acpi_status @@ -290,7 +290,7 @@ acpi_get_possible_resources(acpi_handle device_handle, acpi_status acpi_walk_resources(acpi_handle device_handle, char *name, - acpi_walk_resource_callback user_function, void *context); + ACPI_WALK_RESOURCE_CALLBACK user_function, void *context); acpi_status acpi_set_current_resources(acpi_handle device_handle, diff --git a/trunk/include/acpi/acresrc.h b/trunk/include/acpi/acresrc.h index ad11fc13fbef..fa02e8083381 100644 --- a/trunk/include/acpi/acresrc.h +++ b/trunk/include/acpi/acresrc.h @@ -164,26 +164,23 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, /* * rsutils */ - acpi_status -acpi_rs_get_prt_method_data(struct acpi_namespace_node *node, - struct acpi_buffer *ret_buffer); +acpi_rs_get_prt_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer); acpi_status -acpi_rs_get_crs_method_data(struct acpi_namespace_node *node, - struct acpi_buffer *ret_buffer); +acpi_rs_get_crs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer); +#ifdef ACPI_FUTURE_USAGE acpi_status -acpi_rs_get_prs_method_data(struct acpi_namespace_node *node, - struct acpi_buffer *ret_buffer); +acpi_rs_get_prs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer); +#endif /* ACPI_FUTURE_USAGE */ acpi_status acpi_rs_get_method_data(acpi_handle handle, char *path, struct acpi_buffer *ret_buffer); acpi_status -acpi_rs_set_srs_method_data(struct acpi_namespace_node *node, - struct acpi_buffer *ret_buffer); +acpi_rs_set_srs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer); /* * rscalc @@ -201,9 +198,8 @@ acpi_rs_get_pci_routing_table_length(union acpi_operand_object *package_object, acpi_size * buffer_size_needed); acpi_status -acpi_rs_convert_aml_to_resources(u8 * aml, - u32 length, - u32 offset, u8 resource_index, void **context); +acpi_rs_convert_aml_to_resources(u8 * aml_buffer, + u32 aml_buffer_length, u8 * output_buffer); acpi_status acpi_rs_convert_resources_to_aml(struct acpi_resource *resource, diff --git a/trunk/include/acpi/acstruct.h b/trunk/include/acpi/acstruct.h index 5e8095f0f78f..d8c1c2cdac0c 100644 --- a/trunk/include/acpi/acstruct.h +++ b/trunk/include/acpi/acstruct.h @@ -44,8 +44,6 @@ #ifndef __ACSTRUCT_H__ #define __ACSTRUCT_H__ -/* acpisrc:struct_defs -- for acpisrc conversion */ - /***************************************************************************** * * Tree walking typedefs and structs @@ -53,76 +51,67 @@ ****************************************************************************/ /* - * 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. + * 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 ACPI_NEXT_OP_DOWNWARD 1 #define ACPI_NEXT_OP_UPWARD 2 -/* - * Groups of definitions for walk_type used for different implementations of - * walkers (never simultaneously) - flags for interpreter: - */ #define ACPI_WALK_NON_METHOD 0 -#define ACPI_WALK_METHOD 0x01 -#define ACPI_WALK_METHOD_RESTART 0x02 - -/* Flags for i_aSL compiler only */ - -#define ACPI_WALK_CONST_REQUIRED 0x10 -#define ACPI_WALK_CONST_OPTIONAL 0x20 +#define ACPI_WALK_METHOD 1 +#define ACPI_WALK_METHOD_RESTART 2 +#define ACPI_WALK_CONST_REQUIRED 3 +#define ACPI_WALK_CONST_OPTIONAL 4 struct acpi_walk_state { - struct acpi_walk_state *next; /* Next walk_state in list */ - u8 descriptor_type; /* To differentiate various internal objs */ + u8 data_type; /* To differentiate various internal objs MUST BE FIRST! */ u8 walk_type; - u16 opcode; /* Current AML opcode */ - u8 next_op_info; /* Info about next_op */ - u8 num_operands; /* Stack pointer for Operands[] array */ acpi_owner_id owner_id; /* Owner of objects created during the walk */ u8 last_predicate; /* Result of last predicate */ - u8 current_result; + u8 current_result; /* */ + u8 next_op_info; /* Info about next_op */ + u8 num_operands; /* Stack pointer for Operands[] array */ u8 return_used; + u16 opcode; /* Current AML opcode */ u8 scope_depth; u8 pass_number; /* Parse pass during table load */ + u32 arg_count; /* push for fixed or var args */ u32 aml_offset; u32 arg_types; u32 method_breakpoint; /* For single stepping */ u32 user_breakpoint; /* User AML breakpoint */ u32 parse_flags; - - struct acpi_parse_state parser_state; /* Current state of parser */ u32 prev_arg_types; - u32 arg_count; /* push for fixed or var args */ - - struct acpi_namespace_node arguments[ACPI_METHOD_NUM_ARGS]; /* Control method arguments */ - struct acpi_namespace_node local_variables[ACPI_METHOD_NUM_LOCALS]; /* Control method locals */ - union acpi_operand_object *operands[ACPI_OBJ_NUM_OPERANDS + 1]; /* Operands passed to the interpreter (+1 for NULL terminator) */ - union acpi_operand_object **params; u8 *aml_last_while; + struct acpi_namespace_node arguments[ACPI_METHOD_NUM_ARGS]; /* Control method arguments */ union acpi_operand_object **caller_return_desc; union acpi_generic_state *control_state; /* List of control states (nested IFs) */ struct acpi_namespace_node *deferred_node; /* Used when executing deferred opcodes */ struct acpi_gpe_event_info *gpe_event_info; /* Info for GPE (_Lxx/_Exx methods only */ union acpi_operand_object *implicit_return_obj; + struct acpi_namespace_node local_variables[ACPI_METHOD_NUM_LOCALS]; /* Control method locals */ struct acpi_namespace_node *method_call_node; /* Called method Node */ union acpi_parse_object *method_call_op; /* method_call Op if running a method */ union acpi_operand_object *method_desc; /* Method descriptor if running a method */ struct acpi_namespace_node *method_node; /* Method node if running a method. */ union acpi_parse_object *op; /* Current parser op */ + union acpi_operand_object *operands[ACPI_OBJ_NUM_OPERANDS + 1]; /* Operands passed to the interpreter (+1 for NULL terminator) */ const struct acpi_opcode_info *op_info; /* Info on current opcode */ union acpi_parse_object *origin; /* Start of walk [Obsolete] */ + union acpi_operand_object **params; + struct acpi_parse_state parser_state; /* Current state of parser */ union acpi_operand_object *result_obj; union acpi_generic_state *results; /* Stack of accumulated results */ union acpi_operand_object *return_desc; /* Return object, if any */ union acpi_generic_state *scope_info; /* Stack of nested scopes */ + union acpi_parse_object *prev_op; /* Last op that was processed */ union acpi_parse_object *next_op; /* next op to be processed */ - struct acpi_thread_state *thread; acpi_parse_downwards descending_callback; acpi_parse_upwards ascending_callback; + struct acpi_thread_state *thread; + struct acpi_walk_state *next; /* Next walk_state in list */ }; /* Info used by acpi_ps_init_objects */ @@ -142,6 +131,32 @@ struct acpi_init_walk_info { struct acpi_table_desc *table_desc; }; +/* Info used by acpi_ns_initialize_devices */ + +struct acpi_device_walk_info { + u16 device_count; + u16 num_STA; + u16 num_INI; + struct acpi_table_desc *table_desc; +}; + +/* TBD: [Restructure] Merge with struct above */ + +struct acpi_walk_info { + u32 debug_level; + u32 count; + acpi_owner_id owner_id; + u8 display_type; +}; + +/* Display Types */ + +#define ACPI_DISPLAY_SUMMARY (u8) 0 +#define ACPI_DISPLAY_OBJECTS (u8) 1 +#define ACPI_DISPLAY_MASK (u8) 1 + +#define ACPI_DISPLAY_SHORT (u8) 2 + struct acpi_get_devices_info { acpi_walk_callback user_function; void *context; @@ -174,21 +189,16 @@ union acpi_aml_operands { } mid; }; -/* - * Structure used to pass object evaluation parameters. - * Purpose is to reduce CPU stack use. - */ -struct acpi_evaluate_info { - struct acpi_namespace_node *prefix_node; - char *pathname; +/* Internal method parameter list */ + +struct acpi_parameter_info { + struct acpi_namespace_node *node; union acpi_operand_object *obj_desc; union acpi_operand_object **parameters; - struct acpi_namespace_node *resolved_node; union acpi_operand_object *return_object; u8 pass_number; u8 parameter_type; u8 return_object_type; - u8 flags; }; /* Types for parameter_type above */ @@ -196,35 +206,4 @@ struct acpi_evaluate_info { #define ACPI_PARAM_ARGS 0 #define ACPI_PARAM_GPE 1 -/* Values for Flags above */ - -#define ACPI_IGNORE_RETURN_VALUE 1 - -/* Info used by acpi_ns_initialize_devices */ - -struct acpi_device_walk_info { - u16 device_count; - u16 num_STA; - u16 num_INI; - struct acpi_table_desc *table_desc; - struct acpi_evaluate_info *evaluate_info; -}; - -/* TBD: [Restructure] Merge with struct above */ - -struct acpi_walk_info { - u32 debug_level; - u32 count; - acpi_owner_id owner_id; - u8 display_type; -}; - -/* Display Types */ - -#define ACPI_DISPLAY_SUMMARY (u8) 0 -#define ACPI_DISPLAY_OBJECTS (u8) 1 -#define ACPI_DISPLAY_MASK (u8) 1 - -#define ACPI_DISPLAY_SHORT (u8) 2 - #endif diff --git a/trunk/include/acpi/actables.h b/trunk/include/acpi/actables.h index 4dbaf02fe526..30a47542e1c8 100644 --- a/trunk/include/acpi/actables.h +++ b/trunk/include/acpi/actables.h @@ -136,11 +136,7 @@ acpi_status acpi_tb_is_table_installed(struct acpi_table_desc *new_table_desc); acpi_status acpi_tb_verify_table_checksum(struct acpi_table_header *table_header); -u8 acpi_tb_sum_table(void *buffer, u32 length); - -u8 acpi_tb_generate_checksum(struct acpi_table_header *table); - -void acpi_tb_set_checksum(struct acpi_table_header *table); +u8 acpi_tb_generate_checksum(void *buffer, u32 length); acpi_status acpi_tb_validate_table_header(struct acpi_table_header *table_header); diff --git a/trunk/include/acpi/actbl.h b/trunk/include/acpi/actbl.h index b125ceed9cb7..ed53f842dad4 100644 --- a/trunk/include/acpi/actbl.h +++ b/trunk/include/acpi/actbl.h @@ -1,6 +1,6 @@ /****************************************************************************** * - * Name: actbl.h - Basic ACPI Table Definitions + * Name: actbl.h - Table data structures defined in ACPI specification * *****************************************************************************/ @@ -45,45 +45,66 @@ #define __ACTBL_H__ /* - * Values for description table header signatures. Useful because they make - * it more difficult to inadvertently type in the wrong signature. + * Note about bitfields: The u8 type is used for bitfields in ACPI tables. + * This is the only type that is even remotely portable. Anything else is not + * portable, so do not use any other bitfield types. + */ + +/* + * Values for description table header signatures */ +#define RSDP_NAME "RSDP" +#define RSDP_SIG "RSD PTR " /* RSDT Pointer signature */ +#define APIC_SIG "APIC" /* Multiple APIC Description Table */ #define DSDT_SIG "DSDT" /* Differentiated System Description Table */ #define FADT_SIG "FACP" /* Fixed ACPI Description Table */ #define FACS_SIG "FACS" /* Firmware ACPI Control Structure */ #define PSDT_SIG "PSDT" /* Persistent System Description Table */ -#define RSDP_SIG "RSD PTR " /* Root System Description Pointer */ #define RSDT_SIG "RSDT" /* Root System Description Table */ #define XSDT_SIG "XSDT" /* Extended System Description Table */ #define SSDT_SIG "SSDT" /* Secondary System Description Table */ -#define RSDP_NAME "RSDP" +#define SBST_SIG "SBST" /* Smart Battery Specification Table */ +#define SPIC_SIG "SPIC" /* IOSAPIC table */ +#define BOOT_SIG "BOOT" /* Boot table */ + +#define GL_OWNED 0x02 /* Ownership of global lock is bit 1 */ /* - * All tables and structures must be byte-packed to match the ACPI - * specification, since the tables are provided by the system BIOS + * Common table types. The base code can remain + * constant if the underlying tables are changed */ +#define RSDT_DESCRIPTOR struct rsdt_descriptor_rev2 +#define XSDT_DESCRIPTOR struct xsdt_descriptor_rev2 +#define FACS_DESCRIPTOR struct facs_descriptor_rev2 +#define FADT_DESCRIPTOR struct fadt_descriptor_rev2 + #pragma pack(1) /* - * These are the ACPI tables that are directly consumed by the subsystem. - * - * The RSDP and FACS do not use the common ACPI table header. All other ACPI - * tables use the header. + * ACPI Version-independent tables * - * Note about bitfields: The u8 type is used for bitfields in ACPI tables. - * This is the only type that is even remotely portable. Anything else is not - * portable, so do not use any other bitfield types. + * NOTE: The tables that are specific to ACPI versions (1.0, 2.0, etc.) + * are in separate files. */ +struct rsdp_descriptor { /* Root System Descriptor Pointer */ + char signature[8]; /* ACPI signature, contains "RSD PTR " */ + u8 checksum; /* ACPI 1.0 checksum */ + char oem_id[6]; /* OEM identification */ + u8 revision; /* Must be (0) for ACPI 1.0 or (2) for ACPI 2.0+ */ + u32 rsdt_physical_address; /* 32-bit physical address of the RSDT */ + u32 length; /* XSDT Length in bytes, including header */ + u64 xsdt_physical_address; /* 64-bit physical address of the XSDT */ + u8 extended_checksum; /* Checksum of entire table (ACPI 2.0) */ + char reserved[3]; /* Reserved, must be zero */ +}; -/******************************************************************************* - * - * ACPI Table Header. This common header is used by all tables except the - * RSDP and FACS. The define is used for direct inclusion of header into - * other ACPI tables - * - ******************************************************************************/ +struct acpi_common_facs { /* Common FACS for internal use */ + u32 *global_lock; + u64 *firmware_waking_vector; + u8 vector_width; +}; -#define ACPI_TABLE_HEADER_DEF \ +#define ACPI_TABLE_HEADER_DEF /* ACPI common table header */ \ char signature[4]; /* ASCII table signature */\ u32 length; /* Length of table in bytes, including this header */\ u8 revision; /* ACPI Specification minor version # */\ @@ -91,237 +112,152 @@ char oem_id[6]; /* ASCII OEM identification */\ char oem_table_id[8]; /* ASCII OEM table identification */\ u32 oem_revision; /* OEM revision number */\ - char asl_compiler_id[4]; /* ASCII ASL compiler vendor ID */\ + char asl_compiler_id [4]; /* ASCII ASL compiler vendor ID */\ u32 asl_compiler_revision; /* ASL compiler version */ -struct acpi_table_header { +struct acpi_table_header { /* ACPI common table header */ ACPI_TABLE_HEADER_DEF}; /* - * GAS - Generic Address Structure (ACPI 2.0+) + * MADT values and structures */ -struct acpi_generic_address { - u8 address_space_id; /* Address space where struct or register exists */ - u8 register_bit_width; /* Size in bits of given register */ - u8 register_bit_offset; /* Bit offset within the register */ - u8 access_width; /* Minimum Access size (ACPI 3.0) */ - u64 address; /* 64-bit address of struct or register */ -}; -/******************************************************************************* - * - * RSDP - Root System Description Pointer (Signature is "RSD PTR ") - * - ******************************************************************************/ - -struct rsdp_descriptor { - char signature[8]; /* ACPI signature, contains "RSD PTR " */ - u8 checksum; /* ACPI 1.0 checksum */ - char oem_id[6]; /* OEM identification */ - u8 revision; /* Must be (0) for ACPI 1.0 or (2) for ACPI 2.0+ */ - u32 rsdt_physical_address; /* 32-bit physical address of the RSDT */ - u32 length; /* Table length in bytes, including header (ACPI 2.0+) */ - u64 xsdt_physical_address; /* 64-bit physical address of the XSDT (ACPI 2.0+) */ - u8 extended_checksum; /* Checksum of entire table (ACPI 2.0+) */ - u8 reserved[3]; /* Reserved, must be zero */ -}; +/* Values for MADT PCATCompat */ -#define ACPI_RSDP_REV0_SIZE 20 /* Size of original ACPI 1.0 RSDP */ +#define DUAL_PIC 0 +#define MULTIPLE_APIC 1 -/******************************************************************************* - * - * RSDT/XSDT - Root System Description Tables - * - ******************************************************************************/ +/* Master MADT */ -struct rsdt_descriptor { - ACPI_TABLE_HEADER_DEF u32 table_offset_entry[1]; /* Array of pointers to ACPI tables */ -}; - -struct xsdt_descriptor { - ACPI_TABLE_HEADER_DEF u64 table_offset_entry[1]; /* Array of pointers to ACPI tables */ -}; - -/******************************************************************************* - * - * FACS - Firmware ACPI Control Structure (FACS) - * - ******************************************************************************/ - -struct facs_descriptor { - char signature[4]; /* ASCII table signature */ - u32 length; /* Length of structure, in bytes */ - u32 hardware_signature; /* Hardware configuration signature */ - u32 firmware_waking_vector; /* 32-bit physical address of the Firmware Waking Vector */ - u32 global_lock; /* Global Lock for shared hardware resources */ +struct multiple_apic_table { + ACPI_TABLE_HEADER_DEF /* ACPI common table header */ + u32 local_apic_address; /* Physical address of local APIC */ /* Flags (32 bits) */ - u8 S4bios_f:1; /* 00: S4BIOS support is present */ + u8 PCATcompat:1; /* 00: System also has dual 8259s */ u8:7; /* 01-07: Reserved, must be zero */ u8 reserved1[3]; /* 08-31: Reserved, must be zero */ - - u64 xfirmware_waking_vector; /* 64-bit version of the Firmware Waking Vector (ACPI 2.0+) */ - u8 version; /* Version of this table (ACPI 2.0+) */ - u8 reserved[31]; /* Reserved, must be zero */ }; -#define ACPI_GLOCK_PENDING 0x01 /* 00: Pending global lock ownership */ -#define ACPI_GLOCK_OWNED 0x02 /* 01: Global lock is owned */ +/* Values for Type in APIC_HEADER_DEF */ + +#define APIC_PROCESSOR 0 +#define APIC_IO 1 +#define APIC_XRUPT_OVERRIDE 2 +#define APIC_NMI 3 +#define APIC_LOCAL_NMI 4 +#define APIC_ADDRESS_OVERRIDE 5 +#define APIC_IO_SAPIC 6 +#define APIC_LOCAL_SAPIC 7 +#define APIC_XRUPT_SOURCE 8 +#define APIC_RESERVED 9 /* 9 and greater are reserved */ /* - * Common FACS - This is a version-independent FACS structure used for internal use only + * MADT sub-structures (Follow MULTIPLE_APIC_DESCRIPTION_TABLE) */ -struct acpi_common_facs { - u32 *global_lock; - u64 *firmware_waking_vector; - u8 vector_width; +#define APIC_HEADER_DEF /* Common APIC sub-structure header */\ + u8 type; \ + u8 length; + +struct apic_header { +APIC_HEADER_DEF}; + +/* Values for MPS INTI flags */ + +#define POLARITY_CONFORMS 0 +#define POLARITY_ACTIVE_HIGH 1 +#define POLARITY_RESERVED 2 +#define POLARITY_ACTIVE_LOW 3 + +#define TRIGGER_CONFORMS 0 +#define TRIGGER_EDGE 1 +#define TRIGGER_RESERVED 2 +#define TRIGGER_LEVEL 3 + +/* Common flag definitions (16 bits each) */ + +#define MPS_INTI_FLAGS \ + u8 polarity : 2; /* 00-01: Polarity of APIC I/O input signals */\ + u8 trigger_mode : 2; /* 02-03: Trigger mode of APIC input signals */\ + u8 : 4; /* 04-07: Reserved, must be zero */\ + u8 reserved1; /* 08-15: Reserved, must be zero */ + +#define LOCAL_APIC_FLAGS \ + u8 processor_enabled: 1; /* 00: Processor is usable if set */\ + u8 : 7; /* 01-07: Reserved, must be zero */\ + u8 reserved2; /* 08-15: Reserved, must be zero */ + +/* Sub-structures for MADT */ + +struct madt_processor_apic { + APIC_HEADER_DEF u8 processor_id; /* ACPI processor id */ + u8 local_apic_id; /* Processor's local APIC id */ + LOCAL_APIC_FLAGS}; + +struct madt_io_apic { + APIC_HEADER_DEF u8 io_apic_id; /* I/O APIC ID */ + u8 reserved; /* Reserved - must be zero */ + u32 address; /* APIC physical address */ + u32 interrupt; /* Global system interrupt where INTI + * lines start */ }; -/******************************************************************************* - * - * FADT - Fixed ACPI Description Table (Signature "FACP") - * - ******************************************************************************/ - -/* Fields common to all versions of the FADT */ - -#define ACPI_FADT_COMMON \ - ACPI_TABLE_HEADER_DEF \ - u32 V1_firmware_ctrl; /* 32-bit physical address of FACS */ \ - u32 V1_dsdt; /* 32-bit physical address of DSDT */ \ - u8 reserved1; /* System Interrupt Model isn't used in ACPI 2.0*/ \ - u8 prefer_PM_profile; /* Conveys preferred power management profile to OSPM. */ \ - u16 sci_int; /* System vector of SCI interrupt */ \ - u32 smi_cmd; /* Port address of SMI command port */ \ - u8 acpi_enable; /* Value to write to smi_cmd to enable ACPI */ \ - u8 acpi_disable; /* Value to write to smi_cmd to disable ACPI */ \ - u8 S4bios_req; /* Value to write to SMI CMD to enter S4BIOS state */ \ - u8 pstate_cnt; /* Processor performance state control*/ \ - u32 V1_pm1a_evt_blk; /* Port address of Power Mgt 1a Event Reg Blk */ \ - u32 V1_pm1b_evt_blk; /* Port address of Power Mgt 1b Event Reg Blk */ \ - u32 V1_pm1a_cnt_blk; /* Port address of Power Mgt 1a Control Reg Blk */ \ - u32 V1_pm1b_cnt_blk; /* Port address of Power Mgt 1b Control Reg Blk */ \ - u32 V1_pm2_cnt_blk; /* Port address of Power Mgt 2 Control Reg Blk */ \ - u32 V1_pm_tmr_blk; /* Port address of Power Mgt Timer Ctrl Reg Blk */ \ - u32 V1_gpe0_blk; /* Port addr of General Purpose acpi_event 0 Reg Blk */ \ - u32 V1_gpe1_blk; /* Port addr of General Purpose acpi_event 1 Reg Blk */ \ - u8 pm1_evt_len; /* Byte Length of ports at pm1_x_evt_blk */ \ - u8 pm1_cnt_len; /* Byte Length of ports at pm1_x_cnt_blk */ \ - u8 pm2_cnt_len; /* Byte Length of ports at pm2_cnt_blk */ \ - u8 pm_tm_len; /* Byte Length of ports at pm_tm_blk */ \ - u8 gpe0_blk_len; /* Byte Length of ports at gpe0_blk */ \ - u8 gpe1_blk_len; /* Byte Length of ports at gpe1_blk */ \ - u8 gpe1_base; /* Offset in gpe model where gpe1 events start */ \ - u8 cst_cnt; /* Support for the _CST object and C States change notification.*/ \ - u16 plvl2_lat; /* Worst case HW latency to enter/exit C2 state */ \ - u16 plvl3_lat; /* Worst case HW latency to enter/exit C3 state */ \ - u16 flush_size; /* Processor's memory cache line width, in bytes */ \ - u16 flush_stride; /* Number of flush strides that need to be read */ \ - u8 duty_offset; /* Processor's duty cycle index in processor's P_CNT reg*/ \ - u8 duty_width; /* Processor's duty cycle value bit width in P_CNT register.*/ \ - u8 day_alrm; /* Index to day-of-month alarm in RTC CMOS RAM */ \ - u8 mon_alrm; /* Index to month-of-year alarm in RTC CMOS RAM */ \ - u8 century; /* Index to century in RTC CMOS RAM */ \ - u16 iapc_boot_arch; /* IA-PC Boot Architecture Flags. See Table 5-10 for description*/ \ - u8 reserved2; /* Reserved, must be zero */ +struct madt_interrupt_override { + APIC_HEADER_DEF u8 bus; /* 0 - ISA */ + u8 source; /* Interrupt source (IRQ) */ + u32 interrupt; /* Global system interrupt */ + MPS_INTI_FLAGS}; -/* - * ACPI 2.0+ FADT - */ -struct fadt_descriptor { - ACPI_FADT_COMMON - /* Flags (32 bits) */ - u8 wb_invd:1; /* 00: The wbinvd instruction works properly */ - u8 wb_invd_flush:1; /* 01: The wbinvd flushes but does not invalidate */ - u8 proc_c1:1; /* 02: All processors support C1 state */ - u8 plvl2_up:1; /* 03: C2 state works on MP system */ - u8 pwr_button:1; /* 04: Power button is handled as a generic feature */ - u8 sleep_button:1; /* 05: Sleep button is handled as a generic feature, or not present */ - u8 fixed_rTC:1; /* 06: RTC wakeup stat not in fixed register space */ - u8 rtcs4:1; /* 07: RTC wakeup stat not possible from S4 */ - u8 tmr_val_ext:1; /* 08: tmr_val is 32 bits 0=24-bits */ - u8 dock_cap:1; /* 09: Docking supported */ - u8 reset_reg_sup:1; /* 10: System reset via the FADT RESET_REG supported */ - u8 sealed_case:1; /* 11: No internal expansion capabilities and case is sealed */ - u8 headless:1; /* 12: No local video capabilities or local input devices */ - u8 cpu_sw_sleep:1; /* 13: Must execute native instruction after writing SLP_TYPx register */ - - u8 pci_exp_wak:1; /* 14: System supports PCIEXP_WAKE (STS/EN) bits (ACPI 3.0) */ - u8 use_platform_clock:1; /* 15: OSPM should use platform-provided timer (ACPI 3.0) */ - u8 S4rtc_sts_valid:1; /* 16: Contents of RTC_STS valid after S4 wake (ACPI 3.0) */ - u8 remote_power_on_capable:1; /* 17: System is compatible with remote power on (ACPI 3.0) */ - u8 force_apic_cluster_model:1; /* 18: All local APICs must use cluster model (ACPI 3.0) */ - u8 force_apic_physical_destination_mode:1; /* 19: All local x_aPICs must use physical dest mode (ACPI 3.0) */ - u8:4; /* 20-23: Reserved, must be zero */ - u8 reserved3; /* 24-31: Reserved, must be zero */ - - struct acpi_generic_address reset_register; /* Reset register address in GAS format */ - u8 reset_value; /* Value to write to the reset_register port to reset the system */ - u8 reserved4[3]; /* These three bytes must be zero */ - u64 xfirmware_ctrl; /* 64-bit physical address of FACS */ - u64 Xdsdt; /* 64-bit physical address of DSDT */ - struct acpi_generic_address xpm1a_evt_blk; /* Extended Power Mgt 1a acpi_event Reg Blk address */ - struct acpi_generic_address xpm1b_evt_blk; /* Extended Power Mgt 1b acpi_event Reg Blk address */ - struct acpi_generic_address xpm1a_cnt_blk; /* Extended Power Mgt 1a Control Reg Blk address */ - struct acpi_generic_address xpm1b_cnt_blk; /* Extended Power Mgt 1b Control Reg Blk address */ - struct acpi_generic_address xpm2_cnt_blk; /* Extended Power Mgt 2 Control Reg Blk address */ - struct acpi_generic_address xpm_tmr_blk; /* Extended Power Mgt Timer Ctrl Reg Blk address */ - struct acpi_generic_address xgpe0_blk; /* Extended General Purpose acpi_event 0 Reg Blk address */ - struct acpi_generic_address xgpe1_blk; /* Extended General Purpose acpi_event 1 Reg Blk address */ +struct madt_nmi_source { + APIC_HEADER_DEF MPS_INTI_FLAGS u32 interrupt; /* Global system interrupt */ }; -/* - * "Down-revved" ACPI 2.0 FADT descriptor - * Defined here to allow compiler to generate the length of the struct - */ -struct fadt_descriptor_rev2_minus { - ACPI_FADT_COMMON u32 flags; - struct acpi_generic_address reset_register; /* Reset register address in GAS format */ - u8 reset_value; /* Value to write to the reset_register port to reset the system. */ - u8 reserved7[3]; /* Reserved, must be zero */ +struct madt_local_apic_nmi { + APIC_HEADER_DEF u8 processor_id; /* ACPI processor id */ + MPS_INTI_FLAGS u8 lint; /* LINTn to which NMI is connected */ }; -/* - * ACPI 1.0 FADT - * Defined here to allow compiler to generate the length of the struct - */ -struct fadt_descriptor_rev1 { - ACPI_FADT_COMMON u32 flags; +struct madt_address_override { + APIC_HEADER_DEF u16 reserved; /* Reserved, must be zero */ + u64 address; /* APIC physical address */ }; -/* FADT: Prefered Power Management Profiles */ - -#define PM_UNSPECIFIED 0 -#define PM_DESKTOP 1 -#define PM_MOBILE 2 -#define PM_WORKSTATION 3 -#define PM_ENTERPRISE_SERVER 4 -#define PM_SOHO_SERVER 5 -#define PM_APPLIANCE_PC 6 - -/* FADT: Boot Arch Flags */ - -#define BAF_LEGACY_DEVICES 0x0001 -#define BAF_8042_KEYBOARD_CONTROLLER 0x0002 - -#define FADT2_REVISION_ID 3 -#define FADT2_MINUS_REVISION_ID 2 +struct madt_io_sapic { + APIC_HEADER_DEF u8 io_sapic_id; /* I/O SAPIC ID */ + u8 reserved; /* Reserved, must be zero */ + u32 interrupt_base; /* Glocal interrupt for SAPIC start */ + u64 address; /* SAPIC physical address */ +}; -/* Reset to default packing */ +struct madt_local_sapic { + APIC_HEADER_DEF u8 processor_id; /* ACPI processor id */ + u8 local_sapic_id; /* SAPIC ID */ + u8 local_sapic_eid; /* SAPIC EID */ + u8 reserved[3]; /* Reserved, must be zero */ + LOCAL_APIC_FLAGS u32 processor_uID; /* Numeric UID - ACPI 3.0 */ + char processor_uIDstring[1]; /* String UID - ACPI 3.0 */ +}; -#pragma pack() +struct madt_interrupt_source { + APIC_HEADER_DEF MPS_INTI_FLAGS u8 interrupt_type; /* 1=PMI, 2=INIT, 3=corrected */ + u8 processor_id; /* Processor ID */ + u8 processor_eid; /* Processor EID */ + u8 io_sapic_vector; /* Vector value for PMI interrupts */ + u32 interrupt; /* Global system interrupt */ + u32 flags; /* Interrupt Source Flags */ +}; /* - * This macro is temporary until the table bitfield flag definitions - * are removed and replaced by a Flags field. + * Smart Battery */ -#define ACPI_FLAG_OFFSET(d,f,o) (u8) (ACPI_OFFSET (d,f) + \ - sizeof(((d *)0)->f) + o) -/* - * Get the remaining ACPI tables - */ -#include "actbl1.h" +struct smart_battery_table { + ACPI_TABLE_HEADER_DEF u32 warning_level; + u32 low_level; + u32 critical_level; +}; + +#pragma pack() /* * ACPI Table information. We save the table address, length, @@ -354,17 +290,27 @@ struct acpi_table_support { u8 flags; }; +/* + * Get the ACPI version-specific tables + */ +#include "actbl1.h" /* Acpi 1.0 table definitions */ +#include "actbl2.h" /* Acpi 2.0 table definitions */ + extern u8 acpi_fadt_is_v1; /* is set to 1 if FADT is revision 1, * needed for certain workarounds */ -/* Macros used to generate offsets to specific table fields */ -#define ACPI_FACS_OFFSET(f) (u8) ACPI_OFFSET (struct facs_descriptor,f) -#define ACPI_FADT_OFFSET(f) (u8) ACPI_OFFSET (struct fadt_descriptor, f) -#define ACPI_GAS_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_generic_address,f) -#define ACPI_HDR_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_table_header,f) -#define ACPI_RSDP_OFFSET(f) (u8) ACPI_OFFSET (struct rsdp_descriptor,f) +#pragma pack(1) +/* + * High performance timer + */ +struct hpet_table { + ACPI_TABLE_HEADER_DEF u32 hardware_id; + struct acpi_generic_address base_address; + u8 hpet_number; + u16 clock_tick; + u8 attributes; +}; -#define ACPI_FADT_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (struct fadt_descriptor,f,o) -#define ACPI_FACS_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (struct facs_descriptor,f,o) +#pragma pack() #endif /* __ACTBL_H__ */ diff --git a/trunk/include/acpi/actbl1.h b/trunk/include/acpi/actbl1.h index 745a6445a4f9..cd428d57add0 100644 --- a/trunk/include/acpi/actbl1.h +++ b/trunk/include/acpi/actbl1.h @@ -1,6 +1,6 @@ /****************************************************************************** * - * Name: actbl1.h - Additional ACPI table definitions + * Name: actbl1.h - ACPI 1.0 tables * *****************************************************************************/ @@ -44,599 +44,92 @@ #ifndef __ACTBL1_H__ #define __ACTBL1_H__ -/******************************************************************************* - * - * Additional ACPI Tables - * - * These tables are not consumed directly by the ACPICA subsystem, but are - * included here to support device drivers and the AML disassembler. - * - ******************************************************************************/ - -/* - * Values for description table header signatures. Useful because they make - * it more difficult to inadvertently type in the wrong signature. - */ -#define ACPI_SIG_ASF "ASF!" /* Alert Standard Format table */ -#define ACPI_SIG_BOOT "BOOT" /* Simple Boot Flag Table */ -#define ACPI_SIG_CPEP "CPEP" /* Corrected Platform Error Polling table */ -#define ACPI_SIG_DBGP "DBGP" /* Debug Port table */ -#define ACPI_SIG_ECDT "ECDT" /* Embedded Controller Boot Resources Table */ -#define ACPI_SIG_HPET "HPET" /* High Precision Event Timer table */ -#define ACPI_SIG_MADT "APIC" /* Multiple APIC Description Table */ -#define ACPI_SIG_MCFG "MCFG" /* PCI Memory Mapped Configuration table */ -#define ACPI_SIG_SBST "SBST" /* Smart Battery Specification Table */ -#define ACPI_SIG_SLIT "SLIT" /* System Locality Distance Information Table */ -#define ACPI_SIG_SPCR "SPCR" /* Serial Port Console Redirection table */ -#define ACPI_SIG_SPMI "SPMI" /* Server Platform Management Interface table */ -#define ACPI_SIG_SRAT "SRAT" /* System Resource Affinity Table */ -#define ACPI_SIG_TCPA "TCPA" /* Trusted Computing Platform Alliance table */ -#define ACPI_SIG_WDRT "WDRT" /* Watchdog Resource Table */ - -/* Legacy names */ - -#define APIC_SIG "APIC" /* Multiple APIC Description Table */ -#define BOOT_SIG "BOOT" /* Simple Boot Flag Table */ -#define SBST_SIG "SBST" /* Smart Battery Specification Table */ - -/* - * All tables must be byte-packed to match the ACPI specification, since - * the tables are provided by the system BIOS. - */ #pragma pack(1) /* - * Note about bitfields: The u8 type is used for bitfields in ACPI tables. - * This is the only type that is even remotely portable. Anything else is not - * portable, so do not use any other bitfield types. + * ACPI 1.0 Root System Description Table (RSDT) */ - -/******************************************************************************* - * - * ASF - Alert Standard Format table (Signature "ASF!") - * - ******************************************************************************/ - -struct acpi_table_asf { -ACPI_TABLE_HEADER_DEF}; - -#define ACPI_ASF_HEADER_DEF \ - u8 type; \ - u8 reserved; \ - u16 length; - -struct acpi_asf_header { -ACPI_ASF_HEADER_DEF}; - -/* Values for Type field */ - -#define ASF_INFO 0 -#define ASF_ALERT 1 -#define ASF_CONTROL 2 -#define ASF_BOOT 3 -#define ASF_ADDRESS 4 -#define ASF_RESERVED 5 +struct rsdt_descriptor_rev1 { + ACPI_TABLE_HEADER_DEF /* ACPI common table header */ + u32 table_offset_entry[1]; /* Array of pointers to ACPI tables */ +}; /* - * ASF subtables + * ACPI 1.0 Firmware ACPI Control Structure (FACS) */ - -/* 0: ASF Information */ - -struct acpi_asf_info { - ACPI_ASF_HEADER_DEF u8 min_reset_value; - u8 min_poll_interval; - u16 system_id; - u32 mfg_id; - u8 flags; - u8 reserved2[3]; -}; - -/* 1: ASF Alerts */ - -struct acpi_asf_alert { - ACPI_ASF_HEADER_DEF u8 assert_mask; - u8 deassert_mask; - u8 alerts; - u8 data_length; - u8 array[1]; -}; - -/* 2: ASF Remote Control */ - -struct acpi_asf_remote { - ACPI_ASF_HEADER_DEF u8 controls; - u8 data_length; - u16 reserved2; - u8 array[1]; -}; - -/* 3: ASF RMCP Boot Options */ - -struct acpi_asf_rmcp { - ACPI_ASF_HEADER_DEF u8 capabilities[7]; - u8 completion_code; - u32 enterprise_id; - u8 command; - u16 parameter; - u16 boot_options; - u16 oem_parameters; -}; - -/* 4: ASF Address */ - -struct acpi_asf_address { - ACPI_ASF_HEADER_DEF u8 eprom_address; - u8 devices; - u8 smbus_addresses[1]; -}; - -/******************************************************************************* - * - * BOOT - Simple Boot Flag Table - * - ******************************************************************************/ - -struct acpi_table_boot { - ACPI_TABLE_HEADER_DEF u8 cmos_index; /* Index in CMOS RAM for the boot register */ - u8 reserved[3]; -}; - -/******************************************************************************* - * - * CPEP - Corrected Platform Error Polling table - * - ******************************************************************************/ - -struct acpi_table_cpep { - ACPI_TABLE_HEADER_DEF u64 reserved; -}; - -/* Subtable */ - -struct acpi_cpep_polling { - u8 type; - u8 length; - u8 processor_id; /* Processor ID */ - u8 processor_eid; /* Processor EID */ - u32 polling_interval; /* Polling interval (msec) */ -}; - -/******************************************************************************* - * - * DBGP - Debug Port table - * - ******************************************************************************/ - -struct acpi_table_dbgp { - ACPI_TABLE_HEADER_DEF u8 interface_type; /* 0=full 16550, 1=subset of 16550 */ - u8 reserved[3]; - struct acpi_generic_address debug_port; -}; - -/******************************************************************************* - * - * ECDT - Embedded Controller Boot Resources Table - * - ******************************************************************************/ - -struct ec_boot_resources { - ACPI_TABLE_HEADER_DEF struct acpi_generic_address ec_control; /* Address of EC command/status register */ - struct acpi_generic_address ec_data; /* Address of EC data register */ - u32 uid; /* Unique ID - must be same as the EC _UID method */ - u8 gpe_bit; /* The GPE for the EC */ - u8 ec_id[1]; /* Full namepath of the EC in the ACPI namespace */ -}; - -/******************************************************************************* - * - * HPET - High Precision Event Timer table - * - ******************************************************************************/ - -struct acpi_hpet_table { - ACPI_TABLE_HEADER_DEF u32 hardware_id; /* Hardware ID of event timer block */ - struct acpi_generic_address base_address; /* Address of event timer block */ - u8 hpet_number; /* HPET sequence number */ - u16 clock_tick; /* Main counter min tick, periodic mode */ - u8 attributes; -}; - -#if 0 /* HPET flags to be converted to macros */ -struct { /* Flags (8 bits) */ - u8 page_protect:1; /* 00: No page protection */ - u8 page_protect4:1; /* 01: 4_kB page protected */ - u8 page_protect64:1; /* 02: 64_kB page protected */ - u8:5; /* 03-07: Reserved, must be zero */ -} flags; -#endif - -/******************************************************************************* - * - * MADT - Multiple APIC Description Table - * - ******************************************************************************/ - -struct multiple_apic_table { - ACPI_TABLE_HEADER_DEF u32 local_apic_address; /* Physical address of local APIC */ +struct facs_descriptor_rev1 { + char signature[4]; /* ASCII table signature */ + u32 length; /* Length of structure in bytes */ + u32 hardware_signature; /* Hardware configuration signature */ + u32 firmware_waking_vector; /* ACPI OS waking vector */ + u32 global_lock; /* Global Lock */ /* Flags (32 bits) */ - u8 PCATcompat:1; /* 00: System also has dual 8259s */ + u8 S4bios_f:1; /* 00: S4BIOS support is present */ u8:7; /* 01-07: Reserved, must be zero */ u8 reserved1[3]; /* 08-31: Reserved, must be zero */ -}; - -/* Values for MADT PCATCompat */ - -#define DUAL_PIC 0 -#define MULTIPLE_APIC 1 - -/* Common MADT Sub-table header */ - -#define APIC_HEADER_DEF \ - u8 type; \ - u8 length; - -struct apic_header { -APIC_HEADER_DEF}; -/* Values for Type in struct apic_header */ - -#define APIC_PROCESSOR 0 -#define APIC_IO 1 -#define APIC_XRUPT_OVERRIDE 2 -#define APIC_NMI 3 -#define APIC_LOCAL_NMI 4 -#define APIC_ADDRESS_OVERRIDE 5 -#define APIC_IO_SAPIC 6 -#define APIC_LOCAL_SAPIC 7 -#define APIC_XRUPT_SOURCE 8 -#define APIC_RESERVED 9 /* 9 and greater are reserved */ - -/* Flag definitions for MADT sub-tables */ - -#define ACPI_MADT_IFLAGS /* INTI flags (16 bits) */ \ - u8 polarity : 2; /* 00-01: Polarity of APIC I/O input signals */\ - u8 trigger_mode : 2; /* 02-03: Trigger mode of APIC input signals */\ - u8 : 4; /* 04-07: Reserved, must be zero */\ - u8 reserved1; /* 08-15: Reserved, must be zero */ - -#define ACPI_MADT_LFLAGS /* Local Sapic flags (32 bits) */ \ - u8 processor_enabled: 1; /* 00: Processor is usable if set */\ - u8 : 7; /* 01-07: Reserved, must be zero */\ - u8 reserved2[3]; /* 08-31: Reserved, must be zero */ - -/* Values for MPS INTI flags */ - -#define POLARITY_CONFORMS 0 -#define POLARITY_ACTIVE_HIGH 1 -#define POLARITY_RESERVED 2 -#define POLARITY_ACTIVE_LOW 3 - -#define TRIGGER_CONFORMS 0 -#define TRIGGER_EDGE 1 -#define TRIGGER_RESERVED 2 -#define TRIGGER_LEVEL 3 + u8 reserved2[40]; /* Reserved, must be zero */ +}; /* - * MADT Sub-tables, correspond to Type in struct apic_header + * ACPI 1.0 Fixed ACPI Description Table (FADT) */ - -/* 0: processor APIC */ - -struct madt_processor_apic { - APIC_HEADER_DEF u8 processor_id; /* ACPI processor id */ - u8 local_apic_id; /* Processor's local APIC id */ - ACPI_MADT_LFLAGS}; - -/* 1: IO APIC */ - -struct madt_io_apic { - APIC_HEADER_DEF u8 io_apic_id; /* I/O APIC ID */ - u8 reserved; /* Reserved - must be zero */ - u32 address; /* APIC physical address */ - u32 interrupt; /* Global system interrupt where INTI lines start */ -}; - -/* 2: Interrupt Override */ - -struct madt_interrupt_override { - APIC_HEADER_DEF u8 bus; /* 0 - ISA */ - u8 source; /* Interrupt source (IRQ) */ - u32 interrupt; /* Global system interrupt */ - ACPI_MADT_IFLAGS}; - -/* 3: NMI Sources */ - -struct madt_nmi_source { - APIC_HEADER_DEF ACPI_MADT_IFLAGS u32 interrupt; /* Global system interrupt */ -}; - -/* 4: Local APIC NMI */ - -struct madt_local_apic_nmi { - APIC_HEADER_DEF u8 processor_id; /* ACPI processor id */ - ACPI_MADT_IFLAGS u8 lint; /* LINTn to which NMI is connected */ -}; - -/* 5: Address Override */ - -struct madt_address_override { - APIC_HEADER_DEF u16 reserved; /* Reserved, must be zero */ - u64 address; /* APIC physical address */ -}; - -/* 6: I/O Sapic */ - -struct madt_io_sapic { - APIC_HEADER_DEF u8 io_sapic_id; /* I/O SAPIC ID */ - u8 reserved; /* Reserved, must be zero */ - u32 interrupt_base; /* Glocal interrupt for SAPIC start */ - u64 address; /* SAPIC physical address */ -}; - -/* 7: Local Sapic */ - -struct madt_local_sapic { - APIC_HEADER_DEF u8 processor_id; /* ACPI processor id */ - u8 local_sapic_id; /* SAPIC ID */ - u8 local_sapic_eid; /* SAPIC EID */ - u8 reserved[3]; /* Reserved, must be zero */ - ACPI_MADT_LFLAGS u32 processor_uID; /* Numeric UID - ACPI 3.0 */ - char processor_uIDstring[1]; /* String UID - ACPI 3.0 */ -}; - -/* 8: Platform Interrupt Source */ - -struct madt_interrupt_source { - APIC_HEADER_DEF ACPI_MADT_IFLAGS u8 interrupt_type; /* 1=PMI, 2=INIT, 3=corrected */ - u8 processor_id; /* Processor ID */ - u8 processor_eid; /* Processor EID */ - u8 io_sapic_vector; /* Vector value for PMI interrupts */ - u32 interrupt; /* Global system interrupt */ - u32 flags; /* Interrupt Source Flags */ -}; - -#ifdef DUPLICATE_DEFINITION_WITH_LINUX_ACPI_H -/******************************************************************************* - * - * MCFG - PCI Memory Mapped Configuration table and sub-table - * - ******************************************************************************/ - -struct acpi_table_mcfg { - ACPI_TABLE_HEADER_DEF u8 reserved[8]; -}; - -struct acpi_mcfg_allocation { - u64 base_address; /* Base address, processor-relative */ - u16 pci_segment; /* PCI segment group number */ - u8 start_bus_number; /* Starting PCI Bus number */ - u8 end_bus_number; /* Final PCI Bus number */ - u32 reserved; -}; -#endif - -/******************************************************************************* - * - * SBST - Smart Battery Specification Table - * - ******************************************************************************/ - -struct smart_battery_table { - ACPI_TABLE_HEADER_DEF u32 warning_level; - u32 low_level; - u32 critical_level; -}; - -/******************************************************************************* - * - * SLIT - System Locality Distance Information Table - * - ******************************************************************************/ - -struct system_locality_info { - ACPI_TABLE_HEADER_DEF u64 locality_count; - u8 entry[1][1]; -}; - -/******************************************************************************* - * - * SPCR - Serial Port Console Redirection table - * - ******************************************************************************/ - -struct acpi_table_spcr { - ACPI_TABLE_HEADER_DEF u8 interface_type; /* 0=full 16550, 1=subset of 16550 */ - u8 reserved[3]; - struct acpi_generic_address serial_port; - u8 interrupt_type; - u8 pc_interrupt; - u32 interrupt; - u8 baud_rate; - u8 parity; - u8 stop_bits; - u8 flow_control; - u8 terminal_type; - u8 reserved2; - u16 pci_device_id; - u16 pci_vendor_id; - u8 pci_bus; - u8 pci_device; - u8 pci_function; - u32 pci_flags; - u8 pci_segment; - u32 reserved3; -}; - -/******************************************************************************* - * - * SPMI - Server Platform Management Interface table - * - ******************************************************************************/ - -struct acpi_table_spmi { - ACPI_TABLE_HEADER_DEF u8 reserved; - u8 interface_type; - u16 spec_revision; /* Version of IPMI */ - u8 interrupt_type; - u8 gpe_number; /* GPE assigned */ - u8 reserved2; - u8 pci_device_flag; - u32 interrupt; - struct acpi_generic_address ipmi_register; - u8 pci_segment; - u8 pci_bus; - u8 pci_device; - u8 pci_function; -}; - -/******************************************************************************* - * - * SRAT - System Resource Affinity Table - * - ******************************************************************************/ - -struct system_resource_affinity { - ACPI_TABLE_HEADER_DEF u32 reserved1; /* Must be value '1' */ - u64 reserved2; /* Reserved, must be zero */ -}; - -/* SRAT common sub-table header */ - -#define SRAT_SUBTABLE_HEADER \ - u8 type; \ - u8 length; - -/* Values for Type above */ - -#define SRAT_CPU_AFFINITY 0 -#define SRAT_MEMORY_AFFINITY 1 -#define SRAT_RESERVED 2 - -/* SRAT sub-tables */ - -struct static_resource_alloc { - SRAT_SUBTABLE_HEADER u8 proximity_domain_lo; - u8 apic_id; - - /* Flags (32 bits) */ - - u8 enabled:1; /* 00: Use affinity structure */ - u8:7; /* 01-07: Reserved, must be zero */ - u8 reserved3[3]; /* 08-31: Reserved, must be zero */ - - u8 local_sapic_eid; - u8 proximity_domain_hi[3]; - u32 reserved4; /* Reserved, must be zero */ -}; - -struct memory_affinity { - SRAT_SUBTABLE_HEADER u32 proximity_domain; - u16 reserved3; - u64 base_address; - u64 address_length; - u32 reserved4; +struct fadt_descriptor_rev1 { + ACPI_TABLE_HEADER_DEF /* ACPI common table header */ + u32 firmware_ctrl; /* Physical address of FACS */ + u32 dsdt; /* Physical address of DSDT */ + u8 model; /* System Interrupt Model */ + u8 reserved1; /* Reserved, must be zero */ + u16 sci_int; /* System vector of SCI interrupt */ + u32 smi_cmd; /* Port address of SMI command port */ + u8 acpi_enable; /* Value to write to smi_cmd to enable ACPI */ + u8 acpi_disable; /* Value to write to smi_cmd to disable ACPI */ + u8 S4bios_req; /* Value to write to SMI CMD to enter S4BIOS state */ + u8 reserved2; /* Reserved, must be zero */ + u32 pm1a_evt_blk; /* Port address of Power Mgt 1a acpi_event Reg Blk */ + u32 pm1b_evt_blk; /* Port address of Power Mgt 1b acpi_event Reg Blk */ + u32 pm1a_cnt_blk; /* Port address of Power Mgt 1a Control Reg Blk */ + u32 pm1b_cnt_blk; /* Port address of Power Mgt 1b Control Reg Blk */ + u32 pm2_cnt_blk; /* Port address of Power Mgt 2 Control Reg Blk */ + u32 pm_tmr_blk; /* Port address of Power Mgt Timer Ctrl Reg Blk */ + u32 gpe0_blk; /* Port addr of General Purpose acpi_event 0 Reg Blk */ + u32 gpe1_blk; /* Port addr of General Purpose acpi_event 1 Reg Blk */ + u8 pm1_evt_len; /* Byte length of ports at pm1_x_evt_blk */ + u8 pm1_cnt_len; /* Byte length of ports at pm1_x_cnt_blk */ + u8 pm2_cnt_len; /* Byte Length of ports at pm2_cnt_blk */ + u8 pm_tm_len; /* Byte Length of ports at pm_tm_blk */ + u8 gpe0_blk_len; /* Byte Length of ports at gpe0_blk */ + u8 gpe1_blk_len; /* Byte Length of ports at gpe1_blk */ + u8 gpe1_base; /* Offset in gpe model where gpe1 events start */ + u8 reserved3; /* Reserved, must be zero */ + u16 plvl2_lat; /* Worst case HW latency to enter/exit C2 state */ + u16 plvl3_lat; /* Worst case HW latency to enter/exit C3 state */ + u16 flush_size; /* Size of area read to flush caches */ + u16 flush_stride; /* Stride used in flushing caches */ + u8 duty_offset; /* Bit location of duty cycle field in p_cnt reg */ + u8 duty_width; /* Bit width of duty cycle field in p_cnt reg */ + u8 day_alrm; /* Index to day-of-month alarm in RTC CMOS RAM */ + u8 mon_alrm; /* Index to month-of-year alarm in RTC CMOS RAM */ + u8 century; /* Index to century in RTC CMOS RAM */ + u8 reserved4[3]; /* Reserved, must be zero */ /* Flags (32 bits) */ - u8 enabled:1; /* 00: Use affinity structure */ - u8 hot_pluggable:1; /* 01: Memory region is hot pluggable */ - u8 non_volatile:1; /* 02: Memory is non-volatile */ - u8:5; /* 03-07: Reserved, must be zero */ - u8 reserved5[3]; /* 08-31: Reserved, must be zero */ - - u64 reserved6; /* Reserved, must be zero */ -}; - -/******************************************************************************* - * - * TCPA - Trusted Computing Platform Alliance table - * - ******************************************************************************/ - -struct acpi_table_tcpa { - ACPI_TABLE_HEADER_DEF u16 reserved; - u32 max_log_length; /* Maximum length for the event log area */ - u64 log_address; /* Address of the event log area */ + u8 wb_invd:1; /* 00: The wbinvd instruction works properly */ + u8 wb_invd_flush:1; /* 01: The wbinvd flushes but does not invalidate */ + u8 proc_c1:1; /* 02: All processors support C1 state */ + u8 plvl2_up:1; /* 03: C2 state works on MP system */ + u8 pwr_button:1; /* 04: Power button is handled as a generic feature */ + u8 sleep_button:1; /* 05: Sleep button is handled as a generic feature, or not present */ + u8 fixed_rTC:1; /* 06: RTC wakeup stat not in fixed register space */ + u8 rtcs4:1; /* 07: RTC wakeup stat not possible from S4 */ + u8 tmr_val_ext:1; /* 08: tmr_val width is 32 bits (0 = 24 bits) */ + u8:7; /* 09-15: Reserved, must be zero */ + u8 reserved5[2]; /* 16-31: Reserved, must be zero */ }; -/******************************************************************************* - * - * WDRT - Watchdog Resource Table - * - ******************************************************************************/ - -struct acpi_table_wdrt { - ACPI_TABLE_HEADER_DEF u32 header_length; /* Watchdog Header Length */ - u8 pci_segment; /* PCI Segment number */ - u8 pci_bus; /* PCI Bus number */ - u8 pci_device; /* PCI Device number */ - u8 pci_function; /* PCI Function number */ - u32 timer_period; /* Period of one timer count (msec) */ - u32 max_count; /* Maximum counter value supported */ - u32 min_count; /* Minimum counter value */ - u8 flags; - u8 reserved[3]; - u32 entries; /* Number of watchdog entries that follow */ -}; - -#if 0 /* Flags, will be converted to macros */ -u8 enabled:1; /* 00: Timer enabled */ -u8:6; /* 01-06: Reserved */ -u8 sleep_stop:1; /* 07: Timer stopped in sleep state */ -#endif - -/* Macros used to generate offsets to specific table fields */ - -#define ACPI_ASF0_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_asf_info,f) -#define ACPI_ASF1_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_asf_alert,f) -#define ACPI_ASF2_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_asf_remote,f) -#define ACPI_ASF3_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_asf_rmcp,f) -#define ACPI_ASF4_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_asf_address,f) -#define ACPI_BOOT_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_table_boot,f) -#define ACPI_CPEP_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_table_cpep,f) -#define ACPI_CPEP0_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_cpep_polling,f) -#define ACPI_DBGP_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_table_dbgp,f) -#define ACPI_ECDT_OFFSET(f) (u8) ACPI_OFFSET (struct ec_boot_resources,f) -#define ACPI_HPET_OFFSET(f) (u8) ACPI_OFFSET (struct hpet_table,f) -#define ACPI_MADT_OFFSET(f) (u8) ACPI_OFFSET (struct multiple_apic_table,f) -#define ACPI_MADT0_OFFSET(f) (u8) ACPI_OFFSET (struct madt_processor_apic,f) -#define ACPI_MADT1_OFFSET(f) (u8) ACPI_OFFSET (struct madt_io_apic,f) -#define ACPI_MADT2_OFFSET(f) (u8) ACPI_OFFSET (struct madt_interrupt_override,f) -#define ACPI_MADT3_OFFSET(f) (u8) ACPI_OFFSET (struct madt_nmi_source,f) -#define ACPI_MADT4_OFFSET(f) (u8) ACPI_OFFSET (struct madt_local_apic_nmi,f) -#define ACPI_MADT5_OFFSET(f) (u8) ACPI_OFFSET (struct madt_address_override,f) -#define ACPI_MADT6_OFFSET(f) (u8) ACPI_OFFSET (struct madt_io_sapic,f) -#define ACPI_MADT7_OFFSET(f) (u8) ACPI_OFFSET (struct madt_local_sapic,f) -#define ACPI_MADT8_OFFSET(f) (u8) ACPI_OFFSET (struct madt_interrupt_source,f) -#define ACPI_MADTH_OFFSET(f) (u8) ACPI_OFFSET (struct apic_header,f) -#define ACPI_MCFG_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_table_mcfg,f) -#define ACPI_MCFG0_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_mcfg_allocation,f) -#define ACPI_SBST_OFFSET(f) (u8) ACPI_OFFSET (struct smart_battery_table,f) -#define ACPI_SLIT_OFFSET(f) (u8) ACPI_OFFSET (struct system_locality_info,f) -#define ACPI_SPCR_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_table_spcr,f) -#define ACPI_SPMI_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_table_spmi,f) -#define ACPI_SRAT_OFFSET(f) (u8) ACPI_OFFSET (struct system_resource_affinity,f) -#define ACPI_SRAT0_OFFSET(f) (u8) ACPI_OFFSET (struct static_resource_alloc,f) -#define ACPI_SRAT1_OFFSET(f) (u8) ACPI_OFFSET (struct memory_affinity,f) -#define ACPI_TCPA_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_table_tcpa,f) -#define ACPI_WDRT_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_table_wdrt,f) - -#define ACPI_HPET_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (struct hpet_table,f,o) -#define ACPI_SRAT0_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (struct static_resource_alloc,f,o) -#define ACPI_SRAT1_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (struct memory_affinity,f,o) -#define ACPI_MADT_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (struct multiple_apic_table,f,o) -#define ACPI_MADT0_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (struct madt_processor_apic,f,o) -#define ACPI_MADT2_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (struct madt_interrupt_override,f,o) -#define ACPI_MADT3_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (struct madt_nmi_source,f,o) -#define ACPI_MADT4_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (struct madt_local_apic_nmi,f,o) -#define ACPI_MADT7_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (struct madt_local_sapic,f,o) -#define ACPI_MADT8_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (struct madt_interrupt_source,f,o) - -/* Reset to default packing */ - #pragma pack() #endif /* __ACTBL1_H__ */ diff --git a/trunk/include/acpi/actbl2.h b/trunk/include/acpi/actbl2.h index 67efe6cad27b..dfc7ac1094bb 100644 --- a/trunk/include/acpi/actbl2.h +++ b/trunk/include/acpi/actbl2.h @@ -44,6 +44,234 @@ #ifndef __ACTBL2_H__ #define __ACTBL2_H__ -/* Code moved to both actbl.h and actbl1.h */ +/* + * Prefered Power Management Profiles + */ +#define PM_UNSPECIFIED 0 +#define PM_DESKTOP 1 +#define PM_MOBILE 2 +#define PM_WORKSTATION 3 +#define PM_ENTERPRISE_SERVER 4 +#define PM_SOHO_SERVER 5 +#define PM_APPLIANCE_PC 6 + +/* + * ACPI Boot Arch Flags + */ +#define BAF_LEGACY_DEVICES 0x0001 +#define BAF_8042_KEYBOARD_CONTROLLER 0x0002 + +#define FADT2_REVISION_ID 3 +#define FADT2_MINUS_REVISION_ID 2 + +#pragma pack(1) + +/* + * ACPI 2.0 Root System Description Table (RSDT) + */ +struct rsdt_descriptor_rev2 { + ACPI_TABLE_HEADER_DEF /* ACPI common table header */ + u32 table_offset_entry[1]; /* Array of pointers to ACPI tables */ +}; + +/* + * ACPI 2.0 Extended System Description Table (XSDT) + */ +struct xsdt_descriptor_rev2 { + ACPI_TABLE_HEADER_DEF /* ACPI common table header */ + u64 table_offset_entry[1]; /* Array of pointers to ACPI tables */ +}; + +/* + * ACPI 2.0 Firmware ACPI Control Structure (FACS) + */ +struct facs_descriptor_rev2 { + char signature[4]; /* ASCII table signature */ + u32 length; /* Length of structure, in bytes */ + u32 hardware_signature; /* Hardware configuration signature */ + u32 firmware_waking_vector; /* 32-bit physical address of the Firmware Waking Vector. */ + u32 global_lock; /* Global Lock used to synchronize access to shared hardware resources */ + + /* Flags (32 bits) */ + + u8 S4bios_f:1; /* 00: S4BIOS support is present */ + u8:7; /* 01-07: Reserved, must be zero */ + u8 reserved1[3]; /* 08-31: Reserved, must be zero */ + + u64 xfirmware_waking_vector; /* 64-bit physical address of the Firmware Waking Vector. */ + u8 version; /* Version of this table */ + u8 reserved3[31]; /* Reserved, must be zero */ +}; + +/* + * ACPI 2.0+ Generic Address Structure (GAS) + */ +struct acpi_generic_address { + u8 address_space_id; /* Address space where struct or register exists. */ + u8 register_bit_width; /* Size in bits of given register */ + u8 register_bit_offset; /* Bit offset within the register */ + u8 access_width; /* Minimum Access size (ACPI 3.0) */ + u64 address; /* 64-bit address of struct or register */ +}; + +#define FADT_REV2_COMMON \ + u32 V1_firmware_ctrl; /* 32-bit physical address of FACS */ \ + u32 V1_dsdt; /* 32-bit physical address of DSDT */ \ + u8 reserved1; /* System Interrupt Model isn't used in ACPI 2.0*/ \ + u8 prefer_PM_profile; /* Conveys preferred power management profile to OSPM. */ \ + u16 sci_int; /* System vector of SCI interrupt */ \ + u32 smi_cmd; /* Port address of SMI command port */ \ + u8 acpi_enable; /* Value to write to smi_cmd to enable ACPI */ \ + u8 acpi_disable; /* Value to write to smi_cmd to disable ACPI */ \ + u8 S4bios_req; /* Value to write to SMI CMD to enter S4BIOS state */ \ + u8 pstate_cnt; /* Processor performance state control*/ \ + u32 V1_pm1a_evt_blk; /* Port address of Power Mgt 1a acpi_event Reg Blk */ \ + u32 V1_pm1b_evt_blk; /* Port address of Power Mgt 1b acpi_event Reg Blk */ \ + u32 V1_pm1a_cnt_blk; /* Port address of Power Mgt 1a Control Reg Blk */ \ + u32 V1_pm1b_cnt_blk; /* Port address of Power Mgt 1b Control Reg Blk */ \ + u32 V1_pm2_cnt_blk; /* Port address of Power Mgt 2 Control Reg Blk */ \ + u32 V1_pm_tmr_blk; /* Port address of Power Mgt Timer Ctrl Reg Blk */ \ + u32 V1_gpe0_blk; /* Port addr of General Purpose acpi_event 0 Reg Blk */ \ + u32 V1_gpe1_blk; /* Port addr of General Purpose acpi_event 1 Reg Blk */ \ + u8 pm1_evt_len; /* Byte length of ports at pm1_x_evt_blk */ \ + u8 pm1_cnt_len; /* Byte length of ports at pm1_x_cnt_blk */ \ + u8 pm2_cnt_len; /* Byte Length of ports at pm2_cnt_blk */ \ + u8 pm_tm_len; /* Byte Length of ports at pm_tm_blk */ \ + u8 gpe0_blk_len; /* Byte Length of ports at gpe0_blk */ \ + u8 gpe1_blk_len; /* Byte Length of ports at gpe1_blk */ \ + u8 gpe1_base; /* Offset in gpe model where gpe1 events start */ \ + u8 cst_cnt; /* Support for the _CST object and C States change notification.*/ \ + u16 plvl2_lat; /* Worst case HW latency to enter/exit C2 state */ \ + u16 plvl3_lat; /* Worst case HW latency to enter/exit C3 state */ \ + u16 flush_size; /* Number of flush strides that need to be read */ \ + u16 flush_stride; /* Processor's memory cache line width, in bytes */ \ + u8 duty_offset; /* Processor's duty cycle index in processor's P_CNT reg*/ \ + u8 duty_width; /* Processor's duty cycle value bit width in P_CNT register.*/ \ + u8 day_alrm; /* Index to day-of-month alarm in RTC CMOS RAM */ \ + u8 mon_alrm; /* Index to month-of-year alarm in RTC CMOS RAM */ \ + u8 century; /* Index to century in RTC CMOS RAM */ \ + u16 iapc_boot_arch; /* IA-PC Boot Architecture Flags. See Table 5-10 for description*/ + +/* + * ACPI 2.0+ Fixed ACPI Description Table (FADT) + */ +struct fadt_descriptor_rev2 { + ACPI_TABLE_HEADER_DEF /* ACPI common table header */ + FADT_REV2_COMMON u8 reserved2; /* Reserved, must be zero */ + + /* Flags (32 bits) */ + + u8 wb_invd:1; /* 00: The wbinvd instruction works properly */ + u8 wb_invd_flush:1; /* 01: The wbinvd flushes but does not invalidate */ + u8 proc_c1:1; /* 02: All processors support C1 state */ + u8 plvl2_up:1; /* 03: C2 state works on MP system */ + u8 pwr_button:1; /* 04: Power button is handled as a generic feature */ + u8 sleep_button:1; /* 05: Sleep button is handled as a generic feature, or not present */ + u8 fixed_rTC:1; /* 06: RTC wakeup stat not in fixed register space */ + u8 rtcs4:1; /* 07: RTC wakeup stat not possible from S4 */ + u8 tmr_val_ext:1; /* 08: tmr_val is 32 bits 0=24-bits */ + u8 dock_cap:1; /* 09: Docking supported */ + u8 reset_reg_sup:1; /* 10: System reset via the FADT RESET_REG supported */ + u8 sealed_case:1; /* 11: No internal expansion capabilities and case is sealed */ + u8 headless:1; /* 12: No local video capabilities or local input devices */ + u8 cpu_sw_sleep:1; /* 13: Must execute native instruction after writing SLP_TYPx register */ + + u8 pci_exp_wak:1; /* 14: System supports PCIEXP_WAKE (STS/EN) bits (ACPI 3.0) */ + u8 use_platform_clock:1; /* 15: OSPM should use platform-provided timer (ACPI 3.0) */ + u8 S4rtc_sts_valid:1; /* 16: Contents of RTC_STS valid after S4 wake (ACPI 3.0) */ + u8 remote_power_on_capable:1; /* 17: System is compatible with remote power on (ACPI 3.0) */ + u8 force_apic_cluster_model:1; /* 18: All local APICs must use cluster model (ACPI 3.0) */ + u8 force_apic_physical_destination_mode:1; /* 19: all local x_aPICs must use physical dest mode (ACPI 3.0) */ + u8:4; /* 20-23: Reserved, must be zero */ + u8 reserved3; /* 24-31: Reserved, must be zero */ + + struct acpi_generic_address reset_register; /* Reset register address in GAS format */ + u8 reset_value; /* Value to write to the reset_register port to reset the system */ + u8 reserved4[3]; /* These three bytes must be zero */ + u64 xfirmware_ctrl; /* 64-bit physical address of FACS */ + u64 Xdsdt; /* 64-bit physical address of DSDT */ + struct acpi_generic_address xpm1a_evt_blk; /* Extended Power Mgt 1a acpi_event Reg Blk address */ + struct acpi_generic_address xpm1b_evt_blk; /* Extended Power Mgt 1b acpi_event Reg Blk address */ + struct acpi_generic_address xpm1a_cnt_blk; /* Extended Power Mgt 1a Control Reg Blk address */ + struct acpi_generic_address xpm1b_cnt_blk; /* Extended Power Mgt 1b Control Reg Blk address */ + struct acpi_generic_address xpm2_cnt_blk; /* Extended Power Mgt 2 Control Reg Blk address */ + struct acpi_generic_address xpm_tmr_blk; /* Extended Power Mgt Timer Ctrl Reg Blk address */ + struct acpi_generic_address xgpe0_blk; /* Extended General Purpose acpi_event 0 Reg Blk address */ + struct acpi_generic_address xgpe1_blk; /* Extended General Purpose acpi_event 1 Reg Blk address */ +}; + +/* "Down-revved" ACPI 2.0 FADT descriptor */ + +struct fadt_descriptor_rev2_minus { + ACPI_TABLE_HEADER_DEF /* ACPI common table header */ + FADT_REV2_COMMON u8 reserved2; /* Reserved, must be zero */ + u32 flags; + struct acpi_generic_address reset_register; /* Reset register address in GAS format */ + u8 reset_value; /* Value to write to the reset_register port to reset the system. */ + u8 reserved7[3]; /* Reserved, must be zero */ +}; + +/* ECDT - Embedded Controller Boot Resources Table */ + +struct ec_boot_resources { + ACPI_TABLE_HEADER_DEF struct acpi_generic_address ec_control; /* Address of EC command/status register */ + struct acpi_generic_address ec_data; /* Address of EC data register */ + u32 uid; /* Unique ID - must be same as the EC _UID method */ + u8 gpe_bit; /* The GPE for the EC */ + u8 ec_id[1]; /* Full namepath of the EC in the ACPI namespace */ +}; + +/* SRAT - System Resource Affinity Table */ + +struct static_resource_alloc { + u8 type; + u8 length; + u8 proximity_domain_lo; + u8 apic_id; + + /* Flags (32 bits) */ + + u8 enabled:1; /* 00: Use affinity structure */ + u8:7; /* 01-07: Reserved, must be zero */ + u8 reserved3[3]; /* 08-31: Reserved, must be zero */ + + u8 local_sapic_eid; + u8 proximity_domain_hi[3]; + u32 reserved4; /* Reserved, must be zero */ +}; + +struct memory_affinity { + u8 type; + u8 length; + u32 proximity_domain; + u16 reserved3; + u64 base_address; + u64 address_length; + u32 reserved4; + + /* Flags (32 bits) */ + + u8 enabled:1; /* 00: Use affinity structure */ + u8 hot_pluggable:1; /* 01: Memory region is hot pluggable */ + u8 non_volatile:1; /* 02: Memory is non-volatile */ + u8:5; /* 03-07: Reserved, must be zero */ + u8 reserved5[3]; /* 08-31: Reserved, must be zero */ + + u64 reserved6; /* Reserved, must be zero */ +}; + +struct system_resource_affinity { + ACPI_TABLE_HEADER_DEF u32 reserved1; /* Must be value '1' */ + u64 reserved2; /* Reserved, must be zero */ +}; + +/* SLIT - System Locality Distance Information Table */ + +struct system_locality_info { + ACPI_TABLE_HEADER_DEF u64 locality_count; + u8 entry[1][1]; +}; + +#pragma pack() #endif /* __ACTBL2_H__ */ diff --git a/trunk/include/acpi/actypes.h b/trunk/include/acpi/actypes.h index 77cf1236b05a..7ca89cde706e 100644 --- a/trunk/include/acpi/actypes.h +++ b/trunk/include/acpi/actypes.h @@ -44,8 +44,6 @@ #ifndef __ACTYPES_H__ #define __ACTYPES_H__ -/* acpisrc:struct_defs -- for acpisrc conversion */ - /* * ACPI_MACHINE_WIDTH must be specified in an OS- or compiler-dependent header * and must be either 16, 32, or 64 @@ -156,6 +154,7 @@ typedef u64 acpi_physical_address; #define ACPI_MAX_PTR ACPI_UINT64_MAX #define ACPI_SIZE_MAX ACPI_UINT64_MAX +#define ALIGNED_ADDRESS_BOUNDARY 0x00000008 #define ACPI_USE_NATIVE_DIVIDE /* Has native 64-bit integer support */ /* @@ -196,6 +195,8 @@ typedef u64 acpi_physical_address; #define ACPI_MAX_PTR ACPI_UINT32_MAX #define ACPI_SIZE_MAX ACPI_UINT32_MAX +#define ALIGNED_ADDRESS_BOUNDARY 0x00000004 + /******************************************************************************* * * Types specific to 16-bit targets @@ -222,6 +223,7 @@ typedef char *acpi_physical_address; #define ACPI_MAX_PTR ACPI_UINT16_MAX #define ACPI_SIZE_MAX ACPI_UINT16_MAX +#define ALIGNED_ADDRESS_BOUNDARY 0x00000002 #define ACPI_USE_NATIVE_DIVIDE /* No 64-bit integers, ok to use native divide */ /* 64-bit integers cannot be supported */ @@ -252,7 +254,7 @@ typedef acpi_native_uint acpi_size; /* Use C99 uintptr_t for pointer casting if available, "void *" otherwise */ #ifndef acpi_uintptr_t -#define acpi_uintptr_t void * +#define acpi_uintptr_t void * #endif /* @@ -261,7 +263,7 @@ typedef acpi_native_uint acpi_size; * manager implementation is to be used (ACPI_USE_LOCAL_CACHE) */ #ifndef acpi_cache_t -#define acpi_cache_t struct acpi_memory_list +#define acpi_cache_t struct acpi_memory_list #endif /* @@ -269,7 +271,7 @@ typedef acpi_native_uint acpi_size; * lock and unlock OSL interfaces. */ #ifndef acpi_cpu_flags -#define acpi_cpu_flags acpi_native_uint +#define acpi_cpu_flags acpi_native_uint #endif /* @@ -290,21 +292,6 @@ typedef acpi_native_uint acpi_size; #define ACPI_UNUSED_VAR #endif -/* - * All ACPICA functions that are available to the rest of the kernel are - * tagged with this macro which can be defined as appropriate for the host. - */ -#ifndef ACPI_EXPORT_SYMBOL -#define ACPI_EXPORT_SYMBOL(symbol) -#endif - -/* - * thread_id is returned by acpi_os_get_thread_id. - */ -#ifndef acpi_thread_id -#define acpi_thread_id acpi_native_uint -#endif - /******************************************************************************* * * Independent types @@ -490,15 +477,15 @@ typedef u64 acpi_integer; */ typedef u32 acpi_table_type; -#define ACPI_TABLE_ID_RSDP (acpi_table_type) 0 -#define ACPI_TABLE_ID_DSDT (acpi_table_type) 1 -#define ACPI_TABLE_ID_FADT (acpi_table_type) 2 -#define ACPI_TABLE_ID_FACS (acpi_table_type) 3 -#define ACPI_TABLE_ID_PSDT (acpi_table_type) 4 -#define ACPI_TABLE_ID_SSDT (acpi_table_type) 5 -#define ACPI_TABLE_ID_XSDT (acpi_table_type) 6 -#define ACPI_TABLE_ID_MAX 6 -#define ACPI_NUM_TABLE_TYPES (ACPI_TABLE_ID_MAX+1) +#define ACPI_TABLE_RSDP (acpi_table_type) 0 +#define ACPI_TABLE_DSDT (acpi_table_type) 1 +#define ACPI_TABLE_FADT (acpi_table_type) 2 +#define ACPI_TABLE_FACS (acpi_table_type) 3 +#define ACPI_TABLE_PSDT (acpi_table_type) 4 +#define ACPI_TABLE_SSDT (acpi_table_type) 5 +#define ACPI_TABLE_XSDT (acpi_table_type) 6 +#define ACPI_TABLE_MAX 6 +#define NUM_ACPI_TABLE_TYPES (ACPI_TABLE_MAX+1) /* * Types associated with ACPI names and objects. The first group of @@ -829,7 +816,7 @@ struct acpi_system_info { u32 debug_level; u32 debug_layer; u32 num_table_types; - struct acpi_table_info table_info[ACPI_TABLE_ID_MAX + 1]; + struct acpi_table_info table_info[NUM_ACPI_TABLE_TYPES]; }; /* @@ -871,7 +858,7 @@ acpi_status(*acpi_adr_space_handler) (u32 function, void *handler_context, void *region_context); -#define ACPI_DEFAULT_HANDLER NULL +#define ACPI_DEFAULT_HANDLER NULL typedef acpi_status(*acpi_adr_space_setup) (acpi_handle region_handle, @@ -924,13 +911,12 @@ struct acpi_compatible_id_list { #define ACPI_STA_DEVICE_PRESENT 0x01 #define ACPI_STA_DEVICE_ENABLED 0x02 #define ACPI_STA_DEVICE_UI 0x04 -#define ACPI_STA_DEVICE_FUNCTIONING 0x08 -#define ACPI_STA_DEVICE_OK 0x08 /* Synonym */ +#define ACPI_STA_DEVICE_OK 0x08 #define ACPI_STA_BATTERY_PRESENT 0x10 #define ACPI_COMMON_OBJ_INFO \ - acpi_object_type type; /* ACPI object type */ \ - acpi_name name /* ACPI object Name */ + acpi_object_type type; /* ACPI object type */ \ + acpi_name name /* ACPI object Name */ struct acpi_obj_info_header { ACPI_COMMON_OBJ_INFO; @@ -971,7 +957,7 @@ struct acpi_mem_space_context { * Definitions for Resource Attributes */ typedef u16 acpi_rs_length; /* Resource Length field is fixed at 16 bits */ -typedef u32 acpi_rsdesc_size; /* Max Resource Descriptor size is (Length+3) = (64_k-1)+3 */ +typedef u32 acpi_rsdesc_size; /* Max Resource Descriptor size is (length+3) = (64_k-1)+3 */ /* * Memory Attributes @@ -986,8 +972,8 @@ typedef u32 acpi_rsdesc_size; /* Max Resource Descriptor size is (Length+3) = (6 /* * IO Attributes - * The ISA IO ranges are: n000-n0_fFh, n400-n4_fFh, n800-n8_fFh, n_c00-n_cFFh. - * The non-ISA IO ranges are: n100-n3_fFh, n500-n7_fFh, n900-n_bFFh, n_cd0-n_fFFh. + * The ISA Io ranges are: n000-n0_ffh, n400-n4_ffh, n800-n8_ffh, n_c00-n_cFFh. + * The non-ISA Io ranges are: n100-n3_ffh, n500-n7_ffh, n900-n_bFfh, n_cd0-n_fFFh. */ #define ACPI_NON_ISA_ONLY_RANGES (u8) 0x01 #define ACPI_ISA_ONLY_RANGES (u8) 0x02 @@ -1185,12 +1171,12 @@ struct acpi_resource_source { /* Fields common to all address descriptors, 16/32/64 bit */ #define ACPI_RESOURCE_ADDRESS_COMMON \ - u8 resource_type; \ - u8 producer_consumer; \ - u8 decode; \ - u8 min_address_fixed; \ - u8 max_address_fixed; \ - union acpi_resource_attribute info; + u8 resource_type; \ + u8 producer_consumer; \ + u8 decode; \ + u8 min_address_fixed; \ + u8 max_address_fixed; \ + union acpi_resource_attribute info; struct acpi_resource_address { ACPI_RESOURCE_ADDRESS_COMMON}; @@ -1311,6 +1297,16 @@ struct acpi_resource { #define ACPI_NEXT_RESOURCE(res) (struct acpi_resource *)((u8 *) res + res->length) +#ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED +#define ACPI_ALIGN_RESOURCE_SIZE(length) (length) +#else +#define ACPI_ALIGN_RESOURCE_SIZE(length) ACPI_ROUND_UP_TO_NATIVE_WORD(length) +#endif + +/* + * END: of definitions for Resource Attributes + */ + struct acpi_pci_routing_table { u32 length; u32 pin; @@ -1319,4 +1315,8 @@ struct acpi_pci_routing_table { char source[4]; /* pad to 64 bits so sizeof() works in all cases */ }; +/* + * END: of definitions for PCI Routing tables + */ + #endif /* __ACTYPES_H__ */ diff --git a/trunk/include/acpi/acutils.h b/trunk/include/acpi/acutils.h index ba039ea1a057..0927765df6aa 100644 --- a/trunk/include/acpi/acutils.h +++ b/trunk/include/acpi/acutils.h @@ -50,24 +50,24 @@ extern const u8 acpi_gbl_resource_aml_sizes[]; #if defined(ACPI_DISASSEMBLER) || defined (ACPI_DEBUGGER) -extern const char *acpi_gbl_bm_decode[]; -extern const char *acpi_gbl_config_decode[]; -extern const char *acpi_gbl_consume_decode[]; -extern const char *acpi_gbl_dec_decode[]; -extern const char *acpi_gbl_he_decode[]; -extern const char *acpi_gbl_io_decode[]; -extern const char *acpi_gbl_ll_decode[]; -extern const char *acpi_gbl_max_decode[]; -extern const char *acpi_gbl_mem_decode[]; -extern const char *acpi_gbl_min_decode[]; -extern const char *acpi_gbl_mtp_decode[]; -extern const char *acpi_gbl_rng_decode[]; -extern const char *acpi_gbl_rw_decode[]; -extern const char *acpi_gbl_shr_decode[]; -extern const char *acpi_gbl_siz_decode[]; -extern const char *acpi_gbl_trs_decode[]; -extern const char *acpi_gbl_ttp_decode[]; -extern const char *acpi_gbl_typ_decode[]; +extern const char *acpi_gbl_BMdecode[2]; +extern const char *acpi_gbl_config_decode[4]; +extern const char *acpi_gbl_consume_decode[2]; +extern const char *acpi_gbl_DECdecode[2]; +extern const char *acpi_gbl_HEdecode[2]; +extern const char *acpi_gbl_io_decode[2]; +extern const char *acpi_gbl_LLdecode[2]; +extern const char *acpi_gbl_max_decode[2]; +extern const char *acpi_gbl_MEMdecode[4]; +extern const char *acpi_gbl_min_decode[2]; +extern const char *acpi_gbl_MTPdecode[4]; +extern const char *acpi_gbl_RNGdecode[4]; +extern const char *acpi_gbl_RWdecode[2]; +extern const char *acpi_gbl_SHRdecode[2]; +extern const char *acpi_gbl_SIZdecode[4]; +extern const char *acpi_gbl_TRSdecode[2]; +extern const char *acpi_gbl_TTPdecode[2]; +extern const char *acpi_gbl_TYPdecode[4]; #endif /* Types for Resource descriptor entries */ @@ -77,12 +77,6 @@ extern const char *acpi_gbl_typ_decode[]; #define ACPI_VARIABLE_LENGTH 2 #define ACPI_SMALL_VARIABLE_LENGTH 3 -typedef -acpi_status(*acpi_walk_aml_callback) (u8 * aml, - u32 length, - u32 offset, - u8 resource_index, void **context); - typedef acpi_status(*acpi_pkg_callback) (u8 object_type, union acpi_operand_object * source_object, @@ -283,8 +277,6 @@ acpi_ut_ptr_exit(u32 line_number, void acpi_ut_dump_buffer(u8 * buffer, u32 count, u32 display, u32 component_id); -void acpi_ut_dump_buffer2(u8 * buffer, u32 count, u32 display); - void acpi_ut_report_error(char *module_name, u32 line_number); void acpi_ut_report_info(char *module_name, u32 line_number); @@ -453,8 +445,6 @@ acpi_ut_short_divide(acpi_integer in_dividend, /* * utmisc */ -u8 acpi_ut_is_aml_table(struct acpi_table_header *table); - acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id); void acpi_ut_release_owner_id(acpi_owner_id * owner_id); @@ -470,9 +460,7 @@ void acpi_ut_print_string(char *string, u8 max_length); u8 acpi_ut_valid_acpi_name(u32 name); -acpi_name acpi_ut_repair_name(acpi_name name); - -u8 acpi_ut_valid_acpi_char(char character, acpi_native_uint position); +u8 acpi_ut_valid_acpi_character(char character); acpi_status acpi_ut_strtoul64(char *string, u32 base, acpi_integer * ret_integer); @@ -481,25 +469,6 @@ acpi_ut_strtoul64(char *string, u32 base, acpi_integer * ret_integer); #define ACPI_ANY_BASE 0 -u32 acpi_ut_dword_byte_swap(u32 value); - -void acpi_ut_set_integer_width(u8 revision); - -#ifdef ACPI_DEBUG_OUTPUT -void -acpi_ut_display_init_pathname(u8 type, - struct acpi_namespace_node *obj_handle, - char *path); -#endif - -/* - * utresrc - */ -acpi_status -acpi_ut_walk_aml_resources(u8 * aml, - acpi_size aml_length, - acpi_walk_aml_callback user_function, void **context); - acpi_status acpi_ut_validate_resource(void *aml, u8 * return_index); u32 acpi_ut_get_descriptor_length(void *aml); @@ -514,6 +483,20 @@ acpi_status acpi_ut_get_resource_end_tag(union acpi_operand_object *obj_desc, u8 ** end_tag); +u8 acpi_ut_generate_checksum(u8 * buffer, u32 length); + +u32 acpi_ut_dword_byte_swap(u32 value); + +void acpi_ut_set_integer_width(u8 revision); + +#ifdef ACPI_DEBUG_OUTPUT +void +acpi_ut_display_init_pathname(u8 type, + struct acpi_namespace_node *obj_handle, + char *path); + +#endif + /* * utmutex - mutex support */ @@ -540,15 +523,14 @@ acpi_ut_initialize_buffer(struct acpi_buffer *buffer, void *acpi_ut_allocate(acpi_size size, u32 component, char *module, u32 line); -void *acpi_ut_allocate_zeroed(acpi_size size, - u32 component, char *module, u32 line); +void *acpi_ut_callocate(acpi_size size, u32 component, char *module, u32 line); #ifdef ACPI_DBG_TRACK_ALLOCATIONS void *acpi_ut_allocate_and_track(acpi_size size, u32 component, char *module, u32 line); -void *acpi_ut_allocate_zeroed_and_track(acpi_size size, - u32 component, char *module, u32 line); +void *acpi_ut_callocate_and_track(acpi_size size, + u32 component, char *module, u32 line); void acpi_ut_free_and_track(void *address, u32 component, char *module, u32 line); @@ -558,11 +540,6 @@ void acpi_ut_dump_allocation_info(void); #endif /* ACPI_FUTURE_USAGE */ void acpi_ut_dump_allocations(u32 component, char *module); - -acpi_status -acpi_ut_create_list(char *list_name, - u16 object_size, struct acpi_memory_list **return_cache); - #endif #endif /* _ACUTILS_H */ diff --git a/trunk/include/acpi/amlcode.h b/trunk/include/acpi/amlcode.h index cf18426a87b1..37964a59aef8 100644 --- a/trunk/include/acpi/amlcode.h +++ b/trunk/include/acpi/amlcode.h @@ -180,10 +180,8 @@ #define AML_BANK_FIELD_OP (u16) 0x5b87 #define AML_DATA_REGION_OP (u16) 0x5b88 /* ACPI 2.0 */ -/* - * Combination opcodes (actually two one-byte opcodes) - * Used by the disassembler and i_aSL compiler - */ +/* Bogus opcodes (they are actually two separate opcodes) */ + #define AML_LGREATEREQUAL_OP (u16) 0x9295 #define AML_LLESSEQUAL_OP (u16) 0x9294 #define AML_LNOTEQUAL_OP (u16) 0x9293 diff --git a/trunk/include/acpi/amlresrc.h b/trunk/include/acpi/amlresrc.h index be03818af9d1..fb4735315ad3 100644 --- a/trunk/include/acpi/amlresrc.h +++ b/trunk/include/acpi/amlresrc.h @@ -42,45 +42,39 @@ * POSSIBILITY OF SUCH DAMAGES. */ -/* acpisrc:struct_defs -- for acpisrc conversion */ - #ifndef __AMLRESRC_H #define __AMLRESRC_H -/* - * Resource descriptor tags, as defined in the ACPI specification. - * Used to symbolically reference fields within a descriptor. - */ -#define ACPI_RESTAG_ADDRESS "_ADR" -#define ACPI_RESTAG_ALIGNMENT "_ALN" -#define ACPI_RESTAG_ADDRESSSPACE "_ASI" -#define ACPI_RESTAG_ACCESSSIZE "_ASZ" -#define ACPI_RESTAG_TYPESPECIFICATTRIBUTES "_ATT" -#define ACPI_RESTAG_BASEADDRESS "_BAS" -#define ACPI_RESTAG_BUSMASTER "_BM_" /* Master(1), Slave(0) */ -#define ACPI_RESTAG_DECODE "_DEC" -#define ACPI_RESTAG_DMA "_DMA" -#define ACPI_RESTAG_DMATYPE "_TYP" /* Compatible(0), A(1), B(2), F(3) */ -#define ACPI_RESTAG_GRANULARITY "_GRA" -#define ACPI_RESTAG_INTERRUPT "_INT" -#define ACPI_RESTAG_INTERRUPTLEVEL "_LL_" /* active_lo(1), active_hi(0) */ -#define ACPI_RESTAG_INTERRUPTSHARE "_SHR" /* Shareable(1), no_share(0) */ -#define ACPI_RESTAG_INTERRUPTTYPE "_HE_" /* Edge(1), Level(0) */ -#define ACPI_RESTAG_LENGTH "_LEN" -#define ACPI_RESTAG_MEMATTRIBUTES "_MTP" /* Memory(0), Reserved(1), ACPI(2), NVS(3) */ -#define ACPI_RESTAG_MEMTYPE "_MEM" /* non_cache(0), Cacheable(1) Cache+combine(2), Cache+prefetch(3) */ -#define ACPI_RESTAG_MAXADDR "_MAX" -#define ACPI_RESTAG_MINADDR "_MIN" -#define ACPI_RESTAG_MAXTYPE "_MAF" -#define ACPI_RESTAG_MINTYPE "_MIF" -#define ACPI_RESTAG_REGISTERBITOFFSET "_RBO" -#define ACPI_RESTAG_REGISTERBITWIDTH "_RBW" -#define ACPI_RESTAG_RANGETYPE "_RNG" -#define ACPI_RESTAG_READWRITETYPE "_RW_" /* read_only(0), Writeable (1) */ -#define ACPI_RESTAG_TRANSLATION "_TRA" -#define ACPI_RESTAG_TRANSTYPE "_TRS" /* Sparse(1), Dense(0) */ -#define ACPI_RESTAG_TYPE "_TTP" /* Translation(1), Static (0) */ -#define ACPI_RESTAG_XFERTYPE "_SIZ" /* 8(0), 8_and16(1), 16(2) */ +#define ASL_RESNAME_ADDRESS "_ADR" +#define ASL_RESNAME_ALIGNMENT "_ALN" +#define ASL_RESNAME_ADDRESSSPACE "_ASI" +#define ASL_RESNAME_ACCESSSIZE "_ASZ" +#define ASL_RESNAME_TYPESPECIFICATTRIBUTES "_ATT" +#define ASL_RESNAME_BASEADDRESS "_BAS" +#define ASL_RESNAME_BUSMASTER "_BM_" /* Master(1), Slave(0) */ +#define ASL_RESNAME_DECODE "_DEC" +#define ASL_RESNAME_DMA "_DMA" +#define ASL_RESNAME_DMATYPE "_TYP" /* Compatible(0), A(1), B(2), F(3) */ +#define ASL_RESNAME_GRANULARITY "_GRA" +#define ASL_RESNAME_INTERRUPT "_INT" +#define ASL_RESNAME_INTERRUPTLEVEL "_LL_" /* active_lo(1), active_hi(0) */ +#define ASL_RESNAME_INTERRUPTSHARE "_SHR" /* Shareable(1), no_share(0) */ +#define ASL_RESNAME_INTERRUPTTYPE "_HE_" /* Edge(1), Level(0) */ +#define ASL_RESNAME_LENGTH "_LEN" +#define ASL_RESNAME_MEMATTRIBUTES "_MTP" /* Memory(0), Reserved(1), ACPI(2), NVS(3) */ +#define ASL_RESNAME_MEMTYPE "_MEM" /* non_cache(0), Cacheable(1) Cache+combine(2), Cache+prefetch(3) */ +#define ASL_RESNAME_MAXADDR "_MAX" +#define ASL_RESNAME_MINADDR "_MIN" +#define ASL_RESNAME_MAXTYPE "_MAF" +#define ASL_RESNAME_MINTYPE "_MIF" +#define ASL_RESNAME_REGISTERBITOFFSET "_RBO" +#define ASL_RESNAME_REGISTERBITWIDTH "_RBW" +#define ASL_RESNAME_RANGETYPE "_RNG" +#define ASL_RESNAME_READWRITETYPE "_RW_" /* read_only(0), Writeable (1) */ +#define ASL_RESNAME_TRANSLATION "_TRA" +#define ASL_RESNAME_TRANSTYPE "_TRS" /* Sparse(1), Dense(0) */ +#define ASL_RESNAME_TYPE "_TTP" /* Translation(1), Static (0) */ +#define ASL_RESNAME_XFERTYPE "_SIz" /* 8(0), 8_and16(1), 16(2) */ /* Default sizes for "small" resource descriptors */ @@ -115,7 +109,7 @@ struct asl_resource_node { * SMALL descriptors */ #define AML_RESOURCE_SMALL_HEADER_COMMON \ - u8 descriptor_type; + u8 descriptor_type; struct aml_resource_small_header { AML_RESOURCE_SMALL_HEADER_COMMON}; @@ -168,8 +162,8 @@ struct aml_resource_end_tag { * LARGE descriptors */ #define AML_RESOURCE_LARGE_HEADER_COMMON \ - u8 descriptor_type;\ - u16 resource_length; + u8 descriptor_type;\ + u16 resource_length; struct aml_resource_large_header { AML_RESOURCE_LARGE_HEADER_COMMON}; @@ -200,9 +194,9 @@ struct aml_resource_fixed_memory32 { }; #define AML_RESOURCE_ADDRESS_COMMON \ - u8 resource_type; \ - u8 flags; \ - u8 specific_flags; + u8 resource_type; \ + u8 flags; \ + u8 specific_flags; struct aml_resource_address { AML_RESOURCE_LARGE_HEADER_COMMON AML_RESOURCE_ADDRESS_COMMON}; @@ -272,7 +266,6 @@ struct aml_resource_generic_register { union aml_resource { /* Descriptor headers */ - u8 descriptor_type; struct aml_resource_small_header small_header; struct aml_resource_large_header large_header; @@ -303,9 +296,9 @@ union aml_resource { /* Utility overlays */ struct aml_resource_address address; - u32 dword_item; - u16 word_item; - u8 byte_item; + u32 u32_item; + u16 u16_item; + u8 U8item; }; #endif diff --git a/trunk/include/acpi/platform/acenv.h b/trunk/include/acpi/platform/acenv.h index 453a469fd397..223ec6467108 100644 --- a/trunk/include/acpi/platform/acenv.h +++ b/trunk/include/acpi/platform/acenv.h @@ -49,41 +49,33 @@ */ #ifdef ACPI_LIBRARY -/* - * Note: The non-debug version of the acpi_library does not contain any - * debug support, for minimimal size. The debug version uses ACPI_FULL_DEBUG - */ #define ACPI_USE_LOCAL_CACHE #endif -#ifdef ACPI_ASL_COMPILER +#ifdef ACPI_DUMP_APP +#ifndef MSDOS #define ACPI_DEBUG_OUTPUT +#endif #define ACPI_APPLICATION #define ACPI_DISASSEMBLER -#define ACPI_CONSTANT_EVAL_ONLY -#define ACPI_LARGE_NAMESPACE_NODE -#define ACPI_DATA_TABLE_DISASSEMBLY +#define ACPI_NO_METHOD_EXECUTION #endif #ifdef ACPI_EXEC_APP #undef DEBUGGER_THREADING #define DEBUGGER_THREADING DEBUGGER_SINGLE_THREADED -#define ACPI_FULL_DEBUG +#define ACPI_DEBUG_OUTPUT #define ACPI_APPLICATION #define ACPI_DEBUGGER +#define ACPI_DISASSEMBLER #define ACPI_MUTEX_DEBUG -#define ACPI_DBG_TRACK_ALLOCATIONS #endif -#ifdef ACPI_DASM_APP -#ifndef MSDOS +#ifdef ACPI_ASL_COMPILER #define ACPI_DEBUG_OUTPUT -#endif #define ACPI_APPLICATION #define ACPI_DISASSEMBLER -#define ACPI_NO_METHOD_EXECUTION -#define ACPI_LARGE_NAMESPACE_NODE -#define ACPI_DATA_TABLE_DISASSEMBLY +#define ACPI_CONSTANT_EVAL_ONLY #endif #ifdef ACPI_APPLICATION @@ -91,12 +83,6 @@ #define ACPI_USE_LOCAL_CACHE #endif -#ifdef ACPI_FULL_DEBUG -#define ACPI_DEBUGGER -#define ACPI_DEBUG_OUTPUT -#define ACPI_DISASSEMBLER -#endif - /* * Environment configuration. The purpose of this file is to interface to the * local generation environment. @@ -151,7 +137,7 @@ #elif defined(MSDOS) /* Must appear after WIN32 and WIN64 check */ #include "acdos16.h" -#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) +#elif defined(__FreeBSD__) #include "acfreebsd.h" #elif defined(__NetBSD__) @@ -177,6 +163,17 @@ #endif +/* + * Memory allocation tracking. Used only if + * 1) This is the debug version + * 2) This is NOT a 16-bit version of the code (not enough real-mode memory) + */ +#ifdef ACPI_DEBUG_OUTPUT +#if ACPI_MACHINE_WIDTH != 16 +#define ACPI_DBG_TRACK_ALLOCATIONS +#endif +#endif + /*! [End] no source code translation !*/ /* @@ -274,8 +271,8 @@ typedef char *va_list; /* * Storage alignment properties */ -#define _AUPBND (sizeof (acpi_native_int) - 1) -#define _ADNBND (sizeof (acpi_native_int) - 1) +#define _AUPBND (sizeof (acpi_native_uint) - 1) +#define _ADNBND (sizeof (acpi_native_uint) - 1) /* * Variable argument list macro definitions diff --git a/trunk/include/acpi/platform/aclinux.h b/trunk/include/acpi/platform/aclinux.h index b5655a665ba8..2e6d54569ee8 100644 --- a/trunk/include/acpi/platform/aclinux.h +++ b/trunk/include/acpi/platform/aclinux.h @@ -52,22 +52,27 @@ #include #include #include -#include #include #include #include #include #include -#include -/* Host-dependent types and defines */ +#define strtoul simple_strtoul + +#define ACPI_MACHINE_WIDTH BITS_PER_LONG -#define ACPI_MACHINE_WIDTH BITS_PER_LONG -#define acpi_cache_t kmem_cache_t -#define ACPI_EXPORT_SYMBOL(symbol) EXPORT_SYMBOL(symbol); -#define strtoul simple_strtoul +/* Type(s) for the OSL */ + +#ifdef ACPI_USE_LOCAL_CACHE +#define acpi_cache_t struct acpi_memory_list +#else +#include +#define acpi_cache_t kmem_cache_t +#endif /* Full namespace pathname length limit - arbitrary */ + #define ACPI_PATHNAME_MAX 256 #else /* !__KERNEL__ */ @@ -99,8 +104,4 @@ #define acpi_cpu_flags unsigned long -#define acpi_thread_id u32 - -static inline acpi_thread_id acpi_os_get_thread_id(void) { return 0; } - #endif /* __ACLINUX_H__ */ diff --git a/trunk/include/asm-alpha/smp.h b/trunk/include/asm-alpha/smp.h index e1432102be05..9950706abdf8 100644 --- a/trunk/include/asm-alpha/smp.h +++ b/trunk/include/asm-alpha/smp.h @@ -45,8 +45,10 @@ extern struct cpuinfo_alpha cpu_data[NR_CPUS]; #define hard_smp_processor_id() __hard_smp_processor_id() #define raw_smp_processor_id() (current_thread_info()->cpu) +extern cpumask_t cpu_present_mask; +extern cpumask_t cpu_online_map; extern int smp_num_cpus; -#define cpu_possible_map cpu_present_map +#define cpu_possible_map cpu_present_mask int smp_call_function_on_cpu(void (*func) (void *info), void *info,int retry, int wait, cpumask_t cpu); diff --git a/trunk/include/asm-arm/arch-ixp23xx/memory.h b/trunk/include/asm-arm/arch-ixp23xx/memory.h index c85fc06a043c..6e19f46d54d1 100644 --- a/trunk/include/asm-arm/arch-ixp23xx/memory.h +++ b/trunk/include/asm-arm/arch-ixp23xx/memory.h @@ -49,7 +49,7 @@ static inline int __ixp23xx_arch_is_coherent(void) { extern unsigned int processor_id; - if (((processor_id & 15) >= 4) || machine_is_roadrunner()) + if (((processor_id & 15) >= 2) || machine_is_roadrunner()) return 1; return 0; diff --git a/trunk/include/asm-arm/arch-l7200/serial_l7200.h b/trunk/include/asm-arm/arch-l7200/serial_l7200.h index b1008a9d23e5..238c595d97ea 100644 --- a/trunk/include/asm-arm/arch-l7200/serial_l7200.h +++ b/trunk/include/asm-arm/arch-l7200/serial_l7200.h @@ -28,7 +28,7 @@ #define UARTDR 0x00 /* Tx/Rx data */ #define RXSTAT 0x04 /* Rx status */ #define H_UBRLCR 0x08 /* mode register high */ -#define M_UBRLCR 0x0C /* mode reg mid (MSB of baud)*/ +#define M_UBRLCR 0x0C /* mode reg mid (MSB of buad)*/ #define L_UBRLCR 0x10 /* mode reg low (LSB of baud)*/ #define UARTCON 0x14 /* control register */ #define UARTFLG 0x18 /* flag register */ diff --git a/trunk/include/asm-arm/arch-l7200/uncompress.h b/trunk/include/asm-arm/arch-l7200/uncompress.h index 04be2a088639..9fcd40aee3e3 100644 --- a/trunk/include/asm-arm/arch-l7200/uncompress.h +++ b/trunk/include/asm-arm/arch-l7200/uncompress.h @@ -6,7 +6,7 @@ * Changelog: * 05-01-2000 SJH Created * 05-13-2000 SJH Filled in function bodies - * 07-26-2000 SJH Removed hard coded baud rate + * 07-26-2000 SJH Removed hard coded buad rate */ #include diff --git a/trunk/include/asm-arm/arch-pxa/ohci.h b/trunk/include/asm-arm/arch-pxa/ohci.h index e848a47128cd..7da89569061e 100644 --- a/trunk/include/asm-arm/arch-pxa/ohci.h +++ b/trunk/include/asm-arm/arch-pxa/ohci.h @@ -11,8 +11,6 @@ struct pxaohci_platform_data { #define PMM_NPS_MODE 1 #define PMM_GLOBAL_MODE 2 #define PMM_PERPORT_MODE 3 - - int power_budget; }; extern void pxa_set_ohci_info(struct pxaohci_platform_data *info); diff --git a/trunk/include/asm-generic/pgtable.h b/trunk/include/asm-generic/pgtable.h index c2059a3a0621..358e4d309ceb 100644 --- a/trunk/include/asm-generic/pgtable.h +++ b/trunk/include/asm-generic/pgtable.h @@ -159,8 +159,17 @@ static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addres #define lazy_mmu_prot_update(pte) do { } while (0) #endif -#ifndef __HAVE_ARCH_MOVE_PTE +#ifndef __HAVE_ARCH_MULTIPLE_ZERO_PAGE #define move_pte(pte, prot, old_addr, new_addr) (pte) +#else +#define move_pte(pte, prot, old_addr, new_addr) \ +({ \ + pte_t newpte = (pte); \ + if (pte_present(pte) && pfn_valid(pte_pfn(pte)) && \ + pte_page(pte) == ZERO_PAGE(old_addr)) \ + newpte = mk_pte(ZERO_PAGE(new_addr), (prot)); \ + newpte; \ +}) #endif /* diff --git a/trunk/include/asm-i386/apicdef.h b/trunk/include/asm-i386/apicdef.h index 9f6995341fdc..5e4a35af2921 100644 --- a/trunk/include/asm-i386/apicdef.h +++ b/trunk/include/asm-i386/apicdef.h @@ -121,6 +121,7 @@ */ #define u32 unsigned int +#define lapic ((volatile struct local_apic *)APIC_BASE) struct local_apic { diff --git a/trunk/include/asm-mips/addrspace.h b/trunk/include/asm-mips/addrspace.h index 1386af1cb7d9..42520cc84b0f 100644 --- a/trunk/include/asm-mips/addrspace.h +++ b/trunk/include/asm-mips/addrspace.h @@ -129,7 +129,6 @@ #if defined (CONFIG_CPU_R4300) \ || defined (CONFIG_CPU_R4X00) \ || defined (CONFIG_CPU_R5000) \ - || defined (CONFIG_CPU_RM7000) \ || defined (CONFIG_CPU_NEVADA) \ || defined (CONFIG_CPU_TX49XX) \ || defined (CONFIG_CPU_MIPS64) diff --git a/trunk/include/asm-mips/delay.h b/trunk/include/asm-mips/delay.h index 928f30f8c45c..64dd45150f64 100644 --- a/trunk/include/asm-mips/delay.h +++ b/trunk/include/asm-mips/delay.h @@ -19,22 +19,20 @@ static inline void __delay(unsigned long loops) { if (sizeof(long) == 4) __asm__ __volatile__ ( - " .set noreorder \n" - " .align 3 \n" - "1: bnez %0, 1b \n" - " subu %0, 1 \n" - " .set reorder \n" + ".set\tnoreorder\n" + "1:\tbnez\t%0,1b\n\t" + "subu\t%0,1\n\t" + ".set\treorder" : "=r" (loops) : "0" (loops)); else if (sizeof(long) == 8) __asm__ __volatile__ ( - " .set noreorder \n" - " .align 3 \n" - "1: bnez %0, 1b \n" - " dsubu %0, 1 \n" - " .set reorder \n" - : "=r" (loops) - : "0" (loops)); + ".set\tnoreorder\n" + "1:\tbnez\t%0,1b\n\t" + "dsubu\t%0,1\n\t" + ".set\treorder" + :"=r" (loops) + :"0" (loops)); } diff --git a/trunk/include/asm-mips/page.h b/trunk/include/asm-mips/page.h index 4035ec79ecd4..a1eab136ff6c 100644 --- a/trunk/include/asm-mips/page.h +++ b/trunk/include/asm-mips/page.h @@ -139,11 +139,9 @@ typedef struct { unsigned long pgprot; } pgprot_t; #define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT) -#ifndef CONFIG_SPARSEMEM #ifndef CONFIG_NEED_MULTIPLE_NODES #define pfn_valid(pfn) ((pfn) < max_mapnr) #endif -#endif #define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT) #define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT) diff --git a/trunk/include/asm-mips/pgtable-32.h b/trunk/include/asm-mips/pgtable-32.h index 087c20769256..4d6bc45df594 100644 --- a/trunk/include/asm-mips/pgtable-32.h +++ b/trunk/include/asm-mips/pgtable-32.h @@ -177,67 +177,48 @@ pfn_pte(unsigned long pfn, pgprot_t prot) ((swp_entry_t) { ((type) << 10) | ((offset) << 15) }) /* - * Bits 0, 4, 8, and 9 are taken, split up 28 bits of offset into this range: + * Bits 0, 1, 2, 9 and 10 are taken, split up the 27 bits of offset + * into this range: */ -#define PTE_FILE_MAX_BITS 28 +#define PTE_FILE_MAX_BITS 27 -#define pte_to_pgoff(_pte) ((((_pte).pte >> 1 ) & 0x07) | \ - (((_pte).pte >> 2 ) & 0x38) | \ - (((_pte).pte >> 10) << 6 )) +#define pte_to_pgoff(_pte) \ + ((((_pte).pte >> 3) & 0x3f ) + (((_pte).pte >> 11) << 8 )) -#define pgoff_to_pte(off) ((pte_t) { (((off) & 0x07) << 1 ) | \ - (((off) & 0x38) << 2 ) | \ - (((off) >> 6 ) << 10) | \ - _PAGE_FILE }) +#define pgoff_to_pte(off) \ + ((pte_t) { (((off) & 0x3f) << 3) + (((off) >> 8) << 11) + _PAGE_FILE }) #else /* Swap entries must have VALID and GLOBAL bits cleared. */ -#if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32) -#define __swp_type(x) (((x).val >> 2) & 0x1f) -#define __swp_offset(x) ((x).val >> 7) -#define __swp_entry(type,offset) \ - ((swp_entry_t) { ((type) << 2) | ((offset) << 7) }) -#else #define __swp_type(x) (((x).val >> 8) & 0x1f) -#define __swp_offset(x) ((x).val >> 13) +#define __swp_offset(x) ((x).val >> 13) #define __swp_entry(type,offset) \ - ((swp_entry_t) { ((type) << 8) | ((offset) << 13) }) -#endif /* defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32) */ + ((swp_entry_t) { ((type) << 8) | ((offset) << 13) }) -#if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32) /* - * Bits 0 and 1 of pte_high are taken, use the rest for the page offset... + * Bits 0, 1, 2, 7 and 8 are taken, split up the 27 bits of offset + * into this range: */ -#define PTE_FILE_MAX_BITS 30 +#define PTE_FILE_MAX_BITS 27 -#define pte_to_pgoff(_pte) ((_pte).pte_high >> 2) -#define pgoff_to_pte(off) ((pte_t) { _PAGE_FILE, (off) << 2 }) +#if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32_R1) + /* fixme */ +#define pte_to_pgoff(_pte) (((_pte).pte_high >> 6) + ((_pte).pte_high & 0x3f)) +#define pgoff_to_pte(off) \ + ((pte_t){(((off) & 0x3f) + ((off) << 6) + _PAGE_FILE)}) #else -/* - * Bits 0, 4, 6, and 7 are taken, split up 28 bits of offset into this range: - */ -#define PTE_FILE_MAX_BITS 28 - -#define pte_to_pgoff(_pte) ((((_pte).pte >> 1) & 0x7) | \ - (((_pte).pte >> 2) & 0x8) | \ - (((_pte).pte >> 8) << 4)) +#define pte_to_pgoff(_pte) \ + ((((_pte).pte >> 3) & 0x1f ) + (((_pte).pte >> 9) << 6 )) -#define pgoff_to_pte(off) ((pte_t) { (((off) & 0x7) << 1) | \ - (((off) & 0x8) << 2) | \ - (((off) >> 4) << 8) | \ - _PAGE_FILE }) +#define pgoff_to_pte(off) \ + ((pte_t) { (((off) & 0x1f) << 3) + (((off) >> 6) << 9) + _PAGE_FILE }) #endif #endif -#if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32) -#define __pte_to_swp_entry(pte) ((swp_entry_t) { (pte).pte_high }) -#define __swp_entry_to_pte(x) ((pte_t) { 0, (x).val }) -#else #define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) }) #define __swp_entry_to_pte(x) ((pte_t) { (x).val }) -#endif #endif /* _ASM_PGTABLE_32_H */ diff --git a/trunk/include/asm-mips/pgtable-64.h b/trunk/include/asm-mips/pgtable-64.h index 2faf5c9ff127..82166b254b27 100644 --- a/trunk/include/asm-mips/pgtable-64.h +++ b/trunk/include/asm-mips/pgtable-64.h @@ -224,12 +224,15 @@ static inline pte_t mk_swap_pte(unsigned long type, unsigned long offset) #define __swp_entry_to_pte(x) ((pte_t) { (x).val }) /* - * Bits 0, 4, 6, and 7 are taken. Let's leave bits 1, 2, 3, and 5 alone to - * make things easier, and only use the upper 56 bits for the page offset... + * Bits 0, 1, 2, 7 and 8 are taken, split up the 32 bits of offset + * into this range: */ -#define PTE_FILE_MAX_BITS 56 +#define PTE_FILE_MAX_BITS 32 -#define pte_to_pgoff(_pte) ((_pte).pte >> 8) -#define pgoff_to_pte(off) ((pte_t) { ((off) << 8) | _PAGE_FILE }) +#define pte_to_pgoff(_pte) \ + ((((_pte).pte >> 3) & 0x1f ) + (((_pte).pte >> 9) << 6 )) + +#define pgoff_to_pte(off) \ + ((pte_t) { (((off) & 0x1f) << 3) + (((off) >> 6) << 9) + _PAGE_FILE }) #endif /* _ASM_PGTABLE_64_H */ diff --git a/trunk/include/asm-mips/pgtable.h b/trunk/include/asm-mips/pgtable.h index d0af2a3b0152..174a3cda8c26 100644 --- a/trunk/include/asm-mips/pgtable.h +++ b/trunk/include/asm-mips/pgtable.h @@ -70,15 +70,7 @@ extern unsigned long zero_page_mask; #define ZERO_PAGE(vaddr) \ (virt_to_page(empty_zero_page + (((unsigned long)(vaddr)) & zero_page_mask))) -#define __HAVE_ARCH_MOVE_PTE -#define move_pte(pte, prot, old_addr, new_addr) \ -({ \ - pte_t newpte = (pte); \ - if (pte_present(pte) && pfn_valid(pte_pfn(pte)) && \ - pte_page(pte) == ZERO_PAGE(old_addr)) \ - newpte = mk_pte(ZERO_PAGE(new_addr), (prot)); \ - newpte; \ -}) +#define __HAVE_ARCH_MULTIPLE_ZERO_PAGE extern void paging_init(void); @@ -353,9 +345,8 @@ static inline pgprot_t pgprot_noncached(pgprot_t _prot) #if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32_R1) static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) { - pte.pte_low &= _PAGE_CHG_MASK; - pte.pte_high &= ~0x3f; - pte.pte_low |= pgprot_val(newprot); + pte.pte_low &= _PAGE_CHG_MASK; + pte.pte_low |= pgprot_val(newprot); pte.pte_high |= pgprot_val(newprot) & 0x3f; return pte; } diff --git a/trunk/include/asm-mips/smp.h b/trunk/include/asm-mips/smp.h index e14e4b69de21..75c6fe7c2126 100644 --- a/trunk/include/asm-mips/smp.h +++ b/trunk/include/asm-mips/smp.h @@ -48,6 +48,7 @@ extern struct call_data_struct *call_data; #define SMP_CALL_FUNCTION 0x2 extern cpumask_t phys_cpu_present_map; +extern cpumask_t cpu_online_map; #define cpu_possible_map phys_cpu_present_map extern cpumask_t cpu_callout_map; @@ -85,9 +86,9 @@ extern void prom_init_secondary(void); extern void plat_smp_setup(void); /* - * Called in smp_prepare_cpus. + * Called after init_IRQ but before __cpu_up. */ -extern void plat_prepare_cpus(unsigned int max_cpus); +extern void prom_prepare_cpus(unsigned int max_cpus); /* * Last chance for the board code to finish SMP initialization before diff --git a/trunk/include/asm-mips/sparsemem.h b/trunk/include/asm-mips/sparsemem.h deleted file mode 100644 index 795ac6c23203..000000000000 --- a/trunk/include/asm-mips/sparsemem.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef _MIPS_SPARSEMEM_H -#define _MIPS_SPARSEMEM_H -#ifdef CONFIG_SPARSEMEM - -/* - * SECTION_SIZE_BITS 2^N: how big each section will be - * MAX_PHYSMEM_BITS 2^N: how much memory we can have in that space - */ -#define SECTION_SIZE_BITS 28 -#define MAX_PHYSMEM_BITS 35 - -#endif /* CONFIG_SPARSEMEM */ -#endif /* _MIPS_SPARSEMEM_H */ - diff --git a/trunk/include/asm-s390/futex.h b/trunk/include/asm-s390/futex.h index 1802775568b9..40c25e166a9b 100644 --- a/trunk/include/asm-s390/futex.h +++ b/trunk/include/asm-s390/futex.h @@ -11,24 +11,23 @@ #define __futex_atomic_fixup \ ".section __ex_table,\"a\"\n" \ " .align 4\n" \ - " .long 0b,4b,2b,4b,3b,4b\n" \ + " .long 0b,2b,1b,2b\n" \ ".previous" #else /* __s390x__ */ #define __futex_atomic_fixup \ ".section __ex_table,\"a\"\n" \ " .align 8\n" \ - " .quad 0b,4b,2b,4b,3b,4b\n" \ + " .quad 0b,2b,1b,2b\n" \ ".previous" #endif /* __s390x__ */ #define __futex_atomic_op(insn, ret, oldval, newval, uaddr, oparg) \ - asm volatile(" sacf 256\n" \ - "0: l %1,0(%6)\n" \ - "1: " insn \ - "2: cs %1,%2,0(%6)\n" \ - "3: jl 1b\n" \ + asm volatile(" l %1,0(%6)\n" \ + "0: " insn \ + " cs %1,%2,0(%6)\n" \ + "1: jl 0b\n" \ " lhi %0,0\n" \ - "4: sacf 0\n" \ + "2:\n" \ __futex_atomic_fixup \ : "=d" (ret), "=&d" (oldval), "=&d" (newval), \ "=m" (*uaddr) \ diff --git a/trunk/include/asm-s390/lowcore.h b/trunk/include/asm-s390/lowcore.h index bea727904287..db0606c1abd4 100644 --- a/trunk/include/asm-s390/lowcore.h +++ b/trunk/include/asm-s390/lowcore.h @@ -98,8 +98,8 @@ #define __LC_KERNEL_ASCE 0xD58 #define __LC_USER_ASCE 0xD60 #define __LC_PANIC_STACK 0xD68 -#define __LC_CPUID 0xD80 -#define __LC_CPUADDR 0xD88 +#define __LC_CPUID 0xD90 +#define __LC_CPUADDR 0xD98 #define __LC_IPLDEV 0xDB8 #define __LC_JIFFY_TIMER 0xDC0 #define __LC_CURRENT 0xDD8 diff --git a/trunk/include/asm-sparc64/pgtable.h b/trunk/include/asm-sparc64/pgtable.h index cd464f469a2c..c44e7466534e 100644 --- a/trunk/include/asm-sparc64/pgtable.h +++ b/trunk/include/asm-sparc64/pgtable.h @@ -689,23 +689,6 @@ static inline void set_pte_at(struct mm_struct *mm, unsigned long addr, pte_t *p #define pte_clear(mm,addr,ptep) \ set_pte_at((mm), (addr), (ptep), __pte(0UL)) -#ifdef DCACHE_ALIASING_POSSIBLE -#define __HAVE_ARCH_MOVE_PTE -#define move_pte(pte, prot, old_addr, new_addr) \ -({ \ - pte_t newpte = (pte); \ - if (tlb_type != hypervisor && pte_present(pte)) { \ - unsigned long this_pfn = pte_pfn(pte); \ - \ - if (pfn_valid(this_pfn) && \ - (((old_addr) ^ (new_addr)) & (1 << 13))) \ - flush_dcache_page_all(current->mm, \ - pfn_to_page(this_pfn)); \ - } \ - newpte; \ -}) -#endif - extern pgd_t swapper_pg_dir[2048]; extern pmd_t swapper_low_pmd_dir[2048]; diff --git a/trunk/include/asm-um/irqflags.h b/trunk/include/asm-um/irqflags.h deleted file mode 100644 index 659b9abdfdba..000000000000 --- a/trunk/include/asm-um/irqflags.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef __UM_IRQFLAGS_H -#define __UM_IRQFLAGS_H - -/* Empty for now */ - -#endif diff --git a/trunk/include/asm-um/uaccess.h b/trunk/include/asm-um/uaccess.h index 16c734af9193..bea5a015f667 100644 --- a/trunk/include/asm-um/uaccess.h +++ b/trunk/include/asm-um/uaccess.h @@ -41,11 +41,11 @@ #define __get_user(x, ptr) \ ({ \ - const __typeof__(*(ptr)) __user *__private_ptr = (ptr); \ + const __typeof__(ptr) __private_ptr = ptr; \ __typeof__(x) __private_val; \ int __private_ret = -EFAULT; \ (x) = (__typeof__(*(__private_ptr)))0; \ - if (__copy_from_user((__force void *)&__private_val, (__private_ptr),\ + if (__copy_from_user((void *) &__private_val, (__private_ptr), \ sizeof(*(__private_ptr))) == 0) { \ (x) = (__typeof__(*(__private_ptr))) __private_val; \ __private_ret = 0; \ @@ -62,7 +62,7 @@ #define __put_user(x, ptr) \ ({ \ - __typeof__(*(ptr)) __user *__private_ptr = ptr; \ + __typeof__(ptr) __private_ptr = ptr; \ __typeof__(*(__private_ptr)) __private_val; \ int __private_ret = -EFAULT; \ __private_val = (__typeof__(*(__private_ptr))) (x); \ diff --git a/trunk/include/asm-x86_64/acpi.h b/trunk/include/asm-x86_64/acpi.h index 2c95a319c056..aa1c7b2e438c 100644 --- a/trunk/include/asm-x86_64/acpi.h +++ b/trunk/include/asm-x86_64/acpi.h @@ -162,8 +162,6 @@ extern int acpi_pci_disabled; extern u8 x86_acpiid_to_apicid[]; -#define ARCH_HAS_POWER_INIT 1 - extern int acpi_skip_timer_override; #endif /*__KERNEL__*/ diff --git a/trunk/include/asm-x86_64/apicdef.h b/trunk/include/asm-x86_64/apicdef.h index 1dd40067c67c..5a48e9bcf218 100644 --- a/trunk/include/asm-x86_64/apicdef.h +++ b/trunk/include/asm-x86_64/apicdef.h @@ -137,6 +137,8 @@ */ #define u32 unsigned int +#define lapic ((volatile struct local_apic *)APIC_BASE) + struct local_apic { /*000*/ struct { u32 __reserved[4]; } __reserved_01; diff --git a/trunk/include/linux/elevator.h b/trunk/include/linux/elevator.h index 1713ace808bf..ad133fcfb239 100644 --- a/trunk/include/linux/elevator.h +++ b/trunk/include/linux/elevator.h @@ -21,7 +21,7 @@ typedef void (elevator_put_req_fn) (request_queue_t *, struct request *); typedef void (elevator_activate_req_fn) (request_queue_t *, struct request *); typedef void (elevator_deactivate_req_fn) (request_queue_t *, struct request *); -typedef void *(elevator_init_fn) (request_queue_t *, elevator_t *); +typedef int (elevator_init_fn) (request_queue_t *, elevator_t *); typedef void (elevator_exit_fn) (elevator_t *); struct elevator_ops diff --git a/trunk/include/linux/i2o.h b/trunk/include/linux/i2o.h index c115e9e840b4..dd7d627bf66f 100644 --- a/trunk/include/linux/i2o.h +++ b/trunk/include/linux/i2o.h @@ -1114,11 +1114,8 @@ static inline struct i2o_message *i2o_msg_get(struct i2o_controller *c) mmsg->mfa = readl(c->in_port); if (unlikely(mmsg->mfa >= c->in_queue.len)) { - u32 mfa = mmsg->mfa; - mempool_free(mmsg, c->in_msg.mempool); - - if (mfa == I2O_QUEUE_EMPTY) + if(mmsg->mfa == I2O_QUEUE_EMPTY) return ERR_PTR(-EBUSY); return ERR_PTR(-EFAULT); } diff --git a/trunk/include/linux/m48t86.h b/trunk/include/linux/m48t86.h index 915d6b4f0f89..9065199319d0 100644 --- a/trunk/include/linux/m48t86.h +++ b/trunk/include/linux/m48t86.h @@ -11,6 +11,6 @@ struct m48t86_ops { - void (*writebyte)(unsigned char value, unsigned long addr); - unsigned char (*readbyte)(unsigned long addr); + void (*writeb)(unsigned char value, unsigned long addr); + unsigned char (*readb)(unsigned long addr); }; diff --git a/trunk/include/linux/mempolicy.h b/trunk/include/linux/mempolicy.h index f5fdca1d67e6..6a7621b2b12b 100644 --- a/trunk/include/linux/mempolicy.h +++ b/trunk/include/linux/mempolicy.h @@ -36,7 +36,6 @@ #include struct vm_area_struct; -struct mm_struct; #ifdef CONFIG_NUMA diff --git a/trunk/include/linux/mmzone.h b/trunk/include/linux/mmzone.h index 2d8337150493..36740354d4db 100644 --- a/trunk/include/linux/mmzone.h +++ b/trunk/include/linux/mmzone.h @@ -15,7 +15,6 @@ #include #include #include -#include /* Free memory management - zoned buddy allocator. */ #ifndef CONFIG_FORCE_MAX_ZONEORDER diff --git a/trunk/include/linux/pci-acpi.h b/trunk/include/linux/pci-acpi.h index 936ef82ed76a..4877e35ae202 100644 --- a/trunk/include/linux/pci-acpi.h +++ b/trunk/include/linux/pci-acpi.h @@ -50,7 +50,7 @@ extern acpi_status pci_osc_control_set(acpi_handle handle, u32 flags); extern acpi_status pci_osc_support_set(u32 flags); #else -#if !defined(AE_ERROR) +#if !defined(acpi_status) typedef u32 acpi_status; #define AE_ERROR (acpi_status) (0x0001) #endif diff --git a/trunk/mm/shmem.c b/trunk/mm/shmem.c index 1e43c8a865ba..4c5e68e4e9ae 100644 --- a/trunk/mm/shmem.c +++ b/trunk/mm/shmem.c @@ -1780,7 +1780,6 @@ static int shmem_rmdir(struct inode *dir, struct dentry *dentry) if (!simple_empty(dentry)) return -ENOTEMPTY; - dentry->d_inode->i_nlink--; dir->i_nlink--; return shmem_unlink(dir, dentry); } @@ -2103,7 +2102,6 @@ static int shmem_fill_super(struct super_block *sb, sb->s_blocksize_bits = PAGE_CACHE_SHIFT; sb->s_magic = TMPFS_MAGIC; sb->s_op = &shmem_ops; - sb->s_time_gran = 1; inode = shmem_get_inode(sb, S_IFDIR | mode, 0); if (!inode) diff --git a/trunk/mm/slab.c b/trunk/mm/slab.c index f1b644eb39d8..d31a06bfbea5 100644 --- a/trunk/mm/slab.c +++ b/trunk/mm/slab.c @@ -207,6 +207,11 @@ typedef unsigned int kmem_bufctl_t; #define BUFCTL_ACTIVE (((kmem_bufctl_t)(~0U))-2) #define SLAB_LIMIT (((kmem_bufctl_t)(~0U))-3) +/* Max number of objs-per-slab for caches which use off-slab slabs. + * Needed to avoid a possible looping condition in cache_grow(). + */ +static unsigned long offslab_limit; + /* * struct slab * @@ -1351,6 +1356,12 @@ void __init kmem_cache_init(void) NULL, NULL); } + /* Inc off-slab bufctl limit until the ceiling is hit. */ + if (!(OFF_SLAB(sizes->cs_cachep))) { + offslab_limit = sizes->cs_size - sizeof(struct slab); + offslab_limit /= sizeof(kmem_bufctl_t); + } + sizes->cs_dmacachep = kmem_cache_create(names->name_dma, sizes->cs_size, ARCH_KMALLOC_MINALIGN, @@ -1769,7 +1780,6 @@ static void set_up_list3s(struct kmem_cache *cachep, int index) static size_t calculate_slab_order(struct kmem_cache *cachep, size_t size, size_t align, unsigned long flags) { - unsigned long offslab_limit; size_t left_over = 0; int gfporder; @@ -1781,18 +1791,9 @@ static size_t calculate_slab_order(struct kmem_cache *cachep, if (!num) continue; - if (flags & CFLGS_OFF_SLAB) { - /* - * Max number of objs-per-slab for caches which - * use off-slab slabs. Needed to avoid a possible - * looping condition in cache_grow(). - */ - offslab_limit = size - sizeof(struct slab); - offslab_limit /= sizeof(kmem_bufctl_t); - - if (num > offslab_limit) - break; - } + /* More than offslab_limit objects will cause problems */ + if ((flags & CFLGS_OFF_SLAB) && num > offslab_limit) + break; /* Found something acceptable - save it away */ cachep->num = num; diff --git a/trunk/mm/vmscan.c b/trunk/mm/vmscan.c index 440a733fe2e9..4649a63a8cb6 100644 --- a/trunk/mm/vmscan.c +++ b/trunk/mm/vmscan.c @@ -1061,7 +1061,7 @@ static unsigned long balance_pgdat(pg_data_t *pgdat, unsigned long nr_pages, loop_again: total_scanned = 0; nr_reclaimed = 0; - sc.may_writepage = !laptop_mode; + sc.may_writepage = !laptop_mode, sc.nr_mapped = read_page_state(nr_mapped); inc_page_state(pageoutrun); diff --git a/trunk/net/bridge/br_if.c b/trunk/net/bridge/br_if.c index f5d47bf4f967..ad1c7af65ec8 100644 --- a/trunk/net/bridge/br_if.c +++ b/trunk/net/bridge/br_if.c @@ -300,20 +300,25 @@ int br_add_bridge(const char *name) rtnl_lock(); if (strchr(dev->name, '%')) { ret = dev_alloc_name(dev, dev->name); - if (ret < 0) { - free_netdev(dev); - goto out; - } + if (ret < 0) + goto err1; } ret = register_netdevice(dev); if (ret) - goto out; + goto err2; ret = br_sysfs_addbr(dev); if (ret) - unregister_netdevice(dev); - out: + goto err3; + rtnl_unlock(); + return 0; + + err3: + unregister_netdev(dev); + err2: + free_netdev(dev); + err1: rtnl_unlock(); return ret; } diff --git a/trunk/net/dccp/ackvec.c b/trunk/net/dccp/ackvec.c index 8c211c58893b..b5981e5f6b00 100644 --- a/trunk/net/dccp/ackvec.c +++ b/trunk/net/dccp/ackvec.c @@ -452,7 +452,6 @@ static void dccp_ackvec_check_rcv_ackvector(struct dccp_ackvec *av, (unsigned long long) avr->dccpavr_ack_ackno); dccp_ackvec_throw_record(av, avr); - break; } /* * If it wasn't received, continue scanning... we might diff --git a/trunk/net/ethernet/Makefile b/trunk/net/ethernet/Makefile index 7cef1d8ace27..69b74a9a0fc3 100644 --- a/trunk/net/ethernet/Makefile +++ b/trunk/net/ethernet/Makefile @@ -3,5 +3,6 @@ # obj-y += eth.o +obj-$(CONFIG_SYSCTL) += sysctl_net_ether.o obj-$(subst m,y,$(CONFIG_IPX)) += pe2.o obj-$(subst m,y,$(CONFIG_ATALK)) += pe2.o diff --git a/trunk/net/ethernet/sysctl_net_ether.c b/trunk/net/ethernet/sysctl_net_ether.c new file mode 100644 index 000000000000..66b39fc342d2 --- /dev/null +++ b/trunk/net/ethernet/sysctl_net_ether.c @@ -0,0 +1,14 @@ +/* -*- linux-c -*- + * sysctl_net_ether.c: sysctl interface to net Ethernet subsystem. + * + * Begun April 1, 1996, Mike Shaver. + * Added /proc/sys/net/ether directory entry (empty =) ). [MS] + */ + +#include +#include +#include + +ctl_table ether_table[] = { + {0} +}; diff --git a/trunk/net/ipv4/ip_forward.c b/trunk/net/ipv4/ip_forward.c index 9f0bb529ab70..0923add122b4 100644 --- a/trunk/net/ipv4/ip_forward.c +++ b/trunk/net/ipv4/ip_forward.c @@ -116,7 +116,6 @@ int ip_forward(struct sk_buff *skb) too_many_hops: /* Tell the sender its packet died... */ - IP_INC_STATS_BH(IPSTATS_MIB_INHDRERRORS); icmp_send(skb, ICMP_TIME_EXCEEDED, ICMP_EXC_TTL, 0); drop: kfree_skb(skb); diff --git a/trunk/net/ipv4/tcp_highspeed.c b/trunk/net/ipv4/tcp_highspeed.c index ba7c63ca5bb1..b72fa55dfb84 100644 --- a/trunk/net/ipv4/tcp_highspeed.c +++ b/trunk/net/ipv4/tcp_highspeed.c @@ -135,8 +135,7 @@ static void hstcp_cong_avoid(struct sock *sk, u32 adk, u32 rtt, /* Do additive increase */ if (tp->snd_cwnd < tp->snd_cwnd_clamp) { - /* cwnd = cwnd + a(w) / cwnd */ - tp->snd_cwnd_cnt += ca->ai + 1; + tp->snd_cwnd_cnt += ca->ai; if (tp->snd_cwnd_cnt >= tp->snd_cwnd) { tp->snd_cwnd_cnt -= tp->snd_cwnd; tp->snd_cwnd++; diff --git a/trunk/net/ipv4/tcp_input.c b/trunk/net/ipv4/tcp_input.c index b5521a9d3dc1..4a538bc1683d 100644 --- a/trunk/net/ipv4/tcp_input.c +++ b/trunk/net/ipv4/tcp_input.c @@ -1649,7 +1649,7 @@ static void tcp_update_scoreboard(struct sock *sk, struct tcp_sock *tp) * Hence, we can detect timed out packets during fast * retransmit without falling to slow start. */ - if (!IsReno(tp) && tcp_head_timedout(sk, tp)) { + if (tcp_head_timedout(sk, tp)) { struct sk_buff *skb; skb = tp->scoreboard_skb_hint ? tp->scoreboard_skb_hint @@ -1662,6 +1662,8 @@ static void tcp_update_scoreboard(struct sock *sk, struct tcp_sock *tp) if (!(TCP_SKB_CB(skb)->sacked&TCPCB_TAGBITS)) { TCP_SKB_CB(skb)->sacked |= TCPCB_LOST; tp->lost_out += tcp_skb_pcount(skb); + if (IsReno(tp)) + tcp_remove_reno_sacks(sk, tp, tcp_skb_pcount(skb) + 1); /* clear xmit_retrans hint */ if (tp->retransmit_skb_hint && diff --git a/trunk/net/ipv4/tcp_output.c b/trunk/net/ipv4/tcp_output.c index f33c9dddaa12..743016baa048 100644 --- a/trunk/net/ipv4/tcp_output.c +++ b/trunk/net/ipv4/tcp_output.c @@ -642,7 +642,7 @@ int tcp_fragment(struct sock *sk, struct sk_buff *skb, u32 len, unsigned int mss * eventually). The difference is that pulled data not copied, but * immediately discarded. */ -static void __pskb_trim_head(struct sk_buff *skb, int len) +static unsigned char *__pskb_trim_head(struct sk_buff *skb, int len) { int i, k, eat; @@ -667,6 +667,7 @@ static void __pskb_trim_head(struct sk_buff *skb, int len) skb->tail = skb->data; skb->data_len -= len; skb->len = skb->data_len; + return skb->tail; } int tcp_trim_head(struct sock *sk, struct sk_buff *skb, u32 len) @@ -675,11 +676,12 @@ int tcp_trim_head(struct sock *sk, struct sk_buff *skb, u32 len) pskb_expand_head(skb, 0, 0, GFP_ATOMIC)) return -ENOMEM; - /* If len == headlen, we avoid __skb_pull to preserve alignment. */ - if (unlikely(len < skb_headlen(skb))) + if (len <= skb_headlen(skb)) { __skb_pull(skb, len); - else - __pskb_trim_head(skb, len - skb_headlen(skb)); + } else { + if (__pskb_trim_head(skb, len-skb_headlen(skb)) == NULL) + return -ENOMEM; + } TCP_SKB_CB(skb)->seq += len; skb->ip_summed = CHECKSUM_HW; diff --git a/trunk/net/irda/irlap.c b/trunk/net/irda/irlap.c index a16528657b4c..7029618f5719 100644 --- a/trunk/net/irda/irlap.c +++ b/trunk/net/irda/irlap.c @@ -884,8 +884,7 @@ static void irlap_change_speed(struct irlap_cb *self, __u32 speed, int now) if (now) { /* Send down empty frame to trigger speed change */ skb = dev_alloc_skb(0); - if (skb) - irlap_queue_xmit(self, skb); + irlap_queue_xmit(self, skb); } } diff --git a/trunk/net/sysctl_net.c b/trunk/net/sysctl_net.c index 58a1b6b42ddd..55538f6b60ff 100644 --- a/trunk/net/sysctl_net.c +++ b/trunk/net/sysctl_net.c @@ -37,6 +37,14 @@ struct ctl_table net_table[] = { .mode = 0555, .child = core_table, }, +#ifdef CONFIG_NET + { + .ctl_name = NET_ETHER, + .procname = "ethernet", + .mode = 0555, + .child = ether_table, + }, +#endif #ifdef CONFIG_INET { .ctl_name = NET_IPV4, diff --git a/trunk/security/selinux/hooks.c b/trunk/security/selinux/hooks.c index 90b4cdc0c948..21dad415b896 100644 --- a/trunk/security/selinux/hooks.c +++ b/trunk/security/selinux/hooks.c @@ -4422,7 +4422,6 @@ void selinux_complete_init(void) /* Set up any superblocks initialized prior to the policy load. */ printk(KERN_INFO "SELinux: Setting up existing superblocks.\n"); - spin_lock(&sb_lock); spin_lock(&sb_security_lock); next_sb: if (!list_empty(&superblock_security_head)) { @@ -4431,20 +4430,19 @@ void selinux_complete_init(void) struct superblock_security_struct, list); struct super_block *sb = sbsec->sb; + spin_lock(&sb_lock); sb->s_count++; - spin_unlock(&sb_security_lock); spin_unlock(&sb_lock); + spin_unlock(&sb_security_lock); down_read(&sb->s_umount); if (sb->s_root) superblock_doinit(sb, NULL); drop_super(sb); - spin_lock(&sb_lock); spin_lock(&sb_security_lock); list_del_init(&sbsec->list); goto next_sb; } spin_unlock(&sb_security_lock); - spin_unlock(&sb_lock); } /* SELinux requires early initialization in order to label