diff --git a/[refs] b/[refs] index 48242f52aaad..d75d8b408852 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: d403a6484f0341bf0624d17ece46f24f741b6a92 +refs/heads/master: 35e396cd100489dfe8f5a76e3613fb8049ffdff3 diff --git a/trunk/Documentation/00-INDEX b/trunk/Documentation/00-INDEX index 73060819ed99..5b5aba404aac 100644 --- a/trunk/Documentation/00-INDEX +++ b/trunk/Documentation/00-INDEX @@ -251,6 +251,8 @@ mono.txt - how to execute Mono-based .NET binaries with the help of BINFMT_MISC. moxa-smartio - file with info on installing/using Moxa multiport serial driver. +mtrr.txt + - how to use PPro Memory Type Range Registers to increase performance. mutex-design.txt - info on the generic mutex subsystem. namespaces/ diff --git a/trunk/Documentation/cpu-freq/index.txt b/trunk/Documentation/cpu-freq/index.txt index 3d0b915035b9..ffdb5323df37 100644 --- a/trunk/Documentation/cpu-freq/index.txt +++ b/trunk/Documentation/cpu-freq/index.txt @@ -35,9 +35,11 @@ Mailing List ------------ There is a CPU frequency changing CVS commit and general list where you can report bugs, problems or submit patches. To post a message, -send an email to cpufreq@vger.kernel.org, to subscribe go to -http://vger.kernel.org/vger-lists.html#cpufreq and follow the -instructions there. +send an email to cpufreq@lists.linux.org.uk, to subscribe go to +http://lists.linux.org.uk/mailman/listinfo/cpufreq. Previous post to the +mailing list are available to subscribers at +http://lists.linux.org.uk/mailman/private/cpufreq/. + Links ----- @@ -48,7 +50,7 @@ how to access the CVS repository: * http://cvs.arm.linux.org.uk/ the CPUFreq Mailing list: -* http://vger.kernel.org/vger-lists.html#cpufreq +* http://lists.linux.org.uk/mailman/listinfo/cpufreq Clock and voltage scaling for the SA-1100: * http://www.lartmaker.nl/projects/scaling diff --git a/trunk/Documentation/hwmon/adt7473 b/trunk/Documentation/hwmon/adt7473 index 1cbf671822e2..2126de34c711 100644 --- a/trunk/Documentation/hwmon/adt7473 +++ b/trunk/Documentation/hwmon/adt7473 @@ -14,14 +14,14 @@ Description This driver implements support for the Analog Devices ADT7473 chip family. -The ADT7473 uses the 2-wire interface compatible with the SMBUS 2.0 +The LM85 uses the 2-wire interface compatible with the SMBUS 2.0 specification. Using an analog to digital converter it measures three (3) -temperatures and two (2) voltages. It has four (4) 16-bit counters for +temperatures and two (2) voltages. It has three (3) 16-bit counters for measuring fan speed. There are three (3) PWM outputs that can be used to control fan speed. A sophisticated control system for the PWM outputs is designed into the -ADT7473 that allows fan speed to be adjusted automatically based on any of the +LM85 that allows fan speed to be adjusted automatically based on any of the three temperature sensors. Each PWM output is individually adjustable and programmable. Once configured, the ADT7473 will adjust the PWM outputs in response to the measured temperatures without further host intervention. @@ -46,6 +46,14 @@ from the raw value to get the temperature value. The Analog Devices datasheet is very detailed and describes a procedure for determining an optimal configuration for the automatic PWM control. +Hardware Configurations +----------------------- + +The ADT7473 chips have an optional SMBALERT output that can be used to +signal the chipset in case a limit is exceeded or the temperature sensors +fail. Individual sensor interrupts can be masked so they won't trigger +SMBALERT. The SMBALERT output if configured replaces the PWM2 function. + Configuration Notes ------------------- @@ -53,8 +61,8 @@ Besides standard interfaces driver adds the following: * PWM Control -* pwm#_auto_point1_pwm and temp#_auto_point1_temp and -* pwm#_auto_point2_pwm and temp#_auto_point2_temp - +* pwm#_auto_point1_pwm and pwm#_auto_point1_temp and +* pwm#_auto_point2_pwm and pwm#_auto_point2_temp - point1: Set the pwm speed at a lower temperature bound. point2: Set the pwm speed at a higher temperature bound. diff --git a/trunk/Documentation/hwmon/sysfs-interface b/trunk/Documentation/hwmon/sysfs-interface index 6dbfd5efd991..2d845730d4e0 100644 --- a/trunk/Documentation/hwmon/sysfs-interface +++ b/trunk/Documentation/hwmon/sysfs-interface @@ -329,10 +329,6 @@ power[1-*]_average Average power use Unit: microWatt RO -power[1-*]_average_interval Power use averaging interval - Unit: milliseconds - RW - power[1-*]_average_highest Historical average maximum power use Unit: microWatt RO @@ -357,14 +353,6 @@ power[1-*]_reset_history Reset input_highest, input_lowest, average_highest and average_lowest. WO -********** -* Energy * -********** - -energy[1-*]_input Cumulative energy use - Unit: microJoule - RO - ********** * Alarms * ********** diff --git a/trunk/Documentation/kernel-parameters.txt b/trunk/Documentation/kernel-parameters.txt index 329dcabe4c5e..1150444a21ab 100644 --- a/trunk/Documentation/kernel-parameters.txt +++ b/trunk/Documentation/kernel-parameters.txt @@ -463,6 +463,12 @@ and is between 256 and 4096 characters. It is defined in the file Range: 0 - 8192 Default: 64 + disable_8254_timer + enable_8254_timer + [IA32/X86_64] Disable/Enable interrupt 0 timer routing + over the 8254 in addition to over the IO-APIC. The + kernel tries to set a sensible default. + hpet= [X86-32,HPET] option to control HPET usage Format: { enable (default) | disable | force } disable: disable HPET and use PIT instead @@ -1876,12 +1882,6 @@ and is between 256 and 4096 characters. It is defined in the file shapers= [NET] Maximal number of shapers. - show_msr= [x86] show boot-time MSR settings - Format: { } - Show boot-time (BIOS-initialized) MSR settings. - The parameter means the number of CPUs to show, - for example 1 means boot CPU only. - sim710= [SCSI,HW] See header of drivers/scsi/sim710.c. diff --git a/trunk/Documentation/x86/mtrr.txt b/trunk/Documentation/mtrr.txt similarity index 99% rename from trunk/Documentation/x86/mtrr.txt rename to trunk/Documentation/mtrr.txt index cc071dc333c2..c39ac395970e 100644 --- a/trunk/Documentation/x86/mtrr.txt +++ b/trunk/Documentation/mtrr.txt @@ -18,7 +18,7 @@ Richard Gooch The AMD K6-2 (stepping 8 and above) and K6-3 processors have two MTRRs. These are supported. The AMD Athlon family provide 8 Intel style MTRRs. - + The Centaur C6 (WinChip) has 8 MCRs, allowing write-combining. These are supported. @@ -87,7 +87,7 @@ reg00: base=0x00000000 ( 0MB), size= 64MB: write-back, count=1 reg01: base=0xfb000000 (4016MB), size= 16MB: write-combining, count=1 reg02: base=0xfb000000 (4016MB), size= 4kB: uncachable, count=1 -Some cards (especially Voodoo Graphics boards) need this 4 kB area +Some cards (especially Voodoo Graphics boards) need this 4 kB area excluded from the beginning of the region because it is used for registers. diff --git a/trunk/Documentation/x86/00-INDEX b/trunk/Documentation/x86/00-INDEX deleted file mode 100644 index dbe3377754af..000000000000 --- a/trunk/Documentation/x86/00-INDEX +++ /dev/null @@ -1,4 +0,0 @@ -00-INDEX - - this file -mtrr.txt - - how to use x86 Memory Type Range Registers to increase performance diff --git a/trunk/Documentation/x86/boot.txt b/trunk/Documentation/x86/i386/boot.txt similarity index 99% rename from trunk/Documentation/x86/boot.txt rename to trunk/Documentation/x86/i386/boot.txt index 83c0033ee9e0..147bfe511cdd 100644 --- a/trunk/Documentation/x86/boot.txt +++ b/trunk/Documentation/x86/i386/boot.txt @@ -308,7 +308,7 @@ Protocol: 2.00+ Field name: start_sys Type: read -Offset/size: 0x20c/2 +Offset/size: 0x20c/4 Protocol: 2.00+ The load low segment (0x1000). Obsolete. diff --git a/trunk/Documentation/x86/usb-legacy-support.txt b/trunk/Documentation/x86/i386/usb-legacy-support.txt similarity index 100% rename from trunk/Documentation/x86/usb-legacy-support.txt rename to trunk/Documentation/x86/i386/usb-legacy-support.txt diff --git a/trunk/Documentation/x86/zero-page.txt b/trunk/Documentation/x86/i386/zero-page.txt similarity index 100% rename from trunk/Documentation/x86/zero-page.txt rename to trunk/Documentation/x86/i386/zero-page.txt diff --git a/trunk/Documentation/x86/pat.txt b/trunk/Documentation/x86/pat.txt index c93ff5f4c0dd..17965f927c15 100644 --- a/trunk/Documentation/x86/pat.txt +++ b/trunk/Documentation/x86/pat.txt @@ -14,10 +14,6 @@ PAT allows for different types of memory attributes. The most commonly used ones that will be supported at this time are Write-back, Uncached, Write-combined and Uncached Minus. - -PAT APIs --------- - There are many different APIs in the kernel that allows setting of memory attributes at the page level. In order to avoid aliasing, these interfaces should be used thoughtfully. Below is a table of interfaces available, @@ -30,38 +26,38 @@ address range to avoid any aliasing. API | RAM | ACPI,... | Reserved/Holes | -----------------------|----------|------------|------------------| | | | | -ioremap | -- | UC- | UC- | +ioremap | -- | UC | UC | | | | | ioremap_cache | -- | WB | WB | | | | | -ioremap_nocache | -- | UC- | UC- | +ioremap_nocache | -- | UC | UC | | | | | ioremap_wc | -- | -- | WC | | | | | -set_memory_uc | UC- | -- | -- | +set_memory_uc | UC | -- | -- | set_memory_wb | | | | | | | | set_memory_wc | WC | -- | -- | set_memory_wb | | | | | | | | -pci sysfs resource | -- | -- | UC- | +pci sysfs resource | -- | -- | UC | | | | | pci sysfs resource_wc | -- | -- | WC | is IORESOURCE_PREFETCH| | | | | | | | -pci proc | -- | -- | UC- | +pci proc | -- | -- | UC | !PCIIOC_WRITE_COMBINE | | | | | | | | pci proc | -- | -- | WC | PCIIOC_WRITE_COMBINE | | | | | | | | -/dev/mem | -- | WB/WC/UC- | WB/WC/UC- | +/dev/mem | -- | UC | UC | read-write | | | | | | | | -/dev/mem | -- | UC- | UC- | +/dev/mem | -- | UC | UC | mmap SYNC flag | | | | | | | | -/dev/mem | -- | WB/WC/UC- | WB/WC/UC- | +/dev/mem | -- | WB/WC/UC | WB/WC/UC | mmap !SYNC flag | |(from exist-| (from exist- | and | | ing alias)| ing alias) | any alias to this area| | | | @@ -72,7 +68,7 @@ pci proc | -- | -- | WC | and | | | | MTRR says WB | | | | | | | | -/dev/mem | -- | -- | UC- | +/dev/mem | -- | -- | UC_MINUS | mmap !SYNC flag | | | | no alias to this area | | | | and | | | | @@ -102,35 +98,3 @@ types. Drivers should use set_memory_[uc|wc] to set access type for RAM ranges. - -PAT debugging -------------- - -With CONFIG_DEBUG_FS enabled, PAT memtype list can be examined by - -# mount -t debugfs debugfs /sys/kernel/debug -# cat /sys/kernel/debug/x86/pat_memtype_list -PAT memtype list: -uncached-minus @ 0x7fadf000-0x7fae0000 -uncached-minus @ 0x7fb19000-0x7fb1a000 -uncached-minus @ 0x7fb1a000-0x7fb1b000 -uncached-minus @ 0x7fb1b000-0x7fb1c000 -uncached-minus @ 0x7fb1c000-0x7fb1d000 -uncached-minus @ 0x7fb1d000-0x7fb1e000 -uncached-minus @ 0x7fb1e000-0x7fb25000 -uncached-minus @ 0x7fb25000-0x7fb26000 -uncached-minus @ 0x7fb26000-0x7fb27000 -uncached-minus @ 0x7fb27000-0x7fb28000 -uncached-minus @ 0x7fb28000-0x7fb2e000 -uncached-minus @ 0x7fb2e000-0x7fb2f000 -uncached-minus @ 0x7fb2f000-0x7fb30000 -uncached-minus @ 0x7fb31000-0x7fb32000 -uncached-minus @ 0x80000000-0x90000000 - -This list shows physical address ranges and various PAT settings used to -access those physical address ranges. - -Another, more verbose way of getting PAT related debug messages is with -"debugpat" boot parameter. With this parameter, various debug messages are -printed to dmesg log. - diff --git a/trunk/Documentation/x86/x86_64/boot-options.txt b/trunk/Documentation/x86/x86_64/boot-options.txt index 72ffb5373ec7..b0c7b6c4abda 100644 --- a/trunk/Documentation/x86/x86_64/boot-options.txt +++ b/trunk/Documentation/x86/x86_64/boot-options.txt @@ -54,6 +54,10 @@ APICs apicmaintimer. Useful when your PIT timer is totally broken. + disable_8254_timer / enable_8254_timer + Enable interrupt 0 timer routing over the 8254 in addition to over + the IO-APIC. The kernel tries to set a sensible default. + Early Console syntax: earlyprintk=vga diff --git a/trunk/Makefile b/trunk/Makefile index 16e3fbb968a8..ce9eceb2538e 100644 --- a/trunk/Makefile +++ b/trunk/Makefile @@ -1,7 +1,7 @@ VERSION = 2 PATCHLEVEL = 6 SUBLEVEL = 27 -EXTRAVERSION = +EXTRAVERSION = -rc9 NAME = Rotary Wombat # *DOCUMENTATION* diff --git a/trunk/arch/x86/Kconfig b/trunk/arch/x86/Kconfig index 97f0d2b6dc0c..ed92864d1325 100644 --- a/trunk/arch/x86/Kconfig +++ b/trunk/arch/x86/Kconfig @@ -29,7 +29,6 @@ config X86 select HAVE_FTRACE select HAVE_KVM if ((X86_32 && !X86_VOYAGER && !X86_VISWS && !X86_NUMAQ) || X86_64) select HAVE_ARCH_KGDB if !X86_VOYAGER - select HAVE_ARCH_TRACEHOOK select HAVE_GENERIC_DMA_COHERENT if X86_32 select HAVE_EFFICIENT_UNALIGNED_ACCESS @@ -1021,7 +1020,7 @@ config HAVE_ARCH_ALLOC_REMAP config ARCH_FLATMEM_ENABLE def_bool y - depends on X86_32 && ARCH_SELECT_MEMORY_MODEL && !NUMA + depends on X86_32 && ARCH_SELECT_MEMORY_MODEL && X86_PC && !NUMA config ARCH_DISCONTIGMEM_ENABLE def_bool y @@ -1037,7 +1036,7 @@ config ARCH_SPARSEMEM_DEFAULT config ARCH_SPARSEMEM_ENABLE def_bool y - depends on X86_64 || NUMA || (EXPERIMENTAL && X86_PC) || X86_GENERICARCH + depends on X86_64 || NUMA || (EXPERIMENTAL && X86_PC) select SPARSEMEM_STATIC if X86_32 select SPARSEMEM_VMEMMAP_ENABLE if X86_64 @@ -1118,10 +1117,10 @@ config MTRR You can safely say Y even if your machine doesn't have MTRRs, you'll just add about 9 KB to your kernel. - See for more information. + See for more information. config MTRR_SANITIZER - def_bool y + bool prompt "MTRR cleanup support" depends on MTRR help @@ -1132,7 +1131,7 @@ config MTRR_SANITIZER The largest mtrr entry size for a continous block can be set with mtrr_chunk_size. - If unsure, say Y. + If unsure, say N. config MTRR_SANITIZER_ENABLE_DEFAULT int "MTRR cleanup enable value (0-1)" @@ -1192,6 +1191,7 @@ config IRQBALANCE config SECCOMP def_bool y prompt "Enable seccomp to safely compute untrusted bytecode" + depends on PROC_FS help This kernel feature is useful for number crunching applications that may need to compute untrusted bytecode during their @@ -1199,7 +1199,7 @@ config SECCOMP the process as file descriptors supporting the read/write syscalls, it's possible to isolate those applications in their own address space using seccomp. Once seccomp is - enabled via prctl(PR_SET_SECCOMP), it cannot be disabled + enabled via /proc//seccomp, it cannot be disabled and the task is only allowed to execute a few safe syscalls defined by each seccomp mode. @@ -1356,14 +1356,14 @@ config PHYSICAL_ALIGN Don't change this unless you know what you are doing. config HOTPLUG_CPU - bool "Support for hot-pluggable CPUs" - depends on SMP && HOTPLUG && !X86_VOYAGER + bool "Support for suspend on SMP and hot-pluggable CPUs (EXPERIMENTAL)" + depends on SMP && HOTPLUG && EXPERIMENTAL && !X86_VOYAGER ---help--- - Say Y here to allow turning CPUs off and on. CPUs can be - controlled through /sys/devices/system/cpu. - ( Note: power management support will enable this option - automatically on SMP systems. ) - Say N if you want to disable CPU hotplug. + Say Y here to experiment with turning CPUs off and on, and to + enable suspend on SMP systems. CPUs can be controlled through + /sys/devices/system/cpu. + Say N if you want to disable CPU hotplug and don't need to + suspend. config COMPAT_VDSO def_bool y @@ -1378,51 +1378,6 @@ config COMPAT_VDSO If unsure, say Y. -config CMDLINE_BOOL - bool "Built-in kernel command line" - default n - help - Allow for specifying boot arguments to the kernel at - build time. On some systems (e.g. embedded ones), it is - necessary or convenient to provide some or all of the - kernel boot arguments with the kernel itself (that is, - to not rely on the boot loader to provide them.) - - To compile command line arguments into the kernel, - set this option to 'Y', then fill in the - the boot arguments in CONFIG_CMDLINE. - - Systems with fully functional boot loaders (i.e. non-embedded) - should leave this option set to 'N'. - -config CMDLINE - string "Built-in kernel command string" - depends on CMDLINE_BOOL - default "" - help - Enter arguments here that should be compiled into the kernel - image and used at boot time. If the boot loader provides a - command line at boot time, it is appended to this string to - form the full kernel command line, when the system boots. - - However, you can use the CONFIG_CMDLINE_OVERRIDE option to - change this behavior. - - In most cases, the command line (whether built-in or provided - by the boot loader) should specify the device for the root - file system. - -config CMDLINE_OVERRIDE - bool "Built-in command line overrides boot loader arguments" - default n - depends on CMDLINE_BOOL - help - Set this option to 'Y' to have the kernel ignore the boot loader - command line, and use ONLY the built-in command line. - - This is used to work around broken boot loaders. This should - be set to 'N' under normal conditions. - endmenu config ARCH_ENABLE_MEMORY_HOTPLUG @@ -1818,7 +1773,7 @@ config COMPAT_FOR_U64_ALIGNMENT config SYSVIPC_COMPAT def_bool y - depends on COMPAT && SYSVIPC + depends on X86_64 && COMPAT && SYSVIPC endmenu diff --git a/trunk/arch/x86/Kconfig.cpu b/trunk/arch/x86/Kconfig.cpu index 60a85768cfcb..b225219c448c 100644 --- a/trunk/arch/x86/Kconfig.cpu +++ b/trunk/arch/x86/Kconfig.cpu @@ -418,21 +418,3 @@ config X86_MINIMUM_CPU_FAMILY config X86_DEBUGCTLMSR def_bool y depends on !(MK6 || MWINCHIPC6 || MWINCHIP2 || MWINCHIP3D || MCYRIXIII || M586MMX || M586TSC || M586 || M486 || M386) - -config X86_DS - bool "Debug Store support" - default y - help - Add support for Debug Store. - This allows the kernel to provide a memory buffer to the hardware - to store various profiling and tracing events. - -config X86_PTRACE_BTS - bool "ptrace interface to Branch Trace Store" - default y - depends on (X86_DS && X86_DEBUGCTLMSR) - help - Add a ptrace interface to allow collecting an execution trace - of the traced task. - This collects control flow changes in a (cyclic) buffer and allows - debuggers to fill in the gaps and show an execution trace of the debuggee. diff --git a/trunk/arch/x86/boot/compressed/head_32.S b/trunk/arch/x86/boot/compressed/head_32.S index 29c5fbf08392..ba7736cf2ec7 100644 --- a/trunk/arch/x86/boot/compressed/head_32.S +++ b/trunk/arch/x86/boot/compressed/head_32.S @@ -137,15 +137,14 @@ relocated: */ movl output_len(%ebx), %eax pushl %eax - # push arguments for decompress_kernel: pushl %ebp # output address movl input_len(%ebx), %eax pushl %eax # input_len leal input_data(%ebx), %eax pushl %eax # input_data leal boot_heap(%ebx), %eax - pushl %eax # heap area - pushl %esi # real mode pointer + pushl %eax # heap area as third argument + pushl %esi # real mode pointer as second arg call decompress_kernel addl $20, %esp popl %ecx diff --git a/trunk/arch/x86/boot/compressed/misc.c b/trunk/arch/x86/boot/compressed/misc.c index 5780d361105b..9fea73706479 100644 --- a/trunk/arch/x86/boot/compressed/misc.c +++ b/trunk/arch/x86/boot/compressed/misc.c @@ -16,7 +16,7 @@ */ #undef CONFIG_PARAVIRT #ifdef CONFIG_X86_32 -#define ASM_X86__DESC_H 1 +#define _ASM_DESC_H_ 1 #endif #ifdef CONFIG_X86_64 @@ -27,7 +27,7 @@ #include #include #include -#include +#include #include #include #include @@ -251,7 +251,7 @@ static void __putstr(int error, const char *s) y--; } } else { - vidmem[(x + cols * y) * 2] = c; + vidmem [(x + cols * y) * 2] = c; if (++x >= cols) { x = 0; if (++y >= lines) { @@ -277,8 +277,7 @@ static void *memset(void *s, int c, unsigned n) int i; char *ss = s; - for (i = 0; i < n; i++) - ss[i] = c; + for (i = 0; i < n; i++) ss[i] = c; return s; } @@ -288,8 +287,7 @@ static void *memcpy(void *dest, const void *src, unsigned n) const char *s = src; char *d = dest; - for (i = 0; i < n; i++) - d[i] = s[i]; + for (i = 0; i < n; i++) d[i] = s[i]; return dest; } diff --git a/trunk/arch/x86/boot/header.S b/trunk/arch/x86/boot/header.S index b993062e9a5f..af86e431acfa 100644 --- a/trunk/arch/x86/boot/header.S +++ b/trunk/arch/x86/boot/header.S @@ -30,6 +30,7 @@ SYSSEG = DEF_SYSSEG /* system loaded at 0x10000 (65536) */ SYSSIZE = DEF_SYSSIZE /* system size: # of 16-byte clicks */ /* to be loaded */ ROOT_DEV = 0 /* ROOT_DEV is now written by "build" */ +SWAP_DEV = 0 /* SWAP_DEV is now written by "build" */ #ifndef SVGA_MODE #define SVGA_MODE ASK_VGA diff --git a/trunk/arch/x86/configs/i386_defconfig b/trunk/arch/x86/configs/i386_defconfig index ef9a52005ec9..104275e191a8 100644 --- a/trunk/arch/x86/configs/i386_defconfig +++ b/trunk/arch/x86/configs/i386_defconfig @@ -1,7 +1,7 @@ # # Automatically generated make config: don't edit -# Linux kernel version: 2.6.27-rc5 -# Wed Sep 3 17:23:09 2008 +# Linux kernel version: 2.6.27-rc4 +# Mon Aug 25 15:04:00 2008 # # CONFIG_64BIT is not set CONFIG_X86_32=y @@ -202,7 +202,7 @@ CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y # CONFIG_M586 is not set # CONFIG_M586TSC is not set # CONFIG_M586MMX is not set -CONFIG_M686=y +# CONFIG_M686 is not set # CONFIG_MPENTIUMII is not set # CONFIG_MPENTIUMIII is not set # CONFIG_MPENTIUMM is not set @@ -221,14 +221,13 @@ CONFIG_M686=y # CONFIG_MVIAC3_2 is not set # CONFIG_MVIAC7 is not set # CONFIG_MPSC is not set -# CONFIG_MCORE2 is not set +CONFIG_MCORE2=y # CONFIG_GENERIC_CPU is not set CONFIG_X86_GENERIC=y CONFIG_X86_CPU=y CONFIG_X86_CMPXCHG=y CONFIG_X86_L1_CACHE_SHIFT=7 CONFIG_X86_XADD=y -# CONFIG_X86_PPRO_FENCE is not set CONFIG_X86_WP_WORKS_OK=y CONFIG_X86_INVLPG=y CONFIG_X86_BSWAP=y @@ -236,15 +235,14 @@ CONFIG_X86_POPAD_OK=y CONFIG_X86_INTEL_USERCOPY=y CONFIG_X86_USE_PPRO_CHECKSUM=y CONFIG_X86_TSC=y -CONFIG_X86_CMOV=y CONFIG_X86_MINIMUM_CPU_FAMILY=4 CONFIG_X86_DEBUGCTLMSR=y CONFIG_HPET_TIMER=y CONFIG_HPET_EMULATE_RTC=y CONFIG_DMI=y # CONFIG_IOMMU_HELPER is not set -CONFIG_NR_CPUS=64 -CONFIG_SCHED_SMT=y +CONFIG_NR_CPUS=4 +# CONFIG_SCHED_SMT is not set CONFIG_SCHED_MC=y # CONFIG_PREEMPT_NONE is not set CONFIG_PREEMPT_VOLUNTARY=y @@ -256,8 +254,7 @@ CONFIG_VM86=y # CONFIG_TOSHIBA is not set # CONFIG_I8K is not set CONFIG_X86_REBOOTFIXUPS=y -CONFIG_MICROCODE=y -CONFIG_MICROCODE_OLD_INTERFACE=y +# CONFIG_MICROCODE is not set CONFIG_X86_MSR=y CONFIG_X86_CPUID=y # CONFIG_NOHIGHMEM is not set @@ -2118,7 +2115,7 @@ CONFIG_IO_DELAY_0X80=y CONFIG_DEFAULT_IO_DELAY_TYPE=0 CONFIG_DEBUG_BOOT_PARAMS=y # CONFIG_CPA_DEBUG is not set -CONFIG_OPTIMIZE_INLINING=y +# CONFIG_OPTIMIZE_INLINING is not set # # Security options diff --git a/trunk/arch/x86/configs/x86_64_defconfig b/trunk/arch/x86/configs/x86_64_defconfig index e620ea6e2a7a..678c8acefe04 100644 --- a/trunk/arch/x86/configs/x86_64_defconfig +++ b/trunk/arch/x86/configs/x86_64_defconfig @@ -1,7 +1,7 @@ # # Automatically generated make config: don't edit -# Linux kernel version: 2.6.27-rc5 -# Wed Sep 3 17:13:39 2008 +# Linux kernel version: 2.6.27-rc4 +# Mon Aug 25 14:40:46 2008 # CONFIG_64BIT=y # CONFIG_X86_32 is not set @@ -218,14 +218,17 @@ CONFIG_X86_PC=y # CONFIG_MVIAC3_2 is not set # CONFIG_MVIAC7 is not set # CONFIG_MPSC is not set -# CONFIG_MCORE2 is not set -CONFIG_GENERIC_CPU=y +CONFIG_MCORE2=y +# CONFIG_GENERIC_CPU is not set CONFIG_X86_CPU=y -CONFIG_X86_L1_CACHE_BYTES=128 -CONFIG_X86_INTERNODE_CACHE_BYTES=128 +CONFIG_X86_L1_CACHE_BYTES=64 +CONFIG_X86_INTERNODE_CACHE_BYTES=64 CONFIG_X86_CMPXCHG=y -CONFIG_X86_L1_CACHE_SHIFT=7 +CONFIG_X86_L1_CACHE_SHIFT=6 CONFIG_X86_WP_WORKS_OK=y +CONFIG_X86_INTEL_USERCOPY=y +CONFIG_X86_USE_PPRO_CHECKSUM=y +CONFIG_X86_P6_NOP=y CONFIG_X86_TSC=y CONFIG_X86_CMPXCHG64=y CONFIG_X86_CMOV=y @@ -240,8 +243,9 @@ CONFIG_CALGARY_IOMMU_ENABLED_BY_DEFAULT=y CONFIG_AMD_IOMMU=y CONFIG_SWIOTLB=y CONFIG_IOMMU_HELPER=y -CONFIG_NR_CPUS=64 -CONFIG_SCHED_SMT=y +# CONFIG_MAXSMP is not set +CONFIG_NR_CPUS=4 +# CONFIG_SCHED_SMT is not set CONFIG_SCHED_MC=y # CONFIG_PREEMPT_NONE is not set CONFIG_PREEMPT_VOLUNTARY=y @@ -250,8 +254,7 @@ CONFIG_X86_LOCAL_APIC=y CONFIG_X86_IO_APIC=y # CONFIG_X86_MCE is not set # CONFIG_I8K is not set -CONFIG_MICROCODE=y -CONFIG_MICROCODE_OLD_INTERFACE=y +# CONFIG_MICROCODE is not set CONFIG_X86_MSR=y CONFIG_X86_CPUID=y CONFIG_NUMA=y @@ -287,7 +290,7 @@ CONFIG_BOUNCE=y CONFIG_VIRT_TO_BUS=y CONFIG_MTRR=y # CONFIG_MTRR_SANITIZER is not set -CONFIG_X86_PAT=y +# CONFIG_X86_PAT is not set CONFIG_EFI=y CONFIG_SECCOMP=y # CONFIG_HZ_100 is not set @@ -2086,7 +2089,7 @@ CONFIG_IO_DELAY_0X80=y CONFIG_DEFAULT_IO_DELAY_TYPE=0 CONFIG_DEBUG_BOOT_PARAMS=y # CONFIG_CPA_DEBUG is not set -CONFIG_OPTIMIZE_INLINING=y +# CONFIG_OPTIMIZE_INLINING is not set # # Security options diff --git a/trunk/arch/x86/ia32/ia32_aout.c b/trunk/arch/x86/ia32/ia32_aout.c index 127ec3f07214..a0e1dbe67dc1 100644 --- a/trunk/arch/x86/ia32/ia32_aout.c +++ b/trunk/arch/x86/ia32/ia32_aout.c @@ -85,10 +85,8 @@ static void dump_thread32(struct pt_regs *regs, struct user32 *dump) dump->regs.ax = regs->ax; dump->regs.ds = current->thread.ds; dump->regs.es = current->thread.es; - savesegment(fs, fs); - dump->regs.fs = fs; - savesegment(gs, gs); - dump->regs.gs = gs; + asm("movl %%fs,%0" : "=r" (fs)); dump->regs.fs = fs; + asm("movl %%gs,%0" : "=r" (gs)); dump->regs.gs = gs; dump->regs.orig_ax = regs->orig_ax; dump->regs.ip = regs->ip; dump->regs.cs = regs->cs; @@ -432,9 +430,8 @@ static int load_aout_binary(struct linux_binprm *bprm, struct pt_regs *regs) current->mm->start_stack = (unsigned long)create_aout_tables((char __user *)bprm->p, bprm); /* start thread */ - loadsegment(fs, 0); - loadsegment(ds, __USER32_DS); - loadsegment(es, __USER32_DS); + asm volatile("movl %0,%%fs" :: "r" (0)); \ + asm volatile("movl %0,%%es; movl %0,%%ds": :"r" (__USER32_DS)); load_gs_index(0); (regs)->ip = ex.a_entry; (regs)->sp = current->mm->start_stack; diff --git a/trunk/arch/x86/ia32/ia32_signal.c b/trunk/arch/x86/ia32/ia32_signal.c index f1a2ac777faf..20af4c79579a 100644 --- a/trunk/arch/x86/ia32/ia32_signal.c +++ b/trunk/arch/x86/ia32/ia32_signal.c @@ -206,7 +206,7 @@ struct rt_sigframe { unsigned int cur; \ unsigned short pre; \ err |= __get_user(pre, &sc->seg); \ - savesegment(seg, cur); \ + asm volatile("movl %%" #seg ",%0" : "=r" (cur)); \ pre |= mask; \ if (pre != cur) loadsegment(seg, pre); } @@ -235,7 +235,7 @@ static int ia32_restore_sigcontext(struct pt_regs *regs, */ err |= __get_user(gs, &sc->gs); gs |= 3; - savesegment(gs, oldgs); + asm("movl %%gs,%0" : "=r" (oldgs)); if (gs != oldgs) load_gs_index(gs); @@ -355,13 +355,14 @@ static int ia32_setup_sigcontext(struct sigcontext_ia32 __user *sc, { int tmp, err = 0; - savesegment(gs, tmp); + tmp = 0; + __asm__("movl %%gs,%0" : "=r"(tmp): "0"(tmp)); err |= __put_user(tmp, (unsigned int __user *)&sc->gs); - savesegment(fs, tmp); + __asm__("movl %%fs,%0" : "=r"(tmp): "0"(tmp)); err |= __put_user(tmp, (unsigned int __user *)&sc->fs); - savesegment(ds, tmp); + __asm__("movl %%ds,%0" : "=r"(tmp): "0"(tmp)); err |= __put_user(tmp, (unsigned int __user *)&sc->ds); - savesegment(es, tmp); + __asm__("movl %%es,%0" : "=r"(tmp): "0"(tmp)); err |= __put_user(tmp, (unsigned int __user *)&sc->es); err |= __put_user((u32)regs->di, &sc->di); @@ -497,8 +498,8 @@ int ia32_setup_frame(int sig, struct k_sigaction *ka, regs->dx = 0; regs->cx = 0; - loadsegment(ds, __USER32_DS); - loadsegment(es, __USER32_DS); + asm volatile("movl %0,%%ds" :: "r" (__USER32_DS)); + asm volatile("movl %0,%%es" :: "r" (__USER32_DS)); regs->cs = __USER32_CS; regs->ss = __USER32_DS; @@ -590,8 +591,8 @@ int ia32_setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, regs->dx = (unsigned long) &frame->info; regs->cx = (unsigned long) &frame->uc; - loadsegment(ds, __USER32_DS); - loadsegment(es, __USER32_DS); + asm volatile("movl %0,%%ds" :: "r" (__USER32_DS)); + asm volatile("movl %0,%%es" :: "r" (__USER32_DS)); regs->cs = __USER32_CS; regs->ss = __USER32_DS; diff --git a/trunk/arch/x86/ia32/sys_ia32.c b/trunk/arch/x86/ia32/sys_ia32.c index beda4232ce69..d3c64088b981 100644 --- a/trunk/arch/x86/ia32/sys_ia32.c +++ b/trunk/arch/x86/ia32/sys_ia32.c @@ -556,6 +556,15 @@ asmlinkage long sys32_rt_sigqueueinfo(int pid, int sig, return ret; } +/* These are here just in case some old ia32 binary calls it. */ +asmlinkage long sys32_pause(void) +{ + current->state = TASK_INTERRUPTIBLE; + schedule(); + return -ERESTARTNOHAND; +} + + #ifdef CONFIG_SYSCTL_SYSCALL struct sysctl_ia32 { unsigned int name; diff --git a/trunk/arch/x86/kernel/acpi/boot.c b/trunk/arch/x86/kernel/acpi/boot.c index 7d40ef7b36e3..c102af85df9c 100644 --- a/trunk/arch/x86/kernel/acpi/boot.c +++ b/trunk/arch/x86/kernel/acpi/boot.c @@ -58,6 +58,7 @@ EXPORT_SYMBOL(acpi_disabled); #ifdef CONFIG_X86_64 #include +#include #else /* X86 */ @@ -96,6 +97,8 @@ static u64 acpi_lapic_addr __initdata = APIC_DEFAULT_PHYS_BASE; #warning ACPI uses CMPXCHG, i486 and later hardware #endif +static int acpi_mcfg_64bit_base_addr __initdata = FALSE; + /* -------------------------------------------------------------------------- Boot-time Configuration -------------------------------------------------------------------------- */ @@ -157,8 +160,6 @@ char *__init __acpi_map_table(unsigned long phys, unsigned long size) struct acpi_mcfg_allocation *pci_mmcfg_config; int pci_mmcfg_config_num; -static int acpi_mcfg_64bit_base_addr __initdata = FALSE; - static int __init acpi_mcfg_oem_check(struct acpi_table_mcfg *mcfg) { if (!strcmp(mcfg->header.oem_id, "SGI")) diff --git a/trunk/arch/x86/kernel/alternative.c b/trunk/arch/x86/kernel/alternative.c index fb04e49776ba..65a0c1b48696 100644 --- a/trunk/arch/x86/kernel/alternative.c +++ b/trunk/arch/x86/kernel/alternative.c @@ -231,25 +231,25 @@ static void alternatives_smp_lock(u8 **start, u8 **end, u8 *text, u8 *text_end) continue; if (*ptr > text_end) continue; - /* turn DS segment override prefix into lock prefix */ - text_poke(*ptr, ((unsigned char []){0xf0}), 1); + text_poke(*ptr, ((unsigned char []){0xf0}), 1); /* add lock prefix */ }; } static void alternatives_smp_unlock(u8 **start, u8 **end, u8 *text, u8 *text_end) { u8 **ptr; + char insn[1]; if (noreplace_smp) return; + add_nops(insn, 1); for (ptr = start; ptr < end; ptr++) { if (*ptr < text) continue; if (*ptr > text_end) continue; - /* turn lock prefix into DS segment override prefix */ - text_poke(*ptr, ((unsigned char []){0x3E}), 1); + text_poke(*ptr, insn, 1); }; } diff --git a/trunk/arch/x86/kernel/aperture_64.c b/trunk/arch/x86/kernel/aperture_64.c index 9a32b37ee2ee..44e21826db11 100644 --- a/trunk/arch/x86/kernel/aperture_64.c +++ b/trunk/arch/x86/kernel/aperture_64.c @@ -455,11 +455,11 @@ void __init gart_iommu_hole_init(void) force_iommu || valid_agp || fallback_aper_force) { - printk(KERN_INFO + printk(KERN_ERR "Your BIOS doesn't leave a aperture memory hole\n"); - printk(KERN_INFO + printk(KERN_ERR "Please enable the IOMMU option in the BIOS setup\n"); - printk(KERN_INFO + printk(KERN_ERR "This costs you %d MB of RAM\n", 32 << fallback_aper_order); diff --git a/trunk/arch/x86/kernel/apm_32.c b/trunk/arch/x86/kernel/apm_32.c index 5145a6e72bbb..732d1f4e10ee 100644 --- a/trunk/arch/x86/kernel/apm_32.c +++ b/trunk/arch/x86/kernel/apm_32.c @@ -228,6 +228,7 @@ #include #include #include +#include #include #include diff --git a/trunk/arch/x86/kernel/asm-offsets_64.c b/trunk/arch/x86/kernel/asm-offsets_64.c index 505543a75a56..aa89387006fe 100644 --- a/trunk/arch/x86/kernel/asm-offsets_64.c +++ b/trunk/arch/x86/kernel/asm-offsets_64.c @@ -22,7 +22,7 @@ #define __NO_STUBS 1 #undef __SYSCALL -#undef ASM_X86__UNISTD_64_H +#undef _ASM_X86_64_UNISTD_H_ #define __SYSCALL(nr, sym) [nr] = 1, static char syscalls[] = { #include diff --git a/trunk/arch/x86/kernel/bios_uv.c b/trunk/arch/x86/kernel/bios_uv.c index fdd585f9c53d..c639bd55391c 100644 --- a/trunk/arch/x86/kernel/bios_uv.c +++ b/trunk/arch/x86/kernel/bios_uv.c @@ -25,11 +25,11 @@ x86_bios_strerror(long status) { const char *str; switch (status) { - case 0: str = "Call completed without error"; break; - case -1: str = "Not implemented"; break; - case -2: str = "Invalid argument"; break; - case -3: str = "Call completed with error"; break; - default: str = "Unknown BIOS status code"; break; + case 0: str = "Call completed without error"; break; + case -1: str = "Not implemented"; break; + case -2: str = "Invalid argument"; break; + case -3: str = "Call completed with error"; break; + default: str = "Unknown BIOS status code"; break; } return str; } diff --git a/trunk/arch/x86/kernel/cpu/common_64.c b/trunk/arch/x86/kernel/cpu/common_64.c index 305b465889b0..a11f5d4477cd 100644 --- a/trunk/arch/x86/kernel/cpu/common_64.c +++ b/trunk/arch/x86/kernel/cpu/common_64.c @@ -430,49 +430,6 @@ static __init int setup_noclflush(char *arg) } __setup("noclflush", setup_noclflush); -struct msr_range { - unsigned min; - unsigned max; -}; - -static struct msr_range msr_range_array[] __cpuinitdata = { - { 0x00000000, 0x00000418}, - { 0xc0000000, 0xc000040b}, - { 0xc0010000, 0xc0010142}, - { 0xc0011000, 0xc001103b}, -}; - -static void __cpuinit print_cpu_msr(void) -{ - unsigned index; - u64 val; - int i; - unsigned index_min, index_max; - - for (i = 0; i < ARRAY_SIZE(msr_range_array); i++) { - index_min = msr_range_array[i].min; - index_max = msr_range_array[i].max; - for (index = index_min; index < index_max; index++) { - if (rdmsrl_amd_safe(index, &val)) - continue; - printk(KERN_INFO " MSR%08x: %016llx\n", index, val); - } - } -} - -static int show_msr __cpuinitdata; -static __init int setup_show_msr(char *arg) -{ - int num; - - get_option(&arg, &num); - - if (num > 0) - show_msr = num; - return 1; -} -__setup("show_msr=", setup_show_msr); - void __cpuinit print_cpu_info(struct cpuinfo_x86 *c) { if (c->x86_model_id[0]) @@ -482,14 +439,6 @@ void __cpuinit print_cpu_info(struct cpuinfo_x86 *c) printk(KERN_CONT " stepping %02x\n", c->x86_mask); else printk(KERN_CONT "\n"); - -#ifdef CONFIG_SMP - if (c->cpu_index < show_msr) - print_cpu_msr(); -#else - if (show_msr) - print_cpu_msr(); -#endif } static __init int setup_disablecpuid(char *arg) diff --git a/trunk/arch/x86/kernel/cpu/cpufreq/p4-clockmod.c b/trunk/arch/x86/kernel/cpu/cpufreq/p4-clockmod.c index b8e05ee4f736..f1685fb91fbd 100644 --- a/trunk/arch/x86/kernel/cpu/cpufreq/p4-clockmod.c +++ b/trunk/arch/x86/kernel/cpu/cpufreq/p4-clockmod.c @@ -171,7 +171,7 @@ static unsigned int cpufreq_p4_get_frequency(struct cpuinfo_x86 *c) } if (c->x86 != 0xF) { - printk(KERN_WARNING PFX "Unknown p4-clockmod-capable CPU. Please send an e-mail to \n"); + printk(KERN_WARNING PFX "Unknown p4-clockmod-capable CPU. Please send an e-mail to \n"); return 0; } diff --git a/trunk/arch/x86/kernel/cpu/cpufreq/speedstep-centrino.c b/trunk/arch/x86/kernel/cpu/cpufreq/speedstep-centrino.c index 3b5f06423e77..15e13c01cc36 100644 --- a/trunk/arch/x86/kernel/cpu/cpufreq/speedstep-centrino.c +++ b/trunk/arch/x86/kernel/cpu/cpufreq/speedstep-centrino.c @@ -26,7 +26,7 @@ #include #define PFX "speedstep-centrino: " -#define MAINTAINER "cpufreq@vger.kernel.org" +#define MAINTAINER "cpufreq@lists.linux.org.uk" #define dprintk(msg...) \ cpufreq_debug_printk(CPUFREQ_DEBUG_DRIVER, "speedstep-centrino", msg) diff --git a/trunk/arch/x86/kernel/cpu/intel.c b/trunk/arch/x86/kernel/cpu/intel.c index f113ef4595f6..b75f2569b8f8 100644 --- a/trunk/arch/x86/kernel/cpu/intel.c +++ b/trunk/arch/x86/kernel/cpu/intel.c @@ -222,11 +222,10 @@ static void __cpuinit init_intel(struct cpuinfo_x86 *c) set_cpu_cap(c, X86_FEATURE_BTS); if (!(l1 & (1<<12))) set_cpu_cap(c, X86_FEATURE_PEBS); - ds_init_intel(c); } if (cpu_has_bts) - ptrace_bts_init_intel(c); + ds_init_intel(c); /* * See if we have a good local APIC by checking for buggy Pentia, diff --git a/trunk/arch/x86/kernel/cpu/mtrr/generic.c b/trunk/arch/x86/kernel/cpu/mtrr/generic.c index 4e8d77f01eeb..cb7d3b6a80eb 100644 --- a/trunk/arch/x86/kernel/cpu/mtrr/generic.c +++ b/trunk/arch/x86/kernel/cpu/mtrr/generic.c @@ -401,7 +401,12 @@ static void generic_get_mtrr(unsigned int reg, unsigned long *base, tmp |= ~((1<<(hi - 1)) - 1); if (tmp != mask_lo) { - WARN_ONCE(1, KERN_INFO "mtrr: your BIOS has set up an incorrect mask, fixing it up.\n"); + static int once = 1; + + if (once) { + printk(KERN_INFO "mtrr: your BIOS has set up an incorrect mask, fixing it up.\n"); + once = 0; + } mask_lo = tmp; } } diff --git a/trunk/arch/x86/kernel/cpu/mtrr/if.c b/trunk/arch/x86/kernel/cpu/mtrr/if.c index 4c4214690dd1..84c480bb3715 100644 --- a/trunk/arch/x86/kernel/cpu/mtrr/if.c +++ b/trunk/arch/x86/kernel/cpu/mtrr/if.c @@ -405,9 +405,9 @@ static int mtrr_seq_show(struct seq_file *seq, void *offset) } /* RED-PEN: base can be > 32bit */ len += seq_printf(seq, - "reg%02i: base=0x%06lx000 (%5luMB), size=%5lu%cB, count=%d: %s\n", + "reg%02i: base=0x%05lx000 (%4luMB), size=%4lu%cB: %s, count=%d\n", i, base, base >> (20 - PAGE_SHIFT), size, factor, - mtrr_usage_table[i], mtrr_attrib_to_str(type)); + mtrr_attrib_to_str(type), mtrr_usage_table[i]); } } return 0; diff --git a/trunk/arch/x86/kernel/cpu/mtrr/main.c b/trunk/arch/x86/kernel/cpu/mtrr/main.c index c78c04821ea1..885c8265e6b5 100644 --- a/trunk/arch/x86/kernel/cpu/mtrr/main.c +++ b/trunk/arch/x86/kernel/cpu/mtrr/main.c @@ -729,7 +729,7 @@ struct var_mtrr_range_state { mtrr_type type; }; -static struct var_mtrr_range_state __initdata range_state[RANGE_NUM]; +struct var_mtrr_range_state __initdata range_state[RANGE_NUM]; static int __initdata debug_print; static int __init @@ -759,8 +759,7 @@ x86_get_mtrr_mem_range(struct res_range *range, int nr_range, /* take out UC ranges */ for (i = 0; i < num_var_ranges; i++) { type = range_state[i].type; - if (type != MTRR_TYPE_UNCACHABLE && - type != MTRR_TYPE_WRPROT) + if (type != MTRR_TYPE_UNCACHABLE) continue; size = range_state[i].size_pfn; if (!size) @@ -837,13 +836,6 @@ static int __init enable_mtrr_cleanup_setup(char *str) } early_param("enable_mtrr_cleanup", enable_mtrr_cleanup_setup); -static int __init mtrr_cleanup_debug_setup(char *str) -{ - debug_print = 1; - return 0; -} -early_param("mtrr_cleanup_debug", mtrr_cleanup_debug_setup); - struct var_mtrr_state { unsigned long range_startk; unsigned long range_sizek; @@ -906,27 +898,6 @@ set_var_mtrr_all(unsigned int address_bits) } } -static unsigned long to_size_factor(unsigned long sizek, char *factorp) -{ - char factor; - unsigned long base = sizek; - - if (base & ((1<<10) - 1)) { - /* not MB alignment */ - factor = 'K'; - } else if (base & ((1<<20) - 1)){ - factor = 'M'; - base >>= 10; - } else { - factor = 'G'; - base >>= 20; - } - - *factorp = factor; - - return base; -} - static unsigned int __init range_to_mtrr(unsigned int reg, unsigned long range_startk, unsigned long range_sizek, unsigned char type) @@ -948,21 +919,13 @@ range_to_mtrr(unsigned int reg, unsigned long range_startk, align = max_align; sizek = 1 << align; - if (debug_print) { - char start_factor = 'K', size_factor = 'K'; - unsigned long start_base, size_base; - - start_base = to_size_factor(range_startk, &start_factor), - size_base = to_size_factor(sizek, &size_factor), - + if (debug_print) printk(KERN_DEBUG "Setting variable MTRR %d, " - "base: %ld%cB, range: %ld%cB, type %s\n", - reg, start_base, start_factor, - size_base, size_factor, + "base: %ldMB, range: %ldMB, type %s\n", + reg, range_startk >> 10, sizek >> 10, (type == MTRR_TYPE_UNCACHABLE)?"UC": ((type == MTRR_TYPE_WRBACK)?"WB":"Other") ); - } save_var_mtrr(reg++, range_startk, sizek, type); range_startk += sizek; range_sizek -= sizek; @@ -1007,8 +970,6 @@ range_to_mtrr_with_hole(struct var_mtrr_state *state, unsigned long basek, /* try to append some small hole */ range0_basek = state->range_startk; range0_sizek = ALIGN(state->range_sizek, chunk_sizek); - - /* no increase */ if (range0_sizek == state->range_sizek) { if (debug_print) printk(KERN_DEBUG "rangeX: %016lx - %016lx\n", @@ -1019,40 +980,13 @@ range_to_mtrr_with_hole(struct var_mtrr_state *state, unsigned long basek, return 0; } - /* only cut back, when it is not the last */ - if (sizek) { - while (range0_basek + range0_sizek > (basek + sizek)) { - if (range0_sizek >= chunk_sizek) - range0_sizek -= chunk_sizek; - else - range0_sizek = 0; - - if (!range0_sizek) - break; - } - } - -second_try: - range_basek = range0_basek + range0_sizek; - - /* one hole in the middle */ - if (range_basek > basek && range_basek <= (basek + sizek)) - second_sizek = range_basek - basek; - - if (range0_sizek > state->range_sizek) { - - /* one hole in middle or at end */ - hole_sizek = range0_sizek - state->range_sizek - second_sizek; - - /* hole size should be less than half of range0 size */ - if (hole_sizek >= (range0_sizek >> 1) && - range0_sizek >= chunk_sizek) { - range0_sizek -= chunk_sizek; - second_sizek = 0; - hole_sizek = 0; - - goto second_try; - } + range0_sizek -= chunk_sizek; + if (range0_sizek && sizek) { + while (range0_basek + range0_sizek > (basek + sizek)) { + range0_sizek -= chunk_sizek; + if (!range0_sizek) + break; + } } if (range0_sizek) { @@ -1062,28 +996,50 @@ range_to_mtrr_with_hole(struct var_mtrr_state *state, unsigned long basek, (range0_basek + range0_sizek)<<10); state->reg = range_to_mtrr(state->reg, range0_basek, range0_sizek, MTRR_TYPE_WRBACK); + } - if (range0_sizek < state->range_sizek) { - /* need to handle left over */ - range_sizek = state->range_sizek - range0_sizek; + range_basek = range0_basek + range0_sizek; + range_sizek = chunk_sizek; - if (debug_print) - printk(KERN_DEBUG "range: %016lx - %016lx\n", - range_basek<<10, - (range_basek + range_sizek)<<10); - state->reg = range_to_mtrr(state->reg, range_basek, - range_sizek, MTRR_TYPE_WRBACK); + if (range_basek + range_sizek > basek && + range_basek + range_sizek <= (basek + sizek)) { + /* one hole */ + second_basek = basek; + second_sizek = range_basek + range_sizek - basek; + } + + /* if last piece, only could one hole near end */ + if ((second_basek || !basek) && + range_sizek - (state->range_sizek - range0_sizek) - second_sizek < + (chunk_sizek >> 1)) { + /* + * one hole in middle (second_sizek is 0) or at end + * (second_sizek is 0 ) + */ + hole_sizek = range_sizek - (state->range_sizek - range0_sizek) + - second_sizek; + hole_basek = range_basek + range_sizek - hole_sizek + - second_sizek; + } else { + /* fallback for big hole, or several holes */ + range_sizek = state->range_sizek - range0_sizek; + second_basek = 0; + second_sizek = 0; } + if (debug_print) + printk(KERN_DEBUG "range: %016lx - %016lx\n", range_basek<<10, + (range_basek + range_sizek)<<10); + state->reg = range_to_mtrr(state->reg, range_basek, range_sizek, + MTRR_TYPE_WRBACK); if (hole_sizek) { - hole_basek = range_basek - hole_sizek - second_sizek; if (debug_print) printk(KERN_DEBUG "hole: %016lx - %016lx\n", - hole_basek<<10, - (hole_basek + hole_sizek)<<10); - state->reg = range_to_mtrr(state->reg, hole_basek, - hole_sizek, MTRR_TYPE_UNCACHABLE); + hole_basek<<10, (hole_basek + hole_sizek)<<10); + state->reg = range_to_mtrr(state->reg, hole_basek, hole_sizek, + MTRR_TYPE_UNCACHABLE); + } return second_sizek; @@ -1198,11 +1154,11 @@ struct mtrr_cleanup_result { }; /* - * gran_size: 64K, 128K, 256K, 512K, 1M, 2M, ..., 2G - * chunk size: gran_size, ..., 2G - * so we need (1+16)*8 + * gran_size: 1M, 2M, ..., 2G + * chunk size: gran_size, ..., 4G + * so we need (2+13)*6 */ -#define NUM_RESULT 136 +#define NUM_RESULT 90 #define PSHIFT (PAGE_SHIFT - 10) static struct mtrr_cleanup_result __initdata result[NUM_RESULT]; @@ -1212,14 +1168,13 @@ static unsigned long __initdata min_loss_pfn[RANGE_NUM]; static int __init mtrr_cleanup(unsigned address_bits) { unsigned long extra_remove_base, extra_remove_size; - unsigned long base, size, def, dummy; + unsigned long i, base, size, def, dummy; mtrr_type type; int nr_range, nr_range_new; u64 chunk_size, gran_size; unsigned long range_sums, range_sums_new; int index_good; int num_reg_good; - int i; /* extra one for all 0 */ int num[MTRR_NUM_TYPES + 1]; @@ -1249,8 +1204,6 @@ static int __init mtrr_cleanup(unsigned address_bits) continue; if (!size) type = MTRR_NUM_TYPES; - if (type == MTRR_TYPE_WRPROT) - type = MTRR_TYPE_UNCACHABLE; num[type]++; } @@ -1263,57 +1216,23 @@ static int __init mtrr_cleanup(unsigned address_bits) num_var_ranges - num[MTRR_NUM_TYPES]) return 0; - /* print original var MTRRs at first, for debugging: */ - printk(KERN_DEBUG "original variable MTRRs\n"); - for (i = 0; i < num_var_ranges; i++) { - char start_factor = 'K', size_factor = 'K'; - unsigned long start_base, size_base; - - size_base = range_state[i].size_pfn << (PAGE_SHIFT - 10); - if (!size_base) - continue; - - size_base = to_size_factor(size_base, &size_factor), - start_base = range_state[i].base_pfn << (PAGE_SHIFT - 10); - start_base = to_size_factor(start_base, &start_factor), - type = range_state[i].type; - - printk(KERN_DEBUG "reg %d, base: %ld%cB, range: %ld%cB, type %s\n", - i, start_base, start_factor, - size_base, size_factor, - (type == MTRR_TYPE_UNCACHABLE) ? "UC" : - ((type == MTRR_TYPE_WRPROT) ? "WP" : - ((type == MTRR_TYPE_WRBACK) ? "WB" : "Other")) - ); - } - memset(range, 0, sizeof(range)); extra_remove_size = 0; - extra_remove_base = 1 << (32 - PAGE_SHIFT); - if (mtrr_tom2) + if (mtrr_tom2) { + extra_remove_base = 1 << (32 - PAGE_SHIFT); extra_remove_size = (mtrr_tom2 >> PAGE_SHIFT) - extra_remove_base; + } nr_range = x86_get_mtrr_mem_range(range, 0, extra_remove_base, extra_remove_size); - /* - * [0, 1M) should always be coverred by var mtrr with WB - * and fixed mtrrs should take effective before var mtrr for it - */ - nr_range = add_range_with_merge(range, nr_range, 0, - (1ULL<<(20 - PAGE_SHIFT)) - 1); - /* sort the ranges */ - sort(range, nr_range, sizeof(struct res_range), cmp_range, NULL); - range_sums = sum_ranges(range, nr_range); printk(KERN_INFO "total RAM coverred: %ldM\n", range_sums >> (20 - PAGE_SHIFT)); if (mtrr_chunk_size && mtrr_gran_size) { int num_reg; - char gran_factor, chunk_factor, lose_factor; - unsigned long gran_base, chunk_base, lose_base; - debug_print++; + debug_print = 1; /* convert ranges to var ranges state */ num_reg = x86_setup_var_mtrrs(range, nr_range, mtrr_chunk_size, mtrr_gran_size); @@ -1337,48 +1256,34 @@ static int __init mtrr_cleanup(unsigned address_bits) result[i].lose_cover_sizek = (range_sums - range_sums_new) << PSHIFT; - gran_base = to_size_factor(result[i].gran_sizek, &gran_factor), - chunk_base = to_size_factor(result[i].chunk_sizek, &chunk_factor), - lose_base = to_size_factor(result[i].lose_cover_sizek, &lose_factor), - printk(KERN_INFO "%sgran_size: %ld%c \tchunk_size: %ld%c \t", - result[i].bad?"*BAD*":" ", - gran_base, gran_factor, chunk_base, chunk_factor); - printk(KERN_CONT "num_reg: %d \tlose cover RAM: %s%ld%c\n", + printk(KERN_INFO "%sgran_size: %ldM \tchunk_size: %ldM \t", + result[i].bad?"*BAD*":" ", result[i].gran_sizek >> 10, + result[i].chunk_sizek >> 10); + printk(KERN_CONT "num_reg: %d \tlose cover RAM: %s%ldM \n", result[i].num_reg, result[i].bad?"-":"", - lose_base, lose_factor); + result[i].lose_cover_sizek >> 10); if (!result[i].bad) { set_var_mtrr_all(address_bits); return 1; } printk(KERN_INFO "invalid mtrr_gran_size or mtrr_chunk_size, " "will find optimal one\n"); - debug_print--; + debug_print = 0; memset(result, 0, sizeof(result[0])); } i = 0; memset(min_loss_pfn, 0xff, sizeof(min_loss_pfn)); memset(result, 0, sizeof(result)); - for (gran_size = (1ULL<<16); gran_size < (1ULL<<32); gran_size <<= 1) { - char gran_factor; - unsigned long gran_base; - - if (debug_print) - gran_base = to_size_factor(gran_size >> 10, &gran_factor); - - for (chunk_size = gran_size; chunk_size < (1ULL<<32); + for (gran_size = (1ULL<<20); gran_size < (1ULL<<32); gran_size <<= 1) { + for (chunk_size = gran_size; chunk_size < (1ULL<<33); chunk_size <<= 1) { int num_reg; - if (debug_print) { - char chunk_factor; - unsigned long chunk_base; - - chunk_base = to_size_factor(chunk_size>>10, &chunk_factor), - printk(KERN_INFO "\n"); - printk(KERN_INFO "gran_size: %ld%c chunk_size: %ld%c \n", - gran_base, gran_factor, chunk_base, chunk_factor); - } + if (debug_print) + printk(KERN_INFO + "\ngran_size: %lldM chunk_size_size: %lldM\n", + gran_size >> 20, chunk_size >> 20); if (i >= NUM_RESULT) continue; @@ -1421,18 +1326,12 @@ static int __init mtrr_cleanup(unsigned address_bits) /* print out all */ for (i = 0; i < NUM_RESULT; i++) { - char gran_factor, chunk_factor, lose_factor; - unsigned long gran_base, chunk_base, lose_base; - - gran_base = to_size_factor(result[i].gran_sizek, &gran_factor), - chunk_base = to_size_factor(result[i].chunk_sizek, &chunk_factor), - lose_base = to_size_factor(result[i].lose_cover_sizek, &lose_factor), - printk(KERN_INFO "%sgran_size: %ld%c \tchunk_size: %ld%c \t", - result[i].bad?"*BAD*":" ", - gran_base, gran_factor, chunk_base, chunk_factor); - printk(KERN_CONT "num_reg: %d \tlose cover RAM: %s%ld%c\n", - result[i].num_reg, result[i].bad?"-":"", - lose_base, lose_factor); + printk(KERN_INFO "%sgran_size: %ldM \tchunk_size: %ldM \t", + result[i].bad?"*BAD* ":" ", result[i].gran_sizek >> 10, + result[i].chunk_sizek >> 10); + printk(KERN_CONT "num_reg: %d \tlose RAM: %s%ldM\n", + result[i].num_reg, result[i].bad?"-":"", + result[i].lose_cover_sizek >> 10); } /* try to find the optimal index */ @@ -1440,8 +1339,10 @@ static int __init mtrr_cleanup(unsigned address_bits) nr_mtrr_spare_reg = num_var_ranges - 1; num_reg_good = -1; for (i = num_var_ranges - nr_mtrr_spare_reg; i > 0; i--) { - if (!min_loss_pfn[i]) + if (!min_loss_pfn[i]) { num_reg_good = i; + break; + } } index_good = -1; @@ -1457,26 +1358,21 @@ static int __init mtrr_cleanup(unsigned address_bits) } if (index_good != -1) { - char gran_factor, chunk_factor, lose_factor; - unsigned long gran_base, chunk_base, lose_base; - printk(KERN_INFO "Found optimal setting for mtrr clean up\n"); i = index_good; - gran_base = to_size_factor(result[i].gran_sizek, &gran_factor), - chunk_base = to_size_factor(result[i].chunk_sizek, &chunk_factor), - lose_base = to_size_factor(result[i].lose_cover_sizek, &lose_factor), - printk(KERN_INFO "gran_size: %ld%c \tchunk_size: %ld%c \t", - gran_base, gran_factor, chunk_base, chunk_factor); - printk(KERN_CONT "num_reg: %d \tlose RAM: %ld%c\n", - result[i].num_reg, lose_base, lose_factor); + printk(KERN_INFO "gran_size: %ldM \tchunk_size: %ldM \t", + result[i].gran_sizek >> 10, + result[i].chunk_sizek >> 10); + printk(KERN_CONT "num_reg: %d \tlose RAM: %ldM\n", + result[i].num_reg, + result[i].lose_cover_sizek >> 10); /* convert ranges to var ranges state */ chunk_size = result[i].chunk_sizek; chunk_size <<= 10; gran_size = result[i].gran_sizek; gran_size <<= 10; - debug_print++; + debug_print = 1; x86_setup_var_mtrrs(range, nr_range, chunk_size, gran_size); - debug_print--; set_var_mtrr_all(address_bits); return 1; } diff --git a/trunk/arch/x86/kernel/cpu/perfctr-watchdog.c b/trunk/arch/x86/kernel/cpu/perfctr-watchdog.c index 6bff382094f5..05cc22dbd4ff 100644 --- a/trunk/arch/x86/kernel/cpu/perfctr-watchdog.c +++ b/trunk/arch/x86/kernel/cpu/perfctr-watchdog.c @@ -295,19 +295,13 @@ static int setup_k7_watchdog(unsigned nmi_hz) /* setup the timer */ wrmsr(evntsel_msr, evntsel, 0); write_watchdog_counter(perfctr_msr, "K7_PERFCTR0",nmi_hz); - - /* initialize the wd struct before enabling */ - wd->perfctr_msr = perfctr_msr; - wd->evntsel_msr = evntsel_msr; - wd->cccr_msr = 0; /* unused */ - - /* ok, everything is initialized, announce that we're set */ - cpu_nmi_set_wd_enabled(); - apic_write(APIC_LVTPC, APIC_DM_NMI); evntsel |= K7_EVNTSEL_ENABLE; wrmsr(evntsel_msr, evntsel, 0); + wd->perfctr_msr = perfctr_msr; + wd->evntsel_msr = evntsel_msr; + wd->cccr_msr = 0; /* unused */ return 1; } @@ -385,19 +379,13 @@ static int setup_p6_watchdog(unsigned nmi_hz) wrmsr(evntsel_msr, evntsel, 0); nmi_hz = adjust_for_32bit_ctr(nmi_hz); write_watchdog_counter32(perfctr_msr, "P6_PERFCTR0",nmi_hz); - - /* initialize the wd struct before enabling */ - wd->perfctr_msr = perfctr_msr; - wd->evntsel_msr = evntsel_msr; - wd->cccr_msr = 0; /* unused */ - - /* ok, everything is initialized, announce that we're set */ - cpu_nmi_set_wd_enabled(); - apic_write(APIC_LVTPC, APIC_DM_NMI); evntsel |= P6_EVNTSEL0_ENABLE; wrmsr(evntsel_msr, evntsel, 0); + wd->perfctr_msr = perfctr_msr; + wd->evntsel_msr = evntsel_msr; + wd->cccr_msr = 0; /* unused */ return 1; } @@ -444,27 +432,6 @@ static const struct wd_ops p6_wd_ops = { #define P4_CCCR_ENABLE (1 << 12) #define P4_CCCR_OVF (1 << 31) -#define P4_CONTROLS 18 -static unsigned int p4_controls[18] = { - MSR_P4_BPU_CCCR0, - MSR_P4_BPU_CCCR1, - MSR_P4_BPU_CCCR2, - MSR_P4_BPU_CCCR3, - MSR_P4_MS_CCCR0, - MSR_P4_MS_CCCR1, - MSR_P4_MS_CCCR2, - MSR_P4_MS_CCCR3, - MSR_P4_FLAME_CCCR0, - MSR_P4_FLAME_CCCR1, - MSR_P4_FLAME_CCCR2, - MSR_P4_FLAME_CCCR3, - MSR_P4_IQ_CCCR0, - MSR_P4_IQ_CCCR1, - MSR_P4_IQ_CCCR2, - MSR_P4_IQ_CCCR3, - MSR_P4_IQ_CCCR4, - MSR_P4_IQ_CCCR5, -}; /* * Set up IQ_COUNTER0 to behave like a clock, by having IQ_CCCR0 filter * CRU_ESCR0 (with any non-null event selector) through a complemented @@ -506,26 +473,6 @@ static int setup_p4_watchdog(unsigned nmi_hz) evntsel_msr = MSR_P4_CRU_ESCR0; cccr_msr = MSR_P4_IQ_CCCR0; cccr_val = P4_CCCR_OVF_PMI0 | P4_CCCR_ESCR_SELECT(4); - - /* - * If we're on the kdump kernel or other situation, we may - * still have other performance counter registers set to - * interrupt and they'll keep interrupting forever because - * of the P4_CCCR_OVF quirk. So we need to ACK all the - * pending interrupts and disable all the registers here, - * before reenabling the NMI delivery. Refer to p4_rearm() - * about the P4_CCCR_OVF quirk. - */ - if (reset_devices) { - unsigned int low, high; - int i; - - for (i = 0; i < P4_CONTROLS; i++) { - rdmsr(p4_controls[i], low, high); - low &= ~(P4_CCCR_ENABLE | P4_CCCR_OVF); - wrmsr(p4_controls[i], low, high); - } - } } else { /* logical cpu 1 */ perfctr_msr = MSR_P4_IQ_PERFCTR1; @@ -552,17 +499,12 @@ static int setup_p4_watchdog(unsigned nmi_hz) wrmsr(evntsel_msr, evntsel, 0); wrmsr(cccr_msr, cccr_val, 0); write_watchdog_counter(perfctr_msr, "P4_IQ_COUNTER0", nmi_hz); - - wd->perfctr_msr = perfctr_msr; - wd->evntsel_msr = evntsel_msr; - wd->cccr_msr = cccr_msr; - - /* ok, everything is initialized, announce that we're set */ - cpu_nmi_set_wd_enabled(); - apic_write(APIC_LVTPC, APIC_DM_NMI); cccr_val |= P4_CCCR_ENABLE; wrmsr(cccr_msr, cccr_val, 0); + wd->perfctr_msr = perfctr_msr; + wd->evntsel_msr = evntsel_msr; + wd->cccr_msr = cccr_msr; return 1; } @@ -678,17 +620,13 @@ static int setup_intel_arch_watchdog(unsigned nmi_hz) wrmsr(evntsel_msr, evntsel, 0); nmi_hz = adjust_for_32bit_ctr(nmi_hz); write_watchdog_counter32(perfctr_msr, "INTEL_ARCH_PERFCTR0", nmi_hz); + apic_write(APIC_LVTPC, APIC_DM_NMI); + evntsel |= ARCH_PERFMON_EVENTSEL0_ENABLE; + wrmsr(evntsel_msr, evntsel, 0); wd->perfctr_msr = perfctr_msr; wd->evntsel_msr = evntsel_msr; wd->cccr_msr = 0; /* unused */ - - /* ok, everything is initialized, announce that we're set */ - cpu_nmi_set_wd_enabled(); - - apic_write(APIC_LVTPC, APIC_DM_NMI); - evntsel |= ARCH_PERFMON_EVENTSEL0_ENABLE; - wrmsr(evntsel_msr, evntsel, 0); intel_arch_wd_ops.checkbit = 1ULL << (eax.split.bit_width - 1); return 1; } diff --git a/trunk/arch/x86/kernel/cpuid.c b/trunk/arch/x86/kernel/cpuid.c index 6a44d6465991..8e9cd6a8ec12 100644 --- a/trunk/arch/x86/kernel/cpuid.c +++ b/trunk/arch/x86/kernel/cpuid.c @@ -36,6 +36,7 @@ #include #include #include +#include #include #include #include diff --git a/trunk/arch/x86/kernel/crash_dump_64.c b/trunk/arch/x86/kernel/crash_dump_64.c index e90a60ef10c2..15e6c6bc4a46 100644 --- a/trunk/arch/x86/kernel/crash_dump_64.c +++ b/trunk/arch/x86/kernel/crash_dump_64.c @@ -7,8 +7,9 @@ #include #include -#include -#include + +#include +#include /** * copy_oldmem_page - copy one page from "oldmem" @@ -24,7 +25,7 @@ * in the current kernel. We stitch up a pte, similar to kmap_atomic. */ ssize_t copy_oldmem_page(unsigned long pfn, char *buf, - size_t csize, unsigned long offset, int userbuf) + size_t csize, unsigned long offset, int userbuf) { void *vaddr; @@ -32,16 +33,14 @@ ssize_t copy_oldmem_page(unsigned long pfn, char *buf, return 0; vaddr = ioremap(pfn << PAGE_SHIFT, PAGE_SIZE); - if (!vaddr) - return -ENOMEM; if (userbuf) { - if (copy_to_user(buf, vaddr + offset, csize)) { + if (copy_to_user(buf, (vaddr + offset), csize)) { iounmap(vaddr); return -EFAULT; } } else - memcpy(buf, vaddr + offset, csize); + memcpy(buf, (vaddr + offset), csize); iounmap(vaddr); return csize; diff --git a/trunk/arch/x86/kernel/ds.c b/trunk/arch/x86/kernel/ds.c index 2b69994fd3a8..11c11b8ec48d 100644 --- a/trunk/arch/x86/kernel/ds.c +++ b/trunk/arch/x86/kernel/ds.c @@ -2,49 +2,26 @@ * Debug Store support * * This provides a low-level interface to the hardware's Debug Store - * feature that is used for branch trace store (BTS) and + * feature that is used for last branch recording (LBR) and * precise-event based sampling (PEBS). * - * It manages: - * - per-thread and per-cpu allocation of BTS and PEBS - * - buffer memory allocation (optional) - * - buffer overflow handling - * - buffer access + * Different architectures use a different DS layout/pointer size. + * The below functions therefore work on a void*. * - * It assumes: - * - get_task_struct on all parameter tasks - * - current is allowed to trace parameter tasks * + * Since there is no user for PEBS, yet, only LBR (or branch + * trace store, BTS) is supported. * - * Copyright (C) 2007-2008 Intel Corporation. - * Markus Metzger , 2007-2008 + * + * Copyright (C) 2007 Intel Corporation. + * Markus Metzger , Dec 2007 */ - -#ifdef CONFIG_X86_DS - #include #include #include #include -#include -#include - - -/* - * The configuration for a particular DS hardware implementation. - */ -struct ds_configuration { - /* the size of the DS structure in bytes */ - unsigned char sizeof_ds; - /* the size of one pointer-typed field in the DS structure in bytes; - this covers the first 8 fields related to buffer management. */ - unsigned char sizeof_field; - /* the size of a BTS/PEBS record in bytes */ - unsigned char sizeof_rec[2]; -}; -static struct ds_configuration ds_cfg; /* @@ -67,747 +44,378 @@ static struct ds_configuration ds_cfg; * (interrupt occurs when write pointer passes interrupt pointer) * - value to which counter is reset following counter overflow * - * Later architectures use 64bit pointers throughout, whereas earlier - * architectures use 32bit pointers in 32bit mode. + * On later architectures, the last branch recording hardware uses + * 64bit pointers even in 32bit mode. * * - * We compute the base address for the first 8 fields based on: - * - the field size stored in the DS configuration - * - the relative field position - * - an offset giving the start of the respective region + * Branch Trace Store (BTS) records store information about control + * flow changes. They at least provide the following information: + * - source linear address + * - destination linear address * - * This offset is further used to index various arrays holding - * information for BTS and PEBS at the respective index. + * Netburst supported a predicated bit that had been dropped in later + * architectures. We do not suppor it. * - * On later 32bit processors, we only access the lower 32bit of the - * 64bit pointer fields. The upper halves will be zeroed out. - */ - -enum ds_field { - ds_buffer_base = 0, - ds_index, - ds_absolute_maximum, - ds_interrupt_threshold, -}; - -enum ds_qualifier { - ds_bts = 0, - ds_pebs -}; - -static inline unsigned long ds_get(const unsigned char *base, - enum ds_qualifier qual, enum ds_field field) -{ - base += (ds_cfg.sizeof_field * (field + (4 * qual))); - return *(unsigned long *)base; -} - -static inline void ds_set(unsigned char *base, enum ds_qualifier qual, - enum ds_field field, unsigned long value) -{ - base += (ds_cfg.sizeof_field * (field + (4 * qual))); - (*(unsigned long *)base) = value; -} - - -/* - * Locking is done only for allocating BTS or PEBS resources and for - * guarding context and buffer memory allocation. * - * Most functions require the current task to own the ds context part - * they are going to access. All the locking is done when validating - * access to the context. + * In order to abstract from the actual DS and BTS layout, we describe + * the access to the relevant fields. + * Thanks to Andi Kleen for proposing this design. + * + * The implementation, however, is not as general as it might seem. In + * order to stay somewhat simple and efficient, we assume an + * underlying unsigned type (mostly a pointer type) and we expect the + * field to be at least as big as that type. */ -static spinlock_t ds_lock = __SPIN_LOCK_UNLOCKED(ds_lock); /* - * Validate that the current task is allowed to access the BTS/PEBS - * buffer of the parameter task. - * - * Returns 0, if access is granted; -Eerrno, otherwise. + * A special from_ip address to indicate that the BTS record is an + * info record that needs to be interpreted or skipped. */ -static inline int ds_validate_access(struct ds_context *context, - enum ds_qualifier qual) -{ - if (!context) - return -EPERM; - - if (context->owner[qual] == current) - return 0; - - return -EPERM; -} - +#define BTS_ESCAPE_ADDRESS (-1) /* - * We either support (system-wide) per-cpu or per-thread allocation. - * We distinguish the two based on the task_struct pointer, where a - * NULL pointer indicates per-cpu allocation for the current cpu. - * - * Allocations are use-counted. As soon as resources are allocated, - * further allocations must be of the same type (per-cpu or - * per-thread). We model this by counting allocations (i.e. the number - * of tracers of a certain type) for one type negatively: - * =0 no tracers - * >0 number of per-thread tracers - * <0 number of per-cpu tracers - * - * The below functions to get and put tracers and to check the - * allocation type require the ds_lock to be held by the caller. - * - * Tracers essentially gives the number of ds contexts for a certain - * type of allocation. + * A field access descriptor */ -static long tracers; - -static inline void get_tracer(struct task_struct *task) -{ - tracers += (task ? 1 : -1); -} - -static inline void put_tracer(struct task_struct *task) -{ - tracers -= (task ? 1 : -1); -} - -static inline int check_tracer(struct task_struct *task) -{ - return (task ? (tracers >= 0) : (tracers <= 0)); -} - +struct access_desc { + unsigned char offset; + unsigned char size; +}; /* - * The DS context is either attached to a thread or to a cpu: - * - in the former case, the thread_struct contains a pointer to the - * attached context. - * - in the latter case, we use a static array of per-cpu context - * pointers. - * - * Contexts are use-counted. They are allocated on first access and - * deallocated when the last user puts the context. - * - * We distinguish between an allocating and a non-allocating get of a - * context: - * - the allocating get is used for requesting BTS/PEBS resources. It - * requires the caller to hold the global ds_lock. - * - the non-allocating get is used for all other cases. A - * non-existing context indicates an error. It acquires and releases - * the ds_lock itself for obtaining the context. - * - * A context and its DS configuration are allocated and deallocated - * together. A context always has a DS configuration of the - * appropriate size. + * The configuration for a particular DS/BTS hardware implementation. */ -static DEFINE_PER_CPU(struct ds_context *, system_context); - -#define this_system_context per_cpu(system_context, smp_processor_id()) +struct ds_configuration { + /* the DS configuration */ + unsigned char sizeof_ds; + struct access_desc bts_buffer_base; + struct access_desc bts_index; + struct access_desc bts_absolute_maximum; + struct access_desc bts_interrupt_threshold; + /* the BTS configuration */ + unsigned char sizeof_bts; + struct access_desc from_ip; + struct access_desc to_ip; + /* BTS variants used to store additional information like + timestamps */ + struct access_desc info_type; + struct access_desc info_data; + unsigned long debugctl_mask; +}; /* - * Returns the pointer to the parameter task's context or to the - * system-wide context, if task is NULL. - * - * Increases the use count of the returned context, if not NULL. + * The global configuration used by the below accessor functions */ -static inline struct ds_context *ds_get_context(struct task_struct *task) -{ - struct ds_context *context; - - spin_lock(&ds_lock); - - context = (task ? task->thread.ds_ctx : this_system_context); - if (context) - context->count++; - - spin_unlock(&ds_lock); - - return context; -} +static struct ds_configuration ds_cfg; /* - * Same as ds_get_context, but allocates the context and it's DS - * structure, if necessary; returns NULL; if out of memory. - * - * pre: requires ds_lock to be held + * Accessor functions for some DS and BTS fields using the above + * global ptrace_bts_cfg. */ -static inline struct ds_context *ds_alloc_context(struct task_struct *task) +static inline unsigned long get_bts_buffer_base(char *base) { - struct ds_context **p_context = - (task ? &task->thread.ds_ctx : &this_system_context); - struct ds_context *context = *p_context; - - if (!context) { - context = kzalloc(sizeof(*context), GFP_KERNEL); - - if (!context) - return NULL; - - context->ds = kzalloc(ds_cfg.sizeof_ds, GFP_KERNEL); - if (!context->ds) { - kfree(context); - return NULL; - } - - *p_context = context; - - context->this = p_context; - context->task = task; - - if (task) - set_tsk_thread_flag(task, TIF_DS_AREA_MSR); - - if (!task || (task == current)) - wrmsr(MSR_IA32_DS_AREA, (unsigned long)context->ds, 0); - - get_tracer(task); - } - - context->count++; - - return context; + return *(unsigned long *)(base + ds_cfg.bts_buffer_base.offset); } - -/* - * Decreases the use count of the parameter context, if not NULL. - * Deallocates the context, if the use count reaches zero. - */ -static inline void ds_put_context(struct ds_context *context) +static inline void set_bts_buffer_base(char *base, unsigned long value) { - if (!context) - return; - - spin_lock(&ds_lock); - - if (--context->count) - goto out; - - *(context->this) = NULL; - - if (context->task) - clear_tsk_thread_flag(context->task, TIF_DS_AREA_MSR); - - if (!context->task || (context->task == current)) - wrmsrl(MSR_IA32_DS_AREA, 0); - - put_tracer(context->task); - - /* free any leftover buffers from tracers that did not - * deallocate them properly. */ - kfree(context->buffer[ds_bts]); - kfree(context->buffer[ds_pebs]); - kfree(context->ds); - kfree(context); - out: - spin_unlock(&ds_lock); + (*(unsigned long *)(base + ds_cfg.bts_buffer_base.offset)) = value; } - - -/* - * Handle a buffer overflow - * - * task: the task whose buffers are overflowing; - * NULL for a buffer overflow on the current cpu - * context: the ds context - * qual: the buffer type - */ -static void ds_overflow(struct task_struct *task, struct ds_context *context, - enum ds_qualifier qual) +static inline unsigned long get_bts_index(char *base) { - if (!context) - return; - - if (context->callback[qual]) - (*context->callback[qual])(task); - - /* todo: do some more overflow handling */ + return *(unsigned long *)(base + ds_cfg.bts_index.offset); } - - -/* - * Allocate a non-pageable buffer of the parameter size. - * Checks the memory and the locked memory rlimit. - * - * Returns the buffer, if successful; - * NULL, if out of memory or rlimit exceeded. - * - * size: the requested buffer size in bytes - * pages (out): if not NULL, contains the number of pages reserved - */ -static inline void *ds_allocate_buffer(size_t size, unsigned int *pages) +static inline void set_bts_index(char *base, unsigned long value) { - unsigned long rlim, vm, pgsz; - void *buffer; - - pgsz = PAGE_ALIGN(size) >> PAGE_SHIFT; - - rlim = current->signal->rlim[RLIMIT_AS].rlim_cur >> PAGE_SHIFT; - vm = current->mm->total_vm + pgsz; - if (rlim < vm) - return NULL; - - rlim = current->signal->rlim[RLIMIT_MEMLOCK].rlim_cur >> PAGE_SHIFT; - vm = current->mm->locked_vm + pgsz; - if (rlim < vm) - return NULL; - - buffer = kzalloc(size, GFP_KERNEL); - if (!buffer) - return NULL; - - current->mm->total_vm += pgsz; - current->mm->locked_vm += pgsz; - - if (pages) - *pages = pgsz; - - return buffer; + (*(unsigned long *)(base + ds_cfg.bts_index.offset)) = value; } - -static int ds_request(struct task_struct *task, void *base, size_t size, - ds_ovfl_callback_t ovfl, enum ds_qualifier qual) +static inline unsigned long get_bts_absolute_maximum(char *base) { - struct ds_context *context; - unsigned long buffer, adj; - const unsigned long alignment = (1 << 3); - int error = 0; - - if (!ds_cfg.sizeof_ds) - return -EOPNOTSUPP; - - /* we require some space to do alignment adjustments below */ - if (size < (alignment + ds_cfg.sizeof_rec[qual])) - return -EINVAL; - - /* buffer overflow notification is not yet implemented */ - if (ovfl) - return -EOPNOTSUPP; - - - spin_lock(&ds_lock); - - if (!check_tracer(task)) - return -EPERM; - - error = -ENOMEM; - context = ds_alloc_context(task); - if (!context) - goto out_unlock; - - error = -EALREADY; - if (context->owner[qual] == current) - goto out_unlock; - error = -EPERM; - if (context->owner[qual] != NULL) - goto out_unlock; - context->owner[qual] = current; - - spin_unlock(&ds_lock); - - - error = -ENOMEM; - if (!base) { - base = ds_allocate_buffer(size, &context->pages[qual]); - if (!base) - goto out_release; - - context->buffer[qual] = base; - } - error = 0; - - context->callback[qual] = ovfl; - - /* adjust the buffer address and size to meet alignment - * constraints: - * - buffer is double-word aligned - * - size is multiple of record size - * - * We checked the size at the very beginning; we have enough - * space to do the adjustment. - */ - buffer = (unsigned long)base; - - adj = ALIGN(buffer, alignment) - buffer; - buffer += adj; - size -= adj; - - size /= ds_cfg.sizeof_rec[qual]; - size *= ds_cfg.sizeof_rec[qual]; - - ds_set(context->ds, qual, ds_buffer_base, buffer); - ds_set(context->ds, qual, ds_index, buffer); - ds_set(context->ds, qual, ds_absolute_maximum, buffer + size); - - if (ovfl) { - /* todo: select a suitable interrupt threshold */ - } else - ds_set(context->ds, qual, - ds_interrupt_threshold, buffer + size + 1); - - /* we keep the context until ds_release */ - return error; - - out_release: - context->owner[qual] = NULL; - ds_put_context(context); - return error; - - out_unlock: - spin_unlock(&ds_lock); - ds_put_context(context); - return error; + return *(unsigned long *)(base + ds_cfg.bts_absolute_maximum.offset); } - -int ds_request_bts(struct task_struct *task, void *base, size_t size, - ds_ovfl_callback_t ovfl) +static inline void set_bts_absolute_maximum(char *base, unsigned long value) { - return ds_request(task, base, size, ovfl, ds_bts); + (*(unsigned long *)(base + ds_cfg.bts_absolute_maximum.offset)) = value; } - -int ds_request_pebs(struct task_struct *task, void *base, size_t size, - ds_ovfl_callback_t ovfl) +static inline unsigned long get_bts_interrupt_threshold(char *base) { - return ds_request(task, base, size, ovfl, ds_pebs); + return *(unsigned long *)(base + ds_cfg.bts_interrupt_threshold.offset); } - -static int ds_release(struct task_struct *task, enum ds_qualifier qual) +static inline void set_bts_interrupt_threshold(char *base, unsigned long value) { - struct ds_context *context; - int error; - - context = ds_get_context(task); - error = ds_validate_access(context, qual); - if (error < 0) - goto out; - - kfree(context->buffer[qual]); - context->buffer[qual] = NULL; - - current->mm->total_vm -= context->pages[qual]; - current->mm->locked_vm -= context->pages[qual]; - context->pages[qual] = 0; - context->owner[qual] = NULL; - - /* - * we put the context twice: - * once for the ds_get_context - * once for the corresponding ds_request - */ - ds_put_context(context); - out: - ds_put_context(context); - return error; + (*(unsigned long *)(base + ds_cfg.bts_interrupt_threshold.offset)) = value; } - -int ds_release_bts(struct task_struct *task) +static inline unsigned long get_from_ip(char *base) { - return ds_release(task, ds_bts); + return *(unsigned long *)(base + ds_cfg.from_ip.offset); } - -int ds_release_pebs(struct task_struct *task) +static inline void set_from_ip(char *base, unsigned long value) { - return ds_release(task, ds_pebs); + (*(unsigned long *)(base + ds_cfg.from_ip.offset)) = value; } - -static int ds_get_index(struct task_struct *task, size_t *pos, - enum ds_qualifier qual) +static inline unsigned long get_to_ip(char *base) { - struct ds_context *context; - unsigned long base, index; - int error; - - context = ds_get_context(task); - error = ds_validate_access(context, qual); - if (error < 0) - goto out; - - base = ds_get(context->ds, qual, ds_buffer_base); - index = ds_get(context->ds, qual, ds_index); - - error = ((index - base) / ds_cfg.sizeof_rec[qual]); - if (pos) - *pos = error; - out: - ds_put_context(context); - return error; + return *(unsigned long *)(base + ds_cfg.to_ip.offset); } - -int ds_get_bts_index(struct task_struct *task, size_t *pos) +static inline void set_to_ip(char *base, unsigned long value) { - return ds_get_index(task, pos, ds_bts); + (*(unsigned long *)(base + ds_cfg.to_ip.offset)) = value; } - -int ds_get_pebs_index(struct task_struct *task, size_t *pos) +static inline unsigned char get_info_type(char *base) { - return ds_get_index(task, pos, ds_pebs); + return *(unsigned char *)(base + ds_cfg.info_type.offset); } - -static int ds_get_end(struct task_struct *task, size_t *pos, - enum ds_qualifier qual) +static inline void set_info_type(char *base, unsigned char value) { - struct ds_context *context; - unsigned long base, end; - int error; - - context = ds_get_context(task); - error = ds_validate_access(context, qual); - if (error < 0) - goto out; - - base = ds_get(context->ds, qual, ds_buffer_base); - end = ds_get(context->ds, qual, ds_absolute_maximum); - - error = ((end - base) / ds_cfg.sizeof_rec[qual]); - if (pos) - *pos = error; - out: - ds_put_context(context); - return error; + (*(unsigned char *)(base + ds_cfg.info_type.offset)) = value; } - -int ds_get_bts_end(struct task_struct *task, size_t *pos) +static inline unsigned long get_info_data(char *base) { - return ds_get_end(task, pos, ds_bts); + return *(unsigned long *)(base + ds_cfg.info_data.offset); } - -int ds_get_pebs_end(struct task_struct *task, size_t *pos) +static inline void set_info_data(char *base, unsigned long value) { - return ds_get_end(task, pos, ds_pebs); + (*(unsigned long *)(base + ds_cfg.info_data.offset)) = value; } -static int ds_access(struct task_struct *task, size_t index, - const void **record, enum ds_qualifier qual) + +int ds_allocate(void **dsp, size_t bts_size_in_bytes) { - struct ds_context *context; - unsigned long base, idx; - int error; + size_t bts_size_in_records; + unsigned long bts; + void *ds; - if (!record) + if (!ds_cfg.sizeof_ds || !ds_cfg.sizeof_bts) + return -EOPNOTSUPP; + + if (bts_size_in_bytes < 0) return -EINVAL; - context = ds_get_context(task); - error = ds_validate_access(context, qual); - if (error < 0) - goto out; + bts_size_in_records = + bts_size_in_bytes / ds_cfg.sizeof_bts; + bts_size_in_bytes = + bts_size_in_records * ds_cfg.sizeof_bts; + + if (bts_size_in_bytes <= 0) + return -EINVAL; - base = ds_get(context->ds, qual, ds_buffer_base); - idx = base + (index * ds_cfg.sizeof_rec[qual]); + bts = (unsigned long)kzalloc(bts_size_in_bytes, GFP_KERNEL); - error = -EINVAL; - if (idx > ds_get(context->ds, qual, ds_absolute_maximum)) - goto out; + if (!bts) + return -ENOMEM; - *record = (const void *)idx; - error = ds_cfg.sizeof_rec[qual]; - out: - ds_put_context(context); - return error; -} + ds = kzalloc(ds_cfg.sizeof_ds, GFP_KERNEL); -int ds_access_bts(struct task_struct *task, size_t index, const void **record) -{ - return ds_access(task, index, record, ds_bts); + if (!ds) { + kfree((void *)bts); + return -ENOMEM; + } + + set_bts_buffer_base(ds, bts); + set_bts_index(ds, bts); + set_bts_absolute_maximum(ds, bts + bts_size_in_bytes); + set_bts_interrupt_threshold(ds, bts + bts_size_in_bytes + 1); + + *dsp = ds; + return 0; } -int ds_access_pebs(struct task_struct *task, size_t index, const void **record) +int ds_free(void **dsp) { - return ds_access(task, index, record, ds_pebs); + if (*dsp) { + kfree((void *)get_bts_buffer_base(*dsp)); + kfree(*dsp); + *dsp = NULL; + } + return 0; } -static int ds_write(struct task_struct *task, const void *record, size_t size, - enum ds_qualifier qual, int force) +int ds_get_bts_size(void *ds) { - struct ds_context *context; - int error; + int size_in_bytes; - if (!record) - return -EINVAL; + if (!ds_cfg.sizeof_ds || !ds_cfg.sizeof_bts) + return -EOPNOTSUPP; - error = -EPERM; - context = ds_get_context(task); - if (!context) - goto out; + if (!ds) + return 0; - if (!force) { - error = ds_validate_access(context, qual); - if (error < 0) - goto out; - } + size_in_bytes = + get_bts_absolute_maximum(ds) - + get_bts_buffer_base(ds); + return size_in_bytes; +} - error = 0; - while (size) { - unsigned long base, index, end, write_end, int_th; - unsigned long write_size, adj_write_size; - - /* - * write as much as possible without producing an - * overflow interrupt. - * - * interrupt_threshold must either be - * - bigger than absolute_maximum or - * - point to a record between buffer_base and absolute_maximum - * - * index points to a valid record. - */ - base = ds_get(context->ds, qual, ds_buffer_base); - index = ds_get(context->ds, qual, ds_index); - end = ds_get(context->ds, qual, ds_absolute_maximum); - int_th = ds_get(context->ds, qual, ds_interrupt_threshold); - - write_end = min(end, int_th); - - /* if we are already beyond the interrupt threshold, - * we fill the entire buffer */ - if (write_end <= index) - write_end = end; - - if (write_end <= index) - goto out; - - write_size = min((unsigned long) size, write_end - index); - memcpy((void *)index, record, write_size); - - record = (const char *)record + write_size; - size -= write_size; - error += write_size; - - adj_write_size = write_size / ds_cfg.sizeof_rec[qual]; - adj_write_size *= ds_cfg.sizeof_rec[qual]; - - /* zero out trailing bytes */ - memset((char *)index + write_size, 0, - adj_write_size - write_size); - index += adj_write_size; - - if (index >= end) - index = base; - ds_set(context->ds, qual, ds_index, index); - - if (index >= int_th) - ds_overflow(task, context, qual); - } +int ds_get_bts_end(void *ds) +{ + int size_in_bytes = ds_get_bts_size(ds); + + if (size_in_bytes <= 0) + return size_in_bytes; - out: - ds_put_context(context); - return error; + return size_in_bytes / ds_cfg.sizeof_bts; } -int ds_write_bts(struct task_struct *task, const void *record, size_t size) +int ds_get_bts_index(void *ds) { - return ds_write(task, record, size, ds_bts, /* force = */ 0); + int index_offset_in_bytes; + + if (!ds_cfg.sizeof_ds || !ds_cfg.sizeof_bts) + return -EOPNOTSUPP; + + index_offset_in_bytes = + get_bts_index(ds) - + get_bts_buffer_base(ds); + + return index_offset_in_bytes / ds_cfg.sizeof_bts; } -int ds_write_pebs(struct task_struct *task, const void *record, size_t size) +int ds_set_overflow(void *ds, int method) { - return ds_write(task, record, size, ds_pebs, /* force = */ 0); + switch (method) { + case DS_O_SIGNAL: + return -EOPNOTSUPP; + case DS_O_WRAP: + return 0; + default: + return -EINVAL; + } } -int ds_unchecked_write_bts(struct task_struct *task, - const void *record, size_t size) +int ds_get_overflow(void *ds) { - return ds_write(task, record, size, ds_bts, /* force = */ 1); + return DS_O_WRAP; } -int ds_unchecked_write_pebs(struct task_struct *task, - const void *record, size_t size) +int ds_clear(void *ds) { - return ds_write(task, record, size, ds_pebs, /* force = */ 1); + int bts_size = ds_get_bts_size(ds); + unsigned long bts_base; + + if (bts_size <= 0) + return bts_size; + + bts_base = get_bts_buffer_base(ds); + memset((void *)bts_base, 0, bts_size); + + set_bts_index(ds, bts_base); + return 0; } -static int ds_reset_or_clear(struct task_struct *task, - enum ds_qualifier qual, int clear) +int ds_read_bts(void *ds, int index, struct bts_struct *out) { - struct ds_context *context; - unsigned long base, end; - int error; + void *bts; - context = ds_get_context(task); - error = ds_validate_access(context, qual); - if (error < 0) - goto out; - - base = ds_get(context->ds, qual, ds_buffer_base); - end = ds_get(context->ds, qual, ds_absolute_maximum); + if (!ds_cfg.sizeof_ds || !ds_cfg.sizeof_bts) + return -EOPNOTSUPP; - if (clear) - memset((void *)base, 0, end - base); + if (index < 0) + return -EINVAL; - ds_set(context->ds, qual, ds_index, base); + if (index >= ds_get_bts_size(ds)) + return -EINVAL; - error = 0; - out: - ds_put_context(context); - return error; -} + bts = (void *)(get_bts_buffer_base(ds) + (index * ds_cfg.sizeof_bts)); -int ds_reset_bts(struct task_struct *task) -{ - return ds_reset_or_clear(task, ds_bts, /* clear = */ 0); -} + memset(out, 0, sizeof(*out)); + if (get_from_ip(bts) == BTS_ESCAPE_ADDRESS) { + out->qualifier = get_info_type(bts); + out->variant.jiffies = get_info_data(bts); + } else { + out->qualifier = BTS_BRANCH; + out->variant.lbr.from_ip = get_from_ip(bts); + out->variant.lbr.to_ip = get_to_ip(bts); + } -int ds_reset_pebs(struct task_struct *task) -{ - return ds_reset_or_clear(task, ds_pebs, /* clear = */ 0); + return sizeof(*out);; } -int ds_clear_bts(struct task_struct *task) +int ds_write_bts(void *ds, const struct bts_struct *in) { - return ds_reset_or_clear(task, ds_bts, /* clear = */ 1); -} + unsigned long bts; -int ds_clear_pebs(struct task_struct *task) -{ - return ds_reset_or_clear(task, ds_pebs, /* clear = */ 1); -} + if (!ds_cfg.sizeof_ds || !ds_cfg.sizeof_bts) + return -EOPNOTSUPP; -int ds_get_pebs_reset(struct task_struct *task, u64 *value) -{ - struct ds_context *context; - int error; + if (ds_get_bts_size(ds) <= 0) + return -ENXIO; - if (!value) - return -EINVAL; + bts = get_bts_index(ds); - context = ds_get_context(task); - error = ds_validate_access(context, ds_pebs); - if (error < 0) - goto out; + memset((void *)bts, 0, ds_cfg.sizeof_bts); + switch (in->qualifier) { + case BTS_INVALID: + break; - *value = *(u64 *)(context->ds + (ds_cfg.sizeof_field * 8)); + case BTS_BRANCH: + set_from_ip((void *)bts, in->variant.lbr.from_ip); + set_to_ip((void *)bts, in->variant.lbr.to_ip); + break; - error = 0; - out: - ds_put_context(context); - return error; -} + case BTS_TASK_ARRIVES: + case BTS_TASK_DEPARTS: + set_from_ip((void *)bts, BTS_ESCAPE_ADDRESS); + set_info_type((void *)bts, in->qualifier); + set_info_data((void *)bts, in->variant.jiffies); + break; -int ds_set_pebs_reset(struct task_struct *task, u64 value) -{ - struct ds_context *context; - int error; + default: + return -EINVAL; + } - context = ds_get_context(task); - error = ds_validate_access(context, ds_pebs); - if (error < 0) - goto out; + bts = bts + ds_cfg.sizeof_bts; + if (bts >= get_bts_absolute_maximum(ds)) + bts = get_bts_buffer_base(ds); + set_bts_index(ds, bts); - *(u64 *)(context->ds + (ds_cfg.sizeof_field * 8)) = value; + return ds_cfg.sizeof_bts; +} - error = 0; - out: - ds_put_context(context); - return error; +unsigned long ds_debugctl_mask(void) +{ + return ds_cfg.debugctl_mask; } -static const struct ds_configuration ds_cfg_var = { - .sizeof_ds = sizeof(long) * 12, - .sizeof_field = sizeof(long), - .sizeof_rec[ds_bts] = sizeof(long) * 3, - .sizeof_rec[ds_pebs] = sizeof(long) * 10 +#ifdef __i386__ +static const struct ds_configuration ds_cfg_netburst = { + .sizeof_ds = 9 * 4, + .bts_buffer_base = { 0, 4 }, + .bts_index = { 4, 4 }, + .bts_absolute_maximum = { 8, 4 }, + .bts_interrupt_threshold = { 12, 4 }, + .sizeof_bts = 3 * 4, + .from_ip = { 0, 4 }, + .to_ip = { 4, 4 }, + .info_type = { 4, 1 }, + .info_data = { 8, 4 }, + .debugctl_mask = (1<<2)|(1<<3) +}; + +static const struct ds_configuration ds_cfg_pentium_m = { + .sizeof_ds = 9 * 4, + .bts_buffer_base = { 0, 4 }, + .bts_index = { 4, 4 }, + .bts_absolute_maximum = { 8, 4 }, + .bts_interrupt_threshold = { 12, 4 }, + .sizeof_bts = 3 * 4, + .from_ip = { 0, 4 }, + .to_ip = { 4, 4 }, + .info_type = { 4, 1 }, + .info_data = { 8, 4 }, + .debugctl_mask = (1<<6)|(1<<7) }; -static const struct ds_configuration ds_cfg_64 = { - .sizeof_ds = 8 * 12, - .sizeof_field = 8, - .sizeof_rec[ds_bts] = 8 * 3, - .sizeof_rec[ds_pebs] = 8 * 10 +#endif /* _i386_ */ + +static const struct ds_configuration ds_cfg_core2 = { + .sizeof_ds = 9 * 8, + .bts_buffer_base = { 0, 8 }, + .bts_index = { 8, 8 }, + .bts_absolute_maximum = { 16, 8 }, + .bts_interrupt_threshold = { 24, 8 }, + .sizeof_bts = 3 * 8, + .from_ip = { 0, 8 }, + .to_ip = { 8, 8 }, + .info_type = { 8, 1 }, + .info_data = { 16, 8 }, + .debugctl_mask = (1<<6)|(1<<7)|(1<<9) }; static inline void @@ -821,13 +429,14 @@ void __cpuinit ds_init_intel(struct cpuinfo_x86 *c) switch (c->x86) { case 0x6: switch (c->x86_model) { +#ifdef __i386__ case 0xD: case 0xE: /* Pentium M */ - ds_configure(&ds_cfg_var); + ds_configure(&ds_cfg_pentium_m); break; +#endif /* _i386_ */ case 0xF: /* Core2 */ - case 0x1C: /* Atom */ - ds_configure(&ds_cfg_64); + ds_configure(&ds_cfg_core2); break; default: /* sorry, don't know about them */ @@ -836,11 +445,13 @@ void __cpuinit ds_init_intel(struct cpuinfo_x86 *c) break; case 0xF: switch (c->x86_model) { +#ifdef __i386__ case 0x0: case 0x1: case 0x2: /* Netburst */ - ds_configure(&ds_cfg_var); + ds_configure(&ds_cfg_netburst); break; +#endif /* _i386_ */ default: /* sorry, don't know about them */ break; @@ -851,14 +462,3 @@ void __cpuinit ds_init_intel(struct cpuinfo_x86 *c) break; } } - -void ds_free(struct ds_context *context) -{ - /* This is called when the task owning the parameter context - * is dying. There should not be any user of that context left - * to disturb us, anymore. */ - unsigned long leftovers = context->count; - while (leftovers--) - ds_put_context(context); -} -#endif /* CONFIG_X86_DS */ diff --git a/trunk/arch/x86/kernel/efi.c b/trunk/arch/x86/kernel/efi.c index 945a31cdd81f..06cc8d4254b1 100644 --- a/trunk/arch/x86/kernel/efi.c +++ b/trunk/arch/x86/kernel/efi.c @@ -414,11 +414,9 @@ void __init efi_init(void) if (memmap.map == NULL) printk(KERN_ERR "Could not map the EFI memory map!\n"); memmap.map_end = memmap.map + (memmap.nr_map * memmap.desc_size); - if (memmap.desc_size != sizeof(efi_memory_desc_t)) - printk(KERN_WARNING - "Kernel-defined memdesc doesn't match the one from EFI!\n"); - + printk(KERN_WARNING "Kernel-defined memdesc" + "doesn't match the one from EFI!\n"); if (add_efi_memmap) do_add_efi_memmap(); diff --git a/trunk/arch/x86/kernel/entry_64.S b/trunk/arch/x86/kernel/entry_64.S index cf3a0b2d0059..89434d439605 100644 --- a/trunk/arch/x86/kernel/entry_64.S +++ b/trunk/arch/x86/kernel/entry_64.S @@ -275,9 +275,9 @@ ENTRY(native_usergs_sysret64) ENTRY(ret_from_fork) CFI_DEFAULT_STACK push kernel_eflags(%rip) - CFI_ADJUST_CFA_OFFSET 8 + CFI_ADJUST_CFA_OFFSET 4 popf # reset kernel eflags - CFI_ADJUST_CFA_OFFSET -8 + CFI_ADJUST_CFA_OFFSET -4 call schedule_tail GET_THREAD_INFO(%rcx) testl $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT),TI_flags(%rcx) diff --git a/trunk/arch/x86/kernel/head64.c b/trunk/arch/x86/kernel/head64.c index d16084f90649..9bfc4d72fb2e 100644 --- a/trunk/arch/x86/kernel/head64.c +++ b/trunk/arch/x86/kernel/head64.c @@ -108,11 +108,12 @@ void __init x86_64_start_kernel(char * real_mode_data) } load_idt((const struct desc_ptr *)&idt_descr); - if (console_loglevel == 10) - early_printk("Kernel alive\n"); + early_printk("Kernel alive\n"); x86_64_init_pda(); + early_printk("Kernel really alive\n"); + x86_64_start_reservations(real_mode_data); } diff --git a/trunk/arch/x86/kernel/ioport.c b/trunk/arch/x86/kernel/ioport.c index 191914302744..50e5e4a31c85 100644 --- a/trunk/arch/x86/kernel/ioport.c +++ b/trunk/arch/x86/kernel/ioport.c @@ -14,7 +14,6 @@ #include #include #include -#include /* Set EXTENT bits starting at BASE in BITMAP to value TURN_ON. */ static void set_bitmap(unsigned long *bitmap, unsigned int base, diff --git a/trunk/arch/x86/kernel/ipi.c b/trunk/arch/x86/kernel/ipi.c index f1c688e46f35..3f7537b669d3 100644 --- a/trunk/arch/x86/kernel/ipi.c +++ b/trunk/arch/x86/kernel/ipi.c @@ -20,8 +20,6 @@ #ifdef CONFIG_X86_32 #include -#include - /* * the following functions deal with sending IPIs between CPUs. * @@ -149,6 +147,7 @@ void send_IPI_mask_sequence(cpumask_t mask, int vector) } /* must come after the send_IPI functions above for inlining */ +#include static int convert_apicid_to_cpu(int apic_id) { int i; diff --git a/trunk/arch/x86/kernel/irq_32.c b/trunk/arch/x86/kernel/irq_32.c index b71e02d42f4f..1cf8c1fcc088 100644 --- a/trunk/arch/x86/kernel/irq_32.c +++ b/trunk/arch/x86/kernel/irq_32.c @@ -325,7 +325,7 @@ int show_interrupts(struct seq_file *p, void *v) for_each_online_cpu(j) seq_printf(p, "%10u ", per_cpu(irq_stat,j).irq_call_count); - seq_printf(p, " Function call interrupts\n"); + seq_printf(p, " function call interrupts\n"); seq_printf(p, "TLB: "); for_each_online_cpu(j) seq_printf(p, "%10u ", diff --git a/trunk/arch/x86/kernel/irq_64.c b/trunk/arch/x86/kernel/irq_64.c index f065fe9071b9..1f78b238d8d2 100644 --- a/trunk/arch/x86/kernel/irq_64.c +++ b/trunk/arch/x86/kernel/irq_64.c @@ -129,7 +129,7 @@ int show_interrupts(struct seq_file *p, void *v) seq_printf(p, "CAL: "); for_each_online_cpu(j) seq_printf(p, "%10u ", cpu_pda(j)->irq_call_count); - seq_printf(p, " Function call interrupts\n"); + seq_printf(p, " function call interrupts\n"); seq_printf(p, "TLB: "); for_each_online_cpu(j) seq_printf(p, "%10u ", cpu_pda(j)->irq_tlb_count); diff --git a/trunk/arch/x86/kernel/kvm.c b/trunk/arch/x86/kernel/kvm.c index 478bca986eca..8b7a3cf37d2b 100644 --- a/trunk/arch/x86/kernel/kvm.c +++ b/trunk/arch/x86/kernel/kvm.c @@ -178,7 +178,7 @@ static void kvm_flush_tlb(void) kvm_deferred_mmu_op(&ftlb, sizeof ftlb); } -static void kvm_release_pt(unsigned long pfn) +static void kvm_release_pt(u32 pfn) { struct kvm_mmu_op_release_pt rpt = { .header.op = KVM_MMU_OP_RELEASE_PT, diff --git a/trunk/arch/x86/kernel/ldt.c b/trunk/arch/x86/kernel/ldt.c index 0ed5f939b905..b68e21f06f4f 100644 --- a/trunk/arch/x86/kernel/ldt.c +++ b/trunk/arch/x86/kernel/ldt.c @@ -18,7 +18,6 @@ #include #include #include -#include #ifdef CONFIG_SMP static void flush_ldt(void *current_mm) diff --git a/trunk/arch/x86/kernel/nmi.c b/trunk/arch/x86/kernel/nmi.c index 2c97f07f1c2c..abb78a2cc4ad 100644 --- a/trunk/arch/x86/kernel/nmi.c +++ b/trunk/arch/x86/kernel/nmi.c @@ -299,15 +299,6 @@ void acpi_nmi_disable(void) on_each_cpu(__acpi_nmi_disable, NULL, 1); } -/* - * This function is called as soon the LAPIC NMI watchdog driver has everything - * in place and it's ready to check if the NMIs belong to the NMI watchdog - */ -void cpu_nmi_set_wd_enabled(void) -{ - __get_cpu_var(wd_enabled) = 1; -} - void setup_apic_nmi_watchdog(void *unused) { if (__get_cpu_var(wd_enabled)) @@ -320,6 +311,8 @@ void setup_apic_nmi_watchdog(void *unused) switch (nmi_watchdog) { case NMI_LOCAL_APIC: + /* enable it before to avoid race with handler */ + __get_cpu_var(wd_enabled) = 1; if (lapic_watchdog_init(nmi_hz) < 0) { __get_cpu_var(wd_enabled) = 0; return; diff --git a/trunk/arch/x86/kernel/olpc.c b/trunk/arch/x86/kernel/olpc.c index 7a13fac63a1f..3e6672274807 100644 --- a/trunk/arch/x86/kernel/olpc.c +++ b/trunk/arch/x86/kernel/olpc.c @@ -190,12 +190,12 @@ EXPORT_SYMBOL_GPL(olpc_ec_cmd); static void __init platform_detect(void) { size_t propsize; - __be32 rev; + u32 rev; if (ofw("getprop", 4, 1, NULL, "board-revision-int", &rev, 4, &propsize) || propsize != 4) { printk(KERN_ERR "ofw: getprop call failed!\n"); - rev = cpu_to_be32(0); + rev = 0; } olpc_platform_info.boardrev = be32_to_cpu(rev); } @@ -203,7 +203,7 @@ static void __init platform_detect(void) static void __init platform_detect(void) { /* stopgap until OFW support is added to the kernel */ - olpc_platform_info.boardrev = 0xc2; + olpc_platform_info.boardrev = be32_to_cpu(0xc2); } #endif diff --git a/trunk/arch/x86/kernel/paravirt.c b/trunk/arch/x86/kernel/paravirt.c index e2f43768723a..300da17e61cb 100644 --- a/trunk/arch/x86/kernel/paravirt.c +++ b/trunk/arch/x86/kernel/paravirt.c @@ -330,7 +330,6 @@ struct pv_cpu_ops pv_cpu_ops = { #endif .wbinvd = native_wbinvd, .read_msr = native_read_msr_safe, - .read_msr_amd = native_read_msr_amd_safe, .write_msr = native_write_msr_safe, .read_tsc = native_read_tsc, .read_pmc = native_read_pmc, diff --git a/trunk/arch/x86/kernel/paravirt_patch_32.c b/trunk/arch/x86/kernel/paravirt_patch_32.c index 9fe644f4861d..58262218781b 100644 --- a/trunk/arch/x86/kernel/paravirt_patch_32.c +++ b/trunk/arch/x86/kernel/paravirt_patch_32.c @@ -23,7 +23,7 @@ unsigned native_patch(u8 type, u16 clobbers, void *ibuf, start = start_##ops##_##x; \ end = end_##ops##_##x; \ goto patch_site - switch (type) { + switch(type) { PATCH_SITE(pv_irq_ops, irq_disable); PATCH_SITE(pv_irq_ops, irq_enable); PATCH_SITE(pv_irq_ops, restore_fl); diff --git a/trunk/arch/x86/kernel/pci-dma.c b/trunk/arch/x86/kernel/pci-dma.c index f704cb51ff82..87d4d6964ec2 100644 --- a/trunk/arch/x86/kernel/pci-dma.c +++ b/trunk/arch/x86/kernel/pci-dma.c @@ -82,7 +82,7 @@ void __init dma32_reserve_bootmem(void) * using 512M as goal */ align = 64ULL<<20; - size = roundup(dma32_bootmem_size, align); + size = round_up(dma32_bootmem_size, align); dma32_bootmem_ptr = __alloc_bootmem_nopanic(size, align, 512ULL<<20); if (dma32_bootmem_ptr) diff --git a/trunk/arch/x86/kernel/pci-gart_64.c b/trunk/arch/x86/kernel/pci-gart_64.c index 1a895a582534..be33a5442d82 100644 --- a/trunk/arch/x86/kernel/pci-gart_64.c +++ b/trunk/arch/x86/kernel/pci-gart_64.c @@ -82,8 +82,7 @@ AGPEXTERN __u32 *agp_gatt_table; static unsigned long next_bit; /* protected by iommu_bitmap_lock */ static int need_flush; /* global flush state. set for each gart wrap */ -static unsigned long alloc_iommu(struct device *dev, int size, - unsigned long align_mask) +static unsigned long alloc_iommu(struct device *dev, int size) { unsigned long offset, flags; unsigned long boundary_size; @@ -91,17 +90,16 @@ static unsigned long alloc_iommu(struct device *dev, int size, base_index = ALIGN(iommu_bus_base & dma_get_seg_boundary(dev), PAGE_SIZE) >> PAGE_SHIFT; - boundary_size = ALIGN((unsigned long long)dma_get_seg_boundary(dev) + 1, + boundary_size = ALIGN(dma_get_seg_boundary(dev) + 1, PAGE_SIZE) >> PAGE_SHIFT; spin_lock_irqsave(&iommu_bitmap_lock, flags); offset = iommu_area_alloc(iommu_gart_bitmap, iommu_pages, next_bit, - size, base_index, boundary_size, align_mask); + size, base_index, boundary_size, 0); if (offset == -1) { need_flush = 1; offset = iommu_area_alloc(iommu_gart_bitmap, iommu_pages, 0, - size, base_index, boundary_size, - align_mask); + size, base_index, boundary_size, 0); } if (offset != -1) { next_bit = offset+size; @@ -238,10 +236,10 @@ nonforced_iommu(struct device *dev, unsigned long addr, size_t size) * Caller needs to check if the iommu is needed and flush. */ static dma_addr_t dma_map_area(struct device *dev, dma_addr_t phys_mem, - size_t size, int dir, unsigned long align_mask) + size_t size, int dir) { unsigned long npages = iommu_num_pages(phys_mem, size); - unsigned long iommu_page = alloc_iommu(dev, npages, align_mask); + unsigned long iommu_page = alloc_iommu(dev, npages); int i; if (iommu_page == -1) { @@ -264,11 +262,7 @@ static dma_addr_t dma_map_area(struct device *dev, dma_addr_t phys_mem, static dma_addr_t gart_map_simple(struct device *dev, phys_addr_t paddr, size_t size, int dir) { - dma_addr_t map; - unsigned long align_mask; - - align_mask = (1UL << get_order(size)) - 1; - map = dma_map_area(dev, paddr, size, dir, align_mask); + dma_addr_t map = dma_map_area(dev, paddr, size, dir); flush_gart(); @@ -287,8 +281,7 @@ gart_map_single(struct device *dev, phys_addr_t paddr, size_t size, int dir) if (!need_iommu(dev, paddr, size)) return paddr; - bus = dma_map_area(dev, paddr, size, dir, 0); - flush_gart(); + bus = gart_map_simple(dev, paddr, size, dir); return bus; } @@ -347,7 +340,7 @@ static int dma_map_sg_nonforce(struct device *dev, struct scatterlist *sg, unsigned long addr = sg_phys(s); if (nonforced_iommu(dev, addr, s->length)) { - addr = dma_map_area(dev, addr, s->length, dir, 0); + addr = dma_map_area(dev, addr, s->length, dir); if (addr == bad_dma_address) { if (i > 0) gart_unmap_sg(dev, sg, i, dir); @@ -369,7 +362,7 @@ static int __dma_map_cont(struct device *dev, struct scatterlist *start, int nelems, struct scatterlist *sout, unsigned long pages) { - unsigned long iommu_start = alloc_iommu(dev, pages, 0); + unsigned long iommu_start = alloc_iommu(dev, pages); unsigned long iommu_page = iommu_start; struct scatterlist *s; int i; diff --git a/trunk/arch/x86/kernel/pcspeaker.c b/trunk/arch/x86/kernel/pcspeaker.c index a311ffcaad16..bc1f2d3ea277 100644 --- a/trunk/arch/x86/kernel/pcspeaker.c +++ b/trunk/arch/x86/kernel/pcspeaker.c @@ -1,13 +1,20 @@ #include -#include +#include #include static __init int add_pcspkr(void) { struct platform_device *pd; + int ret; - pd = platform_device_register_simple("pcspkr", -1, NULL, 0); + pd = platform_device_alloc("pcspkr", -1); + if (!pd) + return -ENOMEM; - return IS_ERR(pd) ? PTR_ERR(pd) : 0; + ret = platform_device_add(pd); + if (ret) + platform_device_put(pd); + + return ret; } device_initcall(add_pcspkr); diff --git a/trunk/arch/x86/kernel/process.c b/trunk/arch/x86/kernel/process.c index ec7a2ba9bce8..876e91890777 100644 --- a/trunk/arch/x86/kernel/process.c +++ b/trunk/arch/x86/kernel/process.c @@ -185,8 +185,7 @@ static void mwait_idle(void) static void poll_idle(void) { local_irq_enable(); - while (!need_resched()) - cpu_relax(); + cpu_relax(); } /* diff --git a/trunk/arch/x86/kernel/process_32.c b/trunk/arch/x86/kernel/process_32.c index 205188db9626..31f40b24bf5d 100644 --- a/trunk/arch/x86/kernel/process_32.c +++ b/trunk/arch/x86/kernel/process_32.c @@ -37,7 +37,6 @@ #include #include #include -#include #include #include @@ -57,8 +56,6 @@ #include #include #include -#include -#include asmlinkage void ret_from_fork(void) __asm__("ret_from_fork"); @@ -164,7 +161,6 @@ void __show_registers(struct pt_regs *regs, int all) unsigned long d0, d1, d2, d3, d6, d7; unsigned long sp; unsigned short ss, gs; - const char *board; if (user_mode_vm(regs)) { sp = regs->sp; @@ -177,15 +173,11 @@ void __show_registers(struct pt_regs *regs, int all) } printk("\n"); - - board = dmi_get_system_info(DMI_PRODUCT_NAME); - if (!board) - board = ""; - printk("Pid: %d, comm: %s %s (%s %.*s) %s\n", + printk("Pid: %d, comm: %s %s (%s %.*s)\n", task_pid_nr(current), current->comm, print_tainted(), init_utsname()->release, (int)strcspn(init_utsname()->version, " "), - init_utsname()->version, board); + init_utsname()->version); printk("EIP: %04x:[<%08lx>] EFLAGS: %08lx CPU: %d\n", (u16)regs->cs, regs->ip, regs->flags, @@ -285,14 +277,6 @@ void exit_thread(void) tss->x86_tss.io_bitmap_base = INVALID_IO_BITMAP_OFFSET; put_cpu(); } -#ifdef CONFIG_X86_DS - /* Free any DS contexts that have not been properly released. */ - if (unlikely(current->thread.ds_ctx)) { - /* we clear debugctl to make sure DS is not used. */ - update_debugctlmsr(0); - ds_free(current->thread.ds_ctx); - } -#endif /* CONFIG_X86_DS */ } void flush_thread(void) @@ -454,35 +438,6 @@ int set_tsc_mode(unsigned int val) return 0; } -#ifdef CONFIG_X86_DS -static int update_debugctl(struct thread_struct *prev, - struct thread_struct *next, unsigned long debugctl) -{ - unsigned long ds_prev = 0; - unsigned long ds_next = 0; - - if (prev->ds_ctx) - ds_prev = (unsigned long)prev->ds_ctx->ds; - if (next->ds_ctx) - ds_next = (unsigned long)next->ds_ctx->ds; - - if (ds_next != ds_prev) { - /* we clear debugctl to make sure DS - * is not in use when we change it */ - debugctl = 0; - update_debugctlmsr(0); - wrmsr(MSR_IA32_DS_AREA, ds_next, 0); - } - return debugctl; -} -#else -static int update_debugctl(struct thread_struct *prev, - struct thread_struct *next, unsigned long debugctl) -{ - return debugctl; -} -#endif /* CONFIG_X86_DS */ - static noinline void __switch_to_xtra(struct task_struct *prev_p, struct task_struct *next_p, struct tss_struct *tss) @@ -493,7 +448,14 @@ __switch_to_xtra(struct task_struct *prev_p, struct task_struct *next_p, prev = &prev_p->thread; next = &next_p->thread; - debugctl = update_debugctl(prev, next, prev->debugctlmsr); + debugctl = prev->debugctlmsr; + if (next->ds_area_msr != prev->ds_area_msr) { + /* we clear debugctl to make sure DS + * is not in use when we change it */ + debugctl = 0; + update_debugctlmsr(0); + wrmsr(MSR_IA32_DS_AREA, next->ds_area_msr, 0); + } if (next->debugctlmsr != debugctl) update_debugctlmsr(next->debugctlmsr); @@ -517,13 +479,13 @@ __switch_to_xtra(struct task_struct *prev_p, struct task_struct *next_p, hard_enable_TSC(); } -#ifdef CONFIG_X86_PTRACE_BTS +#ifdef X86_BTS if (test_tsk_thread_flag(prev_p, TIF_BTS_TRACE_TS)) ptrace_bts_take_timestamp(prev_p, BTS_TASK_DEPARTS); if (test_tsk_thread_flag(next_p, TIF_BTS_TRACE_TS)) ptrace_bts_take_timestamp(next_p, BTS_TASK_ARRIVES); -#endif /* CONFIG_X86_PTRACE_BTS */ +#endif if (!test_tsk_thread_flag(next_p, TIF_IO_BITMAP)) { diff --git a/trunk/arch/x86/kernel/process_64.c b/trunk/arch/x86/kernel/process_64.c index 2a8ccb9238b4..e12e0e4dd256 100644 --- a/trunk/arch/x86/kernel/process_64.c +++ b/trunk/arch/x86/kernel/process_64.c @@ -37,11 +37,11 @@ #include #include #include -#include -#include +#include #include #include +#include #include #include #include @@ -51,7 +51,6 @@ #include #include #include -#include asmlinkage extern void ret_from_fork(void); @@ -89,7 +88,7 @@ void exit_idle(void) #ifdef CONFIG_HOTPLUG_CPU DECLARE_PER_CPU(int, cpu_state); -#include +#include /* We halt the CPU with physical CPU hotplug */ static inline void play_dead(void) { @@ -154,7 +153,7 @@ void cpu_idle(void) } /* Prints also some state that isn't saved in the pt_regs */ -void __show_regs(struct pt_regs *regs) +void __show_regs(struct pt_regs * regs) { unsigned long cr0 = 0L, cr2 = 0L, cr3 = 0L, cr4 = 0L, fs, gs, shadowgs; unsigned long d0, d1, d2, d3, d6, d7; @@ -163,61 +162,59 @@ void __show_regs(struct pt_regs *regs) printk("\n"); print_modules(); - printk(KERN_INFO "Pid: %d, comm: %.20s %s %s %.*s\n", + printk("Pid: %d, comm: %.20s %s %s %.*s\n", current->pid, current->comm, print_tainted(), init_utsname()->release, (int)strcspn(init_utsname()->version, " "), init_utsname()->version); - printk(KERN_INFO "RIP: %04lx:[<%016lx>] ", regs->cs & 0xffff, regs->ip); + printk("RIP: %04lx:[<%016lx>] ", regs->cs & 0xffff, regs->ip); printk_address(regs->ip, 1); - printk(KERN_INFO "RSP: %04lx:%016lx EFLAGS: %08lx\n", regs->ss, - regs->sp, regs->flags); - printk(KERN_INFO "RAX: %016lx RBX: %016lx RCX: %016lx\n", + printk("RSP: %04lx:%016lx EFLAGS: %08lx\n", regs->ss, regs->sp, + regs->flags); + printk("RAX: %016lx RBX: %016lx RCX: %016lx\n", regs->ax, regs->bx, regs->cx); - printk(KERN_INFO "RDX: %016lx RSI: %016lx RDI: %016lx\n", + printk("RDX: %016lx RSI: %016lx RDI: %016lx\n", regs->dx, regs->si, regs->di); - printk(KERN_INFO "RBP: %016lx R08: %016lx R09: %016lx\n", + printk("RBP: %016lx R08: %016lx R09: %016lx\n", regs->bp, regs->r8, regs->r9); - printk(KERN_INFO "R10: %016lx R11: %016lx R12: %016lx\n", - regs->r10, regs->r11, regs->r12); - printk(KERN_INFO "R13: %016lx R14: %016lx R15: %016lx\n", - regs->r13, regs->r14, regs->r15); - - asm("movl %%ds,%0" : "=r" (ds)); - asm("movl %%cs,%0" : "=r" (cs)); - asm("movl %%es,%0" : "=r" (es)); + printk("R10: %016lx R11: %016lx R12: %016lx\n", + regs->r10, regs->r11, regs->r12); + printk("R13: %016lx R14: %016lx R15: %016lx\n", + regs->r13, regs->r14, regs->r15); + + asm("movl %%ds,%0" : "=r" (ds)); + asm("movl %%cs,%0" : "=r" (cs)); + asm("movl %%es,%0" : "=r" (es)); asm("movl %%fs,%0" : "=r" (fsindex)); asm("movl %%gs,%0" : "=r" (gsindex)); rdmsrl(MSR_FS_BASE, fs); - rdmsrl(MSR_GS_BASE, gs); - rdmsrl(MSR_KERNEL_GS_BASE, shadowgs); + rdmsrl(MSR_GS_BASE, gs); + rdmsrl(MSR_KERNEL_GS_BASE, shadowgs); cr0 = read_cr0(); cr2 = read_cr2(); cr3 = read_cr3(); cr4 = read_cr4(); - printk(KERN_INFO "FS: %016lx(%04x) GS:%016lx(%04x) knlGS:%016lx\n", - fs, fsindex, gs, gsindex, shadowgs); - printk(KERN_INFO "CS: %04x DS: %04x ES: %04x CR0: %016lx\n", cs, ds, - es, cr0); - printk(KERN_INFO "CR2: %016lx CR3: %016lx CR4: %016lx\n", cr2, cr3, - cr4); + printk("FS: %016lx(%04x) GS:%016lx(%04x) knlGS:%016lx\n", + fs,fsindex,gs,gsindex,shadowgs); + printk("CS: %04x DS: %04x ES: %04x CR0: %016lx\n", cs, ds, es, cr0); + printk("CR2: %016lx CR3: %016lx CR4: %016lx\n", cr2, cr3, cr4); get_debugreg(d0, 0); get_debugreg(d1, 1); get_debugreg(d2, 2); - printk(KERN_INFO "DR0: %016lx DR1: %016lx DR2: %016lx\n", d0, d1, d2); + printk("DR0: %016lx DR1: %016lx DR2: %016lx\n", d0, d1, d2); get_debugreg(d3, 3); get_debugreg(d6, 6); get_debugreg(d7, 7); - printk(KERN_INFO "DR3: %016lx DR6: %016lx DR7: %016lx\n", d3, d6, d7); + printk("DR3: %016lx DR6: %016lx DR7: %016lx\n", d3, d6, d7); } void show_regs(struct pt_regs *regs) { - printk(KERN_INFO "CPU %d:", smp_processor_id()); + printk("CPU %d:", smp_processor_id()); __show_regs(regs); show_trace(NULL, regs, (void *)(regs + 1), regs->bp); } @@ -243,14 +240,6 @@ void exit_thread(void) t->io_bitmap_max = 0; put_cpu(); } -#ifdef CONFIG_X86_DS - /* Free any DS contexts that have not been properly released. */ - if (unlikely(t->ds_ctx)) { - /* we clear debugctl to make sure DS is not used. */ - update_debugctlmsr(0); - ds_free(t->ds_ctx); - } -#endif /* CONFIG_X86_DS */ } void flush_thread(void) @@ -326,10 +315,10 @@ void prepare_to_copy(struct task_struct *tsk) int copy_thread(int nr, unsigned long clone_flags, unsigned long sp, unsigned long unused, - struct task_struct *p, struct pt_regs *regs) + struct task_struct * p, struct pt_regs * regs) { int err; - struct pt_regs *childregs; + struct pt_regs * childregs; struct task_struct *me = current; childregs = ((struct pt_regs *) @@ -374,10 +363,10 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long sp, if (test_thread_flag(TIF_IA32)) err = do_set_thread_area(p, -1, (struct user_desc __user *)childregs->si, 0); - else -#endif - err = do_arch_prctl(p, ARCH_SET_FS, childregs->r8); - if (err) + else +#endif + err = do_arch_prctl(p, ARCH_SET_FS, childregs->r8); + if (err) goto out; } err = 0; @@ -484,27 +473,13 @@ static inline void __switch_to_xtra(struct task_struct *prev_p, next = &next_p->thread; debugctl = prev->debugctlmsr; - -#ifdef CONFIG_X86_DS - { - unsigned long ds_prev = 0, ds_next = 0; - - if (prev->ds_ctx) - ds_prev = (unsigned long)prev->ds_ctx->ds; - if (next->ds_ctx) - ds_next = (unsigned long)next->ds_ctx->ds; - - if (ds_next != ds_prev) { - /* - * We clear debugctl to make sure DS - * is not in use when we change it: - */ - debugctl = 0; - update_debugctlmsr(0); - wrmsrl(MSR_IA32_DS_AREA, ds_next); - } + if (next->ds_area_msr != prev->ds_area_msr) { + /* we clear debugctl to make sure DS + * is not in use when we change it */ + debugctl = 0; + update_debugctlmsr(0); + wrmsrl(MSR_IA32_DS_AREA, next->ds_area_msr); } -#endif /* CONFIG_X86_DS */ if (next->debugctlmsr != debugctl) update_debugctlmsr(next->debugctlmsr); @@ -542,13 +517,13 @@ static inline void __switch_to_xtra(struct task_struct *prev_p, memset(tss->io_bitmap, 0xff, prev->io_bitmap_max); } -#ifdef CONFIG_X86_PTRACE_BTS +#ifdef X86_BTS if (test_tsk_thread_flag(prev_p, TIF_BTS_TRACE_TS)) ptrace_bts_take_timestamp(prev_p, BTS_TASK_DEPARTS); if (test_tsk_thread_flag(next_p, TIF_BTS_TRACE_TS)) ptrace_bts_take_timestamp(next_p, BTS_TASK_ARRIVES); -#endif /* CONFIG_X86_PTRACE_BTS */ +#endif } /* @@ -570,7 +545,7 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p) unsigned fsindex, gsindex; /* we're going to use this soon, after a few expensive things */ - if (next_p->fpu_counter > 5) + if (next_p->fpu_counter>5) prefetch(next->xstate); /* @@ -578,13 +553,13 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p) */ load_sp0(tss, next); - /* + /* * Switch DS and ES. * This won't pick up thread selector changes, but I guess that is ok. */ savesegment(es, prev->es); if (unlikely(next->es | prev->es)) - loadsegment(es, next->es); + loadsegment(es, next->es); savesegment(ds, prev->ds); if (unlikely(next->ds | prev->ds)) @@ -610,7 +585,7 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p) */ arch_leave_lazy_cpu_mode(); - /* + /* * Switch FS and GS. * * Segment register != 0 always requires a reload. Also @@ -619,13 +594,13 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p) */ if (unlikely(fsindex | next->fsindex | prev->fs)) { loadsegment(fs, next->fsindex); - /* + /* * Check if the user used a selector != 0; if yes * clear 64bit base, since overloaded base is always * mapped to the Null selector */ if (fsindex) - prev->fs = 0; + prev->fs = 0; } /* when next process has a 64bit base use it */ if (next->fs) @@ -635,7 +610,7 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p) if (unlikely(gsindex | next->gsindex | prev->gs)) { load_gs_index(next->gsindex); if (gsindex) - prev->gs = 0; + prev->gs = 0; } if (next->gs) wrmsrl(MSR_KERNEL_GS_BASE, next->gs); @@ -644,12 +619,12 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p) /* Must be after DS reload */ unlazy_fpu(prev_p); - /* + /* * Switch the PDA and FPU contexts. */ prev->usersp = read_pda(oldrsp); write_pda(oldrsp, next->usersp); - write_pda(pcurrent, next_p); + write_pda(pcurrent, next_p); write_pda(kernelstack, (unsigned long)task_stack_page(next_p) + @@ -690,7 +665,7 @@ long sys_execve(char __user *name, char __user * __user *argv, char __user * __user *envp, struct pt_regs *regs) { long error; - char *filename; + char * filename; filename = getname(name); error = PTR_ERR(filename); @@ -748,55 +723,55 @@ asmlinkage long sys_vfork(struct pt_regs *regs) unsigned long get_wchan(struct task_struct *p) { unsigned long stack; - u64 fp, ip; + u64 fp,ip; int count = 0; - if (!p || p == current || p->state == TASK_RUNNING) - return 0; + if (!p || p == current || p->state==TASK_RUNNING) + return 0; stack = (unsigned long)task_stack_page(p); if (p->thread.sp < stack || p->thread.sp > stack+THREAD_SIZE) return 0; fp = *(u64 *)(p->thread.sp); - do { + do { if (fp < (unsigned long)stack || fp > (unsigned long)stack+THREAD_SIZE) - return 0; + return 0; ip = *(u64 *)(fp+8); if (!in_sched_functions(ip)) return ip; - fp = *(u64 *)fp; - } while (count++ < 16); + fp = *(u64 *)fp; + } while (count++ < 16); return 0; } long do_arch_prctl(struct task_struct *task, int code, unsigned long addr) -{ - int ret = 0; +{ + int ret = 0; int doit = task == current; int cpu; - switch (code) { + switch (code) { case ARCH_SET_GS: if (addr >= TASK_SIZE_OF(task)) - return -EPERM; + return -EPERM; cpu = get_cpu(); - /* handle small bases via the GDT because that's faster to + /* handle small bases via the GDT because that's faster to switch. */ - if (addr <= 0xffffffff) { - set_32bit_tls(task, GS_TLS, addr); - if (doit) { + if (addr <= 0xffffffff) { + set_32bit_tls(task, GS_TLS, addr); + if (doit) { load_TLS(&task->thread, cpu); - load_gs_index(GS_TLS_SEL); + load_gs_index(GS_TLS_SEL); } - task->thread.gsindex = GS_TLS_SEL; + task->thread.gsindex = GS_TLS_SEL; task->thread.gs = 0; - } else { + } else { task->thread.gsindex = 0; task->thread.gs = addr; if (doit) { load_gs_index(0); ret = checking_wrmsrl(MSR_KERNEL_GS_BASE, addr); - } + } } put_cpu(); break; @@ -850,7 +825,8 @@ long do_arch_prctl(struct task_struct *task, int code, unsigned long addr) rdmsrl(MSR_KERNEL_GS_BASE, base); else base = task->thread.gs; - } else + } + else base = task->thread.gs; ret = put_user(base, (unsigned long __user *)addr); break; diff --git a/trunk/arch/x86/kernel/ptrace.c b/trunk/arch/x86/kernel/ptrace.c index e375b658efc3..e37dccce85db 100644 --- a/trunk/arch/x86/kernel/ptrace.c +++ b/trunk/arch/x86/kernel/ptrace.c @@ -14,7 +14,6 @@ #include #include #include -#include #include #include #include @@ -70,7 +69,7 @@ static inline bool invalid_selector(u16 value) #define FLAG_MASK FLAG_MASK_32 -static unsigned long *pt_regs_access(struct pt_regs *regs, unsigned long regno) +static long *pt_regs_access(struct pt_regs *regs, unsigned long regno) { BUILD_BUG_ON(offsetof(struct pt_regs, bx) != 0); regno >>= 2; @@ -555,115 +554,45 @@ static int ptrace_set_debugreg(struct task_struct *child, return 0; } -#ifdef CONFIG_X86_PTRACE_BTS -/* - * The configuration for a particular BTS hardware implementation. - */ -struct bts_configuration { - /* the size of a BTS record in bytes; at most BTS_MAX_RECORD_SIZE */ - unsigned char sizeof_bts; - /* the size of a field in the BTS record in bytes */ - unsigned char sizeof_field; - /* a bitmask to enable/disable BTS in DEBUGCTL MSR */ - unsigned long debugctl_mask; -}; -static struct bts_configuration bts_cfg; - -#define BTS_MAX_RECORD_SIZE (8 * 3) - - -/* - * Branch Trace Store (BTS) uses the following format. Different - * architectures vary in the size of those fields. - * - source linear address - * - destination linear address - * - flags - * - * Later architectures use 64bit pointers throughout, whereas earlier - * architectures use 32bit pointers in 32bit mode. - * - * We compute the base address for the first 8 fields based on: - * - the field size stored in the DS configuration - * - the relative field position - * - * In order to store additional information in the BTS buffer, we use - * a special source address to indicate that the record requires - * special interpretation. - * - * Netburst indicated via a bit in the flags field whether the branch - * was predicted; this is ignored. - */ - -enum bts_field { - bts_from = 0, - bts_to, - bts_flags, - - bts_escape = (unsigned long)-1, - bts_qual = bts_to, - bts_jiffies = bts_flags -}; - -static inline unsigned long bts_get(const char *base, enum bts_field field) -{ - base += (bts_cfg.sizeof_field * field); - return *(unsigned long *)base; -} +#ifdef X86_BTS -static inline void bts_set(char *base, enum bts_field field, unsigned long val) +static int ptrace_bts_get_size(struct task_struct *child) { - base += (bts_cfg.sizeof_field * field);; - (*(unsigned long *)base) = val; -} + if (!child->thread.ds_area_msr) + return -ENXIO; -/* - * Translate a BTS record from the raw format into the bts_struct format - * - * out (out): bts_struct interpretation - * raw: raw BTS record - */ -static void ptrace_bts_translate_record(struct bts_struct *out, const void *raw) -{ - memset(out, 0, sizeof(*out)); - if (bts_get(raw, bts_from) == bts_escape) { - out->qualifier = bts_get(raw, bts_qual); - out->variant.jiffies = bts_get(raw, bts_jiffies); - } else { - out->qualifier = BTS_BRANCH; - out->variant.lbr.from_ip = bts_get(raw, bts_from); - out->variant.lbr.to_ip = bts_get(raw, bts_to); - } + return ds_get_bts_index((void *)child->thread.ds_area_msr); } -static int ptrace_bts_read_record(struct task_struct *child, size_t index, +static int ptrace_bts_read_record(struct task_struct *child, + long index, struct bts_struct __user *out) { struct bts_struct ret; - const void *bts_record; - size_t bts_index, bts_end; - int error; + int retval; + int bts_end; + int bts_index; - error = ds_get_bts_end(child, &bts_end); - if (error < 0) - return error; + if (!child->thread.ds_area_msr) + return -ENXIO; - if (bts_end <= index) + if (index < 0) return -EINVAL; - error = ds_get_bts_index(child, &bts_index); - if (error < 0) - return error; + bts_end = ds_get_bts_end((void *)child->thread.ds_area_msr); + if (bts_end <= index) + return -EINVAL; /* translate the ptrace bts index into the ds bts index */ - bts_index += bts_end - (index + 1); - if (bts_end <= bts_index) - bts_index -= bts_end; + bts_index = ds_get_bts_index((void *)child->thread.ds_area_msr); + bts_index -= (index + 1); + if (bts_index < 0) + bts_index += bts_end; - error = ds_access_bts(child, bts_index, &bts_record); - if (error < 0) - return error; - - ptrace_bts_translate_record(&ret, bts_record); + retval = ds_read_bts((void *)child->thread.ds_area_msr, + bts_index, &ret); + if (retval < 0) + return retval; if (copy_to_user(out, &ret, sizeof(ret))) return -EFAULT; @@ -671,106 +600,101 @@ static int ptrace_bts_read_record(struct task_struct *child, size_t index, return sizeof(ret); } +static int ptrace_bts_clear(struct task_struct *child) +{ + if (!child->thread.ds_area_msr) + return -ENXIO; + + return ds_clear((void *)child->thread.ds_area_msr); +} + static int ptrace_bts_drain(struct task_struct *child, long size, struct bts_struct __user *out) { - struct bts_struct ret; - const unsigned char *raw; - size_t end, i; - int error; + int end, i; + void *ds = (void *)child->thread.ds_area_msr; - error = ds_get_bts_index(child, &end); - if (error < 0) - return error; + if (!ds) + return -ENXIO; + + end = ds_get_bts_index(ds); + if (end <= 0) + return end; if (size < (end * sizeof(struct bts_struct))) return -EIO; - error = ds_access_bts(child, 0, (const void **)&raw); - if (error < 0) - return error; + for (i = 0; i < end; i++, out++) { + struct bts_struct ret; + int retval; - for (i = 0; i < end; i++, out++, raw += bts_cfg.sizeof_bts) { - ptrace_bts_translate_record(&ret, raw); + retval = ds_read_bts(ds, i, &ret); + if (retval < 0) + return retval; if (copy_to_user(out, &ret, sizeof(ret))) return -EFAULT; } - error = ds_clear_bts(child); - if (error < 0) - return error; + ds_clear(ds); return end; } -static void ptrace_bts_ovfl(struct task_struct *child) -{ - send_sig(child->thread.bts_ovfl_signal, child, 0); -} - static int ptrace_bts_config(struct task_struct *child, long cfg_size, const struct ptrace_bts_config __user *ucfg) { struct ptrace_bts_config cfg; - int error = 0; - - error = -EOPNOTSUPP; - if (!bts_cfg.sizeof_bts) - goto errout; + int bts_size, ret = 0; + void *ds; - error = -EIO; if (cfg_size < sizeof(cfg)) - goto errout; + return -EIO; - error = -EFAULT; if (copy_from_user(&cfg, ucfg, sizeof(cfg))) - goto errout; - - error = -EINVAL; - if ((cfg.flags & PTRACE_BTS_O_SIGNAL) && - !(cfg.flags & PTRACE_BTS_O_ALLOC)) - goto errout; - - if (cfg.flags & PTRACE_BTS_O_ALLOC) { - ds_ovfl_callback_t ovfl = NULL; - unsigned int sig = 0; - - /* we ignore the error in case we were not tracing child */ - (void)ds_release_bts(child); + return -EFAULT; - if (cfg.flags & PTRACE_BTS_O_SIGNAL) { - if (!cfg.signal) - goto errout; + if ((int)cfg.size < 0) + return -EINVAL; - sig = cfg.signal; - ovfl = ptrace_bts_ovfl; - } + bts_size = 0; + ds = (void *)child->thread.ds_area_msr; + if (ds) { + bts_size = ds_get_bts_size(ds); + if (bts_size < 0) + return bts_size; + } + cfg.size = PAGE_ALIGN(cfg.size); - error = ds_request_bts(child, /* base = */ NULL, cfg.size, ovfl); - if (error < 0) + if (bts_size != cfg.size) { + ret = ptrace_bts_realloc(child, cfg.size, + cfg.flags & PTRACE_BTS_O_CUT_SIZE); + if (ret < 0) goto errout; - child->thread.bts_ovfl_signal = sig; + ds = (void *)child->thread.ds_area_msr; } - error = -EINVAL; - if (!child->thread.ds_ctx && cfg.flags) + if (cfg.flags & PTRACE_BTS_O_SIGNAL) + ret = ds_set_overflow(ds, DS_O_SIGNAL); + else + ret = ds_set_overflow(ds, DS_O_WRAP); + if (ret < 0) goto errout; if (cfg.flags & PTRACE_BTS_O_TRACE) - child->thread.debugctlmsr |= bts_cfg.debugctl_mask; + child->thread.debugctlmsr |= ds_debugctl_mask(); else - child->thread.debugctlmsr &= ~bts_cfg.debugctl_mask; + child->thread.debugctlmsr &= ~ds_debugctl_mask(); if (cfg.flags & PTRACE_BTS_O_SCHED) set_tsk_thread_flag(child, TIF_BTS_TRACE_TS); else clear_tsk_thread_flag(child, TIF_BTS_TRACE_TS); - error = sizeof(cfg); + ret = sizeof(cfg); out: if (child->thread.debugctlmsr) @@ -778,10 +702,10 @@ static int ptrace_bts_config(struct task_struct *child, else clear_tsk_thread_flag(child, TIF_DEBUGCTLMSR); - return error; + return ret; errout: - child->thread.debugctlmsr &= ~bts_cfg.debugctl_mask; + child->thread.debugctlmsr &= ~ds_debugctl_mask(); clear_tsk_thread_flag(child, TIF_BTS_TRACE_TS); goto out; } @@ -790,40 +714,29 @@ static int ptrace_bts_status(struct task_struct *child, long cfg_size, struct ptrace_bts_config __user *ucfg) { + void *ds = (void *)child->thread.ds_area_msr; struct ptrace_bts_config cfg; - size_t end; - const void *base, *max; - int error; if (cfg_size < sizeof(cfg)) return -EIO; - error = ds_get_bts_end(child, &end); - if (error < 0) - return error; + memset(&cfg, 0, sizeof(cfg)); - error = ds_access_bts(child, /* index = */ 0, &base); - if (error < 0) - return error; + if (ds) { + cfg.size = ds_get_bts_size(ds); - error = ds_access_bts(child, /* index = */ end, &max); - if (error < 0) - return error; + if (ds_get_overflow(ds) == DS_O_SIGNAL) + cfg.flags |= PTRACE_BTS_O_SIGNAL; - memset(&cfg, 0, sizeof(cfg)); - cfg.size = (max - base); - cfg.signal = child->thread.bts_ovfl_signal; - cfg.bts_size = sizeof(struct bts_struct); + if (test_tsk_thread_flag(child, TIF_DEBUGCTLMSR) && + child->thread.debugctlmsr & ds_debugctl_mask()) + cfg.flags |= PTRACE_BTS_O_TRACE; - if (cfg.signal) - cfg.flags |= PTRACE_BTS_O_SIGNAL; - - if (test_tsk_thread_flag(child, TIF_DEBUGCTLMSR) && - child->thread.debugctlmsr & bts_cfg.debugctl_mask) - cfg.flags |= PTRACE_BTS_O_TRACE; + if (test_tsk_thread_flag(child, TIF_BTS_TRACE_TS)) + cfg.flags |= PTRACE_BTS_O_SCHED; + } - if (test_tsk_thread_flag(child, TIF_BTS_TRACE_TS)) - cfg.flags |= PTRACE_BTS_O_SCHED; + cfg.bts_size = sizeof(struct bts_struct); if (copy_to_user(ucfg, &cfg, sizeof(cfg))) return -EFAULT; @@ -831,38 +744,89 @@ static int ptrace_bts_status(struct task_struct *child, return sizeof(cfg); } + static int ptrace_bts_write_record(struct task_struct *child, const struct bts_struct *in) { - unsigned char bts_record[BTS_MAX_RECORD_SIZE]; + int retval; - BUG_ON(BTS_MAX_RECORD_SIZE < bts_cfg.sizeof_bts); + if (!child->thread.ds_area_msr) + return -ENXIO; - memset(bts_record, 0, bts_cfg.sizeof_bts); - switch (in->qualifier) { - case BTS_INVALID: - break; + retval = ds_write_bts((void *)child->thread.ds_area_msr, in); + if (retval) + return retval; - case BTS_BRANCH: - bts_set(bts_record, bts_from, in->variant.lbr.from_ip); - bts_set(bts_record, bts_to, in->variant.lbr.to_ip); - break; + return sizeof(*in); +} - case BTS_TASK_ARRIVES: - case BTS_TASK_DEPARTS: - bts_set(bts_record, bts_from, bts_escape); - bts_set(bts_record, bts_qual, in->qualifier); - bts_set(bts_record, bts_jiffies, in->variant.jiffies); - break; +static int ptrace_bts_realloc(struct task_struct *child, + int size, int reduce_size) +{ + unsigned long rlim, vm; + int ret, old_size; - default: + if (size < 0) return -EINVAL; + + old_size = ds_get_bts_size((void *)child->thread.ds_area_msr); + if (old_size < 0) + return old_size; + + ret = ds_free((void **)&child->thread.ds_area_msr); + if (ret < 0) + goto out; + + size >>= PAGE_SHIFT; + old_size >>= PAGE_SHIFT; + + current->mm->total_vm -= old_size; + current->mm->locked_vm -= old_size; + + if (size == 0) + goto out; + + rlim = current->signal->rlim[RLIMIT_AS].rlim_cur >> PAGE_SHIFT; + vm = current->mm->total_vm + size; + if (rlim < vm) { + ret = -ENOMEM; + + if (!reduce_size) + goto out; + + size = rlim - current->mm->total_vm; + if (size <= 0) + goto out; + } + + rlim = current->signal->rlim[RLIMIT_MEMLOCK].rlim_cur >> PAGE_SHIFT; + vm = current->mm->locked_vm + size; + if (rlim < vm) { + ret = -ENOMEM; + + if (!reduce_size) + goto out; + + size = rlim - current->mm->locked_vm; + if (size <= 0) + goto out; } - /* The writing task will be the switched-to task on a context - * switch. It needs to write into the switched-from task's BTS - * buffer. */ - return ds_unchecked_write_bts(child, bts_record, bts_cfg.sizeof_bts); + ret = ds_allocate((void **)&child->thread.ds_area_msr, + size << PAGE_SHIFT); + if (ret < 0) + goto out; + + current->mm->total_vm += size; + current->mm->locked_vm += size; + +out: + if (child->thread.ds_area_msr) + set_tsk_thread_flag(child, TIF_DS_AREA_MSR); + else + clear_tsk_thread_flag(child, TIF_DS_AREA_MSR); + + return ret; } void ptrace_bts_take_timestamp(struct task_struct *tsk, @@ -875,66 +839,7 @@ void ptrace_bts_take_timestamp(struct task_struct *tsk, ptrace_bts_write_record(tsk, &rec); } - -static const struct bts_configuration bts_cfg_netburst = { - .sizeof_bts = sizeof(long) * 3, - .sizeof_field = sizeof(long), - .debugctl_mask = (1<<2)|(1<<3)|(1<<5) -}; - -static const struct bts_configuration bts_cfg_pentium_m = { - .sizeof_bts = sizeof(long) * 3, - .sizeof_field = sizeof(long), - .debugctl_mask = (1<<6)|(1<<7) -}; - -static const struct bts_configuration bts_cfg_core2 = { - .sizeof_bts = 8 * 3, - .sizeof_field = 8, - .debugctl_mask = (1<<6)|(1<<7)|(1<<9) -}; - -static inline void bts_configure(const struct bts_configuration *cfg) -{ - bts_cfg = *cfg; -} - -void __cpuinit ptrace_bts_init_intel(struct cpuinfo_x86 *c) -{ - switch (c->x86) { - case 0x6: - switch (c->x86_model) { - case 0xD: - case 0xE: /* Pentium M */ - bts_configure(&bts_cfg_pentium_m); - break; - case 0xF: /* Core2 */ - case 0x1C: /* Atom */ - bts_configure(&bts_cfg_core2); - break; - default: - /* sorry, don't know about them */ - break; - } - break; - case 0xF: - switch (c->x86_model) { - case 0x0: - case 0x1: - case 0x2: /* Netburst */ - bts_configure(&bts_cfg_netburst); - break; - default: - /* sorry, don't know about them */ - break; - } - break; - default: - /* sorry, don't know about them */ - break; - } -} -#endif /* CONFIG_X86_PTRACE_BTS */ +#endif /* X86_BTS */ /* * Called by kernel/ptrace.c when detaching.. @@ -947,15 +852,15 @@ void ptrace_disable(struct task_struct *child) #ifdef TIF_SYSCALL_EMU clear_tsk_thread_flag(child, TIF_SYSCALL_EMU); #endif -#ifdef CONFIG_X86_PTRACE_BTS - (void)ds_release_bts(child); - - child->thread.debugctlmsr &= ~bts_cfg.debugctl_mask; - if (!child->thread.debugctlmsr) - clear_tsk_thread_flag(child, TIF_DEBUGCTLMSR); - - clear_tsk_thread_flag(child, TIF_BTS_TRACE_TS); -#endif /* CONFIG_X86_PTRACE_BTS */ + if (child->thread.ds_area_msr) { +#ifdef X86_BTS + ptrace_bts_realloc(child, 0, 0); +#endif + child->thread.debugctlmsr &= ~ds_debugctl_mask(); + if (!child->thread.debugctlmsr) + clear_tsk_thread_flag(child, TIF_DEBUGCTLMSR); + clear_tsk_thread_flag(child, TIF_BTS_TRACE_TS); + } } #if defined CONFIG_X86_32 || defined CONFIG_IA32_EMULATION @@ -1075,7 +980,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) /* * These bits need more cooking - not enabled yet: */ -#ifdef CONFIG_X86_PTRACE_BTS +#ifdef X86_BTS case PTRACE_BTS_CONFIG: ret = ptrace_bts_config (child, data, (struct ptrace_bts_config __user *)addr); @@ -1087,7 +992,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) break; case PTRACE_BTS_SIZE: - ret = ds_get_bts_index(child, /* pos = */ NULL); + ret = ptrace_bts_get_size(child); break; case PTRACE_BTS_GET: @@ -1096,14 +1001,14 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) break; case PTRACE_BTS_CLEAR: - ret = ds_clear_bts(child); + ret = ptrace_bts_clear(child); break; case PTRACE_BTS_DRAIN: ret = ptrace_bts_drain (child, data, (struct bts_struct __user *) addr); break; -#endif /* CONFIG_X86_PTRACE_BTS */ +#endif default: ret = ptrace_request(child, request, addr, data); @@ -1470,6 +1375,30 @@ void send_sigtrap(struct task_struct *tsk, struct pt_regs *regs, int error_code) force_sig_info(SIGTRAP, &info, tsk); } +static void syscall_trace(struct pt_regs *regs) +{ + if (!(current->ptrace & PT_PTRACED)) + return; + +#if 0 + printk("trace %s ip %lx sp %lx ax %d origrax %d caller %lx tiflags %x ptrace %x\n", + current->comm, + regs->ip, regs->sp, regs->ax, regs->orig_ax, __builtin_return_address(0), + current_thread_info()->flags, current->ptrace); +#endif + + ptrace_notify(SIGTRAP | ((current->ptrace & PT_TRACESYSGOOD) + ? 0x80 : 0)); + /* + * this isn't the same as continuing with a signal, but it will do + * for normal use. strace only continues with a signal if the + * stopping signal is not SIGTRAP. -brl + */ + if (current->exit_code) { + send_sig(current->exit_code, current, 1); + current->exit_code = 0; + } +} #ifdef CONFIG_X86_32 # define IS_IA32 1 @@ -1503,9 +1432,8 @@ asmregparm long syscall_trace_enter(struct pt_regs *regs) if (unlikely(test_thread_flag(TIF_SYSCALL_EMU))) ret = -1L; - if ((ret || test_thread_flag(TIF_SYSCALL_TRACE)) && - tracehook_report_syscall_entry(regs)) - ret = -1L; + if (ret || test_thread_flag(TIF_SYSCALL_TRACE)) + syscall_trace(regs); if (unlikely(current->audit_context)) { if (IS_IA32) @@ -1531,7 +1459,7 @@ asmregparm void syscall_trace_leave(struct pt_regs *regs) audit_syscall_exit(AUDITSC_RESULT(regs->ax), regs->ax); if (test_thread_flag(TIF_SYSCALL_TRACE)) - tracehook_report_syscall_exit(regs, 0); + syscall_trace(regs); /* * If TIF_SYSCALL_EMU is set, we only get here because of @@ -1547,6 +1475,6 @@ asmregparm void syscall_trace_leave(struct pt_regs *regs) * system call instruction. */ if (test_thread_flag(TIF_SINGLESTEP) && - tracehook_consider_fatal_signal(current, SIGTRAP, SIG_DFL)) + (current->ptrace & PT_PTRACED)) send_sigtrap(current, regs, 0); } diff --git a/trunk/arch/x86/kernel/reboot.c b/trunk/arch/x86/kernel/reboot.c index f4c93f1cfc19..724adfc63cb9 100644 --- a/trunk/arch/x86/kernel/reboot.c +++ b/trunk/arch/x86/kernel/reboot.c @@ -29,11 +29,7 @@ EXPORT_SYMBOL(pm_power_off); static const struct desc_ptr no_idt = {}; static int reboot_mode; -/* - * Keyboard reset and triple fault may result in INIT, not RESET, which - * doesn't work when we're in vmx root mode. Try ACPI first. - */ -enum reboot_type reboot_type = BOOT_ACPI; +enum reboot_type reboot_type = BOOT_KBD; int reboot_force; #if defined(CONFIG_X86_32) && defined(CONFIG_SMP) diff --git a/trunk/arch/x86/kernel/setup.c b/trunk/arch/x86/kernel/setup.c index 141efab52400..9838f2539dfc 100644 --- a/trunk/arch/x86/kernel/setup.c +++ b/trunk/arch/x86/kernel/setup.c @@ -223,9 +223,6 @@ unsigned long saved_video_mode; #define RAMDISK_LOAD_FLAG 0x4000 static char __initdata command_line[COMMAND_LINE_SIZE]; -#ifdef CONFIG_CMDLINE_BOOL -static char __initdata builtin_cmdline[COMMAND_LINE_SIZE] = CONFIG_CMDLINE; -#endif #if defined(CONFIG_EDD) || defined(CONFIG_EDD_MODULE) struct edd edd; @@ -668,19 +665,6 @@ void __init setup_arch(char **cmdline_p) bss_resource.start = virt_to_phys(&__bss_start); bss_resource.end = virt_to_phys(&__bss_stop)-1; -#ifdef CONFIG_CMDLINE_BOOL -#ifdef CONFIG_CMDLINE_OVERRIDE - strlcpy(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE); -#else - if (builtin_cmdline[0]) { - /* append boot loader cmdline to builtin */ - strlcat(builtin_cmdline, " ", COMMAND_LINE_SIZE); - strlcat(builtin_cmdline, boot_command_line, COMMAND_LINE_SIZE); - strlcpy(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE); - } -#endif -#endif - strlcpy(command_line, boot_command_line, COMMAND_LINE_SIZE); *cmdline_p = command_line; diff --git a/trunk/arch/x86/kernel/setup_percpu.c b/trunk/arch/x86/kernel/setup_percpu.c index 0e67f72d9316..76e305e064f9 100644 --- a/trunk/arch/x86/kernel/setup_percpu.c +++ b/trunk/arch/x86/kernel/setup_percpu.c @@ -162,16 +162,9 @@ void __init setup_per_cpu_areas(void) printk(KERN_INFO "cpu %d has no node %d or node-local memory\n", cpu, node); - if (ptr) - printk(KERN_DEBUG "per cpu data for cpu%d at %016lx\n", - cpu, __pa(ptr)); } - else { + else ptr = alloc_bootmem_pages_node(NODE_DATA(node), size); - if (ptr) - printk(KERN_DEBUG "per cpu data for cpu%d on node%d at %016lx\n", - cpu, node, __pa(ptr)); - } #endif per_cpu_offset(cpu) = ptr - __per_cpu_start; memcpy(ptr, __per_cpu_start, __per_cpu_end - __per_cpu_start); diff --git a/trunk/arch/x86/kernel/sigframe.h b/trunk/arch/x86/kernel/sigframe.h index 8b4956e800ac..72bbb519d2dc 100644 --- a/trunk/arch/x86/kernel/sigframe.h +++ b/trunk/arch/x86/kernel/sigframe.h @@ -24,9 +24,4 @@ struct rt_sigframe { struct ucontext uc; struct siginfo info; }; - -int ia32_setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, - sigset_t *set, struct pt_regs *regs); -int ia32_setup_frame(int sig, struct k_sigaction *ka, - sigset_t *set, struct pt_regs *regs); #endif diff --git a/trunk/arch/x86/kernel/signal_32.c b/trunk/arch/x86/kernel/signal_32.c index 2a2435d3037d..6fb5bcdd8933 100644 --- a/trunk/arch/x86/kernel/signal_32.c +++ b/trunk/arch/x86/kernel/signal_32.c @@ -17,7 +17,6 @@ #include #include #include -#include #include #include #include @@ -27,7 +26,6 @@ #include #include #include -#include #include "sigframe.h" @@ -560,6 +558,8 @@ handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka, * handler too. */ regs->flags &= ~X86_EFLAGS_TF; + if (test_thread_flag(TIF_SINGLESTEP)) + ptrace_notify(SIGTRAP); spin_lock_irq(¤t->sighand->siglock); sigorsets(¤t->blocked, ¤t->blocked, &ka->sa.sa_mask); @@ -568,9 +568,6 @@ handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka, recalc_sigpending(); spin_unlock_irq(¤t->sighand->siglock); - tracehook_signal_handler(sig, info, ka, regs, - test_thread_flag(TIF_SINGLESTEP)); - return 0; } @@ -664,10 +661,5 @@ do_notify_resume(struct pt_regs *regs, void *unused, __u32 thread_info_flags) if (thread_info_flags & _TIF_SIGPENDING) do_signal(regs); - if (thread_info_flags & _TIF_NOTIFY_RESUME) { - clear_thread_flag(TIF_NOTIFY_RESUME); - tracehook_notify_resume(regs); - } - clear_thread_flag(TIF_IRET); } diff --git a/trunk/arch/x86/kernel/signal_64.c b/trunk/arch/x86/kernel/signal_64.c index 694aa888bb19..ca316b5b742c 100644 --- a/trunk/arch/x86/kernel/signal_64.c +++ b/trunk/arch/x86/kernel/signal_64.c @@ -15,21 +15,17 @@ #include #include #include -#include #include #include #include #include -#include - #include #include +#include #include #include #include #include -#include -#include #include "sigframe.h" #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) @@ -45,6 +41,11 @@ # define FIX_EFLAGS __FIX_EFLAGS #endif +int ia32_setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, + sigset_t *set, struct pt_regs * regs); +int ia32_setup_frame(int sig, struct k_sigaction *ka, + sigset_t *set, struct pt_regs * regs); + asmlinkage long sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss, struct pt_regs *regs) @@ -127,7 +128,7 @@ restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc, /* Always make any pending restarted system calls return -EINTR */ current_thread_info()->restart_block.fn = do_no_restart_syscall; -#define COPY(x) (err |= __get_user(regs->x, &sc->x)) +#define COPY(x) err |= __get_user(regs->x, &sc->x) COPY(di); COPY(si); COPY(bp); COPY(sp); COPY(bx); COPY(dx); COPY(cx); COPY(ip); @@ -157,7 +158,7 @@ restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc, } { - struct _fpstate __user *buf; + struct _fpstate __user * buf; err |= __get_user(buf, &sc->fpstate); if (buf) { @@ -197,7 +198,7 @@ asmlinkage long sys_rt_sigreturn(struct pt_regs *regs) current->blocked = set; recalc_sigpending(); spin_unlock_irq(¤t->sighand->siglock); - + if (restore_sigcontext(regs, &frame->uc.uc_mcontext, &ax)) goto badframe; @@ -207,17 +208,16 @@ asmlinkage long sys_rt_sigreturn(struct pt_regs *regs) return ax; badframe: - signal_fault(regs, frame, "sigreturn"); + signal_fault(regs,frame,"sigreturn"); return 0; -} +} /* * Set up a signal frame. */ static inline int -setup_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs, - unsigned long mask, struct task_struct *me) +setup_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs, unsigned long mask, struct task_struct *me) { int err = 0; @@ -273,35 +273,35 @@ get_stack(struct k_sigaction *ka, struct pt_regs *regs, unsigned long size) } static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, - sigset_t *set, struct pt_regs *regs) + sigset_t *set, struct pt_regs * regs) { struct rt_sigframe __user *frame; - struct _fpstate __user *fp = NULL; + struct _fpstate __user *fp = NULL; int err = 0; struct task_struct *me = current; if (used_math()) { - fp = get_stack(ka, regs, sizeof(struct _fpstate)); + fp = get_stack(ka, regs, sizeof(struct _fpstate)); frame = (void __user *)round_down( (unsigned long)fp - sizeof(struct rt_sigframe), 16) - 8; if (!access_ok(VERIFY_WRITE, fp, sizeof(struct _fpstate))) goto give_sigsegv; - if (save_i387(fp) < 0) - err |= -1; + if (save_i387(fp) < 0) + err |= -1; } else frame = get_stack(ka, regs, sizeof(struct rt_sigframe)) - 8; if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) goto give_sigsegv; - if (ka->sa.sa_flags & SA_SIGINFO) { + if (ka->sa.sa_flags & SA_SIGINFO) { err |= copy_siginfo_to_user(&frame->info, info); if (err) goto give_sigsegv; } - + /* Create the ucontext. */ err |= __put_user(0, &frame->uc.uc_flags); err |= __put_user(0, &frame->uc.uc_link); @@ -311,9 +311,9 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, err |= __put_user(me->sas_ss_size, &frame->uc.uc_stack.ss_size); err |= setup_sigcontext(&frame->uc.uc_mcontext, regs, set->sig[0], me); err |= __put_user(fp, &frame->uc.uc_mcontext.fpstate); - if (sizeof(*set) == 16) { + if (sizeof(*set) == 16) { __put_user(set->sig[0], &frame->uc.uc_sigmask.sig[0]); - __put_user(set->sig[1], &frame->uc.uc_sigmask.sig[1]); + __put_user(set->sig[1], &frame->uc.uc_sigmask.sig[1]); } else err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set)); @@ -324,7 +324,7 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, err |= __put_user(ka->sa.sa_restorer, &frame->pretcode); } else { /* could use a vstub here */ - goto give_sigsegv; + goto give_sigsegv; } if (err) @@ -332,7 +332,7 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, /* Set up registers for signal handler */ regs->di = sig; - /* In case the signal handler was declared without prototypes */ + /* In case the signal handler was declared without prototypes */ regs->ax = 0; /* This also works for non SA_SIGINFO handlers because they expect the @@ -355,8 +355,37 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, } /* - * OK, we're invoking a handler + * Return -1L or the syscall number that @regs is executing. */ +static long current_syscall(struct pt_regs *regs) +{ + /* + * We always sign-extend a -1 value being set here, + * so this is always either -1L or a syscall number. + */ + return regs->orig_ax; +} + +/* + * Return a value that is -EFOO if the system call in @regs->orig_ax + * returned an error. This only works for @regs from @current. + */ +static long current_syscall_ret(struct pt_regs *regs) +{ +#ifdef CONFIG_IA32_EMULATION + if (test_thread_flag(TIF_IA32)) + /* + * Sign-extend the value so (int)-EFOO becomes (long)-EFOO + * and will match correctly in comparisons. + */ + return (int) regs->ax; +#endif + return regs->ax; +} + +/* + * OK, we're invoking a handler + */ static int handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka, @@ -365,9 +394,9 @@ handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka, int ret; /* Are we from a system call? */ - if (syscall_get_nr(current, regs) >= 0) { + if (current_syscall(regs) >= 0) { /* If so, check system call restarting.. */ - switch (syscall_get_error(current, regs)) { + switch (current_syscall_ret(regs)) { case -ERESTART_RESTARTBLOCK: case -ERESTARTNOHAND: regs->ax = -EINTR; @@ -400,7 +429,7 @@ handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka, ret = ia32_setup_rt_frame(sig, ka, info, oldset, regs); else ret = ia32_setup_frame(sig, ka, oldset, regs); - } else + } else #endif ret = setup_rt_frame(sig, ka, info, oldset, regs); @@ -424,16 +453,15 @@ handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka, * handler too. */ regs->flags &= ~X86_EFLAGS_TF; + if (test_thread_flag(TIF_SINGLESTEP)) + ptrace_notify(SIGTRAP); spin_lock_irq(¤t->sighand->siglock); - sigorsets(¤t->blocked, ¤t->blocked, &ka->sa.sa_mask); + sigorsets(¤t->blocked,¤t->blocked,&ka->sa.sa_mask); if (!(ka->sa.sa_flags & SA_NODEFER)) - sigaddset(¤t->blocked, sig); + sigaddset(¤t->blocked,sig); recalc_sigpending(); spin_unlock_irq(¤t->sighand->siglock); - - tracehook_signal_handler(sig, info, ka, regs, - test_thread_flag(TIF_SINGLESTEP)); } return ret; @@ -490,9 +518,9 @@ static void do_signal(struct pt_regs *regs) } /* Did we come from a system call? */ - if (syscall_get_nr(current, regs) >= 0) { + if (current_syscall(regs) >= 0) { /* Restart the system call - no handlers present */ - switch (syscall_get_error(current, regs)) { + switch (current_syscall_ret(regs)) { case -ERESTARTNOHAND: case -ERESTARTSYS: case -ERESTARTNOINTR: @@ -530,23 +558,17 @@ void do_notify_resume(struct pt_regs *regs, void *unused, /* deal with pending signal delivery */ if (thread_info_flags & _TIF_SIGPENDING) do_signal(regs); - - if (thread_info_flags & _TIF_NOTIFY_RESUME) { - clear_thread_flag(TIF_NOTIFY_RESUME); - tracehook_notify_resume(regs); - } } void signal_fault(struct pt_regs *regs, void __user *frame, char *where) -{ - struct task_struct *me = current; +{ + struct task_struct *me = current; if (show_unhandled_signals && printk_ratelimit()) { printk("%s[%d] bad frame in %s frame:%p ip:%lx sp:%lx orax:%lx", - me->comm, me->pid, where, frame, regs->ip, - regs->sp, regs->orig_ax); + me->comm,me->pid,where,frame,regs->ip,regs->sp,regs->orig_ax); print_vma_addr(" in ", regs->ip); printk("\n"); } - force_sig(SIGSEGV, me); -} + force_sig(SIGSEGV, me); +} diff --git a/trunk/arch/x86/kernel/smpboot.c b/trunk/arch/x86/kernel/smpboot.c index 45531e3ba194..7985c5b3f916 100644 --- a/trunk/arch/x86/kernel/smpboot.c +++ b/trunk/arch/x86/kernel/smpboot.c @@ -88,7 +88,7 @@ static DEFINE_PER_CPU(struct task_struct *, idle_thread_array); #define get_idle_for_cpu(x) (per_cpu(idle_thread_array, x)) #define set_idle_for_cpu(x, p) (per_cpu(idle_thread_array, x) = (p)) #else -static struct task_struct *idle_thread_array[NR_CPUS] __cpuinitdata ; +struct task_struct *idle_thread_array[NR_CPUS] __cpuinitdata ; #define get_idle_for_cpu(x) (idle_thread_array[(x)]) #define set_idle_for_cpu(x, p) (idle_thread_array[(x)] = (p)) #endif @@ -129,7 +129,7 @@ static int boot_cpu_logical_apicid; static cpumask_t cpu_sibling_setup_map; /* Set if we find a B stepping CPU */ -static int __cpuinitdata smp_b_stepping; +int __cpuinitdata smp_b_stepping; #if defined(CONFIG_NUMA) && defined(CONFIG_X86_32) @@ -1313,13 +1313,16 @@ __init void prefill_possible_map(void) if (!num_processors) num_processors = 1; +#ifdef CONFIG_HOTPLUG_CPU if (additional_cpus == -1) { if (disabled_cpus > 0) additional_cpus = disabled_cpus; else additional_cpus = 0; } - +#else + additional_cpus = 0; +#endif possible = num_processors + additional_cpus; if (possible > NR_CPUS) possible = NR_CPUS; diff --git a/trunk/arch/x86/kernel/sys_i386_32.c b/trunk/arch/x86/kernel/sys_i386_32.c index 1884a8d12bfa..7066cb855a60 100644 --- a/trunk/arch/x86/kernel/sys_i386_32.c +++ b/trunk/arch/x86/kernel/sys_i386_32.c @@ -22,8 +22,6 @@ #include #include -#include - asmlinkage long sys_mmap2(unsigned long addr, unsigned long len, unsigned long prot, unsigned long flags, unsigned long fd, unsigned long pgoff) diff --git a/trunk/arch/x86/kernel/sys_x86_64.c b/trunk/arch/x86/kernel/sys_x86_64.c index 6bc211accf08..3b360ef33817 100644 --- a/trunk/arch/x86/kernel/sys_x86_64.c +++ b/trunk/arch/x86/kernel/sys_x86_64.c @@ -13,17 +13,15 @@ #include #include #include -#include +#include #include -#include -asmlinkage long sys_mmap(unsigned long addr, unsigned long len, - unsigned long prot, unsigned long flags, - unsigned long fd, unsigned long off) +asmlinkage long sys_mmap(unsigned long addr, unsigned long len, unsigned long prot, unsigned long flags, + unsigned long fd, unsigned long off) { long error; - struct file *file; + struct file * file; error = -EINVAL; if (off & ~PAGE_MASK) @@ -58,9 +56,9 @@ static void find_start_end(unsigned long flags, unsigned long *begin, unmapped base down for this case. This can give conflicts with the heap, but we assume that glibc malloc knows how to fall back to mmap. Give it 1GB - of playground for now. -AK */ - *begin = 0x40000000; - *end = 0x80000000; + of playground for now. -AK */ + *begin = 0x40000000; + *end = 0x80000000; if (current->flags & PF_RANDOMIZE) { new_begin = randomize_range(*begin, *begin + 0x02000000, 0); if (new_begin) @@ -68,9 +66,9 @@ static void find_start_end(unsigned long flags, unsigned long *begin, } } else { *begin = TASK_UNMAPPED_BASE; - *end = TASK_SIZE; + *end = TASK_SIZE; } -} +} unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, @@ -80,11 +78,11 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr, struct vm_area_struct *vma; unsigned long start_addr; unsigned long begin, end; - + if (flags & MAP_FIXED) return addr; - find_start_end(flags, &begin, &end); + find_start_end(flags, &begin, &end); if (len > end) return -ENOMEM; @@ -98,12 +96,12 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr, } if (((flags & MAP_32BIT) || test_thread_flag(TIF_IA32)) && len <= mm->cached_hole_size) { - mm->cached_hole_size = 0; + mm->cached_hole_size = 0; mm->free_area_cache = begin; } addr = mm->free_area_cache; - if (addr < begin) - addr = begin; + if (addr < begin) + addr = begin; start_addr = addr; full_search: @@ -129,7 +127,7 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr, return addr; } if (addr + mm->cached_hole_size < vma->vm_start) - mm->cached_hole_size = vma->vm_start - addr; + mm->cached_hole_size = vma->vm_start - addr; addr = vma->vm_end; } @@ -179,7 +177,7 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0, vma = find_vma(mm, addr-len); if (!vma || addr <= vma->vm_start) /* remember the address as a hint for next time */ - return mm->free_area_cache = addr-len; + return (mm->free_area_cache = addr-len); } if (mm->mmap_base < len) @@ -196,7 +194,7 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0, vma = find_vma(mm, addr); if (!vma || addr+len <= vma->vm_start) /* remember the address as a hint for next time */ - return mm->free_area_cache = addr; + return (mm->free_area_cache = addr); /* remember the largest hole we saw so far */ if (addr + mm->cached_hole_size < vma->vm_start) @@ -226,13 +224,13 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0, } -asmlinkage long sys_uname(struct new_utsname __user *name) +asmlinkage long sys_uname(struct new_utsname __user * name) { int err; down_read(&uts_sem); - err = copy_to_user(name, utsname(), sizeof(*name)); + err = copy_to_user(name, utsname(), sizeof (*name)); up_read(&uts_sem); - if (personality(current->personality) == PER_LINUX32) - err |= copy_to_user(&name->machine, "i686", 5); + if (personality(current->personality) == PER_LINUX32) + err |= copy_to_user(&name->machine, "i686", 5); return err ? -EFAULT : 0; } diff --git a/trunk/arch/x86/kernel/syscall_64.c b/trunk/arch/x86/kernel/syscall_64.c index 3d1be4f0fac5..170d43c17487 100644 --- a/trunk/arch/x86/kernel/syscall_64.c +++ b/trunk/arch/x86/kernel/syscall_64.c @@ -8,12 +8,12 @@ #define __NO_STUBS #define __SYSCALL(nr, sym) extern asmlinkage void sym(void) ; -#undef ASM_X86__UNISTD_64_H +#undef _ASM_X86_64_UNISTD_H_ #include #undef __SYSCALL #define __SYSCALL(nr, sym) [nr] = sym, -#undef ASM_X86__UNISTD_64_H +#undef _ASM_X86_64_UNISTD_H_ typedef void (*sys_call_ptr_t)(void); diff --git a/trunk/arch/x86/kernel/time_32.c b/trunk/arch/x86/kernel/time_32.c index bbecf8b6bf96..ffe3c664afc0 100644 --- a/trunk/arch/x86/kernel/time_32.c +++ b/trunk/arch/x86/kernel/time_32.c @@ -36,7 +36,6 @@ #include #include #include -#include #include "do_timer.h" diff --git a/trunk/arch/x86/kernel/tls.c b/trunk/arch/x86/kernel/tls.c index 6bb7b8579e70..ab6bf375a307 100644 --- a/trunk/arch/x86/kernel/tls.c +++ b/trunk/arch/x86/kernel/tls.c @@ -10,7 +10,6 @@ #include #include #include -#include #include "tls.h" diff --git a/trunk/arch/x86/kernel/traps_64.c b/trunk/arch/x86/kernel/traps_64.c index 7a31f104bef9..513caaca7115 100644 --- a/trunk/arch/x86/kernel/traps_64.c +++ b/trunk/arch/x86/kernel/traps_64.c @@ -32,8 +32,6 @@ #include #include #include -#include -#include #if defined(CONFIG_EDAC) #include @@ -47,6 +45,9 @@ #include #include #include +#include +#include +#include #include #include #include @@ -84,8 +85,7 @@ static inline void preempt_conditional_cli(struct pt_regs *regs) void printk_address(unsigned long address, int reliable) { - printk(" [<%016lx>] %s%pS\n", - address, reliable ? "" : "? ", (void *) address); + printk(" [<%016lx>] %s%pS\n", address, reliable ? "": "? ", (void *) address); } static unsigned long *in_exception_stack(unsigned cpu, unsigned long stack, @@ -98,8 +98,7 @@ static unsigned long *in_exception_stack(unsigned cpu, unsigned long stack, [STACKFAULT_STACK - 1] = "#SS", [MCE_STACK - 1] = "#MC", #if DEBUG_STKSZ > EXCEPTION_STKSZ - [N_EXCEPTION_STACKS ... - N_EXCEPTION_STACKS + DEBUG_STKSZ / EXCEPTION_STKSZ - 2] = "#DB[?]" + [N_EXCEPTION_STACKS ... N_EXCEPTION_STACKS + DEBUG_STKSZ / EXCEPTION_STKSZ - 2] = "#DB[?]" #endif }; unsigned k; @@ -164,7 +163,7 @@ static unsigned long *in_exception_stack(unsigned cpu, unsigned long stack, } /* - * x86-64 can have up to three kernel stacks: + * x86-64 can have up to three kernel stacks: * process stack * interrupt stack * severe exception (double fault, nmi, stack fault, debug, mce) hardware stack @@ -220,7 +219,7 @@ void dump_trace(struct task_struct *task, struct pt_regs *regs, const struct stacktrace_ops *ops, void *data) { const unsigned cpu = get_cpu(); - unsigned long *irqstack_end = (unsigned long *)cpu_pda(cpu)->irqstackptr; + unsigned long *irqstack_end = (unsigned long*)cpu_pda(cpu)->irqstackptr; unsigned used = 0; struct thread_info *tinfo; @@ -238,7 +237,7 @@ void dump_trace(struct task_struct *task, struct pt_regs *regs, if (!bp) { if (task == current) { /* Grab bp right from our regs */ - asm("movq %%rbp, %0" : "=r" (bp) : ); + asm("movq %%rbp, %0" : "=r" (bp) :); } else { /* bp is the last reg pushed by switch_to */ bp = *(unsigned long *) task->thread.sp; @@ -340,8 +339,9 @@ static void show_trace_log_lvl(struct task_struct *task, struct pt_regs *regs, unsigned long *stack, unsigned long bp, char *log_lvl) { - printk("Call Trace:\n"); + printk("\nCall Trace:\n"); dump_trace(task, regs, stack, bp, &print_trace_ops, log_lvl); + printk("\n"); } void show_trace(struct task_struct *task, struct pt_regs *regs, @@ -357,15 +357,11 @@ show_stack_log_lvl(struct task_struct *task, struct pt_regs *regs, unsigned long *stack; int i; const int cpu = smp_processor_id(); - unsigned long *irqstack_end = - (unsigned long *) (cpu_pda(cpu)->irqstackptr); - unsigned long *irqstack = - (unsigned long *) (cpu_pda(cpu)->irqstackptr - IRQSTACKSIZE); + unsigned long *irqstack_end = (unsigned long *) (cpu_pda(cpu)->irqstackptr); + unsigned long *irqstack = (unsigned long *) (cpu_pda(cpu)->irqstackptr - IRQSTACKSIZE); - /* - * debugging aid: "show_stack(NULL, NULL);" prints the - * back trace for this cpu. - */ + // debugging aid: "show_stack(NULL, NULL);" prints the + // back trace for this cpu. if (sp == NULL) { if (task) @@ -390,7 +386,6 @@ show_stack_log_lvl(struct task_struct *task, struct pt_regs *regs, printk(" %016lx", *stack++); touch_nmi_watchdog(); } - printk("\n"); show_trace_log_lvl(task, regs, sp, bp, log_lvl); } @@ -409,7 +404,7 @@ void dump_stack(void) #ifdef CONFIG_FRAME_POINTER if (!bp) - asm("movq %%rbp, %0" : "=r" (bp) : ); + asm("movq %%rbp, %0" : "=r" (bp):); #endif printk("Pid: %d, comm: %.20s %s %s %.*s\n", @@ -419,6 +414,7 @@ void dump_stack(void) init_utsname()->version); show_trace(NULL, NULL, &stack, bp); } + EXPORT_SYMBOL(dump_stack); void show_registers(struct pt_regs *regs) @@ -447,6 +443,7 @@ void show_registers(struct pt_regs *regs) printk("Stack: "); show_stack_log_lvl(NULL, regs, (unsigned long *)sp, regs->bp, ""); + printk("\n"); printk(KERN_EMERG "Code: "); @@ -496,7 +493,7 @@ unsigned __kprobes long oops_begin(void) raw_local_irq_save(flags); cpu = smp_processor_id(); if (!__raw_spin_trylock(&die_lock)) { - if (cpu == die_owner) + if (cpu == die_owner) /* nested oops. should stop eventually */; else __raw_spin_lock(&die_lock); @@ -641,7 +638,7 @@ do_trap(int trapnr, int signr, char *str, struct pt_regs *regs, } #define DO_ERROR(trapnr, signr, str, name) \ -asmlinkage void do_##name(struct pt_regs *regs, long error_code) \ +asmlinkage void do_##name(struct pt_regs * regs, long error_code) \ { \ if (notify_die(DIE_TRAP, str, regs, error_code, trapnr, signr) \ == NOTIFY_STOP) \ @@ -651,7 +648,7 @@ asmlinkage void do_##name(struct pt_regs *regs, long error_code) \ } #define DO_ERROR_INFO(trapnr, signr, str, name, sicode, siaddr) \ -asmlinkage void do_##name(struct pt_regs *regs, long error_code) \ +asmlinkage void do_##name(struct pt_regs * regs, long error_code) \ { \ siginfo_t info; \ info.si_signo = signr; \ @@ -686,7 +683,7 @@ asmlinkage void do_stack_segment(struct pt_regs *regs, long error_code) preempt_conditional_cli(regs); } -asmlinkage void do_double_fault(struct pt_regs *regs, long error_code) +asmlinkage void do_double_fault(struct pt_regs * regs, long error_code) { static const char str[] = "double fault"; struct task_struct *tsk = current; @@ -781,10 +778,9 @@ io_check_error(unsigned char reason, struct pt_regs *regs) } static notrace __kprobes void -unknown_nmi_error(unsigned char reason, struct pt_regs *regs) +unknown_nmi_error(unsigned char reason, struct pt_regs * regs) { - if (notify_die(DIE_NMIUNKNOWN, "nmi", regs, reason, 2, SIGINT) == - NOTIFY_STOP) + if (notify_die(DIE_NMIUNKNOWN, "nmi", regs, reason, 2, SIGINT) == NOTIFY_STOP) return; printk(KERN_EMERG "Uhhuh. NMI received for unknown reason %02x.\n", reason); @@ -886,7 +882,7 @@ asmlinkage __kprobes struct pt_regs *sync_regs(struct pt_regs *eregs) else if (user_mode(eregs)) regs = task_pt_regs(current); /* Exception from kernel and interrupts are enabled. Move to - kernel process stack. */ + kernel process stack. */ else if (eregs->flags & X86_EFLAGS_IF) regs = (struct pt_regs *)(eregs->sp -= sizeof(struct pt_regs)); if (eregs != regs) @@ -895,7 +891,7 @@ asmlinkage __kprobes struct pt_regs *sync_regs(struct pt_regs *eregs) } /* runs on IST stack. */ -asmlinkage void __kprobes do_debug(struct pt_regs *regs, +asmlinkage void __kprobes do_debug(struct pt_regs * regs, unsigned long error_code) { struct task_struct *tsk = current; @@ -1039,7 +1035,7 @@ asmlinkage void do_coprocessor_error(struct pt_regs *regs) asmlinkage void bad_intr(void) { - printk("bad interrupt"); + printk("bad interrupt"); } asmlinkage void do_simd_coprocessor_error(struct pt_regs *regs) @@ -1051,7 +1047,7 @@ asmlinkage void do_simd_coprocessor_error(struct pt_regs *regs) conditional_sti(regs); if (!user_mode(regs) && - kernel_math_error(regs, "kernel simd math error", 19)) + kernel_math_error(regs, "kernel simd math error", 19)) return; /* @@ -1096,7 +1092,7 @@ asmlinkage void do_simd_coprocessor_error(struct pt_regs *regs) force_sig_info(SIGFPE, &info, task); } -asmlinkage void do_spurious_interrupt_bug(struct pt_regs *regs) +asmlinkage void do_spurious_interrupt_bug(struct pt_regs * regs) { } @@ -1153,10 +1149,8 @@ void __init trap_init(void) set_intr_gate(0, ÷_error); set_intr_gate_ist(1, &debug, DEBUG_STACK); set_intr_gate_ist(2, &nmi, NMI_STACK); - /* int3 can be called from all */ - set_system_gate_ist(3, &int3, DEBUG_STACK); - /* int4 can be called from all */ - set_system_gate(4, &overflow); + set_system_gate_ist(3, &int3, DEBUG_STACK); /* int3 can be called from all */ + set_system_gate(4, &overflow); /* int4 can be called from all */ set_intr_gate(5, &bounds); set_intr_gate(6, &invalid_op); set_intr_gate(7, &device_not_available); diff --git a/trunk/arch/x86/kernel/tsc.c b/trunk/arch/x86/kernel/tsc.c index 161bb850fc47..8f98e9de1b82 100644 --- a/trunk/arch/x86/kernel/tsc.c +++ b/trunk/arch/x86/kernel/tsc.c @@ -104,7 +104,7 @@ __setup("notsc", notsc_setup); /* * Read TSC and the reference counters. Take care of SMI disturbance */ -static u64 tsc_read_refs(u64 *p, int hpet) +static u64 tsc_read_refs(u64 *pm, u64 *hpet) { u64 t1, t2; int i; @@ -112,9 +112,9 @@ static u64 tsc_read_refs(u64 *p, int hpet) for (i = 0; i < MAX_RETRIES; i++) { t1 = get_cycles(); if (hpet) - *p = hpet_readl(HPET_COUNTER) & 0xFFFFFFFF; + *hpet = hpet_readl(HPET_COUNTER) & 0xFFFFFFFF; else - *p = acpi_pm_read_early(); + *pm = acpi_pm_read_early(); t2 = get_cycles(); if ((t2 - t1) < SMI_TRESHOLD) return t2; @@ -122,52 +122,6 @@ static u64 tsc_read_refs(u64 *p, int hpet) return ULLONG_MAX; } -/* - * Calculate the TSC frequency from HPET reference - */ -static unsigned long calc_hpet_ref(u64 deltatsc, u64 hpet1, u64 hpet2) -{ - u64 tmp; - - if (hpet2 < hpet1) - hpet2 += 0x100000000ULL; - hpet2 -= hpet1; - tmp = ((u64)hpet2 * hpet_readl(HPET_PERIOD)); - do_div(tmp, 1000000); - do_div(deltatsc, tmp); - - return (unsigned long) deltatsc; -} - -/* - * Calculate the TSC frequency from PMTimer reference - */ -static unsigned long calc_pmtimer_ref(u64 deltatsc, u64 pm1, u64 pm2) -{ - u64 tmp; - - if (!pm1 && !pm2) - return ULONG_MAX; - - if (pm2 < pm1) - pm2 += (u64)ACPI_PM_OVRRUN; - pm2 -= pm1; - tmp = pm2 * 1000000000LL; - do_div(tmp, PMTMR_TICKS_PER_SEC); - do_div(deltatsc, tmp); - - return (unsigned long) deltatsc; -} - -#define CAL_MS 10 -#define CAL_LATCH (CLOCK_TICK_RATE / (1000 / CAL_MS)) -#define CAL_PIT_LOOPS 1000 - -#define CAL2_MS 50 -#define CAL2_LATCH (CLOCK_TICK_RATE / (1000 / CAL2_MS)) -#define CAL2_PIT_LOOPS 5000 - - /* * Try to calibrate the TSC against the Programmable * Interrupt Timer and return the frequency of the TSC @@ -175,7 +129,7 @@ static unsigned long calc_pmtimer_ref(u64 deltatsc, u64 pm1, u64 pm2) * * Return ULONG_MAX on failure to calibrate. */ -static unsigned long pit_calibrate_tsc(u32 latch, unsigned long ms, int loopmin) +static unsigned long pit_calibrate_tsc(void) { u64 tsc, t1, t2, delta; unsigned long tscmin, tscmax; @@ -190,8 +144,8 @@ static unsigned long pit_calibrate_tsc(u32 latch, unsigned long ms, int loopmin) * (LSB then MSB) to begin countdown. */ outb(0xb0, 0x43); - outb(latch & 0xff, 0x42); - outb(latch >> 8, 0x42); + outb((CLOCK_TICK_RATE / (1000 / 50)) & 0xff, 0x42); + outb((CLOCK_TICK_RATE / (1000 / 50)) >> 8, 0x42); tsc = t1 = t2 = get_cycles(); @@ -212,154 +166,31 @@ static unsigned long pit_calibrate_tsc(u32 latch, unsigned long ms, int loopmin) /* * Sanity checks: * - * If we were not able to read the PIT more than loopmin + * If we were not able to read the PIT more than 5000 * times, then we have been hit by a massive SMI * * If the maximum is 10 times larger than the minimum, * then we got hit by an SMI as well. */ - if (pitcnt < loopmin || tscmax > 10 * tscmin) + if (pitcnt < 5000 || tscmax > 10 * tscmin) return ULONG_MAX; /* Calculate the PIT value */ delta = t2 - t1; - do_div(delta, ms); + do_div(delta, 50); return delta; } -/* - * This reads the current MSB of the PIT counter, and - * checks if we are running on sufficiently fast and - * non-virtualized hardware. - * - * Our expectations are: - * - * - the PIT is running at roughly 1.19MHz - * - * - each IO is going to take about 1us on real hardware, - * but we allow it to be much faster (by a factor of 10) or - * _slightly_ slower (ie we allow up to a 2us read+counter - * update - anything else implies a unacceptably slow CPU - * or PIT for the fast calibration to work. - * - * - with 256 PIT ticks to read the value, we have 214us to - * see the same MSB (and overhead like doing a single TSC - * read per MSB value etc). - * - * - We're doing 2 reads per loop (LSB, MSB), and we expect - * them each to take about a microsecond on real hardware. - * So we expect a count value of around 100. But we'll be - * generous, and accept anything over 50. - * - * - if the PIT is stuck, and we see *many* more reads, we - * return early (and the next caller of pit_expect_msb() - * then consider it a failure when they don't see the - * next expected value). - * - * These expectations mean that we know that we have seen the - * transition from one expected value to another with a fairly - * high accuracy, and we didn't miss any events. We can thus - * use the TSC value at the transitions to calculate a pretty - * good value for the TSC frequencty. - */ -static inline int pit_expect_msb(unsigned char val) -{ - int count = 0; - - for (count = 0; count < 50000; count++) { - /* Ignore LSB */ - inb(0x42); - if (inb(0x42) != val) - break; - } - return count > 50; -} - -/* - * How many MSB values do we want to see? We aim for a - * 15ms calibration, which assuming a 2us counter read - * error should give us roughly 150 ppm precision for - * the calibration. - */ -#define QUICK_PIT_MS 15 -#define QUICK_PIT_ITERATIONS (QUICK_PIT_MS * PIT_TICK_RATE / 1000 / 256) - -static unsigned long quick_pit_calibrate(void) -{ - /* Set the Gate high, disable speaker */ - outb((inb(0x61) & ~0x02) | 0x01, 0x61); - - /* - * Counter 2, mode 0 (one-shot), binary count - * - * NOTE! Mode 2 decrements by two (and then the - * output is flipped each time, giving the same - * final output frequency as a decrement-by-one), - * so mode 0 is much better when looking at the - * individual counts. - */ - outb(0xb0, 0x43); - - /* Start at 0xffff */ - outb(0xff, 0x42); - outb(0xff, 0x42); - - if (pit_expect_msb(0xff)) { - int i; - u64 t1, t2, delta; - unsigned char expect = 0xfe; - - t1 = get_cycles(); - for (i = 0; i < QUICK_PIT_ITERATIONS; i++, expect--) { - if (!pit_expect_msb(expect)) - goto failed; - } - t2 = get_cycles(); - - /* - * Make sure we can rely on the second TSC timestamp: - */ - if (!pit_expect_msb(expect)) - goto failed; - - /* - * Ok, if we get here, then we've seen the - * MSB of the PIT decrement QUICK_PIT_ITERATIONS - * times, and each MSB had many hits, so we never - * had any sudden jumps. - * - * As a result, we can depend on there not being - * any odd delays anywhere, and the TSC reads are - * reliable. - * - * kHz = ticks / time-in-seconds / 1000; - * kHz = (t2 - t1) / (QPI * 256 / PIT_TICK_RATE) / 1000 - * kHz = ((t2 - t1) * PIT_TICK_RATE) / (QPI * 256 * 1000) - */ - delta = (t2 - t1)*PIT_TICK_RATE; - do_div(delta, QUICK_PIT_ITERATIONS*256*1000); - printk("Fast TSC calibration using PIT\n"); - return delta; - } -failed: - return 0; -} /** * native_calibrate_tsc - calibrate the tsc on boot */ unsigned long native_calibrate_tsc(void) { - u64 tsc1, tsc2, delta, ref1, ref2; + u64 tsc1, tsc2, delta, pm1, pm2, hpet1, hpet2; unsigned long tsc_pit_min = ULONG_MAX, tsc_ref_min = ULONG_MAX; - unsigned long flags, latch, ms, fast_calibrate; - int hpet = is_hpet_enabled(), i, loopmin; - - local_irq_save(flags); - fast_calibrate = quick_pit_calibrate(); - local_irq_restore(flags); - if (fast_calibrate) - return fast_calibrate; + unsigned long flags; + int hpet = is_hpet_enabled(), i; /* * Run 5 calibration loops to get the lowest frequency value @@ -385,13 +216,7 @@ unsigned long native_calibrate_tsc(void) * calibration delay loop as we have to wait for a certain * amount of time anyway. */ - - /* Preset PIT loop values */ - latch = CAL_LATCH; - ms = CAL_MS; - loopmin = CAL_PIT_LOOPS; - - for (i = 0; i < 3; i++) { + for (i = 0; i < 5; i++) { unsigned long tsc_pit_khz; /* @@ -401,16 +226,16 @@ unsigned long native_calibrate_tsc(void) * read the end value. */ local_irq_save(flags); - tsc1 = tsc_read_refs(&ref1, hpet); - tsc_pit_khz = pit_calibrate_tsc(latch, ms, loopmin); - tsc2 = tsc_read_refs(&ref2, hpet); + tsc1 = tsc_read_refs(&pm1, hpet ? &hpet1 : NULL); + tsc_pit_khz = pit_calibrate_tsc(); + tsc2 = tsc_read_refs(&pm2, hpet ? &hpet2 : NULL); local_irq_restore(flags); /* Pick the lowest PIT TSC calibration so far */ tsc_pit_min = min(tsc_pit_min, tsc_pit_khz); /* hpet or pmtimer available ? */ - if (!hpet && !ref1 && !ref2) + if (!hpet && !pm1 && !pm2) continue; /* Check, whether the sampling was disturbed by an SMI */ @@ -418,41 +243,23 @@ unsigned long native_calibrate_tsc(void) continue; tsc2 = (tsc2 - tsc1) * 1000000LL; - if (hpet) - tsc2 = calc_hpet_ref(tsc2, ref1, ref2); - else - tsc2 = calc_pmtimer_ref(tsc2, ref1, ref2); - tsc_ref_min = min(tsc_ref_min, (unsigned long) tsc2); - - /* Check the reference deviation */ - delta = ((u64) tsc_pit_min) * 100; - do_div(delta, tsc_ref_min); - - /* - * If both calibration results are inside a 10% window - * then we can be sure, that the calibration - * succeeded. We break out of the loop right away. We - * use the reference value, as it is more precise. - */ - if (delta >= 90 && delta <= 110) { - printk(KERN_INFO - "TSC: PIT calibration matches %s. %d loops\n", - hpet ? "HPET" : "PMTIMER", i + 1); - return tsc_ref_min; + if (hpet) { + if (hpet2 < hpet1) + hpet2 += 0x100000000ULL; + hpet2 -= hpet1; + tsc1 = ((u64)hpet2 * hpet_readl(HPET_PERIOD)); + do_div(tsc1, 1000000); + } else { + if (pm2 < pm1) + pm2 += (u64)ACPI_PM_OVRRUN; + pm2 -= pm1; + tsc1 = pm2 * 1000000000LL; + do_div(tsc1, PMTMR_TICKS_PER_SEC); } - /* - * Check whether PIT failed more than once. This - * happens in virtualized environments. We need to - * give the virtual PC a slightly longer timeframe for - * the HPET/PMTIMER to make the result precise. - */ - if (i == 1 && tsc_pit_min == ULONG_MAX) { - latch = CAL2_LATCH; - ms = CAL2_MS; - loopmin = CAL2_PIT_LOOPS; - } + do_div(tsc2, tsc1); + tsc_ref_min = min(tsc_ref_min, (unsigned long) tsc2); } /* @@ -463,7 +270,7 @@ unsigned long native_calibrate_tsc(void) printk(KERN_WARNING "TSC: Unable to calibrate against PIT\n"); /* We don't have an alternative source, disable TSC */ - if (!hpet && !ref1 && !ref2) { + if (!hpet && !pm1 && !pm2) { printk("TSC: No reference (HPET/PMTIMER) available\n"); return 0; } @@ -471,7 +278,7 @@ unsigned long native_calibrate_tsc(void) /* The alternative source failed as well, disable TSC */ if (tsc_ref_min == ULONG_MAX) { printk(KERN_WARNING "TSC: HPET/PMTIMER calibration " - "failed.\n"); + "failed due to SMI disturbance.\n"); return 0; } @@ -483,25 +290,44 @@ unsigned long native_calibrate_tsc(void) } /* We don't have an alternative source, use the PIT calibration value */ - if (!hpet && !ref1 && !ref2) { + if (!hpet && !pm1 && !pm2) { printk(KERN_INFO "TSC: Using PIT calibration value\n"); return tsc_pit_min; } /* The alternative source failed, use the PIT calibration value */ if (tsc_ref_min == ULONG_MAX) { - printk(KERN_WARNING "TSC: HPET/PMTIMER calibration failed. " - "Using PIT calibration\n"); + printk(KERN_WARNING "TSC: HPET/PMTIMER calibration failed due " + "to SMI disturbance. Using PIT calibration\n"); return tsc_pit_min; } + /* Check the reference deviation */ + delta = ((u64) tsc_pit_min) * 100; + do_div(delta, tsc_ref_min); + /* - * The calibration values differ too much. In doubt, we use - * the PIT value as we know that there are PMTIMERs around - * running at double speed. At least we let the user know: + * If both calibration results are inside a 5% window, the we + * use the lower frequency of those as it is probably the + * closest estimate. */ + if (delta >= 95 && delta <= 105) { + printk(KERN_INFO "TSC: PIT calibration confirmed by %s.\n", + hpet ? "HPET" : "PMTIMER"); + printk(KERN_INFO "TSC: using %s calibration value\n", + tsc_pit_min <= tsc_ref_min ? "PIT" : + hpet ? "HPET" : "PMTIMER"); + return tsc_pit_min <= tsc_ref_min ? tsc_pit_min : tsc_ref_min; + } + printk(KERN_WARNING "TSC: PIT calibration deviates from %s: %lu %lu.\n", hpet ? "HPET" : "PMTIMER", tsc_pit_min, tsc_ref_min); + + /* + * The calibration values differ too much. In doubt, we use + * the PIT value as we know that there are PMTIMERs around + * running at double speed. + */ printk(KERN_INFO "TSC: Using PIT calibration value\n"); return tsc_pit_min; } diff --git a/trunk/arch/x86/kernel/visws_quirks.c b/trunk/arch/x86/kernel/visws_quirks.c index 61a97e616f70..594ef47f0a63 100644 --- a/trunk/arch/x86/kernel/visws_quirks.c +++ b/trunk/arch/x86/kernel/visws_quirks.c @@ -25,31 +25,45 @@ #include #include #include -#include #include #include #include #include +#include #include #include #include "mach_apic.h" +#include +#include + #include +#include +#include +#include +#include #include #include +#include #include +#include #include #include +#include #include #include extern int no_broadcast; +#include #include +#include +#include +#include char visws_board_type = -1; char visws_board_rev = -1; diff --git a/trunk/arch/x86/kernel/vm86_32.c b/trunk/arch/x86/kernel/vm86_32.c index 4eeb5cf9720d..38f566fa27d2 100644 --- a/trunk/arch/x86/kernel/vm86_32.c +++ b/trunk/arch/x86/kernel/vm86_32.c @@ -46,7 +46,6 @@ #include #include #include -#include /* * Known problems: diff --git a/trunk/arch/x86/kernel/vmi_32.c b/trunk/arch/x86/kernel/vmi_32.c index 8c9ad02af5a2..edfb09f30479 100644 --- a/trunk/arch/x86/kernel/vmi_32.c +++ b/trunk/arch/x86/kernel/vmi_32.c @@ -393,13 +393,13 @@ static void *vmi_kmap_atomic_pte(struct page *page, enum km_type type) } #endif -static void vmi_allocate_pte(struct mm_struct *mm, unsigned long pfn) +static void vmi_allocate_pte(struct mm_struct *mm, u32 pfn) { vmi_set_page_type(pfn, VMI_PAGE_L1); vmi_ops.allocate_page(pfn, VMI_PAGE_L1, 0, 0, 0); } -static void vmi_allocate_pmd(struct mm_struct *mm, unsigned long pfn) +static void vmi_allocate_pmd(struct mm_struct *mm, u32 pfn) { /* * This call comes in very early, before mem_map is setup. @@ -410,20 +410,20 @@ static void vmi_allocate_pmd(struct mm_struct *mm, unsigned long pfn) vmi_ops.allocate_page(pfn, VMI_PAGE_L2, 0, 0, 0); } -static void vmi_allocate_pmd_clone(unsigned long pfn, unsigned long clonepfn, unsigned long start, unsigned long count) +static void vmi_allocate_pmd_clone(u32 pfn, u32 clonepfn, u32 start, u32 count) { vmi_set_page_type(pfn, VMI_PAGE_L2 | VMI_PAGE_CLONE); vmi_check_page_type(clonepfn, VMI_PAGE_L2); vmi_ops.allocate_page(pfn, VMI_PAGE_L2 | VMI_PAGE_CLONE, clonepfn, start, count); } -static void vmi_release_pte(unsigned long pfn) +static void vmi_release_pte(u32 pfn) { vmi_ops.release_page(pfn, VMI_PAGE_L1); vmi_set_page_type(pfn, VMI_PAGE_NORMAL); } -static void vmi_release_pmd(unsigned long pfn) +static void vmi_release_pmd(u32 pfn) { vmi_ops.release_page(pfn, VMI_PAGE_L2); vmi_set_page_type(pfn, VMI_PAGE_NORMAL); diff --git a/trunk/arch/x86/lib/msr-on-cpu.c b/trunk/arch/x86/lib/msr-on-cpu.c index 321cf720dbb6..01b868ba82f8 100644 --- a/trunk/arch/x86/lib/msr-on-cpu.c +++ b/trunk/arch/x86/lib/msr-on-cpu.c @@ -16,46 +16,37 @@ static void __rdmsr_on_cpu(void *info) rdmsr(rv->msr_no, rv->l, rv->h); } -static void __wrmsr_on_cpu(void *info) +static void __rdmsr_safe_on_cpu(void *info) { struct msr_info *rv = info; - wrmsr(rv->msr_no, rv->l, rv->h); + rv->err = rdmsr_safe(rv->msr_no, &rv->l, &rv->h); } -int rdmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h) +static int _rdmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h, int safe) { - int err; + int err = 0; struct msr_info rv; rv.msr_no = msr_no; - err = smp_call_function_single(cpu, __rdmsr_on_cpu, &rv, 1); + if (safe) { + err = smp_call_function_single(cpu, __rdmsr_safe_on_cpu, + &rv, 1); + err = err ? err : rv.err; + } else { + err = smp_call_function_single(cpu, __rdmsr_on_cpu, &rv, 1); + } *l = rv.l; *h = rv.h; return err; } -int wrmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h) -{ - int err; - struct msr_info rv; - - rv.msr_no = msr_no; - rv.l = l; - rv.h = h; - err = smp_call_function_single(cpu, __wrmsr_on_cpu, &rv, 1); - - return err; -} - -/* These "safe" variants are slower and should be used when the target MSR - may not actually exist. */ -static void __rdmsr_safe_on_cpu(void *info) +static void __wrmsr_on_cpu(void *info) { struct msr_info *rv = info; - rv->err = rdmsr_safe(rv->msr_no, &rv->l, &rv->h); + wrmsr(rv->msr_no, rv->l, rv->h); } static void __wrmsr_safe_on_cpu(void *info) @@ -65,30 +56,45 @@ static void __wrmsr_safe_on_cpu(void *info) rv->err = wrmsr_safe(rv->msr_no, rv->l, rv->h); } -int rdmsr_safe_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h) +static int _wrmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h, int safe) { - int err; + int err = 0; struct msr_info rv; rv.msr_no = msr_no; - err = smp_call_function_single(cpu, __rdmsr_safe_on_cpu, &rv, 1); - *l = rv.l; - *h = rv.h; + rv.l = l; + rv.h = h; + if (safe) { + err = smp_call_function_single(cpu, __wrmsr_safe_on_cpu, + &rv, 1); + err = err ? err : rv.err; + } else { + err = smp_call_function_single(cpu, __wrmsr_on_cpu, &rv, 1); + } - return err ? err : rv.err; + return err; } -int wrmsr_safe_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h) +int wrmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h) { - int err; - struct msr_info rv; + return _wrmsr_on_cpu(cpu, msr_no, l, h, 0); +} - rv.msr_no = msr_no; - rv.l = l; - rv.h = h; - err = smp_call_function_single(cpu, __wrmsr_safe_on_cpu, &rv, 1); +int rdmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h) +{ + return _rdmsr_on_cpu(cpu, msr_no, l, h, 0); +} + +/* These "safe" variants are slower and should be used when the target MSR + may not actually exist. */ +int wrmsr_safe_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h) +{ + return _wrmsr_on_cpu(cpu, msr_no, l, h, 1); +} - return err ? err : rv.err; +int rdmsr_safe_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h) +{ + return _rdmsr_on_cpu(cpu, msr_no, l, h, 1); } EXPORT_SYMBOL(rdmsr_on_cpu); diff --git a/trunk/arch/x86/lib/string_32.c b/trunk/arch/x86/lib/string_32.c index 82004d2bf05e..94972e7c094d 100644 --- a/trunk/arch/x86/lib/string_32.c +++ b/trunk/arch/x86/lib/string_32.c @@ -22,7 +22,7 @@ char *strcpy(char *dest, const char *src) "testb %%al,%%al\n\t" "jne 1b" : "=&S" (d0), "=&D" (d1), "=&a" (d2) - : "0" (src), "1" (dest) : "memory"); + :"0" (src), "1" (dest) : "memory"); return dest; } EXPORT_SYMBOL(strcpy); @@ -42,7 +42,7 @@ char *strncpy(char *dest, const char *src, size_t count) "stosb\n" "2:" : "=&S" (d0), "=&D" (d1), "=&c" (d2), "=&a" (d3) - : "0" (src), "1" (dest), "2" (count) : "memory"); + :"0" (src), "1" (dest), "2" (count) : "memory"); return dest; } EXPORT_SYMBOL(strncpy); @@ -60,7 +60,7 @@ char *strcat(char *dest, const char *src) "testb %%al,%%al\n\t" "jne 1b" : "=&S" (d0), "=&D" (d1), "=&a" (d2), "=&c" (d3) - : "0" (src), "1" (dest), "2" (0), "3" (0xffffffffu) : "memory"); + : "0" (src), "1" (dest), "2" (0), "3" (0xffffffffu): "memory"); return dest; } EXPORT_SYMBOL(strcat); @@ -105,9 +105,9 @@ int strcmp(const char *cs, const char *ct) "2:\tsbbl %%eax,%%eax\n\t" "orb $1,%%al\n" "3:" - : "=a" (res), "=&S" (d0), "=&D" (d1) - : "1" (cs), "2" (ct) - : "memory"); + :"=a" (res), "=&S" (d0), "=&D" (d1) + :"1" (cs), "2" (ct) + :"memory"); return res; } EXPORT_SYMBOL(strcmp); @@ -130,9 +130,9 @@ int strncmp(const char *cs, const char *ct, size_t count) "3:\tsbbl %%eax,%%eax\n\t" "orb $1,%%al\n" "4:" - : "=a" (res), "=&S" (d0), "=&D" (d1), "=&c" (d2) - : "1" (cs), "2" (ct), "3" (count) - : "memory"); + :"=a" (res), "=&S" (d0), "=&D" (d1), "=&c" (d2) + :"1" (cs), "2" (ct), "3" (count) + :"memory"); return res; } EXPORT_SYMBOL(strncmp); @@ -152,9 +152,9 @@ char *strchr(const char *s, int c) "movl $1,%1\n" "2:\tmovl %1,%0\n\t" "decl %0" - : "=a" (res), "=&S" (d0) - : "1" (s), "0" (c) - : "memory"); + :"=a" (res), "=&S" (d0) + :"1" (s), "0" (c) + :"memory"); return res; } EXPORT_SYMBOL(strchr); @@ -169,9 +169,9 @@ size_t strlen(const char *s) "scasb\n\t" "notl %0\n\t" "decl %0" - : "=c" (res), "=&D" (d0) - : "1" (s), "a" (0), "0" (0xffffffffu) - : "memory"); + :"=c" (res), "=&D" (d0) + :"1" (s), "a" (0), "0" (0xffffffffu) + :"memory"); return res; } EXPORT_SYMBOL(strlen); @@ -189,9 +189,9 @@ void *memchr(const void *cs, int c, size_t count) "je 1f\n\t" "movl $1,%0\n" "1:\tdecl %0" - : "=D" (res), "=&c" (d0) - : "a" (c), "0" (cs), "1" (count) - : "memory"); + :"=D" (res), "=&c" (d0) + :"a" (c), "0" (cs), "1" (count) + :"memory"); return res; } EXPORT_SYMBOL(memchr); @@ -228,9 +228,9 @@ size_t strnlen(const char *s, size_t count) "cmpl $-1,%1\n\t" "jne 1b\n" "3:\tsubl %2,%0" - : "=a" (res), "=&d" (d0) - : "c" (s), "1" (count) - : "memory"); + :"=a" (res), "=&d" (d0) + :"c" (s), "1" (count) + :"memory"); return res; } EXPORT_SYMBOL(strnlen); diff --git a/trunk/arch/x86/lib/strstr_32.c b/trunk/arch/x86/lib/strstr_32.c index 8e2d55f754bf..42e8a50303f3 100644 --- a/trunk/arch/x86/lib/strstr_32.c +++ b/trunk/arch/x86/lib/strstr_32.c @@ -23,9 +23,9 @@ __asm__ __volatile__( "jne 1b\n\t" "xorl %%eax,%%eax\n\t" "2:" - : "=a" (__res), "=&c" (d0), "=&S" (d1) - : "0" (0), "1" (0xffffffff), "2" (cs), "g" (ct) - : "dx", "di"); + :"=a" (__res), "=&c" (d0), "=&S" (d1) + :"0" (0), "1" (0xffffffff), "2" (cs), "g" (ct) + :"dx", "di"); return __res; } diff --git a/trunk/arch/x86/mach-default/setup.c b/trunk/arch/x86/mach-default/setup.c index 3f2cf11f201a..3d317836be9e 100644 --- a/trunk/arch/x86/mach-default/setup.c +++ b/trunk/arch/x86/mach-default/setup.c @@ -10,15 +10,13 @@ #include #include -#include - #ifdef CONFIG_HOTPLUG_CPU #define DEFAULT_SEND_IPI (1) #else #define DEFAULT_SEND_IPI (0) #endif -int no_broadcast = DEFAULT_SEND_IPI; +int no_broadcast=DEFAULT_SEND_IPI; /** * pre_intr_init_hook - initialisation prior to setting up interrupt vectors diff --git a/trunk/arch/x86/mm/discontig_32.c b/trunk/arch/x86/mm/discontig_32.c index 847c164725f4..62fa440678d8 100644 --- a/trunk/arch/x86/mm/discontig_32.c +++ b/trunk/arch/x86/mm/discontig_32.c @@ -328,7 +328,7 @@ void __init initmem_init(unsigned long start_pfn, get_memcfg_numa(); - kva_pages = roundup(calculate_numa_remap_pages(), PTRS_PER_PTE); + kva_pages = round_up(calculate_numa_remap_pages(), PTRS_PER_PTE); kva_target_pfn = round_down(max_low_pfn - kva_pages, PTRS_PER_PTE); do { diff --git a/trunk/arch/x86/mm/dump_pagetables.c b/trunk/arch/x86/mm/dump_pagetables.c index e7277cbcfb40..a20d1fa64b4e 100644 --- a/trunk/arch/x86/mm/dump_pagetables.c +++ b/trunk/arch/x86/mm/dump_pagetables.c @@ -148,8 +148,8 @@ static void note_page(struct seq_file *m, struct pg_state *st, * we have now. "break" is either changing perms, levels or * address space marker. */ - prot = pgprot_val(new_prot) & PTE_FLAGS_MASK; - cur = pgprot_val(st->current_prot) & PTE_FLAGS_MASK; + prot = pgprot_val(new_prot) & ~(PTE_PFN_MASK); + cur = pgprot_val(st->current_prot) & ~(PTE_PFN_MASK); if (!st->level) { /* First entry */ diff --git a/trunk/arch/x86/mm/fault.c b/trunk/arch/x86/mm/fault.c index 8f92cac4e6db..455f3fe67b42 100644 --- a/trunk/arch/x86/mm/fault.c +++ b/trunk/arch/x86/mm/fault.c @@ -35,7 +35,6 @@ #include #include #include -#include /* * Page fault error code bits @@ -358,6 +357,8 @@ static int is_errata100(struct pt_regs *regs, unsigned long address) return 0; } +void do_invalid_op(struct pt_regs *, unsigned long); + static int is_f00f_bug(struct pt_regs *regs, unsigned long address) { #ifdef CONFIG_X86_F00F_BUG diff --git a/trunk/arch/x86/mm/init_32.c b/trunk/arch/x86/mm/init_32.c index 6b9a9358b330..60ec1d08ff24 100644 --- a/trunk/arch/x86/mm/init_32.c +++ b/trunk/arch/x86/mm/init_32.c @@ -47,7 +47,6 @@ #include #include #include -#include unsigned int __VMALLOC_RESERVE = 128 << 20; diff --git a/trunk/arch/x86/mm/init_64.c b/trunk/arch/x86/mm/init_64.c index 770536ebf7e9..d3746efb060d 100644 --- a/trunk/arch/x86/mm/init_64.c +++ b/trunk/arch/x86/mm/init_64.c @@ -225,7 +225,7 @@ void __init init_extra_mapping_uc(unsigned long phys, unsigned long size) void __init cleanup_highmap(void) { unsigned long vaddr = __START_KERNEL_map; - unsigned long end = roundup((unsigned long)_end, PMD_SIZE) - 1; + unsigned long end = round_up((unsigned long)_end, PMD_SIZE) - 1; pmd_t *pmd = level2_kernel_pgt; pmd_t *last_pmd = pmd + PTRS_PER_PMD; @@ -451,14 +451,14 @@ static void __init find_early_table_space(unsigned long end) unsigned long puds, pmds, ptes, tables, start; puds = (end + PUD_SIZE - 1) >> PUD_SHIFT; - tables = roundup(puds * sizeof(pud_t), PAGE_SIZE); + tables = round_up(puds * sizeof(pud_t), PAGE_SIZE); if (direct_gbpages) { unsigned long extra; extra = end - ((end>>PUD_SHIFT) << PUD_SHIFT); pmds = (extra + PMD_SIZE - 1) >> PMD_SHIFT; } else pmds = (end + PMD_SIZE - 1) >> PMD_SHIFT; - tables += roundup(pmds * sizeof(pmd_t), PAGE_SIZE); + tables += round_up(pmds * sizeof(pmd_t), PAGE_SIZE); if (cpu_has_pse) { unsigned long extra; @@ -466,7 +466,7 @@ static void __init find_early_table_space(unsigned long end) ptes = (extra + PAGE_SIZE - 1) >> PAGE_SHIFT; } else ptes = (end + PAGE_SIZE - 1) >> PAGE_SHIFT; - tables += roundup(ptes * sizeof(pte_t), PAGE_SIZE); + tables += round_up(ptes * sizeof(pte_t), PAGE_SIZE); /* * RED-PEN putting page tables only on node 0 could diff --git a/trunk/arch/x86/mm/ioremap.c b/trunk/arch/x86/mm/ioremap.c index cac6da54203b..d4b6e6a29ae3 100644 --- a/trunk/arch/x86/mm/ioremap.c +++ b/trunk/arch/x86/mm/ioremap.c @@ -421,7 +421,7 @@ void unxlate_dev_mem_ptr(unsigned long phys, void *addr) return; } -static int __initdata early_ioremap_debug; +int __initdata early_ioremap_debug; static int __init early_ioremap_debug_setup(char *str) { @@ -547,7 +547,7 @@ static inline void __init early_clear_fixmap(enum fixed_addresses idx) } -static int __initdata early_ioremap_nested; +int __initdata early_ioremap_nested; static int __init check_early_ioremap_leak(void) { diff --git a/trunk/arch/x86/mm/numa_64.c b/trunk/arch/x86/mm/numa_64.c index cebcbf152d46..a4dd793d6003 100644 --- a/trunk/arch/x86/mm/numa_64.c +++ b/trunk/arch/x86/mm/numa_64.c @@ -79,7 +79,7 @@ static int __init allocate_cachealigned_memnodemap(void) return 0; addr = 0x8000; - nodemap_size = roundup(sizeof(s16) * memnodemapsize, L1_CACHE_BYTES); + nodemap_size = round_up(sizeof(s16) * memnodemapsize, L1_CACHE_BYTES); nodemap_addr = find_e820_area(addr, max_pfn<> PAGE_SHIFT; + return __pa(round_up((unsigned long)_end, PMD_SIZE)) >> PAGE_SHIFT; } #endif @@ -906,13 +906,11 @@ int set_memory_ro(unsigned long addr, int numpages) { return change_page_attr_clear(addr, numpages, __pgprot(_PAGE_RW)); } -EXPORT_SYMBOL_GPL(set_memory_ro); int set_memory_rw(unsigned long addr, int numpages) { return change_page_attr_set(addr, numpages, __pgprot(_PAGE_RW)); } -EXPORT_SYMBOL_GPL(set_memory_rw); int set_memory_np(unsigned long addr, int numpages) { diff --git a/trunk/arch/x86/mm/pgtable.c b/trunk/arch/x86/mm/pgtable.c index 86f2ffc43c3d..d50302774fe2 100644 --- a/trunk/arch/x86/mm/pgtable.c +++ b/trunk/arch/x86/mm/pgtable.c @@ -63,8 +63,10 @@ static inline void pgd_list_del(pgd_t *pgd) #define UNSHARED_PTRS_PER_PGD \ (SHARED_KERNEL_PMD ? KERNEL_PGD_BOUNDARY : PTRS_PER_PGD) -static void pgd_ctor(pgd_t *pgd) +static void pgd_ctor(void *p) { + pgd_t *pgd = p; + /* If the pgd points to a shared pagetable level (either the ptes in non-PAE, or shared PMD in PAE), then just copy the references from swapper_pg_dir. */ @@ -85,7 +87,7 @@ static void pgd_ctor(pgd_t *pgd) pgd_list_add(pgd); } -static void pgd_dtor(pgd_t *pgd) +static void pgd_dtor(void *pgd) { unsigned long flags; /* can be called from interrupt context */ diff --git a/trunk/arch/x86/mm/pgtable_32.c b/trunk/arch/x86/mm/pgtable_32.c index 0951db9ee519..cab0abbd1ebe 100644 --- a/trunk/arch/x86/mm/pgtable_32.c +++ b/trunk/arch/x86/mm/pgtable_32.c @@ -123,8 +123,7 @@ static int __init parse_vmalloc(char *arg) if (!arg) return -EINVAL; - /* Add VMALLOC_OFFSET to the parsed value due to vm area guard hole*/ - __VMALLOC_RESERVE = memparse(arg, &arg) + VMALLOC_OFFSET; + __VMALLOC_RESERVE = memparse(arg, &arg); return 0; } early_param("vmalloc", parse_vmalloc); diff --git a/trunk/arch/x86/oprofile/op_model_p4.c b/trunk/arch/x86/oprofile/op_model_p4.c index 43ac5af338d8..56b4757a1f47 100644 --- a/trunk/arch/x86/oprofile/op_model_p4.c +++ b/trunk/arch/x86/oprofile/op_model_p4.c @@ -10,12 +10,11 @@ #include #include -#include -#include #include +#include #include #include - +#include #include "op_x86_model.h" #include "op_counter.h" @@ -41,7 +40,7 @@ static unsigned int num_controls = NUM_CONTROLS_NON_HT; static inline void setup_num_counters(void) { #ifdef CONFIG_SMP - if (smp_num_siblings == 2) { + if (smp_num_siblings == 2){ num_counters = NUM_COUNTERS_HT2; num_controls = NUM_CONTROLS_HT2; } @@ -87,7 +86,7 @@ struct p4_event_binding { #define CTR_FLAME_2 (1 << 6) #define CTR_IQ_5 (1 << 7) -static struct p4_counter_binding p4_counters[NUM_COUNTERS_NON_HT] = { +static struct p4_counter_binding p4_counters [NUM_COUNTERS_NON_HT] = { { CTR_BPU_0, MSR_P4_BPU_PERFCTR0, MSR_P4_BPU_CCCR0 }, { CTR_MS_0, MSR_P4_MS_PERFCTR0, MSR_P4_MS_CCCR0 }, { CTR_FLAME_0, MSR_P4_FLAME_PERFCTR0, MSR_P4_FLAME_CCCR0 }, @@ -98,32 +97,32 @@ static struct p4_counter_binding p4_counters[NUM_COUNTERS_NON_HT] = { { CTR_IQ_5, MSR_P4_IQ_PERFCTR5, MSR_P4_IQ_CCCR5 } }; -#define NUM_UNUSED_CCCRS (NUM_CCCRS_NON_HT - NUM_COUNTERS_NON_HT) +#define NUM_UNUSED_CCCRS NUM_CCCRS_NON_HT - NUM_COUNTERS_NON_HT /* p4 event codes in libop/op_event.h are indices into this table. */ static struct p4_event_binding p4_events[NUM_EVENTS] = { - + { /* BRANCH_RETIRED */ - 0x05, 0x06, + 0x05, 0x06, { {CTR_IQ_4, MSR_P4_CRU_ESCR2}, {CTR_IQ_5, MSR_P4_CRU_ESCR3} } }, - + { /* MISPRED_BRANCH_RETIRED */ - 0x04, 0x03, + 0x04, 0x03, { { CTR_IQ_4, MSR_P4_CRU_ESCR0}, { CTR_IQ_5, MSR_P4_CRU_ESCR1} } }, - + { /* TC_DELIVER_MODE */ 0x01, 0x01, - { { CTR_MS_0, MSR_P4_TC_ESCR0}, + { { CTR_MS_0, MSR_P4_TC_ESCR0}, { CTR_MS_2, MSR_P4_TC_ESCR1} } }, - + { /* BPU_FETCH_REQUEST */ - 0x00, 0x03, + 0x00, 0x03, { { CTR_BPU_0, MSR_P4_BPU_ESCR0}, { CTR_BPU_2, MSR_P4_BPU_ESCR1} } }, @@ -147,7 +146,7 @@ static struct p4_event_binding p4_events[NUM_EVENTS] = { }, { /* LOAD_PORT_REPLAY */ - 0x02, 0x04, + 0x02, 0x04, { { CTR_FLAME_0, MSR_P4_SAAT_ESCR0}, { CTR_FLAME_2, MSR_P4_SAAT_ESCR1} } }, @@ -171,43 +170,43 @@ static struct p4_event_binding p4_events[NUM_EVENTS] = { }, { /* BSQ_CACHE_REFERENCE */ - 0x07, 0x0c, + 0x07, 0x0c, { { CTR_BPU_0, MSR_P4_BSU_ESCR0}, { CTR_BPU_2, MSR_P4_BSU_ESCR1} } }, { /* IOQ_ALLOCATION */ - 0x06, 0x03, + 0x06, 0x03, { { CTR_BPU_0, MSR_P4_FSB_ESCR0}, { 0, 0 } } }, { /* IOQ_ACTIVE_ENTRIES */ - 0x06, 0x1a, + 0x06, 0x1a, { { CTR_BPU_2, MSR_P4_FSB_ESCR1}, { 0, 0 } } }, { /* FSB_DATA_ACTIVITY */ - 0x06, 0x17, + 0x06, 0x17, { { CTR_BPU_0, MSR_P4_FSB_ESCR0}, { CTR_BPU_2, MSR_P4_FSB_ESCR1} } }, { /* BSQ_ALLOCATION */ - 0x07, 0x05, + 0x07, 0x05, { { CTR_BPU_0, MSR_P4_BSU_ESCR0}, { 0, 0 } } }, { /* BSQ_ACTIVE_ENTRIES */ 0x07, 0x06, - { { CTR_BPU_2, MSR_P4_BSU_ESCR1 /* guess */}, + { { CTR_BPU_2, MSR_P4_BSU_ESCR1 /* guess */}, { 0, 0 } } }, { /* X87_ASSIST */ - 0x05, 0x03, + 0x05, 0x03, { { CTR_IQ_4, MSR_P4_CRU_ESCR2}, { CTR_IQ_5, MSR_P4_CRU_ESCR3} } }, @@ -217,21 +216,21 @@ static struct p4_event_binding p4_events[NUM_EVENTS] = { { { CTR_FLAME_0, MSR_P4_FIRM_ESCR0}, { CTR_FLAME_2, MSR_P4_FIRM_ESCR1} } }, - + { /* PACKED_SP_UOP */ - 0x01, 0x08, + 0x01, 0x08, { { CTR_FLAME_0, MSR_P4_FIRM_ESCR0}, { CTR_FLAME_2, MSR_P4_FIRM_ESCR1} } }, - + { /* PACKED_DP_UOP */ - 0x01, 0x0c, + 0x01, 0x0c, { { CTR_FLAME_0, MSR_P4_FIRM_ESCR0}, { CTR_FLAME_2, MSR_P4_FIRM_ESCR1} } }, { /* SCALAR_SP_UOP */ - 0x01, 0x0a, + 0x01, 0x0a, { { CTR_FLAME_0, MSR_P4_FIRM_ESCR0}, { CTR_FLAME_2, MSR_P4_FIRM_ESCR1} } }, @@ -243,31 +242,31 @@ static struct p4_event_binding p4_events[NUM_EVENTS] = { }, { /* 64BIT_MMX_UOP */ - 0x01, 0x02, + 0x01, 0x02, { { CTR_FLAME_0, MSR_P4_FIRM_ESCR0}, { CTR_FLAME_2, MSR_P4_FIRM_ESCR1} } }, - + { /* 128BIT_MMX_UOP */ - 0x01, 0x1a, + 0x01, 0x1a, { { CTR_FLAME_0, MSR_P4_FIRM_ESCR0}, { CTR_FLAME_2, MSR_P4_FIRM_ESCR1} } }, { /* X87_FP_UOP */ - 0x01, 0x04, + 0x01, 0x04, { { CTR_FLAME_0, MSR_P4_FIRM_ESCR0}, { CTR_FLAME_2, MSR_P4_FIRM_ESCR1} } }, - + { /* X87_SIMD_MOVES_UOP */ - 0x01, 0x2e, + 0x01, 0x2e, { { CTR_FLAME_0, MSR_P4_FIRM_ESCR0}, { CTR_FLAME_2, MSR_P4_FIRM_ESCR1} } }, - + { /* MACHINE_CLEAR */ - 0x05, 0x02, + 0x05, 0x02, { { CTR_IQ_4, MSR_P4_CRU_ESCR2}, { CTR_IQ_5, MSR_P4_CRU_ESCR3} } }, @@ -277,9 +276,9 @@ static struct p4_event_binding p4_events[NUM_EVENTS] = { { { CTR_BPU_0, MSR_P4_FSB_ESCR0}, { CTR_BPU_2, MSR_P4_FSB_ESCR1} } }, - + { /* TC_MS_XFER */ - 0x00, 0x05, + 0x00, 0x05, { { CTR_MS_0, MSR_P4_MS_ESCR0}, { CTR_MS_2, MSR_P4_MS_ESCR1} } }, @@ -309,7 +308,7 @@ static struct p4_event_binding p4_events[NUM_EVENTS] = { }, { /* INSTR_RETIRED */ - 0x04, 0x02, + 0x04, 0x02, { { CTR_IQ_4, MSR_P4_CRU_ESCR0}, { CTR_IQ_5, MSR_P4_CRU_ESCR1} } }, @@ -320,14 +319,14 @@ static struct p4_event_binding p4_events[NUM_EVENTS] = { { CTR_IQ_5, MSR_P4_CRU_ESCR1} } }, - { /* UOP_TYPE */ - 0x02, 0x02, + { /* UOP_TYPE */ + 0x02, 0x02, { { CTR_IQ_4, MSR_P4_RAT_ESCR0}, { CTR_IQ_5, MSR_P4_RAT_ESCR1} } }, { /* RETIRED_MISPRED_BRANCH_TYPE */ - 0x02, 0x05, + 0x02, 0x05, { { CTR_MS_0, MSR_P4_TBPU_ESCR0}, { CTR_MS_2, MSR_P4_TBPU_ESCR1} } }, @@ -350,8 +349,8 @@ static struct p4_event_binding p4_events[NUM_EVENTS] = { #define ESCR_SET_OS_1(escr, os) ((escr) |= (((os) & 1) << 1)) #define ESCR_SET_EVENT_SELECT(escr, sel) ((escr) |= (((sel) & 0x3f) << 25)) #define ESCR_SET_EVENT_MASK(escr, mask) ((escr) |= (((mask) & 0xffff) << 9)) -#define ESCR_READ(escr, high, ev, i) do {rdmsr(ev->bindings[(i)].escr_address, (escr), (high)); } while (0) -#define ESCR_WRITE(escr, high, ev, i) do {wrmsr(ev->bindings[(i)].escr_address, (escr), (high)); } while (0) +#define ESCR_READ(escr,high,ev,i) do {rdmsr(ev->bindings[(i)].escr_address, (escr), (high));} while (0) +#define ESCR_WRITE(escr,high,ev,i) do {wrmsr(ev->bindings[(i)].escr_address, (escr), (high));} while (0) #define CCCR_RESERVED_BITS 0x38030FFF #define CCCR_CLEAR(cccr) ((cccr) &= CCCR_RESERVED_BITS) @@ -361,15 +360,15 @@ static struct p4_event_binding p4_events[NUM_EVENTS] = { #define CCCR_SET_PMI_OVF_1(cccr) ((cccr) |= (1<<27)) #define CCCR_SET_ENABLE(cccr) ((cccr) |= (1<<12)) #define CCCR_SET_DISABLE(cccr) ((cccr) &= ~(1<<12)) -#define CCCR_READ(low, high, i) do {rdmsr(p4_counters[(i)].cccr_address, (low), (high)); } while (0) -#define CCCR_WRITE(low, high, i) do {wrmsr(p4_counters[(i)].cccr_address, (low), (high)); } while (0) +#define CCCR_READ(low, high, i) do {rdmsr(p4_counters[(i)].cccr_address, (low), (high));} while (0) +#define CCCR_WRITE(low, high, i) do {wrmsr(p4_counters[(i)].cccr_address, (low), (high));} while (0) #define CCCR_OVF_P(cccr) ((cccr) & (1U<<31)) #define CCCR_CLEAR_OVF(cccr) ((cccr) &= (~(1U<<31))) -#define CTRL_IS_RESERVED(msrs, c) (msrs->controls[(c)].addr ? 1 : 0) -#define CTR_IS_RESERVED(msrs, c) (msrs->counters[(c)].addr ? 1 : 0) -#define CTR_READ(l, h, i) do {rdmsr(p4_counters[(i)].counter_address, (l), (h)); } while (0) -#define CTR_WRITE(l, i) do {wrmsr(p4_counters[(i)].counter_address, -(u32)(l), -1); } while (0) +#define CTRL_IS_RESERVED(msrs,c) (msrs->controls[(c)].addr ? 1 : 0) +#define CTR_IS_RESERVED(msrs,c) (msrs->counters[(c)].addr ? 1 : 0) +#define CTR_READ(l,h,i) do {rdmsr(p4_counters[(i)].counter_address, (l), (h));} while (0) +#define CTR_WRITE(l,i) do {wrmsr(p4_counters[(i)].counter_address, -(u32)(l), -1);} while (0) #define CTR_OVERFLOW_P(ctr) (!((ctr) & 0x80000000)) @@ -381,7 +380,7 @@ static unsigned int get_stagger(void) #ifdef CONFIG_SMP int cpu = smp_processor_id(); return (cpu != first_cpu(per_cpu(cpu_sibling_map, cpu))); -#endif +#endif return 0; } @@ -396,23 +395,25 @@ static unsigned long reset_value[NUM_COUNTERS_NON_HT]; static void p4_fill_in_addresses(struct op_msrs * const msrs) { - unsigned int i; + unsigned int i; unsigned int addr, cccraddr, stag; setup_num_counters(); stag = get_stagger(); /* initialize some registers */ - for (i = 0; i < num_counters; ++i) + for (i = 0; i < num_counters; ++i) { msrs->counters[i].addr = 0; - for (i = 0; i < num_controls; ++i) + } + for (i = 0; i < num_controls; ++i) { msrs->controls[i].addr = 0; - + } + /* the counter & cccr registers we pay attention to */ for (i = 0; i < num_counters; ++i) { addr = p4_counters[VIRT_CTR(stag, i)].counter_address; cccraddr = p4_counters[VIRT_CTR(stag, i)].cccr_address; - if (reserve_perfctr_nmi(addr)) { + if (reserve_perfctr_nmi(addr)){ msrs->counters[i].addr = addr; msrs->controls[i].addr = cccraddr; } @@ -446,22 +447,22 @@ static void p4_fill_in_addresses(struct op_msrs * const msrs) if (reserve_evntsel_nmi(addr)) msrs->controls[i].addr = addr; } - + for (addr = MSR_P4_MS_ESCR0 + stag; - addr <= MSR_P4_TC_ESCR1; ++i, addr += addr_increment()) { + addr <= MSR_P4_TC_ESCR1; ++i, addr += addr_increment()) { if (reserve_evntsel_nmi(addr)) msrs->controls[i].addr = addr; } - + for (addr = MSR_P4_IX_ESCR0 + stag; - addr <= MSR_P4_CRU_ESCR3; ++i, addr += addr_increment()) { + addr <= MSR_P4_CRU_ESCR3; ++i, addr += addr_increment()) { if (reserve_evntsel_nmi(addr)) msrs->controls[i].addr = addr; } /* there are 2 remaining non-contiguously located ESCRs */ - if (num_counters == NUM_COUNTERS_NON_HT) { + if (num_counters == NUM_COUNTERS_NON_HT) { /* standard non-HT CPUs handle both remaining ESCRs*/ if (reserve_evntsel_nmi(MSR_P4_CRU_ESCR5)) msrs->controls[i++].addr = MSR_P4_CRU_ESCR5; @@ -497,20 +498,20 @@ static void pmc_setup_one_p4_counter(unsigned int ctr) unsigned int stag; stag = get_stagger(); - + /* convert from counter *number* to counter *bit* */ counter_bit = 1 << VIRT_CTR(stag, ctr); - + /* find our event binding structure. */ if (counter_config[ctr].event <= 0 || counter_config[ctr].event > NUM_EVENTS) { - printk(KERN_ERR - "oprofile: P4 event code 0x%lx out of range\n", + printk(KERN_ERR + "oprofile: P4 event code 0x%lx out of range\n", counter_config[ctr].event); return; } - + ev = &(p4_events[counter_config[ctr].event - 1]); - + for (i = 0; i < maxbind; i++) { if (ev->bindings[i].virt_counter & counter_bit) { @@ -525,24 +526,25 @@ static void pmc_setup_one_p4_counter(unsigned int ctr) ESCR_SET_OS_1(escr, counter_config[ctr].kernel); } ESCR_SET_EVENT_SELECT(escr, ev->event_select); - ESCR_SET_EVENT_MASK(escr, counter_config[ctr].unit_mask); + ESCR_SET_EVENT_MASK(escr, counter_config[ctr].unit_mask); ESCR_WRITE(escr, high, ev, i); - + /* modify CCCR */ CCCR_READ(cccr, high, VIRT_CTR(stag, ctr)); CCCR_CLEAR(cccr); CCCR_SET_REQUIRED_BITS(cccr); CCCR_SET_ESCR_SELECT(cccr, ev->escr_select); - if (stag == 0) + if (stag == 0) { CCCR_SET_PMI_OVF_0(cccr); - else + } else { CCCR_SET_PMI_OVF_1(cccr); + } CCCR_WRITE(cccr, high, VIRT_CTR(stag, ctr)); return; } } - printk(KERN_ERR + printk(KERN_ERR "oprofile: P4 event code 0x%lx no binding, stag %d ctr %d\n", counter_config[ctr].event, stag, ctr); } @@ -557,14 +559,14 @@ static void p4_setup_ctrs(struct op_msrs const * const msrs) stag = get_stagger(); rdmsr(MSR_IA32_MISC_ENABLE, low, high); - if (!MISC_PMC_ENABLED_P(low)) { + if (! MISC_PMC_ENABLED_P(low)) { printk(KERN_ERR "oprofile: P4 PMC not available\n"); return; } /* clear the cccrs we will use */ for (i = 0 ; i < num_counters ; i++) { - if (unlikely(!CTRL_IS_RESERVED(msrs, i))) + if (unlikely(!CTRL_IS_RESERVED(msrs,i))) continue; rdmsr(p4_counters[VIRT_CTR(stag, i)].cccr_address, low, high); CCCR_CLEAR(low); @@ -574,14 +576,14 @@ static void p4_setup_ctrs(struct op_msrs const * const msrs) /* clear all escrs (including those outside our concern) */ for (i = num_counters; i < num_controls; i++) { - if (unlikely(!CTRL_IS_RESERVED(msrs, i))) + if (unlikely(!CTRL_IS_RESERVED(msrs,i))) continue; wrmsr(msrs->controls[i].addr, 0, 0); } /* setup all counters */ for (i = 0 ; i < num_counters ; ++i) { - if ((counter_config[i].enabled) && (CTRL_IS_RESERVED(msrs, i))) { + if ((counter_config[i].enabled) && (CTRL_IS_RESERVED(msrs,i))) { reset_value[i] = counter_config[i].count; pmc_setup_one_p4_counter(i); CTR_WRITE(counter_config[i].count, VIRT_CTR(stag, i)); @@ -601,11 +603,11 @@ static int p4_check_ctrs(struct pt_regs * const regs, stag = get_stagger(); for (i = 0; i < num_counters; ++i) { - - if (!reset_value[i]) + + if (!reset_value[i]) continue; - /* + /* * there is some eccentricity in the hardware which * requires that we perform 2 extra corrections: * @@ -614,24 +616,24 @@ static int p4_check_ctrs(struct pt_regs * const regs, * * - write the counter back twice to ensure it gets * updated properly. - * + * * the former seems to be related to extra NMIs happening * during the current NMI; the latter is reported as errata * N15 in intel doc 249199-029, pentium 4 specification * update, though their suggested work-around does not * appear to solve the problem. */ - + real = VIRT_CTR(stag, i); CCCR_READ(low, high, real); - CTR_READ(ctr, high, real); + CTR_READ(ctr, high, real); if (CCCR_OVF_P(low) || CTR_OVERFLOW_P(ctr)) { oprofile_add_sample(regs, i); - CTR_WRITE(reset_value[i], real); + CTR_WRITE(reset_value[i], real); CCCR_CLEAR_OVF(low); CCCR_WRITE(low, high, real); - CTR_WRITE(reset_value[i], real); + CTR_WRITE(reset_value[i], real); } } @@ -681,16 +683,15 @@ static void p4_shutdown(struct op_msrs const * const msrs) int i; for (i = 0 ; i < num_counters ; ++i) { - if (CTR_IS_RESERVED(msrs, i)) + if (CTR_IS_RESERVED(msrs,i)) release_perfctr_nmi(msrs->counters[i].addr); } - /* - * some of the control registers are specially reserved in + /* some of the control registers are specially reserved in * conjunction with the counter registers (hence the starting offset). * This saves a few bits. */ for (i = num_counters ; i < num_controls ; ++i) { - if (CTRL_IS_RESERVED(msrs, i)) + if (CTRL_IS_RESERVED(msrs,i)) release_evntsel_nmi(msrs->controls[i].addr); } } diff --git a/trunk/arch/x86/pci/amd_bus.c b/trunk/arch/x86/pci/amd_bus.c index 22e057665e55..6a0fca78c362 100644 --- a/trunk/arch/x86/pci/amd_bus.c +++ b/trunk/arch/x86/pci/amd_bus.c @@ -580,7 +580,7 @@ static int __cpuinit amd_cpu_notify(struct notifier_block *self, unsigned long action, void *hcpu) { int cpu = (long)hcpu; - switch (action) { + switch(action) { case CPU_ONLINE: case CPU_ONLINE_FROZEN: smp_call_function_single(cpu, enable_pci_io_ecs, NULL, 0); diff --git a/trunk/arch/x86/pci/irq.c b/trunk/arch/x86/pci/irq.c index 006599db0dc7..8e077185e185 100644 --- a/trunk/arch/x86/pci/irq.c +++ b/trunk/arch/x86/pci/irq.c @@ -1043,44 +1043,35 @@ static void __init pcibios_fixup_irqs(void) if (io_apic_assign_pci_irqs) { int irq; - if (!pin) - continue; - - /* - * interrupt pins are numbered starting from 1 - */ - pin--; - irq = IO_APIC_get_PCI_irq_vector(dev->bus->number, - PCI_SLOT(dev->devfn), pin); - /* - * Busses behind bridges are typically not listed in the - * MP-table. In this case we have to look up the IRQ - * based on the parent bus, parent slot, and pin number. - * The SMP code detects such bridged busses itself so we - * should get into this branch reliably. - */ - if (irq < 0 && dev->bus->parent) { - /* go back to the bridge */ - struct pci_dev *bridge = dev->bus->self; - int bus; - - pin = (pin + PCI_SLOT(dev->devfn)) % 4; - bus = bridge->bus->number; - irq = IO_APIC_get_PCI_irq_vector(bus, - PCI_SLOT(bridge->devfn), pin); - if (irq >= 0) - dev_warn(&dev->dev, - "using bridge %s INT %c to " - "get IRQ %d\n", - pci_name(bridge), - 'A' + pin, irq); - } - if (irq >= 0) { - dev_info(&dev->dev, - "PCI->APIC IRQ transform: INT %c " - "-> IRQ %d\n", - 'A' + pin, irq); - dev->irq = irq; + if (pin) { + /* + * interrupt pins are numbered starting + * from 1 + */ + pin--; + irq = IO_APIC_get_PCI_irq_vector(dev->bus->number, + PCI_SLOT(dev->devfn), pin); + /* + * Busses behind bridges are typically not listed in the MP-table. + * In this case we have to look up the IRQ based on the parent bus, + * parent slot, and pin number. The SMP code detects such bridged + * busses itself so we should get into this branch reliably. + */ + if (irq < 0 && dev->bus->parent) { /* go back to the bridge */ + struct pci_dev *bridge = dev->bus->self; + + pin = (pin + PCI_SLOT(dev->devfn)) % 4; + irq = IO_APIC_get_PCI_irq_vector(bridge->bus->number, + PCI_SLOT(bridge->devfn), pin); + if (irq >= 0) + dev_warn(&dev->dev, "using bridge %s INT %c to get IRQ %d\n", + pci_name(bridge), + 'A' + pin, irq); + } + if (irq >= 0) { + dev_info(&dev->dev, "PCI->APIC IRQ transform: INT %c -> IRQ %d\n", 'A' + pin, irq); + dev->irq = irq; + } } } #endif diff --git a/trunk/arch/x86/power/hibernate_asm_32.S b/trunk/arch/x86/power/hibernate_asm_32.S index d1e9b53f9d33..4fc7e872c85e 100644 --- a/trunk/arch/x86/power/hibernate_asm_32.S +++ b/trunk/arch/x86/power/hibernate_asm_32.S @@ -1,3 +1,5 @@ +.text + /* * This may not use any stack, nor any variable that is not "NoSave": * @@ -10,18 +12,17 @@ #include #include #include -#include -.text + .text ENTRY(swsusp_arch_suspend) + movl %esp, saved_context_esp movl %ebx, saved_context_ebx movl %ebp, saved_context_ebp movl %esi, saved_context_esi movl %edi, saved_context_edi - pushfl - popl saved_context_eflags + pushfl ; popl saved_context_eflags call swsusp_save ret @@ -58,7 +59,7 @@ done: movl mmu_cr4_features, %ecx jecxz 1f # cr4 Pentium and higher, skip if zero movl %ecx, %edx - andl $~(X86_CR4_PGE), %edx + andl $~(1<<7), %edx; # PGE movl %edx, %cr4; # turn off PGE 1: movl %cr3, %eax; # flush TLB @@ -73,8 +74,7 @@ done: movl saved_context_esi, %esi movl saved_context_edi, %edi - pushl saved_context_eflags - popfl + pushl saved_context_eflags ; popfl xorl %eax, %eax diff --git a/trunk/arch/x86/xen/enlighten.c b/trunk/arch/x86/xen/enlighten.c index 7dcd321a0508..a4e201b47f64 100644 --- a/trunk/arch/x86/xen/enlighten.c +++ b/trunk/arch/x86/xen/enlighten.c @@ -812,7 +812,7 @@ static int xen_write_msr_safe(unsigned int msr, unsigned low, unsigned high) /* Early in boot, while setting up the initial pagetable, assume everything is pinned. */ -static __init void xen_alloc_pte_init(struct mm_struct *mm, unsigned long pfn) +static __init void xen_alloc_pte_init(struct mm_struct *mm, u32 pfn) { #ifdef CONFIG_FLATMEM BUG_ON(mem_map); /* should only be used early */ @@ -822,7 +822,7 @@ static __init void xen_alloc_pte_init(struct mm_struct *mm, unsigned long pfn) /* Early release_pte assumes that all pts are pinned, since there's only init_mm and anything attached to that is pinned. */ -static void xen_release_pte_init(unsigned long pfn) +static void xen_release_pte_init(u32 pfn) { make_lowmem_page_readwrite(__va(PFN_PHYS(pfn))); } @@ -838,7 +838,7 @@ static void pin_pagetable_pfn(unsigned cmd, unsigned long pfn) /* This needs to make sure the new pte page is pinned iff its being attached to a pinned pagetable. */ -static void xen_alloc_ptpage(struct mm_struct *mm, unsigned long pfn, unsigned level) +static void xen_alloc_ptpage(struct mm_struct *mm, u32 pfn, unsigned level) { struct page *page = pfn_to_page(pfn); @@ -856,12 +856,12 @@ static void xen_alloc_ptpage(struct mm_struct *mm, unsigned long pfn, unsigned l } } -static void xen_alloc_pte(struct mm_struct *mm, unsigned long pfn) +static void xen_alloc_pte(struct mm_struct *mm, u32 pfn) { xen_alloc_ptpage(mm, pfn, PT_PTE); } -static void xen_alloc_pmd(struct mm_struct *mm, unsigned long pfn) +static void xen_alloc_pmd(struct mm_struct *mm, u32 pfn) { xen_alloc_ptpage(mm, pfn, PT_PMD); } @@ -909,7 +909,7 @@ static void xen_pgd_free(struct mm_struct *mm, pgd_t *pgd) } /* This should never happen until we're OK to use struct page */ -static void xen_release_ptpage(unsigned long pfn, unsigned level) +static void xen_release_ptpage(u32 pfn, unsigned level) { struct page *page = pfn_to_page(pfn); @@ -923,23 +923,23 @@ static void xen_release_ptpage(unsigned long pfn, unsigned level) } } -static void xen_release_pte(unsigned long pfn) +static void xen_release_pte(u32 pfn) { xen_release_ptpage(pfn, PT_PTE); } -static void xen_release_pmd(unsigned long pfn) +static void xen_release_pmd(u32 pfn) { xen_release_ptpage(pfn, PT_PMD); } #if PAGETABLE_LEVELS == 4 -static void xen_alloc_pud(struct mm_struct *mm, unsigned long pfn) +static void xen_alloc_pud(struct mm_struct *mm, u32 pfn) { xen_alloc_ptpage(mm, pfn, PT_PUD); } -static void xen_release_pud(unsigned long pfn) +static void xen_release_pud(u32 pfn) { xen_release_ptpage(pfn, PT_PUD); } diff --git a/trunk/block/scsi_ioctl.c b/trunk/block/scsi_ioctl.c index ec4b7f234626..3aab80a4c484 100644 --- a/trunk/block/scsi_ioctl.c +++ b/trunk/block/scsi_ioctl.c @@ -185,6 +185,7 @@ void blk_set_cmd_filter_defaults(struct blk_cmd_filter *filter) __set_bit(GPCMD_PREVENT_ALLOW_MEDIUM_REMOVAL, filter->write_ok); __set_bit(GPCMD_LOAD_UNLOAD, filter->write_ok); __set_bit(GPCMD_SET_STREAMING, filter->write_ok); + __set_bit(GPCMD_SET_READ_AHEAD, filter->write_ok); } EXPORT_SYMBOL_GPL(blk_set_cmd_filter_defaults); diff --git a/trunk/drivers/ata/Kconfig b/trunk/drivers/ata/Kconfig index f17cd4b572f8..11c8c19f0fb7 100644 --- a/trunk/drivers/ata/Kconfig +++ b/trunk/drivers/ata/Kconfig @@ -663,7 +663,7 @@ config HAVE_PATA_PLATFORM config PATA_PLATFORM tristate "Generic platform device PATA support" - depends on EMBEDDED || PPC || HAVE_PATA_PLATFORM + depends on EMBEDDED || ARCH_RPC || PPC || HAVE_PATA_PLATFORM help This option enables support for generic directly connected ATA devices commonly found on embedded systems. diff --git a/trunk/drivers/ata/ahci.c b/trunk/drivers/ata/ahci.c index aeadd00411a1..2e1a7cb2ed5f 100644 --- a/trunk/drivers/ata/ahci.c +++ b/trunk/drivers/ata/ahci.c @@ -267,8 +267,8 @@ struct ahci_port_priv { * per PM slot */ }; -static int ahci_scr_read(struct ata_link *link, unsigned int sc_reg, u32 *val); -static int ahci_scr_write(struct ata_link *link, unsigned int sc_reg, u32 val); +static int ahci_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val); +static int ahci_scr_write(struct ata_port *ap, unsigned int sc_reg, u32 val); static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent); static unsigned int ahci_qc_issue(struct ata_queued_cmd *qc); static bool ahci_qc_fill_rtf(struct ata_queued_cmd *qc); @@ -316,7 +316,6 @@ static struct device_attribute *ahci_shost_attrs[] = { static struct device_attribute *ahci_sdev_attrs[] = { &dev_attr_sw_activity, - &dev_attr_unload_heads, NULL }; @@ -821,10 +820,10 @@ static unsigned ahci_scr_offset(struct ata_port *ap, unsigned int sc_reg) return 0; } -static int ahci_scr_read(struct ata_link *link, unsigned int sc_reg, u32 *val) +static int ahci_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val) { - void __iomem *port_mmio = ahci_port_base(link->ap); - int offset = ahci_scr_offset(link->ap, sc_reg); + void __iomem *port_mmio = ahci_port_base(ap); + int offset = ahci_scr_offset(ap, sc_reg); if (offset) { *val = readl(port_mmio + offset); @@ -833,10 +832,10 @@ static int ahci_scr_read(struct ata_link *link, unsigned int sc_reg, u32 *val) return -EINVAL; } -static int ahci_scr_write(struct ata_link *link, unsigned int sc_reg, u32 val) +static int ahci_scr_write(struct ata_port *ap, unsigned int sc_reg, u32 val) { - void __iomem *port_mmio = ahci_port_base(link->ap); - int offset = ahci_scr_offset(link->ap, sc_reg); + void __iomem *port_mmio = ahci_port_base(ap); + int offset = ahci_scr_offset(ap, sc_reg); if (offset) { writel(val, port_mmio + offset); @@ -974,7 +973,7 @@ static void ahci_disable_alpm(struct ata_port *ap) writel(PORT_IRQ_PHYRDY, port_mmio + PORT_IRQ_STAT); /* go ahead and clean out PhyRdy Change from Serror too */ - ahci_scr_write(&ap->link, SCR_ERROR, ((1 << 16) | (1 << 18))); + ahci_scr_write(ap, SCR_ERROR, ((1 << 16) | (1 << 18))); /* * Clear flag to indicate that we should ignore all PhyRdy @@ -1938,8 +1937,8 @@ static void ahci_error_intr(struct ata_port *ap, u32 irq_stat) ata_ehi_push_desc(host_ehi, "irq_stat 0x%08x", irq_stat); /* AHCI needs SError cleared; otherwise, it might lock up */ - ahci_scr_read(&ap->link, SCR_ERROR, &serror); - ahci_scr_write(&ap->link, SCR_ERROR, serror); + ahci_scr_read(ap, SCR_ERROR, &serror); + ahci_scr_write(ap, SCR_ERROR, serror); host_ehi->serror |= serror; /* some controllers set IRQ_IF_ERR on device errors, ignore it */ @@ -2028,7 +2027,7 @@ static void ahci_port_intr(struct ata_port *ap) if ((hpriv->flags & AHCI_HFLAG_NO_HOTPLUG) && (status & PORT_IRQ_PHYRDY)) { status &= ~PORT_IRQ_PHYRDY; - ahci_scr_write(&ap->link, SCR_ERROR, ((1 << 16) | (1 << 18))); + ahci_scr_write(ap, SCR_ERROR, ((1 << 16) | (1 << 18))); } if (unlikely(status & PORT_IRQ_ERROR)) { diff --git a/trunk/drivers/ata/ata_piix.c b/trunk/drivers/ata/ata_piix.c index e9e32ed6b1a3..e6b4606e36b6 100644 --- a/trunk/drivers/ata/ata_piix.c +++ b/trunk/drivers/ata/ata_piix.c @@ -165,10 +165,8 @@ static void piix_set_dmamode(struct ata_port *ap, struct ata_device *adev); static void ich_set_dmamode(struct ata_port *ap, struct ata_device *adev); static int ich_pata_cable_detect(struct ata_port *ap); static u8 piix_vmw_bmdma_status(struct ata_port *ap); -static int piix_sidpr_scr_read(struct ata_link *link, - unsigned int reg, u32 *val); -static int piix_sidpr_scr_write(struct ata_link *link, - unsigned int reg, u32 val); +static int piix_sidpr_scr_read(struct ata_port *ap, unsigned int reg, u32 *val); +static int piix_sidpr_scr_write(struct ata_port *ap, unsigned int reg, u32 val); #ifdef CONFIG_PM static int piix_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg); static int piix_pci_device_resume(struct pci_dev *pdev); @@ -280,15 +278,12 @@ static const struct pci_device_id piix_pci_tbl[] = { /* SATA Controller IDE (PCH) */ { 0x8086, 0x3b20, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata }, /* SATA Controller IDE (PCH) */ - { 0x8086, 0x3b21, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, - /* SATA Controller IDE (PCH) */ { 0x8086, 0x3b26, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, /* SATA Controller IDE (PCH) */ - { 0x8086, 0x3b28, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata }, - /* SATA Controller IDE (PCH) */ { 0x8086, 0x3b2d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, /* SATA Controller IDE (PCH) */ { 0x8086, 0x3b2e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata }, + { } /* terminate list */ }; @@ -587,7 +582,6 @@ static const struct ich_laptop ich_laptop[] = { { 0x27DF, 0x1025, 0x0110 }, /* ICH7 on Acer 3682WLMi */ { 0x27DF, 0x1043, 0x1267 }, /* ICH7 on Asus W5F */ { 0x27DF, 0x103C, 0x30A1 }, /* ICH7 on HP Compaq nc2400 */ - { 0x27DF, 0x1071, 0xD221 }, /* ICH7 on Hercules EC-900 */ { 0x24CA, 0x1025, 0x0061 }, /* ICH4 on ACER Aspire 2023WLMi */ { 0x24CA, 0x1025, 0x003d }, /* ICH4 on ACER TM290 */ { 0x266F, 0x1025, 0x0066 }, /* ICH6 on ACER Aspire 1694WLMi */ @@ -891,9 +885,23 @@ static void ich_set_dmamode(struct ata_port *ap, struct ata_device *adev) * Serial ATA Index/Data Pair Superset Registers access * * Beginning from ICH8, there's a sane way to access SCRs using index - * and data register pair located at BAR5 which means that we have - * separate SCRs for master and slave. This is handled using libata - * slave_link facility. + * and data register pair located at BAR5. This creates an + * interesting problem of mapping two SCRs to one port. + * + * Although they have separate SCRs, the master and slave aren't + * independent enough to be treated as separate links - e.g. softreset + * resets both. Also, there's no protocol defined for hard resetting + * singled device sharing the virtual port (no defined way to acquire + * device signature). This is worked around by merging the SCR values + * into one sensible value and requesting follow-up SRST after + * hardreset. + * + * SCR merging is perfomed in nibbles which is the unit contents in + * SCRs are organized. If two values are equal, the value is used. + * When they differ, merge table which lists precedence of possible + * values is consulted and the first match or the last entry when + * nothing matches is used. When there's no merge table for the + * specific nibble, value from the first port is used. */ static const int piix_sidx_map[] = { [SCR_STATUS] = 0, @@ -901,38 +909,120 @@ static const int piix_sidx_map[] = { [SCR_CONTROL] = 1, }; -static void piix_sidpr_sel(struct ata_link *link, unsigned int reg) +static void piix_sidpr_sel(struct ata_device *dev, unsigned int reg) { - struct ata_port *ap = link->ap; + struct ata_port *ap = dev->link->ap; struct piix_host_priv *hpriv = ap->host->private_data; - iowrite32(((ap->port_no * 2 + link->pmp) << 8) | piix_sidx_map[reg], + iowrite32(((ap->port_no * 2 + dev->devno) << 8) | piix_sidx_map[reg], hpriv->sidpr + PIIX_SIDPR_IDX); } -static int piix_sidpr_scr_read(struct ata_link *link, - unsigned int reg, u32 *val) +static int piix_sidpr_read(struct ata_device *dev, unsigned int reg) +{ + struct piix_host_priv *hpriv = dev->link->ap->host->private_data; + + piix_sidpr_sel(dev, reg); + return ioread32(hpriv->sidpr + PIIX_SIDPR_DATA); +} + +static void piix_sidpr_write(struct ata_device *dev, unsigned int reg, u32 val) +{ + struct piix_host_priv *hpriv = dev->link->ap->host->private_data; + + piix_sidpr_sel(dev, reg); + iowrite32(val, hpriv->sidpr + PIIX_SIDPR_DATA); +} + +static u32 piix_merge_scr(u32 val0, u32 val1, const int * const *merge_tbl) +{ + u32 val = 0; + int i, mi; + + for (i = 0, mi = 0; i < 32 / 4; i++) { + u8 c0 = (val0 >> (i * 4)) & 0xf; + u8 c1 = (val1 >> (i * 4)) & 0xf; + u8 merged = c0; + const int *cur; + + /* if no merge preference, assume the first value */ + cur = merge_tbl[mi]; + if (!cur) + goto done; + mi++; + + /* if two values equal, use it */ + if (c0 == c1) + goto done; + + /* choose the first match or the last from the merge table */ + while (*cur != -1) { + if (c0 == *cur || c1 == *cur) + break; + cur++; + } + if (*cur == -1) + cur--; + merged = *cur; + done: + val |= merged << (i * 4); + } + + return val; +} + +static int piix_sidpr_scr_read(struct ata_port *ap, unsigned int reg, u32 *val) { - struct piix_host_priv *hpriv = link->ap->host->private_data; + const int * const sstatus_merge_tbl[] = { + /* DET */ (const int []){ 1, 3, 0, 4, 3, -1 }, + /* SPD */ (const int []){ 2, 1, 0, -1 }, + /* IPM */ (const int []){ 6, 2, 1, 0, -1 }, + NULL, + }; + const int * const scontrol_merge_tbl[] = { + /* DET */ (const int []){ 1, 0, 4, 0, -1 }, + /* SPD */ (const int []){ 0, 2, 1, 0, -1 }, + /* IPM */ (const int []){ 0, 1, 2, 3, 0, -1 }, + NULL, + }; + u32 v0, v1; if (reg >= ARRAY_SIZE(piix_sidx_map)) return -EINVAL; - piix_sidpr_sel(link, reg); - *val = ioread32(hpriv->sidpr + PIIX_SIDPR_DATA); + if (!(ap->flags & ATA_FLAG_SLAVE_POSS)) { + *val = piix_sidpr_read(&ap->link.device[0], reg); + return 0; + } + + v0 = piix_sidpr_read(&ap->link.device[0], reg); + v1 = piix_sidpr_read(&ap->link.device[1], reg); + + switch (reg) { + case SCR_STATUS: + *val = piix_merge_scr(v0, v1, sstatus_merge_tbl); + break; + case SCR_ERROR: + *val = v0 | v1; + break; + case SCR_CONTROL: + *val = piix_merge_scr(v0, v1, scontrol_merge_tbl); + break; + } + return 0; } -static int piix_sidpr_scr_write(struct ata_link *link, - unsigned int reg, u32 val) +static int piix_sidpr_scr_write(struct ata_port *ap, unsigned int reg, u32 val) { - struct piix_host_priv *hpriv = link->ap->host->private_data; - if (reg >= ARRAY_SIZE(piix_sidx_map)) return -EINVAL; - piix_sidpr_sel(link, reg); - iowrite32(val, hpriv->sidpr + PIIX_SIDPR_DATA); + piix_sidpr_write(&ap->link.device[0], reg, val); + + if (ap->flags & ATA_FLAG_SLAVE_POSS) + piix_sidpr_write(&ap->link.device[1], reg, val); + return 0; } @@ -1273,28 +1363,28 @@ static const int *__devinit piix_init_sata_map(struct pci_dev *pdev, return map; } -static int __devinit piix_init_sidpr(struct ata_host *host) +static void __devinit piix_init_sidpr(struct ata_host *host) { struct pci_dev *pdev = to_pci_dev(host->dev); struct piix_host_priv *hpriv = host->private_data; - struct ata_link *link0 = &host->ports[0]->link; + struct ata_device *dev0 = &host->ports[0]->link.device[0]; u32 scontrol; - int i, rc; + int i; /* check for availability */ for (i = 0; i < 4; i++) if (hpriv->map[i] == IDE) - return 0; + return; if (!(host->ports[0]->flags & PIIX_FLAG_SIDPR)) - return 0; + return; if (pci_resource_start(pdev, PIIX_SIDPR_BAR) == 0 || pci_resource_len(pdev, PIIX_SIDPR_BAR) != PIIX_SIDPR_LEN) - return 0; + return; if (pcim_iomap_regions(pdev, 1 << PIIX_SIDPR_BAR, DRV_NAME)) - return 0; + return; hpriv->sidpr = pcim_iomap_table(pdev)[PIIX_SIDPR_BAR]; @@ -1302,7 +1392,7 @@ static int __devinit piix_init_sidpr(struct ata_host *host) * Give it a test drive by inhibiting power save modes which * we'll do anyway. */ - piix_sidpr_scr_read(link0, SCR_CONTROL, &scontrol); + scontrol = piix_sidpr_read(dev0, SCR_CONTROL); /* if IPM is already 3, SCR access is probably working. Don't * un-inhibit power save modes as BIOS might have inhibited @@ -1310,30 +1400,18 @@ static int __devinit piix_init_sidpr(struct ata_host *host) */ if ((scontrol & 0xf00) != 0x300) { scontrol |= 0x300; - piix_sidpr_scr_write(link0, SCR_CONTROL, scontrol); - piix_sidpr_scr_read(link0, SCR_CONTROL, &scontrol); + piix_sidpr_write(dev0, SCR_CONTROL, scontrol); + scontrol = piix_sidpr_read(dev0, SCR_CONTROL); if ((scontrol & 0xf00) != 0x300) { dev_printk(KERN_INFO, host->dev, "SCR access via " "SIDPR is available but doesn't work\n"); - return 0; + return; } } - /* okay, SCRs available, set ops and ask libata for slave_link */ - for (i = 0; i < 2; i++) { - struct ata_port *ap = host->ports[i]; - - ap->ops = &piix_sidpr_sata_ops; - - if (ap->flags & ATA_FLAG_SLAVE_POSS) { - rc = ata_slave_link_init(ap); - if (rc) - return rc; - } - } - - return 0; + host->ports[0]->ops = &piix_sidpr_sata_ops; + host->ports[1]->ops = &piix_sidpr_sata_ops; } static void piix_iocfg_bit18_quirk(struct pci_dev *pdev) @@ -1443,9 +1521,7 @@ static int __devinit piix_init_one(struct pci_dev *pdev, /* initialize controller */ if (port_flags & ATA_FLAG_SATA) { piix_init_pcs(host, piix_map_db_table[ent->driver_data]); - rc = piix_init_sidpr(host); - if (rc) - return rc; + piix_init_sidpr(host); } /* apply IOCFG bit18 quirk */ diff --git a/trunk/drivers/ata/libata-core.c b/trunk/drivers/ata/libata-core.c index 1ee9499bd343..79e3a8e7a84a 100644 --- a/trunk/drivers/ata/libata-core.c +++ b/trunk/drivers/ata/libata-core.c @@ -163,67 +163,6 @@ MODULE_LICENSE("GPL"); MODULE_VERSION(DRV_VERSION); -/* - * Iterator helpers. Don't use directly. - * - * LOCKING: - * Host lock or EH context. - */ -struct ata_link *__ata_port_next_link(struct ata_port *ap, - struct ata_link *link, bool dev_only) -{ - /* NULL link indicates start of iteration */ - if (!link) { - if (dev_only && sata_pmp_attached(ap)) - return ap->pmp_link; - return &ap->link; - } - - /* we just iterated over the host master link, what's next? */ - if (link == &ap->link) { - if (!sata_pmp_attached(ap)) { - if (unlikely(ap->slave_link) && !dev_only) - return ap->slave_link; - return NULL; - } - return ap->pmp_link; - } - - /* slave_link excludes PMP */ - if (unlikely(link == ap->slave_link)) - return NULL; - - /* iterate to the next PMP link */ - if (++link < ap->pmp_link + ap->nr_pmp_links) - return link; - return NULL; -} - -/** - * ata_dev_phys_link - find physical link for a device - * @dev: ATA device to look up physical link for - * - * Look up physical link which @dev is attached to. Note that - * this is different from @dev->link only when @dev is on slave - * link. For all other cases, it's the same as @dev->link. - * - * LOCKING: - * Don't care. - * - * RETURNS: - * Pointer to the found physical link. - */ -struct ata_link *ata_dev_phys_link(struct ata_device *dev) -{ - struct ata_port *ap = dev->link->ap; - - if (!ap->slave_link) - return dev->link; - if (!dev->devno) - return &ap->link; - return ap->slave_link; -} - /** * ata_force_cbl - force cable type according to libata.force * @ap: ATA port of interest @@ -267,8 +206,7 @@ void ata_force_cbl(struct ata_port *ap) * the host link and all fan-out ports connected via PMP. If the * device part is specified as 0 (e.g. 1.00:), it specifies the * first fan-out link not the host link. Device number 15 always - * points to the host link whether PMP is attached or not. If the - * controller has slave link, device number 16 points to it. + * points to the host link whether PMP is attached or not. * * LOCKING: * EH context. @@ -276,11 +214,12 @@ void ata_force_cbl(struct ata_port *ap) static void ata_force_link_limits(struct ata_link *link) { bool did_spd = false; - int linkno = link->pmp; - int i; + int linkno, i; if (ata_is_host_link(link)) - linkno += 15; + linkno = 15; + else + linkno = link->pmp; for (i = ata_force_tbl_size - 1; i >= 0; i--) { const struct ata_force_ent *fe = &ata_force_tbl[i]; @@ -327,9 +266,9 @@ static void ata_force_xfermask(struct ata_device *dev) int alt_devno = devno; int i; - /* allow n.15/16 for devices attached to host port */ - if (ata_is_host_link(dev->link)) - alt_devno += 15; + /* allow n.15 for the first device attached to host port */ + if (ata_is_host_link(dev->link) && devno == 0) + alt_devno = 15; for (i = ata_force_tbl_size - 1; i >= 0; i--) { const struct ata_force_ent *fe = &ata_force_tbl[i]; @@ -381,9 +320,9 @@ static void ata_force_horkage(struct ata_device *dev) int alt_devno = devno; int i; - /* allow n.15/16 for devices attached to host port */ - if (ata_is_host_link(dev->link)) - alt_devno += 15; + /* allow n.15 for the first device attached to host port */ + if (ata_is_host_link(dev->link) && devno == 0) + alt_devno = 15; for (i = 0; i < ata_force_tbl_size; i++) { const struct ata_force_ent *fe = &ata_force_tbl[i]; @@ -2742,7 +2681,7 @@ static void sata_print_link_status(struct ata_link *link) return; sata_scr_read(link, SCR_CONTROL, &scontrol); - if (ata_phys_link_online(link)) { + if (ata_link_online(link)) { tmp = (sstatus >> 4) & 0xf; ata_link_printk(link, KERN_INFO, "SATA link up %s (SStatus %X SControl %X)\n", @@ -3433,12 +3372,6 @@ int ata_wait_ready(struct ata_link *link, unsigned long deadline, unsigned long nodev_deadline = ata_deadline(start, ATA_TMOUT_FF_WAIT); int warned = 0; - /* Slave readiness can't be tested separately from master. On - * M/S emulation configuration, this function should be called - * only on the master and it will handle both master and slave. - */ - WARN_ON(link == link->ap->slave_link); - if (time_after(nodev_deadline, deadline)) nodev_deadline = deadline; @@ -3660,7 +3593,7 @@ int ata_std_prereset(struct ata_link *link, unsigned long deadline) } /* no point in trying softreset on offline link */ - if (ata_phys_link_offline(link)) + if (ata_link_offline(link)) ehc->i.action &= ~ATA_EH_SOFTRESET; return 0; @@ -3738,7 +3671,7 @@ int sata_link_hardreset(struct ata_link *link, const unsigned long *timing, if (rc) goto out; /* if link is offline nothing more to do */ - if (ata_phys_link_offline(link)) + if (ata_link_offline(link)) goto out; /* Link is online. From this point, -ENODEV too is an error. */ @@ -4935,8 +4868,10 @@ int sata_scr_valid(struct ata_link *link) int sata_scr_read(struct ata_link *link, int reg, u32 *val) { if (ata_is_host_link(link)) { + struct ata_port *ap = link->ap; + if (sata_scr_valid(link)) - return link->ap->ops->scr_read(link, reg, val); + return ap->ops->scr_read(ap, reg, val); return -EOPNOTSUPP; } @@ -4962,8 +4897,10 @@ int sata_scr_read(struct ata_link *link, int reg, u32 *val) int sata_scr_write(struct ata_link *link, int reg, u32 val) { if (ata_is_host_link(link)) { + struct ata_port *ap = link->ap; + if (sata_scr_valid(link)) - return link->ap->ops->scr_write(link, reg, val); + return ap->ops->scr_write(ap, reg, val); return -EOPNOTSUPP; } @@ -4988,12 +4925,13 @@ int sata_scr_write(struct ata_link *link, int reg, u32 val) int sata_scr_write_flush(struct ata_link *link, int reg, u32 val) { if (ata_is_host_link(link)) { + struct ata_port *ap = link->ap; int rc; if (sata_scr_valid(link)) { - rc = link->ap->ops->scr_write(link, reg, val); + rc = ap->ops->scr_write(ap, reg, val); if (rc == 0) - rc = link->ap->ops->scr_read(link, reg, &val); + rc = ap->ops->scr_read(ap, reg, &val); return rc; } return -EOPNOTSUPP; @@ -5003,7 +4941,7 @@ int sata_scr_write_flush(struct ata_link *link, int reg, u32 val) } /** - * ata_phys_link_online - test whether the given link is online + * ata_link_online - test whether the given link is online * @link: ATA link to test * * Test whether @link is online. Note that this function returns @@ -5014,20 +4952,20 @@ int sata_scr_write_flush(struct ata_link *link, int reg, u32 val) * None. * * RETURNS: - * True if the port online status is available and online. + * 1 if the port online status is available and online. */ -bool ata_phys_link_online(struct ata_link *link) +int ata_link_online(struct ata_link *link) { u32 sstatus; if (sata_scr_read(link, SCR_STATUS, &sstatus) == 0 && (sstatus & 0xf) == 0x3) - return true; - return false; + return 1; + return 0; } /** - * ata_phys_link_offline - test whether the given link is offline + * ata_link_offline - test whether the given link is offline * @link: ATA link to test * * Test whether @link is offline. Note that this function @@ -5038,68 +4976,16 @@ bool ata_phys_link_online(struct ata_link *link) * None. * * RETURNS: - * True if the port offline status is available and offline. + * 1 if the port offline status is available and offline. */ -bool ata_phys_link_offline(struct ata_link *link) +int ata_link_offline(struct ata_link *link) { u32 sstatus; if (sata_scr_read(link, SCR_STATUS, &sstatus) == 0 && (sstatus & 0xf) != 0x3) - return true; - return false; -} - -/** - * ata_link_online - test whether the given link is online - * @link: ATA link to test - * - * Test whether @link is online. This is identical to - * ata_phys_link_online() when there's no slave link. When - * there's a slave link, this function should only be called on - * the master link and will return true if any of M/S links is - * online. - * - * LOCKING: - * None. - * - * RETURNS: - * True if the port online status is available and online. - */ -bool ata_link_online(struct ata_link *link) -{ - struct ata_link *slave = link->ap->slave_link; - - WARN_ON(link == slave); /* shouldn't be called on slave link */ - - return ata_phys_link_online(link) || - (slave && ata_phys_link_online(slave)); -} - -/** - * ata_link_offline - test whether the given link is offline - * @link: ATA link to test - * - * Test whether @link is offline. This is identical to - * ata_phys_link_offline() when there's no slave link. When - * there's a slave link, this function should only be called on - * the master link and will return true if both M/S links are - * offline. - * - * LOCKING: - * None. - * - * RETURNS: - * True if the port offline status is available and offline. - */ -bool ata_link_offline(struct ata_link *link) -{ - struct ata_link *slave = link->ap->slave_link; - - WARN_ON(link == slave); /* shouldn't be called on slave link */ - - return ata_phys_link_offline(link) && - (!slave || ata_phys_link_offline(slave)); + return 1; + return 0; } #ifdef CONFIG_PM @@ -5241,11 +5127,11 @@ int ata_port_start(struct ata_port *ap) */ void ata_dev_init(struct ata_device *dev) { - struct ata_link *link = ata_dev_phys_link(dev); + struct ata_link *link = dev->link; struct ata_port *ap = link->ap; unsigned long flags; - /* SATA spd limit is bound to the attached device, reset together */ + /* SATA spd limit is bound to the first device */ link->sata_spd_limit = link->hw_sata_spd_limit; link->sata_spd = 0; @@ -5378,7 +5264,6 @@ struct ata_port *ata_port_alloc(struct ata_host *host) INIT_WORK(&ap->scsi_rescan_task, ata_scsi_dev_rescan); INIT_LIST_HEAD(&ap->eh_done_q); init_waitqueue_head(&ap->eh_wait_q); - init_completion(&ap->park_req_pending); init_timer_deferrable(&ap->fastdrain_timer); ap->fastdrain_timer.function = ata_eh_fastdrain_timerfn; ap->fastdrain_timer.data = (unsigned long)ap; @@ -5409,7 +5294,6 @@ static void ata_host_release(struct device *gendev, void *res) scsi_host_put(ap->scsi_host); kfree(ap->pmp_link); - kfree(ap->slave_link); kfree(ap); host->ports[i] = NULL; } @@ -5530,68 +5414,6 @@ struct ata_host *ata_host_alloc_pinfo(struct device *dev, return host; } -/** - * ata_slave_link_init - initialize slave link - * @ap: port to initialize slave link for - * - * Create and initialize slave link for @ap. This enables slave - * link handling on the port. - * - * In libata, a port contains links and a link contains devices. - * There is single host link but if a PMP is attached to it, - * there can be multiple fan-out links. On SATA, there's usually - * a single device connected to a link but PATA and SATA - * controllers emulating TF based interface can have two - master - * and slave. - * - * However, there are a few controllers which don't fit into this - * abstraction too well - SATA controllers which emulate TF - * interface with both master and slave devices but also have - * separate SCR register sets for each device. These controllers - * need separate links for physical link handling - * (e.g. onlineness, link speed) but should be treated like a - * traditional M/S controller for everything else (e.g. command - * issue, softreset). - * - * slave_link is libata's way of handling this class of - * controllers without impacting core layer too much. For - * anything other than physical link handling, the default host - * link is used for both master and slave. For physical link - * handling, separate @ap->slave_link is used. All dirty details - * are implemented inside libata core layer. From LLD's POV, the - * only difference is that prereset, hardreset and postreset are - * called once more for the slave link, so the reset sequence - * looks like the following. - * - * prereset(M) -> prereset(S) -> hardreset(M) -> hardreset(S) -> - * softreset(M) -> postreset(M) -> postreset(S) - * - * Note that softreset is called only for the master. Softreset - * resets both M/S by definition, so SRST on master should handle - * both (the standard method will work just fine). - * - * LOCKING: - * Should be called before host is registered. - * - * RETURNS: - * 0 on success, -errno on failure. - */ -int ata_slave_link_init(struct ata_port *ap) -{ - struct ata_link *link; - - WARN_ON(ap->slave_link); - WARN_ON(ap->flags & ATA_FLAG_PMP); - - link = kzalloc(sizeof(*link), GFP_KERNEL); - if (!link) - return -ENOMEM; - - ata_link_init(ap, link, 1); - ap->slave_link = link; - return 0; -} - static void ata_host_stop(struct device *gendev, void *res) { struct ata_host *host = dev_get_drvdata(gendev); @@ -5818,8 +5640,6 @@ int ata_host_register(struct ata_host *host, struct scsi_host_template *sht) /* init sata_spd_limit to the current value */ sata_link_init_spd(&ap->link); - if (ap->slave_link) - sata_link_init_spd(ap->slave_link); /* print per-port info to dmesg */ xfer_mask = ata_pack_xfermask(ap->pio_mask, ap->mwdma_mask, @@ -6440,12 +6260,10 @@ EXPORT_SYMBOL_GPL(ata_base_port_ops); EXPORT_SYMBOL_GPL(sata_port_ops); EXPORT_SYMBOL_GPL(ata_dummy_port_ops); EXPORT_SYMBOL_GPL(ata_dummy_port_info); -EXPORT_SYMBOL_GPL(__ata_port_next_link); EXPORT_SYMBOL_GPL(ata_std_bios_param); EXPORT_SYMBOL_GPL(ata_host_init); EXPORT_SYMBOL_GPL(ata_host_alloc); EXPORT_SYMBOL_GPL(ata_host_alloc_pinfo); -EXPORT_SYMBOL_GPL(ata_slave_link_init); EXPORT_SYMBOL_GPL(ata_host_start); EXPORT_SYMBOL_GPL(ata_host_register); EXPORT_SYMBOL_GPL(ata_host_activate); diff --git a/trunk/drivers/ata/libata-eh.c b/trunk/drivers/ata/libata-eh.c index f2dd99122bd6..c1db2f234d2e 100644 --- a/trunk/drivers/ata/libata-eh.c +++ b/trunk/drivers/ata/libata-eh.c @@ -79,8 +79,6 @@ enum { */ ATA_EH_PRERESET_TIMEOUT = 10000, ATA_EH_FASTDRAIN_INTERVAL = 3000, - - ATA_EH_UA_TRIES = 5, }; /* The following table determines how we sequence resets. Each entry @@ -1358,37 +1356,6 @@ static int ata_eh_read_log_10h(struct ata_device *dev, return 0; } -/** - * atapi_eh_tur - perform ATAPI TEST_UNIT_READY - * @dev: target ATAPI device - * @r_sense_key: out parameter for sense_key - * - * Perform ATAPI TEST_UNIT_READY. - * - * LOCKING: - * EH context (may sleep). - * - * RETURNS: - * 0 on success, AC_ERR_* mask on failure. - */ -static unsigned int atapi_eh_tur(struct ata_device *dev, u8 *r_sense_key) -{ - u8 cdb[ATAPI_CDB_LEN] = { TEST_UNIT_READY, 0, 0, 0, 0, 0 }; - struct ata_taskfile tf; - unsigned int err_mask; - - ata_tf_init(dev, &tf); - - tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE; - tf.command = ATA_CMD_PACKET; - tf.protocol = ATAPI_PROT_NODATA; - - err_mask = ata_exec_internal(dev, &tf, cdb, DMA_NONE, NULL, 0, 0); - if (err_mask == AC_ERR_DEV) - *r_sense_key = tf.feature >> 4; - return err_mask; -} - /** * atapi_eh_request_sense - perform ATAPI REQUEST_SENSE * @dev: device to perform REQUEST_SENSE to @@ -1789,7 +1756,7 @@ static unsigned int ata_eh_speed_down_verdict(struct ata_device *dev) static unsigned int ata_eh_speed_down(struct ata_device *dev, unsigned int eflags, unsigned int err_mask) { - struct ata_link *link = ata_dev_phys_link(dev); + struct ata_link *link = dev->link; int xfer_ok = 0; unsigned int verdict; unsigned int action = 0; @@ -1913,8 +1880,7 @@ static void ata_eh_link_autopsy(struct ata_link *link) for (tag = 0; tag < ATA_MAX_QUEUE; tag++) { struct ata_queued_cmd *qc = __ata_qc_from_tag(ap, tag); - if (!(qc->flags & ATA_QCFLAG_FAILED) || - ata_dev_phys_link(qc->dev) != link) + if (!(qc->flags & ATA_QCFLAG_FAILED) || qc->dev->link != link) continue; /* inherit upper level err_mask */ @@ -2001,23 +1967,6 @@ void ata_eh_autopsy(struct ata_port *ap) ata_port_for_each_link(link, ap) ata_eh_link_autopsy(link); - /* Handle the frigging slave link. Autopsy is done similarly - * but actions and flags are transferred over to the master - * link and handled from there. - */ - if (ap->slave_link) { - struct ata_eh_context *mehc = &ap->link.eh_context; - struct ata_eh_context *sehc = &ap->slave_link->eh_context; - - ata_eh_link_autopsy(ap->slave_link); - - ata_eh_about_to_do(ap->slave_link, NULL, ATA_EH_ALL_ACTIONS); - mehc->i.action |= sehc->i.action; - mehc->i.dev_action[1] |= sehc->i.dev_action[1]; - mehc->i.flags |= sehc->i.flags; - ata_eh_done(ap->slave_link, NULL, ATA_EH_ALL_ACTIONS); - } - /* Autopsy of fanout ports can affect host link autopsy. * Perform host link autopsy last. */ @@ -2052,8 +2001,7 @@ static void ata_eh_link_report(struct ata_link *link) for (tag = 0; tag < ATA_MAX_QUEUE; tag++) { struct ata_queued_cmd *qc = __ata_qc_from_tag(ap, tag); - if (!(qc->flags & ATA_QCFLAG_FAILED) || - ata_dev_phys_link(qc->dev) != link || + if (!(qc->flags & ATA_QCFLAG_FAILED) || qc->dev->link != link || ((qc->flags & ATA_QCFLAG_QUIET) && qc->err_mask == AC_ERR_DEV)) continue; @@ -2120,7 +2068,7 @@ static void ata_eh_link_report(struct ata_link *link) char cdb_buf[70] = ""; if (!(qc->flags & ATA_QCFLAG_FAILED) || - ata_dev_phys_link(qc->dev) != link || !qc->err_mask) + qc->dev->link != link || !qc->err_mask) continue; if (qc->dma_dir != DMA_NONE) { @@ -2212,14 +2160,12 @@ void ata_eh_report(struct ata_port *ap) } static int ata_do_reset(struct ata_link *link, ata_reset_fn_t reset, - unsigned int *classes, unsigned long deadline, - bool clear_classes) + unsigned int *classes, unsigned long deadline) { struct ata_device *dev; - if (clear_classes) - ata_link_for_each_dev(dev, link) - classes[dev->devno] = ATA_DEV_UNKNOWN; + ata_link_for_each_dev(dev, link) + classes[dev->devno] = ATA_DEV_UNKNOWN; return reset(link, classes, deadline); } @@ -2241,20 +2187,17 @@ int ata_eh_reset(struct ata_link *link, int classify, ata_reset_fn_t hardreset, ata_postreset_fn_t postreset) { struct ata_port *ap = link->ap; - struct ata_link *slave = ap->slave_link; struct ata_eh_context *ehc = &link->eh_context; - struct ata_eh_context *sehc = &slave->eh_context; unsigned int *classes = ehc->classes; unsigned int lflags = link->flags; int verbose = !(ehc->i.flags & ATA_EHI_QUIET); int max_tries = 0, try = 0; - struct ata_link *failed_link; struct ata_device *dev; unsigned long deadline, now; ata_reset_fn_t reset; unsigned long flags; u32 sstatus; - int nr_unknown, rc; + int nr_known, rc; /* * Prepare to reset @@ -2309,30 +2252,8 @@ int ata_eh_reset(struct ata_link *link, int classify, } if (prereset) { - unsigned long deadline = ata_deadline(jiffies, - ATA_EH_PRERESET_TIMEOUT); - - if (slave) { - sehc->i.action &= ~ATA_EH_RESET; - sehc->i.action |= ehc->i.action; - } - - rc = prereset(link, deadline); - - /* If present, do prereset on slave link too. Reset - * is skipped iff both master and slave links report - * -ENOENT or clear ATA_EH_RESET. - */ - if (slave && (rc == 0 || rc == -ENOENT)) { - int tmp; - - tmp = prereset(slave, deadline); - if (tmp != -ENOENT) - rc = tmp; - - ehc->i.action |= sehc->i.action; - } - + rc = prereset(link, + ata_deadline(jiffies, ATA_EH_PRERESET_TIMEOUT)); if (rc) { if (rc == -ENOENT) { ata_link_printk(link, KERN_DEBUG, @@ -2381,51 +2302,25 @@ int ata_eh_reset(struct ata_link *link, int classify, else ehc->i.flags |= ATA_EHI_DID_SOFTRESET; - rc = ata_do_reset(link, reset, classes, deadline, true); - if (rc && rc != -EAGAIN) { - failed_link = link; + rc = ata_do_reset(link, reset, classes, deadline); + if (rc && rc != -EAGAIN) goto fail; - } - - /* hardreset slave link if existent */ - if (slave && reset == hardreset) { - int tmp; - - if (verbose) - ata_link_printk(slave, KERN_INFO, - "hard resetting link\n"); - ata_eh_about_to_do(slave, NULL, ATA_EH_RESET); - tmp = ata_do_reset(slave, reset, classes, deadline, - false); - switch (tmp) { - case -EAGAIN: - rc = -EAGAIN; - case 0: - break; - default: - failed_link = slave; - rc = tmp; - goto fail; - } - } - - /* perform follow-up SRST if necessary */ if (reset == hardreset && ata_eh_followup_srst_needed(link, rc, classes)) { + /* okay, let's do follow-up softreset */ reset = softreset; if (!reset) { ata_link_printk(link, KERN_ERR, "follow-up softreset required " "but no softreset avaliable\n"); - failed_link = link; rc = -EINVAL; goto fail; } ata_eh_about_to_do(link, NULL, ATA_EH_RESET); - rc = ata_do_reset(link, reset, classes, deadline, true); + rc = ata_do_reset(link, reset, classes, deadline); } } else { if (verbose) @@ -2446,7 +2341,7 @@ int ata_eh_reset(struct ata_link *link, int classify, dev->pio_mode = XFER_PIO_0; dev->flags &= ~ATA_DFLAG_SLEEPING; - if (ata_phys_link_offline(ata_dev_phys_link(dev))) + if (ata_link_offline(link)) continue; /* apply class override */ @@ -2459,8 +2354,6 @@ int ata_eh_reset(struct ata_link *link, int classify, /* record current link speed */ if (sata_scr_read(link, SCR_STATUS, &sstatus) == 0) link->sata_spd = (sstatus >> 4) & 0xf; - if (slave && sata_scr_read(slave, SCR_STATUS, &sstatus) == 0) - slave->sata_spd = (sstatus >> 4) & 0xf; /* thaw the port */ if (ata_is_host_link(link)) @@ -2473,17 +2366,12 @@ int ata_eh_reset(struct ata_link *link, int classify, * reset and here. This race is mediated by cross checking * link onlineness and classification result later. */ - if (postreset) { + if (postreset) postreset(link, classes); - if (slave) - postreset(slave, classes); - } /* clear cached SError */ spin_lock_irqsave(link->ap->lock, flags); link->eh_info.serror = 0; - if (slave) - slave->eh_info.serror = 0; spin_unlock_irqrestore(link->ap->lock, flags); /* Make sure onlineness and classification result correspond. @@ -2493,21 +2381,19 @@ int ata_eh_reset(struct ata_link *link, int classify, * link onlineness and classification result, those conditions * can be reliably detected and retried. */ - nr_unknown = 0; + nr_known = 0; ata_link_for_each_dev(dev, link) { /* convert all ATA_DEV_UNKNOWN to ATA_DEV_NONE */ - if (classes[dev->devno] == ATA_DEV_UNKNOWN) { + if (classes[dev->devno] == ATA_DEV_UNKNOWN) classes[dev->devno] = ATA_DEV_NONE; - if (ata_phys_link_online(ata_dev_phys_link(dev))) - nr_unknown++; - } + else + nr_known++; } - if (classify && nr_unknown) { + if (classify && !nr_known && ata_link_online(link)) { if (try < max_tries) { ata_link_printk(link, KERN_WARNING, "link online but " "device misclassified, retrying\n"); - failed_link = link; rc = -EAGAIN; goto fail; } @@ -2518,8 +2404,6 @@ int ata_eh_reset(struct ata_link *link, int classify, /* reset successful, schedule revalidation */ ata_eh_done(link, NULL, ATA_EH_RESET); - if (slave) - ata_eh_done(slave, NULL, ATA_EH_RESET); ehc->last_reset = jiffies; ehc->i.action |= ATA_EH_REVALIDATE; @@ -2527,8 +2411,6 @@ int ata_eh_reset(struct ata_link *link, int classify, out: /* clear hotplug flag */ ehc->i.flags &= ~ATA_EHI_HOTPLUGGED; - if (slave) - sehc->i.flags &= ~ATA_EHI_HOTPLUGGED; spin_lock_irqsave(ap->lock, flags); ap->pflags &= ~ATA_PFLAG_RESETTING; @@ -2549,7 +2431,7 @@ int ata_eh_reset(struct ata_link *link, int classify, if (time_before(now, deadline)) { unsigned long delta = deadline - now; - ata_link_printk(failed_link, KERN_WARNING, + ata_link_printk(link, KERN_WARNING, "reset failed (errno=%d), retrying in %u secs\n", rc, DIV_ROUND_UP(jiffies_to_msecs(delta), 1000)); @@ -2557,92 +2439,13 @@ int ata_eh_reset(struct ata_link *link, int classify, delta = schedule_timeout_uninterruptible(delta); } - if (try == max_tries - 1) { + if (rc == -EPIPE || try == max_tries - 1) sata_down_spd_limit(link); - if (slave) - sata_down_spd_limit(slave); - } else if (rc == -EPIPE) - sata_down_spd_limit(failed_link); - if (hardreset) reset = hardreset; goto retry; } -static inline void ata_eh_pull_park_action(struct ata_port *ap) -{ - struct ata_link *link; - struct ata_device *dev; - unsigned long flags; - - /* - * This function can be thought of as an extended version of - * ata_eh_about_to_do() specially crafted to accommodate the - * requirements of ATA_EH_PARK handling. Since the EH thread - * does not leave the do {} while () loop in ata_eh_recover as - * long as the timeout for a park request to *one* device on - * the port has not expired, and since we still want to pick - * up park requests to other devices on the same port or - * timeout updates for the same device, we have to pull - * ATA_EH_PARK actions from eh_info into eh_context.i - * ourselves at the beginning of each pass over the loop. - * - * Additionally, all write accesses to &ap->park_req_pending - * through INIT_COMPLETION() (see below) or complete_all() - * (see ata_scsi_park_store()) are protected by the host lock. - * As a result we have that park_req_pending.done is zero on - * exit from this function, i.e. when ATA_EH_PARK actions for - * *all* devices on port ap have been pulled into the - * respective eh_context structs. If, and only if, - * park_req_pending.done is non-zero by the time we reach - * wait_for_completion_timeout(), another ATA_EH_PARK action - * has been scheduled for at least one of the devices on port - * ap and we have to cycle over the do {} while () loop in - * ata_eh_recover() again. - */ - - spin_lock_irqsave(ap->lock, flags); - INIT_COMPLETION(ap->park_req_pending); - ata_port_for_each_link(link, ap) { - ata_link_for_each_dev(dev, link) { - struct ata_eh_info *ehi = &link->eh_info; - - link->eh_context.i.dev_action[dev->devno] |= - ehi->dev_action[dev->devno] & ATA_EH_PARK; - ata_eh_clear_action(link, dev, ehi, ATA_EH_PARK); - } - } - spin_unlock_irqrestore(ap->lock, flags); -} - -static void ata_eh_park_issue_cmd(struct ata_device *dev, int park) -{ - struct ata_eh_context *ehc = &dev->link->eh_context; - struct ata_taskfile tf; - unsigned int err_mask; - - ata_tf_init(dev, &tf); - if (park) { - ehc->unloaded_mask |= 1 << dev->devno; - tf.command = ATA_CMD_IDLEIMMEDIATE; - tf.feature = 0x44; - tf.lbal = 0x4c; - tf.lbam = 0x4e; - tf.lbah = 0x55; - } else { - ehc->unloaded_mask &= ~(1 << dev->devno); - tf.command = ATA_CMD_CHK_POWER; - } - - tf.flags |= ATA_TFLAG_DEVICE | ATA_TFLAG_ISADDR; - tf.protocol |= ATA_PROT_NODATA; - err_mask = ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0, 0); - if (park && (err_mask || tf.lbal != 0xc4)) { - ata_dev_printk(dev, KERN_ERR, "head unload failed!\n"); - ehc->unloaded_mask &= ~(1 << dev->devno); - } -} - static int ata_eh_revalidate_and_attach(struct ata_link *link, struct ata_device **r_failed_dev) { @@ -2669,7 +2472,7 @@ static int ata_eh_revalidate_and_attach(struct ata_link *link, if ((action & ATA_EH_REVALIDATE) && ata_dev_enabled(dev)) { WARN_ON(dev->class == ATA_DEV_PMP); - if (ata_phys_link_offline(ata_dev_phys_link(dev))) { + if (ata_link_offline(link)) { rc = -EIO; goto err; } @@ -2807,53 +2610,6 @@ int ata_set_mode(struct ata_link *link, struct ata_device **r_failed_dev) return rc; } -/** - * atapi_eh_clear_ua - Clear ATAPI UNIT ATTENTION after reset - * @dev: ATAPI device to clear UA for - * - * Resets and other operations can make an ATAPI device raise - * UNIT ATTENTION which causes the next operation to fail. This - * function clears UA. - * - * LOCKING: - * EH context (may sleep). - * - * RETURNS: - * 0 on success, -errno on failure. - */ -static int atapi_eh_clear_ua(struct ata_device *dev) -{ - int i; - - for (i = 0; i < ATA_EH_UA_TRIES; i++) { - u8 sense_buffer[SCSI_SENSE_BUFFERSIZE]; - u8 sense_key = 0; - unsigned int err_mask; - - err_mask = atapi_eh_tur(dev, &sense_key); - if (err_mask != 0 && err_mask != AC_ERR_DEV) { - ata_dev_printk(dev, KERN_WARNING, "TEST_UNIT_READY " - "failed (err_mask=0x%x)\n", err_mask); - return -EIO; - } - - if (!err_mask || sense_key != UNIT_ATTENTION) - return 0; - - err_mask = atapi_eh_request_sense(dev, sense_buffer, sense_key); - if (err_mask) { - ata_dev_printk(dev, KERN_WARNING, "failed to clear " - "UNIT ATTENTION (err_mask=0x%x)\n", err_mask); - return -EIO; - } - } - - ata_dev_printk(dev, KERN_WARNING, - "UNIT ATTENTION persists after %d tries\n", ATA_EH_UA_TRIES); - - return 0; -} - static int ata_link_nr_enabled(struct ata_link *link) { struct ata_device *dev; @@ -2941,7 +2697,7 @@ static int ata_eh_handle_dev_fail(struct ata_device *dev, int err) /* This is the last chance, better to slow * down than lose it. */ - sata_down_spd_limit(ata_dev_phys_link(dev)); + sata_down_spd_limit(dev->link); ata_down_xfermask_limit(dev, ATA_DNXFER_PIO); } } @@ -2951,7 +2707,7 @@ static int ata_eh_handle_dev_fail(struct ata_device *dev, int err) ata_dev_disable(dev); /* detach if offline */ - if (ata_phys_link_offline(ata_dev_phys_link(dev))) + if (ata_link_offline(dev->link)) ata_eh_detach_dev(dev); /* schedule probe if necessary */ @@ -2999,7 +2755,7 @@ int ata_eh_recover(struct ata_port *ap, ata_prereset_fn_t prereset, struct ata_device *dev; int nr_failed_devs; int rc; - unsigned long flags, deadline; + unsigned long flags; DPRINTK("ENTER\n"); @@ -3073,56 +2829,6 @@ int ata_eh_recover(struct ata_port *ap, ata_prereset_fn_t prereset, } } - do { - unsigned long now; - - /* - * clears ATA_EH_PARK in eh_info and resets - * ap->park_req_pending - */ - ata_eh_pull_park_action(ap); - - deadline = jiffies; - ata_port_for_each_link(link, ap) { - ata_link_for_each_dev(dev, link) { - struct ata_eh_context *ehc = &link->eh_context; - unsigned long tmp; - - if (dev->class != ATA_DEV_ATA) - continue; - if (!(ehc->i.dev_action[dev->devno] & - ATA_EH_PARK)) - continue; - tmp = dev->unpark_deadline; - if (time_before(deadline, tmp)) - deadline = tmp; - else if (time_before_eq(tmp, jiffies)) - continue; - if (ehc->unloaded_mask & (1 << dev->devno)) - continue; - - ata_eh_park_issue_cmd(dev, 1); - } - } - - now = jiffies; - if (time_before_eq(deadline, now)) - break; - - deadline = wait_for_completion_timeout(&ap->park_req_pending, - deadline - now); - } while (deadline); - ata_port_for_each_link(link, ap) { - ata_link_for_each_dev(dev, link) { - if (!(link->eh_context.unloaded_mask & - (1 << dev->devno))) - continue; - - ata_eh_park_issue_cmd(dev, 0); - ata_eh_done(link, dev, ATA_EH_PARK); - } - } - /* the rest */ ata_port_for_each_link(link, ap) { struct ata_eh_context *ehc = &link->eh_context; @@ -3146,20 +2852,6 @@ int ata_eh_recover(struct ata_port *ap, ata_prereset_fn_t prereset, ehc->i.flags &= ~ATA_EHI_SETMODE; } - /* If reset has been issued, clear UA to avoid - * disrupting the current users of the device. - */ - if (ehc->i.flags & ATA_EHI_DID_RESET) { - ata_link_for_each_dev(dev, link) { - if (dev->class != ATA_DEV_ATAPI) - continue; - rc = atapi_eh_clear_ua(dev); - if (rc) - goto dev_fail; - } - } - - /* configure link power saving */ if (ehc->i.action & ATA_EH_LPM) ata_link_for_each_dev(dev, link) ata_dev_enable_pm(dev, ap->pm_policy); diff --git a/trunk/drivers/ata/libata-scsi.c b/trunk/drivers/ata/libata-scsi.c index fccd5e496c62..b9d3ba423cb2 100644 --- a/trunk/drivers/ata/libata-scsi.c +++ b/trunk/drivers/ata/libata-scsi.c @@ -183,105 +183,6 @@ DEVICE_ATTR(link_power_management_policy, S_IRUGO | S_IWUSR, ata_scsi_lpm_show, ata_scsi_lpm_put); EXPORT_SYMBOL_GPL(dev_attr_link_power_management_policy); -static ssize_t ata_scsi_park_show(struct device *device, - struct device_attribute *attr, char *buf) -{ - struct scsi_device *sdev = to_scsi_device(device); - struct ata_port *ap; - struct ata_link *link; - struct ata_device *dev; - unsigned long flags; - unsigned int uninitialized_var(msecs); - int rc = 0; - - ap = ata_shost_to_port(sdev->host); - - spin_lock_irqsave(ap->lock, flags); - dev = ata_scsi_find_dev(ap, sdev); - if (!dev) { - rc = -ENODEV; - goto unlock; - } - if (dev->flags & ATA_DFLAG_NO_UNLOAD) { - rc = -EOPNOTSUPP; - goto unlock; - } - - link = dev->link; - if (ap->pflags & ATA_PFLAG_EH_IN_PROGRESS && - link->eh_context.unloaded_mask & (1 << dev->devno) && - time_after(dev->unpark_deadline, jiffies)) - msecs = jiffies_to_msecs(dev->unpark_deadline - jiffies); - else - msecs = 0; - -unlock: - spin_unlock_irq(ap->lock); - - return rc ? rc : snprintf(buf, 20, "%u\n", msecs); -} - -static ssize_t ata_scsi_park_store(struct device *device, - struct device_attribute *attr, - const char *buf, size_t len) -{ - struct scsi_device *sdev = to_scsi_device(device); - struct ata_port *ap; - struct ata_device *dev; - long int input; - unsigned long flags; - int rc; - - rc = strict_strtol(buf, 10, &input); - if (rc || input < -2) - return -EINVAL; - if (input > ATA_TMOUT_MAX_PARK) { - rc = -EOVERFLOW; - input = ATA_TMOUT_MAX_PARK; - } - - ap = ata_shost_to_port(sdev->host); - - spin_lock_irqsave(ap->lock, flags); - dev = ata_scsi_find_dev(ap, sdev); - if (unlikely(!dev)) { - rc = -ENODEV; - goto unlock; - } - if (dev->class != ATA_DEV_ATA) { - rc = -EOPNOTSUPP; - goto unlock; - } - - if (input >= 0) { - if (dev->flags & ATA_DFLAG_NO_UNLOAD) { - rc = -EOPNOTSUPP; - goto unlock; - } - - dev->unpark_deadline = ata_deadline(jiffies, input); - dev->link->eh_info.dev_action[dev->devno] |= ATA_EH_PARK; - ata_port_schedule_eh(ap); - complete(&ap->park_req_pending); - } else { - switch (input) { - case -1: - dev->flags &= ~ATA_DFLAG_NO_UNLOAD; - break; - case -2: - dev->flags |= ATA_DFLAG_NO_UNLOAD; - break; - } - } -unlock: - spin_unlock_irqrestore(ap->lock, flags); - - return rc ? rc : len; -} -DEVICE_ATTR(unload_heads, S_IRUGO | S_IWUSR, - ata_scsi_park_show, ata_scsi_park_store); -EXPORT_SYMBOL_GPL(dev_attr_unload_heads); - static void ata_scsi_set_sense(struct scsi_cmnd *cmd, u8 sk, u8 asc, u8 ascq) { cmd->result = (DRIVER_SENSE << 24) | SAM_STAT_CHECK_CONDITION; @@ -368,12 +269,6 @@ DEVICE_ATTR(sw_activity, S_IWUGO | S_IRUGO, ata_scsi_activity_show, ata_scsi_activity_store); EXPORT_SYMBOL_GPL(dev_attr_sw_activity); -struct device_attribute *ata_common_sdev_attrs[] = { - &dev_attr_unload_heads, - NULL -}; -EXPORT_SYMBOL_GPL(ata_common_sdev_attrs); - static void ata_scsi_invalid_field(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)) { @@ -1059,9 +954,6 @@ static int atapi_drain_needed(struct request *rq) static int ata_scsi_dev_config(struct scsi_device *sdev, struct ata_device *dev) { - if (!ata_id_has_unload(dev->id)) - dev->flags |= ATA_DFLAG_NO_UNLOAD; - /* configure max sectors */ blk_queue_max_sectors(sdev->request_queue, dev->max_sectors); diff --git a/trunk/drivers/ata/libata.h b/trunk/drivers/ata/libata.h index e96de96e3020..ade5c75b6144 100644 --- a/trunk/drivers/ata/libata.h +++ b/trunk/drivers/ata/libata.h @@ -70,7 +70,6 @@ extern int atapi_passthru16; extern int libata_fua; extern int libata_noacpi; extern int libata_allow_tpm; -extern struct ata_link *ata_dev_phys_link(struct ata_device *dev); extern void ata_force_cbl(struct ata_port *ap); extern u64 ata_tf_to_lba(const struct ata_taskfile *tf); extern u64 ata_tf_to_lba48(const struct ata_taskfile *tf); @@ -108,8 +107,6 @@ extern void ata_qc_issue(struct ata_queued_cmd *qc); extern void __ata_qc_complete(struct ata_queued_cmd *qc); extern int atapi_check_dma(struct ata_queued_cmd *qc); extern void swap_buf_le16(u16 *buf, unsigned int buf_words); -extern bool ata_phys_link_online(struct ata_link *link); -extern bool ata_phys_link_offline(struct ata_link *link); extern void ata_dev_init(struct ata_device *dev); extern void ata_link_init(struct ata_port *ap, struct ata_link *link, int pmp); extern int sata_link_init_spd(struct ata_link *link); diff --git a/trunk/drivers/ata/pata_bf54x.c b/trunk/drivers/ata/pata_bf54x.c index 1266924c11f9..d3932901a3b3 100644 --- a/trunk/drivers/ata/pata_bf54x.c +++ b/trunk/drivers/ata/pata_bf54x.c @@ -1632,8 +1632,6 @@ static int __devinit bfin_atapi_probe(struct platform_device *pdev) return -ENODEV; } - dev_set_drvdata(&pdev->dev, host); - return 0; } @@ -1650,7 +1648,6 @@ static int __devexit bfin_atapi_remove(struct platform_device *pdev) struct ata_host *host = dev_get_drvdata(dev); ata_host_detach(host); - dev_set_drvdata(&pdev->dev, NULL); peripheral_free_list(atapi_io_port); @@ -1658,44 +1655,27 @@ static int __devexit bfin_atapi_remove(struct platform_device *pdev) } #ifdef CONFIG_PM -static int bfin_atapi_suspend(struct platform_device *pdev, pm_message_t state) +int bfin_atapi_suspend(struct platform_device *pdev, pm_message_t state) { - struct ata_host *host = dev_get_drvdata(&pdev->dev); - if (host) - return ata_host_suspend(host, state); - else - return 0; + return 0; } -static int bfin_atapi_resume(struct platform_device *pdev) +int bfin_atapi_resume(struct platform_device *pdev) { - struct ata_host *host = dev_get_drvdata(&pdev->dev); - int ret; - - if (host) { - ret = bfin_reset_controller(host); - if (ret) { - printk(KERN_ERR DRV_NAME ": Error during HW init\n"); - return ret; - } - ata_host_resume(host); - } - return 0; } -#else -#define bfin_atapi_suspend NULL -#define bfin_atapi_resume NULL #endif static struct platform_driver bfin_atapi_driver = { .probe = bfin_atapi_probe, .remove = __devexit_p(bfin_atapi_remove), - .suspend = bfin_atapi_suspend, - .resume = bfin_atapi_resume, .driver = { .name = DRV_NAME, .owner = THIS_MODULE, +#ifdef CONFIG_PM + .suspend = bfin_atapi_suspend, + .resume = bfin_atapi_resume, +#endif }, }; diff --git a/trunk/drivers/ata/pata_sil680.c b/trunk/drivers/ata/pata_sil680.c index a598bb36aafc..e970b227fbce 100644 --- a/trunk/drivers/ata/pata_sil680.c +++ b/trunk/drivers/ata/pata_sil680.c @@ -230,7 +230,7 @@ static u8 sil680_init_chip(struct pci_dev *pdev, int *try_mmio) tmpbyte & 1, tmpbyte & 0x30); *try_mmio = 0; -#ifdef CONFIG_PPC +#ifdef CONFIG_PPC_MERGE if (machine_is(cell)) *try_mmio = (tmpbyte & 1) || pci_resource_start(pdev, 5); #endif diff --git a/trunk/drivers/ata/sata_fsl.c b/trunk/drivers/ata/sata_fsl.c index 1a56db92ff7a..3924e7209a44 100644 --- a/trunk/drivers/ata/sata_fsl.c +++ b/trunk/drivers/ata/sata_fsl.c @@ -469,10 +469,10 @@ static bool sata_fsl_qc_fill_rtf(struct ata_queued_cmd *qc) return true; } -static int sata_fsl_scr_write(struct ata_link *link, - unsigned int sc_reg_in, u32 val) +static int sata_fsl_scr_write(struct ata_port *ap, unsigned int sc_reg_in, + u32 val) { - struct sata_fsl_host_priv *host_priv = link->ap->host->private_data; + struct sata_fsl_host_priv *host_priv = ap->host->private_data; void __iomem *ssr_base = host_priv->ssr_base; unsigned int sc_reg; @@ -493,10 +493,10 @@ static int sata_fsl_scr_write(struct ata_link *link, return 0; } -static int sata_fsl_scr_read(struct ata_link *link, - unsigned int sc_reg_in, u32 *val) +static int sata_fsl_scr_read(struct ata_port *ap, unsigned int sc_reg_in, + u32 *val) { - struct sata_fsl_host_priv *host_priv = link->ap->host->private_data; + struct sata_fsl_host_priv *host_priv = ap->host->private_data; void __iomem *ssr_base = host_priv->ssr_base; unsigned int sc_reg; @@ -645,12 +645,12 @@ static int sata_fsl_port_start(struct ata_port *ap) * Workaround for 8315DS board 3gbps link-up issue, * currently limit SATA port to GEN1 speed */ - sata_fsl_scr_read(&ap->link, SCR_CONTROL, &temp); + sata_fsl_scr_read(ap, SCR_CONTROL, &temp); temp &= ~(0xF << 4); temp |= (0x1 << 4); - sata_fsl_scr_write(&ap->link, SCR_CONTROL, temp); + sata_fsl_scr_write(ap, SCR_CONTROL, temp); - sata_fsl_scr_read(&ap->link, SCR_CONTROL, &temp); + sata_fsl_scr_read(ap, SCR_CONTROL, &temp); dev_printk(KERN_WARNING, dev, "scr_control, speed limited to %x\n", temp); #endif @@ -868,7 +868,7 @@ static int sata_fsl_softreset(struct ata_link *link, unsigned int *class, ioread32(CQ + hcr_base), ioread32(CA + hcr_base), ioread32(CC + hcr_base)); - sata_fsl_scr_read(&ap->link, SCR_ERROR, &Serror); + sata_fsl_scr_read(ap, SCR_ERROR, &Serror); DPRINTK("HStatus = 0x%x\n", ioread32(hcr_base + HSTATUS)); DPRINTK("HControl = 0x%x\n", ioread32(hcr_base + HCONTROL)); @@ -972,9 +972,9 @@ static void sata_fsl_error_intr(struct ata_port *ap) * Handle & Clear SError */ - sata_fsl_scr_read(&ap->link, SCR_ERROR, &SError); + sata_fsl_scr_read(ap, SCR_ERROR, &SError); if (unlikely(SError & 0xFFFF0000)) { - sata_fsl_scr_write(&ap->link, SCR_ERROR, SError); + sata_fsl_scr_write(ap, SCR_ERROR, SError); } DPRINTK("error_intr,hStat=0x%x,CE=0x%x,DE =0x%x,SErr=0x%x\n", @@ -1091,7 +1091,7 @@ static void sata_fsl_host_intr(struct ata_port *ap) hstatus = ioread32(hcr_base + HSTATUS); - sata_fsl_scr_read(&ap->link, SCR_ERROR, &SError); + sata_fsl_scr_read(ap, SCR_ERROR, &SError); if (unlikely(SError & 0xFFFF0000)) { DPRINTK("serror @host_intr : 0x%x\n", SError); diff --git a/trunk/drivers/ata/sata_inic162x.c b/trunk/drivers/ata/sata_inic162x.c index fbbd87c96f10..5032c32fa505 100644 --- a/trunk/drivers/ata/sata_inic162x.c +++ b/trunk/drivers/ata/sata_inic162x.c @@ -269,9 +269,9 @@ static void inic_reset_port(void __iomem *port_base) writeb(0xff, port_base + PORT_IRQ_STAT); } -static int inic_scr_read(struct ata_link *link, unsigned sc_reg, u32 *val) +static int inic_scr_read(struct ata_port *ap, unsigned sc_reg, u32 *val) { - void __iomem *scr_addr = inic_port_base(link->ap) + PORT_SCR; + void __iomem *scr_addr = inic_port_base(ap) + PORT_SCR; void __iomem *addr; if (unlikely(sc_reg >= ARRAY_SIZE(scr_map))) @@ -286,9 +286,9 @@ static int inic_scr_read(struct ata_link *link, unsigned sc_reg, u32 *val) return 0; } -static int inic_scr_write(struct ata_link *link, unsigned sc_reg, u32 val) +static int inic_scr_write(struct ata_port *ap, unsigned sc_reg, u32 val) { - void __iomem *scr_addr = inic_port_base(link->ap) + PORT_SCR; + void __iomem *scr_addr = inic_port_base(ap) + PORT_SCR; if (unlikely(sc_reg >= ARRAY_SIZE(scr_map))) return -EINVAL; diff --git a/trunk/drivers/ata/sata_mv.c b/trunk/drivers/ata/sata_mv.c index 2b24ae58b52e..c815f8ecf6e6 100644 --- a/trunk/drivers/ata/sata_mv.c +++ b/trunk/drivers/ata/sata_mv.c @@ -493,10 +493,10 @@ struct mv_hw_ops { void (*reset_bus)(struct ata_host *host, void __iomem *mmio); }; -static int mv_scr_read(struct ata_link *link, unsigned int sc_reg_in, u32 *val); -static int mv_scr_write(struct ata_link *link, unsigned int sc_reg_in, u32 val); -static int mv5_scr_read(struct ata_link *link, unsigned int sc_reg_in, u32 *val); -static int mv5_scr_write(struct ata_link *link, unsigned int sc_reg_in, u32 val); +static int mv_scr_read(struct ata_port *ap, unsigned int sc_reg_in, u32 *val); +static int mv_scr_write(struct ata_port *ap, unsigned int sc_reg_in, u32 val); +static int mv5_scr_read(struct ata_port *ap, unsigned int sc_reg_in, u32 *val); +static int mv5_scr_write(struct ata_port *ap, unsigned int sc_reg_in, u32 val); static int mv_port_start(struct ata_port *ap); static void mv_port_stop(struct ata_port *ap); static int mv_qc_defer(struct ata_queued_cmd *qc); @@ -1070,23 +1070,23 @@ static unsigned int mv_scr_offset(unsigned int sc_reg_in) return ofs; } -static int mv_scr_read(struct ata_link *link, unsigned int sc_reg_in, u32 *val) +static int mv_scr_read(struct ata_port *ap, unsigned int sc_reg_in, u32 *val) { unsigned int ofs = mv_scr_offset(sc_reg_in); if (ofs != 0xffffffffU) { - *val = readl(mv_ap_base(link->ap) + ofs); + *val = readl(mv_ap_base(ap) + ofs); return 0; } else return -EINVAL; } -static int mv_scr_write(struct ata_link *link, unsigned int sc_reg_in, u32 val) +static int mv_scr_write(struct ata_port *ap, unsigned int sc_reg_in, u32 val) { unsigned int ofs = mv_scr_offset(sc_reg_in); if (ofs != 0xffffffffU) { - writelfl(val, mv_ap_base(link->ap) + ofs); + writelfl(val, mv_ap_base(ap) + ofs); return 0; } else return -EINVAL; @@ -2251,11 +2251,11 @@ static unsigned int mv5_scr_offset(unsigned int sc_reg_in) return ofs; } -static int mv5_scr_read(struct ata_link *link, unsigned int sc_reg_in, u32 *val) +static int mv5_scr_read(struct ata_port *ap, unsigned int sc_reg_in, u32 *val) { - struct mv_host_priv *hpriv = link->ap->host->private_data; + struct mv_host_priv *hpriv = ap->host->private_data; void __iomem *mmio = hpriv->base; - void __iomem *addr = mv5_phy_base(mmio, link->ap->port_no); + void __iomem *addr = mv5_phy_base(mmio, ap->port_no); unsigned int ofs = mv5_scr_offset(sc_reg_in); if (ofs != 0xffffffffU) { @@ -2265,11 +2265,11 @@ static int mv5_scr_read(struct ata_link *link, unsigned int sc_reg_in, u32 *val) return -EINVAL; } -static int mv5_scr_write(struct ata_link *link, unsigned int sc_reg_in, u32 val) +static int mv5_scr_write(struct ata_port *ap, unsigned int sc_reg_in, u32 val) { - struct mv_host_priv *hpriv = link->ap->host->private_data; + struct mv_host_priv *hpriv = ap->host->private_data; void __iomem *mmio = hpriv->base; - void __iomem *addr = mv5_phy_base(mmio, link->ap->port_no); + void __iomem *addr = mv5_phy_base(mmio, ap->port_no); unsigned int ofs = mv5_scr_offset(sc_reg_in); if (ofs != 0xffffffffU) { diff --git a/trunk/drivers/ata/sata_nv.c b/trunk/drivers/ata/sata_nv.c index fae3841de0d8..14601dc05e41 100644 --- a/trunk/drivers/ata/sata_nv.c +++ b/trunk/drivers/ata/sata_nv.c @@ -302,8 +302,8 @@ static void nv_ck804_host_stop(struct ata_host *host); static irqreturn_t nv_generic_interrupt(int irq, void *dev_instance); static irqreturn_t nv_nf2_interrupt(int irq, void *dev_instance); static irqreturn_t nv_ck804_interrupt(int irq, void *dev_instance); -static int nv_scr_read(struct ata_link *link, unsigned int sc_reg, u32 *val); -static int nv_scr_write(struct ata_link *link, unsigned int sc_reg, u32 val); +static int nv_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val); +static int nv_scr_write(struct ata_port *ap, unsigned int sc_reg, u32 val); static void nv_nf2_freeze(struct ata_port *ap); static void nv_nf2_thaw(struct ata_port *ap); @@ -1511,21 +1511,21 @@ static irqreturn_t nv_ck804_interrupt(int irq, void *dev_instance) return ret; } -static int nv_scr_read(struct ata_link *link, unsigned int sc_reg, u32 *val) +static int nv_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val) { if (sc_reg > SCR_CONTROL) return -EINVAL; - *val = ioread32(link->ap->ioaddr.scr_addr + (sc_reg * 4)); + *val = ioread32(ap->ioaddr.scr_addr + (sc_reg * 4)); return 0; } -static int nv_scr_write(struct ata_link *link, unsigned int sc_reg, u32 val) +static int nv_scr_write(struct ata_port *ap, unsigned int sc_reg, u32 val) { if (sc_reg > SCR_CONTROL) return -EINVAL; - iowrite32(val, link->ap->ioaddr.scr_addr + (sc_reg * 4)); + iowrite32(val, ap->ioaddr.scr_addr + (sc_reg * 4)); return 0; } @@ -2218,9 +2218,9 @@ static void nv_swncq_host_interrupt(struct ata_port *ap, u16 fis) if (!pp->qc_active) return; - if (ap->ops->scr_read(&ap->link, SCR_ERROR, &serror)) + if (ap->ops->scr_read(ap, SCR_ERROR, &serror)) return; - ap->ops->scr_write(&ap->link, SCR_ERROR, serror); + ap->ops->scr_write(ap, SCR_ERROR, serror); if (ata_stat & ATA_ERR) { ata_ehi_clear_desc(ehi); diff --git a/trunk/drivers/ata/sata_promise.c b/trunk/drivers/ata/sata_promise.c index 750d8cdc00cd..030665ba76b7 100644 --- a/trunk/drivers/ata/sata_promise.c +++ b/trunk/drivers/ata/sata_promise.c @@ -137,8 +137,8 @@ struct pdc_port_priv { dma_addr_t pkt_dma; }; -static int pdc_sata_scr_read(struct ata_link *link, unsigned int sc_reg, u32 *val); -static int pdc_sata_scr_write(struct ata_link *link, unsigned int sc_reg, u32 val); +static int pdc_sata_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val); +static int pdc_sata_scr_write(struct ata_port *ap, unsigned int sc_reg, u32 val); static int pdc_ata_init_one(struct pci_dev *pdev, const struct pci_device_id *ent); static int pdc_common_port_start(struct ata_port *ap); static int pdc_sata_port_start(struct ata_port *ap); @@ -386,21 +386,19 @@ static int pdc_sata_cable_detect(struct ata_port *ap) return ATA_CBL_SATA; } -static int pdc_sata_scr_read(struct ata_link *link, - unsigned int sc_reg, u32 *val) +static int pdc_sata_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val) { if (sc_reg > SCR_CONTROL) return -EINVAL; - *val = readl(link->ap->ioaddr.scr_addr + (sc_reg * 4)); + *val = readl(ap->ioaddr.scr_addr + (sc_reg * 4)); return 0; } -static int pdc_sata_scr_write(struct ata_link *link, - unsigned int sc_reg, u32 val) +static int pdc_sata_scr_write(struct ata_port *ap, unsigned int sc_reg, u32 val) { if (sc_reg > SCR_CONTROL) return -EINVAL; - writel(val, link->ap->ioaddr.scr_addr + (sc_reg * 4)); + writel(val, ap->ioaddr.scr_addr + (sc_reg * 4)); return 0; } @@ -733,7 +731,7 @@ static void pdc_error_intr(struct ata_port *ap, struct ata_queued_cmd *qc, if (sata_scr_valid(&ap->link)) { u32 serror; - pdc_sata_scr_read(&ap->link, SCR_ERROR, &serror); + pdc_sata_scr_read(ap, SCR_ERROR, &serror); ehi->serror |= serror; } diff --git a/trunk/drivers/ata/sata_qstor.c b/trunk/drivers/ata/sata_qstor.c index a000c86ac859..1600107047cf 100644 --- a/trunk/drivers/ata/sata_qstor.c +++ b/trunk/drivers/ata/sata_qstor.c @@ -111,8 +111,8 @@ struct qs_port_priv { qs_state_t state; }; -static int qs_scr_read(struct ata_link *link, unsigned int sc_reg, u32 *val); -static int qs_scr_write(struct ata_link *link, unsigned int sc_reg, u32 val); +static int qs_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val); +static int qs_scr_write(struct ata_port *ap, unsigned int sc_reg, u32 val); static int qs_ata_init_one(struct pci_dev *pdev, const struct pci_device_id *ent); static int qs_port_start(struct ata_port *ap); static void qs_host_stop(struct ata_host *host); @@ -242,11 +242,11 @@ static int qs_prereset(struct ata_link *link, unsigned long deadline) return ata_sff_prereset(link, deadline); } -static int qs_scr_read(struct ata_link *link, unsigned int sc_reg, u32 *val) +static int qs_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val) { if (sc_reg > SCR_CONTROL) return -EINVAL; - *val = readl(link->ap->ioaddr.scr_addr + (sc_reg * 8)); + *val = readl(ap->ioaddr.scr_addr + (sc_reg * 8)); return 0; } @@ -256,11 +256,11 @@ static void qs_error_handler(struct ata_port *ap) ata_std_error_handler(ap); } -static int qs_scr_write(struct ata_link *link, unsigned int sc_reg, u32 val) +static int qs_scr_write(struct ata_port *ap, unsigned int sc_reg, u32 val) { if (sc_reg > SCR_CONTROL) return -EINVAL; - writel(val, link->ap->ioaddr.scr_addr + (sc_reg * 8)); + writel(val, ap->ioaddr.scr_addr + (sc_reg * 8)); return 0; } diff --git a/trunk/drivers/ata/sata_sil.c b/trunk/drivers/ata/sata_sil.c index 031d7b7dee34..88bf4212590f 100644 --- a/trunk/drivers/ata/sata_sil.c +++ b/trunk/drivers/ata/sata_sil.c @@ -115,8 +115,8 @@ static int sil_init_one(struct pci_dev *pdev, const struct pci_device_id *ent); static int sil_pci_device_resume(struct pci_dev *pdev); #endif static void sil_dev_config(struct ata_device *dev); -static int sil_scr_read(struct ata_link *link, unsigned int sc_reg, u32 *val); -static int sil_scr_write(struct ata_link *link, unsigned int sc_reg, u32 val); +static int sil_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val); +static int sil_scr_write(struct ata_port *ap, unsigned int sc_reg, u32 val); static int sil_set_mode(struct ata_link *link, struct ata_device **r_failed); static void sil_freeze(struct ata_port *ap); static void sil_thaw(struct ata_port *ap); @@ -317,9 +317,9 @@ static inline void __iomem *sil_scr_addr(struct ata_port *ap, return NULL; } -static int sil_scr_read(struct ata_link *link, unsigned int sc_reg, u32 *val) +static int sil_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val) { - void __iomem *mmio = sil_scr_addr(link->ap, sc_reg); + void __iomem *mmio = sil_scr_addr(ap, sc_reg); if (mmio) { *val = readl(mmio); @@ -328,9 +328,9 @@ static int sil_scr_read(struct ata_link *link, unsigned int sc_reg, u32 *val) return -EINVAL; } -static int sil_scr_write(struct ata_link *link, unsigned int sc_reg, u32 val) +static int sil_scr_write(struct ata_port *ap, unsigned int sc_reg, u32 val) { - void __iomem *mmio = sil_scr_addr(link->ap, sc_reg); + void __iomem *mmio = sil_scr_addr(ap, sc_reg); if (mmio) { writel(val, mmio); @@ -352,8 +352,8 @@ static void sil_host_intr(struct ata_port *ap, u32 bmdma2) * controllers continue to assert IRQ as long as * SError bits are pending. Clear SError immediately. */ - sil_scr_read(&ap->link, SCR_ERROR, &serror); - sil_scr_write(&ap->link, SCR_ERROR, serror); + sil_scr_read(ap, SCR_ERROR, &serror); + sil_scr_write(ap, SCR_ERROR, serror); /* Sometimes spurious interrupts occur, double check * it's PHYRDY CHG. diff --git a/trunk/drivers/ata/sata_sil24.c b/trunk/drivers/ata/sata_sil24.c index 4621807a1a6a..84ffcc26a74b 100644 --- a/trunk/drivers/ata/sata_sil24.c +++ b/trunk/drivers/ata/sata_sil24.c @@ -340,8 +340,8 @@ struct sil24_port_priv { }; static void sil24_dev_config(struct ata_device *dev); -static int sil24_scr_read(struct ata_link *link, unsigned sc_reg, u32 *val); -static int sil24_scr_write(struct ata_link *link, unsigned sc_reg, u32 val); +static int sil24_scr_read(struct ata_port *ap, unsigned sc_reg, u32 *val); +static int sil24_scr_write(struct ata_port *ap, unsigned sc_reg, u32 val); static int sil24_qc_defer(struct ata_queued_cmd *qc); static void sil24_qc_prep(struct ata_queued_cmd *qc); static unsigned int sil24_qc_issue(struct ata_queued_cmd *qc); @@ -504,9 +504,9 @@ static int sil24_scr_map[] = { [SCR_ACTIVE] = 3, }; -static int sil24_scr_read(struct ata_link *link, unsigned sc_reg, u32 *val) +static int sil24_scr_read(struct ata_port *ap, unsigned sc_reg, u32 *val) { - void __iomem *scr_addr = sil24_port_base(link->ap) + PORT_SCONTROL; + void __iomem *scr_addr = sil24_port_base(ap) + PORT_SCONTROL; if (sc_reg < ARRAY_SIZE(sil24_scr_map)) { void __iomem *addr; @@ -517,9 +517,9 @@ static int sil24_scr_read(struct ata_link *link, unsigned sc_reg, u32 *val) return -EINVAL; } -static int sil24_scr_write(struct ata_link *link, unsigned sc_reg, u32 val) +static int sil24_scr_write(struct ata_port *ap, unsigned sc_reg, u32 val) { - void __iomem *scr_addr = sil24_port_base(link->ap) + PORT_SCONTROL; + void __iomem *scr_addr = sil24_port_base(ap) + PORT_SCONTROL; if (sc_reg < ARRAY_SIZE(sil24_scr_map)) { void __iomem *addr; diff --git a/trunk/drivers/ata/sata_sis.c b/trunk/drivers/ata/sata_sis.c index 9c43b4e7c4a6..1010b3069bd5 100644 --- a/trunk/drivers/ata/sata_sis.c +++ b/trunk/drivers/ata/sata_sis.c @@ -64,8 +64,8 @@ enum { }; static int sis_init_one(struct pci_dev *pdev, const struct pci_device_id *ent); -static int sis_scr_read(struct ata_link *link, unsigned int sc_reg, u32 *val); -static int sis_scr_write(struct ata_link *link, unsigned int sc_reg, u32 val); +static int sis_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val); +static int sis_scr_write(struct ata_port *ap, unsigned int sc_reg, u32 val); static const struct pci_device_id sis_pci_tbl[] = { { PCI_VDEVICE(SI, 0x0180), sis_180 }, /* SiS 964/180 */ @@ -134,11 +134,10 @@ static unsigned int get_scr_cfg_addr(struct ata_port *ap, unsigned int sc_reg) return addr; } -static u32 sis_scr_cfg_read(struct ata_link *link, - unsigned int sc_reg, u32 *val) +static u32 sis_scr_cfg_read(struct ata_port *ap, unsigned int sc_reg, u32 *val) { - struct pci_dev *pdev = to_pci_dev(link->ap->host->dev); - unsigned int cfg_addr = get_scr_cfg_addr(link->ap, sc_reg); + struct pci_dev *pdev = to_pci_dev(ap->host->dev); + unsigned int cfg_addr = get_scr_cfg_addr(ap, sc_reg); u32 val2 = 0; u8 pmr; @@ -159,11 +158,10 @@ static u32 sis_scr_cfg_read(struct ata_link *link, return 0; } -static int sis_scr_cfg_write(struct ata_link *link, - unsigned int sc_reg, u32 val) +static int sis_scr_cfg_write(struct ata_port *ap, unsigned int sc_reg, u32 val) { - struct pci_dev *pdev = to_pci_dev(link->ap->host->dev); - unsigned int cfg_addr = get_scr_cfg_addr(link->ap, sc_reg); + struct pci_dev *pdev = to_pci_dev(ap->host->dev); + unsigned int cfg_addr = get_scr_cfg_addr(ap, sc_reg); u8 pmr; if (sc_reg == SCR_ERROR) /* doesn't exist in PCI cfg space */ @@ -180,9 +178,8 @@ static int sis_scr_cfg_write(struct ata_link *link, return 0; } -static int sis_scr_read(struct ata_link *link, unsigned int sc_reg, u32 *val) +static int sis_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val) { - struct ata_port *ap = link->ap; struct pci_dev *pdev = to_pci_dev(ap->host->dev); u8 pmr; @@ -190,7 +187,7 @@ static int sis_scr_read(struct ata_link *link, unsigned int sc_reg, u32 *val) return -EINVAL; if (ap->flags & SIS_FLAG_CFGSCR) - return sis_scr_cfg_read(link, sc_reg, val); + return sis_scr_cfg_read(ap, sc_reg, val); pci_read_config_byte(pdev, SIS_PMR, &pmr); @@ -205,9 +202,8 @@ static int sis_scr_read(struct ata_link *link, unsigned int sc_reg, u32 *val) return 0; } -static int sis_scr_write(struct ata_link *link, unsigned int sc_reg, u32 val) +static int sis_scr_write(struct ata_port *ap, unsigned int sc_reg, u32 val) { - struct ata_port *ap = link->ap; struct pci_dev *pdev = to_pci_dev(ap->host->dev); u8 pmr; @@ -217,7 +213,7 @@ static int sis_scr_write(struct ata_link *link, unsigned int sc_reg, u32 val) pci_read_config_byte(pdev, SIS_PMR, &pmr); if (ap->flags & SIS_FLAG_CFGSCR) - return sis_scr_cfg_write(link, sc_reg, val); + return sis_scr_cfg_write(ap, sc_reg, val); else { iowrite32(val, ap->ioaddr.scr_addr + (sc_reg * 4)); if ((pdev->device == 0x0182) || (pdev->device == 0x0183) || diff --git a/trunk/drivers/ata/sata_svw.c b/trunk/drivers/ata/sata_svw.c index 609d147813ae..fb13b82aacba 100644 --- a/trunk/drivers/ata/sata_svw.c +++ b/trunk/drivers/ata/sata_svw.c @@ -123,22 +123,20 @@ static int k2_sata_check_atapi_dma(struct ata_queued_cmd *qc) } } -static int k2_sata_scr_read(struct ata_link *link, - unsigned int sc_reg, u32 *val) +static int k2_sata_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val) { if (sc_reg > SCR_CONTROL) return -EINVAL; - *val = readl(link->ap->ioaddr.scr_addr + (sc_reg * 4)); + *val = readl(ap->ioaddr.scr_addr + (sc_reg * 4)); return 0; } -static int k2_sata_scr_write(struct ata_link *link, - unsigned int sc_reg, u32 val) +static int k2_sata_scr_write(struct ata_port *ap, unsigned int sc_reg, u32 val) { if (sc_reg > SCR_CONTROL) return -EINVAL; - writel(val, link->ap->ioaddr.scr_addr + (sc_reg * 4)); + writel(val, ap->ioaddr.scr_addr + (sc_reg * 4)); return 0; } diff --git a/trunk/drivers/ata/sata_uli.c b/trunk/drivers/ata/sata_uli.c index 019575bb3e08..db529b849948 100644 --- a/trunk/drivers/ata/sata_uli.c +++ b/trunk/drivers/ata/sata_uli.c @@ -57,8 +57,8 @@ struct uli_priv { }; static int uli_init_one(struct pci_dev *pdev, const struct pci_device_id *ent); -static int uli_scr_read(struct ata_link *link, unsigned int sc_reg, u32 *val); -static int uli_scr_write(struct ata_link *link, unsigned int sc_reg, u32 val); +static int uli_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val); +static int uli_scr_write(struct ata_port *ap, unsigned int sc_reg, u32 val); static const struct pci_device_id uli_pci_tbl[] = { { PCI_VDEVICE(AL, 0x5289), uli_5289 }, @@ -107,39 +107,39 @@ static unsigned int get_scr_cfg_addr(struct ata_port *ap, unsigned int sc_reg) return hpriv->scr_cfg_addr[ap->port_no] + (4 * sc_reg); } -static u32 uli_scr_cfg_read(struct ata_link *link, unsigned int sc_reg) +static u32 uli_scr_cfg_read(struct ata_port *ap, unsigned int sc_reg) { - struct pci_dev *pdev = to_pci_dev(link->ap->host->dev); - unsigned int cfg_addr = get_scr_cfg_addr(link->ap, sc_reg); + struct pci_dev *pdev = to_pci_dev(ap->host->dev); + unsigned int cfg_addr = get_scr_cfg_addr(ap, sc_reg); u32 val; pci_read_config_dword(pdev, cfg_addr, &val); return val; } -static void uli_scr_cfg_write(struct ata_link *link, unsigned int scr, u32 val) +static void uli_scr_cfg_write(struct ata_port *ap, unsigned int scr, u32 val) { - struct pci_dev *pdev = to_pci_dev(link->ap->host->dev); - unsigned int cfg_addr = get_scr_cfg_addr(link->ap, scr); + struct pci_dev *pdev = to_pci_dev(ap->host->dev); + unsigned int cfg_addr = get_scr_cfg_addr(ap, scr); pci_write_config_dword(pdev, cfg_addr, val); } -static int uli_scr_read(struct ata_link *link, unsigned int sc_reg, u32 *val) +static int uli_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val) { if (sc_reg > SCR_CONTROL) return -EINVAL; - *val = uli_scr_cfg_read(link, sc_reg); + *val = uli_scr_cfg_read(ap, sc_reg); return 0; } -static int uli_scr_write(struct ata_link *link, unsigned int sc_reg, u32 val) +static int uli_scr_write(struct ata_port *ap, unsigned int sc_reg, u32 val) { if (sc_reg > SCR_CONTROL) //SCR_CONTROL=2, SCR_ERROR=1, SCR_STATUS=0 return -EINVAL; - uli_scr_cfg_write(link, sc_reg, val); + uli_scr_cfg_write(ap, sc_reg, val); return 0; } diff --git a/trunk/drivers/ata/sata_via.c b/trunk/drivers/ata/sata_via.c index 1cfa74535d91..96deeb354e16 100644 --- a/trunk/drivers/ata/sata_via.c +++ b/trunk/drivers/ata/sata_via.c @@ -68,8 +68,8 @@ enum { }; static int svia_init_one(struct pci_dev *pdev, const struct pci_device_id *ent); -static int svia_scr_read(struct ata_link *link, unsigned int sc_reg, u32 *val); -static int svia_scr_write(struct ata_link *link, unsigned int sc_reg, u32 val); +static int svia_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val); +static int svia_scr_write(struct ata_port *ap, unsigned int sc_reg, u32 val); static void svia_noop_freeze(struct ata_port *ap); static int vt6420_prereset(struct ata_link *link, unsigned long deadline); static int vt6421_pata_cable_detect(struct ata_port *ap); @@ -152,19 +152,19 @@ MODULE_LICENSE("GPL"); MODULE_DEVICE_TABLE(pci, svia_pci_tbl); MODULE_VERSION(DRV_VERSION); -static int svia_scr_read(struct ata_link *link, unsigned int sc_reg, u32 *val) +static int svia_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val) { if (sc_reg > SCR_CONTROL) return -EINVAL; - *val = ioread32(link->ap->ioaddr.scr_addr + (4 * sc_reg)); + *val = ioread32(ap->ioaddr.scr_addr + (4 * sc_reg)); return 0; } -static int svia_scr_write(struct ata_link *link, unsigned int sc_reg, u32 val) +static int svia_scr_write(struct ata_port *ap, unsigned int sc_reg, u32 val) { if (sc_reg > SCR_CONTROL) return -EINVAL; - iowrite32(val, link->ap->ioaddr.scr_addr + (4 * sc_reg)); + iowrite32(val, ap->ioaddr.scr_addr + (4 * sc_reg)); return 0; } @@ -210,20 +210,20 @@ static int vt6420_prereset(struct ata_link *link, unsigned long deadline) goto skip_scr; /* Resume phy. This is the old SATA resume sequence */ - svia_scr_write(link, SCR_CONTROL, 0x300); - svia_scr_read(link, SCR_CONTROL, &scontrol); /* flush */ + svia_scr_write(ap, SCR_CONTROL, 0x300); + svia_scr_read(ap, SCR_CONTROL, &scontrol); /* flush */ /* wait for phy to become ready, if necessary */ do { msleep(200); - svia_scr_read(link, SCR_STATUS, &sstatus); + svia_scr_read(ap, SCR_STATUS, &sstatus); if ((sstatus & 0xf) != 1) break; } while (time_before(jiffies, timeout)); /* open code sata_print_link_status() */ - svia_scr_read(link, SCR_STATUS, &sstatus); - svia_scr_read(link, SCR_CONTROL, &scontrol); + svia_scr_read(ap, SCR_STATUS, &sstatus); + svia_scr_read(ap, SCR_CONTROL, &scontrol); online = (sstatus & 0xf) == 0x3; @@ -232,7 +232,7 @@ static int vt6420_prereset(struct ata_link *link, unsigned long deadline) online ? "up" : "down", sstatus, scontrol); /* SStatus is read one more time */ - svia_scr_read(link, SCR_STATUS, &sstatus); + svia_scr_read(ap, SCR_STATUS, &sstatus); if (!online) { /* tell EH to bail */ diff --git a/trunk/drivers/ata/sata_vsc.c b/trunk/drivers/ata/sata_vsc.c index c57cdff9e6bd..f3d635c0a2e9 100644 --- a/trunk/drivers/ata/sata_vsc.c +++ b/trunk/drivers/ata/sata_vsc.c @@ -98,22 +98,20 @@ enum { VSC_SATA_INT_PHY_CHANGE), }; -static int vsc_sata_scr_read(struct ata_link *link, - unsigned int sc_reg, u32 *val) +static int vsc_sata_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val) { if (sc_reg > SCR_CONTROL) return -EINVAL; - *val = readl(link->ap->ioaddr.scr_addr + (sc_reg * 4)); + *val = readl(ap->ioaddr.scr_addr + (sc_reg * 4)); return 0; } -static int vsc_sata_scr_write(struct ata_link *link, - unsigned int sc_reg, u32 val) +static int vsc_sata_scr_write(struct ata_port *ap, unsigned int sc_reg, u32 val) { if (sc_reg > SCR_CONTROL) return -EINVAL; - writel(val, link->ap->ioaddr.scr_addr + (sc_reg * 4)); + writel(val, ap->ioaddr.scr_addr + (sc_reg * 4)); return 0; } diff --git a/trunk/drivers/hwmon/abituguru3.c b/trunk/drivers/hwmon/abituguru3.c index d9e7a49d6cbf..d568c65c1370 100644 --- a/trunk/drivers/hwmon/abituguru3.c +++ b/trunk/drivers/hwmon/abituguru3.c @@ -279,7 +279,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { { "OTES1 Fan", 36, 2, 60, 1, 0 }, { NULL, 0, 0, 0, 0, 0 } } }, - { 0x0011, "AT8 32X(ATI RD580-ULI M1575)", { + { 0x0011, NULL /* Abit AT8 32X, need DMI string */, { { "CPU Core", 0, 0, 10, 1, 0 }, { "DDR", 1, 0, 20, 1, 0 }, { "DDR VTT", 2, 0, 10, 1, 0 }, @@ -303,7 +303,6 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { { "SYS Fan", 34, 2, 60, 1, 0 }, { "AUX1 Fan", 35, 2, 60, 1, 0 }, { "AUX2 Fan", 36, 2, 60, 1, 0 }, - { "AUX3 Fan", 37, 2, 60, 1, 0 }, { NULL, 0, 0, 0, 0, 0 } } }, { 0x0012, NULL /* Abit AN8 32X, need DMI string */, { diff --git a/trunk/drivers/hwmon/it87.c b/trunk/drivers/hwmon/it87.c index d793cc011990..f1133081cc42 100644 --- a/trunk/drivers/hwmon/it87.c +++ b/trunk/drivers/hwmon/it87.c @@ -46,8 +46,6 @@ #include #include #include -#include -#include #include #define DRVNAME "it87" @@ -238,8 +236,6 @@ struct it87_sio_data { /* Values read from Super-I/O config space */ u8 revision; u8 vid_value; - /* Values set based on DMI strings */ - u8 skip_pwm; }; /* For each registered chip, we need to keep some data in memory. @@ -968,7 +964,6 @@ static int __init it87_find(unsigned short *address, { int err = -ENODEV; u16 chip_type; - const char *board_vendor, *board_name; superio_enter(); chip_type = force_id ? force_id : superio_inw(DEVID); @@ -1027,24 +1022,6 @@ static int __init it87_find(unsigned short *address, pr_info("it87: in7 is VCCH (+5V Stand-By)\n"); } - /* Disable specific features based on DMI strings */ - board_vendor = dmi_get_system_info(DMI_BOARD_VENDOR); - board_name = dmi_get_system_info(DMI_BOARD_NAME); - if (board_vendor && board_name) { - if (strcmp(board_vendor, "nVIDIA") == 0 - && strcmp(board_name, "FN68PT") == 0) { - /* On the Shuttle SN68PT, FAN_CTL2 is apparently not - connected to a fan, but to something else. One user - has reported instant system power-off when changing - the PWM2 duty cycle, so we disable it. - I use the board name string as the trigger in case - the same board is ever used in other systems. */ - pr_info("it87: Disabling pwm2 due to " - "hardware constraints\n"); - sio_data->skip_pwm = (1 << 1); - } - } - exit: superio_exit(); return err; @@ -1191,33 +1168,25 @@ static int __devinit it87_probe(struct platform_device *pdev) } if (enable_pwm_interface) { - if (!(sio_data->skip_pwm & (1 << 0))) { - if ((err = device_create_file(dev, - &sensor_dev_attr_pwm1_enable.dev_attr)) - || (err = device_create_file(dev, - &sensor_dev_attr_pwm1.dev_attr)) - || (err = device_create_file(dev, - &dev_attr_pwm1_freq))) - goto ERROR4; - } - if (!(sio_data->skip_pwm & (1 << 1))) { - if ((err = device_create_file(dev, - &sensor_dev_attr_pwm2_enable.dev_attr)) - || (err = device_create_file(dev, - &sensor_dev_attr_pwm2.dev_attr)) - || (err = device_create_file(dev, - &dev_attr_pwm2_freq))) - goto ERROR4; - } - if (!(sio_data->skip_pwm & (1 << 2))) { - if ((err = device_create_file(dev, - &sensor_dev_attr_pwm3_enable.dev_attr)) - || (err = device_create_file(dev, - &sensor_dev_attr_pwm3.dev_attr)) - || (err = device_create_file(dev, - &dev_attr_pwm3_freq))) - goto ERROR4; - } + if ((err = device_create_file(dev, + &sensor_dev_attr_pwm1_enable.dev_attr)) + || (err = device_create_file(dev, + &sensor_dev_attr_pwm2_enable.dev_attr)) + || (err = device_create_file(dev, + &sensor_dev_attr_pwm3_enable.dev_attr)) + || (err = device_create_file(dev, + &sensor_dev_attr_pwm1.dev_attr)) + || (err = device_create_file(dev, + &sensor_dev_attr_pwm2.dev_attr)) + || (err = device_create_file(dev, + &sensor_dev_attr_pwm3.dev_attr)) + || (err = device_create_file(dev, + &dev_attr_pwm1_freq)) + || (err = device_create_file(dev, + &dev_attr_pwm2_freq)) + || (err = device_create_file(dev, + &dev_attr_pwm3_freq))) + goto ERROR4; } if (data->type == it8712 || data->type == it8716 @@ -1577,7 +1546,6 @@ static int __init sm_it87_init(void) unsigned short isa_address=0; struct it87_sio_data sio_data; - memset(&sio_data, 0, sizeof(struct it87_sio_data)); err = it87_find(&isa_address, &sio_data); if (err) return err; diff --git a/trunk/drivers/misc/eeepc-laptop.c b/trunk/drivers/misc/eeepc-laptop.c index 1ee8501e90f1..facdb9893c84 100644 --- a/trunk/drivers/misc/eeepc-laptop.c +++ b/trunk/drivers/misc/eeepc-laptop.c @@ -450,14 +450,12 @@ static int eeepc_get_fan_pwm(void) int value = 0; read_acpi_int(NULL, EEEPC_EC_FAN_PWM, &value); - value = value * 255 / 100; return (value); } static void eeepc_set_fan_pwm(int value) { - value = SENSORS_LIMIT(value, 0, 255); - value = value * 100 / 255; + value = SENSORS_LIMIT(value, 0, 100); ec_write(EEEPC_EC_SC02, value); } @@ -522,23 +520,15 @@ static ssize_t show_sys_hwmon(int (*get)(void), char *buf) static SENSOR_DEVICE_ATTR(_name, _mode, show_##_name, store_##_name, 0); EEEPC_CREATE_SENSOR_ATTR(fan1_input, S_IRUGO, eeepc_get_fan_rpm, NULL); -EEEPC_CREATE_SENSOR_ATTR(pwm1, S_IRUGO | S_IWUSR, +EEEPC_CREATE_SENSOR_ATTR(fan1_pwm, S_IRUGO | S_IWUSR, eeepc_get_fan_pwm, eeepc_set_fan_pwm); EEEPC_CREATE_SENSOR_ATTR(pwm1_enable, S_IRUGO | S_IWUSR, eeepc_get_fan_ctrl, eeepc_set_fan_ctrl); -static ssize_t -show_name(struct device *dev, struct device_attribute *attr, char *buf) -{ - return sprintf(buf, "eeepc\n"); -} -static SENSOR_DEVICE_ATTR(name, S_IRUGO, show_name, NULL, 0); - static struct attribute *hwmon_attributes[] = { - &sensor_dev_attr_pwm1.dev_attr.attr, + &sensor_dev_attr_fan1_pwm.dev_attr.attr, &sensor_dev_attr_fan1_input.dev_attr.attr, &sensor_dev_attr_pwm1_enable.dev_attr.attr, - &sensor_dev_attr_name.dev_attr.attr, NULL }; diff --git a/trunk/drivers/pnp/Makefile b/trunk/drivers/pnp/Makefile index e83f34f1b5ba..26f5abc9c3f7 100644 --- a/trunk/drivers/pnp/Makefile +++ b/trunk/drivers/pnp/Makefile @@ -2,15 +2,12 @@ # Makefile for the Linux Plug-and-Play Support. # -obj-y := core.o card.o driver.o resource.o manager.o support.o interface.o quirks.o +obj-y := core.o card.o driver.o resource.o manager.o support.o interface.o quirks.o system.o obj-$(CONFIG_PNPACPI) += pnpacpi/ obj-$(CONFIG_PNPBIOS) += pnpbios/ obj-$(CONFIG_ISAPNP) += isapnp/ -# pnp_system_init goes after pnpacpi/pnpbios init -obj-y += system.o - ifeq ($(CONFIG_PNP_DEBUG),y) EXTRA_CFLAGS += -DDEBUG endif diff --git a/trunk/drivers/pnp/pnpacpi/core.c b/trunk/drivers/pnp/pnpacpi/core.c index 53561d72b4ee..c1b9ea34977b 100644 --- a/trunk/drivers/pnp/pnpacpi/core.c +++ b/trunk/drivers/pnp/pnpacpi/core.c @@ -268,7 +268,7 @@ static int __init pnpacpi_init(void) return 0; } -fs_initcall(pnpacpi_init); +subsys_initcall(pnpacpi_init); static int __init pnpacpi_setup(char *str) { diff --git a/trunk/drivers/pnp/pnpbios/core.c b/trunk/drivers/pnp/pnpbios/core.c index 662dfcddedc6..19a4be1a9a31 100644 --- a/trunk/drivers/pnp/pnpbios/core.c +++ b/trunk/drivers/pnp/pnpbios/core.c @@ -571,7 +571,7 @@ static int __init pnpbios_init(void) return 0; } -fs_initcall(pnpbios_init); +subsys_initcall(pnpbios_init); static int __init pnpbios_thread_init(void) { diff --git a/trunk/drivers/scsi/libsas/sas_ata.c b/trunk/drivers/scsi/libsas/sas_ata.c index e1872989710a..48ee8c7f5bdd 100644 --- a/trunk/drivers/scsi/libsas/sas_ata.c +++ b/trunk/drivers/scsi/libsas/sas_ata.c @@ -294,10 +294,10 @@ static void sas_ata_post_internal(struct ata_queued_cmd *qc) } } -static int sas_ata_scr_write(struct ata_link *link, unsigned int sc_reg_in, +static int sas_ata_scr_write(struct ata_port *ap, unsigned int sc_reg_in, u32 val) { - struct domain_device *dev = link->ap->private_data; + struct domain_device *dev = ap->private_data; SAS_DPRINTK("STUB %s\n", __func__); switch (sc_reg_in) { @@ -319,10 +319,10 @@ static int sas_ata_scr_write(struct ata_link *link, unsigned int sc_reg_in, return 0; } -static int sas_ata_scr_read(struct ata_link *link, unsigned int sc_reg_in, +static int sas_ata_scr_read(struct ata_port *ap, unsigned int sc_reg_in, u32 *val) { - struct domain_device *dev = link->ap->private_data; + struct domain_device *dev = ap->private_data; SAS_DPRINTK("STUB %s\n", __func__); switch (sc_reg_in) { diff --git a/trunk/fs/splice.c b/trunk/fs/splice.c index a1e701c27156..1bbc6f4bb09c 100644 --- a/trunk/fs/splice.c +++ b/trunk/fs/splice.c @@ -898,9 +898,6 @@ static long do_splice_from(struct pipe_inode_info *pipe, struct file *out, if (unlikely(!(out->f_mode & FMODE_WRITE))) return -EBADF; - if (unlikely(out->f_flags & O_APPEND)) - return -EINVAL; - ret = rw_verify_area(WRITE, out, ppos, len); if (unlikely(ret < 0)) return ret; diff --git a/trunk/include/asm-x86/a.out-core.h b/trunk/include/asm-x86/a.out-core.h index f5705761a37b..714207a1c387 100644 --- a/trunk/include/asm-x86/a.out-core.h +++ b/trunk/include/asm-x86/a.out-core.h @@ -9,8 +9,8 @@ * 2 of the Licence, or (at your option) any later version. */ -#ifndef ASM_X86__A_OUT_CORE_H -#define ASM_X86__A_OUT_CORE_H +#ifndef _ASM_A_OUT_CORE_H +#define _ASM_A_OUT_CORE_H #ifdef __KERNEL__ #ifdef CONFIG_X86_32 @@ -70,4 +70,4 @@ static inline void aout_dump_thread(struct pt_regs *regs, struct user *dump) #endif /* CONFIG_X86_32 */ #endif /* __KERNEL__ */ -#endif /* ASM_X86__A_OUT_CORE_H */ +#endif /* _ASM_A_OUT_CORE_H */ diff --git a/trunk/include/asm-x86/a.out.h b/trunk/include/asm-x86/a.out.h index 0948748bc69c..4684f97a5bbd 100644 --- a/trunk/include/asm-x86/a.out.h +++ b/trunk/include/asm-x86/a.out.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__A_OUT_H -#define ASM_X86__A_OUT_H +#ifndef _ASM_X86_A_OUT_H +#define _ASM_X86_A_OUT_H struct exec { @@ -17,4 +17,4 @@ struct exec #define N_DRSIZE(a) ((a).a_drsize) #define N_SYMSIZE(a) ((a).a_syms) -#endif /* ASM_X86__A_OUT_H */ +#endif /* _ASM_X86_A_OUT_H */ diff --git a/trunk/include/asm-x86/acpi.h b/trunk/include/asm-x86/acpi.h index 392e17336be1..35d1743b57ac 100644 --- a/trunk/include/asm-x86/acpi.h +++ b/trunk/include/asm-x86/acpi.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__ACPI_H -#define ASM_X86__ACPI_H +#ifndef _ASM_X86_ACPI_H +#define _ASM_X86_ACPI_H /* * Copyright (C) 2001 Paul Diefenbaugh @@ -175,4 +175,4 @@ static inline void acpi_fake_nodes(const struct bootnode *fake_nodes, #define acpi_unlazy_tlb(x) leave_mm(x) -#endif /* ASM_X86__ACPI_H */ +#endif /*__X86_ASM_ACPI_H*/ diff --git a/trunk/include/asm-x86/agp.h b/trunk/include/asm-x86/agp.h index 3617fd4fcdf9..e4004a9f6a9a 100644 --- a/trunk/include/asm-x86/agp.h +++ b/trunk/include/asm-x86/agp.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__AGP_H -#define ASM_X86__AGP_H +#ifndef _ASM_X86_AGP_H +#define _ASM_X86_AGP_H #include #include @@ -32,4 +32,4 @@ #define free_gatt_pages(table, order) \ free_pages((unsigned long)(table), (order)) -#endif /* ASM_X86__AGP_H */ +#endif diff --git a/trunk/include/asm-x86/alternative.h b/trunk/include/asm-x86/alternative.h index 22d3c9862bf3..f6aa18eadf71 100644 --- a/trunk/include/asm-x86/alternative.h +++ b/trunk/include/asm-x86/alternative.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__ALTERNATIVE_H -#define ASM_X86__ALTERNATIVE_H +#ifndef _ASM_X86_ALTERNATIVE_H +#define _ASM_X86_ALTERNATIVE_H #include #include @@ -180,4 +180,4 @@ extern void add_nops(void *insns, unsigned int len); extern void *text_poke(void *addr, const void *opcode, size_t len); extern void *text_poke_early(void *addr, const void *opcode, size_t len); -#endif /* ASM_X86__ALTERNATIVE_H */ +#endif /* _ASM_X86_ALTERNATIVE_H */ diff --git a/trunk/include/asm-x86/amd_iommu.h b/trunk/include/asm-x86/amd_iommu.h index 783f43e58052..30a12049353b 100644 --- a/trunk/include/asm-x86/amd_iommu.h +++ b/trunk/include/asm-x86/amd_iommu.h @@ -17,8 +17,8 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef ASM_X86__AMD_IOMMU_H -#define ASM_X86__AMD_IOMMU_H +#ifndef _ASM_X86_AMD_IOMMU_H +#define _ASM_X86_AMD_IOMMU_H #ifdef CONFIG_AMD_IOMMU extern int amd_iommu_init(void); @@ -29,4 +29,4 @@ static inline int amd_iommu_init(void) { return -ENODEV; } static inline void amd_iommu_detect(void) { } #endif -#endif /* ASM_X86__AMD_IOMMU_H */ +#endif diff --git a/trunk/include/asm-x86/amd_iommu_types.h b/trunk/include/asm-x86/amd_iommu_types.h index 1ffa4e53c989..dcc812067394 100644 --- a/trunk/include/asm-x86/amd_iommu_types.h +++ b/trunk/include/asm-x86/amd_iommu_types.h @@ -17,8 +17,8 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef ASM_X86__AMD_IOMMU_TYPES_H -#define ASM_X86__AMD_IOMMU_TYPES_H +#ifndef __AMD_IOMMU_TYPES_H__ +#define __AMD_IOMMU_TYPES_H__ #include #include @@ -341,4 +341,4 @@ static inline u16 calc_devid(u8 bus, u8 devfn) return (((u16)bus) << 8) | devfn; } -#endif /* ASM_X86__AMD_IOMMU_TYPES_H */ +#endif diff --git a/trunk/include/asm-x86/apic.h b/trunk/include/asm-x86/apic.h index 65590c9aecd4..133c998161ca 100644 --- a/trunk/include/asm-x86/apic.h +++ b/trunk/include/asm-x86/apic.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__APIC_H -#define ASM_X86__APIC_H +#ifndef _ASM_X86_APIC_H +#define _ASM_X86_APIC_H #include #include @@ -54,11 +54,6 @@ extern int disable_apic; #endif extern int is_vsmp_box(void); -extern void xapic_wait_icr_idle(void); -extern u32 safe_xapic_wait_icr_idle(void); -extern u64 xapic_icr_read(void); -extern void xapic_icr_write(u32, u32); -extern int setup_profiling_timer(unsigned int); static inline void native_apic_write(unsigned long reg, u32 v) { @@ -81,7 +76,9 @@ extern int get_physical_broadcast(void); static inline void ack_APIC_irq(void) { /* - * ack_APIC_irq() actually gets compiled as a single instruction + * ack_APIC_irq() actually gets compiled as a single instruction: + * - a single rmw on Pentium/82489DX + * - a single write on P6+ cores (CONFIG_X86_GOOD_APIC) * ... yummie. */ @@ -131,4 +128,4 @@ static inline void init_apic_mappings(void) { } #endif /* !CONFIG_X86_LOCAL_APIC */ -#endif /* ASM_X86__APIC_H */ +#endif /* __ASM_APIC_H */ diff --git a/trunk/include/asm-x86/apicdef.h b/trunk/include/asm-x86/apicdef.h index c40687da20fc..6b9008c78731 100644 --- a/trunk/include/asm-x86/apicdef.h +++ b/trunk/include/asm-x86/apicdef.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__APICDEF_H -#define ASM_X86__APICDEF_H +#ifndef _ASM_X86_APICDEF_H +#define _ASM_X86_APICDEF_H /* * Constants for various Intel APICs. (local APIC, IOAPIC, etc.) @@ -411,4 +411,4 @@ struct local_apic { #else #define BAD_APICID 0xFFFFu #endif -#endif /* ASM_X86__APICDEF_H */ +#endif diff --git a/trunk/include/asm-x86/arch_hooks.h b/trunk/include/asm-x86/arch_hooks.h index 72adc3a109cc..8411750ceb63 100644 --- a/trunk/include/asm-x86/arch_hooks.h +++ b/trunk/include/asm-x86/arch_hooks.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__ARCH_HOOKS_H -#define ASM_X86__ARCH_HOOKS_H +#ifndef _ASM_ARCH_HOOKS_H +#define _ASM_ARCH_HOOKS_H #include @@ -25,4 +25,4 @@ extern void pre_time_init_hook(void); extern void time_init_hook(void); extern void mca_nmi_hook(void); -#endif /* ASM_X86__ARCH_HOOKS_H */ +#endif diff --git a/trunk/include/asm-x86/asm.h b/trunk/include/asm-x86/asm.h index e1355f44d7c3..97220321f39d 100644 --- a/trunk/include/asm-x86/asm.h +++ b/trunk/include/asm-x86/asm.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__ASM_H -#define ASM_X86__ASM_H +#ifndef _ASM_X86_ASM_H +#define _ASM_X86_ASM_H #ifdef __ASSEMBLY__ # define __ASM_FORM(x) x @@ -20,22 +20,17 @@ #define _ASM_PTR __ASM_SEL(.long, .quad) #define _ASM_ALIGN __ASM_SEL(.balign 4, .balign 8) +#define _ASM_MOV_UL __ASM_SIZE(mov) -#define _ASM_MOV __ASM_SIZE(mov) #define _ASM_INC __ASM_SIZE(inc) #define _ASM_DEC __ASM_SIZE(dec) #define _ASM_ADD __ASM_SIZE(add) #define _ASM_SUB __ASM_SIZE(sub) #define _ASM_XADD __ASM_SIZE(xadd) - #define _ASM_AX __ASM_REG(ax) #define _ASM_BX __ASM_REG(bx) #define _ASM_CX __ASM_REG(cx) #define _ASM_DX __ASM_REG(dx) -#define _ASM_SP __ASM_REG(sp) -#define _ASM_BP __ASM_REG(bp) -#define _ASM_SI __ASM_REG(si) -#define _ASM_DI __ASM_REG(di) /* Exception table entry */ # define _ASM_EXTABLE(from,to) \ @@ -44,4 +39,4 @@ _ASM_PTR #from "," #to "\n" \ " .previous\n" -#endif /* ASM_X86__ASM_H */ +#endif /* _ASM_X86_ASM_H */ diff --git a/trunk/include/asm-x86/atomic_32.h b/trunk/include/asm-x86/atomic_32.h index 14d3f0beb889..21a4825148c0 100644 --- a/trunk/include/asm-x86/atomic_32.h +++ b/trunk/include/asm-x86/atomic_32.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__ATOMIC_32_H -#define ASM_X86__ATOMIC_32_H +#ifndef __ARCH_I386_ATOMIC__ +#define __ARCH_I386_ATOMIC__ #include #include @@ -256,4 +256,4 @@ static inline int atomic_add_unless(atomic_t *v, int a, int u) #define smp_mb__after_atomic_inc() barrier() #include -#endif /* ASM_X86__ATOMIC_32_H */ +#endif diff --git a/trunk/include/asm-x86/atomic_64.h b/trunk/include/asm-x86/atomic_64.h index 2cb218c4a356..91c7d03e65bc 100644 --- a/trunk/include/asm-x86/atomic_64.h +++ b/trunk/include/asm-x86/atomic_64.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__ATOMIC_64_H -#define ASM_X86__ATOMIC_64_H +#ifndef __ARCH_X86_64_ATOMIC__ +#define __ARCH_X86_64_ATOMIC__ #include #include @@ -470,4 +470,4 @@ static inline void atomic_or_long(unsigned long *v1, unsigned long v2) #define smp_mb__after_atomic_inc() barrier() #include -#endif /* ASM_X86__ATOMIC_64_H */ +#endif diff --git a/trunk/include/asm-x86/auxvec.h b/trunk/include/asm-x86/auxvec.h index 12c7cac74202..87f5e6d5a020 100644 --- a/trunk/include/asm-x86/auxvec.h +++ b/trunk/include/asm-x86/auxvec.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__AUXVEC_H -#define ASM_X86__AUXVEC_H +#ifndef _ASM_X86_AUXVEC_H +#define _ASM_X86_AUXVEC_H /* * Architecture-neutral AT_ values in 0-17, leave some room * for more of them, start the x86-specific ones at 32. @@ -9,4 +9,4 @@ #endif #define AT_SYSINFO_EHDR 33 -#endif /* ASM_X86__AUXVEC_H */ +#endif diff --git a/trunk/include/asm-x86/bios_ebda.h b/trunk/include/asm-x86/bios_ebda.h index ec42ed874591..0033e50c13b2 100644 --- a/trunk/include/asm-x86/bios_ebda.h +++ b/trunk/include/asm-x86/bios_ebda.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__BIOS_EBDA_H -#define ASM_X86__BIOS_EBDA_H +#ifndef _MACH_BIOS_EBDA_H +#define _MACH_BIOS_EBDA_H #include @@ -16,4 +16,4 @@ static inline unsigned int get_bios_ebda(void) void reserve_ebda_region(void); -#endif /* ASM_X86__BIOS_EBDA_H */ +#endif /* _MACH_BIOS_EBDA_H */ diff --git a/trunk/include/asm-x86/bitops.h b/trunk/include/asm-x86/bitops.h index 61989b93b475..cfb2b64f76e7 100644 --- a/trunk/include/asm-x86/bitops.h +++ b/trunk/include/asm-x86/bitops.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__BITOPS_H -#define ASM_X86__BITOPS_H +#ifndef _ASM_X86_BITOPS_H +#define _ASM_X86_BITOPS_H /* * Copyright 1992, Linus Torvalds. @@ -458,4 +458,4 @@ static inline void set_bit_string(unsigned long *bitmap, #include #endif /* __KERNEL__ */ -#endif /* ASM_X86__BITOPS_H */ +#endif /* _ASM_X86_BITOPS_H */ diff --git a/trunk/include/asm-x86/boot.h b/trunk/include/asm-x86/boot.h index 825de5dc867c..2faed7ecb092 100644 --- a/trunk/include/asm-x86/boot.h +++ b/trunk/include/asm-x86/boot.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__BOOT_H -#define ASM_X86__BOOT_H +#ifndef _ASM_BOOT_H +#define _ASM_BOOT_H /* Don't touch these, unless you really know what you're doing. */ #define DEF_INITSEG 0x9000 @@ -25,4 +25,4 @@ #define BOOT_STACK_SIZE 0x1000 #endif -#endif /* ASM_X86__BOOT_H */ +#endif /* _ASM_BOOT_H */ diff --git a/trunk/include/asm-x86/bootparam.h b/trunk/include/asm-x86/bootparam.h index ccf027e2d97d..ae22bdf0ab14 100644 --- a/trunk/include/asm-x86/bootparam.h +++ b/trunk/include/asm-x86/bootparam.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__BOOTPARAM_H -#define ASM_X86__BOOTPARAM_H +#ifndef _ASM_BOOTPARAM_H +#define _ASM_BOOTPARAM_H #include #include @@ -108,4 +108,4 @@ struct boot_params { __u8 _pad9[276]; /* 0xeec */ } __attribute__((packed)); -#endif /* ASM_X86__BOOTPARAM_H */ +#endif /* _ASM_BOOTPARAM_H */ diff --git a/trunk/include/asm-x86/bug.h b/trunk/include/asm-x86/bug.h index 91ad43a54c47..b69aa64b82a4 100644 --- a/trunk/include/asm-x86/bug.h +++ b/trunk/include/asm-x86/bug.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__BUG_H -#define ASM_X86__BUG_H +#ifndef _ASM_X86_BUG_H +#define _ASM_X86_BUG_H #ifdef CONFIG_BUG #define HAVE_ARCH_BUG @@ -36,4 +36,4 @@ do { \ #endif /* !CONFIG_BUG */ #include -#endif /* ASM_X86__BUG_H */ +#endif diff --git a/trunk/include/asm-x86/bugs.h b/trunk/include/asm-x86/bugs.h index 4761c461d23a..021cbdd5f258 100644 --- a/trunk/include/asm-x86/bugs.h +++ b/trunk/include/asm-x86/bugs.h @@ -1,7 +1,7 @@ -#ifndef ASM_X86__BUGS_H -#define ASM_X86__BUGS_H +#ifndef _ASM_X86_BUGS_H +#define _ASM_X86_BUGS_H extern void check_bugs(void); int ppro_with_ram_bug(void); -#endif /* ASM_X86__BUGS_H */ +#endif /* _ASM_X86_BUGS_H */ diff --git a/trunk/include/asm-x86/byteorder.h b/trunk/include/asm-x86/byteorder.h index 722f27d68105..e02ae2d89acf 100644 --- a/trunk/include/asm-x86/byteorder.h +++ b/trunk/include/asm-x86/byteorder.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__BYTEORDER_H -#define ASM_X86__BYTEORDER_H +#ifndef _ASM_X86_BYTEORDER_H +#define _ASM_X86_BYTEORDER_H #include #include @@ -78,4 +78,4 @@ static inline __attribute_const__ __u32 ___arch__swab32(__u32 x) #include -#endif /* ASM_X86__BYTEORDER_H */ +#endif /* _ASM_X86_BYTEORDER_H */ diff --git a/trunk/include/asm-x86/cache.h b/trunk/include/asm-x86/cache.h index ea3f1cc06a97..1e0bac86f38f 100644 --- a/trunk/include/asm-x86/cache.h +++ b/trunk/include/asm-x86/cache.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__CACHE_H -#define ASM_X86__CACHE_H +#ifndef _ARCH_X86_CACHE_H +#define _ARCH_X86_CACHE_H /* L1 cache line size */ #define L1_CACHE_SHIFT (CONFIG_X86_L1_CACHE_SHIFT) @@ -17,4 +17,4 @@ #endif #endif -#endif /* ASM_X86__CACHE_H */ +#endif diff --git a/trunk/include/asm-x86/cacheflush.h b/trunk/include/asm-x86/cacheflush.h index 59859cb28a36..f4c0ab50d2c2 100644 --- a/trunk/include/asm-x86/cacheflush.h +++ b/trunk/include/asm-x86/cacheflush.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__CACHEFLUSH_H -#define ASM_X86__CACHEFLUSH_H +#ifndef _ASM_X86_CACHEFLUSH_H +#define _ASM_X86_CACHEFLUSH_H /* Keep includes the same across arches. */ #include @@ -112,4 +112,4 @@ static inline int rodata_test(void) } #endif -#endif /* ASM_X86__CACHEFLUSH_H */ +#endif diff --git a/trunk/include/asm-x86/calgary.h b/trunk/include/asm-x86/calgary.h index 933fd272f826..67f60406e2d8 100644 --- a/trunk/include/asm-x86/calgary.h +++ b/trunk/include/asm-x86/calgary.h @@ -21,8 +21,8 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef ASM_X86__CALGARY_H -#define ASM_X86__CALGARY_H +#ifndef _ASM_X86_64_CALGARY_H +#define _ASM_X86_64_CALGARY_H #include #include @@ -69,4 +69,4 @@ static inline int calgary_iommu_init(void) { return 1; } static inline void detect_calgary(void) { return; } #endif -#endif /* ASM_X86__CALGARY_H */ +#endif /* _ASM_X86_64_CALGARY_H */ diff --git a/trunk/include/asm-x86/checksum_32.h b/trunk/include/asm-x86/checksum_32.h index d041e8cda227..52bbb0d8c4c1 100644 --- a/trunk/include/asm-x86/checksum_32.h +++ b/trunk/include/asm-x86/checksum_32.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__CHECKSUM_32_H -#define ASM_X86__CHECKSUM_32_H +#ifndef _I386_CHECKSUM_H +#define _I386_CHECKSUM_H #include @@ -186,4 +186,4 @@ static inline __wsum csum_and_copy_to_user(const void *src, return (__force __wsum)-1; /* invalid checksum */ } -#endif /* ASM_X86__CHECKSUM_32_H */ +#endif diff --git a/trunk/include/asm-x86/checksum_64.h b/trunk/include/asm-x86/checksum_64.h index 110f403beb89..8bd861cc5267 100644 --- a/trunk/include/asm-x86/checksum_64.h +++ b/trunk/include/asm-x86/checksum_64.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__CHECKSUM_64_H -#define ASM_X86__CHECKSUM_64_H +#ifndef _X86_64_CHECKSUM_H +#define _X86_64_CHECKSUM_H /* * Checksums for x86-64 @@ -188,4 +188,4 @@ static inline unsigned add32_with_carry(unsigned a, unsigned b) return a; } -#endif /* ASM_X86__CHECKSUM_64_H */ +#endif diff --git a/trunk/include/asm-x86/cmpxchg_32.h b/trunk/include/asm-x86/cmpxchg_32.h index 0622e45cdf7c..bf5a69d1329e 100644 --- a/trunk/include/asm-x86/cmpxchg_32.h +++ b/trunk/include/asm-x86/cmpxchg_32.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__CMPXCHG_32_H -#define ASM_X86__CMPXCHG_32_H +#ifndef __ASM_CMPXCHG_H +#define __ASM_CMPXCHG_H #include /* for LOCK_PREFIX */ @@ -341,4 +341,4 @@ extern unsigned long long cmpxchg_486_u64(volatile void *, u64, u64); #endif -#endif /* ASM_X86__CMPXCHG_32_H */ +#endif diff --git a/trunk/include/asm-x86/cmpxchg_64.h b/trunk/include/asm-x86/cmpxchg_64.h index 63c1a5e61b99..17463ccf8166 100644 --- a/trunk/include/asm-x86/cmpxchg_64.h +++ b/trunk/include/asm-x86/cmpxchg_64.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__CMPXCHG_64_H -#define ASM_X86__CMPXCHG_64_H +#ifndef __ASM_CMPXCHG_H +#define __ASM_CMPXCHG_H #include /* Provides LOCK_PREFIX */ @@ -182,4 +182,4 @@ static inline unsigned long __cmpxchg_local(volatile void *ptr, cmpxchg_local((ptr), (o), (n)); \ }) -#endif /* ASM_X86__CMPXCHG_64_H */ +#endif diff --git a/trunk/include/asm-x86/compat.h b/trunk/include/asm-x86/compat.h index 6732b150949e..1793ac317a30 100644 --- a/trunk/include/asm-x86/compat.h +++ b/trunk/include/asm-x86/compat.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__COMPAT_H -#define ASM_X86__COMPAT_H +#ifndef _ASM_X86_64_COMPAT_H +#define _ASM_X86_64_COMPAT_H /* * Architecture specific compatibility types @@ -215,4 +215,4 @@ static inline int is_compat_task(void) return current_thread_info()->status & TS_COMPAT; } -#endif /* ASM_X86__COMPAT_H */ +#endif /* _ASM_X86_64_COMPAT_H */ diff --git a/trunk/include/asm-x86/cpu.h b/trunk/include/asm-x86/cpu.h index 83a115083f0d..73f2ea84fd74 100644 --- a/trunk/include/asm-x86/cpu.h +++ b/trunk/include/asm-x86/cpu.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__CPU_H -#define ASM_X86__CPU_H +#ifndef _ASM_I386_CPU_H_ +#define _ASM_I386_CPU_H_ #include #include @@ -17,4 +17,4 @@ extern void arch_unregister_cpu(int); #endif DECLARE_PER_CPU(int, cpu_state); -#endif /* ASM_X86__CPU_H */ +#endif /* _ASM_I386_CPU_H_ */ diff --git a/trunk/include/asm-x86/cpufeature.h b/trunk/include/asm-x86/cpufeature.h index 250fa0cb144b..cfcfb0a806ba 100644 --- a/trunk/include/asm-x86/cpufeature.h +++ b/trunk/include/asm-x86/cpufeature.h @@ -1,8 +1,8 @@ /* * Defines x86 CPU feature bits */ -#ifndef ASM_X86__CPUFEATURE_H -#define ASM_X86__CPUFEATURE_H +#ifndef _ASM_X86_CPUFEATURE_H +#define _ASM_X86_CPUFEATURE_H #include @@ -224,4 +224,4 @@ extern const char * const x86_power_flags[32]; #endif /* defined(__KERNEL__) && !defined(__ASSEMBLY__) */ -#endif /* ASM_X86__CPUFEATURE_H */ +#endif /* _ASM_X86_CPUFEATURE_H */ diff --git a/trunk/include/asm-x86/current.h b/trunk/include/asm-x86/current.h index a863ead856f3..7515c19d4988 100644 --- a/trunk/include/asm-x86/current.h +++ b/trunk/include/asm-x86/current.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__CURRENT_H -#define ASM_X86__CURRENT_H +#ifndef _X86_CURRENT_H +#define _X86_CURRENT_H #ifdef CONFIG_X86_32 #include @@ -36,4 +36,4 @@ static __always_inline struct task_struct *get_current(void) #define current get_current() -#endif /* ASM_X86__CURRENT_H */ +#endif /* X86_CURRENT_H */ diff --git a/trunk/include/asm-x86/debugreg.h b/trunk/include/asm-x86/debugreg.h index ecb6907c3ea4..c6344d572b03 100644 --- a/trunk/include/asm-x86/debugreg.h +++ b/trunk/include/asm-x86/debugreg.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__DEBUGREG_H -#define ASM_X86__DEBUGREG_H +#ifndef _ASM_X86_DEBUGREG_H +#define _ASM_X86_DEBUGREG_H /* Indicate the register numbers for a number of the specific @@ -67,4 +67,4 @@ #define DR_LOCAL_SLOWDOWN (0x100) /* Local slow the pipeline */ #define DR_GLOBAL_SLOWDOWN (0x200) /* Global slow the pipeline */ -#endif /* ASM_X86__DEBUGREG_H */ +#endif diff --git a/trunk/include/asm-x86/delay.h b/trunk/include/asm-x86/delay.h index 8a0da95b4fc5..409a649204aa 100644 --- a/trunk/include/asm-x86/delay.h +++ b/trunk/include/asm-x86/delay.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__DELAY_H -#define ASM_X86__DELAY_H +#ifndef _ASM_X86_DELAY_H +#define _ASM_X86_DELAY_H /* * Copyright (C) 1993 Linus Torvalds @@ -28,4 +28,4 @@ extern void __delay(unsigned long loops); void use_tsc_delay(void); -#endif /* ASM_X86__DELAY_H */ +#endif /* _ASM_X86_DELAY_H */ diff --git a/trunk/include/asm-x86/desc.h b/trunk/include/asm-x86/desc.h index b73fea54def2..a44c4dc70590 100644 --- a/trunk/include/asm-x86/desc.h +++ b/trunk/include/asm-x86/desc.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__DESC_H -#define ASM_X86__DESC_H +#ifndef _ASM_DESC_H_ +#define _ASM_DESC_H_ #ifndef __ASSEMBLY__ #include @@ -397,4 +397,4 @@ static inline void set_system_gate_ist(int n, void *addr, unsigned ist) #endif /* __ASSEMBLY__ */ -#endif /* ASM_X86__DESC_H */ +#endif diff --git a/trunk/include/asm-x86/desc_defs.h b/trunk/include/asm-x86/desc_defs.h index b881db664b46..f7bacf357dac 100644 --- a/trunk/include/asm-x86/desc_defs.h +++ b/trunk/include/asm-x86/desc_defs.h @@ -1,6 +1,6 @@ /* Written 2000 by Andi Kleen */ -#ifndef ASM_X86__DESC_DEFS_H -#define ASM_X86__DESC_DEFS_H +#ifndef __ARCH_DESC_DEFS_H +#define __ARCH_DESC_DEFS_H /* * Segment descriptor structure definitions, usable from both x86_64 and i386 @@ -92,4 +92,4 @@ struct desc_ptr { #endif /* !__ASSEMBLY__ */ -#endif /* ASM_X86__DESC_DEFS_H */ +#endif diff --git a/trunk/include/asm-x86/device.h b/trunk/include/asm-x86/device.h index 1bece04c7d9d..3c034f48fdb0 100644 --- a/trunk/include/asm-x86/device.h +++ b/trunk/include/asm-x86/device.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__DEVICE_H -#define ASM_X86__DEVICE_H +#ifndef _ASM_X86_DEVICE_H +#define _ASM_X86_DEVICE_H struct dev_archdata { #ifdef CONFIG_ACPI @@ -13,4 +13,4 @@ struct dma_mapping_ops *dma_ops; #endif }; -#endif /* ASM_X86__DEVICE_H */ +#endif /* _ASM_X86_DEVICE_H */ diff --git a/trunk/include/asm-x86/div64.h b/trunk/include/asm-x86/div64.h index f9530f23f1d6..9a2d644c08ef 100644 --- a/trunk/include/asm-x86/div64.h +++ b/trunk/include/asm-x86/div64.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__DIV64_H -#define ASM_X86__DIV64_H +#ifndef _ASM_X86_DIV64_H +#define _ASM_X86_DIV64_H #ifdef CONFIG_X86_32 @@ -57,4 +57,4 @@ static inline u64 div_u64_rem(u64 dividend, u32 divisor, u32 *remainder) # include #endif /* CONFIG_X86_32 */ -#endif /* ASM_X86__DIV64_H */ +#endif /* _ASM_X86_DIV64_H */ diff --git a/trunk/include/asm-x86/dma-mapping.h b/trunk/include/asm-x86/dma-mapping.h index 5d200e78bd81..ad9cd6d49bfc 100644 --- a/trunk/include/asm-x86/dma-mapping.h +++ b/trunk/include/asm-x86/dma-mapping.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__DMA_MAPPING_H -#define ASM_X86__DMA_MAPPING_H +#ifndef _ASM_DMA_MAPPING_H_ +#define _ASM_DMA_MAPPING_H_ /* * IOMMU interface. See Documentation/DMA-mapping.txt and DMA-API.txt for @@ -250,4 +250,4 @@ static inline int dma_get_cache_alignment(void) #define dma_is_consistent(d, h) (1) #include -#endif /* ASM_X86__DMA_MAPPING_H */ +#endif diff --git a/trunk/include/asm-x86/dma.h b/trunk/include/asm-x86/dma.h index c9f7a4eec555..ca1098a7e580 100644 --- a/trunk/include/asm-x86/dma.h +++ b/trunk/include/asm-x86/dma.h @@ -5,8 +5,8 @@ * and John Boyd, Nov. 1992. */ -#ifndef ASM_X86__DMA_H -#define ASM_X86__DMA_H +#ifndef _ASM_X86_DMA_H +#define _ASM_X86_DMA_H #include /* And spinlocks */ #include /* need byte IO */ @@ -315,4 +315,4 @@ extern int isa_dma_bridge_buggy; #define isa_dma_bridge_buggy (0) #endif -#endif /* ASM_X86__DMA_H */ +#endif /* _ASM_X86_DMA_H */ diff --git a/trunk/include/asm-x86/dmi.h b/trunk/include/asm-x86/dmi.h index 1cff6fe81fa5..58a86571fe0f 100644 --- a/trunk/include/asm-x86/dmi.h +++ b/trunk/include/asm-x86/dmi.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__DMI_H -#define ASM_X86__DMI_H +#ifndef _ASM_X86_DMI_H +#define _ASM_X86_DMI_H #include @@ -23,4 +23,4 @@ static inline void *dmi_alloc(unsigned len) #define dmi_ioremap early_ioremap #define dmi_iounmap early_iounmap -#endif /* ASM_X86__DMI_H */ +#endif diff --git a/trunk/include/asm-x86/ds.h b/trunk/include/asm-x86/ds.h index c3c953a45b21..7881368142fa 100644 --- a/trunk/include/asm-x86/ds.h +++ b/trunk/include/asm-x86/ds.h @@ -2,237 +2,71 @@ * Debug Store (DS) support * * This provides a low-level interface to the hardware's Debug Store - * feature that is used for branch trace store (BTS) and + * feature that is used for last branch recording (LBR) and * precise-event based sampling (PEBS). * - * It manages: - * - per-thread and per-cpu allocation of BTS and PEBS - * - buffer memory allocation (optional) - * - buffer overflow handling - * - buffer access + * Different architectures use a different DS layout/pointer size. + * The below functions therefore work on a void*. * - * It assumes: - * - get_task_struct on all parameter tasks - * - current is allowed to trace parameter tasks * + * Since there is no user for PEBS, yet, only LBR (or branch + * trace store, BTS) is supported. * - * Copyright (C) 2007-2008 Intel Corporation. - * Markus Metzger , 2007-2008 + * + * Copyright (C) 2007 Intel Corporation. + * Markus Metzger , Dec 2007 */ -#ifndef ASM_X86__DS_H -#define ASM_X86__DS_H - -#ifdef CONFIG_X86_DS +#ifndef _ASM_X86_DS_H +#define _ASM_X86_DS_H #include #include - -struct task_struct; - -/* - * Request BTS or PEBS - * - * Due to alignement constraints, the actual buffer may be slightly - * smaller than the requested or provided buffer. - * - * Returns 0 on success; -Eerrno otherwise - * - * task: the task to request recording for; - * NULL for per-cpu recording on the current cpu - * base: the base pointer for the (non-pageable) buffer; - * NULL if buffer allocation requested - * size: the size of the requested or provided buffer - * ovfl: pointer to a function to be called on buffer overflow; - * NULL if cyclic buffer requested - */ -typedef void (*ds_ovfl_callback_t)(struct task_struct *); -extern int ds_request_bts(struct task_struct *task, void *base, size_t size, - ds_ovfl_callback_t ovfl); -extern int ds_request_pebs(struct task_struct *task, void *base, size_t size, - ds_ovfl_callback_t ovfl); - -/* - * Release BTS or PEBS resources - * - * Frees buffers allocated on ds_request. - * - * Returns 0 on success; -Eerrno otherwise - * - * task: the task to release resources for; - * NULL to release resources for the current cpu - */ -extern int ds_release_bts(struct task_struct *task); -extern int ds_release_pebs(struct task_struct *task); - -/* - * Return the (array) index of the write pointer. - * (assuming an array of BTS/PEBS records) - * - * Returns -Eerrno on error - * - * task: the task to access; - * NULL to access the current cpu - * pos (out): if not NULL, will hold the result - */ -extern int ds_get_bts_index(struct task_struct *task, size_t *pos); -extern int ds_get_pebs_index(struct task_struct *task, size_t *pos); - -/* - * Return the (array) index one record beyond the end of the array. - * (assuming an array of BTS/PEBS records) - * - * Returns -Eerrno on error - * - * task: the task to access; - * NULL to access the current cpu - * pos (out): if not NULL, will hold the result - */ -extern int ds_get_bts_end(struct task_struct *task, size_t *pos); -extern int ds_get_pebs_end(struct task_struct *task, size_t *pos); - -/* - * Provide a pointer to the BTS/PEBS record at parameter index. - * (assuming an array of BTS/PEBS records) - * - * The pointer points directly into the buffer. The user is - * responsible for copying the record. - * - * Returns the size of a single record on success; -Eerrno on error - * - * task: the task to access; - * NULL to access the current cpu - * index: the index of the requested record - * record (out): pointer to the requested record - */ -extern int ds_access_bts(struct task_struct *task, - size_t index, const void **record); -extern int ds_access_pebs(struct task_struct *task, - size_t index, const void **record); - -/* - * Write one or more BTS/PEBS records at the write pointer index and - * advance the write pointer. - * - * If size is not a multiple of the record size, trailing bytes are - * zeroed out. - * - * May result in one or more overflow notifications. - * - * If called during overflow handling, that is, with index >= - * interrupt threshold, the write will wrap around. - * - * An overflow notification is given if and when the interrupt - * threshold is reached during or after the write. - * - * Returns the number of bytes written or -Eerrno. - * - * task: the task to access; - * NULL to access the current cpu - * buffer: the buffer to write - * size: the size of the buffer - */ -extern int ds_write_bts(struct task_struct *task, - const void *buffer, size_t size); -extern int ds_write_pebs(struct task_struct *task, - const void *buffer, size_t size); - -/* - * Same as ds_write_bts/pebs, but omit ownership checks. - * - * This is needed to have some other task than the owner of the - * BTS/PEBS buffer or the parameter task itself write into the - * respective buffer. - */ -extern int ds_unchecked_write_bts(struct task_struct *task, - const void *buffer, size_t size); -extern int ds_unchecked_write_pebs(struct task_struct *task, - const void *buffer, size_t size); - -/* - * Reset the write pointer of the BTS/PEBS buffer. - * - * Returns 0 on success; -Eerrno on error - * - * task: the task to access; - * NULL to access the current cpu - */ -extern int ds_reset_bts(struct task_struct *task); -extern int ds_reset_pebs(struct task_struct *task); - -/* - * Clear the BTS/PEBS buffer and reset the write pointer. - * The entire buffer will be zeroed out. - * - * Returns 0 on success; -Eerrno on error - * - * task: the task to access; - * NULL to access the current cpu - */ -extern int ds_clear_bts(struct task_struct *task); -extern int ds_clear_pebs(struct task_struct *task); - -/* - * Provide the PEBS counter reset value. - * - * Returns 0 on success; -Eerrno on error - * - * task: the task to access; - * NULL to access the current cpu - * value (out): the counter reset value - */ -extern int ds_get_pebs_reset(struct task_struct *task, u64 *value); - -/* - * Set the PEBS counter reset value. - * - * Returns 0 on success; -Eerrno on error - * - * task: the task to access; - * NULL to access the current cpu - * value: the new counter reset value - */ -extern int ds_set_pebs_reset(struct task_struct *task, u64 value); - -/* - * Initialization - */ struct cpuinfo_x86; -extern void __cpuinit ds_init_intel(struct cpuinfo_x86 *); - -/* - * The DS context - part of struct thread_struct. +/* a branch trace record entry + * + * In order to unify the interface between various processor versions, + * we use the below data structure for all processors. */ -struct ds_context { - /* pointer to the DS configuration; goes into MSR_IA32_DS_AREA */ - unsigned char *ds; - /* the owner of the BTS and PEBS configuration, respectively */ - struct task_struct *owner[2]; - /* buffer overflow notification function for BTS and PEBS */ - ds_ovfl_callback_t callback[2]; - /* the original buffer address */ - void *buffer[2]; - /* the number of allocated pages for on-request allocated buffers */ - unsigned int pages[2]; - /* use count */ - unsigned long count; - /* a pointer to the context location inside the thread_struct - * or the per_cpu context array */ - struct ds_context **this; - /* a pointer to the task owning this context, or NULL, if the - * context is owned by a cpu */ - struct task_struct *task; +enum bts_qualifier { + BTS_INVALID = 0, + BTS_BRANCH, + BTS_TASK_ARRIVES, + BTS_TASK_DEPARTS }; -/* called by exit_thread() to free leftover contexts */ -extern void ds_free(struct ds_context *context); - -#else /* CONFIG_X86_DS */ - -#define ds_init_intel(config) do {} while (0) +struct bts_struct { + u64 qualifier; + union { + /* BTS_BRANCH */ + struct { + u64 from_ip; + u64 to_ip; + } lbr; + /* BTS_TASK_ARRIVES or + BTS_TASK_DEPARTS */ + u64 jiffies; + } variant; +}; -#endif /* CONFIG_X86_DS */ -#endif /* ASM_X86__DS_H */ +/* Overflow handling mechanisms */ +#define DS_O_SIGNAL 1 /* send overflow signal */ +#define DS_O_WRAP 2 /* wrap around */ + +extern int ds_allocate(void **, size_t); +extern int ds_free(void **); +extern int ds_get_bts_size(void *); +extern int ds_get_bts_end(void *); +extern int ds_get_bts_index(void *); +extern int ds_set_overflow(void *, int); +extern int ds_get_overflow(void *); +extern int ds_clear(void *); +extern int ds_read_bts(void *, int, struct bts_struct *); +extern int ds_write_bts(void *, const struct bts_struct *); +extern unsigned long ds_debugctl_mask(void); +extern void __cpuinit ds_init_intel(struct cpuinfo_x86 *c); + +#endif /* _ASM_X86_DS_H */ diff --git a/trunk/include/asm-x86/dwarf2.h b/trunk/include/asm-x86/dwarf2.h index 21d1bc32ad7c..738bb9fb3e53 100644 --- a/trunk/include/asm-x86/dwarf2.h +++ b/trunk/include/asm-x86/dwarf2.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__DWARF2_H -#define ASM_X86__DWARF2_H +#ifndef _DWARF2_H +#define _DWARF2_H #ifndef __ASSEMBLY__ #warning "asm/dwarf2.h should be only included in pure assembly files" @@ -58,4 +58,4 @@ #endif -#endif /* ASM_X86__DWARF2_H */ +#endif diff --git a/trunk/include/asm-x86/e820.h b/trunk/include/asm-x86/e820.h index f52daf176bcb..16a31e2c7c57 100644 --- a/trunk/include/asm-x86/e820.h +++ b/trunk/include/asm-x86/e820.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__E820_H -#define ASM_X86__E820_H +#ifndef __ASM_E820_H +#define __ASM_E820_H #define E820MAP 0x2d0 /* our map */ #define E820MAX 128 /* number of entries in E820MAP */ @@ -64,7 +64,6 @@ struct e820map { extern struct e820map e820; extern struct e820map e820_saved; -extern unsigned long pci_mem_start; extern int e820_any_mapped(u64 start, u64 end, unsigned type); extern int e820_all_mapped(u64 start, u64 end, unsigned type); extern void e820_add_region(u64 start, u64 size, int type); @@ -141,4 +140,4 @@ extern char *memory_setup(void); #define HIGH_MEMORY (1024*1024) #endif /* __KERNEL__ */ -#endif /* ASM_X86__E820_H */ +#endif /* __ASM_E820_H */ diff --git a/trunk/include/asm-x86/edac.h b/trunk/include/asm-x86/edac.h index 9493c5b27bbd..a8088f63a30e 100644 --- a/trunk/include/asm-x86/edac.h +++ b/trunk/include/asm-x86/edac.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__EDAC_H -#define ASM_X86__EDAC_H +#ifndef _ASM_X86_EDAC_H +#define _ASM_X86_EDAC_H /* ECC atomic, DMA, SMP and interrupt safe scrub function */ @@ -15,4 +15,4 @@ static inline void atomic_scrub(void *va, u32 size) asm volatile("lock; addl $0, %0"::"m" (*virt_addr)); } -#endif /* ASM_X86__EDAC_H */ +#endif diff --git a/trunk/include/asm-x86/efi.h b/trunk/include/asm-x86/efi.h index ed2de22e8705..d4f2b0abe929 100644 --- a/trunk/include/asm-x86/efi.h +++ b/trunk/include/asm-x86/efi.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__EFI_H -#define ASM_X86__EFI_H +#ifndef _ASM_X86_EFI_H +#define _ASM_X86_EFI_H #ifdef CONFIG_X86_32 @@ -94,4 +94,4 @@ extern void efi_reserve_early(void); extern void efi_call_phys_prelog(void); extern void efi_call_phys_epilog(void); -#endif /* ASM_X86__EFI_H */ +#endif diff --git a/trunk/include/asm-x86/elf.h b/trunk/include/asm-x86/elf.h index 5c4745bec906..7be4733c793e 100644 --- a/trunk/include/asm-x86/elf.h +++ b/trunk/include/asm-x86/elf.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__ELF_H -#define ASM_X86__ELF_H +#ifndef _ASM_X86_ELF_H +#define _ASM_X86_ELF_H /* * ELF register definitions.. @@ -148,9 +148,8 @@ do { \ static inline void start_ia32_thread(struct pt_regs *regs, u32 ip, u32 sp) { - loadsegment(fs, 0); - loadsegment(ds, __USER32_DS); - loadsegment(es, __USER32_DS); + asm volatile("movl %0,%%fs" :: "r" (0)); + asm volatile("movl %0,%%es; movl %0,%%ds" : : "r" (__USER32_DS)); load_gs_index(0); regs->ip = ip; regs->sp = sp; @@ -333,4 +332,4 @@ extern int syscall32_setup_pages(struct linux_binprm *, int exstack); extern unsigned long arch_randomize_brk(struct mm_struct *mm); #define arch_randomize_brk arch_randomize_brk -#endif /* ASM_X86__ELF_H */ +#endif diff --git a/trunk/include/asm-x86/emergency-restart.h b/trunk/include/asm-x86/emergency-restart.h index 190d0d8b71e3..8e6aef19f8f0 100644 --- a/trunk/include/asm-x86/emergency-restart.h +++ b/trunk/include/asm-x86/emergency-restart.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__EMERGENCY_RESTART_H -#define ASM_X86__EMERGENCY_RESTART_H +#ifndef _ASM_EMERGENCY_RESTART_H +#define _ASM_EMERGENCY_RESTART_H enum reboot_type { BOOT_TRIPLE = 't', @@ -15,4 +15,4 @@ extern enum reboot_type reboot_type; extern void machine_emergency_restart(void); -#endif /* ASM_X86__EMERGENCY_RESTART_H */ +#endif /* _ASM_EMERGENCY_RESTART_H */ diff --git a/trunk/include/asm-x86/fb.h b/trunk/include/asm-x86/fb.h index aca38dbd9a64..53018464aea6 100644 --- a/trunk/include/asm-x86/fb.h +++ b/trunk/include/asm-x86/fb.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__FB_H -#define ASM_X86__FB_H +#ifndef _ASM_X86_FB_H +#define _ASM_X86_FB_H #include #include @@ -18,4 +18,4 @@ extern int fb_is_primary_device(struct fb_info *info); static inline int fb_is_primary_device(struct fb_info *info) { return 0; } #endif -#endif /* ASM_X86__FB_H */ +#endif /* _ASM_X86_FB_H */ diff --git a/trunk/include/asm-x86/fixmap.h b/trunk/include/asm-x86/fixmap.h index 78e33a1bc591..44d4f8217349 100644 --- a/trunk/include/asm-x86/fixmap.h +++ b/trunk/include/asm-x86/fixmap.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__FIXMAP_H -#define ASM_X86__FIXMAP_H +#ifndef _ASM_FIXMAP_H +#define _ASM_FIXMAP_H #ifdef CONFIG_X86_32 # include "fixmap_32.h" @@ -65,4 +65,4 @@ static inline unsigned long virt_to_fix(const unsigned long vaddr) BUG_ON(vaddr >= FIXADDR_TOP || vaddr < FIXADDR_START); return __virt_to_fix(vaddr); } -#endif /* ASM_X86__FIXMAP_H */ +#endif diff --git a/trunk/include/asm-x86/fixmap_32.h b/trunk/include/asm-x86/fixmap_32.h index 784e3e759866..f1ac2b2167d7 100644 --- a/trunk/include/asm-x86/fixmap_32.h +++ b/trunk/include/asm-x86/fixmap_32.h @@ -10,8 +10,8 @@ * Support of BIGMEM added by Gerhard Wichert, Siemens AG, July 1999 */ -#ifndef ASM_X86__FIXMAP_32_H -#define ASM_X86__FIXMAP_32_H +#ifndef _ASM_FIXMAP_32_H +#define _ASM_FIXMAP_32_H /* used by vmalloc.c, vsyscall.lds.S. @@ -120,4 +120,4 @@ extern void reserve_top_address(unsigned long reserve); #define FIXADDR_BOOT_START (FIXADDR_TOP - __FIXADDR_BOOT_SIZE) #endif /* !__ASSEMBLY__ */ -#endif /* ASM_X86__FIXMAP_32_H */ +#endif diff --git a/trunk/include/asm-x86/fixmap_64.h b/trunk/include/asm-x86/fixmap_64.h index dafb24bc0424..00f3d74a0524 100644 --- a/trunk/include/asm-x86/fixmap_64.h +++ b/trunk/include/asm-x86/fixmap_64.h @@ -8,8 +8,8 @@ * Copyright (C) 1998 Ingo Molnar */ -#ifndef ASM_X86__FIXMAP_64_H -#define ASM_X86__FIXMAP_64_H +#ifndef _ASM_FIXMAP_64_H +#define _ASM_FIXMAP_64_H #include #include @@ -80,4 +80,4 @@ enum fixed_addresses { #define FIXADDR_USER_START ((unsigned long)VSYSCALL32_VSYSCALL) #define FIXADDR_USER_END (FIXADDR_USER_START + PAGE_SIZE) -#endif /* ASM_X86__FIXMAP_64_H */ +#endif diff --git a/trunk/include/asm-x86/floppy.h b/trunk/include/asm-x86/floppy.h index 7d83a3a83e37..dbe82a5c5eac 100644 --- a/trunk/include/asm-x86/floppy.h +++ b/trunk/include/asm-x86/floppy.h @@ -7,8 +7,8 @@ * * Copyright (C) 1995 */ -#ifndef ASM_X86__FLOPPY_H -#define ASM_X86__FLOPPY_H +#ifndef _ASM_X86_FLOPPY_H +#define _ASM_X86_FLOPPY_H #include @@ -278,4 +278,4 @@ static int FDC2 = -1; #define EXTRA_FLOPPY_PARAMS -#endif /* ASM_X86__FLOPPY_H */ +#endif /* _ASM_X86_FLOPPY_H */ diff --git a/trunk/include/asm-x86/ftrace.h b/trunk/include/asm-x86/ftrace.h index be0e004ad148..5c68b32ee1c8 100644 --- a/trunk/include/asm-x86/ftrace.h +++ b/trunk/include/asm-x86/ftrace.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__FTRACE_H -#define ASM_X86__FTRACE_H +#ifndef _ASM_X86_FTRACE +#define _ASM_X86_FTRACE #ifdef CONFIG_FTRACE #define MCOUNT_ADDR ((long)(mcount)) @@ -11,4 +11,4 @@ extern void mcount(void); #endif /* CONFIG_FTRACE */ -#endif /* ASM_X86__FTRACE_H */ +#endif /* _ASM_X86_FTRACE */ diff --git a/trunk/include/asm-x86/futex.h b/trunk/include/asm-x86/futex.h index 06b924ef6fa5..e7a76b37b333 100644 --- a/trunk/include/asm-x86/futex.h +++ b/trunk/include/asm-x86/futex.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__FUTEX_H -#define ASM_X86__FUTEX_H +#ifndef _ASM_X86_FUTEX_H +#define _ASM_X86_FUTEX_H #ifdef __KERNEL__ @@ -25,7 +25,7 @@ asm volatile("1:\tmovl %2, %0\n" \ "\tmovl\t%0, %3\n" \ "\t" insn "\n" \ - "2:\t" LOCK_PREFIX "cmpxchgl %3, %2\n" \ + "2:\tlock; cmpxchgl %3, %2\n" \ "\tjnz\t1b\n" \ "3:\t.section .fixup,\"ax\"\n" \ "4:\tmov\t%5, %1\n" \ @@ -64,7 +64,7 @@ static inline int futex_atomic_op_inuser(int encoded_op, int __user *uaddr) __futex_atomic_op1("xchgl %0, %2", ret, oldval, uaddr, oparg); break; case FUTEX_OP_ADD: - __futex_atomic_op1(LOCK_PREFIX "xaddl %0, %2", ret, oldval, + __futex_atomic_op1("lock; xaddl %0, %2", ret, oldval, uaddr, oparg); break; case FUTEX_OP_OR: @@ -122,7 +122,7 @@ static inline int futex_atomic_cmpxchg_inatomic(int __user *uaddr, int oldval, if (!access_ok(VERIFY_WRITE, uaddr, sizeof(int))) return -EFAULT; - asm volatile("1:\t" LOCK_PREFIX "cmpxchgl %3, %1\n" + asm volatile("1:\tlock; cmpxchgl %3, %1\n" "2:\t.section .fixup, \"ax\"\n" "3:\tmov %2, %0\n" "\tjmp 2b\n" @@ -137,4 +137,4 @@ static inline int futex_atomic_cmpxchg_inatomic(int __user *uaddr, int oldval, } #endif -#endif /* ASM_X86__FUTEX_H */ +#endif diff --git a/trunk/include/asm-x86/gart.h b/trunk/include/asm-x86/gart.h index baa54faba892..3f62a83887f3 100644 --- a/trunk/include/asm-x86/gart.h +++ b/trunk/include/asm-x86/gart.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__GART_H -#define ASM_X86__GART_H +#ifndef _ASM_X8664_GART_H +#define _ASM_X8664_GART_H 1 #include @@ -52,15 +52,15 @@ static inline int aperture_valid(u64 aper_base, u32 aper_size, u32 min_size) return 0; if (aper_base + aper_size > 0x100000000ULL) { - printk(KERN_INFO "Aperture beyond 4GB. Ignoring.\n"); + printk(KERN_ERR "Aperture beyond 4GB. Ignoring.\n"); return 0; } if (e820_any_mapped(aper_base, aper_base + aper_size, E820_RAM)) { - printk(KERN_INFO "Aperture pointing to e820 RAM. Ignoring.\n"); + printk(KERN_ERR "Aperture pointing to e820 RAM. Ignoring.\n"); return 0; } if (aper_size < min_size) { - printk(KERN_INFO "Aperture too small (%d MB) than (%d MB)\n", + printk(KERN_ERR "Aperture too small (%d MB) than (%d MB)\n", aper_size>>20, min_size>>20); return 0; } @@ -68,4 +68,4 @@ static inline int aperture_valid(u64 aper_base, u32 aper_size, u32 min_size) return 1; } -#endif /* ASM_X86__GART_H */ +#endif diff --git a/trunk/include/asm-x86/genapic_32.h b/trunk/include/asm-x86/genapic_32.h index 34280f027664..754d635f90ff 100644 --- a/trunk/include/asm-x86/genapic_32.h +++ b/trunk/include/asm-x86/genapic_32.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__GENAPIC_32_H -#define ASM_X86__GENAPIC_32_H +#ifndef _ASM_GENAPIC_H +#define _ASM_GENAPIC_H 1 #include @@ -121,4 +121,4 @@ enum uv_system_type {UV_NONE, UV_LEGACY_APIC, UV_X2APIC, UV_NON_UNIQUE_APIC}; #define uv_system_init() do {} while (0) -#endif /* ASM_X86__GENAPIC_32_H */ +#endif diff --git a/trunk/include/asm-x86/genapic_64.h b/trunk/include/asm-x86/genapic_64.h index 25097a8cc5ef..a47d63129135 100644 --- a/trunk/include/asm-x86/genapic_64.h +++ b/trunk/include/asm-x86/genapic_64.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__GENAPIC_64_H -#define ASM_X86__GENAPIC_64_H +#ifndef _ASM_GENAPIC_H +#define _ASM_GENAPIC_H 1 /* * Copyright 2004 James Cleverdon, IBM. @@ -47,4 +47,4 @@ extern int uv_wakeup_secondary(int phys_apicid, unsigned int start_rip); extern void setup_apic_routing(void); -#endif /* ASM_X86__GENAPIC_64_H */ +#endif diff --git a/trunk/include/asm-x86/geode.h b/trunk/include/asm-x86/geode.h index 3f3444be2638..2c1cda0b8a86 100644 --- a/trunk/include/asm-x86/geode.h +++ b/trunk/include/asm-x86/geode.h @@ -7,8 +7,8 @@ * as published by the Free Software Foundation. */ -#ifndef ASM_X86__GEODE_H -#define ASM_X86__GEODE_H +#ifndef _ASM_GEODE_H_ +#define _ASM_GEODE_H_ #include #include @@ -250,4 +250,4 @@ extern int __init mfgpt_timer_setup(void); static inline int mfgpt_timer_setup(void) { return 0; } #endif -#endif /* ASM_X86__GEODE_H */ +#endif diff --git a/trunk/include/asm-x86/gpio.h b/trunk/include/asm-x86/gpio.h index 497fb980d962..c4c91b37c104 100644 --- a/trunk/include/asm-x86/gpio.h +++ b/trunk/include/asm-x86/gpio.h @@ -53,4 +53,4 @@ static inline int irq_to_gpio(unsigned int irq) #endif /* CONFIG_GPIOLIB */ -#endif /* ASM_X86__GPIO_H */ +#endif /* _ASM_I386_GPIO_H */ diff --git a/trunk/include/asm-x86/hardirq_32.h b/trunk/include/asm-x86/hardirq_32.h index 700fe230d919..4f85f0f4b563 100644 --- a/trunk/include/asm-x86/hardirq_32.h +++ b/trunk/include/asm-x86/hardirq_32.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__HARDIRQ_32_H -#define ASM_X86__HARDIRQ_32_H +#ifndef __ASM_HARDIRQ_H +#define __ASM_HARDIRQ_H #include #include @@ -25,4 +25,4 @@ DECLARE_PER_CPU(irq_cpustat_t, irq_stat); void ack_bad_irq(unsigned int irq); #include -#endif /* ASM_X86__HARDIRQ_32_H */ +#endif /* __ASM_HARDIRQ_H */ diff --git a/trunk/include/asm-x86/hardirq_64.h b/trunk/include/asm-x86/hardirq_64.h index f8bd2919a8ce..95d5e090ed89 100644 --- a/trunk/include/asm-x86/hardirq_64.h +++ b/trunk/include/asm-x86/hardirq_64.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__HARDIRQ_64_H -#define ASM_X86__HARDIRQ_64_H +#ifndef __ASM_HARDIRQ_H +#define __ASM_HARDIRQ_H #include #include @@ -20,4 +20,4 @@ extern void ack_bad_irq(unsigned int irq); -#endif /* ASM_X86__HARDIRQ_64_H */ +#endif /* __ASM_HARDIRQ_H */ diff --git a/trunk/include/asm-x86/highmem.h b/trunk/include/asm-x86/highmem.h index bc3f6a280316..4514b16cc723 100644 --- a/trunk/include/asm-x86/highmem.h +++ b/trunk/include/asm-x86/highmem.h @@ -15,8 +15,8 @@ * Copyright (C) 1999 Ingo Molnar */ -#ifndef ASM_X86__HIGHMEM_H -#define ASM_X86__HIGHMEM_H +#ifndef _ASM_HIGHMEM_H +#define _ASM_HIGHMEM_H #ifdef __KERNEL__ @@ -79,4 +79,4 @@ extern void add_highpages_with_active_regions(int nid, unsigned long start_pfn, #endif /* __KERNEL__ */ -#endif /* ASM_X86__HIGHMEM_H */ +#endif /* _ASM_HIGHMEM_H */ diff --git a/trunk/include/asm-x86/hpet.h b/trunk/include/asm-x86/hpet.h index cbbbb6d4dd32..82f1ac641bd7 100644 --- a/trunk/include/asm-x86/hpet.h +++ b/trunk/include/asm-x86/hpet.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__HPET_H -#define ASM_X86__HPET_H +#ifndef ASM_X86_HPET_H +#define ASM_X86_HPET_H #ifdef CONFIG_HPET_TIMER @@ -90,4 +90,4 @@ static inline int is_hpet_enabled(void) { return 0; } #define hpet_readl(a) 0 #endif -#endif /* ASM_X86__HPET_H */ +#endif /* ASM_X86_HPET_H */ diff --git a/trunk/include/asm-x86/hugetlb.h b/trunk/include/asm-x86/hugetlb.h index 0b7ec5dc0884..439a9acc132d 100644 --- a/trunk/include/asm-x86/hugetlb.h +++ b/trunk/include/asm-x86/hugetlb.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__HUGETLB_H -#define ASM_X86__HUGETLB_H +#ifndef _ASM_X86_HUGETLB_H +#define _ASM_X86_HUGETLB_H #include @@ -90,4 +90,4 @@ static inline void arch_release_hugepage(struct page *page) { } -#endif /* ASM_X86__HUGETLB_H */ +#endif /* _ASM_X86_HUGETLB_H */ diff --git a/trunk/include/asm-x86/hw_irq.h b/trunk/include/asm-x86/hw_irq.h index 65997b15d56a..edd0b95f14d0 100644 --- a/trunk/include/asm-x86/hw_irq.h +++ b/trunk/include/asm-x86/hw_irq.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__HW_IRQ_H -#define ASM_X86__HW_IRQ_H +#ifndef _ASM_HW_IRQ_H +#define _ASM_HW_IRQ_H /* * (C) 1992, 1993 Linus Torvalds, (C) 1997 Ingo Molnar @@ -93,26 +93,6 @@ extern asmlinkage void qic_reschedule_interrupt(void); extern asmlinkage void qic_enable_irq_interrupt(void); extern asmlinkage void qic_call_function_interrupt(void); -/* SMP */ -extern void smp_apic_timer_interrupt(struct pt_regs *); -#ifdef CONFIG_X86_32 -extern void smp_spurious_interrupt(struct pt_regs *); -extern void smp_error_interrupt(struct pt_regs *); -#else -extern asmlinkage void smp_spurious_interrupt(void); -extern asmlinkage void smp_error_interrupt(void); -#endif -#ifdef CONFIG_X86_SMP -extern void smp_reschedule_interrupt(struct pt_regs *); -extern void smp_call_function_interrupt(struct pt_regs *); -extern void smp_call_function_single_interrupt(struct pt_regs *); -#ifdef CONFIG_X86_32 -extern void smp_invalidate_interrupt(struct pt_regs *); -#else -extern asmlinkage void smp_invalidate_interrupt(struct pt_regs *); -#endif -#endif - #ifdef CONFIG_X86_32 extern void (*const interrupt[NR_IRQS])(void); #else @@ -132,4 +112,4 @@ static inline void __setup_vector_irq(int cpu) {} #endif /* !ASSEMBLY_ */ -#endif /* ASM_X86__HW_IRQ_H */ +#endif diff --git a/trunk/include/asm-x86/hypertransport.h b/trunk/include/asm-x86/hypertransport.h index cc011a3bc1c2..d2bbd238b3e1 100644 --- a/trunk/include/asm-x86/hypertransport.h +++ b/trunk/include/asm-x86/hypertransport.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__HYPERTRANSPORT_H -#define ASM_X86__HYPERTRANSPORT_H +#ifndef ASM_HYPERTRANSPORT_H +#define ASM_HYPERTRANSPORT_H /* * Constants for x86 Hypertransport Interrupts. @@ -42,4 +42,4 @@ #define HT_IRQ_HIGH_DEST_ID(v) \ ((((v) >> 8) << HT_IRQ_HIGH_DEST_ID_SHIFT) & HT_IRQ_HIGH_DEST_ID_MASK) -#endif /* ASM_X86__HYPERTRANSPORT_H */ +#endif /* ASM_HYPERTRANSPORT_H */ diff --git a/trunk/include/asm-x86/i387.h b/trunk/include/asm-x86/i387.h index 1ecdc3ed96e4..56d00e31aec0 100644 --- a/trunk/include/asm-x86/i387.h +++ b/trunk/include/asm-x86/i387.h @@ -7,8 +7,8 @@ * x86-64 work by Andi Kleen 2002 */ -#ifndef ASM_X86__I387_H -#define ASM_X86__I387_H +#ifndef _ASM_X86_I387_H +#define _ASM_X86_I387_H #include #include @@ -25,7 +25,6 @@ extern void mxcsr_feature_mask_init(void); extern int init_fpu(struct task_struct *child); extern asmlinkage void math_state_restore(void); extern void init_thread_xstate(void); -extern int dump_fpu(struct pt_regs *, struct user_i387_struct *); extern user_regset_active_fn fpregs_active, xfpregs_active; extern user_regset_get_fn fpregs_get, xfpregs_get, fpregs_soft_get; @@ -337,4 +336,4 @@ static inline unsigned short get_fpu_mxcsr(struct task_struct *tsk) } } -#endif /* ASM_X86__I387_H */ +#endif /* _ASM_X86_I387_H */ diff --git a/trunk/include/asm-x86/i8253.h b/trunk/include/asm-x86/i8253.h index 15a5b530044e..b51c0487fc41 100644 --- a/trunk/include/asm-x86/i8253.h +++ b/trunk/include/asm-x86/i8253.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__I8253_H -#define ASM_X86__I8253_H +#ifndef __ASM_I8253_H__ +#define __ASM_I8253_H__ /* i8253A PIT registers */ #define PIT_MODE 0x43 @@ -15,4 +15,4 @@ extern void setup_pit_timer(void); #define inb_pit inb_p #define outb_pit outb_p -#endif /* ASM_X86__I8253_H */ +#endif /* __ASM_I8253_H__ */ diff --git a/trunk/include/asm-x86/i8259.h b/trunk/include/asm-x86/i8259.h index c586559a6957..2f98df91f1f2 100644 --- a/trunk/include/asm-x86/i8259.h +++ b/trunk/include/asm-x86/i8259.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__I8259_H -#define ASM_X86__I8259_H +#ifndef __ASM_I8259_H__ +#define __ASM_I8259_H__ #include @@ -57,4 +57,4 @@ static inline void outb_pic(unsigned char value, unsigned int port) extern struct irq_chip i8259A_chip; -#endif /* ASM_X86__I8259_H */ +#endif /* __ASM_I8259_H__ */ diff --git a/trunk/include/asm-x86/ia32.h b/trunk/include/asm-x86/ia32.h index f932f7ad51dd..55d3abe5276f 100644 --- a/trunk/include/asm-x86/ia32.h +++ b/trunk/include/asm-x86/ia32.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__IA32_H -#define ASM_X86__IA32_H +#ifndef _ASM_X86_64_IA32_H +#define _ASM_X86_64_IA32_H #ifdef CONFIG_IA32_EMULATION @@ -167,4 +167,4 @@ extern void ia32_pick_mmap_layout(struct mm_struct *mm); #endif /* !CONFIG_IA32_SUPPORT */ -#endif /* ASM_X86__IA32_H */ +#endif diff --git a/trunk/include/asm-x86/ia32_unistd.h b/trunk/include/asm-x86/ia32_unistd.h index dbd887d8a5a5..61cea9e7c5c1 100644 --- a/trunk/include/asm-x86/ia32_unistd.h +++ b/trunk/include/asm-x86/ia32_unistd.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__IA32_UNISTD_H -#define ASM_X86__IA32_UNISTD_H +#ifndef _ASM_X86_64_IA32_UNISTD_H_ +#define _ASM_X86_64_IA32_UNISTD_H_ /* * This file contains the system call numbers of the ia32 port, @@ -15,4 +15,4 @@ #define __NR_ia32_sigreturn 119 #define __NR_ia32_rt_sigreturn 173 -#endif /* ASM_X86__IA32_UNISTD_H */ +#endif /* _ASM_X86_64_IA32_UNISTD_H_ */ diff --git a/trunk/include/asm-x86/idle.h b/trunk/include/asm-x86/idle.h index baa3f783d27d..cbb649123612 100644 --- a/trunk/include/asm-x86/idle.h +++ b/trunk/include/asm-x86/idle.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__IDLE_H -#define ASM_X86__IDLE_H +#ifndef _ASM_X86_64_IDLE_H +#define _ASM_X86_64_IDLE_H 1 #define IDLE_START 1 #define IDLE_END 2 @@ -12,4 +12,4 @@ void exit_idle(void); void c1e_remove_cpu(int cpu); -#endif /* ASM_X86__IDLE_H */ +#endif diff --git a/trunk/include/asm-x86/intel_arch_perfmon.h b/trunk/include/asm-x86/intel_arch_perfmon.h index 07c03c6c9a16..fa0fd068bc2e 100644 --- a/trunk/include/asm-x86/intel_arch_perfmon.h +++ b/trunk/include/asm-x86/intel_arch_perfmon.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__INTEL_ARCH_PERFMON_H -#define ASM_X86__INTEL_ARCH_PERFMON_H +#ifndef _ASM_X86_INTEL_ARCH_PERFMON_H +#define _ASM_X86_INTEL_ARCH_PERFMON_H #define MSR_ARCH_PERFMON_PERFCTR0 0xc1 #define MSR_ARCH_PERFMON_PERFCTR1 0xc2 @@ -28,4 +28,4 @@ union cpuid10_eax { unsigned int full; }; -#endif /* ASM_X86__INTEL_ARCH_PERFMON_H */ +#endif /* _ASM_X86_INTEL_ARCH_PERFMON_H */ diff --git a/trunk/include/asm-x86/io.h b/trunk/include/asm-x86/io.h index 72b7719523bf..0f954dc89cb3 100644 --- a/trunk/include/asm-x86/io.h +++ b/trunk/include/asm-x86/io.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__IO_H -#define ASM_X86__IO_H +#ifndef _ASM_X86_IO_H +#define _ASM_X86_IO_H #define ARCH_HAS_IOREMAP_WC @@ -73,8 +73,6 @@ build_mmio_write(__writeq, "q", unsigned long, "r", ) #define writeq writeq #endif -extern int iommu_bio_merge; - #ifdef CONFIG_X86_32 # include "io_32.h" #else @@ -101,4 +99,4 @@ extern void early_iounmap(void *addr, unsigned long size); extern void __iomem *fix_ioremap(unsigned idx, unsigned long phys); -#endif /* ASM_X86__IO_H */ +#endif /* _ASM_X86_IO_H */ diff --git a/trunk/include/asm-x86/io_32.h b/trunk/include/asm-x86/io_32.h index 4f7d878bda18..e876d89ac156 100644 --- a/trunk/include/asm-x86/io_32.h +++ b/trunk/include/asm-x86/io_32.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__IO_32_H -#define ASM_X86__IO_32_H +#ifndef _ASM_IO_H +#define _ASM_IO_H #include #include @@ -281,4 +281,4 @@ BUILDIO(b, b, char) BUILDIO(w, w, short) BUILDIO(l, , int) -#endif /* ASM_X86__IO_32_H */ +#endif diff --git a/trunk/include/asm-x86/io_64.h b/trunk/include/asm-x86/io_64.h index 64429e9431a8..22995c5c5adc 100644 --- a/trunk/include/asm-x86/io_64.h +++ b/trunk/include/asm-x86/io_64.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__IO_64_H -#define ASM_X86__IO_64_H +#ifndef _ASM_IO_H +#define _ASM_IO_H /* @@ -235,6 +235,7 @@ void memset_io(volatile void __iomem *a, int b, size_t c); #define flush_write_buffers() +extern int iommu_bio_merge; #define BIO_VMERGE_BOUNDARY iommu_bio_merge /* @@ -244,4 +245,4 @@ void memset_io(volatile void __iomem *a, int b, size_t c); #endif /* __KERNEL__ */ -#endif /* ASM_X86__IO_64_H */ +#endif diff --git a/trunk/include/asm-x86/io_apic.h b/trunk/include/asm-x86/io_apic.h index be62847ab07e..14f82bbcb5fd 100644 --- a/trunk/include/asm-x86/io_apic.h +++ b/trunk/include/asm-x86/io_apic.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__IO_APIC_H -#define ASM_X86__IO_APIC_H +#ifndef __ASM_IO_APIC_H +#define __ASM_IO_APIC_H #include #include @@ -189,4 +189,4 @@ static const int timer_through_8259 = 0; static inline void ioapic_init_mappings(void) { } #endif -#endif /* ASM_X86__IO_APIC_H */ +#endif diff --git a/trunk/include/asm-x86/ioctls.h b/trunk/include/asm-x86/ioctls.h index 336603512399..c0c338bd4068 100644 --- a/trunk/include/asm-x86/ioctls.h +++ b/trunk/include/asm-x86/ioctls.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__IOCTLS_H -#define ASM_X86__IOCTLS_H +#ifndef _ASM_X86_IOCTLS_H +#define _ASM_X86_IOCTLS_H #include @@ -85,4 +85,4 @@ #define TIOCSER_TEMT 0x01 /* Transmitter physically empty */ -#endif /* ASM_X86__IOCTLS_H */ +#endif diff --git a/trunk/include/asm-x86/iommu.h b/trunk/include/asm-x86/iommu.h index e86f44148c66..5f888cc5be49 100644 --- a/trunk/include/asm-x86/iommu.h +++ b/trunk/include/asm-x86/iommu.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__IOMMU_H -#define ASM_X86__IOMMU_H +#ifndef _ASM_X8664_IOMMU_H +#define _ASM_X8664_IOMMU_H 1 extern void pci_iommu_shutdown(void); extern void no_iommu_init(void); @@ -42,4 +42,4 @@ static inline void gart_iommu_hole_init(void) } #endif -#endif /* ASM_X86__IOMMU_H */ +#endif diff --git a/trunk/include/asm-x86/ipcbuf.h b/trunk/include/asm-x86/ipcbuf.h index 910304fbdc8f..ee678fd51594 100644 --- a/trunk/include/asm-x86/ipcbuf.h +++ b/trunk/include/asm-x86/ipcbuf.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__IPCBUF_H -#define ASM_X86__IPCBUF_H +#ifndef _ASM_X86_IPCBUF_H +#define _ASM_X86_IPCBUF_H /* * The ipc64_perm structure for x86 architecture. @@ -25,4 +25,4 @@ struct ipc64_perm { unsigned long __unused2; }; -#endif /* ASM_X86__IPCBUF_H */ +#endif /* _ASM_X86_IPCBUF_H */ diff --git a/trunk/include/asm-x86/ipi.h b/trunk/include/asm-x86/ipi.h index c1b226797518..bb1c09f7a76c 100644 --- a/trunk/include/asm-x86/ipi.h +++ b/trunk/include/asm-x86/ipi.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__IPI_H -#define ASM_X86__IPI_H +#ifndef __ASM_IPI_H +#define __ASM_IPI_H /* * Copyright 2004 James Cleverdon, IBM. @@ -129,4 +129,4 @@ static inline void send_IPI_mask_sequence(cpumask_t mask, int vector) local_irq_restore(flags); } -#endif /* ASM_X86__IPI_H */ +#endif /* __ASM_IPI_H */ diff --git a/trunk/include/asm-x86/irq.h b/trunk/include/asm-x86/irq.h index 1e5f2909c1db..1a2925757317 100644 --- a/trunk/include/asm-x86/irq.h +++ b/trunk/include/asm-x86/irq.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__IRQ_H -#define ASM_X86__IRQ_H +#ifndef _ASM_IRQ_H +#define _ASM_IRQ_H /* * (C) 1992, 1993 Linus Torvalds, (C) 1997 Ingo Molnar * @@ -47,4 +47,4 @@ extern void native_init_IRQ(void); /* Interrupt vector management */ extern DECLARE_BITMAP(used_vectors, NR_VECTORS); -#endif /* ASM_X86__IRQ_H */ +#endif /* _ASM_IRQ_H */ diff --git a/trunk/include/asm-x86/irq_regs_32.h b/trunk/include/asm-x86/irq_regs_32.h index 316a3b258871..3368b20c0b48 100644 --- a/trunk/include/asm-x86/irq_regs_32.h +++ b/trunk/include/asm-x86/irq_regs_32.h @@ -4,8 +4,8 @@ * * Jeremy Fitzhardinge */ -#ifndef ASM_X86__IRQ_REGS_32_H -#define ASM_X86__IRQ_REGS_32_H +#ifndef _ASM_I386_IRQ_REGS_H +#define _ASM_I386_IRQ_REGS_H #include @@ -26,4 +26,4 @@ static inline struct pt_regs *set_irq_regs(struct pt_regs *new_regs) return old_regs; } -#endif /* ASM_X86__IRQ_REGS_32_H */ +#endif /* _ASM_I386_IRQ_REGS_H */ diff --git a/trunk/include/asm-x86/irq_vectors.h b/trunk/include/asm-x86/irq_vectors.h index c5d2d767a1f3..a48c7f2dbdc0 100644 --- a/trunk/include/asm-x86/irq_vectors.h +++ b/trunk/include/asm-x86/irq_vectors.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__IRQ_VECTORS_H -#define ASM_X86__IRQ_VECTORS_H +#ifndef _ASM_IRQ_VECTORS_H +#define _ASM_IRQ_VECTORS_H #include @@ -179,4 +179,4 @@ #define VIC_CPU_BOOT_ERRATA_CPI (VIC_CPI_LEVEL0 + 8) -#endif /* ASM_X86__IRQ_VECTORS_H */ +#endif /* _ASM_IRQ_VECTORS_H */ diff --git a/trunk/include/asm-x86/ist.h b/trunk/include/asm-x86/ist.h index 35a2fe9bc921..6ec6ceed95a7 100644 --- a/trunk/include/asm-x86/ist.h +++ b/trunk/include/asm-x86/ist.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__IST_H -#define ASM_X86__IST_H +#ifndef _ASM_IST_H +#define _ASM_IST_H /* * Include file for the interface to IST BIOS @@ -31,4 +31,4 @@ struct ist_info { extern struct ist_info ist_info; #endif /* __KERNEL__ */ -#endif /* ASM_X86__IST_H */ +#endif /* _ASM_IST_H */ diff --git a/trunk/include/asm-x86/k8.h b/trunk/include/asm-x86/k8.h index 2bbaf4370a55..452e2b696ff4 100644 --- a/trunk/include/asm-x86/k8.h +++ b/trunk/include/asm-x86/k8.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__K8_H -#define ASM_X86__K8_H +#ifndef _ASM_K8_H +#define _ASM_K8_H 1 #include @@ -12,4 +12,4 @@ extern int cache_k8_northbridges(void); extern void k8_flush_garts(void); extern int k8_scan_nodes(unsigned long start, unsigned long end); -#endif /* ASM_X86__K8_H */ +#endif diff --git a/trunk/include/asm-x86/kdebug.h b/trunk/include/asm-x86/kdebug.h index 5ec3ad3e825c..96651bb59ba1 100644 --- a/trunk/include/asm-x86/kdebug.h +++ b/trunk/include/asm-x86/kdebug.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__KDEBUG_H -#define ASM_X86__KDEBUG_H +#ifndef _ASM_X86_KDEBUG_H +#define _ASM_X86_KDEBUG_H #include @@ -35,4 +35,4 @@ extern void show_regs(struct pt_regs *regs); extern unsigned long oops_begin(void); extern void oops_end(unsigned long, struct pt_regs *, int signr); -#endif /* ASM_X86__KDEBUG_H */ +#endif diff --git a/trunk/include/asm-x86/kexec.h b/trunk/include/asm-x86/kexec.h index ea09600d6129..4246ab7dc988 100644 --- a/trunk/include/asm-x86/kexec.h +++ b/trunk/include/asm-x86/kexec.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__KEXEC_H -#define ASM_X86__KEXEC_H +#ifndef _KEXEC_H +#define _KEXEC_H #ifdef CONFIG_X86_32 # define PA_CONTROL_PAGE 0 @@ -172,4 +172,4 @@ relocate_kernel(unsigned long indirection_page, #endif /* __ASSEMBLY__ */ -#endif /* ASM_X86__KEXEC_H */ +#endif /* _KEXEC_H */ diff --git a/trunk/include/asm-x86/kgdb.h b/trunk/include/asm-x86/kgdb.h index d283863354de..94d63db10365 100644 --- a/trunk/include/asm-x86/kgdb.h +++ b/trunk/include/asm-x86/kgdb.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__KGDB_H -#define ASM_X86__KGDB_H +#ifndef _ASM_KGDB_H_ +#define _ASM_KGDB_H_ /* * Copyright (C) 2001-2004 Amit S. Kale @@ -76,4 +76,4 @@ static inline void arch_kgdb_breakpoint(void) #define BREAK_INSTR_SIZE 1 #define CACHE_FLUSH_IS_SAFE 1 -#endif /* ASM_X86__KGDB_H */ +#endif /* _ASM_KGDB_H_ */ diff --git a/trunk/include/asm-x86/kmap_types.h b/trunk/include/asm-x86/kmap_types.h index 89f44493e643..5f4174132a22 100644 --- a/trunk/include/asm-x86/kmap_types.h +++ b/trunk/include/asm-x86/kmap_types.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__KMAP_TYPES_H -#define ASM_X86__KMAP_TYPES_H +#ifndef _ASM_X86_KMAP_TYPES_H +#define _ASM_X86_KMAP_TYPES_H #if defined(CONFIG_X86_32) && defined(CONFIG_DEBUG_HIGHMEM) # define D(n) __KM_FENCE_##n , @@ -26,4 +26,4 @@ D(13) KM_TYPE_NR #undef D -#endif /* ASM_X86__KMAP_TYPES_H */ +#endif diff --git a/trunk/include/asm-x86/kprobes.h b/trunk/include/asm-x86/kprobes.h index bd8407863c13..54980b0b3892 100644 --- a/trunk/include/asm-x86/kprobes.h +++ b/trunk/include/asm-x86/kprobes.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__KPROBES_H -#define ASM_X86__KPROBES_H +#ifndef _ASM_KPROBES_H +#define _ASM_KPROBES_H /* * Kernel Probes (KProbes) * @@ -94,4 +94,4 @@ static inline void restore_interrupts(struct pt_regs *regs) extern int kprobe_fault_handler(struct pt_regs *regs, int trapnr); extern int kprobe_exceptions_notify(struct notifier_block *self, unsigned long val, void *data); -#endif /* ASM_X86__KPROBES_H */ +#endif /* _ASM_KPROBES_H */ diff --git a/trunk/include/asm-x86/kvm.h b/trunk/include/asm-x86/kvm.h index 78e954db1e7f..6f1840812e59 100644 --- a/trunk/include/asm-x86/kvm.h +++ b/trunk/include/asm-x86/kvm.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__KVM_H -#define ASM_X86__KVM_H +#ifndef __LINUX_KVM_X86_H +#define __LINUX_KVM_X86_H /* * KVM x86 specific structures and definitions @@ -230,4 +230,4 @@ struct kvm_pit_state { #define KVM_TRC_APIC_ACCESS (KVM_TRC_HANDLER + 0x14) #define KVM_TRC_TDP_FAULT (KVM_TRC_HANDLER + 0x15) -#endif /* ASM_X86__KVM_H */ +#endif diff --git a/trunk/include/asm-x86/kvm_host.h b/trunk/include/asm-x86/kvm_host.h index 69794547f514..c2e34c275900 100644 --- a/trunk/include/asm-x86/kvm_host.h +++ b/trunk/include/asm-x86/kvm_host.h @@ -1,4 +1,4 @@ -/* +#/* * Kernel-based Virtual Machine driver for Linux * * This header defines architecture specific interfaces, x86 version @@ -8,8 +8,8 @@ * */ -#ifndef ASM_X86__KVM_HOST_H -#define ASM_X86__KVM_HOST_H +#ifndef ASM_KVM_HOST_H +#define ASM_KVM_HOST_H #include #include @@ -735,4 +735,4 @@ asmlinkage void kvm_handle_fault_on_reboot(void); int kvm_unmap_hva(struct kvm *kvm, unsigned long hva); int kvm_age_hva(struct kvm *kvm, unsigned long hva); -#endif /* ASM_X86__KVM_HOST_H */ +#endif diff --git a/trunk/include/asm-x86/kvm_para.h b/trunk/include/asm-x86/kvm_para.h index 30054fded4fb..76f392146daa 100644 --- a/trunk/include/asm-x86/kvm_para.h +++ b/trunk/include/asm-x86/kvm_para.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__KVM_PARA_H -#define ASM_X86__KVM_PARA_H +#ifndef __X86_KVM_PARA_H +#define __X86_KVM_PARA_H /* This CPUID returns the signature 'KVMKVMKVM' in ebx, ecx, and edx. It * should be used to determine that a VM is running under KVM. @@ -144,4 +144,4 @@ static inline unsigned int kvm_arch_para_features(void) #endif -#endif /* ASM_X86__KVM_PARA_H */ +#endif diff --git a/trunk/include/asm-x86/kvm_x86_emulate.h b/trunk/include/asm-x86/kvm_x86_emulate.h index e2d9b030c1ac..4e8c1e48d91d 100644 --- a/trunk/include/asm-x86/kvm_x86_emulate.h +++ b/trunk/include/asm-x86/kvm_x86_emulate.h @@ -8,8 +8,8 @@ * From: xen-unstable 10676:af9809f51f81a3c43f276f00c81a52ef558afda4 */ -#ifndef ASM_X86__KVM_X86_EMULATE_H -#define ASM_X86__KVM_X86_EMULATE_H +#ifndef __X86_EMULATE_H__ +#define __X86_EMULATE_H__ struct x86_emulate_ctxt; @@ -181,4 +181,4 @@ int x86_decode_insn(struct x86_emulate_ctxt *ctxt, int x86_emulate_insn(struct x86_emulate_ctxt *ctxt, struct x86_emulate_ops *ops); -#endif /* ASM_X86__KVM_X86_EMULATE_H */ +#endif /* __X86_EMULATE_H__ */ diff --git a/trunk/include/asm-x86/ldt.h b/trunk/include/asm-x86/ldt.h index a5228504d867..20c597242b53 100644 --- a/trunk/include/asm-x86/ldt.h +++ b/trunk/include/asm-x86/ldt.h @@ -3,8 +3,8 @@ * * Definitions of structures used with the modify_ldt system call. */ -#ifndef ASM_X86__LDT_H -#define ASM_X86__LDT_H +#ifndef _ASM_X86_LDT_H +#define _ASM_X86_LDT_H /* Maximum number of LDT entries supported. */ #define LDT_ENTRIES 8192 @@ -37,4 +37,4 @@ struct user_desc { #define MODIFY_LDT_CONTENTS_CODE 2 #endif /* !__ASSEMBLY__ */ -#endif /* ASM_X86__LDT_H */ +#endif diff --git a/trunk/include/asm-x86/lguest.h b/trunk/include/asm-x86/lguest.h index 7505e947ed27..be4a7247fa2b 100644 --- a/trunk/include/asm-x86/lguest.h +++ b/trunk/include/asm-x86/lguest.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__LGUEST_H -#define ASM_X86__LGUEST_H +#ifndef _X86_LGUEST_H +#define _X86_LGUEST_H #define GDT_ENTRY_LGUEST_CS 10 #define GDT_ENTRY_LGUEST_DS 11 @@ -91,4 +91,4 @@ static inline void lguest_set_ts(void) #endif /* __ASSEMBLY__ */ -#endif /* ASM_X86__LGUEST_H */ +#endif diff --git a/trunk/include/asm-x86/lguest_hcall.h b/trunk/include/asm-x86/lguest_hcall.h index 8f034ba4b53e..a3241f28e34a 100644 --- a/trunk/include/asm-x86/lguest_hcall.h +++ b/trunk/include/asm-x86/lguest_hcall.h @@ -1,6 +1,6 @@ /* Architecture specific portion of the lguest hypercalls */ -#ifndef ASM_X86__LGUEST_HCALL_H -#define ASM_X86__LGUEST_HCALL_H +#ifndef _X86_LGUEST_HCALL_H +#define _X86_LGUEST_HCALL_H #define LHCALL_FLUSH_ASYNC 0 #define LHCALL_LGUEST_INIT 1 @@ -68,4 +68,4 @@ struct hcall_args { }; #endif /* !__ASSEMBLY__ */ -#endif /* ASM_X86__LGUEST_HCALL_H */ +#endif /* _I386_LGUEST_HCALL_H */ diff --git a/trunk/include/asm-x86/linkage.h b/trunk/include/asm-x86/linkage.h index 42d8b62ee8ab..64e444f8e85b 100644 --- a/trunk/include/asm-x86/linkage.h +++ b/trunk/include/asm-x86/linkage.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__LINKAGE_H -#define ASM_X86__LINKAGE_H +#ifndef __ASM_LINKAGE_H +#define __ASM_LINKAGE_H #undef notrace #define notrace __attribute__((no_instrument_function)) @@ -57,5 +57,5 @@ #define __ALIGN_STR ".align 16,0x90" #endif -#endif /* ASM_X86__LINKAGE_H */ +#endif diff --git a/trunk/include/asm-x86/local.h b/trunk/include/asm-x86/local.h index ae91994fd6c9..330a72496abd 100644 --- a/trunk/include/asm-x86/local.h +++ b/trunk/include/asm-x86/local.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__LOCAL_H -#define ASM_X86__LOCAL_H +#ifndef _ARCH_LOCAL_H +#define _ARCH_LOCAL_H #include @@ -232,4 +232,4 @@ static inline long local_sub_return(long i, local_t *l) #define __cpu_local_add(i, l) cpu_local_add((i), (l)) #define __cpu_local_sub(i, l) cpu_local_sub((i), (l)) -#endif /* ASM_X86__LOCAL_H */ +#endif /* _ARCH_LOCAL_H */ diff --git a/trunk/include/asm-x86/mach-bigsmp/mach_apic.h b/trunk/include/asm-x86/mach-bigsmp/mach_apic.h index 05362d44a3ee..c3b9dc6970c9 100644 --- a/trunk/include/asm-x86/mach-bigsmp/mach_apic.h +++ b/trunk/include/asm-x86/mach-bigsmp/mach_apic.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__MACH_BIGSMP__MACH_APIC_H -#define ASM_X86__MACH_BIGSMP__MACH_APIC_H +#ifndef __ASM_MACH_APIC_H +#define __ASM_MACH_APIC_H #define xapic_phys_to_log_apicid(cpu) (per_cpu(x86_bios_cpu_apicid, cpu)) #define esr_disable (1) @@ -141,4 +141,4 @@ static inline u32 phys_pkg_id(u32 cpuid_apic, int index_msb) return cpuid_apic >> index_msb; } -#endif /* ASM_X86__MACH_BIGSMP__MACH_APIC_H */ +#endif /* __ASM_MACH_APIC_H */ diff --git a/trunk/include/asm-x86/mach-bigsmp/mach_apicdef.h b/trunk/include/asm-x86/mach-bigsmp/mach_apicdef.h index 811935d9d49b..a58ab5a75c8c 100644 --- a/trunk/include/asm-x86/mach-bigsmp/mach_apicdef.h +++ b/trunk/include/asm-x86/mach-bigsmp/mach_apicdef.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__MACH_BIGSMP__MACH_APICDEF_H -#define ASM_X86__MACH_BIGSMP__MACH_APICDEF_H +#ifndef __ASM_MACH_APICDEF_H +#define __ASM_MACH_APICDEF_H #define APIC_ID_MASK (0xFF<<24) @@ -10,4 +10,4 @@ static inline unsigned get_apic_id(unsigned long x) #define GET_APIC_ID(x) get_apic_id(x) -#endif /* ASM_X86__MACH_BIGSMP__MACH_APICDEF_H */ +#endif diff --git a/trunk/include/asm-x86/mach-bigsmp/mach_ipi.h b/trunk/include/asm-x86/mach-bigsmp/mach_ipi.h index b1b0f966a009..9404c535b7ec 100644 --- a/trunk/include/asm-x86/mach-bigsmp/mach_ipi.h +++ b/trunk/include/asm-x86/mach-bigsmp/mach_ipi.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__MACH_BIGSMP__MACH_IPI_H -#define ASM_X86__MACH_BIGSMP__MACH_IPI_H +#ifndef __ASM_MACH_IPI_H +#define __ASM_MACH_IPI_H void send_IPI_mask_sequence(cpumask_t mask, int vector); @@ -22,4 +22,4 @@ static inline void send_IPI_all(int vector) send_IPI_mask(cpu_online_map, vector); } -#endif /* ASM_X86__MACH_BIGSMP__MACH_IPI_H */ +#endif /* __ASM_MACH_IPI_H */ diff --git a/trunk/include/asm-x86/mach-default/apm.h b/trunk/include/asm-x86/mach-default/apm.h index 2aa61b54fbd5..989f34c37d32 100644 --- a/trunk/include/asm-x86/mach-default/apm.h +++ b/trunk/include/asm-x86/mach-default/apm.h @@ -3,8 +3,8 @@ * Split out from apm.c by Osamu Tomita */ -#ifndef ASM_X86__MACH_DEFAULT__APM_H -#define ASM_X86__MACH_DEFAULT__APM_H +#ifndef _ASM_APM_H +#define _ASM_APM_H #ifdef APM_ZERO_SEGS # define APM_DO_ZERO_SEGS \ @@ -70,4 +70,4 @@ static inline u8 apm_bios_call_simple_asm(u32 func, u32 ebx_in, return error; } -#endif /* ASM_X86__MACH_DEFAULT__APM_H */ +#endif /* _ASM_APM_H */ diff --git a/trunk/include/asm-x86/mach-default/mach_apic.h b/trunk/include/asm-x86/mach-default/mach_apic.h index b615f40736be..f3226b9a6b82 100644 --- a/trunk/include/asm-x86/mach-default/mach_apic.h +++ b/trunk/include/asm-x86/mach-default/mach_apic.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__MACH_DEFAULT__MACH_APIC_H -#define ASM_X86__MACH_DEFAULT__MACH_APIC_H +#ifndef __ASM_MACH_APIC_H +#define __ASM_MACH_APIC_H #ifdef CONFIG_X86_LOCAL_APIC @@ -138,4 +138,4 @@ static inline void enable_apic_mode(void) } #endif /* CONFIG_X86_LOCAL_APIC */ -#endif /* ASM_X86__MACH_DEFAULT__MACH_APIC_H */ +#endif /* __ASM_MACH_APIC_H */ diff --git a/trunk/include/asm-x86/mach-default/mach_apicdef.h b/trunk/include/asm-x86/mach-default/mach_apicdef.h index 936704f816d6..e4b29ba37de6 100644 --- a/trunk/include/asm-x86/mach-default/mach_apicdef.h +++ b/trunk/include/asm-x86/mach-default/mach_apicdef.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__MACH_DEFAULT__MACH_APICDEF_H -#define ASM_X86__MACH_DEFAULT__MACH_APICDEF_H +#ifndef __ASM_MACH_APICDEF_H +#define __ASM_MACH_APICDEF_H #include @@ -21,4 +21,4 @@ static inline unsigned get_apic_id(unsigned long x) #define GET_APIC_ID(x) get_apic_id(x) #endif -#endif /* ASM_X86__MACH_DEFAULT__MACH_APICDEF_H */ +#endif diff --git a/trunk/include/asm-x86/mach-default/mach_ipi.h b/trunk/include/asm-x86/mach-default/mach_ipi.h index 674bc7e50c35..be323364e68f 100644 --- a/trunk/include/asm-x86/mach-default/mach_ipi.h +++ b/trunk/include/asm-x86/mach-default/mach_ipi.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__MACH_DEFAULT__MACH_IPI_H -#define ASM_X86__MACH_DEFAULT__MACH_IPI_H +#ifndef __ASM_MACH_IPI_H +#define __ASM_MACH_IPI_H /* Avoid include hell */ #define NMI_VECTOR 0x02 @@ -61,4 +61,4 @@ static inline void send_IPI_all(int vector) } #endif -#endif /* ASM_X86__MACH_DEFAULT__MACH_IPI_H */ +#endif /* __ASM_MACH_IPI_H */ diff --git a/trunk/include/asm-x86/mach-default/mach_mpparse.h b/trunk/include/asm-x86/mach-default/mach_mpparse.h index 9c381f2815ac..d14108505bb8 100644 --- a/trunk/include/asm-x86/mach-default/mach_mpparse.h +++ b/trunk/include/asm-x86/mach-default/mach_mpparse.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__MACH_DEFAULT__MACH_MPPARSE_H -#define ASM_X86__MACH_DEFAULT__MACH_MPPARSE_H +#ifndef __ASM_MACH_MPPARSE_H +#define __ASM_MACH_MPPARSE_H static inline int mps_oem_check(struct mp_config_table *mpc, char *oem, char *productid) @@ -14,4 +14,4 @@ static inline int acpi_madt_oem_check(char *oem_id, char *oem_table_id) } -#endif /* ASM_X86__MACH_DEFAULT__MACH_MPPARSE_H */ +#endif /* __ASM_MACH_MPPARSE_H */ diff --git a/trunk/include/asm-x86/mach-default/mach_mpspec.h b/trunk/include/asm-x86/mach-default/mach_mpspec.h index d77646f011f1..51c9a9775932 100644 --- a/trunk/include/asm-x86/mach-default/mach_mpspec.h +++ b/trunk/include/asm-x86/mach-default/mach_mpspec.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__MACH_DEFAULT__MACH_MPSPEC_H -#define ASM_X86__MACH_DEFAULT__MACH_MPSPEC_H +#ifndef __ASM_MACH_MPSPEC_H +#define __ASM_MACH_MPSPEC_H #define MAX_IRQ_SOURCES 256 @@ -9,4 +9,4 @@ #define MAX_MP_BUSSES 32 #endif -#endif /* ASM_X86__MACH_DEFAULT__MACH_MPSPEC_H */ +#endif /* __ASM_MACH_MPSPEC_H */ diff --git a/trunk/include/asm-x86/mach-default/mach_timer.h b/trunk/include/asm-x86/mach-default/mach_timer.h index 990b15833834..4b76e536cd98 100644 --- a/trunk/include/asm-x86/mach-default/mach_timer.h +++ b/trunk/include/asm-x86/mach-default/mach_timer.h @@ -10,8 +10,8 @@ * directly because of the awkward 8-bit access mechanism of the 82C54 * device. */ -#ifndef ASM_X86__MACH_DEFAULT__MACH_TIMER_H -#define ASM_X86__MACH_DEFAULT__MACH_TIMER_H +#ifndef _MACH_TIMER_H +#define _MACH_TIMER_H #define CALIBRATE_TIME_MSEC 30 /* 30 msecs */ #define CALIBRATE_LATCH \ @@ -45,4 +45,4 @@ static inline void mach_countup(unsigned long *count_p) *count_p = count; } -#endif /* ASM_X86__MACH_DEFAULT__MACH_TIMER_H */ +#endif /* !_MACH_TIMER_H */ diff --git a/trunk/include/asm-x86/mach-default/mach_traps.h b/trunk/include/asm-x86/mach-default/mach_traps.h index de9ac3f5c4ce..2fe7705c0484 100644 --- a/trunk/include/asm-x86/mach-default/mach_traps.h +++ b/trunk/include/asm-x86/mach-default/mach_traps.h @@ -2,8 +2,8 @@ * Machine specific NMI handling for generic. * Split out from traps.c by Osamu Tomita */ -#ifndef ASM_X86__MACH_DEFAULT__MACH_TRAPS_H -#define ASM_X86__MACH_DEFAULT__MACH_TRAPS_H +#ifndef _MACH_TRAPS_H +#define _MACH_TRAPS_H #include @@ -36,4 +36,4 @@ static inline void reassert_nmi(void) unlock_cmos(); } -#endif /* ASM_X86__MACH_DEFAULT__MACH_TRAPS_H */ +#endif /* !_MACH_TRAPS_H */ diff --git a/trunk/include/asm-x86/mach-default/mach_wakecpu.h b/trunk/include/asm-x86/mach-default/mach_wakecpu.h index 361b810f5160..3ebb17893aa5 100644 --- a/trunk/include/asm-x86/mach-default/mach_wakecpu.h +++ b/trunk/include/asm-x86/mach-default/mach_wakecpu.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__MACH_DEFAULT__MACH_WAKECPU_H -#define ASM_X86__MACH_DEFAULT__MACH_WAKECPU_H +#ifndef __ASM_MACH_WAKECPU_H +#define __ASM_MACH_WAKECPU_H /* * This file copes with machines that wakeup secondary CPUs by the @@ -39,4 +39,4 @@ static inline void restore_NMI_vector(unsigned short *high, unsigned short *low) #define inquire_remote_apic(apicid) {} #endif -#endif /* ASM_X86__MACH_DEFAULT__MACH_WAKECPU_H */ +#endif /* __ASM_MACH_WAKECPU_H */ diff --git a/trunk/include/asm-x86/mach-es7000/mach_apic.h b/trunk/include/asm-x86/mach-es7000/mach_apic.h index c1f6f682d619..0a3fdf930672 100644 --- a/trunk/include/asm-x86/mach-es7000/mach_apic.h +++ b/trunk/include/asm-x86/mach-es7000/mach_apic.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__MACH_ES7000__MACH_APIC_H -#define ASM_X86__MACH_ES7000__MACH_APIC_H +#ifndef __ASM_MACH_APIC_H +#define __ASM_MACH_APIC_H #define xapic_phys_to_log_apicid(cpu) per_cpu(x86_bios_cpu_apicid, cpu) #define esr_disable (1) @@ -191,4 +191,4 @@ static inline u32 phys_pkg_id(u32 cpuid_apic, int index_msb) return cpuid_apic >> index_msb; } -#endif /* ASM_X86__MACH_ES7000__MACH_APIC_H */ +#endif /* __ASM_MACH_APIC_H */ diff --git a/trunk/include/asm-x86/mach-es7000/mach_apicdef.h b/trunk/include/asm-x86/mach-es7000/mach_apicdef.h index a07e56744028..a58ab5a75c8c 100644 --- a/trunk/include/asm-x86/mach-es7000/mach_apicdef.h +++ b/trunk/include/asm-x86/mach-es7000/mach_apicdef.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__MACH_ES7000__MACH_APICDEF_H -#define ASM_X86__MACH_ES7000__MACH_APICDEF_H +#ifndef __ASM_MACH_APICDEF_H +#define __ASM_MACH_APICDEF_H #define APIC_ID_MASK (0xFF<<24) @@ -10,4 +10,4 @@ static inline unsigned get_apic_id(unsigned long x) #define GET_APIC_ID(x) get_apic_id(x) -#endif /* ASM_X86__MACH_ES7000__MACH_APICDEF_H */ +#endif diff --git a/trunk/include/asm-x86/mach-es7000/mach_ipi.h b/trunk/include/asm-x86/mach-es7000/mach_ipi.h index 3a21240e03dc..5e61bd220b06 100644 --- a/trunk/include/asm-x86/mach-es7000/mach_ipi.h +++ b/trunk/include/asm-x86/mach-es7000/mach_ipi.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__MACH_ES7000__MACH_IPI_H -#define ASM_X86__MACH_ES7000__MACH_IPI_H +#ifndef __ASM_MACH_IPI_H +#define __ASM_MACH_IPI_H void send_IPI_mask_sequence(cpumask_t mask, int vector); @@ -21,4 +21,4 @@ static inline void send_IPI_all(int vector) send_IPI_mask(cpu_online_map, vector); } -#endif /* ASM_X86__MACH_ES7000__MACH_IPI_H */ +#endif /* __ASM_MACH_IPI_H */ diff --git a/trunk/include/asm-x86/mach-es7000/mach_mpparse.h b/trunk/include/asm-x86/mach-es7000/mach_mpparse.h index befde24705b7..ef26d3523625 100644 --- a/trunk/include/asm-x86/mach-es7000/mach_mpparse.h +++ b/trunk/include/asm-x86/mach-es7000/mach_mpparse.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__MACH_ES7000__MACH_MPPARSE_H -#define ASM_X86__MACH_ES7000__MACH_MPPARSE_H +#ifndef __ASM_MACH_MPPARSE_H +#define __ASM_MACH_MPPARSE_H #include @@ -26,4 +26,4 @@ static inline int es7000_check_dsdt(void) } #endif -#endif /* ASM_X86__MACH_ES7000__MACH_MPPARSE_H */ +#endif /* __ASM_MACH_MPPARSE_H */ diff --git a/trunk/include/asm-x86/mach-es7000/mach_wakecpu.h b/trunk/include/asm-x86/mach-es7000/mach_wakecpu.h index 97c776ce13f2..84ff58314501 100644 --- a/trunk/include/asm-x86/mach-es7000/mach_wakecpu.h +++ b/trunk/include/asm-x86/mach-es7000/mach_wakecpu.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__MACH_ES7000__MACH_WAKECPU_H -#define ASM_X86__MACH_ES7000__MACH_WAKECPU_H +#ifndef __ASM_MACH_WAKECPU_H +#define __ASM_MACH_WAKECPU_H /* * This file copes with machines that wakeup secondary CPUs by the @@ -56,4 +56,4 @@ static inline void restore_NMI_vector(unsigned short *high, unsigned short *low) #define inquire_remote_apic(apicid) {} #endif -#endif /* ASM_X86__MACH_ES7000__MACH_WAKECPU_H */ +#endif /* __ASM_MACH_WAKECPU_H */ diff --git a/trunk/include/asm-x86/mach-generic/gpio.h b/trunk/include/asm-x86/mach-generic/gpio.h index 6ce0f7786ef8..5305dcb96df2 100644 --- a/trunk/include/asm-x86/mach-generic/gpio.h +++ b/trunk/include/asm-x86/mach-generic/gpio.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__MACH_GENERIC__GPIO_H -#define ASM_X86__MACH_GENERIC__GPIO_H +#ifndef __ASM_MACH_GENERIC_GPIO_H +#define __ASM_MACH_GENERIC_GPIO_H int gpio_request(unsigned gpio, const char *label); void gpio_free(unsigned gpio); @@ -12,4 +12,4 @@ int irq_to_gpio(unsigned irq); #include /* cansleep wrappers */ -#endif /* ASM_X86__MACH_GENERIC__GPIO_H */ +#endif /* __ASM_MACH_GENERIC_GPIO_H */ diff --git a/trunk/include/asm-x86/mach-generic/irq_vectors_limits.h b/trunk/include/asm-x86/mach-generic/irq_vectors_limits.h index f7870e1a220d..890ce3f5e09a 100644 --- a/trunk/include/asm-x86/mach-generic/irq_vectors_limits.h +++ b/trunk/include/asm-x86/mach-generic/irq_vectors_limits.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__MACH_GENERIC__IRQ_VECTORS_LIMITS_H -#define ASM_X86__MACH_GENERIC__IRQ_VECTORS_LIMITS_H +#ifndef _ASM_IRQ_VECTORS_LIMITS_H +#define _ASM_IRQ_VECTORS_LIMITS_H /* * For Summit or generic (i.e. installer) kernels, we have lots of I/O APICs, @@ -11,4 +11,4 @@ #define NR_IRQS 224 #define NR_IRQ_VECTORS 1024 -#endif /* ASM_X86__MACH_GENERIC__IRQ_VECTORS_LIMITS_H */ +#endif /* _ASM_IRQ_VECTORS_LIMITS_H */ diff --git a/trunk/include/asm-x86/mach-generic/mach_apic.h b/trunk/include/asm-x86/mach-generic/mach_apic.h index 5d010c6881dd..6eff343e1233 100644 --- a/trunk/include/asm-x86/mach-generic/mach_apic.h +++ b/trunk/include/asm-x86/mach-generic/mach_apic.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__MACH_GENERIC__MACH_APIC_H -#define ASM_X86__MACH_GENERIC__MACH_APIC_H +#ifndef __ASM_MACH_APIC_H +#define __ASM_MACH_APIC_H #include @@ -29,4 +29,4 @@ extern void generic_bigsmp_probe(void); -#endif /* ASM_X86__MACH_GENERIC__MACH_APIC_H */ +#endif /* __ASM_MACH_APIC_H */ diff --git a/trunk/include/asm-x86/mach-generic/mach_apicdef.h b/trunk/include/asm-x86/mach-generic/mach_apicdef.h index 1657f38b8f27..28ed98972ca8 100644 --- a/trunk/include/asm-x86/mach-generic/mach_apicdef.h +++ b/trunk/include/asm-x86/mach-generic/mach_apicdef.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__MACH_GENERIC__MACH_APICDEF_H -#define ASM_X86__MACH_GENERIC__MACH_APICDEF_H +#ifndef _GENAPIC_MACH_APICDEF_H +#define _GENAPIC_MACH_APICDEF_H 1 #ifndef APIC_DEFINITION #include @@ -8,4 +8,4 @@ #define APIC_ID_MASK (genapic->apic_id_mask) #endif -#endif /* ASM_X86__MACH_GENERIC__MACH_APICDEF_H */ +#endif diff --git a/trunk/include/asm-x86/mach-generic/mach_ipi.h b/trunk/include/asm-x86/mach-generic/mach_ipi.h index f67433dbd65f..441b0fe3ed1d 100644 --- a/trunk/include/asm-x86/mach-generic/mach_ipi.h +++ b/trunk/include/asm-x86/mach-generic/mach_ipi.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__MACH_GENERIC__MACH_IPI_H -#define ASM_X86__MACH_GENERIC__MACH_IPI_H +#ifndef _MACH_IPI_H +#define _MACH_IPI_H 1 #include @@ -7,4 +7,4 @@ #define send_IPI_allbutself (genapic->send_IPI_allbutself) #define send_IPI_all (genapic->send_IPI_all) -#endif /* ASM_X86__MACH_GENERIC__MACH_IPI_H */ +#endif diff --git a/trunk/include/asm-x86/mach-generic/mach_mpparse.h b/trunk/include/asm-x86/mach-generic/mach_mpparse.h index 3115564e557c..586cadbf3787 100644 --- a/trunk/include/asm-x86/mach-generic/mach_mpparse.h +++ b/trunk/include/asm-x86/mach-generic/mach_mpparse.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__MACH_GENERIC__MACH_MPPARSE_H -#define ASM_X86__MACH_GENERIC__MACH_MPPARSE_H +#ifndef _MACH_MPPARSE_H +#define _MACH_MPPARSE_H 1 extern int mps_oem_check(struct mp_config_table *mpc, char *oem, @@ -7,4 +7,4 @@ extern int mps_oem_check(struct mp_config_table *mpc, char *oem, extern int acpi_madt_oem_check(char *oem_id, char *oem_table_id); -#endif /* ASM_X86__MACH_GENERIC__MACH_MPPARSE_H */ +#endif diff --git a/trunk/include/asm-x86/mach-generic/mach_mpspec.h b/trunk/include/asm-x86/mach-generic/mach_mpspec.h index 6061b153613e..c83c120be538 100644 --- a/trunk/include/asm-x86/mach-generic/mach_mpspec.h +++ b/trunk/include/asm-x86/mach-generic/mach_mpspec.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__MACH_GENERIC__MACH_MPSPEC_H -#define ASM_X86__MACH_GENERIC__MACH_MPSPEC_H +#ifndef __ASM_MACH_MPSPEC_H +#define __ASM_MACH_MPSPEC_H #define MAX_IRQ_SOURCES 256 @@ -9,4 +9,4 @@ extern void numaq_mps_oem_check(struct mp_config_table *mpc, char *oem, char *productid); -#endif /* ASM_X86__MACH_GENERIC__MACH_MPSPEC_H */ +#endif /* __ASM_MACH_MPSPEC_H */ diff --git a/trunk/include/asm-x86/mach-numaq/mach_apic.h b/trunk/include/asm-x86/mach-numaq/mach_apic.h index 7a0d39edfcfa..d802465e026a 100644 --- a/trunk/include/asm-x86/mach-numaq/mach_apic.h +++ b/trunk/include/asm-x86/mach-numaq/mach_apic.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__MACH_NUMAQ__MACH_APIC_H -#define ASM_X86__MACH_NUMAQ__MACH_APIC_H +#ifndef __ASM_MACH_APIC_H +#define __ASM_MACH_APIC_H #include #include @@ -135,4 +135,4 @@ static inline u32 phys_pkg_id(u32 cpuid_apic, int index_msb) return cpuid_apic >> index_msb; } -#endif /* ASM_X86__MACH_NUMAQ__MACH_APIC_H */ +#endif /* __ASM_MACH_APIC_H */ diff --git a/trunk/include/asm-x86/mach-numaq/mach_apicdef.h b/trunk/include/asm-x86/mach-numaq/mach_apicdef.h index f870ec5f7782..bf439d0690f5 100644 --- a/trunk/include/asm-x86/mach-numaq/mach_apicdef.h +++ b/trunk/include/asm-x86/mach-numaq/mach_apicdef.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__MACH_NUMAQ__MACH_APICDEF_H -#define ASM_X86__MACH_NUMAQ__MACH_APICDEF_H +#ifndef __ASM_MACH_APICDEF_H +#define __ASM_MACH_APICDEF_H #define APIC_ID_MASK (0xF<<24) @@ -11,4 +11,4 @@ static inline unsigned get_apic_id(unsigned long x) #define GET_APIC_ID(x) get_apic_id(x) -#endif /* ASM_X86__MACH_NUMAQ__MACH_APICDEF_H */ +#endif diff --git a/trunk/include/asm-x86/mach-numaq/mach_ipi.h b/trunk/include/asm-x86/mach-numaq/mach_ipi.h index 1e835823f4bc..c6044488e9e6 100644 --- a/trunk/include/asm-x86/mach-numaq/mach_ipi.h +++ b/trunk/include/asm-x86/mach-numaq/mach_ipi.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__MACH_NUMAQ__MACH_IPI_H -#define ASM_X86__MACH_NUMAQ__MACH_IPI_H +#ifndef __ASM_MACH_IPI_H +#define __ASM_MACH_IPI_H void send_IPI_mask_sequence(cpumask_t, int vector); @@ -22,4 +22,4 @@ static inline void send_IPI_all(int vector) send_IPI_mask(cpu_online_map, vector); } -#endif /* ASM_X86__MACH_NUMAQ__MACH_IPI_H */ +#endif /* __ASM_MACH_IPI_H */ diff --git a/trunk/include/asm-x86/mach-numaq/mach_mpparse.h b/trunk/include/asm-x86/mach-numaq/mach_mpparse.h index 74ade184920b..626aef6b155f 100644 --- a/trunk/include/asm-x86/mach-numaq/mach_mpparse.h +++ b/trunk/include/asm-x86/mach-numaq/mach_mpparse.h @@ -1,7 +1,7 @@ -#ifndef ASM_X86__MACH_NUMAQ__MACH_MPPARSE_H -#define ASM_X86__MACH_NUMAQ__MACH_MPPARSE_H +#ifndef __ASM_MACH_MPPARSE_H +#define __ASM_MACH_MPPARSE_H extern void numaq_mps_oem_check(struct mp_config_table *mpc, char *oem, char *productid); -#endif /* ASM_X86__MACH_NUMAQ__MACH_MPPARSE_H */ +#endif /* __ASM_MACH_MPPARSE_H */ diff --git a/trunk/include/asm-x86/mach-numaq/mach_wakecpu.h b/trunk/include/asm-x86/mach-numaq/mach_wakecpu.h index 0db8cea643c0..00530041a991 100644 --- a/trunk/include/asm-x86/mach-numaq/mach_wakecpu.h +++ b/trunk/include/asm-x86/mach-numaq/mach_wakecpu.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__MACH_NUMAQ__MACH_WAKECPU_H -#define ASM_X86__MACH_NUMAQ__MACH_WAKECPU_H +#ifndef __ASM_MACH_WAKECPU_H +#define __ASM_MACH_WAKECPU_H /* This file copes with machines that wakeup secondary CPUs by NMIs */ @@ -40,4 +40,4 @@ static inline void restore_NMI_vector(unsigned short *high, unsigned short *low) #define inquire_remote_apic(apicid) {} -#endif /* ASM_X86__MACH_NUMAQ__MACH_WAKECPU_H */ +#endif /* __ASM_MACH_WAKECPU_H */ diff --git a/trunk/include/asm-x86/mach-rdc321x/gpio.h b/trunk/include/asm-x86/mach-rdc321x/gpio.h index 94b6cdf532e2..acce0b7d397b 100644 --- a/trunk/include/asm-x86/mach-rdc321x/gpio.h +++ b/trunk/include/asm-x86/mach-rdc321x/gpio.h @@ -1,7 +1,5 @@ -#ifndef ASM_X86__MACH_RDC321X__GPIO_H -#define ASM_X86__MACH_RDC321X__GPIO_H - -#include +#ifndef _RDC321X_GPIO_H +#define _RDC321X_GPIO_H extern int rdc_gpio_get_value(unsigned gpio); extern void rdc_gpio_set_value(unsigned gpio, int value); @@ -20,7 +18,6 @@ static inline int gpio_request(unsigned gpio, const char *label) static inline void gpio_free(unsigned gpio) { - might_sleep(); rdc_gpio_free(gpio); } @@ -57,4 +54,4 @@ static inline int irq_to_gpio(unsigned irq) /* For cansleep */ #include -#endif /* ASM_X86__MACH_RDC321X__GPIO_H */ +#endif /* _RDC321X_GPIO_H_ */ diff --git a/trunk/include/asm-x86/mach-summit/irq_vectors_limits.h b/trunk/include/asm-x86/mach-summit/irq_vectors_limits.h index 22f376ad68e1..890ce3f5e09a 100644 --- a/trunk/include/asm-x86/mach-summit/irq_vectors_limits.h +++ b/trunk/include/asm-x86/mach-summit/irq_vectors_limits.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__MACH_SUMMIT__IRQ_VECTORS_LIMITS_H -#define ASM_X86__MACH_SUMMIT__IRQ_VECTORS_LIMITS_H +#ifndef _ASM_IRQ_VECTORS_LIMITS_H +#define _ASM_IRQ_VECTORS_LIMITS_H /* * For Summit or generic (i.e. installer) kernels, we have lots of I/O APICs, @@ -11,4 +11,4 @@ #define NR_IRQS 224 #define NR_IRQ_VECTORS 1024 -#endif /* ASM_X86__MACH_SUMMIT__IRQ_VECTORS_LIMITS_H */ +#endif /* _ASM_IRQ_VECTORS_LIMITS_H */ diff --git a/trunk/include/asm-x86/mach-summit/mach_apic.h b/trunk/include/asm-x86/mach-summit/mach_apic.h index 7a66758d701d..c47e2ab5c5ca 100644 --- a/trunk/include/asm-x86/mach-summit/mach_apic.h +++ b/trunk/include/asm-x86/mach-summit/mach_apic.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__MACH_SUMMIT__MACH_APIC_H -#define ASM_X86__MACH_SUMMIT__MACH_APIC_H +#ifndef __ASM_MACH_APIC_H +#define __ASM_MACH_APIC_H #include @@ -182,4 +182,4 @@ static inline u32 phys_pkg_id(u32 cpuid_apic, int index_msb) return hard_smp_processor_id() >> index_msb; } -#endif /* ASM_X86__MACH_SUMMIT__MACH_APIC_H */ +#endif /* __ASM_MACH_APIC_H */ diff --git a/trunk/include/asm-x86/mach-summit/mach_apicdef.h b/trunk/include/asm-x86/mach-summit/mach_apicdef.h index d4bc8590c4f6..a58ab5a75c8c 100644 --- a/trunk/include/asm-x86/mach-summit/mach_apicdef.h +++ b/trunk/include/asm-x86/mach-summit/mach_apicdef.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__MACH_SUMMIT__MACH_APICDEF_H -#define ASM_X86__MACH_SUMMIT__MACH_APICDEF_H +#ifndef __ASM_MACH_APICDEF_H +#define __ASM_MACH_APICDEF_H #define APIC_ID_MASK (0xFF<<24) @@ -10,4 +10,4 @@ static inline unsigned get_apic_id(unsigned long x) #define GET_APIC_ID(x) get_apic_id(x) -#endif /* ASM_X86__MACH_SUMMIT__MACH_APICDEF_H */ +#endif diff --git a/trunk/include/asm-x86/mach-summit/mach_ipi.h b/trunk/include/asm-x86/mach-summit/mach_ipi.h index a3b31c528d90..9404c535b7ec 100644 --- a/trunk/include/asm-x86/mach-summit/mach_ipi.h +++ b/trunk/include/asm-x86/mach-summit/mach_ipi.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__MACH_SUMMIT__MACH_IPI_H -#define ASM_X86__MACH_SUMMIT__MACH_IPI_H +#ifndef __ASM_MACH_IPI_H +#define __ASM_MACH_IPI_H void send_IPI_mask_sequence(cpumask_t mask, int vector); @@ -22,4 +22,4 @@ static inline void send_IPI_all(int vector) send_IPI_mask(cpu_online_map, vector); } -#endif /* ASM_X86__MACH_SUMMIT__MACH_IPI_H */ +#endif /* __ASM_MACH_IPI_H */ diff --git a/trunk/include/asm-x86/mach-summit/mach_mpparse.h b/trunk/include/asm-x86/mach-summit/mach_mpparse.h index 92396f28772b..fdf591701339 100644 --- a/trunk/include/asm-x86/mach-summit/mach_mpparse.h +++ b/trunk/include/asm-x86/mach-summit/mach_mpparse.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__MACH_SUMMIT__MACH_MPPARSE_H -#define ASM_X86__MACH_SUMMIT__MACH_MPPARSE_H +#ifndef __ASM_MACH_MPPARSE_H +#define __ASM_MACH_MPPARSE_H #include #include @@ -107,4 +107,4 @@ static inline int is_WPEG(struct rio_detail *rio){ rio->type == LookOutAWPEG || rio->type == LookOutBWPEG); } -#endif /* ASM_X86__MACH_SUMMIT__MACH_MPPARSE_H */ +#endif /* __ASM_MACH_MPPARSE_H */ diff --git a/trunk/include/asm-x86/math_emu.h b/trunk/include/asm-x86/math_emu.h index 5768d8e95c8c..9bf4ae93ab10 100644 --- a/trunk/include/asm-x86/math_emu.h +++ b/trunk/include/asm-x86/math_emu.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__MATH_EMU_H -#define ASM_X86__MATH_EMU_H +#ifndef _I386_MATH_EMU_H +#define _I386_MATH_EMU_H /* This structure matches the layout of the data saved to the stack following a device-not-present interrupt, part of it saved @@ -28,4 +28,4 @@ struct info { long ___vm86_fs; long ___vm86_gs; }; -#endif /* ASM_X86__MATH_EMU_H */ +#endif diff --git a/trunk/include/asm-x86/mc146818rtc.h b/trunk/include/asm-x86/mc146818rtc.h index a995f33176cd..daf1ccde77af 100644 --- a/trunk/include/asm-x86/mc146818rtc.h +++ b/trunk/include/asm-x86/mc146818rtc.h @@ -1,8 +1,8 @@ /* * Machine dependent access functions for RTC registers. */ -#ifndef ASM_X86__MC146818RTC_H -#define ASM_X86__MC146818RTC_H +#ifndef _ASM_MC146818RTC_H +#define _ASM_MC146818RTC_H #include #include @@ -101,4 +101,4 @@ extern unsigned long mach_get_cmos_time(void); #define RTC_IRQ 8 -#endif /* ASM_X86__MC146818RTC_H */ +#endif /* _ASM_MC146818RTC_H */ diff --git a/trunk/include/asm-x86/mca.h b/trunk/include/asm-x86/mca.h index 60d1ed287b13..09adf2eac4dc 100644 --- a/trunk/include/asm-x86/mca.h +++ b/trunk/include/asm-x86/mca.h @@ -1,8 +1,8 @@ /* -*- mode: c; c-basic-offset: 8 -*- */ /* Platform specific MCA defines */ -#ifndef ASM_X86__MCA_H -#define ASM_X86__MCA_H +#ifndef _ASM_MCA_H +#define _ASM_MCA_H /* Maximal number of MCA slots - actually, some machines have less, but * they all have sufficient number of POS registers to cover 8. @@ -40,4 +40,4 @@ */ #define MCA_NUMADAPTERS (MCA_MAX_SLOT_NR+3) -#endif /* ASM_X86__MCA_H */ +#endif diff --git a/trunk/include/asm-x86/mca_dma.h b/trunk/include/asm-x86/mca_dma.h index 49f22be237d2..c3dca6edc6b1 100644 --- a/trunk/include/asm-x86/mca_dma.h +++ b/trunk/include/asm-x86/mca_dma.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__MCA_DMA_H -#define ASM_X86__MCA_DMA_H +#ifndef MCA_DMA_H +#define MCA_DMA_H #include #include @@ -198,4 +198,4 @@ static inline void mca_set_dma_mode(unsigned int dmanr, unsigned int mode) outb(mode, MCA_DMA_REG_EXE); } -#endif /* ASM_X86__MCA_DMA_H */ +#endif /* MCA_DMA_H */ diff --git a/trunk/include/asm-x86/mce.h b/trunk/include/asm-x86/mce.h index 036133eaf744..531eaa587455 100644 --- a/trunk/include/asm-x86/mce.h +++ b/trunk/include/asm-x86/mce.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__MCE_H -#define ASM_X86__MCE_H +#ifndef _ASM_X86_MCE_H +#define _ASM_X86_MCE_H #ifdef __x86_64__ @@ -127,4 +127,4 @@ extern void restart_mce(void); #endif /* __KERNEL__ */ -#endif /* ASM_X86__MCE_H */ +#endif diff --git a/trunk/include/asm-x86/mman.h b/trunk/include/asm-x86/mman.h index 4ef28e6de383..90bc4108a4fd 100644 --- a/trunk/include/asm-x86/mman.h +++ b/trunk/include/asm-x86/mman.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__MMAN_H -#define ASM_X86__MMAN_H +#ifndef _ASM_X86_MMAN_H +#define _ASM_X86_MMAN_H #include @@ -17,4 +17,4 @@ #define MCL_CURRENT 1 /* lock all current mappings */ #define MCL_FUTURE 2 /* lock all future mappings */ -#endif /* ASM_X86__MMAN_H */ +#endif /* _ASM_X86_MMAN_H */ diff --git a/trunk/include/asm-x86/mmconfig.h b/trunk/include/asm-x86/mmconfig.h index fb79b1cf5d07..e293ab81e850 100644 --- a/trunk/include/asm-x86/mmconfig.h +++ b/trunk/include/asm-x86/mmconfig.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__MMCONFIG_H -#define ASM_X86__MMCONFIG_H +#ifndef _ASM_MMCONFIG_H +#define _ASM_MMCONFIG_H #ifdef CONFIG_PCI_MMCONFIG extern void __cpuinit fam10h_check_enable_mmcfg(void); @@ -9,4 +9,4 @@ static inline void fam10h_check_enable_mmcfg(void) { } static inline void check_enable_amd_mmconf_dmi(void) { } #endif -#endif /* ASM_X86__MMCONFIG_H */ +#endif diff --git a/trunk/include/asm-x86/mmu.h b/trunk/include/asm-x86/mmu.h index 9d5aff14334a..00e88679e11f 100644 --- a/trunk/include/asm-x86/mmu.h +++ b/trunk/include/asm-x86/mmu.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__MMU_H -#define ASM_X86__MMU_H +#ifndef _ASM_X86_MMU_H +#define _ASM_X86_MMU_H #include #include @@ -7,9 +7,14 @@ /* * The x86 doesn't have a mmu context, but * we put the segment information here. + * + * cpu_vm_mask is used to optimize ldt flushing. */ typedef struct { void *ldt; +#ifdef CONFIG_X86_64 + rwlock_t ldtlock; +#endif int size; struct mutex lock; void *vdso; @@ -23,4 +28,4 @@ static inline void leave_mm(int cpu) } #endif -#endif /* ASM_X86__MMU_H */ +#endif /* _ASM_X86_MMU_H */ diff --git a/trunk/include/asm-x86/mmu_context.h b/trunk/include/asm-x86/mmu_context.h index 8ec940bfd079..fac57014e7c6 100644 --- a/trunk/include/asm-x86/mmu_context.h +++ b/trunk/include/asm-x86/mmu_context.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__MMU_CONTEXT_H -#define ASM_X86__MMU_CONTEXT_H +#ifndef __ASM_X86_MMU_CONTEXT_H +#define __ASM_X86_MMU_CONTEXT_H #include #include @@ -34,4 +34,4 @@ do { \ } while (0); -#endif /* ASM_X86__MMU_CONTEXT_H */ +#endif /* __ASM_X86_MMU_CONTEXT_H */ diff --git a/trunk/include/asm-x86/mmu_context_32.h b/trunk/include/asm-x86/mmu_context_32.h index cce6f6e4afd6..824fc575c6d8 100644 --- a/trunk/include/asm-x86/mmu_context_32.h +++ b/trunk/include/asm-x86/mmu_context_32.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__MMU_CONTEXT_32_H -#define ASM_X86__MMU_CONTEXT_32_H +#ifndef __I386_SCHED_H +#define __I386_SCHED_H static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk) { @@ -53,4 +53,4 @@ static inline void switch_mm(struct mm_struct *prev, #define deactivate_mm(tsk, mm) \ asm("movl %0,%%gs": :"r" (0)); -#endif /* ASM_X86__MMU_CONTEXT_32_H */ +#endif diff --git a/trunk/include/asm-x86/mmu_context_64.h b/trunk/include/asm-x86/mmu_context_64.h index 26758673c828..c7000634ccae 100644 --- a/trunk/include/asm-x86/mmu_context_64.h +++ b/trunk/include/asm-x86/mmu_context_64.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__MMU_CONTEXT_64_H -#define ASM_X86__MMU_CONTEXT_64_H +#ifndef __X86_64_MMU_CONTEXT_H +#define __X86_64_MMU_CONTEXT_H #include @@ -51,4 +51,4 @@ do { \ asm volatile("movl %0,%%fs"::"r"(0)); \ } while (0) -#endif /* ASM_X86__MMU_CONTEXT_64_H */ +#endif diff --git a/trunk/include/asm-x86/mmx.h b/trunk/include/asm-x86/mmx.h index 2e7299bb3653..940881218ff8 100644 --- a/trunk/include/asm-x86/mmx.h +++ b/trunk/include/asm-x86/mmx.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__MMX_H -#define ASM_X86__MMX_H +#ifndef _ASM_MMX_H +#define _ASM_MMX_H /* * MMX 3Dnow! helper operations @@ -11,4 +11,4 @@ extern void *_mmx_memcpy(void *to, const void *from, size_t size); extern void mmx_clear_page(void *page); extern void mmx_copy_page(void *to, void *from); -#endif /* ASM_X86__MMX_H */ +#endif diff --git a/trunk/include/asm-x86/mmzone_32.h b/trunk/include/asm-x86/mmzone_32.h index 121b65d61d86..5862e6460658 100644 --- a/trunk/include/asm-x86/mmzone_32.h +++ b/trunk/include/asm-x86/mmzone_32.h @@ -3,8 +3,8 @@ * */ -#ifndef ASM_X86__MMZONE_32_H -#define ASM_X86__MMZONE_32_H +#ifndef _ASM_MMZONE_H_ +#define _ASM_MMZONE_H_ #include @@ -131,4 +131,4 @@ static inline int pfn_valid(int pfn) }) #endif /* CONFIG_NEED_MULTIPLE_NODES */ -#endif /* ASM_X86__MMZONE_32_H */ +#endif /* _ASM_MMZONE_H_ */ diff --git a/trunk/include/asm-x86/mmzone_64.h b/trunk/include/asm-x86/mmzone_64.h index 626b03a14875..594bd0dc1d08 100644 --- a/trunk/include/asm-x86/mmzone_64.h +++ b/trunk/include/asm-x86/mmzone_64.h @@ -1,8 +1,8 @@ /* K8 NUMA support */ /* Copyright 2002,2003 by Andi Kleen, SuSE Labs */ /* 2.5 Version loosely based on the NUMAQ Code by Pat Gaughen. */ -#ifndef ASM_X86__MMZONE_64_H -#define ASM_X86__MMZONE_64_H +#ifndef _ASM_X86_64_MMZONE_H +#define _ASM_X86_64_MMZONE_H 1 #ifdef CONFIG_NUMA @@ -49,4 +49,4 @@ extern int early_pfn_to_nid(unsigned long pfn); #endif #endif -#endif /* ASM_X86__MMZONE_64_H */ +#endif diff --git a/trunk/include/asm-x86/module.h b/trunk/include/asm-x86/module.h index 48dc3e0c07d9..bfedb247871c 100644 --- a/trunk/include/asm-x86/module.h +++ b/trunk/include/asm-x86/module.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__MODULE_H -#define ASM_X86__MODULE_H +#ifndef _ASM_MODULE_H +#define _ASM_MODULE_H /* x86_32/64 are simple */ struct mod_arch_specific {}; @@ -79,4 +79,4 @@ struct mod_arch_specific {}; # define MODULE_ARCH_VERMAGIC MODULE_PROC_FAMILY MODULE_STACKSIZE #endif -#endif /* ASM_X86__MODULE_H */ +#endif /* _ASM_MODULE_H */ diff --git a/trunk/include/asm-x86/mpspec.h b/trunk/include/asm-x86/mpspec.h index 118da365e371..b6995e567fcc 100644 --- a/trunk/include/asm-x86/mpspec.h +++ b/trunk/include/asm-x86/mpspec.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__MPSPEC_H -#define ASM_X86__MPSPEC_H +#ifndef _AM_X86_MPSPEC_H +#define _AM_X86_MPSPEC_H #include @@ -141,4 +141,4 @@ static inline void physid_set_mask_of_physid(int physid, physid_mask_t *map) extern physid_mask_t phys_cpu_present_map; -#endif /* ASM_X86__MPSPEC_H */ +#endif diff --git a/trunk/include/asm-x86/mpspec_def.h b/trunk/include/asm-x86/mpspec_def.h index 79166b048012..38d1e73b49e4 100644 --- a/trunk/include/asm-x86/mpspec_def.h +++ b/trunk/include/asm-x86/mpspec_def.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__MPSPEC_DEF_H -#define ASM_X86__MPSPEC_DEF_H +#ifndef __ASM_MPSPEC_DEF_H +#define __ASM_MPSPEC_DEF_H /* * Structure definitions for SMP machines following the @@ -177,4 +177,4 @@ enum mp_bustype { MP_BUS_PCI, MP_BUS_MCA, }; -#endif /* ASM_X86__MPSPEC_DEF_H */ +#endif diff --git a/trunk/include/asm-x86/msgbuf.h b/trunk/include/asm-x86/msgbuf.h index 1b538c907a3d..7e4e9481f51c 100644 --- a/trunk/include/asm-x86/msgbuf.h +++ b/trunk/include/asm-x86/msgbuf.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__MSGBUF_H -#define ASM_X86__MSGBUF_H +#ifndef _ASM_X86_MSGBUF_H +#define _ASM_X86_MSGBUF_H /* * The msqid64_ds structure for i386 architecture. @@ -36,4 +36,4 @@ struct msqid64_ds { unsigned long __unused5; }; -#endif /* ASM_X86__MSGBUF_H */ +#endif /* _ASM_X86_MSGBUF_H */ diff --git a/trunk/include/asm-x86/msidef.h b/trunk/include/asm-x86/msidef.h index 3139666a94fa..296f29ce426d 100644 --- a/trunk/include/asm-x86/msidef.h +++ b/trunk/include/asm-x86/msidef.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__MSIDEF_H -#define ASM_X86__MSIDEF_H +#ifndef ASM_MSIDEF_H +#define ASM_MSIDEF_H /* * Constants for Intel APIC based MSI messages. @@ -48,4 +48,4 @@ #define MSI_ADDR_DEST_ID(dest) (((dest) << MSI_ADDR_DEST_ID_SHIFT) & \ MSI_ADDR_DEST_ID_MASK) -#endif /* ASM_X86__MSIDEF_H */ +#endif /* ASM_MSIDEF_H */ diff --git a/trunk/include/asm-x86/msr-index.h b/trunk/include/asm-x86/msr-index.h index 3052f058ab06..44bce773012e 100644 --- a/trunk/include/asm-x86/msr-index.h +++ b/trunk/include/asm-x86/msr-index.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__MSR_INDEX_H -#define ASM_X86__MSR_INDEX_H +#ifndef __ASM_MSR_INDEX_H +#define __ASM_MSR_INDEX_H /* CPU model specific register (MSR) numbers */ @@ -310,4 +310,4 @@ /* Geode defined MSRs */ #define MSR_GEODE_BUSCONT_CONF0 0x00001900 -#endif /* ASM_X86__MSR_INDEX_H */ +#endif /* __ASM_MSR_INDEX_H */ diff --git a/trunk/include/asm-x86/msr.h b/trunk/include/asm-x86/msr.h index 530af1f6389e..2362cfda1fbc 100644 --- a/trunk/include/asm-x86/msr.h +++ b/trunk/include/asm-x86/msr.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__MSR_H -#define ASM_X86__MSR_H +#ifndef __ASM_X86_MSR_H_ +#define __ASM_X86_MSR_H_ #include @@ -63,22 +63,6 @@ static inline unsigned long long native_read_msr_safe(unsigned int msr, return EAX_EDX_VAL(val, low, high); } -static inline unsigned long long native_read_msr_amd_safe(unsigned int msr, - int *err) -{ - DECLARE_ARGS(val, low, high); - - asm volatile("2: rdmsr ; xor %0,%0\n" - "1:\n\t" - ".section .fixup,\"ax\"\n\t" - "3: mov %3,%0 ; jmp 1b\n\t" - ".previous\n\t" - _ASM_EXTABLE(2b, 3b) - : "=r" (*err), EAX_EDX_RET(val, low, high) - : "c" (msr), "D" (0x9c5a203a), "i" (-EFAULT)); - return EAX_EDX_VAL(val, low, high); -} - static inline void native_write_msr(unsigned int msr, unsigned low, unsigned high) { @@ -174,13 +158,6 @@ static inline int rdmsrl_safe(unsigned msr, unsigned long long *p) *p = native_read_msr_safe(msr, &err); return err; } -static inline int rdmsrl_amd_safe(unsigned msr, unsigned long long *p) -{ - int err; - - *p = native_read_msr_amd_safe(msr, &err); - return err; -} #define rdtscl(low) \ ((low) = (u32)native_read_tsc()) @@ -244,4 +221,4 @@ static inline int wrmsr_safe_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h) #endif /* __KERNEL__ */ -#endif /* ASM_X86__MSR_H */ +#endif diff --git a/trunk/include/asm-x86/mtrr.h b/trunk/include/asm-x86/mtrr.h index 23a7f83da953..a69a01a51729 100644 --- a/trunk/include/asm-x86/mtrr.h +++ b/trunk/include/asm-x86/mtrr.h @@ -20,8 +20,8 @@ The postal address is: Richard Gooch, c/o ATNF, P. O. Box 76, Epping, N.S.W., 2121, Australia. */ -#ifndef ASM_X86__MTRR_H -#define ASM_X86__MTRR_H +#ifndef _ASM_X86_MTRR_H +#define _ASM_X86_MTRR_H #include #include @@ -170,4 +170,4 @@ struct mtrr_gentry32 { #endif /* __KERNEL__ */ -#endif /* ASM_X86__MTRR_H */ +#endif /* _ASM_X86_MTRR_H */ diff --git a/trunk/include/asm-x86/mutex_32.h b/trunk/include/asm-x86/mutex_32.h index 25c16d8ba3c7..73e928ef5f03 100644 --- a/trunk/include/asm-x86/mutex_32.h +++ b/trunk/include/asm-x86/mutex_32.h @@ -6,8 +6,8 @@ * * Copyright (C) 2004, 2005, 2006 Red Hat, Inc., Ingo Molnar */ -#ifndef ASM_X86__MUTEX_32_H -#define ASM_X86__MUTEX_32_H +#ifndef _ASM_MUTEX_H +#define _ASM_MUTEX_H #include @@ -122,4 +122,4 @@ static inline int __mutex_fastpath_trylock(atomic_t *count, #endif } -#endif /* ASM_X86__MUTEX_32_H */ +#endif diff --git a/trunk/include/asm-x86/mutex_64.h b/trunk/include/asm-x86/mutex_64.h index 918ba21ab9d9..f3fae9becb38 100644 --- a/trunk/include/asm-x86/mutex_64.h +++ b/trunk/include/asm-x86/mutex_64.h @@ -6,8 +6,8 @@ * * Copyright (C) 2004, 2005, 2006 Red Hat, Inc., Ingo Molnar */ -#ifndef ASM_X86__MUTEX_64_H -#define ASM_X86__MUTEX_64_H +#ifndef _ASM_MUTEX_H +#define _ASM_MUTEX_H /** * __mutex_fastpath_lock - decrement and call function if negative @@ -97,4 +97,4 @@ static inline int __mutex_fastpath_trylock(atomic_t *count, return 0; } -#endif /* ASM_X86__MUTEX_64_H */ +#endif diff --git a/trunk/include/asm-x86/nmi.h b/trunk/include/asm-x86/nmi.h index d5e715f024dc..21f8d0202a82 100644 --- a/trunk/include/asm-x86/nmi.h +++ b/trunk/include/asm-x86/nmi.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__NMI_H -#define ASM_X86__NMI_H +#ifndef _ASM_X86_NMI_H_ +#define _ASM_X86_NMI_H_ #include #include @@ -34,7 +34,6 @@ extern void stop_apic_nmi_watchdog(void *); extern void disable_timer_nmi_watchdog(void); extern void enable_timer_nmi_watchdog(void); extern int nmi_watchdog_tick(struct pt_regs *regs, unsigned reason); -extern void cpu_nmi_set_wd_enabled(void); extern atomic_t nmi_active; extern unsigned int nmi_watchdog; @@ -82,4 +81,4 @@ void enable_lapic_nmi_watchdog(void); void stop_nmi(void); void restart_nmi(void); -#endif /* ASM_X86__NMI_H */ +#endif diff --git a/trunk/include/asm-x86/nops.h b/trunk/include/asm-x86/nops.h index ae742721ae73..ad0bedd10b89 100644 --- a/trunk/include/asm-x86/nops.h +++ b/trunk/include/asm-x86/nops.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__NOPS_H -#define ASM_X86__NOPS_H +#ifndef _ASM_NOPS_H +#define _ASM_NOPS_H 1 /* Define nops for use with alternative() */ @@ -115,4 +115,4 @@ #define ASM_NOP_MAX 8 -#endif /* ASM_X86__NOPS_H */ +#endif diff --git a/trunk/include/asm-x86/numa_32.h b/trunk/include/asm-x86/numa_32.h index 44cb07855c5b..220d7b7707a0 100644 --- a/trunk/include/asm-x86/numa_32.h +++ b/trunk/include/asm-x86/numa_32.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__NUMA_32_H -#define ASM_X86__NUMA_32_H +#ifndef _ASM_X86_32_NUMA_H +#define _ASM_X86_32_NUMA_H 1 extern int pxm_to_nid(int pxm); extern void numa_remove_cpu(int cpu); @@ -8,4 +8,4 @@ extern void numa_remove_cpu(int cpu); extern void set_highmem_pages_init(void); #endif -#endif /* ASM_X86__NUMA_32_H */ +#endif /* _ASM_X86_32_NUMA_H */ diff --git a/trunk/include/asm-x86/numa_64.h b/trunk/include/asm-x86/numa_64.h index 15c990395b02..3830094434a9 100644 --- a/trunk/include/asm-x86/numa_64.h +++ b/trunk/include/asm-x86/numa_64.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__NUMA_64_H -#define ASM_X86__NUMA_64_H +#ifndef _ASM_X8664_NUMA_H +#define _ASM_X8664_NUMA_H 1 #include #include @@ -40,4 +40,4 @@ static inline void numa_add_cpu(int cpu, int node) { } static inline void numa_remove_cpu(int cpu) { } #endif -#endif /* ASM_X86__NUMA_64_H */ +#endif diff --git a/trunk/include/asm-x86/numaq.h b/trunk/include/asm-x86/numaq.h index 124bf7d4b70a..34b92d581fa3 100644 --- a/trunk/include/asm-x86/numaq.h +++ b/trunk/include/asm-x86/numaq.h @@ -23,8 +23,8 @@ * Send feedback to */ -#ifndef ASM_X86__NUMAQ_H -#define ASM_X86__NUMAQ_H +#ifndef NUMAQ_H +#define NUMAQ_H #ifdef CONFIG_X86_NUMAQ @@ -165,5 +165,5 @@ static inline int get_memcfg_numaq(void) return 0; } #endif /* CONFIG_X86_NUMAQ */ -#endif /* ASM_X86__NUMAQ_H */ +#endif /* NUMAQ_H */ diff --git a/trunk/include/asm-x86/olpc.h b/trunk/include/asm-x86/olpc.h index d7328b1a05c1..97d47133486f 100644 --- a/trunk/include/asm-x86/olpc.h +++ b/trunk/include/asm-x86/olpc.h @@ -1,7 +1,7 @@ /* OLPC machine specific definitions */ -#ifndef ASM_X86__OLPC_H -#define ASM_X86__OLPC_H +#ifndef ASM_OLPC_H_ +#define ASM_OLPC_H_ #include @@ -129,4 +129,4 @@ extern int olpc_ec_mask_unset(uint8_t bits); #define OLPC_GPIO_LID geode_gpio(26) #define OLPC_GPIO_ECSCI geode_gpio(27) -#endif /* ASM_X86__OLPC_H */ +#endif diff --git a/trunk/include/asm-x86/page.h b/trunk/include/asm-x86/page.h index 79544e6ffb8b..49982110e4d9 100644 --- a/trunk/include/asm-x86/page.h +++ b/trunk/include/asm-x86/page.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__PAGE_H -#define ASM_X86__PAGE_H +#ifndef _ASM_X86_PAGE_H +#define _ASM_X86_PAGE_H #include @@ -199,4 +199,4 @@ static inline pteval_t native_pte_flags(pte_t pte) #define __HAVE_ARCH_GATE_AREA 1 #endif /* __KERNEL__ */ -#endif /* ASM_X86__PAGE_H */ +#endif /* _ASM_X86_PAGE_H */ diff --git a/trunk/include/asm-x86/page_32.h b/trunk/include/asm-x86/page_32.h index 72f7305682c6..ab8528793f08 100644 --- a/trunk/include/asm-x86/page_32.h +++ b/trunk/include/asm-x86/page_32.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__PAGE_32_H -#define ASM_X86__PAGE_32_H +#ifndef _ASM_X86_PAGE_32_H +#define _ASM_X86_PAGE_32_H /* * This handles the memory map. @@ -89,11 +89,13 @@ extern int nx_enabled; extern unsigned int __VMALLOC_RESERVE; extern int sysctl_legacy_va_layout; +#define VMALLOC_RESERVE ((unsigned long)__VMALLOC_RESERVE) +#define MAXMEM (-__PAGE_OFFSET - __VMALLOC_RESERVE) + extern void find_low_pfn_range(void); extern unsigned long init_memory_mapping(unsigned long start, unsigned long end); extern void initmem_init(unsigned long, unsigned long); -extern void free_initmem(void); extern void setup_bootmem_allocator(void); @@ -124,4 +126,4 @@ static inline void copy_page(void *to, void *from) #endif /* CONFIG_X86_3DNOW */ #endif /* !__ASSEMBLY__ */ -#endif /* ASM_X86__PAGE_32_H */ +#endif /* _ASM_X86_PAGE_32_H */ diff --git a/trunk/include/asm-x86/page_64.h b/trunk/include/asm-x86/page_64.h index 5e64acfed0a4..c6916c83e6b1 100644 --- a/trunk/include/asm-x86/page_64.h +++ b/trunk/include/asm-x86/page_64.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__PAGE_64_H -#define ASM_X86__PAGE_64_H +#ifndef _X86_64_PAGE_H +#define _X86_64_PAGE_H #define PAGETABLE_LEVELS 4 @@ -91,7 +91,6 @@ extern unsigned long init_memory_mapping(unsigned long start, unsigned long end); extern void initmem_init(unsigned long start_pfn, unsigned long end_pfn); -extern void free_initmem(void); extern void init_extra_mapping_uc(unsigned long phys, unsigned long size); extern void init_extra_mapping_wb(unsigned long phys, unsigned long size); @@ -103,4 +102,4 @@ extern void init_extra_mapping_wb(unsigned long phys, unsigned long size); #endif -#endif /* ASM_X86__PAGE_64_H */ +#endif /* _X86_64_PAGE_H */ diff --git a/trunk/include/asm-x86/param.h b/trunk/include/asm-x86/param.h index 0009cfb11a5f..6f0d0422f4ca 100644 --- a/trunk/include/asm-x86/param.h +++ b/trunk/include/asm-x86/param.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__PARAM_H -#define ASM_X86__PARAM_H +#ifndef _ASM_X86_PARAM_H +#define _ASM_X86_PARAM_H #ifdef __KERNEL__ # define HZ CONFIG_HZ /* Internal kernel timer frequency */ @@ -19,4 +19,4 @@ #define MAXHOSTNAMELEN 64 /* max length of hostname */ -#endif /* ASM_X86__PARAM_H */ +#endif /* _ASM_X86_PARAM_H */ diff --git a/trunk/include/asm-x86/paravirt.h b/trunk/include/asm-x86/paravirt.h index 891971f57d35..fbbde93f12d6 100644 --- a/trunk/include/asm-x86/paravirt.h +++ b/trunk/include/asm-x86/paravirt.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__PARAVIRT_H -#define ASM_X86__PARAVIRT_H +#ifndef __ASM_PARAVIRT_H +#define __ASM_PARAVIRT_H /* Various instructions on x86 need to be replaced for * para-virtualization: those hooks are defined here. */ @@ -137,7 +137,6 @@ struct pv_cpu_ops { /* MSR, PMC and TSR operations. err = 0/-EFAULT. wrmsr returns 0/-EFAULT. */ - u64 (*read_msr_amd)(unsigned int msr, int *err); u64 (*read_msr)(unsigned int msr, int *err); int (*write_msr)(unsigned int msr, unsigned low, unsigned high); @@ -258,13 +257,13 @@ struct pv_mmu_ops { * Hooks for allocating/releasing pagetable pages when they're * attached to a pagetable */ - void (*alloc_pte)(struct mm_struct *mm, unsigned long pfn); - void (*alloc_pmd)(struct mm_struct *mm, unsigned long pfn); - void (*alloc_pmd_clone)(unsigned long pfn, unsigned long clonepfn, unsigned long start, unsigned long count); - void (*alloc_pud)(struct mm_struct *mm, unsigned long pfn); - void (*release_pte)(unsigned long pfn); - void (*release_pmd)(unsigned long pfn); - void (*release_pud)(unsigned long pfn); + void (*alloc_pte)(struct mm_struct *mm, u32 pfn); + void (*alloc_pmd)(struct mm_struct *mm, u32 pfn); + void (*alloc_pmd_clone)(u32 pfn, u32 clonepfn, u32 start, u32 count); + void (*alloc_pud)(struct mm_struct *mm, u32 pfn); + void (*release_pte)(u32 pfn); + void (*release_pmd)(u32 pfn); + void (*release_pud)(u32 pfn); /* Pagetable manipulation functions */ void (*set_pte)(pte_t *ptep, pte_t pteval); @@ -727,10 +726,6 @@ static inline u64 paravirt_read_msr(unsigned msr, int *err) { return PVOP_CALL2(u64, pv_cpu_ops.read_msr, msr, err); } -static inline u64 paravirt_read_msr_amd(unsigned msr, int *err) -{ - return PVOP_CALL2(u64, pv_cpu_ops.read_msr_amd, msr, err); -} static inline int paravirt_write_msr(unsigned msr, unsigned low, unsigned high) { return PVOP_CALL3(int, pv_cpu_ops.write_msr, msr, low, high); @@ -776,13 +771,6 @@ static inline int rdmsrl_safe(unsigned msr, unsigned long long *p) *p = paravirt_read_msr(msr, &err); return err; } -static inline int rdmsrl_amd_safe(unsigned msr, unsigned long long *p) -{ - int err; - - *p = paravirt_read_msr_amd(msr, &err); - return err; -} static inline u64 paravirt_read_tsc(void) { @@ -1005,35 +993,35 @@ static inline void paravirt_pgd_free(struct mm_struct *mm, pgd_t *pgd) PVOP_VCALL2(pv_mmu_ops.pgd_free, mm, pgd); } -static inline void paravirt_alloc_pte(struct mm_struct *mm, unsigned long pfn) +static inline void paravirt_alloc_pte(struct mm_struct *mm, unsigned pfn) { PVOP_VCALL2(pv_mmu_ops.alloc_pte, mm, pfn); } -static inline void paravirt_release_pte(unsigned long pfn) +static inline void paravirt_release_pte(unsigned pfn) { PVOP_VCALL1(pv_mmu_ops.release_pte, pfn); } -static inline void paravirt_alloc_pmd(struct mm_struct *mm, unsigned long pfn) +static inline void paravirt_alloc_pmd(struct mm_struct *mm, unsigned pfn) { PVOP_VCALL2(pv_mmu_ops.alloc_pmd, mm, pfn); } -static inline void paravirt_alloc_pmd_clone(unsigned long pfn, unsigned long clonepfn, - unsigned long start, unsigned long count) +static inline void paravirt_alloc_pmd_clone(unsigned pfn, unsigned clonepfn, + unsigned start, unsigned count) { PVOP_VCALL4(pv_mmu_ops.alloc_pmd_clone, pfn, clonepfn, start, count); } -static inline void paravirt_release_pmd(unsigned long pfn) +static inline void paravirt_release_pmd(unsigned pfn) { PVOP_VCALL1(pv_mmu_ops.release_pmd, pfn); } -static inline void paravirt_alloc_pud(struct mm_struct *mm, unsigned long pfn) +static inline void paravirt_alloc_pud(struct mm_struct *mm, unsigned pfn) { PVOP_VCALL2(pv_mmu_ops.alloc_pud, mm, pfn); } -static inline void paravirt_release_pud(unsigned long pfn) +static inline void paravirt_release_pud(unsigned pfn) { PVOP_VCALL1(pv_mmu_ops.release_pud, pfn); } @@ -1646,4 +1634,4 @@ static inline unsigned long __raw_local_irq_save(void) #endif /* __ASSEMBLY__ */ #endif /* CONFIG_PARAVIRT */ -#endif /* ASM_X86__PARAVIRT_H */ +#endif /* __ASM_PARAVIRT_H */ diff --git a/trunk/include/asm-x86/parport.h b/trunk/include/asm-x86/parport.h index 2e3dda4dc3d9..3c4ffeb467e9 100644 --- a/trunk/include/asm-x86/parport.h +++ b/trunk/include/asm-x86/parport.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__PARPORT_H -#define ASM_X86__PARPORT_H +#ifndef _ASM_X86_PARPORT_H +#define _ASM_X86_PARPORT_H static int __devinit parport_pc_find_isa_ports(int autoirq, int autodma); static int __devinit parport_pc_find_nonpci_ports(int autoirq, int autodma) @@ -7,4 +7,4 @@ static int __devinit parport_pc_find_nonpci_ports(int autoirq, int autodma) return parport_pc_find_isa_ports(autoirq, autodma); } -#endif /* ASM_X86__PARPORT_H */ +#endif /* _ASM_X86_PARPORT_H */ diff --git a/trunk/include/asm-x86/pat.h b/trunk/include/asm-x86/pat.h index 482c3e3f9879..7edc47307217 100644 --- a/trunk/include/asm-x86/pat.h +++ b/trunk/include/asm-x86/pat.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__PAT_H -#define ASM_X86__PAT_H +#ifndef _ASM_PAT_H +#define _ASM_PAT_H #include @@ -19,4 +19,4 @@ extern int free_memtype(u64 start, u64 end); extern void pat_disable(char *reason); -#endif /* ASM_X86__PAT_H */ +#endif diff --git a/trunk/include/asm-x86/pci-direct.h b/trunk/include/asm-x86/pci-direct.h index da42be07b690..80c775d9fe20 100644 --- a/trunk/include/asm-x86/pci-direct.h +++ b/trunk/include/asm-x86/pci-direct.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__PCI_DIRECT_H -#define ASM_X86__PCI_DIRECT_H +#ifndef ASM_PCI_DIRECT_H +#define ASM_PCI_DIRECT_H 1 #include @@ -18,4 +18,4 @@ extern int early_pci_allowed(void); extern unsigned int pci_early_dump_regs; extern void early_dump_pci_device(u8 bus, u8 slot, u8 func); extern void early_dump_pci_devices(void); -#endif /* ASM_X86__PCI_DIRECT_H */ +#endif diff --git a/trunk/include/asm-x86/pci.h b/trunk/include/asm-x86/pci.h index 602583192991..2db14cf17db8 100644 --- a/trunk/include/asm-x86/pci.h +++ b/trunk/include/asm-x86/pci.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__PCI_H -#define ASM_X86__PCI_H +#ifndef __x86_PCI_H +#define __x86_PCI_H #include /* for struct page */ #include @@ -111,4 +111,4 @@ static inline cpumask_t __pcibus_to_cpumask(struct pci_bus *bus) } #endif -#endif /* ASM_X86__PCI_H */ +#endif diff --git a/trunk/include/asm-x86/pci_32.h b/trunk/include/asm-x86/pci_32.h index 3f2288207c0c..a50d46851285 100644 --- a/trunk/include/asm-x86/pci_32.h +++ b/trunk/include/asm-x86/pci_32.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__PCI_32_H -#define ASM_X86__PCI_32_H +#ifndef __i386_PCI_H +#define __i386_PCI_H #ifdef __KERNEL__ @@ -31,4 +31,4 @@ struct pci_dev; #endif /* __KERNEL__ */ -#endif /* ASM_X86__PCI_32_H */ +#endif /* __i386_PCI_H */ diff --git a/trunk/include/asm-x86/pci_64.h b/trunk/include/asm-x86/pci_64.h index f72e12d5770e..f330234ffa5c 100644 --- a/trunk/include/asm-x86/pci_64.h +++ b/trunk/include/asm-x86/pci_64.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__PCI_64_H -#define ASM_X86__PCI_64_H +#ifndef __x8664_PCI_H +#define __x8664_PCI_H #ifdef __KERNEL__ @@ -63,4 +63,4 @@ extern void pci_iommu_alloc(void); #endif /* __KERNEL__ */ -#endif /* ASM_X86__PCI_64_H */ +#endif /* __x8664_PCI_H */ diff --git a/trunk/include/asm-x86/pda.h b/trunk/include/asm-x86/pda.h index 80860afffbdb..b34e9a7cc80b 100644 --- a/trunk/include/asm-x86/pda.h +++ b/trunk/include/asm-x86/pda.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__PDA_H -#define ASM_X86__PDA_H +#ifndef X86_64_PDA_H +#define X86_64_PDA_H #ifndef __ASSEMBLY__ #include @@ -134,4 +134,4 @@ do { \ #define PDA_STACKOFFSET (5*8) -#endif /* ASM_X86__PDA_H */ +#endif diff --git a/trunk/include/asm-x86/percpu.h b/trunk/include/asm-x86/percpu.h index e10a1d0678cf..f643a3a92da0 100644 --- a/trunk/include/asm-x86/percpu.h +++ b/trunk/include/asm-x86/percpu.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__PERCPU_H -#define ASM_X86__PERCPU_H +#ifndef _ASM_X86_PERCPU_H_ +#define _ASM_X86_PERCPU_H_ #ifdef CONFIG_X86_64 #include @@ -215,4 +215,4 @@ do { \ #endif /* !CONFIG_SMP */ -#endif /* ASM_X86__PERCPU_H */ +#endif /* _ASM_X86_PERCPU_H_ */ diff --git a/trunk/include/asm-x86/pgalloc.h b/trunk/include/asm-x86/pgalloc.h index 3cd23adedae8..d63ea431cb3b 100644 --- a/trunk/include/asm-x86/pgalloc.h +++ b/trunk/include/asm-x86/pgalloc.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__PGALLOC_H -#define ASM_X86__PGALLOC_H +#ifndef _ASM_X86_PGALLOC_H +#define _ASM_X86_PGALLOC_H #include #include /* for struct page */ @@ -111,4 +111,4 @@ extern void __pud_free_tlb(struct mmu_gather *tlb, pud_t *pud); #endif /* PAGETABLE_LEVELS > 3 */ #endif /* PAGETABLE_LEVELS > 2 */ -#endif /* ASM_X86__PGALLOC_H */ +#endif /* _ASM_X86_PGALLOC_H */ diff --git a/trunk/include/asm-x86/pgtable-2level-defs.h b/trunk/include/asm-x86/pgtable-2level-defs.h index 7ec48f4e5347..0f71c9f13da4 100644 --- a/trunk/include/asm-x86/pgtable-2level-defs.h +++ b/trunk/include/asm-x86/pgtable-2level-defs.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__PGTABLE_2LEVEL_DEFS_H -#define ASM_X86__PGTABLE_2LEVEL_DEFS_H +#ifndef _I386_PGTABLE_2LEVEL_DEFS_H +#define _I386_PGTABLE_2LEVEL_DEFS_H #define SHARED_KERNEL_PMD 0 @@ -17,4 +17,4 @@ #define PTRS_PER_PTE 1024 -#endif /* ASM_X86__PGTABLE_2LEVEL_DEFS_H */ +#endif /* _I386_PGTABLE_2LEVEL_DEFS_H */ diff --git a/trunk/include/asm-x86/pgtable-2level.h b/trunk/include/asm-x86/pgtable-2level.h index 81762081dcd8..46bc52c0eae1 100644 --- a/trunk/include/asm-x86/pgtable-2level.h +++ b/trunk/include/asm-x86/pgtable-2level.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__PGTABLE_2LEVEL_H -#define ASM_X86__PGTABLE_2LEVEL_H +#ifndef _I386_PGTABLE_2LEVEL_H +#define _I386_PGTABLE_2LEVEL_H #define pte_ERROR(e) \ printk("%s:%d: bad pte %08lx.\n", __FILE__, __LINE__, (e).pte_low) @@ -53,7 +53,9 @@ static inline pte_t native_ptep_get_and_clear(pte_t *xp) #define native_ptep_get_and_clear(xp) native_local_ptep_get_and_clear(xp) #endif +#define pte_page(x) pfn_to_page(pte_pfn(x)) #define pte_none(x) (!(x).pte_low) +#define pte_pfn(x) (pte_val(x) >> PAGE_SHIFT) /* * Bits 0, 6 and 7 are taken, split up the 29 bits of offset @@ -76,4 +78,4 @@ static inline pte_t native_ptep_get_and_clear(pte_t *xp) #define __pte_to_swp_entry(pte) ((swp_entry_t) { (pte).pte_low }) #define __swp_entry_to_pte(x) ((pte_t) { .pte = (x).val }) -#endif /* ASM_X86__PGTABLE_2LEVEL_H */ +#endif /* _I386_PGTABLE_2LEVEL_H */ diff --git a/trunk/include/asm-x86/pgtable-3level-defs.h b/trunk/include/asm-x86/pgtable-3level-defs.h index c05fe6ff3720..448ac9516314 100644 --- a/trunk/include/asm-x86/pgtable-3level-defs.h +++ b/trunk/include/asm-x86/pgtable-3level-defs.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__PGTABLE_3LEVEL_DEFS_H -#define ASM_X86__PGTABLE_3LEVEL_DEFS_H +#ifndef _I386_PGTABLE_3LEVEL_DEFS_H +#define _I386_PGTABLE_3LEVEL_DEFS_H #ifdef CONFIG_PARAVIRT #define SHARED_KERNEL_PMD (pv_info.shared_kernel_pmd) @@ -25,4 +25,4 @@ */ #define PTRS_PER_PTE 512 -#endif /* ASM_X86__PGTABLE_3LEVEL_DEFS_H */ +#endif /* _I386_PGTABLE_3LEVEL_DEFS_H */ diff --git a/trunk/include/asm-x86/pgtable-3level.h b/trunk/include/asm-x86/pgtable-3level.h index 75f4276b5ddb..105057f34032 100644 --- a/trunk/include/asm-x86/pgtable-3level.h +++ b/trunk/include/asm-x86/pgtable-3level.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__PGTABLE_3LEVEL_H -#define ASM_X86__PGTABLE_3LEVEL_H +#ifndef _I386_PGTABLE_3LEVEL_H +#define _I386_PGTABLE_3LEVEL_H /* * Intel Physical Address Extension (PAE) Mode - three-level page @@ -151,11 +151,18 @@ static inline int pte_same(pte_t a, pte_t b) return a.pte_low == b.pte_low && a.pte_high == b.pte_high; } +#define pte_page(x) pfn_to_page(pte_pfn(x)) + static inline int pte_none(pte_t pte) { return !pte.pte_low && !pte.pte_high; } +static inline unsigned long pte_pfn(pte_t pte) +{ + return (pte_val(pte) & PTE_PFN_MASK) >> PAGE_SHIFT; +} + /* * Bits 0, 6 and 7 are taken in the low part of the pte, * put the 32 bits of offset into the high part. @@ -172,4 +179,4 @@ static inline int pte_none(pte_t pte) #define __pte_to_swp_entry(pte) ((swp_entry_t){ (pte).pte_high }) #define __swp_entry_to_pte(x) ((pte_t){ { .pte_high = (x).val } }) -#endif /* ASM_X86__PGTABLE_3LEVEL_H */ +#endif /* _I386_PGTABLE_3LEVEL_H */ diff --git a/trunk/include/asm-x86/pgtable.h b/trunk/include/asm-x86/pgtable.h index 888add7b0882..04caa2f544df 100644 --- a/trunk/include/asm-x86/pgtable.h +++ b/trunk/include/asm-x86/pgtable.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__PGTABLE_H -#define ASM_X86__PGTABLE_H +#ifndef _ASM_X86_PGTABLE_H +#define _ASM_X86_PGTABLE_H #define FIRST_USER_ADDRESS 0 @@ -186,13 +186,6 @@ static inline int pte_special(pte_t pte) return pte_val(pte) & _PAGE_SPECIAL; } -static inline unsigned long pte_pfn(pte_t pte) -{ - return (pte_val(pte) & PTE_PFN_MASK) >> PAGE_SHIFT; -} - -#define pte_page(pte) pfn_to_page(pte_pfn(pte)) - static inline int pmd_large(pmd_t pte) { return (pmd_val(pte) & (_PAGE_PSE | _PAGE_PRESENT)) == @@ -320,8 +313,6 @@ static inline void native_pagetable_setup_start(pgd_t *base) {} static inline void native_pagetable_setup_done(pgd_t *base) {} #endif -extern int arch_report_meminfo(char *page); - #ifdef CONFIG_PARAVIRT #include #else /* !CONFIG_PARAVIRT */ @@ -530,4 +521,4 @@ static inline void clone_pgd_range(pgd_t *dst, pgd_t *src, int count) #include #endif /* __ASSEMBLY__ */ -#endif /* ASM_X86__PGTABLE_H */ +#endif /* _ASM_X86_PGTABLE_H */ diff --git a/trunk/include/asm-x86/pgtable_32.h b/trunk/include/asm-x86/pgtable_32.h index 8de702dc7d62..5c3b26567a95 100644 --- a/trunk/include/asm-x86/pgtable_32.h +++ b/trunk/include/asm-x86/pgtable_32.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__PGTABLE_32_H -#define ASM_X86__PGTABLE_32_H +#ifndef _I386_PGTABLE_H +#define _I386_PGTABLE_H /* @@ -31,7 +31,6 @@ static inline void pgtable_cache_init(void) { } static inline void check_pgt_cache(void) { } void paging_init(void); -extern void set_pmd_pfn(unsigned long, unsigned long, pgprot_t); /* * The Linux x86 paging architecture is 'compile-time dual-mode', it @@ -57,7 +56,8 @@ extern void set_pmd_pfn(unsigned long, unsigned long, pgprot_t); * area for the same reason. ;) */ #define VMALLOC_OFFSET (8 * 1024 * 1024) -#define VMALLOC_START ((unsigned long)high_memory + VMALLOC_OFFSET) +#define VMALLOC_START (((unsigned long)high_memory + 2 * VMALLOC_OFFSET - 1) \ + & ~(VMALLOC_OFFSET - 1)) #ifdef CONFIG_X86_PAE #define LAST_PKMAP 512 #else @@ -73,8 +73,6 @@ extern void set_pmd_pfn(unsigned long, unsigned long, pgprot_t); # define VMALLOC_END (FIXADDR_START - 2 * PAGE_SIZE) #endif -#define MAXMEM (VMALLOC_END - PAGE_OFFSET - __VMALLOC_RESERVE) - /* * Define this if things work differently on an i386 and an i486: * it will (on an i486) warn about kernel memory accesses that are @@ -188,4 +186,4 @@ do { \ #define io_remap_pfn_range(vma, vaddr, pfn, size, prot) \ remap_pfn_range(vma, vaddr, pfn, size, prot) -#endif /* ASM_X86__PGTABLE_32_H */ +#endif /* _I386_PGTABLE_H */ diff --git a/trunk/include/asm-x86/pgtable_64.h b/trunk/include/asm-x86/pgtable_64.h index fde9770e53d1..549144d03d99 100644 --- a/trunk/include/asm-x86/pgtable_64.h +++ b/trunk/include/asm-x86/pgtable_64.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__PGTABLE_64_H -#define ASM_X86__PGTABLE_64_H +#ifndef _X86_64_PGTABLE_H +#define _X86_64_PGTABLE_H #include #ifndef __ASSEMBLY__ @@ -175,6 +175,8 @@ static inline int pmd_bad(pmd_t pmd) #define pte_present(x) (pte_val((x)) & (_PAGE_PRESENT | _PAGE_PROTNONE)) #define pages_to_mb(x) ((x) >> (20 - PAGE_SHIFT)) /* FIXME: is this right? */ +#define pte_page(x) pfn_to_page(pte_pfn((x))) +#define pte_pfn(x) ((pte_val((x)) & __PHYSICAL_MASK) >> PAGE_SHIFT) /* * Macro to mark a page protection value as "uncacheable". @@ -282,4 +284,4 @@ extern void cleanup_highmap(void); #define __HAVE_ARCH_PTE_SAME #endif /* !__ASSEMBLY__ */ -#endif /* ASM_X86__PGTABLE_64_H */ +#endif /* _X86_64_PGTABLE_H */ diff --git a/trunk/include/asm-x86/posix_types_32.h b/trunk/include/asm-x86/posix_types_32.h index 70cf2bb05939..b031efda37ec 100644 --- a/trunk/include/asm-x86/posix_types_32.h +++ b/trunk/include/asm-x86/posix_types_32.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__POSIX_TYPES_32_H -#define ASM_X86__POSIX_TYPES_32_H +#ifndef __ARCH_I386_POSIX_TYPES_H +#define __ARCH_I386_POSIX_TYPES_H /* * This file is generally used by user-level software, so you need to @@ -82,4 +82,4 @@ do { \ #endif /* defined(__KERNEL__) */ -#endif /* ASM_X86__POSIX_TYPES_32_H */ +#endif diff --git a/trunk/include/asm-x86/posix_types_64.h b/trunk/include/asm-x86/posix_types_64.h index 388b4e7f4a44..d6624c95854a 100644 --- a/trunk/include/asm-x86/posix_types_64.h +++ b/trunk/include/asm-x86/posix_types_64.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__POSIX_TYPES_64_H -#define ASM_X86__POSIX_TYPES_64_H +#ifndef _ASM_X86_64_POSIX_TYPES_H +#define _ASM_X86_64_POSIX_TYPES_H /* * This file is generally used by user-level software, so you need to @@ -116,4 +116,4 @@ static inline void __FD_ZERO(__kernel_fd_set *p) #endif /* defined(__KERNEL__) */ -#endif /* ASM_X86__POSIX_TYPES_64_H */ +#endif diff --git a/trunk/include/asm-x86/prctl.h b/trunk/include/asm-x86/prctl.h index e7ae34eb4103..52952adef1ca 100644 --- a/trunk/include/asm-x86/prctl.h +++ b/trunk/include/asm-x86/prctl.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__PRCTL_H -#define ASM_X86__PRCTL_H +#ifndef X86_64_PRCTL_H +#define X86_64_PRCTL_H 1 #define ARCH_SET_GS 0x1001 #define ARCH_SET_FS 0x1002 @@ -7,4 +7,4 @@ #define ARCH_GET_GS 0x1004 -#endif /* ASM_X86__PRCTL_H */ +#endif diff --git a/trunk/include/asm-x86/processor-flags.h b/trunk/include/asm-x86/processor-flags.h index 5dd79774f693..eff2ecd7fff0 100644 --- a/trunk/include/asm-x86/processor-flags.h +++ b/trunk/include/asm-x86/processor-flags.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__PROCESSOR_FLAGS_H -#define ASM_X86__PROCESSOR_FLAGS_H +#ifndef __ASM_I386_PROCESSOR_FLAGS_H +#define __ASM_I386_PROCESSOR_FLAGS_H /* Various flags defined: can be included from assembler. */ /* @@ -96,4 +96,4 @@ #endif #endif -#endif /* ASM_X86__PROCESSOR_FLAGS_H */ +#endif /* __ASM_I386_PROCESSOR_FLAGS_H */ diff --git a/trunk/include/asm-x86/processor.h b/trunk/include/asm-x86/processor.h index 5eaf9bf0a623..4df3e2f6fb56 100644 --- a/trunk/include/asm-x86/processor.h +++ b/trunk/include/asm-x86/processor.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__PROCESSOR_H -#define ASM_X86__PROCESSOR_H +#ifndef __ASM_X86_PROCESSOR_H +#define __ASM_X86_PROCESSOR_H #include @@ -20,7 +20,6 @@ struct mm_struct; #include #include #include -#include #include #include @@ -141,8 +140,6 @@ DECLARE_PER_CPU(struct cpuinfo_x86, cpu_info); #define current_cpu_data boot_cpu_data #endif -extern const struct seq_operations cpuinfo_op; - static inline int hlt_works(int cpu) { #ifdef CONFIG_X86_32 @@ -156,8 +153,6 @@ static inline int hlt_works(int cpu) extern void cpu_detect(struct cpuinfo_x86 *c); -extern struct pt_regs *idle_regs(struct pt_regs *); - extern void early_cpu_init(void); extern void identify_boot_cpu(void); extern void identify_secondary_cpu(struct cpuinfo_x86 *); @@ -416,14 +411,9 @@ struct thread_struct { unsigned io_bitmap_max; /* MSR_IA32_DEBUGCTLMSR value to switch in if TIF_DEBUGCTLMSR is set. */ unsigned long debugctlmsr; -#ifdef CONFIG_X86_DS -/* Debug Store context; see include/asm-x86/ds.h; goes into MSR_IA32_DS_AREA */ - struct ds_context *ds_ctx; -#endif /* CONFIG_X86_DS */ -#ifdef CONFIG_X86_PTRACE_BTS -/* the signal to send on a bts buffer overflow */ - unsigned int bts_ovfl_signal; -#endif /* CONFIG_X86_PTRACE_BTS */ +/* Debug Store - if not 0 points to a DS Save Area configuration; + * goes into MSR_IA32_DS_AREA */ + unsigned long ds_area_msr; }; static inline unsigned long native_get_debugreg(int regno) @@ -953,4 +943,4 @@ extern void start_thread(struct pt_regs *regs, unsigned long new_ip, extern int get_tsc_mode(unsigned long adr); extern int set_tsc_mode(unsigned int val); -#endif /* ASM_X86__PROCESSOR_H */ +#endif diff --git a/trunk/include/asm-x86/proto.h b/trunk/include/asm-x86/proto.h index 6e89e8b4de0e..3dd458c385c0 100644 --- a/trunk/include/asm-x86/proto.h +++ b/trunk/include/asm-x86/proto.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__PROTO_H -#define ASM_X86__PROTO_H +#ifndef _ASM_X8664_PROTO_H +#define _ASM_X8664_PROTO_H 1 #include @@ -29,4 +29,4 @@ long do_arch_prctl(struct task_struct *task, int code, unsigned long addr); #define round_up(x, y) (((x) + (y) - 1) & ~((y) - 1)) #define round_down(x, y) ((x) & ~((y) - 1)) -#endif /* ASM_X86__PROTO_H */ +#endif diff --git a/trunk/include/asm-x86/ptrace-abi.h b/trunk/include/asm-x86/ptrace-abi.h index 4298b8882a78..72e7b9db29bb 100644 --- a/trunk/include/asm-x86/ptrace-abi.h +++ b/trunk/include/asm-x86/ptrace-abi.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__PTRACE_ABI_H -#define ASM_X86__PTRACE_ABI_H +#ifndef _ASM_X86_PTRACE_ABI_H +#define _ASM_X86_PTRACE_ABI_H #ifdef __i386__ @@ -80,9 +80,8 @@ #define PTRACE_SINGLEBLOCK 33 /* resume execution until next branch */ -#ifdef CONFIG_X86_PTRACE_BTS - #ifndef __ASSEMBLY__ + #include /* configuration/status structure used in PTRACE_BTS_CONFIG and @@ -98,20 +97,20 @@ struct ptrace_bts_config { /* actual size of bts_struct in bytes */ __u32 bts_size; }; -#endif /* __ASSEMBLY__ */ +#endif #define PTRACE_BTS_O_TRACE 0x1 /* branch trace */ #define PTRACE_BTS_O_SCHED 0x2 /* scheduling events w/ jiffies */ #define PTRACE_BTS_O_SIGNAL 0x4 /* send SIG on buffer overflow instead of wrapping around */ -#define PTRACE_BTS_O_ALLOC 0x8 /* (re)allocate buffer */ +#define PTRACE_BTS_O_CUT_SIZE 0x8 /* cut requested size to max available + instead of failing */ #define PTRACE_BTS_CONFIG 40 /* Configure branch trace recording. ADDR points to a struct ptrace_bts_config. DATA gives the size of that buffer. - A new buffer is allocated, if requested in the flags. - An overflow signal may only be requested for new buffers. + A new buffer is allocated, iff the size changes. Returns the number of bytes read. */ #define PTRACE_BTS_STATUS 41 @@ -120,7 +119,7 @@ struct ptrace_bts_config { Returns the number of bytes written. */ #define PTRACE_BTS_SIZE 42 -/* Return the number of available BTS records for draining. +/* Return the number of available BTS records. DATA and ADDR are ignored. */ #define PTRACE_BTS_GET 43 @@ -140,6 +139,5 @@ struct ptrace_bts_config { BTS records are read from oldest to newest. Returns number of BTS records drained. */ -#endif /* CONFIG_X86_PTRACE_BTS */ -#endif /* ASM_X86__PTRACE_ABI_H */ +#endif diff --git a/trunk/include/asm-x86/ptrace.h b/trunk/include/asm-x86/ptrace.h index d64a61097165..8a71db803da6 100644 --- a/trunk/include/asm-x86/ptrace.h +++ b/trunk/include/asm-x86/ptrace.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__PTRACE_H -#define ASM_X86__PTRACE_H +#ifndef _ASM_X86_PTRACE_H +#define _ASM_X86_PTRACE_H #include /* For __user */ #include @@ -127,48 +127,14 @@ struct pt_regs { #endif /* __KERNEL__ */ #endif /* !__i386__ */ - -#ifdef CONFIG_X86_PTRACE_BTS -/* a branch trace record entry - * - * In order to unify the interface between various processor versions, - * we use the below data structure for all processors. - */ -enum bts_qualifier { - BTS_INVALID = 0, - BTS_BRANCH, - BTS_TASK_ARRIVES, - BTS_TASK_DEPARTS -}; - -struct bts_struct { - __u64 qualifier; - union { - /* BTS_BRANCH */ - struct { - __u64 from_ip; - __u64 to_ip; - } lbr; - /* BTS_TASK_ARRIVES or - BTS_TASK_DEPARTS */ - __u64 jiffies; - } variant; -}; -#endif /* CONFIG_X86_PTRACE_BTS */ - #ifdef __KERNEL__ -#include +/* the DS BTS struct is used for ptrace as well */ +#include -struct cpuinfo_x86; struct task_struct; -#ifdef CONFIG_X86_PTRACE_BTS -extern void __cpuinit ptrace_bts_init_intel(struct cpuinfo_x86 *); extern void ptrace_bts_take_timestamp(struct task_struct *, enum bts_qualifier); -#else -#define ptrace_bts_init_intel(config) do {} while (0) -#endif /* CONFIG_X86_PTRACE_BTS */ extern unsigned long profile_pc(struct pt_regs *regs); @@ -182,9 +148,6 @@ extern void send_sigtrap(struct task_struct *tsk, struct pt_regs *regs, void signal_fault(struct pt_regs *regs, void __user *frame, char *where); #endif -extern long syscall_trace_enter(struct pt_regs *); -extern void syscall_trace_leave(struct pt_regs *); - static inline unsigned long regs_return_value(struct pt_regs *regs) { return regs->ax; @@ -250,11 +213,6 @@ static inline unsigned long frame_pointer(struct pt_regs *regs) return regs->bp; } -static inline unsigned long user_stack_pointer(struct pt_regs *regs) -{ - return regs->sp; -} - /* * These are defined as per linux/ptrace.h, which see. */ @@ -281,4 +239,4 @@ extern int do_set_thread_area(struct task_struct *p, int idx, #endif /* !__ASSEMBLY__ */ -#endif /* ASM_X86__PTRACE_H */ +#endif diff --git a/trunk/include/asm-x86/pvclock-abi.h b/trunk/include/asm-x86/pvclock-abi.h index edb3b4ecfc81..6857f840b243 100644 --- a/trunk/include/asm-x86/pvclock-abi.h +++ b/trunk/include/asm-x86/pvclock-abi.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__PVCLOCK_ABI_H -#define ASM_X86__PVCLOCK_ABI_H +#ifndef _ASM_X86_PVCLOCK_ABI_H_ +#define _ASM_X86_PVCLOCK_ABI_H_ #ifndef __ASSEMBLY__ /* @@ -39,4 +39,4 @@ struct pvclock_wall_clock { } __attribute__((__packed__)); #endif /* __ASSEMBLY__ */ -#endif /* ASM_X86__PVCLOCK_ABI_H */ +#endif /* _ASM_X86_PVCLOCK_ABI_H_ */ diff --git a/trunk/include/asm-x86/pvclock.h b/trunk/include/asm-x86/pvclock.h index 1a38f6834800..85b1bba8e0a3 100644 --- a/trunk/include/asm-x86/pvclock.h +++ b/trunk/include/asm-x86/pvclock.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__PVCLOCK_H -#define ASM_X86__PVCLOCK_H +#ifndef _ASM_X86_PVCLOCK_H_ +#define _ASM_X86_PVCLOCK_H_ #include #include @@ -10,4 +10,4 @@ void pvclock_read_wallclock(struct pvclock_wall_clock *wall, struct pvclock_vcpu_time_info *vcpu, struct timespec *ts); -#endif /* ASM_X86__PVCLOCK_H */ +#endif /* _ASM_X86_PVCLOCK_H_ */ diff --git a/trunk/include/asm-x86/reboot.h b/trunk/include/asm-x86/reboot.h index 1c2f0ce9e31e..206f355786dc 100644 --- a/trunk/include/asm-x86/reboot.h +++ b/trunk/include/asm-x86/reboot.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__REBOOT_H -#define ASM_X86__REBOOT_H +#ifndef _ASM_REBOOT_H +#define _ASM_REBOOT_H struct pt_regs; @@ -18,4 +18,4 @@ void native_machine_crash_shutdown(struct pt_regs *regs); void native_machine_shutdown(void); void machine_real_restart(const unsigned char *code, int length); -#endif /* ASM_X86__REBOOT_H */ +#endif /* _ASM_REBOOT_H */ diff --git a/trunk/include/asm-x86/reboot_fixups.h b/trunk/include/asm-x86/reboot_fixups.h index 2c2987d97570..0cb7d87c2b68 100644 --- a/trunk/include/asm-x86/reboot_fixups.h +++ b/trunk/include/asm-x86/reboot_fixups.h @@ -1,6 +1,6 @@ -#ifndef ASM_X86__REBOOT_FIXUPS_H -#define ASM_X86__REBOOT_FIXUPS_H +#ifndef _LINUX_REBOOT_FIXUPS_H +#define _LINUX_REBOOT_FIXUPS_H extern void mach_reboot_fixups(void); -#endif /* ASM_X86__REBOOT_FIXUPS_H */ +#endif /* _LINUX_REBOOT_FIXUPS_H */ diff --git a/trunk/include/asm-x86/required-features.h b/trunk/include/asm-x86/required-features.h index a01c4e376331..5c2ff4bc2980 100644 --- a/trunk/include/asm-x86/required-features.h +++ b/trunk/include/asm-x86/required-features.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__REQUIRED_FEATURES_H -#define ASM_X86__REQUIRED_FEATURES_H +#ifndef _ASM_REQUIRED_FEATURES_H +#define _ASM_REQUIRED_FEATURES_H 1 /* Define minimum CPUID feature set for kernel These bits are checked really early to actually display a visible error message before the @@ -79,4 +79,4 @@ #define REQUIRED_MASK6 0 #define REQUIRED_MASK7 0 -#endif /* ASM_X86__REQUIRED_FEATURES_H */ +#endif diff --git a/trunk/include/asm-x86/resume-trace.h b/trunk/include/asm-x86/resume-trace.h index e39376d7de50..8d9f0b41ee86 100644 --- a/trunk/include/asm-x86/resume-trace.h +++ b/trunk/include/asm-x86/resume-trace.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__RESUME_TRACE_H -#define ASM_X86__RESUME_TRACE_H +#ifndef _ASM_X86_RESUME_TRACE_H +#define _ASM_X86_RESUME_TRACE_H #include @@ -7,7 +7,7 @@ do { \ if (pm_trace_enabled) { \ const void *tracedata; \ - asm volatile(_ASM_MOV " $1f,%0\n" \ + asm volatile(_ASM_MOV_UL " $1f,%0\n" \ ".section .tracedata,\"a\"\n" \ "1:\t.word %c1\n\t" \ _ASM_PTR " %c2\n" \ @@ -18,4 +18,4 @@ do { \ } \ } while (0) -#endif /* ASM_X86__RESUME_TRACE_H */ +#endif diff --git a/trunk/include/asm-x86/rio.h b/trunk/include/asm-x86/rio.h index 5e1256bdee83..c9448bd8968f 100644 --- a/trunk/include/asm-x86/rio.h +++ b/trunk/include/asm-x86/rio.h @@ -5,8 +5,8 @@ * Author: Laurent Vivier */ -#ifndef ASM_X86__RIO_H -#define ASM_X86__RIO_H +#ifndef __ASM_RIO_H +#define __ASM_RIO_H #define RIO_TABLE_VERSION 3 @@ -60,4 +60,4 @@ enum { ALT_CALGARY = 5, /* Second Planar Calgary */ }; -#endif /* ASM_X86__RIO_H */ +#endif /* __ASM_RIO_H */ diff --git a/trunk/include/asm-x86/rwlock.h b/trunk/include/asm-x86/rwlock.h index 48a3109e1a7d..6a8c0d645108 100644 --- a/trunk/include/asm-x86/rwlock.h +++ b/trunk/include/asm-x86/rwlock.h @@ -1,8 +1,8 @@ -#ifndef ASM_X86__RWLOCK_H -#define ASM_X86__RWLOCK_H +#ifndef _ASM_X86_RWLOCK_H +#define _ASM_X86_RWLOCK_H #define RW_LOCK_BIAS 0x01000000 /* Actual code is in asm/spinlock.h or in arch/x86/lib/rwlock.S */ -#endif /* ASM_X86__RWLOCK_H */ +#endif /* _ASM_X86_RWLOCK_H */ diff --git a/trunk/include/asm-x86/rwsem.h b/trunk/include/asm-x86/rwsem.h index 3ff3015b71a8..750f2a3542b3 100644 --- a/trunk/include/asm-x86/rwsem.h +++ b/trunk/include/asm-x86/rwsem.h @@ -29,8 +29,8 @@ * front, then they'll all be woken up, but no other readers will be. */ -#ifndef ASM_X86__RWSEM_H -#define ASM_X86__RWSEM_H +#ifndef _I386_RWSEM_H +#define _I386_RWSEM_H #ifndef _LINUX_RWSEM_H #error "please don't include asm/rwsem.h directly, use linux/rwsem.h instead" @@ -262,4 +262,4 @@ static inline int rwsem_is_locked(struct rw_semaphore *sem) } #endif /* __KERNEL__ */ -#endif /* ASM_X86__RWSEM_H */ +#endif /* _I386_RWSEM_H */ diff --git a/trunk/include/asm-x86/scatterlist.h b/trunk/include/asm-x86/scatterlist.h index ee48f880005d..c0432061f81a 100644 --- a/trunk/include/asm-x86/scatterlist.h +++ b/trunk/include/asm-x86/scatterlist.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__SCATTERLIST_H -#define ASM_X86__SCATTERLIST_H +#ifndef _ASM_X86_SCATTERLIST_H +#define _ASM_X86_SCATTERLIST_H #include @@ -30,4 +30,4 @@ struct scatterlist { # define sg_dma_len(sg) ((sg)->dma_length) #endif -#endif /* ASM_X86__SCATTERLIST_H */ +#endif diff --git a/trunk/include/asm-x86/seccomp_32.h b/trunk/include/asm-x86/seccomp_32.h index cf9ab2dbcef1..36e71c5f306f 100644 --- a/trunk/include/asm-x86/seccomp_32.h +++ b/trunk/include/asm-x86/seccomp_32.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__SECCOMP_32_H -#define ASM_X86__SECCOMP_32_H +#ifndef _ASM_SECCOMP_H +#define _ASM_SECCOMP_H #include @@ -14,4 +14,4 @@ #define __NR_seccomp_exit __NR_exit #define __NR_seccomp_sigreturn __NR_sigreturn -#endif /* ASM_X86__SECCOMP_32_H */ +#endif /* _ASM_SECCOMP_H */ diff --git a/trunk/include/asm-x86/seccomp_64.h b/trunk/include/asm-x86/seccomp_64.h index 03274cea751f..76cfe69aa63c 100644 --- a/trunk/include/asm-x86/seccomp_64.h +++ b/trunk/include/asm-x86/seccomp_64.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__SECCOMP_64_H -#define ASM_X86__SECCOMP_64_H +#ifndef _ASM_SECCOMP_H +#define _ASM_SECCOMP_H #include @@ -22,4 +22,4 @@ #define __NR_seccomp_exit_32 __NR_ia32_exit #define __NR_seccomp_sigreturn_32 __NR_ia32_sigreturn -#endif /* ASM_X86__SECCOMP_64_H */ +#endif /* _ASM_SECCOMP_H */ diff --git a/trunk/include/asm-x86/segment.h b/trunk/include/asm-x86/segment.h index ea5f0a8686f7..646452ea9ea3 100644 --- a/trunk/include/asm-x86/segment.h +++ b/trunk/include/asm-x86/segment.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__SEGMENT_H -#define ASM_X86__SEGMENT_H +#ifndef _ASM_X86_SEGMENT_H_ +#define _ASM_X86_SEGMENT_H_ /* Constructor for a conventional segment GDT (or LDT) entry */ /* This is a macro so it can be used in initializers */ @@ -212,4 +212,4 @@ extern const char early_idt_handlers[NUM_EXCEPTION_VECTORS][10]; #endif #endif -#endif /* ASM_X86__SEGMENT_H */ +#endif diff --git a/trunk/include/asm-x86/sembuf.h b/trunk/include/asm-x86/sembuf.h index 81f06b7e5a3f..ee50c801f7b7 100644 --- a/trunk/include/asm-x86/sembuf.h +++ b/trunk/include/asm-x86/sembuf.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__SEMBUF_H -#define ASM_X86__SEMBUF_H +#ifndef _ASM_X86_SEMBUF_H +#define _ASM_X86_SEMBUF_H /* * The semid64_ds structure for x86 architecture. @@ -21,4 +21,4 @@ struct semid64_ds { unsigned long __unused4; }; -#endif /* ASM_X86__SEMBUF_H */ +#endif /* _ASM_X86_SEMBUF_H */ diff --git a/trunk/include/asm-x86/serial.h b/trunk/include/asm-x86/serial.h index 303660b671e5..628c801535ea 100644 --- a/trunk/include/asm-x86/serial.h +++ b/trunk/include/asm-x86/serial.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__SERIAL_H -#define ASM_X86__SERIAL_H +#ifndef _ASM_X86_SERIAL_H +#define _ASM_X86_SERIAL_H /* * This assumes you have a 1.8432 MHz clock for your UART. @@ -26,4 +26,4 @@ { 0, BASE_BAUD, 0x3E8, 4, STD_COM_FLAGS }, /* ttyS2 */ \ { 0, BASE_BAUD, 0x2E8, 3, STD_COM4_FLAGS }, /* ttyS3 */ -#endif /* ASM_X86__SERIAL_H */ +#endif /* _ASM_X86_SERIAL_H */ diff --git a/trunk/include/asm-x86/setup.h b/trunk/include/asm-x86/setup.h index 9030cb73c4d7..a07c6f1c01e1 100644 --- a/trunk/include/asm-x86/setup.h +++ b/trunk/include/asm-x86/setup.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__SETUP_H -#define ASM_X86__SETUP_H +#ifndef _ASM_X86_SETUP_H +#define _ASM_X86_SETUP_H #define COMMAND_LINE_SIZE 2048 @@ -41,7 +41,6 @@ struct x86_quirks { }; extern struct x86_quirks *x86_quirks; -extern unsigned long saved_video_mode; #ifndef CONFIG_PARAVIRT #define paravirt_post_allocator_init() do {} while (0) @@ -101,4 +100,4 @@ void __init x86_64_start_reservations(char *real_mode_data); #endif /* __ASSEMBLY__ */ #endif /* __KERNEL__ */ -#endif /* ASM_X86__SETUP_H */ +#endif /* _ASM_X86_SETUP_H */ diff --git a/trunk/include/asm-x86/shmbuf.h b/trunk/include/asm-x86/shmbuf.h index f51aec2298e9..b51413b74971 100644 --- a/trunk/include/asm-x86/shmbuf.h +++ b/trunk/include/asm-x86/shmbuf.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__SHMBUF_H -#define ASM_X86__SHMBUF_H +#ifndef _ASM_X86_SHMBUF_H +#define _ASM_X86_SHMBUF_H /* * The shmid64_ds structure for x86 architecture. @@ -48,4 +48,4 @@ struct shminfo64 { unsigned long __unused4; }; -#endif /* ASM_X86__SHMBUF_H */ +#endif /* _ASM_X86_SHMBUF_H */ diff --git a/trunk/include/asm-x86/shmparam.h b/trunk/include/asm-x86/shmparam.h index a83a1fd96a0e..0880cf0917b9 100644 --- a/trunk/include/asm-x86/shmparam.h +++ b/trunk/include/asm-x86/shmparam.h @@ -1,6 +1,6 @@ -#ifndef ASM_X86__SHMPARAM_H -#define ASM_X86__SHMPARAM_H +#ifndef _ASM_X86_SHMPARAM_H +#define _ASM_X86_SHMPARAM_H #define SHMLBA PAGE_SIZE /* attach addr a multiple of this */ -#endif /* ASM_X86__SHMPARAM_H */ +#endif /* _ASM_X86_SHMPARAM_H */ diff --git a/trunk/include/asm-x86/sigcontext.h b/trunk/include/asm-x86/sigcontext.h index 24879c85b291..2f9c884d2c0f 100644 --- a/trunk/include/asm-x86/sigcontext.h +++ b/trunk/include/asm-x86/sigcontext.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__SIGCONTEXT_H -#define ASM_X86__SIGCONTEXT_H +#ifndef _ASM_X86_SIGCONTEXT_H +#define _ASM_X86_SIGCONTEXT_H #include #include @@ -202,4 +202,4 @@ struct sigcontext { #endif /* !__i386__ */ -#endif /* ASM_X86__SIGCONTEXT_H */ +#endif diff --git a/trunk/include/asm-x86/sigcontext32.h b/trunk/include/asm-x86/sigcontext32.h index 4e2ec732dd01..57a9686fb491 100644 --- a/trunk/include/asm-x86/sigcontext32.h +++ b/trunk/include/asm-x86/sigcontext32.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__SIGCONTEXT32_H -#define ASM_X86__SIGCONTEXT32_H +#ifndef _SIGCONTEXT32_H +#define _SIGCONTEXT32_H 1 /* signal context for 32bit programs. */ @@ -68,4 +68,4 @@ struct sigcontext_ia32 { unsigned int cr2; }; -#endif /* ASM_X86__SIGCONTEXT32_H */ +#endif diff --git a/trunk/include/asm-x86/siginfo.h b/trunk/include/asm-x86/siginfo.h index 808bdfb2958c..a477bea0c2a1 100644 --- a/trunk/include/asm-x86/siginfo.h +++ b/trunk/include/asm-x86/siginfo.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__SIGINFO_H -#define ASM_X86__SIGINFO_H +#ifndef _ASM_X86_SIGINFO_H +#define _ASM_X86_SIGINFO_H #ifdef __x86_64__ # define __ARCH_SI_PREAMBLE_SIZE (4 * sizeof(int)) @@ -7,4 +7,4 @@ #include -#endif /* ASM_X86__SIGINFO_H */ +#endif diff --git a/trunk/include/asm-x86/signal.h b/trunk/include/asm-x86/signal.h index 65acc82d267a..6dac49364e95 100644 --- a/trunk/include/asm-x86/signal.h +++ b/trunk/include/asm-x86/signal.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__SIGNAL_H -#define ASM_X86__SIGNAL_H +#ifndef _ASM_X86_SIGNAL_H +#define _ASM_X86_SIGNAL_H #ifndef __ASSEMBLY__ #include @@ -140,9 +140,6 @@ struct sigaction { struct k_sigaction { struct sigaction sa; }; - -extern void do_notify_resume(struct pt_regs *, void *, __u32); - # else /* __KERNEL__ */ /* Here we must cater to libcs that poke about in kernel headers. */ @@ -259,4 +256,4 @@ struct pt_regs; #endif /* __KERNEL__ */ #endif /* __ASSEMBLY__ */ -#endif /* ASM_X86__SIGNAL_H */ +#endif diff --git a/trunk/include/asm-x86/smp.h b/trunk/include/asm-x86/smp.h index 04f84f4e2c8b..3c877f74f279 100644 --- a/trunk/include/asm-x86/smp.h +++ b/trunk/include/asm-x86/smp.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__SMP_H -#define ASM_X86__SMP_H +#ifndef _ASM_X86_SMP_H_ +#define _ASM_X86_SMP_H_ #ifndef __ASSEMBLY__ #include #include @@ -34,9 +34,6 @@ extern cpumask_t cpu_initialized; DECLARE_PER_CPU(cpumask_t, cpu_sibling_map); DECLARE_PER_CPU(cpumask_t, cpu_core_map); DECLARE_PER_CPU(u16, cpu_llc_id); -#ifdef CONFIG_X86_32 -DECLARE_PER_CPU(int, cpu_number); -#endif DECLARE_EARLY_PER_CPU(u16, x86_cpu_to_apicid); DECLARE_EARLY_PER_CPU(u16, x86_bios_cpu_apicid); @@ -145,6 +142,7 @@ extern unsigned disabled_cpus __cpuinitdata; * from the initial startup. We map APIC_BASE very early in page_setup(), * so this is correct in the x86 case. */ +DECLARE_PER_CPU(int, cpu_number); #define raw_smp_processor_id() (x86_read_percpu(cpu_number)) extern int safe_smp_processor_id(void); @@ -207,4 +205,4 @@ extern void cpu_uninit(void); #endif #endif /* __ASSEMBLY__ */ -#endif /* ASM_X86__SMP_H */ +#endif diff --git a/trunk/include/asm-x86/socket.h b/trunk/include/asm-x86/socket.h index db73274c83c3..80af9c4ccad7 100644 --- a/trunk/include/asm-x86/socket.h +++ b/trunk/include/asm-x86/socket.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__SOCKET_H -#define ASM_X86__SOCKET_H +#ifndef _ASM_SOCKET_H +#define _ASM_SOCKET_H #include @@ -54,4 +54,4 @@ #define SO_MARK 36 -#endif /* ASM_X86__SOCKET_H */ +#endif /* _ASM_SOCKET_H */ diff --git a/trunk/include/asm-x86/sockios.h b/trunk/include/asm-x86/sockios.h index a006704fdc84..49cc72b5d3c9 100644 --- a/trunk/include/asm-x86/sockios.h +++ b/trunk/include/asm-x86/sockios.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__SOCKIOS_H -#define ASM_X86__SOCKIOS_H +#ifndef _ASM_X86_SOCKIOS_H +#define _ASM_X86_SOCKIOS_H /* Socket-level I/O control calls. */ #define FIOSETOWN 0x8901 @@ -10,4 +10,4 @@ #define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */ #define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */ -#endif /* ASM_X86__SOCKIOS_H */ +#endif /* _ASM_X86_SOCKIOS_H */ diff --git a/trunk/include/asm-x86/sparsemem.h b/trunk/include/asm-x86/sparsemem.h index 38f8e6bc3186..9bd48b0a534b 100644 --- a/trunk/include/asm-x86/sparsemem.h +++ b/trunk/include/asm-x86/sparsemem.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__SPARSEMEM_H -#define ASM_X86__SPARSEMEM_H +#ifndef _ASM_X86_SPARSEMEM_H +#define _ASM_X86_SPARSEMEM_H #ifdef CONFIG_SPARSEMEM /* @@ -31,4 +31,4 @@ #endif #endif /* CONFIG_SPARSEMEM */ -#endif /* ASM_X86__SPARSEMEM_H */ +#endif diff --git a/trunk/include/asm-x86/spinlock.h b/trunk/include/asm-x86/spinlock.h index 93adae338ac6..e39c790dbfd2 100644 --- a/trunk/include/asm-x86/spinlock.h +++ b/trunk/include/asm-x86/spinlock.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__SPINLOCK_H -#define ASM_X86__SPINLOCK_H +#ifndef _X86_SPINLOCK_H_ +#define _X86_SPINLOCK_H_ #include #include @@ -97,7 +97,7 @@ static __always_inline int __ticket_spin_trylock(raw_spinlock_t *lock) "jne 1f\n\t" "movw %w0,%w1\n\t" "incb %h1\n\t" - LOCK_PREFIX "cmpxchgw %w1,%2\n\t" + "lock ; cmpxchgw %w1,%2\n\t" "1:" "sete %b1\n\t" "movzbl %b1,%0\n\t" @@ -135,7 +135,7 @@ static __always_inline void __ticket_spin_lock(raw_spinlock_t *lock) int inc = 0x00010000; int tmp; - asm volatile(LOCK_PREFIX "xaddl %0, %1\n" + asm volatile("lock ; xaddl %0, %1\n" "movzwl %w0, %2\n\t" "shrl $16, %0\n\t" "1:\t" @@ -162,7 +162,7 @@ static __always_inline int __ticket_spin_trylock(raw_spinlock_t *lock) "cmpl %0,%1\n\t" "jne 1f\n\t" "addl $0x00010000, %1\n\t" - LOCK_PREFIX "cmpxchgl %1,%2\n\t" + "lock ; cmpxchgl %1,%2\n\t" "1:" "sete %b1\n\t" "movzbl %b1,%0\n\t" @@ -366,4 +366,4 @@ static inline void __raw_write_unlock(raw_rwlock_t *rw) #define _raw_read_relax(lock) cpu_relax() #define _raw_write_relax(lock) cpu_relax() -#endif /* ASM_X86__SPINLOCK_H */ +#endif diff --git a/trunk/include/asm-x86/spinlock_types.h b/trunk/include/asm-x86/spinlock_types.h index 6aa9b562c508..06c071c9eee9 100644 --- a/trunk/include/asm-x86/spinlock_types.h +++ b/trunk/include/asm-x86/spinlock_types.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__SPINLOCK_TYPES_H -#define ASM_X86__SPINLOCK_TYPES_H +#ifndef __ASM_SPINLOCK_TYPES_H +#define __ASM_SPINLOCK_TYPES_H #ifndef __LINUX_SPINLOCK_TYPES_H # error "please don't include this file directly" @@ -17,4 +17,4 @@ typedef struct { #define __RAW_RW_LOCK_UNLOCKED { RW_LOCK_BIAS } -#endif /* ASM_X86__SPINLOCK_TYPES_H */ +#endif diff --git a/trunk/include/asm-x86/srat.h b/trunk/include/asm-x86/srat.h index 5363e4f7e1cd..774c919dc232 100644 --- a/trunk/include/asm-x86/srat.h +++ b/trunk/include/asm-x86/srat.h @@ -24,8 +24,8 @@ * Send feedback to Pat Gaughen */ -#ifndef ASM_X86__SRAT_H -#define ASM_X86__SRAT_H +#ifndef _ASM_SRAT_H_ +#define _ASM_SRAT_H_ #ifdef CONFIG_ACPI_NUMA extern int get_memcfg_from_srat(void); @@ -36,4 +36,4 @@ static inline int get_memcfg_from_srat(void) } #endif -#endif /* ASM_X86__SRAT_H */ +#endif /* _ASM_SRAT_H_ */ diff --git a/trunk/include/asm-x86/stacktrace.h b/trunk/include/asm-x86/stacktrace.h index f43517e28532..30f82526a8e2 100644 --- a/trunk/include/asm-x86/stacktrace.h +++ b/trunk/include/asm-x86/stacktrace.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__STACKTRACE_H -#define ASM_X86__STACKTRACE_H +#ifndef _ASM_STACKTRACE_H +#define _ASM_STACKTRACE_H 1 extern int kstack_depth_to_print; @@ -18,4 +18,4 @@ void dump_trace(struct task_struct *tsk, struct pt_regs *regs, unsigned long *stack, unsigned long bp, const struct stacktrace_ops *ops, void *data); -#endif /* ASM_X86__STACKTRACE_H */ +#endif diff --git a/trunk/include/asm-x86/stat.h b/trunk/include/asm-x86/stat.h index 1e120f628905..5c22dcb5d17e 100644 --- a/trunk/include/asm-x86/stat.h +++ b/trunk/include/asm-x86/stat.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__STAT_H -#define ASM_X86__STAT_H +#ifndef _ASM_X86_STAT_H +#define _ASM_X86_STAT_H #define STAT_HAVE_NSEC 1 @@ -111,4 +111,4 @@ struct __old_kernel_stat { #endif }; -#endif /* ASM_X86__STAT_H */ +#endif diff --git a/trunk/include/asm-x86/statfs.h b/trunk/include/asm-x86/statfs.h index 3f005bc3aa5b..7c651aa97252 100644 --- a/trunk/include/asm-x86/statfs.h +++ b/trunk/include/asm-x86/statfs.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__STATFS_H -#define ASM_X86__STATFS_H +#ifndef _ASM_X86_STATFS_H +#define _ASM_X86_STATFS_H #ifdef __i386__ #include @@ -60,4 +60,4 @@ struct compat_statfs64 { } __attribute__((packed)); #endif /* !__i386__ */ -#endif /* ASM_X86__STATFS_H */ +#endif diff --git a/trunk/include/asm-x86/string_32.h b/trunk/include/asm-x86/string_32.h index 487843ed245a..193578cd1fd9 100644 --- a/trunk/include/asm-x86/string_32.h +++ b/trunk/include/asm-x86/string_32.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__STRING_32_H -#define ASM_X86__STRING_32_H +#ifndef _I386_STRING_H_ +#define _I386_STRING_H_ #ifdef __KERNEL__ @@ -323,4 +323,4 @@ extern void *memscan(void *addr, int c, size_t size); #endif /* __KERNEL__ */ -#endif /* ASM_X86__STRING_32_H */ +#endif diff --git a/trunk/include/asm-x86/string_64.h b/trunk/include/asm-x86/string_64.h index a2add11d3b66..52b5ab383395 100644 --- a/trunk/include/asm-x86/string_64.h +++ b/trunk/include/asm-x86/string_64.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__STRING_64_H -#define ASM_X86__STRING_64_H +#ifndef _X86_64_STRING_H_ +#define _X86_64_STRING_H_ #ifdef __KERNEL__ @@ -57,4 +57,4 @@ int strcmp(const char *cs, const char *ct); #endif /* __KERNEL__ */ -#endif /* ASM_X86__STRING_64_H */ +#endif diff --git a/trunk/include/asm-x86/suspend_32.h b/trunk/include/asm-x86/suspend_32.h index acb6d4d491f4..8675c6782a7d 100644 --- a/trunk/include/asm-x86/suspend_32.h +++ b/trunk/include/asm-x86/suspend_32.h @@ -3,8 +3,8 @@ * Based on code * Copyright 2001 Patrick Mochel */ -#ifndef ASM_X86__SUSPEND_32_H -#define ASM_X86__SUSPEND_32_H +#ifndef __ASM_X86_32_SUSPEND_H +#define __ASM_X86_32_SUSPEND_H #include #include @@ -48,4 +48,4 @@ static inline void acpi_save_register_state(unsigned long return_point) extern int acpi_save_state_mem(void); #endif -#endif /* ASM_X86__SUSPEND_32_H */ +#endif /* __ASM_X86_32_SUSPEND_H */ diff --git a/trunk/include/asm-x86/suspend_64.h b/trunk/include/asm-x86/suspend_64.h index cf821dd310e8..dc3262b43072 100644 --- a/trunk/include/asm-x86/suspend_64.h +++ b/trunk/include/asm-x86/suspend_64.h @@ -3,8 +3,8 @@ * Based on code * Copyright 2001 Patrick Mochel */ -#ifndef ASM_X86__SUSPEND_64_H -#define ASM_X86__SUSPEND_64_H +#ifndef __ASM_X86_64_SUSPEND_H +#define __ASM_X86_64_SUSPEND_H #include #include @@ -49,4 +49,4 @@ extern int acpi_save_state_mem(void); extern char core_restore_code; extern char restore_registers; -#endif /* ASM_X86__SUSPEND_64_H */ +#endif /* __ASM_X86_64_SUSPEND_H */ diff --git a/trunk/include/asm-x86/swiotlb.h b/trunk/include/asm-x86/swiotlb.h index 1e20adbcad4b..2730b351afcf 100644 --- a/trunk/include/asm-x86/swiotlb.h +++ b/trunk/include/asm-x86/swiotlb.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__SWIOTLB_H -#define ASM_X86__SWIOTLB_H +#ifndef _ASM_SWIOTLB_H +#define _ASM_SWIOTLB_H 1 #include @@ -55,4 +55,4 @@ static inline void pci_swiotlb_init(void) static inline void dma_mark_clean(void *addr, size_t size) {} -#endif /* ASM_X86__SWIOTLB_H */ +#endif /* _ASM_SWIOTLB_H */ diff --git a/trunk/include/asm-x86/sync_bitops.h b/trunk/include/asm-x86/sync_bitops.h index b689bee71104..b47a1d0b8a83 100644 --- a/trunk/include/asm-x86/sync_bitops.h +++ b/trunk/include/asm-x86/sync_bitops.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__SYNC_BITOPS_H -#define ASM_X86__SYNC_BITOPS_H +#ifndef _I386_SYNC_BITOPS_H +#define _I386_SYNC_BITOPS_H /* * Copyright 1992, Linus Torvalds. @@ -127,4 +127,4 @@ static inline int sync_test_and_change_bit(int nr, volatile unsigned long *addr) #undef ADDR -#endif /* ASM_X86__SYNC_BITOPS_H */ +#endif /* _I386_SYNC_BITOPS_H */ diff --git a/trunk/include/asm-x86/syscall.h b/trunk/include/asm-x86/syscall.h deleted file mode 100644 index 04c47dc5597c..000000000000 --- a/trunk/include/asm-x86/syscall.h +++ /dev/null @@ -1,211 +0,0 @@ -/* - * Access to user system call parameters and results - * - * Copyright (C) 2008 Red Hat, Inc. All rights reserved. - * - * This copyrighted material is made available to anyone wishing to use, - * modify, copy, or redistribute it subject to the terms and conditions - * of the GNU General Public License v.2. - * - * See asm-generic/syscall.h for descriptions of what we must do here. - */ - -#ifndef _ASM_SYSCALL_H -#define _ASM_SYSCALL_H 1 - -#include -#include - -static inline long syscall_get_nr(struct task_struct *task, - struct pt_regs *regs) -{ - /* - * We always sign-extend a -1 value being set here, - * so this is always either -1L or a syscall number. - */ - return regs->orig_ax; -} - -static inline void syscall_rollback(struct task_struct *task, - struct pt_regs *regs) -{ - regs->ax = regs->orig_ax; -} - -static inline long syscall_get_error(struct task_struct *task, - struct pt_regs *regs) -{ - unsigned long error = regs->ax; -#ifdef CONFIG_IA32_EMULATION - /* - * TS_COMPAT is set for 32-bit syscall entries and then - * remains set until we return to user mode. - */ - if (task_thread_info(task)->status & TS_COMPAT) - /* - * Sign-extend the value so (int)-EFOO becomes (long)-EFOO - * and will match correctly in comparisons. - */ - error = (long) (int) error; -#endif - return IS_ERR_VALUE(error) ? error : 0; -} - -static inline long syscall_get_return_value(struct task_struct *task, - struct pt_regs *regs) -{ - return regs->ax; -} - -static inline void syscall_set_return_value(struct task_struct *task, - struct pt_regs *regs, - int error, long val) -{ - regs->ax = (long) error ?: val; -} - -#ifdef CONFIG_X86_32 - -static inline void syscall_get_arguments(struct task_struct *task, - struct pt_regs *regs, - unsigned int i, unsigned int n, - unsigned long *args) -{ - BUG_ON(i + n > 6); - memcpy(args, ®s->bx + i, n * sizeof(args[0])); -} - -static inline void syscall_set_arguments(struct task_struct *task, - struct pt_regs *regs, - unsigned int i, unsigned int n, - const unsigned long *args) -{ - BUG_ON(i + n > 6); - memcpy(®s->bx + i, args, n * sizeof(args[0])); -} - -#else /* CONFIG_X86_64 */ - -static inline void syscall_get_arguments(struct task_struct *task, - struct pt_regs *regs, - unsigned int i, unsigned int n, - unsigned long *args) -{ -# ifdef CONFIG_IA32_EMULATION - if (task_thread_info(task)->status & TS_COMPAT) - switch (i + n) { - case 6: - if (!n--) break; - *args++ = regs->bp; - case 5: - if (!n--) break; - *args++ = regs->di; - case 4: - if (!n--) break; - *args++ = regs->si; - case 3: - if (!n--) break; - *args++ = regs->dx; - case 2: - if (!n--) break; - *args++ = regs->cx; - case 1: - if (!n--) break; - *args++ = regs->bx; - case 0: - if (!n--) break; - default: - BUG(); - break; - } - else -# endif - switch (i + n) { - case 6: - if (!n--) break; - *args++ = regs->r9; - case 5: - if (!n--) break; - *args++ = regs->r8; - case 4: - if (!n--) break; - *args++ = regs->r10; - case 3: - if (!n--) break; - *args++ = regs->dx; - case 2: - if (!n--) break; - *args++ = regs->si; - case 1: - if (!n--) break; - *args++ = regs->di; - case 0: - if (!n--) break; - default: - BUG(); - break; - } -} - -static inline void syscall_set_arguments(struct task_struct *task, - struct pt_regs *regs, - unsigned int i, unsigned int n, - const unsigned long *args) -{ -# ifdef CONFIG_IA32_EMULATION - if (task_thread_info(task)->status & TS_COMPAT) - switch (i + n) { - case 6: - if (!n--) break; - regs->bp = *args++; - case 5: - if (!n--) break; - regs->di = *args++; - case 4: - if (!n--) break; - regs->si = *args++; - case 3: - if (!n--) break; - regs->dx = *args++; - case 2: - if (!n--) break; - regs->cx = *args++; - case 1: - if (!n--) break; - regs->bx = *args++; - case 0: - if (!n--) break; - default: - BUG(); - } - else -# endif - switch (i + n) { - case 6: - if (!n--) break; - regs->r9 = *args++; - case 5: - if (!n--) break; - regs->r8 = *args++; - case 4: - if (!n--) break; - regs->r10 = *args++; - case 3: - if (!n--) break; - regs->dx = *args++; - case 2: - if (!n--) break; - regs->si = *args++; - case 1: - if (!n--) break; - regs->di = *args++; - case 0: - if (!n--) break; - default: - BUG(); - } -} - -#endif /* CONFIG_X86_32 */ - -#endif /* _ASM_SYSCALL_H */ diff --git a/trunk/include/asm-x86/syscalls.h b/trunk/include/asm-x86/syscalls.h deleted file mode 100644 index 87803da44010..000000000000 --- a/trunk/include/asm-x86/syscalls.h +++ /dev/null @@ -1,93 +0,0 @@ -/* - * syscalls.h - Linux syscall interfaces (arch-specific) - * - * Copyright (c) 2008 Jaswinder Singh - * - * This file is released under the GPLv2. - * See the file COPYING for more details. - */ - -#ifndef _ASM_X86_SYSCALLS_H -#define _ASM_X86_SYSCALLS_H - -#include -#include -#include -#include - -/* Common in X86_32 and X86_64 */ -/* kernel/ioport.c */ -asmlinkage long sys_ioperm(unsigned long, unsigned long, int); - -/* X86_32 only */ -#ifdef CONFIG_X86_32 -/* kernel/process_32.c */ -asmlinkage int sys_fork(struct pt_regs); -asmlinkage int sys_clone(struct pt_regs); -asmlinkage int sys_vfork(struct pt_regs); -asmlinkage int sys_execve(struct pt_regs); - -/* kernel/signal_32.c */ -asmlinkage int sys_sigsuspend(int, int, old_sigset_t); -asmlinkage int sys_sigaction(int, const struct old_sigaction __user *, - struct old_sigaction __user *); -asmlinkage int sys_sigaltstack(unsigned long); -asmlinkage unsigned long sys_sigreturn(unsigned long); -asmlinkage int sys_rt_sigreturn(unsigned long); - -/* kernel/ioport.c */ -asmlinkage long sys_iopl(unsigned long); - -/* kernel/ldt.c */ -asmlinkage int sys_modify_ldt(int, void __user *, unsigned long); - -/* kernel/sys_i386_32.c */ -asmlinkage long sys_mmap2(unsigned long, unsigned long, unsigned long, - unsigned long, unsigned long, unsigned long); -struct mmap_arg_struct; -asmlinkage int old_mmap(struct mmap_arg_struct __user *); -struct sel_arg_struct; -asmlinkage int old_select(struct sel_arg_struct __user *); -asmlinkage int sys_ipc(uint, int, int, int, void __user *, long); -struct old_utsname; -asmlinkage int sys_uname(struct old_utsname __user *); -struct oldold_utsname; -asmlinkage int sys_olduname(struct oldold_utsname __user *); - -/* kernel/tls.c */ -asmlinkage int sys_set_thread_area(struct user_desc __user *); -asmlinkage int sys_get_thread_area(struct user_desc __user *); - -/* kernel/vm86_32.c */ -asmlinkage int sys_vm86old(struct pt_regs); -asmlinkage int sys_vm86(struct pt_regs); - -#else /* CONFIG_X86_32 */ - -/* X86_64 only */ -/* kernel/process_64.c */ -asmlinkage long sys_fork(struct pt_regs *); -asmlinkage long sys_clone(unsigned long, unsigned long, - void __user *, void __user *, - struct pt_regs *); -asmlinkage long sys_vfork(struct pt_regs *); -asmlinkage long sys_execve(char __user *, char __user * __user *, - char __user * __user *, - struct pt_regs *); - -/* kernel/ioport.c */ -asmlinkage long sys_iopl(unsigned int, struct pt_regs *); - -/* kernel/signal_64.c */ -asmlinkage long sys_sigaltstack(const stack_t __user *, stack_t __user *, - struct pt_regs *); -asmlinkage long sys_rt_sigreturn(struct pt_regs *); - -/* kernel/sys_x86_64.c */ -asmlinkage long sys_mmap(unsigned long, unsigned long, unsigned long, - unsigned long, unsigned long, unsigned long); -struct new_utsname; -asmlinkage long sys_uname(struct new_utsname __user *); - -#endif /* CONFIG_X86_32 */ -#endif /* _ASM_X86_SYSCALLS_H */ diff --git a/trunk/include/asm-x86/system.h b/trunk/include/asm-x86/system.h index 34505dd7b24d..983ce37c491f 100644 --- a/trunk/include/asm-x86/system.h +++ b/trunk/include/asm-x86/system.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__SYSTEM_H -#define ASM_X86__SYSTEM_H +#ifndef _ASM_X86_SYSTEM_H_ +#define _ASM_X86_SYSTEM_H_ #include #include @@ -419,4 +419,4 @@ static inline void rdtsc_barrier(void) alternative(ASM_NOP3, "lfence", X86_FEATURE_LFENCE_RDTSC); } -#endif /* ASM_X86__SYSTEM_H */ +#endif diff --git a/trunk/include/asm-x86/system_64.h b/trunk/include/asm-x86/system_64.h index 5aedb8bffc5a..97fa251ccb2b 100644 --- a/trunk/include/asm-x86/system_64.h +++ b/trunk/include/asm-x86/system_64.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__SYSTEM_64_H -#define ASM_X86__SYSTEM_64_H +#ifndef __ASM_SYSTEM_H +#define __ASM_SYSTEM_H #include #include @@ -19,4 +19,4 @@ static inline void write_cr8(unsigned long val) #include -#endif /* ASM_X86__SYSTEM_64_H */ +#endif diff --git a/trunk/include/asm-x86/tce.h b/trunk/include/asm-x86/tce.h index e7932d7fbbab..b1a4ea00df78 100644 --- a/trunk/include/asm-x86/tce.h +++ b/trunk/include/asm-x86/tce.h @@ -21,8 +21,8 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef ASM_X86__TCE_H -#define ASM_X86__TCE_H +#ifndef _ASM_X86_64_TCE_H +#define _ASM_X86_64_TCE_H extern unsigned int specified_table_size; struct iommu_table; @@ -45,4 +45,4 @@ extern void * __init alloc_tce_table(void); extern void __init free_tce_table(void *tbl); extern int __init build_tce_table(struct pci_dev *dev, void __iomem *bbar); -#endif /* ASM_X86__TCE_H */ +#endif /* _ASM_X86_64_TCE_H */ diff --git a/trunk/include/asm-x86/termbits.h b/trunk/include/asm-x86/termbits.h index 3d00dc5e0c71..af1b70ea440f 100644 --- a/trunk/include/asm-x86/termbits.h +++ b/trunk/include/asm-x86/termbits.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__TERMBITS_H -#define ASM_X86__TERMBITS_H +#ifndef _ASM_X86_TERMBITS_H +#define _ASM_X86_TERMBITS_H #include @@ -195,4 +195,4 @@ struct ktermios { #define TCSADRAIN 1 #define TCSAFLUSH 2 -#endif /* ASM_X86__TERMBITS_H */ +#endif /* _ASM_X86_TERMBITS_H */ diff --git a/trunk/include/asm-x86/termios.h b/trunk/include/asm-x86/termios.h index e235db248071..f72956331c49 100644 --- a/trunk/include/asm-x86/termios.h +++ b/trunk/include/asm-x86/termios.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__TERMIOS_H -#define ASM_X86__TERMIOS_H +#ifndef _ASM_X86_TERMIOS_H +#define _ASM_X86_TERMIOS_H #include #include @@ -110,4 +110,4 @@ static inline int kernel_termios_to_user_termios_1(struct termios __user *u, #endif /* __KERNEL__ */ -#endif /* ASM_X86__TERMIOS_H */ +#endif /* _ASM_X86_TERMIOS_H */ diff --git a/trunk/include/asm-x86/therm_throt.h b/trunk/include/asm-x86/therm_throt.h index 1c7f57b6b66e..399bf6026b16 100644 --- a/trunk/include/asm-x86/therm_throt.h +++ b/trunk/include/asm-x86/therm_throt.h @@ -1,9 +1,9 @@ -#ifndef ASM_X86__THERM_THROT_H -#define ASM_X86__THERM_THROT_H +#ifndef __ASM_I386_THERM_THROT_H__ +#define __ASM_I386_THERM_THROT_H__ 1 #include extern atomic_t therm_throt_en; int therm_throt_process(int curr); -#endif /* ASM_X86__THERM_THROT_H */ +#endif /* __ASM_I386_THERM_THROT_H__ */ diff --git a/trunk/include/asm-x86/thread_info.h b/trunk/include/asm-x86/thread_info.h index 4db0066a3a35..da0a675adf94 100644 --- a/trunk/include/asm-x86/thread_info.h +++ b/trunk/include/asm-x86/thread_info.h @@ -4,8 +4,8 @@ * - Incorporating suggestions made by Linus Torvalds and Dave Miller */ -#ifndef ASM_X86__THREAD_INFO_H -#define ASM_X86__THREAD_INFO_H +#ifndef _ASM_X86_THREAD_INFO_H +#define _ASM_X86_THREAD_INFO_H #include #include @@ -71,7 +71,6 @@ struct thread_info { * Warning: layout of LSW is hardcoded in entry.S */ #define TIF_SYSCALL_TRACE 0 /* syscall trace active */ -#define TIF_NOTIFY_RESUME 1 /* callback before returning to user */ #define TIF_SIGPENDING 2 /* signal pending */ #define TIF_NEED_RESCHED 3 /* rescheduling necessary */ #define TIF_SINGLESTEP 4 /* reenable singlestep on user return*/ @@ -94,7 +93,6 @@ struct thread_info { #define TIF_BTS_TRACE_TS 27 /* record scheduling event timestamps */ #define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE) -#define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME) #define _TIF_SIGPENDING (1 << TIF_SIGPENDING) #define _TIF_SINGLESTEP (1 << TIF_SINGLESTEP) #define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED) @@ -135,7 +133,7 @@ struct thread_info { /* Only used for 64 bit */ #define _TIF_DO_NOTIFY_MASK \ - (_TIF_SIGPENDING|_TIF_MCE_NOTIFY|_TIF_NOTIFY_RESUME) + (_TIF_SIGPENDING|_TIF_MCE_NOTIFY) /* flags to check in __switch_to() */ #define _TIF_WORK_CTXSW \ @@ -260,4 +258,4 @@ extern void free_thread_info(struct thread_info *ti); extern int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src); #define arch_task_cache_init arch_task_cache_init #endif -#endif /* ASM_X86__THREAD_INFO_H */ +#endif /* _ASM_X86_THREAD_INFO_H */ diff --git a/trunk/include/asm-x86/time.h b/trunk/include/asm-x86/time.h index 3e724eef7ac4..a17fa473e91d 100644 --- a/trunk/include/asm-x86/time.h +++ b/trunk/include/asm-x86/time.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__TIME_H -#define ASM_X86__TIME_H +#ifndef _ASMX86_TIME_H +#define _ASMX86_TIME_H extern void hpet_time_init(void); @@ -46,8 +46,6 @@ static inline int native_set_wallclock(unsigned long nowtime) #endif -extern void time_init(void); - #ifdef CONFIG_PARAVIRT #include #else /* !CONFIG_PARAVIRT */ @@ -60,4 +58,4 @@ extern void time_init(void); extern unsigned long __init calibrate_cpu(void); -#endif /* ASM_X86__TIME_H */ +#endif diff --git a/trunk/include/asm-x86/timer.h b/trunk/include/asm-x86/timer.h index d0babce4b47a..fb2a4ddddf3d 100644 --- a/trunk/include/asm-x86/timer.h +++ b/trunk/include/asm-x86/timer.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__TIMER_H -#define ASM_X86__TIMER_H +#ifndef _ASMi386_TIMER_H +#define _ASMi386_TIMER_H #include #include #include @@ -9,12 +9,9 @@ unsigned long long native_sched_clock(void); unsigned long native_calibrate_tsc(void); -#ifdef CONFIG_X86_32 extern int timer_ack; -extern int recalibrate_cpu_khz(void); -#endif /* CONFIG_X86_32 */ - extern int no_timer_check; +extern int recalibrate_cpu_khz(void); #ifndef CONFIG_PARAVIRT #define calibrate_tsc() native_calibrate_tsc() @@ -63,4 +60,4 @@ static inline unsigned long long cycles_2_ns(unsigned long long cyc) return ns; } -#endif /* ASM_X86__TIMER_H */ +#endif diff --git a/trunk/include/asm-x86/timex.h b/trunk/include/asm-x86/timex.h index d1ce2416a5da..43e5a78500c5 100644 --- a/trunk/include/asm-x86/timex.h +++ b/trunk/include/asm-x86/timex.h @@ -1,6 +1,6 @@ /* x86 architecture timex specifications */ -#ifndef ASM_X86__TIMEX_H -#define ASM_X86__TIMEX_H +#ifndef _ASM_X86_TIMEX_H +#define _ASM_X86_TIMEX_H #include #include @@ -16,4 +16,4 @@ #define ARCH_HAS_READ_CURRENT_TIMER -#endif /* ASM_X86__TIMEX_H */ +#endif diff --git a/trunk/include/asm-x86/tlb.h b/trunk/include/asm-x86/tlb.h index db36e9e89e87..e4e9e2d07a93 100644 --- a/trunk/include/asm-x86/tlb.h +++ b/trunk/include/asm-x86/tlb.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__TLB_H -#define ASM_X86__TLB_H +#ifndef _ASM_X86_TLB_H +#define _ASM_X86_TLB_H #define tlb_start_vma(tlb, vma) do { } while (0) #define tlb_end_vma(tlb, vma) do { } while (0) @@ -8,4 +8,4 @@ #include -#endif /* ASM_X86__TLB_H */ +#endif diff --git a/trunk/include/asm-x86/tlbflush.h b/trunk/include/asm-x86/tlbflush.h index ef68b76dc3c5..35c76ceb9f40 100644 --- a/trunk/include/asm-x86/tlbflush.h +++ b/trunk/include/asm-x86/tlbflush.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__TLBFLUSH_H -#define ASM_X86__TLBFLUSH_H +#ifndef _ASM_X86_TLBFLUSH_H +#define _ASM_X86_TLBFLUSH_H #include #include @@ -165,4 +165,4 @@ static inline void flush_tlb_kernel_range(unsigned long start, flush_tlb_all(); } -#endif /* ASM_X86__TLBFLUSH_H */ +#endif /* _ASM_X86_TLBFLUSH_H */ diff --git a/trunk/include/asm-x86/topology.h b/trunk/include/asm-x86/topology.h index 7eca9bc022b2..90ac7718469a 100644 --- a/trunk/include/asm-x86/topology.h +++ b/trunk/include/asm-x86/topology.h @@ -22,8 +22,8 @@ * * Send feedback to */ -#ifndef ASM_X86__TOPOLOGY_H -#define ASM_X86__TOPOLOGY_H +#ifndef _ASM_X86_TOPOLOGY_H +#define _ASM_X86_TOPOLOGY_H #ifdef CONFIG_X86_32 # ifdef CONFIG_X86_HT @@ -255,4 +255,4 @@ static inline void set_mp_bus_to_node(int busnum, int node) } #endif -#endif /* ASM_X86__TOPOLOGY_H */ +#endif /* _ASM_X86_TOPOLOGY_H */ diff --git a/trunk/include/asm-x86/trampoline.h b/trunk/include/asm-x86/trampoline.h index 0406bbd898a9..b156b08d0131 100644 --- a/trunk/include/asm-x86/trampoline.h +++ b/trunk/include/asm-x86/trampoline.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__TRAMPOLINE_H -#define ASM_X86__TRAMPOLINE_H +#ifndef __TRAMPOLINE_HEADER +#define __TRAMPOLINE_HEADER #ifndef __ASSEMBLY__ @@ -18,4 +18,4 @@ extern unsigned long setup_trampoline(void); #endif /* __ASSEMBLY__ */ -#endif /* ASM_X86__TRAMPOLINE_H */ +#endif /* __TRAMPOLINE_HEADER */ diff --git a/trunk/include/asm-x86/traps.h b/trunk/include/asm-x86/traps.h index 2ccebc6fb0b0..a4b65a71bd66 100644 --- a/trunk/include/asm-x86/traps.h +++ b/trunk/include/asm-x86/traps.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__TRAPS_H -#define ASM_X86__TRAPS_H +#ifndef _ASM_X86_TRAPS_H +#define _ASM_X86_TRAPS_H /* Common in X86_32 and X86_64 */ asmlinkage void divide_error(void); @@ -51,8 +51,6 @@ void do_spurious_interrupt_bug(struct pt_regs *, long); unsigned long patch_espfix_desc(unsigned long, unsigned long); asmlinkage void math_emulate(long); -void do_page_fault(struct pt_regs *regs, unsigned long error_code); - #else /* CONFIG_X86_32 */ asmlinkage void double_fault(void); @@ -64,7 +62,5 @@ asmlinkage void do_coprocessor_error(struct pt_regs *); asmlinkage void do_simd_coprocessor_error(struct pt_regs *); asmlinkage void do_spurious_interrupt_bug(struct pt_regs *); -asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long error_code); - #endif /* CONFIG_X86_32 */ -#endif /* ASM_X86__TRAPS_H */ +#endif /* _ASM_X86_TRAPS_H */ diff --git a/trunk/include/asm-x86/tsc.h b/trunk/include/asm-x86/tsc.h index ad0f5c41e78c..cb6f6ee45b8f 100644 --- a/trunk/include/asm-x86/tsc.h +++ b/trunk/include/asm-x86/tsc.h @@ -1,8 +1,8 @@ /* * x86 TSC related functions */ -#ifndef ASM_X86__TSC_H -#define ASM_X86__TSC_H +#ifndef _ASM_X86_TSC_H +#define _ASM_X86_TSC_H #include @@ -59,4 +59,4 @@ extern void check_tsc_sync_target(void); extern int notsc_setup(char *); -#endif /* ASM_X86__TSC_H */ +#endif diff --git a/trunk/include/asm-x86/types.h b/trunk/include/asm-x86/types.h index e78b52e17444..1ac80cd9acf8 100644 --- a/trunk/include/asm-x86/types.h +++ b/trunk/include/asm-x86/types.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__TYPES_H -#define ASM_X86__TYPES_H +#ifndef _ASM_X86_TYPES_H +#define _ASM_X86_TYPES_H #include @@ -33,4 +33,4 @@ typedef u32 dma_addr_t; #endif /* __ASSEMBLY__ */ #endif /* __KERNEL__ */ -#endif /* ASM_X86__TYPES_H */ +#endif diff --git a/trunk/include/asm-x86/uaccess.h b/trunk/include/asm-x86/uaccess.h index 48ebc0ad40ec..5f702d1d5218 100644 --- a/trunk/include/asm-x86/uaccess.h +++ b/trunk/include/asm-x86/uaccess.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__UACCESS_H -#define ASM_X86__UACCESS_H +#ifndef _ASM_UACCES_H_ +#define _ASM_UACCES_H_ /* * User space memory access functions */ @@ -450,5 +450,5 @@ extern struct movsl_mask { # include "uaccess_64.h" #endif -#endif /* ASM_X86__UACCESS_H */ +#endif diff --git a/trunk/include/asm-x86/uaccess_32.h b/trunk/include/asm-x86/uaccess_32.h index 6b5b57d9c6d1..6fdef39a0bcb 100644 --- a/trunk/include/asm-x86/uaccess_32.h +++ b/trunk/include/asm-x86/uaccess_32.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__UACCESS_32_H -#define ASM_X86__UACCESS_32_H +#ifndef __i386_UACCESS_H +#define __i386_UACCESS_H /* * User space memory access functions @@ -215,4 +215,4 @@ long strnlen_user(const char __user *str, long n); unsigned long __must_check clear_user(void __user *mem, unsigned long len); unsigned long __must_check __clear_user(void __user *mem, unsigned long len); -#endif /* ASM_X86__UACCESS_32_H */ +#endif /* __i386_UACCESS_H */ diff --git a/trunk/include/asm-x86/uaccess_64.h b/trunk/include/asm-x86/uaccess_64.h index c96c1f5d07a2..45806d60bcbe 100644 --- a/trunk/include/asm-x86/uaccess_64.h +++ b/trunk/include/asm-x86/uaccess_64.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__UACCESS_64_H -#define ASM_X86__UACCESS_64_H +#ifndef __X86_64_UACCESS_H +#define __X86_64_UACCESS_H /* * User space memory access functions @@ -199,4 +199,4 @@ static inline int __copy_from_user_inatomic_nocache(void *dst, unsigned long copy_user_handle_tail(char *to, char *from, unsigned len, unsigned zerorest); -#endif /* ASM_X86__UACCESS_64_H */ +#endif /* __X86_64_UACCESS_H */ diff --git a/trunk/include/asm-x86/ucontext.h b/trunk/include/asm-x86/ucontext.h index 9948dd328084..50a79f7fcde9 100644 --- a/trunk/include/asm-x86/ucontext.h +++ b/trunk/include/asm-x86/ucontext.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__UCONTEXT_H -#define ASM_X86__UCONTEXT_H +#ifndef _ASM_X86_UCONTEXT_H +#define _ASM_X86_UCONTEXT_H struct ucontext { unsigned long uc_flags; @@ -9,4 +9,4 @@ struct ucontext { sigset_t uc_sigmask; /* mask last for extensibility */ }; -#endif /* ASM_X86__UCONTEXT_H */ +#endif /* _ASM_X86_UCONTEXT_H */ diff --git a/trunk/include/asm-x86/unaligned.h b/trunk/include/asm-x86/unaligned.h index 59dcdec37160..a7bd416b4763 100644 --- a/trunk/include/asm-x86/unaligned.h +++ b/trunk/include/asm-x86/unaligned.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__UNALIGNED_H -#define ASM_X86__UNALIGNED_H +#ifndef _ASM_X86_UNALIGNED_H +#define _ASM_X86_UNALIGNED_H /* * The x86 can do unaligned accesses itself. @@ -11,4 +11,4 @@ #define get_unaligned __get_unaligned_le #define put_unaligned __put_unaligned_le -#endif /* ASM_X86__UNALIGNED_H */ +#endif /* _ASM_X86_UNALIGNED_H */ diff --git a/trunk/include/asm-x86/unistd_32.h b/trunk/include/asm-x86/unistd_32.h index 017f4a87c913..d7394673b772 100644 --- a/trunk/include/asm-x86/unistd_32.h +++ b/trunk/include/asm-x86/unistd_32.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__UNISTD_32_H -#define ASM_X86__UNISTD_32_H +#ifndef _ASM_I386_UNISTD_H_ +#define _ASM_I386_UNISTD_H_ /* * This file contains the system call numbers. @@ -376,4 +376,4 @@ #endif #endif /* __KERNEL__ */ -#endif /* ASM_X86__UNISTD_32_H */ +#endif /* _ASM_I386_UNISTD_H_ */ diff --git a/trunk/include/asm-x86/unistd_64.h b/trunk/include/asm-x86/unistd_64.h index ace83f1f6787..3a341d791792 100644 --- a/trunk/include/asm-x86/unistd_64.h +++ b/trunk/include/asm-x86/unistd_64.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__UNISTD_64_H -#define ASM_X86__UNISTD_64_H +#ifndef _ASM_X86_64_UNISTD_H_ +#define _ASM_X86_64_UNISTD_H_ #ifndef __SYSCALL #define __SYSCALL(a, b) @@ -690,4 +690,4 @@ __SYSCALL(__NR_inotify_init1, sys_inotify_init1) #define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall") #endif /* __KERNEL__ */ -#endif /* ASM_X86__UNISTD_64_H */ +#endif /* _ASM_X86_64_UNISTD_H_ */ diff --git a/trunk/include/asm-x86/unwind.h b/trunk/include/asm-x86/unwind.h index a2151567db44..8b064bd9c553 100644 --- a/trunk/include/asm-x86/unwind.h +++ b/trunk/include/asm-x86/unwind.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__UNWIND_H -#define ASM_X86__UNWIND_H +#ifndef _ASM_X86_UNWIND_H +#define _ASM_X86_UNWIND_H #define UNW_PC(frame) ((void)(frame), 0UL) #define UNW_SP(frame) ((void)(frame), 0UL) @@ -10,4 +10,4 @@ static inline int arch_unw_user_mode(const void *info) return 0; } -#endif /* ASM_X86__UNWIND_H */ +#endif /* _ASM_X86_UNWIND_H */ diff --git a/trunk/include/asm-x86/user32.h b/trunk/include/asm-x86/user32.h index aa66c1857f06..a3d910047879 100644 --- a/trunk/include/asm-x86/user32.h +++ b/trunk/include/asm-x86/user32.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__USER32_H -#define ASM_X86__USER32_H +#ifndef USER32_H +#define USER32_H 1 /* IA32 compatible user structures for ptrace. * These should be used for 32bit coredumps too. */ @@ -67,4 +67,4 @@ struct user32 { }; -#endif /* ASM_X86__USER32_H */ +#endif diff --git a/trunk/include/asm-x86/user_32.h b/trunk/include/asm-x86/user_32.h index e0fe2f55f1a6..d6e51edc259d 100644 --- a/trunk/include/asm-x86/user_32.h +++ b/trunk/include/asm-x86/user_32.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__USER_32_H -#define ASM_X86__USER_32_H +#ifndef _I386_USER_H +#define _I386_USER_H #include /* Core file format: The core file is written in such a way that gdb @@ -128,4 +128,4 @@ struct user{ #define HOST_TEXT_START_ADDR (u.start_code) #define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG) -#endif /* ASM_X86__USER_32_H */ +#endif /* _I386_USER_H */ diff --git a/trunk/include/asm-x86/user_64.h b/trunk/include/asm-x86/user_64.h index 38b5799863b4..6037b634c77f 100644 --- a/trunk/include/asm-x86/user_64.h +++ b/trunk/include/asm-x86/user_64.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__USER_64_H -#define ASM_X86__USER_64_H +#ifndef _X86_64_USER_H +#define _X86_64_USER_H #include #include @@ -134,4 +134,4 @@ struct user { #define HOST_TEXT_START_ADDR (u.start_code) #define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG) -#endif /* ASM_X86__USER_64_H */ +#endif /* _X86_64_USER_H */ diff --git a/trunk/include/asm-x86/uv/bios.h b/trunk/include/asm-x86/uv/bios.h index 7cd6d7ec1308..aa73362ff5df 100644 --- a/trunk/include/asm-x86/uv/bios.h +++ b/trunk/include/asm-x86/uv/bios.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__UV__BIOS_H -#define ASM_X86__UV__BIOS_H +#ifndef _ASM_X86_BIOS_H +#define _ASM_X86_BIOS_H /* * BIOS layer definitions. @@ -65,4 +65,4 @@ x86_bios_freq_base(unsigned long which, unsigned long *ticks_per_second, unsigned long *drift_info); extern const char *x86_bios_strerror(long status); -#endif /* ASM_X86__UV__BIOS_H */ +#endif /* _ASM_X86_BIOS_H */ diff --git a/trunk/include/asm-x86/uv/uv_bau.h b/trunk/include/asm-x86/uv/uv_bau.h index 77153fb18f5e..610b6b308e93 100644 --- a/trunk/include/asm-x86/uv/uv_bau.h +++ b/trunk/include/asm-x86/uv/uv_bau.h @@ -8,8 +8,8 @@ * Copyright (C) 2008 Silicon Graphics, Inc. All rights reserved. */ -#ifndef ASM_X86__UV__UV_BAU_H -#define ASM_X86__UV__UV_BAU_H +#ifndef __ASM_X86_UV_BAU__ +#define __ASM_X86_UV_BAU__ #include #define BITSPERBYTE 8 @@ -329,4 +329,4 @@ extern int uv_flush_tlb_others(cpumask_t *, struct mm_struct *, unsigned long); extern void uv_bau_message_intr1(void); extern void uv_bau_timeout_intr1(void); -#endif /* ASM_X86__UV__UV_BAU_H */ +#endif /* __ASM_X86_UV_BAU__ */ diff --git a/trunk/include/asm-x86/uv/uv_hub.h b/trunk/include/asm-x86/uv/uv_hub.h index bdb5b01afbf5..a4ef26e5850b 100644 --- a/trunk/include/asm-x86/uv/uv_hub.h +++ b/trunk/include/asm-x86/uv/uv_hub.h @@ -8,8 +8,8 @@ * Copyright (C) 2007-2008 Silicon Graphics, Inc. All rights reserved. */ -#ifndef ASM_X86__UV__UV_HUB_H -#define ASM_X86__UV__UV_HUB_H +#ifndef __ASM_X86_UV_HUB_H__ +#define __ASM_X86_UV_HUB_H__ #include #include @@ -350,5 +350,5 @@ static inline int uv_num_possible_blades(void) return uv_possible_blades; } -#endif /* ASM_X86__UV__UV_HUB_H */ +#endif /* __ASM_X86_UV_HUB__ */ diff --git a/trunk/include/asm-x86/uv/uv_mmrs.h b/trunk/include/asm-x86/uv/uv_mmrs.h index 8b03d89d2459..151fd7fcb809 100644 --- a/trunk/include/asm-x86/uv/uv_mmrs.h +++ b/trunk/include/asm-x86/uv/uv_mmrs.h @@ -8,8 +8,8 @@ * Copyright (C) 2007-2008 Silicon Graphics, Inc. All rights reserved. */ -#ifndef ASM_X86__UV__UV_MMRS_H -#define ASM_X86__UV__UV_MMRS_H +#ifndef __ASM_X86_UV_MMRS__ +#define __ASM_X86_UV_MMRS__ #define UV_MMR_ENABLE (1UL << 63) @@ -1292,4 +1292,4 @@ union uvh_si_alias2_overlay_config_u { }; -#endif /* ASM_X86__UV__UV_MMRS_H */ +#endif /* __ASM_X86_UV_MMRS__ */ diff --git a/trunk/include/asm-x86/vdso.h b/trunk/include/asm-x86/vdso.h index 4ab320913ea3..8e18fb80f5e6 100644 --- a/trunk/include/asm-x86/vdso.h +++ b/trunk/include/asm-x86/vdso.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__VDSO_H -#define ASM_X86__VDSO_H +#ifndef _ASM_X86_VDSO_H +#define _ASM_X86_VDSO_H 1 #ifdef CONFIG_X86_64 extern const char VDSO64_PRELINK[]; @@ -44,4 +44,4 @@ extern const char vdso32_int80_start, vdso32_int80_end; extern const char vdso32_syscall_start, vdso32_syscall_end; extern const char vdso32_sysenter_start, vdso32_sysenter_end; -#endif /* ASM_X86__VDSO_H */ +#endif /* asm-x86/vdso.h */ diff --git a/trunk/include/asm-x86/vga.h b/trunk/include/asm-x86/vga.h index b9e493d07d07..0ccf804377e6 100644 --- a/trunk/include/asm-x86/vga.h +++ b/trunk/include/asm-x86/vga.h @@ -4,8 +4,8 @@ * (c) 1998 Martin Mares */ -#ifndef ASM_X86__VGA_H -#define ASM_X86__VGA_H +#ifndef _LINUX_ASM_VGA_H_ +#define _LINUX_ASM_VGA_H_ /* * On the PC, we can just recalculate addresses and then @@ -17,4 +17,4 @@ #define vga_readb(x) (*(x)) #define vga_writeb(x, y) (*(y) = (x)) -#endif /* ASM_X86__VGA_H */ +#endif diff --git a/trunk/include/asm-x86/vgtod.h b/trunk/include/asm-x86/vgtod.h index 38fd13364021..3301f0929342 100644 --- a/trunk/include/asm-x86/vgtod.h +++ b/trunk/include/asm-x86/vgtod.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__VGTOD_H -#define ASM_X86__VGTOD_H +#ifndef _ASM_VGTOD_H +#define _ASM_VGTOD_H 1 #include #include @@ -26,4 +26,4 @@ extern struct vsyscall_gtod_data __vsyscall_gtod_data __section_vsyscall_gtod_data; extern struct vsyscall_gtod_data vsyscall_gtod_data; -#endif /* ASM_X86__VGTOD_H */ +#endif diff --git a/trunk/include/asm-x86/visws/cobalt.h b/trunk/include/asm-x86/visws/cobalt.h index 9627a8fe84e9..995258831b7f 100644 --- a/trunk/include/asm-x86/visws/cobalt.h +++ b/trunk/include/asm-x86/visws/cobalt.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__VISWS__COBALT_H -#define ASM_X86__VISWS__COBALT_H +#ifndef __I386_SGI_COBALT_H +#define __I386_SGI_COBALT_H #include @@ -122,4 +122,4 @@ extern char visws_board_type; extern char visws_board_rev; -#endif /* ASM_X86__VISWS__COBALT_H */ +#endif /* __I386_SGI_COBALT_H */ diff --git a/trunk/include/asm-x86/visws/lithium.h b/trunk/include/asm-x86/visws/lithium.h index b36d3b378c63..dfcd4f07ab85 100644 --- a/trunk/include/asm-x86/visws/lithium.h +++ b/trunk/include/asm-x86/visws/lithium.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__VISWS__LITHIUM_H -#define ASM_X86__VISWS__LITHIUM_H +#ifndef __I386_SGI_LITHIUM_H +#define __I386_SGI_LITHIUM_H #include @@ -49,5 +49,5 @@ static inline unsigned short li_pcib_read16(unsigned long reg) return *((volatile unsigned short *)(LI_PCIB_VADDR+reg)); } -#endif /* ASM_X86__VISWS__LITHIUM_H */ +#endif diff --git a/trunk/include/asm-x86/visws/piix4.h b/trunk/include/asm-x86/visws/piix4.h index 61c938045ec9..83ea4f46e419 100644 --- a/trunk/include/asm-x86/visws/piix4.h +++ b/trunk/include/asm-x86/visws/piix4.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__VISWS__PIIX4_H -#define ASM_X86__VISWS__PIIX4_H +#ifndef __I386_SGI_PIIX_H +#define __I386_SGI_PIIX_H /* * PIIX4 as used on SGI Visual Workstations @@ -104,4 +104,4 @@ */ #define PIIX_GPI_STPCLK 0x4 // STPCLK signal routed back in -#endif /* ASM_X86__VISWS__PIIX4_H */ +#endif diff --git a/trunk/include/asm-x86/vm86.h b/trunk/include/asm-x86/vm86.h index 998bd18eb737..5ce351325e01 100644 --- a/trunk/include/asm-x86/vm86.h +++ b/trunk/include/asm-x86/vm86.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__VM86_H -#define ASM_X86__VM86_H +#ifndef _LINUX_VM86_H +#define _LINUX_VM86_H /* * I'm guessing at the VIF/VIP flag usage, but hope that this is how @@ -205,4 +205,4 @@ static inline int handle_vm86_trap(struct kernel_vm86_regs *a, long b, int c) #endif /* __KERNEL__ */ -#endif /* ASM_X86__VM86_H */ +#endif diff --git a/trunk/include/asm-x86/vmi_time.h b/trunk/include/asm-x86/vmi_time.h index b2d39e6a08b7..c3118c385156 100644 --- a/trunk/include/asm-x86/vmi_time.h +++ b/trunk/include/asm-x86/vmi_time.h @@ -22,8 +22,8 @@ * */ -#ifndef ASM_X86__VMI_TIME_H -#define ASM_X86__VMI_TIME_H +#ifndef __VMI_TIME_H +#define __VMI_TIME_H /* * Raw VMI call indices for timer functions @@ -95,4 +95,4 @@ extern void __devinit vmi_time_ap_init(void); #define CONFIG_VMI_ALARM_HZ 100 -#endif /* ASM_X86__VMI_TIME_H */ +#endif diff --git a/trunk/include/asm-x86/vsyscall.h b/trunk/include/asm-x86/vsyscall.h index dcd4682413de..6b66ff905af0 100644 --- a/trunk/include/asm-x86/vsyscall.h +++ b/trunk/include/asm-x86/vsyscall.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__VSYSCALL_H -#define ASM_X86__VSYSCALL_H +#ifndef _ASM_X86_64_VSYSCALL_H_ +#define _ASM_X86_64_VSYSCALL_H_ enum vsyscall_num { __NR_vgettimeofday, @@ -41,4 +41,4 @@ extern void map_vsyscall(void); #endif /* __KERNEL__ */ -#endif /* ASM_X86__VSYSCALL_H */ +#endif /* _ASM_X86_64_VSYSCALL_H_ */ diff --git a/trunk/include/asm-x86/xen/events.h b/trunk/include/asm-x86/xen/events.h index 8151f5b8b6cb..8ded74720024 100644 --- a/trunk/include/asm-x86/xen/events.h +++ b/trunk/include/asm-x86/xen/events.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__XEN__EVENTS_H -#define ASM_X86__XEN__EVENTS_H +#ifndef __XEN_EVENTS_H +#define __XEN_EVENTS_H enum ipi_vector { XEN_RESCHEDULE_VECTOR, @@ -21,4 +21,4 @@ static inline void xen_do_IRQ(int irq, struct pt_regs *regs) do_IRQ(regs); } -#endif /* ASM_X86__XEN__EVENTS_H */ +#endif /* __XEN_EVENTS_H */ diff --git a/trunk/include/asm-x86/xen/grant_table.h b/trunk/include/asm-x86/xen/grant_table.h index c4baab4d2b68..2444d4593a3b 100644 --- a/trunk/include/asm-x86/xen/grant_table.h +++ b/trunk/include/asm-x86/xen/grant_table.h @@ -1,7 +1,7 @@ -#ifndef ASM_X86__XEN__GRANT_TABLE_H -#define ASM_X86__XEN__GRANT_TABLE_H +#ifndef __XEN_GRANT_TABLE_H +#define __XEN_GRANT_TABLE_H #define xen_alloc_vm_area(size) alloc_vm_area(size) #define xen_free_vm_area(area) free_vm_area(area) -#endif /* ASM_X86__XEN__GRANT_TABLE_H */ +#endif /* __XEN_GRANT_TABLE_H */ diff --git a/trunk/include/asm-x86/xen/hypercall.h b/trunk/include/asm-x86/xen/hypercall.h index 44f4259bee3f..91cb7fd5c123 100644 --- a/trunk/include/asm-x86/xen/hypercall.h +++ b/trunk/include/asm-x86/xen/hypercall.h @@ -30,8 +30,8 @@ * IN THE SOFTWARE. */ -#ifndef ASM_X86__XEN__HYPERCALL_H -#define ASM_X86__XEN__HYPERCALL_H +#ifndef __HYPERCALL_H__ +#define __HYPERCALL_H__ #include #include @@ -524,4 +524,4 @@ MULTI_stack_switch(struct multicall_entry *mcl, mcl->args[1] = esp; } -#endif /* ASM_X86__XEN__HYPERCALL_H */ +#endif /* __HYPERCALL_H__ */ diff --git a/trunk/include/asm-x86/xen/hypervisor.h b/trunk/include/asm-x86/xen/hypervisor.h index 0ef3a88b869d..04ee0610014a 100644 --- a/trunk/include/asm-x86/xen/hypervisor.h +++ b/trunk/include/asm-x86/xen/hypervisor.h @@ -30,8 +30,8 @@ * IN THE SOFTWARE. */ -#ifndef ASM_X86__XEN__HYPERVISOR_H -#define ASM_X86__XEN__HYPERVISOR_H +#ifndef __HYPERVISOR_H__ +#define __HYPERVISOR_H__ #include #include @@ -69,4 +69,4 @@ u64 jiffies_to_st(unsigned long jiffies); #define is_running_on_xen() (xen_start_info ? 1 : 0) -#endif /* ASM_X86__XEN__HYPERVISOR_H */ +#endif /* __HYPERVISOR_H__ */ diff --git a/trunk/include/asm-x86/xen/interface.h b/trunk/include/asm-x86/xen/interface.h index d077bba96da9..9d810f2538a2 100644 --- a/trunk/include/asm-x86/xen/interface.h +++ b/trunk/include/asm-x86/xen/interface.h @@ -6,8 +6,8 @@ * Copyright (c) 2004, K A Fraser */ -#ifndef ASM_X86__XEN__INTERFACE_H -#define ASM_X86__XEN__INTERFACE_H +#ifndef __ASM_X86_XEN_INTERFACE_H +#define __ASM_X86_XEN_INTERFACE_H #ifdef __XEN__ #define __DEFINE_GUEST_HANDLE(name, type) \ @@ -172,4 +172,4 @@ DEFINE_GUEST_HANDLE_STRUCT(vcpu_guest_context); #define XEN_CPUID XEN_EMULATE_PREFIX "cpuid" #endif -#endif /* ASM_X86__XEN__INTERFACE_H */ +#endif /* __ASM_X86_XEN_INTERFACE_H */ diff --git a/trunk/include/asm-x86/xen/interface_32.h b/trunk/include/asm-x86/xen/interface_32.h index 08167e19fc66..d8ac41d5db86 100644 --- a/trunk/include/asm-x86/xen/interface_32.h +++ b/trunk/include/asm-x86/xen/interface_32.h @@ -6,8 +6,8 @@ * Copyright (c) 2004, K A Fraser */ -#ifndef ASM_X86__XEN__INTERFACE_32_H -#define ASM_X86__XEN__INTERFACE_32_H +#ifndef __ASM_X86_XEN_INTERFACE_32_H +#define __ASM_X86_XEN_INTERFACE_32_H /* @@ -94,4 +94,4 @@ typedef struct xen_callback xen_callback_t; #define xen_pfn_to_cr3(pfn) (((unsigned)(pfn) << 12) | ((unsigned)(pfn) >> 20)) #define xen_cr3_to_pfn(cr3) (((unsigned)(cr3) >> 12) | ((unsigned)(cr3) << 20)) -#endif /* ASM_X86__XEN__INTERFACE_32_H */ +#endif /* __ASM_X86_XEN_INTERFACE_32_H */ diff --git a/trunk/include/asm-x86/xen/interface_64.h b/trunk/include/asm-x86/xen/interface_64.h index 046c0f1e01d4..842266ce96e6 100644 --- a/trunk/include/asm-x86/xen/interface_64.h +++ b/trunk/include/asm-x86/xen/interface_64.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__XEN__INTERFACE_64_H -#define ASM_X86__XEN__INTERFACE_64_H +#ifndef __ASM_X86_XEN_INTERFACE_64_H +#define __ASM_X86_XEN_INTERFACE_64_H /* * 64-bit segment selectors @@ -156,4 +156,4 @@ typedef unsigned long xen_callback_t; #endif /* !__ASSEMBLY__ */ -#endif /* ASM_X86__XEN__INTERFACE_64_H */ +#endif /* __ASM_X86_XEN_INTERFACE_64_H */ diff --git a/trunk/include/asm-x86/xen/page.h b/trunk/include/asm-x86/xen/page.h index c50185dccec1..7b3835d3b77d 100644 --- a/trunk/include/asm-x86/xen/page.h +++ b/trunk/include/asm-x86/xen/page.h @@ -1,5 +1,5 @@ -#ifndef ASM_X86__XEN__PAGE_H -#define ASM_X86__XEN__PAGE_H +#ifndef __XEN_PAGE_H +#define __XEN_PAGE_H #include @@ -162,4 +162,4 @@ xmaddr_t arbitrary_virt_to_machine(void *address); void make_lowmem_page_readonly(void *vaddr); void make_lowmem_page_readwrite(void *vaddr); -#endif /* ASM_X86__XEN__PAGE_H */ +#endif /* __XEN_PAGE_H */ diff --git a/trunk/include/linux/ata.h b/trunk/include/linux/ata.h index a26ebd25bac1..8a12d718c169 100644 --- a/trunk/include/linux/ata.h +++ b/trunk/include/linux/ata.h @@ -667,15 +667,6 @@ static inline int ata_id_has_dword_io(const u16 *id) return 0; } -static inline int ata_id_has_unload(const u16 *id) -{ - if (ata_id_major_version(id) >= 7 && - (id[ATA_ID_CFSSE] & 0xC000) == 0x4000 && - id[ATA_ID_CFSSE] & (1 << 13)) - return 1; - return 0; -} - static inline int ata_id_current_chs_valid(const u16 *id) { /* For ATA-1 devices, if the INITIALIZE DEVICE PARAMETERS command diff --git a/trunk/include/linux/libata.h b/trunk/include/linux/libata.h index 947cf84e555d..225bfc5bd9ec 100644 --- a/trunk/include/linux/libata.h +++ b/trunk/include/linux/libata.h @@ -146,7 +146,6 @@ enum { ATA_DFLAG_SPUNDOWN = (1 << 14), /* XXX: for spindown_compat */ ATA_DFLAG_SLEEPING = (1 << 15), /* device is sleeping */ ATA_DFLAG_DUBIOUS_XFER = (1 << 16), /* data transfer not verified */ - ATA_DFLAG_NO_UNLOAD = (1 << 17), /* device doesn't support unload */ ATA_DFLAG_INIT_MASK = (1 << 24) - 1, ATA_DFLAG_DETACH = (1 << 24), @@ -245,7 +244,6 @@ enum { ATA_TMOUT_BOOT = 30000, /* heuristic */ ATA_TMOUT_BOOT_QUICK = 7000, /* heuristic */ ATA_TMOUT_INTERNAL_QUICK = 5000, - ATA_TMOUT_MAX_PARK = 30000, /* FIXME: GoVault needs 2s but we can't afford that without * parallel probing. 800ms is enough for iVDR disk @@ -321,11 +319,8 @@ enum { ATA_EH_RESET = ATA_EH_SOFTRESET | ATA_EH_HARDRESET, ATA_EH_ENABLE_LINK = (1 << 3), ATA_EH_LPM = (1 << 4), /* link power management action */ - ATA_EH_PARK = (1 << 5), /* unload heads and stop I/O */ - ATA_EH_PERDEV_MASK = ATA_EH_REVALIDATE | ATA_EH_PARK, - ATA_EH_ALL_ACTIONS = ATA_EH_REVALIDATE | ATA_EH_RESET | - ATA_EH_ENABLE_LINK | ATA_EH_LPM, + ATA_EH_PERDEV_MASK = ATA_EH_REVALIDATE, /* ata_eh_info->flags */ ATA_EHI_HOTPLUGGED = (1 << 0), /* could have been hotplugged */ @@ -457,7 +452,6 @@ enum link_pm { MEDIUM_POWER, }; extern struct device_attribute dev_attr_link_power_management_policy; -extern struct device_attribute dev_attr_unload_heads; extern struct device_attribute dev_attr_em_message_type; extern struct device_attribute dev_attr_em_message; extern struct device_attribute dev_attr_sw_activity; @@ -560,8 +554,8 @@ struct ata_ering { struct ata_device { struct ata_link *link; unsigned int devno; /* 0 or 1 */ - unsigned int horkage; /* List of broken features */ unsigned long flags; /* ATA_DFLAG_xxx */ + unsigned int horkage; /* List of broken features */ struct scsi_device *sdev; /* attached SCSI device */ #ifdef CONFIG_ATA_ACPI acpi_handle acpi_handle; @@ -570,7 +564,6 @@ struct ata_device { /* n_sector is used as CLEAR_OFFSET, read comment above CLEAR_OFFSET */ u64 n_sectors; /* size of device, if ATA */ unsigned int class; /* ATA_DEV_xxx */ - unsigned long unpark_deadline; u8 pio_mode; u8 dma_mode; @@ -628,7 +621,6 @@ struct ata_eh_context { [ATA_EH_CMD_TIMEOUT_TABLE_SIZE]; unsigned int classes[ATA_MAX_DEVICES]; unsigned int did_probe_mask; - unsigned int unloaded_mask; unsigned int saved_ncq_enabled; u8 saved_xfer_mode[ATA_MAX_DEVICES]; /* timestamp for the last reset attempt or success */ @@ -696,8 +688,7 @@ struct ata_port { unsigned int qc_active; int nr_active_links; /* #links with active qcs */ - struct ata_link link; /* host default link */ - struct ata_link *slave_link; /* see ata_slave_link_init() */ + struct ata_link link; /* host default link */ int nr_pmp_links; /* nr of available PMP links */ struct ata_link *pmp_link; /* array of PMP links */ @@ -718,7 +709,6 @@ struct ata_port { struct list_head eh_done_q; wait_queue_head_t eh_wait_q; int eh_tries; - struct completion park_req_pending; pm_message_t pm_mesg; int *pm_result; @@ -782,8 +772,8 @@ struct ata_port_operations { /* * Optional features */ - int (*scr_read)(struct ata_link *link, unsigned int sc_reg, u32 *val); - int (*scr_write)(struct ata_link *link, unsigned int sc_reg, u32 val); + int (*scr_read)(struct ata_port *ap, unsigned int sc_reg, u32 *val); + int (*scr_write)(struct ata_port *ap, unsigned int sc_reg, u32 val); void (*pmp_attach)(struct ata_port *ap); void (*pmp_detach)(struct ata_port *ap); int (*enable_pm)(struct ata_port *ap, enum link_pm policy); @@ -905,7 +895,6 @@ extern void ata_port_disable(struct ata_port *); extern struct ata_host *ata_host_alloc(struct device *dev, int max_ports); extern struct ata_host *ata_host_alloc_pinfo(struct device *dev, const struct ata_port_info * const * ppi, int n_ports); -extern int ata_slave_link_init(struct ata_port *ap); extern int ata_host_start(struct ata_host *host); extern int ata_host_register(struct ata_host *host, struct scsi_host_template *sht); @@ -931,8 +920,8 @@ extern int sata_scr_valid(struct ata_link *link); extern int sata_scr_read(struct ata_link *link, int reg, u32 *val); extern int sata_scr_write(struct ata_link *link, int reg, u32 val); extern int sata_scr_write_flush(struct ata_link *link, int reg, u32 val); -extern bool ata_link_online(struct ata_link *link); -extern bool ata_link_offline(struct ata_link *link); +extern int ata_link_online(struct ata_link *link); +extern int ata_link_offline(struct ata_link *link); #ifdef CONFIG_PM extern int ata_host_suspend(struct ata_host *host, pm_message_t mesg); extern void ata_host_resume(struct ata_host *host); @@ -1109,7 +1098,6 @@ extern void ata_std_error_handler(struct ata_port *ap); */ extern const struct ata_port_operations ata_base_port_ops; extern const struct ata_port_operations sata_port_ops; -extern struct device_attribute *ata_common_sdev_attrs[]; #define ATA_BASE_SHT(drv_name) \ .module = THIS_MODULE, \ @@ -1124,8 +1112,7 @@ extern struct device_attribute *ata_common_sdev_attrs[]; .proc_name = drv_name, \ .slave_configure = ata_scsi_slave_config, \ .slave_destroy = ata_scsi_slave_destroy, \ - .bios_param = ata_std_bios_param, \ - .sdev_attrs = ata_common_sdev_attrs + .bios_param = ata_std_bios_param #define ATA_NCQ_SHT(drv_name) \ ATA_BASE_SHT(drv_name), \ @@ -1147,7 +1134,7 @@ static inline bool sata_pmp_attached(struct ata_port *ap) static inline int ata_is_host_link(const struct ata_link *link) { - return link == &link->ap->link || link == link->ap->slave_link; + return link == &link->ap->link; } #else /* CONFIG_SATA_PMP */ static inline bool sata_pmp_supported(struct ata_port *ap) @@ -1180,7 +1167,7 @@ static inline int sata_srst_pmp(struct ata_link *link) printk("%sata%u: "fmt, lv, (ap)->print_id , ##args) #define ata_link_printk(link, lv, fmt, args...) do { \ - if (sata_pmp_attached((link)->ap) || (link)->ap->slave_link) \ + if (sata_pmp_attached((link)->ap)) \ printk("%sata%u.%02u: "fmt, lv, (link)->ap->print_id, \ (link)->pmp , ##args); \ else \ @@ -1278,17 +1265,34 @@ static inline int ata_link_active(struct ata_link *link) return ata_tag_valid(link->active_tag) || link->sactive; } -extern struct ata_link *__ata_port_next_link(struct ata_port *ap, - struct ata_link *link, - bool dev_only); +static inline struct ata_link *ata_port_first_link(struct ata_port *ap) +{ + if (sata_pmp_attached(ap)) + return ap->pmp_link; + return &ap->link; +} + +static inline struct ata_link *ata_port_next_link(struct ata_link *link) +{ + struct ata_port *ap = link->ap; + + if (ata_is_host_link(link)) { + if (!sata_pmp_attached(ap)) + return NULL; + return ap->pmp_link; + } + + if (++link < ap->nr_pmp_links + ap->pmp_link) + return link; + return NULL; +} -#define __ata_port_for_each_link(link, ap) \ - for ((link) = __ata_port_next_link((ap), NULL, false); (link); \ - (link) = __ata_port_next_link((ap), (link), false)) +#define __ata_port_for_each_link(lk, ap) \ + for ((lk) = &(ap)->link; (lk); (lk) = ata_port_next_link(lk)) #define ata_port_for_each_link(link, ap) \ - for ((link) = __ata_port_next_link((ap), NULL, true); (link); \ - (link) = __ata_port_next_link((ap), (link), true)) + for ((link) = ata_port_first_link(ap); (link); \ + (link) = ata_port_next_link(link)) #define ata_link_for_each_dev(dev, link) \ for ((dev) = (link)->device; \ diff --git a/trunk/mm/slob.c b/trunk/mm/slob.c index cb675d126791..62b679dc660f 100644 --- a/trunk/mm/slob.c +++ b/trunk/mm/slob.c @@ -514,11 +514,9 @@ size_t ksize(const void *block) return 0; sp = (struct slob_page *)virt_to_page(block); - if (slob_page(sp)) { - int align = max(ARCH_KMALLOC_MINALIGN, ARCH_SLAB_MINALIGN); - unsigned int *m = (unsigned int *)(block - align); - return SLOB_UNITS(*m) * SLOB_UNIT; - } else + if (slob_page(sp)) + return (((slob_t *)block - 1)->units - 1) * SLOB_UNIT; + else return sp->page.private; }