Merge git://git.kernel.org/pub/scm/linux/kernel/git/bunk/trivial
authorLinus Torvalds <torvalds@woody.linux-foundation.org>
Sat, 20 Oct 2007 03:36:17 +0000 (20:36 -0700)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Sat, 20 Oct 2007 03:36:17 +0000 (20:36 -0700)
* git://git.kernel.org/pub/scm/linux/kernel/git/bunk/trivial: (74 commits)
  fix do_sys_open() prototype
  sysfs: trivial: fix sysfs_create_file kerneldoc spelling mistake
  Documentation: Fix typo in SubmitChecklist.
  Typo: depricated -> deprecated
  Add missing profile=kvm option to Documentation/kernel-parameters.txt
  fix typo about TBI in e1000 comment
  proc.txt: Add /proc/stat field
  small documentation fixes
  Fix compiler warning in smount example program from sharedsubtree.txt
  docs/sysfs: add missing word to sysfs attribute explanation
  documentation/ext3: grammar fixes
  Documentation/java.txt: typo and grammar fixes
  Documentation/filesystems/vfs.txt: typo fix
  include/asm-*/system.h: remove unused set_rmb(), set_wmb() macros
  trivial copy_data_pages() tidy up
  Fix typo in arch/x86/kernel/tsc_32.c
  file link fix for Pegasus USB net driver help
  remove unused return within void return function
  Typo fixes retrun -> return
  x86 hpet.h: remove broken links
  ...

256 files changed:
.gitignore
Documentation/device-mapper/dm-uevent.txt [new file with mode: 0644]
Documentation/kbuild/kconfig-language.txt
Documentation/kbuild/makefiles.txt
Documentation/kernel-parameters.txt
MAINTAINERS
Makefile
arch/i386/Kconfig
arch/i386/Makefile
arch/x86/ia32/ia32_binfmt.c
arch/x86/kernel/Makefile_32
arch/x86/kernel/Makefile_64
arch/x86/kernel/acpi/Makefile_32
arch/x86/kernel/acpi/boot.c
arch/x86/kernel/acpi/cstate.c
arch/x86/kernel/acpi/earlyquirk_32.c [deleted file]
arch/x86/kernel/acpi/processor.c
arch/x86/kernel/alternative.c
arch/x86/kernel/cpu/cpufreq/Kconfig_32 [moved from arch/x86/kernel/cpu/cpufreq/Kconfig with 100% similarity]
arch/x86/kernel/cpu/cpufreq/Kconfig_64 [moved from arch/x86/kernel/cpufreq/Kconfig with 97% similarity]
arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c
arch/x86/kernel/cpu/cpufreq/e_powersaver.c
arch/x86/kernel/cpu/cpufreq/elanfreq.c
arch/x86/kernel/cpu/cpufreq/longhaul.c
arch/x86/kernel/cpu/cpufreq/longrun.c
arch/x86/kernel/cpu/cpufreq/p4-clockmod.c
arch/x86/kernel/cpu/cpufreq/powernow-k6.c
arch/x86/kernel/cpu/cpufreq/powernow-k7.c
arch/x86/kernel/cpu/cpufreq/sc520_freq.c
arch/x86/kernel/cpu/cpufreq/speedstep-centrino.c
arch/x86/kernel/cpu/cpufreq/speedstep-lib.c
arch/x86/kernel/cpu/intel_cacheinfo.c
arch/x86/kernel/cpu/perfctr-watchdog.c
arch/x86/kernel/cpu/proc.c
arch/x86/kernel/cpuid.c
arch/x86/kernel/early-quirks.c [moved from arch/x86/kernel/early-quirks_64.c with 88% similarity]
arch/x86/kernel/genapic_64.c
arch/x86/kernel/genapic_flat_64.c
arch/x86/kernel/head64.c
arch/x86/kernel/hpet.c
arch/x86/kernel/i8259_32.c
arch/x86/kernel/init_task.c [moved from arch/x86/kernel/init_task_32.c with 79% similarity]
arch/x86/kernel/init_task_64.c [deleted file]
arch/x86/kernel/io_apic_32.c
arch/x86/kernel/mce_64.c
arch/x86/kernel/mce_amd_64.c
arch/x86/kernel/microcode.c
arch/x86/kernel/mpparse_64.c
arch/x86/kernel/msr.c
arch/x86/kernel/pci-dma_64.c
arch/x86/kernel/process_32.c
arch/x86/kernel/quirks.c
arch/x86/kernel/reboot_64.c
arch/x86/kernel/reboot_fixups_32.c
arch/x86/kernel/setup64.c
arch/x86/kernel/setup_32.c
arch/x86/kernel/setup_64.c
arch/x86/kernel/smp_32.c
arch/x86/kernel/smp_64.c
arch/x86/kernel/smpboot_32.c
arch/x86/kernel/smpboot_64.c
arch/x86/kernel/suspend_64.c
arch/x86/kernel/traps_32.c
arch/x86/kernel/traps_64.c
arch/x86/kernel/tsc_32.c
arch/x86/kernel/tsc_64.c
arch/x86/kernel/vsyscall_64.c
arch/x86/lib/delay_32.c
arch/x86/lib/delay_64.c
arch/x86/mach-voyager/voyager_smp.c
arch/x86/mm/fault_32.c
arch/x86/mm/fault_64.c
arch/x86/mm/numa_64.c
arch/x86/oprofile/backtrace.c
arch/x86_64/.gitignore [new file with mode: 0644]
arch/x86_64/Kconfig
arch/x86_64/Makefile
drivers/acpi/processor_core.c
drivers/ata/libata-core.c
drivers/ata/pata_cs5536.c
drivers/ata/sata_sis.c
drivers/hwmon/coretemp.c
drivers/hwmon/hwmon-vid.c
drivers/ide/Kconfig
drivers/ide/arm/bast-ide.c
drivers/ide/arm/icside.c
drivers/ide/arm/ide_arm.c
drivers/ide/arm/rapide.c
drivers/ide/cris/ide-cris.c
drivers/ide/h8300/ide-h8300.c
drivers/ide/ide-acpi.c
drivers/ide/ide-disk.c
drivers/ide/ide-dma.c
drivers/ide/ide-io.c
drivers/ide/ide-iops.c
drivers/ide/ide-pnp.c
drivers/ide/ide-probe.c
drivers/ide/ide-proc.c
drivers/ide/ide-tape.c
drivers/ide/ide-taskfile.c
drivers/ide/ide.c
drivers/ide/legacy/ali14xx.c
drivers/ide/legacy/buddha.c
drivers/ide/legacy/dtc2278.c
drivers/ide/legacy/falconide.c
drivers/ide/legacy/gayle.c
drivers/ide/legacy/ht6560b.c
drivers/ide/legacy/ide-cs.c
drivers/ide/legacy/ide_platform.c
drivers/ide/legacy/macide.c
drivers/ide/legacy/q40ide.c
drivers/ide/legacy/qd65xx.c
drivers/ide/legacy/umc8672.c
drivers/ide/mips/au1xxx-ide.c
drivers/ide/mips/swarm.c
drivers/ide/pci/aec62xx.c
drivers/ide/pci/alim15x3.c
drivers/ide/pci/amd74xx.c
drivers/ide/pci/atiixp.c
drivers/ide/pci/cmd640.c
drivers/ide/pci/cmd64x.c
drivers/ide/pci/cs5520.c
drivers/ide/pci/cs5530.c
drivers/ide/pci/cs5535.c
drivers/ide/pci/cy82c693.c
drivers/ide/pci/delkin_cb.c
drivers/ide/pci/generic.c
drivers/ide/pci/hpt34x.c
drivers/ide/pci/hpt366.c
drivers/ide/pci/it8213.c
drivers/ide/pci/it821x.c
drivers/ide/pci/jmicron.c
drivers/ide/pci/ns87415.c
drivers/ide/pci/opti621.c
drivers/ide/pci/pdc202xx_new.c
drivers/ide/pci/pdc202xx_old.c
drivers/ide/pci/piix.c
drivers/ide/pci/rz1000.c
drivers/ide/pci/sc1200.c
drivers/ide/pci/scc_pata.c
drivers/ide/pci/serverworks.c
drivers/ide/pci/sgiioc4.c
drivers/ide/pci/siimage.c
drivers/ide/pci/sis5513.c
drivers/ide/pci/sl82c105.c
drivers/ide/pci/slc90e66.c
drivers/ide/pci/tc86c001.c
drivers/ide/pci/triflex.c
drivers/ide/pci/trm290.c
drivers/ide/pci/via82cxxx.c
drivers/ide/ppc/mpc8xx.c
drivers/ide/ppc/pmac.c
drivers/ide/setup-pci.c
drivers/input/gameport/gameport.c
drivers/macintosh/mediabay.c
drivers/md/Kconfig
drivers/md/Makefile
drivers/md/dm-bio-list.h
drivers/md/dm-crypt.c
drivers/md/dm-delay.c
drivers/md/dm-emc.c
drivers/md/dm-hw-handler.c
drivers/md/dm-hw-handler.h
drivers/md/dm-ioctl.c
drivers/md/dm-log.c
drivers/md/dm-log.h
drivers/md/dm-mpath-hp-sw.c [new file with mode: 0644]
drivers/md/dm-mpath-rdac.c
drivers/md/dm-mpath.c
drivers/md/dm-path-selector.c
drivers/md/dm-raid1.c
drivers/md/dm-snap.c
drivers/md/dm-stripe.c
drivers/md/dm-table.c
drivers/md/dm-target.c
drivers/md/dm-uevent.c [new file with mode: 0644]
drivers/md/dm-uevent.h [new file with mode: 0644]
drivers/md/dm.c
drivers/md/kcopyd.c
drivers/net/Kconfig
drivers/net/dm9000.c
drivers/net/phy/mdio-bitbang.c
drivers/net/tsi108_eth.c
drivers/net/tulip/Kconfig
drivers/net/wireless/b43/main.c
drivers/net/wireless/b43legacy/main.c
drivers/net/wireless/ipw2100.c
drivers/net/wireless/ipw2100.h
drivers/net/wireless/iwlwifi/iwl-3945-rs.c
drivers/net/wireless/iwlwifi/iwl-3945.c
drivers/net/wireless/iwlwifi/iwl-4965-rs.c
drivers/net/wireless/iwlwifi/iwl-4965.c
drivers/net/wireless/iwlwifi/iwl3945-base.c
drivers/net/wireless/iwlwifi/iwl4965-base.c
drivers/net/wireless/iwlwifi/iwlwifi.h
drivers/net/wireless/p54common.c
drivers/net/wireless/rt2x00/rt2x00dev.c
drivers/net/wireless/rt2x00/rt73usb.c
drivers/net/wireless/rtl8187_dev.c
drivers/net/wireless/zd1201.c
drivers/net/wireless/zd1211rw/zd_usb.c
drivers/s390/net/qeth_main.c
drivers/video/geode/video_gx.c
fs/nfs/delegation.c
fs/nfs/dir.c
fs/nfs/file.c
fs/nfs/inode.c
fs/nfs/nfs4_fs.h
fs/nfs/nfs4proc.c
fs/nfs/nfs4state.c
fs/nfs/unlink.c
fs/nfs/write.c
include/asm-alpha/ide.h
include/asm-arm/ide.h
include/asm-blackfin/ide.h
include/asm-cris/arch-v32/ide.h
include/asm-ia64/ide.h
include/asm-m32r/ide.h
include/asm-m68k/ide.h
include/asm-mips/mach-generic/ide.h
include/asm-parisc/ide.h
include/asm-powerpc/ide.h
include/asm-sh64/ide.h
include/asm-sparc/ide.h
include/asm-sparc64/ide.h
include/asm-x86/acpi_32.h
include/asm-x86/compat.h
include/asm-x86/desc_64.h
include/asm-x86/geode.h
include/asm-x86/hpet.h
include/asm-x86/ide.h
include/asm-x86/io_apic_64.h
include/asm-x86/ipi.h
include/asm-x86/irq_32.h
include/asm-x86/msr-index.h
include/asm-x86/processor_32.h
include/asm-x86/processor_64.h
include/asm-x86/proto.h
include/asm-x86/ptrace_32.h
include/asm-x86/ptrace_64.h
include/asm-x86/smp_32.h
include/asm-x86/smp_64.h
include/asm-x86/system_32.h
include/asm-x86/topology_32.h
include/asm-x86/topology_64.h
include/linux/device-mapper.h
include/linux/dm-ioctl.h
include/linux/ide.h
include/linux/nfs_fs.h
include/linux/prefetch.h
kernel/Makefile
scripts/Kbuild.include
scripts/basic/docproc.c
scripts/kconfig/Makefile
scripts/mod/modpost.c
scripts/package/builddeb

index 22fb8fa9bc3d283c829a7d7ce6da13a6db59262e..8d14531846b95bfa3564b58ccfb7913a034323b8 100644 (file)
@@ -12,6 +12,7 @@
 *.s
 *.ko
 *.so
+*.so.dbg
 *.mod.c
 *.i
 *.lst
diff --git a/Documentation/device-mapper/dm-uevent.txt b/Documentation/device-mapper/dm-uevent.txt
new file mode 100644 (file)
index 0000000..07edbd8
--- /dev/null
@@ -0,0 +1,97 @@
+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
index fe8b0c4892cf14e6f39e255ac368f150c41647c8..616043a6da99a0afd945e3cb5acb93b26bbb3f17 100644 (file)
@@ -77,7 +77,12 @@ applicable everywhere (see syntax).
   Optionally, dependencies only for this default value can be added with
   "if".
 
-- dependencies: "depends on"/"requires" <expr>
+- type definition + default value:
+       "def_bool"/"def_tristate" <expr> ["if" <expr>]
+  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" <expr>
   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
@@ -289,3 +294,10 @@ source:
        "source" <prompt>
 
 This reads the specified configuration file. This file is always parsed.
+
+mainmenu:
+
+       "mainmenu" <prompt>
+
+This sets the config program's title bar if the config program chooses
+to use it.
index f099b814d383c49d44667954fe9e625c90c9a6e4..6166e2d7da76244d628da0543a25ae36f97da4da 100644 (file)
@@ -518,6 +518,28 @@ 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
index 929734386fd945f90ae81dd82f97908f851bd05e..6accd360da735cce8f9e9adecf0e5938d2e8e590 100644 (file)
@@ -419,8 +419,10 @@ 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 disable HPET and use PIT.
-                       Format: disable
+       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)
 
        com20020=       [HW,NET] ARCnet - COM20020 chipset
                        Format:
index 2534dc4aa95a58cfe8b6d617f1ec424ac74a7d5f..4ed41394e492423220afc320856913f4cc45aba1 100644 (file)
@@ -2178,7 +2178,7 @@ S:        Maintained
 KCONFIG
 P:     Roman Zippel
 M:     zippel@linux-m68k.org
