diff options
256 files changed, 2866 insertions, 2060 deletions
diff --git a/.gitignore b/.gitignore index 22fb8fa9bc3d..8d14531846b9 100644 --- a/.gitignore +++ b/.gitignore | |||
| @@ -12,6 +12,7 @@ | |||
| 12 | *.s | 12 | *.s |
| 13 | *.ko | 13 | *.ko |
| 14 | *.so | 14 | *.so |
| 15 | *.so.dbg | ||
| 15 | *.mod.c | 16 | *.mod.c |
| 16 | *.i | 17 | *.i |
| 17 | *.lst | 18 | *.lst |
diff --git a/Documentation/device-mapper/dm-uevent.txt b/Documentation/device-mapper/dm-uevent.txt new file mode 100644 index 000000000000..07edbd85c714 --- /dev/null +++ b/Documentation/device-mapper/dm-uevent.txt | |||
| @@ -0,0 +1,97 @@ | |||
| 1 | The device-mapper uevent code adds the capability to device-mapper to create | ||
| 2 | and send kobject uevents (uevents). Previously device-mapper events were only | ||
| 3 | available through the ioctl interface. The advantage of the uevents interface | ||
| 4 | is the event contains environment attributes providing increased context for | ||
| 5 | the event avoiding the need to query the state of the device-mapper device after | ||
| 6 | the event is received. | ||
| 7 | |||
| 8 | There are two functions currently for device-mapper events. The first function | ||
| 9 | listed creates the event and the second function sends the event(s). | ||
| 10 | |||
| 11 | void dm_path_uevent(enum dm_uevent_type event_type, struct dm_target *ti, | ||
| 12 | const char *path, unsigned nr_valid_paths) | ||
| 13 | |||
| 14 | void dm_send_uevents(struct list_head *events, struct kobject *kobj) | ||
| 15 | |||
| 16 | |||
| 17 | The variables added to the uevent environment are: | ||
| 18 | |||
| 19 | Variable Name: DM_TARGET | ||
| 20 | Uevent Action(s): KOBJ_CHANGE | ||
| 21 | Type: string | ||
| 22 | Description: | ||
| 23 | Value: Name of device-mapper target that generated the event. | ||
| 24 | |||
| 25 | Variable Name: DM_ACTION | ||
| 26 | Uevent Action(s): KOBJ_CHANGE | ||
| 27 | Type: string | ||
| 28 | Description: | ||
| 29 | Value: Device-mapper specific action that caused the uevent action. | ||
| 30 | PATH_FAILED - A path has failed. | ||
| 31 | PATH_REINSTATED - A path has been reinstated. | ||
| 32 | |||
| 33 | Variable Name: DM_SEQNUM | ||
| 34 | Uevent Action(s): KOBJ_CHANGE | ||
| 35 | Type: unsigned integer | ||
| 36 | Description: A sequence number for this specific device-mapper device. | ||
| 37 | Value: Valid unsigned integer range. | ||
| 38 | |||
| 39 | Variable Name: DM_PATH | ||
| 40 | Uevent Action(s): KOBJ_CHANGE | ||
| 41 | Type: string | ||
| 42 | Description: Major and minor number of the path device pertaining to this | ||
| 43 | event. | ||
| 44 | Value: Path name in the form of "Major:Minor" | ||
| 45 | |||
| 46 | Variable Name: DM_NR_VALID_PATHS | ||
| 47 | Uevent Action(s): KOBJ_CHANGE | ||
| 48 | Type: unsigned integer | ||
| 49 | Description: | ||
| 50 | Value: Valid unsigned integer range. | ||
| 51 | |||
| 52 | Variable Name: DM_NAME | ||
| 53 | Uevent Action(s): KOBJ_CHANGE | ||
| 54 | Type: string | ||
| 55 | Description: Name of the device-mapper device. | ||
| 56 | Value: Name | ||
| 57 | |||
| 58 | Variable Name: DM_UUID | ||
| 59 | Uevent Action(s): KOBJ_CHANGE | ||
| 60 | Type: string | ||
| 61 | Description: UUID of the device-mapper device. | ||
| 62 | Value: UUID. (Empty string if there isn't one.) | ||
| 63 | |||
| 64 | An example of the uevents generated as captured by udevmonitor is shown | ||
| 65 | below. | ||
| 66 | |||
| 67 | 1.) Path failure. | ||
| 68 | UEVENT[1192521009.711215] change@/block/dm-3 | ||
| 69 | ACTION=change | ||
| 70 | DEVPATH=/block/dm-3 | ||
| 71 | SUBSYSTEM=block | ||
| 72 | DM_TARGET=multipath | ||
| 73 | DM_ACTION=PATH_FAILED | ||
| 74 | DM_SEQNUM=1 | ||
| 75 | DM_PATH=8:32 | ||
| 76 | DM_NR_VALID_PATHS=0 | ||
| 77 | DM_NAME=mpath2 | ||
| 78 | DM_UUID=mpath-35333333000002328 | ||
| 79 | MINOR=3 | ||
| 80 | MAJOR=253 | ||
| 81 | SEQNUM=1130 | ||
| 82 | |||
| 83 | 2.) Path reinstate. | ||
| 84 | UEVENT[1192521132.989927] change@/block/dm-3 | ||
| 85 | ACTION=change | ||
| 86 | DEVPATH=/block/dm-3 | ||
| 87 | SUBSYSTEM=block | ||
| 88 | DM_TARGET=multipath | ||
| 89 | DM_ACTION=PATH_REINSTATED | ||
| 90 | DM_SEQNUM=2 | ||
| 91 | DM_PATH=8:32 | ||
| 92 | DM_NR_VALID_PATHS=1 | ||
| 93 | DM_NAME=mpath2 | ||
| 94 | DM_UUID=mpath-35333333000002328 | ||
| 95 | MINOR=3 | ||
| 96 | MAJOR=253 | ||
| 97 | SEQNUM=1131 | ||
diff --git a/Documentation/kbuild/kconfig-language.txt b/Documentation/kbuild/kconfig-language.txt index fe8b0c4892cf..616043a6da99 100644 --- a/Documentation/kbuild/kconfig-language.txt +++ b/Documentation/kbuild/kconfig-language.txt | |||
| @@ -77,7 +77,12 @@ applicable everywhere (see syntax). | |||
| 77 | Optionally, dependencies only for this default value can be added with | 77 | Optionally, dependencies only for this default value can be added with |
| 78 | "if". | 78 | "if". |
| 79 | 79 | ||
| 80 | - dependencies: "depends on"/"requires" <expr> | 80 | - type definition + default value: |
| 81 | "def_bool"/"def_tristate" <expr> ["if" <expr>] | ||
| 82 | This is a shorthand notation for a type definition plus a value. | ||
| 83 | Optionally dependencies for this default value can be added with "if". | ||
| 84 | |||
| 85 | - dependencies: "depends on" <expr> | ||
| 81 | This defines a dependency for this menu entry. If multiple | 86 | This defines a dependency for this menu entry. If multiple |
| 82 | dependencies are defined, they are connected with '&&'. Dependencies | 87 | dependencies are defined, they are connected with '&&'. Dependencies |
| 83 | are applied to all other options within this menu entry (which also | 88 | are applied to all other options within this menu entry (which also |
| @@ -289,3 +294,10 @@ source: | |||
| 289 | "source" <prompt> | 294 | "source" <prompt> |
| 290 | 295 | ||
| 291 | This reads the specified configuration file. This file is always parsed. | 296 | This reads the specified configuration file. This file is always parsed. |
| 297 | |||
| 298 | mainmenu: | ||
| 299 | |||
| 300 | "mainmenu" <prompt> | ||
| 301 | |||
| 302 | This sets the config program's title bar if the config program chooses | ||
| 303 | to use it. | ||
diff --git a/Documentation/kbuild/makefiles.txt b/Documentation/kbuild/makefiles.txt index f099b814d383..6166e2d7da76 100644 --- a/Documentation/kbuild/makefiles.txt +++ b/Documentation/kbuild/makefiles.txt | |||
| @@ -518,6 +518,28 @@ more details, with real examples. | |||
| 518 | In this example for a specific GCC version the build will error out explaining | 518 | In this example for a specific GCC version the build will error out explaining |
| 519 | to the user why it stops. | 519 | to the user why it stops. |
| 520 | 520 | ||
| 521 | cc-cross-prefix | ||
| 522 | cc-cross-prefix is used to check if there exist a $(CC) in path with | ||
| 523 | one of the listed prefixes. The first prefix where there exist a | ||
| 524 | prefix$(CC) in the PATH is returned - and if no prefix$(CC) is found | ||
| 525 | then nothing is returned. | ||
| 526 | Additional prefixes are separated by a single space in the | ||
| 527 | call of cc-cross-prefix. | ||
| 528 | This functionality is usefull for architecture Makefile that try | ||
| 529 | to set CROSS_COMPILE to well know values but may have several | ||
| 530 | values to select between. | ||
| 531 | It is recommended only to try to set CROSS_COMPILE is it is a cross | ||
| 532 | build (host arch is different from target arch). And is CROSS_COMPILE | ||
| 533 | is already set then leave it with the old value. | ||
| 534 | |||
| 535 | Example: | ||
| 536 | #arch/m68k/Makefile | ||
| 537 | ifneq ($(SUBARCH),$(ARCH)) | ||
| 538 | ifeq ($(CROSS_COMPILE),) | ||
| 539 | CROSS_COMPILE := $(call cc-cross-prefix, m68k-linux-gnu-) | ||
| 540 | endif | ||
| 541 | endif | ||
| 542 | |||
| 521 | === 4 Host Program support | 543 | === 4 Host Program support |
| 522 | 544 | ||
| 523 | Kbuild supports building executables on the host for use during the | 545 | Kbuild supports building executables on the host for use during the |
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index 929734386fd9..6accd360da73 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt | |||
| @@ -419,8 +419,10 @@ and is between 256 and 4096 characters. It is defined in the file | |||
| 419 | over the 8254 in addition to over the IO-APIC. The | 419 | over the 8254 in addition to over the IO-APIC. The |
| 420 | kernel tries to set a sensible default. | 420 | kernel tries to set a sensible default. |
| 421 | 421 | ||
| 422 | hpet= [X86-32,HPET] option to disable HPET and use PIT. | 422 | hpet= [X86-32,HPET] option to control HPET usage |
| 423 | Format: disable | 423 | Format: { enable (default) | disable | force } |
| 424 | disable: disable HPET and use PIT instead | ||
| 425 | force: allow force enabled of undocumented chips (ICH4, VIA) | ||
| 424 | 426 | ||
| 425 | com20020= [HW,NET] ARCnet - COM20020 chipset | 427 | com20020= [HW,NET] ARCnet - COM20020 chipset |
| 426 | Format: | 428 | Format: |
diff --git a/MAINTAINERS b/MAINTAINERS index 2534dc4aa95a..4ed41394e492 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
| @@ -2178,7 +2178,7 @@ S: Maintained | |||
| 2178 | KCONFIG | 2178 | KCONFIG |
| 2179 | P: Roman Zippel | 2179 | P: Roman Zippel |
| 2180 | M: zippel@linux-m68k.org | 2180 | M: zippel@linux-m68k.org |
| 2181 | L: kbuild-devel@lists.sourceforge.net | 2181 | L: linux-kbuild@vger.kernel.org |
| 2182 | S: Maintained | 2182 | S: Maintained |
| 2183 | 2183 | ||
| 2184 | KDUMP | 2184 | KDUMP |
| @@ -2207,6 +2207,7 @@ KERNEL BUILD (kbuild: Makefile, scripts/Makefile.*) | |||
| 2207 | P: Sam Ravnborg | 2207 | P: Sam Ravnborg |
| 2208 | M: sam@ravnborg.org | 2208 | M: sam@ravnborg.org |
| 2209 | T: git kernel.org:/pub/scm/linux/kernel/git/sam/kbuild.git | 2209 | T: git kernel.org:/pub/scm/linux/kernel/git/sam/kbuild.git |
| 2210 | L: linux-kbuild@vger.kernel.org | ||
| 2210 | S: Maintained | 2211 | S: Maintained |
| 2211 | 2212 | ||
| 2212 | KERNEL JANITORS | 2213 | KERNEL JANITORS |
| @@ -887,10 +887,7 @@ prepare2: prepare3 outputmakefile | |||
| 887 | 887 | ||
| 888 | prepare1: prepare2 include/linux/version.h include/linux/utsrelease.h \ | 888 | prepare1: prepare2 include/linux/version.h include/linux/utsrelease.h \ |
| 889 | include/asm include/config/auto.conf | 889 | include/asm include/config/auto.conf |
| 890 | ifneq ($(KBUILD_MODULES),) | 890 | $(cmd_crmodverdir) |
| 891 | $(Q)mkdir -p $(MODVERDIR) | ||
| 892 | $(Q)rm -f $(MODVERDIR)/* | ||
| 893 | endif | ||
| 894 | 891 | ||
| 895 | archprepare: prepare1 scripts_basic | 892 | archprepare: prepare1 scripts_basic |
| 896 | 893 | ||
| @@ -906,14 +903,24 @@ prepare: prepare0 | |||
| 906 | 903 | ||
| 907 | export CPPFLAGS_vmlinux.lds += -P -C -U$(ARCH) | 904 | export CPPFLAGS_vmlinux.lds += -P -C -U$(ARCH) |
| 908 | 905 | ||
| 909 | # FIXME: The asm symlink changes when $(ARCH) changes. That's | 906 | # The asm symlink changes when $(ARCH) changes. |
| 910 | # hard to detect, but I suppose "make mrproper" is a good idea | 907 | # Detect this and ask user to run make mrproper |
| 911 | # before switching between archs anyway. | 908 | |
| 912 | 909 | include/asm: FORCE | |
| 913 | include/asm: | 910 | $(Q)set -e; asmlink=`readlink include/asm | cut -d '-' -f 2`; \ |
| 914 | @echo ' SYMLINK $@ -> include/asm-$(SRCARCH)' | 911 | if [ -L include/asm ]; then \ |
| 915 | $(Q)if [ ! -d include ]; then mkdir -p include; fi; | 912 | if [ "$$asmlink" != "$(SRCARCH)" ]; then \ |
| 916 | @ln -fsn asm-$(SRCARCH) $@ | 913 | echo "ERROR: the symlink $@ points to asm-$$asmlink but asm-$(SRCARCH) was expected"; \ |
| 914 | echo " set ARCH or save .config and run 'make mrproper' to fix it"; \ | ||
| 915 | exit 1; \ | ||
| 916 | fi; \ | ||
| 917 | else \ | ||
| 918 | echo ' SYMLINK $@ -> include/asm-$(SRCARCH)'; \ | ||
| 919 | if [ ! -d include ]; then \ | ||
| 920 | mkdir -p include; \ | ||
| 921 | fi; \ | ||
| 922 | ln -fsn asm-$(SRCARCH) $@; \ | ||
| 923 | fi | ||
| 917 | 924 | ||
| 918 | # Generate some files | 925 | # Generate some files |
| 919 | # --------------------------------------------------------------------------- | 926 | # --------------------------------------------------------------------------- |
| @@ -1023,19 +1030,12 @@ _modinst_: | |||
| 1023 | fi | 1030 | fi |
| 1024 | $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst | 1031 | $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst |
| 1025 | 1032 | ||
| 1026 | # If System.map exists, run depmod. This deliberately does not have a | 1033 | # This depmod is only for convenience to give the initial |
| 1027 | # dependency on System.map since that would run the dependency tree on | ||
| 1028 | # vmlinux. This depmod is only for convenience to give the initial | ||
| 1029 | # boot a modules.dep even before / is mounted read-write. However the | 1034 | # boot a modules.dep even before / is mounted read-write. However the |
| 1030 | # boot script depmod is the master version. | 1035 | # boot script depmod is the master version. |
| 1031 | ifeq "$(strip $(INSTALL_MOD_PATH))" "" | ||
| 1032 | depmod_opts := | ||
| 1033 | else | ||
| 1034 | depmod_opts := -b $(INSTALL_MOD_PATH) -r | ||
| 1035 | endif | ||
| 1036 | PHONY += _modinst_post | 1036 | PHONY += _modinst_post |
| 1037 | _modinst_post: _modinst_ | 1037 | _modinst_post: _modinst_ |
| 1038 | if [ -r System.map -a -x $(DEPMOD) ]; then $(DEPMOD) -ae -F System.map $(depmod_opts) $(KERNELRELEASE); fi | 1038 | $(call cmd,depmod) |
| 1039 | 1039 | ||
| 1040 | else # CONFIG_MODULES | 1040 | else # CONFIG_MODULES |
| 1041 | 1041 | ||
| @@ -1223,8 +1223,7 @@ else # KBUILD_EXTMOD | |||
| 1223 | KBUILD_MODULES := 1 | 1223 | KBUILD_MODULES := 1 |
| 1224 | PHONY += crmodverdir | 1224 | PHONY += crmodverdir |
| 1225 | crmodverdir: | 1225 | crmodverdir: |
| 1226 | $(Q)mkdir -p $(MODVERDIR) | 1226 | $(cmd_crmodverdir) |
| 1227 | $(Q)rm -f $(MODVERDIR)/* | ||
| 1228 | 1227 | ||
| 1229 | PHONY += $(objtree)/Module.symvers | 1228 | PHONY += $(objtree)/Module.symvers |
| 1230 | $(objtree)/Module.symvers: | 1229 | $(objtree)/Module.symvers: |
| @@ -1252,15 +1251,6 @@ _emodinst_: | |||
| 1252 | $(Q)mkdir -p $(MODLIB)/$(install-dir) | 1251 | $(Q)mkdir -p $(MODLIB)/$(install-dir) |
| 1253 | $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst | 1252 | $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst |
| 1254 | 1253 | ||
| 1255 | # Run depmod only is we have System.map and depmod is executable | ||
| 1256 | quiet_cmd_depmod = DEPMOD $(KERNELRELEASE) | ||
| 1257 | cmd_depmod = if [ -r System.map -a -x $(DEPMOD) ]; then \ | ||
| 1258 | $(DEPMOD) -ae -F System.map \ | ||
| 1259 | $(if $(strip $(INSTALL_MOD_PATH)), \ | ||
| 1260 | -b $(INSTALL_MOD_PATH) -r) \ | ||
| 1261 | $(KERNELRELEASE); \ | ||
| 1262 | fi | ||
| 1263 | |||
| 1264 | PHONY += _emodinst_post | 1254 | PHONY += _emodinst_post |
| 1265 | _emodinst_post: _emodinst_ | 1255 | _emodinst_post: _emodinst_ |
| 1266 | $(call cmd,depmod) | 1256 | $(call cmd,depmod) |
| @@ -1344,7 +1334,7 @@ define find-sources | |||
| 1344 | find $(__srctree)include/asm-generic $(RCS_FIND_IGNORE) \ | 1334 | find $(__srctree)include/asm-generic $(RCS_FIND_IGNORE) \ |
| 1345 | -name $1 -print; \ | 1335 | -name $1 -print; \ |
| 1346 | find $(__srctree) $(RCS_FIND_IGNORE) \ | 1336 | find $(__srctree) $(RCS_FIND_IGNORE) \ |
| 1347 | \( -name include -o -name arch \) -prune -o \ | 1337 | \( -name include -o -name arch -o -name '.tmp_*' \) -prune -o \ |
| 1348 | -name $1 -print; \ | 1338 | -name $1 -print; \ |
| 1349 | ) | 1339 | ) |
| 1350 | endef | 1340 | endef |
| @@ -1493,9 +1483,11 @@ endif | |||
| 1493 | 1483 | ||
| 1494 | # Modules | 1484 | # Modules |
| 1495 | / %/: prepare scripts FORCE | 1485 | / %/: prepare scripts FORCE |
| 1486 | $(cmd_crmodverdir) | ||
| 1496 | $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \ | 1487 | $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \ |
| 1497 | $(build)=$(build-dir) | 1488 | $(build)=$(build-dir) |
| 1498 | %.ko: prepare scripts FORCE | 1489 | %.ko: prepare scripts FORCE |
| 1490 | $(cmd_crmodverdir) | ||
| 1499 | $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \ | 1491 | $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \ |
| 1500 | $(build)=$(build-dir) $(@:.ko=.o) | 1492 | $(build)=$(build-dir) $(@:.ko=.o) |
| 1501 | $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost | 1493 | $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost |
| @@ -1509,6 +1501,19 @@ quiet_cmd_rmdirs = $(if $(wildcard $(rm-dirs)),CLEAN $(wildcard $(rm-dirs))) | |||
| 1509 | quiet_cmd_rmfiles = $(if $(wildcard $(rm-files)),CLEAN $(wildcard $(rm-files))) | 1501 | quiet_cmd_rmfiles = $(if $(wildcard $(rm-files)),CLEAN $(wildcard $(rm-files))) |
| 1510 | cmd_rmfiles = rm -f $(rm-files) | 1502 | cmd_rmfiles = rm -f $(rm-files) |
| 1511 | 1503 | ||
| 1504 | # Run depmod only is we have System.map and depmod is executable | ||
| 1505 | # and we build for the host arch | ||
| 1506 | quiet_cmd_depmod = DEPMOD $(KERNELRELEASE) | ||
| 1507 | cmd_depmod = \ | ||
| 1508 | if [ -r System.map -a -x $(DEPMOD) -a "$(SUBARCH)" == "$(ARCH)" ]; then \ | ||
| 1509 | $(DEPMOD) -ae -F System.map \ | ||
| 1510 | $(if $(strip $(INSTALL_MOD_PATH)), -b $(INSTALL_MOD_PATH) -r) \ | ||
| 1511 | $(KERNELRELEASE); \ | ||
| 1512 | fi | ||
| 1513 | |||
| 1514 | # Create temporary dir for module support files | ||
| 1515 | cmd_crmodverdir = $(Q)mkdir -p $(MODVERDIR); rm -f $(MODVERDIR)/* | ||
| 1516 | |||
| 1512 | 1517 | ||
| 1513 | a_flags = -Wp,-MD,$(depfile) $(KBUILD_AFLAGS) $(AFLAGS_KERNEL) \ | 1518 | a_flags = -Wp,-MD,$(depfile) $(KBUILD_AFLAGS) $(AFLAGS_KERNEL) \ |
| 1514 | $(NOSTDINC_FLAGS) $(KBUILD_CPPFLAGS) \ | 1519 | $(NOSTDINC_FLAGS) $(KBUILD_CPPFLAGS) \ |
diff --git a/arch/i386/Kconfig b/arch/i386/Kconfig index 7627e9bd8b44..f6e44fc5283c 100644 --- a/arch/i386/Kconfig +++ b/arch/i386/Kconfig | |||
| @@ -1080,7 +1080,7 @@ config APM_REAL_MODE_POWER_OFF | |||
| 1080 | 1080 | ||
| 1081 | endif # APM | 1081 | endif # APM |
| 1082 | 1082 | ||
| 1083 | source "arch/x86/kernel/cpu/cpufreq/Kconfig" | 1083 | source "arch/x86/kernel/cpu/cpufreq/Kconfig_32" |
| 1084 | 1084 | ||
| 1085 | source "drivers/cpuidle/Kconfig" | 1085 | source "drivers/cpuidle/Kconfig" |
| 1086 | 1086 | ||
diff --git a/arch/i386/Makefile b/arch/i386/Makefile index f036d2dee3de..b88e47ca3032 100644 --- a/arch/i386/Makefile +++ b/arch/i386/Makefile | |||
| @@ -102,7 +102,7 @@ core-$(CONFIG_XEN) += arch/x86/xen/ | |||
| 102 | # default subarch .h files | 102 | # default subarch .h files |
| 103 | mflags-y += -Iinclude/asm-x86/mach-default | 103 | mflags-y += -Iinclude/asm-x86/mach-default |
| 104 | 104 | ||
| 105 | head-y := arch/x86/kernel/head_32.o arch/x86/kernel/init_task_32.o | 105 | head-y := arch/x86/kernel/head_32.o arch/x86/kernel/init_task.o |
| 106 | 106 | ||
| 107 | libs-y += arch/x86/lib/ | 107 | libs-y += arch/x86/lib/ |
| 108 | core-y += arch/x86/kernel/ \ | 108 | core-y += arch/x86/kernel/ \ |
| @@ -131,9 +131,9 @@ all: bzImage | |||
| 131 | zImage zlilo zdisk: KBUILD_IMAGE := arch/x86/boot/zImage | 131 | zImage zlilo zdisk: KBUILD_IMAGE := arch/x86/boot/zImage |
| 132 | 132 | ||
| 133 | zImage bzImage: vmlinux | 133 | zImage bzImage: vmlinux |
| 134 | $(Q)mkdir -p $(objtree)/arch/i386/boot | ||
| 135 | $(Q)ln -fsn $(objtree)/arch/x86/boot/bzImage $(objtree)/arch/i386/boot/bzImage | ||
| 136 | $(Q)$(MAKE) $(build)=$(boot) $(KBUILD_IMAGE) | 134 | $(Q)$(MAKE) $(build)=$(boot) $(KBUILD_IMAGE) |
| 135 | $(Q)mkdir -p $(objtree)/arch/i386/boot | ||
| 136 | $(Q)ln -fsn ../../x86/boot/bzImage $(objtree)/arch/i386/boot/bzImage | ||
| 137 | 137 | ||
| 138 | compressed: zImage | 138 | compressed: zImage |
| 139 | 139 | ||
diff --git a/arch/x86/ia32/ia32_binfmt.c b/arch/x86/ia32/ia32_binfmt.c index 5027650eb273..55822d2cf053 100644 --- a/arch/x86/ia32/ia32_binfmt.c +++ b/arch/x86/ia32/ia32_binfmt.c | |||
| @@ -5,10 +5,6 @@ | |||
| 5 | * This tricks binfmt_elf.c into loading 32bit binaries using lots | 5 | * This tricks binfmt_elf.c into loading 32bit binaries using lots |
| 6 | * of ugly preprocessor tricks. Talk about very very poor man's inheritance. | 6 | * of ugly preprocessor tricks. Talk about very very poor man's inheritance. |
| 7 | */ | 7 | */ |
| 8 | #define __ASM_X86_64_ELF_H 1 | ||
| 9 | |||
| 10 | #undef ELF_CLASS | ||
| 11 | #define ELF_CLASS ELFCLASS32 | ||
| 12 | 8 | ||
| 13 | #include <linux/types.h> | 9 | #include <linux/types.h> |
| 14 | #include <linux/stddef.h> | 10 | #include <linux/stddef.h> |
| @@ -19,6 +15,7 @@ | |||
| 19 | #include <linux/binfmts.h> | 15 | #include <linux/binfmts.h> |
| 20 | #include <linux/mm.h> | 16 | #include <linux/mm.h> |
| 21 | #include <linux/security.h> | 17 | #include <linux/security.h> |
| 18 | #include <linux/elfcore-compat.h> | ||
| 22 | 19 | ||
| 23 | #include <asm/segment.h> | 20 | #include <asm/segment.h> |
| 24 | #include <asm/ptrace.h> | 21 | #include <asm/ptrace.h> |
| @@ -31,6 +28,20 @@ | |||
| 31 | #include <asm/ia32.h> | 28 | #include <asm/ia32.h> |
| 32 | #include <asm/vsyscall32.h> | 29 | #include <asm/vsyscall32.h> |
| 33 | 30 | ||
| 31 | #undef ELF_ARCH | ||
| 32 | #undef ELF_CLASS | ||
| 33 | #define ELF_CLASS ELFCLASS32 | ||
| 34 | #define ELF_ARCH EM_386 | ||
| 35 | |||
| 36 | #undef elfhdr | ||
| 37 | #undef elf_phdr | ||
| 38 | #undef elf_note | ||
| 39 | #undef elf_addr_t | ||
| 40 | #define elfhdr elf32_hdr | ||
| 41 | #define elf_phdr elf32_phdr | ||
| 42 | #define elf_note elf32_note | ||
| 43 | #define elf_addr_t Elf32_Off | ||
| 44 | |||
| 34 | #define ELF_NAME "elf/i386" | 45 | #define ELF_NAME "elf/i386" |
| 35 | 46 | ||
| 36 | #define AT_SYSINFO 32 | 47 | #define AT_SYSINFO 32 |
| @@ -48,74 +59,20 @@ int sysctl_vsyscall32 = 1; | |||
| 48 | } while(0) | 59 | } while(0) |
| 49 | 60 | ||
| 50 | struct file; | 61 | struct file; |
| 51 | struct elf_phdr; | ||
| 52 | 62 | ||
| 53 | #define IA32_EMULATOR 1 | 63 | #define IA32_EMULATOR 1 |
| 54 | 64 | ||
| 55 | #define ELF_ET_DYN_BASE (TASK_UNMAPPED_BASE + 0x1000000) | 65 | #undef ELF_ET_DYN_BASE |
| 56 | |||
| 57 | #undef ELF_ARCH | ||
| 58 | #define ELF_ARCH EM_386 | ||
| 59 | |||
| 60 | #define ELF_DATA ELFDATA2LSB | ||
| 61 | 66 | ||
| 62 | #define USE_ELF_CORE_DUMP 1 | 67 | #define ELF_ET_DYN_BASE (TASK_UNMAPPED_BASE + 0x1000000) |
| 63 | |||
| 64 | /* Override elfcore.h */ | ||
| 65 | #define _LINUX_ELFCORE_H 1 | ||
| 66 | typedef unsigned int elf_greg_t; | ||
| 67 | |||
| 68 | #define ELF_NGREG (sizeof (struct user_regs_struct32) / sizeof(elf_greg_t)) | ||
| 69 | typedef elf_greg_t elf_gregset_t[ELF_NGREG]; | ||
| 70 | |||
| 71 | struct elf_siginfo | ||
| 72 | { | ||
| 73 | int si_signo; /* signal number */ | ||
| 74 | int si_code; /* extra code */ | ||
| 75 | int si_errno; /* errno */ | ||
| 76 | }; | ||
| 77 | 68 | ||
| 78 | #define jiffies_to_timeval(a,b) do { (b)->tv_usec = 0; (b)->tv_sec = (a)/HZ; }while(0) | 69 | #define jiffies_to_timeval(a,b) do { (b)->tv_usec = 0; (b)->tv_sec = (a)/HZ; }while(0) |
| 79 | 70 | ||
| 80 | struct elf_prstatus | ||
| 81 | { | ||
| 82 | struct elf_siginfo pr_info; /* Info associated with signal */ | ||
| 83 | short pr_cursig; /* Current signal */ | ||
| 84 | unsigned int pr_sigpend; /* Set of pending signals */ | ||
| 85 | unsigned int pr_sighold; /* Set of held signals */ | ||
| 86 | pid_t pr_pid; | ||
| 87 | pid_t pr_ppid; | ||
| 88 | pid_t pr_pgrp; | ||
| 89 | pid_t pr_sid; | ||
| 90 | struct compat_timeval pr_utime; /* User time */ | ||
| 91 | struct compat_timeval pr_stime; /* System time */ | ||
| 92 | struct compat_timeval pr_cutime; /* Cumulative user time */ | ||
| 93 | struct compat_timeval pr_cstime; /* Cumulative system time */ | ||
| 94 | elf_gregset_t pr_reg; /* GP registers */ | ||
| 95 | int pr_fpvalid; /* True if math co-processor being used. */ | ||
| 96 | }; | ||
| 97 | |||
| 98 | #define ELF_PRARGSZ (80) /* Number of chars for args */ | ||
| 99 | |||
| 100 | struct elf_prpsinfo | ||
| 101 | { | ||
| 102 | char pr_state; /* numeric process state */ | ||
| 103 | char pr_sname; /* char for pr_state */ | ||
| 104 | char pr_zomb; /* zombie */ | ||
| 105 | char pr_nice; /* nice val */ | ||
| 106 | unsigned int pr_flag; /* flags */ | ||
| 107 | __u16 pr_uid; | ||
| 108 | __u16 pr_gid; | ||
| 109 | pid_t pr_pid, pr_ppid, pr_pgrp, pr_sid; | ||
| 110 | /* Lots missing */ | ||
| 111 | char pr_fname[16]; /* filename of executable */ | ||
| 112 | char pr_psargs[ELF_PRARGSZ]; /* initial part of arg list */ | ||
| 113 | }; | ||
| 114 | |||
| 115 | #define _GET_SEG(x) \ | 71 | #define _GET_SEG(x) \ |
| 116 | ({ __u32 seg; asm("movl %%" __stringify(x) ",%0" : "=r"(seg)); seg; }) | 72 | ({ __u32 seg; asm("movl %%" __stringify(x) ",%0" : "=r"(seg)); seg; }) |
| 117 | 73 | ||
| 118 | /* Assumes current==process to be dumped */ | 74 | /* Assumes current==process to be dumped */ |
| 75 | #undef ELF_CORE_COPY_REGS | ||
| 119 | #define ELF_CORE_COPY_REGS(pr_reg, regs) \ | 76 | #define ELF_CORE_COPY_REGS(pr_reg, regs) \ |
| 120 | pr_reg[0] = regs->rbx; \ | 77 | pr_reg[0] = regs->rbx; \ |
| 121 | pr_reg[1] = regs->rcx; \ | 78 | pr_reg[1] = regs->rcx; \ |
| @@ -135,36 +92,41 @@ struct elf_prpsinfo | |||
| 135 | pr_reg[15] = regs->rsp; \ | 92 | pr_reg[15] = regs->rsp; \ |
| 136 | pr_reg[16] = regs->ss; | 93 | pr_reg[16] = regs->ss; |
| 137 | 94 | ||
| 138 | #define user user32 | 95 | |
| 96 | #define elf_prstatus compat_elf_prstatus | ||
| 97 | #define elf_prpsinfo compat_elf_prpsinfo | ||
| 98 | #define elf_fpregset_t struct user_i387_ia32_struct | ||
| 99 | #define elf_fpxregset_t struct user32_fxsr_struct | ||
| 100 | #define user user32 | ||
| 139 | 101 | ||
| 140 | #undef elf_read_implies_exec | 102 | #undef elf_read_implies_exec |
| 141 | #define elf_read_implies_exec(ex, executable_stack) (executable_stack != EXSTACK_DISABLE_X) | 103 | #define elf_read_implies_exec(ex, executable_stack) (executable_stack != EXSTACK_DISABLE_X) |
| 142 | //#include <asm/ia32.h> | ||
| 143 | #include <linux/elf.h> | ||
| 144 | |||
| 145 | typedef struct user_i387_ia32_struct elf_fpregset_t; | ||
| 146 | typedef struct user32_fxsr_struct elf_fpxregset_t; | ||
| 147 | |||
| 148 | 104 | ||
| 149 | static inline void elf_core_copy_regs(elf_gregset_t *elfregs, struct pt_regs *regs) | 105 | #define elf_core_copy_regs elf32_core_copy_regs |
| 106 | static inline void elf32_core_copy_regs(compat_elf_gregset_t *elfregs, | ||
| 107 | struct pt_regs *regs) | ||
| 150 | { | 108 | { |
| 151 | ELF_CORE_COPY_REGS((*elfregs), regs) | 109 | ELF_CORE_COPY_REGS((&elfregs->ebx), regs) |
| 152 | } | 110 | } |
| 153 | 111 | ||
| 154 | static inline int elf_core_copy_task_regs(struct task_struct *t, elf_gregset_t* elfregs) | 112 | #define elf_core_copy_task_regs elf32_core_copy_task_regs |
| 113 | static inline int elf32_core_copy_task_regs(struct task_struct *t, | ||
| 114 | compat_elf_gregset_t* elfregs) | ||
| 155 | { | 115 | { |
| 156 | struct pt_regs *pp = task_pt_regs(t); | 116 | struct pt_regs *pp = task_pt_regs(t); |
| 157 | ELF_CORE_COPY_REGS((*elfregs), pp); | 117 | ELF_CORE_COPY_REGS((&elfregs->ebx), pp); |
| 158 | /* fix wrong segments */ | 118 | /* fix wrong segments */ |
| 159 | (*elfregs)[7] = t->thread.ds; | 119 | elfregs->ds = t->thread.ds; |
| 160 | (*elfregs)[9] = t->thread.fsindex; | 120 | elfregs->fs = t->thread.fsindex; |
| 161 | (*elfregs)[10] = t->thread.gsindex; | 121 | elfregs->gs = t->thread.gsindex; |
| 162 | (*elfregs)[8] = t->thread.es; | 122 | elfregs->es = t->thread.es; |
| 163 | return 1; | 123 | return 1; |
| 164 | } | 124 | } |
| 165 | 125 | ||
| 126 | #define elf_core_copy_task_fpregs elf32_core_copy_task_fpregs | ||
| 166 | static inline int | 127 | static inline int |
| 167 | elf_core_copy_task_fpregs(struct task_struct *tsk, struct pt_regs *regs, elf_fpregset_t *fpu) | 128 | elf32_core_copy_task_fpregs(struct task_struct *tsk, struct pt_regs *regs, |
| 129 | elf_fpregset_t *fpu) | ||
| 168 | { | 130 | { |
| 169 | struct _fpstate_ia32 *fpstate = (void*)fpu; | 131 | struct _fpstate_ia32 *fpstate = (void*)fpu; |
| 170 | mm_segment_t oldfs = get_fs(); | 132 | 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 | |||
| 186 | 148 | ||
| 187 | #define ELF_CORE_COPY_XFPREGS 1 | 149 | #define ELF_CORE_COPY_XFPREGS 1 |
| 188 | #define ELF_CORE_XFPREG_TYPE NT_PRXFPREG | 150 | #define ELF_CORE_XFPREG_TYPE NT_PRXFPREG |
| 151 | #define elf_core_copy_task_xfpregs elf32_core_copy_task_xfpregs | ||
| 189 | static inline int | 152 | static inline int |
| 190 | elf_core_copy_task_xfpregs(struct task_struct *t, elf_fpxregset_t *xfpu) | 153 | elf32_core_copy_task_xfpregs(struct task_struct *t, elf_fpxregset_t *xfpu) |
| 191 | { | 154 | { |
| 192 | struct pt_regs *regs = task_pt_regs(t); | 155 | struct pt_regs *regs = task_pt_regs(t); |
| 193 | if (!tsk_used_math(t)) | 156 | if (!tsk_used_math(t)) |
| @@ -206,6 +169,10 @@ elf_core_copy_task_xfpregs(struct task_struct *t, elf_fpxregset_t *xfpu) | |||
| 206 | 169 | ||
| 207 | extern int force_personality32; | 170 | extern int force_personality32; |
| 208 | 171 | ||
| 172 | #undef ELF_EXEC_PAGESIZE | ||
| 173 | #undef ELF_HWCAP | ||
| 174 | #undef ELF_PLATFORM | ||
| 175 | #undef SET_PERSONALITY | ||
| 209 | #define ELF_EXEC_PAGESIZE PAGE_SIZE | 176 | #define ELF_EXEC_PAGESIZE PAGE_SIZE |
| 210 | #define ELF_HWCAP (boot_cpu_data.x86_capability[0]) | 177 | #define ELF_HWCAP (boot_cpu_data.x86_capability[0]) |
| 211 | #define ELF_PLATFORM ("i686") | 178 | #define ELF_PLATFORM ("i686") |
| @@ -231,6 +198,7 @@ do { \ | |||
| 231 | 198 | ||
| 232 | #define load_elf_binary load_elf32_binary | 199 | #define load_elf_binary load_elf32_binary |
| 233 | 200 | ||
| 201 | #undef ELF_PLAT_INIT | ||
| 234 | #define ELF_PLAT_INIT(r, load_addr) elf32_init(r) | 202 | #define ELF_PLAT_INIT(r, load_addr) elf32_init(r) |
| 235 | 203 | ||
| 236 | #undef start_thread | 204 | #undef start_thread |
diff --git a/arch/x86/kernel/Makefile_32 b/arch/x86/kernel/Makefile_32 index a3fa11f8f460..ccea590bbb92 100644 --- a/arch/x86/kernel/Makefile_32 +++ b/arch/x86/kernel/Makefile_32 | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | # Makefile for the linux kernel. | 2 | # Makefile for the linux kernel. |
| 3 | # | 3 | # |
| 4 | 4 | ||
| 5 | extra-y := head_32.o init_task_32.o vmlinux.lds | 5 | extra-y := head_32.o init_task.o vmlinux.lds |
| 6 | 6 | ||
| 7 | obj-y := process_32.o signal_32.o entry_32.o traps_32.o irq_32.o \ | 7 | obj-y := process_32.o signal_32.o entry_32.o traps_32.o irq_32.o \ |
| 8 | ptrace_32.o time_32.o ioport_32.o ldt_32.o setup_32.o i8259_32.o sys_i386_32.o \ | 8 | 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 | |||
| 17 | obj-$(CONFIG_X86_MSR) += msr.o | 17 | obj-$(CONFIG_X86_MSR) += msr.o |
| 18 | obj-$(CONFIG_X86_CPUID) += cpuid.o | 18 | obj-$(CONFIG_X86_CPUID) += cpuid.o |
| 19 | obj-$(CONFIG_MICROCODE) += microcode.o | 19 | obj-$(CONFIG_MICROCODE) += microcode.o |
| 20 | obj-$(CONFIG_PCI) += early-quirks.o | ||
| 20 | obj-$(CONFIG_APM) += apm_32.o | 21 | obj-$(CONFIG_APM) += apm_32.o |
| 21 | obj-$(CONFIG_X86_SMP) += smp_32.o smpboot_32.o tsc_sync.o | 22 | obj-$(CONFIG_X86_SMP) += smp_32.o smpboot_32.o tsc_sync.o |
| 22 | obj-$(CONFIG_SMP) += smpcommon_32.o | 23 | obj-$(CONFIG_SMP) += smpcommon_32.o |
diff --git a/arch/x86/kernel/Makefile_64 b/arch/x86/kernel/Makefile_64 index 43da66213a47..dec06e769281 100644 --- a/arch/x86/kernel/Makefile_64 +++ b/arch/x86/kernel/Makefile_64 | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | # Makefile for the linux kernel. | 2 | # Makefile for the linux kernel. |
| 3 | # | 3 | # |
| 4 | 4 | ||
| 5 | extra-y := head_64.o head64.o init_task_64.o vmlinux.lds | 5 | extra-y := head_64.o head64.o init_task.o vmlinux.lds |
| 6 | EXTRA_AFLAGS := -traditional | 6 | EXTRA_AFLAGS := -traditional |
| 7 | obj-y := process_64.o signal_64.o entry_64.o traps_64.o irq_64.o \ | 7 | obj-y := process_64.o signal_64.o entry_64.o traps_64.o irq_64.o \ |
| 8 | ptrace_64.o time_64.o ioport_64.o ldt_64.o setup_64.o i8259_64.o sys_x86_64.o \ | 8 | 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 | |||
| 39 | obj-$(CONFIG_AUDIT) += audit_64.o | 39 | obj-$(CONFIG_AUDIT) += audit_64.o |
| 40 | 40 | ||
| 41 | obj-$(CONFIG_MODULES) += module_64.o | 41 | obj-$(CONFIG_MODULES) += module_64.o |
| 42 | obj-$(CONFIG_PCI) += early-quirks_64.o | 42 | obj-$(CONFIG_PCI) += early-quirks.o |
| 43 | 43 | ||
| 44 | obj-y += topology.o | 44 | obj-y += topology.o |
| 45 | obj-y += intel_cacheinfo.o | 45 | obj-y += intel_cacheinfo.o |
diff --git a/arch/x86/kernel/acpi/Makefile_32 b/arch/x86/kernel/acpi/Makefile_32 index a4852a2e9190..045dd54b33e0 100644 --- a/arch/x86/kernel/acpi/Makefile_32 +++ b/arch/x86/kernel/acpi/Makefile_32 | |||
| @@ -1,7 +1,4 @@ | |||
| 1 | obj-$(CONFIG_ACPI) += boot.o | 1 | obj-$(CONFIG_ACPI) += boot.o |
| 2 | ifneq ($(CONFIG_PCI),) | ||
| 3 | obj-$(CONFIG_X86_IO_APIC) += earlyquirk_32.o | ||
| 4 | endif | ||
| 5 | obj-$(CONFIG_ACPI_SLEEP) += sleep_32.o wakeup_32.o | 2 | obj-$(CONFIG_ACPI_SLEEP) += sleep_32.o wakeup_32.o |
| 6 | 3 | ||
| 7 | ifneq ($(CONFIG_ACPI_PROCESSOR),) | 4 | ifneq ($(CONFIG_ACPI_PROCESSOR),) |
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c index 25337f2b7399..289247d974c6 100644 --- a/arch/x86/kernel/acpi/boot.c +++ b/arch/x86/kernel/acpi/boot.c | |||
| @@ -555,7 +555,7 @@ EXPORT_SYMBOL(acpi_map_lsapic); | |||
| 555 | 555 | ||
| 556 | int acpi_unmap_lsapic(int cpu) | 556 | int acpi_unmap_lsapic(int cpu) |
| 557 | { | 557 | { |
| 558 | x86_cpu_to_apicid[cpu] = -1; | 558 | per_cpu(x86_cpu_to_apicid, cpu) = -1; |
| 559 | cpu_clear(cpu, cpu_present_map); | 559 | cpu_clear(cpu, cpu_present_map); |
| 560 | num_processors--; | 560 | num_processors--; |
| 561 | 561 | ||
diff --git a/arch/x86/kernel/acpi/cstate.c b/arch/x86/kernel/acpi/cstate.c index 2d39f55d29a8..10b67170b133 100644 --- a/arch/x86/kernel/acpi/cstate.c +++ b/arch/x86/kernel/acpi/cstate.c | |||
| @@ -29,7 +29,7 @@ | |||
| 29 | void acpi_processor_power_init_bm_check(struct acpi_processor_flags *flags, | 29 | void acpi_processor_power_init_bm_check(struct acpi_processor_flags *flags, |
| 30 | unsigned int cpu) | 30 | unsigned int cpu) |
| 31 | { | 31 | { |
| 32 | struct cpuinfo_x86 *c = cpu_data + cpu; | 32 | struct cpuinfo_x86 *c = &cpu_data(cpu); |
| 33 | 33 | ||
| 34 | flags->bm_check = 0; | 34 | flags->bm_check = 0; |
| 35 | if (num_online_cpus() == 1) | 35 | if (num_online_cpus() == 1) |
| @@ -72,7 +72,7 @@ int acpi_processor_ffh_cstate_probe(unsigned int cpu, | |||
| 72 | struct acpi_processor_cx *cx, struct acpi_power_register *reg) | 72 | struct acpi_processor_cx *cx, struct acpi_power_register *reg) |
| 73 | { | 73 | { |
| 74 | struct cstate_entry *percpu_entry; | 74 | struct cstate_entry *percpu_entry; |
| 75 | struct cpuinfo_x86 *c = cpu_data + cpu; | 75 | struct cpuinfo_x86 *c = &cpu_data(cpu); |
| 76 | 76 | ||
| 77 | cpumask_t saved_mask; | 77 | cpumask_t saved_mask; |
| 78 | int retval; | 78 | int retval; |
diff --git a/arch/x86/kernel/acpi/earlyquirk_32.c b/arch/x86/kernel/acpi/earlyquirk_32.c deleted file mode 100644 index 23f78efc577d..000000000000 --- a/arch/x86/kernel/acpi/earlyquirk_32.c +++ /dev/null | |||
| @@ -1,84 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * Do early PCI probing for bug detection when the main PCI subsystem is | ||
| 3 | * not up yet. | ||
| 4 | */ | ||
| 5 | #include <linux/init.h> | ||
| 6 | #include <linux/kernel.h> | ||
| 7 | #include <linux/pci.h> | ||
| 8 | #include <linux/acpi.h> | ||
| 9 | |||
| 10 | #include <asm/pci-direct.h> | ||
| 11 | #include <asm/acpi.h> | ||
| 12 | #include <asm/apic.h> | ||
| 13 | |||
| 14 | #ifdef CONFIG_ACPI | ||
| 15 | |||
| 16 | static int __init nvidia_hpet_check(struct acpi_table_header *header) | ||
| 17 | { | ||
| 18 | return 0; | ||
| 19 | } | ||
| 20 | #endif | ||
| 21 | |||
| 22 | static int __init check_bridge(int vendor, int device) | ||
| 23 | { | ||
| 24 | #ifdef CONFIG_ACPI | ||
| 25 | static int warned; | ||
| 26 | /* According to Nvidia all timer overrides are bogus unless HPET | ||
| 27 | is enabled. */ | ||
| 28 | if (!acpi_use_timer_override && vendor == PCI_VENDOR_ID_NVIDIA) { | ||
| 29 | if (!warned && acpi_table_parse(ACPI_SIG_HPET, | ||
| 30 | nvidia_hpet_check)) { | ||
| 31 | warned = 1; | ||
| 32 | acpi_skip_timer_override = 1; | ||
| 33 | printk(KERN_INFO "Nvidia board " | ||
| 34 | "detected. Ignoring ACPI " | ||
| 35 | "timer override.\n"); | ||
| 36 | printk(KERN_INFO "If you got timer trouble " | ||
| 37 | "try acpi_use_timer_override\n"); | ||
| 38 | |||
| 39 | } | ||
| 40 | } | ||
| 41 | #endif | ||
| 42 | if (vendor == PCI_VENDOR_ID_ATI && timer_over_8254 == 1) { | ||
| 43 | timer_over_8254 = 0; | ||
| 44 | printk(KERN_INFO "ATI board detected. Disabling timer routing " | ||
| 45 | "over 8254.\n"); | ||
| 46 | } | ||
| 47 | return 0; | ||
| 48 | } | ||
| 49 | |||
| 50 | void __init check_acpi_pci(void) | ||
| 51 | { | ||
| 52 | int num, slot, func; | ||
| 53 | |||
| 54 | /* Assume the machine supports type 1. If not it will | ||
| 55 | always read ffffffff and should not have any side effect. | ||
| 56 | Actually a few buggy systems can machine check. Allow the user | ||
| 57 | to disable it by command line option at least -AK */ | ||
| 58 | if (!early_pci_allowed()) | ||
| 59 | return; | ||
| 60 | |||
| 61 | /* Poor man's PCI discovery */ | ||
| 62 | for (num = 0; num < 32; num++) { | ||
| 63 | for (slot = 0; slot < 32; slot++) { | ||
| 64 | for (func = 0; func < 8; func++) { | ||
| 65 | u32 class; | ||
| 66 | u32 vendor; | ||
| 67 | class = read_pci_config(num, slot, func, | ||
| 68 | PCI_CLASS_REVISION); | ||
| 69 | if (class == 0xffffffff) | ||
| 70 | break; | ||
| 71 | |||
| 72 | if ((class >> 16) != PCI_CLASS_BRIDGE_PCI) | ||
| 73 | continue; | ||
| 74 | |||
| 75 | vendor = read_pci_config(num, slot, func, | ||
| 76 | PCI_VENDOR_ID); | ||
| 77 | |||
| 78 | if (check_bridge(vendor & 0xffff, vendor >> 16)) | ||
| 79 | return; | ||
| 80 | } | ||
| 81 | |||
| 82 | } | ||
| 83 | } | ||
| 84 | } | ||
diff --git a/arch/x86/kernel/acpi/processor.c b/arch/x86/kernel/acpi/processor.c index b54fded49834..2ed0a4ce62f0 100644 --- a/arch/x86/kernel/acpi/processor.c +++ b/arch/x86/kernel/acpi/processor.c | |||
| @@ -63,7 +63,7 @@ static void init_intel_pdc(struct acpi_processor *pr, struct cpuinfo_x86 *c) | |||
| 63 | void arch_acpi_processor_init_pdc(struct acpi_processor *pr) | 63 | void arch_acpi_processor_init_pdc(struct acpi_processor *pr) |
| 64 | { | 64 | { |
| 65 | unsigned int cpu = pr->id; | 65 | unsigned int cpu = pr->id; |
| 66 | struct cpuinfo_x86 *c = cpu_data + cpu; | 66 | struct cpuinfo_x86 *c = &cpu_data(cpu); |
| 67 | 67 | ||
| 68 | pr->pdc = NULL; | 68 | pr->pdc = NULL; |
| 69 | if (c->x86_vendor == X86_VENDOR_INTEL) | 69 | if (c->x86_vendor == X86_VENDOR_INTEL) |
diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c index 3bd2688bd443..d6405e0842b5 100644 --- a/arch/x86/kernel/alternative.c +++ b/arch/x86/kernel/alternative.c | |||
| @@ -357,14 +357,14 @@ void alternatives_smp_switch(int smp) | |||
| 357 | if (smp) { | 357 | if (smp) { |
| 358 | printk(KERN_INFO "SMP alternatives: switching to SMP code\n"); | 358 | printk(KERN_INFO "SMP alternatives: switching to SMP code\n"); |
| 359 | clear_bit(X86_FEATURE_UP, boot_cpu_data.x86_capability); | 359 | clear_bit(X86_FEATURE_UP, boot_cpu_data.x86_capability); |
| 360 | clear_bit(X86_FEATURE_UP, cpu_data[0].x86_capability); | 360 | clear_bit(X86_FEATURE_UP, cpu_data(0).x86_capability); |
| 361 | list_for_each_entry(mod, &smp_alt_modules, next) | 361 | list_for_each_entry(mod, &smp_alt_modules, next) |
| 362 | alternatives_smp_lock(mod->locks, mod->locks_end, | 362 | alternatives_smp_lock(mod->locks, mod->locks_end, |
| 363 | mod->text, mod->text_end); | 363 | mod->text, mod->text_end); |
| 364 | } else { | 364 | } else { |
| 365 | printk(KERN_INFO "SMP alternatives: switching to UP code\n"); | 365 | printk(KERN_INFO "SMP alternatives: switching to UP code\n"); |
| 366 | set_bit(X86_FEATURE_UP, boot_cpu_data.x86_capability); | 366 | set_bit(X86_FEATURE_UP, boot_cpu_data.x86_capability); |
| 367 | set_bit(X86_FEATURE_UP, cpu_data[0].x86_capability); | 367 | set_bit(X86_FEATURE_UP, cpu_data(0).x86_capability); |
| 368 | list_for_each_entry(mod, &smp_alt_modules, next) | 368 | list_for_each_entry(mod, &smp_alt_modules, next) |
| 369 | alternatives_smp_unlock(mod->locks, mod->locks_end, | 369 | alternatives_smp_unlock(mod->locks, mod->locks_end, |
| 370 | mod->text, mod->text_end); | 370 | mod->text, mod->text_end); |
| @@ -432,7 +432,7 @@ void __init alternative_instructions(void) | |||
| 432 | if (1 == num_possible_cpus()) { | 432 | if (1 == num_possible_cpus()) { |
| 433 | printk(KERN_INFO "SMP alternatives: switching to UP code\n"); | 433 | printk(KERN_INFO "SMP alternatives: switching to UP code\n"); |
| 434 | set_bit(X86_FEATURE_UP, boot_cpu_data.x86_capability); | 434 | set_bit(X86_FEATURE_UP, boot_cpu_data.x86_capability); |
| 435 | set_bit(X86_FEATURE_UP, cpu_data[0].x86_capability); | 435 | set_bit(X86_FEATURE_UP, cpu_data(0).x86_capability); |
| 436 | alternatives_smp_unlock(__smp_locks, __smp_locks_end, | 436 | alternatives_smp_unlock(__smp_locks, __smp_locks_end, |
| 437 | _text, _etext); | 437 | _text, _etext); |
| 438 | } | 438 | } |
diff --git a/arch/x86/kernel/cpu/cpufreq/Kconfig b/arch/x86/kernel/cpu/cpufreq/Kconfig_32 index d8c6f132dc7a..d8c6f132dc7a 100644 --- a/arch/x86/kernel/cpu/cpufreq/Kconfig +++ b/arch/x86/kernel/cpu/cpufreq/Kconfig_32 | |||
diff --git a/arch/x86/kernel/cpufreq/Kconfig b/arch/x86/kernel/cpu/cpufreq/Kconfig_64 index a3fd51926cbd..9c9699fdcf52 100644 --- a/arch/x86/kernel/cpufreq/Kconfig +++ b/arch/x86/kernel/cpu/cpufreq/Kconfig_64 | |||
| @@ -19,7 +19,7 @@ config X86_POWERNOW_K8 | |||
| 19 | To compile this driver as a module, choose M here: the | 19 | To compile this driver as a module, choose M here: the |
| 20 | module will be called powernow-k8. | 20 | module will be called powernow-k8. |
| 21 | 21 | ||
| 22 | For details, take a look at <file:Documentation/cpu-freq/>. | 22 | For details, take a look at <file:Documentation/cpu-freq/>. |
| 23 | 23 | ||
| 24 | If in doubt, say N. | 24 | If in doubt, say N. |
| 25 | 25 | ||
diff --git a/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c b/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c index 2ca43ba32bc0..fea0af0476b9 100644 --- a/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c +++ b/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c | |||
| @@ -77,7 +77,7 @@ static unsigned int acpi_pstate_strict; | |||
| 77 | 77 | ||
| 78 | static int check_est_cpu(unsigned int cpuid) | 78 | static int check_est_cpu(unsigned int cpuid) |
| 79 | { | 79 | { |
| 80 | struct cpuinfo_x86 *cpu = &cpu_data[cpuid]; | 80 | struct cpuinfo_x86 *cpu = &cpu_data(cpuid); |
| 81 | 81 | ||
| 82 | if (cpu->x86_vendor != X86_VENDOR_INTEL || | 82 | if (cpu->x86_vendor != X86_VENDOR_INTEL || |
| 83 | !cpu_has(cpu, X86_FEATURE_EST)) | 83 | !cpu_has(cpu, X86_FEATURE_EST)) |
| @@ -560,7 +560,7 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy) | |||
| 560 | unsigned int cpu = policy->cpu; | 560 | unsigned int cpu = policy->cpu; |
| 561 | struct acpi_cpufreq_data *data; | 561 | struct acpi_cpufreq_data *data; |
| 562 | unsigned int result = 0; | 562 | unsigned int result = 0; |
| 563 | struct cpuinfo_x86 *c = &cpu_data[policy->cpu]; | 563 | struct cpuinfo_x86 *c = &cpu_data(policy->cpu); |
| 564 | struct acpi_processor_performance *perf; | 564 | struct acpi_processor_performance *perf; |
| 565 | 565 | ||
| 566 | dprintk("acpi_cpufreq_cpu_init\n"); | 566 | dprintk("acpi_cpufreq_cpu_init\n"); |
diff --git a/arch/x86/kernel/cpu/cpufreq/e_powersaver.c b/arch/x86/kernel/cpu/cpufreq/e_powersaver.c index c11baaf9f2b4..326a4c81f684 100644 --- a/arch/x86/kernel/cpu/cpufreq/e_powersaver.c +++ b/arch/x86/kernel/cpu/cpufreq/e_powersaver.c | |||
| @@ -305,7 +305,7 @@ static struct cpufreq_driver eps_driver = { | |||
| 305 | 305 | ||
| 306 | static int __init eps_init(void) | 306 | static int __init eps_init(void) |
| 307 | { | 307 | { |
| 308 | struct cpuinfo_x86 *c = cpu_data; | 308 | struct cpuinfo_x86 *c = &cpu_data(0); |
| 309 | 309 | ||
| 310 | /* This driver will work only on Centaur C7 processors with | 310 | /* This driver will work only on Centaur C7 processors with |
| 311 | * Enhanced SpeedStep/PowerSaver registers */ | 311 | * Enhanced SpeedStep/PowerSaver registers */ |
diff --git a/arch/x86/kernel/cpu/cpufreq/elanfreq.c b/arch/x86/kernel/cpu/cpufreq/elanfreq.c index 1e7ae7dafcf6..94619c22f563 100644 --- a/arch/x86/kernel/cpu/cpufreq/elanfreq.c +++ b/arch/x86/kernel/cpu/cpufreq/elanfreq.c | |||
| @@ -199,7 +199,7 @@ static int elanfreq_target (struct cpufreq_policy *policy, | |||
| 199 | 199 | ||
| 200 | static int elanfreq_cpu_init(struct cpufreq_policy *policy) | 200 | static int elanfreq_cpu_init(struct cpufreq_policy *policy) |
| 201 | { | 201 | { |
| 202 | struct cpuinfo_x86 *c = cpu_data; | 202 | struct cpuinfo_x86 *c = &cpu_data(0); |
| 203 | unsigned int i; | 203 | unsigned int i; |
| 204 | int result; | 204 | int result; |
| 205 | 205 | ||
| @@ -280,7 +280,7 @@ static struct cpufreq_driver elanfreq_driver = { | |||
| 280 | 280 | ||
| 281 | static int __init elanfreq_init(void) | 281 | static int __init elanfreq_init(void) |
| 282 | { | 282 | { |
| 283 | struct cpuinfo_x86 *c = cpu_data; | 283 | struct cpuinfo_x86 *c = &cpu_data(0); |
| 284 | 284 | ||
| 285 | /* Test if we have the right hardware */ | 285 | /* Test if we have the right hardware */ |
| 286 | if ((c->x86_vendor != X86_VENDOR_AMD) || | 286 | if ((c->x86_vendor != X86_VENDOR_AMD) || |
diff --git a/arch/x86/kernel/cpu/cpufreq/longhaul.c b/arch/x86/kernel/cpu/cpufreq/longhaul.c index 5045f5d583c8..749d00cb2ebd 100644 --- a/arch/x86/kernel/cpu/cpufreq/longhaul.c +++ b/arch/x86/kernel/cpu/cpufreq/longhaul.c | |||
| @@ -780,7 +780,7 @@ static int longhaul_setup_southbridge(void) | |||
| 780 | 780 | ||
| 781 | static int __init longhaul_cpu_init(struct cpufreq_policy *policy) | 781 | static int __init longhaul_cpu_init(struct cpufreq_policy *policy) |
| 782 | { | 782 | { |
| 783 | struct cpuinfo_x86 *c = cpu_data; | 783 | struct cpuinfo_x86 *c = &cpu_data(0); |
| 784 | char *cpuname=NULL; | 784 | char *cpuname=NULL; |
| 785 | int ret; | 785 | int ret; |
| 786 | u32 lo, hi; | 786 | u32 lo, hi; |
| @@ -959,7 +959,7 @@ static struct cpufreq_driver longhaul_driver = { | |||
| 959 | 959 | ||
| 960 | static int __init longhaul_init(void) | 960 | static int __init longhaul_init(void) |
| 961 | { | 961 | { |
| 962 | struct cpuinfo_x86 *c = cpu_data; | 962 | struct cpuinfo_x86 *c = &cpu_data(0); |
| 963 | 963 | ||
| 964 | if (c->x86_vendor != X86_VENDOR_CENTAUR || c->x86 != 6) | 964 | if (c->x86_vendor != X86_VENDOR_CENTAUR || c->x86 != 6) |
| 965 | return -ENODEV; | 965 | return -ENODEV; |
diff --git a/arch/x86/kernel/cpu/cpufreq/longrun.c b/arch/x86/kernel/cpu/cpufreq/longrun.c index b2689514295a..af4a867a097c 100644 --- a/arch/x86/kernel/cpu/cpufreq/longrun.c +++ b/arch/x86/kernel/cpu/cpufreq/longrun.c | |||
| @@ -172,7 +172,7 @@ static unsigned int __init longrun_determine_freqs(unsigned int *low_freq, | |||
| 172 | u32 save_lo, save_hi; | 172 | u32 save_lo, save_hi; |
| 173 | u32 eax, ebx, ecx, edx; | 173 | u32 eax, ebx, ecx, edx; |
| 174 | u32 try_hi; | 174 | u32 try_hi; |
| 175 | struct cpuinfo_x86 *c = cpu_data; | 175 | struct cpuinfo_x86 *c = &cpu_data(0); |
| 176 | 176 | ||
| 177 | if (!low_freq || !high_freq) | 177 | if (!low_freq || !high_freq) |
| 178 | return -EINVAL; | 178 | return -EINVAL; |
| @@ -298,7 +298,7 @@ static struct cpufreq_driver longrun_driver = { | |||
| 298 | */ | 298 | */ |
| 299 | static int __init longrun_init(void) | 299 | static int __init longrun_init(void) |
| 300 | { | 300 | { |
| 301 | struct cpuinfo_x86 *c = cpu_data; | 301 | struct cpuinfo_x86 *c = &cpu_data(0); |
| 302 | 302 | ||
| 303 | if (c->x86_vendor != X86_VENDOR_TRANSMETA || | 303 | if (c->x86_vendor != X86_VENDOR_TRANSMETA || |
| 304 | !cpu_has(c, X86_FEATURE_LONGRUN)) | 304 | !cpu_has(c, X86_FEATURE_LONGRUN)) |
diff --git a/arch/x86/kernel/cpu/cpufreq/p4-clockmod.c b/arch/x86/kernel/cpu/cpufreq/p4-clockmod.c index 793eae854f4f..14791ec55cfd 100644 --- a/arch/x86/kernel/cpu/cpufreq/p4-clockmod.c +++ b/arch/x86/kernel/cpu/cpufreq/p4-clockmod.c | |||
| @@ -195,7 +195,7 @@ static unsigned int cpufreq_p4_get_frequency(struct cpuinfo_x86 *c) | |||
| 195 | 195 | ||
| 196 | static int cpufreq_p4_cpu_init(struct cpufreq_policy *policy) | 196 | static int cpufreq_p4_cpu_init(struct cpufreq_policy *policy) |
| 197 | { | 197 | { |
| 198 | struct cpuinfo_x86 *c = &cpu_data[policy->cpu]; | 198 | struct cpuinfo_x86 *c = &cpu_data(policy->cpu); |
| 199 | int cpuid = 0; | 199 | int cpuid = 0; |
| 200 | unsigned int i; | 200 | unsigned int i; |
| 201 | 201 | ||
| @@ -279,7 +279,7 @@ static struct cpufreq_driver p4clockmod_driver = { | |||
| 279 | 279 | ||
| 280 | static int __init cpufreq_p4_init(void) | 280 | static int __init cpufreq_p4_init(void) |
| 281 | { | 281 | { |
| 282 | struct cpuinfo_x86 *c = cpu_data; | 282 | struct cpuinfo_x86 *c = &cpu_data(0); |
| 283 | int ret; | 283 | int ret; |
| 284 | 284 | ||
| 285 | /* | 285 | /* |
diff --git a/arch/x86/kernel/cpu/cpufreq/powernow-k6.c b/arch/x86/kernel/cpu/cpufreq/powernow-k6.c index a07f6d84033a..eb9b62b0830c 100644 --- a/arch/x86/kernel/cpu/cpufreq/powernow-k6.c +++ b/arch/x86/kernel/cpu/cpufreq/powernow-k6.c | |||
| @@ -215,7 +215,7 @@ static struct cpufreq_driver powernow_k6_driver = { | |||
| 215 | */ | 215 | */ |
| 216 | static int __init powernow_k6_init(void) | 216 | static int __init powernow_k6_init(void) |
| 217 | { | 217 | { |
| 218 | struct cpuinfo_x86 *c = cpu_data; | 218 | struct cpuinfo_x86 *c = &cpu_data(0); |
| 219 | 219 | ||
| 220 | if ((c->x86_vendor != X86_VENDOR_AMD) || (c->x86 != 5) || | 220 | if ((c->x86_vendor != X86_VENDOR_AMD) || (c->x86 != 5) || |
| 221 | ((c->x86_model != 12) && (c->x86_model != 13))) | 221 | ((c->x86_model != 12) && (c->x86_model != 13))) |
diff --git a/arch/x86/kernel/cpu/cpufreq/powernow-k7.c b/arch/x86/kernel/cpu/cpufreq/powernow-k7.c index f3686a5f2308..b5a9863d6cdc 100644 --- a/arch/x86/kernel/cpu/cpufreq/powernow-k7.c +++ b/arch/x86/kernel/cpu/cpufreq/powernow-k7.c | |||
| @@ -114,7 +114,7 @@ static int check_fsb(unsigned int fsbspeed) | |||
| 114 | 114 | ||
| 115 | static int check_powernow(void) | 115 | static int check_powernow(void) |
| 116 | { | 116 | { |
| 117 | struct cpuinfo_x86 *c = cpu_data; | 117 | struct cpuinfo_x86 *c = &cpu_data(0); |
| 118 | unsigned int maxei, eax, ebx, ecx, edx; | 118 | unsigned int maxei, eax, ebx, ecx, edx; |
| 119 | 119 | ||
| 120 | if ((c->x86_vendor != X86_VENDOR_AMD) || (c->x86 !=6)) { | 120 | if ((c->x86_vendor != X86_VENDOR_AMD) || (c->x86 !=6)) { |
diff --git a/arch/x86/kernel/cpu/cpufreq/sc520_freq.c b/arch/x86/kernel/cpu/cpufreq/sc520_freq.c index d9f3e90a7ae0..42da9bd677d6 100644 --- a/arch/x86/kernel/cpu/cpufreq/sc520_freq.c +++ b/arch/x86/kernel/cpu/cpufreq/sc520_freq.c | |||
| @@ -102,7 +102,7 @@ static int sc520_freq_target (struct cpufreq_policy *policy, | |||
| 102 | 102 | ||
| 103 | static int sc520_freq_cpu_init(struct cpufreq_policy *policy) | 103 | static int sc520_freq_cpu_init(struct cpufreq_policy *policy) |
| 104 | { | 104 | { |
| 105 | struct cpuinfo_x86 *c = cpu_data; | 105 | struct cpuinfo_x86 *c = &cpu_data(0); |
| 106 | int result; | 106 | int result; |
| 107 | 107 | ||
| 108 | /* capability check */ | 108 | /* capability check */ |
| @@ -151,7 +151,7 @@ static struct cpufreq_driver sc520_freq_driver = { | |||
| 151 | 151 | ||
| 152 | static int __init sc520_freq_init(void) | 152 | static int __init sc520_freq_init(void) |
| 153 | { | 153 | { |
| 154 | struct cpuinfo_x86 *c = cpu_data; | 154 | struct cpuinfo_x86 *c = &cpu_data(0); |
| 155 | int err; | 155 | int err; |
| 156 | 156 | ||
| 157 | /* Test if we have the right hardware */ | 157 | /* Test if we have the right hardware */ |
diff --git a/arch/x86/kernel/cpu/cpufreq/speedstep-centrino.c b/arch/x86/kernel/cpu/cpufreq/speedstep-centrino.c index 811d47438546..3031f1196192 100644 --- a/arch/x86/kernel/cpu/cpufreq/speedstep-centrino.c +++ b/arch/x86/kernel/cpu/cpufreq/speedstep-centrino.c | |||
| @@ -230,7 +230,7 @@ static struct cpu_model models[] = | |||
| 230 | 230 | ||
| 231 | static int centrino_cpu_init_table(struct cpufreq_policy *policy) | 231 | static int centrino_cpu_init_table(struct cpufreq_policy *policy) |
| 232 | { | 232 | { |
| 233 | struct cpuinfo_x86 *cpu = &cpu_data[policy->cpu]; | 233 | struct cpuinfo_x86 *cpu = &cpu_data(policy->cpu); |
| 234 | struct cpu_model *model; | 234 | struct cpu_model *model; |
| 235 | 235 | ||
| 236 | for(model = models; model->cpu_id != NULL; model++) | 236 | for(model = models; model->cpu_id != NULL; model++) |
| @@ -340,7 +340,7 @@ static unsigned int get_cur_freq(unsigned int cpu) | |||
| 340 | 340 | ||
| 341 | static int centrino_cpu_init(struct cpufreq_policy *policy) | 341 | static int centrino_cpu_init(struct cpufreq_policy *policy) |
| 342 | { | 342 | { |
| 343 | struct cpuinfo_x86 *cpu = &cpu_data[policy->cpu]; | 343 | struct cpuinfo_x86 *cpu = &cpu_data(policy->cpu); |
| 344 | unsigned freq; | 344 | unsigned freq; |
| 345 | unsigned l, h; | 345 | unsigned l, h; |
| 346 | int ret; | 346 | int ret; |
| @@ -612,7 +612,7 @@ static struct cpufreq_driver centrino_driver = { | |||
| 612 | */ | 612 | */ |
| 613 | static int __init centrino_init(void) | 613 | static int __init centrino_init(void) |
| 614 | { | 614 | { |
| 615 | struct cpuinfo_x86 *cpu = cpu_data; | 615 | struct cpuinfo_x86 *cpu = &cpu_data(0); |
| 616 | 616 | ||
| 617 | if (!cpu_has(cpu, X86_FEATURE_EST)) | 617 | if (!cpu_has(cpu, X86_FEATURE_EST)) |
| 618 | return -ENODEV; | 618 | return -ENODEV; |
diff --git a/arch/x86/kernel/cpu/cpufreq/speedstep-lib.c b/arch/x86/kernel/cpu/cpufreq/speedstep-lib.c index b1acc8ce3167..76c3ab0da468 100644 --- a/arch/x86/kernel/cpu/cpufreq/speedstep-lib.c +++ b/arch/x86/kernel/cpu/cpufreq/speedstep-lib.c | |||
| @@ -228,7 +228,7 @@ EXPORT_SYMBOL_GPL(speedstep_get_processor_frequency); | |||
| 228 | 228 | ||
| 229 | unsigned int speedstep_detect_processor (void) | 229 | unsigned int speedstep_detect_processor (void) |
| 230 | { | 230 | { |
| 231 | struct cpuinfo_x86 *c = cpu_data; | 231 | struct cpuinfo_x86 *c = &cpu_data(0); |
| 232 | u32 ebx, msr_lo, msr_hi; | 232 | u32 ebx, msr_lo, msr_hi; |
| 233 | 233 | ||
| 234 | dprintk("x86: %x, model: %x\n", c->x86, c->x86_model); | 234 | dprintk("x86: %x, model: %x\n", c->x86, c->x86_model); |
diff --git a/arch/x86/kernel/cpu/intel_cacheinfo.c b/arch/x86/kernel/cpu/intel_cacheinfo.c index 297a24116949..9921b01fe199 100644 --- a/arch/x86/kernel/cpu/intel_cacheinfo.c +++ b/arch/x86/kernel/cpu/intel_cacheinfo.c | |||
| @@ -295,7 +295,7 @@ unsigned int __cpuinit init_intel_cacheinfo(struct cpuinfo_x86 *c) | |||
| 295 | unsigned int new_l2 = 0, new_l3 = 0, i; /* Cache sizes from cpuid(4) */ | 295 | unsigned int new_l2 = 0, new_l3 = 0, i; /* Cache sizes from cpuid(4) */ |
| 296 | unsigned int l2_id = 0, l3_id = 0, num_threads_sharing, index_msb; | 296 | unsigned int l2_id = 0, l3_id = 0, num_threads_sharing, index_msb; |
| 297 | #ifdef CONFIG_X86_HT | 297 | #ifdef CONFIG_X86_HT |
| 298 | unsigned int cpu = (c == &boot_cpu_data) ? 0 : (c - cpu_data); | 298 | unsigned int cpu = c->cpu_index; |
| 299 | #endif | 299 | #endif |
| 300 | 300 | ||
| 301 | if (c->cpuid_level > 3) { | 301 | if (c->cpuid_level > 3) { |
| @@ -417,14 +417,14 @@ unsigned int __cpuinit init_intel_cacheinfo(struct cpuinfo_x86 *c) | |||
| 417 | if (new_l2) { | 417 | if (new_l2) { |
| 418 | l2 = new_l2; | 418 | l2 = new_l2; |
| 419 | #ifdef CONFIG_X86_HT | 419 | #ifdef CONFIG_X86_HT |
| 420 | cpu_llc_id[cpu] = l2_id; | 420 | per_cpu(cpu_llc_id, cpu) = l2_id; |
| 421 | #endif | 421 | #endif |
| 422 | } | 422 | } |
| 423 | 423 | ||
| 424 | if (new_l3) { | 424 | if (new_l3) { |
| 425 | l3 = new_l3; | 425 | l3 = new_l3; |
| 426 | #ifdef CONFIG_X86_HT | 426 | #ifdef CONFIG_X86_HT |
| 427 | cpu_llc_id[cpu] = l3_id; | 427 | per_cpu(cpu_llc_id, cpu) = l3_id; |
| 428 | #endif | 428 | #endif |
| 429 | } | 429 | } |
| 430 | 430 | ||
| @@ -459,7 +459,7 @@ static void __cpuinit cache_shared_cpu_map_setup(unsigned int cpu, int index) | |||
| 459 | struct _cpuid4_info *this_leaf, *sibling_leaf; | 459 | struct _cpuid4_info *this_leaf, *sibling_leaf; |
| 460 | unsigned long num_threads_sharing; | 460 | unsigned long num_threads_sharing; |
| 461 | int index_msb, i; | 461 | int index_msb, i; |
| 462 | struct cpuinfo_x86 *c = cpu_data; | 462 | struct cpuinfo_x86 *c = &cpu_data(cpu); |
| 463 | 463 | ||
| 464 | this_leaf = CPUID4_INFO_IDX(cpu, index); | 464 | this_leaf = CPUID4_INFO_IDX(cpu, index); |
| 465 | num_threads_sharing = 1 + this_leaf->eax.split.num_threads_sharing; | 465 | 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) | |||
| 470 | index_msb = get_count_order(num_threads_sharing); | 470 | index_msb = get_count_order(num_threads_sharing); |
| 471 | 471 | ||
| 472 | for_each_online_cpu(i) { | 472 | for_each_online_cpu(i) { |
| 473 | if (c[i].apicid >> index_msb == | 473 | if (cpu_data(i).apicid >> index_msb == |
| 474 | c[cpu].apicid >> index_msb) { | 474 | c->apicid >> index_msb) { |
| 475 | cpu_set(i, this_leaf->shared_cpu_map); | 475 | cpu_set(i, this_leaf->shared_cpu_map); |
| 476 | if (i != cpu && cpuid4_info[i]) { | 476 | if (i != cpu && cpuid4_info[i]) { |
| 477 | sibling_leaf = CPUID4_INFO_IDX(i, index); | 477 | sibling_leaf = CPUID4_INFO_IDX(i, index); |
diff --git a/arch/x86/kernel/cpu/perfctr-watchdog.c b/arch/x86/kernel/cpu/perfctr-watchdog.c index 54cdbf1a40f1..c02541e6e653 100644 --- a/arch/x86/kernel/cpu/perfctr-watchdog.c +++ b/arch/x86/kernel/cpu/perfctr-watchdog.c | |||
| @@ -120,7 +120,9 @@ int reserve_perfctr_nmi(unsigned int msr) | |||
| 120 | unsigned int counter; | 120 | unsigned int counter; |
| 121 | 121 | ||
| 122 | counter = nmi_perfctr_msr_to_bit(msr); | 122 | counter = nmi_perfctr_msr_to_bit(msr); |
| 123 | BUG_ON(counter > NMI_MAX_COUNTER_BITS); | 123 | /* register not managed by the allocator? */ |
| 124 | if (counter > NMI_MAX_COUNTER_BITS) | ||
| 125 | return 1; | ||
| 124 | 126 | ||
| 125 | if (!test_and_set_bit(counter, perfctr_nmi_owner)) | 127 | if (!test_and_set_bit(counter, perfctr_nmi_owner)) |
| 126 | return 1; | 128 | return 1; |
| @@ -132,7 +134,9 @@ void release_perfctr_nmi(unsigned int msr) | |||
| 132 | unsigned int counter; | 134 | unsigned int counter; |
| 133 | 135 | ||
| 134 | counter = nmi_perfctr_msr_to_bit(msr); | 136 | counter = nmi_perfctr_msr_to_bit(msr); |
| 135 | BUG_ON(counter > NMI_MAX_COUNTER_BITS); | 137 | /* register not managed by the allocator? */ |
| 138 | if (counter > NMI_MAX_COUNTER_BITS) | ||
| 139 | return; | ||
| 136 | 140 | ||
| 137 | clear_bit(counter, perfctr_nmi_owner); | 141 | clear_bit(counter, perfctr_nmi_owner); |
| 138 | } | 142 | } |
| @@ -142,7 +146,9 @@ int reserve_evntsel_nmi(unsigned int msr) | |||
| 142 | unsigned int counter; | 146 | unsigned int counter; |
| 143 | 147 | ||
| 144 | counter = nmi_evntsel_msr_to_bit(msr); | 148 | counter = nmi_evntsel_msr_to_bit(msr); |
| 145 | BUG_ON(counter > NMI_MAX_COUNTER_BITS); | 149 | /* register not managed by the allocator? */ |
| 150 | if (counter > NMI_MAX_COUNTER_BITS) | ||
| 151 | return 1; | ||
| 146 | 152 | ||
| 147 | if (!test_and_set_bit(counter, evntsel_nmi_owner)) | 153 | if (!test_and_set_bit(counter, evntsel_nmi_owner)) |
| 148 | return 1; | 154 | return 1; |
| @@ -154,7 +160,9 @@ void release_evntsel_nmi(unsigned int msr) | |||
| 154 | unsigned int counter; | 160 | unsigned int counter; |
| 155 | 161 | ||
| 156 | counter = nmi_evntsel_msr_to_bit(msr); | 162 | counter = nmi_evntsel_msr_to_bit(msr); |
| 157 | BUG_ON(counter > NMI_MAX_COUNTER_BITS); | 163 | /* register not managed by the allocator? */ |
| 164 | if (counter > NMI_MAX_COUNTER_BITS) | ||
| 165 | return; | ||
| 158 | 166 | ||
| 159 | clear_bit(counter, evntsel_nmi_owner); | 167 | clear_bit(counter, evntsel_nmi_owner); |
| 160 | } | 168 | } |
diff --git a/arch/x86/kernel/cpu/proc.c b/arch/x86/kernel/cpu/proc.c index 879a0f789b1e..2d42b414b777 100644 --- a/arch/x86/kernel/cpu/proc.c +++ b/arch/x86/kernel/cpu/proc.c | |||
| @@ -85,12 +85,13 @@ static int show_cpuinfo(struct seq_file *m, void *v) | |||
| 85 | /* nothing */ | 85 | /* nothing */ |
| 86 | }; | 86 | }; |
| 87 | struct cpuinfo_x86 *c = v; | 87 | struct cpuinfo_x86 *c = v; |
| 88 | int i, n = c - cpu_data; | 88 | int i, n = 0; |
| 89 | int fpu_exception; | 89 | int fpu_exception; |
| 90 | 90 | ||
| 91 | #ifdef CONFIG_SMP | 91 | #ifdef CONFIG_SMP |
| 92 | if (!cpu_online(n)) | 92 | if (!cpu_online(n)) |
| 93 | return 0; | 93 | return 0; |
| 94 | n = c->cpu_index; | ||
| 94 | #endif | 95 | #endif |
| 95 | seq_printf(m, "processor\t: %d\n" | 96 | seq_printf(m, "processor\t: %d\n" |
| 96 | "vendor_id\t: %s\n" | 97 | "vendor_id\t: %s\n" |
| @@ -175,11 +176,15 @@ static int show_cpuinfo(struct seq_file *m, void *v) | |||
| 175 | 176 | ||
| 176 | static void *c_start(struct seq_file *m, loff_t *pos) | 177 | static void *c_start(struct seq_file *m, loff_t *pos) |
| 177 | { | 178 | { |
| 178 | return *pos < NR_CPUS ? cpu_data + *pos : NULL; | 179 | if (*pos == 0) /* just in case, cpu 0 is not the first */ |
| 180 | *pos = first_cpu(cpu_possible_map); | ||
| 181 | if ((*pos) < NR_CPUS && cpu_possible(*pos)) | ||
| 182 | return &cpu_data(*pos); | ||
| 183 | return NULL; | ||
| 179 | } | 184 | } |
| 180 | static void *c_next(struct seq_file *m, void *v, loff_t *pos) | 185 | static void *c_next(struct seq_file *m, void *v, loff_t *pos) |
| 181 | { | 186 | { |
| 182 | ++*pos; | 187 | *pos = next_cpu(*pos, cpu_possible_map); |
| 183 | return c_start(m, pos); | 188 | return c_start(m, pos); |
| 184 | } | 189 | } |
| 185 | static void c_stop(struct seq_file *m, void *v) | 190 | static void c_stop(struct seq_file *m, void *v) |
diff --git a/arch/x86/kernel/cpuid.c b/arch/x86/kernel/cpuid.c index 70dcf912d9fb..05c9936a16cc 100644 --- a/arch/x86/kernel/cpuid.c +++ b/arch/x86/kernel/cpuid.c | |||
| @@ -114,7 +114,7 @@ static ssize_t cpuid_read(struct file *file, char __user *buf, | |||
| 114 | static int cpuid_open(struct inode *inode, struct file *file) | 114 | static int cpuid_open(struct inode *inode, struct file *file) |
| 115 | { | 115 | { |
| 116 | unsigned int cpu = iminor(file->f_path.dentry->d_inode); | 116 | unsigned int cpu = iminor(file->f_path.dentry->d_inode); |
| 117 | struct cpuinfo_x86 *c = &(cpu_data)[cpu]; | 117 | struct cpuinfo_x86 *c = &cpu_data(cpu); |
| 118 | 118 | ||
| 119 | if (cpu >= NR_CPUS || !cpu_online(cpu)) | 119 | if (cpu >= NR_CPUS || !cpu_online(cpu)) |
| 120 | return -ENXIO; /* No such CPU */ | 120 | return -ENXIO; /* No such CPU */ |
| @@ -134,15 +134,18 @@ static const struct file_operations cpuid_fops = { | |||
| 134 | .open = cpuid_open, | 134 | .open = cpuid_open, |
| 135 | }; | 135 | }; |
| 136 | 136 | ||
| 137 | static int __cpuinit cpuid_device_create(int i) | 137 | static __cpuinit int cpuid_device_create(int cpu) |
| 138 | { | 138 | { |
| 139 | int err = 0; | ||
| 140 | struct device *dev; | 139 | struct device *dev; |
| 141 | 140 | ||
| 142 | dev = device_create(cpuid_class, NULL, MKDEV(CPUID_MAJOR, i), "cpu%d",i); | 141 | dev = device_create(cpuid_class, NULL, MKDEV(CPUID_MAJOR, cpu), |
| 143 | if (IS_ERR(dev)) | 142 | "cpu%d", cpu); |
| 144 | err = PTR_ERR(dev); | 143 | return IS_ERR(dev) ? PTR_ERR(dev) : 0; |
| 145 | return err; | 144 | } |
| 145 | |||
| 146 | static void cpuid_device_destroy(int cpu) | ||
| 147 | { | ||
| 148 | device_destroy(cpuid_class, MKDEV(CPUID_MAJOR, cpu)); | ||
| 146 | } | 149 | } |
| 147 | 150 | ||
| 148 | static int __cpuinit cpuid_class_cpu_callback(struct notifier_block *nfb, | 151 | 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, | |||
| 150 | void *hcpu) | 153 | void *hcpu) |
| 151 | { | 154 | { |
| 152 | unsigned int cpu = (unsigned long)hcpu; | 155 | unsigned int cpu = (unsigned long)hcpu; |
| 156 | int err = 0; | ||
| 153 | 157 | ||
| 154 | switch (action) { | 158 | switch (action) { |
| 155 | case CPU_ONLINE: | 159 | case CPU_UP_PREPARE: |
| 156 | case CPU_ONLINE_FROZEN: | 160 | case CPU_UP_PREPARE_FROZEN: |
| 157 | cpuid_device_create(cpu); | 161 | err = cpuid_device_create(cpu); |
| 158 | break; | 162 | break; |
| 163 | case CPU_UP_CANCELED: | ||
| 164 | case CPU_UP_CANCELED_FROZEN: | ||
| 159 | case CPU_DEAD: | 165 | case CPU_DEAD: |
| 160 | case CPU_DEAD_FROZEN: | 166 | case CPU_DEAD_FROZEN: |
| 161 | device_destroy(cpuid_class, MKDEV(CPUID_MAJOR, cpu)); | 167 | cpuid_device_destroy(cpu); |
| 162 | break; | 168 | break; |
| 163 | } | 169 | } |
| 164 | return NOTIFY_OK; | 170 | return err ? NOTIFY_BAD : NOTIFY_OK; |
| 165 | } | 171 | } |
| 166 | 172 | ||
| 167 | static struct notifier_block __cpuinitdata cpuid_class_cpu_notifier = | 173 | static struct notifier_block __cpuinitdata cpuid_class_cpu_notifier = |
| @@ -198,7 +204,7 @@ static int __init cpuid_init(void) | |||
| 198 | out_class: | 204 | out_class: |
| 199 | i = 0; | 205 | i = 0; |
| 200 | for_each_online_cpu(i) { | 206 | for_each_online_cpu(i) { |
| 201 | device_destroy(cpuid_class, MKDEV(CPUID_MAJOR, i)); | 207 | cpuid_device_destroy(i); |
| 202 | } | 208 | } |
| 203 | class_destroy(cpuid_class); | 209 | class_destroy(cpuid_class); |
| 204 | out_chrdev: | 210 | out_chrdev: |
| @@ -212,7 +218,7 @@ static void __exit cpuid_exit(void) | |||
| 212 | int cpu = 0; | 218 | int cpu = 0; |
| 213 | 219 | ||
| 214 | for_each_online_cpu(cpu) | 220 | for_each_online_cpu(cpu) |
| 215 | device_destroy(cpuid_class, MKDEV(CPUID_MAJOR, cpu)); | 221 | cpuid_device_destroy(cpu); |
| 216 | class_destroy(cpuid_class); | 222 | class_destroy(cpuid_class); |
| 217 | unregister_chrdev(CPUID_MAJOR, "cpu/cpuid"); | 223 | unregister_chrdev(CPUID_MAJOR, "cpu/cpuid"); |
| 218 | unregister_hotcpu_notifier(&cpuid_class_cpu_notifier); | 224 | unregister_hotcpu_notifier(&cpuid_class_cpu_notifier); |
diff --git a/arch/x86/kernel/early-quirks_64.c b/arch/x86/kernel/early-quirks.c index 13aa4fd728f3..dc34acbd54aa 100644 --- a/arch/x86/kernel/early-quirks_64.c +++ b/arch/x86/kernel/early-quirks.c | |||
| @@ -13,9 +13,13 @@ | |||
| 13 | #include <linux/acpi.h> | 13 | #include <linux/acpi.h> |
| 14 | #include <linux/pci_ids.h> | 14 | #include <linux/pci_ids.h> |
| 15 | #include <asm/pci-direct.h> | 15 | #include <asm/pci-direct.h> |
| 16 | #include <asm/proto.h> | ||
| 17 | #include <asm/iommu.h> | ||
| 18 | #include <asm/dma.h> | 16 | #include <asm/dma.h> |
| 17 | #include <asm/io_apic.h> | ||
| 18 | #include <asm/apic.h> | ||
| 19 | |||
| 20 | #ifdef CONFIG_IOMMU | ||
| 21 | #include <asm/iommu.h> | ||
| 22 | #endif | ||
| 19 | 23 | ||
| 20 | static void __init via_bugs(void) | 24 | static void __init via_bugs(void) |
| 21 | { | 25 | { |
| @@ -23,7 +27,8 @@ static void __init via_bugs(void) | |||
| 23 | if ((end_pfn > MAX_DMA32_PFN || force_iommu) && | 27 | if ((end_pfn > MAX_DMA32_PFN || force_iommu) && |
| 24 | !iommu_aperture_allowed) { | 28 | !iommu_aperture_allowed) { |
| 25 | printk(KERN_INFO | 29 | printk(KERN_INFO |
| 26 | "Looks like a VIA chipset. Disabling IOMMU. Override with iommu=allowed\n"); | 30 | "Looks like a VIA chipset. Disabling IOMMU." |
| 31 | " Override with iommu=allowed\n"); | ||
| 27 | iommu_aperture_disabled = 1; | 32 | iommu_aperture_disabled = 1; |
| 28 | } | 33 | } |
| 29 | #endif | 34 | #endif |
| @@ -40,6 +45,7 @@ static int __init nvidia_hpet_check(struct acpi_table_header *header) | |||
| 40 | static void __init nvidia_bugs(void) | 45 | static void __init nvidia_bugs(void) |
| 41 | { | 46 | { |
| 42 | #ifdef CONFIG_ACPI | 47 | #ifdef CONFIG_ACPI |
| 48 | #ifdef CONFIG_X86_IO_APIC | ||
| 43 | /* | 49 | /* |
| 44 | * All timer overrides on Nvidia are | 50 | * All timer overrides on Nvidia are |
| 45 | * wrong unless HPET is enabled. | 51 | * wrong unless HPET is enabled. |
| @@ -59,17 +65,20 @@ static void __init nvidia_bugs(void) | |||
| 59 | "try acpi_use_timer_override\n"); | 65 | "try acpi_use_timer_override\n"); |
| 60 | } | 66 | } |
| 61 | #endif | 67 | #endif |
| 68 | #endif | ||
| 62 | /* RED-PEN skip them on mptables too? */ | 69 | /* RED-PEN skip them on mptables too? */ |
| 63 | 70 | ||
| 64 | } | 71 | } |
| 65 | 72 | ||
| 66 | static void __init ati_bugs(void) | 73 | static void __init ati_bugs(void) |
| 67 | { | 74 | { |
| 75 | #ifdef CONFIG_X86_IO_APIC | ||
| 68 | if (timer_over_8254 == 1) { | 76 | if (timer_over_8254 == 1) { |
| 69 | timer_over_8254 = 0; | 77 | timer_over_8254 = 0; |
| 70 | printk(KERN_INFO | 78 | printk(KERN_INFO |
| 71 | "ATI board detected. Disabling timer routing over 8254.\n"); | 79 | "ATI board detected. Disabling timer routing over 8254.\n"); |
| 72 | } | 80 | } |
| 81 | #endif | ||
| 73 | } | 82 | } |
| 74 | 83 | ||
| 75 | struct chipset { | 84 | struct chipset { |
| @@ -104,7 +113,7 @@ void __init early_quirks(void) | |||
| 104 | if (class == 0xffffffff) | 113 | if (class == 0xffffffff) |
| 105 | break; | 114 | break; |
| 106 | 115 | ||
| 107 | if ((class >> 16) != PCI_CLASS_BRIDGE_PCI) | 116 | if ((class >> 16) != PCI_CLASS_BRIDGE_PCI) |
| 108 | continue; | 117 | continue; |
| 109 | 118 | ||
| 110 | vendor = read_pci_config(num, slot, func, | 119 | vendor = read_pci_config(num, slot, func, |
diff --git a/arch/x86/kernel/genapic_64.c b/arch/x86/kernel/genapic_64.c index 4ae03e3e8294..ce703e21c912 100644 --- a/arch/x86/kernel/genapic_64.c +++ b/arch/x86/kernel/genapic_64.c | |||
| @@ -24,10 +24,19 @@ | |||
| 24 | #include <acpi/acpi_bus.h> | 24 | #include <acpi/acpi_bus.h> |
| 25 | #endif | 25 | #endif |
| 26 | 26 | ||
| 27 | /* which logical CPU number maps to which CPU (physical APIC ID) */ | 27 | /* |
| 28 | u8 x86_cpu_to_apicid[NR_CPUS] __read_mostly | 28 | * which logical CPU number maps to which CPU (physical APIC ID) |
| 29 | * | ||
| 30 | * The following static array is used during kernel startup | ||
| 31 | * and the x86_cpu_to_apicid_ptr contains the address of the | ||
| 32 | * array during this time. Is it zeroed when the per_cpu | ||
| 33 | * data area is removed. | ||
| 34 | */ | ||
| 35 | u8 x86_cpu_to_apicid_init[NR_CPUS] __initdata | ||
| 29 | = { [0 ... NR_CPUS-1] = BAD_APICID }; | 36 | = { [0 ... NR_CPUS-1] = BAD_APICID }; |
| 30 | EXPORT_SYMBOL(x86_cpu_to_apicid); | 37 | void *x86_cpu_to_apicid_ptr; |
| 38 | DEFINE_PER_CPU(u8, x86_cpu_to_apicid) = BAD_APICID; | ||
| 39 | EXPORT_PER_CPU_SYMBOL(x86_cpu_to_apicid); | ||
| 31 | 40 | ||
| 32 | struct genapic __read_mostly *genapic = &apic_flat; | 41 | struct genapic __read_mostly *genapic = &apic_flat; |
| 33 | 42 | ||
diff --git a/arch/x86/kernel/genapic_flat_64.c b/arch/x86/kernel/genapic_flat_64.c index 91c7526768ee..07352b74bda6 100644 --- a/arch/x86/kernel/genapic_flat_64.c +++ b/arch/x86/kernel/genapic_flat_64.c | |||
| @@ -172,7 +172,7 @@ static unsigned int physflat_cpu_mask_to_apicid(cpumask_t cpumask) | |||
| 172 | */ | 172 | */ |
| 173 | cpu = first_cpu(cpumask); | 173 | cpu = first_cpu(cpumask); |
| 174 | if ((unsigned)cpu < NR_CPUS) | 174 | if ((unsigned)cpu < NR_CPUS) |
| 175 | return x86_cpu_to_apicid[cpu]; | 175 | return per_cpu(x86_cpu_to_apicid, cpu); |
| 176 | else | 176 | else |
| 177 | return BAD_APICID; | 177 | return BAD_APICID; |
| 178 | } | 178 | } |
diff --git a/arch/x86/kernel/head64.c b/arch/x86/kernel/head64.c index a7eee0a4751d..6b3469311e42 100644 --- a/arch/x86/kernel/head64.c +++ b/arch/x86/kernel/head64.c | |||
| @@ -58,7 +58,7 @@ void __init x86_64_start_kernel(char * real_mode_data) | |||
| 58 | 58 | ||
| 59 | for (i = 0; i < IDT_ENTRIES; i++) | 59 | for (i = 0; i < IDT_ENTRIES; i++) |
| 60 | set_intr_gate(i, early_idt_handler); | 60 | set_intr_gate(i, early_idt_handler); |
| 61 | asm volatile("lidt %0" :: "m" (idt_descr)); | 61 | load_idt((const struct desc_ptr *)&idt_descr); |
| 62 | 62 | ||
| 63 | early_printk("Kernel alive\n"); | 63 | early_printk("Kernel alive\n"); |
| 64 | 64 | ||
diff --git a/arch/x86/kernel/hpet.c b/arch/x86/kernel/hpet.c index 772afab8f196..53303f2e5475 100644 --- a/arch/x86/kernel/hpet.c +++ b/arch/x86/kernel/hpet.c | |||
| @@ -69,12 +69,15 @@ static inline void hpet_clear_mapping(void) | |||
| 69 | * HPET command line enable / disable | 69 | * HPET command line enable / disable |
| 70 | */ | 70 | */ |
| 71 | static int boot_hpet_disable; | 71 | static int boot_hpet_disable; |
| 72 | int hpet_force_user; | ||
| 72 | 73 | ||
| 73 | static int __init hpet_setup(char* str) | 74 | static int __init hpet_setup(char* str) |
| 74 | { | 75 | { |
| 75 | if (str) { | 76 | if (str) { |
| 76 | if (!strncmp("disable", str, 7)) | 77 | if (!strncmp("disable", str, 7)) |
| 77 | boot_hpet_disable = 1; | 78 | boot_hpet_disable = 1; |
| 79 | if (!strncmp("force", str, 5)) | ||
| 80 | hpet_force_user = 1; | ||
| 78 | } | 81 | } |
| 79 | return 1; | 82 | return 1; |
| 80 | } | 83 | } |
diff --git a/arch/x86/kernel/i8259_32.c b/arch/x86/kernel/i8259_32.c index d34a10cc13a7..f634fc715c99 100644 --- a/arch/x86/kernel/i8259_32.c +++ b/arch/x86/kernel/i8259_32.c | |||
| @@ -403,7 +403,8 @@ void __init native_init_IRQ(void) | |||
| 403 | int vector = FIRST_EXTERNAL_VECTOR + i; | 403 | int vector = FIRST_EXTERNAL_VECTOR + i; |
| 404 | if (i >= NR_IRQS) | 404 | if (i >= NR_IRQS) |
| 405 | break; | 405 | break; |
| 406 | if (vector != SYSCALL_VECTOR) | 406 | /* SYSCALL_VECTOR was reserved in trap_init. */ |
| 407 | if (!test_bit(vector, used_vectors)) | ||
| 407 | set_intr_gate(vector, interrupt[i]); | 408 | set_intr_gate(vector, interrupt[i]); |
| 408 | } | 409 | } |
| 409 | 410 | ||
diff --git a/arch/x86/kernel/init_task_32.c b/arch/x86/kernel/init_task.c index d26fc063a760..468c9c437842 100644 --- a/arch/x86/kernel/init_task_32.c +++ b/arch/x86/kernel/init_task.c | |||
| @@ -15,7 +15,6 @@ static struct files_struct init_files = INIT_FILES; | |||
| 15 | static struct signal_struct init_signals = INIT_SIGNALS(init_signals); | 15 | static struct signal_struct init_signals = INIT_SIGNALS(init_signals); |
| 16 | static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); | 16 | static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); |
| 17 | struct mm_struct init_mm = INIT_MM(init_mm); | 17 | struct mm_struct init_mm = INIT_MM(init_mm); |
| 18 | |||
| 19 | EXPORT_SYMBOL(init_mm); | 18 | EXPORT_SYMBOL(init_mm); |
| 20 | 19 | ||
| 21 | /* | 20 | /* |
| @@ -25,7 +24,7 @@ EXPORT_SYMBOL(init_mm); | |||
| 25 | * way process stacks are handled. This is done by having a special | 24 | * way process stacks are handled. This is done by having a special |
| 26 | * "init_task" linker map entry.. | 25 | * "init_task" linker map entry.. |
| 27 | */ | 26 | */ |
| 28 | union thread_union init_thread_union | 27 | union thread_union init_thread_union |
| 29 | __attribute__((__section__(".data.init_task"))) = | 28 | __attribute__((__section__(".data.init_task"))) = |
| 30 | { INIT_THREAD_INFO(init_task) }; | 29 | { INIT_THREAD_INFO(init_task) }; |
| 31 | 30 | ||
| @@ -35,12 +34,14 @@ union thread_union init_thread_union | |||
| 35 | * All other task structs will be allocated on slabs in fork.c | 34 | * All other task structs will be allocated on slabs in fork.c |
| 36 | */ | 35 | */ |
| 37 | struct task_struct init_task = INIT_TASK(init_task); | 36 | struct task_struct init_task = INIT_TASK(init_task); |
| 38 | |||
| 39 | EXPORT_SYMBOL(init_task); | 37 | EXPORT_SYMBOL(init_task); |
| 40 | 38 | ||
| 41 | /* | 39 | /* |
| 42 | * per-CPU TSS segments. Threads are completely 'soft' on Linux, | 40 | * per-CPU TSS segments. Threads are completely 'soft' on Linux, |
| 43 | * no more per-task TSS's. | 41 | * no more per-task TSS's. The TSS size is kept cacheline-aligned |
| 44 | */ | 42 | * so they are allowed to end up in the .data.cacheline_aligned |
| 43 | * section. Since TSS's are completely CPU-local, we want them | ||
| 44 | * on exact cacheline boundaries, to eliminate cacheline ping-pong. | ||
| 45 | */ | ||
| 45 | DEFINE_PER_CPU_SHARED_ALIGNED(struct tss_struct, init_tss) = INIT_TSS; | 46 | DEFINE_PER_CPU_SHARED_ALIGNED(struct tss_struct, init_tss) = INIT_TSS; |
| 46 | 47 | ||
diff --git a/arch/x86/kernel/init_task_64.c b/arch/x86/kernel/init_task_64.c deleted file mode 100644 index 4ff33d4f8551..000000000000 --- a/arch/x86/kernel/init_task_64.c +++ /dev/null | |||
| @@ -1,54 +0,0 @@ | |||
| 1 | #include <linux/mm.h> | ||
| 2 | #include <linux/module.h> | ||
| 3 | #include <linux/sched.h> | ||
| 4 | #include <linux/init.h> | ||
| 5 | #include <linux/init_task.h> | ||
| 6 | #include <linux/fs.h> | ||
| 7 | #include <linux/mqueue.h> | ||
| 8 | |||
| 9 | #include <asm/uaccess.h> | ||
| 10 | #include <asm/pgtable.h> | ||
| 11 | #include <asm/desc.h> | ||
| 12 | |||
| 13 | static struct fs_struct init_fs = INIT_FS; | ||
| 14 | static struct files_struct init_files = INIT_FILES; | ||
| 15 | static struct signal_struct init_signals = INIT_SIGNALS(init_signals); | ||
| 16 | static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); | ||
| 17 | struct mm_struct init_mm = INIT_MM(init_mm); | ||
| 18 | |||
| 19 | EXPORT_SYMBOL(init_mm); | ||
| 20 | |||
| 21 | /* | ||
| 22 | * Initial task structure. | ||
| 23 | * | ||
| 24 | * We need to make sure that this is 8192-byte aligned due to the | ||
| 25 | * way process stacks are handled. This is done by having a special | ||
| 26 | * "init_task" linker map entry.. | ||
| 27 | */ | ||
| 28 | union thread_union init_thread_union | ||
| 29 | __attribute__((__section__(".data.init_task"))) = | ||
| 30 | { INIT_THREAD_INFO(init_task) }; | ||
| 31 | |||
| 32 | /* | ||
| 33 | * Initial task structure. | ||
| 34 | * | ||
| 35 | * All other task structs will be allocated on slabs in fork.c | ||
| 36 | */ | ||
| 37 | struct task_struct init_task = INIT_TASK(init_task); | ||
| 38 | |||
| 39 | EXPORT_SYMBOL(init_task); | ||
| 40 | /* | ||
| 41 | * per-CPU TSS segments. Threads are completely 'soft' on Linux, | ||
| 42 | * no more per-task TSS's. The TSS size is kept cacheline-aligned | ||
| 43 | * so they are allowed to end up in the .data.cacheline_aligned | ||
| 44 | * section. Since TSS's are completely CPU-local, we want them | ||
| 45 | * on exact cacheline boundaries, to eliminate cacheline ping-pong. | ||
| 46 | */ | ||
| 47 | DEFINE_PER_CPU_SHARED_ALIGNED(struct tss_struct, init_tss) = INIT_TSS; | ||
| 48 | |||
| 49 | /* Copies of the original ist values from the tss are only accessed during | ||
| 50 | * debugging, no special alignment required. | ||
| 51 | */ | ||
| 52 | DEFINE_PER_CPU(struct orig_ist, orig_ist); | ||
| 53 | |||
| 54 | #define ALIGN_TO_4K __attribute__((section(".data.init_task"))) | ||
diff --git a/arch/x86/kernel/io_apic_32.c b/arch/x86/kernel/io_apic_32.c index 03e88fc00e5a..f35c6eb33da9 100644 --- a/arch/x86/kernel/io_apic_32.c +++ b/arch/x86/kernel/io_apic_32.c | |||
| @@ -1198,7 +1198,7 @@ static u8 irq_vector[NR_IRQ_VECTORS] __read_mostly = { FIRST_DEVICE_VECTOR , 0 } | |||
| 1198 | static int __assign_irq_vector(int irq) | 1198 | static int __assign_irq_vector(int irq) |
| 1199 | { | 1199 | { |
| 1200 | static int current_vector = FIRST_DEVICE_VECTOR, current_offset = 0; | 1200 | static int current_vector = FIRST_DEVICE_VECTOR, current_offset = 0; |
| 1201 | int vector, offset, i; | 1201 | int vector, offset; |
| 1202 | 1202 | ||
| 1203 | BUG_ON((unsigned)irq >= NR_IRQ_VECTORS); | 1203 | BUG_ON((unsigned)irq >= NR_IRQ_VECTORS); |
| 1204 | 1204 | ||
| @@ -1215,11 +1215,8 @@ next: | |||
| 1215 | } | 1215 | } |
| 1216 | if (vector == current_vector) | 1216 | if (vector == current_vector) |
| 1217 | return -ENOSPC; | 1217 | return -ENOSPC; |
| 1218 | if (vector == SYSCALL_VECTOR) | 1218 | if (test_and_set_bit(vector, used_vectors)) |
| 1219 | goto next; | 1219 | goto next; |
| 1220 | for (i = 0; i < NR_IRQ_VECTORS; i++) | ||
| 1221 | if (irq_vector[i] == vector) | ||
| 1222 | goto next; | ||
| 1223 | 1220 | ||
| 1224 | current_vector = vector; | 1221 | current_vector = vector; |
| 1225 | current_offset = offset; | 1222 | current_offset = offset; |
| @@ -2295,6 +2292,12 @@ static inline void __init check_timer(void) | |||
| 2295 | 2292 | ||
| 2296 | void __init setup_IO_APIC(void) | 2293 | void __init setup_IO_APIC(void) |
| 2297 | { | 2294 | { |
| 2295 | int i; | ||
| 2296 | |||
| 2297 | /* Reserve all the system vectors. */ | ||
| 2298 | for (i = FIRST_SYSTEM_VECTOR; i < NR_VECTORS; i++) | ||
| 2299 | set_bit(i, used_vectors); | ||
| 2300 | |||
| 2298 | enable_IO_APIC(); | 2301 | enable_IO_APIC(); |
| 2299 | 2302 | ||
| 2300 | if (acpi_ioapic) | 2303 | if (acpi_ioapic) |
diff --git a/arch/x86/kernel/mce_64.c b/arch/x86/kernel/mce_64.c index 82c85bdff3a1..07bbfe7aa7f7 100644 --- a/arch/x86/kernel/mce_64.c +++ b/arch/x86/kernel/mce_64.c | |||
| @@ -799,7 +799,8 @@ static __cpuinit int mce_create_device(unsigned int cpu) | |||
| 799 | { | 799 | { |
| 800 | int err; | 800 | int err; |
| 801 | int i; | 801 | int i; |
| 802 | if (!mce_available(&cpu_data[cpu])) | 802 | |
| 803 | if (!mce_available(&cpu_data(cpu))) | ||
| 803 | return -EIO; | 804 | return -EIO; |
| 804 | 805 | ||
| 805 | memset(&per_cpu(device_mce, cpu).kobj, 0, sizeof(struct kobject)); | 806 | memset(&per_cpu(device_mce, cpu).kobj, 0, sizeof(struct kobject)); |
diff --git a/arch/x86/kernel/mce_amd_64.c b/arch/x86/kernel/mce_amd_64.c index 0d2afd96aca4..752fb16a817d 100644 --- a/arch/x86/kernel/mce_amd_64.c +++ b/arch/x86/kernel/mce_amd_64.c | |||
| @@ -472,11 +472,11 @@ static __cpuinit int threshold_create_bank(unsigned int cpu, unsigned int bank) | |||
| 472 | sprintf(name, "threshold_bank%i", bank); | 472 | sprintf(name, "threshold_bank%i", bank); |
| 473 | 473 | ||
| 474 | #ifdef CONFIG_SMP | 474 | #ifdef CONFIG_SMP |
| 475 | if (cpu_data[cpu].cpu_core_id && shared_bank[bank]) { /* symlink */ | 475 | if (cpu_data(cpu).cpu_core_id && shared_bank[bank]) { /* symlink */ |
| 476 | i = first_cpu(per_cpu(cpu_core_map, cpu)); | 476 | i = first_cpu(per_cpu(cpu_core_map, cpu)); |
| 477 | 477 | ||
| 478 | /* first core not up yet */ | 478 | /* first core not up yet */ |
| 479 | if (cpu_data[i].cpu_core_id) | 479 | if (cpu_data(i).cpu_core_id) |
| 480 | goto out; | 480 | goto out; |
| 481 | 481 | ||
| 482 | /* already linked */ | 482 | /* already linked */ |
diff --git a/arch/x86/kernel/microcode.c b/arch/x86/kernel/microcode.c index 09cf78110358..09c315214a5e 100644 --- a/arch/x86/kernel/microcode.c +++ b/arch/x86/kernel/microcode.c | |||
| @@ -132,7 +132,7 @@ static struct ucode_cpu_info { | |||
| 132 | 132 | ||
| 133 | static void collect_cpu_info(int cpu_num) | 133 | static void collect_cpu_info(int cpu_num) |
| 134 | { | 134 | { |
| 135 | struct cpuinfo_x86 *c = cpu_data + cpu_num; | 135 | struct cpuinfo_x86 *c = &cpu_data(cpu_num); |
| 136 | struct ucode_cpu_info *uci = ucode_cpu_info + cpu_num; | 136 | struct ucode_cpu_info *uci = ucode_cpu_info + cpu_num; |
| 137 | unsigned int val[2]; | 137 | unsigned int val[2]; |
| 138 | 138 | ||
| @@ -522,7 +522,7 @@ static struct platform_device *microcode_pdev; | |||
| 522 | static int cpu_request_microcode(int cpu) | 522 | static int cpu_request_microcode(int cpu) |
| 523 | { | 523 | { |
| 524 | char name[30]; | 524 | char name[30]; |
| 525 | struct cpuinfo_x86 *c = cpu_data + cpu; | 525 | struct cpuinfo_x86 *c = &cpu_data(cpu); |
| 526 | const struct firmware *firmware; | 526 | const struct firmware *firmware; |
| 527 | void *buf; | 527 | void *buf; |
| 528 | unsigned long size; | 528 | unsigned long size; |
| @@ -570,7 +570,7 @@ static int cpu_request_microcode(int cpu) | |||
| 570 | 570 | ||
| 571 | static int apply_microcode_check_cpu(int cpu) | 571 | static int apply_microcode_check_cpu(int cpu) |
| 572 | { | 572 | { |
| 573 | struct cpuinfo_x86 *c = cpu_data + cpu; | 573 | struct cpuinfo_x86 *c = &cpu_data(cpu); |
| 574 | struct ucode_cpu_info *uci = ucode_cpu_info + cpu; | 574 | struct ucode_cpu_info *uci = ucode_cpu_info + cpu; |
| 575 | cpumask_t old; | 575 | cpumask_t old; |
| 576 | unsigned int val[2]; | 576 | unsigned int val[2]; |
diff --git a/arch/x86/kernel/mpparse_64.c b/arch/x86/kernel/mpparse_64.c index 8bf0ca03ac8e..ef4aab123581 100644 --- a/arch/x86/kernel/mpparse_64.c +++ b/arch/x86/kernel/mpparse_64.c | |||
| @@ -57,6 +57,8 @@ unsigned long mp_lapic_addr = 0; | |||
| 57 | 57 | ||
| 58 | /* Processor that is doing the boot up */ | 58 | /* Processor that is doing the boot up */ |
| 59 | unsigned int boot_cpu_id = -1U; | 59 | unsigned int boot_cpu_id = -1U; |
| 60 | EXPORT_SYMBOL(boot_cpu_id); | ||
| 61 | |||
| 60 | /* Internal processor count */ | 62 | /* Internal processor count */ |
| 61 | unsigned int num_processors __cpuinitdata = 0; | 63 | unsigned int num_processors __cpuinitdata = 0; |
| 62 | 64 | ||
| @@ -86,7 +88,7 @@ static int __init mpf_checksum(unsigned char *mp, int len) | |||
| 86 | return sum & 0xFF; | 88 | return sum & 0xFF; |
| 87 | } | 89 | } |
| 88 | 90 | ||
| 89 | static void __cpuinit MP_processor_info (struct mpc_config_processor *m) | 91 | static void __cpuinit MP_processor_info(struct mpc_config_processor *m) |
| 90 | { | 92 | { |
| 91 | int cpu; | 93 | int cpu; |
| 92 | cpumask_t tmp_map; | 94 | cpumask_t tmp_map; |
| @@ -123,7 +125,18 @@ static void __cpuinit MP_processor_info (struct mpc_config_processor *m) | |||
| 123 | cpu = 0; | 125 | cpu = 0; |
| 124 | } | 126 | } |
| 125 | bios_cpu_apicid[cpu] = m->mpc_apicid; | 127 | bios_cpu_apicid[cpu] = m->mpc_apicid; |
| 126 | x86_cpu_to_apicid[cpu] = m->mpc_apicid; | 128 | /* |
| 129 | * We get called early in the the start_kernel initialization | ||
| 130 | * process when the per_cpu data area is not yet setup, so we | ||
| 131 | * use a static array that is removed after the per_cpu data | ||
| 132 | * area is created. | ||
| 133 | */ | ||
| 134 | if (x86_cpu_to_apicid_ptr) { | ||
| 135 | u8 *x86_cpu_to_apicid = (u8 *)x86_cpu_to_apicid_ptr; | ||
| 136 | x86_cpu_to_apicid[cpu] = m->mpc_apicid; | ||
| 137 | } else { | ||
| 138 | per_cpu(x86_cpu_to_apicid, cpu) = m->mpc_apicid; | ||
| 139 | } | ||
| 127 | 140 | ||
| 128 | cpu_set(cpu, cpu_possible_map); | 141 | cpu_set(cpu, cpu_possible_map); |
| 129 | cpu_set(cpu, cpu_present_map); | 142 | cpu_set(cpu, cpu_present_map); |
diff --git a/arch/x86/kernel/msr.c b/arch/x86/kernel/msr.c index e18e516cf549..ee6eba4ecfea 100644 --- a/arch/x86/kernel/msr.c +++ b/arch/x86/kernel/msr.c | |||
| @@ -112,7 +112,7 @@ static ssize_t msr_write(struct file *file, const char __user *buf, | |||
| 112 | static int msr_open(struct inode *inode, struct file *file) | 112 | static int msr_open(struct inode *inode, struct file *file) |
| 113 | { | 113 | { |
| 114 | unsigned int cpu = iminor(file->f_path.dentry->d_inode); | 114 | unsigned int cpu = iminor(file->f_path.dentry->d_inode); |
| 115 | struct cpuinfo_x86 *c = &(cpu_data)[cpu]; | 115 | struct cpuinfo_x86 *c = &cpu_data(cpu); |
| 116 | 116 | ||
| 117 | if (cpu >= NR_CPUS || !cpu_online(cpu)) | 117 | if (cpu >= NR_CPUS || !cpu_online(cpu)) |
| 118 | return -ENXIO; /* No such CPU */ | 118 | return -ENXIO; /* No such CPU */ |
diff --git a/arch/x86/kernel/pci-dma_64.c b/arch/x86/kernel/pci-dma_64.c index b2b42bdb0a15..afaf9f12c032 100644 --- a/arch/x86/kernel/pci-dma_64.c +++ b/arch/x86/kernel/pci-dma_64.c | |||
| @@ -11,7 +11,7 @@ | |||
| 11 | #include <asm/iommu.h> | 11 | #include <asm/iommu.h> |
| 12 | #include <asm/calgary.h> | 12 | #include <asm/calgary.h> |
| 13 | 13 | ||
| 14 | int iommu_merge __read_mostly = 0; | 14 | int iommu_merge __read_mostly = 1; |
| 15 | EXPORT_SYMBOL(iommu_merge); | 15 | EXPORT_SYMBOL(iommu_merge); |
| 16 | 16 | ||
| 17 | dma_addr_t bad_dma_address __read_mostly; | 17 | dma_addr_t bad_dma_address __read_mostly; |
diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c index 044a47745a5c..7b899584d290 100644 --- a/arch/x86/kernel/process_32.c +++ b/arch/x86/kernel/process_32.c | |||
| @@ -295,34 +295,52 @@ static int __init idle_setup(char *str) | |||
| 295 | } | 295 | } |
| 296 | early_param("idle", idle_setup); | 296 | early_param("idle", idle_setup); |
| 297 | 297 | ||
| 298 | void show_regs(struct pt_regs * regs) | 298 | void __show_registers(struct pt_regs *regs, int all) |
| 299 | { | 299 | { |
| 300 | unsigned long cr0 = 0L, cr2 = 0L, cr3 = 0L, cr4 = 0L; | 300 | unsigned long cr0 = 0L, cr2 = 0L, cr3 = 0L, cr4 = 0L; |
| 301 | unsigned long d0, d1, d2, d3, d6, d7; | 301 | unsigned long d0, d1, d2, d3, d6, d7; |
| 302 | unsigned long esp; | ||
| 303 | unsigned short ss, gs; | ||
| 304 | |||
| 305 | if (user_mode_vm(regs)) { | ||
| 306 | esp = regs->esp; | ||
| 307 | ss = regs->xss & 0xffff; | ||
| 308 | savesegment(gs, gs); | ||
| 309 | } else { | ||
| 310 | esp = (unsigned long) (®s->esp); | ||
| 311 | savesegment(ss, ss); | ||
| 312 | savesegment(gs, gs); | ||
| 313 | } | ||
| 302 | 314 | ||
| 303 | printk("\n"); | 315 | printk("\n"); |
| 304 | printk("Pid: %d, comm: %20s\n", task_pid_nr(current), current->comm); | 316 | printk("Pid: %d, comm: %s %s (%s %.*s)\n", |
| 305 | printk("EIP: %04x:[<%08lx>] CPU: %d\n",0xffff & regs->xcs,regs->eip, smp_processor_id()); | 317 | task_pid_nr(current), current->comm, |
| 318 | print_tainted(), init_utsname()->release, | ||
| 319 | (int)strcspn(init_utsname()->version, " "), | ||
| 320 | init_utsname()->version); | ||
| 321 | |||
| 322 | printk("EIP: %04x:[<%08lx>] EFLAGS: %08lx CPU: %d\n", | ||
| 323 | 0xffff & regs->xcs, regs->eip, regs->eflags, | ||
| 324 | smp_processor_id()); | ||
| 306 | print_symbol("EIP is at %s\n", regs->eip); | 325 | print_symbol("EIP is at %s\n", regs->eip); |
| 307 | 326 | ||
| 308 | if (user_mode_vm(regs)) | ||
| 309 | printk(" ESP: %04x:%08lx",0xffff & regs->xss,regs->esp); | ||
| 310 | printk(" EFLAGS: %08lx %s (%s %.*s)\n", | ||
| 311 | regs->eflags, print_tainted(), init_utsname()->release, | ||
| 312 | (int)strcspn(init_utsname()->version, " "), | ||
| 313 | init_utsname()->version); | ||
| 314 | printk("EAX: %08lx EBX: %08lx ECX: %08lx EDX: %08lx\n", | 327 | printk("EAX: %08lx EBX: %08lx ECX: %08lx EDX: %08lx\n", |
| 315 | regs->eax,regs->ebx,regs->ecx,regs->edx); | 328 | regs->eax, regs->ebx, regs->ecx, regs->edx); |
| 316 | printk("ESI: %08lx EDI: %08lx EBP: %08lx", | 329 | printk("ESI: %08lx EDI: %08lx EBP: %08lx ESP: %08lx\n", |
| 317 | regs->esi, regs->edi, regs->ebp); | 330 | regs->esi, regs->edi, regs->ebp, esp); |
| 318 | printk(" DS: %04x ES: %04x FS: %04x\n", | 331 | printk(" DS: %04x ES: %04x FS: %04x GS: %04x SS: %04x\n", |
| 319 | 0xffff & regs->xds,0xffff & regs->xes, 0xffff & regs->xfs); | 332 | regs->xds & 0xffff, regs->xes & 0xffff, |
| 333 | regs->xfs & 0xffff, gs, ss); | ||
| 334 | |||
| 335 | if (!all) | ||
| 336 | return; | ||
| 320 | 337 | ||
| 321 | cr0 = read_cr0(); | 338 | cr0 = read_cr0(); |
| 322 | cr2 = read_cr2(); | 339 | cr2 = read_cr2(); |
| 323 | cr3 = read_cr3(); | 340 | cr3 = read_cr3(); |
| 324 | cr4 = read_cr4_safe(); | 341 | cr4 = read_cr4_safe(); |
| 325 | printk("CR0: %08lx CR2: %08lx CR3: %08lx CR4: %08lx\n", cr0, cr2, cr3, cr4); | 342 | printk("CR0: %08lx CR2: %08lx CR3: %08lx CR4: %08lx\n", |
| 343 | cr0, cr2, cr3, cr4); | ||
| 326 | 344 | ||
| 327 | get_debugreg(d0, 0); | 345 | get_debugreg(d0, 0); |
| 328 | get_debugreg(d1, 1); | 346 | get_debugreg(d1, 1); |
| @@ -330,10 +348,16 @@ void show_regs(struct pt_regs * regs) | |||
| 330 | get_debugreg(d3, 3); | 348 | get_debugreg(d3, 3); |
| 331 | printk("DR0: %08lx DR1: %08lx DR2: %08lx DR3: %08lx\n", | 349 | printk("DR0: %08lx DR1: %08lx DR2: %08lx DR3: %08lx\n", |
| 332 | d0, d1, d2, d3); | 350 | d0, d1, d2, d3); |
| 351 | |||
| 333 | get_debugreg(d6, 6); | 352 | get_debugreg(d6, 6); |
| 334 | get_debugreg(d7, 7); | 353 | get_debugreg(d7, 7); |
| 335 | printk("DR6: %08lx DR7: %08lx\n", d6, d7); | 354 | printk("DR6: %08lx DR7: %08lx\n", |
| 355 | d6, d7); | ||
| 356 | } | ||
| 336 | 357 | ||
| 358 | void show_regs(struct pt_regs *regs) | ||
| 359 | { | ||
| 360 | __show_registers(regs, 1); | ||
| 337 | show_trace(NULL, regs, ®s->esp); | 361 | show_trace(NULL, regs, ®s->esp); |
| 338 | } | 362 | } |
| 339 | 363 | ||
diff --git a/arch/x86/kernel/quirks.c b/arch/x86/kernel/quirks.c index d769e204f942..a4ce1911efdf 100644 --- a/arch/x86/kernel/quirks.c +++ b/arch/x86/kernel/quirks.c | |||
| @@ -45,9 +45,12 @@ static void __devinit quirk_intel_irqbalance(struct pci_dev *dev) | |||
| 45 | if (!(config & 0x2)) | 45 | if (!(config & 0x2)) |
| 46 | pci_write_config_byte(dev, 0xf4, config); | 46 | pci_write_config_byte(dev, 0xf4, config); |
| 47 | } | 47 | } |
| 48 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_E7320_MCH, quirk_intel_irqbalance); | 48 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_E7320_MCH, |
| 49 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_E7525_MCH, quirk_intel_irqbalance); | 49 | quirk_intel_irqbalance); |
| 50 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_E7520_MCH, quirk_intel_irqbalance); | 50 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_E7525_MCH, |
| 51 | quirk_intel_irqbalance); | ||
| 52 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_E7520_MCH, | ||
| 53 | quirk_intel_irqbalance); | ||
| 51 | #endif | 54 | #endif |
| 52 | 55 | ||
| 53 | #if defined(CONFIG_HPET_TIMER) | 56 | #if defined(CONFIG_HPET_TIMER) |
| @@ -56,7 +59,8 @@ unsigned long force_hpet_address; | |||
| 56 | static enum { | 59 | static enum { |
| 57 | NONE_FORCE_HPET_RESUME, | 60 | NONE_FORCE_HPET_RESUME, |
| 58 | OLD_ICH_FORCE_HPET_RESUME, | 61 | OLD_ICH_FORCE_HPET_RESUME, |
| 59 | ICH_FORCE_HPET_RESUME | 62 | ICH_FORCE_HPET_RESUME, |
| 63 | VT8237_FORCE_HPET_RESUME | ||
| 60 | } force_hpet_resume_type; | 64 | } force_hpet_resume_type; |
| 61 | 65 | ||
| 62 | static void __iomem *rcba_base; | 66 | static void __iomem *rcba_base; |
| @@ -146,17 +150,17 @@ static void ich_force_enable_hpet(struct pci_dev *dev) | |||
| 146 | } | 150 | } |
| 147 | 151 | ||
| 148 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ESB2_0, | 152 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ESB2_0, |
| 149 | ich_force_enable_hpet); | 153 | ich_force_enable_hpet); |
| 150 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_1, | 154 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_1, |
| 151 | ich_force_enable_hpet); | 155 | ich_force_enable_hpet); |
| 152 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH7_0, | 156 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH7_0, |
| 153 | ich_force_enable_hpet); | 157 | ich_force_enable_hpet); |
| 154 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH7_1, | 158 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH7_1, |
| 155 | ich_force_enable_hpet); | 159 | ich_force_enable_hpet); |
| 156 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH7_31, | 160 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH7_31, |
| 157 | ich_force_enable_hpet); | 161 | ich_force_enable_hpet); |
| 158 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH8_1, | 162 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH8_1, |
| 159 | ich_force_enable_hpet); | 163 | ich_force_enable_hpet); |
| 160 | 164 | ||
| 161 | 165 | ||
| 162 | static struct pci_dev *cached_dev; | 166 | static struct pci_dev *cached_dev; |
| @@ -232,10 +236,91 @@ static void old_ich_force_enable_hpet(struct pci_dev *dev) | |||
| 232 | printk(KERN_DEBUG "Failed to force enable HPET\n"); | 236 | printk(KERN_DEBUG "Failed to force enable HPET\n"); |
| 233 | } | 237 | } |
| 234 | 238 | ||
| 239 | /* | ||
| 240 | * Undocumented chipset features. Make sure that the user enforced | ||
| 241 | * this. | ||
| 242 | */ | ||
| 243 | static void old_ich_force_enable_hpet_user(struct pci_dev *dev) | ||
| 244 | { | ||
| 245 | if (hpet_force_user) | ||
| 246 | old_ich_force_enable_hpet(dev); | ||
| 247 | } | ||
| 248 | |||
| 249 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801CA_0, | ||
| 250 | old_ich_force_enable_hpet_user); | ||
| 251 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801CA_12, | ||
| 252 | old_ich_force_enable_hpet_user); | ||
| 253 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801DB_0, | ||
| 254 | old_ich_force_enable_hpet_user); | ||
| 255 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801DB_12, | ||
| 256 | old_ich_force_enable_hpet_user); | ||
| 235 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801EB_0, | 257 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801EB_0, |
| 236 | old_ich_force_enable_hpet); | 258 | old_ich_force_enable_hpet); |
| 237 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801EB_12, | 259 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801EB_12, |
| 238 | old_ich_force_enable_hpet); | 260 | old_ich_force_enable_hpet); |
| 261 | |||
| 262 | |||
| 263 | static void vt8237_force_hpet_resume(void) | ||
| 264 | { | ||
| 265 | u32 val; | ||
| 266 | |||
| 267 | if (!force_hpet_address || !cached_dev) | ||
| 268 | return; | ||
| 269 | |||
| 270 | val = 0xfed00000 | 0x80; | ||
| 271 | pci_write_config_dword(cached_dev, 0x68, val); | ||
| 272 | |||
| 273 | pci_read_config_dword(cached_dev, 0x68, &val); | ||
| 274 | if (val & 0x80) | ||
| 275 | printk(KERN_DEBUG "Force enabled HPET at resume\n"); | ||
| 276 | else | ||
| 277 | BUG(); | ||
| 278 | } | ||
| 279 | |||
| 280 | static void vt8237_force_enable_hpet(struct pci_dev *dev) | ||
| 281 | { | ||
| 282 | u32 uninitialized_var(val); | ||
| 283 | |||
| 284 | if (!hpet_force_user || hpet_address || force_hpet_address) | ||
| 285 | return; | ||
| 286 | |||
| 287 | pci_read_config_dword(dev, 0x68, &val); | ||
| 288 | /* | ||
| 289 | * Bit 7 is HPET enable bit. | ||
| 290 | * Bit 31:10 is HPET base address (contrary to what datasheet claims) | ||
| 291 | */ | ||
| 292 | if (val & 0x80) { | ||
| 293 | force_hpet_address = (val & ~0x3ff); | ||
| 294 | printk(KERN_DEBUG "HPET at base address 0x%lx\n", | ||
| 295 | force_hpet_address); | ||
| 296 | return; | ||
| 297 | } | ||
| 298 | |||
| 299 | /* | ||
| 300 | * HPET is disabled. Trying enabling at FED00000 and check | ||
| 301 | * whether it sticks | ||
| 302 | */ | ||
| 303 | val = 0xfed00000 | 0x80; | ||
| 304 | pci_write_config_dword(dev, 0x68, val); | ||
| 305 | |||
| 306 | pci_read_config_dword(dev, 0x68, &val); | ||
| 307 | if (val & 0x80) { | ||
| 308 | force_hpet_address = (val & ~0x3ff); | ||
| 309 | printk(KERN_DEBUG "Force enabled HPET at base address 0x%lx\n", | ||
| 310 | force_hpet_address); | ||
| 311 | cached_dev = dev; | ||
| 312 | force_hpet_resume_type = VT8237_FORCE_HPET_RESUME; | ||
| 313 | return; | ||
| 314 | } | ||
| 315 | |||
| 316 | printk(KERN_DEBUG "Failed to force enable HPET\n"); | ||
| 317 | } | ||
| 318 | |||
| 319 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8235, | ||
| 320 | vt8237_force_enable_hpet); | ||
| 321 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8237, | ||
| 322 | vt8237_force_enable_hpet); | ||
| 323 | |||
| 239 | 324 | ||
| 240 | void force_hpet_resume(void) | 325 | void force_hpet_resume(void) |
| 241 | { | 326 | { |
| @@ -246,6 +331,9 @@ void force_hpet_resume(void) | |||
| 246 | case OLD_ICH_FORCE_HPET_RESUME: | 331 | case OLD_ICH_FORCE_HPET_RESUME: |
| 247 | return old_ich_force_hpet_resume(); | 332 | return old_ich_force_hpet_resume(); |
| 248 | 333 | ||
| 334 | case VT8237_FORCE_HPET_RESUME: | ||
| 335 | return vt8237_force_hpet_resume(); | ||
| 336 | |||
| 249 | default: | 337 | default: |
| 250 | break; | 338 | break; |
| 251 | } | 339 | } |
diff --git a/arch/x86/kernel/reboot_64.c b/arch/x86/kernel/reboot_64.c index 368db2b9c5ac..776eb06b6512 100644 --- a/arch/x86/kernel/reboot_64.c +++ b/arch/x86/kernel/reboot_64.c | |||
| @@ -11,6 +11,7 @@ | |||
| 11 | #include <linux/sched.h> | 11 | #include <linux/sched.h> |
| 12 | #include <asm/io.h> | 12 | #include <asm/io.h> |
| 13 | #include <asm/delay.h> | 13 | #include <asm/delay.h> |
| 14 | #include <asm/desc.h> | ||
| 14 | #include <asm/hw_irq.h> | 15 | #include <asm/hw_irq.h> |
| 15 | #include <asm/system.h> | 16 | #include <asm/system.h> |
| 16 | #include <asm/pgtable.h> | 17 | #include <asm/pgtable.h> |
| @@ -136,7 +137,7 @@ void machine_emergency_restart(void) | |||
| 136 | } | 137 | } |
| 137 | 138 | ||
| 138 | case BOOT_TRIPLE: | 139 | case BOOT_TRIPLE: |
| 139 | __asm__ __volatile__("lidt (%0)": :"r" (&no_idt)); | 140 | load_idt((const struct desc_ptr *)&no_idt); |
| 140 | __asm__ __volatile__("int3"); | 141 | __asm__ __volatile__("int3"); |
| 141 | 142 | ||
| 142 | reboot_type = BOOT_KBD; | 143 | reboot_type = BOOT_KBD; |
diff --git a/arch/x86/kernel/reboot_fixups_32.c b/arch/x86/kernel/reboot_fixups_32.c index 8b30b26ad069..1a07bbea7be3 100644 --- a/arch/x86/kernel/reboot_fixups_32.c +++ b/arch/x86/kernel/reboot_fixups_32.c | |||
| @@ -12,6 +12,7 @@ | |||
| 12 | #include <linux/interrupt.h> | 12 | #include <linux/interrupt.h> |
| 13 | #include <asm/reboot_fixups.h> | 13 | #include <asm/reboot_fixups.h> |
| 14 | #include <asm/msr.h> | 14 | #include <asm/msr.h> |
| 15 | #include <asm/geode.h> | ||
| 15 | 16 | ||
| 16 | static void cs5530a_warm_reset(struct pci_dev *dev) | 17 | static void cs5530a_warm_reset(struct pci_dev *dev) |
| 17 | { | 18 | { |
| @@ -24,11 +25,8 @@ static void cs5530a_warm_reset(struct pci_dev *dev) | |||
| 24 | 25 | ||
| 25 | static void cs5536_warm_reset(struct pci_dev *dev) | 26 | static void cs5536_warm_reset(struct pci_dev *dev) |
| 26 | { | 27 | { |
| 27 | /* | 28 | /* writing 1 to the LSB of this MSR causes a hard reset */ |
| 28 | * 6.6.2.12 Soft Reset (DIVIL_SOFT_RESET) | 29 | wrmsrl(MSR_DIVIL_SOFT_RESET, 1ULL); |
| 29 | * writing 1 to the LSB of this MSR causes a hard reset. | ||
| 30 | */ | ||
| 31 | wrmsrl(0x51400017, 1ULL); | ||
| 32 | udelay(50); /* shouldn't get here but be safe and spin a while */ | 30 | udelay(50); /* shouldn't get here but be safe and spin a while */ |
| 33 | } | 31 | } |
| 34 | 32 | ||
diff --git a/arch/x86/kernel/setup64.c b/arch/x86/kernel/setup64.c index ba9188235057..3558ac78c926 100644 --- a/arch/x86/kernel/setup64.c +++ b/arch/x86/kernel/setup64.c | |||
| @@ -185,6 +185,12 @@ void __cpuinit check_efer(void) | |||
| 185 | unsigned long kernel_eflags; | 185 | unsigned long kernel_eflags; |
| 186 | 186 | ||
| 187 | /* | 187 | /* |
| 188 | * Copies of the original ist values from the tss are only accessed during | ||
| 189 | * debugging, no special alignment required. | ||
| 190 | */ | ||
| 191 | DEFINE_PER_CPU(struct orig_ist, orig_ist); | ||
| 192 | |||
| 193 | /* | ||
| 188 | * cpu_init() initializes state that is per-CPU. Some data is already | 194 | * cpu_init() initializes state that is per-CPU. Some data is already |
| 189 | * initialized (naturally) in the bootstrap process, such as the GDT | 195 | * initialized (naturally) in the bootstrap process, such as the GDT |
| 190 | * and IDT. We reload them nevertheless, this function acts as a | 196 | * and IDT. We reload them nevertheless, this function acts as a |
| @@ -224,8 +230,8 @@ void __cpuinit cpu_init (void) | |||
| 224 | memcpy(cpu_gdt(cpu), cpu_gdt_table, GDT_SIZE); | 230 | memcpy(cpu_gdt(cpu), cpu_gdt_table, GDT_SIZE); |
| 225 | 231 | ||
| 226 | cpu_gdt_descr[cpu].size = GDT_SIZE; | 232 | cpu_gdt_descr[cpu].size = GDT_SIZE; |
| 227 | asm volatile("lgdt %0" :: "m" (cpu_gdt_descr[cpu])); | 233 | load_gdt((const struct desc_ptr *)&cpu_gdt_descr[cpu]); |
| 228 | asm volatile("lidt %0" :: "m" (idt_descr)); | 234 | load_idt((const struct desc_ptr *)&idt_descr); |
| 229 | 235 | ||
| 230 | memset(me->thread.tls_array, 0, GDT_ENTRY_TLS_ENTRIES * 8); | 236 | memset(me->thread.tls_array, 0, GDT_ENTRY_TLS_ENTRIES * 8); |
| 231 | syscall_init(); | 237 | syscall_init(); |
diff --git a/arch/x86/kernel/setup_32.c b/arch/x86/kernel/setup_32.c index 18e6eaf138ce..ba2e165a8a0f 100644 --- a/arch/x86/kernel/setup_32.c +++ b/arch/x86/kernel/setup_32.c | |||
| @@ -661,9 +661,7 @@ void __init setup_arch(char **cmdline_p) | |||
| 661 | #endif | 661 | #endif |
| 662 | 662 | ||
| 663 | #ifdef CONFIG_PCI | 663 | #ifdef CONFIG_PCI |
| 664 | #ifdef CONFIG_X86_IO_APIC | 664 | early_quirks(); |
| 665 | check_acpi_pci(); /* Checks more than just ACPI actually */ | ||
| 666 | #endif | ||
| 667 | #endif | 665 | #endif |
| 668 | 666 | ||
| 669 | #ifdef CONFIG_ACPI | 667 | #ifdef CONFIG_ACPI |
diff --git a/arch/x86/kernel/setup_64.c b/arch/x86/kernel/setup_64.c index cdcba6975226..31322d42eaae 100644 --- a/arch/x86/kernel/setup_64.c +++ b/arch/x86/kernel/setup_64.c | |||
| @@ -302,6 +302,11 @@ void __init setup_arch(char **cmdline_p) | |||
| 302 | 302 | ||
| 303 | dmi_scan_machine(); | 303 | dmi_scan_machine(); |
| 304 | 304 | ||
| 305 | #ifdef CONFIG_SMP | ||
| 306 | /* setup to use the static apicid table during kernel startup */ | ||
| 307 | x86_cpu_to_apicid_ptr = (void *)&x86_cpu_to_apicid_init; | ||
| 308 | #endif | ||
| 309 | |||
| 305 | #ifdef CONFIG_ACPI | 310 | #ifdef CONFIG_ACPI |
| 306 | /* | 311 | /* |
| 307 | * Initialize the ACPI boot-time table parser (gets the RSDP and SDT). | 312 | * 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) | |||
| 554 | but in the same order as the HT nodeids. | 559 | but in the same order as the HT nodeids. |
| 555 | If that doesn't result in a usable node fall back to the | 560 | If that doesn't result in a usable node fall back to the |
| 556 | path for the previous case. */ | 561 | path for the previous case. */ |
| 557 | int ht_nodeid = apicid - (cpu_data[0].phys_proc_id << bits); | 562 | int ht_nodeid = apicid - (cpu_data(0).phys_proc_id << bits); |
| 558 | if (ht_nodeid >= 0 && | 563 | if (ht_nodeid >= 0 && |
| 559 | apicid_to_node[ht_nodeid] != NUMA_NO_NODE) | 564 | apicid_to_node[ht_nodeid] != NUMA_NO_NODE) |
| 560 | node = apicid_to_node[ht_nodeid]; | 565 | node = apicid_to_node[ht_nodeid]; |
| @@ -878,6 +883,7 @@ void __cpuinit early_identify_cpu(struct cpuinfo_x86 *c) | |||
| 878 | 883 | ||
| 879 | #ifdef CONFIG_SMP | 884 | #ifdef CONFIG_SMP |
| 880 | c->phys_proc_id = (cpuid_ebx(1) >> 24) & 0xff; | 885 | c->phys_proc_id = (cpuid_ebx(1) >> 24) & 0xff; |
| 886 | c->cpu_index = 0; | ||
| 881 | #endif | 887 | #endif |
| 882 | } | 888 | } |
| 883 | 889 | ||
| @@ -984,6 +990,7 @@ void __cpuinit print_cpu_info(struct cpuinfo_x86 *c) | |||
| 984 | static int show_cpuinfo(struct seq_file *m, void *v) | 990 | static int show_cpuinfo(struct seq_file *m, void *v) |
| 985 | { | 991 | { |
| 986 | struct cpuinfo_x86 *c = v; | 992 | struct cpuinfo_x86 *c = v; |
| 993 | int cpu = 0; | ||
| 987 | 994 | ||
| 988 | /* | 995 | /* |
| 989 | * These flag bits must match the definitions in <asm/cpufeature.h>. | 996 | * 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) | |||
| 1062 | 1069 | ||
| 1063 | 1070 | ||
| 1064 | #ifdef CONFIG_SMP | 1071 | #ifdef CONFIG_SMP |
| 1065 | if (!cpu_online(c-cpu_data)) | 1072 | if (!cpu_online(c->cpu_index)) |
| 1066 | return 0; | 1073 | return 0; |
| 1074 | cpu = c->cpu_index; | ||
| 1067 | #endif | 1075 | #endif |
| 1068 | 1076 | ||
| 1069 | seq_printf(m,"processor\t: %u\n" | 1077 | seq_printf(m,"processor\t: %u\n" |
| @@ -1071,7 +1079,7 @@ static int show_cpuinfo(struct seq_file *m, void *v) | |||
| 1071 | "cpu family\t: %d\n" | 1079 | "cpu family\t: %d\n" |
| 1072 | "model\t\t: %d\n" | 1080 | "model\t\t: %d\n" |
| 1073 | "model name\t: %s\n", | 1081 | "model name\t: %s\n", |
| 1074 | (unsigned)(c-cpu_data), | 1082 | (unsigned)cpu, |
| 1075 | c->x86_vendor_id[0] ? c->x86_vendor_id : "unknown", | 1083 | c->x86_vendor_id[0] ? c->x86_vendor_id : "unknown", |
| 1076 | c->x86, | 1084 | c->x86, |
| 1077 | (int)c->x86_model, | 1085 | (int)c->x86_model, |
| @@ -1083,7 +1091,7 @@ static int show_cpuinfo(struct seq_file *m, void *v) | |||
| 1083 | seq_printf(m, "stepping\t: unknown\n"); | 1091 | seq_printf(m, "stepping\t: unknown\n"); |
| 1084 | 1092 | ||
| 1085 | if (cpu_has(c,X86_FEATURE_TSC)) { | 1093 | if (cpu_has(c,X86_FEATURE_TSC)) { |
| 1086 | unsigned int freq = cpufreq_quick_get((unsigned)(c-cpu_data)); | 1094 | unsigned int freq = cpufreq_quick_get((unsigned)cpu); |
| 1087 | if (!freq) | 1095 | if (!freq) |
| 1088 | freq = cpu_khz; | 1096 | freq = cpu_khz; |
| 1089 | seq_printf(m, "cpu MHz\t\t: %u.%03u\n", | 1097 | seq_printf(m, "cpu MHz\t\t: %u.%03u\n", |
| @@ -1096,7 +1104,6 @@ static int show_cpuinfo(struct seq_file *m, void *v) | |||
| 1096 | 1104 | ||
| 1097 | #ifdef CONFIG_SMP | 1105 | #ifdef CONFIG_SMP |
| 1098 | if (smp_num_siblings * c->x86_max_cores > 1) { | 1106 | if (smp_num_siblings * c->x86_max_cores > 1) { |
| 1099 | int cpu = c - cpu_data; | ||
| 1100 | seq_printf(m, "physical id\t: %d\n", c->phys_proc_id); | 1107 | seq_printf(m, "physical id\t: %d\n", c->phys_proc_id); |
| 1101 | seq_printf(m, "siblings\t: %d\n", | 1108 | seq_printf(m, "siblings\t: %d\n", |
| 1102 | cpus_weight(per_cpu(cpu_core_map, cpu))); | 1109 | cpus_weight(per_cpu(cpu_core_map, cpu))); |
| @@ -1154,12 +1161,16 @@ static int show_cpuinfo(struct seq_file *m, void *v) | |||
| 1154 | 1161 | ||
| 1155 | static void *c_start(struct seq_file *m, loff_t *pos) | 1162 | static void *c_start(struct seq_file *m, loff_t *pos) |
| 1156 | { | 1163 | { |
| 1157 | return *pos < NR_CPUS ? cpu_data + *pos : NULL; | 1164 | if (*pos == 0) /* just in case, cpu 0 is not the first */ |
| 1165 | *pos = first_cpu(cpu_possible_map); | ||
| 1166 | if ((*pos) < NR_CPUS && cpu_possible(*pos)) | ||
| 1167 | return &cpu_data(*pos); | ||
| 1168 | return NULL; | ||
| 1158 | } | 1169 | } |
| 1159 | 1170 | ||
| 1160 | static void *c_next(struct seq_file *m, void *v, loff_t *pos) | 1171 | static void *c_next(struct seq_file *m, void *v, loff_t *pos) |
| 1161 | { | 1172 | { |
| 1162 | ++*pos; | 1173 | *pos = next_cpu(*pos, cpu_possible_map); |
| 1163 | return c_start(m, pos); | 1174 | return c_start(m, pos); |
| 1164 | } | 1175 | } |
| 1165 | 1176 | ||
diff --git a/arch/x86/kernel/smp_32.c b/arch/x86/kernel/smp_32.c index 9ced828d5556..f32115308399 100644 --- a/arch/x86/kernel/smp_32.c +++ b/arch/x86/kernel/smp_32.c | |||
| @@ -610,7 +610,7 @@ static void stop_this_cpu (void * dummy) | |||
| 610 | */ | 610 | */ |
| 611 | cpu_clear(smp_processor_id(), cpu_online_map); | 611 | cpu_clear(smp_processor_id(), cpu_online_map); |
| 612 | disable_local_APIC(); | 612 | disable_local_APIC(); |
| 613 | if (cpu_data[smp_processor_id()].hlt_works_ok) | 613 | if (cpu_data(smp_processor_id()).hlt_works_ok) |
| 614 | for(;;) halt(); | 614 | for(;;) halt(); |
| 615 | for (;;); | 615 | for (;;); |
| 616 | } | 616 | } |
| @@ -676,7 +676,7 @@ static int convert_apicid_to_cpu(int apic_id) | |||
| 676 | int i; | 676 | int i; |
| 677 | 677 | ||
| 678 | for (i = 0; i < NR_CPUS; i++) { | 678 | for (i = 0; i < NR_CPUS; i++) { |
| 679 | if (x86_cpu_to_apicid[i] == apic_id) | 679 | if (per_cpu(x86_cpu_to_apicid, i) == apic_id) |
| 680 | return i; | 680 | return i; |
| 681 | } | 681 | } |
| 682 | return -1; | 682 | return -1; |
diff --git a/arch/x86/kernel/smp_64.c b/arch/x86/kernel/smp_64.c index 5c2964727d19..03fa6ed559c6 100644 --- a/arch/x86/kernel/smp_64.c +++ b/arch/x86/kernel/smp_64.c | |||
| @@ -322,17 +322,27 @@ void unlock_ipi_call_lock(void) | |||
| 322 | } | 322 | } |
| 323 | 323 | ||
| 324 | /* | 324 | /* |
| 325 | * this function sends a 'generic call function' IPI to one other CPU | 325 | * this function sends a 'generic call function' IPI to all other CPU |
| 326 | * in the system. | 326 | * of the system defined in the mask. |
| 327 | * | ||
| 328 | * cpu is a standard Linux logical CPU number. | ||
| 329 | */ | 327 | */ |
| 330 | static void | 328 | |
| 331 | __smp_call_function_single(int cpu, void (*func) (void *info), void *info, | 329 | static int |
| 332 | int nonatomic, int wait) | 330 | __smp_call_function_mask(cpumask_t mask, |
| 331 | void (*func)(void *), void *info, | ||
| 332 | int wait) | ||
| 333 | { | 333 | { |
| 334 | struct call_data_struct data; | 334 | struct call_data_struct data; |
| 335 | int cpus = 1; | 335 | cpumask_t allbutself; |
| 336 | int cpus; | ||
| 337 | |||
| 338 | allbutself = cpu_online_map; | ||
| 339 | cpu_clear(smp_processor_id(), allbutself); | ||
| 340 | |||
| 341 | cpus_and(mask, mask, allbutself); | ||
| 342 | cpus = cpus_weight(mask); | ||
| 343 | |||
| 344 | if (!cpus) | ||
| 345 | return 0; | ||
| 336 | 346 | ||
| 337 | data.func = func; | 347 | data.func = func; |
| 338 | data.info = info; | 348 | data.info = info; |
| @@ -343,19 +353,55 @@ __smp_call_function_single(int cpu, void (*func) (void *info), void *info, | |||
| 343 | 353 | ||
| 344 | call_data = &data; | 354 | call_data = &data; |
| 345 | wmb(); | 355 | wmb(); |
| 346 | /* Send a message to all other CPUs and wait for them to respond */ | 356 | |
| 347 | send_IPI_mask(cpumask_of_cpu(cpu), CALL_FUNCTION_VECTOR); | 357 | /* Send a message to other CPUs */ |
| 358 | if (cpus_equal(mask, allbutself)) | ||
| 359 | send_IPI_allbutself(CALL_FUNCTION_VECTOR); | ||
| 360 | else | ||
| 361 | send_IPI_mask(mask, CALL_FUNCTION_VECTOR); | ||
| 348 | 362 | ||
| 349 | /* Wait for response */ | 363 | /* Wait for response */ |
| 350 | while (atomic_read(&data.started) != cpus) | 364 | while (atomic_read(&data.started) != cpus) |
| 351 | cpu_relax(); | 365 | cpu_relax(); |
| 352 | 366 | ||
| 353 | if (!wait) | 367 | if (!wait) |
| 354 | return; | 368 | return 0; |
| 355 | 369 | ||
| 356 | while (atomic_read(&data.finished) != cpus) | 370 | while (atomic_read(&data.finished) != cpus) |
| 357 | cpu_relax(); | 371 | cpu_relax(); |
| 372 | |||
| 373 | return 0; | ||
| 374 | } | ||
| 375 | /** | ||
| 376 | * smp_call_function_mask(): Run a function on a set of other CPUs. | ||
| 377 | * @mask: The set of cpus to run on. Must not include the current cpu. | ||
| 378 | * @func: The function to run. This must be fast and non-blocking. | ||
| 379 | * @info: An arbitrary pointer to pass to the function. | ||
| 380 | * @wait: If true, wait (atomically) until function has completed on other CPUs. | ||
| 381 | * | ||
| 382 | * Returns 0 on success, else a negative status code. | ||
| 383 | * | ||
| 384 | * If @wait is true, then returns once @func has returned; otherwise | ||
| 385 | * it returns just before the target cpu calls @func. | ||
| 386 | * | ||
| 387 | * You must not call this function with disabled interrupts or from a | ||
| 388 | * hardware interrupt handler or from a bottom half handler. | ||
| 389 | */ | ||
| 390 | int smp_call_function_mask(cpumask_t mask, | ||
| 391 | void (*func)(void *), void *info, | ||
| 392 | int wait) | ||
| 393 | { | ||
| 394 | int ret; | ||
| 395 | |||
| 396 | /* Can deadlock when called with interrupts disabled */ | ||
| 397 | WARN_ON(irqs_disabled()); | ||
| 398 | |||
| 399 | spin_lock(&call_lock); | ||
| 400 | ret = __smp_call_function_mask(mask, func, info, wait); | ||
| 401 | spin_unlock(&call_lock); | ||
| 402 | return ret; | ||
| 358 | } | 403 | } |
| 404 | EXPORT_SYMBOL(smp_call_function_mask); | ||
| 359 | 405 | ||
| 360 | /* | 406 | /* |
| 361 | * smp_call_function_single - Run a function on a specific CPU | 407 | * 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, | |||
| 374 | int nonatomic, int wait) | 420 | int nonatomic, int wait) |
| 375 | { | 421 | { |
| 376 | /* prevent preemption and reschedule on another processor */ | 422 | /* prevent preemption and reschedule on another processor */ |
| 423 | int ret; | ||
| 377 | int me = get_cpu(); | 424 | int me = get_cpu(); |
| 378 | 425 | ||
| 379 | /* Can deadlock when called with interrupts disabled */ | 426 | /* Can deadlock when called with interrupts disabled */ |
| @@ -387,51 +434,14 @@ int smp_call_function_single (int cpu, void (*func) (void *info), void *info, | |||
| 387 | return 0; | 434 | return 0; |
| 388 | } | 435 | } |
| 389 | 436 | ||
| 390 | spin_lock(&call_lock); | 437 | ret = smp_call_function_mask(cpumask_of_cpu(cpu), func, info, wait); |
| 391 | __smp_call_function_single(cpu, func, info, nonatomic, wait); | 438 | |
| 392 | spin_unlock(&call_lock); | ||
| 393 | put_cpu(); | 439 | put_cpu(); |
| 394 | return 0; | 440 | return ret; |
| 395 | } | 441 | } |
| 396 | EXPORT_SYMBOL(smp_call_function_single); | 442 | EXPORT_SYMBOL(smp_call_function_single); |
| 397 | 443 | ||
| 398 | /* | 444 | /* |
| 399 | * this function sends a 'generic call function' IPI to all other CPUs | ||
| 400 | * in the system. | ||
| 401 | */ | ||
| 402 | static void __smp_call_function (void (*func) (void *info), void *info, | ||
| 403 | int nonatomic, int wait) | ||
| 404 | { | ||
| 405 | struct call_data_struct data; | ||
| 406 | int cpus = num_online_cpus()-1; | ||
| 407 | |||
| 408 | if (!cpus) | ||
| 409 | return; | ||
| 410 | |||
| 411 | data.func = func; | ||
| 412 | data.info = info; | ||
| 413 | atomic_set(&data.started, 0); | ||
| 414 | data.wait = wait; | ||
| 415 | if (wait) | ||
| 416 | atomic_set(&data.finished, 0); | ||
| 417 | |||
| 418 | call_data = &data; | ||
| 419 | wmb(); | ||
| 420 | /* Send a message to all other CPUs and wait for them to respond */ | ||
| 421 | send_IPI_allbutself(CALL_FUNCTION_VECTOR); | ||
| 422 | |||
| 423 | /* Wait for response */ | ||
| 424 | while (atomic_read(&data.started) != cpus) | ||
| 425 | cpu_relax(); | ||
| 426 | |||
| 427 | if (!wait) | ||
| 428 | return; | ||
| 429 | |||
| 430 | while (atomic_read(&data.finished) != cpus) | ||
| 431 | cpu_relax(); | ||
| 432 | } | ||
| 433 | |||
| 434 | /* | ||
| 435 | * smp_call_function - run a function on all other CPUs. | 445 | * smp_call_function - run a function on all other CPUs. |
| 436 | * @func: The function to run. This must be fast and non-blocking. | 446 | * @func: The function to run. This must be fast and non-blocking. |
| 437 | * @info: An arbitrary pointer to pass to the function. | 447 | * @info: An arbitrary pointer to pass to the function. |
| @@ -449,10 +459,7 @@ static void __smp_call_function (void (*func) (void *info), void *info, | |||
| 449 | int smp_call_function (void (*func) (void *info), void *info, int nonatomic, | 459 | int smp_call_function (void (*func) (void *info), void *info, int nonatomic, |
| 450 | int wait) | 460 | int wait) |
| 451 | { | 461 | { |
| 452 | spin_lock(&call_lock); | 462 | return smp_call_function_mask(cpu_online_map, func, info, wait); |
| 453 | __smp_call_function(func,info,nonatomic,wait); | ||
| 454 | spin_unlock(&call_lock); | ||
| 455 | return 0; | ||
| 456 | } | 463 | } |
| 457 | EXPORT_SYMBOL(smp_call_function); | 464 | EXPORT_SYMBOL(smp_call_function); |
| 458 | 465 | ||
| @@ -479,7 +486,7 @@ void smp_send_stop(void) | |||
| 479 | /* Don't deadlock on the call lock in panic */ | 486 | /* Don't deadlock on the call lock in panic */ |
| 480 | nolock = !spin_trylock(&call_lock); | 487 | nolock = !spin_trylock(&call_lock); |
| 481 | local_irq_save(flags); | 488 | local_irq_save(flags); |
| 482 | __smp_call_function(stop_this_cpu, NULL, 0, 0); | 489 | __smp_call_function_mask(cpu_online_map, stop_this_cpu, NULL, 0); |
| 483 | if (!nolock) | 490 | if (!nolock) |
| 484 | spin_unlock(&call_lock); | 491 | spin_unlock(&call_lock); |
| 485 | disable_local_APIC(); | 492 | disable_local_APIC(); |
diff --git a/arch/x86/kernel/smpboot_32.c b/arch/x86/kernel/smpboot_32.c index 1b9ee68c98a2..ef0f34ede1ab 100644 --- a/arch/x86/kernel/smpboot_32.c +++ b/arch/x86/kernel/smpboot_32.c | |||
| @@ -67,7 +67,7 @@ int smp_num_siblings = 1; | |||
| 67 | EXPORT_SYMBOL(smp_num_siblings); | 67 | EXPORT_SYMBOL(smp_num_siblings); |
| 68 | 68 | ||
| 69 | /* Last level cache ID of each logical CPU */ | 69 | /* Last level cache ID of each logical CPU */ |
| 70 | int cpu_llc_id[NR_CPUS] __cpuinitdata = {[0 ... NR_CPUS-1] = BAD_APICID}; | 70 | DEFINE_PER_CPU(u8, cpu_llc_id) = BAD_APICID; |
| 71 | 71 | ||
| 72 | /* representing HT siblings of each logical CPU */ | 72 | /* representing HT siblings of each logical CPU */ |
| 73 | DEFINE_PER_CPU(cpumask_t, cpu_sibling_map); | 73 | DEFINE_PER_CPU(cpumask_t, cpu_sibling_map); |
| @@ -89,12 +89,20 @@ EXPORT_SYMBOL(cpu_possible_map); | |||
| 89 | static cpumask_t smp_commenced_mask; | 89 | static cpumask_t smp_commenced_mask; |
| 90 | 90 | ||
| 91 | /* Per CPU bogomips and other parameters */ | 91 | /* Per CPU bogomips and other parameters */ |
| 92 | struct cpuinfo_x86 cpu_data[NR_CPUS] __cacheline_aligned; | 92 | DEFINE_PER_CPU_SHARED_ALIGNED(struct cpuinfo_x86, cpu_info); |
| 93 | EXPORT_SYMBOL(cpu_data); | 93 | EXPORT_PER_CPU_SYMBOL(cpu_info); |
| 94 | 94 | ||
| 95 | u8 x86_cpu_to_apicid[NR_CPUS] __read_mostly = | 95 | /* |
| 96 | { [0 ... NR_CPUS-1] = 0xff }; | 96 | * The following static array is used during kernel startup |
| 97 | EXPORT_SYMBOL(x86_cpu_to_apicid); | 97 | * and the x86_cpu_to_apicid_ptr contains the address of the |
| 98 | * array during this time. Is it zeroed when the per_cpu | ||
| 99 | * data area is removed. | ||
| 100 | */ | ||
| 101 | u8 x86_cpu_to_apicid_init[NR_CPUS] __initdata = | ||
| 102 | { [0 ... NR_CPUS-1] = BAD_APICID }; | ||
| 103 | void *x86_cpu_to_apicid_ptr; | ||
| 104 | DEFINE_PER_CPU(u8, x86_cpu_to_apicid) = BAD_APICID; | ||
| 105 | EXPORT_PER_CPU_SYMBOL(x86_cpu_to_apicid); | ||
| 98 | 106 | ||
| 99 | u8 apicid_2_node[MAX_APICID]; | 107 | u8 apicid_2_node[MAX_APICID]; |
| 100 | 108 | ||
| @@ -150,9 +158,10 @@ void __init smp_alloc_memory(void) | |||
| 150 | 158 | ||
| 151 | void __cpuinit smp_store_cpu_info(int id) | 159 | void __cpuinit smp_store_cpu_info(int id) |
| 152 | { | 160 | { |
| 153 | struct cpuinfo_x86 *c = cpu_data + id; | 161 | struct cpuinfo_x86 *c = &cpu_data(id); |
| 154 | 162 | ||
| 155 | *c = boot_cpu_data; | 163 | *c = boot_cpu_data; |
| 164 | c->cpu_index = id; | ||
| 156 | if (id!=0) | 165 | if (id!=0) |
| 157 | identify_secondary_cpu(c); | 166 | identify_secondary_cpu(c); |
| 158 | /* | 167 | /* |
| @@ -294,7 +303,7 @@ static int cpucount; | |||
| 294 | /* maps the cpu to the sched domain representing multi-core */ | 303 | /* maps the cpu to the sched domain representing multi-core */ |
| 295 | cpumask_t cpu_coregroup_map(int cpu) | 304 | cpumask_t cpu_coregroup_map(int cpu) |
| 296 | { | 305 | { |
| 297 | struct cpuinfo_x86 *c = cpu_data + cpu; | 306 | struct cpuinfo_x86 *c = &cpu_data(cpu); |
| 298 | /* | 307 | /* |
| 299 | * For perf, we return last level cache shared map. | 308 | * For perf, we return last level cache shared map. |
| 300 | * And for power savings, we return cpu_core_map | 309 | * And for power savings, we return cpu_core_map |
| @@ -311,41 +320,41 @@ static cpumask_t cpu_sibling_setup_map; | |||
| 311 | void __cpuinit set_cpu_sibling_map(int cpu) | 320 | void __cpuinit set_cpu_sibling_map(int cpu) |
| 312 | { | 321 | { |
| 313 | int i; | 322 | int i; |
| 314 | struct cpuinfo_x86 *c = cpu_data; | 323 | struct cpuinfo_x86 *c = &cpu_data(cpu); |
| 315 | 324 | ||
| 316 | cpu_set(cpu, cpu_sibling_setup_map); | 325 | cpu_set(cpu, cpu_sibling_setup_map); |
| 317 | 326 | ||
| 318 | if (smp_num_siblings > 1) { | 327 | if (smp_num_siblings > 1) { |
| 319 | for_each_cpu_mask(i, cpu_sibling_setup_map) { | 328 | for_each_cpu_mask(i, cpu_sibling_setup_map) { |
| 320 | if (c[cpu].phys_proc_id == c[i].phys_proc_id && | 329 | if (c->phys_proc_id == cpu_data(i).phys_proc_id && |
| 321 | c[cpu].cpu_core_id == c[i].cpu_core_id) { | 330 | c->cpu_core_id == cpu_data(i).cpu_core_id) { |
| 322 | cpu_set(i, per_cpu(cpu_sibling_map, cpu)); | 331 | cpu_set(i, per_cpu(cpu_sibling_map, cpu)); |
| 323 | cpu_set(cpu, per_cpu(cpu_sibling_map, i)); | 332 | cpu_set(cpu, per_cpu(cpu_sibling_map, i)); |
| 324 | cpu_set(i, per_cpu(cpu_core_map, cpu)); | 333 | cpu_set(i, per_cpu(cpu_core_map, cpu)); |
| 325 | cpu_set(cpu, per_cpu(cpu_core_map, i)); | 334 | cpu_set(cpu, per_cpu(cpu_core_map, i)); |
| 326 | cpu_set(i, c[cpu].llc_shared_map); | 335 | cpu_set(i, c->llc_shared_map); |
| 327 | cpu_set(cpu, c[i].llc_shared_map); | 336 | cpu_set(cpu, cpu_data(i).llc_shared_map); |
| 328 | } | 337 | } |
| 329 | } | 338 | } |
| 330 | } else { | 339 | } else { |
| 331 | cpu_set(cpu, per_cpu(cpu_sibling_map, cpu)); | 340 | cpu_set(cpu, per_cpu(cpu_sibling_map, cpu)); |
| 332 | } | 341 | } |
| 333 | 342 | ||
| 334 | cpu_set(cpu, c[cpu].llc_shared_map); | 343 | cpu_set(cpu, c->llc_shared_map); |
| 335 | 344 | ||
| 336 | if (current_cpu_data.x86_max_cores == 1) { | 345 | if (current_cpu_data.x86_max_cores == 1) { |
| 337 | per_cpu(cpu_core_map, cpu) = per_cpu(cpu_sibling_map, cpu); | 346 | per_cpu(cpu_core_map, cpu) = per_cpu(cpu_sibling_map, cpu); |
| 338 | c[cpu].booted_cores = 1; | 347 | c->booted_cores = 1; |
| 339 | return; | 348 | return; |
| 340 | } | 349 | } |
| 341 | 350 | ||
| 342 | for_each_cpu_mask(i, cpu_sibling_setup_map) { | 351 | for_each_cpu_mask(i, cpu_sibling_setup_map) { |
| 343 | if (cpu_llc_id[cpu] != BAD_APICID && | 352 | if (per_cpu(cpu_llc_id, cpu) != BAD_APICID && |
| 344 | cpu_llc_id[cpu] == cpu_llc_id[i]) { | 353 | per_cpu(cpu_llc_id, cpu) == per_cpu(cpu_llc_id, i)) { |
| 345 | cpu_set(i, c[cpu].llc_shared_map); | 354 | cpu_set(i, c->llc_shared_map); |
| 346 | cpu_set(cpu, c[i].llc_shared_map); | 355 | cpu_set(cpu, cpu_data(i).llc_shared_map); |
| 347 | } | 356 | } |
| 348 | if (c[cpu].phys_proc_id == c[i].phys_proc_id) { | 357 | if (c->phys_proc_id == cpu_data(i).phys_proc_id) { |
| 349 | cpu_set(i, per_cpu(cpu_core_map, cpu)); | 358 | cpu_set(i, per_cpu(cpu_core_map, cpu)); |
| 350 | cpu_set(cpu, per_cpu(cpu_core_map, i)); | 359 | cpu_set(cpu, per_cpu(cpu_core_map, i)); |
| 351 | /* | 360 | /* |
| @@ -357,15 +366,15 @@ void __cpuinit set_cpu_sibling_map(int cpu) | |||
| 357 | * the booted_cores for this new cpu | 366 | * the booted_cores for this new cpu |
| 358 | */ | 367 | */ |
| 359 | if (first_cpu(per_cpu(cpu_sibling_map, i)) == i) | 368 | if (first_cpu(per_cpu(cpu_sibling_map, i)) == i) |
| 360 | c[cpu].booted_cores++; | 369 | c->booted_cores++; |
| 361 | /* | 370 | /* |
| 362 | * increment the core count for all | 371 | * increment the core count for all |
| 363 | * the other cpus in this package | 372 | * the other cpus in this package |
| 364 | */ | 373 | */ |
| 365 | if (i != cpu) | 374 | if (i != cpu) |
| 366 | c[i].booted_cores++; | 375 | cpu_data(i).booted_cores++; |
| 367 | } else if (i != cpu && !c[cpu].booted_cores) | 376 | } else if (i != cpu && !c->booted_cores) |
| 368 | c[cpu].booted_cores = c[i].booted_cores; | 377 | c->booted_cores = cpu_data(i).booted_cores; |
| 369 | } | 378 | } |
| 370 | } | 379 | } |
| 371 | } | 380 | } |
| @@ -804,7 +813,7 @@ static int __cpuinit do_boot_cpu(int apicid, int cpu) | |||
| 804 | 813 | ||
| 805 | irq_ctx_init(cpu); | 814 | irq_ctx_init(cpu); |
| 806 | 815 | ||
| 807 | x86_cpu_to_apicid[cpu] = apicid; | 816 | per_cpu(x86_cpu_to_apicid, cpu) = apicid; |
| 808 | /* | 817 | /* |
| 809 | * This grunge runs the startup process for | 818 | * This grunge runs the startup process for |
| 810 | * the targeted processor. | 819 | * the targeted processor. |
| @@ -844,7 +853,7 @@ static int __cpuinit do_boot_cpu(int apicid, int cpu) | |||
| 844 | /* number CPUs logically, starting from 1 (BSP is 0) */ | 853 | /* number CPUs logically, starting from 1 (BSP is 0) */ |
| 845 | Dprintk("OK.\n"); | 854 | Dprintk("OK.\n"); |
| 846 | printk("CPU%d: ", cpu); | 855 | printk("CPU%d: ", cpu); |
| 847 | print_cpu_info(&cpu_data[cpu]); | 856 | print_cpu_info(&cpu_data(cpu)); |
| 848 | Dprintk("CPU has booted.\n"); | 857 | Dprintk("CPU has booted.\n"); |
| 849 | } else { | 858 | } else { |
| 850 | boot_error= 1; | 859 | boot_error= 1; |
| @@ -866,7 +875,7 @@ static int __cpuinit do_boot_cpu(int apicid, int cpu) | |||
| 866 | cpu_clear(cpu, cpu_initialized); /* was set by cpu_init() */ | 875 | cpu_clear(cpu, cpu_initialized); /* was set by cpu_init() */ |
| 867 | cpucount--; | 876 | cpucount--; |
| 868 | } else { | 877 | } else { |
| 869 | x86_cpu_to_apicid[cpu] = apicid; | 878 | per_cpu(x86_cpu_to_apicid, cpu) = apicid; |
| 870 | cpu_set(cpu, cpu_present_map); | 879 | cpu_set(cpu, cpu_present_map); |
| 871 | } | 880 | } |
| 872 | 881 | ||
| @@ -915,7 +924,7 @@ static int __cpuinit __smp_prepare_cpu(int cpu) | |||
| 915 | struct warm_boot_cpu_info info; | 924 | struct warm_boot_cpu_info info; |
| 916 | int apicid, ret; | 925 | int apicid, ret; |
| 917 | 926 | ||
| 918 | apicid = x86_cpu_to_apicid[cpu]; | 927 | apicid = per_cpu(x86_cpu_to_apicid, cpu); |
| 919 | if (apicid == BAD_APICID) { | 928 | if (apicid == BAD_APICID) { |
| 920 | ret = -ENODEV; | 929 | ret = -ENODEV; |
| 921 | goto exit; | 930 | goto exit; |
| @@ -961,11 +970,11 @@ static void __init smp_boot_cpus(unsigned int max_cpus) | |||
| 961 | */ | 970 | */ |
| 962 | smp_store_cpu_info(0); /* Final full version of the data */ | 971 | smp_store_cpu_info(0); /* Final full version of the data */ |
| 963 | printk("CPU%d: ", 0); | 972 | printk("CPU%d: ", 0); |
| 964 | print_cpu_info(&cpu_data[0]); | 973 | print_cpu_info(&cpu_data(0)); |
| 965 | 974 | ||
| 966 | boot_cpu_physical_apicid = GET_APIC_ID(apic_read(APIC_ID)); | 975 | boot_cpu_physical_apicid = GET_APIC_ID(apic_read(APIC_ID)); |
| 967 | boot_cpu_logical_apicid = logical_smp_processor_id(); | 976 | boot_cpu_logical_apicid = logical_smp_processor_id(); |
| 968 | x86_cpu_to_apicid[0] = boot_cpu_physical_apicid; | 977 | per_cpu(x86_cpu_to_apicid, 0) = boot_cpu_physical_apicid; |
| 969 | 978 | ||
| 970 | current_thread_info()->cpu = 0; | 979 | current_thread_info()->cpu = 0; |
| 971 | 980 | ||
| @@ -1008,6 +1017,7 @@ static void __init smp_boot_cpus(unsigned int max_cpus) | |||
| 1008 | printk(KERN_ERR "... forcing use of dummy APIC emulation. (tell your hw vendor)\n"); | 1017 | printk(KERN_ERR "... forcing use of dummy APIC emulation. (tell your hw vendor)\n"); |
| 1009 | smpboot_clear_io_apic_irqs(); | 1018 | smpboot_clear_io_apic_irqs(); |
| 1010 | phys_cpu_present_map = physid_mask_of_physid(0); | 1019 | phys_cpu_present_map = physid_mask_of_physid(0); |
| 1020 | map_cpu_to_logical_apicid(); | ||
| 1011 | cpu_set(0, per_cpu(cpu_sibling_map, 0)); | 1021 | cpu_set(0, per_cpu(cpu_sibling_map, 0)); |
| 1012 | cpu_set(0, per_cpu(cpu_core_map, 0)); | 1022 | cpu_set(0, per_cpu(cpu_core_map, 0)); |
| 1013 | return; | 1023 | return; |
| @@ -1029,6 +1039,7 @@ static void __init smp_boot_cpus(unsigned int max_cpus) | |||
| 1029 | } | 1039 | } |
| 1030 | smpboot_clear_io_apic_irqs(); | 1040 | smpboot_clear_io_apic_irqs(); |
| 1031 | phys_cpu_present_map = physid_mask_of_physid(0); | 1041 | phys_cpu_present_map = physid_mask_of_physid(0); |
| 1042 | map_cpu_to_logical_apicid(); | ||
| 1032 | cpu_set(0, per_cpu(cpu_sibling_map, 0)); | 1043 | cpu_set(0, per_cpu(cpu_sibling_map, 0)); |
| 1033 | cpu_set(0, per_cpu(cpu_core_map, 0)); | 1044 | cpu_set(0, per_cpu(cpu_core_map, 0)); |
| 1034 | return; | 1045 | return; |
| @@ -1082,7 +1093,7 @@ static void __init smp_boot_cpus(unsigned int max_cpus) | |||
| 1082 | Dprintk("Before bogomips.\n"); | 1093 | Dprintk("Before bogomips.\n"); |
| 1083 | for (cpu = 0; cpu < NR_CPUS; cpu++) | 1094 | for (cpu = 0; cpu < NR_CPUS; cpu++) |
| 1084 | if (cpu_isset(cpu, cpu_callout_map)) | 1095 | if (cpu_isset(cpu, cpu_callout_map)) |
| 1085 | bogosum += cpu_data[cpu].loops_per_jiffy; | 1096 | bogosum += cpu_data(cpu).loops_per_jiffy; |
| 1086 | printk(KERN_INFO | 1097 | printk(KERN_INFO |
| 1087 | "Total of %d processors activated (%lu.%02lu BogoMIPS).\n", | 1098 | "Total of %d processors activated (%lu.%02lu BogoMIPS).\n", |
| 1088 | cpucount+1, | 1099 | cpucount+1, |
| @@ -1152,7 +1163,7 @@ void __init native_smp_prepare_boot_cpu(void) | |||
| 1152 | void remove_siblinginfo(int cpu) | 1163 | void remove_siblinginfo(int cpu) |
| 1153 | { | 1164 | { |
| 1154 | int sibling; | 1165 | int sibling; |
| 1155 | struct cpuinfo_x86 *c = cpu_data; | 1166 | struct cpuinfo_x86 *c = &cpu_data(cpu); |
| 1156 | 1167 | ||
| 1157 | for_each_cpu_mask(sibling, per_cpu(cpu_core_map, cpu)) { | 1168 | for_each_cpu_mask(sibling, per_cpu(cpu_core_map, cpu)) { |
| 1158 | cpu_clear(cpu, per_cpu(cpu_core_map, sibling)); | 1169 | cpu_clear(cpu, per_cpu(cpu_core_map, sibling)); |
| @@ -1160,15 +1171,15 @@ void remove_siblinginfo(int cpu) | |||
| 1160 | * last thread sibling in this cpu core going down | 1171 | * last thread sibling in this cpu core going down |
| 1161 | */ | 1172 | */ |
| 1162 | if (cpus_weight(per_cpu(cpu_sibling_map, cpu)) == 1) | 1173 | if (cpus_weight(per_cpu(cpu_sibling_map, cpu)) == 1) |
| 1163 | c[sibling].booted_cores--; | 1174 | cpu_data(sibling).booted_cores--; |
| 1164 | } | 1175 | } |
| 1165 | 1176 | ||
| 1166 | for_each_cpu_mask(sibling, per_cpu(cpu_sibling_map, cpu)) | 1177 | for_each_cpu_mask(sibling, per_cpu(cpu_sibling_map, cpu)) |
| 1167 | cpu_clear(cpu, per_cpu(cpu_sibling_map, sibling)); | 1178 | cpu_clear(cpu, per_cpu(cpu_sibling_map, sibling)); |
| 1168 | cpus_clear(per_cpu(cpu_sibling_map, cpu)); | 1179 | cpus_clear(per_cpu(cpu_sibling_map, cpu)); |
| 1169 | cpus_clear(per_cpu(cpu_core_map, cpu)); | 1180 | cpus_clear(per_cpu(cpu_core_map, cpu)); |
| 1170 | c[cpu].phys_proc_id = 0; | 1181 | c->phys_proc_id = 0; |
| 1171 | c[cpu].cpu_core_id = 0; | 1182 | c->cpu_core_id = 0; |
| 1172 | cpu_clear(cpu, cpu_sibling_setup_map); | 1183 | cpu_clear(cpu, cpu_sibling_setup_map); |
| 1173 | } | 1184 | } |
| 1174 | 1185 | ||
diff --git a/arch/x86/kernel/smpboot_64.c b/arch/x86/kernel/smpboot_64.c index d4c33aba3ff2..b7e768dd87c9 100644 --- a/arch/x86/kernel/smpboot_64.c +++ b/arch/x86/kernel/smpboot_64.c | |||
| @@ -65,7 +65,7 @@ int smp_num_siblings = 1; | |||
| 65 | EXPORT_SYMBOL(smp_num_siblings); | 65 | EXPORT_SYMBOL(smp_num_siblings); |
| 66 | 66 | ||
| 67 | /* Last level cache ID of each logical CPU */ | 67 | /* Last level cache ID of each logical CPU */ |
| 68 | u8 cpu_llc_id[NR_CPUS] __cpuinitdata = {[0 ... NR_CPUS-1] = BAD_APICID}; | 68 | DEFINE_PER_CPU(u8, cpu_llc_id) = BAD_APICID; |
| 69 | 69 | ||
| 70 | /* Bitmask of currently online CPUs */ | 70 | /* Bitmask of currently online CPUs */ |
| 71 | cpumask_t cpu_online_map __read_mostly; | 71 | cpumask_t cpu_online_map __read_mostly; |
| @@ -84,8 +84,8 @@ cpumask_t cpu_possible_map; | |||
| 84 | EXPORT_SYMBOL(cpu_possible_map); | 84 | EXPORT_SYMBOL(cpu_possible_map); |
| 85 | 85 | ||
| 86 | /* Per CPU bogomips and other parameters */ | 86 | /* Per CPU bogomips and other parameters */ |
| 87 | struct cpuinfo_x86 cpu_data[NR_CPUS] __cacheline_aligned; | 87 | DEFINE_PER_CPU_SHARED_ALIGNED(struct cpuinfo_x86, cpu_info); |
| 88 | EXPORT_SYMBOL(cpu_data); | 88 | EXPORT_PER_CPU_SYMBOL(cpu_info); |
| 89 | 89 | ||
| 90 | /* Set when the idlers are all forked */ | 90 | /* Set when the idlers are all forked */ |
| 91 | int smp_threads_ready; | 91 | int smp_threads_ready; |
| @@ -138,9 +138,10 @@ static unsigned long __cpuinit setup_trampoline(void) | |||
| 138 | 138 | ||
| 139 | static void __cpuinit smp_store_cpu_info(int id) | 139 | static void __cpuinit smp_store_cpu_info(int id) |
| 140 | { | 140 | { |
| 141 | struct cpuinfo_x86 *c = cpu_data + id; | 141 | struct cpuinfo_x86 *c = &cpu_data(id); |
| 142 | 142 | ||
| 143 | *c = boot_cpu_data; | 143 | *c = boot_cpu_data; |
| 144 | c->cpu_index = id; | ||
| 144 | identify_cpu(c); | 145 | identify_cpu(c); |
| 145 | print_cpu_info(c); | 146 | print_cpu_info(c); |
| 146 | } | 147 | } |
| @@ -237,7 +238,7 @@ void __cpuinit smp_callin(void) | |||
| 237 | /* maps the cpu to the sched domain representing multi-core */ | 238 | /* maps the cpu to the sched domain representing multi-core */ |
| 238 | cpumask_t cpu_coregroup_map(int cpu) | 239 | cpumask_t cpu_coregroup_map(int cpu) |
| 239 | { | 240 | { |
| 240 | struct cpuinfo_x86 *c = cpu_data + cpu; | 241 | struct cpuinfo_x86 *c = &cpu_data(cpu); |
| 241 | /* | 242 | /* |
| 242 | * For perf, we return last level cache shared map. | 243 | * For perf, we return last level cache shared map. |
| 243 | * And for power savings, we return cpu_core_map | 244 | * And for power savings, we return cpu_core_map |
| @@ -254,41 +255,41 @@ static cpumask_t cpu_sibling_setup_map; | |||
| 254 | static inline void set_cpu_sibling_map(int cpu) | 255 | static inline void set_cpu_sibling_map(int cpu) |
| 255 | { | 256 | { |
| 256 | int i; | 257 | int i; |
| 257 | struct cpuinfo_x86 *c = cpu_data; | 258 | struct cpuinfo_x86 *c = &cpu_data(cpu); |
| 258 | 259 | ||
| 259 | cpu_set(cpu, cpu_sibling_setup_map); | 260 | cpu_set(cpu, cpu_sibling_setup_map); |
| 260 | 261 | ||
| 261 | if (smp_num_siblings > 1) { | 262 | if (smp_num_siblings > 1) { |
| 262 | for_each_cpu_mask(i, cpu_sibling_setup_map) { | 263 | for_each_cpu_mask(i, cpu_sibling_setup_map) { |
| 263 | if (c[cpu].phys_proc_id == c[i].phys_proc_id && | 264 | if (c->phys_proc_id == cpu_data(i).phys_proc_id && |
| 264 | c[cpu].cpu_core_id == c[i].cpu_core_id) { | 265 | c->cpu_core_id == cpu_data(i).cpu_core_id) { |
| 265 | cpu_set(i, per_cpu(cpu_sibling_map, cpu)); | 266 | cpu_set(i, per_cpu(cpu_sibling_map, cpu)); |
| 266 | cpu_set(cpu, per_cpu(cpu_sibling_map, i)); | 267 | cpu_set(cpu, per_cpu(cpu_sibling_map, i)); |
| 267 | cpu_set(i, per_cpu(cpu_core_map, cpu)); | 268 | cpu_set(i, per_cpu(cpu_core_map, cpu)); |
| 268 | cpu_set(cpu, per_cpu(cpu_core_map, i)); | 269 | cpu_set(cpu, per_cpu(cpu_core_map, i)); |
| 269 | cpu_set(i, c[cpu].llc_shared_map); | 270 | cpu_set(i, c->llc_shared_map); |
| 270 | cpu_set(cpu, c[i].llc_shared_map); | 271 | cpu_set(cpu, cpu_data(i).llc_shared_map); |
| 271 | } | 272 | } |
| 272 | } | 273 | } |
| 273 | } else { | 274 | } else { |
| 274 | cpu_set(cpu, per_cpu(cpu_sibling_map, cpu)); | 275 | cpu_set(cpu, per_cpu(cpu_sibling_map, cpu)); |
| 275 | } | 276 | } |
| 276 | 277 | ||
| 277 | cpu_set(cpu, c[cpu].llc_shared_map); | 278 | cpu_set(cpu, c->llc_shared_map); |
| 278 | 279 | ||
| 279 | if (current_cpu_data.x86_max_cores == 1) { | 280 | if (current_cpu_data.x86_max_cores == 1) { |
| 280 | per_cpu(cpu_core_map, cpu) = per_cpu(cpu_sibling_map, cpu); | 281 | per_cpu(cpu_core_map, cpu) = per_cpu(cpu_sibling_map, cpu); |
| 281 | c[cpu].booted_cores = 1; | 282 | c->booted_cores = 1; |
| 282 | return; | 283 | return; |
| 283 | } | 284 | } |
| 284 | 285 | ||
| 285 | for_each_cpu_mask(i, cpu_sibling_setup_map) { | 286 | for_each_cpu_mask(i, cpu_sibling_setup_map) { |
| 286 | if (cpu_llc_id[cpu] != BAD_APICID && | 287 | if (per_cpu(cpu_llc_id, cpu) != BAD_APICID && |
| 287 | cpu_llc_id[cpu] == cpu_llc_id[i]) { | 288 | per_cpu(cpu_llc_id, cpu) == per_cpu(cpu_llc_id, i)) { |
| 288 | cpu_set(i, c[cpu].llc_shared_map); | 289 | cpu_set(i, c->llc_shared_map); |
| 289 | cpu_set(cpu, c[i].llc_shared_map); | 290 | cpu_set(cpu, cpu_data(i).llc_shared_map); |
| 290 | } | 291 | } |
| 291 | if (c[cpu].phys_proc_id == c[i].phys_proc_id) { | 292 | if (c->phys_proc_id == cpu_data(i).phys_proc_id) { |
| 292 | cpu_set(i, per_cpu(cpu_core_map, cpu)); | 293 | cpu_set(i, per_cpu(cpu_core_map, cpu)); |
| 293 | cpu_set(cpu, per_cpu(cpu_core_map, i)); | 294 | cpu_set(cpu, per_cpu(cpu_core_map, i)); |
| 294 | /* | 295 | /* |
| @@ -300,15 +301,15 @@ static inline void set_cpu_sibling_map(int cpu) | |||
| 300 | * the booted_cores for this new cpu | 301 | * the booted_cores for this new cpu |
| 301 | */ | 302 | */ |
| 302 | if (first_cpu(per_cpu(cpu_sibling_map, i)) == i) | 303 | if (first_cpu(per_cpu(cpu_sibling_map, i)) == i) |
| 303 | c[cpu].booted_cores++; | 304 | c->booted_cores++; |
| 304 | /* | 305 | /* |
| 305 | * increment the core count for all | 306 | * increment the core count for all |
| 306 | * the other cpus in this package | 307 | * the other cpus in this package |
| 307 | */ | 308 | */ |
| 308 | if (i != cpu) | 309 | if (i != cpu) |
| 309 | c[i].booted_cores++; | 310 | cpu_data(i).booted_cores++; |
| 310 | } else if (i != cpu && !c[cpu].booted_cores) | 311 | } else if (i != cpu && !c->booted_cores) |
| 311 | c[cpu].booted_cores = c[i].booted_cores; | 312 | c->booted_cores = cpu_data(i).booted_cores; |
| 312 | } | 313 | } |
| 313 | } | 314 | } |
| 314 | } | 315 | } |
| @@ -694,7 +695,7 @@ do_rest: | |||
| 694 | clear_node_cpumask(cpu); /* was set by numa_add_cpu */ | 695 | clear_node_cpumask(cpu); /* was set by numa_add_cpu */ |
| 695 | cpu_clear(cpu, cpu_present_map); | 696 | cpu_clear(cpu, cpu_present_map); |
| 696 | cpu_clear(cpu, cpu_possible_map); | 697 | cpu_clear(cpu, cpu_possible_map); |
| 697 | x86_cpu_to_apicid[cpu] = BAD_APICID; | 698 | per_cpu(x86_cpu_to_apicid, cpu) = BAD_APICID; |
| 698 | return -EIO; | 699 | return -EIO; |
| 699 | } | 700 | } |
| 700 | 701 | ||
| @@ -841,6 +842,26 @@ static int __init smp_sanity_check(unsigned max_cpus) | |||
| 841 | } | 842 | } |
| 842 | 843 | ||
| 843 | /* | 844 | /* |
| 845 | * Copy apicid's found by MP_processor_info from initial array to the per cpu | ||
| 846 | * data area. The x86_cpu_to_apicid_init array is then expendable and the | ||
| 847 | * x86_cpu_to_apicid_ptr is zeroed indicating that the static array is no | ||
| 848 | * longer available. | ||
| 849 | */ | ||
| 850 | void __init smp_set_apicids(void) | ||
| 851 | { | ||
| 852 | int cpu; | ||
| 853 | |||
| 854 | for_each_cpu_mask(cpu, cpu_possible_map) { | ||
| 855 | if (per_cpu_offset(cpu)) | ||
| 856 | per_cpu(x86_cpu_to_apicid, cpu) = | ||
| 857 | x86_cpu_to_apicid_init[cpu]; | ||
| 858 | } | ||
| 859 | |||
| 860 | /* indicate the static array will be going away soon */ | ||
| 861 | x86_cpu_to_apicid_ptr = NULL; | ||
| 862 | } | ||
| 863 | |||
| 864 | /* | ||
| 844 | * Prepare for SMP bootup. The MP table or ACPI has been read | 865 | * Prepare for SMP bootup. The MP table or ACPI has been read |
| 845 | * earlier. Just do some sanity checking here and enable APIC mode. | 866 | * earlier. Just do some sanity checking here and enable APIC mode. |
| 846 | */ | 867 | */ |
| @@ -849,6 +870,7 @@ void __init smp_prepare_cpus(unsigned int max_cpus) | |||
| 849 | nmi_watchdog_default(); | 870 | nmi_watchdog_default(); |
| 850 | current_cpu_data = boot_cpu_data; | 871 | current_cpu_data = boot_cpu_data; |
| 851 | current_thread_info()->cpu = 0; /* needed? */ | 872 | current_thread_info()->cpu = 0; /* needed? */ |
| 873 | smp_set_apicids(); | ||
| 852 | set_cpu_sibling_map(0); | 874 | set_cpu_sibling_map(0); |
| 853 | 875 | ||
| 854 | if (smp_sanity_check(max_cpus) < 0) { | 876 | if (smp_sanity_check(max_cpus) < 0) { |
| @@ -968,7 +990,7 @@ void __init smp_cpus_done(unsigned int max_cpus) | |||
| 968 | static void remove_siblinginfo(int cpu) | 990 | static void remove_siblinginfo(int cpu) |
| 969 | { | 991 | { |
| 970 | int sibling; | 992 | int sibling; |
| 971 | struct cpuinfo_x86 *c = cpu_data; | 993 | struct cpuinfo_x86 *c = &cpu_data(cpu); |
| 972 | 994 | ||
| 973 | for_each_cpu_mask(sibling, per_cpu(cpu_core_map, cpu)) { | 995 | for_each_cpu_mask(sibling, per_cpu(cpu_core_map, cpu)) { |
| 974 | cpu_clear(cpu, per_cpu(cpu_core_map, sibling)); | 996 | cpu_clear(cpu, per_cpu(cpu_core_map, sibling)); |
| @@ -976,15 +998,15 @@ static void remove_siblinginfo(int cpu) | |||
| 976 | * last thread sibling in this cpu core going down | 998 | * last thread sibling in this cpu core going down |
| 977 | */ | 999 | */ |
| 978 | if (cpus_weight(per_cpu(cpu_sibling_map, cpu)) == 1) | 1000 | if (cpus_weight(per_cpu(cpu_sibling_map, cpu)) == 1) |
| 979 | c[sibling].booted_cores--; | 1001 | cpu_data(sibling).booted_cores--; |
| 980 | } | 1002 | } |
| 981 | 1003 | ||
| 982 | for_each_cpu_mask(sibling, per_cpu(cpu_sibling_map, cpu)) | 1004 | for_each_cpu_mask(sibling, per_cpu(cpu_sibling_map, cpu)) |
| 983 | cpu_clear(cpu, per_cpu(cpu_sibling_map, sibling)); | 1005 | cpu_clear(cpu, per_cpu(cpu_sibling_map, sibling)); |
| 984 | cpus_clear(per_cpu(cpu_sibling_map, cpu)); | 1006 | cpus_clear(per_cpu(cpu_sibling_map, cpu)); |
| 985 | cpus_clear(per_cpu(cpu_core_map, cpu)); | 1007 | cpus_clear(per_cpu(cpu_core_map, cpu)); |
| 986 | c[cpu].phys_proc_id = 0; | 1008 | c->phys_proc_id = 0; |
| 987 | c[cpu].cpu_core_id = 0; | 1009 | c->cpu_core_id = 0; |
| 988 | cpu_clear(cpu, cpu_sibling_setup_map); | 1010 | cpu_clear(cpu, cpu_sibling_setup_map); |
| 989 | } | 1011 | } |
| 990 | 1012 | ||
diff --git a/arch/x86/kernel/suspend_64.c b/arch/x86/kernel/suspend_64.c index 76274eeae9a9..bc9f59c246fd 100644 --- a/arch/x86/kernel/suspend_64.c +++ b/arch/x86/kernel/suspend_64.c | |||
| @@ -32,9 +32,9 @@ void __save_processor_state(struct saved_context *ctxt) | |||
| 32 | /* | 32 | /* |
| 33 | * descriptor tables | 33 | * descriptor tables |
| 34 | */ | 34 | */ |
| 35 | asm volatile ("sgdt %0" : "=m" (ctxt->gdt_limit)); | 35 | store_gdt((struct desc_ptr *)&ctxt->gdt_limit); |
| 36 | asm volatile ("sidt %0" : "=m" (ctxt->idt_limit)); | 36 | store_idt((struct desc_ptr *)&ctxt->idt_limit); |
| 37 | asm volatile ("str %0" : "=m" (ctxt->tr)); | 37 | store_tr(ctxt->tr); |
| 38 | 38 | ||
| 39 | /* XMM0..XMM15 should be handled by kernel_fpu_begin(). */ | 39 | /* XMM0..XMM15 should be handled by kernel_fpu_begin(). */ |
| 40 | /* | 40 | /* |
| @@ -91,8 +91,9 @@ void __restore_processor_state(struct saved_context *ctxt) | |||
| 91 | * now restore the descriptor tables to their proper values | 91 | * now restore the descriptor tables to their proper values |
| 92 | * ltr is done i fix_processor_context(). | 92 | * ltr is done i fix_processor_context(). |
| 93 | */ | 93 | */ |
| 94 | asm volatile ("lgdt %0" :: "m" (ctxt->gdt_limit)); | 94 | load_gdt((const struct desc_ptr *)&ctxt->gdt_limit); |
| 95 | asm volatile ("lidt %0" :: "m" (ctxt->idt_limit)); | 95 | load_idt((const struct desc_ptr *)&ctxt->idt_limit); |
| 96 | |||
| 96 | 97 | ||
| 97 | /* | 98 | /* |
| 98 | * segment registers | 99 | * segment registers |
diff --git a/arch/x86/kernel/traps_32.c b/arch/x86/kernel/traps_32.c index 1e9d57256eb1..cc9acace7e23 100644 --- a/arch/x86/kernel/traps_32.c +++ b/arch/x86/kernel/traps_32.c | |||
| @@ -63,6 +63,9 @@ | |||
| 63 | 63 | ||
| 64 | int panic_on_unrecovered_nmi; | 64 | int panic_on_unrecovered_nmi; |
| 65 | 65 | ||
| 66 | DECLARE_BITMAP(used_vectors, NR_VECTORS); | ||
| 67 | EXPORT_SYMBOL_GPL(used_vectors); | ||
| 68 | |||
| 66 | asmlinkage int system_call(void); | 69 | asmlinkage int system_call(void); |
| 67 | 70 | ||
| 68 | /* Do we ignore FPU interrupts ? */ | 71 | /* Do we ignore FPU interrupts ? */ |
| @@ -288,33 +291,9 @@ EXPORT_SYMBOL(dump_stack); | |||
| 288 | void show_registers(struct pt_regs *regs) | 291 | void show_registers(struct pt_regs *regs) |
| 289 | { | 292 | { |
| 290 | int i; | 293 | int i; |
| 291 | int in_kernel = 1; | 294 | |
| 292 | unsigned long esp; | ||
| 293 | unsigned short ss, gs; | ||
| 294 | |||
| 295 | esp = (unsigned long) (®s->esp); | ||
| 296 | savesegment(ss, ss); | ||
| 297 | savesegment(gs, gs); | ||
| 298 | if (user_mode_vm(regs)) { | ||
| 299 | in_kernel = 0; | ||
| 300 | esp = regs->esp; | ||
| 301 | ss = regs->xss & 0xffff; | ||
| 302 | } | ||
| 303 | print_modules(); | 295 | print_modules(); |
| 304 | printk(KERN_EMERG "CPU: %d\n" | 296 | __show_registers(regs, 0); |
| 305 | KERN_EMERG "EIP: %04x:[<%08lx>] %s VLI\n" | ||
| 306 | KERN_EMERG "EFLAGS: %08lx (%s %.*s)\n", | ||
| 307 | smp_processor_id(), 0xffff & regs->xcs, regs->eip, | ||
| 308 | print_tainted(), regs->eflags, init_utsname()->release, | ||
| 309 | (int)strcspn(init_utsname()->version, " "), | ||
| 310 | init_utsname()->version); | ||
| 311 | print_symbol(KERN_EMERG "EIP is at %s\n", regs->eip); | ||
| 312 | printk(KERN_EMERG "eax: %08lx ebx: %08lx ecx: %08lx edx: %08lx\n", | ||
| 313 | regs->eax, regs->ebx, regs->ecx, regs->edx); | ||
| 314 | printk(KERN_EMERG "esi: %08lx edi: %08lx ebp: %08lx esp: %08lx\n", | ||
| 315 | regs->esi, regs->edi, regs->ebp, esp); | ||
| 316 | printk(KERN_EMERG "ds: %04x es: %04x fs: %04x gs: %04x ss: %04x\n", | ||
| 317 | regs->xds & 0xffff, regs->xes & 0xffff, regs->xfs & 0xffff, gs, ss); | ||
| 318 | printk(KERN_EMERG "Process %.*s (pid: %d, ti=%p task=%p task.ti=%p)", | 297 | printk(KERN_EMERG "Process %.*s (pid: %d, ti=%p task=%p task.ti=%p)", |
| 319 | TASK_COMM_LEN, current->comm, task_pid_nr(current), | 298 | TASK_COMM_LEN, current->comm, task_pid_nr(current), |
| 320 | current_thread_info(), current, task_thread_info(current)); | 299 | current_thread_info(), current, task_thread_info(current)); |
| @@ -322,14 +301,14 @@ void show_registers(struct pt_regs *regs) | |||
| 322 | * When in-kernel, we also print out the stack and code at the | 301 | * When in-kernel, we also print out the stack and code at the |
| 323 | * time of the fault.. | 302 | * time of the fault.. |
| 324 | */ | 303 | */ |
| 325 | if (in_kernel) { | 304 | if (!user_mode_vm(regs)) { |
| 326 | u8 *eip; | 305 | u8 *eip; |
| 327 | unsigned int code_prologue = code_bytes * 43 / 64; | 306 | unsigned int code_prologue = code_bytes * 43 / 64; |
| 328 | unsigned int code_len = code_bytes; | 307 | unsigned int code_len = code_bytes; |
| 329 | unsigned char c; | 308 | unsigned char c; |
| 330 | 309 | ||
| 331 | printk("\n" KERN_EMERG "Stack: "); | 310 | printk("\n" KERN_EMERG "Stack: "); |
| 332 | show_stack_log_lvl(NULL, regs, (unsigned long *)esp, KERN_EMERG); | 311 | show_stack_log_lvl(NULL, regs, ®s->esp, KERN_EMERG); |
| 333 | 312 | ||
| 334 | printk(KERN_EMERG "Code: "); | 313 | printk(KERN_EMERG "Code: "); |
| 335 | 314 | ||
| @@ -374,11 +353,11 @@ int is_valid_bugaddr(unsigned long eip) | |||
| 374 | void die(const char * str, struct pt_regs * regs, long err) | 353 | void die(const char * str, struct pt_regs * regs, long err) |
| 375 | { | 354 | { |
| 376 | static struct { | 355 | static struct { |
| 377 | spinlock_t lock; | 356 | raw_spinlock_t lock; |
| 378 | u32 lock_owner; | 357 | u32 lock_owner; |
| 379 | int lock_owner_depth; | 358 | int lock_owner_depth; |
| 380 | } die = { | 359 | } die = { |
| 381 | .lock = __SPIN_LOCK_UNLOCKED(die.lock), | 360 | .lock = __RAW_SPIN_LOCK_UNLOCKED, |
| 382 | .lock_owner = -1, | 361 | .lock_owner = -1, |
| 383 | .lock_owner_depth = 0 | 362 | .lock_owner_depth = 0 |
| 384 | }; | 363 | }; |
| @@ -389,13 +368,14 @@ void die(const char * str, struct pt_regs * regs, long err) | |||
| 389 | 368 | ||
| 390 | if (die.lock_owner != raw_smp_processor_id()) { | 369 | if (die.lock_owner != raw_smp_processor_id()) { |
| 391 | console_verbose(); | 370 | console_verbose(); |
| 392 | spin_lock_irqsave(&die.lock, flags); | 371 | __raw_spin_lock(&die.lock); |
| 372 | raw_local_save_flags(flags); | ||
| 393 | die.lock_owner = smp_processor_id(); | 373 | die.lock_owner = smp_processor_id(); |
| 394 | die.lock_owner_depth = 0; | 374 | die.lock_owner_depth = 0; |
| 395 | bust_spinlocks(1); | 375 | bust_spinlocks(1); |
| 396 | } | 376 | } |
| 397 | else | 377 | else |
| 398 | local_save_flags(flags); | 378 | raw_local_save_flags(flags); |
| 399 | 379 | ||
| 400 | if (++die.lock_owner_depth < 3) { | 380 | if (++die.lock_owner_depth < 3) { |
| 401 | unsigned long esp; | 381 | unsigned long esp; |
| @@ -439,7 +419,8 @@ void die(const char * str, struct pt_regs * regs, long err) | |||
| 439 | bust_spinlocks(0); | 419 | bust_spinlocks(0); |
| 440 | die.lock_owner = -1; | 420 | die.lock_owner = -1; |
| 441 | add_taint(TAINT_DIE); | 421 | add_taint(TAINT_DIE); |
| 442 | spin_unlock_irqrestore(&die.lock, flags); | 422 | __raw_spin_unlock(&die.lock); |
| 423 | raw_local_irq_restore(flags); | ||
| 443 | 424 | ||
| 444 | if (!regs) | 425 | if (!regs) |
| 445 | return; | 426 | return; |
| @@ -1142,6 +1123,8 @@ static void __init set_task_gate(unsigned int n, unsigned int gdt_entry) | |||
| 1142 | 1123 | ||
| 1143 | void __init trap_init(void) | 1124 | void __init trap_init(void) |
| 1144 | { | 1125 | { |
| 1126 | int i; | ||
| 1127 | |||
| 1145 | #ifdef CONFIG_EISA | 1128 | #ifdef CONFIG_EISA |
| 1146 | void __iomem *p = ioremap(0x0FFFD9, 4); | 1129 | void __iomem *p = ioremap(0x0FFFD9, 4); |
| 1147 | if (readl(p) == 'E'+('I'<<8)+('S'<<16)+('A'<<24)) { | 1130 | if (readl(p) == 'E'+('I'<<8)+('S'<<16)+('A'<<24)) { |
| @@ -1201,6 +1184,11 @@ void __init trap_init(void) | |||
| 1201 | 1184 | ||
| 1202 | set_system_gate(SYSCALL_VECTOR,&system_call); | 1185 | set_system_gate(SYSCALL_VECTOR,&system_call); |
| 1203 | 1186 | ||
| 1187 | /* Reserve all the builtin and the syscall vector. */ | ||
| 1188 | for (i = 0; i < FIRST_EXTERNAL_VECTOR; i++) | ||
| 1189 | set_bit(i, used_vectors); | ||
| 1190 | set_bit(SYSCALL_VECTOR, used_vectors); | ||
| 1191 | |||
| 1204 | /* | 1192 | /* |
| 1205 | * Should be a barrier for any external CPU state. | 1193 | * Should be a barrier for any external CPU state. |
| 1206 | */ | 1194 | */ |
diff --git a/arch/x86/kernel/traps_64.c b/arch/x86/kernel/traps_64.c index b4c887341a26..d0c2bc7ab2ec 100644 --- a/arch/x86/kernel/traps_64.c +++ b/arch/x86/kernel/traps_64.c | |||
| @@ -462,7 +462,7 @@ void out_of_line_bug(void) | |||
| 462 | EXPORT_SYMBOL(out_of_line_bug); | 462 | EXPORT_SYMBOL(out_of_line_bug); |
| 463 | #endif | 463 | #endif |
| 464 | 464 | ||
| 465 | static DEFINE_SPINLOCK(die_lock); | 465 | static raw_spinlock_t die_lock = __RAW_SPIN_LOCK_UNLOCKED; |
| 466 | static int die_owner = -1; | 466 | static int die_owner = -1; |
| 467 | static unsigned int die_nest_count; | 467 | static unsigned int die_nest_count; |
| 468 | 468 | ||
| @@ -474,13 +474,13 @@ unsigned __kprobes long oops_begin(void) | |||
| 474 | oops_enter(); | 474 | oops_enter(); |
| 475 | 475 | ||
| 476 | /* racy, but better than risking deadlock. */ | 476 | /* racy, but better than risking deadlock. */ |
| 477 | local_irq_save(flags); | 477 | raw_local_irq_save(flags); |
| 478 | cpu = smp_processor_id(); | 478 | cpu = smp_processor_id(); |
| 479 | if (!spin_trylock(&die_lock)) { | 479 | if (!__raw_spin_trylock(&die_lock)) { |
| 480 | if (cpu == die_owner) | 480 | if (cpu == die_owner) |
| 481 | /* nested oops. should stop eventually */; | 481 | /* nested oops. should stop eventually */; |
| 482 | else | 482 | else |
| 483 | spin_lock(&die_lock); | 483 | __raw_spin_lock(&die_lock); |
| 484 | } | 484 | } |
| 485 | die_nest_count++; | 485 | die_nest_count++; |
| 486 | die_owner = cpu; | 486 | die_owner = cpu; |
| @@ -494,12 +494,10 @@ void __kprobes oops_end(unsigned long flags) | |||
| 494 | die_owner = -1; | 494 | die_owner = -1; |
| 495 | bust_spinlocks(0); | 495 | bust_spinlocks(0); |
| 496 | die_nest_count--; | 496 | die_nest_count--; |
| 497 | if (die_nest_count) | 497 | if (!die_nest_count) |
| 498 | /* We still own the lock */ | ||
| 499 | local_irq_restore(flags); | ||
| 500 | else | ||
| 501 | /* Nest count reaches zero, release the lock. */ | 498 | /* Nest count reaches zero, release the lock. */ |
| 502 | spin_unlock_irqrestore(&die_lock, flags); | 499 | __raw_spin_unlock(&die_lock); |
| 500 | raw_local_irq_restore(flags); | ||
| 503 | if (panic_on_oops) | 501 | if (panic_on_oops) |
| 504 | panic("Fatal exception"); | 502 | panic("Fatal exception"); |
| 505 | oops_exit(); | 503 | oops_exit(); |
diff --git a/arch/x86/kernel/tsc_32.c b/arch/x86/kernel/tsc_32.c index 9683f1d35601..d78444c788a3 100644 --- a/arch/x86/kernel/tsc_32.c +++ b/arch/x86/kernel/tsc_32.c | |||
| @@ -181,8 +181,8 @@ int recalibrate_cpu_khz(void) | |||
| 181 | if (cpu_has_tsc) { | 181 | if (cpu_has_tsc) { |
| 182 | cpu_khz = calculate_cpu_khz(); | 182 | cpu_khz = calculate_cpu_khz(); |
| 183 | tsc_khz = cpu_khz; | 183 | tsc_khz = cpu_khz; |
| 184 | cpu_data[0].loops_per_jiffy = | 184 | cpu_data(0).loops_per_jiffy = |
| 185 | cpufreq_scale(cpu_data[0].loops_per_jiffy, | 185 | cpufreq_scale(cpu_data(0).loops_per_jiffy, |
| 186 | cpu_khz_old, cpu_khz); | 186 | cpu_khz_old, cpu_khz); |
| 187 | return 0; | 187 | return 0; |
| 188 | } else | 188 | } else |
| @@ -215,7 +215,7 @@ time_cpufreq_notifier(struct notifier_block *nb, unsigned long val, void *data) | |||
| 215 | return 0; | 215 | return 0; |
| 216 | } | 216 | } |
| 217 | ref_freq = freq->old; | 217 | ref_freq = freq->old; |
| 218 | loops_per_jiffy_ref = cpu_data[freq->cpu].loops_per_jiffy; | 218 | loops_per_jiffy_ref = cpu_data(freq->cpu).loops_per_jiffy; |
| 219 | cpu_khz_ref = cpu_khz; | 219 | cpu_khz_ref = cpu_khz; |
| 220 | } | 220 | } |
| 221 | 221 | ||
| @@ -223,7 +223,7 @@ time_cpufreq_notifier(struct notifier_block *nb, unsigned long val, void *data) | |||
| 223 | (val == CPUFREQ_POSTCHANGE && freq->old > freq->new) || | 223 | (val == CPUFREQ_POSTCHANGE && freq->old > freq->new) || |
| 224 | (val == CPUFREQ_RESUMECHANGE)) { | 224 | (val == CPUFREQ_RESUMECHANGE)) { |
| 225 | if (!(freq->flags & CPUFREQ_CONST_LOOPS)) | 225 | if (!(freq->flags & CPUFREQ_CONST_LOOPS)) |
| 226 | cpu_data[freq->cpu].loops_per_jiffy = | 226 | cpu_data(freq->cpu).loops_per_jiffy = |
| 227 | cpufreq_scale(loops_per_jiffy_ref, | 227 | cpufreq_scale(loops_per_jiffy_ref, |
| 228 | ref_freq, freq->new); | 228 | ref_freq, freq->new); |
| 229 | 229 | ||
diff --git a/arch/x86/kernel/tsc_64.c b/arch/x86/kernel/tsc_64.c index 9f22e542c374..9c70af45b42b 100644 --- a/arch/x86/kernel/tsc_64.c +++ b/arch/x86/kernel/tsc_64.c | |||
| @@ -73,13 +73,13 @@ static int time_cpufreq_notifier(struct notifier_block *nb, unsigned long val, | |||
| 73 | struct cpufreq_freqs *freq = data; | 73 | struct cpufreq_freqs *freq = data; |
| 74 | unsigned long *lpj, dummy; | 74 | unsigned long *lpj, dummy; |
| 75 | 75 | ||
| 76 | if (cpu_has(&cpu_data[freq->cpu], X86_FEATURE_CONSTANT_TSC)) | 76 | if (cpu_has(&cpu_data(freq->cpu), X86_FEATURE_CONSTANT_TSC)) |
| 77 | return 0; | 77 | return 0; |
| 78 | 78 | ||
| 79 | lpj = &dummy; | 79 | lpj = &dummy; |
| 80 | if (!(freq->flags & CPUFREQ_CONST_LOOPS)) | 80 | if (!(freq->flags & CPUFREQ_CONST_LOOPS)) |
| 81 | #ifdef CONFIG_SMP | 81 | #ifdef CONFIG_SMP |
| 82 | lpj = &cpu_data[freq->cpu].loops_per_jiffy; | 82 | lpj = &cpu_data(freq->cpu).loops_per_jiffy; |
| 83 | #else | 83 | #else |
| 84 | lpj = &boot_cpu_data.loops_per_jiffy; | 84 | lpj = &boot_cpu_data.loops_per_jiffy; |
| 85 | #endif | 85 | #endif |
diff --git a/arch/x86/kernel/vsyscall_64.c b/arch/x86/kernel/vsyscall_64.c index e14cb3f53862..ad4005c6d4a1 100644 --- a/arch/x86/kernel/vsyscall_64.c +++ b/arch/x86/kernel/vsyscall_64.c | |||
| @@ -48,7 +48,7 @@ | |||
| 48 | ({unsigned long v; \ | 48 | ({unsigned long v; \ |
| 49 | extern char __vsyscall_0; \ | 49 | extern char __vsyscall_0; \ |
| 50 | asm("" : "=r" (v) : "0" (x)); \ | 50 | asm("" : "=r" (v) : "0" (x)); \ |
| 51 | ((v - VSYSCALL_FIRST_PAGE) + __pa_symbol(&__vsyscall_0)); }) | 51 | ((v - VSYSCALL_START) + __pa_symbol(&__vsyscall_0)); }) |
| 52 | 52 | ||
| 53 | /* | 53 | /* |
| 54 | * vsyscall_gtod_data contains data that is : | 54 | * vsyscall_gtod_data contains data that is : |
| @@ -291,7 +291,7 @@ static void __cpuinit vsyscall_set_cpu(int cpu) | |||
| 291 | #ifdef CONFIG_NUMA | 291 | #ifdef CONFIG_NUMA |
| 292 | node = cpu_to_node(cpu); | 292 | node = cpu_to_node(cpu); |
| 293 | #endif | 293 | #endif |
| 294 | if (cpu_has(&cpu_data[cpu], X86_FEATURE_RDTSCP)) | 294 | if (cpu_has(&cpu_data(cpu), X86_FEATURE_RDTSCP)) |
| 295 | write_rdtscp_aux((node << 12) | cpu); | 295 | write_rdtscp_aux((node << 12) | cpu); |
| 296 | 296 | ||
| 297 | /* Store cpu number in limit so that it can be loaded quickly | 297 | /* Store cpu number in limit so that it can be loaded quickly |
diff --git a/arch/x86/lib/delay_32.c b/arch/x86/lib/delay_32.c index f6edb11364df..952e7a89c2ac 100644 --- a/arch/x86/lib/delay_32.c +++ b/arch/x86/lib/delay_32.c | |||
| @@ -82,7 +82,7 @@ inline void __const_udelay(unsigned long xloops) | |||
| 82 | __asm__("mull %0" | 82 | __asm__("mull %0" |
| 83 | :"=d" (xloops), "=&a" (d0) | 83 | :"=d" (xloops), "=&a" (d0) |
| 84 | :"1" (xloops), "0" | 84 | :"1" (xloops), "0" |
| 85 | (cpu_data[raw_smp_processor_id()].loops_per_jiffy * (HZ/4))); | 85 | (cpu_data(raw_smp_processor_id()).loops_per_jiffy * (HZ/4))); |
| 86 | 86 | ||
| 87 | __delay(++xloops); | 87 | __delay(++xloops); |
| 88 | } | 88 | } |
diff --git a/arch/x86/lib/delay_64.c b/arch/x86/lib/delay_64.c index 2dbebd308347..0ebbfb9e7c7f 100644 --- a/arch/x86/lib/delay_64.c +++ b/arch/x86/lib/delay_64.c | |||
| @@ -40,7 +40,8 @@ EXPORT_SYMBOL(__delay); | |||
| 40 | 40 | ||
| 41 | inline void __const_udelay(unsigned long xloops) | 41 | inline void __const_udelay(unsigned long xloops) |
| 42 | { | 42 | { |
| 43 | __delay(((xloops * HZ * cpu_data[raw_smp_processor_id()].loops_per_jiffy) >> 32) + 1); | 43 | __delay(((xloops * HZ * |
| 44 | cpu_data(raw_smp_processor_id()).loops_per_jiffy) >> 32) + 1); | ||
| 44 | } | 45 | } |
| 45 | EXPORT_SYMBOL(__const_udelay); | 46 | EXPORT_SYMBOL(__const_udelay); |
| 46 | 47 | ||
diff --git a/arch/x86/mach-voyager/voyager_smp.c b/arch/x86/mach-voyager/voyager_smp.c index c5f2692273e6..361ac5107b33 100644 --- a/arch/x86/mach-voyager/voyager_smp.c +++ b/arch/x86/mach-voyager/voyager_smp.c | |||
| @@ -36,8 +36,8 @@ static unsigned long cpu_irq_affinity[NR_CPUS] __cacheline_aligned = { [0 ... NR | |||
| 36 | 36 | ||
| 37 | /* per CPU data structure (for /proc/cpuinfo et al), visible externally | 37 | /* per CPU data structure (for /proc/cpuinfo et al), visible externally |
| 38 | * indexed physically */ | 38 | * indexed physically */ |
| 39 | struct cpuinfo_x86 cpu_data[NR_CPUS] __cacheline_aligned; | 39 | DEFINE_PER_CPU(cpuinfo_x86, cpu_info) __cacheline_aligned; |
| 40 | EXPORT_SYMBOL(cpu_data); | 40 | EXPORT_PER_CPU_SYMBOL(cpu_info); |
| 41 | 41 | ||
| 42 | /* physical ID of the CPU used to boot the system */ | 42 | /* physical ID of the CPU used to boot the system */ |
| 43 | unsigned char boot_cpu_id; | 43 | unsigned char boot_cpu_id; |
| @@ -430,7 +430,7 @@ find_smp_config(void) | |||
| 430 | void __init | 430 | void __init |
| 431 | smp_store_cpu_info(int id) | 431 | smp_store_cpu_info(int id) |
| 432 | { | 432 | { |
| 433 | struct cpuinfo_x86 *c=&cpu_data[id]; | 433 | struct cpuinfo_x86 *c = &cpu_data(id); |
| 434 | 434 | ||
| 435 | *c = boot_cpu_data; | 435 | *c = boot_cpu_data; |
| 436 | 436 | ||
| @@ -634,7 +634,7 @@ do_boot_cpu(__u8 cpu) | |||
| 634 | cpu, smp_processor_id())); | 634 | cpu, smp_processor_id())); |
| 635 | 635 | ||
| 636 | printk("CPU%d: ", cpu); | 636 | printk("CPU%d: ", cpu); |
| 637 | print_cpu_info(&cpu_data[cpu]); | 637 | print_cpu_info(&cpu_data(cpu)); |
| 638 | wmb(); | 638 | wmb(); |
| 639 | cpu_set(cpu, cpu_callout_map); | 639 | cpu_set(cpu, cpu_callout_map); |
| 640 | cpu_set(cpu, cpu_present_map); | 640 | cpu_set(cpu, cpu_present_map); |
| @@ -683,7 +683,7 @@ smp_boot_cpus(void) | |||
| 683 | */ | 683 | */ |
| 684 | smp_store_cpu_info(boot_cpu_id); | 684 | smp_store_cpu_info(boot_cpu_id); |
| 685 | printk("CPU%d: ", boot_cpu_id); | 685 | printk("CPU%d: ", boot_cpu_id); |
| 686 | print_cpu_info(&cpu_data[boot_cpu_id]); | 686 | print_cpu_info(&cpu_data(boot_cpu_id)); |
| 687 | 687 | ||
| 688 | if(is_cpu_quad()) { | 688 | if(is_cpu_quad()) { |
| 689 | /* booting on a Quad CPU */ | 689 | /* booting on a Quad CPU */ |
| @@ -714,7 +714,7 @@ smp_boot_cpus(void) | |||
| 714 | unsigned long bogosum = 0; | 714 | unsigned long bogosum = 0; |
| 715 | for (i = 0; i < NR_CPUS; i++) | 715 | for (i = 0; i < NR_CPUS; i++) |
| 716 | if (cpu_isset(i, cpu_online_map)) | 716 | if (cpu_isset(i, cpu_online_map)) |
| 717 | bogosum += cpu_data[i].loops_per_jiffy; | 717 | bogosum += cpu_data(i).loops_per_jiffy; |
| 718 | printk(KERN_INFO "Total of %d processors activated (%lu.%02lu BogoMIPS).\n", | 718 | printk(KERN_INFO "Total of %d processors activated (%lu.%02lu BogoMIPS).\n", |
| 719 | cpucount+1, | 719 | cpucount+1, |
| 720 | bogosum/(500000/HZ), | 720 | bogosum/(500000/HZ), |
diff --git a/arch/x86/mm/fault_32.c b/arch/x86/mm/fault_32.c index d6181597a0a8..503dfc05111b 100644 --- a/arch/x86/mm/fault_32.c +++ b/arch/x86/mm/fault_32.c | |||
| @@ -564,7 +564,8 @@ no_context: | |||
| 564 | * it's allocated already. | 564 | * it's allocated already. |
| 565 | */ | 565 | */ |
| 566 | if ((page >> PAGE_SHIFT) < max_low_pfn | 566 | if ((page >> PAGE_SHIFT) < max_low_pfn |
| 567 | && (page & _PAGE_PRESENT)) { | 567 | && (page & _PAGE_PRESENT) |
| 568 | && !(page & _PAGE_PSE)) { | ||
| 568 | page &= PAGE_MASK; | 569 | page &= PAGE_MASK; |
| 569 | page = ((__typeof__(page) *) __va(page))[(address >> PAGE_SHIFT) | 570 | page = ((__typeof__(page) *) __va(page))[(address >> PAGE_SHIFT) |
| 570 | & (PTRS_PER_PTE - 1)]; | 571 | & (PTRS_PER_PTE - 1)]; |
diff --git a/arch/x86/mm/fault_64.c b/arch/x86/mm/fault_64.c index 7c560843ded1..644b4f7ece10 100644 --- a/arch/x86/mm/fault_64.c +++ b/arch/x86/mm/fault_64.c | |||
| @@ -169,7 +169,7 @@ void dump_pagetable(unsigned long address) | |||
| 169 | pmd = pmd_offset(pud, address); | 169 | pmd = pmd_offset(pud, address); |
| 170 | if (bad_address(pmd)) goto bad; | 170 | if (bad_address(pmd)) goto bad; |
| 171 | printk("PMD %lx ", pmd_val(*pmd)); | 171 | printk("PMD %lx ", pmd_val(*pmd)); |
| 172 | if (!pmd_present(*pmd)) goto ret; | 172 | if (!pmd_present(*pmd) || pmd_large(*pmd)) goto ret; |
| 173 | 173 | ||
| 174 | pte = pte_offset_kernel(pmd, address); | 174 | pte = pte_offset_kernel(pmd, address); |
| 175 | if (bad_address(pte)) goto bad; | 175 | if (bad_address(pte)) goto bad; |
| @@ -285,7 +285,6 @@ static int vmalloc_fault(unsigned long address) | |||
| 285 | return 0; | 285 | return 0; |
| 286 | } | 286 | } |
| 287 | 287 | ||
| 288 | static int page_fault_trace; | ||
| 289 | int show_unhandled_signals = 1; | 288 | int show_unhandled_signals = 1; |
| 290 | 289 | ||
| 291 | /* | 290 | /* |
| @@ -354,10 +353,6 @@ asmlinkage void __kprobes do_page_fault(struct pt_regs *regs, | |||
| 354 | if (likely(regs->eflags & X86_EFLAGS_IF)) | 353 | if (likely(regs->eflags & X86_EFLAGS_IF)) |
| 355 | local_irq_enable(); | 354 | local_irq_enable(); |
| 356 | 355 | ||
| 357 | if (unlikely(page_fault_trace)) | ||
| 358 | printk("pagefault rip:%lx rsp:%lx cs:%lu ss:%lu address %lx error %lx\n", | ||
| 359 | regs->rip,regs->rsp,regs->cs,regs->ss,address,error_code); | ||
| 360 | |||
| 361 | if (unlikely(error_code & PF_RSVD)) | 356 | if (unlikely(error_code & PF_RSVD)) |
| 362 | pgtable_bad(address, regs, error_code); | 357 | pgtable_bad(address, regs, error_code); |
| 363 | 358 | ||
| @@ -488,7 +483,7 @@ bad_area_nosemaphore: | |||
| 488 | if (show_unhandled_signals && unhandled_signal(tsk, SIGSEGV) && | 483 | if (show_unhandled_signals && unhandled_signal(tsk, SIGSEGV) && |
| 489 | printk_ratelimit()) { | 484 | printk_ratelimit()) { |
| 490 | printk( | 485 | printk( |
| 491 | "%s%s[%d]: segfault at %016lx rip %016lx rsp %016lx error %lx\n", | 486 | "%s%s[%d]: segfault at %lx rip %lx rsp %lx error %lx\n", |
| 492 | tsk->pid > 1 ? KERN_INFO : KERN_EMERG, | 487 | tsk->pid > 1 ? KERN_INFO : KERN_EMERG, |
| 493 | tsk->comm, tsk->pid, address, regs->rip, | 488 | tsk->comm, tsk->pid, address, regs->rip, |
| 494 | regs->rsp, error_code); | 489 | regs->rsp, error_code); |
| @@ -621,10 +616,3 @@ void vmalloc_sync_all(void) | |||
| 621 | BUILD_BUG_ON(!(((MODULES_END - 1) & PGDIR_MASK) == | 616 | BUILD_BUG_ON(!(((MODULES_END - 1) & PGDIR_MASK) == |
| 622 | (__START_KERNEL & PGDIR_MASK))); | 617 | (__START_KERNEL & PGDIR_MASK))); |
| 623 | } | 618 | } |
| 624 | |||
| 625 | static int __init enable_pagefaulttrace(char *str) | ||
| 626 | { | ||
| 627 | page_fault_trace = 1; | ||
| 628 | return 1; | ||
| 629 | } | ||
| 630 | __setup("pagefaulttrace", enable_pagefaulttrace); | ||
diff --git a/arch/x86/mm/numa_64.c b/arch/x86/mm/numa_64.c index 5eec5e56d07f..3d6926ba8995 100644 --- a/arch/x86/mm/numa_64.c +++ b/arch/x86/mm/numa_64.c | |||
| @@ -612,7 +612,7 @@ void __init init_cpu_to_node(void) | |||
| 612 | { | 612 | { |
| 613 | int i; | 613 | int i; |
| 614 | for (i = 0; i < NR_CPUS; i++) { | 614 | for (i = 0; i < NR_CPUS; i++) { |
| 615 | u8 apicid = x86_cpu_to_apicid[i]; | 615 | u8 apicid = x86_cpu_to_apicid_init[i]; |
| 616 | if (apicid == BAD_APICID) | 616 | if (apicid == BAD_APICID) |
| 617 | continue; | 617 | continue; |
| 618 | if (apicid_to_node[apicid] == NUMA_NO_NODE) | 618 | if (apicid_to_node[apicid] == NUMA_NO_NODE) |
diff --git a/arch/x86/oprofile/backtrace.c b/arch/x86/oprofile/backtrace.c index c049ce414f01..0ed046a187f7 100644 --- a/arch/x86/oprofile/backtrace.c +++ b/arch/x86/oprofile/backtrace.c | |||
| @@ -13,25 +13,45 @@ | |||
| 13 | #include <linux/mm.h> | 13 | #include <linux/mm.h> |
| 14 | #include <asm/ptrace.h> | 14 | #include <asm/ptrace.h> |
| 15 | #include <asm/uaccess.h> | 15 | #include <asm/uaccess.h> |
| 16 | #include <asm/stacktrace.h> | ||
| 16 | 17 | ||
| 17 | struct frame_head { | 18 | static void backtrace_warning_symbol(void *data, char *msg, |
| 18 | struct frame_head * ebp; | 19 | unsigned long symbol) |
| 19 | unsigned long ret; | 20 | { |
| 20 | } __attribute__((packed)); | 21 | /* Ignore warnings */ |
| 22 | } | ||
| 21 | 23 | ||
| 22 | static struct frame_head * | 24 | static void backtrace_warning(void *data, char *msg) |
| 23 | dump_kernel_backtrace(struct frame_head * head) | ||
| 24 | { | 25 | { |
| 25 | oprofile_add_trace(head->ret); | 26 | /* Ignore warnings */ |
| 27 | } | ||
| 26 | 28 | ||
| 27 | /* frame pointers should strictly progress back up the stack | 29 | static int backtrace_stack(void *data, char *name) |
| 28 | * (towards higher addresses) */ | 30 | { |
| 29 | if (head >= head->ebp) | 31 | /* Yes, we want all stacks */ |
| 30 | return NULL; | 32 | return 0; |
| 33 | } | ||
| 34 | |||
| 35 | static void backtrace_address(void *data, unsigned long addr) | ||
| 36 | { | ||
| 37 | unsigned int *depth = data; | ||
| 31 | 38 | ||
| 32 | return head->ebp; | 39 | if ((*depth)--) |
| 40 | oprofile_add_trace(addr); | ||
| 33 | } | 41 | } |
| 34 | 42 | ||
| 43 | static struct stacktrace_ops backtrace_ops = { | ||
| 44 | .warning = backtrace_warning, | ||
| 45 | .warning_symbol = backtrace_warning_symbol, | ||
| 46 | .stack = backtrace_stack, | ||
| 47 | .address = backtrace_address, | ||
| 48 | }; | ||
| 49 | |||
| 50 | struct frame_head { | ||
| 51 | struct frame_head *ebp; | ||
| 52 | unsigned long ret; | ||
| 53 | } __attribute__((packed)); | ||
| 54 | |||
| 35 | static struct frame_head * | 55 | static struct frame_head * |
| 36 | dump_user_backtrace(struct frame_head * head) | 56 | dump_user_backtrace(struct frame_head * head) |
| 37 | { | 57 | { |
| @@ -53,72 +73,16 @@ dump_user_backtrace(struct frame_head * head) | |||
| 53 | return bufhead[0].ebp; | 73 | return bufhead[0].ebp; |
| 54 | } | 74 | } |
| 55 | 75 | ||
| 56 | /* | ||
| 57 | * | | /\ Higher addresses | ||
| 58 | * | | | ||
| 59 | * --------------- stack base (address of current_thread_info) | ||
| 60 | * | thread info | | ||
| 61 | * . . | ||
| 62 | * | stack | | ||
| 63 | * --------------- saved regs->ebp value if valid (frame_head address) | ||
| 64 | * . . | ||
| 65 | * --------------- saved regs->rsp value if x86_64 | ||
| 66 | * | | | ||
| 67 | * --------------- struct pt_regs * stored on stack if 32-bit | ||
| 68 | * | | | ||
| 69 | * . . | ||
| 70 | * | | | ||
| 71 | * --------------- %esp | ||
| 72 | * | | | ||
| 73 | * | | \/ Lower addresses | ||
| 74 | * | ||
| 75 | * Thus, regs (or regs->rsp for x86_64) <-> stack base restricts the | ||
| 76 | * valid(ish) ebp values. Note: (1) for x86_64, NMI and several other | ||
| 77 | * exceptions use special stacks, maintained by the interrupt stack table | ||
| 78 | * (IST). These stacks are set up in trap_init() in | ||
| 79 | * arch/x86_64/kernel/traps.c. Thus, for x86_64, regs now does not point | ||
| 80 | * to the kernel stack; instead, it points to some location on the NMI | ||
| 81 | * stack. On the other hand, regs->rsp is the stack pointer saved when the | ||
| 82 | * NMI occurred. (2) For 32-bit, regs->esp is not valid because the | ||
| 83 | * processor does not save %esp on the kernel stack when interrupts occur | ||
| 84 | * in the kernel mode. | ||
| 85 | */ | ||
| 86 | #ifdef CONFIG_FRAME_POINTER | ||
| 87 | static int valid_kernel_stack(struct frame_head * head, struct pt_regs * regs) | ||
| 88 | { | ||
| 89 | unsigned long headaddr = (unsigned long)head; | ||
| 90 | #ifdef CONFIG_X86_64 | ||
| 91 | unsigned long stack = (unsigned long)regs->rsp; | ||
| 92 | #else | ||
| 93 | unsigned long stack = (unsigned long)regs; | ||
| 94 | #endif | ||
| 95 | unsigned long stack_base = (stack & ~(THREAD_SIZE - 1)) + THREAD_SIZE; | ||
| 96 | |||
| 97 | return headaddr > stack && headaddr < stack_base; | ||
| 98 | } | ||
| 99 | #else | ||
| 100 | /* without fp, it's just junk */ | ||
| 101 | static int valid_kernel_stack(struct frame_head * head, struct pt_regs * regs) | ||
| 102 | { | ||
| 103 | return 0; | ||
| 104 | } | ||
| 105 | #endif | ||
| 106 | |||
| 107 | |||
| 108 | void | 76 | void |
| 109 | x86_backtrace(struct pt_regs * const regs, unsigned int depth) | 77 | x86_backtrace(struct pt_regs * const regs, unsigned int depth) |
| 110 | { | 78 | { |
| 111 | struct frame_head *head; | 79 | struct frame_head *head = (struct frame_head *)frame_pointer(regs); |
| 112 | 80 | unsigned long stack = stack_pointer(regs); | |
| 113 | #ifdef CONFIG_X86_64 | ||
| 114 | head = (struct frame_head *)regs->rbp; | ||
| 115 | #else | ||
| 116 | head = (struct frame_head *)regs->ebp; | ||
| 117 | #endif | ||
| 118 | 81 | ||
| 119 | if (!user_mode_vm(regs)) { | 82 | if (!user_mode_vm(regs)) { |
| 120 | while (depth-- && valid_kernel_stack(head, regs)) | 83 | if (depth) |
| 121 | head = dump_kernel_backtrace(head); | 84 | dump_trace(NULL, regs, (unsigned long *)stack, |
| 85 | &backtrace_ops, &depth); | ||
| 122 | return; | 86 | return; |
| 123 | } | 87 | } |
| 124 | 88 | ||
diff --git a/arch/x86_64/.gitignore b/arch/x86_64/.gitignore new file mode 100644 index 000000000000..36ef4c374d25 --- /dev/null +++ b/arch/x86_64/.gitignore | |||
| @@ -0,0 +1 @@ | |||
| boot | |||
diff --git a/arch/x86_64/Kconfig b/arch/x86_64/Kconfig index 25785b23df87..aab25f3ba3ce 100644 --- a/arch/x86_64/Kconfig +++ b/arch/x86_64/Kconfig | |||
| @@ -723,7 +723,7 @@ config ARCH_HIBERNATION_HEADER | |||
| 723 | 723 | ||
| 724 | source "drivers/acpi/Kconfig" | 724 | source "drivers/acpi/Kconfig" |
| 725 | 725 | ||
| 726 | source "arch/x86/kernel/cpufreq/Kconfig" | 726 | source "arch/x86/kernel/cpu/cpufreq/Kconfig_64" |
| 727 | 727 | ||
| 728 | source "drivers/cpuidle/Kconfig" | 728 | source "drivers/cpuidle/Kconfig" |
| 729 | 729 | ||
| @@ -768,9 +768,9 @@ source "fs/Kconfig.binfmt" | |||
| 768 | config IA32_EMULATION | 768 | config IA32_EMULATION |
| 769 | bool "IA32 Emulation" | 769 | bool "IA32 Emulation" |
| 770 | help | 770 | help |
| 771 | Include code to run 32-bit programs under a 64-bit kernel. You should likely | 771 | Include code to run 32-bit programs under a 64-bit kernel. You should |
| 772 | turn this on, unless you're 100% sure that you don't have any 32-bit programs | 772 | likely turn this on, unless you're 100% sure that you don't have any |
| 773 | left. | 773 | 32-bit programs left. |
| 774 | 774 | ||
| 775 | config IA32_AOUT | 775 | config IA32_AOUT |
| 776 | tristate "IA32 a.out support" | 776 | tristate "IA32 a.out support" |
diff --git a/arch/x86_64/Makefile b/arch/x86_64/Makefile index 03e1ede27b85..6d89ab762ffc 100644 --- a/arch/x86_64/Makefile +++ b/arch/x86_64/Makefile | |||
| @@ -74,7 +74,7 @@ KBUILD_CFLAGS += $(cflags-y) | |||
| 74 | CFLAGS_KERNEL += $(cflags-kernel-y) | 74 | CFLAGS_KERNEL += $(cflags-kernel-y) |
| 75 | KBUILD_AFLAGS += -m64 | 75 | KBUILD_AFLAGS += -m64 |
| 76 | 76 | ||
| 77 | head-y := arch/x86/kernel/head_64.o arch/x86/kernel/head64.o arch/x86/kernel/init_task_64.o | 77 | head-y := arch/x86/kernel/head_64.o arch/x86/kernel/head64.o arch/x86/kernel/init_task.o |
| 78 | 78 | ||
| 79 | libs-y += arch/x86/lib/ | 79 | libs-y += arch/x86/lib/ |
| 80 | core-y += arch/x86/kernel/ \ | 80 | core-y += arch/x86/kernel/ \ |
| @@ -97,9 +97,9 @@ BOOTIMAGE := arch/x86/boot/bzImage | |||
| 97 | KBUILD_IMAGE := $(BOOTIMAGE) | 97 | KBUILD_IMAGE := $(BOOTIMAGE) |
| 98 | 98 | ||
| 99 | bzImage: vmlinux | 99 | bzImage: vmlinux |
| 100 | $(Q)mkdir -p $(objtree)/arch/x86_64/boot | ||
| 101 | $(Q)ln -fsn $(objtree)/arch/x86/boot/bzImage $(objtree)/arch/x86_64/boot/bzImage | ||
| 102 | $(Q)$(MAKE) $(build)=$(boot) $(BOOTIMAGE) | 100 | $(Q)$(MAKE) $(build)=$(boot) $(BOOTIMAGE) |
| 101 | $(Q)mkdir -p $(objtree)/arch/x86_64/boot | ||
| 102 | $(Q)ln -fsn ../../x86/boot/bzImage $(objtree)/arch/x86_64/boot/bzImage | ||
| 103 | 103 | ||
| 104 | bzlilo: vmlinux | 104 | bzlilo: vmlinux |
| 105 | $(Q)$(MAKE) $(build)=$(boot) BOOTIMAGE=$(BOOTIMAGE) zlilo | 105 | $(Q)$(MAKE) $(build)=$(boot) BOOTIMAGE=$(BOOTIMAGE) zlilo |
diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c index a7351084f2f8..235a51e328c3 100644 --- a/drivers/acpi/processor_core.c +++ b/drivers/acpi/processor_core.c | |||
| @@ -422,12 +422,6 @@ static int map_lsapic_id(struct acpi_subtable_header *entry, | |||
| 422 | return 0; | 422 | return 0; |
| 423 | } | 423 | } |
| 424 | 424 | ||
| 425 | #ifdef CONFIG_IA64 | ||
| 426 | #define arch_cpu_to_apicid ia64_cpu_to_sapicid | ||
| 427 | #else | ||
| 428 | #define arch_cpu_to_apicid x86_cpu_to_apicid | ||
| 429 | #endif | ||
| 430 | |||
| 431 | static int map_madt_entry(u32 acpi_id) | 425 | static int map_madt_entry(u32 acpi_id) |
| 432 | { | 426 | { |
| 433 | unsigned long madt_end, entry; | 427 | unsigned long madt_end, entry; |
| @@ -501,7 +495,7 @@ static int get_cpu_id(acpi_handle handle, u32 acpi_id) | |||
| 501 | return apic_id; | 495 | return apic_id; |
| 502 | 496 | ||
| 503 | for (i = 0; i < NR_CPUS; ++i) { | 497 | for (i = 0; i < NR_CPUS; ++i) { |
| 504 | if (arch_cpu_to_apicid[i] == apic_id) | 498 | if (cpu_physical_id(i) == apic_id) |
| 505 | return i; | 499 | return i; |
| 506 | } | 500 | } |
| 507 | return -1; | 501 | return -1; |
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index bbaa545ea999..629eadbd0ec0 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
| @@ -1392,7 +1392,7 @@ static void ata_qc_complete_internal(struct ata_queued_cmd *qc) | |||
| 1392 | * @tf: Taskfile registers for the command and the result | 1392 | * @tf: Taskfile registers for the command and the result |
| 1393 | * @cdb: CDB for packet command | 1393 | * @cdb: CDB for packet command |
| 1394 | * @dma_dir: Data tranfer direction of the command | 1394 | * @dma_dir: Data tranfer direction of the command |
| 1395 | * @sg: sg list for the data buffer of the command | 1395 | * @sgl: sg list for the data buffer of the command |
| 1396 | * @n_elem: Number of sg entries | 1396 | * @n_elem: Number of sg entries |
| 1397 | * @timeout: Timeout in msecs (0 for default) | 1397 | * @timeout: Timeout in msecs (0 for default) |
| 1398 | * | 1398 | * |
diff --git a/drivers/ata/pata_cs5536.c b/drivers/ata/pata_cs5536.c index 53070f6b1fc4..d753e568588e 100644 --- a/drivers/ata/pata_cs5536.c +++ b/drivers/ata/pata_cs5536.c | |||
| @@ -40,7 +40,7 @@ | |||
| 40 | #include <asm/msr.h> | 40 | #include <asm/msr.h> |
| 41 | 41 | ||
| 42 | #define DRV_NAME "pata_cs5536" | 42 | #define DRV_NAME "pata_cs5536" |
| 43 | #define DRV_VERSION "0.0.5" | 43 | #define DRV_VERSION "0.0.6" |
| 44 | 44 | ||
| 45 | enum { | 45 | enum { |
| 46 | CFG = 0, | 46 | CFG = 0, |
| @@ -214,7 +214,7 @@ static void cs5536_set_dmamode(struct ata_port *ap, struct ata_device *adev) | |||
| 214 | cs5536_read(pdev, DTC, &dtc); | 214 | cs5536_read(pdev, DTC, &dtc); |
| 215 | 215 | ||
| 216 | dtc &= ~(IDE_DRV_MASK << dshift); | 216 | dtc &= ~(IDE_DRV_MASK << dshift); |
| 217 | dtc |= mwdma_timings[mode] << dshift; | 217 | dtc |= mwdma_timings[mode - XFER_MW_DMA_0] << dshift; |
| 218 | 218 | ||
| 219 | cs5536_write(pdev, DTC, dtc); | 219 | cs5536_write(pdev, DTC, dtc); |
| 220 | } | 220 | } |
diff --git a/drivers/ata/sata_sis.c b/drivers/ata/sata_sis.c index 8d98a9fb0a42..f147dc7bf464 100644 --- a/drivers/ata/sata_sis.c +++ b/drivers/ata/sata_sis.c | |||
| @@ -92,7 +92,7 @@ static struct scsi_host_template sis_sht = { | |||
| 92 | .queuecommand = ata_scsi_queuecmd, | 92 | .queuecommand = ata_scsi_queuecmd, |
| 93 | .can_queue = ATA_DEF_QUEUE, | 93 | .can_queue = ATA_DEF_QUEUE, |
| 94 | .this_id = ATA_SHT_THIS_ID, | 94 | .this_id = ATA_SHT_THIS_ID, |
| 95 | .sg_tablesize = ATA_MAX_PRD, | 95 | .sg_tablesize = LIBATA_MAX_PRD, |
| 96 | .cmd_per_lun = ATA_SHT_CMD_PER_LUN, | 96 | .cmd_per_lun = ATA_SHT_CMD_PER_LUN, |
| 97 | .emulated = ATA_SHT_EMULATED, | 97 | .emulated = ATA_SHT_EMULATED, |
| 98 | .use_clustering = ATA_SHT_USE_CLUSTERING, | 98 | .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) | |||
| 166 | return addr; | 166 | return addr; |
| 167 | } | 167 | } |
| 168 | 168 | ||
| 169 | static u32 sis_scr_cfg_read (struct ata_port *ap, unsigned int sc_reg) | 169 | static u32 sis_scr_cfg_read (struct ata_port *ap, unsigned int sc_reg, u32 *val) |
| 170 | { | 170 | { |
| 171 | struct pci_dev *pdev = to_pci_dev(ap->host->dev); | 171 | struct pci_dev *pdev = to_pci_dev(ap->host->dev); |
| 172 | unsigned int cfg_addr = get_scr_cfg_addr(ap, sc_reg); | 172 | unsigned int cfg_addr = get_scr_cfg_addr(ap, sc_reg); |
| 173 | u32 val, val2 = 0; | 173 | u32 val2 = 0; |
| 174 | u8 pmr; | 174 | u8 pmr; |
| 175 | 175 | ||
| 176 | if (sc_reg == SCR_ERROR) /* doesn't exist in PCI cfg space */ | 176 | 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) | |||
| 178 | 178 | ||
| 179 | pci_read_config_byte(pdev, SIS_PMR, &pmr); | 179 | pci_read_config_byte(pdev, SIS_PMR, &pmr); |
| 180 | 180 | ||
| 181 | pci_read_config_dword(pdev, cfg_addr, &val); | 181 | pci_read_config_dword(pdev, cfg_addr, val); |
| 182 | 182 | ||
| 183 | if ((pdev->device == 0x0182) || (pdev->device == 0x0183) || | 183 | if ((pdev->device == 0x0182) || (pdev->device == 0x0183) || |
| 184 | (pdev->device == 0x1182) || (pmr & SIS_PMR_COMBINED)) | 184 | (pdev->device == 0x1182) || (pmr & SIS_PMR_COMBINED)) |
| 185 | pci_read_config_dword(pdev, cfg_addr+0x10, &val2); | 185 | pci_read_config_dword(pdev, cfg_addr+0x10, &val2); |
| 186 | 186 | ||
| 187 | return (val|val2) & 0xfffffffb; /* avoid problems with powerdowned ports */ | 187 | *val |= val2; |
| 188 | *val &= 0xfffffffb; /* avoid problems with powerdowned ports */ | ||
| 189 | |||
| 190 | return 0; | ||
| 188 | } | 191 | } |
| 189 | 192 | ||
| 190 | static void sis_scr_cfg_write (struct ata_port *ap, unsigned int sc_reg, u32 val) | 193 | 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) | |||
| 214 | return -EINVAL; | 217 | return -EINVAL; |
| 215 | 218 | ||
| 216 | if (ap->flags & SIS_FLAG_CFGSCR) | 219 | if (ap->flags & SIS_FLAG_CFGSCR) |
| 217 | return sis_scr_cfg_read(ap, sc_reg); | 220 | return sis_scr_cfg_read(ap, sc_reg, val); |
| 218 | 221 | ||
| 219 | pci_read_config_byte(pdev, SIS_PMR, &pmr); | 222 | pci_read_config_byte(pdev, SIS_PMR, &pmr); |
| 220 | 223 | ||
diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c index 6f66551d9e51..5c82ec7f8bbd 100644 --- a/drivers/hwmon/coretemp.c +++ b/drivers/hwmon/coretemp.c | |||
| @@ -150,7 +150,7 @@ static struct coretemp_data *coretemp_update_device(struct device *dev) | |||
| 150 | static int __devinit coretemp_probe(struct platform_device *pdev) | 150 | static int __devinit coretemp_probe(struct platform_device *pdev) |
| 151 | { | 151 | { |
| 152 | struct coretemp_data *data; | 152 | struct coretemp_data *data; |
| 153 | struct cpuinfo_x86 *c = &(cpu_data)[pdev->id]; | 153 | struct cpuinfo_x86 *c = &cpu_data(pdev->id); |
| 154 | int err; | 154 | int err; |
| 155 | u32 eax, edx; | 155 | u32 eax, edx; |
| 156 | 156 | ||
| @@ -359,7 +359,7 @@ static int __init coretemp_init(void) | |||
| 359 | struct pdev_entry *p, *n; | 359 | struct pdev_entry *p, *n; |
| 360 | 360 | ||
| 361 | /* quick check if we run Intel */ | 361 | /* quick check if we run Intel */ |
| 362 | if (cpu_data[0].x86_vendor != X86_VENDOR_INTEL) | 362 | if (cpu_data(0).x86_vendor != X86_VENDOR_INTEL) |
| 363 | goto exit; | 363 | goto exit; |
| 364 | 364 | ||
| 365 | err = platform_driver_register(&coretemp_driver); | 365 | err = platform_driver_register(&coretemp_driver); |
| @@ -367,7 +367,7 @@ static int __init coretemp_init(void) | |||
| 367 | goto exit; | 367 | goto exit; |
| 368 | 368 | ||
| 369 | for_each_online_cpu(i) { | 369 | for_each_online_cpu(i) { |
| 370 | struct cpuinfo_x86 *c = &(cpu_data)[i]; | 370 | struct cpuinfo_x86 *c = &cpu_data(i); |
| 371 | 371 | ||
| 372 | /* check if family 6, models e, f, 16 */ | 372 | /* check if family 6, models e, f, 16 */ |
| 373 | if ((c->cpuid_level < 0) || (c->x86 != 0x6) || | 373 | if ((c->cpuid_level < 0) || (c->x86 != 0x6) || |
diff --git a/drivers/hwmon/hwmon-vid.c b/drivers/hwmon/hwmon-vid.c index f17e771e42f8..3330667280b9 100644 --- a/drivers/hwmon/hwmon-vid.c +++ b/drivers/hwmon/hwmon-vid.c | |||
| @@ -200,7 +200,7 @@ static u8 find_vrm(u8 eff_family, u8 eff_model, u8 eff_stepping, u8 vendor) | |||
| 200 | 200 | ||
| 201 | u8 vid_which_vrm(void) | 201 | u8 vid_which_vrm(void) |
| 202 | { | 202 | { |
| 203 | struct cpuinfo_x86 *c = cpu_data; | 203 | struct cpuinfo_x86 *c = &cpu_data(0); |
| 204 | u32 eax; | 204 | u32 eax; |
| 205 | u8 eff_family, eff_model, eff_stepping, vrm_ret; | 205 | u8 eff_family, eff_model, eff_stepping, vrm_ret; |
| 206 | 206 | ||
diff --git a/drivers/ide/Kconfig b/drivers/ide/Kconfig index 6d9fd92763f4..6eaece96524e 100644 --- a/drivers/ide/Kconfig +++ b/drivers/ide/Kconfig | |||
| @@ -1056,6 +1056,9 @@ endif | |||
| 1056 | config BLK_DEV_IDEDMA | 1056 | config BLK_DEV_IDEDMA |
| 1057 | def_bool BLK_DEV_IDEDMA_PCI || BLK_DEV_IDEDMA_PMAC || BLK_DEV_IDEDMA_ICS || BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA | 1057 | def_bool BLK_DEV_IDEDMA_PCI || BLK_DEV_IDEDMA_PMAC || BLK_DEV_IDEDMA_ICS || BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA |
| 1058 | 1058 | ||
| 1059 | config IDE_ARCH_OBSOLETE_INIT | ||
| 1060 | def_bool ALPHA || (ARM && !ARCH_L7200) || BLACKFIN || X86 || IA64 || M32R || MIPS || PARISC || PPC || (SUPERH64 && BLK_DEV_IDEPCI) || SPARC | ||
| 1061 | |||
| 1059 | endif | 1062 | endif |
| 1060 | 1063 | ||
| 1061 | config BLK_DEV_HD_ONLY | 1064 | config BLK_DEV_HD_ONLY |
diff --git a/drivers/ide/arm/bast-ide.c b/drivers/ide/arm/bast-ide.c index f7449d04114a..48db6167bb90 100644 --- a/drivers/ide/arm/bast-ide.c +++ b/drivers/ide/arm/bast-ide.c | |||
| @@ -45,7 +45,7 @@ bastide_register(unsigned int base, unsigned int aux, int irq, | |||
| 45 | hw.io_ports[IDE_CONTROL_OFFSET] = aux + (6 * 0x20); | 45 | hw.io_ports[IDE_CONTROL_OFFSET] = aux + (6 * 0x20); |
| 46 | hw.irq = irq; | 46 | hw.irq = irq; |
| 47 | 47 | ||
| 48 | ide_register_hw(&hw, 0, hwif); | 48 | ide_register_hw(&hw, NULL, 0, hwif); |
| 49 | 49 | ||
| 50 | return 0; | 50 | return 0; |
| 51 | } | 51 | } |
diff --git a/drivers/ide/arm/icside.c b/drivers/ide/arm/icside.c index 3af33fbf1f88..410a0d13e35e 100644 --- a/drivers/ide/arm/icside.c +++ b/drivers/ide/arm/icside.c | |||
| @@ -316,27 +316,29 @@ static int icside_dma_end(ide_drive_t *drive) | |||
| 316 | 316 | ||
| 317 | drive->waiting_for_dma = 0; | 317 | drive->waiting_for_dma = 0; |
| 318 | 318 | ||
| 319 | disable_dma(hwif->hw.dma); | 319 | disable_dma(state->dev->dma); |
| 320 | 320 | ||
| 321 | /* Teardown mappings after DMA has completed. */ | 321 | /* Teardown mappings after DMA has completed. */ |
| 322 | dma_unmap_sg(state->dev, hwif->sg_table, hwif->sg_nents, | 322 | dma_unmap_sg(state->dev, hwif->sg_table, hwif->sg_nents, |
| 323 | hwif->sg_dma_direction); | 323 | hwif->sg_dma_direction); |
| 324 | 324 | ||
| 325 | return get_dma_residue(hwif->hw.dma) != 0; | 325 | return get_dma_residue(state->dev->dma) != 0; |
| 326 | } | 326 | } |
| 327 | 327 | ||
| 328 | static void icside_dma_start(ide_drive_t *drive) | 328 | static void icside_dma_start(ide_drive_t *drive) |
| 329 | { | 329 | { |
| 330 | ide_hwif_t *hwif = HWIF(drive); | 330 | ide_hwif_t *hwif = HWIF(drive); |
| 331 | struct icside_state *state = hwif->hwif_data; | ||
| 331 | 332 | ||
| 332 | /* We can not enable DMA on both channels simultaneously. */ | 333 | /* We can not enable DMA on both channels simultaneously. */ |
| 333 | BUG_ON(dma_channel_active(hwif->hw.dma)); | 334 | BUG_ON(dma_channel_active(state->dev->dma)); |
| 334 | enable_dma(hwif->hw.dma); | 335 | enable_dma(state->dev->dma); |
| 335 | } | 336 | } |
| 336 | 337 | ||
| 337 | static int icside_dma_setup(ide_drive_t *drive) | 338 | static int icside_dma_setup(ide_drive_t *drive) |
| 338 | { | 339 | { |
| 339 | ide_hwif_t *hwif = HWIF(drive); | 340 | ide_hwif_t *hwif = HWIF(drive); |
| 341 | struct icside_state *state = hwif->hwif_data; | ||
| 340 | struct request *rq = hwif->hwgroup->rq; | 342 | struct request *rq = hwif->hwgroup->rq; |
| 341 | unsigned int dma_mode; | 343 | unsigned int dma_mode; |
| 342 | 344 | ||
| @@ -348,7 +350,7 @@ static int icside_dma_setup(ide_drive_t *drive) | |||
| 348 | /* | 350 | /* |
| 349 | * We can not enable DMA on both channels. | 351 | * We can not enable DMA on both channels. |
| 350 | */ | 352 | */ |
| 351 | BUG_ON(dma_channel_active(hwif->hw.dma)); | 353 | BUG_ON(dma_channel_active(state->dev->dma)); |
| 352 | 354 | ||
| 353 | icside_build_sglist(drive, rq); | 355 | icside_build_sglist(drive, rq); |
| 354 | 356 | ||
| @@ -365,14 +367,14 @@ static int icside_dma_setup(ide_drive_t *drive) | |||
| 365 | /* | 367 | /* |
| 366 | * Select the correct timing for this drive. | 368 | * Select the correct timing for this drive. |
| 367 | */ | 369 | */ |
| 368 | set_dma_speed(hwif->hw.dma, drive->drive_data); | 370 | set_dma_speed(state->dev->dma, drive->drive_data); |
| 369 | 371 | ||
| 370 | /* | 372 | /* |
| 371 | * Tell the DMA engine about the SG table and | 373 | * Tell the DMA engine about the SG table and |
| 372 | * data direction. | 374 | * data direction. |
| 373 | */ | 375 | */ |
| 374 | set_dma_sg(hwif->hw.dma, hwif->sg_table, hwif->sg_nents); | 376 | set_dma_sg(state->dev->dma, hwif->sg_table, hwif->sg_nents); |
| 375 | set_dma_mode(hwif->hw.dma, dma_mode); | 377 | set_dma_mode(state->dev->dma, dma_mode); |
| 376 | 378 | ||
| 377 | drive->waiting_for_dma = 1; | 379 | drive->waiting_for_dma = 1; |
| 378 | 380 | ||
| @@ -438,40 +440,16 @@ static void icside_dma_init(ide_hwif_t *hwif) | |||
| 438 | #define icside_dma_init(hwif) (0) | 440 | #define icside_dma_init(hwif) (0) |
| 439 | #endif | 441 | #endif |
| 440 | 442 | ||
| 441 | static ide_hwif_t *icside_find_hwif(unsigned long dataport) | ||
| 442 | { | ||
| 443 | ide_hwif_t *hwif; | ||
| 444 | int index; | ||
| 445 | |||
| 446 | for (index = 0; index < MAX_HWIFS; ++index) { | ||
| 447 | hwif = &ide_hwifs[index]; | ||
| 448 | if (hwif->io_ports[IDE_DATA_OFFSET] == dataport) | ||
| 449 | goto found; | ||
| 450 | } | ||
| 451 | |||
| 452 | for (index = 0; index < MAX_HWIFS; ++index) { | ||
| 453 | hwif = &ide_hwifs[index]; | ||
| 454 | if (!hwif->io_ports[IDE_DATA_OFFSET]) | ||
| 455 | goto found; | ||
| 456 | } | ||
| 457 | |||
| 458 | hwif = NULL; | ||
| 459 | found: | ||
| 460 | return hwif; | ||
| 461 | } | ||
| 462 | |||
| 463 | static ide_hwif_t * | 443 | static ide_hwif_t * |
| 464 | icside_setup(void __iomem *base, struct cardinfo *info, struct expansion_card *ec) | 444 | icside_setup(void __iomem *base, struct cardinfo *info, struct expansion_card *ec) |
| 465 | { | 445 | { |
| 466 | unsigned long port = (unsigned long)base + info->dataoffset; | 446 | unsigned long port = (unsigned long)base + info->dataoffset; |
| 467 | ide_hwif_t *hwif; | 447 | ide_hwif_t *hwif; |
| 468 | 448 | ||
| 469 | hwif = icside_find_hwif(port); | 449 | hwif = ide_find_port(port); |
| 470 | if (hwif) { | 450 | if (hwif) { |
| 471 | int i; | 451 | int i; |
| 472 | 452 | ||
| 473 | memset(&hwif->hw, 0, sizeof(hw_regs_t)); | ||
| 474 | |||
| 475 | /* | 453 | /* |
| 476 | * Ensure we're using MMIO | 454 | * Ensure we're using MMIO |
| 477 | */ | 455 | */ |
| @@ -479,13 +457,10 @@ icside_setup(void __iomem *base, struct cardinfo *info, struct expansion_card *e | |||
| 479 | hwif->mmio = 1; | 457 | hwif->mmio = 1; |
| 480 | 458 | ||
| 481 | for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) { | 459 | for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) { |
| 482 | hwif->hw.io_ports[i] = port; | ||
| 483 | hwif->io_ports[i] = port; | 460 | hwif->io_ports[i] = port; |
| 484 | port += 1 << info->stepping; | 461 | port += 1 << info->stepping; |
| 485 | } | 462 | } |
| 486 | hwif->hw.io_ports[IDE_CONTROL_OFFSET] = (unsigned long)base + info->ctrloffset; | ||
| 487 | hwif->io_ports[IDE_CONTROL_OFFSET] = (unsigned long)base + info->ctrloffset; | 463 | hwif->io_ports[IDE_CONTROL_OFFSET] = (unsigned long)base + info->ctrloffset; |
| 488 | hwif->hw.irq = ec->irq; | ||
| 489 | hwif->irq = ec->irq; | 464 | hwif->irq = ec->irq; |
| 490 | hwif->noprobe = 0; | 465 | hwif->noprobe = 0; |
| 491 | hwif->chipset = ide_acorn; | 466 | hwif->chipset = ide_acorn; |
| @@ -500,6 +475,7 @@ icside_register_v5(struct icside_state *state, struct expansion_card *ec) | |||
| 500 | { | 475 | { |
| 501 | ide_hwif_t *hwif; | 476 | ide_hwif_t *hwif; |
| 502 | void __iomem *base; | 477 | void __iomem *base; |
| 478 | u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; | ||
| 503 | 479 | ||
| 504 | base = ecardm_iomap(ec, ECARD_RES_MEMC, 0, 0); | 480 | base = ecardm_iomap(ec, ECARD_RES_MEMC, 0, 0); |
| 505 | if (!base) | 481 | if (!base) |
| @@ -523,9 +499,9 @@ icside_register_v5(struct icside_state *state, struct expansion_card *ec) | |||
| 523 | 499 | ||
| 524 | state->hwif[0] = hwif; | 500 | state->hwif[0] = hwif; |
| 525 | 501 | ||
| 526 | probe_hwif_init(hwif); | 502 | idx[0] = hwif->index; |
| 527 | 503 | ||
| 528 | ide_proc_register_port(hwif); | 504 | ide_device_add(idx); |
| 529 | 505 | ||
| 530 | return 0; | 506 | return 0; |
| 531 | } | 507 | } |
| @@ -537,6 +513,7 @@ icside_register_v6(struct icside_state *state, struct expansion_card *ec) | |||
| 537 | void __iomem *ioc_base, *easi_base; | 513 | void __iomem *ioc_base, *easi_base; |
| 538 | unsigned int sel = 0; | 514 | unsigned int sel = 0; |
| 539 | int ret; | 515 | int ret; |
| 516 | u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; | ||
| 540 | 517 | ||
| 541 | ioc_base = ecardm_iomap(ec, ECARD_RES_IOCFAST, 0, 0); | 518 | ioc_base = ecardm_iomap(ec, ECARD_RES_IOCFAST, 0, 0); |
| 542 | if (!ioc_base) { | 519 | if (!ioc_base) { |
| @@ -592,7 +569,6 @@ icside_register_v6(struct icside_state *state, struct expansion_card *ec) | |||
| 592 | hwif->serialized = 1; | 569 | hwif->serialized = 1; |
| 593 | hwif->config_data = (unsigned long)ioc_base; | 570 | hwif->config_data = (unsigned long)ioc_base; |
| 594 | hwif->select_data = sel; | 571 | hwif->select_data = sel; |
| 595 | hwif->hw.dma = ec->dma; | ||
| 596 | 572 | ||
| 597 | mate->maskproc = icside_maskproc; | 573 | mate->maskproc = icside_maskproc; |
| 598 | mate->channel = 1; | 574 | mate->channel = 1; |
| @@ -601,18 +577,16 @@ icside_register_v6(struct icside_state *state, struct expansion_card *ec) | |||
| 601 | mate->serialized = 1; | 577 | mate->serialized = 1; |
| 602 | mate->config_data = (unsigned long)ioc_base; | 578 | mate->config_data = (unsigned long)ioc_base; |
| 603 | mate->select_data = sel | 1; | 579 | mate->select_data = sel | 1; |
| 604 | mate->hw.dma = ec->dma; | ||
| 605 | 580 | ||
| 606 | if (ec->dma != NO_DMA && !request_dma(ec->dma, hwif->name)) { | 581 | if (ec->dma != NO_DMA && !request_dma(ec->dma, hwif->name)) { |
| 607 | icside_dma_init(hwif); | 582 | icside_dma_init(hwif); |
| 608 | icside_dma_init(mate); | 583 | icside_dma_init(mate); |
| 609 | } | 584 | } |
| 610 | 585 | ||
| 611 | probe_hwif_init(hwif); | 586 | idx[0] = hwif->index; |
| 612 | probe_hwif_init(mate); | 587 | idx[1] = mate->index; |
| 613 | 588 | ||
| 614 | ide_proc_register_port(hwif); | 589 | ide_device_add(idx); |
| 615 | ide_proc_register_port(mate); | ||
| 616 | 590 | ||
| 617 | return 0; | 591 | return 0; |
| 618 | 592 | ||
diff --git a/drivers/ide/arm/ide_arm.c b/drivers/ide/arm/ide_arm.c index bce2bec81413..8957cbadf5c2 100644 --- a/drivers/ide/arm/ide_arm.c +++ b/drivers/ide/arm/ide_arm.c | |||
| @@ -31,5 +31,5 @@ void __init ide_arm_init(void) | |||
| 31 | memset(&hw, 0, sizeof(hw)); | 31 | memset(&hw, 0, sizeof(hw)); |
| 32 | ide_std_init_ports(&hw, IDE_ARM_IO, IDE_ARM_IO + 0x206); | 32 | ide_std_init_ports(&hw, IDE_ARM_IO, IDE_ARM_IO + 0x206); |
| 33 | hw.irq = IDE_ARM_IRQ; | 33 | hw.irq = IDE_ARM_IRQ; |
| 34 | ide_register_hw(&hw, 1, NULL); | 34 | ide_register_hw(&hw, NULL, 1, NULL); |
| 35 | } | 35 | } |
diff --git a/drivers/ide/arm/rapide.c b/drivers/ide/arm/rapide.c index 83811af11610..0775a3afef48 100644 --- a/drivers/ide/arm/rapide.c +++ b/drivers/ide/arm/rapide.c | |||
| @@ -13,42 +13,25 @@ | |||
| 13 | 13 | ||
| 14 | #include <asm/ecard.h> | 14 | #include <asm/ecard.h> |
| 15 | 15 | ||
| 16 | /* | ||
| 17 | * Something like this really should be in generic code, but isn't. | ||
| 18 | */ | ||
| 19 | static ide_hwif_t * | 16 | static ide_hwif_t * |
| 20 | rapide_locate_hwif(void __iomem *base, void __iomem *ctrl, unsigned int sz, int irq) | 17 | rapide_locate_hwif(void __iomem *base, void __iomem *ctrl, unsigned int sz, int irq) |
| 21 | { | 18 | { |
| 22 | unsigned long port = (unsigned long)base; | 19 | unsigned long port = (unsigned long)base; |
| 23 | ide_hwif_t *hwif; | 20 | ide_hwif_t *hwif = ide_find_port(port); |
| 24 | int index, i; | 21 | int i; |
| 25 | |||
| 26 | for (index = 0; index < MAX_HWIFS; ++index) { | ||
| 27 | hwif = ide_hwifs + index; | ||
| 28 | if (hwif->io_ports[IDE_DATA_OFFSET] == port) | ||
| 29 | goto found; | ||
| 30 | } | ||
| 31 | |||
| 32 | for (index = 0; index < MAX_HWIFS; ++index) { | ||
| 33 | hwif = ide_hwifs + index; | ||
| 34 | if (hwif->io_ports[IDE_DATA_OFFSET] == 0) | ||
| 35 | goto found; | ||
| 36 | } | ||
| 37 | 22 | ||
| 38 | return NULL; | 23 | if (hwif == NULL) |
| 24 | goto out; | ||
| 39 | 25 | ||
| 40 | found: | ||
| 41 | for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) { | 26 | for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) { |
| 42 | hwif->hw.io_ports[i] = port; | ||
| 43 | hwif->io_ports[i] = port; | 27 | hwif->io_ports[i] = port; |
| 44 | port += sz; | 28 | port += sz; |
| 45 | } | 29 | } |
| 46 | hwif->hw.io_ports[IDE_CONTROL_OFFSET] = (unsigned long)ctrl; | ||
| 47 | hwif->io_ports[IDE_CONTROL_OFFSET] = (unsigned long)ctrl; | 30 | hwif->io_ports[IDE_CONTROL_OFFSET] = (unsigned long)ctrl; |
| 48 | hwif->hw.irq = hwif->irq = irq; | 31 | hwif->irq = irq; |
| 49 | hwif->mmio = 1; | 32 | hwif->mmio = 1; |
| 50 | default_hwif_mmiops(hwif); | 33 | default_hwif_mmiops(hwif); |
| 51 | 34 | out: | |
| 52 | return hwif; | 35 | return hwif; |
| 53 | } | 36 | } |
| 54 | 37 | ||
| @@ -58,6 +41,7 @@ rapide_probe(struct expansion_card *ec, const struct ecard_id *id) | |||
| 58 | ide_hwif_t *hwif; | 41 | ide_hwif_t *hwif; |
| 59 | void __iomem *base; | 42 | void __iomem *base; |
| 60 | int ret; | 43 | int ret; |
| 44 | u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; | ||
| 61 | 45 | ||
| 62 | ret = ecard_request_resources(ec); | 46 | ret = ecard_request_resources(ec); |
| 63 | if (ret) | 47 | if (ret) |
| @@ -74,8 +58,11 @@ rapide_probe(struct expansion_card *ec, const struct ecard_id *id) | |||
| 74 | hwif->hwif_data = base; | 58 | hwif->hwif_data = base; |
| 75 | hwif->gendev.parent = &ec->dev; | 59 | hwif->gendev.parent = &ec->dev; |
| 76 | hwif->noprobe = 0; | 60 | hwif->noprobe = 0; |
| 77 | probe_hwif_init(hwif); | 61 | |
| 78 | ide_proc_register_port(hwif); | 62 | idx[0] = hwif->index; |
| 63 | |||
| 64 | ide_device_add(idx); | ||
| 65 | |||
| 79 | ecard_set_drvdata(ec, hwif); | 66 | ecard_set_drvdata(ec, hwif); |
| 80 | goto out; | 67 | goto out; |
| 81 | } | 68 | } |
diff --git a/drivers/ide/cris/ide-cris.c b/drivers/ide/cris/ide-cris.c index 9a96a10ba9d3..ff20377b4c82 100644 --- a/drivers/ide/cris/ide-cris.c +++ b/drivers/ide/cris/ide-cris.c | |||
| @@ -782,7 +782,7 @@ init_e100_ide (void) | |||
| 782 | ide_offsets, | 782 | ide_offsets, |
| 783 | 0, 0, cris_ide_ack_intr, | 783 | 0, 0, cris_ide_ack_intr, |
| 784 | ide_default_irq(0)); | 784 | ide_default_irq(0)); |
| 785 | ide_register_hw(&hw, 1, &hwif); | 785 | ide_register_hw(&hw, NULL, 1, &hwif); |
| 786 | hwif->mmio = 1; | 786 | hwif->mmio = 1; |
| 787 | hwif->chipset = ide_etrax100; | 787 | hwif->chipset = ide_etrax100; |
| 788 | hwif->set_pio_mode = &cris_set_pio_mode; | 788 | hwif->set_pio_mode = &cris_set_pio_mode; |
diff --git a/drivers/ide/h8300/ide-h8300.c b/drivers/ide/h8300/ide-h8300.c index 6d26ad7360d5..4a49b5c59acb 100644 --- a/drivers/ide/h8300/ide-h8300.c +++ b/drivers/ide/h8300/ide-h8300.c | |||
| @@ -68,7 +68,6 @@ static inline void hw_setup(hw_regs_t *hw) | |||
| 68 | hw->io_ports[i] = CONFIG_H8300_IDE_BASE + H8300_IDE_GAP*i; | 68 | hw->io_ports[i] = CONFIG_H8300_IDE_BASE + H8300_IDE_GAP*i; |
| 69 | hw->io_ports[IDE_CONTROL_OFFSET] = CONFIG_H8300_IDE_ALT; | 69 | hw->io_ports[IDE_CONTROL_OFFSET] = CONFIG_H8300_IDE_ALT; |
| 70 | hw->irq = EXT_IRQ0 + CONFIG_H8300_IDE_IRQ; | 70 | hw->irq = EXT_IRQ0 + CONFIG_H8300_IDE_IRQ; |
| 71 | hw->dma = NO_DMA; | ||
| 72 | hw->chipset = ide_generic; | 71 | hw->chipset = ide_generic; |
| 73 | } | 72 | } |
| 74 | 73 | ||
| @@ -101,7 +100,7 @@ void __init h8300_ide_init(void) | |||
| 101 | hw_setup(&hw); | 100 | hw_setup(&hw); |
| 102 | 101 | ||
| 103 | /* register if */ | 102 | /* register if */ |
| 104 | idx = ide_register_hw(&hw, 1, &hwif); | 103 | idx = ide_register_hw(&hw, NULL, 1, &hwif); |
| 105 | if (idx == -1) { | 104 | if (idx == -1) { |
| 106 | printk(KERN_ERR "ide-h8300: IDE I/F register failed\n"); | 105 | printk(KERN_ERR "ide-h8300: IDE I/F register failed\n"); |
| 107 | return; | 106 | return; |
diff --git a/drivers/ide/ide-acpi.c b/drivers/ide/ide-acpi.c index 1d5f6823101c..89df48fdc69d 100644 --- a/drivers/ide/ide-acpi.c +++ b/drivers/ide/ide-acpi.c | |||
| @@ -350,7 +350,7 @@ static int taskfile_load_raw(ide_drive_t *drive, | |||
| 350 | 350 | ||
| 351 | memset(&args, 0, sizeof(ide_task_t)); | 351 | memset(&args, 0, sizeof(ide_task_t)); |
| 352 | args.command_type = IDE_DRIVE_TASK_NO_DATA; | 352 | args.command_type = IDE_DRIVE_TASK_NO_DATA; |
| 353 | args.data_phase = TASKFILE_IN; | 353 | args.data_phase = TASKFILE_NO_DATA; |
| 354 | args.handler = &task_no_data_intr; | 354 | args.handler = &task_no_data_intr; |
| 355 | 355 | ||
| 356 | /* convert gtf to IDE Taskfile */ | 356 | /* convert gtf to IDE Taskfile */ |
diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c index 2722d9165b6b..00123d99527a 100644 --- a/drivers/ide/ide-disk.c +++ b/drivers/ide/ide-disk.c | |||
| @@ -593,28 +593,12 @@ static int smart_enable(ide_drive_t *drive) | |||
| 593 | return ide_raw_taskfile(drive, &args, NULL); | 593 | return ide_raw_taskfile(drive, &args, NULL); |
| 594 | } | 594 | } |
| 595 | 595 | ||
| 596 | static int get_smart_values(ide_drive_t *drive, u8 *buf) | 596 | static int get_smart_data(ide_drive_t *drive, u8 *buf, u8 sub_cmd) |
| 597 | { | 597 | { |
| 598 | ide_task_t args; | 598 | ide_task_t args; |
| 599 | 599 | ||
| 600 | memset(&args, 0, sizeof(ide_task_t)); | 600 | memset(&args, 0, sizeof(ide_task_t)); |
| 601 | args.tfRegister[IDE_FEATURE_OFFSET] = SMART_READ_VALUES; | 601 | args.tfRegister[IDE_FEATURE_OFFSET] = sub_cmd; |
| 602 | args.tfRegister[IDE_NSECTOR_OFFSET] = 0x01; | ||
| 603 | args.tfRegister[IDE_LCYL_OFFSET] = SMART_LCYL_PASS; | ||
| 604 | args.tfRegister[IDE_HCYL_OFFSET] = SMART_HCYL_PASS; | ||
| 605 | args.tfRegister[IDE_COMMAND_OFFSET] = WIN_SMART; | ||
| 606 | args.command_type = IDE_DRIVE_TASK_IN; | ||
| 607 | args.data_phase = TASKFILE_IN; | ||
| 608 | args.handler = &task_in_intr; | ||
| 609 | (void) smart_enable(drive); | ||
| 610 | return ide_raw_taskfile(drive, &args, buf); | ||
| 611 | } | ||
| 612 | |||
| 613 | static int get_smart_thresholds(ide_drive_t *drive, u8 *buf) | ||
| 614 | { | ||
| 615 | ide_task_t args; | ||
| 616 | memset(&args, 0, sizeof(ide_task_t)); | ||
| 617 | args.tfRegister[IDE_FEATURE_OFFSET] = SMART_READ_THRESHOLDS; | ||
| 618 | args.tfRegister[IDE_NSECTOR_OFFSET] = 0x01; | 602 | args.tfRegister[IDE_NSECTOR_OFFSET] = 0x01; |
| 619 | args.tfRegister[IDE_LCYL_OFFSET] = SMART_LCYL_PASS; | 603 | args.tfRegister[IDE_LCYL_OFFSET] = SMART_LCYL_PASS; |
| 620 | args.tfRegister[IDE_HCYL_OFFSET] = SMART_HCYL_PASS; | 604 | args.tfRegister[IDE_HCYL_OFFSET] = SMART_HCYL_PASS; |
| @@ -656,7 +640,7 @@ static int proc_idedisk_read_smart_thresholds | |||
| 656 | ide_drive_t *drive = (ide_drive_t *)data; | 640 | ide_drive_t *drive = (ide_drive_t *)data; |
| 657 | int len = 0, i = 0; | 641 | int len = 0, i = 0; |
| 658 | 642 | ||
| 659 | if (!get_smart_thresholds(drive, page)) { | 643 | if (get_smart_data(drive, page, SMART_READ_THRESHOLDS) == 0) { |
| 660 | unsigned short *val = (unsigned short *) page; | 644 | unsigned short *val = (unsigned short *) page; |
| 661 | char *out = ((char *)val) + (SECTOR_WORDS * 4); | 645 | char *out = ((char *)val) + (SECTOR_WORDS * 4); |
| 662 | page = out; | 646 | page = out; |
| @@ -675,7 +659,7 @@ static int proc_idedisk_read_smart_values | |||
| 675 | ide_drive_t *drive = (ide_drive_t *)data; | 659 | ide_drive_t *drive = (ide_drive_t *)data; |
| 676 | int len = 0, i = 0; | 660 | int len = 0, i = 0; |
| 677 | 661 | ||
| 678 | if (!get_smart_values(drive, page)) { | 662 | if (get_smart_data(drive, page, SMART_READ_VALUES) == 0) { |
| 679 | unsigned short *val = (unsigned short *) page; | 663 | unsigned short *val = (unsigned short *) page; |
| 680 | char *out = ((char *)val) + (SECTOR_WORDS * 4); | 664 | char *out = ((char *)val) + (SECTOR_WORDS * 4); |
| 681 | page = out; | 665 | page = out; |
diff --git a/drivers/ide/ide-dma.c b/drivers/ide/ide-dma.c index 80b4f17f3941..428f7a8a00b6 100644 --- a/drivers/ide/ide-dma.c +++ b/drivers/ide/ide-dma.c | |||
| @@ -901,10 +901,7 @@ void ide_dma_timeout (ide_drive_t *drive) | |||
| 901 | 901 | ||
| 902 | EXPORT_SYMBOL(ide_dma_timeout); | 902 | EXPORT_SYMBOL(ide_dma_timeout); |
| 903 | 903 | ||
| 904 | /* | 904 | static void ide_release_dma_engine(ide_hwif_t *hwif) |
| 905 | * Needed for allowing full modular support of ide-driver | ||
| 906 | */ | ||
| 907 | static int ide_release_dma_engine(ide_hwif_t *hwif) | ||
| 908 | { | 905 | { |
| 909 | if (hwif->dmatable_cpu) { | 906 | if (hwif->dmatable_cpu) { |
| 910 | pci_free_consistent(hwif->pci_dev, | 907 | pci_free_consistent(hwif->pci_dev, |
| @@ -913,7 +910,6 @@ static int ide_release_dma_engine(ide_hwif_t *hwif) | |||
| 913 | hwif->dmatable_dma); | 910 | hwif->dmatable_dma); |
| 914 | hwif->dmatable_cpu = NULL; | 911 | hwif->dmatable_cpu = NULL; |
| 915 | } | 912 | } |
| 916 | return 1; | ||
| 917 | } | 913 | } |
| 918 | 914 | ||
| 919 | static int ide_release_iomio_dma(ide_hwif_t *hwif) | 915 | 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 | |||
| 956 | { | 952 | { |
| 957 | printk(KERN_INFO " %s: MMIO-DMA ", hwif->name); | 953 | printk(KERN_INFO " %s: MMIO-DMA ", hwif->name); |
| 958 | 954 | ||
| 959 | hwif->dma_base = base; | ||
| 960 | |||
| 961 | if(hwif->mate) | ||
| 962 | hwif->dma_master = (hwif->channel) ? hwif->mate->dma_base : base; | ||
| 963 | else | ||
| 964 | hwif->dma_master = base; | ||
| 965 | return 0; | 955 | return 0; |
| 966 | } | 956 | } |
| 967 | 957 | ||
| @@ -975,8 +965,6 @@ static int ide_iomio_dma(ide_hwif_t *hwif, unsigned long base, unsigned int port | |||
| 975 | return 1; | 965 | return 1; |
| 976 | } | 966 | } |
| 977 | 967 | ||
| 978 | hwif->dma_base = base; | ||
| 979 | |||
| 980 | if (hwif->cds->extra) { | 968 | if (hwif->cds->extra) { |
| 981 | hwif->extra_base = base + (hwif->channel ? 8 : 16); | 969 | hwif->extra_base = base + (hwif->channel ? 8 : 16); |
| 982 | 970 | ||
| @@ -991,10 +979,6 @@ static int ide_iomio_dma(ide_hwif_t *hwif, unsigned long base, unsigned int port | |||
| 991 | } | 979 | } |
| 992 | } | 980 | } |
| 993 | 981 | ||
| 994 | if(hwif->mate) | ||
| 995 | hwif->dma_master = (hwif->channel) ? hwif->mate->dma_base:base; | ||
| 996 | else | ||
| 997 | hwif->dma_master = base; | ||
| 998 | return 0; | 982 | return 0; |
| 999 | } | 983 | } |
| 1000 | 984 | ||
| @@ -1006,12 +990,9 @@ static int ide_dma_iobase(ide_hwif_t *hwif, unsigned long base, unsigned int por | |||
| 1006 | return ide_iomio_dma(hwif, base, ports); | 990 | return ide_iomio_dma(hwif, base, ports); |
| 1007 | } | 991 | } |
| 1008 | 992 | ||
| 1009 | /* | 993 | void ide_setup_dma(ide_hwif_t *hwif, unsigned long base, unsigned num_ports) |
| 1010 | * This can be called for a dynamically installed interface. Don't __init it | ||
| 1011 | */ | ||
| 1012 | void ide_setup_dma (ide_hwif_t *hwif, unsigned long dma_base, unsigned int num_ports) | ||
| 1013 | { | 994 | { |
| 1014 | if (ide_dma_iobase(hwif, dma_base, num_ports)) | 995 | if (ide_dma_iobase(hwif, base, num_ports)) |
| 1015 | return; | 996 | return; |
| 1016 | 997 | ||
| 1017 | if (ide_allocate_dma_engine(hwif)) { | 998 | 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 | |||
| 1019 | return; | 1000 | return; |
| 1020 | } | 1001 | } |
| 1021 | 1002 | ||
| 1003 | hwif->dma_base = base; | ||
| 1004 | |||
| 1005 | if (hwif->mate) | ||
| 1006 | hwif->dma_master = hwif->channel ? hwif->mate->dma_base : base; | ||
| 1007 | else | ||
| 1008 | hwif->dma_master = base; | ||
| 1009 | |||
| 1022 | if (!(hwif->dma_command)) | 1010 | if (!(hwif->dma_command)) |
| 1023 | hwif->dma_command = hwif->dma_base; | 1011 | hwif->dma_command = hwif->dma_base; |
| 1024 | if (!(hwif->dma_vendor1)) | 1012 | if (!(hwif->dma_vendor1)) |
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c index 32eaa3f80515..c89f0d3058e9 100644 --- a/drivers/ide/ide-io.c +++ b/drivers/ide/ide-io.c | |||
| @@ -55,7 +55,7 @@ | |||
| 55 | #include <asm/io.h> | 55 | #include <asm/io.h> |
| 56 | 56 | ||
| 57 | static int __ide_end_request(ide_drive_t *drive, struct request *rq, | 57 | static int __ide_end_request(ide_drive_t *drive, struct request *rq, |
| 58 | int uptodate, unsigned int nr_bytes) | 58 | int uptodate, unsigned int nr_bytes, int dequeue) |
| 59 | { | 59 | { |
| 60 | int ret = 1; | 60 | int ret = 1; |
| 61 | 61 | ||
| @@ -80,9 +80,11 @@ static int __ide_end_request(ide_drive_t *drive, struct request *rq, | |||
| 80 | 80 | ||
| 81 | if (!end_that_request_chunk(rq, uptodate, nr_bytes)) { | 81 | if (!end_that_request_chunk(rq, uptodate, nr_bytes)) { |
| 82 | add_disk_randomness(rq->rq_disk); | 82 | add_disk_randomness(rq->rq_disk); |
| 83 | if (!list_empty(&rq->queuelist)) | 83 | if (dequeue) { |
| 84 | blkdev_dequeue_request(rq); | 84 | if (!list_empty(&rq->queuelist)) |
| 85 | HWGROUP(drive)->rq = NULL; | 85 | blkdev_dequeue_request(rq); |
| 86 | HWGROUP(drive)->rq = NULL; | ||
| 87 | } | ||
| 86 | end_that_request_last(rq, uptodate); | 88 | end_that_request_last(rq, uptodate); |
| 87 | ret = 0; | 89 | ret = 0; |
| 88 | } | 90 | } |
| @@ -122,7 +124,7 @@ int ide_end_request (ide_drive_t *drive, int uptodate, int nr_sectors) | |||
| 122 | nr_bytes = rq->hard_cur_sectors << 9; | 124 | nr_bytes = rq->hard_cur_sectors << 9; |
| 123 | } | 125 | } |
| 124 | 126 | ||
| 125 | ret = __ide_end_request(drive, rq, uptodate, nr_bytes); | 127 | ret = __ide_end_request(drive, rq, uptodate, nr_bytes, 1); |
| 126 | 128 | ||
| 127 | spin_unlock_irqrestore(&ide_lock, flags); | 129 | spin_unlock_irqrestore(&ide_lock, flags); |
| 128 | return ret; | 130 | return ret; |
| @@ -255,39 +257,13 @@ int ide_end_dequeued_request(ide_drive_t *drive, struct request *rq, | |||
| 255 | int uptodate, int nr_sectors) | 257 | int uptodate, int nr_sectors) |
| 256 | { | 258 | { |
| 257 | unsigned long flags; | 259 | unsigned long flags; |
| 258 | int ret = 1; | 260 | int ret; |
| 259 | 261 | ||
| 260 | spin_lock_irqsave(&ide_lock, flags); | 262 | spin_lock_irqsave(&ide_lock, flags); |
| 261 | |||
| 262 | BUG_ON(!blk_rq_started(rq)); | 263 | BUG_ON(!blk_rq_started(rq)); |
| 263 | 264 | ret = __ide_end_request(drive, rq, uptodate, nr_sectors << 9, 0); | |
| 264 | /* | ||
| 265 | * if failfast is set on a request, override number of sectors and | ||
| 266 | * complete the whole request right now | ||
| 267 | */ | ||
| 268 | if (blk_noretry_request(rq) && end_io_error(uptodate)) | ||
| 269 | nr_sectors = rq->hard_nr_sectors; | ||
| 270 | |||
| 271 | if (!blk_fs_request(rq) && end_io_error(uptodate) && !rq->errors) | ||
| 272 | rq->errors = -EIO; | ||
| 273 | |||
| 274 | /* | ||
| 275 | * decide whether to reenable DMA -- 3 is a random magic for now, | ||
| 276 | * if we DMA timeout more than 3 times, just stay in PIO | ||
| 277 | */ | ||
| 278 | if (drive->state == DMA_PIO_RETRY && drive->retry_pio <= 3) { | ||
| 279 | drive->state = 0; | ||
| 280 | HWGROUP(drive)->hwif->ide_dma_on(drive); | ||
| 281 | } | ||
| 282 | |||
| 283 | if (!end_that_request_first(rq, uptodate, nr_sectors)) { | ||
| 284 | add_disk_randomness(rq->rq_disk); | ||
| 285 | if (blk_rq_tagged(rq)) | ||
| 286 | blk_queue_end_tag(drive->queue, rq); | ||
| 287 | end_that_request_last(rq, uptodate); | ||
| 288 | ret = 0; | ||
| 289 | } | ||
| 290 | spin_unlock_irqrestore(&ide_lock, flags); | 265 | spin_unlock_irqrestore(&ide_lock, flags); |
| 266 | |||
| 291 | return ret; | 267 | return ret; |
| 292 | } | 268 | } |
| 293 | EXPORT_SYMBOL_GPL(ide_end_dequeued_request); | 269 | EXPORT_SYMBOL_GPL(ide_end_dequeued_request); |
| @@ -800,7 +776,20 @@ static ide_startstop_t do_special (ide_drive_t *drive) | |||
| 800 | s->b.set_tune = 0; | 776 | s->b.set_tune = 0; |
| 801 | 777 | ||
| 802 | if (set_pio_mode_abuse(drive->hwif, req_pio)) { | 778 | if (set_pio_mode_abuse(drive->hwif, req_pio)) { |
| 803 | if (hwif->set_pio_mode) | 779 | |
| 780 | if (hwif->set_pio_mode == NULL) | ||
| 781 | return ide_stopped; | ||
| 782 | |||
| 783 | /* | ||
| 784 | * take ide_lock for drive->[no_]unmask/[no_]io_32bit | ||
| 785 | */ | ||
| 786 | if (req_pio == 8 || req_pio == 9) { | ||
| 787 | unsigned long flags; | ||
| 788 | |||
| 789 | spin_lock_irqsave(&ide_lock, flags); | ||
| 790 | hwif->set_pio_mode(drive, req_pio); | ||
| 791 | spin_unlock_irqrestore(&ide_lock, flags); | ||
| 792 | } else | ||
| 804 | hwif->set_pio_mode(drive, req_pio); | 793 | hwif->set_pio_mode(drive, req_pio); |
| 805 | } else { | 794 | } else { |
| 806 | int keep_dma = drive->using_dma; | 795 | int keep_dma = drive->using_dma; |
diff --git a/drivers/ide/ide-iops.c b/drivers/ide/ide-iops.c index d4d790f91f91..95168833d069 100644 --- a/drivers/ide/ide-iops.c +++ b/drivers/ide/ide-iops.c | |||
| @@ -693,35 +693,16 @@ static u8 ide_auto_reduce_xfer (ide_drive_t *drive) | |||
| 693 | } | 693 | } |
| 694 | #endif /* CONFIG_BLK_DEV_IDEDMA */ | 694 | #endif /* CONFIG_BLK_DEV_IDEDMA */ |
| 695 | 695 | ||
| 696 | /* | 696 | int ide_driveid_update(ide_drive_t *drive) |
| 697 | * Update the | ||
| 698 | */ | ||
| 699 | int ide_driveid_update (ide_drive_t *drive) | ||
| 700 | { | 697 | { |
| 701 | ide_hwif_t *hwif = HWIF(drive); | 698 | ide_hwif_t *hwif = drive->hwif; |
| 702 | struct hd_driveid *id; | 699 | struct hd_driveid *id; |
| 703 | #if 0 | 700 | unsigned long timeout, flags; |
| 704 | id = kmalloc(SECTOR_WORDS*4, GFP_ATOMIC); | ||
| 705 | if (!id) | ||
| 706 | return 0; | ||
| 707 | |||
| 708 | taskfile_lib_get_identify(drive, (char *)&id); | ||
| 709 | 701 | ||
| 710 | ide_fix_driveid(id); | ||
| 711 | if (id) { | ||
| 712 | drive->id->dma_ultra = id->dma_ultra; | ||
| 713 | drive->id->dma_mword = id->dma_mword; | ||
| 714 | drive->id->dma_1word = id->dma_1word; | ||
| 715 | /* anything more ? */ | ||
| 716 | kfree(id); | ||
| 717 | } | ||
| 718 | return 1; | ||
| 719 | #else | ||
| 720 | /* | 702 | /* |
| 721 | * Re-read drive->id for possible DMA mode | 703 | * Re-read drive->id for possible DMA mode |
| 722 | * change (copied from ide-probe.c) | 704 | * change (copied from ide-probe.c) |
| 723 | */ | 705 | */ |
| 724 | unsigned long timeout, flags; | ||
| 725 | 706 | ||
| 726 | SELECT_MASK(drive, 1); | 707 | SELECT_MASK(drive, 1); |
| 727 | if (IDE_CONTROL_REG) | 708 | if (IDE_CONTROL_REG) |
| @@ -763,7 +744,6 @@ int ide_driveid_update (ide_drive_t *drive) | |||
| 763 | } | 744 | } |
| 764 | 745 | ||
| 765 | return 1; | 746 | return 1; |
| 766 | #endif | ||
| 767 | } | 747 | } |
| 768 | 748 | ||
| 769 | int ide_config_drive_speed(ide_drive_t *drive, u8 speed) | 749 | int ide_config_drive_speed(ide_drive_t *drive, u8 speed) |
diff --git a/drivers/ide/ide-pnp.c b/drivers/ide/ide-pnp.c index 2b8009c50e91..e245521af7b5 100644 --- a/drivers/ide/ide-pnp.c +++ b/drivers/ide/ide-pnp.c | |||
| @@ -40,9 +40,8 @@ static int idepnp_probe(struct pnp_dev * dev, const struct pnp_device_id *dev_id | |||
| 40 | ide_std_init_ports(&hw, pnp_port_start(dev, 0), | 40 | ide_std_init_ports(&hw, pnp_port_start(dev, 0), |
| 41 | pnp_port_start(dev, 1)); | 41 | pnp_port_start(dev, 1)); |
| 42 | hw.irq = pnp_irq(dev, 0); | 42 | hw.irq = pnp_irq(dev, 0); |
| 43 | hw.dma = NO_DMA; | ||
| 44 | 43 | ||
| 45 | index = ide_register_hw(&hw, 1, &hwif); | 44 | index = ide_register_hw(&hw, NULL, 1, &hwif); |
| 46 | 45 | ||
| 47 | if (index != -1) { | 46 | if (index != -1) { |
| 48 | printk(KERN_INFO "ide%d: generic PnP IDE interface\n", index); | 47 | printk(KERN_INFO "ide%d: generic PnP IDE interface\n", index); |
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c index e294c7415c27..d5146c57e5b3 100644 --- a/drivers/ide/ide-probe.c +++ b/drivers/ide/ide-probe.c | |||
| @@ -717,7 +717,7 @@ EXPORT_SYMBOL_GPL(ide_undecoded_slave); | |||
| 717 | * This routine only knows how to look for drive units 0 and 1 | 717 | * This routine only knows how to look for drive units 0 and 1 |
| 718 | * on an interface, so any setting of MAX_DRIVES > 2 won't work here. | 718 | * on an interface, so any setting of MAX_DRIVES > 2 won't work here. |
| 719 | */ | 719 | */ |
| 720 | static void probe_hwif(ide_hwif_t *hwif, void (*fixup)(ide_hwif_t *hwif)) | 720 | static void probe_hwif(ide_hwif_t *hwif) |
| 721 | { | 721 | { |
| 722 | unsigned long flags; | 722 | unsigned long flags; |
| 723 | unsigned int irqd; | 723 | unsigned int irqd; |
| @@ -819,8 +819,8 @@ static void probe_hwif(ide_hwif_t *hwif, void (*fixup)(ide_hwif_t *hwif)) | |||
| 819 | return; | 819 | return; |
| 820 | } | 820 | } |
| 821 | 821 | ||
| 822 | if (fixup) | 822 | if (hwif->fixup) |
| 823 | fixup(hwif); | 823 | hwif->fixup(hwif); |
| 824 | 824 | ||
| 825 | for (unit = 0; unit < MAX_DRIVES; ++unit) { | 825 | for (unit = 0; unit < MAX_DRIVES; ++unit) { |
| 826 | ide_drive_t *drive = &hwif->drives[unit]; | 826 | 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)) | |||
| 859 | } | 859 | } |
| 860 | 860 | ||
| 861 | static int hwif_init(ide_hwif_t *hwif); | 861 | static int hwif_init(ide_hwif_t *hwif); |
| 862 | static void hwif_register_devices(ide_hwif_t *hwif); | ||
| 862 | 863 | ||
| 863 | int probe_hwif_init_with_fixup(ide_hwif_t *hwif, void (*fixup)(ide_hwif_t *hwif)) | 864 | static int probe_hwif_init(ide_hwif_t *hwif) |
| 864 | { | 865 | { |
| 865 | probe_hwif(hwif, fixup); | 866 | probe_hwif(hwif); |
| 866 | 867 | ||
| 867 | if (!hwif_init(hwif)) { | 868 | if (!hwif_init(hwif)) { |
| 868 | printk(KERN_INFO "%s: failed to initialize IDE interface\n", | 869 | 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) | |||
| 870 | return -1; | 871 | return -1; |
| 871 | } | 872 | } |
| 872 | 873 | ||
| 873 | if (hwif->present) { | 874 | if (hwif->present) |
| 874 | u16 unit = 0; | 875 | hwif_register_devices(hwif); |
| 875 | int ret; | ||
| 876 | 876 | ||
| 877 | for (unit = 0; unit < MAX_DRIVES; ++unit) { | ||
| 878 | ide_drive_t *drive = &hwif->drives[unit]; | ||
| 879 | /* For now don't attach absent drives, we may | ||
| 880 | want them on default or a new "empty" class | ||
| 881 | for hotplug reprobing ? */ | ||
| 882 | if (drive->present) { | ||
| 883 | ret = device_register(&drive->gendev); | ||
| 884 | if (ret < 0) | ||
| 885 | printk(KERN_WARNING "IDE: %s: " | ||
| 886 | "device_register error: %d\n", | ||
| 887 | __FUNCTION__, ret); | ||
| 888 | } | ||
| 889 | } | ||
| 890 | } | ||
| 891 | return 0; | 877 | return 0; |
| 892 | } | 878 | } |
| 893 | 879 | ||
| 894 | int probe_hwif_init(ide_hwif_t *hwif) | ||
| 895 | { | ||
| 896 | return probe_hwif_init_with_fixup(hwif, NULL); | ||
| 897 | } | ||
| 898 | |||
| 899 | EXPORT_SYMBOL(probe_hwif_init); | ||
| 900 | |||
| 901 | #if MAX_HWIFS > 1 | 880 | #if MAX_HWIFS > 1 |
| 902 | /* | 881 | /* |
| 903 | * save_match() is used to simplify logic in init_irq() below. | 882 | * save_match() is used to simplify logic in init_irq() below. |
| @@ -1379,6 +1358,24 @@ out: | |||
| 1379 | return 0; | 1358 | return 0; |
| 1380 | } | 1359 | } |
| 1381 | 1360 | ||
| 1361 | static void hwif_register_devices(ide_hwif_t *hwif) | ||
| 1362 | { | ||
| 1363 | unsigned int i; | ||
| 1364 | |||
| 1365 | for (i = 0; i < MAX_DRIVES; i++) { | ||
| 1366 | ide_drive_t *drive = &hwif->drives[i]; | ||
| 1367 | |||
| 1368 | if (drive->present) { | ||
| 1369 | int ret = device_register(&drive->gendev); | ||
| 1370 | |||
| 1371 | if (ret < 0) | ||
| 1372 | printk(KERN_WARNING "IDE: %s: " | ||
| 1373 | "device_register error: %d\n", | ||
| 1374 | __FUNCTION__, ret); | ||
| 1375 | } | ||
| 1376 | } | ||
| 1377 | } | ||
| 1378 | |||
| 1382 | int ideprobe_init (void) | 1379 | int ideprobe_init (void) |
| 1383 | { | 1380 | { |
| 1384 | unsigned int index; | 1381 | unsigned int index; |
| @@ -1390,27 +1387,18 @@ int ideprobe_init (void) | |||
| 1390 | 1387 | ||
| 1391 | for (index = 0; index < MAX_HWIFS; ++index) | 1388 | for (index = 0; index < MAX_HWIFS; ++index) |
| 1392 | if (probe[index]) | 1389 | if (probe[index]) |
| 1393 | probe_hwif(&ide_hwifs[index], NULL); | 1390 | probe_hwif(&ide_hwifs[index]); |
| 1394 | for (index = 0; index < MAX_HWIFS; ++index) | 1391 | for (index = 0; index < MAX_HWIFS; ++index) |
| 1395 | if (probe[index]) | 1392 | if (probe[index]) |
| 1396 | hwif_init(&ide_hwifs[index]); | 1393 | hwif_init(&ide_hwifs[index]); |
| 1397 | for (index = 0; index < MAX_HWIFS; ++index) { | 1394 | for (index = 0; index < MAX_HWIFS; ++index) { |
| 1398 | if (probe[index]) { | 1395 | if (probe[index]) { |
| 1399 | ide_hwif_t *hwif = &ide_hwifs[index]; | 1396 | ide_hwif_t *hwif = &ide_hwifs[index]; |
| 1400 | int unit; | ||
| 1401 | if (!hwif->present) | 1397 | if (!hwif->present) |
| 1402 | continue; | 1398 | continue; |
| 1403 | if (hwif->chipset == ide_unknown || hwif->chipset == ide_forced) | 1399 | if (hwif->chipset == ide_unknown || hwif->chipset == ide_forced) |
| 1404 | hwif->chipset = ide_generic; | 1400 | hwif->chipset = ide_generic; |
| 1405 | for (unit = 0; unit < MAX_DRIVES; ++unit) | 1401 | hwif_register_devices(hwif); |
| 1406 | if (hwif->drives[unit].present) { | ||
| 1407 | int ret = device_register( | ||
| 1408 | &hwif->drives[unit].gendev); | ||
| 1409 | if (ret < 0) | ||
| 1410 | printk(KERN_WARNING "IDE: %s: " | ||
| 1411 | "device_register error: %d\n", | ||
| 1412 | __FUNCTION__, ret); | ||
| 1413 | } | ||
| 1414 | } | 1402 | } |
| 1415 | } | 1403 | } |
| 1416 | for (index = 0; index < MAX_HWIFS; ++index) | 1404 | for (index = 0; index < MAX_HWIFS; ++index) |
| @@ -1420,3 +1408,22 @@ int ideprobe_init (void) | |||
| 1420 | } | 1408 | } |
| 1421 | 1409 | ||
| 1422 | EXPORT_SYMBOL_GPL(ideprobe_init); | 1410 | EXPORT_SYMBOL_GPL(ideprobe_init); |
| 1411 | |||
| 1412 | int ide_device_add(u8 idx[4]) | ||
| 1413 | { | ||
| 1414 | int i, rc = 0; | ||
| 1415 | |||
| 1416 | for (i = 0; i < 4; i++) { | ||
| 1417 | if (idx[i] != 0xff) | ||
| 1418 | rc |= probe_hwif_init(&ide_hwifs[idx[i]]); | ||
| 1419 | } | ||
| 1420 | |||
| 1421 | for (i = 0; i < 4; i++) { | ||
| 1422 | if (idx[i] != 0xff) | ||
| 1423 | ide_proc_register_port(&ide_hwifs[idx[i]]); | ||
| 1424 | } | ||
| 1425 | |||
| 1426 | return rc; | ||
| 1427 | } | ||
| 1428 | |||
| 1429 | EXPORT_SYMBOL_GPL(ide_device_add); | ||
diff --git a/drivers/ide/ide-proc.c b/drivers/ide/ide-proc.c index fc1d8ae6a803..a4007d30da52 100644 --- a/drivers/ide/ide-proc.c +++ b/drivers/ide/ide-proc.c | |||
| @@ -804,8 +804,6 @@ void ide_proc_register_port(ide_hwif_t *hwif) | |||
| 804 | create_proc_ide_drives(hwif); | 804 | create_proc_ide_drives(hwif); |
| 805 | } | 805 | } |
| 806 | 806 | ||
| 807 | EXPORT_SYMBOL_GPL(ide_proc_register_port); | ||
| 808 | |||
| 809 | #ifdef CONFIG_BLK_DEV_IDEPCI | 807 | #ifdef CONFIG_BLK_DEV_IDEPCI |
| 810 | void ide_pci_create_host_proc(const char *name, get_info_t *get_info) | 808 | void ide_pci_create_host_proc(const char *name, get_info_t *get_info) |
| 811 | { | 809 | { |
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c index b463cef2de63..7b9181b5469d 100644 --- a/drivers/ide/ide-tape.c +++ b/drivers/ide/ide-tape.c | |||
| @@ -621,7 +621,6 @@ typedef struct os_dat_s { | |||
| 621 | */ | 621 | */ |
| 622 | #define USE_IOTRACE 0 | 622 | #define USE_IOTRACE 0 |
| 623 | #if USE_IOTRACE | 623 | #if USE_IOTRACE |
| 624 | #include <linux/io_trace.h> | ||
| 625 | #define IO_IDETAPE_FIFO 500 | 624 | #define IO_IDETAPE_FIFO 500 |
| 626 | #endif | 625 | #endif |
| 627 | 626 | ||
diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c index 2a3c8d498343..73ef6bf5fbcc 100644 --- a/drivers/ide/ide-taskfile.c +++ b/drivers/ide/ide-taskfile.c | |||
| @@ -8,23 +8,6 @@ | |||
| 8 | * Copyright (C) 2003-2004 Bartlomiej Zolnierkiewicz | 8 | * Copyright (C) 2003-2004 Bartlomiej Zolnierkiewicz |
| 9 | * | 9 | * |
| 10 | * The big the bad and the ugly. | 10 | * The big the bad and the ugly. |
| 11 | * | ||
| 12 | * Problems to be fixed because of BH interface or the lack therefore. | ||
| 13 | * | ||
| 14 | * Fill me in stupid !!! | ||
| 15 | * | ||
| 16 | * HOST: | ||
| 17 | * General refers to the Controller and Driver "pair". | ||
| 18 | * DATA HANDLER: | ||
| 19 | * Under the context of Linux it generally refers to an interrupt handler. | ||
| 20 | * However, it correctly describes the 'HOST' | ||
| 21 | * DATA BLOCK: | ||
| 22 | * The amount of data needed to be transfered as predefined in the | ||
| 23 | * setup of the device. | ||
| 24 | * STORAGE ATOMIC: | ||
| 25 | * The 'DATA BLOCK' associated to the 'DATA HANDLER', and can be as | ||
| 26 | * small as a single sector or as large as the entire command block | ||
| 27 | * request. | ||
| 28 | */ | 11 | */ |
| 29 | 12 | ||
| 30 | #include <linux/module.h> | 13 | #include <linux/module.h> |
| @@ -695,9 +678,6 @@ int ide_wait_cmd (ide_drive_t *drive, u8 cmd, u8 nsect, u8 feature, u8 sectors, | |||
| 695 | return ide_do_drive_cmd(drive, &rq, ide_wait); | 678 | return ide_do_drive_cmd(drive, &rq, ide_wait); |
| 696 | } | 679 | } |
| 697 | 680 | ||
| 698 | /* | ||
| 699 | * FIXME : this needs to map into at taskfile. <andre@linux-ide.org> | ||
| 700 | */ | ||
| 701 | int ide_cmd_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg) | 681 | int ide_cmd_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg) |
| 702 | { | 682 | { |
| 703 | int err = 0; | 683 | int err = 0; |
| @@ -761,9 +741,6 @@ static int ide_wait_cmd_task(ide_drive_t *drive, u8 *buf) | |||
| 761 | return ide_do_drive_cmd(drive, &rq, ide_wait); | 741 | return ide_do_drive_cmd(drive, &rq, ide_wait); |
| 762 | } | 742 | } |
| 763 | 743 | ||
| 764 | /* | ||
| 765 | * FIXME : this needs to map into at taskfile. <andre@linux-ide.org> | ||
| 766 | */ | ||
| 767 | int ide_task_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg) | 744 | int ide_task_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg) |
| 768 | { | 745 | { |
| 769 | void __user *p = (void __user *)arg; | 746 | void __user *p = (void __user *)arg; |
| @@ -860,9 +837,14 @@ ide_startstop_t flagged_taskfile (ide_drive_t *drive, ide_task_t *task) | |||
| 860 | case TASKFILE_OUT_DMA: | 837 | case TASKFILE_OUT_DMA: |
| 861 | case TASKFILE_IN_DMAQ: | 838 | case TASKFILE_IN_DMAQ: |
| 862 | case TASKFILE_IN_DMA: | 839 | case TASKFILE_IN_DMA: |
| 863 | hwif->dma_setup(drive); | 840 | if (!drive->using_dma) |
| 864 | hwif->dma_exec_cmd(drive, taskfile->command); | 841 | break; |
| 865 | hwif->dma_start(drive); | 842 | |
| 843 | if (!hwif->dma_setup(drive)) { | ||
| 844 | hwif->dma_exec_cmd(drive, taskfile->command); | ||
| 845 | hwif->dma_start(drive); | ||
| 846 | return ide_started; | ||
| 847 | } | ||
| 866 | break; | 848 | break; |
| 867 | 849 | ||
| 868 | default: | 850 | default: |
| @@ -876,7 +858,8 @@ ide_startstop_t flagged_taskfile (ide_drive_t *drive, ide_task_t *task) | |||
| 876 | return task->prehandler(drive, task->rq); | 858 | return task->prehandler(drive, task->rq); |
| 877 | } | 859 | } |
| 878 | ide_execute_command(drive, taskfile->command, task->handler, WAIT_WORSTCASE, NULL); | 860 | ide_execute_command(drive, taskfile->command, task->handler, WAIT_WORSTCASE, NULL); |
| 861 | return ide_started; | ||
| 879 | } | 862 | } |
| 880 | 863 | ||
| 881 | return ide_started; | 864 | return ide_stopped; |
| 882 | } | 865 | } |
diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c index 961e6c897286..674a65c1a130 100644 --- a/drivers/ide/ide.c +++ b/drivers/ide/ide.c | |||
| @@ -168,7 +168,6 @@ static void init_hwif_default(ide_hwif_t *hwif, unsigned int index) | |||
| 168 | 168 | ||
| 169 | ide_init_hwif_ports(&hw, ide_default_io_base(index), 0, &hwif->irq); | 169 | ide_init_hwif_ports(&hw, ide_default_io_base(index), 0, &hwif->irq); |
| 170 | 170 | ||
| 171 | memcpy(&hwif->hw, &hw, sizeof(hw)); | ||
| 172 | memcpy(hwif->io_ports, hw.io_ports, sizeof(hw.io_ports)); | 171 | memcpy(hwif->io_ports, hw.io_ports, sizeof(hw.io_ports)); |
| 173 | 172 | ||
| 174 | hwif->noprobe = !hwif->io_ports[IDE_DATA_OFFSET]; | 173 | hwif->noprobe = !hwif->io_ports[IDE_DATA_OFFSET]; |
| @@ -214,7 +213,7 @@ static void __init init_ide_data (void) | |||
| 214 | init_hwif_data(hwif, index); | 213 | init_hwif_data(hwif, index); |
| 215 | init_hwif_default(hwif, index); | 214 | init_hwif_default(hwif, index); |
| 216 | #if !defined(CONFIG_PPC32) || !defined(CONFIG_PCI) | 215 | #if !defined(CONFIG_PPC32) || !defined(CONFIG_PCI) |
| 217 | hwif->irq = hwif->hw.irq = | 216 | hwif->irq = |
| 218 | ide_init_default_irq(hwif->io_ports[IDE_DATA_OFFSET]); | 217 | ide_init_default_irq(hwif->io_ports[IDE_DATA_OFFSET]); |
| 219 | #endif | 218 | #endif |
| 220 | } | 219 | } |
| @@ -265,6 +264,30 @@ static int ide_system_bus_speed(void) | |||
| 265 | return system_bus_speed; | 264 | return system_bus_speed; |
| 266 | } | 265 | } |
| 267 | 266 | ||
| 267 | ide_hwif_t * ide_find_port(unsigned long base) | ||
| 268 | { | ||
| 269 | ide_hwif_t *hwif; | ||
| 270 | int i; | ||
| 271 | |||
| 272 | for (i = 0; i < MAX_HWIFS; i++) { | ||
| 273 | hwif = &ide_hwifs[i]; | ||
| 274 | if (hwif->io_ports[IDE_DATA_OFFSET] == base) | ||
| 275 | goto found; | ||
| 276 | } | ||
| 277 | |||
| 278 | for (i = 0; i < MAX_HWIFS; i++) { | ||
| 279 | hwif = &ide_hwifs[i]; | ||
| 280 | if (hwif->io_ports[IDE_DATA_OFFSET] == 0) | ||
| 281 | goto found; | ||
| 282 | } | ||
| 283 | |||
| 284 | hwif = NULL; | ||
| 285 | found: | ||
| 286 | return hwif; | ||
| 287 | } | ||
| 288 | |||
| 289 | EXPORT_SYMBOL_GPL(ide_find_port); | ||
| 290 | |||
| 268 | static struct resource* hwif_request_region(ide_hwif_t *hwif, | 291 | static struct resource* hwif_request_region(ide_hwif_t *hwif, |
| 269 | unsigned long addr, int num) | 292 | unsigned long addr, int num) |
| 270 | { | 293 | { |
| @@ -391,6 +414,8 @@ static void ide_hwif_restore(ide_hwif_t *hwif, ide_hwif_t *tmp_hwif) | |||
| 391 | hwif->cds = tmp_hwif->cds; | 414 | hwif->cds = tmp_hwif->cds; |
| 392 | #endif | 415 | #endif |
| 393 | 416 | ||
| 417 | hwif->fixup = tmp_hwif->fixup; | ||
| 418 | |||
| 394 | hwif->set_pio_mode = tmp_hwif->set_pio_mode; | 419 | hwif->set_pio_mode = tmp_hwif->set_pio_mode; |
| 395 | hwif->set_dma_mode = tmp_hwif->set_dma_mode; | 420 | hwif->set_dma_mode = tmp_hwif->set_dma_mode; |
| 396 | hwif->mdma_filter = tmp_hwif->mdma_filter; | 421 | hwif->mdma_filter = tmp_hwif->mdma_filter; |
| @@ -652,7 +677,6 @@ void ide_setup_ports ( hw_regs_t *hw, | |||
| 652 | } | 677 | } |
| 653 | } | 678 | } |
| 654 | hw->irq = irq; | 679 | hw->irq = irq; |
| 655 | hw->dma = NO_DMA; | ||
| 656 | hw->ack_intr = ack_intr; | 680 | hw->ack_intr = ack_intr; |
| 657 | /* | 681 | /* |
| 658 | * hw->iops = iops; | 682 | * hw->iops = iops; |
| @@ -660,11 +684,11 @@ void ide_setup_ports ( hw_regs_t *hw, | |||
| 660 | } | 684 | } |
| 661 | 685 | ||
| 662 | /** | 686 | /** |
| 663 | * ide_register_hw_with_fixup - register IDE interface | 687 | * ide_register_hw - register IDE interface |
| 664 | * @hw: hardware registers | 688 | * @hw: hardware registers |
| 689 | * @fixup: fixup function | ||
| 665 | * @initializing: set while initializing built-in drivers | 690 | * @initializing: set while initializing built-in drivers |
| 666 | * @hwifp: pointer to returned hwif | 691 | * @hwifp: pointer to returned hwif |
| 667 | * @fixup: fixup function | ||
| 668 | * | 692 | * |
| 669 | * Register an IDE interface, specifying exactly the registers etc. | 693 | * Register an IDE interface, specifying exactly the registers etc. |
| 670 | * Set init=1 iff calling before probes have taken place. | 694 | * Set init=1 iff calling before probes have taken place. |
| @@ -672,9 +696,8 @@ void ide_setup_ports ( hw_regs_t *hw, | |||
| 672 | * Returns -1 on error. | 696 | * Returns -1 on error. |
| 673 | */ | 697 | */ |
| 674 | 698 | ||
| 675 | int ide_register_hw_with_fixup(hw_regs_t *hw, int initializing, | 699 | int ide_register_hw(hw_regs_t *hw, void (*fixup)(ide_hwif_t *), |
| 676 | ide_hwif_t **hwifp, | 700 | int initializing, ide_hwif_t **hwifp) |
| 677 | void(*fixup)(ide_hwif_t *hwif)) | ||
| 678 | { | 701 | { |
| 679 | int index, retry = 1; | 702 | int index, retry = 1; |
| 680 | ide_hwif_t *hwif; | 703 | ide_hwif_t *hwif; |
| @@ -682,7 +705,7 @@ int ide_register_hw_with_fixup(hw_regs_t *hw, int initializing, | |||
| 682 | do { | 705 | do { |
| 683 | for (index = 0; index < MAX_HWIFS; ++index) { | 706 | for (index = 0; index < MAX_HWIFS; ++index) { |
| 684 | hwif = &ide_hwifs[index]; | 707 | hwif = &ide_hwifs[index]; |
| 685 | if (hwif->hw.io_ports[IDE_DATA_OFFSET] == hw->io_ports[IDE_DATA_OFFSET]) | 708 | if (hwif->io_ports[IDE_DATA_OFFSET] == hw->io_ports[IDE_DATA_OFFSET]) |
| 686 | goto found; | 709 | goto found; |
| 687 | } | 710 | } |
| 688 | for (index = 0; index < MAX_HWIFS; ++index) { | 711 | for (index = 0; index < MAX_HWIFS; ++index) { |
| @@ -690,7 +713,7 @@ int ide_register_hw_with_fixup(hw_regs_t *hw, int initializing, | |||
| 690 | if (hwif->hold) | 713 | if (hwif->hold) |
| 691 | continue; | 714 | continue; |
| 692 | if ((!hwif->present && !hwif->mate && !initializing) || | 715 | if ((!hwif->present && !hwif->mate && !initializing) || |
| 693 | (!hwif->hw.io_ports[IDE_DATA_OFFSET] && initializing)) | 716 | (!hwif->io_ports[IDE_DATA_OFFSET] && initializing)) |
| 694 | goto found; | 717 | goto found; |
| 695 | } | 718 | } |
| 696 | for (index = 0; index < MAX_HWIFS; index++) | 719 | for (index = 0; index < MAX_HWIFS; index++) |
| @@ -706,16 +729,18 @@ found: | |||
| 706 | } | 729 | } |
| 707 | if (hwif->present) | 730 | if (hwif->present) |
| 708 | return -1; | 731 | return -1; |
| 709 | memcpy(&hwif->hw, hw, sizeof(*hw)); | 732 | memcpy(hwif->io_ports, hw->io_ports, sizeof(hwif->io_ports)); |
| 710 | memcpy(hwif->io_ports, hwif->hw.io_ports, sizeof(hwif->hw.io_ports)); | ||
| 711 | hwif->irq = hw->irq; | 733 | hwif->irq = hw->irq; |
| 712 | hwif->noprobe = 0; | 734 | hwif->noprobe = 0; |
| 735 | hwif->fixup = fixup; | ||
| 713 | hwif->chipset = hw->chipset; | 736 | hwif->chipset = hw->chipset; |
| 714 | hwif->gendev.parent = hw->dev; | 737 | hwif->gendev.parent = hw->dev; |
| 738 | hwif->ack_intr = hw->ack_intr; | ||
| 739 | |||
| 740 | if (initializing == 0) { | ||
| 741 | u8 idx[4] = { index, 0xff, 0xff, 0xff }; | ||
| 715 | 742 | ||
| 716 | if (!initializing) { | 743 | ide_device_add(idx); |
| 717 | probe_hwif_init_with_fixup(hwif, fixup); | ||
| 718 | ide_proc_register_port(hwif); | ||
| 719 | } | 744 | } |
| 720 | 745 | ||
| 721 | if (hwifp) | 746 | if (hwifp) |
| @@ -724,13 +749,6 @@ found: | |||
| 724 | return (initializing || hwif->present) ? index : -1; | 749 | return (initializing || hwif->present) ? index : -1; |
| 725 | } | 750 | } |
| 726 | 751 | ||
| 727 | EXPORT_SYMBOL(ide_register_hw_with_fixup); | ||
| 728 | |||
| 729 | int ide_register_hw(hw_regs_t *hw, int initializing, ide_hwif_t **hwifp) | ||
| 730 | { | ||
| 731 | return ide_register_hw_with_fixup(hw, initializing, hwifp, NULL); | ||
| 732 | } | ||
| 733 | |||
| 734 | EXPORT_SYMBOL(ide_register_hw); | 752 | EXPORT_SYMBOL(ide_register_hw); |
| 735 | 753 | ||
| 736 | /* | 754 | /* |
| @@ -1046,7 +1064,7 @@ int generic_ide_ioctl(ide_drive_t *drive, struct file *file, struct block_device | |||
| 1046 | ide_init_hwif_ports(&hw, (unsigned long) args[0], | 1064 | ide_init_hwif_ports(&hw, (unsigned long) args[0], |
| 1047 | (unsigned long) args[1], NULL); | 1065 | (unsigned long) args[1], NULL); |
| 1048 | hw.irq = args[2]; | 1066 | hw.irq = args[2]; |
| 1049 | if (ide_register_hw(&hw, 0, NULL) == -1) | 1067 | if (ide_register_hw(&hw, NULL, 0, NULL) == -1) |
| 1050 | return -EIO; | 1068 | return -EIO; |
| 1051 | return 0; | 1069 | return 0; |
| 1052 | } | 1070 | } |
| @@ -1397,6 +1415,9 @@ static int __init ide_setup(char *s) | |||
| 1397 | "reset", "minus6", "ata66", "minus8", "minus9", | 1415 | "reset", "minus6", "ata66", "minus8", "minus9", |
| 1398 | "minus10", "four", "qd65xx", "ht6560b", "cmd640_vlb", | 1416 | "minus10", "four", "qd65xx", "ht6560b", "cmd640_vlb", |
| 1399 | "dtc2278", "umc8672", "ali14xx", NULL }; | 1417 | "dtc2278", "umc8672", "ali14xx", NULL }; |
| 1418 | |||
| 1419 | hw_regs_t hwregs; | ||
| 1420 | |||
| 1400 | hw = s[3] - '0'; | 1421 | hw = s[3] - '0'; |
| 1401 | hwif = &ide_hwifs[hw]; | 1422 | hwif = &ide_hwifs[hw]; |
| 1402 | i = match_parm(&s[4], ide_words, vals, 3); | 1423 | i = match_parm(&s[4], ide_words, vals, 3); |
| @@ -1506,9 +1527,9 @@ static int __init ide_setup(char *s) | |||
| 1506 | case 2: /* base,ctl */ | 1527 | case 2: /* base,ctl */ |
| 1507 | vals[2] = 0; /* default irq = probe for it */ | 1528 | vals[2] = 0; /* default irq = probe for it */ |
| 1508 | case 3: /* base,ctl,irq */ | 1529 | case 3: /* base,ctl,irq */ |
| 1509 | hwif->hw.irq = vals[2]; | 1530 | memset(&hwregs, 0, sizeof(hwregs)); |
| 1510 | ide_init_hwif_ports(&hwif->hw, (unsigned long) vals[0], (unsigned long) vals[1], &hwif->irq); | 1531 | ide_init_hwif_ports(&hwregs, vals[0], vals[1], &hwif->irq); |
| 1511 | memcpy(hwif->io_ports, hwif->hw.io_ports, sizeof(hwif->io_ports)); | 1532 | memcpy(hwif->io_ports, hwregs.io_ports, sizeof(hwif->io_ports)); |
| 1512 | hwif->irq = vals[2]; | 1533 | hwif->irq = vals[2]; |
| 1513 | hwif->noprobe = 0; | 1534 | hwif->noprobe = 0; |
| 1514 | hwif->chipset = ide_forced; | 1535 | hwif->chipset = ide_forced; |
diff --git a/drivers/ide/legacy/ali14xx.c b/drivers/ide/legacy/ali14xx.c index 2f0ef9b44033..10311ecc674a 100644 --- a/drivers/ide/legacy/ali14xx.c +++ b/drivers/ide/legacy/ali14xx.c | |||
| @@ -102,6 +102,8 @@ static void outReg (u8 data, u8 reg) | |||
| 102 | outb_p(data, dataPort); | 102 | outb_p(data, dataPort); |
| 103 | } | 103 | } |
| 104 | 104 | ||
| 105 | static DEFINE_SPINLOCK(ali14xx_lock); | ||
| 106 | |||
| 105 | /* | 107 | /* |
| 106 | * Set PIO mode for the specified drive. | 108 | * Set PIO mode for the specified drive. |
| 107 | * This function computes timing parameters | 109 | * This function computes timing parameters |
| @@ -129,14 +131,14 @@ static void ali14xx_set_pio_mode(ide_drive_t *drive, const u8 pio) | |||
| 129 | 131 | ||
| 130 | /* stuff timing parameters into controller registers */ | 132 | /* stuff timing parameters into controller registers */ |
| 131 | driveNum = (HWIF(drive)->index << 1) + drive->select.b.unit; | 133 | driveNum = (HWIF(drive)->index << 1) + drive->select.b.unit; |
| 132 | spin_lock_irqsave(&ide_lock, flags); | 134 | spin_lock_irqsave(&ali14xx_lock, flags); |
| 133 | outb_p(regOn, basePort); | 135 | outb_p(regOn, basePort); |
| 134 | outReg(param1, regTab[driveNum].reg1); | 136 | outReg(param1, regTab[driveNum].reg1); |
| 135 | outReg(param2, regTab[driveNum].reg2); | 137 | outReg(param2, regTab[driveNum].reg2); |
| 136 | outReg(param3, regTab[driveNum].reg3); | 138 | outReg(param3, regTab[driveNum].reg3); |
| 137 | outReg(param4, regTab[driveNum].reg4); | 139 | outReg(param4, regTab[driveNum].reg4); |
| 138 | outb_p(regOff, basePort); | 140 | outb_p(regOff, basePort); |
| 139 | spin_unlock_irqrestore(&ide_lock, flags); | 141 | spin_unlock_irqrestore(&ali14xx_lock, flags); |
| 140 | } | 142 | } |
| 141 | 143 | ||
| 142 | /* | 144 | /* |
| @@ -193,6 +195,7 @@ static int __init initRegisters (void) { | |||
| 193 | static int __init ali14xx_probe(void) | 195 | static int __init ali14xx_probe(void) |
| 194 | { | 196 | { |
| 195 | ide_hwif_t *hwif, *mate; | 197 | ide_hwif_t *hwif, *mate; |
| 198 | static u8 idx[4] = { 0, 1, 0xff, 0xff }; | ||
| 196 | 199 | ||
| 197 | printk(KERN_DEBUG "ali14xx: base=0x%03x, regOn=0x%02x.\n", | 200 | printk(KERN_DEBUG "ali14xx: base=0x%03x, regOn=0x%02x.\n", |
| 198 | basePort, regOn); | 201 | basePort, regOn); |
| @@ -217,11 +220,7 @@ static int __init ali14xx_probe(void) | |||
| 217 | mate->mate = hwif; | 220 | mate->mate = hwif; |
| 218 | mate->channel = 1; | 221 | mate->channel = 1; |
| 219 | 222 | ||
| 220 | probe_hwif_init(hwif); | 223 | ide_device_add(idx); |
| 221 | probe_hwif_init(mate); | ||
| 222 | |||
| 223 | ide_proc_register_port(hwif); | ||
| 224 | ide_proc_register_port(mate); | ||
| 225 | 224 | ||
| 226 | return 0; | 225 | return 0; |
| 227 | } | 226 | } |
diff --git a/drivers/ide/legacy/buddha.c b/drivers/ide/legacy/buddha.c index 101aee1711c4..4a0be251a05f 100644 --- a/drivers/ide/legacy/buddha.c +++ b/drivers/ide/legacy/buddha.c | |||
| @@ -212,8 +212,8 @@ fail_base2: | |||
| 212 | // xsurf_iops, | 212 | // xsurf_iops, |
| 213 | IRQ_AMIGA_PORTS); | 213 | IRQ_AMIGA_PORTS); |
| 214 | } | 214 | } |
| 215 | 215 | ||
| 216 | index = ide_register_hw(&hw, 1, &hwif); | 216 | index = ide_register_hw(&hw, NULL, 1, &hwif); |
| 217 | if (index != -1) { | 217 | if (index != -1) { |
| 218 | hwif->mmio = 1; | 218 | hwif->mmio = 1; |
| 219 | printk("ide%d: ", index); | 219 | printk("ide%d: ", index); |
diff --git a/drivers/ide/legacy/dtc2278.c b/drivers/ide/legacy/dtc2278.c index f16521254867..24a845d45bd2 100644 --- a/drivers/ide/legacy/dtc2278.c +++ b/drivers/ide/legacy/dtc2278.c | |||
| @@ -67,20 +67,24 @@ static void sub22 (char b, char c) | |||
| 67 | } | 67 | } |
| 68 | } | 68 | } |
| 69 | 69 | ||
| 70 | static DEFINE_SPINLOCK(dtc2278_lock); | ||
| 71 | |||
| 70 | static void dtc2278_set_pio_mode(ide_drive_t *drive, const u8 pio) | 72 | static void dtc2278_set_pio_mode(ide_drive_t *drive, const u8 pio) |
| 71 | { | 73 | { |
| 72 | unsigned long flags; | 74 | unsigned long flags; |
| 73 | 75 | ||
| 74 | if (pio >= 3) { | 76 | if (pio >= 3) { |
| 75 | spin_lock_irqsave(&ide_lock, flags); | 77 | spin_lock_irqsave(&dtc2278_lock, flags); |
| 76 | /* | 78 | /* |
| 77 | * This enables PIO mode4 (3?) on the first interface | 79 | * This enables PIO mode4 (3?) on the first interface |
| 78 | */ | 80 | */ |
| 79 | sub22(1,0xc3); | 81 | sub22(1,0xc3); |
| 80 | sub22(0,0xa0); | 82 | sub22(0,0xa0); |
| 81 | spin_unlock_irqrestore(&ide_lock, flags); | 83 | spin_unlock_irqrestore(&dtc2278_lock, flags); |
| 82 | } else { | 84 | } else { |
| 83 | /* we don't know how to set it back again.. */ | 85 | /* we don't know how to set it back again.. */ |
| 86 | /* Actually we do - there is a data sheet available for the | ||
| 87 | Winbond but does anyone actually care */ | ||
| 84 | } | 88 | } |
| 85 | 89 | ||
| 86 | /* | 90 | /* |
| @@ -94,6 +98,7 @@ static int __init dtc2278_probe(void) | |||
| 94 | { | 98 | { |
| 95 | unsigned long flags; | 99 | unsigned long flags; |
| 96 | ide_hwif_t *hwif, *mate; | 100 | ide_hwif_t *hwif, *mate; |
| 101 | static u8 idx[4] = { 0, 1, 0xff, 0xff }; | ||
| 97 | 102 | ||
| 98 | hwif = &ide_hwifs[0]; | 103 | hwif = &ide_hwifs[0]; |
| 99 | mate = &ide_hwifs[1]; | 104 | mate = &ide_hwifs[1]; |
| @@ -129,16 +134,13 @@ static int __init dtc2278_probe(void) | |||
| 129 | 134 | ||
| 130 | mate->serialized = 1; | 135 | mate->serialized = 1; |
| 131 | mate->chipset = ide_dtc2278; | 136 | mate->chipset = ide_dtc2278; |
| 137 | mate->pio_mask = ATA_PIO4; | ||
| 132 | mate->drives[0].no_unmask = 1; | 138 | mate->drives[0].no_unmask = 1; |
| 133 | mate->drives[1].no_unmask = 1; | 139 | mate->drives[1].no_unmask = 1; |
| 134 | mate->mate = hwif; | 140 | mate->mate = hwif; |
| 135 | mate->channel = 1; | 141 | mate->channel = 1; |
| 136 | 142 | ||
| 137 | probe_hwif_init(hwif); | 143 | ide_device_add(idx); |
| 138 | probe_hwif_init(mate); | ||
| 139 | |||
| 140 | ide_proc_register_port(hwif); | ||
| 141 | ide_proc_register_port(mate); | ||
| 142 | 144 | ||
| 143 | return 0; | 145 | return 0; |
| 144 | } | 146 | } |
diff --git a/drivers/ide/legacy/falconide.c b/drivers/ide/legacy/falconide.c index f0829b83e970..7d7936f1b900 100644 --- a/drivers/ide/legacy/falconide.c +++ b/drivers/ide/legacy/falconide.c | |||
| @@ -72,7 +72,7 @@ void __init falconide_init(void) | |||
| 72 | 0, 0, NULL, | 72 | 0, 0, NULL, |
| 73 | // falconide_iops, | 73 | // falconide_iops, |
| 74 | IRQ_MFP_IDE); | 74 | IRQ_MFP_IDE); |
| 75 | index = ide_register_hw(&hw, 1, NULL); | 75 | index = ide_register_hw(&hw, NULL, 1, NULL); |
| 76 | 76 | ||
| 77 | if (index != -1) | 77 | if (index != -1) |
| 78 | printk("ide%d: Falcon IDE interface\n", index); | 78 | printk("ide%d: Falcon IDE interface\n", index); |
diff --git a/drivers/ide/legacy/gayle.c b/drivers/ide/legacy/gayle.c index 0830a021bbb6..53331ee1e957 100644 --- a/drivers/ide/legacy/gayle.c +++ b/drivers/ide/legacy/gayle.c | |||
| @@ -165,7 +165,7 @@ found: | |||
| 165 | // &gayle_iops, | 165 | // &gayle_iops, |
| 166 | IRQ_AMIGA_PORTS); | 166 | IRQ_AMIGA_PORTS); |
| 167 | 167 | ||
| 168 | index = ide_register_hw(&hw, 1, &hwif); | 168 | index = ide_register_hw(&hw, NULL, 1, &hwif); |
| 169 | if (index != -1) { | 169 | if (index != -1) { |
| 170 | hwif->mmio = 1; | 170 | hwif->mmio = 1; |
| 171 | switch (i) { | 171 | switch (i) { |
diff --git a/drivers/ide/legacy/ht6560b.c b/drivers/ide/legacy/ht6560b.c index 2e5a9cc5c0f7..a4245d13f11b 100644 --- a/drivers/ide/legacy/ht6560b.c +++ b/drivers/ide/legacy/ht6560b.c | |||
| @@ -247,6 +247,8 @@ static u8 ht_pio2timings(ide_drive_t *drive, const u8 pio) | |||
| 247 | } | 247 | } |
| 248 | } | 248 | } |
| 249 | 249 | ||
| 250 | static DEFINE_SPINLOCK(ht6560b_lock); | ||
| 251 | |||
| 250 | /* | 252 | /* |
| 251 | * Enable/Disable so called prefetch mode | 253 | * Enable/Disable so called prefetch mode |
| 252 | */ | 254 | */ |
| @@ -254,9 +256,9 @@ static void ht_set_prefetch(ide_drive_t *drive, u8 state) | |||
| 254 | { | 256 | { |
| 255 | unsigned long flags; | 257 | unsigned long flags; |
| 256 | int t = HT_PREFETCH_MODE << 8; | 258 | int t = HT_PREFETCH_MODE << 8; |
| 257 | 259 | ||
| 258 | spin_lock_irqsave(&ide_lock, flags); | 260 | spin_lock_irqsave(&ht6560b_lock, flags); |
| 259 | 261 | ||
| 260 | /* | 262 | /* |
| 261 | * Prefetch mode and unmask irq seems to conflict | 263 | * Prefetch mode and unmask irq seems to conflict |
| 262 | */ | 264 | */ |
| @@ -268,9 +270,9 @@ static void ht_set_prefetch(ide_drive_t *drive, u8 state) | |||
| 268 | drive->drive_data &= ~t; /* disable prefetch mode */ | 270 | drive->drive_data &= ~t; /* disable prefetch mode */ |
| 269 | drive->no_unmask = 0; | 271 | drive->no_unmask = 0; |
| 270 | } | 272 | } |
| 271 | 273 | ||
| 272 | spin_unlock_irqrestore(&ide_lock, flags); | 274 | spin_unlock_irqrestore(&ht6560b_lock, flags); |
| 273 | 275 | ||
| 274 | #ifdef DEBUG | 276 | #ifdef DEBUG |
| 275 | printk("ht6560b: drive %s prefetch mode %sabled\n", drive->name, (state ? "en" : "dis")); | 277 | printk("ht6560b: drive %s prefetch mode %sabled\n", drive->name, (state ? "en" : "dis")); |
| 276 | #endif | 278 | #endif |
| @@ -287,16 +289,14 @@ static void ht6560b_set_pio_mode(ide_drive_t *drive, const u8 pio) | |||
| 287 | ht_set_prefetch(drive, pio & 1); | 289 | ht_set_prefetch(drive, pio & 1); |
| 288 | return; | 290 | return; |
| 289 | } | 291 | } |
| 290 | 292 | ||
| 291 | timing = ht_pio2timings(drive, pio); | 293 | timing = ht_pio2timings(drive, pio); |
| 292 | 294 | ||
| 293 | spin_lock_irqsave(&ide_lock, flags); | 295 | spin_lock_irqsave(&ht6560b_lock, flags); |
| 294 | |||
| 295 | drive->drive_data &= 0xff00; | 296 | drive->drive_data &= 0xff00; |
| 296 | drive->drive_data |= timing; | 297 | drive->drive_data |= timing; |
| 297 | 298 | spin_unlock_irqrestore(&ht6560b_lock, flags); | |
| 298 | spin_unlock_irqrestore(&ide_lock, flags); | 299 | |
| 299 | |||
| 300 | #ifdef DEBUG | 300 | #ifdef DEBUG |
| 301 | printk("ht6560b: drive %s tuned to pio mode %#x timing=%#x\n", drive->name, pio, timing); | 301 | printk("ht6560b: drive %s tuned to pio mode %#x timing=%#x\n", drive->name, pio, timing); |
| 302 | #endif | 302 | #endif |
| @@ -311,6 +311,7 @@ MODULE_PARM_DESC(probe, "probe for HT6560B chipset"); | |||
| 311 | int __init ht6560b_init(void) | 311 | int __init ht6560b_init(void) |
| 312 | { | 312 | { |
| 313 | ide_hwif_t *hwif, *mate; | 313 | ide_hwif_t *hwif, *mate; |
| 314 | static u8 idx[4] = { 0, 1, 0xff, 0xff }; | ||
| 314 | int t; | 315 | int t; |
| 315 | 316 | ||
| 316 | if (probe_ht6560b == 0) | 317 | if (probe_ht6560b == 0) |
| @@ -359,11 +360,7 @@ int __init ht6560b_init(void) | |||
| 359 | mate->drives[0].drive_data = t; | 360 | mate->drives[0].drive_data = t; |
| 360 | mate->drives[1].drive_data = t; | 361 | mate->drives[1].drive_data = t; |
| 361 | 362 | ||
| 362 | probe_hwif_init(hwif); | 363 | ide_device_add(idx); |
| 363 | probe_hwif_init(mate); | ||
| 364 | |||
| 365 | ide_proc_register_port(hwif); | ||
| 366 | ide_proc_register_port(mate); | ||
| 367 | 364 | ||
| 368 | return 0; | 365 | return 0; |
| 369 | 366 | ||
diff --git a/drivers/ide/legacy/ide-cs.c b/drivers/ide/legacy/ide-cs.c index e8e360c2619d..03715c058664 100644 --- a/drivers/ide/legacy/ide-cs.c +++ b/drivers/ide/legacy/ide-cs.c | |||
| @@ -153,7 +153,7 @@ static int idecs_register(unsigned long io, unsigned long ctl, unsigned long irq | |||
| 153 | hw.irq = irq; | 153 | hw.irq = irq; |
| 154 | hw.chipset = ide_pci; | 154 | hw.chipset = ide_pci; |
| 155 | hw.dev = &handle->dev; | 155 | hw.dev = &handle->dev; |
| 156 | return ide_register_hw_with_fixup(&hw, 0, NULL, ide_undecoded_slave); | 156 | return ide_register_hw(&hw, &ide_undecoded_slave, 0, NULL); |
| 157 | } | 157 | } |
| 158 | 158 | ||
| 159 | /*====================================================================== | 159 | /*====================================================================== |
diff --git a/drivers/ide/legacy/ide_platform.c b/drivers/ide/legacy/ide_platform.c index b992b2b91fe2..7bb79f53dac8 100644 --- a/drivers/ide/legacy/ide_platform.c +++ b/drivers/ide/legacy/ide_platform.c | |||
| @@ -33,39 +33,24 @@ static ide_hwif_t *__devinit plat_ide_locate_hwif(void __iomem *base, | |||
| 33 | int mmio) | 33 | int mmio) |
| 34 | { | 34 | { |
| 35 | unsigned long port = (unsigned long)base; | 35 | unsigned long port = (unsigned long)base; |
| 36 | ide_hwif_t *hwif; | 36 | ide_hwif_t *hwif = ide_find_port(port); |
| 37 | int index, i; | 37 | int i; |
| 38 | |||
| 39 | for (index = 0; index < MAX_HWIFS; ++index) { | ||
| 40 | hwif = ide_hwifs + index; | ||
| 41 | if (hwif->io_ports[IDE_DATA_OFFSET] == port) | ||
| 42 | goto found; | ||
| 43 | } | ||
| 44 | |||
| 45 | for (index = 0; index < MAX_HWIFS; ++index) { | ||
| 46 | hwif = ide_hwifs + index; | ||
| 47 | if (hwif->io_ports[IDE_DATA_OFFSET] == 0) | ||
| 48 | goto found; | ||
| 49 | } | ||
| 50 | 38 | ||
| 51 | return NULL; | 39 | if (hwif == NULL) |
| 52 | 40 | goto out; | |
| 53 | found: | ||
| 54 | 41 | ||
| 55 | hwif->hw.io_ports[IDE_DATA_OFFSET] = port; | 42 | hwif->io_ports[IDE_DATA_OFFSET] = port; |
| 56 | 43 | ||
| 57 | port += (1 << pdata->ioport_shift); | 44 | port += (1 << pdata->ioport_shift); |
| 58 | for (i = IDE_ERROR_OFFSET; i <= IDE_STATUS_OFFSET; | 45 | for (i = IDE_ERROR_OFFSET; i <= IDE_STATUS_OFFSET; |
| 59 | i++, port += (1 << pdata->ioport_shift)) | 46 | i++, port += (1 << pdata->ioport_shift)) |
| 60 | hwif->hw.io_ports[i] = port; | 47 | hwif->io_ports[i] = port; |
| 61 | 48 | ||
| 62 | hwif->hw.io_ports[IDE_CONTROL_OFFSET] = (unsigned long)ctrl; | 49 | hwif->io_ports[IDE_CONTROL_OFFSET] = (unsigned long)ctrl; |
| 63 | 50 | ||
| 64 | memcpy(hwif->io_ports, hwif->hw.io_ports, sizeof(hwif->hw.io_ports)); | 51 | hwif->irq = irq; |
| 65 | hwif->hw.irq = hwif->irq = irq; | ||
| 66 | 52 | ||
| 67 | hwif->hw.dma = NO_DMA; | 53 | hwif->chipset = ide_generic; |
| 68 | hwif->chipset = hwif->hw.chipset = ide_generic; | ||
| 69 | 54 | ||
| 70 | if (mmio) { | 55 | if (mmio) { |
| 71 | hwif->mmio = 1; | 56 | hwif->mmio = 1; |
| @@ -73,8 +58,8 @@ found: | |||
| 73 | } | 58 | } |
| 74 | 59 | ||
| 75 | hwif_prop.hwif = hwif; | 60 | hwif_prop.hwif = hwif; |
| 76 | hwif_prop.index = index; | 61 | hwif_prop.index = hwif->index; |
| 77 | 62 | out: | |
| 78 | return hwif; | 63 | return hwif; |
| 79 | } | 64 | } |
| 80 | 65 | ||
| @@ -83,6 +68,7 @@ static int __devinit plat_ide_probe(struct platform_device *pdev) | |||
| 83 | struct resource *res_base, *res_alt, *res_irq; | 68 | struct resource *res_base, *res_alt, *res_irq; |
| 84 | ide_hwif_t *hwif; | 69 | ide_hwif_t *hwif; |
| 85 | struct pata_platform_info *pdata; | 70 | struct pata_platform_info *pdata; |
| 71 | u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; | ||
| 86 | int ret = 0; | 72 | int ret = 0; |
| 87 | int mmio = 0; | 73 | int mmio = 0; |
| 88 | 74 | ||
| @@ -130,10 +116,11 @@ static int __devinit plat_ide_probe(struct platform_device *pdev) | |||
| 130 | hwif->gendev.parent = &pdev->dev; | 116 | hwif->gendev.parent = &pdev->dev; |
| 131 | hwif->noprobe = 0; | 117 | hwif->noprobe = 0; |
| 132 | 118 | ||
| 133 | probe_hwif_init(hwif); | 119 | idx[0] = hwif->index; |
| 120 | |||
| 121 | ide_device_add(idx); | ||
| 134 | 122 | ||
| 135 | platform_set_drvdata(pdev, hwif); | 123 | platform_set_drvdata(pdev, hwif); |
| 136 | ide_proc_register_port(hwif); | ||
| 137 | 124 | ||
| 138 | return 0; | 125 | return 0; |
| 139 | 126 | ||
diff --git a/drivers/ide/legacy/macide.c b/drivers/ide/legacy/macide.c index b557c45a5a9d..e87cd2f16430 100644 --- a/drivers/ide/legacy/macide.c +++ b/drivers/ide/legacy/macide.c | |||
| @@ -93,21 +93,21 @@ void macide_init(void) | |||
| 93 | 0, 0, macide_ack_intr, | 93 | 0, 0, macide_ack_intr, |
| 94 | // quadra_ide_iops, | 94 | // quadra_ide_iops, |
| 95 | IRQ_NUBUS_F); | 95 | IRQ_NUBUS_F); |
| 96 | index = ide_register_hw(&hw, 1, &hwif); | 96 | index = ide_register_hw(&hw, NULL, 1, &hwif); |
| 97 | break; | 97 | break; |
| 98 | case MAC_IDE_PB: | 98 | case MAC_IDE_PB: |
| 99 | ide_setup_ports(&hw, IDE_BASE, macide_offsets, | 99 | ide_setup_ports(&hw, IDE_BASE, macide_offsets, |
| 100 | 0, 0, macide_ack_intr, | 100 | 0, 0, macide_ack_intr, |
| 101 | // macide_pb_iops, | 101 | // macide_pb_iops, |
| 102 | IRQ_NUBUS_C); | 102 | IRQ_NUBUS_C); |
| 103 | index = ide_register_hw(&hw, 1, &hwif); | 103 | index = ide_register_hw(&hw, NULL, 1, &hwif); |
| 104 | break; | 104 | break; |
| 105 | case MAC_IDE_BABOON: | 105 | case MAC_IDE_BABOON: |
| 106 | ide_setup_ports(&hw, BABOON_BASE, macide_offsets, | 106 | ide_setup_ports(&hw, BABOON_BASE, macide_offsets, |
| 107 | 0, 0, NULL, | 107 | 0, 0, NULL, |
| 108 | // macide_baboon_iops, | 108 | // macide_baboon_iops, |
| 109 | IRQ_BABOON_1); | 109 | IRQ_BABOON_1); |
| 110 | index = ide_register_hw(&hw, 1, &hwif); | 110 | index = ide_register_hw(&hw, NULL, 1, &hwif); |
| 111 | if (index == -1) break; | 111 | if (index == -1) break; |
| 112 | if (macintosh_config->ident == MAC_MODEL_PB190) { | 112 | if (macintosh_config->ident == MAC_MODEL_PB190) { |
| 113 | 113 | ||
diff --git a/drivers/ide/legacy/q40ide.c b/drivers/ide/legacy/q40ide.c index 16ba70b46096..a73db1bd482d 100644 --- a/drivers/ide/legacy/q40ide.c +++ b/drivers/ide/legacy/q40ide.c | |||
| @@ -89,9 +89,8 @@ void q40_ide_setup_ports ( hw_regs_t *hw, | |||
| 89 | else | 89 | else |
| 90 | hw->io_ports[i] = Q40_ISA_IO_B(base + offsets[i]); | 90 | hw->io_ports[i] = Q40_ISA_IO_B(base + offsets[i]); |
| 91 | } | 91 | } |
| 92 | 92 | ||
| 93 | hw->irq = irq; | 93 | hw->irq = irq; |
| 94 | hw->dma = NO_DMA; | ||
| 95 | hw->ack_intr = ack_intr; | 94 | hw->ack_intr = ack_intr; |
| 96 | /* | 95 | /* |
| 97 | * hw->iops = iops; | 96 | * hw->iops = iops; |
| @@ -142,7 +141,7 @@ void q40ide_init(void) | |||
| 142 | 0, NULL, | 141 | 0, NULL, |
| 143 | // m68kide_iops, | 142 | // m68kide_iops, |
| 144 | q40ide_default_irq(pcide_bases[i])); | 143 | q40ide_default_irq(pcide_bases[i])); |
| 145 | index = ide_register_hw(&hw, 1, &hwif); | 144 | index = ide_register_hw(&hw, NULL, 1, &hwif); |
| 146 | // **FIXME** | 145 | // **FIXME** |
| 147 | if (index != -1) | 146 | if (index != -1) |
| 148 | hwif->mmio = 1; | 147 | hwif->mmio = 1; |
diff --git a/drivers/ide/legacy/qd65xx.c b/drivers/ide/legacy/qd65xx.c index 0c81d2d0b941..912e73853faa 100644 --- a/drivers/ide/legacy/qd65xx.c +++ b/drivers/ide/legacy/qd65xx.c | |||
| @@ -89,26 +89,6 @@ | |||
| 89 | 89 | ||
| 90 | static int timings[4]={-1,-1,-1,-1}; /* stores current timing for each timer */ | 90 | static int timings[4]={-1,-1,-1,-1}; /* stores current timing for each timer */ |
| 91 | 91 | ||
| 92 | static void qd_write_reg (u8 content, unsigned long reg) | ||
| 93 | { | ||
| 94 | unsigned long flags; | ||
| 95 | |||
| 96 | spin_lock_irqsave(&ide_lock, flags); | ||
| 97 | outb(content,reg); | ||
| 98 | spin_unlock_irqrestore(&ide_lock, flags); | ||
| 99 | } | ||
| 100 | |||
| 101 | static u8 __init qd_read_reg (unsigned long reg) | ||
| 102 | { | ||
| 103 | unsigned long flags; | ||
| 104 | u8 read; | ||
| 105 | |||
| 106 | spin_lock_irqsave(&ide_lock, flags); | ||
| 107 | read = inb(reg); | ||
| 108 | spin_unlock_irqrestore(&ide_lock, flags); | ||
| 109 | return read; | ||
| 110 | } | ||
| 111 | |||
| 112 | /* | 92 | /* |
| 113 | * qd_select: | 93 | * qd_select: |
| 114 | * | 94 | * |
| @@ -121,7 +101,7 @@ static void qd_select (ide_drive_t *drive) | |||
| 121 | (QD_TIMREG(drive) & 0x02); | 101 | (QD_TIMREG(drive) & 0x02); |
| 122 | 102 | ||
| 123 | if (timings[index] != QD_TIMING(drive)) | 103 | if (timings[index] != QD_TIMING(drive)) |
| 124 | qd_write_reg(timings[index] = QD_TIMING(drive), QD_TIMREG(drive)); | 104 | outb(timings[index] = QD_TIMING(drive), QD_TIMREG(drive)); |
| 125 | } | 105 | } |
| 126 | 106 | ||
| 127 | /* | 107 | /* |
| @@ -284,7 +264,7 @@ static void qd6580_set_pio_mode(ide_drive_t *drive, const u8 pio) | |||
| 284 | } | 264 | } |
| 285 | 265 | ||
| 286 | if (!HWIF(drive)->channel && drive->media != ide_disk) { | 266 | if (!HWIF(drive)->channel && drive->media != ide_disk) { |
| 287 | qd_write_reg(0x5f, QD_CONTROL_PORT); | 267 | outb(0x5f, QD_CONTROL_PORT); |
| 288 | printk(KERN_WARNING "%s: ATAPI: disabled read-ahead FIFO " | 268 | printk(KERN_WARNING "%s: ATAPI: disabled read-ahead FIFO " |
| 289 | "and post-write buffer on %s.\n", | 269 | "and post-write buffer on %s.\n", |
| 290 | drive->name, HWIF(drive)->name); | 270 | drive->name, HWIF(drive)->name); |
| @@ -301,16 +281,15 @@ static void qd6580_set_pio_mode(ide_drive_t *drive, const u8 pio) | |||
| 301 | 281 | ||
| 302 | static int __init qd_testreg(int port) | 282 | static int __init qd_testreg(int port) |
| 303 | { | 283 | { |
| 304 | u8 savereg; | ||
| 305 | u8 readreg; | ||
| 306 | unsigned long flags; | 284 | unsigned long flags; |
| 285 | u8 savereg, readreg; | ||
| 307 | 286 | ||
| 308 | spin_lock_irqsave(&ide_lock, flags); | 287 | local_irq_save(flags); |
| 309 | savereg = inb_p(port); | 288 | savereg = inb_p(port); |
| 310 | outb_p(QD_TESTVAL, port); /* safe value */ | 289 | outb_p(QD_TESTVAL, port); /* safe value */ |
| 311 | readreg = inb_p(port); | 290 | readreg = inb_p(port); |
| 312 | outb(savereg, port); | 291 | outb(savereg, port); |
| 313 | spin_unlock_irqrestore(&ide_lock, flags); | 292 | local_irq_restore(flags); |
| 314 | 293 | ||
| 315 | if (savereg == QD_TESTVAL) { | 294 | if (savereg == QD_TESTVAL) { |
| 316 | printk(KERN_ERR "Outch ! the probe for qd65xx isn't reliable !\n"); | 295 | 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) | |||
| 364 | 343 | ||
| 365 | if (set_pio_mode == (void *)qd6500_set_pio_mode) { | 344 | if (set_pio_mode == (void *)qd6500_set_pio_mode) { |
| 366 | // will do it for both | 345 | // will do it for both |
| 367 | qd_write_reg(QD6500_DEF_DATA, QD_TIMREG(&hwif->drives[0])); | 346 | outb(QD6500_DEF_DATA, QD_TIMREG(&hwif->drives[0])); |
| 368 | } else if (set_pio_mode == (void *)qd6580_set_pio_mode) { | 347 | } else if (set_pio_mode == (void *)qd6580_set_pio_mode) { |
| 369 | if (QD_CONTROL(hwif) & QD_CONTR_SEC_DISABLED) { | 348 | if (QD_CONTROL(hwif) & QD_CONTR_SEC_DISABLED) { |
| 370 | qd_write_reg(QD6580_DEF_DATA, QD_TIMREG(&hwif->drives[0])); | 349 | outb(QD6580_DEF_DATA, QD_TIMREG(&hwif->drives[0])); |
| 371 | qd_write_reg(QD6580_DEF_DATA2, QD_TIMREG(&hwif->drives[1])); | 350 | outb(QD6580_DEF_DATA2, QD_TIMREG(&hwif->drives[1])); |
| 372 | } else { | 351 | } else { |
| 373 | qd_write_reg(hwif->channel ? QD6580_DEF_DATA2 : QD6580_DEF_DATA, QD_TIMREG(&hwif->drives[0])); | 352 | outb(hwif->channel ? QD6580_DEF_DATA2 : QD6580_DEF_DATA, QD_TIMREG(&hwif->drives[0])); |
| 374 | } | 353 | } |
| 375 | } else { | 354 | } else { |
| 376 | printk(KERN_WARNING "Unknown qd65xx tuning fonction !\n"); | 355 | printk(KERN_WARNING "Unknown qd65xx tuning fonction !\n"); |
| @@ -389,10 +368,11 @@ static void __exit qd_unsetup(ide_hwif_t *hwif) | |||
| 389 | static int __init qd_probe(int base) | 368 | static int __init qd_probe(int base) |
| 390 | { | 369 | { |
| 391 | ide_hwif_t *hwif; | 370 | ide_hwif_t *hwif; |
| 371 | u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; | ||
| 392 | u8 config; | 372 | u8 config; |
| 393 | u8 unit; | 373 | u8 unit; |
| 394 | 374 | ||
| 395 | config = qd_read_reg(QD_CONFIG_PORT); | 375 | config = inb(QD_CONFIG_PORT); |
| 396 | 376 | ||
| 397 | if (! ((config & QD_CONFIG_BASEPORT) >> 1 == (base == 0xb0)) ) | 377 | if (! ((config & QD_CONFIG_BASEPORT) >> 1 == (base == 0xb0)) ) |
| 398 | return 1; | 378 | return 1; |
| @@ -419,9 +399,9 @@ static int __init qd_probe(int base) | |||
| 419 | 399 | ||
| 420 | hwif->set_pio_mode = &qd6500_set_pio_mode; | 400 | hwif->set_pio_mode = &qd6500_set_pio_mode; |
| 421 | 401 | ||
| 422 | probe_hwif_init(hwif); | 402 | idx[0] = unit; |
| 423 | 403 | ||
| 424 | ide_proc_register_port(hwif); | 404 | ide_device_add(idx); |
| 425 | 405 | ||
| 426 | return 1; | 406 | return 1; |
| 427 | } | 407 | } |
| @@ -436,7 +416,7 @@ static int __init qd_probe(int base) | |||
| 436 | 416 | ||
| 437 | /* qd6580 found */ | 417 | /* qd6580 found */ |
| 438 | 418 | ||
| 439 | control = qd_read_reg(QD_CONTROL_PORT); | 419 | control = inb(QD_CONTROL_PORT); |
| 440 | 420 | ||
| 441 | printk(KERN_NOTICE "qd6580 at %#x\n", base); | 421 | printk(KERN_NOTICE "qd6580 at %#x\n", base); |
| 442 | printk(KERN_DEBUG "qd6580: config=%#x, control=%#x, ID3=%u\n", | 422 | printk(KERN_DEBUG "qd6580: config=%#x, control=%#x, ID3=%u\n", |
| @@ -453,11 +433,11 @@ static int __init qd_probe(int base) | |||
| 453 | 433 | ||
| 454 | hwif->set_pio_mode = &qd6580_set_pio_mode; | 434 | hwif->set_pio_mode = &qd6580_set_pio_mode; |
| 455 | 435 | ||
| 456 | probe_hwif_init(hwif); | 436 | idx[0] = unit; |
| 457 | 437 | ||
| 458 | qd_write_reg(QD_DEF_CONTR,QD_CONTROL_PORT); | 438 | ide_device_add(idx); |
| 459 | 439 | ||
| 460 | ide_proc_register_port(hwif); | 440 | outb(QD_DEF_CONTR, QD_CONTROL_PORT); |
| 461 | 441 | ||
| 462 | return 1; | 442 | return 1; |
| 463 | } else { | 443 | } else { |
| @@ -474,19 +454,17 @@ static int __init qd_probe(int base) | |||
| 474 | 454 | ||
| 475 | hwif->set_pio_mode = &qd6580_set_pio_mode; | 455 | hwif->set_pio_mode = &qd6580_set_pio_mode; |
| 476 | 456 | ||
| 477 | probe_hwif_init(hwif); | ||
| 478 | |||
| 479 | qd_setup(mate, base, config | (control << 8), | 457 | qd_setup(mate, base, config | (control << 8), |
| 480 | QD6580_DEF_DATA2, QD6580_DEF_DATA2); | 458 | QD6580_DEF_DATA2, QD6580_DEF_DATA2); |
| 481 | 459 | ||
| 482 | mate->set_pio_mode = &qd6580_set_pio_mode; | 460 | mate->set_pio_mode = &qd6580_set_pio_mode; |
| 483 | 461 | ||
| 484 | probe_hwif_init(mate); | 462 | idx[0] = 0; |
| 463 | idx[1] = 1; | ||
| 485 | 464 | ||
| 486 | qd_write_reg(QD_DEF_CONTR,QD_CONTROL_PORT); | 465 | ide_device_add(idx); |
| 487 | 466 | ||
| 488 | ide_proc_register_port(hwif); | 467 | outb(QD_DEF_CONTR, QD_CONTROL_PORT); |
| 489 | ide_proc_register_port(mate); | ||
| 490 | 468 | ||
| 491 | return 0; /* no other qd65xx possible */ | 469 | return 0; /* no other qd65xx possible */ |
| 492 | } | 470 | } |
diff --git a/drivers/ide/legacy/umc8672.c b/drivers/ide/legacy/umc8672.c index 1151c92dd531..79577b916874 100644 --- a/drivers/ide/legacy/umc8672.c +++ b/drivers/ide/legacy/umc8672.c | |||
| @@ -124,8 +124,9 @@ static void umc_set_pio_mode(ide_drive_t *drive, const u8 pio) | |||
| 124 | 124 | ||
| 125 | static int __init umc8672_probe(void) | 125 | static int __init umc8672_probe(void) |
| 126 | { | 126 | { |
| 127 | unsigned long flags; | ||
| 128 | ide_hwif_t *hwif, *mate; | 127 | ide_hwif_t *hwif, *mate; |
| 128 | unsigned long flags; | ||
| 129 | static u8 idx[4] = { 0, 1, 0xff, 0xff }; | ||
| 129 | 130 | ||
| 130 | if (!request_region(0x108, 2, "umc8672")) { | 131 | if (!request_region(0x108, 2, "umc8672")) { |
| 131 | printk(KERN_ERR "umc8672: ports 0x108-0x109 already in use.\n"); | 132 | printk(KERN_ERR "umc8672: ports 0x108-0x109 already in use.\n"); |
| @@ -158,11 +159,7 @@ static int __init umc8672_probe(void) | |||
| 158 | mate->mate = hwif; | 159 | mate->mate = hwif; |
| 159 | mate->channel = 1; | 160 | mate->channel = 1; |
| 160 | 161 | ||
| 161 | probe_hwif_init(hwif); | 162 | ide_device_add(idx); |
| 162 | probe_hwif_init(mate); | ||
| 163 | |||
| 164 | ide_proc_register_port(hwif); | ||
| 165 | ide_proc_register_port(mate); | ||
| 166 | 163 | ||
| 167 | return 0; | 164 | return 0; |
| 168 | } | 165 | } |
diff --git a/drivers/ide/mips/au1xxx-ide.c b/drivers/ide/mips/au1xxx-ide.c index 2f322d7e881b..1de58566e5b6 100644 --- a/drivers/ide/mips/au1xxx-ide.c +++ b/drivers/ide/mips/au1xxx-ide.c | |||
| @@ -601,8 +601,9 @@ static int au_ide_probe(struct device *dev) | |||
| 601 | _auide_hwif *ahwif = &auide_hwif; | 601 | _auide_hwif *ahwif = &auide_hwif; |
| 602 | ide_hwif_t *hwif; | 602 | ide_hwif_t *hwif; |
| 603 | struct resource *res; | 603 | struct resource *res; |
| 604 | hw_regs_t *hw; | ||
| 605 | int ret = 0; | 604 | int ret = 0; |
| 605 | u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; | ||
| 606 | hw_regs_t hw; | ||
| 606 | 607 | ||
| 607 | #if defined(CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA) | 608 | #if defined(CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA) |
| 608 | char *mode = "MWDMA2"; | 609 | char *mode = "MWDMA2"; |
| @@ -644,12 +645,12 @@ static int au_ide_probe(struct device *dev) | |||
| 644 | /* FIXME: This might possibly break PCMCIA IDE devices */ | 645 | /* FIXME: This might possibly break PCMCIA IDE devices */ |
| 645 | 646 | ||
| 646 | hwif = &ide_hwifs[pdev->id]; | 647 | hwif = &ide_hwifs[pdev->id]; |
| 647 | hw = &hwif->hw; | 648 | hwif->irq = ahwif->irq; |
| 648 | hwif->irq = hw->irq = ahwif->irq; | ||
| 649 | hwif->chipset = ide_au1xxx; | 649 | hwif->chipset = ide_au1xxx; |
| 650 | 650 | ||
| 651 | auide_setup_ports(hw, ahwif); | 651 | memset(&hw, 0, sizeof(hw)); |
| 652 | memcpy(hwif->io_ports, hw->io_ports, sizeof(hwif->io_ports)); | 652 | auide_setup_ports(&hw, ahwif); |
| 653 | memcpy(hwif->io_ports, hw.io_ports, sizeof(hwif->io_ports)); | ||
| 653 | 654 | ||
| 654 | hwif->ultra_mask = 0x0; /* Disable Ultra DMA */ | 655 | hwif->ultra_mask = 0x0; /* Disable Ultra DMA */ |
| 655 | #ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA | 656 | #ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA |
| @@ -706,8 +707,10 @@ static int au_ide_probe(struct device *dev) | |||
| 706 | hwif->config_data = 0; /* no chipset-specific code */ | 707 | hwif->config_data = 0; /* no chipset-specific code */ |
| 707 | 708 | ||
| 708 | hwif->drives[0].autotune = 1; /* 1=autotune, 2=noautotune, 0=default */ | 709 | hwif->drives[0].autotune = 1; /* 1=autotune, 2=noautotune, 0=default */ |
| 710 | hwif->drives[1].autotune = 1; | ||
| 709 | #endif | 711 | #endif |
| 710 | hwif->drives[0].no_io_32bit = 1; | 712 | hwif->drives[0].no_io_32bit = 1; |
| 713 | hwif->drives[1].no_io_32bit = 1; | ||
| 711 | 714 | ||
| 712 | auide_hwif.hwif = hwif; | 715 | auide_hwif.hwif = hwif; |
| 713 | hwif->hwif_data = &auide_hwif; | 716 | hwif->hwif_data = &auide_hwif; |
| @@ -717,9 +720,9 @@ static int au_ide_probe(struct device *dev) | |||
| 717 | dbdma_init_done = 1; | 720 | dbdma_init_done = 1; |
| 718 | #endif | 721 | #endif |
| 719 | 722 | ||
| 720 | probe_hwif_init(hwif); | 723 | idx[0] = hwif->index; |
| 721 | 724 | ||
| 722 | ide_proc_register_port(hwif); | 725 | ide_device_add(idx); |
| 723 | 726 | ||
| 724 | dev_set_drvdata(dev, hwif); | 727 | dev_set_drvdata(dev, hwif); |
| 725 | 728 | ||
diff --git a/drivers/ide/mips/swarm.c b/drivers/ide/mips/swarm.c index c2e29571b007..521edd41b572 100644 --- a/drivers/ide/mips/swarm.c +++ b/drivers/ide/mips/swarm.c | |||
| @@ -71,6 +71,7 @@ static int __devinit swarm_ide_probe(struct device *dev) | |||
| 71 | u8 __iomem *base; | 71 | u8 __iomem *base; |
| 72 | phys_t offset, size; | 72 | phys_t offset, size; |
| 73 | int i; | 73 | int i; |
| 74 | u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; | ||
| 74 | 75 | ||
| 75 | if (!SIBYTE_HAVE_IDE) | 76 | if (!SIBYTE_HAVE_IDE) |
| 76 | return -ENODEV; | 77 | return -ENODEV; |
| @@ -119,18 +120,15 @@ static int __devinit swarm_ide_probe(struct device *dev) | |||
| 119 | hwif->noprobe = 0; | 120 | hwif->noprobe = 0; |
| 120 | 121 | ||
| 121 | for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) | 122 | for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) |
| 122 | hwif->hw.io_ports[i] = | 123 | hwif->io_ports[i] = |
| 123 | (unsigned long)(base + ((0x1f0 + i) << 5)); | 124 | (unsigned long)(base + ((0x1f0 + i) << 5)); |
| 124 | hwif->hw.io_ports[IDE_CONTROL_OFFSET] = | 125 | hwif->io_ports[IDE_CONTROL_OFFSET] = |
| 125 | (unsigned long)(base + (0x3f6 << 5)); | 126 | (unsigned long)(base + (0x3f6 << 5)); |
| 126 | hwif->hw.irq = K_INT_GB_IDE; | 127 | hwif->irq = K_INT_GB_IDE; |
| 127 | 128 | ||
| 128 | memcpy(hwif->io_ports, hwif->hw.io_ports, sizeof(hwif->io_ports)); | 129 | idx[0] = hwif->index; |
| 129 | hwif->irq = hwif->hw.irq; | ||
| 130 | 130 | ||
| 131 | probe_hwif_init(hwif); | 131 | ide_device_add(idx); |
| 132 | |||
| 133 | ide_proc_register_port(hwif); | ||
| 134 | 132 | ||
| 135 | dev_set_drvdata(dev, hwif); | 133 | dev_set_drvdata(dev, hwif); |
| 136 | 134 | ||
diff --git a/drivers/ide/pci/aec62xx.c b/drivers/ide/pci/aec62xx.c index b3dc12a70d51..19ec421f7b9f 100644 --- a/drivers/ide/pci/aec62xx.c +++ b/drivers/ide/pci/aec62xx.c | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * linux/drivers/ide/pci/aec62xx.c Version 0.26 Sep 1, 2007 | 2 | * linux/drivers/ide/pci/aec62xx.c Version 0.27 Sep 16, 2007 |
| 3 | * | 3 | * |
| 4 | * Copyright (C) 1999-2002 Andre Hedrick <andre@linux-ide.org> | 4 | * Copyright (C) 1999-2002 Andre Hedrick <andre@linux-ide.org> |
| 5 | * Copyright (C) 2007 MontaVista Software, Inc. <source@mvista.com> | 5 | * 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) | |||
| 141 | drive->hwif->set_dma_mode(drive, pio + XFER_PIO_0); | 141 | drive->hwif->set_dma_mode(drive, pio + XFER_PIO_0); |
| 142 | } | 142 | } |
| 143 | 143 | ||
| 144 | static void aec62xx_dma_lost_irq (ide_drive_t *drive) | ||
| 145 | { | ||
| 146 | switch (HWIF(drive)->pci_dev->device) { | ||
| 147 | case PCI_DEVICE_ID_ARTOP_ATP860: | ||
| 148 | case PCI_DEVICE_ID_ARTOP_ATP860R: | ||
| 149 | case PCI_DEVICE_ID_ARTOP_ATP865: | ||
| 150 | case PCI_DEVICE_ID_ARTOP_ATP865R: | ||
| 151 | printk(" AEC62XX time out "); | ||
| 152 | default: | ||
| 153 | break; | ||
| 154 | } | ||
| 155 | } | ||
| 156 | |||
| 157 | static unsigned int __devinit init_chipset_aec62xx(struct pci_dev *dev, const char *name) | 144 | static unsigned int __devinit init_chipset_aec62xx(struct pci_dev *dev, const char *name) |
| 158 | { | 145 | { |
| 159 | int bus_speed = system_bus_clock(); | 146 | int bus_speed = system_bus_clock(); |
| @@ -195,8 +182,6 @@ static void __devinit init_hwif_aec62xx(ide_hwif_t *hwif) | |||
| 195 | if (hwif->dma_base == 0) | 182 | if (hwif->dma_base == 0) |
| 196 | return; | 183 | return; |
| 197 | 184 | ||
| 198 | hwif->dma_lost_irq = &aec62xx_dma_lost_irq; | ||
| 199 | |||
| 200 | if (dev->device == PCI_DEVICE_ID_ARTOP_ATP850UF) | 185 | if (dev->device == PCI_DEVICE_ID_ARTOP_ATP850UF) |
| 201 | return; | 186 | return; |
| 202 | 187 | ||
| @@ -209,7 +194,7 @@ static void __devinit init_hwif_aec62xx(ide_hwif_t *hwif) | |||
| 209 | } | 194 | } |
| 210 | } | 195 | } |
| 211 | 196 | ||
| 212 | static ide_pci_device_t aec62xx_chipsets[] __devinitdata = { | 197 | static const struct ide_port_info aec62xx_chipsets[] __devinitdata = { |
| 213 | { /* 0 */ | 198 | { /* 0 */ |
| 214 | .name = "AEC6210", | 199 | .name = "AEC6210", |
| 215 | .init_chipset = init_chipset_aec62xx, | 200 | .init_chipset = init_chipset_aec62xx, |
| @@ -268,12 +253,12 @@ static ide_pci_device_t aec62xx_chipsets[] __devinitdata = { | |||
| 268 | * finds a device matching our IDE device tables. | 253 | * finds a device matching our IDE device tables. |
| 269 | * | 254 | * |
| 270 | * NOTE: since we're going to modify the 'name' field for AEC-6[26]80[R] | 255 | * NOTE: since we're going to modify the 'name' field for AEC-6[26]80[R] |
| 271 | * chips, pass a local copy of 'struct pci_device_id' down the call chain. | 256 | * chips, pass a local copy of 'struct ide_port_info' down the call chain. |
| 272 | */ | 257 | */ |
| 273 | 258 | ||
| 274 | static int __devinit aec62xx_init_one(struct pci_dev *dev, const struct pci_device_id *id) | 259 | static int __devinit aec62xx_init_one(struct pci_dev *dev, const struct pci_device_id *id) |
| 275 | { | 260 | { |
| 276 | ide_pci_device_t d; | 261 | struct ide_port_info d; |
| 277 | u8 idx = id->driver_data; | 262 | u8 idx = id->driver_data; |
| 278 | 263 | ||
| 279 | d = aec62xx_chipsets[idx]; | 264 | d = aec62xx_chipsets[idx]; |
diff --git a/drivers/ide/pci/alim15x3.c b/drivers/ide/pci/alim15x3.c index 8ee2b48d105d..a607dd31a64c 100644 --- a/drivers/ide/pci/alim15x3.c +++ b/drivers/ide/pci/alim15x3.c | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * linux/drivers/ide/pci/alim15x3.c Version 0.27 Aug 27 2007 | 2 | * linux/drivers/ide/pci/alim15x3.c Version 0.29 Sep 16 2007 |
| 3 | * | 3 | * |
| 4 | * Copyright (C) 1998-2000 Michel Aubry, Maintainer | 4 | * Copyright (C) 1998-2000 Michel Aubry, Maintainer |
| 5 | * Copyright (C) 1998-2000 Andrzej Krzysztofowicz, Maintainer | 5 | * Copyright (C) 1998-2000 Andrzej Krzysztofowicz, Maintainer |
| @@ -492,6 +492,13 @@ static unsigned int __devinit init_chipset_ali15x3 (struct pci_dev *dev, const c | |||
| 492 | * clear bit 7 | 492 | * clear bit 7 |
| 493 | */ | 493 | */ |
| 494 | pci_write_config_byte(dev, 0x4b, tmpbyte & 0x7F); | 494 | pci_write_config_byte(dev, 0x4b, tmpbyte & 0x7F); |
| 495 | /* | ||
| 496 | * check m1533, 0x5e, bit 1~4 == 1001 => & 00011110 = 00010010 | ||
| 497 | */ | ||
| 498 | if (m5229_revision >= 0x20 && isa_dev) { | ||
| 499 | pci_read_config_byte(isa_dev, 0x5e, &tmpbyte); | ||
| 500 | chip_is_1543c_e = ((tmpbyte & 0x1e) == 0x12) ? 1: 0; | ||
| 501 | } | ||
| 495 | goto out; | 502 | goto out; |
| 496 | } | 503 | } |
| 497 | 504 | ||
| @@ -537,7 +544,30 @@ static unsigned int __devinit init_chipset_ali15x3 (struct pci_dev *dev, const c | |||
| 537 | pci_write_config_byte(isa_dev, 0x79, tmpbyte | 0x02); | 544 | pci_write_config_byte(isa_dev, 0x79, tmpbyte | 0x02); |
| 538 | } | 545 | } |
| 539 | } | 546 | } |
| 547 | |||
| 540 | out: | 548 | out: |
| 549 | /* | ||
| 550 | * CD_ROM DMA on (m5229, 0x53, bit0) | ||
| 551 | * Enable this bit even if we want to use PIO. | ||
| 552 | * PIO FIFO off (m5229, 0x53, bit1) | ||
| 553 | * The hardware will use 0x54h and 0x55h to control PIO FIFO. | ||
| 554 | * (Not on later devices it seems) | ||
| 555 | * | ||
| 556 | * 0x53 changes meaning on later revs - we must no touch | ||
| 557 | * bit 1 on them. Need to check if 0x20 is the right break. | ||
| 558 | */ | ||
| 559 | if (m5229_revision >= 0x20) { | ||
| 560 | pci_read_config_byte(dev, 0x53, &tmpbyte); | ||
| 561 | |||
| 562 | if (m5229_revision <= 0x20) | ||
| 563 | tmpbyte = (tmpbyte & (~0x02)) | 0x01; | ||
| 564 | else if (m5229_revision == 0xc7 || m5229_revision == 0xc8) | ||
| 565 | tmpbyte |= 0x03; | ||
| 566 | else | ||
| 567 | tmpbyte |= 0x01; | ||
| 568 | |||
| 569 | pci_write_config_byte(dev, 0x53, tmpbyte); | ||
| 570 | } | ||
| 541 | pci_dev_put(north); | 571 | pci_dev_put(north); |
| 542 | pci_dev_put(isa_dev); | 572 | pci_dev_put(isa_dev); |
| 543 | local_irq_restore(flags); | 573 | local_irq_restore(flags); |
| @@ -616,36 +646,8 @@ static u8 __devinit ata66_ali15x3(ide_hwif_t *hwif) | |||
| 616 | if ((tmpbyte & (1 << hwif->channel)) == 0) | 646 | if ((tmpbyte & (1 << hwif->channel)) == 0) |
| 617 | cbl = ATA_CBL_PATA80; | 647 | cbl = ATA_CBL_PATA80; |
| 618 | } | 648 | } |
| 619 | } else { | ||
| 620 | /* | ||
| 621 | * check m1533, 0x5e, bit 1~4 == 1001 => & 00011110 = 00010010 | ||
| 622 | */ | ||
| 623 | pci_read_config_byte(isa_dev, 0x5e, &tmpbyte); | ||
| 624 | chip_is_1543c_e = ((tmpbyte & 0x1e) == 0x12) ? 1: 0; | ||
| 625 | } | 649 | } |
| 626 | 650 | ||
| 627 | /* | ||
| 628 | * CD_ROM DMA on (m5229, 0x53, bit0) | ||
| 629 | * Enable this bit even if we want to use PIO | ||
| 630 | * PIO FIFO off (m5229, 0x53, bit1) | ||
| 631 | * The hardware will use 0x54h and 0x55h to control PIO FIFO | ||
| 632 | * (Not on later devices it seems) | ||
| 633 | * | ||
| 634 | * 0x53 changes meaning on later revs - we must no touch | ||
| 635 | * bit 1 on them. Need to check if 0x20 is the right break | ||
| 636 | */ | ||
| 637 | |||
| 638 | pci_read_config_byte(dev, 0x53, &tmpbyte); | ||
| 639 | |||
| 640 | if(m5229_revision <= 0x20) | ||
| 641 | tmpbyte = (tmpbyte & (~0x02)) | 0x01; | ||
| 642 | else if (m5229_revision == 0xc7 || m5229_revision == 0xc8) | ||
| 643 | tmpbyte |= 0x03; | ||
| 644 | else | ||
| 645 | tmpbyte |= 0x01; | ||
| 646 | |||
| 647 | pci_write_config_byte(dev, 0x53, tmpbyte); | ||
| 648 | |||
| 649 | local_irq_restore(flags); | 651 | local_irq_restore(flags); |
| 650 | 652 | ||
| 651 | return cbl; | 653 | return cbl; |
| @@ -664,31 +666,9 @@ static void __devinit init_hwif_common_ali15x3 (ide_hwif_t *hwif) | |||
| 664 | hwif->set_dma_mode = &ali_set_dma_mode; | 666 | hwif->set_dma_mode = &ali_set_dma_mode; |
| 665 | hwif->udma_filter = &ali_udma_filter; | 667 | hwif->udma_filter = &ali_udma_filter; |
| 666 | 668 | ||
| 667 | /* don't use LBA48 DMA on ALi devices before rev 0xC5 */ | ||
| 668 | if (m5229_revision <= 0xC4) | ||
| 669 | hwif->host_flags |= IDE_HFLAG_NO_LBA48_DMA; | ||
| 670 | |||
| 671 | if (hwif->dma_base == 0) | 669 | if (hwif->dma_base == 0) |
| 672 | return; | 670 | return; |
| 673 | 671 | ||
| 674 | /* | ||
| 675 | * check in ->init_dma guarantees m5229_revision >= 0x20 here | ||
| 676 | */ | ||
| 677 | |||
| 678 | if (m5229_revision == 0x20) | ||
| 679 | hwif->host_flags |= IDE_HFLAG_NO_ATAPI_DMA; | ||
| 680 | |||
| 681 | if (m5229_revision <= 0x20) | ||
| 682 | hwif->ultra_mask = 0x00; /* no udma */ | ||
| 683 | else if (m5229_revision < 0xC2) | ||
| 684 | hwif->ultra_mask = ATA_UDMA2; | ||
| 685 | else if (m5229_revision == 0xC2 || m5229_revision == 0xC3) | ||
| 686 | hwif->ultra_mask = ATA_UDMA4; | ||
| 687 | else if (m5229_revision == 0xC4) | ||
| 688 | hwif->ultra_mask = ATA_UDMA5; | ||
| 689 | else | ||
| 690 | hwif->ultra_mask = ATA_UDMA6; | ||
| 691 | |||
| 692 | hwif->dma_setup = &ali15x3_dma_setup; | 672 | hwif->dma_setup = &ali15x3_dma_setup; |
| 693 | 673 | ||
| 694 | if (hwif->cbl != ATA_CBL_PATA40_SHORT) | 674 | if (hwif->cbl != ATA_CBL_PATA40_SHORT) |
| @@ -766,7 +746,7 @@ static void __devinit init_dma_ali15x3 (ide_hwif_t *hwif, unsigned long dmabase) | |||
| 766 | ide_setup_dma(hwif, dmabase, 8); | 746 | ide_setup_dma(hwif, dmabase, 8); |
| 767 | } | 747 | } |
| 768 | 748 | ||
| 769 | static ide_pci_device_t ali15x3_chipset __devinitdata = { | 749 | static const struct ide_port_info ali15x3_chipset __devinitdata = { |
| 770 | .name = "ALI15X3", | 750 | .name = "ALI15X3", |
| 771 | .init_chipset = init_chipset_ali15x3, | 751 | .init_chipset = init_chipset_ali15x3, |
| 772 | .init_hwif = init_hwif_ali15x3, | 752 | .init_hwif = init_hwif_ali15x3, |
| @@ -792,15 +772,34 @@ static int __devinit alim15x3_init_one(struct pci_dev *dev, const struct pci_dev | |||
| 792 | { }, | 772 | { }, |
| 793 | }; | 773 | }; |
| 794 | 774 | ||
| 795 | ide_pci_device_t *d = &ali15x3_chipset; | 775 | struct ide_port_info d = ali15x3_chipset; |
| 776 | u8 rev = dev->revision; | ||
| 796 | 777 | ||
| 797 | if (pci_dev_present(ati_rs100)) | 778 | if (pci_dev_present(ati_rs100)) |
| 798 | printk(KERN_WARNING "alim15x3: ATI Radeon IGP Northbridge is not yet fully tested.\n"); | 779 | printk(KERN_WARNING "alim15x3: ATI Radeon IGP Northbridge is not yet fully tested.\n"); |
| 799 | 780 | ||
| 781 | /* don't use LBA48 DMA on ALi devices before rev 0xC5 */ | ||
| 782 | if (rev <= 0xC4) | ||
| 783 | d.host_flags |= IDE_HFLAG_NO_LBA48_DMA; | ||
| 784 | |||
| 785 | if (rev >= 0x20) { | ||
| 786 | if (rev == 0x20) | ||
| 787 | d.host_flags |= IDE_HFLAG_NO_ATAPI_DMA; | ||
| 788 | |||
| 789 | if (rev < 0xC2) | ||
| 790 | d.udma_mask = ATA_UDMA2; | ||
| 791 | else if (rev == 0xC2 || rev == 0xC3) | ||
| 792 | d.udma_mask = ATA_UDMA4; | ||
| 793 | else if (rev == 0xC4) | ||
| 794 | d.udma_mask = ATA_UDMA5; | ||
| 795 | else | ||
| 796 | d.udma_mask = ATA_UDMA6; | ||
| 797 | } | ||
| 798 | |||
| 800 | #if defined(CONFIG_SPARC64) | 799 | #if defined(CONFIG_SPARC64) |
| 801 | d->init_hwif = init_hwif_common_ali15x3; | 800 | d.init_hwif = init_hwif_common_ali15x3; |
| 802 | #endif /* CONFIG_SPARC64 */ | 801 | #endif /* CONFIG_SPARC64 */ |
| 803 | return ide_setup_pci_device(dev, d); | 802 | return ide_setup_pci_device(dev, &d); |
| 804 | } | 803 | } |
| 805 | 804 | ||
| 806 | 805 | ||
diff --git a/drivers/ide/pci/amd74xx.c b/drivers/ide/pci/amd74xx.c index 7cafefbf6c1b..8d4125ec252c 100644 --- a/drivers/ide/pci/amd74xx.c +++ b/drivers/ide/pci/amd74xx.c | |||
| @@ -77,7 +77,7 @@ static struct amd_ide_chip { | |||
| 77 | }; | 77 | }; |
| 78 | 78 | ||
| 79 | static struct amd_ide_chip *amd_config; | 79 | static struct amd_ide_chip *amd_config; |
| 80 | static ide_pci_device_t *amd_chipset; | 80 | static const struct ide_port_info *amd_chipset; |
| 81 | static unsigned int amd_80w; | 81 | static unsigned int amd_80w; |
| 82 | static unsigned int amd_clock; | 82 | static unsigned int amd_clock; |
| 83 | 83 | ||
| @@ -242,19 +242,12 @@ static unsigned int __devinit init_chipset_amd74xx(struct pci_dev *dev, const ch | |||
| 242 | 242 | ||
| 243 | static void __devinit init_hwif_amd74xx(ide_hwif_t *hwif) | 243 | static void __devinit init_hwif_amd74xx(ide_hwif_t *hwif) |
| 244 | { | 244 | { |
| 245 | int i; | ||
| 246 | |||
| 247 | if (hwif->irq == 0) /* 0 is bogus but will do for now */ | 245 | if (hwif->irq == 0) /* 0 is bogus but will do for now */ |
| 248 | hwif->irq = pci_get_legacy_ide_irq(hwif->pci_dev, hwif->channel); | 246 | hwif->irq = pci_get_legacy_ide_irq(hwif->pci_dev, hwif->channel); |
| 249 | 247 | ||
| 250 | hwif->set_pio_mode = &amd_set_pio_mode; | 248 | hwif->set_pio_mode = &amd_set_pio_mode; |
| 251 | hwif->set_dma_mode = &amd_set_drive; | 249 | hwif->set_dma_mode = &amd_set_drive; |
| 252 | 250 | ||
| 253 | for (i = 0; i < 2; i++) { | ||
| 254 | hwif->drives[i].io_32bit = 1; | ||
| 255 | hwif->drives[i].unmask = 1; | ||
| 256 | } | ||
| 257 | |||
| 258 | if (!hwif->dma_base) | 251 | if (!hwif->dma_base) |
| 259 | return; | 252 | return; |
| 260 | 253 | ||
| @@ -270,16 +263,21 @@ static void __devinit init_hwif_amd74xx(ide_hwif_t *hwif) | |||
| 270 | } | 263 | } |
| 271 | } | 264 | } |
| 272 | 265 | ||
| 266 | #define IDE_HFLAGS_AMD \ | ||
| 267 | (IDE_HFLAG_PIO_NO_BLACKLIST | \ | ||
| 268 | IDE_HFLAG_PIO_NO_DOWNGRADE | \ | ||
| 269 | IDE_HFLAG_POST_SET_MODE | \ | ||
| 270 | IDE_HFLAG_IO_32BIT | \ | ||
| 271 | IDE_HFLAG_UNMASK_IRQS | \ | ||
| 272 | IDE_HFLAG_BOOTABLE) | ||
| 273 | |||
| 273 | #define DECLARE_AMD_DEV(name_str) \ | 274 | #define DECLARE_AMD_DEV(name_str) \ |
| 274 | { \ | 275 | { \ |
| 275 | .name = name_str, \ | 276 | .name = name_str, \ |
| 276 | .init_chipset = init_chipset_amd74xx, \ | 277 | .init_chipset = init_chipset_amd74xx, \ |
| 277 | .init_hwif = init_hwif_amd74xx, \ | 278 | .init_hwif = init_hwif_amd74xx, \ |
| 278 | .enablebits = {{0x40,0x02,0x02}, {0x40,0x01,0x01}}, \ | 279 | .enablebits = {{0x40,0x02,0x02}, {0x40,0x01,0x01}}, \ |
| 279 | .host_flags = IDE_HFLAG_PIO_NO_BLACKLIST | \ | 280 | .host_flags = IDE_HFLAGS_AMD, \ |
| 280 | IDE_HFLAG_PIO_NO_DOWNGRADE | \ | ||
| 281 | IDE_HFLAG_POST_SET_MODE | \ | ||
| 282 | IDE_HFLAG_BOOTABLE, \ | ||
| 283 | .pio_mask = ATA_PIO5, \ | 281 | .pio_mask = ATA_PIO5, \ |
| 284 | .swdma_mask = ATA_SWDMA2, \ | 282 | .swdma_mask = ATA_SWDMA2, \ |
| 285 | .mwdma_mask = ATA_MWDMA2, \ | 283 | .mwdma_mask = ATA_MWDMA2, \ |
| @@ -291,16 +289,13 @@ static void __devinit init_hwif_amd74xx(ide_hwif_t *hwif) | |||
| 291 | .init_chipset = init_chipset_amd74xx, \ | 289 | .init_chipset = init_chipset_amd74xx, \ |
| 292 | .init_hwif = init_hwif_amd74xx, \ | 290 | .init_hwif = init_hwif_amd74xx, \ |
| 293 | .enablebits = {{0x50,0x02,0x02}, {0x50,0x01,0x01}}, \ | 291 | .enablebits = {{0x50,0x02,0x02}, {0x50,0x01,0x01}}, \ |
| 294 | .host_flags = IDE_HFLAG_PIO_NO_BLACKLIST | \ | 292 | .host_flags = IDE_HFLAGS_AMD, \ |
| 295 | IDE_HFLAG_PIO_NO_DOWNGRADE | \ | ||
| 296 | IDE_HFLAG_POST_SET_MODE | \ | ||
| 297 | IDE_HFLAG_BOOTABLE, \ | ||
| 298 | .pio_mask = ATA_PIO5, \ | 293 | .pio_mask = ATA_PIO5, \ |
| 299 | .swdma_mask = ATA_SWDMA2, \ | 294 | .swdma_mask = ATA_SWDMA2, \ |
| 300 | .mwdma_mask = ATA_MWDMA2, \ | 295 | .mwdma_mask = ATA_MWDMA2, \ |
| 301 | } | 296 | } |
| 302 | 297 | ||
| 303 | static ide_pci_device_t amd74xx_chipsets[] __devinitdata = { | 298 | static const struct ide_port_info amd74xx_chipsets[] __devinitdata = { |
| 304 | /* 0 */ DECLARE_AMD_DEV("AMD7401"), | 299 | /* 0 */ DECLARE_AMD_DEV("AMD7401"), |
| 305 | /* 1 */ DECLARE_AMD_DEV("AMD7409"), | 300 | /* 1 */ DECLARE_AMD_DEV("AMD7409"), |
| 306 | /* 2 */ DECLARE_AMD_DEV("AMD7411"), | 301 | /* 2 */ DECLARE_AMD_DEV("AMD7411"), |
diff --git a/drivers/ide/pci/atiixp.c b/drivers/ide/pci/atiixp.c index 307843053078..ef8e0164ef7a 100644 --- a/drivers/ide/pci/atiixp.c +++ b/drivers/ide/pci/atiixp.c | |||
| @@ -189,8 +189,7 @@ static void __devinit init_hwif_atiixp(ide_hwif_t *hwif) | |||
| 189 | hwif->dma_host_off = &atiixp_dma_host_off; | 189 | hwif->dma_host_off = &atiixp_dma_host_off; |
| 190 | } | 190 | } |
| 191 | 191 | ||
| 192 | 192 | static const struct ide_port_info atiixp_pci_info[] __devinitdata = { | |
| 193 | static ide_pci_device_t atiixp_pci_info[] __devinitdata = { | ||
| 194 | { /* 0 */ | 193 | { /* 0 */ |
| 195 | .name = "ATIIXP", | 194 | .name = "ATIIXP", |
| 196 | .init_hwif = init_hwif_atiixp, | 195 | .init_hwif = init_hwif_atiixp, |
diff --git a/drivers/ide/pci/cmd640.c b/drivers/ide/pci/cmd640.c index f369645e4d16..4aa48104e0c1 100644 --- a/drivers/ide/pci/cmd640.c +++ b/drivers/ide/pci/cmd640.c | |||
| @@ -185,6 +185,8 @@ static u8 recovery_counts[4] = {16, 16, 16, 16}; /* Recovery count (encoded) */ | |||
| 185 | 185 | ||
| 186 | #endif /* CONFIG_BLK_DEV_CMD640_ENHANCED */ | 186 | #endif /* CONFIG_BLK_DEV_CMD640_ENHANCED */ |
| 187 | 187 | ||
| 188 | static DEFINE_SPINLOCK(cmd640_lock); | ||
| 189 | |||
| 188 | /* | 190 | /* |
| 189 | * These are initialized to point at the devices we control | 191 | * These are initialized to point at the devices we control |
| 190 | */ | 192 | */ |
| @@ -258,12 +260,12 @@ static u8 get_cmd640_reg_vlb (u16 reg) | |||
| 258 | 260 | ||
| 259 | static u8 get_cmd640_reg(u16 reg) | 261 | static u8 get_cmd640_reg(u16 reg) |
| 260 | { | 262 | { |
| 261 | u8 b; | ||
| 262 | unsigned long flags; | 263 | unsigned long flags; |
| 264 | u8 b; | ||
| 263 | 265 | ||
| 264 | spin_lock_irqsave(&ide_lock, flags); | 266 | spin_lock_irqsave(&cmd640_lock, flags); |
| 265 | b = __get_cmd640_reg(reg); | 267 | b = __get_cmd640_reg(reg); |
| 266 | spin_unlock_irqrestore(&ide_lock, flags); | 268 | spin_unlock_irqrestore(&cmd640_lock, flags); |
| 267 | return b; | 269 | return b; |
| 268 | } | 270 | } |
| 269 | 271 | ||
| @@ -271,9 +273,9 @@ static void put_cmd640_reg(u16 reg, u8 val) | |||
| 271 | { | 273 | { |
| 272 | unsigned long flags; | 274 | unsigned long flags; |
| 273 | 275 | ||
| 274 | spin_lock_irqsave(&ide_lock, flags); | 276 | spin_lock_irqsave(&cmd640_lock, flags); |
| 275 | __put_cmd640_reg(reg,val); | 277 | __put_cmd640_reg(reg,val); |
| 276 | spin_unlock_irqrestore(&ide_lock, flags); | 278 | spin_unlock_irqrestore(&cmd640_lock, flags); |
| 277 | } | 279 | } |
| 278 | 280 | ||
| 279 | static int __init match_pci_cmd640_device (void) | 281 | static int __init match_pci_cmd640_device (void) |
| @@ -351,7 +353,7 @@ static int __init secondary_port_responding (void) | |||
| 351 | { | 353 | { |
| 352 | unsigned long flags; | 354 | unsigned long flags; |
| 353 | 355 | ||
| 354 | spin_lock_irqsave(&ide_lock, flags); | 356 | spin_lock_irqsave(&cmd640_lock, flags); |
| 355 | 357 | ||
| 356 | outb_p(0x0a, 0x170 + IDE_SELECT_OFFSET); /* select drive0 */ | 358 | outb_p(0x0a, 0x170 + IDE_SELECT_OFFSET); /* select drive0 */ |
| 357 | udelay(100); | 359 | udelay(100); |
| @@ -359,11 +361,11 @@ static int __init secondary_port_responding (void) | |||
| 359 | outb_p(0x1a, 0x170 + IDE_SELECT_OFFSET); /* select drive1 */ | 361 | outb_p(0x1a, 0x170 + IDE_SELECT_OFFSET); /* select drive1 */ |
| 360 | udelay(100); | 362 | udelay(100); |
| 361 | if ((inb_p(0x170 + IDE_SELECT_OFFSET) & 0x1f) != 0x1a) { | 363 | if ((inb_p(0x170 + IDE_SELECT_OFFSET) & 0x1f) != 0x1a) { |
| 362 | spin_unlock_irqrestore(&ide_lock, flags); | 364 | spin_unlock_irqrestore(&cmd640_lock, flags); |
| 363 | return 0; /* nothing responded */ | 365 | return 0; /* nothing responded */ |
| 364 | } | 366 | } |
| 365 | } | 367 | } |
| 366 | spin_unlock_irqrestore(&ide_lock, flags); | 368 | spin_unlock_irqrestore(&cmd640_lock, flags); |
| 367 | return 1; /* success */ | 369 | return 1; /* success */ |
| 368 | } | 370 | } |
| 369 | 371 | ||
| @@ -440,11 +442,11 @@ static void __init setup_device_ptrs (void) | |||
| 440 | static void set_prefetch_mode (unsigned int index, int mode) | 442 | static void set_prefetch_mode (unsigned int index, int mode) |
| 441 | { | 443 | { |
| 442 | ide_drive_t *drive = cmd_drives[index]; | 444 | ide_drive_t *drive = cmd_drives[index]; |
| 445 | unsigned long flags; | ||
| 443 | int reg = prefetch_regs[index]; | 446 | int reg = prefetch_regs[index]; |
| 444 | u8 b; | 447 | u8 b; |
| 445 | unsigned long flags; | ||
| 446 | 448 | ||
| 447 | spin_lock_irqsave(&ide_lock, flags); | 449 | spin_lock_irqsave(&cmd640_lock, flags); |
| 448 | b = __get_cmd640_reg(reg); | 450 | b = __get_cmd640_reg(reg); |
| 449 | if (mode) { /* want prefetch on? */ | 451 | if (mode) { /* want prefetch on? */ |
| 450 | #if CMD640_PREFETCH_MASKS | 452 | #if CMD640_PREFETCH_MASKS |
| @@ -460,7 +462,7 @@ static void set_prefetch_mode (unsigned int index, int mode) | |||
| 460 | b |= prefetch_masks[index]; /* disable prefetch */ | 462 | b |= prefetch_masks[index]; /* disable prefetch */ |
| 461 | } | 463 | } |
| 462 | __put_cmd640_reg(reg, b); | 464 | __put_cmd640_reg(reg, b); |
| 463 | spin_unlock_irqrestore(&ide_lock, flags); | 465 | spin_unlock_irqrestore(&cmd640_lock, flags); |
| 464 | } | 466 | } |
| 465 | 467 | ||
| 466 | /* | 468 | /* |
| @@ -561,7 +563,7 @@ static void program_drive_counts (unsigned int index) | |||
| 561 | /* | 563 | /* |
| 562 | * Now that everything is ready, program the new timings | 564 | * Now that everything is ready, program the new timings |
| 563 | */ | 565 | */ |
| 564 | spin_lock_irqsave(&ide_lock, flags); | 566 | spin_lock_irqsave(&cmd640_lock, flags); |
| 565 | /* | 567 | /* |
| 566 | * Program the address_setup clocks into ARTTIM reg, | 568 | * Program the address_setup clocks into ARTTIM reg, |
| 567 | * and then the active/recovery counts into the DRWTIM reg | 569 | * and then the active/recovery counts into the DRWTIM reg |
| @@ -570,7 +572,7 @@ static void program_drive_counts (unsigned int index) | |||
| 570 | setup_count |= __get_cmd640_reg(arttim_regs[index]) & 0x3f; | 572 | setup_count |= __get_cmd640_reg(arttim_regs[index]) & 0x3f; |
| 571 | __put_cmd640_reg(arttim_regs[index], setup_count); | 573 | __put_cmd640_reg(arttim_regs[index], setup_count); |
| 572 | __put_cmd640_reg(drwtim_regs[index], pack_nibbles(active_count, recovery_count)); | 574 | __put_cmd640_reg(drwtim_regs[index], pack_nibbles(active_count, recovery_count)); |
| 573 | spin_unlock_irqrestore(&ide_lock, flags); | 575 | spin_unlock_irqrestore(&cmd640_lock, flags); |
| 574 | } | 576 | } |
| 575 | 577 | ||
| 576 | /* | 578 | /* |
| @@ -670,20 +672,20 @@ static void cmd640_set_pio_mode(ide_drive_t *drive, const u8 pio) | |||
| 670 | 672 | ||
| 671 | static int pci_conf1(void) | 673 | static int pci_conf1(void) |
| 672 | { | 674 | { |
| 673 | u32 tmp; | ||
| 674 | unsigned long flags; | 675 | unsigned long flags; |
| 676 | u32 tmp; | ||
| 675 | 677 | ||
| 676 | spin_lock_irqsave(&ide_lock, flags); | 678 | spin_lock_irqsave(&cmd640_lock, flags); |
| 677 | outb(0x01, 0xCFB); | 679 | outb(0x01, 0xCFB); |
| 678 | tmp = inl(0xCF8); | 680 | tmp = inl(0xCF8); |
| 679 | outl(0x80000000, 0xCF8); | 681 | outl(0x80000000, 0xCF8); |
| 680 | if (inl(0xCF8) == 0x80000000) { | 682 | if (inl(0xCF8) == 0x80000000) { |
| 681 | outl(tmp, 0xCF8); | 683 | outl(tmp, 0xCF8); |
| 682 | spin_unlock_irqrestore(&ide_lock, flags); | 684 | spin_unlock_irqrestore(&cmd640_lock, flags); |
| 683 | return 1; | 685 | return 1; |
| 684 | } | 686 | } |
| 685 | outl(tmp, 0xCF8); | 687 | outl(tmp, 0xCF8); |
| 686 | spin_unlock_irqrestore(&ide_lock, flags); | 688 | spin_unlock_irqrestore(&cmd640_lock, flags); |
| 687 | return 0; | 689 | return 0; |
| 688 | } | 690 | } |
| 689 | 691 | ||
| @@ -691,15 +693,15 @@ static int pci_conf2(void) | |||
| 691 | { | 693 | { |
| 692 | unsigned long flags; | 694 | unsigned long flags; |
| 693 | 695 | ||
| 694 | spin_lock_irqsave(&ide_lock, flags); | 696 | spin_lock_irqsave(&cmd640_lock, flags); |
| 695 | outb(0x00, 0xCFB); | 697 | outb(0x00, 0xCFB); |
| 696 | outb(0x00, 0xCF8); | 698 | outb(0x00, 0xCF8); |
| 697 | outb(0x00, 0xCFA); | 699 | outb(0x00, 0xCFA); |
| 698 | if (inb(0xCF8) == 0x00 && inb(0xCF8) == 0x00) { | 700 | if (inb(0xCF8) == 0x00 && inb(0xCF8) == 0x00) { |
| 699 | spin_unlock_irqrestore(&ide_lock, flags); | 701 | spin_unlock_irqrestore(&cmd640_lock, flags); |
| 700 | return 1; | 702 | return 1; |
| 701 | } | 703 | } |
| 702 | spin_unlock_irqrestore(&ide_lock, flags); | 704 | spin_unlock_irqrestore(&cmd640_lock, flags); |
| 703 | return 0; | 705 | return 0; |
| 704 | } | 706 | } |
| 705 | 707 | ||
diff --git a/drivers/ide/pci/cmd64x.c b/drivers/ide/pci/cmd64x.c index adee2ef6fd71..ea0143ef5fe5 100644 --- a/drivers/ide/pci/cmd64x.c +++ b/drivers/ide/pci/cmd64x.c | |||
| @@ -535,7 +535,6 @@ static void __devinit init_hwif_cmd64x(ide_hwif_t *hwif) | |||
| 535 | hwif->ide_dma_test_irq = &cmd648_ide_dma_test_irq; | 535 | hwif->ide_dma_test_irq = &cmd648_ide_dma_test_irq; |
| 536 | break; | 536 | break; |
| 537 | case PCI_DEVICE_ID_CMD_646: | 537 | case PCI_DEVICE_ID_CMD_646: |
| 538 | hwif->chipset = ide_cmd646; | ||
| 539 | if (dev->revision == 0x01) { | 538 | if (dev->revision == 0x01) { |
| 540 | hwif->ide_dma_end = &cmd646_1_ide_dma_end; | 539 | hwif->ide_dma_end = &cmd646_1_ide_dma_end; |
| 541 | break; | 540 | break; |
| @@ -549,7 +548,7 @@ static void __devinit init_hwif_cmd64x(ide_hwif_t *hwif) | |||
| 549 | } | 548 | } |
| 550 | } | 549 | } |
| 551 | 550 | ||
| 552 | static ide_pci_device_t cmd64x_chipsets[] __devinitdata = { | 551 | static const struct ide_port_info cmd64x_chipsets[] __devinitdata = { |
| 553 | { /* 0 */ | 552 | { /* 0 */ |
| 554 | .name = "CMD643", | 553 | .name = "CMD643", |
| 555 | .init_chipset = init_chipset_cmd64x, | 554 | .init_chipset = init_chipset_cmd64x, |
| @@ -573,6 +572,7 @@ static ide_pci_device_t cmd64x_chipsets[] __devinitdata = { | |||
| 573 | .init_chipset = init_chipset_cmd64x, | 572 | .init_chipset = init_chipset_cmd64x, |
| 574 | .init_hwif = init_hwif_cmd64x, | 573 | .init_hwif = init_hwif_cmd64x, |
| 575 | .enablebits = {{0x51,0x04,0x04}, {0x51,0x08,0x08}}, | 574 | .enablebits = {{0x51,0x04,0x04}, {0x51,0x08,0x08}}, |
| 575 | .chipset = ide_cmd646, | ||
| 576 | .host_flags = IDE_HFLAG_ABUSE_PREFETCH | IDE_HFLAG_BOOTABLE, | 576 | .host_flags = IDE_HFLAG_ABUSE_PREFETCH | IDE_HFLAG_BOOTABLE, |
| 577 | .pio_mask = ATA_PIO5, | 577 | .pio_mask = ATA_PIO5, |
| 578 | .mwdma_mask = ATA_MWDMA2, | 578 | .mwdma_mask = ATA_MWDMA2, |
| @@ -591,7 +591,7 @@ static ide_pci_device_t cmd64x_chipsets[] __devinitdata = { | |||
| 591 | 591 | ||
| 592 | static int __devinit cmd64x_init_one(struct pci_dev *dev, const struct pci_device_id *id) | 592 | static int __devinit cmd64x_init_one(struct pci_dev *dev, const struct pci_device_id *id) |
| 593 | { | 593 | { |
| 594 | ide_pci_device_t d; | 594 | struct ide_port_info d; |
| 595 | u8 idx = id->driver_data; | 595 | u8 idx = id->driver_data; |
| 596 | 596 | ||
| 597 | d = cmd64x_chipsets[idx]; | 597 | d = cmd64x_chipsets[idx]; |
diff --git a/drivers/ide/pci/cs5520.c b/drivers/ide/pci/cs5520.c index aa98e817d385..0466462fd21b 100644 --- a/drivers/ide/pci/cs5520.c +++ b/drivers/ide/pci/cs5520.c | |||
| @@ -141,7 +141,7 @@ static void __devinit init_hwif_cs5520(ide_hwif_t *hwif) | |||
| 141 | .pio_mask = ATA_PIO4, \ | 141 | .pio_mask = ATA_PIO4, \ |
| 142 | } | 142 | } |
| 143 | 143 | ||
| 144 | static ide_pci_device_t cyrix_chipsets[] __devinitdata = { | 144 | static const struct ide_port_info cyrix_chipsets[] __devinitdata = { |
| 145 | /* 0 */ DECLARE_CS_DEV("Cyrix 5510"), | 145 | /* 0 */ DECLARE_CS_DEV("Cyrix 5510"), |
| 146 | /* 1 */ DECLARE_CS_DEV("Cyrix 5520") | 146 | /* 1 */ DECLARE_CS_DEV("Cyrix 5520") |
| 147 | }; | 147 | }; |
| @@ -154,9 +154,8 @@ static ide_pci_device_t cyrix_chipsets[] __devinitdata = { | |||
| 154 | 154 | ||
| 155 | static int __devinit cs5520_init_one(struct pci_dev *dev, const struct pci_device_id *id) | 155 | static int __devinit cs5520_init_one(struct pci_dev *dev, const struct pci_device_id *id) |
| 156 | { | 156 | { |
| 157 | ide_hwif_t *hwif = NULL, *mate = NULL; | 157 | const struct ide_port_info *d = &cyrix_chipsets[id->driver_data]; |
| 158 | ata_index_t index; | 158 | u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; |
| 159 | ide_pci_device_t *d = &cyrix_chipsets[id->driver_data]; | ||
| 160 | 159 | ||
| 161 | ide_setup_pci_noise(dev, d); | 160 | ide_setup_pci_noise(dev, d); |
| 162 | 161 | ||
| @@ -172,29 +171,14 @@ static int __devinit cs5520_init_one(struct pci_dev *dev, const struct pci_devic | |||
| 172 | return -ENODEV; | 171 | return -ENODEV; |
| 173 | } | 172 | } |
| 174 | 173 | ||
| 175 | index.all = 0xf0f0; | ||
| 176 | |||
| 177 | /* | 174 | /* |
| 178 | * Now the chipset is configured we can let the core | 175 | * Now the chipset is configured we can let the core |
| 179 | * do all the device setup for us | 176 | * do all the device setup for us |
| 180 | */ | 177 | */ |
| 181 | 178 | ||
| 182 | ide_pci_setup_ports(dev, d, 14, &index); | 179 | ide_pci_setup_ports(dev, d, 14, &idx[0]); |
| 183 | |||
| 184 | if ((index.b.low & 0xf0) != 0xf0) | ||
| 185 | hwif = &ide_hwifs[index.b.low]; | ||
| 186 | if ((index.b.high & 0xf0) != 0xf0) | ||
| 187 | mate = &ide_hwifs[index.b.high]; | ||
| 188 | |||
| 189 | if (hwif) | ||
| 190 | probe_hwif_init(hwif); | ||
| 191 | if (mate) | ||
| 192 | probe_hwif_init(mate); | ||
| 193 | 180 | ||
| 194 | if (hwif) | 181 | ide_device_add(idx); |
| 195 | ide_proc_register_port(hwif); | ||
| 196 | if (mate) | ||
| 197 | ide_proc_register_port(mate); | ||
| 198 | 182 | ||
| 199 | return 0; | 183 | return 0; |
| 200 | } | 184 | } |
diff --git a/drivers/ide/pci/cs5530.c b/drivers/ide/pci/cs5530.c index ba0c6eba024b..599408952bd4 100644 --- a/drivers/ide/pci/cs5530.c +++ b/drivers/ide/pci/cs5530.c | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * linux/drivers/ide/pci/cs5530.c Version 0.76 Aug 3 2007 | 2 | * linux/drivers/ide/pci/cs5530.c Version 0.77 Sep 24 2007 |
| 3 | * | 3 | * |
| 4 | * Copyright (C) 2000 Andre Hedrick <andre@linux-ide.org> | 4 | * Copyright (C) 2000 Andre Hedrick <andre@linux-ide.org> |
| 5 | * Copyright (C) 2000 Mark Lord <mlord@pobox.com> | 5 | * Copyright (C) 2000 Mark Lord <mlord@pobox.com> |
| @@ -146,7 +146,6 @@ static void cs5530_set_dma_mode(ide_drive_t *drive, const u8 mode) | |||
| 146 | static unsigned int __devinit init_chipset_cs5530 (struct pci_dev *dev, const char *name) | 146 | static unsigned int __devinit init_chipset_cs5530 (struct pci_dev *dev, const char *name) |
| 147 | { | 147 | { |
| 148 | struct pci_dev *master_0 = NULL, *cs5530_0 = NULL; | 148 | struct pci_dev *master_0 = NULL, *cs5530_0 = NULL; |
| 149 | unsigned long flags; | ||
| 150 | 149 | ||
| 151 | if (pci_resource_start(dev, 4) == 0) | 150 | if (pci_resource_start(dev, 4) == 0) |
| 152 | return -EFAULT; | 151 | return -EFAULT; |
| @@ -171,9 +170,6 @@ static unsigned int __devinit init_chipset_cs5530 (struct pci_dev *dev, const ch | |||
| 171 | goto out; | 170 | goto out; |
| 172 | } | 171 | } |
| 173 | 172 | ||
| 174 | spin_lock_irqsave(&ide_lock, flags); | ||
| 175 | /* all CPUs (there should only be one CPU with this chipset) */ | ||
| 176 | |||
| 177 | /* | 173 | /* |
| 178 | * Enable BusMaster and MemoryWriteAndInvalidate for the cs5530: | 174 | * Enable BusMaster and MemoryWriteAndInvalidate for the cs5530: |
| 179 | * --> OR 0x14 into 16-bit PCI COMMAND reg of function 0 of the cs5530 | 175 | * --> OR 0x14 into 16-bit PCI COMMAND reg of function 0 of the cs5530 |
| @@ -224,8 +220,6 @@ static unsigned int __devinit init_chipset_cs5530 (struct pci_dev *dev, const ch | |||
| 224 | pci_write_config_byte(master_0, 0x42, 0x00); | 220 | pci_write_config_byte(master_0, 0x42, 0x00); |
| 225 | pci_write_config_byte(master_0, 0x43, 0xc1); | 221 | pci_write_config_byte(master_0, 0x43, 0xc1); |
| 226 | 222 | ||
| 227 | spin_unlock_irqrestore(&ide_lock, flags); | ||
| 228 | |||
| 229 | out: | 223 | out: |
| 230 | pci_dev_put(master_0); | 224 | pci_dev_put(master_0); |
| 231 | pci_dev_put(cs5530_0); | 225 | pci_dev_put(cs5530_0); |
| @@ -261,7 +255,7 @@ static void __devinit init_hwif_cs5530 (ide_hwif_t *hwif) | |||
| 261 | hwif->udma_filter = cs5530_udma_filter; | 255 | hwif->udma_filter = cs5530_udma_filter; |
| 262 | } | 256 | } |
| 263 | 257 | ||
| 264 | static ide_pci_device_t cs5530_chipset __devinitdata = { | 258 | static const struct ide_port_info cs5530_chipset __devinitdata = { |
| 265 | .name = "CS5530", | 259 | .name = "CS5530", |
| 266 | .init_chipset = init_chipset_cs5530, | 260 | .init_chipset = init_chipset_cs5530, |
| 267 | .init_hwif = init_hwif_cs5530, | 261 | .init_hwif = init_hwif_cs5530, |
diff --git a/drivers/ide/pci/cs5535.c b/drivers/ide/pci/cs5535.c index 5ac82ffa5c09..9094916e3780 100644 --- a/drivers/ide/pci/cs5535.c +++ b/drivers/ide/pci/cs5535.c | |||
| @@ -186,7 +186,7 @@ static void __devinit init_hwif_cs5535(ide_hwif_t *hwif) | |||
| 186 | hwif->cbl = cs5535_cable_detect(hwif->pci_dev); | 186 | hwif->cbl = cs5535_cable_detect(hwif->pci_dev); |
| 187 | } | 187 | } |
| 188 | 188 | ||
| 189 | static ide_pci_device_t cs5535_chipset __devinitdata = { | 189 | static const struct ide_port_info cs5535_chipset __devinitdata = { |
| 190 | .name = "CS5535", | 190 | .name = "CS5535", |
| 191 | .init_hwif = init_hwif_cs5535, | 191 | .init_hwif = init_hwif_cs5535, |
| 192 | .host_flags = IDE_HFLAG_SINGLE | IDE_HFLAG_POST_SET_MODE | | 192 | .host_flags = IDE_HFLAG_SINGLE | IDE_HFLAG_POST_SET_MODE | |
diff --git a/drivers/ide/pci/cy82c693.c b/drivers/ide/pci/cy82c693.c index efc20bd97fd5..3ef4fc10fe2c 100644 --- a/drivers/ide/pci/cy82c693.c +++ b/drivers/ide/pci/cy82c693.c | |||
| @@ -428,7 +428,6 @@ static unsigned int __devinit init_chipset_cy82c693(struct pci_dev *dev, const c | |||
| 428 | */ | 428 | */ |
| 429 | static void __devinit init_hwif_cy82c693(ide_hwif_t *hwif) | 429 | static void __devinit init_hwif_cy82c693(ide_hwif_t *hwif) |
| 430 | { | 430 | { |
| 431 | hwif->chipset = ide_cy82c693; | ||
| 432 | hwif->set_pio_mode = &cy82c693_set_pio_mode; | 431 | hwif->set_pio_mode = &cy82c693_set_pio_mode; |
| 433 | 432 | ||
| 434 | if (hwif->dma_base == 0) | 433 | if (hwif->dma_base == 0) |
| @@ -449,11 +448,12 @@ static void __devinit init_iops_cy82c693(ide_hwif_t *hwif) | |||
| 449 | } | 448 | } |
| 450 | } | 449 | } |
| 451 | 450 | ||
| 452 | static ide_pci_device_t cy82c693_chipset __devinitdata = { | 451 | static const struct ide_port_info cy82c693_chipset __devinitdata = { |
| 453 | .name = "CY82C693", | 452 | .name = "CY82C693", |
| 454 | .init_chipset = init_chipset_cy82c693, | 453 | .init_chipset = init_chipset_cy82c693, |
| 455 | .init_iops = init_iops_cy82c693, | 454 | .init_iops = init_iops_cy82c693, |
| 456 | .init_hwif = init_hwif_cy82c693, | 455 | .init_hwif = init_hwif_cy82c693, |
| 456 | .chipset = ide_cy82c693, | ||
| 457 | .host_flags = IDE_HFLAG_SINGLE | IDE_HFLAG_TRUST_BIOS_FOR_DMA | | 457 | .host_flags = IDE_HFLAG_SINGLE | IDE_HFLAG_TRUST_BIOS_FOR_DMA | |
| 458 | IDE_HFLAG_BOOTABLE, | 458 | IDE_HFLAG_BOOTABLE, |
| 459 | .pio_mask = ATA_PIO4, | 459 | .pio_mask = ATA_PIO4, |
diff --git a/drivers/ide/pci/delkin_cb.c b/drivers/ide/pci/delkin_cb.c index 46f4a888c037..83829081640a 100644 --- a/drivers/ide/pci/delkin_cb.c +++ b/drivers/ide/pci/delkin_cb.c | |||
| @@ -80,7 +80,7 @@ delkin_cb_probe (struct pci_dev *dev, const struct pci_device_id *id) | |||
| 80 | hw.irq = dev->irq; | 80 | hw.irq = dev->irq; |
| 81 | hw.chipset = ide_pci; /* this enables IRQ sharing */ | 81 | hw.chipset = ide_pci; /* this enables IRQ sharing */ |
| 82 | 82 | ||
| 83 | rc = ide_register_hw_with_fixup(&hw, 0, &hwif, ide_undecoded_slave); | 83 | rc = ide_register_hw(&hw, &ide_undecoded_slave, 0, &hwif); |
| 84 | if (rc < 0) { | 84 | if (rc < 0) { |
| 85 | printk(KERN_ERR "delkin_cb: ide_register_hw failed (%d)\n", rc); | 85 | printk(KERN_ERR "delkin_cb: ide_register_hw failed (%d)\n", rc); |
| 86 | pci_disable_device(dev); | 86 | pci_disable_device(dev); |
diff --git a/drivers/ide/pci/generic.c b/drivers/ide/pci/generic.c index 51165832e7f2..f44d70852c3c 100644 --- a/drivers/ide/pci/generic.c +++ b/drivers/ide/pci/generic.c | |||
| @@ -54,37 +54,24 @@ __setup("all-generic-ide", ide_generic_all_on); | |||
| 54 | module_param_named(all_generic_ide, ide_generic_all, bool, 0444); | 54 | module_param_named(all_generic_ide, ide_generic_all, bool, 0444); |
| 55 | MODULE_PARM_DESC(all_generic_ide, "IDE generic will claim all unknown PCI IDE storage controllers."); | 55 | MODULE_PARM_DESC(all_generic_ide, "IDE generic will claim all unknown PCI IDE storage controllers."); |
| 56 | 56 | ||
| 57 | static void __devinit init_hwif_generic (ide_hwif_t *hwif) | 57 | #define IDE_HFLAGS_UMC (IDE_HFLAG_NO_DMA | IDE_HFLAG_FORCE_LEGACY_IRQS) |
| 58 | { | ||
| 59 | switch(hwif->pci_dev->device) { | ||
| 60 | case PCI_DEVICE_ID_UMC_UM8673F: | ||
| 61 | case PCI_DEVICE_ID_UMC_UM8886A: | ||
| 62 | case PCI_DEVICE_ID_UMC_UM8886BF: | ||
| 63 | hwif->irq = hwif->channel ? 15 : 14; | ||
| 64 | break; | ||
| 65 | default: | ||
| 66 | break; | ||
| 67 | } | ||
| 68 | } | ||
| 69 | 58 | ||
| 70 | #define DECLARE_GENERIC_PCI_DEV(name_str, dma_setting) \ | 59 | #define DECLARE_GENERIC_PCI_DEV(name_str, extra_flags) \ |
| 71 | { \ | 60 | { \ |
| 72 | .name = name_str, \ | 61 | .name = name_str, \ |
| 73 | .init_hwif = init_hwif_generic, \ | ||
| 74 | .host_flags = IDE_HFLAG_TRUST_BIOS_FOR_DMA | \ | 62 | .host_flags = IDE_HFLAG_TRUST_BIOS_FOR_DMA | \ |
| 75 | dma_setting | \ | 63 | extra_flags | \ |
| 76 | IDE_HFLAG_BOOTABLE, \ | 64 | IDE_HFLAG_BOOTABLE, \ |
| 77 | .swdma_mask = ATA_SWDMA2, \ | 65 | .swdma_mask = ATA_SWDMA2, \ |
| 78 | .mwdma_mask = ATA_MWDMA2, \ | 66 | .mwdma_mask = ATA_MWDMA2, \ |
| 79 | .udma_mask = ATA_UDMA6, \ | 67 | .udma_mask = ATA_UDMA6, \ |
| 80 | } | 68 | } |
| 81 | 69 | ||
| 82 | static ide_pci_device_t generic_chipsets[] __devinitdata = { | 70 | static const struct ide_port_info generic_chipsets[] __devinitdata = { |
| 83 | /* 0 */ DECLARE_GENERIC_PCI_DEV("Unknown", 0), | 71 | /* 0 */ DECLARE_GENERIC_PCI_DEV("Unknown", 0), |
| 84 | 72 | ||
| 85 | { /* 1 */ | 73 | { /* 1 */ |
| 86 | .name = "NS87410", | 74 | .name = "NS87410", |
| 87 | .init_hwif = init_hwif_generic, | ||
| 88 | .enablebits = {{0x43,0x08,0x08}, {0x47,0x08,0x08}}, | 75 | .enablebits = {{0x43,0x08,0x08}, {0x47,0x08,0x08}}, |
| 89 | .host_flags = IDE_HFLAG_TRUST_BIOS_FOR_DMA | | 76 | .host_flags = IDE_HFLAG_TRUST_BIOS_FOR_DMA | |
| 90 | IDE_HFLAG_BOOTABLE, | 77 | IDE_HFLAG_BOOTABLE, |
| @@ -95,16 +82,15 @@ static ide_pci_device_t generic_chipsets[] __devinitdata = { | |||
| 95 | 82 | ||
| 96 | /* 2 */ DECLARE_GENERIC_PCI_DEV("SAMURAI", 0), | 83 | /* 2 */ DECLARE_GENERIC_PCI_DEV("SAMURAI", 0), |
| 97 | /* 3 */ DECLARE_GENERIC_PCI_DEV("HT6565", 0), | 84 | /* 3 */ DECLARE_GENERIC_PCI_DEV("HT6565", 0), |
| 98 | /* 4 */ DECLARE_GENERIC_PCI_DEV("UM8673F", IDE_HFLAG_NO_DMA), | 85 | /* 4 */ DECLARE_GENERIC_PCI_DEV("UM8673F", IDE_HFLAGS_UMC), |
| 99 | /* 5 */ DECLARE_GENERIC_PCI_DEV("UM8886A", IDE_HFLAG_NO_DMA), | 86 | /* 5 */ DECLARE_GENERIC_PCI_DEV("UM8886A", IDE_HFLAGS_UMC), |
| 100 | /* 6 */ DECLARE_GENERIC_PCI_DEV("UM8886BF", IDE_HFLAG_NO_DMA), | 87 | /* 6 */ DECLARE_GENERIC_PCI_DEV("UM8886BF", IDE_HFLAGS_UMC), |
| 101 | /* 7 */ DECLARE_GENERIC_PCI_DEV("HINT_IDE", 0), | 88 | /* 7 */ DECLARE_GENERIC_PCI_DEV("HINT_IDE", 0), |
| 102 | /* 8 */ DECLARE_GENERIC_PCI_DEV("VIA_IDE", IDE_HFLAG_NO_AUTODMA), | 89 | /* 8 */ DECLARE_GENERIC_PCI_DEV("VIA_IDE", IDE_HFLAG_NO_AUTODMA), |
| 103 | /* 9 */ DECLARE_GENERIC_PCI_DEV("OPTI621V", IDE_HFLAG_NO_AUTODMA), | 90 | /* 9 */ DECLARE_GENERIC_PCI_DEV("OPTI621V", IDE_HFLAG_NO_AUTODMA), |
| 104 | 91 | ||
| 105 | { /* 10 */ | 92 | { /* 10 */ |
| 106 | .name = "VIA8237SATA", | 93 | .name = "VIA8237SATA", |
| 107 | .init_hwif = init_hwif_generic, | ||
| 108 | .host_flags = IDE_HFLAG_TRUST_BIOS_FOR_DMA | | 94 | .host_flags = IDE_HFLAG_TRUST_BIOS_FOR_DMA | |
| 109 | IDE_HFLAG_OFF_BOARD, | 95 | IDE_HFLAG_OFF_BOARD, |
| 110 | .swdma_mask = ATA_SWDMA2, | 96 | .swdma_mask = ATA_SWDMA2, |
| @@ -118,7 +104,6 @@ static ide_pci_device_t generic_chipsets[] __devinitdata = { | |||
| 118 | 104 | ||
| 119 | { /* 14 */ | 105 | { /* 14 */ |
| 120 | .name = "Revolution", | 106 | .name = "Revolution", |
| 121 | .init_hwif = init_hwif_generic, | ||
| 122 | .host_flags = IDE_HFLAG_TRUST_BIOS_FOR_DMA | | 107 | .host_flags = IDE_HFLAG_TRUST_BIOS_FOR_DMA | |
| 123 | IDE_HFLAG_OFF_BOARD, | 108 | IDE_HFLAG_OFF_BOARD, |
| 124 | .swdma_mask = ATA_SWDMA2, | 109 | .swdma_mask = ATA_SWDMA2, |
| @@ -138,7 +123,7 @@ static ide_pci_device_t generic_chipsets[] __devinitdata = { | |||
| 138 | 123 | ||
| 139 | static int __devinit generic_init_one(struct pci_dev *dev, const struct pci_device_id *id) | 124 | static int __devinit generic_init_one(struct pci_dev *dev, const struct pci_device_id *id) |
| 140 | { | 125 | { |
| 141 | ide_pci_device_t *d = &generic_chipsets[id->driver_data]; | 126 | const struct ide_port_info *d = &generic_chipsets[id->driver_data]; |
| 142 | int ret = -ENODEV; | 127 | int ret = -ENODEV; |
| 143 | 128 | ||
| 144 | /* Don't use the generic entry unless instructed to do so */ | 129 | /* Don't use the generic entry unless instructed to do so */ |
diff --git a/drivers/ide/pci/hpt34x.c b/drivers/ide/pci/hpt34x.c index 67af1a7dde30..ae6307fae4f9 100644 --- a/drivers/ide/pci/hpt34x.c +++ b/drivers/ide/pci/hpt34x.c | |||
| @@ -129,7 +129,7 @@ static void __devinit init_hwif_hpt34x(ide_hwif_t *hwif) | |||
| 129 | hwif->set_dma_mode = &hpt34x_set_mode; | 129 | hwif->set_dma_mode = &hpt34x_set_mode; |
| 130 | } | 130 | } |
| 131 | 131 | ||
| 132 | static ide_pci_device_t hpt34x_chipsets[] __devinitdata = { | 132 | static const struct ide_port_info hpt34x_chipsets[] __devinitdata = { |
| 133 | { /* 0 */ | 133 | { /* 0 */ |
| 134 | .name = "HPT343", | 134 | .name = "HPT343", |
| 135 | .init_chipset = init_chipset_hpt34x, | 135 | .init_chipset = init_chipset_hpt34x, |
| @@ -158,7 +158,7 @@ static ide_pci_device_t hpt34x_chipsets[] __devinitdata = { | |||
| 158 | 158 | ||
| 159 | static int __devinit hpt34x_init_one(struct pci_dev *dev, const struct pci_device_id *id) | 159 | static int __devinit hpt34x_init_one(struct pci_dev *dev, const struct pci_device_id *id) |
| 160 | { | 160 | { |
| 161 | ide_pci_device_t *d; | 161 | const struct ide_port_info *d; |
| 162 | u16 pcicmd = 0; | 162 | u16 pcicmd = 0; |
| 163 | 163 | ||
| 164 | pci_read_config_word(dev, PCI_COMMAND, &pcicmd); | 164 | pci_read_config_word(dev, PCI_COMMAND, &pcicmd); |
diff --git a/drivers/ide/pci/hpt366.c b/drivers/ide/pci/hpt366.c index 18f5b7ddaee6..612b795241bf 100644 --- a/drivers/ide/pci/hpt366.c +++ b/drivers/ide/pci/hpt366.c | |||
| @@ -1425,7 +1425,7 @@ static int __devinit hpt36x_init(struct pci_dev *dev, struct pci_dev *dev2) | |||
| 1425 | return 0; | 1425 | return 0; |
| 1426 | } | 1426 | } |
| 1427 | 1427 | ||
| 1428 | static ide_pci_device_t hpt366_chipsets[] __devinitdata = { | 1428 | static const struct ide_port_info hpt366_chipsets[] __devinitdata = { |
| 1429 | { /* 0 */ | 1429 | { /* 0 */ |
| 1430 | .name = "HPT36x", | 1430 | .name = "HPT36x", |
| 1431 | .init_chipset = init_chipset_hpt366, | 1431 | .init_chipset = init_chipset_hpt366, |
| @@ -1510,7 +1510,7 @@ static int __devinit hpt366_init_one(struct pci_dev *dev, const struct pci_devic | |||
| 1510 | { | 1510 | { |
| 1511 | struct hpt_info *info = NULL; | 1511 | struct hpt_info *info = NULL; |
| 1512 | struct pci_dev *dev2 = NULL; | 1512 | struct pci_dev *dev2 = NULL; |
| 1513 | ide_pci_device_t d; | 1513 | struct ide_port_info d; |
| 1514 | u8 idx = id->driver_data; | 1514 | u8 idx = id->driver_data; |
| 1515 | u8 rev = dev->revision; | 1515 | u8 rev = dev->revision; |
| 1516 | 1516 | ||
diff --git a/drivers/ide/pci/it8213.c b/drivers/ide/pci/it8213.c index dfbe605120cb..90b52ed37bfc 100644 --- a/drivers/ide/pci/it8213.c +++ b/drivers/ide/pci/it8213.c | |||
| @@ -193,7 +193,7 @@ static void __devinit init_hwif_it8213(ide_hwif_t *hwif) | |||
| 193 | .udma_mask = ATA_UDMA6, \ | 193 | .udma_mask = ATA_UDMA6, \ |
| 194 | } | 194 | } |
| 195 | 195 | ||
| 196 | static ide_pci_device_t it8213_chipsets[] __devinitdata = { | 196 | static const struct ide_port_info it8213_chipsets[] __devinitdata = { |
| 197 | /* 0 */ DECLARE_ITE_DEV("IT8213"), | 197 | /* 0 */ DECLARE_ITE_DEV("IT8213"), |
| 198 | }; | 198 | }; |
| 199 | 199 | ||
diff --git a/drivers/ide/pci/it821x.c b/drivers/ide/pci/it821x.c index 08e820e89ae2..5c9975435319 100644 --- a/drivers/ide/pci/it821x.c +++ b/drivers/ide/pci/it821x.c | |||
| @@ -638,7 +638,7 @@ static unsigned int __devinit init_chipset_it821x(struct pci_dev *dev, const cha | |||
| 638 | .pio_mask = ATA_PIO4, \ | 638 | .pio_mask = ATA_PIO4, \ |
| 639 | } | 639 | } |
| 640 | 640 | ||
| 641 | static ide_pci_device_t it821x_chipsets[] __devinitdata = { | 641 | static const struct ide_port_info it821x_chipsets[] __devinitdata = { |
| 642 | /* 0 */ DECLARE_ITE_DEV("IT8212"), | 642 | /* 0 */ DECLARE_ITE_DEV("IT8212"), |
| 643 | }; | 643 | }; |
| 644 | 644 | ||
diff --git a/drivers/ide/pci/jmicron.c b/drivers/ide/pci/jmicron.c index 2eeff670d9a6..bdf64d997708 100644 --- a/drivers/ide/pci/jmicron.c +++ b/drivers/ide/pci/jmicron.c | |||
| @@ -118,7 +118,7 @@ static void __devinit init_hwif_jmicron(ide_hwif_t *hwif) | |||
| 118 | hwif->cbl = ata66_jmicron(hwif); | 118 | hwif->cbl = ata66_jmicron(hwif); |
| 119 | } | 119 | } |
| 120 | 120 | ||
| 121 | static ide_pci_device_t jmicron_chipset __devinitdata = { | 121 | static const struct ide_port_info jmicron_chipset __devinitdata = { |
| 122 | .name = "JMB", | 122 | .name = "JMB", |
| 123 | .init_hwif = init_hwif_jmicron, | 123 | .init_hwif = init_hwif_jmicron, |
| 124 | .host_flags = IDE_HFLAG_BOOTABLE, | 124 | .host_flags = IDE_HFLAG_BOOTABLE, |
diff --git a/drivers/ide/pci/ns87415.c b/drivers/ide/pci/ns87415.c index d21b58923829..d4df4642dbb5 100644 --- a/drivers/ide/pci/ns87415.c +++ b/drivers/ide/pci/ns87415.c | |||
| @@ -260,7 +260,7 @@ static void __devinit init_hwif_ns87415 (ide_hwif_t *hwif) | |||
| 260 | hwif->ide_dma_end = &ns87415_ide_dma_end; | 260 | hwif->ide_dma_end = &ns87415_ide_dma_end; |
| 261 | } | 261 | } |
| 262 | 262 | ||
| 263 | static ide_pci_device_t ns87415_chipset __devinitdata = { | 263 | static const struct ide_port_info ns87415_chipset __devinitdata = { |
| 264 | .name = "NS87415", | 264 | .name = "NS87415", |
| 265 | #ifdef CONFIG_SUPERIO | 265 | #ifdef CONFIG_SUPERIO |
| 266 | .init_iops = init_iops_ns87415, | 266 | .init_iops = init_iops_ns87415, |
diff --git a/drivers/ide/pci/opti621.c b/drivers/ide/pci/opti621.c index 3573ffeaaa34..8953d9c3926f 100644 --- a/drivers/ide/pci/opti621.c +++ b/drivers/ide/pci/opti621.c | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * linux/drivers/ide/pci/opti621.c Version 0.8 Aug 27, 2007 | 2 | * linux/drivers/ide/pci/opti621.c Version 0.9 Sep 24, 2007 |
| 3 | * | 3 | * |
| 4 | * Copyright (C) 1996-1998 Linus Torvalds & authors (see below) | 4 | * Copyright (C) 1996-1998 Linus Torvalds & authors (see below) |
| 5 | */ | 5 | */ |
| @@ -133,6 +133,8 @@ static int reg_base; | |||
| 133 | #define PIO_NOT_EXIST 254 | 133 | #define PIO_NOT_EXIST 254 |
| 134 | #define PIO_DONT_KNOW 255 | 134 | #define PIO_DONT_KNOW 255 |
| 135 | 135 | ||
| 136 | static DEFINE_SPINLOCK(opti621_lock); | ||
| 137 | |||
| 136 | /* there are stored pio numbers from other calls of opti621_set_pio_mode */ | 138 | /* there are stored pio numbers from other calls of opti621_set_pio_mode */ |
| 137 | static void compute_pios(ide_drive_t *drive, const u8 pio) | 139 | static void compute_pios(ide_drive_t *drive, const u8 pio) |
| 138 | /* Store values into drive->drive_data | 140 | /* Store values into drive->drive_data |
| @@ -278,7 +280,7 @@ static void opti621_set_pio_mode(ide_drive_t *drive, const u8 pio) | |||
| 278 | second.recovery_time, drdy); | 280 | second.recovery_time, drdy); |
| 279 | #endif | 281 | #endif |
| 280 | 282 | ||
| 281 | spin_lock_irqsave(&ide_lock, flags); | 283 | spin_lock_irqsave(&opti621_lock, flags); |
| 282 | 284 | ||
| 283 | reg_base = hwif->io_ports[IDE_DATA_OFFSET]; | 285 | reg_base = hwif->io_ports[IDE_DATA_OFFSET]; |
| 284 | 286 | ||
| @@ -317,7 +319,7 @@ static void opti621_set_pio_mode(ide_drive_t *drive, const u8 pio) | |||
| 317 | /* and read prefetch for both drives */ | 319 | /* and read prefetch for both drives */ |
| 318 | write_reg(misc, MISC_REG); | 320 | write_reg(misc, MISC_REG); |
| 319 | 321 | ||
| 320 | spin_unlock_irqrestore(&ide_lock, flags); | 322 | spin_unlock_irqrestore(&opti621_lock, flags); |
| 321 | } | 323 | } |
| 322 | 324 | ||
| 323 | /* | 325 | /* |
| @@ -331,7 +333,7 @@ static void __devinit init_hwif_opti621 (ide_hwif_t *hwif) | |||
| 331 | hwif->set_pio_mode = &opti621_set_pio_mode; | 333 | hwif->set_pio_mode = &opti621_set_pio_mode; |
| 332 | } | 334 | } |
| 333 | 335 | ||
| 334 | static ide_pci_device_t opti621_chipsets[] __devinitdata = { | 336 | static const struct ide_port_info opti621_chipsets[] __devinitdata = { |
| 335 | { /* 0 */ | 337 | { /* 0 */ |
| 336 | .name = "OPTI621", | 338 | .name = "OPTI621", |
| 337 | .init_hwif = init_hwif_opti621, | 339 | .init_hwif = init_hwif_opti621, |
diff --git a/drivers/ide/pci/pdc202xx_new.c b/drivers/ide/pci/pdc202xx_new.c index d1e7823454f3..4234efeba606 100644 --- a/drivers/ide/pci/pdc202xx_new.c +++ b/drivers/ide/pci/pdc202xx_new.c | |||
| @@ -513,7 +513,7 @@ static struct pci_dev * __devinit pdc20270_get_dev2(struct pci_dev *dev) | |||
| 513 | .udma_mask = udma, \ | 513 | .udma_mask = udma, \ |
| 514 | } | 514 | } |
| 515 | 515 | ||
| 516 | static ide_pci_device_t pdcnew_chipsets[] __devinitdata = { | 516 | static const struct ide_port_info pdcnew_chipsets[] __devinitdata = { |
| 517 | /* 0 */ DECLARE_PDCNEW_DEV("PDC20268", ATA_UDMA5), | 517 | /* 0 */ DECLARE_PDCNEW_DEV("PDC20268", ATA_UDMA5), |
| 518 | /* 1 */ DECLARE_PDCNEW_DEV("PDC20269", ATA_UDMA6), | 518 | /* 1 */ DECLARE_PDCNEW_DEV("PDC20269", ATA_UDMA6), |
| 519 | /* 2 */ DECLARE_PDCNEW_DEV("PDC20270", ATA_UDMA5), | 519 | /* 2 */ DECLARE_PDCNEW_DEV("PDC20270", ATA_UDMA5), |
| @@ -534,7 +534,7 @@ static ide_pci_device_t pdcnew_chipsets[] __devinitdata = { | |||
| 534 | 534 | ||
| 535 | static int __devinit pdc202new_init_one(struct pci_dev *dev, const struct pci_device_id *id) | 535 | static int __devinit pdc202new_init_one(struct pci_dev *dev, const struct pci_device_id *id) |
| 536 | { | 536 | { |
| 537 | ide_pci_device_t *d; | 537 | const struct ide_port_info *d; |
| 538 | struct pci_dev *bridge = dev->bus->self; | 538 | struct pci_dev *bridge = dev->bus->self; |
| 539 | u8 idx = id->driver_data; | 539 | u8 idx = id->driver_data; |
| 540 | 540 | ||
diff --git a/drivers/ide/pci/pdc202xx_old.c b/drivers/ide/pci/pdc202xx_old.c index 29306121dc4a..e09742e2ba59 100644 --- a/drivers/ide/pci/pdc202xx_old.c +++ b/drivers/ide/pci/pdc202xx_old.c | |||
| @@ -302,13 +302,6 @@ static unsigned int __devinit init_chipset_pdc202xx(struct pci_dev *dev, | |||
| 302 | 302 | ||
| 303 | static void __devinit init_hwif_pdc202xx(ide_hwif_t *hwif) | 303 | static void __devinit init_hwif_pdc202xx(ide_hwif_t *hwif) |
| 304 | { | 304 | { |
| 305 | struct pci_dev *dev = hwif->pci_dev; | ||
| 306 | |||
| 307 | /* PDC20265 has problems with large LBA48 requests */ | ||
| 308 | if ((dev->device == PCI_DEVICE_ID_PROMISE_20267) || | ||
| 309 | (dev->device == PCI_DEVICE_ID_PROMISE_20265)) | ||
| 310 | hwif->rqsize = 256; | ||
| 311 | |||
| 312 | hwif->set_pio_mode = &pdc202xx_set_pio_mode; | 305 | hwif->set_pio_mode = &pdc202xx_set_pio_mode; |
| 313 | hwif->set_dma_mode = &pdc202xx_set_mode; | 306 | hwif->set_dma_mode = &pdc202xx_set_mode; |
| 314 | 307 | ||
| @@ -382,7 +375,7 @@ static void __devinit pdc202ata4_fixup_irq(struct pci_dev *dev, | |||
| 382 | } | 375 | } |
| 383 | } | 376 | } |
| 384 | 377 | ||
| 385 | #define DECLARE_PDC2026X_DEV(name_str, udma) \ | 378 | #define DECLARE_PDC2026X_DEV(name_str, udma, extra_flags) \ |
| 386 | { \ | 379 | { \ |
| 387 | .name = name_str, \ | 380 | .name = name_str, \ |
| 388 | .init_chipset = init_chipset_pdc202xx, \ | 381 | .init_chipset = init_chipset_pdc202xx, \ |
| @@ -390,13 +383,14 @@ static void __devinit pdc202ata4_fixup_irq(struct pci_dev *dev, | |||
| 390 | .init_dma = init_dma_pdc202xx, \ | 383 | .init_dma = init_dma_pdc202xx, \ |
| 391 | .extra = 48, \ | 384 | .extra = 48, \ |
| 392 | .host_flags = IDE_HFLAG_ERROR_STOPS_FIFO | \ | 385 | .host_flags = IDE_HFLAG_ERROR_STOPS_FIFO | \ |
| 386 | extra_flags | \ | ||
| 393 | IDE_HFLAG_OFF_BOARD, \ | 387 | IDE_HFLAG_OFF_BOARD, \ |
| 394 | .pio_mask = ATA_PIO4, \ | 388 | .pio_mask = ATA_PIO4, \ |
| 395 | .mwdma_mask = ATA_MWDMA2, \ | 389 | .mwdma_mask = ATA_MWDMA2, \ |
| 396 | .udma_mask = udma, \ | 390 | .udma_mask = udma, \ |
| 397 | } | 391 | } |
| 398 | 392 | ||
| 399 | static ide_pci_device_t pdc202xx_chipsets[] __devinitdata = { | 393 | static const struct ide_port_info pdc202xx_chipsets[] __devinitdata = { |
| 400 | { /* 0 */ | 394 | { /* 0 */ |
| 401 | .name = "PDC20246", | 395 | .name = "PDC20246", |
| 402 | .init_chipset = init_chipset_pdc202xx, | 396 | .init_chipset = init_chipset_pdc202xx, |
| @@ -410,10 +404,10 @@ static ide_pci_device_t pdc202xx_chipsets[] __devinitdata = { | |||
| 410 | .udma_mask = ATA_UDMA2, | 404 | .udma_mask = ATA_UDMA2, |
| 411 | }, | 405 | }, |
| 412 | 406 | ||
| 413 | /* 1 */ DECLARE_PDC2026X_DEV("PDC20262", ATA_UDMA4), | 407 | /* 1 */ DECLARE_PDC2026X_DEV("PDC20262", ATA_UDMA4, 0), |
| 414 | /* 2 */ DECLARE_PDC2026X_DEV("PDC20263", ATA_UDMA4), | 408 | /* 2 */ DECLARE_PDC2026X_DEV("PDC20263", ATA_UDMA4, 0), |
| 415 | /* 3 */ DECLARE_PDC2026X_DEV("PDC20265", ATA_UDMA5), | 409 | /* 3 */ DECLARE_PDC2026X_DEV("PDC20265", ATA_UDMA5, IDE_HFLAG_RQSIZE_256), |
| 416 | /* 4 */ DECLARE_PDC2026X_DEV("PDC20267", ATA_UDMA5), | 410 | /* 4 */ DECLARE_PDC2026X_DEV("PDC20267", ATA_UDMA5, IDE_HFLAG_RQSIZE_256), |
| 417 | }; | 411 | }; |
| 418 | 412 | ||
| 419 | /** | 413 | /** |
| @@ -427,7 +421,7 @@ static ide_pci_device_t pdc202xx_chipsets[] __devinitdata = { | |||
| 427 | 421 | ||
| 428 | static int __devinit pdc202xx_init_one(struct pci_dev *dev, const struct pci_device_id *id) | 422 | static int __devinit pdc202xx_init_one(struct pci_dev *dev, const struct pci_device_id *id) |
| 429 | { | 423 | { |
| 430 | ide_pci_device_t *d; | 424 | const struct ide_port_info *d; |
| 431 | u8 idx = id->driver_data; | 425 | u8 idx = id->driver_data; |
| 432 | 426 | ||
| 433 | d = &pdc202xx_chipsets[idx]; | 427 | d = &pdc202xx_chipsets[idx]; |
diff --git a/drivers/ide/pci/piix.c b/drivers/ide/pci/piix.c index ec0c6e96a213..9329d4a810e5 100644 --- a/drivers/ide/pci/piix.c +++ b/drivers/ide/pci/piix.c | |||
| @@ -396,7 +396,7 @@ static void __devinit init_hwif_ich(ide_hwif_t *hwif) | |||
| 396 | .udma_mask = udma, \ | 396 | .udma_mask = udma, \ |
| 397 | } | 397 | } |
| 398 | 398 | ||
| 399 | static ide_pci_device_t piix_pci_info[] __devinitdata = { | 399 | static const struct ide_port_info piix_pci_info[] __devinitdata = { |
| 400 | /* 0 */ DECLARE_PIIX_DEV("PIIXa", 0x00), /* no udma */ | 400 | /* 0 */ DECLARE_PIIX_DEV("PIIXa", 0x00), /* no udma */ |
| 401 | /* 1 */ DECLARE_PIIX_DEV("PIIXb", 0x00), /* no udma */ | 401 | /* 1 */ DECLARE_PIIX_DEV("PIIXb", 0x00), /* no udma */ |
| 402 | 402 | ||
| @@ -449,9 +449,7 @@ static ide_pci_device_t piix_pci_info[] __devinitdata = { | |||
| 449 | 449 | ||
| 450 | static int __devinit piix_init_one(struct pci_dev *dev, const struct pci_device_id *id) | 450 | static int __devinit piix_init_one(struct pci_dev *dev, const struct pci_device_id *id) |
| 451 | { | 451 | { |
| 452 | ide_pci_device_t *d = &piix_pci_info[id->driver_data]; | 452 | return ide_setup_pci_device(dev, &piix_pci_info[id->driver_data]); |
| 453 | |||
| 454 | return ide_setup_pci_device(dev, d); | ||
| 455 | } | 453 | } |
| 456 | 454 | ||
| 457 | /** | 455 | /** |
diff --git a/drivers/ide/pci/rz1000.c b/drivers/ide/pci/rz1000.c index dd2583ef1ad7..6b10ae260fa2 100644 --- a/drivers/ide/pci/rz1000.c +++ b/drivers/ide/pci/rz1000.c | |||
| @@ -35,13 +35,13 @@ static void __devinit init_hwif_rz1000 (ide_hwif_t *hwif) | |||
| 35 | u16 reg; | 35 | u16 reg; |
| 36 | struct pci_dev *dev = hwif->pci_dev; | 36 | struct pci_dev *dev = hwif->pci_dev; |
| 37 | 37 | ||
| 38 | hwif->chipset = ide_rz1000; | ||
| 39 | if (!pci_read_config_word (dev, 0x40, ®) && | 38 | if (!pci_read_config_word (dev, 0x40, ®) && |
| 40 | !pci_write_config_word(dev, 0x40, reg & 0xdfff)) { | 39 | !pci_write_config_word(dev, 0x40, reg & 0xdfff)) { |
| 41 | printk(KERN_INFO "%s: disabled chipset read-ahead " | 40 | printk(KERN_INFO "%s: disabled chipset read-ahead " |
| 42 | "(buggy RZ1000/RZ1001)\n", hwif->name); | 41 | "(buggy RZ1000/RZ1001)\n", hwif->name); |
| 43 | } else { | 42 | } else { |
| 44 | hwif->serialized = 1; | 43 | if (hwif->mate) |
| 44 | hwif->mate->serialized = hwif->serialized = 1; | ||
| 45 | hwif->drives[0].no_unmask = 1; | 45 | hwif->drives[0].no_unmask = 1; |
| 46 | hwif->drives[1].no_unmask = 1; | 46 | hwif->drives[1].no_unmask = 1; |
| 47 | printk(KERN_INFO "%s: serialized, disabled unmasking " | 47 | printk(KERN_INFO "%s: serialized, disabled unmasking " |
| @@ -49,9 +49,10 @@ static void __devinit init_hwif_rz1000 (ide_hwif_t *hwif) | |||
| 49 | } | 49 | } |
| 50 | } | 50 | } |
| 51 | 51 | ||
| 52 | static ide_pci_device_t rz1000_chipset __devinitdata = { | 52 | static const struct ide_port_info rz1000_chipset __devinitdata = { |
| 53 | .name = "RZ100x", | 53 | .name = "RZ100x", |
| 54 | .init_hwif = init_hwif_rz1000, | 54 | .init_hwif = init_hwif_rz1000, |
| 55 | .chipset = ide_rz1000, | ||
| 55 | .host_flags = IDE_HFLAG_NO_DMA | IDE_HFLAG_BOOTABLE, | 56 | .host_flags = IDE_HFLAG_NO_DMA | IDE_HFLAG_BOOTABLE, |
| 56 | }; | 57 | }; |
| 57 | 58 | ||
diff --git a/drivers/ide/pci/sc1200.c b/drivers/ide/pci/sc1200.c index b2423e03bf36..d2c8b5524f28 100644 --- a/drivers/ide/pci/sc1200.c +++ b/drivers/ide/pci/sc1200.c | |||
| @@ -372,7 +372,7 @@ static void __devinit init_hwif_sc1200 (ide_hwif_t *hwif) | |||
| 372 | hwif->ide_dma_end = &sc1200_ide_dma_end; | 372 | hwif->ide_dma_end = &sc1200_ide_dma_end; |
| 373 | } | 373 | } |
| 374 | 374 | ||
| 375 | static ide_pci_device_t sc1200_chipset __devinitdata = { | 375 | static const struct ide_port_info sc1200_chipset __devinitdata = { |
| 376 | .name = "SC1200", | 376 | .name = "SC1200", |
| 377 | .init_hwif = init_hwif_sc1200, | 377 | .init_hwif = init_hwif_sc1200, |
| 378 | .host_flags = IDE_HFLAG_SERIALIZE | | 378 | .host_flags = IDE_HFLAG_SERIALIZE | |
diff --git a/drivers/ide/pci/scc_pata.c b/drivers/ide/pci/scc_pata.c index ae9b50331d2a..ebb7132b9b84 100644 --- a/drivers/ide/pci/scc_pata.c +++ b/drivers/ide/pci/scc_pata.c | |||
| @@ -538,12 +538,13 @@ static int setup_mmio_scc (struct pci_dev *dev, const char *name) | |||
| 538 | /** | 538 | /** |
| 539 | * init_setup_scc - set up an SCC PATA Controller | 539 | * init_setup_scc - set up an SCC PATA Controller |
| 540 | * @dev: PCI device | 540 | * @dev: PCI device |
| 541 | * @d: IDE PCI device | 541 | * @d: IDE port info |
| 542 | * | 542 | * |
| 543 | * Perform the initial set up for this device. | 543 | * Perform the initial set up for this device. |
| 544 | */ | 544 | */ |
| 545 | 545 | ||
| 546 | static int __devinit init_setup_scc(struct pci_dev *dev, ide_pci_device_t *d) | 546 | static int __devinit init_setup_scc(struct pci_dev *dev, |
| 547 | const struct ide_port_info *d) | ||
| 547 | { | 548 | { |
| 548 | unsigned long ctl_base; | 549 | unsigned long ctl_base; |
| 549 | unsigned long dma_base; | 550 | unsigned long dma_base; |
| @@ -702,7 +703,7 @@ static void __devinit init_hwif_scc(ide_hwif_t *hwif) | |||
| 702 | .pio_mask = ATA_PIO4, \ | 703 | .pio_mask = ATA_PIO4, \ |
| 703 | } | 704 | } |
| 704 | 705 | ||
| 705 | static ide_pci_device_t scc_chipsets[] __devinitdata = { | 706 | static const struct ide_port_info scc_chipsets[] __devinitdata = { |
| 706 | /* 0 */ DECLARE_SCC_DEV("sccIDE"), | 707 | /* 0 */ DECLARE_SCC_DEV("sccIDE"), |
| 707 | }; | 708 | }; |
| 708 | 709 | ||
| @@ -717,9 +718,7 @@ static ide_pci_device_t scc_chipsets[] __devinitdata = { | |||
| 717 | 718 | ||
| 718 | static int __devinit scc_init_one(struct pci_dev *dev, const struct pci_device_id *id) | 719 | static int __devinit scc_init_one(struct pci_dev *dev, const struct pci_device_id *id) |
| 719 | { | 720 | { |
| 720 | ide_pci_device_t *d = &scc_chipsets[id->driver_data]; | 721 | return init_setup_scc(dev, &scc_chipsets[id->driver_data]); |
| 721 | |||
| 722 | return init_setup_scc(dev, d); | ||
| 723 | } | 722 | } |
| 724 | 723 | ||
| 725 | /** | 724 | /** |
diff --git a/drivers/ide/pci/serverworks.c b/drivers/ide/pci/serverworks.c index a3d880e21d0b..a7280311357b 100644 --- a/drivers/ide/pci/serverworks.c +++ b/drivers/ide/pci/serverworks.c | |||
| @@ -158,13 +158,6 @@ static void svwks_set_dma_mode(ide_drive_t *drive, const u8 speed) | |||
| 158 | 158 | ||
| 159 | u8 ultra_enable = 0, ultra_timing = 0, dma_timing = 0; | 159 | u8 ultra_enable = 0, ultra_timing = 0, dma_timing = 0; |
| 160 | 160 | ||
| 161 | /* If we are about to put a disk into UDMA mode we screwed up. | ||
| 162 | Our code assumes we never _ever_ do this on an OSB4 */ | ||
| 163 | |||
| 164 | if(dev->device == PCI_DEVICE_ID_SERVERWORKS_OSB4 && | ||
| 165 | drive->media == ide_disk && speed >= XFER_UDMA_0) | ||
| 166 | BUG(); | ||
| 167 | |||
| 168 | pci_read_config_byte(dev, (0x56|hwif->channel), &ultra_timing); | 161 | pci_read_config_byte(dev, (0x56|hwif->channel), &ultra_timing); |
| 169 | pci_read_config_byte(dev, 0x54, &ultra_enable); | 162 | pci_read_config_byte(dev, 0x54, &ultra_enable); |
| 170 | 163 | ||
| @@ -373,7 +366,7 @@ static void __devinit init_hwif_svwks (ide_hwif_t *hwif) | |||
| 373 | } | 366 | } |
| 374 | } | 367 | } |
| 375 | 368 | ||
| 376 | static ide_pci_device_t serverworks_chipsets[] __devinitdata = { | 369 | static const struct ide_port_info serverworks_chipsets[] __devinitdata = { |
| 377 | { /* 0 */ | 370 | { /* 0 */ |
| 378 | .name = "SvrWks OSB4", | 371 | .name = "SvrWks OSB4", |
| 379 | .init_chipset = init_chipset_svwks, | 372 | .init_chipset = init_chipset_svwks, |
| @@ -430,7 +423,7 @@ static ide_pci_device_t serverworks_chipsets[] __devinitdata = { | |||
| 430 | 423 | ||
| 431 | static int __devinit svwks_init_one(struct pci_dev *dev, const struct pci_device_id *id) | 424 | static int __devinit svwks_init_one(struct pci_dev *dev, const struct pci_device_id *id) |
| 432 | { | 425 | { |
| 433 | ide_pci_device_t d; | 426 | struct ide_port_info d; |
| 434 | u8 idx = id->driver_data; | 427 | u8 idx = id->driver_data; |
| 435 | 428 | ||
| 436 | d = serverworks_chipsets[idx]; | 429 | d = serverworks_chipsets[idx]; |
diff --git a/drivers/ide/pci/sgiioc4.c b/drivers/ide/pci/sgiioc4.c index 5af74ea1d46e..de820aa58cd0 100644 --- a/drivers/ide/pci/sgiioc4.c +++ b/drivers/ide/pci/sgiioc4.c | |||
| @@ -614,6 +614,7 @@ sgiioc4_ide_setup_pci_device(struct pci_dev *dev) | |||
| 614 | void __iomem *virt_base; | 614 | void __iomem *virt_base; |
| 615 | ide_hwif_t *hwif; | 615 | ide_hwif_t *hwif; |
| 616 | int h; | 616 | int h; |
| 617 | u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; | ||
| 617 | 618 | ||
| 618 | /* | 619 | /* |
| 619 | * Find an empty HWIF; if none available, return -ENOMEM. | 620 | * Find an empty HWIF; if none available, return -ENOMEM. |
| @@ -654,10 +655,12 @@ sgiioc4_ide_setup_pci_device(struct pci_dev *dev) | |||
| 654 | } | 655 | } |
| 655 | 656 | ||
| 656 | if (hwif->io_ports[IDE_DATA_OFFSET] != cmd_base) { | 657 | if (hwif->io_ports[IDE_DATA_OFFSET] != cmd_base) { |
| 658 | hw_regs_t hw; | ||
| 659 | |||
| 657 | /* Initialize the IO registers */ | 660 | /* Initialize the IO registers */ |
| 658 | sgiioc4_init_hwif_ports(&hwif->hw, cmd_base, ctl, irqport); | 661 | memset(&hw, 0, sizeof(hw)); |
| 659 | memcpy(hwif->io_ports, hwif->hw.io_ports, | 662 | sgiioc4_init_hwif_ports(&hw, cmd_base, ctl, irqport); |
| 660 | sizeof (hwif->io_ports)); | 663 | memcpy(hwif->io_ports, hw.io_ports, sizeof(hwif->io_ports)); |
| 661 | hwif->noprobe = !hwif->io_ports[IDE_DATA_OFFSET]; | 664 | hwif->noprobe = !hwif->io_ports[IDE_DATA_OFFSET]; |
| 662 | } | 665 | } |
| 663 | 666 | ||
| @@ -679,11 +682,10 @@ sgiioc4_ide_setup_pci_device(struct pci_dev *dev) | |||
| 679 | 682 | ||
| 680 | ide_init_sgiioc4(hwif); | 683 | ide_init_sgiioc4(hwif); |
| 681 | 684 | ||
| 682 | if (probe_hwif_init(hwif)) | 685 | idx[0] = hwif->index; |
| 683 | return -EIO; | ||
| 684 | 686 | ||
| 685 | /* Create /proc/ide entries */ | 687 | if (ide_device_add(idx)) |
| 686 | ide_proc_register_port(hwif); | 688 | return -EIO; |
| 687 | 689 | ||
| 688 | return 0; | 690 | return 0; |
| 689 | } | 691 | } |
diff --git a/drivers/ide/pci/siimage.c b/drivers/ide/pci/siimage.c index 1353afb10a4d..6d99441c605b 100644 --- a/drivers/ide/pci/siimage.c +++ b/drivers/ide/pci/siimage.c | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * linux/drivers/ide/pci/siimage.c Version 1.17 Oct 18 2007 | 2 | * linux/drivers/ide/pci/siimage.c Version 1.18 Oct 18 2007 |
| 3 | * | 3 | * |
| 4 | * Copyright (C) 2001-2002 Andre Hedrick <andre@linux-ide.org> | 4 | * Copyright (C) 2001-2002 Andre Hedrick <andre@linux-ide.org> |
| 5 | * Copyright (C) 2003 Red Hat <alan@redhat.com> | 5 | * Copyright (C) 2003 Red Hat <alan@redhat.com> |
| @@ -57,8 +57,8 @@ | |||
| 57 | 57 | ||
| 58 | static int pdev_is_sata(struct pci_dev *pdev) | 58 | static int pdev_is_sata(struct pci_dev *pdev) |
| 59 | { | 59 | { |
| 60 | switch(pdev->device) | 60 | #ifdef CONFIG_BLK_DEV_IDE_SATA |
| 61 | { | 61 | switch(pdev->device) { |
| 62 | case PCI_DEVICE_ID_SII_3112: | 62 | case PCI_DEVICE_ID_SII_3112: |
| 63 | case PCI_DEVICE_ID_SII_1210SA: | 63 | case PCI_DEVICE_ID_SII_1210SA: |
| 64 | return 1; | 64 | return 1; |
| @@ -66,9 +66,10 @@ static int pdev_is_sata(struct pci_dev *pdev) | |||
| 66 | return 0; | 66 | return 0; |
| 67 | } | 67 | } |
| 68 | BUG(); | 68 | BUG(); |
| 69 | #endif | ||
| 69 | return 0; | 70 | return 0; |
| 70 | } | 71 | } |
| 71 | 72 | ||
| 72 | /** | 73 | /** |
| 73 | * is_sata - check if hwif is SATA | 74 | * is_sata - check if hwif is SATA |
| 74 | * @hwif: interface to check | 75 | * @hwif: interface to check |
| @@ -136,7 +137,7 @@ static inline unsigned long siimage_seldev(ide_drive_t *drive, int r) | |||
| 136 | * SI3112 SATA controller life is a bit simpler. | 137 | * SI3112 SATA controller life is a bit simpler. |
| 137 | */ | 138 | */ |
| 138 | 139 | ||
| 139 | static u8 sil_udma_filter(ide_drive_t *drive) | 140 | static u8 sil_pata_udma_filter(ide_drive_t *drive) |
| 140 | { | 141 | { |
| 141 | ide_hwif_t *hwif = drive->hwif; | 142 | ide_hwif_t *hwif = drive->hwif; |
| 142 | unsigned long base = (unsigned long) hwif->hwif_data; | 143 | unsigned long base = (unsigned long) hwif->hwif_data; |
| @@ -147,23 +148,23 @@ static u8 sil_udma_filter(ide_drive_t *drive) | |||
| 147 | else | 148 | else |
| 148 | pci_read_config_byte(hwif->pci_dev, 0x8A, &scsc); | 149 | pci_read_config_byte(hwif->pci_dev, 0x8A, &scsc); |
| 149 | 150 | ||
| 150 | if (is_sata(hwif)) { | ||
| 151 | mask = strstr(drive->id->model, "Maxtor") ? 0x3f : 0x7f; | ||
| 152 | goto out; | ||
| 153 | } | ||
| 154 | |||
| 155 | if ((scsc & 0x30) == 0x10) /* 133 */ | 151 | if ((scsc & 0x30) == 0x10) /* 133 */ |
| 156 | mask = 0x7f; | 152 | mask = ATA_UDMA6; |
| 157 | else if ((scsc & 0x30) == 0x20) /* 2xPCI */ | 153 | else if ((scsc & 0x30) == 0x20) /* 2xPCI */ |
| 158 | mask = 0x7f; | 154 | mask = ATA_UDMA6; |
| 159 | else if ((scsc & 0x30) == 0x00) /* 100 */ | 155 | else if ((scsc & 0x30) == 0x00) /* 100 */ |
| 160 | mask = 0x3f; | 156 | mask = ATA_UDMA5; |
| 161 | else /* Disabled ? */ | 157 | else /* Disabled ? */ |
| 162 | BUG(); | 158 | BUG(); |
| 163 | out: | 159 | |
| 164 | return mask; | 160 | return mask; |
| 165 | } | 161 | } |
| 166 | 162 | ||
| 163 | static u8 sil_sata_udma_filter(ide_drive_t *drive) | ||
| 164 | { | ||
| 165 | return strstr(drive->id->model, "Maxtor") ? ATA_UDMA5 : ATA_UDMA6; | ||
| 166 | } | ||
| 167 | |||
| 167 | /** | 168 | /** |
| 168 | * sil_set_pio_mode - set host controller for PIO mode | 169 | * sil_set_pio_mode - set host controller for PIO mode |
| 169 | * @drive: drive | 170 | * @drive: drive |
| @@ -340,10 +341,11 @@ static int siimage_io_ide_dma_test_irq (ide_drive_t *drive) | |||
| 340 | static int siimage_mmio_ide_dma_test_irq (ide_drive_t *drive) | 341 | static int siimage_mmio_ide_dma_test_irq (ide_drive_t *drive) |
| 341 | { | 342 | { |
| 342 | ide_hwif_t *hwif = HWIF(drive); | 343 | ide_hwif_t *hwif = HWIF(drive); |
| 343 | unsigned long base = (unsigned long)hwif->hwif_data; | ||
| 344 | unsigned long addr = siimage_selreg(hwif, 0x1); | 344 | unsigned long addr = siimage_selreg(hwif, 0x1); |
| 345 | 345 | ||
| 346 | if (SATA_ERROR_REG) { | 346 | if (SATA_ERROR_REG) { |
| 347 | unsigned long base = (unsigned long)hwif->hwif_data; | ||
| 348 | |||
| 347 | u32 ext_stat = readl((void __iomem *)(base + 0x10)); | 349 | u32 ext_stat = readl((void __iomem *)(base + 0x10)); |
| 348 | u8 watchdog = 0; | 350 | u8 watchdog = 0; |
| 349 | if (ext_stat & ((hwif->channel) ? 0x40 : 0x10)) { | 351 | if (ext_stat & ((hwif->channel) ? 0x40 : 0x10)) { |
| @@ -376,7 +378,7 @@ static int siimage_mmio_ide_dma_test_irq (ide_drive_t *drive) | |||
| 376 | } | 378 | } |
| 377 | 379 | ||
| 378 | /** | 380 | /** |
| 379 | * siimage_busproc - bus isolation ioctl | 381 | * sil_sata_busproc - bus isolation IOCTL |
| 380 | * @drive: drive to isolate/restore | 382 | * @drive: drive to isolate/restore |
| 381 | * @state: bus state to set | 383 | * @state: bus state to set |
| 382 | * | 384 | * |
| @@ -384,8 +386,8 @@ static int siimage_mmio_ide_dma_test_irq (ide_drive_t *drive) | |||
| 384 | * SATA controller the work required is quite limited, we | 386 | * SATA controller the work required is quite limited, we |
| 385 | * just have to clean up the statistics | 387 | * just have to clean up the statistics |
| 386 | */ | 388 | */ |
| 387 | 389 | ||
| 388 | static int siimage_busproc (ide_drive_t * drive, int state) | 390 | static int sil_sata_busproc(ide_drive_t * drive, int state) |
| 389 | { | 391 | { |
| 390 | ide_hwif_t *hwif = HWIF(drive); | 392 | ide_hwif_t *hwif = HWIF(drive); |
| 391 | u32 stat_config = 0; | 393 | u32 stat_config = 0; |
| @@ -417,14 +419,14 @@ static int siimage_busproc (ide_drive_t * drive, int state) | |||
| 417 | } | 419 | } |
| 418 | 420 | ||
| 419 | /** | 421 | /** |
| 420 | * siimage_reset_poll - wait for sata reset | 422 | * sil_sata_reset_poll - wait for SATA reset |
| 421 | * @drive: drive we are resetting | 423 | * @drive: drive we are resetting |
| 422 | * | 424 | * |
| 423 | * Poll the SATA phy and see whether it has come back from the dead | 425 | * Poll the SATA phy and see whether it has come back from the dead |
| 424 | * yet. | 426 | * yet. |
| 425 | */ | 427 | */ |
| 426 | 428 | ||
| 427 | static int siimage_reset_poll (ide_drive_t *drive) | 429 | static int sil_sata_reset_poll(ide_drive_t *drive) |
| 428 | { | 430 | { |
| 429 | if (SATA_STATUS_REG) { | 431 | if (SATA_STATUS_REG) { |
| 430 | ide_hwif_t *hwif = HWIF(drive); | 432 | ide_hwif_t *hwif = HWIF(drive); |
| @@ -436,27 +438,22 @@ static int siimage_reset_poll (ide_drive_t *drive) | |||
| 436 | HWGROUP(drive)->polling = 0; | 438 | HWGROUP(drive)->polling = 0; |
| 437 | return ide_started; | 439 | return ide_started; |
| 438 | } | 440 | } |
| 439 | return 0; | ||
| 440 | } else { | ||
| 441 | return 0; | ||
| 442 | } | 441 | } |
| 442 | |||
| 443 | return 0; | ||
| 443 | } | 444 | } |
| 444 | 445 | ||
| 445 | /** | 446 | /** |
| 446 | * siimage_pre_reset - reset hook | 447 | * sil_sata_pre_reset - reset hook |
| 447 | * @drive: IDE device being reset | 448 | * @drive: IDE device being reset |
| 448 | * | 449 | * |
| 449 | * For the SATA devices we need to handle recalibration/geometry | 450 | * For the SATA devices we need to handle recalibration/geometry |
| 450 | * differently | 451 | * differently |
| 451 | */ | 452 | */ |
| 452 | |||
| 453 | static void siimage_pre_reset (ide_drive_t *drive) | ||
| 454 | { | ||
| 455 | if (drive->media != ide_disk) | ||
| 456 | return; | ||
| 457 | 453 | ||
| 458 | if (is_sata(HWIF(drive))) | 454 | static void sil_sata_pre_reset(ide_drive_t *drive) |
| 459 | { | 455 | { |
| 456 | if (drive->media == ide_disk) { | ||
| 460 | drive->special.b.set_geometry = 0; | 457 | drive->special.b.set_geometry = 0; |
| 461 | drive->special.b.recalibrate = 0; | 458 | drive->special.b.recalibrate = 0; |
| 462 | } | 459 | } |
| @@ -502,7 +499,6 @@ static void siimage_reset (ide_drive_t *drive) | |||
| 502 | drive->failures++; | 499 | drive->failures++; |
| 503 | } | 500 | } |
| 504 | } | 501 | } |
| 505 | |||
| 506 | } | 502 | } |
| 507 | 503 | ||
| 508 | /** | 504 | /** |
| @@ -758,16 +754,11 @@ static void __devinit init_mmio_iops_siimage(ide_hwif_t *hwif) | |||
| 758 | hwif->sata_misc[SATA_IEN_OFFSET] = base + 0x148; | 754 | hwif->sata_misc[SATA_IEN_OFFSET] = base + 0x148; |
| 759 | } | 755 | } |
| 760 | 756 | ||
| 761 | hw.irq = hwif->pci_dev->irq; | 757 | memcpy(hwif->io_ports, hw.io_ports, sizeof(hwif->io_ports)); |
| 762 | 758 | ||
| 763 | memcpy(&hwif->hw, &hw, sizeof(hw)); | 759 | hwif->irq = dev->irq; |
| 764 | memcpy(hwif->io_ports, hwif->hw.io_ports, sizeof(hwif->hw.io_ports)); | ||
| 765 | 760 | ||
| 766 | hwif->irq = hw.irq; | 761 | hwif->dma_base = (unsigned long)addr + (ch ? 0x08 : 0x00); |
| 767 | |||
| 768 | base = (unsigned long) addr; | ||
| 769 | |||
| 770 | hwif->dma_base = base + (ch ? 0x08 : 0x00); | ||
| 771 | 762 | ||
| 772 | hwif->mmio = 1; | 763 | hwif->mmio = 1; |
| 773 | } | 764 | } |
| @@ -864,28 +855,31 @@ static u8 __devinit ata66_siimage(ide_hwif_t *hwif) | |||
| 864 | 855 | ||
| 865 | static void __devinit init_hwif_siimage(ide_hwif_t *hwif) | 856 | static void __devinit init_hwif_siimage(ide_hwif_t *hwif) |
| 866 | { | 857 | { |
| 858 | u8 sata = is_sata(hwif); | ||
| 859 | |||
| 867 | hwif->resetproc = &siimage_reset; | 860 | hwif->resetproc = &siimage_reset; |
| 868 | hwif->set_pio_mode = &sil_set_pio_mode; | 861 | hwif->set_pio_mode = &sil_set_pio_mode; |
| 869 | hwif->set_dma_mode = &sil_set_dma_mode; | 862 | hwif->set_dma_mode = &sil_set_dma_mode; |
| 870 | hwif->reset_poll = &siimage_reset_poll; | ||
| 871 | hwif->pre_reset = &siimage_pre_reset; | ||
| 872 | hwif->udma_filter = &sil_udma_filter; | ||
| 873 | 863 | ||
| 874 | if(is_sata(hwif)) { | 864 | if (sata) { |
| 875 | static int first = 1; | 865 | static int first = 1; |
| 876 | 866 | ||
| 877 | hwif->busproc = &siimage_busproc; | 867 | hwif->busproc = &sil_sata_busproc; |
| 868 | hwif->reset_poll = &sil_sata_reset_poll; | ||
| 869 | hwif->pre_reset = &sil_sata_pre_reset; | ||
| 870 | hwif->udma_filter = &sil_sata_udma_filter; | ||
| 878 | 871 | ||
| 879 | if (first) { | 872 | if (first) { |
| 880 | printk(KERN_INFO "siimage: For full SATA support you should use the libata sata_sil module.\n"); | 873 | printk(KERN_INFO "siimage: For full SATA support you should use the libata sata_sil module.\n"); |
| 881 | first = 0; | 874 | first = 0; |
| 882 | } | 875 | } |
| 883 | } | 876 | } else |
| 877 | hwif->udma_filter = &sil_pata_udma_filter; | ||
| 884 | 878 | ||
| 885 | if (hwif->dma_base == 0) | 879 | if (hwif->dma_base == 0) |
| 886 | return; | 880 | return; |
| 887 | 881 | ||
| 888 | if (is_sata(hwif)) | 882 | if (sata) |
| 889 | hwif->host_flags |= IDE_HFLAG_NO_ATAPI_DMA; | 883 | hwif->host_flags |= IDE_HFLAG_NO_ATAPI_DMA; |
| 890 | 884 | ||
| 891 | if (hwif->cbl != ATA_CBL_PATA40_SHORT) | 885 | if (hwif->cbl != ATA_CBL_PATA40_SHORT) |
| @@ -911,7 +905,7 @@ static void __devinit init_hwif_siimage(ide_hwif_t *hwif) | |||
| 911 | .udma_mask = ATA_UDMA6, \ | 905 | .udma_mask = ATA_UDMA6, \ |
| 912 | } | 906 | } |
| 913 | 907 | ||
| 914 | static ide_pci_device_t siimage_chipsets[] __devinitdata = { | 908 | static const struct ide_port_info siimage_chipsets[] __devinitdata = { |
| 915 | /* 0 */ DECLARE_SII_DEV("SiI680"), | 909 | /* 0 */ DECLARE_SII_DEV("SiI680"), |
| 916 | /* 1 */ DECLARE_SII_DEV("SiI3112 Serial ATA"), | 910 | /* 1 */ DECLARE_SII_DEV("SiI3112 Serial ATA"), |
| 917 | /* 2 */ DECLARE_SII_DEV("Adaptec AAR-1210SA") | 911 | /* 2 */ DECLARE_SII_DEV("Adaptec AAR-1210SA") |
diff --git a/drivers/ide/pci/sis5513.c b/drivers/ide/pci/sis5513.c index c1d280b06391..6b7bb53acefd 100644 --- a/drivers/ide/pci/sis5513.c +++ b/drivers/ide/pci/sis5513.c | |||
| @@ -264,7 +264,7 @@ static void sis_ata133_program_timings(ide_drive_t *drive, const u8 mode) | |||
| 264 | if (mode >= XFER_MW_DMA_0) { | 264 | if (mode >= XFER_MW_DMA_0) { |
| 265 | t1 &= ~0x04; /* disable UDMA */ | 265 | t1 &= ~0x04; /* disable UDMA */ |
| 266 | idx = mode - XFER_MW_DMA_0 + 5; | 266 | idx = mode - XFER_MW_DMA_0 + 5; |
| 267 | } | 267 | } else |
| 268 | idx = mode - XFER_PIO_0; | 268 | idx = mode - XFER_PIO_0; |
| 269 | t1 |= ini_time_value[clk][idx] << 12; | 269 | t1 |= ini_time_value[clk][idx] << 12; |
| 270 | t1 |= act_time_value[clk][idx] << 16; | 270 | t1 |= act_time_value[clk][idx] << 16; |
| @@ -579,7 +579,7 @@ static void __devinit init_hwif_sis5513 (ide_hwif_t *hwif) | |||
| 579 | hwif->cbl = ata66_sis5513(hwif); | 579 | hwif->cbl = ata66_sis5513(hwif); |
| 580 | } | 580 | } |
| 581 | 581 | ||
| 582 | static ide_pci_device_t sis5513_chipset __devinitdata = { | 582 | static const struct ide_port_info sis5513_chipset __devinitdata = { |
| 583 | .name = "SIS5513", | 583 | .name = "SIS5513", |
| 584 | .init_chipset = init_chipset_sis5513, | 584 | .init_chipset = init_chipset_sis5513, |
| 585 | .init_hwif = init_hwif_sis5513, | 585 | .init_hwif = init_hwif_sis5513, |
diff --git a/drivers/ide/pci/sl82c105.c b/drivers/ide/pci/sl82c105.c index 0dce459b1269..147d783f7529 100644 --- a/drivers/ide/pci/sl82c105.c +++ b/drivers/ide/pci/sl82c105.c | |||
| @@ -361,13 +361,6 @@ static void __devinit init_hwif_sl82c105(ide_hwif_t *hwif) | |||
| 361 | hwif->selectproc = &sl82c105_selectproc; | 361 | hwif->selectproc = &sl82c105_selectproc; |
| 362 | hwif->resetproc = &sl82c105_resetproc; | 362 | hwif->resetproc = &sl82c105_resetproc; |
| 363 | 363 | ||
| 364 | /* | ||
| 365 | * We support 32-bit I/O on this interface, and | ||
| 366 | * it doesn't have problems with interrupts. | ||
| 367 | */ | ||
| 368 | hwif->drives[0].io_32bit = hwif->drives[1].io_32bit = 1; | ||
| 369 | hwif->drives[0].unmask = hwif->drives[1].unmask = 1; | ||
| 370 | |||
| 371 | if (!hwif->dma_base) | 364 | if (!hwif->dma_base) |
| 372 | return; | 365 | return; |
| 373 | 366 | ||
| @@ -394,12 +387,15 @@ static void __devinit init_hwif_sl82c105(ide_hwif_t *hwif) | |||
| 394 | hwif->serialized = hwif->mate->serialized = 1; | 387 | hwif->serialized = hwif->mate->serialized = 1; |
| 395 | } | 388 | } |
| 396 | 389 | ||
| 397 | static ide_pci_device_t sl82c105_chipset __devinitdata = { | 390 | static const struct ide_port_info sl82c105_chipset __devinitdata = { |
| 398 | .name = "W82C105", | 391 | .name = "W82C105", |
| 399 | .init_chipset = init_chipset_sl82c105, | 392 | .init_chipset = init_chipset_sl82c105, |
| 400 | .init_hwif = init_hwif_sl82c105, | 393 | .init_hwif = init_hwif_sl82c105, |
| 401 | .enablebits = {{0x40,0x01,0x01}, {0x40,0x10,0x10}}, | 394 | .enablebits = {{0x40,0x01,0x01}, {0x40,0x10,0x10}}, |
| 402 | .host_flags = IDE_HFLAG_NO_AUTODMA | IDE_HFLAG_BOOTABLE, | 395 | .host_flags = IDE_HFLAG_IO_32BIT | |
| 396 | IDE_HFLAG_UNMASK_IRQS | | ||
| 397 | IDE_HFLAG_NO_AUTODMA | | ||
| 398 | IDE_HFLAG_BOOTABLE, | ||
| 403 | .pio_mask = ATA_PIO5, | 399 | .pio_mask = ATA_PIO5, |
| 404 | }; | 400 | }; |
| 405 | 401 | ||
diff --git a/drivers/ide/pci/slc90e66.c b/drivers/ide/pci/slc90e66.c index 4f22dffdf8ef..eb4445b229ed 100644 --- a/drivers/ide/pci/slc90e66.c +++ b/drivers/ide/pci/slc90e66.c | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * linux/drivers/ide/pci/slc90e66.c Version 0.18 Aug 9, 2007 | 2 | * linux/drivers/ide/pci/slc90e66.c Version 0.19 Sep 24, 2007 |
| 3 | * | 3 | * |
| 4 | * Copyright (C) 2000-2002 Andre Hedrick <andre@linux-ide.org> | 4 | * Copyright (C) 2000-2002 Andre Hedrick <andre@linux-ide.org> |
| 5 | * Copyright (C) 2006-2007 MontaVista Software, Inc. <source@mvista.com> | 5 | * Copyright (C) 2006-2007 MontaVista Software, Inc. <source@mvista.com> |
| @@ -21,6 +21,8 @@ | |||
| 21 | 21 | ||
| 22 | #include <asm/io.h> | 22 | #include <asm/io.h> |
| 23 | 23 | ||
| 24 | static DEFINE_SPINLOCK(slc90e66_lock); | ||
| 25 | |||
| 24 | static void slc90e66_set_pio_mode(ide_drive_t *drive, const u8 pio) | 26 | static void slc90e66_set_pio_mode(ide_drive_t *drive, const u8 pio) |
| 25 | { | 27 | { |
| 26 | ide_hwif_t *hwif = HWIF(drive); | 28 | ide_hwif_t *hwif = HWIF(drive); |
| @@ -40,7 +42,7 @@ static void slc90e66_set_pio_mode(ide_drive_t *drive, const u8 pio) | |||
| 40 | { 2, 1 }, | 42 | { 2, 1 }, |
| 41 | { 2, 3 }, }; | 43 | { 2, 3 }, }; |
| 42 | 44 | ||
| 43 | spin_lock_irqsave(&ide_lock, flags); | 45 | spin_lock_irqsave(&slc90e66_lock, flags); |
| 44 | pci_read_config_word(dev, master_port, &master_data); | 46 | pci_read_config_word(dev, master_port, &master_data); |
| 45 | 47 | ||
| 46 | if (pio > 1) | 48 | if (pio > 1) |
| @@ -71,7 +73,7 @@ static void slc90e66_set_pio_mode(ide_drive_t *drive, const u8 pio) | |||
| 71 | pci_write_config_word(dev, master_port, master_data); | 73 | pci_write_config_word(dev, master_port, master_data); |
| 72 | if (is_slave) | 74 | if (is_slave) |
| 73 | pci_write_config_byte(dev, slave_port, slave_data); | 75 | pci_write_config_byte(dev, slave_port, slave_data); |
| 74 | spin_unlock_irqrestore(&ide_lock, flags); | 76 | spin_unlock_irqrestore(&slc90e66_lock, flags); |
| 75 | } | 77 | } |
| 76 | 78 | ||
| 77 | static void slc90e66_set_dma_mode(ide_drive_t *drive, const u8 speed) | 79 | static void slc90e66_set_dma_mode(ide_drive_t *drive, const u8 speed) |
| @@ -146,7 +148,7 @@ static void __devinit init_hwif_slc90e66 (ide_hwif_t *hwif) | |||
| 146 | hwif->cbl = (reg47 & mask) ? ATA_CBL_PATA40 : ATA_CBL_PATA80; | 148 | hwif->cbl = (reg47 & mask) ? ATA_CBL_PATA40 : ATA_CBL_PATA80; |
| 147 | } | 149 | } |
| 148 | 150 | ||
| 149 | static ide_pci_device_t slc90e66_chipset __devinitdata = { | 151 | static const struct ide_port_info slc90e66_chipset __devinitdata = { |
| 150 | .name = "SLC90E66", | 152 | .name = "SLC90E66", |
| 151 | .init_hwif = init_hwif_slc90e66, | 153 | .init_hwif = init_hwif_slc90e66, |
| 152 | .enablebits = {{0x41,0x80,0x80}, {0x43,0x80,0x80}}, | 154 | .enablebits = {{0x41,0x80,0x80}, {0x43,0x80,0x80}}, |
diff --git a/drivers/ide/pci/tc86c001.c b/drivers/ide/pci/tc86c001.c index 631506e9b5d2..a66ebd14664e 100644 --- a/drivers/ide/pci/tc86c001.c +++ b/drivers/ide/pci/tc86c001.c | |||
| @@ -218,7 +218,7 @@ static unsigned int __devinit init_chipset_tc86c001(struct pci_dev *dev, | |||
| 218 | return err; | 218 | return err; |
| 219 | } | 219 | } |
| 220 | 220 | ||
| 221 | static ide_pci_device_t tc86c001_chipset __devinitdata = { | 221 | static const struct ide_port_info tc86c001_chipset __devinitdata = { |
| 222 | .name = "TC86C001", | 222 | .name = "TC86C001", |
| 223 | .init_chipset = init_chipset_tc86c001, | 223 | .init_chipset = init_chipset_tc86c001, |
| 224 | .init_hwif = init_hwif_tc86c001, | 224 | .init_hwif = init_hwif_tc86c001, |
diff --git a/drivers/ide/pci/triflex.c b/drivers/ide/pci/triflex.c index 30b52f62699a..a227c41d23a3 100644 --- a/drivers/ide/pci/triflex.c +++ b/drivers/ide/pci/triflex.c | |||
| @@ -102,7 +102,7 @@ static void __devinit init_hwif_triflex(ide_hwif_t *hwif) | |||
| 102 | hwif->set_dma_mode = &triflex_set_mode; | 102 | hwif->set_dma_mode = &triflex_set_mode; |
| 103 | } | 103 | } |
| 104 | 104 | ||
| 105 | static ide_pci_device_t triflex_device __devinitdata = { | 105 | static const struct ide_port_info triflex_device __devinitdata = { |
| 106 | .name = "TRIFLEX", | 106 | .name = "TRIFLEX", |
| 107 | .init_hwif = init_hwif_triflex, | 107 | .init_hwif = init_hwif_triflex, |
| 108 | .enablebits = {{0x80, 0x01, 0x01}, {0x80, 0x02, 0x02}}, | 108 | .enablebits = {{0x80, 0x01, 0x01}, {0x80, 0x02, 0x02}}, |
diff --git a/drivers/ide/pci/trm290.c b/drivers/ide/pci/trm290.c index 140d486f6237..5011ba22e36c 100644 --- a/drivers/ide/pci/trm290.c +++ b/drivers/ide/pci/trm290.c | |||
| @@ -250,7 +250,6 @@ static void __devinit init_hwif_trm290(ide_hwif_t *hwif) | |||
| 250 | u8 reg = 0; | 250 | u8 reg = 0; |
| 251 | struct pci_dev *dev = hwif->pci_dev; | 251 | struct pci_dev *dev = hwif->pci_dev; |
| 252 | 252 | ||
| 253 | hwif->chipset = ide_trm290; | ||
| 254 | cfgbase = pci_resource_start(dev, 4); | 253 | cfgbase = pci_resource_start(dev, 4); |
| 255 | if ((dev->class & 5) && cfgbase) { | 254 | if ((dev->class & 5) && cfgbase) { |
| 256 | hwif->config_data = cfgbase; | 255 | hwif->config_data = cfgbase; |
| @@ -320,9 +319,10 @@ static void __devinit init_hwif_trm290(ide_hwif_t *hwif) | |||
| 320 | #endif | 319 | #endif |
| 321 | } | 320 | } |
| 322 | 321 | ||
| 323 | static ide_pci_device_t trm290_chipset __devinitdata = { | 322 | static const struct ide_port_info trm290_chipset __devinitdata = { |
| 324 | .name = "TRM290", | 323 | .name = "TRM290", |
| 325 | .init_hwif = init_hwif_trm290, | 324 | .init_hwif = init_hwif_trm290, |
| 325 | .chipset = ide_trm290, | ||
| 326 | .host_flags = IDE_HFLAG_NO_ATAPI_DMA | | 326 | .host_flags = IDE_HFLAG_NO_ATAPI_DMA | |
| 327 | #if 0 /* play it safe for now */ | 327 | #if 0 /* play it safe for now */ |
| 328 | IDE_HFLAG_TRUST_BIOS_FOR_DMA | | 328 | IDE_HFLAG_TRUST_BIOS_FOR_DMA | |
diff --git a/drivers/ide/pci/via82cxxx.c b/drivers/ide/pci/via82cxxx.c index c8022a92a0e3..a0d3c16b68ec 100644 --- a/drivers/ide/pci/via82cxxx.c +++ b/drivers/ide/pci/via82cxxx.c | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * | 2 | * |
| 3 | * Version 3.49 | 3 | * Version 3.50 |
| 4 | * | 4 | * |
| 5 | * VIA IDE driver for Linux. Supported southbridges: | 5 | * VIA IDE driver for Linux. Supported southbridges: |
| 6 | * | 6 | * |
| @@ -422,65 +422,40 @@ static u8 __devinit via82cxxx_cable_detect(ide_hwif_t *hwif) | |||
| 422 | 422 | ||
| 423 | static void __devinit init_hwif_via82cxxx(ide_hwif_t *hwif) | 423 | static void __devinit init_hwif_via82cxxx(ide_hwif_t *hwif) |
| 424 | { | 424 | { |
| 425 | struct via82cxxx_dev *vdev = pci_get_drvdata(hwif->pci_dev); | ||
| 426 | int i; | ||
| 427 | |||
| 428 | hwif->set_pio_mode = &via_set_pio_mode; | 425 | hwif->set_pio_mode = &via_set_pio_mode; |
| 429 | hwif->set_dma_mode = &via_set_drive; | 426 | hwif->set_dma_mode = &via_set_drive; |
| 430 | 427 | ||
| 431 | #ifdef CONFIG_PPC_CHRP | ||
| 432 | if(machine_is(chrp) && _chrp_type == _CHRP_Pegasos) { | ||
| 433 | hwif->irq = hwif->channel ? 15 : 14; | ||
| 434 | } | ||
| 435 | #endif | ||
| 436 | |||
| 437 | for (i = 0; i < 2; i++) { | ||
| 438 | hwif->drives[i].io_32bit = 1; | ||
| 439 | hwif->drives[i].unmask = (vdev->via_config->flags & VIA_NO_UNMASK) ? 0 : 1; | ||
| 440 | } | ||
| 441 | |||
| 442 | if (!hwif->dma_base) | 428 | if (!hwif->dma_base) |
| 443 | return; | 429 | return; |
| 444 | 430 | ||
| 445 | hwif->ultra_mask = vdev->via_config->udma_mask; | ||
| 446 | |||
| 447 | if (hwif->cbl != ATA_CBL_PATA40_SHORT) | 431 | if (hwif->cbl != ATA_CBL_PATA40_SHORT) |
| 448 | hwif->cbl = via82cxxx_cable_detect(hwif); | 432 | hwif->cbl = via82cxxx_cable_detect(hwif); |
| 449 | } | 433 | } |
| 450 | 434 | ||
| 451 | static ide_pci_device_t via82cxxx_chipsets[] __devinitdata = { | 435 | static const struct ide_port_info via82cxxx_chipset __devinitdata = { |
| 452 | { /* 0 */ | 436 | .name = "VP_IDE", |
| 453 | .name = "VP_IDE", | 437 | .init_chipset = init_chipset_via82cxxx, |
| 454 | .init_chipset = init_chipset_via82cxxx, | 438 | .init_hwif = init_hwif_via82cxxx, |
| 455 | .init_hwif = init_hwif_via82cxxx, | 439 | .enablebits = { { 0x40, 0x02, 0x02 }, { 0x40, 0x01, 0x01 } }, |
| 456 | .enablebits = {{0x40,0x02,0x02}, {0x40,0x01,0x01}}, | 440 | .host_flags = IDE_HFLAG_PIO_NO_BLACKLIST | |
| 457 | .host_flags = IDE_HFLAG_PIO_NO_BLACKLIST | | 441 | IDE_HFLAG_PIO_NO_DOWNGRADE | |
| 458 | IDE_HFLAG_PIO_NO_DOWNGRADE | | 442 | IDE_HFLAG_POST_SET_MODE | |
| 459 | IDE_HFLAG_POST_SET_MODE | | 443 | IDE_HFLAG_IO_32BIT | |
| 460 | IDE_HFLAG_NO_AUTODMA | | 444 | IDE_HFLAG_BOOTABLE, |
| 461 | IDE_HFLAG_BOOTABLE, | 445 | .pio_mask = ATA_PIO5, |
| 462 | .pio_mask = ATA_PIO5, | 446 | .swdma_mask = ATA_SWDMA2, |
| 463 | .swdma_mask = ATA_SWDMA2, | 447 | .mwdma_mask = ATA_MWDMA2, |
| 464 | .mwdma_mask = ATA_MWDMA2, | ||
| 465 | },{ /* 1 */ | ||
| 466 | .name = "VP_IDE", | ||
| 467 | .init_chipset = init_chipset_via82cxxx, | ||
| 468 | .init_hwif = init_hwif_via82cxxx, | ||
| 469 | .enablebits = {{0x00,0x00,0x00}, {0x00,0x00,0x00}}, | ||
| 470 | .host_flags = IDE_HFLAG_PIO_NO_BLACKLIST | | ||
| 471 | IDE_HFLAG_PIO_NO_DOWNGRADE | | ||
| 472 | IDE_HFLAG_POST_SET_MODE | | ||
| 473 | IDE_HFLAG_BOOTABLE, | ||
| 474 | .pio_mask = ATA_PIO5, | ||
| 475 | .swdma_mask = ATA_SWDMA2, | ||
| 476 | .mwdma_mask = ATA_MWDMA2, | ||
| 477 | } | ||
| 478 | }; | 448 | }; |
| 479 | 449 | ||
| 480 | static int __devinit via_init_one(struct pci_dev *dev, const struct pci_device_id *id) | 450 | static int __devinit via_init_one(struct pci_dev *dev, const struct pci_device_id *id) |
| 481 | { | 451 | { |
| 482 | struct pci_dev *isa = NULL; | 452 | struct pci_dev *isa = NULL; |
| 483 | struct via_isa_bridge *via_config; | 453 | struct via_isa_bridge *via_config; |
| 454 | u8 idx = id->driver_data; | ||
| 455 | struct ide_port_info d; | ||
| 456 | |||
| 457 | d = via82cxxx_chipset; | ||
| 458 | |||
| 484 | /* | 459 | /* |
| 485 | * Find the ISA bridge and check we know what it is. | 460 | * Find the ISA bridge and check we know what it is. |
| 486 | */ | 461 | */ |
| @@ -490,7 +465,23 @@ static int __devinit via_init_one(struct pci_dev *dev, const struct pci_device_i | |||
| 490 | printk(KERN_WARNING "VP_IDE: Unknown VIA SouthBridge, disabling DMA.\n"); | 465 | printk(KERN_WARNING "VP_IDE: Unknown VIA SouthBridge, disabling DMA.\n"); |
| 491 | return -ENODEV; | 466 | return -ENODEV; |
| 492 | } | 467 | } |
| 493 | return ide_setup_pci_device(dev, &via82cxxx_chipsets[id->driver_data]); | 468 | |
| 469 | if (idx == 0) | ||
| 470 | d.host_flags |= IDE_HFLAG_NO_AUTODMA; | ||
| 471 | else | ||
| 472 | d.enablebits[1].reg = d.enablebits[0].reg = 0; | ||
| 473 | |||
| 474 | if ((via_config->flags & VIA_NO_UNMASK) == 0) | ||
| 475 | d.host_flags |= IDE_HFLAG_UNMASK_IRQS; | ||
| 476 | |||
| 477 | #ifdef CONFIG_PPC_CHRP | ||
| 478 | if (machine_is(chrp) && _chrp_type == _CHRP_Pegasos) | ||
| 479 | d.host_flags |= IDE_HFLAG_FORCE_LEGACY_IRQS; | ||
| 480 | #endif | ||
| 481 | |||
| 482 | d.udma_mask = via_config->udma_mask; | ||
| 483 | |||
| 484 | return ide_setup_pci_device(dev, &d); | ||
| 494 | } | 485 | } |
| 495 | 486 | ||
| 496 | static const struct pci_device_id via_pci_tbl[] = { | 487 | static const struct pci_device_id via_pci_tbl[] = { |
diff --git a/drivers/ide/ppc/mpc8xx.c b/drivers/ide/ppc/mpc8xx.c index df2e92034f5d..5f0da35ab5ad 100644 --- a/drivers/ide/ppc/mpc8xx.c +++ b/drivers/ide/ppc/mpc8xx.c | |||
| @@ -316,8 +316,8 @@ m8xx_ide_init_hwif_ports(hw_regs_t *hw, unsigned long data_port, | |||
| 316 | 316 | ||
| 317 | ide_hwifs[data_port].pio_mask = ATA_PIO4; | 317 | ide_hwifs[data_port].pio_mask = ATA_PIO4; |
| 318 | ide_hwifs[data_port].set_pio_mode = m8xx_ide_set_pio_mode; | 318 | ide_hwifs[data_port].set_pio_mode = m8xx_ide_set_pio_mode; |
| 319 | ide_hwifs[data_port].ack_intr = (ide_ack_intr_t *)ide_interrupt_ack; | ||
| 319 | 320 | ||
| 320 | hw->ack_intr = (ide_ack_intr_t *) ide_interrupt_ack; | ||
| 321 | /* Enable Harddisk Interrupt, | 321 | /* Enable Harddisk Interrupt, |
| 322 | * and make it edge sensitive | 322 | * and make it edge sensitive |
| 323 | */ | 323 | */ |
| @@ -402,8 +402,8 @@ void m8xx_ide_init_hwif_ports (hw_regs_t *hw, | |||
| 402 | 402 | ||
| 403 | ide_hwifs[data_port].pio_mask = ATA_PIO4; | 403 | ide_hwifs[data_port].pio_mask = ATA_PIO4; |
| 404 | ide_hwifs[data_port].set_pio_mode = m8xx_ide_set_pio_mode; | 404 | ide_hwifs[data_port].set_pio_mode = m8xx_ide_set_pio_mode; |
| 405 | ide_hwifs[data_port].ack_intr = (ide_ack_intr_t *)ide_interrupt_ack; | ||
| 405 | 406 | ||
| 406 | hw->ack_intr = (ide_ack_intr_t *) ide_interrupt_ack; | ||
| 407 | /* Enable Harddisk Interrupt, | 407 | /* Enable Harddisk Interrupt, |
| 408 | * and make it edge sensitive | 408 | * and make it edge sensitive |
| 409 | */ | 409 | */ |
diff --git a/drivers/ide/ppc/pmac.c b/drivers/ide/ppc/pmac.c index c55479356768..816b5311dad6 100644 --- a/drivers/ide/ppc/pmac.c +++ b/drivers/ide/ppc/pmac.c | |||
| @@ -1039,6 +1039,8 @@ pmac_ide_setup_device(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif) | |||
| 1039 | { | 1039 | { |
| 1040 | struct device_node *np = pmif->node; | 1040 | struct device_node *np = pmif->node; |
| 1041 | const int *bidp; | 1041 | const int *bidp; |
| 1042 | u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; | ||
| 1043 | hw_regs_t hw; | ||
| 1042 | 1044 | ||
| 1043 | pmif->cable_80 = 0; | 1045 | pmif->cable_80 = 0; |
| 1044 | pmif->broken_dma = pmif->broken_dma_warn = 0; | 1046 | pmif->broken_dma = pmif->broken_dma_warn = 0; |
| @@ -1124,8 +1126,9 @@ pmac_ide_setup_device(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif) | |||
| 1124 | /* Tell common code _not_ to mess with resources */ | 1126 | /* Tell common code _not_ to mess with resources */ |
| 1125 | hwif->mmio = 1; | 1127 | hwif->mmio = 1; |
| 1126 | hwif->hwif_data = pmif; | 1128 | hwif->hwif_data = pmif; |
| 1127 | pmac_ide_init_hwif_ports(&hwif->hw, pmif->regbase, 0, &hwif->irq); | 1129 | memset(&hw, 0, sizeof(hw)); |
| 1128 | memcpy(hwif->io_ports, hwif->hw.io_ports, sizeof(hwif->io_ports)); | 1130 | pmac_ide_init_hwif_ports(&hw, pmif->regbase, 0, &hwif->irq); |
| 1131 | memcpy(hwif->io_ports, hw.io_ports, sizeof(hwif->io_ports)); | ||
| 1129 | hwif->chipset = ide_pmac; | 1132 | hwif->chipset = ide_pmac; |
| 1130 | hwif->noprobe = !hwif->io_ports[IDE_DATA_OFFSET] || pmif->mediabay; | 1133 | hwif->noprobe = !hwif->io_ports[IDE_DATA_OFFSET] || pmif->mediabay; |
| 1131 | hwif->hold = pmif->mediabay; | 1134 | hwif->hold = pmif->mediabay; |
| @@ -1163,10 +1166,9 @@ pmac_ide_setup_device(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif) | |||
| 1163 | pmac_ide_setup_dma(pmif, hwif); | 1166 | pmac_ide_setup_dma(pmif, hwif); |
| 1164 | #endif /* CONFIG_BLK_DEV_IDEDMA_PMAC */ | 1167 | #endif /* CONFIG_BLK_DEV_IDEDMA_PMAC */ |
| 1165 | 1168 | ||
| 1166 | /* We probe the hwif now */ | 1169 | idx[0] = hwif->index; |
| 1167 | probe_hwif_init(hwif); | ||
| 1168 | 1170 | ||
| 1169 | ide_proc_register_port(hwif); | 1171 | ide_device_add(idx); |
| 1170 | 1172 | ||
| 1171 | return 0; | 1173 | return 0; |
| 1172 | } | 1174 | } |
diff --git a/drivers/ide/setup-pci.c b/drivers/ide/setup-pci.c index fff567bcedbe..02d14bf85ab2 100644 --- a/drivers/ide/setup-pci.c +++ b/drivers/ide/setup-pci.c | |||
| @@ -147,15 +147,15 @@ static int ide_setup_pci_baseregs (struct pci_dev *dev, const char *name) | |||
| 147 | #ifdef CONFIG_BLK_DEV_IDEDMA_PCI | 147 | #ifdef CONFIG_BLK_DEV_IDEDMA_PCI |
| 148 | /** | 148 | /** |
| 149 | * ide_get_or_set_dma_base - setup BMIBA | 149 | * ide_get_or_set_dma_base - setup BMIBA |
| 150 | * @d: IDE pci device data | 150 | * @d: IDE port info |
| 151 | * @hwif: Interface | 151 | * @hwif: IDE interface |
| 152 | * | 152 | * |
| 153 | * Fetch the DMA Bus-Master-I/O-Base-Address (BMIBA) from PCI space. | 153 | * Fetch the DMA Bus-Master-I/O-Base-Address (BMIBA) from PCI space. |
| 154 | * Where a device has a partner that is already in DMA mode we check | 154 | * Where a device has a partner that is already in DMA mode we check |
| 155 | * and enforce IDE simplex rules. | 155 | * and enforce IDE simplex rules. |
| 156 | */ | 156 | */ |
| 157 | 157 | ||
| 158 | static unsigned long ide_get_or_set_dma_base(ide_pci_device_t *d, ide_hwif_t *hwif) | 158 | static unsigned long ide_get_or_set_dma_base(const struct ide_port_info *d, ide_hwif_t *hwif) |
| 159 | { | 159 | { |
| 160 | unsigned long dma_base = 0; | 160 | unsigned long dma_base = 0; |
| 161 | struct pci_dev *dev = hwif->pci_dev; | 161 | struct pci_dev *dev = hwif->pci_dev; |
| @@ -225,10 +225,11 @@ static unsigned long ide_get_or_set_dma_base(ide_pci_device_t *d, ide_hwif_t *hw | |||
| 225 | } | 225 | } |
| 226 | #endif /* CONFIG_BLK_DEV_IDEDMA_PCI */ | 226 | #endif /* CONFIG_BLK_DEV_IDEDMA_PCI */ |
| 227 | 227 | ||
| 228 | void ide_setup_pci_noise (struct pci_dev *dev, ide_pci_device_t *d) | 228 | void ide_setup_pci_noise(struct pci_dev *dev, const struct ide_port_info *d) |
| 229 | { | 229 | { |
| 230 | printk(KERN_INFO "%s: IDE controller at PCI slot %s\n", | 230 | printk(KERN_INFO "%s: IDE controller (0x%04x:0x%04x rev 0x%02x) at " |
| 231 | d->name, pci_name(dev)); | 231 | " PCI slot %s\n", d->name, dev->vendor, dev->device, |
| 232 | dev->revision, pci_name(dev)); | ||
| 232 | } | 233 | } |
| 233 | 234 | ||
| 234 | EXPORT_SYMBOL_GPL(ide_setup_pci_noise); | 235 | EXPORT_SYMBOL_GPL(ide_setup_pci_noise); |
| @@ -237,15 +238,15 @@ EXPORT_SYMBOL_GPL(ide_setup_pci_noise); | |||
| 237 | /** | 238 | /** |
| 238 | * ide_pci_enable - do PCI enables | 239 | * ide_pci_enable - do PCI enables |
| 239 | * @dev: PCI device | 240 | * @dev: PCI device |
| 240 | * @d: IDE pci device data | 241 | * @d: IDE port info |
| 241 | * | 242 | * |
| 242 | * Enable the IDE PCI device. We attempt to enable the device in full | 243 | * Enable the IDE PCI device. We attempt to enable the device in full |
| 243 | * but if that fails then we only need BAR4 so we will enable that. | 244 | * but if that fails then we only need BAR4 so we will enable that. |
| 244 | * | 245 | * |
| 245 | * Returns zero on success or an error code | 246 | * Returns zero on success or an error code |
| 246 | */ | 247 | */ |
| 247 | 248 | ||
| 248 | static int ide_pci_enable(struct pci_dev *dev, ide_pci_device_t *d) | 249 | static int ide_pci_enable(struct pci_dev *dev, const struct ide_port_info *d) |
| 249 | { | 250 | { |
| 250 | int ret; | 251 | int ret; |
| 251 | 252 | ||
| @@ -260,9 +261,9 @@ static int ide_pci_enable(struct pci_dev *dev, ide_pci_device_t *d) | |||
| 260 | } | 261 | } |
| 261 | 262 | ||
| 262 | /* | 263 | /* |
| 263 | * assume all devices can do 32-bit dma for now. we can add a | 264 | * assume all devices can do 32-bit DMA for now, we can add |
| 264 | * dma mask field to the ide_pci_device_t if we need it (or let | 265 | * a DMA mask field to the struct ide_port_info if we need it |
| 265 | * lower level driver set the dma mask) | 266 | * (or let lower level driver set the DMA mask) |
| 266 | */ | 267 | */ |
| 267 | ret = pci_set_dma_mask(dev, DMA_32BIT_MASK); | 268 | ret = pci_set_dma_mask(dev, DMA_32BIT_MASK); |
| 268 | if (ret < 0) { | 269 | if (ret < 0) { |
| @@ -284,13 +285,13 @@ out: | |||
| 284 | /** | 285 | /** |
| 285 | * ide_pci_configure - configure an unconfigured device | 286 | * ide_pci_configure - configure an unconfigured device |
| 286 | * @dev: PCI device | 287 | * @dev: PCI device |
| 287 | * @d: IDE pci device data | 288 | * @d: IDE port info |
| 288 | * | 289 | * |
| 289 | * Enable and configure the PCI device we have been passed. | 290 | * Enable and configure the PCI device we have been passed. |
| 290 | * Returns zero on success or an error code. | 291 | * Returns zero on success or an error code. |
| 291 | */ | 292 | */ |
| 292 | 293 | ||
| 293 | static int ide_pci_configure(struct pci_dev *dev, ide_pci_device_t *d) | 294 | static int ide_pci_configure(struct pci_dev *dev, const struct ide_port_info *d) |
| 294 | { | 295 | { |
| 295 | u16 pcicmd = 0; | 296 | u16 pcicmd = 0; |
| 296 | /* | 297 | /* |
| @@ -318,15 +319,15 @@ static int ide_pci_configure(struct pci_dev *dev, ide_pci_device_t *d) | |||
| 318 | 319 | ||
| 319 | /** | 320 | /** |
| 320 | * ide_pci_check_iomem - check a register is I/O | 321 | * ide_pci_check_iomem - check a register is I/O |
| 321 | * @dev: pci device | 322 | * @dev: PCI device |
| 322 | * @d: ide_pci_device | 323 | * @d: IDE port info |
| 323 | * @bar: bar number | 324 | * @bar: BAR number |
| 324 | * | 325 | * |
| 325 | * Checks if a BAR is configured and points to MMIO space. If so | 326 | * Checks if a BAR is configured and points to MMIO space. If so |
| 326 | * print an error and return an error code. Otherwise return 0 | 327 | * print an error and return an error code. Otherwise return 0 |
| 327 | */ | 328 | */ |
| 328 | 329 | ||
| 329 | static int ide_pci_check_iomem(struct pci_dev *dev, ide_pci_device_t *d, int bar) | 330 | static int ide_pci_check_iomem(struct pci_dev *dev, const struct ide_port_info *d, int bar) |
| 330 | { | 331 | { |
| 331 | ulong flags = pci_resource_flags(dev, bar); | 332 | ulong flags = pci_resource_flags(dev, bar); |
| 332 | 333 | ||
| @@ -348,7 +349,7 @@ static int ide_pci_check_iomem(struct pci_dev *dev, ide_pci_device_t *d, int bar | |||
| 348 | /** | 349 | /** |
| 349 | * ide_hwif_configure - configure an IDE interface | 350 | * ide_hwif_configure - configure an IDE interface |
| 350 | * @dev: PCI device holding interface | 351 | * @dev: PCI device holding interface |
| 351 | * @d: IDE pci data | 352 | * @d: IDE port info |
| 352 | * @mate: Paired interface if any | 353 | * @mate: Paired interface if any |
| 353 | * | 354 | * |
| 354 | * Perform the initial set up for the hardware interface structure. This | 355 | * Perform the initial set up for the hardware interface structure. This |
| @@ -357,8 +358,8 @@ static int ide_pci_check_iomem(struct pci_dev *dev, ide_pci_device_t *d, int bar | |||
| 357 | * | 358 | * |
| 358 | * Returns the new hardware interface structure, or NULL on a failure | 359 | * Returns the new hardware interface structure, or NULL on a failure |
| 359 | */ | 360 | */ |
| 360 | 361 | ||
| 361 | static ide_hwif_t *ide_hwif_configure(struct pci_dev *dev, ide_pci_device_t *d, ide_hwif_t *mate, int port, int irq) | 362 | static ide_hwif_t *ide_hwif_configure(struct pci_dev *dev, const struct ide_port_info *d, ide_hwif_t *mate, int port, int irq) |
| 362 | { | 363 | { |
| 363 | unsigned long ctl = 0, base = 0; | 364 | unsigned long ctl = 0, base = 0; |
| 364 | ide_hwif_t *hwif; | 365 | ide_hwif_t *hwif; |
| @@ -387,19 +388,20 @@ static ide_hwif_t *ide_hwif_configure(struct pci_dev *dev, ide_pci_device_t *d, | |||
| 387 | return NULL; /* no room in ide_hwifs[] */ | 388 | return NULL; /* no room in ide_hwifs[] */ |
| 388 | if (hwif->io_ports[IDE_DATA_OFFSET] != base || | 389 | if (hwif->io_ports[IDE_DATA_OFFSET] != base || |
| 389 | hwif->io_ports[IDE_CONTROL_OFFSET] != (ctl | 2)) { | 390 | hwif->io_ports[IDE_CONTROL_OFFSET] != (ctl | 2)) { |
| 390 | memset(&hwif->hw, 0, sizeof(hwif->hw)); | 391 | hw_regs_t hw; |
| 391 | #ifndef IDE_ARCH_OBSOLETE_INIT | 392 | |
| 392 | ide_std_init_ports(&hwif->hw, base, (ctl | 2)); | 393 | memset(&hw, 0, sizeof(hw)); |
| 393 | hwif->hw.io_ports[IDE_IRQ_OFFSET] = 0; | 394 | #ifndef CONFIG_IDE_ARCH_OBSOLETE_INIT |
| 395 | ide_std_init_ports(&hw, base, ctl | 2); | ||
| 394 | #else | 396 | #else |
| 395 | ide_init_hwif_ports(&hwif->hw, base, (ctl | 2), NULL); | 397 | ide_init_hwif_ports(&hw, base, ctl | 2, NULL); |
| 396 | #endif | 398 | #endif |
| 397 | memcpy(hwif->io_ports, hwif->hw.io_ports, sizeof(hwif->io_ports)); | 399 | memcpy(hwif->io_ports, hw.io_ports, sizeof(hwif->io_ports)); |
| 398 | hwif->noprobe = !hwif->io_ports[IDE_DATA_OFFSET]; | 400 | hwif->noprobe = !hwif->io_ports[IDE_DATA_OFFSET]; |
| 399 | } | 401 | } |
| 400 | hwif->chipset = ide_pci; | 402 | hwif->chipset = d->chipset ? d->chipset : ide_pci; |
| 401 | hwif->pci_dev = dev; | 403 | hwif->pci_dev = dev; |
| 402 | hwif->cds = (struct ide_pci_device_s *) d; | 404 | hwif->cds = d; |
| 403 | hwif->channel = port; | 405 | hwif->channel = port; |
| 404 | 406 | ||
| 405 | if (!hwif->irq) | 407 | if (!hwif->irq) |
| @@ -414,21 +416,17 @@ static ide_hwif_t *ide_hwif_configure(struct pci_dev *dev, ide_pci_device_t *d, | |||
| 414 | /** | 416 | /** |
| 415 | * ide_hwif_setup_dma - configure DMA interface | 417 | * ide_hwif_setup_dma - configure DMA interface |
| 416 | * @dev: PCI device | 418 | * @dev: PCI device |
| 417 | * @d: IDE pci data | 419 | * @d: IDE port info |
| 418 | * @hwif: Hardware interface we are configuring | 420 | * @hwif: IDE interface |
| 419 | * | 421 | * |
| 420 | * Set up the DMA base for the interface. Enable the master bits as | 422 | * Set up the DMA base for the interface. Enable the master bits as |
| 421 | * necessary and attempt to bring the device DMA into a ready to use | 423 | * necessary and attempt to bring the device DMA into a ready to use |
| 422 | * state | 424 | * state |
| 423 | */ | 425 | */ |
| 424 | 426 | ||
| 425 | #ifndef CONFIG_BLK_DEV_IDEDMA_PCI | 427 | static void ide_hwif_setup_dma(struct pci_dev *dev, const struct ide_port_info *d, ide_hwif_t *hwif) |
| 426 | static void ide_hwif_setup_dma(struct pci_dev *dev, ide_pci_device_t *d, ide_hwif_t *hwif) | ||
| 427 | { | ||
| 428 | } | ||
| 429 | #else | ||
| 430 | static void ide_hwif_setup_dma(struct pci_dev *dev, ide_pci_device_t *d, ide_hwif_t *hwif) | ||
| 431 | { | 428 | { |
| 429 | #ifdef CONFIG_BLK_DEV_IDEDMA_PCI | ||
| 432 | u16 pcicmd; | 430 | u16 pcicmd; |
| 433 | 431 | ||
| 434 | pci_read_config_word(dev, PCI_COMMAND, &pcicmd); | 432 | pci_read_config_word(dev, PCI_COMMAND, &pcicmd); |
| @@ -460,13 +458,13 @@ static void ide_hwif_setup_dma(struct pci_dev *dev, ide_pci_device_t *d, ide_hwi | |||
| 460 | "(BIOS)\n", hwif->name, d->name); | 458 | "(BIOS)\n", hwif->name, d->name); |
| 461 | } | 459 | } |
| 462 | } | 460 | } |
| 463 | } | ||
| 464 | #endif /* CONFIG_BLK_DEV_IDEDMA_PCI*/ | 461 | #endif /* CONFIG_BLK_DEV_IDEDMA_PCI*/ |
| 462 | } | ||
| 465 | 463 | ||
| 466 | /** | 464 | /** |
| 467 | * ide_setup_pci_controller - set up IDE PCI | 465 | * ide_setup_pci_controller - set up IDE PCI |
| 468 | * @dev: PCI device | 466 | * @dev: PCI device |
| 469 | * @d: IDE PCI data | 467 | * @d: IDE port info |
| 470 | * @noisy: verbose flag | 468 | * @noisy: verbose flag |
| 471 | * @config: returned as 1 if we configured the hardware | 469 | * @config: returned as 1 if we configured the hardware |
| 472 | * | 470 | * |
| @@ -474,8 +472,8 @@ static void ide_hwif_setup_dma(struct pci_dev *dev, ide_pci_device_t *d, ide_hwi | |||
| 474 | * up the PCI side of the device, checks that the device is enabled | 472 | * up the PCI side of the device, checks that the device is enabled |
| 475 | * and enables it if need be | 473 | * and enables it if need be |
| 476 | */ | 474 | */ |
| 477 | 475 | ||
| 478 | static int ide_setup_pci_controller(struct pci_dev *dev, ide_pci_device_t *d, int noisy, int *config) | 476 | static int ide_setup_pci_controller(struct pci_dev *dev, const struct ide_port_info *d, int noisy, int *config) |
| 479 | { | 477 | { |
| 480 | int ret; | 478 | int ret; |
| 481 | u16 pcicmd; | 479 | u16 pcicmd; |
| @@ -500,9 +498,6 @@ static int ide_setup_pci_controller(struct pci_dev *dev, ide_pci_device_t *d, in | |||
| 500 | printk(KERN_INFO "%s: device enabled (Linux)\n", d->name); | 498 | printk(KERN_INFO "%s: device enabled (Linux)\n", d->name); |
| 501 | } | 499 | } |
| 502 | 500 | ||
| 503 | if (noisy) | ||
| 504 | printk(KERN_INFO "%s: chipset revision %d\n", | ||
| 505 | d->name, dev->revision); | ||
| 506 | out: | 501 | out: |
| 507 | return ret; | 502 | return ret; |
| 508 | } | 503 | } |
| @@ -510,9 +505,9 @@ out: | |||
| 510 | /** | 505 | /** |
| 511 | * ide_pci_setup_ports - configure ports/devices on PCI IDE | 506 | * ide_pci_setup_ports - configure ports/devices on PCI IDE |
| 512 | * @dev: PCI device | 507 | * @dev: PCI device |
| 513 | * @d: IDE pci device info | 508 | * @d: IDE port info |
| 514 | * @pciirq: IRQ line | 509 | * @pciirq: IRQ line |
| 515 | * @index: ata index to update | 510 | * @idx: ATA index table to update |
| 516 | * | 511 | * |
| 517 | * Scan the interfaces attached to this device and do any | 512 | * Scan the interfaces attached to this device and do any |
| 518 | * necessary per port setup. Attach the devices and ask the | 513 | * necessary per port setup. Attach the devices and ask the |
| @@ -522,26 +517,25 @@ out: | |||
| 522 | * but is also used directly as a helper function by some controllers | 517 | * but is also used directly as a helper function by some controllers |
| 523 | * where the chipset setup is not the default PCI IDE one. | 518 | * where the chipset setup is not the default PCI IDE one. |
| 524 | */ | 519 | */ |
| 525 | 520 | ||
| 526 | void ide_pci_setup_ports(struct pci_dev *dev, ide_pci_device_t *d, int pciirq, ata_index_t *index) | 521 | void ide_pci_setup_ports(struct pci_dev *dev, const struct ide_port_info *d, int pciirq, u8 *idx) |
| 527 | { | 522 | { |
| 528 | int channels = (d->host_flags & IDE_HFLAG_SINGLE) ? 1 : 2, port; | 523 | int channels = (d->host_flags & IDE_HFLAG_SINGLE) ? 1 : 2, port; |
| 529 | int at_least_one_hwif_enabled = 0; | ||
| 530 | ide_hwif_t *hwif, *mate = NULL; | 524 | ide_hwif_t *hwif, *mate = NULL; |
| 531 | u8 tmp; | 525 | u8 tmp; |
| 532 | 526 | ||
| 533 | index->all = 0xf0f0; | ||
| 534 | |||
| 535 | /* | 527 | /* |
| 536 | * Set up the IDE ports | 528 | * Set up the IDE ports |
| 537 | */ | 529 | */ |
| 538 | 530 | ||
| 539 | for (port = 0; port < channels; ++port) { | 531 | for (port = 0; port < channels; ++port) { |
| 540 | ide_pci_enablebit_t *e = &(d->enablebits[port]); | 532 | const ide_pci_enablebit_t *e = &(d->enablebits[port]); |
| 541 | 533 | ||
| 542 | if (e->reg && (pci_read_config_byte(dev, e->reg, &tmp) || | 534 | if (e->reg && (pci_read_config_byte(dev, e->reg, &tmp) || |
| 543 | (tmp & e->mask) != e->val)) | 535 | (tmp & e->mask) != e->val)) { |
| 536 | printk(KERN_INFO "%s: IDE port disabled\n", d->name); | ||
| 544 | continue; /* port not enabled */ | 537 | continue; /* port not enabled */ |
| 538 | } | ||
| 545 | 539 | ||
| 546 | if ((hwif = ide_hwif_configure(dev, d, mate, port, pciirq)) == NULL) | 540 | if ((hwif = ide_hwif_configure(dev, d, mate, port, pciirq)) == NULL) |
| 547 | continue; | 541 | continue; |
| @@ -549,11 +543,7 @@ void ide_pci_setup_ports(struct pci_dev *dev, ide_pci_device_t *d, int pciirq, a | |||
| 549 | /* setup proper ancestral information */ | 543 | /* setup proper ancestral information */ |
| 550 | hwif->gendev.parent = &dev->dev; | 544 | hwif->gendev.parent = &dev->dev; |
| 551 | 545 | ||
| 552 | if (hwif->channel) { | 546 | *(idx + port) = hwif->index; |
| 553 | index->b.high = hwif->index; | ||
| 554 | } else { | ||
| 555 | index->b.low = hwif->index; | ||
| 556 | } | ||
| 557 | 547 | ||
| 558 | 548 | ||
| 559 | if (d->init_iops) | 549 | if (d->init_iops) |
| @@ -562,15 +552,28 @@ void ide_pci_setup_ports(struct pci_dev *dev, ide_pci_device_t *d, int pciirq, a | |||
| 562 | if ((d->host_flags & IDE_HFLAG_NO_DMA) == 0) | 552 | if ((d->host_flags & IDE_HFLAG_NO_DMA) == 0) |
| 563 | ide_hwif_setup_dma(dev, d, hwif); | 553 | ide_hwif_setup_dma(dev, d, hwif); |
| 564 | 554 | ||
| 565 | if ((d->host_flags & IDE_HFLAG_LEGACY_IRQS) && hwif->irq == 0) | 555 | if ((!hwif->irq && (d->host_flags & IDE_HFLAG_LEGACY_IRQS)) || |
| 556 | (d->host_flags & IDE_HFLAG_FORCE_LEGACY_IRQS)) | ||
| 566 | hwif->irq = port ? 15 : 14; | 557 | hwif->irq = port ? 15 : 14; |
| 567 | 558 | ||
| 559 | hwif->fixup = d->fixup; | ||
| 560 | |||
| 568 | hwif->host_flags = d->host_flags; | 561 | hwif->host_flags = d->host_flags; |
| 569 | hwif->pio_mask = d->pio_mask; | 562 | hwif->pio_mask = d->pio_mask; |
| 570 | 563 | ||
| 571 | if ((d->host_flags & IDE_HFLAG_SERIALIZE) && hwif->mate) | 564 | if ((d->host_flags & IDE_HFLAG_SERIALIZE) && hwif->mate) |
| 572 | hwif->mate->serialized = hwif->serialized = 1; | 565 | hwif->mate->serialized = hwif->serialized = 1; |
| 573 | 566 | ||
| 567 | if (d->host_flags & IDE_HFLAG_IO_32BIT) { | ||
| 568 | hwif->drives[0].io_32bit = 1; | ||
| 569 | hwif->drives[1].io_32bit = 1; | ||
| 570 | } | ||
| 571 | |||
| 572 | if (d->host_flags & IDE_HFLAG_UNMASK_IRQS) { | ||
| 573 | hwif->drives[0].unmask = 1; | ||
| 574 | hwif->drives[1].unmask = 1; | ||
| 575 | } | ||
| 576 | |||
| 574 | if (hwif->dma_base) { | 577 | if (hwif->dma_base) { |
| 575 | hwif->swdma_mask = d->swdma_mask; | 578 | hwif->swdma_mask = d->swdma_mask; |
| 576 | hwif->mwdma_mask = d->mwdma_mask; | 579 | hwif->mwdma_mask = d->mwdma_mask; |
| @@ -580,6 +583,9 @@ void ide_pci_setup_ports(struct pci_dev *dev, ide_pci_device_t *d, int pciirq, a | |||
| 580 | hwif->drives[0].autotune = 1; | 583 | hwif->drives[0].autotune = 1; |
| 581 | hwif->drives[1].autotune = 1; | 584 | hwif->drives[1].autotune = 1; |
| 582 | 585 | ||
| 586 | if (d->host_flags & IDE_HFLAG_RQSIZE_256) | ||
| 587 | hwif->rqsize = 256; | ||
| 588 | |||
| 583 | if (d->init_hwif) | 589 | if (d->init_hwif) |
| 584 | /* Call chipset-specific routine | 590 | /* Call chipset-specific routine |
| 585 | * for each enabled hwif | 591 | * for each enabled hwif |
| @@ -587,10 +593,7 @@ void ide_pci_setup_ports(struct pci_dev *dev, ide_pci_device_t *d, int pciirq, a | |||
| 587 | d->init_hwif(hwif); | 593 | d->init_hwif(hwif); |
| 588 | 594 | ||
| 589 | mate = hwif; | 595 | mate = hwif; |
| 590 | at_least_one_hwif_enabled = 1; | ||
| 591 | } | 596 | } |
| 592 | if (!at_least_one_hwif_enabled) | ||
| 593 | printk(KERN_INFO "%s: neither IDE port enabled (BIOS)\n", d->name); | ||
| 594 | } | 597 | } |
| 595 | 598 | ||
| 596 | EXPORT_SYMBOL_GPL(ide_pci_setup_ports); | 599 | EXPORT_SYMBOL_GPL(ide_pci_setup_ports); |
| @@ -602,13 +605,13 @@ EXPORT_SYMBOL_GPL(ide_pci_setup_ports); | |||
| 602 | * | 605 | * |
| 603 | * One thing that is not standardized is the location of the | 606 | * One thing that is not standardized is the location of the |
| 604 | * primary/secondary interface "enable/disable" bits. For chipsets that | 607 | * primary/secondary interface "enable/disable" bits. For chipsets that |
| 605 | * we "know" about, this information is in the ide_pci_device_t struct; | 608 | * we "know" about, this information is in the struct ide_port_info; |
| 606 | * for all other chipsets, we just assume both interfaces are enabled. | 609 | * for all other chipsets, we just assume both interfaces are enabled. |
| 607 | */ | 610 | */ |
| 608 | static int do_ide_setup_pci_device(struct pci_dev *dev, ide_pci_device_t *d, | 611 | static int do_ide_setup_pci_device(struct pci_dev *dev, |
| 609 | ata_index_t *index, u8 noisy) | 612 | const struct ide_port_info *d, |
| 613 | u8 *idx, u8 noisy) | ||
| 610 | { | 614 | { |
| 611 | static ata_index_t ata_index = { .b = { .low = 0xff, .high = 0xff } }; | ||
| 612 | int tried_config = 0; | 615 | int tried_config = 0; |
| 613 | int pciirq, ret; | 616 | int pciirq, ret; |
| 614 | 617 | ||
| @@ -658,51 +661,35 @@ static int do_ide_setup_pci_device(struct pci_dev *dev, ide_pci_device_t *d, | |||
| 658 | 661 | ||
| 659 | /* FIXME: silent failure can happen */ | 662 | /* FIXME: silent failure can happen */ |
| 660 | 663 | ||
| 661 | *index = ata_index; | 664 | ide_pci_setup_ports(dev, d, pciirq, idx); |
| 662 | ide_pci_setup_ports(dev, d, pciirq, index); | ||
| 663 | out: | 665 | out: |
| 664 | return ret; | 666 | return ret; |
| 665 | } | 667 | } |
| 666 | 668 | ||
| 667 | int ide_setup_pci_device(struct pci_dev *dev, ide_pci_device_t *d) | 669 | int ide_setup_pci_device(struct pci_dev *dev, const struct ide_port_info *d) |
| 668 | { | 670 | { |
| 669 | ide_hwif_t *hwif = NULL, *mate = NULL; | 671 | u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; |
| 670 | ata_index_t index_list; | ||
| 671 | int ret; | 672 | int ret; |
| 672 | 673 | ||
| 673 | ret = do_ide_setup_pci_device(dev, d, &index_list, 1); | 674 | ret = do_ide_setup_pci_device(dev, d, &idx[0], 1); |
| 674 | if (ret < 0) | ||
| 675 | goto out; | ||
| 676 | 675 | ||
| 677 | if ((index_list.b.low & 0xf0) != 0xf0) | 676 | if (ret >= 0) |
| 678 | hwif = &ide_hwifs[index_list.b.low]; | 677 | ide_device_add(idx); |
| 679 | if ((index_list.b.high & 0xf0) != 0xf0) | ||
| 680 | mate = &ide_hwifs[index_list.b.high]; | ||
| 681 | 678 | ||
| 682 | if (hwif) | ||
| 683 | probe_hwif_init_with_fixup(hwif, d->fixup); | ||
| 684 | if (mate) | ||
| 685 | probe_hwif_init_with_fixup(mate, d->fixup); | ||
| 686 | |||
| 687 | if (hwif) | ||
| 688 | ide_proc_register_port(hwif); | ||
| 689 | if (mate) | ||
| 690 | ide_proc_register_port(mate); | ||
| 691 | out: | ||
| 692 | return ret; | 679 | return ret; |
| 693 | } | 680 | } |
| 694 | 681 | ||
| 695 | EXPORT_SYMBOL_GPL(ide_setup_pci_device); | 682 | EXPORT_SYMBOL_GPL(ide_setup_pci_device); |
| 696 | 683 | ||
| 697 | int ide_setup_pci_devices(struct pci_dev *dev1, struct pci_dev *dev2, | 684 | int ide_setup_pci_devices(struct pci_dev *dev1, struct pci_dev *dev2, |
| 698 | ide_pci_device_t *d) | 685 | const struct ide_port_info *d) |
| 699 | { | 686 | { |
| 700 | struct pci_dev *pdev[] = { dev1, dev2 }; | 687 | struct pci_dev *pdev[] = { dev1, dev2 }; |
| 701 | ata_index_t index_list[2]; | ||
| 702 | int ret, i; | 688 | int ret, i; |
| 689 | u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; | ||
| 703 | 690 | ||
| 704 | for (i = 0; i < 2; i++) { | 691 | for (i = 0; i < 2; i++) { |
| 705 | ret = do_ide_setup_pci_device(pdev[i], d, index_list + i, !i); | 692 | ret = do_ide_setup_pci_device(pdev[i], d, &idx[i*2], !i); |
| 706 | /* | 693 | /* |
| 707 | * FIXME: Mom, mom, they stole me the helper function to undo | 694 | * FIXME: Mom, mom, they stole me the helper function to undo |
| 708 | * do_ide_setup_pci_device() on the first device! | 695 | * do_ide_setup_pci_device() on the first device! |
| @@ -711,25 +698,7 @@ int ide_setup_pci_devices(struct pci_dev *dev1, struct pci_dev *dev2, | |||
| 711 | goto out; | 698 | goto out; |
| 712 | } | 699 | } |
| 713 | 700 | ||
| 714 | for (i = 0; i < 2; i++) { | 701 | ide_device_add(idx); |
| 715 | u8 idx[2] = { index_list[i].b.low, index_list[i].b.high }; | ||
| 716 | int j; | ||
| 717 | |||
| 718 | for (j = 0; j < 2; j++) { | ||
| 719 | if ((idx[j] & 0xf0) != 0xf0) | ||
| 720 | probe_hwif_init(ide_hwifs + idx[j]); | ||
| 721 | } | ||
| 722 | } | ||
| 723 | |||
| 724 | for (i = 0; i < 2; i++) { | ||
| 725 | u8 idx[2] = { index_list[i].b.low, index_list[i].b.high }; | ||
| 726 | int j; | ||
| 727 | |||
| 728 | for (j = 0; j < 2; j++) { | ||
| 729 | if ((idx[j] & 0xf0) != 0xf0) | ||
| 730 | ide_proc_register_port(ide_hwifs + idx[j]); | ||
| 731 | } | ||
| 732 | } | ||
| 733 | out: | 702 | out: |
| 734 | return ret; | 703 | return ret; |
| 735 | } | 704 | } |
| @@ -754,9 +723,6 @@ static LIST_HEAD(ide_pci_drivers); | |||
| 754 | * hands the controllers off to the core PCI code to do the rest of | 723 | * hands the controllers off to the core PCI code to do the rest of |
| 755 | * the work. | 724 | * the work. |
| 756 | * | 725 | * |
| 757 | * The driver_data of the driver table must point to an ide_pci_device_t | ||
| 758 | * describing the interface. | ||
| 759 | * | ||
| 760 | * Returns are the same as for pci_register_driver | 726 | * Returns are the same as for pci_register_driver |
| 761 | */ | 727 | */ |
| 762 | 728 | ||
diff --git a/drivers/input/gameport/gameport.c b/drivers/input/gameport/gameport.c index ec1b6cfefcd3..bfc6061f1554 100644 --- a/drivers/input/gameport/gameport.c +++ b/drivers/input/gameport/gameport.c | |||
| @@ -136,7 +136,8 @@ static int gameport_measure_speed(struct gameport *gameport) | |||
| 136 | } | 136 | } |
| 137 | 137 | ||
| 138 | gameport_close(gameport); | 138 | gameport_close(gameport); |
| 139 | return (cpu_data[raw_smp_processor_id()].loops_per_jiffy * (unsigned long)HZ / (1000 / 50)) / (tx < 1 ? 1 : tx); | 139 | return (cpu_data(raw_smp_processor_id()).loops_per_jiffy * |
| 140 | (unsigned long)HZ / (1000 / 50)) / (tx < 1 ? 1 : tx); | ||
| 140 | 141 | ||
| 141 | #else | 142 | #else |
| 142 | 143 | ||
diff --git a/drivers/macintosh/mediabay.c b/drivers/macintosh/mediabay.c index c803d2bba65d..48d647abea46 100644 --- a/drivers/macintosh/mediabay.c +++ b/drivers/macintosh/mediabay.c | |||
| @@ -563,7 +563,7 @@ static void media_bay_step(int i) | |||
| 563 | ide_init_hwif_ports(&hw, (unsigned long) bay->cd_base, (unsigned long) 0, NULL); | 563 | ide_init_hwif_ports(&hw, (unsigned long) bay->cd_base, (unsigned long) 0, NULL); |
| 564 | hw.irq = bay->cd_irq; | 564 | hw.irq = bay->cd_irq; |
| 565 | hw.chipset = ide_pmac; | 565 | hw.chipset = ide_pmac; |
| 566 | bay->cd_index = ide_register_hw(&hw, 0, NULL); | 566 | bay->cd_index = ide_register_hw(&hw, NULL, 0, NULL); |
| 567 | pmu_resume(); | 567 | pmu_resume(); |
| 568 | } | 568 | } |
| 569 | if (bay->cd_index == -1) { | 569 | if (bay->cd_index == -1) { |
diff --git a/drivers/md/Kconfig b/drivers/md/Kconfig index 34a8c60a254a..9b6fbf044fd8 100644 --- a/drivers/md/Kconfig +++ b/drivers/md/Kconfig | |||
| @@ -267,6 +267,12 @@ config DM_MULTIPATH_RDAC | |||
| 267 | ---help--- | 267 | ---help--- |
| 268 | Multipath support for LSI/Engenio RDAC. | 268 | Multipath support for LSI/Engenio RDAC. |
| 269 | 269 | ||
| 270 | config DM_MULTIPATH_HP | ||
| 271 | tristate "HP MSA multipath support (EXPERIMENTAL)" | ||
| 272 | depends on DM_MULTIPATH && BLK_DEV_DM && EXPERIMENTAL | ||
| 273 | ---help--- | ||
| 274 | Multipath support for HP MSA (Active/Passive) series hardware. | ||
| 275 | |||
| 270 | config DM_DELAY | 276 | config DM_DELAY |
| 271 | tristate "I/O delaying target (EXPERIMENTAL)" | 277 | tristate "I/O delaying target (EXPERIMENTAL)" |
| 272 | depends on BLK_DEV_DM && EXPERIMENTAL | 278 | depends on BLK_DEV_DM && EXPERIMENTAL |
| @@ -276,4 +282,10 @@ config DM_DELAY | |||
| 276 | 282 | ||
| 277 | If unsure, say N. | 283 | If unsure, say N. |
| 278 | 284 | ||
| 285 | config DM_UEVENT | ||
| 286 | bool "DM uevents (EXPERIMENTAL)" | ||
| 287 | depends on BLK_DEV_DM && EXPERIMENTAL | ||
| 288 | ---help--- | ||
| 289 | Generate udev events for DM events. | ||
| 290 | |||
| 279 | endif # MD | 291 | endif # MD |
diff --git a/drivers/md/Makefile b/drivers/md/Makefile index c49366cdc05d..d9aa7edb8780 100644 --- a/drivers/md/Makefile +++ b/drivers/md/Makefile | |||
| @@ -8,6 +8,7 @@ dm-multipath-objs := dm-hw-handler.o dm-path-selector.o dm-mpath.o | |||
| 8 | dm-snapshot-objs := dm-snap.o dm-exception-store.o | 8 | dm-snapshot-objs := dm-snap.o dm-exception-store.o |
| 9 | dm-mirror-objs := dm-log.o dm-raid1.o | 9 | dm-mirror-objs := dm-log.o dm-raid1.o |
| 10 | dm-rdac-objs := dm-mpath-rdac.o | 10 | dm-rdac-objs := dm-mpath-rdac.o |
| 11 | dm-hp-sw-objs := dm-mpath-hp-sw.o | ||
| 11 | md-mod-objs := md.o bitmap.o | 12 | md-mod-objs := md.o bitmap.o |
| 12 | raid456-objs := raid5.o raid6algos.o raid6recov.o raid6tables.o \ | 13 | raid456-objs := raid5.o raid6algos.o raid6recov.o raid6tables.o \ |
| 13 | raid6int1.o raid6int2.o raid6int4.o \ | 14 | raid6int1.o raid6int2.o raid6int4.o \ |
| @@ -35,6 +36,7 @@ obj-$(CONFIG_DM_CRYPT) += dm-crypt.o | |||
| 35 | obj-$(CONFIG_DM_DELAY) += dm-delay.o | 36 | obj-$(CONFIG_DM_DELAY) += dm-delay.o |
| 36 | obj-$(CONFIG_DM_MULTIPATH) += dm-multipath.o dm-round-robin.o | 37 | obj-$(CONFIG_DM_MULTIPATH) += dm-multipath.o dm-round-robin.o |
| 37 | obj-$(CONFIG_DM_MULTIPATH_EMC) += dm-emc.o | 38 | obj-$(CONFIG_DM_MULTIPATH_EMC) += dm-emc.o |
| 39 | obj-$(CONFIG_DM_MULTIPATH_HP) += dm-hp-sw.o | ||
| 38 | obj-$(CONFIG_DM_MULTIPATH_RDAC) += dm-rdac.o | 40 | obj-$(CONFIG_DM_MULTIPATH_RDAC) += dm-rdac.o |
| 39 | obj-$(CONFIG_DM_SNAPSHOT) += dm-snapshot.o | 41 | obj-$(CONFIG_DM_SNAPSHOT) += dm-snapshot.o |
| 40 | obj-$(CONFIG_DM_MIRROR) += dm-mirror.o | 42 | obj-$(CONFIG_DM_MIRROR) += dm-mirror.o |
| @@ -48,6 +50,10 @@ ifeq ($(CONFIG_ALTIVEC),y) | |||
| 48 | altivec_flags := -maltivec -mabi=altivec | 50 | altivec_flags := -maltivec -mabi=altivec |
| 49 | endif | 51 | endif |
| 50 | 52 | ||
| 53 | ifeq ($(CONFIG_DM_UEVENT),y) | ||
| 54 | dm-mod-objs += dm-uevent.o | ||
| 55 | endif | ||
| 56 | |||
| 51 | targets += raid6int1.c | 57 | targets += raid6int1.c |
| 52 | $(obj)/raid6int1.c: UNROLL := 1 | 58 | $(obj)/raid6int1.c: UNROLL := 1 |
| 53 | $(obj)/raid6int1.c: $(src)/raid6int.uc $(src)/unroll.pl FORCE | 59 | $(obj)/raid6int1.c: $(src)/raid6int.uc $(src)/unroll.pl FORCE |
diff --git a/drivers/md/dm-bio-list.h b/drivers/md/dm-bio-list.h index 3f7b827649e3..d4509be0fe67 100644 --- a/drivers/md/dm-bio-list.h +++ b/drivers/md/dm-bio-list.h | |||
| @@ -21,11 +21,6 @@ static inline int bio_list_empty(const struct bio_list *bl) | |||
| 21 | return bl->head == NULL; | 21 | return bl->head == NULL; |
| 22 | } | 22 | } |
| 23 | 23 | ||
| 24 | #define BIO_LIST_INIT { .head = NULL, .tail = NULL } | ||
| 25 | |||
| 26 | #define BIO_LIST(bl) \ | ||
| 27 | struct bio_list bl = BIO_LIST_INIT | ||
| 28 | |||
| 29 | static inline void bio_list_init(struct bio_list *bl) | 24 | static inline void bio_list_init(struct bio_list *bl) |
| 30 | { | 25 | { |
| 31 | bl->head = bl->tail = NULL; | 26 | bl->head = bl->tail = NULL; |
diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c index 4a5849b55197..0eb5416798bd 100644 --- a/drivers/md/dm-crypt.c +++ b/drivers/md/dm-crypt.c | |||
| @@ -36,7 +36,6 @@ struct dm_crypt_io { | |||
| 36 | struct work_struct work; | 36 | struct work_struct work; |
| 37 | atomic_t pending; | 37 | atomic_t pending; |
| 38 | int error; | 38 | int error; |
| 39 | int post_process; | ||
| 40 | }; | 39 | }; |
| 41 | 40 | ||
| 42 | /* | 41 | /* |
| @@ -57,7 +56,7 @@ struct crypt_config; | |||
| 57 | 56 | ||
| 58 | struct crypt_iv_operations { | 57 | struct crypt_iv_operations { |
| 59 | int (*ctr)(struct crypt_config *cc, struct dm_target *ti, | 58 | int (*ctr)(struct crypt_config *cc, struct dm_target *ti, |
| 60 | const char *opts); | 59 | const char *opts); |
| 61 | void (*dtr)(struct crypt_config *cc); | 60 | void (*dtr)(struct crypt_config *cc); |
| 62 | const char *(*status)(struct crypt_config *cc); | 61 | const char *(*status)(struct crypt_config *cc); |
| 63 | int (*generator)(struct crypt_config *cc, u8 *iv, sector_t sector); | 62 | int (*generator)(struct crypt_config *cc, u8 *iv, sector_t sector); |
| @@ -80,6 +79,8 @@ struct crypt_config { | |||
| 80 | mempool_t *page_pool; | 79 | mempool_t *page_pool; |
| 81 | struct bio_set *bs; | 80 | struct bio_set *bs; |
| 82 | 81 | ||
| 82 | struct workqueue_struct *io_queue; | ||
| 83 | struct workqueue_struct *crypt_queue; | ||
| 83 | /* | 84 | /* |
| 84 | * crypto related data | 85 | * crypto related data |
| 85 | */ | 86 | */ |
| @@ -137,7 +138,7 @@ static int crypt_iv_plain_gen(struct crypt_config *cc, u8 *iv, sector_t sector) | |||
| 137 | } | 138 | } |
| 138 | 139 | ||
| 139 | static int crypt_iv_essiv_ctr(struct crypt_config *cc, struct dm_target *ti, | 140 | static int crypt_iv_essiv_ctr(struct crypt_config *cc, struct dm_target *ti, |
| 140 | const char *opts) | 141 | const char *opts) |
| 141 | { | 142 | { |
| 142 | struct crypto_cipher *essiv_tfm; | 143 | struct crypto_cipher *essiv_tfm; |
| 143 | struct crypto_hash *hash_tfm; | 144 | struct crypto_hash *hash_tfm; |
| @@ -175,6 +176,7 @@ static int crypt_iv_essiv_ctr(struct crypt_config *cc, struct dm_target *ti, | |||
| 175 | 176 | ||
| 176 | if (err) { | 177 | if (err) { |
| 177 | ti->error = "Error calculating hash in ESSIV"; | 178 | ti->error = "Error calculating hash in ESSIV"; |
| 179 | kfree(salt); | ||
| 178 | return err; | 180 | return err; |
| 179 | } | 181 | } |
| 180 | 182 | ||
| @@ -188,7 +190,7 @@ static int crypt_iv_essiv_ctr(struct crypt_config *cc, struct dm_target *ti, | |||
| 188 | if (crypto_cipher_blocksize(essiv_tfm) != | 190 | if (crypto_cipher_blocksize(essiv_tfm) != |
| 189 | crypto_blkcipher_ivsize(cc->tfm)) { | 191 | crypto_blkcipher_ivsize(cc->tfm)) { |
| 190 | ti->error = "Block size of ESSIV cipher does " | 192 | ti->error = "Block size of ESSIV cipher does " |
| 191 | "not match IV size of block cipher"; | 193 | "not match IV size of block cipher"; |
| 192 | crypto_free_cipher(essiv_tfm); | 194 | crypto_free_cipher(essiv_tfm); |
| 193 | kfree(salt); | 195 | kfree(salt); |
| 194 | return -EINVAL; | 196 | return -EINVAL; |
| @@ -319,10 +321,10 @@ crypt_convert_scatterlist(struct crypt_config *cc, struct scatterlist *out, | |||
| 319 | return r; | 321 | return r; |
| 320 | } | 322 | } |
| 321 | 323 | ||
| 322 | static void | 324 | static void crypt_convert_init(struct crypt_config *cc, |
| 323 | crypt_convert_init(struct crypt_config *cc, struct convert_context *ctx, | 325 | struct convert_context *ctx, |
| 324 | struct bio *bio_out, struct bio *bio_in, | 326 | struct bio *bio_out, struct bio *bio_in, |
| 325 | sector_t sector, int write) | 327 | sector_t sector, int write) |
| 326 | { | 328 | { |
| 327 | ctx->bio_in = bio_in; | 329 | ctx->bio_in = bio_in; |
| 328 | ctx->bio_out = bio_out; | 330 | ctx->bio_out = bio_out; |
| @@ -338,7 +340,7 @@ crypt_convert_init(struct crypt_config *cc, struct convert_context *ctx, | |||
| 338 | * Encrypt / decrypt data from one bio to another one (can be the same one) | 340 | * Encrypt / decrypt data from one bio to another one (can be the same one) |
| 339 | */ | 341 | */ |
| 340 | static int crypt_convert(struct crypt_config *cc, | 342 | static int crypt_convert(struct crypt_config *cc, |
| 341 | struct convert_context *ctx) | 343 | struct convert_context *ctx) |
| 342 | { | 344 | { |
| 343 | int r = 0; | 345 | int r = 0; |
| 344 | 346 | ||
| @@ -370,7 +372,7 @@ static int crypt_convert(struct crypt_config *cc, | |||
| 370 | } | 372 | } |
| 371 | 373 | ||
| 372 | r = crypt_convert_scatterlist(cc, &sg_out, &sg_in, sg_in.length, | 374 | r = crypt_convert_scatterlist(cc, &sg_out, &sg_in, sg_in.length, |
| 373 | ctx->write, ctx->sector); | 375 | ctx->write, ctx->sector); |
| 374 | if (r < 0) | 376 | if (r < 0) |
| 375 | break; | 377 | break; |
| 376 | 378 | ||
| @@ -380,13 +382,13 @@ static int crypt_convert(struct crypt_config *cc, | |||
| 380 | return r; | 382 | return r; |
| 381 | } | 383 | } |
| 382 | 384 | ||
| 383 | static void dm_crypt_bio_destructor(struct bio *bio) | 385 | static void dm_crypt_bio_destructor(struct bio *bio) |
| 384 | { | 386 | { |
| 385 | struct dm_crypt_io *io = bio->bi_private; | 387 | struct dm_crypt_io *io = bio->bi_private; |
| 386 | struct crypt_config *cc = io->target->private; | 388 | struct crypt_config *cc = io->target->private; |
| 387 | 389 | ||
| 388 | bio_free(bio, cc->bs); | 390 | bio_free(bio, cc->bs); |
| 389 | } | 391 | } |
| 390 | 392 | ||
| 391 | /* | 393 | /* |
| 392 | * Generate a new unfragmented bio with the given size | 394 | * Generate a new unfragmented bio with the given size |
| @@ -458,7 +460,7 @@ static void crypt_free_buffer_pages(struct crypt_config *cc, struct bio *clone) | |||
| 458 | * One of the bios was finished. Check for completion of | 460 | * One of the bios was finished. Check for completion of |
| 459 | * the whole request and correctly clean up the buffer. | 461 | * the whole request and correctly clean up the buffer. |
| 460 | */ | 462 | */ |
| 461 | static void dec_pending(struct dm_crypt_io *io, int error) | 463 | static void crypt_dec_pending(struct dm_crypt_io *io, int error) |
| 462 | { | 464 | { |
| 463 | struct crypt_config *cc = (struct crypt_config *) io->target->private; | 465 | struct crypt_config *cc = (struct crypt_config *) io->target->private; |
| 464 | 466 | ||
| @@ -474,18 +476,36 @@ static void dec_pending(struct dm_crypt_io *io, int error) | |||
| 474 | } | 476 | } |
| 475 | 477 | ||
| 476 | /* | 478 | /* |
| 477 | * kcryptd: | 479 | * kcryptd/kcryptd_io: |
| 478 | * | 480 | * |
| 479 | * Needed because it would be very unwise to do decryption in an | 481 | * Needed because it would be very unwise to do decryption in an |
| 480 | * interrupt context. | 482 | * interrupt context. |
| 483 | * | ||
| 484 | * kcryptd performs the actual encryption or decryption. | ||
| 485 | * | ||
| 486 | * kcryptd_io performs the IO submission. | ||
| 487 | * | ||
| 488 | * They must be separated as otherwise the final stages could be | ||
| 489 | * starved by new requests which can block in the first stages due | ||
| 490 | * to memory allocation. | ||
| 481 | */ | 491 | */ |
| 482 | static struct workqueue_struct *_kcryptd_workqueue; | ||
| 483 | static void kcryptd_do_work(struct work_struct *work); | 492 | static void kcryptd_do_work(struct work_struct *work); |
| 493 | static void kcryptd_do_crypt(struct work_struct *work); | ||
| 484 | 494 | ||
| 485 | static void kcryptd_queue_io(struct dm_crypt_io *io) | 495 | static void kcryptd_queue_io(struct dm_crypt_io *io) |
| 486 | { | 496 | { |
| 497 | struct crypt_config *cc = io->target->private; | ||
| 498 | |||
| 487 | INIT_WORK(&io->work, kcryptd_do_work); | 499 | INIT_WORK(&io->work, kcryptd_do_work); |
| 488 | queue_work(_kcryptd_workqueue, &io->work); | 500 | queue_work(cc->io_queue, &io->work); |
| 501 | } | ||
| 502 | |||
| 503 | static void kcryptd_queue_crypt(struct dm_crypt_io *io) | ||
| 504 | { | ||
| 505 | struct crypt_config *cc = io->target->private; | ||
| 506 | |||
| 507 | INIT_WORK(&io->work, kcryptd_do_crypt); | ||
| 508 | queue_work(cc->crypt_queue, &io->work); | ||
| 489 | } | 509 | } |
| 490 | 510 | ||
| 491 | static void crypt_endio(struct bio *clone, int error) | 511 | static void crypt_endio(struct bio *clone, int error) |
| @@ -508,13 +528,12 @@ static void crypt_endio(struct bio *clone, int error) | |||
| 508 | } | 528 | } |
| 509 | 529 | ||
| 510 | bio_put(clone); | 530 | bio_put(clone); |
| 511 | io->post_process = 1; | 531 | kcryptd_queue_crypt(io); |
| 512 | kcryptd_queue_io(io); | ||
| 513 | return; | 532 | return; |
| 514 | 533 | ||
| 515 | out: | 534 | out: |
| 516 | bio_put(clone); | 535 | bio_put(clone); |
| 517 | dec_pending(io, error); | 536 | crypt_dec_pending(io, error); |
| 518 | } | 537 | } |
| 519 | 538 | ||
| 520 | static void clone_init(struct dm_crypt_io *io, struct bio *clone) | 539 | static void clone_init(struct dm_crypt_io *io, struct bio *clone) |
| @@ -544,7 +563,7 @@ static void process_read(struct dm_crypt_io *io) | |||
| 544 | */ | 563 | */ |
| 545 | clone = bio_alloc_bioset(GFP_NOIO, bio_segments(base_bio), cc->bs); | 564 | clone = bio_alloc_bioset(GFP_NOIO, bio_segments(base_bio), cc->bs); |
| 546 | if (unlikely(!clone)) { | 565 | if (unlikely(!clone)) { |
| 547 | dec_pending(io, -ENOMEM); | 566 | crypt_dec_pending(io, -ENOMEM); |
| 548 | return; | 567 | return; |
| 549 | } | 568 | } |
| 550 | 569 | ||
| @@ -579,7 +598,7 @@ static void process_write(struct dm_crypt_io *io) | |||
| 579 | while (remaining) { | 598 | while (remaining) { |
| 580 | clone = crypt_alloc_buffer(io, remaining); | 599 | clone = crypt_alloc_buffer(io, remaining); |
| 581 | if (unlikely(!clone)) { | 600 | if (unlikely(!clone)) { |
| 582 | dec_pending(io, -ENOMEM); | 601 | crypt_dec_pending(io, -ENOMEM); |
| 583 | return; | 602 | return; |
| 584 | } | 603 | } |
| 585 | 604 | ||
| @@ -589,7 +608,7 @@ static void process_write(struct dm_crypt_io *io) | |||
| 589 | if (unlikely(crypt_convert(cc, &ctx) < 0)) { | 608 | if (unlikely(crypt_convert(cc, &ctx) < 0)) { |
| 590 | crypt_free_buffer_pages(cc, clone); | 609 | crypt_free_buffer_pages(cc, clone); |
| 591 | bio_put(clone); | 610 | bio_put(clone); |
| 592 | dec_pending(io, -EIO); | 611 | crypt_dec_pending(io, -EIO); |
| 593 | return; | 612 | return; |
| 594 | } | 613 | } |
| 595 | 614 | ||
| @@ -624,17 +643,23 @@ static void process_read_endio(struct dm_crypt_io *io) | |||
| 624 | crypt_convert_init(cc, &ctx, io->base_bio, io->base_bio, | 643 | crypt_convert_init(cc, &ctx, io->base_bio, io->base_bio, |
| 625 | io->base_bio->bi_sector - io->target->begin, 0); | 644 | io->base_bio->bi_sector - io->target->begin, 0); |
| 626 | 645 | ||
| 627 | dec_pending(io, crypt_convert(cc, &ctx)); | 646 | crypt_dec_pending(io, crypt_convert(cc, &ctx)); |
| 628 | } | 647 | } |
| 629 | 648 | ||
| 630 | static void kcryptd_do_work(struct work_struct *work) | 649 | static void kcryptd_do_work(struct work_struct *work) |
| 631 | { | 650 | { |
| 632 | struct dm_crypt_io *io = container_of(work, struct dm_crypt_io, work); | 651 | struct dm_crypt_io *io = container_of(work, struct dm_crypt_io, work); |
| 633 | 652 | ||
| 634 | if (io->post_process) | 653 | if (bio_data_dir(io->base_bio) == READ) |
| 635 | process_read_endio(io); | ||
| 636 | else if (bio_data_dir(io->base_bio) == READ) | ||
| 637 | process_read(io); | 654 | process_read(io); |
| 655 | } | ||
| 656 | |||
| 657 | static void kcryptd_do_crypt(struct work_struct *work) | ||
| 658 | { | ||
| 659 | struct dm_crypt_io *io = container_of(work, struct dm_crypt_io, work); | ||
| 660 | |||
| 661 | if (bio_data_dir(io->base_bio) == READ) | ||
| 662 | process_read_endio(io); | ||
| 638 | else | 663 | else |
| 639 | process_write(io); | 664 | process_write(io); |
| 640 | } | 665 | } |
| @@ -690,7 +715,7 @@ static int crypt_set_key(struct crypt_config *cc, char *key) | |||
| 690 | cc->key_size = key_size; /* initial settings */ | 715 | cc->key_size = key_size; /* initial settings */ |
| 691 | 716 | ||
| 692 | if ((!key_size && strcmp(key, "-")) || | 717 | if ((!key_size && strcmp(key, "-")) || |
| 693 | (key_size && crypt_decode_key(cc->key, key, key_size) < 0)) | 718 | (key_size && crypt_decode_key(cc->key, key, key_size) < 0)) |
| 694 | return -EINVAL; | 719 | return -EINVAL; |
| 695 | 720 | ||
| 696 | set_bit(DM_CRYPT_KEY_VALID, &cc->flags); | 721 | set_bit(DM_CRYPT_KEY_VALID, &cc->flags); |
| @@ -746,7 +771,7 @@ static int crypt_ctr(struct dm_target *ti, unsigned int argc, char **argv) | |||
| 746 | 771 | ||
| 747 | if (crypt_set_key(cc, argv[1])) { | 772 | if (crypt_set_key(cc, argv[1])) { |
| 748 | ti->error = "Error decoding key"; | 773 | ti->error = "Error decoding key"; |
| 749 | goto bad1; | 774 | goto bad_cipher; |
| 750 | } | 775 | } |
| 751 | 776 | ||
| 752 | /* Compatiblity mode for old dm-crypt cipher strings */ | 777 | /* Compatiblity mode for old dm-crypt cipher strings */ |
| @@ -757,19 +782,19 @@ static int crypt_ctr(struct dm_target *ti, unsigned int argc, char **argv) | |||
| 757 | 782 | ||
| 758 | if (strcmp(chainmode, "ecb") && !ivmode) { | 783 | if (strcmp(chainmode, "ecb") && !ivmode) { |
| 759 | ti->error = "This chaining mode requires an IV mechanism"; | 784 | ti->error = "This chaining mode requires an IV mechanism"; |
| 760 | goto bad1; | 785 | goto bad_cipher; |
| 761 | } | 786 | } |
| 762 | 787 | ||
| 763 | if (snprintf(cc->cipher, CRYPTO_MAX_ALG_NAME, "%s(%s)", chainmode, | 788 | if (snprintf(cc->cipher, CRYPTO_MAX_ALG_NAME, "%s(%s)", |
| 764 | cipher) >= CRYPTO_MAX_ALG_NAME) { | 789 | chainmode, cipher) >= CRYPTO_MAX_ALG_NAME) { |
| 765 | ti->error = "Chain mode + cipher name is too long"; | 790 | ti->error = "Chain mode + cipher name is too long"; |
| 766 | goto bad1; | 791 | goto bad_cipher; |
| 767 | } | 792 | } |
| 768 | 793 | ||
| 769 | tfm = crypto_alloc_blkcipher(cc->cipher, 0, CRYPTO_ALG_ASYNC); | 794 | tfm = crypto_alloc_blkcipher(cc->cipher, 0, CRYPTO_ALG_ASYNC); |
| 770 | if (IS_ERR(tfm)) { | 795 | if (IS_ERR(tfm)) { |
| 771 | ti->error = "Error allocating crypto tfm"; | 796 | ti->error = "Error allocating crypto tfm"; |
| 772 | goto bad1; | 797 | goto bad_cipher; |
| 773 | } | 798 | } |
| 774 | 799 | ||
| 775 | strcpy(cc->cipher, cipher); | 800 | strcpy(cc->cipher, cipher); |
| @@ -793,18 +818,18 @@ static int crypt_ctr(struct dm_target *ti, unsigned int argc, char **argv) | |||
| 793 | cc->iv_gen_ops = &crypt_iv_null_ops; | 818 | cc->iv_gen_ops = &crypt_iv_null_ops; |
| 794 | else { | 819 | else { |
| 795 | ti->error = "Invalid IV mode"; | 820 | ti->error = "Invalid IV mode"; |
| 796 | goto bad2; | 821 | goto bad_ivmode; |
| 797 | } | 822 | } |
| 798 | 823 | ||
| 799 | if (cc->iv_gen_ops && cc->iv_gen_ops->ctr && | 824 | if (cc->iv_gen_ops && cc->iv_gen_ops->ctr && |
| 800 | cc->iv_gen_ops->ctr(cc, ti, ivopts) < 0) | 825 | cc->iv_gen_ops->ctr(cc, ti, ivopts) < 0) |
| 801 | goto bad2; | 826 | goto bad_ivmode; |
| 802 | 827 | ||
| 803 | cc->iv_size = crypto_blkcipher_ivsize(tfm); | 828 | cc->iv_size = crypto_blkcipher_ivsize(tfm); |
| 804 | if (cc->iv_size) | 829 | if (cc->iv_size) |
| 805 | /* at least a 64 bit sector number should fit in our buffer */ | 830 | /* at least a 64 bit sector number should fit in our buffer */ |
| 806 | cc->iv_size = max(cc->iv_size, | 831 | cc->iv_size = max(cc->iv_size, |
| 807 | (unsigned int)(sizeof(u64) / sizeof(u8))); | 832 | (unsigned int)(sizeof(u64) / sizeof(u8))); |
| 808 | else { | 833 | else { |
| 809 | if (cc->iv_gen_ops) { | 834 | if (cc->iv_gen_ops) { |
| 810 | DMWARN("Selected cipher does not support IVs"); | 835 | DMWARN("Selected cipher does not support IVs"); |
| @@ -817,13 +842,13 @@ static int crypt_ctr(struct dm_target *ti, unsigned int argc, char **argv) | |||
| 817 | cc->io_pool = mempool_create_slab_pool(MIN_IOS, _crypt_io_pool); | 842 | cc->io_pool = mempool_create_slab_pool(MIN_IOS, _crypt_io_pool); |
| 818 | if (!cc->io_pool) { | 843 | if (!cc->io_pool) { |
| 819 | ti->error = "Cannot allocate crypt io mempool"; | 844 | ti->error = "Cannot allocate crypt io mempool"; |
| 820 | goto bad3; | 845 | goto bad_slab_pool; |
| 821 | } | 846 | } |
| 822 | 847 | ||
| 823 | cc->page_pool = mempool_create_page_pool(MIN_POOL_PAGES, 0); | 848 | cc->page_pool = mempool_create_page_pool(MIN_POOL_PAGES, 0); |
| 824 | if (!cc->page_pool) { | 849 | if (!cc->page_pool) { |
| 825 | ti->error = "Cannot allocate page mempool"; | 850 | ti->error = "Cannot allocate page mempool"; |
| 826 | goto bad4; | 851 | goto bad_page_pool; |
| 827 | } | 852 | } |
| 828 | 853 | ||
| 829 | cc->bs = bioset_create(MIN_IOS, MIN_IOS); | 854 | cc->bs = bioset_create(MIN_IOS, MIN_IOS); |
| @@ -834,25 +859,25 @@ static int crypt_ctr(struct dm_target *ti, unsigned int argc, char **argv) | |||
| 834 | 859 | ||
| 835 | if (crypto_blkcipher_setkey(tfm, cc->key, key_size) < 0) { | 860 | if (crypto_blkcipher_setkey(tfm, cc->key, key_size) < 0) { |
| 836 | ti->error = "Error setting key"; | 861 | ti->error = "Error setting key"; |
| 837 | goto bad5; | 862 | goto bad_device; |
| 838 | } | 863 | } |
| 839 | 864 | ||
| 840 | if (sscanf(argv[2], "%llu", &tmpll) != 1) { | 865 | if (sscanf(argv[2], "%llu", &tmpll) != 1) { |
| 841 | ti->error = "Invalid iv_offset sector"; | 866 | ti->error = "Invalid iv_offset sector"; |
| 842 | goto bad5; | 867 | goto bad_device; |
| 843 | } | 868 | } |
| 844 | cc->iv_offset = tmpll; | 869 | cc->iv_offset = tmpll; |
| 845 | 870 | ||
| 846 | if (sscanf(argv[4], "%llu", &tmpll) != 1) { | 871 | if (sscanf(argv[4], "%llu", &tmpll) != 1) { |
| 847 | ti->error = "Invalid device sector"; | 872 | ti->error = "Invalid device sector"; |
| 848 | goto bad5; | 873 | goto bad_device; |
| 849 | } | 874 | } |
| 850 | cc->start = tmpll; | 875 | cc->start = tmpll; |
| 851 | 876 | ||
| 852 | if (dm_get_device(ti, argv[3], cc->start, ti->len, | 877 | if (dm_get_device(ti, argv[3], cc->start, ti->len, |
| 853 | dm_table_get_mode(ti->table), &cc->dev)) { | 878 | dm_table_get_mode(ti->table), &cc->dev)) { |
| 854 | ti->error = "Device lookup failed"; | 879 | ti->error = "Device lookup failed"; |
| 855 | goto bad5; | 880 | goto bad_device; |
| 856 | } | 881 | } |
| 857 | 882 | ||
| 858 | if (ivmode && cc->iv_gen_ops) { | 883 | if (ivmode && cc->iv_gen_ops) { |
| @@ -861,27 +886,45 @@ static int crypt_ctr(struct dm_target *ti, unsigned int argc, char **argv) | |||
| 861 | cc->iv_mode = kmalloc(strlen(ivmode) + 1, GFP_KERNEL); | 886 | cc->iv_mode = kmalloc(strlen(ivmode) + 1, GFP_KERNEL); |
| 862 | if (!cc->iv_mode) { | 887 | if (!cc->iv_mode) { |
| 863 | ti->error = "Error kmallocing iv_mode string"; | 888 | ti->error = "Error kmallocing iv_mode string"; |
| 864 | goto bad5; | 889 | goto bad_ivmode_string; |
| 865 | } | 890 | } |
| 866 | strcpy(cc->iv_mode, ivmode); | 891 | strcpy(cc->iv_mode, ivmode); |
| 867 | } else | 892 | } else |
| 868 | cc->iv_mode = NULL; | 893 | cc->iv_mode = NULL; |
| 869 | 894 | ||
| 895 | cc->io_queue = create_singlethread_workqueue("kcryptd_io"); | ||
| 896 | if (!cc->io_queue) { | ||
| 897 | ti->error = "Couldn't create kcryptd io queue"; | ||
| 898 | goto bad_io_queue; | ||
| 899 | } | ||
| 900 | |||
| 901 | cc->crypt_queue = create_singlethread_workqueue("kcryptd"); | ||
| 902 | if (!cc->crypt_queue) { | ||
| 903 | ti->error = "Couldn't create kcryptd queue"; | ||
| 904 | goto bad_crypt_queue; | ||
| 905 | } | ||
| 906 | |||
| 870 | ti->private = cc; | 907 | ti->private = cc; |
| 871 | return 0; | 908 | return 0; |
| 872 | 909 | ||
| 873 | bad5: | 910 | bad_crypt_queue: |
| 911 | destroy_workqueue(cc->io_queue); | ||
| 912 | bad_io_queue: | ||
| 913 | kfree(cc->iv_mode); | ||
| 914 | bad_ivmode_string: | ||
| 915 | dm_put_device(ti, cc->dev); | ||
| 916 | bad_device: | ||
| 874 | bioset_free(cc->bs); | 917 | bioset_free(cc->bs); |
| 875 | bad_bs: | 918 | bad_bs: |
| 876 | mempool_destroy(cc->page_pool); | 919 | mempool_destroy(cc->page_pool); |
| 877 | bad4: | 920 | bad_page_pool: |
| 878 | mempool_destroy(cc->io_pool); | 921 | mempool_destroy(cc->io_pool); |
| 879 | bad3: | 922 | bad_slab_pool: |
| 880 | if (cc->iv_gen_ops && cc->iv_gen_ops->dtr) | 923 | if (cc->iv_gen_ops && cc->iv_gen_ops->dtr) |
| 881 | cc->iv_gen_ops->dtr(cc); | 924 | cc->iv_gen_ops->dtr(cc); |
| 882 | bad2: | 925 | bad_ivmode: |
| 883 | crypto_free_blkcipher(tfm); | 926 | crypto_free_blkcipher(tfm); |
| 884 | bad1: | 927 | bad_cipher: |
| 885 | /* Must zero key material before freeing */ | 928 | /* Must zero key material before freeing */ |
| 886 | memset(cc, 0, sizeof(*cc) + cc->key_size * sizeof(u8)); | 929 | memset(cc, 0, sizeof(*cc) + cc->key_size * sizeof(u8)); |
| 887 | kfree(cc); | 930 | kfree(cc); |
| @@ -892,7 +935,8 @@ static void crypt_dtr(struct dm_target *ti) | |||
| 892 | { | 935 | { |
| 893 | struct crypt_config *cc = (struct crypt_config *) ti->private; | 936 | struct crypt_config *cc = (struct crypt_config *) ti->private; |
| 894 | 937 | ||
| 895 | flush_workqueue(_kcryptd_workqueue); | 938 | destroy_workqueue(cc->io_queue); |
| 939 | destroy_workqueue(cc->crypt_queue); | ||
| 896 | 940 | ||
| 897 | bioset_free(cc->bs); | 941 | bioset_free(cc->bs); |
| 898 | mempool_destroy(cc->page_pool); | 942 | mempool_destroy(cc->page_pool); |
| @@ -918,9 +962,13 @@ static int crypt_map(struct dm_target *ti, struct bio *bio, | |||
| 918 | io = mempool_alloc(cc->io_pool, GFP_NOIO); | 962 | io = mempool_alloc(cc->io_pool, GFP_NOIO); |
| 919 | io->target = ti; | 963 | io->target = ti; |
| 920 | io->base_bio = bio; | 964 | io->base_bio = bio; |
| 921 | io->error = io->post_process = 0; | 965 | io->error = 0; |
| 922 | atomic_set(&io->pending, 0); | 966 | atomic_set(&io->pending, 0); |
| 923 | kcryptd_queue_io(io); | 967 | |
| 968 | if (bio_data_dir(io->base_bio) == READ) | ||
| 969 | kcryptd_queue_io(io); | ||
| 970 | else | ||
| 971 | kcryptd_queue_crypt(io); | ||
| 924 | 972 | ||
| 925 | return DM_MAPIO_SUBMITTED; | 973 | return DM_MAPIO_SUBMITTED; |
| 926 | } | 974 | } |
| @@ -1037,25 +1085,12 @@ static int __init dm_crypt_init(void) | |||
| 1037 | if (!_crypt_io_pool) | 1085 | if (!_crypt_io_pool) |
| 1038 | return -ENOMEM; | 1086 | return -ENOMEM; |
| 1039 | 1087 | ||
| 1040 | _kcryptd_workqueue = create_workqueue("kcryptd"); | ||
| 1041 | if (!_kcryptd_workqueue) { | ||
| 1042 | r = -ENOMEM; | ||
| 1043 | DMERR("couldn't create kcryptd"); | ||
| 1044 | goto bad1; | ||
| 1045 | } | ||
| 1046 | |||
| 1047 | r = dm_register_target(&crypt_target); | 1088 | r = dm_register_target(&crypt_target); |
| 1048 | if (r < 0) { | 1089 | if (r < 0) { |
| 1049 | DMERR("register failed %d", r); | 1090 | DMERR("register failed %d", r); |
| 1050 | goto bad2; | 1091 | kmem_cache_destroy(_crypt_io_pool); |
| 1051 | } | 1092 | } |
| 1052 | 1093 | ||
| 1053 | return 0; | ||
| 1054 | |||
| 1055 | bad2: | ||
| 1056 | destroy_workqueue(_kcryptd_workqueue); | ||
| 1057 | bad1: | ||
| 1058 | kmem_cache_destroy(_crypt_io_pool); | ||
| 1059 | return r; | 1094 | return r; |
| 1060 | } | 1095 | } |
| 1061 | 1096 | ||
| @@ -1066,7 +1101,6 @@ static void __exit dm_crypt_exit(void) | |||
| 1066 | if (r < 0) | 1101 | if (r < 0) |
| 1067 | DMERR("unregister failed %d", r); | 1102 | DMERR("unregister failed %d", r); |
| 1068 | 1103 | ||
| 1069 | destroy_workqueue(_kcryptd_workqueue); | ||
| 1070 | kmem_cache_destroy(_crypt_io_pool); | 1104 | kmem_cache_destroy(_crypt_io_pool); |
| 1071 | } | 1105 | } |
| 1072 | 1106 | ||
diff --git a/drivers/md/dm-delay.c b/drivers/md/dm-delay.c index 6928c136d3c5..bdd37f881c42 100644 --- a/drivers/md/dm-delay.c +++ b/drivers/md/dm-delay.c | |||
| @@ -83,7 +83,7 @@ static struct bio *flush_delayed_bios(struct delay_c *dc, int flush_all) | |||
| 83 | struct dm_delay_info *delayed, *next; | 83 | struct dm_delay_info *delayed, *next; |
| 84 | unsigned long next_expires = 0; | 84 | unsigned long next_expires = 0; |
| 85 | int start_timer = 0; | 85 | int start_timer = 0; |
| 86 | BIO_LIST(flush_bios); | 86 | struct bio_list flush_bios = { }; |
| 87 | 87 | ||
| 88 | mutex_lock(&delayed_bios_lock); | 88 | mutex_lock(&delayed_bios_lock); |
| 89 | list_for_each_entry_safe(delayed, next, &dc->delayed_bios, list) { | 89 | list_for_each_entry_safe(delayed, next, &dc->delayed_bios, list) { |
| @@ -163,34 +163,32 @@ static int delay_ctr(struct dm_target *ti, unsigned int argc, char **argv) | |||
| 163 | goto bad; | 163 | goto bad; |
| 164 | } | 164 | } |
| 165 | 165 | ||
| 166 | if (argc == 3) { | 166 | dc->dev_write = NULL; |
| 167 | dc->dev_write = NULL; | 167 | if (argc == 3) |
| 168 | goto out; | 168 | goto out; |
| 169 | } | ||
| 170 | 169 | ||
| 171 | if (sscanf(argv[4], "%llu", &tmpll) != 1) { | 170 | if (sscanf(argv[4], "%llu", &tmpll) != 1) { |
| 172 | ti->error = "Invalid write device sector"; | 171 | ti->error = "Invalid write device sector"; |
| 173 | goto bad; | 172 | goto bad_dev_read; |
| 174 | } | 173 | } |
| 175 | dc->start_write = tmpll; | 174 | dc->start_write = tmpll; |
| 176 | 175 | ||
| 177 | if (sscanf(argv[5], "%u", &dc->write_delay) != 1) { | 176 | if (sscanf(argv[5], "%u", &dc->write_delay) != 1) { |
| 178 | ti->error = "Invalid write delay"; | 177 | ti->error = "Invalid write delay"; |
| 179 | goto bad; | 178 | goto bad_dev_read; |
| 180 | } | 179 | } |
| 181 | 180 | ||
| 182 | if (dm_get_device(ti, argv[3], dc->start_write, ti->len, | 181 | if (dm_get_device(ti, argv[3], dc->start_write, ti->len, |
| 183 | dm_table_get_mode(ti->table), &dc->dev_write)) { | 182 | dm_table_get_mode(ti->table), &dc->dev_write)) { |
| 184 | ti->error = "Write device lookup failed"; | 183 | ti->error = "Write device lookup failed"; |
| 185 | dm_put_device(ti, dc->dev_read); | 184 | goto bad_dev_read; |
| 186 | goto bad; | ||
| 187 | } | 185 | } |
| 188 | 186 | ||
| 189 | out: | 187 | out: |
| 190 | dc->delayed_pool = mempool_create_slab_pool(128, delayed_cache); | 188 | dc->delayed_pool = mempool_create_slab_pool(128, delayed_cache); |
| 191 | if (!dc->delayed_pool) { | 189 | if (!dc->delayed_pool) { |
| 192 | DMERR("Couldn't create delayed bio pool."); | 190 | DMERR("Couldn't create delayed bio pool."); |
| 193 | goto bad; | 191 | goto bad_dev_write; |
| 194 | } | 192 | } |
| 195 | 193 | ||
| 196 | setup_timer(&dc->delay_timer, handle_delayed_timer, (unsigned long)dc); | 194 | setup_timer(&dc->delay_timer, handle_delayed_timer, (unsigned long)dc); |
| @@ -203,6 +201,11 @@ out: | |||
| 203 | ti->private = dc; | 201 | ti->private = dc; |
| 204 | return 0; | 202 | return 0; |
| 205 | 203 | ||
| 204 | bad_dev_write: | ||
| 205 | if (dc->dev_write) | ||
| 206 | dm_put_device(ti, dc->dev_write); | ||
| 207 | bad_dev_read: | ||
| 208 | dm_put_device(ti, dc->dev_read); | ||
| 206 | bad: | 209 | bad: |
| 207 | kfree(dc); | 210 | kfree(dc); |
| 208 | return -EINVAL; | 211 | return -EINVAL; |
| @@ -305,7 +308,7 @@ static int delay_status(struct dm_target *ti, status_type_t type, | |||
| 305 | (unsigned long long) dc->start_read, | 308 | (unsigned long long) dc->start_read, |
| 306 | dc->read_delay); | 309 | dc->read_delay); |
| 307 | if (dc->dev_write) | 310 | if (dc->dev_write) |
| 308 | DMEMIT("%s %llu %u", dc->dev_write->name, | 311 | DMEMIT(" %s %llu %u", dc->dev_write->name, |
| 309 | (unsigned long long) dc->start_write, | 312 | (unsigned long long) dc->start_write, |
| 310 | dc->write_delay); | 313 | dc->write_delay); |
| 311 | break; | 314 | break; |
diff --git a/drivers/md/dm-emc.c b/drivers/md/dm-emc.c index 342517261ece..6b91b9ab1d41 100644 --- a/drivers/md/dm-emc.c +++ b/drivers/md/dm-emc.c | |||
| @@ -81,7 +81,7 @@ static struct bio *get_failover_bio(struct dm_path *path, unsigned data_size) | |||
| 81 | } | 81 | } |
| 82 | 82 | ||
| 83 | if (bio_add_page(bio, page, data_size, 0) != data_size) { | 83 | if (bio_add_page(bio, page, data_size, 0) != data_size) { |
| 84 | DMERR("get_failover_bio: alloc_page() failed."); | 84 | DMERR("get_failover_bio: bio_add_page() failed."); |
| 85 | __free_page(page); | 85 | __free_page(page); |
| 86 | bio_put(bio); | 86 | bio_put(bio); |
| 87 | return NULL; | 87 | return NULL; |
| @@ -211,12 +211,10 @@ fail_path: | |||
| 211 | 211 | ||
| 212 | static struct emc_handler *alloc_emc_handler(void) | 212 | static struct emc_handler *alloc_emc_handler(void) |
| 213 | { | 213 | { |
| 214 | struct emc_handler *h = kmalloc(sizeof(*h), GFP_KERNEL); | 214 | struct emc_handler *h = kzalloc(sizeof(*h), GFP_KERNEL); |
| 215 | 215 | ||
| 216 | if (h) { | 216 | if (h) |
| 217 | memset(h, 0, sizeof(*h)); | ||
| 218 | spin_lock_init(&h->lock); | 217 | spin_lock_init(&h->lock); |
| 219 | } | ||
| 220 | 218 | ||
| 221 | return h; | 219 | return h; |
| 222 | } | 220 | } |
diff --git a/drivers/md/dm-hw-handler.c b/drivers/md/dm-hw-handler.c index baafaaba4d4b..2ee84d8aa0bf 100644 --- a/drivers/md/dm-hw-handler.c +++ b/drivers/md/dm-hw-handler.c | |||
| @@ -91,12 +91,10 @@ void dm_put_hw_handler(struct hw_handler_type *hwht) | |||
| 91 | 91 | ||
| 92 | static struct hwh_internal *_alloc_hw_handler(struct hw_handler_type *hwht) | 92 | static struct hwh_internal *_alloc_hw_handler(struct hw_handler_type *hwht) |
| 93 | { | 93 | { |
| 94 | struct hwh_internal *hwhi = kmalloc(sizeof(*hwhi), GFP_KERNEL); | 94 | struct hwh_internal *hwhi = kzalloc(sizeof(*hwhi), GFP_KERNEL); |
| 95 | 95 | ||
| 96 | if (hwhi) { | 96 | if (hwhi) |
| 97 | memset(hwhi, 0, sizeof(*hwhi)); | ||
| 98 | hwhi->hwht = *hwht; | 97 | hwhi->hwht = *hwht; |
| 99 | } | ||
| 100 | 98 | ||
| 101 | return hwhi; | 99 | return hwhi; |
| 102 | } | 100 | } |
diff --git a/drivers/md/dm-hw-handler.h b/drivers/md/dm-hw-handler.h index e0832e6fcf36..46809dcb121a 100644 --- a/drivers/md/dm-hw-handler.h +++ b/drivers/md/dm-hw-handler.h | |||
| @@ -58,5 +58,6 @@ unsigned dm_scsi_err_handler(struct hw_handler *hwh, struct bio *bio); | |||
| 58 | #define MP_FAIL_PATH 1 | 58 | #define MP_FAIL_PATH 1 |
| 59 | #define MP_BYPASS_PG 2 | 59 | #define MP_BYPASS_PG 2 |
| 60 | #define MP_ERROR_IO 4 /* Don't retry this I/O */ | 60 | #define MP_ERROR_IO 4 /* Don't retry this I/O */ |
| 61 | #define MP_RETRY 8 | ||
| 61 | 62 | ||
| 62 | #endif | 63 | #endif |
diff --git a/drivers/md/dm-ioctl.c b/drivers/md/dm-ioctl.c index b441d82c338a..138200bf5e0b 100644 --- a/drivers/md/dm-ioctl.c +++ b/drivers/md/dm-ioctl.c | |||
| @@ -700,7 +700,7 @@ static int dev_rename(struct dm_ioctl *param, size_t param_size) | |||
| 700 | int r; | 700 | int r; |
| 701 | char *new_name = (char *) param + param->data_start; | 701 | char *new_name = (char *) param + param->data_start; |
| 702 | 702 | ||
| 703 | if (new_name < (char *) (param + 1) || | 703 | if (new_name < (char *) param->data || |
| 704 | invalid_str(new_name, (void *) param + param_size)) { | 704 | invalid_str(new_name, (void *) param + param_size)) { |
| 705 | DMWARN("Invalid new logical volume name supplied."); | 705 | DMWARN("Invalid new logical volume name supplied."); |
| 706 | return -EINVAL; | 706 | return -EINVAL; |
| @@ -726,7 +726,7 @@ static int dev_set_geometry(struct dm_ioctl *param, size_t param_size) | |||
| 726 | if (!md) | 726 | if (!md) |
| 727 | return -ENXIO; | 727 | return -ENXIO; |
| 728 | 728 | ||
| 729 | if (geostr < (char *) (param + 1) || | 729 | if (geostr < (char *) param->data || |
| 730 | invalid_str(geostr, (void *) param + param_size)) { | 730 | invalid_str(geostr, (void *) param + param_size)) { |
| 731 | DMWARN("Invalid geometry supplied."); | 731 | DMWARN("Invalid geometry supplied."); |
| 732 | goto out; | 732 | goto out; |
| @@ -1233,7 +1233,7 @@ static int target_message(struct dm_ioctl *param, size_t param_size) | |||
| 1233 | if (r) | 1233 | if (r) |
| 1234 | goto out; | 1234 | goto out; |
| 1235 | 1235 | ||
| 1236 | if (tmsg < (struct dm_target_msg *) (param + 1) || | 1236 | if (tmsg < (struct dm_target_msg *) param->data || |
| 1237 | invalid_str(tmsg->message, (void *) param + param_size)) { | 1237 | invalid_str(tmsg->message, (void *) param + param_size)) { |
| 1238 | DMWARN("Invalid target message parameters."); | 1238 | DMWARN("Invalid target message parameters."); |
| 1239 | r = -EINVAL; | 1239 | r = -EINVAL; |
| @@ -1358,7 +1358,7 @@ static int copy_params(struct dm_ioctl __user *user, struct dm_ioctl **param) | |||
| 1358 | if (tmp.data_size < sizeof(tmp)) | 1358 | if (tmp.data_size < sizeof(tmp)) |
| 1359 | return -EINVAL; | 1359 | return -EINVAL; |
| 1360 | 1360 | ||
| 1361 | dmi = (struct dm_ioctl *) vmalloc(tmp.data_size); | 1361 | dmi = vmalloc(tmp.data_size); |
| 1362 | if (!dmi) | 1362 | if (!dmi) |
| 1363 | return -ENOMEM; | 1363 | return -ENOMEM; |
| 1364 | 1364 | ||
| @@ -1515,3 +1515,35 @@ void dm_interface_exit(void) | |||
| 1515 | 1515 | ||
| 1516 | dm_hash_exit(); | 1516 | dm_hash_exit(); |
| 1517 | } | 1517 | } |
| 1518 | |||
| 1519 | /** | ||
| 1520 | * dm_copy_name_and_uuid - Copy mapped device name & uuid into supplied buffers | ||
| 1521 | * @md: Pointer to mapped_device | ||
| 1522 | * @name: Buffer (size DM_NAME_LEN) for name | ||
| 1523 | * @uuid: Buffer (size DM_UUID_LEN) for uuid or empty string if uuid not defined | ||
| 1524 | */ | ||
| 1525 | int dm_copy_name_and_uuid(struct mapped_device *md, char *name, char *uuid) | ||
| 1526 | { | ||
| 1527 | int r = 0; | ||
| 1528 | struct hash_cell *hc; | ||
| 1529 | |||
| 1530 | if (!md) | ||
| 1531 | return -ENXIO; | ||
| 1532 | |||
| 1533 | dm_get(md); | ||
| 1534 | down_read(&_hash_lock); | ||
| 1535 | hc = dm_get_mdptr(md); | ||
| 1536 | if (!hc || hc->md != md) { | ||
| 1537 | r = -ENXIO; | ||
| 1538 | goto out; | ||
| 1539 | } | ||
| 1540 | |||
| 1541 | strcpy(name, hc->name); | ||
| 1542 | strcpy(uuid, hc->uuid ? : ""); | ||
| 1543 | |||
| 1544 | out: | ||
| 1545 | up_read(&_hash_lock); | ||
| 1546 | dm_put(md); | ||
| 1547 | |||
| 1548 | return r; | ||
| 1549 | } | ||
diff --git a/drivers/md/dm-log.c b/drivers/md/dm-log.c index a66428d860fe..072ee4353eab 100644 --- a/drivers/md/dm-log.c +++ b/drivers/md/dm-log.c | |||
| @@ -696,7 +696,7 @@ static struct dirty_log_type _disk_type = { | |||
| 696 | .module = THIS_MODULE, | 696 | .module = THIS_MODULE, |
| 697 | .ctr = disk_ctr, | 697 | .ctr = disk_ctr, |
| 698 | .dtr = disk_dtr, | 698 | .dtr = disk_dtr, |
| 699 | .suspend = disk_flush, | 699 | .postsuspend = disk_flush, |
| 700 | .resume = disk_resume, | 700 | .resume = disk_resume, |
| 701 | .get_region_size = core_get_region_size, | 701 | .get_region_size = core_get_region_size, |
| 702 | .is_clean = core_is_clean, | 702 | .is_clean = core_is_clean, |
diff --git a/drivers/md/dm-log.h b/drivers/md/dm-log.h index 86a301c8daf1..3fae87eb5963 100644 --- a/drivers/md/dm-log.h +++ b/drivers/md/dm-log.h | |||
| @@ -32,7 +32,8 @@ struct dirty_log_type { | |||
| 32 | * There are times when we don't want the log to touch | 32 | * There are times when we don't want the log to touch |
| 33 | * the disk. | 33 | * the disk. |
| 34 | */ | 34 | */ |
| 35 | int (*suspend)(struct dirty_log *log); | 35 | int (*presuspend)(struct dirty_log *log); |
| 36 | int (*postsuspend)(struct dirty_log *log); | ||
| 36 | int (*resume)(struct dirty_log *log); | 37 | int (*resume)(struct dirty_log *log); |
| 37 | 38 | ||
| 38 | /* | 39 | /* |
diff --git a/drivers/md/dm-mpath-hp-sw.c b/drivers/md/dm-mpath-hp-sw.c new file mode 100644 index 000000000000..204bf42c9449 --- /dev/null +++ b/drivers/md/dm-mpath-hp-sw.c | |||
| @@ -0,0 +1,248 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) 2005 Mike Christie, All rights reserved. | ||
| 3 | * Copyright (C) 2007 Red Hat, Inc. All rights reserved. | ||
| 4 | * Authors: Mike Christie | ||
| 5 | * Dave Wysochanski | ||
| 6 | * | ||
| 7 | * This file is released under the GPL. | ||
| 8 | * | ||
| 9 | * This module implements the specific path activation code for | ||
| 10 | * HP StorageWorks and FSC FibreCat Asymmetric (Active/Passive) | ||
| 11 | * storage arrays. | ||
| 12 | * These storage arrays have controller-based failover, not | ||
| 13 | * LUN-based failover. However, LUN-based failover is the design | ||
| 14 | * of dm-multipath. Thus, this module is written for LUN-based failover. | ||
| 15 | */ | ||
| 16 | #include <linux/blkdev.h> | ||
| 17 | #include <linux/list.h> | ||
| 18 | #include <linux/types.h> | ||
| 19 | #include <scsi/scsi.h> | ||
| 20 | #include <scsi/scsi_cmnd.h> | ||
| 21 | #include <scsi/scsi_dbg.h> | ||
| 22 | |||
| 23 | #include "dm.h" | ||
| 24 | #include "dm-hw-handler.h" | ||
| 25 | |||
| 26 | #define DM_MSG_PREFIX "multipath hp-sw" | ||
| 27 | #define DM_HP_HWH_NAME "hp-sw" | ||
| 28 | #define DM_HP_HWH_VER "1.0.0" | ||
| 29 | |||
| 30 | struct hp_sw_context { | ||
| 31 | unsigned char sense[SCSI_SENSE_BUFFERSIZE]; | ||
| 32 | }; | ||
| 33 | |||
| 34 | /* | ||
| 35 | * hp_sw_error_is_retryable - Is an HP-specific check condition retryable? | ||
| 36 | * @req: path activation request | ||
| 37 | * | ||
| 38 | * Examine error codes of request and determine whether the error is retryable. | ||
| 39 | * Some error codes are already retried by scsi-ml (see | ||
| 40 | * scsi_decide_disposition), but some HP specific codes are not. | ||
| 41 | * The intent of this routine is to supply the logic for the HP specific | ||
| 42 | * check conditions. | ||
| 43 | * | ||
| 44 | * Returns: | ||
| 45 | * 1 - command completed with retryable error | ||
| 46 | * 0 - command completed with non-retryable error | ||
| 47 | * | ||
| 48 | * Possible optimizations | ||
| 49 | * 1. More hardware-specific error codes | ||
| 50 | */ | ||
| 51 | static int hp_sw_error_is_retryable(struct request *req) | ||
| 52 | { | ||
| 53 | /* | ||
| 54 | * NOT_READY is known to be retryable | ||
| 55 | * For now we just dump out the sense data and call it retryable | ||
| 56 | */ | ||
| 57 | if (status_byte(req->errors) == CHECK_CONDITION) | ||
| 58 | __scsi_print_sense(DM_HP_HWH_NAME, req->sense, req->sense_len); | ||
| 59 | |||
| 60 | /* | ||
| 61 | * At this point we don't have complete information about all the error | ||
| 62 | * codes from this hardware, so we are just conservative and retry | ||
| 63 | * when in doubt. | ||
| 64 | */ | ||
| 65 | return 1; | ||
| 66 | } | ||
| 67 | |||
| 68 | /* | ||
| 69 | * hp_sw_end_io - Completion handler for HP path activation. | ||
| 70 | * @req: path activation request | ||
| 71 | * @error: scsi-ml error | ||
| 72 | * | ||
| 73 | * Check sense data, free request structure, and notify dm that | ||
| 74 | * pg initialization has completed. | ||
| 75 | * | ||
| 76 | * Context: scsi-ml softirq | ||
| 77 | * | ||
| 78 | */ | ||
| 79 | static void hp_sw_end_io(struct request *req, int error) | ||
| 80 | { | ||
| 81 | struct dm_path *path = req->end_io_data; | ||
| 82 | unsigned err_flags = 0; | ||
| 83 | |||
| 84 | if (!error) { | ||
| 85 | DMDEBUG("%s path activation command - success", | ||
| 86 | path->dev->name); | ||
| 87 | goto out; | ||
| 88 | } | ||
| 89 | |||
| 90 | if (hp_sw_error_is_retryable(req)) { | ||
| 91 | DMDEBUG("%s path activation command - retry", | ||
| 92 | path->dev->name); | ||
| 93 | err_flags = MP_RETRY; | ||
| 94 | goto out; | ||
| 95 | } | ||
| 96 | |||
| 97 | DMWARN("%s path activation fail - error=0x%x", | ||
| 98 | path->dev->name, error); | ||
| 99 | err_flags = MP_FAIL_PATH; | ||
| 100 | |||
| 101 | out: | ||
| 102 | req->end_io_data = NULL; | ||
| 103 | __blk_put_request(req->q, req); | ||
| 104 | dm_pg_init_complete(path, err_flags); | ||
| 105 | } | ||
| 106 | |||
| 107 | /* | ||
| 108 | * hp_sw_get_request - Allocate an HP specific path activation request | ||
| 109 | * @path: path on which request will be sent (needed for request queue) | ||
| 110 | * | ||
| 111 | * The START command is used for path activation request. | ||
| 112 | * These arrays are controller-based failover, not LUN based. | ||
| 113 | * One START command issued to a single path will fail over all | ||
| 114 | * LUNs for the same controller. | ||
| 115 | * | ||
| 116 | * Possible optimizations | ||
| 117 | * 1. Make timeout configurable | ||
| 118 | * 2. Preallocate request | ||
| 119 | */ | ||
| 120 | static struct request *hp_sw_get_request(struct dm_path *path) | ||
| 121 | { | ||
| 122 | struct request *req; | ||
| 123 | struct block_device *bdev = path->dev->bdev; | ||
| 124 | struct request_queue *q = bdev_get_queue(bdev); | ||
| 125 | struct hp_sw_context *h = path->hwhcontext; | ||
| 126 | |||
| 127 | req = blk_get_request(q, WRITE, GFP_NOIO); | ||
| 128 | if (!req) | ||
| 129 | goto out; | ||
| 130 | |||
| 131 | req->timeout = 60 * HZ; | ||
| 132 | |||
| 133 | req->errors = 0; | ||
| 134 | req->cmd_type = REQ_TYPE_BLOCK_PC; | ||
| 135 | req->cmd_flags |= REQ_FAILFAST | REQ_NOMERGE; | ||
| 136 | req->end_io_data = path; | ||
| 137 | req->sense = h->sense; | ||
| 138 | memset(req->sense, 0, SCSI_SENSE_BUFFERSIZE); | ||
| 139 | |||
| 140 | memset(&req->cmd, 0, BLK_MAX_CDB); | ||
| 141 | req->cmd[0] = START_STOP; | ||
| 142 | req->cmd[4] = 1; | ||
| 143 | req->cmd_len = COMMAND_SIZE(req->cmd[0]); | ||
| 144 | |||
| 145 | out: | ||
| 146 | return req; | ||
| 147 | } | ||
| 148 | |||
| 149 | /* | ||
| 150 | * hp_sw_pg_init - HP path activation implementation. | ||
| 151 | * @hwh: hardware handler specific data | ||
| 152 | * @bypassed: unused; is the path group bypassed? (see dm-mpath.c) | ||
| 153 | * @path: path to send initialization command | ||
| 154 | * | ||
| 155 | * Send an HP-specific path activation command on 'path'. | ||
| 156 | * Do not try to optimize in any way, just send the activation command. | ||
| 157 | * More than one path activation command may be sent to the same controller. | ||
| 158 | * This seems to work fine for basic failover support. | ||
| 159 | * | ||
| 160 | * Possible optimizations | ||
| 161 | * 1. Detect an in-progress activation request and avoid submitting another one | ||
| 162 | * 2. Model the controller and only send a single activation request at a time | ||
| 163 | * 3. Determine the state of a path before sending an activation request | ||
| 164 | * | ||
| 165 | * Context: kmpathd (see process_queued_ios() in dm-mpath.c) | ||
| 166 | */ | ||
| 167 | static void hp_sw_pg_init(struct hw_handler *hwh, unsigned bypassed, | ||
| 168 | struct dm_path *path) | ||
| 169 | { | ||
| 170 | struct request *req; | ||
| 171 | struct hp_sw_context *h; | ||
| 172 | |||
| 173 | path->hwhcontext = hwh->context; | ||
| 174 | h = hwh->context; | ||
| 175 | |||
| 176 | req = hp_sw_get_request(path); | ||
| 177 | if (!req) { | ||
| 178 | DMERR("%s path activation command - allocation fail", | ||
| 179 | path->dev->name); | ||
| 180 | goto retry; | ||
| 181 | } | ||
| 182 | |||
| 183 | DMDEBUG("%s path activation command - sent", path->dev->name); | ||
| 184 | |||
| 185 | blk_execute_rq_nowait(req->q, NULL, req, 1, hp_sw_end_io); | ||
| 186 | return; | ||
| 187 | |||
| 188 | retry: | ||
| 189 | dm_pg_init_complete(path, MP_RETRY); | ||
| 190 | } | ||
| 191 | |||
| 192 | static int hp_sw_create(struct hw_handler *hwh, unsigned argc, char **argv) | ||
| 193 | { | ||
| 194 | struct hp_sw_context *h; | ||
| 195 | |||
| 196 | h = kmalloc(sizeof(*h), GFP_KERNEL); | ||
| 197 | if (!h) | ||
| 198 | return -ENOMEM; | ||
| 199 | |||
| 200 | hwh->context = h; | ||
| 201 | |||
| 202 | return 0; | ||
| 203 | } | ||
| 204 | |||
| 205 | static void hp_sw_destroy(struct hw_handler *hwh) | ||
| 206 | { | ||
| 207 | struct hp_sw_context *h = hwh->context; | ||
| 208 | |||
| 209 | kfree(h); | ||
| 210 | } | ||
| 211 | |||
| 212 | static struct hw_handler_type hp_sw_hwh = { | ||
| 213 | .name = DM_HP_HWH_NAME, | ||
| 214 | .module = THIS_MODULE, | ||
| 215 | .create = hp_sw_create, | ||
| 216 | .destroy = hp_sw_destroy, | ||
| 217 | .pg_init = hp_sw_pg_init, | ||
| 218 | }; | ||
| 219 | |||
| 220 | static int __init hp_sw_init(void) | ||
| 221 | { | ||
| 222 | int r; | ||
| 223 | |||
| 224 | r = dm_register_hw_handler(&hp_sw_hwh); | ||
| 225 | if (r < 0) | ||
| 226 | DMERR("register failed %d", r); | ||
| 227 | else | ||
| 228 | DMINFO("version " DM_HP_HWH_VER " loaded"); | ||
| 229 | |||
| 230 | return r; | ||
| 231 | } | ||
| 232 | |||
| 233 | static void __exit hp_sw_exit(void) | ||
| 234 | { | ||
| 235 | int r; | ||
| 236 | |||
| 237 | r = dm_unregister_hw_handler(&hp_sw_hwh); | ||
| 238 | if (r < 0) | ||
| 239 | DMERR("unregister failed %d", r); | ||
| 240 | } | ||
| 241 | |||
| 242 | module_init(hp_sw_init); | ||
| 243 | module_exit(hp_sw_exit); | ||
| 244 | |||
| 245 | MODULE_DESCRIPTION("DM Multipath HP StorageWorks / FSC FibreCat (A/P) support"); | ||
| 246 | MODULE_AUTHOR("Mike Christie, Dave Wysochanski <dm-devel@redhat.com>"); | ||
| 247 | MODULE_LICENSE("GPL"); | ||
| 248 | MODULE_VERSION(DM_HP_HWH_VER); | ||
diff --git a/drivers/md/dm-mpath-rdac.c b/drivers/md/dm-mpath-rdac.c index 16b161345775..e04eb5c697fb 100644 --- a/drivers/md/dm-mpath-rdac.c +++ b/drivers/md/dm-mpath-rdac.c | |||
| @@ -664,20 +664,21 @@ static struct hw_handler_type rdac_handler = { | |||
| 664 | 664 | ||
| 665 | static int __init rdac_init(void) | 665 | static int __init rdac_init(void) |
| 666 | { | 666 | { |
| 667 | int r = dm_register_hw_handler(&rdac_handler); | 667 | int r; |
| 668 | |||
| 669 | if (r < 0) { | ||
| 670 | DMERR("%s: register failed %d", RDAC_DM_HWH_NAME, r); | ||
| 671 | return r; | ||
| 672 | } | ||
| 673 | 668 | ||
| 674 | rdac_wkqd = create_singlethread_workqueue("rdac_wkqd"); | 669 | rdac_wkqd = create_singlethread_workqueue("rdac_wkqd"); |
| 675 | if (!rdac_wkqd) { | 670 | if (!rdac_wkqd) { |
| 676 | DMERR("Failed to create workqueue rdac_wkqd."); | 671 | DMERR("Failed to create workqueue rdac_wkqd."); |
| 677 | dm_unregister_hw_handler(&rdac_handler); | ||
| 678 | return -ENOMEM; | 672 | return -ENOMEM; |
| 679 | } | 673 | } |
| 680 | 674 | ||
| 675 | r = dm_register_hw_handler(&rdac_handler); | ||
| 676 | if (r < 0) { | ||
| 677 | DMERR("%s: register failed %d", RDAC_DM_HWH_NAME, r); | ||
| 678 | destroy_workqueue(rdac_wkqd); | ||
| 679 | return r; | ||
| 680 | } | ||
| 681 | |||
| 681 | DMINFO("%s: version %s loaded", RDAC_DM_HWH_NAME, RDAC_DM_HWH_VER); | 682 | DMINFO("%s: version %s loaded", RDAC_DM_HWH_NAME, RDAC_DM_HWH_VER); |
| 682 | return 0; | 683 | return 0; |
| 683 | } | 684 | } |
diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c index 31056abca89d..24b2b1e32fae 100644 --- a/drivers/md/dm-mpath.c +++ b/drivers/md/dm-mpath.c | |||
| @@ -10,6 +10,7 @@ | |||
| 10 | #include "dm-hw-handler.h" | 10 | #include "dm-hw-handler.h" |
| 11 | #include "dm-bio-list.h" | 11 | #include "dm-bio-list.h" |
| 12 | #include "dm-bio-record.h" | 12 | #include "dm-bio-record.h" |
| 13 | #include "dm-uevent.h" | ||
| 13 | 14 | ||
| 14 | #include <linux/ctype.h> | 15 | #include <linux/ctype.h> |
| 15 | #include <linux/init.h> | 16 | #include <linux/init.h> |
| @@ -75,6 +76,8 @@ struct multipath { | |||
| 75 | unsigned queue_io; /* Must we queue all I/O? */ | 76 | unsigned queue_io; /* Must we queue all I/O? */ |
| 76 | unsigned queue_if_no_path; /* Queue I/O if last path fails? */ | 77 | unsigned queue_if_no_path; /* Queue I/O if last path fails? */ |
| 77 | unsigned saved_queue_if_no_path;/* Saved state during suspension */ | 78 | unsigned saved_queue_if_no_path;/* Saved state during suspension */ |
| 79 | unsigned pg_init_retries; /* Number of times to retry pg_init */ | ||
| 80 | unsigned pg_init_count; /* Number of times pg_init called */ | ||
| 78 | 81 | ||
| 79 | struct work_struct process_queued_ios; | 82 | struct work_struct process_queued_ios; |
| 80 | struct bio_list queued_ios; | 83 | struct bio_list queued_ios; |
| @@ -225,6 +228,8 @@ static void __switch_pg(struct multipath *m, struct pgpath *pgpath) | |||
| 225 | m->pg_init_required = 0; | 228 | m->pg_init_required = 0; |
| 226 | m->queue_io = 0; | 229 | m->queue_io = 0; |
| 227 | } | 230 | } |
| 231 | |||
| 232 | m->pg_init_count = 0; | ||
| 228 | } | 233 | } |
| 229 | 234 | ||
| 230 | static int __choose_path_in_pg(struct multipath *m, struct priority_group *pg) | 235 | static int __choose_path_in_pg(struct multipath *m, struct priority_group *pg) |
| @@ -424,6 +429,7 @@ static void process_queued_ios(struct work_struct *work) | |||
| 424 | must_queue = 0; | 429 | must_queue = 0; |
| 425 | 430 | ||
| 426 | if (m->pg_init_required && !m->pg_init_in_progress) { | 431 | if (m->pg_init_required && !m->pg_init_in_progress) { |
| 432 | m->pg_init_count++; | ||
| 427 | m->pg_init_required = 0; | 433 | m->pg_init_required = 0; |
| 428 | m->pg_init_in_progress = 1; | 434 | m->pg_init_in_progress = 1; |
| 429 | init_required = 1; | 435 | init_required = 1; |
| @@ -689,9 +695,11 @@ static int parse_features(struct arg_set *as, struct multipath *m) | |||
| 689 | int r; | 695 | int r; |
| 690 | unsigned argc; | 696 | unsigned argc; |
| 691 | struct dm_target *ti = m->ti; | 697 | struct dm_target *ti = m->ti; |
| 698 | const char *param_name; | ||
| 692 | 699 | ||
| 693 | static struct param _params[] = { | 700 | static struct param _params[] = { |
| 694 | {0, 1, "invalid number of feature args"}, | 701 | {0, 3, "invalid number of feature args"}, |
| 702 | {1, 50, "pg_init_retries must be between 1 and 50"}, | ||
| 695 | }; | 703 | }; |
| 696 | 704 | ||
| 697 | r = read_param(_params, shift(as), &argc, &ti->error); | 705 | r = read_param(_params, shift(as), &argc, &ti->error); |
| @@ -701,12 +709,28 @@ static int parse_features(struct arg_set *as, struct multipath *m) | |||
| 701 | if (!argc) | 709 | if (!argc) |
| 702 | return 0; | 710 | return 0; |
| 703 | 711 | ||
| 704 | if (!strnicmp(shift(as), MESG_STR("queue_if_no_path"))) | 712 | do { |
| 705 | return queue_if_no_path(m, 1, 0); | 713 | param_name = shift(as); |
| 706 | else { | 714 | argc--; |
| 715 | |||
| 716 | if (!strnicmp(param_name, MESG_STR("queue_if_no_path"))) { | ||
| 717 | r = queue_if_no_path(m, 1, 0); | ||
| 718 | continue; | ||
| 719 | } | ||
| 720 | |||
| 721 | if (!strnicmp(param_name, MESG_STR("pg_init_retries")) && | ||
| 722 | (argc >= 1)) { | ||
| 723 | r = read_param(_params + 1, shift(as), | ||
| 724 | &m->pg_init_retries, &ti->error); | ||
| 725 | argc--; | ||
| 726 | continue; | ||
| 727 | } | ||
| 728 | |||
| 707 | ti->error = "Unrecognised multipath feature request"; | 729 | ti->error = "Unrecognised multipath feature request"; |
| 708 | return -EINVAL; | 730 | r = -EINVAL; |
| 709 | } | 731 | } while (argc && !r); |
| 732 | |||
| 733 | return r; | ||
| 710 | } | 734 | } |
| 711 | 735 | ||
| 712 | static int multipath_ctr(struct dm_target *ti, unsigned int argc, | 736 | static int multipath_ctr(struct dm_target *ti, unsigned int argc, |
| @@ -834,6 +858,9 @@ static int fail_path(struct pgpath *pgpath) | |||
| 834 | if (pgpath == m->current_pgpath) | 858 | if (pgpath == m->current_pgpath) |
| 835 | m->current_pgpath = NULL; | 859 | m->current_pgpath = NULL; |
| 836 | 860 | ||
| 861 | dm_path_uevent(DM_UEVENT_PATH_FAILED, m->ti, | ||
| 862 | pgpath->path.dev->name, m->nr_valid_paths); | ||
| 863 | |||
| 837 | queue_work(kmultipathd, &m->trigger_event); | 864 | queue_work(kmultipathd, &m->trigger_event); |
| 838 | 865 | ||
| 839 | out: | 866 | out: |
| @@ -873,6 +900,9 @@ static int reinstate_path(struct pgpath *pgpath) | |||
| 873 | if (!m->nr_valid_paths++ && m->queue_size) | 900 | if (!m->nr_valid_paths++ && m->queue_size) |
| 874 | queue_work(kmultipathd, &m->process_queued_ios); | 901 | queue_work(kmultipathd, &m->process_queued_ios); |
| 875 | 902 | ||
| 903 | dm_path_uevent(DM_UEVENT_PATH_REINSTATED, m->ti, | ||
| 904 | pgpath->path.dev->name, m->nr_valid_paths); | ||
| 905 | |||
| 876 | queue_work(kmultipathd, &m->trigger_event); | 906 | queue_work(kmultipathd, &m->trigger_event); |
| 877 | 907 | ||
| 878 | out: | 908 | out: |
| @@ -976,6 +1006,26 @@ static int bypass_pg_num(struct multipath *m, const char *pgstr, int bypassed) | |||
| 976 | } | 1006 | } |
| 977 | 1007 | ||
| 978 | /* | 1008 | /* |
| 1009 | * Should we retry pg_init immediately? | ||
| 1010 | */ | ||
| 1011 | static int pg_init_limit_reached(struct multipath *m, struct pgpath *pgpath) | ||
| 1012 | { | ||
| 1013 | unsigned long flags; | ||
| 1014 | int limit_reached = 0; | ||
| 1015 | |||
| 1016 | spin_lock_irqsave(&m->lock, flags); | ||
| 1017 | |||
| 1018 | if (m->pg_init_count <= m->pg_init_retries) | ||
| 1019 | m->pg_init_required = 1; | ||
| 1020 | else | ||
| 1021 | limit_reached = 1; | ||
| 1022 | |||
| 1023 | spin_unlock_irqrestore(&m->lock, flags); | ||
| 1024 | |||
| 1025 | return limit_reached; | ||
| 1026 | } | ||
| 1027 | |||
| 1028 | /* | ||
| 979 | * pg_init must call this when it has completed its initialisation | 1029 | * pg_init must call this when it has completed its initialisation |
| 980 | */ | 1030 | */ |
| 981 | void dm_pg_init_complete(struct dm_path *path, unsigned err_flags) | 1031 | void dm_pg_init_complete(struct dm_path *path, unsigned err_flags) |
| @@ -985,8 +1035,14 @@ void dm_pg_init_complete(struct dm_path *path, unsigned err_flags) | |||
| 985 | struct multipath *m = pg->m; | 1035 | struct multipath *m = pg->m; |
| 986 | unsigned long flags; | 1036 | unsigned long flags; |
| 987 | 1037 | ||
| 988 | /* We insist on failing the path if the PG is already bypassed. */ | 1038 | /* |
| 989 | if (err_flags && pg->bypassed) | 1039 | * If requested, retry pg_init until maximum number of retries exceeded. |
| 1040 | * If retry not requested and PG already bypassed, always fail the path. | ||
| 1041 | */ | ||
| 1042 | if (err_flags & MP_RETRY) { | ||
| 1043 | if (pg_init_limit_reached(m, pgpath)) | ||
| 1044 | err_flags |= MP_FAIL_PATH; | ||
| 1045 | } else if (err_flags && pg->bypassed) | ||
| 990 | err_flags |= MP_FAIL_PATH; | 1046 | err_flags |= MP_FAIL_PATH; |
| 991 | 1047 | ||
| 992 | if (err_flags & MP_FAIL_PATH) | 1048 | if (err_flags & MP_FAIL_PATH) |
| @@ -996,7 +1052,7 @@ void dm_pg_init_complete(struct dm_path *path, unsigned err_flags) | |||
| 996 | bypass_pg(m, pg, 1); | 1052 | bypass_pg(m, pg, 1); |
| 997 | 1053 | ||
| 998 | spin_lock_irqsave(&m->lock, flags); | 1054 | spin_lock_irqsave(&m->lock, flags); |
| 999 | if (err_flags) { | 1055 | if (err_flags & ~MP_RETRY) { |
| 1000 | m->current_pgpath = NULL; | 1056 | m->current_pgpath = NULL; |
| 1001 | m->current_pg = NULL; | 1057 | m->current_pg = NULL; |
| 1002 | } else if (!m->pg_init_required) | 1058 | } else if (!m->pg_init_required) |
| @@ -1148,11 +1204,15 @@ static int multipath_status(struct dm_target *ti, status_type_t type, | |||
| 1148 | 1204 | ||
| 1149 | /* Features */ | 1205 | /* Features */ |
| 1150 | if (type == STATUSTYPE_INFO) | 1206 | if (type == STATUSTYPE_INFO) |
| 1151 | DMEMIT("1 %u ", m->queue_size); | 1207 | DMEMIT("2 %u %u ", m->queue_size, m->pg_init_count); |
| 1152 | else if (m->queue_if_no_path) | 1208 | else { |
| 1153 | DMEMIT("1 queue_if_no_path "); | 1209 | DMEMIT("%u ", m->queue_if_no_path + |
| 1154 | else | 1210 | (m->pg_init_retries > 0) * 2); |
| 1155 | DMEMIT("0 "); | 1211 | if (m->queue_if_no_path) |
| 1212 | DMEMIT("queue_if_no_path "); | ||
| 1213 | if (m->pg_init_retries) | ||
| 1214 | DMEMIT("pg_init_retries %u ", m->pg_init_retries); | ||
| 1215 | } | ||
| 1156 | 1216 | ||
| 1157 | if (hwh->type && hwh->type->status) | 1217 | if (hwh->type && hwh->type->status) |
| 1158 | sz += hwh->type->status(hwh, type, result + sz, maxlen - sz); | 1218 | sz += hwh->type->status(hwh, type, result + sz, maxlen - sz); |
diff --git a/drivers/md/dm-path-selector.c b/drivers/md/dm-path-selector.c index f10a0c89b3f4..ca1bb636a3e4 100644 --- a/drivers/md/dm-path-selector.c +++ b/drivers/md/dm-path-selector.c | |||
| @@ -94,12 +94,10 @@ out: | |||
| 94 | 94 | ||
| 95 | static struct ps_internal *_alloc_path_selector(struct path_selector_type *pst) | 95 | static struct ps_internal *_alloc_path_selector(struct path_selector_type *pst) |
| 96 | { | 96 | { |
| 97 | struct ps_internal *psi = kmalloc(sizeof(*psi), GFP_KERNEL); | 97 | struct ps_internal *psi = kzalloc(sizeof(*psi), GFP_KERNEL); |
| 98 | 98 | ||
| 99 | if (psi) { | 99 | if (psi) |
| 100 | memset(psi, 0, sizeof(*psi)); | ||
| 101 | psi->pst = *pst; | 100 | psi->pst = *pst; |
| 102 | } | ||
| 103 | 101 | ||
| 104 | return psi; | 102 | return psi; |
| 105 | } | 103 | } |
diff --git a/drivers/md/dm-raid1.c b/drivers/md/dm-raid1.c index d09ff15490a5..31123d4a6b9c 100644 --- a/drivers/md/dm-raid1.c +++ b/drivers/md/dm-raid1.c | |||
| @@ -19,6 +19,7 @@ | |||
| 19 | #include <linux/time.h> | 19 | #include <linux/time.h> |
| 20 | #include <linux/vmalloc.h> | 20 | #include <linux/vmalloc.h> |
| 21 | #include <linux/workqueue.h> | 21 | #include <linux/workqueue.h> |
| 22 | #include <linux/log2.h> | ||
| 22 | 23 | ||
| 23 | #define DM_MSG_PREFIX "raid1" | 24 | #define DM_MSG_PREFIX "raid1" |
| 24 | #define DM_IO_PAGES 64 | 25 | #define DM_IO_PAGES 64 |
| @@ -113,6 +114,7 @@ struct region { | |||
| 113 | * Mirror set structures. | 114 | * Mirror set structures. |
| 114 | *---------------------------------------------------------------*/ | 115 | *---------------------------------------------------------------*/ |
| 115 | struct mirror { | 116 | struct mirror { |
| 117 | struct mirror_set *ms; | ||
| 116 | atomic_t error_count; | 118 | atomic_t error_count; |
| 117 | struct dm_dev *dev; | 119 | struct dm_dev *dev; |
| 118 | sector_t offset; | 120 | sector_t offset; |
| @@ -974,6 +976,7 @@ static struct mirror_set *alloc_context(unsigned int nr_mirrors, | |||
| 974 | 976 | ||
| 975 | if (rh_init(&ms->rh, ms, dl, region_size, ms->nr_regions)) { | 977 | if (rh_init(&ms->rh, ms, dl, region_size, ms->nr_regions)) { |
| 976 | ti->error = "Error creating dirty region hash"; | 978 | ti->error = "Error creating dirty region hash"; |
| 979 | dm_io_client_destroy(ms->io_client); | ||
| 977 | kfree(ms); | 980 | kfree(ms); |
| 978 | return NULL; | 981 | return NULL; |
| 979 | } | 982 | } |
| @@ -994,7 +997,7 @@ static void free_context(struct mirror_set *ms, struct dm_target *ti, | |||
| 994 | 997 | ||
| 995 | static inline int _check_region_size(struct dm_target *ti, uint32_t size) | 998 | static inline int _check_region_size(struct dm_target *ti, uint32_t size) |
| 996 | { | 999 | { |
| 997 | return !(size % (PAGE_SIZE >> 9) || (size & (size - 1)) || | 1000 | return !(size % (PAGE_SIZE >> 9) || !is_power_of_2(size) || |
| 998 | size > ti->len); | 1001 | size > ti->len); |
| 999 | } | 1002 | } |
| 1000 | 1003 | ||
| @@ -1015,6 +1018,7 @@ static int get_mirror(struct mirror_set *ms, struct dm_target *ti, | |||
| 1015 | return -ENXIO; | 1018 | return -ENXIO; |
| 1016 | } | 1019 | } |
| 1017 | 1020 | ||
| 1021 | ms->mirror[mirror].ms = ms; | ||
| 1018 | ms->mirror[mirror].offset = offset; | 1022 | ms->mirror[mirror].offset = offset; |
| 1019 | 1023 | ||
| 1020 | return 0; | 1024 | return 0; |
| @@ -1163,16 +1167,14 @@ static int mirror_ctr(struct dm_target *ti, unsigned int argc, char **argv) | |||
| 1163 | ms->kmirrord_wq = create_singlethread_workqueue("kmirrord"); | 1167 | ms->kmirrord_wq = create_singlethread_workqueue("kmirrord"); |
| 1164 | if (!ms->kmirrord_wq) { | 1168 | if (!ms->kmirrord_wq) { |
| 1165 | DMERR("couldn't start kmirrord"); | 1169 | DMERR("couldn't start kmirrord"); |
| 1166 | free_context(ms, ti, m); | 1170 | r = -ENOMEM; |
| 1167 | return -ENOMEM; | 1171 | goto err_free_context; |
| 1168 | } | 1172 | } |
| 1169 | INIT_WORK(&ms->kmirrord_work, do_mirror); | 1173 | INIT_WORK(&ms->kmirrord_work, do_mirror); |
| 1170 | 1174 | ||
| 1171 | r = parse_features(ms, argc, argv, &args_used); | 1175 | r = parse_features(ms, argc, argv, &args_used); |
| 1172 | if (r) { | 1176 | if (r) |
| 1173 | free_context(ms, ti, ms->nr_mirrors); | 1177 | goto err_destroy_wq; |
| 1174 | return r; | ||
| 1175 | } | ||
| 1176 | 1178 | ||
| 1177 | argv += args_used; | 1179 | argv += args_used; |
| 1178 | argc -= args_used; | 1180 | argc -= args_used; |
| @@ -1188,19 +1190,22 @@ static int mirror_ctr(struct dm_target *ti, unsigned int argc, char **argv) | |||
| 1188 | 1190 | ||
| 1189 | if (argc) { | 1191 | if (argc) { |
| 1190 | ti->error = "Too many mirror arguments"; | 1192 | ti->error = "Too many mirror arguments"; |
| 1191 | free_context(ms, ti, ms->nr_mirrors); | 1193 | r = -EINVAL; |
| 1192 | return -EINVAL; | 1194 | goto err_destroy_wq; |
| 1193 | } | 1195 | } |
| 1194 | 1196 | ||
| 1195 | r = kcopyd_client_create(DM_IO_PAGES, &ms->kcopyd_client); | 1197 | r = kcopyd_client_create(DM_IO_PAGES, &ms->kcopyd_client); |
| 1196 | if (r) { | 1198 | if (r) |
| 1197 | destroy_workqueue(ms->kmirrord_wq); | 1199 | goto err_destroy_wq; |
| 1198 | free_context(ms, ti, ms->nr_mirrors); | ||
| 1199 | return r; | ||
| 1200 | } | ||
| 1201 | 1200 | ||
| 1202 | wake(ms); | 1201 | wake(ms); |
| 1203 | return 0; | 1202 | return 0; |
| 1203 | |||
| 1204 | err_destroy_wq: | ||
| 1205 | destroy_workqueue(ms->kmirrord_wq); | ||
| 1206 | err_free_context: | ||
| 1207 | free_context(ms, ti, ms->nr_mirrors); | ||
| 1208 | return r; | ||
| 1204 | } | 1209 | } |
| 1205 | 1210 | ||
| 1206 | static void mirror_dtr(struct dm_target *ti) | 1211 | static void mirror_dtr(struct dm_target *ti) |
| @@ -1302,7 +1307,7 @@ static void mirror_postsuspend(struct dm_target *ti) | |||
| 1302 | wait_event(_kmirrord_recovery_stopped, | 1307 | wait_event(_kmirrord_recovery_stopped, |
| 1303 | !atomic_read(&ms->rh.recovery_in_flight)); | 1308 | !atomic_read(&ms->rh.recovery_in_flight)); |
| 1304 | 1309 | ||
| 1305 | if (log->type->suspend && log->type->suspend(log)) | 1310 | if (log->type->postsuspend && log->type->postsuspend(log)) |
| 1306 | /* FIXME: need better error handling */ | 1311 | /* FIXME: need better error handling */ |
| 1307 | DMWARN("log suspend failed"); | 1312 | DMWARN("log suspend failed"); |
| 1308 | } | 1313 | } |
diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c index 98a633f3d6b0..cee16fadd9ee 100644 --- a/drivers/md/dm-snap.c +++ b/drivers/md/dm-snap.c | |||
| @@ -17,6 +17,7 @@ | |||
| 17 | #include <linux/module.h> | 17 | #include <linux/module.h> |
| 18 | #include <linux/slab.h> | 18 | #include <linux/slab.h> |
| 19 | #include <linux/vmalloc.h> | 19 | #include <linux/vmalloc.h> |
| 20 | #include <linux/log2.h> | ||
| 20 | 21 | ||
| 21 | #include "dm-snap.h" | 22 | #include "dm-snap.h" |
| 22 | #include "dm-bio-list.h" | 23 | #include "dm-bio-list.h" |
| @@ -415,7 +416,7 @@ static int set_chunk_size(struct dm_snapshot *s, const char *chunk_size_arg, | |||
| 415 | chunk_size = round_up(chunk_size, PAGE_SIZE >> 9); | 416 | chunk_size = round_up(chunk_size, PAGE_SIZE >> 9); |
| 416 | 417 | ||
| 417 | /* Check chunk_size is a power of 2 */ | 418 | /* Check chunk_size is a power of 2 */ |
| 418 | if (chunk_size & (chunk_size - 1)) { | 419 | if (!is_power_of_2(chunk_size)) { |
| 419 | *error = "Chunk size is not a power of 2"; | 420 | *error = "Chunk size is not a power of 2"; |
| 420 | return -EINVAL; | 421 | return -EINVAL; |
| 421 | } | 422 | } |
diff --git a/drivers/md/dm-stripe.c b/drivers/md/dm-stripe.c index 51f5e0760012..969944a8aba2 100644 --- a/drivers/md/dm-stripe.c +++ b/drivers/md/dm-stripe.c | |||
| @@ -11,6 +11,7 @@ | |||
| 11 | #include <linux/blkdev.h> | 11 | #include <linux/blkdev.h> |
| 12 | #include <linux/bio.h> | 12 | #include <linux/bio.h> |
| 13 | #include <linux/slab.h> | 13 | #include <linux/slab.h> |
| 14 | #include <linux/log2.h> | ||
| 14 | 15 | ||
| 15 | #define DM_MSG_PREFIX "striped" | 16 | #define DM_MSG_PREFIX "striped" |
| 16 | 17 | ||
| @@ -99,7 +100,7 @@ static int stripe_ctr(struct dm_target *ti, unsigned int argc, char **argv) | |||
| 99 | /* | 100 | /* |
| 100 | * chunk_size is a power of two | 101 | * chunk_size is a power of two |
| 101 | */ | 102 | */ |
| 102 | if (!chunk_size || (chunk_size & (chunk_size - 1)) || | 103 | if (!is_power_of_2(chunk_size) || |
| 103 | (chunk_size < (PAGE_SIZE >> SECTOR_SHIFT))) { | 104 | (chunk_size < (PAGE_SIZE >> SECTOR_SHIFT))) { |
| 104 | ti->error = "Invalid chunk size"; | 105 | ti->error = "Invalid chunk size"; |
| 105 | return -EINVAL; | 106 | return -EINVAL; |
diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c index fbe477bb2c68..8939e6105088 100644 --- a/drivers/md/dm-table.c +++ b/drivers/md/dm-table.c | |||
| @@ -213,12 +213,11 @@ static int alloc_targets(struct dm_table *t, unsigned int num) | |||
| 213 | int dm_table_create(struct dm_table **result, int mode, | 213 | int dm_table_create(struct dm_table **result, int mode, |
| 214 | unsigned num_targets, struct mapped_device *md) | 214 | unsigned num_targets, struct mapped_device *md) |
| 215 | { | 215 | { |
| 216 | struct dm_table *t = kmalloc(sizeof(*t), GFP_KERNEL); | 216 | struct dm_table *t = kzalloc(sizeof(*t), GFP_KERNEL); |
| 217 | 217 | ||
| 218 | if (!t) | 218 | if (!t) |
| 219 | return -ENOMEM; | 219 | return -ENOMEM; |
| 220 | 220 | ||
| 221 | memset(t, 0, sizeof(*t)); | ||
| 222 | INIT_LIST_HEAD(&t->devices); | 221 | INIT_LIST_HEAD(&t->devices); |
| 223 | atomic_set(&t->holders, 1); | 222 | atomic_set(&t->holders, 1); |
| 224 | 223 | ||
diff --git a/drivers/md/dm-target.c b/drivers/md/dm-target.c index 477a041a41cf..835cf95b857f 100644 --- a/drivers/md/dm-target.c +++ b/drivers/md/dm-target.c | |||
| @@ -88,12 +88,10 @@ void dm_put_target_type(struct target_type *t) | |||
| 88 | 88 | ||
| 89 | static struct tt_internal *alloc_target(struct target_type *t) | 89 | static struct tt_internal *alloc_target(struct target_type *t) |
| 90 | { | 90 | { |
| 91 | struct tt_internal *ti = kmalloc(sizeof(*ti), GFP_KERNEL); | 91 | struct tt_internal *ti = kzalloc(sizeof(*ti), GFP_KERNEL); |
| 92 | 92 | ||
| 93 | if (ti) { | 93 | if (ti) |
| 94 | memset(ti, 0, sizeof(*ti)); | ||
| 95 | ti->tt = *t; | 94 | ti->tt = *t; |
| 96 | } | ||
| 97 | 95 | ||
| 98 | return ti; | 96 | return ti; |
| 99 | } | 97 | } |
diff --git a/drivers/md/dm-uevent.c b/drivers/md/dm-uevent.c new file mode 100644 index 000000000000..50377e5dc2a3 --- /dev/null +++ b/drivers/md/dm-uevent.c | |||
| @@ -0,0 +1,222 @@ | |||
| 1 | /* | ||
| 2 | * Device Mapper Uevent Support (dm-uevent) | ||
| 3 | * | ||
| 4 | * This program is free software; you can redistribute it and/or modify it | ||
| 5 | * under the terms of the GNU General Public License as published by the | ||
| 6 | * Free Software Foundation; either version 2 of the License, or (at your | ||
| 7 | * option) any later version. | ||
| 8 | * | ||
| 9 | * This program is distributed in the hope that it will be useful, but | ||
| 10 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 12 | * General Public License for more details. | ||
| 13 | * | ||
| 14 | * You should have received a copy of the GNU General Public License along | ||
| 15 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
| 16 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
| 17 | * | ||
| 18 | * Copyright IBM Corporation, 2007 | ||
| 19 | * Author: Mike Anderson <andmike@linux.vnet.ibm.com> | ||
| 20 | */ | ||
| 21 | #include <linux/list.h> | ||
| 22 | #include <linux/slab.h> | ||
| 23 | #include <linux/kobject.h> | ||
| 24 | #include <linux/dm-ioctl.h> | ||
| 25 | |||
| 26 | #include "dm.h" | ||
| 27 | #include "dm-uevent.h" | ||
| 28 | |||
| 29 | #define DM_MSG_PREFIX "uevent" | ||
| 30 | |||
| 31 | static const struct { | ||
| 32 | enum dm_uevent_type type; | ||
| 33 | enum kobject_action action; | ||
| 34 | char *name; | ||
| 35 | } _dm_uevent_type_names[] = { | ||
| 36 | {DM_UEVENT_PATH_FAILED, KOBJ_CHANGE, "PATH_FAILED"}, | ||
| 37 | {DM_UEVENT_PATH_REINSTATED, KOBJ_CHANGE, "PATH_REINSTATED"}, | ||
| 38 | }; | ||
| 39 | |||
| 40 | static struct kmem_cache *_dm_event_cache; | ||
| 41 | |||
| 42 | struct dm_uevent { | ||
| 43 | struct mapped_device *md; | ||
| 44 | enum kobject_action action; | ||
| 45 | struct kobj_uevent_env ku_env; | ||
| 46 | struct list_head elist; | ||
| 47 | char name[DM_NAME_LEN]; | ||
| 48 | char uuid[DM_UUID_LEN]; | ||
| 49 | }; | ||
| 50 | |||
| 51 | static void dm_uevent_free(struct dm_uevent *event) | ||
| 52 | { | ||
| 53 | kmem_cache_free(_dm_event_cache, event); | ||
| 54 | } | ||
| 55 | |||
| 56 | static struct dm_uevent *dm_uevent_alloc(struct mapped_device *md) | ||
| 57 | { | ||
| 58 | struct dm_uevent *event; | ||
| 59 | |||
| 60 | event = kmem_cache_zalloc(_dm_event_cache, GFP_ATOMIC); | ||
| 61 | if (!event) | ||
| 62 | return NULL; | ||
| 63 | |||
| 64 | INIT_LIST_HEAD(&event->elist); | ||
| 65 | event->md = md; | ||
| 66 | |||
| 67 | return event; | ||
| 68 | } | ||
| 69 | |||
| 70 | static struct dm_uevent *dm_build_path_uevent(struct mapped_device *md, | ||
| 71 | struct dm_target *ti, | ||
| 72 | enum kobject_action action, | ||
| 73 | const char *dm_action, | ||
| 74 | const char *path, | ||
| 75 | unsigned nr_valid_paths) | ||
| 76 | { | ||
| 77 | struct dm_uevent *event; | ||
| 78 | |||
| 79 | event = dm_uevent_alloc(md); | ||
| 80 | if (!event) { | ||
| 81 | DMERR("%s: dm_uevent_alloc() failed", __FUNCTION__); | ||
| 82 | goto err_nomem; | ||
| 83 | } | ||
| 84 | |||
| 85 | event->action = action; | ||
| 86 | |||
| 87 | if (add_uevent_var(&event->ku_env, "DM_TARGET=%s", ti->type->name)) { | ||
| 88 | DMERR("%s: add_uevent_var() for DM_TARGET failed", | ||
| 89 | __FUNCTION__); | ||
| 90 | goto err_add; | ||
| 91 | } | ||
| 92 | |||
| 93 | if (add_uevent_var(&event->ku_env, "DM_ACTION=%s", dm_action)) { | ||
| 94 | DMERR("%s: add_uevent_var() for DM_ACTION failed", | ||
| 95 | __FUNCTION__); | ||
| 96 | goto err_add; | ||
| 97 | } | ||
| 98 | |||
| 99 | if (add_uevent_var(&event->ku_env, "DM_SEQNUM=%u", | ||
| 100 | dm_next_uevent_seq(md))) { | ||
| 101 | DMERR("%s: add_uevent_var() for DM_SEQNUM failed", | ||
| 102 | __FUNCTION__); | ||
| 103 | goto err_add; | ||
| 104 | } | ||
| 105 | |||
| 106 | if (add_uevent_var(&event->ku_env, "DM_PATH=%s", path)) { | ||
| 107 | DMERR("%s: add_uevent_var() for DM_PATH failed", __FUNCTION__); | ||
| 108 | goto err_add; | ||
| 109 | } | ||
| 110 | |||
| 111 | if (add_uevent_var(&event->ku_env, "DM_NR_VALID_PATHS=%d", | ||
| 112 | nr_valid_paths)) { | ||
| 113 | DMERR("%s: add_uevent_var() for DM_NR_VALID_PATHS failed", | ||
| 114 | __FUNCTION__); | ||
| 115 | goto err_add; | ||
| 116 | } | ||
| 117 | |||
| 118 | return event; | ||
| 119 | |||
| 120 | err_add: | ||
| 121 | dm_uevent_free(event); | ||
| 122 | err_nomem: | ||
| 123 | return ERR_PTR(-ENOMEM); | ||
| 124 | } | ||
| 125 | |||
| 126 | /** | ||
| 127 | * dm_send_uevents - send uevents for given list | ||
| 128 | * | ||
| 129 | * @events: list of events to send | ||
| 130 | * @kobj: kobject generating event | ||
| 131 | * | ||
| 132 | */ | ||
| 133 | void dm_send_uevents(struct list_head *events, struct kobject *kobj) | ||
| 134 | { | ||
| 135 | int r; | ||
| 136 | struct dm_uevent *event, *next; | ||
| 137 | |||
| 138 | list_for_each_entry_safe(event, next, events, elist) { | ||
| 139 | list_del_init(&event->elist); | ||
| 140 | |||
| 141 | /* | ||
| 142 | * Need to call dm_copy_name_and_uuid from here for now. | ||
| 143 | * Context of previous var adds and locking used for | ||
| 144 | * hash_cell not compatable. | ||
| 145 | */ | ||
| 146 | if (dm_copy_name_and_uuid(event->md, event->name, | ||
| 147 | event->uuid)) { | ||
| 148 | DMERR("%s: dm_copy_name_and_uuid() failed", | ||
| 149 | __FUNCTION__); | ||
| 150 | goto uevent_free; | ||
| 151 | } | ||
| 152 | |||
| 153 | if (add_uevent_var(&event->ku_env, "DM_NAME=%s", event->name)) { | ||
| 154 | DMERR("%s: add_uevent_var() for DM_NAME failed", | ||
| 155 | __FUNCTION__); | ||
| 156 | goto uevent_free; | ||
| 157 | } | ||
| 158 | |||
| 159 | if (add_uevent_var(&event->ku_env, "DM_UUID=%s", event->uuid)) { | ||
| 160 | DMERR("%s: add_uevent_var() for DM_UUID failed", | ||
| 161 | __FUNCTION__); | ||
| 162 | goto uevent_free; | ||
| 163 | } | ||
| 164 | |||
| 165 | r = kobject_uevent_env(kobj, event->action, event->ku_env.envp); | ||
| 166 | if (r) | ||
| 167 | DMERR("%s: kobject_uevent_env failed", __FUNCTION__); | ||
| 168 | uevent_free: | ||
| 169 | dm_uevent_free(event); | ||
| 170 | } | ||
| 171 | } | ||
| 172 | EXPORT_SYMBOL_GPL(dm_send_uevents); | ||
| 173 | |||
| 174 | /** | ||
| 175 | * dm_path_uevent - called to create a new path event and queue it | ||
| 176 | * | ||
| 177 | * @event_type: path event type enum | ||
| 178 | * @ti: pointer to a dm_target | ||
| 179 | * @path: string containing pathname | ||
| 180 | * @nr_valid_paths: number of valid paths remaining | ||
| 181 | * | ||
| 182 | */ | ||
| 183 | void dm_path_uevent(enum dm_uevent_type event_type, struct dm_target *ti, | ||
| 184 | const char *path, unsigned nr_valid_paths) | ||
| 185 | { | ||
| 186 | struct mapped_device *md = dm_table_get_md(ti->table); | ||
| 187 | struct dm_uevent *event; | ||
| 188 | |||
| 189 | if (event_type >= ARRAY_SIZE(_dm_uevent_type_names)) { | ||
| 190 | DMERR("%s: Invalid event_type %d", __FUNCTION__, event_type); | ||
| 191 | goto out; | ||
| 192 | } | ||
| 193 | |||
| 194 | event = dm_build_path_uevent(md, ti, | ||
| 195 | _dm_uevent_type_names[event_type].action, | ||
| 196 | _dm_uevent_type_names[event_type].name, | ||
| 197 | path, nr_valid_paths); | ||
| 198 | if (IS_ERR(event)) | ||
| 199 | goto out; | ||
| 200 | |||
| 201 | dm_uevent_add(md, &event->elist); | ||
| 202 | |||
| 203 | out: | ||
| 204 | dm_put(md); | ||
| 205 | } | ||
| 206 | EXPORT_SYMBOL_GPL(dm_path_uevent); | ||
| 207 | |||
| 208 | int dm_uevent_init(void) | ||
| 209 | { | ||
| 210 | _dm_event_cache = KMEM_CACHE(dm_uevent, 0); | ||
| 211 | if (!_dm_event_cache) | ||
| 212 | return -ENOMEM; | ||
| 213 | |||
| 214 | DMINFO("version 1.0.3"); | ||
| 215 | |||
| 216 | return 0; | ||
| 217 | } | ||
| 218 | |||
| 219 | void dm_uevent_exit(void) | ||
| 220 | { | ||
| 221 | kmem_cache_destroy(_dm_event_cache); | ||
| 222 | } | ||
diff --git a/drivers/md/dm-uevent.h b/drivers/md/dm-uevent.h new file mode 100644 index 000000000000..2eccc8bd671a --- /dev/null +++ b/drivers/md/dm-uevent.h | |||
| @@ -0,0 +1,59 @@ | |||
| 1 | /* | ||
| 2 | * Device Mapper Uevent Support | ||
| 3 | * | ||
| 4 | * This program is free software; you can redistribute it and/or modify it | ||
| 5 | * under the terms of the GNU General Public License as published by the | ||
| 6 | * Free Software Foundation; either version 2 of the License, or (at your | ||
| 7 | * option) any later version. | ||
| 8 | * | ||
| 9 | * This program is distributed in the hope that it will be useful, but | ||
| 10 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 12 | * General Public License for more details. | ||
| 13 | * | ||
| 14 | * You should have received a copy of the GNU General Public License along | ||
| 15 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
| 16 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
| 17 | * | ||
| 18 | * Copyright IBM Corporation, 2007 | ||
| 19 | * Author: Mike Anderson <andmike@linux.vnet.ibm.com> | ||
| 20 | */ | ||
| 21 | #ifndef DM_UEVENT_H | ||
| 22 | #define DM_UEVENT_H | ||
| 23 | |||
| 24 | enum dm_uevent_type { | ||
| 25 | DM_UEVENT_PATH_FAILED, | ||
| 26 | DM_UEVENT_PATH_REINSTATED, | ||
| 27 | }; | ||
| 28 | |||
| 29 | #ifdef CONFIG_DM_UEVENT | ||
| 30 | |||
| 31 | extern int dm_uevent_init(void); | ||
| 32 | extern void dm_uevent_exit(void); | ||
| 33 | extern void dm_send_uevents(struct list_head *events, struct kobject *kobj); | ||
| 34 | extern void dm_path_uevent(enum dm_uevent_type event_type, | ||
| 35 | struct dm_target *ti, const char *path, | ||
| 36 | unsigned nr_valid_paths); | ||
| 37 | |||
| 38 | #else | ||
| 39 | |||
| 40 | static inline int dm_uevent_init(void) | ||
| 41 | { | ||
| 42 | return 0; | ||
| 43 | } | ||
| 44 | static inline void dm_uevent_exit(void) | ||
| 45 | { | ||
| 46 | } | ||
| 47 | static inline void dm_send_uevents(struct list_head *events, | ||
| 48 | struct kobject *kobj) | ||
| 49 | { | ||
| 50 | } | ||
| 51 | static inline void dm_path_uevent(enum dm_uevent_type event_type, | ||
| 52 | struct dm_target *ti, const char *path, | ||
| 53 | unsigned nr_valid_paths) | ||
| 54 | { | ||
| 55 | } | ||
| 56 | |||
| 57 | #endif /* CONFIG_DM_UEVENT */ | ||
| 58 | |||
| 59 | #endif /* DM_UEVENT_H */ | ||
diff --git a/drivers/md/dm.c b/drivers/md/dm.c index d837d37f6209..07cbbb8eb3e0 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c | |||
| @@ -7,6 +7,7 @@ | |||
| 7 | 7 | ||
| 8 | #include "dm.h" | 8 | #include "dm.h" |
| 9 | #include "dm-bio-list.h" | 9 | #include "dm-bio-list.h" |
| 10 | #include "dm-uevent.h" | ||
| 10 | 11 | ||
| 11 | #include <linux/init.h> | 12 | #include <linux/init.h> |
| 12 | #include <linux/module.h> | 13 | #include <linux/module.h> |
| @@ -112,6 +113,9 @@ struct mapped_device { | |||
| 112 | */ | 113 | */ |
| 113 | atomic_t event_nr; | 114 | atomic_t event_nr; |
| 114 | wait_queue_head_t eventq; | 115 | wait_queue_head_t eventq; |
| 116 | atomic_t uevent_seq; | ||
| 117 | struct list_head uevent_list; | ||
| 118 | spinlock_t uevent_lock; /* Protect access to uevent_list */ | ||
| 115 | 119 | ||
| 116 | /* | 120 | /* |
| 117 | * freeze/thaw support require holding onto a super block | 121 | * freeze/thaw support require holding onto a super block |
| @@ -143,11 +147,19 @@ static int __init local_init(void) | |||
| 143 | return -ENOMEM; | 147 | return -ENOMEM; |
| 144 | } | 148 | } |
| 145 | 149 | ||
| 150 | r = dm_uevent_init(); | ||
| 151 | if (r) { | ||
| 152 | kmem_cache_destroy(_tio_cache); | ||
| 153 | kmem_cache_destroy(_io_cache); | ||
| 154 | return r; | ||
| 155 | } | ||
| 156 | |||
| 146 | _major = major; | 157 | _major = major; |
| 147 | r = register_blkdev(_major, _name); | 158 | r = register_blkdev(_major, _name); |
| 148 | if (r < 0) { | 159 | if (r < 0) { |
| 149 | kmem_cache_destroy(_tio_cache); | 160 | kmem_cache_destroy(_tio_cache); |
| 150 | kmem_cache_destroy(_io_cache); | 161 | kmem_cache_destroy(_io_cache); |
| 162 | dm_uevent_exit(); | ||
| 151 | return r; | 163 | return r; |
| 152 | } | 164 | } |
| 153 | 165 | ||
| @@ -162,6 +174,7 @@ static void local_exit(void) | |||
| 162 | kmem_cache_destroy(_tio_cache); | 174 | kmem_cache_destroy(_tio_cache); |
| 163 | kmem_cache_destroy(_io_cache); | 175 | kmem_cache_destroy(_io_cache); |
| 164 | unregister_blkdev(_major, _name); | 176 | unregister_blkdev(_major, _name); |
| 177 | dm_uevent_exit(); | ||
| 165 | 178 | ||
| 166 | _major = 0; | 179 | _major = 0; |
| 167 | 180 | ||
| @@ -751,15 +764,13 @@ static void __clone_and_map(struct clone_info *ci) | |||
| 751 | /* | 764 | /* |
| 752 | * Split the bio into several clones. | 765 | * Split the bio into several clones. |
| 753 | */ | 766 | */ |
| 754 | static void __split_bio(struct mapped_device *md, struct bio *bio) | 767 | static int __split_bio(struct mapped_device *md, struct bio *bio) |
| 755 | { | 768 | { |
| 756 | struct clone_info ci; | 769 | struct clone_info ci; |
| 757 | 770 | ||
| 758 | ci.map = dm_get_table(md); | 771 | ci.map = dm_get_table(md); |
| 759 | if (!ci.map) { | 772 | if (unlikely(!ci.map)) |
| 760 | bio_io_error(bio); | 773 | return -EIO; |
| 761 | return; | ||
| 762 | } | ||
| 763 | 774 | ||
| 764 | ci.md = md; | 775 | ci.md = md; |
| 765 | ci.bio = bio; | 776 | ci.bio = bio; |
| @@ -779,6 +790,8 @@ static void __split_bio(struct mapped_device *md, struct bio *bio) | |||
| 779 | /* drop the extra reference count */ | 790 | /* drop the extra reference count */ |
| 780 | dec_pending(ci.io, 0); | 791 | dec_pending(ci.io, 0); |
| 781 | dm_table_put(ci.map); | 792 | dm_table_put(ci.map); |
| 793 | |||
| 794 | return 0; | ||
| 782 | } | 795 | } |
| 783 | /*----------------------------------------------------------------- | 796 | /*----------------------------------------------------------------- |
| 784 | * CRUD END | 797 | * CRUD END |
| @@ -790,7 +803,7 @@ static void __split_bio(struct mapped_device *md, struct bio *bio) | |||
| 790 | */ | 803 | */ |
| 791 | static int dm_request(struct request_queue *q, struct bio *bio) | 804 | static int dm_request(struct request_queue *q, struct bio *bio) |
| 792 | { | 805 | { |
| 793 | int r; | 806 | int r = -EIO; |
| 794 | int rw = bio_data_dir(bio); | 807 | int rw = bio_data_dir(bio); |
| 795 | struct mapped_device *md = q->queuedata; | 808 | struct mapped_device *md = q->queuedata; |
| 796 | 809 | ||
| @@ -815,18 +828,11 @@ static int dm_request(struct request_queue *q, struct bio *bio) | |||
| 815 | while (test_bit(DMF_BLOCK_IO, &md->flags)) { | 828 | while (test_bit(DMF_BLOCK_IO, &md->flags)) { |
| 816 | up_read(&md->io_lock); | 829 | up_read(&md->io_lock); |
| 817 | 830 | ||
| 818 | if (bio_rw(bio) == READA) { | 831 | if (bio_rw(bio) != READA) |
| 819 | bio_io_error(bio); | 832 | r = queue_io(md, bio); |
| 820 | return 0; | ||
| 821 | } | ||
| 822 | |||
| 823 | r = queue_io(md, bio); | ||
| 824 | if (r < 0) { | ||
| 825 | bio_io_error(bio); | ||
| 826 | return 0; | ||
| 827 | 833 | ||
| 828 | } else if (r == 0) | 834 | if (r <= 0) |
| 829 | return 0; /* deferred successfully */ | 835 | goto out_req; |
| 830 | 836 | ||
| 831 | /* | 837 | /* |
| 832 | * We're in a while loop, because someone could suspend | 838 | * We're in a while loop, because someone could suspend |
| @@ -835,8 +841,13 @@ static int dm_request(struct request_queue *q, struct bio *bio) | |||
| 835 | down_read(&md->io_lock); | 841 | down_read(&md->io_lock); |
| 836 | } | 842 | } |
| 837 | 843 | ||
| 838 | __split_bio(md, bio); | 844 | r = __split_bio(md, bio); |
| 839 | up_read(&md->io_lock); | 845 | up_read(&md->io_lock); |
| 846 | |||
| 847 | out_req: | ||
| 848 | if (r < 0) | ||
| 849 | bio_io_error(bio); | ||
| 850 | |||
| 840 | return 0; | 851 | return 0; |
| 841 | } | 852 | } |
| 842 | 853 | ||
| @@ -977,6 +988,9 @@ static struct mapped_device *alloc_dev(int minor) | |||
| 977 | atomic_set(&md->holders, 1); | 988 | atomic_set(&md->holders, 1); |
| 978 | atomic_set(&md->open_count, 0); | 989 | atomic_set(&md->open_count, 0); |
| 979 | atomic_set(&md->event_nr, 0); | 990 | atomic_set(&md->event_nr, 0); |
| 991 | atomic_set(&md->uevent_seq, 0); | ||
| 992 | INIT_LIST_HEAD(&md->uevent_list); | ||
| 993 | spin_lock_init(&md->uevent_lock); | ||
| 980 | 994 | ||
| 981 | md->queue = blk_alloc_queue(GFP_KERNEL); | 995 | md->queue = blk_alloc_queue(GFP_KERNEL); |
| 982 | if (!md->queue) | 996 | if (!md->queue) |
| @@ -1044,12 +1058,14 @@ static struct mapped_device *alloc_dev(int minor) | |||
| 1044 | return NULL; | 1058 | return NULL; |
| 1045 | } | 1059 | } |
| 1046 | 1060 | ||
| 1061 | static void unlock_fs(struct mapped_device *md); | ||
| 1062 | |||
| 1047 | static void free_dev(struct mapped_device *md) | 1063 | static void free_dev(struct mapped_device *md) |
| 1048 | { | 1064 | { |
| 1049 | int minor = md->disk->first_minor; | 1065 | int minor = md->disk->first_minor; |
| 1050 | 1066 | ||
| 1051 | if (md->suspended_bdev) { | 1067 | if (md->suspended_bdev) { |
| 1052 | thaw_bdev(md->suspended_bdev, NULL); | 1068 | unlock_fs(md); |
| 1053 | bdput(md->suspended_bdev); | 1069 | bdput(md->suspended_bdev); |
| 1054 | } | 1070 | } |
| 1055 | mempool_destroy(md->tio_pool); | 1071 | mempool_destroy(md->tio_pool); |
| @@ -1073,8 +1089,16 @@ static void free_dev(struct mapped_device *md) | |||
| 1073 | */ | 1089 | */ |
| 1074 | static void event_callback(void *context) | 1090 | static void event_callback(void *context) |
| 1075 | { | 1091 | { |
| 1092 | unsigned long flags; | ||
| 1093 | LIST_HEAD(uevents); | ||
| 1076 | struct mapped_device *md = (struct mapped_device *) context; | 1094 | struct mapped_device *md = (struct mapped_device *) context; |
| 1077 | 1095 | ||
| 1096 | spin_lock_irqsave(&md->uevent_lock, flags); | ||
| 1097 | list_splice_init(&md->uevent_list, &uevents); | ||
| 1098 | spin_unlock_irqrestore(&md->uevent_lock, flags); | ||
| 1099 | |||
| 1100 | dm_send_uevents(&uevents, &md->disk->kobj); | ||
| 1101 | |||
| 1078 | atomic_inc(&md->event_nr); | 1102 | atomic_inc(&md->event_nr); |
| 1079 | wake_up(&md->eventq); | 1103 | wake_up(&md->eventq); |
| 1080 | } | 1104 | } |
| @@ -1233,7 +1257,8 @@ static void __flush_deferred_io(struct mapped_device *md, struct bio *c) | |||
| 1233 | while (c) { | 1257 | while (c) { |
| 1234 | n = c->bi_next; | 1258 | n = c->bi_next; |
| 1235 | c->bi_next = NULL; | 1259 | c->bi_next = NULL; |
| 1236 | __split_bio(md, c); | 1260 | if (__split_bio(md, c)) |
| 1261 | bio_io_error(c); | ||
| 1237 | c = n; | 1262 | c = n; |
| 1238 | } | 1263 | } |
| 1239 | } | 1264 | } |
| @@ -1491,6 +1516,11 @@ out: | |||
| 1491 | /*----------------------------------------------------------------- | 1516 | /*----------------------------------------------------------------- |
| 1492 | * Event notification. | 1517 | * Event notification. |
| 1493 | *---------------------------------------------------------------*/ | 1518 | *---------------------------------------------------------------*/ |
| 1519 | uint32_t dm_next_uevent_seq(struct mapped_device *md) | ||
| 1520 | { | ||
| 1521 | return atomic_add_return(1, &md->uevent_seq); | ||
| 1522 | } | ||
| 1523 | |||
| 1494 | uint32_t dm_get_event_nr(struct mapped_device *md) | 1524 | uint32_t dm_get_event_nr(struct mapped_device *md) |
| 1495 | { | 1525 | { |
| 1496 | return atomic_read(&md->event_nr); | 1526 | return atomic_read(&md->event_nr); |
| @@ -1502,6 +1532,15 @@ int dm_wait_event(struct mapped_device *md, int event_nr) | |||
| 1502 | (event_nr != atomic_read(&md->event_nr))); | 1532 | (event_nr != atomic_read(&md->event_nr))); |
| 1503 | } | 1533 | } |
| 1504 | 1534 | ||
| 1535 | void dm_uevent_add(struct mapped_device *md, struct list_head *elist) | ||
| 1536 | { | ||
| 1537 | unsigned long flags; | ||
| 1538 | |||
| 1539 | spin_lock_irqsave(&md->uevent_lock, flags); | ||
| 1540 | list_add(elist, &md->uevent_list); | ||
| 1541 | spin_unlock_irqrestore(&md->uevent_lock, flags); | ||
| 1542 | } | ||
| 1543 | |||
| 1505 | /* | 1544 | /* |
| 1506 | * The gendisk is only valid as long as you have a reference | 1545 | * The gendisk is only valid as long as you have a reference |
| 1507 | * count on 'md'. | 1546 | * count on 'md'. |
diff --git a/drivers/md/kcopyd.c b/drivers/md/kcopyd.c index 7e052378c47e..f3831f31223e 100644 --- a/drivers/md/kcopyd.c +++ b/drivers/md/kcopyd.c | |||
| @@ -198,7 +198,7 @@ struct kcopyd_job { | |||
| 198 | * These fields are only used if the job has been split | 198 | * These fields are only used if the job has been split |
| 199 | * into more manageable parts. | 199 | * into more manageable parts. |
| 200 | */ | 200 | */ |
| 201 | struct semaphore lock; | 201 | struct mutex lock; |
| 202 | atomic_t sub_jobs; | 202 | atomic_t sub_jobs; |
| 203 | sector_t progress; | 203 | sector_t progress; |
| 204 | }; | 204 | }; |
| @@ -456,7 +456,7 @@ static void segment_complete(int read_err, | |||
| 456 | sector_t count = 0; | 456 | sector_t count = 0; |
| 457 | struct kcopyd_job *job = (struct kcopyd_job *) context; | 457 | struct kcopyd_job *job = (struct kcopyd_job *) context; |
| 458 | 458 | ||
| 459 | down(&job->lock); | 459 | mutex_lock(&job->lock); |
| 460 | 460 | ||
| 461 | /* update the error */ | 461 | /* update the error */ |
| 462 | if (read_err) | 462 | if (read_err) |
| @@ -480,7 +480,7 @@ static void segment_complete(int read_err, | |||
| 480 | job->progress += count; | 480 | job->progress += count; |
| 481 | } | 481 | } |
| 482 | } | 482 | } |
| 483 | up(&job->lock); | 483 | mutex_unlock(&job->lock); |
| 484 | 484 | ||
| 485 | if (count) { | 485 | if (count) { |
| 486 | int i; | 486 | int i; |
| @@ -562,7 +562,7 @@ int kcopyd_copy(struct kcopyd_client *kc, struct io_region *from, | |||
| 562 | dispatch_job(job); | 562 | dispatch_job(job); |
| 563 | 563 | ||
| 564 | else { | 564 | else { |
| 565 | init_MUTEX(&job->lock); | 565 | mutex_init(&job->lock); |
| 566 | job->progress = 0; | 566 | job->progress = 0; |
| 567 | split_job(job); | 567 | split_job(job); |
| 568 | } | 568 | } |
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index fd9e8405fd77..ce34b539bf38 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig | |||
| @@ -1293,9 +1293,6 @@ config PCNET32_NAPI | |||
| 1293 | deployed on potentially unfriendly networks (e.g. in a firewall), | 1293 | deployed on potentially unfriendly networks (e.g. in a firewall), |
| 1294 | then say Y here. | 1294 | then say Y here. |
| 1295 | 1295 | ||
| 1296 | See <file:Documentation/networking/NAPI_HOWTO.txt> for more | ||
| 1297 | information. | ||
| 1298 | |||
| 1299 | If in doubt, say N. | 1296 | If in doubt, say N. |
| 1300 | 1297 | ||
| 1301 | config AMD8111_ETH | 1298 | config AMD8111_ETH |
| @@ -1313,7 +1310,7 @@ config AMD8111_ETH | |||
| 1313 | will be called amd8111e. | 1310 | will be called amd8111e. |
| 1314 | 1311 | ||
| 1315 | config AMD8111E_NAPI | 1312 | config AMD8111E_NAPI |
| 1316 | bool "Enable NAPI support" | 1313 | bool "Use RX polling (NAPI)" |
| 1317 | depends on AMD8111_ETH | 1314 | depends on AMD8111_ETH |
| 1318 | help | 1315 | help |
| 1319 | NAPI is a new driver API designed to reduce CPU and interrupt load | 1316 | NAPI is a new driver API designed to reduce CPU and interrupt load |
| @@ -1324,9 +1321,6 @@ config AMD8111E_NAPI | |||
| 1324 | deployed on potentially unfriendly networks (e.g. in a firewall), | 1321 | deployed on potentially unfriendly networks (e.g. in a firewall), |
| 1325 | then say Y here. | 1322 | then say Y here. |
| 1326 | 1323 | ||
| 1327 | See <file:Documentation/networking/NAPI_HOWTO.txt> for more | ||
| 1328 | information. | ||
| 1329 | |||
| 1330 | If in doubt, say N. | 1324 | If in doubt, say N. |
| 1331 | 1325 | ||
| 1332 | config ADAPTEC_STARFIRE | 1326 | config ADAPTEC_STARFIRE |
| @@ -1355,9 +1349,6 @@ config ADAPTEC_STARFIRE_NAPI | |||
| 1355 | deployed on potentially unfriendly networks (e.g. in a firewall), | 1349 | deployed on potentially unfriendly networks (e.g. in a firewall), |
| 1356 | then say Y here. | 1350 | then say Y here. |
| 1357 | 1351 | ||
| 1358 | See <file:Documentation/networking/NAPI_HOWTO.txt> for more | ||
| 1359 | information. | ||
| 1360 | |||
| 1361 | If in doubt, say N. | 1352 | If in doubt, say N. |
| 1362 | 1353 | ||
| 1363 | config AC3200 | 1354 | config AC3200 |
| @@ -1431,7 +1422,7 @@ config FORCEDETH | |||
| 1431 | called forcedeth. | 1422 | called forcedeth. |
| 1432 | 1423 | ||
| 1433 | config FORCEDETH_NAPI | 1424 | config FORCEDETH_NAPI |
| 1434 | bool "Use Rx and Tx Polling (NAPI) (EXPERIMENTAL)" | 1425 | bool "Use Rx Polling (NAPI) (EXPERIMENTAL)" |
| 1435 | depends on FORCEDETH && EXPERIMENTAL | 1426 | depends on FORCEDETH && EXPERIMENTAL |
| 1436 | help | 1427 | help |
| 1437 | NAPI is a new driver API designed to reduce CPU and interrupt load | 1428 | NAPI is a new driver API designed to reduce CPU and interrupt load |
| @@ -1442,9 +1433,6 @@ config FORCEDETH_NAPI | |||
| 1442 | deployed on potentially unfriendly networks (e.g. in a firewall), | 1433 | deployed on potentially unfriendly networks (e.g. in a firewall), |
| 1443 | then say Y here. | 1434 | then say Y here. |
| 1444 | 1435 | ||
| 1445 | See <file:Documentation/networking/NAPI_HOWTO.txt> for more | ||
| 1446 | information. | ||
| 1447 | |||
| 1448 | If in doubt, say N. | 1436 | If in doubt, say N. |
| 1449 | 1437 | ||
| 1450 | config CS89x0 | 1438 | config CS89x0 |
| @@ -1756,9 +1744,6 @@ config VIA_RHINE_NAPI | |||
| 1756 | deployed on potentially unfriendly networks (e.g. in a firewall), | 1744 | deployed on potentially unfriendly networks (e.g. in a firewall), |
| 1757 | then say Y here. | 1745 | then say Y here. |
| 1758 | 1746 | ||
| 1759 | See <file:Documentation/networking/NAPI_HOWTO.txt> for more | ||
| 1760 | information. | ||
| 1761 | |||
| 1762 | config LAN_SAA9730 | 1747 | config LAN_SAA9730 |
| 1763 | bool "Philips SAA9730 Ethernet support" | 1748 | bool "Philips SAA9730 Ethernet support" |
| 1764 | depends on NET_PCI && PCI && MIPS_ATLAS | 1749 | depends on NET_PCI && PCI && MIPS_ATLAS |
| @@ -2003,9 +1988,6 @@ config E1000_NAPI | |||
| 2003 | deployed on potentially unfriendly networks (e.g. in a firewall), | 1988 | deployed on potentially unfriendly networks (e.g. in a firewall), |
| 2004 | then say Y here. | 1989 | then say Y here. |
| 2005 | 1990 | ||
| 2006 | See <file:Documentation/networking/NAPI_HOWTO.txt> for more | ||
| 2007 | information. | ||
| 2008 | |||
| 2009 | If in doubt, say N. | 1991 | If in doubt, say N. |
| 2010 | 1992 | ||
| 2011 | config E1000_DISABLE_PACKET_SPLIT | 1993 | config E1000_DISABLE_PACKET_SPLIT |
| @@ -2099,7 +2081,7 @@ config R8169 | |||
| 2099 | will be called r8169. This is recommended. | 2081 | will be called r8169. This is recommended. |
| 2100 | 2082 | ||
| 2101 | config R8169_NAPI | 2083 | config R8169_NAPI |
| 2102 | bool "Use Rx and Tx Polling (NAPI) (EXPERIMENTAL)" | 2084 | bool "Use Rx Polling (NAPI) (EXPERIMENTAL)" |
| 2103 | depends on R8169 && EXPERIMENTAL | 2085 | depends on R8169 && EXPERIMENTAL |
| 2104 | help | 2086 | help |
| 2105 | NAPI is a new driver API designed to reduce CPU and interrupt load | 2087 | NAPI is a new driver API designed to reduce CPU and interrupt load |
| @@ -2110,9 +2092,6 @@ config R8169_NAPI | |||
| 2110 | deployed on potentially unfriendly networks (e.g. in a firewall), | 2092 | deployed on potentially unfriendly networks (e.g. in a firewall), |
| 2111 | then say Y here. | 2093 | then say Y here. |
| 2112 | 2094 | ||
| 2113 | See <file:Documentation/networking/NAPI_HOWTO.txt> for more | ||
| 2114 | information. | ||
| 2115 | |||
| 2116 | If in doubt, say N. | 2095 | If in doubt, say N. |
| 2117 | 2096 | ||
| 2118 | config R8169_VLAN | 2097 | config R8169_VLAN |
| @@ -2364,7 +2343,7 @@ config GIANFAR | |||
| 2364 | and MPC86xx family of chips, and the FEC on the 8540. | 2343 | and MPC86xx family of chips, and the FEC on the 8540. |
| 2365 | 2344 | ||
| 2366 | config GFAR_NAPI | 2345 | config GFAR_NAPI |
| 2367 | bool "NAPI Support" | 2346 | bool "Use Rx Polling (NAPI)" |
| 2368 | depends on GIANFAR | 2347 | depends on GIANFAR |
| 2369 | 2348 | ||
| 2370 | config UCC_GETH | 2349 | config UCC_GETH |
| @@ -2376,7 +2355,7 @@ config UCC_GETH | |||
| 2376 | which is available on some Freescale SOCs. | 2355 | which is available on some Freescale SOCs. |
| 2377 | 2356 | ||
| 2378 | config UGETH_NAPI | 2357 | config UGETH_NAPI |
| 2379 | bool "NAPI Support" | 2358 | bool "Use Rx Polling (NAPI)" |
| 2380 | depends on UCC_GETH | 2359 | depends on UCC_GETH |
| 2381 | 2360 | ||
| 2382 | config UGETH_MAGIC_PACKET | 2361 | config UGETH_MAGIC_PACKET |
| @@ -2494,7 +2473,7 @@ config CHELSIO_T3 | |||
| 2494 | 2473 | ||
| 2495 | config EHEA | 2474 | config EHEA |
| 2496 | tristate "eHEA Ethernet support" | 2475 | tristate "eHEA Ethernet support" |
| 2497 | depends on IBMEBUS | 2476 | depends on IBMEBUS && INET |
| 2498 | select INET_LRO | 2477 | select INET_LRO |
| 2499 | ---help--- | 2478 | ---help--- |
| 2500 | This driver supports the IBM pSeries eHEA ethernet adapter. | 2479 | This driver supports the IBM pSeries eHEA ethernet adapter. |
| @@ -2559,9 +2538,6 @@ config IXGB_NAPI | |||
| 2559 | deployed on potentially unfriendly networks (e.g. in a firewall), | 2538 | deployed on potentially unfriendly networks (e.g. in a firewall), |
| 2560 | then say Y here. | 2539 | then say Y here. |
| 2561 | 2540 | ||
| 2562 | See <file:Documentation/networking/NAPI_HOWTO.txt> for more | ||
| 2563 | information. | ||
| 2564 | |||
| 2565 | If in doubt, say N. | 2541 | If in doubt, say N. |
| 2566 | 2542 | ||
| 2567 | config S2IO | 2543 | config S2IO |
| @@ -2584,14 +2560,11 @@ config S2IO_NAPI | |||
| 2584 | deployed on potentially unfriendly networks (e.g. in a firewall), | 2560 | deployed on potentially unfriendly networks (e.g. in a firewall), |
| 2585 | then say Y here. | 2561 | then say Y here. |
| 2586 | 2562 | ||
| 2587 | See <file:Documentation/networking/NAPI_HOWTO.txt> for more | ||
| 2588 | information. | ||
| 2589 | |||
| 2590 | If in doubt, say N. | 2563 | If in doubt, say N. |
| 2591 | 2564 | ||
| 2592 | config MYRI10GE | 2565 | config MYRI10GE |
| 2593 | tristate "Myricom Myri-10G Ethernet support" | 2566 | tristate "Myricom Myri-10G Ethernet support" |
| 2594 | depends on PCI | 2567 | depends on PCI && INET |
| 2595 | select FW_LOADER | 2568 | select FW_LOADER |
| 2596 | select CRC32 | 2569 | select CRC32 |
| 2597 | select INET_LRO | 2570 | select INET_LRO |
diff --git a/drivers/net/dm9000.c b/drivers/net/dm9000.c index 27ac010900ab..3286d2a0a870 100644 --- a/drivers/net/dm9000.c +++ b/drivers/net/dm9000.c | |||
| @@ -542,7 +542,8 @@ dm9000_probe(struct platform_device *pdev) | |||
| 542 | 542 | ||
| 543 | if (id_val != DM9000_ID) { | 543 | if (id_val != DM9000_ID) { |
| 544 | printk("%s: wrong id: 0x%08x\n", CARDNAME, id_val); | 544 | printk("%s: wrong id: 0x%08x\n", CARDNAME, id_val); |
| 545 | goto release; | 545 | ret = -ENODEV; |
| 546 | goto out; | ||
| 546 | } | 547 | } |
| 547 | 548 | ||
| 548 | /* from this point we assume that we have found a DM9000 */ | 549 | /* from this point we assume that we have found a DM9000 */ |
| @@ -602,8 +603,7 @@ dm9000_probe(struct platform_device *pdev) | |||
| 602 | } | 603 | } |
| 603 | return 0; | 604 | return 0; |
| 604 | 605 | ||
| 605 | release: | 606 | out: |
| 606 | out: | ||
| 607 | printk("%s: not found (%d).\n", CARDNAME, ret); | 607 | printk("%s: not found (%d).\n", CARDNAME, ret); |
| 608 | 608 | ||
| 609 | dm9000_release_board(pdev, db); | 609 | dm9000_release_board(pdev, db); |
diff --git a/drivers/net/phy/mdio-bitbang.c b/drivers/net/phy/mdio-bitbang.c index 8cd243d92af3..2747b1f89ffe 100644 --- a/drivers/net/phy/mdio-bitbang.c +++ b/drivers/net/phy/mdio-bitbang.c | |||
| @@ -185,3 +185,5 @@ void free_mdio_bitbang(struct mii_bus *bus) | |||
| 185 | module_put(ctrl->ops->owner); | 185 | module_put(ctrl->ops->owner); |
| 186 | kfree(bus); | 186 | kfree(bus); |
| 187 | } | 187 | } |
| 188 | |||
| 189 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/net/tsi108_eth.c b/drivers/net/tsi108_eth.c index df10af7df7b8..35d15e850075 100644 --- a/drivers/net/tsi108_eth.c +++ b/drivers/net/tsi108_eth.c | |||
| @@ -1629,7 +1629,7 @@ tsi108_init_one(struct platform_device *pdev) | |||
| 1629 | goto register_fail; | 1629 | goto register_fail; |
| 1630 | } | 1630 | } |
| 1631 | 1631 | ||
| 1632 | printk(KERN_INFO "%s: Tsi108 Gigabit Ethernet, MAC: %s\n" | 1632 | printk(KERN_INFO "%s: Tsi108 Gigabit Ethernet, MAC: %s\n", |
| 1633 | dev->name, print_mac(mac, dev->dev_addr)); | 1633 | dev->name, print_mac(mac, dev->dev_addr)); |
| 1634 | #ifdef DEBUG | 1634 | #ifdef DEBUG |
| 1635 | data->msg_enable = DEBUG; | 1635 | data->msg_enable = DEBUG; |
diff --git a/drivers/net/tulip/Kconfig b/drivers/net/tulip/Kconfig index 1c537d5a3062..49d7a290dbbc 100644 --- a/drivers/net/tulip/Kconfig +++ b/drivers/net/tulip/Kconfig | |||
| @@ -67,7 +67,7 @@ config TULIP_MMIO | |||
| 67 | If in doubt, say N. | 67 | If in doubt, say N. |
| 68 | 68 | ||
| 69 | config TULIP_NAPI | 69 | config TULIP_NAPI |
| 70 | bool "Use NAPI RX polling " | 70 | bool "Use RX polling (NAPI)" |
| 71 | depends on TULIP | 71 | depends on TULIP |
| 72 | help | 72 | help |
| 73 | NAPI is a new driver API designed to reduce CPU and interrupt load | 73 | NAPI is a new driver API designed to reduce CPU and interrupt load |
| @@ -78,18 +78,16 @@ config TULIP_NAPI | |||
| 78 | deployed on potentially unfriendly networks (e.g. in a firewall), | 78 | deployed on potentially unfriendly networks (e.g. in a firewall), |
| 79 | then say Y here. | 79 | then say Y here. |
| 80 | 80 | ||
| 81 | See <file:Documentation/networking/NAPI_HOWTO.txt> for more | ||
| 82 | information. | ||
| 83 | |||
| 84 | If in doubt, say N. | 81 | If in doubt, say N. |
| 85 | 82 | ||
| 86 | config TULIP_NAPI_HW_MITIGATION | 83 | config TULIP_NAPI_HW_MITIGATION |
| 87 | bool "Use Interrupt Mitigation " | 84 | bool "Use Interrupt Mitigation" |
| 88 | depends on TULIP_NAPI | 85 | depends on TULIP_NAPI |
| 89 | ---help--- | 86 | ---help--- |
| 90 | Use HW to reduce RX interrupts. Not strict necessary since NAPI reduces | 87 | Use HW to reduce RX interrupts. Not strictly necessary since NAPI |
| 91 | RX interrupts but itself. Although this reduces RX interrupts even at | 88 | reduces RX interrupts by itself. Interrupt mitigation reduces RX |
| 92 | low levels traffic at the cost of a small latency. | 89 | interrupts even at low levels of traffic at the cost of a small |
| 90 | latency. | ||
| 93 | 91 | ||
| 94 | If in doubt, say Y. | 92 | If in doubt, say Y. |
| 95 | 93 | ||
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c index c141a264ac45..9d9ff76a9bc6 100644 --- a/drivers/net/wireless/b43/main.c +++ b/drivers/net/wireless/b43/main.c | |||
| @@ -49,7 +49,6 @@ | |||
| 49 | #include "pio.h" | 49 | #include "pio.h" |
| 50 | #include "sysfs.h" | 50 | #include "sysfs.h" |
| 51 | #include "xmit.h" | 51 | #include "xmit.h" |
| 52 | #include "sysfs.h" | ||
| 53 | #include "lo.h" | 52 | #include "lo.h" |
| 54 | #include "pcmcia.h" | 53 | #include "pcmcia.h" |
| 55 | 54 | ||
| @@ -3495,7 +3494,7 @@ static int b43_start(struct ieee80211_hw *hw) | |||
| 3495 | struct b43_wl *wl = hw_to_b43_wl(hw); | 3494 | struct b43_wl *wl = hw_to_b43_wl(hw); |
| 3496 | struct b43_wldev *dev = wl->current_dev; | 3495 | struct b43_wldev *dev = wl->current_dev; |
| 3497 | int did_init = 0; | 3496 | int did_init = 0; |
| 3498 | int err; | 3497 | int err = 0; |
| 3499 | 3498 | ||
| 3500 | mutex_lock(&wl->mutex); | 3499 | mutex_lock(&wl->mutex); |
| 3501 | 3500 | ||
| @@ -3521,7 +3520,7 @@ static int b43_start(struct ieee80211_hw *hw) | |||
| 3521 | return err; | 3520 | return err; |
| 3522 | } | 3521 | } |
| 3523 | 3522 | ||
| 3524 | void b43_stop(struct ieee80211_hw *hw) | 3523 | static void b43_stop(struct ieee80211_hw *hw) |
| 3525 | { | 3524 | { |
| 3526 | struct b43_wl *wl = hw_to_b43_wl(hw); | 3525 | struct b43_wl *wl = hw_to_b43_wl(hw); |
| 3527 | struct b43_wldev *dev = wl->current_dev; | 3526 | struct b43_wldev *dev = wl->current_dev; |
diff --git a/drivers/net/wireless/b43legacy/main.c b/drivers/net/wireless/b43legacy/main.c index f0749510bcd7..d09479e816cd 100644 --- a/drivers/net/wireless/b43legacy/main.c +++ b/drivers/net/wireless/b43legacy/main.c | |||
| @@ -3306,7 +3306,7 @@ static int b43legacy_start(struct ieee80211_hw *hw) | |||
| 3306 | struct b43legacy_wl *wl = hw_to_b43legacy_wl(hw); | 3306 | struct b43legacy_wl *wl = hw_to_b43legacy_wl(hw); |
| 3307 | struct b43legacy_wldev *dev = wl->current_dev; | 3307 | struct b43legacy_wldev *dev = wl->current_dev; |
| 3308 | int did_init = 0; | 3308 | int did_init = 0; |
| 3309 | int err; | 3309 | int err = 0; |
| 3310 | 3310 | ||
| 3311 | mutex_lock(&wl->mutex); | 3311 | mutex_lock(&wl->mutex); |
| 3312 | 3312 | ||
diff --git a/drivers/net/wireless/ipw2100.c b/drivers/net/wireless/ipw2100.c index 92314c365afd..a6c7904de282 100644 --- a/drivers/net/wireless/ipw2100.c +++ b/drivers/net/wireless/ipw2100.c | |||
| @@ -2089,12 +2089,46 @@ static void isr_indicate_rf_kill(struct ipw2100_priv *priv, u32 status) | |||
| 2089 | queue_delayed_work(priv->workqueue, &priv->rf_kill, round_jiffies(HZ)); | 2089 | queue_delayed_work(priv->workqueue, &priv->rf_kill, round_jiffies(HZ)); |
| 2090 | } | 2090 | } |
| 2091 | 2091 | ||
| 2092 | static void send_scan_event(void *data) | ||
| 2093 | { | ||
| 2094 | struct ipw2100_priv *priv = data; | ||
| 2095 | union iwreq_data wrqu; | ||
| 2096 | |||
| 2097 | wrqu.data.length = 0; | ||
| 2098 | wrqu.data.flags = 0; | ||
| 2099 | wireless_send_event(priv->net_dev, SIOCGIWSCAN, &wrqu, NULL); | ||
| 2100 | } | ||
| 2101 | |||
| 2102 | static void ipw2100_scan_event_later(struct work_struct *work) | ||
| 2103 | { | ||
| 2104 | send_scan_event(container_of(work, struct ipw2100_priv, | ||
| 2105 | scan_event_later.work)); | ||
| 2106 | } | ||
| 2107 | |||
| 2108 | static void ipw2100_scan_event_now(struct work_struct *work) | ||
| 2109 | { | ||
| 2110 | send_scan_event(container_of(work, struct ipw2100_priv, | ||
| 2111 | scan_event_now)); | ||
| 2112 | } | ||
| 2113 | |||
| 2092 | static void isr_scan_complete(struct ipw2100_priv *priv, u32 status) | 2114 | static void isr_scan_complete(struct ipw2100_priv *priv, u32 status) |
| 2093 | { | 2115 | { |
| 2094 | IPW_DEBUG_SCAN("scan complete\n"); | 2116 | IPW_DEBUG_SCAN("scan complete\n"); |
| 2095 | /* Age the scan results... */ | 2117 | /* Age the scan results... */ |
| 2096 | priv->ieee->scans++; | 2118 | priv->ieee->scans++; |
| 2097 | priv->status &= ~STATUS_SCANNING; | 2119 | priv->status &= ~STATUS_SCANNING; |
| 2120 | |||
| 2121 | /* Only userspace-requested scan completion events go out immediately */ | ||
| 2122 | if (!priv->user_requested_scan) { | ||
| 2123 | if (!delayed_work_pending(&priv->scan_event_later)) | ||
| 2124 | queue_delayed_work(priv->workqueue, | ||
| 2125 | &priv->scan_event_later, | ||
| 2126 | round_jiffies(msecs_to_jiffies(4000))); | ||
| 2127 | } else { | ||
| 2128 | priv->user_requested_scan = 0; | ||
| 2129 | cancel_delayed_work(&priv->scan_event_later); | ||
| 2130 | queue_work(priv->workqueue, &priv->scan_event_now); | ||
| 2131 | } | ||
| 2098 | } | 2132 | } |
| 2099 | 2133 | ||
| 2100 | #ifdef CONFIG_IPW2100_DEBUG | 2134 | #ifdef CONFIG_IPW2100_DEBUG |
| @@ -4349,6 +4383,7 @@ static void ipw2100_kill_workqueue(struct ipw2100_priv *priv) | |||
| 4349 | cancel_delayed_work(&priv->wx_event_work); | 4383 | cancel_delayed_work(&priv->wx_event_work); |
| 4350 | cancel_delayed_work(&priv->hang_check); | 4384 | cancel_delayed_work(&priv->hang_check); |
| 4351 | cancel_delayed_work(&priv->rf_kill); | 4385 | cancel_delayed_work(&priv->rf_kill); |
| 4386 | cancel_delayed_work(&priv->scan_event_later); | ||
| 4352 | destroy_workqueue(priv->workqueue); | 4387 | destroy_workqueue(priv->workqueue); |
| 4353 | priv->workqueue = NULL; | 4388 | priv->workqueue = NULL; |
| 4354 | } | 4389 | } |
| @@ -6092,6 +6127,8 @@ static struct net_device *ipw2100_alloc_device(struct pci_dev *pci_dev, | |||
| 6092 | INIT_DELAYED_WORK(&priv->wx_event_work, ipw2100_wx_event_work); | 6127 | INIT_DELAYED_WORK(&priv->wx_event_work, ipw2100_wx_event_work); |
| 6093 | INIT_DELAYED_WORK(&priv->hang_check, ipw2100_hang_check); | 6128 | INIT_DELAYED_WORK(&priv->hang_check, ipw2100_hang_check); |
| 6094 | INIT_DELAYED_WORK(&priv->rf_kill, ipw2100_rf_kill); | 6129 | INIT_DELAYED_WORK(&priv->rf_kill, ipw2100_rf_kill); |
| 6130 | INIT_WORK(&priv->scan_event_now, ipw2100_scan_event_now); | ||
| 6131 | INIT_DELAYED_WORK(&priv->scan_event_later, ipw2100_scan_event_later); | ||
| 6095 | 6132 | ||
| 6096 | tasklet_init(&priv->irq_tasklet, (void (*)(unsigned long)) | 6133 | tasklet_init(&priv->irq_tasklet, (void (*)(unsigned long)) |
| 6097 | ipw2100_irq_tasklet, (unsigned long)priv); | 6134 | ipw2100_irq_tasklet, (unsigned long)priv); |
| @@ -7396,6 +7433,8 @@ static int ipw2100_wx_set_scan(struct net_device *dev, | |||
| 7396 | } | 7433 | } |
| 7397 | 7434 | ||
| 7398 | IPW_DEBUG_WX("Initiating scan...\n"); | 7435 | IPW_DEBUG_WX("Initiating scan...\n"); |
| 7436 | |||
| 7437 | priv->user_requested_scan = 1; | ||
| 7399 | if (ipw2100_set_scan_options(priv) || ipw2100_start_scan(priv)) { | 7438 | if (ipw2100_set_scan_options(priv) || ipw2100_start_scan(priv)) { |
| 7400 | IPW_DEBUG_WX("Start scan failed.\n"); | 7439 | IPW_DEBUG_WX("Start scan failed.\n"); |
| 7401 | 7440 | ||
diff --git a/drivers/net/wireless/ipw2100.h b/drivers/net/wireless/ipw2100.h index 2b8be2418fa7..bbf1ddcafba8 100644 --- a/drivers/net/wireless/ipw2100.h +++ b/drivers/net/wireless/ipw2100.h | |||
| @@ -586,6 +586,10 @@ struct ipw2100_priv { | |||
| 586 | struct delayed_work wx_event_work; | 586 | struct delayed_work wx_event_work; |
| 587 | struct delayed_work hang_check; | 587 | struct delayed_work hang_check; |
| 588 | struct delayed_work rf_kill; | 588 | struct delayed_work rf_kill; |
| 589 | struct work_struct scan_event_now; | ||
| 590 | struct delayed_work scan_event_later; | ||
| 591 | |||
| 592 | int user_requested_scan; | ||
| 589 | 593 | ||
| 590 | u32 interrupts; | 594 | u32 interrupts; |
| 591 | int tx_interrupts; | 595 | int tx_interrupts; |
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c index f4aabcf480e4..262ab0b55824 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c +++ b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c | |||
| @@ -37,9 +37,6 @@ | |||
| 37 | 37 | ||
| 38 | #include <linux/workqueue.h> | 38 | #include <linux/workqueue.h> |
| 39 | 39 | ||
| 40 | #include <net/mac80211.h> | ||
| 41 | #include <linux/wireless.h> | ||
| 42 | |||
| 43 | #define IWL 3945 | 40 | #define IWL 3945 |
| 44 | 41 | ||
| 45 | #include "../net/mac80211/ieee80211_rate.h" | 42 | #include "../net/mac80211/ieee80211_rate.h" |
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c index acb38750535f..19bcb01e2784 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945.c +++ b/drivers/net/wireless/iwlwifi/iwl-3945.c | |||
| @@ -38,7 +38,6 @@ | |||
| 38 | #include <net/mac80211.h> | 38 | #include <net/mac80211.h> |
| 39 | 39 | ||
| 40 | #include <linux/etherdevice.h> | 40 | #include <linux/etherdevice.h> |
| 41 | #include <linux/delay.h> | ||
| 42 | 41 | ||
| 43 | #define IWL 3945 | 42 | #define IWL 3945 |
| 44 | 43 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965-rs.c b/drivers/net/wireless/iwlwifi/iwl-4965-rs.c index 287c75705c44..8dc78c0bf1ff 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965-rs.c +++ b/drivers/net/wireless/iwlwifi/iwl-4965-rs.c | |||
| @@ -36,9 +36,6 @@ | |||
| 36 | 36 | ||
| 37 | #include <linux/workqueue.h> | 37 | #include <linux/workqueue.h> |
| 38 | 38 | ||
| 39 | #include <net/mac80211.h> | ||
| 40 | #include <linux/wireless.h> | ||
| 41 | |||
| 42 | #define IWL 4965 | 39 | #define IWL 4965 |
| 43 | 40 | ||
| 44 | #include "../net/mac80211/ieee80211_rate.h" | 41 | #include "../net/mac80211/ieee80211_rate.h" |
| @@ -2024,12 +2021,18 @@ static int open_file_generic(struct inode *inode, struct file *file) | |||
| 2024 | static void rs_dbgfs_set_mcs(struct iwl_rate_scale_priv *rs_priv, | 2021 | static void rs_dbgfs_set_mcs(struct iwl_rate_scale_priv *rs_priv, |
| 2025 | struct iwl_rate *mcs, int index) | 2022 | struct iwl_rate *mcs, int index) |
| 2026 | { | 2023 | { |
| 2027 | const u32 cck_rate = 0x820A; | 2024 | u32 base_rate; |
| 2025 | |||
| 2026 | if (rs_priv->phymode == (u8) MODE_IEEE80211A) | ||
| 2027 | base_rate = 0x800D; | ||
| 2028 | else | ||
| 2029 | base_rate = 0x820A; | ||
| 2030 | |||
| 2028 | if (rs_priv->dbg_fixed.rate_n_flags) { | 2031 | if (rs_priv->dbg_fixed.rate_n_flags) { |
| 2029 | if (index < 12) | 2032 | if (index < 12) |
| 2030 | mcs->rate_n_flags = rs_priv->dbg_fixed.rate_n_flags; | 2033 | mcs->rate_n_flags = rs_priv->dbg_fixed.rate_n_flags; |
| 2031 | else | 2034 | else |
| 2032 | mcs->rate_n_flags = cck_rate; | 2035 | mcs->rate_n_flags = base_rate; |
| 2033 | IWL_DEBUG_RATE("Fixed rate ON\n"); | 2036 | IWL_DEBUG_RATE("Fixed rate ON\n"); |
| 2034 | return; | 2037 | return; |
| 2035 | } | 2038 | } |
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c index b50d20267c8a..557deebca1b9 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965.c +++ b/drivers/net/wireless/iwlwifi/iwl-4965.c | |||
| @@ -35,9 +35,7 @@ | |||
| 35 | #include <linux/netdevice.h> | 35 | #include <linux/netdevice.h> |
| 36 | #include <linux/wireless.h> | 36 | #include <linux/wireless.h> |
| 37 | #include <net/mac80211.h> | 37 | #include <net/mac80211.h> |
| 38 | #include <linux/netdevice.h> | ||
| 39 | #include <linux/etherdevice.h> | 38 | #include <linux/etherdevice.h> |
| 40 | #include <linux/delay.h> | ||
| 41 | 39 | ||
| 42 | #define IWL 4965 | 40 | #define IWL 4965 |
| 43 | 41 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c index 75e3b5c3f155..83019d1d7ccc 100644 --- a/drivers/net/wireless/iwlwifi/iwl3945-base.c +++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c | |||
| @@ -48,8 +48,6 @@ | |||
| 48 | #include <linux/netdevice.h> | 48 | #include <linux/netdevice.h> |
| 49 | #include <linux/wireless.h> | 49 | #include <linux/wireless.h> |
| 50 | #include <linux/firmware.h> | 50 | #include <linux/firmware.h> |
| 51 | #include <linux/skbuff.h> | ||
| 52 | #include <linux/netdevice.h> | ||
| 53 | #include <linux/etherdevice.h> | 51 | #include <linux/etherdevice.h> |
| 54 | #include <linux/if_arp.h> | 52 | #include <linux/if_arp.h> |
| 55 | 53 | ||
| @@ -1749,21 +1747,22 @@ static void iwl_unset_hw_setting(struct iwl_priv *priv) | |||
| 1749 | * return : set the bit for each supported rate insert in ie | 1747 | * return : set the bit for each supported rate insert in ie |
| 1750 | */ | 1748 | */ |
| 1751 | static u16 iwl_supported_rate_to_ie(u8 *ie, u16 supported_rate, | 1749 | static u16 iwl_supported_rate_to_ie(u8 *ie, u16 supported_rate, |
| 1752 | u16 basic_rate, int max_count) | 1750 | u16 basic_rate, int *left) |
| 1753 | { | 1751 | { |
| 1754 | u16 ret_rates = 0, bit; | 1752 | u16 ret_rates = 0, bit; |
| 1755 | int i; | 1753 | int i; |
| 1756 | u8 *rates; | 1754 | u8 *cnt = ie; |
| 1757 | 1755 | u8 *rates = ie + 1; | |
| 1758 | rates = &(ie[1]); | ||
| 1759 | 1756 | ||
| 1760 | for (bit = 1, i = 0; i < IWL_RATE_COUNT; i++, bit <<= 1) { | 1757 | for (bit = 1, i = 0; i < IWL_RATE_COUNT; i++, bit <<= 1) { |
| 1761 | if (bit & supported_rate) { | 1758 | if (bit & supported_rate) { |
| 1762 | ret_rates |= bit; | 1759 | ret_rates |= bit; |
| 1763 | rates[*ie] = iwl_rates[i].ieee | | 1760 | rates[*cnt] = iwl_rates[i].ieee | |
| 1764 | ((bit & basic_rate) ? 0x80 : 0x00); | 1761 | ((bit & basic_rate) ? 0x80 : 0x00); |
| 1765 | *ie = *ie + 1; | 1762 | (*cnt)++; |
| 1766 | if (*ie >= max_count) | 1763 | (*left)--; |
| 1764 | if ((*left <= 0) || | ||
| 1765 | (*cnt >= IWL_SUPPORTED_RATES_IE_LEN)) | ||
| 1767 | break; | 1766 | break; |
| 1768 | } | 1767 | } |
| 1769 | } | 1768 | } |
| @@ -1780,7 +1779,7 @@ static u16 iwl_fill_probe_req(struct iwl_priv *priv, | |||
| 1780 | { | 1779 | { |
| 1781 | int len = 0; | 1780 | int len = 0; |
| 1782 | u8 *pos = NULL; | 1781 | u8 *pos = NULL; |
| 1783 | u16 ret_rates; | 1782 | u16 active_rates, ret_rates, cck_rates; |
| 1784 | 1783 | ||
| 1785 | /* Make sure there is enough space for the probe request, | 1784 | /* Make sure there is enough space for the probe request, |
| 1786 | * two mandatory IEs and the data */ | 1785 | * two mandatory IEs and the data */ |
| @@ -1825,19 +1824,27 @@ static u16 iwl_fill_probe_req(struct iwl_priv *priv, | |||
| 1825 | left -= 2; | 1824 | left -= 2; |
| 1826 | if (left < 0) | 1825 | if (left < 0) |
| 1827 | return 0; | 1826 | return 0; |
| 1827 | |||
| 1828 | /* ... fill it in... */ | 1828 | /* ... fill it in... */ |
| 1829 | *pos++ = WLAN_EID_SUPP_RATES; | 1829 | *pos++ = WLAN_EID_SUPP_RATES; |
| 1830 | *pos = 0; | 1830 | *pos = 0; |
| 1831 | ret_rates = priv->active_rate = priv->rates_mask; | 1831 | |
| 1832 | priv->active_rate = priv->rates_mask; | ||
| 1833 | active_rates = priv->active_rate; | ||
| 1832 | priv->active_rate_basic = priv->rates_mask & IWL_BASIC_RATES_MASK; | 1834 | priv->active_rate_basic = priv->rates_mask & IWL_BASIC_RATES_MASK; |
| 1833 | 1835 | ||
| 1834 | iwl_supported_rate_to_ie(pos, priv->active_rate, | 1836 | cck_rates = IWL_CCK_RATES_MASK & active_rates; |
| 1835 | priv->active_rate_basic, left); | 1837 | ret_rates = iwl_supported_rate_to_ie(pos, cck_rates, |
| 1838 | priv->active_rate_basic, &left); | ||
| 1839 | active_rates &= ~ret_rates; | ||
| 1840 | |||
| 1841 | ret_rates = iwl_supported_rate_to_ie(pos, active_rates, | ||
| 1842 | priv->active_rate_basic, &left); | ||
| 1843 | active_rates &= ~ret_rates; | ||
| 1844 | |||
| 1836 | len += 2 + *pos; | 1845 | len += 2 + *pos; |
| 1837 | pos += (*pos) + 1; | 1846 | pos += (*pos) + 1; |
| 1838 | ret_rates = ~ret_rates & priv->active_rate; | 1847 | if (active_rates == 0) |
| 1839 | |||
| 1840 | if (ret_rates == 0) | ||
| 1841 | goto fill_end; | 1848 | goto fill_end; |
| 1842 | 1849 | ||
| 1843 | /* fill in supported extended rate */ | 1850 | /* fill in supported extended rate */ |
| @@ -1848,7 +1855,8 @@ static u16 iwl_fill_probe_req(struct iwl_priv *priv, | |||
| 1848 | /* ... fill it in... */ | 1855 | /* ... fill it in... */ |
| 1849 | *pos++ = WLAN_EID_EXT_SUPP_RATES; | 1856 | *pos++ = WLAN_EID_EXT_SUPP_RATES; |
| 1850 | *pos = 0; | 1857 | *pos = 0; |
| 1851 | iwl_supported_rate_to_ie(pos, ret_rates, priv->active_rate_basic, left); | 1858 | iwl_supported_rate_to_ie(pos, active_rates, |
| 1859 | priv->active_rate_basic, &left); | ||
| 1852 | if (*pos > 0) | 1860 | if (*pos > 0) |
| 1853 | len += 2 + *pos; | 1861 | len += 2 + *pos; |
| 1854 | 1862 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c index b1a6e39f7821..5e1279263b22 100644 --- a/drivers/net/wireless/iwlwifi/iwl4965-base.c +++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c | |||
| @@ -48,8 +48,6 @@ | |||
| 48 | #include <linux/netdevice.h> | 48 | #include <linux/netdevice.h> |
| 49 | #include <linux/wireless.h> | 49 | #include <linux/wireless.h> |
| 50 | #include <linux/firmware.h> | 50 | #include <linux/firmware.h> |
| 51 | #include <linux/skbuff.h> | ||
| 52 | #include <linux/netdevice.h> | ||
| 53 | #include <linux/etherdevice.h> | 51 | #include <linux/etherdevice.h> |
| 54 | #include <linux/if_arp.h> | 52 | #include <linux/if_arp.h> |
| 55 | 53 | ||
| @@ -1802,21 +1800,22 @@ static void iwl_unset_hw_setting(struct iwl_priv *priv) | |||
| 1802 | * return : set the bit for each supported rate insert in ie | 1800 | * return : set the bit for each supported rate insert in ie |
| 1803 | */ | 1801 | */ |
| 1804 | static u16 iwl_supported_rate_to_ie(u8 *ie, u16 supported_rate, | 1802 | static u16 iwl_supported_rate_to_ie(u8 *ie, u16 supported_rate, |
| 1805 | u16 basic_rate, int max_count) | 1803 | u16 basic_rate, int *left) |
| 1806 | { | 1804 | { |
| 1807 | u16 ret_rates = 0, bit; | 1805 | u16 ret_rates = 0, bit; |
| 1808 | int i; | 1806 | int i; |
| 1809 | u8 *rates; | 1807 | u8 *cnt = ie; |
| 1810 | 1808 | u8 *rates = ie + 1; | |
| 1811 | rates = &(ie[1]); | ||
| 1812 | 1809 | ||
| 1813 | for (bit = 1, i = 0; i < IWL_RATE_COUNT; i++, bit <<= 1) { | 1810 | for (bit = 1, i = 0; i < IWL_RATE_COUNT; i++, bit <<= 1) { |
| 1814 | if (bit & supported_rate) { | 1811 | if (bit & supported_rate) { |
| 1815 | ret_rates |= bit; | 1812 | ret_rates |= bit; |
| 1816 | rates[*ie] = iwl_rates[i].ieee | | 1813 | rates[*cnt] = iwl_rates[i].ieee | |
| 1817 | ((bit & basic_rate) ? 0x80 : 0x00); | 1814 | ((bit & basic_rate) ? 0x80 : 0x00); |
| 1818 | *ie = *ie + 1; | 1815 | (*cnt)++; |
| 1819 | if (*ie >= max_count) | 1816 | (*left)--; |
| 1817 | if ((*left <= 0) || | ||
| 1818 | (*cnt >= IWL_SUPPORTED_RATES_IE_LEN)) | ||
| 1820 | break; | 1819 | break; |
| 1821 | } | 1820 | } |
| 1822 | } | 1821 | } |
| @@ -1839,7 +1838,7 @@ static u16 iwl_fill_probe_req(struct iwl_priv *priv, | |||
| 1839 | { | 1838 | { |
| 1840 | int len = 0; | 1839 | int len = 0; |
| 1841 | u8 *pos = NULL; | 1840 | u8 *pos = NULL; |
| 1842 | u16 ret_rates; | 1841 | u16 active_rates, ret_rates, cck_rates; |
| 1843 | 1842 | ||
| 1844 | /* Make sure there is enough space for the probe request, | 1843 | /* Make sure there is enough space for the probe request, |
| 1845 | * two mandatory IEs and the data */ | 1844 | * two mandatory IEs and the data */ |
| @@ -1884,19 +1883,27 @@ static u16 iwl_fill_probe_req(struct iwl_priv *priv, | |||
| 1884 | left -= 2; | 1883 | left -= 2; |
| 1885 | if (left < 0) | 1884 | if (left < 0) |
| 1886 | return 0; | 1885 | return 0; |
| 1886 | |||
| 1887 | /* ... fill it in... */ | 1887 | /* ... fill it in... */ |
| 1888 | *pos++ = WLAN_EID_SUPP_RATES; | 1888 | *pos++ = WLAN_EID_SUPP_RATES; |
| 1889 | *pos = 0; | 1889 | *pos = 0; |
| 1890 | ret_rates = priv->active_rate = priv->rates_mask; | 1890 | |
| 1891 | priv->active_rate = priv->rates_mask; | ||
| 1892 | active_rates = priv->active_rate; | ||
| 1891 | priv->active_rate_basic = priv->rates_mask & IWL_BASIC_RATES_MASK; | 1893 | priv->active_rate_basic = priv->rates_mask & IWL_BASIC_RATES_MASK; |
| 1892 | 1894 | ||
| 1893 | iwl_supported_rate_to_ie(pos, priv->active_rate, | 1895 | cck_rates = IWL_CCK_RATES_MASK & active_rates; |
| 1894 | priv->active_rate_basic, left); | 1896 | ret_rates = iwl_supported_rate_to_ie(pos, cck_rates, |
| 1897 | priv->active_rate_basic, &left); | ||
| 1898 | active_rates &= ~ret_rates; | ||
| 1899 | |||
| 1900 | ret_rates = iwl_supported_rate_to_ie(pos, active_rates, | ||
| 1901 | priv->active_rate_basic, &left); | ||
| 1902 | active_rates &= ~ret_rates; | ||
| 1903 | |||
| 1895 | len += 2 + *pos; | 1904 | len += 2 + *pos; |
| 1896 | pos += (*pos) + 1; | 1905 | pos += (*pos) + 1; |
| 1897 | ret_rates = ~ret_rates & priv->active_rate; | 1906 | if (active_rates == 0) |
| 1898 | |||
| 1899 | if (ret_rates == 0) | ||
| 1900 | goto fill_end; | 1907 | goto fill_end; |
| 1901 | 1908 | ||
| 1902 | /* fill in supported extended rate */ | 1909 | /* fill in supported extended rate */ |
| @@ -1907,7 +1914,8 @@ static u16 iwl_fill_probe_req(struct iwl_priv *priv, | |||
| 1907 | /* ... fill it in... */ | 1914 | /* ... fill it in... */ |
| 1908 | *pos++ = WLAN_EID_EXT_SUPP_RATES; | 1915 | *pos++ = WLAN_EID_EXT_SUPP_RATES; |
| 1909 | *pos = 0; | 1916 | *pos = 0; |
| 1910 | iwl_supported_rate_to_ie(pos, ret_rates, priv->active_rate_basic, left); | 1917 | iwl_supported_rate_to_ie(pos, active_rates, |
| 1918 | priv->active_rate_basic, &left); | ||
| 1911 | if (*pos > 0) | 1919 | if (*pos > 0) |
| 1912 | len += 2 + *pos; | 1920 | len += 2 + *pos; |
| 1913 | 1921 | ||
| @@ -4494,13 +4502,13 @@ static u8 ratio2dB[100] = { | |||
| 4494 | * Conversion assumes that levels are voltages (20*log), not powers (10*log). */ | 4502 | * Conversion assumes that levels are voltages (20*log), not powers (10*log). */ |
| 4495 | int iwl_calc_db_from_ratio(int sig_ratio) | 4503 | int iwl_calc_db_from_ratio(int sig_ratio) |
| 4496 | { | 4504 | { |
| 4497 | /* Anything above 1000:1 just report as 60 dB */ | 4505 | /* 1000:1 or higher just report as 60 dB */ |
| 4498 | if (sig_ratio > 1000) | 4506 | if (sig_ratio >= 1000) |
| 4499 | return 60; | 4507 | return 60; |
| 4500 | 4508 | ||
| 4501 | /* Above 100:1, divide by 10 and use table, | 4509 | /* 100:1 or higher, divide by 10 and use table, |
| 4502 | * add 20 dB to make up for divide by 10 */ | 4510 | * add 20 dB to make up for divide by 10 */ |
| 4503 | if (sig_ratio > 100) | 4511 | if (sig_ratio >= 100) |
| 4504 | return (20 + (int)ratio2dB[sig_ratio/10]); | 4512 | return (20 + (int)ratio2dB[sig_ratio/10]); |
| 4505 | 4513 | ||
| 4506 | /* We shouldn't see this */ | 4514 | /* We shouldn't see this */ |
diff --git a/drivers/net/wireless/iwlwifi/iwlwifi.h b/drivers/net/wireless/iwlwifi/iwlwifi.h index e0b97c341215..432ce887807f 100644 --- a/drivers/net/wireless/iwlwifi/iwlwifi.h +++ b/drivers/net/wireless/iwlwifi/iwlwifi.h | |||
| @@ -39,18 +39,13 @@ struct iwl_priv; | |||
| 39 | /* Hardware specific file defines the PCI IDs table for that hardware module */ | 39 | /* Hardware specific file defines the PCI IDs table for that hardware module */ |
| 40 | extern struct pci_device_id iwl_hw_card_ids[]; | 40 | extern struct pci_device_id iwl_hw_card_ids[]; |
| 41 | 41 | ||
| 42 | #include "iwl-hw.h" | ||
| 42 | #if IWL == 3945 | 43 | #if IWL == 3945 |
| 43 | |||
| 44 | #define DRV_NAME "iwl3945" | 44 | #define DRV_NAME "iwl3945" |
| 45 | #include "iwl-hw.h" | ||
| 46 | #include "iwl-3945-hw.h" | 45 | #include "iwl-3945-hw.h" |
| 47 | |||
| 48 | #elif IWL == 4965 | 46 | #elif IWL == 4965 |
| 49 | |||
| 50 | #define DRV_NAME "iwl4965" | 47 | #define DRV_NAME "iwl4965" |
| 51 | #include "iwl-hw.h" | ||
| 52 | #include "iwl-4965-hw.h" | 48 | #include "iwl-4965-hw.h" |
| 53 | |||
| 54 | #endif | 49 | #endif |
| 55 | 50 | ||
| 56 | #include "iwl-prph.h" | 51 | #include "iwl-prph.h" |
diff --git a/drivers/net/wireless/p54common.c b/drivers/net/wireless/p54common.c index 2c63cf0ad2cd..1437db0cf4b2 100644 --- a/drivers/net/wireless/p54common.c +++ b/drivers/net/wireless/p54common.c | |||
| @@ -577,7 +577,7 @@ static int p54_set_filter(struct ieee80211_hw *dev, u16 filter_type, | |||
| 577 | struct p54_tx_control_filter *filter; | 577 | struct p54_tx_control_filter *filter; |
| 578 | 578 | ||
| 579 | hdr = kzalloc(sizeof(*hdr) + sizeof(*filter) + | 579 | hdr = kzalloc(sizeof(*hdr) + sizeof(*filter) + |
| 580 | priv->tx_hdr_len, GFP_KERNEL); | 580 | priv->tx_hdr_len, GFP_ATOMIC); |
| 581 | if (!hdr) | 581 | if (!hdr) |
| 582 | return -ENOMEM; | 582 | return -ENOMEM; |
| 583 | 583 | ||
diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c index bb6f46cfbb9f..ff399f8083e9 100644 --- a/drivers/net/wireless/rt2x00/rt2x00dev.c +++ b/drivers/net/wireless/rt2x00/rt2x00dev.c | |||
| @@ -550,7 +550,7 @@ void rt2x00lib_write_tx_desc(struct rt2x00_dev *rt2x00dev, | |||
| 550 | /* | 550 | /* |
| 551 | * Check if we need to set the Length Extension | 551 | * Check if we need to set the Length Extension |
| 552 | */ | 552 | */ |
| 553 | if (bitrate == 110 && residual <= 3) | 553 | if (bitrate == 110 && residual <= 30) |
| 554 | desc.service |= 0x80; | 554 | desc.service |= 0x80; |
| 555 | } | 555 | } |
| 556 | 556 | ||
diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c index 3e42759473c3..46c8c0840a65 100644 --- a/drivers/net/wireless/rt2x00/rt73usb.c +++ b/drivers/net/wireless/rt2x00/rt73usb.c | |||
| @@ -2029,6 +2029,7 @@ static struct usb_device_id rt73usb_device_table[] = { | |||
| 2029 | { USB_DEVICE(0x050d, 0x7050), USB_DEVICE_DATA(&rt73usb_ops) }, | 2029 | { USB_DEVICE(0x050d, 0x7050), USB_DEVICE_DATA(&rt73usb_ops) }, |
| 2030 | { USB_DEVICE(0x050d, 0x705a), USB_DEVICE_DATA(&rt73usb_ops) }, | 2030 | { USB_DEVICE(0x050d, 0x705a), USB_DEVICE_DATA(&rt73usb_ops) }, |
| 2031 | { USB_DEVICE(0x050d, 0x905b), USB_DEVICE_DATA(&rt73usb_ops) }, | 2031 | { USB_DEVICE(0x050d, 0x905b), USB_DEVICE_DATA(&rt73usb_ops) }, |
| 2032 | { USB_DEVICE(0x050d, 0x905c), USB_DEVICE_DATA(&rt73usb_ops) }, | ||
| 2032 | /* Billionton */ | 2033 | /* Billionton */ |
| 2033 | { USB_DEVICE(0x1631, 0xc019), USB_DEVICE_DATA(&rt73usb_ops) }, | 2034 | { USB_DEVICE(0x1631, 0xc019), USB_DEVICE_DATA(&rt73usb_ops) }, |
| 2034 | /* Buffalo */ | 2035 | /* Buffalo */ |
diff --git a/drivers/net/wireless/rtl8187_dev.c b/drivers/net/wireless/rtl8187_dev.c index 0ef887dd2867..de61c8fe6492 100644 --- a/drivers/net/wireless/rtl8187_dev.c +++ b/drivers/net/wireless/rtl8187_dev.c | |||
| @@ -131,7 +131,8 @@ static int rtl8187_tx(struct ieee80211_hw *dev, struct sk_buff *skb, | |||
| 131 | struct rtl8187_tx_hdr *hdr; | 131 | struct rtl8187_tx_hdr *hdr; |
| 132 | struct rtl8187_tx_info *info; | 132 | struct rtl8187_tx_info *info; |
| 133 | struct urb *urb; | 133 | struct urb *urb; |
| 134 | u32 tmp; | 134 | __le16 rts_dur = 0; |
| 135 | u32 flags; | ||
| 135 | 136 | ||
| 136 | urb = usb_alloc_urb(0, GFP_ATOMIC); | 137 | urb = usb_alloc_urb(0, GFP_ATOMIC); |
| 137 | if (!urb) { | 138 | if (!urb) { |
| @@ -139,24 +140,24 @@ static int rtl8187_tx(struct ieee80211_hw *dev, struct sk_buff *skb, | |||
| 139 | return 0; | 140 | return 0; |
| 140 | } | 141 | } |
| 141 | 142 | ||
| 142 | hdr = (struct rtl8187_tx_hdr *)skb_push(skb, sizeof(*hdr)); | 143 | flags = skb->len; |
| 143 | tmp = skb->len - sizeof(*hdr); | 144 | flags |= RTL8187_TX_FLAG_NO_ENCRYPT; |
| 144 | tmp |= RTL8187_TX_FLAG_NO_ENCRYPT; | 145 | flags |= control->rts_cts_rate << 19; |
| 145 | tmp |= control->rts_cts_rate << 19; | 146 | flags |= control->tx_rate << 24; |
| 146 | tmp |= control->tx_rate << 24; | 147 | if (ieee80211_get_morefrag((struct ieee80211_hdr *)skb->data)) |
| 147 | if (ieee80211_get_morefrag((struct ieee80211_hdr *)skb)) | 148 | flags |= RTL8187_TX_FLAG_MORE_FRAG; |
| 148 | tmp |= RTL8187_TX_FLAG_MORE_FRAG; | ||
| 149 | if (control->flags & IEEE80211_TXCTL_USE_RTS_CTS) { | 149 | if (control->flags & IEEE80211_TXCTL_USE_RTS_CTS) { |
| 150 | tmp |= RTL8187_TX_FLAG_RTS; | 150 | flags |= RTL8187_TX_FLAG_RTS; |
| 151 | hdr->rts_duration = | 151 | rts_dur = ieee80211_rts_duration(dev, priv->if_id, skb->len, control); |
| 152 | ieee80211_rts_duration(dev, priv->if_id, skb->len, control); | ||
| 153 | } | 152 | } |
| 154 | if (control->flags & IEEE80211_TXCTL_USE_CTS_PROTECT) | 153 | if (control->flags & IEEE80211_TXCTL_USE_CTS_PROTECT) |
| 155 | tmp |= RTL8187_TX_FLAG_CTS; | 154 | flags |= RTL8187_TX_FLAG_CTS; |
| 156 | hdr->flags = cpu_to_le32(tmp); | 155 | |
| 156 | hdr = (struct rtl8187_tx_hdr *)skb_push(skb, sizeof(*hdr)); | ||
| 157 | hdr->flags = cpu_to_le32(flags); | ||
| 157 | hdr->len = 0; | 158 | hdr->len = 0; |
| 158 | tmp = control->retry_limit << 8; | 159 | hdr->rts_duration = rts_dur; |
| 159 | hdr->retry = cpu_to_le32(tmp); | 160 | hdr->retry = cpu_to_le32(control->retry_limit << 8); |
| 160 | 161 | ||
| 161 | info = (struct rtl8187_tx_info *)skb->cb; | 162 | info = (struct rtl8187_tx_info *)skb->cb; |
| 162 | info->control = kmemdup(control, sizeof(*control), GFP_ATOMIC); | 163 | info->control = kmemdup(control, sizeof(*control), GFP_ATOMIC); |
| @@ -587,8 +588,6 @@ static void rtl8187_configure_filter(struct ieee80211_hw *dev, | |||
| 587 | 588 | ||
| 588 | *total_flags = 0; | 589 | *total_flags = 0; |
| 589 | 590 | ||
| 590 | if (changed_flags & FIF_PROMISC_IN_BSS) | ||
| 591 | priv->rx_conf ^= RTL818X_RX_CONF_NICMAC; | ||
| 592 | if (changed_flags & FIF_ALLMULTI) | 591 | if (changed_flags & FIF_ALLMULTI) |
| 593 | priv->rx_conf ^= RTL818X_RX_CONF_MULTICAST; | 592 | priv->rx_conf ^= RTL818X_RX_CONF_MULTICAST; |
| 594 | if (changed_flags & FIF_FCSFAIL) | 593 | if (changed_flags & FIF_FCSFAIL) |
| @@ -601,8 +600,6 @@ static void rtl8187_configure_filter(struct ieee80211_hw *dev, | |||
| 601 | if (mc_count > 0) | 600 | if (mc_count > 0) |
| 602 | priv->rx_conf |= RTL818X_RX_CONF_MULTICAST; | 601 | priv->rx_conf |= RTL818X_RX_CONF_MULTICAST; |
| 603 | 602 | ||
| 604 | if (priv->rx_conf & RTL818X_RX_CONF_NICMAC) | ||
| 605 | *total_flags |= FIF_PROMISC_IN_BSS; | ||
| 606 | if (priv->rx_conf & RTL818X_RX_CONF_MULTICAST) | 603 | if (priv->rx_conf & RTL818X_RX_CONF_MULTICAST) |
| 607 | *total_flags |= FIF_ALLMULTI; | 604 | *total_flags |= FIF_ALLMULTI; |
| 608 | if (priv->rx_conf & RTL818X_RX_CONF_FCS) | 605 | if (priv->rx_conf & RTL818X_RX_CONF_FCS) |
diff --git a/drivers/net/wireless/zd1201.c b/drivers/net/wireless/zd1201.c index 935b144d9b56..d5c0c66188ca 100644 --- a/drivers/net/wireless/zd1201.c +++ b/drivers/net/wireless/zd1201.c | |||
| @@ -327,8 +327,8 @@ static void zd1201_usbrx(struct urb *urb) | |||
| 327 | memcpy(skb_put(skb, 6), &data[datalen-8], 6); | 327 | memcpy(skb_put(skb, 6), &data[datalen-8], 6); |
| 328 | memcpy(skb_put(skb, 2), &data[datalen-24], 2); | 328 | memcpy(skb_put(skb, 2), &data[datalen-24], 2); |
| 329 | memcpy(skb_put(skb, len), data, len); | 329 | memcpy(skb_put(skb, len), data, len); |
| 330 | skb->dev->last_rx = jiffies; | ||
| 331 | skb->protocol = eth_type_trans(skb, zd->dev); | 330 | skb->protocol = eth_type_trans(skb, zd->dev); |
| 331 | skb->dev->last_rx = jiffies; | ||
| 332 | zd->stats.rx_packets++; | 332 | zd->stats.rx_packets++; |
| 333 | zd->stats.rx_bytes += skb->len; | 333 | zd->stats.rx_bytes += skb->len; |
| 334 | netif_rx(skb); | 334 | netif_rx(skb); |
| @@ -384,8 +384,8 @@ static void zd1201_usbrx(struct urb *urb) | |||
| 384 | memcpy(skb_put(skb, 2), &data[6], 2); | 384 | memcpy(skb_put(skb, 2), &data[6], 2); |
| 385 | memcpy(skb_put(skb, len), data+8, len); | 385 | memcpy(skb_put(skb, len), data+8, len); |
| 386 | } | 386 | } |
| 387 | skb->dev->last_rx = jiffies; | ||
| 388 | skb->protocol = eth_type_trans(skb, zd->dev); | 387 | skb->protocol = eth_type_trans(skb, zd->dev); |
| 388 | skb->dev->last_rx = jiffies; | ||
| 389 | zd->stats.rx_packets++; | 389 | zd->stats.rx_packets++; |
| 390 | zd->stats.rx_bytes += skb->len; | 390 | zd->stats.rx_bytes += skb->len; |
| 391 | netif_rx(skb); | 391 | netif_rx(skb); |
diff --git a/drivers/net/wireless/zd1211rw/zd_usb.c b/drivers/net/wireless/zd1211rw/zd_usb.c index b0684f965761..c755b6923812 100644 --- a/drivers/net/wireless/zd1211rw/zd_usb.c +++ b/drivers/net/wireless/zd1211rw/zd_usb.c | |||
| @@ -1044,14 +1044,17 @@ error: | |||
| 1044 | static void disconnect(struct usb_interface *intf) | 1044 | static void disconnect(struct usb_interface *intf) |
| 1045 | { | 1045 | { |
| 1046 | struct net_device *netdev = zd_intf_to_netdev(intf); | 1046 | struct net_device *netdev = zd_intf_to_netdev(intf); |
| 1047 | struct zd_mac *mac = zd_netdev_mac(netdev); | 1047 | struct zd_mac *mac; |
| 1048 | struct zd_usb *usb = &mac->chip.usb; | 1048 | struct zd_usb *usb; |
| 1049 | 1049 | ||
| 1050 | /* Either something really bad happened, or we're just dealing with | 1050 | /* Either something really bad happened, or we're just dealing with |
| 1051 | * a DEVICE_INSTALLER. */ | 1051 | * a DEVICE_INSTALLER. */ |
| 1052 | if (netdev == NULL) | 1052 | if (netdev == NULL) |
| 1053 | return; | 1053 | return; |
| 1054 | 1054 | ||
| 1055 | mac = zd_netdev_mac(netdev); | ||
| 1056 | usb = &mac->chip.usb; | ||
| 1057 | |||
| 1055 | dev_dbg_f(zd_usb_dev(usb), "\n"); | 1058 | dev_dbg_f(zd_usb_dev(usb), "\n"); |
| 1056 | 1059 | ||
| 1057 | zd_netdev_disconnect(netdev); | 1060 | zd_netdev_disconnect(netdev); |
diff --git a/drivers/s390/net/qeth_main.c b/drivers/s390/net/qeth_main.c index a2d08c9ba3c4..ff999ff0b627 100644 --- a/drivers/s390/net/qeth_main.c +++ b/drivers/s390/net/qeth_main.c | |||
| @@ -6643,7 +6643,8 @@ qeth_netdev_init(struct net_device *dev) | |||
| 6643 | dev->vlan_rx_kill_vid = qeth_vlan_rx_kill_vid; | 6643 | dev->vlan_rx_kill_vid = qeth_vlan_rx_kill_vid; |
| 6644 | dev->vlan_rx_add_vid = qeth_vlan_rx_add_vid; | 6644 | dev->vlan_rx_add_vid = qeth_vlan_rx_add_vid; |
| 6645 | #endif | 6645 | #endif |
| 6646 | dev->header_ops = &qeth_null_ops; | 6646 | if (qeth_get_netdev_flags(card) & IFF_NOARP) |
| 6647 | dev->header_ops = &qeth_null_ops; | ||
| 6647 | 6648 | ||
| 6648 | #ifdef CONFIG_QETH_IPV6 | 6649 | #ifdef CONFIG_QETH_IPV6 |
| 6649 | /*IPv6 address autoconfiguration stuff*/ | 6650 | /*IPv6 address autoconfiguration stuff*/ |
diff --git a/drivers/video/geode/video_gx.c b/drivers/video/geode/video_gx.c index 7f3f18d06718..febf09c63492 100644 --- a/drivers/video/geode/video_gx.c +++ b/drivers/video/geode/video_gx.c | |||
| @@ -127,7 +127,7 @@ static void gx_set_dclk_frequency(struct fb_info *info) | |||
| 127 | int timeout = 1000; | 127 | int timeout = 1000; |
| 128 | 128 | ||
| 129 | /* Rev. 1 Geode GXs use a 14 MHz reference clock instead of 48 MHz. */ | 129 | /* Rev. 1 Geode GXs use a 14 MHz reference clock instead of 48 MHz. */ |
| 130 | if (cpu_data->x86_mask == 1) { | 130 | if (cpu_data(0).x86_mask == 1) { |
| 131 | pll_table = gx_pll_table_14MHz; | 131 | pll_table = gx_pll_table_14MHz; |
| 132 | pll_table_len = ARRAY_SIZE(gx_pll_table_14MHz); | 132 | pll_table_len = ARRAY_SIZE(gx_pll_table_14MHz); |
| 133 | } else { | 133 | } else { |
diff --git a/fs/nfs/delegation.c b/fs/nfs/delegation.c index af8b235d405d..11833f4caeaa 100644 --- a/fs/nfs/delegation.c +++ b/fs/nfs/delegation.c | |||
| @@ -168,7 +168,8 @@ int nfs_inode_set_delegation(struct inode *inode, struct rpc_cred *cred, struct | |||
| 168 | spin_unlock(&inode->i_lock); | 168 | spin_unlock(&inode->i_lock); |
| 169 | 169 | ||
| 170 | spin_unlock(&clp->cl_lock); | 170 | spin_unlock(&clp->cl_lock); |
| 171 | kfree(delegation); | 171 | if (delegation != NULL) |
| 172 | nfs_free_delegation(delegation); | ||
| 172 | return status; | 173 | return status; |
| 173 | } | 174 | } |
| 174 | 175 | ||
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index 8ec7fbd8240c..35334539d947 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c | |||
| @@ -562,6 +562,7 @@ static int nfs_readdir(struct file *filp, void *dirent, filldir_t filldir) | |||
| 562 | nfs_fattr_init(&fattr); | 562 | nfs_fattr_init(&fattr); |
| 563 | desc->entry = &my_entry; | 563 | desc->entry = &my_entry; |
| 564 | 564 | ||
| 565 | nfs_block_sillyrename(dentry); | ||
| 565 | while(!desc->entry->eof) { | 566 | while(!desc->entry->eof) { |
| 566 | res = readdir_search_pagecache(desc); | 567 | res = readdir_search_pagecache(desc); |
| 567 | 568 | ||
| @@ -592,6 +593,7 @@ static int nfs_readdir(struct file *filp, void *dirent, filldir_t filldir) | |||
| 592 | break; | 593 | break; |
| 593 | } | 594 | } |
| 594 | } | 595 | } |
| 596 | nfs_unblock_sillyrename(dentry); | ||
| 595 | unlock_kernel(); | 597 | unlock_kernel(); |
| 596 | if (res > 0) | 598 | if (res > 0) |
| 597 | res = 0; | 599 | res = 0; |
| @@ -866,6 +868,7 @@ struct dentry_operations nfs_dentry_operations = { | |||
| 866 | static struct dentry *nfs_lookup(struct inode *dir, struct dentry * dentry, struct nameidata *nd) | 868 | static struct dentry *nfs_lookup(struct inode *dir, struct dentry * dentry, struct nameidata *nd) |
| 867 | { | 869 | { |
| 868 | struct dentry *res; | 870 | struct dentry *res; |
| 871 | struct dentry *parent; | ||
| 869 | struct inode *inode = NULL; | 872 | struct inode *inode = NULL; |
| 870 | int error; | 873 | int error; |
| 871 | struct nfs_fh fhandle; | 874 | struct nfs_fh fhandle; |
| @@ -894,26 +897,31 @@ static struct dentry *nfs_lookup(struct inode *dir, struct dentry * dentry, stru | |||
| 894 | goto out_unlock; | 897 | goto out_unlock; |
| 895 | } | 898 | } |
| 896 | 899 | ||
| 900 | parent = dentry->d_parent; | ||
| 901 | /* Protect against concurrent sillydeletes */ | ||
| 902 | nfs_block_sillyrename(parent); | ||
| 897 | error = NFS_PROTO(dir)->lookup(dir, &dentry->d_name, &fhandle, &fattr); | 903 | error = NFS_PROTO(dir)->lookup(dir, &dentry->d_name, &fhandle, &fattr); |
| 898 | if (error == -ENOENT) | 904 | if (error == -ENOENT) |
| 899 | goto no_entry; | 905 | goto no_entry; |
| 900 | if (error < 0) { | 906 | if (error < 0) { |
| 901 | res = ERR_PTR(error); | 907 | res = ERR_PTR(error); |
| 902 | goto out_unlock; | 908 | goto out_unblock_sillyrename; |
| 903 | } | 909 | } |
| 904 | inode = nfs_fhget(dentry->d_sb, &fhandle, &fattr); | 910 | inode = nfs_fhget(dentry->d_sb, &fhandle, &fattr); |
| 905 | res = (struct dentry *)inode; | 911 | res = (struct dentry *)inode; |
| 906 | if (IS_ERR(res)) | 912 | if (IS_ERR(res)) |
| 907 | goto out_unlock; | 913 | goto out_unblock_sillyrename; |
| 908 | 914 | ||
| 909 | no_entry: | 915 | no_entry: |
| 910 | res = d_materialise_unique(dentry, inode); | 916 | res = d_materialise_unique(dentry, inode); |
| 911 | if (res != NULL) { | 917 | if (res != NULL) { |
| 912 | if (IS_ERR(res)) | 918 | if (IS_ERR(res)) |
| 913 | goto out_unlock; | 919 | goto out_unblock_sillyrename; |
| 914 | dentry = res; | 920 | dentry = res; |
| 915 | } | 921 | } |
| 916 | nfs_set_verifier(dentry, nfs_save_change_attribute(dir)); | 922 | nfs_set_verifier(dentry, nfs_save_change_attribute(dir)); |
| 923 | out_unblock_sillyrename: | ||
| 924 | nfs_unblock_sillyrename(parent); | ||
| 917 | out_unlock: | 925 | out_unlock: |
| 918 | unlock_kernel(); | 926 | unlock_kernel(); |
| 919 | out: | 927 | out: |
diff --git a/fs/nfs/file.c b/fs/nfs/file.c index d29f90d00aa2..b3bb89f7d5d2 100644 --- a/fs/nfs/file.c +++ b/fs/nfs/file.c | |||
| @@ -131,7 +131,7 @@ nfs_file_release(struct inode *inode, struct file *filp) | |||
| 131 | { | 131 | { |
| 132 | /* Ensure that dirty pages are flushed out with the right creds */ | 132 | /* Ensure that dirty pages are flushed out with the right creds */ |
| 133 | if (filp->f_mode & FMODE_WRITE) | 133 | if (filp->f_mode & FMODE_WRITE) |
| 134 | filemap_fdatawrite(filp->f_mapping); | 134 | nfs_wb_all(filp->f_path.dentry->d_inode); |
| 135 | nfs_inc_stats(inode, NFSIOS_VFSRELEASE); | 135 | nfs_inc_stats(inode, NFSIOS_VFSRELEASE); |
| 136 | return NFS_PROTO(inode)->file_release(inode, filp); | 136 | return NFS_PROTO(inode)->file_release(inode, filp); |
| 137 | } | 137 | } |
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index 6d2f2a3eccf8..db5d96dc6107 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c | |||
| @@ -514,7 +514,7 @@ struct nfs_open_context *get_nfs_open_context(struct nfs_open_context *ctx) | |||
| 514 | return ctx; | 514 | return ctx; |
| 515 | } | 515 | } |
| 516 | 516 | ||
| 517 | void put_nfs_open_context(struct nfs_open_context *ctx) | 517 | static void __put_nfs_open_context(struct nfs_open_context *ctx, int wait) |
| 518 | { | 518 | { |
| 519 | struct inode *inode = ctx->path.dentry->d_inode; | 519 | struct inode *inode = ctx->path.dentry->d_inode; |
| 520 | 520 | ||
| @@ -522,8 +522,12 @@ void put_nfs_open_context(struct nfs_open_context *ctx) | |||
| 522 | return; | 522 | return; |
| 523 | list_del(&ctx->list); | 523 | list_del(&ctx->list); |
| 524 | spin_unlock(&inode->i_lock); | 524 | spin_unlock(&inode->i_lock); |
| 525 | if (ctx->state != NULL) | 525 | if (ctx->state != NULL) { |
| 526 | nfs4_close_state(&ctx->path, ctx->state, ctx->mode); | 526 | if (wait) |
| 527 | nfs4_close_sync(&ctx->path, ctx->state, ctx->mode); | ||
| 528 | else | ||
| 529 | nfs4_close_state(&ctx->path, ctx->state, ctx->mode); | ||
| 530 | } | ||
| 527 | if (ctx->cred != NULL) | 531 | if (ctx->cred != NULL) |
| 528 | put_rpccred(ctx->cred); | 532 | put_rpccred(ctx->cred); |
| 529 | dput(ctx->path.dentry); | 533 | dput(ctx->path.dentry); |
| @@ -531,6 +535,16 @@ void put_nfs_open_context(struct nfs_open_context *ctx) | |||
| 531 | kfree(ctx); | 535 | kfree(ctx); |
| 532 | } | 536 | } |
| 533 | 537 | ||
| 538 | void put_nfs_open_context(struct nfs_open_context *ctx) | ||
| 539 | { | ||
| 540 | __put_nfs_open_context(ctx, 0); | ||
| 541 | } | ||
| 542 | |||
| 543 | static void put_nfs_open_context_sync(struct nfs_open_context *ctx) | ||
| 544 | { | ||
| 545 | __put_nfs_open_context(ctx, 1); | ||
| 546 | } | ||
| 547 | |||
| 534 | /* | 548 | /* |
| 535 | * Ensure that mmap has a recent RPC credential for use when writing out | 549 | * Ensure that mmap has a recent RPC credential for use when writing out |
| 536 | * shared pages | 550 | * shared pages |
| @@ -577,7 +591,7 @@ static void nfs_file_clear_open_context(struct file *filp) | |||
| 577 | spin_lock(&inode->i_lock); | 591 | spin_lock(&inode->i_lock); |
| 578 | list_move_tail(&ctx->list, &NFS_I(inode)->open_files); | 592 | list_move_tail(&ctx->list, &NFS_I(inode)->open_files); |
| 579 | spin_unlock(&inode->i_lock); | 593 | spin_unlock(&inode->i_lock); |
| 580 | put_nfs_open_context(ctx); | 594 | put_nfs_open_context_sync(ctx); |
| 581 | } | 595 | } |
| 582 | } | 596 | } |
| 583 | 597 | ||
| @@ -1169,6 +1183,9 @@ static void init_once(struct kmem_cache * cachep, void *foo) | |||
| 1169 | INIT_RADIX_TREE(&nfsi->nfs_page_tree, GFP_ATOMIC); | 1183 | INIT_RADIX_TREE(&nfsi->nfs_page_tree, GFP_ATOMIC); |
| 1170 | nfsi->ncommit = 0; | 1184 | nfsi->ncommit = 0; |
| 1171 | nfsi->npages = 0; | 1185 | nfsi->npages = 0; |
| 1186 | atomic_set(&nfsi->silly_count, 1); | ||
| 1187 | INIT_HLIST_HEAD(&nfsi->silly_list); | ||
| 1188 | init_waitqueue_head(&nfsi->waitqueue); | ||
| 1172 | nfs4_init_once(nfsi); | 1189 | nfs4_init_once(nfsi); |
| 1173 | } | 1190 | } |
| 1174 | 1191 | ||
diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h index d2802b1ca3b9..b35069a2aa9e 100644 --- a/fs/nfs/nfs4_fs.h +++ b/fs/nfs/nfs4_fs.h | |||
| @@ -178,7 +178,7 @@ extern int nfs4_proc_setclientid(struct nfs_client *, u32, unsigned short, struc | |||
| 178 | extern int nfs4_proc_setclientid_confirm(struct nfs_client *, struct rpc_cred *); | 178 | extern int nfs4_proc_setclientid_confirm(struct nfs_client *, struct rpc_cred *); |
| 179 | extern int nfs4_proc_async_renew(struct nfs_client *, struct rpc_cred *); | 179 | extern int nfs4_proc_async_renew(struct nfs_client *, struct rpc_cred *); |
| 180 | extern int nfs4_proc_renew(struct nfs_client *, struct rpc_cred *); | 180 | extern int nfs4_proc_renew(struct nfs_client *, struct rpc_cred *); |
| 181 | extern int nfs4_do_close(struct path *path, struct nfs4_state *state); | 181 | extern int nfs4_do_close(struct path *path, struct nfs4_state *state, int wait); |
| 182 | extern struct dentry *nfs4_atomic_open(struct inode *, struct dentry *, struct nameidata *); | 182 | extern struct dentry *nfs4_atomic_open(struct inode *, struct dentry *, struct nameidata *); |
| 183 | extern int nfs4_open_revalidate(struct inode *, struct dentry *, int, struct nameidata *); | 183 | extern int nfs4_open_revalidate(struct inode *, struct dentry *, int, struct nameidata *); |
| 184 | extern int nfs4_server_capabilities(struct nfs_server *server, struct nfs_fh *fhandle); | 184 | extern int nfs4_server_capabilities(struct nfs_server *server, struct nfs_fh *fhandle); |
| @@ -209,6 +209,7 @@ extern void nfs4_drop_state_owner(struct nfs4_state_owner *); | |||
| 209 | extern struct nfs4_state * nfs4_get_open_state(struct inode *, struct nfs4_state_owner *); | 209 | extern struct nfs4_state * nfs4_get_open_state(struct inode *, struct nfs4_state_owner *); |
| 210 | extern void nfs4_put_open_state(struct nfs4_state *); | 210 | extern void nfs4_put_open_state(struct nfs4_state *); |
| 211 | extern void nfs4_close_state(struct path *, struct nfs4_state *, mode_t); | 211 | extern void nfs4_close_state(struct path *, struct nfs4_state *, mode_t); |
| 212 | extern void nfs4_close_sync(struct path *, struct nfs4_state *, mode_t); | ||
| 212 | extern void nfs4_state_set_mode_locked(struct nfs4_state *, mode_t); | 213 | extern void nfs4_state_set_mode_locked(struct nfs4_state *, mode_t); |
| 213 | extern void nfs4_schedule_state_recovery(struct nfs_client *); | 214 | extern void nfs4_schedule_state_recovery(struct nfs_client *); |
| 214 | extern void nfs4_put_lock_state(struct nfs4_lock_state *lsp); | 215 | extern void nfs4_put_lock_state(struct nfs4_lock_state *lsp); |
| @@ -235,6 +236,7 @@ extern struct svc_version nfs4_callback_version1; | |||
| 235 | #else | 236 | #else |
| 236 | 237 | ||
| 237 | #define nfs4_close_state(a, b, c) do { } while (0) | 238 | #define nfs4_close_state(a, b, c) do { } while (0) |
| 239 | #define nfs4_close_sync(a, b, c) do { } while (0) | ||
| 238 | 240 | ||
| 239 | #endif /* CONFIG_NFS_V4 */ | 241 | #endif /* CONFIG_NFS_V4 */ |
| 240 | #endif /* __LINUX_FS_NFS_NFS4_FS.H */ | 242 | #endif /* __LINUX_FS_NFS_NFS4_FS.H */ |
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index cb99fd90a9ac..f03d9d5f5ba4 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
| @@ -1305,7 +1305,7 @@ static const struct rpc_call_ops nfs4_close_ops = { | |||
| 1305 | * | 1305 | * |
| 1306 | * NOTE: Caller must be holding the sp->so_owner semaphore! | 1306 | * NOTE: Caller must be holding the sp->so_owner semaphore! |
| 1307 | */ | 1307 | */ |
| 1308 | int nfs4_do_close(struct path *path, struct nfs4_state *state) | 1308 | int nfs4_do_close(struct path *path, struct nfs4_state *state, int wait) |
| 1309 | { | 1309 | { |
| 1310 | struct nfs_server *server = NFS_SERVER(state->inode); | 1310 | struct nfs_server *server = NFS_SERVER(state->inode); |
| 1311 | struct nfs4_closedata *calldata; | 1311 | struct nfs4_closedata *calldata; |
| @@ -1333,8 +1333,11 @@ int nfs4_do_close(struct path *path, struct nfs4_state *state) | |||
| 1333 | task = rpc_run_task(server->client, RPC_TASK_ASYNC, &nfs4_close_ops, calldata); | 1333 | task = rpc_run_task(server->client, RPC_TASK_ASYNC, &nfs4_close_ops, calldata); |
| 1334 | if (IS_ERR(task)) | 1334 | if (IS_ERR(task)) |
| 1335 | return PTR_ERR(task); | 1335 | return PTR_ERR(task); |
| 1336 | status = 0; | ||
| 1337 | if (wait) | ||
| 1338 | status = rpc_wait_for_completion_task(task); | ||
| 1336 | rpc_put_task(task); | 1339 | rpc_put_task(task); |
| 1337 | return 0; | 1340 | return status; |
| 1338 | out_free_calldata: | 1341 | out_free_calldata: |
| 1339 | kfree(calldata); | 1342 | kfree(calldata); |
| 1340 | out: | 1343 | out: |
| @@ -1365,13 +1368,14 @@ static int nfs4_intent_set_file(struct nameidata *nd, struct path *path, struct | |||
| 1365 | } | 1368 | } |
| 1366 | ret = PTR_ERR(filp); | 1369 | ret = PTR_ERR(filp); |
| 1367 | out_close: | 1370 | out_close: |
| 1368 | nfs4_close_state(path, state, nd->intent.open.flags); | 1371 | nfs4_close_sync(path, state, nd->intent.open.flags); |
| 1369 | return ret; | 1372 | return ret; |
| 1370 | } | 1373 | } |
| 1371 | 1374 | ||
| 1372 | struct dentry * | 1375 | struct dentry * |
| 1373 | nfs4_atomic_open(struct inode *dir, struct dentry *dentry, struct nameidata *nd) | 1376 | nfs4_atomic_open(struct inode *dir, struct dentry *dentry, struct nameidata *nd) |
| 1374 | { | 1377 | { |
| 1378 | struct dentry *parent; | ||
| 1375 | struct path path = { | 1379 | struct path path = { |
| 1376 | .mnt = nd->mnt, | 1380 | .mnt = nd->mnt, |
| 1377 | .dentry = dentry, | 1381 | .dentry = dentry, |
| @@ -1394,6 +1398,9 @@ nfs4_atomic_open(struct inode *dir, struct dentry *dentry, struct nameidata *nd) | |||
| 1394 | cred = rpcauth_lookupcred(NFS_CLIENT(dir)->cl_auth, 0); | 1398 | cred = rpcauth_lookupcred(NFS_CLIENT(dir)->cl_auth, 0); |
| 1395 | if (IS_ERR(cred)) | 1399 | if (IS_ERR(cred)) |
| 1396 | return (struct dentry *)cred; | 1400 | return (struct dentry *)cred; |
| 1401 | parent = dentry->d_parent; | ||
| 1402 | /* Protect against concurrent sillydeletes */ | ||
| 1403 | nfs_block_sillyrename(parent); | ||
| 1397 | state = nfs4_do_open(dir, &path, nd->intent.open.flags, &attr, cred); | 1404 | state = nfs4_do_open(dir, &path, nd->intent.open.flags, &attr, cred); |
| 1398 | put_rpccred(cred); | 1405 | put_rpccred(cred); |
| 1399 | if (IS_ERR(state)) { | 1406 | if (IS_ERR(state)) { |
| @@ -1401,12 +1408,14 @@ nfs4_atomic_open(struct inode *dir, struct dentry *dentry, struct nameidata *nd) | |||
| 1401 | d_add(dentry, NULL); | 1408 | d_add(dentry, NULL); |
| 1402 | nfs_set_verifier(dentry, nfs_save_change_attribute(dir)); | 1409 | nfs_set_verifier(dentry, nfs_save_change_attribute(dir)); |
| 1403 | } | 1410 | } |
| 1411 | nfs_unblock_sillyrename(parent); | ||
| 1404 | return (struct dentry *)state; | 1412 | return (struct dentry *)state; |
| 1405 | } | 1413 | } |
| 1406 | res = d_add_unique(dentry, igrab(state->inode)); | 1414 | res = d_add_unique(dentry, igrab(state->inode)); |
| 1407 | if (res != NULL) | 1415 | if (res != NULL) |
| 1408 | path.dentry = res; | 1416 | path.dentry = res; |
| 1409 | nfs_set_verifier(path.dentry, nfs_save_change_attribute(dir)); | 1417 | nfs_set_verifier(path.dentry, nfs_save_change_attribute(dir)); |
| 1418 | nfs_unblock_sillyrename(parent); | ||
| 1410 | nfs4_intent_set_file(nd, &path, state); | 1419 | nfs4_intent_set_file(nd, &path, state); |
| 1411 | return res; | 1420 | return res; |
| 1412 | } | 1421 | } |
| @@ -1444,7 +1453,7 @@ nfs4_open_revalidate(struct inode *dir, struct dentry *dentry, int openflags, st | |||
| 1444 | nfs4_intent_set_file(nd, &path, state); | 1453 | nfs4_intent_set_file(nd, &path, state); |
| 1445 | return 1; | 1454 | return 1; |
| 1446 | } | 1455 | } |
| 1447 | nfs4_close_state(&path, state, openflags); | 1456 | nfs4_close_sync(&path, state, openflags); |
| 1448 | out_drop: | 1457 | out_drop: |
| 1449 | d_drop(dentry); | 1458 | d_drop(dentry); |
| 1450 | return 0; | 1459 | return 0; |
| @@ -1898,7 +1907,7 @@ nfs4_proc_create(struct inode *dir, struct dentry *dentry, struct iattr *sattr, | |||
| 1898 | if (status == 0 && (nd->flags & LOOKUP_OPEN) != 0) | 1907 | if (status == 0 && (nd->flags & LOOKUP_OPEN) != 0) |
| 1899 | status = nfs4_intent_set_file(nd, &path, state); | 1908 | status = nfs4_intent_set_file(nd, &path, state); |
| 1900 | else | 1909 | else |
| 1901 | nfs4_close_state(&path, state, flags); | 1910 | nfs4_close_sync(&path, state, flags); |
| 1902 | out: | 1911 | out: |
| 1903 | return status; | 1912 | return status; |
| 1904 | } | 1913 | } |
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c index bfb36261cecb..23a9a36556bf 100644 --- a/fs/nfs/nfs4state.c +++ b/fs/nfs/nfs4state.c | |||
| @@ -425,7 +425,7 @@ void nfs4_put_open_state(struct nfs4_state *state) | |||
| 425 | /* | 425 | /* |
| 426 | * Close the current file. | 426 | * Close the current file. |
| 427 | */ | 427 | */ |
| 428 | void nfs4_close_state(struct path *path, struct nfs4_state *state, mode_t mode) | 428 | static void __nfs4_close(struct path *path, struct nfs4_state *state, mode_t mode, int wait) |
| 429 | { | 429 | { |
| 430 | struct nfs4_state_owner *owner = state->owner; | 430 | struct nfs4_state_owner *owner = state->owner; |
| 431 | int call_close = 0; | 431 | int call_close = 0; |
| @@ -466,7 +466,17 @@ void nfs4_close_state(struct path *path, struct nfs4_state *state, mode_t mode) | |||
| 466 | nfs4_put_open_state(state); | 466 | nfs4_put_open_state(state); |
| 467 | nfs4_put_state_owner(owner); | 467 | nfs4_put_state_owner(owner); |
| 468 | } else | 468 | } else |
| 469 | nfs4_do_close(path, state); | 469 | nfs4_do_close(path, state, wait); |
| 470 | } | ||
| 471 | |||
| 472 | void nfs4_close_state(struct path *path, struct nfs4_state *state, mode_t mode) | ||
| 473 | { | ||
| 474 | __nfs4_close(path, state, mode, 0); | ||
| 475 | } | ||
| 476 | |||
| 477 | void nfs4_close_sync(struct path *path, struct nfs4_state *state, mode_t mode) | ||
| 478 | { | ||
| 479 | __nfs4_close(path, state, mode, 1); | ||
| 470 | } | 480 | } |
| 471 | 481 | ||
| 472 | /* | 482 | /* |
diff --git a/fs/nfs/unlink.c b/fs/nfs/unlink.c index 1aed850d18f2..ce558c2e4d53 100644 --- a/fs/nfs/unlink.c +++ b/fs/nfs/unlink.c | |||
| @@ -11,9 +11,11 @@ | |||
| 11 | #include <linux/sunrpc/sched.h> | 11 | #include <linux/sunrpc/sched.h> |
| 12 | #include <linux/sunrpc/clnt.h> | 12 | #include <linux/sunrpc/clnt.h> |
| 13 | #include <linux/nfs_fs.h> | 13 | #include <linux/nfs_fs.h> |
| 14 | 14 | #include <linux/sched.h> | |
| 15 | #include <linux/wait.h> | ||
| 15 | 16 | ||
| 16 | struct nfs_unlinkdata { | 17 | struct nfs_unlinkdata { |
| 18 | struct hlist_node list; | ||
| 17 | struct nfs_removeargs args; | 19 | struct nfs_removeargs args; |
| 18 | struct nfs_removeres res; | 20 | struct nfs_removeres res; |
| 19 | struct inode *dir; | 21 | struct inode *dir; |
| @@ -52,6 +54,20 @@ static int nfs_copy_dname(struct dentry *dentry, struct nfs_unlinkdata *data) | |||
| 52 | return 0; | 54 | return 0; |
| 53 | } | 55 | } |
| 54 | 56 | ||
| 57 | static void nfs_free_dname(struct nfs_unlinkdata *data) | ||
| 58 | { | ||
| 59 | kfree(data->args.name.name); | ||
| 60 | data->args.name.name = NULL; | ||
| 61 | data->args.name.len = 0; | ||
| 62 | } | ||
| 63 | |||
| 64 | static void nfs_dec_sillycount(struct inode *dir) | ||
| 65 | { | ||
| 66 | struct nfs_inode *nfsi = NFS_I(dir); | ||
| 67 | if (atomic_dec_return(&nfsi->silly_count) == 1) | ||
| 68 | wake_up(&nfsi->waitqueue); | ||
| 69 | } | ||
| 70 | |||
| 55 | /** | 71 | /** |
| 56 | * nfs_async_unlink_init - Initialize the RPC info | 72 | * nfs_async_unlink_init - Initialize the RPC info |
| 57 | * task: rpc_task of the sillydelete | 73 | * task: rpc_task of the sillydelete |
| @@ -95,6 +111,8 @@ static void nfs_async_unlink_done(struct rpc_task *task, void *calldata) | |||
| 95 | static void nfs_async_unlink_release(void *calldata) | 111 | static void nfs_async_unlink_release(void *calldata) |
| 96 | { | 112 | { |
| 97 | struct nfs_unlinkdata *data = calldata; | 113 | struct nfs_unlinkdata *data = calldata; |
| 114 | |||
| 115 | nfs_dec_sillycount(data->dir); | ||
| 98 | nfs_free_unlinkdata(data); | 116 | nfs_free_unlinkdata(data); |
| 99 | } | 117 | } |
| 100 | 118 | ||
| @@ -104,33 +122,100 @@ static const struct rpc_call_ops nfs_unlink_ops = { | |||
| 104 | .rpc_release = nfs_async_unlink_release, | 122 | .rpc_release = nfs_async_unlink_release, |
| 105 | }; | 123 | }; |
| 106 | 124 | ||
| 107 | static int nfs_call_unlink(struct dentry *dentry, struct nfs_unlinkdata *data) | 125 | static int nfs_do_call_unlink(struct dentry *parent, struct inode *dir, struct nfs_unlinkdata *data) |
| 108 | { | 126 | { |
| 109 | struct rpc_task *task; | 127 | struct rpc_task *task; |
| 128 | struct dentry *alias; | ||
| 129 | |||
| 130 | alias = d_lookup(parent, &data->args.name); | ||
| 131 | if (alias != NULL) { | ||
| 132 | int ret = 0; | ||
| 133 | /* | ||
| 134 | * Hey, we raced with lookup... See if we need to transfer | ||
| 135 | * the sillyrename information to the aliased dentry. | ||
| 136 | */ | ||
| 137 | nfs_free_dname(data); | ||
| 138 | spin_lock(&alias->d_lock); | ||
| 139 | if (!(alias->d_flags & DCACHE_NFSFS_RENAMED)) { | ||
| 140 | alias->d_fsdata = data; | ||
| 141 | alias->d_flags ^= DCACHE_NFSFS_RENAMED; | ||
| 142 | ret = 1; | ||
| 143 | } | ||
| 144 | spin_unlock(&alias->d_lock); | ||
| 145 | nfs_dec_sillycount(dir); | ||
| 146 | dput(alias); | ||
| 147 | return ret; | ||
| 148 | } | ||
| 149 | data->dir = igrab(dir); | ||
| 150 | if (!data->dir) { | ||
| 151 | nfs_dec_sillycount(dir); | ||
| 152 | return 0; | ||
| 153 | } | ||
| 154 | data->args.fh = NFS_FH(dir); | ||
| 155 | nfs_fattr_init(&data->res.dir_attr); | ||
| 156 | |||
| 157 | task = rpc_run_task(NFS_CLIENT(dir), RPC_TASK_ASYNC, &nfs_unlink_ops, data); | ||
| 158 | if (!IS_ERR(task)) | ||
| 159 | rpc_put_task(task); | ||
| 160 | return 1; | ||
| 161 | } | ||
| 162 | |||
| 163 | static int nfs_call_unlink(struct dentry *dentry, struct nfs_unlinkdata *data) | ||
| 164 | { | ||
| 110 | struct dentry *parent; | 165 | struct dentry *parent; |
| 111 | struct inode *dir; | 166 | struct inode *dir; |
| 167 | int ret = 0; | ||
| 112 | 168 | ||
| 113 | if (nfs_copy_dname(dentry, data) < 0) | ||
| 114 | goto out_free; | ||
| 115 | 169 | ||
| 116 | parent = dget_parent(dentry); | 170 | parent = dget_parent(dentry); |
| 117 | if (parent == NULL) | 171 | if (parent == NULL) |
| 118 | goto out_free; | 172 | goto out_free; |
| 119 | dir = igrab(parent->d_inode); | 173 | dir = parent->d_inode; |
| 174 | if (nfs_copy_dname(dentry, data) == 0) | ||
| 175 | goto out_dput; | ||
| 176 | /* Non-exclusive lock protects against concurrent lookup() calls */ | ||
| 177 | spin_lock(&dir->i_lock); | ||
| 178 | if (atomic_inc_not_zero(&NFS_I(dir)->silly_count) == 0) { | ||
| 179 | /* Deferred delete */ | ||
| 180 | hlist_add_head(&data->list, &NFS_I(dir)->silly_list); | ||
| 181 | spin_unlock(&dir->i_lock); | ||
| 182 | ret = 1; | ||
| 183 | goto out_dput; | ||
| 184 | } | ||
| 185 | spin_unlock(&dir->i_lock); | ||
| 186 | ret = nfs_do_call_unlink(parent, dir, data); | ||
| 187 | out_dput: | ||
| 120 | dput(parent); | 188 | dput(parent); |
| 121 | if (dir == NULL) | 189 | out_free: |
| 122 | goto out_free; | 190 | return ret; |
| 191 | } | ||
| 123 | 192 | ||
| 124 | data->dir = dir; | 193 | void nfs_block_sillyrename(struct dentry *dentry) |
| 125 | data->args.fh = NFS_FH(dir); | 194 | { |
| 126 | nfs_fattr_init(&data->res.dir_attr); | 195 | struct nfs_inode *nfsi = NFS_I(dentry->d_inode); |
| 127 | 196 | ||
| 128 | task = rpc_run_task(NFS_CLIENT(dir), RPC_TASK_ASYNC, &nfs_unlink_ops, data); | 197 | wait_event(nfsi->waitqueue, atomic_cmpxchg(&nfsi->silly_count, 1, 0) == 1); |
| 129 | if (!IS_ERR(task)) | 198 | } |
| 130 | rpc_put_task(task); | 199 | |
| 131 | return 1; | 200 | void nfs_unblock_sillyrename(struct dentry *dentry) |
| 132 | out_free: | 201 | { |
| 133 | return 0; | 202 | struct inode *dir = dentry->d_inode; |
| 203 | struct nfs_inode *nfsi = NFS_I(dir); | ||
| 204 | struct nfs_unlinkdata *data; | ||
| 205 | |||
| 206 | atomic_inc(&nfsi->silly_count); | ||
| 207 | spin_lock(&dir->i_lock); | ||
| 208 | while (!hlist_empty(&nfsi->silly_list)) { | ||
| 209 | if (!atomic_inc_not_zero(&nfsi->silly_count)) | ||
| 210 | break; | ||
| 211 | data = hlist_entry(nfsi->silly_list.first, struct nfs_unlinkdata, list); | ||
| 212 | hlist_del(&data->list); | ||
| 213 | spin_unlock(&dir->i_lock); | ||
| 214 | if (nfs_do_call_unlink(dentry, dir, data) == 0) | ||
| 215 | nfs_free_unlinkdata(data); | ||
| 216 | spin_lock(&dir->i_lock); | ||
| 217 | } | ||
| 218 | spin_unlock(&dir->i_lock); | ||
| 134 | } | 219 | } |
| 135 | 220 | ||
| 136 | /** | 221 | /** |
diff --git a/fs/nfs/write.c b/fs/nfs/write.c index 0cf9d1cd9bd2..89527a487ed7 100644 --- a/fs/nfs/write.c +++ b/fs/nfs/write.c | |||
| @@ -174,8 +174,6 @@ static void nfs_mark_uptodate(struct page *page, unsigned int base, unsigned int | |||
| 174 | return; | 174 | return; |
| 175 | if (count != nfs_page_length(page)) | 175 | if (count != nfs_page_length(page)) |
| 176 | return; | 176 | return; |
| 177 | if (count != PAGE_CACHE_SIZE) | ||
| 178 | zero_user_page(page, count, PAGE_CACHE_SIZE - count, KM_USER0); | ||
| 179 | SetPageUptodate(page); | 177 | SetPageUptodate(page); |
| 180 | } | 178 | } |
| 181 | 179 | ||
| @@ -627,7 +625,8 @@ static struct nfs_page * nfs_update_request(struct nfs_open_context* ctx, | |||
| 627 | return ERR_PTR(error); | 625 | return ERR_PTR(error); |
| 628 | } | 626 | } |
| 629 | spin_unlock(&inode->i_lock); | 627 | spin_unlock(&inode->i_lock); |
| 630 | return new; | 628 | req = new; |
| 629 | goto zero_page; | ||
| 631 | } | 630 | } |
| 632 | spin_unlock(&inode->i_lock); | 631 | spin_unlock(&inode->i_lock); |
| 633 | 632 | ||
| @@ -655,13 +654,23 @@ static struct nfs_page * nfs_update_request(struct nfs_open_context* ctx, | |||
| 655 | if (offset < req->wb_offset) { | 654 | if (offset < req->wb_offset) { |
| 656 | req->wb_offset = offset; | 655 | req->wb_offset = offset; |
| 657 | req->wb_pgbase = offset; | 656 | req->wb_pgbase = offset; |
| 658 | req->wb_bytes = rqend - req->wb_offset; | 657 | req->wb_bytes = max(end, rqend) - req->wb_offset; |
| 658 | goto zero_page; | ||
| 659 | } | 659 | } |
| 660 | 660 | ||
| 661 | if (end > rqend) | 661 | if (end > rqend) |
| 662 | req->wb_bytes = end - req->wb_offset; | 662 | req->wb_bytes = end - req->wb_offset; |
| 663 | 663 | ||
| 664 | return req; | 664 | return req; |
| 665 | zero_page: | ||
| 666 | /* If this page might potentially be marked as up to date, | ||
| 667 | * then we need to zero any uninitalised data. */ | ||
| 668 | if (req->wb_pgbase == 0 && req->wb_bytes != PAGE_CACHE_SIZE | ||
| 669 | && !PageUptodate(req->wb_page)) | ||
| 670 | zero_user_page(req->wb_page, req->wb_bytes, | ||
| 671 | PAGE_CACHE_SIZE - req->wb_bytes, | ||
| 672 | KM_USER0); | ||
| 673 | return req; | ||
| 665 | } | 674 | } |
| 666 | 675 | ||
| 667 | int nfs_flush_incompatible(struct file *file, struct page *page) | 676 | int nfs_flush_incompatible(struct file *file, struct page *page) |
diff --git a/include/asm-alpha/ide.h b/include/asm-alpha/ide.h index 2a5cc0b367ab..b7bf68d0407b 100644 --- a/include/asm-alpha/ide.h +++ b/include/asm-alpha/ide.h | |||
| @@ -40,7 +40,6 @@ static inline unsigned long ide_default_io_base(int index) | |||
| 40 | } | 40 | } |
| 41 | } | 41 | } |
| 42 | 42 | ||
| 43 | #define IDE_ARCH_OBSOLETE_INIT | ||
| 44 | #define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */ | 43 | #define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */ |
| 45 | 44 | ||
| 46 | #ifdef CONFIG_PCI | 45 | #ifdef CONFIG_PCI |
diff --git a/include/asm-arm/ide.h b/include/asm-arm/ide.h index 4f68c8a5a199..f348fcf3150b 100644 --- a/include/asm-arm/ide.h +++ b/include/asm-arm/ide.h | |||
| @@ -18,7 +18,6 @@ | |||
| 18 | #endif | 18 | #endif |
| 19 | 19 | ||
| 20 | #if !defined(CONFIG_ARCH_L7200) | 20 | #if !defined(CONFIG_ARCH_L7200) |
| 21 | # define IDE_ARCH_OBSOLETE_INIT | ||
| 22 | # ifdef CONFIG_ARCH_CLPS7500 | 21 | # ifdef CONFIG_ARCH_CLPS7500 |
| 23 | # define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */ | 22 | # define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */ |
| 24 | # else | 23 | # else |
diff --git a/include/asm-blackfin/ide.h b/include/asm-blackfin/ide.h index 41b2db46a168..121e272581d6 100644 --- a/include/asm-blackfin/ide.h +++ b/include/asm-blackfin/ide.h | |||
| @@ -20,7 +20,6 @@ | |||
| 20 | #define MAX_HWIFS 1 | 20 | #define MAX_HWIFS 1 |
| 21 | 21 | ||
| 22 | /* Legacy ... BLK_DEV_IDECS */ | 22 | /* Legacy ... BLK_DEV_IDECS */ |
| 23 | #define IDE_ARCH_OBSOLETE_INIT | ||
| 24 | #define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */ | 23 | #define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */ |
| 25 | 24 | ||
| 26 | 25 | ||
diff --git a/include/asm-cris/arch-v32/ide.h b/include/asm-cris/arch-v32/ide.h index 6590f657500d..11296170d057 100644 --- a/include/asm-cris/arch-v32/ide.h +++ b/include/asm-cris/arch-v32/ide.h | |||
| @@ -54,7 +54,7 @@ static inline unsigned long ide_default_io_base(int index) | |||
| 54 | #define SUPPORT_VLB_SYNC 0 | 54 | #define SUPPORT_VLB_SYNC 0 |
| 55 | 55 | ||
| 56 | #define IDE_ARCH_ACK_INTR | 56 | #define IDE_ARCH_ACK_INTR |
| 57 | #define ide_ack_intr(hwif) (hwif)->hw.ack_intr(hwif) | 57 | #define ide_ack_intr(hwif) ((hwif)->ack_intr(hwif)) |
| 58 | 58 | ||
| 59 | #endif /* __KERNEL__ */ | 59 | #endif /* __KERNEL__ */ |
| 60 | 60 | ||
diff --git a/include/asm-ia64/ide.h b/include/asm-ia64/ide.h index e928675de352..1ccf23809329 100644 --- a/include/asm-ia64/ide.h +++ b/include/asm-ia64/ide.h | |||
| @@ -46,7 +46,6 @@ static inline unsigned long ide_default_io_base(int index) | |||
| 46 | } | 46 | } |
| 47 | } | 47 | } |
| 48 | 48 | ||
| 49 | #define IDE_ARCH_OBSOLETE_INIT | ||
| 50 | #define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */ | 49 | #define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */ |
| 51 | 50 | ||
| 52 | #ifdef CONFIG_PCI | 51 | #ifdef CONFIG_PCI |
diff --git a/include/asm-m32r/ide.h b/include/asm-m32r/ide.h index 4672a49e8760..5d2044e529ab 100644 --- a/include/asm-m32r/ide.h +++ b/include/asm-m32r/ide.h | |||
| @@ -65,7 +65,6 @@ static __inline__ unsigned long ide_default_io_base(int index) | |||
| 65 | } | 65 | } |
| 66 | } | 66 | } |
| 67 | 67 | ||
| 68 | #define IDE_ARCH_OBSOLETE_INIT | ||
| 69 | #define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */ | 68 | #define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */ |
| 70 | 69 | ||
| 71 | #ifdef CONFIG_BLK_DEV_IDEPCI | 70 | #ifdef CONFIG_BLK_DEV_IDEPCI |
diff --git a/include/asm-m68k/ide.h b/include/asm-m68k/ide.h index f9ffb2cbbae8..909c6dfd3851 100644 --- a/include/asm-m68k/ide.h +++ b/include/asm-m68k/ide.h | |||
| @@ -137,7 +137,7 @@ ide_get_lock(irq_handler_t handler, void *data) | |||
| 137 | #endif /* CONFIG_BLK_DEV_FALCON_IDE */ | 137 | #endif /* CONFIG_BLK_DEV_FALCON_IDE */ |
| 138 | 138 | ||
| 139 | #define IDE_ARCH_ACK_INTR | 139 | #define IDE_ARCH_ACK_INTR |
| 140 | #define ide_ack_intr(hwif) ((hwif)->hw.ack_intr ? (hwif)->hw.ack_intr(hwif) : 1) | 140 | #define ide_ack_intr(hwif) ((hwif)->ack_intr ? (hwif)->ack_intr(hwif) : 1) |
| 141 | 141 | ||
| 142 | #endif /* __KERNEL__ */ | 142 | #endif /* __KERNEL__ */ |
| 143 | #endif /* _M68K_IDE_H */ | 143 | #endif /* _M68K_IDE_H */ |
diff --git a/include/asm-mips/mach-generic/ide.h b/include/asm-mips/mach-generic/ide.h index a77128362a7d..4ec2b930dfbb 100644 --- a/include/asm-mips/mach-generic/ide.h +++ b/include/asm-mips/mach-generic/ide.h | |||
| @@ -98,7 +98,6 @@ static __inline__ unsigned long ide_default_io_base(int index) | |||
| 98 | } | 98 | } |
| 99 | } | 99 | } |
| 100 | 100 | ||
| 101 | #define IDE_ARCH_OBSOLETE_INIT | ||
| 102 | #define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */ | 101 | #define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */ |
| 103 | 102 | ||
| 104 | #ifdef CONFIG_BLK_DEV_IDEPCI | 103 | #ifdef CONFIG_BLK_DEV_IDEPCI |
diff --git a/include/asm-parisc/ide.h b/include/asm-parisc/ide.h index b27bf7aeb256..be8760fbc8ee 100644 --- a/include/asm-parisc/ide.h +++ b/include/asm-parisc/ide.h | |||
| @@ -17,7 +17,6 @@ | |||
| 17 | #define MAX_HWIFS 2 | 17 | #define MAX_HWIFS 2 |
| 18 | #endif | 18 | #endif |
| 19 | 19 | ||
| 20 | #define IDE_ARCH_OBSOLETE_INIT | ||
| 21 | #define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */ | 20 | #define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */ |
| 22 | 21 | ||
| 23 | #define ide_request_irq(irq,hand,flg,dev,id) request_irq((irq),(hand),(flg),(dev),(id)) | 22 | #define ide_request_irq(irq,hand,flg,dev,id) request_irq((irq),(hand),(flg),(dev),(id)) |
diff --git a/include/asm-powerpc/ide.h b/include/asm-powerpc/ide.h index 1644e44c8757..fd7f5a430f0a 100644 --- a/include/asm-powerpc/ide.h +++ b/include/asm-powerpc/ide.h | |||
| @@ -69,12 +69,11 @@ static __inline__ unsigned long ide_default_io_base(int index) | |||
| 69 | 69 | ||
| 70 | #ifdef CONFIG_BLK_DEV_MPC8xx_IDE | 70 | #ifdef CONFIG_BLK_DEV_MPC8xx_IDE |
| 71 | #define IDE_ARCH_ACK_INTR 1 | 71 | #define IDE_ARCH_ACK_INTR 1 |
| 72 | #define ide_ack_intr(hwif) (hwif->hw.ack_intr ? hwif->hw.ack_intr(hwif) : 1) | 72 | #define ide_ack_intr(hwif) ((hwif)->ack_intr ? (hwif)->ack_intr(hwif) : 1) |
| 73 | #endif | 73 | #endif |
| 74 | 74 | ||
| 75 | #endif /* __powerpc64__ */ | 75 | #endif /* __powerpc64__ */ |
| 76 | 76 | ||
| 77 | #define IDE_ARCH_OBSOLETE_INIT | ||
| 78 | #define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */ | 77 | #define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */ |
| 79 | 78 | ||
| 80 | #endif /* __KERNEL__ */ | 79 | #endif /* __KERNEL__ */ |
diff --git a/include/asm-sh64/ide.h b/include/asm-sh64/ide.h index c9d84d5f772e..b6e31e8b9410 100644 --- a/include/asm-sh64/ide.h +++ b/include/asm-sh64/ide.h | |||
| @@ -19,7 +19,6 @@ | |||
| 19 | /* Without this, the initialisation of PCI IDE cards end up calling | 19 | /* Without this, the initialisation of PCI IDE cards end up calling |
| 20 | * ide_init_hwif_ports, which won't work. */ | 20 | * ide_init_hwif_ports, which won't work. */ |
| 21 | #ifdef CONFIG_BLK_DEV_IDEPCI | 21 | #ifdef CONFIG_BLK_DEV_IDEPCI |
| 22 | #define IDE_ARCH_OBSOLETE_INIT 1 | ||
| 23 | #define ide_default_io_ctl(base) (0) | 22 | #define ide_default_io_ctl(base) (0) |
| 24 | #endif | 23 | #endif |
| 25 | 24 | ||
diff --git a/include/asm-sparc/ide.h b/include/asm-sparc/ide.h index a6d735a1310e..404022765fc7 100644 --- a/include/asm-sparc/ide.h +++ b/include/asm-sparc/ide.h | |||
| @@ -18,7 +18,6 @@ | |||
| 18 | #undef MAX_HWIFS | 18 | #undef MAX_HWIFS |
| 19 | #define MAX_HWIFS 2 | 19 | #define MAX_HWIFS 2 |
| 20 | 20 | ||
| 21 | #define IDE_ARCH_OBSOLETE_INIT | ||
| 22 | #define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */ | 21 | #define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */ |
| 23 | 22 | ||
| 24 | #define __ide_insl(data_reg, buffer, wcount) \ | 23 | #define __ide_insl(data_reg, buffer, wcount) \ |
diff --git a/include/asm-sparc64/ide.h b/include/asm-sparc64/ide.h index 55149cf933c2..ac7eb210b941 100644 --- a/include/asm-sparc64/ide.h +++ b/include/asm-sparc64/ide.h | |||
| @@ -24,7 +24,6 @@ | |||
| 24 | # endif | 24 | # endif |
| 25 | #endif | 25 | #endif |
| 26 | 26 | ||
| 27 | #define IDE_ARCH_OBSOLETE_INIT | ||
| 28 | #define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */ | 27 | #define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */ |
| 29 | 28 | ||
| 30 | #define __ide_insl(data_reg, buffer, wcount) \ | 29 | #define __ide_insl(data_reg, buffer, wcount) \ |
diff --git a/include/asm-x86/acpi_32.h b/include/asm-x86/acpi_32.h index 125179adf044..723493e6c851 100644 --- a/include/asm-x86/acpi_32.h +++ b/include/asm-x86/acpi_32.h | |||
| @@ -81,11 +81,7 @@ int __acpi_release_global_lock(unsigned int *lock); | |||
| 81 | :"=r"(n_hi), "=r"(n_lo) \ | 81 | :"=r"(n_hi), "=r"(n_lo) \ |
| 82 | :"0"(n_hi), "1"(n_lo)) | 82 | :"0"(n_hi), "1"(n_lo)) |
| 83 | 83 | ||
| 84 | #ifdef CONFIG_X86_IO_APIC | 84 | extern void early_quirks(void); |
| 85 | extern void check_acpi_pci(void); | ||
| 86 | #else | ||
| 87 | static inline void check_acpi_pci(void) { } | ||
| 88 | #endif | ||
| 89 | 85 | ||
| 90 | #ifdef CONFIG_ACPI | 86 | #ifdef CONFIG_ACPI |
| 91 | extern int acpi_lapic; | 87 | extern int acpi_lapic; |
diff --git a/include/asm-x86/compat.h b/include/asm-x86/compat.h index 53cb96b68a62..66ba7987184a 100644 --- a/include/asm-x86/compat.h +++ b/include/asm-x86/compat.h | |||
| @@ -6,6 +6,7 @@ | |||
| 6 | */ | 6 | */ |
| 7 | #include <linux/types.h> | 7 | #include <linux/types.h> |
| 8 | #include <linux/sched.h> | 8 | #include <linux/sched.h> |
| 9 | #include <asm/user32.h> | ||
| 9 | 10 | ||
| 10 | #define COMPAT_USER_HZ 100 | 11 | #define COMPAT_USER_HZ 100 |
| 11 | 12 | ||
| @@ -181,6 +182,11 @@ struct compat_shmid64_ds { | |||
| 181 | }; | 182 | }; |
| 182 | 183 | ||
| 183 | /* | 184 | /* |
| 185 | * The type of struct elf_prstatus.pr_reg in compatible core dumps. | ||
| 186 | */ | ||
| 187 | typedef struct user_regs_struct32 compat_elf_gregset_t; | ||
| 188 | |||
| 189 | /* | ||
| 184 | * A pointer passed in from user mode. This should not | 190 | * A pointer passed in from user mode. This should not |
| 185 | * be used for syscall parameters, just declare them | 191 | * be used for syscall parameters, just declare them |
| 186 | * as pointers because the syscall entry code will have | 192 | * as pointers because the syscall entry code will have |
diff --git a/include/asm-x86/desc_64.h b/include/asm-x86/desc_64.h index ac991b5ca0fd..7d9c938e69fd 100644 --- a/include/asm-x86/desc_64.h +++ b/include/asm-x86/desc_64.h | |||
| @@ -20,6 +20,16 @@ extern struct desc_struct cpu_gdt_table[GDT_ENTRIES]; | |||
| 20 | #define load_LDT_desc() asm volatile("lldt %w0"::"r" (GDT_ENTRY_LDT*8)) | 20 | #define load_LDT_desc() asm volatile("lldt %w0"::"r" (GDT_ENTRY_LDT*8)) |
| 21 | #define clear_LDT() asm volatile("lldt %w0"::"r" (0)) | 21 | #define clear_LDT() asm volatile("lldt %w0"::"r" (0)) |
| 22 | 22 | ||
| 23 | static inline unsigned long __store_tr(void) | ||
| 24 | { | ||
| 25 | unsigned long tr; | ||
| 26 | |||
| 27 | asm volatile ("str %w0":"=r" (tr)); | ||
| 28 | return tr; | ||
| 29 | } | ||
| 30 | |||
| 31 | #define store_tr(tr) (tr) = __store_tr() | ||
| 32 | |||
| 23 | /* | 33 | /* |
| 24 | * This is the ldt that every process will get unless we need | 34 | * This is the ldt that every process will get unless we need |
| 25 | * something other than this. | 35 | * something other than this. |
| @@ -31,6 +41,16 @@ extern struct desc_ptr cpu_gdt_descr[]; | |||
| 31 | /* the cpu gdt accessor */ | 41 | /* the cpu gdt accessor */ |
| 32 | #define cpu_gdt(_cpu) ((struct desc_struct *)cpu_gdt_descr[_cpu].address) | 42 | #define cpu_gdt(_cpu) ((struct desc_struct *)cpu_gdt_descr[_cpu].address) |
| 33 | 43 | ||
| 44 | static inline void load_gdt(const struct desc_ptr *ptr) | ||
| 45 | { | ||
| 46 | asm volatile("lgdt %w0"::"m" (*ptr)); | ||
| 47 | } | ||
| 48 | |||
| 49 | static inline void store_gdt(struct desc_ptr *ptr) | ||
| 50 | { | ||
| 51 | asm("sgdt %w0":"=m" (*ptr)); | ||
| 52 | } | ||
| 53 | |||
| 34 | static inline void _set_gate(void *adr, unsigned type, unsigned long func, unsigned dpl, unsigned ist) | 54 | static inline void _set_gate(void *adr, unsigned type, unsigned long func, unsigned dpl, unsigned ist) |
| 35 | { | 55 | { |
| 36 | struct gate_struct s; | 56 | struct gate_struct s; |
| @@ -71,6 +91,16 @@ static inline void set_system_gate_ist(int nr, void *func, unsigned ist) | |||
| 71 | _set_gate(&idt_table[nr], GATE_INTERRUPT, (unsigned long) func, 3, ist); | 91 | _set_gate(&idt_table[nr], GATE_INTERRUPT, (unsigned long) func, 3, ist); |
| 72 | } | 92 | } |
| 73 | 93 | ||
| 94 | static inline void load_idt(const struct desc_ptr *ptr) | ||
| 95 | { | ||
| 96 | asm volatile("lidt %w0"::"m" (*ptr)); | ||
| 97 | } | ||
| 98 | |||
| 99 | static inline void store_idt(struct desc_ptr *dtr) | ||
| 100 | { | ||
| 101 | asm("sidt %w0":"=m" (*dtr)); | ||
| 102 | } | ||
| 103 | |||
| 74 | static inline void set_tssldt_descriptor(void *ptr, unsigned long tss, unsigned type, | 104 | static inline void set_tssldt_descriptor(void *ptr, unsigned long tss, unsigned type, |
| 75 | unsigned size) | 105 | unsigned size) |
| 76 | { | 106 | { |
diff --git a/include/asm-x86/geode.h b/include/asm-x86/geode.h index d94898831bac..771af336734f 100644 --- a/include/asm-x86/geode.h +++ b/include/asm-x86/geode.h | |||
| @@ -38,6 +38,8 @@ extern int geode_get_dev_base(unsigned int dev); | |||
| 38 | #define MSR_LBAR_ACPI 0x5140000E | 38 | #define MSR_LBAR_ACPI 0x5140000E |
| 39 | #define MSR_LBAR_PMS 0x5140000F | 39 | #define MSR_LBAR_PMS 0x5140000F |
| 40 | 40 | ||
| 41 | #define MSR_DIVIL_SOFT_RESET 0x51400017 | ||
| 42 | |||
| 41 | #define MSR_PIC_YSEL_LOW 0x51400020 | 43 | #define MSR_PIC_YSEL_LOW 0x51400020 |
| 42 | #define MSR_PIC_YSEL_HIGH 0x51400021 | 44 | #define MSR_PIC_YSEL_HIGH 0x51400021 |
| 43 | #define MSR_PIC_ZSEL_LOW 0x51400022 | 45 | #define MSR_PIC_ZSEL_LOW 0x51400022 |
diff --git a/include/asm-x86/hpet.h b/include/asm-x86/hpet.h index f95d79250a4d..b1f3c1ea55d9 100644 --- a/include/asm-x86/hpet.h +++ b/include/asm-x86/hpet.h | |||
| @@ -58,6 +58,7 @@ | |||
| 58 | /* hpet memory map physical address */ | 58 | /* hpet memory map physical address */ |
| 59 | extern unsigned long hpet_address; | 59 | extern unsigned long hpet_address; |
| 60 | extern unsigned long force_hpet_address; | 60 | extern unsigned long force_hpet_address; |
| 61 | extern int hpet_force_user; | ||
| 61 | extern int is_hpet_enabled(void); | 62 | extern int is_hpet_enabled(void); |
| 62 | extern int hpet_enable(void); | 63 | extern int hpet_enable(void); |
| 63 | extern unsigned long hpet_readl(unsigned long a); | 64 | extern unsigned long hpet_readl(unsigned long a); |
diff --git a/include/asm-x86/ide.h b/include/asm-x86/ide.h index e7817a3d6578..42130adf9c7c 100644 --- a/include/asm-x86/ide.h +++ b/include/asm-x86/ide.h | |||
| @@ -62,7 +62,6 @@ static __inline__ unsigned long ide_default_io_base(int index) | |||
| 62 | } | 62 | } |
| 63 | } | 63 | } |
| 64 | 64 | ||
| 65 | #define IDE_ARCH_OBSOLETE_INIT | ||
| 66 | #define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */ | 65 | #define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */ |
| 67 | 66 | ||
| 68 | #ifdef CONFIG_BLK_DEV_IDEPCI | 67 | #ifdef CONFIG_BLK_DEV_IDEPCI |
diff --git a/include/asm-x86/io_apic_64.h b/include/asm-x86/io_apic_64.h index d9f2e54324d5..e2c13675ee4e 100644 --- a/include/asm-x86/io_apic_64.h +++ b/include/asm-x86/io_apic_64.h | |||
| @@ -133,4 +133,6 @@ void enable_NMI_through_LVT0 (void * dummy); | |||
| 133 | 133 | ||
| 134 | extern spinlock_t i8259A_lock; | 134 | extern spinlock_t i8259A_lock; |
| 135 | 135 | ||
| 136 | extern int timer_over_8254; | ||
| 137 | |||
| 136 | #endif | 138 | #endif |
diff --git a/include/asm-x86/ipi.h b/include/asm-x86/ipi.h index a7c75ea408a8..6d011bd6067d 100644 --- a/include/asm-x86/ipi.h +++ b/include/asm-x86/ipi.h | |||
| @@ -119,7 +119,7 @@ static inline void send_IPI_mask_sequence(cpumask_t mask, int vector) | |||
| 119 | */ | 119 | */ |
| 120 | local_irq_save(flags); | 120 | local_irq_save(flags); |
| 121 | for_each_cpu_mask(query_cpu, mask) { | 121 | for_each_cpu_mask(query_cpu, mask) { |
| 122 | __send_IPI_dest_field(x86_cpu_to_apicid[query_cpu], | 122 | __send_IPI_dest_field(per_cpu(x86_cpu_to_apicid, query_cpu), |
| 123 | vector, APIC_DEST_PHYSICAL); | 123 | vector, APIC_DEST_PHYSICAL); |
| 124 | } | 124 | } |
| 125 | local_irq_restore(flags); | 125 | local_irq_restore(flags); |
diff --git a/include/asm-x86/irq_32.h b/include/asm-x86/irq_32.h index 36f310632c49..aca9c96e8e6b 100644 --- a/include/asm-x86/irq_32.h +++ b/include/asm-x86/irq_32.h | |||
| @@ -45,4 +45,7 @@ unsigned int do_IRQ(struct pt_regs *regs); | |||
| 45 | void init_IRQ(void); | 45 | void init_IRQ(void); |
| 46 | void __init native_init_IRQ(void); | 46 | void __init native_init_IRQ(void); |
| 47 | 47 | ||
| 48 | /* Interrupt vector management */ | ||
| 49 | extern DECLARE_BITMAP(used_vectors, NR_VECTORS); | ||
| 50 | |||
| 48 | #endif /* _ASM_IRQ_H */ | 51 | #endif /* _ASM_IRQ_H */ |
diff --git a/include/asm-x86/msr-index.h b/include/asm-x86/msr-index.h index a02eb2991349..a4944732be04 100644 --- a/include/asm-x86/msr-index.h +++ b/include/asm-x86/msr-index.h | |||
| @@ -73,8 +73,32 @@ | |||
| 73 | #define MSR_P6_EVNTSEL0 0x00000186 | 73 | #define MSR_P6_EVNTSEL0 0x00000186 |
| 74 | #define MSR_P6_EVNTSEL1 0x00000187 | 74 | #define MSR_P6_EVNTSEL1 0x00000187 |
| 75 | 75 | ||
| 76 | /* K7/K8 MSRs. Not complete. See the architecture manual for a more | 76 | /* AMD64 MSRs. Not complete. See the architecture manual for a more |
| 77 | complete list. */ | 77 | complete list. */ |
| 78 | |||
| 79 | #define MSR_AMD64_IBSFETCHCTL 0xc0011030 | ||
| 80 | #define MSR_AMD64_IBSFETCHLINAD 0xc0011031 | ||
| 81 | #define MSR_AMD64_IBSFETCHPHYSAD 0xc0011032 | ||
| 82 | #define MSR_AMD64_IBSOPCTL 0xc0011033 | ||
| 83 | #define MSR_AMD64_IBSOPRIP 0xc0011034 | ||
| 84 | #define MSR_AMD64_IBSOPDATA 0xc0011035 | ||
| 85 | #define MSR_AMD64_IBSOPDATA2 0xc0011036 | ||
| 86 | #define MSR_AMD64_IBSOPDATA3 0xc0011037 | ||
| 87 | #define MSR_AMD64_IBSDCLINAD 0xc0011038 | ||
| 88 | #define MSR_AMD64_IBSDCPHYSAD 0xc0011039 | ||
| 89 | #define MSR_AMD64_IBSCTL 0xc001103a | ||
| 90 | |||
| 91 | /* K8 MSRs */ | ||
| 92 | #define MSR_K8_TOP_MEM1 0xc001001a | ||
| 93 | #define MSR_K8_TOP_MEM2 0xc001001d | ||
| 94 | #define MSR_K8_SYSCFG 0xc0010010 | ||
| 95 | #define MSR_K8_HWCR 0xc0010015 | ||
| 96 | #define MSR_K8_ENABLE_C1E 0xc0010055 | ||
| 97 | #define K8_MTRRFIXRANGE_DRAM_ENABLE 0x00040000 /* MtrrFixDramEn bit */ | ||
| 98 | #define K8_MTRRFIXRANGE_DRAM_MODIFY 0x00080000 /* MtrrFixDramModEn bit */ | ||
| 99 | #define K8_MTRR_RDMEM_WRMEM_MASK 0x18181818 /* Mask: RdMem|WrMem */ | ||
| 100 | |||
| 101 | /* K7 MSRs */ | ||
| 78 | #define MSR_K7_EVNTSEL0 0xc0010000 | 102 | #define MSR_K7_EVNTSEL0 0xc0010000 |
| 79 | #define MSR_K7_PERFCTR0 0xc0010004 | 103 | #define MSR_K7_PERFCTR0 0xc0010004 |
| 80 | #define MSR_K7_EVNTSEL1 0xc0010001 | 104 | #define MSR_K7_EVNTSEL1 0xc0010001 |
| @@ -83,20 +107,10 @@ | |||
| 83 | #define MSR_K7_PERFCTR2 0xc0010006 | 107 | #define MSR_K7_PERFCTR2 0xc0010006 |
| 84 | #define MSR_K7_EVNTSEL3 0xc0010003 | 108 | #define MSR_K7_EVNTSEL3 0xc0010003 |
| 85 | #define MSR_K7_PERFCTR3 0xc0010007 | 109 | #define MSR_K7_PERFCTR3 0xc0010007 |
| 86 | #define MSR_K8_TOP_MEM1 0xc001001a | ||
| 87 | #define MSR_K7_CLK_CTL 0xc001001b | 110 | #define MSR_K7_CLK_CTL 0xc001001b |
| 88 | #define MSR_K8_TOP_MEM2 0xc001001d | ||
| 89 | #define MSR_K8_SYSCFG 0xc0010010 | ||
| 90 | |||
| 91 | #define K8_MTRRFIXRANGE_DRAM_ENABLE 0x00040000 /* MtrrFixDramEn bit */ | ||
| 92 | #define K8_MTRRFIXRANGE_DRAM_MODIFY 0x00080000 /* MtrrFixDramModEn bit */ | ||
| 93 | #define K8_MTRR_RDMEM_WRMEM_MASK 0x18181818 /* Mask: RdMem|WrMem */ | ||
| 94 | |||
| 95 | #define MSR_K7_HWCR 0xc0010015 | 111 | #define MSR_K7_HWCR 0xc0010015 |
| 96 | #define MSR_K8_HWCR 0xc0010015 | ||
| 97 | #define MSR_K7_FID_VID_CTL 0xc0010041 | 112 | #define MSR_K7_FID_VID_CTL 0xc0010041 |
| 98 | #define MSR_K7_FID_VID_STATUS 0xc0010042 | 113 | #define MSR_K7_FID_VID_STATUS 0xc0010042 |
| 99 | #define MSR_K8_ENABLE_C1E 0xc0010055 | ||
| 100 | 114 | ||
| 101 | /* K6 MSRs */ | 115 | /* K6 MSRs */ |
| 102 | #define MSR_K6_EFER 0xc0000080 | 116 | #define MSR_K6_EFER 0xc0000080 |
diff --git a/include/asm-x86/processor_32.h b/include/asm-x86/processor_32.h index 83800e7496ee..13976b086837 100644 --- a/include/asm-x86/processor_32.h +++ b/include/asm-x86/processor_32.h | |||
| @@ -79,6 +79,7 @@ struct cpuinfo_x86 { | |||
| 79 | unsigned char booted_cores; /* number of cores as seen by OS */ | 79 | unsigned char booted_cores; /* number of cores as seen by OS */ |
| 80 | __u8 phys_proc_id; /* Physical processor id. */ | 80 | __u8 phys_proc_id; /* Physical processor id. */ |
| 81 | __u8 cpu_core_id; /* Core id */ | 81 | __u8 cpu_core_id; /* Core id */ |
| 82 | __u8 cpu_index; /* index into per_cpu list */ | ||
| 82 | #endif | 83 | #endif |
| 83 | } __attribute__((__aligned__(SMP_CACHE_BYTES))); | 84 | } __attribute__((__aligned__(SMP_CACHE_BYTES))); |
| 84 | 85 | ||
| @@ -103,14 +104,19 @@ extern struct tss_struct doublefault_tss; | |||
| 103 | DECLARE_PER_CPU(struct tss_struct, init_tss); | 104 | DECLARE_PER_CPU(struct tss_struct, init_tss); |
| 104 | 105 | ||
| 105 | #ifdef CONFIG_SMP | 106 | #ifdef CONFIG_SMP |
| 106 | extern struct cpuinfo_x86 cpu_data[]; | 107 | DECLARE_PER_CPU(struct cpuinfo_x86, cpu_info); |
| 107 | #define current_cpu_data cpu_data[smp_processor_id()] | 108 | #define cpu_data(cpu) per_cpu(cpu_info, cpu) |
| 109 | #define current_cpu_data cpu_data(smp_processor_id()) | ||
| 108 | #else | 110 | #else |
| 109 | #define cpu_data (&boot_cpu_data) | 111 | #define cpu_data(cpu) boot_cpu_data |
| 110 | #define current_cpu_data boot_cpu_data | 112 | #define current_cpu_data boot_cpu_data |
| 111 | #endif | 113 | #endif |
| 112 | 114 | ||
| 113 | extern int cpu_llc_id[NR_CPUS]; | 115 | /* |
| 116 | * the following now lives in the per cpu area: | ||
| 117 | * extern int cpu_llc_id[NR_CPUS]; | ||
| 118 | */ | ||
| 119 | DECLARE_PER_CPU(u8, cpu_llc_id); | ||
| 114 | extern char ignore_fpu_irq; | 120 | extern char ignore_fpu_irq; |
| 115 | 121 | ||
| 116 | void __init cpu_detect(struct cpuinfo_x86 *c); | 122 | void __init cpu_detect(struct cpuinfo_x86 *c); |
diff --git a/include/asm-x86/processor_64.h b/include/asm-x86/processor_64.h index f422becbddd9..e4f19970a82b 100644 --- a/include/asm-x86/processor_64.h +++ b/include/asm-x86/processor_64.h | |||
| @@ -74,6 +74,7 @@ struct cpuinfo_x86 { | |||
| 74 | __u8 booted_cores; /* number of cores as seen by OS */ | 74 | __u8 booted_cores; /* number of cores as seen by OS */ |
| 75 | __u8 phys_proc_id; /* Physical Processor id. */ | 75 | __u8 phys_proc_id; /* Physical Processor id. */ |
| 76 | __u8 cpu_core_id; /* Core id. */ | 76 | __u8 cpu_core_id; /* Core id. */ |
| 77 | __u8 cpu_index; /* index into per_cpu list */ | ||
| 77 | #endif | 78 | #endif |
| 78 | } ____cacheline_aligned; | 79 | } ____cacheline_aligned; |
| 79 | 80 | ||
| @@ -88,11 +89,12 @@ struct cpuinfo_x86 { | |||
| 88 | #define X86_VENDOR_UNKNOWN 0xff | 89 | #define X86_VENDOR_UNKNOWN 0xff |
| 89 | 90 | ||
| 90 | #ifdef CONFIG_SMP | 91 | #ifdef CONFIG_SMP |
| 91 | extern struct cpuinfo_x86 cpu_data[]; | 92 | DECLARE_PER_CPU(struct cpuinfo_x86, cpu_info); |
| 92 | #define current_cpu_data cpu_data[smp_processor_id()] | 93 | #define cpu_data(cpu) per_cpu(cpu_info, cpu) |
| 94 | #define current_cpu_data cpu_data(smp_processor_id()) | ||
| 93 | #else | 95 | #else |
| 94 | #define cpu_data (&boot_cpu_data) | 96 | #define cpu_data(cpu) boot_cpu_data |
| 95 | #define current_cpu_data boot_cpu_data | 97 | #define current_cpu_data boot_cpu_data |
| 96 | #endif | 98 | #endif |
| 97 | 99 | ||
| 98 | extern char ignore_irq13; | 100 | extern char ignore_irq13; |
| @@ -390,12 +392,6 @@ static inline void sync_core(void) | |||
| 390 | asm volatile("cpuid" : "=a" (tmp) : "0" (1) : "ebx","ecx","edx","memory"); | 392 | asm volatile("cpuid" : "=a" (tmp) : "0" (1) : "ebx","ecx","edx","memory"); |
| 391 | } | 393 | } |
| 392 | 394 | ||
| 393 | #define ARCH_HAS_PREFETCH | ||
| 394 | static inline void prefetch(void *x) | ||
| 395 | { | ||
| 396 | asm volatile("prefetcht0 (%0)" :: "r" (x)); | ||
| 397 | } | ||
| 398 | |||
| 399 | #define ARCH_HAS_PREFETCHW 1 | 395 | #define ARCH_HAS_PREFETCHW 1 |
| 400 | static inline void prefetchw(void *x) | 396 | static inline void prefetchw(void *x) |
| 401 | { | 397 | { |
diff --git a/include/asm-x86/proto.h b/include/asm-x86/proto.h index c44a3a93b5a4..dabba55f7ed8 100644 --- a/include/asm-x86/proto.h +++ b/include/asm-x86/proto.h | |||
| @@ -83,8 +83,6 @@ extern unsigned tsc_khz; | |||
| 83 | extern int reboot_force; | 83 | extern int reboot_force; |
| 84 | extern int notsc_setup(char *); | 84 | extern int notsc_setup(char *); |
| 85 | 85 | ||
| 86 | extern int timer_over_8254; | ||
| 87 | |||
| 88 | extern int gsi_irq_sharing(int gsi); | 86 | extern int gsi_irq_sharing(int gsi); |
| 89 | 87 | ||
| 90 | extern int force_mwait; | 88 | extern int force_mwait; |
diff --git a/include/asm-x86/ptrace_32.h b/include/asm-x86/ptrace_32.h index 6002597b9e12..78d063dabe0a 100644 --- a/include/asm-x86/ptrace_32.h +++ b/include/asm-x86/ptrace_32.h | |||
| @@ -55,6 +55,8 @@ static inline int v8086_mode(struct pt_regs *regs) | |||
| 55 | } | 55 | } |
| 56 | 56 | ||
| 57 | #define instruction_pointer(regs) ((regs)->eip) | 57 | #define instruction_pointer(regs) ((regs)->eip) |
| 58 | #define frame_pointer(regs) ((regs)->ebp) | ||
| 59 | #define stack_pointer(regs) ((regs)->esp) | ||
| 58 | #define regs_return_value(regs) ((regs)->eax) | 60 | #define regs_return_value(regs) ((regs)->eax) |
| 59 | 61 | ||
| 60 | extern unsigned long profile_pc(struct pt_regs *regs); | 62 | extern unsigned long profile_pc(struct pt_regs *regs); |
diff --git a/include/asm-x86/ptrace_64.h b/include/asm-x86/ptrace_64.h index 7f166ccb0606..7bfe61e1b705 100644 --- a/include/asm-x86/ptrace_64.h +++ b/include/asm-x86/ptrace_64.h | |||
| @@ -40,6 +40,8 @@ struct pt_regs { | |||
| 40 | #define user_mode(regs) (!!((regs)->cs & 3)) | 40 | #define user_mode(regs) (!!((regs)->cs & 3)) |
| 41 | #define user_mode_vm(regs) user_mode(regs) | 41 | #define user_mode_vm(regs) user_mode(regs) |
| 42 | #define instruction_pointer(regs) ((regs)->rip) | 42 | #define instruction_pointer(regs) ((regs)->rip) |
| 43 | #define frame_pointer(regs) ((regs)->rbp) | ||
| 44 | #define stack_pointer(regs) ((regs)->rsp) | ||
| 43 | #define regs_return_value(regs) ((regs)->rax) | 45 | #define regs_return_value(regs) ((regs)->rax) |
| 44 | 46 | ||
| 45 | extern unsigned long profile_pc(struct pt_regs *regs); | 47 | extern unsigned long profile_pc(struct pt_regs *regs); |
diff --git a/include/asm-x86/smp_32.h b/include/asm-x86/smp_32.h index 1f576a93368f..7056d8684522 100644 --- a/include/asm-x86/smp_32.h +++ b/include/asm-x86/smp_32.h | |||
| @@ -39,9 +39,11 @@ extern void lock_ipi_call_lock(void); | |||
| 39 | extern void unlock_ipi_call_lock(void); | 39 | extern void unlock_ipi_call_lock(void); |
| 40 | 40 | ||
| 41 | #define MAX_APICID 256 | 41 | #define MAX_APICID 256 |
| 42 | extern u8 x86_cpu_to_apicid[]; | 42 | extern u8 __initdata x86_cpu_to_apicid_init[]; |
| 43 | extern void *x86_cpu_to_apicid_ptr; | ||
| 44 | DECLARE_PER_CPU(u8, x86_cpu_to_apicid); | ||
| 43 | 45 | ||
| 44 | #define cpu_physical_id(cpu) x86_cpu_to_apicid[cpu] | 46 | #define cpu_physical_id(cpu) per_cpu(x86_cpu_to_apicid, cpu) |
| 45 | 47 | ||
| 46 | extern void set_cpu_sibling_map(int cpu); | 48 | extern void set_cpu_sibling_map(int cpu); |
| 47 | 49 | ||
diff --git a/include/asm-x86/smp_64.h b/include/asm-x86/smp_64.h index d30e9b684fdd..6f0e0273b646 100644 --- a/include/asm-x86/smp_64.h +++ b/include/asm-x86/smp_64.h | |||
| @@ -37,6 +37,8 @@ extern void lock_ipi_call_lock(void); | |||
| 37 | extern void unlock_ipi_call_lock(void); | 37 | extern void unlock_ipi_call_lock(void); |
| 38 | extern int smp_num_siblings; | 38 | extern int smp_num_siblings; |
| 39 | extern void smp_send_reschedule(int cpu); | 39 | extern void smp_send_reschedule(int cpu); |
| 40 | extern int smp_call_function_mask(cpumask_t mask, void (*func)(void *), | ||
| 41 | void *info, int wait); | ||
| 40 | 42 | ||
| 41 | /* | 43 | /* |
| 42 | * cpu_sibling_map and cpu_core_map now live | 44 | * cpu_sibling_map and cpu_core_map now live |
| @@ -47,7 +49,7 @@ extern void smp_send_reschedule(int cpu); | |||
| 47 | */ | 49 | */ |
| 48 | DECLARE_PER_CPU(cpumask_t, cpu_sibling_map); | 50 | DECLARE_PER_CPU(cpumask_t, cpu_sibling_map); |
| 49 | DECLARE_PER_CPU(cpumask_t, cpu_core_map); | 51 | DECLARE_PER_CPU(cpumask_t, cpu_core_map); |
| 50 | extern u8 cpu_llc_id[NR_CPUS]; | 52 | DECLARE_PER_CPU(u8, cpu_llc_id); |
| 51 | 53 | ||
| 52 | #define SMP_TRAMPOLINE_BASE 0x6000 | 54 | #define SMP_TRAMPOLINE_BASE 0x6000 |
| 53 | 55 | ||
| @@ -84,7 +86,9 @@ static inline int hard_smp_processor_id(void) | |||
| 84 | * Some lowlevel functions might want to know about | 86 | * Some lowlevel functions might want to know about |
| 85 | * the real APIC ID <-> CPU # mapping. | 87 | * the real APIC ID <-> CPU # mapping. |
| 86 | */ | 88 | */ |
| 87 | extern u8 x86_cpu_to_apicid[NR_CPUS]; /* physical ID */ | 89 | extern u8 __initdata x86_cpu_to_apicid_init[]; |
| 90 | extern void *x86_cpu_to_apicid_ptr; | ||
| 91 | DECLARE_PER_CPU(u8, x86_cpu_to_apicid); /* physical ID */ | ||
| 88 | extern u8 bios_cpu_apicid[]; | 92 | extern u8 bios_cpu_apicid[]; |
| 89 | 93 | ||
| 90 | static inline int cpu_present_to_apicid(int mps_cpu) | 94 | static inline int cpu_present_to_apicid(int mps_cpu) |
| @@ -115,8 +119,9 @@ static __inline int logical_smp_processor_id(void) | |||
| 115 | } | 119 | } |
| 116 | 120 | ||
| 117 | #ifdef CONFIG_SMP | 121 | #ifdef CONFIG_SMP |
| 118 | #define cpu_physical_id(cpu) x86_cpu_to_apicid[cpu] | 122 | #define cpu_physical_id(cpu) per_cpu(x86_cpu_to_apicid, cpu) |
| 119 | #else | 123 | #else |
| 124 | extern unsigned int boot_cpu_id; | ||
| 120 | #define cpu_physical_id(cpu) boot_cpu_id | 125 | #define cpu_physical_id(cpu) boot_cpu_id |
| 121 | #endif /* !CONFIG_SMP */ | 126 | #endif /* !CONFIG_SMP */ |
| 122 | #endif | 127 | #endif |
diff --git a/include/asm-x86/system_32.h b/include/asm-x86/system_32.h index db6283eb5e46..ef8468883bac 100644 --- a/include/asm-x86/system_32.h +++ b/include/asm-x86/system_32.h | |||
| @@ -315,5 +315,6 @@ extern unsigned long arch_align_stack(unsigned long sp); | |||
| 315 | extern void free_init_pages(char *what, unsigned long begin, unsigned long end); | 315 | extern void free_init_pages(char *what, unsigned long begin, unsigned long end); |
| 316 | 316 | ||
| 317 | void default_idle(void); | 317 | void default_idle(void); |
| 318 | void __show_registers(struct pt_regs *, int all); | ||
| 318 | 319 | ||
| 319 | #endif | 320 | #endif |
diff --git a/include/asm-x86/topology_32.h b/include/asm-x86/topology_32.h index ae1074603c4b..9040f5a61278 100644 --- a/include/asm-x86/topology_32.h +++ b/include/asm-x86/topology_32.h | |||
| @@ -28,8 +28,8 @@ | |||
| 28 | #define _ASM_I386_TOPOLOGY_H | 28 | #define _ASM_I386_TOPOLOGY_H |
| 29 | 29 | ||
| 30 | #ifdef CONFIG_X86_HT | 30 | #ifdef CONFIG_X86_HT |
| 31 | #define topology_physical_package_id(cpu) (cpu_data[cpu].phys_proc_id) | 31 | #define topology_physical_package_id(cpu) (cpu_data(cpu).phys_proc_id) |
| 32 | #define topology_core_id(cpu) (cpu_data[cpu].cpu_core_id) | 32 | #define topology_core_id(cpu) (cpu_data(cpu).cpu_core_id) |
| 33 | #define topology_core_siblings(cpu) (per_cpu(cpu_core_map, cpu)) | 33 | #define topology_core_siblings(cpu) (per_cpu(cpu_core_map, cpu)) |
| 34 | #define topology_thread_siblings(cpu) (per_cpu(cpu_sibling_map, cpu)) | 34 | #define topology_thread_siblings(cpu) (per_cpu(cpu_sibling_map, cpu)) |
| 35 | #endif | 35 | #endif |
diff --git a/include/asm-x86/topology_64.h b/include/asm-x86/topology_64.h index c0c93d744673..a718dda037e0 100644 --- a/include/asm-x86/topology_64.h +++ b/include/asm-x86/topology_64.h | |||
| @@ -56,8 +56,8 @@ extern int __node_distance(int, int); | |||
| 56 | #endif | 56 | #endif |
| 57 | 57 | ||
| 58 | #ifdef CONFIG_SMP | 58 | #ifdef CONFIG_SMP |
| 59 | #define topology_physical_package_id(cpu) (cpu_data[cpu].phys_proc_id) | 59 | #define topology_physical_package_id(cpu) (cpu_data(cpu).phys_proc_id) |
| 60 | #define topology_core_id(cpu) (cpu_data[cpu].cpu_core_id) | 60 | #define topology_core_id(cpu) (cpu_data(cpu).cpu_core_id) |
| 61 | #define topology_core_siblings(cpu) (per_cpu(cpu_core_map, cpu)) | 61 | #define topology_core_siblings(cpu) (per_cpu(cpu_core_map, cpu)) |
| 62 | #define topology_thread_siblings(cpu) (per_cpu(cpu_sibling_map, cpu)) | 62 | #define topology_thread_siblings(cpu) (per_cpu(cpu_sibling_map, cpu)) |
| 63 | #define mc_capable() (boot_cpu_data.x86_max_cores > 1) | 63 | #define mc_capable() (boot_cpu_data.x86_max_cores > 1) |
diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h index 499f5373e213..37c66d1254b5 100644 --- a/include/linux/device-mapper.h +++ b/include/linux/device-mapper.h | |||
| @@ -183,11 +183,14 @@ int dm_resume(struct mapped_device *md); | |||
| 183 | */ | 183 | */ |
| 184 | uint32_t dm_get_event_nr(struct mapped_device *md); | 184 | uint32_t dm_get_event_nr(struct mapped_device *md); |
| 185 | int dm_wait_event(struct mapped_device *md, int event_nr); | 185 | int dm_wait_event(struct mapped_device *md, int event_nr); |
| 186 | uint32_t dm_next_uevent_seq(struct mapped_device *md); | ||
| 187 | void dm_uevent_add(struct mapped_device *md, struct list_head *elist); | ||
| 186 | 188 | ||
| 187 | /* | 189 | /* |
| 188 | * Info functions. | 190 | * Info functions. |
| 189 | */ | 191 | */ |
| 190 | const char *dm_device_name(struct mapped_device *md); | 192 | const char *dm_device_name(struct mapped_device *md); |
| 193 | int dm_copy_name_and_uuid(struct mapped_device *md, char *name, char *uuid); | ||
| 191 | struct gendisk *dm_disk(struct mapped_device *md); | 194 | struct gendisk *dm_disk(struct mapped_device *md); |
| 192 | int dm_suspended(struct mapped_device *md); | 195 | int dm_suspended(struct mapped_device *md); |
| 193 | int dm_noflush_suspending(struct dm_target *ti); | 196 | int dm_noflush_suspending(struct dm_target *ti); |
diff --git a/include/linux/dm-ioctl.h b/include/linux/dm-ioctl.h index b93486107821..523281c5b7f5 100644 --- a/include/linux/dm-ioctl.h +++ b/include/linux/dm-ioctl.h | |||
| @@ -131,6 +131,7 @@ struct dm_ioctl { | |||
| 131 | char name[DM_NAME_LEN]; /* device name */ | 131 | char name[DM_NAME_LEN]; /* device name */ |
| 132 | char uuid[DM_UUID_LEN]; /* unique identifier for | 132 | char uuid[DM_UUID_LEN]; /* unique identifier for |
| 133 | * the block device */ | 133 | * the block device */ |
| 134 | char data[7]; /* padding or data */ | ||
| 134 | }; | 135 | }; |
| 135 | 136 | ||
| 136 | /* | 137 | /* |
| @@ -285,9 +286,9 @@ typedef char ioctl_struct[308]; | |||
| 285 | #define DM_DEV_SET_GEOMETRY _IOWR(DM_IOCTL, DM_DEV_SET_GEOMETRY_CMD, struct dm_ioctl) | 286 | #define DM_DEV_SET_GEOMETRY _IOWR(DM_IOCTL, DM_DEV_SET_GEOMETRY_CMD, struct dm_ioctl) |
| 286 | 287 | ||
| 287 | #define DM_VERSION_MAJOR 4 | 288 | #define DM_VERSION_MAJOR 4 |
| 288 | #define DM_VERSION_MINOR 11 | 289 | #define DM_VERSION_MINOR 12 |
| 289 | #define DM_VERSION_PATCHLEVEL 0 | 290 | #define DM_VERSION_PATCHLEVEL 0 |
| 290 | #define DM_VERSION_EXTRA "-ioctl (2006-10-12)" | 291 | #define DM_VERSION_EXTRA "-ioctl (2007-10-02)" |
| 291 | 292 | ||
| 292 | /* Status bits */ | 293 | /* Status bits */ |
| 293 | #define DM_READONLY_FLAG (1 << 0) /* In/Out */ | 294 | #define DM_READONLY_FLAG (1 << 0) /* In/Out */ |
diff --git a/include/linux/ide.h b/include/linux/ide.h index 19db0a4ae447..2e4b8dd03cfe 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h | |||
| @@ -192,22 +192,20 @@ typedef unsigned char byte; /* used everywhere */ | |||
| 192 | struct hwif_s; | 192 | struct hwif_s; |
| 193 | typedef int (ide_ack_intr_t)(struct hwif_s *); | 193 | typedef int (ide_ack_intr_t)(struct hwif_s *); |
| 194 | 194 | ||
| 195 | #ifndef NO_DMA | ||
| 196 | #define NO_DMA 255 | ||
| 197 | #endif | ||
| 198 | |||
| 199 | /* | 195 | /* |
| 200 | * hwif_chipset_t is used to keep track of the specific hardware | 196 | * hwif_chipset_t is used to keep track of the specific hardware |
| 201 | * chipset used by each IDE interface, if known. | 197 | * chipset used by each IDE interface, if known. |
| 202 | */ | 198 | */ |
| 203 | typedef enum { ide_unknown, ide_generic, ide_pci, | 199 | enum { ide_unknown, ide_generic, ide_pci, |
| 204 | ide_cmd640, ide_dtc2278, ide_ali14xx, | 200 | ide_cmd640, ide_dtc2278, ide_ali14xx, |
| 205 | ide_qd65xx, ide_umc8672, ide_ht6560b, | 201 | ide_qd65xx, ide_umc8672, ide_ht6560b, |
| 206 | ide_rz1000, ide_trm290, | 202 | ide_rz1000, ide_trm290, |
| 207 | ide_cmd646, ide_cy82c693, ide_4drives, | 203 | ide_cmd646, ide_cy82c693, ide_4drives, |
| 208 | ide_pmac, ide_etrax100, ide_acorn, | 204 | ide_pmac, ide_etrax100, ide_acorn, |
| 209 | ide_au1xxx, ide_forced | 205 | ide_au1xxx, ide_forced |
| 210 | } hwif_chipset_t; | 206 | }; |
| 207 | |||
| 208 | typedef u8 hwif_chipset_t; | ||
| 211 | 209 | ||
| 212 | /* | 210 | /* |
| 213 | * Structure to hold all information about the location of this port | 211 | * Structure to hold all information about the location of this port |
| @@ -215,22 +213,16 @@ typedef enum { ide_unknown, ide_generic, ide_pci, | |||
| 215 | typedef struct hw_regs_s { | 213 | typedef struct hw_regs_s { |
| 216 | unsigned long io_ports[IDE_NR_PORTS]; /* task file registers */ | 214 | unsigned long io_ports[IDE_NR_PORTS]; /* task file registers */ |
| 217 | int irq; /* our irq number */ | 215 | int irq; /* our irq number */ |
| 218 | int dma; /* our dma entry */ | ||
| 219 | ide_ack_intr_t *ack_intr; /* acknowledge interrupt */ | 216 | ide_ack_intr_t *ack_intr; /* acknowledge interrupt */ |
| 220 | hwif_chipset_t chipset; | 217 | hwif_chipset_t chipset; |
| 221 | struct device *dev; | 218 | struct device *dev; |
| 222 | } hw_regs_t; | 219 | } hw_regs_t; |
| 223 | 220 | ||
| 224 | /* | 221 | struct hwif_s * ide_find_port(unsigned long); |
| 225 | * Register new hardware with ide | 222 | |
| 226 | */ | 223 | int ide_register_hw(hw_regs_t *, void (*)(struct hwif_s *), int, |
| 227 | int ide_register_hw(hw_regs_t *, int, struct hwif_s **); | 224 | struct hwif_s **); |
| 228 | int ide_register_hw_with_fixup(hw_regs_t *, int, struct hwif_s **, | ||
| 229 | void (*)(struct hwif_s *)); | ||
| 230 | 225 | ||
| 231 | /* | ||
| 232 | * Set up hw_regs_t structure before calling ide_register_hw (optional) | ||
| 233 | */ | ||
| 234 | void ide_setup_ports( hw_regs_t *hw, | 226 | void ide_setup_ports( hw_regs_t *hw, |
| 235 | unsigned long base, | 227 | unsigned long base, |
| 236 | int *offsets, | 228 | int *offsets, |
| @@ -268,11 +260,7 @@ static inline void ide_std_init_ports(hw_regs_t *hw, | |||
| 268 | # define ide_init_default_irq(base) (0) | 260 | # define ide_init_default_irq(base) (0) |
| 269 | #endif | 261 | #endif |
| 270 | 262 | ||
| 271 | /* | 263 | #ifdef CONFIG_IDE_ARCH_OBSOLETE_INIT |
| 272 | * ide_init_hwif_ports() is OBSOLETE and will be removed in 2.7 series. | ||
| 273 | * New ports shouldn't define IDE_ARCH_OBSOLETE_INIT in <asm/ide.h>. | ||
| 274 | */ | ||
| 275 | #ifdef IDE_ARCH_OBSOLETE_INIT | ||
| 276 | static inline void ide_init_hwif_ports(hw_regs_t *hw, | 264 | static inline void ide_init_hwif_ports(hw_regs_t *hw, |
| 277 | unsigned long io_addr, | 265 | unsigned long io_addr, |
| 278 | unsigned long ctl_addr, | 266 | unsigned long ctl_addr, |
| @@ -302,7 +290,7 @@ static inline void ide_init_hwif_ports(hw_regs_t *hw, | |||
| 302 | if (io_addr || ctl_addr) | 290 | if (io_addr || ctl_addr) |
| 303 | printk(KERN_WARNING "%s: must not be called\n", __FUNCTION__); | 291 | printk(KERN_WARNING "%s: must not be called\n", __FUNCTION__); |
| 304 | } | 292 | } |
| 305 | #endif /* IDE_ARCH_OBSOLETE_INIT */ | 293 | #endif /* CONFIG_IDE_ARCH_OBSOLETE_INIT */ |
| 306 | 294 | ||
| 307 | /* Currently only m68k, apus and m8xx need it */ | 295 | /* Currently only m68k, apus and m8xx need it */ |
| 308 | #ifndef IDE_ARCH_ACK_INTR | 296 | #ifndef IDE_ARCH_ACK_INTR |
| @@ -363,7 +351,6 @@ typedef union { | |||
| 363 | * ATA DATA Register Special. | 351 | * ATA DATA Register Special. |
| 364 | * ATA NSECTOR Count Register(). | 352 | * ATA NSECTOR Count Register(). |
| 365 | * ATAPI Byte Count Register. | 353 | * ATAPI Byte Count Register. |
| 366 | * Channel index ordering pairs. | ||
| 367 | */ | 354 | */ |
| 368 | typedef union { | 355 | typedef union { |
| 369 | unsigned all :16; | 356 | unsigned all :16; |
| @@ -378,7 +365,7 @@ typedef union { | |||
| 378 | #error "Please fix <asm/byteorder.h>" | 365 | #error "Please fix <asm/byteorder.h>" |
| 379 | #endif | 366 | #endif |
| 380 | } b; | 367 | } b; |
| 381 | } ata_nsector_t, ata_data_t, atapi_bcount_t, ata_index_t; | 368 | } ata_nsector_t, ata_data_t, atapi_bcount_t; |
| 382 | 369 | ||
| 383 | /* | 370 | /* |
| 384 | * ATA-IDE Select Register, aka Device-Head | 371 | * ATA-IDE Select Register, aka Device-Head |
| @@ -657,7 +644,7 @@ typedef struct ide_drive_s { | |||
| 657 | ((1<<ide_pci)|(1<<ide_cmd646)|(1<<ide_ali14xx)) | 644 | ((1<<ide_pci)|(1<<ide_cmd646)|(1<<ide_ali14xx)) |
| 658 | #define IDE_CHIPSET_IS_PCI(c) ((IDE_CHIPSET_PCI_MASK >> (c)) & 1) | 645 | #define IDE_CHIPSET_IS_PCI(c) ((IDE_CHIPSET_PCI_MASK >> (c)) & 1) |
| 659 | 646 | ||
| 660 | struct ide_pci_device_s; | 647 | struct ide_port_info; |
| 661 | 648 | ||
| 662 | typedef struct hwif_s { | 649 | typedef struct hwif_s { |
| 663 | struct hwif_s *next; /* for linked-list in ide_hwgroup_t */ | 650 | struct hwif_s *next; /* for linked-list in ide_hwgroup_t */ |
| @@ -672,7 +659,6 @@ typedef struct hwif_s { | |||
| 672 | unsigned long sata_scr[SATA_NR_PORTS]; | 659 | unsigned long sata_scr[SATA_NR_PORTS]; |
| 673 | unsigned long sata_misc[SATA_NR_PORTS]; | 660 | unsigned long sata_misc[SATA_NR_PORTS]; |
| 674 | 661 | ||
| 675 | hw_regs_t hw; /* Hardware info */ | ||
| 676 | ide_drive_t drives[MAX_DRIVES]; /* drive info */ | 662 | ide_drive_t drives[MAX_DRIVES]; /* drive info */ |
| 677 | 663 | ||
| 678 | u8 major; /* our major number */ | 664 | u8 major; /* our major number */ |
| @@ -694,7 +680,9 @@ typedef struct hwif_s { | |||
| 694 | hwif_chipset_t chipset; /* sub-module for tuning.. */ | 680 | hwif_chipset_t chipset; /* sub-module for tuning.. */ |
| 695 | 681 | ||
| 696 | struct pci_dev *pci_dev; /* for pci chipsets */ | 682 | struct pci_dev *pci_dev; /* for pci chipsets */ |
| 697 | struct ide_pci_device_s *cds; /* chipset device struct */ | 683 | const struct ide_port_info *cds; /* chipset device struct */ |
| 684 | |||
| 685 | ide_ack_intr_t *ack_intr; | ||
| 698 | 686 | ||
| 699 | void (*rw_disk)(ide_drive_t *, struct request *); | 687 | void (*rw_disk)(ide_drive_t *, struct request *); |
| 700 | 688 | ||
| @@ -725,6 +713,8 @@ typedef struct hwif_s { | |||
| 725 | u8 (*mdma_filter)(ide_drive_t *); | 713 | u8 (*mdma_filter)(ide_drive_t *); |
| 726 | u8 (*udma_filter)(ide_drive_t *); | 714 | u8 (*udma_filter)(ide_drive_t *); |
| 727 | 715 | ||
| 716 | void (*fixup)(struct hwif_s *); | ||
| 717 | |||
| 728 | void (*ata_input_data)(ide_drive_t *, void *, u32); | 718 | void (*ata_input_data)(ide_drive_t *, void *, u32); |
| 729 | void (*ata_output_data)(ide_drive_t *, void *, u32); | 719 | void (*ata_output_data)(ide_drive_t *, void *, u32); |
| 730 | 720 | ||
| @@ -841,8 +831,6 @@ typedef struct hwgroup_s { | |||
| 841 | 831 | ||
| 842 | /* for pci chipsets */ | 832 | /* for pci chipsets */ |
| 843 | struct pci_dev *pci_dev; | 833 | struct pci_dev *pci_dev; |
| 844 | /* chipset device struct */ | ||
| 845 | struct ide_pci_device_s *cds; | ||
| 846 | 834 | ||
| 847 | /* current request */ | 835 | /* current request */ |
| 848 | struct request *rq; | 836 | struct request *rq; |
| @@ -1030,36 +1018,16 @@ extern int ide_end_request (ide_drive_t *drive, int uptodate, int nrsecs); | |||
| 1030 | int ide_end_dequeued_request(ide_drive_t *drive, struct request *rq, | 1018 | int ide_end_dequeued_request(ide_drive_t *drive, struct request *rq, |
| 1031 | int uptodate, int nr_sectors); | 1019 | int uptodate, int nr_sectors); |
| 1032 | 1020 | ||
| 1033 | /* | ||
| 1034 | * This is used on exit from the driver to designate the next irq handler | ||
| 1035 | * and also to start the safety timer. | ||
| 1036 | */ | ||
| 1037 | extern void ide_set_handler (ide_drive_t *drive, ide_handler_t *handler, unsigned int timeout, ide_expiry_t *expiry); | 1021 | extern void ide_set_handler (ide_drive_t *drive, ide_handler_t *handler, unsigned int timeout, ide_expiry_t *expiry); |
| 1038 | 1022 | ||
| 1039 | /* | ||
| 1040 | * This is used on exit from the driver to designate the next irq handler | ||
| 1041 | * and start the safety time safely and atomically from the IRQ handler | ||
| 1042 | * with respect to the command issue (which it also does) | ||
| 1043 | */ | ||
| 1044 | extern void ide_execute_command(ide_drive_t *, task_ioreg_t cmd, ide_handler_t *, unsigned int, ide_expiry_t *); | 1023 | extern void ide_execute_command(ide_drive_t *, task_ioreg_t cmd, ide_handler_t *, unsigned int, ide_expiry_t *); |
| 1045 | 1024 | ||
| 1046 | ide_startstop_t __ide_error(ide_drive_t *, struct request *, u8, u8); | 1025 | ide_startstop_t __ide_error(ide_drive_t *, struct request *, u8, u8); |
| 1047 | 1026 | ||
| 1048 | /* | ||
| 1049 | * ide_error() takes action based on the error returned by the controller. | ||
| 1050 | * The caller should return immediately after invoking this. | ||
| 1051 | * | ||
| 1052 | * (drive, msg, status) | ||
| 1053 | */ | ||
| 1054 | ide_startstop_t ide_error (ide_drive_t *drive, const char *msg, byte stat); | 1027 | ide_startstop_t ide_error (ide_drive_t *drive, const char *msg, byte stat); |
| 1055 | 1028 | ||
| 1056 | ide_startstop_t __ide_abort(ide_drive_t *, struct request *); | 1029 | ide_startstop_t __ide_abort(ide_drive_t *, struct request *); |
| 1057 | 1030 | ||
| 1058 | /* | ||
| 1059 | * Abort a running command on the controller triggering the abort | ||
| 1060 | * from a host side, non error situation | ||
| 1061 | * (drive, msg) | ||
| 1062 | */ | ||
| 1063 | extern ide_startstop_t ide_abort(ide_drive_t *, const char *); | 1031 | extern ide_startstop_t ide_abort(ide_drive_t *, const char *); |
| 1064 | 1032 | ||
| 1065 | extern void ide_fix_driveid(struct hd_driveid *); | 1033 | extern void ide_fix_driveid(struct hd_driveid *); |
| @@ -1075,15 +1043,8 @@ extern void ide_fixstring(u8 *, const int, const int); | |||
| 1075 | 1043 | ||
| 1076 | int ide_wait_stat(ide_startstop_t *, ide_drive_t *, u8, u8, unsigned long); | 1044 | int ide_wait_stat(ide_startstop_t *, ide_drive_t *, u8, u8, unsigned long); |
| 1077 | 1045 | ||
| 1078 | /* | ||
| 1079 | * Start a reset operation for an IDE interface. | ||
| 1080 | * The caller should return immediately after invoking this. | ||
| 1081 | */ | ||
| 1082 | extern ide_startstop_t ide_do_reset (ide_drive_t *); | 1046 | extern ide_startstop_t ide_do_reset (ide_drive_t *); |
| 1083 | 1047 | ||
| 1084 | /* | ||
| 1085 | * This function is intended to be used prior to invoking ide_do_drive_cmd(). | ||
| 1086 | */ | ||
| 1087 | extern void ide_init_drive_cmd (struct request *rq); | 1048 | extern void ide_init_drive_cmd (struct request *rq); |
| 1088 | 1049 | ||
| 1089 | /* | 1050 | /* |
| @@ -1098,13 +1059,6 @@ typedef enum { | |||
| 1098 | 1059 | ||
| 1099 | extern int ide_do_drive_cmd(ide_drive_t *, struct request *, ide_action_t); | 1060 | extern int ide_do_drive_cmd(ide_drive_t *, struct request *, ide_action_t); |
| 1100 | 1061 | ||
| 1101 | /* | ||
| 1102 | * Clean up after success/failure of an explicit drive cmd. | ||
| 1103 | * stat/err are used only when (HWGROUP(drive)->rq->cmd == IDE_DRIVE_CMD). | ||
| 1104 | * stat/err are used only when (HWGROUP(drive)->rq->cmd == IDE_DRIVE_TASK_MASK). | ||
| 1105 | * | ||
| 1106 | * (ide_drive_t *drive, u8 stat, u8 err) | ||
| 1107 | */ | ||
| 1108 | extern void ide_end_drive_cmd(ide_drive_t *, u8, u8); | 1062 | extern void ide_end_drive_cmd(ide_drive_t *, u8, u8); |
| 1109 | 1063 | ||
| 1110 | /* | 1064 | /* |
| @@ -1177,10 +1131,6 @@ extern int taskfile_lib_get_identify(ide_drive_t *drive, u8 *); | |||
| 1177 | 1131 | ||
| 1178 | extern int ide_wait_not_busy(ide_hwif_t *hwif, unsigned long timeout); | 1132 | extern int ide_wait_not_busy(ide_hwif_t *hwif, unsigned long timeout); |
| 1179 | 1133 | ||
| 1180 | /* | ||
| 1181 | * ide_stall_queue() can be used by a drive to give excess bandwidth back | ||
| 1182 | * to the hwgroup by sleeping for timeout jiffies. | ||
| 1183 | */ | ||
| 1184 | extern void ide_stall_queue(ide_drive_t *drive, unsigned long timeout); | 1134 | extern void ide_stall_queue(ide_drive_t *drive, unsigned long timeout); |
| 1185 | 1135 | ||
| 1186 | extern int ide_spin_wait_hwgroup(ide_drive_t *); | 1136 | extern int ide_spin_wait_hwgroup(ide_drive_t *); |
| @@ -1200,8 +1150,8 @@ extern int __ide_pci_register_driver(struct pci_driver *driver, struct module *o | |||
| 1200 | #define ide_pci_register_driver(d) pci_register_driver(d) | 1150 | #define ide_pci_register_driver(d) pci_register_driver(d) |
| 1201 | #endif | 1151 | #endif |
| 1202 | 1152 | ||
| 1203 | void ide_pci_setup_ports(struct pci_dev *, struct ide_pci_device_s *, int, ata_index_t *); | 1153 | void ide_pci_setup_ports(struct pci_dev *, const struct ide_port_info *, int, u8 *); |
| 1204 | extern void ide_setup_pci_noise (struct pci_dev *dev, struct ide_pci_device_s *d); | 1154 | void ide_setup_pci_noise(struct pci_dev *, const struct ide_port_info *); |
| 1205 | 1155 | ||
| 1206 | extern void default_hwif_iops(ide_hwif_t *); | 1156 | extern void default_hwif_iops(ide_hwif_t *); |
| 1207 | extern void default_hwif_mmiops(ide_hwif_t *); | 1157 | extern void default_hwif_mmiops(ide_hwif_t *); |
| @@ -1261,6 +1211,14 @@ enum { | |||
| 1261 | IDE_HFLAG_SERIALIZE = (1 << 20), | 1211 | IDE_HFLAG_SERIALIZE = (1 << 20), |
| 1262 | /* use legacy IRQs */ | 1212 | /* use legacy IRQs */ |
| 1263 | IDE_HFLAG_LEGACY_IRQS = (1 << 21), | 1213 | IDE_HFLAG_LEGACY_IRQS = (1 << 21), |
| 1214 | /* force use of legacy IRQs */ | ||
| 1215 | IDE_HFLAG_FORCE_LEGACY_IRQS = (1 << 22), | ||
| 1216 | /* limit LBA48 requests to 256 sectors */ | ||
| 1217 | IDE_HFLAG_RQSIZE_256 = (1 << 23), | ||
| 1218 | /* use 32-bit I/O ops */ | ||
| 1219 | IDE_HFLAG_IO_32BIT = (1 << 24), | ||
| 1220 | /* unmask IRQs */ | ||
| 1221 | IDE_HFLAG_UNMASK_IRQS = (1 << 25), | ||
| 1264 | }; | 1222 | }; |
| 1265 | 1223 | ||
| 1266 | #ifdef CONFIG_BLK_DEV_OFFBOARD | 1224 | #ifdef CONFIG_BLK_DEV_OFFBOARD |
| @@ -1269,7 +1227,7 @@ enum { | |||
| 1269 | # define IDE_HFLAG_OFF_BOARD 0 | 1227 | # define IDE_HFLAG_OFF_BOARD 0 |
| 1270 | #endif | 1228 | #endif |
| 1271 | 1229 | ||
| 1272 | typedef struct ide_pci_device_s { | 1230 | struct ide_port_info { |
| 1273 | char *name; | 1231 | char *name; |
| 1274 | unsigned int (*init_chipset)(struct pci_dev *, const char *); | 1232 | unsigned int (*init_chipset)(struct pci_dev *, const char *); |
| 1275 | void (*init_iops)(ide_hwif_t *); | 1233 | void (*init_iops)(ide_hwif_t *); |
| @@ -1277,17 +1235,17 @@ typedef struct ide_pci_device_s { | |||
| 1277 | void (*init_dma)(ide_hwif_t *, unsigned long); | 1235 | void (*init_dma)(ide_hwif_t *, unsigned long); |
| 1278 | void (*fixup)(ide_hwif_t *); | 1236 | void (*fixup)(ide_hwif_t *); |
| 1279 | ide_pci_enablebit_t enablebits[2]; | 1237 | ide_pci_enablebit_t enablebits[2]; |
| 1238 | hwif_chipset_t chipset; | ||
| 1280 | unsigned int extra; | 1239 | unsigned int extra; |
| 1281 | struct ide_pci_device_s *next; | ||
| 1282 | u32 host_flags; | 1240 | u32 host_flags; |
| 1283 | u8 pio_mask; | 1241 | u8 pio_mask; |
| 1284 | u8 swdma_mask; | 1242 | u8 swdma_mask; |
| 1285 | u8 mwdma_mask; | 1243 | u8 mwdma_mask; |
| 1286 | u8 udma_mask; | 1244 | u8 udma_mask; |
| 1287 | } ide_pci_device_t; | 1245 | }; |
| 1288 | 1246 | ||
| 1289 | extern int ide_setup_pci_device(struct pci_dev *, ide_pci_device_t *); | 1247 | int ide_setup_pci_device(struct pci_dev *, const struct ide_port_info *); |
| 1290 | extern int ide_setup_pci_devices(struct pci_dev *, struct pci_dev *, ide_pci_device_t *); | 1248 | int ide_setup_pci_devices(struct pci_dev *, struct pci_dev *, const struct ide_port_info *); |
| 1291 | 1249 | ||
| 1292 | void ide_map_sg(ide_drive_t *, struct request *); | 1250 | void ide_map_sg(ide_drive_t *, struct request *); |
| 1293 | void ide_init_sg_cmd(ide_drive_t *, struct request *); | 1251 | void ide_init_sg_cmd(ide_drive_t *, struct request *); |
| @@ -1370,8 +1328,7 @@ void ide_unregister_region(struct gendisk *); | |||
| 1370 | 1328 | ||
| 1371 | void ide_undecoded_slave(ide_hwif_t *); | 1329 | void ide_undecoded_slave(ide_hwif_t *); |
| 1372 | 1330 | ||
| 1373 | int probe_hwif_init_with_fixup(ide_hwif_t *, void (*)(ide_hwif_t *)); | 1331 | int ide_device_add(u8 idx[4]); |
| 1374 | extern int probe_hwif_init(ide_hwif_t *); | ||
| 1375 | 1332 | ||
| 1376 | static inline void *ide_get_hwifdata (ide_hwif_t * hwif) | 1333 | static inline void *ide_get_hwifdata (ide_hwif_t * hwif) |
| 1377 | { | 1334 | { |
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h index c5164c257f71..e82a6ebc725d 100644 --- a/include/linux/nfs_fs.h +++ b/include/linux/nfs_fs.h | |||
| @@ -160,6 +160,12 @@ struct nfs_inode { | |||
| 160 | /* Open contexts for shared mmap writes */ | 160 | /* Open contexts for shared mmap writes */ |
| 161 | struct list_head open_files; | 161 | struct list_head open_files; |
| 162 | 162 | ||
| 163 | /* Number of in-flight sillydelete RPC calls */ | ||
| 164 | atomic_t silly_count; | ||
| 165 | /* List of deferred sillydelete requests */ | ||
| 166 | struct hlist_head silly_list; | ||
| 167 | wait_queue_head_t waitqueue; | ||
| 168 | |||
| 163 | #ifdef CONFIG_NFS_V4 | 169 | #ifdef CONFIG_NFS_V4 |
| 164 | struct nfs4_cached_acl *nfs4_acl; | 170 | struct nfs4_cached_acl *nfs4_acl; |
| 165 | /* NFSv4 state */ | 171 | /* NFSv4 state */ |
| @@ -394,6 +400,8 @@ extern void nfs_release_automount_timer(void); | |||
| 394 | */ | 400 | */ |
| 395 | extern int nfs_async_unlink(struct inode *dir, struct dentry *dentry); | 401 | extern int nfs_async_unlink(struct inode *dir, struct dentry *dentry); |
| 396 | extern void nfs_complete_unlink(struct dentry *dentry, struct inode *); | 402 | extern void nfs_complete_unlink(struct dentry *dentry, struct inode *); |
| 403 | extern void nfs_block_sillyrename(struct dentry *dentry); | ||
| 404 | extern void nfs_unblock_sillyrename(struct dentry *dentry); | ||
| 397 | 405 | ||
| 398 | /* | 406 | /* |
| 399 | * linux/fs/nfs/write.c | 407 | * linux/fs/nfs/write.c |
diff --git a/include/linux/prefetch.h b/include/linux/prefetch.h index 1adfe668d031..af7c36a5a521 100644 --- a/include/linux/prefetch.h +++ b/include/linux/prefetch.h | |||
| @@ -34,17 +34,12 @@ | |||
| 34 | 34 | ||
| 35 | */ | 35 | */ |
| 36 | 36 | ||
| 37 | /* | ||
| 38 | * These cannot be do{}while(0) macros. See the mental gymnastics in | ||
| 39 | * the loop macro. | ||
| 40 | */ | ||
| 41 | |||
| 42 | #ifndef ARCH_HAS_PREFETCH | 37 | #ifndef ARCH_HAS_PREFETCH |
| 43 | static inline void prefetch(const void *x) {;} | 38 | #define prefetch(x) __builtin_prefetch(x) |
| 44 | #endif | 39 | #endif |
| 45 | 40 | ||
| 46 | #ifndef ARCH_HAS_PREFETCHW | 41 | #ifndef ARCH_HAS_PREFETCHW |
| 47 | static inline void prefetchw(const void *x) {;} | 42 | #define prefetchw(x) __builtin_prefetch(x,1) |
| 48 | #endif | 43 | #endif |
| 49 | 44 | ||
| 50 | #ifndef ARCH_HAS_SPINLOCK_PREFETCH | 45 | #ifndef ARCH_HAS_SPINLOCK_PREFETCH |
diff --git a/kernel/Makefile b/kernel/Makefile index 05c3e6df8597..79f017e09fbd 100644 --- a/kernel/Makefile +++ b/kernel/Makefile | |||
| @@ -9,8 +9,9 @@ obj-y = sched.o fork.o exec_domain.o panic.o printk.o profile.o \ | |||
| 9 | rcupdate.o extable.o params.o posix-timers.o \ | 9 | rcupdate.o extable.o params.o posix-timers.o \ |
| 10 | kthread.o wait.o kfifo.o sys_ni.o posix-cpu-timers.o mutex.o \ | 10 | kthread.o wait.o kfifo.o sys_ni.o posix-cpu-timers.o mutex.o \ |
| 11 | hrtimer.o rwsem.o latency.o nsproxy.o srcu.o \ | 11 | hrtimer.o rwsem.o latency.o nsproxy.o srcu.o \ |
| 12 | utsname.o sysctl_check.o notifier.o | 12 | utsname.o notifier.o |
| 13 | 13 | ||
| 14 | obj-$(CONFIG_SYSCTL) += sysctl_check.o | ||
| 14 | obj-$(CONFIG_STACKTRACE) += stacktrace.o | 15 | obj-$(CONFIG_STACKTRACE) += stacktrace.o |
| 15 | obj-y += time/ | 16 | obj-y += time/ |
| 16 | obj-$(CONFIG_DEBUG_MUTEXES) += mutex-debug.o | 17 | obj-$(CONFIG_DEBUG_MUTEXES) += mutex-debug.o |
diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include index de7bb284c611..b96ea8d6a5ed 100644 --- a/scripts/Kbuild.include +++ b/scripts/Kbuild.include | |||
| @@ -56,6 +56,17 @@ endef | |||
| 56 | # gcc support functions | 56 | # gcc support functions |
| 57 | # See documentation in Documentation/kbuild/makefiles.txt | 57 | # See documentation in Documentation/kbuild/makefiles.txt |
| 58 | 58 | ||
| 59 | # cc-cross-prefix | ||
| 60 | # Usage: CROSS_COMPILE := $(call cc-cross-prefix, m68k-linux-gnu- m68k-linux-) | ||
| 61 | # Return first prefix where a prefix$(CC) is found in PATH. | ||
| 62 | # If no $(CC) found in PATH with listed prefixes return nothing | ||
| 63 | cc-cross-prefix = \ | ||
| 64 | $(word 1, $(foreach c,$(1), \ | ||
| 65 | $(shell set -e; \ | ||
| 66 | if (which $(strip $(c))$(CC)) > /dev/null 2>&1 ; then \ | ||
| 67 | echo $(c); \ | ||
| 68 | fi))) | ||
| 69 | |||
| 59 | # output directory for tests below | 70 | # output directory for tests below |
| 60 | TMPOUT := $(if $(KBUILD_EXTMOD),$(firstword $(KBUILD_EXTMOD))/) | 71 | TMPOUT := $(if $(KBUILD_EXTMOD),$(firstword $(KBUILD_EXTMOD))/) |
| 61 | 72 | ||
diff --git a/scripts/basic/docproc.c b/scripts/basic/docproc.c index e5c6ac7bde9b..0e4bd5459df4 100644 --- a/scripts/basic/docproc.c +++ b/scripts/basic/docproc.c | |||
| @@ -66,12 +66,15 @@ FILELINE * entity_system; | |||
| 66 | #define FUNCTION "-function" | 66 | #define FUNCTION "-function" |
| 67 | #define NOFUNCTION "-nofunction" | 67 | #define NOFUNCTION "-nofunction" |
| 68 | 68 | ||
| 69 | char *srctree; | ||
| 70 | |||
| 69 | void usage (void) | 71 | void usage (void) |
| 70 | { | 72 | { |
| 71 | fprintf(stderr, "Usage: docproc {doc|depend} file\n"); | 73 | fprintf(stderr, "Usage: docproc {doc|depend} file\n"); |
| 72 | fprintf(stderr, "Input is read from file.tmpl. Output is sent to stdout\n"); | 74 | fprintf(stderr, "Input is read from file.tmpl. Output is sent to stdout\n"); |
| 73 | fprintf(stderr, "doc: frontend when generating kernel documentation\n"); | 75 | fprintf(stderr, "doc: frontend when generating kernel documentation\n"); |
| 74 | fprintf(stderr, "depend: generate list of files referenced within file\n"); | 76 | fprintf(stderr, "depend: generate list of files referenced within file\n"); |
| 77 | fprintf(stderr, "Environment variable SRCTREE: absolute path to kernel source tree.\n"); | ||
| 75 | } | 78 | } |
| 76 | 79 | ||
| 77 | /* | 80 | /* |
| @@ -90,7 +93,7 @@ void exec_kernel_doc(char **svec) | |||
| 90 | exit(1); | 93 | exit(1); |
| 91 | case 0: | 94 | case 0: |
| 92 | memset(real_filename, 0, sizeof(real_filename)); | 95 | memset(real_filename, 0, sizeof(real_filename)); |
| 93 | strncat(real_filename, getenv("SRCTREE"), PATH_MAX); | 96 | strncat(real_filename, srctree, PATH_MAX); |
| 94 | strncat(real_filename, KERNELDOCPATH KERNELDOC, | 97 | strncat(real_filename, KERNELDOCPATH KERNELDOC, |
| 95 | PATH_MAX - strlen(real_filename)); | 98 | PATH_MAX - strlen(real_filename)); |
| 96 | execvp(real_filename, svec); | 99 | execvp(real_filename, svec); |
| @@ -171,7 +174,7 @@ void find_export_symbols(char * filename) | |||
| 171 | if (filename_exist(filename) == NULL) { | 174 | if (filename_exist(filename) == NULL) { |
| 172 | char real_filename[PATH_MAX + 1]; | 175 | char real_filename[PATH_MAX + 1]; |
| 173 | memset(real_filename, 0, sizeof(real_filename)); | 176 | memset(real_filename, 0, sizeof(real_filename)); |
| 174 | strncat(real_filename, getenv("SRCTREE"), PATH_MAX); | 177 | strncat(real_filename, srctree, PATH_MAX); |
| 175 | strncat(real_filename, filename, | 178 | strncat(real_filename, filename, |
| 176 | PATH_MAX - strlen(real_filename)); | 179 | PATH_MAX - strlen(real_filename)); |
| 177 | sym = add_new_file(filename); | 180 | sym = add_new_file(filename); |
| @@ -338,6 +341,10 @@ void parse_file(FILE *infile) | |||
| 338 | int main(int argc, char *argv[]) | 341 | int main(int argc, char *argv[]) |
| 339 | { | 342 | { |
| 340 | FILE * infile; | 343 | FILE * infile; |
| 344 | |||
| 345 | srctree = getenv("SRCTREE"); | ||
| 346 | if (!srctree) | ||
| 347 | srctree = getcwd(NULL, 0); | ||
| 341 | if (argc != 3) { | 348 | if (argc != 3) { |
| 342 | usage(); | 349 | usage(); |
| 343 | exit(1); | 350 | exit(1); |
diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile index bb08069b04af..83c5e76414ce 100644 --- a/scripts/kconfig/Makefile +++ b/scripts/kconfig/Makefile | |||
| @@ -84,7 +84,7 @@ help: | |||
| 84 | # lxdialog stuff | 84 | # lxdialog stuff |
| 85 | check-lxdialog := $(srctree)/$(src)/lxdialog/check-lxdialog.sh | 85 | check-lxdialog := $(srctree)/$(src)/lxdialog/check-lxdialog.sh |
| 86 | 86 | ||
| 87 | # Use reursively expanded variables so we do not call gcc unless | 87 | # Use recursively expanded variables so we do not call gcc unless |
| 88 | # we really need to do so. (Do not call gcc as part of make mrproper) | 88 | # we really need to do so. (Do not call gcc as part of make mrproper) |
| 89 | HOST_EXTRACFLAGS = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ccflags) | 89 | HOST_EXTRACFLAGS = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ccflags) |
| 90 | HOST_LOADLIBES = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags $(HOSTCC)) | 90 | HOST_LOADLIBES = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags $(HOSTCC)) |
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index 2ef9a193fcae..93ac52adb498 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c | |||
| @@ -268,6 +268,9 @@ static struct symbol *sym_add_exported(const char *name, struct module *mod, | |||
| 268 | "was in %s%s\n", mod->name, name, | 268 | "was in %s%s\n", mod->name, name, |
| 269 | s->module->name, | 269 | s->module->name, |
| 270 | is_vmlinux(s->module->name) ?"":".ko"); | 270 | is_vmlinux(s->module->name) ?"":".ko"); |
| 271 | } else { | ||
| 272 | /* In case Modules.symvers was out of date */ | ||
| 273 | s->module = mod; | ||
| 271 | } | 274 | } |
| 272 | } | 275 | } |
| 273 | s->preloaded = 0; | 276 | s->preloaded = 0; |
diff --git a/scripts/package/builddeb b/scripts/package/builddeb index 6edb29f2b4a6..0f657b5f3bc8 100644 --- a/scripts/package/builddeb +++ b/scripts/package/builddeb | |||
| @@ -83,6 +83,7 @@ Maintainer: $name | |||
| 83 | Standards-Version: 3.6.1 | 83 | Standards-Version: 3.6.1 |
| 84 | 84 | ||
| 85 | Package: $packagename | 85 | Package: $packagename |
| 86 | Provides: kernel-image-$version, linux-image-$version | ||
| 86 | Architecture: any | 87 | Architecture: any |
| 87 | Description: User Mode Linux kernel, version $version | 88 | Description: User Mode Linux kernel, version $version |
| 88 | User-mode Linux is a port of the Linux kernel to its own system call | 89 | User-mode Linux is a port of the Linux kernel to its own system call |
| @@ -104,6 +105,7 @@ Maintainer: $name | |||
| 104 | Standards-Version: 3.6.1 | 105 | Standards-Version: 3.6.1 |
| 105 | 106 | ||
| 106 | Package: $packagename | 107 | Package: $packagename |
| 108 | Provides: kernel-image-$version, linux-image-$version | ||
| 107 | Architecture: any | 109 | Architecture: any |
| 108 | Description: Linux kernel, version $version | 110 | Description: Linux kernel, version $version |
| 109 | This package contains the Linux kernel, modules and corresponding other | 111 | This package contains the Linux kernel, modules and corresponding other |
