diff options
| author | Anton Altaparmakov <aia21@drop.stormcorp.org> | 2002-03-16 15:15:04 +0000 |
|---|---|---|
| committer | Anton Altaparmakov <aia21@drop.stormcorp.org> | 2002-03-16 15:15:04 +0000 |
| commit | 00f25ce01530179c27139d4dc8042f1b9b1595fe (patch) | |
| tree | d207a7f8d11df628e8e0249e15e86da1400ac244 /include | |
| parent | dced44de772e9d2f2fd87b6451b337d8f06e1d43 (diff) | |
| parent | 9038672ad96899c5c334cf4dc192483ffa671bab (diff) | |
Merge drop.stormcorp.org:/rain/usr/src/bklinux-2.5
into drop.stormcorp.org:/rain/usr/src/bkntfs-tng-2.5
Diffstat (limited to 'include')
31 files changed, 1075 insertions, 305 deletions
diff --git a/include/asm-i386/acpi.h b/include/asm-i386/acpi.h new file mode 100644 index 000000000000..4b51cff4d217 --- /dev/null +++ b/include/asm-i386/acpi.h @@ -0,0 +1,83 @@ +/* + * asm-i386/acpi.h + * + * Copyright (C) 2001 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com> + * Copyright (C) 2001 Patrick Mochel <mochel@osdl.org> + * + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + */ + +#ifndef _ASM_ACPI_H +#define _ASM_ACPI_H + +#ifdef __KERNEL__ + +#ifdef CONFIG_ACPI_BOOT + +/* Fixmap pages to reserve for ACPI boot-time tables (see fixmap.h) */ +#define FIX_ACPI_PAGES 4 + +char * __acpi_map_table (unsigned long phys_addr, unsigned long size); +extern int acpi_find_rsdp (unsigned long *phys_addr); +extern int acpi_parse_madt (unsigned long phys_addr, unsigned long size); + +#endif /*CONFIG_ACPI_BOOT*/ + +#ifdef CONFIG_ACPI_PCI +int acpi_get_interrupt_model (int *type); +#endif /*CONFIG_ACPI_PCI*/ + + +#ifdef CONFIG_ACPI_SLEEP + +extern unsigned long saved_eip; +extern unsigned long saved_esp; +extern unsigned long saved_ebp; +extern unsigned long saved_ebx; +extern unsigned long saved_esi; +extern unsigned long saved_edi; + +static inline void acpi_save_register_state(unsigned long return_point) +{ + saved_eip = return_point; + asm volatile ("movl %%esp,(%0)" : "=m" (saved_esp)); + asm volatile ("movl %%ebp,(%0)" : "=m" (saved_ebp)); + asm volatile ("movl %%ebx,(%0)" : "=m" (saved_ebx)); + asm volatile ("movl %%edi,(%0)" : "=m" (saved_edi)); + asm volatile ("movl %%esi,(%0)" : "=m" (saved_esi)); +} + +#define acpi_restore_register_state() do {} while (0) + +/* routines for saving/restoring kernel state */ +extern int acpi_save_state_mem(void); +extern int acpi_save_state_disk(void); +extern void acpi_restore_state_mem(void); + +extern unsigned long acpi_wakeup_address; + +/* early initialization routine */ +extern void acpi_reserve_bootmem(void); + +#endif /*CONFIG_ACPI_SLEEP*/ + + +#endif /*__KERNEL__*/ + +#endif /*_ASM_ACPI_H*/ diff --git a/include/asm-i386/fixmap.h b/include/asm-i386/fixmap.h index 033278aa50e7..603caa2b42c6 100644 --- a/include/asm-i386/fixmap.h +++ b/include/asm-i386/fixmap.h @@ -15,6 +15,7 @@ #include <linux/config.h> #include <linux/kernel.h> +#include <asm/acpi.h> #include <asm/apicdef.h> #include <asm/page.h> #ifdef CONFIG_HIGHMEM @@ -61,10 +62,17 @@ enum fixed_addresses { FIX_LI_PCIA, /* Lithium PCI Bridge A */ FIX_LI_PCIB, /* Lithium PCI Bridge B */ #endif +#ifdef CONFIG_X86_F00F_BUG + FIX_F00F_IDT, /* Virtual mapping for IDT */ +#endif #ifdef CONFIG_HIGHMEM FIX_KMAP_BEGIN, /* reserved pte's for temporary kernel mappings */ FIX_KMAP_END = FIX_KMAP_BEGIN+(KM_TYPE_NR*NR_CPUS)-1, #endif +#ifdef CONFIG_ACPI_BOOT + FIX_ACPI_BEGIN, + FIX_ACPI_END = FIX_ACPI_BEGIN + FIX_ACPI_PAGES - 1, +#endif __end_of_permanent_fixed_addresses, /* temporary boot-time mappings, used before ioremap() is functional */ #define NR_FIX_BTMAPS 16 diff --git a/include/asm-i386/irq.h b/include/asm-i386/irq.h index c0d2b88b6ff0..c1bcd739bc7b 100644 --- a/include/asm-i386/irq.h +++ b/include/asm-i386/irq.h @@ -23,7 +23,11 @@ * Since vectors 0x00-0x1f are used/reserved for the CPU, * the usable vector space is 0x20-0xff (224 vectors) */ +#ifdef CONFIG_X86_IO_APIC #define NR_IRQS 224 +#else +#define NR_IRQS 16 +#endif static __inline__ int irq_cannonicalize(int irq) { diff --git a/include/asm-i386/pci.h b/include/asm-i386/pci.h index 10df65b20e4e..1d957c02e541 100644 --- a/include/asm-i386/pci.h +++ b/include/asm-i386/pci.h @@ -19,6 +19,11 @@ extern unsigned long pci_mem_start; #define PCIBIOS_MIN_IO 0x1000 #define PCIBIOS_MIN_MEM (pci_mem_start) +void pcibios_config_init(void); +struct pci_bus * pcibios_scan_root(int bus); +extern int (*pci_config_read)(int seg, int bus, int dev, int fn, int reg, int len, u32 *value); +extern int (*pci_config_write)(int seg, int bus, int dev, int fn, int reg, int len, u32 value); + void pcibios_set_master(struct pci_dev *dev); void pcibios_penalize_isa_irq(int irq); struct irq_routing_table *pcibios_get_irq_routing_table(void); diff --git a/include/asm-ia64/bitops.h b/include/asm-ia64/bitops.h index 67e2c61b0f43..340b70543401 100644 --- a/include/asm-ia64/bitops.h +++ b/include/asm-ia64/bitops.h @@ -9,6 +9,8 @@ * scheduler patch */ +#include <linux/types.h> + #include <asm/system.h> /** @@ -97,7 +99,7 @@ clear_bit (int nr, volatile void *addr) static __inline__ void __clear_bit (int nr, volatile void *addr) { - volatile __u32 *p = (__u32 *) addr + (nr >> 5);; + volatile __u32 *p = (__u32 *) addr + (nr >> 5); __u32 m = 1 << (nr & 31); *p &= ~m; } diff --git a/include/asm-ia64/cache.h b/include/asm-ia64/cache.h index d590f7b9b3d3..40dd25195d65 100644 --- a/include/asm-ia64/cache.h +++ b/include/asm-ia64/cache.h @@ -5,7 +5,7 @@ /* * Copyright (C) 1998-2000 Hewlett-Packard Co - * Copyright (C) 1998-2000 David Mosberger-Tang <davidm@hpl.hp.com> + * David Mosberger-Tang <davidm@hpl.hp.com> */ /* Bytes per L1 (data) cache line. */ diff --git a/include/asm-ia64/hardirq.h b/include/asm-ia64/hardirq.h index 417248256272..be27f0d793bb 100644 --- a/include/asm-ia64/hardirq.h +++ b/include/asm-ia64/hardirq.h @@ -2,8 +2,8 @@ #define _ASM_IA64_HARDIRQ_H /* - * Copyright (C) 1998-2001 Hewlett-Packard Co - * Copyright (C) 1998-2001 David Mosberger-Tang <davidm@hpl.hp.com> + * Copyright (C) 1998-2002 Hewlett-Packard Co + * David Mosberger-Tang <davidm@hpl.hp.com> */ #include <linux/config.h> diff --git a/include/asm-ia64/mman.h b/include/asm-ia64/mman.h index 58db5609867e..88c81a1fcfba 100644 --- a/include/asm-ia64/mman.h +++ b/include/asm-ia64/mman.h @@ -9,6 +9,7 @@ #define PROT_READ 0x1 /* page can be read */ #define PROT_WRITE 0x2 /* page can be written */ #define PROT_EXEC 0x4 /* page can be executed */ +#define PROT_SEM 0x8 /* page may be used for atomic ops */ #define PROT_NONE 0x0 /* page can not be accessed */ #define MAP_SHARED 0x01 /* Share changes */ diff --git a/include/asm-ia64/offsets.h b/include/asm-ia64/offsets.h index 0c456df266ec..835d2a5b70f4 100644 --- a/include/asm-ia64/offsets.h +++ b/include/asm-ia64/offsets.h @@ -6,23 +6,16 @@ * This file was generated by arch/ia64/tools/print_offsets.awk. * */ -#define PT_PTRACED_BIT 0 -#define PT_SYSCALLTRACE_BIT 1 #define IA64_TASK_SIZE 3936 /* 0xf60 */ #define IA64_THREAD_INFO_SIZE 24 /* 0x18 */ #define IA64_PT_REGS_SIZE 400 /* 0x190 */ #define IA64_SWITCH_STACK_SIZE 560 /* 0x230 */ #define IA64_SIGINFO_SIZE 128 /* 0x80 */ -#define IA64_CPU_SIZE 16384 /* 0x4000 */ +#define IA64_CPU_SIZE 224 /* 0xe0 */ #define SIGFRAME_SIZE 2816 /* 0xb00 */ #define UNW_FRAME_INFO_SIZE 448 /* 0x1c0 */ -#define IA64_TASK_PTRACE_OFFSET 32 /* 0x20 */ -#define IA64_TASK_THREAD_OFFSET 1472 /* 0x5c0 */ #define IA64_TASK_THREAD_KSP_OFFSET 1480 /* 0x5c8 */ -#define IA64_TASK_PFM_OVFL_BLOCK_RESET_OFFSET 2096 /* 0x830 */ -#define IA64_TASK_PID_OFFSET 212 /* 0xd4 */ -#define IA64_TASK_MM_OFFSET 136 /* 0x88 */ #define IA64_PT_REGS_CR_IPSR_OFFSET 0 /* 0x0 */ #define IA64_PT_REGS_CR_IIP_OFFSET 8 /* 0x8 */ #define IA64_PT_REGS_CR_IFS_OFFSET 16 /* 0x10 */ @@ -132,8 +125,5 @@ #define IA64_SIGFRAME_SIGCONTEXT_OFFSET 160 /* 0xa0 */ #define IA64_CLONE_VFORK 16384 /* 0x4000 */ #define IA64_CLONE_VM 256 /* 0x100 */ -#define IA64_CPU_IRQ_COUNT_OFFSET 0 /* 0x0 */ -#define IA64_CPU_BH_COUNT_OFFSET 4 /* 0x4 */ -#define IA64_CPU_PHYS_STACKED_SIZE_P8_OFFSET 12 /* 0xc */ #endif /* _ASM_IA64_OFFSETS_H */ diff --git a/include/asm-ia64/processor.h b/include/asm-ia64/processor.h index 1b88dcaccd48..8713f2544632 100644 --- a/include/asm-ia64/processor.h +++ b/include/asm-ia64/processor.h @@ -15,6 +15,8 @@ #include <linux/config.h> +#include <linux/compiler.h> + #include <asm/ptrace.h> #include <asm/kregs.h> #include <asm/system.h> @@ -184,6 +186,10 @@ */ #define IA64_USEC_PER_CYC_SHIFT 41 +#define __HAVE_ARCH_PER_CPU + +#define THIS_CPU(var) (var) + #ifndef __ASSEMBLY__ #include <linux/threads.h> @@ -196,6 +202,11 @@ #include <asm/unwind.h> #include <asm/atomic.h> +extern unsigned long __per_cpu_offset[NR_CPUS]; + +#define per_cpu(var, cpu) (*(__typeof__(&(var))) ((void *) &(var) + __per_cpu_offset[cpu])) +#define this_cpu(var) (var) + /* like above but expressed as bitfields for more efficient access: */ struct ia64_psr { __u64 reserved0 : 1; @@ -239,7 +250,7 @@ struct ia64_psr { * CPU type, hardware bug flags, and per-CPU state. Frequently used * state comes earlier: */ -struct cpuinfo_ia64 { +extern struct cpuinfo_ia64 { /* irq_stat must be 64-bit aligned */ union { struct { @@ -249,7 +260,6 @@ struct cpuinfo_ia64 { __u64 irq_and_bh_counts; } irq_stat; __u32 softirq_pending; - __u32 phys_stacked_size_p8; /* size of physical stacked registers + 8 */ __u64 itm_delta; /* # of clock cycles between clock ticks */ __u64 itm_next; /* interval timer mask value to use for next clock tick */ __u64 *pgd_quick; @@ -282,41 +292,15 @@ struct cpuinfo_ia64 { __u64 prof_multiplier; __u32 pfm_syst_wide; __u32 pfm_dcr_pp; - /* this is written to by *other* CPUs: */ - __u64 ipi_operation ____cacheline_aligned; -#endif -#ifdef CONFIG_NUMA - void *node_directory; - int numa_node_id; - struct cpuinfo_ia64 *cpu_data[NR_CPUS]; #endif - /* Platform specific word. MUST BE LAST IN STRUCT */ - __u64 platform_specific; -} __attribute__ ((aligned (PAGE_SIZE))) ; +} cpu_info __per_cpu_data; /* * The "local" data pointer. It points to the per-CPU data of the currently executing * CPU, much like "current" points to the per-task data of the currently executing task. */ -#define local_cpu_data ((struct cpuinfo_ia64 *) PERCPU_ADDR) - -/* - * On NUMA systems, cpu_data for each cpu is allocated during cpu_init() & is allocated on - * the node that contains the cpu. This minimizes off-node memory references. cpu_data - * for each cpu contains an array of pointers to the cpu_data structures of each of the - * other cpus. - * - * On non-NUMA systems, cpu_data is a static array allocated at compile time. References - * to the cpu_data of another cpu is done by direct references to the appropriate entry of - * the array. - */ -#ifdef CONFIG_NUMA -# define cpu_data(cpu) local_cpu_data->cpu_data[cpu] -# define numa_node_id() (local_cpu_data->numa_node_id) -#else - extern struct cpuinfo_ia64 _cpu_data[NR_CPUS]; -# define cpu_data(cpu) (&_cpu_data[cpu]) -#endif +#define local_cpu_data (&this_cpu(cpu_info)) +#define cpu_data(cpu) (&per_cpu(cpu_info, cpu)) extern void identify_cpu (struct cpuinfo_ia64 *); extern void print_cpu_info (struct cpuinfo_ia64 *); diff --git a/include/asm-ia64/siginfo.h b/include/asm-ia64/siginfo.h index f75b189ccf0c..00b47ffd9678 100644 --- a/include/asm-ia64/siginfo.h +++ b/include/asm-ia64/siginfo.h @@ -136,6 +136,7 @@ typedef struct siginfo { #define SI_ASYNCIO (-4) /* sent by AIO completion */ #define SI_SIGIO (-5) /* sent by queued SIGIO */ #define SI_TKILL (-6) /* sent by tkill system call */ +#define SI_DETHREAD (-7) /* sent by execve() killing subsidiary threads */ #define SI_FROMUSER(siptr) ((siptr)->si_code <= 0) #define SI_FROMKERNEL(siptr) ((siptr)->si_code > 0) diff --git a/include/asm-ia64/smplock.h b/include/asm-ia64/smplock.h index f574e418a374..d5b5222b344b 100644 --- a/include/asm-ia64/smplock.h +++ b/include/asm-ia64/smplock.h @@ -12,30 +12,36 @@ extern spinlock_t kernel_flag; -#define kernel_locked() spin_is_locked(&kernel_flag) +#ifdef CONFIG_SMP +# define kernel_locked() spin_is_locked(&kernel_flag) +# define check_irq_holder(cpu) \ +do { \ + if (global_irq_holder == (cpu)) \ + BUG(); \ +} while (0) +#else +# define kernel_locked() (1) +#endif /* * Release global kernel lock and global interrupt lock */ -static __inline__ void -release_kernel_lock(struct task_struct *task, int cpu) -{ - if (unlikely(task->lock_depth >= 0)) { - spin_unlock(&kernel_flag); - if (global_irq_holder == (cpu)) \ - BUG(); \ - } -} +#define release_kernel_lock(task, cpu) \ +do { \ + if (unlikely(task->lock_depth >= 0)) { \ + spin_unlock(&kernel_flag); \ + check_irq_holder(cpu); \ + } \ +} while (0) /* * Re-acquire the kernel lock */ -static __inline__ void -reacquire_kernel_lock(struct task_struct *task) -{ - if (unlikely(task->lock_depth >= 0)) - spin_lock(&kernel_flag); -} +#define reacquire_kernel_lock(task) \ +do { \ + if (unlikely(task->lock_depth >= 0)) \ + spin_lock(&kernel_flag); \ +} while (0) /* * Getting the big kernel lock. diff --git a/include/asm-ia64/system.h b/include/asm-ia64/system.h index 5cbf1dac47b3..8ec865590279 100644 --- a/include/asm-ia64/system.h +++ b/include/asm-ia64/system.h @@ -397,13 +397,17 @@ extern void ia64_load_extra (struct task_struct *task); } while (0) #ifdef CONFIG_SMP - /* - * In the SMP case, we save the fph state when context-switching - * away from a thread that modified fph. This way, when the thread - * gets scheduled on another CPU, the CPU can pick up the state from - * task->thread.fph, avoiding the complication of having to fetch - * the latest fph state from another CPU. - */ + +/* Return true if this CPU can call the console drivers in printk() */ +#define arch_consoles_callable() (cpu_online_map & (1UL << smp_processor_id())) + +/* + * In the SMP case, we save the fph state when context-switching + * away from a thread that modified fph. This way, when the thread + * gets scheduled on another CPU, the CPU can pick up the state from + * task->thread.fph, avoiding the complication of having to fetch + * the latest fph state from another CPU. + */ # define switch_to(prev,next) do { \ if (ia64_psr(ia64_task_regs(prev))->mfh) { \ ia64_psr(ia64_task_regs(prev))->mfh = 0; \ diff --git a/include/asm-ia64/uaccess.h b/include/asm-ia64/uaccess.h index b53b244d80e2..965aecc95e66 100644 --- a/include/asm-ia64/uaccess.h +++ b/include/asm-ia64/uaccess.h @@ -320,4 +320,22 @@ struct exception_fixup { extern struct exception_fixup search_exception_table (unsigned long addr); extern void handle_exception (struct pt_regs *regs, struct exception_fixup fixup); +#ifdef GAS_HAS_LOCAL_TAGS +#define SEARCH_EXCEPTION_TABLE(regs) search_exception_table(regs->cr_iip + ia64_psr(regs)->ri); +#else +#define SEARCH_EXCEPTION_TABLE(regs) search_exception_table(regs->cr_iip); +#endif + +static inline int +done_with_exception (struct pt_regs *regs) +{ + struct exception_fixup fix; + fix = SEARCH_EXCEPTION_TABLE(regs); + if (fix.cont) { + handle_exception(regs, fix); + return 1; + } + return 0; +} + #endif /* _ASM_IA64_UACCESS_H */ diff --git a/include/linux/acpi.h b/include/linux/acpi.h index 216200305f3e..d22727f577f8 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h @@ -1,180 +1,390 @@ /* - * acpi.h - ACPI driver interface + * acpi.h - ACPI Interface * - * Copyright (C) 1999 Andrew Henroid + * Copyright (C) 2001 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com> * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * This program is 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. * - * 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 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ #ifndef _LINUX_ACPI_H #define _LINUX_ACPI_H -#include <linux/types.h> -#include <linux/ioctl.h> -#ifdef __KERNEL__ -#include <linux/sched.h> -#include <linux/wait.h> -#endif /* __KERNEL__ */ +#ifndef _LINUX +#define _LINUX +#endif + +#include "../../drivers/acpi/include/acpi.h" +#include <asm/acpi.h> + + +/* -------------------------------------------------------------------------- + Boot-Time Table Parsing + -------------------------------------------------------------------------- */ + +#ifdef CONFIG_ACPI_BOOT + +/* Root System Description Pointer (RSDP) */ + +struct acpi_table_rsdp { + char signature[8]; + u8 checksum; + char oem_id[6]; + u8 revision; + u32 rsdt_address; +} __attribute__ ((packed)); + +struct acpi20_table_rsdp { + char signature[8]; + u8 checksum; + char oem_id[6]; + u8 revision; + u32 rsdt_address; + u32 length; + u64 xsdt_address; + u8 ext_checksum; + u8 reserved[3]; +} __attribute__ ((packed)); + +/* Common table header */ + +struct acpi_table_header { + char signature[4]; + u32 length; + u8 revision; + u8 checksum; + char oem_id[6]; + char oem_table_id[8]; + u32 oem_revision; + char asl_compiler_id[4]; + u32 asl_compiler_revision; +} __attribute__ ((packed)); + +typedef struct { + u8 type; + u8 length; +} acpi_table_entry_header __attribute__ ((packed)); + +/* Root System Description Table (RSDT) */ + +struct acpi_table_rsdt { + struct acpi_table_header header; + u32 entry[1]; +} __attribute__ ((packed)); + +/* Extended System Description Table (XSDT) */ + +struct acpi_table_xsdt { + struct acpi_table_header header; + u64 entry[1]; +} __attribute__ ((packed)); + +/* Multiple APIC Description Table (MADT) */ + +struct acpi_table_madt { + struct acpi_table_header header; + u32 lapic_address; + struct { + u32 pcat_compat:1; + u32 reserved:31; + } flags; +} __attribute__ ((packed)); + +enum acpi_madt_entry_id { + 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 +}; + +typedef struct { + u16 polarity:2; + u16 trigger:2; + u16 reserved:12; +} acpi_interrupt_flags __attribute__ ((packed)); + +struct acpi_table_lapic { + acpi_table_entry_header header; + u8 acpi_id; + u8 id; + struct { + u32 enabled:1; + u32 reserved:31; + } flags; +} __attribute__ ((packed)); + +struct acpi_table_ioapic { + acpi_table_entry_header header; + u8 id; + u8 reserved; + u32 address; + u32 global_irq_base; +} __attribute__ ((packed)); + +struct acpi_table_int_src_ovr { + acpi_table_entry_header header; + u8 bus; + u8 bus_irq; + u32 global_irq; + acpi_interrupt_flags flags; +} __attribute__ ((packed)); + +struct acpi_table_nmi_src { + acpi_table_entry_header header; + acpi_interrupt_flags flags; + u32 global_irq; +} __attribute__ ((packed)); + +struct acpi_table_lapic_nmi { + acpi_table_entry_header header; + u8 acpi_id; + acpi_interrupt_flags flags; + u8 lint; +} __attribute__ ((packed)); + +struct acpi_table_lapic_addr_ovr { + acpi_table_entry_header header; + u8 reserved[2]; + u64 address; +} __attribute__ ((packed)); + +struct acpi_table_iosapic { + acpi_table_entry_header header; + u8 id; + u8 reserved; + u32 global_irq_base; + u64 address; +} __attribute__ ((packed)); + +struct acpi_table_lsapic { + acpi_table_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_table_entry_header header; + acpi_interrupt_flags flags; + u8 type; /* See acpi_interrupt_type */ + u8 id; + u8 eid; + u8 iosapic_vector; + u32 global_irq; + u32 reserved; +} __attribute__ ((packed)); + +enum acpi_interrupt_id { + ACPI_INTERRUPT_PMI = 1, + ACPI_INTERRUPT_INIT, + ACPI_INTERRUPT_CPEI, + ACPI_INTERRUPT_COUNT +}; /* - * Device states + * System Resource Affinity Table (SRAT) + * see http://www.microsoft.com/hwdev/design/srat.htm */ -typedef enum { - ACPI_D0, /* fully-on */ - ACPI_D1, /* partial-on */ - ACPI_D2, /* partial-on */ - ACPI_D3, /* fully-off */ -} acpi_dstate_t; - -typedef enum { - ACPI_S0, /* working state */ - ACPI_S1, /* power-on suspend */ - ACPI_S2, /* suspend to ram, with devices */ - ACPI_S3, /* suspend to ram */ - ACPI_S4, /* suspend to disk */ - ACPI_S5, /* soft-off */ -} acpi_sstate_t; - -/* RSDP location */ -#define ACPI_BIOS_ROM_BASE (0x0e0000) -#define ACPI_BIOS_ROM_END (0x100000) - -/* Table signatures */ -#define ACPI_RSDP1_SIG 0x20445352 /* 'RSD ' */ -#define ACPI_RSDP2_SIG 0x20525450 /* 'PTR ' */ -#define ACPI_RSDT_SIG 0x54445352 /* 'RSDT' */ -#define ACPI_FADT_SIG 0x50434146 /* 'FACP' */ -#define ACPI_DSDT_SIG 0x54445344 /* 'DSDT' */ -#define ACPI_FACS_SIG 0x53434146 /* 'FACS' */ - -#define ACPI_SIG_LEN 4 -#define ACPI_FADT_SIGNATURE "FACP" - -/* PM1_STS/EN flags */ -#define ACPI_TMR 0x0001 -#define ACPI_BM 0x0010 -#define ACPI_GBL 0x0020 -#define ACPI_PWRBTN 0x0100 -#define ACPI_SLPBTN 0x0200 -#define ACPI_RTC 0x0400 -#define ACPI_WAK 0x8000 - -/* PM1_CNT flags */ -#define ACPI_SCI_EN 0x0001 -#define ACPI_BM_RLD 0x0002 -#define ACPI_GBL_RLS 0x0004 -#define ACPI_SLP_TYP0 0x0400 -#define ACPI_SLP_TYP1 0x0800 -#define ACPI_SLP_TYP2 0x1000 -#define ACPI_SLP_EN 0x2000 - -#define ACPI_SLP_TYP_MASK 0x1c00 -#define ACPI_SLP_TYP_SHIFT 10 - -/* PM_TMR masks */ -#define ACPI_TMR_VAL_EXT 0x00000100 -#define ACPI_TMR_MASK 0x00ffffff -#define ACPI_TMR_HZ 3579545 /* 3.58 MHz */ -#define ACPI_TMR_KHZ (ACPI_TMR_HZ / 1000) - -#define ACPI_MICROSEC_TO_TMR_TICKS(val) \ - (((val) * (ACPI_TMR_KHZ)) / 1000) - -/* PM2_CNT flags */ -#define ACPI_ARB_DIS 0x01 - -/* FADT flags */ -#define ACPI_WBINVD 0x00000001 -#define ACPI_WBINVD_FLUSH 0x00000002 -#define ACPI_PROC_C1 0x00000004 -#define ACPI_P_LVL2_UP 0x00000008 -#define ACPI_PWR_BUTTON 0x00000010 -#define ACPI_SLP_BUTTON 0x00000020 -#define ACPI_FIX_RTC 0x00000040 -#define ACPI_RTC_64 0x00000080 -#define ACPI_TMR_VAL_EXT 0x00000100 -#define ACPI_DCK_CAP 0x00000200 - -/* FADT BOOT_ARCH flags */ -#define FADT_BOOT_ARCH_LEGACY_DEVICES 0x0001 -#define FADT_BOOT_ARCH_KBD_CONTROLLER 0x0002 - -/* FACS flags */ -#define ACPI_S4BIOS 0x00000001 - -/* processor block offsets */ -#define ACPI_P_CNT 0x00000000 -#define ACPI_P_LVL2 0x00000004 -#define ACPI_P_LVL3 0x00000005 - -/* C-state latencies (microseconds) */ -#define ACPI_MAX_P_LVL2_LAT 100 -#define ACPI_MAX_P_LVL3_LAT 1000 -#define ACPI_INFINITE_LAT (~0UL) + +struct acpi_table_srat { + struct acpi_table_header header; + u32 table_revision; + u64 reserved; +} __attribute__ ((packed)); + +enum acpi_srat_entry_id { + ACPI_SRAT_PROCESSOR_AFFINITY = 0, + ACPI_SRAT_MEMORY_AFFINITY, + ACPI_SRAT_ENTRY_COUNT +}; + +struct acpi_table_processor_affinity { + acpi_table_entry_header header; + u8 proximity_domain; + u8 apic_id; + struct { + u32 enabled:1; + u32 reserved:31; + } flags; + u8 lsapic_eid; + u8 reserved[7]; +} __attribute__ ((packed)); + +struct acpi_table_memory_affinity { + acpi_table_entry_header header; + u8 proximity_domain; + u8 reserved1[5]; + u32 base_addr_lo; + u32 base_addr_hi; + u32 length_lo; + u32 length_hi; + u32 memory_type; /* See acpi_address_range_id */ + struct { + u32 enabled:1; + u32 hot_pluggable:1; + u32 reserved:30; + } flags; + u64 reserved2; +} __attribute__ ((packed)); + +enum acpi_address_range_id { + ACPI_ADDRESS_RANGE_MEMORY = 1, + ACPI_ADDRESS_RANGE_RESERVED = 2, + ACPI_ADDRESS_RANGE_ACPI = 3, + ACPI_ADDRESS_RANGE_NVS = 4, + ACPI_ADDRESS_RANGE_COUNT +}; /* - * Sysctl declarations + * System Locality Information Table (SLIT) + * see http://devresource.hp.com/devresource/docs/techpapers/ia64/slit.pdf */ -enum -{ - CTL_ACPI = 10 +struct acpi_table_slit { + struct acpi_table_header header; + u64 localities; + u8 entry[1]; /* real size = localities^2 */ }; -enum -{ - ACPI_FADT = 1, +/* Smart Battery Description Table (SBST) */ + +struct acpi_table_sbst { + struct acpi_table_header header; + u32 warning; /* Warn user */ + u32 low; /* Critical sleep */ + u32 critical; /* Critical shutdown */ +} __attribute__ ((packed)); + +/* Embedded Controller Boot Resources Table (ECDT) */ + +/* TBD: acpi_generic_address +struct acpi_table_ecdt { + struct acpi_table_header header; + acpi_generic_address ec_control; + acpi_generic_address ec_data; + u32 uid; + u8 gpe_bit; + char *ec_id; +} __attribute__ ((packed)); +*/ + +/* Table Handlers */ + +enum acpi_table_id { + ACPI_TABLE_UNKNOWN = 0, + ACPI_APIC, + ACPI_BOOT, + ACPI_DBGP, ACPI_DSDT, - ACPI_PM1_ENABLE, - ACPI_GPE_ENABLE, - ACPI_GPE_LEVEL, - ACPI_EVENT, - ACPI_P_BLK, - ACPI_ENTER_LVL2_LAT, - ACPI_ENTER_LVL3_LAT, - ACPI_P_LVL2_LAT, - ACPI_P_LVL3_LAT, - ACPI_C1_TIME, - ACPI_C2_TIME, - ACPI_C3_TIME, - ACPI_C1_COUNT, - ACPI_C2_COUNT, - ACPI_C3_COUNT, - ACPI_S0_SLP_TYP, - ACPI_S1_SLP_TYP, - ACPI_S5_SLP_TYP, - ACPI_SLEEP, + ACPI_ECDT, + ACPI_ETDT, + ACPI_FACP, ACPI_FACS, - ACPI_XSDT, - ACPI_PMTIMER, - ACPI_BATT, + ACPI_OEMX, + ACPI_PSDT, + ACPI_SBST, + ACPI_SLIT, + ACPI_SPCR, + ACPI_SRAT, + ACPI_SSDT, + ACPI_SPMI, + ACPI_TABLE_COUNT }; -#define ACPI_SLP_TYP_DISABLED (~0UL) +typedef int (*acpi_table_handler) (unsigned long phys_addr, unsigned long size); + +extern acpi_table_handler acpi_table_ops[ACPI_TABLE_COUNT]; + +typedef int (*acpi_madt_entry_handler) (acpi_table_entry_header *header); + +struct acpi_boot_flags { + u8 madt:1; + u8 reserved:7; +}; -#ifdef __KERNEL__ +int acpi_table_init (char *cmdline); +int acpi_table_parse (enum acpi_table_id, acpi_table_handler); +int acpi_table_parse_madt (enum acpi_table_id, acpi_madt_entry_handler); +void acpi_table_print (struct acpi_table_header *, unsigned long); +void acpi_table_print_madt_entry (acpi_table_entry_header *); -/* routines for saving/restoring kernel state */ -FASTCALL(extern unsigned long acpi_save_state_mem(unsigned long return_point)); -FASTCALL(extern int acpi_save_state_disk(unsigned long return_point)); -extern void acpi_restore_state(void); +#endif /*CONFIG_ACPI_BOOT*/ -extern unsigned long acpi_wakeup_address; -#endif /* __KERNEL__ */ +/* -------------------------------------------------------------------------- + PCI Interrupt Routing (PRT) + -------------------------------------------------------------------------- */ + +#ifdef CONFIG_ACPI_PCI + +#define ACPI_PCI_ROUTING_PIC 0 +#define ACPI_PCI_ROUTING_IOAPIC 1 +#define ACPI_PCI_ROUTING_IOSAPIC 2 + +struct acpi_prt_entry { + struct list_head node; + struct { + u8 seg; + u8 bus; + u8 dev; + u8 pin; + } id; + struct { + acpi_handle handle; + u32 index; + } source; +}; + +struct acpi_prt_list { + int count; + struct list_head entries; +}; + +extern struct acpi_prt_list acpi_prts; + +struct pci_dev; + +int acpi_prt_get_irq (struct pci_dev *dev, u8 pin, int *irq); +int acpi_prt_set_irq (struct pci_dev *dev, u8 pin, int irq); + +#endif /*CONFIG_ACPI_PCI*/ + + +/* -------------------------------------------------------------------------- + ACPI Interpreter (Core) + -------------------------------------------------------------------------- */ + +#ifdef CONFIG_ACPI_INTERPRETER int acpi_init(void); -#endif /* _LINUX_ACPI_H */ +#endif /*CONFIG_ACPI_INTERPRETER*/ + + +#endif /*_LINUX_ACPI_H*/ diff --git a/include/linux/fs.h b/include/linux/fs.h index 9cd6a35ab641..dc0d9a84bf27 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -647,16 +647,13 @@ struct quota_mount_options #include <linux/ext3_fs_sb.h> #include <linux/hpfs_fs_sb.h> -#include <linux/msdos_fs_sb.h> #include <linux/iso_fs_sb.h> #include <linux/sysv_fs_sb.h> #include <linux/affs_fs_sb.h> #include <linux/ufs_fs_sb.h> #include <linux/romfs_fs_sb.h> -#include <linux/smb_fs_sb.h> #include <linux/hfs_fs_sb.h> #include <linux/adfs_fs_sb.h> -#include <linux/qnx4_fs_sb.h> #include <linux/reiserfs_fs_sb.h> #include <linux/bfs_fs_sb.h> #include <linux/udf_fs_sb.h> @@ -698,17 +695,14 @@ struct super_block { union { struct ext3_sb_info ext3_sb; struct hpfs_sb_info hpfs_sb; - struct msdos_sb_info msdos_sb; struct isofs_sb_info isofs_sb; struct sysv_sb_info sysv_sb; struct affs_sb_info affs_sb; struct ufs_sb_info ufs_sb; struct shmem_sb_info shmem_sb; struct romfs_sb_info romfs_sb; - struct smb_sb_info smbfs_sb; struct hfs_sb_info hfs_sb; struct adfs_sb_info adfs_sb; - struct qnx4_sb_info qnx4_sb; struct reiserfs_sb_info reiserfs_sb; struct bfs_sb_info bfs_sb; struct udf_sb_info udf_sb; @@ -1454,7 +1448,6 @@ extern void do_generic_file_read(struct file *, loff_t *, read_descriptor_t *, r extern loff_t no_llseek(struct file *file, loff_t offset, int origin); extern loff_t generic_file_llseek(struct file *file, loff_t offset, int origin); extern loff_t remote_llseek(struct file *file, loff_t offset, int origin); -extern ssize_t generic_read_dir(struct file *, char *, size_t, loff_t *); extern int generic_file_open(struct inode * inode, struct file * filp); extern struct file_operations generic_ro_fops; @@ -1466,7 +1459,6 @@ extern int page_follow_link(struct dentry *, struct nameidata *); extern struct inode_operations page_symlink_inode_operations; extern int vfs_readdir(struct file *, filldir_t, void *); -extern int dcache_readdir(struct file *, void *, filldir_t); extern int vfs_stat(char *, struct kstat *); extern int vfs_lstat(char *, struct kstat *); @@ -1478,6 +1470,12 @@ extern void drop_super(struct super_block *sb); extern kdev_t ROOT_DEV; extern char root_device_name[]; +extern int dcache_readdir(struct file *, void *, filldir_t); +extern int simple_statfs(struct super_block *, struct statfs *); +extern struct dentry *simple_lookup(struct inode *, struct dentry *); +extern ssize_t generic_read_dir(struct file *, char *, size_t, loff_t *); +extern struct file_operations simple_dir_operations; +extern struct inode_operations simple_dir_inode_operations; extern void show_buffers(void); diff --git a/include/linux/init_task.h b/include/linux/init_task.h index 9f34e057079a..98951775c267 100644 --- a/include/linux/init_task.h +++ b/include/linux/init_task.h @@ -53,10 +53,11 @@ active_mm: &init_mm, \ run_list: LIST_HEAD_INIT(tsk.run_list), \ time_slice: HZ, \ - next_task: &tsk, \ - prev_task: &tsk, \ - p_opptr: &tsk, \ - p_pptr: &tsk, \ + tasks: LIST_HEAD_INIT(tsk.tasks), \ + real_parent: &tsk, \ + parent: &tsk, \ + children: LIST_HEAD_INIT(tsk.children), \ + sibling: LIST_HEAD_INIT(tsk.sibling), \ thread_group: LIST_HEAD_INIT(tsk.thread_group), \ wait_chldexit: __WAIT_QUEUE_HEAD_INITIALIZER(tsk.wait_chldexit),\ real_timer: { \ diff --git a/include/linux/msdos_fs.h b/include/linux/msdos_fs.h index 4851d846d912..022e7a89d98a 100644 --- a/include/linux/msdos_fs.h +++ b/include/linux/msdos_fs.h @@ -5,6 +5,7 @@ * The MS-DOS filesystem constants/structures */ #include <linux/msdos_fs_i.h> +#include <linux/msdos_fs_sb.h> #include <asm/byteorder.h> @@ -53,7 +54,11 @@ #define MSDOS_VALID_MODE (S_IFREG | S_IFDIR | S_IRWXU | S_IRWXG | S_IRWXO) /* valid file mode bits */ -#define MSDOS_SB(s) (&((s)->u.msdos_sb)) +static inline struct msdos_sb_info *MSDOS_SB(struct super_block *sb) +{ + return sb->u.generic_sbp; +} + static inline struct msdos_inode_info *MSDOS_I(struct inode *inode) { return list_entry(inode, struct msdos_inode_info, vfs_inode); @@ -282,9 +287,8 @@ extern struct inode *fat_build_inode(struct super_block *sb, extern void fat_delete_inode(struct inode *inode); extern void fat_clear_inode(struct inode *inode); extern void fat_put_super(struct super_block *sb); -extern struct super_block * -fat_read_super(struct super_block *sb, void *data, int silent, - struct inode_operations *fs_dir_inode_ops); +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 void fat_write_inode(struct inode *inode, int wait); extern int fat_notify_change(struct dentry * dentry, struct iattr * attr); diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 178f6a5a0fe6..32b6db3c7a2c 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -206,7 +206,8 @@ enum netdev_state_t __LINK_STATE_START, __LINK_STATE_PRESENT, __LINK_STATE_SCHED, - __LINK_STATE_NOCARRIER + __LINK_STATE_NOCARRIER, + __LINK_STATE_RX_SCHED }; @@ -330,6 +331,10 @@ struct net_device void *ip6_ptr; /* IPv6 specific data */ void *ec_ptr; /* Econet specific data */ + struct list_head poll_list; /* Link to poll list */ + int quota; + int weight; + struct Qdisc *qdisc; struct Qdisc *qdisc_sleeping; struct Qdisc *qdisc_list; @@ -373,6 +378,7 @@ struct net_device int (*stop)(struct net_device *dev); int (*hard_start_xmit) (struct sk_buff *skb, struct net_device *dev); + int (*poll) (struct net_device *dev, int *quota); int (*hard_header) (struct sk_buff *skb, struct net_device *dev, unsigned short type, @@ -492,8 +498,11 @@ struct softnet_data int cng_level; int avg_blog; struct sk_buff_head input_pkt_queue; + struct list_head poll_list; struct net_device *output_queue; struct sk_buff *completion_queue; + + struct net_device backlog_dev; /* Sorry. 8) */ } __attribute__((__aligned__(SMP_CACHE_BYTES))); @@ -547,6 +556,7 @@ static inline int netif_running(struct net_device *dev) return test_bit(__LINK_STATE_START, &dev->state); } + /* Use this variant when it is known for sure that it * is executing from interrupt context. */ @@ -578,6 +588,8 @@ static inline void dev_kfree_skb_any(struct sk_buff *skb) extern void net_call_rx_atomic(void (*fn)(void)); #define HAVE_NETIF_RX 1 extern int netif_rx(struct sk_buff *skb); +#define HAVE_NETIF_RECEIVE_SKB 1 +extern int netif_receive_skb(struct sk_buff *skb); extern int dev_ioctl(unsigned int cmd, void *); extern int dev_change_flags(struct net_device *, unsigned); extern void dev_queue_xmit_nit(struct sk_buff *skb, struct net_device *dev); @@ -695,6 +707,78 @@ enum { #define netif_msg_rx_status(p) ((p)->msg_enable & NETIF_MSG_RX_STATUS) #define netif_msg_pktdata(p) ((p)->msg_enable & NETIF_MSG_PKTDATA) +/* Schedule rx intr now? */ + +static inline int netif_rx_schedule_prep(struct net_device *dev) +{ + return netif_running(dev) && + !test_and_set_bit(__LINK_STATE_RX_SCHED, &dev->state); +} + +/* Add interface to tail of rx poll list. This assumes that _prep has + * already been called and returned 1. + */ + +static inline void __netif_rx_schedule(struct net_device *dev) +{ + unsigned long flags; + int cpu = smp_processor_id(); + + local_irq_save(flags); + dev_hold(dev); + list_add_tail(&dev->poll_list, &softnet_data[cpu].poll_list); + if (dev->quota < 0) + dev->quota += dev->weight; + else + dev->quota = dev->weight; + __cpu_raise_softirq(cpu, NET_RX_SOFTIRQ); + local_irq_restore(flags); +} + +/* Try to reschedule poll. Called by irq handler. */ + +static inline void netif_rx_schedule(struct net_device *dev) +{ + if (netif_rx_schedule_prep(dev)) + __netif_rx_schedule(dev); +} + +/* Try to reschedule poll. Called by dev->poll() after netif_rx_complete(). + * Do not inline this? + */ +static inline int netif_rx_reschedule(struct net_device *dev, int undo) +{ + if (netif_rx_schedule_prep(dev)) { + unsigned long flags; + int cpu = smp_processor_id(); + + dev->quota += undo; + + local_irq_save(flags); + list_add_tail(&dev->poll_list, &softnet_data[cpu].poll_list); + __cpu_raise_softirq(cpu, NET_RX_SOFTIRQ); + local_irq_restore(flags); + return 1; + } + return 0; +} + +/* Remove interface from poll list: it must be in the poll list + * on current cpu. This primitive is called by dev->poll(), when + * it completes the work. The device cannot be out of poll list at this + * moment, it is BUG(). + */ +static inline void netif_rx_complete(struct net_device *dev) +{ + unsigned long flags; + + local_irq_save(flags); + if (!test_bit(__LINK_STATE_RX_SCHED, &dev->state)) BUG(); + list_del(&dev->poll_list); + clear_bit(__LINK_STATE_RX_SCHED, &dev->state); + local_irq_restore(flags); +} + /* These functions live elsewhere (drivers/net/net_init.c, but related) */ extern void ether_setup(struct net_device *dev); @@ -719,6 +803,7 @@ extern void dev_mcast_init(void); extern int netdev_register_fc(struct net_device *dev, void (*stimul)(struct net_device *dev)); extern void netdev_unregister_fc(int bit); extern int netdev_max_backlog; +extern int weight_p; extern unsigned long netdev_fc_xoff; extern atomic_t netdev_dropping; extern int netdev_set_master(struct net_device *dev, struct net_device *master); diff --git a/include/linux/netfilter_arp.h b/include/linux/netfilter_arp.h new file mode 100644 index 000000000000..4f460b3b0cba --- /dev/null +++ b/include/linux/netfilter_arp.h @@ -0,0 +1,19 @@ +#ifndef __LINUX_ARP_NETFILTER_H +#define __LINUX_ARP_NETFILTER_H + +/* ARP-specific defines for netfilter. + * (C)2002 Rusty Russell IBM -- This code is GPL. + */ + +#include <linux/config.h> +#include <linux/netfilter.h> + +/* There is no PF_ARP. */ +#define NF_ARP 0 + +/* ARP Hooks */ +#define NF_ARP_IN 0 +#define NF_ARP_OUT 1 +#define NF_ARP_NUMHOOKS 2 + +#endif /* __LINUX_ARP_NETFILTER_H */ diff --git a/include/linux/netfilter_arp/arp_tables.h b/include/linux/netfilter_arp/arp_tables.h new file mode 100644 index 000000000000..7b11e236c7c9 --- /dev/null +++ b/include/linux/netfilter_arp/arp_tables.h @@ -0,0 +1,342 @@ +/* + * Format of an ARP firewall descriptor + * + * src, tgt, src_mask, tgt_mask, arpop, arpop_mask are always stored in + * network byte order. + * flags are stored in host byte order (of course). + */ + +#ifndef _ARPTABLES_H +#define _ARPTABLES_H + +#ifdef __KERNEL__ +#include <linux/if.h> +#include <linux/types.h> +#include <linux/in.h> +#include <linux/if_arp.h> +#include <linux/skbuff.h> +#endif + +#include <linux/netfilter_arp.h> + +#define ARPT_FUNCTION_MAXNAMELEN 30 +#define ARPT_TABLE_MAXNAMELEN 32 + +#define ARPT_DEV_ADDR_LEN_MAX 16 + +struct arpt_devaddr_info { + char addr[ARPT_DEV_ADDR_LEN_MAX]; + char mask[ARPT_DEV_ADDR_LEN_MAX]; +}; + +/* Yes, Virginia, you have to zero the padding. */ +struct arpt_arp { + /* Source and target IP addr */ + struct in_addr src, tgt; + /* Mask for src and target IP addr */ + struct in_addr smsk, tmsk; + + /* Device hw address length, src+target device addresses */ + u_int8_t arhln, arhln_mask; + struct arpt_devaddr_info src_devaddr; + struct arpt_devaddr_info tgt_devaddr; + + /* ARP operation code. */ + u_int16_t arpop, arpop_mask; + + /* ARP hardware address and protocol address format. */ + u_int16_t arhrd, arhrd_mask; + u_int16_t arpro, arpro_mask; + + /* The protocol address length is only accepted if it is 4 + * so there is no use in offering a way to do filtering on it. + */ + + char iniface[IFNAMSIZ], outiface[IFNAMSIZ]; + unsigned char iniface_mask[IFNAMSIZ], outiface_mask[IFNAMSIZ]; + + /* Flags word */ + u_int8_t flags; + /* Inverse flags */ + u_int16_t invflags; +}; + +struct arpt_entry_target +{ + union { + struct { + u_int16_t target_size; + + /* Used by userspace */ + char name[ARPT_FUNCTION_MAXNAMELEN]; + } user; + struct { + u_int16_t target_size; + + /* Used inside the kernel */ + struct arpt_target *target; + } kernel; + + /* Total length */ + u_int16_t target_size; + } u; + + unsigned char data[0]; +}; + +struct arpt_standard_target +{ + struct arpt_entry_target target; + int verdict; +}; + +struct arpt_counters +{ + u_int64_t pcnt, bcnt; /* Packet and byte counters */ +}; + +/* Values for "flag" field in struct arpt_ip (general arp structure). + * No flags defined yet. + */ +#define ARPT_F_MASK 0x00 /* All possible flag bits mask. */ + +/* Values for "inv" field in struct arpt_arp. */ +#define ARPT_INV_VIA_IN 0x0001 /* Invert the sense of IN IFACE. */ +#define ARPT_INV_VIA_OUT 0x0002 /* Invert the sense of OUT IFACE */ +#define ARPT_INV_SRCIP 0x0004 /* Invert the sense of SRC IP. */ +#define ARPT_INV_TGTIP 0x0008 /* Invert the sense of TGT IP. */ +#define ARPT_INV_SRCDEVADDR 0x0010 /* Invert the sense of SRC DEV ADDR. */ +#define ARPT_INV_TGTDEVADDR 0x0020 /* Invert the sense of TGT DEV ADDR. */ +#define ARPT_INV_ARPOP 0x0040 /* Invert the sense of ARP OP. */ +#define ARPT_INV_ARPHRD 0x0080 /* Invert the sense of ARP HRD. */ +#define ARPT_INV_ARPPRO 0x0100 /* Invert the sense of ARP PRO. */ +#define ARPT_INV_ARPHLN 0x0200 /* Invert the sense of ARP HLN. */ +#define ARPT_INV_MASK 0x007F /* All possible flag bits mask. */ + +/* This structure defines each of the firewall rules. Consists of 3 + parts which are 1) general ARP header stuff 2) match specific + stuff 3) the target to perform if the rule matches */ +struct arpt_entry +{ + struct arpt_arp arp; + + /* Size of arpt_entry + matches */ + u_int16_t target_offset; + /* Size of arpt_entry + matches + target */ + u_int16_t next_offset; + + /* Back pointer */ + unsigned int comefrom; + + /* Packet and byte counters. */ + struct arpt_counters counters; + + /* The matches (if any), then the target. */ + unsigned char elems[0]; +}; + +/* + * New IP firewall options for [gs]etsockopt at the RAW IP level. + * Unlike BSD Linux inherits IP options so you don't have to use a raw + * socket for this. Instead we check rights in the calls. + */ +#define ARPT_BASE_CTL 96 /* base for firewall socket options */ + +#define ARPT_SO_SET_REPLACE (ARPT_BASE_CTL) +#define ARPT_SO_SET_ADD_COUNTERS (ARPT_BASE_CTL + 1) +#define ARPT_SO_SET_MAX ARPT_SO_SET_ADD_COUNTERS + +#define ARPT_SO_GET_INFO (ARPT_BASE_CTL) +#define ARPT_SO_GET_ENTRIES (ARPT_BASE_CTL + 1) +#define ARPT_SO_GET_MAX ARPT_SO_GET_ENTRIES + +/* CONTINUE verdict for targets */ +#define ARPT_CONTINUE 0xFFFFFFFF + +/* For standard target */ +#define ARPT_RETURN (-NF_MAX_VERDICT - 1) + +/* The argument to ARPT_SO_GET_INFO */ +struct arpt_getinfo +{ + /* Which table: caller fills this in. */ + char name[ARPT_TABLE_MAXNAMELEN]; + + /* Kernel fills these in. */ + /* Which hook entry points are valid: bitmask */ + unsigned int valid_hooks; + + /* Hook entry points: one per netfilter hook. */ + unsigned int hook_entry[NF_ARP_NUMHOOKS]; + + /* Underflow points. */ + unsigned int underflow[NF_ARP_NUMHOOKS]; + + /* Number of entries */ + unsigned int num_entries; + + /* Size of entries. */ + unsigned int size; +}; + +/* The argument to ARPT_SO_SET_REPLACE. */ +struct arpt_replace +{ + /* Which table. */ + char name[ARPT_TABLE_MAXNAMELEN]; + + /* Which hook entry points are valid: bitmask. You can't + change this. */ + unsigned int valid_hooks; + + /* Number of entries */ + unsigned int num_entries; + + /* Total size of new entries */ + unsigned int size; + + /* Hook entry points. */ + unsigned int hook_entry[NF_ARP_NUMHOOKS]; + + /* Underflow points. */ + unsigned int underflow[NF_ARP_NUMHOOKS]; + + /* Information about old entries: */ + /* Number of counters (must be equal to current number of entries). */ + unsigned int num_counters; + /* The old entries' counters. */ + struct arpt_counters *counters; + + /* The entries (hang off end: not really an array). */ + struct arpt_entry entries[0]; +}; + +/* The argument to ARPT_SO_ADD_COUNTERS. */ +struct arpt_counters_info +{ + /* Which table. */ + char name[ARPT_TABLE_MAXNAMELEN]; + + unsigned int num_counters; + + /* The counters (actually `number' of these). */ + struct arpt_counters counters[0]; +}; + +/* The argument to ARPT_SO_GET_ENTRIES. */ +struct arpt_get_entries +{ + /* Which table: user fills this in. */ + char name[ARPT_TABLE_MAXNAMELEN]; + + /* User fills this in: total entry size. */ + unsigned int size; + + /* The entries. */ + struct arpt_entry entrytable[0]; +}; + +/* Standard return verdict, or do jump. */ +#define ARPT_STANDARD_TARGET "" +/* Error verdict. */ +#define ARPT_ERROR_TARGET "ERROR" + +/* Helper functions */ +static __inline__ struct arpt_entry_target *arpt_get_target(struct arpt_entry *e) +{ + return (void *)e + e->target_offset; +} + +/* fn returns 0 to continue iteration */ +#define ARPT_ENTRY_ITERATE(entries, size, fn, args...) \ +({ \ + unsigned int __i; \ + int __ret = 0; \ + struct arpt_entry *__entry; \ + \ + for (__i = 0; __i < (size); __i += __entry->next_offset) { \ + __entry = (void *)(entries) + __i; \ + \ + __ret = fn(__entry , ## args); \ + if (__ret != 0) \ + break; \ + } \ + __ret; \ +}) + +/* + * Main firewall chains definitions and global var's definitions. + */ +#ifdef __KERNEL__ + +/* Registration hooks for targets. */ +struct arpt_target +{ + struct list_head list; + + const char name[ARPT_FUNCTION_MAXNAMELEN]; + + /* Returns verdict. */ + unsigned int (*target)(struct sk_buff **pskb, + unsigned int hooknum, + const struct net_device *in, + const struct net_device *out, + const void *targinfo, + void *userdata); + + /* Called when user tries to insert an entry of this type: + hook_mask is a bitmask of hooks from which it can be + called. */ + /* Should return true or false. */ + int (*checkentry)(const char *tablename, + const struct arpt_entry *e, + void *targinfo, + unsigned int targinfosize, + unsigned int hook_mask); + + /* Called when entry of this type deleted. */ + void (*destroy)(void *targinfo, unsigned int targinfosize); + + /* Set this to THIS_MODULE if you are a module, otherwise NULL */ + struct module *me; +}; + +extern int arpt_register_target(struct arpt_target *target); +extern void arpt_unregister_target(struct arpt_target *target); + +/* Furniture shopping... */ +struct arpt_table +{ + struct list_head list; + + /* A unique name... */ + char name[ARPT_TABLE_MAXNAMELEN]; + + /* Seed table: copied in register_table */ + struct arpt_replace *table; + + /* What hooks you will enter on */ + unsigned int valid_hooks; + + /* Lock for the curtain */ + rwlock_t lock; + + /* Man behind the curtain... */ + struct arpt_table_info *private; + + /* Set this to THIS_MODULE if you are a module, otherwise NULL */ + struct module *me; +}; + +extern int arpt_register_table(struct arpt_table *table); +extern void arpt_unregister_table(struct arpt_table *table); +extern unsigned int arpt_do_table(struct sk_buff **pskb, + unsigned int hook, + const struct net_device *in, + const struct net_device *out, + struct arpt_table *table, + void *userdata); + +#define ARPT_ALIGN(s) (((s) + (__alignof__(struct arpt_entry)-1)) & ~(__alignof__(struct arpt_entry)-1)) +#endif /*__KERNEL__*/ +#endif /* _ARPTABLES_H */ diff --git a/include/linux/netfilter_ipv4/ip_nat.h b/include/linux/netfilter_ipv4/ip_nat.h index 3a35b1fafd5d..0cfbfd7201c7 100644 --- a/include/linux/netfilter_ipv4/ip_nat.h +++ b/include/linux/netfilter_ipv4/ip_nat.h @@ -11,8 +11,13 @@ enum ip_nat_manip_type IP_NAT_MANIP_DST }; +#ifndef CONFIG_IP_NF_NAT_LOCAL /* SRC manip occurs only on POST_ROUTING */ #define HOOK2MANIP(hooknum) ((hooknum) != NF_IP_POST_ROUTING) +#else +/* SRC manip occurs POST_ROUTING or LOCAL_IN */ +#define HOOK2MANIP(hooknum) ((hooknum) != NF_IP_POST_ROUTING && (hooknum) != NF_IP_LOCAL_IN) +#endif /* 2.3.19 (I hope) will define this in linux/netfilter_ipv4.h. */ #ifndef SO_ORIGINAL_DST diff --git a/include/linux/nfsd/interface.h b/include/linux/nfsd/interface.h index 80c65165778d..af0979704afb 100644 --- a/include/linux/nfsd/interface.h +++ b/include/linux/nfsd/interface.h @@ -10,17 +10,4 @@ #ifndef LINUX_NFSD_INTERFACE_H #define LINUX_NFSD_INTERFACE_H -#include <linux/config.h> - -#ifndef CONFIG_NFSD -#ifdef CONFIG_MODULES - -extern struct nfsd_linkage { - long (*do_nfsservctl)(int cmd, void *argp, void *resp); - struct module *owner; -} * nfsd_linkage; - -#endif -#endif - #endif /* LINUX_NFSD_INTERFACE_H */ diff --git a/include/linux/nfsd/syscall.h b/include/linux/nfsd/syscall.h index e98c9fa8ae21..b68a0d63f901 100644 --- a/include/linux/nfsd/syscall.h +++ b/include/linux/nfsd/syscall.h @@ -133,7 +133,7 @@ union nfsctl_res { * Kernel syscall implementation. */ #if defined(CONFIG_NFSD) || defined(CONFIG_NFSD_MODULE) -extern asmlinkage long sys_nfsservctl(int, void *, void *); +extern asmlinkage long sys_nfsservctl(int, struct nfsctl_arg *, void *); #else #define sys_nfsservctl sys_ni_syscall #endif diff --git a/include/linux/qnx4_fs.h b/include/linux/qnx4_fs.h index fc1912a3fd72..06e0e6b51e4c 100644 --- a/include/linux/qnx4_fs.h +++ b/include/linux/qnx4_fs.h @@ -97,6 +97,13 @@ struct qnx4_super_block { #define QNX4DEBUG(X) (void) 0 #endif +struct qnx4_sb_info { + struct buffer_head *sb_buf; /* superblock buffer */ + struct qnx4_super_block *sb; /* our superblock */ + unsigned int Version; /* may be useful */ + struct qnx4_inode_entry *BitMap; /* useful */ +}; + struct qnx4_inode_info { struct qnx4_inode_entry raw; unsigned long mmu_private; @@ -126,6 +133,11 @@ extern int qnx4_sync_file(struct file *file, struct dentry *dentry, int); extern int qnx4_sync_inode(struct inode *inode); extern int qnx4_get_block(struct inode *inode, sector_t iblock, struct buffer_head *bh, int create); +static inline struct qnx4_sb_info *qnx4_sb(struct super_block *sb) +{ + return sb->u.generic_sbp; +} + static inline struct qnx4_inode_info *qnx4_i(struct inode *inode) { return list_entry(inode, struct qnx4_inode_info, vfs_inode); diff --git a/include/linux/qnx4_fs_sb.h b/include/linux/qnx4_fs_sb.h deleted file mode 100644 index 1f62cc0cc7fb..000000000000 --- a/include/linux/qnx4_fs_sb.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Name : qnx4_fs_sb.h - * Author : Richard Frowijn - * Function : qnx4 superblock definitions - * Version : 1.0.2 - * Last modified : 2000-01-06 - * - * History : 23-03-1998 created - * - */ -#ifndef _QNX4_FS_SB -#define _QNX4_FS_SB - -#include <linux/qnx4_fs.h> - -/* - * qnx4 super-block data in memory - */ - -struct qnx4_sb_info { - struct buffer_head *sb_buf; /* superblock buffer */ - struct qnx4_super_block *sb; /* our superblock */ - unsigned int Version; /* may be useful */ - struct qnx4_inode_entry *BitMap; /* useful */ -}; - -#endif diff --git a/include/linux/sched.h b/include/linux/sched.h index c71390735df2..205c801bea22 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -250,7 +250,7 @@ struct task_struct { unsigned long cpus_allowed; unsigned int time_slice; - struct task_struct *next_task, *prev_task; + struct list_head tasks; struct mm_struct *mm, *active_mm; struct list_head local_pages; @@ -274,9 +274,12 @@ struct task_struct { /* * pointers to (original) parent process, youngest child, younger sibling, * older sibling, respectively. (p->father can be replaced with - * p->p_pptr->pid) + * p->parent->pid) */ - struct task_struct *p_opptr, *p_pptr, *p_cptr, *p_ysptr, *p_osptr; + struct task_struct *real_parent; /* real parent process (when being debugged) */ + struct task_struct *parent; /* parent process */ + struct list_head children; /* list of my children */ + struct list_head sibling; /* linkage in my parent's children list */ struct list_head thread_group; /* PID hash table linkage. */ @@ -715,30 +718,48 @@ do { \ __ret; \ }) -#define REMOVE_LINKS(p) do { \ - (p)->next_task->prev_task = (p)->prev_task; \ - (p)->prev_task->next_task = (p)->next_task; \ - if ((p)->p_osptr) \ - (p)->p_osptr->p_ysptr = (p)->p_ysptr; \ - if ((p)->p_ysptr) \ - (p)->p_ysptr->p_osptr = (p)->p_osptr; \ - else \ - (p)->p_pptr->p_cptr = (p)->p_osptr; \ +#define remove_parent(p) list_del_init(&(p)->sibling) +#define add_parent(p, parent) list_add_tail(&(p)->sibling,&(parent)->children) + +#define REMOVE_LINKS(p) do { \ + list_del_init(&(p)->tasks); \ + remove_parent(p); \ } while (0) -#define SET_LINKS(p) do { \ - (p)->next_task = &init_task; \ - (p)->prev_task = init_task.prev_task; \ - init_task.prev_task->next_task = (p); \ - init_task.prev_task = (p); \ - (p)->p_ysptr = NULL; \ - if (((p)->p_osptr = (p)->p_pptr->p_cptr) != NULL) \ - (p)->p_osptr->p_ysptr = p; \ - (p)->p_pptr->p_cptr = p; \ +#define SET_LINKS(p) do { \ + list_add_tail(&(p)->tasks,&init_task.tasks); \ + add_parent(p, (p)->parent); \ } while (0) +static inline struct task_struct *eldest_child(struct task_struct *p) +{ + if (list_empty(&p->children)) return NULL; + return list_entry(p->children.next,struct task_struct,sibling); +} + +static inline struct task_struct *youngest_child(struct task_struct *p) +{ + if (list_empty(&p->children)) return NULL; + return list_entry(p->children.prev,struct task_struct,sibling); +} + +static inline struct task_struct *older_sibling(struct task_struct *p) +{ + if (p->sibling.prev==&p->parent->children) return NULL; + return list_entry(p->sibling.prev,struct task_struct,sibling); +} + +static inline struct task_struct *younger_sibling(struct task_struct *p) +{ + if (p->sibling.next==&p->parent->children) return NULL; + return list_entry(p->sibling.next,struct task_struct,sibling); +} + +#define next_task(p) list_entry((p)->tasks.next, struct task_struct, tasks) +#define prev_task(p) list_entry((p)->tasks.prev, struct task_struct, tasks) + #define for_each_task(p) \ - for (p = &init_task ; (p = p->next_task) != &init_task ; ) + for (p = &init_task ; (p = next_task(p)) != &init_task ; ) #define for_each_thread(task) \ for (task = next_thread(current) ; task != current ; task = next_thread(task)) diff --git a/include/linux/smb_fs.h b/include/linux/smb_fs.h index 62c079d5a44b..f554cf9057a8 100644 --- a/include/linux/smb_fs.h +++ b/include/linux/smb_fs.h @@ -11,6 +11,7 @@ #include <linux/smb.h> #include <linux/smb_fs_i.h> +#include <linux/smb_fs_sb.h> /* * ioctl commands @@ -29,6 +30,11 @@ #include <linux/smb_mount.h> #include <asm/unaligned.h> +static inline struct smb_sb_info *SMB_SB(struct super_block *sb) +{ + return sb->u.generic_sbp; +} + static inline struct smb_inode_info *SMB_I(struct inode *inode) { return list_entry(inode, struct smb_inode_info, vfs_inode); diff --git a/include/linux/smb_fs_sb.h b/include/linux/smb_fs_sb.h index 8226f7ecb79b..c5db9cd5136c 100644 --- a/include/linux/smb_fs_sb.h +++ b/include/linux/smb_fs_sb.h @@ -15,10 +15,9 @@ #include <linux/smb.h> /* structure access macros */ -#define server_from_inode(inode) (&(inode)->i_sb->u.smbfs_sb) -#define server_from_dentry(dentry) (&(dentry)->d_sb->u.smbfs_sb) -#define SB_of(server) ((struct super_block *) ((char *)(server) - \ - (unsigned long)(&((struct super_block *)0)->u.smbfs_sb))) +#define server_from_inode(inode) SMB_SB((inode)->i_sb) +#define server_from_dentry(dentry) SMB_SB((dentry)->d_sb) +#define SB_of(server) ((server)->super_block) struct smb_sb_info { enum smb_conn_state state; @@ -55,6 +54,7 @@ struct smb_sb_info { char *name_buf; struct smb_ops *ops; + struct super_block *super_block; }; diff --git a/include/linux/sunrpc/svcsock.h b/include/linux/sunrpc/svcsock.h index 95f52982b49e..eb118134b0c0 100644 --- a/include/linux/sunrpc/svcsock.h +++ b/include/linux/sunrpc/svcsock.h @@ -22,7 +22,7 @@ struct svc_sock { struct svc_serv * sk_server; /* service for this socket */ unsigned char sk_inuse; /* use count */ - unsigned int sk_flags; + unsigned long sk_flags; #define SK_BUSY 0 /* enqueued/receiving */ #define SK_CONN 1 /* conn pending */ #define SK_CLOSE 2 /* dead or dying */ diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h index 938560387354..01829afb8e41 100644 --- a/include/linux/sysctl.h +++ b/include/linux/sysctl.h @@ -202,7 +202,8 @@ enum NET_CORE_NO_CONG_THRESH=13, NET_CORE_NO_CONG=14, NET_CORE_LO_CONG=15, - NET_CORE_MOD_CONG=16 + NET_CORE_MOD_CONG=16, + NET_CORE_DEV_WEIGHT=17 }; /* /proc/sys/net/ethernet */ |