-L:     kbuild-devel@lists.sourceforge.net
+L:     linux-kbuild@vger.kernel.org
 S:     Maintained
 
 KDUMP
@@ -2207,6 +2207,7 @@ 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
index 68ef80b30340371e13ff8e38777d0bf9d715dc33..f9c264e243a2a01e78cd85d209b8cdae8102a6ab 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -887,10 +887,7 @@ prepare2: prepare3 outputmakefile
 
 prepare1: prepare2 include/linux/version.h include/linux/utsrelease.h \
                    include/asm include/config/auto.conf
-ifneq ($(KBUILD_MODULES),)
-       $(Q)mkdir -p $(MODVERDIR)
-       $(Q)rm -f $(MODVERDIR)/*
-endif
+       $(cmd_crmodverdir)
 
 archprepare: prepare1 scripts_basic
 
@@ -906,14 +903,24 @@ prepare: prepare0
 
 export CPPFLAGS_vmlinux.lds += -P -C -U$(ARCH)
 
-# 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) $@
+# 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
 
 # Generate some files
 # ---------------------------------------------------------------------------
@@ -1023,19 +1030,12 @@ _modinst_:
        fi
        $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst
 
-# 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
+# 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_
-       if [ -r System.map -a -x $(DEPMOD) ]; then $(DEPMOD) -ae -F System.map $(depmod_opts) $(KERNELRELEASE); fi
+       $(call cmd,depmod)
 
 else # CONFIG_MODULES
 
@@ -1223,8 +1223,7 @@ else # KBUILD_EXTMOD
 KBUILD_MODULES := 1
 PHONY += crmodverdir
 crmodverdir:
-       $(Q)mkdir -p $(MODVERDIR)
-       $(Q)rm -f $(MODVERDIR)/*
+       $(cmd_crmodverdir)
 
 PHONY += $(objtree)/Module.symvers
 $(objtree)/Module.symvers:
@@ -1252,15 +1251,6 @@ _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)
@@ -1344,7 +1334,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 \) -prune -o \
+              \( -name include -o -name arch -o -name '.tmp_*' \) -prune -o \
               -name $1 -print; \
          )
 endef
@@ -1493,9 +1483,11 @@ 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
@@ -1509,6 +1501,19 @@ 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) \
index 7627e9bd8b44ff811bf768320b0117718f867159..f6e44fc5283c4d1684f9ee3eac98ed373f92f7a4 100644 (file)
@@ -1080,7 +1080,7 @@ config APM_REAL_MODE_POWER_OFF
 
 endif # APM
 
-source "arch/x86/kernel/cpu/cpufreq/Kconfig"
+source "arch/x86/kernel/cpu/cpufreq/Kconfig_32"
 
 source "drivers/cpuidle/Kconfig"
 
index f036d2dee3def4508411ebb9401e06e433039303..b88e47ca3032e8efc7f10dddebc3d12eb87e5f84 100644 (file)
@@ -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_32.o
+head-y := arch/x86/kernel/head_32.o arch/x86/kernel/init_task.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)mkdir -p $(objtree)/arch/i386/boot
-       $(Q)ln -fsn $(objtree)/arch/x86/boot/bzImage $(objtree)/arch/i386/boot/bzImage
        $(Q)$(MAKE) $(build)=$(boot) $(KBUILD_IMAGE)
+       $(Q)mkdir -p $(objtree)/arch/i386/boot
+       $(Q)ln -fsn ../../x86/boot/bzImage $(objtree)/arch/i386/boot/bzImage
 
 compressed: zImage
 
index 5027650eb273158ea70b6b9a3a8ccd04eddf085c..55822d2cf05319acdf7464acdfd3e37271279b4b 100644 (file)
@@ -5,10 +5,6 @@
  * 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 <linux/types.h>
 #include <linux/stddef.h>
@@ -19,6 +15,7 @@
 #include <linux/binfmts.h>
 #include <linux/mm.h>
 #include <linux/security.h>
+#include <linux/elfcore-compat.h>
 
 #include <asm/segment.h> 
 #include <asm/ptrace.h>
 #include <asm/ia32.h>
 #include <asm/vsyscall32.h>
 
+#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
@@ -48,74 +59,20 @@ int sysctl_vsyscall32 = 1;
 } while(0)
 
 struct file;
-struct elf_phdr; 
 
 #define IA32_EMULATOR 1
 
-#define ELF_ET_DYN_BASE                (TASK_UNMAPPED_BASE + 0x1000000)
-
-#undef ELF_ARCH
-#define ELF_ARCH EM_386
-
-#define ELF_DATA       ELFDATA2LSB
+#undef ELF_ET_DYN_BASE
 
-#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 ELF_ET_DYN_BASE                (TASK_UNMAPPED_BASE + 0x1000000)
 
 #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;                          \
@@ -135,36 +92,41 @@ struct elf_prpsinfo
        pr_reg[15] = regs->rsp;                         \
        pr_reg[16] = regs->ss;
 
-#define user user32
+
+#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
 
 #undef elf_read_implies_exec
 #define elf_read_implies_exec(ex, executable_stack)     (executable_stack != EXSTACK_DISABLE_X)
-//#include <asm/ia32.h>
-#include <linux/elf.h>
-
-typedef struct user_i387_ia32_struct elf_fpregset_t;
-typedef struct user32_fxsr_struct elf_fpxregset_t;
-
 
-static inline void elf_core_copy_regs(elf_gregset_t *elfregs, struct pt_regs *regs)
+#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)
 {
-       ELF_CORE_COPY_REGS((*elfregs), regs)
+       ELF_CORE_COPY_REGS((&elfregs->ebx), regs)
 }
 
-static inline int elf_core_copy_task_regs(struct task_struct *t, elf_gregset_t* elfregs)
+#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)
 {      
        struct pt_regs *pp = task_pt_regs(t);
-       ELF_CORE_COPY_REGS((*elfregs), pp);
+       ELF_CORE_COPY_REGS((&elfregs->ebx), pp);
        /* fix wrong segments */ 
-       (*elfregs)[7] = t->thread.ds; 
-       (*elfregs)[9] = t->thread.fsindex; 
-       (*elfregs)[10] = t->thread.gsindex; 
-       (*elfregs)[8] = t->thread.es;   
+       elfregs->ds = t->thread.ds;
+       elfregs->fs = t->thread.fsindex;
+       elfregs->gs = t->thread.gsindex;
+       elfregs->es = t->thread.es;
        return 1; 
 }
 
+#define elf_core_copy_task_fpregs      elf32_core_copy_task_fpregs
 static inline int 
-elf_core_copy_task_fpregs(struct task_struct *tsk, struct pt_regs *regs, elf_fpregset_t *fpu)
+elf32_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();
@@ -186,8 +148,9 @@ elf_core_copy_task_fpregs(struct task_struct *tsk, struct pt_regs *regs, elf_fpr
 
 #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 
-elf_core_copy_task_xfpregs(struct task_struct *t, elf_fpxregset_t *xfpu)
+elf32_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))
@@ -206,6 +169,10 @@ elf_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")
@@ -231,6 +198,7 @@ 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
index a3fa11f8f4609f6744cba78d95cd829dd617a4ea..ccea590bbb920e914358a77083ec8a7f3cdd423c 100644 (file)
@@ -2,7 +2,7 @@
 # Makefile for the linux kernel.
 #
 
-extra-y := head_32.o init_task_32.o vmlinux.lds
+extra-y := head_32.o init_task.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,6 +17,7 @@ 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
index 43da66213a479117a91c05f62e4b67447d412205..dec06e769281b18751d5518e9528b84646101ec9 100644 (file)
@@ -2,7 +2,7 @@
 # Makefile for the linux kernel.
 #
 
-extra-y        := head_64.o head64.o init_task_64.o vmlinux.lds
+extra-y        := head_64.o head64.o init_task.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_64.o
+obj-$(CONFIG_PCI)              += early-quirks.o
 
 obj-y                          += topology.o
 obj-y                          += intel_cacheinfo.o
index a4852a2e9190c147f1faa66ac3ba271e9f3a8a6c..045dd54b33e052498a3f6a2ab7445156cff1d704 100644 (file)
@@ -1,7 +1,4 @@
 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),)
index 25337f2b7399710b27daa28832c94cc2e9adb83e..289247d974c60fe77ed4b989a2a2634734392ab9 100644 (file)
@@ -555,7 +555,7 @@ EXPORT_SYMBOL(acpi_map_lsapic);
 
 int acpi_unmap_lsapic(int cpu)
 {
-       x86_cpu_to_apicid[cpu] = -1;
+       per_cpu(x86_cpu_to_apicid, cpu) = -1;
        cpu_clear(cpu, cpu_present_map);
        num_processors--;
 
index 2d39f55d29a88ca36283d2f87206cd646649e521..10b67170b133eccc3ed2dff7fef44e95a44e76ad 100644 (file)
@@ -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/arch/x86/kernel/acpi/earlyquirk_32.c b/arch/x86/kernel/acpi/earlyquirk_32.c
deleted file mode 100644 (file)
index 23f78ef..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-/* 
- * Do early PCI probing for bug detection when the main PCI subsystem is 
- * not up yet.
- */
-#include <linux/init.h>
-#include <linux/kernel.h>
-#include <linux/pci.h>
-#include <linux/acpi.h>
-
-#include <asm/pci-direct.h>
-#include <asm/acpi.h>
-#include <asm/apic.h>
-
-#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;
-                       }
-
-               }
-       }
-}
index b54fded49834ade14daa22ce53418fc501c5653f..2ed0a4ce62f02ebc77750fe11adec66e7e6f9f8e 100644 (file)
@@ -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)
index 3bd2688bd4432a9cab554d6c665e1ceb64e9d410..d6405e0842b55d35835a9ffa203c6b22ea41c189 100644 (file)
@@ -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);
                }
similarity index 97%
rename from arch/x86/kernel/cpufreq/Kconfig
rename to arch/x86/kernel/cpu/cpufreq/Kconfig_64
index a3fd51926cbd0fe0c59185f8a94764505a961560..9c9699fdcf52b896fe0b5667d55484ea838a9b0d 100644 (file)
@@ -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 <file:Documentation/cpu-freq/>. 
+         For details, take a look at <file:Documentation/cpu-freq/>.
 
          If in doubt, say N.
 
index 2ca43ba32bc0ea50e99c4f872dfac269bde7ee8f..fea0af0476b96371f4c71fabcb463ab65d74fc89 100644 (file)
@@ -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");
index c11baaf9f2b403f6624e1fa0d4fd5756491d8383..326a4c81f68493cd8802ce13093689858577ad63 100644 (file)
@@ -305,7 +305,7 @@ static struct cpufreq_driver eps_driver = {
 
 static int __init eps_init(void)
 {
-       struct cpuinfo_x86 *c = cpu_data;
+       struct cpuinfo_x86 *c = &cpu_data(0);
 
        /* This driver will work only on Centaur C7 processors with
         * Enhanced SpeedStep/PowerSaver registers */
index 1e7ae7dafcf6a50921d1271347e2f522ad13ad2b..94619c22f56326a555fa47114bf2df365634343a 100644 (file)
@@ -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;
+       struct cpuinfo_x86 *c = &cpu_data(0);
        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;
+       struct cpuinfo_x86 *c = &cpu_data(0);
 
        /* Test if we have the right hardware */
        if ((c->x86_vendor != X86_VENDOR_AMD) ||
index 5045f5d583c81954fa7123df8697188a39012583..749d00cb2ebdde52ae67719ecc4514191b6c20fe 100644 (file)
@@ -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;
+       struct cpuinfo_x86 *c = &cpu_data(0);
        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;
+       struct cpuinfo_x86 *c = &cpu_data(0);
 
        if (c->x86_vendor != X86_VENDOR_CENTAUR || c->x86 != 6)
                return -ENODEV;
index b2689514295ab361057623dd7c2afb56d7deb81e..af4a867a097cdcc5f8296eca454199e39a56e675 100644 (file)
@@ -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;
+       struct cpuinfo_x86 *c = &cpu_data(0);
 
        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;
+       struct cpuinfo_x86 *c = &cpu_data(0);
 
        if (c->x86_vendor != X86_VENDOR_TRANSMETA ||
            !cpu_has(c, X86_FEATURE_LONGRUN))
index 793eae854f4f779e26ba95404a054c94349cc395..14791ec55cfd16798eb0366cb908b31d0dedf1e7 100644 (file)
@@ -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;
+       struct cpuinfo_x86 *c = &cpu_data(0);
        int ret;
 
        /*
index a07f6d84033a9090e7552d9e8cfc49f839445040..eb9b62b0830c8941ee7ea990304596e2a1d82316 100644 (file)
@@ -215,7 +215,7 @@ static struct cpufreq_driver powernow_k6_driver = {
  */
 static int __init powernow_k6_init(void)
 {
-       struct cpuinfo_x86      *c = cpu_data;
+       struct cpuinfo_x86 *c = &cpu_data(0);
 
        if ((c->x86_vendor != X86_VENDOR_AMD) || (c->x86 != 5) ||
                ((c->x86_model != 12) && (c->x86_model != 13)))
index f3686a5f2308ab0d9832fad24df58fb7bb4b07e9..b5a9863d6cdc336ce7b13f5c9d797944b179cbc6 100644 (file)
@@ -114,7 +114,7 @@ static int check_fsb(unsigned int fsbspeed)
 
 static int check_powernow(void)
 {
-       struct cpuinfo_x86 *c = cpu_data;
+       struct cpuinfo_x86 *c = &cpu_data(0);
        unsigned int maxei, eax, ebx, ecx, edx;
 
        if ((c->x86_vendor != X86_VENDOR_AMD) || (c->x86 !=6)) {
index d9f3e90a7ae080c9ba1e316c56ccb3afe6022231..42da9bd677d6ee91ed3cb41f2b09c62d3bf5b26b 100644 (file)
@@ -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;
+       struct cpuinfo_x86 *c = &cpu_data(0);
        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;
+       struct cpuinfo_x86 *c = &cpu_data(0);
        int err;
 
        /* Test if we have the right hardware */
index 811d47438546974e41651794cecf380a26e53c33..3031f119619212d40946ee2d0b297bf8a43bc576 100644 (file)
@@ -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;
+       struct cpuinfo_x86 *cpu = &cpu_data(0);
 
        if (!cpu_has(cpu, X86_FEATURE_EST))
                return -ENODEV;
index b1acc8ce3167c8f02d0747f7282fc8b685e1d94a..76c3ab0da468db354af1d55da7f5b5af39fdca50 100644 (file)
@@ -228,7 +228,7 @@ EXPORT_SYMBOL_GPL(speedstep_get_processor_frequency);
 
 unsigned int speedstep_detect_processor (void)
 {
-       struct cpuinfo_x86 *c = cpu_data;
+       struct cpuinfo_x86 *c = &cpu_data(0);
        u32 ebx, msr_lo, msr_hi;
 
        dprintk("x86: %x, model: %x\n", c->x86, c->x86_model);
index 297a24116949152324e3cb8edd8f91e2a2a310ba..9921b01fe19907bd9fb22dc9ca00d3d61e9c4381 100644 (file)
@@ -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 == &boot_cpu_data) ? 0 : (c - cpu_data);
+       unsigned int cpu = c->cpu_index;
 #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
-               cpu_llc_id[cpu] = l2_id;
+               per_cpu(cpu_llc_id, cpu) = l2_id;
 #endif
        }
 
        if (new_l3) {
                l3 = new_l3;
 #ifdef CONFIG_X86_HT
-               cpu_llc_id[cpu] = l3_id;
+               per_cpu(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;
+       struct cpuinfo_x86 *c = &cpu_data(cpu);
 
        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 (c[i].apicid >> index_msb ==
-                           c[cpu].apicid >> index_msb) {
+                       if (cpu_data(i).apicid >> index_msb ==
+                           c->apicid >> index_msb) {
                                cpu_set(i, this_leaf->shared_cpu_map);
                                if (i != cpu && cpuid4_info[i])  {
                                        sibling_leaf = CPUID4_INFO_IDX(i, index);
index 54cdbf1a40f1a054bb5d9affc0c9c77fb913482b..c02541e6e653f72ae1856df090b0719041cd2664 100644 (file)
@@ -120,7 +120,9 @@ int reserve_perfctr_nmi(unsigned int msr)
        unsigned int counter;
 
        counter = nmi_perfctr_msr_to_bit(msr);
-       BUG_ON(counter > NMI_MAX_COUNTER_BITS);
+       /* register not managed by the allocator? */
+       if (counter > NMI_MAX_COUNTER_BITS)
+               return 1;
 
        if (!test_and_set_bit(counter, perfctr_nmi_owner))
                return 1;
@@ -132,7 +134,9 @@ void release_perfctr_nmi(unsigned int msr)
        unsigned int counter;
 
        counter = nmi_perfctr_msr_to_bit(msr);
-       BUG_ON(counter > NMI_MAX_COUNTER_BITS);
+       /* register not managed by the allocator? */
+       if (counter > NMI_MAX_COUNTER_BITS)
+               return;
 
        clear_bit(counter, perfctr_nmi_owner);
 }
@@ -142,7 +146,9 @@ int reserve_evntsel_nmi(unsigned int msr)
        unsigned int counter;
 
        counter = nmi_evntsel_msr_to_bit(msr);
-       BUG_ON(counter > NMI_MAX_COUNTER_BITS);
+       /* register not managed by the allocator? */
+       if (counter > NMI_MAX_COUNTER_BITS)
+               return 1;
 
        if (!test_and_set_bit(counter, evntsel_nmi_owner))
                return 1;
@@ -154,7 +160,9 @@ void release_evntsel_nmi(unsigned int msr)
        unsigned int counter;
 
        counter = nmi_evntsel_msr_to_bit(msr);
-       BUG_ON(counter > NMI_MAX_COUNTER_BITS);
+       /* register not managed by the allocator? */
+       if (counter > NMI_MAX_COUNTER_BITS)
+               return;
 
        clear_bit(counter, evntsel_nmi_owner);
 }
index 879a0f789b1e223026ec820c873cca43a70dec89..2d42b414b7779b37604d9c564f044642c8cb0832 100644 (file)
@@ -85,12 +85,13 @@ static int show_cpuinfo(struct seq_file *m, void *v)
                /* nothing */
        };
        struct cpuinfo_x86 *c = v;
-       int i, n = c - cpu_data;
+       int i, n = 0;
        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"
@@ -175,11 +176,15 @@ static int show_cpuinfo(struct seq_file *m, void *v)
 
 static void *c_start(struct seq_file *m, loff_t *pos)
 {
-       return *pos < NR_CPUS ? cpu_data + *pos : NULL;
+       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;
 }
 static void *c_next(struct seq_file *m, void *v, loff_t *pos)
 {
-       ++*pos;
+       *pos = next_cpu(*pos, cpu_possible_map);
        return c_start(m, pos);
 }
 static void c_stop(struct seq_file *m, void *v)
index 70dcf912d9fb3076e1116a438a3dcde699205ab9..05c9936a16ccc50c015dae4c3af81552d4564fa7 100644 (file)
@@ -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,15 +134,18 @@ static const struct file_operations cpuid_fops = {
        .open = cpuid_open,
 };
 
-static int __cpuinit cpuid_device_create(int i)
+static __cpuinit int cpuid_device_create(int cpu)
 {
-       int err = 0;
        struct device *dev;
 
-       dev = device_create(cpuid_class, NULL, MKDEV(CPUID_MAJOR, i), "cpu%d",i);
-       if (IS_ERR(dev))
-               err = PTR_ERR(dev);
-       return err;
+       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));
 }
 
 static int __cpuinit cpuid_class_cpu_callback(struct notifier_block *nfb,
@@ -150,18 +153,21 @@ 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_ONLINE:
-       case CPU_ONLINE_FROZEN:
-               cpuid_device_create(cpu);
+       case CPU_UP_PREPARE:
+       case CPU_UP_PREPARE_FROZEN:
+               err = cpuid_device_create(cpu);
                break;
+       case CPU_UP_CANCELED:
+       case CPU_UP_CANCELED_FROZEN:
        case CPU_DEAD:
        case CPU_DEAD_FROZEN:
-               device_destroy(cpuid_class, MKDEV(CPUID_MAJOR, cpu));
+               cpuid_device_destroy(cpu);
                break;
        }
-       return NOTIFY_OK;
+       return err ? NOTIFY_BAD : NOTIFY_OK;
 }
 
 static struct notifier_block __cpuinitdata cpuid_class_cpu_notifier =
@@ -198,7 +204,7 @@ static int __init cpuid_init(void)
 out_class:
        i = 0;
        for_each_online_cpu(i) {
-               device_destroy(cpuid_class, MKDEV(CPUID_MAJOR, i));
+               cpuid_device_destroy(i);
        }
        class_destroy(cpuid_class);
 out_chrdev:
@@ -212,7 +218,7 @@ static void __exit cpuid_exit(void)
        int cpu = 0;
 
        for_each_online_cpu(cpu)
-               device_destroy(cpuid_class, MKDEV(CPUID_MAJOR, cpu));
+               cpuid_device_destroy(cpu);
        class_destroy(cpuid_class);
        unregister_chrdev(CPUID_MAJOR, "cpu/cpuid");
        unregister_hotcpu_notifier(&cpuid_class_cpu_notifier);
similarity index 88%
rename from arch/x86/kernel/early-quirks_64.c
rename to arch/x86/kernel/early-quirks.c
index 13aa4fd728f3dc7543ad49a37f825852a9a8ef00..dc34acbd54aafd1710808e422eea853edaba1531 100644 (file)
 #include <linux/acpi.h>
 #include <linux/pci_ids.h>
 #include <asm/pci-direct.h>
-#include <asm/proto.h>
-#include <asm/iommu.h>
 #include <asm/dma.h>
+#include <asm/io_apic.h>
+#include <asm/apic.h>
+
+#ifdef CONFIG_IOMMU
+#include <asm/iommu.h>
+#endif
 
 static void __init via_bugs(void)
 {
@@ -23,7 +27,8 @@ 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
@@ -40,6 +45,7 @@ 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.
@@ -58,6 +64,7 @@ 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? */
 
@@ -65,11 +72,13 @@ 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 {
@@ -104,7 +113,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,
index 4ae03e3e829441a27ed27decdd8905acf9b18411..ce703e21c91212485ccf04fdae476e806e755ac4 100644 (file)
 #include <acpi/acpi_bus.h>
 #endif
 
-/* which logical CPU number maps to which CPU (physical APIC ID) */
-u8 x86_cpu_to_apicid[NR_CPUS] __read_mostly
+/*
+ * 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
                                        = { [0 ... NR_CPUS-1] = BAD_APICID };
-EXPORT_SYMBOL(x86_cpu_to_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);
 
 struct genapic __read_mostly *genapic = &apic_flat;
 
index 91c7526768ee8e0f934c7c7e7d8c1b987ad46112..07352b74bda6dfaac343ef5caa5674c6fde77a9e 100644 (file)
@@ -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 x86_cpu_to_apicid[cpu];
+               return per_cpu(x86_cpu_to_apicid, cpu);
        else
                return BAD_APICID;
 }
index a7eee0a4751d6b42568aac385c8c9625fa4e3741..6b3469311e42736a630d9d95d907c8230277ee51 100644 (file)
@@ -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);
-       asm volatile("lidt %0" :: "m" (idt_descr));
+       load_idt((const struct desc_ptr *)&idt_descr);
 
        early_printk("Kernel alive\n");
 
index 772afab8f1960a9356ad8d8b383bf0c6c6e53bc9..53303f2e547582e282f5a941cc2311b79a821238 100644 (file)
@@ -69,12 +69,15 @@ 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;
 }
index d34a10cc13a7dbe4eba3b456ed5eeca83e7be526..f634fc715c99b455d3973645d4d16c3a80e13361 100644 (file)
@@ -403,7 +403,8 @@ void __init native_init_IRQ(void)
                int vector = FIRST_EXTERNAL_VECTOR + i;
                if (i >= NR_IRQS)
                        break;
-               if (vector != SYSCALL_VECTOR) 
+               /* SYSCALL_VECTOR was reserved in trap_init. */
+               if (!test_bit(vector, used_vectors))
                        set_intr_gate(vector, interrupt[i]);
        }
 
similarity index 79%
rename from arch/x86/kernel/init_task_32.c
rename to arch/x86/kernel/init_task.c
index d26fc063a760c508dd0060b784a6d070ff0bf4dc..468c9c43784261823bbd018550d113c4a49df777 100644 (file)
@@ -15,7 +15,6 @@ 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);
 
 /*
@@ -25,7 +24,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) };
 
@@ -35,12 +34,14 @@ 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.
- */ 
+ * 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;
 
diff --git a/arch/x86/kernel/init_task_64.c b/arch/x86/kernel/init_task_64.c
deleted file mode 100644 (file)
index 4ff33d4..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-#include <linux/mm.h>
-#include <linux/module.h>
-#include <linux/sched.h>
-#include <linux/init.h>
-#include <linux/init_task.h>
-#include <linux/fs.h>
-#include <linux/mqueue.h>
-
-#include <asm/uaccess.h>
-#include <asm/pgtable.h>
-#include <asm/desc.h>
-
-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")))
index 03e88fc00e5a97a74e77d7f81c851e611eecef22..f35c6eb33da9b7a5e0caa1dee4f0e075121349af 100644 (file)
@@ -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, i;
+       int vector, offset;
 
        BUG_ON((unsigned)irq >= NR_IRQ_VECTORS);
 
@@ -1215,11 +1215,8 @@ next:
        }
        if (vector == current_vector)
                return -ENOSPC;
-       if (vector == SYSCALL_VECTOR)
+       if (test_and_set_bit(vector, used_vectors))
                goto next;
-       for (i = 0; i < NR_IRQ_VECTORS; i++)
-               if (irq_vector[i] == vector)
-                       goto next;
 
        current_vector = vector;
        current_offset = offset;
@@ -2295,6 +2292,12 @@ 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)
index 82c85bdff3a18564f0a478dec43b262faff2e2fc..07bbfe7aa7f70efa86fceb4adb87139296efad5c 100644 (file)
@@ -799,7 +799,8 @@ 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));
index 0d2afd96aca40b7ff5a458f1890b9422ba32873e..752fb16a817d7187ac1732e66c426a12a19ff352 100644 (file)
@@ -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 */
index 09cf78110358fadc78bbc704349b8283737f5f90..09c315214a5ec87fdddd00f039255d69f3c01b9a 100644 (file)
@@ -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];
index 8bf0ca03ac8e8a78f13ca5ea86842e02cfca9be0..ef4aab123581a54ac17019d4441138a90b36b980 100644 (file)
@@ -57,6 +57,8 @@ 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;
 
@@ -86,7 +88,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;
@@ -123,7 +125,18 @@ static void __cpuinit MP_processor_info (struct mpc_config_processor *m)
                cpu = 0;
        }
        bios_cpu_apicid[cpu] = m->mpc_apicid;
-       x86_cpu_to_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;
+       }
 
        cpu_set(cpu, cpu_possible_map);
        cpu_set(cpu, cpu_present_map);
index e18e516cf5491bf875d5fbe6a3ef42fc10e39fef..ee6eba4ecfeaadee33e8875be5a4f3b1ccd253d0 100644 (file)
@@ -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 */
index b2b42bdb0a150c8f1d74f6630d1f9dc0be3569a2..afaf9f12c03290c24b2fd781233b464aa26343f5 100644 (file)
@@ -11,7 +11,7 @@
 #include <asm/iommu.h>
 #include <asm/calgary.h>
 
-int iommu_merge __read_mostly = 0;
+int iommu_merge __read_mostly = 1;
 EXPORT_SYMBOL(iommu_merge);
 
 dma_addr_t bad_dma_address __read_mostly;
index 044a47745a5cfe5eee6999297da3582e18681dc2..7b899584d290833cdbfed7dee779e20043a91ddb 100644 (file)
@@ -295,34 +295,52 @@ static int __init idle_setup(char *str)
 }
 early_param("idle", idle_setup);
 
-void show_regs(struct pt_regs * regs)
+void __show_registers(struct pt_regs *regs, int all)
 {
        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) (&regs->esp);
+               savesegment(ss, ss);
+               savesegment(gs, gs);
+       }
 
        printk("\n");
-       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());
+       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());
        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",
-               regs->esi, regs->edi, regs->ebp);
-       printk(" DS: %04x ES: %04x FS: %04x\n",
-              0xffff & regs->xds,0xffff & regs->xes, 0xffff & regs->xfs);
+               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;
 
        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);
@@ -330,10 +348,16 @@ void show_regs(struct pt_regs * regs)
        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, &regs->esp);
 }
 
index d769e204f942904b389daba44417cd9c97f61dc1..a4ce1911efdf948691b8ae2afef62ed878033bfa 100644 (file)
@@ -45,9 +45,12 @@ 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)
@@ -56,7 +59,8 @@ unsigned long force_hpet_address;
 static enum {
        NONE_FORCE_HPET_RESUME,
        OLD_ICH_FORCE_HPET_RESUME,
-       ICH_FORCE_HPET_RESUME
+       ICH_FORCE_HPET_RESUME,
+       VT8237_FORCE_HPET_RESUME
 } force_hpet_resume_type;
 
 static void __iomem *rcba_base;
@@ -146,17 +150,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;
@@ -232,10 +236,91 @@ 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);
+                        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);
+
 
 void force_hpet_resume(void)
 {
@@ -246,6 +331,9 @@ 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;
        }
index 368db2b9c5ac3977b0ec32edabe2aec9359df6de..776eb06b6512dcf61e0a0d85daa23992870ac7e2 100644 (file)
@@ -11,6 +11,7 @@
 #include <linux/sched.h>
 #include <asm/io.h>
 #include <asm/delay.h>
+#include <asm/desc.h>
 #include <asm/hw_irq.h>
 #include <asm/system.h>
 #include <asm/pgtable.h>
@@ -136,7 +137,7 @@ void machine_emergency_restart(void)
                }
 
                case BOOT_TRIPLE: 
-                       __asm__ __volatile__("lidt (%0)": :"r" (&no_idt));
+                       load_idt((const struct desc_ptr *)&no_idt);
                        __asm__ __volatile__("int3");
 
                        reboot_type = BOOT_KBD;
index 8b30b26ad0698161276c2b87c4c64594887aa4ad..1a07bbea7be36eadcea68843d7b727eaa03ee9a4 100644 (file)
@@ -12,6 +12,7 @@
 #include <linux/interrupt.h>
 #include <asm/reboot_fixups.h>
 #include <asm/msr.h>
+#include <asm/geode.h>
 
 static void cs5530a_warm_reset(struct pci_dev *dev)
 {
@@ -24,11 +25,8 @@ static void cs5530a_warm_reset(struct pci_dev *dev)
 
 static void cs5536_warm_reset(struct pci_dev *dev)
 {
-       /*
-        * 6.6.2.12 Soft Reset (DIVIL_SOFT_RESET)
-        * writing 1 to the LSB of this MSR causes a hard reset.
-        */
-       wrmsrl(0x51400017, 1ULL);
+       /* writing 1 to the LSB of this MSR causes a hard reset */
+       wrmsrl(MSR_DIVIL_SOFT_RESET, 1ULL);
        udelay(50); /* shouldn't get here but be safe and spin a while */
 }
 
index ba9188235057b17a6002a10c36493646aa747da8..3558ac78c9265517a4eb22628708f9774ded1f8b 100644 (file)
@@ -184,6 +184,12 @@ 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
@@ -224,8 +230,8 @@ void __cpuinit cpu_init (void)
                memcpy(cpu_gdt(cpu), cpu_gdt_table, GDT_SIZE);
 
        cpu_gdt_descr[cpu].size = GDT_SIZE;
-       asm volatile("lgdt %0" :: "m" (cpu_gdt_descr[cpu]));
-       asm volatile("lidt %0" :: "m" (idt_descr));
+       load_gdt((const struct desc_ptr *)&cpu_gdt_descr[cpu]);
+       load_idt((const struct desc_ptr *)&idt_descr);
 
        memset(me->thread.tls_array, 0, GDT_ENTRY_TLS_ENTRIES * 8);
        syscall_init();
index 18e6eaf138ce0259e3407bfea49a1e27fd3a25cd..ba2e165a8a0f7fb8d25d7945ca9a101607f81c03 100644 (file)
@@ -661,9 +661,7 @@ void __init setup_arch(char **cmdline_p)
 #endif
 
 #ifdef CONFIG_PCI
-#ifdef CONFIG_X86_IO_APIC
-       check_acpi_pci();       /* Checks more than just ACPI actually */
-#endif
+       early_quirks();
 #endif
 
 #ifdef CONFIG_ACPI
index cdcba69752263678c1d5337c5a8d75a000f30be7..31322d42eaae688b066e1ad3c74cb90886c4947c 100644 (file)
@@ -302,6 +302,11 @@ 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).
@@ -554,7 +559,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];
@@ -878,6 +883,7 @@ 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
 }
 
@@ -984,6 +990,7 @@ 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 <asm/cpufeature.h>.
@@ -1062,8 +1069,9 @@ static int show_cpuinfo(struct seq_file *m, void *v)
 
 
 #ifdef CONFIG_SMP
-       if (!cpu_online(c-cpu_data))
+       if (!cpu_online(c->cpu_index))
                return 0;
+       cpu = c->cpu_index;
 #endif
 
        seq_printf(m,"processor\t: %u\n"
@@ -1071,7 +1079,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)(c-cpu_data),
+                    (unsigned)cpu,
                     c->x86_vendor_id[0] ? c->x86_vendor_id : "unknown",
                     c->x86,
                     (int)c->x86_model,
@@ -1083,7 +1091,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)(c-cpu_data));
+               unsigned int freq = cpufreq_quick_get((unsigned)cpu);
                if (!freq)
                        freq = cpu_khz;
                seq_printf(m, "cpu MHz\t\t: %u.%03u\n",
@@ -1096,7 +1104,6 @@ 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)));
@@ -1154,12 +1161,16 @@ static int show_cpuinfo(struct seq_file *m, void *v)
 
 static void *c_start(struct seq_file *m, loff_t *pos)
 {
-       return *pos < NR_CPUS ? cpu_data + *pos : NULL;
+       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;
 }
 
 static void *c_next(struct seq_file *m, void *v, loff_t *pos)
 {
-       ++*pos;
+       *pos = next_cpu(*pos, cpu_possible_map);
        return c_start(m, pos);
 }
 
index 9ced828d5556657ee621b061c3fcd38f5db226aa..f32115308399453305598431f9955f97eb22387e 100644 (file)
@@ -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 (x86_cpu_to_apicid[i] == apic_id)
+               if (per_cpu(x86_cpu_to_apicid, i) == apic_id)
                        return i;
        }
        return -1;
index 5c2964727d197faf6bc135e50c7c95399781bcae..03fa6ed559c637f5bf3b240184db97c16642aa65 100644 (file)
@@ -322,17 +322,27 @@ void unlock_ipi_call_lock(void)
 }
 
 /*
- * this function sends a 'generic call function' IPI to one other CPU
- * in the system.
- *
- * cpu is a standard Linux logical CPU number.
+ * this function sends a 'generic call function' IPI to all other CPU
+ * of the system defined in the mask.
  */
-static void
-__smp_call_function_single(int cpu, void (*func) (void *info), void *info,
-                               int nonatomic, int wait)
+
+static int
+__smp_call_function_mask(cpumask_t mask,
+                        void (*func)(void *), void *info,
+                        int wait)
 {
        struct call_data_struct data;
-       int cpus = 1;
+       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;
 
        data.func = func;
        data.info = info;
@@ -343,19 +353,55 @@ __smp_call_function_single(int cpu, void (*func) (void *info), void *info,
 
        call_data = &data;
        wmb();
-       /* Send a message to all other CPUs and wait for them to respond */
-       send_IPI_mask(cpumask_of_cpu(cpu), CALL_FUNCTION_VECTOR);
+
+       /* 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);
 
        /* Wait for response */
        while (atomic_read(&data.started) != cpus)
                cpu_relax();
 
        if (!wait)
-               return;
+               return 0;
 
        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
@@ -374,6 +420,7 @@ 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 */
@@ -387,50 +434,13 @@ int smp_call_function_single (int cpu, void (*func) (void *info), void *info,
                return 0;
        }
 
-       spin_lock(&call_lock);
-       __smp_call_function_single(cpu, func, info, nonatomic, wait);
-       spin_unlock(&call_lock);
+       ret = smp_call_function_mask(cpumask_of_cpu(cpu), func, info, wait);
+
        put_cpu();
-       return 0;
+       return ret;
 }
 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.
@@ -449,10 +459,7 @@ static void __smp_call_function (void (*func) (void *info), void *info,
 int smp_call_function (void (*func) (void *info), void *info, int nonatomic,
                        int wait)
 {
-       spin_lock(&call_lock);
-       __smp_call_function(func,info,nonatomic,wait);
-       spin_unlock(&call_lock);
-       return 0;
+       return smp_call_function_mask(cpu_online_map, func, info, wait);
 }
 EXPORT_SYMBOL(smp_call_function);
 
@@ -479,7 +486,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(stop_this_cpu, NULL, 0, 0);
+       __smp_call_function_mask(cpu_online_map, stop_this_cpu, NULL, 0);
        if (!nolock)
                spin_unlock(&call_lock);
        disable_local_APIC();
index 1b9ee68c98a23fba61fcd8cec2a9a38bd78c3d21..ef0f34ede1ab34c4db94e1d6c5bd22f4b4a2b4d6 100644 (file)
@@ -67,7 +67,7 @@ int smp_num_siblings = 1;
 EXPORT_SYMBOL(smp_num_siblings);
 
 /* Last level cache ID of each logical CPU */
-int cpu_llc_id[NR_CPUS] __cpuinitdata = {[0 ... NR_CPUS-1] = BAD_APICID};
+DEFINE_PER_CPU(u8, cpu_llc_id) = BAD_APICID;
 
 /* representing HT siblings of each logical CPU */
 DEFINE_PER_CPU(cpumask_t, cpu_sibling_map);
@@ -89,12 +89,20 @@ EXPORT_SYMBOL(cpu_possible_map);
 static cpumask_t smp_commenced_mask;
 
 /* Per CPU bogomips and other parameters */
-struct cpuinfo_x86 cpu_data[NR_CPUS] __cacheline_aligned;
-EXPORT_SYMBOL(cpu_data);
+DEFINE_PER_CPU_SHARED_ALIGNED(struct cpuinfo_x86, cpu_info);
+EXPORT_PER_CPU_SYMBOL(cpu_info);
 
-u8 x86_cpu_to_apicid[NR_CPUS] __read_mostly =
-                       { [0 ... NR_CPUS-1] = 0xff };
-EXPORT_SYMBOL(x86_cpu_to_apicid);
+/*
+ * 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 apicid_2_node[MAX_APICID];
 
@@ -150,9 +158,10 @@ 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);
        /*
@@ -294,7 +303,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
@@ -311,41 +320,41 @@ static cpumask_t cpu_sibling_setup_map;
 void __cpuinit set_cpu_sibling_map(int cpu)
 {
        int i;
-       struct cpuinfo_x86 *c = cpu_data;
+       struct cpuinfo_x86 *c = &cpu_data(cpu);
 
        cpu_set(cpu, cpu_sibling_setup_map);
 
        if (smp_num_siblings > 1) {
                for_each_cpu_mask(i, cpu_sibling_setup_map) {
-                       if (c[cpu].phys_proc_id == c[i].phys_proc_id &&
-                           c[cpu].cpu_core_id == c[i].cpu_core_id) {
+                       if (c->phys_proc_id == cpu_data(i).phys_proc_id &&
+                           c->cpu_core_id == cpu_data(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[cpu].llc_shared_map);
-                               cpu_set(cpu, c[i].llc_shared_map);
+                               cpu_set(i, c->llc_shared_map);
+                               cpu_set(cpu, cpu_data(i).llc_shared_map);
                        }
                }
        } else {
                cpu_set(cpu, per_cpu(cpu_sibling_map, cpu));
        }
 
-       cpu_set(cpu, c[cpu].llc_shared_map);
+       cpu_set(cpu, c->llc_shared_map);
 
        if (current_cpu_data.x86_max_cores == 1) {
                per_cpu(cpu_core_map, cpu) = per_cpu(cpu_sibling_map, cpu);
-               c[cpu].booted_cores = 1;
+               c->booted_cores = 1;
                return;
        }
 
        for_each_cpu_mask(i, cpu_sibling_setup_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 (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 (c[cpu].phys_proc_id == c[i].phys_proc_id) {
+               if (c->phys_proc_id == cpu_data(i).phys_proc_id) {
                        cpu_set(i, per_cpu(cpu_core_map, cpu));
                        cpu_set(cpu, per_cpu(cpu_core_map, i));
                        /*
@@ -357,15 +366,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[cpu].booted_cores++;
+                                       c->booted_cores++;
                                /*
                                 * increment the core count for all
                                 * the other cpus in this package
                                 */
                                if (i != cpu)
-                                       c[i].booted_cores++;
-                       } else if (i != cpu && !c[cpu].booted_cores)
-                               c[cpu].booted_cores = c[i].booted_cores;
+                                       cpu_data(i).booted_cores++;
+                       } else if (i != cpu && !c->booted_cores)
+                               c->booted_cores = cpu_data(i).booted_cores;
                }
        }
 }
@@ -804,7 +813,7 @@ static int __cpuinit do_boot_cpu(int apicid, int cpu)
 
        irq_ctx_init(cpu);
 
-       x86_cpu_to_apicid[cpu] = apicid;
+       per_cpu(x86_cpu_to_apicid, cpu) = apicid;
        /*
         * This grunge runs the startup process for
         * the targeted processor.
@@ -844,7 +853,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;
@@ -866,7 +875,7 @@ static int __cpuinit do_boot_cpu(int apicid, int cpu)
                cpu_clear(cpu, cpu_initialized); /* was set by cpu_init() */
                cpucount--;
        } else {
-               x86_cpu_to_apicid[cpu] = apicid;
+               per_cpu(x86_cpu_to_apicid, cpu) = apicid;
                cpu_set(cpu, cpu_present_map);
        }
 
@@ -915,7 +924,7 @@ static int __cpuinit __smp_prepare_cpu(int cpu)
        struct warm_boot_cpu_info info;
        int     apicid, ret;
 
-       apicid = x86_cpu_to_apicid[cpu];
+       apicid = per_cpu(x86_cpu_to_apicid, cpu);
        if (apicid == BAD_APICID) {
                ret = -ENODEV;
                goto exit;
@@ -961,11 +970,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();
-       x86_cpu_to_apicid[0] = boot_cpu_physical_apicid;
+       per_cpu(x86_cpu_to_apicid, 0) = boot_cpu_physical_apicid;
 
        current_thread_info()->cpu = 0;
 
@@ -1008,6 +1017,7 @@ 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;
@@ -1029,6 +1039,7 @@ 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;
@@ -1082,7 +1093,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,
@@ -1152,7 +1163,7 @@ void __init native_smp_prepare_boot_cpu(void)
 void remove_siblinginfo(int cpu)
 {
        int sibling;
-       struct cpuinfo_x86 *c = cpu_data;
+       struct cpuinfo_x86 *c = &cpu_data(cpu);
 
        for_each_cpu_mask(sibling, per_cpu(cpu_core_map, cpu)) {
                cpu_clear(cpu, per_cpu(cpu_core_map, sibling));
@@ -1160,15 +1171,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)
-                       c[sibling].booted_cores--;
+                       cpu_data(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[cpu].phys_proc_id = 0;
-       c[cpu].cpu_core_id = 0;
+       c->phys_proc_id = 0;
+       c->cpu_core_id = 0;
        cpu_clear(cpu, cpu_sibling_setup_map);
 }
 
index d4c33aba3ff2d4d37360e077048f806f2f4cfa13..b7e768dd87c90c731770cdce985649409626b73a 100644 (file)
@@ -65,7 +65,7 @@ int smp_num_siblings = 1;
 EXPORT_SYMBOL(smp_num_siblings);
 
 /* Last level cache ID of each logical CPU */
-u8 cpu_llc_id[NR_CPUS] __cpuinitdata  = {[0 ... NR_CPUS-1] = BAD_APICID};
+DEFINE_PER_CPU(u8, cpu_llc_id) = 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 */
-struct cpuinfo_x86 cpu_data[NR_CPUS] __cacheline_aligned;
-EXPORT_SYMBOL(cpu_data);
+DEFINE_PER_CPU_SHARED_ALIGNED(struct cpuinfo_x86, cpu_info);
+EXPORT_PER_CPU_SYMBOL(cpu_info);
 
 /* Set when the idlers are all forked */
 int smp_threads_ready;
@@ -138,9 +138,10 @@ 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);
 }
@@ -237,7 +238,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
@@ -254,41 +255,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;
+       struct cpuinfo_x86 *c = &cpu_data(cpu);
 
        cpu_set(cpu, cpu_sibling_setup_map);
 
        if (smp_num_siblings > 1) {
                for_each_cpu_mask(i, cpu_sibling_setup_map) {
-                       if (c[cpu].phys_proc_id == c[i].phys_proc_id &&
-                           c[cpu].cpu_core_id == c[i].cpu_core_id) {
+                       if (c->phys_proc_id == cpu_data(i).phys_proc_id &&
+                           c->cpu_core_id == cpu_data(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[cpu].llc_shared_map);
-                               cpu_set(cpu, c[i].llc_shared_map);
+                               cpu_set(i, c->llc_shared_map);
+                               cpu_set(cpu, cpu_data(i).llc_shared_map);
                        }
                }
        } else {
                cpu_set(cpu, per_cpu(cpu_sibling_map, cpu));
        }
 
-       cpu_set(cpu, c[cpu].llc_shared_map);
+       cpu_set(cpu, c->llc_shared_map);
 
        if (current_cpu_data.x86_max_cores == 1) {
                per_cpu(cpu_core_map, cpu) = per_cpu(cpu_sibling_map, cpu);
-               c[cpu].booted_cores = 1;
+               c->booted_cores = 1;
                return;
        }
 
        for_each_cpu_mask(i, cpu_sibling_setup_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 (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 (c[cpu].phys_proc_id == c[i].phys_proc_id) {
+               if (c->phys_proc_id == cpu_data(i).phys_proc_id) {
                        cpu_set(i, per_cpu(cpu_core_map, cpu));
                        cpu_set(cpu, per_cpu(cpu_core_map, i));
                        /*
@@ -300,15 +301,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[cpu].booted_cores++;
+                                       c->booted_cores++;
                                /*
                                 * increment the core count for all
                                 * the other cpus in this package
                                 */
                                if (i != cpu)
-                                       c[i].booted_cores++;
-                       } else if (i != cpu && !c[cpu].booted_cores)
-                               c[cpu].booted_cores = c[i].booted_cores;
+                                       cpu_data(i).booted_cores++;
+                       } else if (i != cpu && !c->booted_cores)
+                               c->booted_cores = cpu_data(i).booted_cores;
                }
        }
 }
@@ -694,7 +695,7 @@ do_rest:
                clear_node_cpumask(cpu); /* was set by numa_add_cpu */
                cpu_clear(cpu, cpu_present_map);
                cpu_clear(cpu, cpu_possible_map);
-               x86_cpu_to_apicid[cpu] = BAD_APICID;
+               per_cpu(x86_cpu_to_apicid, cpu) = BAD_APICID;
                return -EIO;
        }
 
@@ -840,6 +841,26 @@ 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.
@@ -849,6 +870,7 @@ 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) {
@@ -968,7 +990,7 @@ void __init smp_cpus_done(unsigned int max_cpus)
 static void remove_siblinginfo(int cpu)
 {
        int sibling;
-       struct cpuinfo_x86 *c = cpu_data;
+       struct cpuinfo_x86 *c = &cpu_data(cpu);
 
        for_each_cpu_mask(sibling, per_cpu(cpu_core_map, cpu)) {
                cpu_clear(cpu, per_cpu(cpu_core_map, sibling));
@@ -976,15 +998,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)
-                       c[sibling].booted_cores--;
+                       cpu_data(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[cpu].phys_proc_id = 0;
-       c[cpu].cpu_core_id = 0;
+       c->phys_proc_id = 0;
+       c->cpu_core_id = 0;
        cpu_clear(cpu, cpu_sibling_setup_map);
 }
 
index 76274eeae9a9ab75cdca94f966423f601a81aa17..bc9f59c246fd99890da74eec868d92cc3f8f7f2b 100644 (file)
@@ -32,9 +32,9 @@ void __save_processor_state(struct saved_context *ctxt)
        /*
         * descriptor tables
         */
-       asm volatile ("sgdt %0" : "=m" (ctxt->gdt_limit));
-       asm volatile ("sidt %0" : "=m" (ctxt->idt_limit));
-       asm volatile ("str %0"  : "=m" (ctxt->tr));
+       store_gdt((struct desc_ptr *)&ctxt->gdt_limit);
+       store_idt((struct desc_ptr *)&ctxt->idt_limit);
+       store_tr(ctxt->tr);
 
        /* XMM0..XMM15 should be handled by kernel_fpu_begin(). */
        /*
@@ -91,8 +91,9 @@ void __restore_processor_state(struct saved_context *ctxt)
         * now restore the descriptor tables to their proper values
         * ltr is done i fix_processor_context().
         */
-       asm volatile ("lgdt %0" :: "m" (ctxt->gdt_limit));
-       asm volatile ("lidt %0" :: "m" (ctxt->idt_limit));
+       load_gdt((const struct desc_ptr *)&ctxt->gdt_limit);
+       load_idt((const struct desc_ptr *)&ctxt->idt_limit);
+
 
        /*
         * segment registers
index 1e9d57256eb11ff9061d3713f3844ce1fa8634aa..cc9acace7e23ba05b810afcf3c9d96bff0516d6c 100644 (file)
@@ -63,6 +63,9 @@
 
 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 ? */
@@ -288,33 +291,9 @@ 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) (&regs->esp);
-       savesegment(ss, ss);
-       savesegment(gs, gs);
-       if (user_mode_vm(regs)) {
-               in_kernel = 0;
-               esp = regs->esp;
-               ss = regs->xss & 0xffff;
-       }
+
        print_modules();
-       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);
+       __show_registers(regs, 0);
        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));
@@ -322,14 +301,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 (in_kernel) {
+       if (!user_mode_vm(regs)) {
                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, (unsigned long *)esp, KERN_EMERG);
+               show_stack_log_lvl(NULL, regs, &regs->esp, KERN_EMERG);
 
                printk(KERN_EMERG "Code: ");
 
@@ -374,11 +353,11 @@ int is_valid_bugaddr(unsigned long eip)
 void die(const char * str, struct pt_regs * regs, long err)
 {
        static struct {
-               spinlock_t lock;
+               raw_spinlock_t lock;
                u32 lock_owner;
                int lock_owner_depth;
        } die = {
-               .lock =                 __SPIN_LOCK_UNLOCKED(die.lock),
+               .lock =                 __RAW_SPIN_LOCK_UNLOCKED,
                .lock_owner =           -1,
                .lock_owner_depth =     0
        };
@@ -389,13 +368,14 @@ void die(const char * str, struct pt_regs * regs, long err)
 
        if (die.lock_owner != raw_smp_processor_id()) {
                console_verbose();
-               spin_lock_irqsave(&die.lock, flags);
+               __raw_spin_lock(&die.lock);
+               raw_local_save_flags(flags);
                die.lock_owner = smp_processor_id();
                die.lock_owner_depth = 0;
                bust_spinlocks(1);
        }
        else
-               local_save_flags(flags);
+               raw_local_save_flags(flags);
 
        if (++die.lock_owner_depth < 3) {
                unsigned long esp;
@@ -439,7 +419,8 @@ void die(const char * str, struct pt_regs * regs, long err)
        bust_spinlocks(0);
        die.lock_owner = -1;
        add_taint(TAINT_DIE);
-       spin_unlock_irqrestore(&die.lock, flags);
+       __raw_spin_unlock(&die.lock);
+       raw_local_irq_restore(flags);
 
        if (!regs)
                return;
@@ -1142,6 +1123,8 @@ 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)) {
@@ -1201,6 +1184,11 @@ 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.
         */
index b4c887341a2663911520b4d13571b4e2309ead51..d0c2bc7ab2ec561dc91e12dee87fde8b563f8770 100644 (file)
@@ -462,7 +462,7 @@ void out_of_line_bug(void)
 EXPORT_SYMBOL(out_of_line_bug);
 #endif
 
-static DEFINE_SPINLOCK(die_lock);
+static raw_spinlock_t die_lock = __RAW_SPIN_LOCK_UNLOCKED;
 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. */
-       local_irq_save(flags);
+       raw_local_irq_save(flags);
        cpu = smp_processor_id();
-       if (!spin_trylock(&die_lock)) { 
+       if (!__raw_spin_trylock(&die_lock)) {
                if (cpu == die_owner) 
                        /* nested oops. should stop eventually */;
                else
-                       spin_lock(&die_lock);
+                       __raw_spin_lock(&die_lock);
        }
        die_nest_count++;
        die_owner = cpu;
@@ -494,12 +494,10 @@ void __kprobes oops_end(unsigned long flags)
        die_owner = -1;
        bust_spinlocks(0);
        die_nest_count--;
-       if (die_nest_count)
-               /* We still own the lock */
-               local_irq_restore(flags);
-       else
+       if (!die_nest_count)
                /* Nest count reaches zero, release the lock. */
-               spin_unlock_irqrestore(&die_lock, flags);
+               __raw_spin_unlock(&die_lock);
+       raw_local_irq_restore(flags);
        if (panic_on_oops)
                panic("Fatal exception");
        oops_exit();
index 9683f1d356013fdf4d5a0ea409483511aeb8d0de..d78444c788a3b8f8c4fa6824a6afcf3860d2f4fe 100644 (file)
@@ -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);
 
index 9f22e542c37409e84967b4903f4a24bb7db56dfd..9c70af45b42bcbe7683cf2c37b593f4da7b793ee 100644 (file)
@@ -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
index e14cb3f53862f7289e9dc08d6dc350bdc2705fa8..ad4005c6d4a1113d47c289a06d46328743fd2b2b 100644 (file)
@@ -48,7 +48,7 @@
        ({unsigned long v;              \
        extern char __vsyscall_0;       \
          asm("" : "=r" (v) : "0" (x)); \
-         ((v - VSYSCALL_FIRST_PAGE) + __pa_symbol(&__vsyscall_0)); })
+         ((v - VSYSCALL_START) + __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
index f6edb11364dfe5edef9ffac33341b24307a85434..952e7a89c2ac4f0cc218b310e6a0f84da3845d99 100644 (file)
@@ -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);
 }
index 2dbebd308347f21be2ad931ce480a6ade16e72b2..0ebbfb9e7c7f8d2b86abeb23f07b0cfbf0ebe56f 100644 (file)
@@ -40,7 +40,8 @@ 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);
 
index c5f2692273e6a6444dedd80f4d41797fdabdac4d..361ac5107b33efcc2331eabc6342912e071e2090 100644 (file)
@@ -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 */
-struct cpuinfo_x86 cpu_data[NR_CPUS] __cacheline_aligned;
-EXPORT_SYMBOL(cpu_data);
+DEFINE_PER_CPU(cpuinfo_x86, cpu_info) __cacheline_aligned;
+EXPORT_PER_CPU_SYMBOL(cpu_info);
 
 /* 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),
index d6181597a0a83f4f4321ba2c9c89c7e4a56df170..503dfc05111b051de74265e2d44ae7de86a80145 100644 (file)
@@ -564,7 +564,8 @@ no_context:
                 * it's allocated already.
                 */
                if ((page >> PAGE_SHIFT) < max_low_pfn
-                   && (page & _PAGE_PRESENT)) {
+                   && (page & _PAGE_PRESENT)
+                   && !(page & _PAGE_PSE)) {
                        page &= PAGE_MASK;
                        page = ((__typeof__(page) *) __va(page))[(address >> PAGE_SHIFT)
                                                                 & (PTRS_PER_PTE - 1)];
index 7c560843ded1fbe083a365658edf4c6750e29f11..644b4f7ece10acc498fd9ac61c0d93637f519a82 100644 (file)
@@ -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)) goto ret;        
+       if (!pmd_present(*pmd) || pmd_large(*pmd)) goto ret;
 
        pte = pte_offset_kernel(pmd, address);
        if (bad_address(pte)) goto bad;
@@ -285,7 +285,6 @@ static int vmalloc_fault(unsigned long address)
        return 0;
 }
 
-static int page_fault_trace;
 int show_unhandled_signals = 1;
 
 /*
@@ -354,10 +353,6 @@ 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);
 
@@ -488,7 +483,7 @@ bad_area_nosemaphore:
                if (show_unhandled_signals && unhandled_signal(tsk, SIGSEGV) &&
                    printk_ratelimit()) {
                        printk(
-                      "%s%s[%d]: segfault at %016lx rip %016lx rsp %016lx error %lx\n",
+                      "%s%s[%d]: segfault at %lx rip %lx rsp %lx error %lx\n",
                                        tsk->pid > 1 ? KERN_INFO : KERN_EMERG,
                                        tsk->comm, tsk->pid, address, regs->rip,
                                        regs->rsp, error_code);
@@ -621,10 +616,3 @@ 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);
index 5eec5e56d07f3a2b7d5bb6b48b1d4acadf15e689..3d6926ba8995e4d54131c2660ffb1348955d6e32 100644 (file)
@@ -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[i];
+               u8 apicid = x86_cpu_to_apicid_init[i];
                if (apicid == BAD_APICID)
                        continue;
                if (apicid_to_node[apicid] == NUMA_NO_NODE)
index c049ce414f010359c0c312e08c6bd903b683797d..0ed046a187f77fb1d29228780c395f4e8d4636a1 100644 (file)
 #include <linux/mm.h>
 #include <asm/ptrace.h>
 #include <asm/uaccess.h>
+#include <asm/stacktrace.h>
 
-struct frame_head {
-       struct frame_head * ebp;
-       unsigned long ret;
-} __attribute__((packed));
+static void backtrace_warning_symbol(void *data, char *msg,
+                                    unsigned long symbol)
+{
+       /* Ignore warnings */
+}
 
-static struct frame_head *
-dump_kernel_backtrace(struct frame_head * head)
+static void backtrace_warning(void *data, char *msg)
 {
-       oprofile_add_trace(head->ret);
+       /* Ignore warnings */
+}
 
-       /* frame pointers should strictly progress back up the stack
-        * (towards higher addresses) */
-       if (head >= head->ebp)
-               return NULL;
+static int backtrace_stack(void *data, char *name)
+{
+       /* Yes, we want all stacks */
+       return 0;
+}
+
+static void backtrace_address(void *data, unsigned long addr)
+{
+       unsigned int *depth = data;
 
-       return head->ebp;
+       if ((*depth)--)
+               oprofile_add_trace(addr);
 }
 
