Commit a052f447 authored by Linus Torvalds's avatar Linus Torvalds

Merge git://git.kernel.org/pub/scm/linux/kernel/git/sam/x86

* git://git.kernel.org/pub/scm/linux/kernel/git/sam/x86:
  x86: enable "make ARCH=x86"
  x86: do not use $(ARCH) when not needed
  kconfig: use $K64BIT to set 64BIT with all*config targets
  kconfig: add helper to set config symbol from environment variable
  kconfig: factor out code in confdata.c
  x86: move the rest of the menu's to Kconfig
  x86: move all simple arch settings to Kconfig
  x86: copy x86_64 specific Kconfig symbols to Kconfig.i386
  x86: add X86_64 dependency to x86_64 specific symbols in Kconfig.x86_64
  x86: add X86_32 dependency to i386 specific symbols in Kconfig.i386
  x86: arch/x86/Kconfig.cpu unification
  x86: start unification of arch/x86/Kconfig.*
  x86: unification of cfufreq/Kconfig
parents 6f37ac79 daa93fab
...@@ -197,8 +197,15 @@ CROSS_COMPILE ?= ...@@ -197,8 +197,15 @@ CROSS_COMPILE ?=
UTS_MACHINE := $(ARCH) UTS_MACHINE := $(ARCH)
SRCARCH := $(ARCH) SRCARCH := $(ARCH)
# for i386 and x86_64 we use SRCARCH equal to x86 # Additional ARCH settings for x86
SRCARCH := $(if $(filter x86_64 i386,$(SRCARCH)),x86,$(SRCARCH)) ifeq ($(ARCH),i386)
SRCARCH := x86
K64BIT := n
endif
ifeq ($(ARCH),x86_64)
SRCARCH := x86
K64BIT := y
endif
KCONFIG_CONFIG ?= .config KCONFIG_CONFIG ?= .config
...@@ -334,7 +341,7 @@ KERNELRELEASE = $(shell cat include/config/kernel.release 2> /dev/null) ...@@ -334,7 +341,7 @@ KERNELRELEASE = $(shell cat include/config/kernel.release 2> /dev/null)
KERNELVERSION = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION) KERNELVERSION = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
export VERSION PATCHLEVEL SUBLEVEL KERNELRELEASE KERNELVERSION export VERSION PATCHLEVEL SUBLEVEL KERNELRELEASE KERNELVERSION
export ARCH SRCARCH CONFIG_SHELL HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC export ARCH SRCARCH K64BIT CONFIG_SHELL HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC
export CPP AR NM STRIP OBJCOPY OBJDUMP MAKE AWK GENKSYMS PERL UTS_MACHINE export CPP AR NM STRIP OBJCOPY OBJDUMP MAKE AWK GENKSYMS PERL UTS_MACHINE
export HOSTCXX HOSTCXXFLAGS LDFLAGS_MODULE CHECK CHECKFLAGS export HOSTCXX HOSTCXXFLAGS LDFLAGS_MODULE CHECK CHECKFLAGS
......
...@@ -194,6 +194,8 @@ CONFIGURING the kernel: ...@@ -194,6 +194,8 @@ CONFIGURING the kernel:
"make *config" checks for a file named "all{yes/mod/no/random}.config" "make *config" checks for a file named "all{yes/mod/no/random}.config"
for symbol values that are to be forced. If this file is not found, for symbol values that are to be forced. If this file is not found,
it checks for a file named "all.config" to contain forced values. it checks for a file named "all.config" to contain forced values.
Finally it checks the environment variable K64BIT and if found, sets
the config symbol "64BIT" to the value of the K64BIT variable.
NOTES on "make config": NOTES on "make config":
- having unnecessary drivers will make the kernel bigger, and can - having unnecessary drivers will make the kernel bigger, and can
......
This diff is collapsed.
...@@ -3,11 +3,12 @@ if !X86_ELAN ...@@ -3,11 +3,12 @@ if !X86_ELAN
choice choice
prompt "Processor family" prompt "Processor family"
default M686 default M686 if X86_32
default GENERIC_CPU if X86_64
config M386 config M386
bool "386" bool "386"
depends on !UML depends on X86_32 && !UML
---help--- ---help---
This is the processor type of your CPU. This information is used for This is the processor type of your CPU. This information is used for
optimizing purposes. In order to compile a kernel that can run on optimizing purposes. In order to compile a kernel that can run on
...@@ -49,6 +50,7 @@ config M386 ...@@ -49,6 +50,7 @@ config M386
config M486 config M486
bool "486" bool "486"
depends on X86_32
help help
Select this for a 486 series processor, either Intel or one of the Select this for a 486 series processor, either Intel or one of the
compatible processors from AMD, Cyrix, IBM, or Intel. Includes DX, compatible processors from AMD, Cyrix, IBM, or Intel. Includes DX,
...@@ -57,6 +59,7 @@ config M486 ...@@ -57,6 +59,7 @@ config M486
config M586 config M586
bool "586/K5/5x86/6x86/6x86MX" bool "586/K5/5x86/6x86/6x86MX"
depends on X86_32
help help
Select this for an 586 or 686 series processor such as the AMD K5, Select this for an 586 or 686 series processor such as the AMD K5,
the Cyrix 5x86, 6x86 and 6x86MX. This choice does not the Cyrix 5x86, 6x86 and 6x86MX. This choice does not
...@@ -64,18 +67,21 @@ config M586 ...@@ -64,18 +67,21 @@ config M586
config M586TSC config M586TSC
bool "Pentium-Classic" bool "Pentium-Classic"
depends on X86_32
help help
Select this for a Pentium Classic processor with the RDTSC (Read Select this for a Pentium Classic processor with the RDTSC (Read
Time Stamp Counter) instruction for benchmarking. Time Stamp Counter) instruction for benchmarking.
config M586MMX config M586MMX
bool "Pentium-MMX" bool "Pentium-MMX"
depends on X86_32
help help
Select this for a Pentium with the MMX graphics/multimedia Select this for a Pentium with the MMX graphics/multimedia
extended instructions. extended instructions.
config M686 config M686
bool "Pentium-Pro" bool "Pentium-Pro"
depends on X86_32
help help
Select this for Intel Pentium Pro chips. This enables the use of Select this for Intel Pentium Pro chips. This enables the use of
Pentium Pro extended instructions, and disables the init-time guard Pentium Pro extended instructions, and disables the init-time guard
...@@ -83,6 +89,7 @@ config M686 ...@@ -83,6 +89,7 @@ config M686
config MPENTIUMII config MPENTIUMII
bool "Pentium-II/Celeron(pre-Coppermine)" bool "Pentium-II/Celeron(pre-Coppermine)"
depends on X86_32
help help
Select this for Intel chips based on the Pentium-II and Select this for Intel chips based on the Pentium-II and
pre-Coppermine Celeron core. This option enables an unaligned pre-Coppermine Celeron core. This option enables an unaligned
...@@ -92,6 +99,7 @@ config MPENTIUMII ...@@ -92,6 +99,7 @@ config MPENTIUMII
config MPENTIUMIII config MPENTIUMIII
bool "Pentium-III/Celeron(Coppermine)/Pentium-III Xeon" bool "Pentium-III/Celeron(Coppermine)/Pentium-III Xeon"
depends on X86_32
help help
Select this for Intel chips based on the Pentium-III and Select this for Intel chips based on the Pentium-III and
Celeron-Coppermine core. This option enables use of some Celeron-Coppermine core. This option enables use of some
...@@ -100,19 +108,14 @@ config MPENTIUMIII ...@@ -100,19 +108,14 @@ config MPENTIUMIII
config MPENTIUMM config MPENTIUMM
bool "Pentium M" bool "Pentium M"
depends on X86_32
help help
Select this for Intel Pentium M (not Pentium-4 M) Select this for Intel Pentium M (not Pentium-4 M)
notebook chips. notebook chips.
config MCORE2
bool "Core 2/newer Xeon"
help
Select this for Intel Core 2 and newer Core 2 Xeons (Xeon 51xx and 53xx)
CPUs. You can distinguish newer from older Xeons by the CPU family
in /proc/cpuinfo. Newer ones have 6 and older ones 15 (not a typo)
config MPENTIUM4 config MPENTIUM4
bool "Pentium-4/Celeron(P4-based)/Pentium-4 M/older Xeon" bool "Pentium-4/Celeron(P4-based)/Pentium-4 M/older Xeon"
depends on X86_32
help help
Select this for Intel Pentium 4 chips. This includes the Select this for Intel Pentium 4 chips. This includes the
Pentium 4, Pentium D, P4-based Celeron and Xeon, and Pentium 4, Pentium D, P4-based Celeron and Xeon, and
...@@ -148,6 +151,7 @@ config MPENTIUM4 ...@@ -148,6 +151,7 @@ config MPENTIUM4
config MK6 config MK6
bool "K6/K6-II/K6-III" bool "K6/K6-II/K6-III"
depends on X86_32
help help
Select this for an AMD K6-family processor. Enables use of Select this for an AMD K6-family processor. Enables use of
some extended instructions, and passes appropriate optimization some extended instructions, and passes appropriate optimization
...@@ -155,6 +159,7 @@ config MK6 ...@@ -155,6 +159,7 @@ config MK6
config MK7 config MK7
bool "Athlon/Duron/K7" bool "Athlon/Duron/K7"
depends on X86_32
help help
Select this for an AMD Athlon K7-family processor. Enables use of Select this for an AMD Athlon K7-family processor. Enables use of
some extended instructions, and passes appropriate optimization some extended instructions, and passes appropriate optimization
...@@ -169,6 +174,7 @@ config MK8 ...@@ -169,6 +174,7 @@ config MK8
config MCRUSOE config MCRUSOE
bool "Crusoe" bool "Crusoe"
depends on X86_32
help help
Select this for a Transmeta Crusoe processor. Treats the processor Select this for a Transmeta Crusoe processor. Treats the processor
like a 586 with TSC, and sets some GCC optimization flags (like a like a 586 with TSC, and sets some GCC optimization flags (like a
...@@ -176,11 +182,13 @@ config MCRUSOE ...@@ -176,11 +182,13 @@ config MCRUSOE
config MEFFICEON config MEFFICEON
bool "Efficeon" bool "Efficeon"
depends on X86_32
help help
Select this for a Transmeta Efficeon processor. Select this for a Transmeta Efficeon processor.
config MWINCHIPC6 config MWINCHIPC6
bool "Winchip-C6" bool "Winchip-C6"
depends on X86_32
help help
Select this for an IDT Winchip C6 chip. Linux and GCC Select this for an IDT Winchip C6 chip. Linux and GCC
treat this chip as a 586TSC with some extended instructions treat this chip as a 586TSC with some extended instructions
...@@ -188,6 +196,7 @@ config MWINCHIPC6 ...@@ -188,6 +196,7 @@ config MWINCHIPC6
config MWINCHIP2 config MWINCHIP2
bool "Winchip-2" bool "Winchip-2"
depends on X86_32
help help
Select this for an IDT Winchip-2. Linux and GCC Select this for an IDT Winchip-2. Linux and GCC
treat this chip as a 586TSC with some extended instructions treat this chip as a 586TSC with some extended instructions
...@@ -195,6 +204,7 @@ config MWINCHIP2 ...@@ -195,6 +204,7 @@ config MWINCHIP2
config MWINCHIP3D config MWINCHIP3D
bool "Winchip-2A/Winchip-3" bool "Winchip-2A/Winchip-3"
depends on X86_32
help help
Select this for an IDT Winchip-2A or 3. Linux and GCC Select this for an IDT Winchip-2A or 3. Linux and GCC
treat this chip as a 586TSC with some extended instructions treat this chip as a 586TSC with some extended instructions
...@@ -204,16 +214,19 @@ config MWINCHIP3D ...@@ -204,16 +214,19 @@ config MWINCHIP3D
config MGEODEGX1 config MGEODEGX1
bool "GeodeGX1" bool "GeodeGX1"
depends on X86_32
help help
Select this for a Geode GX1 (Cyrix MediaGX) chip. Select this for a Geode GX1 (Cyrix MediaGX) chip.
config MGEODE_LX config MGEODE_LX
bool "Geode GX/LX" bool "Geode GX/LX"
depends on X86_32
help help
Select this for AMD Geode GX and LX processors. Select this for AMD Geode GX and LX processors.
config MCYRIXIII config MCYRIXIII
bool "CyrixIII/VIA-C3" bool "CyrixIII/VIA-C3"
depends on X86_32
help help
Select this for a Cyrix III or C3 chip. Presently Linux and GCC Select this for a Cyrix III or C3 chip. Presently Linux and GCC
treat this chip as a generic 586. Whilst the CPU is 686 class, treat this chip as a generic 586. Whilst the CPU is 686 class,
...@@ -225,6 +238,7 @@ config MCYRIXIII ...@@ -225,6 +238,7 @@ config MCYRIXIII
config MVIAC3_2 config MVIAC3_2
bool "VIA C3-2 (Nehemiah)" bool "VIA C3-2 (Nehemiah)"
depends on X86_32
help help
Select this for a VIA C3 "Nehemiah". Selecting this enables usage Select this for a VIA C3 "Nehemiah". Selecting this enables usage
of SSE and tells gcc to treat the CPU as a 686. of SSE and tells gcc to treat the CPU as a 686.
...@@ -232,15 +246,42 @@ config MVIAC3_2 ...@@ -232,15 +246,42 @@ config MVIAC3_2
config MVIAC7 config MVIAC7
bool "VIA C7" bool "VIA C7"
depends on X86_32
help help
Select this for a VIA C7. Selecting this uses the correct cache Select this for a VIA C7. Selecting this uses the correct cache
shift and tells gcc to treat the CPU as a 686. shift and tells gcc to treat the CPU as a 686.
config MPSC
bool "Intel P4 / older Netburst based Xeon"
depends on X86_64
help
Optimize for Intel Pentium 4, Pentium D and older Nocona/Dempsey
Xeon CPUs with Intel 64bit which is compatible with x86-64.
Note that the latest Xeons (Xeon 51xx and 53xx) are not based on the
Netburst core and shouldn't use this option. You can distinguish them
using the cpu family field
in /proc/cpuinfo. Family 15 is an older Xeon, Family 6 a newer one.
config MCORE2
bool "Core 2/newer Xeon"
help
Select this for Intel Core 2 and newer Core 2 Xeons (Xeon 51xx and 53xx)
CPUs. You can distinguish newer from older Xeons by the CPU family
in /proc/cpuinfo. Newer ones have 6 and older ones 15 (not a typo)
config GENERIC_CPU
bool "Generic-x86-64"
depends on X86_64
help
Generic x86-64 CPU.
Run equally well on all x86-64 CPUs.
endchoice endchoice
config X86_GENERIC config X86_GENERIC
bool "Generic x86 support" bool "Generic x86 support"
help depends on X86_32
help
Instead of just including optimizations for the selected Instead of just including optimizations for the selected
x86 variant (e.g. PII, Crusoe or Athlon), include some more x86 variant (e.g. PII, Crusoe or Athlon), include some more
generic optimizations as well. This will make the kernel generic optimizations as well. This will make the kernel
...@@ -253,44 +294,31 @@ endif ...@@ -253,44 +294,31 @@ endif
# #
# Define implied options from the CPU selection here # Define implied options from the CPU selection here
# config X86_L1_CACHE_BYTES
int
default "128" if GENERIC_CPU || MPSC
default "64" if MK8 || MCORE2
depends on X86_64
config X86_INTERNODE_CACHE_BYTES
int
default "4096" if X86_VSMP
default X86_L1_CACHE_BYTES if !X86_VSMP
depends on X86_64
config X86_CMPXCHG config X86_CMPXCHG
bool def_bool X86_64 || (X86_32 && !M386)
depends on !M386
default y
config X86_L1_CACHE_SHIFT config X86_L1_CACHE_SHIFT
int int
default "7" if MPENTIUM4 || X86_GENERIC default "7" if MPENTIUM4 || X86_GENERIC || GENERIC_CPU || MPSC
default "4" if X86_ELAN || M486 || M386 || MGEODEGX1 default "4" if X86_ELAN || M486 || M386 || MGEODEGX1
default "5" if MWINCHIP3D || MWINCHIP2 || MWINCHIPC6 || MCRUSOE || MEFFICEON || MCYRIXIII || MK6 || MPENTIUMIII || MPENTIUMII || M686 || M586MMX || M586TSC || M586 || MVIAC3_2 || MGEODE_LX default "5" if MWINCHIP3D || MWINCHIP2 || MWINCHIPC6 || MCRUSOE || MEFFICEON || MCYRIXIII || MK6 || MPENTIUMIII || MPENTIUMII || M686 || M586MMX || M586TSC || M586 || MVIAC3_2 || MGEODE_LX
default "6" if MK7 || MK8 || MPENTIUMM || MCORE2 || MVIAC7 default "6" if MK7 || MK8 || MPENTIUMM || MCORE2 || MVIAC7
config X86_XADD config X86_XADD
bool bool
depends on !M386 depends on X86_32 && !M386
default y
config RWSEM_GENERIC_SPINLOCK
bool
depends on !X86_XADD
default y
config RWSEM_XCHGADD_ALGORITHM
bool
depends on X86_XADD
default y
config ARCH_HAS_ILOG2_U32
bool
default n
config ARCH_HAS_ILOG2_U64
bool
default n
config GENERIC_CALIBRATE_DELAY
bool
default y default y
config X86_PPRO_FENCE config X86_PPRO_FENCE
...@@ -305,22 +333,22 @@ config X86_F00F_BUG ...@@ -305,22 +333,22 @@ config X86_F00F_BUG
config X86_WP_WORKS_OK config X86_WP_WORKS_OK
bool bool
depends on !M386 depends on X86_32 && !M386
default y default y
config X86_INVLPG config X86_INVLPG
bool bool
depends on !M386 depends on X86_32 && !M386
default y default y
config X86_BSWAP config X86_BSWAP
bool bool
depends on !M386 depends on X86_32 && !M386
default y default y
config X86_POPAD_OK config X86_POPAD_OK
bool bool
depends on !M386 depends on X86_32 && !M386
default y default y
config X86_ALIGNMENT_16 config X86_ALIGNMENT_16
...@@ -330,7 +358,7 @@ config X86_ALIGNMENT_16 ...@@ -330,7 +358,7 @@ config X86_ALIGNMENT_16
config X86_GOOD_APIC config X86_GOOD_APIC
bool bool
depends on MK7 || MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || M586MMX || MK8 || MEFFICEON || MCORE2 || MVIAC7 depends on MK7 || MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || M586MMX || MK8 || MEFFICEON || MCORE2 || MVIAC7 || X86_64
default y default y
config X86_INTEL_USERCOPY config X86_INTEL_USERCOPY
...@@ -355,7 +383,7 @@ config X86_OOSTORE ...@@ -355,7 +383,7 @@ config X86_OOSTORE
config X86_TSC config X86_TSC
bool bool
depends on (MWINCHIP3D || MWINCHIP2 || MCRUSOE || MEFFICEON || MCYRIXIII || MK7 || MK6 || MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || M586MMX || M586TSC || MK8 || MVIAC3_2 || MVIAC7 || MGEODEGX1 || MGEODE_LX || MCORE2) && !X86_NUMAQ depends on ((MWINCHIP3D || MWINCHIP2 || MCRUSOE || MEFFICEON || MCYRIXIII || MK7 || MK6 || MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || M586MMX || M586TSC || MK8 || MVIAC3_2 || MVIAC7 || MGEODEGX1 || MGEODE_LX || MCORE2) && !X86_NUMAQ) || X86_64
default y default y
# this should be set for all -march=.. options where the compiler # this should be set for all -march=.. options where the compiler
...@@ -367,6 +395,7 @@ config X86_CMOV ...@@ -367,6 +395,7 @@ config X86_CMOV
config X86_MINIMUM_CPU_FAMILY config X86_MINIMUM_CPU_FAMILY
int int
default "4" if X86_XADD || X86_CMPXCHG || X86_BSWAP || X86_WP_WORKS_OK default "64" if X86_64
default "4" if X86_32 && (X86_XADD || X86_CMPXCHG || X86_BSWAP || X86_WP_WORKS_OK)
default "3" default "3"
This diff is collapsed.
# Unified Makefile for i386 and x86_64 # Unified Makefile for i386 and x86_64
# select defconfig based on actual architecture # select defconfig based on actual architecture
KBUILD_DEFCONFIG := $(ARCH)_defconfig ifeq ($(ARCH),x86)
KBUILD_DEFCONFIG := i386_defconfig
else
KBUILD_DEFCONFIG := $(ARCH)_defconfig
endif
# # No need to remake these files # No need to remake these files
$(srctree)/arch/x86/Makefile%: ; $(srctree)/arch/x86/Makefile%: ;
ifeq ($(ARCH),i386) ifeq ($(CONFIG_X86_32),y)
include $(srctree)/arch/x86/Makefile_32 include $(srctree)/arch/x86/Makefile_32
else else
include $(srctree)/arch/x86/Makefile_64 include $(srctree)/arch/x86/Makefile_64
......
...@@ -160,7 +160,7 @@ archclean: ...@@ -160,7 +160,7 @@ archclean:
$(Q)$(MAKE) $(clean)=arch/x86/boot $(Q)$(MAKE) $(clean)=arch/x86/boot
define archhelp define archhelp
echo '* bzImage - Compressed kernel image (arch/$(ARCH)/boot/bzImage)' echo '* bzImage - Compressed kernel image (arch/x86/boot/bzImage)'
echo ' install - Install kernel using' echo ' install - Install kernel using'
echo ' (your) ~/bin/installkernel or' echo ' (your) ~/bin/installkernel or'
echo ' (distribution) /sbin/installkernel or' echo ' (distribution) /sbin/installkernel or'
...@@ -170,6 +170,6 @@ define archhelp ...@@ -170,6 +170,6 @@ define archhelp
echo ' isoimage - Create a boot CD-ROM image' echo ' isoimage - Create a boot CD-ROM image'
endef endef
CLEAN_FILES += arch/$(ARCH)/boot/fdimage \ CLEAN_FILES += arch/x86/boot/fdimage \
arch/$(ARCH)/boot/image.iso \ arch/x86/boot/image.iso \
arch/$(ARCH)/boot/mtools.conf arch/x86/boot/mtools.conf
...@@ -127,7 +127,7 @@ archclean: ...@@ -127,7 +127,7 @@ archclean:
$(Q)$(MAKE) $(clean)=$(boot) $(Q)$(MAKE) $(clean)=$(boot)
define archhelp define archhelp
echo '* bzImage - Compressed kernel image (arch/$(ARCH)/boot/bzImage)' echo '* bzImage - Compressed kernel image (arch/x86/boot/bzImage)'
echo ' install - Install kernel using' echo ' install - Install kernel using'
echo ' (your) ~/bin/installkernel or' echo ' (your) ~/bin/installkernel or'
echo ' (distribution) /sbin/installkernel or' echo ' (distribution) /sbin/installkernel or'
...@@ -137,8 +137,8 @@ define archhelp ...@@ -137,8 +137,8 @@ define archhelp
echo ' isoimage - Create a boot CD-ROM image' echo ' isoimage - Create a boot CD-ROM image'
endef endef
CLEAN_FILES += arch/$(ARCH)/boot/fdimage \ CLEAN_FILES += arch/x86/boot/fdimage \
arch/$(ARCH)/boot/image.iso \ arch/x86/boot/image.iso \
arch/$(ARCH)/boot/mtools.conf arch/x86/boot/mtools.conf
...@@ -49,10 +49,10 @@ HOSTCFLAGS_build.o := $(LINUXINCLUDE) ...@@ -49,10 +49,10 @@ HOSTCFLAGS_build.o := $(LINUXINCLUDE)
# How to compile the 16-bit code. Note we always compile for -march=i386, # How to compile the 16-bit code. Note we always compile for -march=i386,
# that way we can complain to the user if the CPU is insufficient. # that way we can complain to the user if the CPU is insufficient.
cflags-i386 := cflags-$(CONFIG_X86_32) :=
cflags-x86_64 := -m32 cflags-$(CONFIG_X86_64) := -m32
KBUILD_CFLAGS := $(LINUXINCLUDE) -g -Os -D_SETUP -D__KERNEL__ \ KBUILD_CFLAGS := $(LINUXINCLUDE) -g -Os -D_SETUP -D__KERNEL__ \
$(cflags-$(ARCH)) \ $(cflags-y) \
-Wall -Wstrict-prototypes \ -Wall -Wstrict-prototypes \
-march=i386 -mregparm=3 \ -march=i386 -mregparm=3 \
-include $(srctree)/$(src)/code16gcc.h \ -include $(srctree)/$(src)/code16gcc.h \
......
...@@ -42,13 +42,7 @@ static struct cpu_features cpu; ...@@ -42,13 +42,7 @@ static struct cpu_features cpu;
static u32 cpu_vendor[3]; static u32 cpu_vendor[3];
static u32 err_flags[NCAPINTS]; static u32 err_flags[NCAPINTS];
#ifdef CONFIG_X86_64
static const int req_level = 64;
#elif defined(CONFIG_X86_MINIMUM_CPU_FAMILY)
static const int req_level = CONFIG_X86_MINIMUM_CPU_FAMILY; static const int req_level = CONFIG_X86_MINIMUM_CPU_FAMILY;
#else
static const int req_level = 3;
#endif
static const u32 req_flags[NCAPINTS] = static const u32 req_flags[NCAPINTS] =
{ {
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
# #
extra-y := head_32.o init_task.o vmlinux.lds extra-y := head_32.o init_task.o vmlinux.lds
CPPFLAGS_vmlinux.lds += -Ui386
obj-y := process_32.o signal_32.o entry_32.o traps_32.o irq_32.o \ obj-y := process_32.o signal_32.o entry_32.o traps_32.o irq_32.o \
ptrace_32.o time_32.o ioport_32.o ldt_32.o setup_32.o i8259_32.o sys_i386_32.o \ ptrace_32.o time_32.o ioport_32.o ldt_32.o setup_32.o i8259_32.o sys_i386_32.o \
...@@ -60,7 +61,7 @@ quiet_cmd_syscall = SYSCALL $@ ...@@ -60,7 +61,7 @@ quiet_cmd_syscall = SYSCALL $@
cmd_syscall = $(CC) -m elf_i386 -nostdlib $(SYSCFLAGS_$(@F)) \ cmd_syscall = $(CC) -m elf_i386 -nostdlib $(SYSCFLAGS_$(@F)) \
-Wl,-T,$(filter-out FORCE,$^) -o $@ -Wl,-T,$(filter-out FORCE,$^) -o $@
export CPPFLAGS_vsyscall_32.lds += -P -C -U$(ARCH) export CPPFLAGS_vsyscall_32.lds += -P -C -Ui386
vsyscall-flags = -shared -s -Wl,-soname=linux-gate.so.1 \ vsyscall-flags = -shared -s -Wl,-soname=linux-gate.so.1 \
$(call ld-option, -Wl$(comma)--hash-style=sysv) $(call ld-option, -Wl$(comma)--hash-style=sysv)
......
...@@ -3,7 +3,9 @@ ...@@ -3,7 +3,9 @@
# #
extra-y := head_64.o head64.o init_task.o vmlinux.lds extra-y := head_64.o head64.o init_task.o vmlinux.lds
CPPFLAGS_vmlinux.lds += -Ux86_64
EXTRA_AFLAGS := -traditional EXTRA_AFLAGS := -traditional
obj-y := process_64.o signal_64.o entry_64.o traps_64.o irq_64.o \ obj-y := process_64.o signal_64.o entry_64.o traps_64.o irq_64.o \
ptrace_64.o time_64.o ioport_64.o ldt_64.o setup_64.o i8259_64.o sys_x86_64.o \ ptrace_64.o time_64.o ioport_64.o ldt_64.o setup_64.o i8259_64.o sys_x86_64.o \
x8664_ksyms_64.o i387_64.o syscall_64.o vsyscall_64.o \ x8664_ksyms_64.o i387_64.o syscall_64.o vsyscall_64.o \
......
...@@ -19,6 +19,9 @@ config X86_ACPI_CPUFREQ ...@@ -19,6 +19,9 @@ config X86_ACPI_CPUFREQ
Processor Performance States. Processor Performance States.
This driver also supports Intel Enhanced Speedstep. This driver also supports Intel Enhanced Speedstep.
To compile this driver as a module, choose M here: the
module will be called acpi-cpufreq.
For details, take a look at <file:Documentation/cpu-freq/>. For details, take a look at <file:Documentation/cpu-freq/>.
If in doubt, say N. If in doubt, say N.
...@@ -26,7 +29,7 @@ config X86_ACPI_CPUFREQ ...@@ -26,7 +29,7 @@ config X86_ACPI_CPUFREQ
config ELAN_CPUFREQ config ELAN_CPUFREQ
tristate "AMD Elan SC400 and SC410" tristate "AMD Elan SC400 and SC410"
select CPU_FREQ_TABLE select CPU_FREQ_TABLE
depends on X86_ELAN depends on X86_32 && X86_ELAN
---help--- ---help---
This adds the CPUFreq driver for AMD Elan SC400 and SC410 This adds the CPUFreq driver for AMD Elan SC400 and SC410
processors. processors.
...@@ -42,7 +45,7 @@ config ELAN_CPUFREQ ...@@ -42,7 +45,7 @@ config ELAN_CPUFREQ
config SC520_CPUFREQ config SC520_CPUFREQ
tristate "AMD Elan SC520" tristate "AMD Elan SC520"
select CPU_FREQ_TABLE select CPU_FREQ_TABLE
depends on X86_ELAN depends on X86_32 && X86_ELAN
---help--- ---help---
This adds the CPUFreq driver for AMD Elan SC520 processor. This adds the CPUFreq driver for AMD Elan SC520 processor.
...@@ -54,6 +57,7 @@ config SC520_CPUFREQ ...@@ -54,6 +57,7 @@ config SC520_CPUFREQ
config X86_POWERNOW_K6 config X86_POWERNOW_K6
tristate "AMD Mobile K6-2/K6-3 PowerNow!" tristate "AMD Mobile K6-2/K6-3 PowerNow!"
select CPU_FREQ_TABLE select CPU_FREQ_TABLE
depends on X86_32
help help
This adds the CPUFreq driver for mobile AMD K6-2+ and mobile This adds the CPUFreq driver for mobile AMD K6-2+ and mobile
AMD K6-3+ processors. AMD K6-3+ processors.
...@@ -65,6 +69,7 @@ config X86_POWERNOW_K6 ...@@ -65,6 +69,7 @@ config X86_POWERNOW_K6
config X86_POWERNOW_K7 config X86_POWERNOW_K7
tristate "AMD Mobile Athlon/Duron PowerNow!" tristate "AMD Mobile Athlon/Duron PowerNow!"
select CPU_FREQ_TABLE select CPU_FREQ_TABLE
depends on X86_32
help help
This adds the CPUFreq driver for mobile AMD K7 mobile processors. This adds the CPUFreq driver for mobile AMD K7 mobile processors.
...@@ -76,23 +81,27 @@ config X86_POWERNOW_K7_ACPI ...@@ -76,23 +81,27 @@ config X86_POWERNOW_K7_ACPI
bool bool
depends on X86_POWERNOW_K7 && ACPI_PROCESSOR depends on X86_POWERNOW_K7 && ACPI_PROCESSOR
depends on !(X86_POWERNOW_K7 = y && ACPI_PROCESSOR = m) depends on !(X86_POWERNOW_K7 = y && ACPI_PROCESSOR = m)
depends on X86_32
default y default y
config X86_POWERNOW_K8 config X86_POWERNOW_K8
tristate "AMD Opteron/Athlon64 PowerNow!" tristate "AMD Opteron/Athlon64 PowerNow!"
select CPU_FREQ_TABLE select CPU_FREQ_TABLE
depends on EXPERIMENTAL
help help
This adds the CPUFreq driver for mobile AMD Opteron/Athlon64 processors. This adds the CPUFreq driver for mobile AMD Opteron/Athlon64 processors.
To compile this driver as a module, choose M here: the
module will be called powernow-k8.
For details, take a look at <file:Documentation/cpu-freq/>. For details, take a look at <file:Documentation/cpu-freq/>.
If in doubt, say N. If in doubt, say N.
config X86_POWERNOW_K8_ACPI config X86_POWERNOW_K8_ACPI
bool "ACPI Support" bool
select ACPI_PROCESSOR prompt "ACPI Support" if X86_32
depends on ACPI && X86_POWERNOW_K8 depends on ACPI && X86_POWERNOW_K8 && ACPI_PROCESSOR
depends on !(X86_POWERNOW_K8 = y && ACPI_PROCESSOR = m)
default y default y
help help
This provides access to the K8s Processor Performance States via ACPI. This provides access to the K8s Processor Performance States via ACPI.
...@@ -104,7 +113,7 @@ config X86_POWERNOW_K8_ACPI ...@@ -104,7 +113,7 @@ config X86_POWERNOW_K8_ACPI
config X86_GX_SUSPMOD config X86_GX_SUSPMOD
tristate "Cyrix MediaGX/NatSemi Geode Suspend Modulation" tristate "Cyrix MediaGX/NatSemi Geode Suspend Modulation"
depends on PCI depends on X86_32 && PCI
help help
This add the CPUFreq driver for NatSemi Geode processors which This add the CPUFreq driver for NatSemi Geode processors which
support suspend modulation. support suspend modulation.
...@@ -114,15 +123,20 @@ config X86_GX_SUSPMOD ...@@ -114,15 +123,20 @@ config X86_GX_SUSPMOD
If in doubt, say N. If in doubt, say N.
config X86_SPEEDSTEP_CENTRINO config X86_SPEEDSTEP_CENTRINO
tristate "Intel Enhanced SpeedStep" tristate "Intel Enhanced SpeedStep (deprecated)"
select CPU_FREQ_TABLE select CPU_FREQ_TABLE
select X86_SPEEDSTEP_CENTRINO_TABLE select X86_SPEEDSTEP_CENTRINO_TABLE if X86_32
depends on X86_32 || (X86_64 && ACPI_PROCESSOR)
help help
This is deprecated and this functionality is now merged into
acpi_cpufreq (X86_ACPI_CPUFREQ). Use that driver instead of
speedstep_centrino.
This adds the CPUFreq driver for Enhanced SpeedStep enabled This adds the CPUFreq driver for Enhanced SpeedStep enabled
mobile CPUs. This means Intel Pentium M (Centrino) CPUs. However, mobile CPUs. This means Intel Pentium M (Centrino) CPUs
you also need to say Y to "Use ACPI tables to decode..." below or 64bit enabled Intel Xeons.
[which might imply enabling ACPI] if you want to use this driver
on non-Banias CPUs. To compile this driver as a module, choose M here: the
module will be called speedstep-centrino.
For details, take a look at <file:Documentation/cpu-freq/>. For details, take a look at <file:Documentation/cpu-freq/>.
...@@ -130,7 +144,7 @@ config X86_SPEEDSTEP_CENTRINO ...@@ -130,7 +144,7 @@ config X86_SPEEDSTEP_CENTRINO
config X86_SPEEDSTEP_CENTRINO_TABLE config X86_SPEEDSTEP_CENTRINO_TABLE
bool "Built-in tables for Banias CPUs" bool "Built-in tables for Banias CPUs"
depends on X86_SPEEDSTEP_CENTRINO depends on X86_32 && X86_SPEEDSTEP_CENTRINO
default y default y
help help
Use built-in tables for Banias CPUs if ACPI encoding Use built-in tables for Banias CPUs if ACPI encoding
...@@ -141,6 +155,7 @@ config X86_SPEEDSTEP_CENTRINO_TABLE ...@@ -141,6 +155,7 @@ config X86_SPEEDSTEP_CENTRINO_TABLE
config X86_SPEEDSTEP_ICH config X86_SPEEDSTEP_ICH
tristate "Intel Speedstep on ICH-M chipsets (ioport interface)" tristate "Intel Speedstep on ICH-M chipsets (ioport interface)"
select CPU_FREQ_TABLE select CPU_FREQ_TABLE
depends on X86_32
help help
This adds the CPUFreq driver for certain mobile Intel Pentium III This adds the CPUFreq driver for certain mobile Intel Pentium III
(Coppermine), all mobile Intel Pentium III-M (Tualatin) and all (Coppermine), all mobile Intel Pentium III-M (Tualatin) and all
...@@ -154,7 +169,7 @@ config X86_SPEEDSTEP_ICH ...@@ -154,7 +169,7 @@ config X86_SPEEDSTEP_ICH
config X86_SPEEDSTEP_SMI config X86_SPEEDSTEP_SMI
tristate "Intel SpeedStep on 440BX/ZX/MX chipsets (SMI interface)" tristate "Intel SpeedStep on 440BX/ZX/MX chipsets (SMI interface)"
select CPU_FREQ_TABLE select CPU_FREQ_TABLE
depends on EXPERIMENTAL depends on X86_32 && EXPERIMENTAL
help help
This adds the CPUFreq driver for certain mobile Intel Pentium III This adds the CPUFreq driver for certain mobile Intel Pentium III
(Coppermine), all mobile Intel Pentium III-M (Tualatin) (Coppermine), all mobile Intel Pentium III-M (Tualatin)
...@@ -169,15 +184,24 @@ config X86_P4_CLOCKMOD ...@@ -169,15 +184,24 @@ config X86_P4_CLOCKMOD
select CPU_FREQ_TABLE select CPU_FREQ_TABLE
help help
This adds the CPUFreq driver for Intel Pentium 4 / XEON This adds the CPUFreq driver for Intel Pentium 4 / XEON
processors. processors. When enabled it will lower CPU temperature by skipping
clocks.
This driver should be only used in exceptional
circumstances when very low power is needed because it causes severe
slowdowns and noticeable latencies. Normally Speedstep should be used
instead.
To compile this driver as a module, choose M here: the
module will be called p4-clockmod.
For details, take a look at <file:Documentation/cpu-freq/>. For details, take a look at <file:Documentation/cpu-freq/>.
If in doubt, say N. Unless you are absolutely sure say N.
config X86_CPUFREQ_NFORCE2 config X86_CPUFREQ_NFORCE2
tristate "nVidia nForce2 FSB changing" tristate "nVidia nForce2 FSB changing"
depends on EXPERIMENTAL depends on X86_32 && EXPERIMENTAL
help help
This adds the CPUFreq driver for FSB changing on nVidia nForce2 This adds the CPUFreq driver for FSB changing on nVidia nForce2
platforms. platforms.
...@@ -188,6 +212,7 @@ config X86_CPUFREQ_NFORCE2 ...@@ -188,6 +212,7 @@ config X86_CPUFREQ_NFORCE2
config X86_LONGRUN config X86_LONGRUN
tristate "Transmeta LongRun" tristate "Transmeta LongRun"
depends on X86_32
help help
This adds the CPUFreq driver for Transmeta Crusoe and Efficeon processors This adds the CPUFreq driver for Transmeta Crusoe and Efficeon processors
which support LongRun. which support LongRun.
...@@ -199,7 +224,7 @@ config X86_LONGRUN ...@@ -199,7 +224,7 @@ config X86_LONGRUN
config X86_LONGHAUL config X86_LONGHAUL
tristate "VIA Cyrix III Longhaul" tristate "VIA Cyrix III Longhaul"
select CPU_FREQ_TABLE select CPU_FREQ_TABLE
depends on ACPI_PROCESSOR depends on X86_32 && ACPI_PROCESSOR
help help
This adds the CPUFreq driver for VIA Samuel/CyrixIII, This adds the CPUFreq driver for VIA Samuel/CyrixIII,
VIA Cyrix Samuel/C3, VIA Cyrix Ezra and VIA Cyrix Ezra-T VIA Cyrix Samuel/C3, VIA Cyrix Ezra and VIA Cyrix Ezra-T
...@@ -212,7 +237,7 @@ config X86_LONGHAUL ...@@ -212,7 +237,7 @@ config X86_LONGHAUL
config X86_E_POWERSAVER config X86_E_POWERSAVER
tristate "VIA C7 Enhanced PowerSaver (EXPERIMENTAL)" tristate "VIA C7 Enhanced PowerSaver (EXPERIMENTAL)"
select CPU_FREQ_TABLE select CPU_FREQ_TABLE
depends on EXPERIMENTAL depends on X86_32 && EXPERIMENTAL
help help
This adds the CPUFreq driver for VIA C7 processors. This adds the CPUFreq driver for VIA C7 processors.
...@@ -233,11 +258,11 @@ config X86_ACPI_CPUFREQ_PROC_INTF ...@@ -233,11 +258,11 @@ config X86_ACPI_CPUFREQ_PROC_INTF
config X86_SPEEDSTEP_LIB config X86_SPEEDSTEP_LIB
tristate tristate
default X86_SPEEDSTEP_ICH || X86_SPEEDSTEP_SMI || X86_P4_CLOCKMOD default (X86_SPEEDSTEP_ICH || X86_SPEEDSTEP_SMI || X86_P4_CLOCKMOD)
config X86_SPEEDSTEP_RELAXED_CAP_CHECK config X86_SPEEDSTEP_RELAXED_CAP_CHECK
bool "Relaxed speedstep capability checks" bool "Relaxed speedstep capability checks"
depends on (X86_SPEEDSTEP_SMI || X86_SPEEDSTEP_ICH) depends on X86_32 && (X86_SPEEDSTEP_SMI || X86_SPEEDSTEP_ICH)
help help
Don't perform all checks for a speedstep capable system which would Don't perform all checks for a speedstep capable system which would
normally be done. Some ancient or strange systems, though speedstep normally be done. Some ancient or strange systems, though speedstep
......
#
# CPU Frequency scaling
#
menu "CPU Frequency scaling"
source "drivers/cpufreq/Kconfig"
if CPU_FREQ
comment "CPUFreq processor drivers"
config X86_POWERNOW_K8
tristate "AMD Opteron/Athlon64 PowerNow!"
select CPU_FREQ_TABLE
help
This adds the CPUFreq driver for mobile AMD Opteron/Athlon64 processors.
To compile this driver as a module, choose M here: the
module will be called powernow-k8.
For details, take a look at <file:Documentation/cpu-freq/>.
If in doubt, say N.
config X86_POWERNOW_K8_ACPI
bool
depends on X86_POWERNOW_K8 && ACPI_PROCESSOR
depends on !(X86_POWERNOW_K8 = y && ACPI_PROCESSOR = m)
default y
config X86_SPEEDSTEP_CENTRINO
tristate "Intel Enhanced SpeedStep (deprecated)"
select CPU_FREQ_TABLE
depends on ACPI_PROCESSOR
help
This is deprecated and this functionality is now merged into
acpi_cpufreq (X86_ACPI_CPUFREQ). Use that driver instead of
speedstep_centrino.
This adds the CPUFreq driver for Enhanced SpeedStep enabled
mobile CPUs. This means Intel Pentium M (Centrino) CPUs
or 64bit enabled Intel Xeons.
To compile this driver as a module, choose M here: the
module will be called speedstep-centrino.
For details, take a look at <file:Documentation/cpu-freq/>.
If in doubt, say N.
config X86_ACPI_CPUFREQ
tristate "ACPI Processor P-States driver"
select CPU_FREQ_TABLE
depends on ACPI_PROCESSOR
help
This driver adds a CPUFreq driver which utilizes the ACPI
Processor Performance States.
This driver also supports Intel Enhanced Speedstep.
To compile this driver as a module, choose M here: the
module will be called acpi-cpufreq.
For details, take a look at <file:Documentation/cpu-freq/>.
If in doubt, say N.
comment "shared options"
config X86_ACPI_CPUFREQ_PROC_INTF
bool "/proc/acpi/processor/../performance interface (deprecated)"
depends on PROC_FS
depends on X86_ACPI_CPUFREQ || X86_POWERNOW_K8_ACPI
help
This enables the deprecated /proc/acpi/processor/../performance
interface. While it is helpful for debugging, the generic,
cross-architecture cpufreq interfaces should be used.
If in doubt, say N.
config X86_P4_CLOCKMOD
tristate "Intel Pentium 4 clock modulation"
depends on EMBEDDED
select CPU_FREQ_TABLE
help
This adds the clock modulation driver for Intel Pentium 4 / XEON
processors. When enabled it will lower CPU temperature by skipping
clocks.
This driver should be only used in exceptional
circumstances when very low power is needed because it causes severe
slowdowns and noticeable latencies. Normally Speedstep should be used
instead.
To compile this driver as a module, choose M here: the
module will be called p4-clockmod.
For details, take a look at <file:Documentation/cpu-freq/>.
Unless you are absolutely sure say N.
config X86_SPEEDSTEP_LIB
tristate
default X86_P4_CLOCKMOD
endif
endmenu
...@@ -20,7 +20,7 @@ quiet_cmd_syscall = SYSCALL $@ ...@@ -20,7 +20,7 @@ quiet_cmd_syscall = SYSCALL $@
cmd_syscall = $(CC) -m elf_x86_64 -nostdlib $(SYSCFLAGS_$(@F)) \ cmd_syscall = $(CC) -m elf_x86_64 -nostdlib $(SYSCFLAGS_$(@F)) \
-Wl,-T,$(filter-out FORCE,$^) -o $@ -Wl,-T,$(filter-out FORCE,$^) -o $@
export CPPFLAGS_vdso.lds += -P -C -U$(ARCH) export CPPFLAGS_vdso.lds += -P -C
vdso-flags = -fPIC -shared -Wl,-soname=linux-vdso.so.1 \ vdso-flags = -fPIC -shared -Wl,-soname=linux-vdso.so.1 \
$(call ld-option, -Wl$(comma)--hash-style=sysv) \ $(call ld-option, -Wl$(comma)--hash-style=sysv) \
......
...@@ -4,12 +4,7 @@ ...@@ -4,12 +4,7 @@
PHONY += oldconfig xconfig gconfig menuconfig config silentoldconfig update-po-config PHONY += oldconfig xconfig gconfig menuconfig config silentoldconfig update-po-config
# If a arch/$(SRCARCH)/Kconfig.$(ARCH) file exist use it Kconfig := arch/$(SRCARCH)/Kconfig
ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/Kconfig.$(ARCH)),)
Kconfig := arch/$(SRCARCH)/Kconfig.$(ARCH)
else
Kconfig := arch/$(SRCARCH)/Kconfig
endif
xconfig: $(obj)/qconf xconfig: $(obj)/qconf
$< $(Kconfig) $< $(Kconfig)
......
...@@ -591,6 +591,7 @@ int main(int ac, char **av) ...@@ -591,6 +591,7 @@ int main(int ac, char **av)
conf_read_simple(name, S_DEF_USER); conf_read_simple(name, S_DEF_USER);
else if (!stat("all.config", &tmpstat)) else if (!stat("all.config", &tmpstat))
conf_read_simple("all.config", S_DEF_USER); conf_read_simple("all.config", S_DEF_USER);
conf_set_env_sym("K64BIT", "64BIT", S_DEF_USER);
break; break;
default: default:
break; break;
......
...@@ -83,6 +83,95 @@ char *conf_get_default_confname(void) ...@@ -83,6 +83,95 @@ char *conf_get_default_confname(void)
return name; return name;
} }
static int conf_set_sym_val(struct symbol *sym, int def, int def_flags, char *p)
{
char *p2;
switch (sym->type) {
case S_TRISTATE:
if (p[0] == 'm') {
sym->def[def].tri = mod;
sym->flags |= def_flags;
break;
}
case S_BOOLEAN:
if (p[0] == 'y') {
sym->def[def].tri = yes;
sym->flags |= def_flags;
break;
}
if (p[0] == 'n') {
sym->def[def].tri = no;
sym->flags |= def_flags;
break;
}
conf_warning("symbol value '%s' invalid for %s", p, sym->name);
break;
case S_OTHER:
if (*p != '"') {
for (p2 = p; *p2 && !isspace(*p2); p2++)
;
sym->type = S_STRING;
goto done;
}
case S_STRING:
if (*p++ != '"')
break;
for (p2 = p; (p2 = strpbrk(p2, "\"\\")); p2++) {
if (*p2 == '"') {
*p2 = 0;
break;
}
memmove(p2, p2 + 1, strlen(p2));
}
if (!p2) {
conf_warning("invalid string found");
return 1;
}
case S_INT:
case S_HEX:
done:
if (sym_string_valid(sym, p)) {
sym->def[def].val = strdup(p);
sym->flags |= def_flags;
} else {
conf_warning("symbol value '%s' invalid for %s", p, sym->name);
return 1;
}
break;
default:
;
}
return 0;
}
/* Read an environment variable and assign the value to the symbol */
int conf_set_env_sym(const char *env, const char *symname, int def)
{
struct symbol *sym;
char *p;
int def_flags;
p = getenv(env);
if (p) {
char warning[200];
sprintf(warning, "Environment variable (%s = \"%s\")", env, p);
conf_filename = warning;
def_flags = SYMBOL_DEF << def;
if (def == S_DEF_USER) {
sym = sym_find(symname);
if (!sym)
return 1;
} else {
sym = sym_lookup(symname, 0);
if (sym->type == S_UNKNOWN)
sym->type = S_OTHER;
}
conf_set_sym_val(sym, def, def_flags, p);
}
return 0;
}
int conf_read_simple(const char *name, int def) int conf_read_simple(const char *name, int def)
{ {
FILE *in = NULL; FILE *in = NULL;
...@@ -213,61 +302,8 @@ int conf_read_simple(const char *name, int def) ...@@ -213,61 +302,8 @@ int conf_read_simple(const char *name, int def)
conf_warning("trying to reassign symbol %s", sym->name); conf_warning("trying to reassign symbol %s", sym->name);
break; break;
} }
switch (sym->type) { if (conf_set_sym_val(sym, def, def_flags, p))
case S_TRISTATE: continue;
if (p[0] == 'm') {
sym->def[def].tri = mod;
sym->flags |= def_flags;
break;
}
case S_BOOLEAN:
if (p[0] == 'y') {
sym->def[def].tri = yes;
sym->flags |= def_flags;
break;
}
if (p[0] == 'n') {
sym->def[def].tri = no;
sym->flags |= def_flags;
break;
}
conf_warning("symbol value '%s' invalid for %s", p, sym->name);
break;
case S_OTHER:
if (*p != '"') {
for (p2 = p; *p2 && !isspace(*p2); p2++)
;
sym->type = S_STRING;
goto done;
}
case S_STRING:
if (*p++ != '"')
break;
for (p2 = p; (p2 = strpbrk(p2, "\"\\")); p2++) {
if (*p2 == '"') {
*p2 = 0;
break;
}
memmove(p2, p2 + 1, strlen(p2));
}
if (!p2) {
conf_warning("invalid string found");
continue;
}
case S_INT:
case S_HEX:
done:
if (sym_string_valid(sym, p)) {
sym->def[def].val = strdup(p);
sym->flags |= def_flags;
} else {
conf_warning("symbol value '%s' invalid for %s", p, sym->name);
continue;
}
break;
default:
;
}
break; break;
case '\r': case '\r':
case '\n': case '\n':
......
/* confdata.c */ /* confdata.c */
P(conf_parse,void,(const char *name)); P(conf_parse,void,(const char *name));
P(conf_set_env_sym,int,(const char *envname, const char *symname, int def));
P(conf_read,int,(const char *name)); P(conf_read,int,(const char *name));
P(conf_read_simple,int,(const char *name, int)); P(conf_read_simple,int,(const char *name, int));
P(conf_write,int,(const char *name)); P(conf_write,int,(const char *name));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment