diff --git a/[refs] b/[refs] index 0bd06e9d33d1..9b88fbfbec52 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 9abbf7d028b1598b40ebdc81c48f30da7f3d5bf5 +refs/heads/master: 2e977c85d78e2ae846d313d0c139d0efbc0c1207 diff --git a/trunk/.gitignore b/trunk/.gitignore index 8d14531846b9..22fb8fa9bc3d 100644 --- a/trunk/.gitignore +++ b/trunk/.gitignore @@ -12,7 +12,6 @@ *.s *.ko *.so -*.so.dbg *.mod.c *.i *.lst diff --git a/trunk/Documentation/device-mapper/dm-uevent.txt b/trunk/Documentation/device-mapper/dm-uevent.txt deleted file mode 100644 index 07edbd85c714..000000000000 --- a/trunk/Documentation/device-mapper/dm-uevent.txt +++ /dev/null @@ -1,97 +0,0 @@ -The device-mapper uevent code adds the capability to device-mapper to create -and send kobject uevents (uevents). Previously device-mapper events were only -available through the ioctl interface. The advantage of the uevents interface -is the event contains environment attributes providing increased context for -the event avoiding the need to query the state of the device-mapper device after -the event is received. - -There are two functions currently for device-mapper events. The first function -listed creates the event and the second function sends the event(s). - -void dm_path_uevent(enum dm_uevent_type event_type, struct dm_target *ti, - const char *path, unsigned nr_valid_paths) - -void dm_send_uevents(struct list_head *events, struct kobject *kobj) - - -The variables added to the uevent environment are: - -Variable Name: DM_TARGET -Uevent Action(s): KOBJ_CHANGE -Type: string -Description: -Value: Name of device-mapper target that generated the event. - -Variable Name: DM_ACTION -Uevent Action(s): KOBJ_CHANGE -Type: string -Description: -Value: Device-mapper specific action that caused the uevent action. - PATH_FAILED - A path has failed. - PATH_REINSTATED - A path has been reinstated. - -Variable Name: DM_SEQNUM -Uevent Action(s): KOBJ_CHANGE -Type: unsigned integer -Description: A sequence number for this specific device-mapper device. -Value: Valid unsigned integer range. - -Variable Name: DM_PATH -Uevent Action(s): KOBJ_CHANGE -Type: string -Description: Major and minor number of the path device pertaining to this -event. -Value: Path name in the form of "Major:Minor" - -Variable Name: DM_NR_VALID_PATHS -Uevent Action(s): KOBJ_CHANGE -Type: unsigned integer -Description: -Value: Valid unsigned integer range. - -Variable Name: DM_NAME -Uevent Action(s): KOBJ_CHANGE -Type: string -Description: Name of the device-mapper device. -Value: Name - -Variable Name: DM_UUID -Uevent Action(s): KOBJ_CHANGE -Type: string -Description: UUID of the device-mapper device. -Value: UUID. (Empty string if there isn't one.) - -An example of the uevents generated as captured by udevmonitor is shown -below. - -1.) Path failure. -UEVENT[1192521009.711215] change@/block/dm-3 -ACTION=change -DEVPATH=/block/dm-3 -SUBSYSTEM=block -DM_TARGET=multipath -DM_ACTION=PATH_FAILED -DM_SEQNUM=1 -DM_PATH=8:32 -DM_NR_VALID_PATHS=0 -DM_NAME=mpath2 -DM_UUID=mpath-35333333000002328 -MINOR=3 -MAJOR=253 -SEQNUM=1130 - -2.) Path reinstate. -UEVENT[1192521132.989927] change@/block/dm-3 -ACTION=change -DEVPATH=/block/dm-3 -SUBSYSTEM=block -DM_TARGET=multipath -DM_ACTION=PATH_REINSTATED -DM_SEQNUM=2 -DM_PATH=8:32 -DM_NR_VALID_PATHS=1 -DM_NAME=mpath2 -DM_UUID=mpath-35333333000002328 -MINOR=3 -MAJOR=253 -SEQNUM=1131 diff --git a/trunk/Documentation/kbuild/kconfig-language.txt b/trunk/Documentation/kbuild/kconfig-language.txt index 616043a6da99..fe8b0c4892cf 100644 --- a/trunk/Documentation/kbuild/kconfig-language.txt +++ b/trunk/Documentation/kbuild/kconfig-language.txt @@ -77,12 +77,7 @@ applicable everywhere (see syntax). Optionally, dependencies only for this default value can be added with "if". -- type definition + default value: - "def_bool"/"def_tristate" ["if" ] - This is a shorthand notation for a type definition plus a value. - Optionally dependencies for this default value can be added with "if". - -- dependencies: "depends on" +- dependencies: "depends on"/"requires" This defines a dependency for this menu entry. If multiple dependencies are defined, they are connected with '&&'. Dependencies are applied to all other options within this menu entry (which also @@ -294,10 +289,3 @@ source: "source" This reads the specified configuration file. This file is always parsed. - -mainmenu: - - "mainmenu" - -This sets the config program's title bar if the config program chooses -to use it. diff --git a/trunk/Documentation/kbuild/makefiles.txt b/trunk/Documentation/kbuild/makefiles.txt index 6166e2d7da76..f099b814d383 100644 --- a/trunk/Documentation/kbuild/makefiles.txt +++ b/trunk/Documentation/kbuild/makefiles.txt @@ -518,28 +518,6 @@ more details, with real examples. In this example for a specific GCC version the build will error out explaining to the user why it stops. - cc-cross-prefix - cc-cross-prefix is used to check if there exist a $(CC) in path with - one of the listed prefixes. The first prefix where there exist a - prefix$(CC) in the PATH is returned - and if no prefix$(CC) is found - then nothing is returned. - Additional prefixes are separated by a single space in the - call of cc-cross-prefix. - This functionality is usefull for architecture Makefile that try - to set CROSS_COMPILE to well know values but may have several - values to select between. - It is recommended only to try to set CROSS_COMPILE is it is a cross - build (host arch is different from target arch). And is CROSS_COMPILE - is already set then leave it with the old value. - - Example: - #arch/m68k/Makefile - ifneq ($(SUBARCH),$(ARCH)) - ifeq ($(CROSS_COMPILE),) - CROSS_COMPILE := $(call cc-cross-prefix, m68k-linux-gnu-) - endif - endif - === 4 Host Program support Kbuild supports building executables on the host for use during the diff --git a/trunk/Documentation/kernel-parameters.txt b/trunk/Documentation/kernel-parameters.txt index 7bf6bd2f530b..0a3fed445249 100644 --- a/trunk/Documentation/kernel-parameters.txt +++ b/trunk/Documentation/kernel-parameters.txt @@ -431,10 +431,8 @@ and is between 256 and 4096 characters. It is defined in the file over the 8254 in addition to over the IO-APIC. The kernel tries to set a sensible default. - hpet= [X86-32,HPET] option to control HPET usage - Format: { enable (default) | disable | force } - disable: disable HPET and use PIT instead - force: allow force enabled of undocumented chips (ICH4, VIA) + hpet= [X86-32,HPET] option to disable HPET and use PIT. + Format: disable com20020= [HW,NET] ARCnet - COM20020 chipset Format: diff --git a/trunk/MAINTAINERS b/trunk/MAINTAINERS index 4ed41394e492..2534dc4aa95a 100644 --- a/trunk/MAINTAINERS +++ b/trunk/MAINTAINERS @@ -2178,7 +2178,7 @@ S: Maintained KCONFIG P: Roman Zippel M: zippel@linux-m68k.org -L: linux-kbuild@vger.kernel.org +L: kbuild-devel@lists.sourceforge.net S: Maintained KDUMP @@ -2207,7 +2207,6 @@ KERNEL BUILD (kbuild: Makefile, scripts/Makefile.*) P: Sam Ravnborg M: sam@ravnborg.org T: git kernel.org:/pub/scm/linux/kernel/git/sam/kbuild.git -L: linux-kbuild@vger.kernel.org S: Maintained KERNEL JANITORS diff --git a/trunk/Makefile b/trunk/Makefile index f9c264e243a2..68ef80b30340 100644 --- a/trunk/Makefile +++ b/trunk/Makefile @@ -887,7 +887,10 @@ prepare2: prepare3 outputmakefile prepare1: prepare2 include/linux/version.h include/linux/utsrelease.h \ include/asm include/config/auto.conf - $(cmd_crmodverdir) +ifneq ($(KBUILD_MODULES),) + $(Q)mkdir -p $(MODVERDIR) + $(Q)rm -f $(MODVERDIR)/* +endif archprepare: prepare1 scripts_basic @@ -903,24 +906,14 @@ prepare: prepare0 export CPPFLAGS_vmlinux.lds += -P -C -U$(ARCH) -# The asm symlink changes when $(ARCH) changes. -# Detect this and ask user to run make mrproper - -include/asm: FORCE - $(Q)set -e; asmlink=`readlink include/asm | cut -d '-' -f 2`; \ - if [ -L include/asm ]; then \ - if [ "$$asmlink" != "$(SRCARCH)" ]; then \ - echo "ERROR: the symlink $@ points to asm-$$asmlink but asm-$(SRCARCH) was expected"; \ - echo " set ARCH or save .config and run 'make mrproper' to fix it"; \ - exit 1; \ - fi; \ - else \ - echo ' SYMLINK $@ -> include/asm-$(SRCARCH)'; \ - if [ ! -d include ]; then \ - mkdir -p include; \ - fi; \ - ln -fsn asm-$(SRCARCH) $@; \ - fi +# FIXME: The asm symlink changes when $(ARCH) changes. That's +# hard to detect, but I suppose "make mrproper" is a good idea +# before switching between archs anyway. + +include/asm: + @echo ' SYMLINK $@ -> include/asm-$(SRCARCH)' + $(Q)if [ ! -d include ]; then mkdir -p include; fi; + @ln -fsn asm-$(SRCARCH) $@ # Generate some files # --------------------------------------------------------------------------- @@ -1030,12 +1023,19 @@ _modinst_: fi $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst -# This depmod is only for convenience to give the initial +# If System.map exists, run depmod. This deliberately does not have a +# dependency on System.map since that would run the dependency tree on +# vmlinux. This depmod is only for convenience to give the initial # boot a modules.dep even before / is mounted read-write. However the # boot script depmod is the master version. +ifeq "$(strip $(INSTALL_MOD_PATH))" "" +depmod_opts := +else +depmod_opts := -b $(INSTALL_MOD_PATH) -r +endif PHONY += _modinst_post _modinst_post: _modinst_ - $(call cmd,depmod) + if [ -r System.map -a -x $(DEPMOD) ]; then $(DEPMOD) -ae -F System.map $(depmod_opts) $(KERNELRELEASE); fi else # CONFIG_MODULES @@ -1223,7 +1223,8 @@ else # KBUILD_EXTMOD KBUILD_MODULES := 1 PHONY += crmodverdir crmodverdir: - $(cmd_crmodverdir) + $(Q)mkdir -p $(MODVERDIR) + $(Q)rm -f $(MODVERDIR)/* PHONY += $(objtree)/Module.symvers $(objtree)/Module.symvers: @@ -1251,6 +1252,15 @@ _emodinst_: $(Q)mkdir -p $(MODLIB)/$(install-dir) $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst +# Run depmod only is we have System.map and depmod is executable +quiet_cmd_depmod = DEPMOD $(KERNELRELEASE) + cmd_depmod = if [ -r System.map -a -x $(DEPMOD) ]; then \ + $(DEPMOD) -ae -F System.map \ + $(if $(strip $(INSTALL_MOD_PATH)), \ + -b $(INSTALL_MOD_PATH) -r) \ + $(KERNELRELEASE); \ + fi + PHONY += _emodinst_post _emodinst_post: _emodinst_ $(call cmd,depmod) @@ -1334,7 +1344,7 @@ define find-sources find $(__srctree)include/asm-generic $(RCS_FIND_IGNORE) \ -name $1 -print; \ find $(__srctree) $(RCS_FIND_IGNORE) \ - \( -name include -o -name arch -o -name '.tmp_*' \) -prune -o \ + \( -name include -o -name arch \) -prune -o \ -name $1 -print; \ ) endef @@ -1483,11 +1493,9 @@ endif # Modules / %/: prepare scripts FORCE - $(cmd_crmodverdir) $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \ $(build)=$(build-dir) %.ko: prepare scripts FORCE - $(cmd_crmodverdir) $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \ $(build)=$(build-dir) $(@:.ko=.o) $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost @@ -1501,19 +1509,6 @@ quiet_cmd_rmdirs = $(if $(wildcard $(rm-dirs)),CLEAN $(wildcard $(rm-dirs))) quiet_cmd_rmfiles = $(if $(wildcard $(rm-files)),CLEAN $(wildcard $(rm-files))) cmd_rmfiles = rm -f $(rm-files) -# Run depmod only is we have System.map and depmod is executable -# and we build for the host arch -quiet_cmd_depmod = DEPMOD $(KERNELRELEASE) - cmd_depmod = \ - if [ -r System.map -a -x $(DEPMOD) -a "$(SUBARCH)" == "$(ARCH)" ]; then \ - $(DEPMOD) -ae -F System.map \ - $(if $(strip $(INSTALL_MOD_PATH)), -b $(INSTALL_MOD_PATH) -r) \ - $(KERNELRELEASE); \ - fi - -# Create temporary dir for module support files -cmd_crmodverdir = $(Q)mkdir -p $(MODVERDIR); rm -f $(MODVERDIR)/* - a_flags = -Wp,-MD,$(depfile) $(KBUILD_AFLAGS) $(AFLAGS_KERNEL) \ $(NOSTDINC_FLAGS) $(KBUILD_CPPFLAGS) \ diff --git a/trunk/arch/i386/Kconfig b/trunk/arch/i386/Kconfig index d1bedbf9deb8..d0a4ea1ba14d 100644 --- a/trunk/arch/i386/Kconfig +++ b/trunk/arch/i386/Kconfig @@ -1080,7 +1080,7 @@ config APM_REAL_MODE_POWER_OFF endif # APM -source "arch/x86/kernel/cpu/cpufreq/Kconfig_32" +source "arch/x86/kernel/cpu/cpufreq/Kconfig" source "drivers/cpuidle/Kconfig" diff --git a/trunk/arch/i386/Makefile b/trunk/arch/i386/Makefile index b88e47ca3032..f036d2dee3de 100644 --- a/trunk/arch/i386/Makefile +++ b/trunk/arch/i386/Makefile @@ -102,7 +102,7 @@ core-$(CONFIG_XEN) += arch/x86/xen/ # default subarch .h files mflags-y += -Iinclude/asm-x86/mach-default -head-y := arch/x86/kernel/head_32.o arch/x86/kernel/init_task.o +head-y := arch/x86/kernel/head_32.o arch/x86/kernel/init_task_32.o libs-y += arch/x86/lib/ core-y += arch/x86/kernel/ \ @@ -131,9 +131,9 @@ all: bzImage zImage zlilo zdisk: KBUILD_IMAGE := arch/x86/boot/zImage zImage bzImage: vmlinux - $(Q)$(MAKE) $(build)=$(boot) $(KBUILD_IMAGE) $(Q)mkdir -p $(objtree)/arch/i386/boot - $(Q)ln -fsn ../../x86/boot/bzImage $(objtree)/arch/i386/boot/bzImage + $(Q)ln -fsn $(objtree)/arch/x86/boot/bzImage $(objtree)/arch/i386/boot/bzImage + $(Q)$(MAKE) $(build)=$(boot) $(KBUILD_IMAGE) compressed: zImage diff --git a/trunk/arch/x86/ia32/ia32_binfmt.c b/trunk/arch/x86/ia32/ia32_binfmt.c index 55822d2cf053..5027650eb273 100644 --- a/trunk/arch/x86/ia32/ia32_binfmt.c +++ b/trunk/arch/x86/ia32/ia32_binfmt.c @@ -5,6 +5,10 @@ * This tricks binfmt_elf.c into loading 32bit binaries using lots * of ugly preprocessor tricks. Talk about very very poor man's inheritance. */ +#define __ASM_X86_64_ELF_H 1 + +#undef ELF_CLASS +#define ELF_CLASS ELFCLASS32 #include #include @@ -15,7 +19,6 @@ #include #include #include -#include #include #include @@ -28,20 +31,6 @@ #include #include -#undef ELF_ARCH -#undef ELF_CLASS -#define ELF_CLASS ELFCLASS32 -#define ELF_ARCH EM_386 - -#undef elfhdr -#undef elf_phdr -#undef elf_note -#undef elf_addr_t -#define elfhdr elf32_hdr -#define elf_phdr elf32_phdr -#define elf_note elf32_note -#define elf_addr_t Elf32_Off - #define ELF_NAME "elf/i386" #define AT_SYSINFO 32 @@ -59,20 +48,74 @@ int sysctl_vsyscall32 = 1; } while(0) struct file; +struct elf_phdr; #define IA32_EMULATOR 1 -#undef ELF_ET_DYN_BASE - #define ELF_ET_DYN_BASE (TASK_UNMAPPED_BASE + 0x1000000) +#undef ELF_ARCH +#define ELF_ARCH EM_386 + +#define ELF_DATA ELFDATA2LSB + +#define USE_ELF_CORE_DUMP 1 + +/* Override elfcore.h */ +#define _LINUX_ELFCORE_H 1 +typedef unsigned int elf_greg_t; + +#define ELF_NGREG (sizeof (struct user_regs_struct32) / sizeof(elf_greg_t)) +typedef elf_greg_t elf_gregset_t[ELF_NGREG]; + +struct elf_siginfo +{ + int si_signo; /* signal number */ + int si_code; /* extra code */ + int si_errno; /* errno */ +}; + #define jiffies_to_timeval(a,b) do { (b)->tv_usec = 0; (b)->tv_sec = (a)/HZ; }while(0) +struct elf_prstatus +{ + struct elf_siginfo pr_info; /* Info associated with signal */ + short pr_cursig; /* Current signal */ + unsigned int pr_sigpend; /* Set of pending signals */ + unsigned int pr_sighold; /* Set of held signals */ + pid_t pr_pid; + pid_t pr_ppid; + pid_t pr_pgrp; + pid_t pr_sid; + struct compat_timeval pr_utime; /* User time */ + struct compat_timeval pr_stime; /* System time */ + struct compat_timeval pr_cutime; /* Cumulative user time */ + struct compat_timeval pr_cstime; /* Cumulative system time */ + elf_gregset_t pr_reg; /* GP registers */ + int pr_fpvalid; /* True if math co-processor being used. */ +}; + +#define ELF_PRARGSZ (80) /* Number of chars for args */ + +struct elf_prpsinfo +{ + char pr_state; /* numeric process state */ + char pr_sname; /* char for pr_state */ + char pr_zomb; /* zombie */ + char pr_nice; /* nice val */ + unsigned int pr_flag; /* flags */ + __u16 pr_uid; + __u16 pr_gid; + pid_t pr_pid, pr_ppid, pr_pgrp, pr_sid; + /* Lots missing */ + char pr_fname[16]; /* filename of executable */ + char pr_psargs[ELF_PRARGSZ]; /* initial part of arg list */ +}; + #define _GET_SEG(x) \ ({ __u32 seg; asm("movl %%" __stringify(x) ",%0" : "=r"(seg)); seg; }) /* Assumes current==process to be dumped */ -#undef ELF_CORE_COPY_REGS #define ELF_CORE_COPY_REGS(pr_reg, regs) \ pr_reg[0] = regs->rbx; \ pr_reg[1] = regs->rcx; \ @@ -92,41 +135,36 @@ struct file; pr_reg[15] = regs->rsp; \ pr_reg[16] = regs->ss; - -#define elf_prstatus compat_elf_prstatus -#define elf_prpsinfo compat_elf_prpsinfo -#define elf_fpregset_t struct user_i387_ia32_struct -#define elf_fpxregset_t struct user32_fxsr_struct -#define user user32 +#define user user32 #undef elf_read_implies_exec #define elf_read_implies_exec(ex, executable_stack) (executable_stack != EXSTACK_DISABLE_X) +//#include +#include + +typedef struct user_i387_ia32_struct elf_fpregset_t; +typedef struct user32_fxsr_struct elf_fpxregset_t; + -#define elf_core_copy_regs elf32_core_copy_regs -static inline void elf32_core_copy_regs(compat_elf_gregset_t *elfregs, - struct pt_regs *regs) +static inline void elf_core_copy_regs(elf_gregset_t *elfregs, struct pt_regs *regs) { - ELF_CORE_COPY_REGS((&elfregs->ebx), regs) + ELF_CORE_COPY_REGS((*elfregs), regs) } -#define elf_core_copy_task_regs elf32_core_copy_task_regs -static inline int elf32_core_copy_task_regs(struct task_struct *t, - compat_elf_gregset_t* elfregs) +static inline int elf_core_copy_task_regs(struct task_struct *t, elf_gregset_t* elfregs) { struct pt_regs *pp = task_pt_regs(t); - ELF_CORE_COPY_REGS((&elfregs->ebx), pp); + ELF_CORE_COPY_REGS((*elfregs), pp); /* fix wrong segments */ - elfregs->ds = t->thread.ds; - elfregs->fs = t->thread.fsindex; - elfregs->gs = t->thread.gsindex; - elfregs->es = t->thread.es; + (*elfregs)[7] = t->thread.ds; + (*elfregs)[9] = t->thread.fsindex; + (*elfregs)[10] = t->thread.gsindex; + (*elfregs)[8] = t->thread.es; return 1; } -#define elf_core_copy_task_fpregs elf32_core_copy_task_fpregs static inline int -elf32_core_copy_task_fpregs(struct task_struct *tsk, struct pt_regs *regs, - elf_fpregset_t *fpu) +elf_core_copy_task_fpregs(struct task_struct *tsk, struct pt_regs *regs, elf_fpregset_t *fpu) { struct _fpstate_ia32 *fpstate = (void*)fpu; mm_segment_t oldfs = get_fs(); @@ -148,9 +186,8 @@ elf32_core_copy_task_fpregs(struct task_struct *tsk, struct pt_regs *regs, #define ELF_CORE_COPY_XFPREGS 1 #define ELF_CORE_XFPREG_TYPE NT_PRXFPREG -#define elf_core_copy_task_xfpregs elf32_core_copy_task_xfpregs static inline int -elf32_core_copy_task_xfpregs(struct task_struct *t, elf_fpxregset_t *xfpu) +elf_core_copy_task_xfpregs(struct task_struct *t, elf_fpxregset_t *xfpu) { struct pt_regs *regs = task_pt_regs(t); if (!tsk_used_math(t)) @@ -169,10 +206,6 @@ elf32_core_copy_task_xfpregs(struct task_struct *t, elf_fpxregset_t *xfpu) extern int force_personality32; -#undef ELF_EXEC_PAGESIZE -#undef ELF_HWCAP -#undef ELF_PLATFORM -#undef SET_PERSONALITY #define ELF_EXEC_PAGESIZE PAGE_SIZE #define ELF_HWCAP (boot_cpu_data.x86_capability[0]) #define ELF_PLATFORM ("i686") @@ -198,7 +231,6 @@ do { \ #define load_elf_binary load_elf32_binary -#undef ELF_PLAT_INIT #define ELF_PLAT_INIT(r, load_addr) elf32_init(r) #undef start_thread diff --git a/trunk/arch/x86/kernel/Makefile_32 b/trunk/arch/x86/kernel/Makefile_32 index ccea590bbb92..a3fa11f8f460 100644 --- a/trunk/arch/x86/kernel/Makefile_32 +++ b/trunk/arch/x86/kernel/Makefile_32 @@ -2,7 +2,7 @@ # Makefile for the linux kernel. # -extra-y := head_32.o init_task.o vmlinux.lds +extra-y := head_32.o init_task_32.o vmlinux.lds 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 \ @@ -17,7 +17,6 @@ obj-$(CONFIG_MCA) += mca_32.o obj-$(CONFIG_X86_MSR) += msr.o obj-$(CONFIG_X86_CPUID) += cpuid.o obj-$(CONFIG_MICROCODE) += microcode.o -obj-$(CONFIG_PCI) += early-quirks.o obj-$(CONFIG_APM) += apm_32.o obj-$(CONFIG_X86_SMP) += smp_32.o smpboot_32.o tsc_sync.o obj-$(CONFIG_SMP) += smpcommon_32.o diff --git a/trunk/arch/x86/kernel/Makefile_64 b/trunk/arch/x86/kernel/Makefile_64 index dec06e769281..43da66213a47 100644 --- a/trunk/arch/x86/kernel/Makefile_64 +++ b/trunk/arch/x86/kernel/Makefile_64 @@ -2,7 +2,7 @@ # Makefile for the linux kernel. # -extra-y := head_64.o head64.o init_task.o vmlinux.lds +extra-y := head_64.o head64.o init_task_64.o vmlinux.lds EXTRA_AFLAGS := -traditional 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 \ @@ -39,7 +39,7 @@ obj-$(CONFIG_K8_NB) += k8.o obj-$(CONFIG_AUDIT) += audit_64.o obj-$(CONFIG_MODULES) += module_64.o -obj-$(CONFIG_PCI) += early-quirks.o +obj-$(CONFIG_PCI) += early-quirks_64.o obj-y += topology.o obj-y += intel_cacheinfo.o diff --git a/trunk/arch/x86/kernel/acpi/Makefile_32 b/trunk/arch/x86/kernel/acpi/Makefile_32 index 045dd54b33e0..a4852a2e9190 100644 --- a/trunk/arch/x86/kernel/acpi/Makefile_32 +++ b/trunk/arch/x86/kernel/acpi/Makefile_32 @@ -1,4 +1,7 @@ obj-$(CONFIG_ACPI) += boot.o +ifneq ($(CONFIG_PCI),) +obj-$(CONFIG_X86_IO_APIC) += earlyquirk_32.o +endif obj-$(CONFIG_ACPI_SLEEP) += sleep_32.o wakeup_32.o ifneq ($(CONFIG_ACPI_PROCESSOR),) diff --git a/trunk/arch/x86/kernel/acpi/boot.c b/trunk/arch/x86/kernel/acpi/boot.c index f28b2e251b1d..afd2afe9102d 100644 --- a/trunk/arch/x86/kernel/acpi/boot.c +++ b/trunk/arch/x86/kernel/acpi/boot.c @@ -555,7 +555,7 @@ EXPORT_SYMBOL(acpi_map_lsapic); int acpi_unmap_lsapic(int cpu) { - per_cpu(x86_cpu_to_apicid, cpu) = -1; + x86_cpu_to_apicid[cpu] = -1; cpu_clear(cpu, cpu_present_map); num_processors--; diff --git a/trunk/arch/x86/kernel/acpi/cstate.c b/trunk/arch/x86/kernel/acpi/cstate.c index 10b67170b133..2d39f55d29a8 100644 --- a/trunk/arch/x86/kernel/acpi/cstate.c +++ b/trunk/arch/x86/kernel/acpi/cstate.c @@ -29,7 +29,7 @@ void acpi_processor_power_init_bm_check(struct acpi_processor_flags *flags, unsigned int cpu) { - struct cpuinfo_x86 *c = &cpu_data(cpu); + struct cpuinfo_x86 *c = cpu_data + cpu; flags->bm_check = 0; if (num_online_cpus() == 1) @@ -72,7 +72,7 @@ int acpi_processor_ffh_cstate_probe(unsigned int cpu, struct acpi_processor_cx *cx, struct acpi_power_register *reg) { struct cstate_entry *percpu_entry; - struct cpuinfo_x86 *c = &cpu_data(cpu); + struct cpuinfo_x86 *c = cpu_data + cpu; cpumask_t saved_mask; int retval; diff --git a/trunk/arch/x86/kernel/acpi/earlyquirk_32.c b/trunk/arch/x86/kernel/acpi/earlyquirk_32.c new file mode 100644 index 000000000000..23f78efc577d --- /dev/null +++ b/trunk/arch/x86/kernel/acpi/earlyquirk_32.c @@ -0,0 +1,84 @@ +/* + * Do early PCI probing for bug detection when the main PCI subsystem is + * not up yet. + */ +#include +#include +#include +#include + +#include +#include +#include + +#ifdef CONFIG_ACPI + +static int __init nvidia_hpet_check(struct acpi_table_header *header) +{ + return 0; +} +#endif + +static int __init check_bridge(int vendor, int device) +{ +#ifdef CONFIG_ACPI + static int warned; + /* According to Nvidia all timer overrides are bogus unless HPET + is enabled. */ + if (!acpi_use_timer_override && vendor == PCI_VENDOR_ID_NVIDIA) { + if (!warned && acpi_table_parse(ACPI_SIG_HPET, + nvidia_hpet_check)) { + warned = 1; + acpi_skip_timer_override = 1; + printk(KERN_INFO "Nvidia board " + "detected. Ignoring ACPI " + "timer override.\n"); + printk(KERN_INFO "If you got timer trouble " + "try acpi_use_timer_override\n"); + + } + } +#endif + if (vendor == PCI_VENDOR_ID_ATI && timer_over_8254 == 1) { + timer_over_8254 = 0; + printk(KERN_INFO "ATI board detected. Disabling timer routing " + "over 8254.\n"); + } + return 0; +} + +void __init check_acpi_pci(void) +{ + int num, slot, func; + + /* Assume the machine supports type 1. If not it will + always read ffffffff and should not have any side effect. + Actually a few buggy systems can machine check. Allow the user + to disable it by command line option at least -AK */ + if (!early_pci_allowed()) + return; + + /* Poor man's PCI discovery */ + for (num = 0; num < 32; num++) { + for (slot = 0; slot < 32; slot++) { + for (func = 0; func < 8; func++) { + u32 class; + u32 vendor; + class = read_pci_config(num, slot, func, + PCI_CLASS_REVISION); + if (class == 0xffffffff) + break; + + if ((class >> 16) != PCI_CLASS_BRIDGE_PCI) + continue; + + vendor = read_pci_config(num, slot, func, + PCI_VENDOR_ID); + + if (check_bridge(vendor & 0xffff, vendor >> 16)) + return; + } + + } + } +} diff --git a/trunk/arch/x86/kernel/acpi/processor.c b/trunk/arch/x86/kernel/acpi/processor.c index 2ed0a4ce62f0..b54fded49834 100644 --- a/trunk/arch/x86/kernel/acpi/processor.c +++ b/trunk/arch/x86/kernel/acpi/processor.c @@ -63,7 +63,7 @@ static void init_intel_pdc(struct acpi_processor *pr, struct cpuinfo_x86 *c) void arch_acpi_processor_init_pdc(struct acpi_processor *pr) { unsigned int cpu = pr->id; - struct cpuinfo_x86 *c = &cpu_data(cpu); + struct cpuinfo_x86 *c = cpu_data + cpu; pr->pdc = NULL; if (c->x86_vendor == X86_VENDOR_INTEL) diff --git a/trunk/arch/x86/kernel/alternative.c b/trunk/arch/x86/kernel/alternative.c index d6405e0842b5..3bd2688bd443 100644 --- a/trunk/arch/x86/kernel/alternative.c +++ b/trunk/arch/x86/kernel/alternative.c @@ -357,14 +357,14 @@ void alternatives_smp_switch(int smp) if (smp) { printk(KERN_INFO "SMP alternatives: switching to SMP code\n"); clear_bit(X86_FEATURE_UP, boot_cpu_data.x86_capability); - clear_bit(X86_FEATURE_UP, cpu_data(0).x86_capability); + clear_bit(X86_FEATURE_UP, cpu_data[0].x86_capability); list_for_each_entry(mod, &smp_alt_modules, next) alternatives_smp_lock(mod->locks, mod->locks_end, mod->text, mod->text_end); } else { printk(KERN_INFO "SMP alternatives: switching to UP code\n"); set_bit(X86_FEATURE_UP, boot_cpu_data.x86_capability); - set_bit(X86_FEATURE_UP, cpu_data(0).x86_capability); + set_bit(X86_FEATURE_UP, cpu_data[0].x86_capability); list_for_each_entry(mod, &smp_alt_modules, next) alternatives_smp_unlock(mod->locks, mod->locks_end, mod->text, mod->text_end); @@ -432,7 +432,7 @@ void __init alternative_instructions(void) if (1 == num_possible_cpus()) { printk(KERN_INFO "SMP alternatives: switching to UP code\n"); set_bit(X86_FEATURE_UP, boot_cpu_data.x86_capability); - set_bit(X86_FEATURE_UP, cpu_data(0).x86_capability); + set_bit(X86_FEATURE_UP, cpu_data[0].x86_capability); alternatives_smp_unlock(__smp_locks, __smp_locks_end, _text, _etext); } diff --git a/trunk/arch/x86/kernel/cpu/cpufreq/Kconfig_32 b/trunk/arch/x86/kernel/cpu/cpufreq/Kconfig similarity index 100% rename from trunk/arch/x86/kernel/cpu/cpufreq/Kconfig_32 rename to trunk/arch/x86/kernel/cpu/cpufreq/Kconfig diff --git a/trunk/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c b/trunk/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c index fea0af0476b9..2ca43ba32bc0 100644 --- a/trunk/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c +++ b/trunk/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c @@ -77,7 +77,7 @@ static unsigned int acpi_pstate_strict; static int check_est_cpu(unsigned int cpuid) { - struct cpuinfo_x86 *cpu = &cpu_data(cpuid); + struct cpuinfo_x86 *cpu = &cpu_data[cpuid]; if (cpu->x86_vendor != X86_VENDOR_INTEL || !cpu_has(cpu, X86_FEATURE_EST)) @@ -560,7 +560,7 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy) unsigned int cpu = policy->cpu; struct acpi_cpufreq_data *data; unsigned int result = 0; - struct cpuinfo_x86 *c = &cpu_data(policy->cpu); + struct cpuinfo_x86 *c = &cpu_data[policy->cpu]; struct acpi_processor_performance *perf; dprintk("acpi_cpufreq_cpu_init\n"); diff --git a/trunk/arch/x86/kernel/cpu/cpufreq/e_powersaver.c b/trunk/arch/x86/kernel/cpu/cpufreq/e_powersaver.c index 326a4c81f684..c11baaf9f2b4 100644 --- a/trunk/arch/x86/kernel/cpu/cpufreq/e_powersaver.c +++ b/trunk/arch/x86/kernel/cpu/cpufreq/e_powersaver.c @@ -305,7 +305,7 @@ static struct cpufreq_driver eps_driver = { static int __init eps_init(void) { - struct cpuinfo_x86 *c = &cpu_data(0); + struct cpuinfo_x86 *c = cpu_data; /* This driver will work only on Centaur C7 processors with * Enhanced SpeedStep/PowerSaver registers */ diff --git a/trunk/arch/x86/kernel/cpu/cpufreq/elanfreq.c b/trunk/arch/x86/kernel/cpu/cpufreq/elanfreq.c index 94619c22f563..1e7ae7dafcf6 100644 --- a/trunk/arch/x86/kernel/cpu/cpufreq/elanfreq.c +++ b/trunk/arch/x86/kernel/cpu/cpufreq/elanfreq.c @@ -199,7 +199,7 @@ static int elanfreq_target (struct cpufreq_policy *policy, static int elanfreq_cpu_init(struct cpufreq_policy *policy) { - struct cpuinfo_x86 *c = &cpu_data(0); + struct cpuinfo_x86 *c = cpu_data; unsigned int i; int result; @@ -280,7 +280,7 @@ static struct cpufreq_driver elanfreq_driver = { static int __init elanfreq_init(void) { - struct cpuinfo_x86 *c = &cpu_data(0); + struct cpuinfo_x86 *c = cpu_data; /* Test if we have the right hardware */ if ((c->x86_vendor != X86_VENDOR_AMD) || diff --git a/trunk/arch/x86/kernel/cpu/cpufreq/longhaul.c b/trunk/arch/x86/kernel/cpu/cpufreq/longhaul.c index 749d00cb2ebd..5045f5d583c8 100644 --- a/trunk/arch/x86/kernel/cpu/cpufreq/longhaul.c +++ b/trunk/arch/x86/kernel/cpu/cpufreq/longhaul.c @@ -780,7 +780,7 @@ static int longhaul_setup_southbridge(void) static int __init longhaul_cpu_init(struct cpufreq_policy *policy) { - struct cpuinfo_x86 *c = &cpu_data(0); + struct cpuinfo_x86 *c = cpu_data; char *cpuname=NULL; int ret; u32 lo, hi; @@ -959,7 +959,7 @@ static struct cpufreq_driver longhaul_driver = { static int __init longhaul_init(void) { - struct cpuinfo_x86 *c = &cpu_data(0); + struct cpuinfo_x86 *c = cpu_data; if (c->x86_vendor != X86_VENDOR_CENTAUR || c->x86 != 6) return -ENODEV; diff --git a/trunk/arch/x86/kernel/cpu/cpufreq/longrun.c b/trunk/arch/x86/kernel/cpu/cpufreq/longrun.c index af4a867a097c..b2689514295a 100644 --- a/trunk/arch/x86/kernel/cpu/cpufreq/longrun.c +++ b/trunk/arch/x86/kernel/cpu/cpufreq/longrun.c @@ -172,7 +172,7 @@ static unsigned int __init longrun_determine_freqs(unsigned int *low_freq, u32 save_lo, save_hi; u32 eax, ebx, ecx, edx; u32 try_hi; - struct cpuinfo_x86 *c = &cpu_data(0); + struct cpuinfo_x86 *c = cpu_data; if (!low_freq || !high_freq) return -EINVAL; @@ -298,7 +298,7 @@ static struct cpufreq_driver longrun_driver = { */ static int __init longrun_init(void) { - struct cpuinfo_x86 *c = &cpu_data(0); + struct cpuinfo_x86 *c = cpu_data; if (c->x86_vendor != X86_VENDOR_TRANSMETA || !cpu_has(c, X86_FEATURE_LONGRUN)) diff --git a/trunk/arch/x86/kernel/cpu/cpufreq/p4-clockmod.c b/trunk/arch/x86/kernel/cpu/cpufreq/p4-clockmod.c index 14791ec55cfd..793eae854f4f 100644 --- a/trunk/arch/x86/kernel/cpu/cpufreq/p4-clockmod.c +++ b/trunk/arch/x86/kernel/cpu/cpufreq/p4-clockmod.c @@ -195,7 +195,7 @@ static unsigned int cpufreq_p4_get_frequency(struct cpuinfo_x86 *c) static int cpufreq_p4_cpu_init(struct cpufreq_policy *policy) { - struct cpuinfo_x86 *c = &cpu_data(policy->cpu); + struct cpuinfo_x86 *c = &cpu_data[policy->cpu]; int cpuid = 0; unsigned int i; @@ -279,7 +279,7 @@ static struct cpufreq_driver p4clockmod_driver = { static int __init cpufreq_p4_init(void) { - struct cpuinfo_x86 *c = &cpu_data(0); + struct cpuinfo_x86 *c = cpu_data; int ret; /* diff --git a/trunk/arch/x86/kernel/cpu/cpufreq/powernow-k6.c b/trunk/arch/x86/kernel/cpu/cpufreq/powernow-k6.c index 42405b4e34ed..6d0285339317 100644 --- a/trunk/arch/x86/kernel/cpu/cpufreq/powernow-k6.c +++ b/trunk/arch/x86/kernel/cpu/cpufreq/powernow-k6.c @@ -215,7 +215,7 @@ static struct cpufreq_driver powernow_k6_driver = { */ static int __init powernow_k6_init(void) { - struct cpuinfo_x86 *c = &cpu_data(0); + struct cpuinfo_x86 *c = cpu_data; if ((c->x86_vendor != X86_VENDOR_AMD) || (c->x86 != 5) || ((c->x86_model != 12) && (c->x86_model != 13))) diff --git a/trunk/arch/x86/kernel/cpu/cpufreq/powernow-k7.c b/trunk/arch/x86/kernel/cpu/cpufreq/powernow-k7.c index b5a9863d6cdc..f3686a5f2308 100644 --- a/trunk/arch/x86/kernel/cpu/cpufreq/powernow-k7.c +++ b/trunk/arch/x86/kernel/cpu/cpufreq/powernow-k7.c @@ -114,7 +114,7 @@ static int check_fsb(unsigned int fsbspeed) static int check_powernow(void) { - struct cpuinfo_x86 *c = &cpu_data(0); + struct cpuinfo_x86 *c = cpu_data; unsigned int maxei, eax, ebx, ecx, edx; if ((c->x86_vendor != X86_VENDOR_AMD) || (c->x86 !=6)) { diff --git a/trunk/arch/x86/kernel/cpu/cpufreq/sc520_freq.c b/trunk/arch/x86/kernel/cpu/cpufreq/sc520_freq.c index 42da9bd677d6..d9f3e90a7ae0 100644 --- a/trunk/arch/x86/kernel/cpu/cpufreq/sc520_freq.c +++ b/trunk/arch/x86/kernel/cpu/cpufreq/sc520_freq.c @@ -102,7 +102,7 @@ static int sc520_freq_target (struct cpufreq_policy *policy, static int sc520_freq_cpu_init(struct cpufreq_policy *policy) { - struct cpuinfo_x86 *c = &cpu_data(0); + struct cpuinfo_x86 *c = cpu_data; int result; /* capability check */ @@ -151,7 +151,7 @@ static struct cpufreq_driver sc520_freq_driver = { static int __init sc520_freq_init(void) { - struct cpuinfo_x86 *c = &cpu_data(0); + struct cpuinfo_x86 *c = cpu_data; int err; /* Test if we have the right hardware */ diff --git a/trunk/arch/x86/kernel/cpu/cpufreq/speedstep-centrino.c b/trunk/arch/x86/kernel/cpu/cpufreq/speedstep-centrino.c index 3031f1196192..811d47438546 100644 --- a/trunk/arch/x86/kernel/cpu/cpufreq/speedstep-centrino.c +++ b/trunk/arch/x86/kernel/cpu/cpufreq/speedstep-centrino.c @@ -230,7 +230,7 @@ static struct cpu_model models[] = static int centrino_cpu_init_table(struct cpufreq_policy *policy) { - struct cpuinfo_x86 *cpu = &cpu_data(policy->cpu); + struct cpuinfo_x86 *cpu = &cpu_data[policy->cpu]; struct cpu_model *model; for(model = models; model->cpu_id != NULL; model++) @@ -340,7 +340,7 @@ static unsigned int get_cur_freq(unsigned int cpu) static int centrino_cpu_init(struct cpufreq_policy *policy) { - struct cpuinfo_x86 *cpu = &cpu_data(policy->cpu); + struct cpuinfo_x86 *cpu = &cpu_data[policy->cpu]; unsigned freq; unsigned l, h; int ret; @@ -612,7 +612,7 @@ static struct cpufreq_driver centrino_driver = { */ static int __init centrino_init(void) { - struct cpuinfo_x86 *cpu = &cpu_data(0); + struct cpuinfo_x86 *cpu = cpu_data; if (!cpu_has(cpu, X86_FEATURE_EST)) return -ENODEV; diff --git a/trunk/arch/x86/kernel/cpu/cpufreq/speedstep-lib.c b/trunk/arch/x86/kernel/cpu/cpufreq/speedstep-lib.c index 76c3ab0da468..b1acc8ce3167 100644 --- a/trunk/arch/x86/kernel/cpu/cpufreq/speedstep-lib.c +++ b/trunk/arch/x86/kernel/cpu/cpufreq/speedstep-lib.c @@ -228,7 +228,7 @@ EXPORT_SYMBOL_GPL(speedstep_get_processor_frequency); unsigned int speedstep_detect_processor (void) { - struct cpuinfo_x86 *c = &cpu_data(0); + struct cpuinfo_x86 *c = cpu_data; u32 ebx, msr_lo, msr_hi; dprintk("x86: %x, model: %x\n", c->x86, c->x86_model); diff --git a/trunk/arch/x86/kernel/cpu/intel_cacheinfo.c b/trunk/arch/x86/kernel/cpu/intel_cacheinfo.c index 9921b01fe199..297a24116949 100644 --- a/trunk/arch/x86/kernel/cpu/intel_cacheinfo.c +++ b/trunk/arch/x86/kernel/cpu/intel_cacheinfo.c @@ -295,7 +295,7 @@ unsigned int __cpuinit init_intel_cacheinfo(struct cpuinfo_x86 *c) unsigned int new_l2 = 0, new_l3 = 0, i; /* Cache sizes from cpuid(4) */ unsigned int l2_id = 0, l3_id = 0, num_threads_sharing, index_msb; #ifdef CONFIG_X86_HT - unsigned int cpu = c->cpu_index; + unsigned int cpu = (c == &boot_cpu_data) ? 0 : (c - cpu_data); #endif if (c->cpuid_level > 3) { @@ -417,14 +417,14 @@ unsigned int __cpuinit init_intel_cacheinfo(struct cpuinfo_x86 *c) if (new_l2) { l2 = new_l2; #ifdef CONFIG_X86_HT - per_cpu(cpu_llc_id, cpu) = l2_id; + cpu_llc_id[cpu] = l2_id; #endif } if (new_l3) { l3 = new_l3; #ifdef CONFIG_X86_HT - per_cpu(cpu_llc_id, cpu) = l3_id; + cpu_llc_id[cpu] = l3_id; #endif } @@ -459,7 +459,7 @@ static void __cpuinit cache_shared_cpu_map_setup(unsigned int cpu, int index) struct _cpuid4_info *this_leaf, *sibling_leaf; unsigned long num_threads_sharing; int index_msb, i; - struct cpuinfo_x86 *c = &cpu_data(cpu); + struct cpuinfo_x86 *c = cpu_data; this_leaf = CPUID4_INFO_IDX(cpu, index); num_threads_sharing = 1 + this_leaf->eax.split.num_threads_sharing; @@ -470,8 +470,8 @@ static void __cpuinit cache_shared_cpu_map_setup(unsigned int cpu, int index) index_msb = get_count_order(num_threads_sharing); for_each_online_cpu(i) { - if (cpu_data(i).apicid >> index_msb == - c->apicid >> index_msb) { + if (c[i].apicid >> index_msb == + c[cpu].apicid >> index_msb) { cpu_set(i, this_leaf->shared_cpu_map); if (i != cpu && cpuid4_info[i]) { sibling_leaf = CPUID4_INFO_IDX(i, index); diff --git a/trunk/arch/x86/kernel/cpu/perfctr-watchdog.c b/trunk/arch/x86/kernel/cpu/perfctr-watchdog.c index c02541e6e653..54cdbf1a40f1 100644 --- a/trunk/arch/x86/kernel/cpu/perfctr-watchdog.c +++ b/trunk/arch/x86/kernel/cpu/perfctr-watchdog.c @@ -120,9 +120,7 @@ int reserve_perfctr_nmi(unsigned int msr) unsigned int counter; counter = nmi_perfctr_msr_to_bit(msr); - /* register not managed by the allocator? */ - if (counter > NMI_MAX_COUNTER_BITS) - return 1; + BUG_ON(counter > NMI_MAX_COUNTER_BITS); if (!test_and_set_bit(counter, perfctr_nmi_owner)) return 1; @@ -134,9 +132,7 @@ void release_perfctr_nmi(unsigned int msr) unsigned int counter; counter = nmi_perfctr_msr_to_bit(msr); - /* register not managed by the allocator? */ - if (counter > NMI_MAX_COUNTER_BITS) - return; + BUG_ON(counter > NMI_MAX_COUNTER_BITS); clear_bit(counter, perfctr_nmi_owner); } @@ -146,9 +142,7 @@ int reserve_evntsel_nmi(unsigned int msr) unsigned int counter; counter = nmi_evntsel_msr_to_bit(msr); - /* register not managed by the allocator? */ - if (counter > NMI_MAX_COUNTER_BITS) - return 1; + BUG_ON(counter > NMI_MAX_COUNTER_BITS); if (!test_and_set_bit(counter, evntsel_nmi_owner)) return 1; @@ -160,9 +154,7 @@ void release_evntsel_nmi(unsigned int msr) unsigned int counter; counter = nmi_evntsel_msr_to_bit(msr); - /* register not managed by the allocator? */ - if (counter > NMI_MAX_COUNTER_BITS) - return; + BUG_ON(counter > NMI_MAX_COUNTER_BITS); clear_bit(counter, evntsel_nmi_owner); } diff --git a/trunk/arch/x86/kernel/cpu/proc.c b/trunk/arch/x86/kernel/cpu/proc.c index 2d42b414b777..879a0f789b1e 100644 --- a/trunk/arch/x86/kernel/cpu/proc.c +++ b/trunk/arch/x86/kernel/cpu/proc.c @@ -85,13 +85,12 @@ static int show_cpuinfo(struct seq_file *m, void *v) /* nothing */ }; struct cpuinfo_x86 *c = v; - int i, n = 0; + int i, n = c - cpu_data; int fpu_exception; #ifdef CONFIG_SMP if (!cpu_online(n)) return 0; - n = c->cpu_index; #endif seq_printf(m, "processor\t: %d\n" "vendor_id\t: %s\n" @@ -176,15 +175,11 @@ static int show_cpuinfo(struct seq_file *m, void *v) static void *c_start(struct seq_file *m, loff_t *pos) { - if (*pos == 0) /* just in case, cpu 0 is not the first */ - *pos = first_cpu(cpu_possible_map); - if ((*pos) < NR_CPUS && cpu_possible(*pos)) - return &cpu_data(*pos); - return NULL; + return *pos < NR_CPUS ? cpu_data + *pos : NULL; } static void *c_next(struct seq_file *m, void *v, loff_t *pos) { - *pos = next_cpu(*pos, cpu_possible_map); + ++*pos; return c_start(m, pos); } static void c_stop(struct seq_file *m, void *v) diff --git a/trunk/arch/x86/kernel/cpu/cpufreq/Kconfig_64 b/trunk/arch/x86/kernel/cpufreq/Kconfig similarity index 97% rename from trunk/arch/x86/kernel/cpu/cpufreq/Kconfig_64 rename to trunk/arch/x86/kernel/cpufreq/Kconfig index 9c9699fdcf52..a3fd51926cbd 100644 --- a/trunk/arch/x86/kernel/cpu/cpufreq/Kconfig_64 +++ b/trunk/arch/x86/kernel/cpufreq/Kconfig @@ -19,7 +19,7 @@ config X86_POWERNOW_K8 To compile this driver as a module, choose M here: the module will be called powernow-k8. - For details, take a look at . + For details, take a look at . If in doubt, say N. diff --git a/trunk/arch/x86/kernel/cpuid.c b/trunk/arch/x86/kernel/cpuid.c index 05c9936a16cc..70dcf912d9fb 100644 --- a/trunk/arch/x86/kernel/cpuid.c +++ b/trunk/arch/x86/kernel/cpuid.c @@ -114,7 +114,7 @@ static ssize_t cpuid_read(struct file *file, char __user *buf, static int cpuid_open(struct inode *inode, struct file *file) { unsigned int cpu = iminor(file->f_path.dentry->d_inode); - struct cpuinfo_x86 *c = &cpu_data(cpu); + struct cpuinfo_x86 *c = &(cpu_data)[cpu]; if (cpu >= NR_CPUS || !cpu_online(cpu)) return -ENXIO; /* No such CPU */ @@ -134,18 +134,15 @@ static const struct file_operations cpuid_fops = { .open = cpuid_open, }; -static __cpuinit int cpuid_device_create(int cpu) +static int __cpuinit cpuid_device_create(int i) { + int err = 0; struct device *dev; - dev = device_create(cpuid_class, NULL, MKDEV(CPUID_MAJOR, cpu), - "cpu%d", cpu); - return IS_ERR(dev) ? PTR_ERR(dev) : 0; -} - -static void cpuid_device_destroy(int cpu) -{ - device_destroy(cpuid_class, MKDEV(CPUID_MAJOR, cpu)); + dev = device_create(cpuid_class, NULL, MKDEV(CPUID_MAJOR, i), "cpu%d",i); + if (IS_ERR(dev)) + err = PTR_ERR(dev); + return err; } static int __cpuinit cpuid_class_cpu_callback(struct notifier_block *nfb, @@ -153,21 +150,18 @@ static int __cpuinit cpuid_class_cpu_callback(struct notifier_block *nfb, void *hcpu) { unsigned int cpu = (unsigned long)hcpu; - int err = 0; switch (action) { - case CPU_UP_PREPARE: - case CPU_UP_PREPARE_FROZEN: - err = cpuid_device_create(cpu); + case CPU_ONLINE: + case CPU_ONLINE_FROZEN: + cpuid_device_create(cpu); break; - case CPU_UP_CANCELED: - case CPU_UP_CANCELED_FROZEN: case CPU_DEAD: case CPU_DEAD_FROZEN: - cpuid_device_destroy(cpu); + device_destroy(cpuid_class, MKDEV(CPUID_MAJOR, cpu)); break; } - return err ? NOTIFY_BAD : NOTIFY_OK; + return NOTIFY_OK; } static struct notifier_block __cpuinitdata cpuid_class_cpu_notifier = @@ -204,7 +198,7 @@ static int __init cpuid_init(void) out_class: i = 0; for_each_online_cpu(i) { - cpuid_device_destroy(i); + device_destroy(cpuid_class, MKDEV(CPUID_MAJOR, i)); } class_destroy(cpuid_class); out_chrdev: @@ -218,7 +212,7 @@ static void __exit cpuid_exit(void) int cpu = 0; for_each_online_cpu(cpu) - cpuid_device_destroy(cpu); + device_destroy(cpuid_class, MKDEV(CPUID_MAJOR, cpu)); class_destroy(cpuid_class); unregister_chrdev(CPUID_MAJOR, "cpu/cpuid"); unregister_hotcpu_notifier(&cpuid_class_cpu_notifier); diff --git a/trunk/arch/x86/kernel/early-quirks.c b/trunk/arch/x86/kernel/early-quirks_64.c similarity index 88% rename from trunk/arch/x86/kernel/early-quirks.c rename to trunk/arch/x86/kernel/early-quirks_64.c index dc34acbd54aa..13aa4fd728f3 100644 --- a/trunk/arch/x86/kernel/early-quirks.c +++ b/trunk/arch/x86/kernel/early-quirks_64.c @@ -13,13 +13,9 @@ #include #include #include -#include -#include -#include - -#ifdef CONFIG_IOMMU +#include #include -#endif +#include static void __init via_bugs(void) { @@ -27,8 +23,7 @@ static void __init via_bugs(void) if ((end_pfn > MAX_DMA32_PFN || force_iommu) && !iommu_aperture_allowed) { printk(KERN_INFO - "Looks like a VIA chipset. Disabling IOMMU." - " Override with iommu=allowed\n"); + "Looks like a VIA chipset. Disabling IOMMU. Override with iommu=allowed\n"); iommu_aperture_disabled = 1; } #endif @@ -45,7 +40,6 @@ static int __init nvidia_hpet_check(struct acpi_table_header *header) static void __init nvidia_bugs(void) { #ifdef CONFIG_ACPI -#ifdef CONFIG_X86_IO_APIC /* * All timer overrides on Nvidia are * wrong unless HPET is enabled. @@ -64,7 +58,6 @@ static void __init nvidia_bugs(void) printk(KERN_INFO "If you got timer trouble " "try acpi_use_timer_override\n"); } -#endif #endif /* RED-PEN skip them on mptables too? */ @@ -72,13 +65,11 @@ static void __init nvidia_bugs(void) static void __init ati_bugs(void) { -#ifdef CONFIG_X86_IO_APIC if (timer_over_8254 == 1) { timer_over_8254 = 0; printk(KERN_INFO - "ATI board detected. Disabling timer routing over 8254.\n"); + "ATI board detected. Disabling timer routing over 8254.\n"); } -#endif } struct chipset { @@ -113,7 +104,7 @@ void __init early_quirks(void) if (class == 0xffffffff) break; - if ((class >> 16) != PCI_CLASS_BRIDGE_PCI) + if ((class >> 16) != PCI_CLASS_BRIDGE_PCI) continue; vendor = read_pci_config(num, slot, func, diff --git a/trunk/arch/x86/kernel/genapic_64.c b/trunk/arch/x86/kernel/genapic_64.c index ce703e21c912..4ae03e3e8294 100644 --- a/trunk/arch/x86/kernel/genapic_64.c +++ b/trunk/arch/x86/kernel/genapic_64.c @@ -24,19 +24,10 @@ #include #endif -/* - * which logical CPU number maps to which CPU (physical APIC ID) - * - * The following static array is used during kernel startup - * and the x86_cpu_to_apicid_ptr contains the address of the - * array during this time. Is it zeroed when the per_cpu - * data area is removed. - */ -u8 x86_cpu_to_apicid_init[NR_CPUS] __initdata +/* which logical CPU number maps to which CPU (physical APIC ID) */ +u8 x86_cpu_to_apicid[NR_CPUS] __read_mostly = { [0 ... NR_CPUS-1] = BAD_APICID }; -void *x86_cpu_to_apicid_ptr; -DEFINE_PER_CPU(u8, x86_cpu_to_apicid) = BAD_APICID; -EXPORT_PER_CPU_SYMBOL(x86_cpu_to_apicid); +EXPORT_SYMBOL(x86_cpu_to_apicid); struct genapic __read_mostly *genapic = &apic_flat; diff --git a/trunk/arch/x86/kernel/genapic_flat_64.c b/trunk/arch/x86/kernel/genapic_flat_64.c index 07352b74bda6..91c7526768ee 100644 --- a/trunk/arch/x86/kernel/genapic_flat_64.c +++ b/trunk/arch/x86/kernel/genapic_flat_64.c @@ -172,7 +172,7 @@ static unsigned int physflat_cpu_mask_to_apicid(cpumask_t cpumask) */ cpu = first_cpu(cpumask); if ((unsigned)cpu < NR_CPUS) - return per_cpu(x86_cpu_to_apicid, cpu); + return x86_cpu_to_apicid[cpu]; else return BAD_APICID; } diff --git a/trunk/arch/x86/kernel/head64.c b/trunk/arch/x86/kernel/head64.c index 6b3469311e42..a7eee0a4751d 100644 --- a/trunk/arch/x86/kernel/head64.c +++ b/trunk/arch/x86/kernel/head64.c @@ -58,7 +58,7 @@ void __init x86_64_start_kernel(char * real_mode_data) for (i = 0; i < IDT_ENTRIES; i++) set_intr_gate(i, early_idt_handler); - load_idt((const struct desc_ptr *)&idt_descr); + asm volatile("lidt %0" :: "m" (idt_descr)); early_printk("Kernel alive\n"); diff --git a/trunk/arch/x86/kernel/hpet.c b/trunk/arch/x86/kernel/hpet.c index 22d8f00c80dc..f8367074da0d 100644 --- a/trunk/arch/x86/kernel/hpet.c +++ b/trunk/arch/x86/kernel/hpet.c @@ -69,15 +69,12 @@ static inline void hpet_clear_mapping(void) * HPET command line enable / disable */ static int boot_hpet_disable; -int hpet_force_user; static int __init hpet_setup(char* str) { if (str) { if (!strncmp("disable", str, 7)) boot_hpet_disable = 1; - if (!strncmp("force", str, 5)) - hpet_force_user = 1; } return 1; } diff --git a/trunk/arch/x86/kernel/i8259_32.c b/trunk/arch/x86/kernel/i8259_32.c index f634fc715c99..d34a10cc13a7 100644 --- a/trunk/arch/x86/kernel/i8259_32.c +++ b/trunk/arch/x86/kernel/i8259_32.c @@ -403,8 +403,7 @@ void __init native_init_IRQ(void) int vector = FIRST_EXTERNAL_VECTOR + i; if (i >= NR_IRQS) break; - /* SYSCALL_VECTOR was reserved in trap_init. */ - if (!test_bit(vector, used_vectors)) + if (vector != SYSCALL_VECTOR) set_intr_gate(vector, interrupt[i]); } diff --git a/trunk/arch/x86/kernel/init_task.c b/trunk/arch/x86/kernel/init_task_32.c similarity index 79% rename from trunk/arch/x86/kernel/init_task.c rename to trunk/arch/x86/kernel/init_task_32.c index 468c9c437842..d26fc063a760 100644 --- a/trunk/arch/x86/kernel/init_task.c +++ b/trunk/arch/x86/kernel/init_task_32.c @@ -15,6 +15,7 @@ static struct files_struct init_files = INIT_FILES; static struct signal_struct init_signals = INIT_SIGNALS(init_signals); static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); struct mm_struct init_mm = INIT_MM(init_mm); + EXPORT_SYMBOL(init_mm); /* @@ -24,7 +25,7 @@ EXPORT_SYMBOL(init_mm); * way process stacks are handled. This is done by having a special * "init_task" linker map entry.. */ -union thread_union init_thread_union +union thread_union init_thread_union __attribute__((__section__(".data.init_task"))) = { INIT_THREAD_INFO(init_task) }; @@ -34,14 +35,12 @@ union thread_union init_thread_union * All other task structs will be allocated on slabs in fork.c */ struct task_struct init_task = INIT_TASK(init_task); + EXPORT_SYMBOL(init_task); /* * per-CPU TSS segments. Threads are completely 'soft' on Linux, - * no more per-task TSS's. The TSS size is kept cacheline-aligned - * so they are allowed to end up in the .data.cacheline_aligned - * section. Since TSS's are completely CPU-local, we want them - * on exact cacheline boundaries, to eliminate cacheline ping-pong. - */ + * no more per-task TSS's. + */ DEFINE_PER_CPU_SHARED_ALIGNED(struct tss_struct, init_tss) = INIT_TSS; diff --git a/trunk/arch/x86/kernel/init_task_64.c b/trunk/arch/x86/kernel/init_task_64.c new file mode 100644 index 000000000000..4ff33d4f8551 --- /dev/null +++ b/trunk/arch/x86/kernel/init_task_64.c @@ -0,0 +1,54 @@ +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +static struct fs_struct init_fs = INIT_FS; +static struct files_struct init_files = INIT_FILES; +static struct signal_struct init_signals = INIT_SIGNALS(init_signals); +static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); +struct mm_struct init_mm = INIT_MM(init_mm); + +EXPORT_SYMBOL(init_mm); + +/* + * Initial task structure. + * + * We need to make sure that this is 8192-byte aligned due to the + * way process stacks are handled. This is done by having a special + * "init_task" linker map entry.. + */ +union thread_union init_thread_union + __attribute__((__section__(".data.init_task"))) = + { INIT_THREAD_INFO(init_task) }; + +/* + * Initial task structure. + * + * All other task structs will be allocated on slabs in fork.c + */ +struct task_struct init_task = INIT_TASK(init_task); + +EXPORT_SYMBOL(init_task); +/* + * per-CPU TSS segments. Threads are completely 'soft' on Linux, + * no more per-task TSS's. The TSS size is kept cacheline-aligned + * so they are allowed to end up in the .data.cacheline_aligned + * section. Since TSS's are completely CPU-local, we want them + * on exact cacheline boundaries, to eliminate cacheline ping-pong. + */ +DEFINE_PER_CPU_SHARED_ALIGNED(struct tss_struct, init_tss) = INIT_TSS; + +/* Copies of the original ist values from the tss are only accessed during + * debugging, no special alignment required. + */ +DEFINE_PER_CPU(struct orig_ist, orig_ist); + +#define ALIGN_TO_4K __attribute__((section(".data.init_task"))) diff --git a/trunk/arch/x86/kernel/io_apic_32.c b/trunk/arch/x86/kernel/io_apic_32.c index 0c55e9d86f69..5f10c7189534 100644 --- a/trunk/arch/x86/kernel/io_apic_32.c +++ b/trunk/arch/x86/kernel/io_apic_32.c @@ -1198,7 +1198,7 @@ static u8 irq_vector[NR_IRQ_VECTORS] __read_mostly = { FIRST_DEVICE_VECTOR , 0 } static int __assign_irq_vector(int irq) { static int current_vector = FIRST_DEVICE_VECTOR, current_offset = 0; - int vector, offset; + int vector, offset, i; BUG_ON((unsigned)irq >= NR_IRQ_VECTORS); @@ -1215,8 +1215,11 @@ static int __assign_irq_vector(int irq) } if (vector == current_vector) return -ENOSPC; - if (test_and_set_bit(vector, used_vectors)) + if (vector == SYSCALL_VECTOR) goto next; + for (i = 0; i < NR_IRQ_VECTORS; i++) + if (irq_vector[i] == vector) + goto next; current_vector = vector; current_offset = offset; @@ -2292,12 +2295,6 @@ static inline void __init check_timer(void) void __init setup_IO_APIC(void) { - int i; - - /* Reserve all the system vectors. */ - for (i = FIRST_SYSTEM_VECTOR; i < NR_VECTORS; i++) - set_bit(i, used_vectors); - enable_IO_APIC(); if (acpi_ioapic) diff --git a/trunk/arch/x86/kernel/mce_64.c b/trunk/arch/x86/kernel/mce_64.c index 2cf20de5beca..66e6b797b2cb 100644 --- a/trunk/arch/x86/kernel/mce_64.c +++ b/trunk/arch/x86/kernel/mce_64.c @@ -799,8 +799,7 @@ static __cpuinit int mce_create_device(unsigned int cpu) { int err; int i; - - if (!mce_available(&cpu_data(cpu))) + if (!mce_available(&cpu_data[cpu])) return -EIO; memset(&per_cpu(device_mce, cpu).kobj, 0, sizeof(struct kobject)); diff --git a/trunk/arch/x86/kernel/mce_amd_64.c b/trunk/arch/x86/kernel/mce_amd_64.c index 752fb16a817d..0d2afd96aca4 100644 --- a/trunk/arch/x86/kernel/mce_amd_64.c +++ b/trunk/arch/x86/kernel/mce_amd_64.c @@ -472,11 +472,11 @@ static __cpuinit int threshold_create_bank(unsigned int cpu, unsigned int bank) sprintf(name, "threshold_bank%i", bank); #ifdef CONFIG_SMP - if (cpu_data(cpu).cpu_core_id && shared_bank[bank]) { /* symlink */ + if (cpu_data[cpu].cpu_core_id && shared_bank[bank]) { /* symlink */ i = first_cpu(per_cpu(cpu_core_map, cpu)); /* first core not up yet */ - if (cpu_data(i).cpu_core_id) + if (cpu_data[i].cpu_core_id) goto out; /* already linked */ diff --git a/trunk/arch/x86/kernel/microcode.c b/trunk/arch/x86/kernel/microcode.c index 09c315214a5e..09cf78110358 100644 --- a/trunk/arch/x86/kernel/microcode.c +++ b/trunk/arch/x86/kernel/microcode.c @@ -132,7 +132,7 @@ static struct ucode_cpu_info { static void collect_cpu_info(int cpu_num) { - struct cpuinfo_x86 *c = &cpu_data(cpu_num); + struct cpuinfo_x86 *c = cpu_data + cpu_num; struct ucode_cpu_info *uci = ucode_cpu_info + cpu_num; unsigned int val[2]; @@ -522,7 +522,7 @@ static struct platform_device *microcode_pdev; static int cpu_request_microcode(int cpu) { char name[30]; - struct cpuinfo_x86 *c = &cpu_data(cpu); + struct cpuinfo_x86 *c = cpu_data + cpu; const struct firmware *firmware; void *buf; unsigned long size; @@ -570,7 +570,7 @@ static int cpu_request_microcode(int cpu) static int apply_microcode_check_cpu(int cpu) { - struct cpuinfo_x86 *c = &cpu_data(cpu); + struct cpuinfo_x86 *c = cpu_data + cpu; struct ucode_cpu_info *uci = ucode_cpu_info + cpu; cpumask_t old; unsigned int val[2]; diff --git a/trunk/arch/x86/kernel/mpparse_64.c b/trunk/arch/x86/kernel/mpparse_64.c index ef4aab123581..8bf0ca03ac8e 100644 --- a/trunk/arch/x86/kernel/mpparse_64.c +++ b/trunk/arch/x86/kernel/mpparse_64.c @@ -57,8 +57,6 @@ unsigned long mp_lapic_addr = 0; /* Processor that is doing the boot up */ unsigned int boot_cpu_id = -1U; -EXPORT_SYMBOL(boot_cpu_id); - /* Internal processor count */ unsigned int num_processors __cpuinitdata = 0; @@ -88,7 +86,7 @@ static int __init mpf_checksum(unsigned char *mp, int len) return sum & 0xFF; } -static void __cpuinit MP_processor_info(struct mpc_config_processor *m) +static void __cpuinit MP_processor_info (struct mpc_config_processor *m) { int cpu; cpumask_t tmp_map; @@ -125,18 +123,7 @@ static void __cpuinit MP_processor_info(struct mpc_config_processor *m) cpu = 0; } bios_cpu_apicid[cpu] = m->mpc_apicid; - /* - * We get called early in the the start_kernel initialization - * process when the per_cpu data area is not yet setup, so we - * use a static array that is removed after the per_cpu data - * area is created. - */ - if (x86_cpu_to_apicid_ptr) { - u8 *x86_cpu_to_apicid = (u8 *)x86_cpu_to_apicid_ptr; - x86_cpu_to_apicid[cpu] = m->mpc_apicid; - } else { - per_cpu(x86_cpu_to_apicid, cpu) = m->mpc_apicid; - } + x86_cpu_to_apicid[cpu] = m->mpc_apicid; cpu_set(cpu, cpu_possible_map); cpu_set(cpu, cpu_present_map); diff --git a/trunk/arch/x86/kernel/msr.c b/trunk/arch/x86/kernel/msr.c index ee6eba4ecfea..e18e516cf549 100644 --- a/trunk/arch/x86/kernel/msr.c +++ b/trunk/arch/x86/kernel/msr.c @@ -112,7 +112,7 @@ static ssize_t msr_write(struct file *file, const char __user *buf, static int msr_open(struct inode *inode, struct file *file) { unsigned int cpu = iminor(file->f_path.dentry->d_inode); - struct cpuinfo_x86 *c = &cpu_data(cpu); + struct cpuinfo_x86 *c = &(cpu_data)[cpu]; if (cpu >= NR_CPUS || !cpu_online(cpu)) return -ENXIO; /* No such CPU */ diff --git a/trunk/arch/x86/kernel/pci-dma_64.c b/trunk/arch/x86/kernel/pci-dma_64.c index afaf9f12c032..b2b42bdb0a15 100644 --- a/trunk/arch/x86/kernel/pci-dma_64.c +++ b/trunk/arch/x86/kernel/pci-dma_64.c @@ -11,7 +11,7 @@ #include #include -int iommu_merge __read_mostly = 1; +int iommu_merge __read_mostly = 0; EXPORT_SYMBOL(iommu_merge); dma_addr_t bad_dma_address __read_mostly; diff --git a/trunk/arch/x86/kernel/process_32.c b/trunk/arch/x86/kernel/process_32.c index 7b899584d290..044a47745a5c 100644 --- a/trunk/arch/x86/kernel/process_32.c +++ b/trunk/arch/x86/kernel/process_32.c @@ -295,52 +295,34 @@ static int __init idle_setup(char *str) } early_param("idle", idle_setup); -void __show_registers(struct pt_regs *regs, int all) +void show_regs(struct pt_regs * regs) { unsigned long cr0 = 0L, cr2 = 0L, cr3 = 0L, cr4 = 0L; unsigned long d0, d1, d2, d3, d6, d7; - unsigned long esp; - unsigned short ss, gs; - - if (user_mode_vm(regs)) { - esp = regs->esp; - ss = regs->xss & 0xffff; - savesegment(gs, gs); - } else { - esp = (unsigned long) (®s->esp); - savesegment(ss, ss); - savesegment(gs, gs); - } printk("\n"); - printk("Pid: %d, comm: %s %s (%s %.*s)\n", - task_pid_nr(current), current->comm, - print_tainted(), init_utsname()->release, - (int)strcspn(init_utsname()->version, " "), - init_utsname()->version); - - printk("EIP: %04x:[<%08lx>] EFLAGS: %08lx CPU: %d\n", - 0xffff & regs->xcs, regs->eip, regs->eflags, - smp_processor_id()); + printk("Pid: %d, comm: %20s\n", task_pid_nr(current), current->comm); + printk("EIP: %04x:[<%08lx>] CPU: %d\n",0xffff & regs->xcs,regs->eip, smp_processor_id()); print_symbol("EIP is at %s\n", regs->eip); + if (user_mode_vm(regs)) + printk(" ESP: %04x:%08lx",0xffff & regs->xss,regs->esp); + printk(" EFLAGS: %08lx %s (%s %.*s)\n", + regs->eflags, print_tainted(), init_utsname()->release, + (int)strcspn(init_utsname()->version, " "), + init_utsname()->version); printk("EAX: %08lx EBX: %08lx ECX: %08lx EDX: %08lx\n", - regs->eax, regs->ebx, regs->ecx, regs->edx); - printk("ESI: %08lx EDI: %08lx EBP: %08lx ESP: %08lx\n", - regs->esi, regs->edi, regs->ebp, esp); - printk(" DS: %04x ES: %04x FS: %04x GS: %04x SS: %04x\n", - regs->xds & 0xffff, regs->xes & 0xffff, - regs->xfs & 0xffff, gs, ss); - - if (!all) - return; + regs->eax,regs->ebx,regs->ecx,regs->edx); + printk("ESI: %08lx EDI: %08lx EBP: %08lx", + regs->esi, regs->edi, regs->ebp); + printk(" DS: %04x ES: %04x FS: %04x\n", + 0xffff & regs->xds,0xffff & regs->xes, 0xffff & regs->xfs); cr0 = read_cr0(); cr2 = read_cr2(); cr3 = read_cr3(); cr4 = read_cr4_safe(); - printk("CR0: %08lx CR2: %08lx CR3: %08lx CR4: %08lx\n", - cr0, cr2, cr3, cr4); + printk("CR0: %08lx CR2: %08lx CR3: %08lx CR4: %08lx\n", cr0, cr2, cr3, cr4); get_debugreg(d0, 0); get_debugreg(d1, 1); @@ -348,16 +330,10 @@ void __show_registers(struct pt_regs *regs, int all) get_debugreg(d3, 3); printk("DR0: %08lx DR1: %08lx DR2: %08lx DR3: %08lx\n", d0, d1, d2, d3); - get_debugreg(d6, 6); get_debugreg(d7, 7); - printk("DR6: %08lx DR7: %08lx\n", - d6, d7); -} + printk("DR6: %08lx DR7: %08lx\n", d6, d7); -void show_regs(struct pt_regs *regs) -{ - __show_registers(regs, 1); show_trace(NULL, regs, ®s->esp); } diff --git a/trunk/arch/x86/kernel/quirks.c b/trunk/arch/x86/kernel/quirks.c index a4ce1911efdf..d769e204f942 100644 --- a/trunk/arch/x86/kernel/quirks.c +++ b/trunk/arch/x86/kernel/quirks.c @@ -45,12 +45,9 @@ static void __devinit quirk_intel_irqbalance(struct pci_dev *dev) if (!(config & 0x2)) pci_write_config_byte(dev, 0xf4, config); } -DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_E7320_MCH, - quirk_intel_irqbalance); -DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_E7525_MCH, - quirk_intel_irqbalance); -DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_E7520_MCH, - quirk_intel_irqbalance); +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_E7320_MCH, quirk_intel_irqbalance); +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_E7525_MCH, quirk_intel_irqbalance); +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_E7520_MCH, quirk_intel_irqbalance); #endif #if defined(CONFIG_HPET_TIMER) @@ -59,8 +56,7 @@ unsigned long force_hpet_address; static enum { NONE_FORCE_HPET_RESUME, OLD_ICH_FORCE_HPET_RESUME, - ICH_FORCE_HPET_RESUME, - VT8237_FORCE_HPET_RESUME + ICH_FORCE_HPET_RESUME } force_hpet_resume_type; static void __iomem *rcba_base; @@ -150,17 +146,17 @@ static void ich_force_enable_hpet(struct pci_dev *dev) } DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ESB2_0, - ich_force_enable_hpet); + ich_force_enable_hpet); DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_1, - ich_force_enable_hpet); + ich_force_enable_hpet); DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH7_0, - ich_force_enable_hpet); + ich_force_enable_hpet); DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH7_1, - ich_force_enable_hpet); + ich_force_enable_hpet); DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH7_31, - ich_force_enable_hpet); + ich_force_enable_hpet); DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH8_1, - ich_force_enable_hpet); + ich_force_enable_hpet); static struct pci_dev *cached_dev; @@ -236,91 +232,10 @@ static void old_ich_force_enable_hpet(struct pci_dev *dev) printk(KERN_DEBUG "Failed to force enable HPET\n"); } -/* - * Undocumented chipset features. Make sure that the user enforced - * this. - */ -static void old_ich_force_enable_hpet_user(struct pci_dev *dev) -{ - if (hpet_force_user) - old_ich_force_enable_hpet(dev); -} - -DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801CA_0, - old_ich_force_enable_hpet_user); -DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801CA_12, - old_ich_force_enable_hpet_user); -DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801DB_0, - old_ich_force_enable_hpet_user); -DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801DB_12, - old_ich_force_enable_hpet_user); DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801EB_0, - old_ich_force_enable_hpet); + old_ich_force_enable_hpet); DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801EB_12, - old_ich_force_enable_hpet); - - -static void vt8237_force_hpet_resume(void) -{ - u32 val; - - if (!force_hpet_address || !cached_dev) - return; - - val = 0xfed00000 | 0x80; - pci_write_config_dword(cached_dev, 0x68, val); - - pci_read_config_dword(cached_dev, 0x68, &val); - if (val & 0x80) - printk(KERN_DEBUG "Force enabled HPET at resume\n"); - else - BUG(); -} - -static void vt8237_force_enable_hpet(struct pci_dev *dev) -{ - u32 uninitialized_var(val); - - if (!hpet_force_user || hpet_address || force_hpet_address) - return; - - pci_read_config_dword(dev, 0x68, &val); - /* - * Bit 7 is HPET enable bit. - * Bit 31:10 is HPET base address (contrary to what datasheet claims) - */ - if (val & 0x80) { - force_hpet_address = (val & ~0x3ff); - printk(KERN_DEBUG "HPET at base address 0x%lx\n", - force_hpet_address); - return; - } - - /* - * HPET is disabled. Trying enabling at FED00000 and check - * whether it sticks - */ - val = 0xfed00000 | 0x80; - pci_write_config_dword(dev, 0x68, val); - - pci_read_config_dword(dev, 0x68, &val); - if (val & 0x80) { - force_hpet_address = (val & ~0x3ff); - printk(KERN_DEBUG "Force enabled HPET at base address 0x%lx\n", - force_hpet_address); - cached_dev = dev; - force_hpet_resume_type = VT8237_FORCE_HPET_RESUME; - return; - } - - printk(KERN_DEBUG "Failed to force enable HPET\n"); -} - -DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8235, - vt8237_force_enable_hpet); -DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8237, - vt8237_force_enable_hpet); - + old_ich_force_enable_hpet); void force_hpet_resume(void) { @@ -331,9 +246,6 @@ void force_hpet_resume(void) case OLD_ICH_FORCE_HPET_RESUME: return old_ich_force_hpet_resume(); - case VT8237_FORCE_HPET_RESUME: - return vt8237_force_hpet_resume(); - default: break; } diff --git a/trunk/arch/x86/kernel/reboot_64.c b/trunk/arch/x86/kernel/reboot_64.c index 776eb06b6512..368db2b9c5ac 100644 --- a/trunk/arch/x86/kernel/reboot_64.c +++ b/trunk/arch/x86/kernel/reboot_64.c @@ -11,7 +11,6 @@ #include #include #include -#include #include #include #include @@ -137,7 +136,7 @@ void machine_emergency_restart(void) } case BOOT_TRIPLE: - load_idt((const struct desc_ptr *)&no_idt); + __asm__ __volatile__("lidt (%0)": :"r" (&no_idt)); __asm__ __volatile__("int3"); reboot_type = BOOT_KBD; diff --git a/trunk/arch/x86/kernel/reboot_fixups_32.c b/trunk/arch/x86/kernel/reboot_fixups_32.c index 1a07bbea7be3..8b30b26ad069 100644 --- a/trunk/arch/x86/kernel/reboot_fixups_32.c +++ b/trunk/arch/x86/kernel/reboot_fixups_32.c @@ -12,7 +12,6 @@ #include #include #include -#include static void cs5530a_warm_reset(struct pci_dev *dev) { @@ -25,8 +24,11 @@ static void cs5530a_warm_reset(struct pci_dev *dev) static void cs5536_warm_reset(struct pci_dev *dev) { - /* writing 1 to the LSB of this MSR causes a hard reset */ - wrmsrl(MSR_DIVIL_SOFT_RESET, 1ULL); + /* + * 6.6.2.12 Soft Reset (DIVIL_SOFT_RESET) + * writing 1 to the LSB of this MSR causes a hard reset. + */ + wrmsrl(0x51400017, 1ULL); udelay(50); /* shouldn't get here but be safe and spin a while */ } diff --git a/trunk/arch/x86/kernel/setup64.c b/trunk/arch/x86/kernel/setup64.c index 3558ac78c926..ba9188235057 100644 --- a/trunk/arch/x86/kernel/setup64.c +++ b/trunk/arch/x86/kernel/setup64.c @@ -184,12 +184,6 @@ void __cpuinit check_efer(void) unsigned long kernel_eflags; -/* - * Copies of the original ist values from the tss are only accessed during - * debugging, no special alignment required. - */ -DEFINE_PER_CPU(struct orig_ist, orig_ist); - /* * cpu_init() initializes state that is per-CPU. Some data is already * initialized (naturally) in the bootstrap process, such as the GDT @@ -230,8 +224,8 @@ void __cpuinit cpu_init (void) memcpy(cpu_gdt(cpu), cpu_gdt_table, GDT_SIZE); cpu_gdt_descr[cpu].size = GDT_SIZE; - load_gdt((const struct desc_ptr *)&cpu_gdt_descr[cpu]); - load_idt((const struct desc_ptr *)&idt_descr); + asm volatile("lgdt %0" :: "m" (cpu_gdt_descr[cpu])); + asm volatile("lidt %0" :: "m" (idt_descr)); memset(me->thread.tls_array, 0, GDT_ENTRY_TLS_ENTRIES * 8); syscall_init(); diff --git a/trunk/arch/x86/kernel/setup_32.c b/trunk/arch/x86/kernel/setup_32.c index e4f199124761..978dc0196a0f 100644 --- a/trunk/arch/x86/kernel/setup_32.c +++ b/trunk/arch/x86/kernel/setup_32.c @@ -661,7 +661,9 @@ void __init setup_arch(char **cmdline_p) #endif #ifdef CONFIG_PCI - early_quirks(); +#ifdef CONFIG_X86_IO_APIC + check_acpi_pci(); /* Checks more than just ACPI actually */ +#endif #endif #ifdef CONFIG_ACPI diff --git a/trunk/arch/x86/kernel/setup_64.c b/trunk/arch/x86/kernel/setup_64.c index 31322d42eaae..cdcba6975226 100644 --- a/trunk/arch/x86/kernel/setup_64.c +++ b/trunk/arch/x86/kernel/setup_64.c @@ -302,11 +302,6 @@ void __init setup_arch(char **cmdline_p) dmi_scan_machine(); -#ifdef CONFIG_SMP - /* setup to use the static apicid table during kernel startup */ - x86_cpu_to_apicid_ptr = (void *)&x86_cpu_to_apicid_init; -#endif - #ifdef CONFIG_ACPI /* * Initialize the ACPI boot-time table parser (gets the RSDP and SDT). @@ -559,7 +554,7 @@ static void __init amd_detect_cmp(struct cpuinfo_x86 *c) but in the same order as the HT nodeids. If that doesn't result in a usable node fall back to the path for the previous case. */ - int ht_nodeid = apicid - (cpu_data(0).phys_proc_id << bits); + int ht_nodeid = apicid - (cpu_data[0].phys_proc_id << bits); if (ht_nodeid >= 0 && apicid_to_node[ht_nodeid] != NUMA_NO_NODE) node = apicid_to_node[ht_nodeid]; @@ -883,7 +878,6 @@ void __cpuinit early_identify_cpu(struct cpuinfo_x86 *c) #ifdef CONFIG_SMP c->phys_proc_id = (cpuid_ebx(1) >> 24) & 0xff; - c->cpu_index = 0; #endif } @@ -990,7 +984,6 @@ void __cpuinit print_cpu_info(struct cpuinfo_x86 *c) static int show_cpuinfo(struct seq_file *m, void *v) { struct cpuinfo_x86 *c = v; - int cpu = 0; /* * These flag bits must match the definitions in . @@ -1069,9 +1062,8 @@ static int show_cpuinfo(struct seq_file *m, void *v) #ifdef CONFIG_SMP - if (!cpu_online(c->cpu_index)) + if (!cpu_online(c-cpu_data)) return 0; - cpu = c->cpu_index; #endif seq_printf(m,"processor\t: %u\n" @@ -1079,7 +1071,7 @@ static int show_cpuinfo(struct seq_file *m, void *v) "cpu family\t: %d\n" "model\t\t: %d\n" "model name\t: %s\n", - (unsigned)cpu, + (unsigned)(c-cpu_data), c->x86_vendor_id[0] ? c->x86_vendor_id : "unknown", c->x86, (int)c->x86_model, @@ -1091,7 +1083,7 @@ static int show_cpuinfo(struct seq_file *m, void *v) seq_printf(m, "stepping\t: unknown\n"); if (cpu_has(c,X86_FEATURE_TSC)) { - unsigned int freq = cpufreq_quick_get((unsigned)cpu); + unsigned int freq = cpufreq_quick_get((unsigned)(c-cpu_data)); if (!freq) freq = cpu_khz; seq_printf(m, "cpu MHz\t\t: %u.%03u\n", @@ -1104,6 +1096,7 @@ static int show_cpuinfo(struct seq_file *m, void *v) #ifdef CONFIG_SMP if (smp_num_siblings * c->x86_max_cores > 1) { + int cpu = c - cpu_data; seq_printf(m, "physical id\t: %d\n", c->phys_proc_id); seq_printf(m, "siblings\t: %d\n", cpus_weight(per_cpu(cpu_core_map, cpu))); @@ -1161,16 +1154,12 @@ static int show_cpuinfo(struct seq_file *m, void *v) static void *c_start(struct seq_file *m, loff_t *pos) { - if (*pos == 0) /* just in case, cpu 0 is not the first */ - *pos = first_cpu(cpu_possible_map); - if ((*pos) < NR_CPUS && cpu_possible(*pos)) - return &cpu_data(*pos); - return NULL; + return *pos < NR_CPUS ? cpu_data + *pos : NULL; } static void *c_next(struct seq_file *m, void *v, loff_t *pos) { - *pos = next_cpu(*pos, cpu_possible_map); + ++*pos; return c_start(m, pos); } diff --git a/trunk/arch/x86/kernel/smp_32.c b/trunk/arch/x86/kernel/smp_32.c index 2621ca3b2e4d..791d9f8036ae 100644 --- a/trunk/arch/x86/kernel/smp_32.c +++ b/trunk/arch/x86/kernel/smp_32.c @@ -610,7 +610,7 @@ static void stop_this_cpu (void * dummy) */ cpu_clear(smp_processor_id(), cpu_online_map); disable_local_APIC(); - if (cpu_data(smp_processor_id()).hlt_works_ok) + if (cpu_data[smp_processor_id()].hlt_works_ok) for(;;) halt(); for (;;); } @@ -676,7 +676,7 @@ static int convert_apicid_to_cpu(int apic_id) int i; for (i = 0; i < NR_CPUS; i++) { - if (per_cpu(x86_cpu_to_apicid, i) == apic_id) + if (x86_cpu_to_apicid[i] == apic_id) return i; } return -1; diff --git a/trunk/arch/x86/kernel/smp_64.c b/trunk/arch/x86/kernel/smp_64.c index 03fa6ed559c6..5c2964727d19 100644 --- a/trunk/arch/x86/kernel/smp_64.c +++ b/trunk/arch/x86/kernel/smp_64.c @@ -322,27 +322,17 @@ void unlock_ipi_call_lock(void) } /* - * this function sends a 'generic call function' IPI to all other CPU - * of the system defined in the mask. + * this function sends a 'generic call function' IPI to one other CPU + * in the system. + * + * cpu is a standard Linux logical CPU number. */ - -static int -__smp_call_function_mask(cpumask_t mask, - void (*func)(void *), void *info, - int wait) +static void +__smp_call_function_single(int cpu, void (*func) (void *info), void *info, + int nonatomic, int wait) { struct call_data_struct data; - cpumask_t allbutself; - int cpus; - - allbutself = cpu_online_map; - cpu_clear(smp_processor_id(), allbutself); - - cpus_and(mask, mask, allbutself); - cpus = cpus_weight(mask); - - if (!cpus) - return 0; + int cpus = 1; data.func = func; data.info = info; @@ -353,55 +343,19 @@ __smp_call_function_mask(cpumask_t mask, call_data = &data; wmb(); - - /* Send a message to other CPUs */ - if (cpus_equal(mask, allbutself)) - send_IPI_allbutself(CALL_FUNCTION_VECTOR); - else - send_IPI_mask(mask, CALL_FUNCTION_VECTOR); + /* Send a message to all other CPUs and wait for them to respond */ + send_IPI_mask(cpumask_of_cpu(cpu), CALL_FUNCTION_VECTOR); /* Wait for response */ while (atomic_read(&data.started) != cpus) cpu_relax(); if (!wait) - return 0; + return; while (atomic_read(&data.finished) != cpus) cpu_relax(); - - return 0; -} -/** - * smp_call_function_mask(): Run a function on a set of other CPUs. - * @mask: The set of cpus to run on. Must not include the current cpu. - * @func: The function to run. This must be fast and non-blocking. - * @info: An arbitrary pointer to pass to the function. - * @wait: If true, wait (atomically) until function has completed on other CPUs. - * - * Returns 0 on success, else a negative status code. - * - * If @wait is true, then returns once @func has returned; otherwise - * it returns just before the target cpu calls @func. - * - * You must not call this function with disabled interrupts or from a - * hardware interrupt handler or from a bottom half handler. - */ -int smp_call_function_mask(cpumask_t mask, - void (*func)(void *), void *info, - int wait) -{ - int ret; - - /* Can deadlock when called with interrupts disabled */ - WARN_ON(irqs_disabled()); - - spin_lock(&call_lock); - ret = __smp_call_function_mask(mask, func, info, wait); - spin_unlock(&call_lock); - return ret; } -EXPORT_SYMBOL(smp_call_function_mask); /* * smp_call_function_single - Run a function on a specific CPU @@ -420,7 +374,6 @@ int smp_call_function_single (int cpu, void (*func) (void *info), void *info, int nonatomic, int wait) { /* prevent preemption and reschedule on another processor */ - int ret; int me = get_cpu(); /* Can deadlock when called with interrupts disabled */ @@ -434,13 +387,50 @@ int smp_call_function_single (int cpu, void (*func) (void *info), void *info, return 0; } - ret = smp_call_function_mask(cpumask_of_cpu(cpu), func, info, wait); - + spin_lock(&call_lock); + __smp_call_function_single(cpu, func, info, nonatomic, wait); + spin_unlock(&call_lock); put_cpu(); - return ret; + return 0; } EXPORT_SYMBOL(smp_call_function_single); +/* + * this function sends a 'generic call function' IPI to all other CPUs + * in the system. + */ +static void __smp_call_function (void (*func) (void *info), void *info, + int nonatomic, int wait) +{ + struct call_data_struct data; + int cpus = num_online_cpus()-1; + + if (!cpus) + return; + + data.func = func; + data.info = info; + atomic_set(&data.started, 0); + data.wait = wait; + if (wait) + atomic_set(&data.finished, 0); + + call_data = &data; + wmb(); + /* Send a message to all other CPUs and wait for them to respond */ + send_IPI_allbutself(CALL_FUNCTION_VECTOR); + + /* Wait for response */ + while (atomic_read(&data.started) != cpus) + cpu_relax(); + + if (!wait) + return; + + while (atomic_read(&data.finished) != cpus) + cpu_relax(); +} + /* * smp_call_function - run a function on all other CPUs. * @func: The function to run. This must be fast and non-blocking. @@ -459,7 +449,10 @@ EXPORT_SYMBOL(smp_call_function_single); int smp_call_function (void (*func) (void *info), void *info, int nonatomic, int wait) { - return smp_call_function_mask(cpu_online_map, func, info, wait); + spin_lock(&call_lock); + __smp_call_function(func,info,nonatomic,wait); + spin_unlock(&call_lock); + return 0; } EXPORT_SYMBOL(smp_call_function); @@ -486,7 +479,7 @@ void smp_send_stop(void) /* Don't deadlock on the call lock in panic */ nolock = !spin_trylock(&call_lock); local_irq_save(flags); - __smp_call_function_mask(cpu_online_map, stop_this_cpu, NULL, 0); + __smp_call_function(stop_this_cpu, NULL, 0, 0); if (!nolock) spin_unlock(&call_lock); disable_local_APIC(); diff --git a/trunk/arch/x86/kernel/smpboot_32.c b/trunk/arch/x86/kernel/smpboot_32.c index 7b8fdfa169dd..be3faac04719 100644 --- a/trunk/arch/x86/kernel/smpboot_32.c +++ b/trunk/arch/x86/kernel/smpboot_32.c @@ -67,7 +67,7 @@ int smp_num_siblings = 1; EXPORT_SYMBOL(smp_num_siblings); /* Last level cache ID of each logical CPU */ -DEFINE_PER_CPU(u8, cpu_llc_id) = BAD_APICID; +int cpu_llc_id[NR_CPUS] __cpuinitdata = {[0 ... NR_CPUS-1] = BAD_APICID}; /* representing HT siblings of each logical CPU */ DEFINE_PER_CPU(cpumask_t, cpu_sibling_map); @@ -89,20 +89,12 @@ EXPORT_SYMBOL(cpu_possible_map); static cpumask_t smp_commenced_mask; /* Per CPU bogomips and other parameters */ -DEFINE_PER_CPU_SHARED_ALIGNED(struct cpuinfo_x86, cpu_info); -EXPORT_PER_CPU_SYMBOL(cpu_info); +struct cpuinfo_x86 cpu_data[NR_CPUS] __cacheline_aligned; +EXPORT_SYMBOL(cpu_data); -/* - * The following static array is used during kernel startup - * and the x86_cpu_to_apicid_ptr contains the address of the - * array during this time. Is it zeroed when the per_cpu - * data area is removed. - */ -u8 x86_cpu_to_apicid_init[NR_CPUS] __initdata = - { [0 ... NR_CPUS-1] = BAD_APICID }; -void *x86_cpu_to_apicid_ptr; -DEFINE_PER_CPU(u8, x86_cpu_to_apicid) = BAD_APICID; -EXPORT_PER_CPU_SYMBOL(x86_cpu_to_apicid); +u8 x86_cpu_to_apicid[NR_CPUS] __read_mostly = + { [0 ... NR_CPUS-1] = 0xff }; +EXPORT_SYMBOL(x86_cpu_to_apicid); u8 apicid_2_node[MAX_APICID]; @@ -158,10 +150,9 @@ void __init smp_alloc_memory(void) void __cpuinit smp_store_cpu_info(int id) { - struct cpuinfo_x86 *c = &cpu_data(id); + struct cpuinfo_x86 *c = cpu_data + id; *c = boot_cpu_data; - c->cpu_index = id; if (id!=0) identify_secondary_cpu(c); /* @@ -303,7 +294,7 @@ static int cpucount; /* maps the cpu to the sched domain representing multi-core */ cpumask_t cpu_coregroup_map(int cpu) { - struct cpuinfo_x86 *c = &cpu_data(cpu); + struct cpuinfo_x86 *c = cpu_data + cpu; /* * For perf, we return last level cache shared map. * And for power savings, we return cpu_core_map @@ -320,41 +311,41 @@ static cpumask_t cpu_sibling_setup_map; void __cpuinit set_cpu_sibling_map(int cpu) { int i; - struct cpuinfo_x86 *c = &cpu_data(cpu); + struct cpuinfo_x86 *c = cpu_data; cpu_set(cpu, cpu_sibling_setup_map); if (smp_num_siblings > 1) { for_each_cpu_mask(i, cpu_sibling_setup_map) { - if (c->phys_proc_id == cpu_data(i).phys_proc_id && - c->cpu_core_id == cpu_data(i).cpu_core_id) { + if (c[cpu].phys_proc_id == c[i].phys_proc_id && + c[cpu].cpu_core_id == c[i].cpu_core_id) { cpu_set(i, per_cpu(cpu_sibling_map, cpu)); cpu_set(cpu, per_cpu(cpu_sibling_map, i)); cpu_set(i, per_cpu(cpu_core_map, cpu)); cpu_set(cpu, per_cpu(cpu_core_map, i)); - cpu_set(i, c->llc_shared_map); - cpu_set(cpu, cpu_data(i).llc_shared_map); + cpu_set(i, c[cpu].llc_shared_map); + cpu_set(cpu, c[i].llc_shared_map); } } } else { cpu_set(cpu, per_cpu(cpu_sibling_map, cpu)); } - cpu_set(cpu, c->llc_shared_map); + cpu_set(cpu, c[cpu].llc_shared_map); if (current_cpu_data.x86_max_cores == 1) { per_cpu(cpu_core_map, cpu) = per_cpu(cpu_sibling_map, cpu); - c->booted_cores = 1; + c[cpu].booted_cores = 1; return; } for_each_cpu_mask(i, cpu_sibling_setup_map) { - if (per_cpu(cpu_llc_id, cpu) != BAD_APICID && - per_cpu(cpu_llc_id, cpu) == per_cpu(cpu_llc_id, i)) { - cpu_set(i, c->llc_shared_map); - cpu_set(cpu, cpu_data(i).llc_shared_map); + if (cpu_llc_id[cpu] != BAD_APICID && + cpu_llc_id[cpu] == cpu_llc_id[i]) { + cpu_set(i, c[cpu].llc_shared_map); + cpu_set(cpu, c[i].llc_shared_map); } - if (c->phys_proc_id == cpu_data(i).phys_proc_id) { + if (c[cpu].phys_proc_id == c[i].phys_proc_id) { cpu_set(i, per_cpu(cpu_core_map, cpu)); cpu_set(cpu, per_cpu(cpu_core_map, i)); /* @@ -366,15 +357,15 @@ void __cpuinit set_cpu_sibling_map(int cpu) * the booted_cores for this new cpu */ if (first_cpu(per_cpu(cpu_sibling_map, i)) == i) - c->booted_cores++; + c[cpu].booted_cores++; /* * increment the core count for all * the other cpus in this package */ if (i != cpu) - cpu_data(i).booted_cores++; - } else if (i != cpu && !c->booted_cores) - c->booted_cores = cpu_data(i).booted_cores; + c[i].booted_cores++; + } else if (i != cpu && !c[cpu].booted_cores) + c[cpu].booted_cores = c[i].booted_cores; } } } @@ -813,7 +804,7 @@ static int __cpuinit do_boot_cpu(int apicid, int cpu) irq_ctx_init(cpu); - per_cpu(x86_cpu_to_apicid, cpu) = apicid; + x86_cpu_to_apicid[cpu] = apicid; /* * This grunge runs the startup process for * the targeted processor. @@ -853,7 +844,7 @@ static int __cpuinit do_boot_cpu(int apicid, int cpu) /* number CPUs logically, starting from 1 (BSP is 0) */ Dprintk("OK.\n"); printk("CPU%d: ", cpu); - print_cpu_info(&cpu_data(cpu)); + print_cpu_info(&cpu_data[cpu]); Dprintk("CPU has booted.\n"); } else { boot_error= 1; @@ -875,7 +866,7 @@ static int __cpuinit do_boot_cpu(int apicid, int cpu) cpu_clear(cpu, cpu_initialized); /* was set by cpu_init() */ cpucount--; } else { - per_cpu(x86_cpu_to_apicid, cpu) = apicid; + x86_cpu_to_apicid[cpu] = apicid; cpu_set(cpu, cpu_present_map); } @@ -924,7 +915,7 @@ static int __cpuinit __smp_prepare_cpu(int cpu) struct warm_boot_cpu_info info; int apicid, ret; - apicid = per_cpu(x86_cpu_to_apicid, cpu); + apicid = x86_cpu_to_apicid[cpu]; if (apicid == BAD_APICID) { ret = -ENODEV; goto exit; @@ -970,11 +961,11 @@ static void __init smp_boot_cpus(unsigned int max_cpus) */ smp_store_cpu_info(0); /* Final full version of the data */ printk("CPU%d: ", 0); - print_cpu_info(&cpu_data(0)); + print_cpu_info(&cpu_data[0]); boot_cpu_physical_apicid = GET_APIC_ID(apic_read(APIC_ID)); boot_cpu_logical_apicid = logical_smp_processor_id(); - per_cpu(x86_cpu_to_apicid, 0) = boot_cpu_physical_apicid; + x86_cpu_to_apicid[0] = boot_cpu_physical_apicid; current_thread_info()->cpu = 0; @@ -1017,7 +1008,6 @@ static void __init smp_boot_cpus(unsigned int max_cpus) printk(KERN_ERR "... forcing use of dummy APIC emulation. (tell your hw vendor)\n"); smpboot_clear_io_apic_irqs(); phys_cpu_present_map = physid_mask_of_physid(0); - map_cpu_to_logical_apicid(); cpu_set(0, per_cpu(cpu_sibling_map, 0)); cpu_set(0, per_cpu(cpu_core_map, 0)); return; @@ -1039,7 +1029,6 @@ static void __init smp_boot_cpus(unsigned int max_cpus) } smpboot_clear_io_apic_irqs(); phys_cpu_present_map = physid_mask_of_physid(0); - map_cpu_to_logical_apicid(); cpu_set(0, per_cpu(cpu_sibling_map, 0)); cpu_set(0, per_cpu(cpu_core_map, 0)); return; @@ -1093,7 +1082,7 @@ static void __init smp_boot_cpus(unsigned int max_cpus) Dprintk("Before bogomips.\n"); for (cpu = 0; cpu < NR_CPUS; cpu++) if (cpu_isset(cpu, cpu_callout_map)) - bogosum += cpu_data(cpu).loops_per_jiffy; + bogosum += cpu_data[cpu].loops_per_jiffy; printk(KERN_INFO "Total of %d processors activated (%lu.%02lu BogoMIPS).\n", cpucount+1, @@ -1163,7 +1152,7 @@ void __init native_smp_prepare_boot_cpu(void) void remove_siblinginfo(int cpu) { int sibling; - struct cpuinfo_x86 *c = &cpu_data(cpu); + struct cpuinfo_x86 *c = cpu_data; for_each_cpu_mask(sibling, per_cpu(cpu_core_map, cpu)) { cpu_clear(cpu, per_cpu(cpu_core_map, sibling)); @@ -1171,15 +1160,15 @@ void remove_siblinginfo(int cpu) * last thread sibling in this cpu core going down */ if (cpus_weight(per_cpu(cpu_sibling_map, cpu)) == 1) - cpu_data(sibling).booted_cores--; + c[sibling].booted_cores--; } for_each_cpu_mask(sibling, per_cpu(cpu_sibling_map, cpu)) cpu_clear(cpu, per_cpu(cpu_sibling_map, sibling)); cpus_clear(per_cpu(cpu_sibling_map, cpu)); cpus_clear(per_cpu(cpu_core_map, cpu)); - c->phys_proc_id = 0; - c->cpu_core_id = 0; + c[cpu].phys_proc_id = 0; + c[cpu].cpu_core_id = 0; cpu_clear(cpu, cpu_sibling_setup_map); } diff --git a/trunk/arch/x86/kernel/smpboot_64.c b/trunk/arch/x86/kernel/smpboot_64.c index fd1fff6a35a2..e351ac4ab5b1 100644 --- a/trunk/arch/x86/kernel/smpboot_64.c +++ b/trunk/arch/x86/kernel/smpboot_64.c @@ -65,7 +65,7 @@ int smp_num_siblings = 1; EXPORT_SYMBOL(smp_num_siblings); /* Last level cache ID of each logical CPU */ -DEFINE_PER_CPU(u8, cpu_llc_id) = BAD_APICID; +u8 cpu_llc_id[NR_CPUS] __cpuinitdata = {[0 ... NR_CPUS-1] = BAD_APICID}; /* Bitmask of currently online CPUs */ cpumask_t cpu_online_map __read_mostly; @@ -84,8 +84,8 @@ cpumask_t cpu_possible_map; EXPORT_SYMBOL(cpu_possible_map); /* Per CPU bogomips and other parameters */ -DEFINE_PER_CPU_SHARED_ALIGNED(struct cpuinfo_x86, cpu_info); -EXPORT_PER_CPU_SYMBOL(cpu_info); +struct cpuinfo_x86 cpu_data[NR_CPUS] __cacheline_aligned; +EXPORT_SYMBOL(cpu_data); /* Set when the idlers are all forked */ int smp_threads_ready; @@ -138,10 +138,9 @@ static unsigned long __cpuinit setup_trampoline(void) static void __cpuinit smp_store_cpu_info(int id) { - struct cpuinfo_x86 *c = &cpu_data(id); + struct cpuinfo_x86 *c = cpu_data + id; *c = boot_cpu_data; - c->cpu_index = id; identify_cpu(c); print_cpu_info(c); } @@ -238,7 +237,7 @@ void __cpuinit smp_callin(void) /* maps the cpu to the sched domain representing multi-core */ cpumask_t cpu_coregroup_map(int cpu) { - struct cpuinfo_x86 *c = &cpu_data(cpu); + struct cpuinfo_x86 *c = cpu_data + cpu; /* * For perf, we return last level cache shared map. * And for power savings, we return cpu_core_map @@ -255,41 +254,41 @@ static cpumask_t cpu_sibling_setup_map; static inline void set_cpu_sibling_map(int cpu) { int i; - struct cpuinfo_x86 *c = &cpu_data(cpu); + struct cpuinfo_x86 *c = cpu_data; cpu_set(cpu, cpu_sibling_setup_map); if (smp_num_siblings > 1) { for_each_cpu_mask(i, cpu_sibling_setup_map) { - if (c->phys_proc_id == cpu_data(i).phys_proc_id && - c->cpu_core_id == cpu_data(i).cpu_core_id) { + if (c[cpu].phys_proc_id == c[i].phys_proc_id && + c[cpu].cpu_core_id == c[i].cpu_core_id) { cpu_set(i, per_cpu(cpu_sibling_map, cpu)); cpu_set(cpu, per_cpu(cpu_sibling_map, i)); cpu_set(i, per_cpu(cpu_core_map, cpu)); cpu_set(cpu, per_cpu(cpu_core_map, i)); - cpu_set(i, c->llc_shared_map); - cpu_set(cpu, cpu_data(i).llc_shared_map); + cpu_set(i, c[cpu].llc_shared_map); + cpu_set(cpu, c[i].llc_shared_map); } } } else { cpu_set(cpu, per_cpu(cpu_sibling_map, cpu)); } - cpu_set(cpu, c->llc_shared_map); + cpu_set(cpu, c[cpu].llc_shared_map); if (current_cpu_data.x86_max_cores == 1) { per_cpu(cpu_core_map, cpu) = per_cpu(cpu_sibling_map, cpu); - c->booted_cores = 1; + c[cpu].booted_cores = 1; return; } for_each_cpu_mask(i, cpu_sibling_setup_map) { - if (per_cpu(cpu_llc_id, cpu) != BAD_APICID && - per_cpu(cpu_llc_id, cpu) == per_cpu(cpu_llc_id, i)) { - cpu_set(i, c->llc_shared_map); - cpu_set(cpu, cpu_data(i).llc_shared_map); + if (cpu_llc_id[cpu] != BAD_APICID && + cpu_llc_id[cpu] == cpu_llc_id[i]) { + cpu_set(i, c[cpu].llc_shared_map); + cpu_set(cpu, c[i].llc_shared_map); } - if (c->phys_proc_id == cpu_data(i).phys_proc_id) { + if (c[cpu].phys_proc_id == c[i].phys_proc_id) { cpu_set(i, per_cpu(cpu_core_map, cpu)); cpu_set(cpu, per_cpu(cpu_core_map, i)); /* @@ -301,15 +300,15 @@ static inline void set_cpu_sibling_map(int cpu) * the booted_cores for this new cpu */ if (first_cpu(per_cpu(cpu_sibling_map, i)) == i) - c->booted_cores++; + c[cpu].booted_cores++; /* * increment the core count for all * the other cpus in this package */ if (i != cpu) - cpu_data(i).booted_cores++; - } else if (i != cpu && !c->booted_cores) - c->booted_cores = cpu_data(i).booted_cores; + c[i].booted_cores++; + } else if (i != cpu && !c[cpu].booted_cores) + c[cpu].booted_cores = c[i].booted_cores; } } } @@ -695,7 +694,7 @@ static int __cpuinit do_boot_cpu(int cpu, int apicid) clear_node_cpumask(cpu); /* was set by numa_add_cpu */ cpu_clear(cpu, cpu_present_map); cpu_clear(cpu, cpu_possible_map); - per_cpu(x86_cpu_to_apicid, cpu) = BAD_APICID; + x86_cpu_to_apicid[cpu] = BAD_APICID; return -EIO; } @@ -841,26 +840,6 @@ static int __init smp_sanity_check(unsigned max_cpus) return 0; } -/* - * Copy apicid's found by MP_processor_info from initial array to the per cpu - * data area. The x86_cpu_to_apicid_init array is then expendable and the - * x86_cpu_to_apicid_ptr is zeroed indicating that the static array is no - * longer available. - */ -void __init smp_set_apicids(void) -{ - int cpu; - - for_each_cpu_mask(cpu, cpu_possible_map) { - if (per_cpu_offset(cpu)) - per_cpu(x86_cpu_to_apicid, cpu) = - x86_cpu_to_apicid_init[cpu]; - } - - /* indicate the static array will be going away soon */ - x86_cpu_to_apicid_ptr = NULL; -} - /* * Prepare for SMP bootup. The MP table or ACPI has been read * earlier. Just do some sanity checking here and enable APIC mode. @@ -870,7 +849,6 @@ void __init smp_prepare_cpus(unsigned int max_cpus) nmi_watchdog_default(); current_cpu_data = boot_cpu_data; current_thread_info()->cpu = 0; /* needed? */ - smp_set_apicids(); set_cpu_sibling_map(0); if (smp_sanity_check(max_cpus) < 0) { @@ -990,7 +968,7 @@ void __init smp_cpus_done(unsigned int max_cpus) static void remove_siblinginfo(int cpu) { int sibling; - struct cpuinfo_x86 *c = &cpu_data(cpu); + struct cpuinfo_x86 *c = cpu_data; for_each_cpu_mask(sibling, per_cpu(cpu_core_map, cpu)) { cpu_clear(cpu, per_cpu(cpu_core_map, sibling)); @@ -998,15 +976,15 @@ static void remove_siblinginfo(int cpu) * last thread sibling in this cpu core going down */ if (cpus_weight(per_cpu(cpu_sibling_map, cpu)) == 1) - cpu_data(sibling).booted_cores--; + c[sibling].booted_cores--; } for_each_cpu_mask(sibling, per_cpu(cpu_sibling_map, cpu)) cpu_clear(cpu, per_cpu(cpu_sibling_map, sibling)); cpus_clear(per_cpu(cpu_sibling_map, cpu)); cpus_clear(per_cpu(cpu_core_map, cpu)); - c->phys_proc_id = 0; - c->cpu_core_id = 0; + c[cpu].phys_proc_id = 0; + c[cpu].cpu_core_id = 0; cpu_clear(cpu, cpu_sibling_setup_map); } diff --git a/trunk/arch/x86/kernel/suspend_64.c b/trunk/arch/x86/kernel/suspend_64.c index 622bb0268284..f8fafe527ff1 100644 --- a/trunk/arch/x86/kernel/suspend_64.c +++ b/trunk/arch/x86/kernel/suspend_64.c @@ -32,9 +32,9 @@ void __save_processor_state(struct saved_context *ctxt) /* * descriptor tables */ - store_gdt((struct desc_ptr *)&ctxt->gdt_limit); - store_idt((struct desc_ptr *)&ctxt->idt_limit); - store_tr(ctxt->tr); + asm volatile ("sgdt %0" : "=m" (ctxt->gdt_limit)); + asm volatile ("sidt %0" : "=m" (ctxt->idt_limit)); + asm volatile ("str %0" : "=m" (ctxt->tr)); /* XMM0..XMM15 should be handled by kernel_fpu_begin(). */ /* @@ -91,9 +91,8 @@ void __restore_processor_state(struct saved_context *ctxt) * now restore the descriptor tables to their proper values * ltr is done i fix_processor_context(). */ - load_gdt((const struct desc_ptr *)&ctxt->gdt_limit); - load_idt((const struct desc_ptr *)&ctxt->idt_limit); - + asm volatile ("lgdt %0" :: "m" (ctxt->gdt_limit)); + asm volatile ("lidt %0" :: "m" (ctxt->idt_limit)); /* * segment registers diff --git a/trunk/arch/x86/kernel/traps_32.c b/trunk/arch/x86/kernel/traps_32.c index cc9acace7e23..1e9d57256eb1 100644 --- a/trunk/arch/x86/kernel/traps_32.c +++ b/trunk/arch/x86/kernel/traps_32.c @@ -63,9 +63,6 @@ int panic_on_unrecovered_nmi; -DECLARE_BITMAP(used_vectors, NR_VECTORS); -EXPORT_SYMBOL_GPL(used_vectors); - asmlinkage int system_call(void); /* Do we ignore FPU interrupts ? */ @@ -291,9 +288,33 @@ EXPORT_SYMBOL(dump_stack); void show_registers(struct pt_regs *regs) { int i; - + int in_kernel = 1; + unsigned long esp; + unsigned short ss, gs; + + esp = (unsigned long) (®s->esp); + savesegment(ss, ss); + savesegment(gs, gs); + if (user_mode_vm(regs)) { + in_kernel = 0; + esp = regs->esp; + ss = regs->xss & 0xffff; + } print_modules(); - __show_registers(regs, 0); + printk(KERN_EMERG "CPU: %d\n" + KERN_EMERG "EIP: %04x:[<%08lx>] %s VLI\n" + KERN_EMERG "EFLAGS: %08lx (%s %.*s)\n", + smp_processor_id(), 0xffff & regs->xcs, regs->eip, + print_tainted(), regs->eflags, init_utsname()->release, + (int)strcspn(init_utsname()->version, " "), + init_utsname()->version); + print_symbol(KERN_EMERG "EIP is at %s\n", regs->eip); + printk(KERN_EMERG "eax: %08lx ebx: %08lx ecx: %08lx edx: %08lx\n", + regs->eax, regs->ebx, regs->ecx, regs->edx); + printk(KERN_EMERG "esi: %08lx edi: %08lx ebp: %08lx esp: %08lx\n", + regs->esi, regs->edi, regs->ebp, esp); + printk(KERN_EMERG "ds: %04x es: %04x fs: %04x gs: %04x ss: %04x\n", + regs->xds & 0xffff, regs->xes & 0xffff, regs->xfs & 0xffff, gs, ss); printk(KERN_EMERG "Process %.*s (pid: %d, ti=%p task=%p task.ti=%p)", TASK_COMM_LEN, current->comm, task_pid_nr(current), current_thread_info(), current, task_thread_info(current)); @@ -301,14 +322,14 @@ void show_registers(struct pt_regs *regs) * When in-kernel, we also print out the stack and code at the * time of the fault.. */ - if (!user_mode_vm(regs)) { + if (in_kernel) { u8 *eip; unsigned int code_prologue = code_bytes * 43 / 64; unsigned int code_len = code_bytes; unsigned char c; printk("\n" KERN_EMERG "Stack: "); - show_stack_log_lvl(NULL, regs, ®s->esp, KERN_EMERG); + show_stack_log_lvl(NULL, regs, (unsigned long *)esp, KERN_EMERG); printk(KERN_EMERG "Code: "); @@ -353,11 +374,11 @@ int is_valid_bugaddr(unsigned long eip) void die(const char * str, struct pt_regs * regs, long err) { static struct { - raw_spinlock_t lock; + spinlock_t lock; u32 lock_owner; int lock_owner_depth; } die = { - .lock = __RAW_SPIN_LOCK_UNLOCKED, + .lock = __SPIN_LOCK_UNLOCKED(die.lock), .lock_owner = -1, .lock_owner_depth = 0 }; @@ -368,14 +389,13 @@ void die(const char * str, struct pt_regs * regs, long err) if (die.lock_owner != raw_smp_processor_id()) { console_verbose(); - __raw_spin_lock(&die.lock); - raw_local_save_flags(flags); + spin_lock_irqsave(&die.lock, flags); die.lock_owner = smp_processor_id(); die.lock_owner_depth = 0; bust_spinlocks(1); } else - raw_local_save_flags(flags); + local_save_flags(flags); if (++die.lock_owner_depth < 3) { unsigned long esp; @@ -419,8 +439,7 @@ void die(const char * str, struct pt_regs * regs, long err) bust_spinlocks(0); die.lock_owner = -1; add_taint(TAINT_DIE); - __raw_spin_unlock(&die.lock); - raw_local_irq_restore(flags); + spin_unlock_irqrestore(&die.lock, flags); if (!regs) return; @@ -1123,8 +1142,6 @@ static void __init set_task_gate(unsigned int n, unsigned int gdt_entry) void __init trap_init(void) { - int i; - #ifdef CONFIG_EISA void __iomem *p = ioremap(0x0FFFD9, 4); if (readl(p) == 'E'+('I'<<8)+('S'<<16)+('A'<<24)) { @@ -1184,11 +1201,6 @@ void __init trap_init(void) set_system_gate(SYSCALL_VECTOR,&system_call); - /* Reserve all the builtin and the syscall vector. */ - for (i = 0; i < FIRST_EXTERNAL_VECTOR; i++) - set_bit(i, used_vectors); - set_bit(SYSCALL_VECTOR, used_vectors); - /* * Should be a barrier for any external CPU state. */ diff --git a/trunk/arch/x86/kernel/traps_64.c b/trunk/arch/x86/kernel/traps_64.c index df690c3fa458..b4a9b3db1994 100644 --- a/trunk/arch/x86/kernel/traps_64.c +++ b/trunk/arch/x86/kernel/traps_64.c @@ -462,7 +462,7 @@ void out_of_line_bug(void) EXPORT_SYMBOL(out_of_line_bug); #endif -static raw_spinlock_t die_lock = __RAW_SPIN_LOCK_UNLOCKED; +static DEFINE_SPINLOCK(die_lock); static int die_owner = -1; static unsigned int die_nest_count; @@ -474,13 +474,13 @@ unsigned __kprobes long oops_begin(void) oops_enter(); /* racy, but better than risking deadlock. */ - raw_local_irq_save(flags); + local_irq_save(flags); cpu = smp_processor_id(); - if (!__raw_spin_trylock(&die_lock)) { + if (!spin_trylock(&die_lock)) { if (cpu == die_owner) /* nested oops. should stop eventually */; else - __raw_spin_lock(&die_lock); + spin_lock(&die_lock); } die_nest_count++; die_owner = cpu; @@ -494,10 +494,12 @@ void __kprobes oops_end(unsigned long flags) die_owner = -1; bust_spinlocks(0); die_nest_count--; - if (!die_nest_count) + if (die_nest_count) + /* We still own the lock */ + local_irq_restore(flags); + else /* Nest count reaches zero, release the lock. */ - __raw_spin_unlock(&die_lock); - raw_local_irq_restore(flags); + spin_unlock_irqrestore(&die_lock, flags); if (panic_on_oops) panic("Fatal exception"); oops_exit(); diff --git a/trunk/arch/x86/kernel/tsc_32.c b/trunk/arch/x86/kernel/tsc_32.c index b8a7cf671432..e87a3939ed40 100644 --- a/trunk/arch/x86/kernel/tsc_32.c +++ b/trunk/arch/x86/kernel/tsc_32.c @@ -181,8 +181,8 @@ int recalibrate_cpu_khz(void) if (cpu_has_tsc) { cpu_khz = calculate_cpu_khz(); tsc_khz = cpu_khz; - cpu_data(0).loops_per_jiffy = - cpufreq_scale(cpu_data(0).loops_per_jiffy, + cpu_data[0].loops_per_jiffy = + cpufreq_scale(cpu_data[0].loops_per_jiffy, cpu_khz_old, cpu_khz); return 0; } else @@ -215,7 +215,7 @@ time_cpufreq_notifier(struct notifier_block *nb, unsigned long val, void *data) return 0; } ref_freq = freq->old; - loops_per_jiffy_ref = cpu_data(freq->cpu).loops_per_jiffy; + loops_per_jiffy_ref = cpu_data[freq->cpu].loops_per_jiffy; cpu_khz_ref = cpu_khz; } @@ -223,7 +223,7 @@ time_cpufreq_notifier(struct notifier_block *nb, unsigned long val, void *data) (val == CPUFREQ_POSTCHANGE && freq->old > freq->new) || (val == CPUFREQ_RESUMECHANGE)) { if (!(freq->flags & CPUFREQ_CONST_LOOPS)) - cpu_data(freq->cpu).loops_per_jiffy = + cpu_data[freq->cpu].loops_per_jiffy = cpufreq_scale(loops_per_jiffy_ref, ref_freq, freq->new); diff --git a/trunk/arch/x86/kernel/tsc_64.c b/trunk/arch/x86/kernel/tsc_64.c index 9c70af45b42b..9f22e542c374 100644 --- a/trunk/arch/x86/kernel/tsc_64.c +++ b/trunk/arch/x86/kernel/tsc_64.c @@ -73,13 +73,13 @@ static int time_cpufreq_notifier(struct notifier_block *nb, unsigned long val, struct cpufreq_freqs *freq = data; unsigned long *lpj, dummy; - if (cpu_has(&cpu_data(freq->cpu), X86_FEATURE_CONSTANT_TSC)) + if (cpu_has(&cpu_data[freq->cpu], X86_FEATURE_CONSTANT_TSC)) return 0; lpj = &dummy; if (!(freq->flags & CPUFREQ_CONST_LOOPS)) #ifdef CONFIG_SMP - lpj = &cpu_data(freq->cpu).loops_per_jiffy; + lpj = &cpu_data[freq->cpu].loops_per_jiffy; #else lpj = &boot_cpu_data.loops_per_jiffy; #endif diff --git a/trunk/arch/x86/kernel/vsyscall_64.c b/trunk/arch/x86/kernel/vsyscall_64.c index 78f2250963ae..585541ca1a7e 100644 --- a/trunk/arch/x86/kernel/vsyscall_64.c +++ b/trunk/arch/x86/kernel/vsyscall_64.c @@ -48,7 +48,7 @@ ({unsigned long v; \ extern char __vsyscall_0; \ asm("" : "=r" (v) : "0" (x)); \ - ((v - VSYSCALL_START) + __pa_symbol(&__vsyscall_0)); }) + ((v - VSYSCALL_FIRST_PAGE) + __pa_symbol(&__vsyscall_0)); }) /* * vsyscall_gtod_data contains data that is : @@ -291,7 +291,7 @@ static void __cpuinit vsyscall_set_cpu(int cpu) #ifdef CONFIG_NUMA node = cpu_to_node(cpu); #endif - if (cpu_has(&cpu_data(cpu), X86_FEATURE_RDTSCP)) + if (cpu_has(&cpu_data[cpu], X86_FEATURE_RDTSCP)) write_rdtscp_aux((node << 12) | cpu); /* Store cpu number in limit so that it can be loaded quickly diff --git a/trunk/arch/x86/lib/delay_32.c b/trunk/arch/x86/lib/delay_32.c index 952e7a89c2ac..f6edb11364df 100644 --- a/trunk/arch/x86/lib/delay_32.c +++ b/trunk/arch/x86/lib/delay_32.c @@ -82,7 +82,7 @@ inline void __const_udelay(unsigned long xloops) __asm__("mull %0" :"=d" (xloops), "=&a" (d0) :"1" (xloops), "0" - (cpu_data(raw_smp_processor_id()).loops_per_jiffy * (HZ/4))); + (cpu_data[raw_smp_processor_id()].loops_per_jiffy * (HZ/4))); __delay(++xloops); } diff --git a/trunk/arch/x86/lib/delay_64.c b/trunk/arch/x86/lib/delay_64.c index 0ebbfb9e7c7f..2dbebd308347 100644 --- a/trunk/arch/x86/lib/delay_64.c +++ b/trunk/arch/x86/lib/delay_64.c @@ -40,8 +40,7 @@ EXPORT_SYMBOL(__delay); inline void __const_udelay(unsigned long xloops) { - __delay(((xloops * HZ * - cpu_data(raw_smp_processor_id()).loops_per_jiffy) >> 32) + 1); + __delay(((xloops * HZ * cpu_data[raw_smp_processor_id()].loops_per_jiffy) >> 32) + 1); } EXPORT_SYMBOL(__const_udelay); diff --git a/trunk/arch/x86/mach-voyager/voyager_smp.c b/trunk/arch/x86/mach-voyager/voyager_smp.c index f93a730b44d0..e4928aa6bdfb 100644 --- a/trunk/arch/x86/mach-voyager/voyager_smp.c +++ b/trunk/arch/x86/mach-voyager/voyager_smp.c @@ -36,8 +36,8 @@ static unsigned long cpu_irq_affinity[NR_CPUS] __cacheline_aligned = { [0 ... NR /* per CPU data structure (for /proc/cpuinfo et al), visible externally * indexed physically */ -DEFINE_PER_CPU(cpuinfo_x86, cpu_info) __cacheline_aligned; -EXPORT_PER_CPU_SYMBOL(cpu_info); +struct cpuinfo_x86 cpu_data[NR_CPUS] __cacheline_aligned; +EXPORT_SYMBOL(cpu_data); /* physical ID of the CPU used to boot the system */ unsigned char boot_cpu_id; @@ -430,7 +430,7 @@ find_smp_config(void) void __init smp_store_cpu_info(int id) { - struct cpuinfo_x86 *c = &cpu_data(id); + struct cpuinfo_x86 *c=&cpu_data[id]; *c = boot_cpu_data; @@ -634,7 +634,7 @@ do_boot_cpu(__u8 cpu) cpu, smp_processor_id())); printk("CPU%d: ", cpu); - print_cpu_info(&cpu_data(cpu)); + print_cpu_info(&cpu_data[cpu]); wmb(); cpu_set(cpu, cpu_callout_map); cpu_set(cpu, cpu_present_map); @@ -683,7 +683,7 @@ smp_boot_cpus(void) */ smp_store_cpu_info(boot_cpu_id); printk("CPU%d: ", boot_cpu_id); - print_cpu_info(&cpu_data(boot_cpu_id)); + print_cpu_info(&cpu_data[boot_cpu_id]); if(is_cpu_quad()) { /* booting on a Quad CPU */ @@ -714,7 +714,7 @@ smp_boot_cpus(void) unsigned long bogosum = 0; for (i = 0; i < NR_CPUS; i++) if (cpu_isset(i, cpu_online_map)) - bogosum += cpu_data(i).loops_per_jiffy; + bogosum += cpu_data[i].loops_per_jiffy; printk(KERN_INFO "Total of %d processors activated (%lu.%02lu BogoMIPS).\n", cpucount+1, bogosum/(500000/HZ), diff --git a/trunk/arch/x86/mm/fault_32.c b/trunk/arch/x86/mm/fault_32.c index b695d70e998c..4d3e538c57ab 100644 --- a/trunk/arch/x86/mm/fault_32.c +++ b/trunk/arch/x86/mm/fault_32.c @@ -564,8 +564,7 @@ fastcall void __kprobes do_page_fault(struct pt_regs *regs, * it's allocated already. */ if ((page >> PAGE_SHIFT) < max_low_pfn - && (page & _PAGE_PRESENT) - && !(page & _PAGE_PSE)) { + && (page & _PAGE_PRESENT)) { page &= PAGE_MASK; page = ((__typeof__(page) *) __va(page))[(address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)]; diff --git a/trunk/arch/x86/mm/fault_64.c b/trunk/arch/x86/mm/fault_64.c index 00be7f0a71b2..5149ac136a5d 100644 --- a/trunk/arch/x86/mm/fault_64.c +++ b/trunk/arch/x86/mm/fault_64.c @@ -169,7 +169,7 @@ void dump_pagetable(unsigned long address) pmd = pmd_offset(pud, address); if (bad_address(pmd)) goto bad; printk("PMD %lx ", pmd_val(*pmd)); - if (!pmd_present(*pmd) || pmd_large(*pmd)) goto ret; + if (!pmd_present(*pmd)) goto ret; pte = pte_offset_kernel(pmd, address); if (bad_address(pte)) goto bad; @@ -285,6 +285,7 @@ static int vmalloc_fault(unsigned long address) return 0; } +static int page_fault_trace; int show_unhandled_signals = 1; /* @@ -353,6 +354,10 @@ asmlinkage void __kprobes do_page_fault(struct pt_regs *regs, if (likely(regs->eflags & X86_EFLAGS_IF)) local_irq_enable(); + if (unlikely(page_fault_trace)) + printk("pagefault rip:%lx rsp:%lx cs:%lu ss:%lu address %lx error %lx\n", + regs->rip,regs->rsp,regs->cs,regs->ss,address,error_code); + if (unlikely(error_code & PF_RSVD)) pgtable_bad(address, regs, error_code); @@ -483,7 +488,7 @@ asmlinkage void __kprobes do_page_fault(struct pt_regs *regs, if (show_unhandled_signals && unhandled_signal(tsk, SIGSEGV) && printk_ratelimit()) { printk( - "%s%s[%d]: segfault at %lx rip %lx rsp %lx error %lx\n", + "%s%s[%d]: segfault at %016lx rip %016lx rsp %016lx error %lx\n", tsk->pid > 1 ? KERN_INFO : KERN_EMERG, tsk->comm, tsk->pid, address, regs->rip, regs->rsp, error_code); @@ -616,3 +621,10 @@ void vmalloc_sync_all(void) BUILD_BUG_ON(!(((MODULES_END - 1) & PGDIR_MASK) == (__START_KERNEL & PGDIR_MASK))); } + +static int __init enable_pagefaulttrace(char *str) +{ + page_fault_trace = 1; + return 1; +} +__setup("pagefaulttrace", enable_pagefaulttrace); diff --git a/trunk/arch/x86/mm/numa_64.c b/trunk/arch/x86/mm/numa_64.c index 3d6926ba8995..5eec5e56d07f 100644 --- a/trunk/arch/x86/mm/numa_64.c +++ b/trunk/arch/x86/mm/numa_64.c @@ -612,7 +612,7 @@ void __init init_cpu_to_node(void) { int i; for (i = 0; i < NR_CPUS; i++) { - u8 apicid = x86_cpu_to_apicid_init[i]; + u8 apicid = x86_cpu_to_apicid[i]; if (apicid == BAD_APICID) continue; if (apicid_to_node[apicid] == NUMA_NO_NODE) diff --git a/trunk/arch/x86/oprofile/backtrace.c b/trunk/arch/x86/oprofile/backtrace.c index 0ed046a187f7..c049ce414f01 100644 --- a/trunk/arch/x86/oprofile/backtrace.c +++ b/trunk/arch/x86/oprofile/backtrace.c @@ -13,45 +13,25 @@ #include #include #include -#include -static void backtrace_warning_symbol(void *data, char *msg, - unsigned long symbol) -{ - /* Ignore warnings */ -} - -static void backtrace_warning(void *data, char *msg) -{ - /* Ignore warnings */ -} +struct frame_head { + struct frame_head * ebp; + unsigned long ret; +} __attribute__((packed)); -static int backtrace_stack(void *data, char *name) +static struct frame_head * +dump_kernel_backtrace(struct frame_head * head) { - /* Yes, we want all stacks */ - return 0; -} + oprofile_add_trace(head->ret); -static void backtrace_address(void *data, unsigned long addr) -{ - unsigned int *depth = data; + /* frame pointers should strictly progress back up the stack + * (towards higher addresses) */ + if (head >= head->ebp) + return NULL; - if ((*depth)--) - oprofile_add_trace(addr); + return head->ebp; } -static struct stacktrace_ops backtrace_ops = { - .warning = backtrace_warning, - .warning_symbol = backtrace_warning_symbol, - .stack = backtrace_stack, - .address = backtrace_address, -}; - -struct frame_head { - struct frame_head *ebp; - unsigned long ret; -} __attribute__((packed)); - static struct frame_head * dump_user_backtrace(struct frame_head * head) { @@ -73,16 +53,72 @@ dump_user_backtrace(struct frame_head * head) return bufhead[0].ebp; } +/* + * | | /\ Higher addresses + * | | + * --------------- stack base (address of current_thread_info) + * | thread info | + * . . + * | stack | + * --------------- saved regs->ebp value if valid (frame_head address) + * . . + * --------------- saved regs->rsp value if x86_64 + * | | + * --------------- struct pt_regs * stored on stack if 32-bit + * | | + * . . + * | | + * --------------- %esp + * | | + * | | \/ Lower addresses + * + * Thus, regs (or regs->rsp for x86_64) <-> stack base restricts the + * valid(ish) ebp values. Note: (1) for x86_64, NMI and several other + * exceptions use special stacks, maintained by the interrupt stack table + * (IST). These stacks are set up in trap_init() in + * arch/x86_64/kernel/traps.c. Thus, for x86_64, regs now does not point + * to the kernel stack; instead, it points to some location on the NMI + * stack. On the other hand, regs->rsp is the stack pointer saved when the + * NMI occurred. (2) For 32-bit, regs->esp is not valid because the + * processor does not save %esp on the kernel stack when interrupts occur + * in the kernel mode. + */ +#ifdef CONFIG_FRAME_POINTER +static int valid_kernel_stack(struct frame_head * head, struct pt_regs * regs) +{ + unsigned long headaddr = (unsigned long)head; +#ifdef CONFIG_X86_64 + unsigned long stack = (unsigned long)regs->rsp; +#else + unsigned long stack = (unsigned long)regs; +#endif + unsigned long stack_base = (stack & ~(THREAD_SIZE - 1)) + THREAD_SIZE; + + return headaddr > stack && headaddr < stack_base; +} +#else +/* without fp, it's just junk */ +static int valid_kernel_stack(struct frame_head * head, struct pt_regs * regs) +{ + return 0; +} +#endif + + void x86_backtrace(struct pt_regs * const regs, unsigned int depth) { - struct frame_head *head = (struct frame_head *)frame_pointer(regs); - unsigned long stack = stack_pointer(regs); + struct frame_head *head; + +#ifdef CONFIG_X86_64 + head = (struct frame_head *)regs->rbp; +#else + head = (struct frame_head *)regs->ebp; +#endif if (!user_mode_vm(regs)) { - if (depth) - dump_trace(NULL, regs, (unsigned long *)stack, - &backtrace_ops, &depth); + while (depth-- && valid_kernel_stack(head, regs)) + head = dump_kernel_backtrace(head); return; } diff --git a/trunk/arch/x86_64/.gitignore b/trunk/arch/x86_64/.gitignore deleted file mode 100644 index 36ef4c374d25..000000000000 --- a/trunk/arch/x86_64/.gitignore +++ /dev/null @@ -1 +0,0 @@ -boot diff --git a/trunk/arch/x86_64/Kconfig b/trunk/arch/x86_64/Kconfig index aab25f3ba3ce..25785b23df87 100644 --- a/trunk/arch/x86_64/Kconfig +++ b/trunk/arch/x86_64/Kconfig @@ -723,7 +723,7 @@ config ARCH_HIBERNATION_HEADER source "drivers/acpi/Kconfig" -source "arch/x86/kernel/cpu/cpufreq/Kconfig_64" +source "arch/x86/kernel/cpufreq/Kconfig" source "drivers/cpuidle/Kconfig" @@ -768,9 +768,9 @@ source "fs/Kconfig.binfmt" config IA32_EMULATION bool "IA32 Emulation" help - Include code to run 32-bit programs under a 64-bit kernel. You should - likely turn this on, unless you're 100% sure that you don't have any - 32-bit programs left. + Include code to run 32-bit programs under a 64-bit kernel. You should likely + turn this on, unless you're 100% sure that you don't have any 32-bit programs + left. config IA32_AOUT tristate "IA32 a.out support" diff --git a/trunk/arch/x86_64/Makefile b/trunk/arch/x86_64/Makefile index 6d89ab762ffc..03e1ede27b85 100644 --- a/trunk/arch/x86_64/Makefile +++ b/trunk/arch/x86_64/Makefile @@ -74,7 +74,7 @@ KBUILD_CFLAGS += $(cflags-y) CFLAGS_KERNEL += $(cflags-kernel-y) KBUILD_AFLAGS += -m64 -head-y := arch/x86/kernel/head_64.o arch/x86/kernel/head64.o arch/x86/kernel/init_task.o +head-y := arch/x86/kernel/head_64.o arch/x86/kernel/head64.o arch/x86/kernel/init_task_64.o libs-y += arch/x86/lib/ core-y += arch/x86/kernel/ \ @@ -97,9 +97,9 @@ BOOTIMAGE := arch/x86/boot/bzImage KBUILD_IMAGE := $(BOOTIMAGE) bzImage: vmlinux - $(Q)$(MAKE) $(build)=$(boot) $(BOOTIMAGE) $(Q)mkdir -p $(objtree)/arch/x86_64/boot - $(Q)ln -fsn ../../x86/boot/bzImage $(objtree)/arch/x86_64/boot/bzImage + $(Q)ln -fsn $(objtree)/arch/x86/boot/bzImage $(objtree)/arch/x86_64/boot/bzImage + $(Q)$(MAKE) $(build)=$(boot) $(BOOTIMAGE) bzlilo: vmlinux $(Q)$(MAKE) $(build)=$(boot) BOOTIMAGE=$(BOOTIMAGE) zlilo diff --git a/trunk/drivers/acpi/processor_core.c b/trunk/drivers/acpi/processor_core.c index 235a51e328c3..a7351084f2f8 100644 --- a/trunk/drivers/acpi/processor_core.c +++ b/trunk/drivers/acpi/processor_core.c @@ -422,6 +422,12 @@ static int map_lsapic_id(struct acpi_subtable_header *entry, return 0; } +#ifdef CONFIG_IA64 +#define arch_cpu_to_apicid ia64_cpu_to_sapicid +#else +#define arch_cpu_to_apicid x86_cpu_to_apicid +#endif + static int map_madt_entry(u32 acpi_id) { unsigned long madt_end, entry; @@ -495,7 +501,7 @@ static int get_cpu_id(acpi_handle handle, u32 acpi_id) return apic_id; for (i = 0; i < NR_CPUS; ++i) { - if (cpu_physical_id(i) == apic_id) + if (arch_cpu_to_apicid[i] == apic_id) return i; } return -1; diff --git a/trunk/drivers/ata/libata-core.c b/trunk/drivers/ata/libata-core.c index 629eadbd0ec0..bbaa545ea999 100644 --- a/trunk/drivers/ata/libata-core.c +++ b/trunk/drivers/ata/libata-core.c @@ -1392,7 +1392,7 @@ static void ata_qc_complete_internal(struct ata_queued_cmd *qc) * @tf: Taskfile registers for the command and the result * @cdb: CDB for packet command * @dma_dir: Data tranfer direction of the command - * @sgl: sg list for the data buffer of the command + * @sg: sg list for the data buffer of the command * @n_elem: Number of sg entries * @timeout: Timeout in msecs (0 for default) * diff --git a/trunk/drivers/ata/pata_cs5536.c b/trunk/drivers/ata/pata_cs5536.c index d753e568588e..53070f6b1fc4 100644 --- a/trunk/drivers/ata/pata_cs5536.c +++ b/trunk/drivers/ata/pata_cs5536.c @@ -40,7 +40,7 @@ #include #define DRV_NAME "pata_cs5536" -#define DRV_VERSION "0.0.6" +#define DRV_VERSION "0.0.5" enum { CFG = 0, @@ -214,7 +214,7 @@ static void cs5536_set_dmamode(struct ata_port *ap, struct ata_device *adev) cs5536_read(pdev, DTC, &dtc); dtc &= ~(IDE_DRV_MASK << dshift); - dtc |= mwdma_timings[mode - XFER_MW_DMA_0] << dshift; + dtc |= mwdma_timings[mode] << dshift; cs5536_write(pdev, DTC, dtc); } diff --git a/trunk/drivers/ata/sata_sis.c b/trunk/drivers/ata/sata_sis.c index f147dc7bf464..8d98a9fb0a42 100644 --- a/trunk/drivers/ata/sata_sis.c +++ b/trunk/drivers/ata/sata_sis.c @@ -92,7 +92,7 @@ static struct scsi_host_template sis_sht = { .queuecommand = ata_scsi_queuecmd, .can_queue = ATA_DEF_QUEUE, .this_id = ATA_SHT_THIS_ID, - .sg_tablesize = LIBATA_MAX_PRD, + .sg_tablesize = ATA_MAX_PRD, .cmd_per_lun = ATA_SHT_CMD_PER_LUN, .emulated = ATA_SHT_EMULATED, .use_clustering = ATA_SHT_USE_CLUSTERING, @@ -166,11 +166,11 @@ static unsigned int get_scr_cfg_addr(struct ata_port *ap, unsigned int sc_reg) return addr; } -static u32 sis_scr_cfg_read (struct ata_port *ap, unsigned int sc_reg, u32 *val) +static u32 sis_scr_cfg_read (struct ata_port *ap, unsigned int sc_reg) { struct pci_dev *pdev = to_pci_dev(ap->host->dev); unsigned int cfg_addr = get_scr_cfg_addr(ap, sc_reg); - u32 val2 = 0; + u32 val, val2 = 0; u8 pmr; if (sc_reg == SCR_ERROR) /* doesn't exist in PCI cfg space */ @@ -178,16 +178,13 @@ static u32 sis_scr_cfg_read (struct ata_port *ap, unsigned int sc_reg, u32 *val) pci_read_config_byte(pdev, SIS_PMR, &pmr); - pci_read_config_dword(pdev, cfg_addr, val); + pci_read_config_dword(pdev, cfg_addr, &val); if ((pdev->device == 0x0182) || (pdev->device == 0x0183) || (pdev->device == 0x1182) || (pmr & SIS_PMR_COMBINED)) pci_read_config_dword(pdev, cfg_addr+0x10, &val2); - *val |= val2; - *val &= 0xfffffffb; /* avoid problems with powerdowned ports */ - - return 0; + return (val|val2) & 0xfffffffb; /* avoid problems with powerdowned ports */ } static void sis_scr_cfg_write (struct ata_port *ap, unsigned int sc_reg, u32 val) @@ -217,7 +214,7 @@ static int sis_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val) return -EINVAL; if (ap->flags & SIS_FLAG_CFGSCR) - return sis_scr_cfg_read(ap, sc_reg, val); + return sis_scr_cfg_read(ap, sc_reg); pci_read_config_byte(pdev, SIS_PMR, &pmr); diff --git a/trunk/drivers/block/Kconfig b/trunk/drivers/block/Kconfig index ca4d7f0d09b7..38a085ea7758 100644 --- a/trunk/drivers/block/Kconfig +++ b/trunk/drivers/block/Kconfig @@ -351,7 +351,7 @@ config BLK_DEV_RAM_COUNT default "16" depends on BLK_DEV_RAM help - The default value is 16 RAM disks. Change this if you know what + The default value is 16 RAM disks. Change this if you know what you are doing. If you boot from a filesystem that needs to be extracted in memory, you will need at least one RAM disk (e.g. root on cramfs). @@ -361,7 +361,7 @@ config BLK_DEV_RAM_SIZE default "4096" help The default value is 4096 kilobytes. Only change this if you know - what are you doing. + what you are doing. config BLK_DEV_RAM_BLOCKSIZE int "Default RAM disk block size (bytes)" diff --git a/trunk/drivers/hwmon/coretemp.c b/trunk/drivers/hwmon/coretemp.c index 5c82ec7f8bbd..6f66551d9e51 100644 --- a/trunk/drivers/hwmon/coretemp.c +++ b/trunk/drivers/hwmon/coretemp.c @@ -150,7 +150,7 @@ static struct coretemp_data *coretemp_update_device(struct device *dev) static int __devinit coretemp_probe(struct platform_device *pdev) { struct coretemp_data *data; - struct cpuinfo_x86 *c = &cpu_data(pdev->id); + struct cpuinfo_x86 *c = &(cpu_data)[pdev->id]; int err; u32 eax, edx; @@ -359,7 +359,7 @@ static int __init coretemp_init(void) struct pdev_entry *p, *n; /* quick check if we run Intel */ - if (cpu_data(0).x86_vendor != X86_VENDOR_INTEL) + if (cpu_data[0].x86_vendor != X86_VENDOR_INTEL) goto exit; err = platform_driver_register(&coretemp_driver); @@ -367,7 +367,7 @@ static int __init coretemp_init(void) goto exit; for_each_online_cpu(i) { - struct cpuinfo_x86 *c = &cpu_data(i); + struct cpuinfo_x86 *c = &(cpu_data)[i]; /* check if family 6, models e, f, 16 */ if ((c->cpuid_level < 0) || (c->x86 != 0x6) || diff --git a/trunk/drivers/hwmon/hwmon-vid.c b/trunk/drivers/hwmon/hwmon-vid.c index 3330667280b9..f17e771e42f8 100644 --- a/trunk/drivers/hwmon/hwmon-vid.c +++ b/trunk/drivers/hwmon/hwmon-vid.c @@ -200,7 +200,7 @@ static u8 find_vrm(u8 eff_family, u8 eff_model, u8 eff_stepping, u8 vendor) u8 vid_which_vrm(void) { - struct cpuinfo_x86 *c = &cpu_data(0); + struct cpuinfo_x86 *c = cpu_data; u32 eax; u8 eff_family, eff_model, eff_stepping, vrm_ret; diff --git a/trunk/drivers/ide/Kconfig b/trunk/drivers/ide/Kconfig index 6eaece96524e..6d9fd92763f4 100644 --- a/trunk/drivers/ide/Kconfig +++ b/trunk/drivers/ide/Kconfig @@ -1056,9 +1056,6 @@ endif config BLK_DEV_IDEDMA def_bool BLK_DEV_IDEDMA_PCI || BLK_DEV_IDEDMA_PMAC || BLK_DEV_IDEDMA_ICS || BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA -config IDE_ARCH_OBSOLETE_INIT - def_bool ALPHA || (ARM && !ARCH_L7200) || BLACKFIN || X86 || IA64 || M32R || MIPS || PARISC || PPC || (SUPERH64 && BLK_DEV_IDEPCI) || SPARC - endif config BLK_DEV_HD_ONLY diff --git a/trunk/drivers/ide/arm/bast-ide.c b/trunk/drivers/ide/arm/bast-ide.c index 48db6167bb90..f7449d04114a 100644 --- a/trunk/drivers/ide/arm/bast-ide.c +++ b/trunk/drivers/ide/arm/bast-ide.c @@ -45,7 +45,7 @@ bastide_register(unsigned int base, unsigned int aux, int irq, hw.io_ports[IDE_CONTROL_OFFSET] = aux + (6 * 0x20); hw.irq = irq; - ide_register_hw(&hw, NULL, 0, hwif); + ide_register_hw(&hw, 0, hwif); return 0; } diff --git a/trunk/drivers/ide/arm/icside.c b/trunk/drivers/ide/arm/icside.c index 410a0d13e35e..3af33fbf1f88 100644 --- a/trunk/drivers/ide/arm/icside.c +++ b/trunk/drivers/ide/arm/icside.c @@ -316,29 +316,27 @@ static int icside_dma_end(ide_drive_t *drive) drive->waiting_for_dma = 0; - disable_dma(state->dev->dma); + disable_dma(hwif->hw.dma); /* Teardown mappings after DMA has completed. */ dma_unmap_sg(state->dev, hwif->sg_table, hwif->sg_nents, hwif->sg_dma_direction); - return get_dma_residue(state->dev->dma) != 0; + return get_dma_residue(hwif->hw.dma) != 0; } static void icside_dma_start(ide_drive_t *drive) { ide_hwif_t *hwif = HWIF(drive); - struct icside_state *state = hwif->hwif_data; /* We can not enable DMA on both channels simultaneously. */ - BUG_ON(dma_channel_active(state->dev->dma)); - enable_dma(state->dev->dma); + BUG_ON(dma_channel_active(hwif->hw.dma)); + enable_dma(hwif->hw.dma); } static int icside_dma_setup(ide_drive_t *drive) { ide_hwif_t *hwif = HWIF(drive); - struct icside_state *state = hwif->hwif_data; struct request *rq = hwif->hwgroup->rq; unsigned int dma_mode; @@ -350,7 +348,7 @@ static int icside_dma_setup(ide_drive_t *drive) /* * We can not enable DMA on both channels. */ - BUG_ON(dma_channel_active(state->dev->dma)); + BUG_ON(dma_channel_active(hwif->hw.dma)); icside_build_sglist(drive, rq); @@ -367,14 +365,14 @@ static int icside_dma_setup(ide_drive_t *drive) /* * Select the correct timing for this drive. */ - set_dma_speed(state->dev->dma, drive->drive_data); + set_dma_speed(hwif->hw.dma, drive->drive_data); /* * Tell the DMA engine about the SG table and * data direction. */ - set_dma_sg(state->dev->dma, hwif->sg_table, hwif->sg_nents); - set_dma_mode(state->dev->dma, dma_mode); + set_dma_sg(hwif->hw.dma, hwif->sg_table, hwif->sg_nents); + set_dma_mode(hwif->hw.dma, dma_mode); drive->waiting_for_dma = 1; @@ -440,16 +438,40 @@ static void icside_dma_init(ide_hwif_t *hwif) #define icside_dma_init(hwif) (0) #endif +static ide_hwif_t *icside_find_hwif(unsigned long dataport) +{ + ide_hwif_t *hwif; + int index; + + for (index = 0; index < MAX_HWIFS; ++index) { + hwif = &ide_hwifs[index]; + if (hwif->io_ports[IDE_DATA_OFFSET] == dataport) + goto found; + } + + for (index = 0; index < MAX_HWIFS; ++index) { + hwif = &ide_hwifs[index]; + if (!hwif->io_ports[IDE_DATA_OFFSET]) + goto found; + } + + hwif = NULL; +found: + return hwif; +} + static ide_hwif_t * icside_setup(void __iomem *base, struct cardinfo *info, struct expansion_card *ec) { unsigned long port = (unsigned long)base + info->dataoffset; ide_hwif_t *hwif; - hwif = ide_find_port(port); + hwif = icside_find_hwif(port); if (hwif) { int i; + memset(&hwif->hw, 0, sizeof(hw_regs_t)); + /* * Ensure we're using MMIO */ @@ -457,10 +479,13 @@ icside_setup(void __iomem *base, struct cardinfo *info, struct expansion_card *e hwif->mmio = 1; for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) { + hwif->hw.io_ports[i] = port; hwif->io_ports[i] = port; port += 1 << info->stepping; } + hwif->hw.io_ports[IDE_CONTROL_OFFSET] = (unsigned long)base + info->ctrloffset; hwif->io_ports[IDE_CONTROL_OFFSET] = (unsigned long)base + info->ctrloffset; + hwif->hw.irq = ec->irq; hwif->irq = ec->irq; hwif->noprobe = 0; hwif->chipset = ide_acorn; @@ -475,7 +500,6 @@ icside_register_v5(struct icside_state *state, struct expansion_card *ec) { ide_hwif_t *hwif; void __iomem *base; - u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; base = ecardm_iomap(ec, ECARD_RES_MEMC, 0, 0); if (!base) @@ -499,9 +523,9 @@ icside_register_v5(struct icside_state *state, struct expansion_card *ec) state->hwif[0] = hwif; - idx[0] = hwif->index; + probe_hwif_init(hwif); - ide_device_add(idx); + ide_proc_register_port(hwif); return 0; } @@ -513,7 +537,6 @@ icside_register_v6(struct icside_state *state, struct expansion_card *ec) void __iomem *ioc_base, *easi_base; unsigned int sel = 0; int ret; - u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; ioc_base = ecardm_iomap(ec, ECARD_RES_IOCFAST, 0, 0); if (!ioc_base) { @@ -569,6 +592,7 @@ icside_register_v6(struct icside_state *state, struct expansion_card *ec) hwif->serialized = 1; hwif->config_data = (unsigned long)ioc_base; hwif->select_data = sel; + hwif->hw.dma = ec->dma; mate->maskproc = icside_maskproc; mate->channel = 1; @@ -577,16 +601,18 @@ icside_register_v6(struct icside_state *state, struct expansion_card *ec) mate->serialized = 1; mate->config_data = (unsigned long)ioc_base; mate->select_data = sel | 1; + mate->hw.dma = ec->dma; if (ec->dma != NO_DMA && !request_dma(ec->dma, hwif->name)) { icside_dma_init(hwif); icside_dma_init(mate); } - idx[0] = hwif->index; - idx[1] = mate->index; + probe_hwif_init(hwif); + probe_hwif_init(mate); - ide_device_add(idx); + ide_proc_register_port(hwif); + ide_proc_register_port(mate); return 0; diff --git a/trunk/drivers/ide/arm/ide_arm.c b/trunk/drivers/ide/arm/ide_arm.c index 8957cbadf5c2..bce2bec81413 100644 --- a/trunk/drivers/ide/arm/ide_arm.c +++ b/trunk/drivers/ide/arm/ide_arm.c @@ -31,5 +31,5 @@ void __init ide_arm_init(void) memset(&hw, 0, sizeof(hw)); ide_std_init_ports(&hw, IDE_ARM_IO, IDE_ARM_IO + 0x206); hw.irq = IDE_ARM_IRQ; - ide_register_hw(&hw, NULL, 1, NULL); + ide_register_hw(&hw, 1, NULL); } diff --git a/trunk/drivers/ide/arm/rapide.c b/trunk/drivers/ide/arm/rapide.c index 0775a3afef48..83811af11610 100644 --- a/trunk/drivers/ide/arm/rapide.c +++ b/trunk/drivers/ide/arm/rapide.c @@ -13,25 +13,42 @@ #include +/* + * Something like this really should be in generic code, but isn't. + */ static ide_hwif_t * rapide_locate_hwif(void __iomem *base, void __iomem *ctrl, unsigned int sz, int irq) { unsigned long port = (unsigned long)base; - ide_hwif_t *hwif = ide_find_port(port); - int i; + ide_hwif_t *hwif; + int index, i; - if (hwif == NULL) - goto out; + for (index = 0; index < MAX_HWIFS; ++index) { + hwif = ide_hwifs + index; + if (hwif->io_ports[IDE_DATA_OFFSET] == port) + goto found; + } + + for (index = 0; index < MAX_HWIFS; ++index) { + hwif = ide_hwifs + index; + if (hwif->io_ports[IDE_DATA_OFFSET] == 0) + goto found; + } + + return NULL; + found: for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) { + hwif->hw.io_ports[i] = port; hwif->io_ports[i] = port; port += sz; } + hwif->hw.io_ports[IDE_CONTROL_OFFSET] = (unsigned long)ctrl; hwif->io_ports[IDE_CONTROL_OFFSET] = (unsigned long)ctrl; - hwif->irq = irq; + hwif->hw.irq = hwif->irq = irq; hwif->mmio = 1; default_hwif_mmiops(hwif); -out: + return hwif; } @@ -41,7 +58,6 @@ rapide_probe(struct expansion_card *ec, const struct ecard_id *id) ide_hwif_t *hwif; void __iomem *base; int ret; - u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; ret = ecard_request_resources(ec); if (ret) @@ -58,11 +74,8 @@ rapide_probe(struct expansion_card *ec, const struct ecard_id *id) hwif->hwif_data = base; hwif->gendev.parent = &ec->dev; hwif->noprobe = 0; - - idx[0] = hwif->index; - - ide_device_add(idx); - + probe_hwif_init(hwif); + ide_proc_register_port(hwif); ecard_set_drvdata(ec, hwif); goto out; } diff --git a/trunk/drivers/ide/cris/ide-cris.c b/trunk/drivers/ide/cris/ide-cris.c index ff20377b4c82..9a96a10ba9d3 100644 --- a/trunk/drivers/ide/cris/ide-cris.c +++ b/trunk/drivers/ide/cris/ide-cris.c @@ -782,7 +782,7 @@ init_e100_ide (void) ide_offsets, 0, 0, cris_ide_ack_intr, ide_default_irq(0)); - ide_register_hw(&hw, NULL, 1, &hwif); + ide_register_hw(&hw, 1, &hwif); hwif->mmio = 1; hwif->chipset = ide_etrax100; hwif->set_pio_mode = &cris_set_pio_mode; diff --git a/trunk/drivers/ide/h8300/ide-h8300.c b/trunk/drivers/ide/h8300/ide-h8300.c index 4a49b5c59acb..6d26ad7360d5 100644 --- a/trunk/drivers/ide/h8300/ide-h8300.c +++ b/trunk/drivers/ide/h8300/ide-h8300.c @@ -68,6 +68,7 @@ static inline void hw_setup(hw_regs_t *hw) hw->io_ports[i] = CONFIG_H8300_IDE_BASE + H8300_IDE_GAP*i; hw->io_ports[IDE_CONTROL_OFFSET] = CONFIG_H8300_IDE_ALT; hw->irq = EXT_IRQ0 + CONFIG_H8300_IDE_IRQ; + hw->dma = NO_DMA; hw->chipset = ide_generic; } @@ -100,7 +101,7 @@ void __init h8300_ide_init(void) hw_setup(&hw); /* register if */ - idx = ide_register_hw(&hw, NULL, 1, &hwif); + idx = ide_register_hw(&hw, 1, &hwif); if (idx == -1) { printk(KERN_ERR "ide-h8300: IDE I/F register failed\n"); return; diff --git a/trunk/drivers/ide/ide-acpi.c b/trunk/drivers/ide/ide-acpi.c index 89df48fdc69d..1d5f6823101c 100644 --- a/trunk/drivers/ide/ide-acpi.c +++ b/trunk/drivers/ide/ide-acpi.c @@ -350,7 +350,7 @@ static int taskfile_load_raw(ide_drive_t *drive, memset(&args, 0, sizeof(ide_task_t)); args.command_type = IDE_DRIVE_TASK_NO_DATA; - args.data_phase = TASKFILE_NO_DATA; + args.data_phase = TASKFILE_IN; args.handler = &task_no_data_intr; /* convert gtf to IDE Taskfile */ diff --git a/trunk/drivers/ide/ide-disk.c b/trunk/drivers/ide/ide-disk.c index 00123d99527a..2722d9165b6b 100644 --- a/trunk/drivers/ide/ide-disk.c +++ b/trunk/drivers/ide/ide-disk.c @@ -593,12 +593,28 @@ static int smart_enable(ide_drive_t *drive) return ide_raw_taskfile(drive, &args, NULL); } -static int get_smart_data(ide_drive_t *drive, u8 *buf, u8 sub_cmd) +static int get_smart_values(ide_drive_t *drive, u8 *buf) { ide_task_t args; memset(&args, 0, sizeof(ide_task_t)); - args.tfRegister[IDE_FEATURE_OFFSET] = sub_cmd; + args.tfRegister[IDE_FEATURE_OFFSET] = SMART_READ_VALUES; + args.tfRegister[IDE_NSECTOR_OFFSET] = 0x01; + args.tfRegister[IDE_LCYL_OFFSET] = SMART_LCYL_PASS; + args.tfRegister[IDE_HCYL_OFFSET] = SMART_HCYL_PASS; + args.tfRegister[IDE_COMMAND_OFFSET] = WIN_SMART; + args.command_type = IDE_DRIVE_TASK_IN; + args.data_phase = TASKFILE_IN; + args.handler = &task_in_intr; + (void) smart_enable(drive); + return ide_raw_taskfile(drive, &args, buf); +} + +static int get_smart_thresholds(ide_drive_t *drive, u8 *buf) +{ + ide_task_t args; + memset(&args, 0, sizeof(ide_task_t)); + args.tfRegister[IDE_FEATURE_OFFSET] = SMART_READ_THRESHOLDS; args.tfRegister[IDE_NSECTOR_OFFSET] = 0x01; args.tfRegister[IDE_LCYL_OFFSET] = SMART_LCYL_PASS; args.tfRegister[IDE_HCYL_OFFSET] = SMART_HCYL_PASS; @@ -640,7 +656,7 @@ static int proc_idedisk_read_smart_thresholds ide_drive_t *drive = (ide_drive_t *)data; int len = 0, i = 0; - if (get_smart_data(drive, page, SMART_READ_THRESHOLDS) == 0) { + if (!get_smart_thresholds(drive, page)) { unsigned short *val = (unsigned short *) page; char *out = ((char *)val) + (SECTOR_WORDS * 4); page = out; @@ -659,7 +675,7 @@ static int proc_idedisk_read_smart_values ide_drive_t *drive = (ide_drive_t *)data; int len = 0, i = 0; - if (get_smart_data(drive, page, SMART_READ_VALUES) == 0) { + if (!get_smart_values(drive, page)) { unsigned short *val = (unsigned short *) page; char *out = ((char *)val) + (SECTOR_WORDS * 4); page = out; diff --git a/trunk/drivers/ide/ide-dma.c b/trunk/drivers/ide/ide-dma.c index 428f7a8a00b6..80b4f17f3941 100644 --- a/trunk/drivers/ide/ide-dma.c +++ b/trunk/drivers/ide/ide-dma.c @@ -901,7 +901,10 @@ void ide_dma_timeout (ide_drive_t *drive) EXPORT_SYMBOL(ide_dma_timeout); -static void ide_release_dma_engine(ide_hwif_t *hwif) +/* + * Needed for allowing full modular support of ide-driver + */ +static int ide_release_dma_engine(ide_hwif_t *hwif) { if (hwif->dmatable_cpu) { pci_free_consistent(hwif->pci_dev, @@ -910,6 +913,7 @@ static void ide_release_dma_engine(ide_hwif_t *hwif) hwif->dmatable_dma); hwif->dmatable_cpu = NULL; } + return 1; } static int ide_release_iomio_dma(ide_hwif_t *hwif) @@ -952,6 +956,12 @@ static int ide_mapped_mmio_dma(ide_hwif_t *hwif, unsigned long base, unsigned in { printk(KERN_INFO " %s: MMIO-DMA ", hwif->name); + hwif->dma_base = base; + + if(hwif->mate) + hwif->dma_master = (hwif->channel) ? hwif->mate->dma_base : base; + else + hwif->dma_master = base; return 0; } @@ -965,6 +975,8 @@ static int ide_iomio_dma(ide_hwif_t *hwif, unsigned long base, unsigned int port return 1; } + hwif->dma_base = base; + if (hwif->cds->extra) { hwif->extra_base = base + (hwif->channel ? 8 : 16); @@ -979,6 +991,10 @@ static int ide_iomio_dma(ide_hwif_t *hwif, unsigned long base, unsigned int port } } + if(hwif->mate) + hwif->dma_master = (hwif->channel) ? hwif->mate->dma_base:base; + else + hwif->dma_master = base; return 0; } @@ -990,9 +1006,12 @@ static int ide_dma_iobase(ide_hwif_t *hwif, unsigned long base, unsigned int por return ide_iomio_dma(hwif, base, ports); } -void ide_setup_dma(ide_hwif_t *hwif, unsigned long base, unsigned num_ports) +/* + * This can be called for a dynamically installed interface. Don't __init it + */ +void ide_setup_dma (ide_hwif_t *hwif, unsigned long dma_base, unsigned int num_ports) { - if (ide_dma_iobase(hwif, base, num_ports)) + if (ide_dma_iobase(hwif, dma_base, num_ports)) return; if (ide_allocate_dma_engine(hwif)) { @@ -1000,13 +1019,6 @@ void ide_setup_dma(ide_hwif_t *hwif, unsigned long base, unsigned num_ports) return; } - hwif->dma_base = base; - - if (hwif->mate) - hwif->dma_master = hwif->channel ? hwif->mate->dma_base : base; - else - hwif->dma_master = base; - if (!(hwif->dma_command)) hwif->dma_command = hwif->dma_base; if (!(hwif->dma_vendor1)) diff --git a/trunk/drivers/ide/ide-io.c b/trunk/drivers/ide/ide-io.c index c89f0d3058e9..32eaa3f80515 100644 --- a/trunk/drivers/ide/ide-io.c +++ b/trunk/drivers/ide/ide-io.c @@ -55,7 +55,7 @@ #include static int __ide_end_request(ide_drive_t *drive, struct request *rq, - int uptodate, unsigned int nr_bytes, int dequeue) + int uptodate, unsigned int nr_bytes) { int ret = 1; @@ -80,11 +80,9 @@ static int __ide_end_request(ide_drive_t *drive, struct request *rq, if (!end_that_request_chunk(rq, uptodate, nr_bytes)) { add_disk_randomness(rq->rq_disk); - if (dequeue) { - if (!list_empty(&rq->queuelist)) - blkdev_dequeue_request(rq); - HWGROUP(drive)->rq = NULL; - } + if (!list_empty(&rq->queuelist)) + blkdev_dequeue_request(rq); + HWGROUP(drive)->rq = NULL; end_that_request_last(rq, uptodate); ret = 0; } @@ -124,7 +122,7 @@ int ide_end_request (ide_drive_t *drive, int uptodate, int nr_sectors) nr_bytes = rq->hard_cur_sectors << 9; } - ret = __ide_end_request(drive, rq, uptodate, nr_bytes, 1); + ret = __ide_end_request(drive, rq, uptodate, nr_bytes); spin_unlock_irqrestore(&ide_lock, flags); return ret; @@ -257,13 +255,39 @@ int ide_end_dequeued_request(ide_drive_t *drive, struct request *rq, int uptodate, int nr_sectors) { unsigned long flags; - int ret; + int ret = 1; spin_lock_irqsave(&ide_lock, flags); + BUG_ON(!blk_rq_started(rq)); - ret = __ide_end_request(drive, rq, uptodate, nr_sectors << 9, 0); - spin_unlock_irqrestore(&ide_lock, flags); + /* + * if failfast is set on a request, override number of sectors and + * complete the whole request right now + */ + if (blk_noretry_request(rq) && end_io_error(uptodate)) + nr_sectors = rq->hard_nr_sectors; + + if (!blk_fs_request(rq) && end_io_error(uptodate) && !rq->errors) + rq->errors = -EIO; + + /* + * decide whether to reenable DMA -- 3 is a random magic for now, + * if we DMA timeout more than 3 times, just stay in PIO + */ + if (drive->state == DMA_PIO_RETRY && drive->retry_pio <= 3) { + drive->state = 0; + HWGROUP(drive)->hwif->ide_dma_on(drive); + } + + if (!end_that_request_first(rq, uptodate, nr_sectors)) { + add_disk_randomness(rq->rq_disk); + if (blk_rq_tagged(rq)) + blk_queue_end_tag(drive->queue, rq); + end_that_request_last(rq, uptodate); + ret = 0; + } + spin_unlock_irqrestore(&ide_lock, flags); return ret; } EXPORT_SYMBOL_GPL(ide_end_dequeued_request); @@ -776,20 +800,7 @@ static ide_startstop_t do_special (ide_drive_t *drive) s->b.set_tune = 0; if (set_pio_mode_abuse(drive->hwif, req_pio)) { - - if (hwif->set_pio_mode == NULL) - return ide_stopped; - - /* - * take ide_lock for drive->[no_]unmask/[no_]io_32bit - */ - if (req_pio == 8 || req_pio == 9) { - unsigned long flags; - - spin_lock_irqsave(&ide_lock, flags); - hwif->set_pio_mode(drive, req_pio); - spin_unlock_irqrestore(&ide_lock, flags); - } else + if (hwif->set_pio_mode) hwif->set_pio_mode(drive, req_pio); } else { int keep_dma = drive->using_dma; diff --git a/trunk/drivers/ide/ide-iops.c b/trunk/drivers/ide/ide-iops.c index 95168833d069..d4d790f91f91 100644 --- a/trunk/drivers/ide/ide-iops.c +++ b/trunk/drivers/ide/ide-iops.c @@ -693,16 +693,35 @@ static u8 ide_auto_reduce_xfer (ide_drive_t *drive) } #endif /* CONFIG_BLK_DEV_IDEDMA */ -int ide_driveid_update(ide_drive_t *drive) +/* + * Update the + */ +int ide_driveid_update (ide_drive_t *drive) { - ide_hwif_t *hwif = drive->hwif; + ide_hwif_t *hwif = HWIF(drive); struct hd_driveid *id; - unsigned long timeout, flags; +#if 0 + id = kmalloc(SECTOR_WORDS*4, GFP_ATOMIC); + if (!id) + return 0; + taskfile_lib_get_identify(drive, (char *)&id); + + ide_fix_driveid(id); + if (id) { + drive->id->dma_ultra = id->dma_ultra; + drive->id->dma_mword = id->dma_mword; + drive->id->dma_1word = id->dma_1word; + /* anything more ? */ + kfree(id); + } + return 1; +#else /* * Re-read drive->id for possible DMA mode * change (copied from ide-probe.c) */ + unsigned long timeout, flags; SELECT_MASK(drive, 1); if (IDE_CONTROL_REG) @@ -744,6 +763,7 @@ int ide_driveid_update(ide_drive_t *drive) } return 1; +#endif } int ide_config_drive_speed(ide_drive_t *drive, u8 speed) diff --git a/trunk/drivers/ide/ide-pnp.c b/trunk/drivers/ide/ide-pnp.c index e245521af7b5..2b8009c50e91 100644 --- a/trunk/drivers/ide/ide-pnp.c +++ b/trunk/drivers/ide/ide-pnp.c @@ -40,8 +40,9 @@ static int idepnp_probe(struct pnp_dev * dev, const struct pnp_device_id *dev_id ide_std_init_ports(&hw, pnp_port_start(dev, 0), pnp_port_start(dev, 1)); hw.irq = pnp_irq(dev, 0); + hw.dma = NO_DMA; - index = ide_register_hw(&hw, NULL, 1, &hwif); + index = ide_register_hw(&hw, 1, &hwif); if (index != -1) { printk(KERN_INFO "ide%d: generic PnP IDE interface\n", index); diff --git a/trunk/drivers/ide/ide-probe.c b/trunk/drivers/ide/ide-probe.c index d5146c57e5b3..e294c7415c27 100644 --- a/trunk/drivers/ide/ide-probe.c +++ b/trunk/drivers/ide/ide-probe.c @@ -717,7 +717,7 @@ EXPORT_SYMBOL_GPL(ide_undecoded_slave); * This routine only knows how to look for drive units 0 and 1 * on an interface, so any setting of MAX_DRIVES > 2 won't work here. */ -static void probe_hwif(ide_hwif_t *hwif) +static void probe_hwif(ide_hwif_t *hwif, void (*fixup)(ide_hwif_t *hwif)) { unsigned long flags; unsigned int irqd; @@ -819,8 +819,8 @@ static void probe_hwif(ide_hwif_t *hwif) return; } - if (hwif->fixup) - hwif->fixup(hwif); + if (fixup) + fixup(hwif); for (unit = 0; unit < MAX_DRIVES; ++unit) { ide_drive_t *drive = &hwif->drives[unit]; @@ -859,11 +859,10 @@ static void probe_hwif(ide_hwif_t *hwif) } static int hwif_init(ide_hwif_t *hwif); -static void hwif_register_devices(ide_hwif_t *hwif); -static int probe_hwif_init(ide_hwif_t *hwif) +int probe_hwif_init_with_fixup(ide_hwif_t *hwif, void (*fixup)(ide_hwif_t *hwif)) { - probe_hwif(hwif); + probe_hwif(hwif, fixup); if (!hwif_init(hwif)) { printk(KERN_INFO "%s: failed to initialize IDE interface\n", @@ -871,12 +870,34 @@ static int probe_hwif_init(ide_hwif_t *hwif) return -1; } - if (hwif->present) - hwif_register_devices(hwif); + if (hwif->present) { + u16 unit = 0; + int ret; + for (unit = 0; unit < MAX_DRIVES; ++unit) { + ide_drive_t *drive = &hwif->drives[unit]; + /* For now don't attach absent drives, we may + want them on default or a new "empty" class + for hotplug reprobing ? */ + if (drive->present) { + ret = device_register(&drive->gendev); + if (ret < 0) + printk(KERN_WARNING "IDE: %s: " + "device_register error: %d\n", + __FUNCTION__, ret); + } + } + } return 0; } +int probe_hwif_init(ide_hwif_t *hwif) +{ + return probe_hwif_init_with_fixup(hwif, NULL); +} + +EXPORT_SYMBOL(probe_hwif_init); + #if MAX_HWIFS > 1 /* * save_match() is used to simplify logic in init_irq() below. @@ -1358,24 +1379,6 @@ static int hwif_init(ide_hwif_t *hwif) return 0; } -static void hwif_register_devices(ide_hwif_t *hwif) -{ - unsigned int i; - - for (i = 0; i < MAX_DRIVES; i++) { - ide_drive_t *drive = &hwif->drives[i]; - - if (drive->present) { - int ret = device_register(&drive->gendev); - - if (ret < 0) - printk(KERN_WARNING "IDE: %s: " - "device_register error: %d\n", - __FUNCTION__, ret); - } - } -} - int ideprobe_init (void) { unsigned int index; @@ -1387,18 +1390,27 @@ int ideprobe_init (void) for (index = 0; index < MAX_HWIFS; ++index) if (probe[index]) - probe_hwif(&ide_hwifs[index]); + probe_hwif(&ide_hwifs[index], NULL); for (index = 0; index < MAX_HWIFS; ++index) if (probe[index]) hwif_init(&ide_hwifs[index]); for (index = 0; index < MAX_HWIFS; ++index) { if (probe[index]) { ide_hwif_t *hwif = &ide_hwifs[index]; + int unit; if (!hwif->present) continue; if (hwif->chipset == ide_unknown || hwif->chipset == ide_forced) hwif->chipset = ide_generic; - hwif_register_devices(hwif); + for (unit = 0; unit < MAX_DRIVES; ++unit) + if (hwif->drives[unit].present) { + int ret = device_register( + &hwif->drives[unit].gendev); + if (ret < 0) + printk(KERN_WARNING "IDE: %s: " + "device_register error: %d\n", + __FUNCTION__, ret); + } } } for (index = 0; index < MAX_HWIFS; ++index) @@ -1408,22 +1420,3 @@ int ideprobe_init (void) } EXPORT_SYMBOL_GPL(ideprobe_init); - -int ide_device_add(u8 idx[4]) -{ - int i, rc = 0; - - for (i = 0; i < 4; i++) { - if (idx[i] != 0xff) - rc |= probe_hwif_init(&ide_hwifs[idx[i]]); - } - - for (i = 0; i < 4; i++) { - if (idx[i] != 0xff) - ide_proc_register_port(&ide_hwifs[idx[i]]); - } - - return rc; -} - -EXPORT_SYMBOL_GPL(ide_device_add); diff --git a/trunk/drivers/ide/ide-proc.c b/trunk/drivers/ide/ide-proc.c index a4007d30da52..fc1d8ae6a803 100644 --- a/trunk/drivers/ide/ide-proc.c +++ b/trunk/drivers/ide/ide-proc.c @@ -804,6 +804,8 @@ void ide_proc_register_port(ide_hwif_t *hwif) create_proc_ide_drives(hwif); } +EXPORT_SYMBOL_GPL(ide_proc_register_port); + #ifdef CONFIG_BLK_DEV_IDEPCI void ide_pci_create_host_proc(const char *name, get_info_t *get_info) { diff --git a/trunk/drivers/ide/ide-tape.c b/trunk/drivers/ide/ide-tape.c index e5a86a962b26..1fa57947bca0 100644 --- a/trunk/drivers/ide/ide-tape.c +++ b/trunk/drivers/ide/ide-tape.c @@ -621,6 +621,7 @@ typedef struct os_dat_s { */ #define USE_IOTRACE 0 #if USE_IOTRACE +#include #define IO_IDETAPE_FIFO 500 #endif diff --git a/trunk/drivers/ide/ide-taskfile.c b/trunk/drivers/ide/ide-taskfile.c index 73ef6bf5fbcc..2a3c8d498343 100644 --- a/trunk/drivers/ide/ide-taskfile.c +++ b/trunk/drivers/ide/ide-taskfile.c @@ -8,6 +8,23 @@ * Copyright (C) 2003-2004 Bartlomiej Zolnierkiewicz * * The big the bad and the ugly. + * + * Problems to be fixed because of BH interface or the lack therefore. + * + * Fill me in stupid !!! + * + * HOST: + * General refers to the Controller and Driver "pair". + * DATA HANDLER: + * Under the context of Linux it generally refers to an interrupt handler. + * However, it correctly describes the 'HOST' + * DATA BLOCK: + * The amount of data needed to be transfered as predefined in the + * setup of the device. + * STORAGE ATOMIC: + * The 'DATA BLOCK' associated to the 'DATA HANDLER', and can be as + * small as a single sector or as large as the entire command block + * request. */ #include @@ -678,6 +695,9 @@ int ide_wait_cmd (ide_drive_t *drive, u8 cmd, u8 nsect, u8 feature, u8 sectors, return ide_do_drive_cmd(drive, &rq, ide_wait); } +/* + * FIXME : this needs to map into at taskfile. + */ int ide_cmd_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg) { int err = 0; @@ -741,6 +761,9 @@ static int ide_wait_cmd_task(ide_drive_t *drive, u8 *buf) return ide_do_drive_cmd(drive, &rq, ide_wait); } +/* + * FIXME : this needs to map into at taskfile. + */ int ide_task_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg) { void __user *p = (void __user *)arg; @@ -837,14 +860,9 @@ ide_startstop_t flagged_taskfile (ide_drive_t *drive, ide_task_t *task) case TASKFILE_OUT_DMA: case TASKFILE_IN_DMAQ: case TASKFILE_IN_DMA: - if (!drive->using_dma) - break; - - if (!hwif->dma_setup(drive)) { - hwif->dma_exec_cmd(drive, taskfile->command); - hwif->dma_start(drive); - return ide_started; - } + hwif->dma_setup(drive); + hwif->dma_exec_cmd(drive, taskfile->command); + hwif->dma_start(drive); break; default: @@ -858,8 +876,7 @@ ide_startstop_t flagged_taskfile (ide_drive_t *drive, ide_task_t *task) return task->prehandler(drive, task->rq); } ide_execute_command(drive, taskfile->command, task->handler, WAIT_WORSTCASE, NULL); - return ide_started; } - return ide_stopped; + return ide_started; } diff --git a/trunk/drivers/ide/ide.c b/trunk/drivers/ide/ide.c index 674a65c1a130..961e6c897286 100644 --- a/trunk/drivers/ide/ide.c +++ b/trunk/drivers/ide/ide.c @@ -168,6 +168,7 @@ static void init_hwif_default(ide_hwif_t *hwif, unsigned int index) ide_init_hwif_ports(&hw, ide_default_io_base(index), 0, &hwif->irq); + memcpy(&hwif->hw, &hw, sizeof(hw)); memcpy(hwif->io_ports, hw.io_ports, sizeof(hw.io_ports)); hwif->noprobe = !hwif->io_ports[IDE_DATA_OFFSET]; @@ -213,7 +214,7 @@ static void __init init_ide_data (void) init_hwif_data(hwif, index); init_hwif_default(hwif, index); #if !defined(CONFIG_PPC32) || !defined(CONFIG_PCI) - hwif->irq = + hwif->irq = hwif->hw.irq = ide_init_default_irq(hwif->io_ports[IDE_DATA_OFFSET]); #endif } @@ -264,30 +265,6 @@ static int ide_system_bus_speed(void) return system_bus_speed; } -ide_hwif_t * ide_find_port(unsigned long base) -{ - ide_hwif_t *hwif; - int i; - - for (i = 0; i < MAX_HWIFS; i++) { - hwif = &ide_hwifs[i]; - if (hwif->io_ports[IDE_DATA_OFFSET] == base) - goto found; - } - - for (i = 0; i < MAX_HWIFS; i++) { - hwif = &ide_hwifs[i]; - if (hwif->io_ports[IDE_DATA_OFFSET] == 0) - goto found; - } - - hwif = NULL; -found: - return hwif; -} - -EXPORT_SYMBOL_GPL(ide_find_port); - static struct resource* hwif_request_region(ide_hwif_t *hwif, unsigned long addr, int num) { @@ -414,8 +391,6 @@ static void ide_hwif_restore(ide_hwif_t *hwif, ide_hwif_t *tmp_hwif) hwif->cds = tmp_hwif->cds; #endif - hwif->fixup = tmp_hwif->fixup; - hwif->set_pio_mode = tmp_hwif->set_pio_mode; hwif->set_dma_mode = tmp_hwif->set_dma_mode; hwif->mdma_filter = tmp_hwif->mdma_filter; @@ -677,6 +652,7 @@ void ide_setup_ports ( hw_regs_t *hw, } } hw->irq = irq; + hw->dma = NO_DMA; hw->ack_intr = ack_intr; /* * hw->iops = iops; @@ -684,11 +660,11 @@ void ide_setup_ports ( hw_regs_t *hw, } /** - * ide_register_hw - register IDE interface + * ide_register_hw_with_fixup - register IDE interface * @hw: hardware registers - * @fixup: fixup function * @initializing: set while initializing built-in drivers * @hwifp: pointer to returned hwif + * @fixup: fixup function * * Register an IDE interface, specifying exactly the registers etc. * Set init=1 iff calling before probes have taken place. @@ -696,8 +672,9 @@ void ide_setup_ports ( hw_regs_t *hw, * Returns -1 on error. */ -int ide_register_hw(hw_regs_t *hw, void (*fixup)(ide_hwif_t *), - int initializing, ide_hwif_t **hwifp) +int ide_register_hw_with_fixup(hw_regs_t *hw, int initializing, + ide_hwif_t **hwifp, + void(*fixup)(ide_hwif_t *hwif)) { int index, retry = 1; ide_hwif_t *hwif; @@ -705,7 +682,7 @@ int ide_register_hw(hw_regs_t *hw, void (*fixup)(ide_hwif_t *), do { for (index = 0; index < MAX_HWIFS; ++index) { hwif = &ide_hwifs[index]; - if (hwif->io_ports[IDE_DATA_OFFSET] == hw->io_ports[IDE_DATA_OFFSET]) + if (hwif->hw.io_ports[IDE_DATA_OFFSET] == hw->io_ports[IDE_DATA_OFFSET]) goto found; } for (index = 0; index < MAX_HWIFS; ++index) { @@ -713,7 +690,7 @@ int ide_register_hw(hw_regs_t *hw, void (*fixup)(ide_hwif_t *), if (hwif->hold) continue; if ((!hwif->present && !hwif->mate && !initializing) || - (!hwif->io_ports[IDE_DATA_OFFSET] && initializing)) + (!hwif->hw.io_ports[IDE_DATA_OFFSET] && initializing)) goto found; } for (index = 0; index < MAX_HWIFS; index++) @@ -729,18 +706,16 @@ int ide_register_hw(hw_regs_t *hw, void (*fixup)(ide_hwif_t *), } if (hwif->present) return -1; - memcpy(hwif->io_ports, hw->io_ports, sizeof(hwif->io_ports)); + memcpy(&hwif->hw, hw, sizeof(*hw)); + memcpy(hwif->io_ports, hwif->hw.io_ports, sizeof(hwif->hw.io_ports)); hwif->irq = hw->irq; hwif->noprobe = 0; - hwif->fixup = fixup; hwif->chipset = hw->chipset; hwif->gendev.parent = hw->dev; - hwif->ack_intr = hw->ack_intr; - - if (initializing == 0) { - u8 idx[4] = { index, 0xff, 0xff, 0xff }; - ide_device_add(idx); + if (!initializing) { + probe_hwif_init_with_fixup(hwif, fixup); + ide_proc_register_port(hwif); } if (hwifp) @@ -749,6 +724,13 @@ int ide_register_hw(hw_regs_t *hw, void (*fixup)(ide_hwif_t *), return (initializing || hwif->present) ? index : -1; } +EXPORT_SYMBOL(ide_register_hw_with_fixup); + +int ide_register_hw(hw_regs_t *hw, int initializing, ide_hwif_t **hwifp) +{ + return ide_register_hw_with_fixup(hw, initializing, hwifp, NULL); +} + EXPORT_SYMBOL(ide_register_hw); /* @@ -1064,7 +1046,7 @@ int generic_ide_ioctl(ide_drive_t *drive, struct file *file, struct block_device ide_init_hwif_ports(&hw, (unsigned long) args[0], (unsigned long) args[1], NULL); hw.irq = args[2]; - if (ide_register_hw(&hw, NULL, 0, NULL) == -1) + if (ide_register_hw(&hw, 0, NULL) == -1) return -EIO; return 0; } @@ -1415,9 +1397,6 @@ static int __init ide_setup(char *s) "reset", "minus6", "ata66", "minus8", "minus9", "minus10", "four", "qd65xx", "ht6560b", "cmd640_vlb", "dtc2278", "umc8672", "ali14xx", NULL }; - - hw_regs_t hwregs; - hw = s[3] - '0'; hwif = &ide_hwifs[hw]; i = match_parm(&s[4], ide_words, vals, 3); @@ -1527,9 +1506,9 @@ static int __init ide_setup(char *s) case 2: /* base,ctl */ vals[2] = 0; /* default irq = probe for it */ case 3: /* base,ctl,irq */ - memset(&hwregs, 0, sizeof(hwregs)); - ide_init_hwif_ports(&hwregs, vals[0], vals[1], &hwif->irq); - memcpy(hwif->io_ports, hwregs.io_ports, sizeof(hwif->io_ports)); + hwif->hw.irq = vals[2]; + ide_init_hwif_ports(&hwif->hw, (unsigned long) vals[0], (unsigned long) vals[1], &hwif->irq); + memcpy(hwif->io_ports, hwif->hw.io_ports, sizeof(hwif->io_ports)); hwif->irq = vals[2]; hwif->noprobe = 0; hwif->chipset = ide_forced; diff --git a/trunk/drivers/ide/legacy/ali14xx.c b/trunk/drivers/ide/legacy/ali14xx.c index 10311ecc674a..2f0ef9b44033 100644 --- a/trunk/drivers/ide/legacy/ali14xx.c +++ b/trunk/drivers/ide/legacy/ali14xx.c @@ -102,8 +102,6 @@ static void outReg (u8 data, u8 reg) outb_p(data, dataPort); } -static DEFINE_SPINLOCK(ali14xx_lock); - /* * Set PIO mode for the specified drive. * This function computes timing parameters @@ -131,14 +129,14 @@ static void ali14xx_set_pio_mode(ide_drive_t *drive, const u8 pio) /* stuff timing parameters into controller registers */ driveNum = (HWIF(drive)->index << 1) + drive->select.b.unit; - spin_lock_irqsave(&ali14xx_lock, flags); + spin_lock_irqsave(&ide_lock, flags); outb_p(regOn, basePort); outReg(param1, regTab[driveNum].reg1); outReg(param2, regTab[driveNum].reg2); outReg(param3, regTab[driveNum].reg3); outReg(param4, regTab[driveNum].reg4); outb_p(regOff, basePort); - spin_unlock_irqrestore(&ali14xx_lock, flags); + spin_unlock_irqrestore(&ide_lock, flags); } /* @@ -195,7 +193,6 @@ static int __init initRegisters (void) { static int __init ali14xx_probe(void) { ide_hwif_t *hwif, *mate; - static u8 idx[4] = { 0, 1, 0xff, 0xff }; printk(KERN_DEBUG "ali14xx: base=0x%03x, regOn=0x%02x.\n", basePort, regOn); @@ -220,7 +217,11 @@ static int __init ali14xx_probe(void) mate->mate = hwif; mate->channel = 1; - ide_device_add(idx); + probe_hwif_init(hwif); + probe_hwif_init(mate); + + ide_proc_register_port(hwif); + ide_proc_register_port(mate); return 0; } diff --git a/trunk/drivers/ide/legacy/buddha.c b/trunk/drivers/ide/legacy/buddha.c index 4a0be251a05f..101aee1711c4 100644 --- a/trunk/drivers/ide/legacy/buddha.c +++ b/trunk/drivers/ide/legacy/buddha.c @@ -212,8 +212,8 @@ void __init buddha_init(void) // xsurf_iops, IRQ_AMIGA_PORTS); } - - index = ide_register_hw(&hw, NULL, 1, &hwif); + + index = ide_register_hw(&hw, 1, &hwif); if (index != -1) { hwif->mmio = 1; printk("ide%d: ", index); diff --git a/trunk/drivers/ide/legacy/dtc2278.c b/trunk/drivers/ide/legacy/dtc2278.c index 24a845d45bd2..f16521254867 100644 --- a/trunk/drivers/ide/legacy/dtc2278.c +++ b/trunk/drivers/ide/legacy/dtc2278.c @@ -67,24 +67,20 @@ static void sub22 (char b, char c) } } -static DEFINE_SPINLOCK(dtc2278_lock); - static void dtc2278_set_pio_mode(ide_drive_t *drive, const u8 pio) { unsigned long flags; if (pio >= 3) { - spin_lock_irqsave(&dtc2278_lock, flags); + spin_lock_irqsave(&ide_lock, flags); /* * This enables PIO mode4 (3?) on the first interface */ sub22(1,0xc3); sub22(0,0xa0); - spin_unlock_irqrestore(&dtc2278_lock, flags); + spin_unlock_irqrestore(&ide_lock, flags); } else { /* we don't know how to set it back again.. */ - /* Actually we do - there is a data sheet available for the - Winbond but does anyone actually care */ } /* @@ -98,7 +94,6 @@ static int __init dtc2278_probe(void) { unsigned long flags; ide_hwif_t *hwif, *mate; - static u8 idx[4] = { 0, 1, 0xff, 0xff }; hwif = &ide_hwifs[0]; mate = &ide_hwifs[1]; @@ -134,13 +129,16 @@ static int __init dtc2278_probe(void) mate->serialized = 1; mate->chipset = ide_dtc2278; - mate->pio_mask = ATA_PIO4; mate->drives[0].no_unmask = 1; mate->drives[1].no_unmask = 1; mate->mate = hwif; mate->channel = 1; - ide_device_add(idx); + probe_hwif_init(hwif); + probe_hwif_init(mate); + + ide_proc_register_port(hwif); + ide_proc_register_port(mate); return 0; } diff --git a/trunk/drivers/ide/legacy/falconide.c b/trunk/drivers/ide/legacy/falconide.c index 7d7936f1b900..f0829b83e970 100644 --- a/trunk/drivers/ide/legacy/falconide.c +++ b/trunk/drivers/ide/legacy/falconide.c @@ -72,7 +72,7 @@ void __init falconide_init(void) 0, 0, NULL, // falconide_iops, IRQ_MFP_IDE); - index = ide_register_hw(&hw, NULL, 1, NULL); + index = ide_register_hw(&hw, 1, NULL); if (index != -1) printk("ide%d: Falcon IDE interface\n", index); diff --git a/trunk/drivers/ide/legacy/gayle.c b/trunk/drivers/ide/legacy/gayle.c index 53331ee1e957..0830a021bbb6 100644 --- a/trunk/drivers/ide/legacy/gayle.c +++ b/trunk/drivers/ide/legacy/gayle.c @@ -165,7 +165,7 @@ void __init gayle_init(void) // &gayle_iops, IRQ_AMIGA_PORTS); - index = ide_register_hw(&hw, NULL, 1, &hwif); + index = ide_register_hw(&hw, 1, &hwif); if (index != -1) { hwif->mmio = 1; switch (i) { diff --git a/trunk/drivers/ide/legacy/ht6560b.c b/trunk/drivers/ide/legacy/ht6560b.c index a4245d13f11b..2e5a9cc5c0f7 100644 --- a/trunk/drivers/ide/legacy/ht6560b.c +++ b/trunk/drivers/ide/legacy/ht6560b.c @@ -247,8 +247,6 @@ static u8 ht_pio2timings(ide_drive_t *drive, const u8 pio) } } -static DEFINE_SPINLOCK(ht6560b_lock); - /* * Enable/Disable so called prefetch mode */ @@ -256,9 +254,9 @@ static void ht_set_prefetch(ide_drive_t *drive, u8 state) { unsigned long flags; int t = HT_PREFETCH_MODE << 8; - - spin_lock_irqsave(&ht6560b_lock, flags); - + + spin_lock_irqsave(&ide_lock, flags); + /* * Prefetch mode and unmask irq seems to conflict */ @@ -270,9 +268,9 @@ static void ht_set_prefetch(ide_drive_t *drive, u8 state) drive->drive_data &= ~t; /* disable prefetch mode */ drive->no_unmask = 0; } - - spin_unlock_irqrestore(&ht6560b_lock, flags); - + + spin_unlock_irqrestore(&ide_lock, flags); + #ifdef DEBUG printk("ht6560b: drive %s prefetch mode %sabled\n", drive->name, (state ? "en" : "dis")); #endif @@ -289,14 +287,16 @@ static void ht6560b_set_pio_mode(ide_drive_t *drive, const u8 pio) ht_set_prefetch(drive, pio & 1); return; } - + timing = ht_pio2timings(drive, pio); - - spin_lock_irqsave(&ht6560b_lock, flags); + + spin_lock_irqsave(&ide_lock, flags); + drive->drive_data &= 0xff00; drive->drive_data |= timing; - spin_unlock_irqrestore(&ht6560b_lock, flags); - + + spin_unlock_irqrestore(&ide_lock, flags); + #ifdef DEBUG printk("ht6560b: drive %s tuned to pio mode %#x timing=%#x\n", drive->name, pio, timing); #endif @@ -311,7 +311,6 @@ MODULE_PARM_DESC(probe, "probe for HT6560B chipset"); int __init ht6560b_init(void) { ide_hwif_t *hwif, *mate; - static u8 idx[4] = { 0, 1, 0xff, 0xff }; int t; if (probe_ht6560b == 0) @@ -360,7 +359,11 @@ int __init ht6560b_init(void) mate->drives[0].drive_data = t; mate->drives[1].drive_data = t; - ide_device_add(idx); + probe_hwif_init(hwif); + probe_hwif_init(mate); + + ide_proc_register_port(hwif); + ide_proc_register_port(mate); return 0; diff --git a/trunk/drivers/ide/legacy/ide-cs.c b/trunk/drivers/ide/legacy/ide-cs.c index 03715c058664..e8e360c2619d 100644 --- a/trunk/drivers/ide/legacy/ide-cs.c +++ b/trunk/drivers/ide/legacy/ide-cs.c @@ -153,7 +153,7 @@ static int idecs_register(unsigned long io, unsigned long ctl, unsigned long irq hw.irq = irq; hw.chipset = ide_pci; hw.dev = &handle->dev; - return ide_register_hw(&hw, &ide_undecoded_slave, 0, NULL); + return ide_register_hw_with_fixup(&hw, 0, NULL, ide_undecoded_slave); } /*====================================================================== diff --git a/trunk/drivers/ide/legacy/ide_platform.c b/trunk/drivers/ide/legacy/ide_platform.c index 7bb79f53dac8..b992b2b91fe2 100644 --- a/trunk/drivers/ide/legacy/ide_platform.c +++ b/trunk/drivers/ide/legacy/ide_platform.c @@ -33,24 +33,39 @@ static ide_hwif_t *__devinit plat_ide_locate_hwif(void __iomem *base, int mmio) { unsigned long port = (unsigned long)base; - ide_hwif_t *hwif = ide_find_port(port); - int i; + ide_hwif_t *hwif; + int index, i; - if (hwif == NULL) - goto out; + for (index = 0; index < MAX_HWIFS; ++index) { + hwif = ide_hwifs + index; + if (hwif->io_ports[IDE_DATA_OFFSET] == port) + goto found; + } + + for (index = 0; index < MAX_HWIFS; ++index) { + hwif = ide_hwifs + index; + if (hwif->io_ports[IDE_DATA_OFFSET] == 0) + goto found; + } - hwif->io_ports[IDE_DATA_OFFSET] = port; + return NULL; + +found: + + hwif->hw.io_ports[IDE_DATA_OFFSET] = port; port += (1 << pdata->ioport_shift); for (i = IDE_ERROR_OFFSET; i <= IDE_STATUS_OFFSET; i++, port += (1 << pdata->ioport_shift)) - hwif->io_ports[i] = port; + hwif->hw.io_ports[i] = port; - hwif->io_ports[IDE_CONTROL_OFFSET] = (unsigned long)ctrl; + hwif->hw.io_ports[IDE_CONTROL_OFFSET] = (unsigned long)ctrl; - hwif->irq = irq; + memcpy(hwif->io_ports, hwif->hw.io_ports, sizeof(hwif->hw.io_ports)); + hwif->hw.irq = hwif->irq = irq; - hwif->chipset = ide_generic; + hwif->hw.dma = NO_DMA; + hwif->chipset = hwif->hw.chipset = ide_generic; if (mmio) { hwif->mmio = 1; @@ -58,8 +73,8 @@ static ide_hwif_t *__devinit plat_ide_locate_hwif(void __iomem *base, } hwif_prop.hwif = hwif; - hwif_prop.index = hwif->index; -out: + hwif_prop.index = index; + return hwif; } @@ -68,7 +83,6 @@ static int __devinit plat_ide_probe(struct platform_device *pdev) struct resource *res_base, *res_alt, *res_irq; ide_hwif_t *hwif; struct pata_platform_info *pdata; - u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; int ret = 0; int mmio = 0; @@ -116,11 +130,10 @@ static int __devinit plat_ide_probe(struct platform_device *pdev) hwif->gendev.parent = &pdev->dev; hwif->noprobe = 0; - idx[0] = hwif->index; - - ide_device_add(idx); + probe_hwif_init(hwif); platform_set_drvdata(pdev, hwif); + ide_proc_register_port(hwif); return 0; diff --git a/trunk/drivers/ide/legacy/macide.c b/trunk/drivers/ide/legacy/macide.c index e87cd2f16430..b557c45a5a9d 100644 --- a/trunk/drivers/ide/legacy/macide.c +++ b/trunk/drivers/ide/legacy/macide.c @@ -93,21 +93,21 @@ void macide_init(void) 0, 0, macide_ack_intr, // quadra_ide_iops, IRQ_NUBUS_F); - index = ide_register_hw(&hw, NULL, 1, &hwif); + index = ide_register_hw(&hw, 1, &hwif); break; case MAC_IDE_PB: ide_setup_ports(&hw, IDE_BASE, macide_offsets, 0, 0, macide_ack_intr, // macide_pb_iops, IRQ_NUBUS_C); - index = ide_register_hw(&hw, NULL, 1, &hwif); + index = ide_register_hw(&hw, 1, &hwif); break; case MAC_IDE_BABOON: ide_setup_ports(&hw, BABOON_BASE, macide_offsets, 0, 0, NULL, // macide_baboon_iops, IRQ_BABOON_1); - index = ide_register_hw(&hw, NULL, 1, &hwif); + index = ide_register_hw(&hw, 1, &hwif); if (index == -1) break; if (macintosh_config->ident == MAC_MODEL_PB190) { diff --git a/trunk/drivers/ide/legacy/q40ide.c b/trunk/drivers/ide/legacy/q40ide.c index 44cdb745a6ff..e628a983ce33 100644 --- a/trunk/drivers/ide/legacy/q40ide.c +++ b/trunk/drivers/ide/legacy/q40ide.c @@ -89,8 +89,9 @@ void q40_ide_setup_ports ( hw_regs_t *hw, else hw->io_ports[i] = Q40_ISA_IO_B(base + offsets[i]); } - + hw->irq = irq; + hw->dma = NO_DMA; hw->ack_intr = ack_intr; /* * hw->iops = iops; @@ -141,7 +142,7 @@ void q40ide_init(void) 0, NULL, // m68kide_iops, q40ide_default_irq(pcide_bases[i])); - index = ide_register_hw(&hw, NULL, 1, &hwif); + index = ide_register_hw(&hw, 1, &hwif); // **FIXME** if (index != -1) hwif->mmio = 1; diff --git a/trunk/drivers/ide/legacy/qd65xx.c b/trunk/drivers/ide/legacy/qd65xx.c index 912e73853faa..0c81d2d0b941 100644 --- a/trunk/drivers/ide/legacy/qd65xx.c +++ b/trunk/drivers/ide/legacy/qd65xx.c @@ -89,6 +89,26 @@ static int timings[4]={-1,-1,-1,-1}; /* stores current timing for each timer */ +static void qd_write_reg (u8 content, unsigned long reg) +{ + unsigned long flags; + + spin_lock_irqsave(&ide_lock, flags); + outb(content,reg); + spin_unlock_irqrestore(&ide_lock, flags); +} + +static u8 __init qd_read_reg (unsigned long reg) +{ + unsigned long flags; + u8 read; + + spin_lock_irqsave(&ide_lock, flags); + read = inb(reg); + spin_unlock_irqrestore(&ide_lock, flags); + return read; +} + /* * qd_select: * @@ -101,7 +121,7 @@ static void qd_select (ide_drive_t *drive) (QD_TIMREG(drive) & 0x02); if (timings[index] != QD_TIMING(drive)) - outb(timings[index] = QD_TIMING(drive), QD_TIMREG(drive)); + qd_write_reg(timings[index] = QD_TIMING(drive), QD_TIMREG(drive)); } /* @@ -264,7 +284,7 @@ static void qd6580_set_pio_mode(ide_drive_t *drive, const u8 pio) } if (!HWIF(drive)->channel && drive->media != ide_disk) { - outb(0x5f, QD_CONTROL_PORT); + qd_write_reg(0x5f, QD_CONTROL_PORT); printk(KERN_WARNING "%s: ATAPI: disabled read-ahead FIFO " "and post-write buffer on %s.\n", drive->name, HWIF(drive)->name); @@ -281,15 +301,16 @@ static void qd6580_set_pio_mode(ide_drive_t *drive, const u8 pio) static int __init qd_testreg(int port) { + u8 savereg; + u8 readreg; unsigned long flags; - u8 savereg, readreg; - local_irq_save(flags); + spin_lock_irqsave(&ide_lock, flags); savereg = inb_p(port); outb_p(QD_TESTVAL, port); /* safe value */ readreg = inb_p(port); outb(savereg, port); - local_irq_restore(flags); + spin_unlock_irqrestore(&ide_lock, flags); if (savereg == QD_TESTVAL) { printk(KERN_ERR "Outch ! the probe for qd65xx isn't reliable !\n"); @@ -343,13 +364,13 @@ static void __exit qd_unsetup(ide_hwif_t *hwif) if (set_pio_mode == (void *)qd6500_set_pio_mode) { // will do it for both - outb(QD6500_DEF_DATA, QD_TIMREG(&hwif->drives[0])); + qd_write_reg(QD6500_DEF_DATA, QD_TIMREG(&hwif->drives[0])); } else if (set_pio_mode == (void *)qd6580_set_pio_mode) { if (QD_CONTROL(hwif) & QD_CONTR_SEC_DISABLED) { - outb(QD6580_DEF_DATA, QD_TIMREG(&hwif->drives[0])); - outb(QD6580_DEF_DATA2, QD_TIMREG(&hwif->drives[1])); + qd_write_reg(QD6580_DEF_DATA, QD_TIMREG(&hwif->drives[0])); + qd_write_reg(QD6580_DEF_DATA2, QD_TIMREG(&hwif->drives[1])); } else { - outb(hwif->channel ? QD6580_DEF_DATA2 : QD6580_DEF_DATA, QD_TIMREG(&hwif->drives[0])); + qd_write_reg(hwif->channel ? QD6580_DEF_DATA2 : QD6580_DEF_DATA, QD_TIMREG(&hwif->drives[0])); } } else { printk(KERN_WARNING "Unknown qd65xx tuning fonction !\n"); @@ -368,11 +389,10 @@ static void __exit qd_unsetup(ide_hwif_t *hwif) static int __init qd_probe(int base) { ide_hwif_t *hwif; - u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; u8 config; u8 unit; - config = inb(QD_CONFIG_PORT); + config = qd_read_reg(QD_CONFIG_PORT); if (! ((config & QD_CONFIG_BASEPORT) >> 1 == (base == 0xb0)) ) return 1; @@ -399,9 +419,9 @@ static int __init qd_probe(int base) hwif->set_pio_mode = &qd6500_set_pio_mode; - idx[0] = unit; + probe_hwif_init(hwif); - ide_device_add(idx); + ide_proc_register_port(hwif); return 1; } @@ -416,7 +436,7 @@ static int __init qd_probe(int base) /* qd6580 found */ - control = inb(QD_CONTROL_PORT); + control = qd_read_reg(QD_CONTROL_PORT); printk(KERN_NOTICE "qd6580 at %#x\n", base); printk(KERN_DEBUG "qd6580: config=%#x, control=%#x, ID3=%u\n", @@ -433,11 +453,11 @@ static int __init qd_probe(int base) hwif->set_pio_mode = &qd6580_set_pio_mode; - idx[0] = unit; + probe_hwif_init(hwif); - ide_device_add(idx); + qd_write_reg(QD_DEF_CONTR,QD_CONTROL_PORT); - outb(QD_DEF_CONTR, QD_CONTROL_PORT); + ide_proc_register_port(hwif); return 1; } else { @@ -454,17 +474,19 @@ static int __init qd_probe(int base) hwif->set_pio_mode = &qd6580_set_pio_mode; + probe_hwif_init(hwif); + qd_setup(mate, base, config | (control << 8), QD6580_DEF_DATA2, QD6580_DEF_DATA2); mate->set_pio_mode = &qd6580_set_pio_mode; - idx[0] = 0; - idx[1] = 1; + probe_hwif_init(mate); - ide_device_add(idx); + qd_write_reg(QD_DEF_CONTR,QD_CONTROL_PORT); - outb(QD_DEF_CONTR, QD_CONTROL_PORT); + ide_proc_register_port(hwif); + ide_proc_register_port(mate); return 0; /* no other qd65xx possible */ } diff --git a/trunk/drivers/ide/legacy/umc8672.c b/trunk/drivers/ide/legacy/umc8672.c index 79577b916874..1151c92dd531 100644 --- a/trunk/drivers/ide/legacy/umc8672.c +++ b/trunk/drivers/ide/legacy/umc8672.c @@ -124,9 +124,8 @@ static void umc_set_pio_mode(ide_drive_t *drive, const u8 pio) static int __init umc8672_probe(void) { - ide_hwif_t *hwif, *mate; unsigned long flags; - static u8 idx[4] = { 0, 1, 0xff, 0xff }; + ide_hwif_t *hwif, *mate; if (!request_region(0x108, 2, "umc8672")) { printk(KERN_ERR "umc8672: ports 0x108-0x109 already in use.\n"); @@ -159,7 +158,11 @@ static int __init umc8672_probe(void) mate->mate = hwif; mate->channel = 1; - ide_device_add(idx); + probe_hwif_init(hwif); + probe_hwif_init(mate); + + ide_proc_register_port(hwif); + ide_proc_register_port(mate); return 0; } diff --git a/trunk/drivers/ide/mips/au1xxx-ide.c b/trunk/drivers/ide/mips/au1xxx-ide.c index 1de58566e5b6..2f322d7e881b 100644 --- a/trunk/drivers/ide/mips/au1xxx-ide.c +++ b/trunk/drivers/ide/mips/au1xxx-ide.c @@ -601,9 +601,8 @@ static int au_ide_probe(struct device *dev) _auide_hwif *ahwif = &auide_hwif; ide_hwif_t *hwif; struct resource *res; + hw_regs_t *hw; int ret = 0; - u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; - hw_regs_t hw; #if defined(CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA) char *mode = "MWDMA2"; @@ -645,12 +644,12 @@ static int au_ide_probe(struct device *dev) /* FIXME: This might possibly break PCMCIA IDE devices */ hwif = &ide_hwifs[pdev->id]; - hwif->irq = ahwif->irq; + hw = &hwif->hw; + hwif->irq = hw->irq = ahwif->irq; hwif->chipset = ide_au1xxx; - memset(&hw, 0, sizeof(hw)); - auide_setup_ports(&hw, ahwif); - memcpy(hwif->io_ports, hw.io_ports, sizeof(hwif->io_ports)); + auide_setup_ports(hw, ahwif); + memcpy(hwif->io_ports, hw->io_ports, sizeof(hwif->io_ports)); hwif->ultra_mask = 0x0; /* Disable Ultra DMA */ #ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA @@ -707,10 +706,8 @@ static int au_ide_probe(struct device *dev) hwif->config_data = 0; /* no chipset-specific code */ hwif->drives[0].autotune = 1; /* 1=autotune, 2=noautotune, 0=default */ - hwif->drives[1].autotune = 1; #endif - hwif->drives[0].no_io_32bit = 1; - hwif->drives[1].no_io_32bit = 1; + hwif->drives[0].no_io_32bit = 1; auide_hwif.hwif = hwif; hwif->hwif_data = &auide_hwif; @@ -720,9 +717,9 @@ static int au_ide_probe(struct device *dev) dbdma_init_done = 1; #endif - idx[0] = hwif->index; + probe_hwif_init(hwif); - ide_device_add(idx); + ide_proc_register_port(hwif); dev_set_drvdata(dev, hwif); diff --git a/trunk/drivers/ide/mips/swarm.c b/trunk/drivers/ide/mips/swarm.c index 521edd41b572..c2e29571b007 100644 --- a/trunk/drivers/ide/mips/swarm.c +++ b/trunk/drivers/ide/mips/swarm.c @@ -71,7 +71,6 @@ static int __devinit swarm_ide_probe(struct device *dev) u8 __iomem *base; phys_t offset, size; int i; - u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; if (!SIBYTE_HAVE_IDE) return -ENODEV; @@ -120,15 +119,18 @@ static int __devinit swarm_ide_probe(struct device *dev) hwif->noprobe = 0; for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) - hwif->io_ports[i] = + hwif->hw.io_ports[i] = (unsigned long)(base + ((0x1f0 + i) << 5)); - hwif->io_ports[IDE_CONTROL_OFFSET] = + hwif->hw.io_ports[IDE_CONTROL_OFFSET] = (unsigned long)(base + (0x3f6 << 5)); - hwif->irq = K_INT_GB_IDE; + hwif->hw.irq = K_INT_GB_IDE; - idx[0] = hwif->index; + memcpy(hwif->io_ports, hwif->hw.io_ports, sizeof(hwif->io_ports)); + hwif->irq = hwif->hw.irq; - ide_device_add(idx); + probe_hwif_init(hwif); + + ide_proc_register_port(hwif); dev_set_drvdata(dev, hwif); diff --git a/trunk/drivers/ide/pci/aec62xx.c b/trunk/drivers/ide/pci/aec62xx.c index 19ec421f7b9f..b3dc12a70d51 100644 --- a/trunk/drivers/ide/pci/aec62xx.c +++ b/trunk/drivers/ide/pci/aec62xx.c @@ -1,5 +1,5 @@ /* - * linux/drivers/ide/pci/aec62xx.c Version 0.27 Sep 16, 2007 + * linux/drivers/ide/pci/aec62xx.c Version 0.26 Sep 1, 2007 * * Copyright (C) 1999-2002 Andre Hedrick * Copyright (C) 2007 MontaVista Software, Inc. @@ -141,6 +141,19 @@ static void aec_set_pio_mode(ide_drive_t *drive, const u8 pio) drive->hwif->set_dma_mode(drive, pio + XFER_PIO_0); } +static void aec62xx_dma_lost_irq (ide_drive_t *drive) +{ + switch (HWIF(drive)->pci_dev->device) { + case PCI_DEVICE_ID_ARTOP_ATP860: + case PCI_DEVICE_ID_ARTOP_ATP860R: + case PCI_DEVICE_ID_ARTOP_ATP865: + case PCI_DEVICE_ID_ARTOP_ATP865R: + printk(" AEC62XX time out "); + default: + break; + } +} + static unsigned int __devinit init_chipset_aec62xx(struct pci_dev *dev, const char *name) { int bus_speed = system_bus_clock(); @@ -182,6 +195,8 @@ static void __devinit init_hwif_aec62xx(ide_hwif_t *hwif) if (hwif->dma_base == 0) return; + hwif->dma_lost_irq = &aec62xx_dma_lost_irq; + if (dev->device == PCI_DEVICE_ID_ARTOP_ATP850UF) return; @@ -194,7 +209,7 @@ static void __devinit init_hwif_aec62xx(ide_hwif_t *hwif) } } -static const struct ide_port_info aec62xx_chipsets[] __devinitdata = { +static ide_pci_device_t aec62xx_chipsets[] __devinitdata = { { /* 0 */ .name = "AEC6210", .init_chipset = init_chipset_aec62xx, @@ -253,12 +268,12 @@ static const struct ide_port_info aec62xx_chipsets[] __devinitdata = { * finds a device matching our IDE device tables. * * NOTE: since we're going to modify the 'name' field for AEC-6[26]80[R] - * chips, pass a local copy of 'struct ide_port_info' down the call chain. + * chips, pass a local copy of 'struct pci_device_id' down the call chain. */ - + static int __devinit aec62xx_init_one(struct pci_dev *dev, const struct pci_device_id *id) { - struct ide_port_info d; + ide_pci_device_t d; u8 idx = id->driver_data; d = aec62xx_chipsets[idx]; diff --git a/trunk/drivers/ide/pci/alim15x3.c b/trunk/drivers/ide/pci/alim15x3.c index a607dd31a64c..8ee2b48d105d 100644 --- a/trunk/drivers/ide/pci/alim15x3.c +++ b/trunk/drivers/ide/pci/alim15x3.c @@ -1,5 +1,5 @@ /* - * linux/drivers/ide/pci/alim15x3.c Version 0.29 Sep 16 2007 + * linux/drivers/ide/pci/alim15x3.c Version 0.27 Aug 27 2007 * * Copyright (C) 1998-2000 Michel Aubry, Maintainer * Copyright (C) 1998-2000 Andrzej Krzysztofowicz, Maintainer @@ -492,13 +492,6 @@ static unsigned int __devinit init_chipset_ali15x3 (struct pci_dev *dev, const c * clear bit 7 */ pci_write_config_byte(dev, 0x4b, tmpbyte & 0x7F); - /* - * check m1533, 0x5e, bit 1~4 == 1001 => & 00011110 = 00010010 - */ - if (m5229_revision >= 0x20 && isa_dev) { - pci_read_config_byte(isa_dev, 0x5e, &tmpbyte); - chip_is_1543c_e = ((tmpbyte & 0x1e) == 0x12) ? 1: 0; - } goto out; } @@ -544,30 +537,7 @@ static unsigned int __devinit init_chipset_ali15x3 (struct pci_dev *dev, const c pci_write_config_byte(isa_dev, 0x79, tmpbyte | 0x02); } } - out: - /* - * CD_ROM DMA on (m5229, 0x53, bit0) - * Enable this bit even if we want to use PIO. - * PIO FIFO off (m5229, 0x53, bit1) - * The hardware will use 0x54h and 0x55h to control PIO FIFO. - * (Not on later devices it seems) - * - * 0x53 changes meaning on later revs - we must no touch - * bit 1 on them. Need to check if 0x20 is the right break. - */ - if (m5229_revision >= 0x20) { - pci_read_config_byte(dev, 0x53, &tmpbyte); - - if (m5229_revision <= 0x20) - tmpbyte = (tmpbyte & (~0x02)) | 0x01; - else if (m5229_revision == 0xc7 || m5229_revision == 0xc8) - tmpbyte |= 0x03; - else - tmpbyte |= 0x01; - - pci_write_config_byte(dev, 0x53, tmpbyte); - } pci_dev_put(north); pci_dev_put(isa_dev); local_irq_restore(flags); @@ -646,8 +616,36 @@ static u8 __devinit ata66_ali15x3(ide_hwif_t *hwif) if ((tmpbyte & (1 << hwif->channel)) == 0) cbl = ATA_CBL_PATA80; } + } else { + /* + * check m1533, 0x5e, bit 1~4 == 1001 => & 00011110 = 00010010 + */ + pci_read_config_byte(isa_dev, 0x5e, &tmpbyte); + chip_is_1543c_e = ((tmpbyte & 0x1e) == 0x12) ? 1: 0; } + /* + * CD_ROM DMA on (m5229, 0x53, bit0) + * Enable this bit even if we want to use PIO + * PIO FIFO off (m5229, 0x53, bit1) + * The hardware will use 0x54h and 0x55h to control PIO FIFO + * (Not on later devices it seems) + * + * 0x53 changes meaning on later revs - we must no touch + * bit 1 on them. Need to check if 0x20 is the right break + */ + + pci_read_config_byte(dev, 0x53, &tmpbyte); + + if(m5229_revision <= 0x20) + tmpbyte = (tmpbyte & (~0x02)) | 0x01; + else if (m5229_revision == 0xc7 || m5229_revision == 0xc8) + tmpbyte |= 0x03; + else + tmpbyte |= 0x01; + + pci_write_config_byte(dev, 0x53, tmpbyte); + local_irq_restore(flags); return cbl; @@ -666,9 +664,31 @@ static void __devinit init_hwif_common_ali15x3 (ide_hwif_t *hwif) hwif->set_dma_mode = &ali_set_dma_mode; hwif->udma_filter = &ali_udma_filter; + /* don't use LBA48 DMA on ALi devices before rev 0xC5 */ + if (m5229_revision <= 0xC4) + hwif->host_flags |= IDE_HFLAG_NO_LBA48_DMA; + if (hwif->dma_base == 0) return; + /* + * check in ->init_dma guarantees m5229_revision >= 0x20 here + */ + + if (m5229_revision == 0x20) + hwif->host_flags |= IDE_HFLAG_NO_ATAPI_DMA; + + if (m5229_revision <= 0x20) + hwif->ultra_mask = 0x00; /* no udma */ + else if (m5229_revision < 0xC2) + hwif->ultra_mask = ATA_UDMA2; + else if (m5229_revision == 0xC2 || m5229_revision == 0xC3) + hwif->ultra_mask = ATA_UDMA4; + else if (m5229_revision == 0xC4) + hwif->ultra_mask = ATA_UDMA5; + else + hwif->ultra_mask = ATA_UDMA6; + hwif->dma_setup = &ali15x3_dma_setup; if (hwif->cbl != ATA_CBL_PATA40_SHORT) @@ -746,7 +766,7 @@ static void __devinit init_dma_ali15x3 (ide_hwif_t *hwif, unsigned long dmabase) ide_setup_dma(hwif, dmabase, 8); } -static const struct ide_port_info ali15x3_chipset __devinitdata = { +static ide_pci_device_t ali15x3_chipset __devinitdata = { .name = "ALI15X3", .init_chipset = init_chipset_ali15x3, .init_hwif = init_hwif_ali15x3, @@ -772,34 +792,15 @@ static int __devinit alim15x3_init_one(struct pci_dev *dev, const struct pci_dev { }, }; - struct ide_port_info d = ali15x3_chipset; - u8 rev = dev->revision; + ide_pci_device_t *d = &ali15x3_chipset; if (pci_dev_present(ati_rs100)) printk(KERN_WARNING "alim15x3: ATI Radeon IGP Northbridge is not yet fully tested.\n"); - /* don't use LBA48 DMA on ALi devices before rev 0xC5 */ - if (rev <= 0xC4) - d.host_flags |= IDE_HFLAG_NO_LBA48_DMA; - - if (rev >= 0x20) { - if (rev == 0x20) - d.host_flags |= IDE_HFLAG_NO_ATAPI_DMA; - - if (rev < 0xC2) - d.udma_mask = ATA_UDMA2; - else if (rev == 0xC2 || rev == 0xC3) - d.udma_mask = ATA_UDMA4; - else if (rev == 0xC4) - d.udma_mask = ATA_UDMA5; - else - d.udma_mask = ATA_UDMA6; - } - #if defined(CONFIG_SPARC64) - d.init_hwif = init_hwif_common_ali15x3; + d->init_hwif = init_hwif_common_ali15x3; #endif /* CONFIG_SPARC64 */ - return ide_setup_pci_device(dev, &d); + return ide_setup_pci_device(dev, d); } diff --git a/trunk/drivers/ide/pci/amd74xx.c b/trunk/drivers/ide/pci/amd74xx.c index 8d4125ec252c..7cafefbf6c1b 100644 --- a/trunk/drivers/ide/pci/amd74xx.c +++ b/trunk/drivers/ide/pci/amd74xx.c @@ -77,7 +77,7 @@ static struct amd_ide_chip { }; static struct amd_ide_chip *amd_config; -static const struct ide_port_info *amd_chipset; +static ide_pci_device_t *amd_chipset; static unsigned int amd_80w; static unsigned int amd_clock; @@ -242,12 +242,19 @@ static unsigned int __devinit init_chipset_amd74xx(struct pci_dev *dev, const ch static void __devinit init_hwif_amd74xx(ide_hwif_t *hwif) { + int i; + if (hwif->irq == 0) /* 0 is bogus but will do for now */ hwif->irq = pci_get_legacy_ide_irq(hwif->pci_dev, hwif->channel); hwif->set_pio_mode = &amd_set_pio_mode; hwif->set_dma_mode = &amd_set_drive; + for (i = 0; i < 2; i++) { + hwif->drives[i].io_32bit = 1; + hwif->drives[i].unmask = 1; + } + if (!hwif->dma_base) return; @@ -263,21 +270,16 @@ static void __devinit init_hwif_amd74xx(ide_hwif_t *hwif) } } -#define IDE_HFLAGS_AMD \ - (IDE_HFLAG_PIO_NO_BLACKLIST | \ - IDE_HFLAG_PIO_NO_DOWNGRADE | \ - IDE_HFLAG_POST_SET_MODE | \ - IDE_HFLAG_IO_32BIT | \ - IDE_HFLAG_UNMASK_IRQS | \ - IDE_HFLAG_BOOTABLE) - #define DECLARE_AMD_DEV(name_str) \ { \ .name = name_str, \ .init_chipset = init_chipset_amd74xx, \ .init_hwif = init_hwif_amd74xx, \ .enablebits = {{0x40,0x02,0x02}, {0x40,0x01,0x01}}, \ - .host_flags = IDE_HFLAGS_AMD, \ + .host_flags = IDE_HFLAG_PIO_NO_BLACKLIST | \ + IDE_HFLAG_PIO_NO_DOWNGRADE | \ + IDE_HFLAG_POST_SET_MODE | \ + IDE_HFLAG_BOOTABLE, \ .pio_mask = ATA_PIO5, \ .swdma_mask = ATA_SWDMA2, \ .mwdma_mask = ATA_MWDMA2, \ @@ -289,13 +291,16 @@ static void __devinit init_hwif_amd74xx(ide_hwif_t *hwif) .init_chipset = init_chipset_amd74xx, \ .init_hwif = init_hwif_amd74xx, \ .enablebits = {{0x50,0x02,0x02}, {0x50,0x01,0x01}}, \ - .host_flags = IDE_HFLAGS_AMD, \ + .host_flags = IDE_HFLAG_PIO_NO_BLACKLIST | \ + IDE_HFLAG_PIO_NO_DOWNGRADE | \ + IDE_HFLAG_POST_SET_MODE | \ + IDE_HFLAG_BOOTABLE, \ .pio_mask = ATA_PIO5, \ .swdma_mask = ATA_SWDMA2, \ .mwdma_mask = ATA_MWDMA2, \ } -static const struct ide_port_info amd74xx_chipsets[] __devinitdata = { +static ide_pci_device_t amd74xx_chipsets[] __devinitdata = { /* 0 */ DECLARE_AMD_DEV("AMD7401"), /* 1 */ DECLARE_AMD_DEV("AMD7409"), /* 2 */ DECLARE_AMD_DEV("AMD7411"), diff --git a/trunk/drivers/ide/pci/atiixp.c b/trunk/drivers/ide/pci/atiixp.c index ef8e0164ef7a..307843053078 100644 --- a/trunk/drivers/ide/pci/atiixp.c +++ b/trunk/drivers/ide/pci/atiixp.c @@ -189,7 +189,8 @@ static void __devinit init_hwif_atiixp(ide_hwif_t *hwif) hwif->dma_host_off = &atiixp_dma_host_off; } -static const struct ide_port_info atiixp_pci_info[] __devinitdata = { + +static ide_pci_device_t atiixp_pci_info[] __devinitdata = { { /* 0 */ .name = "ATIIXP", .init_hwif = init_hwif_atiixp, diff --git a/trunk/drivers/ide/pci/cmd640.c b/trunk/drivers/ide/pci/cmd640.c index 4aa48104e0c1..f369645e4d16 100644 --- a/trunk/drivers/ide/pci/cmd640.c +++ b/trunk/drivers/ide/pci/cmd640.c @@ -185,8 +185,6 @@ static u8 recovery_counts[4] = {16, 16, 16, 16}; /* Recovery count (encoded) */ #endif /* CONFIG_BLK_DEV_CMD640_ENHANCED */ -static DEFINE_SPINLOCK(cmd640_lock); - /* * These are initialized to point at the devices we control */ @@ -260,12 +258,12 @@ static u8 get_cmd640_reg_vlb (u16 reg) static u8 get_cmd640_reg(u16 reg) { - unsigned long flags; u8 b; + unsigned long flags; - spin_lock_irqsave(&cmd640_lock, flags); + spin_lock_irqsave(&ide_lock, flags); b = __get_cmd640_reg(reg); - spin_unlock_irqrestore(&cmd640_lock, flags); + spin_unlock_irqrestore(&ide_lock, flags); return b; } @@ -273,9 +271,9 @@ static void put_cmd640_reg(u16 reg, u8 val) { unsigned long flags; - spin_lock_irqsave(&cmd640_lock, flags); + spin_lock_irqsave(&ide_lock, flags); __put_cmd640_reg(reg,val); - spin_unlock_irqrestore(&cmd640_lock, flags); + spin_unlock_irqrestore(&ide_lock, flags); } static int __init match_pci_cmd640_device (void) @@ -353,7 +351,7 @@ static int __init secondary_port_responding (void) { unsigned long flags; - spin_lock_irqsave(&cmd640_lock, flags); + spin_lock_irqsave(&ide_lock, flags); outb_p(0x0a, 0x170 + IDE_SELECT_OFFSET); /* select drive0 */ udelay(100); @@ -361,11 +359,11 @@ static int __init secondary_port_responding (void) outb_p(0x1a, 0x170 + IDE_SELECT_OFFSET); /* select drive1 */ udelay(100); if ((inb_p(0x170 + IDE_SELECT_OFFSET) & 0x1f) != 0x1a) { - spin_unlock_irqrestore(&cmd640_lock, flags); + spin_unlock_irqrestore(&ide_lock, flags); return 0; /* nothing responded */ } } - spin_unlock_irqrestore(&cmd640_lock, flags); + spin_unlock_irqrestore(&ide_lock, flags); return 1; /* success */ } @@ -442,11 +440,11 @@ static void __init setup_device_ptrs (void) static void set_prefetch_mode (unsigned int index, int mode) { ide_drive_t *drive = cmd_drives[index]; - unsigned long flags; int reg = prefetch_regs[index]; u8 b; + unsigned long flags; - spin_lock_irqsave(&cmd640_lock, flags); + spin_lock_irqsave(&ide_lock, flags); b = __get_cmd640_reg(reg); if (mode) { /* want prefetch on? */ #if CMD640_PREFETCH_MASKS @@ -462,7 +460,7 @@ static void set_prefetch_mode (unsigned int index, int mode) b |= prefetch_masks[index]; /* disable prefetch */ } __put_cmd640_reg(reg, b); - spin_unlock_irqrestore(&cmd640_lock, flags); + spin_unlock_irqrestore(&ide_lock, flags); } /* @@ -563,7 +561,7 @@ static void program_drive_counts (unsigned int index) /* * Now that everything is ready, program the new timings */ - spin_lock_irqsave(&cmd640_lock, flags); + spin_lock_irqsave(&ide_lock, flags); /* * Program the address_setup clocks into ARTTIM reg, * and then the active/recovery counts into the DRWTIM reg @@ -572,7 +570,7 @@ static void program_drive_counts (unsigned int index) setup_count |= __get_cmd640_reg(arttim_regs[index]) & 0x3f; __put_cmd640_reg(arttim_regs[index], setup_count); __put_cmd640_reg(drwtim_regs[index], pack_nibbles(active_count, recovery_count)); - spin_unlock_irqrestore(&cmd640_lock, flags); + spin_unlock_irqrestore(&ide_lock, flags); } /* @@ -672,20 +670,20 @@ static void cmd640_set_pio_mode(ide_drive_t *drive, const u8 pio) static int pci_conf1(void) { - unsigned long flags; u32 tmp; + unsigned long flags; - spin_lock_irqsave(&cmd640_lock, flags); + spin_lock_irqsave(&ide_lock, flags); outb(0x01, 0xCFB); tmp = inl(0xCF8); outl(0x80000000, 0xCF8); if (inl(0xCF8) == 0x80000000) { outl(tmp, 0xCF8); - spin_unlock_irqrestore(&cmd640_lock, flags); + spin_unlock_irqrestore(&ide_lock, flags); return 1; } outl(tmp, 0xCF8); - spin_unlock_irqrestore(&cmd640_lock, flags); + spin_unlock_irqrestore(&ide_lock, flags); return 0; } @@ -693,15 +691,15 @@ static int pci_conf2(void) { unsigned long flags; - spin_lock_irqsave(&cmd640_lock, flags); + spin_lock_irqsave(&ide_lock, flags); outb(0x00, 0xCFB); outb(0x00, 0xCF8); outb(0x00, 0xCFA); if (inb(0xCF8) == 0x00 && inb(0xCF8) == 0x00) { - spin_unlock_irqrestore(&cmd640_lock, flags); + spin_unlock_irqrestore(&ide_lock, flags); return 1; } - spin_unlock_irqrestore(&cmd640_lock, flags); + spin_unlock_irqrestore(&ide_lock, flags); return 0; } diff --git a/trunk/drivers/ide/pci/cmd64x.c b/trunk/drivers/ide/pci/cmd64x.c index ea0143ef5fe5..adee2ef6fd71 100644 --- a/trunk/drivers/ide/pci/cmd64x.c +++ b/trunk/drivers/ide/pci/cmd64x.c @@ -535,6 +535,7 @@ static void __devinit init_hwif_cmd64x(ide_hwif_t *hwif) hwif->ide_dma_test_irq = &cmd648_ide_dma_test_irq; break; case PCI_DEVICE_ID_CMD_646: + hwif->chipset = ide_cmd646; if (dev->revision == 0x01) { hwif->ide_dma_end = &cmd646_1_ide_dma_end; break; @@ -548,7 +549,7 @@ static void __devinit init_hwif_cmd64x(ide_hwif_t *hwif) } } -static const struct ide_port_info cmd64x_chipsets[] __devinitdata = { +static ide_pci_device_t cmd64x_chipsets[] __devinitdata = { { /* 0 */ .name = "CMD643", .init_chipset = init_chipset_cmd64x, @@ -572,7 +573,6 @@ static const struct ide_port_info cmd64x_chipsets[] __devinitdata = { .init_chipset = init_chipset_cmd64x, .init_hwif = init_hwif_cmd64x, .enablebits = {{0x51,0x04,0x04}, {0x51,0x08,0x08}}, - .chipset = ide_cmd646, .host_flags = IDE_HFLAG_ABUSE_PREFETCH | IDE_HFLAG_BOOTABLE, .pio_mask = ATA_PIO5, .mwdma_mask = ATA_MWDMA2, @@ -591,7 +591,7 @@ static const struct ide_port_info cmd64x_chipsets[] __devinitdata = { static int __devinit cmd64x_init_one(struct pci_dev *dev, const struct pci_device_id *id) { - struct ide_port_info d; + ide_pci_device_t d; u8 idx = id->driver_data; d = cmd64x_chipsets[idx]; diff --git a/trunk/drivers/ide/pci/cs5520.c b/trunk/drivers/ide/pci/cs5520.c index 0466462fd21b..aa98e817d385 100644 --- a/trunk/drivers/ide/pci/cs5520.c +++ b/trunk/drivers/ide/pci/cs5520.c @@ -141,7 +141,7 @@ static void __devinit init_hwif_cs5520(ide_hwif_t *hwif) .pio_mask = ATA_PIO4, \ } -static const struct ide_port_info cyrix_chipsets[] __devinitdata = { +static ide_pci_device_t cyrix_chipsets[] __devinitdata = { /* 0 */ DECLARE_CS_DEV("Cyrix 5510"), /* 1 */ DECLARE_CS_DEV("Cyrix 5520") }; @@ -154,8 +154,9 @@ static const struct ide_port_info cyrix_chipsets[] __devinitdata = { static int __devinit cs5520_init_one(struct pci_dev *dev, const struct pci_device_id *id) { - const struct ide_port_info *d = &cyrix_chipsets[id->driver_data]; - u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; + ide_hwif_t *hwif = NULL, *mate = NULL; + ata_index_t index; + ide_pci_device_t *d = &cyrix_chipsets[id->driver_data]; ide_setup_pci_noise(dev, d); @@ -171,14 +172,29 @@ static int __devinit cs5520_init_one(struct pci_dev *dev, const struct pci_devic return -ENODEV; } + index.all = 0xf0f0; + /* * Now the chipset is configured we can let the core * do all the device setup for us */ - ide_pci_setup_ports(dev, d, 14, &idx[0]); + ide_pci_setup_ports(dev, d, 14, &index); + + if ((index.b.low & 0xf0) != 0xf0) + hwif = &ide_hwifs[index.b.low]; + if ((index.b.high & 0xf0) != 0xf0) + mate = &ide_hwifs[index.b.high]; + + if (hwif) + probe_hwif_init(hwif); + if (mate) + probe_hwif_init(mate); - ide_device_add(idx); + if (hwif) + ide_proc_register_port(hwif); + if (mate) + ide_proc_register_port(mate); return 0; } diff --git a/trunk/drivers/ide/pci/cs5530.c b/trunk/drivers/ide/pci/cs5530.c index 599408952bd4..ba0c6eba024b 100644 --- a/trunk/drivers/ide/pci/cs5530.c +++ b/trunk/drivers/ide/pci/cs5530.c @@ -1,5 +1,5 @@ /* - * linux/drivers/ide/pci/cs5530.c Version 0.77 Sep 24 2007 + * linux/drivers/ide/pci/cs5530.c Version 0.76 Aug 3 2007 * * Copyright (C) 2000 Andre Hedrick * Copyright (C) 2000 Mark Lord @@ -146,6 +146,7 @@ static void cs5530_set_dma_mode(ide_drive_t *drive, const u8 mode) static unsigned int __devinit init_chipset_cs5530 (struct pci_dev *dev, const char *name) { struct pci_dev *master_0 = NULL, *cs5530_0 = NULL; + unsigned long flags; if (pci_resource_start(dev, 4) == 0) return -EFAULT; @@ -170,6 +171,9 @@ static unsigned int __devinit init_chipset_cs5530 (struct pci_dev *dev, const ch goto out; } + spin_lock_irqsave(&ide_lock, flags); + /* all CPUs (there should only be one CPU with this chipset) */ + /* * Enable BusMaster and MemoryWriteAndInvalidate for the cs5530: * --> OR 0x14 into 16-bit PCI COMMAND reg of function 0 of the cs5530 @@ -220,6 +224,8 @@ static unsigned int __devinit init_chipset_cs5530 (struct pci_dev *dev, const ch pci_write_config_byte(master_0, 0x42, 0x00); pci_write_config_byte(master_0, 0x43, 0xc1); + spin_unlock_irqrestore(&ide_lock, flags); + out: pci_dev_put(master_0); pci_dev_put(cs5530_0); @@ -255,7 +261,7 @@ static void __devinit init_hwif_cs5530 (ide_hwif_t *hwif) hwif->udma_filter = cs5530_udma_filter; } -static const struct ide_port_info cs5530_chipset __devinitdata = { +static ide_pci_device_t cs5530_chipset __devinitdata = { .name = "CS5530", .init_chipset = init_chipset_cs5530, .init_hwif = init_hwif_cs5530, diff --git a/trunk/drivers/ide/pci/cs5535.c b/trunk/drivers/ide/pci/cs5535.c index 9094916e3780..5ac82ffa5c09 100644 --- a/trunk/drivers/ide/pci/cs5535.c +++ b/trunk/drivers/ide/pci/cs5535.c @@ -186,7 +186,7 @@ static void __devinit init_hwif_cs5535(ide_hwif_t *hwif) hwif->cbl = cs5535_cable_detect(hwif->pci_dev); } -static const struct ide_port_info cs5535_chipset __devinitdata = { +static ide_pci_device_t cs5535_chipset __devinitdata = { .name = "CS5535", .init_hwif = init_hwif_cs5535, .host_flags = IDE_HFLAG_SINGLE | IDE_HFLAG_POST_SET_MODE | diff --git a/trunk/drivers/ide/pci/cy82c693.c b/trunk/drivers/ide/pci/cy82c693.c index 3ef4fc10fe2c..efc20bd97fd5 100644 --- a/trunk/drivers/ide/pci/cy82c693.c +++ b/trunk/drivers/ide/pci/cy82c693.c @@ -428,6 +428,7 @@ static unsigned int __devinit init_chipset_cy82c693(struct pci_dev *dev, const c */ static void __devinit init_hwif_cy82c693(ide_hwif_t *hwif) { + hwif->chipset = ide_cy82c693; hwif->set_pio_mode = &cy82c693_set_pio_mode; if (hwif->dma_base == 0) @@ -448,12 +449,11 @@ static void __devinit init_iops_cy82c693(ide_hwif_t *hwif) } } -static const struct ide_port_info cy82c693_chipset __devinitdata = { +static ide_pci_device_t cy82c693_chipset __devinitdata = { .name = "CY82C693", .init_chipset = init_chipset_cy82c693, .init_iops = init_iops_cy82c693, .init_hwif = init_hwif_cy82c693, - .chipset = ide_cy82c693, .host_flags = IDE_HFLAG_SINGLE | IDE_HFLAG_TRUST_BIOS_FOR_DMA | IDE_HFLAG_BOOTABLE, .pio_mask = ATA_PIO4, diff --git a/trunk/drivers/ide/pci/delkin_cb.c b/trunk/drivers/ide/pci/delkin_cb.c index 83829081640a..46f4a888c037 100644 --- a/trunk/drivers/ide/pci/delkin_cb.c +++ b/trunk/drivers/ide/pci/delkin_cb.c @@ -80,7 +80,7 @@ delkin_cb_probe (struct pci_dev *dev, const struct pci_device_id *id) hw.irq = dev->irq; hw.chipset = ide_pci; /* this enables IRQ sharing */ - rc = ide_register_hw(&hw, &ide_undecoded_slave, 0, &hwif); + rc = ide_register_hw_with_fixup(&hw, 0, &hwif, ide_undecoded_slave); if (rc < 0) { printk(KERN_ERR "delkin_cb: ide_register_hw failed (%d)\n", rc); pci_disable_device(dev); diff --git a/trunk/drivers/ide/pci/generic.c b/trunk/drivers/ide/pci/generic.c index f44d70852c3c..51165832e7f2 100644 --- a/trunk/drivers/ide/pci/generic.c +++ b/trunk/drivers/ide/pci/generic.c @@ -54,24 +54,37 @@ __setup("all-generic-ide", ide_generic_all_on); module_param_named(all_generic_ide, ide_generic_all, bool, 0444); MODULE_PARM_DESC(all_generic_ide, "IDE generic will claim all unknown PCI IDE storage controllers."); -#define IDE_HFLAGS_UMC (IDE_HFLAG_NO_DMA | IDE_HFLAG_FORCE_LEGACY_IRQS) +static void __devinit init_hwif_generic (ide_hwif_t *hwif) +{ + switch(hwif->pci_dev->device) { + case PCI_DEVICE_ID_UMC_UM8673F: + case PCI_DEVICE_ID_UMC_UM8886A: + case PCI_DEVICE_ID_UMC_UM8886BF: + hwif->irq = hwif->channel ? 15 : 14; + break; + default: + break; + } +} -#define DECLARE_GENERIC_PCI_DEV(name_str, extra_flags) \ +#define DECLARE_GENERIC_PCI_DEV(name_str, dma_setting) \ { \ .name = name_str, \ + .init_hwif = init_hwif_generic, \ .host_flags = IDE_HFLAG_TRUST_BIOS_FOR_DMA | \ - extra_flags | \ + dma_setting | \ IDE_HFLAG_BOOTABLE, \ .swdma_mask = ATA_SWDMA2, \ .mwdma_mask = ATA_MWDMA2, \ .udma_mask = ATA_UDMA6, \ } -static const struct ide_port_info generic_chipsets[] __devinitdata = { +static ide_pci_device_t generic_chipsets[] __devinitdata = { /* 0 */ DECLARE_GENERIC_PCI_DEV("Unknown", 0), { /* 1 */ .name = "NS87410", + .init_hwif = init_hwif_generic, .enablebits = {{0x43,0x08,0x08}, {0x47,0x08,0x08}}, .host_flags = IDE_HFLAG_TRUST_BIOS_FOR_DMA | IDE_HFLAG_BOOTABLE, @@ -82,15 +95,16 @@ static const struct ide_port_info generic_chipsets[] __devinitdata = { /* 2 */ DECLARE_GENERIC_PCI_DEV("SAMURAI", 0), /* 3 */ DECLARE_GENERIC_PCI_DEV("HT6565", 0), - /* 4 */ DECLARE_GENERIC_PCI_DEV("UM8673F", IDE_HFLAGS_UMC), - /* 5 */ DECLARE_GENERIC_PCI_DEV("UM8886A", IDE_HFLAGS_UMC), - /* 6 */ DECLARE_GENERIC_PCI_DEV("UM8886BF", IDE_HFLAGS_UMC), + /* 4 */ DECLARE_GENERIC_PCI_DEV("UM8673F", IDE_HFLAG_NO_DMA), + /* 5 */ DECLARE_GENERIC_PCI_DEV("UM8886A", IDE_HFLAG_NO_DMA), + /* 6 */ DECLARE_GENERIC_PCI_DEV("UM8886BF", IDE_HFLAG_NO_DMA), /* 7 */ DECLARE_GENERIC_PCI_DEV("HINT_IDE", 0), /* 8 */ DECLARE_GENERIC_PCI_DEV("VIA_IDE", IDE_HFLAG_NO_AUTODMA), /* 9 */ DECLARE_GENERIC_PCI_DEV("OPTI621V", IDE_HFLAG_NO_AUTODMA), { /* 10 */ .name = "VIA8237SATA", + .init_hwif = init_hwif_generic, .host_flags = IDE_HFLAG_TRUST_BIOS_FOR_DMA | IDE_HFLAG_OFF_BOARD, .swdma_mask = ATA_SWDMA2, @@ -104,6 +118,7 @@ static const struct ide_port_info generic_chipsets[] __devinitdata = { { /* 14 */ .name = "Revolution", + .init_hwif = init_hwif_generic, .host_flags = IDE_HFLAG_TRUST_BIOS_FOR_DMA | IDE_HFLAG_OFF_BOARD, .swdma_mask = ATA_SWDMA2, @@ -123,7 +138,7 @@ static const struct ide_port_info generic_chipsets[] __devinitdata = { static int __devinit generic_init_one(struct pci_dev *dev, const struct pci_device_id *id) { - const struct ide_port_info *d = &generic_chipsets[id->driver_data]; + ide_pci_device_t *d = &generic_chipsets[id->driver_data]; int ret = -ENODEV; /* Don't use the generic entry unless instructed to do so */ diff --git a/trunk/drivers/ide/pci/hpt34x.c b/trunk/drivers/ide/pci/hpt34x.c index ae6307fae4f9..67af1a7dde30 100644 --- a/trunk/drivers/ide/pci/hpt34x.c +++ b/trunk/drivers/ide/pci/hpt34x.c @@ -129,7 +129,7 @@ static void __devinit init_hwif_hpt34x(ide_hwif_t *hwif) hwif->set_dma_mode = &hpt34x_set_mode; } -static const struct ide_port_info hpt34x_chipsets[] __devinitdata = { +static ide_pci_device_t hpt34x_chipsets[] __devinitdata = { { /* 0 */ .name = "HPT343", .init_chipset = init_chipset_hpt34x, @@ -158,7 +158,7 @@ static const struct ide_port_info hpt34x_chipsets[] __devinitdata = { static int __devinit hpt34x_init_one(struct pci_dev *dev, const struct pci_device_id *id) { - const struct ide_port_info *d; + ide_pci_device_t *d; u16 pcicmd = 0; pci_read_config_word(dev, PCI_COMMAND, &pcicmd); diff --git a/trunk/drivers/ide/pci/hpt366.c b/trunk/drivers/ide/pci/hpt366.c index 612b795241bf..18f5b7ddaee6 100644 --- a/trunk/drivers/ide/pci/hpt366.c +++ b/trunk/drivers/ide/pci/hpt366.c @@ -1425,7 +1425,7 @@ static int __devinit hpt36x_init(struct pci_dev *dev, struct pci_dev *dev2) return 0; } -static const struct ide_port_info hpt366_chipsets[] __devinitdata = { +static ide_pci_device_t hpt366_chipsets[] __devinitdata = { { /* 0 */ .name = "HPT36x", .init_chipset = init_chipset_hpt366, @@ -1510,7 +1510,7 @@ static int __devinit hpt366_init_one(struct pci_dev *dev, const struct pci_devic { struct hpt_info *info = NULL; struct pci_dev *dev2 = NULL; - struct ide_port_info d; + ide_pci_device_t d; u8 idx = id->driver_data; u8 rev = dev->revision; diff --git a/trunk/drivers/ide/pci/it8213.c b/trunk/drivers/ide/pci/it8213.c index 90b52ed37bfc..dfbe605120cb 100644 --- a/trunk/drivers/ide/pci/it8213.c +++ b/trunk/drivers/ide/pci/it8213.c @@ -193,7 +193,7 @@ static void __devinit init_hwif_it8213(ide_hwif_t *hwif) .udma_mask = ATA_UDMA6, \ } -static const struct ide_port_info it8213_chipsets[] __devinitdata = { +static ide_pci_device_t it8213_chipsets[] __devinitdata = { /* 0 */ DECLARE_ITE_DEV("IT8213"), }; diff --git a/trunk/drivers/ide/pci/it821x.c b/trunk/drivers/ide/pci/it821x.c index 1a7ddd12e65c..ec45b7247209 100644 --- a/trunk/drivers/ide/pci/it821x.c +++ b/trunk/drivers/ide/pci/it821x.c @@ -638,7 +638,7 @@ static unsigned int __devinit init_chipset_it821x(struct pci_dev *dev, const cha .pio_mask = ATA_PIO4, \ } -static const struct ide_port_info it821x_chipsets[] __devinitdata = { +static ide_pci_device_t it821x_chipsets[] __devinitdata = { /* 0 */ DECLARE_ITE_DEV("IT8212"), }; diff --git a/trunk/drivers/ide/pci/jmicron.c b/trunk/drivers/ide/pci/jmicron.c index bdf64d997708..2eeff670d9a6 100644 --- a/trunk/drivers/ide/pci/jmicron.c +++ b/trunk/drivers/ide/pci/jmicron.c @@ -118,7 +118,7 @@ static void __devinit init_hwif_jmicron(ide_hwif_t *hwif) hwif->cbl = ata66_jmicron(hwif); } -static const struct ide_port_info jmicron_chipset __devinitdata = { +static ide_pci_device_t jmicron_chipset __devinitdata = { .name = "JMB", .init_hwif = init_hwif_jmicron, .host_flags = IDE_HFLAG_BOOTABLE, diff --git a/trunk/drivers/ide/pci/ns87415.c b/trunk/drivers/ide/pci/ns87415.c index d4df4642dbb5..d21b58923829 100644 --- a/trunk/drivers/ide/pci/ns87415.c +++ b/trunk/drivers/ide/pci/ns87415.c @@ -260,7 +260,7 @@ static void __devinit init_hwif_ns87415 (ide_hwif_t *hwif) hwif->ide_dma_end = &ns87415_ide_dma_end; } -static const struct ide_port_info ns87415_chipset __devinitdata = { +static ide_pci_device_t ns87415_chipset __devinitdata = { .name = "NS87415", #ifdef CONFIG_SUPERIO .init_iops = init_iops_ns87415, diff --git a/trunk/drivers/ide/pci/opti621.c b/trunk/drivers/ide/pci/opti621.c index 8953d9c3926f..3573ffeaaa34 100644 --- a/trunk/drivers/ide/pci/opti621.c +++ b/trunk/drivers/ide/pci/opti621.c @@ -1,5 +1,5 @@ /* - * linux/drivers/ide/pci/opti621.c Version 0.9 Sep 24, 2007 + * linux/drivers/ide/pci/opti621.c Version 0.8 Aug 27, 2007 * * Copyright (C) 1996-1998 Linus Torvalds & authors (see below) */ @@ -133,8 +133,6 @@ static int reg_base; #define PIO_NOT_EXIST 254 #define PIO_DONT_KNOW 255 -static DEFINE_SPINLOCK(opti621_lock); - /* there are stored pio numbers from other calls of opti621_set_pio_mode */ static void compute_pios(ide_drive_t *drive, const u8 pio) /* Store values into drive->drive_data @@ -280,7 +278,7 @@ static void opti621_set_pio_mode(ide_drive_t *drive, const u8 pio) second.recovery_time, drdy); #endif - spin_lock_irqsave(&opti621_lock, flags); + spin_lock_irqsave(&ide_lock, flags); reg_base = hwif->io_ports[IDE_DATA_OFFSET]; @@ -319,7 +317,7 @@ static void opti621_set_pio_mode(ide_drive_t *drive, const u8 pio) /* and read prefetch for both drives */ write_reg(misc, MISC_REG); - spin_unlock_irqrestore(&opti621_lock, flags); + spin_unlock_irqrestore(&ide_lock, flags); } /* @@ -333,7 +331,7 @@ static void __devinit init_hwif_opti621 (ide_hwif_t *hwif) hwif->set_pio_mode = &opti621_set_pio_mode; } -static const struct ide_port_info opti621_chipsets[] __devinitdata = { +static ide_pci_device_t opti621_chipsets[] __devinitdata = { { /* 0 */ .name = "OPTI621", .init_hwif = init_hwif_opti621, diff --git a/trunk/drivers/ide/pci/pdc202xx_new.c b/trunk/drivers/ide/pci/pdc202xx_new.c index 4234efeba606..d1e7823454f3 100644 --- a/trunk/drivers/ide/pci/pdc202xx_new.c +++ b/trunk/drivers/ide/pci/pdc202xx_new.c @@ -513,7 +513,7 @@ static struct pci_dev * __devinit pdc20270_get_dev2(struct pci_dev *dev) .udma_mask = udma, \ } -static const struct ide_port_info pdcnew_chipsets[] __devinitdata = { +static ide_pci_device_t pdcnew_chipsets[] __devinitdata = { /* 0 */ DECLARE_PDCNEW_DEV("PDC20268", ATA_UDMA5), /* 1 */ DECLARE_PDCNEW_DEV("PDC20269", ATA_UDMA6), /* 2 */ DECLARE_PDCNEW_DEV("PDC20270", ATA_UDMA5), @@ -534,7 +534,7 @@ static const struct ide_port_info pdcnew_chipsets[] __devinitdata = { static int __devinit pdc202new_init_one(struct pci_dev *dev, const struct pci_device_id *id) { - const struct ide_port_info *d; + ide_pci_device_t *d; struct pci_dev *bridge = dev->bus->self; u8 idx = id->driver_data; diff --git a/trunk/drivers/ide/pci/pdc202xx_old.c b/trunk/drivers/ide/pci/pdc202xx_old.c index e09742e2ba59..29306121dc4a 100644 --- a/trunk/drivers/ide/pci/pdc202xx_old.c +++ b/trunk/drivers/ide/pci/pdc202xx_old.c @@ -302,6 +302,13 @@ static unsigned int __devinit init_chipset_pdc202xx(struct pci_dev *dev, static void __devinit init_hwif_pdc202xx(ide_hwif_t *hwif) { + struct pci_dev *dev = hwif->pci_dev; + + /* PDC20265 has problems with large LBA48 requests */ + if ((dev->device == PCI_DEVICE_ID_PROMISE_20267) || + (dev->device == PCI_DEVICE_ID_PROMISE_20265)) + hwif->rqsize = 256; + hwif->set_pio_mode = &pdc202xx_set_pio_mode; hwif->set_dma_mode = &pdc202xx_set_mode; @@ -375,7 +382,7 @@ static void __devinit pdc202ata4_fixup_irq(struct pci_dev *dev, } } -#define DECLARE_PDC2026X_DEV(name_str, udma, extra_flags) \ +#define DECLARE_PDC2026X_DEV(name_str, udma) \ { \ .name = name_str, \ .init_chipset = init_chipset_pdc202xx, \ @@ -383,14 +390,13 @@ static void __devinit pdc202ata4_fixup_irq(struct pci_dev *dev, .init_dma = init_dma_pdc202xx, \ .extra = 48, \ .host_flags = IDE_HFLAG_ERROR_STOPS_FIFO | \ - extra_flags | \ IDE_HFLAG_OFF_BOARD, \ .pio_mask = ATA_PIO4, \ .mwdma_mask = ATA_MWDMA2, \ .udma_mask = udma, \ } -static const struct ide_port_info pdc202xx_chipsets[] __devinitdata = { +static ide_pci_device_t pdc202xx_chipsets[] __devinitdata = { { /* 0 */ .name = "PDC20246", .init_chipset = init_chipset_pdc202xx, @@ -404,10 +410,10 @@ static const struct ide_port_info pdc202xx_chipsets[] __devinitdata = { .udma_mask = ATA_UDMA2, }, - /* 1 */ DECLARE_PDC2026X_DEV("PDC20262", ATA_UDMA4, 0), - /* 2 */ DECLARE_PDC2026X_DEV("PDC20263", ATA_UDMA4, 0), - /* 3 */ DECLARE_PDC2026X_DEV("PDC20265", ATA_UDMA5, IDE_HFLAG_RQSIZE_256), - /* 4 */ DECLARE_PDC2026X_DEV("PDC20267", ATA_UDMA5, IDE_HFLAG_RQSIZE_256), + /* 1 */ DECLARE_PDC2026X_DEV("PDC20262", ATA_UDMA4), + /* 2 */ DECLARE_PDC2026X_DEV("PDC20263", ATA_UDMA4), + /* 3 */ DECLARE_PDC2026X_DEV("PDC20265", ATA_UDMA5), + /* 4 */ DECLARE_PDC2026X_DEV("PDC20267", ATA_UDMA5), }; /** @@ -421,7 +427,7 @@ static const struct ide_port_info pdc202xx_chipsets[] __devinitdata = { static int __devinit pdc202xx_init_one(struct pci_dev *dev, const struct pci_device_id *id) { - const struct ide_port_info *d; + ide_pci_device_t *d; u8 idx = id->driver_data; d = &pdc202xx_chipsets[idx]; diff --git a/trunk/drivers/ide/pci/piix.c b/trunk/drivers/ide/pci/piix.c index 9329d4a810e5..ec0c6e96a213 100644 --- a/trunk/drivers/ide/pci/piix.c +++ b/trunk/drivers/ide/pci/piix.c @@ -396,7 +396,7 @@ static void __devinit init_hwif_ich(ide_hwif_t *hwif) .udma_mask = udma, \ } -static const struct ide_port_info piix_pci_info[] __devinitdata = { +static ide_pci_device_t piix_pci_info[] __devinitdata = { /* 0 */ DECLARE_PIIX_DEV("PIIXa", 0x00), /* no udma */ /* 1 */ DECLARE_PIIX_DEV("PIIXb", 0x00), /* no udma */ @@ -449,7 +449,9 @@ static const struct ide_port_info piix_pci_info[] __devinitdata = { static int __devinit piix_init_one(struct pci_dev *dev, const struct pci_device_id *id) { - return ide_setup_pci_device(dev, &piix_pci_info[id->driver_data]); + ide_pci_device_t *d = &piix_pci_info[id->driver_data]; + + return ide_setup_pci_device(dev, d); } /** diff --git a/trunk/drivers/ide/pci/rz1000.c b/trunk/drivers/ide/pci/rz1000.c index 6b10ae260fa2..dd2583ef1ad7 100644 --- a/trunk/drivers/ide/pci/rz1000.c +++ b/trunk/drivers/ide/pci/rz1000.c @@ -35,13 +35,13 @@ static void __devinit init_hwif_rz1000 (ide_hwif_t *hwif) u16 reg; struct pci_dev *dev = hwif->pci_dev; + hwif->chipset = ide_rz1000; if (!pci_read_config_word (dev, 0x40, ®) && !pci_write_config_word(dev, 0x40, reg & 0xdfff)) { printk(KERN_INFO "%s: disabled chipset read-ahead " "(buggy RZ1000/RZ1001)\n", hwif->name); } else { - if (hwif->mate) - hwif->mate->serialized = hwif->serialized = 1; + hwif->serialized = 1; hwif->drives[0].no_unmask = 1; hwif->drives[1].no_unmask = 1; printk(KERN_INFO "%s: serialized, disabled unmasking " @@ -49,10 +49,9 @@ static void __devinit init_hwif_rz1000 (ide_hwif_t *hwif) } } -static const struct ide_port_info rz1000_chipset __devinitdata = { +static ide_pci_device_t rz1000_chipset __devinitdata = { .name = "RZ100x", .init_hwif = init_hwif_rz1000, - .chipset = ide_rz1000, .host_flags = IDE_HFLAG_NO_DMA | IDE_HFLAG_BOOTABLE, }; diff --git a/trunk/drivers/ide/pci/sc1200.c b/trunk/drivers/ide/pci/sc1200.c index d2c8b5524f28..b2423e03bf36 100644 --- a/trunk/drivers/ide/pci/sc1200.c +++ b/trunk/drivers/ide/pci/sc1200.c @@ -372,7 +372,7 @@ static void __devinit init_hwif_sc1200 (ide_hwif_t *hwif) hwif->ide_dma_end = &sc1200_ide_dma_end; } -static const struct ide_port_info sc1200_chipset __devinitdata = { +static ide_pci_device_t sc1200_chipset __devinitdata = { .name = "SC1200", .init_hwif = init_hwif_sc1200, .host_flags = IDE_HFLAG_SERIALIZE | diff --git a/trunk/drivers/ide/pci/scc_pata.c b/trunk/drivers/ide/pci/scc_pata.c index ebb7132b9b84..ae9b50331d2a 100644 --- a/trunk/drivers/ide/pci/scc_pata.c +++ b/trunk/drivers/ide/pci/scc_pata.c @@ -538,13 +538,12 @@ static int setup_mmio_scc (struct pci_dev *dev, const char *name) /** * init_setup_scc - set up an SCC PATA Controller * @dev: PCI device - * @d: IDE port info + * @d: IDE PCI device * * Perform the initial set up for this device. */ -static int __devinit init_setup_scc(struct pci_dev *dev, - const struct ide_port_info *d) +static int __devinit init_setup_scc(struct pci_dev *dev, ide_pci_device_t *d) { unsigned long ctl_base; unsigned long dma_base; @@ -703,7 +702,7 @@ static void __devinit init_hwif_scc(ide_hwif_t *hwif) .pio_mask = ATA_PIO4, \ } -static const struct ide_port_info scc_chipsets[] __devinitdata = { +static ide_pci_device_t scc_chipsets[] __devinitdata = { /* 0 */ DECLARE_SCC_DEV("sccIDE"), }; @@ -718,7 +717,9 @@ static const struct ide_port_info scc_chipsets[] __devinitdata = { static int __devinit scc_init_one(struct pci_dev *dev, const struct pci_device_id *id) { - return init_setup_scc(dev, &scc_chipsets[id->driver_data]); + ide_pci_device_t *d = &scc_chipsets[id->driver_data]; + + return init_setup_scc(dev, d); } /** diff --git a/trunk/drivers/ide/pci/serverworks.c b/trunk/drivers/ide/pci/serverworks.c index a7280311357b..a3d880e21d0b 100644 --- a/trunk/drivers/ide/pci/serverworks.c +++ b/trunk/drivers/ide/pci/serverworks.c @@ -158,6 +158,13 @@ static void svwks_set_dma_mode(ide_drive_t *drive, const u8 speed) u8 ultra_enable = 0, ultra_timing = 0, dma_timing = 0; + /* If we are about to put a disk into UDMA mode we screwed up. + Our code assumes we never _ever_ do this on an OSB4 */ + + if(dev->device == PCI_DEVICE_ID_SERVERWORKS_OSB4 && + drive->media == ide_disk && speed >= XFER_UDMA_0) + BUG(); + pci_read_config_byte(dev, (0x56|hwif->channel), &ultra_timing); pci_read_config_byte(dev, 0x54, &ultra_enable); @@ -366,7 +373,7 @@ static void __devinit init_hwif_svwks (ide_hwif_t *hwif) } } -static const struct ide_port_info serverworks_chipsets[] __devinitdata = { +static ide_pci_device_t serverworks_chipsets[] __devinitdata = { { /* 0 */ .name = "SvrWks OSB4", .init_chipset = init_chipset_svwks, @@ -423,7 +430,7 @@ static const struct ide_port_info serverworks_chipsets[] __devinitdata = { static int __devinit svwks_init_one(struct pci_dev *dev, const struct pci_device_id *id) { - struct ide_port_info d; + ide_pci_device_t d; u8 idx = id->driver_data; d = serverworks_chipsets[idx]; diff --git a/trunk/drivers/ide/pci/sgiioc4.c b/trunk/drivers/ide/pci/sgiioc4.c index de820aa58cd0..5af74ea1d46e 100644 --- a/trunk/drivers/ide/pci/sgiioc4.c +++ b/trunk/drivers/ide/pci/sgiioc4.c @@ -614,7 +614,6 @@ sgiioc4_ide_setup_pci_device(struct pci_dev *dev) void __iomem *virt_base; ide_hwif_t *hwif; int h; - u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; /* * Find an empty HWIF; if none available, return -ENOMEM. @@ -655,12 +654,10 @@ sgiioc4_ide_setup_pci_device(struct pci_dev *dev) } if (hwif->io_ports[IDE_DATA_OFFSET] != cmd_base) { - hw_regs_t hw; - /* Initialize the IO registers */ - memset(&hw, 0, sizeof(hw)); - sgiioc4_init_hwif_ports(&hw, cmd_base, ctl, irqport); - memcpy(hwif->io_ports, hw.io_ports, sizeof(hwif->io_ports)); + sgiioc4_init_hwif_ports(&hwif->hw, cmd_base, ctl, irqport); + memcpy(hwif->io_ports, hwif->hw.io_ports, + sizeof (hwif->io_ports)); hwif->noprobe = !hwif->io_ports[IDE_DATA_OFFSET]; } @@ -682,11 +679,12 @@ sgiioc4_ide_setup_pci_device(struct pci_dev *dev) ide_init_sgiioc4(hwif); - idx[0] = hwif->index; - - if (ide_device_add(idx)) + if (probe_hwif_init(hwif)) return -EIO; + /* Create /proc/ide entries */ + ide_proc_register_port(hwif); + return 0; } diff --git a/trunk/drivers/ide/pci/siimage.c b/trunk/drivers/ide/pci/siimage.c index dc915cb22bec..689786df1ede 100644 --- a/trunk/drivers/ide/pci/siimage.c +++ b/trunk/drivers/ide/pci/siimage.c @@ -1,5 +1,5 @@ /* - * linux/drivers/ide/pci/siimage.c Version 1.18 Oct 18 2007 + * linux/drivers/ide/pci/siimage.c Version 1.17 Oct 18 2007 * * Copyright (C) 2001-2002 Andre Hedrick * Copyright (C) 2003 Red Hat @@ -57,8 +57,8 @@ static int pdev_is_sata(struct pci_dev *pdev) { -#ifdef CONFIG_BLK_DEV_IDE_SATA - switch(pdev->device) { + switch(pdev->device) + { case PCI_DEVICE_ID_SII_3112: case PCI_DEVICE_ID_SII_1210SA: return 1; @@ -66,10 +66,9 @@ static int pdev_is_sata(struct pci_dev *pdev) return 0; } BUG(); -#endif return 0; } - + /** * is_sata - check if hwif is SATA * @hwif: interface to check @@ -137,7 +136,7 @@ static inline unsigned long siimage_seldev(ide_drive_t *drive, int r) * SI3112 SATA controller life is a bit simpler. */ -static u8 sil_pata_udma_filter(ide_drive_t *drive) +static u8 sil_udma_filter(ide_drive_t *drive) { ide_hwif_t *hwif = drive->hwif; unsigned long base = (unsigned long) hwif->hwif_data; @@ -148,23 +147,23 @@ static u8 sil_pata_udma_filter(ide_drive_t *drive) else pci_read_config_byte(hwif->pci_dev, 0x8A, &scsc); + if (is_sata(hwif)) { + mask = strstr(drive->id->model, "Maxtor") ? 0x3f : 0x7f; + goto out; + } + if ((scsc & 0x30) == 0x10) /* 133 */ - mask = ATA_UDMA6; + mask = 0x7f; else if ((scsc & 0x30) == 0x20) /* 2xPCI */ - mask = ATA_UDMA6; + mask = 0x7f; else if ((scsc & 0x30) == 0x00) /* 100 */ - mask = ATA_UDMA5; + mask = 0x3f; else /* Disabled ? */ BUG(); - +out: return mask; } -static u8 sil_sata_udma_filter(ide_drive_t *drive) -{ - return strstr(drive->id->model, "Maxtor") ? ATA_UDMA5 : ATA_UDMA6; -} - /** * sil_set_pio_mode - set host controller for PIO mode * @drive: drive @@ -341,11 +340,10 @@ static int siimage_io_ide_dma_test_irq (ide_drive_t *drive) static int siimage_mmio_ide_dma_test_irq (ide_drive_t *drive) { ide_hwif_t *hwif = HWIF(drive); + unsigned long base = (unsigned long)hwif->hwif_data; unsigned long addr = siimage_selreg(hwif, 0x1); if (SATA_ERROR_REG) { - unsigned long base = (unsigned long)hwif->hwif_data; - u32 ext_stat = readl((void __iomem *)(base + 0x10)); u8 watchdog = 0; if (ext_stat & ((hwif->channel) ? 0x40 : 0x10)) { @@ -378,7 +376,7 @@ static int siimage_mmio_ide_dma_test_irq (ide_drive_t *drive) } /** - * sil_sata_busproc - bus isolation IOCTL + * siimage_busproc - bus isolation ioctl * @drive: drive to isolate/restore * @state: bus state to set * @@ -386,8 +384,8 @@ static int siimage_mmio_ide_dma_test_irq (ide_drive_t *drive) * SATA controller the work required is quite limited, we * just have to clean up the statistics */ - -static int sil_sata_busproc(ide_drive_t * drive, int state) + +static int siimage_busproc (ide_drive_t * drive, int state) { ide_hwif_t *hwif = HWIF(drive); u32 stat_config = 0; @@ -419,14 +417,14 @@ static int sil_sata_busproc(ide_drive_t * drive, int state) } /** - * sil_sata_reset_poll - wait for SATA reset + * siimage_reset_poll - wait for sata reset * @drive: drive we are resetting * * Poll the SATA phy and see whether it has come back from the dead * yet. */ - -static int sil_sata_reset_poll(ide_drive_t *drive) + +static int siimage_reset_poll (ide_drive_t *drive) { if (SATA_STATUS_REG) { ide_hwif_t *hwif = HWIF(drive); @@ -438,22 +436,27 @@ static int sil_sata_reset_poll(ide_drive_t *drive) HWGROUP(drive)->polling = 0; return ide_started; } + return 0; + } else { + return 0; } - - return 0; } /** - * sil_sata_pre_reset - reset hook + * siimage_pre_reset - reset hook * @drive: IDE device being reset * * For the SATA devices we need to handle recalibration/geometry * differently */ - -static void sil_sata_pre_reset(ide_drive_t *drive) + +static void siimage_pre_reset (ide_drive_t *drive) { - if (drive->media == ide_disk) { + if (drive->media != ide_disk) + return; + + if (is_sata(HWIF(drive))) + { drive->special.b.set_geometry = 0; drive->special.b.recalibrate = 0; } @@ -499,6 +502,7 @@ static void siimage_reset (ide_drive_t *drive) drive->failures++; } } + } /** @@ -754,11 +758,16 @@ static void __devinit init_mmio_iops_siimage(ide_hwif_t *hwif) hwif->sata_misc[SATA_IEN_OFFSET] = base + 0x148; } - memcpy(hwif->io_ports, hw.io_ports, sizeof(hwif->io_ports)); + hw.irq = hwif->pci_dev->irq; - hwif->irq = dev->irq; + memcpy(&hwif->hw, &hw, sizeof(hw)); + memcpy(hwif->io_ports, hwif->hw.io_ports, sizeof(hwif->hw.io_ports)); - hwif->dma_base = (unsigned long)addr + (ch ? 0x08 : 0x00); + hwif->irq = hw.irq; + + base = (unsigned long) addr; + + hwif->dma_base = base + (ch ? 0x08 : 0x00); hwif->mmio = 1; } @@ -855,31 +864,28 @@ static u8 __devinit ata66_siimage(ide_hwif_t *hwif) static void __devinit init_hwif_siimage(ide_hwif_t *hwif) { - u8 sata = is_sata(hwif); - hwif->resetproc = &siimage_reset; hwif->set_pio_mode = &sil_set_pio_mode; hwif->set_dma_mode = &sil_set_dma_mode; + hwif->reset_poll = &siimage_reset_poll; + hwif->pre_reset = &siimage_pre_reset; + hwif->udma_filter = &sil_udma_filter; - if (sata) { + if(is_sata(hwif)) { static int first = 1; - hwif->busproc = &sil_sata_busproc; - hwif->reset_poll = &sil_sata_reset_poll; - hwif->pre_reset = &sil_sata_pre_reset; - hwif->udma_filter = &sil_sata_udma_filter; + hwif->busproc = &siimage_busproc; if (first) { printk(KERN_INFO "siimage: For full SATA support you should use the libata sata_sil module.\n"); first = 0; } - } else - hwif->udma_filter = &sil_pata_udma_filter; + } if (hwif->dma_base == 0) return; - if (sata) + if (is_sata(hwif)) hwif->host_flags |= IDE_HFLAG_NO_ATAPI_DMA; if (hwif->cbl != ATA_CBL_PATA40_SHORT) @@ -905,7 +911,7 @@ static void __devinit init_hwif_siimage(ide_hwif_t *hwif) .udma_mask = ATA_UDMA6, \ } -static const struct ide_port_info siimage_chipsets[] __devinitdata = { +static ide_pci_device_t siimage_chipsets[] __devinitdata = { /* 0 */ DECLARE_SII_DEV("SiI680"), /* 1 */ DECLARE_SII_DEV("SiI3112 Serial ATA"), /* 2 */ DECLARE_SII_DEV("Adaptec AAR-1210SA") diff --git a/trunk/drivers/ide/pci/sis5513.c b/trunk/drivers/ide/pci/sis5513.c index 6b7bb53acefd..c1d280b06391 100644 --- a/trunk/drivers/ide/pci/sis5513.c +++ b/trunk/drivers/ide/pci/sis5513.c @@ -264,7 +264,7 @@ static void sis_ata133_program_timings(ide_drive_t *drive, const u8 mode) if (mode >= XFER_MW_DMA_0) { t1 &= ~0x04; /* disable UDMA */ idx = mode - XFER_MW_DMA_0 + 5; - } else + } idx = mode - XFER_PIO_0; t1 |= ini_time_value[clk][idx] << 12; t1 |= act_time_value[clk][idx] << 16; @@ -579,7 +579,7 @@ static void __devinit init_hwif_sis5513 (ide_hwif_t *hwif) hwif->cbl = ata66_sis5513(hwif); } -static const struct ide_port_info sis5513_chipset __devinitdata = { +static ide_pci_device_t sis5513_chipset __devinitdata = { .name = "SIS5513", .init_chipset = init_chipset_sis5513, .init_hwif = init_hwif_sis5513, diff --git a/trunk/drivers/ide/pci/sl82c105.c b/trunk/drivers/ide/pci/sl82c105.c index 147d783f7529..0dce459b1269 100644 --- a/trunk/drivers/ide/pci/sl82c105.c +++ b/trunk/drivers/ide/pci/sl82c105.c @@ -361,6 +361,13 @@ static void __devinit init_hwif_sl82c105(ide_hwif_t *hwif) hwif->selectproc = &sl82c105_selectproc; hwif->resetproc = &sl82c105_resetproc; + /* + * We support 32-bit I/O on this interface, and + * it doesn't have problems with interrupts. + */ + hwif->drives[0].io_32bit = hwif->drives[1].io_32bit = 1; + hwif->drives[0].unmask = hwif->drives[1].unmask = 1; + if (!hwif->dma_base) return; @@ -387,15 +394,12 @@ static void __devinit init_hwif_sl82c105(ide_hwif_t *hwif) hwif->serialized = hwif->mate->serialized = 1; } -static const struct ide_port_info sl82c105_chipset __devinitdata = { +static ide_pci_device_t sl82c105_chipset __devinitdata = { .name = "W82C105", .init_chipset = init_chipset_sl82c105, .init_hwif = init_hwif_sl82c105, .enablebits = {{0x40,0x01,0x01}, {0x40,0x10,0x10}}, - .host_flags = IDE_HFLAG_IO_32BIT | - IDE_HFLAG_UNMASK_IRQS | - IDE_HFLAG_NO_AUTODMA | - IDE_HFLAG_BOOTABLE, + .host_flags = IDE_HFLAG_NO_AUTODMA | IDE_HFLAG_BOOTABLE, .pio_mask = ATA_PIO5, }; diff --git a/trunk/drivers/ide/pci/slc90e66.c b/trunk/drivers/ide/pci/slc90e66.c index eb4445b229ed..4f22dffdf8ef 100644 --- a/trunk/drivers/ide/pci/slc90e66.c +++ b/trunk/drivers/ide/pci/slc90e66.c @@ -1,5 +1,5 @@ /* - * linux/drivers/ide/pci/slc90e66.c Version 0.19 Sep 24, 2007 + * linux/drivers/ide/pci/slc90e66.c Version 0.18 Aug 9, 2007 * * Copyright (C) 2000-2002 Andre Hedrick * Copyright (C) 2006-2007 MontaVista Software, Inc. @@ -21,8 +21,6 @@ #include -static DEFINE_SPINLOCK(slc90e66_lock); - static void slc90e66_set_pio_mode(ide_drive_t *drive, const u8 pio) { ide_hwif_t *hwif = HWIF(drive); @@ -42,7 +40,7 @@ static void slc90e66_set_pio_mode(ide_drive_t *drive, const u8 pio) { 2, 1 }, { 2, 3 }, }; - spin_lock_irqsave(&slc90e66_lock, flags); + spin_lock_irqsave(&ide_lock, flags); pci_read_config_word(dev, master_port, &master_data); if (pio > 1) @@ -73,7 +71,7 @@ static void slc90e66_set_pio_mode(ide_drive_t *drive, const u8 pio) pci_write_config_word(dev, master_port, master_data); if (is_slave) pci_write_config_byte(dev, slave_port, slave_data); - spin_unlock_irqrestore(&slc90e66_lock, flags); + spin_unlock_irqrestore(&ide_lock, flags); } static void slc90e66_set_dma_mode(ide_drive_t *drive, const u8 speed) @@ -148,7 +146,7 @@ static void __devinit init_hwif_slc90e66 (ide_hwif_t *hwif) hwif->cbl = (reg47 & mask) ? ATA_CBL_PATA40 : ATA_CBL_PATA80; } -static const struct ide_port_info slc90e66_chipset __devinitdata = { +static ide_pci_device_t slc90e66_chipset __devinitdata = { .name = "SLC90E66", .init_hwif = init_hwif_slc90e66, .enablebits = {{0x41,0x80,0x80}, {0x43,0x80,0x80}}, diff --git a/trunk/drivers/ide/pci/tc86c001.c b/trunk/drivers/ide/pci/tc86c001.c index a66ebd14664e..631506e9b5d2 100644 --- a/trunk/drivers/ide/pci/tc86c001.c +++ b/trunk/drivers/ide/pci/tc86c001.c @@ -218,7 +218,7 @@ static unsigned int __devinit init_chipset_tc86c001(struct pci_dev *dev, return err; } -static const struct ide_port_info tc86c001_chipset __devinitdata = { +static ide_pci_device_t tc86c001_chipset __devinitdata = { .name = "TC86C001", .init_chipset = init_chipset_tc86c001, .init_hwif = init_hwif_tc86c001, diff --git a/trunk/drivers/ide/pci/triflex.c b/trunk/drivers/ide/pci/triflex.c index a227c41d23a3..30b52f62699a 100644 --- a/trunk/drivers/ide/pci/triflex.c +++ b/trunk/drivers/ide/pci/triflex.c @@ -102,7 +102,7 @@ static void __devinit init_hwif_triflex(ide_hwif_t *hwif) hwif->set_dma_mode = &triflex_set_mode; } -static const struct ide_port_info triflex_device __devinitdata = { +static ide_pci_device_t triflex_device __devinitdata = { .name = "TRIFLEX", .init_hwif = init_hwif_triflex, .enablebits = {{0x80, 0x01, 0x01}, {0x80, 0x02, 0x02}}, diff --git a/trunk/drivers/ide/pci/trm290.c b/trunk/drivers/ide/pci/trm290.c index 5011ba22e36c..140d486f6237 100644 --- a/trunk/drivers/ide/pci/trm290.c +++ b/trunk/drivers/ide/pci/trm290.c @@ -250,6 +250,7 @@ static void __devinit init_hwif_trm290(ide_hwif_t *hwif) u8 reg = 0; struct pci_dev *dev = hwif->pci_dev; + hwif->chipset = ide_trm290; cfgbase = pci_resource_start(dev, 4); if ((dev->class & 5) && cfgbase) { hwif->config_data = cfgbase; @@ -319,10 +320,9 @@ static void __devinit init_hwif_trm290(ide_hwif_t *hwif) #endif } -static const struct ide_port_info trm290_chipset __devinitdata = { +static ide_pci_device_t trm290_chipset __devinitdata = { .name = "TRM290", .init_hwif = init_hwif_trm290, - .chipset = ide_trm290, .host_flags = IDE_HFLAG_NO_ATAPI_DMA | #if 0 /* play it safe for now */ IDE_HFLAG_TRUST_BIOS_FOR_DMA | diff --git a/trunk/drivers/ide/pci/via82cxxx.c b/trunk/drivers/ide/pci/via82cxxx.c index a0d3c16b68ec..c8022a92a0e3 100644 --- a/trunk/drivers/ide/pci/via82cxxx.c +++ b/trunk/drivers/ide/pci/via82cxxx.c @@ -1,6 +1,6 @@ /* * - * Version 3.50 + * Version 3.49 * * VIA IDE driver for Linux. Supported southbridges: * @@ -422,40 +422,65 @@ static u8 __devinit via82cxxx_cable_detect(ide_hwif_t *hwif) static void __devinit init_hwif_via82cxxx(ide_hwif_t *hwif) { + struct via82cxxx_dev *vdev = pci_get_drvdata(hwif->pci_dev); + int i; + hwif->set_pio_mode = &via_set_pio_mode; hwif->set_dma_mode = &via_set_drive; +#ifdef CONFIG_PPC_CHRP + if(machine_is(chrp) && _chrp_type == _CHRP_Pegasos) { + hwif->irq = hwif->channel ? 15 : 14; + } +#endif + + for (i = 0; i < 2; i++) { + hwif->drives[i].io_32bit = 1; + hwif->drives[i].unmask = (vdev->via_config->flags & VIA_NO_UNMASK) ? 0 : 1; + } + if (!hwif->dma_base) return; + hwif->ultra_mask = vdev->via_config->udma_mask; + if (hwif->cbl != ATA_CBL_PATA40_SHORT) hwif->cbl = via82cxxx_cable_detect(hwif); } -static const struct ide_port_info via82cxxx_chipset __devinitdata = { - .name = "VP_IDE", - .init_chipset = init_chipset_via82cxxx, - .init_hwif = init_hwif_via82cxxx, - .enablebits = { { 0x40, 0x02, 0x02 }, { 0x40, 0x01, 0x01 } }, - .host_flags = IDE_HFLAG_PIO_NO_BLACKLIST | - IDE_HFLAG_PIO_NO_DOWNGRADE | - IDE_HFLAG_POST_SET_MODE | - IDE_HFLAG_IO_32BIT | - IDE_HFLAG_BOOTABLE, - .pio_mask = ATA_PIO5, - .swdma_mask = ATA_SWDMA2, - .mwdma_mask = ATA_MWDMA2, +static ide_pci_device_t via82cxxx_chipsets[] __devinitdata = { + { /* 0 */ + .name = "VP_IDE", + .init_chipset = init_chipset_via82cxxx, + .init_hwif = init_hwif_via82cxxx, + .enablebits = {{0x40,0x02,0x02}, {0x40,0x01,0x01}}, + .host_flags = IDE_HFLAG_PIO_NO_BLACKLIST | + IDE_HFLAG_PIO_NO_DOWNGRADE | + IDE_HFLAG_POST_SET_MODE | + IDE_HFLAG_NO_AUTODMA | + IDE_HFLAG_BOOTABLE, + .pio_mask = ATA_PIO5, + .swdma_mask = ATA_SWDMA2, + .mwdma_mask = ATA_MWDMA2, + },{ /* 1 */ + .name = "VP_IDE", + .init_chipset = init_chipset_via82cxxx, + .init_hwif = init_hwif_via82cxxx, + .enablebits = {{0x00,0x00,0x00}, {0x00,0x00,0x00}}, + .host_flags = IDE_HFLAG_PIO_NO_BLACKLIST | + IDE_HFLAG_PIO_NO_DOWNGRADE | + IDE_HFLAG_POST_SET_MODE | + IDE_HFLAG_BOOTABLE, + .pio_mask = ATA_PIO5, + .swdma_mask = ATA_SWDMA2, + .mwdma_mask = ATA_MWDMA2, + } }; static int __devinit via_init_one(struct pci_dev *dev, const struct pci_device_id *id) { struct pci_dev *isa = NULL; struct via_isa_bridge *via_config; - u8 idx = id->driver_data; - struct ide_port_info d; - - d = via82cxxx_chipset; - /* * Find the ISA bridge and check we know what it is. */ @@ -465,23 +490,7 @@ static int __devinit via_init_one(struct pci_dev *dev, const struct pci_device_i printk(KERN_WARNING "VP_IDE: Unknown VIA SouthBridge, disabling DMA.\n"); return -ENODEV; } - - if (idx == 0) - d.host_flags |= IDE_HFLAG_NO_AUTODMA; - else - d.enablebits[1].reg = d.enablebits[0].reg = 0; - - if ((via_config->flags & VIA_NO_UNMASK) == 0) - d.host_flags |= IDE_HFLAG_UNMASK_IRQS; - -#ifdef CONFIG_PPC_CHRP - if (machine_is(chrp) && _chrp_type == _CHRP_Pegasos) - d.host_flags |= IDE_HFLAG_FORCE_LEGACY_IRQS; -#endif - - d.udma_mask = via_config->udma_mask; - - return ide_setup_pci_device(dev, &d); + return ide_setup_pci_device(dev, &via82cxxx_chipsets[id->driver_data]); } static const struct pci_device_id via_pci_tbl[] = { diff --git a/trunk/drivers/ide/ppc/mpc8xx.c b/trunk/drivers/ide/ppc/mpc8xx.c index 5f0da35ab5ad..df2e92034f5d 100644 --- a/trunk/drivers/ide/ppc/mpc8xx.c +++ b/trunk/drivers/ide/ppc/mpc8xx.c @@ -316,8 +316,8 @@ m8xx_ide_init_hwif_ports(hw_regs_t *hw, unsigned long data_port, ide_hwifs[data_port].pio_mask = ATA_PIO4; ide_hwifs[data_port].set_pio_mode = m8xx_ide_set_pio_mode; - ide_hwifs[data_port].ack_intr = (ide_ack_intr_t *)ide_interrupt_ack; + hw->ack_intr = (ide_ack_intr_t *) ide_interrupt_ack; /* Enable Harddisk Interrupt, * and make it edge sensitive */ @@ -402,8 +402,8 @@ void m8xx_ide_init_hwif_ports (hw_regs_t *hw, ide_hwifs[data_port].pio_mask = ATA_PIO4; ide_hwifs[data_port].set_pio_mode = m8xx_ide_set_pio_mode; - ide_hwifs[data_port].ack_intr = (ide_ack_intr_t *)ide_interrupt_ack; + hw->ack_intr = (ide_ack_intr_t *) ide_interrupt_ack; /* Enable Harddisk Interrupt, * and make it edge sensitive */ diff --git a/trunk/drivers/ide/ppc/pmac.c b/trunk/drivers/ide/ppc/pmac.c index 816b5311dad6..c55479356768 100644 --- a/trunk/drivers/ide/ppc/pmac.c +++ b/trunk/drivers/ide/ppc/pmac.c @@ -1039,8 +1039,6 @@ pmac_ide_setup_device(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif) { struct device_node *np = pmif->node; const int *bidp; - u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; - hw_regs_t hw; pmif->cable_80 = 0; pmif->broken_dma = pmif->broken_dma_warn = 0; @@ -1126,9 +1124,8 @@ pmac_ide_setup_device(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif) /* Tell common code _not_ to mess with resources */ hwif->mmio = 1; hwif->hwif_data = pmif; - memset(&hw, 0, sizeof(hw)); - pmac_ide_init_hwif_ports(&hw, pmif->regbase, 0, &hwif->irq); - memcpy(hwif->io_ports, hw.io_ports, sizeof(hwif->io_ports)); + pmac_ide_init_hwif_ports(&hwif->hw, pmif->regbase, 0, &hwif->irq); + memcpy(hwif->io_ports, hwif->hw.io_ports, sizeof(hwif->io_ports)); hwif->chipset = ide_pmac; hwif->noprobe = !hwif->io_ports[IDE_DATA_OFFSET] || pmif->mediabay; hwif->hold = pmif->mediabay; @@ -1166,9 +1163,10 @@ pmac_ide_setup_device(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif) pmac_ide_setup_dma(pmif, hwif); #endif /* CONFIG_BLK_DEV_IDEDMA_PMAC */ - idx[0] = hwif->index; + /* We probe the hwif now */ + probe_hwif_init(hwif); - ide_device_add(idx); + ide_proc_register_port(hwif); return 0; } diff --git a/trunk/drivers/ide/setup-pci.c b/trunk/drivers/ide/setup-pci.c index 02d14bf85ab2..fff567bcedbe 100644 --- a/trunk/drivers/ide/setup-pci.c +++ b/trunk/drivers/ide/setup-pci.c @@ -147,15 +147,15 @@ static int ide_setup_pci_baseregs (struct pci_dev *dev, const char *name) #ifdef CONFIG_BLK_DEV_IDEDMA_PCI /** * ide_get_or_set_dma_base - setup BMIBA - * @d: IDE port info - * @hwif: IDE interface + * @d: IDE pci device data + * @hwif: Interface * * Fetch the DMA Bus-Master-I/O-Base-Address (BMIBA) from PCI space. * Where a device has a partner that is already in DMA mode we check * and enforce IDE simplex rules. */ -static unsigned long ide_get_or_set_dma_base(const struct ide_port_info *d, ide_hwif_t *hwif) +static unsigned long ide_get_or_set_dma_base(ide_pci_device_t *d, ide_hwif_t *hwif) { unsigned long dma_base = 0; struct pci_dev *dev = hwif->pci_dev; @@ -225,11 +225,10 @@ static unsigned long ide_get_or_set_dma_base(const struct ide_port_info *d, ide_ } #endif /* CONFIG_BLK_DEV_IDEDMA_PCI */ -void ide_setup_pci_noise(struct pci_dev *dev, const struct ide_port_info *d) +void ide_setup_pci_noise (struct pci_dev *dev, ide_pci_device_t *d) { - printk(KERN_INFO "%s: IDE controller (0x%04x:0x%04x rev 0x%02x) at " - " PCI slot %s\n", d->name, dev->vendor, dev->device, - dev->revision, pci_name(dev)); + printk(KERN_INFO "%s: IDE controller at PCI slot %s\n", + d->name, pci_name(dev)); } EXPORT_SYMBOL_GPL(ide_setup_pci_noise); @@ -238,15 +237,15 @@ EXPORT_SYMBOL_GPL(ide_setup_pci_noise); /** * ide_pci_enable - do PCI enables * @dev: PCI device - * @d: IDE port info + * @d: IDE pci device data * * Enable the IDE PCI device. We attempt to enable the device in full * but if that fails then we only need BAR4 so we will enable that. * * Returns zero on success or an error code */ - -static int ide_pci_enable(struct pci_dev *dev, const struct ide_port_info *d) + +static int ide_pci_enable(struct pci_dev *dev, ide_pci_device_t *d) { int ret; @@ -261,9 +260,9 @@ static int ide_pci_enable(struct pci_dev *dev, const struct ide_port_info *d) } /* - * assume all devices can do 32-bit DMA for now, we can add - * a DMA mask field to the struct ide_port_info if we need it - * (or let lower level driver set the DMA mask) + * assume all devices can do 32-bit dma for now. we can add a + * dma mask field to the ide_pci_device_t if we need it (or let + * lower level driver set the dma mask) */ ret = pci_set_dma_mask(dev, DMA_32BIT_MASK); if (ret < 0) { @@ -285,13 +284,13 @@ static int ide_pci_enable(struct pci_dev *dev, const struct ide_port_info *d) /** * ide_pci_configure - configure an unconfigured device * @dev: PCI device - * @d: IDE port info + * @d: IDE pci device data * * Enable and configure the PCI device we have been passed. * Returns zero on success or an error code. */ - -static int ide_pci_configure(struct pci_dev *dev, const struct ide_port_info *d) + +static int ide_pci_configure(struct pci_dev *dev, ide_pci_device_t *d) { u16 pcicmd = 0; /* @@ -319,15 +318,15 @@ static int ide_pci_configure(struct pci_dev *dev, const struct ide_port_info *d) /** * ide_pci_check_iomem - check a register is I/O - * @dev: PCI device - * @d: IDE port info - * @bar: BAR number + * @dev: pci device + * @d: ide_pci_device + * @bar: bar number * * Checks if a BAR is configured and points to MMIO space. If so * print an error and return an error code. Otherwise return 0 */ - -static int ide_pci_check_iomem(struct pci_dev *dev, const struct ide_port_info *d, int bar) + +static int ide_pci_check_iomem(struct pci_dev *dev, ide_pci_device_t *d, int bar) { ulong flags = pci_resource_flags(dev, bar); @@ -349,7 +348,7 @@ static int ide_pci_check_iomem(struct pci_dev *dev, const struct ide_port_info * /** * ide_hwif_configure - configure an IDE interface * @dev: PCI device holding interface - * @d: IDE port info + * @d: IDE pci data * @mate: Paired interface if any * * Perform the initial set up for the hardware interface structure. This @@ -358,8 +357,8 @@ static int ide_pci_check_iomem(struct pci_dev *dev, const struct ide_port_info * * * Returns the new hardware interface structure, or NULL on a failure */ - -static ide_hwif_t *ide_hwif_configure(struct pci_dev *dev, const struct ide_port_info *d, ide_hwif_t *mate, int port, int irq) + +static ide_hwif_t *ide_hwif_configure(struct pci_dev *dev, ide_pci_device_t *d, ide_hwif_t *mate, int port, int irq) { unsigned long ctl = 0, base = 0; ide_hwif_t *hwif; @@ -388,20 +387,19 @@ static ide_hwif_t *ide_hwif_configure(struct pci_dev *dev, const struct ide_port return NULL; /* no room in ide_hwifs[] */ if (hwif->io_ports[IDE_DATA_OFFSET] != base || hwif->io_ports[IDE_CONTROL_OFFSET] != (ctl | 2)) { - hw_regs_t hw; - - memset(&hw, 0, sizeof(hw)); -#ifndef CONFIG_IDE_ARCH_OBSOLETE_INIT - ide_std_init_ports(&hw, base, ctl | 2); + memset(&hwif->hw, 0, sizeof(hwif->hw)); +#ifndef IDE_ARCH_OBSOLETE_INIT + ide_std_init_ports(&hwif->hw, base, (ctl | 2)); + hwif->hw.io_ports[IDE_IRQ_OFFSET] = 0; #else - ide_init_hwif_ports(&hw, base, ctl | 2, NULL); + ide_init_hwif_ports(&hwif->hw, base, (ctl | 2), NULL); #endif - memcpy(hwif->io_ports, hw.io_ports, sizeof(hwif->io_ports)); + memcpy(hwif->io_ports, hwif->hw.io_ports, sizeof(hwif->io_ports)); hwif->noprobe = !hwif->io_ports[IDE_DATA_OFFSET]; } - hwif->chipset = d->chipset ? d->chipset : ide_pci; + hwif->chipset = ide_pci; hwif->pci_dev = dev; - hwif->cds = d; + hwif->cds = (struct ide_pci_device_s *) d; hwif->channel = port; if (!hwif->irq) @@ -416,17 +414,21 @@ static ide_hwif_t *ide_hwif_configure(struct pci_dev *dev, const struct ide_port /** * ide_hwif_setup_dma - configure DMA interface * @dev: PCI device - * @d: IDE port info - * @hwif: IDE interface + * @d: IDE pci data + * @hwif: Hardware interface we are configuring * * Set up the DMA base for the interface. Enable the master bits as * necessary and attempt to bring the device DMA into a ready to use * state */ - -static void ide_hwif_setup_dma(struct pci_dev *dev, const struct ide_port_info *d, ide_hwif_t *hwif) + +#ifndef CONFIG_BLK_DEV_IDEDMA_PCI +static void ide_hwif_setup_dma(struct pci_dev *dev, ide_pci_device_t *d, ide_hwif_t *hwif) +{ +} +#else +static void ide_hwif_setup_dma(struct pci_dev *dev, ide_pci_device_t *d, ide_hwif_t *hwif) { -#ifdef CONFIG_BLK_DEV_IDEDMA_PCI u16 pcicmd; pci_read_config_word(dev, PCI_COMMAND, &pcicmd); @@ -458,13 +460,13 @@ static void ide_hwif_setup_dma(struct pci_dev *dev, const struct ide_port_info * "(BIOS)\n", hwif->name, d->name); } } -#endif /* CONFIG_BLK_DEV_IDEDMA_PCI*/ } +#endif /* CONFIG_BLK_DEV_IDEDMA_PCI*/ /** * ide_setup_pci_controller - set up IDE PCI * @dev: PCI device - * @d: IDE port info + * @d: IDE PCI data * @noisy: verbose flag * @config: returned as 1 if we configured the hardware * @@ -472,8 +474,8 @@ static void ide_hwif_setup_dma(struct pci_dev *dev, const struct ide_port_info * * up the PCI side of the device, checks that the device is enabled * and enables it if need be */ - -static int ide_setup_pci_controller(struct pci_dev *dev, const struct ide_port_info *d, int noisy, int *config) + +static int ide_setup_pci_controller(struct pci_dev *dev, ide_pci_device_t *d, int noisy, int *config) { int ret; u16 pcicmd; @@ -498,6 +500,9 @@ static int ide_setup_pci_controller(struct pci_dev *dev, const struct ide_port_i printk(KERN_INFO "%s: device enabled (Linux)\n", d->name); } + if (noisy) + printk(KERN_INFO "%s: chipset revision %d\n", + d->name, dev->revision); out: return ret; } @@ -505,9 +510,9 @@ static int ide_setup_pci_controller(struct pci_dev *dev, const struct ide_port_i /** * ide_pci_setup_ports - configure ports/devices on PCI IDE * @dev: PCI device - * @d: IDE port info + * @d: IDE pci device info * @pciirq: IRQ line - * @idx: ATA index table to update + * @index: ata index to update * * Scan the interfaces attached to this device and do any * necessary per port setup. Attach the devices and ask the @@ -517,25 +522,26 @@ static int ide_setup_pci_controller(struct pci_dev *dev, const struct ide_port_i * but is also used directly as a helper function by some controllers * where the chipset setup is not the default PCI IDE one. */ - -void ide_pci_setup_ports(struct pci_dev *dev, const struct ide_port_info *d, int pciirq, u8 *idx) + +void ide_pci_setup_ports(struct pci_dev *dev, ide_pci_device_t *d, int pciirq, ata_index_t *index) { int channels = (d->host_flags & IDE_HFLAG_SINGLE) ? 1 : 2, port; + int at_least_one_hwif_enabled = 0; ide_hwif_t *hwif, *mate = NULL; u8 tmp; + index->all = 0xf0f0; + /* * Set up the IDE ports */ - + for (port = 0; port < channels; ++port) { - const ide_pci_enablebit_t *e = &(d->enablebits[port]); - + ide_pci_enablebit_t *e = &(d->enablebits[port]); + if (e->reg && (pci_read_config_byte(dev, e->reg, &tmp) || - (tmp & e->mask) != e->val)) { - printk(KERN_INFO "%s: IDE port disabled\n", d->name); + (tmp & e->mask) != e->val)) continue; /* port not enabled */ - } if ((hwif = ide_hwif_configure(dev, d, mate, port, pciirq)) == NULL) continue; @@ -543,7 +549,11 @@ void ide_pci_setup_ports(struct pci_dev *dev, const struct ide_port_info *d, int /* setup proper ancestral information */ hwif->gendev.parent = &dev->dev; - *(idx + port) = hwif->index; + if (hwif->channel) { + index->b.high = hwif->index; + } else { + index->b.low = hwif->index; + } if (d->init_iops) @@ -552,28 +562,15 @@ void ide_pci_setup_ports(struct pci_dev *dev, const struct ide_port_info *d, int if ((d->host_flags & IDE_HFLAG_NO_DMA) == 0) ide_hwif_setup_dma(dev, d, hwif); - if ((!hwif->irq && (d->host_flags & IDE_HFLAG_LEGACY_IRQS)) || - (d->host_flags & IDE_HFLAG_FORCE_LEGACY_IRQS)) + if ((d->host_flags & IDE_HFLAG_LEGACY_IRQS) && hwif->irq == 0) hwif->irq = port ? 15 : 14; - hwif->fixup = d->fixup; - hwif->host_flags = d->host_flags; hwif->pio_mask = d->pio_mask; if ((d->host_flags & IDE_HFLAG_SERIALIZE) && hwif->mate) hwif->mate->serialized = hwif->serialized = 1; - if (d->host_flags & IDE_HFLAG_IO_32BIT) { - hwif->drives[0].io_32bit = 1; - hwif->drives[1].io_32bit = 1; - } - - if (d->host_flags & IDE_HFLAG_UNMASK_IRQS) { - hwif->drives[0].unmask = 1; - hwif->drives[1].unmask = 1; - } - if (hwif->dma_base) { hwif->swdma_mask = d->swdma_mask; hwif->mwdma_mask = d->mwdma_mask; @@ -583,9 +580,6 @@ void ide_pci_setup_ports(struct pci_dev *dev, const struct ide_port_info *d, int hwif->drives[0].autotune = 1; hwif->drives[1].autotune = 1; - if (d->host_flags & IDE_HFLAG_RQSIZE_256) - hwif->rqsize = 256; - if (d->init_hwif) /* Call chipset-specific routine * for each enabled hwif @@ -593,7 +587,10 @@ void ide_pci_setup_ports(struct pci_dev *dev, const struct ide_port_info *d, int d->init_hwif(hwif); mate = hwif; + at_least_one_hwif_enabled = 1; } + if (!at_least_one_hwif_enabled) + printk(KERN_INFO "%s: neither IDE port enabled (BIOS)\n", d->name); } EXPORT_SYMBOL_GPL(ide_pci_setup_ports); @@ -605,13 +602,13 @@ EXPORT_SYMBOL_GPL(ide_pci_setup_ports); * * One thing that is not standardized is the location of the * primary/secondary interface "enable/disable" bits. For chipsets that - * we "know" about, this information is in the struct ide_port_info; + * we "know" about, this information is in the ide_pci_device_t struct; * for all other chipsets, we just assume both interfaces are enabled. */ -static int do_ide_setup_pci_device(struct pci_dev *dev, - const struct ide_port_info *d, - u8 *idx, u8 noisy) +static int do_ide_setup_pci_device(struct pci_dev *dev, ide_pci_device_t *d, + ata_index_t *index, u8 noisy) { + static ata_index_t ata_index = { .b = { .low = 0xff, .high = 0xff } }; int tried_config = 0; int pciirq, ret; @@ -661,35 +658,51 @@ static int do_ide_setup_pci_device(struct pci_dev *dev, /* FIXME: silent failure can happen */ - ide_pci_setup_ports(dev, d, pciirq, idx); + *index = ata_index; + ide_pci_setup_ports(dev, d, pciirq, index); out: return ret; } -int ide_setup_pci_device(struct pci_dev *dev, const struct ide_port_info *d) +int ide_setup_pci_device(struct pci_dev *dev, ide_pci_device_t *d) { - u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; + ide_hwif_t *hwif = NULL, *mate = NULL; + ata_index_t index_list; int ret; - ret = do_ide_setup_pci_device(dev, d, &idx[0], 1); + ret = do_ide_setup_pci_device(dev, d, &index_list, 1); + if (ret < 0) + goto out; - if (ret >= 0) - ide_device_add(idx); + if ((index_list.b.low & 0xf0) != 0xf0) + hwif = &ide_hwifs[index_list.b.low]; + if ((index_list.b.high & 0xf0) != 0xf0) + mate = &ide_hwifs[index_list.b.high]; + if (hwif) + probe_hwif_init_with_fixup(hwif, d->fixup); + if (mate) + probe_hwif_init_with_fixup(mate, d->fixup); + + if (hwif) + ide_proc_register_port(hwif); + if (mate) + ide_proc_register_port(mate); +out: return ret; } EXPORT_SYMBOL_GPL(ide_setup_pci_device); int ide_setup_pci_devices(struct pci_dev *dev1, struct pci_dev *dev2, - const struct ide_port_info *d) + ide_pci_device_t *d) { struct pci_dev *pdev[] = { dev1, dev2 }; + ata_index_t index_list[2]; int ret, i; - u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; for (i = 0; i < 2; i++) { - ret = do_ide_setup_pci_device(pdev[i], d, &idx[i*2], !i); + ret = do_ide_setup_pci_device(pdev[i], d, index_list + i, !i); /* * FIXME: Mom, mom, they stole me the helper function to undo * do_ide_setup_pci_device() on the first device! @@ -698,7 +711,25 @@ int ide_setup_pci_devices(struct pci_dev *dev1, struct pci_dev *dev2, goto out; } - ide_device_add(idx); + for (i = 0; i < 2; i++) { + u8 idx[2] = { index_list[i].b.low, index_list[i].b.high }; + int j; + + for (j = 0; j < 2; j++) { + if ((idx[j] & 0xf0) != 0xf0) + probe_hwif_init(ide_hwifs + idx[j]); + } + } + + for (i = 0; i < 2; i++) { + u8 idx[2] = { index_list[i].b.low, index_list[i].b.high }; + int j; + + for (j = 0; j < 2; j++) { + if ((idx[j] & 0xf0) != 0xf0) + ide_proc_register_port(ide_hwifs + idx[j]); + } + } out: return ret; } @@ -723,6 +754,9 @@ static LIST_HEAD(ide_pci_drivers); * hands the controllers off to the core PCI code to do the rest of * the work. * + * The driver_data of the driver table must point to an ide_pci_device_t + * describing the interface. + * * Returns are the same as for pci_register_driver */ diff --git a/trunk/drivers/input/gameport/gameport.c b/trunk/drivers/input/gameport/gameport.c index bfc6061f1554..ec1b6cfefcd3 100644 --- a/trunk/drivers/input/gameport/gameport.c +++ b/trunk/drivers/input/gameport/gameport.c @@ -136,8 +136,7 @@ static int gameport_measure_speed(struct gameport *gameport) } gameport_close(gameport); - return (cpu_data(raw_smp_processor_id()).loops_per_jiffy * - (unsigned long)HZ / (1000 / 50)) / (tx < 1 ? 1 : tx); + return (cpu_data[raw_smp_processor_id()].loops_per_jiffy * (unsigned long)HZ / (1000 / 50)) / (tx < 1 ? 1 : tx); #else diff --git a/trunk/drivers/macintosh/mediabay.c b/trunk/drivers/macintosh/mediabay.c index 48d647abea46..c803d2bba65d 100644 --- a/trunk/drivers/macintosh/mediabay.c +++ b/trunk/drivers/macintosh/mediabay.c @@ -563,7 +563,7 @@ static void media_bay_step(int i) ide_init_hwif_ports(&hw, (unsigned long) bay->cd_base, (unsigned long) 0, NULL); hw.irq = bay->cd_irq; hw.chipset = ide_pmac; - bay->cd_index = ide_register_hw(&hw, NULL, 0, NULL); + bay->cd_index = ide_register_hw(&hw, 0, NULL); pmu_resume(); } if (bay->cd_index == -1) { diff --git a/trunk/drivers/md/Kconfig b/trunk/drivers/md/Kconfig index 9b6fbf044fd8..34a8c60a254a 100644 --- a/trunk/drivers/md/Kconfig +++ b/trunk/drivers/md/Kconfig @@ -267,12 +267,6 @@ config DM_MULTIPATH_RDAC ---help--- Multipath support for LSI/Engenio RDAC. -config DM_MULTIPATH_HP - tristate "HP MSA multipath support (EXPERIMENTAL)" - depends on DM_MULTIPATH && BLK_DEV_DM && EXPERIMENTAL - ---help--- - Multipath support for HP MSA (Active/Passive) series hardware. - config DM_DELAY tristate "I/O delaying target (EXPERIMENTAL)" depends on BLK_DEV_DM && EXPERIMENTAL @@ -282,10 +276,4 @@ config DM_DELAY If unsure, say N. -config DM_UEVENT - bool "DM uevents (EXPERIMENTAL)" - depends on BLK_DEV_DM && EXPERIMENTAL - ---help--- - Generate udev events for DM events. - endif # MD diff --git a/trunk/drivers/md/Makefile b/trunk/drivers/md/Makefile index d9aa7edb8780..c49366cdc05d 100644 --- a/trunk/drivers/md/Makefile +++ b/trunk/drivers/md/Makefile @@ -8,7 +8,6 @@ dm-multipath-objs := dm-hw-handler.o dm-path-selector.o dm-mpath.o dm-snapshot-objs := dm-snap.o dm-exception-store.o dm-mirror-objs := dm-log.o dm-raid1.o dm-rdac-objs := dm-mpath-rdac.o -dm-hp-sw-objs := dm-mpath-hp-sw.o md-mod-objs := md.o bitmap.o raid456-objs := raid5.o raid6algos.o raid6recov.o raid6tables.o \ raid6int1.o raid6int2.o raid6int4.o \ @@ -36,7 +35,6 @@ obj-$(CONFIG_DM_CRYPT) += dm-crypt.o obj-$(CONFIG_DM_DELAY) += dm-delay.o obj-$(CONFIG_DM_MULTIPATH) += dm-multipath.o dm-round-robin.o obj-$(CONFIG_DM_MULTIPATH_EMC) += dm-emc.o -obj-$(CONFIG_DM_MULTIPATH_HP) += dm-hp-sw.o obj-$(CONFIG_DM_MULTIPATH_RDAC) += dm-rdac.o obj-$(CONFIG_DM_SNAPSHOT) += dm-snapshot.o obj-$(CONFIG_DM_MIRROR) += dm-mirror.o @@ -50,10 +48,6 @@ ifeq ($(CONFIG_ALTIVEC),y) altivec_flags := -maltivec -mabi=altivec endif -ifeq ($(CONFIG_DM_UEVENT),y) -dm-mod-objs += dm-uevent.o -endif - targets += raid6int1.c $(obj)/raid6int1.c: UNROLL := 1 $(obj)/raid6int1.c: $(src)/raid6int.uc $(src)/unroll.pl FORCE diff --git a/trunk/drivers/md/dm-bio-list.h b/trunk/drivers/md/dm-bio-list.h index d4509be0fe67..3f7b827649e3 100644 --- a/trunk/drivers/md/dm-bio-list.h +++ b/trunk/drivers/md/dm-bio-list.h @@ -21,6 +21,11 @@ static inline int bio_list_empty(const struct bio_list *bl) return bl->head == NULL; } +#define BIO_LIST_INIT { .head = NULL, .tail = NULL } + +#define BIO_LIST(bl) \ + struct bio_list bl = BIO_LIST_INIT + static inline void bio_list_init(struct bio_list *bl) { bl->head = bl->tail = NULL; diff --git a/trunk/drivers/md/dm-crypt.c b/trunk/drivers/md/dm-crypt.c index b41f945df8a1..64fee90bb68b 100644 --- a/trunk/drivers/md/dm-crypt.c +++ b/trunk/drivers/md/dm-crypt.c @@ -36,6 +36,7 @@ struct dm_crypt_io { struct work_struct work; atomic_t pending; int error; + int post_process; }; /* @@ -56,7 +57,7 @@ struct crypt_config; struct crypt_iv_operations { int (*ctr)(struct crypt_config *cc, struct dm_target *ti, - const char *opts); + const char *opts); void (*dtr)(struct crypt_config *cc); const char *(*status)(struct crypt_config *cc); int (*generator)(struct crypt_config *cc, u8 *iv, sector_t sector); @@ -79,8 +80,6 @@ struct crypt_config { mempool_t *page_pool; struct bio_set *bs; - struct workqueue_struct *io_queue; - struct workqueue_struct *crypt_queue; /* * crypto related data */ @@ -138,7 +137,7 @@ static int crypt_iv_plain_gen(struct crypt_config *cc, u8 *iv, sector_t sector) } static int crypt_iv_essiv_ctr(struct crypt_config *cc, struct dm_target *ti, - const char *opts) + const char *opts) { struct crypto_cipher *essiv_tfm; struct crypto_hash *hash_tfm; @@ -176,7 +175,6 @@ static int crypt_iv_essiv_ctr(struct crypt_config *cc, struct dm_target *ti, if (err) { ti->error = "Error calculating hash in ESSIV"; - kfree(salt); return err; } @@ -190,7 +188,7 @@ static int crypt_iv_essiv_ctr(struct crypt_config *cc, struct dm_target *ti, if (crypto_cipher_blocksize(essiv_tfm) != crypto_blkcipher_ivsize(cc->tfm)) { ti->error = "Block size of ESSIV cipher does " - "not match IV size of block cipher"; + "not match IV size of block cipher"; crypto_free_cipher(essiv_tfm); kfree(salt); return -EINVAL; @@ -321,10 +319,10 @@ crypt_convert_scatterlist(struct crypt_config *cc, struct scatterlist *out, return r; } -static void crypt_convert_init(struct crypt_config *cc, - struct convert_context *ctx, - struct bio *bio_out, struct bio *bio_in, - sector_t sector, int write) +static void +crypt_convert_init(struct crypt_config *cc, struct convert_context *ctx, + struct bio *bio_out, struct bio *bio_in, + sector_t sector, int write) { ctx->bio_in = bio_in; ctx->bio_out = bio_out; @@ -340,7 +338,7 @@ static void crypt_convert_init(struct crypt_config *cc, * Encrypt / decrypt data from one bio to another one (can be the same one) */ static int crypt_convert(struct crypt_config *cc, - struct convert_context *ctx) + struct convert_context *ctx) { int r = 0; @@ -372,7 +370,7 @@ static int crypt_convert(struct crypt_config *cc, } r = crypt_convert_scatterlist(cc, &sg_out, &sg_in, sg_in.length, - ctx->write, ctx->sector); + ctx->write, ctx->sector); if (r < 0) break; @@ -382,13 +380,13 @@ static int crypt_convert(struct crypt_config *cc, return r; } -static void dm_crypt_bio_destructor(struct bio *bio) -{ + static void dm_crypt_bio_destructor(struct bio *bio) + { struct dm_crypt_io *io = bio->bi_private; struct crypt_config *cc = io->target->private; bio_free(bio, cc->bs); -} + } /* * Generate a new unfragmented bio with the given size @@ -460,7 +458,7 @@ static void crypt_free_buffer_pages(struct crypt_config *cc, struct bio *clone) * One of the bios was finished. Check for completion of * the whole request and correctly clean up the buffer. */ -static void crypt_dec_pending(struct dm_crypt_io *io, int error) +static void dec_pending(struct dm_crypt_io *io, int error) { struct crypt_config *cc = (struct crypt_config *) io->target->private; @@ -476,36 +474,18 @@ static void crypt_dec_pending(struct dm_crypt_io *io, int error) } /* - * kcryptd/kcryptd_io: + * kcryptd: * * Needed because it would be very unwise to do decryption in an * interrupt context. - * - * kcryptd performs the actual encryption or decryption. - * - * kcryptd_io performs the IO submission. - * - * They must be separated as otherwise the final stages could be - * starved by new requests which can block in the first stages due - * to memory allocation. */ +static struct workqueue_struct *_kcryptd_workqueue; static void kcryptd_do_work(struct work_struct *work); -static void kcryptd_do_crypt(struct work_struct *work); static void kcryptd_queue_io(struct dm_crypt_io *io) { - struct crypt_config *cc = io->target->private; - INIT_WORK(&io->work, kcryptd_do_work); - queue_work(cc->io_queue, &io->work); -} - -static void kcryptd_queue_crypt(struct dm_crypt_io *io) -{ - struct crypt_config *cc = io->target->private; - - INIT_WORK(&io->work, kcryptd_do_crypt); - queue_work(cc->crypt_queue, &io->work); + queue_work(_kcryptd_workqueue, &io->work); } static void crypt_endio(struct bio *clone, int error) @@ -528,12 +508,13 @@ static void crypt_endio(struct bio *clone, int error) } bio_put(clone); - kcryptd_queue_crypt(io); + io->post_process = 1; + kcryptd_queue_io(io); return; out: bio_put(clone); - crypt_dec_pending(io, error); + dec_pending(io, error); } static void clone_init(struct dm_crypt_io *io, struct bio *clone) @@ -563,7 +544,7 @@ static void process_read(struct dm_crypt_io *io) */ clone = bio_alloc_bioset(GFP_NOIO, bio_segments(base_bio), cc->bs); if (unlikely(!clone)) { - crypt_dec_pending(io, -ENOMEM); + dec_pending(io, -ENOMEM); return; } @@ -598,7 +579,7 @@ static void process_write(struct dm_crypt_io *io) while (remaining) { clone = crypt_alloc_buffer(io, remaining); if (unlikely(!clone)) { - crypt_dec_pending(io, -ENOMEM); + dec_pending(io, -ENOMEM); return; } @@ -608,7 +589,7 @@ static void process_write(struct dm_crypt_io *io) if (unlikely(crypt_convert(cc, &ctx) < 0)) { crypt_free_buffer_pages(cc, clone); bio_put(clone); - crypt_dec_pending(io, -EIO); + dec_pending(io, -EIO); return; } @@ -643,23 +624,17 @@ static void process_read_endio(struct dm_crypt_io *io) crypt_convert_init(cc, &ctx, io->base_bio, io->base_bio, io->base_bio->bi_sector - io->target->begin, 0); - crypt_dec_pending(io, crypt_convert(cc, &ctx)); + dec_pending(io, crypt_convert(cc, &ctx)); } static void kcryptd_do_work(struct work_struct *work) { struct dm_crypt_io *io = container_of(work, struct dm_crypt_io, work); - if (bio_data_dir(io->base_bio) == READ) - process_read(io); -} - -static void kcryptd_do_crypt(struct work_struct *work) -{ - struct dm_crypt_io *io = container_of(work, struct dm_crypt_io, work); - - if (bio_data_dir(io->base_bio) == READ) + if (io->post_process) process_read_endio(io); + else if (bio_data_dir(io->base_bio) == READ) + process_read(io); else process_write(io); } @@ -715,7 +690,7 @@ static int crypt_set_key(struct crypt_config *cc, char *key) cc->key_size = key_size; /* initial settings */ if ((!key_size && strcmp(key, "-")) || - (key_size && crypt_decode_key(cc->key, key, key_size) < 0)) + (key_size && crypt_decode_key(cc->key, key, key_size) < 0)) return -EINVAL; set_bit(DM_CRYPT_KEY_VALID, &cc->flags); @@ -771,7 +746,7 @@ static int crypt_ctr(struct dm_target *ti, unsigned int argc, char **argv) if (crypt_set_key(cc, argv[1])) { ti->error = "Error decoding key"; - goto bad_cipher; + goto bad1; } /* Compatiblity mode for old dm-crypt cipher strings */ @@ -782,19 +757,19 @@ static int crypt_ctr(struct dm_target *ti, unsigned int argc, char **argv) if (strcmp(chainmode, "ecb") && !ivmode) { ti->error = "This chaining mode requires an IV mechanism"; - goto bad_cipher; + goto bad1; } - if (snprintf(cc->cipher, CRYPTO_MAX_ALG_NAME, "%s(%s)", - chainmode, cipher) >= CRYPTO_MAX_ALG_NAME) { + if (snprintf(cc->cipher, CRYPTO_MAX_ALG_NAME, "%s(%s)", chainmode, + cipher) >= CRYPTO_MAX_ALG_NAME) { ti->error = "Chain mode + cipher name is too long"; - goto bad_cipher; + goto bad1; } tfm = crypto_alloc_blkcipher(cc->cipher, 0, CRYPTO_ALG_ASYNC); if (IS_ERR(tfm)) { ti->error = "Error allocating crypto tfm"; - goto bad_cipher; + goto bad1; } strcpy(cc->cipher, cipher); @@ -818,18 +793,18 @@ static int crypt_ctr(struct dm_target *ti, unsigned int argc, char **argv) cc->iv_gen_ops = &crypt_iv_null_ops; else { ti->error = "Invalid IV mode"; - goto bad_ivmode; + goto bad2; } if (cc->iv_gen_ops && cc->iv_gen_ops->ctr && cc->iv_gen_ops->ctr(cc, ti, ivopts) < 0) - goto bad_ivmode; + goto bad2; cc->iv_size = crypto_blkcipher_ivsize(tfm); if (cc->iv_size) /* at least a 64 bit sector number should fit in our buffer */ cc->iv_size = max(cc->iv_size, - (unsigned int)(sizeof(u64) / sizeof(u8))); + (unsigned int)(sizeof(u64) / sizeof(u8))); else { if (cc->iv_gen_ops) { DMWARN("Selected cipher does not support IVs"); @@ -842,13 +817,13 @@ static int crypt_ctr(struct dm_target *ti, unsigned int argc, char **argv) cc->io_pool = mempool_create_slab_pool(MIN_IOS, _crypt_io_pool); if (!cc->io_pool) { ti->error = "Cannot allocate crypt io mempool"; - goto bad_slab_pool; + goto bad3; } cc->page_pool = mempool_create_page_pool(MIN_POOL_PAGES, 0); if (!cc->page_pool) { ti->error = "Cannot allocate page mempool"; - goto bad_page_pool; + goto bad4; } cc->bs = bioset_create(MIN_IOS, MIN_IOS); @@ -859,25 +834,25 @@ static int crypt_ctr(struct dm_target *ti, unsigned int argc, char **argv) if (crypto_blkcipher_setkey(tfm, cc->key, key_size) < 0) { ti->error = "Error setting key"; - goto bad_device; + goto bad5; } if (sscanf(argv[2], "%llu", &tmpll) != 1) { ti->error = "Invalid iv_offset sector"; - goto bad_device; + goto bad5; } cc->iv_offset = tmpll; if (sscanf(argv[4], "%llu", &tmpll) != 1) { ti->error = "Invalid device sector"; - goto bad_device; + goto bad5; } cc->start = tmpll; if (dm_get_device(ti, argv[3], cc->start, ti->len, - dm_table_get_mode(ti->table), &cc->dev)) { + dm_table_get_mode(ti->table), &cc->dev)) { ti->error = "Device lookup failed"; - goto bad_device; + goto bad5; } if (ivmode && cc->iv_gen_ops) { @@ -886,45 +861,27 @@ static int crypt_ctr(struct dm_target *ti, unsigned int argc, char **argv) cc->iv_mode = kmalloc(strlen(ivmode) + 1, GFP_KERNEL); if (!cc->iv_mode) { ti->error = "Error kmallocing iv_mode string"; - goto bad_ivmode_string; + goto bad5; } strcpy(cc->iv_mode, ivmode); } else cc->iv_mode = NULL; - cc->io_queue = create_singlethread_workqueue("kcryptd_io"); - if (!cc->io_queue) { - ti->error = "Couldn't create kcryptd io queue"; - goto bad_io_queue; - } - - cc->crypt_queue = create_singlethread_workqueue("kcryptd"); - if (!cc->crypt_queue) { - ti->error = "Couldn't create kcryptd queue"; - goto bad_crypt_queue; - } - ti->private = cc; return 0; -bad_crypt_queue: - destroy_workqueue(cc->io_queue); -bad_io_queue: - kfree(cc->iv_mode); -bad_ivmode_string: - dm_put_device(ti, cc->dev); -bad_device: +bad5: bioset_free(cc->bs); bad_bs: mempool_destroy(cc->page_pool); -bad_page_pool: +bad4: mempool_destroy(cc->io_pool); -bad_slab_pool: +bad3: if (cc->iv_gen_ops && cc->iv_gen_ops->dtr) cc->iv_gen_ops->dtr(cc); -bad_ivmode: +bad2: crypto_free_blkcipher(tfm); -bad_cipher: +bad1: /* Must zero key material before freeing */ memset(cc, 0, sizeof(*cc) + cc->key_size * sizeof(u8)); kfree(cc); @@ -935,8 +892,7 @@ static void crypt_dtr(struct dm_target *ti) { struct crypt_config *cc = (struct crypt_config *) ti->private; - destroy_workqueue(cc->io_queue); - destroy_workqueue(cc->crypt_queue); + flush_workqueue(_kcryptd_workqueue); bioset_free(cc->bs); mempool_destroy(cc->page_pool); @@ -962,13 +918,9 @@ static int crypt_map(struct dm_target *ti, struct bio *bio, io = mempool_alloc(cc->io_pool, GFP_NOIO); io->target = ti; io->base_bio = bio; - io->error = 0; + io->error = io->post_process = 0; atomic_set(&io->pending, 0); - - if (bio_data_dir(io->base_bio) == READ) - kcryptd_queue_io(io); - else - kcryptd_queue_crypt(io); + kcryptd_queue_io(io); return DM_MAPIO_SUBMITTED; } @@ -1085,12 +1037,25 @@ static int __init dm_crypt_init(void) if (!_crypt_io_pool) return -ENOMEM; + _kcryptd_workqueue = create_workqueue("kcryptd"); + if (!_kcryptd_workqueue) { + r = -ENOMEM; + DMERR("couldn't create kcryptd"); + goto bad1; + } + r = dm_register_target(&crypt_target); if (r < 0) { DMERR("register failed %d", r); - kmem_cache_destroy(_crypt_io_pool); + goto bad2; } + return 0; + +bad2: + destroy_workqueue(_kcryptd_workqueue); +bad1: + kmem_cache_destroy(_crypt_io_pool); return r; } @@ -1101,6 +1066,7 @@ static void __exit dm_crypt_exit(void) if (r < 0) DMERR("unregister failed %d", r); + destroy_workqueue(_kcryptd_workqueue); kmem_cache_destroy(_crypt_io_pool); } diff --git a/trunk/drivers/md/dm-delay.c b/trunk/drivers/md/dm-delay.c index bdd37f881c42..6928c136d3c5 100644 --- a/trunk/drivers/md/dm-delay.c +++ b/trunk/drivers/md/dm-delay.c @@ -83,7 +83,7 @@ static struct bio *flush_delayed_bios(struct delay_c *dc, int flush_all) struct dm_delay_info *delayed, *next; unsigned long next_expires = 0; int start_timer = 0; - struct bio_list flush_bios = { }; + BIO_LIST(flush_bios); mutex_lock(&delayed_bios_lock); list_for_each_entry_safe(delayed, next, &dc->delayed_bios, list) { @@ -163,32 +163,34 @@ static int delay_ctr(struct dm_target *ti, unsigned int argc, char **argv) goto bad; } - dc->dev_write = NULL; - if (argc == 3) + if (argc == 3) { + dc->dev_write = NULL; goto out; + } if (sscanf(argv[4], "%llu", &tmpll) != 1) { ti->error = "Invalid write device sector"; - goto bad_dev_read; + goto bad; } dc->start_write = tmpll; if (sscanf(argv[5], "%u", &dc->write_delay) != 1) { ti->error = "Invalid write delay"; - goto bad_dev_read; + goto bad; } if (dm_get_device(ti, argv[3], dc->start_write, ti->len, dm_table_get_mode(ti->table), &dc->dev_write)) { ti->error = "Write device lookup failed"; - goto bad_dev_read; + dm_put_device(ti, dc->dev_read); + goto bad; } out: dc->delayed_pool = mempool_create_slab_pool(128, delayed_cache); if (!dc->delayed_pool) { DMERR("Couldn't create delayed bio pool."); - goto bad_dev_write; + goto bad; } setup_timer(&dc->delay_timer, handle_delayed_timer, (unsigned long)dc); @@ -201,11 +203,6 @@ static int delay_ctr(struct dm_target *ti, unsigned int argc, char **argv) ti->private = dc; return 0; -bad_dev_write: - if (dc->dev_write) - dm_put_device(ti, dc->dev_write); -bad_dev_read: - dm_put_device(ti, dc->dev_read); bad: kfree(dc); return -EINVAL; @@ -308,7 +305,7 @@ static int delay_status(struct dm_target *ti, status_type_t type, (unsigned long long) dc->start_read, dc->read_delay); if (dc->dev_write) - DMEMIT(" %s %llu %u", dc->dev_write->name, + DMEMIT("%s %llu %u", dc->dev_write->name, (unsigned long long) dc->start_write, dc->write_delay); break; diff --git a/trunk/drivers/md/dm-emc.c b/trunk/drivers/md/dm-emc.c index 6b91b9ab1d41..342517261ece 100644 --- a/trunk/drivers/md/dm-emc.c +++ b/trunk/drivers/md/dm-emc.c @@ -81,7 +81,7 @@ static struct bio *get_failover_bio(struct dm_path *path, unsigned data_size) } if (bio_add_page(bio, page, data_size, 0) != data_size) { - DMERR("get_failover_bio: bio_add_page() failed."); + DMERR("get_failover_bio: alloc_page() failed."); __free_page(page); bio_put(bio); return NULL; @@ -211,10 +211,12 @@ static void emc_pg_init(struct hw_handler *hwh, unsigned bypassed, static struct emc_handler *alloc_emc_handler(void) { - struct emc_handler *h = kzalloc(sizeof(*h), GFP_KERNEL); + struct emc_handler *h = kmalloc(sizeof(*h), GFP_KERNEL); - if (h) + if (h) { + memset(h, 0, sizeof(*h)); spin_lock_init(&h->lock); + } return h; } diff --git a/trunk/drivers/md/dm-hw-handler.c b/trunk/drivers/md/dm-hw-handler.c index 2ee84d8aa0bf..baafaaba4d4b 100644 --- a/trunk/drivers/md/dm-hw-handler.c +++ b/trunk/drivers/md/dm-hw-handler.c @@ -91,10 +91,12 @@ void dm_put_hw_handler(struct hw_handler_type *hwht) static struct hwh_internal *_alloc_hw_handler(struct hw_handler_type *hwht) { - struct hwh_internal *hwhi = kzalloc(sizeof(*hwhi), GFP_KERNEL); + struct hwh_internal *hwhi = kmalloc(sizeof(*hwhi), GFP_KERNEL); - if (hwhi) + if (hwhi) { + memset(hwhi, 0, sizeof(*hwhi)); hwhi->hwht = *hwht; + } return hwhi; } diff --git a/trunk/drivers/md/dm-hw-handler.h b/trunk/drivers/md/dm-hw-handler.h index 46809dcb121a..e0832e6fcf36 100644 --- a/trunk/drivers/md/dm-hw-handler.h +++ b/trunk/drivers/md/dm-hw-handler.h @@ -58,6 +58,5 @@ unsigned dm_scsi_err_handler(struct hw_handler *hwh, struct bio *bio); #define MP_FAIL_PATH 1 #define MP_BYPASS_PG 2 #define MP_ERROR_IO 4 /* Don't retry this I/O */ -#define MP_RETRY 8 #endif diff --git a/trunk/drivers/md/dm-ioctl.c b/trunk/drivers/md/dm-ioctl.c index 138200bf5e0b..b441d82c338a 100644 --- a/trunk/drivers/md/dm-ioctl.c +++ b/trunk/drivers/md/dm-ioctl.c @@ -700,7 +700,7 @@ static int dev_rename(struct dm_ioctl *param, size_t param_size) int r; char *new_name = (char *) param + param->data_start; - if (new_name < (char *) param->data || + if (new_name < (char *) (param + 1) || invalid_str(new_name, (void *) param + param_size)) { DMWARN("Invalid new logical volume name supplied."); return -EINVAL; @@ -726,7 +726,7 @@ static int dev_set_geometry(struct dm_ioctl *param, size_t param_size) if (!md) return -ENXIO; - if (geostr < (char *) param->data || + if (geostr < (char *) (param + 1) || invalid_str(geostr, (void *) param + param_size)) { DMWARN("Invalid geometry supplied."); goto out; @@ -1233,7 +1233,7 @@ static int target_message(struct dm_ioctl *param, size_t param_size) if (r) goto out; - if (tmsg < (struct dm_target_msg *) param->data || + if (tmsg < (struct dm_target_msg *) (param + 1) || invalid_str(tmsg->message, (void *) param + param_size)) { DMWARN("Invalid target message parameters."); r = -EINVAL; @@ -1358,7 +1358,7 @@ static int copy_params(struct dm_ioctl __user *user, struct dm_ioctl **param) if (tmp.data_size < sizeof(tmp)) return -EINVAL; - dmi = vmalloc(tmp.data_size); + dmi = (struct dm_ioctl *) vmalloc(tmp.data_size); if (!dmi) return -ENOMEM; @@ -1515,35 +1515,3 @@ void dm_interface_exit(void) dm_hash_exit(); } - -/** - * dm_copy_name_and_uuid - Copy mapped device name & uuid into supplied buffers - * @md: Pointer to mapped_device - * @name: Buffer (size DM_NAME_LEN) for name - * @uuid: Buffer (size DM_UUID_LEN) for uuid or empty string if uuid not defined - */ -int dm_copy_name_and_uuid(struct mapped_device *md, char *name, char *uuid) -{ - int r = 0; - struct hash_cell *hc; - - if (!md) - return -ENXIO; - - dm_get(md); - down_read(&_hash_lock); - hc = dm_get_mdptr(md); - if (!hc || hc->md != md) { - r = -ENXIO; - goto out; - } - - strcpy(name, hc->name); - strcpy(uuid, hc->uuid ? : ""); - -out: - up_read(&_hash_lock); - dm_put(md); - - return r; -} diff --git a/trunk/drivers/md/dm-log.c b/trunk/drivers/md/dm-log.c index 072ee4353eab..a66428d860fe 100644 --- a/trunk/drivers/md/dm-log.c +++ b/trunk/drivers/md/dm-log.c @@ -696,7 +696,7 @@ static struct dirty_log_type _disk_type = { .module = THIS_MODULE, .ctr = disk_ctr, .dtr = disk_dtr, - .postsuspend = disk_flush, + .suspend = disk_flush, .resume = disk_resume, .get_region_size = core_get_region_size, .is_clean = core_is_clean, diff --git a/trunk/drivers/md/dm-log.h b/trunk/drivers/md/dm-log.h index 3fae87eb5963..86a301c8daf1 100644 --- a/trunk/drivers/md/dm-log.h +++ b/trunk/drivers/md/dm-log.h @@ -32,8 +32,7 @@ struct dirty_log_type { * There are times when we don't want the log to touch * the disk. */ - int (*presuspend)(struct dirty_log *log); - int (*postsuspend)(struct dirty_log *log); + int (*suspend)(struct dirty_log *log); int (*resume)(struct dirty_log *log); /* diff --git a/trunk/drivers/md/dm-mpath-hp-sw.c b/trunk/drivers/md/dm-mpath-hp-sw.c deleted file mode 100644 index 204bf42c9449..000000000000 --- a/trunk/drivers/md/dm-mpath-hp-sw.c +++ /dev/null @@ -1,248 +0,0 @@ -/* - * Copyright (C) 2005 Mike Christie, All rights reserved. - * Copyright (C) 2007 Red Hat, Inc. All rights reserved. - * Authors: Mike Christie - * Dave Wysochanski - * - * This file is released under the GPL. - * - * This module implements the specific path activation code for - * HP StorageWorks and FSC FibreCat Asymmetric (Active/Passive) - * storage arrays. - * These storage arrays have controller-based failover, not - * LUN-based failover. However, LUN-based failover is the design - * of dm-multipath. Thus, this module is written for LUN-based failover. - */ -#include -#include -#include -#include -#include -#include - -#include "dm.h" -#include "dm-hw-handler.h" - -#define DM_MSG_PREFIX "multipath hp-sw" -#define DM_HP_HWH_NAME "hp-sw" -#define DM_HP_HWH_VER "1.0.0" - -struct hp_sw_context { - unsigned char sense[SCSI_SENSE_BUFFERSIZE]; -}; - -/* - * hp_sw_error_is_retryable - Is an HP-specific check condition retryable? - * @req: path activation request - * - * Examine error codes of request and determine whether the error is retryable. - * Some error codes are already retried by scsi-ml (see - * scsi_decide_disposition), but some HP specific codes are not. - * The intent of this routine is to supply the logic for the HP specific - * check conditions. - * - * Returns: - * 1 - command completed with retryable error - * 0 - command completed with non-retryable error - * - * Possible optimizations - * 1. More hardware-specific error codes - */ -static int hp_sw_error_is_retryable(struct request *req) -{ - /* - * NOT_READY is known to be retryable - * For now we just dump out the sense data and call it retryable - */ - if (status_byte(req->errors) == CHECK_CONDITION) - __scsi_print_sense(DM_HP_HWH_NAME, req->sense, req->sense_len); - - /* - * At this point we don't have complete information about all the error - * codes from this hardware, so we are just conservative and retry - * when in doubt. - */ - return 1; -} - -/* - * hp_sw_end_io - Completion handler for HP path activation. - * @req: path activation request - * @error: scsi-ml error - * - * Check sense data, free request structure, and notify dm that - * pg initialization has completed. - * - * Context: scsi-ml softirq - * - */ -static void hp_sw_end_io(struct request *req, int error) -{ - struct dm_path *path = req->end_io_data; - unsigned err_flags = 0; - - if (!error) { - DMDEBUG("%s path activation command - success", - path->dev->name); - goto out; - } - - if (hp_sw_error_is_retryable(req)) { - DMDEBUG("%s path activation command - retry", - path->dev->name); - err_flags = MP_RETRY; - goto out; - } - - DMWARN("%s path activation fail - error=0x%x", - path->dev->name, error); - err_flags = MP_FAIL_PATH; - -out: - req->end_io_data = NULL; - __blk_put_request(req->q, req); - dm_pg_init_complete(path, err_flags); -} - -/* - * hp_sw_get_request - Allocate an HP specific path activation request - * @path: path on which request will be sent (needed for request queue) - * - * The START command is used for path activation request. - * These arrays are controller-based failover, not LUN based. - * One START command issued to a single path will fail over all - * LUNs for the same controller. - * - * Possible optimizations - * 1. Make timeout configurable - * 2. Preallocate request - */ -static struct request *hp_sw_get_request(struct dm_path *path) -{ - struct request *req; - struct block_device *bdev = path->dev->bdev; - struct request_queue *q = bdev_get_queue(bdev); - struct hp_sw_context *h = path->hwhcontext; - - req = blk_get_request(q, WRITE, GFP_NOIO); - if (!req) - goto out; - - req->timeout = 60 * HZ; - - req->errors = 0; - req->cmd_type = REQ_TYPE_BLOCK_PC; - req->cmd_flags |= REQ_FAILFAST | REQ_NOMERGE; - req->end_io_data = path; - req->sense = h->sense; - memset(req->sense, 0, SCSI_SENSE_BUFFERSIZE); - - memset(&req->cmd, 0, BLK_MAX_CDB); - req->cmd[0] = START_STOP; - req->cmd[4] = 1; - req->cmd_len = COMMAND_SIZE(req->cmd[0]); - -out: - return req; -} - -/* - * hp_sw_pg_init - HP path activation implementation. - * @hwh: hardware handler specific data - * @bypassed: unused; is the path group bypassed? (see dm-mpath.c) - * @path: path to send initialization command - * - * Send an HP-specific path activation command on 'path'. - * Do not try to optimize in any way, just send the activation command. - * More than one path activation command may be sent to the same controller. - * This seems to work fine for basic failover support. - * - * Possible optimizations - * 1. Detect an in-progress activation request and avoid submitting another one - * 2. Model the controller and only send a single activation request at a time - * 3. Determine the state of a path before sending an activation request - * - * Context: kmpathd (see process_queued_ios() in dm-mpath.c) - */ -static void hp_sw_pg_init(struct hw_handler *hwh, unsigned bypassed, - struct dm_path *path) -{ - struct request *req; - struct hp_sw_context *h; - - path->hwhcontext = hwh->context; - h = hwh->context; - - req = hp_sw_get_request(path); - if (!req) { - DMERR("%s path activation command - allocation fail", - path->dev->name); - goto retry; - } - - DMDEBUG("%s path activation command - sent", path->dev->name); - - blk_execute_rq_nowait(req->q, NULL, req, 1, hp_sw_end_io); - return; - -retry: - dm_pg_init_complete(path, MP_RETRY); -} - -static int hp_sw_create(struct hw_handler *hwh, unsigned argc, char **argv) -{ - struct hp_sw_context *h; - - h = kmalloc(sizeof(*h), GFP_KERNEL); - if (!h) - return -ENOMEM; - - hwh->context = h; - - return 0; -} - -static void hp_sw_destroy(struct hw_handler *hwh) -{ - struct hp_sw_context *h = hwh->context; - - kfree(h); -} - -static struct hw_handler_type hp_sw_hwh = { - .name = DM_HP_HWH_NAME, - .module = THIS_MODULE, - .create = hp_sw_create, - .destroy = hp_sw_destroy, - .pg_init = hp_sw_pg_init, -}; - -static int __init hp_sw_init(void) -{ - int r; - - r = dm_register_hw_handler(&hp_sw_hwh); - if (r < 0) - DMERR("register failed %d", r); - else - DMINFO("version " DM_HP_HWH_VER " loaded"); - - return r; -} - -static void __exit hp_sw_exit(void) -{ - int r; - - r = dm_unregister_hw_handler(&hp_sw_hwh); - if (r < 0) - DMERR("unregister failed %d", r); -} - -module_init(hp_sw_init); -module_exit(hp_sw_exit); - -MODULE_DESCRIPTION("DM Multipath HP StorageWorks / FSC FibreCat (A/P) support"); -MODULE_AUTHOR("Mike Christie, Dave Wysochanski "); -MODULE_LICENSE("GPL"); -MODULE_VERSION(DM_HP_HWH_VER); diff --git a/trunk/drivers/md/dm-mpath-rdac.c b/trunk/drivers/md/dm-mpath-rdac.c index e04eb5c697fb..16b161345775 100644 --- a/trunk/drivers/md/dm-mpath-rdac.c +++ b/trunk/drivers/md/dm-mpath-rdac.c @@ -664,21 +664,20 @@ static struct hw_handler_type rdac_handler = { static int __init rdac_init(void) { - int r; + int r = dm_register_hw_handler(&rdac_handler); + + if (r < 0) { + DMERR("%s: register failed %d", RDAC_DM_HWH_NAME, r); + return r; + } rdac_wkqd = create_singlethread_workqueue("rdac_wkqd"); if (!rdac_wkqd) { DMERR("Failed to create workqueue rdac_wkqd."); + dm_unregister_hw_handler(&rdac_handler); return -ENOMEM; } - r = dm_register_hw_handler(&rdac_handler); - if (r < 0) { - DMERR("%s: register failed %d", RDAC_DM_HWH_NAME, r); - destroy_workqueue(rdac_wkqd); - return r; - } - DMINFO("%s: version %s loaded", RDAC_DM_HWH_NAME, RDAC_DM_HWH_VER); return 0; } diff --git a/trunk/drivers/md/dm-mpath.c b/trunk/drivers/md/dm-mpath.c index 24b2b1e32fae..31056abca89d 100644 --- a/trunk/drivers/md/dm-mpath.c +++ b/trunk/drivers/md/dm-mpath.c @@ -10,7 +10,6 @@ #include "dm-hw-handler.h" #include "dm-bio-list.h" #include "dm-bio-record.h" -#include "dm-uevent.h" #include #include @@ -76,8 +75,6 @@ struct multipath { unsigned queue_io; /* Must we queue all I/O? */ unsigned queue_if_no_path; /* Queue I/O if last path fails? */ unsigned saved_queue_if_no_path;/* Saved state during suspension */ - unsigned pg_init_retries; /* Number of times to retry pg_init */ - unsigned pg_init_count; /* Number of times pg_init called */ struct work_struct process_queued_ios; struct bio_list queued_ios; @@ -228,8 +225,6 @@ static void __switch_pg(struct multipath *m, struct pgpath *pgpath) m->pg_init_required = 0; m->queue_io = 0; } - - m->pg_init_count = 0; } static int __choose_path_in_pg(struct multipath *m, struct priority_group *pg) @@ -429,7 +424,6 @@ static void process_queued_ios(struct work_struct *work) must_queue = 0; if (m->pg_init_required && !m->pg_init_in_progress) { - m->pg_init_count++; m->pg_init_required = 0; m->pg_init_in_progress = 1; init_required = 1; @@ -695,11 +689,9 @@ static int parse_features(struct arg_set *as, struct multipath *m) int r; unsigned argc; struct dm_target *ti = m->ti; - const char *param_name; static struct param _params[] = { - {0, 3, "invalid number of feature args"}, - {1, 50, "pg_init_retries must be between 1 and 50"}, + {0, 1, "invalid number of feature args"}, }; r = read_param(_params, shift(as), &argc, &ti->error); @@ -709,28 +701,12 @@ static int parse_features(struct arg_set *as, struct multipath *m) if (!argc) return 0; - do { - param_name = shift(as); - argc--; - - if (!strnicmp(param_name, MESG_STR("queue_if_no_path"))) { - r = queue_if_no_path(m, 1, 0); - continue; - } - - if (!strnicmp(param_name, MESG_STR("pg_init_retries")) && - (argc >= 1)) { - r = read_param(_params + 1, shift(as), - &m->pg_init_retries, &ti->error); - argc--; - continue; - } - + if (!strnicmp(shift(as), MESG_STR("queue_if_no_path"))) + return queue_if_no_path(m, 1, 0); + else { ti->error = "Unrecognised multipath feature request"; - r = -EINVAL; - } while (argc && !r); - - return r; + return -EINVAL; + } } static int multipath_ctr(struct dm_target *ti, unsigned int argc, @@ -858,9 +834,6 @@ static int fail_path(struct pgpath *pgpath) if (pgpath == m->current_pgpath) m->current_pgpath = NULL; - dm_path_uevent(DM_UEVENT_PATH_FAILED, m->ti, - pgpath->path.dev->name, m->nr_valid_paths); - queue_work(kmultipathd, &m->trigger_event); out: @@ -900,9 +873,6 @@ static int reinstate_path(struct pgpath *pgpath) if (!m->nr_valid_paths++ && m->queue_size) queue_work(kmultipathd, &m->process_queued_ios); - dm_path_uevent(DM_UEVENT_PATH_REINSTATED, m->ti, - pgpath->path.dev->name, m->nr_valid_paths); - queue_work(kmultipathd, &m->trigger_event); out: @@ -1005,26 +975,6 @@ static int bypass_pg_num(struct multipath *m, const char *pgstr, int bypassed) return 0; } -/* - * Should we retry pg_init immediately? - */ -static int pg_init_limit_reached(struct multipath *m, struct pgpath *pgpath) -{ - unsigned long flags; - int limit_reached = 0; - - spin_lock_irqsave(&m->lock, flags); - - if (m->pg_init_count <= m->pg_init_retries) - m->pg_init_required = 1; - else - limit_reached = 1; - - spin_unlock_irqrestore(&m->lock, flags); - - return limit_reached; -} - /* * pg_init must call this when it has completed its initialisation */ @@ -1035,14 +985,8 @@ void dm_pg_init_complete(struct dm_path *path, unsigned err_flags) struct multipath *m = pg->m; unsigned long flags; - /* - * If requested, retry pg_init until maximum number of retries exceeded. - * If retry not requested and PG already bypassed, always fail the path. - */ - if (err_flags & MP_RETRY) { - if (pg_init_limit_reached(m, pgpath)) - err_flags |= MP_FAIL_PATH; - } else if (err_flags && pg->bypassed) + /* We insist on failing the path if the PG is already bypassed. */ + if (err_flags && pg->bypassed) err_flags |= MP_FAIL_PATH; if (err_flags & MP_FAIL_PATH) @@ -1052,7 +996,7 @@ void dm_pg_init_complete(struct dm_path *path, unsigned err_flags) bypass_pg(m, pg, 1); spin_lock_irqsave(&m->lock, flags); - if (err_flags & ~MP_RETRY) { + if (err_flags) { m->current_pgpath = NULL; m->current_pg = NULL; } else if (!m->pg_init_required) @@ -1204,15 +1148,11 @@ static int multipath_status(struct dm_target *ti, status_type_t type, /* Features */ if (type == STATUSTYPE_INFO) - DMEMIT("2 %u %u ", m->queue_size, m->pg_init_count); - else { - DMEMIT("%u ", m->queue_if_no_path + - (m->pg_init_retries > 0) * 2); - if (m->queue_if_no_path) - DMEMIT("queue_if_no_path "); - if (m->pg_init_retries) - DMEMIT("pg_init_retries %u ", m->pg_init_retries); - } + DMEMIT("1 %u ", m->queue_size); + else if (m->queue_if_no_path) + DMEMIT("1 queue_if_no_path "); + else + DMEMIT("0 "); if (hwh->type && hwh->type->status) sz += hwh->type->status(hwh, type, result + sz, maxlen - sz); diff --git a/trunk/drivers/md/dm-path-selector.c b/trunk/drivers/md/dm-path-selector.c index ca1bb636a3e4..f10a0c89b3f4 100644 --- a/trunk/drivers/md/dm-path-selector.c +++ b/trunk/drivers/md/dm-path-selector.c @@ -94,10 +94,12 @@ void dm_put_path_selector(struct path_selector_type *pst) static struct ps_internal *_alloc_path_selector(struct path_selector_type *pst) { - struct ps_internal *psi = kzalloc(sizeof(*psi), GFP_KERNEL); + struct ps_internal *psi = kmalloc(sizeof(*psi), GFP_KERNEL); - if (psi) + if (psi) { + memset(psi, 0, sizeof(*psi)); psi->pst = *pst; + } return psi; } diff --git a/trunk/drivers/md/dm-raid1.c b/trunk/drivers/md/dm-raid1.c index 31123d4a6b9c..d09ff15490a5 100644 --- a/trunk/drivers/md/dm-raid1.c +++ b/trunk/drivers/md/dm-raid1.c @@ -19,7 +19,6 @@ #include #include #include -#include #define DM_MSG_PREFIX "raid1" #define DM_IO_PAGES 64 @@ -114,7 +113,6 @@ struct region { * Mirror set structures. *---------------------------------------------------------------*/ struct mirror { - struct mirror_set *ms; atomic_t error_count; struct dm_dev *dev; sector_t offset; @@ -976,7 +974,6 @@ static struct mirror_set *alloc_context(unsigned int nr_mirrors, if (rh_init(&ms->rh, ms, dl, region_size, ms->nr_regions)) { ti->error = "Error creating dirty region hash"; - dm_io_client_destroy(ms->io_client); kfree(ms); return NULL; } @@ -997,7 +994,7 @@ static void free_context(struct mirror_set *ms, struct dm_target *ti, static inline int _check_region_size(struct dm_target *ti, uint32_t size) { - return !(size % (PAGE_SIZE >> 9) || !is_power_of_2(size) || + return !(size % (PAGE_SIZE >> 9) || (size & (size - 1)) || size > ti->len); } @@ -1018,7 +1015,6 @@ static int get_mirror(struct mirror_set *ms, struct dm_target *ti, return -ENXIO; } - ms->mirror[mirror].ms = ms; ms->mirror[mirror].offset = offset; return 0; @@ -1167,14 +1163,16 @@ static int mirror_ctr(struct dm_target *ti, unsigned int argc, char **argv) ms->kmirrord_wq = create_singlethread_workqueue("kmirrord"); if (!ms->kmirrord_wq) { DMERR("couldn't start kmirrord"); - r = -ENOMEM; - goto err_free_context; + free_context(ms, ti, m); + return -ENOMEM; } INIT_WORK(&ms->kmirrord_work, do_mirror); r = parse_features(ms, argc, argv, &args_used); - if (r) - goto err_destroy_wq; + if (r) { + free_context(ms, ti, ms->nr_mirrors); + return r; + } argv += args_used; argc -= args_used; @@ -1190,22 +1188,19 @@ static int mirror_ctr(struct dm_target *ti, unsigned int argc, char **argv) if (argc) { ti->error = "Too many mirror arguments"; - r = -EINVAL; - goto err_destroy_wq; + free_context(ms, ti, ms->nr_mirrors); + return -EINVAL; } r = kcopyd_client_create(DM_IO_PAGES, &ms->kcopyd_client); - if (r) - goto err_destroy_wq; + if (r) { + destroy_workqueue(ms->kmirrord_wq); + free_context(ms, ti, ms->nr_mirrors); + return r; + } wake(ms); return 0; - -err_destroy_wq: - destroy_workqueue(ms->kmirrord_wq); -err_free_context: - free_context(ms, ti, ms->nr_mirrors); - return r; } static void mirror_dtr(struct dm_target *ti) @@ -1307,7 +1302,7 @@ static void mirror_postsuspend(struct dm_target *ti) wait_event(_kmirrord_recovery_stopped, !atomic_read(&ms->rh.recovery_in_flight)); - if (log->type->postsuspend && log->type->postsuspend(log)) + if (log->type->suspend && log->type->suspend(log)) /* FIXME: need better error handling */ DMWARN("log suspend failed"); } diff --git a/trunk/drivers/md/dm-snap.c b/trunk/drivers/md/dm-snap.c index cee16fadd9ee..98a633f3d6b0 100644 --- a/trunk/drivers/md/dm-snap.c +++ b/trunk/drivers/md/dm-snap.c @@ -17,7 +17,6 @@ #include #include #include -#include #include "dm-snap.h" #include "dm-bio-list.h" @@ -416,7 +415,7 @@ static int set_chunk_size(struct dm_snapshot *s, const char *chunk_size_arg, chunk_size = round_up(chunk_size, PAGE_SIZE >> 9); /* Check chunk_size is a power of 2 */ - if (!is_power_of_2(chunk_size)) { + if (chunk_size & (chunk_size - 1)) { *error = "Chunk size is not a power of 2"; return -EINVAL; } diff --git a/trunk/drivers/md/dm-stripe.c b/trunk/drivers/md/dm-stripe.c index 969944a8aba2..51f5e0760012 100644 --- a/trunk/drivers/md/dm-stripe.c +++ b/trunk/drivers/md/dm-stripe.c @@ -11,7 +11,6 @@ #include #include #include -#include #define DM_MSG_PREFIX "striped" @@ -100,7 +99,7 @@ static int stripe_ctr(struct dm_target *ti, unsigned int argc, char **argv) /* * chunk_size is a power of two */ - if (!is_power_of_2(chunk_size) || + if (!chunk_size || (chunk_size & (chunk_size - 1)) || (chunk_size < (PAGE_SIZE >> SECTOR_SHIFT))) { ti->error = "Invalid chunk size"; return -EINVAL; diff --git a/trunk/drivers/md/dm-table.c b/trunk/drivers/md/dm-table.c index 8939e6105088..fbe477bb2c68 100644 --- a/trunk/drivers/md/dm-table.c +++ b/trunk/drivers/md/dm-table.c @@ -213,11 +213,12 @@ static int alloc_targets(struct dm_table *t, unsigned int num) int dm_table_create(struct dm_table **result, int mode, unsigned num_targets, struct mapped_device *md) { - struct dm_table *t = kzalloc(sizeof(*t), GFP_KERNEL); + struct dm_table *t = kmalloc(sizeof(*t), GFP_KERNEL); if (!t) return -ENOMEM; + memset(t, 0, sizeof(*t)); INIT_LIST_HEAD(&t->devices); atomic_set(&t->holders, 1); diff --git a/trunk/drivers/md/dm-target.c b/trunk/drivers/md/dm-target.c index 835cf95b857f..477a041a41cf 100644 --- a/trunk/drivers/md/dm-target.c +++ b/trunk/drivers/md/dm-target.c @@ -88,10 +88,12 @@ void dm_put_target_type(struct target_type *t) static struct tt_internal *alloc_target(struct target_type *t) { - struct tt_internal *ti = kzalloc(sizeof(*ti), GFP_KERNEL); + struct tt_internal *ti = kmalloc(sizeof(*ti), GFP_KERNEL); - if (ti) + if (ti) { + memset(ti, 0, sizeof(*ti)); ti->tt = *t; + } return ti; } diff --git a/trunk/drivers/md/dm-uevent.c b/trunk/drivers/md/dm-uevent.c deleted file mode 100644 index 50377e5dc2a3..000000000000 --- a/trunk/drivers/md/dm-uevent.c +++ /dev/null @@ -1,222 +0,0 @@ -/* - * Device Mapper Uevent Support (dm-uevent) - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * Copyright IBM Corporation, 2007 - * Author: Mike Anderson - */ -#include -#include -#include -#include - -#include "dm.h" -#include "dm-uevent.h" - -#define DM_MSG_PREFIX "uevent" - -static const struct { - enum dm_uevent_type type; - enum kobject_action action; - char *name; -} _dm_uevent_type_names[] = { - {DM_UEVENT_PATH_FAILED, KOBJ_CHANGE, "PATH_FAILED"}, - {DM_UEVENT_PATH_REINSTATED, KOBJ_CHANGE, "PATH_REINSTATED"}, -}; - -static struct kmem_cache *_dm_event_cache; - -struct dm_uevent { - struct mapped_device *md; - enum kobject_action action; - struct kobj_uevent_env ku_env; - struct list_head elist; - char name[DM_NAME_LEN]; - char uuid[DM_UUID_LEN]; -}; - -static void dm_uevent_free(struct dm_uevent *event) -{ - kmem_cache_free(_dm_event_cache, event); -} - -static struct dm_uevent *dm_uevent_alloc(struct mapped_device *md) -{ - struct dm_uevent *event; - - event = kmem_cache_zalloc(_dm_event_cache, GFP_ATOMIC); - if (!event) - return NULL; - - INIT_LIST_HEAD(&event->elist); - event->md = md; - - return event; -} - -static struct dm_uevent *dm_build_path_uevent(struct mapped_device *md, - struct dm_target *ti, - enum kobject_action action, - const char *dm_action, - const char *path, - unsigned nr_valid_paths) -{ - struct dm_uevent *event; - - event = dm_uevent_alloc(md); - if (!event) { - DMERR("%s: dm_uevent_alloc() failed", __FUNCTION__); - goto err_nomem; - } - - event->action = action; - - if (add_uevent_var(&event->ku_env, "DM_TARGET=%s", ti->type->name)) { - DMERR("%s: add_uevent_var() for DM_TARGET failed", - __FUNCTION__); - goto err_add; - } - - if (add_uevent_var(&event->ku_env, "DM_ACTION=%s", dm_action)) { - DMERR("%s: add_uevent_var() for DM_ACTION failed", - __FUNCTION__); - goto err_add; - } - - if (add_uevent_var(&event->ku_env, "DM_SEQNUM=%u", - dm_next_uevent_seq(md))) { - DMERR("%s: add_uevent_var() for DM_SEQNUM failed", - __FUNCTION__); - goto err_add; - } - - if (add_uevent_var(&event->ku_env, "DM_PATH=%s", path)) { - DMERR("%s: add_uevent_var() for DM_PATH failed", __FUNCTION__); - goto err_add; - } - - if (add_uevent_var(&event->ku_env, "DM_NR_VALID_PATHS=%d", - nr_valid_paths)) { - DMERR("%s: add_uevent_var() for DM_NR_VALID_PATHS failed", - __FUNCTION__); - goto err_add; - } - - return event; - -err_add: - dm_uevent_free(event); -err_nomem: - return ERR_PTR(-ENOMEM); -} - -/** - * dm_send_uevents - send uevents for given list - * - * @events: list of events to send - * @kobj: kobject generating event - * - */ -void dm_send_uevents(struct list_head *events, struct kobject *kobj) -{ - int r; - struct dm_uevent *event, *next; - - list_for_each_entry_safe(event, next, events, elist) { - list_del_init(&event->elist); - - /* - * Need to call dm_copy_name_and_uuid from here for now. - * Context of previous var adds and locking used for - * hash_cell not compatable. - */ - if (dm_copy_name_and_uuid(event->md, event->name, - event->uuid)) { - DMERR("%s: dm_copy_name_and_uuid() failed", - __FUNCTION__); - goto uevent_free; - } - - if (add_uevent_var(&event->ku_env, "DM_NAME=%s", event->name)) { - DMERR("%s: add_uevent_var() for DM_NAME failed", - __FUNCTION__); - goto uevent_free; - } - - if (add_uevent_var(&event->ku_env, "DM_UUID=%s", event->uuid)) { - DMERR("%s: add_uevent_var() for DM_UUID failed", - __FUNCTION__); - goto uevent_free; - } - - r = kobject_uevent_env(kobj, event->action, event->ku_env.envp); - if (r) - DMERR("%s: kobject_uevent_env failed", __FUNCTION__); -uevent_free: - dm_uevent_free(event); - } -} -EXPORT_SYMBOL_GPL(dm_send_uevents); - -/** - * dm_path_uevent - called to create a new path event and queue it - * - * @event_type: path event type enum - * @ti: pointer to a dm_target - * @path: string containing pathname - * @nr_valid_paths: number of valid paths remaining - * - */ -void dm_path_uevent(enum dm_uevent_type event_type, struct dm_target *ti, - const char *path, unsigned nr_valid_paths) -{ - struct mapped_device *md = dm_table_get_md(ti->table); - struct dm_uevent *event; - - if (event_type >= ARRAY_SIZE(_dm_uevent_type_names)) { - DMERR("%s: Invalid event_type %d", __FUNCTION__, event_type); - goto out; - } - - event = dm_build_path_uevent(md, ti, - _dm_uevent_type_names[event_type].action, - _dm_uevent_type_names[event_type].name, - path, nr_valid_paths); - if (IS_ERR(event)) - goto out; - - dm_uevent_add(md, &event->elist); - -out: - dm_put(md); -} -EXPORT_SYMBOL_GPL(dm_path_uevent); - -int dm_uevent_init(void) -{ - _dm_event_cache = KMEM_CACHE(dm_uevent, 0); - if (!_dm_event_cache) - return -ENOMEM; - - DMINFO("version 1.0.3"); - - return 0; -} - -void dm_uevent_exit(void) -{ - kmem_cache_destroy(_dm_event_cache); -} diff --git a/trunk/drivers/md/dm-uevent.h b/trunk/drivers/md/dm-uevent.h deleted file mode 100644 index 2eccc8bd671a..000000000000 --- a/trunk/drivers/md/dm-uevent.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Device Mapper Uevent Support - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * Copyright IBM Corporation, 2007 - * Author: Mike Anderson - */ -#ifndef DM_UEVENT_H -#define DM_UEVENT_H - -enum dm_uevent_type { - DM_UEVENT_PATH_FAILED, - DM_UEVENT_PATH_REINSTATED, -}; - -#ifdef CONFIG_DM_UEVENT - -extern int dm_uevent_init(void); -extern void dm_uevent_exit(void); -extern void dm_send_uevents(struct list_head *events, struct kobject *kobj); -extern void dm_path_uevent(enum dm_uevent_type event_type, - struct dm_target *ti, const char *path, - unsigned nr_valid_paths); - -#else - -static inline int dm_uevent_init(void) -{ - return 0; -} -static inline void dm_uevent_exit(void) -{ -} -static inline void dm_send_uevents(struct list_head *events, - struct kobject *kobj) -{ -} -static inline void dm_path_uevent(enum dm_uevent_type event_type, - struct dm_target *ti, const char *path, - unsigned nr_valid_paths) -{ -} - -#endif /* CONFIG_DM_UEVENT */ - -#endif /* DM_UEVENT_H */ diff --git a/trunk/drivers/md/dm.c b/trunk/drivers/md/dm.c index 07cbbb8eb3e0..d837d37f6209 100644 --- a/trunk/drivers/md/dm.c +++ b/trunk/drivers/md/dm.c @@ -7,7 +7,6 @@ #include "dm.h" #include "dm-bio-list.h" -#include "dm-uevent.h" #include #include @@ -113,9 +112,6 @@ struct mapped_device { */ atomic_t event_nr; wait_queue_head_t eventq; - atomic_t uevent_seq; - struct list_head uevent_list; - spinlock_t uevent_lock; /* Protect access to uevent_list */ /* * freeze/thaw support require holding onto a super block @@ -147,19 +143,11 @@ static int __init local_init(void) return -ENOMEM; } - r = dm_uevent_init(); - if (r) { - kmem_cache_destroy(_tio_cache); - kmem_cache_destroy(_io_cache); - return r; - } - _major = major; r = register_blkdev(_major, _name); if (r < 0) { kmem_cache_destroy(_tio_cache); kmem_cache_destroy(_io_cache); - dm_uevent_exit(); return r; } @@ -174,7 +162,6 @@ static void local_exit(void) kmem_cache_destroy(_tio_cache); kmem_cache_destroy(_io_cache); unregister_blkdev(_major, _name); - dm_uevent_exit(); _major = 0; @@ -764,13 +751,15 @@ static void __clone_and_map(struct clone_info *ci) /* * Split the bio into several clones. */ -static int __split_bio(struct mapped_device *md, struct bio *bio) +static void __split_bio(struct mapped_device *md, struct bio *bio) { struct clone_info ci; ci.map = dm_get_table(md); - if (unlikely(!ci.map)) - return -EIO; + if (!ci.map) { + bio_io_error(bio); + return; + } ci.md = md; ci.bio = bio; @@ -790,8 +779,6 @@ static int __split_bio(struct mapped_device *md, struct bio *bio) /* drop the extra reference count */ dec_pending(ci.io, 0); dm_table_put(ci.map); - - return 0; } /*----------------------------------------------------------------- * CRUD END @@ -803,7 +790,7 @@ static int __split_bio(struct mapped_device *md, struct bio *bio) */ static int dm_request(struct request_queue *q, struct bio *bio) { - int r = -EIO; + int r; int rw = bio_data_dir(bio); struct mapped_device *md = q->queuedata; @@ -828,11 +815,18 @@ static int dm_request(struct request_queue *q, struct bio *bio) while (test_bit(DMF_BLOCK_IO, &md->flags)) { up_read(&md->io_lock); - if (bio_rw(bio) != READA) - r = queue_io(md, bio); + if (bio_rw(bio) == READA) { + bio_io_error(bio); + return 0; + } + + r = queue_io(md, bio); + if (r < 0) { + bio_io_error(bio); + return 0; - if (r <= 0) - goto out_req; + } else if (r == 0) + return 0; /* deferred successfully */ /* * We're in a while loop, because someone could suspend @@ -841,13 +835,8 @@ static int dm_request(struct request_queue *q, struct bio *bio) down_read(&md->io_lock); } - r = __split_bio(md, bio); + __split_bio(md, bio); up_read(&md->io_lock); - -out_req: - if (r < 0) - bio_io_error(bio); - return 0; } @@ -988,9 +977,6 @@ static struct mapped_device *alloc_dev(int minor) atomic_set(&md->holders, 1); atomic_set(&md->open_count, 0); atomic_set(&md->event_nr, 0); - atomic_set(&md->uevent_seq, 0); - INIT_LIST_HEAD(&md->uevent_list); - spin_lock_init(&md->uevent_lock); md->queue = blk_alloc_queue(GFP_KERNEL); if (!md->queue) @@ -1058,14 +1044,12 @@ static struct mapped_device *alloc_dev(int minor) return NULL; } -static void unlock_fs(struct mapped_device *md); - static void free_dev(struct mapped_device *md) { int minor = md->disk->first_minor; if (md->suspended_bdev) { - unlock_fs(md); + thaw_bdev(md->suspended_bdev, NULL); bdput(md->suspended_bdev); } mempool_destroy(md->tio_pool); @@ -1089,16 +1073,8 @@ static void free_dev(struct mapped_device *md) */ static void event_callback(void *context) { - unsigned long flags; - LIST_HEAD(uevents); struct mapped_device *md = (struct mapped_device *) context; - spin_lock_irqsave(&md->uevent_lock, flags); - list_splice_init(&md->uevent_list, &uevents); - spin_unlock_irqrestore(&md->uevent_lock, flags); - - dm_send_uevents(&uevents, &md->disk->kobj); - atomic_inc(&md->event_nr); wake_up(&md->eventq); } @@ -1257,8 +1233,7 @@ static void __flush_deferred_io(struct mapped_device *md, struct bio *c) while (c) { n = c->bi_next; c->bi_next = NULL; - if (__split_bio(md, c)) - bio_io_error(c); + __split_bio(md, c); c = n; } } @@ -1516,11 +1491,6 @@ int dm_resume(struct mapped_device *md) /*----------------------------------------------------------------- * Event notification. *---------------------------------------------------------------*/ -uint32_t dm_next_uevent_seq(struct mapped_device *md) -{ - return atomic_add_return(1, &md->uevent_seq); -} - uint32_t dm_get_event_nr(struct mapped_device *md) { return atomic_read(&md->event_nr); @@ -1532,15 +1502,6 @@ int dm_wait_event(struct mapped_device *md, int event_nr) (event_nr != atomic_read(&md->event_nr))); } -void dm_uevent_add(struct mapped_device *md, struct list_head *elist) -{ - unsigned long flags; - - spin_lock_irqsave(&md->uevent_lock, flags); - list_add(elist, &md->uevent_list); - spin_unlock_irqrestore(&md->uevent_lock, flags); -} - /* * The gendisk is only valid as long as you have a reference * count on 'md'. diff --git a/trunk/drivers/md/kcopyd.c b/trunk/drivers/md/kcopyd.c index f3831f31223e..7e052378c47e 100644 --- a/trunk/drivers/md/kcopyd.c +++ b/trunk/drivers/md/kcopyd.c @@ -198,7 +198,7 @@ struct kcopyd_job { * These fields are only used if the job has been split * into more manageable parts. */ - struct mutex lock; + struct semaphore lock; atomic_t sub_jobs; sector_t progress; }; @@ -456,7 +456,7 @@ static void segment_complete(int read_err, sector_t count = 0; struct kcopyd_job *job = (struct kcopyd_job *) context; - mutex_lock(&job->lock); + down(&job->lock); /* update the error */ if (read_err) @@ -480,7 +480,7 @@ static void segment_complete(int read_err, job->progress += count; } } - mutex_unlock(&job->lock); + up(&job->lock); if (count) { int i; @@ -562,7 +562,7 @@ int kcopyd_copy(struct kcopyd_client *kc, struct io_region *from, dispatch_job(job); else { - mutex_init(&job->lock); + init_MUTEX(&job->lock); job->progress = 0; split_job(job); } diff --git a/trunk/drivers/net/Kconfig b/trunk/drivers/net/Kconfig index 2cafa5c1783e..83d52c8acab0 100644 --- a/trunk/drivers/net/Kconfig +++ b/trunk/drivers/net/Kconfig @@ -1293,6 +1293,9 @@ config PCNET32_NAPI deployed on potentially unfriendly networks (e.g. in a firewall), then say Y here. + See for more + information. + If in doubt, say N. config AMD8111_ETH @@ -1310,7 +1313,7 @@ config AMD8111_ETH will be called amd8111e. config AMD8111E_NAPI - bool "Use RX polling (NAPI)" + bool "Enable NAPI support" depends on AMD8111_ETH help NAPI is a new driver API designed to reduce CPU and interrupt load @@ -1321,6 +1324,9 @@ config AMD8111E_NAPI deployed on potentially unfriendly networks (e.g. in a firewall), then say Y here. + See for more + information. + If in doubt, say N. config ADAPTEC_STARFIRE @@ -1349,6 +1355,9 @@ config ADAPTEC_STARFIRE_NAPI deployed on potentially unfriendly networks (e.g. in a firewall), then say Y here. + See for more + information. + If in doubt, say N. config AC3200 @@ -1422,7 +1431,7 @@ config FORCEDETH called forcedeth. config FORCEDETH_NAPI - bool "Use Rx Polling (NAPI) (EXPERIMENTAL)" + bool "Use Rx and Tx Polling (NAPI) (EXPERIMENTAL)" depends on FORCEDETH && EXPERIMENTAL help NAPI is a new driver API designed to reduce CPU and interrupt load @@ -1433,6 +1442,9 @@ config FORCEDETH_NAPI deployed on potentially unfriendly networks (e.g. in a firewall), then say Y here. + See for more + information. + If in doubt, say N. config CS89x0 @@ -1744,6 +1756,9 @@ config VIA_RHINE_NAPI deployed on potentially unfriendly networks (e.g. in a firewall), then say Y here. + See for more + information. + config LAN_SAA9730 bool "Philips SAA9730 Ethernet support" depends on NET_PCI && PCI && MIPS_ATLAS @@ -1988,6 +2003,9 @@ config E1000_NAPI deployed on potentially unfriendly networks (e.g. in a firewall), then say Y here. + See for more + information. + If in doubt, say N. config E1000_DISABLE_PACKET_SPLIT @@ -2081,7 +2099,7 @@ config R8169 will be called r8169. This is recommended. config R8169_NAPI - bool "Use Rx Polling (NAPI) (EXPERIMENTAL)" + bool "Use Rx and Tx Polling (NAPI) (EXPERIMENTAL)" depends on R8169 && EXPERIMENTAL help NAPI is a new driver API designed to reduce CPU and interrupt load @@ -2092,6 +2110,9 @@ config R8169_NAPI deployed on potentially unfriendly networks (e.g. in a firewall), then say Y here. + See for more + information. + If in doubt, say N. config R8169_VLAN @@ -2343,7 +2364,7 @@ config GIANFAR and MPC86xx family of chips, and the FEC on the 8540. config GFAR_NAPI - bool "Use Rx Polling (NAPI)" + bool "NAPI Support" depends on GIANFAR config UCC_GETH @@ -2355,7 +2376,7 @@ config UCC_GETH which is available on some Freescale SOCs. config UGETH_NAPI - bool "Use Rx Polling (NAPI)" + bool "NAPI Support" depends on UCC_GETH config UGETH_MAGIC_PACKET @@ -2473,7 +2494,7 @@ config CHELSIO_T3 config EHEA tristate "eHEA Ethernet support" - depends on IBMEBUS && INET + depends on IBMEBUS select INET_LRO ---help--- This driver supports the IBM pSeries eHEA ethernet adapter. @@ -2538,6 +2559,9 @@ config IXGB_NAPI deployed on potentially unfriendly networks (e.g. in a firewall), then say Y here. + See for more + information. + If in doubt, say N. config S2IO @@ -2560,11 +2584,14 @@ config S2IO_NAPI deployed on potentially unfriendly networks (e.g. in a firewall), then say Y here. + See for more + information. + If in doubt, say N. config MYRI10GE tristate "Myricom Myri-10G Ethernet support" - depends on PCI && INET + depends on PCI select FW_LOADER select CRC32 select INET_LRO diff --git a/trunk/drivers/net/dm9000.c b/trunk/drivers/net/dm9000.c index 3286d2a0a870..27ac010900ab 100644 --- a/trunk/drivers/net/dm9000.c +++ b/trunk/drivers/net/dm9000.c @@ -542,8 +542,7 @@ dm9000_probe(struct platform_device *pdev) if (id_val != DM9000_ID) { printk("%s: wrong id: 0x%08x\n", CARDNAME, id_val); - ret = -ENODEV; - goto out; + goto release; } /* from this point we assume that we have found a DM9000 */ @@ -603,7 +602,8 @@ dm9000_probe(struct platform_device *pdev) } return 0; -out: + release: + out: printk("%s: not found (%d).\n", CARDNAME, ret); dm9000_release_board(pdev, db); diff --git a/trunk/drivers/net/phy/mdio-bitbang.c b/trunk/drivers/net/phy/mdio-bitbang.c index 2747b1f89ffe..8cd243d92af3 100644 --- a/trunk/drivers/net/phy/mdio-bitbang.c +++ b/trunk/drivers/net/phy/mdio-bitbang.c @@ -185,5 +185,3 @@ void free_mdio_bitbang(struct mii_bus *bus) module_put(ctrl->ops->owner); kfree(bus); } - -MODULE_LICENSE("GPL"); diff --git a/trunk/drivers/net/tsi108_eth.c b/trunk/drivers/net/tsi108_eth.c index 35d15e850075..df10af7df7b8 100644 --- a/trunk/drivers/net/tsi108_eth.c +++ b/trunk/drivers/net/tsi108_eth.c @@ -1629,7 +1629,7 @@ tsi108_init_one(struct platform_device *pdev) goto register_fail; } - printk(KERN_INFO "%s: Tsi108 Gigabit Ethernet, MAC: %s\n", + printk(KERN_INFO "%s: Tsi108 Gigabit Ethernet, MAC: %s\n" dev->name, print_mac(mac, dev->dev_addr)); #ifdef DEBUG data->msg_enable = DEBUG; diff --git a/trunk/drivers/net/tulip/Kconfig b/trunk/drivers/net/tulip/Kconfig index 49d7a290dbbc..1c537d5a3062 100644 --- a/trunk/drivers/net/tulip/Kconfig +++ b/trunk/drivers/net/tulip/Kconfig @@ -67,7 +67,7 @@ config TULIP_MMIO If in doubt, say N. config TULIP_NAPI - bool "Use RX polling (NAPI)" + bool "Use NAPI RX polling " depends on TULIP help NAPI is a new driver API designed to reduce CPU and interrupt load @@ -78,16 +78,18 @@ config TULIP_NAPI deployed on potentially unfriendly networks (e.g. in a firewall), then say Y here. + See for more + information. + If in doubt, say N. config TULIP_NAPI_HW_MITIGATION - bool "Use Interrupt Mitigation" + bool "Use Interrupt Mitigation " depends on TULIP_NAPI ---help--- - Use HW to reduce RX interrupts. Not strictly necessary since NAPI - reduces RX interrupts by itself. Interrupt mitigation reduces RX - interrupts even at low levels of traffic at the cost of a small - latency. + Use HW to reduce RX interrupts. Not strict necessary since NAPI reduces + RX interrupts but itself. Although this reduces RX interrupts even at + low levels traffic at the cost of a small latency. If in doubt, say Y. diff --git a/trunk/drivers/net/wireless/b43/main.c b/trunk/drivers/net/wireless/b43/main.c index 9d9ff76a9bc6..c141a264ac45 100644 --- a/trunk/drivers/net/wireless/b43/main.c +++ b/trunk/drivers/net/wireless/b43/main.c @@ -49,6 +49,7 @@ #include "pio.h" #include "sysfs.h" #include "xmit.h" +#include "sysfs.h" #include "lo.h" #include "pcmcia.h" @@ -3494,7 +3495,7 @@ static int b43_start(struct ieee80211_hw *hw) struct b43_wl *wl = hw_to_b43_wl(hw); struct b43_wldev *dev = wl->current_dev; int did_init = 0; - int err = 0; + int err; mutex_lock(&wl->mutex); @@ -3520,7 +3521,7 @@ static int b43_start(struct ieee80211_hw *hw) return err; } -static void b43_stop(struct ieee80211_hw *hw) +void b43_stop(struct ieee80211_hw *hw) { struct b43_wl *wl = hw_to_b43_wl(hw); struct b43_wldev *dev = wl->current_dev; diff --git a/trunk/drivers/net/wireless/b43legacy/main.c b/trunk/drivers/net/wireless/b43legacy/main.c index d09479e816cd..f0749510bcd7 100644 --- a/trunk/drivers/net/wireless/b43legacy/main.c +++ b/trunk/drivers/net/wireless/b43legacy/main.c @@ -3306,7 +3306,7 @@ static int b43legacy_start(struct ieee80211_hw *hw) struct b43legacy_wl *wl = hw_to_b43legacy_wl(hw); struct b43legacy_wldev *dev = wl->current_dev; int did_init = 0; - int err = 0; + int err; mutex_lock(&wl->mutex); diff --git a/trunk/drivers/net/wireless/ipw2100.c b/trunk/drivers/net/wireless/ipw2100.c index 7a7797560a23..c144e3cdb890 100644 --- a/trunk/drivers/net/wireless/ipw2100.c +++ b/trunk/drivers/net/wireless/ipw2100.c @@ -2089,46 +2089,12 @@ static void isr_indicate_rf_kill(struct ipw2100_priv *priv, u32 status) queue_delayed_work(priv->workqueue, &priv->rf_kill, round_jiffies(HZ)); } -static void send_scan_event(void *data) -{ - struct ipw2100_priv *priv = data; - union iwreq_data wrqu; - - wrqu.data.length = 0; - wrqu.data.flags = 0; - wireless_send_event(priv->net_dev, SIOCGIWSCAN, &wrqu, NULL); -} - -static void ipw2100_scan_event_later(struct work_struct *work) -{ - send_scan_event(container_of(work, struct ipw2100_priv, - scan_event_later.work)); -} - -static void ipw2100_scan_event_now(struct work_struct *work) -{ - send_scan_event(container_of(work, struct ipw2100_priv, - scan_event_now)); -} - static void isr_scan_complete(struct ipw2100_priv *priv, u32 status) { IPW_DEBUG_SCAN("scan complete\n"); /* Age the scan results... */ priv->ieee->scans++; priv->status &= ~STATUS_SCANNING; - - /* Only userspace-requested scan completion events go out immediately */ - if (!priv->user_requested_scan) { - if (!delayed_work_pending(&priv->scan_event_later)) - queue_delayed_work(priv->workqueue, - &priv->scan_event_later, - round_jiffies(msecs_to_jiffies(4000))); - } else { - priv->user_requested_scan = 0; - cancel_delayed_work(&priv->scan_event_later); - queue_work(priv->workqueue, &priv->scan_event_now); - } } #ifdef CONFIG_IPW2100_DEBUG @@ -4383,7 +4349,6 @@ static void ipw2100_kill_workqueue(struct ipw2100_priv *priv) cancel_delayed_work(&priv->wx_event_work); cancel_delayed_work(&priv->hang_check); cancel_delayed_work(&priv->rf_kill); - cancel_delayed_work(&priv->scan_event_later); destroy_workqueue(priv->workqueue); priv->workqueue = NULL; } @@ -6127,8 +6092,6 @@ static struct net_device *ipw2100_alloc_device(struct pci_dev *pci_dev, INIT_DELAYED_WORK(&priv->wx_event_work, ipw2100_wx_event_work); INIT_DELAYED_WORK(&priv->hang_check, ipw2100_hang_check); INIT_DELAYED_WORK(&priv->rf_kill, ipw2100_rf_kill); - INIT_WORK(&priv->scan_event_now, ipw2100_scan_event_now); - INIT_DELAYED_WORK(&priv->scan_event_later, ipw2100_scan_event_later); tasklet_init(&priv->irq_tasklet, (void (*)(unsigned long)) ipw2100_irq_tasklet, (unsigned long)priv); @@ -7433,8 +7396,6 @@ static int ipw2100_wx_set_scan(struct net_device *dev, } IPW_DEBUG_WX("Initiating scan...\n"); - - priv->user_requested_scan = 1; if (ipw2100_set_scan_options(priv) || ipw2100_start_scan(priv)) { IPW_DEBUG_WX("Start scan failed.\n"); diff --git a/trunk/drivers/net/wireless/ipw2100.h b/trunk/drivers/net/wireless/ipw2100.h index bbf1ddcafba8..2b8be2418fa7 100644 --- a/trunk/drivers/net/wireless/ipw2100.h +++ b/trunk/drivers/net/wireless/ipw2100.h @@ -586,10 +586,6 @@ struct ipw2100_priv { struct delayed_work wx_event_work; struct delayed_work hang_check; struct delayed_work rf_kill; - struct work_struct scan_event_now; - struct delayed_work scan_event_later; - - int user_requested_scan; u32 interrupts; int tx_interrupts; diff --git a/trunk/drivers/net/wireless/iwlwifi/iwl-3945-rs.c b/trunk/drivers/net/wireless/iwlwifi/iwl-3945-rs.c index 262ab0b55824..f4aabcf480e4 100644 --- a/trunk/drivers/net/wireless/iwlwifi/iwl-3945-rs.c +++ b/trunk/drivers/net/wireless/iwlwifi/iwl-3945-rs.c @@ -37,6 +37,9 @@ #include +#include +#include + #define IWL 3945 #include "../net/mac80211/ieee80211_rate.h" diff --git a/trunk/drivers/net/wireless/iwlwifi/iwl-3945.c b/trunk/drivers/net/wireless/iwlwifi/iwl-3945.c index 19bcb01e2784..acb38750535f 100644 --- a/trunk/drivers/net/wireless/iwlwifi/iwl-3945.c +++ b/trunk/drivers/net/wireless/iwlwifi/iwl-3945.c @@ -38,6 +38,7 @@ #include #include +#include #define IWL 3945 diff --git a/trunk/drivers/net/wireless/iwlwifi/iwl-4965-rs.c b/trunk/drivers/net/wireless/iwlwifi/iwl-4965-rs.c index 8dc78c0bf1ff..287c75705c44 100644 --- a/trunk/drivers/net/wireless/iwlwifi/iwl-4965-rs.c +++ b/trunk/drivers/net/wireless/iwlwifi/iwl-4965-rs.c @@ -36,6 +36,9 @@ #include +#include +#include + #define IWL 4965 #include "../net/mac80211/ieee80211_rate.h" @@ -2021,18 +2024,12 @@ static int open_file_generic(struct inode *inode, struct file *file) static void rs_dbgfs_set_mcs(struct iwl_rate_scale_priv *rs_priv, struct iwl_rate *mcs, int index) { - u32 base_rate; - - if (rs_priv->phymode == (u8) MODE_IEEE80211A) - base_rate = 0x800D; - else - base_rate = 0x820A; - + const u32 cck_rate = 0x820A; if (rs_priv->dbg_fixed.rate_n_flags) { if (index < 12) mcs->rate_n_flags = rs_priv->dbg_fixed.rate_n_flags; else - mcs->rate_n_flags = base_rate; + mcs->rate_n_flags = cck_rate; IWL_DEBUG_RATE("Fixed rate ON\n"); return; } diff --git a/trunk/drivers/net/wireless/iwlwifi/iwl-4965.c b/trunk/drivers/net/wireless/iwlwifi/iwl-4965.c index 557deebca1b9..b50d20267c8a 100644 --- a/trunk/drivers/net/wireless/iwlwifi/iwl-4965.c +++ b/trunk/drivers/net/wireless/iwlwifi/iwl-4965.c @@ -35,7 +35,9 @@ #include #include #include +#include #include +#include #define IWL 4965 diff --git a/trunk/drivers/net/wireless/iwlwifi/iwl3945-base.c b/trunk/drivers/net/wireless/iwlwifi/iwl3945-base.c index 83019d1d7ccc..75e3b5c3f155 100644 --- a/trunk/drivers/net/wireless/iwlwifi/iwl3945-base.c +++ b/trunk/drivers/net/wireless/iwlwifi/iwl3945-base.c @@ -48,6 +48,8 @@ #include #include #include +#include +#include #include #include @@ -1747,22 +1749,21 @@ static void iwl_unset_hw_setting(struct iwl_priv *priv) * return : set the bit for each supported rate insert in ie */ static u16 iwl_supported_rate_to_ie(u8 *ie, u16 supported_rate, - u16 basic_rate, int *left) + u16 basic_rate, int max_count) { u16 ret_rates = 0, bit; int i; - u8 *cnt = ie; - u8 *rates = ie + 1; + u8 *rates; + + rates = &(ie[1]); for (bit = 1, i = 0; i < IWL_RATE_COUNT; i++, bit <<= 1) { if (bit & supported_rate) { ret_rates |= bit; - rates[*cnt] = iwl_rates[i].ieee | - ((bit & basic_rate) ? 0x80 : 0x00); - (*cnt)++; - (*left)--; - if ((*left <= 0) || - (*cnt >= IWL_SUPPORTED_RATES_IE_LEN)) + rates[*ie] = iwl_rates[i].ieee | + ((bit & basic_rate) ? 0x80 : 0x00); + *ie = *ie + 1; + if (*ie >= max_count) break; } } @@ -1779,7 +1780,7 @@ static u16 iwl_fill_probe_req(struct iwl_priv *priv, { int len = 0; u8 *pos = NULL; - u16 active_rates, ret_rates, cck_rates; + u16 ret_rates; /* Make sure there is enough space for the probe request, * two mandatory IEs and the data */ @@ -1824,27 +1825,19 @@ static u16 iwl_fill_probe_req(struct iwl_priv *priv, left -= 2; if (left < 0) return 0; - /* ... fill it in... */ *pos++ = WLAN_EID_SUPP_RATES; *pos = 0; - - priv->active_rate = priv->rates_mask; - active_rates = priv->active_rate; + ret_rates = priv->active_rate = priv->rates_mask; priv->active_rate_basic = priv->rates_mask & IWL_BASIC_RATES_MASK; - cck_rates = IWL_CCK_RATES_MASK & active_rates; - ret_rates = iwl_supported_rate_to_ie(pos, cck_rates, - priv->active_rate_basic, &left); - active_rates &= ~ret_rates; - - ret_rates = iwl_supported_rate_to_ie(pos, active_rates, - priv->active_rate_basic, &left); - active_rates &= ~ret_rates; - + iwl_supported_rate_to_ie(pos, priv->active_rate, + priv->active_rate_basic, left); len += 2 + *pos; pos += (*pos) + 1; - if (active_rates == 0) + ret_rates = ~ret_rates & priv->active_rate; + + if (ret_rates == 0) goto fill_end; /* fill in supported extended rate */ @@ -1855,8 +1848,7 @@ static u16 iwl_fill_probe_req(struct iwl_priv *priv, /* ... fill it in... */ *pos++ = WLAN_EID_EXT_SUPP_RATES; *pos = 0; - iwl_supported_rate_to_ie(pos, active_rates, - priv->active_rate_basic, &left); + iwl_supported_rate_to_ie(pos, ret_rates, priv->active_rate_basic, left); if (*pos > 0) len += 2 + *pos; diff --git a/trunk/drivers/net/wireless/iwlwifi/iwl4965-base.c b/trunk/drivers/net/wireless/iwlwifi/iwl4965-base.c index 5e1279263b22..b1a6e39f7821 100644 --- a/trunk/drivers/net/wireless/iwlwifi/iwl4965-base.c +++ b/trunk/drivers/net/wireless/iwlwifi/iwl4965-base.c @@ -48,6 +48,8 @@ #include #include #include +#include +#include #include #include @@ -1800,22 +1802,21 @@ static void iwl_unset_hw_setting(struct iwl_priv *priv) * return : set the bit for each supported rate insert in ie */ static u16 iwl_supported_rate_to_ie(u8 *ie, u16 supported_rate, - u16 basic_rate, int *left) + u16 basic_rate, int max_count) { u16 ret_rates = 0, bit; int i; - u8 *cnt = ie; - u8 *rates = ie + 1; + u8 *rates; + + rates = &(ie[1]); for (bit = 1, i = 0; i < IWL_RATE_COUNT; i++, bit <<= 1) { if (bit & supported_rate) { ret_rates |= bit; - rates[*cnt] = iwl_rates[i].ieee | - ((bit & basic_rate) ? 0x80 : 0x00); - (*cnt)++; - (*left)--; - if ((*left <= 0) || - (*cnt >= IWL_SUPPORTED_RATES_IE_LEN)) + rates[*ie] = iwl_rates[i].ieee | + ((bit & basic_rate) ? 0x80 : 0x00); + *ie = *ie + 1; + if (*ie >= max_count) break; } } @@ -1838,7 +1839,7 @@ static u16 iwl_fill_probe_req(struct iwl_priv *priv, { int len = 0; u8 *pos = NULL; - u16 active_rates, ret_rates, cck_rates; + u16 ret_rates; /* Make sure there is enough space for the probe request, * two mandatory IEs and the data */ @@ -1883,27 +1884,19 @@ static u16 iwl_fill_probe_req(struct iwl_priv *priv, left -= 2; if (left < 0) return 0; - /* ... fill it in... */ *pos++ = WLAN_EID_SUPP_RATES; *pos = 0; - - priv->active_rate = priv->rates_mask; - active_rates = priv->active_rate; + ret_rates = priv->active_rate = priv->rates_mask; priv->active_rate_basic = priv->rates_mask & IWL_BASIC_RATES_MASK; - cck_rates = IWL_CCK_RATES_MASK & active_rates; - ret_rates = iwl_supported_rate_to_ie(pos, cck_rates, - priv->active_rate_basic, &left); - active_rates &= ~ret_rates; - - ret_rates = iwl_supported_rate_to_ie(pos, active_rates, - priv->active_rate_basic, &left); - active_rates &= ~ret_rates; - + iwl_supported_rate_to_ie(pos, priv->active_rate, + priv->active_rate_basic, left); len += 2 + *pos; pos += (*pos) + 1; - if (active_rates == 0) + ret_rates = ~ret_rates & priv->active_rate; + + if (ret_rates == 0) goto fill_end; /* fill in supported extended rate */ @@ -1914,8 +1907,7 @@ static u16 iwl_fill_probe_req(struct iwl_priv *priv, /* ... fill it in... */ *pos++ = WLAN_EID_EXT_SUPP_RATES; *pos = 0; - iwl_supported_rate_to_ie(pos, active_rates, - priv->active_rate_basic, &left); + iwl_supported_rate_to_ie(pos, ret_rates, priv->active_rate_basic, left); if (*pos > 0) len += 2 + *pos; @@ -4502,13 +4494,13 @@ static u8 ratio2dB[100] = { * Conversion assumes that levels are voltages (20*log), not powers (10*log). */ int iwl_calc_db_from_ratio(int sig_ratio) { - /* 1000:1 or higher just report as 60 dB */ - if (sig_ratio >= 1000) + /* Anything above 1000:1 just report as 60 dB */ + if (sig_ratio > 1000) return 60; - /* 100:1 or higher, divide by 10 and use table, + /* Above 100:1, divide by 10 and use table, * add 20 dB to make up for divide by 10 */ - if (sig_ratio >= 100) + if (sig_ratio > 100) return (20 + (int)ratio2dB[sig_ratio/10]); /* We shouldn't see this */ diff --git a/trunk/drivers/net/wireless/iwlwifi/iwlwifi.h b/trunk/drivers/net/wireless/iwlwifi/iwlwifi.h index 432ce887807f..e0b97c341215 100644 --- a/trunk/drivers/net/wireless/iwlwifi/iwlwifi.h +++ b/trunk/drivers/net/wireless/iwlwifi/iwlwifi.h @@ -39,13 +39,18 @@ struct iwl_priv; /* Hardware specific file defines the PCI IDs table for that hardware module */ extern struct pci_device_id iwl_hw_card_ids[]; -#include "iwl-hw.h" #if IWL == 3945 + #define DRV_NAME "iwl3945" +#include "iwl-hw.h" #include "iwl-3945-hw.h" + #elif IWL == 4965 + #define DRV_NAME "iwl4965" +#include "iwl-hw.h" #include "iwl-4965-hw.h" + #endif #include "iwl-prph.h" diff --git a/trunk/drivers/net/wireless/p54common.c b/trunk/drivers/net/wireless/p54common.c index 1437db0cf4b2..2c63cf0ad2cd 100644 --- a/trunk/drivers/net/wireless/p54common.c +++ b/trunk/drivers/net/wireless/p54common.c @@ -577,7 +577,7 @@ static int p54_set_filter(struct ieee80211_hw *dev, u16 filter_type, struct p54_tx_control_filter *filter; hdr = kzalloc(sizeof(*hdr) + sizeof(*filter) + - priv->tx_hdr_len, GFP_ATOMIC); + priv->tx_hdr_len, GFP_KERNEL); if (!hdr) return -ENOMEM; diff --git a/trunk/drivers/net/wireless/rt2x00/rt2x00dev.c b/trunk/drivers/net/wireless/rt2x00/rt2x00dev.c index ff399f8083e9..bb6f46cfbb9f 100644 --- a/trunk/drivers/net/wireless/rt2x00/rt2x00dev.c +++ b/trunk/drivers/net/wireless/rt2x00/rt2x00dev.c @@ -550,7 +550,7 @@ void rt2x00lib_write_tx_desc(struct rt2x00_dev *rt2x00dev, /* * Check if we need to set the Length Extension */ - if (bitrate == 110 && residual <= 30) + if (bitrate == 110 && residual <= 3) desc.service |= 0x80; } diff --git a/trunk/drivers/net/wireless/rt2x00/rt73usb.c b/trunk/drivers/net/wireless/rt2x00/rt73usb.c index 46c8c0840a65..3e42759473c3 100644 --- a/trunk/drivers/net/wireless/rt2x00/rt73usb.c +++ b/trunk/drivers/net/wireless/rt2x00/rt73usb.c @@ -2029,7 +2029,6 @@ static struct usb_device_id rt73usb_device_table[] = { { USB_DEVICE(0x050d, 0x7050), USB_DEVICE_DATA(&rt73usb_ops) }, { USB_DEVICE(0x050d, 0x705a), USB_DEVICE_DATA(&rt73usb_ops) }, { USB_DEVICE(0x050d, 0x905b), USB_DEVICE_DATA(&rt73usb_ops) }, - { USB_DEVICE(0x050d, 0x905c), USB_DEVICE_DATA(&rt73usb_ops) }, /* Billionton */ { USB_DEVICE(0x1631, 0xc019), USB_DEVICE_DATA(&rt73usb_ops) }, /* Buffalo */ diff --git a/trunk/drivers/net/wireless/rtl8187_dev.c b/trunk/drivers/net/wireless/rtl8187_dev.c index de61c8fe6492..0ef887dd2867 100644 --- a/trunk/drivers/net/wireless/rtl8187_dev.c +++ b/trunk/drivers/net/wireless/rtl8187_dev.c @@ -131,8 +131,7 @@ static int rtl8187_tx(struct ieee80211_hw *dev, struct sk_buff *skb, struct rtl8187_tx_hdr *hdr; struct rtl8187_tx_info *info; struct urb *urb; - __le16 rts_dur = 0; - u32 flags; + u32 tmp; urb = usb_alloc_urb(0, GFP_ATOMIC); if (!urb) { @@ -140,24 +139,24 @@ static int rtl8187_tx(struct ieee80211_hw *dev, struct sk_buff *skb, return 0; } - flags = skb->len; - flags |= RTL8187_TX_FLAG_NO_ENCRYPT; - flags |= control->rts_cts_rate << 19; - flags |= control->tx_rate << 24; - if (ieee80211_get_morefrag((struct ieee80211_hdr *)skb->data)) - flags |= RTL8187_TX_FLAG_MORE_FRAG; + hdr = (struct rtl8187_tx_hdr *)skb_push(skb, sizeof(*hdr)); + tmp = skb->len - sizeof(*hdr); + tmp |= RTL8187_TX_FLAG_NO_ENCRYPT; + tmp |= control->rts_cts_rate << 19; + tmp |= control->tx_rate << 24; + if (ieee80211_get_morefrag((struct ieee80211_hdr *)skb)) + tmp |= RTL8187_TX_FLAG_MORE_FRAG; if (control->flags & IEEE80211_TXCTL_USE_RTS_CTS) { - flags |= RTL8187_TX_FLAG_RTS; - rts_dur = ieee80211_rts_duration(dev, priv->if_id, skb->len, control); + tmp |= RTL8187_TX_FLAG_RTS; + hdr->rts_duration = + ieee80211_rts_duration(dev, priv->if_id, skb->len, control); } if (control->flags & IEEE80211_TXCTL_USE_CTS_PROTECT) - flags |= RTL8187_TX_FLAG_CTS; - - hdr = (struct rtl8187_tx_hdr *)skb_push(skb, sizeof(*hdr)); - hdr->flags = cpu_to_le32(flags); + tmp |= RTL8187_TX_FLAG_CTS; + hdr->flags = cpu_to_le32(tmp); hdr->len = 0; - hdr->rts_duration = rts_dur; - hdr->retry = cpu_to_le32(control->retry_limit << 8); + tmp = control->retry_limit << 8; + hdr->retry = cpu_to_le32(tmp); info = (struct rtl8187_tx_info *)skb->cb; info->control = kmemdup(control, sizeof(*control), GFP_ATOMIC); @@ -588,6 +587,8 @@ static void rtl8187_configure_filter(struct ieee80211_hw *dev, *total_flags = 0; + if (changed_flags & FIF_PROMISC_IN_BSS) + priv->rx_conf ^= RTL818X_RX_CONF_NICMAC; if (changed_flags & FIF_ALLMULTI) priv->rx_conf ^= RTL818X_RX_CONF_MULTICAST; if (changed_flags & FIF_FCSFAIL) @@ -600,6 +601,8 @@ static void rtl8187_configure_filter(struct ieee80211_hw *dev, if (mc_count > 0) priv->rx_conf |= RTL818X_RX_CONF_MULTICAST; + if (priv->rx_conf & RTL818X_RX_CONF_NICMAC) + *total_flags |= FIF_PROMISC_IN_BSS; if (priv->rx_conf & RTL818X_RX_CONF_MULTICAST) *total_flags |= FIF_ALLMULTI; if (priv->rx_conf & RTL818X_RX_CONF_FCS) diff --git a/trunk/drivers/net/wireless/zd1201.c b/trunk/drivers/net/wireless/zd1201.c index d5c0c66188ca..935b144d9b56 100644 --- a/trunk/drivers/net/wireless/zd1201.c +++ b/trunk/drivers/net/wireless/zd1201.c @@ -327,8 +327,8 @@ static void zd1201_usbrx(struct urb *urb) memcpy(skb_put(skb, 6), &data[datalen-8], 6); memcpy(skb_put(skb, 2), &data[datalen-24], 2); memcpy(skb_put(skb, len), data, len); - skb->protocol = eth_type_trans(skb, zd->dev); skb->dev->last_rx = jiffies; + skb->protocol = eth_type_trans(skb, zd->dev); zd->stats.rx_packets++; zd->stats.rx_bytes += skb->len; netif_rx(skb); @@ -384,8 +384,8 @@ static void zd1201_usbrx(struct urb *urb) memcpy(skb_put(skb, 2), &data[6], 2); memcpy(skb_put(skb, len), data+8, len); } - skb->protocol = eth_type_trans(skb, zd->dev); skb->dev->last_rx = jiffies; + skb->protocol = eth_type_trans(skb, zd->dev); zd->stats.rx_packets++; zd->stats.rx_bytes += skb->len; netif_rx(skb); diff --git a/trunk/drivers/net/wireless/zd1211rw/zd_usb.c b/trunk/drivers/net/wireless/zd1211rw/zd_usb.c index c755b6923812..b0684f965761 100644 --- a/trunk/drivers/net/wireless/zd1211rw/zd_usb.c +++ b/trunk/drivers/net/wireless/zd1211rw/zd_usb.c @@ -1044,17 +1044,14 @@ static int probe(struct usb_interface *intf, const struct usb_device_id *id) static void disconnect(struct usb_interface *intf) { struct net_device *netdev = zd_intf_to_netdev(intf); - struct zd_mac *mac; - struct zd_usb *usb; + struct zd_mac *mac = zd_netdev_mac(netdev); + struct zd_usb *usb = &mac->chip.usb; /* Either something really bad happened, or we're just dealing with * a DEVICE_INSTALLER. */ if (netdev == NULL) return; - mac = zd_netdev_mac(netdev); - usb = &mac->chip.usb; - dev_dbg_f(zd_usb_dev(usb), "\n"); zd_netdev_disconnect(netdev); diff --git a/trunk/drivers/s390/net/qeth_main.c b/trunk/drivers/s390/net/qeth_main.c index ff999ff0b627..a2d08c9ba3c4 100644 --- a/trunk/drivers/s390/net/qeth_main.c +++ b/trunk/drivers/s390/net/qeth_main.c @@ -6643,8 +6643,7 @@ qeth_netdev_init(struct net_device *dev) dev->vlan_rx_kill_vid = qeth_vlan_rx_kill_vid; dev->vlan_rx_add_vid = qeth_vlan_rx_add_vid; #endif - if (qeth_get_netdev_flags(card) & IFF_NOARP) - dev->header_ops = &qeth_null_ops; + dev->header_ops = &qeth_null_ops; #ifdef CONFIG_QETH_IPV6 /*IPv6 address autoconfiguration stuff*/ diff --git a/trunk/drivers/video/geode/video_gx.c b/trunk/drivers/video/geode/video_gx.c index febf09c63492..7f3f18d06718 100644 --- a/trunk/drivers/video/geode/video_gx.c +++ b/trunk/drivers/video/geode/video_gx.c @@ -127,7 +127,7 @@ static void gx_set_dclk_frequency(struct fb_info *info) int timeout = 1000; /* Rev. 1 Geode GXs use a 14 MHz reference clock instead of 48 MHz. */ - if (cpu_data(0).x86_mask == 1) { + if (cpu_data->x86_mask == 1) { pll_table = gx_pll_table_14MHz; pll_table_len = ARRAY_SIZE(gx_pll_table_14MHz); } else { diff --git a/trunk/fs/nfs/delegation.c b/trunk/fs/nfs/delegation.c index 11833f4caeaa..af8b235d405d 100644 --- a/trunk/fs/nfs/delegation.c +++ b/trunk/fs/nfs/delegation.c @@ -168,8 +168,7 @@ int nfs_inode_set_delegation(struct inode *inode, struct rpc_cred *cred, struct spin_unlock(&inode->i_lock); spin_unlock(&clp->cl_lock); - if (delegation != NULL) - nfs_free_delegation(delegation); + kfree(delegation); return status; } diff --git a/trunk/fs/nfs/dir.c b/trunk/fs/nfs/dir.c index 35334539d947..8ec7fbd8240c 100644 --- a/trunk/fs/nfs/dir.c +++ b/trunk/fs/nfs/dir.c @@ -562,7 +562,6 @@ static int nfs_readdir(struct file *filp, void *dirent, filldir_t filldir) nfs_fattr_init(&fattr); desc->entry = &my_entry; - nfs_block_sillyrename(dentry); while(!desc->entry->eof) { res = readdir_search_pagecache(desc); @@ -593,7 +592,6 @@ static int nfs_readdir(struct file *filp, void *dirent, filldir_t filldir) break; } } - nfs_unblock_sillyrename(dentry); unlock_kernel(); if (res > 0) res = 0; @@ -868,7 +866,6 @@ struct dentry_operations nfs_dentry_operations = { static struct dentry *nfs_lookup(struct inode *dir, struct dentry * dentry, struct nameidata *nd) { struct dentry *res; - struct dentry *parent; struct inode *inode = NULL; int error; struct nfs_fh fhandle; @@ -897,31 +894,26 @@ static struct dentry *nfs_lookup(struct inode *dir, struct dentry * dentry, stru goto out_unlock; } - parent = dentry->d_parent; - /* Protect against concurrent sillydeletes */ - nfs_block_sillyrename(parent); error = NFS_PROTO(dir)->lookup(dir, &dentry->d_name, &fhandle, &fattr); if (error == -ENOENT) goto no_entry; if (error < 0) { res = ERR_PTR(error); - goto out_unblock_sillyrename; + goto out_unlock; } inode = nfs_fhget(dentry->d_sb, &fhandle, &fattr); res = (struct dentry *)inode; if (IS_ERR(res)) - goto out_unblock_sillyrename; + goto out_unlock; no_entry: res = d_materialise_unique(dentry, inode); if (res != NULL) { if (IS_ERR(res)) - goto out_unblock_sillyrename; + goto out_unlock; dentry = res; } nfs_set_verifier(dentry, nfs_save_change_attribute(dir)); -out_unblock_sillyrename: - nfs_unblock_sillyrename(parent); out_unlock: unlock_kernel(); out: diff --git a/trunk/fs/nfs/file.c b/trunk/fs/nfs/file.c index b3bb89f7d5d2..d29f90d00aa2 100644 --- a/trunk/fs/nfs/file.c +++ b/trunk/fs/nfs/file.c @@ -131,7 +131,7 @@ nfs_file_release(struct inode *inode, struct file *filp) { /* Ensure that dirty pages are flushed out with the right creds */ if (filp->f_mode & FMODE_WRITE) - nfs_wb_all(filp->f_path.dentry->d_inode); + filemap_fdatawrite(filp->f_mapping); nfs_inc_stats(inode, NFSIOS_VFSRELEASE); return NFS_PROTO(inode)->file_release(inode, filp); } diff --git a/trunk/fs/nfs/inode.c b/trunk/fs/nfs/inode.c index db5d96dc6107..6d2f2a3eccf8 100644 --- a/trunk/fs/nfs/inode.c +++ b/trunk/fs/nfs/inode.c @@ -514,7 +514,7 @@ struct nfs_open_context *get_nfs_open_context(struct nfs_open_context *ctx) return ctx; } -static void __put_nfs_open_context(struct nfs_open_context *ctx, int wait) +void put_nfs_open_context(struct nfs_open_context *ctx) { struct inode *inode = ctx->path.dentry->d_inode; @@ -522,12 +522,8 @@ static void __put_nfs_open_context(struct nfs_open_context *ctx, int wait) return; list_del(&ctx->list); spin_unlock(&inode->i_lock); - if (ctx->state != NULL) { - if (wait) - nfs4_close_sync(&ctx->path, ctx->state, ctx->mode); - else - nfs4_close_state(&ctx->path, ctx->state, ctx->mode); - } + if (ctx->state != NULL) + nfs4_close_state(&ctx->path, ctx->state, ctx->mode); if (ctx->cred != NULL) put_rpccred(ctx->cred); dput(ctx->path.dentry); @@ -535,16 +531,6 @@ static void __put_nfs_open_context(struct nfs_open_context *ctx, int wait) kfree(ctx); } -void put_nfs_open_context(struct nfs_open_context *ctx) -{ - __put_nfs_open_context(ctx, 0); -} - -static void put_nfs_open_context_sync(struct nfs_open_context *ctx) -{ - __put_nfs_open_context(ctx, 1); -} - /* * Ensure that mmap has a recent RPC credential for use when writing out * shared pages @@ -591,7 +577,7 @@ static void nfs_file_clear_open_context(struct file *filp) spin_lock(&inode->i_lock); list_move_tail(&ctx->list, &NFS_I(inode)->open_files); spin_unlock(&inode->i_lock); - put_nfs_open_context_sync(ctx); + put_nfs_open_context(ctx); } } @@ -1183,9 +1169,6 @@ static void init_once(struct kmem_cache * cachep, void *foo) INIT_RADIX_TREE(&nfsi->nfs_page_tree, GFP_ATOMIC); nfsi->ncommit = 0; nfsi->npages = 0; - atomic_set(&nfsi->silly_count, 1); - INIT_HLIST_HEAD(&nfsi->silly_list); - init_waitqueue_head(&nfsi->waitqueue); nfs4_init_once(nfsi); } diff --git a/trunk/fs/nfs/nfs4_fs.h b/trunk/fs/nfs/nfs4_fs.h index b35069a2aa9e..d2802b1ca3b9 100644 --- a/trunk/fs/nfs/nfs4_fs.h +++ b/trunk/fs/nfs/nfs4_fs.h @@ -178,7 +178,7 @@ extern int nfs4_proc_setclientid(struct nfs_client *, u32, unsigned short, struc extern int nfs4_proc_setclientid_confirm(struct nfs_client *, struct rpc_cred *); extern int nfs4_proc_async_renew(struct nfs_client *, struct rpc_cred *); extern int nfs4_proc_renew(struct nfs_client *, struct rpc_cred *); -extern int nfs4_do_close(struct path *path, struct nfs4_state *state, int wait); +extern int nfs4_do_close(struct path *path, struct nfs4_state *state); extern struct dentry *nfs4_atomic_open(struct inode *, struct dentry *, struct nameidata *); extern int nfs4_open_revalidate(struct inode *, struct dentry *, int, struct nameidata *); extern int nfs4_server_capabilities(struct nfs_server *server, struct nfs_fh *fhandle); @@ -209,7 +209,6 @@ extern void nfs4_drop_state_owner(struct nfs4_state_owner *); extern struct nfs4_state * nfs4_get_open_state(struct inode *, struct nfs4_state_owner *); extern void nfs4_put_open_state(struct nfs4_state *); extern void nfs4_close_state(struct path *, struct nfs4_state *, mode_t); -extern void nfs4_close_sync(struct path *, struct nfs4_state *, mode_t); extern void nfs4_state_set_mode_locked(struct nfs4_state *, mode_t); extern void nfs4_schedule_state_recovery(struct nfs_client *); extern void nfs4_put_lock_state(struct nfs4_lock_state *lsp); @@ -236,7 +235,6 @@ extern struct svc_version nfs4_callback_version1; #else #define nfs4_close_state(a, b, c) do { } while (0) -#define nfs4_close_sync(a, b, c) do { } while (0) #endif /* CONFIG_NFS_V4 */ #endif /* __LINUX_FS_NFS_NFS4_FS.H */ diff --git a/trunk/fs/nfs/nfs4proc.c b/trunk/fs/nfs/nfs4proc.c index f03d9d5f5ba4..cb99fd90a9ac 100644 --- a/trunk/fs/nfs/nfs4proc.c +++ b/trunk/fs/nfs/nfs4proc.c @@ -1305,7 +1305,7 @@ static const struct rpc_call_ops nfs4_close_ops = { * * NOTE: Caller must be holding the sp->so_owner semaphore! */ -int nfs4_do_close(struct path *path, struct nfs4_state *state, int wait) +int nfs4_do_close(struct path *path, struct nfs4_state *state) { struct nfs_server *server = NFS_SERVER(state->inode); struct nfs4_closedata *calldata; @@ -1333,11 +1333,8 @@ int nfs4_do_close(struct path *path, struct nfs4_state *state, int wait) task = rpc_run_task(server->client, RPC_TASK_ASYNC, &nfs4_close_ops, calldata); if (IS_ERR(task)) return PTR_ERR(task); - status = 0; - if (wait) - status = rpc_wait_for_completion_task(task); rpc_put_task(task); - return status; + return 0; out_free_calldata: kfree(calldata); out: @@ -1368,14 +1365,13 @@ static int nfs4_intent_set_file(struct nameidata *nd, struct path *path, struct } ret = PTR_ERR(filp); out_close: - nfs4_close_sync(path, state, nd->intent.open.flags); + nfs4_close_state(path, state, nd->intent.open.flags); return ret; } struct dentry * nfs4_atomic_open(struct inode *dir, struct dentry *dentry, struct nameidata *nd) { - struct dentry *parent; struct path path = { .mnt = nd->mnt, .dentry = dentry, @@ -1398,9 +1394,6 @@ nfs4_atomic_open(struct inode *dir, struct dentry *dentry, struct nameidata *nd) cred = rpcauth_lookupcred(NFS_CLIENT(dir)->cl_auth, 0); if (IS_ERR(cred)) return (struct dentry *)cred; - parent = dentry->d_parent; - /* Protect against concurrent sillydeletes */ - nfs_block_sillyrename(parent); state = nfs4_do_open(dir, &path, nd->intent.open.flags, &attr, cred); put_rpccred(cred); if (IS_ERR(state)) { @@ -1408,14 +1401,12 @@ nfs4_atomic_open(struct inode *dir, struct dentry *dentry, struct nameidata *nd) d_add(dentry, NULL); nfs_set_verifier(dentry, nfs_save_change_attribute(dir)); } - nfs_unblock_sillyrename(parent); return (struct dentry *)state; } res = d_add_unique(dentry, igrab(state->inode)); if (res != NULL) path.dentry = res; nfs_set_verifier(path.dentry, nfs_save_change_attribute(dir)); - nfs_unblock_sillyrename(parent); nfs4_intent_set_file(nd, &path, state); return res; } @@ -1453,7 +1444,7 @@ nfs4_open_revalidate(struct inode *dir, struct dentry *dentry, int openflags, st nfs4_intent_set_file(nd, &path, state); return 1; } - nfs4_close_sync(&path, state, openflags); + nfs4_close_state(&path, state, openflags); out_drop: d_drop(dentry); return 0; @@ -1907,7 +1898,7 @@ nfs4_proc_create(struct inode *dir, struct dentry *dentry, struct iattr *sattr, if (status == 0 && (nd->flags & LOOKUP_OPEN) != 0) status = nfs4_intent_set_file(nd, &path, state); else - nfs4_close_sync(&path, state, flags); + nfs4_close_state(&path, state, flags); out: return status; } diff --git a/trunk/fs/nfs/nfs4state.c b/trunk/fs/nfs/nfs4state.c index 23a9a36556bf..bfb36261cecb 100644 --- a/trunk/fs/nfs/nfs4state.c +++ b/trunk/fs/nfs/nfs4state.c @@ -425,7 +425,7 @@ void nfs4_put_open_state(struct nfs4_state *state) /* * Close the current file. */ -static void __nfs4_close(struct path *path, struct nfs4_state *state, mode_t mode, int wait) +void nfs4_close_state(struct path *path, struct nfs4_state *state, mode_t mode) { struct nfs4_state_owner *owner = state->owner; int call_close = 0; @@ -466,17 +466,7 @@ static void __nfs4_close(struct path *path, struct nfs4_state *state, mode_t mod nfs4_put_open_state(state); nfs4_put_state_owner(owner); } else - nfs4_do_close(path, state, wait); -} - -void nfs4_close_state(struct path *path, struct nfs4_state *state, mode_t mode) -{ - __nfs4_close(path, state, mode, 0); -} - -void nfs4_close_sync(struct path *path, struct nfs4_state *state, mode_t mode) -{ - __nfs4_close(path, state, mode, 1); + nfs4_do_close(path, state); } /* diff --git a/trunk/fs/nfs/unlink.c b/trunk/fs/nfs/unlink.c index ce558c2e4d53..1aed850d18f2 100644 --- a/trunk/fs/nfs/unlink.c +++ b/trunk/fs/nfs/unlink.c @@ -11,11 +11,9 @@ #include #include #include -#include -#include + struct nfs_unlinkdata { - struct hlist_node list; struct nfs_removeargs args; struct nfs_removeres res; struct inode *dir; @@ -54,20 +52,6 @@ static int nfs_copy_dname(struct dentry *dentry, struct nfs_unlinkdata *data) return 0; } -static void nfs_free_dname(struct nfs_unlinkdata *data) -{ - kfree(data->args.name.name); - data->args.name.name = NULL; - data->args.name.len = 0; -} - -static void nfs_dec_sillycount(struct inode *dir) -{ - struct nfs_inode *nfsi = NFS_I(dir); - if (atomic_dec_return(&nfsi->silly_count) == 1) - wake_up(&nfsi->waitqueue); -} - /** * nfs_async_unlink_init - Initialize the RPC info * task: rpc_task of the sillydelete @@ -111,8 +95,6 @@ static void nfs_async_unlink_done(struct rpc_task *task, void *calldata) static void nfs_async_unlink_release(void *calldata) { struct nfs_unlinkdata *data = calldata; - - nfs_dec_sillycount(data->dir); nfs_free_unlinkdata(data); } @@ -122,100 +104,33 @@ static const struct rpc_call_ops nfs_unlink_ops = { .rpc_release = nfs_async_unlink_release, }; -static int nfs_do_call_unlink(struct dentry *parent, struct inode *dir, struct nfs_unlinkdata *data) -{ - struct rpc_task *task; - struct dentry *alias; - - alias = d_lookup(parent, &data->args.name); - if (alias != NULL) { - int ret = 0; - /* - * Hey, we raced with lookup... See if we need to transfer - * the sillyrename information to the aliased dentry. - */ - nfs_free_dname(data); - spin_lock(&alias->d_lock); - if (!(alias->d_flags & DCACHE_NFSFS_RENAMED)) { - alias->d_fsdata = data; - alias->d_flags ^= DCACHE_NFSFS_RENAMED; - ret = 1; - } - spin_unlock(&alias->d_lock); - nfs_dec_sillycount(dir); - dput(alias); - return ret; - } - data->dir = igrab(dir); - if (!data->dir) { - nfs_dec_sillycount(dir); - return 0; - } - data->args.fh = NFS_FH(dir); - nfs_fattr_init(&data->res.dir_attr); - - task = rpc_run_task(NFS_CLIENT(dir), RPC_TASK_ASYNC, &nfs_unlink_ops, data); - if (!IS_ERR(task)) - rpc_put_task(task); - return 1; -} - static int nfs_call_unlink(struct dentry *dentry, struct nfs_unlinkdata *data) { + struct rpc_task *task; struct dentry *parent; struct inode *dir; - int ret = 0; + if (nfs_copy_dname(dentry, data) < 0) + goto out_free; parent = dget_parent(dentry); if (parent == NULL) goto out_free; - dir = parent->d_inode; - if (nfs_copy_dname(dentry, data) == 0) - goto out_dput; - /* Non-exclusive lock protects against concurrent lookup() calls */ - spin_lock(&dir->i_lock); - if (atomic_inc_not_zero(&NFS_I(dir)->silly_count) == 0) { - /* Deferred delete */ - hlist_add_head(&data->list, &NFS_I(dir)->silly_list); - spin_unlock(&dir->i_lock); - ret = 1; - goto out_dput; - } - spin_unlock(&dir->i_lock); - ret = nfs_do_call_unlink(parent, dir, data); -out_dput: + dir = igrab(parent->d_inode); dput(parent); -out_free: - return ret; -} - -void nfs_block_sillyrename(struct dentry *dentry) -{ - struct nfs_inode *nfsi = NFS_I(dentry->d_inode); - - wait_event(nfsi->waitqueue, atomic_cmpxchg(&nfsi->silly_count, 1, 0) == 1); -} + if (dir == NULL) + goto out_free; -void nfs_unblock_sillyrename(struct dentry *dentry) -{ - struct inode *dir = dentry->d_inode; - struct nfs_inode *nfsi = NFS_I(dir); - struct nfs_unlinkdata *data; + data->dir = dir; + data->args.fh = NFS_FH(dir); + nfs_fattr_init(&data->res.dir_attr); - atomic_inc(&nfsi->silly_count); - spin_lock(&dir->i_lock); - while (!hlist_empty(&nfsi->silly_list)) { - if (!atomic_inc_not_zero(&nfsi->silly_count)) - break; - data = hlist_entry(nfsi->silly_list.first, struct nfs_unlinkdata, list); - hlist_del(&data->list); - spin_unlock(&dir->i_lock); - if (nfs_do_call_unlink(dentry, dir, data) == 0) - nfs_free_unlinkdata(data); - spin_lock(&dir->i_lock); - } - spin_unlock(&dir->i_lock); + task = rpc_run_task(NFS_CLIENT(dir), RPC_TASK_ASYNC, &nfs_unlink_ops, data); + if (!IS_ERR(task)) + rpc_put_task(task); + return 1; +out_free: + return 0; } /** diff --git a/trunk/fs/nfs/write.c b/trunk/fs/nfs/write.c index 89527a487ed7..0cf9d1cd9bd2 100644 --- a/trunk/fs/nfs/write.c +++ b/trunk/fs/nfs/write.c @@ -174,6 +174,8 @@ static void nfs_mark_uptodate(struct page *page, unsigned int base, unsigned int return; if (count != nfs_page_length(page)) return; + if (count != PAGE_CACHE_SIZE) + zero_user_page(page, count, PAGE_CACHE_SIZE - count, KM_USER0); SetPageUptodate(page); } @@ -625,8 +627,7 @@ static struct nfs_page * nfs_update_request(struct nfs_open_context* ctx, return ERR_PTR(error); } spin_unlock(&inode->i_lock); - req = new; - goto zero_page; + return new; } spin_unlock(&inode->i_lock); @@ -654,23 +655,13 @@ static struct nfs_page * nfs_update_request(struct nfs_open_context* ctx, if (offset < req->wb_offset) { req->wb_offset = offset; req->wb_pgbase = offset; - req->wb_bytes = max(end, rqend) - req->wb_offset; - goto zero_page; + req->wb_bytes = rqend - req->wb_offset; } if (end > rqend) req->wb_bytes = end - req->wb_offset; return req; -zero_page: - /* If this page might potentially be marked as up to date, - * then we need to zero any uninitalised data. */ - if (req->wb_pgbase == 0 && req->wb_bytes != PAGE_CACHE_SIZE - && !PageUptodate(req->wb_page)) - zero_user_page(req->wb_page, req->wb_bytes, - PAGE_CACHE_SIZE - req->wb_bytes, - KM_USER0); - return req; } int nfs_flush_incompatible(struct file *file, struct page *page) diff --git a/trunk/include/asm-alpha/ide.h b/trunk/include/asm-alpha/ide.h index b7bf68d0407b..2a5cc0b367ab 100644 --- a/trunk/include/asm-alpha/ide.h +++ b/trunk/include/asm-alpha/ide.h @@ -40,6 +40,7 @@ static inline unsigned long ide_default_io_base(int index) } } +#define IDE_ARCH_OBSOLETE_INIT #define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */ #ifdef CONFIG_PCI diff --git a/trunk/include/asm-arm/ide.h b/trunk/include/asm-arm/ide.h index f348fcf3150b..4f68c8a5a199 100644 --- a/trunk/include/asm-arm/ide.h +++ b/trunk/include/asm-arm/ide.h @@ -18,6 +18,7 @@ #endif #if !defined(CONFIG_ARCH_L7200) +# define IDE_ARCH_OBSOLETE_INIT # ifdef CONFIG_ARCH_CLPS7500 # define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */ # else diff --git a/trunk/include/asm-blackfin/ide.h b/trunk/include/asm-blackfin/ide.h index 121e272581d6..41b2db46a168 100644 --- a/trunk/include/asm-blackfin/ide.h +++ b/trunk/include/asm-blackfin/ide.h @@ -20,6 +20,7 @@ #define MAX_HWIFS 1 /* Legacy ... BLK_DEV_IDECS */ +#define IDE_ARCH_OBSOLETE_INIT #define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */ diff --git a/trunk/include/asm-cris/arch-v32/ide.h b/trunk/include/asm-cris/arch-v32/ide.h index 11296170d057..6590f657500d 100644 --- a/trunk/include/asm-cris/arch-v32/ide.h +++ b/trunk/include/asm-cris/arch-v32/ide.h @@ -54,7 +54,7 @@ static inline unsigned long ide_default_io_base(int index) #define SUPPORT_VLB_SYNC 0 #define IDE_ARCH_ACK_INTR -#define ide_ack_intr(hwif) ((hwif)->ack_intr(hwif)) +#define ide_ack_intr(hwif) (hwif)->hw.ack_intr(hwif) #endif /* __KERNEL__ */ diff --git a/trunk/include/asm-ia64/ide.h b/trunk/include/asm-ia64/ide.h index 1ccf23809329..e928675de352 100644 --- a/trunk/include/asm-ia64/ide.h +++ b/trunk/include/asm-ia64/ide.h @@ -46,6 +46,7 @@ static inline unsigned long ide_default_io_base(int index) } } +#define IDE_ARCH_OBSOLETE_INIT #define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */ #ifdef CONFIG_PCI diff --git a/trunk/include/asm-m32r/ide.h b/trunk/include/asm-m32r/ide.h index 5d2044e529ab..4672a49e8760 100644 --- a/trunk/include/asm-m32r/ide.h +++ b/trunk/include/asm-m32r/ide.h @@ -65,6 +65,7 @@ static __inline__ unsigned long ide_default_io_base(int index) } } +#define IDE_ARCH_OBSOLETE_INIT #define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */ #ifdef CONFIG_BLK_DEV_IDEPCI diff --git a/trunk/include/asm-m68k/ide.h b/trunk/include/asm-m68k/ide.h index 909c6dfd3851..f9ffb2cbbae8 100644 --- a/trunk/include/asm-m68k/ide.h +++ b/trunk/include/asm-m68k/ide.h @@ -137,7 +137,7 @@ ide_get_lock(irq_handler_t handler, void *data) #endif /* CONFIG_BLK_DEV_FALCON_IDE */ #define IDE_ARCH_ACK_INTR -#define ide_ack_intr(hwif) ((hwif)->ack_intr ? (hwif)->ack_intr(hwif) : 1) +#define ide_ack_intr(hwif) ((hwif)->hw.ack_intr ? (hwif)->hw.ack_intr(hwif) : 1) #endif /* __KERNEL__ */ #endif /* _M68K_IDE_H */ diff --git a/trunk/include/asm-mips/mach-generic/ide.h b/trunk/include/asm-mips/mach-generic/ide.h index 4ec2b930dfbb..a77128362a7d 100644 --- a/trunk/include/asm-mips/mach-generic/ide.h +++ b/trunk/include/asm-mips/mach-generic/ide.h @@ -98,6 +98,7 @@ static __inline__ unsigned long ide_default_io_base(int index) } } +#define IDE_ARCH_OBSOLETE_INIT #define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */ #ifdef CONFIG_BLK_DEV_IDEPCI diff --git a/trunk/include/asm-parisc/ide.h b/trunk/include/asm-parisc/ide.h index be8760fbc8ee..b27bf7aeb256 100644 --- a/trunk/include/asm-parisc/ide.h +++ b/trunk/include/asm-parisc/ide.h @@ -17,6 +17,7 @@ #define MAX_HWIFS 2 #endif +#define IDE_ARCH_OBSOLETE_INIT #define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */ #define ide_request_irq(irq,hand,flg,dev,id) request_irq((irq),(hand),(flg),(dev),(id)) diff --git a/trunk/include/asm-powerpc/ide.h b/trunk/include/asm-powerpc/ide.h index fd7f5a430f0a..1644e44c8757 100644 --- a/trunk/include/asm-powerpc/ide.h +++ b/trunk/include/asm-powerpc/ide.h @@ -69,11 +69,12 @@ static __inline__ unsigned long ide_default_io_base(int index) #ifdef CONFIG_BLK_DEV_MPC8xx_IDE #define IDE_ARCH_ACK_INTR 1 -#define ide_ack_intr(hwif) ((hwif)->ack_intr ? (hwif)->ack_intr(hwif) : 1) +#define ide_ack_intr(hwif) (hwif->hw.ack_intr ? hwif->hw.ack_intr(hwif) : 1) #endif #endif /* __powerpc64__ */ +#define IDE_ARCH_OBSOLETE_INIT #define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */ #endif /* __KERNEL__ */ diff --git a/trunk/include/asm-sh64/ide.h b/trunk/include/asm-sh64/ide.h index b6e31e8b9410..c9d84d5f772e 100644 --- a/trunk/include/asm-sh64/ide.h +++ b/trunk/include/asm-sh64/ide.h @@ -19,6 +19,7 @@ /* Without this, the initialisation of PCI IDE cards end up calling * ide_init_hwif_ports, which won't work. */ #ifdef CONFIG_BLK_DEV_IDEPCI +#define IDE_ARCH_OBSOLETE_INIT 1 #define ide_default_io_ctl(base) (0) #endif diff --git a/trunk/include/asm-sparc/ide.h b/trunk/include/asm-sparc/ide.h index 404022765fc7..a6d735a1310e 100644 --- a/trunk/include/asm-sparc/ide.h +++ b/trunk/include/asm-sparc/ide.h @@ -18,6 +18,7 @@ #undef MAX_HWIFS #define MAX_HWIFS 2 +#define IDE_ARCH_OBSOLETE_INIT #define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */ #define __ide_insl(data_reg, buffer, wcount) \ diff --git a/trunk/include/asm-sparc64/ide.h b/trunk/include/asm-sparc64/ide.h index ac7eb210b941..55149cf933c2 100644 --- a/trunk/include/asm-sparc64/ide.h +++ b/trunk/include/asm-sparc64/ide.h @@ -24,6 +24,7 @@ # endif #endif +#define IDE_ARCH_OBSOLETE_INIT #define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */ #define __ide_insl(data_reg, buffer, wcount) \ diff --git a/trunk/include/asm-x86/acpi_32.h b/trunk/include/asm-x86/acpi_32.h index 723493e6c851..125179adf044 100644 --- a/trunk/include/asm-x86/acpi_32.h +++ b/trunk/include/asm-x86/acpi_32.h @@ -81,7 +81,11 @@ int __acpi_release_global_lock(unsigned int *lock); :"=r"(n_hi), "=r"(n_lo) \ :"0"(n_hi), "1"(n_lo)) -extern void early_quirks(void); +#ifdef CONFIG_X86_IO_APIC +extern void check_acpi_pci(void); +#else +static inline void check_acpi_pci(void) { } +#endif #ifdef CONFIG_ACPI extern int acpi_lapic; diff --git a/trunk/include/asm-x86/compat.h b/trunk/include/asm-x86/compat.h index 66ba7987184a..53cb96b68a62 100644 --- a/trunk/include/asm-x86/compat.h +++ b/trunk/include/asm-x86/compat.h @@ -6,7 +6,6 @@ */ #include #include -#include #define COMPAT_USER_HZ 100 @@ -181,11 +180,6 @@ struct compat_shmid64_ds { compat_ulong_t __unused5; }; -/* - * The type of struct elf_prstatus.pr_reg in compatible core dumps. - */ -typedef struct user_regs_struct32 compat_elf_gregset_t; - /* * A pointer passed in from user mode. This should not * be used for syscall parameters, just declare them diff --git a/trunk/include/asm-x86/desc_64.h b/trunk/include/asm-x86/desc_64.h index 7d9c938e69fd..ac991b5ca0fd 100644 --- a/trunk/include/asm-x86/desc_64.h +++ b/trunk/include/asm-x86/desc_64.h @@ -20,16 +20,6 @@ extern struct desc_struct cpu_gdt_table[GDT_ENTRIES]; #define load_LDT_desc() asm volatile("lldt %w0"::"r" (GDT_ENTRY_LDT*8)) #define clear_LDT() asm volatile("lldt %w0"::"r" (0)) -static inline unsigned long __store_tr(void) -{ - unsigned long tr; - - asm volatile ("str %w0":"=r" (tr)); - return tr; -} - -#define store_tr(tr) (tr) = __store_tr() - /* * This is the ldt that every process will get unless we need * something other than this. @@ -41,16 +31,6 @@ extern struct desc_ptr cpu_gdt_descr[]; /* the cpu gdt accessor */ #define cpu_gdt(_cpu) ((struct desc_struct *)cpu_gdt_descr[_cpu].address) -static inline void load_gdt(const struct desc_ptr *ptr) -{ - asm volatile("lgdt %w0"::"m" (*ptr)); -} - -static inline void store_gdt(struct desc_ptr *ptr) -{ - asm("sgdt %w0":"=m" (*ptr)); -} - static inline void _set_gate(void *adr, unsigned type, unsigned long func, unsigned dpl, unsigned ist) { struct gate_struct s; @@ -91,16 +71,6 @@ static inline void set_system_gate_ist(int nr, void *func, unsigned ist) _set_gate(&idt_table[nr], GATE_INTERRUPT, (unsigned long) func, 3, ist); } -static inline void load_idt(const struct desc_ptr *ptr) -{ - asm volatile("lidt %w0"::"m" (*ptr)); -} - -static inline void store_idt(struct desc_ptr *dtr) -{ - asm("sidt %w0":"=m" (*dtr)); -} - static inline void set_tssldt_descriptor(void *ptr, unsigned long tss, unsigned type, unsigned size) { diff --git a/trunk/include/asm-x86/geode.h b/trunk/include/asm-x86/geode.h index 771af336734f..d94898831bac 100644 --- a/trunk/include/asm-x86/geode.h +++ b/trunk/include/asm-x86/geode.h @@ -38,8 +38,6 @@ extern int geode_get_dev_base(unsigned int dev); #define MSR_LBAR_ACPI 0x5140000E #define MSR_LBAR_PMS 0x5140000F -#define MSR_DIVIL_SOFT_RESET 0x51400017 - #define MSR_PIC_YSEL_LOW 0x51400020 #define MSR_PIC_YSEL_HIGH 0x51400021 #define MSR_PIC_ZSEL_LOW 0x51400022 diff --git a/trunk/include/asm-x86/hpet.h b/trunk/include/asm-x86/hpet.h index 4f51519fc199..d4ab6db050b6 100644 --- a/trunk/include/asm-x86/hpet.h +++ b/trunk/include/asm-x86/hpet.h @@ -64,7 +64,6 @@ /* hpet memory map physical address */ extern unsigned long hpet_address; extern unsigned long force_hpet_address; -extern int hpet_force_user; extern int is_hpet_enabled(void); extern int hpet_enable(void); extern unsigned long hpet_readl(unsigned long a); diff --git a/trunk/include/asm-x86/ide.h b/trunk/include/asm-x86/ide.h index 42130adf9c7c..e7817a3d6578 100644 --- a/trunk/include/asm-x86/ide.h +++ b/trunk/include/asm-x86/ide.h @@ -62,6 +62,7 @@ static __inline__ unsigned long ide_default_io_base(int index) } } +#define IDE_ARCH_OBSOLETE_INIT #define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */ #ifdef CONFIG_BLK_DEV_IDEPCI diff --git a/trunk/include/asm-x86/io_apic_64.h b/trunk/include/asm-x86/io_apic_64.h index e2c13675ee4e..d9f2e54324d5 100644 --- a/trunk/include/asm-x86/io_apic_64.h +++ b/trunk/include/asm-x86/io_apic_64.h @@ -133,6 +133,4 @@ void enable_NMI_through_LVT0 (void * dummy); extern spinlock_t i8259A_lock; -extern int timer_over_8254; - #endif diff --git a/trunk/include/asm-x86/ipi.h b/trunk/include/asm-x86/ipi.h index 6d011bd6067d..a7c75ea408a8 100644 --- a/trunk/include/asm-x86/ipi.h +++ b/trunk/include/asm-x86/ipi.h @@ -119,7 +119,7 @@ static inline void send_IPI_mask_sequence(cpumask_t mask, int vector) */ local_irq_save(flags); for_each_cpu_mask(query_cpu, mask) { - __send_IPI_dest_field(per_cpu(x86_cpu_to_apicid, query_cpu), + __send_IPI_dest_field(x86_cpu_to_apicid[query_cpu], vector, APIC_DEST_PHYSICAL); } local_irq_restore(flags); diff --git a/trunk/include/asm-x86/irq_32.h b/trunk/include/asm-x86/irq_32.h index aca9c96e8e6b..36f310632c49 100644 --- a/trunk/include/asm-x86/irq_32.h +++ b/trunk/include/asm-x86/irq_32.h @@ -45,7 +45,4 @@ unsigned int do_IRQ(struct pt_regs *regs); void init_IRQ(void); void __init native_init_IRQ(void); -/* Interrupt vector management */ -extern DECLARE_BITMAP(used_vectors, NR_VECTORS); - #endif /* _ASM_IRQ_H */ diff --git a/trunk/include/asm-x86/msr-index.h b/trunk/include/asm-x86/msr-index.h index a4944732be04..a02eb2991349 100644 --- a/trunk/include/asm-x86/msr-index.h +++ b/trunk/include/asm-x86/msr-index.h @@ -73,32 +73,8 @@ #define MSR_P6_EVNTSEL0 0x00000186 #define MSR_P6_EVNTSEL1 0x00000187 -/* AMD64 MSRs. Not complete. See the architecture manual for a more +/* K7/K8 MSRs. Not complete. See the architecture manual for a more complete list. */ - -#define MSR_AMD64_IBSFETCHCTL 0xc0011030 -#define MSR_AMD64_IBSFETCHLINAD 0xc0011031 -#define MSR_AMD64_IBSFETCHPHYSAD 0xc0011032 -#define MSR_AMD64_IBSOPCTL 0xc0011033 -#define MSR_AMD64_IBSOPRIP 0xc0011034 -#define MSR_AMD64_IBSOPDATA 0xc0011035 -#define MSR_AMD64_IBSOPDATA2 0xc0011036 -#define MSR_AMD64_IBSOPDATA3 0xc0011037 -#define MSR_AMD64_IBSDCLINAD 0xc0011038 -#define MSR_AMD64_IBSDCPHYSAD 0xc0011039 -#define MSR_AMD64_IBSCTL 0xc001103a - -/* K8 MSRs */ -#define MSR_K8_TOP_MEM1 0xc001001a -#define MSR_K8_TOP_MEM2 0xc001001d -#define MSR_K8_SYSCFG 0xc0010010 -#define MSR_K8_HWCR 0xc0010015 -#define MSR_K8_ENABLE_C1E 0xc0010055 -#define K8_MTRRFIXRANGE_DRAM_ENABLE 0x00040000 /* MtrrFixDramEn bit */ -#define K8_MTRRFIXRANGE_DRAM_MODIFY 0x00080000 /* MtrrFixDramModEn bit */ -#define K8_MTRR_RDMEM_WRMEM_MASK 0x18181818 /* Mask: RdMem|WrMem */ - -/* K7 MSRs */ #define MSR_K7_EVNTSEL0 0xc0010000 #define MSR_K7_PERFCTR0 0xc0010004 #define MSR_K7_EVNTSEL1 0xc0010001 @@ -107,10 +83,20 @@ #define MSR_K7_PERFCTR2 0xc0010006 #define MSR_K7_EVNTSEL3 0xc0010003 #define MSR_K7_PERFCTR3 0xc0010007 +#define MSR_K8_TOP_MEM1 0xc001001a #define MSR_K7_CLK_CTL 0xc001001b +#define MSR_K8_TOP_MEM2 0xc001001d +#define MSR_K8_SYSCFG 0xc0010010 + +#define K8_MTRRFIXRANGE_DRAM_ENABLE 0x00040000 /* MtrrFixDramEn bit */ +#define K8_MTRRFIXRANGE_DRAM_MODIFY 0x00080000 /* MtrrFixDramModEn bit */ +#define K8_MTRR_RDMEM_WRMEM_MASK 0x18181818 /* Mask: RdMem|WrMem */ + #define MSR_K7_HWCR 0xc0010015 +#define MSR_K8_HWCR 0xc0010015 #define MSR_K7_FID_VID_CTL 0xc0010041 #define MSR_K7_FID_VID_STATUS 0xc0010042 +#define MSR_K8_ENABLE_C1E 0xc0010055 /* K6 MSRs */ #define MSR_K6_EFER 0xc0000080 diff --git a/trunk/include/asm-x86/processor_32.h b/trunk/include/asm-x86/processor_32.h index 13976b086837..83800e7496ee 100644 --- a/trunk/include/asm-x86/processor_32.h +++ b/trunk/include/asm-x86/processor_32.h @@ -79,7 +79,6 @@ struct cpuinfo_x86 { unsigned char booted_cores; /* number of cores as seen by OS */ __u8 phys_proc_id; /* Physical processor id. */ __u8 cpu_core_id; /* Core id */ - __u8 cpu_index; /* index into per_cpu list */ #endif } __attribute__((__aligned__(SMP_CACHE_BYTES))); @@ -104,19 +103,14 @@ extern struct tss_struct doublefault_tss; DECLARE_PER_CPU(struct tss_struct, init_tss); #ifdef CONFIG_SMP -DECLARE_PER_CPU(struct cpuinfo_x86, cpu_info); -#define cpu_data(cpu) per_cpu(cpu_info, cpu) -#define current_cpu_data cpu_data(smp_processor_id()) +extern struct cpuinfo_x86 cpu_data[]; +#define current_cpu_data cpu_data[smp_processor_id()] #else -#define cpu_data(cpu) boot_cpu_data -#define current_cpu_data boot_cpu_data +#define cpu_data (&boot_cpu_data) +#define current_cpu_data boot_cpu_data #endif -/* - * the following now lives in the per cpu area: - * extern int cpu_llc_id[NR_CPUS]; - */ -DECLARE_PER_CPU(u8, cpu_llc_id); +extern int cpu_llc_id[NR_CPUS]; extern char ignore_fpu_irq; void __init cpu_detect(struct cpuinfo_x86 *c); diff --git a/trunk/include/asm-x86/processor_64.h b/trunk/include/asm-x86/processor_64.h index e4f19970a82b..f422becbddd9 100644 --- a/trunk/include/asm-x86/processor_64.h +++ b/trunk/include/asm-x86/processor_64.h @@ -74,7 +74,6 @@ struct cpuinfo_x86 { __u8 booted_cores; /* number of cores as seen by OS */ __u8 phys_proc_id; /* Physical Processor id. */ __u8 cpu_core_id; /* Core id. */ - __u8 cpu_index; /* index into per_cpu list */ #endif } ____cacheline_aligned; @@ -89,12 +88,11 @@ struct cpuinfo_x86 { #define X86_VENDOR_UNKNOWN 0xff #ifdef CONFIG_SMP -DECLARE_PER_CPU(struct cpuinfo_x86, cpu_info); -#define cpu_data(cpu) per_cpu(cpu_info, cpu) -#define current_cpu_data cpu_data(smp_processor_id()) +extern struct cpuinfo_x86 cpu_data[]; +#define current_cpu_data cpu_data[smp_processor_id()] #else -#define cpu_data(cpu) boot_cpu_data -#define current_cpu_data boot_cpu_data +#define cpu_data (&boot_cpu_data) +#define current_cpu_data boot_cpu_data #endif extern char ignore_irq13; @@ -392,6 +390,12 @@ static inline void sync_core(void) asm volatile("cpuid" : "=a" (tmp) : "0" (1) : "ebx","ecx","edx","memory"); } +#define ARCH_HAS_PREFETCH +static inline void prefetch(void *x) +{ + asm volatile("prefetcht0 (%0)" :: "r" (x)); +} + #define ARCH_HAS_PREFETCHW 1 static inline void prefetchw(void *x) { diff --git a/trunk/include/asm-x86/proto.h b/trunk/include/asm-x86/proto.h index dabba55f7ed8..c44a3a93b5a4 100644 --- a/trunk/include/asm-x86/proto.h +++ b/trunk/include/asm-x86/proto.h @@ -83,6 +83,8 @@ extern unsigned tsc_khz; extern int reboot_force; extern int notsc_setup(char *); +extern int timer_over_8254; + extern int gsi_irq_sharing(int gsi); extern int force_mwait; diff --git a/trunk/include/asm-x86/ptrace_32.h b/trunk/include/asm-x86/ptrace_32.h index 78d063dabe0a..6002597b9e12 100644 --- a/trunk/include/asm-x86/ptrace_32.h +++ b/trunk/include/asm-x86/ptrace_32.h @@ -55,8 +55,6 @@ static inline int v8086_mode(struct pt_regs *regs) } #define instruction_pointer(regs) ((regs)->eip) -#define frame_pointer(regs) ((regs)->ebp) -#define stack_pointer(regs) ((regs)->esp) #define regs_return_value(regs) ((regs)->eax) extern unsigned long profile_pc(struct pt_regs *regs); diff --git a/trunk/include/asm-x86/ptrace_64.h b/trunk/include/asm-x86/ptrace_64.h index 7bfe61e1b705..7f166ccb0606 100644 --- a/trunk/include/asm-x86/ptrace_64.h +++ b/trunk/include/asm-x86/ptrace_64.h @@ -40,8 +40,6 @@ struct pt_regs { #define user_mode(regs) (!!((regs)->cs & 3)) #define user_mode_vm(regs) user_mode(regs) #define instruction_pointer(regs) ((regs)->rip) -#define frame_pointer(regs) ((regs)->rbp) -#define stack_pointer(regs) ((regs)->rsp) #define regs_return_value(regs) ((regs)->rax) extern unsigned long profile_pc(struct pt_regs *regs); diff --git a/trunk/include/asm-x86/smp_32.h b/trunk/include/asm-x86/smp_32.h index 7056d8684522..1f576a93368f 100644 --- a/trunk/include/asm-x86/smp_32.h +++ b/trunk/include/asm-x86/smp_32.h @@ -39,11 +39,9 @@ extern void lock_ipi_call_lock(void); extern void unlock_ipi_call_lock(void); #define MAX_APICID 256 -extern u8 __initdata x86_cpu_to_apicid_init[]; -extern void *x86_cpu_to_apicid_ptr; -DECLARE_PER_CPU(u8, x86_cpu_to_apicid); +extern u8 x86_cpu_to_apicid[]; -#define cpu_physical_id(cpu) per_cpu(x86_cpu_to_apicid, cpu) +#define cpu_physical_id(cpu) x86_cpu_to_apicid[cpu] extern void set_cpu_sibling_map(int cpu); diff --git a/trunk/include/asm-x86/smp_64.h b/trunk/include/asm-x86/smp_64.h index 6f0e0273b646..d30e9b684fdd 100644 --- a/trunk/include/asm-x86/smp_64.h +++ b/trunk/include/asm-x86/smp_64.h @@ -37,8 +37,6 @@ extern void lock_ipi_call_lock(void); extern void unlock_ipi_call_lock(void); extern int smp_num_siblings; extern void smp_send_reschedule(int cpu); -extern int smp_call_function_mask(cpumask_t mask, void (*func)(void *), - void *info, int wait); /* * cpu_sibling_map and cpu_core_map now live @@ -49,7 +47,7 @@ extern int smp_call_function_mask(cpumask_t mask, void (*func)(void *), */ DECLARE_PER_CPU(cpumask_t, cpu_sibling_map); DECLARE_PER_CPU(cpumask_t, cpu_core_map); -DECLARE_PER_CPU(u8, cpu_llc_id); +extern u8 cpu_llc_id[NR_CPUS]; #define SMP_TRAMPOLINE_BASE 0x6000 @@ -86,9 +84,7 @@ static inline int hard_smp_processor_id(void) * Some lowlevel functions might want to know about * the real APIC ID <-> CPU # mapping. */ -extern u8 __initdata x86_cpu_to_apicid_init[]; -extern void *x86_cpu_to_apicid_ptr; -DECLARE_PER_CPU(u8, x86_cpu_to_apicid); /* physical ID */ +extern u8 x86_cpu_to_apicid[NR_CPUS]; /* physical ID */ extern u8 bios_cpu_apicid[]; static inline int cpu_present_to_apicid(int mps_cpu) @@ -119,9 +115,8 @@ static __inline int logical_smp_processor_id(void) } #ifdef CONFIG_SMP -#define cpu_physical_id(cpu) per_cpu(x86_cpu_to_apicid, cpu) +#define cpu_physical_id(cpu) x86_cpu_to_apicid[cpu] #else -extern unsigned int boot_cpu_id; #define cpu_physical_id(cpu) boot_cpu_id #endif /* !CONFIG_SMP */ #endif diff --git a/trunk/include/asm-x86/system_32.h b/trunk/include/asm-x86/system_32.h index ef8468883bac..db6283eb5e46 100644 --- a/trunk/include/asm-x86/system_32.h +++ b/trunk/include/asm-x86/system_32.h @@ -315,6 +315,5 @@ extern unsigned long arch_align_stack(unsigned long sp); extern void free_init_pages(char *what, unsigned long begin, unsigned long end); void default_idle(void); -void __show_registers(struct pt_regs *, int all); #endif diff --git a/trunk/include/asm-x86/topology_32.h b/trunk/include/asm-x86/topology_32.h index 9040f5a61278..ae1074603c4b 100644 --- a/trunk/include/asm-x86/topology_32.h +++ b/trunk/include/asm-x86/topology_32.h @@ -28,8 +28,8 @@ #define _ASM_I386_TOPOLOGY_H #ifdef CONFIG_X86_HT -#define topology_physical_package_id(cpu) (cpu_data(cpu).phys_proc_id) -#define topology_core_id(cpu) (cpu_data(cpu).cpu_core_id) +#define topology_physical_package_id(cpu) (cpu_data[cpu].phys_proc_id) +#define topology_core_id(cpu) (cpu_data[cpu].cpu_core_id) #define topology_core_siblings(cpu) (per_cpu(cpu_core_map, cpu)) #define topology_thread_siblings(cpu) (per_cpu(cpu_sibling_map, cpu)) #endif diff --git a/trunk/include/asm-x86/topology_64.h b/trunk/include/asm-x86/topology_64.h index a718dda037e0..c0c93d744673 100644 --- a/trunk/include/asm-x86/topology_64.h +++ b/trunk/include/asm-x86/topology_64.h @@ -56,8 +56,8 @@ extern int __node_distance(int, int); #endif #ifdef CONFIG_SMP -#define topology_physical_package_id(cpu) (cpu_data(cpu).phys_proc_id) -#define topology_core_id(cpu) (cpu_data(cpu).cpu_core_id) +#define topology_physical_package_id(cpu) (cpu_data[cpu].phys_proc_id) +#define topology_core_id(cpu) (cpu_data[cpu].cpu_core_id) #define topology_core_siblings(cpu) (per_cpu(cpu_core_map, cpu)) #define topology_thread_siblings(cpu) (per_cpu(cpu_sibling_map, cpu)) #define mc_capable() (boot_cpu_data.x86_max_cores > 1) diff --git a/trunk/include/linux/device-mapper.h b/trunk/include/linux/device-mapper.h index 37c66d1254b5..499f5373e213 100644 --- a/trunk/include/linux/device-mapper.h +++ b/trunk/include/linux/device-mapper.h @@ -183,14 +183,11 @@ int dm_resume(struct mapped_device *md); */ uint32_t dm_get_event_nr(struct mapped_device *md); int dm_wait_event(struct mapped_device *md, int event_nr); -uint32_t dm_next_uevent_seq(struct mapped_device *md); -void dm_uevent_add(struct mapped_device *md, struct list_head *elist); /* * Info functions. */ const char *dm_device_name(struct mapped_device *md); -int dm_copy_name_and_uuid(struct mapped_device *md, char *name, char *uuid); struct gendisk *dm_disk(struct mapped_device *md); int dm_suspended(struct mapped_device *md); int dm_noflush_suspending(struct dm_target *ti); diff --git a/trunk/include/linux/dm-ioctl.h b/trunk/include/linux/dm-ioctl.h index 523281c5b7f5..b93486107821 100644 --- a/trunk/include/linux/dm-ioctl.h +++ b/trunk/include/linux/dm-ioctl.h @@ -131,7 +131,6 @@ struct dm_ioctl { char name[DM_NAME_LEN]; /* device name */ char uuid[DM_UUID_LEN]; /* unique identifier for * the block device */ - char data[7]; /* padding or data */ }; /* @@ -286,9 +285,9 @@ typedef char ioctl_struct[308]; #define DM_DEV_SET_GEOMETRY _IOWR(DM_IOCTL, DM_DEV_SET_GEOMETRY_CMD, struct dm_ioctl) #define DM_VERSION_MAJOR 4 -#define DM_VERSION_MINOR 12 +#define DM_VERSION_MINOR 11 #define DM_VERSION_PATCHLEVEL 0 -#define DM_VERSION_EXTRA "-ioctl (2007-10-02)" +#define DM_VERSION_EXTRA "-ioctl (2006-10-12)" /* Status bits */ #define DM_READONLY_FLAG (1 << 0) /* In/Out */ diff --git a/trunk/include/linux/ide.h b/trunk/include/linux/ide.h index 2e4b8dd03cfe..19db0a4ae447 100644 --- a/trunk/include/linux/ide.h +++ b/trunk/include/linux/ide.h @@ -192,20 +192,22 @@ typedef unsigned char byte; /* used everywhere */ struct hwif_s; typedef int (ide_ack_intr_t)(struct hwif_s *); +#ifndef NO_DMA +#define NO_DMA 255 +#endif + /* * hwif_chipset_t is used to keep track of the specific hardware * chipset used by each IDE interface, if known. */ -enum { ide_unknown, ide_generic, ide_pci, +typedef enum { ide_unknown, ide_generic, ide_pci, ide_cmd640, ide_dtc2278, ide_ali14xx, ide_qd65xx, ide_umc8672, ide_ht6560b, ide_rz1000, ide_trm290, ide_cmd646, ide_cy82c693, ide_4drives, ide_pmac, ide_etrax100, ide_acorn, ide_au1xxx, ide_forced -}; - -typedef u8 hwif_chipset_t; +} hwif_chipset_t; /* * Structure to hold all information about the location of this port @@ -213,16 +215,22 @@ typedef u8 hwif_chipset_t; typedef struct hw_regs_s { unsigned long io_ports[IDE_NR_PORTS]; /* task file registers */ int irq; /* our irq number */ + int dma; /* our dma entry */ ide_ack_intr_t *ack_intr; /* acknowledge interrupt */ hwif_chipset_t chipset; struct device *dev; } hw_regs_t; -struct hwif_s * ide_find_port(unsigned long); - -int ide_register_hw(hw_regs_t *, void (*)(struct hwif_s *), int, - struct hwif_s **); +/* + * Register new hardware with ide + */ +int ide_register_hw(hw_regs_t *, int, struct hwif_s **); +int ide_register_hw_with_fixup(hw_regs_t *, int, struct hwif_s **, + void (*)(struct hwif_s *)); +/* + * Set up hw_regs_t structure before calling ide_register_hw (optional) + */ void ide_setup_ports( hw_regs_t *hw, unsigned long base, int *offsets, @@ -260,7 +268,11 @@ static inline void ide_std_init_ports(hw_regs_t *hw, # define ide_init_default_irq(base) (0) #endif -#ifdef CONFIG_IDE_ARCH_OBSOLETE_INIT +/* + * ide_init_hwif_ports() is OBSOLETE and will be removed in 2.7 series. + * New ports shouldn't define IDE_ARCH_OBSOLETE_INIT in . + */ +#ifdef IDE_ARCH_OBSOLETE_INIT static inline void ide_init_hwif_ports(hw_regs_t *hw, unsigned long io_addr, unsigned long ctl_addr, @@ -290,7 +302,7 @@ static inline void ide_init_hwif_ports(hw_regs_t *hw, if (io_addr || ctl_addr) printk(KERN_WARNING "%s: must not be called\n", __FUNCTION__); } -#endif /* CONFIG_IDE_ARCH_OBSOLETE_INIT */ +#endif /* IDE_ARCH_OBSOLETE_INIT */ /* Currently only m68k, apus and m8xx need it */ #ifndef IDE_ARCH_ACK_INTR @@ -351,6 +363,7 @@ typedef union { * ATA DATA Register Special. * ATA NSECTOR Count Register(). * ATAPI Byte Count Register. + * Channel index ordering pairs. */ typedef union { unsigned all :16; @@ -365,7 +378,7 @@ typedef union { #error "Please fix " #endif } b; -} ata_nsector_t, ata_data_t, atapi_bcount_t; +} ata_nsector_t, ata_data_t, atapi_bcount_t, ata_index_t; /* * ATA-IDE Select Register, aka Device-Head @@ -644,7 +657,7 @@ typedef struct ide_drive_s { ((1<> (c)) & 1) -struct ide_port_info; +struct ide_pci_device_s; typedef struct hwif_s { struct hwif_s *next; /* for linked-list in ide_hwgroup_t */ @@ -659,6 +672,7 @@ typedef struct hwif_s { unsigned long sata_scr[SATA_NR_PORTS]; unsigned long sata_misc[SATA_NR_PORTS]; + hw_regs_t hw; /* Hardware info */ ide_drive_t drives[MAX_DRIVES]; /* drive info */ u8 major; /* our major number */ @@ -680,9 +694,7 @@ typedef struct hwif_s { hwif_chipset_t chipset; /* sub-module for tuning.. */ struct pci_dev *pci_dev; /* for pci chipsets */ - const struct ide_port_info *cds; /* chipset device struct */ - - ide_ack_intr_t *ack_intr; + struct ide_pci_device_s *cds; /* chipset device struct */ void (*rw_disk)(ide_drive_t *, struct request *); @@ -713,8 +725,6 @@ typedef struct hwif_s { u8 (*mdma_filter)(ide_drive_t *); u8 (*udma_filter)(ide_drive_t *); - void (*fixup)(struct hwif_s *); - void (*ata_input_data)(ide_drive_t *, void *, u32); void (*ata_output_data)(ide_drive_t *, void *, u32); @@ -831,6 +841,8 @@ typedef struct hwgroup_s { /* for pci chipsets */ struct pci_dev *pci_dev; + /* chipset device struct */ + struct ide_pci_device_s *cds; /* current request */ struct request *rq; @@ -1018,16 +1030,36 @@ extern int ide_end_request (ide_drive_t *drive, int uptodate, int nrsecs); int ide_end_dequeued_request(ide_drive_t *drive, struct request *rq, int uptodate, int nr_sectors); +/* + * This is used on exit from the driver to designate the next irq handler + * and also to start the safety timer. + */ extern void ide_set_handler (ide_drive_t *drive, ide_handler_t *handler, unsigned int timeout, ide_expiry_t *expiry); +/* + * This is used on exit from the driver to designate the next irq handler + * and start the safety time safely and atomically from the IRQ handler + * with respect to the command issue (which it also does) + */ extern void ide_execute_command(ide_drive_t *, task_ioreg_t cmd, ide_handler_t *, unsigned int, ide_expiry_t *); ide_startstop_t __ide_error(ide_drive_t *, struct request *, u8, u8); +/* + * ide_error() takes action based on the error returned by the controller. + * The caller should return immediately after invoking this. + * + * (drive, msg, status) + */ ide_startstop_t ide_error (ide_drive_t *drive, const char *msg, byte stat); ide_startstop_t __ide_abort(ide_drive_t *, struct request *); +/* + * Abort a running command on the controller triggering the abort + * from a host side, non error situation + * (drive, msg) + */ extern ide_startstop_t ide_abort(ide_drive_t *, const char *); extern void ide_fix_driveid(struct hd_driveid *); @@ -1043,8 +1075,15 @@ extern void ide_fixstring(u8 *, const int, const int); int ide_wait_stat(ide_startstop_t *, ide_drive_t *, u8, u8, unsigned long); +/* + * Start a reset operation for an IDE interface. + * The caller should return immediately after invoking this. + */ extern ide_startstop_t ide_do_reset (ide_drive_t *); +/* + * This function is intended to be used prior to invoking ide_do_drive_cmd(). + */ extern void ide_init_drive_cmd (struct request *rq); /* @@ -1059,6 +1098,13 @@ typedef enum { extern int ide_do_drive_cmd(ide_drive_t *, struct request *, ide_action_t); +/* + * Clean up after success/failure of an explicit drive cmd. + * stat/err are used only when (HWGROUP(drive)->rq->cmd == IDE_DRIVE_CMD). + * stat/err are used only when (HWGROUP(drive)->rq->cmd == IDE_DRIVE_TASK_MASK). + * + * (ide_drive_t *drive, u8 stat, u8 err) + */ extern void ide_end_drive_cmd(ide_drive_t *, u8, u8); /* @@ -1131,6 +1177,10 @@ extern int taskfile_lib_get_identify(ide_drive_t *drive, u8 *); extern int ide_wait_not_busy(ide_hwif_t *hwif, unsigned long timeout); +/* + * ide_stall_queue() can be used by a drive to give excess bandwidth back + * to the hwgroup by sleeping for timeout jiffies. + */ extern void ide_stall_queue(ide_drive_t *drive, unsigned long timeout); extern int ide_spin_wait_hwgroup(ide_drive_t *); @@ -1150,8 +1200,8 @@ extern int __ide_pci_register_driver(struct pci_driver *driver, struct module *o #define ide_pci_register_driver(d) pci_register_driver(d) #endif -void ide_pci_setup_ports(struct pci_dev *, const struct ide_port_info *, int, u8 *); -void ide_setup_pci_noise(struct pci_dev *, const struct ide_port_info *); +void ide_pci_setup_ports(struct pci_dev *, struct ide_pci_device_s *, int, ata_index_t *); +extern void ide_setup_pci_noise (struct pci_dev *dev, struct ide_pci_device_s *d); extern void default_hwif_iops(ide_hwif_t *); extern void default_hwif_mmiops(ide_hwif_t *); @@ -1211,14 +1261,6 @@ enum { IDE_HFLAG_SERIALIZE = (1 << 20), /* use legacy IRQs */ IDE_HFLAG_LEGACY_IRQS = (1 << 21), - /* force use of legacy IRQs */ - IDE_HFLAG_FORCE_LEGACY_IRQS = (1 << 22), - /* limit LBA48 requests to 256 sectors */ - IDE_HFLAG_RQSIZE_256 = (1 << 23), - /* use 32-bit I/O ops */ - IDE_HFLAG_IO_32BIT = (1 << 24), - /* unmask IRQs */ - IDE_HFLAG_UNMASK_IRQS = (1 << 25), }; #ifdef CONFIG_BLK_DEV_OFFBOARD @@ -1227,7 +1269,7 @@ enum { # define IDE_HFLAG_OFF_BOARD 0 #endif -struct ide_port_info { +typedef struct ide_pci_device_s { char *name; unsigned int (*init_chipset)(struct pci_dev *, const char *); void (*init_iops)(ide_hwif_t *); @@ -1235,17 +1277,17 @@ struct ide_port_info { void (*init_dma)(ide_hwif_t *, unsigned long); void (*fixup)(ide_hwif_t *); ide_pci_enablebit_t enablebits[2]; - hwif_chipset_t chipset; unsigned int extra; + struct ide_pci_device_s *next; u32 host_flags; u8 pio_mask; u8 swdma_mask; u8 mwdma_mask; u8 udma_mask; -}; +} ide_pci_device_t; -int ide_setup_pci_device(struct pci_dev *, const struct ide_port_info *); -int ide_setup_pci_devices(struct pci_dev *, struct pci_dev *, const struct ide_port_info *); +extern int ide_setup_pci_device(struct pci_dev *, ide_pci_device_t *); +extern int ide_setup_pci_devices(struct pci_dev *, struct pci_dev *, ide_pci_device_t *); void ide_map_sg(ide_drive_t *, struct request *); void ide_init_sg_cmd(ide_drive_t *, struct request *); @@ -1328,7 +1370,8 @@ void ide_unregister_region(struct gendisk *); void ide_undecoded_slave(ide_hwif_t *); -int ide_device_add(u8 idx[4]); +int probe_hwif_init_with_fixup(ide_hwif_t *, void (*)(ide_hwif_t *)); +extern int probe_hwif_init(ide_hwif_t *); static inline void *ide_get_hwifdata (ide_hwif_t * hwif) { diff --git a/trunk/include/linux/nfs_fs.h b/trunk/include/linux/nfs_fs.h index e82a6ebc725d..c5164c257f71 100644 --- a/trunk/include/linux/nfs_fs.h +++ b/trunk/include/linux/nfs_fs.h @@ -160,12 +160,6 @@ struct nfs_inode { /* Open contexts for shared mmap writes */ struct list_head open_files; - /* Number of in-flight sillydelete RPC calls */ - atomic_t silly_count; - /* List of deferred sillydelete requests */ - struct hlist_head silly_list; - wait_queue_head_t waitqueue; - #ifdef CONFIG_NFS_V4 struct nfs4_cached_acl *nfs4_acl; /* NFSv4 state */ @@ -400,8 +394,6 @@ extern void nfs_release_automount_timer(void); */ extern int nfs_async_unlink(struct inode *dir, struct dentry *dentry); extern void nfs_complete_unlink(struct dentry *dentry, struct inode *); -extern void nfs_block_sillyrename(struct dentry *dentry); -extern void nfs_unblock_sillyrename(struct dentry *dentry); /* * linux/fs/nfs/write.c diff --git a/trunk/include/linux/prefetch.h b/trunk/include/linux/prefetch.h index af7c36a5a521..1adfe668d031 100644 --- a/trunk/include/linux/prefetch.h +++ b/trunk/include/linux/prefetch.h @@ -34,12 +34,17 @@ */ +/* + * These cannot be do{}while(0) macros. See the mental gymnastics in + * the loop macro. + */ + #ifndef ARCH_HAS_PREFETCH -#define prefetch(x) __builtin_prefetch(x) +static inline void prefetch(const void *x) {;} #endif #ifndef ARCH_HAS_PREFETCHW -#define prefetchw(x) __builtin_prefetch(x,1) +static inline void prefetchw(const void *x) {;} #endif #ifndef ARCH_HAS_SPINLOCK_PREFETCH diff --git a/trunk/kernel/Makefile b/trunk/kernel/Makefile index 79f017e09fbd..05c3e6df8597 100644 --- a/trunk/kernel/Makefile +++ b/trunk/kernel/Makefile @@ -9,9 +9,8 @@ obj-y = sched.o fork.o exec_domain.o panic.o printk.o profile.o \ rcupdate.o extable.o params.o posix-timers.o \ kthread.o wait.o kfifo.o sys_ni.o posix-cpu-timers.o mutex.o \ hrtimer.o rwsem.o latency.o nsproxy.o srcu.o \ - utsname.o notifier.o + utsname.o sysctl_check.o notifier.o -obj-$(CONFIG_SYSCTL) += sysctl_check.o obj-$(CONFIG_STACKTRACE) += stacktrace.o obj-y += time/ obj-$(CONFIG_DEBUG_MUTEXES) += mutex-debug.o diff --git a/trunk/scripts/Kbuild.include b/trunk/scripts/Kbuild.include index b96ea8d6a5ed..de7bb284c611 100644 --- a/trunk/scripts/Kbuild.include +++ b/trunk/scripts/Kbuild.include @@ -56,17 +56,6 @@ endef # gcc support functions # See documentation in Documentation/kbuild/makefiles.txt -# cc-cross-prefix -# Usage: CROSS_COMPILE := $(call cc-cross-prefix, m68k-linux-gnu- m68k-linux-) -# Return first prefix where a prefix$(CC) is found in PATH. -# If no $(CC) found in PATH with listed prefixes return nothing -cc-cross-prefix = \ - $(word 1, $(foreach c,$(1), \ - $(shell set -e; \ - if (which $(strip $(c))$(CC)) > /dev/null 2>&1 ; then \ - echo $(c); \ - fi))) - # output directory for tests below TMPOUT := $(if $(KBUILD_EXTMOD),$(firstword $(KBUILD_EXTMOD))/) diff --git a/trunk/scripts/basic/docproc.c b/trunk/scripts/basic/docproc.c index 0e4bd5459df4..e5c6ac7bde9b 100644 --- a/trunk/scripts/basic/docproc.c +++ b/trunk/scripts/basic/docproc.c @@ -66,15 +66,12 @@ FILELINE * entity_system; #define FUNCTION "-function" #define NOFUNCTION "-nofunction" -char *srctree; - void usage (void) { fprintf(stderr, "Usage: docproc {doc|depend} file\n"); fprintf(stderr, "Input is read from file.tmpl. Output is sent to stdout\n"); fprintf(stderr, "doc: frontend when generating kernel documentation\n"); fprintf(stderr, "depend: generate list of files referenced within file\n"); - fprintf(stderr, "Environment variable SRCTREE: absolute path to kernel source tree.\n"); } /* @@ -93,7 +90,7 @@ void exec_kernel_doc(char **svec) exit(1); case 0: memset(real_filename, 0, sizeof(real_filename)); - strncat(real_filename, srctree, PATH_MAX); + strncat(real_filename, getenv("SRCTREE"), PATH_MAX); strncat(real_filename, KERNELDOCPATH KERNELDOC, PATH_MAX - strlen(real_filename)); execvp(real_filename, svec); @@ -174,7 +171,7 @@ void find_export_symbols(char * filename) if (filename_exist(filename) == NULL) { char real_filename[PATH_MAX + 1]; memset(real_filename, 0, sizeof(real_filename)); - strncat(real_filename, srctree, PATH_MAX); + strncat(real_filename, getenv("SRCTREE"), PATH_MAX); strncat(real_filename, filename, PATH_MAX - strlen(real_filename)); sym = add_new_file(filename); @@ -341,10 +338,6 @@ void parse_file(FILE *infile) int main(int argc, char *argv[]) { FILE * infile; - - srctree = getenv("SRCTREE"); - if (!srctree) - srctree = getcwd(NULL, 0); if (argc != 3) { usage(); exit(1); diff --git a/trunk/scripts/kconfig/Makefile b/trunk/scripts/kconfig/Makefile index 83c5e76414ce..bb08069b04af 100644 --- a/trunk/scripts/kconfig/Makefile +++ b/trunk/scripts/kconfig/Makefile @@ -84,7 +84,7 @@ help: # lxdialog stuff check-lxdialog := $(srctree)/$(src)/lxdialog/check-lxdialog.sh -# Use recursively expanded variables so we do not call gcc unless +# Use reursively expanded variables so we do not call gcc unless # we really need to do so. (Do not call gcc as part of make mrproper) HOST_EXTRACFLAGS = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ccflags) HOST_LOADLIBES = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags $(HOSTCC)) diff --git a/trunk/scripts/mod/modpost.c b/trunk/scripts/mod/modpost.c index 93ac52adb498..2ef9a193fcae 100644 --- a/trunk/scripts/mod/modpost.c +++ b/trunk/scripts/mod/modpost.c @@ -268,9 +268,6 @@ static struct symbol *sym_add_exported(const char *name, struct module *mod, "was in %s%s\n", mod->name, name, s->module->name, is_vmlinux(s->module->name) ?"":".ko"); - } else { - /* In case Modules.symvers was out of date */ - s->module = mod; } } s->preloaded = 0; diff --git a/trunk/scripts/package/builddeb b/trunk/scripts/package/builddeb index 0f657b5f3bc8..6edb29f2b4a6 100644 --- a/trunk/scripts/package/builddeb +++ b/trunk/scripts/package/builddeb @@ -83,7 +83,6 @@ Maintainer: $name Standards-Version: 3.6.1 Package: $packagename -Provides: kernel-image-$version, linux-image-$version Architecture: any Description: User Mode Linux kernel, version $version User-mode Linux is a port of the Linux kernel to its own system call @@ -105,7 +104,6 @@ Maintainer: $name Standards-Version: 3.6.1 Package: $packagename -Provides: kernel-image-$version, linux-image-$version Architecture: any Description: Linux kernel, version $version This package contains the Linux kernel, modules and corresponding other