+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)
 {
@@ -53,72 +73,16 @@ 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;
-
-#ifdef CONFIG_X86_64
-       head = (struct frame_head *)regs->rbp;
-#else
-       head = (struct frame_head *)regs->ebp;
-#endif
+       struct frame_head *head = (struct frame_head *)frame_pointer(regs);
+       unsigned long stack = stack_pointer(regs);
 
        if (!user_mode_vm(regs)) {
-               while (depth-- && valid_kernel_stack(head, regs))
-                       head = dump_kernel_backtrace(head);
+               if (depth)
+                       dump_trace(NULL, regs, (unsigned long *)stack,
+                                  &backtrace_ops, &depth);
                return;
        }
 
diff --git a/arch/x86_64/.gitignore b/arch/x86_64/.gitignore
new file mode 100644 (file)
index 0000000..36ef4c3
--- /dev/null
@@ -0,0 +1 @@
+boot
index 25785b23df87fabe74ff640459dc5ecc04d68f6a..aab25f3ba3cee2fff6733344f3ea44d5f0c26e12 100644 (file)
@@ -723,7 +723,7 @@ config ARCH_HIBERNATION_HEADER
 
 source "drivers/acpi/Kconfig"
 
-source "arch/x86/kernel/cpufreq/Kconfig"
+source "arch/x86/kernel/cpu/cpufreq/Kconfig_64"
 
 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"
index 03e1ede27b8541c627f8db895ae5e8534cff3166..6d89ab762ffcf759b2dc6d344babe73ce056a239 100644 (file)
@@ -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_64.o
+head-y := arch/x86/kernel/head_64.o arch/x86/kernel/head64.o arch/x86/kernel/init_task.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)mkdir -p $(objtree)/arch/x86_64/boot
-       $(Q)ln -fsn $(objtree)/arch/x86/boot/bzImage $(objtree)/arch/x86_64/boot/bzImage
        $(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
 
 bzlilo: vmlinux
        $(Q)$(MAKE) $(build)=$(boot) BOOTIMAGE=$(BOOTIMAGE) zlilo
index a7351084f2f8d48a28c5e024aff9a0b83ac8dce2..235a51e328c3467522e16ac1d4bb26c5a7227537 100644 (file)
@@ -422,12 +422,6 @@ 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;
@@ -501,7 +495,7 @@ static int get_cpu_id(acpi_handle handle, u32 acpi_id)
                return apic_id;
 
        for (i = 0; i < NR_CPUS; ++i) {
-               if (arch_cpu_to_apicid[i] == apic_id)
+               if (cpu_physical_id(i) == apic_id)
                        return i;
        }
        return -1;
index bbaa545ea999817200366d54f3ea4b65cb6f32af..629eadbd0ec09c17f538ace9ffd7921161679eac 100644 (file)
@@ -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
- *     @sg: sg list for the data buffer of the command
+ *     @sgl: sg list for the data buffer of the command
  *     @n_elem: Number of sg entries
  *     @timeout: Timeout in msecs (0 for default)
  *
index 53070f6b1fc4e1c7e005482cb95c9f00cc92a351..d753e568588ea585e4fed4970e1940b63d4382d3 100644 (file)
@@ -40,7 +40,7 @@
 #include <asm/msr.h>
 
 #define DRV_NAME       "pata_cs5536"
-#define DRV_VERSION    "0.0.5"
+#define DRV_VERSION    "0.0.6"
 
 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] << dshift;
+               dtc |= mwdma_timings[mode - XFER_MW_DMA_0] << dshift;
 
                cs5536_write(pdev, DTC, dtc);
        }
index 8d98a9fb0a42d12162f744204b25c279a3706dde..f147dc7bf464ff74f404440bb74c75df0f3ea622 100644 (file)
@@ -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           = ATA_MAX_PRD,
+       .sg_tablesize           = LIBATA_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)
+static u32 sis_scr_cfg_read (struct ata_port *ap, unsigned int sc_reg, u32 *val)
 {
        struct pci_dev *pdev = to_pci_dev(ap->host->dev);
        unsigned int cfg_addr = get_scr_cfg_addr(ap, sc_reg);
-       u32 val, val2 = 0;
+       u32 val2 = 0;
        u8 pmr;
 
        if (sc_reg == SCR_ERROR) /* doesn't exist in PCI cfg space */
@@ -178,13 +178,16 @@ static u32 sis_scr_cfg_read (struct ata_port *ap, unsigned int sc_reg)
 
        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);
 
-       return (val|val2) &  0xfffffffb; /* avoid problems with powerdowned ports */
+       *val |= val2;
+       *val &= 0xfffffffb;     /* avoid problems with powerdowned ports */
+
+       return 0;
 }
 
 static void sis_scr_cfg_write (struct ata_port *ap, unsigned int sc_reg, u32 val)
@@ -214,7 +217,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);
+               return sis_scr_cfg_read(ap, sc_reg, val);
 
        pci_read_config_byte(pdev, SIS_PMR, &pmr);
 
index 6f66551d9e51ab00f787dfe5c2d5d9182affd4bc..5c82ec7f8bbda7fea7ec8a1f81c14add4a25c6d8 100644 (file)
@@ -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) ||
index f17e771e42f8aa6c699a21e429b0a1d557fbb048..3330667280b9aa5d5b3d9a7852934041a384bf8c 100644 (file)
@@ -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;
+       struct cpuinfo_x86 *c = &cpu_data(0);
        u32 eax;
        u8 eff_family, eff_model, eff_stepping, vrm_ret;
 
index 6d9fd92763f46bf853bacbf091c92be3d1294c92..6eaece96524eac2c9e7d709559c4c99f4eb8a2a1 100644 (file)
@@ -1056,6 +1056,9 @@ 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
index f7449d04114a1b1e984917e35fb23755424abaf3..48db6167bb90f6005927590431ba56a231061cd3 100644 (file)
@@ -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, 0, hwif);
+       ide_register_hw(&hw, NULL, 0, hwif);
 
        return 0;
 }
index 3af33fbf1f8859da5f2dc6c7ea0f9aeaf52e1c3a..410a0d13e35e847ad8695a7e8585cbb3d322e72b 100644 (file)
@@ -316,27 +316,29 @@ static int icside_dma_end(ide_drive_t *drive)
 
        drive->waiting_for_dma = 0;
 
-       disable_dma(hwif->hw.dma);
+       disable_dma(state->dev->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(hwif->hw.dma) != 0;
+       return get_dma_residue(state->dev->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(hwif->hw.dma));
-       enable_dma(hwif->hw.dma);
+       BUG_ON(dma_channel_active(state->dev->dma));
+       enable_dma(state->dev->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;
 
@@ -348,7 +350,7 @@ static int icside_dma_setup(ide_drive_t *drive)
        /*
         * We can not enable DMA on both channels.
         */
-       BUG_ON(dma_channel_active(hwif->hw.dma));
+       BUG_ON(dma_channel_active(state->dev->dma));
 
        icside_build_sglist(drive, rq);
 
@@ -365,14 +367,14 @@ static int icside_dma_setup(ide_drive_t *drive)
        /*
         * Select the correct timing for this drive.
         */
-       set_dma_speed(hwif->hw.dma, drive->drive_data);
+       set_dma_speed(state->dev->dma, drive->drive_data);
 
        /*
         * Tell the DMA engine about the SG table and
         * data direction.
         */
-       set_dma_sg(hwif->hw.dma, hwif->sg_table, hwif->sg_nents);
-       set_dma_mode(hwif->hw.dma, dma_mode);
+       set_dma_sg(state->dev->dma, hwif->sg_table, hwif->sg_nents);
+       set_dma_mode(state->dev->dma, dma_mode);
 
        drive->waiting_for_dma = 1;
 
@@ -438,40 +440,16 @@ 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 = icside_find_hwif(port);
+       hwif = ide_find_port(port);
        if (hwif) {
                int i;
 
-               memset(&hwif->hw, 0, sizeof(hw_regs_t));
-
                /*
                 * Ensure we're using MMIO
                 */
@@ -479,13 +457,10 @@ 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;
@@ -500,6 +475,7 @@ 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)
@@ -523,9 +499,9 @@ icside_register_v5(struct icside_state *state, struct expansion_card *ec)
 
        state->hwif[0] = hwif;
 
-       probe_hwif_init(hwif);
+       idx[0] = hwif->index;
 
-       ide_proc_register_port(hwif);
+       ide_device_add(idx);
 
        return 0;
 }
@@ -537,6 +513,7 @@ 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) {
@@ -592,7 +569,6 @@ 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;
@@ -601,18 +577,16 @@ 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);
        }
 
-       probe_hwif_init(hwif);
-       probe_hwif_init(mate);
+       idx[0] = hwif->index;
+       idx[1] = mate->index;
 
-       ide_proc_register_port(hwif);
-       ide_proc_register_port(mate);
+       ide_device_add(idx);
 
        return 0;
 
index bce2bec81413eafa8f9358bb81efc3306ca7ad83..8957cbadf5c2a8c5870800a54ebd1d4b6eebae70 100644 (file)
@@ -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, 1, NULL);
+       ide_register_hw(&hw, NULL, 1, NULL);
 }
index 83811af11610d91a371825ca5e937af6ec327927..0775a3afef4862d5e5b2b5646443cbcfdec1448c 100644 (file)
 
 #include <asm/ecard.h>
 
-/*
- * 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;
-       int index, i;
-
-       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;
-       }
+       ide_hwif_t *hwif = ide_find_port(port);
+       int i;
 
-       return NULL;
+       if (hwif == NULL)
+               goto out;
 
- 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->hw.irq = hwif->irq = irq;
+       hwif->irq = irq;
        hwif->mmio = 1;
        default_hwif_mmiops(hwif);
-
+out:
        return hwif;
 }
 
@@ -58,6 +41,7 @@ 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)
@@ -74,8 +58,11 @@ rapide_probe(struct expansion_card *ec, const struct ecard_id *id)
                hwif->hwif_data = base;
                hwif->gendev.parent = &ec->dev;
                hwif->noprobe = 0;
-               probe_hwif_init(hwif);
-               ide_proc_register_port(hwif);
+
+               idx[0] = hwif->index;
+
+               ide_device_add(idx);
+
                ecard_set_drvdata(ec, hwif);
                goto out;
        }
index 9a96a10ba9d3a7f69573f117b59c34a95db3a220..ff20377b4c822d4a562929d7c8f122b17488d5f4 100644 (file)
@@ -782,7 +782,7 @@ init_e100_ide (void)
                                ide_offsets,
                                0, 0, cris_ide_ack_intr,
                                ide_default_irq(0));
-               ide_register_hw(&hw, 1, &hwif);
+               ide_register_hw(&hw, NULL, 1, &hwif);
                hwif->mmio = 1;
                hwif->chipset = ide_etrax100;
                hwif->set_pio_mode = &cris_set_pio_mode;
index 6d26ad7360d52c35dd01ab897dafe24b8fd2dacd..4a49b5c59acb3949fa87656814678956b7855e17 100644 (file)
@@ -68,7 +68,6 @@ 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;
 }
 
@@ -101,7 +100,7 @@ void __init h8300_ide_init(void)
        hw_setup(&hw);
 
        /* register if */
-       idx = ide_register_hw(&hw, 1, &hwif);
+       idx = ide_register_hw(&hw, NULL, 1, &hwif);
        if (idx == -1) {
                printk(KERN_ERR "ide-h8300: IDE I/F register failed\n");
                return;
index 1d5f6823101c26c2e73980c6705878956e68be85..89df48fdc69d7b6109098153813524862fe4bff1 100644 (file)
@@ -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_IN;
+       args.data_phase   = TASKFILE_NO_DATA;
        args.handler      = &task_no_data_intr;
 
        /* convert gtf to IDE Taskfile */
index 2722d9165b6bee75abfd066536deda80b0ce4707..00123d99527ab72c28ce29fd5d2f08b558211e78 100644 (file)
@@ -593,28 +593,12 @@ static int smart_enable(ide_drive_t *drive)
        return ide_raw_taskfile(drive, &args, NULL);
 }
 
-static int get_smart_values(ide_drive_t *drive, u8 *buf)
+static int get_smart_data(ide_drive_t *drive, u8 *buf, u8 sub_cmd)
 {
        ide_task_t args;
 
        memset(&args, 0, sizeof(ide_task_t));
-       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_FEATURE_OFFSET]     = sub_cmd;
        args.tfRegister[IDE_NSECTOR_OFFSET]     = 0x01;
        args.tfRegister[IDE_LCYL_OFFSET]        = SMART_LCYL_PASS;
        args.tfRegister[IDE_HCYL_OFFSET]        = SMART_HCYL_PASS;
@@ -656,7 +640,7 @@ static int proc_idedisk_read_smart_thresholds
        ide_drive_t     *drive = (ide_drive_t *)data;
        int             len = 0, i = 0;
 
