## Automatically generated incremental diff ## From: linux-2.5.72-bk3 ## To: linux-2.5.73 ## Robot: $Id: make-incremental-diff,v 1.11 2002/02/20 02:59:33 hpa Exp $ diff -urN linux-2.5.72-bk3/Documentation/sched-coding.txt linux-2.5.73/Documentation/sched-coding.txt --- linux-2.5.72-bk3/Documentation/sched-coding.txt 2003-06-16 21:19:40.000000000 -0700 +++ linux-2.5.73/Documentation/sched-coding.txt 2003-06-22 12:03:54.000000000 -0700 @@ -103,7 +103,7 @@ Sets the "nice" value of task p to the given value. int setscheduler(pid_t pid, int policy, struct sched_param *param) Sets the scheduling policy and parameters for the given pid. -void set_cpus_allowed(task_t *p, unsigned long new_mask) +int set_cpus_allowed(task_t *p, unsigned long new_mask) Sets a given task's CPU affinity and migrates it to a proper cpu. Callers must have a valid reference to the task and assure the task not exit prematurely. No locks can be held during the call. diff -urN linux-2.5.72-bk3/Documentation/vm/hugetlbpage.txt linux-2.5.73/Documentation/vm/hugetlbpage.txt --- linux-2.5.72-bk3/Documentation/vm/hugetlbpage.txt 2003-06-16 21:19:41.000000000 -0700 +++ linux-2.5.73/Documentation/vm/hugetlbpage.txt 2003-06-22 12:03:54.000000000 -0700 @@ -68,14 +68,21 @@ type hugetlbfs: mount none /mnt/huge -t hugetlbfs + This command mounts a (pseudo) filesystem of type hugetlbfs on the directory /mnt/huge. Any files created on /mnt/huge uses hugepages. The uid and gid options sets the owner and group of the root of the file system. By default the uid and gid of the current process are taken. The mode option sets the mode of root of file system to value & 0777. This value is given in octal. -By default the value 0755 is picked. An example is given at the end of this -document. +By default the value 0755 is picked. The size option sets the maximum value of +memory (huge pages) allowed for that filesystem (/mnt/huge). The size is +rounded down to HPAGE_SIZE. The option nr_inode sets the maximum number of +inodes that /mnt/huge can use. If the size or nr_inode options are not +provided on command line then no limits are set. For size and nr_inodes +options, you can use [G|g]/[M|m]/[K|k] to represent giga/mega/kilo. For +example, size=2K has the same meaning as size=2048. An example is given at +the end of this document. read and write system calls are not supported on files that reside on hugetlb file systems. diff -urN linux-2.5.72-bk3/MAINTAINERS linux-2.5.73/MAINTAINERS --- linux-2.5.72-bk3/MAINTAINERS 2003-06-16 21:20:05.000000000 -0700 +++ linux-2.5.73/MAINTAINERS 2003-06-22 12:03:54.000000000 -0700 @@ -1429,10 +1429,10 @@ S: Maintained PCI SUBSYSTEM -P: Martin Mares -M: mj@ucw.cz +P: Greg Kroah-Hartman +M: greg@kroah.com L: linux-kernel@vger.kernel.org -S: Odd Fixes +S: Supported PCI HOTPLUG CORE P: Greg Kroah-Hartman diff -urN linux-2.5.72-bk3/Makefile linux-2.5.73/Makefile --- linux-2.5.72-bk3/Makefile 2003-06-22 12:03:18.000000000 -0700 +++ linux-2.5.73/Makefile 2003-06-22 12:03:54.000000000 -0700 @@ -1,7 +1,7 @@ VERSION = 2 PATCHLEVEL = 5 -SUBLEVEL = 72 -EXTRAVERSION = -bk3 +SUBLEVEL = 73 +EXTRAVERSION = # *DOCUMENTATION* # To see a list of typical targets execute "make help" diff -urN linux-2.5.72-bk3/arch/alpha/kernel/osf_sys.c linux-2.5.73/arch/alpha/kernel/osf_sys.c --- linux-2.5.72-bk3/arch/alpha/kernel/osf_sys.c 2003-06-16 21:19:37.000000000 -0700 +++ linux-2.5.73/arch/alpha/kernel/osf_sys.c 2003-06-22 12:03:54.000000000 -0700 @@ -218,15 +218,14 @@ } *osf_stat; static int -linux_to_osf_statfs(struct statfs *linux_stat, struct osf_statfs *osf_stat, +linux_to_osf_statfs(struct kstatfs *linux_stat, struct osf_statfs *osf_stat, unsigned long bufsiz) { struct osf_statfs tmp_stat; tmp_stat.f_type = linux_stat->f_type; tmp_stat.f_flags = 0; /* mount flags */ - /* Linux doesn't provide a "fundamental filesystem block size": */ - tmp_stat.f_fsize = linux_stat->f_bsize; + tmp_stat.f_fsize = linux_stat->f_frsize; tmp_stat.f_bsize = linux_stat->f_bsize; tmp_stat.f_blocks = linux_stat->f_blocks; tmp_stat.f_bfree = linux_stat->f_bfree; @@ -243,7 +242,7 @@ do_osf_statfs(struct dentry * dentry, struct osf_statfs *buffer, unsigned long bufsiz) { - struct statfs linux_stat; + struct kstatfs linux_stat; int error = vfs_statfs(dentry->d_inode->i_sb, &linux_stat); if (!error) error = linux_to_osf_statfs(&linux_stat, buffer, bufsiz); diff -urN linux-2.5.72-bk3/arch/alpha/kernel/traps.c linux-2.5.73/arch/alpha/kernel/traps.c --- linux-2.5.72-bk3/arch/alpha/kernel/traps.c 2003-06-16 21:20:21.000000000 -0700 +++ linux-2.5.73/arch/alpha/kernel/traps.c 2003-06-22 12:03:54.000000000 -0700 @@ -148,7 +148,7 @@ static int kstack_depth_to_print = 24; -void show_stack(unsigned long *sp) +void show_stack(struct task_struct *task, unsigned long *sp) { unsigned long *stack; int i; @@ -174,7 +174,7 @@ void dump_stack(void) { - show_stack(NULL); + show_stack(NULL, NULL); } void diff -urN linux-2.5.72-bk3/arch/arm/kernel/pm.c linux-2.5.73/arch/arm/kernel/pm.c --- linux-2.5.72-bk3/arch/arm/kernel/pm.c 2003-06-16 21:20:27.000000000 -0700 +++ linux-2.5.73/arch/arm/kernel/pm.c 2003-06-22 12:03:54.000000000 -0700 @@ -11,6 +11,8 @@ #include #include #include +#include +#include #include #include diff -urN linux-2.5.72-bk3/arch/arm/lib/lib1funcs.S linux-2.5.73/arch/arm/lib/lib1funcs.S --- linux-2.5.72-bk3/arch/arm/lib/lib1funcs.S 2003-06-16 21:19:41.000000000 -0700 +++ linux-2.5.73/arch/arm/lib/lib1funcs.S 2003-06-22 12:03:54.000000000 -0700 @@ -52,10 +52,6 @@ result .req r2 overdone .req r2 curbit .req r3 -ip .req r12 -sp .req r13 -lr .req r14 -pc .req r15 ENTRY(__udivsi3) cmp divisor, #0 diff -urN linux-2.5.72-bk3/arch/arm/mach-sa1100/generic.c linux-2.5.73/arch/arm/mach-sa1100/generic.c --- linux-2.5.72-bk3/arch/arm/mach-sa1100/generic.c 2003-06-16 21:19:46.000000000 -0700 +++ linux-2.5.73/arch/arm/mach-sa1100/generic.c 2003-06-22 12:03:54.000000000 -0700 @@ -138,11 +138,14 @@ }, }; +static u64 sa11x0udc_dma_mask = 0xffffffffUL; + static struct platform_device sa11x0udc_device = { .name = "sa11x0-udc", .id = 0, .dev = { .name = "Intel Corporation SA11x0 [UDC]", + .dma_mask = &sa11x0udc_dma_mask, }, .num_resources = ARRAY_SIZE(sa11x0udc_resources), .resource = sa11x0udc_resources, @@ -166,6 +169,27 @@ .resource = sa11x0mcp_resources, }; +static struct resource sa11x0ssp_resources[] = { + [0] = { + .start = 0x80070000, + .end = 0x8007ffff, + .flags = IORESOURCE_MEM, + }, +}; + +static u64 sa11x0ssp_dma_mask = 0xffffffffUL; + +static struct platform_device sa11x0ssp_device = { + .name = "sa11x0-ssp", + .id = 0, + .dev = { + .name = "Intel Corporation SA11x0 [SSP]", + .dma_mask = &sa11x0ssp_dma_mask, + }, + .num_resources = ARRAY_SIZE(sa11x0ssp_resources), + .resource = sa11x0ssp_resources, +}; + static struct resource sa11x0fb_resources[] = { [0] = { .start = 0xb0100000, @@ -200,6 +224,7 @@ static struct platform_device *sa11x0_devices[] __initdata = { &sa11x0udc_device, &sa11x0mcp_device, + &sa11x0ssp_device, &sa11x0pcmcia_device, &sa11x0fb_device, }; diff -urN linux-2.5.72-bk3/arch/arm/tools/mach-types linux-2.5.73/arch/arm/tools/mach-types --- linux-2.5.72-bk3/arch/arm/tools/mach-types 2003-06-16 21:20:01.000000000 -0700 +++ linux-2.5.73/arch/arm/tools/mach-types 2003-06-22 12:03:54.000000000 -0700 @@ -6,7 +6,7 @@ # To add an entry into this database, please see Documentation/arm/README, # or contact rmk@arm.linux.org.uk # -# Last update: Wed May 7 23:43:08 2003 +# Last update: Thu Jun 19 18:42:39 2003 # # machine_is_xxx CONFIG_xxxx MACH_TYPE_xxx number # @@ -259,7 +259,7 @@ stork_egg ARCH_STORK_EGG STORK_EGG 248 wismo SA1100_WISMO WISMO 249 ezlinx ARCH_EZLINX EZLINX 250 -at91 ARCH_AT91 AT91 251 +at91rm9200 ARCH_AT91 AT91 251 orion ARCH_ORION ORION 252 neptune ARCH_NEPTUNE NEPTUNE 253 hackkit SA1100_HACKKIT HACKKIT 254 @@ -332,10 +332,26 @@ bandon ARCH_BANDON BANDON 321 pcm7210 ARCH_PCM7210 PCM7210 322 nms9200 ARCH_NMS9200 NMS9200 323 -gealog ARCH_GEALOG GEALOG 324 +logodl ARCH_LOGODL LOGODL 324 m7140 SA1100_M7140 M7140 325 korebot ARCH_KOREBOT KOREBOT 326 iq31244 ARCH_IQ31244 IQ31244 327 koan393 SA1100_KOAN393 KOAN393 328 inhandftip3 ARCH_INHANDFTIP3 INHANDFTIP3 329 gonzo ARCH_GONZO GONZO 330 +bast ARCH_BAST BAST 331 +scanpass ARCH_SCANPASS SCANPASS 332 +ep7312_pooh ARCH_EP7312_POOH EP7312_POOH 333 +ta7s ARCH_TA7S TA7S 334 +ta7v ARCH_TA7V TA7V 335 +icarus SA1100_ICARUS ICARUS 336 +h1900 ARCH_H1900 H1900 337 +gemini SA1100_GEMINI GEMINI 338 +axim ARCH_AXIM AXIM 339 +audiotron ARCH_AUDIOTRON AUDIOTRON 340 +h2200 ARCH_H2200 H2200 341 +loox600 ARCH_LOOX600 LOOX600 342 +niop ARCH_NIOP NIOP 343 +dm310 ARCH_DM310 DM310 344 +seedpxa_c2 ARCH_SEEDPXA_C2 SEEDPXA_C2 345 +ixp4xx_mguardpci ARCH_IXP4XX_MGUARD_PCI IXP4XX_MGUARD_PCI 346 diff -urN linux-2.5.72-bk3/arch/i386/kernel/acpi/Makefile linux-2.5.73/arch/i386/kernel/acpi/Makefile --- linux-2.5.72-bk3/arch/i386/kernel/acpi/Makefile 2003-06-16 21:20:01.000000000 -0700 +++ linux-2.5.73/arch/i386/kernel/acpi/Makefile 2003-06-22 12:03:54.000000000 -0700 @@ -1,3 +1,4 @@ +obj-$(CONFIG_ACPI_HT_ONLY) := acpitable.o obj-$(CONFIG_ACPI_BOOT) := boot.o obj-$(CONFIG_ACPI_SLEEP) += sleep.o wakeup.o diff -urN linux-2.5.72-bk3/arch/i386/kernel/acpi/acpitable.c linux-2.5.73/arch/i386/kernel/acpi/acpitable.c --- linux-2.5.72-bk3/arch/i386/kernel/acpi/acpitable.c 1969-12-31 16:00:00.000000000 -0800 +++ linux-2.5.73/arch/i386/kernel/acpi/acpitable.c 2003-06-22 12:03:54.000000000 -0700 @@ -0,0 +1,553 @@ +/* + * acpitable.c - IA32-specific ACPI boot-time initialization (Revision: 1) + * + * Copyright (C) 1999 Andrew Henroid + * Copyright (C) 2001 Richard Schaal + * Copyright (C) 2001 Paul Diefenbaugh + * Copyright (C) 2001 Jun Nakajima + * Copyright (C) 2001 Arjan van de Ven + * + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + * + * $Id: acpitable.c,v 1.7 2001/11/04 12:21:18 fenrus Exp $ + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "acpitable.h" + +static acpi_table_handler acpi_boot_ops[ACPI_TABLE_COUNT]; + +int acpi_lapic; + +static unsigned char __init +acpi_checksum(void *buffer, int length) +{ + int i; + unsigned char *bytebuffer; + unsigned char sum = 0; + + if (!buffer || length <= 0) + return 0; + + bytebuffer = (unsigned char *) buffer; + + for (i = 0; i < length; i++) + sum += *(bytebuffer++); + + return sum; +} + +static void __init +acpi_print_table_header(acpi_table_header * header) +{ + if (!header) + return; + + printk(KERN_INFO "ACPI table found: %.4s v%d [%.6s %.8s %d.%d]\n", + header->signature, header->revision, header->oem_id, + header->oem_table_id, header->oem_revision >> 16, + header->oem_revision & 0xffff); + + return; +} + +/******************************************************************************* + * + * FUNCTION: acpi_tb_scan_memory_for_rsdp + * + * PARAMETERS: address - Starting pointer for search + * length - Maximum length to search + * + * RETURN: Pointer to the RSDP if found and valid, otherwise NULL. + * + * DESCRIPTION: Search a block of memory for the RSDP signature + * + ******************************************************************************/ + +static void *__init +acpi_tb_scan_memory_for_rsdp(void *address, int length) +{ + u32 offset; + + if (length <= 0) + return NULL; + + /* Search from given start addr for the requested length */ + + offset = 0; + + while (offset < length) { + /* The signature must match and the checksum must be correct */ + if (strncmp(address, RSDP_SIG, sizeof(RSDP_SIG) - 1) == 0 && + acpi_checksum(address, RSDP_CHECKSUM_LENGTH) == 0) { + /* If so, we have found the RSDP */ + printk(KERN_INFO "ACPI: RSDP located at physical address %p\n", + address); + return address; + } + offset += RSDP_SCAN_STEP; + address += RSDP_SCAN_STEP; + } + + /* Searched entire block, no RSDP was found */ + printk(KERN_INFO "ACPI: Searched entire block, no RSDP was found.\n"); + return NULL; +} + +/******************************************************************************* + * + * FUNCTION: acpi_find_root_pointer + * + * PARAMETERS: none + * + * RETURN: physical address of the RSDP + * + * DESCRIPTION: Search lower 1_mbyte of memory for the root system descriptor + * pointer structure. If it is found, set *RSDP to point to it. + * + * NOTE: The RSDP must be either in the first 1_k of the Extended + * BIOS Data Area or between E0000 and FFFFF (ACPI 1.0 section + * 5.2.2; assertion #421). + * + ******************************************************************************/ + +static struct acpi_table_rsdp * __init +acpi_find_root_pointer(void) +{ + struct acpi_table_rsdp * rsdp; + + /* + * Physical address is given + */ + /* + * Region 1) Search EBDA (low memory) paragraphs + */ + rsdp = acpi_tb_scan_memory_for_rsdp(__va(LO_RSDP_WINDOW_BASE), + LO_RSDP_WINDOW_SIZE); + + if (rsdp) + return rsdp; + + /* + * Region 2) Search upper memory: 16-byte boundaries in E0000h-F0000h + */ + rsdp = acpi_tb_scan_memory_for_rsdp(__va(HI_RSDP_WINDOW_BASE), + HI_RSDP_WINDOW_SIZE); + + + + if (rsdp) + return rsdp; + + printk(KERN_ERR "ACPI: System description tables not found\n"); + return NULL; +} + + +/* + * Temporarily use the virtual area starting from FIX_IO_APIC_BASE_END, + * to map the target physical address. The problem is that set_fixmap() + * provides a single page, and it is possible that the page is not + * sufficient. + * By using this area, we can map up to MAX_IO_APICS pages temporarily, + * i.e. until the next __va_range() call. + * + * Important Safety Note: The fixed I/O APIC page numbers are *subtracted* + * from the fixed base. That's why we start at FIX_IO_APIC_BASE_END and + * count idx down while incrementing the phys address. + */ +static __init char * +__va_range(unsigned long phys, unsigned long size) +{ + unsigned long base, offset, mapped_size; + int idx; + + offset = phys & (PAGE_SIZE - 1); + mapped_size = PAGE_SIZE - offset; + set_fixmap(FIX_IO_APIC_BASE_END, phys); + base = fix_to_virt(FIX_IO_APIC_BASE_END); + dprintk("__va_range(0x%lx, 0x%lx): idx=%d mapped at %lx\n", phys, size, + FIX_IO_APIC_BASE_END, base); + + /* + * Most cases can be covered by the below. + */ + idx = FIX_IO_APIC_BASE_END; + while (mapped_size < size) { + if (--idx < FIX_IO_APIC_BASE_0) + return 0; /* cannot handle this */ + phys += PAGE_SIZE; + set_fixmap(idx, phys); + mapped_size += PAGE_SIZE; + } + + return ((unsigned char *) base + offset); +} + +static int __init acpi_tables_init(void) +{ + int result = -ENODEV; + acpi_table_header *header = NULL; + struct acpi_table_rsdp *rsdp = NULL; + struct acpi_table_rsdt *rsdt = NULL; + struct acpi_table_rsdt saved_rsdt; + int tables = 0; + int type = 0; + int i = 0; + + + rsdp = (struct acpi_table_rsdp *) acpi_find_root_pointer(); + + if (!rsdp) + return -ENODEV; + + printk(KERN_INFO "%.8s v%d [%.6s]\n", rsdp->signature, rsdp->revision, + rsdp->oem_id); + + if (strncmp(rsdp->signature, RSDP_SIG,strlen(RSDP_SIG))) { + printk(KERN_WARNING "RSDP table signature incorrect\n"); + return -EINVAL; + } + + rsdt = (struct acpi_table_rsdt *) + __va_range(rsdp->rsdt_address, sizeof(struct acpi_table_rsdt)); + + if (!rsdt) { + printk(KERN_WARNING "ACPI: Invalid root system description tables (RSDT)\n"); + return -ENODEV; + } + + header = & rsdt->header; + acpi_print_table_header(header); + + if (strncmp(header->signature, RSDT_SIG, strlen(RSDT_SIG))) { + printk(KERN_WARNING "ACPI: RSDT signature incorrect\n"); + return -ENODEV; + } + + /* + * The number of tables is computed by taking the + * size of all entries (header size minus total + * size of RSDT) divided by the size of each entry + * (4-byte table pointers). + */ + tables = (header->length - sizeof(acpi_table_header)) / 4; + + memcpy(&saved_rsdt, rsdt, sizeof(saved_rsdt)); + + if (saved_rsdt.header.length > sizeof(saved_rsdt)) { + printk(KERN_WARNING "ACPI: Too big length in RSDT: %d\n", saved_rsdt.header.length); + return -ENODEV; + } + + for (i = 0; i < tables; i++) { + /* Map in header, then map in full table length. */ + header = (acpi_table_header *) + __va_range(saved_rsdt.entry[i], + sizeof(acpi_table_header)); + if (!header) + break; + header = (acpi_table_header *) + __va_range(saved_rsdt.entry[i], header->length); + if (!header) + break; + + acpi_print_table_header(header); + + if (acpi_checksum(header,header->length)) { + printk(KERN_WARNING "ACPI %s has invalid checksum\n", + acpi_table_signatures[i]); + continue; + } + + for (type = 0; type < ACPI_TABLE_COUNT; type++) + if (!strncmp((char *) &header->signature, + acpi_table_signatures[type],strlen(acpi_table_signatures[type]))) + break; + + if (type >= ACPI_TABLE_COUNT) { + printk(KERN_WARNING "ACPI: Unsupported table %.4s\n", + header->signature); + continue; + } + + + if (!acpi_boot_ops[type]) + continue; + + result = acpi_boot_ops[type] (header, + (unsigned long) saved_rsdt. + entry[i]); + } + + return result; +} + +static int total_cpus __initdata = 0; +int have_acpi_tables; + +extern void __init MP_processor_info(struct mpc_config_processor *); + +static void __init +acpi_parse_lapic(struct acpi_table_lapic *local_apic) +{ + struct mpc_config_processor proc_entry; + int ix = 0; + + if (!local_apic) + return; + + printk(KERN_INFO "LAPIC (acpi_id[0x%04x] id[0x%x] enabled[%d])\n", + local_apic->acpi_id, local_apic->id, local_apic->flags.enabled); + + printk(KERN_INFO "CPU %d (0x%02x00)", total_cpus, local_apic->id); + + if (local_apic->flags.enabled) { + printk(" enabled"); + ix = local_apic->id; + if (ix >= MAX_APICS) { + printk(KERN_WARNING + "Processor #%d INVALID - (Max ID: %d).\n", ix, + MAX_APICS); + return; + } + /* + * Fill in the info we want to save. Not concerned about + * the processor ID. Processor features aren't present in + * the table. + */ + proc_entry.mpc_type = MP_PROCESSOR; + proc_entry.mpc_apicid = local_apic->id; + proc_entry.mpc_cpuflag = CPU_ENABLED; + if (proc_entry.mpc_apicid == boot_cpu_physical_apicid) { + printk(" (BSP)"); + proc_entry.mpc_cpuflag |= CPU_BOOTPROCESSOR; + } + proc_entry.mpc_cpufeature = + (boot_cpu_data.x86 << 8) | + (boot_cpu_data.x86_model << 4) | + boot_cpu_data.x86_mask; + proc_entry.mpc_featureflag = boot_cpu_data.x86_capability[0]; + proc_entry.mpc_reserved[0] = 0; + proc_entry.mpc_reserved[1] = 0; + proc_entry.mpc_apicver = 0x10; /* integrated APIC */ + MP_processor_info(&proc_entry); + } else { + printk(" disabled"); + } + printk("\n"); + + total_cpus++; + return; +} + +static void __init +acpi_parse_ioapic(struct acpi_table_ioapic *ioapic) +{ + + if (!ioapic) + return; + + printk(KERN_INFO + "IOAPIC (id[0x%x] address[0x%x] global_irq_base[0x%x])\n", + ioapic->id, ioapic->address, ioapic->global_irq_base); + + if (nr_ioapics >= MAX_IO_APICS) { + printk(KERN_WARNING + "Max # of I/O APICs (%d) exceeded (found %d).\n", + MAX_IO_APICS, nr_ioapics); +/* panic("Recompile kernel with bigger MAX_IO_APICS!\n"); */ + } +} + + +/* Interrupt source overrides inform the machine about exceptions + to the normal "PIC" mode interrupt routing */ + +static void __init +acpi_parse_int_src_ovr(struct acpi_table_int_src_ovr *intsrc) +{ + if (!intsrc) + return; + + printk(KERN_INFO + "INT_SRC_OVR (bus[%d] irq[0x%x] global_irq[0x%x] polarity[0x%x] trigger[0x%x])\n", + intsrc->bus, intsrc->bus_irq, intsrc->global_irq, + intsrc->flags.polarity, intsrc->flags.trigger); +} + +/* + * At this point, we look at the interrupt assignment entries in the MPS + * table. + */ + +static void __init acpi_parse_nmi_src(struct acpi_table_nmi_src *nmisrc) +{ + if (!nmisrc) + return; + + printk(KERN_INFO + "NMI_SRC (polarity[0x%x] trigger[0x%x] global_irq[0x%x])\n", + nmisrc->flags.polarity, nmisrc->flags.trigger, + nmisrc->global_irq); + +} +static void __init +acpi_parse_lapic_nmi(struct acpi_table_lapic_nmi *localnmi) +{ + if (!localnmi) + return; + + printk(KERN_INFO + "LAPIC_NMI (acpi_id[0x%04x] polarity[0x%x] trigger[0x%x] lint[0x%x])\n", + localnmi->acpi_id, localnmi->flags.polarity, + localnmi->flags.trigger, localnmi->lint); +} +static void __init +acpi_parse_lapic_addr_ovr(struct acpi_table_lapic_addr_ovr *lapic_addr_ovr) +{ + if (!lapic_addr_ovr) + return; + + printk(KERN_INFO "LAPIC_ADDR_OVR (address[0x%lx])\n", + (unsigned long) lapic_addr_ovr->address); + +} + +static void __init +acpi_parse_plat_int_src(struct acpi_table_plat_int_src *plintsrc) +{ + if (!plintsrc) + return; + + printk(KERN_INFO + "PLAT_INT_SRC (polarity[0x%x] trigger[0x%x] type[0x%x] id[0x%04x] eid[0x%x] iosapic_vector[0x%x] global_irq[0x%x]\n", + plintsrc->flags.polarity, plintsrc->flags.trigger, + plintsrc->type, plintsrc->id, plintsrc->eid, + plintsrc->iosapic_vector, plintsrc->global_irq); +} +static int __init +acpi_parse_madt(acpi_table_header * header, unsigned long phys) +{ + + struct acpi_table_madt *madt; + acpi_madt_entry_header *entry_header; + int table_size; + + madt = (struct acpi_table_madt *) __va_range(phys, header->length); + + if (!madt) + return -EINVAL; + + table_size = (int) (header->length - sizeof(*madt)); + entry_header = + (acpi_madt_entry_header *) ((void *) madt + sizeof(*madt)); + + while (entry_header && (table_size > 0)) { + switch (entry_header->type) { + case ACPI_MADT_LAPIC: + acpi_parse_lapic((struct acpi_table_lapic *) + entry_header); + break; + case ACPI_MADT_IOAPIC: + acpi_parse_ioapic((struct acpi_table_ioapic *) + entry_header); + break; + case ACPI_MADT_INT_SRC_OVR: + acpi_parse_int_src_ovr((struct acpi_table_int_src_ovr *) + entry_header); + break; + case ACPI_MADT_NMI_SRC: + acpi_parse_nmi_src((struct acpi_table_nmi_src *) + entry_header); + break; + case ACPI_MADT_LAPIC_NMI: + acpi_parse_lapic_nmi((struct acpi_table_lapic_nmi *) + entry_header); + break; + case ACPI_MADT_LAPIC_ADDR_OVR: + acpi_parse_lapic_addr_ovr((struct + acpi_table_lapic_addr_ovr *) + entry_header); + break; + case ACPI_MADT_PLAT_INT_SRC: + acpi_parse_plat_int_src((struct acpi_table_plat_int_src + *) entry_header); + break; + default: + printk(KERN_WARNING + "Unsupported MADT entry type 0x%x\n", + entry_header->type); + break; + } + table_size -= entry_header->length; + entry_header = + (acpi_madt_entry_header *) ((void *) entry_header + + entry_header->length); + } + + if (!total_cpus) { + printk("ACPI: No Processors found in the APCI table.\n"); + return -EINVAL; + } + + printk(KERN_INFO "%d CPUs total\n", total_cpus); + + if (madt->lapic_address) + mp_lapic_addr = madt->lapic_address; + else + mp_lapic_addr = APIC_DEFAULT_PHYS_BASE; + + printk(KERN_INFO "Local APIC address %x\n", madt->lapic_address); + + return 0; +} + + +/* + * Configure the processor info using MADT in the ACPI tables. If we fail to + * configure that, then we use the MPS tables. + */ +void __init +acpi_boot_init(void) +{ + + memset(&acpi_boot_ops, 0, sizeof(acpi_boot_ops)); + acpi_boot_ops[ACPI_APIC] = acpi_parse_madt; + + /* + * Only do this when requested, either because of CPU/Bios type or from the command line + */ + + if (!acpi_tables_init()) + acpi_lapic = 1; +} + diff -urN linux-2.5.72-bk3/arch/i386/kernel/acpi/acpitable.h linux-2.5.73/arch/i386/kernel/acpi/acpitable.h --- linux-2.5.72-bk3/arch/i386/kernel/acpi/acpitable.h 1969-12-31 16:00:00.000000000 -0800 +++ linux-2.5.73/arch/i386/kernel/acpi/acpitable.h 2003-06-22 12:03:54.000000000 -0700 @@ -0,0 +1,260 @@ +/* + * acpitable.c - IA32-specific ACPI boot-time initialization (Revision: 1) + * + * Copyright (C) 1999 Andrew Henroid + * Copyright (C) 2001 Richard Schaal + * Copyright (C) 2001 Paul Diefenbaugh + * Copyright (C) 2001 Jun Nakajima + * Copyright (C) 2001 Arjan van de Ven + * + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + * + * $Id: acpitable.h,v 1.3 2001/11/03 22:41:34 fenrus Exp $ + */ + +/* + * The following codes are cut&pasted from drivers/acpi. Part of the code + * there can be not updated or delivered yet. + * To avoid conflicts when CONFIG_ACPI is defined, the following codes are + * modified so that they are self-contained in this file. + * -- jun + */ + +#ifndef _HEADER_ACPITABLE_H_ +#define _HEADER_ACPITABLE_H_ + +#define dprintk printk +typedef unsigned int ACPI_TBLPTR; + +typedef struct { /* ACPI common table header */ + char signature[4]; /* identifies type of table */ + u32 length; /* length of table, + in bytes, * including header */ + u8 revision; /* specification minor version # */ + u8 checksum; /* to make sum of entire table == 0 */ + char oem_id[6]; /* OEM identification */ + char oem_table_id[8]; /* OEM table identification */ + u32 oem_revision; /* OEM revision number */ + char asl_compiler_id[4]; /* ASL compiler vendor ID */ + u32 asl_compiler_revision; /* ASL compiler revision number */ +} acpi_table_header __attribute__ ((packed));; + +enum { + ACPI_APIC = 0, + ACPI_BOOT, + ACPI_DBGP, + ACPI_DSDT, + ACPI_ECDT, + ACPI_ETDT, + ACPI_FACP, + ACPI_FACS, + ACPI_OEMX, + ACPI_PSDT, + ACPI_SBST, + ACPI_SLIT, + ACPI_SPCR, + ACPI_SRAT, + ACPI_SSDT, + ACPI_SPMI, + ACPI_XSDT, + ACPI_TABLE_COUNT +}; + +static char *acpi_table_signatures[ACPI_TABLE_COUNT] = { + "APIC", + "BOOT", + "DBGP", + "DSDT", + "ECDT", + "ETDT", + "FACP", + "FACS", + "OEM", + "PSDT", + "SBST", + "SLIT", + "SPCR", + "SRAT", + "SSDT", + "SPMI", + "XSDT" +}; + +struct acpi_table_madt { + acpi_table_header header; + u32 lapic_address; + struct { + u32 pcat_compat:1; + u32 reserved:31; + } flags __attribute__ ((packed)); +} __attribute__ ((packed));; + +enum { + ACPI_MADT_LAPIC = 0, + ACPI_MADT_IOAPIC, + ACPI_MADT_INT_SRC_OVR, + ACPI_MADT_NMI_SRC, + ACPI_MADT_LAPIC_NMI, + ACPI_MADT_LAPIC_ADDR_OVR, + ACPI_MADT_IOSAPIC, + ACPI_MADT_LSAPIC, + ACPI_MADT_PLAT_INT_SRC, + ACPI_MADT_ENTRY_COUNT +}; + +#define RSDP_SIG "RSD PTR " +#define RSDT_SIG "RSDT" + +#define ACPI_DEBUG_PRINT(pl) + +#define ACPI_MEMORY_MODE 0x01 +#define ACPI_LOGICAL_ADDRESSING 0x00 +#define ACPI_PHYSICAL_ADDRESSING 0x01 + +#define LO_RSDP_WINDOW_BASE 0 /* Physical Address */ +#define HI_RSDP_WINDOW_BASE 0xE0000 /* Physical Address */ +#define LO_RSDP_WINDOW_SIZE 0x400 +#define HI_RSDP_WINDOW_SIZE 0x20000 +#define RSDP_SCAN_STEP 16 +#define RSDP_CHECKSUM_LENGTH 20 + +typedef int (*acpi_table_handler) (acpi_table_header * header, unsigned long); + +struct acpi_table_rsdp { + char signature[8]; + u8 checksum; + char oem_id[6]; + u8 revision; + u32 rsdt_address; +} __attribute__ ((packed)); + +struct acpi_table_rsdt { + acpi_table_header header; + u32 entry[ACPI_TABLE_COUNT]; +} __attribute__ ((packed)); + +typedef struct { + u8 type; + u8 length; +} acpi_madt_entry_header __attribute__ ((packed)); + +typedef struct { + u16 polarity:2; + u16 trigger:2; + u16 reserved:12; +} acpi_madt_int_flags __attribute__ ((packed)); + +struct acpi_table_lapic { + acpi_madt_entry_header header; + u8 acpi_id; + u8 id; + struct { + u32 enabled:1; + u32 reserved:31; + } flags __attribute__ ((packed)); +} __attribute__ ((packed)); + +struct acpi_table_ioapic { + acpi_madt_entry_header header; + u8 id; + u8 reserved; + u32 address; + u32 global_irq_base; +} __attribute__ ((packed)); + +struct acpi_table_int_src_ovr { + acpi_madt_entry_header header; + u8 bus; + u8 bus_irq; + u32 global_irq; + acpi_madt_int_flags flags; +} __attribute__ ((packed)); + +struct acpi_table_nmi_src { + acpi_madt_entry_header header; + acpi_madt_int_flags flags; + u32 global_irq; +} __attribute__ ((packed)); + +struct acpi_table_lapic_nmi { + acpi_madt_entry_header header; + u8 acpi_id; + acpi_madt_int_flags flags; + u8 lint; +} __attribute__ ((packed)); + +struct acpi_table_lapic_addr_ovr { + acpi_madt_entry_header header; + u8 reserved[2]; + u64 address; +} __attribute__ ((packed)); + +struct acpi_table_iosapic { + acpi_madt_entry_header header; + u8 id; + u8 reserved; + u32 global_irq_base; + u64 address; +} __attribute__ ((packed)); + +struct acpi_table_lsapic { + acpi_madt_entry_header header; + u8 acpi_id; + u8 id; + u8 eid; + u8 reserved[3]; + struct { + u32 enabled:1; + u32 reserved:31; + } flags; +} __attribute__ ((packed)); + +struct acpi_table_plat_int_src { + acpi_madt_entry_header header; + acpi_madt_int_flags flags; + u8 type; + u8 id; + u8 eid; + u8 iosapic_vector; + u32 global_irq; + u32 reserved; +} __attribute__ ((packed)); + +/* + * ACPI Table Descriptor. One per ACPI table + */ +typedef struct acpi_table_desc { + struct acpi_table_desc *prev; + struct acpi_table_desc *next; + struct acpi_table_desc *installed_desc; + acpi_table_header *pointer; + void *base_pointer; + u8 *aml_pointer; + u64 physical_address; + u32 aml_length; + u32 length; + u32 count; + u16 table_id; + u8 type; + u8 allocation; + u8 loaded_into_namespace; + +} acpi_table_desc __attribute__ ((packed));; + +#endif diff -urN linux-2.5.72-bk3/arch/i386/kernel/entry.S linux-2.5.73/arch/i386/kernel/entry.S --- linux-2.5.72-bk3/arch/i386/kernel/entry.S 2003-06-16 21:19:46.000000000 -0700 +++ linux-2.5.73/arch/i386/kernel/entry.S 2003-06-22 12:03:54.000000000 -0700 @@ -874,6 +874,7 @@ .long sys_clock_gettime /* 265 */ .long sys_clock_getres .long sys_clock_nanosleep - + .long sys_statfs64 + .long sys_fstatfs64 nr_syscalls=(.-sys_call_table)/4 diff -urN linux-2.5.72-bk3/arch/i386/kernel/process.c linux-2.5.73/arch/i386/kernel/process.c --- linux-2.5.72-bk3/arch/i386/kernel/process.c 2003-06-16 21:19:37.000000000 -0700 +++ linux-2.5.73/arch/i386/kernel/process.c 2003-06-22 12:03:54.000000000 -0700 @@ -190,7 +190,7 @@ ".previous \n" : "=r" (cr4): "0" (0)); printk("CR0: %08lx CR2: %08lx CR3: %08lx CR4: %08lx\n", cr0, cr2, cr3, cr4); - show_trace(®s->esp); + show_trace(NULL, ®s->esp); } /* diff -urN linux-2.5.72-bk3/arch/i386/kernel/setup.c linux-2.5.73/arch/i386/kernel/setup.c --- linux-2.5.72-bk3/arch/i386/kernel/setup.c 2003-06-22 12:03:18.000000000 -0700 +++ linux-2.5.73/arch/i386/kernel/setup.c 2003-06-22 12:03:54.000000000 -0700 @@ -61,7 +61,12 @@ unsigned long mmu_cr4_features; EXPORT_SYMBOL_GPL(mmu_cr4_features); -int acpi_disabled __initdata = 0; +#ifdef CONFIG_ACPI_HT_ONLY +int acpi_disabled = 1; +#else +int acpi_disabled = 0; +#endif +EXPORT_SYMBOL(acpi_disabled); int MCA_bus; /* for MCA, but anyone else can use it if they want */ @@ -514,6 +519,10 @@ if (c == ' ' && !memcmp(from, "acpi=off", 8)) acpi_disabled = 1; + /* "acpismp=force" turns on ACPI again */ + else if (!memcmp(from, "acpismp=force", 14)) + acpi_disabled = 0; + /* * highmem=size forces highmem to be exactly 'size' bytes. * This works even on boxes that have no highmem otherwise. diff -urN linux-2.5.72-bk3/arch/i386/kernel/traps.c linux-2.5.73/arch/i386/kernel/traps.c --- linux-2.5.72-bk3/arch/i386/kernel/traps.c 2003-06-16 21:19:42.000000000 -0700 +++ linux-2.5.73/arch/i386/kernel/traps.c 2003-06-22 12:03:54.000000000 -0700 @@ -32,9 +32,9 @@ #ifdef CONFIG_MCA #include -#include #endif +#include #include #include #include @@ -92,9 +92,8 @@ static int kstack_depth_to_print = 24; -void show_trace(unsigned long * stack) +void show_trace(struct task_struct *task, unsigned long * stack) { - int i; unsigned long addr; if (!stack) @@ -104,7 +103,6 @@ #ifdef CONFIG_KALLSYMS printk("\n"); #endif - i = 1; while (((long) stack & (THREAD_SIZE-1)) != 0) { addr = *stack++; if (kernel_text_address(addr)) { @@ -122,10 +120,10 @@ /* User space on another CPU? */ if ((esp ^ (unsigned long)tsk->thread_info) & (PAGE_MASK<<1)) return; - show_trace((unsigned long *)esp); + show_trace(tsk, (unsigned long *)esp); } -void show_stack(unsigned long * esp) +void show_stack(struct task_struct *task, unsigned long * esp) { unsigned long *stack; int i; @@ -145,7 +143,7 @@ printk("%08lx ", *stack++); } printk("\n"); - show_trace(esp); + show_trace(task, esp); } /* @@ -155,7 +153,7 @@ { unsigned long stack; - show_trace(&stack); + show_trace(current, &stack); } void show_registers(struct pt_regs *regs) @@ -192,7 +190,7 @@ if (in_kernel) { printk("\nStack: "); - show_stack((unsigned long*)esp); + show_stack(NULL, (unsigned long*)esp); printk("Code: "); if(regs->eip < PAGE_OFFSET) diff -urN linux-2.5.72-bk3/arch/i386/mm/hugetlbpage.c linux-2.5.73/arch/i386/mm/hugetlbpage.c --- linux-2.5.72-bk3/arch/i386/mm/hugetlbpage.c 2003-06-16 21:20:22.000000000 -0700 +++ linux-2.5.73/arch/i386/mm/hugetlbpage.c 2003-06-22 12:03:55.000000000 -0700 @@ -24,9 +24,41 @@ int htlbpage_max; static long htlbzone_pages; -static LIST_HEAD(htlbpage_freelist); +static struct list_head hugepage_freelists[MAX_NUMNODES]; static spinlock_t htlbpage_lock = SPIN_LOCK_UNLOCKED; +static void enqueue_huge_page(struct page *page) +{ + list_add(&page->list, + &hugepage_freelists[page_zone(page)->zone_pgdat->node_id]); +} + +static struct page *dequeue_huge_page(void) +{ + int nid = numa_node_id(); + struct page *page = NULL; + + if (list_empty(&hugepage_freelists[nid])) { + for (nid = 0; nid < MAX_NUMNODES; ++nid) + if (!list_empty(&hugepage_freelists[nid])) + break; + } + if (nid >= 0 && nid < MAX_NUMNODES && !list_empty(&hugepage_freelists[nid])) { + page = list_entry(hugepage_freelists[nid].next, struct page, list); + list_del(&page->list); + } + return page; +} + +static struct page *alloc_fresh_huge_page(void) +{ + static int nid = 0; + struct page *page; + page = alloc_pages_node(nid, GFP_HIGHUSER, HUGETLB_PAGE_ORDER); + nid = (nid + 1) % numnodes; + return page; +} + void free_huge_page(struct page *page); static struct page *alloc_hugetlb_page(void) @@ -35,13 +67,11 @@ struct page *page; spin_lock(&htlbpage_lock); - if (list_empty(&htlbpage_freelist)) { + page = dequeue_huge_page(); + if (!page) { spin_unlock(&htlbpage_lock); return NULL; } - - page = list_entry(htlbpage_freelist.next, struct page, list); - list_del(&page->list); htlbpagemem--; spin_unlock(&htlbpage_lock); set_page_count(page, 1); @@ -253,7 +283,7 @@ INIT_LIST_HEAD(&page->list); spin_lock(&htlbpage_lock); - list_add(&page->list, &htlbpage_freelist); + enqueue_huge_page(page); htlbpagemem++; spin_unlock(&htlbpage_lock); } @@ -369,7 +399,8 @@ map = NULL; spin_lock(&htlbpage_lock); - list_for_each(p, &htlbpage_freelist) { + /* all lowmem is on node 0 */ + list_for_each(p, &hugepage_freelists[0]) { if (map) { list_del(&map->list); update_and_free_page(map); @@ -406,11 +437,11 @@ return (int)htlbzone_pages; if (lcount > 0) { /* Increase the mem size. */ while (lcount--) { - page = alloc_pages(__GFP_HIGHMEM, HUGETLB_PAGE_ORDER); + page = alloc_fresh_huge_page(); if (page == NULL) break; spin_lock(&htlbpage_lock); - list_add(&page->list, &htlbpage_freelist); + enqueue_huge_page(page); htlbpagemem++; htlbzone_pages++; spin_unlock(&htlbpage_lock); @@ -451,12 +482,15 @@ int i; struct page *page; + for (i = 0; i < MAX_NUMNODES; ++i) + INIT_LIST_HEAD(&hugepage_freelists[i]); + for (i = 0; i < htlbpage_max; ++i) { - page = alloc_pages(__GFP_HIGHMEM, HUGETLB_PAGE_ORDER); + page = alloc_fresh_huge_page(); if (!page) break; spin_lock(&htlbpage_lock); - list_add(&page->list, &htlbpage_freelist); + enqueue_huge_page(page); spin_unlock(&htlbpage_lock); } htlbpage_max = htlbpagemem = htlbzone_pages = i; diff -urN linux-2.5.72-bk3/arch/i386/mm/init.c linux-2.5.73/arch/i386/mm/init.c --- linux-2.5.72-bk3/arch/i386/mm/init.c 2003-06-16 21:20:19.000000000 -0700 +++ linux-2.5.73/arch/i386/mm/init.c 2003-06-22 12:03:55.000000000 -0700 @@ -27,6 +27,7 @@ #include #include #include +#include #include #include @@ -425,6 +426,8 @@ extern void set_max_mapnr_init(void); #endif /* !CONFIG_DISCONTIGMEM */ +static struct kcore_list kcore_mem, kcore_vmalloc; + void __init mem_init(void) { extern int ppro_with_ram_bug(void); @@ -477,6 +480,10 @@ datasize = (unsigned long) &_edata - (unsigned long) &_etext; initsize = (unsigned long) &__init_end - (unsigned long) &__init_begin; + kclist_add(&kcore_mem, __va(0), max_low_pfn << PAGE_SHIFT); + kclist_add(&kcore_vmalloc, (void *)VMALLOC_START, + VMALLOC_END-VMALLOC_START); + printk(KERN_INFO "Memory: %luk/%luk available (%dk kernel code, %dk reserved, %dk data, %dk init, %ldk highmem)\n", (unsigned long) nr_free_pages() << (PAGE_SHIFT-10), num_physpages << (PAGE_SHIFT-10), diff -urN linux-2.5.72-bk3/arch/i386/pci/common.c linux-2.5.73/arch/i386/pci/common.c --- linux-2.5.72-bk3/arch/i386/pci/common.c 2003-06-16 21:20:00.000000000 -0700 +++ linux-2.5.73/arch/i386/pci/common.c 2003-06-22 12:03:55.000000000 -0700 @@ -23,7 +23,24 @@ int pcibios_last_bus = -1; struct pci_bus *pci_root_bus = NULL; -struct pci_ops *pci_root_ops = NULL; +struct pci_raw_ops *raw_pci_ops; + +static int pci_read(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 *value) +{ + return raw_pci_ops->read(0, bus->number, PCI_SLOT(devfn), + PCI_FUNC(devfn), where, size, value); +} + +static int pci_write(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 value) +{ + return raw_pci_ops->write(0, bus->number, PCI_SLOT(devfn), + PCI_FUNC(devfn), where, size, value); +} + +struct pci_ops pci_root_ops = { + .read = pci_read, + .write = pci_write, +}; /* * legacy, numa, and acpi all want to call pcibios_scan_root @@ -115,7 +132,7 @@ printk("PCI: Probing PCI hardware (bus %02x)\n", busnum); - return pci_scan_bus(busnum, pci_root_ops, NULL); + return pci_scan_bus(busnum, &pci_root_ops, NULL); } extern u8 pci_cache_line_size; @@ -124,7 +141,7 @@ { struct cpuinfo_x86 *c = &boot_cpu_data; - if (!pci_root_ops) { + if (!raw_pci_ops) { printk("PCI: System does not support PCI\n"); return 0; } diff -urN linux-2.5.72-bk3/arch/i386/pci/direct.c linux-2.5.73/arch/i386/pci/direct.c --- linux-2.5.72-bk3/arch/i386/pci/direct.c 2003-06-16 21:19:43.000000000 -0700 +++ linux-2.5.73/arch/i386/pci/direct.c 2003-06-22 12:03:55.000000000 -0700 @@ -13,7 +13,7 @@ #define PCI_CONF1_ADDRESS(bus, dev, fn, reg) \ (0x80000000 | (bus << 16) | (dev << 11) | (fn << 8) | (reg & ~3)) -static int __pci_conf1_read (int seg, int bus, int dev, int fn, int reg, int len, u32 *value) +static int pci_conf1_read (int seg, int bus, int dev, int fn, int reg, int len, u32 *value) { unsigned long flags; @@ -41,7 +41,7 @@ return 0; } -static int __pci_conf1_write (int seg, int bus, int dev, int fn, int reg, int len, u32 value) +static int pci_conf1_write (int seg, int bus, int dev, int fn, int reg, int len, u32 value) { unsigned long flags; @@ -71,19 +71,7 @@ #undef PCI_CONF1_ADDRESS -static int pci_conf1_read(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 *value) -{ - return __pci_conf1_read(0, bus->number, PCI_SLOT(devfn), - PCI_FUNC(devfn), where, size, value); -} - -static int pci_conf1_write(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 value) -{ - return __pci_conf1_write(0, bus->number, PCI_SLOT(devfn), - PCI_FUNC(devfn), where, size, value); -} - -struct pci_ops pci_direct_conf1 = { +struct pci_raw_ops pci_direct_conf1 = { .read = pci_conf1_read, .write = pci_conf1_write, }; @@ -95,7 +83,7 @@ #define PCI_CONF2_ADDRESS(dev, reg) (u16)(0xC000 | (dev << 8) | reg) -static int __pci_conf2_read (int seg, int bus, int dev, int fn, int reg, int len, u32 *value) +static int pci_conf2_read (int seg, int bus, int dev, int fn, int reg, int len, u32 *value) { unsigned long flags; @@ -129,7 +117,7 @@ return 0; } -static int __pci_conf2_write (int seg, int bus, int dev, int fn, int reg, int len, u32 value) +static int pci_conf2_write (int seg, int bus, int dev, int fn, int reg, int len, u32 value) { unsigned long flags; @@ -165,19 +153,7 @@ #undef PCI_CONF2_ADDRESS -static int pci_conf2_read(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 *value) -{ - return __pci_conf2_read(0, bus->number, PCI_SLOT(devfn), - PCI_FUNC(devfn), where, size, value); -} - -static int pci_conf2_write(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 value) -{ - return __pci_conf2_write(0, bus->number, PCI_SLOT(devfn), - PCI_FUNC(devfn), where, size, value); -} - -static struct pci_ops pci_direct_conf2 = { +static struct pci_raw_ops pci_direct_conf2 = { .read = pci_conf2_read, .write = pci_conf2_write, }; @@ -193,38 +169,30 @@ * This should be close to trivial, but it isn't, because there are buggy * chipsets (yes, you guessed it, by Intel and Compaq) that have no class ID. */ -static int __devinit pci_sanity_check(struct pci_ops *o) +static int __devinit pci_sanity_check(struct pci_raw_ops *o) { u32 x = 0; - int retval = 0; - struct pci_bus *bus; /* Fake bus and device */ - struct pci_dev *dev; + int devfn; if (pci_probe & PCI_NO_CHECKS) return 1; - bus = kmalloc(sizeof(*bus), GFP_ATOMIC); - dev = kmalloc(sizeof(*dev), GFP_ATOMIC); - if (!bus || !dev) { - printk(KERN_ERR "Out of memory in %s\n", __FUNCTION__); - goto exit; + for (devfn = 0; devfn < 0x100; devfn++) { + if (o->read(0, 0, PCI_SLOT(devfn), PCI_FUNC(devfn), + PCI_CLASS_DEVICE, 2, &x)) + continue; + if (x == PCI_CLASS_BRIDGE_HOST || x == PCI_CLASS_DISPLAY_VGA) + return 1; + + if (o->read(0, 0, PCI_SLOT(devfn), PCI_FUNC(devfn), + PCI_VENDOR_ID, 2, &x)) + continue; + if (x == PCI_VENDOR_ID_INTEL || x == PCI_VENDOR_ID_COMPAQ) + return 1; } - bus->number = 0; - dev->bus = bus; - for(dev->devfn=0; dev->devfn < 0x100; dev->devfn++) - if ((!o->read(bus, dev->devfn, PCI_CLASS_DEVICE, 2, &x) && - (x == PCI_CLASS_BRIDGE_HOST || x == PCI_CLASS_DISPLAY_VGA)) || - (!o->read(bus, dev->devfn, PCI_VENDOR_ID, 2, &x) && - (x == PCI_VENDOR_ID_INTEL || x == PCI_VENDOR_ID_COMPAQ))) { - retval = 1; - goto exit; - } DBG("PCI: Sanity check failed\n"); -exit: - kfree(dev); - kfree(bus); - return retval; + return 0; } static int __init pci_direct_init(void) @@ -247,9 +215,9 @@ local_irq_restore(flags); printk(KERN_INFO "PCI: Using configuration type 1\n"); if (!request_region(0xCF8, 8, "PCI conf1")) - pci_root_ops = NULL; + raw_pci_ops = NULL; else - pci_root_ops = &pci_direct_conf1; + raw_pci_ops = &pci_direct_conf1; return 0; } outl (tmp, 0xCF8); @@ -267,9 +235,9 @@ local_irq_restore(flags); printk(KERN_INFO "PCI: Using configuration type 2\n"); if (!request_region(0xCF8, 4, "PCI conf2")) - pci_root_ops = NULL; + raw_pci_ops = NULL; else - pci_root_ops = &pci_direct_conf2; + raw_pci_ops = &pci_direct_conf2; return 0; } } diff -urN linux-2.5.72-bk3/arch/i386/pci/fixup.c linux-2.5.73/arch/i386/pci/fixup.c --- linux-2.5.72-bk3/arch/i386/pci/fixup.c 2003-06-16 21:20:07.000000000 -0700 +++ linux-2.5.73/arch/i386/pci/fixup.c 2003-06-22 12:03:55.000000000 -0700 @@ -23,9 +23,9 @@ pci_read_config_byte(d, reg++, &subb); DBG("i450NX PXB %d: %02x/%02x/%02x\n", pxb, busno, suba, subb); if (busno) - pci_scan_bus(busno, pci_root_ops, NULL); /* Bus A */ + pci_scan_bus(busno, &pci_root_ops, NULL); /* Bus A */ if (suba < subb) - pci_scan_bus(suba+1, pci_root_ops, NULL); /* Bus B */ + pci_scan_bus(suba+1, &pci_root_ops, NULL); /* Bus B */ } pcibios_last_bus = -1; } @@ -39,7 +39,7 @@ u8 busno; pci_read_config_byte(d, 0x4a, &busno); printk(KERN_INFO "PCI: i440KX/GX host bridge %s: secondary bus %02x\n", d->slot_name, busno); - pci_scan_bus(busno, pci_root_ops, NULL); + pci_scan_bus(busno, &pci_root_ops, NULL); pcibios_last_bus = -1; } diff -urN linux-2.5.72-bk3/arch/i386/pci/irq.c linux-2.5.73/arch/i386/pci/irq.c --- linux-2.5.72-bk3/arch/i386/pci/irq.c 2003-06-16 21:20:27.000000000 -0700 +++ linux-2.5.73/arch/i386/pci/irq.c 2003-06-22 12:03:55.000000000 -0700 @@ -107,7 +107,7 @@ * It might be a secondary bus, but in this case its parent is already * known (ascending bus order) and therefore pci_scan_bus returns immediately. */ - if (busmap[i] && pci_scan_bus(i, pci_root_bus->ops, NULL)) + if (busmap[i] && pci_scan_bus(i, &pci_root_ops, NULL)) printk(KERN_INFO "PCI: Discovered primary peer bus %02x [IRQ]\n", i); pcibios_last_bus = -1; } diff -urN linux-2.5.72-bk3/arch/i386/pci/legacy.c linux-2.5.73/arch/i386/pci/legacy.c --- linux-2.5.72-bk3/arch/i386/pci/legacy.c 2003-06-16 21:20:21.000000000 -0700 +++ linux-2.5.73/arch/i386/pci/legacy.c 2003-06-22 12:03:55.000000000 -0700 @@ -31,14 +31,14 @@ if (pci_bus_exists(&pci_root_buses, n)) continue; bus->number = n; - bus->ops = pci_root_ops; + bus->ops = &pci_root_ops; dev->bus = bus; for (dev->devfn=0; dev->devfn<256; dev->devfn += 8) if (!pci_read_config_word(dev, PCI_VENDOR_ID, &l) && l != 0x0000 && l != 0xffff) { DBG("Found device at %02x:%02x [%04x]\n", n, dev->devfn, l); printk(KERN_INFO "PCI: Discovered peer bus %02x\n", n); - pci_scan_bus(n, pci_root_ops, NULL); + pci_scan_bus(n, &pci_root_ops, NULL); break; } } @@ -49,7 +49,7 @@ static int __init pci_legacy_init(void) { - if (!pci_root_ops) { + if (!raw_pci_ops) { printk("PCI: System does not support PCI\n"); return 0; } diff -urN linux-2.5.72-bk3/arch/i386/pci/numa.c linux-2.5.73/arch/i386/pci/numa.c --- linux-2.5.72-bk3/arch/i386/pci/numa.c 2003-06-16 21:19:42.000000000 -0700 +++ linux-2.5.73/arch/i386/pci/numa.c 2003-06-22 12:03:55.000000000 -0700 @@ -13,7 +13,7 @@ #define PCI_CONF1_MQ_ADDRESS(bus, dev, fn, reg) \ (0x80000000 | (BUS2LOCAL(bus) << 16) | (dev << 11) | (fn << 8) | (reg & ~3)) -static int __pci_conf1_mq_read (int seg, int bus, int dev, int fn, int reg, int len, u32 *value) +static int pci_conf1_mq_read (int seg, int bus, int dev, int fn, int reg, int len, u32 *value) { unsigned long flags; @@ -41,7 +41,7 @@ return 0; } -static int __pci_conf1_mq_write (int seg, int bus, int dev, int fn, int reg, int len, u32 value) +static int pci_conf1_mq_write (int seg, int bus, int dev, int fn, int reg, int len, u32 value) { unsigned long flags; @@ -71,19 +71,7 @@ #undef PCI_CONF1_MQ_ADDRESS -static int pci_conf1_mq_read(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 *value) -{ - return __pci_conf1_mq_read(0, bus->number, PCI_SLOT(devfn), - PCI_FUNC(devfn), where, size, value); -} - -static int pci_conf1_mq_write(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 value) -{ - return __pci_conf1_mq_write(0, bus->number, PCI_SLOT(devfn), - PCI_FUNC(devfn), where, size, value); -} - -static struct pci_ops pci_direct_conf1_mq = { +static struct pci_raw_ops pci_direct_conf1_mq = { .read = pci_conf1_mq_read, .write = pci_conf1_mq_write }; @@ -106,9 +94,9 @@ pci_read_config_byte(d, reg++, &subb); DBG("i450NX PXB %d: %02x/%02x/%02x\n", pxb, busno, suba, subb); if (busno) - pci_scan_bus(QUADLOCAL2BUS(quad,busno), pci_root_ops, NULL); /* Bus A */ + pci_scan_bus(QUADLOCAL2BUS(quad,busno), &pci_root_ops, NULL); /* Bus A */ if (suba < subb) - pci_scan_bus(QUADLOCAL2BUS(quad,suba+1), pci_root_ops, NULL); /* Bus B */ + pci_scan_bus(QUADLOCAL2BUS(quad,suba+1), &pci_root_ops, NULL); /* Bus B */ } pcibios_last_bus = -1; } @@ -121,7 +109,7 @@ { int quad; - pci_root_ops = &pci_direct_conf1_mq; + raw_pci_ops = &pci_direct_conf1_mq; if (pcibios_scanned++) return 0; @@ -132,7 +120,7 @@ printk("Scanning PCI bus %d for quad %d\n", QUADLOCAL2BUS(quad,0), quad); pci_scan_bus(QUADLOCAL2BUS(quad,0), - pci_root_ops, NULL); + &pci_root_ops, NULL); } } return 0; diff -urN linux-2.5.72-bk3/arch/i386/pci/pcbios.c linux-2.5.73/arch/i386/pci/pcbios.c --- linux-2.5.72-bk3/arch/i386/pci/pcbios.c 2003-06-16 21:19:40.000000000 -0700 +++ linux-2.5.73/arch/i386/pci/pcbios.c 2003-06-22 12:03:55.000000000 -0700 @@ -172,7 +172,7 @@ return (int) (ret & 0xff00) >> 8; } -static int __pci_bios_read (int seg, int bus, int dev, int fn, int reg, int len, u32 *value) +static int pci_bios_read (int seg, int bus, int dev, int fn, int reg, int len, u32 *value) { unsigned long result = 0; unsigned long flags; @@ -227,7 +227,7 @@ return (int)((result & 0xff00) >> 8); } -static int __pci_bios_write (int seg, int bus, int dev, int fn, int reg, int len, u32 value) +static int pci_bios_write (int seg, int bus, int dev, int fn, int reg, int len, u32 value) { unsigned long result = 0; unsigned long flags; @@ -282,24 +282,12 @@ return (int)((result & 0xff00) >> 8); } -static int pci_bios_read(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 *value) -{ - return __pci_bios_read(0, bus->number, PCI_SLOT(devfn), - PCI_FUNC(devfn), where, size, value); -} - -static int pci_bios_write(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 value) -{ - return __pci_bios_write(0, bus->number, PCI_SLOT(devfn), - PCI_FUNC(devfn), where, size, value); -} - /* * Function table for BIOS32 access */ -static struct pci_ops pci_bios_access = { +static struct pci_raw_ops pci_bios_access = { .read = pci_bios_read, .write = pci_bios_write }; @@ -308,7 +296,7 @@ * Try to find PCI BIOS. */ -static struct pci_ops * __devinit pci_find_bios(void) +static struct pci_raw_ops * __devinit pci_find_bios(void) { union bios32 *check; unsigned char sum; @@ -484,7 +472,7 @@ static int __init pci_pcbios_init(void) { if ((pci_probe & PCI_PROBE_BIOS) - && ((pci_root_ops = pci_find_bios()))) { + && ((raw_pci_ops = pci_find_bios()))) { pci_probe |= PCI_BIOS_SORT; pci_bios_present = 1; } diff -urN linux-2.5.72-bk3/arch/i386/pci/pci.h linux-2.5.73/arch/i386/pci/pci.h --- linux-2.5.72-bk3/arch/i386/pci/pci.h 2003-06-16 21:20:05.000000000 -0700 +++ linux-2.5.73/arch/i386/pci/pci.h 2003-06-22 12:03:55.000000000 -0700 @@ -37,7 +37,7 @@ extern int pcibios_last_bus; extern struct pci_bus *pci_root_bus; -extern struct pci_ops *pci_root_ops; +extern struct pci_ops pci_root_ops; /* pci-irq.c */ diff -urN linux-2.5.72-bk3/arch/ia64/ia32/ia32_entry.S linux-2.5.73/arch/ia64/ia32/ia32_entry.S --- linux-2.5.72-bk3/arch/ia64/ia32/ia32_entry.S 2003-06-22 12:03:18.000000000 -0700 +++ linux-2.5.73/arch/ia64/ia32/ia32_entry.S 2003-06-22 12:03:55.000000000 -0700 @@ -436,6 +436,28 @@ data8 sys_ni_syscall data8 sys_ni_syscall data8 sys_ni_syscall + data8 sys_ni_syscall /* 250 */ + data8 sys_ni_syscall + data8 sys_ni_syscall + data8 sys_ni_syscall + data8 sys_ni_syscall + data8 sys_ni_syscall /*255*/ + data8 sys_ni_syscall + data8 sys_ni_syscall + data8 sys_ni_syscall + data8 sys_ni_syscall + data8 sys_ni_syscall /* 260 */ + data8 sys_ni_syscall + data8 sys_ni_syscall + data8 sys_ni_syscall + data8 sys_ni_syscall + data8 sys_ni_syscall /* 265 */ + data8 sys_ni_syscall + data8 sys_ni_syscall + data8 sys_statfs64 + data8 sys_fstatfs64 + data8 sys_ni_syscall + /* * CAUTION: If any system calls are added beyond this point * then the check in `arch/ia64/kernel/ivt.S' will have diff -urN linux-2.5.72-bk3/arch/ia64/kernel/entry.S linux-2.5.73/arch/ia64/kernel/entry.S --- linux-2.5.72-bk3/arch/ia64/kernel/entry.S 2003-06-22 12:03:19.000000000 -0700 +++ linux-2.5.73/arch/ia64/kernel/entry.S 2003-06-22 12:03:55.000000000 -0700 @@ -1430,8 +1430,8 @@ data8 sys_clock_gettime data8 sys_clock_getres // 1255 data8 sys_clock_nanosleep - data8 ia64_ni_syscall - data8 ia64_ni_syscall + data8 sys_fstatfs64 + data8 sys_statfs64 data8 ia64_ni_syscall data8 ia64_ni_syscall // 1260 data8 ia64_ni_syscall diff -urN linux-2.5.72-bk3/arch/ia64/kernel/ivt.S linux-2.5.73/arch/ia64/kernel/ivt.S --- linux-2.5.72-bk3/arch/ia64/kernel/ivt.S 2003-06-22 12:03:19.000000000 -0700 +++ linux-2.5.73/arch/ia64/kernel/ivt.S 2003-06-22 12:03:55.000000000 -0700 @@ -1513,7 +1513,7 @@ alloc r15=ar.pfs,0,0,6,0 // must first in an insn group ;; ld4 r8=[r14],8 // r8 == eax (syscall number) - mov r15=250 // number of entries in ia32 system call table + mov r15=270 // number of entries in ia32 system call table ;; cmp.ltu.unc p6,p7=r8,r15 ld4 out1=[r14],8 // r9 == ecx diff -urN linux-2.5.72-bk3/arch/ia64/pci/pci.c linux-2.5.73/arch/ia64/pci/pci.c --- linux-2.5.72-bk3/arch/ia64/pci/pci.c 2003-06-16 21:20:00.000000000 -0700 +++ linux-2.5.73/arch/ia64/pci/pci.c 2003-06-22 12:03:55.000000000 -0700 @@ -59,7 +59,7 @@ static int -__pci_sal_read (int seg, int bus, int dev, int fn, int reg, int len, u32 *value) +pci_sal_read (int seg, int bus, int dev, int fn, int reg, int len, u32 *value) { int result = 0; u64 data = 0; @@ -75,7 +75,7 @@ } static int -__pci_sal_write (int seg, int bus, int dev, int fn, int reg, int len, u32 value) +pci_sal_write (int seg, int bus, int dev, int fn, int reg, int len, u32 value) { if ((seg > 255) || (bus > 255) || (dev > 31) || (fn > 7) || (reg > 255)) return -EINVAL; @@ -83,28 +83,33 @@ return ia64_sal_pci_config_write(PCI_SAL_ADDRESS(seg, bus, dev, fn, reg), len, value); } +struct pci_raw_ops pci_sal_ops = { + .read = pci_sal_read, + .write = pci_sal_write +}; + +struct pci_raw_ops *raw_pci_ops = &pci_sal_ops; /* default to SAL */ + static int -pci_sal_read (struct pci_bus *bus, unsigned int devfn, int where, int size, u32 *value) +pci_read (struct pci_bus *bus, unsigned int devfn, int where, int size, u32 *value) { - return __pci_sal_read(pci_domain_nr(bus), bus->number, PCI_SLOT(devfn), PCI_FUNC(devfn), - where, size, value); + return raw_pci_ops->read(pci_domain_nr(bus), bus->number, + PCI_SLOT(devfn), PCI_FUNC(devfn), where, size, value); } static int -pci_sal_write (struct pci_bus *bus, unsigned int devfn, int where, int size, u32 value) +pci_write (struct pci_bus *bus, unsigned int devfn, int where, int size, u32 value) { - return __pci_sal_write(pci_domain_nr(bus), bus->number, PCI_SLOT(devfn), PCI_FUNC(devfn), - where, size, value); + return raw_pci_ops->write(pci_domain_nr(bus), bus->number, + PCI_SLOT(devfn), PCI_FUNC(devfn), where, size, value); } -struct pci_ops pci_sal_ops = { - .read = pci_sal_read, - .write = pci_sal_write +static struct pci_ops pci_root_ops = { + .read = pci_read, + .write = pci_write, }; -struct pci_ops *pci_root_ops = &pci_sal_ops; /* default to SAL */ - static int __init pci_acpi_init (void) { @@ -307,7 +312,7 @@ info.name = name; acpi_walk_resources(handle, METHOD_NAME__CRS, add_window, &info); - return scan_root_bus(bus, pci_root_ops, controller); + return scan_root_bus(bus, &pci_root_ops, controller); out3: kfree(controller->window); diff -urN linux-2.5.72-bk3/arch/m68knommu/platform/5249/MOTOROLA/crt0_ram.S linux-2.5.73/arch/m68knommu/platform/5249/MOTOROLA/crt0_ram.S --- linux-2.5.72-bk3/arch/m68knommu/platform/5249/MOTOROLA/crt0_ram.S 2003-06-16 21:20:21.000000000 -0700 +++ linux-2.5.73/arch/m68knommu/platform/5249/MOTOROLA/crt0_ram.S 2003-06-22 12:03:55.000000000 -0700 @@ -174,6 +174,7 @@ nop +#ifdef CONFIG_ROMFS_FS /* * Move ROM filesystem above bss :-) */ @@ -195,6 +196,12 @@ cmp.l %a0, %a2 /* Check if at end */ bne _copy_romfs +#else /* CONFIG_ROMFS_FS */ + lea.l _ebss, %a1 + move.l %a1, _ramstart +#endif /* CONFIG_ROMFS_FS */ + + /* * Zero out the bss region. */ diff -urN linux-2.5.72-bk3/arch/m68knommu/platform/5249/config.c linux-2.5.73/arch/m68knommu/platform/5249/config.c --- linux-2.5.72-bk3/arch/m68knommu/platform/5249/config.c 2003-06-16 21:20:05.000000000 -0700 +++ linux-2.5.73/arch/m68knommu/platform/5249/config.c 2003-06-22 12:03:55.000000000 -0700 @@ -95,7 +95,13 @@ void config_BSP(char *commandp, int size) { mcf_setimr(MCFSIM_IMR_MASKALL); + +#if defined(CONFIG_BOOTPARAM) + strncpy(commandp, CONFIG_BOOTPARAM_STRING, size); + commandp[size-1] = 0; +#else memset(commandp, 0, size); +#endif mach_sched_init = coldfire_timer_init; mach_tick = coldfire_tick; diff -urN linux-2.5.72-bk3/arch/m68knommu/platform/5272/MOTOROLA/crt0_ram.S linux-2.5.73/arch/m68knommu/platform/5272/MOTOROLA/crt0_ram.S --- linux-2.5.72-bk3/arch/m68knommu/platform/5272/MOTOROLA/crt0_ram.S 2003-06-16 21:20:20.000000000 -0700 +++ linux-2.5.73/arch/m68knommu/platform/5272/MOTOROLA/crt0_ram.S 2003-06-22 12:03:55.000000000 -0700 @@ -103,6 +103,7 @@ move.l #0x80000100, %d0 /* Setup cache mask */ movec %d0, %CACR /* Enable cache */ +#ifdef CONFIG_ROMFS_FS /* * Move ROM filesystem above bss :-) */ @@ -124,6 +125,12 @@ cmp.l %a0, %a2 /* Check if at end */ bne _copy_romfs +#else /* CONFIG_ROMFS_FS */ + lea.l _ebss, %a1 + move.l %a1, _ramstart +#endif /* CONFIG_ROMFS_FS */ + + /* * Zero out the bss region. */ diff -urN linux-2.5.72-bk3/arch/m68knommu/platform/5272/config.c linux-2.5.73/arch/m68knommu/platform/5272/config.c --- linux-2.5.72-bk3/arch/m68knommu/platform/5272/config.c 2003-06-16 21:19:47.000000000 -0700 +++ linux-2.5.73/arch/m68knommu/platform/5272/config.c 2003-06-22 12:03:55.000000000 -0700 @@ -104,7 +104,10 @@ mcf_disableall(); -#if defined(CONFIG_NETtel) +#if defined(CONFIG_BOOTPARAM) + strncpy(commandp, CONFIG_BOOTPARAM_STRING, size); + commandp[size-1] = 0; +#elif defined(CONFIG_NETtel) /* Copy command line from FLASH to local buffer... */ memcpy(commandp, (char *) 0xf0004000, size); commandp[size-1] = 0; diff -urN linux-2.5.72-bk3/arch/ppc64/kernel/process.c linux-2.5.73/arch/ppc64/kernel/process.c --- linux-2.5.72-bk3/arch/ppc64/kernel/process.c 2003-06-16 21:20:05.000000000 -0700 +++ linux-2.5.73/arch/ppc64/kernel/process.c 2003-06-22 12:03:55.000000000 -0700 @@ -129,7 +129,6 @@ return last; } -static void show_tsk_stack(struct task_struct *p, unsigned long sp); char *ppc_find_proc_name(unsigned *p, char *buf, unsigned buflen); void show_regs(struct pt_regs * regs) @@ -172,7 +171,7 @@ printk("NIP [%016lx] ", regs->nip); printk("%s\n", ppc_find_proc_name((unsigned *)regs->nip, name_buf, 256)); - show_tsk_stack(current, regs->gpr[1]); + show_stack(current, (unsigned long *)regs->gpr[1]); } void exit_thread(void) @@ -517,22 +516,26 @@ return 0; } -static void show_tsk_stack(struct task_struct *p, unsigned long sp) +void show_stack(struct task_struct *p, unsigned long *_sp) { unsigned long ip; unsigned long stack_page = (unsigned long)p->thread_info; int count = 0; char name_buf[256]; + unsigned long sp = (unsigned long)_sp; if (!p) return; + if (sp == 0) + sp = p->thread.ksp; printk("Call Trace:\n"); do { if (__get_user(sp, (unsigned long *)sp)) break; - if (sp < (stack_page + sizeof(struct thread_struct)) || - sp >= (stack_page + THREAD_SIZE)) + if (sp < stack_page + sizeof(struct thread_struct)) + break; + if (sp >= stack_page + THREAD_SIZE) break; if (__get_user(ip, (unsigned long *)(sp + 16))) break; @@ -544,10 +547,10 @@ void dump_stack(void) { - show_tsk_stack(current, (unsigned long)_get_SP()); + show_stack(current, (unsigned long *)_get_SP()); } void show_trace_task(struct task_struct *tsk) { - show_tsk_stack(tsk, tsk->thread.ksp); + show_stack(tsk, (unsigned long *)tsk->thread.ksp); } diff -urN linux-2.5.72-bk3/arch/sparc64/defconfig linux-2.5.73/arch/sparc64/defconfig --- linux-2.5.72-bk3/arch/sparc64/defconfig 2003-06-16 21:19:47.000000000 -0700 +++ linux-2.5.73/arch/sparc64/defconfig 2003-06-22 12:03:55.000000000 -0700 @@ -90,6 +90,11 @@ CONFIG_WATCHDOG_RIO=m # +# Generic Driver Options +# +CONFIG_FW_LOADER=m + +# # Graphics support # CONFIG_FB=y @@ -266,39 +271,72 @@ CONFIG_SCSI=y # -# SCSI support type (disk, tape, CDrom) +# SCSI support type (disk, tape, CD-ROM) # CONFIG_BLK_DEV_SD=y -CONFIG_SD_EXTRA_DEVS=40 CONFIG_CHR_DEV_ST=m CONFIG_CHR_DEV_OSST=m CONFIG_BLK_DEV_SR=m CONFIG_BLK_DEV_SR_VENDOR=y -CONFIG_SR_EXTRA_DEVS=2 CONFIG_CHR_DEV_SG=m # # Some SCSI devices (e.g. CD jukebox) support multiple LUNs # CONFIG_SCSI_MULTI_LUN=y +CONFIG_SCSI_REPORT_LUNS=y CONFIG_SCSI_CONSTANTS=y # CONFIG_SCSI_LOGGING is not set # # SCSI low-level drivers # -CONFIG_SCSI_SUNESP=y -CONFIG_SCSI_QLOGICPTI=m +CONFIG_BLK_DEV_3W_XXXX_RAID=m +CONFIG_SCSI_ACARD=m +CONFIG_SCSI_AACRAID=m # CONFIG_SCSI_AIC7XXX is not set # CONFIG_SCSI_AIC7XXX_OLD is not set +CONFIG_SCSI_AIC79XX=m +CONFIG_AIC79XX_CMDS_PER_DEVICE=32 +CONFIG_AIC79XX_RESET_DELAY_MS=15000 +# CONFIG_AIC79XX_BUILD_FIRMWARE is not set +# CONFIG_AIC79XX_ENABLE_RD_STRM is not set +# CONFIG_AIC79XX_DEBUG_ENABLE is not set +CONFIG_AIC79XX_DEBUG_MASK=0 +# CONFIG_AIC79XX_REG_PRETTY_PRINT is not set +# CONFIG_SCSI_DPT_I2O is not set +# CONFIG_SCSI_ADVANSYS is not set +# CONFIG_SCSI_MEGARAID is not set +# CONFIG_SCSI_BUSLOGIC is not set +# CONFIG_SCSI_CPQFCTS is not set +CONFIG_SCSI_DMX3191D=m +# CONFIG_SCSI_EATA is not set +CONFIG_SCSI_EATA_PIO=m +# CONFIG_SCSI_FUTURE_DOMAIN is not set +# CONFIG_SCSI_GDTH is not set +# CONFIG_SCSI_INITIO is not set +CONFIG_SCSI_INIA100=m +CONFIG_SCSI_PPA=m +CONFIG_SCSI_IMM=m +# CONFIG_SCSI_IZIP_EPP16 is not set +# CONFIG_SCSI_IZIP_SLOW_CTR is not set CONFIG_SCSI_SYM53C8XX_2=y CONFIG_SCSI_SYM53C8XX_DMA_ADDRESSING_MODE=1 CONFIG_SCSI_SYM53C8XX_DEFAULT_TAGS=16 CONFIG_SCSI_SYM53C8XX_MAX_TAGS=64 # CONFIG_SCSI_SYM53C8XX_IOMAPPED is not set +# CONFIG_SCSI_PCI2000 is not set +# CONFIG_SCSI_PCI2220I is not set CONFIG_SCSI_QLOGIC_ISP=m CONFIG_SCSI_QLOGIC_FC=y CONFIG_SCSI_QLOGIC_FC_FIRMWARE=y +# CONFIG_SCSI_QLOGIC_1280 is not set +CONFIG_SCSI_QLOGICPTI=m +CONFIG_SCSI_DC395x=m +# CONFIG_SCSI_DC390T is not set +# CONFIG_SCSI_NSP32 is not set +CONFIG_SCSI_DEBUG=m +CONFIG_SCSI_SUNESP=y # # Fibre Channel support @@ -966,17 +1004,19 @@ # # Miscellaneous filesystems # -# CONFIG_ADFS_FS is not set +CONFIG_ADFS_FS=m +# CONFIG_ADFS_FS_RW is not set CONFIG_AFFS_FS=m -# CONFIG_HFS_FS is not set +CONFIG_HFS_FS=m CONFIG_BEFS_FS=m # CONFIG_BEFS_DEBUG is not set CONFIG_BFS_FS=m CONFIG_EFS_FS=m -# CONFIG_CRAMFS is not set -# CONFIG_VXFS_FS is not set +CONFIG_CRAMFS=m +CONFIG_VXFS_FS=m CONFIG_HPFS_FS=m -# CONFIG_QNX4FS_FS is not set +CONFIG_QNX4FS_FS=m +# CONFIG_QNX4FS_RW is not set CONFIG_SYSV_FS=m CONFIG_UFS_FS=m CONFIG_UFS_FS_WRITE=y @@ -997,12 +1037,22 @@ CONFIG_SUNRPC=m CONFIG_SUNRPC_GSS=m CONFIG_RPCSEC_GSS_KRB5=m -# CONFIG_SMB_FS is not set +CONFIG_SMB_FS=m +# CONFIG_SMB_NLS_DEFAULT is not set CONFIG_CIFS=m -# CONFIG_NCP_FS is not set +CONFIG_NCP_FS=m +# CONFIG_NCPFS_PACKET_SIGNING is not set +# CONFIG_NCPFS_IOCTL_LOCKING is not set +# CONFIG_NCPFS_STRONG is not set +# CONFIG_NCPFS_NFS_NS is not set +# CONFIG_NCPFS_OS2_NS is not set +# CONFIG_NCPFS_SMALLDOS is not set +# CONFIG_NCPFS_NLS is not set +# CONFIG_NCPFS_EXTRAS is not set CONFIG_CODA_FS=m # CONFIG_INTERMEZZO_FS is not set -# CONFIG_AFS_FS is not set +CONFIG_AFS_FS=m +CONFIG_RXRPC=m # # Partition Types @@ -1010,6 +1060,7 @@ # CONFIG_PARTITION_ADVANCED is not set CONFIG_MSDOS_PARTITION=y CONFIG_SUN_PARTITION=y +CONFIG_SMB_NLS=y CONFIG_NLS=y # @@ -1210,6 +1261,7 @@ # # USB Network adaptors # +CONFIG_USB_AX8817X=m CONFIG_USB_CATC=m CONFIG_USB_KAWETH=m CONFIG_USB_PEGASUS=m diff -urN linux-2.5.72-bk3/drivers/acpi/Kconfig linux-2.5.73/drivers/acpi/Kconfig --- linux-2.5.72-bk3/drivers/acpi/Kconfig 2003-06-16 21:20:27.000000000 -0700 +++ linux-2.5.73/drivers/acpi/Kconfig 2003-06-22 12:03:55.000000000 -0700 @@ -49,12 +49,12 @@ Full ACPI support (CONFIG_ACPI) is preferred. Use this option only if you wish to limit ACPI's role to processor enumeration. - There is no command-line option to disable this, but the kernel - will fall back to the MPS table if the MADT is not present. + In this configuration, ACPI defaults to off. It must be enabled + on the command-line with the "acpismp=force" option. config ACPI_BOOT bool - depends on IA64 && (!IA64_HP_SIM || IA64_SGI_SN) || X86 && ACPI && !ACPI_HT_ONLY || X86 && ACPI + depends on IA64 && (!IA64_HP_SIM || IA64_SGI_SN) || X86 && ACPI && !ACPI_HT_ONLY default y config ACPI_SLEEP @@ -135,6 +135,31 @@ bool "NUMA support" if NUMA && (IA64 && !IA64_HP_SIM || X86 && ACPI && !ACPI_HT_ONLY && !X86_64) default y if IA64 && IA64_SGI_SN +config ACPI_ASUS + tristate "ASUS/Medion Laptop Extras" + depends on X86 && ACPI && !ACPI_HT_ONLY + ---help--- + This driver provides support for extra features of ACPI-compatible + ASUS laptops. As some of Medion laptops are made by ASUS, it may also + support some Medion laptops (such as 9675 for example). It makes all + the extra buttons generate standard ACPI events that go through + /proc/acpi/events, and (on some models) adds support for changing the + display brightness and output, switching the LCD backlight on and off, + and most importantly, allows you to blink those fancy LEDs intended + for reporting mail and wireless status. + + All settings are changed via /proc/acpi/asus directory entries. Owner + and group for these entries can be set with asus_uid and asus_gid + parameters. + + More information and a userspace daemon for handling the extra buttons + at . + + If you have an ACPI-compatible ASUS laptop, say Y or M here. This + driver is still under development, so if your laptop is unsupported or + something works not quite as expected, please use the mailing list + available on the above page (acpi4asus-user@lists.sourceforge.net) + config ACPI_TOSHIBA tristate "Toshiba Laptop Extras" depends on X86 && ACPI && !ACPI_HT_ONLY diff -urN linux-2.5.72-bk3/drivers/acpi/Makefile linux-2.5.73/drivers/acpi/Makefile --- linux-2.5.72-bk3/drivers/acpi/Makefile 2003-06-16 21:20:24.000000000 -0700 +++ linux-2.5.73/drivers/acpi/Makefile 2003-06-22 12:03:55.000000000 -0700 @@ -44,5 +44,6 @@ obj-$(CONFIG_ACPI_SYSTEM) += system.o event.o obj-$(CONFIG_ACPI_DEBUG) += debug.o obj-$(CONFIG_ACPI_NUMA) += numa.o +obj-$(CONFIG_ACPI_ASUS) += asus_acpi.o obj-$(CONFIG_ACPI_TOSHIBA) += toshiba_acpi.o obj-$(CONFIG_ACPI_BUS) += scan.o diff -urN linux-2.5.72-bk3/drivers/acpi/asus_acpi.c linux-2.5.73/drivers/acpi/asus_acpi.c --- linux-2.5.72-bk3/drivers/acpi/asus_acpi.c 1969-12-31 16:00:00.000000000 -0800 +++ linux-2.5.73/drivers/acpi/asus_acpi.c 2003-06-22 12:03:55.000000000 -0700 @@ -0,0 +1,951 @@ +/* + * asus_acpi.c - Asus Laptop ACPI Extras + * + * + * Copyright (C) 2002, 2003 Julien Lerouge, Karol Kozimor + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * + * The development page for this driver is located at + * http://sourceforge.net/projects/acpi4asus/ + * + * Credits: + * Johann Wiesner - Small compile fixes + * John Belmonte - ACPI code for Toshiba laptop was a good starting point. + * + * TODO + * add Fn key status + * Add mode selection on module loading (parameter) -> still necessary ? + * Complete display switching -- may require dirty hacks? + * + */ + +#include +#include +#include +#include +#include +#include +#include + +#define ASUS_ACPI_VERSION "0.24a" + +#define PROC_ASUS "asus" //the directory +#define PROC_MLED "mled" +#define PROC_WLED "wled" +#define PROC_INFOS "info" +#define PROC_LCD "lcd" +#define PROC_BRN "brn" +#define PROC_DISP "disp" + +#define ACPI_HOTK_NAME "Asus Laptop ACPI Extras Driver" +#define ACPI_HOTK_CLASS "hotkey" +#define ACPI_HOTK_DEVICE_NAME "Hotkey" +#define ACPI_HOTK_HID "ATK0100" + +/* + * Some events we use, same for all Asus + */ +#define BR_UP 0x10 +#define BR_DOWN 0x20 + +/* + * Flags for hotk status + */ +#define MLED_ON 0x01 //is MLED ON ? +#define WLED_ON 0x02 + +MODULE_AUTHOR("Julien Lerouge, Karol Kozimor"); +MODULE_DESCRIPTION(ACPI_HOTK_NAME); +MODULE_LICENSE("GPL"); + + +static uid_t asus_uid = 0; +static gid_t asus_gid = 0; +MODULE_PARM(asus_uid, "i"); +MODULE_PARM_DESC(uid, "UID for entries in /proc/acpi/asus.\n"); +MODULE_PARM(asus_gid, "i"); +MODULE_PARM_DESC(gid, "GID for entries in /proc/acpi/asus.\n"); + + +/* For each model, all features implemented */ +struct model_data { + char *name; //name of the laptop + char *mt_mled; //method to handle mled + char *mled_status; //node to handle mled reading + char *mt_wled; //method to handle wled + char *wled_status; //node to handle wled reading + char *mt_lcd_switch; //method to turn LCD ON/OFF + char *lcd_status; //node to read LCD panel state + char *brightness_up; //method to set brightness up + char *brightness_down; //guess what ? + char *brightness_set; //method to set absolute brightness + char *brightness_get; //method to get absolute brightness + char *brightness_status;//node to get brightness + char *display_set; //method to set video output + char *display_get; //method to get video output +}; + +/* + * This is the main structure, we can use it to store anything interesting + * about the hotk device + */ +struct asus_hotk { + struct acpi_device *device; //the device we are in + acpi_handle handle; //the handle of the hotk device + char status; //status of the hotk, for LEDs, ... + struct model_data *methods; //methods available on the laptop + u8 brightness; //brighness level + enum { + L2X = 0, //L200D -> TODO check Q11 (Fn+F8) + // Calling this method simply hang the + // computer, ISMI method hangs the laptop. + L3X, //L3C + L3D, //L3400D + M2X, //M2400E + S1X, //S1300A -> TODO special keys do not work ? + D1X, //D1 + L1X, //L1400B + A1X, //A1340D, A1300F + J1X, //S200 (J1) + //TODO A1370D does not seems to have a ATK device + // L8400 model doesn't have ATK + END_MODEL, + } model; //Models currently supported + u16 event_count[128]; //count for each event TODO make this better +}; + +/* Here we go */ +#define L3X_PREFIX "\\_SB.PCI0.PX40.ECD0." +#define S1X_PREFIX "\\_SB.PCI0.PX40." +#define L1X_PREFIX S1X_PREFIX +#define A1X_PREFIX "\\_SB.PCI0.ISA.EC0." +#define J1X_PREFIX A1X_PREFIX + +static struct model_data model_conf[END_MODEL] = { + /* + * name| mled |mled read| wled |wled read| lcd sw |lcd read | + * br up|br down | br set | br read | br status|set disp | get disp + * + * br set and read shall be in hotk device ! + * same for set disp + * + * TODO I have seen a SWBX and AIBX method on some models, like L1400B, + * it seems to be a kind of switch, but what for ? + * + */ + {"L2X", "MLED", "\\SGP6", "WLED", "\\RCP3", "\\Q10", "\\SGP0", + "\\Q0E", "\\Q0F", NULL, NULL, NULL, "SDSP", "\\INFB"}, + + {"L3X", "MLED", NULL, "WLED", NULL, L3X_PREFIX "_Q10", "\\GL32", + L3X_PREFIX "_Q0F", L3X_PREFIX "_Q0E", "SPLV", "GPLV", "\\BLVL", "SDSP", + "\\_SB.PCI0.PCI1.VGAC.NMAP"}, + + {"L3D", "MLED", "\\MALD", "WLED", NULL, "\\Q10", "\\BKLG", + "\\Q0E", "\\Q0F", "SPLV", "GPLV", "\\BLVL", "SDSP", "\\INFB"}, + + {"M2X", "MLED", NULL, "WLED", NULL, "\\Q10", "\\GP06", + "\\Q0E","\\Q0F", "SPLV", "GPLV", NULL, "SDSP", "\\INFB"}, + + {"S1X", "MLED", "\\EMLE", "WLED", NULL, S1X_PREFIX "Q10", "\\PNOF", + S1X_PREFIX "Q0F", S1X_PREFIX "Q0E", "SPLV", "GPLV", "\\BRIT", NULL, NULL}, + + {"D1X", "MLED", NULL, NULL, NULL, "\\Q0D", "\\GP11", + "\\Q0C", "\\Q0B", NULL, NULL, "\\BLVL", "SDSP","\\INFB"}, + + {"L1X", "MLED", NULL, "WLED", NULL, L1X_PREFIX "Q10", "\\PNOF", + L1X_PREFIX "Q0F", L1X_PREFIX "Q0E", "SPLV", "GPLV", "\\BRIT", NULL, NULL}, + + {"A1X", "MLED", "\\MAIL", NULL, NULL, A1X_PREFIX "_Q10", "\\BKLI", + A1X_PREFIX "_Q0E", A1X_PREFIX "_Q0F", NULL, NULL, NULL, NULL, NULL}, + + {"J1X", "MLED", "\\MAIL", NULL, NULL, J1X_PREFIX "_Q10", "\\BKLI", + J1X_PREFIX "_Q0B", J1X_PREFIX "_Q0A", NULL, NULL, NULL, NULL, NULL} +}; + +/* procdir we use */ +static struct proc_dir_entry *asus_proc_dir = NULL; + +/* + * This header is made available to allow proper configuration given model, + * revision number , ... this info cannot go in struct asus_hotk because it is + * available before the hotk + */ +static struct acpi_table_header *asus_info = NULL; + +/* + * The hotkey driver declaration + */ +static int asus_hotk_add(struct acpi_device *device); +static int asus_hotk_remove(struct acpi_device *device, int type); +static struct acpi_driver asus_hotk_driver = { + .name = ACPI_HOTK_NAME, + .class = ACPI_HOTK_CLASS, + .ids = ACPI_HOTK_HID, + .ops = { + .add = asus_hotk_add, + .remove = asus_hotk_remove, + }, +}; + +/* + * This function evaluates an ACPI method, given an int as parameter, the + * method is searched within the scope of the handle, can be NULL. The output + * of the method is written is output, which can also be NULL + * + * returns 1 if write is successful, 0 else. + */ +static int write_acpi_int(acpi_handle handle, const char *method, int val, + struct acpi_buffer *output) +{ + struct acpi_object_list params; //list of input parameters (an int here) + union acpi_object in_obj; //the only param we use + acpi_status status; + + params.count = 1; + params.pointer = &in_obj; + in_obj.type = ACPI_TYPE_INTEGER; + in_obj.integer.value = val; + + status = acpi_evaluate_object(handle, (char *) method, ¶ms, output); + return (status == AE_OK); +} + + +static int read_acpi_int(acpi_handle handle, const char *method, int *val) +{ + struct acpi_buffer output; + union acpi_object out_obj; + acpi_status status; + + output.length = sizeof(out_obj); + output.pointer = &out_obj; + + status = acpi_evaluate_object(handle, (char*) method, NULL, &output); + *val = out_obj.integer.value; + return (status == AE_OK) && (out_obj.type == ACPI_TYPE_INTEGER); +} + +/* + * We write our info in page, we begin at offset off and cannot write more + * than count bytes. We set eof to 1 if we handle those 2 values. We return the + * number of bytes written in page + */ +static int +proc_read_info(char *page, char **start, off_t off, int count, int *eof, + void *data) +{ + int len = 0; + struct asus_hotk *hotk = (struct asus_hotk *) data; + char buf[16]; //enough for all info + /* + * We use the easy way, we don't care of off and count, so we don't set eof + * to 1 + */ + + len += sprintf(page, ACPI_HOTK_NAME " " ASUS_ACPI_VERSION "\n"); + len += + sprintf(page + len, "Model reference : %s\n", + hotk->methods->name); + if (asus_info) { + snprintf(buf, 5, "%s", asus_info->signature); + len += sprintf(page + len, "ACPI signature : %s\n", buf); + snprintf(buf, 16, "%d", asus_info->length); + len += sprintf(page + len, "Table length : %s\n", buf); + snprintf(buf, 16, "%d", asus_info->revision); + len += sprintf(page + len, "ACPI minor version : %s\n", buf); + snprintf(buf, 16, "%d", asus_info->checksum); + len += sprintf(page + len, "Checksum : %s\n", buf); + snprintf(buf, 7, "%s", asus_info->oem_id); + len += sprintf(page + len, "OEM identification : %s\n", buf); + snprintf(buf, 9, "%s", asus_info->oem_table_id); + len += sprintf(page + len, "OEM table id : %s\n", buf); + snprintf(buf, 16, "%x", asus_info->oem_revision); + len += sprintf(page + len, "OEM rev number : 0x%s\n", buf); + snprintf(buf, 5, "%s", asus_info->asl_compiler_id); + len += sprintf(page + len, "ASL comp vendor ID : %s\n", buf); + snprintf(buf, 16, "%x", asus_info->asl_compiler_revision); + len += sprintf(page + len, "ASL comp rev number: 0x%s\n", buf); + } + + return len; +} + + +/* + * proc file handlers + */ +static int +proc_read_mled(char *page, char **start, off_t off, int count, int *eof, + void *data) +{ + int len = 0; + struct asus_hotk *hotk = (struct asus_hotk *) data; + int led_status = 0; + /* + * We use the easy way, we don't care of off and count, so we don't set eof + * to 1 + */ + if (hotk->methods->mled_status) { + if (read_acpi_int(NULL, hotk->methods->mled_status, + &led_status)) + len = sprintf(page, "%d\n", led_status); + else + printk(KERN_NOTICE "Asus ACPI: Error reading MLED " + "status\n"); + } else { + len = sprintf(page, "%d\n", (hotk->status & MLED_ON) ? 1 : 0); + } + + return len; +} + + +static int +proc_write_mled(struct file *file, const char *buffer, + unsigned long count, void *data) +{ + int value; + int led_out = 0; + struct asus_hotk *hotk = (struct asus_hotk *) data; + + + + /* scan expression. Multiple expressions may be delimited with ; */ + if (sscanf(buffer, "%i", &value) == 1) + led_out = ~value & 1; + + hotk->status = + (value) ? (hotk->status | MLED_ON) : (hotk->status & ~MLED_ON); + + /* We don't have to check mt_mled exists if we are here :) */ + if (!write_acpi_int(hotk->handle, hotk->methods->mt_mled, led_out, + NULL)) + printk(KERN_NOTICE "Asus ACPI: MLED write failed\n"); + + + + return count; +} + +/* + * We write our info in page, we begin at offset off and cannot write more + * than count bytes. We set eof to 1 if we handle those 2 values. We return the + * number of bytes written in page + */ +static int +proc_read_wled(char *page, char **start, off_t off, int count, int *eof, + void *data) +{ + int len = 0; + struct asus_hotk *hotk = (struct asus_hotk *) data; + int led_status; + + if (hotk->methods->wled_status) { + if (read_acpi_int(NULL, hotk->methods->mled_status, + &led_status)) + len = sprintf(page, "%d\n", led_status); + else + printk(KERN_NOTICE "Asus ACPI: Error reading WLED " + "status\n"); + } else { + len = sprintf(page, "%d\n", (hotk->status & WLED_ON) ? 1 : 0); + } + + return len; +} + +static int +proc_write_wled(struct file *file, const char *buffer, + unsigned long count, void *data) +{ + int value; + int led_out = 0; + struct asus_hotk *hotk = (struct asus_hotk *) data; + + /* scan expression. Multiple expressions may be delimited with ; */ + if (sscanf(buffer, "%i", &value) == 1) + led_out = value & 1; + + hotk->status = + (value) ? (hotk->status | WLED_ON) : (hotk->status & ~WLED_ON); + + /* We don't have to check if mt_wled exists if we are here :) */ + if (!write_acpi_int(hotk->handle, hotk->methods->mt_wled, led_out, + NULL)) + printk(KERN_NOTICE "Asus ACPI: WLED write failed\n"); + + + return count; +} + + +static int get_lcd_state(struct asus_hotk *hotk) +{ + int lcd = 0; + + /* We don't have to check anything, if we are here */ + if (!read_acpi_int(NULL, hotk->methods->lcd_status, &lcd)) + printk(KERN_NOTICE "Asus ACPI: Error reading LCD status\n"); + + if (hotk->model == L2X) + lcd = ~lcd; + + return (lcd & 1); +} + + +static int +proc_read_lcd(char *page, char **start, off_t off, int count, int *eof, + void *data) +{ + return sprintf(page, "%d\n", get_lcd_state((struct asus_hotk *) data)); +} + + +static int +proc_write_lcd(struct file *file, const char *buffer, + unsigned long count, void *data) +{ + int value; + int lcd = 0; + acpi_status status = 0; + int lcd_status = 0; + struct asus_hotk *hotk = (struct asus_hotk *) data; + + /* scan expression. Multiple expressions may be delimited with ; */ + if (sscanf(buffer, "%i", &value) == 1) + lcd = value & 1; + + lcd_status = get_lcd_state(hotk); + + if (lcd_status != lcd) { + /* switch */ + status = + acpi_evaluate_object(NULL, hotk->methods->mt_lcd_switch, + NULL, NULL); + if (ACPI_FAILURE(status)) + printk(KERN_NOTICE "Asus ACPI: Error switching LCD\n"); + } + + return count; +} + + +/* + * Change the brightness level + */ +static void set_brightness(int value, struct asus_hotk *hotk) +{ + acpi_status status = 0; + + /* ATKD laptop */ + if(hotk->methods->brightness_set) { + if (!write_acpi_int(hotk->handle, hotk->methods->brightness_set, + value, NULL)) + printk(KERN_NOTICE "Asus ACPI: Error changing brightness\n"); + return; + } + + /* HOTK laptop if we are here, act as appropriate */ + value -= hotk->brightness; + while (value != 0) { + status = acpi_evaluate_object(NULL, (value > 0) ? + hotk->methods->brightness_up : + hotk->methods->brightness_down, + NULL, NULL); + (value > 0) ? value-- : value++; + if (ACPI_FAILURE(status)) + printk(KERN_NOTICE "Asus ACPI: Error changing brightness\n"); + } + return; +} + +static int read_brightness(struct asus_hotk *hotk) +{ + int value; + + if(hotk->methods->brightness_get) { /* ATKD laptop */ + if (!read_acpi_int(hotk->handle, hotk->methods->brightness_get, + &value)) + printk(KERN_NOTICE "Asus ACPI: Error reading brightness\n"); + } else if (hotk->methods->brightness_status) { /* For D1 for example */ + if (!read_acpi_int(NULL, hotk->methods->brightness_status, + &value)) + printk(KERN_NOTICE "Asus ACPI: Error reading brightness\n"); + } else /* HOTK laptop */ + value = hotk->brightness; + return value; +} + +static int +proc_read_brn(char *page, char **start, off_t off, int count, int *eof, + void *data) +{ + struct asus_hotk *hotk = (struct asus_hotk *) data; + return sprintf(page, "%d\n", read_brightness(hotk)); +} + +static int +proc_write_brn(struct file *file, const char *buffer, + unsigned long count, void *data) +{ + int value; + struct asus_hotk *hotk = (struct asus_hotk *) data; + + /* scan expression. Multiple expressions may be delimited with ; */ + if (sscanf(buffer, "%d", &value) == 1) { + value = (0 < value) ? ((15 < value) ? 15 : value) : 0; + /* 0 <= value <= 15 */ + set_brightness(value, hotk); + } else { + printk(KERN_NOTICE "Asus ACPI: Error reading user input\n"); + } + + return count; +} + +static void set_display(int value, struct asus_hotk *hotk) +{ + /* no sanity check needed for now */ + if (!write_acpi_int(hotk->handle, hotk->methods->display_set, + value, NULL)) + printk(KERN_NOTICE "Asus ACPI: Error setting display\n"); + return; +} + +/* + * Now, *this* one could be more user-friendly, but so far, no-one has + * complained. The significance of bits is the same as in proc_write_disp() + */ + +static int +proc_read_disp(char *page, char **start, off_t off, int count, int *eof, + void *data) +{ + int value = 0; + struct asus_hotk *hotk = (struct asus_hotk *) data; + + if (!read_acpi_int(hotk->handle, hotk->methods->display_get, &value)) + printk(KERN_NOTICE "Asus ACPI: Error reading display status\n"); + return sprintf(page, "%d\n", value); +} + +/* + * Preliminary support for display switching. As of now: 0x01 should activate + * the LCD output, 0x02 should do for CRT, and 0x04 for TV-Out. Any combination + * (bitwise) of these will suffice. I never actually tested 3 displays hooked up + * simultaneously, so be warned. + */ + +static int +proc_write_disp(struct file *file, const char *buffer, + unsigned long count, void *data) +{ + int value; + struct asus_hotk *hotk = (struct asus_hotk *) data; + + /* scan expression. Multiple expressions may be delimited with ; */ + if (sscanf(buffer, "%d", &value) == 1) + set_display(value, hotk); + else { + printk(KERN_NOTICE "Asus ACPI: Error reading user input\n"); + } + + return count; +} + +static int asus_hotk_add_fs(struct acpi_device *device) +{ + struct proc_dir_entry *proc; + struct asus_hotk *hotk = acpi_driver_data(device); + mode_t mode; + + /* + * If parameter uid or gid is not changed, keep the default setting for + * our proc entries (-rw-rw-rw-) else, it means we care about security, + * and then set to -rw-rw---- + */ + + if ((asus_uid == 0) && (asus_gid == 0)){ + mode = S_IFREG | S_IRUGO | S_IWUGO; + }else{ + mode = S_IFREG | S_IRUSR | S_IRGRP | S_IWUSR | S_IWGRP; + } + + acpi_device_dir(device) = asus_proc_dir; + if (!acpi_device_dir(device)) + return(-ENODEV); + + proc = create_proc_entry(PROC_INFOS, mode, acpi_device_dir(device)); + if (proc) { + proc->read_proc = proc_read_info; + proc->data = acpi_driver_data(device); + proc->owner = THIS_MODULE; + proc->uid = asus_uid; + proc->gid = asus_gid;; + } else { + printk(KERN_NOTICE " Unable to create " PROC_INFOS + " fs entry\n"); + } + + if (hotk->methods->mt_wled) { + proc = create_proc_entry(PROC_WLED, mode, acpi_device_dir(device)); + if (proc) { + proc->write_proc = proc_write_wled; + proc->read_proc = proc_read_wled; + proc->data = acpi_driver_data(device); + proc->owner = THIS_MODULE; + proc->uid = asus_uid; + proc->gid = asus_gid;; + } else { + printk(KERN_NOTICE " Unable to create " PROC_WLED + " fs entry\n"); + } + } + + if (hotk->methods->mt_mled) { + proc = create_proc_entry(PROC_MLED, mode, acpi_device_dir(device)); + if (proc) { + proc->write_proc = proc_write_mled; + proc->read_proc = proc_read_mled; + proc->data = acpi_driver_data(device); + proc->owner = THIS_MODULE; + proc->uid = asus_uid; + proc->gid = asus_gid;; + } else { + printk(KERN_NOTICE " Unable to create " PROC_MLED + " fs entry\n"); + } + } + + /* + * We need both read node and write method as LCD switch is also accessible + * from keyboard + */ + if (hotk->methods->mt_lcd_switch && hotk->methods->lcd_status) { + proc = create_proc_entry(PROC_LCD, mode, acpi_device_dir(device)); + if (proc) { + proc->write_proc = proc_write_lcd; + proc->read_proc = proc_read_lcd; + proc->data = acpi_driver_data(device); + proc->owner = THIS_MODULE; + proc->uid = asus_uid; + proc->gid = asus_gid;; + } else { + printk(KERN_NOTICE " Unable to create " PROC_LCD + " fs entry\n"); + } + } + + if ((hotk->methods->brightness_up && hotk->methods->brightness_down) || + (hotk->methods->brightness_get && hotk->methods->brightness_get)) { + proc = create_proc_entry(PROC_BRN, mode, acpi_device_dir(device)); + if (proc) { + proc->write_proc = proc_write_brn; + proc->read_proc = proc_read_brn; + proc->data = acpi_driver_data(device); + proc->owner = THIS_MODULE; + proc->uid = asus_uid; + proc->gid = asus_gid;; + } else { + printk(KERN_NOTICE " Unable to create " PROC_BRN + " fs entry\n"); + } + } + + if (hotk->methods->display_set) { + proc = create_proc_entry(PROC_DISP, mode, acpi_device_dir(device)); + if (proc) { + proc->write_proc = proc_write_disp; + proc->read_proc = proc_read_disp; + proc->data = acpi_driver_data(device); + proc->owner = THIS_MODULE; + proc->uid = asus_uid; + proc->gid = asus_gid;; + } else { + printk(KERN_NOTICE " Unable to create " PROC_DISP + " fs entry\n"); + } + } + + return (AE_OK); +} + + +static void asus_hotk_notify(acpi_handle handle, u32 event, void *data) +{ + /* TODO Find a better way to handle events count. Here, in data, we receive + * the hotk, so we can make anything !! + */ + struct asus_hotk *hotk = (struct asus_hotk *) data; + + if (!hotk) + return; + + if ((event & ~((u32) BR_UP)) < 16) { + hotk->brightness = (event & ~((u32) BR_UP)); + } else if ((event & ~((u32) BR_DOWN)) < 16 ) { + hotk->brightness = (event & ~((u32) BR_DOWN)); + } + + acpi_bus_generate_event(hotk->device, event, + hotk->event_count[event % 128]++); + + return; +} + +/* + * 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(struct asus_hotk *hotk) +{ + struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; + union acpi_object *model = NULL; + + /* + * We have to write 0 on init this far for all ASUS models + */ + if (!write_acpi_int(hotk->handle, "INIT", 0, &buffer)) { + printk(KERN_NOTICE " Hotkey initialization failed\n"); + return -ENODEV; + } + + /* + * Here, we also use asus_info to make decision. For example, on INIT + * method, S1X and L1X models both reports to be L84F, but they don't + * have the same methods (L1X has WLED, S1X don't) + */ + model = (union acpi_object *) buffer.pointer; + if (model->type == ACPI_TYPE_STRING) { + printk(KERN_NOTICE " %s model detected, ", model->string.pointer); + } + + hotk->model = END_MODEL; + if (strncmp(model->string.pointer, "L3D", 3) == 0) + hotk->model = L3D; + /* + * L2B has same settings that L3X, except for GL32, but as + * there is no node to get the LCD status, and as GL32 is never + * used anywhere else, I assume it's safe, even if lcd get is + * broken for this model (TODO fix it ?) + */ + else if (strncmp(model->string.pointer, "L3", 2) == 0 || + strncmp(model->string.pointer, "L2B", 3) == 0) + hotk->model = L3X; + else if (strncmp(model->string.pointer, "M2", 2) == 0) + hotk->model = M2X; + else if (strncmp(model->string.pointer, "L2", 2) == 0) + hotk->model = L2X; + else if (strncmp(model->string.pointer, "L8", 2) == 0) + /* S1300A reports L84F, but L1400B too */ + if (strncmp(asus_info->oem_table_id, "L1", 2) == 0) + hotk->model = L1X; + else + hotk->model = S1X; + else if (strncmp(model->string.pointer, "D1", 2) == 0) + hotk->model = D1X; + else if (strncmp(model->string.pointer, "A1", 2) == 0) + hotk->model = A1X; + else if (strncmp(model->string.pointer, "J1", 2) == 0) + hotk->model = J1X; + + + if (hotk->model == END_MODEL) { + /* By default use the same values, as I don't know others */ + printk("unsupported, trying default values, contact the " + "developers\n"); + hotk->model = L2X; + } else { + printk("supported\n"); + } + + hotk->methods = &model_conf[hotk->model]; + + acpi_os_free(model); + + return AE_OK; +} + + + +static int asus_hotk_check(struct asus_hotk *hotk) +{ + int result = 0; + + if (!hotk) + return(-EINVAL); + + result = acpi_bus_get_status(hotk->device); + if (result) + return(result); + + if (hotk->device->status.present) { + result = asus_hotk_get_info(hotk); + } else { + printk(KERN_NOTICE " Hotkey device not present, aborting\n"); + return(-EINVAL); + } + + return(result); +} + + + +static int asus_hotk_add(struct acpi_device *device) +{ + struct asus_hotk *hotk = NULL; + acpi_status status = AE_OK; + int result; + + if (!device) + return(-EINVAL); + + hotk = + (struct asus_hotk *) kmalloc(sizeof(struct asus_hotk), GFP_KERNEL); + if (!hotk) + return(-ENOMEM); + memset(hotk, 0, sizeof(struct asus_hotk)); + + hotk->handle = device->handle; + sprintf(acpi_device_name(device), "%s", ACPI_HOTK_DEVICE_NAME); + sprintf(acpi_device_class(device), "%s", ACPI_HOTK_CLASS); + acpi_driver_data(device) = hotk; + hotk->device = device; + + + result = asus_hotk_check(hotk); + if (result) + goto end; + + result = asus_hotk_add_fs(device); + if (result) + goto end; + + /* + * We install the handler, it will receive the hotk in parameter, so, we + * could add other data to the hotk struct + */ + status = acpi_install_notify_handler(hotk->handle, ACPI_SYSTEM_NOTIFY, + asus_hotk_notify, hotk); + if (ACPI_FAILURE(status)) { + printk(KERN_NOTICE + " Error installing notify handler\n"); + } else { + printk(KERN_DEBUG + " Notify Handler installed successfully\n"); + } + + /* For HOTK laptops: init the hotk->brightness value */ + if ((!hotk->methods->brightness_get) && (!hotk->methods->brightness_status) && + (hotk->methods->brightness_up && hotk->methods->brightness_down)) { + status = acpi_evaluate_object(NULL, hotk->methods->brightness_down, + NULL, NULL); + if (ACPI_FAILURE(status)) + printk(KERN_NOTICE " Error changing brightness\n"); + status = acpi_evaluate_object(NULL, hotk->methods->brightness_up, + NULL, NULL); + if (ACPI_FAILURE(status)) + printk(KERN_NOTICE " Error changing brightness\n"); + } + + end: + if (result) { + kfree(hotk); + } + + return(result); +} + + + + +static int asus_hotk_remove(struct acpi_device *device, int type) +{ + acpi_status status = 0; + struct asus_hotk *hotk = NULL; + + if (!device || !acpi_driver_data(device)) + return(-EINVAL); + + hotk = (struct asus_hotk *) acpi_driver_data(device); + + status = acpi_remove_notify_handler(hotk->handle, ACPI_SYSTEM_NOTIFY, + asus_hotk_notify); + if (ACPI_FAILURE(status)) + printk(KERN_NOTICE "Error removing notify handler\n"); + + kfree(hotk); + + return(0); +} + + + + +static int __init asus_acpi_init(void) +{ + int result = 0; + acpi_status status = 0; + struct acpi_buffer dsdt = { ACPI_ALLOCATE_BUFFER, NULL }; + + printk(KERN_NOTICE "Asus Laptop ACPI Extras version %s\n", + ASUS_ACPI_VERSION); + /* + * Here is the code to know the model we are running on. We need to + * know this before calling the acpi_bus_register_driver function, in + * case the HID for the laptop we are running on is different from + * ACPI_HOTK_HID, which I have never seen yet :) + * + * This information is then available in the global var asus_info + */ + status = acpi_get_table(ACPI_TABLE_DSDT, 1, &dsdt); + if (ACPI_FAILURE(status)) { + printk(KERN_NOTICE " Couldn't get the DSDT table header\n"); + } else { + asus_info = (struct acpi_table_header *) dsdt.pointer; + } + + asus_proc_dir = proc_mkdir(PROC_ASUS, acpi_root_dir); + if (!asus_proc_dir) + return(-ENODEV); + asus_proc_dir->owner = THIS_MODULE; + + result = acpi_bus_register_driver(&asus_hotk_driver); + if (result < 0) { + printk(KERN_NOTICE " Error registering " ACPI_HOTK_NAME " \n"); + remove_proc_entry(PROC_ASUS, acpi_root_dir); + return(-ENODEV); + } + + return(0); +} + + + +static void __exit asus_acpi_exit(void) +{ + acpi_bus_unregister_driver(&asus_hotk_driver); + remove_proc_entry(PROC_ASUS, acpi_root_dir); + + acpi_os_free(asus_info); + + return; +} + +module_init(asus_acpi_init); +module_exit(asus_acpi_exit); diff -urN linux-2.5.72-bk3/drivers/acpi/dispatcher/dsmthdat.c linux-2.5.73/drivers/acpi/dispatcher/dsmthdat.c --- linux-2.5.72-bk3/drivers/acpi/dispatcher/dsmthdat.c 2003-06-16 21:19:59.000000000 -0700 +++ linux-2.5.73/drivers/acpi/dispatcher/dsmthdat.c 2003-06-22 12:03:56.000000000 -0700 @@ -306,7 +306,6 @@ { acpi_status status; struct acpi_namespace_node *node; - union acpi_operand_object *new_desc = object; ACPI_FUNCTION_TRACE ("ds_method_data_set_value"); @@ -325,28 +324,16 @@ } /* - * If the object has just been created and is not attached to anything, - * (the reference count is 1), then we can just store it directly into - * the arg/local. Otherwise, we must copy it. + * 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) */ - if (object->common.reference_count > 1) { - status = acpi_ut_copy_iobject_to_iobject (object, &new_desc, walk_state); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); - } - - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Object Copied %p, new %p\n", - object, new_desc)); - } - else { - /* Increment ref count so object can't be deleted while installed */ - - acpi_ut_add_reference (new_desc); - } + acpi_ut_add_reference (object); /* Install the object */ - node->object = new_desc; + node->object = object; return_ACPI_STATUS (status); } diff -urN linux-2.5.72-bk3/drivers/acpi/events/evgpe.c linux-2.5.73/drivers/acpi/events/evgpe.c --- linux-2.5.72-bk3/drivers/acpi/events/evgpe.c 2003-06-16 21:20:05.000000000 -0700 +++ linux-2.5.73/drivers/acpi/events/evgpe.c 2003-06-22 12:03:56.000000000 -0700 @@ -186,11 +186,13 @@ } ACPI_DEBUG_PRINT ((ACPI_DB_INTERRUPTS, - "GPE block at %8.8X%8.8X - Values: Enable %02X Status %02X\n", + "GPE pair: Status %8.8X%8.8X = %02X, Enable %8.8X%8.8X = %02X\n", + ACPI_HIDWORD (gpe_register_info->status_address.address), + ACPI_LODWORD (gpe_register_info->status_address.address), + gpe_register_info->status, ACPI_HIDWORD (gpe_register_info->enable_address.address), ACPI_LODWORD (gpe_register_info->enable_address.address), - gpe_register_info->enable, - gpe_register_info->status)); + gpe_register_info->enable)); /* First check if there is anything active at all in this register */ diff -urN linux-2.5.72-bk3/drivers/acpi/events/evgpeblk.c linux-2.5.73/drivers/acpi/events/evgpeblk.c --- linux-2.5.72-bk3/drivers/acpi/events/evgpeblk.c 2003-06-16 21:20:02.000000000 -0700 +++ linux-2.5.73/drivers/acpi/events/evgpeblk.c 2003-06-22 12:03:56.000000000 -0700 @@ -76,9 +76,14 @@ /* No need for spin lock since we are not changing any list elements */ + /* Walk the GPE interrupt levels */ + gpe_xrupt_block = acpi_gbl_gpe_xrupt_list_head; while (gpe_xrupt_block) { gpe_block = gpe_xrupt_block->gpe_block_list_head; + + /* Walk the GPE blocks on this interrupt level */ + while (gpe_block) { if ((&gpe_block->event_info[0] <= gpe_event_info) && (&gpe_block->event_info[((acpi_size) gpe_block->register_count) * 8] > gpe_event_info)) { @@ -155,7 +160,7 @@ * * PARAMETERS: Callback from walk_namespace * - * RETURN: None + * RETURN: Status * * DESCRIPTION: Called from acpi_walk_namespace. Expects each object to be a * control method under the _GPE portion of the namespace. @@ -164,10 +169,10 @@ * * The name of each GPE control method is of the form: * "_Lnn" or "_Enn" - * Where: - * L - means that the GPE is level triggered - * E - means that the GPE is edge triggered - * nn - is the GPE number [in HEX] + * Where: + * L - means that the GPE is level triggered + * E - means that the GPE is edge triggered + * nn - is the GPE number [in HEX] * ******************************************************************************/ @@ -196,7 +201,8 @@ name[ACPI_NAME_SIZE] = 0; /* - * Edge/Level determination is based on the 2nd character of the method name + * Edge/Level determination is based on the 2nd character + * of the method name */ switch (name[1]) { case 'L': @@ -249,15 +255,14 @@ gpe_event_info->flags = type; gpe_event_info->method_node = (struct acpi_namespace_node *) obj_handle; - /* - * Enable the GPE (SCIs should be disabled at this point) - */ + /* Enable the GPE (SCIs should be disabled at this point) */ + status = acpi_hw_enable_gpe (gpe_event_info); if (ACPI_FAILURE (status)) { return_ACPI_STATUS (status); } - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, + ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "Registered GPE method %s as GPE number 0x%.2X\n", name, gpe_number)); return_ACPI_STATUS (AE_OK); @@ -867,8 +872,8 @@ } /* - * GPE0 and GPE1 do not have to be contiguous in the GPE number space, - * But, GPE0 always starts at zero. + * GPE0 and GPE1 do not have to be contiguous in the GPE number + * space. However, GPE0 always starts at GPE number zero. */ gpe_number_max = acpi_gbl_FADT->gpe1_base + ((register_count1 * ACPI_GPE_REGISTER_WIDTH) - 1); diff -urN linux-2.5.72-bk3/drivers/acpi/executer/exoparg1.c linux-2.5.73/drivers/acpi/executer/exoparg1.c --- linux-2.5.72-bk3/drivers/acpi/executer/exoparg1.c 2003-06-16 21:20:22.000000000 -0700 +++ linux-2.5.73/drivers/acpi/executer/exoparg1.c 2003-06-22 12:03:56.000000000 -0700 @@ -222,7 +222,7 @@ union acpi_operand_object *return_desc2 = NULL; u32 temp32; u32 i; - u32 j; + u32 power_of_ten; acpi_integer digit; @@ -291,61 +291,70 @@ case AML_FROM_BCD_OP: /* from_bcd (BCDValue, Result) */ /* - * The 64-bit ACPI integer can hold 16 4-bit BCD integers + * The 64-bit ACPI integer can hold 16 4-bit BCD characters + * (if table is 32-bit, integer can hold 8 BCD characters) + * Convert each 4-bit BCD value */ + power_of_ten = 1; return_desc->integer.value = 0; - for (i = 0; i < ACPI_MAX_BCD_DIGITS; i++) { - /* Get one BCD digit */ + digit = operand[0]->integer.value; - digit = (acpi_integer) ((operand[0]->integer.value >> (i * 4)) & 0xF); + /* Convert each BCD digit (each is one nybble wide) */ + + for (i = 0; (i < acpi_gbl_integer_nybble_width) && (digit > 0); i++) { + /* Get the least significant 4-bit BCD digit */ + + temp32 = ((u32) digit) & 0xF; /* Check the range of the digit */ - if (digit > 9) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "BCD digit too large: %d\n", - (u32) digit)); + if (temp32 > 9) { + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, + "BCD digit too large (not decimal): 0x%X\n", + temp32)); + status = AE_AML_NUMERIC_OVERFLOW; goto cleanup; } - if (digit > 0) { - /* Sum into the result with the appropriate power of 10 */ + /* Sum the digit into the result with the current power of 10 */ - for (j = 0; j < i; j++) { - digit *= 10; - } + return_desc->integer.value += (((acpi_integer) temp32) * power_of_ten); - return_desc->integer.value += digit; - } + /* Shift to next BCD digit */ + + digit >>= 4; + + /* Next power of 10 */ + + power_of_ten *= 10; } break; case AML_TO_BCD_OP: /* to_bcd (Operand, Result) */ - if (operand[0]->integer.value > ACPI_MAX_BCD_VALUE) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "BCD overflow: %8.8X%8.8X\n", - ACPI_HIDWORD(operand[0]->integer.value), - ACPI_LODWORD(operand[0]->integer.value))); - status = AE_AML_NUMERIC_OVERFLOW; - goto cleanup; - } - return_desc->integer.value = 0; - for (i = 0; i < ACPI_MAX_BCD_DIGITS; i++) { - /* Divide by nth factor of 10 */ + digit = operand[0]->integer.value; - temp32 = 0; - digit = operand[0]->integer.value; - for (j = 0; j < i; j++) { - (void) acpi_ut_short_divide (&digit, 10, &digit, &temp32); - } + /* Each BCD digit is one nybble wide */ - /* Create the BCD digit from the remainder above */ + for (i = 0; (i < acpi_gbl_integer_nybble_width) && (digit > 0); i++) { + (void) acpi_ut_short_divide (&digit, 10, &digit, &temp32); - if (digit > 0) { - return_desc->integer.value += ((acpi_integer) temp32 << (i * 4)); - } + /* Insert the BCD digit that resides in the remainder from above */ + + return_desc->integer.value |= (((acpi_integer) temp32) << (i * 4)); + } + + /* Overflow if there is any data left in Digit */ + + if (digit > 0) { + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Integer too large to convert to BCD: %8.8X%8.8X\n", + ACPI_HIDWORD(operand[0]->integer.value), + ACPI_LODWORD(operand[0]->integer.value))); + status = AE_AML_NUMERIC_OVERFLOW; + goto cleanup; } break; diff -urN linux-2.5.72-bk3/drivers/acpi/executer/exstore.c linux-2.5.73/drivers/acpi/executer/exstore.c --- linux-2.5.72-bk3/drivers/acpi/executer/exstore.c 2003-06-16 21:20:00.000000000 -0700 +++ linux-2.5.73/drivers/acpi/executer/exstore.c 2003-06-22 12:03:56.000000000 -0700 @@ -190,8 +190,8 @@ case ACPI_TYPE_INTEGER: ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "%8.8X%8.8X\n", - ACPI_HIWORD (source_desc->integer.value), - ACPI_LOWORD (source_desc->integer.value))); + ACPI_HIDWORD (source_desc->integer.value), + ACPI_LODWORD (source_desc->integer.value))); break; diff -urN linux-2.5.72-bk3/drivers/acpi/executer/exsystem.c linux-2.5.73/drivers/acpi/executer/exsystem.c --- linux-2.5.72-bk3/drivers/acpi/executer/exsystem.c 2003-06-16 21:20:07.000000000 -0700 +++ linux-2.5.73/drivers/acpi/executer/exsystem.c 2003-06-22 12:03:56.000000000 -0700 @@ -134,7 +134,7 @@ acpi_ex_exit_interpreter (); - acpi_os_stall (how_long); + acpi_os_sleep (0, (how_long / 1000) + 1); /* And now we must get the interpreter again */ @@ -142,7 +142,7 @@ } else { - acpi_os_sleep (0, (how_long / 1000) + 1); + acpi_os_stall (how_long); } return (status); diff -urN linux-2.5.72-bk3/drivers/acpi/executer/exutils.c linux-2.5.73/drivers/acpi/executer/exutils.c --- linux-2.5.72-bk3/drivers/acpi/executer/exutils.c 2003-06-16 21:19:42.000000000 -0700 +++ linux-2.5.73/drivers/acpi/executer/exutils.c 2003-06-22 12:03:56.000000000 -0700 @@ -289,7 +289,10 @@ /* * acpi_integer is unsigned, so we don't worry about a '-' */ - current_value = value; + if ((current_value = value) == 0) { + return_VALUE (1); + } + num_digits = 0; while (current_value) { diff -urN linux-2.5.72-bk3/drivers/acpi/hardware/hwregs.c linux-2.5.73/drivers/acpi/hardware/hwregs.c --- linux-2.5.72-bk3/drivers/acpi/hardware/hwregs.c 2003-06-16 21:20:21.000000000 -0700 +++ linux-2.5.73/drivers/acpi/hardware/hwregs.c 2003-06-22 12:03:56.000000000 -0700 @@ -56,7 +56,7 @@ * * FUNCTION: acpi_hw_clear_acpi_status * - * PARAMETERS: none + * PARAMETERS: Flags - Lock the hardware or not * * RETURN: none * @@ -65,7 +65,8 @@ ******************************************************************************/ acpi_status -acpi_hw_clear_acpi_status (void) +acpi_hw_clear_acpi_status ( + u32 flags) { acpi_status status; @@ -77,10 +78,11 @@ ACPI_BITMASK_ALL_FIXED_STATUS, (u16) acpi_gbl_FADT->xpm1a_evt_blk.address)); - - status = acpi_ut_acquire_mutex (ACPI_MTX_HARDWARE); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + 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, @@ -104,7 +106,9 @@ status = acpi_ev_walk_gpe_list (acpi_hw_clear_gpe_block); unlock_and_exit: - (void) acpi_ut_release_mutex (ACPI_MTX_HARDWARE); + if (flags & ACPI_MTX_LOCK) { + (void) acpi_ut_release_mutex (ACPI_MTX_HARDWARE); + } return_ACPI_STATUS (status); } @@ -237,8 +241,9 @@ * * FUNCTION: acpi_get_register * - * PARAMETERS: register_id - Index of ACPI Register to access - * use_lock - Lock the hardware + * PARAMETERS: register_id - ID of ACPI bit_register to access + * return_value - Value that was read from the register + * Flags - Lock the hardware or not * * RETURN: Value is read from specified Register. Value returned is * normalized to bit0 (is shifted all the way right) @@ -290,7 +295,8 @@ *return_value = register_value; - ACPI_DEBUG_PRINT ((ACPI_DB_IO, "Read value %X\n", register_value)); + ACPI_DEBUG_PRINT ((ACPI_DB_IO, "Read value %8.8X register %X\n", + register_value, bit_reg_info->parent_register)); } return_ACPI_STATUS (status); @@ -443,7 +449,8 @@ ACPI_DEBUG_EXEC (register_value = ((register_value & bit_reg_info->access_bit_mask) >> bit_reg_info->bit_position)); - ACPI_DEBUG_PRINT ((ACPI_DB_IO, "ACPI Register Write actual %X\n", register_value)); + ACPI_DEBUG_PRINT ((ACPI_DB_IO, "Set bits: %8.8X actual %8.8X register %X\n", + value, register_value, bit_reg_info->parent_register)); return_ACPI_STATUS (status); } @@ -751,10 +758,15 @@ default: ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unsupported address space: %X\n", reg->address_space_id)); - status = AE_BAD_PARAMETER; - break; + return (AE_BAD_PARAMETER); } + ACPI_DEBUG_PRINT ((ACPI_DB_IO, "Read: %8.8X width %2d from %8.8X%8.8X (%s)\n", + *value, width, + ACPI_HIDWORD (reg->address), + ACPI_LODWORD (reg->address), + acpi_ut_get_region_name (reg->address_space_id))); + return (status); } @@ -832,9 +844,14 @@ default: ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unsupported address space: %X\n", reg->address_space_id)); - status = AE_BAD_PARAMETER; - break; + return (AE_BAD_PARAMETER); } + ACPI_DEBUG_PRINT ((ACPI_DB_IO, "Wrote: %8.8X width %2d to %8.8X%8.8X (%s)\n", + value, width, + ACPI_HIDWORD (reg->address), + ACPI_LODWORD (reg->address), + acpi_ut_get_region_name (reg->address_space_id))); + return (status); } diff -urN linux-2.5.72-bk3/drivers/acpi/hardware/hwsleep.c linux-2.5.73/drivers/acpi/hardware/hwsleep.c --- linux-2.5.72-bk3/drivers/acpi/hardware/hwsleep.c 2003-06-16 21:19:40.000000000 -0700 +++ linux-2.5.73/drivers/acpi/hardware/hwsleep.c 2003-06-22 12:03:56.000000000 -0700 @@ -231,7 +231,7 @@ return_ACPI_STATUS (status); } - status = acpi_hw_clear_acpi_status(); + status = acpi_hw_clear_acpi_status(ACPI_MTX_DO_NOT_LOCK); if (ACPI_FAILURE (status)) { return_ACPI_STATUS (status); } @@ -355,7 +355,7 @@ ACPI_FUNCTION_TRACE ("acpi_enter_sleep_state_s4bios"); acpi_set_register (ACPI_BITREG_WAKE_STATUS, 1, ACPI_MTX_DO_NOT_LOCK); - acpi_hw_clear_acpi_status(); + acpi_hw_clear_acpi_status(ACPI_MTX_DO_NOT_LOCK); acpi_hw_disable_non_wakeup_gpes(); diff -urN linux-2.5.72-bk3/drivers/acpi/osl.c linux-2.5.73/drivers/acpi/osl.c --- linux-2.5.72-bk3/drivers/acpi/osl.c 2003-06-16 21:20:20.000000000 -0700 +++ linux-2.5.73/drivers/acpi/osl.c 2003-06-22 12:03:56.000000000 -0700 @@ -69,8 +69,6 @@ static OSD_HANDLER acpi_irq_handler = NULL; static void *acpi_irq_context = NULL; -extern struct pci_ops *pci_root_ops; - acpi_status acpi_os_initialize(void) { @@ -79,7 +77,7 @@ * it while walking the namespace (bus 0 and root bridges w/ _BBNs). */ #ifdef CONFIG_ACPI_PCI - if (!pci_root_ops) { + if (!raw_pci_ops) { printk(KERN_ERR PREFIX "Access to PCI configuration space unavailable\n"); return AE_NULL_ENTRY; } @@ -446,15 +444,9 @@ #ifdef CONFIG_ACPI_PCI acpi_status -acpi_os_read_pci_configuration ( - struct acpi_pci_id *pci_id, - u32 reg, - void *value, - u32 width) +acpi_os_read_pci_configuration (struct acpi_pci_id *pci_id, u32 reg, void *value, u32 width) { - int result = 0; - int size = 0; - struct pci_bus bus; + int result, size; if (!value) return AE_BAD_PARAMETER; @@ -470,27 +462,19 @@ size = 4; break; default: - BUG(); + return AE_ERROR; } - bus.number = pci_id->bus; - result = pci_root_ops->read(&bus, PCI_DEVFN(pci_id->device, - pci_id->function), - reg, size, value); + result = raw_pci_ops->read(pci_id->segment, pci_id->bus, + pci_id->device, pci_id->function, reg, size, value); return (result ? AE_ERROR : AE_OK); } acpi_status -acpi_os_write_pci_configuration ( - struct acpi_pci_id *pci_id, - u32 reg, - acpi_integer value, - u32 width) +acpi_os_write_pci_configuration (struct acpi_pci_id *pci_id, u32 reg, acpi_integer value, u32 width) { - int result = 0; - int size = 0; - struct pci_bus bus; + int result, size; switch (width) { case 8: @@ -503,13 +487,12 @@ size = 4; break; default: - BUG(); + return AE_ERROR; } - bus.number = pci_id->bus; - result = pci_root_ops->write(&bus, PCI_DEVFN(pci_id->device, - pci_id->function), - reg, size, value); + result = raw_pci_ops->write(pci_id->segment, pci_id->bus, + pci_id->device, pci_id->function, reg, size, value); + return (result ? AE_ERROR : AE_OK); } diff -urN linux-2.5.72-bk3/drivers/acpi/pci_root.c linux-2.5.73/drivers/acpi/pci_root.c --- linux-2.5.72-bk3/drivers/acpi/pci_root.c 2003-06-16 21:19:46.000000000 -0700 +++ linux-2.5.73/drivers/acpi/pci_root.c 2003-06-22 12:03:56.000000000 -0700 @@ -44,8 +44,6 @@ #define ACPI_PCI_ROOT_DRIVER_NAME "ACPI PCI Root Bridge Driver" #define ACPI_PCI_ROOT_DEVICE_NAME "PCI Root Bridge" -extern struct pci_ops *pci_root_ops; - static int acpi_pci_root_add (struct acpi_device *device); static int acpi_pci_root_remove (struct acpi_device *device, int type); diff -urN linux-2.5.72-bk3/drivers/acpi/tables/tbconvrt.c linux-2.5.73/drivers/acpi/tables/tbconvrt.c --- linux-2.5.72-bk3/drivers/acpi/tables/tbconvrt.c 2003-06-16 21:19:59.000000000 -0700 +++ linux-2.5.73/drivers/acpi/tables/tbconvrt.c 2003-06-22 12:03:56.000000000 -0700 @@ -287,10 +287,14 @@ (acpi_physical_address) (local_fadt->xpm1a_evt_blk.address + ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len))); - acpi_tb_init_generic_address (&acpi_gbl_xpm1b_enable, - (u8) ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len), - (acpi_physical_address) (local_fadt->xpm1b_evt_blk.address + - ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len))); + /* PM1B is optional; leave null if not present */ + + if (local_fadt->xpm1b_evt_blk.address) { + acpi_tb_init_generic_address (&acpi_gbl_xpm1b_enable, + (u8) ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len), + (acpi_physical_address) (local_fadt->xpm1b_evt_blk.address + + ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len))); + } } @@ -379,11 +383,15 @@ ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len))); acpi_gbl_xpm1a_enable.address_space_id = local_fadt->xpm1a_evt_blk.address_space_id; - acpi_tb_init_generic_address (&acpi_gbl_xpm1b_enable, - (u8) ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len), - (acpi_physical_address) (local_fadt->xpm1b_evt_blk.address + - ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len))); - acpi_gbl_xpm1b_enable.address_space_id = local_fadt->xpm1b_evt_blk.address_space_id; + /* PM1B is optional; leave null if not present */ + + if (local_fadt->xpm1b_evt_blk.address) { + acpi_tb_init_generic_address (&acpi_gbl_xpm1b_enable, + (u8) ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len), + (acpi_physical_address) (local_fadt->xpm1b_evt_blk.address + + ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len))); + acpi_gbl_xpm1b_enable.address_space_id = local_fadt->xpm1b_evt_blk.address_space_id; + } } diff -urN linux-2.5.72-bk3/drivers/acpi/utilities/utmisc.c linux-2.5.73/drivers/acpi/utilities/utmisc.c --- linux-2.5.72-bk3/drivers/acpi/utilities/utmisc.c 2003-06-16 21:19:40.000000000 -0700 +++ linux-2.5.73/drivers/acpi/utilities/utmisc.c 2003-06-22 12:03:56.000000000 -0700 @@ -203,10 +203,12 @@ if (revision <= 1) { acpi_gbl_integer_bit_width = 32; + acpi_gbl_integer_nybble_width = 8; acpi_gbl_integer_byte_width = 4; } else { acpi_gbl_integer_bit_width = 64; + acpi_gbl_integer_nybble_width = 16; acpi_gbl_integer_byte_width = 8; } } diff -urN linux-2.5.72-bk3/drivers/block/rd.c linux-2.5.73/drivers/block/rd.c --- linux-2.5.72-bk3/drivers/block/rd.c 2003-06-16 21:20:06.000000000 -0700 +++ linux-2.5.73/drivers/block/rd.c 2003-06-22 12:03:56.000000000 -0700 @@ -269,7 +269,10 @@ static int rd_open(struct inode * inode, struct file * filp) { - int unit = minor(inode->i_rdev); + unsigned unit = minor(inode->i_rdev); + + if (unit >= NUM_RAMDISKS) + return -ENODEV; /* * Immunize device against invalidate_buffers() and prune_icache(). diff -urN linux-2.5.72-bk3/drivers/char/keyboard.c linux-2.5.73/drivers/char/keyboard.c --- linux-2.5.72-bk3/drivers/char/keyboard.c 2003-06-16 21:19:59.000000000 -0700 +++ linux-2.5.73/drivers/char/keyboard.c 2003-06-22 12:03:56.000000000 -0700 @@ -242,7 +242,7 @@ del_timer(&kd_mksound_timer); if (hz) { - list_for_each(node,&kbd_handler.h_list) { + list_for_each_prev(node,&kbd_handler.h_list) { struct input_handle *handle = to_handle_h(node); if (test_bit(EV_SND, handle->dev->evbit)) { if (test_bit(SND_TONE, handle->dev->sndbit)) { diff -urN linux-2.5.72-bk3/drivers/char/raw.c linux-2.5.73/drivers/char/raw.c --- linux-2.5.72-bk3/drivers/char/raw.c 2003-06-16 21:20:06.000000000 -0700 +++ linux-2.5.73/drivers/char/raw.c 2003-06-22 12:03:56.000000000 -0700 @@ -10,6 +10,7 @@ #include #include +#include #include #include #include @@ -258,12 +259,27 @@ static int __init raw_init(void) { + int i; + register_chrdev(RAW_MAJOR, "raw", &raw_fops); + devfs_mk_cdev(MKDEV(RAW_MAJOR, 0), + S_IFCHR | S_IRUGO | S_IWUGO, + "raw/rawctl"); + for (i = 1; i < MAX_RAW_MINORS; i++) + devfs_mk_cdev(MKDEV(RAW_MAJOR, i), + S_IFCHR | S_IRUGO | S_IWUGO, + "raw/raw%d", i); return 0; } static void __exit raw_exit(void) { + int i; + + for (i = 1; i < MAX_RAW_MINORS; i++) + devfs_remove("raw/raw%d", i); + devfs_remove("raw/rawctl"); + devfs_remove("raw"); unregister_chrdev(RAW_MAJOR, "raw"); } diff -urN linux-2.5.72-bk3/drivers/char/vt.c linux-2.5.73/drivers/char/vt.c --- linux-2.5.72-bk3/drivers/char/vt.c 2003-06-16 21:20:21.000000000 -0700 +++ linux-2.5.73/drivers/char/vt.c 2003-06-22 12:03:56.000000000 -0700 @@ -75,6 +75,7 @@ */ #include +#include #include #include #include @@ -2279,7 +2280,7 @@ ret = fg_console; break; case TIOCL_SCROLLCONSOLE: - if (get_user(lines, (char *)arg+1)) { + if (get_user(lines, (s32 *)((char *)arg+4))) { ret = -EFAULT; } else { scrollfront(lines); diff -urN linux-2.5.72-bk3/drivers/char/vt_ioctl.c linux-2.5.73/drivers/char/vt_ioctl.c --- linux-2.5.72-bk3/drivers/char/vt_ioctl.c 2003-06-16 21:20:07.000000000 -0700 +++ linux-2.5.73/drivers/char/vt_ioctl.c 2003-06-22 12:03:56.000000000 -0700 @@ -872,6 +872,8 @@ return -EINVAL; for (i = 0; i < MAX_NR_CONSOLES; i++) { + if (!vc_cons[i].d) + continue; if (vlin) vc_cons[i].d->vc_scan_lines = vlin; if (clin) diff -urN linux-2.5.72-bk3/drivers/ide/pci/sis5513.c linux-2.5.73/drivers/ide/pci/sis5513.c --- linux-2.5.72-bk3/drivers/ide/pci/sis5513.c 2003-06-16 21:20:01.000000000 -0700 +++ linux-2.5.73/drivers/ide/pci/sis5513.c 2003-06-22 12:03:56.000000000 -0700 @@ -1,8 +1,9 @@ /* - * linux/drivers/ide/pci/sis5513.c Version 0.14ac Sept 11, 2002 + * linux/drivers/ide/pci/sis5513.c Version 0.16ac+vp Jun 18, 2003 * * Copyright (C) 1999-2000 Andre Hedrick * Copyright (C) 2002 Lionel Bouton , Maintainer + * Copyright (C) 2003 Vojtech Pavlik * May be copied or modified under the terms of the GNU General Public License * * @@ -14,31 +15,33 @@ * for checking code correctness, providing patches. * * - * Original tests and design on the SiS620/5513 chipset. - * ATA100 tests and design on the SiS735/5513 chipset. + * Original tests and design on the SiS620 chipset. + * ATA100 tests and design on the SiS735 chipset. * ATA16/33 support from specs * ATA133 support for SiS961/962 by L.C. Chang + * ATA133 961/962/963 fixes by Vojtech Pavlik * * Documentation: - * SiS chipset documentation available under NDA to companies not - * individuals only. + * SiS chipset documentation available under NDA to companies only + * (not to individuals). */ /* - * Notes/Special cases: - * - SiS5513 derivatives usually have the same PCI IDE register layout when - * supporting the same UDMA modes. - * - There are exceptions : - * . SiS730 and SiS550 use the same layout than ATA_66 chipsets but support - * ATA_100 - * . ATA_133 capable chipsets mark a shift in SiS chipset designs : previously - * south and northbridge were integrated, making IDE (a southbridge function) - * capabilities easily deduced from the northbridge PCI id. With ATA_133, - * chipsets started to be split in the usual north/south bridges chips - * -> the driver needs to detect the correct southbridge when faced to newest - * northbridges. - * . On ATA133 capable chipsets when bit 30 of dword at 0x54 is 1 the - * configuration space is moved from 0x40 to 0x70. + * The original SiS5513 comes from a SiS5511/55112/5513 chipset. The original + * SiS5513 was also used in the SiS5596/5513 chipset. Thus if we see a SiS5511 + * or SiS5596, we can assume we see the first MWDMA-16 capable SiS5513 chip. + * + * Later SiS chipsets integrated the 5513 functionality into the NorthBridge, + * starting with SiS5571 and up to SiS745. The PCI ID didn't change, though. We + * can figure out that we have a more modern and more capable 5513 by looking + * for the respective NorthBridge IDs. + * + * Even later (96x family) SiS chipsets use the MuTIOL link and place the 5513 + * into the SouthBrige. Here we cannot rely on looking up the NorthBridge PCI + * ID, while the now ATA-133 capable 5513 still has the same PCI ID. + * Fortunately the 5513 can be 'unmasked' by fiddling with some config space + * bits, changing its device id to the true one - 5517 for 961 and 5518 for + * 962/963. */ #include @@ -57,94 +60,23 @@ #include #include -#include #include +#include "ide-timing.h" #include "ide_modes.h" #include "sis5513.h" -/* When DEBUG is defined it outputs initial PCI config register - values and changes made to them by the driver */ -// #define DEBUG -/* When BROKEN_LEVEL is defined it limits the DMA mode - at boot time to its value */ -// #define BROKEN_LEVEL XFER_SW_DMA_0 - -/* Miscellaneous flags */ -#define SIS5513_LATENCY 0x01 - /* registers layout and init values are chipset family dependant */ -/* 1/ define families */ -#define ATA_00 0x00 + #define ATA_16 0x01 #define ATA_33 0x02 #define ATA_66 0x03 -#define ATA_100a 0x04 // SiS730 is ATA100 with ATA66 layout +#define ATA_100a 0x04 // SiS730/SiS550 is ATA100 with ATA66 layout #define ATA_100 0x05 #define ATA_133a 0x06 // SiS961b with 133 support -#define ATA_133 0x07 // SiS962 -/* 2/ variable holding the controller chipset family value */ -static u8 chipset_family; - - -/* - * Debug code: following IDE config registers' changes - */ -#ifdef DEBUG -/* Copy of IDE Config registers fewer will be used - * Some odd chipsets hang if unused registers are accessed - * -> We only access them in #DEBUG code (then we'll see if SiS did - * it right from day one) */ -static u8 ide_regs_copy[0xff]; - -/* Read config registers, print differences from previous read */ -static void sis5513_load_verify_registers(struct pci_dev* dev, char* info) { - int i; - u8 reg_val; - u8 changed=0; - - printk("SIS5513: %s, changed registers:\n", info); - for(i=0; i<=0xff; i++) { - pci_read_config_byte(dev, i, ®_val); - if (reg_val != ide_regs_copy[i]) { - printk("%02x: %02x -> %02x\n", - i, ide_regs_copy[i], reg_val); - ide_regs_copy[i]=reg_val; - changed=1; - } - } - - if (!changed) { - printk("none\n"); - } -} - -/* Load config registers, no printing */ -static void sis5513_load_registers(struct pci_dev* dev) { - int i; - - for(i=0; i<=0xff; i++) { - pci_read_config_byte(dev, i, &(ide_regs_copy[i])); - } -} - -/* Print config space registers a la "lspci -vxxx" */ -static void sis5513_print_registers(struct pci_dev* dev, char* marker) { - int i,j; - - sis5513_load_registers(dev); - printk("SIS5513 %s\n", marker); - - for(i=0; i<=0xf; i++) { - printk("SIS5513 dump: %d" "0:", i); - for(j=0; j<=0xf; j++) { - printk(" %02x", ide_regs_copy[(i<<16)+j]); - } - printk("\n"); - } -} -#endif +#define ATA_133 0x07 // SiS962/963 +static u8 chipset_family; /* * Devices supported @@ -155,42 +87,38 @@ u8 chipset_family; u8 flags; } SiSHostChipInfo[] = { - { "SiS752", PCI_DEVICE_ID_SI_752, ATA_133, 0 }, - { "SiS751", PCI_DEVICE_ID_SI_751, ATA_133, 0 }, - { "SiS750", PCI_DEVICE_ID_SI_750, ATA_133, 0 }, - { "SiS748", PCI_DEVICE_ID_SI_748, ATA_133, 0 }, - { "SiS746", PCI_DEVICE_ID_SI_746, ATA_133, 0 }, - { "SiS745", PCI_DEVICE_ID_SI_745, ATA_133, 0 }, - { "SiS740", PCI_DEVICE_ID_SI_740, ATA_133, 0 }, - { "SiS735", PCI_DEVICE_ID_SI_735, ATA_100, SIS5513_LATENCY }, - { "SiS730", PCI_DEVICE_ID_SI_730, ATA_100a, SIS5513_LATENCY }, - { "SiS655", PCI_DEVICE_ID_SI_655, ATA_133, 0 }, - { "SiS652", PCI_DEVICE_ID_SI_652, ATA_133, 0 }, - { "SiS651", PCI_DEVICE_ID_SI_651, ATA_133, 0 }, - { "SiS650", PCI_DEVICE_ID_SI_650, ATA_133, 0 }, - { "SiS648", PCI_DEVICE_ID_SI_648, ATA_133, 0 }, - { "SiS646", PCI_DEVICE_ID_SI_646, ATA_133, 0 }, - { "SiS645", PCI_DEVICE_ID_SI_645, ATA_133, 0 }, - { "SiS635", PCI_DEVICE_ID_SI_635, ATA_100, SIS5513_LATENCY }, - { "SiS640", PCI_DEVICE_ID_SI_640, ATA_66, SIS5513_LATENCY }, - { "SiS630", PCI_DEVICE_ID_SI_630, ATA_66, SIS5513_LATENCY }, - { "SiS620", PCI_DEVICE_ID_SI_620, ATA_66, SIS5513_LATENCY }, - { "SiS550", PCI_DEVICE_ID_SI_550, ATA_100a, 0}, - { "SiS540", PCI_DEVICE_ID_SI_540, ATA_66, 0}, - { "SiS530", PCI_DEVICE_ID_SI_530, ATA_66, 0}, - { "SiS5600", PCI_DEVICE_ID_SI_5600, ATA_33, 0}, - { "SiS5598", PCI_DEVICE_ID_SI_5598, ATA_33, 0}, - { "SiS5597", PCI_DEVICE_ID_SI_5597, ATA_33, 0}, - { "SiS5591", PCI_DEVICE_ID_SI_5591, ATA_33, 0}, - { "SiS5513", PCI_DEVICE_ID_SI_5513, ATA_16, 0}, - { "SiS5511", PCI_DEVICE_ID_SI_5511, ATA_16, 0}, + { "SiS745", PCI_DEVICE_ID_SI_745, ATA_100 }, + { "SiS735", PCI_DEVICE_ID_SI_735, ATA_100 }, + { "SiS733", PCI_DEVICE_ID_SI_733, ATA_100 }, + { "SiS635", PCI_DEVICE_ID_SI_635, ATA_100 }, + { "SiS633", PCI_DEVICE_ID_SI_633, ATA_100 }, + + { "SiS730", PCI_DEVICE_ID_SI_730, ATA_100a }, + { "SiS550", PCI_DEVICE_ID_SI_550, ATA_100a }, + + { "SiS640", PCI_DEVICE_ID_SI_640, ATA_66 }, + { "SiS630", PCI_DEVICE_ID_SI_630, ATA_66 }, + { "SiS620", PCI_DEVICE_ID_SI_620, ATA_66 }, + { "SiS540", PCI_DEVICE_ID_SI_540, ATA_66 }, + { "SiS530", PCI_DEVICE_ID_SI_530, ATA_66 }, + + { "SiS5600", PCI_DEVICE_ID_SI_5600, ATA_33 }, + { "SiS5598", PCI_DEVICE_ID_SI_5598, ATA_33 }, + { "SiS5597", PCI_DEVICE_ID_SI_5597, ATA_33 }, + { "SiS5591/2", PCI_DEVICE_ID_SI_5591, ATA_33 }, + { "SiS5582", PCI_DEVICE_ID_SI_5582, ATA_33 }, + { "SiS5581", PCI_DEVICE_ID_SI_5581, ATA_33 }, + + { "SiS5596", PCI_DEVICE_ID_SI_5596, ATA_16 }, + { "SiS5571", PCI_DEVICE_ID_SI_5571, ATA_16 }, + { "SiS551x", PCI_DEVICE_ID_SI_5511, ATA_16 }, }; /* Cycle time bits and values vary across chip dma capabilities These three arrays hold the register layout and the values to set. Indexed by chipset_family and (dma_mode - XFER_UDMA_0) */ -/* {ATA_00, ATA_16, ATA_33, ATA_66, ATA_100a, ATA_100, ATA_133} */ +/* {0, ATA_16, ATA_33, ATA_66, ATA_100a, ATA_100, ATA_133} */ static u8 cycle_time_offset[] = {0,0,5,4,4,0,0}; static u8 cycle_time_range[] = {0,0,2,3,3,4,4}; static u8 cycle_time_value[][XFER_UDMA_6 - XFER_UDMA_0 + 1] = { @@ -249,8 +177,6 @@ {40,12,4,12,5,34,12,5}, }; -static struct pci_dev *host_dev = NULL; - /* * Printing configuration */ @@ -334,6 +260,7 @@ } pci_read_config_dword(bmide_dev, (unsigned long)drive_pci+4*pos, ®dw0); pci_read_config_dword(bmide_dev, (unsigned long)drive_pci+4*pos+8, ®dw1); + p += sprintf(p, "Drive %d:\n", pos); } @@ -372,11 +299,12 @@ p += sprintf(p, "\n"); } - if (chipset_family < ATA_133) { /* else case TODO */ + + if (chipset_family < ATA_133) { /* else case TODO */ + /* Data Active */ p += sprintf(p, " Data Active Time "); switch(chipset_family) { - case ATA_00: case ATA_16: /* confirmed */ case ATA_33: case ATA_66: @@ -387,7 +315,6 @@ } p += sprintf(p, " \t Data Active Time "); switch(chipset_family) { - case ATA_00: case ATA_16: case ATA_33: case ATA_66: @@ -493,39 +420,16 @@ len = (p - buffer) - offset; *addr = buffer + offset; - + return len > count ? count : len; } #endif /* defined(DISPLAY_SIS_TIMINGS) && defined(CONFIG_PROC_FS) */ static u8 sis5513_ratemask (ide_drive_t *drive) { -#if 0 u8 rates[] = { 0, 0, 1, 2, 3, 3, 4, 4 }; u8 mode = rates[chipset_family]; -#else - u8 mode; - switch(chipset_family) { - case ATA_133: - case ATA_133a: - mode = 4; - break; - case ATA_100: - case ATA_100a: - mode = 3; - break; - case ATA_66: - mode = 2; - break; - case ATA_33: - return 1; - case ATA_16: - case ATA_00: - default: - return 0; - } -#endif if (!eighty_ninty_three(drive)) mode = min(mode, (u8)1); return mode; @@ -543,20 +447,12 @@ u8 reg4bh = 0; u8 rw_prefetch = (0x11 << drive->dn); -#ifdef DEBUG - printk("SIS5513: config_drive_art_rwp, drive %d\n", drive->dn); - sis5513_load_verify_registers(dev, "config_drive_art_rwp start"); -#endif - if (drive->media != ide_disk) return; pci_read_config_byte(dev, 0x4b, ®4bh); if ((reg4bh & rw_prefetch) != rw_prefetch) pci_write_config_byte(dev, 0x4b, reg4bh|rw_prefetch); -#ifdef DEBUG - sis5513_load_verify_registers(dev, "config_drive_art_rwp end"); -#endif } @@ -571,10 +467,6 @@ u16 eide_pio_timing[6] = {600, 390, 240, 180, 120, 90}; u16 xfer_pio = drive->id->eide_pio_modes; -#ifdef DEBUG - sis5513_load_verify_registers(dev, "config_drive_art_rwp_pio start"); -#endif - config_drive_art_rwp(drive); pio = ide_get_best_pio_mode(drive, 255, pio, NULL); @@ -594,12 +486,6 @@ timing = (xfer_pio >= pio) ? xfer_pio : pio; -#ifdef DEBUG - printk("SIS5513: config_drive_art_rwp_pio, " - "drive %d, pio %d, timing %d\n", - drive->dn, pio, timing); -#endif - /* In pre ATA_133 case, drives sit at 0x40 + 4*drive->dn */ drive_pci = 0x40; /* In SiS962 case drives sit at (0x40 or 0x70) + 8*drive->dn) */ @@ -645,41 +531,24 @@ pci_read_config_dword(dev, drive_pci, &test3); test3 &= 0xc0c00fff; if (test3 & 0x08) { - test3 |= (unsigned long)ini_time_value[ATA_133-ATA_00][timing] << 12; - test3 |= (unsigned long)act_time_value[ATA_133-ATA_00][timing] << 16; - test3 |= (unsigned long)rco_time_value[ATA_133-ATA_00][timing] << 24; + test3 |= (unsigned long)ini_time_value[ATA_133][timing] << 12; + test3 |= (unsigned long)act_time_value[ATA_133][timing] << 16; + test3 |= (unsigned long)rco_time_value[ATA_133][timing] << 24; } else { - test3 |= (unsigned long)ini_time_value[ATA_100-ATA_00][timing] << 12; - test3 |= (unsigned long)act_time_value[ATA_100-ATA_00][timing] << 16; - test3 |= (unsigned long)rco_time_value[ATA_100-ATA_00][timing] << 24; + test3 |= (unsigned long)ini_time_value[ATA_100][timing] << 12; + test3 |= (unsigned long)act_time_value[ATA_100][timing] << 16; + test3 |= (unsigned long)rco_time_value[ATA_100][timing] << 24; } pci_write_config_dword(dev, drive_pci, test3); } - -#ifdef DEBUG - sis5513_load_verify_registers(dev, "config_drive_art_rwp_pio start"); -#endif } static int config_chipset_for_pio (ide_drive_t *drive, u8 pio) { -#if 0 + if (pio == 255) + pio = ide_find_best_mode(drive, XFER_PIO | XFER_EPIO) - XFER_PIO_0; config_art_rwp_pio(drive, pio); - return ide_config_drive_speed(drive, (XFER_PIO_0 + pio)); -#else - u8 speed; - - switch(pio) { - case 4: speed = XFER_PIO_4; break; - case 3: speed = XFER_PIO_3; break; - case 2: speed = XFER_PIO_2; break; - case 1: speed = XFER_PIO_1; break; - default: speed = XFER_PIO_0; break; - } - - config_art_rwp_pio(drive, pio); - return ide_config_drive_speed(drive, speed); -#endif + return ide_config_drive_speed(drive, XFER_PIO_0 + min_t(u8, pio, 4)); } static int sis5513_tune_chipset (ide_drive_t *drive, u8 xferspeed) @@ -690,24 +559,8 @@ u8 drive_pci, reg, speed; u32 regdw; -#ifdef DEBUG - sis5513_load_verify_registers(dev, "sis5513_tune_chipset start"); -#endif - -#ifdef BROKEN_LEVEL -#ifdef DEBUG - printk("SIS5513: BROKEN_LEVEL activated, speed=%d -> speed=%d\n", xferspeed, BROKEN_LEVEL); -#endif - if (xferspeed > BROKEN_LEVEL) xferspeed = BROKEN_LEVEL; -#endif - speed = ide_rate_filter(sis5513_ratemask(drive), xferspeed); -#ifdef DEBUG - printk("SIS5513: sis5513_tune_chipset, drive %d, speed %d\n", - drive->dn, xferspeed); -#endif - /* See config_art_rwp_pio for drive pci config registers */ drive_pci = 0x40; if (chipset_family >= ATA_133) { @@ -746,14 +599,14 @@ regdw &= 0xfffff00f; /* check if ATA133 enable */ if (regdw & 0x08) { - regdw |= (unsigned long)cycle_time_value[ATA_133-ATA_00][speed-XFER_UDMA_0] << 4; - regdw |= (unsigned long)cvs_time_value[ATA_133-ATA_00][speed-XFER_UDMA_0] << 8; + regdw |= (unsigned long)cycle_time_value[ATA_133][speed-XFER_UDMA_0] << 4; + regdw |= (unsigned long)cvs_time_value[ATA_133][speed-XFER_UDMA_0] << 8; } else { /* if ATA133 disable, we should not set speed above UDMA5 */ if (speed > XFER_UDMA_5) speed = XFER_UDMA_5; - regdw |= (unsigned long)cycle_time_value[ATA_100-ATA_00][speed-XFER_UDMA_0] << 4; - regdw |= (unsigned long)cvs_time_value[ATA_100-ATA_00][speed-XFER_UDMA_0] << 8; + regdw |= (unsigned long)cycle_time_value[ATA_100][speed-XFER_UDMA_0] << 4; + regdw |= (unsigned long)cvs_time_value[ATA_100][speed-XFER_UDMA_0] << 8; } pci_write_config_dword(dev, (unsigned long)drive_pci, regdw); } else { @@ -763,7 +616,7 @@ reg &= ~((0xFF >> (8 - cycle_time_range[chipset_family])) << cycle_time_offset[chipset_family]); /* set reg cycle time bits */ - reg |= cycle_time_value[chipset_family-ATA_00][speed-XFER_UDMA_0] + reg |= cycle_time_value[chipset_family][speed-XFER_UDMA_0] << cycle_time_offset[chipset_family]; pci_write_config_byte(dev, drive_pci+1, reg); } @@ -782,9 +635,7 @@ case XFER_PIO_0: default: return((int) config_chipset_for_pio(drive, 0)); } -#ifdef DEBUG - sis5513_load_verify_registers(dev, "sis5513_tune_chipset end"); -#endif + return ((int) ide_config_drive_speed(drive, speed)); } @@ -863,18 +714,34 @@ return sis5513_config_drive_xfer_rate(drive); } -/* Helper function used at init time - * returns a PCI device revision ID - * (used to detect different IDE controller versions) - */ -static u8 __init devfn_rev(int device, int function) +/* + Future simpler config_xfer_rate : + When ide_find_best_mode is made bad-drive aware + - remove config_drive_xfer_rate and config_chipset_for_dma, + - replace config_xfer_rate with the following + +static int sis5513_config_xfer_rate (ide_drive_t *drive) { - u8 revision; - /* Find device */ - struct pci_dev* dev = pci_find_slot(0,PCI_DEVFN(device,function)); - pci_read_config_byte(dev, PCI_REVISION_ID, &revision); - return revision; + u16 w80 = HWIF(drive)->udma_four; + u16 speed; + + config_drive_art_rwp(drive); + config_art_rwp_pio(drive, 5); + + speed = ide_find_best_mode(drive, + XFER_PIO | XFER_EPIO | XFER_SWDMA | XFER_MWDMA | + (chipset_family >= ATA_33 ? XFER_UDMA : 0) | + (w80 && chipset_family >= ATA_66 ? XFER_UDMA_66 : 0) | + (w80 && chipset_family >= ATA_100a ? XFER_UDMA_100 : 0) | + (w80 && chipset_family >= ATA_133a ? XFER_UDMA_133 : 0)); + + sis5513_tune_chipset(drive, speed); + + if (drive->autodma && (speed & XFER_MODE) != XFER_PIO) + return HWIF(drive)->ide_dma_on(drive); + return HWIF(drive)->ide_dma_off_quietly(drive); } +*/ /* Chip detection and general config */ static unsigned int __init init_chipset_sis5513 (struct pci_dev *dev, const char *name) @@ -882,71 +749,86 @@ struct pci_dev *host; int i = 0; - /* Find the chip */ - for (i = 0; i < ARRAY_SIZE(SiSHostChipInfo) && !host_dev; i++) { - host = pci_find_device (PCI_VENDOR_ID_SI, - SiSHostChipInfo[i].host_id, - NULL); + chipset_family = 0; + + for (i = 0; i < ARRAY_SIZE(SiSHostChipInfo) && !chipset_family; i++) { + + host = pci_find_device(PCI_VENDOR_ID_SI, SiSHostChipInfo[i].host_id, NULL); + if (!host) continue; - host_dev = host; chipset_family = SiSHostChipInfo[i].chipset_family; + + /* Special case for SiS630 : 630S/ET is ATA_100a */ + if (SiSHostChipInfo[i].host_id == PCI_DEVICE_ID_SI_630) { + u8 hostrev; + pci_read_config_byte(host, PCI_REVISION_ID, &hostrev); + if (hostrev >= 0x30) + chipset_family = ATA_100a; + } - /* check 100/133 chipset family */ - if (chipset_family == ATA_133) { - u32 reg54h; - u16 devid; - pci_read_config_dword(dev, 0x54, ®54h); - /* SiS962 and above report 0x5518 dev id if high bit is cleared */ - pci_write_config_dword(dev, 0x54, (reg54h & 0x7fffffff)); - pci_read_config_word(dev, 0x02, &devid); - /* restore register 0x54 */ - pci_write_config_dword(dev, 0x54, reg54h); - - /* devid 5518 here means SiS962 or later - which supports ATA133. - These are refered by chipset_family = ATA133 - */ - if (devid != 0x5518) { - u8 reg49h; - /* SiS961 family */ - pci_read_config_byte(dev, 0x49, ®49h); - /* check isa bridge device rev id */ - if (((devfn_rev(2,0) & 0xff) == 0x10) && (reg49h & 0x80)) - chipset_family = ATA_133a; - else - chipset_family = ATA_100; + printk(KERN_INFO "SIS5513: %s %s controller\n", + SiSHostChipInfo[i].name, chipset_capability[chipset_family]); + } + + if (!chipset_family) { /* Belongs to pci-quirks */ + + u32 idemisc; + u16 trueid; + + /* Disable ID masking and register remapping */ + pci_read_config_dword(dev, 0x54, &idemisc); + pci_write_config_dword(dev, 0x54, (idemisc & 0x7fffffff)); + pci_read_config_word(dev, PCI_DEVICE_ID, &trueid); + pci_write_config_dword(dev, 0x54, idemisc); + + if (trueid == 0x5518) { + printk(KERN_INFO "SIS5513: SiS 962/963 MuTIOL IDE UDMA133 controller\n"); + chipset_family = ATA_133; } - } - printk(SiSHostChipInfo[i].name); - printk(" %s controller", chipset_capability[chipset_family]); - printk("\n"); + } -#ifdef DEBUG - sis5513_print_registers(dev, "pci_init_sis5513 start"); -#endif + if (!chipset_family) { /* Belongs to pci-quirks */ - if (SiSHostChipInfo[i].flags & SIS5513_LATENCY) { - u8 latency = (chipset_family == ATA_100)? 0x80 : 0x10; /* Lacking specs */ - pci_write_config_byte(dev, PCI_LATENCY_TIMER, latency); - } + struct pci_dev *lpc_bridge; + u16 trueid; + u8 prefctl; + u8 idecfg; + u8 sbrev; + + pci_read_config_byte(dev, 0x4a, &idecfg); + pci_write_config_byte(dev, 0x4a, idecfg | 0x10); + pci_read_config_word(dev, PCI_DEVICE_ID, &trueid); + pci_write_config_byte(dev, 0x4a, idecfg); + + if (trueid == 0x5517) { /* SiS 961/961B */ + + lpc_bridge = pci_find_slot(0x00, 0x10); /* Bus 0, Dev 2, Fn 0 */ + pci_read_config_byte(lpc_bridge, PCI_REVISION_ID, &sbrev); + pci_read_config_byte(dev, 0x49, &prefctl); - /* Special case for SiS630 : 630S/ET is ATA_100a */ - if (SiSHostChipInfo[i].host_id == PCI_DEVICE_ID_SI_630) { - /* check host device rev id */ - if (devfn_rev(0,0) >= 0x30) { - chipset_family = ATA_100a; + if (sbrev == 0x10 && (prefctl & 0x80)) { + printk(KERN_INFO "SIS5513: SiS 961B MuTIOL IDE UDMA133 controller\n"); + chipset_family = ATA_133a; + } else { + printk(KERN_INFO "SIS5513: SiS 961 MuTIOL IDE UDMA100 controller\n"); + chipset_family = ATA_100; + } } - } } + if (!chipset_family) + return -1; + /* Make general config ops here 1/ tell IDE channels to operate in Compatibility mode only 2/ tell old chips to allow per drive IDE timings */ - if (host_dev) { + + { u8 reg; u16 regw; + switch(chipset_family) { case ATA_133: /* SiS962 operation mode */ @@ -959,6 +841,8 @@ break; case ATA_133a: case ATA_100: + /* Fixup latency */ + pci_write_config_byte(dev, PCI_LATENCY_TIMER, 0x80); /* Set compatibility bit */ pci_read_config_byte(dev, 0x49, ®); if (!(reg & 0x01)) { @@ -967,6 +851,9 @@ break; case ATA_100a: case ATA_66: + /* Fixup latency */ + pci_write_config_byte(dev, PCI_LATENCY_TIMER, 0x10); + /* On ATA_66 chips the bit was elsewhere */ pci_read_config_byte(dev, 0x52, ®); if (!(reg & 0x04)) { @@ -987,8 +874,6 @@ pci_write_config_byte(dev, 0x52, reg|0x08); } break; - case ATA_00: - default: break; } #if defined(DISPLAY_SIS_TIMINGS) && defined(CONFIG_PROC_FS) @@ -999,9 +884,7 @@ } #endif } -#ifdef DEBUG - sis5513_load_verify_registers(dev, "pci_init_sis5513 end"); -#endif + return 0; } @@ -1044,7 +927,7 @@ hwif->mwdma_mask = 0x07; hwif->swdma_mask = 0x07; - if (!host_dev) + if (!chipset_family) return; if (!(hwif->udma_four)) @@ -1102,19 +985,16 @@ module_init(sis5513_ide_init); module_exit(sis5513_ide_exit); -MODULE_AUTHOR("Lionel Bouton, L C Chang, Andre Hedrick"); +MODULE_AUTHOR("Lionel Bouton, L C Chang, Andre Hedrick, Vojtech Pavlik"); MODULE_DESCRIPTION("PCI driver module for SIS IDE"); MODULE_LICENSE("GPL"); /* * TODO: - * - Get ridden of SisHostChipInfo[] completness dependancy. - * - Study drivers/ide/ide-timing.h. - * - Are there pre-ATA_16 SiS5513 chips ? -> tune init code for them - * or remove ATA_00 define + * - CLEANUP + * - Use drivers/ide/ide-timing.h ! * - More checks in the config registers (force values instead of * relying on the BIOS setting them correctly). * - Further optimisations ? * . for example ATA66+ regs 0x48 & 0x4A */ - diff -urN linux-2.5.72-bk3/drivers/input/gameport/gameport.c linux-2.5.73/drivers/input/gameport/gameport.c --- linux-2.5.72-bk3/drivers/input/gameport/gameport.c 2003-06-16 21:20:02.000000000 -0700 +++ linux-2.5.73/drivers/input/gameport/gameport.c 2003-06-22 12:03:57.000000000 -0700 @@ -84,6 +84,7 @@ if ((t = DELTA(t2,t1) - DELTA(t3,t2)) < tx) tx = t; } + gameport_close(gameport); return 59659 / (tx < 1 ? 1 : tx); #else @@ -93,11 +94,10 @@ j = jiffies; while (j == jiffies); j = jiffies; while (j == jiffies) { t++; gameport_read(gameport); } + gameport_close(gameport); return t * HZ / 1000; #endif - - gameport_close(gameport); } static void gameport_find_dev(struct gameport *gameport) diff -urN linux-2.5.72-bk3/drivers/input/joystick/gamecon.c linux-2.5.73/drivers/input/joystick/gamecon.c --- linux-2.5.72-bk3/drivers/input/joystick/gamecon.c 2003-06-16 21:20:28.000000000 -0700 +++ linux-2.5.73/drivers/input/joystick/gamecon.c 2003-06-22 12:03:57.000000000 -0700 @@ -46,6 +46,7 @@ MODULE_PARM(gc, "2-6i"); MODULE_PARM(gc_2,"2-6i"); MODULE_PARM(gc_3,"2-6i"); +MODULE_PARM(gc_psx_delay, "i"); #define GC_SNES 1 #define GC_NES 2 @@ -213,7 +214,7 @@ * */ -#define GC_PSX_DELAY 60 /* 60 usec */ +#define GC_PSX_DELAY 25 /* 25 usec */ #define GC_PSX_LENGTH 8 /* talk to the controller in bytes */ #define GC_PSX_MOUSE 1 /* Mouse */ @@ -230,6 +231,7 @@ #define GC_PSX_ID(x) ((x) >> 4) /* High nibble is device type */ #define GC_PSX_LEN(x) ((x) & 0xf) /* Low nibble is length in words */ +static int gc_psx_delay = GC_PSX_DELAY; static short gc_psx_abs[] = { ABS_X, ABS_Y, ABS_RX, ABS_RY, ABS_HAT0X, ABS_HAT0Y }; static short gc_psx_btn[] = { BTN_TL, BTN_TR, BTN_TL2, BTN_TR2, BTN_A, BTN_B, BTN_X, BTN_Y, BTN_START, BTN_SELECT, BTN_THUMBL, BTN_THUMBR }; @@ -246,10 +248,10 @@ for (i = 0; i < 8; i++, b >>= 1) { cmd = (b & 1) ? GC_PSX_COMMAND : 0; parport_write_data(gc->pd->port, cmd | GC_PSX_POWER); - udelay(GC_PSX_DELAY); + udelay(gc_psx_delay); data |= ((parport_read_status(gc->pd->port) ^ 0x80) & gc->pads[GC_PSX]) ? (1 << i) : 0; parport_write_data(gc->pd->port, cmd | GC_PSX_CLOCK | GC_PSX_POWER); - udelay(GC_PSX_DELAY); + udelay(gc_psx_delay); } return data; } @@ -265,9 +267,9 @@ unsigned long flags; parport_write_data(gc->pd->port, GC_PSX_CLOCK | GC_PSX_SELECT | GC_PSX_POWER); /* Select pad */ - udelay(GC_PSX_DELAY * 2); + udelay(gc_psx_delay * 2); parport_write_data(gc->pd->port, GC_PSX_CLOCK | GC_PSX_POWER); /* Deselect, begin command */ - udelay(GC_PSX_DELAY * 2); + udelay(gc_psx_delay * 2); local_irq_save(flags); @@ -649,9 +651,15 @@ for (i = 0; i <= ints[0] && i < 6; i++) gc_3[i] = ints[i + 1]; return 1; } +static int __init gc_psx_setup(char *str) +{ + get_option(&str, &gc_psx_delay); + return 1; +} __setup("gc=", gc_setup); __setup("gc_2=", gc_setup_2); __setup("gc_3=", gc_setup_3); +__setup("gc_psx_delay=", gc_psx_setup); #endif int __init gc_init(void) diff -urN linux-2.5.72-bk3/drivers/input/joystick/sidewinder.c linux-2.5.73/drivers/input/joystick/sidewinder.c --- linux-2.5.72-bk3/drivers/input/joystick/sidewinder.c 2003-06-16 21:20:22.000000000 -0700 +++ linux-2.5.73/drivers/input/joystick/sidewinder.c 2003-06-22 12:03:57.000000000 -0700 @@ -378,10 +378,10 @@ for (j = 0; j < 6; j++) input_report_key(dev, sw_btn[SW_ID_FSP][j], !GB(j+10,1)); - input_report_key(dev, BTN_TR, GB(26,1)); - input_report_key(dev, BTN_START, GB(27,1)); - input_report_key(dev, BTN_MODE, GB(38,1)); - input_report_key(dev, BTN_SELECT, GB(39,1)); + input_report_key(dev, BTN_TR, !GB(26,1)); + input_report_key(dev, BTN_START, !GB(27,1)); + input_report_key(dev, BTN_MODE, !GB(38,1)); + input_report_key(dev, BTN_SELECT, !GB(39,1)); input_sync(dev); @@ -602,7 +602,6 @@ gameport->phys, gameport->io, gameport->speed); i = sw_read_packet(gameport, buf, SW_LENGTH, 0); /* Read normal packet */ - m |= sw_guess_mode(buf, i); /* Data packet (1-bit) can carry mode info [FSP] */ udelay(SW_TIMEOUT); dbg("Init 1: Mode %d. Length %d.", m , i); @@ -676,6 +675,8 @@ } else sw->type = SW_ID_PP; break; + case 66: + sw->bits = 3; case 198: sw->length = 22; case 64: diff -urN linux-2.5.72-bk3/drivers/input/keyboard/atkbd.c linux-2.5.73/drivers/input/keyboard/atkbd.c --- linux-2.5.72-bk3/drivers/input/keyboard/atkbd.c 2003-06-16 21:20:20.000000000 -0700 +++ linux-2.5.73/drivers/input/keyboard/atkbd.c 2003-06-22 12:03:57.000000000 -0700 @@ -89,7 +89,7 @@ #define ATKBD_CMD_GETID 0x02f2 #define ATKBD_CMD_ENABLE 0x00f4 #define ATKBD_CMD_RESET_DIS 0x00f5 -#define ATKBD_CMD_RESET_BAT 0x01ff +#define ATKBD_CMD_RESET_BAT 0x02ff #define ATKBD_CMD_SETALL_MB 0x00f8 #define ATKBD_CMD_RESEND 0x00fe #define ATKBD_CMD_EX_ENABLE 0x10ea @@ -255,7 +255,8 @@ while (atkbd->cmdcnt && timeout--) { - if (atkbd->cmdcnt == 1 && command == ATKBD_CMD_RESET_BAT) + if (atkbd->cmdcnt == 1 && + command == ATKBD_CMD_RESET_BAT && timeout > 100000) timeout = 100000; if (atkbd->cmdcnt == 1 && command == ATKBD_CMD_GETID && @@ -271,6 +272,9 @@ for (i = 0; i < receive; i++) param[i] = atkbd->cmdbuf[(receive - 1) - i]; + if (command == ATKBD_CMD_RESET_BAT && atkbd->cmdcnt == 1) + atkbd->cmdcnt = 0; + if (atkbd->cmdcnt) { atkbd->cmdcnt = 0; return -1; diff -urN linux-2.5.72-bk3/drivers/input/misc/uinput.c linux-2.5.73/drivers/input/misc/uinput.c --- linux-2.5.72-bk3/drivers/input/misc/uinput.c 2003-06-16 21:20:21.000000000 -0700 +++ linux-2.5.73/drivers/input/misc/uinput.c 2003-06-22 12:03:57.000000000 -0700 @@ -49,11 +49,11 @@ udev = (struct uinput_device *)dev->private; - udev->head = (udev->head + 1) % UINPUT_BUFFER_SIZE; udev->buff[udev->head].type = type; udev->buff[udev->head].code = code; udev->buff[udev->head].value = value; do_gettimeofday(&udev->buff[udev->head].time); + udev->head = (udev->head + 1) % UINPUT_BUFFER_SIZE; wake_up_interruptible(&udev->waitq); @@ -82,6 +82,7 @@ udev->dev->event = uinput_dev_event; udev->dev->upload_effect = uinput_dev_upload_effect; udev->dev->erase_effect = uinput_dev_erase_effect; + udev->dev->private = udev; init_waitqueue_head(&(udev->waitq)); @@ -264,7 +265,7 @@ return -ENODEV; while ((udev->head != udev->tail) && - (retval + sizeof(struct uinput_device) <= count)) { + (retval + sizeof(struct input_event) <= count)) { if (copy_to_user(buffer + retval, &(udev->buff[udev->tail]), sizeof(struct input_event))) return -EFAULT; udev->tail = (udev->tail + 1) % UINPUT_BUFFER_SIZE; diff -urN linux-2.5.72-bk3/drivers/input/mouse/Kconfig linux-2.5.73/drivers/input/mouse/Kconfig --- linux-2.5.72-bk3/drivers/input/mouse/Kconfig 2003-06-16 21:20:21.000000000 -0700 +++ linux-2.5.73/drivers/input/mouse/Kconfig 2003-06-22 12:03:57.000000000 -0700 @@ -19,7 +19,9 @@ Say Y here if you have a PS/2 mouse connected to your system. This includes the standard 2 or 3-button PS/2 mouse, as well as PS/2 mice with wheels and extra buttons, Microsoft, Logitech or Genius - compatible. + compatible. Support for Synaptics TouchPads is also included. + For Synaptics TouchPad support in XFree86 you'll need this XFree86 + driver: http://w1.894.telia.com/~u89404340/touchpad/index.html If unsure, say Y. @@ -28,19 +30,6 @@ The module will be called psmouse. If you want to compile it as a module, say M here and read . -config MOUSE_PS2_SYNAPTICS - bool "Synaptics TouchPad" - default n - depends on INPUT && INPUT_MOUSE && SERIO && MOUSE_PS2 - ---help--- - Say Y here if you have a Synaptics TouchPad connected to your system. - This touchpad is found on many modern laptop computers. - Note that you also need a user space driver to interpret the data - generated by the kernel. A compatible driver for XFree86 is available - from http://... - - If unsure, say Y. - config MOUSE_SERIAL tristate "Serial mouse" depends on INPUT && INPUT_MOUSE && SERIO diff -urN linux-2.5.72-bk3/drivers/input/mouse/Makefile linux-2.5.73/drivers/input/mouse/Makefile --- linux-2.5.72-bk3/drivers/input/mouse/Makefile 2003-06-16 21:19:42.000000000 -0700 +++ linux-2.5.73/drivers/input/mouse/Makefile 2003-06-22 12:03:57.000000000 -0700 @@ -14,7 +14,4 @@ obj-$(CONFIG_MOUSE_PS2) += psmouse.o obj-$(CONFIG_MOUSE_SERIAL) += sermouse.o -psmouse-objs := psmouse-base.o -ifeq ($(CONFIG_MOUSE_PS2_SYNAPTICS),y) - psmouse-objs += synaptics.o -endif +psmouse-objs := psmouse-base.o logips2pp.o synaptics.o diff -urN linux-2.5.72-bk3/drivers/input/mouse/logips2pp.c linux-2.5.73/drivers/input/mouse/logips2pp.c --- linux-2.5.72-bk3/drivers/input/mouse/logips2pp.c 1969-12-31 16:00:00.000000000 -0800 +++ linux-2.5.73/drivers/input/mouse/logips2pp.c 2003-06-22 12:03:57.000000000 -0700 @@ -0,0 +1,228 @@ +/* + * Logitech PS/2++ mouse driver + * + * Copyright (c) 1999-2003 Vojtech Pavlik + * Copyright (c) 2003 Eric Wong + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published by + * the Free Software Foundation. + */ + +#include +#include "psmouse.h" +#include "logips2pp.h" + +/* + * Process a PS2++ or PS2T++ packet. + */ + +void ps2pp_process_packet(struct psmouse *psmouse) +{ + struct input_dev *dev = &psmouse->dev; + unsigned char *packet = psmouse->packet; + + if ((packet[0] & 0x48) == 0x48 && (packet[1] & 0x02) == 0x02) { + + switch ((packet[1] >> 4) | (packet[0] & 0x30)) { + + case 0x0d: /* Mouse extra info */ + + input_report_rel(dev, packet[2] & 0x80 ? REL_HWHEEL : REL_WHEEL, + (int) (packet[2] & 8) - (int) (packet[2] & 7)); + input_report_key(dev, BTN_SIDE, (packet[2] >> 4) & 1); + input_report_key(dev, BTN_EXTRA, (packet[2] >> 5) & 1); + + break; + + case 0x0e: /* buttons 4, 5, 6, 7, 8, 9, 10 info */ + + input_report_key(dev, BTN_SIDE, (packet[2]) & 1); + input_report_key(dev, BTN_EXTRA, (packet[2] >> 1) & 1); + input_report_key(dev, BTN_BACK, (packet[2] >> 3) & 1); + input_report_key(dev, BTN_FORWARD, (packet[2] >> 4) & 1); + input_report_key(dev, BTN_TASK, (packet[2] >> 2) & 1); + + break; + + case 0x0f: /* TouchPad extra info */ + + input_report_rel(dev, packet[2] & 0x08 ? REL_HWHEEL : REL_WHEEL, + (int) ((packet[2] >> 4) & 8) - (int) ((packet[2] >> 4) & 7)); + packet[0] = packet[2] | 0x08; + break; + +#ifdef DEBUG + default: + printk(KERN_WARNING "psmouse.c: Received PS2++ packet #%x, but don't know how to handle.\n", + (packet[1] >> 4) | (packet[0] & 0x30)); +#endif + } + + packet[0] &= 0x0f; + packet[1] = 0; + packet[2] = 0; + + } +} + +/* + * ps2pp_cmd() sends a PS2++ command, sliced into two bit + * pieces through the SETRES command. This is needed to send extended + * commands to mice on notebooks that try to understand the PS/2 protocol + * Ugly. + */ + +static int ps2pp_cmd(struct psmouse *psmouse, unsigned char *param, unsigned char command) +{ + unsigned char d; + int i; + + if (psmouse_command(psmouse, NULL, PSMOUSE_CMD_SETSCALE11)) + return -1; + + for (i = 6; i >= 0; i -= 2) { + d = (command >> i) & 3; + if(psmouse_command(psmouse, &d, PSMOUSE_CMD_SETRES)) + return -1; + } + + if (psmouse_command(psmouse, param, PSMOUSE_CMD_POLL)) + return -1; + + return 0; +} + +/* + * SmartScroll / CruiseControl for some newer Logitech mice Defaults to + * enabled if we do nothing to it. Of course I put this in because I want it + * disabled :P + * 1 - enabled (if previously disabled, also default) + * 0/2 - disabled + */ + +static void ps2pp_set_smartscroll(struct psmouse *psmouse) +{ + unsigned char param[4]; + + ps2pp_cmd(psmouse, param, 0x32); + + param[0] = 0; + psmouse_command(psmouse, param, PSMOUSE_CMD_SETRES); + psmouse_command(psmouse, param, PSMOUSE_CMD_SETRES); + psmouse_command(psmouse, param, PSMOUSE_CMD_SETRES); + + if (psmouse_smartscroll == 1) + param[0] = 1; + else + if (psmouse_smartscroll > 2) + return; + + /* else leave param[0] == 0 to disable */ + psmouse_command(psmouse, param, PSMOUSE_CMD_SETRES); +} + +/* + * Support 800 dpi resolution _only_ if the user wants it (there are good + * reasons to not use it even if the mouse supports it, and of course there are + * also good reasons to use it, let the user decide). + */ + +void ps2pp_set_800dpi(struct psmouse *psmouse) +{ + unsigned char param = 3; + psmouse_command(psmouse, NULL, PSMOUSE_CMD_SETSCALE11); + psmouse_command(psmouse, NULL, PSMOUSE_CMD_SETSCALE11); + psmouse_command(psmouse, NULL, PSMOUSE_CMD_SETSCALE11); + psmouse_command(psmouse, ¶m, PSMOUSE_CMD_SETRES); +} + +/* + * Detect the exact model and features of a PS2++ or PS2T++ Logitech mouse or + * touchpad. + */ + +int ps2pp_detect_model(struct psmouse *psmouse, unsigned char *param) +{ + int i; + static int logitech_4btn[] = { 12, 40, 41, 42, 43, 52, 73, 80, -1 }; + static int logitech_wheel[] = { 52, 53, 75, 76, 80, 81, 83, 88, 112, -1 }; + static int logitech_ps2pp[] = { 12, 13, 40, 41, 42, 43, 50, 51, 52, 53, 73, 75, + 76, 80, 81, 83, 88, 96, 97, 112, -1 }; + static int logitech_mx[] = { 112, -1 }; + + psmouse->vendor = "Logitech"; + psmouse->model = ((param[0] >> 4) & 0x07) | ((param[0] << 3) & 0x78); + + if (param[1] < 3) + clear_bit(BTN_MIDDLE, psmouse->dev.keybit); + if (param[1] < 2) + clear_bit(BTN_RIGHT, psmouse->dev.keybit); + + psmouse->type = PSMOUSE_PS2; + + for (i = 0; logitech_ps2pp[i] != -1; i++) + if (logitech_ps2pp[i] == psmouse->model) + psmouse->type = PSMOUSE_PS2PP; + + if (psmouse->type == PSMOUSE_PS2PP) { + + for (i = 0; logitech_4btn[i] != -1; i++) + if (logitech_4btn[i] == psmouse->model) + set_bit(BTN_SIDE, psmouse->dev.keybit); + + for (i = 0; logitech_wheel[i] != -1; i++) + if (logitech_wheel[i] == psmouse->model) { + set_bit(REL_WHEEL, psmouse->dev.relbit); + psmouse->name = "Wheel Mouse"; + } + + for (i = 0; logitech_mx[i] != -1; i++) + if (logitech_mx[i] == psmouse->model) { + set_bit(BTN_SIDE, psmouse->dev.keybit); + set_bit(BTN_EXTRA, psmouse->dev.keybit); + set_bit(BTN_BACK, psmouse->dev.keybit); + set_bit(BTN_FORWARD, psmouse->dev.keybit); + set_bit(BTN_TASK, psmouse->dev.keybit); + psmouse->name = "MX Mouse"; + } + +/* + * Do Logitech PS2++ / PS2T++ magic init. + */ + + if (psmouse->model == 97) { /* TouchPad 3 */ + + set_bit(REL_WHEEL, psmouse->dev.relbit); + set_bit(REL_HWHEEL, psmouse->dev.relbit); + + param[0] = 0x11; param[1] = 0x04; param[2] = 0x68; /* Unprotect RAM */ + psmouse_command(psmouse, param, 0x30d1); + param[0] = 0x11; param[1] = 0x05; param[2] = 0x0b; /* Enable features */ + psmouse_command(psmouse, param, 0x30d1); + param[0] = 0x11; param[1] = 0x09; param[2] = 0xc3; /* Enable PS2++ */ + psmouse_command(psmouse, param, 0x30d1); + + param[0] = 0; + if (!psmouse_command(psmouse, param, 0x13d1) && + param[0] == 0x06 && param[1] == 0x00 && param[2] == 0x14) { + psmouse->name = "TouchPad 3"; + return PSMOUSE_PS2TPP; + } + + } else { + + param[0] = param[1] = param[2] = 0; + ps2pp_cmd(psmouse, param, 0x39); /* Magic knock */ + ps2pp_cmd(psmouse, param, 0xDB); + + if ((param[0] & 0x78) == 0x48 && (param[1] & 0xf3) == 0xc2 && + (param[2] & 3) == ((param[1] >> 2) & 3)) { + ps2pp_set_smartscroll(psmouse); + return PSMOUSE_PS2PP; + } + } + } + + return 0; +} diff -urN linux-2.5.72-bk3/drivers/input/mouse/logips2pp.h linux-2.5.73/drivers/input/mouse/logips2pp.h --- linux-2.5.72-bk3/drivers/input/mouse/logips2pp.h 1969-12-31 16:00:00.000000000 -0800 +++ linux-2.5.73/drivers/input/mouse/logips2pp.h 2003-06-22 12:03:57.000000000 -0700 @@ -0,0 +1,17 @@ +/* + * Logitech PS/2++ mouse driver header + * + * Copyright (c) 2003 Vojtech Pavlik + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published by + * the Free Software Foundation. + */ + +#ifndef _LOGIPS2PP_H +#define _LOGIPS2PP_H +struct psmouse; +void ps2pp_process_packet(struct psmouse *psmouse); +void ps2pp_set_800dpi(struct psmouse *psmouse); +int ps2pp_detect_model(struct psmouse *psmouse, unsigned char *param); +#endif diff -urN linux-2.5.72-bk3/drivers/input/mouse/psmouse-base.c linux-2.5.73/drivers/input/mouse/psmouse-base.c --- linux-2.5.72-bk3/drivers/input/mouse/psmouse-base.c 2003-06-16 21:19:44.000000000 -0700 +++ linux-2.5.73/drivers/input/mouse/psmouse-base.c 2003-06-22 12:03:57.000000000 -0700 @@ -19,13 +19,23 @@ #include #include "psmouse.h" #include "synaptics.h" +#include "logips2pp.h" MODULE_AUTHOR("Vojtech Pavlik "); MODULE_DESCRIPTION("PS/2 mouse driver"); MODULE_PARM(psmouse_noext, "1i"); +MODULE_PARM_DESC(psmouse_noext, "Disable any protocol extensions. Useful for KVM switches."); +MODULE_PARM(psmouse_resolution, "i"); +MODULE_PARM_DESC(psmouse_resolution, "Resolution, in dpi."); +MODULE_PARM(psmouse_smartscroll, "i"); +MODULE_PARM_DESC(psmouse_smartscroll, "Logitech Smartscroll autorepeat, 1 = enabled (default), 0 = disabled."); MODULE_LICENSE("GPL"); +#define PSMOUSE_LOGITECH_SMARTSCROLL 1 + static int psmouse_noext; +int psmouse_resolution; +int psmouse_smartscroll = PSMOUSE_LOGITECH_SMARTSCROLL; static char *psmouse_protocols[] = { "None", "PS/2", "PS2++", "PS2T++", "GenPS/2", "ImPS/2", "ImExPS/2", "Synaptics"}; @@ -45,43 +55,8 @@ * The PS2++ protocol is a little bit complex */ - if (psmouse->type == PSMOUSE_PS2PP || psmouse->type == PSMOUSE_PS2TPP) { - - if ((packet[0] & 0x40) == 0x40 && abs((int)packet[1] - (((int)packet[0] & 0x10) << 4)) > 191 ) { - - switch (((packet[1] >> 4) & 0x03) | ((packet[0] >> 2) & 0x0c)) { - - case 1: /* Mouse extra info */ - - input_report_rel(dev, packet[2] & 0x80 ? REL_HWHEEL : REL_WHEEL, - (int) (packet[2] & 8) - (int) (packet[2] & 7)); - input_report_key(dev, BTN_SIDE, (packet[2] >> 4) & 1); - input_report_key(dev, BTN_EXTRA, (packet[2] >> 5) & 1); - - break; - - case 3: /* TouchPad extra info */ - - input_report_rel(dev, packet[2] & 0x08 ? REL_HWHEEL : REL_WHEEL, - (int) ((packet[2] >> 4) & 8) - (int) ((packet[2] >> 4) & 7)); - packet[0] = packet[2] | 0x08; - - break; - -#ifdef DEBUG - default: - printk(KERN_WARNING "psmouse.c: Received PS2++ packet #%x, but don't know how to handle.\n", - ((packet[1] >> 4) & 0x03) | ((packet[0] >> 2) & 0x0c)); -#endif - - } - - packet[0] &= 0x0f; - packet[1] = 0; - packet[2] = 0; - - } - } + if (psmouse->type == PSMOUSE_PS2PP || psmouse->type == PSMOUSE_PS2TPP) + ps2pp_process_packet(psmouse); /* * Scroll wheel on IntelliMice, scroll buttons on NetMice @@ -259,33 +234,6 @@ } /* - * psmouse_ps2pp_cmd() sends a PS2++ command, sliced into two bit - * pieces through the SETRES command. This is needed to send extended - * commands to mice on notebooks that try to understand the PS/2 protocol - * Ugly. - */ - -static int psmouse_ps2pp_cmd(struct psmouse *psmouse, unsigned char *param, unsigned char command) -{ - unsigned char d; - int i; - - if (psmouse_command(psmouse, NULL, PSMOUSE_CMD_SETSCALE11)) - return -1; - - for (i = 6; i >= 0; i -= 2) { - d = (command >> i) & 3; - if(psmouse_command(psmouse, &d, PSMOUSE_CMD_SETRES)) - return -1; - } - - if (psmouse_command(psmouse, param, PSMOUSE_CMD_POLL)) - return -1; - - return 0; -} - -/* * psmouse_extensions() probes for any extensions to the basic PS/2 protocol * the mouse may have. */ @@ -353,73 +301,13 @@ psmouse_command(psmouse, NULL, PSMOUSE_CMD_SETSCALE11); psmouse_command(psmouse, NULL, PSMOUSE_CMD_SETSCALE11); psmouse_command(psmouse, NULL, PSMOUSE_CMD_SETSCALE11); + param[1] = 0; psmouse_command(psmouse, param, PSMOUSE_CMD_GETINFO); if (param[1]) { - - int i; - static int logitech_4btn[] = { 12, 40, 41, 42, 43, 52, 73, 80, -1 }; - static int logitech_wheel[] = { 52, 53, 75, 76, 80, 81, 83, 88, -1 }; - static int logitech_ps2pp[] = { 12, 13, 40, 41, 42, 43, 50, 51, 52, 53, 73, 75, - 76, 80, 81, 83, 88, 96, 97, -1 }; - psmouse->vendor = "Logitech"; - psmouse->model = ((param[0] >> 4) & 0x07) | ((param[0] << 3) & 0x78); - - if (param[1] < 3) - clear_bit(BTN_MIDDLE, psmouse->dev.keybit); - if (param[1] < 2) - clear_bit(BTN_RIGHT, psmouse->dev.keybit); - - psmouse->type = PSMOUSE_PS2; - - for (i = 0; logitech_ps2pp[i] != -1; i++) - if (logitech_ps2pp[i] == psmouse->model) - psmouse->type = PSMOUSE_PS2PP; - - if (psmouse->type == PSMOUSE_PS2PP) { - - for (i = 0; logitech_4btn[i] != -1; i++) - if (logitech_4btn[i] == psmouse->model) - set_bit(BTN_SIDE, psmouse->dev.keybit); - - for (i = 0; logitech_wheel[i] != -1; i++) - if (logitech_wheel[i] == psmouse->model) { - set_bit(REL_WHEEL, psmouse->dev.relbit); - psmouse->name = "Wheel Mouse"; - } - -/* - * Do Logitech PS2++ / PS2T++ magic init. - */ - - if (psmouse->model == 97) { /* TouchPad 3 */ - - set_bit(REL_WHEEL, psmouse->dev.relbit); - set_bit(REL_HWHEEL, psmouse->dev.relbit); - - param[0] = 0x11; param[1] = 0x04; param[2] = 0x68; /* Unprotect RAM */ - psmouse_command(psmouse, param, 0x30d1); - param[0] = 0x11; param[1] = 0x05; param[2] = 0x0b; /* Enable features */ - psmouse_command(psmouse, param, 0x30d1); - param[0] = 0x11; param[1] = 0x09; param[2] = 0xc3; /* Enable PS2++ */ - psmouse_command(psmouse, param, 0x30d1); - - param[0] = 0; - if (!psmouse_command(psmouse, param, 0x13d1) && - param[0] == 0x06 && param[1] == 0x00 && param[2] == 0x14) - return PSMOUSE_PS2TPP; - - } else { - param[0] = param[1] = param[2] = 0; - - psmouse_ps2pp_cmd(psmouse, param, 0x39); /* Magic knock */ - psmouse_ps2pp_cmd(psmouse, param, 0xDB); - - if ((param[0] & 0x78) == 0x48 && (param[1] & 0xf3) == 0xc2 && - (param[2] & 3) == ((param[1] >> 2) & 3)) - return PSMOUSE_PS2PP; - } - } + int type = ps2pp_detect_model(psmouse, param); + if (type) + return type; } /* @@ -508,6 +396,31 @@ } /* + * Here we set the mouse resolution. + */ + +static void psmouse_set_resolution(struct psmouse *psmouse) +{ + unsigned char param[1]; + + if (psmouse->type == PSMOUSE_PS2PP && psmouse_resolution > 400) { + ps2pp_set_800dpi(psmouse); + return; + } + + if (!psmouse_resolution || psmouse_resolution >= 200) + param[0] = 3; + else if (psmouse_resolution >= 100) + param[0] = 2; + else if (psmouse_resolution >= 50) + param[0] = 1; + else if (psmouse_resolution) + param[0] = 0; + + psmouse_command(psmouse, param, PSMOUSE_CMD_SETRES); +} + +/* * psmouse_initialize() initializes the mouse to a sane state. */ @@ -519,7 +432,6 @@ * We set the mouse report rate to a highest possible value. * We try 100 first in case mouse fails to set 200. */ - param[0] = 100; psmouse_command(psmouse, param, PSMOUSE_CMD_SETRATE); @@ -530,8 +442,7 @@ * We also set the resolution and scaling. */ - param[0] = 3; - psmouse_command(psmouse, param, PSMOUSE_CMD_SETRES); + psmouse_set_resolution(psmouse); psmouse_command(psmouse, NULL, PSMOUSE_CMD_SETSCALE11); /* @@ -638,12 +549,28 @@ }; #ifndef MODULE -static int __init psmouse_setup(char *str) +static int __init psmouse_noext_setup(char *str) { psmouse_noext = 1; return 1; } -__setup("psmouse_noext", psmouse_setup); + +static int __init psmouse_resolution_setup(char *str) +{ + get_option(&str, &psmouse_resolution); + return 1; +} + +static int __init psmouse_smartscroll_setup(char *str) +{ + get_option(&str, &psmouse_smartscroll); + return 1; +} + +__setup("psmouse_noext", psmouse_noext_setup); +__setup("psmouse_resolution=", psmouse_resolution_setup); +__setup("psmouse_smartscroll=", psmouse_smartscroll_setup); + #endif int __init psmouse_init(void) diff -urN linux-2.5.72-bk3/drivers/input/mouse/psmouse.h linux-2.5.73/drivers/input/mouse/psmouse.h --- linux-2.5.72-bk3/drivers/input/mouse/psmouse.h 2003-06-16 21:20:22.000000000 -0700 +++ linux-2.5.73/drivers/input/mouse/psmouse.h 2003-06-22 12:03:57.000000000 -0700 @@ -46,4 +46,6 @@ int psmouse_command(struct psmouse *psmouse, unsigned char *param, int command); +extern int psmouse_smartscroll; + #endif /* _PSMOUSE_H */ diff -urN linux-2.5.72-bk3/drivers/input/mouse/synaptics.c linux-2.5.73/drivers/input/mouse/synaptics.c --- linux-2.5.72-bk3/drivers/input/mouse/synaptics.c 2003-06-16 21:19:48.000000000 -0700 +++ linux-2.5.73/drivers/input/mouse/synaptics.c 2003-06-22 12:03:57.000000000 -0700 @@ -171,9 +171,9 @@ static int query_hardware(struct psmouse *psmouse) { struct synaptics_data *priv = psmouse->private; - int retries = 3; + int retries = 0; - while ((retries++ <= 3) && synaptics_reset(psmouse)) + while ((retries++ < 3) && synaptics_reset(psmouse)) printk(KERN_ERR "synaptics reset failed\n"); if (synaptics_identify(psmouse, &priv->identity)) @@ -266,8 +266,7 @@ * Functions to interpret the absolute mode packets ****************************************************************************/ -static void synaptics_parse_hw_state(struct synaptics_data *priv, - struct synaptics_hw_state *hw) +static void synaptics_parse_hw_state(struct synaptics_data *priv, struct synaptics_hw_state *hw) { unsigned char *buf = priv->proto_buf; diff -urN linux-2.5.72-bk3/drivers/input/mouse/synaptics.h linux-2.5.73/drivers/input/mouse/synaptics.h --- linux-2.5.72-bk3/drivers/input/mouse/synaptics.h 2003-06-16 21:20:01.000000000 -0700 +++ linux-2.5.73/drivers/input/mouse/synaptics.h 2003-06-22 12:03:57.000000000 -0700 @@ -9,21 +9,11 @@ #ifndef _SYNAPTICS_H #define _SYNAPTICS_H -#ifdef CONFIG_MOUSE_PS2_SYNAPTICS extern void synaptics_process_byte(struct psmouse *psmouse, struct pt_regs *regs); extern int synaptics_init(struct psmouse *psmouse); extern void synaptics_disconnect(struct psmouse *psmouse); -#else - -static inline void synaptics_process_byte(struct psmouse *psmouse, struct pt_regs *regs) {} -static inline int synaptics_init(struct psmouse *psmouse) { return -1; } -static inline void synaptics_disconnect(struct psmouse *psmouse) {} - -#endif - - /* synaptics queries */ #define SYN_QUE_IDENTIFY 0x00 #define SYN_QUE_MODES 0x01 diff -urN linux-2.5.72-bk3/drivers/input/serio/serio.c linux-2.5.73/drivers/input/serio/serio.c --- linux-2.5.72-bk3/drivers/input/serio/serio.c 2003-06-16 21:19:39.000000000 -0700 +++ linux-2.5.73/drivers/input/serio/serio.c 2003-06-22 12:03:57.000000000 -0700 @@ -58,6 +58,7 @@ struct list_head node; }; +static DECLARE_MUTEX(serio_sem); static LIST_HEAD(serio_list); static LIST_HEAD(serio_dev_list); static LIST_HEAD(serio_event_list); @@ -90,9 +91,11 @@ switch (event->type) { case SERIO_RESCAN : + down(&serio_sem); if (event->serio->dev && event->serio->dev->disconnect) event->serio->dev->disconnect(event->serio); serio_find_dev(event->serio); + up(&serio_sem); break; default: break; @@ -153,30 +156,37 @@ void serio_register_port(struct serio *serio) { + down(&serio_sem); list_add_tail(&serio->node, &serio_list); serio_find_dev(serio); + up(&serio_sem); } void serio_unregister_port(struct serio *serio) { + down(&serio_sem); list_del_init(&serio->node); if (serio->dev && serio->dev->disconnect) serio->dev->disconnect(serio); + up(&serio_sem); } void serio_register_device(struct serio_dev *dev) { struct serio *serio; + down(&serio_sem); list_add_tail(&dev->node, &serio_dev_list); list_for_each_entry(serio, &serio_list, node) if (!serio->dev && dev->connect) dev->connect(serio, dev); + up(&serio_sem); } void serio_unregister_device(struct serio_dev *dev) { struct serio *serio; + down(&serio_sem); list_del_init(&dev->node); list_for_each_entry(serio, &serio_list, node) { @@ -184,8 +194,10 @@ dev->disconnect(serio); serio_find_dev(serio); } + up(&serio_sem); } +/* called from serio_dev->connect/disconnect methods under serio_sem */ int serio_open(struct serio *serio, struct serio_dev *dev) { if (serio->open(serio)) @@ -194,6 +206,7 @@ return 0; } +/* called from serio_dev->connect/disconnect methods under serio_sem */ void serio_close(struct serio *serio) { serio->close(serio); diff -urN linux-2.5.72-bk3/drivers/net/amd8111e.c linux-2.5.73/drivers/net/amd8111e.c --- linux-2.5.72-bk3/drivers/net/amd8111e.c 2003-06-16 21:20:05.000000000 -0700 +++ linux-2.5.73/drivers/net/amd8111e.c 2003-06-22 12:03:57.000000000 -0700 @@ -53,6 +53,8 @@ 2. Bug fix: Fixed VLAN support failure. 3. Bug fix: Fixed receive interrupt coalescing bug. 4. Dynamic IPG support is disabled by default. + 3.0.3 06/05/2003 + 1. Bug fix: Fixed failure to close the interface if SMP is enabled. */ @@ -89,9 +91,9 @@ #include "amd8111e.h" #define MODULE_NAME "amd8111e" -#define MODULE_VERSION "3.0.2" +#define MODULE_VERSION "3.0.3" MODULE_AUTHOR("Advanced Micro Devices, Inc."); -MODULE_DESCRIPTION ("AMD8111 based 10/100 Ethernet Controller. Driver Version 3.0.2"); +MODULE_DESCRIPTION ("AMD8111 based 10/100 Ethernet Controller. Driver Version 3.0.3"); MODULE_LICENSE("GPL"); MODULE_PARM(speed_duplex, "1-" __MODULE_STRING (MAX_UNITS) "i"); MODULE_PARM_DESC(speed_duplex, "Set device speed and duplex modes, 0: Auto Negotitate, 1: 10Mbps Half Duplex, 2: 10Mbps Full Duplex, 3: 100Mbps Half Duplex, 4: 100Mbps Full Duplex"); @@ -1171,11 +1173,11 @@ if(lp->options & OPTION_DYN_IPG_ENABLE) del_timer_sync(&lp->ipg_data.ipg_timer); - /* Update the statistics before closing */ - amd8111e_get_stats(dev); spin_unlock_irq(&lp->lock); - free_irq(dev->irq, dev); + + /* Update the statistics before closing */ + amd8111e_get_stats(dev); lp->opened = 0; return 0; } diff -urN linux-2.5.72-bk3/drivers/net/bonding/bond_main.c linux-2.5.73/drivers/net/bonding/bond_main.c --- linux-2.5.72-bk3/drivers/net/bonding/bond_main.c 2003-06-22 12:03:20.000000000 -0700 +++ linux-2.5.73/drivers/net/bonding/bond_main.c 2003-06-22 12:03:57.000000000 -0700 @@ -390,6 +390,7 @@ #include #include #include +#include #include #include #include @@ -2792,84 +2793,6 @@ mod_timer(&bond->arp_timer, next_timer); } -typedef uint32_t in_addr_t; - -int -my_inet_aton(char *cp, unsigned long *the_addr) { - static const in_addr_t max[4] = { 0xffffffff, 0xffffff, 0xffff, 0xff }; - in_addr_t val; - char c; - union iaddr { - uint8_t bytes[4]; - uint32_t word; - } res; - uint8_t *pp = res.bytes; - int digit,base; - - res.word = 0; - - c = *cp; - for (;;) { - /* - * Collect number up to ``.''. - * Values are specified as for C: - * 0x=hex, 0=octal, isdigit=decimal. - */ - if (!isdigit(c)) goto ret_0; - val = 0; base = 10; digit = 0; - for (;;) { - if (isdigit(c)) { - val = (val * base) + (c - '0'); - c = *++cp; - digit = 1; - } else { - break; - } - } - if (c == '.') { - /* - * Internet format: - * a.b.c.d - * a.b.c (with c treated as 16 bits) - * a.b (with b treated as 24 bits) - */ - if (pp > res.bytes + 2 || val > 0xff) { - goto ret_0; - } - *pp++ = val; - c = *++cp; - } else - break; - } - /* - * Check for trailing characters. - */ - if (c != '\0' && (!isascii(c) || !isspace(c))) { - goto ret_0; - } - /* - * Did we get a valid digit? - */ - if (!digit) { - goto ret_0; - } - - /* Check whether the last part is in its limits depending on - the number of parts in total. */ - if (val > max[pp - res.bytes]) { - goto ret_0; - } - - if (the_addr != NULL) { - *the_addr = res.word | htonl (val); - } - - return (1); - -ret_0: - return (0); -} - static int bond_sethwaddr(struct net_device *master, struct net_device *slave) { #ifdef BONDING_DEBUG @@ -3877,15 +3800,18 @@ for (arp_ip_count=0 ; (arp_ip_count < MAX_ARP_IP_TARGETS) && arp_ip_target[arp_ip_count]; arp_ip_count++ ) { - /* TODO: check and log bad ip address */ - if (my_inet_aton(arp_ip_target[arp_ip_count], - &arp_target[arp_ip_count]) == 0) { + /* not complete check, but should be good enough to + catch mistakes */ + if (!isdigit(arp_ip_target[arp_ip_count][0])) { printk(KERN_WARNING "bonding_init(): bad arp_ip_target module " "parameter (%s), ARP monitoring will not be " "performed\n", arp_ip_target[arp_ip_count]); arp_interval = 0; + } else { + u32 ip = in_aton(arp_ip_target[arp_ip_count]); + *(u32 *)(arp_ip_target[arp_ip_count]) = ip; } } diff -urN linux-2.5.72-bk3/drivers/net/hamradio/baycom_epp.c linux-2.5.73/drivers/net/hamradio/baycom_epp.c --- linux-2.5.72-bk3/drivers/net/hamradio/baycom_epp.c 2003-06-16 21:20:27.000000000 -0700 +++ linux-2.5.73/drivers/net/hamradio/baycom_epp.c 2003-06-22 12:03:57.000000000 -0700 @@ -376,7 +376,6 @@ char portarg[16]; char *argv[] = { eppconfig_path, "-s", "-p", portarg, "-m", modearg, NULL }; - int ret; /* set up arguments */ sprintf(modearg, "%sclk,%smodem,fclk=%d,bps=%d,divider=%d%s,extstat", @@ -1164,7 +1163,6 @@ static int baycom_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) { struct baycom_state *bc; - struct baycom_ioctl bi; struct hdlcdrv_ioctl hi; baycom_paranoia_check(dev, "baycom_ioctl", -EINVAL); diff -urN linux-2.5.72-bk3/drivers/net/hamradio/yam.c linux-2.5.73/drivers/net/hamradio/yam.c --- linux-2.5.72-bk3/drivers/net/hamradio/yam.c 2003-06-16 21:20:19.000000000 -0700 +++ linux-2.5.73/drivers/net/hamradio/yam.c 2003-06-22 12:03:57.000000000 -0700 @@ -721,7 +721,7 @@ unsigned char iir; int counter = 100; int i; - + int handled = 0; for (i = 0; i < NR_PORTS; i++) { yp = &yam_ports[i]; @@ -735,14 +735,17 @@ unsigned char lsr = inb(LSR(dev->base_addr)); unsigned char rxb; + handled = 1; + if (lsr & LSR_OE) ++yp->stats.rx_fifo_errors; yp->dcd = (msr & RX_DCD) ? 1 : 0; if (--counter <= 0) { - printk(KERN_ERR "%s: too many irq iir=%d\n", dev->name, iir); - return; + printk(KERN_ERR "%s: too many irq iir=%d\n", + dev->name, iir); + goto out; } if (msr & TX_RDY) { ++yp->nb_mdint; @@ -758,7 +761,8 @@ } } } - return IRQ_HANDLED; +out: + return IRQ_RETVAL(handled); } static int yam_net_get_info(char *buffer, char **start, off_t offset, int length) diff -urN linux-2.5.72-bk3/drivers/net/ixgb/ixgb_ethtool.c linux-2.5.73/drivers/net/ixgb/ixgb_ethtool.c --- linux-2.5.72-bk3/drivers/net/ixgb/ixgb_ethtool.c 2003-06-16 21:20:22.000000000 -0700 +++ linux-2.5.73/drivers/net/ixgb/ixgb_ethtool.c 2003-06-22 12:03:57.000000000 -0700 @@ -50,7 +50,6 @@ return (IXGB_EEPROM_SIZE << 1); } -#define SUPPORTED_10000baseT_Full (1 << 11) #define SPEED_10000 10000 static void diff -urN linux-2.5.72-bk3/drivers/net/pcmcia/xirc2ps_cs.c linux-2.5.73/drivers/net/pcmcia/xirc2ps_cs.c --- linux-2.5.72-bk3/drivers/net/pcmcia/xirc2ps_cs.c 2003-06-16 21:19:59.000000000 -0700 +++ linux-2.5.73/drivers/net/pcmcia/xirc2ps_cs.c 2003-06-22 12:03:57.000000000 -0700 @@ -225,9 +225,7 @@ #else #define DEBUG(n, args...) #endif -static char *version = -"xirc2ps_cs.c 1.31 1998/12/09 19:32:55 (dd9jn+kvh)"; - /* !--- CVS revision */ + #define KDBG_XIRC KERN_DEBUG "xirc2ps_cs: " #define KERR_XIRC KERN_ERR "xirc2ps_cs: " #define KWRN_XIRC KERN_WARNING "xirc2ps_cs: " @@ -358,7 +356,6 @@ typedef struct local_info_t { dev_link_t link; - struct net_device dev; dev_node_t node; struct net_device_stats stats; int card_type; @@ -432,22 +429,10 @@ #define PutByte(reg,value) outb((value), ioaddr+(reg)) #define PutWord(reg,value) outw((value), ioaddr+(reg)) -static void -busy_loop(u_long len) -{ - if (in_interrupt()) { - u_long timeout = jiffies + len; - u_long flags; - save_flags(flags); - sti(); - while (time_before_eq(jiffies, timeout)) - ; - restore_flags(flags); - } else { - __set_current_state(TASK_UNINTERRUPTIBLE); - schedule_timeout(len); - } -} +#define Wait(n) do { \ + set_current_state(TASK_UNINTERRUPTIBLE); \ + schedule_timeout(n); \ +} while (0) /*====== Functions used for debugging =================================*/ #if defined(PCMCIA_DEBUG) && 0 /* reading regs may change system status */ @@ -619,11 +604,12 @@ flush_stale_links(); /* Allocate the device structure */ - local = kmalloc(sizeof(*local), GFP_KERNEL); - if (!local) return NULL; - memset(local, 0, sizeof(*local)); - link = &local->link; dev = &local->dev; - link->priv = dev->priv = local; + dev = alloc_etherdev(sizeof(local_info_t)); + if (!dev) + return NULL; + local = dev->priv; + link = &local->link; + link->priv = dev; init_timer(&link->release); link->release.function = &xirc2ps_release; @@ -645,7 +631,6 @@ dev->get_stats = &do_get_stats; dev->do_ioctl = &do_ioctl; dev->set_multicast_list = &set_multicast_list; - ether_setup(dev); dev->open = &do_open; dev->stop = &do_stop; #ifdef HAVE_TX_TIMEOUT @@ -684,7 +669,7 @@ static void xirc2ps_detach(dev_link_t * link) { - local_info_t *local = link->priv; + struct net_device *dev = link->priv; dev_link_t **linkp; DEBUG(0, "detach(0x%p)\n", link); @@ -706,10 +691,11 @@ */ del_timer(&link->release); if (link->state & DEV_CONFIG) { - DEBUG(0, "detach postponed, '%s' still locked\n", - link->dev->dev_name); - link->state |= DEV_STALE_LINK; - return; + xirc2ps_release((unsigned long)link); + if (link->state & DEV_STALE_CONFIG) { + link->state |= DEV_STALE_LINK; + return; + } } /* Break the link with Card Services */ @@ -719,8 +705,8 @@ /* Unlink device structure, free it */ *linkp = link->next; if (link->dev) - unregister_netdev(&local->dev); - kfree(local); + unregister_netdev(dev); + kfree(dev); } /* xirc2ps_detach */ @@ -745,7 +731,8 @@ static int set_card_type(dev_link_t *link, const void *s) { - local_info_t *local = link->priv; + struct net_device *dev = link->priv; + local_info_t *local = dev->priv; #ifdef PCMCIA_DEBUG unsigned cisrev = ((const unsigned char *)s)[2]; #endif @@ -839,8 +826,8 @@ xirc2ps_config(dev_link_t * link) { client_handle_t handle = link->handle; - local_info_t *local = link->priv; - struct net_device *dev = &local->dev; + struct net_device *dev = link->priv; + local_info_t *local = dev->priv; tuple_t tuple; cisparse_t parse; ioaddr_t ioaddr; @@ -1195,11 +1182,10 @@ xirc2ps_release(u_long arg) { dev_link_t *link = (dev_link_t *) arg; - local_info_t *local = link->priv; - struct net_device *dev = &local->dev; DEBUG(0, "release(0x%p)\n", link); +#if 0 /* * If the device is currently in use, we won't release until it * is actually closed. @@ -1210,8 +1196,10 @@ link->state |= DEV_STALE_CONFIG; return; } +#endif if (link->win) { + struct net_device *dev = link->priv; local_info_t *local = dev->priv; if (local->dingo) iounmap(local->dingo_ccr - 0x0800); @@ -1243,8 +1231,7 @@ event_callback_args_t * args) { dev_link_t *link = args->client_data; - local_info_t *lp = link->priv; - struct net_device *dev = &lp->dev; + struct net_device *dev = link->priv; DEBUG(0, "event(%d)\n", (int)event); @@ -1779,12 +1766,12 @@ SelectPage(4); udelay(1); PutByte(XIRCREG4_GPR1, 0); /* clear bit 0: power down */ - busy_loop(HZ/25); /* wait 40 msec */ + Wait(HZ/25); /* wait 40 msec */ if (local->mohawk) PutByte(XIRCREG4_GPR1, 1); /* set bit 0: power up */ else PutByte(XIRCREG4_GPR1, 1 | 4); /* set bit 0: power up, bit 2: AIC */ - busy_loop(HZ/50); /* wait 20 msec */ + Wait(HZ/50); /* wait 20 msec */ } static void @@ -1798,9 +1785,9 @@ hardreset(dev); PutByte(XIRCREG_CR, SoftReset); /* set */ - busy_loop(HZ/50); /* wait 20 msec */ + Wait(HZ/50); /* wait 20 msec */ PutByte(XIRCREG_CR, 0); /* clear */ - busy_loop(HZ/25); /* wait 40 msec */ + Wait(HZ/25); /* wait 40 msec */ if (local->mohawk) { SelectPage(4); /* set pin GP1 and GP2 to output (0x0c) @@ -1811,7 +1798,7 @@ } /* give the circuits some time to power up */ - busy_loop(HZ/2); /* about 500ms */ + Wait(HZ/2); /* about 500ms */ local->last_ptr_value = 0; local->silicon = local->mohawk ? (GetByte(XIRCREG4_BOV) & 0x70) >> 4 @@ -1830,7 +1817,7 @@ SelectPage(0x42); PutByte(XIRCREG42_SWC1, 0x80); } - busy_loop(HZ/25); /* wait 40 msec to let it complete */ + Wait(HZ/25); /* wait 40 msec to let it complete */ #ifdef PCMCIA_DEBUG if (pc_debug) { @@ -1889,7 +1876,7 @@ printk(KERN_INFO "%s: MII selected\n", dev->name); SelectPage(2); PutByte(XIRCREG2_MSR, GetByte(XIRCREG2_MSR) | 0x08); - busy_loop(HZ/50); + Wait(HZ/50); } else { printk(KERN_INFO "%s: MII detected; using 10mbs\n", dev->name); @@ -1898,7 +1885,7 @@ PutByte(XIRCREG42_SWC1, 0xC0); else /* enable 10BaseT */ PutByte(XIRCREG42_SWC1, 0x80); - busy_loop(HZ/25); /* wait 40 msec to let it complete */ + Wait(HZ/25); /* wait 40 msec to let it complete */ } if (full_duplex) PutByte(XIRCREG1_ECR, GetByte(XIRCREG1_ECR | FullDuplex)); @@ -1991,7 +1978,7 @@ * Fixme: Better to use a timer here! */ for (i=0; i < 35; i++) { - busy_loop(HZ/10); /* wait 100 msec */ + Wait(HZ/10); /* wait 100 msec */ status = mii_rd(ioaddr, 0, 1); if ((status & 0x0020) && (status & 0x0004)) break; @@ -2083,12 +2070,8 @@ { pcmcia_unregister_driver(&xirc2ps_cs_driver); - while (dev_list) { - if (dev_list->state & DEV_CONFIG) - xirc2ps_release((u_long)dev_list); - if (dev_list) /* xirc2ps_release() might already have detached... */ - xirc2ps_detach(dev_list); - } + while (dev_list) + xirc2ps_detach(dev_list); } module_init(init_xirc2ps_cs); diff -urN linux-2.5.72-bk3/drivers/net/pcnet32.c linux-2.5.73/drivers/net/pcnet32.c --- linux-2.5.72-bk3/drivers/net/pcnet32.c 2003-06-16 21:19:46.000000000 -0700 +++ linux-2.5.73/drivers/net/pcnet32.c 2003-06-22 12:03:57.000000000 -0700 @@ -1003,7 +1003,7 @@ skb_reserve (rx_skbuff, 2); } - if (lp->rx_dma_addr[i] == NULL) + if (lp->rx_dma_addr[i] == 0) lp->rx_dma_addr[i] = pci_map_single(lp->pci_dev, rx_skbuff->tail, rx_skbuff->len, PCI_DMA_FROMDEVICE); lp->rx_ring[i].base = (u32)le32_to_cpu(lp->rx_dma_addr[i]); lp->rx_ring[i].buf_length = le16_to_cpu(-PKT_BUF_SZ); diff -urN linux-2.5.72-bk3/drivers/net/ppp_async.c linux-2.5.73/drivers/net/ppp_async.c --- linux-2.5.72-bk3/drivers/net/ppp_async.c 2003-06-16 21:20:19.000000000 -0700 +++ linux-2.5.73/drivers/net/ppp_async.c 2003-06-22 12:03:57.000000000 -0700 @@ -147,7 +147,6 @@ struct asyncppp *ap; int err; - MOD_INC_USE_COUNT; err = -ENOMEM; ap = kmalloc(sizeof(*ap), GFP_KERNEL); if (ap == 0) @@ -183,7 +182,6 @@ out_free: kfree(ap); out: - MOD_DEC_USE_COUNT; return err; } @@ -223,7 +221,6 @@ if (ap->tpkt != 0) kfree_skb(ap->tpkt); kfree(ap); - MOD_DEC_USE_COUNT; } /* @@ -351,6 +348,7 @@ static struct tty_ldisc ppp_ldisc = { + .owner = THIS_MODULE, .magic = TTY_LDISC_MAGIC, .name = "ppp", .open = ppp_asynctty_open, diff -urN linux-2.5.72-bk3/drivers/net/sis900.c linux-2.5.73/drivers/net/sis900.c --- linux-2.5.72-bk3/drivers/net/sis900.c 2003-06-16 21:20:00.000000000 -0700 +++ linux-2.5.73/drivers/net/sis900.c 2003-06-22 12:03:57.000000000 -0700 @@ -124,6 +124,7 @@ { "ICS LAN PHY", 0x0015, 0xF440, LAN }, { "NS 83851 PHY", 0x2000, 0x5C20, MIX }, { "Realtek RTL8201 PHY", 0x0000, 0x8200, LAN }, + { "VIA 6103 PHY", 0x0101, 0x8f20, LAN }, {0,}, }; diff -urN linux-2.5.72-bk3/drivers/net/sundance.c linux-2.5.73/drivers/net/sundance.c --- linux-2.5.72-bk3/drivers/net/sundance.c 2003-06-16 21:20:06.000000000 -0700 +++ linux-2.5.73/drivers/net/sundance.c 2003-06-22 12:03:57.000000000 -0700 @@ -980,8 +980,8 @@ { int i; for (i=0; itx_ring_dma + i*sizeof(*np->tx_ring), + printk(KERN_DEBUG "%02x %08Zx %08x %08x(%02x) %08x %08x\n", i, + np->tx_ring_dma + i*sizeof(*np->tx_ring), le32_to_cpu(np->tx_ring[i].next_desc), le32_to_cpu(np->tx_ring[i].status), (le32_to_cpu(np->tx_ring[i].status) >> 2) & 0xff, @@ -1666,7 +1666,7 @@ switch (cmd) { case SIOCDEVPRIVATE: for (i=0; itx_ring_dma + i*sizeof(*np->tx_ring), le32_to_cpu(np->tx_ring[i].next_desc), le32_to_cpu(np->tx_ring[i].status), diff -urN linux-2.5.72-bk3/drivers/net/tulip/Kconfig linux-2.5.73/drivers/net/tulip/Kconfig --- linux-2.5.72-bk3/drivers/net/tulip/Kconfig 2003-06-16 21:20:19.000000000 -0700 +++ linux-2.5.73/drivers/net/tulip/Kconfig 2003-06-22 12:03:57.000000000 -0700 @@ -37,7 +37,7 @@ ---help--- This driver is developed for the SMC EtherPower series Ethernet cards and also works with cards based on the DECchip - 21040/21041/21140 (Tulip series) chips. Some LinkSys PCI cards are + 21140 (Tulip series) chips. Some LinkSys PCI cards are of this type. (If your card is NOT SMC EtherPower 10/100 PCI (smc9332dst), you can also try the driver for "Generic DECchip" cards, above. However, most people with a network card of this type diff -urN linux-2.5.72-bk3/drivers/pci/bus.c linux-2.5.73/drivers/pci/bus.c --- linux-2.5.72-bk3/drivers/pci/bus.c 2003-06-16 21:20:25.000000000 -0700 +++ linux-2.5.73/drivers/pci/bus.c 2003-06-22 12:03:57.000000000 -0700 @@ -93,7 +93,11 @@ continue; device_add(&dev->dev); + + spin_lock(&pci_bus_lock); list_add_tail(&dev->global_list, &pci_devices); + spin_unlock(&pci_bus_lock); + pci_proc_attach_device(dev); pci_create_sysfs_dev_files(dev); @@ -108,7 +112,9 @@ * it and then scan for unattached PCI devices. */ if (dev->subordinate && list_empty(&dev->subordinate->node)) { + spin_lock(&pci_bus_lock); list_add_tail(&dev->subordinate->node, &dev->bus->children); + spin_unlock(&pci_bus_lock); pci_bus_add_devices(dev->subordinate); } } diff -urN linux-2.5.72-bk3/drivers/pci/hotplug/acpiphp.h linux-2.5.73/drivers/pci/hotplug/acpiphp.h --- linux-2.5.72-bk3/drivers/pci/hotplug/acpiphp.h 2003-06-16 21:20:27.000000000 -0700 +++ linux-2.5.73/drivers/pci/hotplug/acpiphp.h 2003-06-22 12:03:57.000000000 -0700 @@ -5,8 +5,8 @@ * Copyright (c) 2001 Greg Kroah-Hartman (greg@kroah.com) * Copyright (c) 2001 IBM Corp. * Copyright (c) 2002 Hiroshi Aono (h-aono@ap.jp.nec.com) - * Copyright (c) 2002 Takayoshi Kochi (t-kouchi@cq.jp.nec.com) - * Copyright (c) 2002 NEC Corporation + * Copyright (c) 2002,2003 Takayoshi Kochi (t-kochi@bq.jp.nec.com) + * Copyright (c) 2002,2003 NEC Corporation * * All rights reserved. * @@ -26,8 +26,7 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * Send feedback to , - * , - * + * * */ @@ -35,6 +34,7 @@ #define _ACPIPHP_H #include +#include /* for KOBJ_NAME_LEN */ #include "pci_hotplug.h" #define dbg(format, arg...) \ @@ -49,7 +49,7 @@ #define SLOT_MAGIC 0x67267322 /* name size which is used for entries in pcihpfs */ -#define SLOT_NAME_SIZE 32 /* ACPI{_SUN}-{BUS}:{DEV} */ +#define SLOT_NAME_SIZE KOBJ_NAME_LEN /* {_SUN} */ struct acpiphp_bridge; struct acpiphp_slot; @@ -212,11 +212,7 @@ #define FUNC_HAS_PS2 (0x00000040) #define FUNC_HAS_PS3 (0x00000080) -/* not yet */ -#define SLOT_SUPPORT_66MHZ (0x00010000) -#define SLOT_SUPPORT_100MHZ (0x00020000) -#define SLOT_SUPPORT_133MHZ (0x00040000) -#define SLOT_SUPPORT_PCIX (0x00080000) +#define FUNC_EXISTS (0x10000000) /* to make sure we call _EJ0 only for existing funcs */ /* function prototypes */ diff -urN linux-2.5.72-bk3/drivers/pci/hotplug/acpiphp_core.c linux-2.5.73/drivers/pci/hotplug/acpiphp_core.c --- linux-2.5.72-bk3/drivers/pci/hotplug/acpiphp_core.c 2003-06-16 21:20:06.000000000 -0700 +++ linux-2.5.73/drivers/pci/hotplug/acpiphp_core.c 2003-06-22 12:03:57.000000000 -0700 @@ -5,8 +5,8 @@ * Copyright (c) 2001 Greg Kroah-Hartman (greg@kroah.com) * Copyright (c) 2001 IBM Corp. * Copyright (c) 2002 Hiroshi Aono (h-aono@ap.jp.nec.com) - * Copyright (c) 2002 Takayoshi Kochi (t-kouchi@cq.jp.nec.com) - * Copyright (c) 2002 NEC Corporation + * Copyright (c) 2002,2003 Takayoshi Kochi (t-kochi@bq.jp.nec.com) + * Copyright (c) 2002,2003 NEC Corporation * * All rights reserved. * @@ -26,8 +26,7 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * Send feedback to , - * , - * + * * */ @@ -57,7 +56,7 @@ static int num_slots; #define DRIVER_VERSION "0.4" -#define DRIVER_AUTHOR "Greg Kroah-Hartman , Takayoshi Kochi " +#define DRIVER_AUTHOR "Greg Kroah-Hartman , Takayoshi Kochi " #define DRIVER_DESC "ACPI Hot Plug PCI Controller Driver" MODULE_AUTHOR(DRIVER_AUTHOR); @@ -376,10 +375,8 @@ */ static void make_slot_name (struct slot *slot) { - snprintf(slot->hotplug_slot->name, SLOT_NAME_SIZE, "ACPI%d-%02x:%02x", - slot->acpi_slot->sun, - slot->acpi_slot->bridge->bus, - slot->acpi_slot->device); + snprintf(slot->hotplug_slot->name, SLOT_NAME_SIZE, "%u", + slot->acpi_slot->sun); } /** diff -urN linux-2.5.72-bk3/drivers/pci/hotplug/acpiphp_glue.c linux-2.5.73/drivers/pci/hotplug/acpiphp_glue.c --- linux-2.5.72-bk3/drivers/pci/hotplug/acpiphp_glue.c 2003-06-16 21:19:47.000000000 -0700 +++ linux-2.5.73/drivers/pci/hotplug/acpiphp_glue.c 2003-06-22 12:03:57.000000000 -0700 @@ -1,9 +1,9 @@ /* * ACPI PCI HotPlug glue functions to ACPI CA subsystem * - * Copyright (c) 2002 Takayoshi Kochi (t-kouchi@cq.jp.nec.com) + * Copyright (c) 2002,2003 Takayoshi Kochi (t-kochi@bq.jp.nec.com) * Copyright (c) 2002 Hiroshi Aono (h-aono@ap.jp.nec.com) - * Copyright (c) 2002 NEC Corporation + * Copyright (c) 2002,2003 NEC Corporation * * All rights reserved. * @@ -22,7 +22,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * - * Send feedback to + * Send feedback to * */ @@ -204,7 +204,6 @@ if (ACPI_FAILURE(status)) { err("failed to register interrupt notify handler\n"); - kfree(newfunc); return status; } @@ -617,9 +616,8 @@ /* find hot-pluggable slots, and then find P2P bridge */ -static int add_bridges(struct acpi_device *device) +static int add_bridge(acpi_handle handle) { - acpi_handle *handle = device->handle; acpi_status status; unsigned long tmp; int seg, bus; @@ -673,6 +671,12 @@ } +static void remove_bridge (acpi_handle handle) +{ + /* No-op for now .. */ +} + + static int power_on_slot (struct acpiphp_slot *slot) { acpi_status status; @@ -725,9 +729,7 @@ list_for_each (l, &slot->funcs) { func = list_entry(l, struct acpiphp_func, sibling); - if (func->flags & FUNC_HAS_PS3) { - dbg("%s: executing _PS3 on %s\n", __FUNCTION__, - func->pci_dev->slot_name); + if (func->flags & (FUNC_HAS_PS3 | FUNC_EXISTS)) { status = acpi_evaluate_object(func->handle, "_PS3", NULL, NULL); if (ACPI_FAILURE(status)) { warn("%s: _PS3 failed\n", __FUNCTION__); @@ -740,10 +742,8 @@ list_for_each (l, &slot->funcs) { func = list_entry(l, struct acpiphp_func, sibling); - if (func->flags & FUNC_HAS_EJ0) { - dbg("%s: executing _EJ0 on %s\n", __FUNCTION__, - func->pci_dev->slot_name); - + /* We don't want to call _EJ0 on non-existing functions. */ + if (func->flags & (FUNC_HAS_EJ0 | FUNC_EXISTS)) { /* _EJ0 method take one argument */ arg_list.count = 1; arg_list.pointer = &arg; @@ -756,6 +756,7 @@ retval = -1; goto err_exit; } + func->flags &= (~FUNC_EXISTS); } } @@ -835,6 +836,8 @@ retval = acpiphp_configure_function(func); if (retval) goto err_exit; + + func->flags |= FUNC_EXISTS; } slot->flags |= SLOT_ENABLED; @@ -1029,13 +1032,10 @@ } } -static struct acpi_driver acpi_pci_hp_driver = { - .name = "pci_hp", - .class = "", - .ids = ACPI_PCI_HOST_HID, - .ops = { - .add = add_bridges, - } + +static struct acpi_pci_driver acpi_pci_hp_driver = { + .add = add_bridge, + .remove = remove_bridge, }; /** @@ -1044,17 +1044,15 @@ */ int acpiphp_glue_init (void) { - acpi_status status; + int num; if (list_empty(&pci_root_buses)) return -1; - status = acpi_bus_register_driver(&acpi_pci_hp_driver); + num = acpi_pci_register_driver(&acpi_pci_hp_driver); - if (ACPI_FAILURE(status)) { - err("%s: acpi_walk_namespace() failed\n", __FUNCTION__); + if (num <= 0) return -1; - } return 0; } @@ -1296,7 +1294,7 @@ /* * attention LED ON: 1 - * OFF: 0 + * OFF: 0 * * TBD * no direct attention led status information via ACPI diff -urN linux-2.5.72-bk3/drivers/pci/hotplug/acpiphp_pci.c linux-2.5.73/drivers/pci/hotplug/acpiphp_pci.c --- linux-2.5.72-bk3/drivers/pci/hotplug/acpiphp_pci.c 2003-06-16 21:19:37.000000000 -0700 +++ linux-2.5.73/drivers/pci/hotplug/acpiphp_pci.c 2003-06-22 12:03:57.000000000 -0700 @@ -4,7 +4,7 @@ * Copyright (c) 1995,2001 Compaq Computer Corporation * Copyright (c) 2001 Greg Kroah-Hartman (greg@kroah.com) * Copyright (c) 2001,2002 IBM Corp. - * Copyright (c) 2002 Takayoshi Kochi (t-kouchi@cq.jp.nec.com) + * Copyright (c) 2002 Takayoshi Kochi (t-kochi@bq.jp.nec.com) * Copyright (c) 2002 Hiroshi Aono (h-aono@ap.jp.nec.com) * Copyright (c) 2002 NEC Corporation * @@ -25,7 +25,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * - * Send feedback to + * Send feedback to * */ diff -urN linux-2.5.72-bk3/drivers/pci/hotplug/acpiphp_res.c linux-2.5.73/drivers/pci/hotplug/acpiphp_res.c --- linux-2.5.72-bk3/drivers/pci/hotplug/acpiphp_res.c 2003-06-16 21:19:59.000000000 -0700 +++ linux-2.5.73/drivers/pci/hotplug/acpiphp_res.c 2003-06-22 12:03:57.000000000 -0700 @@ -5,7 +5,7 @@ * Copyright (c) 2001 Greg Kroah-Hartman (greg@kroah.com) * Copyright (c) 2001 IBM Corp. * Copyright (c) 2002 Hiroshi Aono (h-aono@ap.jp.nec.com) - * Copyright (c) 2002 Takayoshi Kochi (t-kouchi@cq.jp.nec.com) + * Copyright (c) 2002 Takayoshi Kochi (t-kochi@bq.jp.nec.com) * Copyright (c) 2002 NEC Corporation * * All rights reserved. @@ -25,7 +25,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * - * Send feedback to , + * Send feedback to , * */ diff -urN linux-2.5.72-bk3/drivers/pci/hotplug.c linux-2.5.73/drivers/pci/hotplug.c --- linux-2.5.72-bk3/drivers/pci/hotplug.c 2003-06-16 21:20:22.000000000 -0700 +++ linux-2.5.73/drivers/pci/hotplug.c 2003-06-22 12:03:57.000000000 -0700 @@ -173,6 +173,24 @@ } EXPORT_SYMBOL(pci_visit_dev); +static void pci_destroy_dev(struct pci_dev *dev) +{ + pci_proc_detach_device(dev); + device_unregister(&dev->dev); + + /* Remove the device from the device lists, and prevent any further + * list accesses from this device */ + spin_lock(&pci_bus_lock); + list_del(&dev->bus_list); + list_del(&dev->global_list); + dev->bus_list.next = dev->bus_list.prev = NULL; + dev->global_list.next = dev->global_list.prev = NULL; + spin_unlock(&pci_bus_lock); + + pci_free_resources(dev); + pci_dev_put(dev); +} + /** * pci_remove_device_safe - remove an unused hotplug device * @dev: the device to remove @@ -186,11 +204,7 @@ { if (pci_dev_driver(dev)) return -EBUSY; - device_unregister(&dev->dev); - list_del(&dev->bus_list); - list_del(&dev->global_list); - pci_free_resources(dev); - pci_proc_detach_device(dev); + pci_destroy_dev(dev); return 0; } EXPORT_SYMBOL(pci_remove_device_safe); @@ -237,17 +251,15 @@ pci_remove_behind_bridge(dev); pci_proc_detach_bus(b); + spin_lock(&pci_bus_lock); list_del(&b->node); + spin_unlock(&pci_bus_lock); + kfree(b); dev->subordinate = NULL; } - device_unregister(&dev->dev); - list_del(&dev->bus_list); - list_del(&dev->global_list); - pci_free_resources(dev); - pci_proc_detach_device(dev); - pci_put_dev(dev); + pci_destroy_dev(dev); } /** diff -urN linux-2.5.72-bk3/drivers/pci/pci-driver.c linux-2.5.73/drivers/pci/pci-driver.c --- linux-2.5.72-bk3/drivers/pci/pci-driver.c 2003-06-16 21:20:07.000000000 -0700 +++ linux-2.5.73/drivers/pci/pci-driver.c 2003-06-22 12:03:57.000000000 -0700 @@ -138,10 +138,10 @@ drv = to_pci_driver(dev->driver); pci_dev = to_pci_dev(dev); - pci_get_dev(pci_dev); + pci_dev_get(pci_dev); error = __pci_device_probe(drv, pci_dev); if (error) - pci_put_dev(pci_dev); + pci_dev_put(pci_dev); return error; } @@ -156,7 +156,7 @@ drv->remove(pci_dev); pci_dev->driver = NULL; } - pci_put_dev(pci_dev); + pci_dev_put(pci_dev); return 0; } @@ -448,18 +448,18 @@ } /** - * pci_get_dev - increments the reference count of the pci device structure + * pci_dev_get - increments the reference count of the pci device structure * @dev: the device being referenced * * Each live reference to a device should be refcounted. * * Drivers for PCI devices should normally record such references in * their probe() methods, when they bind to a device, and release - * them by calling pci_put_dev(), in their disconnect() methods. + * them by calling pci_dev_put(), in their disconnect() methods. * * A pointer to the device with the incremented reference counter is returned. */ -struct pci_dev *pci_get_dev (struct pci_dev *dev) +struct pci_dev *pci_dev_get(struct pci_dev *dev) { struct device *tmp; @@ -474,13 +474,13 @@ } /** - * pci_put_dev - release a use of the pci device structure + * pci_dev_put - release a use of the pci device structure * @dev: device that's been disconnected * * Must be called when a user of a device is finished with it. When the last * user of the device calls this function, the memory of the device is freed. */ -void pci_put_dev(struct pci_dev *dev) +void pci_dev_put(struct pci_dev *dev) { if (dev) put_device(&dev->dev); @@ -504,5 +504,5 @@ EXPORT_SYMBOL(pci_unregister_driver); EXPORT_SYMBOL(pci_dev_driver); EXPORT_SYMBOL(pci_bus_type); -EXPORT_SYMBOL(pci_get_dev); -EXPORT_SYMBOL(pci_put_dev); +EXPORT_SYMBOL(pci_dev_get); +EXPORT_SYMBOL(pci_dev_put); diff -urN linux-2.5.72-bk3/drivers/pci/pci-sysfs.c linux-2.5.73/drivers/pci/pci-sysfs.c --- linux-2.5.72-bk3/drivers/pci/pci-sysfs.c 2003-06-16 21:20:02.000000000 -0700 +++ linux-2.5.73/drivers/pci/pci-sysfs.c 2003-06-22 12:03:57.000000000 -0700 @@ -18,12 +18,6 @@ #include "pci.h" -#if BITS_PER_LONG == 32 -#define LONG_FORMAT "\t%08lx" -#else -#define LONG_FORMAT "\t%16lx" -#endif - /* show configuration fields */ #define pci_config_attr(field, format_string) \ static ssize_t \ @@ -36,11 +30,11 @@ } \ static DEVICE_ATTR(field, S_IRUGO, show_##field, NULL); -pci_config_attr(vendor, "%04x\n"); -pci_config_attr(device, "%04x\n"); -pci_config_attr(subsystem_vendor, "%04x\n"); -pci_config_attr(subsystem_device, "%04x\n"); -pci_config_attr(class, "%06x\n"); +pci_config_attr(vendor, "0x%04x\n"); +pci_config_attr(device, "0x%04x\n"); +pci_config_attr(subsystem_vendor, "0x%04x\n"); +pci_config_attr(subsystem_device, "0x%04x\n"); +pci_config_attr(class, "0x%06x\n"); pci_config_attr(irq, "%u\n"); /* show resources */ @@ -50,9 +44,13 @@ struct pci_dev * pci_dev = to_pci_dev(dev); char * str = buf; int i; + int max = 7; + + if (pci_dev->subordinate) + max = DEVICE_COUNT_RESOURCE; - for (i = 0; i < DEVICE_COUNT_RESOURCE && pci_resource_start(pci_dev,i); i++) { - str += sprintf(str,LONG_FORMAT LONG_FORMAT LONG_FORMAT "\n", + for (i = 0; i < max; i++) { + str += sprintf(str,"0x%016lx 0x%016lx 0x%016lx\n", pci_resource_start(pci_dev,i), pci_resource_end(pci_dev,i), pci_resource_flags(pci_dev,i)); diff -urN linux-2.5.72-bk3/drivers/pci/pci.h linux-2.5.73/drivers/pci/pci.h --- linux-2.5.72-bk3/drivers/pci/pci.h 2003-06-16 21:19:57.000000000 -0700 +++ linux-2.5.73/drivers/pci/pci.h 2003-06-22 12:03:57.000000000 -0700 @@ -58,3 +58,6 @@ extern int pci_visit_dev(struct pci_visit *fn, struct pci_dev_wrapped *wrapped_dev, struct pci_bus_wrapped *wrapped_parent); + +/* Lock for read/write access to pci device and bus lists */ +extern spinlock_t pci_bus_lock; diff -urN linux-2.5.72-bk3/drivers/pci/probe.c linux-2.5.73/drivers/pci/probe.c --- linux-2.5.72-bk3/drivers/pci/probe.c 2003-06-16 21:20:07.000000000 -0700 +++ linux-2.5.73/drivers/pci/probe.c 2003-06-22 12:03:57.000000000 -0700 @@ -524,7 +524,7 @@ } device_initialize(&dev->dev); dev->dev.release = pci_release_dev; - pci_get_dev(dev); + pci_dev_get(dev); pci_name_device(dev); diff -urN linux-2.5.72-bk3/drivers/pci/proc.c linux-2.5.73/drivers/pci/proc.c --- linux-2.5.72-bk3/drivers/pci/proc.c 2003-06-16 21:20:05.000000000 -0700 +++ linux-2.5.73/drivers/pci/proc.c 2003-06-22 12:03:57.000000000 -0700 @@ -308,39 +308,45 @@ /* iterator */ static void *pci_seq_start(struct seq_file *m, loff_t *pos) { - struct list_head *p = &pci_devices; + struct pci_dev *dev = NULL; loff_t n = *pos; - /* XXX: surely we need some locking for traversing the list? */ + dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev); while (n--) { - p = p->next; - if (p == &pci_devices) - return NULL; + dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev); + if (dev == NULL) + goto exit; } - return p; +exit: + return dev; } + static void *pci_seq_next(struct seq_file *m, void *v, loff_t *pos) { - struct list_head *p = v; + struct pci_dev *dev = v; + (*pos)++; - return p->next != &pci_devices ? (void *)p->next : NULL; + dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev); + return dev; } + static void pci_seq_stop(struct seq_file *m, void *v) { - /* release whatever locks we need */ + if (v) { + struct pci_dev *dev = v; + pci_dev_put(dev); + } } static int show_device(struct seq_file *m, void *v) { - struct list_head *p = v; - const struct pci_dev *dev; + const struct pci_dev *dev = v; const struct pci_driver *drv; int i; - if (p == &pci_devices) + if (dev == NULL) return 0; - dev = pci_dev_g(p); drv = pci_dev_driver(dev); seq_printf(m, "%02x%02x\t%04x%04x\t%x", dev->bus->number, @@ -383,7 +389,8 @@ return -EACCES; if (!(de = bus->procdir)) { - sprintf(name, "%02x", bus->number); + if (pci_name_bus(name, bus)) + return -EEXIST; de = bus->procdir = proc_mkdir(name, proc_bus_pci_dir); if (!de) return -ENOMEM; @@ -451,19 +458,18 @@ */ static int show_dev_config(struct seq_file *m, void *v) { - struct list_head *p = v; - struct pci_dev *dev; + struct pci_dev *dev = v; + struct pci_dev *first_dev; struct pci_driver *drv; u32 class_rev; unsigned char latency, min_gnt, max_lat, *class; int reg; - if (p == &pci_devices) { + first_dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, NULL); + if (dev == first_dev) seq_puts(m, "PCI devices found:\n"); - return 0; - } + pci_dev_put(first_dev); - dev = pci_dev_g(p); drv = pci_dev_driver(dev); pci_read_config_dword(dev, PCI_CLASS_REVISION, &class_rev); diff -urN linux-2.5.72-bk3/drivers/pci/quirks.c linux-2.5.73/drivers/pci/quirks.c --- linux-2.5.72-bk3/drivers/pci/quirks.c 2003-06-16 21:19:39.000000000 -0700 +++ linux-2.5.73/drivers/pci/quirks.c 2003-06-22 12:03:57.000000000 -0700 @@ -690,6 +690,9 @@ if ((dev->device == PCI_DEVICE_ID_INTEL_82850_HB) && (dev->subsystem_device == 0x8030)) /* P4T533 */ asus_hides_smbus = 1; + if ((dev->device == PCI_DEVICE_ID_INTEL_7205_0) && + (dev->subsystem_device == 0x8070)) /* P4G8X Deluxe */ + asus_hides_smbus = 1; return; } @@ -838,6 +841,7 @@ { PCI_FIXUP_HEADER, PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82845_HB, asus_hides_smbus_hostbridge }, { PCI_FIXUP_HEADER, PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82845G_HB, asus_hides_smbus_hostbridge }, { PCI_FIXUP_HEADER, PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82850_HB, asus_hides_smbus_hostbridge }, + { PCI_FIXUP_HEADER, PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_7205_0, asus_hides_smbus_hostbridge }, { PCI_FIXUP_HEADER, PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801DB_0, asus_hides_smbus_lpc }, { PCI_FIXUP_HEADER, PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801BA_0, asus_hides_smbus_lpc }, diff -urN linux-2.5.72-bk3/drivers/pci/search.c linux-2.5.73/drivers/pci/search.c --- linux-2.5.72-bk3/drivers/pci/search.c 2003-06-16 21:19:37.000000000 -0700 +++ linux-2.5.73/drivers/pci/search.c 2003-06-22 12:03:57.000000000 -0700 @@ -1,6 +1,17 @@ +/* + * PCI searching functions. + * + * Copyright 1993 -- 1997 Drew Eckhardt, Frederic Potter, + * David Mosberger-Tang + * Copyright 1997 -- 2000 Martin Mares + * Copyright 2003 -- Greg Kroah-Hartman + */ + #include #include +spinlock_t pci_bus_lock = SPIN_LOCK_UNLOCKED; + static struct pci_bus * pci_do_find_bus(struct pci_bus* bus, unsigned char busnr) { @@ -52,11 +63,15 @@ struct pci_bus * pci_find_next_bus(const struct pci_bus *from) { - struct list_head *n = from ? from->node.next : pci_root_buses.next; + struct list_head *n; struct pci_bus *b = NULL; + WARN_ON(irqs_disabled()); + spin_lock(&pci_bus_lock); + n = from ? from->node.next : pci_root_buses.next; if (n != &pci_root_buses) b = pci_bus_b(n); + spin_unlock(&pci_bus_lock); return b; } @@ -97,24 +112,36 @@ * device structure is returned. Otherwise, %NULL is returned. * A new search is initiated by passing %NULL to the @from argument. * Otherwise if @from is not %NULL, searches continue from next device on the global list. + * + * NOTE: Do not use this function anymore, use pci_get_subsys() instead, as + * the pci device returned by this function can disappear at any moment in + * time. */ struct pci_dev * pci_find_subsys(unsigned int vendor, unsigned int device, unsigned int ss_vendor, unsigned int ss_device, const struct pci_dev *from) { - struct list_head *n = from ? from->global_list.next : pci_devices.next; + struct list_head *n; + struct pci_dev *dev; + + WARN_ON(irqs_disabled()); + spin_lock(&pci_bus_lock); + n = from ? from->global_list.next : pci_devices.next; - while (n != &pci_devices) { - struct pci_dev *dev = pci_dev_g(n); + while (n && (n != &pci_devices)) { + dev = pci_dev_g(n); if ((vendor == PCI_ANY_ID || dev->vendor == vendor) && (device == PCI_ANY_ID || dev->device == device) && (ss_vendor == PCI_ANY_ID || dev->subsystem_vendor == ss_vendor) && (ss_device == PCI_ANY_ID || dev->subsystem_device == ss_device)) - return dev; + goto exit; n = n->next; } - return NULL; + dev = NULL; +exit: + spin_unlock(&pci_bus_lock); + return dev; } /** @@ -128,6 +155,10 @@ * returned. Otherwise, %NULL is returned. * A new search is initiated by passing %NULL to the @from argument. * Otherwise if @from is not %NULL, searches continue from next device on the global list. + * + * NOTE: Do not use this function anymore, use pci_get_device() instead, as + * the pci device returned by this function can disappear at any moment in + * time. */ struct pci_dev * pci_find_device(unsigned int vendor, unsigned int device, const struct pci_dev *from) @@ -135,6 +166,77 @@ return pci_find_subsys(vendor, device, PCI_ANY_ID, PCI_ANY_ID, from); } +/** + * pci_get_subsys - begin or continue searching for a PCI device by vendor/subvendor/device/subdevice id + * @vendor: PCI vendor id to match, or %PCI_ANY_ID to match all vendor ids + * @device: PCI device id to match, or %PCI_ANY_ID to match all device ids + * @ss_vendor: PCI subsystem vendor id to match, or %PCI_ANY_ID to match all vendor ids + * @ss_device: PCI subsystem device id to match, or %PCI_ANY_ID to match all device ids + * @from: Previous PCI device found in search, or %NULL for new search. + * + * Iterates through the list of known PCI devices. If a PCI device is + * found with a matching @vendor, @device, @ss_vendor and @ss_device, a pointer to its + * device structure is returned, and the reference count to the device is + * incremented. Otherwise, %NULL is returned. A new search is initiated by + * passing %NULL to the @from argument. Otherwise if @from is not %NULL, + * searches continue from next device on the global list. + * The reference count for @from is always decremented if it is not %NULL. + */ +struct pci_dev * +pci_get_subsys(unsigned int vendor, unsigned int device, + unsigned int ss_vendor, unsigned int ss_device, + struct pci_dev *from) +{ + struct list_head *n; + struct pci_dev *dev; + + WARN_ON(irqs_disabled()); + spin_lock(&pci_bus_lock); + n = from ? from->global_list.next : pci_devices.next; + + while (n && (n != &pci_devices)) { + dev = pci_dev_g(n); + if ((vendor == PCI_ANY_ID || dev->vendor == vendor) && + (device == PCI_ANY_ID || dev->device == device) && + (ss_vendor == PCI_ANY_ID || dev->subsystem_vendor == ss_vendor) && + (ss_device == PCI_ANY_ID || dev->subsystem_device == ss_device)) + goto exit; + n = n->next; + } + dev = NULL; +exit: + pci_dev_put(from); + dev = pci_dev_get(dev); + spin_unlock(&pci_bus_lock); + return dev; +} + +/** + * pci_get_device - begin or continue searching for a PCI device by vendor/device id + * @vendor: PCI vendor id to match, or %PCI_ANY_ID to match all vendor ids + * @device: PCI device id to match, or %PCI_ANY_ID to match all device ids + * @from: Previous PCI device found in search, or %NULL for new search. + * + * Iterates through the list of known PCI devices. If a PCI device is + * found with a matching @vendor and @device, a pointer to its device structure is + * returned. Otherwise, %NULL is returned. + * A new search is initiated by passing %NULL to the @from argument. + * Otherwise if @from is not %NULL, searches continue from next device on the global list. + * + * Iterates through the list of known PCI devices. If a PCI device is + * found with a matching @vendor and @device, the reference count to the + * device is incremented and a pointer to its device structure is returned. + * Otherwise, %NULL is returned. A new search is initiated by passing %NULL + * to the @from argument. Otherwise if @from is not %NULL, searches continue + * from next device on the global list. The reference count for @from is + * always decremented if it is not %NULL. + */ +struct pci_dev * +pci_get_device(unsigned int vendor, unsigned int device, struct pci_dev *from) +{ + return pci_get_subsys(vendor, device, PCI_ANY_ID, PCI_ANY_ID, from); +} + /** * pci_find_device_reverse - begin or continue searching for a PCI device by vendor/device id @@ -151,16 +253,24 @@ struct pci_dev * pci_find_device_reverse(unsigned int vendor, unsigned int device, const struct pci_dev *from) { - struct list_head *n = from ? from->global_list.prev : pci_devices.prev; + struct list_head *n; + struct pci_dev *dev; - while (n != &pci_devices) { - struct pci_dev *dev = pci_dev_g(n); + WARN_ON(irqs_disabled()); + spin_lock(&pci_bus_lock); + n = from ? from->global_list.prev : pci_devices.prev; + + while (n && (n != &pci_devices)) { + dev = pci_dev_g(n); if ((vendor == PCI_ANY_ID || dev->vendor == vendor) && (device == PCI_ANY_ID || dev->device == device)) - return dev; + goto exit; n = n->prev; } - return NULL; + dev = NULL; +exit: + spin_unlock(&pci_bus_lock); + return dev; } @@ -179,15 +289,22 @@ struct pci_dev * pci_find_class(unsigned int class, const struct pci_dev *from) { - struct list_head *n = from ? from->global_list.next : pci_devices.next; + struct list_head *n; + struct pci_dev *dev; - while (n != &pci_devices) { - struct pci_dev *dev = pci_dev_g(n); + spin_lock(&pci_bus_lock); + n = from ? from->global_list.next : pci_devices.next; + + while (n && (n != &pci_devices)) { + dev = pci_dev_g(n); if (dev->class == class) - return dev; + goto exit; n = n->next; } - return NULL; + dev = NULL; +exit: + spin_unlock(&pci_bus_lock); + return dev; } EXPORT_SYMBOL(pci_find_bus); @@ -196,3 +313,5 @@ EXPORT_SYMBOL(pci_find_device_reverse); EXPORT_SYMBOL(pci_find_slot); EXPORT_SYMBOL(pci_find_subsys); +EXPORT_SYMBOL(pci_get_device); +EXPORT_SYMBOL(pci_get_subsys); diff -urN linux-2.5.72-bk3/drivers/pcmcia/i82365.c linux-2.5.73/drivers/pcmcia/i82365.c --- linux-2.5.72-bk3/drivers/pcmcia/i82365.c 2003-06-16 21:20:22.000000000 -0700 +++ linux-2.5.73/drivers/pcmcia/i82365.c 2003-06-22 12:03:58.000000000 -0700 @@ -1471,6 +1471,10 @@ pcmcia_unregister_socket(&socket[i].socket); break; } + class_device_create_file(&socket[i].socket.dev, + &class_device_attr_info); + class_device_create_file(&socket[i].socket.dev, + &class_device_attr_exca); } /* Finally, schedule a polling interrupt */ @@ -1481,9 +1485,6 @@ poll_timer.expires = jiffies + poll_interval; add_timer(&poll_timer); } - - class_device_create_file(&socket[i].socket.dev, &class_device_attr_info); - class_device_create_file(&socket[i].socket.dev, &class_device_attr_exca); return 0; diff -urN linux-2.5.72-bk3/drivers/scsi/aacraid/aachba.c linux-2.5.73/drivers/scsi/aacraid/aachba.c --- linux-2.5.72-bk3/drivers/scsi/aacraid/aachba.c 2003-06-16 21:20:00.000000000 -0700 +++ linux-2.5.73/drivers/scsi/aacraid/aachba.c 2003-06-22 12:03:59.000000000 -0700 @@ -1518,7 +1518,7 @@ dev = (struct aac_dev *)scsicmd->device->host->hostdata; // Get rid of old data psg->count = cpu_to_le32(0); - psg->sg[0].addr = cpu_to_le32(NULL); + psg->sg[0].addr = cpu_to_le32(0); psg->sg[0].count = cpu_to_le32(0); if (scsicmd->use_sg) { struct scatterlist *sg; @@ -1558,7 +1558,7 @@ psg->count = cpu_to_le32(1); psg->sg[0].addr = cpu_to_le32(addr); psg->sg[0].count = cpu_to_le32(scsicmd->request_bufflen); - scsicmd->SCp.ptr = (char *)addr; + scsicmd->SCp.ptr = (char *)(ulong)addr; byte_count = scsicmd->request_bufflen; } return byte_count; @@ -1574,8 +1574,8 @@ dev = (struct aac_dev *)scsicmd->device->host->hostdata; // Get rid of old data psg->count = cpu_to_le32(0); - psg->sg[0].addr[0] = cpu_to_le32(NULL); - psg->sg[0].addr[1] = cpu_to_le32(NULL); + psg->sg[0].addr[0] = cpu_to_le32(0); + psg->sg[0].addr[1] = cpu_to_le32(0); psg->sg[0].count = cpu_to_le32(0); if (scsicmd->use_sg) { struct scatterlist *sg; @@ -1619,7 +1619,7 @@ psg->sg[0].addr[1] = (u32)(le_addr>>32); psg->sg[0].addr[0] = (u32)(le_addr & 0xffffffff); psg->sg[0].count = cpu_to_le32(scsicmd->request_bufflen); - scsicmd->SCp.ptr = (char *)addr; + scsicmd->SCp.ptr = (char *)(ulong)addr; byte_count = scsicmd->request_bufflen; } return byte_count; diff -urN linux-2.5.72-bk3/drivers/scsi/aic7xxx/aic79xx_osm_pci.c linux-2.5.73/drivers/scsi/aic7xxx/aic79xx_osm_pci.c --- linux-2.5.72-bk3/drivers/scsi/aic7xxx/aic79xx_osm_pci.c 2003-06-16 21:19:46.000000000 -0700 +++ linux-2.5.73/drivers/scsi/aic7xxx/aic79xx_osm_pci.c 2003-06-22 12:03:59.000000000 -0700 @@ -52,9 +52,11 @@ const struct pci_device_id *ent); static int ahd_linux_pci_reserve_io_regions(struct ahd_softc *ahd, u_long *base, u_long *base2); +#ifdef MMAPIO static int ahd_linux_pci_reserve_mem_region(struct ahd_softc *ahd, u_long *bus_addr, uint8_t **maddr); +#endif #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) static void ahd_linux_pci_dev_remove(struct pci_dev *pdev); @@ -271,6 +273,7 @@ return (0); } +#ifdef MMAPIO static int ahd_linux_pci_reserve_mem_region(struct ahd_softc *ahd, u_long *bus_addr, @@ -318,6 +321,7 @@ error = ENOMEM; return (error); } +#endif int ahd_pci_map_registers(struct ahd_softc *ahd) diff -urN linux-2.5.72-bk3/drivers/scsi/arm/powertec.c linux-2.5.73/drivers/scsi/arm/powertec.c --- linux-2.5.72-bk3/drivers/scsi/arm/powertec.c 2003-06-22 12:03:21.000000000 -0700 +++ linux-2.5.73/drivers/scsi/arm/powertec.c 2003-06-22 12:04:01.000000000 -0700 @@ -235,18 +235,17 @@ * of the required information. * offset - offset into information that we have read upto. * length - length of buffer - * host_no - host number to return information for * inout - 0 for reading, 1 for writing. * Returns : length of data written to buffer. */ int powertecscsi_proc_info(struct Scsi_Host *host, char *buffer, char **start, off_t offset, - int length, int host_no, int inout) + int length, int inout) { struct powertec_info *info; char *p = buffer; int pos; - If (inout == 1) + if (inout == 1) return powertecscsi_set_proc_info(host, buffer, length); info = (struct powertec_info *)host->hostdata; diff -urN linux-2.5.72-bk3/drivers/scsi/scsi_scan.c linux-2.5.73/drivers/scsi/scsi_scan.c --- linux-2.5.72-bk3/drivers/scsi/scsi_scan.c 2003-06-22 12:03:25.000000000 -0700 +++ linux-2.5.73/drivers/scsi/scsi_scan.c 2003-06-22 12:04:08.000000000 -0700 @@ -583,8 +583,6 @@ sdev->host->host_no, sdev->channel, sdev->id, sdev->lun); - scsi_device_register(sdev); - /* * End driverfs/devfs code. */ @@ -647,11 +645,18 @@ sdev->max_device_blocked = SCSI_DEFAULT_DEVICE_BLOCKED; sdev->use_10_for_rw = 1; - sdev->use_10_for_ms = 0; + sdev->use_10_for_ms = 1; if(sdev->host->hostt->slave_configure) sdev->host->hostt->slave_configure(sdev); + /* + * Ok, the device is now all set up, we can + * register it and tell the rest of the kernel + * about it. + */ + scsi_device_register(sdev); + return SCSI_SCAN_LUN_PRESENT; } diff -urN linux-2.5.72-bk3/drivers/scsi/st.c linux-2.5.73/drivers/scsi/st.c --- linux-2.5.72-bk3/drivers/scsi/st.c 2003-06-22 12:03:26.000000000 -0700 +++ linux-2.5.73/drivers/scsi/st.c 2003-06-22 12:04:08.000000000 -0700 @@ -12,13 +12,12 @@ Copyright 1992 - 2003 Kai Makisara email Kai.Makisara@kolumbus.fi - Last modified: Sun Apr 13 10:17:18 2003 by makisara Some small formal changes - aeb, 950809 Last modified: 18-JAN-1998 Richard Gooch Devfs support */ -static char *verstr = "20030413"; +static char *verstr = "20030622"; #include @@ -1555,6 +1554,7 @@ } } else { filp->f_pos -= do_count; + count += do_count; STps->drv_block = (-1); /* Too cautious? */ retval = (-EIO); } diff -urN linux-2.5.72-bk3/drivers/telephony/ixj.c linux-2.5.73/drivers/telephony/ixj.c --- linux-2.5.72-bk3/drivers/telephony/ixj.c 2003-06-16 21:19:39.000000000 -0700 +++ linux-2.5.73/drivers/telephony/ixj.c 2003-06-22 12:04:10.000000000 -0700 @@ -7247,8 +7247,8 @@ len += sprintf(buf + len, "\n%s", ixj_h_rcsid); len += sprintf(buf + len, "\n%s", ixjuser_h_rcsid); len += sprintf(buf + len, "\nDriver version %i.%i.%i", IXJ_VER_MAJOR, IXJ_VER_MINOR, IXJ_BLD_VER); - len += sprintf(buf + len, "\nsizeof IXJ struct %d bytes", sizeof(IXJ)); - len += sprintf(buf + len, "\nsizeof DAA struct %d bytes", sizeof(DAA_REGS)); + len += sprintf(buf + len, "\nsizeof IXJ struct %Zd bytes", sizeof(IXJ)); + len += sprintf(buf + len, "\nsizeof DAA struct %Zd bytes", sizeof(DAA_REGS)); len += sprintf(buf + len, "\nUsing old telephony API"); len += sprintf(buf + len, "\nDebug Level %d\n", ixjdebug); diff -urN linux-2.5.72-bk3/drivers/telephony/ixj.h linux-2.5.73/drivers/telephony/ixj.h --- linux-2.5.72-bk3/drivers/telephony/ixj.h 2003-06-16 21:20:27.000000000 -0700 +++ linux-2.5.73/drivers/telephony/ixj.h 2003-06-22 12:04:10.000000000 -0700 @@ -1213,7 +1213,7 @@ #endif char *read_buffer, *read_buffer_end; char *read_convert_buffer; - unsigned int read_buffer_size; + size_t read_buffer_size; unsigned int read_buffer_ready; #if LINUX_VERSION_CODE < 0x020400 struct wait_queue *write_q; @@ -1222,7 +1222,7 @@ #endif char *write_buffer, *write_buffer_end; char *write_convert_buffer; - unsigned int write_buffer_size; + size_t write_buffer_size; unsigned int write_buffers_empty; unsigned long drybuffer; char *write_buffer_rp, *write_buffer_wp; @@ -1281,7 +1281,7 @@ unsigned char fskcnt; unsigned int cidsize; unsigned int cidcnt; - unsigned pstn_cid_received; + unsigned long pstn_cid_received; PHONE_CID cid; PHONE_CID cid_send; unsigned long pstn_ring_int; diff -urN linux-2.5.72-bk3/drivers/usb/input/hid-core.c linux-2.5.73/drivers/usb/input/hid-core.c --- linux-2.5.72-bk3/drivers/usb/input/hid-core.c 2003-06-22 12:03:27.000000000 -0700 +++ linux-2.5.73/drivers/usb/input/hid-core.c 2003-06-22 12:04:11.000000000 -0700 @@ -215,7 +215,7 @@ return -1; } - if (parser->global.logical_maximum <= parser->global.logical_minimum) { + if (parser->global.logical_maximum < parser->global.logical_minimum) { dbg("logical range invalid %d %d", parser->global.logical_minimum, parser->global.logical_maximum); return -1; } @@ -674,7 +674,6 @@ if (item.format != HID_ITEM_FORMAT_SHORT) { dbg("unexpected long global item"); - kfree(device->rdesc); kfree(device->collection); hid_free_device(device); kfree(parser); @@ -684,7 +683,6 @@ if (dispatch_type[item.type](parser, &item)) { dbg("item %u %u %u %u parsing failed\n", item.format, (unsigned)item.size, (unsigned)item.type, (unsigned)item.tag); - kfree(device->rdesc); kfree(device->collection); hid_free_device(device); kfree(parser); @@ -694,7 +692,6 @@ if (start == end) { if (parser->collection_stack_ptr) { dbg("unbalanced collection at end of report description"); - kfree(device->rdesc); kfree(device->collection); hid_free_device(device); kfree(parser); @@ -702,7 +699,6 @@ } if (parser->local.delimiter_depth) { dbg("unbalanced delimiter at end of report description"); - kfree(device->rdesc); kfree(device->collection); hid_free_device(device); kfree(parser); @@ -714,7 +710,6 @@ } dbg("item fetching failed at offset %d\n", (int)(end - start)); - kfree(device->rdesc); kfree(device->collection); hid_free_device(device); kfree(parser); diff -urN linux-2.5.72-bk3/fs/adfs/super.c linux-2.5.73/fs/adfs/super.c --- linux-2.5.72-bk3/fs/adfs/super.c 2003-06-16 21:19:38.000000000 -0700 +++ linux-2.5.73/fs/adfs/super.c 2003-06-22 12:04:13.000000000 -0700 @@ -189,7 +189,7 @@ return parse_options(sb, data); } -static int adfs_statfs(struct super_block *sb, struct statfs *buf) +static int adfs_statfs(struct super_block *sb, struct kstatfs *buf) { struct adfs_sb_info *asb = ADFS_SB(sb); @@ -200,7 +200,7 @@ buf->f_files = asb->s_ids_per_zone * asb->s_map_size; buf->f_bavail = buf->f_bfree = adfs_map_free(sb); - buf->f_ffree = buf->f_bfree * buf->f_files / buf->f_blocks; + buf->f_ffree = (long)(buf->f_bfree * buf->f_files) / (long)buf->f_blocks; return 0; } diff -urN linux-2.5.72-bk3/fs/affs/super.c linux-2.5.73/fs/affs/super.c --- linux-2.5.72-bk3/fs/affs/super.c 2003-06-16 21:20:07.000000000 -0700 +++ linux-2.5.73/fs/affs/super.c 2003-06-22 12:04:13.000000000 -0700 @@ -33,7 +33,7 @@ extern struct timezone sys_tz; -static int affs_statfs(struct super_block *sb, struct statfs *buf); +static int affs_statfs(struct super_block *sb, struct kstatfs *buf); static int affs_remount (struct super_block *sb, int *flags, char *data); static void @@ -524,7 +524,7 @@ } static int -affs_statfs(struct super_block *sb, struct statfs *buf) +affs_statfs(struct super_block *sb, struct kstatfs *buf) { int free; diff -urN linux-2.5.72-bk3/fs/befs/linuxvfs.c linux-2.5.73/fs/befs/linuxvfs.c --- linux-2.5.72-bk3/fs/befs/linuxvfs.c 2003-06-16 21:20:00.000000000 -0700 +++ linux-2.5.73/fs/befs/linuxvfs.c 2003-06-22 12:04:13.000000000 -0700 @@ -47,7 +47,7 @@ char **out, int *out_len); static void befs_put_super(struct super_block *); static int befs_remount(struct super_block *, int *, char *); -static int befs_statfs(struct super_block *, struct statfs *); +static int befs_statfs(struct super_block *, struct kstatfs *); static int parse_options(char *, befs_mount_options *); static const struct super_operations befs_sops = { @@ -896,7 +896,7 @@ } static int -befs_statfs(struct super_block *sb, struct statfs *buf) +befs_statfs(struct super_block *sb, struct kstatfs *buf) { befs_debug(sb, "---> befs_statfs()"); diff -urN linux-2.5.72-bk3/fs/bfs/inode.c linux-2.5.73/fs/bfs/inode.c --- linux-2.5.72-bk3/fs/bfs/inode.c 2003-06-16 21:19:59.000000000 -0700 +++ linux-2.5.73/fs/bfs/inode.c 2003-06-22 12:04:13.000000000 -0700 @@ -191,7 +191,7 @@ s->s_fs_info = NULL; } -static int bfs_statfs(struct super_block *s, struct statfs *buf) +static int bfs_statfs(struct super_block *s, struct kstatfs *buf) { struct bfs_sb_info *info = BFS_SB(s); buf->f_type = BFS_MAGIC; diff -urN linux-2.5.72-bk3/fs/binfmt_elf.c linux-2.5.73/fs/binfmt_elf.c --- linux-2.5.72-bk3/fs/binfmt_elf.c 2003-06-16 21:20:00.000000000 -0700 +++ linux-2.5.73/fs/binfmt_elf.c 2003-06-22 12:04:13.000000000 -0700 @@ -697,7 +697,7 @@ load_bias += error - ELF_PAGESTART(load_bias + vaddr); load_addr += load_bias; - reloc_func_desc = load_addr; + reloc_func_desc = load_bias; } } k = elf_ppnt->p_vaddr; diff -urN linux-2.5.72-bk3/fs/cifs/CHANGES linux-2.5.73/fs/cifs/CHANGES --- linux-2.5.72-bk3/fs/cifs/CHANGES 2003-06-16 21:20:22.000000000 -0700 +++ linux-2.5.73/fs/cifs/CHANGES 2003-06-22 12:04:13.000000000 -0700 @@ -1,3 +1,17 @@ +Version 0.80 +----------- +Fix oops on stopping oplock thread when removing cifs when +built as module. + +Version 0.79 +------------ +Fix mount options for ro (readonly), uid, gid and file and directory mode. + +Version 0.78 +------------ +Fix errors displayed on failed mounts to be more understandable. +Fixed various incorrect or misleading smb to posix error code mappings. + Version 0.77 ------------ Fix display of NTFS DFS junctions to display as symlinks. diff -urN linux-2.5.72-bk3/fs/cifs/asn1.c linux-2.5.73/fs/cifs/asn1.c --- linux-2.5.72-bk3/fs/cifs/asn1.c 2003-06-16 21:19:39.000000000 -0700 +++ linux-2.5.73/fs/cifs/asn1.c 2003-06-22 12:04:13.000000000 -0700 @@ -432,7 +432,7 @@ compare_oid(unsigned long *oid1, unsigned int oid1len, unsigned long *oid2, unsigned int oid2len) { - int i; + unsigned int i; if (oid1len != oid2len) return 0; diff -urN linux-2.5.72-bk3/fs/cifs/cifs_fs_sb.h linux-2.5.73/fs/cifs/cifs_fs_sb.h --- linux-2.5.72-bk3/fs/cifs/cifs_fs_sb.h 2003-06-16 21:19:46.000000000 -0700 +++ linux-2.5.73/fs/cifs/cifs_fs_sb.h 2003-06-22 12:04:13.000000000 -0700 @@ -24,5 +24,9 @@ struct nls_table *local_nls; unsigned int rsize; unsigned int wsize; + uid_t mnt_uid; + gid_t mnt_gid; + mode_t mnt_file_mode; + mode_t mnt_dir_mode; }; #endif /* _CIFS_FS_SB_H */ diff -urN linux-2.5.72-bk3/fs/cifs/cifsfs.c linux-2.5.73/fs/cifs/cifsfs.c --- linux-2.5.72-bk3/fs/cifs/cifsfs.c 2003-06-16 21:20:02.000000000 -0700 +++ linux-2.5.73/fs/cifs/cifsfs.c 2003-06-22 12:04:13.000000000 -0700 @@ -62,6 +62,9 @@ void cifs_proc_init(void); void cifs_proc_clean(void); +static DECLARE_COMPLETION(cifs_oplock_exited); + + static int cifs_read_super(struct super_block *sb, void *data, const char *devname, int silent) @@ -143,7 +146,7 @@ } int -cifs_statfs(struct super_block *sb, struct statfs *buf) +cifs_statfs(struct super_block *sb, struct kstatfs *buf) { int xid, rc; struct cifs_sb_info *cifs_sb; @@ -427,7 +430,8 @@ "cifs_destroy_mids: error not all structures were freed\n"); if (kmem_cache_destroy(cifs_oplock_cachep)) printk(KERN_WARNING - "error not all oplock structures were freed\n");} + "error not all oplock structures were freed\n"); +} static int cifs_oplock_thread(void * dummyarg) { @@ -439,14 +443,13 @@ int rc; daemonize("cifsoplockd"); - allow_signal(SIGKILL); + allow_signal(SIGTERM); oplockThread = current; - while (1) { + do { set_current_state(TASK_INTERRUPTIBLE); schedule_timeout(100*HZ); /* BB add missing code */ - cFYI(1,("oplock thread woken up - flush inode")); /* BB remove */ write_lock(&GlobalMid_Lock); list_for_each_safe(tmp, tmp1, &GlobalOplock_Q) { oplock_item = list_entry(tmp, struct oplock_q_entry, @@ -466,11 +469,10 @@ write_lock(&GlobalMid_Lock); } else break; - cFYI(1,("next time through list")); /* BB remove */ } write_unlock(&GlobalMid_Lock); - cFYI(1,("next time through while loop")); /* BB remove */ - } + } while(!signal_pending(current)); + complete_and_exit (&cifs_oplock_exited, 0); } static int __init @@ -532,8 +534,10 @@ cifs_destroy_inodecache(); cifs_destroy_mids(); cifs_destroy_request_bufs(); - if(oplockThread) - send_sig(SIGKILL, oplockThread, 1); + if(oplockThread) { + send_sig(SIGTERM, oplockThread, 1); + wait_for_completion(&cifs_oplock_exited); + } } MODULE_AUTHOR("Steve French "); diff -urN linux-2.5.72-bk3/fs/cifs/cifsproto.h linux-2.5.73/fs/cifs/cifsproto.h --- linux-2.5.72-bk3/fs/cifs/cifsproto.h 2003-06-16 21:19:39.000000000 -0700 +++ linux-2.5.73/fs/cifs/cifsproto.h 2003-06-22 12:04:13.000000000 -0700 @@ -49,7 +49,7 @@ extern int checkSMBhdr(struct smb_hdr *smb, __u16 mid); extern int checkSMB(struct smb_hdr *smb, __u16 mid, int length); extern int is_valid_oplock_break(struct smb_hdr *smb); -extern int smbCalcSize(struct smb_hdr *ptr); +extern unsigned int smbCalcSize(struct smb_hdr *ptr); extern int decode_negTokenInit(unsigned char *security_blob, int length, enum securityEnum *secType); extern int map_smb_to_linux_error(struct smb_hdr *smb); @@ -137,7 +137,7 @@ const char *old_path, const struct nls_table *nls_codepage, unsigned int *pnum_referrals, unsigned char ** preferrals); extern int CIFSSMBQFSInfo(const int xid, struct cifsTconInfo *tcon, - struct statfs *FSData, + struct kstatfs *FSData, const struct nls_table *nls_codepage); extern int CIFSSMBQFSAttributeInfo(const int xid, struct cifsTconInfo *tcon, diff -urN linux-2.5.72-bk3/fs/cifs/cifssmb.c linux-2.5.73/fs/cifs/cifssmb.c --- linux-2.5.72-bk3/fs/cifs/cifssmb.c 2003-06-16 21:19:42.000000000 -0700 +++ linux-2.5.73/fs/cifs/cifssmb.c 2003-06-22 12:04:13.000000000 -0700 @@ -1782,7 +1782,7 @@ int CIFSSMBQFSInfo(const int xid, struct cifsTconInfo *tcon, - struct statfs *FSData, const struct nls_table *nls_codepage) + struct kstatfs *FSData, const struct nls_table *nls_codepage) { /* level 0x103 SMB_QUERY_FILE_SYSTEM_INFO */ TRANSACTION2_QFSI_REQ *pSMB = NULL; @@ -1846,8 +1846,9 @@ FSData->f_bfree = FSData->f_bavail = le64_to_cpu(response_data->FreeAllocationUnits); cFYI(1, - ("Blocks: %ld Free: %ld Block size %ld", - FSData->f_blocks, FSData->f_bfree, + ("Blocks: %lld Free: %lld Block size %ld", + (unsigned long long)FSData->f_blocks, + (unsigned long long)FSData->f_bfree, FSData->f_bsize)); } } diff -urN linux-2.5.72-bk3/fs/cifs/connect.c linux-2.5.73/fs/cifs/connect.c --- linux-2.5.72-bk3/fs/cifs/connect.c 2003-06-16 21:20:22.000000000 -0700 +++ linux-2.5.73/fs/cifs/connect.c 2003-06-22 12:04:13.000000000 -0700 @@ -53,7 +53,7 @@ char *UNC; char *UNCip; uid_t linux_uid; - uid_t linux_gid; + gid_t linux_gid; mode_t file_mode; mode_t dir_mode; int rw; @@ -136,8 +136,8 @@ int cifs_demultiplex_thread(struct TCP_Server_Info *server) { - int length, total_read; - unsigned int pdu_length; + int length; + unsigned int pdu_length, total_read; struct smb_hdr *smb_buffer = NULL; struct msghdr smb_msg; mm_segment_t temp_fs; @@ -351,6 +351,10 @@ memset(vol,0,sizeof(struct smb_vol)); vol->linux_uid = current->uid; /* current->euid instead? */ vol->linux_gid = current->gid; + vol->dir_mode = S_IRWXUGO; + /* 2767 perms indicate mandatory locking support */ + vol->file_mode = S_IALLUGO & ~(S_ISUID | S_IXGRP); + vol->rw = TRUE; if (!options) @@ -466,6 +470,8 @@ /* ignore */ } else if (strnicmp(data, "rw", 2) == 0) { vol->rw = TRUE; + } else if (strnicmp(data, "ro", 2) == 0) { + vol->rw = FALSE; } else printk(KERN_WARNING "CIFS: Unknown mount option %s\n",data); } @@ -929,8 +935,11 @@ cifs_sb->rsize = PAGE_CACHE_SIZE; cERROR(1,("Attempt to set readsize for mount to less than one page (4096)")); } - - + cifs_sb->mnt_uid = volume_info.linux_uid; + cifs_sb->mnt_gid = volume_info.linux_gid; + cifs_sb->mnt_file_mode = volume_info.file_mode; + cifs_sb->mnt_dir_mode = volume_info.dir_mode; + cFYI(1,("file mode: 0x%x dir mode: 0x%x",cifs_sb->mnt_file_mode,cifs_sb->mnt_dir_mode)); tcon = find_unc(sin_server.sin_addr.s_addr, volume_info.UNC, volume_info.username); diff -urN linux-2.5.72-bk3/fs/cifs/file.c linux-2.5.73/fs/cifs/file.c --- linux-2.5.72-bk3/fs/cifs/file.c 2003-06-16 21:19:37.000000000 -0700 +++ linux-2.5.73/fs/cifs/file.c 2003-06-22 12:04:13.000000000 -0700 @@ -123,8 +123,8 @@ to problems creating new read-only files */ if (cifs_sb->tcon->ses->capabilities & CAP_UNIX) CIFSSMBUnixSetPerms(xid, pTcon, full_path, inode->i_mode, - 0xFFFFFFFFFFFFFFFF, - 0xFFFFFFFFFFFFFFFF, + (__u64)-1, + (__u64)-1, cifs_sb->local_nls); else {/* BB implement via Windows security descriptors */ /* eg CIFSSMBWinSetPerms(xid,pTcon,full_path,mode,-1,-1,local_nls);*/ @@ -351,8 +351,8 @@ size_t write_size, loff_t * poffset) { int rc = 0; - int bytes_written = 0; - int total_written; + unsigned int bytes_written = 0; + unsigned int total_written; struct cifs_sb_info *cifs_sb; struct cifsTconInfo *pTcon; int xid, long_op; @@ -633,9 +633,9 @@ loff_t * poffset) { int rc = -EACCES; - int bytes_read = 0; - int total_read; - int current_read_size; + unsigned int bytes_read = 0; + unsigned int total_read; + unsigned int current_read_size; struct cifs_sb_info *cifs_sb; struct cifsTconInfo *pTcon; int xid; @@ -742,13 +742,13 @@ struct list_head *page_list, unsigned num_pages) { int rc = -EACCES; - int xid,i; + int xid; loff_t offset; struct page * page; struct cifs_sb_info *cifs_sb; struct cifsTconInfo *pTcon; int bytes_read = 0; - unsigned int read_size; + unsigned int read_size,i; char * smb_read_data = 0; struct smb_com_read_rsp * pSMBr; struct pagevec lru_pvec; @@ -877,6 +877,8 @@ FILE_DIRECTORY_INFO * pfindData, int *pobject_type) { struct cifsInodeInfo *cifsInfo = CIFS_I(tmp_inode); + struct cifs_sb_info *cifs_sb = CIFS_SB(tmp_inode->i_sb); + pfindData->ExtFileAttributes = le32_to_cpu(pfindData->ExtFileAttributes); pfindData->AllocationSize = le64_to_cpu(pfindData->AllocationSize); @@ -894,7 +896,13 @@ cifs_NTtimeToUnix(le64_to_cpu(pfindData->ChangeTime)); /* treat dos attribute of read-only as read-only mode bit e.g. 555? */ /* 2767 perms - indicate mandatory locking */ - tmp_inode->i_mode = S_IALLUGO & ~(S_ISUID | S_IXGRP); + /* BB fill in uid and gid here? with help from winbind? + or retrieve from NTFS stream extended attribute */ + tmp_inode->i_uid = cifs_sb->mnt_uid; + tmp_inode->i_gid = cifs_sb->mnt_gid; + /* set default mode. will override for dirs below */ + tmp_inode->i_mode = cifs_sb->mnt_file_mode; + cFYI(0, ("CIFS FFIRST: Attributes came in as 0x%x", pfindData->ExtFileAttributes)); @@ -905,7 +913,7 @@ } else if (pfindData->ExtFileAttributes & ATTR_DIRECTORY) { *pobject_type = DT_DIR; /* override default perms since we do not lock dirs */ - tmp_inode->i_mode = S_IRWXUGO; + tmp_inode->i_mode = cifs_sb->mnt_dir_mode; tmp_inode->i_mode |= S_IFDIR; } else { *pobject_type = DT_REG; @@ -1091,10 +1099,10 @@ cifs_readdir(struct file *file, void *direntry, filldir_t filldir) { int rc = 0; - int xid, i; + int xid; int Unicode = FALSE; int UnixSearch = FALSE; - unsigned int bufsize; + unsigned int bufsize, i; __u16 searchHandle; struct cifs_sb_info *cifs_sb; struct cifsTconInfo *pTcon; diff -urN linux-2.5.72-bk3/fs/cifs/inode.c linux-2.5.73/fs/cifs/inode.c --- linux-2.5.72-bk3/fs/cifs/inode.c 2003-06-16 21:19:39.000000000 -0700 +++ linux-2.5.73/fs/cifs/inode.c 2003-06-22 12:04:13.000000000 -0700 @@ -224,16 +224,19 @@ cifs_NTtimeToUnix(le64_to_cpu(findData.LastWriteTime)); inode->i_ctime = cifs_NTtimeToUnix(le64_to_cpu(findData.ChangeTime)); - inode->i_mode = S_IALLUGO & ~(S_ISUID | S_IXGRP); /* 2767 perms indicate mandatory locking - will override for dirs later */ cFYI(0, (" Attributes came in as 0x%x ", findData.Attributes)); - if (findData.Attributes & ATTR_REPARSE) { - /* Can IFLNK be set as it basically is on windows with IFREG or IFDIR? */ + + /* set default mode. will override for dirs below */ + inode->i_mode = cifs_sb->mnt_file_mode; + + if (findData.Attributes & ATTR_REPARSE) { + /* Can IFLNK be set as it basically is on windows with IFREG or IFDIR? */ inode->i_mode |= S_IFLNK; } else if (findData.Attributes & ATTR_DIRECTORY) { - /* override default perms since we do not do byte range locking on dirs */ - inode->i_mode = S_IRWXUGO; - inode->i_mode |= S_IFDIR; + /* override default perms since we do not do byte range locking on dirs */ + inode->i_mode = cifs_sb->mnt_dir_mode; + inode->i_mode |= S_IFDIR; } else { inode->i_mode |= S_IFREG; /* treat the dos attribute of read-only as read-only mode e.g. 555 */ @@ -250,8 +253,11 @@ (unsigned long) inode->i_size, inode->i_blocks)); inode->i_nlink = le32_to_cpu(findData.NumberOfLinks); - /* BB fill in uid and gid here? with help from winbind? */ - + /* BB fill in uid and gid here? with help from winbind? + or retrieve from NTFS stream extended attribute */ + inode->i_uid = cifs_sb->mnt_uid; + inode->i_gid = cifs_sb->mnt_gid; + if (S_ISREG(inode->i_mode)) { cFYI(1, (" File inode ")); inode->i_op = &cifs_file_inode_ops; @@ -389,8 +395,8 @@ direntry->d_inode->i_nlink = 2; if (cifs_sb->tcon->ses->capabilities & CAP_UNIX) CIFSSMBUnixSetPerms(xid, pTcon, full_path, mode, - 0xFFFFFFFFFFFFFFFF, - 0xFFFFFFFFFFFFFFFF, + (__u64)-1, + (__u64)-1, cifs_sb->local_nls); else { /* BB to be implemented via Windows secrty descriptors*/ /* eg CIFSSMBWinSetPerms(xid,pTcon,full_path,mode,-1,-1,local_nls);*/ diff -urN linux-2.5.72-bk3/fs/cifs/misc.c linux-2.5.73/fs/cifs/misc.c --- linux-2.5.72-bk3/fs/cifs/misc.c 2003-06-16 21:20:25.000000000 -0700 +++ linux-2.5.73/fs/cifs/misc.c 2003-06-22 12:04:13.000000000 -0700 @@ -274,12 +274,12 @@ cFYI(0, ("Entering checkSMB with Length: %x, smb_buf_length: %x ", length, ntohl(smb->smb_buf_length))); - if ((length < 2 + sizeof (struct smb_hdr)) + if (((unsigned int)length < 2 + sizeof (struct smb_hdr)) || (4 + ntohl(smb->smb_buf_length) > CIFS_MAX_MSGSIZE + MAX_CIFS_HDR_SIZE)) { - if (length < 2 + sizeof (struct smb_hdr)) { + if ((unsigned int)length < 2 + sizeof (struct smb_hdr)) { cERROR(1, ("Length less than 2 + sizeof smb_hdr ")); - if ((length >= sizeof (struct smb_hdr) - 1) + if (((unsigned int)length >= sizeof (struct smb_hdr) - 1) && (smb->Status.CifsError != 0)) return 0; /* some error cases do not return wct and bcc */ @@ -298,7 +298,7 @@ return 1; if ((4 + ntohl(smb->smb_buf_length) != smbCalcSize(smb)) - || (4 + ntohl(smb->smb_buf_length) != length)) { + || (4 + ntohl(smb->smb_buf_length) != (unsigned int)length)) { return 0; } else { cERROR(1, ("smbCalcSize %x ", smbCalcSize(smb))); diff -urN linux-2.5.72-bk3/fs/cifs/netmisc.c linux-2.5.73/fs/cifs/netmisc.c --- linux-2.5.72-bk3/fs/cifs/netmisc.c 2003-06-16 21:20:22.000000000 -0700 +++ linux-2.5.73/fs/cifs/netmisc.c 2003-06-22 12:04:14.000000000 -0700 @@ -791,7 +791,7 @@ int map_smb_to_linux_error(struct smb_hdr *smb) { - int i; + unsigned int i; int rc = -EIO; /* if transport error smb error may not be set */ __u8 smberrclass; __u16 smberrcode; @@ -859,10 +859,10 @@ * calculate the size of the SMB message based on the fixed header * portion, the number of word parameters and the data portion of the message */ -int +unsigned int smbCalcSize(struct smb_hdr *ptr) { - return (sizeof (struct smb_hdr) + (int) (2 * ptr->WordCount) + + return (sizeof (struct smb_hdr) + (2 * ptr->WordCount) + BCC(ptr)); } diff -urN linux-2.5.72-bk3/fs/cifs/transport.c linux-2.5.73/fs/cifs/transport.c --- linux-2.5.72-bk3/fs/cifs/transport.c 2003-06-16 21:19:47.000000000 -0700 +++ linux-2.5.73/fs/cifs/transport.c 2003-06-22 12:04:14.000000000 -0700 @@ -186,7 +186,7 @@ int *pbytes_returned, const int long_op) { int rc = 0; - int receive_len; + unsigned int receive_len; long timeout; struct mid_q_entry *midQ; diff -urN linux-2.5.72-bk3/fs/coda/inode.c linux-2.5.73/fs/coda/inode.c --- linux-2.5.72-bk3/fs/coda/inode.c 2003-06-16 21:20:01.000000000 -0700 +++ linux-2.5.73/fs/coda/inode.c 2003-06-22 12:04:14.000000000 -0700 @@ -34,7 +34,7 @@ /* VFS super_block ops */ static void coda_clear_inode(struct inode *); static void coda_put_super(struct super_block *); -static int coda_statfs(struct super_block *sb, struct statfs *buf); +static int coda_statfs(struct super_block *sb, struct kstatfs *buf); static kmem_cache_t * coda_inode_cachep; @@ -273,7 +273,7 @@ .setattr = coda_setattr, }; -static int coda_statfs(struct super_block *sb, struct statfs *buf) +static int coda_statfs(struct super_block *sb, struct kstatfs *buf) { int error; diff -urN linux-2.5.72-bk3/fs/coda/upcall.c linux-2.5.73/fs/coda/upcall.c --- linux-2.5.72-bk3/fs/coda/upcall.c 2003-06-16 21:20:20.000000000 -0700 +++ linux-2.5.73/fs/coda/upcall.c 2003-06-22 12:04:14.000000000 -0700 @@ -585,7 +585,7 @@ return error; } -int venus_statfs(struct super_block *sb, struct statfs *sfs) +int venus_statfs(struct super_block *sb, struct kstatfs *sfs) { union inputArgs *inp; union outputArgs *outp; diff -urN linux-2.5.72-bk3/fs/compat.c linux-2.5.73/fs/compat.c --- linux-2.5.72-bk3/fs/compat.c 2003-06-16 21:20:01.000000000 -0700 +++ linux-2.5.73/fs/compat.c 2003-06-22 12:04:14.000000000 -0700 @@ -87,8 +87,15 @@ return error; } -static int put_compat_statfs(struct compat_statfs *ubuf, struct statfs *kbuf) +static int put_compat_statfs(struct compat_statfs *ubuf, struct kstatfs *kbuf) { + + if (sizeof ubuf->f_blocks == 4) { + if ((kbuf->f_blocks | kbuf->f_bfree | + kbuf->f_bavail | kbuf->f_files | kbuf->f_ffree) & + 0xffffffff00000000ULL) + return -EOVERFLOW; + } if (verify_area(VERIFY_WRITE, ubuf, sizeof(*ubuf)) || __put_user(kbuf->f_type, &ubuf->f_type) || __put_user(kbuf->f_bsize, &ubuf->f_bsize) || @@ -99,7 +106,8 @@ __put_user(kbuf->f_ffree, &ubuf->f_ffree) || __put_user(kbuf->f_namelen, &ubuf->f_namelen) || __put_user(kbuf->f_fsid.val[0], &ubuf->f_fsid.val[0]) || - __put_user(kbuf->f_fsid.val[1], &ubuf->f_fsid.val[1])) + __put_user(kbuf->f_fsid.val[1], &ubuf->f_fsid.val[1]) || + __put_user(kbuf->f_frsize, &ubuf->f_frsize)) return -EFAULT; return 0; } @@ -115,7 +123,7 @@ error = user_path_walk(path, &nd); if (!error) { - struct statfs tmp; + struct kstatfs tmp; error = vfs_statfs(nd.dentry->d_inode->i_sb, &tmp); if (!error && put_compat_statfs(buf, &tmp)) error = -EFAULT; @@ -127,7 +135,7 @@ asmlinkage long compat_sys_fstatfs(unsigned int fd, struct compat_statfs *buf) { struct file * file; - struct statfs tmp; + struct kstatfs tmp; int error; error = -EBADF; diff -urN linux-2.5.72-bk3/fs/cramfs/inode.c linux-2.5.73/fs/cramfs/inode.c --- linux-2.5.72-bk3/fs/cramfs/inode.c 2003-06-16 21:19:39.000000000 -0700 +++ linux-2.5.73/fs/cramfs/inode.c 2003-06-22 12:04:14.000000000 -0700 @@ -266,7 +266,7 @@ return -EINVAL; } -static int cramfs_statfs(struct super_block *sb, struct statfs *buf) +static int cramfs_statfs(struct super_block *sb, struct kstatfs *buf) { buf->f_type = CRAMFS_MAGIC; buf->f_bsize = PAGE_CACHE_SIZE; diff -urN linux-2.5.72-bk3/fs/efs/super.c linux-2.5.73/fs/efs/super.c --- linux-2.5.72-bk3/fs/efs/super.c 2003-06-16 21:20:20.000000000 -0700 +++ linux-2.5.73/fs/efs/super.c 2003-06-22 12:04:14.000000000 -0700 @@ -278,7 +278,7 @@ return -EINVAL; } -int efs_statfs(struct super_block *s, struct statfs *buf) { +int efs_statfs(struct super_block *s, struct kstatfs *buf) { struct efs_sb_info *sb = SUPER_INFO(s); buf->f_type = EFS_SUPER_MAGIC; /* efs magic number */ diff -urN linux-2.5.72-bk3/fs/ext2/super.c linux-2.5.73/fs/ext2/super.c --- linux-2.5.72-bk3/fs/ext2/super.c 2003-06-16 21:20:06.000000000 -0700 +++ linux-2.5.73/fs/ext2/super.c 2003-06-22 12:04:14.000000000 -0700 @@ -34,7 +34,7 @@ static void ext2_sync_super(struct super_block *sb, struct ext2_super_block *es); static int ext2_remount (struct super_block * sb, int * flags, char * data); -static int ext2_statfs (struct super_block * sb, struct statfs * buf); +static int ext2_statfs (struct super_block * sb, struct kstatfs * buf); static char error_buf[1024]; @@ -939,7 +939,7 @@ return 0; } -static int ext2_statfs (struct super_block * sb, struct statfs * buf) +static int ext2_statfs (struct super_block * sb, struct kstatfs * buf) { struct ext2_sb_info *sbi = EXT2_SB(sb); unsigned long overhead; diff -urN linux-2.5.72-bk3/fs/ext3/acl.c linux-2.5.73/fs/ext3/acl.c --- linux-2.5.72-bk3/fs/ext3/acl.c 2003-06-22 12:03:28.000000000 -0700 +++ linux-2.5.73/fs/ext3/acl.c 2003-06-22 12:04:14.000000000 -0700 @@ -361,7 +361,7 @@ error = -ENOMEM; if (!clone) goto cleanup; - + mode = inode->i_mode; error = posix_acl_create_masq(clone, &mode); if (error >= 0) { diff -urN linux-2.5.72-bk3/fs/ext3/balloc.c linux-2.5.73/fs/ext3/balloc.c --- linux-2.5.72-bk3/fs/ext3/balloc.c 2003-06-22 12:03:28.000000000 -0700 +++ linux-2.5.73/fs/ext3/balloc.c 2003-06-22 12:04:14.000000000 -0700 @@ -54,7 +54,7 @@ return NULL; } - + group_desc = block_group / EXT3_DESC_PER_BLOCK(sb); desc = block_group % EXT3_DESC_PER_BLOCK(sb); if (!EXT3_SB(sb)->s_group_desc[group_desc]) { @@ -64,7 +64,7 @@ block_group, group_desc, desc); return NULL; } - + gdp = (struct ext3_group_desc *) EXT3_SB(sb)->s_group_desc[group_desc]->b_data; if (bh) @@ -83,7 +83,7 @@ { struct ext3_group_desc * desc; struct buffer_head * bh = NULL; - + desc = ext3_get_group_desc (sb, block_group, NULL); if (!desc) goto error_out; @@ -174,19 +174,19 @@ err = ext3_journal_get_undo_access(handle, bitmap_bh, NULL); if (err) goto error_return; - + /* * We are about to modify some metadata. Call the journal APIs * to unshare ->b_data if a currently-committing transaction is * using it */ BUFFER_TRACE(gd_bh, "get_write_access"); - err = ext3_journal_get_write_access(handle, gd_bh); + err = ext3_journal_get_write_access(handle, gd_bh); if (err) goto error_return; jbd_lock_bh_state(bitmap_bh); - + for (i = 0; i < count; i++) { /* * An HJ special. This is expensive... @@ -316,7 +316,7 @@ { int here, next; char *p, *r; - + if (start > 0) { /* * The goal was occupied; search forward for a free @@ -331,15 +331,14 @@ if (here < end_goal && ext3_test_allocatable(here, bh, have_access)) return here; - + ext3_debug ("Bit not found near goal\n"); - } - + here = start; if (here < 0) here = 0; - + /* * There has been no free block found in the near vicinity of * the goal: do a search forward through the block groups, @@ -351,10 +350,10 @@ p = ((char *) bh->b_data) + (here >> 3); r = memscan(p, 0, (maxblocks - here + 7) >> 3); next = (r - ((char *) bh->b_data)) << 3; - + if (next < maxblocks && ext3_test_allocatable(next, bh, have_access)) return next; - + /* The bitmap search --- search forward alternately * through the actual bitmap and the last-committed copy * until we find a bit free in both. */ @@ -547,7 +546,7 @@ EXT3_BLOCKS_PER_GROUP(sb)); bitmap_bh = read_block_bitmap(sb, group_no); if (!bitmap_bh) - goto io_error; + goto io_error; ret_block = ext3_try_to_allocate(sb, handle, group_no, bitmap_bh, ret_block, &fatal); if (fatal) @@ -555,7 +554,7 @@ if (ret_block >= 0) goto allocated; } - + /* * Now search the rest of the groups. We assume that * i and gdp correctly point to the last group visited. @@ -675,7 +674,7 @@ *errp = 0; brelse(bitmap_bh); return ret_block; - + io_error: *errp = -EIO; out: @@ -690,7 +689,6 @@ DQUOT_FREE_BLOCK(inode, 1); brelse(bitmap_bh); return 0; - } unsigned long ext3_count_free_blocks(struct super_block *sb) @@ -702,7 +700,7 @@ struct ext3_super_block *es; unsigned long bitmap_count, x; struct buffer_head *bitmap_bh = NULL; - + lock_super(sb); es = EXT3_SB(sb)->s_es; desc_count = 0; @@ -717,7 +715,7 @@ bitmap_bh = read_block_bitmap(sb, i); if (bitmap_bh == NULL) continue; - + x = ext3_count_free(bitmap_bh, sb->s_blocksize); printk("group %d: stored = %d, counted = %lu\n", i, le16_to_cpu(gdp->bg_free_blocks_count), x); diff -urN linux-2.5.72-bk3/fs/ext3/bitmap.c linux-2.5.73/fs/ext3/bitmap.c --- linux-2.5.72-bk3/fs/ext3/bitmap.c 2003-06-16 21:20:19.000000000 -0700 +++ linux-2.5.73/fs/ext3/bitmap.c 2003-06-22 12:04:14.000000000 -0700 @@ -16,7 +16,7 @@ { unsigned int i; unsigned long sum = 0; - + if (!map) return (0); for (i = 0; i < numchars; i++) diff -urN linux-2.5.72-bk3/fs/ext3/dir.c linux-2.5.73/fs/ext3/dir.c --- linux-2.5.72-bk3/fs/ext3/dir.c 2003-06-16 21:20:02.000000000 -0700 +++ linux-2.5.73/fs/ext3/dir.c 2003-06-22 12:04:14.000000000 -0700 @@ -16,6 +16,9 @@ * * Big-endian to little-endian byte-swapping/bitmaps by * David S. Miller (davem@caip.rutgers.edu), 1995 + * + * Hash Tree Directory indexing (c) 2001 Daniel Phillips + * */ #include @@ -154,7 +157,7 @@ brelse (bha[i]); } } - + revalidate: /* If the dir block has changed since the last call to * readdir(2), then we might be pointing to an invalid @@ -180,7 +183,7 @@ | offset; filp->f_version = inode->i_version; } - + while (!error && filp->f_pos < inode->i_size && offset < sb->s_blocksize) { de = (struct ext3_dir_entry_2 *) (bh->b_data + offset); @@ -326,7 +329,7 @@ free_rb_tree_fname(&p->root); kfree(p); } - + /* * Given a directory entry, enter it into the fname rb tree. */ @@ -355,7 +358,7 @@ new_fn->file_type = dirent->file_type; memcpy(new_fn->name, dirent->name, dirent->name_len); new_fn->name[dirent->name_len] = 0; - + while (*p) { parent = *p; fname = rb_entry(parent, struct fname, rb_hash); @@ -370,7 +373,7 @@ fname->next = new_fn; return 0; } - + if (new_fn->hash < fname->hash) p = &(*p)->rb_left; else if (new_fn->hash > fname->hash) @@ -403,7 +406,7 @@ int error; sb = inode->i_sb; - + if (!fname) { printk("call_filldir: called with null fname?!?\n"); return 0; diff -urN linux-2.5.72-bk3/fs/ext3/file.c linux-2.5.73/fs/ext3/file.c --- linux-2.5.72-bk3/fs/ext3/file.c 2003-06-16 21:20:26.000000000 -0700 +++ linux-2.5.73/fs/ext3/file.c 2003-06-22 12:04:14.000000000 -0700 @@ -69,7 +69,7 @@ */ if (ret <= 0) return ret; - + /* * If the inode is IS_SYNC, or is O_SYNC and we are doing data * journalling then we need to make sure that we force the transaction @@ -97,14 +97,14 @@ */ if (!IS_SYNC(inode)) return ret; - + /* * Open question #2 --- should we force data to disk here too? If we * don't, the only impact is that data=writeback filesystems won't * flush data to disk automatically on IS_SYNC, only metadata (but * historically, that is what ext2 has done.) */ - + force_commit: err = ext3_force_commit(inode->i_sb); if (err) diff -urN linux-2.5.72-bk3/fs/ext3/hash.c linux-2.5.73/fs/ext3/hash.c --- linux-2.5.72-bk3/fs/ext3/hash.c 2003-06-16 21:20:02.000000000 -0700 +++ linux-2.5.73/fs/ext3/hash.c 2003-06-22 12:04:14.000000000 -0700 @@ -23,10 +23,10 @@ __u32 a = in[0], b = in[1], c = in[2], d = in[3]; int n = 16; - do { - sum += DELTA; - b0 += ((b1 << 4)+a) ^ (b1+sum) ^ ((b1 >> 5)+b); - b1 += ((b0 << 4)+c) ^ (b0+sum) ^ ((b0 >> 5)+d); + do { + sum += DELTA; + b0 += ((b1 << 4)+a) ^ (b1+sum) ^ ((b1 >> 5)+b); + b1 += ((b0 << 4)+c) ^ (b0+sum) ^ ((b0 >> 5)+d); } while(--n); buf[0] += b0; @@ -107,7 +107,7 @@ __u32 hash0 = 0x12a3fe2d, hash1 = 0x37abe8f9; while (len--) { __u32 hash = hash1 + (hash0 ^ (*name++ * 7152373)); - + if (hash & 0x80000000) hash -= 0x7fffffff; hash1 = hash0; hash0 = hash; @@ -178,7 +178,7 @@ if (i < 4) memcpy(buf, hinfo->seed, sizeof(buf)); } - + switch (hinfo->hash_version) { case DX_HASH_LEGACY: hash = dx_hack_hash(name, len); diff -urN linux-2.5.72-bk3/fs/ext3/ialloc.c linux-2.5.73/fs/ext3/ialloc.c --- linux-2.5.72-bk3/fs/ext3/ialloc.c 2003-06-22 12:03:29.000000000 -0700 +++ linux-2.5.73/fs/ext3/ialloc.c 2003-06-22 12:04:14.000000000 -0700 @@ -462,13 +462,13 @@ for (i = 0; i < sbi->s_groups_count; i++) { gdp = ext3_get_group_desc(sb, group, &bh2); - + err = -EIO; brelse(bitmap_bh); bitmap_bh = read_inode_bitmap(sb, group); if (!bitmap_bh) goto fail; - + ino = ext3_find_first_zero_bit((unsigned long *) bitmap_bh->b_data, EXT3_INODES_PER_GROUP(sb)); if (ino < EXT3_INODES_PER_GROUP(sb)) { @@ -532,7 +532,7 @@ BUFFER_TRACE(bh2, "call ext3_journal_dirty_metadata"); err = ext3_journal_dirty_metadata(handle, bh2); if (err) goto fail; - + percpu_counter_dec(&sbi->s_freeinodes_counter); if (S_ISDIR(mode)) percpu_counter_inc(&sbi->s_dirs_counter); @@ -580,7 +580,7 @@ ei->i_prealloc_count = 0; #endif ei->i_block_group = group; - + ext3_set_inode_flags(inode); if (IS_DIRSYNC(inode)) handle->h_sync = 1; diff -urN linux-2.5.72-bk3/fs/ext3/inode.c linux-2.5.73/fs/ext3/inode.c --- linux-2.5.72-bk3/fs/ext3/inode.c 2003-06-22 12:03:29.000000000 -0700 +++ linux-2.5.73/fs/ext3/inode.c 2003-06-22 12:04:15.000000000 -0700 @@ -72,7 +72,7 @@ "data mode %lx\n", bh, is_metadata, inode->i_mode, test_opt(inode->i_sb, DATA_FLAGS)); - + /* Never use the revoke function if we are doing full data * journaling: there is no need to, and a V1 superblock won't * support it. Otherwise, only skip the revoke on un-journaled @@ -107,7 +107,7 @@ static unsigned long blocks_for_truncate(struct inode *inode) { unsigned long needed; - + needed = inode->i_blocks >> (inode->i_sb->s_blocksize_bits - 9); /* Give ourselves just enough room to cope with inodes in which @@ -126,7 +126,7 @@ return EXT3_DATA_TRANS_BLOCKS + needed; } - + /* * Truncate transactions can be complex and absolutely huge. So we need to * be able to restart the transaction at a conventient checkpoint to make @@ -141,11 +141,11 @@ static handle_t *start_transaction(struct inode *inode) { handle_t *result; - + result = ext3_journal_start(inode, blocks_for_truncate(inode)); if (!IS_ERR(result)) return result; - + ext3_std_error(inode->i_sb, PTR_ERR(result)); return result; } @@ -195,7 +195,7 @@ void ext3_delete_inode (struct inode * inode) { handle_t *handle; - + if (is_bad_inode(inode)) goto no_delete; @@ -209,7 +209,7 @@ ext3_std_error(inode->i_sb, PTR_ERR(handle)); goto no_delete; } - + if (IS_SYNC(inode)) handle->h_sync = 1; inode->i_size = 0; @@ -593,7 +593,7 @@ break; branch[n].key = cpu_to_le32(nr); keys = n+1; - + /* * Get buffer_head for parent block, zero it out * and set the pointer to new one, then send @@ -621,7 +621,7 @@ err = ext3_journal_dirty_metadata(handle, bh); if (err) break; - + parent = nr; } } @@ -723,7 +723,7 @@ */ jbd_debug(1, "the chain changed: try again\n"); err = -EAGAIN; - + err_out: for (i = 1; i < num; i++) { BUFFER_TRACE(where[i].bh, "call journal_forget"); @@ -915,7 +915,7 @@ { struct buffer_head dummy; int fatal = 0, err; - + J_ASSERT(handle != NULL || create == 0); dummy.b_state = 0; @@ -1233,7 +1233,7 @@ struct inode *inode = mapping->host; journal_t *journal; int err; - + if (EXT3_I(inode)->i_state & EXT3_STATE_JDATA) { /* * This is a REALLY heavyweight approach, but the use of @@ -1252,17 +1252,17 @@ * hasn't yet been flushed to disk, they deserve * everything they get. */ - + EXT3_I(inode)->i_state &= ~EXT3_STATE_JDATA; journal = EXT3_JOURNAL(inode); journal_lock_updates(journal); err = journal_flush(journal); journal_unlock_updates(journal); - + if (err) return 0; } - + return generic_block_bmap(mapping,block,ext3_get_block); } @@ -1347,7 +1347,7 @@ int err; J_ASSERT(PageLocked(page)); - + /* * We give up here if we're reentered, because it might be for a * different filesystem. @@ -1356,7 +1356,7 @@ goto out_fail; handle = ext3_journal_start(inode, ext3_writepage_trans_blocks(inode)); - + if (IS_ERR(handle)) { ret = PTR_ERR(handle); goto out_fail; @@ -2003,7 +2003,7 @@ if (is_handle_aborted(handle)) return; - + if (depth--) { struct buffer_head *bh; int addr_per_block = EXT3_ADDR_PER_BLOCK(inode->i_sb); @@ -2165,7 +2165,6 @@ >> EXT3_BLOCK_SIZE_BITS(inode->i_sb); ext3_block_truncate_page(handle, inode->i_mapping, inode->i_size); - n = ext3_block_to_path(inode, last_block, offsets, NULL); if (n == 0) @@ -2296,7 +2295,7 @@ unsigned long desc; unsigned long offset; struct ext3_group_desc * gdp; - + if ((inode->i_ino != EXT3_ROOT_INO && inode->i_ino != EXT3_JOURNAL_INO && inode->i_ino < EXT3_FIRST_INO(inode->i_sb)) || @@ -2340,9 +2339,9 @@ iloc->bh = bh; iloc->raw_inode = (struct ext3_inode *) (bh->b_data + offset); iloc->block_group = block_group; - + return 0; - + bad_inode: return -EIO; } @@ -2372,7 +2371,7 @@ struct ext3_inode_info *ei = EXT3_I(inode); struct buffer_head *bh; int block; - + #ifdef CONFIG_EXT3_FS_POSIX_ACL ei->i_acl = EXT3_ACL_NOT_CACHED; ei->i_default_acl = EXT3_ACL_NOT_CACHED; @@ -2472,7 +2471,7 @@ } ext3_set_inode_flags(inode); return; - + bad_inode: make_bad_inode(inode); return; @@ -2634,7 +2633,7 @@ if (!wait) return; - ext3_force_commit(inode->i_sb); + ext3_force_commit(inode->i_sb); } /* @@ -2680,7 +2679,7 @@ error = PTR_ERR(handle); goto err_out; } - + error = ext3_orphan_add(handle, inode); EXT3_I(inode)->i_disksize = attr->ia_size; rc = ext3_mark_inode_dirty(handle, inode); @@ -2688,7 +2687,7 @@ error = rc; ext3_journal_stop(handle); } - + rc = inode_setattr(inode, attr); /* If inode_setattr's call to ext3_truncate failed to get a @@ -2740,7 +2739,7 @@ int bpp = ext3_journal_blocks_per_page(inode); int indirects = (EXT3_NDIR_BLOCKS % bpp) ? 5 : 3; int ret; - + if (ext3_should_journal_data(inode)) ret = 3 * (bpp + indirects) + 2; else @@ -2877,7 +2876,7 @@ ext3_pin_inode(handle_t *handle, struct inode *inode) { struct ext3_iloc iloc; - + int err = 0; if (handle) { err = ext3_get_inode_loc(inode, &iloc); @@ -2914,7 +2913,7 @@ journal = EXT3_JOURNAL(inode); if (is_journal_aborted(journal) || IS_RDONLY(inode)) return -EROFS; - + journal_lock_updates(journal); journal_flush(journal); @@ -2943,6 +2942,6 @@ handle->h_sync = 1; ext3_journal_stop(handle); ext3_std_error(inode->i_sb, err); - + return err; } diff -urN linux-2.5.72-bk3/fs/ext3/ioctl.c linux-2.5.73/fs/ext3/ioctl.c --- linux-2.5.72-bk3/fs/ext3/ioctl.c 2003-06-22 12:03:29.000000000 -0700 +++ linux-2.5.73/fs/ext3/ioctl.c 2003-06-22 12:04:15.000000000 -0700 @@ -61,7 +61,7 @@ if (!capable(CAP_LINUX_IMMUTABLE)) return -EPERM; } - + /* * The JOURNAL_DATA flag can only be changed by * the relevant capability. @@ -80,7 +80,7 @@ err = ext3_reserve_inode_write(handle, inode, &iloc); if (err) goto flags_err; - + flags = flags & EXT3_FL_USER_MODIFIABLE; flags |= oldflags & ~EXT3_FL_USER_MODIFIABLE; ei->i_flags = flags; @@ -93,7 +93,7 @@ ext3_journal_stop(handle); if (err) return err; - + if ((jflag ^ oldflags) & (EXT3_JOURNAL_DATA_FL)) err = ext3_change_inode_journal_flag(inode, jflag); return err; diff -urN linux-2.5.72-bk3/fs/ext3/namei.c linux-2.5.73/fs/ext3/namei.c --- linux-2.5.72-bk3/fs/ext3/namei.c 2003-06-22 12:03:29.000000000 -0700 +++ linux-2.5.73/fs/ext3/namei.c 2003-06-22 12:04:15.000000000 -0700 @@ -263,7 +263,7 @@ unsigned names = 0, space = 0; char *base = (char *) de; struct dx_hash_info h = *hinfo; - + printk("names: "); while ((char *) de < base + size) { @@ -546,7 +546,7 @@ dxtrace(printk("In htree dirblock_to_tree: block %d\n", block)); if (!(bh = ext3_bread (NULL, dir, block, 0, &err))) return err; - + de = (struct ext3_dir_entry_2 *) bh->b_data; top = (struct ext3_dir_entry_2 *) ((char *) de + dir->i_sb->s_blocksize - @@ -588,11 +588,11 @@ int count = 0; int ret; __u32 hashval; - + dxtrace(printk("In htree_fill_tree, start hash: %x:%x\n", start_hash, start_minor_hash)); dir = dir_file->f_dentry->d_inode; - if (!(EXT3_I(dir)->i_flags & EXT3_INDEX_FL)) { + if (!(EXT3_I(dir)->i_flags & EXT3_INDEX_FL)) { hinfo.hash_version = EXT3_SB(dir->i_sb)->s_def_hash_version; hinfo.seed = EXT3_SB(dir->i_sb)->s_hash_seed; count = htree_dirblock_to_tree(dir_file, dir, 0, &hinfo, @@ -663,7 +663,7 @@ int count = 0; char *base = (char *) de; struct dx_hash_info h = *hinfo; - + while ((char *) de < base + size) { if (de->name_len && de->inode) { @@ -798,8 +798,6 @@ * The returned buffer_head has ->b_count elevated. The caller is expected * to brelse() it when appropriate. */ - - static struct buffer_head * ext3_find_entry (struct dentry *dentry, struct ext3_dir_entry_2 ** res_dir) { @@ -903,7 +901,7 @@ start = 0; goto restart; } - + cleanup_and_exit: /* Clean up the read-ahead blocks */ for (; ra_ptr < ra_max; ra_ptr++) @@ -926,7 +924,7 @@ int namelen = dentry->d_name.len; const u8 *name = dentry->d_name.name; struct inode *dir = dentry->d_parent->d_inode; - + sb = dir->i_sb; if (!(frame = dx_probe (dentry, 0, &hinfo, frames, err))) return NULL; @@ -963,7 +961,7 @@ goto errout; } } while (retval == 1); - + *err = -ENOENT; errout: dxtrace(printk("%s not found\n", name)); @@ -1191,7 +1189,7 @@ unsigned short reclen; int nlen, rlen, err; char *top; - + reclen = EXT3_DIR_REC_LEN(namelen); if (!de) { de = (struct ext3_dir_entry_2 *)bh->b_data; @@ -1223,7 +1221,7 @@ brelse(bh); return err; } - + /* By now the buffer is marked for journaling */ nlen = EXT3_DIR_REC_LEN(de->name_len); rlen = le16_to_cpu(de->rec_len); @@ -1286,7 +1284,7 @@ unsigned blocksize; struct dx_hash_info hinfo; u32 block; - + blocksize = dir->i_sb->s_blocksize; dxtrace(printk("Creating index\n")); retval = ext3_journal_get_write_access(handle, bh); @@ -1296,7 +1294,7 @@ return retval; } root = (struct dx_root *) bh->b_data; - + EXT3_I(dir)->i_flags |= EXT3_INDEX_FL; bh2 = ext3_append (handle, dir, &block, &retval); if (!(bh2)) { @@ -1479,13 +1477,13 @@ unsigned icount1 = icount/2, icount2 = icount - icount1; unsigned hash2 = dx_get_hash(entries + icount1); dxtrace(printk("Split index %i/%i\n", icount1, icount2)); - + BUFFER_TRACE(frame->bh, "get_write_access"); /* index root */ err = ext3_journal_get_write_access(handle, frames[0].bh); if (err) goto journal_error; - + memcpy ((char *) entries2, (char *) (entries + icount1), icount2 * sizeof(struct dx_entry)); dx_set_count (entries, icount1); @@ -1535,7 +1533,7 @@ err = add_dirent_to_buf(handle, dentry, inode, de, bh); bh = 0; goto cleanup; - + journal_error: ext3_std_error(dir->i_sb, err); cleanup: @@ -1831,7 +1829,7 @@ struct super_block *sb = inode->i_sb; struct ext3_iloc iloc; int err = 0, rc; - + lock_super(sb); if (!list_empty(&EXT3_I(inode)->i_orphan)) goto out_unlock; @@ -1852,7 +1850,7 @@ err = ext3_journal_get_write_access(handle, EXT3_SB(sb)->s_sbh); if (err) goto out_unlock; - + err = ext3_reserve_inode_write(handle, inode, &iloc); if (err) goto out_unlock; @@ -2045,7 +2043,7 @@ retval = -EIO; if (le32_to_cpu(de->inode) != inode->i_ino) goto end_unlink; - + if (!inode->i_nlink) { ext3_warning (inode->i_sb, "ext3_unlink", "Deleting nonexistent file (%lu), %d", @@ -2251,7 +2249,7 @@ */ struct buffer_head *old_bh2; struct ext3_dir_entry_2 *old_de2; - + old_bh2 = ext3_find_entry(old_dentry, &old_de2); if (old_bh2) { retval = ext3_delete_entry(handle, old_dir, @@ -2316,9 +2314,9 @@ .mknod = ext3_mknod, .rename = ext3_rename, .setattr = ext3_setattr, - .setxattr = ext3_setxattr, - .getxattr = ext3_getxattr, - .listxattr = ext3_listxattr, + .setxattr = ext3_setxattr, + .getxattr = ext3_getxattr, + .listxattr = ext3_listxattr, .removexattr = ext3_removexattr, .permission = ext3_permission, }; diff -urN linux-2.5.72-bk3/fs/ext3/super.c linux-2.5.73/fs/ext3/super.c --- linux-2.5.72-bk3/fs/ext3/super.c 2003-06-22 12:03:29.000000000 -0700 +++ linux-2.5.73/fs/ext3/super.c 2003-06-22 12:04:15.000000000 -0700 @@ -119,7 +119,7 @@ handle_t *ext3_journal_start(struct inode *inode, int nblocks) { journal_t *journal; - + if (inode->i_sb->s_flags & MS_RDONLY) return ERR_PTR(-EROFS); @@ -132,7 +132,7 @@ "Detected aborted journal"); return ERR_PTR(-EROFS); } - + return journal_start(journal, nblocks); } @@ -164,7 +164,7 @@ { char nbuf[16]; const char *errstr = ext3_decode_error(NULL, err, nbuf); - + printk(KERN_ERR "%s: aborting transaction: %s in %s", caller, errstr, err_fn); @@ -236,7 +236,7 @@ const char *ext3_decode_error(struct super_block * sb, int errno, char nbuf[16]) { char *errstr = NULL; - + switch (errno) { case -EIO: errstr = "IO failure"; @@ -259,7 +259,6 @@ if (snprintf(nbuf, 16, "error %d", -errno) >= 0) errstr = nbuf; } - break; } @@ -277,7 +276,7 @@ printk (KERN_CRIT "EXT3-fs error (device %s) in %s: %s\n", sb->s_id, function, errstr); - + ext3_handle_error(sb); } @@ -311,7 +310,7 @@ if (sb->s_flags & MS_RDONLY) return; - + printk (KERN_CRIT "Remounting filesystem read-only\n"); EXT3_SB(sb)->s_mount_state |= EXT3_ERROR_FS; sb->s_flags |= MS_RDONLY; @@ -426,10 +425,10 @@ static void dump_orphan_list(struct super_block *sb, struct ext3_sb_info *sbi) { struct list_head *l; - + printk(KERN_ERR "sb orphan head is %d\n", le32_to_cpu(sbi->s_es->s_last_orphan)); - + printk(KERN_ERR "sb_info orphan list:\n"); list_for_each(l, &sbi->s_orphan) { struct inode *inode = orphan_list_entry(l); @@ -1062,7 +1061,7 @@ struct ext3_sb_info *sbi = EXT3_SB(sb); unsigned long bg, first_data_block, first_meta_bg; int has_super = 0; - + first_data_block = le32_to_cpu(sbi->s_es->s_first_data_block); first_meta_bg = le32_to_cpu(sbi->s_es->s_first_meta_bg); @@ -1138,7 +1137,7 @@ sb->s_id); goto failed_mount; } - + /* Set defaults before we parse the mount options */ def_mount_opts = le32_to_cpu(es->s_default_mount_opts); if (def_mount_opts & EXT3_DEFM_DEBUG) @@ -1162,7 +1161,7 @@ set_opt(sbi->s_mount_opt, ERRORS_PANIC); else if (le16_to_cpu(sbi->s_es->s_errors) == EXT3_ERRORS_RO) set_opt(sbi->s_mount_opt, ERRORS_RO); - + sbi->s_resuid = le16_to_cpu(es->s_def_resuid); sbi->s_resgid = le16_to_cpu(es->s_def_resgid); @@ -1539,7 +1538,7 @@ "EXT3-fs: blocksize too small for journal device.\n"); goto out_bdev; } - + sb_block = EXT3_MIN_BLOCK_SIZE / blocksize; offset = EXT3_MIN_BLOCK_SIZE % blocksize; set_blocksize(bdev, blocksize); @@ -1753,7 +1752,7 @@ journal_t *journal; int j_errno; const char *errstr; - + journal = EXT3_SB(sb)->s_journal; /* @@ -1764,13 +1763,13 @@ j_errno = journal_errno(journal); if (j_errno) { char nbuf[16]; - + errstr = ext3_decode_error(sb, j_errno, nbuf); ext3_warning(sb, __FUNCTION__, "Filesystem error recorded " "from previous mount: %s", errstr); ext3_warning(sb, __FUNCTION__, "Marking fs in need of " "filesystem check."); - + EXT3_SB(sb)->s_mount_state |= EXT3_ERROR_FS; es->s_state |= cpu_to_le16(EXT3_ERROR_FS); ext3_commit_super (sb, es, 1); @@ -1886,7 +1885,7 @@ es = sbi->s_es; ext3_init_journal_params(sbi, sbi->s_journal); - + if ((*flags & MS_RDONLY) != (sb->s_flags & MS_RDONLY)) { if (sbi->s_mount_opt & EXT3_MOUNT_ABORT) return -EROFS; @@ -1934,7 +1933,7 @@ return 0; } -int ext3_statfs (struct super_block * sb, struct statfs * buf) +int ext3_statfs (struct super_block * sb, struct kstatfs * buf) { struct ext3_super_block *es = EXT3_SB(sb)->s_es; unsigned long overhead; diff -urN linux-2.5.72-bk3/fs/ext3/xattr.c linux-2.5.73/fs/ext3/xattr.c --- linux-2.5.72-bk3/fs/ext3/xattr.c 2003-06-22 12:03:29.000000000 -0700 +++ linux-2.5.73/fs/ext3/xattr.c 2003-06-22 12:04:15.000000000 -0700 @@ -481,7 +481,7 @@ unsigned int name_len; int min_offs = sb->s_blocksize, not_found = 1, free, error; char *end; - + /* * header -- Points either into bh, or to a temporarily * allocated buffer. @@ -493,7 +493,7 @@ * towards the end of the block). * end -- Points right after the block pointed to by header. */ - + ea_idebug(inode, "name=%d.%s, value=%p, value_len=%ld", name_index, name, value, (long)value_len); @@ -736,11 +736,11 @@ ea_bdebug(new_bh, "%s block %ld", (old_bh == new_bh) ? "keeping" : "reusing", new_bh->b_blocknr); - + error = -EDQUOT; if (DQUOT_ALLOC_BLOCK(inode, 1)) goto cleanup; - + error = ext3_journal_get_write_access(handle, new_bh); if (error) goto cleanup; @@ -782,7 +782,7 @@ set_buffer_uptodate(new_bh); unlock_buffer(new_bh); ext3_xattr_cache_insert(new_bh); - + ext3_xattr_update_super_block(handle, sb); } error = ext3_journal_dirty_metadata(handle, new_bh); @@ -1108,7 +1108,7 @@ { struct ext3_xattr_entry *here; __u32 hash = 0; - + ext3_xattr_hash_entry(header, entry); here = ENTRY(header+1); while (!IS_LAST_ENTRY(here)) { @@ -1131,7 +1131,7 @@ init_ext3_xattr(void) { int err; - + err = ext3_xattr_register(EXT3_XATTR_INDEX_USER, &ext3_xattr_user_handler); if (err) diff -urN linux-2.5.72-bk3/fs/fat/inode.c linux-2.5.73/fs/fat/inode.c --- linux-2.5.72-bk3/fs/fat/inode.c 2003-06-16 21:20:00.000000000 -0700 +++ linux-2.5.73/fs/fat/inode.c 2003-06-22 12:04:15.000000000 -0700 @@ -1019,7 +1019,7 @@ return error; } -int fat_statfs(struct super_block *sb,struct statfs *buf) +int fat_statfs(struct super_block *sb, struct kstatfs *buf) { int free,nr; diff -urN linux-2.5.72-bk3/fs/freevxfs/vxfs_super.c linux-2.5.73/fs/freevxfs/vxfs_super.c --- linux-2.5.72-bk3/fs/freevxfs/vxfs_super.c 2003-06-16 21:20:21.000000000 -0700 +++ linux-2.5.73/fs/freevxfs/vxfs_super.c 2003-06-22 12:04:15.000000000 -0700 @@ -55,7 +55,7 @@ static void vxfs_put_super(struct super_block *); -static int vxfs_statfs(struct super_block *, struct statfs *); +static int vxfs_statfs(struct super_block *, struct kstatfs *); static struct super_operations vxfs_super_ops = { .read_inode = vxfs_read_inode, @@ -105,7 +105,7 @@ * This is everything but complete... */ static int -vxfs_statfs(struct super_block *sbp, struct statfs *bufp) +vxfs_statfs(struct super_block *sbp, struct kstatfs *bufp) { struct vxfs_sb_info *infp = VXFS_SBI(sbp); diff -urN linux-2.5.72-bk3/fs/fs-writeback.c linux-2.5.73/fs/fs-writeback.c --- linux-2.5.72-bk3/fs/fs-writeback.c 2003-06-16 21:20:28.000000000 -0700 +++ linux-2.5.73/fs/fs-writeback.c 2003-06-22 12:04:15.000000000 -0700 @@ -49,9 +49,6 @@ { struct super_block *sb = inode->i_sb; - if (!sb) - return; /* swapper_space */ - /* * Don't do this for I_DIRTY_PAGES - that doesn't actually * dirty the inode itself @@ -90,9 +87,12 @@ * Only add valid (hashed) inodes to the superblock's * dirty list. Add blockdev inodes as well. */ - if ((hlist_unhashed(&inode->i_hash) || (inode->i_state & (I_FREEING|I_CLEAR))) - && !S_ISBLK(inode->i_mode)) - goto out; + if (!S_ISBLK(inode->i_mode)) { + if (hlist_unhashed(&inode->i_hash)) + goto out; + if (inode->i_state & (I_FREEING|I_CLEAR)) + goto out; + } /* * If the inode was already on s_dirty or s_io, don't @@ -369,6 +369,9 @@ * * A finite limit is set on the number of pages which will be written. * To prevent infinite livelock of sys_sync(). + * + * We add in the number of potentially dirty inodes, because each inode write + * can dirty pagecache in the underlying blockdev. */ void sync_inodes_sb(struct super_block *sb, int wait) { @@ -382,7 +385,9 @@ get_page_state(&ps); wbc.nr_to_write = ps.nr_dirty + ps.nr_unstable + - (ps.nr_dirty + ps.nr_unstable) / 4; + (inodes_stat.nr_inodes - inodes_stat.nr_unused) + + ps.nr_dirty + ps.nr_unstable; + wbc.nr_to_write += wbc.nr_to_write / 2; /* Bit more for luck */ spin_lock(&inode_lock); sync_sb_inodes(sb, &wbc); spin_unlock(&inode_lock); diff -urN linux-2.5.72-bk3/fs/hfs/super.c linux-2.5.73/fs/hfs/super.c --- linux-2.5.72-bk3/fs/hfs/super.c 2003-06-16 21:19:57.000000000 -0700 +++ linux-2.5.73/fs/hfs/super.c 2003-06-22 12:04:15.000000000 -0700 @@ -40,7 +40,7 @@ static void hfs_read_inode(struct inode *); static void hfs_put_super(struct super_block *); -static int hfs_statfs(struct super_block *, struct statfs *); +static int hfs_statfs(struct super_block *, struct kstatfs *); static void hfs_write_super(struct super_block *); static kmem_cache_t * hfs_inode_cachep; @@ -195,7 +195,7 @@ * * changed f_files/f_ffree to reflect the fs_ablock/free_ablocks. */ -static int hfs_statfs(struct super_block *sb, struct statfs *buf) +static int hfs_statfs(struct super_block *sb, struct kstatfs *buf) { struct hfs_mdb *mdb = HFS_SB(sb)->s_mdb; diff -urN linux-2.5.72-bk3/fs/hpfs/hpfs_fn.h linux-2.5.73/fs/hpfs/hpfs_fn.h --- linux-2.5.72-bk3/fs/hpfs/hpfs_fn.h 2003-06-16 21:20:05.000000000 -0700 +++ linux-2.5.73/fs/hpfs/hpfs_fn.h 2003-06-22 12:04:15.000000000 -0700 @@ -310,7 +310,7 @@ int hpfs_remount_fs(struct super_block *, int *, char *); void hpfs_put_super(struct super_block *); unsigned hpfs_count_one_bitmap(struct super_block *, secno); -int hpfs_statfs(struct super_block *, struct statfs *); +int hpfs_statfs(struct super_block *, struct kstatfs *); extern struct address_space_operations hpfs_aops; diff -urN linux-2.5.72-bk3/fs/hpfs/super.c linux-2.5.73/fs/hpfs/super.c --- linux-2.5.72-bk3/fs/hpfs/super.c 2003-06-16 21:20:05.000000000 -0700 +++ linux-2.5.73/fs/hpfs/super.c 2003-06-22 12:04:15.000000000 -0700 @@ -136,7 +136,7 @@ return count; } -int hpfs_statfs(struct super_block *s, struct statfs *buf) +int hpfs_statfs(struct super_block *s, struct kstatfs *buf) { struct hpfs_sb_info *sbi = hpfs_sb(s); lock_kernel(); diff -urN linux-2.5.72-bk3/fs/hugetlbfs/inode.c linux-2.5.73/fs/hugetlbfs/inode.c --- linux-2.5.72-bk3/fs/hugetlbfs/inode.c 2003-06-16 21:20:22.000000000 -0700 +++ linux-2.5.73/fs/hugetlbfs/inode.c 2003-06-22 12:04:15.000000000 -0700 @@ -22,7 +22,9 @@ #include #include #include +#include #include +#include #include #include @@ -43,8 +45,9 @@ static int hugetlbfs_file_mmap(struct file *file, struct vm_area_struct *vma) { - struct inode *inode =file->f_dentry->d_inode; + struct inode *inode = file->f_dentry->d_inode; struct address_space *mapping = inode->i_mapping; + struct hugetlbfs_sb_info *sbinfo = HUGETLBFS_SB(inode->i_sb); loff_t len; int ret; @@ -57,6 +60,18 @@ if (vma->vm_end - vma->vm_start < HPAGE_SIZE) return -EINVAL; + len = (loff_t)(vma->vm_end - vma->vm_start); + if (sbinfo->free_blocks >= 0) { /* Check if there is any size limit. */ + spin_lock(&sbinfo->stat_lock); + if ((len >> HPAGE_SHIFT) <= sbinfo->free_blocks) { + sbinfo->free_blocks -= (len >> HPAGE_SHIFT); + spin_unlock(&sbinfo->stat_lock); + } else { + spin_unlock(&sbinfo->stat_lock); + return -ENOMEM; + } + } + down(&inode->i_sem); update_atime(inode); @@ -68,6 +83,16 @@ if (ret == 0 && inode->i_size < len) inode->i_size = len; up(&inode->i_sem); + + /* + * If the huge page allocation has failed then increment free_blocks. + */ + if ((ret != 0) && (sbinfo->free_blocks >= 0)) { + spin_lock(&sbinfo->stat_lock); + sbinfo->free_blocks += (len >> HPAGE_SHIFT); + spin_unlock(&sbinfo->stat_lock); + } + return ret; } @@ -154,6 +179,7 @@ void truncate_hugepages(struct address_space *mapping, loff_t lstart) { + struct hugetlbfs_sb_info *sbinfo = HUGETLBFS_SB(mapping->host->i_sb); const pgoff_t start = lstart >> HPAGE_SHIFT; struct pagevec pvec; pgoff_t next; @@ -178,6 +204,11 @@ ++next; truncate_huge_page(page); unlock_page(page); + if (sbinfo->free_blocks >= 0) { + spin_lock(&sbinfo->stat_lock); + sbinfo->free_blocks++; + spin_unlock(&sbinfo->stat_lock); + } } huge_pagevec_release(&pvec); } @@ -186,6 +217,8 @@ static void hugetlbfs_delete_inode(struct inode *inode) { + struct hugetlbfs_sb_info *sbinfo = HUGETLBFS_SB(inode->i_sb); + hlist_del_init(&inode->i_hash); list_del_init(&inode->i_list); inode->i_state |= I_FREEING; @@ -197,6 +230,12 @@ security_inode_delete(inode); + if (sbinfo->free_inodes >= 0) { + spin_lock(&sbinfo->stat_lock); + sbinfo->free_inodes++; + spin_unlock(&sbinfo->stat_lock); + } + clear_inode(inode); destroy_inode(inode); } @@ -204,6 +243,7 @@ static void hugetlbfs_forget_inode(struct inode *inode) { struct super_block *super_block = inode->i_sb; + struct hugetlbfs_sb_info *sbinfo = HUGETLBFS_SB(super_block); if (hlist_unhashed(&inode->i_hash)) goto out_truncate; @@ -229,6 +269,12 @@ if (inode->i_data.nrpages) truncate_hugepages(&inode->i_data, 0); + if (sbinfo->free_inodes >= 0) { + spin_lock(&sbinfo->stat_lock); + sbinfo->free_inodes++; + spin_unlock(&sbinfo->stat_lock); + } + clear_inode(inode); destroy_inode(inode); } @@ -341,13 +387,25 @@ static struct inode *hugetlbfs_get_inode(struct super_block *sb, uid_t uid, gid_t gid, int mode, dev_t dev) { - struct inode * inode = new_inode(sb); + struct inode *inode; + struct hugetlbfs_sb_info *sbinfo = HUGETLBFS_SB(sb); + + if (sbinfo->free_inodes >= 0) { + spin_lock(&sbinfo->stat_lock); + if (!sbinfo->free_inodes) { + spin_unlock(&sbinfo->stat_lock); + return NULL; + } + sbinfo->free_inodes--; + spin_unlock(&sbinfo->stat_lock); + } + inode = new_inode(sb); if (inode) { inode->i_mode = mode; inode->i_uid = uid; inode->i_gid = gid; - inode->i_blksize = PAGE_CACHE_SIZE; + inode->i_blksize = HPAGE_SIZE; inode->i_blocks = 0; inode->i_rdev = NODEV; inode->i_mapping->a_ops = &hugetlbfs_aops; @@ -379,17 +437,18 @@ /* * File creation. Allocate an inode, and we're done.. */ -/* SMP-safe */ static int hugetlbfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t dev) { - struct inode * inode = hugetlbfs_get_inode(dir->i_sb, current->fsuid, + struct inode *inode = hugetlbfs_get_inode(dir->i_sb, current->fsuid, current->fsgid, mode, dev); int error = -ENOSPC; if (inode) { + dir->i_size += PSEUDO_DIRENT_SIZE; + dir->i_ctime = dir->i_mtime = CURRENT_TIME; d_instantiate(dentry, inode); - dget(dentry); /* Extra count - pin the dentry in core */ + dget(dentry); /* Extra count - pin the dentry in core */ error = 0; } return error; @@ -425,6 +484,9 @@ } else iput(inode); } + dir->i_size += PSEUDO_DIRENT_SIZE; + dir->i_ctime = dir->i_mtime = CURRENT_TIME; + return error; } @@ -436,6 +498,83 @@ return 0; } +static int hugetlbfs_statfs(struct super_block *sb, struct kstatfs *buf) +{ + struct hugetlbfs_sb_info *sbinfo = HUGETLBFS_SB(sb); + + buf->f_type = HUGETLBFS_MAGIC; + buf->f_bsize = HPAGE_SIZE; + if (sbinfo) { + spin_lock(&sbinfo->stat_lock); + buf->f_blocks = sbinfo->max_blocks; + buf->f_bavail = buf->f_bfree = sbinfo->free_blocks; + buf->f_files = sbinfo->max_inodes; + buf->f_ffree = sbinfo->free_inodes; + spin_unlock(&sbinfo->stat_lock); + } + buf->f_namelen = NAME_MAX; + return 0; +} + +static int hugetlbfs_link(struct dentry *old_dentry, + struct inode *dir, struct dentry *dentry) +{ + struct inode *inode = old_dentry->d_inode; + + dir->i_size += PSEUDO_DIRENT_SIZE; + inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME; + inode->i_nlink++; + atomic_inc(&inode->i_count); + dget(dentry); + d_instantiate(dentry, inode); + return 0; +} + +static int hugetlbfs_unlink(struct inode *dir, struct dentry *dentry) +{ + struct inode *inode = dentry->d_inode; + + dir->i_size -= PSEUDO_DIRENT_SIZE; + inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME; + inode->i_nlink--; + dput(dentry); + return 0; +} + +static int hugetlbfs_rmdir(struct inode *dir, struct dentry *dentry) +{ + if (!simple_empty(dentry)) + return -ENOTEMPTY; + + dir->i_nlink--; + return hugetlbfs_unlink(dir, dentry); +} + +static int hugetlbfs_rename(struct inode *old_dir, struct dentry *old_dentry, + struct inode *new_dir, struct dentry *new_dentry) +{ + struct inode *inode = old_dentry->d_inode; + int they_are_dirs = S_ISDIR(inode->i_mode); + + if (!simple_empty(new_dentry)) + return -ENOTEMPTY; + + if (new_dentry->d_inode) { + hugetlbfs_unlink(new_dir, new_dentry); + if (they_are_dirs) + old_dir->i_nlink--; + } else if (they_are_dirs) { + old_dir->i_nlink--; + new_dir->i_nlink++; + } + + old_dir->i_size -= PSEUDO_DIRENT_SIZE; + new_dir->i_size += PSEUDO_DIRENT_SIZE; + old_dir->i_ctime = old_dir->i_mtime = new_dir->i_ctime = + new_dir->i_mtime = inode->i_ctime = CURRENT_TIME; + return 0; +} + static struct address_space_operations hugetlbfs_aops = { .readpage = hugetlbfs_readpage, .prepare_write = hugetlbfs_prepare_write, @@ -452,13 +591,13 @@ static struct inode_operations hugetlbfs_dir_inode_operations = { .create = hugetlbfs_create, .lookup = simple_lookup, - .link = simple_link, - .unlink = simple_unlink, + .link = hugetlbfs_link, + .unlink = hugetlbfs_unlink, .symlink = hugetlbfs_symlink, .mkdir = hugetlbfs_mkdir, - .rmdir = simple_rmdir, + .rmdir = hugetlbfs_rmdir, .mknod = hugetlbfs_mknod, - .rename = simple_rename, + .rename = hugetlbfs_rename, .setattr = hugetlbfs_setattr, }; @@ -467,29 +606,26 @@ }; static struct super_operations hugetlbfs_ops = { - .statfs = simple_statfs, + .statfs = hugetlbfs_statfs, .drop_inode = hugetlbfs_drop_inode, }; static int hugetlbfs_parse_options(char *options, struct hugetlbfs_config *pconfig) { - char *opt, *value; - int ret = 0; + char *opt, *value, *rest; if (!options) - goto out; + return 0; while ((opt = strsep(&options, ",")) != NULL) { if (!*opt) continue; value = strchr(opt, '='); - if (!value || !*value) { - ret = -EINVAL; - goto out; - } else { + if (!value || !*value) + return -EINVAL; + else *value++ = '\0'; - } if (!strcmp(opt, "uid")) pconfig->uid = simple_strtoul(value, &value, 0); @@ -497,22 +633,27 @@ pconfig->gid = simple_strtoul(value, &value, 0); else if (!strcmp(opt, "mode")) pconfig->mode = simple_strtoul(value,&value,0) & 0777U; - else { - ret = -EINVAL; - goto out; - } + else if (!strcmp(opt, "size")) { + unsigned long long size = memparse(value, &rest); + if (*rest == '%') { + size <<= HPAGE_SHIFT; + size *= htlbpage_max; + do_div(size, 100); + rest++; + } + size &= HPAGE_MASK; + pconfig->nr_blocks = (size >> HPAGE_SHIFT); + value = rest; + } else if (!strcmp(opt,"nr_inodes")) { + pconfig->nr_inodes = memparse(value, &rest); + value = rest; + } else + return -EINVAL; - if (*value) { - ret = -EINVAL; - goto out; - } + if (*value) + return -EINVAL; } return 0; -out: - pconfig->uid = current->fsuid; - pconfig->gid = current->fsgid; - pconfig->mode = 0755; - return ret; } static int @@ -522,13 +663,30 @@ struct dentry * root; int ret; struct hugetlbfs_config config; + struct hugetlbfs_sb_info *sbinfo; + + sbinfo = kmalloc(sizeof(struct hugetlbfs_sb_info), GFP_KERNEL); + if (!sbinfo) + return -ENOMEM; + sb->s_fs_info = sbinfo; + config.nr_blocks = -1; /* No limit on size by default */ + config.nr_inodes = -1; /* No limit on number of inodes by default */ + config.uid = current->fsuid; + config.gid = current->fsgid; + config.mode = 0755; ret = hugetlbfs_parse_options(data, &config); + if (ret) return ret; - sb->s_blocksize = PAGE_CACHE_SIZE; - sb->s_blocksize_bits = PAGE_CACHE_SHIFT; + spin_lock_init(&sbinfo->stat_lock); + sbinfo->max_blocks = config.nr_blocks; + sbinfo->free_blocks = config.nr_blocks; + sbinfo->max_inodes = config.nr_inodes; + sbinfo->free_inodes = config.nr_inodes; + sb->s_blocksize = HPAGE_SIZE; + sb->s_blocksize_bits = HPAGE_SHIFT; sb->s_magic = HUGETLBFS_MAGIC; sb->s_op = &hugetlbfs_ops; inode = hugetlbfs_get_inode(sb, config.uid, config.gid, @@ -551,10 +709,19 @@ return get_sb_nodev(fs_type, flags, data, hugetlbfs_fill_super); } +static void hugetlbfs_kill_super(struct super_block *sb) +{ + if (sb) { + if(sb->s_fs_info) + kfree(sb->s_fs_info); + kill_litter_super(sb); + } +} + static struct file_system_type hugetlbfs_fs_type = { .name = "hugetlbfs", .get_sb = hugetlbfs_get_sb, - .kill_sb = kill_litter_super, + .kill_sb = hugetlbfs_kill_super }; static struct vfsmount *hugetlbfs_vfsmount; diff -urN linux-2.5.72-bk3/fs/intermezzo/intermezzo_fs.h linux-2.5.73/fs/intermezzo/intermezzo_fs.h --- linux-2.5.72-bk3/fs/intermezzo/intermezzo_fs.h 2003-06-16 21:20:00.000000000 -0700 +++ linux-2.5.73/fs/intermezzo/intermezzo_fs.h 2003-06-22 12:04:16.000000000 -0700 @@ -530,7 +530,7 @@ struct dentry *old_dentry, struct dentry *new_dir, struct dentry *new_dentry, struct lento_vfs_context *info); int presto_do_statfs (struct presto_file_set *fset, - struct statfs * buf); + struct kstatfs * buf); int lento_setattr(const char *name, struct iattr *iattr, struct lento_vfs_context *info); diff -urN linux-2.5.72-bk3/fs/isofs/inode.c linux-2.5.73/fs/isofs/inode.c --- linux-2.5.72-bk3/fs/isofs/inode.c 2003-06-16 21:20:25.000000000 -0700 +++ linux-2.5.73/fs/isofs/inode.c 2003-06-22 12:04:16.000000000 -0700 @@ -74,7 +74,7 @@ } static void isofs_read_inode(struct inode *); -static int isofs_statfs (struct super_block *, struct statfs *); +static int isofs_statfs (struct super_block *, struct kstatfs *); static kmem_cache_t *isofs_inode_cachep; @@ -884,7 +884,7 @@ return -EINVAL; } -static int isofs_statfs (struct super_block *sb, struct statfs *buf) +static int isofs_statfs (struct super_block *sb, struct kstatfs *buf) { buf->f_type = ISOFS_SUPER_MAGIC; buf->f_bsize = sb->s_blocksize; diff -urN linux-2.5.72-bk3/fs/jbd/checkpoint.c linux-2.5.73/fs/jbd/checkpoint.c --- linux-2.5.72-bk3/fs/jbd/checkpoint.c 2003-06-22 12:03:29.000000000 -0700 +++ linux-2.5.73/fs/jbd/checkpoint.c 2003-06-22 12:04:16.000000000 -0700 @@ -85,7 +85,7 @@ return; spin_unlock(&journal->j_state_lock); down(&journal->j_checkpoint_sem); - + /* * Test again, another process may have checkpointed while we * were waiting for the checkpoint lock @@ -232,7 +232,7 @@ if (buffer_dirty(bh) && !buffer_locked(bh) && jh->b_jlist == BJ_None) { J_ASSERT_JH(jh, jh->b_transaction == NULL); - + /* * Important: we are about to write the buffer, and * possibly block, while still holding the journal lock. @@ -267,7 +267,6 @@ return ret; } - /* * Perform an actual checkpoint. We don't write out only enough to * satisfy the current blocked requests: rather we submit a reasonably @@ -373,7 +372,7 @@ result = cleanup_journal_tail(journal); if (result < 0) return result; - + return 0; } @@ -524,7 +523,7 @@ journal_t *journal; JBUFFER_TRACE(jh, "entry"); - + if ((transaction = jh->b_cp_transaction) == NULL) { JBUFFER_TRACE(jh, "not on transaction"); goto out; diff -urN linux-2.5.72-bk3/fs/jbd/commit.c linux-2.5.73/fs/jbd/commit.c --- linux-2.5.72-bk3/fs/jbd/commit.c 2003-06-22 12:03:29.000000000 -0700 +++ linux-2.5.73/fs/jbd/commit.c 2003-06-22 12:04:16.000000000 -0700 @@ -197,7 +197,7 @@ commit_transaction->t_log_start = journal->j_head; wake_up(&journal->j_wait_transaction_locked); spin_unlock(&journal->j_state_lock); - + jbd_debug (3, "JBD: commit phase 2\n"); /* @@ -368,7 +368,7 @@ __journal_abort_hard(journal); continue; } - + bh = jh2bh(descriptor); jbd_debug(4, "JBD: got buffer %llu (%p)\n", (unsigned long long)bh->b_blocknr, bh->b_data); @@ -622,7 +622,7 @@ if (err) __journal_abort_hard(journal); - + /* * Call any callbacks that had been registered for handles in this * transaction. It is up to the callback to free any allocated @@ -714,7 +714,7 @@ clear_buffer_freed(bh); clear_buffer_jbddirty(bh); } - + if (buffer_jbddirty(bh)) { JBUFFER_TRACE(jh, "add to new checkpointing trans"); __journal_insert_checkpoint(jh, commit_transaction); diff -urN linux-2.5.72-bk3/fs/jbd/journal.c linux-2.5.73/fs/jbd/journal.c --- linux-2.5.72-bk3/fs/jbd/journal.c 2003-06-22 12:03:29.000000000 -0700 +++ linux-2.5.73/fs/jbd/journal.c 2003-06-22 12:04:16.000000000 -0700 @@ -161,7 +161,7 @@ del_timer_sync(journal->j_commit_timer); journal_commit_transaction(journal); spin_lock(&journal->j_state_lock); - goto loop; + goto end_loop; } wake_up(&journal->j_wait_done_commit); @@ -175,7 +175,6 @@ spin_unlock(&journal->j_state_lock); refrigerator(PF_IOTHREAD); spin_lock(&journal->j_state_lock); - jbd_debug(1, "Resuming kjournald\n"); } else { /* * We assume on resume that commits are already there, @@ -185,7 +184,7 @@ int should_sleep = 1; prepare_to_wait(&journal->j_wait_commit, &wait, - TASK_INTERRUPTIBLE); + TASK_INTERRUPTIBLE); if (journal->j_commit_sequence != journal->j_commit_request) should_sleep = 0; transaction = journal->j_running_transaction; @@ -210,7 +209,7 @@ journal->j_commit_request = transaction->t_tid; jbd_debug(1, "woke because of timeout\n"); } - +end_loop: if (!(journal->j_flags & JFS_UNMOUNT)) goto loop; @@ -230,12 +229,16 @@ static void journal_kill_thread(journal_t *journal) { + spin_lock(&journal->j_state_lock); journal->j_flags |= JFS_UNMOUNT; while (journal->j_task) { wake_up(&journal->j_wait_commit); + spin_unlock(&journal->j_state_lock); wait_event(journal->j_wait_done_commit, journal->j_task == 0); + spin_lock(&journal->j_state_lock); } + spin_unlock(&journal->j_state_lock); } /* @@ -729,7 +732,7 @@ kfree(journal); return NULL; } - + bh = __getblk(journal->j_dev, blocknr, journal->j_blocksize); J_ASSERT(bh != NULL); journal->j_sb_buffer = bh; @@ -868,6 +871,22 @@ journal_superblock_t *sb = journal->j_superblock; struct buffer_head *bh = journal->j_sb_buffer; + /* + * As a special case, if the on-disk copy is already marked as needing + * no recovery (s_start == 0) and there are no outstanding transactions + * in the filesystem, then we can safely defer the superblock update + * until the next commit by setting JFS_FLUSHED. This avoids + * attempting a write to a potential-readonly device. + */ + if (sb->s_start == 0 && journal->j_tail_sequence == + journal->j_transaction_sequence) { + jbd_debug(1,"JBD: Skipping superblock update on recovered sb " + "(start %ld, seq %d, errno %d)\n", + journal->j_tail, journal->j_tail_sequence, + journal->j_errno); + goto out; + } + spin_lock(&journal->j_state_lock); jbd_debug(1,"JBD: updating superblock (start %ld, seq %d, errno %d)\n", journal->j_tail, journal->j_tail_sequence, journal->j_errno); @@ -884,6 +903,7 @@ else ll_rw_block(WRITE, 1, &bh); +out: /* If we have just flushed the log (by marking s_start==0), then * any future commit will have to be careful to update the * superblock again to re-record the true start of the log. */ @@ -906,7 +926,7 @@ struct buffer_head *bh; journal_superblock_t *sb; int err = -EIO; - + bh = journal->j_sb_buffer; J_ASSERT(bh != NULL); @@ -923,7 +943,7 @@ sb = journal->j_superblock; err = -EINVAL; - + if (sb->s_header.h_magic != htonl(JFS_MAGIC_NUMBER) || sb->s_blocksize != htonl(journal->j_blocksize)) { printk(KERN_WARNING "JBD: no valid journal superblock found\n"); @@ -1242,7 +1262,7 @@ unsigned long old_tail; spin_lock(&journal->j_state_lock); - + /* Force everything buffered to the log... */ if (journal->j_running_transaction) { transaction = journal->j_running_transaction; @@ -1520,7 +1540,7 @@ */ void * __jbd_kmalloc (const char *where, size_t size, int flags, int retry) { - return kmalloc(size, flags | (retry ? __GFP_NOFAIL : 0)); + return kmalloc(size, flags | (retry ? __GFP_NOFAIL : 0)); } /* diff -urN linux-2.5.72-bk3/fs/jbd/recovery.c linux-2.5.73/fs/jbd/recovery.c --- linux-2.5.72-bk3/fs/jbd/recovery.c 2003-06-16 21:20:20.000000000 -0700 +++ linux-2.5.73/fs/jbd/recovery.c 2003-06-22 12:04:16.000000000 -0700 @@ -29,9 +29,9 @@ */ struct recovery_info { - tid_t start_transaction; + tid_t start_transaction; tid_t end_transaction; - + int nr_replays; int nr_revokes; int nr_revoke_hits; @@ -72,9 +72,9 @@ unsigned int max, nbufs, next; unsigned long blocknr; struct buffer_head *bh; - + struct buffer_head * bufs[MAXBUF]; - + /* Do up to 128K of readahead */ max = start + (128 * 1024 / journal->j_blocksize); if (max > journal->j_maxlen) @@ -82,9 +82,9 @@ /* Do the readahead itself. We'll submit MAXBUF buffer_heads at * a time to the block device IO layer. */ - + nbufs = 0; - + for (next = start; next < max; next++) { err = journal_bmap(journal, next, &blocknr); @@ -115,7 +115,7 @@ ll_rw_block(READ, nbufs, bufs); err = 0; -failed: +failed: if (nbufs) journal_brelse_array(bufs, nbufs); return err; @@ -138,7 +138,7 @@ *bhp = NULL; J_ASSERT (offset < journal->j_maxlen); - + err = journal_bmap(journal, offset, &blocknr); if (err) { @@ -224,10 +224,10 @@ journal_superblock_t * sb; struct recovery_info info; - + memset(&info, 0, sizeof(info)); sb = journal->j_superblock; - + /* * The journal superblock's s_start field (the current log head) * is always zero if, and only if, the journal was cleanly @@ -240,7 +240,6 @@ journal->j_transaction_sequence = ntohl(sb->s_sequence) + 1; return 0; } - err = do_one_pass(journal, &info, PASS_SCAN); if (!err) @@ -257,7 +256,7 @@ /* Restart the log at the next transaction ID, thus invalidating * any existing commit records in the log. */ journal->j_transaction_sequence = ++info.end_transaction; - + journal_clear_revoke(journal); sync_blockdev(journal->j_fs_dev); return err; @@ -282,10 +281,10 @@ journal_superblock_t * sb; struct recovery_info info; - + memset (&info, 0, sizeof(info)); sb = journal->j_superblock; - + err = do_one_pass(journal, &info, PASS_SCAN); if (err) { @@ -295,7 +294,6 @@ #ifdef CONFIG_JBD_DEBUG int dropped = info.end_transaction - ntohl(sb->s_sequence); #endif - jbd_debug(0, "JBD: ignoring %d transaction%s from the journal.\n", dropped, (dropped == 1) ? "" : "s"); @@ -303,14 +301,12 @@ } journal->j_tail = 0; - return err; } static int do_one_pass(journal_t *journal, struct recovery_info *info, enum passtype pass) { - unsigned int first_commit_ID, next_commit_ID; unsigned long next_log_block; int err, success = 0; @@ -319,7 +315,7 @@ struct buffer_head * bh; unsigned int sequence; int blocktype; - + /* Precompute the maximum metadata descriptors in a descriptor block */ int MAX_BLOCKS_PER_DESC; MAX_BLOCKS_PER_DESC = ((journal->j_blocksize-sizeof(journal_header_t)) @@ -354,11 +350,11 @@ journal_block_tag_t * tag; struct buffer_head * obh; struct buffer_head * nbh; - + /* If we already know where to stop the log traversal, * check right now that we haven't gone past the end of * the log. */ - + if (pass != PASS_SCAN) if (tid_geq(next_commit_ID, info->end_transaction)) break; @@ -369,7 +365,7 @@ /* Skip over each chunk of the transaction looking * either the next descriptor block or the final commit * record. */ - + jbd_debug(3, "JBD: checking block %ld\n", next_log_block); err = jread(&bh, journal, next_log_block); if (err) @@ -377,7 +373,7 @@ next_log_block++; wrap(journal, next_log_block); - + /* What kind of buffer is it? * * If it is a descriptor block, check that it has the @@ -385,7 +381,7 @@ * here. */ tmp = (journal_header_t *)bh->b_data; - + if (tmp->h_magic != htonl(JFS_MAGIC_NUMBER)) { brelse(bh); break; @@ -395,12 +391,12 @@ sequence = ntohl(tmp->h_sequence); jbd_debug(3, "Found magic %d, sequence %d\n", blocktype, sequence); - + if (sequence != next_commit_ID) { brelse(bh); break; } - + /* OK, we have a valid descriptor block which matches * all of the sequence number checks. What are we going * to do with it? That depends on the pass... */ @@ -429,7 +425,7 @@ tag = (journal_block_tag_t *) tagp; flags = ntohl(tag->t_flags); - + io_block = next_log_block++; wrap(journal, next_log_block); err = jread(&obh, journal, io_block); @@ -443,7 +439,7 @@ err, io_block); } else { unsigned long blocknr; - + J_ASSERT(obh != NULL); blocknr = ntohl(tag->t_blocknr); @@ -457,7 +453,7 @@ ++info->nr_revoke_hits; goto skip_write; } - + /* Find a buffer for the new * data being restored */ nbh = __getblk(journal->j_fs_dev, @@ -491,7 +487,7 @@ brelse(obh); brelse(nbh); } - + skip_write: tagp += sizeof(journal_block_tag_t); if (!(flags & JFS_FLAG_SAME_UUID)) @@ -500,7 +496,7 @@ if (flags & JFS_FLAG_LAST_TAG) break; } - + brelse(bh); continue; @@ -541,7 +537,7 @@ * log. If the latter happened, then we know that the "current" * transaction marks the end of the valid log. */ - + if (pass == PASS_SCAN) info->end_transaction = next_commit_ID; else { @@ -574,11 +570,11 @@ header = (journal_revoke_header_t *) bh->b_data; offset = sizeof(journal_revoke_header_t); max = ntohl(header->r_count); - + while (offset < max) { unsigned long blocknr; int err; - + blocknr = ntohl(* ((unsigned int *) (bh->b_data+offset))); offset += 4; err = journal_set_revoke(journal, blocknr, sequence); diff -urN linux-2.5.72-bk3/fs/jbd/revoke.c linux-2.5.73/fs/jbd/revoke.c --- linux-2.5.72-bk3/fs/jbd/revoke.c 2003-06-22 12:03:29.000000000 -0700 +++ linux-2.5.73/fs/jbd/revoke.c 2003-06-22 12:04:16.000000000 -0700 @@ -81,7 +81,7 @@ { struct list_head hash; tid_t sequence; /* Used for recovery only */ - unsigned long blocknr; + unsigned long blocknr; }; @@ -110,7 +110,7 @@ { struct jbd_revoke_table_s *table = journal->j_revoke; int hash_shift = table->hash_shift; - + return ((block << (hash_shift - 6)) ^ (block >> 13) ^ (block << (hash_shift - 12))) & (table->hash_size - 1); @@ -149,7 +149,7 @@ { struct list_head *hash_list; struct jbd_revoke_record_s *record; - + hash_list = &journal->j_revoke->hash_table[hash(journal, blocknr)]; spin_lock(&journal->j_revoke_lock); @@ -161,7 +161,7 @@ } record = (struct jbd_revoke_record_s *) record->hash.next; } - spin_unlock(&journal->j_revoke_lock); + spin_unlock(&journal->j_revoke_lock); return NULL; } @@ -182,7 +182,7 @@ return -ENOMEM; } return 0; -} +} void journal_destroy_revoke_caches(void) { @@ -197,9 +197,9 @@ int journal_init_revoke(journal_t *journal, int hash_size) { int shift, tmp; - + J_ASSERT (journal->j_revoke_table[0] == NULL); - + shift = 0; tmp = hash_size; while((tmp >>= 1UL) != 0UL) @@ -209,7 +209,7 @@ if (!journal->j_revoke_table[0]) return -ENOMEM; journal->j_revoke = journal->j_revoke_table[0]; - + /* Check that the hash_size is a power of two */ J_ASSERT ((hash_size & (hash_size-1)) == 0); @@ -224,19 +224,19 @@ journal->j_revoke = NULL; return -ENOMEM; } - + for (tmp = 0; tmp < hash_size; tmp++) INIT_LIST_HEAD(&journal->j_revoke->hash_table[tmp]); - + journal->j_revoke_table[1] = kmem_cache_alloc(revoke_table_cache, GFP_KERNEL); if (!journal->j_revoke_table[1]) { kfree(journal->j_revoke_table[0]->hash_table); kmem_cache_free(revoke_table_cache, journal->j_revoke_table[0]); return -ENOMEM; } - + journal->j_revoke = journal->j_revoke_table[1]; - + /* Check that the hash_size is a power of two */ J_ASSERT ((hash_size & (hash_size-1)) == 0); @@ -253,7 +253,7 @@ journal->j_revoke = NULL; return -ENOMEM; } - + for (tmp = 0; tmp < hash_size; tmp++) INIT_LIST_HEAD(&journal->j_revoke->hash_table[tmp]); @@ -269,16 +269,16 @@ struct jbd_revoke_table_s *table; struct list_head *hash_list; int i; - + table = journal->j_revoke_table[0]; if (!table) return; - + for (i=0; ihash_size; i++) { hash_list = &table->hash_table[i]; J_ASSERT (list_empty(hash_list)); } - + kfree(table->hash_table); kmem_cache_free(revoke_table_cache, table); journal->j_revoke = NULL; @@ -286,12 +286,12 @@ table = journal->j_revoke_table[1]; if (!table) return; - + for (i=0; ihash_size; i++) { hash_list = &table->hash_table[i]; J_ASSERT (list_empty(hash_list)); } - + kfree(table->hash_table); kmem_cache_free(revoke_table_cache, table); journal->j_revoke = NULL; @@ -420,7 +420,7 @@ int need_cancel; int did_revoke = 0; /* akpm: debug */ struct buffer_head *bh = jh2bh(jh); - + jbd_debug(4, "journal_head %p, cancelling revoke\n", jh); /* Is the existing Revoke bit valid? If so, we trust it, and @@ -466,7 +466,6 @@ __brelse(bh2); } } - return did_revoke; } @@ -482,7 +481,7 @@ journal->j_revoke = journal->j_revoke_table[1]; else journal->j_revoke = journal->j_revoke_table[0]; - + for (i = 0; i < journal->j_revoke->hash_size; i++) INIT_LIST_HEAD(&journal->j_revoke->hash_table[i]); } @@ -506,11 +505,11 @@ descriptor = NULL; offset = 0; count = 0; - + /* select revoke table for committing transaction */ revoke = journal->j_revoke == journal->j_revoke_table[0] ? journal->j_revoke_table[1] : journal->j_revoke_table[0]; - + for (i = 0; i < revoke->hash_size; i++) { hash_list = &revoke->hash_table[i]; @@ -562,7 +561,7 @@ descriptor = NULL; } } - + if (!descriptor) { descriptor = journal_get_descriptor_buffer(journal); if (!descriptor) @@ -579,7 +578,7 @@ offset = sizeof(journal_revoke_header_t); *descriptorp = descriptor; } - + * ((unsigned int *)(&jh2bh(descriptor)->b_data[offset])) = htonl(record->blocknr); offset += 4; @@ -604,7 +603,7 @@ __brelse(jh2bh(descriptor)); return; } - + header = (journal_revoke_header_t *) jh2bh(descriptor)->b_data; header->r_count = htonl(offset); set_bit(BH_JWrite, &jh2bh(descriptor)->b_state); @@ -645,7 +644,7 @@ tid_t sequence) { struct jbd_revoke_record_s *record; - + record = find_revoke_record(journal, blocknr); if (record) { /* If we have multiple occurrences, only record the @@ -669,7 +668,7 @@ tid_t sequence) { struct jbd_revoke_record_s *record; - + record = find_revoke_record(journal, blocknr); if (!record) return 0; @@ -689,9 +688,9 @@ struct list_head *hash_list; struct jbd_revoke_record_s *record; struct jbd_revoke_table_s *revoke; - + revoke = journal->j_revoke; - + for (i = 0; i < revoke->hash_size; i++) { hash_list = &revoke->hash_table[i]; while (!list_empty(hash_list)) { @@ -701,4 +700,3 @@ } } } - diff -urN linux-2.5.72-bk3/fs/jbd/transaction.c linux-2.5.73/fs/jbd/transaction.c --- linux-2.5.72-bk3/fs/jbd/transaction.c 2003-06-22 12:03:30.000000000 -0700 +++ linux-2.5.73/fs/jbd/transaction.c 2003-06-22 12:04:16.000000000 -0700 @@ -57,7 +57,7 @@ /* Set up the commit timer for the new transaction. */ journal->j_commit_timer->expires = transaction->t_expires; add_timer(journal->j_commit_timer); - + J_ASSERT(journal->j_running_transaction == NULL); journal->j_running_transaction = transaction; @@ -130,7 +130,7 @@ journal->j_barrier_count == 0); goto repeat; } - + if (!journal->j_running_transaction) { if (!new_transaction) { spin_unlock(&journal->j_state_lock); @@ -153,7 +153,7 @@ transaction->t_state != T_LOCKED); goto repeat; } - + /* * If there is not enough space left in the log to write all potential * buffers requested by this operation, we need to stall pending a log @@ -210,7 +210,7 @@ if (journal->j_committing_transaction) needed += journal->j_committing_transaction-> t_outstanding_credits; - + if (__log_space_left(journal) < needed) { jbd_debug(2, "Handle %p waiting for checkpoint...\n", handle); spin_unlock(&transaction->t_handle_lock); @@ -268,7 +268,7 @@ { handle_t *handle = journal_current_handle(); int err; - + if (!journal) return ERR_PTR(-EROFS); @@ -337,7 +337,7 @@ spin_lock(&transaction->t_handle_lock); wanted = transaction->t_outstanding_credits + nblocks; - + if (wanted > journal->j_max_transaction_buffers) { jbd_debug(3, "denied handle %p %d blocks: " "transaction too large\n", handle, nblocks); @@ -349,7 +349,7 @@ "insufficient log space\n", handle, nblocks); goto unlock; } - + handle->h_buffer_credits += nblocks; transaction->t_outstanding_credits += nblocks; result = 0; @@ -388,7 +388,7 @@ * actually doing the restart! */ if (is_handle_aborted(handle)) return 0; - + /* * First unlink the handle from its current transaction, and start the * commit on that. @@ -496,7 +496,7 @@ { struct buffer_head *bh = jh2bh(jh); int jlist; - + if (buffer_dirty(bh)) { /* If this buffer is one which might reasonably be dirty * --- ie. data, or not part of this journal --- then @@ -504,7 +504,7 @@ * move the dirty bit to the journal's own internal * JBDDirty bit. */ jlist = jh->b_jlist; - + if (jlist == BJ_Metadata || jlist == BJ_Reserved || jlist == BJ_Shadow || jlist == BJ_Forget) { if (test_clear_buffer_dirty(jh2bh(jh))) { @@ -609,7 +609,7 @@ (*credits)++; goto done_locked; } - + /* Is there data here we need to preserve? */ if (jh->b_transaction && jh->b_transaction != transaction) { @@ -638,7 +638,7 @@ wait_event(*wqh, (jh->b_jlist != BJ_Shadow)); goto repeat; } - + /* Only do the copy if the currently-owning transaction * still needs it. If it is on the Forget list, the * committing transaction is past that stage. The @@ -697,7 +697,7 @@ JBUFFER_TRACE(jh, "file as BJ_Reserved"); __journal_file_buffer(jh, transaction, BJ_Reserved); } - + done_locked: spin_unlock(&journal->j_list_lock); if (need_copy) { @@ -778,13 +778,13 @@ journal_t *journal = transaction->t_journal; struct journal_head *jh = journal_add_journal_head(bh); int err; - + jbd_debug(5, "journal_head %p\n", jh); err = -EROFS; if (is_handle_aborted(handle)) goto out; err = 0; - + JBUFFER_TRACE(jh, "entry"); /* * The buffer may already belong to this transaction due to pre-zeroing @@ -932,7 +932,7 @@ if (is_handle_aborted(handle)) return 0; - + jh = journal_add_journal_head(bh); JBUFFER_TRACE(jh, "entry"); @@ -1098,7 +1098,7 @@ JBUFFER_TRACE(jh, "entry"); if (is_handle_aborted(handle)) goto out; - + jbd_lock_bh_state(bh); /* @@ -1130,7 +1130,7 @@ set_buffer_jbddirty(bh); J_ASSERT_JH(jh, jh->b_transaction != NULL); - + /* * Metadata already on the current transaction list doesn't * need to be filed. Metadata on another transaction's list must @@ -1272,7 +1272,6 @@ return; } } - } else if (jh->b_transaction) { J_ASSERT_JH(jh, (jh->b_transaction == journal->j_committing_transaction)); @@ -1346,18 +1345,18 @@ transaction_t *transaction = handle->h_transaction; journal_t *journal = transaction->t_journal; int old_handle_count, err; - + if (!handle) return 0; J_ASSERT(transaction->t_updates > 0); J_ASSERT(journal_current_handle() == handle); - + if (is_handle_aborted(handle)) err = -EIO; else err = 0; - + if (--handle->h_ref > 0) { jbd_debug(4, "h_ref %d -> %d\n", handle->h_ref + 1, handle->h_ref); @@ -1413,7 +1412,7 @@ * completes the commit thread, it just doesn't write * anything to disk. */ tid_t tid = transaction->t_tid; - + spin_unlock(&transaction->t_handle_lock); jbd_debug(2, "transaction too old, requesting commit for " "handle %p\n", handle); @@ -1563,7 +1562,7 @@ list = &transaction->t_reserved_list; break; } - + __blist_del_buffer(list, jh); jh->b_jlist = BJ_None; if (test_clear_buffer_jbddirty(bh)) @@ -1811,7 +1810,7 @@ JBUFFER_TRACE(jh, "not on any transaction: zap"); goto zap_buffer; } - + if (!buffer_dirty(bh)) { /* bdflush has written it. We can drop it now */ goto zap_buffer; @@ -1910,7 +1909,7 @@ struct buffer_head *head, *bh, *next; unsigned int curr_off = 0; int may_free = 1; - + if (!PageLocked(page)) BUG(); if (!page_has_buffers(page)) @@ -1967,7 +1966,7 @@ if (jh->b_transaction && jh->b_jlist == jlist) return; - + /* The following list of buffer states needs to be consistent * with __jbd_unexpected_dirty_buffer()'s handling of dirty * state. */ @@ -2055,7 +2054,7 @@ jh->b_transaction = NULL; return; } - + /* * It has been modified by a later transaction: add it to the new * transaction's metadata list. diff -urN linux-2.5.72-bk3/fs/jfs/super.c linux-2.5.73/fs/jfs/super.c --- linux-2.5.72-bk3/fs/jfs/super.c 2003-06-16 21:20:00.000000000 -0700 +++ linux-2.5.73/fs/jfs/super.c 2003-06-22 12:04:16.000000000 -0700 @@ -117,7 +117,7 @@ kmem_cache_free(jfs_inode_cachep, ji); } -static int jfs_statfs(struct super_block *sb, struct statfs *buf) +static int jfs_statfs(struct super_block *sb, struct kstatfs *buf) { struct jfs_sb_info *sbi = JFS_SBI(sb); s64 maxinodes; diff -urN linux-2.5.72-bk3/fs/libfs.c linux-2.5.73/fs/libfs.c --- linux-2.5.72-bk3/fs/libfs.c 2003-06-16 21:19:39.000000000 -0700 +++ linux-2.5.73/fs/libfs.c 2003-06-22 12:04:16.000000000 -0700 @@ -16,7 +16,7 @@ return 0; } -int simple_statfs(struct super_block *sb, struct statfs *buf) +int simple_statfs(struct super_block *sb, struct kstatfs *buf) { buf->f_type = sb->s_magic; buf->f_bsize = PAGE_CACHE_SIZE; diff -urN linux-2.5.72-bk3/fs/lockd/svc.c linux-2.5.73/fs/lockd/svc.c --- linux-2.5.72-bk3/fs/lockd/svc.c 2003-06-16 21:20:06.000000000 -0700 +++ linux-2.5.73/fs/lockd/svc.c 2003-06-22 12:04:16.000000000 -0700 @@ -34,6 +34,7 @@ #include #include #include +#include #define NLMDBG_FACILITY NLMDBG_SVC #define LOCKD_BUFSIZE (1024 + NLMSVC_XDRSIZE) @@ -118,9 +119,11 @@ * NFS mount or NFS daemon has gone away, and we've been sent a * signal, or else another process has taken over our job. */ - while ((nlmsvc_users || !signalled()) && nlmsvc_pid == current->pid) - { + while ((nlmsvc_users || !signalled()) && nlmsvc_pid == current->pid) { long timeout = MAX_SCHEDULE_TIMEOUT; + + if (current->flags & PF_FREEZE) + refrigerator(PF_IOTHREAD); if (signalled()) { flush_signals(current); if (nlmsvc_ops) { diff -urN linux-2.5.72-bk3/fs/minix/inode.c linux-2.5.73/fs/minix/inode.c --- linux-2.5.72-bk3/fs/minix/inode.c 2003-06-16 21:20:02.000000000 -0700 +++ linux-2.5.73/fs/minix/inode.c 2003-06-22 12:04:16.000000000 -0700 @@ -19,7 +19,7 @@ static void minix_read_inode(struct inode * inode); static void minix_write_inode(struct inode * inode, int wait); -static int minix_statfs(struct super_block *sb, struct statfs *buf); +static int minix_statfs(struct super_block *sb, struct kstatfs *buf); static int minix_remount (struct super_block * sb, int * flags, char * data); static void minix_delete_inode(struct inode *inode) @@ -294,7 +294,7 @@ return -EINVAL; } -static int minix_statfs(struct super_block *sb, struct statfs *buf) +static int minix_statfs(struct super_block *sb, struct kstatfs *buf) { struct minix_sb_info *sbi = minix_sb(sb); buf->f_type = sb->s_magic; diff -urN linux-2.5.72-bk3/fs/ncpfs/inode.c linux-2.5.73/fs/ncpfs/inode.c --- linux-2.5.72-bk3/fs/ncpfs/inode.c 2003-06-16 21:20:01.000000000 -0700 +++ linux-2.5.73/fs/ncpfs/inode.c 2003-06-22 12:04:16.000000000 -0700 @@ -39,7 +39,7 @@ static void ncp_delete_inode(struct inode *); static void ncp_put_super(struct super_block *); -static int ncp_statfs(struct super_block *, struct statfs *); +static int ncp_statfs(struct super_block *, struct kstatfs *); static kmem_cache_t * ncp_inode_cachep; @@ -717,7 +717,7 @@ kfree(server); } -static int ncp_statfs(struct super_block *sb, struct statfs *buf) +static int ncp_statfs(struct super_block *sb, struct kstatfs *buf) { struct dentry* d; struct inode* i; diff -urN linux-2.5.72-bk3/fs/ncpfs/sock.c linux-2.5.73/fs/ncpfs/sock.c --- linux-2.5.72-bk3/fs/ncpfs/sock.c 2003-06-16 21:19:59.000000000 -0700 +++ linux-2.5.73/fs/ncpfs/sock.c 2003-06-22 12:04:16.000000000 -0700 @@ -521,7 +521,7 @@ return result; } if (result > len) { - printk(KERN_ERR "ncpfs: tcp: bug in recvmsg (%u > %u)\n", result, len); + printk(KERN_ERR "ncpfs: tcp: bug in recvmsg (%u > %Zu)\n", result, len); return -EIO; } return result; @@ -614,7 +614,7 @@ goto skipdata2; } if (datalen > req->datalen + 8) { - printk(KERN_ERR "ncpfs: tcp: Unexpected reply len %d (expected at most %d)\n", datalen, req->datalen + 8); + printk(KERN_ERR "ncpfs: tcp: Unexpected reply len %d (expected at most %Zd)\n", datalen, req->datalen + 8); server->rcv.state = 3; goto skipdata; } diff -urN linux-2.5.72-bk3/fs/nfs/inode.c linux-2.5.73/fs/nfs/inode.c --- linux-2.5.72-bk3/fs/nfs/inode.c 2003-06-22 12:03:30.000000000 -0700 +++ linux-2.5.73/fs/nfs/inode.c 2003-06-22 12:04:17.000000000 -0700 @@ -53,7 +53,7 @@ static void nfs_put_super(struct super_block *); static void nfs_clear_inode(struct inode *); static void nfs_umount_begin(struct super_block *); -static int nfs_statfs(struct super_block *, struct statfs *); +static int nfs_statfs(struct super_block *, struct kstatfs *); static int nfs_show_options(struct seq_file *, struct vfsmount *); static struct super_operations nfs_sops = { @@ -474,7 +474,7 @@ } static int -nfs_statfs(struct super_block *sb, struct statfs *buf) +nfs_statfs(struct super_block *sb, struct kstatfs *buf) { struct nfs_server *server = NFS_SB(sb); unsigned char blockbits; diff -urN linux-2.5.72-bk3/fs/nfsd/nfs3xdr.c linux-2.5.73/fs/nfsd/nfs3xdr.c --- linux-2.5.72-bk3/fs/nfsd/nfs3xdr.c 2003-06-16 21:19:37.000000000 -0700 +++ linux-2.5.73/fs/nfsd/nfs3xdr.c 2003-06-22 12:04:17.000000000 -0700 @@ -866,7 +866,7 @@ nfs3svc_encode_fsstatres(struct svc_rqst *rqstp, u32 *p, struct nfsd3_fsstatres *resp) { - struct statfs *s = &resp->stats; + struct kstatfs *s = &resp->stats; u64 bs = s->f_bsize; *p++ = xdr_zero; /* no post_op_attr */ diff -urN linux-2.5.72-bk3/fs/nfsd/nfs4xdr.c linux-2.5.73/fs/nfsd/nfs4xdr.c --- linux-2.5.72-bk3/fs/nfsd/nfs4xdr.c 2003-06-22 12:03:30.000000000 -0700 +++ linux-2.5.73/fs/nfsd/nfs4xdr.c 2003-06-22 12:04:17.000000000 -0700 @@ -1081,7 +1081,7 @@ struct name_ent *owner = NULL; struct name_ent *group = NULL; struct svc_fh tempfh; - struct statfs statfs; + struct kstatfs statfs; int buflen = *countp << 2; u32 *attrlenp; u32 dummy; diff -urN linux-2.5.72-bk3/fs/nfsd/nfsxdr.c linux-2.5.73/fs/nfsd/nfsxdr.c --- linux-2.5.72-bk3/fs/nfsd/nfsxdr.c 2003-06-16 21:19:39.000000000 -0700 +++ linux-2.5.73/fs/nfsd/nfsxdr.c 2003-06-22 12:04:17.000000000 -0700 @@ -441,7 +441,7 @@ nfssvc_encode_statfsres(struct svc_rqst *rqstp, u32 *p, struct nfsd_statfsres *resp) { - struct statfs *stat = &resp->stats; + struct kstatfs *stat = &resp->stats; *p++ = htonl(NFSSVC_MAXBLKSIZE); /* max transfer size */ *p++ = htonl(stat->f_bsize); diff -urN linux-2.5.72-bk3/fs/nfsd/vfs.c linux-2.5.73/fs/nfsd/vfs.c --- linux-2.5.72-bk3/fs/nfsd/vfs.c 2003-06-22 12:03:30.000000000 -0700 +++ linux-2.5.73/fs/nfsd/vfs.c 2003-06-22 12:04:17.000000000 -0700 @@ -1505,7 +1505,7 @@ * N.B. After this call fhp needs an fh_put */ int -nfsd_statfs(struct svc_rqst *rqstp, struct svc_fh *fhp, struct statfs *stat) +nfsd_statfs(struct svc_rqst *rqstp, struct svc_fh *fhp, struct kstatfs *stat) { int err = fh_verify(rqstp, fhp, 0, MAY_NOP); if (!err && vfs_statfs(fhp->fh_dentry->d_inode->i_sb,stat)) diff -urN linux-2.5.72-bk3/fs/ntfs/super.c linux-2.5.73/fs/ntfs/super.c --- linux-2.5.72-bk3/fs/ntfs/super.c 2003-06-16 21:20:07.000000000 -0700 +++ linux-2.5.73/fs/ntfs/super.c 2003-06-22 12:04:17.000000000 -0700 @@ -1251,7 +1251,7 @@ * * Return 0 on success or -errno on error. */ -static int ntfs_statfs(struct super_block *sb, struct statfs *sfs) +static int ntfs_statfs(struct super_block *sb, struct kstatfs *sfs) { ntfs_volume *vol = NTFS_SB(sb); s64 size; diff -urN linux-2.5.72-bk3/fs/open.c linux-2.5.73/fs/open.c --- linux-2.5.72-bk3/fs/open.c 2003-06-16 21:19:40.000000000 -0700 +++ linux-2.5.73/fs/open.c 2003-06-22 12:04:17.000000000 -0700 @@ -23,23 +23,85 @@ #define special_file(m) (S_ISCHR(m)||S_ISBLK(m)||S_ISFIFO(m)||S_ISSOCK(m)) -int vfs_statfs(struct super_block *sb, struct statfs *buf) +int vfs_statfs(struct super_block *sb, struct kstatfs *buf) { int retval = -ENODEV; if (sb) { retval = -ENOSYS; if (sb->s_op->statfs) { - memset(buf, 0, sizeof(struct statfs)); + memset(buf, 0, sizeof(*buf)); retval = security_sb_statfs(sb); if (retval) return retval; retval = sb->s_op->statfs(sb, buf); + if (retval == 0 && buf->f_frsize == 0) + buf->f_frsize = buf->f_bsize; } } return retval; } +static int vfs_statfs_native(struct super_block *sb, struct statfs *buf) +{ + struct kstatfs st; + int retval; + + retval = vfs_statfs(sb, &st); + if (retval) + return retval; + + if (sizeof(*buf) == sizeof(st)) + memcpy(buf, &st, sizeof(st)); + else { + if (sizeof buf->f_blocks == 4) { + if ((st.f_blocks | st.f_bfree | + st.f_bavail | st.f_files | st.f_ffree) & + 0xffffffff00000000ULL) + return -EOVERFLOW; + } + + buf->f_type = st.f_type; + buf->f_bsize = st.f_bsize; + buf->f_blocks = st.f_blocks; + buf->f_bfree = st.f_bfree; + buf->f_bavail = st.f_bavail; + buf->f_files = st.f_files; + buf->f_ffree = st.f_ffree; + buf->f_fsid = st.f_fsid; + buf->f_namelen = st.f_namelen; + buf->f_frsize = st.f_frsize; + memset(buf->f_spare, 0, sizeof(buf->f_spare)); + } + return 0; +} + +static int vfs_statfs64(struct super_block *sb, struct statfs64 *buf) +{ + struct kstatfs st; + int retval; + + retval = vfs_statfs(sb, &st); + if (retval) + return retval; + + if (sizeof(*buf) == sizeof(st)) + memcpy(buf, &st, sizeof(st)); + else { + buf->f_type = st.f_type; + buf->f_bsize = st.f_bsize; + buf->f_blocks = st.f_blocks; + buf->f_bfree = st.f_bfree; + buf->f_bavail = st.f_bavail; + buf->f_files = st.f_files; + buf->f_ffree = st.f_ffree; + buf->f_fsid = st.f_fsid; + buf->f_namelen = st.f_namelen; + buf->f_frsize = st.f_frsize; + memset(buf->f_spare, 0, sizeof(buf->f_spare)); + } + return 0; +} asmlinkage long sys_statfs(const char __user * path, struct statfs __user * buf) { @@ -49,14 +111,34 @@ error = user_path_walk(path, &nd); if (!error) { struct statfs tmp; - error = vfs_statfs(nd.dentry->d_inode->i_sb, &tmp); - if (!error && copy_to_user(buf, &tmp, sizeof(struct statfs))) + error = vfs_statfs_native(nd.dentry->d_inode->i_sb, &tmp); + if (!error && copy_to_user(buf, &tmp, sizeof(tmp))) error = -EFAULT; path_release(&nd); } return error; } + +asmlinkage long sys_statfs64(const char __user *path, size_t sz, struct statfs64 __user *buf) +{ + struct nameidata nd; + long error; + + if (sz != sizeof(*buf)) + return -EINVAL; + error = user_path_walk(path, &nd); + if (!error) { + struct statfs64 tmp; + error = vfs_statfs64(nd.dentry->d_inode->i_sb, &tmp); + if (!error && copy_to_user(buf, &tmp, sizeof(tmp))) + error = -EFAULT; + path_release(&nd); + } + return error; +} + + asmlinkage long sys_fstatfs(unsigned int fd, struct statfs __user * buf) { struct file * file; @@ -67,8 +149,29 @@ file = fget(fd); if (!file) goto out; - error = vfs_statfs(file->f_dentry->d_inode->i_sb, &tmp); - if (!error && copy_to_user(buf, &tmp, sizeof(struct statfs))) + error = vfs_statfs_native(file->f_dentry->d_inode->i_sb, &tmp); + if (!error && copy_to_user(buf, &tmp, sizeof(tmp))) + error = -EFAULT; + fput(file); +out: + return error; +} + +asmlinkage long sys_fstatfs64(unsigned int fd, size_t sz, struct statfs64 __user *buf) +{ + struct file * file; + struct statfs64 tmp; + int error; + + if (sz != sizeof(*buf)) + return -EINVAL; + + error = -EBADF; + file = fget(fd); + if (!file) + goto out; + error = vfs_statfs64(file->f_dentry->d_inode->i_sb, &tmp); + if (!error && copy_to_user(buf, &tmp, sizeof(tmp))) error = -EFAULT; fput(file); out: diff -urN linux-2.5.72-bk3/fs/partitions/Kconfig linux-2.5.73/fs/partitions/Kconfig --- linux-2.5.72-bk3/fs/partitions/Kconfig 2003-06-16 21:20:22.000000000 -0700 +++ linux-2.5.73/fs/partitions/Kconfig 2003-06-22 12:04:17.000000000 -0700 @@ -20,7 +20,17 @@ help Support hard disks partitioned under Acorn operating systems. -# bool ' Cumana partition support' CONFIG_ACORN_PARTITION_CUMANA +config ACORN_PARTITION_CUMANA + bool "Cumana partition support" if PARTITION_ADVANCED && ACORN_PARTITION + default y if !PARTITION_ADVANCED && ARCH_ACORN + help + Say Y here if you would like to use hard disks under Linux which + were partitioned using the Cumana interface on Acorn machines. + +config ACORN_PARTITION_EESOX + bool "EESOX partition support" if PARTITION_ADVANCED && ACORN_PARTITION + default y if !PARTITION_ADVANCED && ARCH_ACORN + config ACORN_PARTITION_ICS bool "ICS partition support" if PARTITION_ADVANCED && ACORN_PARTITION default y if !PARTITION_ADVANCED && ARCH_ACORN diff -urN linux-2.5.72-bk3/fs/partitions/acorn.c linux-2.5.73/fs/partitions/acorn.c --- linux-2.5.72-bk3/fs/partitions/acorn.c 2003-06-16 21:20:06.000000000 -0700 +++ linux-2.5.73/fs/partitions/acorn.c 2003-06-22 12:04:17.000000000 -0700 @@ -7,14 +7,25 @@ * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. * - * Scan ADFS partitions on hard disk drives. + * Scan ADFS partitions on hard disk drives. Unfortunately, there + * isn't a standard for partitioning drives on Acorn machines, so + * every single manufacturer of SCSI and IDE cards created their own + * method. */ #include #include +#include #include "check.h" #include "acorn.h" +/* + * Partition types. (Oh for reusability) + */ +#define PARTITION_RISCIX_MFM 1 +#define PARTITION_RISCIX_SCSI 2 +#define PARTITION_LINUX 9 + static struct adfs_discrecord * adfs_partition(struct parsed_partitions *state, char *name, char *data, unsigned long first_sector, int slot) @@ -40,6 +51,21 @@ } #ifdef CONFIG_ACORN_PARTITION_RISCIX + +struct riscix_part { + __u32 start; + __u32 length; + __u32 one; + char name[16]; +}; + +struct riscix_record { + __u32 magic; +#define RISCIX_MAGIC (0x4a657320) + __u32 date; + struct riscix_part part[8]; +}; + static int riscix_partition(struct parsed_partitions *state, struct block_device *bdev, unsigned long first_sect, int slot, unsigned long nr_sects) @@ -81,6 +107,15 @@ } #endif +#define LINUX_NATIVE_MAGIC 0xdeafa1de +#define LINUX_SWAP_MAGIC 0xdeafab1e + +struct linux_part { + __u32 magic; + __u32 start_sect; + __u32 nr_sects; +}; + static int linux_partition(struct parsed_partitions *state, struct block_device *bdev, unsigned long first_sect, int slot, unsigned long nr_sects) @@ -114,7 +149,7 @@ } #ifdef CONFIG_ACORN_PARTITION_CUMANA -static int +int adfspart_check_CUMANA(struct parsed_partitions *state, struct block_device *bdev) { unsigned long first_sector = 0; @@ -126,7 +161,7 @@ int slot = 1; /* - * Try Cumana style partitions - sector 3 contains ADFS boot block + * Try Cumana style partitions - sector 6 contains ADFS boot block * with pointer to next 'drive'. * * There are unknowns in this code - is the 'cylinder number' of the @@ -206,7 +241,7 @@ * hda1 = ADFS partition on first drive. * hda2 = non-ADFS partition. */ -static int +int adfspart_check_ADFS(struct parsed_partitions *state, struct block_device *bdev) { unsigned long start_sect, nr_sects, sectscyl, heads; @@ -263,11 +298,18 @@ break; } } + printk("\n"); return 1; } #endif #ifdef CONFIG_ACORN_PARTITION_ICS + +struct ics_part { + __u32 start; + __s32 size; +}; + static int adfspart_check_ICSLinux(struct block_device *bdev, unsigned long block) { Sector sect; @@ -284,6 +326,22 @@ } /* + * Check for a valid ICS partition using the checksum. + */ +static inline int valid_ics_sector(const unsigned char *data) +{ + unsigned long sum; + int i; + + for (i = 0, sum = 0x50617274; i < 508; i++) + sum += data[i]; + + sum -= le32_to_cpu(*(__u32 *)(&data[508])); + + return sum == 0; +} + +/* * Purpose: allocate ICS partitions. * Params : hd - pointer to gendisk structure to store partition info. * dev - device number to access. @@ -293,15 +351,13 @@ * hda2 = ADFS partition 1 on first drive. * ..etc.. */ -static int +int adfspart_check_ICS(struct parsed_partitions *state, struct block_device *bdev) { - Sector sect; - unsigned char *data; - unsigned long sum; - unsigned int i; + const unsigned char *data; + const struct ics_part *p; int slot; - struct ics_part *p; + Sector sect; /* * Try ICS style partitions - sector 0 contains partition info. @@ -310,33 +366,33 @@ if (!data) return -1; - /* - * check for a valid checksum - */ - for (i = 0, sum = 0x50617274; i < 508; i++) - sum += data[i]; - - sum -= le32_to_cpu(*(__u32 *)(&data[508])); - if (sum) { + if (!valid_ics_sector(data)) { put_dev_sector(sect); - return 0; /* not ICS partition table */ + return 0; } printk(" [ICS]"); - for (slot = 1, p = (struct ics_part *)data; p->size; p++) { + for (slot = 1, p = (const struct ics_part *)data; p->size; p++) { u32 start = le32_to_cpu(p->start); - u32 size = le32_to_cpu(p->size); + s32 size = le32_to_cpu(p->size); /* yes, it's signed. */ if (slot == state->limit) break; + /* + * Negative sizes tell the RISC OS ICS driver to ignore + * this partition - in effect it says that this does not + * contain an ADFS filesystem. + */ if (size < 0) { size = -size; /* - * We use the first sector to identify what type - * this partition is... + * Our own extension - We use the first sector + * of the partition to identify what type this + * partition is. We must not make this visible + * to the filesystem. */ if (size > 1 && adfspart_check_ICSLinux(bdev, start)) { start += 1; @@ -349,10 +405,39 @@ } put_dev_sector(sect); + printk("\n"); return 1; } #endif +#ifdef CONFIG_ACORN_PARTITION_POWERTEC +struct ptec_part { + __u32 unused1; + __u32 unused2; + __u32 start; + __u32 size; + __u32 unused5; + char type[8]; +}; + +static inline int valid_ptec_sector(const unsigned char *data) +{ + unsigned char checksum = 0x2a; + int i; + + /* + * If it looks like a PC/BIOS partition, then it + * probably isn't PowerTec. + */ + if (data[510] == 0x55 && data[511] == 0xaa) + return 0; + + for (i = 0; i < 511; i++) + checksum += data[i]; + + return checksum == data[511]; +} + /* * Purpose: allocate ICS partitions. * Params : hd - pointer to gendisk structure to store partition info. @@ -363,14 +448,12 @@ * hda2 = ADFS partition 1 on first drive. * ..etc.. */ -#ifdef CONFIG_ACORN_PARTITION_POWERTEC -static int +int adfspart_check_POWERTEC(struct parsed_partitions *state, struct block_device *bdev) { Sector sect; - unsigned char *data; - struct ptec_partition *p; - unsigned char checksum; + const unsigned char *data; + const struct ptec_part *p; int slot = 1; int i; @@ -378,17 +461,14 @@ if (!data) return -1; - for (checksum = 0x2a, i = 0; i < 511; i++) - checksum += data[i]; - - if (checksum != data[511]) { + if (!valid_ptec_sector(data)) { put_dev_sector(sect); return 0; } printk(" [POWERTEC]"); - for (i = 0, p = (struct ptec_partition *)data; i < 12; i++, p++) { + for (i = 0, p = (const struct ptec_part *)data; i < 12; i++, p++) { u32 start = le32_to_cpu(p->start); u32 size = le32_to_cpu(p->size); @@ -397,46 +477,81 @@ } put_dev_sector(sect); + printk("\n"); return 1; } #endif -static int (*partfn[])(struct parsed_partitions *, struct block_device *) = { -#ifdef CONFIG_ACORN_PARTITION_ICS - adfspart_check_ICS, -#endif -#ifdef CONFIG_ACORN_PARTITION_POWERTEC - adfspart_check_POWERTEC, -#endif -#ifdef CONFIG_ACORN_PARTITION_CUMANA - adfspart_check_CUMANA, -#endif -#ifdef CONFIG_ACORN_PARTITION_ADFS - adfspart_check_ADFS, -#endif - NULL +#ifdef CONFIG_ACORN_PARTITION_EESOX +struct eesox_part { + char magic[6]; + char name[10]; + u32 start; + u32 unused6; + u32 unused7; + u32 unused8; +}; + +/* + * Guess who created this format? + */ +static const char eesox_name[] = { + 'N', 'e', 'i', 'l', ' ', + 'C', 'r', 'i', 't', 'c', 'h', 'e', 'l', 'l', ' ', ' ' }; + /* - * Purpose: initialise all the partitions on an ADFS drive. - * These may be other ADFS partitions or a Linux/RiscBSD/RISCiX - * partition. + * EESOX SCSI partition format. * - * Params : hd - pointer to gendisk structure - * dev - device number to access + * This is a goddamned awful partition format. We don't seem to store + * the size of the partition in this table, only the start addresses. * - * Returns: -1 on error, 0 if not ADFS format, 1 if ok. + * There are two possibilities where the size comes from: + * 1. The individual ADFS boot block entries that are placed on the disk. + * 2. The start address of the next entry. */ -int acorn_partition(struct parsed_partitions *state, struct block_device *bdev) +int +adfspart_check_EESOX(struct parsed_partitions *state, struct block_device *bdev) { - int i; + Sector sect; + const unsigned char *data; + unsigned char buffer[256]; + struct eesox_part *p; + u32 start = 0; + int i, slot = 1; - for (i = 0; partfn[i]; i++) { - int r = partfn[i](state, bdev); - if (r) { - if (r > 0) - printk("\n"); - return r; - } + data = read_dev_sector(bdev, 7, §); + if (!data) + return -1; + + /* + * "Decrypt" the partition table. God knows why... + */ + for (i = 0; i < 256; i++) + buffer[i] = data[i] ^ eesox_name[i & 15]; + + put_dev_sector(sect); + + for (i = 0, p = (struct eesox_part *)buffer; i < 8; i++, p++) { + u32 next; + + if (memcmp(p->magic, "Eesox", 6)) + break; + + next = le32_to_cpu(p->start) + first_sector; + if (i) + put_partition(state, slot++, start, next - start); + start = next; } - return 0; + + if (i != 0) { + unsigned long size; + + size = hd->part[minor(to_kdev_t(bdev->bd_dev))].nr_sects; + add_gd_partition(hd, minor++, start, size - start); + printk("\n"); + } + + return i ? 1 : 0; } +#endif diff -urN linux-2.5.72-bk3/fs/partitions/acorn.h linux-2.5.73/fs/partitions/acorn.h --- linux-2.5.72-bk3/fs/partitions/acorn.h 2003-06-16 21:20:06.000000000 -0700 +++ linux-2.5.73/fs/partitions/acorn.h 2003-06-22 12:04:17.000000000 -0700 @@ -1,53 +1,14 @@ /* - * fs/partitions/acorn.h + * linux/fs/partitions/acorn.h * - * Copyright (C) 1996-1998 Russell King - */ -#include - -/* - * Partition types. (Oh for reusability) + * Copyright (C) 1996-2001 Russell King. + * + * I _hate_ this partitioning mess - why can't we have one defined + * format, and everyone stick to it? */ -#define PARTITION_RISCIX_MFM 1 -#define PARTITION_RISCIX_SCSI 2 -#define PARTITION_LINUX 9 - -struct riscix_part { - __u32 start; - __u32 length; - __u32 one; - char name[16]; -}; - -struct riscix_record { - __u32 magic; -#define RISCIX_MAGIC (0x4a657320) - __u32 date; - struct riscix_part part[8]; -}; - -#define LINUX_NATIVE_MAGIC 0xdeafa1de -#define LINUX_SWAP_MAGIC 0xdeafab1e - -struct linux_part { - __u32 magic; - __u32 start_sect; - __u32 nr_sects; -}; - -struct ics_part { - __u32 start; - __s32 size; -}; - -struct ptec_partition { - __u32 unused1; - __u32 unused2; - __u32 start; - __u32 size; - __u32 unused5; - char type[8]; -}; - -int acorn_partition(struct parsed_partitions *state, struct block_device *bdev); +int adfspart_check_CUMANA(struct parsed_partitions *state, struct block_device *bdev); +int adfspart_check_ADFS(struct parsed_partitions *state, struct block_device *bdev); +int adfspart_check_ICS(struct parsed_partitions *state, struct block_device *bdev); +int adfspart_check_POWERTEC(struct parsed_partitions *state, struct block_device *bdev); +int adfspart_check_EESOX(struct parsed_partitions *state, struct block_device *bdev); diff -urN linux-2.5.72-bk3/fs/partitions/check.c linux-2.5.73/fs/partitions/check.c --- linux-2.5.72-bk3/fs/partitions/check.c 2003-06-16 21:20:22.000000000 -0700 +++ linux-2.5.73/fs/partitions/check.c 2003-06-22 12:04:17.000000000 -0700 @@ -45,9 +45,33 @@ int warn_no_part = 1; /*This is ugly: should make genhd removable media aware*/ static int (*check_part[])(struct parsed_partitions *, struct block_device *) = { -#ifdef CONFIG_ACORN_PARTITION - acorn_partition, + /* + * Probe partition formats with tables at disk address 0 + * that also have an ADFS boot block at 0xdc0. + */ +#ifdef CONFIG_ACORN_PARTITION_ICS + adfspart_check_ICS, +#endif +#ifdef CONFIG_ACORN_PARTITION_POWERTEC + adfspart_check_POWERTEC, +#endif +#ifdef CONFIG_ACORN_PARTITION_EESOX + adfspart_check_EESOX, +#endif + + /* + * Now move on to formats that only have partition info at + * disk address 0xdc0. Since these may also have stale + * PC/BIOS partition tables, they need to come before + * the msdos entry. + */ +#ifdef CONFIG_ACORN_PARTITION_CUMANA + adfspart_check_CUMANA, #endif +#ifdef CONFIG_ACORN_PARTITION_ADFS + adfspart_check_ADFS, +#endif + #ifdef CONFIG_EFI_PARTITION efi_partition, /* this must come before msdos */ #endif diff -urN linux-2.5.72-bk3/fs/proc/base.c linux-2.5.73/fs/proc/base.c --- linux-2.5.72-bk3/fs/proc/base.c 2003-06-16 21:20:06.000000000 -0700 +++ linux-2.5.73/fs/proc/base.c 2003-06-22 12:04:17.000000000 -0700 @@ -1362,10 +1362,11 @@ inode = proc_pid_make_inode(dir->i_sb, task, PROC_PID_INO); - put_task_struct(task); - if (!inode) + if (!inode) { + put_task_struct(task); goto out; + } inode->i_mode = S_IFDIR|S_IRUGO|S_IXUGO; inode->i_op = &proc_base_inode_operations; inode->i_fop = &proc_base_operations; @@ -1379,6 +1380,7 @@ d_add(dentry, inode); spin_unlock(&task->proc_lock); + put_task_struct(task); return NULL; out: return ERR_PTR(-ENOENT); diff -urN linux-2.5.72-bk3/fs/proc/kcore.c linux-2.5.73/fs/proc/kcore.c --- linux-2.5.72-bk3/fs/proc/kcore.c 2003-06-16 21:20:02.000000000 -0700 +++ linux-2.5.73/fs/proc/kcore.c 2003-06-22 12:04:17.000000000 -0700 @@ -451,8 +451,20 @@ kfree(elf_buf); } else { if (kern_addr_valid(start)) { - if (copy_to_user(buffer, (char *)start, tsz)) - return -EFAULT; + unsigned long n; + + n = copy_to_user(buffer, (char *)start, tsz); + /* + * We cannot distingush between fault on source + * and fault on destination. When this happens + * we clear too and hope it will trigger the + * EFAULT again. + */ + if (n) { + if (clear_user(buffer + tsz - n, + tsz - n)) + return -EFAULT; + } } else { if (clear_user(buffer, tsz)) return -EFAULT; diff -urN linux-2.5.72-bk3/fs/proc/task_mmu.c linux-2.5.73/fs/proc/task_mmu.c --- linux-2.5.72-bk3/fs/proc/task_mmu.c 2003-06-16 21:19:41.000000000 -0700 +++ linux-2.5.73/fs/proc/task_mmu.c 2003-06-22 12:04:17.000000000 -0700 @@ -91,13 +91,13 @@ } seq_printf(m, "%0*lx-%0*lx %c%c%c%c %0*lx %02x:%02x %lu %n", - 2*sizeof(void*), map->vm_start, - 2*sizeof(void*), map->vm_end, + (int) (2*sizeof(void*)), map->vm_start, + (int) (2*sizeof(void*)), map->vm_end, flags & VM_READ ? 'r' : '-', flags & VM_WRITE ? 'w' : '-', flags & VM_EXEC ? 'x' : '-', flags & VM_MAYSHARE ? 's' : 'p', - 2*sizeof(void*), map->vm_pgoff << PAGE_SHIFT, + (int) (2*sizeof(void*)), map->vm_pgoff << PAGE_SHIFT, MAJOR(dev), MINOR(dev), ino, &len); if (map->vm_file) { diff -urN linux-2.5.72-bk3/fs/qnx4/inode.c linux-2.5.73/fs/qnx4/inode.c --- linux-2.5.72-bk3/fs/qnx4/inode.c 2003-06-16 21:20:22.000000000 -0700 +++ linux-2.5.73/fs/qnx4/inode.c 2003-06-22 12:04:17.000000000 -0700 @@ -126,7 +126,7 @@ static void qnx4_destroy_inode(struct inode *inode); static void qnx4_read_inode(struct inode *); static int qnx4_remount(struct super_block *sb, int *flags, char *data); -static int qnx4_statfs(struct super_block *, struct statfs *); +static int qnx4_statfs(struct super_block *, struct kstatfs *); static struct super_operations qnx4_sops = { @@ -276,7 +276,7 @@ return block; } -static int qnx4_statfs(struct super_block *sb, struct statfs *buf) +static int qnx4_statfs(struct super_block *sb, struct kstatfs *buf) { lock_kernel(); diff -urN linux-2.5.72-bk3/fs/reiserfs/super.c linux-2.5.73/fs/reiserfs/super.c --- linux-2.5.72-bk3/fs/reiserfs/super.c 2003-06-16 21:20:00.000000000 -0700 +++ linux-2.5.73/fs/reiserfs/super.c 2003-06-22 12:04:17.000000000 -0700 @@ -62,7 +62,7 @@ } static int reiserfs_remount (struct super_block * s, int * flags, char * data); -static int reiserfs_statfs (struct super_block * s, struct statfs * buf); +static int reiserfs_statfs (struct super_block * s, struct kstatfs * buf); static void reiserfs_write_super (struct super_block * s) { @@ -1414,13 +1414,11 @@ } -static int reiserfs_statfs (struct super_block * s, struct statfs * buf) +static int reiserfs_statfs (struct super_block * s, struct kstatfs * buf) { struct reiserfs_super_block * rs = SB_DISK_SUPER_BLOCK (s); buf->f_namelen = (REISERFS_MAX_NAME (s->s_blocksize)); - buf->f_ffree = -1; - buf->f_files = -1; buf->f_bfree = sb_free_blocks(rs); buf->f_bavail = buf->f_bfree; buf->f_blocks = sb_block_count(rs) - sb_bmap_nr(rs) - 1; diff -urN linux-2.5.72-bk3/fs/romfs/inode.c linux-2.5.73/fs/romfs/inode.c --- linux-2.5.72-bk3/fs/romfs/inode.c 2003-06-16 21:20:07.000000000 -0700 +++ linux-2.5.73/fs/romfs/inode.c 2003-06-22 12:04:17.000000000 -0700 @@ -176,7 +176,7 @@ /* That's simple too. */ static int -romfs_statfs(struct super_block *sb, struct statfs *buf) +romfs_statfs(struct super_block *sb, struct kstatfs *buf) { buf->f_type = ROMFS_MAGIC; buf->f_bsize = ROMBSIZE; diff -urN linux-2.5.72-bk3/fs/smbfs/inode.c linux-2.5.73/fs/smbfs/inode.c --- linux-2.5.72-bk3/fs/smbfs/inode.c 2003-06-16 21:19:41.000000000 -0700 +++ linux-2.5.73/fs/smbfs/inode.c 2003-06-22 12:04:17.000000000 -0700 @@ -47,7 +47,7 @@ static void smb_delete_inode(struct inode *); static void smb_put_super(struct super_block *); -static int smb_statfs(struct super_block *, struct statfs *); +static int smb_statfs(struct super_block *, struct kstatfs *); static int smb_show_options(struct seq_file *, struct vfsmount *); static kmem_cache_t *smb_inode_cachep; @@ -610,7 +610,7 @@ } static int -smb_statfs(struct super_block *sb, struct statfs *buf) +smb_statfs(struct super_block *sb, struct kstatfs *buf) { int result; diff -urN linux-2.5.72-bk3/fs/smbfs/proc.c linux-2.5.73/fs/smbfs/proc.c --- linux-2.5.72-bk3/fs/smbfs/proc.c 2003-06-16 21:19:41.000000000 -0700 +++ linux-2.5.73/fs/smbfs/proc.c 2003-06-22 12:04:17.000000000 -0700 @@ -3160,7 +3160,7 @@ } int -smb_proc_dskattr(struct super_block *sb, struct statfs *attr) +smb_proc_dskattr(struct super_block *sb, struct kstatfs *attr) { struct smb_sb_info *server = SMB_SB(sb); int result; diff -urN linux-2.5.72-bk3/fs/smbfs/proto.h linux-2.5.73/fs/smbfs/proto.h --- linux-2.5.72-bk3/fs/smbfs/proto.h 2003-06-16 21:20:06.000000000 -0700 +++ linux-2.5.73/fs/smbfs/proto.h 2003-06-22 12:04:17.000000000 -0700 @@ -29,7 +29,7 @@ extern int smb_proc_setattr(struct dentry *dir, struct smb_fattr *fattr); extern int smb_proc_setattr_unix(struct dentry *d, struct iattr *attr, unsigned int major, unsigned int minor); extern int smb_proc_settime(struct dentry *dentry, struct smb_fattr *fattr); -extern int smb_proc_dskattr(struct super_block *sb, struct statfs *attr); +extern int smb_proc_dskattr(struct super_block *sb, struct kstatfs *attr); extern int smb_proc_read_link(struct smb_sb_info *server, struct dentry *d, char *buffer, int len); extern int smb_proc_symlink(struct smb_sb_info *server, struct dentry *d, const char *oldpath); extern int smb_proc_link(struct smb_sb_info *server, struct dentry *dentry, struct dentry *new_dentry); diff -urN linux-2.5.72-bk3/fs/super.c linux-2.5.73/fs/super.c --- linux-2.5.72-bk3/fs/super.c 2003-06-16 21:20:00.000000000 -0700 +++ linux-2.5.73/fs/super.c 2003-06-22 12:04:17.000000000 -0700 @@ -409,7 +409,7 @@ { struct super_block *s; struct ustat tmp; - struct statfs sbuf; + struct kstatfs sbuf; int err = -EINVAL; s = user_get_super(dev); diff -urN linux-2.5.72-bk3/fs/sysv/inode.c linux-2.5.73/fs/sysv/inode.c --- linux-2.5.72-bk3/fs/sysv/inode.c 2003-06-16 21:19:39.000000000 -0700 +++ linux-2.5.73/fs/sysv/inode.c 2003-06-22 12:04:17.000000000 -0700 @@ -75,7 +75,7 @@ kfree(sbi); } -static int sysv_statfs(struct super_block *sb, struct statfs *buf) +static int sysv_statfs(struct super_block *sb, struct kstatfs *buf) { struct sysv_sb_info *sbi = SYSV_SB(sb); diff -urN linux-2.5.72-bk3/fs/udf/super.c linux-2.5.73/fs/udf/super.c --- linux-2.5.72-bk3/fs/udf/super.c 2003-06-16 21:20:06.000000000 -0700 +++ linux-2.5.73/fs/udf/super.c 2003-06-22 12:04:17.000000000 -0700 @@ -95,7 +95,7 @@ static void udf_open_lvid(struct super_block *); static void udf_close_lvid(struct super_block *); static unsigned int udf_count_free(struct super_block *); -static int udf_statfs(struct super_block *, struct statfs *); +static int udf_statfs(struct super_block *, struct kstatfs *); /* UDF filesystem type */ static struct super_block *udf_get_sb(struct file_system_type *fs_type, @@ -1720,7 +1720,7 @@ * Written, tested, and released. */ static int -udf_statfs(struct super_block *sb, struct statfs *buf) +udf_statfs(struct super_block *sb, struct kstatfs *buf) { buf->f_type = UDF_SUPER_MAGIC; buf->f_bsize = sb->s_blocksize; diff -urN linux-2.5.72-bk3/fs/ufs/super.c linux-2.5.73/fs/ufs/super.c --- linux-2.5.72-bk3/fs/ufs/super.c 2003-06-16 21:19:37.000000000 -0700 +++ linux-2.5.73/fs/ufs/super.c 2003-06-22 12:04:17.000000000 -0700 @@ -973,7 +973,7 @@ return 0; } -int ufs_statfs (struct super_block * sb, struct statfs * buf) +int ufs_statfs (struct super_block * sb, struct kstatfs * buf) { struct ufs_sb_private_info * uspi; struct ufs_super_block_first * usb1; @@ -988,8 +988,8 @@ buf->f_blocks = uspi->s_dsize; buf->f_bfree = ufs_blkstofrags(fs32_to_cpu(sb, usb1->fs_cstotal.cs_nbfree)) + fs32_to_cpu(sb, usb1->fs_cstotal.cs_nffree); - buf->f_bavail = (buf->f_bfree > ((buf->f_blocks / 100) * uspi->s_minfree)) - ? (buf->f_bfree - ((buf->f_blocks / 100) * uspi->s_minfree)) : 0; + buf->f_bavail = (buf->f_bfree > (((long)buf->f_blocks / 100) * uspi->s_minfree)) + ? (buf->f_bfree - (((long)buf->f_blocks / 100) * uspi->s_minfree)) : 0; buf->f_files = uspi->s_ncg * uspi->s_ipg; buf->f_ffree = fs32_to_cpu(sb, usb1->fs_cstotal.cs_nifree); buf->f_namelen = UFS_MAXNAMLEN; diff -urN linux-2.5.72-bk3/fs/xfs/linux/xfs_super.c linux-2.5.73/fs/xfs/linux/xfs_super.c --- linux-2.5.72-bk3/fs/xfs/linux/xfs_super.c 2003-06-16 21:20:22.000000000 -0700 +++ linux-2.5.73/fs/xfs/linux/xfs_super.c 2003-06-22 12:04:17.000000000 -0700 @@ -477,7 +477,7 @@ STATIC int linvfs_statfs( struct super_block *sb, - struct statfs *statp) + struct kstatfs *statp) { vfs_t *vfsp = LINVFS_GET_VFS(sb); int error; @@ -673,7 +673,7 @@ vnode_t *rootvp; struct vfs *vfsp = vfs_allocate(); struct xfs_mount_args *args = args_allocate(sb); - struct statfs statvfs; + struct kstatfs statvfs; int error; vfsp->vfs_super = sb; diff -urN linux-2.5.72-bk3/fs/xfs/linux/xfs_vfs.c linux-2.5.73/fs/xfs/linux/xfs_vfs.c --- linux-2.5.72-bk3/fs/xfs/linux/xfs_vfs.c 2003-06-16 21:19:39.000000000 -0700 +++ linux-2.5.73/fs/xfs/linux/xfs_vfs.c 2003-06-22 12:04:17.000000000 -0700 @@ -134,7 +134,7 @@ int vfs_statvfs( struct bhv_desc *bdp, - struct statfs *sp, + struct kstatfs *sp, struct vnode *vp) { struct bhv_desc *next = bdp; diff -urN linux-2.5.72-bk3/fs/xfs/linux/xfs_vfs.h linux-2.5.73/fs/xfs/linux/xfs_vfs.h --- linux-2.5.72-bk3/fs/xfs/linux/xfs_vfs.h 2003-06-16 21:19:39.000000000 -0700 +++ linux-2.5.73/fs/xfs/linux/xfs_vfs.h 2003-06-22 12:04:17.000000000 -0700 @@ -37,7 +37,7 @@ struct fid; struct cred; struct vnode; -struct statfs; +struct kstatfs; struct seq_file; struct super_block; struct xfs_mount_args; @@ -100,7 +100,7 @@ typedef int (*vfs_mntupdate_t)(bhv_desc_t *, int *, struct xfs_mount_args *); typedef int (*vfs_root_t)(bhv_desc_t *, struct vnode **); -typedef int (*vfs_statvfs_t)(bhv_desc_t *, struct statfs *, struct vnode *); +typedef int (*vfs_statvfs_t)(bhv_desc_t *, struct kstatfs *, struct vnode *); typedef int (*vfs_sync_t)(bhv_desc_t *, int, struct cred *); typedef int (*vfs_vget_t)(bhv_desc_t *, struct vnode **, struct fid *); typedef int (*vfs_dmapiops_t)(bhv_desc_t *, caddr_t); @@ -167,7 +167,7 @@ extern int vfs_unmount(bhv_desc_t *, int, struct cred *); extern int vfs_mntupdate(bhv_desc_t *, int *, struct xfs_mount_args *); extern int vfs_root(bhv_desc_t *, struct vnode **); -extern int vfs_statvfs(bhv_desc_t *, struct statfs *, struct vnode *); +extern int vfs_statvfs(bhv_desc_t *, struct kstatfs *, struct vnode *); extern int vfs_sync(bhv_desc_t *, int, struct cred *); extern int vfs_vget(bhv_desc_t *, struct vnode **, struct fid *); extern int vfs_dmapiops(bhv_desc_t *, caddr_t); diff -urN linux-2.5.72-bk3/fs/xfs/xfs_vfsops.c linux-2.5.73/fs/xfs/xfs_vfsops.c --- linux-2.5.72-bk3/fs/xfs/xfs_vfsops.c 2003-06-16 21:19:42.000000000 -0700 +++ linux-2.5.73/fs/xfs/xfs_vfsops.c 2003-06-22 12:04:17.000000000 -0700 @@ -752,7 +752,7 @@ STATIC int xfs_statvfs( bhv_desc_t *bdp, - struct statfs *statp, + struct kstatfs *statp, vnode_t *vp) { __uint64_t fakeinos; @@ -782,7 +782,7 @@ if (!mp->m_inoadd) #endif statp->f_files = - MIN(statp->f_files, (long)mp->m_maxicount); + min_t(sector_t, statp->f_files, mp->m_maxicount); statp->f_ffree = statp->f_files - (sbp->sb_icount - sbp->sb_ifree); XFS_SB_UNLOCK(mp, s); diff -urN linux-2.5.72-bk3/include/acpi/acconfig.h linux-2.5.73/include/acpi/acconfig.h --- linux-2.5.72-bk3/include/acpi/acconfig.h 2003-06-16 21:20:19.000000000 -0700 +++ linux-2.5.73/include/acpi/acconfig.h 2003-06-22 12:04:17.000000000 -0700 @@ -64,7 +64,7 @@ /* Version string */ -#define ACPI_CA_VERSION 0x20030522 +#define ACPI_CA_VERSION 0x20030619 /* Maximum objects in the various object caches */ diff -urN linux-2.5.72-bk3/include/acpi/acglobal.h linux-2.5.73/include/acpi/acglobal.h --- linux-2.5.72-bk3/include/acpi/acglobal.h 2003-06-16 21:19:37.000000000 -0700 +++ linux-2.5.73/include/acpi/acglobal.h 2003-06-22 12:04:17.000000000 -0700 @@ -105,6 +105,7 @@ */ ACPI_EXTERN u8 acpi_gbl_integer_bit_width; ACPI_EXTERN u8 acpi_gbl_integer_byte_width; +ACPI_EXTERN u8 acpi_gbl_integer_nybble_width; ACPI_EXTERN struct acpi_generic_address acpi_gbl_xpm1a_enable; ACPI_EXTERN struct acpi_generic_address acpi_gbl_xpm1b_enable; diff -urN linux-2.5.72-bk3/include/acpi/achware.h linux-2.5.73/include/acpi/achware.h --- linux-2.5.72-bk3/include/acpi/achware.h 2003-06-16 21:20:05.000000000 -0700 +++ linux-2.5.73/include/acpi/achware.h 2003-06-22 12:04:17.000000000 -0700 @@ -108,7 +108,7 @@ acpi_status acpi_hw_clear_acpi_status ( - void); + u32 flags); /* GPE support */ diff -urN linux-2.5.72-bk3/include/acpi/acpiosxf.h linux-2.5.73/include/acpi/acpiosxf.h --- linux-2.5.72-bk3/include/acpi/acpiosxf.h 2003-06-16 21:19:39.000000000 -0700 +++ linux-2.5.73/include/acpi/acpiosxf.h 2003-06-22 12:04:17.000000000 -0700 @@ -287,15 +287,15 @@ * Miscellaneous */ -BOOLEAN +u8 acpi_os_readable ( void *pointer, - u32 length); + acpi_size length); -BOOLEAN +u8 acpi_os_writable ( void *pointer, - u32 length); + acpi_size length); u32 acpi_os_get_timer ( diff -urN linux-2.5.72-bk3/include/acpi/actypes.h linux-2.5.73/include/acpi/actypes.h --- linux-2.5.72-bk3/include/acpi/actypes.h 2003-06-16 21:20:05.000000000 -0700 +++ linux-2.5.73/include/acpi/actypes.h 2003-06-22 12:04:17.000000000 -0700 @@ -50,11 +50,14 @@ /* * Data type ranges - */ -#define ACPI_UINT8_MAX (~((UINT8) 0)) -#define ACPI_UINT16_MAX (~((UINT16) 0)) -#define ACPI_UINT32_MAX (~((UINT32) 0)) -#define ACPI_UINT64_MAX (~((UINT64) 0)) + * Note: These macros are designed to be compiler independent as well as + * working around problems that some 32-bit compilers have with 64-bit + * constants. + */ +#define ACPI_UINT8_MAX (UINT8) (~((UINT8) 0)) /* 0xFF */ +#define ACPI_UINT16_MAX (UINT16)(~((UINT16) 0)) /* 0xFFFF */ +#define ACPI_UINT32_MAX (UINT32)(~((UINT32) 0)) /* 0xFFFFFFFF */ +#define ACPI_UINT64_MAX (UINT64)(~((UINT64) 0)) /* 0xFFFFFFFFFFFFFFFF */ #define ACPI_ASCII_MAX 0x7F @@ -299,8 +302,6 @@ typedef u32 acpi_integer; #define ACPI_INTEGER_MAX ACPI_UINT32_MAX #define ACPI_INTEGER_BIT_SIZE 32 -#define ACPI_MAX_BCD_VALUE 99999999 -#define ACPI_MAX_BCD_DIGITS 8 #define ACPI_MAX_DECIMAL_DIGITS 10 #define ACPI_USE_NATIVE_DIVIDE /* Use compiler native 32-bit divide */ @@ -313,12 +314,6 @@ typedef u64 acpi_integer; #define ACPI_INTEGER_MAX ACPI_UINT64_MAX #define ACPI_INTEGER_BIT_SIZE 64 -#if ACPI_MACHINE_WIDTH == 64 -#define ACPI_MAX_BCD_VALUE 9999999999999999UL -#else -#define ACPI_MAX_BCD_VALUE 9999999999999999ULL -#endif -#define ACPI_MAX_BCD_DIGITS 16 #define ACPI_MAX_DECIMAL_DIGITS 19 #if ACPI_MACHINE_WIDTH == 64 diff -urN linux-2.5.72-bk3/include/asm-alpha/pci.h linux-2.5.73/include/asm-alpha/pci.h --- linux-2.5.72-bk3/include/asm-alpha/pci.h 2003-06-16 21:19:37.000000000 -0700 +++ linux-2.5.73/include/asm-alpha/pci.h 2003-06-22 12:04:17.000000000 -0700 @@ -194,6 +194,18 @@ #define pci_domain_nr(bus) ((struct pci_controller *)(bus)->sysdata)->index +/* Bus number == domain number until we get above 256 busses */ +static inline int pci_name_bus(char *name, struct pci_bus *bus) +{ + int domain = pci_domain_nr(bus) + if (domain < 256) { + sprintf(name, "%02x", domain); + } else { + sprintf(name, "%04x:%02x", domain, bus->number); + } + return 0; +} + #endif /* __KERNEL__ */ /* Values for the `which' argument to sys_pciconfig_iobase. */ diff -urN linux-2.5.72-bk3/include/asm-alpha/statfs.h linux-2.5.73/include/asm-alpha/statfs.h --- linux-2.5.72-bk3/include/asm-alpha/statfs.h 2003-06-16 21:19:37.000000000 -0700 +++ linux-2.5.73/include/asm-alpha/statfs.h 2003-06-22 12:04:17.000000000 -0700 @@ -1,25 +1,6 @@ #ifndef _ALPHA_STATFS_H #define _ALPHA_STATFS_H -#ifndef __KERNEL_STRICT_NAMES - -#include - -typedef __kernel_fsid_t fsid_t; - -#endif - -struct statfs { - int f_type; - int f_bsize; - int f_blocks; - int f_bfree; - int f_bavail; - int f_files; - int f_ffree; - __kernel_fsid_t f_fsid; - int f_namelen; - int f_spare[6]; -}; +#include #endif diff -urN linux-2.5.72-bk3/include/asm-arm/statfs.h linux-2.5.73/include/asm-arm/statfs.h --- linux-2.5.72-bk3/include/asm-arm/statfs.h 2003-06-16 21:20:01.000000000 -0700 +++ linux-2.5.73/include/asm-arm/statfs.h 2003-06-22 12:04:18.000000000 -0700 @@ -1,25 +1,6 @@ #ifndef _ASMARM_STATFS_H #define _ASMARM_STATFS_H -#ifndef __KERNEL_STRICT_NAMES - -#include - -typedef __kernel_fsid_t fsid_t; - -#endif - -struct statfs { - long f_type; - long f_bsize; - long f_blocks; - long f_bfree; - long f_bavail; - long f_files; - long f_ffree; - __kernel_fsid_t f_fsid; - long f_namelen; - long f_spare[6]; -}; +#include #endif diff -urN linux-2.5.72-bk3/include/asm-cris/statfs.h linux-2.5.73/include/asm-cris/statfs.h --- linux-2.5.72-bk3/include/asm-cris/statfs.h 2003-06-16 21:20:06.000000000 -0700 +++ linux-2.5.73/include/asm-cris/statfs.h 2003-06-22 12:04:18.000000000 -0700 @@ -1,25 +1,6 @@ #ifndef _CRIS_STATFS_H #define _CRIS_STATFS_H -#ifndef __KERNEL_STRICT_NAMES - -#include - -typedef __kernel_fsid_t fsid_t; - -#endif - -struct statfs { - long f_type; - long f_bsize; - long f_blocks; - long f_bfree; - long f_bavail; - long f_files; - long f_ffree; - __kernel_fsid_t f_fsid; - long f_namelen; - long f_spare[6]; -}; +#include #endif diff -urN linux-2.5.72-bk3/include/asm-generic/statfs.h linux-2.5.73/include/asm-generic/statfs.h --- linux-2.5.72-bk3/include/asm-generic/statfs.h 1969-12-31 16:00:00.000000000 -0800 +++ linux-2.5.73/include/asm-generic/statfs.h 2003-06-22 12:04:18.000000000 -0700 @@ -0,0 +1,37 @@ +#ifndef _GENERIC_STATFS_H +#define _GENERIC_STATFS_H + +#ifndef __KERNEL_STRICT_NAMES +# include +typedef __kernel_fsid_t fsid_t; +#endif + +struct statfs { + __u32 f_type; + __u32 f_bsize; + __u32 f_blocks; + __u32 f_bfree; + __u32 f_bavail; + __u32 f_files; + __u32 f_ffree; + __kernel_fsid_t f_fsid; + __u32 f_namelen; + __u32 f_frsize; + __u32 f_spare[5]; +}; + +struct statfs64 { + __u32 f_type; + __u32 f_bsize; + __u64 f_blocks; + __u64 f_bfree; + __u64 f_bavail; + __u64 f_files; + __u64 f_ffree; + __kernel_fsid_t f_fsid; + __u32 f_namelen; + __u32 f_frsize; + __u32 f_spare[5]; +}; + +#endif diff -urN linux-2.5.72-bk3/include/asm-h8300/statfs.h linux-2.5.73/include/asm-h8300/statfs.h --- linux-2.5.72-bk3/include/asm-h8300/statfs.h 2003-06-16 21:19:42.000000000 -0700 +++ linux-2.5.73/include/asm-h8300/statfs.h 2003-06-22 12:04:18.000000000 -0700 @@ -1,25 +1,6 @@ #ifndef _H8300_STATFS_H #define _H8300_STATFS_H -#ifndef __KERNEL_STRICT_NAMES - -#include - -typedef __kernel_fsid_t fsid_t; - -#endif - -struct statfs { - long f_type; - long f_bsize; - long f_blocks; - long f_bfree; - long f_bavail; - long f_files; - long f_ffree; - __kernel_fsid_t f_fsid; - long f_namelen; - long f_spare[6]; -}; +#include #endif /* _H8300_STATFS_H */ diff -urN linux-2.5.72-bk3/include/asm-h8300/uaccess.h linux-2.5.73/include/asm-h8300/uaccess.h --- linux-2.5.72-bk3/include/asm-h8300/uaccess.h 2003-06-16 21:19:47.000000000 -0700 +++ linux-2.5.73/include/asm-h8300/uaccess.h 2003-06-22 12:04:18.000000000 -0700 @@ -6,6 +6,8 @@ */ #include #include +#include + #include #define VERIFY_READ 0 @@ -159,7 +161,7 @@ clear_user(void *to, unsigned long n) { memset(to, 0, n); - return(0); + return 0; } #endif /* _H8300_UACCESS_H */ diff -urN linux-2.5.72-bk3/include/asm-i386/acpi.h linux-2.5.73/include/asm-i386/acpi.h --- linux-2.5.72-bk3/include/asm-i386/acpi.h 2003-06-16 21:20:22.000000000 -0700 +++ linux-2.5.73/include/asm-i386/acpi.h 2003-06-22 12:04:18.000000000 -0700 @@ -106,6 +106,10 @@ :"0"(n_hi), "1"(n_lo)) +#ifdef CONFIG_ACPI_HT_ONLY +extern int acpi_lapic; +#define acpi_ioapic 0 +#else #ifndef CONFIG_ACPI_BOOT #define acpi_lapic 0 #define acpi_ioapic 0 @@ -120,6 +124,7 @@ #else #define acpi_ioapic 0 #endif +#endif /* Fixmap pages to reserve for ACPI boot-time tables (see fixmap.h) */ #define FIX_ACPI_PAGES 4 diff -urN linux-2.5.72-bk3/include/asm-i386/genapic.h linux-2.5.73/include/asm-i386/genapic.h --- linux-2.5.72-bk3/include/asm-i386/genapic.h 2003-06-16 21:20:05.000000000 -0700 +++ linux-2.5.73/include/asm-i386/genapic.h 2003-06-22 12:04:18.000000000 -0700 @@ -43,6 +43,7 @@ struct mpc_config_translation *t); void (*setup_portio_remap)(void); int (*check_phys_apicid_present)(int boot_cpu_physical_apicid); + void (*enable_apic_mode)(void); /* mpparse */ void (*mpc_oem_bus_info)(struct mpc_config_bus *, char *, @@ -101,6 +102,7 @@ APICFUNC(send_IPI_mask), \ APICFUNC(send_IPI_allbutself), \ APICFUNC(send_IPI_all), \ + APICFUNC(enable_apic_mode), \ } extern struct genapic *genapic; diff -urN linux-2.5.72-bk3/include/asm-i386/mach-default/mach_resources.h linux-2.5.73/include/asm-i386/mach-default/mach_resources.h --- linux-2.5.72-bk3/include/asm-i386/mach-default/mach_resources.h 2003-06-16 21:20:06.000000000 -0700 +++ linux-2.5.73/include/asm-i386/mach-default/mach_resources.h 2003-06-22 12:04:18.000000000 -0700 @@ -9,18 +9,14 @@ struct resource standard_io_resources[] = { { "dma1", 0x00, 0x1f, IORESOURCE_BUSY }, - { "pic1", 0x20, 0x3f, IORESOURCE_BUSY }, + { "pic1", 0x20, 0x21, IORESOURCE_BUSY }, { "timer", 0x40, 0x5f, IORESOURCE_BUSY }, { "keyboard", 0x60, 0x6f, IORESOURCE_BUSY }, { "dma page reg", 0x80, 0x8f, IORESOURCE_BUSY }, - { "pic2", 0xa0, 0xbf, IORESOURCE_BUSY }, + { "pic2", 0xa0, 0xa1, IORESOURCE_BUSY }, { "dma2", 0xc0, 0xdf, IORESOURCE_BUSY }, { "fpu", 0xf0, 0xff, IORESOURCE_BUSY } }; -#ifdef CONFIG_MELAN -standard_io_resources[1] = { "pic1", 0x20, 0x21, IORESOURCE_BUSY }; -standard_io_resources[5] = { "pic2", 0xa0, 0xa1, IORESOURCE_BUSY }; -#endif #define STANDARD_IO_RESOURCES (sizeof(standard_io_resources)/sizeof(struct resource)) diff -urN linux-2.5.72-bk3/include/asm-i386/mach-generic/mach_apic.h linux-2.5.73/include/asm-i386/mach-generic/mach_apic.h --- linux-2.5.72-bk3/include/asm-i386/mach-generic/mach_apic.h 2003-06-16 21:19:58.000000000 -0700 +++ linux-2.5.73/include/asm-i386/mach-generic/mach_apic.h 2003-06-22 12:04:18.000000000 -0700 @@ -25,5 +25,6 @@ #define check_phys_apicid_present (genapic->check_phys_apicid_present) #define check_apicid_used (genapic->check_apicid_used) #define cpu_mask_to_apicid (genapic->cpu_mask_to_apicid) +#define enable_apic_mode (genapic->enable_apic_mode) #endif /* __ASM_MACH_APIC_H */ diff -urN linux-2.5.72-bk3/include/asm-i386/mach-pc9800/setup_arch_pre.h linux-2.5.73/include/asm-i386/mach-pc9800/setup_arch_pre.h --- linux-2.5.72-bk3/include/asm-i386/mach-pc9800/setup_arch_pre.h 2003-06-16 21:20:02.000000000 -0700 +++ linux-2.5.73/include/asm-i386/mach-pc9800/setup_arch_pre.h 2003-06-22 12:04:18.000000000 -0700 @@ -25,8 +25,8 @@ { CLOCK_TICK_RATE = PC9800_8MHz_P() ? 1996800 : 2457600; printk(KERN_DEBUG "CLOCK_TICK_RATE = %d\n", CLOCK_TICK_RATE); - tick_usec = TICK_USEC; /* ACTHZ period (usec) */ - tick_nsec = TICK_NSEC; /* USER_HZ period (nsec) */ + tick_usec = TICK_USEC; /* USER_HZ period (usec) */ + tick_nsec = TICK_NSEC; /* ACTHZ period (nsec) */ pc9800_misc_flags = PC9800_MISC_FLAGS; #ifdef CONFIG_SMP diff -urN linux-2.5.72-bk3/include/asm-i386/processor.h linux-2.5.73/include/asm-i386/processor.h --- linux-2.5.72-bk3/include/asm-i386/processor.h 2003-06-16 21:19:39.000000000 -0700 +++ linux-2.5.73/include/asm-i386/processor.h 2003-06-22 12:04:18.000000000 -0700 @@ -468,6 +468,7 @@ extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags); extern unsigned long thread_saved_pc(struct task_struct *tsk); +void show_trace(struct task_struct *task, unsigned long *stack); unsigned long get_wchan(struct task_struct *p); #define KSTK_EIP(tsk) (((unsigned long *)(4096+(unsigned long)(tsk)->thread_info))[1019]) diff -urN linux-2.5.72-bk3/include/asm-i386/smp.h linux-2.5.73/include/asm-i386/smp.h --- linux-2.5.72-bk3/include/asm-i386/smp.h 2003-06-16 21:20:05.000000000 -0700 +++ linux-2.5.73/include/asm-i386/smp.h 2003-06-22 12:04:18.000000000 -0700 @@ -78,12 +78,12 @@ extern void map_cpu_to_logical_apicid(void); extern void unmap_cpu_to_logical_apicid(int cpu); -extern inline int any_online_cpu(unsigned int mask) +extern inline unsigned int any_online_cpu(unsigned int mask) { if (mask & cpu_online_map) return __ffs(mask & cpu_online_map); - return -1; + return NR_CPUS; } #ifdef CONFIG_X86_LOCAL_APIC diff -urN linux-2.5.72-bk3/include/asm-i386/statfs.h linux-2.5.73/include/asm-i386/statfs.h --- linux-2.5.72-bk3/include/asm-i386/statfs.h 2003-06-16 21:20:21.000000000 -0700 +++ linux-2.5.73/include/asm-i386/statfs.h 2003-06-22 12:04:18.000000000 -0700 @@ -1,25 +1,6 @@ #ifndef _I386_STATFS_H #define _I386_STATFS_H -#ifndef __KERNEL_STRICT_NAMES - -#include - -typedef __kernel_fsid_t fsid_t; - -#endif - -struct statfs { - long f_type; - long f_bsize; - long f_blocks; - long f_bfree; - long f_bavail; - long f_files; - long f_ffree; - __kernel_fsid_t f_fsid; - long f_namelen; - long f_spare[6]; -}; +#include #endif diff -urN linux-2.5.72-bk3/include/asm-i386/uaccess.h linux-2.5.73/include/asm-i386/uaccess.h --- linux-2.5.72-bk3/include/asm-i386/uaccess.h 2003-06-16 21:19:41.000000000 -0700 +++ linux-2.5.73/include/asm-i386/uaccess.h 2003-06-22 12:04:18.000000000 -0700 @@ -8,6 +8,7 @@ #include #include #include +#include #include #define VERIFY_READ 0 @@ -494,6 +495,8 @@ { if (access_ok(VERIFY_READ, from, n)) n = __copy_from_user(to, from, n); + else + memset(to, 0, n); return n; } diff -urN linux-2.5.72-bk3/include/asm-i386/unistd.h linux-2.5.73/include/asm-i386/unistd.h --- linux-2.5.72-bk3/include/asm-i386/unistd.h 2003-06-16 21:20:06.000000000 -0700 +++ linux-2.5.73/include/asm-i386/unistd.h 2003-06-22 12:04:18.000000000 -0700 @@ -273,8 +273,10 @@ #define __NR_clock_gettime (__NR_timer_create+6) #define __NR_clock_getres (__NR_timer_create+7) #define __NR_clock_nanosleep (__NR_timer_create+8) +#define __NR_statfs64 268 +#define __NR_fstatfs64 269 -#define NR_syscalls 268 +#define NR_syscalls 270 /* user-visible error numbers are in the range -1 - -124: see */ diff -urN linux-2.5.72-bk3/include/asm-ia64/compat.h linux-2.5.73/include/asm-ia64/compat.h --- linux-2.5.72-bk3/include/asm-ia64/compat.h 2003-06-22 12:03:31.000000000 -0700 +++ linux-2.5.73/include/asm-ia64/compat.h 2003-06-22 12:04:18.000000000 -0700 @@ -99,7 +99,8 @@ int f_ffree; compat_fsid_t f_fsid; int f_namelen; /* SunOS ignores this field. */ - int f_spare[6]; + int f_frsize; + int f_spare[5]; }; #define COMPAT_RLIM_OLD_INFINITY 0x7fffffff diff -urN linux-2.5.72-bk3/include/asm-ia64/pci.h linux-2.5.73/include/asm-ia64/pci.h --- linux-2.5.72-bk3/include/asm-ia64/pci.h 2003-06-22 12:03:31.000000000 -0700 +++ linux-2.5.73/include/asm-ia64/pci.h 2003-06-22 12:04:18.000000000 -0700 @@ -102,6 +102,16 @@ #define PCI_CONTROLLER(busdev) ((struct pci_controller *) busdev->sysdata) #define pci_domain_nr(busdev) (PCI_CONTROLLER(busdev)->segment) +static inline int pci_name_bus(char *name, struct pci_bus *bus) +{ + if (pci_domain_nr(bus) == 0) { + sprintf(name, "%02x", bus->number); + } else { + sprintf(name, "%04x:%02x", pci_domain_nr(bus), bus->number); + } + return 0; +} + /* generic pci stuff */ #include diff -urN linux-2.5.72-bk3/include/asm-ia64/smp.h linux-2.5.73/include/asm-ia64/smp.h --- linux-2.5.72-bk3/include/asm-ia64/smp.h 2003-06-16 21:20:01.000000000 -0700 +++ linux-2.5.73/include/asm-ia64/smp.h 2003-06-22 12:04:18.000000000 -0700 @@ -56,12 +56,12 @@ return hweight64(cpu_online_map); } -static inline int +static inline unsigned int any_online_cpu (unsigned int mask) { if (mask & cpu_online_map) return __ffs(mask & cpu_online_map); - return -1; + return NR_CPUS; } /* diff -urN linux-2.5.72-bk3/include/asm-ia64/statfs.h linux-2.5.73/include/asm-ia64/statfs.h --- linux-2.5.72-bk3/include/asm-ia64/statfs.h 2003-06-16 21:20:02.000000000 -0700 +++ linux-2.5.73/include/asm-ia64/statfs.h 2003-06-22 12:04:21.000000000 -0700 @@ -6,11 +6,9 @@ * Copyright (C) 1998, 1999 David Mosberger-Tang */ -# ifndef __KERNEL_STRICT_NAMES -# include - typedef __kernel_fsid_t fsid_t; -# endif - +/* + * This is ugly --- we're already 64-bit, so just duplicate the definitions + */ struct statfs { long f_type; long f_bsize; @@ -21,7 +19,24 @@ long f_ffree; __kernel_fsid_t f_fsid; long f_namelen; - long f_spare[6]; + long f_frsize; + long f_spare[5]; }; + +struct statfs64 { + long f_type; + long f_bsize; + long f_blocks; + long f_bfree; + long f_bavail; + long f_files; + long f_ffree; + __kernel_fsid_t f_fsid; + long f_namelen; + long f_frsize; + long f_spare[5]; +}; + + #endif /* _ASM_IA64_STATFS_H */ diff -urN linux-2.5.72-bk3/include/asm-ia64/unistd.h linux-2.5.73/include/asm-ia64/unistd.h --- linux-2.5.72-bk3/include/asm-ia64/unistd.h 2003-06-22 12:03:37.000000000 -0700 +++ linux-2.5.73/include/asm-ia64/unistd.h 2003-06-22 12:04:21.000000000 -0700 @@ -246,6 +246,8 @@ #define __NR_sys_clock_gettime 1254 #define __NR_sys_clock_getres 1255 #define __NR_sys_clock_nanosleep 1256 +#define __NR_sys_fstatfs64 1257 +#define __NR_sys_statfs64 1258 #ifdef __KERNEL__ diff -urN linux-2.5.72-bk3/include/asm-m68k/statfs.h linux-2.5.73/include/asm-m68k/statfs.h --- linux-2.5.72-bk3/include/asm-m68k/statfs.h 2003-06-16 21:19:42.000000000 -0700 +++ linux-2.5.73/include/asm-m68k/statfs.h 2003-06-22 12:04:21.000000000 -0700 @@ -1,25 +1,6 @@ #ifndef _M68K_STATFS_H #define _M68K_STATFS_H -#ifndef __KERNEL_STRICT_NAMES - -#include - -typedef __kernel_fsid_t fsid_t; - -#endif - -struct statfs { - long f_type; - long f_bsize; - long f_blocks; - long f_bfree; - long f_bavail; - long f_files; - long f_ffree; - __kernel_fsid_t f_fsid; - long f_namelen; - long f_spare[6]; -}; +#include #endif /* _M68K_STATFS_H */ diff -urN linux-2.5.72-bk3/include/asm-m68knommu/uaccess.h linux-2.5.73/include/asm-m68knommu/uaccess.h --- linux-2.5.72-bk3/include/asm-m68knommu/uaccess.h 2003-06-16 21:20:19.000000000 -0700 +++ linux-2.5.73/include/asm-m68knommu/uaccess.h 2003-06-22 12:04:21.000000000 -0700 @@ -6,6 +6,8 @@ */ #include #include +#include + #include #define VERIFY_READ 0 @@ -178,7 +180,7 @@ clear_user(void *to, unsigned long n) { memset(to, 0, n); - return(0); + return 0; } #endif /* _M68KNOMMU_UACCESS_H */ diff -urN linux-2.5.72-bk3/include/asm-parisc/compat.h linux-2.5.73/include/asm-parisc/compat.h --- linux-2.5.72-bk3/include/asm-parisc/compat.h 2003-06-16 21:20:29.000000000 -0700 +++ linux-2.5.73/include/asm-parisc/compat.h 2003-06-22 12:04:21.000000000 -0700 @@ -97,7 +97,8 @@ s32 f_ffree; __kernel_fsid_t f_fsid; s32 f_namelen; - s32 f_spare[6]; + s32 f_frsize; + s32 f_spare[5]; }; #define COMPAT_RLIM_INFINITY 0xffffffff diff -urN linux-2.5.72-bk3/include/asm-parisc/smp.h linux-2.5.73/include/asm-parisc/smp.h --- linux-2.5.72-bk3/include/asm-parisc/smp.h 2003-06-16 21:20:20.000000000 -0700 +++ linux-2.5.73/include/asm-parisc/smp.h 2003-06-22 12:04:21.000000000 -0700 @@ -60,12 +60,12 @@ return hweight32(cpu_online_map); } -extern inline int any_online_cpu(unsigned int mask) +extern inline unsigned int any_online_cpu(unsigned int mask) { if (mask & cpu_online_map) return __ffs(mask & cpu_online_map); - return -1; + return NR_CPUS; } #endif /* CONFIG_SMP */ diff -urN linux-2.5.72-bk3/include/asm-parisc/statfs.h linux-2.5.73/include/asm-parisc/statfs.h --- linux-2.5.72-bk3/include/asm-parisc/statfs.h 2003-06-16 21:20:19.000000000 -0700 +++ linux-2.5.73/include/asm-parisc/statfs.h 2003-06-22 12:04:21.000000000 -0700 @@ -9,6 +9,10 @@ #endif +/* + * It appears that PARISC could be 64 _or_ 32 bit. + * 64-bit fields must be explicitly 64-bit in statfs64. + */ struct statfs { long f_type; long f_bsize; @@ -19,7 +23,22 @@ long f_ffree; __kernel_fsid_t f_fsid; long f_namelen; - long f_spare[6]; + long f_frsize; + long f_spare[5]; +}; + +struct statfs64 { + long f_type; + long f_bsize; + u64 f_blocks; + u64 f_bfree; + u64 f_bavail; + u64 f_files; + u64 f_ffree; + __kernel_fsid_t f_fsid; + long f_namelen; + long f_frsize; + long f_spare[5]; }; #endif diff -urN linux-2.5.72-bk3/include/asm-ppc/pci.h linux-2.5.73/include/asm-ppc/pci.h --- linux-2.5.72-bk3/include/asm-ppc/pci.h 2003-06-16 21:20:19.000000000 -0700 +++ linux-2.5.73/include/asm-ppc/pci.h 2003-06-22 12:04:21.000000000 -0700 @@ -269,6 +269,13 @@ /* Return the index of the PCI controller for device PDEV. */ #define pci_domain_nr(bus) ((struct pci_controller *)(bus)->sysdata)->index +/* Set the name of the bus as it appears in /proc/bus/pci */ +static inline int pci_name_bus(char *name, struct pci_bus *bus) +{ + sprintf(name, "%02x", bus->number); + return 0; +} + /* Map a range of PCI memory or I/O space for a device into user space */ int pci_mmap_page_range(struct pci_dev *pdev, struct vm_area_struct *vma, enum pci_mmap_state mmap_state, int write_combine); diff -urN linux-2.5.72-bk3/include/asm-ppc/smp.h linux-2.5.73/include/asm-ppc/smp.h --- linux-2.5.72-bk3/include/asm-ppc/smp.h 2003-06-16 21:19:42.000000000 -0700 +++ linux-2.5.73/include/asm-ppc/smp.h 2003-06-22 12:04:21.000000000 -0700 @@ -53,12 +53,12 @@ return hweight32(cpu_online_map); } -extern inline int any_online_cpu(unsigned int mask) +extern inline unsigned int any_online_cpu(unsigned int mask) { if (mask & cpu_online_map) return __ffs(mask & cpu_online_map); - return -1; + return NR_CPUS; } extern int __cpu_up(unsigned int cpu); diff -urN linux-2.5.72-bk3/include/asm-ppc/statfs.h linux-2.5.73/include/asm-ppc/statfs.h --- linux-2.5.72-bk3/include/asm-ppc/statfs.h 2003-06-16 21:19:40.000000000 -0700 +++ linux-2.5.73/include/asm-ppc/statfs.h 2003-06-22 12:04:21.000000000 -0700 @@ -1,27 +1,7 @@ #ifndef _PPC_STATFS_H #define _PPC_STATFS_H -#ifndef __KERNEL_STRICT_NAMES - -#include - -typedef __kernel_fsid_t fsid_t; - -#endif - -struct statfs { - long f_type; - long f_bsize; - long f_blocks; - long f_bfree; - long f_bavail; - long f_files; - long f_ffree; - __kernel_fsid_t f_fsid; - long f_namelen; - long f_spare[6]; -}; - +#include #endif diff -urN linux-2.5.72-bk3/include/asm-ppc64/compat.h linux-2.5.73/include/asm-ppc64/compat.h --- linux-2.5.72-bk3/include/asm-ppc64/compat.h 2003-06-16 21:19:44.000000000 -0700 +++ linux-2.5.73/include/asm-ppc64/compat.h 2003-06-22 12:04:21.000000000 -0700 @@ -91,7 +91,8 @@ int f_ffree; compat_fsid_t f_fsid; int f_namelen; /* SunOS ignores this field. */ - int f_spare[6]; + int f_frsize; + int f_spare[5]; }; #define COMPAT_RLIM_OLD_INFINITY 0x7fffffff diff -urN linux-2.5.72-bk3/include/asm-ppc64/pci.h linux-2.5.73/include/asm-ppc64/pci.h --- linux-2.5.72-bk3/include/asm-ppc64/pci.h 2003-06-16 21:19:59.000000000 -0700 +++ linux-2.5.73/include/asm-ppc64/pci.h 2003-06-22 12:04:21.000000000 -0700 @@ -88,6 +88,13 @@ extern int pci_domain_nr(struct pci_bus *bus); +/* Set the name of the bus as it appears in /proc/bus/pci */ +static inline int pci_name_bus(char *name, struct pci_bus *bus) +{ + sprintf(name, "%02x", bus->number); + return 0; +} + struct vm_area_struct; /* Map a range of PCI memory or I/O space for a device into user space */ int pci_mmap_page_range(struct pci_dev *pdev, struct vm_area_struct *vma, diff -urN linux-2.5.72-bk3/include/asm-ppc64/statfs.h linux-2.5.73/include/asm-ppc64/statfs.h --- linux-2.5.72-bk3/include/asm-ppc64/statfs.h 2003-06-16 21:20:07.000000000 -0700 +++ linux-2.5.73/include/asm-ppc64/statfs.h 2003-06-22 12:04:21.000000000 -0700 @@ -13,6 +13,9 @@ typedef __kernel_fsid_t fsid_t; #endif +/* + * We're already 64-bit, so duplicate the definition + */ struct statfs { long f_type; long f_bsize; @@ -23,7 +26,22 @@ long f_ffree; __kernel_fsid_t f_fsid; long f_namelen; - long f_spare[6]; + long f_frsize; + long f_spare[5]; +}; + +struct statfs64 { + long f_type; + long f_bsize; + long f_blocks; + long f_bfree; + long f_bavail; + long f_files; + long f_ffree; + __kernel_fsid_t f_fsid; + long f_namelen; + long f_frsize; + long f_spare[5]; }; #endif /* _PPC64_STATFS_H */ diff -urN linux-2.5.72-bk3/include/asm-s390/smp.h linux-2.5.73/include/asm-s390/smp.h --- linux-2.5.72-bk3/include/asm-s390/smp.h 2003-06-16 21:20:01.000000000 -0700 +++ linux-2.5.73/include/asm-s390/smp.h 2003-06-22 12:04:21.000000000 -0700 @@ -59,12 +59,12 @@ #endif /* __s390x__ */ } -extern inline int any_online_cpu(unsigned int mask) +extern inline unsigned int any_online_cpu(unsigned int mask) { if (mask & cpu_online_map) return __ffs(mask & cpu_online_map); - return -1; + return NR_CPUS; } extern __inline__ __u16 hard_smp_processor_id(void) diff -urN linux-2.5.72-bk3/include/asm-sparc/statfs.h linux-2.5.73/include/asm-sparc/statfs.h --- linux-2.5.72-bk3/include/asm-sparc/statfs.h 2003-06-16 21:20:23.000000000 -0700 +++ linux-2.5.73/include/asm-sparc/statfs.h 2003-06-22 12:04:21.000000000 -0700 @@ -2,25 +2,6 @@ #ifndef _SPARC_STATFS_H #define _SPARC_STATFS_H -#ifndef __KERNEL_STRICT_NAMES - -#include - -typedef __kernel_fsid_t fsid_t; - -#endif - -struct statfs { - long f_type; - long f_bsize; - long f_blocks; - long f_bfree; - long f_bavail; - long f_files; - long f_ffree; - __kernel_fsid_t f_fsid; - long f_namelen; /* SunOS ignores this field. */ - long f_spare[6]; -}; +#include #endif diff -urN linux-2.5.72-bk3/include/asm-sparc64/pci.h linux-2.5.73/include/asm-sparc64/pci.h --- linux-2.5.72-bk3/include/asm-sparc64/pci.h 2003-06-16 21:19:41.000000000 -0700 +++ linux-2.5.73/include/asm-sparc64/pci.h 2003-06-22 12:04:21.000000000 -0700 @@ -191,6 +191,13 @@ extern int pci_domain_nr(struct pci_bus *bus); +/* Set the name of the bus as it appears in /proc/bus/pci */ +static inline int pci_name_bus(char *name, struct pci_bus *bus) +{ + sprintf(name, "%02x", bus->number); + return 0; +} + /* Platform support for /proc/bus/pci/X/Y mmap()s. */ #define HAVE_PCI_MMAP diff -urN linux-2.5.72-bk3/include/asm-sparc64/smp.h linux-2.5.73/include/asm-sparc64/smp.h --- linux-2.5.72-bk3/include/asm-sparc64/smp.h 2003-06-16 21:19:47.000000000 -0700 +++ linux-2.5.73/include/asm-sparc64/smp.h 2003-06-22 12:04:21.000000000 -0700 @@ -80,11 +80,11 @@ extern atomic_t sparc64_num_cpus_possible; #define num_possible_cpus() (atomic_read(&sparc64_num_cpus_possible)) -static inline int any_online_cpu(unsigned long mask) +static inline unsigned int any_online_cpu(unsigned long mask) { if ((mask &= cpu_online_map) != 0UL) return __ffs(mask); - return -1; + return NR_CPUS; } /* diff -urN linux-2.5.72-bk3/include/asm-sparc64/statfs.h linux-2.5.73/include/asm-sparc64/statfs.h --- linux-2.5.72-bk3/include/asm-sparc64/statfs.h 2003-06-16 21:20:01.000000000 -0700 +++ linux-2.5.73/include/asm-sparc64/statfs.h 2003-06-22 12:04:21.000000000 -0700 @@ -20,7 +20,22 @@ long f_ffree; __kernel_fsid_t f_fsid; long f_namelen; - long f_spare[6]; + long f_frsize; + long f_spare[5]; +}; + +struct statfs64 { + long f_type; + long f_bsize; + long f_blocks; + long f_bfree; + long f_bavail; + long f_files; + long f_ffree; + __kernel_fsid_t f_fsid; + long f_namelen; + long f_frsize; + long f_spare[5]; }; #endif diff -urN linux-2.5.72-bk3/include/asm-x86_64/compat.h linux-2.5.73/include/asm-x86_64/compat.h --- linux-2.5.72-bk3/include/asm-x86_64/compat.h 2003-06-16 21:20:19.000000000 -0700 +++ linux-2.5.73/include/asm-x86_64/compat.h 2003-06-22 12:04:21.000000000 -0700 @@ -101,7 +101,8 @@ int f_ffree; compat_fsid_t f_fsid; int f_namelen; /* SunOS ignores this field. */ - int f_spare[6]; + int f_frsize; + int f_spare[5]; }; #define COMPAT_RLIM_OLD_INFINITY 0x7fffffff diff -urN linux-2.5.72-bk3/include/asm-x86_64/smp.h linux-2.5.73/include/asm-x86_64/smp.h --- linux-2.5.72-bk3/include/asm-x86_64/smp.h 2003-06-16 21:19:37.000000000 -0700 +++ linux-2.5.73/include/asm-x86_64/smp.h 2003-06-22 12:04:21.000000000 -0700 @@ -66,12 +66,12 @@ cpu = __ffs(mask), mask != 0; \ mask &= ~(1UL<> 4) & 0x0F); } -static inline unsigned long generic_hweight64(u64 w) +static inline unsigned long generic_hweight64(__u64 w) { #if BITS_PER_LONG < 64 return generic_hweight32((unsigned int)(w >> 32)) + diff -urN linux-2.5.72-bk3/include/linux/coda_psdev.h linux-2.5.73/include/linux/coda_psdev.h --- linux-2.5.72-bk3/include/linux/coda_psdev.h 2003-06-16 21:20:01.000000000 -0700 +++ linux-2.5.73/include/linux/coda_psdev.h 2003-06-22 12:04:22.000000000 -0700 @@ -73,7 +73,7 @@ unsigned int cmd, struct PioctlData *data); int coda_downcall(int opcode, union outputArgs *out, struct super_block *sb); int venus_fsync(struct super_block *sb, struct ViceFid *fid); -int venus_statfs(struct super_block *sb, struct statfs *sfs); +int venus_statfs(struct super_block *sb, struct kstatfs *sfs); /* messages between coda filesystem in kernel and Venus */ diff -urN linux-2.5.72-bk3/include/linux/efs_fs.h linux-2.5.73/include/linux/efs_fs.h --- linux-2.5.72-bk3/include/linux/efs_fs.h 2003-06-16 21:20:00.000000000 -0700 +++ linux-2.5.73/include/linux/efs_fs.h 2003-06-22 12:04:22.000000000 -0700 @@ -41,7 +41,7 @@ extern struct address_space_operations efs_symlink_aops; extern int efs_fill_super(struct super_block *, void *, int); -extern int efs_statfs(struct super_block *, struct statfs *); +extern int efs_statfs(struct super_block *, struct kstatfs *); extern void efs_read_inode(struct inode *); extern efs_block_t efs_map_block(struct inode *, efs_block_t); diff -urN linux-2.5.72-bk3/include/linux/ext3_fs.h linux-2.5.73/include/linux/ext3_fs.h --- linux-2.5.72-bk3/include/linux/ext3_fs.h 2003-06-22 12:03:37.000000000 -0700 +++ linux-2.5.73/include/linux/ext3_fs.h 2003-06-22 12:04:22.000000000 -0700 @@ -764,7 +764,7 @@ extern void ext3_write_super_lockfs (struct super_block *); extern void ext3_unlockfs (struct super_block *); extern int ext3_remount (struct super_block *, int *, char *); -extern int ext3_statfs (struct super_block *, struct statfs *); +extern int ext3_statfs (struct super_block *, struct kstatfs *); #define ext3_std_error(sb, errno) \ do { \ diff -urN linux-2.5.72-bk3/include/linux/ext3_fs_i.h linux-2.5.73/include/linux/ext3_fs_i.h --- linux-2.5.72-bk3/include/linux/ext3_fs_i.h 2003-06-16 21:19:39.000000000 -0700 +++ linux-2.5.73/include/linux/ext3_fs_i.h 2003-06-22 12:04:22.000000000 -0700 @@ -66,7 +66,7 @@ struct posix_acl *i_acl; struct posix_acl *i_default_acl; #endif - + struct list_head i_orphan; /* unlinked but open inodes */ /* diff -urN linux-2.5.72-bk3/include/linux/fs.h linux-2.5.73/include/linux/fs.h --- linux-2.5.72-bk3/include/linux/fs.h 2003-06-16 21:19:46.000000000 -0700 +++ linux-2.5.73/include/linux/fs.h 2003-06-22 12:04:22.000000000 -0700 @@ -25,7 +25,7 @@ struct nameidata; struct pipe_inode_info; struct poll_table_struct; -struct statfs; +struct kstatfs; struct vm_area_struct; struct vfsmount; @@ -781,7 +781,7 @@ int (*sync_fs)(struct super_block *sb, int wait); void (*write_super_lockfs) (struct super_block *); void (*unlockfs) (struct super_block *); - int (*statfs) (struct super_block *, struct statfs *); + int (*statfs) (struct super_block *, struct kstatfs *); int (*remount_fs) (struct super_block *, int *, char *); void (*clear_inode) (struct inode *); void (*umount_begin) (struct super_block *); @@ -960,7 +960,7 @@ extern int may_umount(struct vfsmount *); extern long do_mount(char *, char *, char *, unsigned long, void *); -extern int vfs_statfs(struct super_block *, struct statfs *); +extern int vfs_statfs(struct super_block *, struct kstatfs *); /* Return value for VFS lock functions - tells locks.c to lock conventionally * REALLY kosha for root NFS and nfs_lock @@ -1278,7 +1278,7 @@ extern loff_t dcache_dir_lseek(struct file *, loff_t, int); extern int dcache_readdir(struct file *, void *, filldir_t); extern int simple_getattr(struct vfsmount *, struct dentry *, struct kstat *); -extern int simple_statfs(struct super_block *, struct statfs *); +extern int simple_statfs(struct super_block *, struct kstatfs *); extern int simple_link(struct dentry *, struct inode *, struct dentry *); extern int simple_unlink(struct inode *, struct dentry *); extern int simple_rmdir(struct inode *, struct dentry *); diff -urN linux-2.5.72-bk3/include/linux/gfp.h linux-2.5.73/include/linux/gfp.h --- linux-2.5.72-bk3/include/linux/gfp.h 2003-06-16 21:19:46.000000000 -0700 +++ linux-2.5.73/include/linux/gfp.h 2003-06-22 12:04:22.000000000 -0700 @@ -7,7 +7,7 @@ /* * GFP bitmasks.. */ -/* Zone modifiers in GFP_ZONEMASK (see linux/mmzone.h - low four bits) */ +/* Zone modifiers in GFP_ZONEMASK (see linux/mmzone.h - low two bits) */ #define __GFP_DMA 0x01 #define __GFP_HIGHMEM 0x02 diff -urN linux-2.5.72-bk3/include/linux/highmem.h linux-2.5.73/include/linux/highmem.h --- linux-2.5.72-bk3/include/linux/highmem.h 2003-06-16 21:20:19.000000000 -0700 +++ linux-2.5.73/include/linux/highmem.h 2003-06-22 12:04:22.000000000 -0700 @@ -3,6 +3,8 @@ #include #include +#include + #include #ifdef CONFIG_HIGHMEM diff -urN linux-2.5.72-bk3/include/linux/hugetlb.h linux-2.5.73/include/linux/hugetlb.h --- linux-2.5.72-bk3/include/linux/hugetlb.h 2003-06-16 21:20:01.000000000 -0700 +++ linux-2.5.73/include/linux/hugetlb.h 2003-06-22 12:04:22.000000000 -0700 @@ -73,11 +73,28 @@ #ifdef CONFIG_HUGETLBFS struct hugetlbfs_config { - uid_t uid; - gid_t gid; - umode_t mode; + uid_t uid; + gid_t gid; + umode_t mode; + long nr_blocks; + long nr_inodes; }; +struct hugetlbfs_sb_info { + long max_blocks; /* blocks allowed */ + long free_blocks; /* blocks free */ + long max_inodes; /* inodes allowed */ + long free_inodes; /* inodes free */ + spinlock_t stat_lock; +}; + +static inline struct hugetlbfs_sb_info *HUGETLBFS_SB(struct super_block *sb) +{ + return sb->s_fs_info; +} + +#define PSEUDO_DIRENT_SIZE 20 + extern struct file_operations hugetlbfs_file_operations; extern struct vm_operations_struct hugetlb_vm_ops; struct file *hugetlb_zero_setup(size_t); diff -urN linux-2.5.72-bk3/include/linux/input.h linux-2.5.73/include/linux/input.h --- linux-2.5.72-bk3/include/linux/input.h 2003-06-16 21:20:00.000000000 -0700 +++ linux-2.5.73/include/linux/input.h 2003-06-22 12:04:22.000000000 -0700 @@ -358,6 +358,7 @@ #define BTN_EXTRA 0x114 #define BTN_FORWARD 0x115 #define BTN_BACK 0x116 +#define BTN_TASK 0x117 #define BTN_JOYSTICK 0x120 #define BTN_TRIGGER 0x120 diff -urN linux-2.5.72-bk3/include/linux/msdos_fs.h linux-2.5.73/include/linux/msdos_fs.h --- linux-2.5.72-bk3/include/linux/msdos_fs.h 2003-06-16 21:20:20.000000000 -0700 +++ linux-2.5.73/include/linux/msdos_fs.h 2003-06-22 12:04:22.000000000 -0700 @@ -270,7 +270,7 @@ extern void fat_put_super(struct super_block *sb); int fat_fill_super(struct super_block *sb, void *data, int silent, struct inode_operations *fs_dir_inode_ops, int isvfat); -extern int fat_statfs(struct super_block *sb, struct statfs *buf); +extern int fat_statfs(struct super_block *sb, struct kstatfs *buf); extern void fat_write_inode(struct inode *inode, int wait); extern int fat_notify_change(struct dentry * dentry, struct iattr * attr); diff -urN linux-2.5.72-bk3/include/linux/nfsd/nfsd.h linux-2.5.73/include/linux/nfsd/nfsd.h --- linux-2.5.72-bk3/include/linux/nfsd/nfsd.h 2003-06-22 12:03:38.000000000 -0700 +++ linux-2.5.73/include/linux/nfsd/nfsd.h 2003-06-22 12:04:22.000000000 -0700 @@ -113,7 +113,7 @@ int nfsd_readdir(struct svc_rqst *, struct svc_fh *, loff_t *, struct readdir_cd *, encode_dent_fn); int nfsd_statfs(struct svc_rqst *, struct svc_fh *, - struct statfs *); + struct kstatfs *); int nfsd_notify_change(struct inode *, struct iattr *); int nfsd_permission(struct svc_export *, struct dentry *, int); diff -urN linux-2.5.72-bk3/include/linux/nfsd/xdr.h linux-2.5.73/include/linux/nfsd/xdr.h --- linux-2.5.72-bk3/include/linux/nfsd/xdr.h 2003-06-16 21:20:20.000000000 -0700 +++ linux-2.5.73/include/linux/nfsd/xdr.h 2003-06-22 12:04:22.000000000 -0700 @@ -113,7 +113,7 @@ }; struct nfsd_statfsres { - struct statfs stats; + struct kstatfs stats; }; /* diff -urN linux-2.5.72-bk3/include/linux/nfsd/xdr3.h linux-2.5.73/include/linux/nfsd/xdr3.h --- linux-2.5.72-bk3/include/linux/nfsd/xdr3.h 2003-06-16 21:19:47.000000000 -0700 +++ linux-2.5.73/include/linux/nfsd/xdr3.h 2003-06-22 12:04:22.000000000 -0700 @@ -176,7 +176,7 @@ struct nfsd3_fsstatres { __u32 status; - struct statfs stats; + struct kstatfs stats; __u32 invarsec; }; diff -urN linux-2.5.72-bk3/include/linux/pci.h linux-2.5.73/include/linux/pci.h --- linux-2.5.72-bk3/include/linux/pci.h 2003-06-16 21:20:01.000000000 -0700 +++ linux-2.5.73/include/linux/pci.h 2003-06-22 12:04:22.000000000 -0700 @@ -486,6 +486,13 @@ int (*write)(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 val); }; +struct pci_raw_ops { + int (*read)(int dom, int bus, int dev, int func, int reg, int len, u32 *val); + int (*write)(int dom, int bus, int dev, int func, int reg, int len, u32 val); +}; + +extern struct pci_raw_ops *raw_pci_ops; + struct pci_bus_region { unsigned long start; unsigned long end; @@ -549,8 +556,8 @@ void pci_read_bridge_bases(struct pci_bus *child); struct resource *pci_find_parent_resource(const struct pci_dev *dev, struct resource *res); int pci_get_interrupt_pin(struct pci_dev *dev, struct pci_dev **bridge); -extern struct pci_dev *pci_get_dev(struct pci_dev *dev); -extern void pci_put_dev(struct pci_dev *dev); +extern struct pci_dev *pci_dev_get(struct pci_dev *dev); +extern void pci_dev_put(struct pci_dev *dev); extern void pci_remove_bus_device(struct pci_dev *dev); @@ -566,6 +573,10 @@ int pci_find_capability (struct pci_dev *dev, int cap); struct pci_bus * pci_find_next_bus(const struct pci_bus *from); +struct pci_dev *pci_get_device (unsigned int vendor, unsigned int device, struct pci_dev *from); +struct pci_dev *pci_get_subsys (unsigned int vendor, unsigned int device, + unsigned int ss_vendor, unsigned int ss_device, + struct pci_dev *from); int pci_bus_read_config_byte (struct pci_bus *bus, unsigned int devfn, int where, u8 *val); int pci_bus_read_config_word (struct pci_bus *bus, unsigned int devfn, int where, u16 *val); int pci_bus_read_config_dword (struct pci_bus *bus, unsigned int devfn, int where, u32 *val); @@ -688,6 +699,13 @@ unsigned int ss_vendor, unsigned int ss_device, const struct pci_dev *from) { return NULL; } +static inline struct pci_dev *pci_get_device (unsigned int vendor, unsigned int device, struct pci_dev *from) +{ return NULL; } + +static inline struct pci_dev *pci_get_subsys (unsigned int vendor, unsigned int device, +unsigned int ss_vendor, unsigned int ss_device, struct pci_dev *from) +{ return NULL; } + static inline void pci_set_master(struct pci_dev *dev) { } static inline int pci_enable_device(struct pci_dev *dev) { return -EIO; } static inline void pci_disable_device(struct pci_dev *dev) { } @@ -743,6 +761,20 @@ return rc; } +/* + * PCI domain support. Sometimes called PCI segment (eg by ACPI), + * a PCI domain is defined to be a set of PCI busses which share + * configuration space. + */ +#ifndef CONFIG_PCI_DOMAINS +static inline int pci_domain_nr(struct pci_bus *bus) { return 0; } +static inline int pci_name_bus(char *name, struct pci_bus *bus) +{ + sprintf(name, "%02x", bus->number); + return 0; +} +#endif + #endif /* !CONFIG_PCI */ /* these helpers provide future and backwards compatibility @@ -800,15 +832,5 @@ #define PCIPCI_VSFX 16 #define PCIPCI_ALIMAGIK 32 -/* - * PCI domain support. Sometimes called PCI segment (eg by ACPI), - * a PCI domain is defined to be a set of PCI busses which share - * configuration space. - */ - -#ifndef CONFIG_PCI_DOMAINS -static inline int pci_domain_nr(struct pci_bus *bus) { return 0; } -#endif - #endif /* __KERNEL__ */ #endif /* LINUX_PCI_H */ diff -urN linux-2.5.72-bk3/include/linux/pci_ids.h linux-2.5.73/include/linux/pci_ids.h --- linux-2.5.72-bk3/include/linux/pci_ids.h 2003-06-22 12:03:38.000000000 -0700 +++ linux-2.5.73/include/linux/pci_ids.h 2003-06-22 12:04:22.000000000 -0700 @@ -549,6 +549,7 @@ #define PCI_DEVICE_ID_SI_601 0x0601 #define PCI_DEVICE_ID_SI_620 0x0620 #define PCI_DEVICE_ID_SI_630 0x0630 +#define PCI_DEVICE_ID_SI_633 0x0633 #define PCI_DEVICE_ID_SI_635 0x0635 #define PCI_DEVICE_ID_SI_640 0x0640 #define PCI_DEVICE_ID_SI_645 0x0645 @@ -559,6 +560,7 @@ #define PCI_DEVICE_ID_SI_652 0x0652 #define PCI_DEVICE_ID_SI_655 0x0655 #define PCI_DEVICE_ID_SI_730 0x0730 +#define PCI_DEVICE_ID_SI_733 0x0733 #define PCI_DEVICE_ID_SI_630_VGA 0x6300 #define PCI_DEVICE_ID_SI_730_VGA 0x7300 #define PCI_DEVICE_ID_SI_735 0x0735 @@ -579,7 +581,10 @@ #define PCI_DEVICE_ID_SI_5513 0x5513 #define PCI_DEVICE_ID_SI_5518 0x5518 #define PCI_DEVICE_ID_SI_5571 0x5571 +#define PCI_DEVICE_ID_SI_5581 0x5581 +#define PCI_DEVICE_ID_SI_5582 0x5582 #define PCI_DEVICE_ID_SI_5591 0x5591 +#define PCI_DEVICE_ID_SI_5596 0x5596 #define PCI_DEVICE_ID_SI_5597 0x5597 #define PCI_DEVICE_ID_SI_5598 0x5598 #define PCI_DEVICE_ID_SI_5600 0x5600 diff -urN linux-2.5.72-bk3/include/linux/sched.h linux-2.5.73/include/linux/sched.h --- linux-2.5.72-bk3/include/linux/sched.h 2003-06-16 21:19:40.000000000 -0700 +++ linux-2.5.73/include/linux/sched.h 2003-06-22 12:04:22.000000000 -0700 @@ -148,10 +148,15 @@ extern void init_idle(task_t *idle, int cpu); extern void show_state(void); -extern void show_trace(unsigned long *stack); -extern void show_stack(unsigned long *stack); extern void show_regs(struct pt_regs *); +/* + * TASK is a pointer to the task whose backtrace we want to see (or NULL for current + * task), SP is the stack pointer of the first frame that should be shown in the back + * trace (or NULL if the entire call-chain of the task should be shown). + */ +extern void show_stack(struct task_struct *task, unsigned long *sp); + void io_schedule(void); long io_schedule_timeout(long timeout); @@ -478,9 +483,12 @@ #define PF_LESS_THROTTLE 0x01000000 /* Throttle me less: I clena memory */ #ifdef CONFIG_SMP -extern void set_cpus_allowed(task_t *p, unsigned long new_mask); +extern int set_cpus_allowed(task_t *p, unsigned long new_mask); #else -# define set_cpus_allowed(p, new_mask) do { } while (0) +static inline int set_cpus_allowed(task_t *p, unsigned long new_mask) +{ + return 0; +} #endif #ifdef CONFIG_NUMA diff -urN linux-2.5.72-bk3/include/linux/sem.h linux-2.5.73/include/linux/sem.h --- linux-2.5.72-bk3/include/linux/sem.h 2003-06-16 21:19:59.000000000 -0700 +++ linux-2.5.73/include/linux/sem.h 2003-06-22 12:04:22.000000000 -0700 @@ -128,13 +128,11 @@ struct sem_undo_list { atomic_t refcnt; spinlock_t lock; - volatile unsigned long add_count; struct sem_undo *proc_list; }; struct sysv_sem { struct sem_undo_list *undo_list; - struct sem_queue *sleep_list; }; asmlinkage long sys_semget (key_t key, int nsems, int semflg); @@ -143,6 +141,8 @@ asmlinkage long sys_semtimedop(int semid, struct sembuf __user *sops, unsigned nsops, const struct timespec __user *timeout); +void exit_sem(struct task_struct *p); + #endif /* __KERNEL__ */ #endif /* _LINUX_SEM_H */ diff -urN linux-2.5.72-bk3/include/linux/serio.h linux-2.5.73/include/linux/serio.h --- linux-2.5.72-bk3/include/linux/serio.h 2003-06-16 21:20:05.000000000 -0700 +++ linux-2.5.73/include/linux/serio.h 2003-06-22 12:04:22.000000000 -0700 @@ -26,7 +26,6 @@ void *driver; char *name; char *phys; - int number; unsigned short idbus; unsigned short idvendor; diff -urN linux-2.5.72-bk3/include/linux/smbno.h linux-2.5.73/include/linux/smbno.h --- linux-2.5.72-bk3/include/linux/smbno.h 2003-06-16 21:20:05.000000000 -0700 +++ linux-2.5.73/include/linux/smbno.h 2003-06-22 12:04:22.000000000 -0700 @@ -347,8 +347,8 @@ #define SMB_MODE_NO_CHANGE 0xFFFFFFFF #define SMB_UID_NO_CHANGE 0xFFFFFFFF #define SMB_GID_NO_CHANGE 0xFFFFFFFF -#define SMB_TIME_NO_CHANGE 0xFFFFFFFFFFFFFFFF -#define SMB_SIZE_NO_CHANGE 0xFFFFFFFFFFFFFFFF +#define SMB_TIME_NO_CHANGE 0xFFFFFFFFFFFFFFFFULL +#define SMB_SIZE_NO_CHANGE 0xFFFFFFFFFFFFFFFFULL /* UNIX filetype mappings. */ #define UNIX_TYPE_FILE 0 diff -urN linux-2.5.72-bk3/include/linux/spinlock.h linux-2.5.73/include/linux/spinlock.h --- linux-2.5.72-bk3/include/linux/spinlock.h 2003-06-22 12:03:38.000000000 -0700 +++ linux-2.5.73/include/linux/spinlock.h 2003-06-22 12:04:22.000000000 -0700 @@ -146,13 +146,8 @@ /* * gcc versions before ~2.95 have a nasty bug with empty initializers. */ -#if (__GNUC__ > 2) - typedef struct { } spinlock_t; - #define SPIN_LOCK_UNLOCKED (spinlock_t) { } -#else - typedef struct { int gcc_is_buggy; } spinlock_t; - #define SPIN_LOCK_UNLOCKED (spinlock_t) { 0 } -#endif +typedef struct { } spinlock_t; +#define SPIN_LOCK_UNLOCKED (spinlock_t) { } /* * If CONFIG_SMP is unset, declare the _raw_* definitions as nops diff -urN linux-2.5.72-bk3/include/linux/statfs.h linux-2.5.73/include/linux/statfs.h --- linux-2.5.72-bk3/include/linux/statfs.h 1969-12-31 16:00:00.000000000 -0800 +++ linux-2.5.73/include/linux/statfs.h 2003-06-22 12:04:22.000000000 -0700 @@ -0,0 +1,22 @@ +#ifndef _LINUX_STATFS_H +#define _LINUX_STATFS_H + +#include + +#include + +struct kstatfs { + long f_type; + long f_bsize; + sector_t f_blocks; + sector_t f_bfree; + sector_t f_bavail; + sector_t f_files; + sector_t f_ffree; + __kernel_fsid_t f_fsid; + long f_namelen; + long f_frsize; + long f_spare[5]; +}; + +#endif diff -urN linux-2.5.72-bk3/include/linux/time.h linux-2.5.73/include/linux/time.h --- linux-2.5.72-bk3/include/linux/time.h 2003-06-16 21:20:06.000000000 -0700 +++ linux-2.5.73/include/linux/time.h 2003-06-22 12:04:23.000000000 -0700 @@ -130,7 +130,8 @@ timeval_to_jiffies(struct timeval *value) { unsigned long sec = value->tv_sec; - long usec = value->tv_usec + TICK_USEC - 1; + long usec = value->tv_usec + + ((TICK_NSEC + 1000UL/2) / 1000UL) - 1; if (sec >= MAX_SEC_IN_JIFFIES){ sec = MAX_SEC_IN_JIFFIES; diff -urN linux-2.5.72-bk3/include/linux/timex.h linux-2.5.73/include/linux/timex.h --- linux-2.5.72-bk3/include/linux/timex.h 2003-06-16 21:19:39.000000000 -0700 +++ linux-2.5.73/include/linux/timex.h 2003-06-22 12:04:23.000000000 -0700 @@ -176,7 +176,7 @@ #define TICK_NSEC (SH_DIV (1000000UL * 1000, ACTHZ, 8)) /* TICK_USEC is the time between ticks in usec assuming fake USER_HZ */ -#define TICK_USEC ((TICK_NSEC + 1000UL/2) / 1000UL) +#define TICK_USEC ((1000000UL + USER_HZ/2) / USER_HZ) /* TICK_USEC_TO_NSEC is the time between ticks in nsec assuming real ACTHZ and */ /* a value TUSEC for TICK_USEC (can be set bij adjtimex) */ diff -urN linux-2.5.72-bk3/include/linux/vfs.h linux-2.5.73/include/linux/vfs.h --- linux-2.5.72-bk3/include/linux/vfs.h 2003-06-16 21:20:00.000000000 -0700 +++ linux-2.5.73/include/linux/vfs.h 2003-06-22 12:04:23.000000000 -0700 @@ -1,6 +1,6 @@ #ifndef _LINUX_VFS_H #define _LINUX_VFS_H -#include +#include #endif diff -urN linux-2.5.72-bk3/ipc/sem.c linux-2.5.73/ipc/sem.c --- linux-2.5.72-bk3/ipc/sem.c 2003-06-16 21:19:59.000000000 -0700 +++ linux-2.5.73/ipc/sem.c 2003-06-22 12:04:23.000000000 -0700 @@ -214,7 +214,7 @@ return -EIDRM; } - if (ipcperms(&sma->sem_perm, flg)) { + if (flg && ipcperms(&sma->sem_perm, flg)) { sem_unlock(smanew); return -EACCES; } @@ -412,7 +412,7 @@ int size; /* Invalidate the existing undo structures for this semaphore set. - * (They will be freed without any further action in sem_exit() + * (They will be freed without any further action in exit_sem() * or during the next semop.) */ for (un = sma->undo; un; un = un->id_next) @@ -887,106 +887,87 @@ return 0; } -static struct sem_undo* freeundos(struct sem_undo* un) +static struct sem_undo *lookup_undo(struct sem_undo_list *ulp, int semid) { - struct sem_undo* u; - struct sem_undo** up; + struct sem_undo **last, *un; - for(up = ¤t->sysvsem.undo_list->proc_list;(u=*up);up=&u->proc_next) { - if(un==u) { - un=u->proc_next; - *up=un; - kfree(u); - return un; - } - } - printk ("freeundos undo list error id=%d\n", un->semid); - return un->proc_next; -} - -static inline struct sem_undo *find_undo(int semid) -{ - struct sem_undo *un; - - un = NULL; - if (current->sysvsem.undo_list != NULL) { - un = current->sysvsem.undo_list->proc_list; - } + last = &ulp->proc_list; + un = *last; while(un != NULL) { if(un->semid==semid) break; - if(un->semid==-1) - un=freeundos(un); - else - un=un->proc_next; + if(un->semid==-1) { + *last=un->proc_next; + kfree(un); + } else { + last=&un->proc_next; + } + un=*last; } return un; } -/* returns without sem_lock and semundo list locks on error! */ -static int alloc_undo(struct sem_array *sma, struct sem_undo** unp, int semid, int alter) +static struct sem_undo *find_undo(int semid) { - int size, nsems, error; - struct sem_undo *un, *new_un; - struct sem_undo_list *undo_list; - unsigned long saved_add_count; + struct sem_array *sma; + struct sem_undo_list *ulp; + struct sem_undo *un, *new; + int nsems; + int error; + error = get_undo_list(&ulp); + if (error) + return ERR_PTR(error); - nsems = sma->sem_nsems; - saved_add_count = 0; - if (current->sysvsem.undo_list != NULL) - saved_add_count = current->sysvsem.undo_list->add_count; - sem_unlock(sma); + lock_semundo(); + un = lookup_undo(ulp, semid); unlock_semundo(); + if (likely(un!=NULL)) + goto out; - error = get_undo_list(&undo_list); - if (error) - return error; + /* no undo structure around - allocate one. */ + sma = sem_lock(semid); + un = ERR_PTR(-EINVAL); + if(sma==NULL) + goto out; + un = ERR_PTR(-EIDRM); + if (sem_checkid(sma,semid)) + goto out_unlock; + nsems = sma->sem_nsems; + sem_unlock(sma); - size = sizeof(struct sem_undo) + sizeof(short)*nsems; - un = (struct sem_undo *) kmalloc(size, GFP_KERNEL); - if (!un) - return -ENOMEM; + new = (struct sem_undo *) kmalloc(sizeof(struct sem_undo) + sizeof(short)*nsems, GFP_KERNEL); + if (!new) + return ERR_PTR(-ENOMEM); + memset(new, 0, sizeof(struct sem_undo) + sizeof(short)*nsems); + new->semadj = (short *) &new[1]; + new->semid = semid; - memset(un, 0, size); lock_semundo(); - error = sem_revalidate(semid, sma, nsems, alter ? S_IWUGO : S_IRUGO); - if(error) { + un = lookup_undo(ulp, semid); + if (un) { unlock_semundo(); - kfree(un); - return error; + kfree(new); + goto out; } - - - /* alloc_undo has just - * released all locks and reacquired them. - * But, another thread may have - * added the semundo we were looking for - * during that time. - * So, we check for it again. - * only initialize and add the new one - * if we don't discover one. - */ - new_un = NULL; - if (current->sysvsem.undo_list->add_count != saved_add_count) - new_un = find_undo(semid); - - if (new_un != NULL) { - if (sma->undo != new_un) - BUG(); - kfree(un); - un = new_un; - } else { - current->sysvsem.undo_list->add_count++; - un->semadj = (short *) &un[1]; - un->semid = semid; - un->proc_next = undo_list->proc_list; - undo_list->proc_list = un; - un->id_next = sma->undo; - sma->undo = un; - } - *unp = un; - return 0; + error = sem_revalidate(semid, sma, nsems, 0); + if (error) { + sem_unlock(sma); + unlock_semundo(); + kfree(new); + un = ERR_PTR(error); + goto out; + } + new->proc_next = ulp->proc_list; + ulp->proc_list = new; + new->id_next = sma->undo; + sma->undo = new; + sem_unlock(sma); + un = new; +out_unlock: + unlock_semundo(); +out: + return un; } asmlinkage long sys_semop (int semid, struct sembuf *tsops, unsigned nsops) @@ -1002,7 +983,7 @@ struct sembuf fast_sops[SEMOPM_FAST]; struct sembuf* sops = fast_sops, *sop; struct sem_undo *un; - int undos = 0, decrease = 0, alter = 0; + int undos = 0, decrease = 0, alter = 0, max; struct sem_queue queue; unsigned long jiffies_left = 0; @@ -1032,18 +1013,10 @@ } jiffies_left = timespec_to_jiffies(&_timeout); } - lock_semundo(); - sma = sem_lock(semid); - error=-EINVAL; - if(sma==NULL) - goto out_semundo_free; - error = -EIDRM; - if (sem_checkid(sma,semid)) - goto out_unlock_semundo_free; - error = -EFBIG; + max = 0; for (sop = sops; sop < sops + nsops; sop++) { - if (sop->sem_num >= sma->sem_nsems) - goto out_unlock_semundo_free; + if (sop->sem_num >= max) + max = sop->sem_num; if (sop->sem_flg & SEM_UNDO) undos++; if (sop->sem_op < 0) @@ -1053,30 +1026,42 @@ } alter |= decrease; - error = -EACCES; - if (ipcperms(&sma->sem_perm, alter ? S_IWUGO : S_IRUGO)) - goto out_unlock_semundo_free; - - error = security_sem_semop(sma, sops, nsops, alter); - if (error) - goto out_unlock_semundo_free; - - error = -EACCES; +retry_undos: if (undos) { - /* Make sure we have an undo structure - * for this process and this semaphore set. - */ - un = find_undo(semid); - if (!un) { - error = alloc_undo(sma,&un,semid,alter); - if (error) - goto out_free; - + if (IS_ERR(un)) { + error = PTR_ERR(un); + goto out_free; } } else un = NULL; + sma = sem_lock(semid); + error=-EINVAL; + if(sma==NULL) + goto out_free; + error = -EIDRM; + if (sem_checkid(sma,semid)) + goto out_unlock_free; + /* + * semid identifies are not unique - find_undo may have + * allocated an undo structure, it was invalidated by an RMID + * and now a new array with received the same id. Check and retry. + */ + if (un && un->semid == -1) + goto retry_undos; + error = -EFBIG; + if (max >= sma->sem_nsems) + goto out_unlock_free; + + error = -EACCES; + if (ipcperms(&sma->sem_perm, alter ? S_IWUGO : S_IRUGO)) + goto out_unlock_free; + + error = security_sem_semop(sma, sops, nsops, alter); + if (error) + goto out_unlock_free; + error = try_atomic_semop (sma, sops, nsops, un, current->pid, 0); if (error <= 0) goto update; @@ -1096,28 +1081,24 @@ append_to_queue(sma ,&queue); else prepend_to_queue(sma ,&queue); - current->sysvsem.sleep_list = &queue; for (;;) { queue.status = -EINTR; queue.sleeper = current; current->state = TASK_INTERRUPTIBLE; sem_unlock(sma); - unlock_semundo(); if (timeout) jiffies_left = schedule_timeout(jiffies_left); else schedule(); - lock_semundo(); sma = sem_lock(semid); if(sma==NULL) { if(queue.prev != NULL) BUG(); - current->sysvsem.sleep_list = NULL; error = -EIDRM; - goto out_semundo_free; + goto out_free; } /* * If queue.status == 1 we where woken up and @@ -1139,19 +1120,15 @@ if (queue.prev) /* got Interrupt */ break; /* Everything done by update_queue */ - current->sysvsem.sleep_list = NULL; - goto out_unlock_semundo_free; + goto out_unlock_free; } } - current->sysvsem.sleep_list = NULL; remove_from_queue(sma,&queue); update: if (alter) update_queue (sma); -out_unlock_semundo_free: +out_unlock_free: sem_unlock(sma); -out_semundo_free: - unlock_semundo(); out_free: if(sops != fast_sops) kfree(sops); @@ -1185,21 +1162,6 @@ return 0; } -static inline void __exit_semundo(struct task_struct *tsk) -{ - struct sem_undo_list *undo_list; - - undo_list = tsk->sysvsem.undo_list; - if (!atomic_dec_and_test(&undo_list->refcnt)) - kfree(undo_list); -} - -void exit_semundo(struct task_struct *tsk) -{ - if (tsk->sysvsem.undo_list != NULL) - __exit_semundo(tsk); -} - /* * add semadj values to semaphores, free undo structures. * undo structures are not freed when semaphore arrays are destroyed @@ -1212,44 +1174,29 @@ * The current implementation does not do so. The POSIX standard * and SVID should be consulted to determine what behavior is mandated. */ -void sem_exit (void) +void exit_sem(struct task_struct *tsk) { - struct sem_queue *q; - struct sem_undo *u, *un = NULL, **up, **unp; - struct sem_array *sma; struct sem_undo_list *undo_list; - int nsems, i; + struct sem_undo *u, **up; - lock_kernel(); - - /* If the current process was sleeping for a semaphore, - * remove it from the queue. - */ - if ((q = current->sysvsem.sleep_list)) { - int semid = q->id; - sma = sem_lock(semid); - current->sysvsem.sleep_list = NULL; - - if (q->prev) { - if(sma==NULL) - BUG(); - remove_from_queue(q->sma,q); - } - if(sma!=NULL) - sem_unlock(sma); - } + undo_list = tsk->sysvsem.undo_list; + if (!undo_list) + return; - undo_list = current->sysvsem.undo_list; - if ((undo_list == NULL) || (atomic_read(&undo_list->refcnt) != 1)) { - unlock_kernel(); + if (!atomic_dec_and_test(&undo_list->refcnt)) return; - } /* There's no need to hold the semundo list lock, as current * is the last task exiting for this undo list. */ for (up = &undo_list->proc_list; (u = *up); *up = u->proc_next, kfree(u)) { - int semid = u->semid; + struct sem_array *sma; + int nsems, i; + struct sem_undo *un, **unp; + int semid; + + semid = u->semid; + if(semid == -1) continue; sma = sem_lock(semid); @@ -1259,15 +1206,14 @@ if (u->semid == -1) goto next_entry; - if (sem_checkid(sma,u->semid)) - goto next_entry; + BUG_ON(sem_checkid(sma,u->semid)); /* remove u from the sma->undo list */ for (unp = &sma->undo; (un = *unp); unp = &un->id_next) { if (u == un) goto found; } - printk ("sem_exit undo list error id=%d\n", u->semid); + printk ("exit_sem undo list error id=%d\n", u->semid); goto next_entry; found: *unp = un->id_next; @@ -1275,10 +1221,12 @@ nsems = sma->sem_nsems; for (i = 0; i < nsems; i++) { struct sem * sem = &sma->sem_base[i]; - sem->semval += u->semadj[i]; - if (sem->semval < 0) - sem->semval = 0; /* shouldn't happen */ - sem->sempid = current->pid; + if (u->semadj[i]) { + sem->semval += u->semadj[i]; + if (sem->semval < 0) + sem->semval = 0; /* shouldn't happen */ + sem->sempid = current->pid; + } } sma->sem_otime = get_seconds(); /* maybe some queued-up processes were waiting for this */ @@ -1286,9 +1234,7 @@ next_entry: sem_unlock(sma); } - __exit_semundo(current); - - unlock_kernel(); + kfree(undo_list); } #ifdef CONFIG_PROC_FS diff -urN linux-2.5.72-bk3/ipc/util.c linux-2.5.73/ipc/util.c --- linux-2.5.72-bk3/ipc/util.c 2003-06-16 21:19:59.000000000 -0700 +++ linux-2.5.73/ipc/util.c 2003-06-22 12:04:23.000000000 -0700 @@ -541,17 +541,11 @@ return 0; } -void exit_semundo(struct task_struct *tsk) +void exit_sem(struct task_struct *tsk) { return; } - -void sem_exit (void) -{ - return; -} - asmlinkage long sys_semget (key_t key, int nsems, int semflg) { return -ENOSYS; diff -urN linux-2.5.72-bk3/kernel/acct.c linux-2.5.73/kernel/acct.c --- linux-2.5.72-bk3/kernel/acct.c 2003-06-16 21:20:02.000000000 -0700 +++ linux-2.5.73/kernel/acct.c 2003-06-22 12:04:23.000000000 -0700 @@ -54,6 +54,7 @@ #include #include #include +#include /* sector_div */ /* * These constants control the amount of freespace that suspend and @@ -100,9 +101,11 @@ */ static int check_free_space(struct file *file) { - struct statfs sbuf; + struct kstatfs sbuf; int res; int act; + sector_t resume; + sector_t suspend; spin_lock(&acct_globals.lock); res = acct_globals.active; @@ -113,10 +116,15 @@ /* May block */ if (vfs_statfs(file->f_dentry->d_inode->i_sb, &sbuf)) return res; + suspend = sbuf.f_blocks * SUSPEND; + resume = sbuf.f_blocks * RESUME; - if (sbuf.f_bavail <= SUSPEND * sbuf.f_blocks / 100) + sector_div(suspend, 100); + sector_div(resume, 100); + + if (sbuf.f_bavail <= suspend) act = -1; - else if (sbuf.f_bavail >= RESUME * sbuf.f_blocks / 100) + else if (sbuf.f_bavail >= resume) act = 1; else act = 0; diff -urN linux-2.5.72-bk3/kernel/exit.c linux-2.5.73/kernel/exit.c --- linux-2.5.72-bk3/kernel/exit.c 2003-06-16 21:20:22.000000000 -0700 +++ linux-2.5.73/kernel/exit.c 2003-06-22 12:04:23.000000000 -0700 @@ -698,7 +698,7 @@ acct_process(code); __exit_mm(tsk); - sem_exit(); + exit_sem(tsk); __exit_files(tsk); __exit_fs(tsk); exit_namespace(tsk); diff -urN linux-2.5.72-bk3/kernel/fork.c linux-2.5.73/kernel/fork.c --- linux-2.5.72-bk3/kernel/fork.c 2003-06-16 21:19:40.000000000 -0700 +++ linux-2.5.73/kernel/fork.c 2003-06-22 12:04:23.000000000 -0700 @@ -39,7 +39,7 @@ #include extern int copy_semundo(unsigned long clone_flags, struct task_struct *tsk); -extern void exit_semundo(struct task_struct *tsk); +extern void exit_sem(struct task_struct *tsk); /* The idle threads do not count.. * Protected by write_lock_irq(&tasklist_lock) @@ -887,13 +887,11 @@ if (retval) goto bad_fork_cleanup_namespace; - if (clone_flags & CLONE_CHILD_SETTID) - p->set_child_tid = child_tidptr; + p->set_child_tid = (clone_flags & CLONE_CHILD_SETTID) ? child_tidptr : NULL; /* * Clear TID on mm_release()? */ - if (clone_flags & CLONE_CHILD_CLEARTID) - p->clear_child_tid = child_tidptr; + p->clear_child_tid = (clone_flags & CLONE_CHILD_CLEARTID) ? child_tidptr: NULL; /* * Syscall tracing should be turned off in the child regardless @@ -1034,7 +1032,7 @@ bad_fork_cleanup_files: exit_files(p); /* blocking */ bad_fork_cleanup_semundo: - exit_semundo(p); + exit_sem(p); bad_fork_cleanup_security: security_task_free(p); bad_fork_cleanup: diff -urN linux-2.5.72-bk3/kernel/kmod.c linux-2.5.73/kernel/kmod.c --- linux-2.5.72-bk3/kernel/kmod.c 2003-06-16 21:19:47.000000000 -0700 +++ linux-2.5.73/kernel/kmod.c 2003-06-22 12:04:23.000000000 -0700 @@ -183,12 +183,15 @@ struct subprocess_info *sub_info = data; pid_t pid; - pid = kernel_thread(____call_usermodehelper, sub_info, - CLONE_VFORK | SIGCHLD); + sub_info->retval = 0; + pid = kernel_thread(____call_usermodehelper, sub_info, SIGCHLD); if (pid < 0) sub_info->retval = pid; else - sys_wait4(pid, (unsigned int *)&sub_info->retval, 0, NULL); + /* We don't have a SIGCHLD signal handler, so this + * always returns -ECHILD, but the important thing is + * that it blocks. */ + sys_wait4(pid, NULL, 0, NULL); complete(sub_info->complete); return 0; @@ -231,8 +234,7 @@ * (ie. it runs with full root capabilities). * * Must be called from process context. Returns a negative error code - * if program was not execed successfully, or (exitcode << 8 + signal) - * of the application (0 if wait is not set). + * if program was not execed successfully, or 0. */ int call_usermodehelper(char *path, char **argv, char **envp, int wait) { diff -urN linux-2.5.72-bk3/kernel/sched.c linux-2.5.73/kernel/sched.c --- linux-2.5.72-bk3/kernel/sched.c 2003-06-16 21:20:20.000000000 -0700 +++ linux-2.5.73/kernel/sched.c 2003-06-22 12:04:23.000000000 -0700 @@ -1880,10 +1880,6 @@ if (copy_from_user(&new_mask, user_mask_ptr, sizeof(new_mask))) return -EFAULT; - new_mask &= cpu_online_map; - if (!new_mask) - return -EINVAL; - read_lock(&tasklist_lock); p = find_process_by_pid(pid); @@ -1905,8 +1901,7 @@ !capable(CAP_SYS_NICE)) goto out_unlock; - retval = 0; - set_cpus_allowed(p, new_mask); + retval = set_cpus_allowed(p, new_mask); out_unlock: put_task_struct(p); @@ -2182,10 +2177,7 @@ else printk(" (NOTLB)\n"); - { - extern void show_trace_task(task_t *tsk); - show_trace_task(p); - } + show_stack(p, NULL); } void show_state(void) @@ -2272,17 +2264,14 @@ * task must not exit() & deallocate itself prematurely. The * call is not atomic; no spinlocks may be held. */ -void set_cpus_allowed(task_t *p, unsigned long new_mask) +int set_cpus_allowed(task_t *p, unsigned long new_mask) { unsigned long flags; migration_req_t req; runqueue_t *rq; -#if 0 /* FIXME: Grab cpu_lock, return error on this case. --RR */ - new_mask &= cpu_online_map; - if (!new_mask) - BUG(); -#endif + if (any_online_cpu(new_mask) == NR_CPUS) + return -EINVAL; rq = task_rq_lock(p, &flags); p->cpus_allowed = new_mask; @@ -2292,7 +2281,7 @@ */ if (new_mask & (1UL << task_cpu(p))) { task_rq_unlock(rq, &flags); - return; + return 0; } /* * If the task is not on a runqueue (and not running), then @@ -2301,7 +2290,7 @@ if (!p->array && !task_running(rq, p)) { set_task_cpu(p, any_online_cpu(p->cpus_allowed)); task_rq_unlock(rq, &flags); - return; + return 0; } init_completion(&req.done); req.task = p; @@ -2311,6 +2300,7 @@ wake_up_process(rq->migration_thread); wait_for_completion(&req.done); + return 0; } /* Move (not current) task off this cpu, onto dest cpu. */ diff -urN linux-2.5.72-bk3/kernel/timer.c linux-2.5.73/kernel/timer.c --- linux-2.5.72-bk3/kernel/timer.c 2003-06-16 21:20:21.000000000 -0700 +++ linux-2.5.73/kernel/timer.c 2003-06-22 12:04:23.000000000 -0700 @@ -439,8 +439,8 @@ /* * Timekeeping variables */ -unsigned long tick_usec = TICK_USEC; /* ACTHZ period (usec) */ -unsigned long tick_nsec = TICK_NSEC; /* USER_HZ period (nsec) */ +unsigned long tick_usec = TICK_USEC; /* USER_HZ period (usec) */ +unsigned long tick_nsec = TICK_NSEC; /* ACTHZ period (nsec) */ /* * The current time diff -urN linux-2.5.72-bk3/kernel/workqueue.c linux-2.5.73/kernel/workqueue.c --- linux-2.5.72-bk3/kernel/workqueue.c 2003-06-16 21:20:27.000000000 -0700 +++ linux-2.5.73/kernel/workqueue.c 2003-06-22 12:04:23.000000000 -0700 @@ -259,15 +259,40 @@ } } -struct workqueue_struct *create_workqueue(const char *name) +static int create_workqueue_thread(struct workqueue_struct *wq, + const char *name, + int cpu) { - int ret, cpu, destroy = 0; - struct cpu_workqueue_struct *cwq; startup_t startup; + struct cpu_workqueue_struct *cwq = wq->cpu_wq + cpu; + int ret; + + spin_lock_init(&cwq->lock); + cwq->wq = wq; + cwq->thread = NULL; + cwq->insert_sequence = 0; + cwq->remove_sequence = 0; + INIT_LIST_HEAD(&cwq->worklist); + init_waitqueue_head(&cwq->more_work); + init_waitqueue_head(&cwq->work_done); + + init_completion(&startup.done); + startup.cwq = cwq; + startup.name = name; + ret = kernel_thread(worker_thread, &startup, CLONE_FS | CLONE_FILES); + if (ret >= 0) { + wait_for_completion(&startup.done); + BUG_ON(!cwq->thread); + } + return ret; +} + +struct workqueue_struct *create_workqueue(const char *name) +{ + int cpu, destroy = 0; struct workqueue_struct *wq; BUG_ON(strlen(name) > 10); - startup.name = name; wq = kmalloc(sizeof(*wq), GFP_KERNEL); if (!wq) @@ -276,27 +301,8 @@ for (cpu = 0; cpu < NR_CPUS; cpu++) { if (!cpu_online(cpu)) continue; - cwq = wq->cpu_wq + cpu; - - spin_lock_init(&cwq->lock); - cwq->wq = wq; - cwq->thread = NULL; - cwq->insert_sequence = 0; - cwq->remove_sequence = 0; - INIT_LIST_HEAD(&cwq->worklist); - init_waitqueue_head(&cwq->more_work); - init_waitqueue_head(&cwq->work_done); - - init_completion(&startup.done); - startup.cwq = cwq; - ret = kernel_thread(worker_thread, &startup, - CLONE_FS | CLONE_FILES); - if (ret < 0) + if (create_workqueue_thread(wq, name, cpu) < 0) destroy = 1; - else { - wait_for_completion(&startup.done); - BUG_ON(!cwq->thread); - } } /* * Was there any error during startup? If yes then clean up: @@ -308,28 +314,33 @@ return wq; } -void destroy_workqueue(struct workqueue_struct *wq) +static void cleanup_workqueue_thread(struct workqueue_struct *wq, int cpu) { struct cpu_workqueue_struct *cwq; - int cpu; - flush_workqueue(wq); - - for (cpu = 0; cpu < NR_CPUS; cpu++) { - if (!cpu_online(cpu)) - continue; - cwq = wq->cpu_wq + cpu; - if (!cwq->thread) - continue; - /* - * Initiate an exit and wait for it: - */ + cwq = wq->cpu_wq + cpu; + if (cwq->thread) { + printk("Cleaning up workqueue thread for %i\n", cpu); + /* Initiate an exit and wait for it: */ init_completion(&cwq->exit); + wmb(); /* Thread must see !cwq->thread after completion init */ cwq->thread = NULL; wake_up(&cwq->more_work); wait_for_completion(&cwq->exit); } +} + +void destroy_workqueue(struct workqueue_struct *wq) +{ + int cpu; + + flush_workqueue(wq); + + for (cpu = 0; cpu < NR_CPUS; cpu++) { + if (cpu_online(cpu)) + cleanup_workqueue_thread(wq, cpu); + } kfree(wq); } diff -urN linux-2.5.72-bk3/mm/page-writeback.c linux-2.5.73/mm/page-writeback.c --- linux-2.5.72-bk3/mm/page-writeback.c 2003-06-16 21:20:07.000000000 -0700 +++ linux-2.5.73/mm/page-writeback.c 2003-06-22 12:04:23.000000000 -0700 @@ -323,7 +323,8 @@ oldest_jif = jiffies - (dirty_expire_centisecs * HZ) / 100; start_jif = jiffies; next_jif = start_jif + (dirty_writeback_centisecs * HZ) / 100; - nr_to_write = ps.nr_dirty + ps.nr_unstable; + nr_to_write = ps.nr_dirty + ps.nr_unstable + + (inodes_stat.nr_inodes - inodes_stat.nr_unused); while (nr_to_write > 0) { wbc.encountered_congestion = 0; wbc.nr_to_write = MAX_WRITEBACK_PAGES; @@ -516,7 +517,9 @@ list_add(&page->list, &mapping->dirty_pages); } spin_unlock(&mapping->page_lock); - __mark_inode_dirty(mapping->host, I_DIRTY_PAGES); + if (!PageSwapCache(page)) + __mark_inode_dirty(mapping->host, + I_DIRTY_PAGES); } } return ret; diff -urN linux-2.5.72-bk3/mm/shmem.c linux-2.5.73/mm/shmem.c --- linux-2.5.72-bk3/mm/shmem.c 2003-06-16 21:20:00.000000000 -0700 +++ linux-2.5.73/mm/shmem.c 2003-06-22 12:04:23.000000000 -0700 @@ -1010,7 +1010,7 @@ struct inode *inode = file->f_dentry->d_inode; ops = &shmem_vm_ops; - if (!inode->i_sb || !S_ISREG(inode->i_mode)) + if (!S_ISREG(inode->i_mode)) return -EACCES; update_atime(inode); vma->vm_ops = ops; @@ -1352,7 +1352,7 @@ return desc.error; } -static int shmem_statfs(struct super_block *sb, struct statfs *buf) +static int shmem_statfs(struct super_block *sb, struct kstatfs *buf) { struct shmem_sb_info *sbinfo = SHMEM_SB(sb); diff -urN linux-2.5.72-bk3/mm/slab.c linux-2.5.73/mm/slab.c --- linux-2.5.72-bk3/mm/slab.c 2003-06-16 21:20:20.000000000 -0700 +++ linux-2.5.73/mm/slab.c 2003-06-22 12:04:23.000000000 -0700 @@ -475,8 +475,6 @@ *left_over = wastage; } -#if DEBUG - #define slab_error(cachep, msg) __slab_error(__FUNCTION__, cachep, msg) static void __slab_error(const char *function, kmem_cache_t *cachep, char *msg) @@ -486,8 +484,6 @@ dump_stack(); } -#endif - /* * Start the reap timer running on the target CPU. We run at around 1 to 2Hz. * Add the CPU number into the expiry time to minimize the possibility of the @@ -1307,6 +1303,8 @@ */ int kmem_cache_destroy (kmem_cache_t * cachep) { + int i; + if (!cachep || in_interrupt()) BUG(); @@ -1319,21 +1317,19 @@ up(&cache_chain_sem); if (__cache_shrink(cachep)) { - printk(KERN_ERR "kmem_cache_destroy: Can't free all objects %p\n", - cachep); + slab_error(cachep, "Can't free all objects"); down(&cache_chain_sem); list_add(&cachep->next,&cache_chain); up(&cache_chain_sem); return 1; } - { - int i; - for (i = 0; i < NR_CPUS; i++) - kfree(cachep->array[i]); - /* NUMA: free the list3 structures */ - kfree(cachep->lists.shared); - cachep->lists.shared = NULL; - } + + for (i = 0; i < NR_CPUS; i++) + kfree(cachep->array[i]); + + /* NUMA: free the list3 structures */ + kfree(cachep->lists.shared); + cachep->lists.shared = NULL; kmem_cache_free(&cache_cache, cachep); return 0; @@ -1749,8 +1745,10 @@ if (!objp) return objp; - if (cachep->flags & SLAB_POISON) + if (cachep->flags & SLAB_POISON) { check_poison_obj(cachep, objp); + poison_obj(cachep, objp, POISON_BEFORE); + } if (cachep->flags & SLAB_STORE_USER) { objlen -= BYTES_PER_WORD; *((void **)(objp+objlen)) = caller; diff -urN linux-2.5.72-bk3/mm/swap_state.c linux-2.5.73/mm/swap_state.c --- linux-2.5.72-bk3/mm/swap_state.c 2003-06-16 21:20:00.000000000 -0700 +++ linux-2.5.73/mm/swap_state.c 2003-06-22 12:04:23.000000000 -0700 @@ -16,14 +16,6 @@ #include -/* - * swapper_inode doesn't do anything much. It is really only here to - * avoid some special-casing in other parts of the kernel. - */ -static struct inode swapper_inode = { - .i_mapping = &swapper_space, -}; - static struct backing_dev_info swap_backing_dev_info = { .ra_pages = 0, /* No readahead */ .memory_backed = 1, /* Does not contribute to dirty memory */ @@ -38,7 +30,6 @@ .dirty_pages = LIST_HEAD_INIT(swapper_space.dirty_pages), .io_pages = LIST_HEAD_INIT(swapper_space.io_pages), .locked_pages = LIST_HEAD_INIT(swapper_space.locked_pages), - .host = &swapper_inode, .a_ops = &swap_aops, .backing_dev_info = &swap_backing_dev_info, .i_mmap = LIST_HEAD_INIT(swapper_space.i_mmap), diff -urN linux-2.5.72-bk3/net/core/flow.c linux-2.5.73/net/core/flow.c --- linux-2.5.72-bk3/net/core/flow.c 2003-06-22 12:03:40.000000000 -0700 +++ linux-2.5.73/net/core/flow.c 2003-06-22 12:04:24.000000000 -0700 @@ -388,11 +388,14 @@ add_timer(&flow_hash_rnd_timer); register_cpu_notifier(&flow_cache_cpu_nb); - for (i = 0; i < NR_CPUS; i++) - if (cpu_online(i)) { - flow_cache_cpu_prepare(i); - flow_cache_cpu_online(i); - } + for (i = 0; i < NR_CPUS; i++) { + if (!cpu_online(i)) + continue; + if (flow_cache_cpu_prepare(i) == NOTIFY_OK && + flow_cache_cpu_online(i) == NOTIFY_OK) + continue; + panic("NET: failed to initialise flow cache hash table\n"); + } return 0; } diff -urN linux-2.5.72-bk3/net/ipv4/arp.c linux-2.5.73/net/ipv4/arp.c --- linux-2.5.72-bk3/net/ipv4/arp.c 2003-06-16 21:20:21.000000000 -0700 +++ linux-2.5.73/net/ipv4/arp.c 2003-06-22 12:04:24.000000000 -0700 @@ -623,15 +623,20 @@ int addr_type; struct neighbour *n; - /* arp_rcv below verifies the ARP header, verifies the device - * is ARP'able, and linearizes the SKB (if needed). + /* arp_rcv below verifies the ARP header and verifies the device + * is ARP'able. */ if (in_dev == NULL) goto out; + /* ARP header, plus 2 device addresses, plus 2 IP addresses. */ + if (!pskb_may_pull(skb, (sizeof(struct arphdr) + + (2 * dev->addr_len) + + (2 * sizeof(u32))))) + goto out; + arp = skb->nh.arph; - arp_ptr= (unsigned char *)(arp+1); switch (dev_type) { default: @@ -693,6 +698,7 @@ /* * Extract fields */ + arp_ptr= (unsigned char *)(arp+1); sha = arp_ptr; arp_ptr += dev->addr_len; memcpy(&sip, arp_ptr, 4); @@ -841,11 +847,6 @@ if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL) goto out_of_mem; - if (skb_is_nonlinear(skb)) { - if (skb_linearize(skb, GFP_ATOMIC) != 0) - goto freeskb; - } - return NF_HOOK(NF_ARP, NF_ARP_IN, skb, dev, NULL, arp_process); freeskb: diff -urN linux-2.5.72-bk3/net/ipv4/netfilter/arp_tables.c linux-2.5.73/net/ipv4/netfilter/arp_tables.c --- linux-2.5.72-bk3/net/ipv4/netfilter/arp_tables.c 2003-06-16 21:20:20.000000000 -0700 +++ linux-2.5.73/net/ipv4/netfilter/arp_tables.c 2003-06-22 12:04:24.000000000 -0700 @@ -247,14 +247,16 @@ { static const char nulldevname[IFNAMSIZ] = { 0 }; unsigned int verdict = NF_DROP; - struct arphdr *arp = (*pskb)->nh.arph; + struct arphdr *arp; int hotdrop = 0; struct arpt_entry *e, *back; const char *indev, *outdev; void *table_base; - /* FIXME: Push down to extensions --RR */ - if (skb_is_nonlinear(*pskb) && skb_linearize(*pskb, GFP_ATOMIC) != 0) + /* ARP header, plus 2 device addresses, plus 2 IP addresses. */ + if (!pskb_may_pull((*pskb), (sizeof(struct arphdr) + + (2 * (*pskb)->dev->addr_len) + + (2 * sizeof(u32))))) return NF_DROP; indev = in ? in->name : nulldevname; @@ -267,6 +269,7 @@ e = get_entry(table_base, table->private->hook_entry[hook]); back = get_entry(table_base, table->private->underflow[hook]); + arp = (*pskb)->nh.arph; do { if (arp_packet_match(arp, (*pskb)->dev, indev, outdev, &e->arp)) { struct arpt_entry_target *t; diff -urN linux-2.5.72-bk3/net/ipv6/icmp.c linux-2.5.73/net/ipv6/icmp.c --- linux-2.5.72-bk3/net/ipv6/icmp.c 2003-06-16 21:19:47.000000000 -0700 +++ linux-2.5.73/net/ipv6/icmp.c 2003-06-22 12:04:24.000000000 -0700 @@ -613,12 +613,6 @@ case NDISC_NEIGHBOUR_SOLICITATION: case NDISC_NEIGHBOUR_ADVERTISEMENT: case NDISC_REDIRECT: - if (skb_is_nonlinear(skb) && - skb_linearize(skb, GFP_ATOMIC) != 0) { - kfree_skb(skb); - return 0; - } - ndisc_rcv(skb); break; diff -urN linux-2.5.72-bk3/net/ipv6/ndisc.c linux-2.5.73/net/ipv6/ndisc.c --- linux-2.5.72-bk3/net/ipv6/ndisc.c 2003-06-16 21:20:05.000000000 -0700 +++ linux-2.5.73/net/ipv6/ndisc.c 2003-06-22 12:04:24.000000000 -0700 @@ -714,12 +714,6 @@ struct inet6_ifaddr *ifp; struct neighbour *neigh; - if (skb->len < sizeof(struct nd_msg)) { - if (net_ratelimit()) - printk(KERN_WARNING "ICMP NS: packet too short\n"); - return; - } - if (ipv6_addr_type(&msg->target)&IPV6_ADDR_MULTICAST) { if (net_ratelimit()) printk(KERN_WARNING "ICMP NS: target address is multicast\n"); @@ -1410,7 +1404,12 @@ int ndisc_rcv(struct sk_buff *skb) { - struct nd_msg *msg = (struct nd_msg *) skb->h.raw; + struct nd_msg *msg; + + if (!pskb_may_pull(skb, skb->len)) + return 0; + + msg = (struct nd_msg *) skb->h.raw; __skb_push(skb, skb->data-skb->h.raw); diff -urN linux-2.5.72-bk3/net/irda/irda_device.c linux-2.5.73/net/irda/irda_device.c --- linux-2.5.72-bk3/net/irda/irda_device.c 2003-06-16 21:20:01.000000000 -0700 +++ linux-2.5.73/net/irda/irda_device.c 2003-06-22 12:04:24.000000000 -0700 @@ -231,7 +231,7 @@ void irda_task_delete(struct irda_task *task) { /* Unregister task */ - hashbin_remove(tasks, (int) task, NULL); + hashbin_remove(tasks, (long) task, NULL); __irda_task_delete(task); } @@ -345,7 +345,7 @@ init_timer(&task->timer); /* Register task */ - hashbin_insert(tasks, (irda_queue_t *) task, (int) task, NULL); + hashbin_insert(tasks, (irda_queue_t *) task, (long) task, NULL); /* No time to waste, so lets get going! */ ret = irda_task_kick(task); diff -urN linux-2.5.72-bk3/net/irda/irnet/irnet_irda.c linux-2.5.73/net/irda/irnet/irnet_irda.c --- linux-2.5.72-bk3/net/irda/irnet/irnet_irda.c 2003-06-16 21:19:39.000000000 -0700 +++ linux-2.5.73/net/irda/irnet/irnet_irda.c 2003-06-22 12:04:24.000000000 -0700 @@ -33,8 +33,8 @@ { int index; /* In the log */ - DENTER(CTRL_TRACE, "(ap=0x%X, event=%d, daddr=%08x, name=``%s'')\n", - (unsigned int) ap, event, daddr, name); + DENTER(CTRL_TRACE, "(ap=0x%p, event=%d, daddr=%08x, name=``%s'')\n", + ap, event, daddr, name); /* Protect this section via spinlock. * Note : as we are the only event producer, we only need to exclude @@ -100,7 +100,7 @@ { notify_t notify; /* Callback structure */ - DENTER(IRDA_SR_TRACE, "(self=0x%X)\n", (unsigned int) self); + DENTER(IRDA_SR_TRACE, "(self=0x%p)\n", self); DABORT(self->tsap != NULL, -EBUSY, IRDA_SR_ERROR, "Already busy !\n"); @@ -125,8 +125,8 @@ /* Remember which TSAP selector we actually got */ self->stsap_sel = self->tsap->stsap_sel; - DEXIT(IRDA_SR_TRACE, " - tsap=0x%X, sel=0x%X\n", - (unsigned int) self->tsap, self->stsap_sel); + DEXIT(IRDA_SR_TRACE, " - tsap=0x%p, sel=0x%X\n", + self->tsap, self->stsap_sel); return 0; } @@ -151,7 +151,7 @@ { __u8 dtsap_sel = 0; /* TSAP we are looking for */ - DENTER(IRDA_SR_TRACE, "(self=0x%X)\n", (unsigned int) self); + DENTER(IRDA_SR_TRACE, "(self=0x%p)\n", self); /* By default, no error */ self->errno = 0; @@ -231,7 +231,7 @@ static inline int irnet_find_lsap_sel(irnet_socket * self) { - DENTER(IRDA_SR_TRACE, "(self=0x%X)\n", (unsigned int) self); + DENTER(IRDA_SR_TRACE, "(self=0x%p)\n", self); /* This should not happen */ DABORT(self->iriap, -EBUSY, IRDA_SR_ERROR, "busy with a previous query.\n"); @@ -268,7 +268,7 @@ { int err; - DENTER(IRDA_SR_TRACE, "(self=0x%X)\n", (unsigned int) self); + DENTER(IRDA_SR_TRACE, "(self=0x%p)\n", self); /* Open a local TSAP (an IrTTP instance) */ err = irnet_open_tsap(self); @@ -369,7 +369,7 @@ { int ret; - DENTER(IRDA_SR_TRACE, "(self=0x%X)\n", (unsigned int) self); + DENTER(IRDA_SR_TRACE, "(self=0x%p)\n", self); /* Ask lmp for the current discovery log */ self->discoveries = irlmp_get_discoveries(&self->disco_number, self->mask, @@ -382,8 +382,8 @@ clear_bit(0, &self->ttp_connect); DRETURN(-ENETUNREACH, IRDA_SR_INFO, "No Cachelog...\n"); } - DEBUG(IRDA_SR_INFO, "Got the log (0x%X), size is %d\n", - (unsigned int) self->discoveries, self->disco_number); + DEBUG(IRDA_SR_INFO, "Got the log (0x%p), size is %d\n", + self->discoveries, self->disco_number); /* Start with the first discovery */ self->disco_index = -1; @@ -426,7 +426,7 @@ int number; /* Number of nodes in the log */ int i; - DENTER(IRDA_SR_TRACE, "(self=0x%X)\n", (unsigned int) self); + DENTER(IRDA_SR_TRACE, "(self=0x%p)\n", self); /* Ask lmp for the current discovery log */ discoveries = irlmp_get_discoveries(&number, 0xffff, @@ -474,7 +474,7 @@ int irda_irnet_create(irnet_socket * self) { - DENTER(IRDA_SOCK_TRACE, "(self=0x%X)\n", (unsigned int) self); + DENTER(IRDA_SOCK_TRACE, "(self=0x%p)\n", self); self->magic = IRNET_MAGIC; /* Paranoia */ @@ -518,7 +518,7 @@ { int err; - DENTER(IRDA_SOCK_TRACE, "(self=0x%X)\n", (unsigned int) self); + DENTER(IRDA_SOCK_TRACE, "(self=0x%p)\n", self); /* Check if we are already trying to connect. * Because irda_irnet_connect() can be called directly by pppd plus @@ -585,7 +585,7 @@ void irda_irnet_destroy(irnet_socket * self) { - DENTER(IRDA_SOCK_TRACE, "(self=0x%X)\n", (unsigned int) self); + DENTER(IRDA_SOCK_TRACE, "(self=0x%p)\n", self); if(self == NULL) return; @@ -676,7 +676,7 @@ int number; /* Number of nodes in the log */ int i; - DENTER(IRDA_SERV_TRACE, "(self=0x%X)\n", (unsigned int) self); + DENTER(IRDA_SERV_TRACE, "(self=0x%p)\n", self); /* Ask lmp for the current discovery log */ discoveries = irlmp_get_discoveries(&number, 0xffff, @@ -722,7 +722,7 @@ irnet_socket * new = (irnet_socket *) NULL; int err; - DENTER(IRDA_SERV_TRACE, "(self=0x%X)\n", (unsigned int) self); + DENTER(IRDA_SERV_TRACE, "(self=0x%p)\n", self); /* Get the addresses of the requester */ self->daddr = irttp_get_daddr(self->tsap); @@ -741,8 +741,8 @@ new = (irnet_socket *) hashbin_find(irnet_server.list, 0, self->rname); if(new) - DEBUG(IRDA_SERV_INFO, "Socket 0x%X matches rname ``%s''.\n", - (unsigned int) new, new->rname); + DEBUG(IRDA_SERV_INFO, "Socket 0x%p matches rname ``%s''.\n", + new, new->rname); } /* If no name matches, try to find an socket by the destination address */ @@ -758,8 +758,8 @@ if((new->rdaddr == self->daddr) || (new->daddr == self->daddr)) { /* Yes !!! Get it.. */ - DEBUG(IRDA_SERV_INFO, "Socket 0x%X matches daddr %#08x.\n", - (unsigned int) new, self->daddr); + DEBUG(IRDA_SERV_INFO, "Socket 0x%p matches daddr %#08x.\n", + new, self->daddr); break; } new = (irnet_socket *) hashbin_get_next(irnet_server.list); @@ -777,8 +777,8 @@ (new->rname[0] == '\0') && (new->ppp_open)) { /* Yes !!! Get it.. */ - DEBUG(IRDA_SERV_INFO, "Socket 0x%X is free.\n", - (unsigned int) new); + DEBUG(IRDA_SERV_INFO, "Socket 0x%p is free.\n", + new); break; } new = (irnet_socket *) hashbin_get_next(irnet_server.list); @@ -788,7 +788,7 @@ /* Spin lock end */ spin_unlock_bh(&irnet_server.spinlock); - DEXIT(IRDA_SERV_TRACE, " - new = 0x%X\n", (unsigned int) new); + DEXIT(IRDA_SERV_TRACE, " - new = 0x%p\n", new); return new; } @@ -806,8 +806,8 @@ __u32 max_sdu_size, __u8 max_header_size) { - DENTER(IRDA_SERV_TRACE, "(server=0x%X, new=0x%X)\n", - (unsigned int) server, (unsigned int) new); + DENTER(IRDA_SERV_TRACE, "(server=0x%p, new=0x%p)\n", + server, new); /* Now attach up the new socket */ new->tsap = irttp_dup(server->tsap, new); @@ -878,7 +878,7 @@ irnet_disconnect_server(irnet_socket * self, struct sk_buff *skb) { - DENTER(IRDA_SERV_TRACE, "(self=0x%X)\n", (unsigned int) self); + DENTER(IRDA_SERV_TRACE, "(self=0x%p)\n", self); /* Put the received packet in the black hole */ kfree_skb(skb); @@ -1010,8 +1010,8 @@ unsigned char * p; int code = 0; - DENTER(IRDA_TCB_TRACE, "(self/ap=0x%X, skb=0x%X)\n", - (unsigned int) ap,(unsigned int) skb); + DENTER(IRDA_TCB_TRACE, "(self/ap=0x%p, skb=0x%p)\n", + ap, skb); DASSERT(skb != NULL, 0, IRDA_CB_ERROR, "skb is NULL !!!\n"); /* Check is ppp is ready to receive our packet */ @@ -1081,7 +1081,7 @@ int test_open; int test_connect; - DENTER(IRDA_TCB_TRACE, "(self=0x%X)\n", (unsigned int) self); + DENTER(IRDA_TCB_TRACE, "(self=0x%p)\n", self); DASSERT(self != NULL, , IRDA_CB_ERROR, "Self is NULL !!!\n"); /* Don't care about it, but let's not leak it */ @@ -1171,7 +1171,7 @@ { irnet_socket * self = (irnet_socket *) instance; - DENTER(IRDA_TCB_TRACE, "(self=0x%X)\n", (unsigned int) self); + DENTER(IRDA_TCB_TRACE, "(self=0x%p)\n", self); /* Check if socket is closing down (via irda_irnet_destroy()) */ if(! test_bit(0, &self->ttp_connect)) @@ -1237,7 +1237,7 @@ irnet_socket * self = (irnet_socket *) instance; LOCAL_FLOW oldflow = self->tx_flow; - DENTER(IRDA_TCB_TRACE, "(self=0x%X, flow=%d)\n", (unsigned int) self, flow); + DENTER(IRDA_TCB_TRACE, "(self=0x%p, flow=%d)\n", self, flow); /* Update our state */ self->tx_flow = flow; @@ -1278,7 +1278,7 @@ { irnet_socket * self = (irnet_socket *) instance; - DENTER(IRDA_TCB_TRACE, "(self=0x%X)\n", (unsigned int) self); + DENTER(IRDA_TCB_TRACE, "(self=0x%p)\n", self); DASSERT(self != NULL, , IRDA_CB_ERROR, "Self is NULL !!!\n"); /* We can only get this event if we are connected */ @@ -1320,9 +1320,9 @@ irnet_socket * server = &irnet_server.s; irnet_socket * new = (irnet_socket *) NULL; - DENTER(IRDA_TCB_TRACE, "(server=0x%X)\n", (unsigned int) server); + DENTER(IRDA_TCB_TRACE, "(server=0x%p)\n", server); DASSERT(instance == &irnet_server, , IRDA_CB_ERROR, - "Invalid instance (0x%X) !!!\n", (unsigned int) instance); + "Invalid instance (0x%p) !!!\n", instance); DASSERT(sap == irnet_server.s.tsap, , IRDA_CB_ERROR, "Invalid sap !!!\n"); /* Try to find the most appropriate IrNET socket */ @@ -1466,7 +1466,7 @@ { irnet_socket * self = (irnet_socket *) priv; - DENTER(IRDA_OCB_TRACE, "(self=0x%X)\n", (unsigned int) self); + DENTER(IRDA_OCB_TRACE, "(self=0x%p)\n", self); DASSERT(self != NULL, , IRDA_OCB_ERROR, "Self is NULL !!!\n"); /* Check if already connected (via irnet_connect_socket()) @@ -1530,7 +1530,7 @@ irnet_socket * self = (irnet_socket *) priv; __u8 dtsap_sel; /* TSAP we are looking for */ - DENTER(IRDA_OCB_TRACE, "(self=0x%X)\n", (unsigned int) self); + DENTER(IRDA_OCB_TRACE, "(self=0x%p)\n", self); DASSERT(self != NULL, , IRDA_OCB_ERROR, "Self is NULL !!!\n"); /* Check if already connected (via irnet_connect_socket()) @@ -1583,8 +1583,8 @@ self->iriap = NULL; /* No more items : remove the log and signal termination */ - DEBUG(IRDA_OCB_INFO, "Cleaning up log (0x%X)\n", - (unsigned int) self->discoveries); + DEBUG(IRDA_OCB_INFO, "Cleaning up log (0x%p)\n", + self->discoveries); if(self->discoveries != NULL) { /* Cleanup our copy of the discovery log */ @@ -1643,9 +1643,9 @@ { irnet_socket * self = &irnet_server.s; - DENTER(IRDA_OCB_TRACE, "(self=0x%X)\n", (unsigned int) self); + DENTER(IRDA_OCB_TRACE, "(self=0x%p)\n", self); DASSERT(priv == &irnet_server, , IRDA_OCB_ERROR, - "Invalid instance (0x%X) !!!\n", (unsigned int) priv); + "Invalid instance (0x%p) !!!\n", priv); DEBUG(IRDA_OCB_INFO, "Discovered new IrNET/IrLAN node %s...\n", discovery->info); @@ -1674,9 +1674,9 @@ { irnet_socket * self = &irnet_server.s; - DENTER(IRDA_OCB_TRACE, "(self=0x%X)\n", (unsigned int) self); + DENTER(IRDA_OCB_TRACE, "(self=0x%p)\n", self); DASSERT(priv == &irnet_server, , IRDA_OCB_ERROR, - "Invalid instance (0x%X) !!!\n", (unsigned int) priv); + "Invalid instance (0x%p) !!!\n", priv); DEBUG(IRDA_OCB_INFO, "IrNET/IrLAN node %s expired...\n", expiry->info); diff -urN linux-2.5.72-bk3/net/irda/irnet/irnet_ppp.c linux-2.5.73/net/irda/irnet/irnet_ppp.c --- linux-2.5.72-bk3/net/irda/irnet/irnet_ppp.c 2003-06-16 21:20:19.000000000 -0700 +++ linux-2.5.73/net/irda/irnet/irnet_ppp.c 2003-06-22 12:04:24.000000000 -0700 @@ -43,7 +43,7 @@ char * next; /* Next command to process */ int length; /* Length of current command */ - DENTER(CTRL_TRACE, "(ap=0x%X, count=%d)\n", (unsigned int) ap, count); + DENTER(CTRL_TRACE, "(ap=0x%p, count=%Zd)\n", ap, count); /* Check for overflow... */ DABORT(count >= IRNET_MAX_COMMAND, -ENOMEM, @@ -58,7 +58,7 @@ /* Safe terminate the string */ command[count] = '\0'; - DEBUG(CTRL_INFO, "Command line received is ``%s'' (%d).\n", + DEBUG(CTRL_INFO, "Command line received is ``%s'' (%Zd).\n", command, count); /* Check every commands in the command line */ @@ -184,8 +184,8 @@ { int done_event = 0; - DENTER(CTRL_TRACE, "(ap=0x%X, event=0x%X)\n", - (unsigned int) ap, (unsigned int) event); + DENTER(CTRL_TRACE, "(ap=0x%p, event=0x%p)\n", + ap, event); /* Test if we have some work to do or we have already finished */ if(ap->disco_number == -1) @@ -205,8 +205,8 @@ /* Check if the we got some results */ if(ap->discoveries == NULL) ap->disco_number = -1; - DEBUG(CTRL_INFO, "Got the log (0x%X), size is %d\n", - (unsigned int) ap->discoveries, ap->disco_number); + DEBUG(CTRL_INFO, "Got the log (0x%p), size is %d\n", + ap->discoveries, ap->disco_number); } /* Check if we have more item to dump */ @@ -232,8 +232,8 @@ if(ap->disco_index >= ap->disco_number) { /* No more items : remove the log and signal termination */ - DEBUG(CTRL_INFO, "Cleaning up log (0x%X)\n", - (unsigned int) ap->discoveries); + DEBUG(CTRL_INFO, "Cleaning up log (0x%p)\n", + ap->discoveries); if(ap->discoveries != NULL) { /* Cleanup our copy of the discovery log */ @@ -261,7 +261,7 @@ char event[64]; /* Max event is 61 char */ ssize_t ret = 0; - DENTER(CTRL_TRACE, "(ap=0x%X, count=%d)\n", (unsigned int) ap, count); + DENTER(CTRL_TRACE, "(ap=0x%p, count=%Zd)\n", ap, count); /* Check if we can write an event out in one go */ DABORT(count < sizeof(event), -EOVERFLOW, CTRL_ERROR, "Buffer to small.\n"); @@ -307,7 +307,7 @@ if(ret != 0) { /* No, return the error code */ - DEXIT(CTRL_TRACE, " - ret %d\n", ret); + DEXIT(CTRL_TRACE, " - ret %Zd\n", ret); return ret; } @@ -402,7 +402,7 @@ { unsigned int mask; - DENTER(CTRL_TRACE, "(ap=0x%X)\n", (unsigned int) ap); + DENTER(CTRL_TRACE, "(ap=0x%p)\n", ap); poll_wait(file, &irnet_events.rwait, wait); mask = POLLOUT | POLLWRNORM; @@ -439,7 +439,7 @@ struct irnet_socket * ap; int err; - DENTER(FS_TRACE, "(file=0x%X)\n", (unsigned int) file); + DENTER(FS_TRACE, "(file=0x%p)\n", file); #ifdef SECURE_DEVIRNET /* This could (should?) be enforced by the permissions on /dev/irnet. */ @@ -482,7 +482,7 @@ /* Put our stuff where we will be able to find it later */ file->private_data = ap; - DEXIT(FS_TRACE, " - ap=0x%X\n", (unsigned int) ap); + DEXIT(FS_TRACE, " - ap=0x%p\n", ap); return 0; } @@ -498,8 +498,8 @@ { irnet_socket * ap = (struct irnet_socket *) file->private_data; - DENTER(FS_TRACE, "(file=0x%X, ap=0x%X)\n", - (unsigned int) file, (unsigned int) ap); + DENTER(FS_TRACE, "(file=0x%p, ap=0x%p)\n", + file, ap); DABORT(ap == NULL, 0, FS_ERROR, "ap is NULL !!!\n"); /* Detach ourselves */ @@ -535,8 +535,8 @@ { irnet_socket * ap = (struct irnet_socket *) file->private_data; - DPASS(FS_TRACE, "(file=0x%X, ap=0x%X, count=%d)\n", - (unsigned int) file, (unsigned int) ap, count); + DPASS(FS_TRACE, "(file=0x%p, ap=0x%p, count=%Zd)\n", + file, ap, count); DABORT(ap == NULL, -ENXIO, FS_ERROR, "ap is NULL !!!\n"); /* If we are connected to ppp_generic, let it handle the job */ @@ -559,8 +559,8 @@ { irnet_socket * ap = (struct irnet_socket *) file->private_data; - DPASS(FS_TRACE, "(file=0x%X, ap=0x%X, count=%d)\n", - (unsigned int) file, (unsigned int) ap, count); + DPASS(FS_TRACE, "(file=0x%p, ap=0x%p, count=%Zd)\n", + file, ap, count); DABORT(ap == NULL, -ENXIO, FS_ERROR, "ap is NULL !!!\n"); /* If we are connected to ppp_generic, let it handle the job */ @@ -581,8 +581,8 @@ irnet_socket * ap = (struct irnet_socket *) file->private_data; unsigned int mask; - DENTER(FS_TRACE, "(file=0x%X, ap=0x%X)\n", - (unsigned int) file, (unsigned int) ap); + DENTER(FS_TRACE, "(file=0x%p, ap=0x%p)\n", + file, ap); mask = POLLOUT | POLLWRNORM; DABORT(ap == NULL, mask, FS_ERROR, "ap is NULL !!!\n"); @@ -611,8 +611,8 @@ int err; int val; - DENTER(FS_TRACE, "(file=0x%X, ap=0x%X, cmd=0x%X)\n", - (unsigned int) file, (unsigned int) ap, cmd); + DENTER(FS_TRACE, "(file=0x%p, ap=0x%p, cmd=0x%X)\n", + file, ap, cmd); /* Basic checks... */ DASSERT(ap != NULL, -ENXIO, PPP_ERROR, "ap is NULL...\n"); @@ -777,8 +777,8 @@ int islcp; /* Protocol == LCP */ int needaddr; /* Need PPP address */ - DENTER(PPP_TRACE, "(ap=0x%X, skb=0x%X)\n", - (unsigned int) ap, (unsigned int) skb); + DENTER(PPP_TRACE, "(ap=0x%p, skb=0x%p)\n", + ap, skb); /* Extract PPP protocol from the frame */ data = skb->data; @@ -845,8 +845,8 @@ irnet_socket * self = (struct irnet_socket *) chan->private; int ret; - DENTER(PPP_TRACE, "(channel=0x%X, ap/self=0x%X)\n", - (unsigned int) chan, (unsigned int) self); + DENTER(PPP_TRACE, "(channel=0x%p, ap/self=0x%p)\n", + chan, self); /* Check if things are somewhat valid... */ DASSERT(self != NULL, 0, PPP_ERROR, "Self is NULL !!!\n"); @@ -949,8 +949,8 @@ int val; u32 accm[8]; - DENTER(PPP_TRACE, "(channel=0x%X, ap=0x%X, cmd=0x%X)\n", - (unsigned int) chan, (unsigned int) ap, cmd); + DENTER(PPP_TRACE, "(channel=0x%p, ap=0x%p, cmd=0x%X)\n", + chan, ap, cmd); /* Basic checks... */ DASSERT(ap != NULL, -ENXIO, PPP_ERROR, "ap is NULL...\n"); diff -urN linux-2.5.72-bk3/net/irda/irttp.c linux-2.5.73/net/irda/irttp.c --- linux-2.5.72-bk3/net/irda/irttp.c 2003-06-16 21:20:06.000000000 -0700 +++ linux-2.5.73/net/irda/irttp.c 2003-06-22 12:04:24.000000000 -0700 @@ -1408,7 +1408,7 @@ spin_lock_irqsave(&irttp->tsaps->hb_spinlock, flags); /* Find the old instance */ - if (!hashbin_find(irttp->tsaps, (int) orig, NULL)) { + if (!hashbin_find(irttp->tsaps, (long) orig, NULL)) { IRDA_DEBUG(0, "%s(), unable to find TSAP\n", __FUNCTION__); spin_unlock_irqrestore(&irttp->tsaps->hb_spinlock, flags); return NULL; diff -urN linux-2.5.72-bk3/net/sunrpc/sched.c linux-2.5.73/net/sunrpc/sched.c --- linux-2.5.72-bk3/net/sunrpc/sched.c 2003-06-16 21:20:02.000000000 -0700 +++ linux-2.5.73/net/sunrpc/sched.c 2003-06-22 12:04:25.000000000 -0700 @@ -20,6 +20,7 @@ #include #include #include +#include #include #include @@ -969,6 +970,8 @@ flush_signals(current); } __rpc_schedule(); + if (current->flags & PF_FREEZE) + refrigerator(PF_IOTHREAD); if (++rounds >= 64) { /* safeguard */ schedule(); diff -urN linux-2.5.72-bk3/scripts/kconfig/mconf.c linux-2.5.73/scripts/kconfig/mconf.c --- linux-2.5.72-bk3/scripts/kconfig/mconf.c 2003-06-16 21:19:44.000000000 -0700 +++ linux-2.5.73/scripts/kconfig/mconf.c 2003-06-22 12:04:25.000000000 -0700 @@ -492,7 +492,7 @@ switch (type) { case 'm': if (single_menu_mode) - submenu->data = (void *) !submenu->data; + submenu->data = (void *) (long) !submenu->data; else conf(submenu); break; diff -urN linux-2.5.72-bk3/sound/pci/korg1212/korg1212.c linux-2.5.73/sound/pci/korg1212/korg1212.c --- linux-2.5.72-bk3/sound/pci/korg1212/korg1212.c 2003-06-16 21:19:39.000000000 -0700 +++ linux-2.5.73/sound/pci/korg1212/korg1212.c 2003-06-22 12:04:25.000000000 -0700 @@ -2070,7 +2070,7 @@ snd_iprintf(buffer, korg1212->card->longname); snd_iprintf(buffer, " (index #%d)\n", korg1212->card->number + 1); snd_iprintf(buffer, "\nGeneral settings\n"); - snd_iprintf(buffer, " period size: %d bytes\n", K1212_PERIOD_BYTES); + snd_iprintf(buffer, " period size: %Zd bytes\n", K1212_PERIOD_BYTES); snd_iprintf(buffer, " clock mode: %s\n", clockSourceName[korg1212->clkSrcRate] ); snd_iprintf(buffer, " left ADC Sens: %d\n", korg1212->leftADCInSens ); snd_iprintf(buffer, " right ADC Sens: %d\n", korg1212->rightADCInSens ); @@ -2336,7 +2336,7 @@ korg1212->sharedBufferPhy = (unsigned long)phys_addr; if (korg1212->sharedBufferPtr == NULL) { - snd_printk(KERN_ERR "can not allocate shared buffer memory (%d bytes)\n", sizeof(KorgSharedBuffer)); + snd_printk(KERN_ERR "can not allocate shared buffer memory (%Zd bytes)\n", sizeof(KorgSharedBuffer)); return -ENOMEM; } @@ -2385,9 +2385,12 @@ korg1212->dspCodeSize = sizeof (dspCode); - korg1212->VolumeTablePhy = (u32) &((KorgSharedBuffer *) korg1212->sharedBufferPhy)->volumeData; - korg1212->RoutingTablePhy = (u32) &((KorgSharedBuffer *) korg1212->sharedBufferPhy)->routeData; - korg1212->AdatTimeCodePhy = (u32) &((KorgSharedBuffer *) korg1212->sharedBufferPhy)->AdatTimeCode; + korg1212->VolumeTablePhy = korg1212->sharedBufferPhy + + offsetof(KorgSharedBuffer, volumeData); + korg1212->RoutingTablePhy = korg1212->sharedBufferPhy + + offsetof(KorgSharedBuffer, routeData); + korg1212->AdatTimeCodePhy = korg1212->sharedBufferPhy + + offsetof(KorgSharedBuffer, AdatTimeCode); korg1212->dspMemPtr = snd_malloc_pci_pages(korg1212->pci, korg1212->dspCodeSize, &phys_addr); korg1212->dspMemPhy = (u32)phys_addr; diff -urN linux-2.5.72-bk3/usr/gen_init_cpio.c linux-2.5.73/usr/gen_init_cpio.c --- linux-2.5.72-bk3/usr/gen_init_cpio.c 2003-06-16 21:20:06.000000000 -0700 +++ linux-2.5.73/usr/gen_init_cpio.c 2003-06-22 12:04:25.000000000 -0700 @@ -56,7 +56,7 @@ const char *name = "TRAILER!!!"; sprintf(s, "%s%08X%08X%08lX%08lX%08X%08lX" - "%08X%08X%08X%08X%08X%08X%08X", + "%08X%08X%08X%08X%08X%08ZX%08X", "070701", /* magic */ 0, /* ino */ 0, /* mode */ @@ -87,7 +87,7 @@ time_t mtime = time(NULL); sprintf(s,"%s%08X%08X%08lX%08lX%08X%08lX" - "%08X%08X%08X%08X%08X%08X%08X", + "%08X%08X%08X%08X%08X%08ZX%08X", "070701", /* magic */ ino++, /* ino */ S_IFDIR | mode, /* mode */ @@ -119,7 +119,7 @@ mode |= S_IFCHR; sprintf(s,"%s%08X%08X%08lX%08lX%08X%08lX" - "%08X%08X%08X%08X%08X%08X%08X", + "%08X%08X%08X%08X%08X%08ZX%08X", "070701", /* magic */ ino++, /* ino */ mode, /* mode */ @@ -176,7 +176,7 @@ } sprintf(s,"%s%08X%08X%08lX%08lX%08X%08lX" - "%08X%08X%08X%08X%08X%08X%08X", + "%08X%08X%08X%08X%08X%08ZX%08X", "070701", /* magic */ ino++, /* ino */ mode, /* mode */