diff options
Diffstat (limited to 'arch/i386')
76 files changed, 1119 insertions, 1081 deletions
diff --git a/arch/i386/Kconfig b/arch/i386/Kconfig index 6004bb0795e0..cbde675bc95c 100644 --- a/arch/i386/Kconfig +++ b/arch/i386/Kconfig | |||
@@ -29,10 +29,6 @@ config MMU | |||
29 | config SBUS | 29 | config SBUS |
30 | bool | 30 | bool |
31 | 31 | ||
32 | config UID16 | ||
33 | bool | ||
34 | default y | ||
35 | |||
36 | config GENERIC_ISA_DMA | 32 | config GENERIC_ISA_DMA |
37 | bool | 33 | bool |
38 | default y | 34 | default y |
@@ -45,8 +41,21 @@ config ARCH_MAY_HAVE_PC_FDC | |||
45 | bool | 41 | bool |
46 | default y | 42 | default y |
47 | 43 | ||
44 | config DMI | ||
45 | bool | ||
46 | default y | ||
47 | |||
48 | source "init/Kconfig" | 48 | source "init/Kconfig" |
49 | 49 | ||
50 | config DOUBLEFAULT | ||
51 | default y | ||
52 | bool "Enable doublefault exception handler" if EMBEDDED | ||
53 | help | ||
54 | This option allows trapping of rare doublefault exceptions that | ||
55 | would otherwise cause a system to silently reboot. Disabling this | ||
56 | option saves about 4k and might cause you much additional grey | ||
57 | hair. | ||
58 | |||
50 | menu "Processor type and features" | 59 | menu "Processor type and features" |
51 | 60 | ||
52 | choice | 61 | choice |
@@ -464,7 +473,6 @@ config NUMA | |||
464 | depends on SMP && HIGHMEM64G && (X86_NUMAQ || X86_GENERICARCH || (X86_SUMMIT && ACPI)) | 473 | depends on SMP && HIGHMEM64G && (X86_NUMAQ || X86_GENERICARCH || (X86_SUMMIT && ACPI)) |
465 | default n if X86_PC | 474 | default n if X86_PC |
466 | default y if (X86_NUMAQ || X86_SUMMIT) | 475 | default y if (X86_NUMAQ || X86_SUMMIT) |
467 | select SPARSEMEM_STATIC | ||
468 | 476 | ||
469 | # Need comments to help the hapless user trying to turn on NUMA support | 477 | # Need comments to help the hapless user trying to turn on NUMA support |
470 | comment "NUMA (NUMA-Q) requires SMP, 64GB highmem support" | 478 | comment "NUMA (NUMA-Q) requires SMP, 64GB highmem support" |
@@ -493,6 +501,10 @@ config HAVE_ARCH_ALLOC_REMAP | |||
493 | depends on NUMA | 501 | depends on NUMA |
494 | default y | 502 | default y |
495 | 503 | ||
504 | config ARCH_FLATMEM_ENABLE | ||
505 | def_bool y | ||
506 | depends on (ARCH_SELECT_MEMORY_MODEL && X86_PC) | ||
507 | |||
496 | config ARCH_DISCONTIGMEM_ENABLE | 508 | config ARCH_DISCONTIGMEM_ENABLE |
497 | def_bool y | 509 | def_bool y |
498 | depends on NUMA | 510 | depends on NUMA |
@@ -503,7 +515,8 @@ config ARCH_DISCONTIGMEM_DEFAULT | |||
503 | 515 | ||
504 | config ARCH_SPARSEMEM_ENABLE | 516 | config ARCH_SPARSEMEM_ENABLE |
505 | def_bool y | 517 | def_bool y |
506 | depends on NUMA | 518 | depends on (NUMA || (X86_PC && EXPERIMENTAL)) |
519 | select SPARSEMEM_STATIC | ||
507 | 520 | ||
508 | config ARCH_SELECT_MEMORY_MODEL | 521 | config ARCH_SELECT_MEMORY_MODEL |
509 | def_bool y | 522 | def_bool y |
@@ -626,10 +639,6 @@ config REGPARM | |||
626 | and passes the first three arguments of a function call in registers. | 639 | and passes the first three arguments of a function call in registers. |
627 | This will probably break binary only modules. | 640 | This will probably break binary only modules. |
628 | 641 | ||
629 | This feature is only enabled for gcc-3.0 and later - earlier compilers | ||
630 | generate incorrect output with certain kernel constructs when | ||
631 | -mregparm=3 is used. | ||
632 | |||
633 | config SECCOMP | 642 | config SECCOMP |
634 | bool "Enable seccomp to safely compute untrusted bytecode" | 643 | bool "Enable seccomp to safely compute untrusted bytecode" |
635 | depends on PROC_FS | 644 | depends on PROC_FS |
@@ -649,17 +658,6 @@ config SECCOMP | |||
649 | 658 | ||
650 | source kernel/Kconfig.hz | 659 | source kernel/Kconfig.hz |
651 | 660 | ||
652 | config PHYSICAL_START | ||
653 | hex "Physical address where the kernel is loaded" if EMBEDDED | ||
654 | default "0x100000" | ||
655 | help | ||
656 | This gives the physical address where the kernel is loaded. | ||
657 | Primarily used in the case of kexec on panic where the | ||
658 | fail safe kernel needs to run at a different address than | ||
659 | the panic-ed kernel. | ||
660 | |||
661 | Don't change this unless you know what you are doing. | ||
662 | |||
663 | config KEXEC | 661 | config KEXEC |
664 | bool "kexec system call (EXPERIMENTAL)" | 662 | bool "kexec system call (EXPERIMENTAL)" |
665 | depends on EXPERIMENTAL | 663 | depends on EXPERIMENTAL |
@@ -679,11 +677,40 @@ config KEXEC | |||
679 | 677 | ||
680 | config CRASH_DUMP | 678 | config CRASH_DUMP |
681 | bool "kernel crash dumps (EXPERIMENTAL)" | 679 | bool "kernel crash dumps (EXPERIMENTAL)" |
682 | depends on EMBEDDED | ||
683 | depends on EXPERIMENTAL | 680 | depends on EXPERIMENTAL |
684 | depends on HIGHMEM | 681 | depends on HIGHMEM |
685 | help | 682 | help |
686 | Generate crash dump after being started by kexec. | 683 | Generate crash dump after being started by kexec. |
684 | |||
685 | config PHYSICAL_START | ||
686 | hex "Physical address where the kernel is loaded" if (EMBEDDED || CRASH_DUMP) | ||
687 | |||
688 | default "0x1000000" if CRASH_DUMP | ||
689 | default "0x100000" | ||
690 | help | ||
691 | This gives the physical address where the kernel is loaded. Normally | ||
692 | for regular kernels this value is 0x100000 (1MB). But in the case | ||
693 | of kexec on panic the fail safe kernel needs to run at a different | ||
694 | address than the panic-ed kernel. This option is used to set the load | ||
695 | address for kernels used to capture crash dump on being kexec'ed | ||
696 | after panic. The default value for crash dump kernels is | ||
697 | 0x1000000 (16MB). This can also be set based on the "X" value as | ||
698 | specified in the "crashkernel=YM@XM" command line boot parameter | ||
699 | passed to the panic-ed kernel. Typically this parameter is set as | ||
700 | crashkernel=64M@16M. Please take a look at | ||
701 | Documentation/kdump/kdump.txt for more details about crash dumps. | ||
702 | |||
703 | Don't change this unless you know what you are doing. | ||
704 | |||
705 | config HOTPLUG_CPU | ||
706 | bool "Support for hot-pluggable CPUs (EXPERIMENTAL)" | ||
707 | depends on SMP && HOTPLUG && EXPERIMENTAL | ||
708 | ---help--- | ||
709 | Say Y here to experiment with turning CPUs off and on. CPUs | ||
710 | can be controlled through /sys/devices/system/cpu. | ||
711 | |||
712 | Say N. | ||
713 | |||
687 | endmenu | 714 | endmenu |
688 | 715 | ||
689 | 716 | ||
@@ -699,7 +726,7 @@ depends on PM && !X86_VISWS | |||
699 | 726 | ||
700 | config APM | 727 | config APM |
701 | tristate "APM (Advanced Power Management) BIOS support" | 728 | tristate "APM (Advanced Power Management) BIOS support" |
702 | depends on PM && PM_LEGACY | 729 | depends on PM |
703 | ---help--- | 730 | ---help--- |
704 | APM is a BIOS specification for saving power using several different | 731 | APM is a BIOS specification for saving power using several different |
705 | techniques. This is mostly useful for battery powered laptops with | 732 | techniques. This is mostly useful for battery powered laptops with |
@@ -970,15 +997,6 @@ config SCx200 | |||
970 | This support is also available as a module. If compiled as a | 997 | This support is also available as a module. If compiled as a |
971 | module, it will be called scx200. | 998 | module, it will be called scx200. |
972 | 999 | ||
973 | config HOTPLUG_CPU | ||
974 | bool "Support for hot-pluggable CPUs (EXPERIMENTAL)" | ||
975 | depends on SMP && HOTPLUG && EXPERIMENTAL | ||
976 | ---help--- | ||
977 | Say Y here to experiment with turning CPUs off and on. CPUs | ||
978 | can be controlled through /sys/devices/system/cpu. | ||
979 | |||
980 | Say N. | ||
981 | |||
982 | source "drivers/pcmcia/Kconfig" | 1000 | source "drivers/pcmcia/Kconfig" |
983 | 1001 | ||
984 | source "drivers/pci/hotplug/Kconfig" | 1002 | source "drivers/pci/hotplug/Kconfig" |
@@ -1055,3 +1073,7 @@ config X86_TRAMPOLINE | |||
1055 | bool | 1073 | bool |
1056 | depends on X86_SMP || (X86_VOYAGER && SMP) | 1074 | depends on X86_SMP || (X86_VOYAGER && SMP) |
1057 | default y | 1075 | default y |
1076 | |||
1077 | config KTIME_SCALAR | ||
1078 | bool | ||
1079 | default y | ||
diff --git a/arch/i386/Kconfig.cpu b/arch/i386/Kconfig.cpu index 53bbb3c008ee..79603b3471f9 100644 --- a/arch/i386/Kconfig.cpu +++ b/arch/i386/Kconfig.cpu | |||
@@ -39,6 +39,7 @@ config M386 | |||
39 | - "Winchip-2" for IDT Winchip 2. | 39 | - "Winchip-2" for IDT Winchip 2. |
40 | - "Winchip-2A" for IDT Winchips with 3dNow! capabilities. | 40 | - "Winchip-2A" for IDT Winchips with 3dNow! capabilities. |
41 | - "GeodeGX1" for Geode GX1 (Cyrix MediaGX). | 41 | - "GeodeGX1" for Geode GX1 (Cyrix MediaGX). |
42 | - "Geode GX/LX" For AMD Geode GX and LX processors. | ||
42 | - "CyrixIII/VIA C3" for VIA Cyrix III or VIA C3. | 43 | - "CyrixIII/VIA C3" for VIA Cyrix III or VIA C3. |
43 | - "VIA C3-2 for VIA C3-2 "Nehemiah" (model 9 and above). | 44 | - "VIA C3-2 for VIA C3-2 "Nehemiah" (model 9 and above). |
44 | 45 | ||
@@ -171,6 +172,11 @@ config MGEODEGX1 | |||
171 | help | 172 | help |
172 | Select this for a Geode GX1 (Cyrix MediaGX) chip. | 173 | Select this for a Geode GX1 (Cyrix MediaGX) chip. |
173 | 174 | ||
175 | config MGEODE_LX | ||
176 | bool "Geode GX/LX" | ||
177 | help | ||
178 | Select this for AMD Geode GX and LX processors. | ||
179 | |||
174 | config MCYRIXIII | 180 | config MCYRIXIII |
175 | bool "CyrixIII/VIA-C3" | 181 | bool "CyrixIII/VIA-C3" |
176 | help | 182 | help |
@@ -220,8 +226,8 @@ config X86_XADD | |||
220 | config X86_L1_CACHE_SHIFT | 226 | config X86_L1_CACHE_SHIFT |
221 | int | 227 | int |
222 | default "7" if MPENTIUM4 || X86_GENERIC | 228 | default "7" if MPENTIUM4 || X86_GENERIC |
223 | default "4" if X86_ELAN || M486 || M386 | 229 | default "4" if X86_ELAN || M486 || M386 || MGEODEGX1 |
224 | default "5" if MWINCHIP3D || MWINCHIP2 || MWINCHIPC6 || MCRUSOE || MEFFICEON || MCYRIXIII || MK6 || MPENTIUMIII || MPENTIUMII || M686 || M586MMX || M586TSC || M586 || MVIAC3_2 || MGEODEGX1 | 230 | default "5" if MWINCHIP3D || MWINCHIP2 || MWINCHIPC6 || MCRUSOE || MEFFICEON || MCYRIXIII || MK6 || MPENTIUMIII || MPENTIUMII || M686 || M586MMX || M586TSC || M586 || MVIAC3_2 || MGEODE_LX |
225 | default "6" if MK7 || MK8 || MPENTIUMM | 231 | default "6" if MK7 || MK8 || MPENTIUMM |
226 | 232 | ||
227 | config RWSEM_GENERIC_SPINLOCK | 233 | config RWSEM_GENERIC_SPINLOCK |
@@ -290,12 +296,12 @@ config X86_INTEL_USERCOPY | |||
290 | 296 | ||
291 | config X86_USE_PPRO_CHECKSUM | 297 | config X86_USE_PPRO_CHECKSUM |
292 | bool | 298 | bool |
293 | depends on MWINCHIP3D || MWINCHIP2 || MWINCHIPC6 || MCYRIXIII || MK7 || MK6 || MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || MK8 || MVIAC3_2 || MEFFICEON | 299 | depends on MWINCHIP3D || MWINCHIP2 || MWINCHIPC6 || MCYRIXIII || MK7 || MK6 || MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || MK8 || MVIAC3_2 || MEFFICEON || MGEODE_LX |
294 | default y | 300 | default y |
295 | 301 | ||
296 | config X86_USE_3DNOW | 302 | config X86_USE_3DNOW |
297 | bool | 303 | bool |
298 | depends on MCYRIXIII || MK7 | 304 | depends on MCYRIXIII || MK7 || MGEODE_LX |
299 | default y | 305 | default y |
300 | 306 | ||
301 | config X86_OOSTORE | 307 | config X86_OOSTORE |
diff --git a/arch/i386/Kconfig.debug b/arch/i386/Kconfig.debug index c48b424dd640..bf32ecc9ad04 100644 --- a/arch/i386/Kconfig.debug +++ b/arch/i386/Kconfig.debug | |||
@@ -42,6 +42,16 @@ config DEBUG_PAGEALLOC | |||
42 | This results in a large slowdown, but helps to find certain types | 42 | This results in a large slowdown, but helps to find certain types |
43 | of memory corruptions. | 43 | of memory corruptions. |
44 | 44 | ||
45 | config DEBUG_RODATA | ||
46 | bool "Write protect kernel read-only data structures" | ||
47 | depends on DEBUG_KERNEL | ||
48 | help | ||
49 | Mark the kernel read-only data as write-protected in the pagetables, | ||
50 | in order to catch accidental (and incorrect) writes to such const | ||
51 | data. This option may have a slight performance impact because a | ||
52 | portion of the kernel code won't be covered by a 2MB TLB anymore. | ||
53 | If in doubt, say "N". | ||
54 | |||
45 | config 4KSTACKS | 55 | config 4KSTACKS |
46 | bool "Use 4Kb for kernel stacks instead of 8Kb" | 56 | bool "Use 4Kb for kernel stacks instead of 8Kb" |
47 | depends on DEBUG_KERNEL | 57 | depends on DEBUG_KERNEL |
diff --git a/arch/i386/Makefile b/arch/i386/Makefile index d121ea18460f..36bef6543ac1 100644 --- a/arch/i386/Makefile +++ b/arch/i386/Makefile | |||
@@ -37,14 +37,11 @@ CFLAGS += $(call cc-option,-mpreferred-stack-boundary=2) | |||
37 | # CPU-specific tuning. Anything which can be shared with UML should go here. | 37 | # CPU-specific tuning. Anything which can be shared with UML should go here. |
38 | include $(srctree)/arch/i386/Makefile.cpu | 38 | include $(srctree)/arch/i386/Makefile.cpu |
39 | 39 | ||
40 | # -mregparm=3 works ok on gcc-3.0 and later | 40 | cflags-$(CONFIG_REGPARM) += -mregparm=3 |
41 | # | ||
42 | GCC_VERSION := $(call cc-version) | ||
43 | cflags-$(CONFIG_REGPARM) += $(shell if [ $(GCC_VERSION) -ge 0300 ] ; then echo "-mregparm=3"; fi ;) | ||
44 | 41 | ||
45 | # Disable unit-at-a-time mode, it makes gcc use a lot more stack | 42 | # Disable unit-at-a-time mode on pre-gcc-4.0 compilers, it makes gcc use |
46 | # due to the lack of sharing of stacklots. | 43 | # a lot more stack due to the lack of sharing of stacklots: |
47 | CFLAGS += $(call cc-option,-fno-unit-at-a-time) | 44 | CFLAGS += $(shell if [ $(call cc-version) -lt 0400 ] ; then echo $(call cc-option,-fno-unit-at-a-time); fi ;) |
48 | 45 | ||
49 | CFLAGS += $(cflags-y) | 46 | CFLAGS += $(cflags-y) |
50 | 47 | ||
@@ -103,7 +100,7 @@ AFLAGS += $(mflags-y) | |||
103 | boot := arch/i386/boot | 100 | boot := arch/i386/boot |
104 | 101 | ||
105 | .PHONY: zImage bzImage compressed zlilo bzlilo \ | 102 | .PHONY: zImage bzImage compressed zlilo bzlilo \ |
106 | zdisk bzdisk fdimage fdimage144 fdimage288 install kernel_install | 103 | zdisk bzdisk fdimage fdimage144 fdimage288 install |
107 | 104 | ||
108 | all: bzImage | 105 | all: bzImage |
109 | 106 | ||
@@ -125,8 +122,7 @@ zdisk bzdisk: vmlinux | |||
125 | fdimage fdimage144 fdimage288: vmlinux | 122 | fdimage fdimage144 fdimage288: vmlinux |
126 | $(Q)$(MAKE) $(build)=$(boot) BOOTIMAGE=$(KBUILD_IMAGE) $@ | 123 | $(Q)$(MAKE) $(build)=$(boot) BOOTIMAGE=$(KBUILD_IMAGE) $@ |
127 | 124 | ||
128 | install: vmlinux | 125 | install: |
129 | install kernel_install: | ||
130 | $(Q)$(MAKE) $(build)=$(boot) BOOTIMAGE=$(KBUILD_IMAGE) install | 126 | $(Q)$(MAKE) $(build)=$(boot) BOOTIMAGE=$(KBUILD_IMAGE) install |
131 | 127 | ||
132 | archclean: | 128 | archclean: |
diff --git a/arch/i386/Makefile.cpu b/arch/i386/Makefile.cpu index 8e51456df23d..dcd936ef45db 100644 --- a/arch/i386/Makefile.cpu +++ b/arch/i386/Makefile.cpu | |||
@@ -1,7 +1,7 @@ | |||
1 | # CPU tuning section - shared with UML. | 1 | # CPU tuning section - shared with UML. |
2 | # Must change only cflags-y (or [yn]), not CFLAGS! That makes a difference for UML. | 2 | # Must change only cflags-y (or [yn]), not CFLAGS! That makes a difference for UML. |
3 | 3 | ||
4 | #-mtune exists since gcc 3.4, and some -mcpu flavors didn't exist in gcc 2.95. | 4 | #-mtune exists since gcc 3.4 |
5 | HAS_MTUNE := $(call cc-option-yn, -mtune=i386) | 5 | HAS_MTUNE := $(call cc-option-yn, -mtune=i386) |
6 | ifeq ($(HAS_MTUNE),y) | 6 | ifeq ($(HAS_MTUNE),y) |
7 | tune = $(call cc-option,-mtune=$(1),) | 7 | tune = $(call cc-option,-mtune=$(1),) |
@@ -14,7 +14,7 @@ cflags-$(CONFIG_M386) += -march=i386 | |||
14 | cflags-$(CONFIG_M486) += -march=i486 | 14 | cflags-$(CONFIG_M486) += -march=i486 |
15 | cflags-$(CONFIG_M586) += -march=i586 | 15 | cflags-$(CONFIG_M586) += -march=i586 |
16 | cflags-$(CONFIG_M586TSC) += -march=i586 | 16 | cflags-$(CONFIG_M586TSC) += -march=i586 |
17 | cflags-$(CONFIG_M586MMX) += $(call cc-option,-march=pentium-mmx,-march=i586) | 17 | cflags-$(CONFIG_M586MMX) += -march=pentium-mmx |
18 | cflags-$(CONFIG_M686) += -march=i686 | 18 | cflags-$(CONFIG_M686) += -march=i686 |
19 | cflags-$(CONFIG_MPENTIUMII) += -march=i686 $(call tune,pentium2) | 19 | cflags-$(CONFIG_MPENTIUMII) += -march=i686 $(call tune,pentium2) |
20 | cflags-$(CONFIG_MPENTIUMIII) += -march=i686 $(call tune,pentium3) | 20 | cflags-$(CONFIG_MPENTIUMIII) += -march=i686 $(call tune,pentium3) |
@@ -23,8 +23,8 @@ cflags-$(CONFIG_MPENTIUM4) += -march=i686 $(call tune,pentium4) | |||
23 | cflags-$(CONFIG_MK6) += -march=k6 | 23 | cflags-$(CONFIG_MK6) += -march=k6 |
24 | # Please note, that patches that add -march=athlon-xp and friends are pointless. | 24 | # Please note, that patches that add -march=athlon-xp and friends are pointless. |
25 | # They make zero difference whatsosever to performance at this time. | 25 | # They make zero difference whatsosever to performance at this time. |
26 | cflags-$(CONFIG_MK7) += $(call cc-option,-march=athlon,-march=i686 $(align)-functions=4) | 26 | cflags-$(CONFIG_MK7) += -march=athlon |
27 | cflags-$(CONFIG_MK8) += $(call cc-option,-march=k8,$(call cc-option,-march=athlon,-march=i686 $(align)-functions=4)) | 27 | cflags-$(CONFIG_MK8) += $(call cc-option,-march=k8,-march=athlon) |
28 | cflags-$(CONFIG_MCRUSOE) += -march=i686 $(align)-functions=0 $(align)-jumps=0 $(align)-loops=0 | 28 | cflags-$(CONFIG_MCRUSOE) += -march=i686 $(align)-functions=0 $(align)-jumps=0 $(align)-loops=0 |
29 | cflags-$(CONFIG_MEFFICEON) += -march=i686 $(call tune,pentium3) $(align)-functions=0 $(align)-jumps=0 $(align)-loops=0 | 29 | cflags-$(CONFIG_MEFFICEON) += -march=i686 $(call tune,pentium3) $(align)-functions=0 $(align)-jumps=0 $(align)-loops=0 |
30 | cflags-$(CONFIG_MWINCHIPC6) += $(call cc-option,-march=winchip-c6,-march=i586) | 30 | cflags-$(CONFIG_MWINCHIPC6) += $(call cc-option,-march=winchip-c6,-march=i586) |
@@ -37,5 +37,5 @@ cflags-$(CONFIG_MVIAC3_2) += $(call cc-option,-march=c3-2,-march=i686) | |||
37 | cflags-$(CONFIG_X86_ELAN) += -march=i486 | 37 | cflags-$(CONFIG_X86_ELAN) += -march=i486 |
38 | 38 | ||
39 | # Geode GX1 support | 39 | # Geode GX1 support |
40 | cflags-$(CONFIG_MGEODEGX1) += $(call cc-option,-march=pentium-mmx,-march=i486) | 40 | cflags-$(CONFIG_MGEODEGX1) += -march=pentium-mmx |
41 | 41 | ||
diff --git a/arch/i386/boot/Makefile b/arch/i386/boot/Makefile index 1e71382d413a..f136752563b1 100644 --- a/arch/i386/boot/Makefile +++ b/arch/i386/boot/Makefile | |||
@@ -100,5 +100,5 @@ zlilo: $(BOOTIMAGE) | |||
100 | cp System.map $(INSTALL_PATH)/ | 100 | cp System.map $(INSTALL_PATH)/ |
101 | if [ -x /sbin/lilo ]; then /sbin/lilo; else /etc/lilo/install; fi | 101 | if [ -x /sbin/lilo ]; then /sbin/lilo; else /etc/lilo/install; fi |
102 | 102 | ||
103 | install: $(BOOTIMAGE) | 103 | install: |
104 | sh $(srctree)/$(src)/install.sh $(KERNELRELEASE) $< System.map "$(INSTALL_PATH)" | 104 | sh $(srctree)/$(src)/install.sh $(KERNELRELEASE) $(BOOTIMAGE) System.map "$(INSTALL_PATH)" |
diff --git a/arch/i386/boot/compressed/misc.c b/arch/i386/boot/compressed/misc.c index 82a807f9f5e6..f19f3a7492a5 100644 --- a/arch/i386/boot/compressed/misc.c +++ b/arch/i386/boot/compressed/misc.c | |||
@@ -11,7 +11,7 @@ | |||
11 | 11 | ||
12 | #include <linux/linkage.h> | 12 | #include <linux/linkage.h> |
13 | #include <linux/vmalloc.h> | 13 | #include <linux/vmalloc.h> |
14 | #include <linux/tty.h> | 14 | #include <linux/screen_info.h> |
15 | #include <asm/io.h> | 15 | #include <asm/io.h> |
16 | #include <asm/page.h> | 16 | #include <asm/page.h> |
17 | 17 | ||
diff --git a/arch/i386/boot/install.sh b/arch/i386/boot/install.sh index f17b40dfc0f4..5e44c736eea8 100644 --- a/arch/i386/boot/install.sh +++ b/arch/i386/boot/install.sh | |||
@@ -19,6 +19,20 @@ | |||
19 | # $4 - default install path (blank if root directory) | 19 | # $4 - default install path (blank if root directory) |
20 | # | 20 | # |
21 | 21 | ||
22 | verify () { | ||
23 | if [ ! -f "$1" ]; then | ||
24 | echo "" 1>&2 | ||
25 | echo " *** Missing file: $1" 1>&2 | ||
26 | echo ' *** You need to run "make" before "make install".' 1>&2 | ||
27 | echo "" 1>&2 | ||
28 | exit 1 | ||
29 | fi | ||
30 | } | ||
31 | |||
32 | # Make sure the files actually exist | ||
33 | verify "$2" | ||
34 | verify "$3" | ||
35 | |||
22 | # User may have a custom install script | 36 | # User may have a custom install script |
23 | 37 | ||
24 | if [ -x ~/bin/${CROSS_COMPILE}installkernel ]; then exec ~/bin/${CROSS_COMPILE}installkernel "$@"; fi | 38 | if [ -x ~/bin/${CROSS_COMPILE}installkernel ]; then exec ~/bin/${CROSS_COMPILE}installkernel "$@"; fi |
diff --git a/arch/i386/boot/video.S b/arch/i386/boot/video.S index 92f669470142..2ac40c8244c4 100644 --- a/arch/i386/boot/video.S +++ b/arch/i386/boot/video.S | |||
@@ -97,7 +97,6 @@ | |||
97 | #define PARAM_VESAPM_OFF 0x30 | 97 | #define PARAM_VESAPM_OFF 0x30 |
98 | #define PARAM_LFB_PAGES 0x32 | 98 | #define PARAM_LFB_PAGES 0x32 |
99 | #define PARAM_VESA_ATTRIB 0x34 | 99 | #define PARAM_VESA_ATTRIB 0x34 |
100 | #define PARAM_CAPABILITIES 0x36 | ||
101 | 100 | ||
102 | /* Define DO_STORE according to CONFIG_VIDEO_RETAIN */ | 101 | /* Define DO_STORE according to CONFIG_VIDEO_RETAIN */ |
103 | #ifdef CONFIG_VIDEO_RETAIN | 102 | #ifdef CONFIG_VIDEO_RETAIN |
@@ -234,10 +233,6 @@ mopar_gr: | |||
234 | movw 18(%di), %ax | 233 | movw 18(%di), %ax |
235 | movl %eax, %fs:(PARAM_LFB_SIZE) | 234 | movl %eax, %fs:(PARAM_LFB_SIZE) |
236 | 235 | ||
237 | # store mode capabilities | ||
238 | movl 10(%di), %eax | ||
239 | movl %eax, %fs:(PARAM_CAPABILITIES) | ||
240 | |||
241 | # switching the DAC to 8-bit is for <= 8 bpp only | 236 | # switching the DAC to 8-bit is for <= 8 bpp only |
242 | movw %fs:(PARAM_LFB_DEPTH), %ax | 237 | movw %fs:(PARAM_LFB_DEPTH), %ax |
243 | cmpw $8, %ax | 238 | cmpw $8, %ax |
diff --git a/arch/i386/crypto/aes-i586-asm.S b/arch/i386/crypto/aes-i586-asm.S index 7b73c67cb4e8..911b15377f2e 100644 --- a/arch/i386/crypto/aes-i586-asm.S +++ b/arch/i386/crypto/aes-i586-asm.S | |||
@@ -255,18 +255,17 @@ aes_enc_blk: | |||
255 | xor 8(%ebp),%r4 | 255 | xor 8(%ebp),%r4 |
256 | xor 12(%ebp),%r5 | 256 | xor 12(%ebp),%r5 |
257 | 257 | ||
258 | sub $8,%esp // space for register saves on stack | 258 | sub $8,%esp // space for register saves on stack |
259 | add $16,%ebp // increment to next round key | 259 | add $16,%ebp // increment to next round key |
260 | sub $10,%r3 | 260 | cmp $12,%r3 |
261 | je 4f // 10 rounds for 128-bit key | 261 | jb 4f // 10 rounds for 128-bit key |
262 | add $32,%ebp | 262 | lea 32(%ebp),%ebp |
263 | sub $2,%r3 | 263 | je 3f // 12 rounds for 192-bit key |
264 | je 3f // 12 rounds for 128-bit key | 264 | lea 32(%ebp),%ebp |
265 | add $32,%ebp | 265 | |
266 | 266 | 2: fwd_rnd1( -64(%ebp) ,ft_tab) // 14 rounds for 256-bit key | |
267 | 2: fwd_rnd1( -64(%ebp) ,ft_tab) // 14 rounds for 128-bit key | ||
268 | fwd_rnd2( -48(%ebp) ,ft_tab) | 267 | fwd_rnd2( -48(%ebp) ,ft_tab) |
269 | 3: fwd_rnd1( -32(%ebp) ,ft_tab) // 12 rounds for 128-bit key | 268 | 3: fwd_rnd1( -32(%ebp) ,ft_tab) // 12 rounds for 192-bit key |
270 | fwd_rnd2( -16(%ebp) ,ft_tab) | 269 | fwd_rnd2( -16(%ebp) ,ft_tab) |
271 | 4: fwd_rnd1( (%ebp) ,ft_tab) // 10 rounds for 128-bit key | 270 | 4: fwd_rnd1( (%ebp) ,ft_tab) // 10 rounds for 128-bit key |
272 | fwd_rnd2( +16(%ebp) ,ft_tab) | 271 | fwd_rnd2( +16(%ebp) ,ft_tab) |
@@ -334,18 +333,17 @@ aes_dec_blk: | |||
334 | xor 8(%ebp),%r4 | 333 | xor 8(%ebp),%r4 |
335 | xor 12(%ebp),%r5 | 334 | xor 12(%ebp),%r5 |
336 | 335 | ||
337 | sub $8,%esp // space for register saves on stack | 336 | sub $8,%esp // space for register saves on stack |
338 | sub $16,%ebp // increment to next round key | 337 | sub $16,%ebp // increment to next round key |
339 | sub $10,%r3 | 338 | cmp $12,%r3 |
340 | je 4f // 10 rounds for 128-bit key | 339 | jb 4f // 10 rounds for 128-bit key |
341 | sub $32,%ebp | 340 | lea -32(%ebp),%ebp |
342 | sub $2,%r3 | 341 | je 3f // 12 rounds for 192-bit key |
343 | je 3f // 12 rounds for 128-bit key | 342 | lea -32(%ebp),%ebp |
344 | sub $32,%ebp | ||
345 | 343 | ||
346 | 2: inv_rnd1( +64(%ebp), it_tab) // 14 rounds for 128-bit key | 344 | 2: inv_rnd1( +64(%ebp), it_tab) // 14 rounds for 256-bit key |
347 | inv_rnd2( +48(%ebp), it_tab) | 345 | inv_rnd2( +48(%ebp), it_tab) |
348 | 3: inv_rnd1( +32(%ebp), it_tab) // 12 rounds for 128-bit key | 346 | 3: inv_rnd1( +32(%ebp), it_tab) // 12 rounds for 192-bit key |
349 | inv_rnd2( +16(%ebp), it_tab) | 347 | inv_rnd2( +16(%ebp), it_tab) |
350 | 4: inv_rnd1( (%ebp), it_tab) // 10 rounds for 128-bit key | 348 | 4: inv_rnd1( (%ebp), it_tab) // 10 rounds for 128-bit key |
351 | inv_rnd2( -16(%ebp), it_tab) | 349 | inv_rnd2( -16(%ebp), it_tab) |
diff --git a/arch/i386/crypto/aes.c b/arch/i386/crypto/aes.c index 88ee85c3b43b..a50397b1d5c7 100644 --- a/arch/i386/crypto/aes.c +++ b/arch/i386/crypto/aes.c | |||
@@ -36,6 +36,8 @@ | |||
36 | * Copyright (c) 2004 Red Hat, Inc., James Morris <jmorris@redhat.com> | 36 | * Copyright (c) 2004 Red Hat, Inc., James Morris <jmorris@redhat.com> |
37 | * | 37 | * |
38 | */ | 38 | */ |
39 | |||
40 | #include <asm/byteorder.h> | ||
39 | #include <linux/kernel.h> | 41 | #include <linux/kernel.h> |
40 | #include <linux/module.h> | 42 | #include <linux/module.h> |
41 | #include <linux/init.h> | 43 | #include <linux/init.h> |
@@ -59,7 +61,6 @@ struct aes_ctx { | |||
59 | }; | 61 | }; |
60 | 62 | ||
61 | #define WPOLY 0x011b | 63 | #define WPOLY 0x011b |
62 | #define u32_in(x) le32_to_cpup((const __le32 *)(x)) | ||
63 | #define bytes2word(b0, b1, b2, b3) \ | 64 | #define bytes2word(b0, b1, b2, b3) \ |
64 | (((u32)(b3) << 24) | ((u32)(b2) << 16) | ((u32)(b1) << 8) | (b0)) | 65 | (((u32)(b3) << 24) | ((u32)(b2) << 16) | ((u32)(b1) << 8) | (b0)) |
65 | 66 | ||
@@ -93,7 +94,6 @@ static u32 rcon_tab[RC_LENGTH]; | |||
93 | 94 | ||
94 | u32 ft_tab[4][256]; | 95 | u32 ft_tab[4][256]; |
95 | u32 fl_tab[4][256]; | 96 | u32 fl_tab[4][256]; |
96 | static u32 ls_tab[4][256]; | ||
97 | static u32 im_tab[4][256]; | 97 | static u32 im_tab[4][256]; |
98 | u32 il_tab[4][256]; | 98 | u32 il_tab[4][256]; |
99 | u32 it_tab[4][256]; | 99 | u32 it_tab[4][256]; |
@@ -144,15 +144,6 @@ static void gen_tabs(void) | |||
144 | fl_tab[2][i] = upr(w, 2); | 144 | fl_tab[2][i] = upr(w, 2); |
145 | fl_tab[3][i] = upr(w, 3); | 145 | fl_tab[3][i] = upr(w, 3); |
146 | 146 | ||
147 | /* | ||
148 | * table for key schedule if fl_tab above is | ||
149 | * not of the required form | ||
150 | */ | ||
151 | ls_tab[0][i] = w; | ||
152 | ls_tab[1][i] = upr(w, 1); | ||
153 | ls_tab[2][i] = upr(w, 2); | ||
154 | ls_tab[3][i] = upr(w, 3); | ||
155 | |||
156 | b = fi(inv_affine((u8)i)); | 147 | b = fi(inv_affine((u8)i)); |
157 | w = bytes2word(fe(b), f9(b), fd(b), fb(b)); | 148 | w = bytes2word(fe(b), f9(b), fd(b), fb(b)); |
158 | 149 | ||
@@ -393,13 +384,14 @@ aes_set_key(void *ctx_arg, const u8 *in_key, unsigned int key_len, u32 *flags) | |||
393 | int i; | 384 | int i; |
394 | u32 ss[8]; | 385 | u32 ss[8]; |
395 | struct aes_ctx *ctx = ctx_arg; | 386 | struct aes_ctx *ctx = ctx_arg; |
387 | const __le32 *key = (const __le32 *)in_key; | ||
396 | 388 | ||
397 | /* encryption schedule */ | 389 | /* encryption schedule */ |
398 | 390 | ||
399 | ctx->ekey[0] = ss[0] = u32_in(in_key); | 391 | ctx->ekey[0] = ss[0] = le32_to_cpu(key[0]); |
400 | ctx->ekey[1] = ss[1] = u32_in(in_key + 4); | 392 | ctx->ekey[1] = ss[1] = le32_to_cpu(key[1]); |
401 | ctx->ekey[2] = ss[2] = u32_in(in_key + 8); | 393 | ctx->ekey[2] = ss[2] = le32_to_cpu(key[2]); |
402 | ctx->ekey[3] = ss[3] = u32_in(in_key + 12); | 394 | ctx->ekey[3] = ss[3] = le32_to_cpu(key[3]); |
403 | 395 | ||
404 | switch(key_len) { | 396 | switch(key_len) { |
405 | case 16: | 397 | case 16: |
@@ -410,8 +402,8 @@ aes_set_key(void *ctx_arg, const u8 *in_key, unsigned int key_len, u32 *flags) | |||
410 | break; | 402 | break; |
411 | 403 | ||
412 | case 24: | 404 | case 24: |
413 | ctx->ekey[4] = ss[4] = u32_in(in_key + 16); | 405 | ctx->ekey[4] = ss[4] = le32_to_cpu(key[4]); |
414 | ctx->ekey[5] = ss[5] = u32_in(in_key + 20); | 406 | ctx->ekey[5] = ss[5] = le32_to_cpu(key[5]); |
415 | for (i = 0; i < 7; i++) | 407 | for (i = 0; i < 7; i++) |
416 | ke6(ctx->ekey, i); | 408 | ke6(ctx->ekey, i); |
417 | kel6(ctx->ekey, 7); | 409 | kel6(ctx->ekey, 7); |
@@ -419,10 +411,10 @@ aes_set_key(void *ctx_arg, const u8 *in_key, unsigned int key_len, u32 *flags) | |||
419 | break; | 411 | break; |
420 | 412 | ||
421 | case 32: | 413 | case 32: |
422 | ctx->ekey[4] = ss[4] = u32_in(in_key + 16); | 414 | ctx->ekey[4] = ss[4] = le32_to_cpu(key[4]); |
423 | ctx->ekey[5] = ss[5] = u32_in(in_key + 20); | 415 | ctx->ekey[5] = ss[5] = le32_to_cpu(key[5]); |
424 | ctx->ekey[6] = ss[6] = u32_in(in_key + 24); | 416 | ctx->ekey[6] = ss[6] = le32_to_cpu(key[6]); |
425 | ctx->ekey[7] = ss[7] = u32_in(in_key + 28); | 417 | ctx->ekey[7] = ss[7] = le32_to_cpu(key[7]); |
426 | for (i = 0; i < 6; i++) | 418 | for (i = 0; i < 6; i++) |
427 | ke8(ctx->ekey, i); | 419 | ke8(ctx->ekey, i); |
428 | kel8(ctx->ekey, 6); | 420 | kel8(ctx->ekey, 6); |
@@ -436,10 +428,10 @@ aes_set_key(void *ctx_arg, const u8 *in_key, unsigned int key_len, u32 *flags) | |||
436 | 428 | ||
437 | /* decryption schedule */ | 429 | /* decryption schedule */ |
438 | 430 | ||
439 | ctx->dkey[0] = ss[0] = u32_in(in_key); | 431 | ctx->dkey[0] = ss[0] = le32_to_cpu(key[0]); |
440 | ctx->dkey[1] = ss[1] = u32_in(in_key + 4); | 432 | ctx->dkey[1] = ss[1] = le32_to_cpu(key[1]); |
441 | ctx->dkey[2] = ss[2] = u32_in(in_key + 8); | 433 | ctx->dkey[2] = ss[2] = le32_to_cpu(key[2]); |
442 | ctx->dkey[3] = ss[3] = u32_in(in_key + 12); | 434 | ctx->dkey[3] = ss[3] = le32_to_cpu(key[3]); |
443 | 435 | ||
444 | switch (key_len) { | 436 | switch (key_len) { |
445 | case 16: | 437 | case 16: |
@@ -450,8 +442,8 @@ aes_set_key(void *ctx_arg, const u8 *in_key, unsigned int key_len, u32 *flags) | |||
450 | break; | 442 | break; |
451 | 443 | ||
452 | case 24: | 444 | case 24: |
453 | ctx->dkey[4] = ff(ss[4] = u32_in(in_key + 16)); | 445 | ctx->dkey[4] = ff(ss[4] = le32_to_cpu(key[4])); |
454 | ctx->dkey[5] = ff(ss[5] = u32_in(in_key + 20)); | 446 | ctx->dkey[5] = ff(ss[5] = le32_to_cpu(key[5])); |
455 | kdf6(ctx->dkey, 0); | 447 | kdf6(ctx->dkey, 0); |
456 | for (i = 1; i < 7; i++) | 448 | for (i = 1; i < 7; i++) |
457 | kd6(ctx->dkey, i); | 449 | kd6(ctx->dkey, i); |
@@ -459,10 +451,10 @@ aes_set_key(void *ctx_arg, const u8 *in_key, unsigned int key_len, u32 *flags) | |||
459 | break; | 451 | break; |
460 | 452 | ||
461 | case 32: | 453 | case 32: |
462 | ctx->dkey[4] = ff(ss[4] = u32_in(in_key + 16)); | 454 | ctx->dkey[4] = ff(ss[4] = le32_to_cpu(key[4])); |
463 | ctx->dkey[5] = ff(ss[5] = u32_in(in_key + 20)); | 455 | ctx->dkey[5] = ff(ss[5] = le32_to_cpu(key[5])); |
464 | ctx->dkey[6] = ff(ss[6] = u32_in(in_key + 24)); | 456 | ctx->dkey[6] = ff(ss[6] = le32_to_cpu(key[6])); |
465 | ctx->dkey[7] = ff(ss[7] = u32_in(in_key + 28)); | 457 | ctx->dkey[7] = ff(ss[7] = le32_to_cpu(key[7])); |
466 | kdf8(ctx->dkey, 0); | 458 | kdf8(ctx->dkey, 0); |
467 | for (i = 1; i < 6; i++) | 459 | for (i = 1; i < 6; i++) |
468 | kd8(ctx->dkey, i); | 460 | kd8(ctx->dkey, i); |
@@ -484,6 +476,8 @@ static inline void aes_decrypt(void *ctx, u8 *dst, const u8 *src) | |||
484 | 476 | ||
485 | static struct crypto_alg aes_alg = { | 477 | static struct crypto_alg aes_alg = { |
486 | .cra_name = "aes", | 478 | .cra_name = "aes", |
479 | .cra_driver_name = "aes-i586", | ||
480 | .cra_priority = 200, | ||
487 | .cra_flags = CRYPTO_ALG_TYPE_CIPHER, | 481 | .cra_flags = CRYPTO_ALG_TYPE_CIPHER, |
488 | .cra_blocksize = AES_BLOCK_SIZE, | 482 | .cra_blocksize = AES_BLOCK_SIZE, |
489 | .cra_ctxsize = sizeof(struct aes_ctx), | 483 | .cra_ctxsize = sizeof(struct aes_ctx), |
diff --git a/arch/i386/defconfig b/arch/i386/defconfig index 6a431b926019..3cbe6e9cb9fc 100644 --- a/arch/i386/defconfig +++ b/arch/i386/defconfig | |||
@@ -644,6 +644,8 @@ CONFIG_8139TOO_PIO=y | |||
644 | # CONFIG_ACENIC is not set | 644 | # CONFIG_ACENIC is not set |
645 | # CONFIG_DL2K is not set | 645 | # CONFIG_DL2K is not set |
646 | # CONFIG_E1000 is not set | 646 | # CONFIG_E1000 is not set |
647 | # CONFIG_E1000_NAPI is not set | ||
648 | # CONFIG_E1000_DISABLE_PACKET_SPLIT is not set | ||
647 | # CONFIG_NS83820 is not set | 649 | # CONFIG_NS83820 is not set |
648 | # CONFIG_HAMACHI is not set | 650 | # CONFIG_HAMACHI is not set |
649 | # CONFIG_YELLOWFIN is not set | 651 | # CONFIG_YELLOWFIN is not set |
diff --git a/arch/i386/kernel/Makefile b/arch/i386/kernel/Makefile index f10de0f2c5e6..60c3f76dfca4 100644 --- a/arch/i386/kernel/Makefile +++ b/arch/i386/kernel/Makefile | |||
@@ -4,10 +4,10 @@ | |||
4 | 4 | ||
5 | extra-y := head.o init_task.o vmlinux.lds | 5 | extra-y := head.o init_task.o vmlinux.lds |
6 | 6 | ||
7 | obj-y := process.o semaphore.o signal.o entry.o traps.o irq.o vm86.o \ | 7 | obj-y := process.o semaphore.o signal.o entry.o traps.o irq.o \ |
8 | ptrace.o time.o ioport.o ldt.o setup.o i8259.o sys_i386.o \ | 8 | ptrace.o time.o ioport.o ldt.o setup.o i8259.o sys_i386.o \ |
9 | pci-dma.o i386_ksyms.o i387.o dmi_scan.o bootflag.o \ | 9 | pci-dma.o i386_ksyms.o i387.o dmi_scan.o bootflag.o \ |
10 | doublefault.o quirks.o i8237.o | 10 | quirks.o i8237.o |
11 | 11 | ||
12 | obj-y += cpu/ | 12 | obj-y += cpu/ |
13 | obj-y += timers/ | 13 | obj-y += timers/ |
@@ -25,6 +25,7 @@ obj-$(CONFIG_X86_LOCAL_APIC) += apic.o nmi.o | |||
25 | obj-$(CONFIG_X86_IO_APIC) += io_apic.o | 25 | obj-$(CONFIG_X86_IO_APIC) += io_apic.o |
26 | obj-$(CONFIG_X86_REBOOTFIXUPS) += reboot_fixups.o | 26 | obj-$(CONFIG_X86_REBOOTFIXUPS) += reboot_fixups.o |
27 | obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o crash.o | 27 | obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o crash.o |
28 | obj-$(CONFIG_CRASH_DUMP) += crash_dump.o | ||
28 | obj-$(CONFIG_X86_NUMAQ) += numaq.o | 29 | obj-$(CONFIG_X86_NUMAQ) += numaq.o |
29 | obj-$(CONFIG_X86_SUMMIT_NUMA) += summit.o | 30 | obj-$(CONFIG_X86_SUMMIT_NUMA) += summit.o |
30 | obj-$(CONFIG_KPROBES) += kprobes.o | 31 | obj-$(CONFIG_KPROBES) += kprobes.o |
@@ -33,6 +34,8 @@ obj-y += sysenter.o vsyscall.o | |||
33 | obj-$(CONFIG_ACPI_SRAT) += srat.o | 34 | obj-$(CONFIG_ACPI_SRAT) += srat.o |
34 | obj-$(CONFIG_HPET_TIMER) += time_hpet.o | 35 | obj-$(CONFIG_HPET_TIMER) += time_hpet.o |
35 | obj-$(CONFIG_EFI) += efi.o efi_stub.o | 36 | obj-$(CONFIG_EFI) += efi.o efi_stub.o |
37 | obj-$(CONFIG_DOUBLEFAULT) += doublefault.o | ||
38 | obj-$(CONFIG_VM86) += vm86.o | ||
36 | obj-$(CONFIG_EARLY_PRINTK) += early_printk.o | 39 | obj-$(CONFIG_EARLY_PRINTK) += early_printk.o |
37 | 40 | ||
38 | EXTRA_AFLAGS := -traditional | 41 | EXTRA_AFLAGS := -traditional |
diff --git a/arch/i386/kernel/acpi/Makefile b/arch/i386/kernel/acpi/Makefile index 267ca48e1b6c..d51c7313cae8 100644 --- a/arch/i386/kernel/acpi/Makefile +++ b/arch/i386/kernel/acpi/Makefile | |||
@@ -3,6 +3,6 @@ obj-$(CONFIG_X86_IO_APIC) += earlyquirk.o | |||
3 | obj-$(CONFIG_ACPI_SLEEP) += sleep.o wakeup.o | 3 | obj-$(CONFIG_ACPI_SLEEP) += sleep.o wakeup.o |
4 | 4 | ||
5 | ifneq ($(CONFIG_ACPI_PROCESSOR),) | 5 | ifneq ($(CONFIG_ACPI_PROCESSOR),) |
6 | obj-y += cstate.o | 6 | obj-y += cstate.o processor.o |
7 | endif | 7 | endif |
8 | 8 | ||
diff --git a/arch/i386/kernel/acpi/boot.c b/arch/i386/kernel/acpi/boot.c index 76b1135d401a..f21fa0d4482f 100644 --- a/arch/i386/kernel/acpi/boot.c +++ b/arch/i386/kernel/acpi/boot.c | |||
@@ -108,7 +108,7 @@ char *__acpi_map_table(unsigned long phys_addr, unsigned long size) | |||
108 | if (!phys_addr || !size) | 108 | if (!phys_addr || !size) |
109 | return NULL; | 109 | return NULL; |
110 | 110 | ||
111 | if (phys_addr < (end_pfn_map << PAGE_SHIFT)) | 111 | if (phys_addr+size <= (end_pfn_map << PAGE_SHIFT) + PAGE_SIZE) |
112 | return __va(phys_addr); | 112 | return __va(phys_addr); |
113 | 113 | ||
114 | return NULL; | 114 | return NULL; |
@@ -464,7 +464,7 @@ int acpi_gsi_to_irq(u32 gsi, unsigned int *irq) | |||
464 | * success: return IRQ number (>=0) | 464 | * success: return IRQ number (>=0) |
465 | * failure: return < 0 | 465 | * failure: return < 0 |
466 | */ | 466 | */ |
467 | int acpi_register_gsi(u32 gsi, int edge_level, int active_high_low) | 467 | int acpi_register_gsi(u32 gsi, int triggering, int polarity) |
468 | { | 468 | { |
469 | unsigned int irq; | 469 | unsigned int irq; |
470 | unsigned int plat_gsi = gsi; | 470 | unsigned int plat_gsi = gsi; |
@@ -476,14 +476,14 @@ int acpi_register_gsi(u32 gsi, int edge_level, int active_high_low) | |||
476 | if (acpi_irq_model == ACPI_IRQ_MODEL_PIC) { | 476 | if (acpi_irq_model == ACPI_IRQ_MODEL_PIC) { |
477 | extern void eisa_set_level_irq(unsigned int irq); | 477 | extern void eisa_set_level_irq(unsigned int irq); |
478 | 478 | ||
479 | if (edge_level == ACPI_LEVEL_SENSITIVE) | 479 | if (triggering == ACPI_LEVEL_SENSITIVE) |
480 | eisa_set_level_irq(gsi); | 480 | eisa_set_level_irq(gsi); |
481 | } | 481 | } |
482 | #endif | 482 | #endif |
483 | 483 | ||
484 | #ifdef CONFIG_X86_IO_APIC | 484 | #ifdef CONFIG_X86_IO_APIC |
485 | if (acpi_irq_model == ACPI_IRQ_MODEL_IOAPIC) { | 485 | if (acpi_irq_model == ACPI_IRQ_MODEL_IOAPIC) { |
486 | plat_gsi = mp_register_gsi(gsi, edge_level, active_high_low); | 486 | plat_gsi = mp_register_gsi(gsi, triggering, polarity); |
487 | } | 487 | } |
488 | #endif | 488 | #endif |
489 | acpi_gsi_to_irq(plat_gsi, &irq); | 489 | acpi_gsi_to_irq(plat_gsi, &irq); |
@@ -638,6 +638,13 @@ static int __init acpi_parse_fadt(unsigned long phys, unsigned long size) | |||
638 | return 0; | 638 | return 0; |
639 | 639 | ||
640 | pmtmr_ioport = fadt->xpm_tmr_blk.address; | 640 | pmtmr_ioport = fadt->xpm_tmr_blk.address; |
641 | /* | ||
642 | * "X" fields are optional extensions to the original V1.0 | ||
643 | * fields, so we must selectively expand V1.0 fields if the | ||
644 | * corresponding X field is zero. | ||
645 | */ | ||
646 | if (!pmtmr_ioport) | ||
647 | pmtmr_ioport = fadt->V1_pm_tmr_blk; | ||
641 | } else { | 648 | } else { |
642 | /* FADT rev. 1 */ | 649 | /* FADT rev. 1 */ |
643 | pmtmr_ioport = fadt->V1_pm_tmr_blk; | 650 | pmtmr_ioport = fadt->V1_pm_tmr_blk; |
diff --git a/arch/i386/kernel/acpi/cstate.c b/arch/i386/kernel/acpi/cstate.c index 4c3036ba65df..25db49ef1770 100644 --- a/arch/i386/kernel/acpi/cstate.c +++ b/arch/i386/kernel/acpi/cstate.c | |||
@@ -14,64 +14,6 @@ | |||
14 | #include <acpi/processor.h> | 14 | #include <acpi/processor.h> |
15 | #include <asm/acpi.h> | 15 | #include <asm/acpi.h> |
16 | 16 | ||
17 | static void acpi_processor_power_init_intel_pdc(struct acpi_processor_power | ||
18 | *pow) | ||
19 | { | ||
20 | struct acpi_object_list *obj_list; | ||
21 | union acpi_object *obj; | ||
22 | u32 *buf; | ||
23 | |||
24 | /* allocate and initialize pdc. It will be used later. */ | ||
25 | obj_list = kmalloc(sizeof(struct acpi_object_list), GFP_KERNEL); | ||
26 | if (!obj_list) { | ||
27 | printk(KERN_ERR "Memory allocation error\n"); | ||
28 | return; | ||
29 | } | ||
30 | |||
31 | obj = kmalloc(sizeof(union acpi_object), GFP_KERNEL); | ||
32 | if (!obj) { | ||
33 | printk(KERN_ERR "Memory allocation error\n"); | ||
34 | kfree(obj_list); | ||
35 | return; | ||
36 | } | ||
37 | |||
38 | buf = kmalloc(12, GFP_KERNEL); | ||
39 | if (!buf) { | ||
40 | printk(KERN_ERR "Memory allocation error\n"); | ||
41 | kfree(obj); | ||
42 | kfree(obj_list); | ||
43 | return; | ||
44 | } | ||
45 | |||
46 | buf[0] = ACPI_PDC_REVISION_ID; | ||
47 | buf[1] = 1; | ||
48 | buf[2] = ACPI_PDC_C_CAPABILITY_SMP; | ||
49 | |||
50 | obj->type = ACPI_TYPE_BUFFER; | ||
51 | obj->buffer.length = 12; | ||
52 | obj->buffer.pointer = (u8 *) buf; | ||
53 | obj_list->count = 1; | ||
54 | obj_list->pointer = obj; | ||
55 | pow->pdc = obj_list; | ||
56 | |||
57 | return; | ||
58 | } | ||
59 | |||
60 | /* Initialize _PDC data based on the CPU vendor */ | ||
61 | void acpi_processor_power_init_pdc(struct acpi_processor_power *pow, | ||
62 | unsigned int cpu) | ||
63 | { | ||
64 | struct cpuinfo_x86 *c = cpu_data + cpu; | ||
65 | |||
66 | pow->pdc = NULL; | ||
67 | if (c->x86_vendor == X86_VENDOR_INTEL) | ||
68 | acpi_processor_power_init_intel_pdc(pow); | ||
69 | |||
70 | return; | ||
71 | } | ||
72 | |||
73 | EXPORT_SYMBOL(acpi_processor_power_init_pdc); | ||
74 | |||
75 | /* | 17 | /* |
76 | * Initialize bm_flags based on the CPU cache properties | 18 | * Initialize bm_flags based on the CPU cache properties |
77 | * On SMP it depends on cache configuration | 19 | * On SMP it depends on cache configuration |
diff --git a/arch/i386/kernel/acpi/processor.c b/arch/i386/kernel/acpi/processor.c new file mode 100644 index 000000000000..9f4cc02717ec --- /dev/null +++ b/arch/i386/kernel/acpi/processor.c | |||
@@ -0,0 +1,75 @@ | |||
1 | /* | ||
2 | * arch/i386/kernel/acpi/processor.c | ||
3 | * | ||
4 | * Copyright (C) 2005 Intel Corporation | ||
5 | * Venkatesh Pallipadi <venkatesh.pallipadi@intel.com> | ||
6 | * - Added _PDC for platforms with Intel CPUs | ||
7 | */ | ||
8 | |||
9 | #include <linux/kernel.h> | ||
10 | #include <linux/module.h> | ||
11 | #include <linux/init.h> | ||
12 | #include <linux/acpi.h> | ||
13 | |||
14 | #include <acpi/processor.h> | ||
15 | #include <asm/acpi.h> | ||
16 | |||
17 | static void init_intel_pdc(struct acpi_processor *pr, struct cpuinfo_x86 *c) | ||
18 | { | ||
19 | struct acpi_object_list *obj_list; | ||
20 | union acpi_object *obj; | ||
21 | u32 *buf; | ||
22 | |||
23 | /* allocate and initialize pdc. It will be used later. */ | ||
24 | obj_list = kmalloc(sizeof(struct acpi_object_list), GFP_KERNEL); | ||
25 | if (!obj_list) { | ||
26 | printk(KERN_ERR "Memory allocation error\n"); | ||
27 | return; | ||
28 | } | ||
29 | |||
30 | obj = kmalloc(sizeof(union acpi_object), GFP_KERNEL); | ||
31 | if (!obj) { | ||
32 | printk(KERN_ERR "Memory allocation error\n"); | ||
33 | kfree(obj_list); | ||
34 | return; | ||
35 | } | ||
36 | |||
37 | buf = kmalloc(12, GFP_KERNEL); | ||
38 | if (!buf) { | ||
39 | printk(KERN_ERR "Memory allocation error\n"); | ||
40 | kfree(obj); | ||
41 | kfree(obj_list); | ||
42 | return; | ||
43 | } | ||
44 | |||
45 | buf[0] = ACPI_PDC_REVISION_ID; | ||
46 | buf[1] = 1; | ||
47 | buf[2] = ACPI_PDC_C_CAPABILITY_SMP; | ||
48 | |||
49 | if (cpu_has(c, X86_FEATURE_EST)) | ||
50 | buf[2] |= ACPI_PDC_EST_CAPABILITY_SMP; | ||
51 | |||
52 | obj->type = ACPI_TYPE_BUFFER; | ||
53 | obj->buffer.length = 12; | ||
54 | obj->buffer.pointer = (u8 *) buf; | ||
55 | obj_list->count = 1; | ||
56 | obj_list->pointer = obj; | ||
57 | pr->pdc = obj_list; | ||
58 | |||
59 | return; | ||
60 | } | ||
61 | |||
62 | /* Initialize _PDC data based on the CPU vendor */ | ||
63 | void arch_acpi_processor_init_pdc(struct acpi_processor *pr) | ||
64 | { | ||
65 | unsigned int cpu = pr->id; | ||
66 | struct cpuinfo_x86 *c = cpu_data + cpu; | ||
67 | |||
68 | pr->pdc = NULL; | ||
69 | if (c->x86_vendor == X86_VENDOR_INTEL) | ||
70 | init_intel_pdc(pr, c); | ||
71 | |||
72 | return; | ||
73 | } | ||
74 | |||
75 | EXPORT_SYMBOL(arch_acpi_processor_init_pdc); | ||
diff --git a/arch/i386/kernel/apic.c b/arch/i386/kernel/apic.c index 496a2c9909fe..acd3f1e34ca6 100644 --- a/arch/i386/kernel/apic.c +++ b/arch/i386/kernel/apic.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/kernel_stat.h> | 26 | #include <linux/kernel_stat.h> |
27 | #include <linux/sysdev.h> | 27 | #include <linux/sysdev.h> |
28 | #include <linux/cpu.h> | 28 | #include <linux/cpu.h> |
29 | #include <linux/module.h> | ||
29 | 30 | ||
30 | #include <asm/atomic.h> | 31 | #include <asm/atomic.h> |
31 | #include <asm/smp.h> | 32 | #include <asm/smp.h> |
@@ -37,10 +38,17 @@ | |||
37 | #include <asm/i8253.h> | 38 | #include <asm/i8253.h> |
38 | 39 | ||
39 | #include <mach_apic.h> | 40 | #include <mach_apic.h> |
41 | #include <mach_ipi.h> | ||
40 | 42 | ||
41 | #include "io_ports.h" | 43 | #include "io_ports.h" |
42 | 44 | ||
43 | /* | 45 | /* |
46 | * cpu_mask that denotes the CPUs that needs timer interrupt coming in as | ||
47 | * IPIs in place of local APIC timers | ||
48 | */ | ||
49 | static cpumask_t timer_bcast_ipi; | ||
50 | |||
51 | /* | ||
44 | * Knob to control our willingness to enable the local APIC. | 52 | * Knob to control our willingness to enable the local APIC. |
45 | */ | 53 | */ |
46 | int enable_local_apic __initdata = 0; /* -1=force-disable, +1=force-enable */ | 54 | int enable_local_apic __initdata = 0; /* -1=force-disable, +1=force-enable */ |
@@ -92,10 +100,6 @@ void __init apic_intr_init(void) | |||
92 | /* Using APIC to generate smp_local_timer_interrupt? */ | 100 | /* Using APIC to generate smp_local_timer_interrupt? */ |
93 | int using_apic_timer = 0; | 101 | int using_apic_timer = 0; |
94 | 102 | ||
95 | static DEFINE_PER_CPU(int, prof_multiplier) = 1; | ||
96 | static DEFINE_PER_CPU(int, prof_old_multiplier) = 1; | ||
97 | static DEFINE_PER_CPU(int, prof_counter) = 1; | ||
98 | |||
99 | static int enabled_via_apicbase; | 103 | static int enabled_via_apicbase; |
100 | 104 | ||
101 | void enable_NMI_through_LVT0 (void * dummy) | 105 | void enable_NMI_through_LVT0 (void * dummy) |
@@ -721,7 +725,7 @@ static int __init apic_set_verbosity(char *str) | |||
721 | apic_verbosity = APIC_VERBOSE; | 725 | apic_verbosity = APIC_VERBOSE; |
722 | else | 726 | else |
723 | printk(KERN_WARNING "APIC Verbosity level %s not recognised" | 727 | printk(KERN_WARNING "APIC Verbosity level %s not recognised" |
724 | " use apic=verbose or apic=debug", str); | 728 | " use apic=verbose or apic=debug\n", str); |
725 | 729 | ||
726 | return 0; | 730 | return 0; |
727 | } | 731 | } |
@@ -935,11 +939,16 @@ void (*wait_timer_tick)(void) __devinitdata = wait_8254_wraparound; | |||
935 | static void __setup_APIC_LVTT(unsigned int clocks) | 939 | static void __setup_APIC_LVTT(unsigned int clocks) |
936 | { | 940 | { |
937 | unsigned int lvtt_value, tmp_value, ver; | 941 | unsigned int lvtt_value, tmp_value, ver; |
942 | int cpu = smp_processor_id(); | ||
938 | 943 | ||
939 | ver = GET_APIC_VERSION(apic_read(APIC_LVR)); | 944 | ver = GET_APIC_VERSION(apic_read(APIC_LVR)); |
940 | lvtt_value = APIC_LVT_TIMER_PERIODIC | LOCAL_TIMER_VECTOR; | 945 | lvtt_value = APIC_LVT_TIMER_PERIODIC | LOCAL_TIMER_VECTOR; |
941 | if (!APIC_INTEGRATED(ver)) | 946 | if (!APIC_INTEGRATED(ver)) |
942 | lvtt_value |= SET_APIC_TIMER_BASE(APIC_TIMER_BASE_DIV); | 947 | lvtt_value |= SET_APIC_TIMER_BASE(APIC_TIMER_BASE_DIV); |
948 | |||
949 | if (cpu_isset(cpu, timer_bcast_ipi)) | ||
950 | lvtt_value |= APIC_LVT_MASKED; | ||
951 | |||
943 | apic_write_around(APIC_LVTT, lvtt_value); | 952 | apic_write_around(APIC_LVTT, lvtt_value); |
944 | 953 | ||
945 | /* | 954 | /* |
@@ -1072,7 +1081,7 @@ void __devinit setup_secondary_APIC_clock(void) | |||
1072 | setup_APIC_timer(calibration_result); | 1081 | setup_APIC_timer(calibration_result); |
1073 | } | 1082 | } |
1074 | 1083 | ||
1075 | void __devinit disable_APIC_timer(void) | 1084 | void disable_APIC_timer(void) |
1076 | { | 1085 | { |
1077 | if (using_apic_timer) { | 1086 | if (using_apic_timer) { |
1078 | unsigned long v; | 1087 | unsigned long v; |
@@ -1084,7 +1093,10 @@ void __devinit disable_APIC_timer(void) | |||
1084 | 1093 | ||
1085 | void enable_APIC_timer(void) | 1094 | void enable_APIC_timer(void) |
1086 | { | 1095 | { |
1087 | if (using_apic_timer) { | 1096 | int cpu = smp_processor_id(); |
1097 | |||
1098 | if (using_apic_timer && | ||
1099 | !cpu_isset(cpu, timer_bcast_ipi)) { | ||
1088 | unsigned long v; | 1100 | unsigned long v; |
1089 | 1101 | ||
1090 | v = apic_read(APIC_LVTT); | 1102 | v = apic_read(APIC_LVTT); |
@@ -1092,33 +1104,31 @@ void enable_APIC_timer(void) | |||
1092 | } | 1104 | } |
1093 | } | 1105 | } |
1094 | 1106 | ||
1095 | /* | 1107 | void switch_APIC_timer_to_ipi(void *cpumask) |
1096 | * the frequency of the profiling timer can be changed | ||
1097 | * by writing a multiplier value into /proc/profile. | ||
1098 | */ | ||
1099 | int setup_profiling_timer(unsigned int multiplier) | ||
1100 | { | 1108 | { |
1101 | int i; | 1109 | cpumask_t mask = *(cpumask_t *)cpumask; |
1110 | int cpu = smp_processor_id(); | ||
1102 | 1111 | ||
1103 | /* | 1112 | if (cpu_isset(cpu, mask) && |
1104 | * Sanity check. [at least 500 APIC cycles should be | 1113 | !cpu_isset(cpu, timer_bcast_ipi)) { |
1105 | * between APIC interrupts as a rule of thumb, to avoid | 1114 | disable_APIC_timer(); |
1106 | * irqs flooding us] | 1115 | cpu_set(cpu, timer_bcast_ipi); |
1107 | */ | 1116 | } |
1108 | if ( (!multiplier) || (calibration_result/multiplier < 500)) | 1117 | } |
1109 | return -EINVAL; | 1118 | EXPORT_SYMBOL(switch_APIC_timer_to_ipi); |
1110 | |||
1111 | /* | ||
1112 | * Set the new multiplier for each CPU. CPUs don't start using the | ||
1113 | * new values until the next timer interrupt in which they do process | ||
1114 | * accounting. At that time they also adjust their APIC timers | ||
1115 | * accordingly. | ||
1116 | */ | ||
1117 | for (i = 0; i < NR_CPUS; ++i) | ||
1118 | per_cpu(prof_multiplier, i) = multiplier; | ||
1119 | 1119 | ||
1120 | return 0; | 1120 | void switch_ipi_to_APIC_timer(void *cpumask) |
1121 | { | ||
1122 | cpumask_t mask = *(cpumask_t *)cpumask; | ||
1123 | int cpu = smp_processor_id(); | ||
1124 | |||
1125 | if (cpu_isset(cpu, mask) && | ||
1126 | cpu_isset(cpu, timer_bcast_ipi)) { | ||
1127 | cpu_clear(cpu, timer_bcast_ipi); | ||
1128 | enable_APIC_timer(); | ||
1129 | } | ||
1121 | } | 1130 | } |
1131 | EXPORT_SYMBOL(switch_ipi_to_APIC_timer); | ||
1122 | 1132 | ||
1123 | #undef APIC_DIVISOR | 1133 | #undef APIC_DIVISOR |
1124 | 1134 | ||
@@ -1134,32 +1144,10 @@ int setup_profiling_timer(unsigned int multiplier) | |||
1134 | 1144 | ||
1135 | inline void smp_local_timer_interrupt(struct pt_regs * regs) | 1145 | inline void smp_local_timer_interrupt(struct pt_regs * regs) |
1136 | { | 1146 | { |
1137 | int cpu = smp_processor_id(); | ||
1138 | |||
1139 | profile_tick(CPU_PROFILING, regs); | 1147 | profile_tick(CPU_PROFILING, regs); |
1140 | if (--per_cpu(prof_counter, cpu) <= 0) { | ||
1141 | /* | ||
1142 | * The multiplier may have changed since the last time we got | ||
1143 | * to this point as a result of the user writing to | ||
1144 | * /proc/profile. In this case we need to adjust the APIC | ||
1145 | * timer accordingly. | ||
1146 | * | ||
1147 | * Interrupts are already masked off at this point. | ||
1148 | */ | ||
1149 | per_cpu(prof_counter, cpu) = per_cpu(prof_multiplier, cpu); | ||
1150 | if (per_cpu(prof_counter, cpu) != | ||
1151 | per_cpu(prof_old_multiplier, cpu)) { | ||
1152 | __setup_APIC_LVTT( | ||
1153 | calibration_result/ | ||
1154 | per_cpu(prof_counter, cpu)); | ||
1155 | per_cpu(prof_old_multiplier, cpu) = | ||
1156 | per_cpu(prof_counter, cpu); | ||
1157 | } | ||
1158 | |||
1159 | #ifdef CONFIG_SMP | 1148 | #ifdef CONFIG_SMP |
1160 | update_process_times(user_mode_vm(regs)); | 1149 | update_process_times(user_mode_vm(regs)); |
1161 | #endif | 1150 | #endif |
1162 | } | ||
1163 | 1151 | ||
1164 | /* | 1152 | /* |
1165 | * We take the 'long' return path, and there every subsystem | 1153 | * We take the 'long' return path, and there every subsystem |
@@ -1206,6 +1194,43 @@ fastcall void smp_apic_timer_interrupt(struct pt_regs *regs) | |||
1206 | irq_exit(); | 1194 | irq_exit(); |
1207 | } | 1195 | } |
1208 | 1196 | ||
1197 | #ifndef CONFIG_SMP | ||
1198 | static void up_apic_timer_interrupt_call(struct pt_regs *regs) | ||
1199 | { | ||
1200 | int cpu = smp_processor_id(); | ||
1201 | |||
1202 | /* | ||
1203 | * the NMI deadlock-detector uses this. | ||
1204 | */ | ||
1205 | per_cpu(irq_stat, cpu).apic_timer_irqs++; | ||
1206 | |||
1207 | smp_local_timer_interrupt(regs); | ||
1208 | } | ||
1209 | #endif | ||
1210 | |||
1211 | void smp_send_timer_broadcast_ipi(struct pt_regs *regs) | ||
1212 | { | ||
1213 | cpumask_t mask; | ||
1214 | |||
1215 | cpus_and(mask, cpu_online_map, timer_bcast_ipi); | ||
1216 | if (!cpus_empty(mask)) { | ||
1217 | #ifdef CONFIG_SMP | ||
1218 | send_IPI_mask(mask, LOCAL_TIMER_VECTOR); | ||
1219 | #else | ||
1220 | /* | ||
1221 | * We can directly call the apic timer interrupt handler | ||
1222 | * in UP case. Minus all irq related functions | ||
1223 | */ | ||
1224 | up_apic_timer_interrupt_call(regs); | ||
1225 | #endif | ||
1226 | } | ||
1227 | } | ||
1228 | |||
1229 | int setup_profiling_timer(unsigned int multiplier) | ||
1230 | { | ||
1231 | return -EINVAL; | ||
1232 | } | ||
1233 | |||
1209 | /* | 1234 | /* |
1210 | * This interrupt should _never_ happen with our APIC/SMP architecture | 1235 | * This interrupt should _never_ happen with our APIC/SMP architecture |
1211 | */ | 1236 | */ |
diff --git a/arch/i386/kernel/apm.c b/arch/i386/kernel/apm.c index 1e60acbed3c1..05312a8abb8b 100644 --- a/arch/i386/kernel/apm.c +++ b/arch/i386/kernel/apm.c | |||
@@ -219,6 +219,7 @@ | |||
219 | #include <linux/sched.h> | 219 | #include <linux/sched.h> |
220 | #include <linux/pm.h> | 220 | #include <linux/pm.h> |
221 | #include <linux/pm_legacy.h> | 221 | #include <linux/pm_legacy.h> |
222 | #include <linux/capability.h> | ||
222 | #include <linux/device.h> | 223 | #include <linux/device.h> |
223 | #include <linux/kernel.h> | 224 | #include <linux/kernel.h> |
224 | #include <linux/smp.h> | 225 | #include <linux/smp.h> |
@@ -303,17 +304,6 @@ extern int (*console_blank_hook)(int); | |||
303 | #include "apm.h" | 304 | #include "apm.h" |
304 | 305 | ||
305 | /* | 306 | /* |
306 | * Define to make all _set_limit calls use 64k limits. The APM 1.1 BIOS is | ||
307 | * supposed to provide limit information that it recognizes. Many machines | ||
308 | * do this correctly, but many others do not restrict themselves to their | ||
309 | * claimed limit. When this happens, they will cause a segmentation | ||
310 | * violation in the kernel at boot time. Most BIOS's, however, will | ||
311 | * respect a 64k limit, so we use that. If you want to be pedantic and | ||
312 | * hold your BIOS to its claims, then undefine this. | ||
313 | */ | ||
314 | #define APM_RELAX_SEGMENTS | ||
315 | |||
316 | /* | ||
317 | * Define to re-initialize the interrupt 0 timer to 100 Hz after a suspend. | 307 | * Define to re-initialize the interrupt 0 timer to 100 Hz after a suspend. |
318 | * This patched by Chad Miller <cmiller@surfsouth.com>, original code by | 308 | * This patched by Chad Miller <cmiller@surfsouth.com>, original code by |
319 | * David Chen <chen@ctpa04.mit.edu> | 309 | * David Chen <chen@ctpa04.mit.edu> |
@@ -1075,22 +1065,23 @@ static int apm_engage_power_management(u_short device, int enable) | |||
1075 | 1065 | ||
1076 | static int apm_console_blank(int blank) | 1066 | static int apm_console_blank(int blank) |
1077 | { | 1067 | { |
1078 | int error; | 1068 | int error, i; |
1079 | u_short state; | 1069 | u_short state; |
1070 | static const u_short dev[3] = { 0x100, 0x1FF, 0x101 }; | ||
1080 | 1071 | ||
1081 | state = blank ? APM_STATE_STANDBY : APM_STATE_READY; | 1072 | state = blank ? APM_STATE_STANDBY : APM_STATE_READY; |
1082 | /* Blank the first display device */ | 1073 | |
1083 | error = set_power_state(0x100, state); | 1074 | for (i = 0; i < ARRAY_SIZE(dev); i++) { |
1084 | if ((error != APM_SUCCESS) && (error != APM_NO_ERROR)) { | 1075 | error = set_power_state(dev[i], state); |
1085 | /* try to blank them all instead */ | 1076 | |
1086 | error = set_power_state(0x1ff, state); | 1077 | if ((error == APM_SUCCESS) || (error == APM_NO_ERROR)) |
1087 | if ((error != APM_SUCCESS) && (error != APM_NO_ERROR)) | 1078 | return 1; |
1088 | /* try to blank device one instead */ | 1079 | |
1089 | error = set_power_state(0x101, state); | 1080 | if (error == APM_NOT_ENGAGED) |
1081 | break; | ||
1090 | } | 1082 | } |
1091 | if ((error == APM_SUCCESS) || (error == APM_NO_ERROR)) | 1083 | |
1092 | return 1; | 1084 | if (error == APM_NOT_ENGAGED && state != APM_STATE_READY) { |
1093 | if (error == APM_NOT_ENGAGED) { | ||
1094 | static int tried; | 1085 | static int tried; |
1095 | int eng_error; | 1086 | int eng_error; |
1096 | if (tried++ == 0) { | 1087 | if (tried++ == 0) { |
@@ -2233,8 +2224,8 @@ static struct dmi_system_id __initdata apm_dmi_table[] = { | |||
2233 | static int __init apm_init(void) | 2224 | static int __init apm_init(void) |
2234 | { | 2225 | { |
2235 | struct proc_dir_entry *apm_proc; | 2226 | struct proc_dir_entry *apm_proc; |
2227 | struct desc_struct *gdt; | ||
2236 | int ret; | 2228 | int ret; |
2237 | int i; | ||
2238 | 2229 | ||
2239 | dmi_check_system(apm_dmi_table); | 2230 | dmi_check_system(apm_dmi_table); |
2240 | 2231 | ||
@@ -2301,7 +2292,9 @@ static int __init apm_init(void) | |||
2301 | apm_info.disabled = 1; | 2292 | apm_info.disabled = 1; |
2302 | return -ENODEV; | 2293 | return -ENODEV; |
2303 | } | 2294 | } |
2295 | #ifdef CONFIG_PM_LEGACY | ||
2304 | pm_active = 1; | 2296 | pm_active = 1; |
2297 | #endif | ||
2305 | 2298 | ||
2306 | /* | 2299 | /* |
2307 | * Set up a segment that references the real mode segment 0x40 | 2300 | * Set up a segment that references the real mode segment 0x40 |
@@ -2312,45 +2305,30 @@ static int __init apm_init(void) | |||
2312 | set_base(bad_bios_desc, __va((unsigned long)0x40 << 4)); | 2305 | set_base(bad_bios_desc, __va((unsigned long)0x40 << 4)); |
2313 | _set_limit((char *)&bad_bios_desc, 4095 - (0x40 << 4)); | 2306 | _set_limit((char *)&bad_bios_desc, 4095 - (0x40 << 4)); |
2314 | 2307 | ||
2308 | /* | ||
2309 | * Set up the long jump entry point to the APM BIOS, which is called | ||
2310 | * from inline assembly. | ||
2311 | */ | ||
2315 | apm_bios_entry.offset = apm_info.bios.offset; | 2312 | apm_bios_entry.offset = apm_info.bios.offset; |
2316 | apm_bios_entry.segment = APM_CS; | 2313 | apm_bios_entry.segment = APM_CS; |
2317 | 2314 | ||
2318 | for (i = 0; i < NR_CPUS; i++) { | 2315 | /* |
2319 | struct desc_struct *gdt = get_cpu_gdt_table(i); | 2316 | * The APM 1.1 BIOS is supposed to provide limit information that it |
2320 | set_base(gdt[APM_CS >> 3], | 2317 | * recognizes. Many machines do this correctly, but many others do |
2321 | __va((unsigned long)apm_info.bios.cseg << 4)); | 2318 | * not restrict themselves to their claimed limit. When this happens, |
2322 | set_base(gdt[APM_CS_16 >> 3], | 2319 | * they will cause a segmentation violation in the kernel at boot time. |
2323 | __va((unsigned long)apm_info.bios.cseg_16 << 4)); | 2320 | * Most BIOS's, however, will respect a 64k limit, so we use that. |
2324 | set_base(gdt[APM_DS >> 3], | 2321 | * |
2325 | __va((unsigned long)apm_info.bios.dseg << 4)); | 2322 | * Note we only set APM segments on CPU zero, since we pin the APM |
2326 | #ifndef APM_RELAX_SEGMENTS | 2323 | * code to that CPU. |
2327 | if (apm_info.bios.version == 0x100) { | 2324 | */ |
2328 | #endif | 2325 | gdt = get_cpu_gdt_table(0); |
2329 | /* For ASUS motherboard, Award BIOS rev 110 (and others?) */ | 2326 | set_base(gdt[APM_CS >> 3], |
2330 | _set_limit((char *)&gdt[APM_CS >> 3], 64 * 1024 - 1); | 2327 | __va((unsigned long)apm_info.bios.cseg << 4)); |
2331 | /* For some unknown machine. */ | 2328 | set_base(gdt[APM_CS_16 >> 3], |
2332 | _set_limit((char *)&gdt[APM_CS_16 >> 3], 64 * 1024 - 1); | 2329 | __va((unsigned long)apm_info.bios.cseg_16 << 4)); |
2333 | /* For the DEC Hinote Ultra CT475 (and others?) */ | 2330 | set_base(gdt[APM_DS >> 3], |
2334 | _set_limit((char *)&gdt[APM_DS >> 3], 64 * 1024 - 1); | 2331 | __va((unsigned long)apm_info.bios.dseg << 4)); |
2335 | #ifndef APM_RELAX_SEGMENTS | ||
2336 | } else { | ||
2337 | _set_limit((char *)&gdt[APM_CS >> 3], | ||
2338 | (apm_info.bios.cseg_len - 1) & 0xffff); | ||
2339 | _set_limit((char *)&gdt[APM_CS_16 >> 3], | ||
2340 | (apm_info.bios.cseg_16_len - 1) & 0xffff); | ||
2341 | _set_limit((char *)&gdt[APM_DS >> 3], | ||
2342 | (apm_info.bios.dseg_len - 1) & 0xffff); | ||
2343 | /* workaround for broken BIOSes */ | ||
2344 | if (apm_info.bios.cseg_len <= apm_info.bios.offset) | ||
2345 | _set_limit((char *)&gdt[APM_CS >> 3], 64 * 1024 -1); | ||
2346 | if (apm_info.bios.dseg_len <= 0x40) { /* 0x40 * 4kB == 64kB */ | ||
2347 | /* for the BIOS that assumes granularity = 1 */ | ||
2348 | gdt[APM_DS >> 3].b |= 0x800000; | ||
2349 | printk(KERN_NOTICE "apm: we set the granularity of dseg.\n"); | ||
2350 | } | ||
2351 | } | ||
2352 | #endif | ||
2353 | } | ||
2354 | 2332 | ||
2355 | apm_proc = create_proc_info_entry("apm", 0, NULL, apm_get_info); | 2333 | apm_proc = create_proc_info_entry("apm", 0, NULL, apm_get_info); |
2356 | if (apm_proc) | 2334 | if (apm_proc) |
@@ -2407,7 +2385,9 @@ static void __exit apm_exit(void) | |||
2407 | exit_kapmd = 1; | 2385 | exit_kapmd = 1; |
2408 | while (kapmd_running) | 2386 | while (kapmd_running) |
2409 | schedule(); | 2387 | schedule(); |
2388 | #ifdef CONFIG_PM_LEGACY | ||
2410 | pm_active = 0; | 2389 | pm_active = 0; |
2390 | #endif | ||
2411 | } | 2391 | } |
2412 | 2392 | ||
2413 | module_init(apm_init); | 2393 | module_init(apm_init); |
diff --git a/arch/i386/kernel/cpu/amd.c b/arch/i386/kernel/cpu/amd.c index e344ef88cfcd..333578a4e91a 100644 --- a/arch/i386/kernel/cpu/amd.c +++ b/arch/i386/kernel/cpu/amd.c | |||
@@ -161,8 +161,13 @@ static void __init init_amd(struct cpuinfo_x86 *c) | |||
161 | set_bit(X86_FEATURE_K6_MTRR, c->x86_capability); | 161 | set_bit(X86_FEATURE_K6_MTRR, c->x86_capability); |
162 | break; | 162 | break; |
163 | } | 163 | } |
164 | break; | ||
165 | 164 | ||
165 | if (c->x86_model == 10) { | ||
166 | /* AMD Geode LX is model 10 */ | ||
167 | /* placeholder for any needed mods */ | ||
168 | break; | ||
169 | } | ||
170 | break; | ||
166 | case 6: /* An Athlon/Duron */ | 171 | case 6: /* An Athlon/Duron */ |
167 | 172 | ||
168 | /* Bit 15 of Athlon specific MSR 15, needs to be 0 | 173 | /* Bit 15 of Athlon specific MSR 15, needs to be 0 |
@@ -211,6 +216,12 @@ static void __init init_amd(struct cpuinfo_x86 *c) | |||
211 | c->x86_max_cores = 1; | 216 | c->x86_max_cores = 1; |
212 | } | 217 | } |
213 | 218 | ||
219 | if (cpuid_eax(0x80000000) >= 0x80000007) { | ||
220 | c->x86_power = cpuid_edx(0x80000007); | ||
221 | if (c->x86_power & (1<<8)) | ||
222 | set_bit(X86_FEATURE_CONSTANT_TSC, c->x86_capability); | ||
223 | } | ||
224 | |||
214 | #ifdef CONFIG_X86_HT | 225 | #ifdef CONFIG_X86_HT |
215 | /* | 226 | /* |
216 | * On a AMD dual core setup the lower bits of the APIC id | 227 | * On a AMD dual core setup the lower bits of the APIC id |
@@ -228,6 +239,7 @@ static void __init init_amd(struct cpuinfo_x86 *c) | |||
228 | cpu, c->x86_max_cores, cpu_core_id[cpu]); | 239 | cpu, c->x86_max_cores, cpu_core_id[cpu]); |
229 | } | 240 | } |
230 | #endif | 241 | #endif |
242 | |||
231 | } | 243 | } |
232 | 244 | ||
233 | static unsigned int amd_size_cache(struct cpuinfo_x86 * c, unsigned int size) | 245 | static unsigned int amd_size_cache(struct cpuinfo_x86 * c, unsigned int size) |
diff --git a/arch/i386/kernel/cpu/changelog b/arch/i386/kernel/cpu/changelog deleted file mode 100644 index cef76b80a710..000000000000 --- a/arch/i386/kernel/cpu/changelog +++ /dev/null | |||
@@ -1,63 +0,0 @@ | |||
1 | /* | ||
2 | * Enhanced CPU type detection by Mike Jagdis, Patrick St. Jean | ||
3 | * and Martin Mares, November 1997. | ||
4 | * | ||
5 | * Force Cyrix 6x86(MX) and M II processors to report MTRR capability | ||
6 | * and Cyrix "coma bug" recognition by | ||
7 | * Zoltán Böszörményi <zboszor@mail.externet.hu> February 1999. | ||
8 | * | ||
9 | * Force Centaur C6 processors to report MTRR capability. | ||
10 | * Bart Hartgers <bart@etpmod.phys.tue.nl>, May 1999. | ||
11 | * | ||
12 | * Intel Mobile Pentium II detection fix. Sean Gilley, June 1999. | ||
13 | * | ||
14 | * IDT Winchip tweaks, misc clean ups. | ||
15 | * Dave Jones <davej@suse.de>, August 1999 | ||
16 | * | ||
17 | * Better detection of Centaur/IDT WinChip models. | ||
18 | * Bart Hartgers <bart@etpmod.phys.tue.nl>, August 1999. | ||
19 | * | ||
20 | * Cleaned up cache-detection code | ||
21 | * Dave Jones <davej@suse.de>, October 1999 | ||
22 | * | ||
23 | * Added proper L2 cache detection for Coppermine | ||
24 | * Dragan Stancevic <visitor@valinux.com>, October 1999 | ||
25 | * | ||
26 | * Added the original array for capability flags but forgot to credit | ||
27 | * myself :) (~1998) Fixed/cleaned up some cpu_model_info and other stuff | ||
28 | * Jauder Ho <jauderho@carumba.com>, January 2000 | ||
29 | * | ||
30 | * Detection for Celeron coppermine, identify_cpu() overhauled, | ||
31 | * and a few other clean ups. | ||
32 | * Dave Jones <davej@suse.de>, April 2000 | ||
33 | * | ||
34 | * Pentium III FXSR, SSE support | ||
35 | * General FPU state handling cleanups | ||
36 | * Gareth Hughes <gareth@valinux.com>, May 2000 | ||
37 | * | ||
38 | * Added proper Cascades CPU and L2 cache detection for Cascades | ||
39 | * and 8-way type cache happy bunch from Intel:^) | ||
40 | * Dragan Stancevic <visitor@valinux.com>, May 2000 | ||
41 | * | ||
42 | * Forward port AMD Duron errata T13 from 2.2.17pre | ||
43 | * Dave Jones <davej@suse.de>, August 2000 | ||
44 | * | ||
45 | * Forward port lots of fixes/improvements from 2.2.18pre | ||
46 | * Cyrix III, Pentium IV support. | ||
47 | * Dave Jones <davej@suse.de>, October 2000 | ||
48 | * | ||
49 | * Massive cleanup of CPU detection and bug handling; | ||
50 | * Transmeta CPU detection, | ||
51 | * H. Peter Anvin <hpa@zytor.com>, November 2000 | ||
52 | * | ||
53 | * VIA C3 Support. | ||
54 | * Dave Jones <davej@suse.de>, March 2001 | ||
55 | * | ||
56 | * AMD Athlon/Duron/Thunderbird bluesmoke support. | ||
57 | * Dave Jones <davej@suse.de>, April 2001. | ||
58 | * | ||
59 | * CacheSize bug workaround updates for AMD, Intel & VIA Cyrix. | ||
60 | * Dave Jones <davej@suse.de>, September, October 2001. | ||
61 | * | ||
62 | */ | ||
63 | |||
diff --git a/arch/i386/kernel/cpu/common.c b/arch/i386/kernel/cpu/common.c index 31e344b26bae..15aee26ec2b6 100644 --- a/arch/i386/kernel/cpu/common.c +++ b/arch/i386/kernel/cpu/common.c | |||
@@ -18,9 +18,6 @@ | |||
18 | 18 | ||
19 | #include "cpu.h" | 19 | #include "cpu.h" |
20 | 20 | ||
21 | DEFINE_PER_CPU(struct desc_struct, cpu_gdt_table[GDT_ENTRIES]); | ||
22 | EXPORT_PER_CPU_SYMBOL(cpu_gdt_table); | ||
23 | |||
24 | DEFINE_PER_CPU(unsigned char, cpu_16bit_stack[CPU_16BIT_STACK_SIZE]); | 21 | DEFINE_PER_CPU(unsigned char, cpu_16bit_stack[CPU_16BIT_STACK_SIZE]); |
25 | EXPORT_PER_CPU_SYMBOL(cpu_16bit_stack); | 22 | EXPORT_PER_CPU_SYMBOL(cpu_16bit_stack); |
26 | 23 | ||
@@ -207,7 +204,10 @@ static int __devinit have_cpuid_p(void) | |||
207 | 204 | ||
208 | /* Do minimum CPU detection early. | 205 | /* Do minimum CPU detection early. |
209 | Fields really needed: vendor, cpuid_level, family, model, mask, cache alignment. | 206 | Fields really needed: vendor, cpuid_level, family, model, mask, cache alignment. |
210 | The others are not touched to avoid unwanted side effects. */ | 207 | The others are not touched to avoid unwanted side effects. |
208 | |||
209 | WARNING: this function is only called on the BP. Don't add code here | ||
210 | that is supposed to run on all CPUs. */ | ||
211 | static void __init early_cpu_detect(void) | 211 | static void __init early_cpu_detect(void) |
212 | { | 212 | { |
213 | struct cpuinfo_x86 *c = &boot_cpu_data; | 213 | struct cpuinfo_x86 *c = &boot_cpu_data; |
@@ -239,12 +239,6 @@ static void __init early_cpu_detect(void) | |||
239 | if (cap0 & (1<<19)) | 239 | if (cap0 & (1<<19)) |
240 | c->x86_cache_alignment = ((misc >> 8) & 0xff) * 8; | 240 | c->x86_cache_alignment = ((misc >> 8) & 0xff) * 8; |
241 | } | 241 | } |
242 | |||
243 | early_intel_workaround(c); | ||
244 | |||
245 | #ifdef CONFIG_X86_HT | ||
246 | phys_proc_id[smp_processor_id()] = (cpuid_ebx(1) >> 24) & 0xff; | ||
247 | #endif | ||
248 | } | 242 | } |
249 | 243 | ||
250 | void __devinit generic_identify(struct cpuinfo_x86 * c) | 244 | void __devinit generic_identify(struct cpuinfo_x86 * c) |
@@ -292,6 +286,12 @@ void __devinit generic_identify(struct cpuinfo_x86 * c) | |||
292 | get_model_name(c); /* Default name */ | 286 | get_model_name(c); /* Default name */ |
293 | } | 287 | } |
294 | } | 288 | } |
289 | |||
290 | early_intel_workaround(c); | ||
291 | |||
292 | #ifdef CONFIG_X86_HT | ||
293 | phys_proc_id[smp_processor_id()] = (cpuid_ebx(1) >> 24) & 0xff; | ||
294 | #endif | ||
295 | } | 295 | } |
296 | 296 | ||
297 | static void __devinit squash_the_stupid_serial_number(struct cpuinfo_x86 *c) | 297 | static void __devinit squash_the_stupid_serial_number(struct cpuinfo_x86 *c) |
@@ -599,11 +599,6 @@ void __devinit cpu_init(void) | |||
599 | load_idt(&idt_descr); | 599 | load_idt(&idt_descr); |
600 | 600 | ||
601 | /* | 601 | /* |
602 | * Delete NT | ||
603 | */ | ||
604 | __asm__("pushfl ; andl $0xffffbfff,(%esp) ; popfl"); | ||
605 | |||
606 | /* | ||
607 | * Set up and load the per-CPU TSS and LDT | 602 | * Set up and load the per-CPU TSS and LDT |
608 | */ | 603 | */ |
609 | atomic_inc(&init_mm.mm_count); | 604 | atomic_inc(&init_mm.mm_count); |
@@ -617,8 +612,10 @@ void __devinit cpu_init(void) | |||
617 | load_TR_desc(); | 612 | load_TR_desc(); |
618 | load_LDT(&init_mm.context); | 613 | load_LDT(&init_mm.context); |
619 | 614 | ||
615 | #ifdef CONFIG_DOUBLEFAULT | ||
620 | /* Set up doublefault TSS pointer in the GDT */ | 616 | /* Set up doublefault TSS pointer in the GDT */ |
621 | __set_tss_desc(cpu, GDT_ENTRY_DOUBLEFAULT_TSS, &doublefault_tss); | 617 | __set_tss_desc(cpu, GDT_ENTRY_DOUBLEFAULT_TSS, &doublefault_tss); |
618 | #endif | ||
622 | 619 | ||
623 | /* Clear %fs and %gs. */ | 620 | /* Clear %fs and %gs. */ |
624 | asm volatile ("xorl %eax, %eax; movl %eax, %fs; movl %eax, %gs"); | 621 | asm volatile ("xorl %eax, %eax; movl %eax, %fs; movl %eax, %gs"); |
diff --git a/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c b/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c index 871366b83b3f..3852d0a4c1b5 100644 --- a/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c +++ b/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c | |||
@@ -40,8 +40,6 @@ | |||
40 | #include <linux/acpi.h> | 40 | #include <linux/acpi.h> |
41 | #include <acpi/processor.h> | 41 | #include <acpi/processor.h> |
42 | 42 | ||
43 | #include "speedstep-est-common.h" | ||
44 | |||
45 | #define dprintk(msg...) cpufreq_debug_printk(CPUFREQ_DEBUG_DRIVER, "acpi-cpufreq", msg) | 43 | #define dprintk(msg...) cpufreq_debug_printk(CPUFREQ_DEBUG_DRIVER, "acpi-cpufreq", msg) |
46 | 44 | ||
47 | MODULE_AUTHOR("Paul Diefenbaugh, Dominik Brodowski"); | 45 | MODULE_AUTHOR("Paul Diefenbaugh, Dominik Brodowski"); |
@@ -297,68 +295,6 @@ acpi_cpufreq_guess_freq ( | |||
297 | } | 295 | } |
298 | 296 | ||
299 | 297 | ||
300 | /* | ||
301 | * acpi_processor_cpu_init_pdc_est - let BIOS know about the SMP capabilities | ||
302 | * of this driver | ||
303 | * @perf: processor-specific acpi_io_data struct | ||
304 | * @cpu: CPU being initialized | ||
305 | * | ||
306 | * To avoid issues with legacy OSes, some BIOSes require to be informed of | ||
307 | * the SMP capabilities of OS P-state driver. Here we set the bits in _PDC | ||
308 | * accordingly, for Enhanced Speedstep. Actual call to _PDC is done in | ||
309 | * driver/acpi/processor.c | ||
310 | */ | ||
311 | static void | ||
312 | acpi_processor_cpu_init_pdc_est( | ||
313 | struct acpi_processor_performance *perf, | ||
314 | unsigned int cpu, | ||
315 | struct acpi_object_list *obj_list | ||
316 | ) | ||
317 | { | ||
318 | union acpi_object *obj; | ||
319 | u32 *buf; | ||
320 | struct cpuinfo_x86 *c = cpu_data + cpu; | ||
321 | dprintk("acpi_processor_cpu_init_pdc_est\n"); | ||
322 | |||
323 | if (!cpu_has(c, X86_FEATURE_EST)) | ||
324 | return; | ||
325 | |||
326 | /* Initialize pdc. It will be used later. */ | ||
327 | if (!obj_list) | ||
328 | return; | ||
329 | |||
330 | if (!(obj_list->count && obj_list->pointer)) | ||
331 | return; | ||
332 | |||
333 | obj = obj_list->pointer; | ||
334 | if ((obj->buffer.length == 12) && obj->buffer.pointer) { | ||
335 | buf = (u32 *)obj->buffer.pointer; | ||
336 | buf[0] = ACPI_PDC_REVISION_ID; | ||
337 | buf[1] = 1; | ||
338 | buf[2] = ACPI_PDC_EST_CAPABILITY_SMP; | ||
339 | perf->pdc = obj_list; | ||
340 | } | ||
341 | return; | ||
342 | } | ||
343 | |||
344 | |||
345 | /* CPU specific PDC initialization */ | ||
346 | static void | ||
347 | acpi_processor_cpu_init_pdc( | ||
348 | struct acpi_processor_performance *perf, | ||
349 | unsigned int cpu, | ||
350 | struct acpi_object_list *obj_list | ||
351 | ) | ||
352 | { | ||
353 | struct cpuinfo_x86 *c = cpu_data + cpu; | ||
354 | dprintk("acpi_processor_cpu_init_pdc\n"); | ||
355 | perf->pdc = NULL; | ||
356 | if (cpu_has(c, X86_FEATURE_EST)) | ||
357 | acpi_processor_cpu_init_pdc_est(perf, cpu, obj_list); | ||
358 | return; | ||
359 | } | ||
360 | |||
361 | |||
362 | static int | 298 | static int |
363 | acpi_cpufreq_cpu_init ( | 299 | acpi_cpufreq_cpu_init ( |
364 | struct cpufreq_policy *policy) | 300 | struct cpufreq_policy *policy) |
@@ -367,15 +303,9 @@ acpi_cpufreq_cpu_init ( | |||
367 | unsigned int cpu = policy->cpu; | 303 | unsigned int cpu = policy->cpu; |
368 | struct cpufreq_acpi_io *data; | 304 | struct cpufreq_acpi_io *data; |
369 | unsigned int result = 0; | 305 | unsigned int result = 0; |
370 | 306 | struct cpuinfo_x86 *c = &cpu_data[policy->cpu]; | |
371 | union acpi_object arg0 = {ACPI_TYPE_BUFFER}; | ||
372 | u32 arg0_buf[3]; | ||
373 | struct acpi_object_list arg_list = {1, &arg0}; | ||
374 | 307 | ||
375 | dprintk("acpi_cpufreq_cpu_init\n"); | 308 | dprintk("acpi_cpufreq_cpu_init\n"); |
376 | /* setup arg_list for _PDC settings */ | ||
377 | arg0.buffer.length = 12; | ||
378 | arg0.buffer.pointer = (u8 *) arg0_buf; | ||
379 | 309 | ||
380 | data = kzalloc(sizeof(struct cpufreq_acpi_io), GFP_KERNEL); | 310 | data = kzalloc(sizeof(struct cpufreq_acpi_io), GFP_KERNEL); |
381 | if (!data) | 311 | if (!data) |
@@ -383,14 +313,12 @@ acpi_cpufreq_cpu_init ( | |||
383 | 313 | ||
384 | acpi_io_data[cpu] = data; | 314 | acpi_io_data[cpu] = data; |
385 | 315 | ||
386 | acpi_processor_cpu_init_pdc(&data->acpi_data, cpu, &arg_list); | ||
387 | result = acpi_processor_register_performance(&data->acpi_data, cpu); | 316 | result = acpi_processor_register_performance(&data->acpi_data, cpu); |
388 | data->acpi_data.pdc = NULL; | ||
389 | 317 | ||
390 | if (result) | 318 | if (result) |
391 | goto err_free; | 319 | goto err_free; |
392 | 320 | ||
393 | if (is_const_loops_cpu(cpu)) { | 321 | if (cpu_has(c, X86_FEATURE_CONSTANT_TSC)) { |
394 | acpi_cpufreq_driver.flags |= CPUFREQ_CONST_LOOPS; | 322 | acpi_cpufreq_driver.flags |= CPUFREQ_CONST_LOOPS; |
395 | } | 323 | } |
396 | 324 | ||
diff --git a/arch/i386/kernel/cpu/cpufreq/cpufreq-nforce2.c b/arch/i386/kernel/cpu/cpufreq/cpufreq-nforce2.c index 04a405345203..2b62dee35c6c 100644 --- a/arch/i386/kernel/cpu/cpufreq/cpufreq-nforce2.c +++ b/arch/i386/kernel/cpu/cpufreq/cpufreq-nforce2.c | |||
@@ -177,9 +177,10 @@ static unsigned int nforce2_fsb_read(int bootfsb) | |||
177 | */ | 177 | */ |
178 | static int nforce2_set_fsb(unsigned int fsb) | 178 | static int nforce2_set_fsb(unsigned int fsb) |
179 | { | 179 | { |
180 | u32 pll, temp = 0; | 180 | u32 temp = 0; |
181 | unsigned int tfsb; | 181 | unsigned int tfsb; |
182 | int diff; | 182 | int diff; |
183 | int pll = 0; | ||
183 | 184 | ||
184 | if ((fsb > max_fsb) || (fsb < NFORCE2_MIN_FSB)) { | 185 | if ((fsb > max_fsb) || (fsb < NFORCE2_MIN_FSB)) { |
185 | printk(KERN_ERR "cpufreq: FSB %d is out of range!\n", fsb); | 186 | printk(KERN_ERR "cpufreq: FSB %d is out of range!\n", fsb); |
diff --git a/arch/i386/kernel/cpu/cpufreq/powernow-k8.c b/arch/i386/kernel/cpu/cpufreq/powernow-k8.c index 68a1fc87f4ca..e11a09207ec8 100644 --- a/arch/i386/kernel/cpu/cpufreq/powernow-k8.c +++ b/arch/i386/kernel/cpu/cpufreq/powernow-k8.c | |||
@@ -45,7 +45,7 @@ | |||
45 | 45 | ||
46 | #define PFX "powernow-k8: " | 46 | #define PFX "powernow-k8: " |
47 | #define BFX PFX "BIOS error: " | 47 | #define BFX PFX "BIOS error: " |
48 | #define VERSION "version 1.50.4" | 48 | #define VERSION "version 1.60.0" |
49 | #include "powernow-k8.h" | 49 | #include "powernow-k8.h" |
50 | 50 | ||
51 | /* serialize freq changes */ | 51 | /* serialize freq changes */ |
@@ -216,10 +216,10 @@ static int write_new_vid(struct powernow_k8_data *data, u32 vid) | |||
216 | 216 | ||
217 | do { | 217 | do { |
218 | wrmsr(MSR_FIDVID_CTL, lo, STOP_GRANT_5NS); | 218 | wrmsr(MSR_FIDVID_CTL, lo, STOP_GRANT_5NS); |
219 | if (i++ > 100) { | 219 | if (i++ > 100) { |
220 | printk(KERN_ERR PFX "internal error - pending bit very stuck - no further pstate changes possible\n"); | 220 | printk(KERN_ERR PFX "internal error - pending bit very stuck - no further pstate changes possible\n"); |
221 | return 1; | 221 | return 1; |
222 | } | 222 | } |
223 | } while (query_current_values_with_pending_wait(data)); | 223 | } while (query_current_values_with_pending_wait(data)); |
224 | 224 | ||
225 | if (savefid != data->currfid) { | 225 | if (savefid != data->currfid) { |
@@ -336,7 +336,7 @@ static int core_voltage_pre_transition(struct powernow_k8_data *data, u32 reqvid | |||
336 | /* Phase 2 - core frequency transition */ | 336 | /* Phase 2 - core frequency transition */ |
337 | static int core_frequency_transition(struct powernow_k8_data *data, u32 reqfid) | 337 | static int core_frequency_transition(struct powernow_k8_data *data, u32 reqfid) |
338 | { | 338 | { |
339 | u32 vcoreqfid, vcocurrfid, vcofiddiff, savevid = data->currvid; | 339 | u32 vcoreqfid, vcocurrfid, vcofiddiff, fid_interval, savevid = data->currvid; |
340 | 340 | ||
341 | if ((reqfid < HI_FID_TABLE_BOTTOM) && (data->currfid < HI_FID_TABLE_BOTTOM)) { | 341 | if ((reqfid < HI_FID_TABLE_BOTTOM) && (data->currfid < HI_FID_TABLE_BOTTOM)) { |
342 | printk(KERN_ERR PFX "ph2: illegal lo-lo transition 0x%x 0x%x\n", | 342 | printk(KERN_ERR PFX "ph2: illegal lo-lo transition 0x%x 0x%x\n", |
@@ -359,9 +359,11 @@ static int core_frequency_transition(struct powernow_k8_data *data, u32 reqfid) | |||
359 | : vcoreqfid - vcocurrfid; | 359 | : vcoreqfid - vcocurrfid; |
360 | 360 | ||
361 | while (vcofiddiff > 2) { | 361 | while (vcofiddiff > 2) { |
362 | (data->currfid & 1) ? (fid_interval = 1) : (fid_interval = 2); | ||
363 | |||
362 | if (reqfid > data->currfid) { | 364 | if (reqfid > data->currfid) { |
363 | if (data->currfid > LO_FID_TABLE_TOP) { | 365 | if (data->currfid > LO_FID_TABLE_TOP) { |
364 | if (write_new_fid(data, data->currfid + 2)) { | 366 | if (write_new_fid(data, data->currfid + fid_interval)) { |
365 | return 1; | 367 | return 1; |
366 | } | 368 | } |
367 | } else { | 369 | } else { |
@@ -371,7 +373,7 @@ static int core_frequency_transition(struct powernow_k8_data *data, u32 reqfid) | |||
371 | } | 373 | } |
372 | } | 374 | } |
373 | } else { | 375 | } else { |
374 | if (write_new_fid(data, data->currfid - 2)) | 376 | if (write_new_fid(data, data->currfid - fid_interval)) |
375 | return 1; | 377 | return 1; |
376 | } | 378 | } |
377 | 379 | ||
@@ -464,7 +466,7 @@ static int check_supported_cpu(unsigned int cpu) | |||
464 | set_cpus_allowed(current, cpumask_of_cpu(cpu)); | 466 | set_cpus_allowed(current, cpumask_of_cpu(cpu)); |
465 | 467 | ||
466 | if (smp_processor_id() != cpu) { | 468 | if (smp_processor_id() != cpu) { |
467 | printk(KERN_ERR "limiting to cpu %u failed\n", cpu); | 469 | printk(KERN_ERR PFX "limiting to cpu %u failed\n", cpu); |
468 | goto out; | 470 | goto out; |
469 | } | 471 | } |
470 | 472 | ||
@@ -474,7 +476,7 @@ static int check_supported_cpu(unsigned int cpu) | |||
474 | eax = cpuid_eax(CPUID_PROCESSOR_SIGNATURE); | 476 | eax = cpuid_eax(CPUID_PROCESSOR_SIGNATURE); |
475 | if (((eax & CPUID_USE_XFAM_XMOD) != CPUID_USE_XFAM_XMOD) || | 477 | if (((eax & CPUID_USE_XFAM_XMOD) != CPUID_USE_XFAM_XMOD) || |
476 | ((eax & CPUID_XFAM) != CPUID_XFAM_K8) || | 478 | ((eax & CPUID_XFAM) != CPUID_XFAM_K8) || |
477 | ((eax & CPUID_XMOD) > CPUID_XMOD_REV_F)) { | 479 | ((eax & CPUID_XMOD) > CPUID_XMOD_REV_G)) { |
478 | printk(KERN_INFO PFX "Processor cpuid %x not supported\n", eax); | 480 | printk(KERN_INFO PFX "Processor cpuid %x not supported\n", eax); |
479 | goto out; | 481 | goto out; |
480 | } | 482 | } |
@@ -517,22 +519,24 @@ static int check_pst_table(struct powernow_k8_data *data, struct pst_s *pst, u8 | |||
517 | printk(KERN_ERR BFX "maxvid exceeded with pstate %d\n", j); | 519 | printk(KERN_ERR BFX "maxvid exceeded with pstate %d\n", j); |
518 | return -ENODEV; | 520 | return -ENODEV; |
519 | } | 521 | } |
520 | if ((pst[j].fid > MAX_FID) | 522 | if (pst[j].fid > MAX_FID) { |
521 | || (pst[j].fid & 1) | 523 | printk(KERN_ERR BFX "maxfid exceeded with pstate %d\n", j); |
522 | || (j && (pst[j].fid < HI_FID_TABLE_BOTTOM))) { | 524 | return -ENODEV; |
525 | } | ||
526 | if (j && (pst[j].fid < HI_FID_TABLE_BOTTOM)) { | ||
523 | /* Only first fid is allowed to be in "low" range */ | 527 | /* Only first fid is allowed to be in "low" range */ |
524 | printk(KERN_ERR PFX "two low fids - %d : 0x%x\n", j, pst[j].fid); | 528 | printk(KERN_ERR BFX "two low fids - %d : 0x%x\n", j, pst[j].fid); |
525 | return -EINVAL; | 529 | return -EINVAL; |
526 | } | 530 | } |
527 | if (pst[j].fid < lastfid) | 531 | if (pst[j].fid < lastfid) |
528 | lastfid = pst[j].fid; | 532 | lastfid = pst[j].fid; |
529 | } | 533 | } |
530 | if (lastfid & 1) { | 534 | if (lastfid & 1) { |
531 | printk(KERN_ERR PFX "lastfid invalid\n"); | 535 | printk(KERN_ERR BFX "lastfid invalid\n"); |
532 | return -EINVAL; | 536 | return -EINVAL; |
533 | } | 537 | } |
534 | if (lastfid > LO_FID_TABLE_TOP) | 538 | if (lastfid > LO_FID_TABLE_TOP) |
535 | printk(KERN_INFO PFX "first fid not from lo freq table\n"); | 539 | printk(KERN_INFO BFX "first fid not from lo freq table\n"); |
536 | 540 | ||
537 | return 0; | 541 | return 0; |
538 | } | 542 | } |
@@ -631,7 +635,7 @@ static int find_psb_table(struct powernow_k8_data *data) | |||
631 | 635 | ||
632 | dprintk("table vers: 0x%x\n", psb->tableversion); | 636 | dprintk("table vers: 0x%x\n", psb->tableversion); |
633 | if (psb->tableversion != PSB_VERSION_1_4) { | 637 | if (psb->tableversion != PSB_VERSION_1_4) { |
634 | printk(KERN_INFO BFX "PSB table is not v1.4\n"); | 638 | printk(KERN_ERR BFX "PSB table is not v1.4\n"); |
635 | return -ENODEV; | 639 | return -ENODEV; |
636 | } | 640 | } |
637 | 641 | ||
@@ -689,7 +693,7 @@ static int find_psb_table(struct powernow_k8_data *data) | |||
689 | * BIOS and Kernel Developer's Guide, which is available on | 693 | * BIOS and Kernel Developer's Guide, which is available on |
690 | * www.amd.com | 694 | * www.amd.com |
691 | */ | 695 | */ |
692 | printk(KERN_INFO PFX "BIOS error - no PSB or ACPI _PSS objects\n"); | 696 | printk(KERN_ERR PFX "BIOS error - no PSB or ACPI _PSS objects\n"); |
693 | return -ENODEV; | 697 | return -ENODEV; |
694 | } | 698 | } |
695 | 699 | ||
@@ -912,7 +916,7 @@ static int powernowk8_target(struct cpufreq_policy *pol, unsigned targfreq, unsi | |||
912 | set_cpus_allowed(current, cpumask_of_cpu(pol->cpu)); | 916 | set_cpus_allowed(current, cpumask_of_cpu(pol->cpu)); |
913 | 917 | ||
914 | if (smp_processor_id() != pol->cpu) { | 918 | if (smp_processor_id() != pol->cpu) { |
915 | printk(KERN_ERR "limiting to cpu %u failed\n", pol->cpu); | 919 | printk(KERN_ERR PFX "limiting to cpu %u failed\n", pol->cpu); |
916 | goto err_out; | 920 | goto err_out; |
917 | } | 921 | } |
918 | 922 | ||
@@ -976,12 +980,15 @@ static int powernowk8_verify(struct cpufreq_policy *pol) | |||
976 | } | 980 | } |
977 | 981 | ||
978 | /* per CPU init entry point to the driver */ | 982 | /* per CPU init entry point to the driver */ |
979 | static int __init powernowk8_cpu_init(struct cpufreq_policy *pol) | 983 | static int __cpuinit powernowk8_cpu_init(struct cpufreq_policy *pol) |
980 | { | 984 | { |
981 | struct powernow_k8_data *data; | 985 | struct powernow_k8_data *data; |
982 | cpumask_t oldmask = CPU_MASK_ALL; | 986 | cpumask_t oldmask = CPU_MASK_ALL; |
983 | int rc, i; | 987 | int rc, i; |
984 | 988 | ||
989 | if (!cpu_online(pol->cpu)) | ||
990 | return -ENODEV; | ||
991 | |||
985 | if (!check_supported_cpu(pol->cpu)) | 992 | if (!check_supported_cpu(pol->cpu)) |
986 | return -ENODEV; | 993 | return -ENODEV; |
987 | 994 | ||
@@ -1021,7 +1028,7 @@ static int __init powernowk8_cpu_init(struct cpufreq_policy *pol) | |||
1021 | set_cpus_allowed(current, cpumask_of_cpu(pol->cpu)); | 1028 | set_cpus_allowed(current, cpumask_of_cpu(pol->cpu)); |
1022 | 1029 | ||
1023 | if (smp_processor_id() != pol->cpu) { | 1030 | if (smp_processor_id() != pol->cpu) { |
1024 | printk(KERN_ERR "limiting to cpu %u failed\n", pol->cpu); | 1031 | printk(KERN_ERR PFX "limiting to cpu %u failed\n", pol->cpu); |
1025 | goto err_out; | 1032 | goto err_out; |
1026 | } | 1033 | } |
1027 | 1034 | ||
@@ -1134,7 +1141,7 @@ static struct cpufreq_driver cpufreq_amd64_driver = { | |||
1134 | }; | 1141 | }; |
1135 | 1142 | ||
1136 | /* driver entry point for init */ | 1143 | /* driver entry point for init */ |
1137 | static int __init powernowk8_init(void) | 1144 | static int __cpuinit powernowk8_init(void) |
1138 | { | 1145 | { |
1139 | unsigned int i, supported_cpus = 0; | 1146 | unsigned int i, supported_cpus = 0; |
1140 | 1147 | ||
@@ -1162,10 +1169,9 @@ static void __exit powernowk8_exit(void) | |||
1162 | cpufreq_unregister_driver(&cpufreq_amd64_driver); | 1169 | cpufreq_unregister_driver(&cpufreq_amd64_driver); |
1163 | } | 1170 | } |
1164 | 1171 | ||
1165 | MODULE_AUTHOR("Paul Devriendt <paul.devriendt@amd.com> and Mark Langsdorf <mark.langsdorf@amd.com."); | 1172 | MODULE_AUTHOR("Paul Devriendt <paul.devriendt@amd.com> and Mark Langsdorf <mark.langsdorf@amd.com>"); |
1166 | MODULE_DESCRIPTION("AMD Athlon 64 and Opteron processor frequency driver."); | 1173 | MODULE_DESCRIPTION("AMD Athlon 64 and Opteron processor frequency driver."); |
1167 | MODULE_LICENSE("GPL"); | 1174 | MODULE_LICENSE("GPL"); |
1168 | 1175 | ||
1169 | late_initcall(powernowk8_init); | 1176 | late_initcall(powernowk8_init); |
1170 | module_exit(powernowk8_exit); | 1177 | module_exit(powernowk8_exit); |
1171 | |||
diff --git a/arch/i386/kernel/cpu/cpufreq/powernow-k8.h b/arch/i386/kernel/cpu/cpufreq/powernow-k8.h index b1e85bb36396..d0de37d58e9a 100644 --- a/arch/i386/kernel/cpu/cpufreq/powernow-k8.h +++ b/arch/i386/kernel/cpu/cpufreq/powernow-k8.h | |||
@@ -42,7 +42,7 @@ struct powernow_k8_data { | |||
42 | #define CPUID_XFAM 0x0ff00000 /* extended family */ | 42 | #define CPUID_XFAM 0x0ff00000 /* extended family */ |
43 | #define CPUID_XFAM_K8 0 | 43 | #define CPUID_XFAM_K8 0 |
44 | #define CPUID_XMOD 0x000f0000 /* extended model */ | 44 | #define CPUID_XMOD 0x000f0000 /* extended model */ |
45 | #define CPUID_XMOD_REV_F 0x00040000 | 45 | #define CPUID_XMOD_REV_G 0x00060000 |
46 | #define CPUID_USE_XFAM_XMOD 0x00000f00 | 46 | #define CPUID_USE_XFAM_XMOD 0x00000f00 |
47 | #define CPUID_GET_MAX_CAPABILITIES 0x80000000 | 47 | #define CPUID_GET_MAX_CAPABILITIES 0x80000000 |
48 | #define CPUID_FREQ_VOLT_CAPABILITIES 0x80000007 | 48 | #define CPUID_FREQ_VOLT_CAPABILITIES 0x80000007 |
@@ -86,13 +86,14 @@ struct powernow_k8_data { | |||
86 | * low fid table | 86 | * low fid table |
87 | * - lowest entry in the high fid table must be a <= 200MHz + 2 * the entry | 87 | * - lowest entry in the high fid table must be a <= 200MHz + 2 * the entry |
88 | * in the low fid table | 88 | * in the low fid table |
89 | * - the parts can only step at 200 MHz intervals, so 1.9 GHz is never valid | 89 | * - the parts can only step at <= 200 MHz intervals, odd fid values are |
90 | * supported in revision G and later revisions. | ||
90 | * - lowest frequency must be >= interprocessor hypertransport link speed | 91 | * - lowest frequency must be >= interprocessor hypertransport link speed |
91 | * (only applies to MP systems obviously) | 92 | * (only applies to MP systems obviously) |
92 | */ | 93 | */ |
93 | 94 | ||
94 | /* fids (frequency identifiers) are arranged in 2 tables - lo and hi */ | 95 | /* fids (frequency identifiers) are arranged in 2 tables - lo and hi */ |
95 | #define LO_FID_TABLE_TOP 6 /* fid values marking the boundary */ | 96 | #define LO_FID_TABLE_TOP 7 /* fid values marking the boundary */ |
96 | #define HI_FID_TABLE_BOTTOM 8 /* between the low and high tables */ | 97 | #define HI_FID_TABLE_BOTTOM 8 /* between the low and high tables */ |
97 | 98 | ||
98 | #define LO_VCOFREQ_TABLE_TOP 1400 /* corresponding vco frequency values */ | 99 | #define LO_VCOFREQ_TABLE_TOP 1400 /* corresponding vco frequency values */ |
@@ -106,7 +107,7 @@ struct powernow_k8_data { | |||
106 | #define MIN_FREQ 800 /* Min and max freqs, per spec */ | 107 | #define MIN_FREQ 800 /* Min and max freqs, per spec */ |
107 | #define MAX_FREQ 5000 | 108 | #define MAX_FREQ 5000 |
108 | 109 | ||
109 | #define INVALID_FID_MASK 0xffffffc1 /* not a valid fid if these bits are set */ | 110 | #define INVALID_FID_MASK 0xffffffc0 /* not a valid fid if these bits are set */ |
110 | #define INVALID_VID_MASK 0xffffffc0 /* not a valid vid if these bits are set */ | 111 | #define INVALID_VID_MASK 0xffffffc0 /* not a valid vid if these bits are set */ |
111 | 112 | ||
112 | #define VID_OFF 0x3f | 113 | #define VID_OFF 0x3f |
diff --git a/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c b/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c index edb9873e27e3..c173c0fa117a 100644 --- a/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c +++ b/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c | |||
@@ -35,8 +35,6 @@ | |||
35 | #include <asm/processor.h> | 35 | #include <asm/processor.h> |
36 | #include <asm/cpufeature.h> | 36 | #include <asm/cpufeature.h> |
37 | 37 | ||
38 | #include "speedstep-est-common.h" | ||
39 | |||
40 | #define PFX "speedstep-centrino: " | 38 | #define PFX "speedstep-centrino: " |
41 | #define MAINTAINER "Jeremy Fitzhardinge <jeremy@goop.org>" | 39 | #define MAINTAINER "Jeremy Fitzhardinge <jeremy@goop.org>" |
42 | 40 | ||
@@ -364,22 +362,10 @@ static struct acpi_processor_performance p; | |||
364 | */ | 362 | */ |
365 | static int centrino_cpu_init_acpi(struct cpufreq_policy *policy) | 363 | static int centrino_cpu_init_acpi(struct cpufreq_policy *policy) |
366 | { | 364 | { |
367 | union acpi_object arg0 = {ACPI_TYPE_BUFFER}; | ||
368 | u32 arg0_buf[3]; | ||
369 | struct acpi_object_list arg_list = {1, &arg0}; | ||
370 | unsigned long cur_freq; | 365 | unsigned long cur_freq; |
371 | int result = 0, i; | 366 | int result = 0, i; |
372 | unsigned int cpu = policy->cpu; | 367 | unsigned int cpu = policy->cpu; |
373 | 368 | ||
374 | /* _PDC settings */ | ||
375 | arg0.buffer.length = 12; | ||
376 | arg0.buffer.pointer = (u8 *) arg0_buf; | ||
377 | arg0_buf[0] = ACPI_PDC_REVISION_ID; | ||
378 | arg0_buf[1] = 1; | ||
379 | arg0_buf[2] = ACPI_PDC_EST_CAPABILITY_SMP_MSR; | ||
380 | |||
381 | p.pdc = &arg_list; | ||
382 | |||
383 | /* register with ACPI core */ | 369 | /* register with ACPI core */ |
384 | if (acpi_processor_register_performance(&p, cpu)) { | 370 | if (acpi_processor_register_performance(&p, cpu)) { |
385 | dprintk(KERN_INFO PFX "obtaining ACPI data failed\n"); | 371 | dprintk(KERN_INFO PFX "obtaining ACPI data failed\n"); |
@@ -493,12 +479,13 @@ static int centrino_cpu_init(struct cpufreq_policy *policy) | |||
493 | unsigned l, h; | 479 | unsigned l, h; |
494 | int ret; | 480 | int ret; |
495 | int i; | 481 | int i; |
482 | struct cpuinfo_x86 *c = &cpu_data[policy->cpu]; | ||
496 | 483 | ||
497 | /* Only Intel makes Enhanced Speedstep-capable CPUs */ | 484 | /* Only Intel makes Enhanced Speedstep-capable CPUs */ |
498 | if (cpu->x86_vendor != X86_VENDOR_INTEL || !cpu_has(cpu, X86_FEATURE_EST)) | 485 | if (cpu->x86_vendor != X86_VENDOR_INTEL || !cpu_has(cpu, X86_FEATURE_EST)) |
499 | return -ENODEV; | 486 | return -ENODEV; |
500 | 487 | ||
501 | if (is_const_loops_cpu(policy->cpu)) { | 488 | if (cpu_has(c, X86_FEATURE_CONSTANT_TSC)) { |
502 | centrino_driver.flags |= CPUFREQ_CONST_LOOPS; | 489 | centrino_driver.flags |= CPUFREQ_CONST_LOOPS; |
503 | } | 490 | } |
504 | 491 | ||
diff --git a/arch/i386/kernel/cpu/cpufreq/speedstep-est-common.h b/arch/i386/kernel/cpu/cpufreq/speedstep-est-common.h deleted file mode 100644 index 5ce995c9d866..000000000000 --- a/arch/i386/kernel/cpu/cpufreq/speedstep-est-common.h +++ /dev/null | |||
@@ -1,25 +0,0 @@ | |||
1 | /* | ||
2 | * Routines common for drivers handling Enhanced Speedstep Technology | ||
3 | * Copyright (C) 2004 Venkatesh Pallipadi <venkatesh.pallipadi@intel.com> | ||
4 | * | ||
5 | * Licensed under the terms of the GNU GPL License version 2 -- see | ||
6 | * COPYING for details. | ||
7 | */ | ||
8 | |||
9 | static inline int is_const_loops_cpu(unsigned int cpu) | ||
10 | { | ||
11 | struct cpuinfo_x86 *c = cpu_data + cpu; | ||
12 | |||
13 | if (c->x86_vendor != X86_VENDOR_INTEL || !cpu_has(c, X86_FEATURE_EST)) | ||
14 | return 0; | ||
15 | |||
16 | /* | ||
17 | * on P-4s, the TSC runs with constant frequency independent of cpu freq | ||
18 | * when we use EST | ||
19 | */ | ||
20 | if (c->x86 == 0xf) | ||
21 | return 1; | ||
22 | |||
23 | return 0; | ||
24 | } | ||
25 | |||
diff --git a/arch/i386/kernel/cpu/cpufreq/speedstep-ich.c b/arch/i386/kernel/cpu/cpufreq/speedstep-ich.c index 5b7d18a06afa..b425cd3d1838 100644 --- a/arch/i386/kernel/cpu/cpufreq/speedstep-ich.c +++ b/arch/i386/kernel/cpu/cpufreq/speedstep-ich.c | |||
@@ -40,6 +40,7 @@ static struct pci_dev *speedstep_chipset_dev; | |||
40 | */ | 40 | */ |
41 | static unsigned int speedstep_processor = 0; | 41 | static unsigned int speedstep_processor = 0; |
42 | 42 | ||
43 | static u32 pmbase; | ||
43 | 44 | ||
44 | /* | 45 | /* |
45 | * There are only two frequency states for each processor. Values | 46 | * There are only two frequency states for each processor. Values |
@@ -56,34 +57,47 @@ static struct cpufreq_frequency_table speedstep_freqs[] = { | |||
56 | 57 | ||
57 | 58 | ||
58 | /** | 59 | /** |
59 | * speedstep_set_state - set the SpeedStep state | 60 | * speedstep_find_register - read the PMBASE address |
60 | * @state: new processor frequency state (SPEEDSTEP_LOW or SPEEDSTEP_HIGH) | ||
61 | * | 61 | * |
62 | * Tries to change the SpeedStep state. | 62 | * Returns: -ENODEV if no register could be found |
63 | */ | 63 | */ |
64 | static void speedstep_set_state (unsigned int state) | 64 | static int speedstep_find_register (void) |
65 | { | 65 | { |
66 | u32 pmbase; | 66 | if (!speedstep_chipset_dev) |
67 | u8 pm2_blk; | 67 | return -ENODEV; |
68 | u8 value; | ||
69 | unsigned long flags; | ||
70 | |||
71 | if (!speedstep_chipset_dev || (state > 0x1)) | ||
72 | return; | ||
73 | 68 | ||
74 | /* get PMBASE */ | 69 | /* get PMBASE */ |
75 | pci_read_config_dword(speedstep_chipset_dev, 0x40, &pmbase); | 70 | pci_read_config_dword(speedstep_chipset_dev, 0x40, &pmbase); |
76 | if (!(pmbase & 0x01)) { | 71 | if (!(pmbase & 0x01)) { |
77 | printk(KERN_ERR "speedstep-ich: could not find speedstep register\n"); | 72 | printk(KERN_ERR "speedstep-ich: could not find speedstep register\n"); |
78 | return; | 73 | return -ENODEV; |
79 | } | 74 | } |
80 | 75 | ||
81 | pmbase &= 0xFFFFFFFE; | 76 | pmbase &= 0xFFFFFFFE; |
82 | if (!pmbase) { | 77 | if (!pmbase) { |
83 | printk(KERN_ERR "speedstep-ich: could not find speedstep register\n"); | 78 | printk(KERN_ERR "speedstep-ich: could not find speedstep register\n"); |
84 | return; | 79 | return -ENODEV; |
85 | } | 80 | } |
86 | 81 | ||
82 | dprintk("pmbase is 0x%x\n", pmbase); | ||
83 | return 0; | ||
84 | } | ||
85 | |||
86 | /** | ||
87 | * speedstep_set_state - set the SpeedStep state | ||
88 | * @state: new processor frequency state (SPEEDSTEP_LOW or SPEEDSTEP_HIGH) | ||
89 | * | ||
90 | * Tries to change the SpeedStep state. | ||
91 | */ | ||
92 | static void speedstep_set_state (unsigned int state) | ||
93 | { | ||
94 | u8 pm2_blk; | ||
95 | u8 value; | ||
96 | unsigned long flags; | ||
97 | |||
98 | if (state > 0x1) | ||
99 | return; | ||
100 | |||
87 | /* Disable IRQs */ | 101 | /* Disable IRQs */ |
88 | local_irq_save(flags); | 102 | local_irq_save(flags); |
89 | 103 | ||
@@ -315,10 +329,11 @@ static int speedstep_cpu_init(struct cpufreq_policy *policy) | |||
315 | cpus_allowed = current->cpus_allowed; | 329 | cpus_allowed = current->cpus_allowed; |
316 | set_cpus_allowed(current, policy->cpus); | 330 | set_cpus_allowed(current, policy->cpus); |
317 | 331 | ||
318 | /* detect low and high frequency */ | 332 | /* detect low and high frequency and transition latency */ |
319 | result = speedstep_get_freqs(speedstep_processor, | 333 | result = speedstep_get_freqs(speedstep_processor, |
320 | &speedstep_freqs[SPEEDSTEP_LOW].frequency, | 334 | &speedstep_freqs[SPEEDSTEP_LOW].frequency, |
321 | &speedstep_freqs[SPEEDSTEP_HIGH].frequency, | 335 | &speedstep_freqs[SPEEDSTEP_HIGH].frequency, |
336 | &policy->cpuinfo.transition_latency, | ||
322 | &speedstep_set_state); | 337 | &speedstep_set_state); |
323 | set_cpus_allowed(current, cpus_allowed); | 338 | set_cpus_allowed(current, cpus_allowed); |
324 | if (result) | 339 | if (result) |
@@ -335,7 +350,6 @@ static int speedstep_cpu_init(struct cpufreq_policy *policy) | |||
335 | 350 | ||
336 | /* cpuinfo and default policy values */ | 351 | /* cpuinfo and default policy values */ |
337 | policy->governor = CPUFREQ_DEFAULT_GOVERNOR; | 352 | policy->governor = CPUFREQ_DEFAULT_GOVERNOR; |
338 | policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL; | ||
339 | policy->cur = speed; | 353 | policy->cur = speed; |
340 | 354 | ||
341 | result = cpufreq_frequency_table_cpuinfo(policy, speedstep_freqs); | 355 | result = cpufreq_frequency_table_cpuinfo(policy, speedstep_freqs); |
@@ -400,6 +414,9 @@ static int __init speedstep_init(void) | |||
400 | return -EINVAL; | 414 | return -EINVAL; |
401 | } | 415 | } |
402 | 416 | ||
417 | if (speedstep_find_register()) | ||
418 | return -ENODEV; | ||
419 | |||
403 | return cpufreq_register_driver(&speedstep_driver); | 420 | return cpufreq_register_driver(&speedstep_driver); |
404 | } | 421 | } |
405 | 422 | ||
diff --git a/arch/i386/kernel/cpu/cpufreq/speedstep-lib.c b/arch/i386/kernel/cpu/cpufreq/speedstep-lib.c index d368b3f5fce8..7c47005a1805 100644 --- a/arch/i386/kernel/cpu/cpufreq/speedstep-lib.c +++ b/arch/i386/kernel/cpu/cpufreq/speedstep-lib.c | |||
@@ -320,11 +320,13 @@ EXPORT_SYMBOL_GPL(speedstep_detect_processor); | |||
320 | unsigned int speedstep_get_freqs(unsigned int processor, | 320 | unsigned int speedstep_get_freqs(unsigned int processor, |
321 | unsigned int *low_speed, | 321 | unsigned int *low_speed, |
322 | unsigned int *high_speed, | 322 | unsigned int *high_speed, |
323 | unsigned int *transition_latency, | ||
323 | void (*set_state) (unsigned int state)) | 324 | void (*set_state) (unsigned int state)) |
324 | { | 325 | { |
325 | unsigned int prev_speed; | 326 | unsigned int prev_speed; |
326 | unsigned int ret = 0; | 327 | unsigned int ret = 0; |
327 | unsigned long flags; | 328 | unsigned long flags; |
329 | struct timeval tv1, tv2; | ||
328 | 330 | ||
329 | if ((!processor) || (!low_speed) || (!high_speed) || (!set_state)) | 331 | if ((!processor) || (!low_speed) || (!high_speed) || (!set_state)) |
330 | return -EINVAL; | 332 | return -EINVAL; |
@@ -337,7 +339,7 @@ unsigned int speedstep_get_freqs(unsigned int processor, | |||
337 | return -EIO; | 339 | return -EIO; |
338 | 340 | ||
339 | dprintk("previous speed is %u\n", prev_speed); | 341 | dprintk("previous speed is %u\n", prev_speed); |
340 | 342 | ||
341 | local_irq_save(flags); | 343 | local_irq_save(flags); |
342 | 344 | ||
343 | /* switch to low state */ | 345 | /* switch to low state */ |
@@ -350,8 +352,17 @@ unsigned int speedstep_get_freqs(unsigned int processor, | |||
350 | 352 | ||
351 | dprintk("low speed is %u\n", *low_speed); | 353 | dprintk("low speed is %u\n", *low_speed); |
352 | 354 | ||
355 | /* start latency measurement */ | ||
356 | if (transition_latency) | ||
357 | do_gettimeofday(&tv1); | ||
358 | |||
353 | /* switch to high state */ | 359 | /* switch to high state */ |
354 | set_state(SPEEDSTEP_HIGH); | 360 | set_state(SPEEDSTEP_HIGH); |
361 | |||
362 | /* end latency measurement */ | ||
363 | if (transition_latency) | ||
364 | do_gettimeofday(&tv2); | ||
365 | |||
355 | *high_speed = speedstep_get_processor_frequency(processor); | 366 | *high_speed = speedstep_get_processor_frequency(processor); |
356 | if (!*high_speed) { | 367 | if (!*high_speed) { |
357 | ret = -EIO; | 368 | ret = -EIO; |
@@ -369,6 +380,25 @@ unsigned int speedstep_get_freqs(unsigned int processor, | |||
369 | if (*high_speed != prev_speed) | 380 | if (*high_speed != prev_speed) |
370 | set_state(SPEEDSTEP_LOW); | 381 | set_state(SPEEDSTEP_LOW); |
371 | 382 | ||
383 | if (transition_latency) { | ||
384 | *transition_latency = (tv2.tv_sec - tv1.tv_sec) * USEC_PER_SEC + | ||
385 | tv2.tv_usec - tv1.tv_usec; | ||
386 | dprintk("transition latency is %u uSec\n", *transition_latency); | ||
387 | |||
388 | /* convert uSec to nSec and add 20% for safety reasons */ | ||
389 | *transition_latency *= 1200; | ||
390 | |||
391 | /* check if the latency measurement is too high or too low | ||
392 | * and set it to a safe value (500uSec) in that case | ||
393 | */ | ||
394 | if (*transition_latency > 10000000 || *transition_latency < 50000) { | ||
395 | printk (KERN_WARNING "speedstep: frequency transition measured seems out of " | ||
396 | "range (%u nSec), falling back to a safe one of %u nSec.\n", | ||
397 | *transition_latency, 500000); | ||
398 | *transition_latency = 500000; | ||
399 | } | ||
400 | } | ||
401 | |||
372 | out: | 402 | out: |
373 | local_irq_restore(flags); | 403 | local_irq_restore(flags); |
374 | return (ret); | 404 | return (ret); |
diff --git a/arch/i386/kernel/cpu/cpufreq/speedstep-lib.h b/arch/i386/kernel/cpu/cpufreq/speedstep-lib.h index 261a2c9b7f6b..6a727fd3a77e 100644 --- a/arch/i386/kernel/cpu/cpufreq/speedstep-lib.h +++ b/arch/i386/kernel/cpu/cpufreq/speedstep-lib.h | |||
@@ -44,4 +44,5 @@ extern unsigned int speedstep_get_processor_frequency(unsigned int processor); | |||
44 | extern unsigned int speedstep_get_freqs(unsigned int processor, | 44 | extern unsigned int speedstep_get_freqs(unsigned int processor, |
45 | unsigned int *low_speed, | 45 | unsigned int *low_speed, |
46 | unsigned int *high_speed, | 46 | unsigned int *high_speed, |
47 | unsigned int *transition_latency, | ||
47 | void (*set_state) (unsigned int state)); | 48 | void (*set_state) (unsigned int state)); |
diff --git a/arch/i386/kernel/cpu/cpufreq/speedstep-smi.c b/arch/i386/kernel/cpu/cpufreq/speedstep-smi.c index 2718fb6f6aba..28cc5d524afc 100644 --- a/arch/i386/kernel/cpu/cpufreq/speedstep-smi.c +++ b/arch/i386/kernel/cpu/cpufreq/speedstep-smi.c | |||
@@ -269,6 +269,7 @@ static int speedstep_cpu_init(struct cpufreq_policy *policy) | |||
269 | result = speedstep_get_freqs(speedstep_processor, | 269 | result = speedstep_get_freqs(speedstep_processor, |
270 | &speedstep_freqs[SPEEDSTEP_LOW].frequency, | 270 | &speedstep_freqs[SPEEDSTEP_LOW].frequency, |
271 | &speedstep_freqs[SPEEDSTEP_HIGH].frequency, | 271 | &speedstep_freqs[SPEEDSTEP_HIGH].frequency, |
272 | NULL, | ||
272 | &speedstep_set_state); | 273 | &speedstep_set_state); |
273 | 274 | ||
274 | if (result) { | 275 | if (result) { |
diff --git a/arch/i386/kernel/cpu/cyrix.c b/arch/i386/kernel/cpu/cyrix.c index ff87cc22b323..75015975d038 100644 --- a/arch/i386/kernel/cpu/cyrix.c +++ b/arch/i386/kernel/cpu/cyrix.c | |||
@@ -343,6 +343,31 @@ static void __init init_cyrix(struct cpuinfo_x86 *c) | |||
343 | } | 343 | } |
344 | 344 | ||
345 | /* | 345 | /* |
346 | * Handle National Semiconductor branded processors | ||
347 | */ | ||
348 | static void __devinit init_nsc(struct cpuinfo_x86 *c) | ||
349 | { | ||
350 | /* There may be GX1 processors in the wild that are branded | ||
351 | * NSC and not Cyrix. | ||
352 | * | ||
353 | * This function only handles the GX processor, and kicks every | ||
354 | * thing else to the Cyrix init function above - that should | ||
355 | * cover any processors that might have been branded differently | ||
356 | * after NSC aquired Cyrix. | ||
357 | * | ||
358 | * If this breaks your GX1 horribly, please e-mail | ||
359 | * info-linux@ldcmail.amd.com to tell us. | ||
360 | */ | ||
361 | |||
362 | /* Handle the GX (Formally known as the GX2) */ | ||
363 | |||
364 | if (c->x86 == 5 && c->x86_model == 5) | ||
365 | display_cacheinfo(c); | ||
366 | else | ||
367 | init_cyrix(c); | ||
368 | } | ||
369 | |||
370 | /* | ||
346 | * Cyrix CPUs without cpuid or with cpuid not yet enabled can be detected | 371 | * Cyrix CPUs without cpuid or with cpuid not yet enabled can be detected |
347 | * by the fact that they preserve the flags across the division of 5/2. | 372 | * by the fact that they preserve the flags across the division of 5/2. |
348 | * PII and PPro exhibit this behavior too, but they have cpuid available. | 373 | * PII and PPro exhibit this behavior too, but they have cpuid available. |
@@ -422,7 +447,7 @@ int __init cyrix_init_cpu(void) | |||
422 | static struct cpu_dev nsc_cpu_dev __initdata = { | 447 | static struct cpu_dev nsc_cpu_dev __initdata = { |
423 | .c_vendor = "NSC", | 448 | .c_vendor = "NSC", |
424 | .c_ident = { "Geode by NSC" }, | 449 | .c_ident = { "Geode by NSC" }, |
425 | .c_init = init_cyrix, | 450 | .c_init = init_nsc, |
426 | .c_identify = generic_identify, | 451 | .c_identify = generic_identify, |
427 | }; | 452 | }; |
428 | 453 | ||
diff --git a/arch/i386/kernel/cpu/intel.c b/arch/i386/kernel/cpu/intel.c index 5e2da704f0fa..8c0120186b9f 100644 --- a/arch/i386/kernel/cpu/intel.c +++ b/arch/i386/kernel/cpu/intel.c | |||
@@ -183,10 +183,13 @@ static void __devinit init_intel(struct cpuinfo_x86 *c) | |||
183 | } | 183 | } |
184 | #endif | 184 | #endif |
185 | 185 | ||
186 | if (c->x86 == 15) | 186 | if (c->x86 == 15) |
187 | set_bit(X86_FEATURE_P4, c->x86_capability); | 187 | set_bit(X86_FEATURE_P4, c->x86_capability); |
188 | if (c->x86 == 6) | 188 | if (c->x86 == 6) |
189 | set_bit(X86_FEATURE_P3, c->x86_capability); | 189 | set_bit(X86_FEATURE_P3, c->x86_capability); |
190 | if ((c->x86 == 0xf && c->x86_model >= 0x03) || | ||
191 | (c->x86 == 0x6 && c->x86_model >= 0x0e)) | ||
192 | set_bit(X86_FEATURE_CONSTANT_TSC, c->x86_capability); | ||
190 | } | 193 | } |
191 | 194 | ||
192 | 195 | ||
diff --git a/arch/i386/kernel/cpu/mtrr/changelog b/arch/i386/kernel/cpu/mtrr/changelog deleted file mode 100644 index af1368535955..000000000000 --- a/arch/i386/kernel/cpu/mtrr/changelog +++ /dev/null | |||
@@ -1,229 +0,0 @@ | |||
1 | ChangeLog | ||
2 | |||
3 | Prehistory Martin Tischhäuser <martin@ikcbarka.fzk.de> | ||
4 | Initial register-setting code (from proform-1.0). | ||
5 | 19971216 Richard Gooch <rgooch@atnf.csiro.au> | ||
6 | Original version for /proc/mtrr interface, SMP-safe. | ||
7 | v1.0 | ||
8 | 19971217 Richard Gooch <rgooch@atnf.csiro.au> | ||
9 | Bug fix for ioctls()'s. | ||
10 | Added sample code in Documentation/mtrr.txt | ||
11 | v1.1 | ||
12 | 19971218 Richard Gooch <rgooch@atnf.csiro.au> | ||
13 | Disallow overlapping regions. | ||
14 | 19971219 Jens Maurer <jmaurer@menuett.rhein-main.de> | ||
15 | Register-setting fixups. | ||
16 | v1.2 | ||
17 | 19971222 Richard Gooch <rgooch@atnf.csiro.au> | ||
18 | Fixups for kernel 2.1.75. | ||
19 | v1.3 | ||
20 | 19971229 David Wragg <dpw@doc.ic.ac.uk> | ||
21 | Register-setting fixups and conformity with Intel conventions. | ||
22 | 19971229 Richard Gooch <rgooch@atnf.csiro.au> | ||
23 | Cosmetic changes and wrote this ChangeLog ;-) | ||
24 | 19980106 Richard Gooch <rgooch@atnf.csiro.au> | ||
25 | Fixups for kernel 2.1.78. | ||
26 | v1.4 | ||
27 | 19980119 David Wragg <dpw@doc.ic.ac.uk> | ||
28 | Included passive-release enable code (elsewhere in PCI setup). | ||
29 | v1.5 | ||
30 | 19980131 Richard Gooch <rgooch@atnf.csiro.au> | ||
31 | Replaced global kernel lock with private spinlock. | ||
32 | v1.6 | ||
33 | 19980201 Richard Gooch <rgooch@atnf.csiro.au> | ||
34 | Added wait for other CPUs to complete changes. | ||
35 | v1.7 | ||
36 | 19980202 Richard Gooch <rgooch@atnf.csiro.au> | ||
37 | Bug fix in definition of <set_mtrr> for UP. | ||
38 | v1.8 | ||
39 | 19980319 Richard Gooch <rgooch@atnf.csiro.au> | ||
40 | Fixups for kernel 2.1.90. | ||
41 | 19980323 Richard Gooch <rgooch@atnf.csiro.au> | ||
42 | Move SMP BIOS fixup before secondary CPUs call <calibrate_delay> | ||
43 | v1.9 | ||
44 | 19980325 Richard Gooch <rgooch@atnf.csiro.au> | ||
45 | Fixed test for overlapping regions: confused by adjacent regions | ||
46 | 19980326 Richard Gooch <rgooch@atnf.csiro.au> | ||
47 | Added wbinvd in <set_mtrr_prepare>. | ||
48 | 19980401 Richard Gooch <rgooch@atnf.csiro.au> | ||
49 | Bug fix for non-SMP compilation. | ||
50 | 19980418 David Wragg <dpw@doc.ic.ac.uk> | ||
51 | Fixed-MTRR synchronisation for SMP and use atomic operations | ||
52 | instead of spinlocks. | ||
53 | 19980418 Richard Gooch <rgooch@atnf.csiro.au> | ||
54 | Differentiate different MTRR register classes for BIOS fixup. | ||
55 | v1.10 | ||
56 | 19980419 David Wragg <dpw@doc.ic.ac.uk> | ||
57 | Bug fix in variable MTRR synchronisation. | ||
58 | v1.11 | ||
59 | 19980419 Richard Gooch <rgooch@atnf.csiro.au> | ||
60 | Fixups for kernel 2.1.97. | ||
61 | v1.12 | ||
62 | 19980421 Richard Gooch <rgooch@atnf.csiro.au> | ||
63 | Safer synchronisation across CPUs when changing MTRRs. | ||
64 | v1.13 | ||
65 | 19980423 Richard Gooch <rgooch@atnf.csiro.au> | ||
66 | Bugfix for SMP systems without MTRR support. | ||
67 | v1.14 | ||
68 | 19980427 Richard Gooch <rgooch@atnf.csiro.au> | ||
69 | Trap calls to <mtrr_add> and <mtrr_del> on non-MTRR machines. | ||
70 | v1.15 | ||
71 | 19980427 Richard Gooch <rgooch@atnf.csiro.au> | ||
72 | Use atomic bitops for setting SMP change mask. | ||
73 | v1.16 | ||
74 | 19980428 Richard Gooch <rgooch@atnf.csiro.au> | ||
75 | Removed spurious diagnostic message. | ||
76 | v1.17 | ||
77 | 19980429 Richard Gooch <rgooch@atnf.csiro.au> | ||
78 | Moved register-setting macros into this file. | ||
79 | Moved setup code from init/main.c to i386-specific areas. | ||
80 | v1.18 | ||
81 | 19980502 Richard Gooch <rgooch@atnf.csiro.au> | ||
82 | Moved MTRR detection outside conditionals in <mtrr_init>. | ||
83 | v1.19 | ||
84 | 19980502 Richard Gooch <rgooch@atnf.csiro.au> | ||
85 | Documentation improvement: mention Pentium II and AGP. | ||
86 | v1.20 | ||
87 | 19980521 Richard Gooch <rgooch@atnf.csiro.au> | ||
88 | Only manipulate interrupt enable flag on local CPU. | ||
89 | Allow enclosed uncachable regions. | ||
90 | v1.21 | ||
91 | 19980611 Richard Gooch <rgooch@atnf.csiro.au> | ||
92 | Always define <main_lock>. | ||
93 | v1.22 | ||
94 | 19980901 Richard Gooch <rgooch@atnf.csiro.au> | ||
95 | Removed module support in order to tidy up code. | ||
96 | Added sanity check for <mtrr_add>/<mtrr_del> before <mtrr_init>. | ||
97 | Created addition queue for prior to SMP commence. | ||
98 | v1.23 | ||
99 | 19980902 Richard Gooch <rgooch@atnf.csiro.au> | ||
100 | Ported patch to kernel 2.1.120-pre3. | ||
101 | v1.24 | ||
102 | 19980910 Richard Gooch <rgooch@atnf.csiro.au> | ||
103 | Removed sanity checks and addition queue: Linus prefers an OOPS. | ||
104 | v1.25 | ||
105 | 19981001 Richard Gooch <rgooch@atnf.csiro.au> | ||
106 | Fixed harmless compiler warning in include/asm-i386/mtrr.h | ||
107 | Fixed version numbering and history for v1.23 -> v1.24. | ||
108 | v1.26 | ||
109 | 19990118 Richard Gooch <rgooch@atnf.csiro.au> | ||
110 | Added devfs support. | ||
111 | v1.27 | ||
112 | 19990123 Richard Gooch <rgooch@atnf.csiro.au> | ||
113 | Changed locking to spin with reschedule. | ||
114 | Made use of new <smp_call_function>. | ||
115 | v1.28 | ||
116 | 19990201 Zoltán Böszörményi <zboszor@mail.externet.hu> | ||
117 | Extended the driver to be able to use Cyrix style ARRs. | ||
118 | 19990204 Richard Gooch <rgooch@atnf.csiro.au> | ||
119 | Restructured Cyrix support. | ||
120 | v1.29 | ||
121 | 19990204 Zoltán Böszörményi <zboszor@mail.externet.hu> | ||
122 | Refined ARR support: enable MAPEN in set_mtrr_prepare() | ||
123 | and disable MAPEN in set_mtrr_done(). | ||
124 | 19990205 Richard Gooch <rgooch@atnf.csiro.au> | ||
125 | Minor cleanups. | ||
126 | v1.30 | ||
127 | 19990208 Zoltán Böszörményi <zboszor@mail.externet.hu> | ||
128 | Protect plain 6x86s (and other processors without the | ||
129 | Page Global Enable feature) against accessing CR4 in | ||
130 | set_mtrr_prepare() and set_mtrr_done(). | ||
131 | 19990210 Richard Gooch <rgooch@atnf.csiro.au> | ||
132 | Turned <set_mtrr_up> and <get_mtrr> into function pointers. | ||
133 | v1.31 | ||
134 | 19990212 Zoltán Böszörményi <zboszor@mail.externet.hu> | ||
135 | Major rewrite of cyrix_arr_init(): do not touch ARRs, | ||
136 | leave them as the BIOS have set them up. | ||
137 | Enable usage of all 8 ARRs. | ||
138 | Avoid multiplications by 3 everywhere and other | ||
139 | code clean ups/speed ups. | ||
140 | 19990213 Zoltán Böszörményi <zboszor@mail.externet.hu> | ||
141 | Set up other Cyrix processors identical to the boot cpu. | ||
142 | Since Cyrix don't support Intel APIC, this is l'art pour l'art. | ||
143 | Weigh ARRs by size: | ||
144 | If size <= 32M is given, set up ARR# we were given. | ||
145 | If size > 32M is given, set up ARR7 only if it is free, | ||
146 | fail otherwise. | ||
147 | 19990214 Zoltán Böszörményi <zboszor@mail.externet.hu> | ||
148 | Also check for size >= 256K if we are to set up ARR7, | ||
149 | mtrr_add() returns the value it gets from set_mtrr() | ||
150 | 19990218 Zoltán Böszörményi <zboszor@mail.externet.hu> | ||
151 | Remove Cyrix "coma bug" workaround from here. | ||
152 | Moved to linux/arch/i386/kernel/setup.c and | ||
153 | linux/include/asm-i386/bugs.h | ||
154 | 19990228 Richard Gooch <rgooch@atnf.csiro.au> | ||
155 | Added MTRRIOC_KILL_ENTRY ioctl(2) | ||
156 | Trap for counter underflow in <mtrr_file_del>. | ||
157 | Trap for 4 MiB aligned regions for PPro, stepping <= 7. | ||
158 | 19990301 Richard Gooch <rgooch@atnf.csiro.au> | ||
159 | Created <get_free_region> hook. | ||
160 | 19990305 Richard Gooch <rgooch@atnf.csiro.au> | ||
161 | Temporarily disable AMD support now MTRR capability flag is set. | ||
162 | v1.32 | ||
163 | 19990308 Zoltán Böszörményi <zboszor@mail.externet.hu> | ||
164 | Adjust my changes (19990212-19990218) to Richard Gooch's | ||
165 | latest changes. (19990228-19990305) | ||
166 | v1.33 | ||
167 | 19990309 Richard Gooch <rgooch@atnf.csiro.au> | ||
168 | Fixed typo in <printk> message. | ||
169 | 19990310 Richard Gooch <rgooch@atnf.csiro.au> | ||
170 | Support K6-II/III based on Alan Cox's <alan@redhat.com> patches. | ||
171 | v1.34 | ||
172 | 19990511 Bart Hartgers <bart@etpmod.phys.tue.nl> | ||
173 | Support Centaur C6 MCR's. | ||
174 | 19990512 Richard Gooch <rgooch@atnf.csiro.au> | ||
175 | Minor cleanups. | ||
176 | v1.35 | ||
177 | 19990707 Zoltán Böszörményi <zboszor@mail.externet.hu> | ||
178 | Check whether ARR3 is protected in cyrix_get_free_region() | ||
179 | and mtrr_del(). The code won't attempt to delete or change it | ||
180 | from now on if the BIOS protected ARR3. It silently skips ARR3 | ||
181 | in cyrix_get_free_region() or returns with an error code from | ||
182 | mtrr_del(). | ||
183 | 19990711 Zoltán Böszörményi <zboszor@mail.externet.hu> | ||
184 | Reset some bits in the CCRs in cyrix_arr_init() to disable SMM | ||
185 | if ARR3 isn't protected. This is needed because if SMM is active | ||
186 | and ARR3 isn't protected then deleting and setting ARR3 again | ||
187 | may lock up the processor. With SMM entirely disabled, it does | ||
188 | not happen. | ||
189 | 19990812 Zoltán Böszörményi <zboszor@mail.externet.hu> | ||
190 | Rearrange switch() statements so the driver accomodates to | ||
191 | the fact that the AMD Athlon handles its MTRRs the same way | ||
192 | as Intel does. | ||
193 | 19990814 Zoltán Böszörményi <zboszor@mail.externet.hu> | ||
194 | Double check for Intel in mtrr_add()'s big switch() because | ||
195 | that revision check is only valid for Intel CPUs. | ||
196 | 19990819 Alan Cox <alan@redhat.com> | ||
197 | Tested Zoltan's changes on a pre production Athlon - 100% | ||
198 | success. | ||
199 | 19991008 Manfred Spraul <manfreds@colorfullife.com> | ||
200 | replaced spin_lock_reschedule() with a normal semaphore. | ||
201 | v1.36 | ||
202 | 20000221 Richard Gooch <rgooch@atnf.csiro.au> | ||
203 | Compile fix if procfs and devfs not enabled. | ||
204 | Formatting changes. | ||
205 | v1.37 | ||
206 | 20001109 H. Peter Anvin <hpa@zytor.com> | ||
207 | Use the new centralized CPU feature detects. | ||
208 | |||
209 | v1.38 | ||
210 | 20010309 Dave Jones <davej@suse.de> | ||
211 | Add support for Cyrix III. | ||
212 | |||
213 | v1.39 | ||
214 | 20010312 Dave Jones <davej@suse.de> | ||
215 | Ugh, I broke AMD support. | ||
216 | Reworked fix by Troels Walsted Hansen <troels@thule.no> | ||
217 | |||
218 | v1.40 | ||
219 | 20010327 Dave Jones <davej@suse.de> | ||
220 | Adapted Cyrix III support to include VIA C3. | ||
221 | |||
222 | v2.0 | ||
223 | 20020306 Patrick Mochel <mochel@osdl.org> | ||
224 | Split mtrr.c -> mtrr/*.c | ||
225 | Converted to Linux Kernel Coding Style | ||
226 | Fixed several minor nits in form | ||
227 | Moved some SMP-only functions out, so they can be used | ||
228 | for power management in the future. | ||
229 | TODO: Fix user interface cruft. | ||
diff --git a/arch/i386/kernel/cpu/mtrr/if.c b/arch/i386/kernel/cpu/mtrr/if.c index cf39e205d33c..5ac051bb9d55 100644 --- a/arch/i386/kernel/cpu/mtrr/if.c +++ b/arch/i386/kernel/cpu/mtrr/if.c | |||
@@ -1,5 +1,6 @@ | |||
1 | #include <linux/init.h> | 1 | #include <linux/init.h> |
2 | #include <linux/proc_fs.h> | 2 | #include <linux/proc_fs.h> |
3 | #include <linux/capability.h> | ||
3 | #include <linux/ctype.h> | 4 | #include <linux/ctype.h> |
4 | #include <linux/module.h> | 5 | #include <linux/module.h> |
5 | #include <linux/seq_file.h> | 6 | #include <linux/seq_file.h> |
diff --git a/arch/i386/kernel/cpu/proc.c b/arch/i386/kernel/cpu/proc.c index e7921315ae9d..89a85af33d28 100644 --- a/arch/i386/kernel/cpu/proc.c +++ b/arch/i386/kernel/cpu/proc.c | |||
@@ -3,6 +3,7 @@ | |||
3 | #include <linux/string.h> | 3 | #include <linux/string.h> |
4 | #include <asm/semaphore.h> | 4 | #include <asm/semaphore.h> |
5 | #include <linux/seq_file.h> | 5 | #include <linux/seq_file.h> |
6 | #include <linux/cpufreq.h> | ||
6 | 7 | ||
7 | /* | 8 | /* |
8 | * Get CPU information for use by the procfs. | 9 | * Get CPU information for use by the procfs. |
@@ -28,7 +29,7 @@ static int show_cpuinfo(struct seq_file *m, void *v) | |||
28 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | 29 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, |
29 | NULL, NULL, NULL, "syscall", NULL, NULL, NULL, NULL, | 30 | NULL, NULL, NULL, "syscall", NULL, NULL, NULL, NULL, |
30 | NULL, NULL, NULL, "mp", "nx", NULL, "mmxext", NULL, | 31 | NULL, NULL, NULL, "mp", "nx", NULL, "mmxext", NULL, |
31 | NULL, "fxsr_opt", NULL, NULL, NULL, "lm", "3dnowext", "3dnow", | 32 | NULL, "fxsr_opt", "rdtscp", NULL, NULL, "lm", "3dnowext", "3dnow", |
32 | 33 | ||
33 | /* Transmeta-defined */ | 34 | /* Transmeta-defined */ |
34 | "recovery", "longrun", NULL, "lrti", NULL, NULL, NULL, NULL, | 35 | "recovery", "longrun", NULL, "lrti", NULL, NULL, NULL, NULL, |
@@ -39,7 +40,7 @@ static int show_cpuinfo(struct seq_file *m, void *v) | |||
39 | /* Other (Linux-defined) */ | 40 | /* Other (Linux-defined) */ |
40 | "cxmmx", "k6_mtrr", "cyrix_arr", "centaur_mcr", | 41 | "cxmmx", "k6_mtrr", "cyrix_arr", "centaur_mcr", |
41 | NULL, NULL, NULL, NULL, | 42 | NULL, NULL, NULL, NULL, |
42 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | 43 | "constant_tsc", NULL, NULL, NULL, NULL, NULL, NULL, NULL, |
43 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | 44 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, |
44 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | 45 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, |
45 | 46 | ||
@@ -56,11 +57,21 @@ static int show_cpuinfo(struct seq_file *m, void *v) | |||
56 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | 57 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, |
57 | 58 | ||
58 | /* AMD-defined (#2) */ | 59 | /* AMD-defined (#2) */ |
59 | "lahf_lm", "cmp_legacy", NULL, NULL, NULL, NULL, NULL, NULL, | 60 | "lahf_lm", "cmp_legacy", "svm", NULL, "cr8legacy", NULL, NULL, NULL, |
60 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | 61 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, |
61 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | 62 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, |
62 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | 63 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, |
63 | }; | 64 | }; |
65 | static char *x86_power_flags[] = { | ||
66 | "ts", /* temperature sensor */ | ||
67 | "fid", /* frequency id control */ | ||
68 | "vid", /* voltage id control */ | ||
69 | "ttp", /* thermal trip */ | ||
70 | "tm", | ||
71 | "stc", | ||
72 | NULL, | ||
73 | /* nothing */ /* constant_tsc - moved to flags */ | ||
74 | }; | ||
64 | struct cpuinfo_x86 *c = v; | 75 | struct cpuinfo_x86 *c = v; |
65 | int i, n = c - cpu_data; | 76 | int i, n = c - cpu_data; |
66 | int fpu_exception; | 77 | int fpu_exception; |
@@ -86,8 +97,11 @@ static int show_cpuinfo(struct seq_file *m, void *v) | |||
86 | seq_printf(m, "stepping\t: unknown\n"); | 97 | seq_printf(m, "stepping\t: unknown\n"); |
87 | 98 | ||
88 | if ( cpu_has(c, X86_FEATURE_TSC) ) { | 99 | if ( cpu_has(c, X86_FEATURE_TSC) ) { |
100 | unsigned int freq = cpufreq_quick_get(n); | ||
101 | if (!freq) | ||
102 | freq = cpu_khz; | ||
89 | seq_printf(m, "cpu MHz\t\t: %u.%03u\n", | 103 | seq_printf(m, "cpu MHz\t\t: %u.%03u\n", |
90 | cpu_khz / 1000, (cpu_khz % 1000)); | 104 | freq / 1000, (freq % 1000)); |
91 | } | 105 | } |
92 | 106 | ||
93 | /* Cache size */ | 107 | /* Cache size */ |
@@ -127,6 +141,17 @@ static int show_cpuinfo(struct seq_file *m, void *v) | |||
127 | x86_cap_flags[i] != NULL ) | 141 | x86_cap_flags[i] != NULL ) |
128 | seq_printf(m, " %s", x86_cap_flags[i]); | 142 | seq_printf(m, " %s", x86_cap_flags[i]); |
129 | 143 | ||
144 | for (i = 0; i < 32; i++) | ||
145 | if (c->x86_power & (1 << i)) { | ||
146 | if (i < ARRAY_SIZE(x86_power_flags) && | ||
147 | x86_power_flags[i]) | ||
148 | seq_printf(m, "%s%s", | ||
149 | x86_power_flags[i][0]?" ":"", | ||
150 | x86_power_flags[i]); | ||
151 | else | ||
152 | seq_printf(m, " [%d]", i); | ||
153 | } | ||
154 | |||
130 | seq_printf(m, "\nbogomips\t: %lu.%02lu\n\n", | 155 | seq_printf(m, "\nbogomips\t: %lu.%02lu\n\n", |
131 | c->loops_per_jiffy/(500000/HZ), | 156 | c->loops_per_jiffy/(500000/HZ), |
132 | (c->loops_per_jiffy/(5000/HZ)) % 100); | 157 | (c->loops_per_jiffy/(5000/HZ)) % 100); |
diff --git a/arch/i386/kernel/cpuid.c b/arch/i386/kernel/cpuid.c index 13bae799e626..006141d1c12a 100644 --- a/arch/i386/kernel/cpuid.c +++ b/arch/i386/kernel/cpuid.c | |||
@@ -117,14 +117,13 @@ static ssize_t cpuid_read(struct file *file, char __user *buf, | |||
117 | { | 117 | { |
118 | char __user *tmp = buf; | 118 | char __user *tmp = buf; |
119 | u32 data[4]; | 119 | u32 data[4]; |
120 | size_t rv; | ||
121 | u32 reg = *ppos; | 120 | u32 reg = *ppos; |
122 | int cpu = iminor(file->f_dentry->d_inode); | 121 | int cpu = iminor(file->f_dentry->d_inode); |
123 | 122 | ||
124 | if (count % 16) | 123 | if (count % 16) |
125 | return -EINVAL; /* Invalid chunk size */ | 124 | return -EINVAL; /* Invalid chunk size */ |
126 | 125 | ||
127 | for (rv = 0; count; count -= 16) { | 126 | for (; count; count -= 16) { |
128 | do_cpuid(cpu, reg, data); | 127 | do_cpuid(cpu, reg, data); |
129 | if (copy_to_user(tmp, &data, 16)) | 128 | if (copy_to_user(tmp, &data, 16)) |
130 | return -EFAULT; | 129 | return -EFAULT; |
diff --git a/arch/i386/kernel/crash.c b/arch/i386/kernel/crash.c index 0248e084017c..d49dbe8dc96b 100644 --- a/arch/i386/kernel/crash.c +++ b/arch/i386/kernel/crash.c | |||
@@ -25,7 +25,6 @@ | |||
25 | #include <mach_ipi.h> | 25 | #include <mach_ipi.h> |
26 | 26 | ||
27 | 27 | ||
28 | note_buf_t crash_notes[NR_CPUS]; | ||
29 | /* This keeps a track of which one is crashing cpu. */ | 28 | /* This keeps a track of which one is crashing cpu. */ |
30 | static int crashing_cpu; | 29 | static int crashing_cpu; |
31 | 30 | ||
@@ -72,7 +71,9 @@ static void crash_save_this_cpu(struct pt_regs *regs, int cpu) | |||
72 | * squirrelled away. ELF notes happen to provide | 71 | * squirrelled away. ELF notes happen to provide |
73 | * all of that that no need to invent something new. | 72 | * all of that that no need to invent something new. |
74 | */ | 73 | */ |
75 | buf = &crash_notes[cpu][0]; | 74 | buf = (u32*)per_cpu_ptr(crash_notes, cpu); |
75 | if (!buf) | ||
76 | return; | ||
76 | memset(&prstatus, 0, sizeof(prstatus)); | 77 | memset(&prstatus, 0, sizeof(prstatus)); |
77 | prstatus.pr_pid = current->pid; | 78 | prstatus.pr_pid = current->pid; |
78 | elf_core_copy_regs(&prstatus.pr_reg, regs); | 79 | elf_core_copy_regs(&prstatus.pr_reg, regs); |
@@ -81,51 +82,12 @@ static void crash_save_this_cpu(struct pt_regs *regs, int cpu) | |||
81 | final_note(buf); | 82 | final_note(buf); |
82 | } | 83 | } |
83 | 84 | ||
84 | static void crash_get_current_regs(struct pt_regs *regs) | 85 | static void crash_save_self(struct pt_regs *regs) |
85 | { | ||
86 | __asm__ __volatile__("movl %%ebx,%0" : "=m"(regs->ebx)); | ||
87 | __asm__ __volatile__("movl %%ecx,%0" : "=m"(regs->ecx)); | ||
88 | __asm__ __volatile__("movl %%edx,%0" : "=m"(regs->edx)); | ||
89 | __asm__ __volatile__("movl %%esi,%0" : "=m"(regs->esi)); | ||
90 | __asm__ __volatile__("movl %%edi,%0" : "=m"(regs->edi)); | ||
91 | __asm__ __volatile__("movl %%ebp,%0" : "=m"(regs->ebp)); | ||
92 | __asm__ __volatile__("movl %%eax,%0" : "=m"(regs->eax)); | ||
93 | __asm__ __volatile__("movl %%esp,%0" : "=m"(regs->esp)); | ||
94 | __asm__ __volatile__("movw %%ss, %%ax;" :"=a"(regs->xss)); | ||
95 | __asm__ __volatile__("movw %%cs, %%ax;" :"=a"(regs->xcs)); | ||
96 | __asm__ __volatile__("movw %%ds, %%ax;" :"=a"(regs->xds)); | ||
97 | __asm__ __volatile__("movw %%es, %%ax;" :"=a"(regs->xes)); | ||
98 | __asm__ __volatile__("pushfl; popl %0" :"=m"(regs->eflags)); | ||
99 | |||
100 | regs->eip = (unsigned long)current_text_addr(); | ||
101 | } | ||
102 | |||
103 | /* CPU does not save ss and esp on stack if execution is already | ||
104 | * running in kernel mode at the time of NMI occurrence. This code | ||
105 | * fixes it. | ||
106 | */ | ||
107 | static void crash_setup_regs(struct pt_regs *newregs, struct pt_regs *oldregs) | ||
108 | { | ||
109 | memcpy(newregs, oldregs, sizeof(*newregs)); | ||
110 | newregs->esp = (unsigned long)&(oldregs->esp); | ||
111 | __asm__ __volatile__("xorl %eax, %eax;"); | ||
112 | __asm__ __volatile__ ("movw %%ss, %%ax;" :"=a"(newregs->xss)); | ||
113 | } | ||
114 | |||
115 | /* We may have saved_regs from where the error came from | ||
116 | * or it is NULL if via a direct panic(). | ||
117 | */ | ||
118 | static void crash_save_self(struct pt_regs *saved_regs) | ||
119 | { | 86 | { |
120 | struct pt_regs regs; | ||
121 | int cpu; | 87 | int cpu; |
122 | 88 | ||
123 | cpu = smp_processor_id(); | 89 | cpu = smp_processor_id(); |
124 | if (saved_regs) | 90 | crash_save_this_cpu(regs, cpu); |
125 | crash_setup_regs(®s, saved_regs); | ||
126 | else | ||
127 | crash_get_current_regs(®s); | ||
128 | crash_save_this_cpu(®s, cpu); | ||
129 | } | 91 | } |
130 | 92 | ||
131 | #ifdef CONFIG_SMP | 93 | #ifdef CONFIG_SMP |
@@ -144,7 +106,7 @@ static int crash_nmi_callback(struct pt_regs *regs, int cpu) | |||
144 | local_irq_disable(); | 106 | local_irq_disable(); |
145 | 107 | ||
146 | if (!user_mode(regs)) { | 108 | if (!user_mode(regs)) { |
147 | crash_setup_regs(&fixed_regs, regs); | 109 | crash_fixup_ss_esp(&fixed_regs, regs); |
148 | regs = &fixed_regs; | 110 | regs = &fixed_regs; |
149 | } | 111 | } |
150 | crash_save_this_cpu(regs, cpu); | 112 | crash_save_this_cpu(regs, cpu); |
diff --git a/arch/i386/kernel/crash_dump.c b/arch/i386/kernel/crash_dump.c new file mode 100644 index 000000000000..3f532df488bc --- /dev/null +++ b/arch/i386/kernel/crash_dump.c | |||
@@ -0,0 +1,74 @@ | |||
1 | /* | ||
2 | * kernel/crash_dump.c - Memory preserving reboot related code. | ||
3 | * | ||
4 | * Created by: Hariprasad Nellitheertha (hari@in.ibm.com) | ||
5 | * Copyright (C) IBM Corporation, 2004. All rights reserved | ||
6 | */ | ||
7 | |||
8 | #include <linux/errno.h> | ||
9 | #include <linux/highmem.h> | ||
10 | #include <linux/crash_dump.h> | ||
11 | |||
12 | #include <asm/uaccess.h> | ||
13 | |||
14 | static void *kdump_buf_page; | ||
15 | |||
16 | /** | ||
17 | * copy_oldmem_page - copy one page from "oldmem" | ||
18 | * @pfn: page frame number to be copied | ||
19 | * @buf: target memory address for the copy; this can be in kernel address | ||
20 | * space or user address space (see @userbuf) | ||
21 | * @csize: number of bytes to copy | ||
22 | * @offset: offset in bytes into the page (based on pfn) to begin the copy | ||
23 | * @userbuf: if set, @buf is in user address space, use copy_to_user(), | ||
24 | * otherwise @buf is in kernel address space, use memcpy(). | ||
25 | * | ||
26 | * Copy a page from "oldmem". For this page, there is no pte mapped | ||
27 | * in the current kernel. We stitch up a pte, similar to kmap_atomic. | ||
28 | * | ||
29 | * Calling copy_to_user() in atomic context is not desirable. Hence first | ||
30 | * copying the data to a pre-allocated kernel page and then copying to user | ||
31 | * space in non-atomic context. | ||
32 | */ | ||
33 | ssize_t copy_oldmem_page(unsigned long pfn, char *buf, | ||
34 | size_t csize, unsigned long offset, int userbuf) | ||
35 | { | ||
36 | void *vaddr; | ||
37 | |||
38 | if (!csize) | ||
39 | return 0; | ||
40 | |||
41 | vaddr = kmap_atomic_pfn(pfn, KM_PTE0); | ||
42 | |||
43 | if (!userbuf) { | ||
44 | memcpy(buf, (vaddr + offset), csize); | ||
45 | kunmap_atomic(vaddr, KM_PTE0); | ||
46 | } else { | ||
47 | if (!kdump_buf_page) { | ||
48 | printk(KERN_WARNING "Kdump: Kdump buffer page not" | ||
49 | " allocated\n"); | ||
50 | return -EFAULT; | ||
51 | } | ||
52 | copy_page(kdump_buf_page, vaddr); | ||
53 | kunmap_atomic(vaddr, KM_PTE0); | ||
54 | if (copy_to_user(buf, (kdump_buf_page + offset), csize)) | ||
55 | return -EFAULT; | ||
56 | } | ||
57 | |||
58 | return csize; | ||
59 | } | ||
60 | |||
61 | static int __init kdump_buf_page_init(void) | ||
62 | { | ||
63 | int ret = 0; | ||
64 | |||
65 | kdump_buf_page = kmalloc(PAGE_SIZE, GFP_KERNEL); | ||
66 | if (!kdump_buf_page) { | ||
67 | printk(KERN_WARNING "Kdump: Failed to allocate kdump buffer" | ||
68 | " page\n"); | ||
69 | ret = -ENOMEM; | ||
70 | } | ||
71 | |||
72 | return ret; | ||
73 | } | ||
74 | arch_initcall(kdump_buf_page_init); | ||
diff --git a/arch/i386/kernel/dmi_scan.c b/arch/i386/kernel/dmi_scan.c index 58516e2ac172..6a93d75db431 100644 --- a/arch/i386/kernel/dmi_scan.c +++ b/arch/i386/kernel/dmi_scan.c | |||
@@ -4,7 +4,7 @@ | |||
4 | #include <linux/module.h> | 4 | #include <linux/module.h> |
5 | #include <linux/dmi.h> | 5 | #include <linux/dmi.h> |
6 | #include <linux/bootmem.h> | 6 | #include <linux/bootmem.h> |
7 | 7 | #include <linux/slab.h> | |
8 | 8 | ||
9 | static char * __init dmi_string(struct dmi_header *dm, u8 s) | 9 | static char * __init dmi_string(struct dmi_header *dm, u8 s) |
10 | { | 10 | { |
@@ -19,7 +19,7 @@ static char * __init dmi_string(struct dmi_header *dm, u8 s) | |||
19 | } | 19 | } |
20 | 20 | ||
21 | if (*bp != 0) { | 21 | if (*bp != 0) { |
22 | str = alloc_bootmem(strlen(bp) + 1); | 22 | str = dmi_alloc(strlen(bp) + 1); |
23 | if (str != NULL) | 23 | if (str != NULL) |
24 | strcpy(str, bp); | 24 | strcpy(str, bp); |
25 | else | 25 | else |
@@ -40,7 +40,7 @@ static int __init dmi_table(u32 base, int len, int num, | |||
40 | u8 *buf, *data; | 40 | u8 *buf, *data; |
41 | int i = 0; | 41 | int i = 0; |
42 | 42 | ||
43 | buf = bt_ioremap(base, len); | 43 | buf = dmi_ioremap(base, len); |
44 | if (buf == NULL) | 44 | if (buf == NULL) |
45 | return -1; | 45 | return -1; |
46 | 46 | ||
@@ -65,7 +65,7 @@ static int __init dmi_table(u32 base, int len, int num, | |||
65 | data += 2; | 65 | data += 2; |
66 | i++; | 66 | i++; |
67 | } | 67 | } |
68 | bt_iounmap(buf, len); | 68 | dmi_iounmap(buf, len); |
69 | return 0; | 69 | return 0; |
70 | } | 70 | } |
71 | 71 | ||
@@ -112,7 +112,7 @@ static void __init dmi_save_devices(struct dmi_header *dm) | |||
112 | if ((*d & 0x80) == 0) | 112 | if ((*d & 0x80) == 0) |
113 | continue; | 113 | continue; |
114 | 114 | ||
115 | dev = alloc_bootmem(sizeof(*dev)); | 115 | dev = dmi_alloc(sizeof(*dev)); |
116 | if (!dev) { | 116 | if (!dev) { |
117 | printk(KERN_ERR "dmi_save_devices: out of memory.\n"); | 117 | printk(KERN_ERR "dmi_save_devices: out of memory.\n"); |
118 | break; | 118 | break; |
@@ -131,7 +131,7 @@ static void __init dmi_save_ipmi_device(struct dmi_header *dm) | |||
131 | struct dmi_device *dev; | 131 | struct dmi_device *dev; |
132 | void * data; | 132 | void * data; |
133 | 133 | ||
134 | data = alloc_bootmem(dm->length); | 134 | data = dmi_alloc(dm->length); |
135 | if (data == NULL) { | 135 | if (data == NULL) { |
136 | printk(KERN_ERR "dmi_save_ipmi_device: out of memory.\n"); | 136 | printk(KERN_ERR "dmi_save_ipmi_device: out of memory.\n"); |
137 | return; | 137 | return; |
@@ -139,7 +139,7 @@ static void __init dmi_save_ipmi_device(struct dmi_header *dm) | |||
139 | 139 | ||
140 | memcpy(data, dm, dm->length); | 140 | memcpy(data, dm, dm->length); |
141 | 141 | ||
142 | dev = alloc_bootmem(sizeof(*dev)); | 142 | dev = dmi_alloc(sizeof(*dev)); |
143 | if (!dev) { | 143 | if (!dev) { |
144 | printk(KERN_ERR "dmi_save_ipmi_device: out of memory.\n"); | 144 | printk(KERN_ERR "dmi_save_ipmi_device: out of memory.\n"); |
145 | return; | 145 | return; |
@@ -221,7 +221,7 @@ void __init dmi_scan_machine(void) | |||
221 | } | 221 | } |
222 | } | 222 | } |
223 | 223 | ||
224 | out: printk(KERN_INFO "DMI not present.\n"); | 224 | out: printk(KERN_INFO "DMI not present or invalid.\n"); |
225 | } | 225 | } |
226 | 226 | ||
227 | 227 | ||
diff --git a/arch/i386/kernel/entry.S b/arch/i386/kernel/entry.S index e50b93155249..4d704724b2f5 100644 --- a/arch/i386/kernel/entry.S +++ b/arch/i386/kernel/entry.S | |||
@@ -323,6 +323,7 @@ work_notifysig: # deal with pending signals and | |||
323 | 323 | ||
324 | ALIGN | 324 | ALIGN |
325 | work_notifysig_v86: | 325 | work_notifysig_v86: |
326 | #ifdef CONFIG_VM86 | ||
326 | pushl %ecx # save ti_flags for do_notify_resume | 327 | pushl %ecx # save ti_flags for do_notify_resume |
327 | call save_v86_state # %eax contains pt_regs pointer | 328 | call save_v86_state # %eax contains pt_regs pointer |
328 | popl %ecx | 329 | popl %ecx |
@@ -330,6 +331,7 @@ work_notifysig_v86: | |||
330 | xorl %edx, %edx | 331 | xorl %edx, %edx |
331 | call do_notify_resume | 332 | call do_notify_resume |
332 | jmp resume_userspace | 333 | jmp resume_userspace |
334 | #endif | ||
333 | 335 | ||
334 | # perform syscall exit tracing | 336 | # perform syscall exit tracing |
335 | ALIGN | 337 | ALIGN |
@@ -657,6 +659,7 @@ ENTRY(spurious_interrupt_bug) | |||
657 | pushl $do_spurious_interrupt_bug | 659 | pushl $do_spurious_interrupt_bug |
658 | jmp error_code | 660 | jmp error_code |
659 | 661 | ||
662 | .section .rodata,"a" | ||
660 | #include "syscall_table.S" | 663 | #include "syscall_table.S" |
661 | 664 | ||
662 | syscall_table_size=(.-sys_call_table) | 665 | syscall_table_size=(.-sys_call_table) |
diff --git a/arch/i386/kernel/head.S b/arch/i386/kernel/head.S index e437fb367498..5884469f6bfe 100644 --- a/arch/i386/kernel/head.S +++ b/arch/i386/kernel/head.S | |||
@@ -504,19 +504,24 @@ ENTRY(cpu_gdt_table) | |||
504 | .quad 0x0000000000000000 /* 0x80 TSS descriptor */ | 504 | .quad 0x0000000000000000 /* 0x80 TSS descriptor */ |
505 | .quad 0x0000000000000000 /* 0x88 LDT descriptor */ | 505 | .quad 0x0000000000000000 /* 0x88 LDT descriptor */ |
506 | 506 | ||
507 | /* Segments used for calling PnP BIOS */ | 507 | /* |
508 | .quad 0x00c09a0000000000 /* 0x90 32-bit code */ | 508 | * Segments used for calling PnP BIOS have byte granularity. |
509 | .quad 0x00809a0000000000 /* 0x98 16-bit code */ | 509 | * They code segments and data segments have fixed 64k limits, |
510 | .quad 0x0080920000000000 /* 0xa0 16-bit data */ | 510 | * the transfer segment sizes are set at run time. |
511 | .quad 0x0080920000000000 /* 0xa8 16-bit data */ | 511 | */ |
512 | .quad 0x0080920000000000 /* 0xb0 16-bit data */ | 512 | .quad 0x00409a000000ffff /* 0x90 32-bit code */ |
513 | .quad 0x00009a000000ffff /* 0x98 16-bit code */ | ||
514 | .quad 0x000092000000ffff /* 0xa0 16-bit data */ | ||
515 | .quad 0x0000920000000000 /* 0xa8 16-bit data */ | ||
516 | .quad 0x0000920000000000 /* 0xb0 16-bit data */ | ||
517 | |||
513 | /* | 518 | /* |
514 | * The APM segments have byte granularity and their bases | 519 | * The APM segments have byte granularity and their bases |
515 | * and limits are set at run time. | 520 | * are set at run time. All have 64k limits. |
516 | */ | 521 | */ |
517 | .quad 0x00409a0000000000 /* 0xb8 APM CS code */ | 522 | .quad 0x00409a000000ffff /* 0xb8 APM CS code */ |
518 | .quad 0x00009a0000000000 /* 0xc0 APM CS 16 code (16 bit) */ | 523 | .quad 0x00009a000000ffff /* 0xc0 APM CS 16 code (16 bit) */ |
519 | .quad 0x0040920000000000 /* 0xc8 APM DS data */ | 524 | .quad 0x004092000000ffff /* 0xc8 APM DS data */ |
520 | 525 | ||
521 | .quad 0x0000920000000000 /* 0xd0 - ESPFIX 16-bit SS */ | 526 | .quad 0x0000920000000000 /* 0xd0 - ESPFIX 16-bit SS */ |
522 | .quad 0x0000000000000000 /* 0xd8 - unused */ | 527 | .quad 0x0000000000000000 /* 0xd8 - unused */ |
@@ -525,3 +530,5 @@ ENTRY(cpu_gdt_table) | |||
525 | .quad 0x0000000000000000 /* 0xf0 - unused */ | 530 | .quad 0x0000000000000000 /* 0xf0 - unused */ |
526 | .quad 0x0000000000000000 /* 0xf8 - GDT entry 31: double-fault TSS */ | 531 | .quad 0x0000000000000000 /* 0xf8 - GDT entry 31: double-fault TSS */ |
527 | 532 | ||
533 | /* Be sure this is zeroed to avoid false validations in Xen */ | ||
534 | .fill PAGE_SIZE_asm / 8 - GDT_ENTRIES,8,0 | ||
diff --git a/arch/i386/kernel/i386_ksyms.c b/arch/i386/kernel/i386_ksyms.c index 180f070d03cb..3999bec50c33 100644 --- a/arch/i386/kernel/i386_ksyms.c +++ b/arch/i386/kernel/i386_ksyms.c | |||
@@ -3,8 +3,7 @@ | |||
3 | #include <asm/checksum.h> | 3 | #include <asm/checksum.h> |
4 | #include <asm/desc.h> | 4 | #include <asm/desc.h> |
5 | 5 | ||
6 | /* This is definitely a GPL-only symbol */ | 6 | EXPORT_SYMBOL_GPL(cpu_gdt_descr); |
7 | EXPORT_SYMBOL_GPL(cpu_gdt_table); | ||
8 | 7 | ||
9 | EXPORT_SYMBOL(__down_failed); | 8 | EXPORT_SYMBOL(__down_failed); |
10 | EXPORT_SYMBOL(__down_failed_interruptible); | 9 | EXPORT_SYMBOL(__down_failed_interruptible); |
diff --git a/arch/i386/kernel/init_task.c b/arch/i386/kernel/init_task.c index 9caa8e8db80c..cff95d10a4d8 100644 --- a/arch/i386/kernel/init_task.c +++ b/arch/i386/kernel/init_task.c | |||
@@ -42,5 +42,5 @@ EXPORT_SYMBOL(init_task); | |||
42 | * per-CPU TSS segments. Threads are completely 'soft' on Linux, | 42 | * per-CPU TSS segments. Threads are completely 'soft' on Linux, |
43 | * no more per-task TSS's. | 43 | * no more per-task TSS's. |
44 | */ | 44 | */ |
45 | DEFINE_PER_CPU(struct tss_struct, init_tss) ____cacheline_maxaligned_in_smp = INIT_TSS; | 45 | DEFINE_PER_CPU(struct tss_struct, init_tss) ____cacheline_internodealigned_in_smp = INIT_TSS; |
46 | 46 | ||
diff --git a/arch/i386/kernel/io_apic.c b/arch/i386/kernel/io_apic.c index 22c8675c79f4..f2dd218d88cb 100644 --- a/arch/i386/kernel/io_apic.c +++ b/arch/i386/kernel/io_apic.c | |||
@@ -1649,7 +1649,7 @@ static void __init enable_IO_APIC(void) | |||
1649 | for(apic = 0; apic < nr_ioapics; apic++) { | 1649 | for(apic = 0; apic < nr_ioapics; apic++) { |
1650 | int pin; | 1650 | int pin; |
1651 | /* See if any of the pins is in ExtINT mode */ | 1651 | /* See if any of the pins is in ExtINT mode */ |
1652 | for(pin = 0; pin < nr_ioapic_registers[i]; pin++) { | 1652 | for (pin = 0; pin < nr_ioapic_registers[apic]; pin++) { |
1653 | struct IO_APIC_route_entry entry; | 1653 | struct IO_APIC_route_entry entry; |
1654 | spin_lock_irqsave(&ioapic_lock, flags); | 1654 | spin_lock_irqsave(&ioapic_lock, flags); |
1655 | *(((int *)&entry) + 0) = io_apic_read(apic, 0x10 + 2 * pin); | 1655 | *(((int *)&entry) + 0) = io_apic_read(apic, 0x10 + 2 * pin); |
@@ -1722,8 +1722,8 @@ void disable_IO_APIC(void) | |||
1722 | entry.dest_mode = 0; /* Physical */ | 1722 | entry.dest_mode = 0; /* Physical */ |
1723 | entry.delivery_mode = dest_ExtINT; /* ExtInt */ | 1723 | entry.delivery_mode = dest_ExtINT; /* ExtInt */ |
1724 | entry.vector = 0; | 1724 | entry.vector = 0; |
1725 | entry.dest.physical.physical_dest = 0; | 1725 | entry.dest.physical.physical_dest = |
1726 | 1726 | GET_APIC_ID(apic_read(APIC_ID)); | |
1727 | 1727 | ||
1728 | /* | 1728 | /* |
1729 | * Add it to the IO-APIC irq-routing table: | 1729 | * Add it to the IO-APIC irq-routing table: |
diff --git a/arch/i386/kernel/ioport.c b/arch/i386/kernel/ioport.c index b59a34dbe262..79026f026b85 100644 --- a/arch/i386/kernel/ioport.c +++ b/arch/i386/kernel/ioport.c | |||
@@ -7,6 +7,7 @@ | |||
7 | 7 | ||
8 | #include <linux/sched.h> | 8 | #include <linux/sched.h> |
9 | #include <linux/kernel.h> | 9 | #include <linux/kernel.h> |
10 | #include <linux/capability.h> | ||
10 | #include <linux/errno.h> | 11 | #include <linux/errno.h> |
11 | #include <linux/types.h> | 12 | #include <linux/types.h> |
12 | #include <linux/ioport.h> | 13 | #include <linux/ioport.h> |
diff --git a/arch/i386/kernel/irq.c b/arch/i386/kernel/irq.c index 1a201a932865..f3a9c78c4a24 100644 --- a/arch/i386/kernel/irq.c +++ b/arch/i386/kernel/irq.c | |||
@@ -19,7 +19,7 @@ | |||
19 | #include <linux/cpu.h> | 19 | #include <linux/cpu.h> |
20 | #include <linux/delay.h> | 20 | #include <linux/delay.h> |
21 | 21 | ||
22 | DEFINE_PER_CPU(irq_cpustat_t, irq_stat) ____cacheline_maxaligned_in_smp; | 22 | DEFINE_PER_CPU(irq_cpustat_t, irq_stat) ____cacheline_internodealigned_in_smp; |
23 | EXPORT_PER_CPU_SYMBOL(irq_stat); | 23 | EXPORT_PER_CPU_SYMBOL(irq_stat); |
24 | 24 | ||
25 | #ifndef CONFIG_X86_LOCAL_APIC | 25 | #ifndef CONFIG_X86_LOCAL_APIC |
diff --git a/arch/i386/kernel/kprobes.c b/arch/i386/kernel/kprobes.c index 32b0c24ab9a6..6483eeb1a4e8 100644 --- a/arch/i386/kernel/kprobes.c +++ b/arch/i386/kernel/kprobes.c | |||
@@ -58,13 +58,9 @@ static inline int is_IF_modifier(kprobe_opcode_t opcode) | |||
58 | 58 | ||
59 | int __kprobes arch_prepare_kprobe(struct kprobe *p) | 59 | int __kprobes arch_prepare_kprobe(struct kprobe *p) |
60 | { | 60 | { |
61 | return 0; | ||
62 | } | ||
63 | |||
64 | void __kprobes arch_copy_kprobe(struct kprobe *p) | ||
65 | { | ||
66 | memcpy(p->ainsn.insn, p->addr, MAX_INSN_SIZE * sizeof(kprobe_opcode_t)); | 61 | memcpy(p->ainsn.insn, p->addr, MAX_INSN_SIZE * sizeof(kprobe_opcode_t)); |
67 | p->opcode = *p->addr; | 62 | p->opcode = *p->addr; |
63 | return 0; | ||
68 | } | 64 | } |
69 | 65 | ||
70 | void __kprobes arch_arm_kprobe(struct kprobe *p) | 66 | void __kprobes arch_arm_kprobe(struct kprobe *p) |
@@ -81,10 +77,6 @@ void __kprobes arch_disarm_kprobe(struct kprobe *p) | |||
81 | (unsigned long) p->addr + sizeof(kprobe_opcode_t)); | 77 | (unsigned long) p->addr + sizeof(kprobe_opcode_t)); |
82 | } | 78 | } |
83 | 79 | ||
84 | void __kprobes arch_remove_kprobe(struct kprobe *p) | ||
85 | { | ||
86 | } | ||
87 | |||
88 | static inline void save_previous_kprobe(struct kprobe_ctlblk *kcb) | 80 | static inline void save_previous_kprobe(struct kprobe_ctlblk *kcb) |
89 | { | 81 | { |
90 | kcb->prev_kprobe.kp = kprobe_running(); | 82 | kcb->prev_kprobe.kp = kprobe_running(); |
@@ -191,11 +183,24 @@ static int __kprobes kprobe_handler(struct pt_regs *regs) | |||
191 | */ | 183 | */ |
192 | save_previous_kprobe(kcb); | 184 | save_previous_kprobe(kcb); |
193 | set_current_kprobe(p, regs, kcb); | 185 | set_current_kprobe(p, regs, kcb); |
194 | p->nmissed++; | 186 | kprobes_inc_nmissed_count(p); |
195 | prepare_singlestep(p, regs); | 187 | prepare_singlestep(p, regs); |
196 | kcb->kprobe_status = KPROBE_REENTER; | 188 | kcb->kprobe_status = KPROBE_REENTER; |
197 | return 1; | 189 | return 1; |
198 | } else { | 190 | } else { |
191 | if (regs->eflags & VM_MASK) { | ||
192 | /* We are in virtual-8086 mode. Return 0 */ | ||
193 | goto no_kprobe; | ||
194 | } | ||
195 | if (*addr != BREAKPOINT_INSTRUCTION) { | ||
196 | /* The breakpoint instruction was removed by | ||
197 | * another cpu right after we hit, no further | ||
198 | * handling of this interrupt is appropriate | ||
199 | */ | ||
200 | regs->eip -= sizeof(kprobe_opcode_t); | ||
201 | ret = 1; | ||
202 | goto no_kprobe; | ||
203 | } | ||
199 | p = __get_cpu_var(current_kprobe); | 204 | p = __get_cpu_var(current_kprobe); |
200 | if (p->break_handler && p->break_handler(p, regs)) { | 205 | if (p->break_handler && p->break_handler(p, regs)) { |
201 | goto ss_probe; | 206 | goto ss_probe; |
diff --git a/arch/i386/kernel/microcode.c b/arch/i386/kernel/microcode.c index 165f13158c60..d3fdf0057d82 100644 --- a/arch/i386/kernel/microcode.c +++ b/arch/i386/kernel/microcode.c | |||
@@ -70,6 +70,7 @@ | |||
70 | */ | 70 | */ |
71 | 71 | ||
72 | //#define DEBUG /* pr_debug */ | 72 | //#define DEBUG /* pr_debug */ |
73 | #include <linux/capability.h> | ||
73 | #include <linux/kernel.h> | 74 | #include <linux/kernel.h> |
74 | #include <linux/init.h> | 75 | #include <linux/init.h> |
75 | #include <linux/sched.h> | 76 | #include <linux/sched.h> |
@@ -165,7 +166,7 @@ static void collect_cpu_info (void *unused) | |||
165 | 166 | ||
166 | wrmsr(MSR_IA32_UCODE_REV, 0, 0); | 167 | wrmsr(MSR_IA32_UCODE_REV, 0, 0); |
167 | /* see notes above for revision 1.07. Apparent chip bug */ | 168 | /* see notes above for revision 1.07. Apparent chip bug */ |
168 | serialize_cpu(); | 169 | sync_core(); |
169 | /* get the current revision from MSR 0x8B */ | 170 | /* get the current revision from MSR 0x8B */ |
170 | rdmsr(MSR_IA32_UCODE_REV, val[0], uci->rev); | 171 | rdmsr(MSR_IA32_UCODE_REV, val[0], uci->rev); |
171 | pr_debug("microcode: collect_cpu_info : sig=0x%x, pf=0x%x, rev=0x%x\n", | 172 | pr_debug("microcode: collect_cpu_info : sig=0x%x, pf=0x%x, rev=0x%x\n", |
@@ -379,7 +380,7 @@ static void do_update_one (void * unused) | |||
379 | wrmsr(MSR_IA32_UCODE_REV, 0, 0); | 380 | wrmsr(MSR_IA32_UCODE_REV, 0, 0); |
380 | 381 | ||
381 | /* see notes above for revision 1.07. Apparent chip bug */ | 382 | /* see notes above for revision 1.07. Apparent chip bug */ |
382 | serialize_cpu(); | 383 | sync_core(); |
383 | 384 | ||
384 | /* get the current revision from MSR 0x8B */ | 385 | /* get the current revision from MSR 0x8B */ |
385 | rdmsr(MSR_IA32_UCODE_REV, val[0], val[1]); | 386 | rdmsr(MSR_IA32_UCODE_REV, val[0], val[1]); |
diff --git a/arch/i386/kernel/mpparse.c b/arch/i386/kernel/mpparse.c index 1ca5269b1e86..0102f3d50e57 100644 --- a/arch/i386/kernel/mpparse.c +++ b/arch/i386/kernel/mpparse.c | |||
@@ -38,6 +38,12 @@ | |||
38 | int smp_found_config; | 38 | int smp_found_config; |
39 | unsigned int __initdata maxcpus = NR_CPUS; | 39 | unsigned int __initdata maxcpus = NR_CPUS; |
40 | 40 | ||
41 | #ifdef CONFIG_HOTPLUG_CPU | ||
42 | #define CPU_HOTPLUG_ENABLED (1) | ||
43 | #else | ||
44 | #define CPU_HOTPLUG_ENABLED (0) | ||
45 | #endif | ||
46 | |||
41 | /* | 47 | /* |
42 | * Various Linux-internal data structures created from the | 48 | * Various Linux-internal data structures created from the |
43 | * MP-table. | 49 | * MP-table. |
@@ -219,14 +225,18 @@ static void __devinit MP_processor_info (struct mpc_config_processor *m) | |||
219 | cpu_set(num_processors, cpu_possible_map); | 225 | cpu_set(num_processors, cpu_possible_map); |
220 | num_processors++; | 226 | num_processors++; |
221 | 227 | ||
222 | if ((num_processors > 8) && | 228 | if (CPU_HOTPLUG_ENABLED || (num_processors > 8)) { |
223 | ((APIC_XAPIC(ver) && | 229 | switch (boot_cpu_data.x86_vendor) { |
224 | (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL)) || | 230 | case X86_VENDOR_INTEL: |
225 | (boot_cpu_data.x86_vendor == X86_VENDOR_AMD))) | 231 | if (!APIC_XAPIC(ver)) { |
226 | def_to_bigsmp = 1; | 232 | def_to_bigsmp = 0; |
227 | else | 233 | break; |
228 | def_to_bigsmp = 0; | 234 | } |
229 | 235 | /* If P4 and above fall through */ | |
236 | case X86_VENDOR_AMD: | ||
237 | def_to_bigsmp = 1; | ||
238 | } | ||
239 | } | ||
230 | bios_cpu_apicid[num_processors - 1] = m->mpc_apicid; | 240 | bios_cpu_apicid[num_processors - 1] = m->mpc_apicid; |
231 | } | 241 | } |
232 | 242 | ||
@@ -1070,7 +1080,7 @@ void __init mp_config_acpi_legacy_irqs (void) | |||
1070 | 1080 | ||
1071 | #define MAX_GSI_NUM 4096 | 1081 | #define MAX_GSI_NUM 4096 |
1072 | 1082 | ||
1073 | int mp_register_gsi (u32 gsi, int edge_level, int active_high_low) | 1083 | int mp_register_gsi (u32 gsi, int triggering, int polarity) |
1074 | { | 1084 | { |
1075 | int ioapic = -1; | 1085 | int ioapic = -1; |
1076 | int ioapic_pin = 0; | 1086 | int ioapic_pin = 0; |
@@ -1119,7 +1129,7 @@ int mp_register_gsi (u32 gsi, int edge_level, int active_high_low) | |||
1119 | 1129 | ||
1120 | mp_ioapic_routing[ioapic].pin_programmed[idx] |= (1<<bit); | 1130 | mp_ioapic_routing[ioapic].pin_programmed[idx] |= (1<<bit); |
1121 | 1131 | ||
1122 | if (edge_level) { | 1132 | if (triggering == ACPI_LEVEL_SENSITIVE) { |
1123 | /* | 1133 | /* |
1124 | * For PCI devices assign IRQs in order, avoiding gaps | 1134 | * For PCI devices assign IRQs in order, avoiding gaps |
1125 | * due to unused I/O APIC pins. | 1135 | * due to unused I/O APIC pins. |
@@ -1141,8 +1151,8 @@ int mp_register_gsi (u32 gsi, int edge_level, int active_high_low) | |||
1141 | } | 1151 | } |
1142 | 1152 | ||
1143 | io_apic_set_pci_routing(ioapic, ioapic_pin, gsi, | 1153 | io_apic_set_pci_routing(ioapic, ioapic_pin, gsi, |
1144 | edge_level == ACPI_EDGE_SENSITIVE ? 0 : 1, | 1154 | triggering == ACPI_EDGE_SENSITIVE ? 0 : 1, |
1145 | active_high_low == ACPI_ACTIVE_HIGH ? 0 : 1); | 1155 | polarity == ACPI_ACTIVE_HIGH ? 0 : 1); |
1146 | return gsi; | 1156 | return gsi; |
1147 | } | 1157 | } |
1148 | 1158 | ||
diff --git a/arch/i386/kernel/msr.c b/arch/i386/kernel/msr.c index 44470fea4309..1d0a55e68760 100644 --- a/arch/i386/kernel/msr.c +++ b/arch/i386/kernel/msr.c | |||
@@ -172,7 +172,6 @@ static ssize_t msr_read(struct file *file, char __user * buf, | |||
172 | { | 172 | { |
173 | u32 __user *tmp = (u32 __user *) buf; | 173 | u32 __user *tmp = (u32 __user *) buf; |
174 | u32 data[2]; | 174 | u32 data[2]; |
175 | size_t rv; | ||
176 | u32 reg = *ppos; | 175 | u32 reg = *ppos; |
177 | int cpu = iminor(file->f_dentry->d_inode); | 176 | int cpu = iminor(file->f_dentry->d_inode); |
178 | int err; | 177 | int err; |
@@ -180,7 +179,7 @@ static ssize_t msr_read(struct file *file, char __user * buf, | |||
180 | if (count % 8) | 179 | if (count % 8) |
181 | return -EINVAL; /* Invalid chunk size */ | 180 | return -EINVAL; /* Invalid chunk size */ |
182 | 181 | ||
183 | for (rv = 0; count; count -= 8) { | 182 | for (; count; count -= 8) { |
184 | err = do_rdmsr(cpu, reg, &data[0], &data[1]); | 183 | err = do_rdmsr(cpu, reg, &data[0], &data[1]); |
185 | if (err) | 184 | if (err) |
186 | return err; | 185 | return err; |
diff --git a/arch/i386/kernel/process.c b/arch/i386/kernel/process.c index df6c2bcde067..2185377fdde1 100644 --- a/arch/i386/kernel/process.c +++ b/arch/i386/kernel/process.c | |||
@@ -48,6 +48,7 @@ | |||
48 | #include <asm/processor.h> | 48 | #include <asm/processor.h> |
49 | #include <asm/i387.h> | 49 | #include <asm/i387.h> |
50 | #include <asm/desc.h> | 50 | #include <asm/desc.h> |
51 | #include <asm/vm86.h> | ||
51 | #ifdef CONFIG_MATH_EMULATION | 52 | #ifdef CONFIG_MATH_EMULATION |
52 | #include <asm/math_emu.h> | 53 | #include <asm/math_emu.h> |
53 | #endif | 54 | #endif |
@@ -308,9 +309,7 @@ void show_regs(struct pt_regs * regs) | |||
308 | cr0 = read_cr0(); | 309 | cr0 = read_cr0(); |
309 | cr2 = read_cr2(); | 310 | cr2 = read_cr2(); |
310 | cr3 = read_cr3(); | 311 | cr3 = read_cr3(); |
311 | if (current_cpu_data.x86 > 4) { | 312 | cr4 = read_cr4_safe(); |
312 | cr4 = read_cr4(); | ||
313 | } | ||
314 | printk("CR0: %08lx CR2: %08lx CR3: %08lx CR4: %08lx\n", cr0, cr2, cr3, cr4); | 313 | printk("CR0: %08lx CR2: %08lx CR3: %08lx CR4: %08lx\n", cr0, cr2, cr3, cr4); |
315 | show_trace(NULL, ®s->esp); | 314 | show_trace(NULL, ®s->esp); |
316 | } | 315 | } |
@@ -404,17 +403,7 @@ void flush_thread(void) | |||
404 | 403 | ||
405 | void release_thread(struct task_struct *dead_task) | 404 | void release_thread(struct task_struct *dead_task) |
406 | { | 405 | { |
407 | if (dead_task->mm) { | 406 | BUG_ON(dead_task->mm); |
408 | // temporary debugging check | ||
409 | if (dead_task->mm->context.size) { | ||
410 | printk("WARNING: dead process %8s still has LDT? <%p/%d>\n", | ||
411 | dead_task->comm, | ||
412 | dead_task->mm->context.ldt, | ||
413 | dead_task->mm->context.size); | ||
414 | BUG(); | ||
415 | } | ||
416 | } | ||
417 | |||
418 | release_vm86_irqs(dead_task); | 407 | release_vm86_irqs(dead_task); |
419 | } | 408 | } |
420 | 409 | ||
@@ -435,18 +424,7 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long esp, | |||
435 | struct task_struct *tsk; | 424 | struct task_struct *tsk; |
436 | int err; | 425 | int err; |
437 | 426 | ||
438 | childregs = ((struct pt_regs *) (THREAD_SIZE + (unsigned long) p->thread_info)) - 1; | 427 | childregs = task_pt_regs(p); |
439 | /* | ||
440 | * The below -8 is to reserve 8 bytes on top of the ring0 stack. | ||
441 | * This is necessary to guarantee that the entire "struct pt_regs" | ||
442 | * is accessable even if the CPU haven't stored the SS/ESP registers | ||
443 | * on the stack (interrupt gate does not save these registers | ||
444 | * when switching to the same priv ring). | ||
445 | * Therefore beware: accessing the xss/esp fields of the | ||
446 | * "struct pt_regs" is possible, but they may contain the | ||
447 | * completely wrong values. | ||
448 | */ | ||
449 | childregs = (struct pt_regs *) ((unsigned long) childregs - 8); | ||
450 | *childregs = *regs; | 428 | *childregs = *regs; |
451 | childregs->eax = 0; | 429 | childregs->eax = 0; |
452 | childregs->esp = esp; | 430 | childregs->esp = esp; |
@@ -551,10 +529,7 @@ EXPORT_SYMBOL(dump_thread); | |||
551 | */ | 529 | */ |
552 | int dump_task_regs(struct task_struct *tsk, elf_gregset_t *regs) | 530 | int dump_task_regs(struct task_struct *tsk, elf_gregset_t *regs) |
553 | { | 531 | { |
554 | struct pt_regs ptregs; | 532 | struct pt_regs ptregs = *task_pt_regs(tsk); |
555 | |||
556 | ptregs = *(struct pt_regs *) | ||
557 | ((unsigned long)tsk->thread_info+THREAD_SIZE - sizeof(ptregs)); | ||
558 | ptregs.xcs &= 0xffff; | 533 | ptregs.xcs &= 0xffff; |
559 | ptregs.xds &= 0xffff; | 534 | ptregs.xds &= 0xffff; |
560 | ptregs.xes &= 0xffff; | 535 | ptregs.xes &= 0xffff; |
@@ -610,8 +585,8 @@ static inline void disable_tsc(struct task_struct *prev_p, | |||
610 | * gcc should eliminate the ->thread_info dereference if | 585 | * gcc should eliminate the ->thread_info dereference if |
611 | * has_secure_computing returns 0 at compile time (SECCOMP=n). | 586 | * has_secure_computing returns 0 at compile time (SECCOMP=n). |
612 | */ | 587 | */ |
613 | prev = prev_p->thread_info; | 588 | prev = task_thread_info(prev_p); |
614 | next = next_p->thread_info; | 589 | next = task_thread_info(next_p); |
615 | 590 | ||
616 | if (has_secure_computing(prev) || has_secure_computing(next)) { | 591 | if (has_secure_computing(prev) || has_secure_computing(next)) { |
617 | /* slow path here */ | 592 | /* slow path here */ |
@@ -796,7 +771,7 @@ unsigned long get_wchan(struct task_struct *p) | |||
796 | int count = 0; | 771 | int count = 0; |
797 | if (!p || p == current || p->state == TASK_RUNNING) | 772 | if (!p || p == current || p->state == TASK_RUNNING) |
798 | return 0; | 773 | return 0; |
799 | stack_page = (unsigned long)p->thread_info; | 774 | stack_page = (unsigned long)task_stack_page(p); |
800 | esp = p->thread.esp; | 775 | esp = p->thread.esp; |
801 | if (!stack_page || esp < stack_page || esp > top_esp+stack_page) | 776 | if (!stack_page || esp < stack_page || esp > top_esp+stack_page) |
802 | return 0; | 777 | return 0; |
diff --git a/arch/i386/kernel/ptrace.c b/arch/i386/kernel/ptrace.c index 5ffbb4b7ad05..5c1fb6aada5b 100644 --- a/arch/i386/kernel/ptrace.c +++ b/arch/i386/kernel/ptrace.c | |||
@@ -32,9 +32,12 @@ | |||
32 | * in exit.c or in signal.c. | 32 | * in exit.c or in signal.c. |
33 | */ | 33 | */ |
34 | 34 | ||
35 | /* determines which flags the user has access to. */ | 35 | /* |
36 | /* 1 = access 0 = no access */ | 36 | * Determines which flags the user has access to [1 = access, 0 = no access]. |
37 | #define FLAG_MASK 0x00044dd5 | 37 | * Prohibits changing ID(21), VIP(20), VIF(19), VM(17), IOPL(12-13), IF(9). |
38 | * Also masks reserved bits (31-22, 15, 5, 3, 1). | ||
39 | */ | ||
40 | #define FLAG_MASK 0x00054dd5 | ||
38 | 41 | ||
39 | /* set's the trap flag. */ | 42 | /* set's the trap flag. */ |
40 | #define TRAP_FLAG 0x100 | 43 | #define TRAP_FLAG 0x100 |
diff --git a/arch/i386/kernel/quirks.c b/arch/i386/kernel/quirks.c index aaf89cb2bc51..87ccdac84928 100644 --- a/arch/i386/kernel/quirks.c +++ b/arch/i386/kernel/quirks.c | |||
@@ -25,8 +25,7 @@ static void __devinit quirk_intel_irqbalance(struct pci_dev *dev) | |||
25 | 25 | ||
26 | /* enable access to config space*/ | 26 | /* enable access to config space*/ |
27 | pci_read_config_byte(dev, 0xf4, &config); | 27 | pci_read_config_byte(dev, 0xf4, &config); |
28 | config |= 0x2; | 28 | pci_write_config_byte(dev, 0xf4, config|0x2); |
29 | pci_write_config_byte(dev, 0xf4, config); | ||
30 | 29 | ||
31 | /* read xTPR register */ | 30 | /* read xTPR register */ |
32 | raw_pci_ops->read(0, 0, 0x40, 0x4c, 2, &word); | 31 | raw_pci_ops->read(0, 0, 0x40, 0x4c, 2, &word); |
@@ -42,9 +41,9 @@ static void __devinit quirk_intel_irqbalance(struct pci_dev *dev) | |||
42 | #endif | 41 | #endif |
43 | } | 42 | } |
44 | 43 | ||
45 | config &= ~0x2; | 44 | /* put back the original value for config space*/ |
46 | /* disable access to config space*/ | 45 | if (!(config & 0x2)) |
47 | pci_write_config_byte(dev, 0xf4, config); | 46 | pci_write_config_byte(dev, 0xf4, config); |
48 | } | 47 | } |
49 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_E7320_MCH, quirk_intel_irqbalance); | 48 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_E7320_MCH, quirk_intel_irqbalance); |
50 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_E7525_MCH, quirk_intel_irqbalance); | 49 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_E7525_MCH, quirk_intel_irqbalance); |
diff --git a/arch/i386/kernel/reboot.c b/arch/i386/kernel/reboot.c index 2afe0f8d555a..d207242976d3 100644 --- a/arch/i386/kernel/reboot.c +++ b/arch/i386/kernel/reboot.c | |||
@@ -12,6 +12,7 @@ | |||
12 | #include <linux/efi.h> | 12 | #include <linux/efi.h> |
13 | #include <linux/dmi.h> | 13 | #include <linux/dmi.h> |
14 | #include <linux/ctype.h> | 14 | #include <linux/ctype.h> |
15 | #include <linux/pm.h> | ||
15 | #include <asm/uaccess.h> | 16 | #include <asm/uaccess.h> |
16 | #include <asm/apic.h> | 17 | #include <asm/apic.h> |
17 | #include <asm/desc.h> | 18 | #include <asm/desc.h> |
@@ -111,12 +112,12 @@ static struct dmi_system_id __initdata reboot_dmi_table[] = { | |||
111 | DMI_MATCH(DMI_PRODUCT_NAME, "PowerEdge 2400"), | 112 | DMI_MATCH(DMI_PRODUCT_NAME, "PowerEdge 2400"), |
112 | }, | 113 | }, |
113 | }, | 114 | }, |
114 | { /* Handle problems with rebooting on HP nc6120 */ | 115 | { /* Handle problems with rebooting on HP laptops */ |
115 | .callback = set_bios_reboot, | 116 | .callback = set_bios_reboot, |
116 | .ident = "HP Compaq nc6120", | 117 | .ident = "HP Compaq Laptop", |
117 | .matches = { | 118 | .matches = { |
118 | DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), | 119 | DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), |
119 | DMI_MATCH(DMI_PRODUCT_NAME, "HP Compaq nc6120"), | 120 | DMI_MATCH(DMI_PRODUCT_NAME, "HP Compaq"), |
120 | }, | 121 | }, |
121 | }, | 122 | }, |
122 | { } | 123 | { } |
@@ -355,10 +356,10 @@ void machine_halt(void) | |||
355 | 356 | ||
356 | void machine_power_off(void) | 357 | void machine_power_off(void) |
357 | { | 358 | { |
358 | machine_shutdown(); | 359 | if (pm_power_off) { |
359 | 360 | machine_shutdown(); | |
360 | if (pm_power_off) | ||
361 | pm_power_off(); | 361 | pm_power_off(); |
362 | } | ||
362 | } | 363 | } |
363 | 364 | ||
364 | 365 | ||
diff --git a/arch/i386/kernel/scx200.c b/arch/i386/kernel/scx200.c index 9c968ae67c43..321f5fd26e75 100644 --- a/arch/i386/kernel/scx200.c +++ b/arch/i386/kernel/scx200.c | |||
@@ -143,7 +143,7 @@ static int __init scx200_init(void) | |||
143 | { | 143 | { |
144 | printk(KERN_INFO NAME ": NatSemi SCx200 Driver\n"); | 144 | printk(KERN_INFO NAME ": NatSemi SCx200 Driver\n"); |
145 | 145 | ||
146 | return pci_module_init(&scx200_pci_driver); | 146 | return pci_register_driver(&scx200_pci_driver); |
147 | } | 147 | } |
148 | 148 | ||
149 | static void __exit scx200_cleanup(void) | 149 | static void __exit scx200_cleanup(void) |
diff --git a/arch/i386/kernel/setup.c b/arch/i386/kernel/setup.c index fdfcb0cba9b4..51e513b4f72d 100644 --- a/arch/i386/kernel/setup.c +++ b/arch/i386/kernel/setup.c | |||
@@ -45,6 +45,7 @@ | |||
45 | #include <linux/nodemask.h> | 45 | #include <linux/nodemask.h> |
46 | #include <linux/kexec.h> | 46 | #include <linux/kexec.h> |
47 | #include <linux/crash_dump.h> | 47 | #include <linux/crash_dump.h> |
48 | #include <linux/dmi.h> | ||
48 | 49 | ||
49 | #include <video/edid.h> | 50 | #include <video/edid.h> |
50 | 51 | ||
@@ -146,7 +147,6 @@ EXPORT_SYMBOL(ist_info); | |||
146 | struct e820map e820; | 147 | struct e820map e820; |
147 | 148 | ||
148 | extern void early_cpu_init(void); | 149 | extern void early_cpu_init(void); |
149 | extern void dmi_scan_machine(void); | ||
150 | extern void generic_apic_probe(char *); | 150 | extern void generic_apic_probe(char *); |
151 | extern int root_mountflags; | 151 | extern int root_mountflags; |
152 | 152 | ||
@@ -898,7 +898,7 @@ static void __init parse_cmdline_early (char ** cmdline_p) | |||
898 | } | 898 | } |
899 | } | 899 | } |
900 | #endif | 900 | #endif |
901 | #ifdef CONFIG_CRASH_DUMP | 901 | #ifdef CONFIG_PROC_VMCORE |
902 | /* elfcorehdr= specifies the location of elf core header | 902 | /* elfcorehdr= specifies the location of elf core header |
903 | * stored by the crashed kernel. | 903 | * stored by the crashed kernel. |
904 | */ | 904 | */ |
@@ -954,6 +954,12 @@ efi_find_max_pfn(unsigned long start, unsigned long end, void *arg) | |||
954 | return 0; | 954 | return 0; |
955 | } | 955 | } |
956 | 956 | ||
957 | static int __init | ||
958 | efi_memory_present_wrapper(unsigned long start, unsigned long end, void *arg) | ||
959 | { | ||
960 | memory_present(0, start, end); | ||
961 | return 0; | ||
962 | } | ||
957 | 963 | ||
958 | /* | 964 | /* |
959 | * Find the highest page frame number we have available | 965 | * Find the highest page frame number we have available |
@@ -965,6 +971,7 @@ void __init find_max_pfn(void) | |||
965 | max_pfn = 0; | 971 | max_pfn = 0; |
966 | if (efi_enabled) { | 972 | if (efi_enabled) { |
967 | efi_memmap_walk(efi_find_max_pfn, &max_pfn); | 973 | efi_memmap_walk(efi_find_max_pfn, &max_pfn); |
974 | efi_memmap_walk(efi_memory_present_wrapper, NULL); | ||
968 | return; | 975 | return; |
969 | } | 976 | } |
970 | 977 | ||
@@ -979,6 +986,7 @@ void __init find_max_pfn(void) | |||
979 | continue; | 986 | continue; |
980 | if (end > max_pfn) | 987 | if (end > max_pfn) |
981 | max_pfn = end; | 988 | max_pfn = end; |
989 | memory_present(0, start, end); | ||
982 | } | 990 | } |
983 | } | 991 | } |
984 | 992 | ||
@@ -1576,7 +1584,7 @@ void __init setup_arch(char **cmdline_p) | |||
1576 | if (s) { | 1584 | if (s) { |
1577 | extern void setup_early_printk(char *); | 1585 | extern void setup_early_printk(char *); |
1578 | 1586 | ||
1579 | setup_early_printk(s); | 1587 | setup_early_printk(strchr(s, '=') + 1); |
1580 | printk("early console enabled\n"); | 1588 | printk("early console enabled\n"); |
1581 | } | 1589 | } |
1582 | } | 1590 | } |
diff --git a/arch/i386/kernel/signal.c b/arch/i386/kernel/signal.c index adcd069db91e..963616d364ec 100644 --- a/arch/i386/kernel/signal.c +++ b/arch/i386/kernel/signal.c | |||
@@ -37,51 +37,17 @@ | |||
37 | asmlinkage int | 37 | asmlinkage int |
38 | sys_sigsuspend(int history0, int history1, old_sigset_t mask) | 38 | sys_sigsuspend(int history0, int history1, old_sigset_t mask) |
39 | { | 39 | { |
40 | struct pt_regs * regs = (struct pt_regs *) &history0; | ||
41 | sigset_t saveset; | ||
42 | |||
43 | mask &= _BLOCKABLE; | 40 | mask &= _BLOCKABLE; |
44 | spin_lock_irq(¤t->sighand->siglock); | 41 | spin_lock_irq(¤t->sighand->siglock); |
45 | saveset = current->blocked; | 42 | current->saved_sigmask = current->blocked; |
46 | siginitset(¤t->blocked, mask); | 43 | siginitset(¤t->blocked, mask); |
47 | recalc_sigpending(); | 44 | recalc_sigpending(); |
48 | spin_unlock_irq(¤t->sighand->siglock); | 45 | spin_unlock_irq(¤t->sighand->siglock); |
49 | 46 | ||
50 | regs->eax = -EINTR; | 47 | current->state = TASK_INTERRUPTIBLE; |
51 | while (1) { | 48 | schedule(); |
52 | current->state = TASK_INTERRUPTIBLE; | 49 | set_thread_flag(TIF_RESTORE_SIGMASK); |
53 | schedule(); | 50 | return -ERESTARTNOHAND; |
54 | if (do_signal(regs, &saveset)) | ||
55 | return -EINTR; | ||
56 | } | ||
57 | } | ||
58 | |||
59 | asmlinkage int | ||
60 | sys_rt_sigsuspend(struct pt_regs regs) | ||
61 | { | ||
62 | sigset_t saveset, newset; | ||
63 | |||
64 | /* XXX: Don't preclude handling different sized sigset_t's. */ | ||
65 | if (regs.ecx != sizeof(sigset_t)) | ||
66 | return -EINVAL; | ||
67 | |||
68 | if (copy_from_user(&newset, (sigset_t __user *)regs.ebx, sizeof(newset))) | ||
69 | return -EFAULT; | ||
70 | sigdelsetmask(&newset, ~_BLOCKABLE); | ||
71 | |||
72 | spin_lock_irq(¤t->sighand->siglock); | ||
73 | saveset = current->blocked; | ||
74 | current->blocked = newset; | ||
75 | recalc_sigpending(); | ||
76 | spin_unlock_irq(¤t->sighand->siglock); | ||
77 | |||
78 | regs.eax = -EINTR; | ||
79 | while (1) { | ||
80 | current->state = TASK_INTERRUPTIBLE; | ||
81 | schedule(); | ||
82 | if (do_signal(®s, &saveset)) | ||
83 | return -EINTR; | ||
84 | } | ||
85 | } | 51 | } |
86 | 52 | ||
87 | asmlinkage int | 53 | asmlinkage int |
@@ -433,11 +399,11 @@ static int setup_frame(int sig, struct k_sigaction *ka, | |||
433 | current->comm, current->pid, frame, regs->eip, frame->pretcode); | 399 | current->comm, current->pid, frame, regs->eip, frame->pretcode); |
434 | #endif | 400 | #endif |
435 | 401 | ||
436 | return 1; | 402 | return 0; |
437 | 403 | ||
438 | give_sigsegv: | 404 | give_sigsegv: |
439 | force_sigsegv(sig, current); | 405 | force_sigsegv(sig, current); |
440 | return 0; | 406 | return -EFAULT; |
441 | } | 407 | } |
442 | 408 | ||
443 | static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, | 409 | static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, |
@@ -527,11 +493,11 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, | |||
527 | current->comm, current->pid, frame, regs->eip, frame->pretcode); | 493 | current->comm, current->pid, frame, regs->eip, frame->pretcode); |
528 | #endif | 494 | #endif |
529 | 495 | ||
530 | return 1; | 496 | return 0; |
531 | 497 | ||
532 | give_sigsegv: | 498 | give_sigsegv: |
533 | force_sigsegv(sig, current); | 499 | force_sigsegv(sig, current); |
534 | return 0; | 500 | return -EFAULT; |
535 | } | 501 | } |
536 | 502 | ||
537 | /* | 503 | /* |
@@ -581,7 +547,7 @@ handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka, | |||
581 | else | 547 | else |
582 | ret = setup_frame(sig, ka, oldset, regs); | 548 | ret = setup_frame(sig, ka, oldset, regs); |
583 | 549 | ||
584 | if (ret) { | 550 | if (ret == 0) { |
585 | spin_lock_irq(¤t->sighand->siglock); | 551 | spin_lock_irq(¤t->sighand->siglock); |
586 | sigorsets(¤t->blocked,¤t->blocked,&ka->sa.sa_mask); | 552 | sigorsets(¤t->blocked,¤t->blocked,&ka->sa.sa_mask); |
587 | if (!(ka->sa.sa_flags & SA_NODEFER)) | 553 | if (!(ka->sa.sa_flags & SA_NODEFER)) |
@@ -598,11 +564,12 @@ handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka, | |||
598 | * want to handle. Thus you cannot kill init even with a SIGKILL even by | 564 | * want to handle. Thus you cannot kill init even with a SIGKILL even by |
599 | * mistake. | 565 | * mistake. |
600 | */ | 566 | */ |
601 | int fastcall do_signal(struct pt_regs *regs, sigset_t *oldset) | 567 | static void fastcall do_signal(struct pt_regs *regs) |
602 | { | 568 | { |
603 | siginfo_t info; | 569 | siginfo_t info; |
604 | int signr; | 570 | int signr; |
605 | struct k_sigaction ka; | 571 | struct k_sigaction ka; |
572 | sigset_t *oldset; | ||
606 | 573 | ||
607 | /* | 574 | /* |
608 | * We want the common case to go fast, which | 575 | * We want the common case to go fast, which |
@@ -613,12 +580,14 @@ int fastcall do_signal(struct pt_regs *regs, sigset_t *oldset) | |||
613 | * CS suffices. | 580 | * CS suffices. |
614 | */ | 581 | */ |
615 | if (!user_mode(regs)) | 582 | if (!user_mode(regs)) |
616 | return 1; | 583 | return; |
617 | 584 | ||
618 | if (try_to_freeze()) | 585 | if (try_to_freeze()) |
619 | goto no_signal; | 586 | goto no_signal; |
620 | 587 | ||
621 | if (!oldset) | 588 | if (test_thread_flag(TIF_RESTORE_SIGMASK)) |
589 | oldset = ¤t->saved_sigmask; | ||
590 | else | ||
622 | oldset = ¤t->blocked; | 591 | oldset = ¤t->blocked; |
623 | 592 | ||
624 | signr = get_signal_to_deliver(&info, &ka, regs, NULL); | 593 | signr = get_signal_to_deliver(&info, &ka, regs, NULL); |
@@ -628,38 +597,55 @@ int fastcall do_signal(struct pt_regs *regs, sigset_t *oldset) | |||
628 | * have been cleared if the watchpoint triggered | 597 | * have been cleared if the watchpoint triggered |
629 | * inside the kernel. | 598 | * inside the kernel. |
630 | */ | 599 | */ |
631 | if (unlikely(current->thread.debugreg[7])) { | 600 | if (unlikely(current->thread.debugreg[7])) |
632 | set_debugreg(current->thread.debugreg[7], 7); | 601 | set_debugreg(current->thread.debugreg[7], 7); |
633 | } | ||
634 | 602 | ||
635 | /* Whee! Actually deliver the signal. */ | 603 | /* Whee! Actually deliver the signal. */ |
636 | return handle_signal(signr, &info, &ka, oldset, regs); | 604 | if (handle_signal(signr, &info, &ka, oldset, regs) == 0) { |
605 | /* a signal was successfully delivered; the saved | ||
606 | * sigmask will have been stored in the signal frame, | ||
607 | * and will be restored by sigreturn, so we can simply | ||
608 | * clear the TIF_RESTORE_SIGMASK flag */ | ||
609 | if (test_thread_flag(TIF_RESTORE_SIGMASK)) | ||
610 | clear_thread_flag(TIF_RESTORE_SIGMASK); | ||
611 | } | ||
612 | |||
613 | return; | ||
637 | } | 614 | } |
638 | 615 | ||
639 | no_signal: | 616 | no_signal: |
640 | /* Did we come from a system call? */ | 617 | /* Did we come from a system call? */ |
641 | if (regs->orig_eax >= 0) { | 618 | if (regs->orig_eax >= 0) { |
642 | /* Restart the system call - no handlers present */ | 619 | /* Restart the system call - no handlers present */ |
643 | if (regs->eax == -ERESTARTNOHAND || | 620 | switch (regs->eax) { |
644 | regs->eax == -ERESTARTSYS || | 621 | case -ERESTARTNOHAND: |
645 | regs->eax == -ERESTARTNOINTR) { | 622 | case -ERESTARTSYS: |
623 | case -ERESTARTNOINTR: | ||
646 | regs->eax = regs->orig_eax; | 624 | regs->eax = regs->orig_eax; |
647 | regs->eip -= 2; | 625 | regs->eip -= 2; |
648 | } | 626 | break; |
649 | if (regs->eax == -ERESTART_RESTARTBLOCK){ | 627 | |
628 | case -ERESTART_RESTARTBLOCK: | ||
650 | regs->eax = __NR_restart_syscall; | 629 | regs->eax = __NR_restart_syscall; |
651 | regs->eip -= 2; | 630 | regs->eip -= 2; |
631 | break; | ||
652 | } | 632 | } |
653 | } | 633 | } |
654 | return 0; | 634 | |
635 | /* if there's no signal to deliver, we just put the saved sigmask | ||
636 | * back */ | ||
637 | if (test_thread_flag(TIF_RESTORE_SIGMASK)) { | ||
638 | clear_thread_flag(TIF_RESTORE_SIGMASK); | ||
639 | sigprocmask(SIG_SETMASK, ¤t->saved_sigmask, NULL); | ||
640 | } | ||
655 | } | 641 | } |
656 | 642 | ||
657 | /* | 643 | /* |
658 | * notification of userspace execution resumption | 644 | * notification of userspace execution resumption |
659 | * - triggered by current->work.notify_resume | 645 | * - triggered by the TIF_WORK_MASK flags |
660 | */ | 646 | */ |
661 | __attribute__((regparm(3))) | 647 | __attribute__((regparm(3))) |
662 | void do_notify_resume(struct pt_regs *regs, sigset_t *oldset, | 648 | void do_notify_resume(struct pt_regs *regs, void *_unused, |
663 | __u32 thread_info_flags) | 649 | __u32 thread_info_flags) |
664 | { | 650 | { |
665 | /* Pending single-step? */ | 651 | /* Pending single-step? */ |
@@ -667,9 +653,10 @@ void do_notify_resume(struct pt_regs *regs, sigset_t *oldset, | |||
667 | regs->eflags |= TF_MASK; | 653 | regs->eflags |= TF_MASK; |
668 | clear_thread_flag(TIF_SINGLESTEP); | 654 | clear_thread_flag(TIF_SINGLESTEP); |
669 | } | 655 | } |
656 | |||
670 | /* deal with pending signal delivery */ | 657 | /* deal with pending signal delivery */ |
671 | if (thread_info_flags & _TIF_SIGPENDING) | 658 | if (thread_info_flags & (_TIF_SIGPENDING | _TIF_RESTORE_SIGMASK)) |
672 | do_signal(regs,oldset); | 659 | do_signal(regs); |
673 | 660 | ||
674 | clear_thread_flag(TIF_IRET); | 661 | clear_thread_flag(TIF_IRET); |
675 | } | 662 | } |
diff --git a/arch/i386/kernel/smpboot.c b/arch/i386/kernel/smpboot.c index d16520da4550..255adb498268 100644 --- a/arch/i386/kernel/smpboot.c +++ b/arch/i386/kernel/smpboot.c | |||
@@ -875,8 +875,7 @@ static inline struct task_struct * alloc_idle_task(int cpu) | |||
875 | /* initialize thread_struct. we really want to avoid destroy | 875 | /* initialize thread_struct. we really want to avoid destroy |
876 | * idle tread | 876 | * idle tread |
877 | */ | 877 | */ |
878 | idle->thread.esp = (unsigned long)(((struct pt_regs *) | 878 | idle->thread.esp = (unsigned long)task_pt_regs(idle); |
879 | (THREAD_SIZE + (unsigned long) idle->thread_info)) - 1); | ||
880 | init_idle(idle, cpu); | 879 | init_idle(idle, cpu); |
881 | return idle; | 880 | return idle; |
882 | } | 881 | } |
@@ -903,6 +902,12 @@ static int __devinit do_boot_cpu(int apicid, int cpu) | |||
903 | unsigned long start_eip; | 902 | unsigned long start_eip; |
904 | unsigned short nmi_high = 0, nmi_low = 0; | 903 | unsigned short nmi_high = 0, nmi_low = 0; |
905 | 904 | ||
905 | if (!cpu_gdt_descr[cpu].address && | ||
906 | !(cpu_gdt_descr[cpu].address = get_zeroed_page(GFP_KERNEL))) { | ||
907 | printk("Failed to allocate GDT for CPU %d\n", cpu); | ||
908 | return 1; | ||
909 | } | ||
910 | |||
906 | ++cpucount; | 911 | ++cpucount; |
907 | 912 | ||
908 | /* | 913 | /* |
@@ -1090,6 +1095,7 @@ static void smp_tune_scheduling (void) | |||
1090 | cachesize = 16; /* Pentiums, 2x8kB cache */ | 1095 | cachesize = 16; /* Pentiums, 2x8kB cache */ |
1091 | bandwidth = 100; | 1096 | bandwidth = 100; |
1092 | } | 1097 | } |
1098 | max_cache_size = cachesize * 1024; | ||
1093 | } | 1099 | } |
1094 | } | 1100 | } |
1095 | 1101 | ||
@@ -1338,8 +1344,7 @@ int __cpu_disable(void) | |||
1338 | if (cpu == 0) | 1344 | if (cpu == 0) |
1339 | return -EBUSY; | 1345 | return -EBUSY; |
1340 | 1346 | ||
1341 | /* We enable the timer again on the exit path of the death loop */ | 1347 | clear_local_APIC(); |
1342 | disable_APIC_timer(); | ||
1343 | /* Allow any queued timer interrupts to get serviced */ | 1348 | /* Allow any queued timer interrupts to get serviced */ |
1344 | local_irq_enable(); | 1349 | local_irq_enable(); |
1345 | mdelay(1); | 1350 | mdelay(1); |
diff --git a/arch/i386/kernel/syscall_table.S b/arch/i386/kernel/syscall_table.S index 9b21a31d4f4e..1b665928336b 100644 --- a/arch/i386/kernel/syscall_table.S +++ b/arch/i386/kernel/syscall_table.S | |||
@@ -1,4 +1,3 @@ | |||
1 | .data | ||
2 | ENTRY(sys_call_table) | 1 | ENTRY(sys_call_table) |
3 | .long sys_restart_syscall /* 0 - old "setup()" system call, used for restarting */ | 2 | .long sys_restart_syscall /* 0 - old "setup()" system call, used for restarting */ |
4 | .long sys_exit | 3 | .long sys_exit |
@@ -294,3 +293,19 @@ ENTRY(sys_call_table) | |||
294 | .long sys_inotify_init | 293 | .long sys_inotify_init |
295 | .long sys_inotify_add_watch | 294 | .long sys_inotify_add_watch |
296 | .long sys_inotify_rm_watch | 295 | .long sys_inotify_rm_watch |
296 | .long sys_migrate_pages | ||
297 | .long sys_openat /* 295 */ | ||
298 | .long sys_mkdirat | ||
299 | .long sys_mknodat | ||
300 | .long sys_fchownat | ||
301 | .long sys_futimesat | ||
302 | .long sys_newfstatat /* 300 */ | ||
303 | .long sys_unlinkat | ||
304 | .long sys_renameat | ||
305 | .long sys_linkat | ||
306 | .long sys_symlinkat | ||
307 | .long sys_readlinkat /* 305 */ | ||
308 | .long sys_fchmodat | ||
309 | .long sys_faccessat | ||
310 | .long sys_pselect6 | ||
311 | .long sys_ppoll | ||
diff --git a/arch/i386/kernel/time.c b/arch/i386/kernel/time.c index 41c5b2dc6200..a14d594bfbeb 100644 --- a/arch/i386/kernel/time.c +++ b/arch/i386/kernel/time.c | |||
@@ -302,6 +302,12 @@ irqreturn_t timer_interrupt(int irq, void *dev_id, struct pt_regs *regs) | |||
302 | do_timer_interrupt(irq, regs); | 302 | do_timer_interrupt(irq, regs); |
303 | 303 | ||
304 | write_sequnlock(&xtime_lock); | 304 | write_sequnlock(&xtime_lock); |
305 | |||
306 | #ifdef CONFIG_X86_LOCAL_APIC | ||
307 | if (using_apic_timer) | ||
308 | smp_send_timer_broadcast_ipi(regs); | ||
309 | #endif | ||
310 | |||
305 | return IRQ_HANDLED; | 311 | return IRQ_HANDLED; |
306 | } | 312 | } |
307 | 313 | ||
diff --git a/arch/i386/kernel/time_hpet.c b/arch/i386/kernel/time_hpet.c index 9caeaa315cd7..a529f0cdce17 100644 --- a/arch/i386/kernel/time_hpet.c +++ b/arch/i386/kernel/time_hpet.c | |||
@@ -259,8 +259,6 @@ __setup("hpet=", hpet_setup); | |||
259 | #include <linux/mc146818rtc.h> | 259 | #include <linux/mc146818rtc.h> |
260 | #include <linux/rtc.h> | 260 | #include <linux/rtc.h> |
261 | 261 | ||
262 | extern irqreturn_t rtc_interrupt(int irq, void *dev_id, struct pt_regs *regs); | ||
263 | |||
264 | #define DEFAULT_RTC_INT_FREQ 64 | 262 | #define DEFAULT_RTC_INT_FREQ 64 |
265 | #define RTC_NUM_INTS 1 | 263 | #define RTC_NUM_INTS 1 |
266 | 264 | ||
diff --git a/arch/i386/kernel/timers/timer_tsc.c b/arch/i386/kernel/timers/timer_tsc.c index d395e3b42485..47675bbbb316 100644 --- a/arch/i386/kernel/timers/timer_tsc.c +++ b/arch/i386/kernel/timers/timer_tsc.c | |||
@@ -330,7 +330,9 @@ int recalibrate_cpu_khz(void) | |||
330 | unsigned int cpu_khz_old = cpu_khz; | 330 | unsigned int cpu_khz_old = cpu_khz; |
331 | 331 | ||
332 | if (cpu_has_tsc) { | 332 | if (cpu_has_tsc) { |
333 | local_irq_disable(); | ||
333 | init_cpu_khz(); | 334 | init_cpu_khz(); |
335 | local_irq_enable(); | ||
334 | cpu_data[0].loops_per_jiffy = | 336 | cpu_data[0].loops_per_jiffy = |
335 | cpufreq_scale(cpu_data[0].loops_per_jiffy, | 337 | cpufreq_scale(cpu_data[0].loops_per_jiffy, |
336 | cpu_khz_old, | 338 | cpu_khz_old, |
diff --git a/arch/i386/kernel/traps.c b/arch/i386/kernel/traps.c index c34d1bfc5161..0aaebf3e1cfa 100644 --- a/arch/i386/kernel/traps.c +++ b/arch/i386/kernel/traps.c | |||
@@ -112,33 +112,38 @@ static inline int valid_stack_ptr(struct thread_info *tinfo, void *p) | |||
112 | p < (void *)tinfo + THREAD_SIZE - 3; | 112 | p < (void *)tinfo + THREAD_SIZE - 3; |
113 | } | 113 | } |
114 | 114 | ||
115 | static void print_addr_and_symbol(unsigned long addr, char *log_lvl) | ||
116 | { | ||
117 | printk(log_lvl); | ||
118 | printk(" [<%08lx>] ", addr); | ||
119 | print_symbol("%s", addr); | ||
120 | printk("\n"); | ||
121 | } | ||
122 | |||
115 | static inline unsigned long print_context_stack(struct thread_info *tinfo, | 123 | static inline unsigned long print_context_stack(struct thread_info *tinfo, |
116 | unsigned long *stack, unsigned long ebp) | 124 | unsigned long *stack, unsigned long ebp, |
125 | char *log_lvl) | ||
117 | { | 126 | { |
118 | unsigned long addr; | 127 | unsigned long addr; |
119 | 128 | ||
120 | #ifdef CONFIG_FRAME_POINTER | 129 | #ifdef CONFIG_FRAME_POINTER |
121 | while (valid_stack_ptr(tinfo, (void *)ebp)) { | 130 | while (valid_stack_ptr(tinfo, (void *)ebp)) { |
122 | addr = *(unsigned long *)(ebp + 4); | 131 | addr = *(unsigned long *)(ebp + 4); |
123 | printk(" [<%08lx>] ", addr); | 132 | print_addr_and_symbol(addr, log_lvl); |
124 | print_symbol("%s", addr); | ||
125 | printk("\n"); | ||
126 | ebp = *(unsigned long *)ebp; | 133 | ebp = *(unsigned long *)ebp; |
127 | } | 134 | } |
128 | #else | 135 | #else |
129 | while (valid_stack_ptr(tinfo, stack)) { | 136 | while (valid_stack_ptr(tinfo, stack)) { |
130 | addr = *stack++; | 137 | addr = *stack++; |
131 | if (__kernel_text_address(addr)) { | 138 | if (__kernel_text_address(addr)) |
132 | printk(" [<%08lx>]", addr); | 139 | print_addr_and_symbol(addr, log_lvl); |
133 | print_symbol(" %s", addr); | ||
134 | printk("\n"); | ||
135 | } | ||
136 | } | 140 | } |
137 | #endif | 141 | #endif |
138 | return ebp; | 142 | return ebp; |
139 | } | 143 | } |
140 | 144 | ||
141 | void show_trace(struct task_struct *task, unsigned long * stack) | 145 | static void show_trace_log_lvl(struct task_struct *task, |
146 | unsigned long *stack, char *log_lvl) | ||
142 | { | 147 | { |
143 | unsigned long ebp; | 148 | unsigned long ebp; |
144 | 149 | ||
@@ -157,15 +162,21 @@ void show_trace(struct task_struct *task, unsigned long * stack) | |||
157 | struct thread_info *context; | 162 | struct thread_info *context; |
158 | context = (struct thread_info *) | 163 | context = (struct thread_info *) |
159 | ((unsigned long)stack & (~(THREAD_SIZE - 1))); | 164 | ((unsigned long)stack & (~(THREAD_SIZE - 1))); |
160 | ebp = print_context_stack(context, stack, ebp); | 165 | ebp = print_context_stack(context, stack, ebp, log_lvl); |
161 | stack = (unsigned long*)context->previous_esp; | 166 | stack = (unsigned long*)context->previous_esp; |
162 | if (!stack) | 167 | if (!stack) |
163 | break; | 168 | break; |
164 | printk(" =======================\n"); | 169 | printk(KERN_EMERG " =======================\n"); |
165 | } | 170 | } |
166 | } | 171 | } |
167 | 172 | ||
168 | void show_stack(struct task_struct *task, unsigned long *esp) | 173 | void show_trace(struct task_struct *task, unsigned long * stack) |
174 | { | ||
175 | show_trace_log_lvl(task, stack, ""); | ||
176 | } | ||
177 | |||
178 | static void show_stack_log_lvl(struct task_struct *task, unsigned long *esp, | ||
179 | char *log_lvl) | ||
169 | { | 180 | { |
170 | unsigned long *stack; | 181 | unsigned long *stack; |
171 | int i; | 182 | int i; |
@@ -178,15 +189,26 @@ void show_stack(struct task_struct *task, unsigned long *esp) | |||
178 | } | 189 | } |
179 | 190 | ||
180 | stack = esp; | 191 | stack = esp; |
192 | printk(log_lvl); | ||
181 | for(i = 0; i < kstack_depth_to_print; i++) { | 193 | for(i = 0; i < kstack_depth_to_print; i++) { |
182 | if (kstack_end(stack)) | 194 | if (kstack_end(stack)) |
183 | break; | 195 | break; |
184 | if (i && ((i % 8) == 0)) | 196 | if (i && ((i % 8) == 0)) { |
185 | printk("\n "); | 197 | printk("\n"); |
198 | printk(log_lvl); | ||
199 | printk(" "); | ||
200 | } | ||
186 | printk("%08lx ", *stack++); | 201 | printk("%08lx ", *stack++); |
187 | } | 202 | } |
188 | printk("\nCall Trace:\n"); | 203 | printk("\n"); |
189 | show_trace(task, esp); | 204 | printk(log_lvl); |
205 | printk("Call Trace:\n"); | ||
206 | show_trace_log_lvl(task, esp, log_lvl); | ||
207 | } | ||
208 | |||
209 | void show_stack(struct task_struct *task, unsigned long *esp) | ||
210 | { | ||
211 | show_stack_log_lvl(task, esp, ""); | ||
190 | } | 212 | } |
191 | 213 | ||
192 | /* | 214 | /* |
@@ -216,18 +238,18 @@ void show_registers(struct pt_regs *regs) | |||
216 | ss = regs->xss & 0xffff; | 238 | ss = regs->xss & 0xffff; |
217 | } | 239 | } |
218 | print_modules(); | 240 | print_modules(); |
219 | printk("CPU: %d\nEIP: %04x:[<%08lx>] %s VLI\nEFLAGS: %08lx" | 241 | printk(KERN_EMERG "CPU: %d\nEIP: %04x:[<%08lx>] %s VLI\n" |
220 | " (%s) \n", | 242 | "EFLAGS: %08lx (%s) \n", |
221 | smp_processor_id(), 0xffff & regs->xcs, regs->eip, | 243 | smp_processor_id(), 0xffff & regs->xcs, regs->eip, |
222 | print_tainted(), regs->eflags, system_utsname.release); | 244 | print_tainted(), regs->eflags, system_utsname.release); |
223 | print_symbol("EIP is at %s\n", regs->eip); | 245 | print_symbol(KERN_EMERG "EIP is at %s\n", regs->eip); |
224 | printk("eax: %08lx ebx: %08lx ecx: %08lx edx: %08lx\n", | 246 | printk(KERN_EMERG "eax: %08lx ebx: %08lx ecx: %08lx edx: %08lx\n", |
225 | regs->eax, regs->ebx, regs->ecx, regs->edx); | 247 | regs->eax, regs->ebx, regs->ecx, regs->edx); |
226 | printk("esi: %08lx edi: %08lx ebp: %08lx esp: %08lx\n", | 248 | printk(KERN_EMERG "esi: %08lx edi: %08lx ebp: %08lx esp: %08lx\n", |
227 | regs->esi, regs->edi, regs->ebp, esp); | 249 | regs->esi, regs->edi, regs->ebp, esp); |
228 | printk("ds: %04x es: %04x ss: %04x\n", | 250 | printk(KERN_EMERG "ds: %04x es: %04x ss: %04x\n", |
229 | regs->xds & 0xffff, regs->xes & 0xffff, ss); | 251 | regs->xds & 0xffff, regs->xes & 0xffff, ss); |
230 | printk("Process %s (pid: %d, threadinfo=%p task=%p)", | 252 | printk(KERN_EMERG "Process %s (pid: %d, threadinfo=%p task=%p)", |
231 | current->comm, current->pid, current_thread_info(), current); | 253 | current->comm, current->pid, current_thread_info(), current); |
232 | /* | 254 | /* |
233 | * When in-kernel, we also print out the stack and code at the | 255 | * When in-kernel, we also print out the stack and code at the |
@@ -236,10 +258,10 @@ void show_registers(struct pt_regs *regs) | |||
236 | if (in_kernel) { | 258 | if (in_kernel) { |
237 | u8 __user *eip; | 259 | u8 __user *eip; |
238 | 260 | ||
239 | printk("\nStack: "); | 261 | printk("\n" KERN_EMERG "Stack: "); |
240 | show_stack(NULL, (unsigned long*)esp); | 262 | show_stack_log_lvl(NULL, (unsigned long *)esp, KERN_EMERG); |
241 | 263 | ||
242 | printk("Code: "); | 264 | printk(KERN_EMERG "Code: "); |
243 | 265 | ||
244 | eip = (u8 __user *)regs->eip - 43; | 266 | eip = (u8 __user *)regs->eip - 43; |
245 | for (i = 0; i < 64; i++, eip++) { | 267 | for (i = 0; i < 64; i++, eip++) { |
@@ -280,15 +302,15 @@ static void handle_BUG(struct pt_regs *regs) | |||
280 | (unsigned long)file < PAGE_OFFSET || __get_user(c, file)) | 302 | (unsigned long)file < PAGE_OFFSET || __get_user(c, file)) |
281 | file = "<bad filename>"; | 303 | file = "<bad filename>"; |
282 | 304 | ||
283 | printk("------------[ cut here ]------------\n"); | 305 | printk(KERN_EMERG "------------[ cut here ]------------\n"); |
284 | printk(KERN_ALERT "kernel BUG at %s:%d!\n", file, line); | 306 | printk(KERN_EMERG "kernel BUG at %s:%d!\n", file, line); |
285 | 307 | ||
286 | no_bug: | 308 | no_bug: |
287 | return; | 309 | return; |
288 | 310 | ||
289 | /* Here we know it was a BUG but file-n-line is unavailable */ | 311 | /* Here we know it was a BUG but file-n-line is unavailable */ |
290 | bug: | 312 | bug: |
291 | printk("Kernel BUG\n"); | 313 | printk(KERN_EMERG "Kernel BUG\n"); |
292 | } | 314 | } |
293 | 315 | ||
294 | /* This is gone through when something in the kernel | 316 | /* This is gone through when something in the kernel |
@@ -306,28 +328,35 @@ void die(const char * str, struct pt_regs * regs, long err) | |||
306 | .lock_owner_depth = 0 | 328 | .lock_owner_depth = 0 |
307 | }; | 329 | }; |
308 | static int die_counter; | 330 | static int die_counter; |
331 | unsigned long flags; | ||
309 | 332 | ||
310 | if (die.lock_owner != raw_smp_processor_id()) { | 333 | if (die.lock_owner != raw_smp_processor_id()) { |
311 | console_verbose(); | 334 | console_verbose(); |
312 | spin_lock_irq(&die.lock); | 335 | spin_lock_irqsave(&die.lock, flags); |
313 | die.lock_owner = smp_processor_id(); | 336 | die.lock_owner = smp_processor_id(); |
314 | die.lock_owner_depth = 0; | 337 | die.lock_owner_depth = 0; |
315 | bust_spinlocks(1); | 338 | bust_spinlocks(1); |
316 | } | 339 | } |
340 | else | ||
341 | local_save_flags(flags); | ||
317 | 342 | ||
318 | if (++die.lock_owner_depth < 3) { | 343 | if (++die.lock_owner_depth < 3) { |
319 | int nl = 0; | 344 | int nl = 0; |
320 | handle_BUG(regs); | 345 | handle_BUG(regs); |
321 | printk(KERN_ALERT "%s: %04lx [#%d]\n", str, err & 0xffff, ++die_counter); | 346 | printk(KERN_EMERG "%s: %04lx [#%d]\n", str, err & 0xffff, ++die_counter); |
322 | #ifdef CONFIG_PREEMPT | 347 | #ifdef CONFIG_PREEMPT |
323 | printk("PREEMPT "); | 348 | printk(KERN_EMERG "PREEMPT "); |
324 | nl = 1; | 349 | nl = 1; |
325 | #endif | 350 | #endif |
326 | #ifdef CONFIG_SMP | 351 | #ifdef CONFIG_SMP |
352 | if (!nl) | ||
353 | printk(KERN_EMERG); | ||
327 | printk("SMP "); | 354 | printk("SMP "); |
328 | nl = 1; | 355 | nl = 1; |
329 | #endif | 356 | #endif |
330 | #ifdef CONFIG_DEBUG_PAGEALLOC | 357 | #ifdef CONFIG_DEBUG_PAGEALLOC |
358 | if (!nl) | ||
359 | printk(KERN_EMERG); | ||
331 | printk("DEBUG_PAGEALLOC"); | 360 | printk("DEBUG_PAGEALLOC"); |
332 | nl = 1; | 361 | nl = 1; |
333 | #endif | 362 | #endif |
@@ -336,11 +365,11 @@ void die(const char * str, struct pt_regs * regs, long err) | |||
336 | notify_die(DIE_OOPS, (char *)str, regs, err, 255, SIGSEGV); | 365 | notify_die(DIE_OOPS, (char *)str, regs, err, 255, SIGSEGV); |
337 | show_registers(regs); | 366 | show_registers(regs); |
338 | } else | 367 | } else |
339 | printk(KERN_ERR "Recursive die() failure, output suppressed\n"); | 368 | printk(KERN_EMERG "Recursive die() failure, output suppressed\n"); |
340 | 369 | ||
341 | bust_spinlocks(0); | 370 | bust_spinlocks(0); |
342 | die.lock_owner = -1; | 371 | die.lock_owner = -1; |
343 | spin_unlock_irq(&die.lock); | 372 | spin_unlock_irqrestore(&die.lock, flags); |
344 | 373 | ||
345 | if (kexec_should_crash(current)) | 374 | if (kexec_should_crash(current)) |
346 | crash_kexec(regs); | 375 | crash_kexec(regs); |
@@ -452,7 +481,7 @@ DO_VM86_ERROR( 3, SIGTRAP, "int3", int3) | |||
452 | #endif | 481 | #endif |
453 | DO_VM86_ERROR( 4, SIGSEGV, "overflow", overflow) | 482 | DO_VM86_ERROR( 4, SIGSEGV, "overflow", overflow) |
454 | DO_VM86_ERROR( 5, SIGSEGV, "bounds", bounds) | 483 | DO_VM86_ERROR( 5, SIGSEGV, "bounds", bounds) |
455 | DO_ERROR_INFO( 6, SIGILL, "invalid operand", invalid_op, ILL_ILLOPN, regs->eip) | 484 | DO_ERROR_INFO( 6, SIGILL, "invalid opcode", invalid_op, ILL_ILLOPN, regs->eip) |
456 | DO_ERROR( 9, SIGFPE, "coprocessor segment overrun", coprocessor_segment_overrun) | 485 | DO_ERROR( 9, SIGFPE, "coprocessor segment overrun", coprocessor_segment_overrun) |
457 | DO_ERROR(10, SIGSEGV, "invalid TSS", invalid_TSS) | 486 | DO_ERROR(10, SIGSEGV, "invalid TSS", invalid_TSS) |
458 | DO_ERROR(11, SIGBUS, "segment not present", segment_not_present) | 487 | DO_ERROR(11, SIGBUS, "segment not present", segment_not_present) |
@@ -524,8 +553,10 @@ gp_in_kernel: | |||
524 | 553 | ||
525 | static void mem_parity_error(unsigned char reason, struct pt_regs * regs) | 554 | static void mem_parity_error(unsigned char reason, struct pt_regs * regs) |
526 | { | 555 | { |
527 | printk("Uhhuh. NMI received. Dazed and confused, but trying to continue\n"); | 556 | printk(KERN_EMERG "Uhhuh. NMI received. Dazed and confused, but trying " |
528 | printk("You probably have a hardware problem with your RAM chips\n"); | 557 | "to continue\n"); |
558 | printk(KERN_EMERG "You probably have a hardware problem with your RAM " | ||
559 | "chips\n"); | ||
529 | 560 | ||
530 | /* Clear and disable the memory parity error line. */ | 561 | /* Clear and disable the memory parity error line. */ |
531 | clear_mem_error(reason); | 562 | clear_mem_error(reason); |
@@ -535,7 +566,7 @@ static void io_check_error(unsigned char reason, struct pt_regs * regs) | |||
535 | { | 566 | { |
536 | unsigned long i; | 567 | unsigned long i; |
537 | 568 | ||
538 | printk("NMI: IOCK error (debug interrupt?)\n"); | 569 | printk(KERN_EMERG "NMI: IOCK error (debug interrupt?)\n"); |
539 | show_registers(regs); | 570 | show_registers(regs); |
540 | 571 | ||
541 | /* Re-enable the IOCK line, wait for a few seconds */ | 572 | /* Re-enable the IOCK line, wait for a few seconds */ |
@@ -577,11 +608,11 @@ void die_nmi (struct pt_regs *regs, const char *msg) | |||
577 | * to get a message out. | 608 | * to get a message out. |
578 | */ | 609 | */ |
579 | bust_spinlocks(1); | 610 | bust_spinlocks(1); |
580 | printk(msg); | 611 | printk(KERN_EMERG "%s", msg); |
581 | printk(" on CPU%d, eip %08lx, registers:\n", | 612 | printk(" on CPU%d, eip %08lx, registers:\n", |
582 | smp_processor_id(), regs->eip); | 613 | smp_processor_id(), regs->eip); |
583 | show_registers(regs); | 614 | show_registers(regs); |
584 | printk("console shuts up ...\n"); | 615 | printk(KERN_EMERG "console shuts up ...\n"); |
585 | console_silent(); | 616 | console_silent(); |
586 | spin_unlock(&nmi_print_lock); | 617 | spin_unlock(&nmi_print_lock); |
587 | bust_spinlocks(0); | 618 | bust_spinlocks(0); |
@@ -650,13 +681,6 @@ fastcall void do_nmi(struct pt_regs * regs, long error_code) | |||
650 | 681 | ||
651 | cpu = smp_processor_id(); | 682 | cpu = smp_processor_id(); |
652 | 683 | ||
653 | #ifdef CONFIG_HOTPLUG_CPU | ||
654 | if (!cpu_online(cpu)) { | ||
655 | nmi_exit(); | ||
656 | return; | ||
657 | } | ||
658 | #endif | ||
659 | |||
660 | ++nmi_count(cpu); | 684 | ++nmi_count(cpu); |
661 | 685 | ||
662 | if (!rcu_dereference(nmi_callback)(regs, cpu)) | 686 | if (!rcu_dereference(nmi_callback)(regs, cpu)) |
@@ -994,8 +1018,8 @@ asmlinkage void math_state_restore(struct pt_regs regs) | |||
994 | 1018 | ||
995 | asmlinkage void math_emulate(long arg) | 1019 | asmlinkage void math_emulate(long arg) |
996 | { | 1020 | { |
997 | printk("math-emulation not enabled and no coprocessor found.\n"); | 1021 | printk(KERN_EMERG "math-emulation not enabled and no coprocessor found.\n"); |
998 | printk("killing %s.\n",current->comm); | 1022 | printk(KERN_EMERG "killing %s.\n",current->comm); |
999 | force_sig(SIGFPE,current); | 1023 | force_sig(SIGFPE,current); |
1000 | schedule(); | 1024 | schedule(); |
1001 | } | 1025 | } |
@@ -1082,9 +1106,9 @@ void __init trap_init(void) | |||
1082 | set_trap_gate(0,÷_error); | 1106 | set_trap_gate(0,÷_error); |
1083 | set_intr_gate(1,&debug); | 1107 | set_intr_gate(1,&debug); |
1084 | set_intr_gate(2,&nmi); | 1108 | set_intr_gate(2,&nmi); |
1085 | set_system_intr_gate(3, &int3); /* int3-5 can be called from all */ | 1109 | set_system_intr_gate(3, &int3); /* int3/4 can be called from all */ |
1086 | set_system_gate(4,&overflow); | 1110 | set_system_gate(4,&overflow); |
1087 | set_system_gate(5,&bounds); | 1111 | set_trap_gate(5,&bounds); |
1088 | set_trap_gate(6,&invalid_op); | 1112 | set_trap_gate(6,&invalid_op); |
1089 | set_trap_gate(7,&device_not_available); | 1113 | set_trap_gate(7,&device_not_available); |
1090 | set_task_gate(8,GDT_ENTRY_DOUBLEFAULT_TSS); | 1114 | set_task_gate(8,GDT_ENTRY_DOUBLEFAULT_TSS); |
@@ -1102,6 +1126,28 @@ void __init trap_init(void) | |||
1102 | #endif | 1126 | #endif |
1103 | set_trap_gate(19,&simd_coprocessor_error); | 1127 | set_trap_gate(19,&simd_coprocessor_error); |
1104 | 1128 | ||
1129 | if (cpu_has_fxsr) { | ||
1130 | /* | ||
1131 | * Verify that the FXSAVE/FXRSTOR data will be 16-byte aligned. | ||
1132 | * Generates a compile-time "error: zero width for bit-field" if | ||
1133 | * the alignment is wrong. | ||
1134 | */ | ||
1135 | struct fxsrAlignAssert { | ||
1136 | int _:!(offsetof(struct task_struct, | ||
1137 | thread.i387.fxsave) & 15); | ||
1138 | }; | ||
1139 | |||
1140 | printk(KERN_INFO "Enabling fast FPU save and restore... "); | ||
1141 | set_in_cr4(X86_CR4_OSFXSR); | ||
1142 | printk("done.\n"); | ||
1143 | } | ||
1144 | if (cpu_has_xmm) { | ||
1145 | printk(KERN_INFO "Enabling unmasked SIMD FPU exception " | ||
1146 | "support... "); | ||
1147 | set_in_cr4(X86_CR4_OSXMMEXCPT); | ||
1148 | printk("done.\n"); | ||
1149 | } | ||
1150 | |||
1105 | set_system_gate(SYSCALL_VECTOR,&system_call); | 1151 | set_system_gate(SYSCALL_VECTOR,&system_call); |
1106 | 1152 | ||
1107 | /* | 1153 | /* |
diff --git a/arch/i386/kernel/vm86.c b/arch/i386/kernel/vm86.c index fc1993564f98..f51c894a7da5 100644 --- a/arch/i386/kernel/vm86.c +++ b/arch/i386/kernel/vm86.c | |||
@@ -4,7 +4,7 @@ | |||
4 | * Copyright (C) 1994 Linus Torvalds | 4 | * Copyright (C) 1994 Linus Torvalds |
5 | * | 5 | * |
6 | * 29 dec 2001 - Fixed oopses caused by unchecked access to the vm86 | 6 | * 29 dec 2001 - Fixed oopses caused by unchecked access to the vm86 |
7 | * stack - Manfred Spraul <manfreds@colorfullife.com> | 7 | * stack - Manfred Spraul <manfred@colorfullife.com> |
8 | * | 8 | * |
9 | * 22 mar 2002 - Manfred detected the stackfaults, but didn't handle | 9 | * 22 mar 2002 - Manfred detected the stackfaults, but didn't handle |
10 | * them correctly. Now the emulation will be in a | 10 | * them correctly. Now the emulation will be in a |
@@ -30,6 +30,7 @@ | |||
30 | * | 30 | * |
31 | */ | 31 | */ |
32 | 32 | ||
33 | #include <linux/capability.h> | ||
33 | #include <linux/config.h> | 34 | #include <linux/config.h> |
34 | #include <linux/errno.h> | 35 | #include <linux/errno.h> |
35 | #include <linux/interrupt.h> | 36 | #include <linux/interrupt.h> |
@@ -310,7 +311,7 @@ static void do_sys_vm86(struct kernel_vm86_struct *info, struct task_struct *tsk | |||
310 | "movl %1,%%ebp\n\t" | 311 | "movl %1,%%ebp\n\t" |
311 | "jmp resume_userspace" | 312 | "jmp resume_userspace" |
312 | : /* no outputs */ | 313 | : /* no outputs */ |
313 | :"r" (&info->regs), "r" (tsk->thread_info) : "ax"); | 314 | :"r" (&info->regs), "r" (task_thread_info(tsk)) : "ax"); |
314 | /* we never return here */ | 315 | /* we never return here */ |
315 | } | 316 | } |
316 | 317 | ||
diff --git a/arch/i386/mm/init.c b/arch/i386/mm/init.c index 06e26f006238..2700f01994ba 100644 --- a/arch/i386/mm/init.c +++ b/arch/i386/mm/init.c | |||
@@ -268,7 +268,7 @@ static void __init permanent_kmaps_init(pgd_t *pgd_base) | |||
268 | pkmap_page_table = pte; | 268 | pkmap_page_table = pte; |
269 | } | 269 | } |
270 | 270 | ||
271 | static void __devinit free_new_highpage(struct page *page) | 271 | static void __meminit free_new_highpage(struct page *page) |
272 | { | 272 | { |
273 | set_page_count(page, 1); | 273 | set_page_count(page, 1); |
274 | __free_page(page); | 274 | __free_page(page); |
@@ -735,6 +735,30 @@ void free_initmem(void) | |||
735 | printk (KERN_INFO "Freeing unused kernel memory: %dk freed\n", (__init_end - __init_begin) >> 10); | 735 | printk (KERN_INFO "Freeing unused kernel memory: %dk freed\n", (__init_end - __init_begin) >> 10); |
736 | } | 736 | } |
737 | 737 | ||
738 | #ifdef CONFIG_DEBUG_RODATA | ||
739 | |||
740 | extern char __start_rodata, __end_rodata; | ||
741 | void mark_rodata_ro(void) | ||
742 | { | ||
743 | unsigned long addr = (unsigned long)&__start_rodata; | ||
744 | |||
745 | for (; addr < (unsigned long)&__end_rodata; addr += PAGE_SIZE) | ||
746 | change_page_attr(virt_to_page(addr), 1, PAGE_KERNEL_RO); | ||
747 | |||
748 | printk ("Write protecting the kernel read-only data: %luk\n", | ||
749 | (unsigned long)(&__end_rodata - &__start_rodata) >> 10); | ||
750 | |||
751 | /* | ||
752 | * change_page_attr() requires a global_flush_tlb() call after it. | ||
753 | * We do this after the printk so that if something went wrong in the | ||
754 | * change, the printk gets out at least to give a better debug hint | ||
755 | * of who is the culprit. | ||
756 | */ | ||
757 | global_flush_tlb(); | ||
758 | } | ||
759 | #endif | ||
760 | |||
761 | |||
738 | #ifdef CONFIG_BLK_DEV_INITRD | 762 | #ifdef CONFIG_BLK_DEV_INITRD |
739 | void free_initrd_mem(unsigned long start, unsigned long end) | 763 | void free_initrd_mem(unsigned long start, unsigned long end) |
740 | { | 764 | { |
diff --git a/arch/i386/mm/ioremap.c b/arch/i386/mm/ioremap.c index 5d09de8d1c6b..247fde76aaed 100644 --- a/arch/i386/mm/ioremap.c +++ b/arch/i386/mm/ioremap.c | |||
@@ -223,9 +223,15 @@ void __iomem *ioremap_nocache (unsigned long phys_addr, unsigned long size) | |||
223 | } | 223 | } |
224 | EXPORT_SYMBOL(ioremap_nocache); | 224 | EXPORT_SYMBOL(ioremap_nocache); |
225 | 225 | ||
226 | /** | ||
227 | * iounmap - Free a IO remapping | ||
228 | * @addr: virtual address from ioremap_* | ||
229 | * | ||
230 | * Caller must ensure there is only one unmapping for the same pointer. | ||
231 | */ | ||
226 | void iounmap(volatile void __iomem *addr) | 232 | void iounmap(volatile void __iomem *addr) |
227 | { | 233 | { |
228 | struct vm_struct *p; | 234 | struct vm_struct *p, *o; |
229 | 235 | ||
230 | if ((void __force *)addr <= high_memory) | 236 | if ((void __force *)addr <= high_memory) |
231 | return; | 237 | return; |
@@ -239,22 +245,37 @@ void iounmap(volatile void __iomem *addr) | |||
239 | addr < phys_to_virt(ISA_END_ADDRESS)) | 245 | addr < phys_to_virt(ISA_END_ADDRESS)) |
240 | return; | 246 | return; |
241 | 247 | ||
242 | write_lock(&vmlist_lock); | 248 | addr = (volatile void __iomem *)(PAGE_MASK & (unsigned long __force)addr); |
243 | p = __remove_vm_area((void *)(PAGE_MASK & (unsigned long __force)addr)); | 249 | |
244 | if (!p) { | 250 | /* Use the vm area unlocked, assuming the caller |
245 | printk(KERN_WARNING "iounmap: bad address %p\n", addr); | 251 | ensures there isn't another iounmap for the same address |
252 | in parallel. Reuse of the virtual address is prevented by | ||
253 | leaving it in the global lists until we're done with it. | ||
254 | cpa takes care of the direct mappings. */ | ||
255 | read_lock(&vmlist_lock); | ||
256 | for (p = vmlist; p; p = p->next) { | ||
257 | if (p->addr == addr) | ||
258 | break; | ||
259 | } | ||
260 | read_unlock(&vmlist_lock); | ||
261 | |||
262 | if (!p) { | ||
263 | printk("iounmap: bad address %p\n", addr); | ||
246 | dump_stack(); | 264 | dump_stack(); |
247 | goto out_unlock; | 265 | return; |
248 | } | 266 | } |
249 | 267 | ||
268 | /* Reset the direct mapping. Can block */ | ||
250 | if ((p->flags >> 20) && p->phys_addr < virt_to_phys(high_memory) - 1) { | 269 | if ((p->flags >> 20) && p->phys_addr < virt_to_phys(high_memory) - 1) { |
251 | change_page_attr(virt_to_page(__va(p->phys_addr)), | 270 | change_page_attr(virt_to_page(__va(p->phys_addr)), |
252 | p->size >> PAGE_SHIFT, | 271 | p->size >> PAGE_SHIFT, |
253 | PAGE_KERNEL); | 272 | PAGE_KERNEL); |
254 | global_flush_tlb(); | 273 | global_flush_tlb(); |
255 | } | 274 | } |
256 | out_unlock: | 275 | |
257 | write_unlock(&vmlist_lock); | 276 | /* Finally remove it */ |
277 | o = remove_vm_area((void *)addr); | ||
278 | BUG_ON(p != o || o == NULL); | ||
258 | kfree(p); | 279 | kfree(p); |
259 | } | 280 | } |
260 | EXPORT_SYMBOL(iounmap); | 281 | EXPORT_SYMBOL(iounmap); |
diff --git a/arch/i386/mm/pageattr.c b/arch/i386/mm/pageattr.c index f600fc244f02..d0cadb33b54c 100644 --- a/arch/i386/mm/pageattr.c +++ b/arch/i386/mm/pageattr.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <asm/processor.h> | 13 | #include <asm/processor.h> |
14 | #include <asm/tlbflush.h> | 14 | #include <asm/tlbflush.h> |
15 | #include <asm/pgalloc.h> | 15 | #include <asm/pgalloc.h> |
16 | #include <asm/sections.h> | ||
16 | 17 | ||
17 | static DEFINE_SPINLOCK(cpa_lock); | 18 | static DEFINE_SPINLOCK(cpa_lock); |
18 | static struct list_head df_list = LIST_HEAD_INIT(df_list); | 19 | static struct list_head df_list = LIST_HEAD_INIT(df_list); |
@@ -36,7 +37,8 @@ pte_t *lookup_address(unsigned long address) | |||
36 | return pte_offset_kernel(pmd, address); | 37 | return pte_offset_kernel(pmd, address); |
37 | } | 38 | } |
38 | 39 | ||
39 | static struct page *split_large_page(unsigned long address, pgprot_t prot) | 40 | static struct page *split_large_page(unsigned long address, pgprot_t prot, |
41 | pgprot_t ref_prot) | ||
40 | { | 42 | { |
41 | int i; | 43 | int i; |
42 | unsigned long addr; | 44 | unsigned long addr; |
@@ -54,7 +56,7 @@ static struct page *split_large_page(unsigned long address, pgprot_t prot) | |||
54 | pbase = (pte_t *)page_address(base); | 56 | pbase = (pte_t *)page_address(base); |
55 | for (i = 0; i < PTRS_PER_PTE; i++, addr += PAGE_SIZE) { | 57 | for (i = 0; i < PTRS_PER_PTE; i++, addr += PAGE_SIZE) { |
56 | set_pte(&pbase[i], pfn_pte(addr >> PAGE_SHIFT, | 58 | set_pte(&pbase[i], pfn_pte(addr >> PAGE_SHIFT, |
57 | addr == address ? prot : PAGE_KERNEL)); | 59 | addr == address ? prot : ref_prot)); |
58 | } | 60 | } |
59 | return base; | 61 | return base; |
60 | } | 62 | } |
@@ -98,11 +100,18 @@ static void set_pmd_pte(pte_t *kpte, unsigned long address, pte_t pte) | |||
98 | */ | 100 | */ |
99 | static inline void revert_page(struct page *kpte_page, unsigned long address) | 101 | static inline void revert_page(struct page *kpte_page, unsigned long address) |
100 | { | 102 | { |
101 | pte_t *linear = (pte_t *) | 103 | pgprot_t ref_prot; |
104 | pte_t *linear; | ||
105 | |||
106 | ref_prot = | ||
107 | ((address & LARGE_PAGE_MASK) < (unsigned long)&_etext) | ||
108 | ? PAGE_KERNEL_LARGE_EXEC : PAGE_KERNEL_LARGE; | ||
109 | |||
110 | linear = (pte_t *) | ||
102 | pmd_offset(pud_offset(pgd_offset_k(address), address), address); | 111 | pmd_offset(pud_offset(pgd_offset_k(address), address), address); |
103 | set_pmd_pte(linear, address, | 112 | set_pmd_pte(linear, address, |
104 | pfn_pte((__pa(address) & LARGE_PAGE_MASK) >> PAGE_SHIFT, | 113 | pfn_pte((__pa(address) & LARGE_PAGE_MASK) >> PAGE_SHIFT, |
105 | PAGE_KERNEL_LARGE)); | 114 | ref_prot)); |
106 | } | 115 | } |
107 | 116 | ||
108 | static int | 117 | static int |
@@ -123,10 +132,16 @@ __change_page_attr(struct page *page, pgprot_t prot) | |||
123 | if ((pte_val(*kpte) & _PAGE_PSE) == 0) { | 132 | if ((pte_val(*kpte) & _PAGE_PSE) == 0) { |
124 | set_pte_atomic(kpte, mk_pte(page, prot)); | 133 | set_pte_atomic(kpte, mk_pte(page, prot)); |
125 | } else { | 134 | } else { |
126 | struct page *split = split_large_page(address, prot); | 135 | pgprot_t ref_prot; |
136 | struct page *split; | ||
137 | |||
138 | ref_prot = | ||
139 | ((address & LARGE_PAGE_MASK) < (unsigned long)&_etext) | ||
140 | ? PAGE_KERNEL_EXEC : PAGE_KERNEL; | ||
141 | split = split_large_page(address, prot, ref_prot); | ||
127 | if (!split) | 142 | if (!split) |
128 | return -ENOMEM; | 143 | return -ENOMEM; |
129 | set_pmd_pte(kpte,address,mk_pte(split, PAGE_KERNEL)); | 144 | set_pmd_pte(kpte,address,mk_pte(split, ref_prot)); |
130 | kpte_page = split; | 145 | kpte_page = split; |
131 | } | 146 | } |
132 | get_page(kpte_page); | 147 | get_page(kpte_page); |
@@ -207,6 +222,10 @@ void kernel_map_pages(struct page *page, int numpages, int enable) | |||
207 | { | 222 | { |
208 | if (PageHighMem(page)) | 223 | if (PageHighMem(page)) |
209 | return; | 224 | return; |
225 | if (!enable) | ||
226 | mutex_debug_check_no_locks_freed(page_address(page), | ||
227 | numpages * PAGE_SIZE); | ||
228 | |||
210 | /* the return value is ignored - the calls cannot fail, | 229 | /* the return value is ignored - the calls cannot fail, |
211 | * large pages are disabled at boot time. | 230 | * large pages are disabled at boot time. |
212 | */ | 231 | */ |
diff --git a/arch/i386/pci/Makefile b/arch/i386/pci/Makefile index ead6122dd06d..5461d4d5ea1e 100644 --- a/arch/i386/pci/Makefile +++ b/arch/i386/pci/Makefile | |||
@@ -1,7 +1,7 @@ | |||
1 | obj-y := i386.o | 1 | obj-y := i386.o |
2 | 2 | ||
3 | obj-$(CONFIG_PCI_BIOS) += pcbios.o | 3 | obj-$(CONFIG_PCI_BIOS) += pcbios.o |
4 | obj-$(CONFIG_PCI_MMCONFIG) += mmconfig.o | 4 | obj-$(CONFIG_PCI_MMCONFIG) += mmconfig.o direct.o |
5 | obj-$(CONFIG_PCI_DIRECT) += direct.o | 5 | obj-$(CONFIG_PCI_DIRECT) += direct.o |
6 | 6 | ||
7 | pci-y := fixup.o | 7 | pci-y := fixup.o |
diff --git a/arch/i386/pci/acpi.c b/arch/i386/pci/acpi.c index 4c4522b43be5..b33aea845f58 100644 --- a/arch/i386/pci/acpi.c +++ b/arch/i386/pci/acpi.c | |||
@@ -53,7 +53,7 @@ static int __init pci_acpi_init(void) | |||
53 | * don't use pci_enable_device(). | 53 | * don't use pci_enable_device(). |
54 | */ | 54 | */ |
55 | printk(KERN_INFO "PCI: Routing PCI interrupts for all devices because \"pci=routeirq\" specified\n"); | 55 | printk(KERN_INFO "PCI: Routing PCI interrupts for all devices because \"pci=routeirq\" specified\n"); |
56 | while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) | 56 | for_each_pci_dev(dev) |
57 | acpi_pci_irq_enable(dev); | 57 | acpi_pci_irq_enable(dev); |
58 | } else | 58 | } else |
59 | printk(KERN_INFO "PCI: If a device doesn't work, try \"pci=routeirq\". If it helps, post a report\n"); | 59 | printk(KERN_INFO "PCI: If a device doesn't work, try \"pci=routeirq\". If it helps, post a report\n"); |
diff --git a/arch/i386/pci/direct.c b/arch/i386/pci/direct.c index 94331d6be7a3..e3ac502bf2fb 100644 --- a/arch/i386/pci/direct.c +++ b/arch/i386/pci/direct.c | |||
@@ -13,7 +13,7 @@ | |||
13 | #define PCI_CONF1_ADDRESS(bus, devfn, reg) \ | 13 | #define PCI_CONF1_ADDRESS(bus, devfn, reg) \ |
14 | (0x80000000 | (bus << 16) | (devfn << 8) | (reg & ~3)) | 14 | (0x80000000 | (bus << 16) | (devfn << 8) | (reg & ~3)) |
15 | 15 | ||
16 | static int pci_conf1_read(unsigned int seg, unsigned int bus, | 16 | int pci_conf1_read(unsigned int seg, unsigned int bus, |
17 | unsigned int devfn, int reg, int len, u32 *value) | 17 | unsigned int devfn, int reg, int len, u32 *value) |
18 | { | 18 | { |
19 | unsigned long flags; | 19 | unsigned long flags; |
@@ -42,7 +42,7 @@ static int pci_conf1_read(unsigned int seg, unsigned int bus, | |||
42 | return 0; | 42 | return 0; |
43 | } | 43 | } |
44 | 44 | ||
45 | static int pci_conf1_write(unsigned int seg, unsigned int bus, | 45 | int pci_conf1_write(unsigned int seg, unsigned int bus, |
46 | unsigned int devfn, int reg, int len, u32 value) | 46 | unsigned int devfn, int reg, int len, u32 value) |
47 | { | 47 | { |
48 | unsigned long flags; | 48 | unsigned long flags; |
diff --git a/arch/i386/pci/fixup.c b/arch/i386/pci/fixup.c index eeb1b1f2d548..83c3645ccc43 100644 --- a/arch/i386/pci/fixup.c +++ b/arch/i386/pci/fixup.c | |||
@@ -413,6 +413,13 @@ static struct dmi_system_id __devinitdata toshiba_ohci1394_dmi_table[] = { | |||
413 | DMI_MATCH(DMI_PRODUCT_VERSION, "PSM4"), | 413 | DMI_MATCH(DMI_PRODUCT_VERSION, "PSM4"), |
414 | }, | 414 | }, |
415 | }, | 415 | }, |
416 | { | ||
417 | .ident = "Toshiba A40 based laptop", | ||
418 | .matches = { | ||
419 | DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), | ||
420 | DMI_MATCH(DMI_PRODUCT_VERSION, "PSA40U"), | ||
421 | }, | ||
422 | }, | ||
416 | { } | 423 | { } |
417 | }; | 424 | }; |
418 | 425 | ||
@@ -442,3 +449,19 @@ static void __devinit pci_post_fixup_toshiba_ohci1394(struct pci_dev *dev) | |||
442 | } | 449 | } |
443 | DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_TI, 0x8032, | 450 | DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_TI, 0x8032, |
444 | pci_post_fixup_toshiba_ohci1394); | 451 | pci_post_fixup_toshiba_ohci1394); |
452 | |||
453 | |||
454 | /* | ||
455 | * Prevent the BIOS trapping accesses to the Cyrix CS5530A video device | ||
456 | * configuration space. | ||
457 | */ | ||
458 | static void __devinit pci_early_fixup_cyrix_5530(struct pci_dev *dev) | ||
459 | { | ||
460 | u8 r; | ||
461 | /* clear 'F4 Video Configuration Trap' bit */ | ||
462 | pci_read_config_byte(dev, 0x42, &r); | ||
463 | r &= 0xfd; | ||
464 | pci_write_config_byte(dev, 0x42, r); | ||
465 | } | ||
466 | DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_CYRIX, PCI_DEVICE_ID_CYRIX_5530_LEGACY, | ||
467 | pci_early_fixup_cyrix_5530); | ||
diff --git a/arch/i386/pci/irq.c b/arch/i386/pci/irq.c index 19e6f4871d1e..e715aa930036 100644 --- a/arch/i386/pci/irq.c +++ b/arch/i386/pci/irq.c | |||
@@ -78,7 +78,7 @@ static inline struct irq_routing_table * pirq_check_routing_table(u8 *addr) | |||
78 | for (i=0; i < rt->size; i++) | 78 | for (i=0; i < rt->size; i++) |
79 | sum += addr[i]; | 79 | sum += addr[i]; |
80 | if (!sum) { | 80 | if (!sum) { |
81 | DBG("PCI: Interrupt Routing Table found at 0x%p\n", rt); | 81 | DBG(KERN_DEBUG "PCI: Interrupt Routing Table found at 0x%p\n", rt); |
82 | return rt; | 82 | return rt; |
83 | } | 83 | } |
84 | return NULL; | 84 | return NULL; |
@@ -128,7 +128,7 @@ static void __init pirq_peer_trick(void) | |||
128 | #ifdef DEBUG | 128 | #ifdef DEBUG |
129 | { | 129 | { |
130 | int j; | 130 | int j; |
131 | DBG("%02x:%02x slot=%02x", e->bus, e->devfn/8, e->slot); | 131 | DBG(KERN_DEBUG "%02x:%02x slot=%02x", e->bus, e->devfn/8, e->slot); |
132 | for(j=0; j<4; j++) | 132 | for(j=0; j<4; j++) |
133 | DBG(" %d:%02x/%04x", j, e->irq[j].link, e->irq[j].bitmap); | 133 | DBG(" %d:%02x/%04x", j, e->irq[j].link, e->irq[j].bitmap); |
134 | DBG("\n"); | 134 | DBG("\n"); |
@@ -160,10 +160,10 @@ void eisa_set_level_irq(unsigned int irq) | |||
160 | return; | 160 | return; |
161 | 161 | ||
162 | eisa_irq_mask |= (1 << irq); | 162 | eisa_irq_mask |= (1 << irq); |
163 | printk("PCI: setting IRQ %u as level-triggered\n", irq); | 163 | printk(KERN_DEBUG "PCI: setting IRQ %u as level-triggered\n", irq); |
164 | val = inb(port); | 164 | val = inb(port); |
165 | if (!(val & mask)) { | 165 | if (!(val & mask)) { |
166 | DBG(" -> edge"); | 166 | DBG(KERN_DEBUG " -> edge"); |
167 | outb(val | mask, port); | 167 | outb(val | mask, port); |
168 | } | 168 | } |
169 | } | 169 | } |
@@ -677,11 +677,11 @@ static __init int ali_router_probe(struct irq_router *r, struct pci_dev *router, | |||
677 | { | 677 | { |
678 | case PCI_DEVICE_ID_AL_M1533: | 678 | case PCI_DEVICE_ID_AL_M1533: |
679 | case PCI_DEVICE_ID_AL_M1563: | 679 | case PCI_DEVICE_ID_AL_M1563: |
680 | printk("PCI: Using ALI IRQ Router\n"); | 680 | printk(KERN_DEBUG "PCI: Using ALI IRQ Router\n"); |
681 | r->name = "ALI"; | 681 | r->name = "ALI"; |
682 | r->get = pirq_ali_get; | 682 | r->get = pirq_ali_get; |
683 | r->set = pirq_ali_set; | 683 | r->set = pirq_ali_set; |
684 | return 1; | 684 | return 1; |
685 | } | 685 | } |
686 | return 0; | 686 | return 0; |
687 | } | 687 | } |
@@ -749,12 +749,13 @@ static void __init pirq_find_router(struct irq_router *r) | |||
749 | r->get = NULL; | 749 | r->get = NULL; |
750 | r->set = NULL; | 750 | r->set = NULL; |
751 | 751 | ||
752 | DBG("PCI: Attempting to find IRQ router for %04x:%04x\n", | 752 | DBG(KERN_DEBUG "PCI: Attempting to find IRQ router for %04x:%04x\n", |
753 | rt->rtr_vendor, rt->rtr_device); | 753 | rt->rtr_vendor, rt->rtr_device); |
754 | 754 | ||
755 | pirq_router_dev = pci_find_slot(rt->rtr_bus, rt->rtr_devfn); | 755 | pirq_router_dev = pci_find_slot(rt->rtr_bus, rt->rtr_devfn); |
756 | if (!pirq_router_dev) { | 756 | if (!pirq_router_dev) { |
757 | DBG("PCI: Interrupt router not found at %02x:%02x\n", rt->rtr_bus, rt->rtr_devfn); | 757 | DBG(KERN_DEBUG "PCI: Interrupt router not found at " |
758 | "%02x:%02x\n", rt->rtr_bus, rt->rtr_devfn); | ||
758 | return; | 759 | return; |
759 | } | 760 | } |
760 | 761 | ||
@@ -799,7 +800,7 @@ static int pcibios_lookup_irq(struct pci_dev *dev, int assign) | |||
799 | /* Find IRQ pin */ | 800 | /* Find IRQ pin */ |
800 | pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &pin); | 801 | pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &pin); |
801 | if (!pin) { | 802 | if (!pin) { |
802 | DBG(" -> no interrupt pin\n"); | 803 | DBG(KERN_DEBUG " -> no interrupt pin\n"); |
803 | return 0; | 804 | return 0; |
804 | } | 805 | } |
805 | pin = pin - 1; | 806 | pin = pin - 1; |
@@ -809,16 +810,16 @@ static int pcibios_lookup_irq(struct pci_dev *dev, int assign) | |||
809 | if (!pirq_table) | 810 | if (!pirq_table) |
810 | return 0; | 811 | return 0; |
811 | 812 | ||
812 | DBG("IRQ for %s[%c]", pci_name(dev), 'A' + pin); | 813 | DBG(KERN_DEBUG "IRQ for %s[%c]", pci_name(dev), 'A' + pin); |
813 | info = pirq_get_info(dev); | 814 | info = pirq_get_info(dev); |
814 | if (!info) { | 815 | if (!info) { |
815 | DBG(" -> not found in routing table\n"); | 816 | DBG(" -> not found in routing table\n" KERN_DEBUG); |
816 | return 0; | 817 | return 0; |
817 | } | 818 | } |
818 | pirq = info->irq[pin].link; | 819 | pirq = info->irq[pin].link; |
819 | mask = info->irq[pin].bitmap; | 820 | mask = info->irq[pin].bitmap; |
820 | if (!pirq) { | 821 | if (!pirq) { |
821 | DBG(" -> not routed\n"); | 822 | DBG(" -> not routed\n" KERN_DEBUG); |
822 | return 0; | 823 | return 0; |
823 | } | 824 | } |
824 | DBG(" -> PIRQ %02x, mask %04x, excl %04x", pirq, mask, pirq_table->exclusive_irqs); | 825 | DBG(" -> PIRQ %02x, mask %04x, excl %04x", pirq, mask, pirq_table->exclusive_irqs); |
@@ -846,9 +847,12 @@ static int pcibios_lookup_irq(struct pci_dev *dev, int assign) | |||
846 | * reported by the device if possible. | 847 | * reported by the device if possible. |
847 | */ | 848 | */ |
848 | newirq = dev->irq; | 849 | newirq = dev->irq; |
849 | if (!((1 << newirq) & mask)) { | 850 | if (newirq && !((1 << newirq) & mask)) { |
850 | if ( pci_probe & PCI_USE_PIRQ_MASK) newirq = 0; | 851 | if ( pci_probe & PCI_USE_PIRQ_MASK) newirq = 0; |
851 | else printk(KERN_WARNING "PCI: IRQ %i for device %s doesn't match PIRQ mask - try pci=usepirqmask\n", newirq, pci_name(dev)); | 852 | else printk("\n" KERN_WARNING |
853 | "PCI: IRQ %i for device %s doesn't match PIRQ mask " | ||
854 | "- try pci=usepirqmask\n" KERN_DEBUG, newirq, | ||
855 | pci_name(dev)); | ||
852 | } | 856 | } |
853 | if (!newirq && assign) { | 857 | if (!newirq && assign) { |
854 | for (i = 0; i < 16; i++) { | 858 | for (i = 0; i < 16; i++) { |
@@ -923,14 +927,14 @@ static void __init pcibios_fixup_irqs(void) | |||
923 | struct pci_dev *dev = NULL; | 927 | struct pci_dev *dev = NULL; |
924 | u8 pin; | 928 | u8 pin; |
925 | 929 | ||
926 | DBG("PCI: IRQ fixup\n"); | 930 | DBG(KERN_DEBUG "PCI: IRQ fixup\n"); |
927 | while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) { | 931 | while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) { |
928 | /* | 932 | /* |
929 | * If the BIOS has set an out of range IRQ number, just ignore it. | 933 | * If the BIOS has set an out of range IRQ number, just ignore it. |
930 | * Also keep track of which IRQ's are already in use. | 934 | * Also keep track of which IRQ's are already in use. |
931 | */ | 935 | */ |
932 | if (dev->irq >= 16) { | 936 | if (dev->irq >= 16) { |
933 | DBG("%s: ignoring bogus IRQ %d\n", pci_name(dev), dev->irq); | 937 | DBG(KERN_DEBUG "%s: ignoring bogus IRQ %d\n", pci_name(dev), dev->irq); |
934 | dev->irq = 0; | 938 | dev->irq = 0; |
935 | } | 939 | } |
936 | /* If the IRQ is already assigned to a PCI device, ignore its ISA use penalty */ | 940 | /* If the IRQ is already assigned to a PCI device, ignore its ISA use penalty */ |
@@ -1039,7 +1043,7 @@ static struct dmi_system_id __initdata pciirq_dmi_table[] = { | |||
1039 | 1043 | ||
1040 | static int __init pcibios_irq_init(void) | 1044 | static int __init pcibios_irq_init(void) |
1041 | { | 1045 | { |
1042 | DBG("PCI: IRQ init\n"); | 1046 | DBG(KERN_DEBUG "PCI: IRQ init\n"); |
1043 | 1047 | ||
1044 | if (pcibios_enable_irq || raw_pci_ops == NULL) | 1048 | if (pcibios_enable_irq || raw_pci_ops == NULL) |
1045 | return 0; | 1049 | return 0; |
diff --git a/arch/i386/pci/mmconfig.c b/arch/i386/pci/mmconfig.c index dfbf80cff834..4bb4d4b0f73a 100644 --- a/arch/i386/pci/mmconfig.c +++ b/arch/i386/pci/mmconfig.c | |||
@@ -19,21 +19,25 @@ | |||
19 | /* The base address of the last MMCONFIG device accessed */ | 19 | /* The base address of the last MMCONFIG device accessed */ |
20 | static u32 mmcfg_last_accessed_device; | 20 | static u32 mmcfg_last_accessed_device; |
21 | 21 | ||
22 | static DECLARE_BITMAP(fallback_slots, 32); | ||
23 | |||
22 | /* | 24 | /* |
23 | * Functions for accessing PCI configuration space with MMCONFIG accesses | 25 | * Functions for accessing PCI configuration space with MMCONFIG accesses |
24 | */ | 26 | */ |
25 | static u32 get_base_addr(unsigned int seg, int bus) | 27 | static u32 get_base_addr(unsigned int seg, int bus, unsigned devfn) |
26 | { | 28 | { |
27 | int cfg_num = -1; | 29 | int cfg_num = -1; |
28 | struct acpi_table_mcfg_config *cfg; | 30 | struct acpi_table_mcfg_config *cfg; |
29 | 31 | ||
32 | if (seg == 0 && bus == 0 && | ||
33 | test_bit(PCI_SLOT(devfn), fallback_slots)) | ||
34 | return 0; | ||
35 | |||
30 | while (1) { | 36 | while (1) { |
31 | ++cfg_num; | 37 | ++cfg_num; |
32 | if (cfg_num >= pci_mmcfg_config_num) { | 38 | if (cfg_num >= pci_mmcfg_config_num) { |
33 | /* something bad is going on, no cfg table is found. */ | 39 | /* Not found - fallback to type 1 */ |
34 | /* so we fall back to the old way we used to do this */ | 40 | return 0; |
35 | /* and just rely on the first entry to be correct. */ | ||
36 | return pci_mmcfg_config[0].base_address; | ||
37 | } | 41 | } |
38 | cfg = &pci_mmcfg_config[cfg_num]; | 42 | cfg = &pci_mmcfg_config[cfg_num]; |
39 | if (cfg->pci_segment_group_number != seg) | 43 | if (cfg->pci_segment_group_number != seg) |
@@ -44,9 +48,9 @@ static u32 get_base_addr(unsigned int seg, int bus) | |||
44 | } | 48 | } |
45 | } | 49 | } |
46 | 50 | ||
47 | static inline void pci_exp_set_dev_base(unsigned int seg, int bus, int devfn) | 51 | static inline void pci_exp_set_dev_base(unsigned int base, int bus, int devfn) |
48 | { | 52 | { |
49 | u32 dev_base = get_base_addr(seg, bus) | (bus << 20) | (devfn << 12); | 53 | u32 dev_base = base | (bus << 20) | (devfn << 12); |
50 | if (dev_base != mmcfg_last_accessed_device) { | 54 | if (dev_base != mmcfg_last_accessed_device) { |
51 | mmcfg_last_accessed_device = dev_base; | 55 | mmcfg_last_accessed_device = dev_base; |
52 | set_fixmap_nocache(FIX_PCIE_MCFG, dev_base); | 56 | set_fixmap_nocache(FIX_PCIE_MCFG, dev_base); |
@@ -57,13 +61,18 @@ static int pci_mmcfg_read(unsigned int seg, unsigned int bus, | |||
57 | unsigned int devfn, int reg, int len, u32 *value) | 61 | unsigned int devfn, int reg, int len, u32 *value) |
58 | { | 62 | { |
59 | unsigned long flags; | 63 | unsigned long flags; |
64 | u32 base; | ||
60 | 65 | ||
61 | if (!value || (bus > 255) || (devfn > 255) || (reg > 4095)) | 66 | if (!value || (bus > 255) || (devfn > 255) || (reg > 4095)) |
62 | return -EINVAL; | 67 | return -EINVAL; |
63 | 68 | ||
69 | base = get_base_addr(seg, bus, devfn); | ||
70 | if (!base) | ||
71 | return pci_conf1_read(seg,bus,devfn,reg,len,value); | ||
72 | |||
64 | spin_lock_irqsave(&pci_config_lock, flags); | 73 | spin_lock_irqsave(&pci_config_lock, flags); |
65 | 74 | ||
66 | pci_exp_set_dev_base(seg, bus, devfn); | 75 | pci_exp_set_dev_base(base, bus, devfn); |
67 | 76 | ||
68 | switch (len) { | 77 | switch (len) { |
69 | case 1: | 78 | case 1: |
@@ -86,13 +95,18 @@ static int pci_mmcfg_write(unsigned int seg, unsigned int bus, | |||
86 | unsigned int devfn, int reg, int len, u32 value) | 95 | unsigned int devfn, int reg, int len, u32 value) |
87 | { | 96 | { |
88 | unsigned long flags; | 97 | unsigned long flags; |
98 | u32 base; | ||
89 | 99 | ||
90 | if ((bus > 255) || (devfn > 255) || (reg > 4095)) | 100 | if ((bus > 255) || (devfn > 255) || (reg > 4095)) |
91 | return -EINVAL; | 101 | return -EINVAL; |
92 | 102 | ||
103 | base = get_base_addr(seg, bus, devfn); | ||
104 | if (!base) | ||
105 | return pci_conf1_write(seg,bus,devfn,reg,len,value); | ||
106 | |||
93 | spin_lock_irqsave(&pci_config_lock, flags); | 107 | spin_lock_irqsave(&pci_config_lock, flags); |
94 | 108 | ||
95 | pci_exp_set_dev_base(seg, bus, devfn); | 109 | pci_exp_set_dev_base(base, bus, devfn); |
96 | 110 | ||
97 | switch (len) { | 111 | switch (len) { |
98 | case 1: | 112 | case 1: |
@@ -116,6 +130,37 @@ static struct pci_raw_ops pci_mmcfg = { | |||
116 | .write = pci_mmcfg_write, | 130 | .write = pci_mmcfg_write, |
117 | }; | 131 | }; |
118 | 132 | ||
133 | /* K8 systems have some devices (typically in the builtin northbridge) | ||
134 | that are only accessible using type1 | ||
135 | Normally this can be expressed in the MCFG by not listing them | ||
136 | and assigning suitable _SEGs, but this isn't implemented in some BIOS. | ||
137 | Instead try to discover all devices on bus 0 that are unreachable using MM | ||
138 | and fallback for them. | ||
139 | We only do this for bus 0/seg 0 */ | ||
140 | static __init void unreachable_devices(void) | ||
141 | { | ||
142 | int i; | ||
143 | unsigned long flags; | ||
144 | |||
145 | for (i = 0; i < 32; i++) { | ||
146 | u32 val1; | ||
147 | u32 addr; | ||
148 | |||
149 | pci_conf1_read(0, 0, PCI_DEVFN(i, 0), 0, 4, &val1); | ||
150 | if (val1 == 0xffffffff) | ||
151 | continue; | ||
152 | |||
153 | /* Locking probably not needed, but safer */ | ||
154 | spin_lock_irqsave(&pci_config_lock, flags); | ||
155 | addr = get_base_addr(0, 0, PCI_DEVFN(i, 0)); | ||
156 | if (addr != 0) | ||
157 | pci_exp_set_dev_base(addr, 0, PCI_DEVFN(i, 0)); | ||
158 | if (addr == 0 || readl((u32 __iomem *)mmcfg_virt_addr) != val1) | ||
159 | set_bit(i, fallback_slots); | ||
160 | spin_unlock_irqrestore(&pci_config_lock, flags); | ||
161 | } | ||
162 | } | ||
163 | |||
119 | static int __init pci_mmcfg_init(void) | 164 | static int __init pci_mmcfg_init(void) |
120 | { | 165 | { |
121 | if ((pci_probe & PCI_PROBE_MMCONF) == 0) | 166 | if ((pci_probe & PCI_PROBE_MMCONF) == 0) |
@@ -131,6 +176,8 @@ static int __init pci_mmcfg_init(void) | |||
131 | raw_pci_ops = &pci_mmcfg; | 176 | raw_pci_ops = &pci_mmcfg; |
132 | pci_probe = (pci_probe & ~PCI_PROBE_MASK) | PCI_PROBE_MMCONF; | 177 | pci_probe = (pci_probe & ~PCI_PROBE_MASK) | PCI_PROBE_MMCONF; |
133 | 178 | ||
179 | unreachable_devices(); | ||
180 | |||
134 | out: | 181 | out: |
135 | return 0; | 182 | return 0; |
136 | } | 183 | } |
diff --git a/arch/i386/pci/pci.h b/arch/i386/pci/pci.h index 127d53ad16be..f550781ec310 100644 --- a/arch/i386/pci/pci.h +++ b/arch/i386/pci/pci.h | |||
@@ -74,3 +74,10 @@ extern spinlock_t pci_config_lock; | |||
74 | 74 | ||
75 | extern int (*pcibios_enable_irq)(struct pci_dev *dev); | 75 | extern int (*pcibios_enable_irq)(struct pci_dev *dev); |
76 | extern void (*pcibios_disable_irq)(struct pci_dev *dev); | 76 | extern void (*pcibios_disable_irq)(struct pci_dev *dev); |
77 | |||
78 | extern int pci_conf1_write(unsigned int seg, unsigned int bus, | ||
79 | unsigned int devfn, int reg, int len, u32 value); | ||
80 | extern int pci_conf1_read(unsigned int seg, unsigned int bus, | ||
81 | unsigned int devfn, int reg, int len, u32 *value); | ||
82 | |||
83 | |||