-       if (!get_smart_thresholds(drive, page)) {
+       if (get_smart_data(drive, page, SMART_READ_THRESHOLDS) == 0) {
                unsigned short *val = (unsigned short *) page;
                char *out = ((char *)val) + (SECTOR_WORDS * 4);
                page = out;
@@ -675,7 +659,7 @@ static int proc_idedisk_read_smart_values
        ide_drive_t     *drive = (ide_drive_t *)data;
        int             len = 0, i = 0;
 
-       if (!get_smart_values(drive, page)) {
+       if (get_smart_data(drive, page, SMART_READ_VALUES) == 0) {
                unsigned short *val = (unsigned short *) page;
                char *out = ((char *)val) + (SECTOR_WORDS * 4);
                page = out;
index 80b4f17f3941deeeb42c9791d1ff40e42ae62d30..428f7a8a00b628715d86d7f9c27007db33952d3d 100644 (file)
@@ -901,10 +901,7 @@ void ide_dma_timeout (ide_drive_t *drive)
 
 EXPORT_SYMBOL(ide_dma_timeout);
 
-/*
- * Needed for allowing full modular support of ide-driver
- */
-static int ide_release_dma_engine(ide_hwif_t *hwif)
+static void ide_release_dma_engine(ide_hwif_t *hwif)
 {
        if (hwif->dmatable_cpu) {
                pci_free_consistent(hwif->pci_dev,
@@ -913,7 +910,6 @@ static int 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)
@@ -956,12 +952,6 @@ 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;
 }
 
@@ -975,8 +965,6 @@ 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);
 
@@ -991,10 +979,6 @@ 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;
 }
 
@@ -1006,12 +990,9 @@ static int ide_dma_iobase(ide_hwif_t *hwif, unsigned long base, unsigned int por
        return ide_iomio_dma(hwif, base, 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)
+void ide_setup_dma(ide_hwif_t *hwif, unsigned long base, unsigned num_ports)
 {
-       if (ide_dma_iobase(hwif, dma_base, num_ports))
+       if (ide_dma_iobase(hwif, base, num_ports))
                return;
 
        if (ide_allocate_dma_engine(hwif)) {
@@ -1019,6 +1000,13 @@ void ide_setup_dma (ide_hwif_t *hwif, unsigned long dma_base, unsigned int num_p
                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))
index 32eaa3f8051592f4ecb132ccaa08fb8ced966d60..c89f0d3058e934767bc1c2a3b8b7e2231b43a587 100644 (file)
@@ -55,7 +55,7 @@
 #include <asm/io.h>
 
 static int __ide_end_request(ide_drive_t *drive, struct request *rq,
-                            int uptodate, unsigned int nr_bytes)
+                            int uptodate, unsigned int nr_bytes, int dequeue)
 {
        int ret = 1;
 
@@ -80,9 +80,11 @@ 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 (!list_empty(&rq->queuelist))
-                       blkdev_dequeue_request(rq);
-               HWGROUP(drive)->rq = NULL;
+               if (dequeue) {
+                       if (!list_empty(&rq->queuelist))
+                               blkdev_dequeue_request(rq);
+                       HWGROUP(drive)->rq = NULL;
+               }
                end_that_request_last(rq, uptodate);
                ret = 0;
        }
@@ -122,7 +124,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);
+       ret = __ide_end_request(drive, rq, uptodate, nr_bytes, 1);
 
        spin_unlock_irqrestore(&ide_lock, flags);
        return ret;
@@ -255,39 +257,13 @@ int ide_end_dequeued_request(ide_drive_t *drive, struct request *rq,
                             int uptodate, int nr_sectors)
 {
        unsigned long flags;
-       int ret = 1;
+       int ret;
 
        spin_lock_irqsave(&ide_lock, flags);
-
        BUG_ON(!blk_rq_started(rq));
-
-       /*
-        * 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;
-       }
+       ret = __ide_end_request(drive, rq, uptodate, nr_sectors << 9, 0);
        spin_unlock_irqrestore(&ide_lock, flags);
+
        return ret;
 }
 EXPORT_SYMBOL_GPL(ide_end_dequeued_request);
@@ -800,7 +776,20 @@ 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)
+
+                       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
                                hwif->set_pio_mode(drive, req_pio);
                } else {
                        int keep_dma = drive->using_dma;
index d4d790f91f91afc7e7156b442143caa46d32f932..95168833d0691a82c896197a7a4d01beae361479 100644 (file)
@@ -693,35 +693,16 @@ static u8 ide_auto_reduce_xfer (ide_drive_t *drive)
 }
 #endif /* CONFIG_BLK_DEV_IDEDMA */
 
-/*
- * Update the 
- */
-int ide_driveid_update (ide_drive_t *drive)
+int ide_driveid_update(ide_drive_t *drive)
 {
-       ide_hwif_t *hwif        = HWIF(drive);
+       ide_hwif_t *hwif = drive->hwif;
        struct hd_driveid *id;
-#if 0
-       id = kmalloc(SECTOR_WORDS*4, GFP_ATOMIC);
-       if (!id)
-               return 0;
-
-       taskfile_lib_get_identify(drive, (char *)&id);
+       unsigned long timeout, flags;
 
-       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)
@@ -763,7 +744,6 @@ int ide_driveid_update (ide_drive_t *drive)
        }
 
        return 1;
-#endif
 }
 
 int ide_config_drive_speed(ide_drive_t *drive, u8 speed)
index 2b8009c50e91363c1316c3a8bbfad6208e823942..e245521af7b55d3aa9ae97c381c2234213183179 100644 (file)
@@ -40,9 +40,8 @@ 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, 1, &hwif);
+       index = ide_register_hw(&hw, NULL, 1, &hwif);
 
        if (index != -1) {
                printk(KERN_INFO "ide%d: generic PnP IDE interface\n", index);
index e294c7415c27aa048e9a734f3f4736f304e87483..d5146c57e5b3151e33bcb0defc4496d25bcef674 100644 (file)
@@ -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, void (*fixup)(ide_hwif_t *hwif))
+static void probe_hwif(ide_hwif_t *hwif)
 {
        unsigned long flags;
        unsigned int irqd;
@@ -819,8 +819,8 @@ static void probe_hwif(ide_hwif_t *hwif, void (*fixup)(ide_hwif_t *hwif))
                return;
        }
 
-       if (fixup)
-               fixup(hwif);
+       if (hwif->fixup)
+               hwif->fixup(hwif);
 
        for (unit = 0; unit < MAX_DRIVES; ++unit) {
                ide_drive_t *drive = &hwif->drives[unit];
@@ -859,10 +859,11 @@ static void probe_hwif(ide_hwif_t *hwif, void (*fixup)(ide_hwif_t *hwif))
 }
 
 static int hwif_init(ide_hwif_t *hwif);
+static void hwif_register_devices(ide_hwif_t *hwif);
 
-int probe_hwif_init_with_fixup(ide_hwif_t *hwif, void (*fixup)(ide_hwif_t *hwif))
+static int probe_hwif_init(ide_hwif_t *hwif)
 {
-       probe_hwif(hwif, fixup);
+       probe_hwif(hwif);
 
        if (!hwif_init(hwif)) {
                printk(KERN_INFO "%s: failed to initialize IDE interface\n",
@@ -870,34 +871,12 @@ int probe_hwif_init_with_fixup(ide_hwif_t *hwif, void (*fixup)(ide_hwif_t *hwif)
                return -1;
        }
 
-       if (hwif->present) {
-               u16 unit = 0;
-               int ret;
+       if (hwif->present)
+               hwif_register_devices(hwif);
 
-               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.
@@ -1379,6 +1358,24 @@ out:
        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;
@@ -1390,27 +1387,18 @@ int ideprobe_init (void)
 
        for (index = 0; index < MAX_HWIFS; ++index)
                if (probe[index])
-                       probe_hwif(&ide_hwifs[index], NULL);
+                       probe_hwif(&ide_hwifs[index]);
        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;
-                       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);
-                               }
+                       hwif_register_devices(hwif);
                }
        }
        for (index = 0; index < MAX_HWIFS; ++index)
@@ -1420,3 +1408,22 @@ 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);
index fc1d8ae6a80381d08937faf4dc5d2fd687d33c7c..a4007d30da520c091491f4ca6e9923b9cc83d232 100644 (file)
@@ -804,8 +804,6 @@ 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)
 {
index b463cef2de63b831afdadcc3870f11057a9ff95c..7b9181b5469d3be9d3e8e0929c5a0c2d4122c8d5 100644 (file)
@@ -621,7 +621,6 @@ typedef struct os_dat_s {
  */
 #define USE_IOTRACE    0
 #if USE_IOTRACE
-#include <linux/io_trace.h>
 #define IO_IDETAPE_FIFO        500
 #endif
 
index 2a3c8d498343ff417f398d1fb4b93e8678dbf82f..73ef6bf5fbcc51470f6638f81766c63cd86b755d 100644 (file)
@@ -8,23 +8,6 @@
  *  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 <linux/module.h>
@@ -695,9 +678,6 @@ 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. <andre@linux-ide.org>
- */
 int ide_cmd_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg)
 {
        int err = 0;
@@ -761,9 +741,6 @@ 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. <andre@linux-ide.org>
- */
 int ide_task_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg)
 {
        void __user *p = (void __user *)arg;
@@ -860,9 +837,14 @@ 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:
-                       hwif->dma_setup(drive);
-                       hwif->dma_exec_cmd(drive, taskfile->command);
-                       hwif->dma_start(drive);
+                       if (!drive->using_dma)
+                               break;
+
+                       if (!hwif->dma_setup(drive)) {
+                               hwif->dma_exec_cmd(drive, taskfile->command);
+                               hwif->dma_start(drive);
+                               return ide_started;
+                       }
                        break;
 
                default:
@@ -876,7 +858,8 @@ 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_started;
+       return ide_stopped;
 }
index 961e6c897286e7a1245d7c56ba3eda2420374761..674a65c1a1308986743237c46792a6c7661d1c7c 100644 (file)
@@ -168,7 +168,6 @@ 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];
@@ -214,7 +213,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->hw.irq =
+               hwif->irq =
                        ide_init_default_irq(hwif->io_ports[IDE_DATA_OFFSET]);
 #endif
        }
@@ -265,6 +264,30 @@ 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)
 {
@@ -391,6 +414,8 @@ 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;
@@ -652,7 +677,6 @@ void ide_setup_ports (      hw_regs_t *hw,
                }
        }
        hw->irq = irq;
-       hw->dma = NO_DMA;
        hw->ack_intr = ack_intr;
 /*
  *     hw->iops = iops;
@@ -660,11 +684,11 @@ void ide_setup_ports (    hw_regs_t *hw,
 }
 
 /**
- *     ide_register_hw_with_fixup      -       register IDE interface
+ *     ide_register_hw         -       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.
@@ -672,9 +696,8 @@ void ide_setup_ports (      hw_regs_t *hw,
  *     Returns -1 on error.
  */
 
-int ide_register_hw_with_fixup(hw_regs_t *hw, int initializing,
-                              ide_hwif_t **hwifp,
-                              void(*fixup)(ide_hwif_t *hwif))
+int ide_register_hw(hw_regs_t *hw, void (*fixup)(ide_hwif_t *),
+                   int initializing, ide_hwif_t **hwifp)
 {
        int index, retry = 1;
        ide_hwif_t *hwif;
@@ -682,7 +705,7 @@ int ide_register_hw_with_fixup(hw_regs_t *hw, int initializing,
        do {
                for (index = 0; index < MAX_HWIFS; ++index) {
                        hwif = &ide_hwifs[index];
-                       if (hwif->hw.io_ports[IDE_DATA_OFFSET] == hw->io_ports[IDE_DATA_OFFSET])
+                       if (hwif->io_ports[IDE_DATA_OFFSET] == hw->io_ports[IDE_DATA_OFFSET])
                                goto found;
                }
                for (index = 0; index < MAX_HWIFS; ++index) {
@@ -690,7 +713,7 @@ int ide_register_hw_with_fixup(hw_regs_t *hw, int initializing,
                        if (hwif->hold)
                                continue;
                        if ((!hwif->present && !hwif->mate && !initializing) ||
-                           (!hwif->hw.io_ports[IDE_DATA_OFFSET] && initializing))
+                           (!hwif->io_ports[IDE_DATA_OFFSET] && initializing))
                                goto found;
                }
                for (index = 0; index < MAX_HWIFS; index++)
@@ -706,16 +729,18 @@ found:
        }
        if (hwif->present)
                return -1;
-       memcpy(&hwif->hw, hw, sizeof(*hw));
-       memcpy(hwif->io_ports, hwif->hw.io_ports, sizeof(hwif->hw.io_ports));
+       memcpy(hwif->io_ports, hw->io_ports, sizeof(hwif->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 };
 
-       if (!initializing) {
-               probe_hwif_init_with_fixup(hwif, fixup);
-               ide_proc_register_port(hwif);
+               ide_device_add(idx);
        }
 
        if (hwifp)
@@ -724,13 +749,6 @@ found:
        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);
 
 /*
@@ -1046,7 +1064,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, 0, NULL) == -1)
+                       if (ide_register_hw(&hw, NULL, 0, NULL) == -1)
                                return -EIO;
                        return 0;
                }
@@ -1397,6 +1415,9 @@ 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);
@@ -1506,9 +1527,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 */
-                               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));
+                               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->irq      = vals[2];
                                hwif->noprobe  = 0;
                                hwif->chipset  = ide_forced;
index 2f0ef9b440335d9e1f6654c54424a4faa30b145a..10311ecc674a4440511de0b4b27d0601d3718a45 100644 (file)
@@ -102,6 +102,8 @@ 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
@@ -129,14 +131,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(&ide_lock, flags);
+       spin_lock_irqsave(&ali14xx_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(&ide_lock, flags);
+       spin_unlock_irqrestore(&ali14xx_lock, flags);
 }
 
 /*
@@ -193,6 +195,7 @@ 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);
@@ -217,11 +220,7 @@ static int __init ali14xx_probe(void)
        mate->mate = hwif;
        mate->channel = 1;
 
-       probe_hwif_init(hwif);
-       probe_hwif_init(mate);
-
-       ide_proc_register_port(hwif);
-       ide_proc_register_port(mate);
+       ide_device_add(idx);
 
        return 0;
 }
index 101aee1711c489c7985bc1d730e3ca6fb1452c29..4a0be251a05fd84ddaa606c2b1161c2c99d93a59 100644 (file)
@@ -212,8 +212,8 @@ fail_base2:
 //                                             xsurf_iops,
                                                IRQ_AMIGA_PORTS);
                        }       
-                       
-                       index = ide_register_hw(&hw, 1, &hwif);
+
+                       index = ide_register_hw(&hw, NULL, 1, &hwif);
                        if (index != -1) {
                                hwif->mmio = 1;
                                printk("ide%d: ", index);
index f165212548673729f412bbfb031aea67ba20c49c..24a845d45bd29b369001979b9b24cede2c6bda05 100644 (file)
@@ -67,20 +67,24 @@ 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(&ide_lock, flags);
+               spin_lock_irqsave(&dtc2278_lock, flags);
                /*
                 * This enables PIO mode4 (3?) on the first interface
                 */
                sub22(1,0xc3);
                sub22(0,0xa0);
-               spin_unlock_irqrestore(&ide_lock, flags);
+               spin_unlock_irqrestore(&dtc2278_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 */
        }
 
        /*
@@ -94,6 +98,7 @@ 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];
@@ -129,16 +134,13 @@ 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;
 
-       probe_hwif_init(hwif);
-       probe_hwif_init(mate);
-
-       ide_proc_register_port(hwif);
-       ide_proc_register_port(mate);
+       ide_device_add(idx);
 
        return 0;
 }
index f0829b83e970db20c5f7a500eee860bf1aa484a2..7d7936f1b9007b06c50bfe477f1171ef49a33150 100644 (file)
@@ -72,7 +72,7 @@ void __init falconide_init(void)
                        0, 0, NULL,
 //                     falconide_iops,
                        IRQ_MFP_IDE);
-       index = ide_register_hw(&hw, 1, NULL);
+       index = ide_register_hw(&hw, NULL, 1, NULL);
 
        if (index != -1)
            printk("ide%d: Falcon IDE interface\n", index);
index 0830a021bbb609d4b103dc037239a0f2ec5bc934..53331ee1e957c9a71c651a2eeb3c5ae2aaa191bf 100644 (file)
@@ -165,7 +165,7 @@ found:
 //                     &gayle_iops,
                        IRQ_AMIGA_PORTS);
 
-       index = ide_register_hw(&hw, 1, &hwif);
+       index = ide_register_hw(&hw, NULL, 1, &hwif);
        if (index != -1) {
            hwif->mmio = 1;
            switch (i) {
index 2e5a9cc5c0f7ab1a48a2b26bef35ca12922f4837..a4245d13f11b83d2dced3d1f82d33f0caa6c34e7 100644 (file)
@@ -247,6 +247,8 @@ static u8 ht_pio2timings(ide_drive_t *drive, const u8 pio)
        }
 }
 
+static DEFINE_SPINLOCK(ht6560b_lock);
+
 /*
  *  Enable/Disable so called prefetch mode
  */
@@ -254,9 +256,9 @@ static void ht_set_prefetch(ide_drive_t *drive, u8 state)
 {
        unsigned long flags;
        int t = HT_PREFETCH_MODE << 8;
-       
-       spin_lock_irqsave(&ide_lock, flags);
-       
+
+       spin_lock_irqsave(&ht6560b_lock, flags);
+
        /*
         *  Prefetch mode and unmask irq seems to conflict
         */
@@ -268,9 +270,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(&ide_lock, flags);
-       
+
+       spin_unlock_irqrestore(&ht6560b_lock, flags);
+
 #ifdef DEBUG
        printk("ht6560b: drive %s prefetch mode %sabled\n", drive->name, (state ? "en" : "dis"));
 #endif
@@ -287,16 +289,14 @@ 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(&ide_lock, flags);
-       
+
+       spin_lock_irqsave(&ht6560b_lock, flags);
        drive->drive_data &= 0xff00;
        drive->drive_data |= timing;
-       
-       spin_unlock_irqrestore(&ide_lock, flags);
-       
+       spin_unlock_irqrestore(&ht6560b_lock, flags);
+
 #ifdef DEBUG
        printk("ht6560b: drive %s tuned to pio mode %#x timing=%#x\n", drive->name, pio, timing);
 #endif
@@ -311,6 +311,7 @@ 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)
@@ -359,11 +360,7 @@ int __init ht6560b_init(void)
        mate->drives[0].drive_data = t;
        mate->drives[1].drive_data = t;
 
-       probe_hwif_init(hwif);
-       probe_hwif_init(mate);
-
-       ide_proc_register_port(hwif);
-       ide_proc_register_port(mate);
+       ide_device_add(idx);
 
        return 0;
 
index e8e360c2619d1eea7365ae2bd5645716834c97f5..03715c05866408b1d14773e365d265d74b7194c4 100644 (file)
@@ -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_with_fixup(&hw, 0, NULL, ide_undecoded_slave);
+    return ide_register_hw(&hw, &ide_undecoded_slave, 0, NULL);
 }
 
 /*======================================================================
index b992b2b91fe2ba684dadbc7345ffb96d4161f8bc..7bb79f53dac804e708ef6a49e110804d903f993d 100644 (file)
@@ -33,39 +33,24 @@ static ide_hwif_t *__devinit plat_ide_locate_hwif(void __iomem *base,
            int mmio)
 {
        unsigned long port = (unsigned long)base;
-       ide_hwif_t *hwif;
-       int index, i;
-
-       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;
-       }
+       ide_hwif_t *hwif = ide_find_port(port);
+       int i;
 
-       return NULL;
-
-found:
+       if (hwif == NULL)
+               goto out;
 
-       hwif->hw.io_ports[IDE_DATA_OFFSET] = port;
+       hwif->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->hw.io_ports[i] = port;
+               hwif->io_ports[i] = port;
 
-       hwif->hw.io_ports[IDE_CONTROL_OFFSET] = (unsigned long)ctrl;
+       hwif->io_ports[IDE_CONTROL_OFFSET] = (unsigned long)ctrl;
 
-       memcpy(hwif->io_ports, hwif->hw.io_ports, sizeof(hwif->hw.io_ports));
-       hwif->hw.irq = hwif->irq = irq;
+       hwif->irq = irq;
 
-       hwif->hw.dma = NO_DMA;
-       hwif->chipset = hwif->hw.chipset = ide_generic;
+       hwif->chipset = ide_generic;
 
        if (mmio) {
                hwif->mmio = 1;
@@ -73,8 +58,8 @@ found:
        }
 
        hwif_prop.hwif = hwif;
-       hwif_prop.index = index;
-
+       hwif_prop.index = hwif->index;
+out:
        return hwif;
 }
 
@@ -83,6 +68,7 @@ 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;
 
@@ -130,10 +116,11 @@ static int __devinit plat_ide_probe(struct platform_device *pdev)
        hwif->gendev.parent = &pdev->dev;
        hwif->noprobe = 0;
 
-       probe_hwif_init(hwif);
+       idx[0] = hwif->index;
+
+       ide_device_add(idx);
 
        platform_set_drvdata(pdev, hwif);
-       ide_proc_register_port(hwif);
 
        return 0;
 
index b557c45a5a9dc614e7aa556e07554f5b3623457a..e87cd2f16430a6555e4f7e88fca5ee1e17d0e3e0 100644 (file)
@@ -93,21 +93,21 @@ void macide_init(void)
                                0, 0, macide_ack_intr,
 //                             quadra_ide_iops,
                                IRQ_NUBUS_F);
-               index = ide_register_hw(&hw, 1, &hwif);
+               index = ide_register_hw(&hw, NULL, 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, 1, &hwif);
+               index = ide_register_hw(&hw, NULL, 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, 1, &hwif);
+               index = ide_register_hw(&hw, NULL, 1, &hwif);
                if (index == -1) break;
                if (macintosh_config->ident == MAC_MODEL_PB190) {
 
index 16ba70b460967212df4e9d8c92de675dd9f6fbc3..a73db1bd482d6ecbdcf023f72aba169e61595f4b 100644 (file)
@@ -89,9 +89,8 @@ 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;
@@ -142,7 +141,7 @@ void q40ide_init(void)
                        0, NULL,
 //                     m68kide_iops,
                        q40ide_default_irq(pcide_bases[i]));
-       index = ide_register_hw(&hw, 1, &hwif);
+       index = ide_register_hw(&hw, NULL, 1, &hwif);
        // **FIXME**
        if (index != -1)
                hwif->mmio = 1;
index 0c81d2d0b9418a2a2f7db1ca85a119b1038b41b9..912e73853faa1b3fa2082031cd6687e95be94dde 100644 (file)
 
 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:
  *
@@ -121,7 +101,7 @@ static void qd_select (ide_drive_t *drive)
                        (QD_TIMREG(drive) & 0x02);
 
        if (timings[index] != QD_TIMING(drive))
-               qd_write_reg(timings[index] = QD_TIMING(drive), QD_TIMREG(drive));
+               outb(timings[index] = QD_TIMING(drive), QD_TIMREG(drive));
 }
 
 /*
@@ -284,7 +264,7 @@ static void qd6580_set_pio_mode(ide_drive_t *drive, const u8 pio)
        }
 
        if (!HWIF(drive)->channel && drive->media != ide_disk) {
-               qd_write_reg(0x5f, QD_CONTROL_PORT);
+               outb(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);
@@ -301,16 +281,15 @@ 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;
 
-       spin_lock_irqsave(&ide_lock, flags);
+       local_irq_save(flags);
        savereg = inb_p(port);
        outb_p(QD_TESTVAL, port);       /* safe value */
        readreg = inb_p(port);
        outb(savereg, port);
-       spin_unlock_irqrestore(&ide_lock, flags);
+       local_irq_restore(flags);
 
        if (savereg == QD_TESTVAL) {
                printk(KERN_ERR "Outch ! the probe for qd65xx isn't reliable !\n");
@@ -364,13 +343,13 @@ static void __exit qd_unsetup(ide_hwif_t *hwif)
 
        if (set_pio_mode == (void *)qd6500_set_pio_mode) {
                // will do it for both
-               qd_write_reg(QD6500_DEF_DATA, QD_TIMREG(&hwif->drives[0]));
+               outb(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) {
-                       qd_write_reg(QD6580_DEF_DATA, QD_TIMREG(&hwif->drives[0]));
-                       qd_write_reg(QD6580_DEF_DATA2, QD_TIMREG(&hwif->drives[1]));
+                       outb(QD6580_DEF_DATA, QD_TIMREG(&hwif->drives[0]));
+                       outb(QD6580_DEF_DATA2, QD_TIMREG(&hwif->drives[1]));
                } else {
-                       qd_write_reg(hwif->channel ? QD6580_DEF_DATA2 : QD6580_DEF_DATA, QD_TIMREG(&hwif->drives[0]));
+                       outb(hwif->channel ? QD6580_DEF_DATA2 : QD6580_DEF_DATA, QD_TIMREG(&hwif->drives[0]));
                }
        } else {
                printk(KERN_WARNING "Unknown qd65xx tuning fonction !\n");
@@ -389,10 +368,11 @@ 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 = qd_read_reg(QD_CONFIG_PORT);
+       config = inb(QD_CONFIG_PORT);
 
        if (! ((config & QD_CONFIG_BASEPORT) >> 1 == (base == 0xb0)) )
                return 1;
@@ -419,9 +399,9 @@ static int __init qd_probe(int base)
 
                hwif->set_pio_mode = &qd6500_set_pio_mode;
 
-               probe_hwif_init(hwif);
+               idx[0] = unit;
 
-               ide_proc_register_port(hwif);
+               ide_device_add(idx);
 
                return 1;
        }
@@ -436,7 +416,7 @@ static int __init qd_probe(int base)
 
                /* qd6580 found */
 
-               control = qd_read_reg(QD_CONTROL_PORT);
+               control = inb(QD_CONTROL_PORT);
 
                printk(KERN_NOTICE "qd6580 at %#x\n", base);
                printk(KERN_DEBUG "qd6580: config=%#x, control=%#x, ID3=%u\n",
@@ -453,11 +433,11 @@ static int __init qd_probe(int base)
 
                        hwif->set_pio_mode = &qd6580_set_pio_mode;
 
-                       probe_hwif_init(hwif);
+                       idx[0] = unit;
 
-                       qd_write_reg(QD_DEF_CONTR,QD_CONTROL_PORT);
+                       ide_device_add(idx);
 
-                       ide_proc_register_port(hwif);
+                       outb(QD_DEF_CONTR, QD_CONTROL_PORT);
 
                        return 1;
                } else {
@@ -474,19 +454,17 @@ 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;
 
-                       probe_hwif_init(mate);
+                       idx[0] = 0;
+                       idx[1] = 1;
 
-                       qd_write_reg(QD_DEF_CONTR,QD_CONTROL_PORT);
+                       ide_device_add(idx);
 
-                       ide_proc_register_port(hwif);
-                       ide_proc_register_port(mate);
+                       outb(QD_DEF_CONTR, QD_CONTROL_PORT);
 
                        return 0; /* no other qd65xx possible */
                }
index 1151c92dd5318dfc8681771143322f7d1e4e3480..79577b916874d085fa96dbf2c2036301e129ef11 100644 (file)
@@ -124,8 +124,9 @@ static void umc_set_pio_mode(ide_drive_t *drive, const u8 pio)
 
 static int __init umc8672_probe(void)
 {
-       unsigned long flags;
        ide_hwif_t *hwif, *mate;
+       unsigned long flags;
+       static u8 idx[4] = { 0, 1, 0xff, 0xff };
 
        if (!request_region(0x108, 2, "umc8672")) {
                printk(KERN_ERR "umc8672: ports 0x108-0x109 already in use.\n");
@@ -158,11 +159,7 @@ static int __init umc8672_probe(void)
        mate->mate = hwif;
        mate->channel = 1;
 
-       probe_hwif_init(hwif);
-       probe_hwif_init(mate);
-
-       ide_proc_register_port(hwif);
-       ide_proc_register_port(mate);
+       ide_device_add(idx);
 
        return 0;
 }
index 2f322d7e881bc95dcdade00ad6ed27115ddf53e5..1de58566e5b618aede51102965e7ed6f574a8a18 100644 (file)
@@ -601,8 +601,9 @@ 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";
@@ -644,12 +645,12 @@ static int au_ide_probe(struct device *dev)
        /* FIXME:  This might possibly break PCMCIA IDE devices */
 
        hwif                            = &ide_hwifs[pdev->id];
-       hw                              = &hwif->hw;
-       hwif->irq = hw->irq             = ahwif->irq;
+       hwif->irq                       = ahwif->irq;
        hwif->chipset                   = ide_au1xxx;
 
-       auide_setup_ports(hw, ahwif);
-       memcpy(hwif->io_ports, hw->io_ports, sizeof(hwif->io_ports));
+       memset(&hw, 0, sizeof(hw));
+       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
@@ -706,8 +707,10 @@ 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[0].no_io_32bit     = 1;
+       hwif->drives[1].no_io_32bit     = 1;
 
        auide_hwif.hwif                 = hwif;
        hwif->hwif_data                 = &auide_hwif;
@@ -717,9 +720,9 @@ static int au_ide_probe(struct device *dev)
        dbdma_init_done = 1;
 #endif
 
-       probe_hwif_init(hwif);
+       idx[0] = hwif->index;
 
-       ide_proc_register_port(hwif);
+       ide_device_add(idx);
 
        dev_set_drvdata(dev, hwif);
 
index c2e29571b0075d3647d2978f24c281cf4d0e7d0f..521edd41b572b0e9c00a82d218c9ec91acb72046 100644 (file)
@@ -71,6 +71,7 @@ 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;
@@ -119,18 +120,15 @@ static int __devinit swarm_ide_probe(struct device *dev)
        hwif->noprobe = 0;
 
        for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++)
-               hwif->hw.io_ports[i] =
+               hwif->io_ports[i] =
                                (unsigned long)(base + ((0x1f0 + i) << 5));
-       hwif->hw.io_ports[IDE_CONTROL_OFFSET] =
+       hwif->io_ports[IDE_CONTROL_OFFSET] =
                                (unsigned long)(base + (0x3f6 << 5));
-       hwif->hw.irq = K_INT_GB_IDE;
+       hwif->irq = K_INT_GB_IDE;
 
-       memcpy(hwif->io_ports, hwif->hw.io_ports, sizeof(hwif->io_ports));
-       hwif->irq = hwif->hw.irq;
+       idx[0] = hwif->index;
 
-       probe_hwif_init(hwif);
-
-       ide_proc_register_port(hwif);
+       ide_device_add(idx);
 
        dev_set_drvdata(dev, hwif);
 
index b3dc12a70d51beeb27973b4ac6d9a6174668bbfb..19ec421f7b9f4c2f4871c74069c9dd0fa9db46e2 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * linux/drivers/ide/pci/aec62xx.c             Version 0.26    Sep 1, 2007
+ * linux/drivers/ide/pci/aec62xx.c             Version 0.27    Sep 16, 2007
  *
  * Copyright (C) 1999-2002     Andre Hedrick <andre@linux-ide.org>
  * Copyright (C) 2007          MontaVista Software, Inc. <source@mvista.com>
@@ -141,19 +141,6 @@ 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();
@@ -195,8 +182,6 @@ 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;
 
@@ -209,7 +194,7 @@ static void __devinit init_hwif_aec62xx(ide_hwif_t *hwif)
        }
 }
 
-static ide_pci_device_t aec62xx_chipsets[] __devinitdata = {
+static const struct ide_port_info aec62xx_chipsets[] __devinitdata = {
        {       /* 0 */
                .name